From ca805dee239f0eb657bc0a37d7b40e076e75f8bb Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Sat, 30 Nov 2024 19:31:19 +0100 Subject: [PATCH 001/853] Created the Random FriendlyFire --- KruacentE.Misc/Config.cs | 17 ++++++++++++ KruacentE.Misc/KE.Misc.csproj | 32 ++++++++++++++++++++++ KruacentE.Misc/KE.Misc.sln | 22 +++++++++++++++ KruacentE.Misc/MainPlugin.cs | 48 +++++++++++++++++++++++++++++++++ KruacentE.Misc/README.md | 8 ++++++ KruacentE.Misc/ServerHandler.cs | 18 +++++++++++++ 6 files changed, 145 insertions(+) create mode 100644 KruacentE.Misc/Config.cs create mode 100644 KruacentE.Misc/KE.Misc.csproj create mode 100644 KruacentE.Misc/KE.Misc.sln create mode 100644 KruacentE.Misc/MainPlugin.cs create mode 100644 KruacentE.Misc/README.md create mode 100644 KruacentE.Misc/ServerHandler.cs diff --git a/KruacentE.Misc/Config.cs b/KruacentE.Misc/Config.cs new file mode 100644 index 00000000..d5abd96b --- /dev/null +++ b/KruacentE.Misc/Config.cs @@ -0,0 +1,17 @@ +using Exiled.API.Interfaces; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace KE.Misc +{ + public class Config : IConfig + { + public bool IsEnabled { get; set; } = true; + public bool Debug { get; set; } = true; + + public int ChanceFF { get; set; } = 50; + } +} diff --git a/KruacentE.Misc/KE.Misc.csproj b/KruacentE.Misc/KE.Misc.csproj new file mode 100644 index 00000000..ded80437 --- /dev/null +++ b/KruacentE.Misc/KE.Misc.csproj @@ -0,0 +1,32 @@ + + + + net48 + + + + + + + + + C:\Program Files (x86)\Steam\steamapps\common\SCP Secret Laboratory Dedicated Server\SCPSL_Data\Managed\Assembly-CSharp-firstpass.dll + + + C:\Program Files (x86)\Steam\steamapps\common\SCP Secret Laboratory Dedicated Server\SCPSL_Data\Managed\Mirror.dll + + + C:\Program Files (x86)\Steam\steamapps\common\SCP Secret Laboratory Dedicated Server\SCPSL_Data\Managed\System.ComponentModel.Composition.dll + + + C:\Program Files (x86)\Steam\steamapps\common\SCP Secret Laboratory Dedicated Server\SCPSL_Data\Managed\UnityEngine.dll + + + C:\Program Files (x86)\Steam\steamapps\common\SCP Secret Laboratory Dedicated Server\SCPSL_Data\Managed\UnityEngine.CoreModule.dll + + + C:\Program Files (x86)\Steam\steamapps\common\SCP Secret Laboratory Dedicated Server\SCPSL_Data\Managed\UnityEngine.PhysicsModule.dll + + + + diff --git a/KruacentE.Misc/KE.Misc.sln b/KruacentE.Misc/KE.Misc.sln new file mode 100644 index 00000000..a826aa28 --- /dev/null +++ b/KruacentE.Misc/KE.Misc.sln @@ -0,0 +1,22 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.12.35506.116 d17.12 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "KE.Misc", "KE.Misc.csproj", "{1653A566-B1B3-49C1-A331-7FD600A6C118}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {1653A566-B1B3-49C1-A331-7FD600A6C118}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {1653A566-B1B3-49C1-A331-7FD600A6C118}.Debug|Any CPU.Build.0 = Debug|Any CPU + {1653A566-B1B3-49C1-A331-7FD600A6C118}.Release|Any CPU.ActiveCfg = Release|Any CPU + {1653A566-B1B3-49C1-A331-7FD600A6C118}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/KruacentE.Misc/MainPlugin.cs b/KruacentE.Misc/MainPlugin.cs new file mode 100644 index 00000000..238624a1 --- /dev/null +++ b/KruacentE.Misc/MainPlugin.cs @@ -0,0 +1,48 @@ +using Exiled.API.Features; +using ServerHandle = Exiled.Events.Handlers.Server; + +namespace KE.Misc +{ + public class MainPlugin : Plugin + { + internal static MainPlugin Instance { get; private set; } + private ServerHandler serverHandler; + + public override void OnEnabled() + { + Instance = this; + + serverHandler = new ServerHandler(); + ServerHandle.RoundStarted += serverHandler.OnRoundStarted; + } + + public override void OnDisabled() + { + + ServerHandle.RoundStarted -= serverHandler.OnRoundStarted; + + + serverHandler = null; + + Instance = null; + } + + + + + internal void RandomFF() + { + if(UnityEngine.Random.Range(0,101) < Instance.Config.ChanceFF) + { + Server.FriendlyFire = true; + } + else + { + Server.FriendlyFire = false; + } + Log.Debug($"Friendly Fire : {Exiled.API.Features.Server.FriendlyFire}"); + } + + + } +} diff --git a/KruacentE.Misc/README.md b/KruacentE.Misc/README.md new file mode 100644 index 00000000..cbe31475 --- /dev/null +++ b/KruacentE.Misc/README.md @@ -0,0 +1,8 @@ +# Misc Plugin + +This plugin add all of the other feature. + +## Random FriendlyFire + +Each round, there is a chance (50% by default) to have the Friendly Fire enabled. + diff --git a/KruacentE.Misc/ServerHandler.cs b/KruacentE.Misc/ServerHandler.cs new file mode 100644 index 00000000..f2eb1044 --- /dev/null +++ b/KruacentE.Misc/ServerHandler.cs @@ -0,0 +1,18 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace KE.Misc +{ + internal class ServerHandler + { + public void OnRoundStarted() + { + MainPlugin.Instance.RandomFF(); + + + } + } +} From d1de85f076341a466cc4f3426d02fc6fd4f73ca4 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Mon, 2 Dec 2024 06:49:52 +0100 Subject: [PATCH 002/853] started nuke annoucement --- KruacentE.Misc/MainPlugin.cs | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/KruacentE.Misc/MainPlugin.cs b/KruacentE.Misc/MainPlugin.cs index 238624a1..a6247dc0 100644 --- a/KruacentE.Misc/MainPlugin.cs +++ b/KruacentE.Misc/MainPlugin.cs @@ -1,4 +1,6 @@ -using Exiled.API.Features; +using Exiled.API.Enums; +using Exiled.API.Features; +using System.Collections.Generic; using ServerHandle = Exiled.Events.Handlers.Server; namespace KE.Misc @@ -40,7 +42,14 @@ internal void RandomFF() { Server.FriendlyFire = false; } - Log.Debug($"Friendly Fire : {Exiled.API.Features.Server.FriendlyFire}"); + Log.Debug($"Friendly Fire : {Server.FriendlyFire}"); + } + + + internal IEnumerable Nuke() + { + + yield return 0; } From e8a203cd1c93dd315f72ebb69581a4f3142a5b2f Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Mon, 2 Dec 2024 11:58:41 +0100 Subject: [PATCH 003/853] Autonuke announcement --- KruacentE.Misc/MainPlugin.cs | 8 +++++--- KruacentE.Misc/ServerHandler.cs | 4 ++-- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/KruacentE.Misc/MainPlugin.cs b/KruacentE.Misc/MainPlugin.cs index a6247dc0..b38b1f62 100644 --- a/KruacentE.Misc/MainPlugin.cs +++ b/KruacentE.Misc/MainPlugin.cs @@ -2,6 +2,7 @@ using Exiled.API.Features; using System.Collections.Generic; using ServerHandle = Exiled.Events.Handlers.Server; +using MEC; namespace KE.Misc { @@ -46,10 +47,11 @@ internal void RandomFF() } - internal IEnumerable Nuke() + internal IEnumerator NukeAnnouncement() { - - yield return 0; + yield return Timing.WaitUntilTrue(() => 25 <= Round.ElapsedTime.TotalMinutes); + Cassie.MessageTranslated("Warning automatic warhead will detonate in 5 minutes", + "Warning automatic warhead will detonate in 5 minutes"); } diff --git a/KruacentE.Misc/ServerHandler.cs b/KruacentE.Misc/ServerHandler.cs index f2eb1044..bfaba869 100644 --- a/KruacentE.Misc/ServerHandler.cs +++ b/KruacentE.Misc/ServerHandler.cs @@ -3,6 +3,7 @@ using System.Linq; using System.Text; using System.Threading.Tasks; +using MEC; namespace KE.Misc { @@ -11,8 +12,7 @@ internal class ServerHandler public void OnRoundStarted() { MainPlugin.Instance.RandomFF(); - - + Timing.RunCoroutine(MainPlugin.Instance.NukeAnnouncement()); } } } From cba2e1ddde95a71eaa8d61dc885e3fd497a525aa Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Mon, 2 Dec 2024 12:24:28 +0100 Subject: [PATCH 004/853] PeanutLockdown done --- KruacentE.Misc/MainPlugin.cs | 13 +++++++++++++ KruacentE.Misc/ServerHandler.cs | 1 + 2 files changed, 14 insertions(+) diff --git a/KruacentE.Misc/MainPlugin.cs b/KruacentE.Misc/MainPlugin.cs index b38b1f62..a4af30cd 100644 --- a/KruacentE.Misc/MainPlugin.cs +++ b/KruacentE.Misc/MainPlugin.cs @@ -3,6 +3,8 @@ using System.Collections.Generic; using ServerHandle = Exiled.Events.Handlers.Server; using MEC; +using Exiled.API.Features.Doors; +using System.Linq; namespace KE.Misc { @@ -53,6 +55,17 @@ internal IEnumerator NukeAnnouncement() Cassie.MessageTranslated("Warning automatic warhead will detonate in 5 minutes", "Warning automatic warhead will detonate in 5 minutes"); } + + + internal IEnumerator PeanutLockdown() + { + Door peanutDoor = Door.List.ToList().Where(x => x.Type == DoorType.Scp173NewGate).ToList()[0]; + peanutDoor.IsOpen = false; + peanutDoor.ChangeLock(DoorLockType.Lockdown2176); + yield return Timing.WaitForSeconds(135-Player.List.Count*15); + peanutDoor.IsOpen = true; + peanutDoor.Unlock(); + } } diff --git a/KruacentE.Misc/ServerHandler.cs b/KruacentE.Misc/ServerHandler.cs index bfaba869..330c3ced 100644 --- a/KruacentE.Misc/ServerHandler.cs +++ b/KruacentE.Misc/ServerHandler.cs @@ -13,6 +13,7 @@ public void OnRoundStarted() { MainPlugin.Instance.RandomFF(); Timing.RunCoroutine(MainPlugin.Instance.NukeAnnouncement()); + Timing.RunCoroutine(MainPlugin.Instance.PeanutLockdown()); } } } From 8a5fd0df80011ee9c01fb5c8342e3ba402aaf1c4 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Mon, 2 Dec 2024 13:26:16 +0100 Subject: [PATCH 005/853] Finished the auto Elevator --- KruacentE.Misc/Config.cs | 14 ++++++++------ KruacentE.Misc/MainPlugin.cs | 15 +++++++++++++++ KruacentE.Misc/ServerHandler.cs | 11 ++++++++--- 3 files changed, 31 insertions(+), 9 deletions(-) diff --git a/KruacentE.Misc/Config.cs b/KruacentE.Misc/Config.cs index d5abd96b..4d73a023 100644 --- a/KruacentE.Misc/Config.cs +++ b/KruacentE.Misc/Config.cs @@ -1,9 +1,5 @@ using Exiled.API.Interfaces; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; +using System.ComponentModel; namespace KE.Misc { @@ -11,7 +7,13 @@ public class Config : IConfig { public bool IsEnabled { get; set; } = true; public bool Debug { get; set; } = true; - + [Description("Chance that the friendly fire is enabled at the start of the round (set 0 to disable)")] public int ChanceFF { get; set; } = 50; + [Description("Enable or disable the auto-nuke annoucement")] + public bool AutoNukeAnnoucement { get; set; } = true; + [Description("Enable or disable the lockdown of SCP-173")] + public bool PeanutLockDown { get; set; } = true; + [Description("Enable or disable the auto elevator")] + public bool AutoElevator { get; set; } = true; } } diff --git a/KruacentE.Misc/MainPlugin.cs b/KruacentE.Misc/MainPlugin.cs index a4af30cd..657ce67f 100644 --- a/KruacentE.Misc/MainPlugin.cs +++ b/KruacentE.Misc/MainPlugin.cs @@ -67,6 +67,21 @@ internal IEnumerator PeanutLockdown() peanutDoor.Unlock(); } + internal IEnumerator AutoElevator() + { + while (!Round.IsEnded) + { + foreach (Lift l in Lift.List) + { + yield return Timing.WaitForSeconds(UnityEngine.Random.Range(30,45)); + SendElevator(l); + } + } + } + private void SendElevator(Lift e) + { + e.TryStart(0, true); + } } } diff --git a/KruacentE.Misc/ServerHandler.cs b/KruacentE.Misc/ServerHandler.cs index 330c3ced..3b2fb11a 100644 --- a/KruacentE.Misc/ServerHandler.cs +++ b/KruacentE.Misc/ServerHandler.cs @@ -11,9 +11,14 @@ internal class ServerHandler { public void OnRoundStarted() { - MainPlugin.Instance.RandomFF(); - Timing.RunCoroutine(MainPlugin.Instance.NukeAnnouncement()); - Timing.RunCoroutine(MainPlugin.Instance.PeanutLockdown()); + if(MainPlugin.Instance.Config.ChanceFF >= 0 && MainPlugin.Instance.Config.ChanceFF <= 100) + MainPlugin.Instance.RandomFF(); + if(MainPlugin.Instance.Config.AutoNukeAnnoucement) + Timing.RunCoroutine(MainPlugin.Instance.NukeAnnouncement()); + if(MainPlugin.Instance.Config.PeanutLockDown) + Timing.RunCoroutine(MainPlugin.Instance.PeanutLockdown()); + if(MainPlugin.Instance.Config.AutoElevator) + Timing.RunCoroutine(MainPlugin.Instance.AutoElevator()); } } } From 45f1fe47534d503a0170ffc3616ed2b4b225b03c Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Mon, 2 Dec 2024 13:40:48 +0100 Subject: [PATCH 006/853] readme updated --- KruacentE.Misc/README.md | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/KruacentE.Misc/README.md b/KruacentE.Misc/README.md index cbe31475..79b9d8a2 100644 --- a/KruacentE.Misc/README.md +++ b/KruacentE.Misc/README.md @@ -1,8 +1,14 @@ # Misc Plugin - This plugin add all of the other feature. ## Random FriendlyFire - Each round, there is a chance (50% by default) to have the Friendly Fire enabled. +## Auto-nuke Annoucement +C.A.S.S.I.E. make an announcement when the auto-nuke + +## Peanut Lockdown +Peanut is locked down in its containment for a limited amount of time because + +## Auto Elevator +Elevator automaticly goes up and down \ No newline at end of file From 324b23f31b15c1b2102484a26dc9468efdb94f81 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9COmer?= <“27omerf@gmail.com”> Date: Mon, 2 Dec 2024 15:42:41 +0100 Subject: [PATCH 007/853] [ITEM] Defibrilator : Allow to revive a unconscious person. --- KruacentE.Items/Items/Defibrilator.cs | 128 ++++++++++++++++++++++++++ 1 file changed, 128 insertions(+) create mode 100644 KruacentE.Items/Items/Defibrilator.cs diff --git a/KruacentE.Items/Items/Defibrilator.cs b/KruacentE.Items/Items/Defibrilator.cs new file mode 100644 index 00000000..41a99a04 --- /dev/null +++ b/KruacentE.Items/Items/Defibrilator.cs @@ -0,0 +1,128 @@ +using System.Collections.Concurrent; +using System.Collections.Generic; +using Exiled.API.Enums; +using Exiled.API.Features.Attributes; +using Exiled.API.Features.Spawn; +using Exiled.CustomItems.API.Features; +using MEC; +using Exiled.Events.EventArgs.Player; +using Exiled.API.Features; +using UnityEngine; +using System.Linq; +[CustomItem(ItemType.SCP1853)] + +public class Defibrilator : CustomItem +{ + public override uint Id { get; set; } = 20; + public override string Name { get; set; } = "DF-001"; + public override string Description { get; set; } = "Voici un défibrillateur, utilisez-le sur une personne que vous voulez réanimer. Utilisable uniquement pendant les 10 premières secondes après la perte de conscience de la personne. Utilisez-le lorsque vous êtes dans la même pièce que la personne."; + public override float Weight { get; set; } = 0.65f; + + private ConcurrentDictionary positionMort = new ConcurrentDictionary(); + + public override SpawnProperties SpawnProperties { get; set; } = new SpawnProperties() + { + Limit = 2, + DynamicSpawnPoints = new List + { + new DynamicSpawnPoint() { Chance = 100, Location = SpawnLocationType.Inside079Secondary }, + new DynamicSpawnPoint() { Chance = 10, Location = SpawnLocationType.InsideHidRight }, + new DynamicSpawnPoint() { Chance = 10, Location = SpawnLocationType.InsideHidLeft }, + }, + }; + + protected override void SubscribeEvents() + { + Exiled.Events.Handlers.Player.UsedItem += OnUsingItem; + Exiled.Events.Handlers.Player.Dying += OnDeathEvent; + Exiled.Events.Handlers.Player.Spawned += OnSpawningEvent; + base.SubscribeEvents(); + } + + protected override void UnsubscribeEvents() + { + Exiled.Events.Handlers.Player.UsedItem -= OnUsingItem; + Exiled.Events.Handlers.Player.Dying -= OnDeathEvent; + Exiled.Events.Handlers.Player.Spawned -= OnSpawningEvent; + base.UnsubscribeEvents(); + } + + private void OnDeathEvent(DyingEventArgs ev) + { + Log.Debug(positionMort.Count()); + Log.Debug(ev.Player.Nickname); + positionMort.TryAdd(ev.Player, ev.Player.Position); + Log.Debug(positionMort.Count()); + Log.Debug("Role : " + ev.Player.Role); + } + + private void OnSpawningEvent(SpawnedEventArgs ev) + { + if (ev.Player.IsAlive) + { + Log.Debug("Enlèvement du joueur"); + positionMort.TryRemove(ev.Player, out _); + } + } + + private void OnUsingItem(UsedItemEventArgs ev) + { + if (TryGet(ev.Item, out var result) && result.Id == 20) + { + Timing.CallDelayed(0.5f, () => + { + ev.Player.DisableEffect(EffectType.Scp1853); + Timing.RunCoroutine(EffectAttribution(ev.Player)); + }); + } + } + + private IEnumerator EffectAttribution(Player joueur) + { + Log.Debug("Utilisation item"); + Log.Debug("Nombre de mort : " + positionMort.Count()); + + if (positionMort.Count == 0) + { + joueur.Broadcast(5, "Il n'y a pas de morts actuellement.", Broadcast.BroadcastFlags.Normal, true); + Exiled.CustomItems.API.Features.CustomItem.TryGive(joueur, 20); + } + else + { + var playerPosition = joueur.Position; + + Exiled.API.Features.Player closestDeadPlayer = null; + float shortestDistance = float.MaxValue; + + foreach (var dead in positionMort) + { + float distance = Vector3.Distance(playerPosition, dead.Value); + + + if (distance < shortestDistance) + { + shortestDistance = distance; + closestDeadPlayer = dead.Key; + } + } + + if (closestDeadPlayer != null) + { + Log.Debug($"Le joueur mort le plus proche est à une distance de {shortestDistance:F2} unités. C'est : " + closestDeadPlayer.Nickname); + + closestDeadPlayer.IsGodModeEnabled = true; + closestDeadPlayer.Role.Set(joueur.Role); + closestDeadPlayer.Health = 10; + + closestDeadPlayer.Teleport(joueur.Position); + + closestDeadPlayer.Broadcast(5, joueur.Nickname + " t'as réanimé !", Broadcast.BroadcastFlags.Normal, true); + joueur.Broadcast(5, "Tu as réanimé " + closestDeadPlayer.Nickname + " !", Broadcast.BroadcastFlags.Normal, true); + + yield return Timing.WaitForSeconds(1); + + closestDeadPlayer.IsGodModeEnabled = false; + } + } + } +} \ No newline at end of file From 3aad4bbabae4bef952d524370d98c86a12ac152c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9COmer?= <“27omerf@gmail.com”> Date: Mon, 2 Dec 2024 15:43:19 +0100 Subject: [PATCH 008/853] [ITEM] The Defibrilator : Allow to revive a unconscious person. (SCP or Human). --- KruacentE.Items/Items/Defibrilator.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/KruacentE.Items/Items/Defibrilator.cs b/KruacentE.Items/Items/Defibrilator.cs index 41a99a04..e5eb798e 100644 --- a/KruacentE.Items/Items/Defibrilator.cs +++ b/KruacentE.Items/Items/Defibrilator.cs @@ -15,7 +15,7 @@ public class Defibrilator : CustomItem { public override uint Id { get; set; } = 20; public override string Name { get; set; } = "DF-001"; - public override string Description { get; set; } = "Voici un défibrillateur, utilisez-le sur une personne que vous voulez réanimer. Utilisable uniquement pendant les 10 premières secondes après la perte de conscience de la personne. Utilisez-le lorsque vous êtes dans la même pièce que la personne."; + public override string Description { get; set; } = "Le défibrilateur, il permet de réanimer une personne qui à une perte de conscience, on va réanimer la personne la plus proche du joueur qui l'utilise (le lieu de mort et non où se trouve le corps)"; public override float Weight { get; set; } = 0.65f; private ConcurrentDictionary positionMort = new ConcurrentDictionary(); From 5fad0aa36d1e42426a2d4fe3f29e6c00d6e01806 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Tue, 3 Dec 2024 09:22:47 +0100 Subject: [PATCH 009/853] Finished RandomSpawn --- .../GEFE.Examples/GE/RandomSpawn.cs | 38 +++++++++++++++++++ KruacentE.GlobalEventFramework/GEFExiled.sln | 25 ++++++++++++ 2 files changed, 63 insertions(+) create mode 100644 KruacentE.GlobalEventFramework/GEFE.Examples/GE/RandomSpawn.cs create mode 100644 KruacentE.GlobalEventFramework/GEFExiled.sln diff --git a/KruacentE.GlobalEventFramework/GEFE.Examples/GE/RandomSpawn.cs b/KruacentE.GlobalEventFramework/GEFE.Examples/GE/RandomSpawn.cs new file mode 100644 index 00000000..36c645f8 --- /dev/null +++ b/KruacentE.GlobalEventFramework/GEFE.Examples/GE/RandomSpawn.cs @@ -0,0 +1,38 @@ +using Exiled.API.Features; +using GEFExiled.GEFE.API.Features; +using PlayerRoles; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace GEFExiled.GEFE.Examples.GE +{ + public class RandomSpawn : GlobalEvent + { + public override int Id { get; set; } = 32; + public override string Name { get; set; } = "RandomSpawn"; + public override string Description { get; set; } = "Les spawns sont random"; + public override double Weight { get; set; } = 1; + public override IEnumerator Start() + { + Room room = Room.Random(); + foreach (RoleTypeId r in Enum.GetValues(typeof(RoleTypeId))) + { + foreach (Player p in Player.List) + { + + if (p.Role == r) + { + p.Teleport(room); + } + + } + room = Room.Random(); + } + yield return 0; + } + + } +} diff --git a/KruacentE.GlobalEventFramework/GEFExiled.sln b/KruacentE.GlobalEventFramework/GEFExiled.sln new file mode 100644 index 00000000..d4cc1296 --- /dev/null +++ b/KruacentE.GlobalEventFramework/GEFExiled.sln @@ -0,0 +1,25 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.11.35222.181 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "GEFExiled", "GEFExiled.csproj", "{C3D1358D-F7B6-48A0-8344-3917D6572980}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {C3D1358D-F7B6-48A0-8344-3917D6572980}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {C3D1358D-F7B6-48A0-8344-3917D6572980}.Debug|Any CPU.Build.0 = Debug|Any CPU + {C3D1358D-F7B6-48A0-8344-3917D6572980}.Release|Any CPU.ActiveCfg = Release|Any CPU + {C3D1358D-F7B6-48A0-8344-3917D6572980}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {42FD0DA0-321B-4DCB-BD21-C300DD7D64A3} + EndGlobalSection +EndGlobal From 1179b7b85339e9752d8cfb6c2eb34c50ce3fee7b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9COmer?= <“27omerf@gmail.com”> Date: Tue, 3 Dec 2024 09:28:53 +0100 Subject: [PATCH 010/853] [ADD] D-Boy Cells can explode. --- KruacentE.Misc/Config.cs | 5 +++++ KruacentE.Misc/MainPlugin.cs | 24 +++++++++++++++++++++++- KruacentE.Misc/ServerHandler.cs | 2 ++ 3 files changed, 30 insertions(+), 1 deletion(-) diff --git a/KruacentE.Misc/Config.cs b/KruacentE.Misc/Config.cs index 4d73a023..fbc26af2 100644 --- a/KruacentE.Misc/Config.cs +++ b/KruacentE.Misc/Config.cs @@ -10,6 +10,11 @@ public class Config : IConfig [Description("Chance that the friendly fire is enabled at the start of the round (set 0 to disable)")] public int ChanceFF { get; set; } = 50; [Description("Enable or disable the auto-nuke annoucement")] + + public int ChanceClassDDoorGoesBoom { get; set; } = 2; + [Description("Chance to d-boy doors goes boom")] + + public bool AutoNukeAnnoucement { get; set; } = true; [Description("Enable or disable the lockdown of SCP-173")] public bool PeanutLockDown { get; set; } = true; diff --git a/KruacentE.Misc/MainPlugin.cs b/KruacentE.Misc/MainPlugin.cs index 657ce67f..235e3b0c 100644 --- a/KruacentE.Misc/MainPlugin.cs +++ b/KruacentE.Misc/MainPlugin.cs @@ -5,6 +5,8 @@ using MEC; using Exiled.API.Features.Doors; using System.Linq; +using Exiled.API.Features.Doors; +using Exiled.API.Interfaces; namespace KE.Misc { @@ -32,7 +34,27 @@ public override void OnDisabled() Instance = null; } - + internal void ClassDDoorGoesBoom() + { + if (UnityEngine.Random.Range(0, 101) < Instance.Config.ChanceClassDDoorGoesBoom) + { + foreach (Door door in Door.List) + { + if (door.Type == DoorType.PrisonDoor) + { + if (door is IDamageableDoor dBoyDoor && !dBoyDoor.IsDestroyed) + { + dBoyDoor.Break(); + Log.Debug("Les portes kaboom"); + } + } + } + } + else + { + Log.Debug("Les portes ne kaboom pas"); + } + } internal void RandomFF() diff --git a/KruacentE.Misc/ServerHandler.cs b/KruacentE.Misc/ServerHandler.cs index 3b2fb11a..f1775a57 100644 --- a/KruacentE.Misc/ServerHandler.cs +++ b/KruacentE.Misc/ServerHandler.cs @@ -13,6 +13,8 @@ public void OnRoundStarted() { if(MainPlugin.Instance.Config.ChanceFF >= 0 && MainPlugin.Instance.Config.ChanceFF <= 100) MainPlugin.Instance.RandomFF(); + if (MainPlugin.Instance.Config.ChanceClassDDoorGoesBoom >= 0 && MainPlugin.Instance.Config.ChanceClassDDoorGoesBoom <= 100) + MainPlugin.Instance.ClassDDoorGoesBoom(); if(MainPlugin.Instance.Config.AutoNukeAnnoucement) Timing.RunCoroutine(MainPlugin.Instance.NukeAnnouncement()); if(MainPlugin.Instance.Config.PeanutLockDown) From dc553ea7edeff05ed122141570c0a8c92d2e429e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9COmer?= <“27omerf@gmail.com”> Date: Tue, 3 Dec 2024 18:10:11 +0100 Subject: [PATCH 011/853] [GE] Impostor --- .../GEFE.Examples/GE/Impostor.cs | 66 +++++++++++++++++++ .../GEFE.Examples/GE/Speed.cs | 1 - 2 files changed, 66 insertions(+), 1 deletion(-) create mode 100644 KruacentE.GlobalEventFramework/GEFE.Examples/GE/Impostor.cs diff --git a/KruacentE.GlobalEventFramework/GEFE.Examples/GE/Impostor.cs b/KruacentE.GlobalEventFramework/GEFE.Examples/GE/Impostor.cs new file mode 100644 index 00000000..8945d755 --- /dev/null +++ b/KruacentE.GlobalEventFramework/GEFE.Examples/GE/Impostor.cs @@ -0,0 +1,66 @@ +using Player = Exiled.API.Features.Player; +using GEFExiled.GEFE.API.Features; +using System.Collections.Generic; +using MEC; +using System.Linq; +using Exiled.API.Extensions; +using Exiled.API.Features; + +namespace GEFExiled.GEFE.Examples.GE +{ + public class Impostor : GlobalEvent + { + public override int Id { get; set; } = 30; + public override string Name { get; set; } = "Impostor"; + public override string Description { get; set; } = "Ne vous fiez pas aux apparences !"; + public override double Weight { get; set; } = 1; + + public override IEnumerator Start() + { + while (true) + { + int randomNumber = UnityEngine.Random.Range(180, 300); + yield return Timing.WaitForSeconds(randomNumber); + ChangingPlayer(); + } + } + + private void ChangingPlayer() + { + List playerInServer = Player.List.ToList(); + playerInServer.ShuffleList(); + + //Affichage des joueurs pour le debug + playerInServer.ForEach(x => Log.Debug("Joueur : " + x.Nickname)); + + foreach (Player player in playerInServer) + { + Player otherPlayer = playerInServer.RandomItem(); + + + Log.Debug("Joueur Target : " + otherPlayer.Nickname); + Log.Debug("Role du Target : " + otherPlayer.Role); + + player.ChangeAppearance(otherPlayer.Role); + player.DisplayNickname = otherPlayer.Nickname; + + playerInServer.Remove(otherPlayer); + } + } + + public override void SubscribeEvent() + { + Exiled.Events.Handlers.Server.RoundStarted += OnRoundStarted; + } + + public override void UnsubscribeEvent() + { + Exiled.Events.Handlers.Server.RoundStarted -= OnRoundStarted; + } + + private void OnRoundStarted() + { + Start(); + } + } +} diff --git a/KruacentE.GlobalEventFramework/GEFE.Examples/GE/Speed.cs b/KruacentE.GlobalEventFramework/GEFE.Examples/GE/Speed.cs index a5697b44..aa77c770 100644 --- a/KruacentE.GlobalEventFramework/GEFE.Examples/GE/Speed.cs +++ b/KruacentE.GlobalEventFramework/GEFE.Examples/GE/Speed.cs @@ -26,7 +26,6 @@ public override IEnumerator Start() public override void SubscribeEvent() { Exiled.Events.Handlers.Server.RoundStarted += OnRoundStarted; - Exiled.Events.Handlers.Server.RespawnedTeam +=; } public override void UnsubscribeEvent() From 9334305e942a554b79dbadca5a4bcc7d2013c332 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Wed, 4 Dec 2024 07:09:15 +0100 Subject: [PATCH 012/853] added a register for a List of GE --- .../GEFE/API/Features/GlobalEvent.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/KruacentE.GlobalEventFramework/GEFE/API/Features/GlobalEvent.cs b/KruacentE.GlobalEventFramework/GEFE/API/Features/GlobalEvent.cs index 7c202975..91152434 100644 --- a/KruacentE.GlobalEventFramework/GEFE/API/Features/GlobalEvent.cs +++ b/KruacentE.GlobalEventFramework/GEFE/API/Features/GlobalEvent.cs @@ -49,7 +49,10 @@ public static void Register(IGlobalEvent globalEvent) } GlobalEvents.Add(globalEvent.Id, globalEvent); Log.Info($"{globalEvent.Name} is registered"); - + } + public static void Register(List globalEvents) + { + globalEvents.ForEach(globalEvent => Register(globalEvent)); } public virtual IEnumerator Start() From 5ea1a34f3df09f61ca1066b8088fd4058bc225a2 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Wed, 4 Dec 2024 07:09:57 +0100 Subject: [PATCH 013/853] Changed the ge logic to enable and disable events --- .../GEFE.Examples/GE/Shuffle.cs | 4 ++-- .../GEFE.Examples/GE/Speed.cs | 17 +++++------------ .../GEFE/Handlers/ServerHandler.cs | 8 +++++--- KruacentE.GlobalEventFramework/MainPlugin.cs | 18 +++++++----------- 4 files changed, 19 insertions(+), 28 deletions(-) diff --git a/KruacentE.GlobalEventFramework/GEFE.Examples/GE/Shuffle.cs b/KruacentE.GlobalEventFramework/GEFE.Examples/GE/Shuffle.cs index 256b3c0d..be4d22ca 100644 --- a/KruacentE.GlobalEventFramework/GEFE.Examples/GE/Shuffle.cs +++ b/KruacentE.GlobalEventFramework/GEFE.Examples/GE/Shuffle.cs @@ -1,6 +1,6 @@ using System.Collections.Generic; using Exiled.API.Features; -using GlobalEventFrameworkEXILED.API.Utils; +using GEFExiled.API.Utils; using InventorySystem; using System.Linq; using Exiled.API.Features.Items; @@ -22,7 +22,7 @@ public class Shuffle : GlobalEvent /// public override string Description { get; set; } = "et ça fait roomba café dans le scp"; /// - public override double Weight { get; set; } = 1; + public override double Weight { get; set; } = 0; private Player[] players = Player.List.ToArray(); private List[] inventories; /// diff --git a/KruacentE.GlobalEventFramework/GEFE.Examples/GE/Speed.cs b/KruacentE.GlobalEventFramework/GEFE.Examples/GE/Speed.cs index aa77c770..17609f11 100644 --- a/KruacentE.GlobalEventFramework/GEFE.Examples/GE/Speed.cs +++ b/KruacentE.GlobalEventFramework/GEFE.Examples/GE/Speed.cs @@ -1,4 +1,5 @@ -using Exiled.API.Enums; +using CustomPlayerEffects; +using Exiled.API.Enums; using Exiled.API.Features; using GEFExiled.GEFE.API.Features; using System; @@ -18,27 +19,19 @@ public class Speed : GlobalEvent public override IEnumerator Start() { - + Player.List.ToList().ForEach(p => p.EnableEffect(100)); yield return 0; } public override void SubscribeEvent() { - Exiled.Events.Handlers.Server.RoundStarted += OnRoundStarted; + } public override void UnsubscribeEvent() { - Exiled.Events.Handlers.Server.RoundStarted -= OnRoundStarted; - } - - private void OnRoundStarted() - { - foreach(Player p in Player.List) - { - p.EnableEffect(EffectType.MovementBoost,100,99999999f); - } + } } diff --git a/KruacentE.GlobalEventFramework/GEFE/Handlers/ServerHandler.cs b/KruacentE.GlobalEventFramework/GEFE/Handlers/ServerHandler.cs index f5999932..c01efd80 100644 --- a/KruacentE.GlobalEventFramework/GEFE/Handlers/ServerHandler.cs +++ b/KruacentE.GlobalEventFramework/GEFE/Handlers/ServerHandler.cs @@ -6,27 +6,29 @@ using System.Text; using System.Threading.Tasks; using MEC; +using GEFExiled.GEFE.API.Interfaces; namespace GEFExiled.Handlers { internal class ServerHandler { MainPlugin _plugin; - CoroutineHandle _coroutineHandle; - public ServerHandler(MainPlugin mainPlugin) + List _activeGE; + public ServerHandler(MainPlugin mainPlugin) { this._plugin = mainPlugin; } public void OnRoundStarted() { Log.Debug("starting round"); - _plugin.ChooseGE(); + _activeGE = _plugin.ChooseGE(); Log.Debug("end starting round"); } public void OnEndingRound(EndingRoundEventArgs ev) { Log.Debug("ending round"); + _activeGE.ForEach(e => e.UnsubscribeEvent()); this._plugin.StopCoroutines(); } } diff --git a/KruacentE.GlobalEventFramework/MainPlugin.cs b/KruacentE.GlobalEventFramework/MainPlugin.cs index aefea34b..458c2618 100644 --- a/KruacentE.GlobalEventFramework/MainPlugin.cs +++ b/KruacentE.GlobalEventFramework/MainPlugin.cs @@ -22,10 +22,11 @@ internal class MainPlugin : Plugin public override void OnEnabled() { _instance = this; - GlobalEvent.Register(new SystemMalfunction()); - GlobalEvent.Register(new Shuffle()); - + List globalEvents = new List(){ new SystemMalfunction(), new Speed(),new RandomSpawn() }; + GlobalEvent.Register(globalEvents); + RegisterEvents(); + base.OnEnabled(); } @@ -78,21 +79,20 @@ private String ShowText() return result; } - public void ChooseGE() + public List ChooseGE() { - Log.Debug("Choosine ge"); List activeGE = ChooseRandomGE(); - Log.Debug("et go les ga c la fin du randomge"); foreach (IGlobalEvent ge in activeGE) { + ge.SubscribeEvent(); Log.Debug($"GE : {ge.Name}"); var a = Timing.RunCoroutine(ge.Start()); Log.Debug("fin start corutn"); coroutineHandles.Add(a); //crash Log.Debug("fin add corutn"); } - Log.Debug("fin choosein ge"); + return activeGE; } @@ -108,7 +108,6 @@ private List ChooseRandomGE(int nbGE = 1) for (int i = 0; i < nbGE; i++) { - Log.Debug("start foreach"); bool found = false; foreach (IGlobalEvent ge in gelist) { @@ -116,20 +115,17 @@ private List ChooseRandomGE(int nbGE = 1) if (randomWeight <= cumulativeWeight) { - Log.Debug("hon hon hon le add du if"); result.Add(ge); break; } } if (!found) { - Log.Debug("nsm on a pa trouvé"); result.Add(gelist.Last()); gelist.Remove(gelist.Last()); } } - Log.Debug("fin :D"); return result; } From 2a354138298cac5655900e9661b39e8799c84db1 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Wed, 4 Dec 2024 14:07:49 +0100 Subject: [PATCH 014/853] Removed useless using --- KruacentE.Misc/MainPlugin.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/KruacentE.Misc/MainPlugin.cs b/KruacentE.Misc/MainPlugin.cs index 235e3b0c..09dd0560 100644 --- a/KruacentE.Misc/MainPlugin.cs +++ b/KruacentE.Misc/MainPlugin.cs @@ -5,7 +5,6 @@ using MEC; using Exiled.API.Features.Doors; using System.Linq; -using Exiled.API.Features.Doors; using Exiled.API.Interfaces; namespace KE.Misc From 615b765b96889edd36a38760441deac819fb832d Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Thu, 5 Dec 2024 18:24:33 +0100 Subject: [PATCH 015/853] Fixed the double Start --- .../GEFE.Examples/GE/Impostor.cs | 16 +--------------- 1 file changed, 1 insertion(+), 15 deletions(-) diff --git a/KruacentE.GlobalEventFramework/GEFE.Examples/GE/Impostor.cs b/KruacentE.GlobalEventFramework/GEFE.Examples/GE/Impostor.cs index 8945d755..6b688d18 100644 --- a/KruacentE.GlobalEventFramework/GEFE.Examples/GE/Impostor.cs +++ b/KruacentE.GlobalEventFramework/GEFE.Examples/GE/Impostor.cs @@ -17,7 +17,7 @@ public class Impostor : GlobalEvent public override IEnumerator Start() { - while (true) + while (!Round.IsEnded) { int randomNumber = UnityEngine.Random.Range(180, 300); yield return Timing.WaitForSeconds(randomNumber); @@ -48,19 +48,5 @@ private void ChangingPlayer() } } - public override void SubscribeEvent() - { - Exiled.Events.Handlers.Server.RoundStarted += OnRoundStarted; - } - - public override void UnsubscribeEvent() - { - Exiled.Events.Handlers.Server.RoundStarted -= OnRoundStarted; - } - - private void OnRoundStarted() - { - Start(); - } } } From 9b1104af7b87087a2638c3ded52c5ee523278bd3 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Thu, 5 Dec 2024 18:24:54 +0100 Subject: [PATCH 016/853] Finished Shuffle and Speed --- .../GEFE.Examples/GE/Shuffle.cs | 80 +++++++++---------- .../GEFE.Examples/GE/Speed.cs | 22 +++-- .../GEFE.Examples/MainPlugin.cs | 2 +- .../GEFE/Handlers/ServerHandler.cs | 1 + .../GEFExiled.csproj | 2 +- KruacentE.GlobalEventFramework/MainPlugin.cs | 1 - 6 files changed, 55 insertions(+), 53 deletions(-) diff --git a/KruacentE.GlobalEventFramework/GEFE.Examples/GE/Shuffle.cs b/KruacentE.GlobalEventFramework/GEFE.Examples/GE/Shuffle.cs index be4d22ca..3a3a6c0c 100644 --- a/KruacentE.GlobalEventFramework/GEFE.Examples/GE/Shuffle.cs +++ b/KruacentE.GlobalEventFramework/GEFE.Examples/GE/Shuffle.cs @@ -1,15 +1,10 @@ using System.Collections.Generic; using Exiled.API.Features; -using GEFExiled.API.Utils; -using InventorySystem; -using System.Linq; -using Exiled.API.Features.Items; -using Exiled.API.Extensions; -using Exiled.API.Enums; -using InventorySystem.Items.Firearms.Attachments.Components; -using Exiled.API.Structs; using MEC; using GEFExiled.GEFE.API.Features; +using PlayerHandler = Exiled.Events.Handlers.Player; +using Exiled.Events.EventArgs.Player; +using UnityEngine; namespace GEFExiled.GEFE.Examples.GE { @@ -23,58 +18,57 @@ public class Shuffle : GlobalEvent public override string Description { get; set; } = "et ça fait roomba café dans le scp"; /// public override double Weight { get; set; } = 0; - private Player[] players = Player.List.ToArray(); - private List[] inventories; + private List players; + private List pos; /// public override IEnumerator Start() { - Coroutine.LaunchCoroutine(Update()); - yield return 0; + this.players.ShuffleList(); + pos = new List(); + while (!Round.IsEnded) + { + yield return Timing.WaitForSeconds(Random.Range(120, 240)); + for (int i = 0; i < this.players.Count; i++) + { + pos[i] = this.players[i].Position; + } + ShiftLeft(this.players); + for (int i = 0; i < this.players.Count; i++) + { + this.players[i].Position = pos[i]; + } + pos.Clear(); + } } - public Shuffle() + public override void SubscribeEvent() { - inventories = new List[players.Length]; - for (int i = 0; i < players.Length; i++) - { - inventories[i] = players[i].Items.ToList(); - } + PlayerHandler.Joined += OnJoined; } - private IEnumerator Update() + + public override void UnsubscribeEvent() { - while (!Round.IsEnded) - { - yield return Timing.WaitForSeconds(UnityEngine.Random.Range(120, 240)); + PlayerHandler.Joined -= OnJoined; + } - } + private void OnJoined(JoinedEventArgs ev) + { + this.players.Add(ev.Player); } - //sprainte 9 fèr lé non ki rest - private void Shuffling(int decale) + + private void ShiftLeft(List lst) { - for (int i = 0; i < players.Length; i++) + for (int i = 1; i < lst.Count; i++) { - + lst[i - 1] = lst[i]; } - } - private void ChangeInventory(int pid) - { - var fire = new Dictionary>(); - players[pid].ClearItems(); - foreach (Item item in inventories[pid]) + for (int i = lst.Count - 1; i < lst.Count; i++) { - //is a firearm - if (item is Firearm firearm) - { - fire.Add(firearm, firearm.AttachmentIdentifiers); - players[pid].AddItem(fire); - } - else - { - players[pid].AddItem(item); - } + lst[i] = default; } } + } } diff --git a/KruacentE.GlobalEventFramework/GEFE.Examples/GE/Speed.cs b/KruacentE.GlobalEventFramework/GEFE.Examples/GE/Speed.cs index 17609f11..6f122ec7 100644 --- a/KruacentE.GlobalEventFramework/GEFE.Examples/GE/Speed.cs +++ b/KruacentE.GlobalEventFramework/GEFE.Examples/GE/Speed.cs @@ -1,12 +1,14 @@ using CustomPlayerEffects; using Exiled.API.Enums; using Exiled.API.Features; +using Exiled.Events.EventArgs.Player; using GEFExiled.GEFE.API.Features; using System; using System.Collections.Generic; +using System.ComponentModel; using System.Linq; -using System.Text; -using System.Threading.Tasks; +using Utils.NonAllocLINQ; +using PlayerHandler = Exiled.Events.Handlers.Player; namespace GEFExiled.GEFE.Examples.GE { @@ -16,23 +18,29 @@ public class Speed : GlobalEvent public override string Name { get; set; } = "Speed"; public override string Description { get; set; } = "Gas! gas! gas!"; public override double Weight { get; set; } = 1; + [Description("the movement speed that will be added to the player")] + public int MovementBoost { get; set; } = 100; public override IEnumerator Start() { - Player.List.ToList().ForEach(p => p.EnableEffect(100)); + Player.List.ToList().ForEach(p => p.EnableEffect(MovementBoost, true)); yield return 0; } - - public override void SubscribeEvent() { - + PlayerHandler.ChangingRole += ReactivateEffectSpawn; } public override void UnsubscribeEvent() { - + PlayerHandler.ChangingRole -= ReactivateEffectSpawn; + Player.List.ToList().ForEach(p => p.DisableEffect()); } + + private void ReactivateEffectSpawn(ChangingRoleEventArgs ev) + { + ev.Player.EnableEffect(MovementBoost,true); + } } } diff --git a/KruacentE.GlobalEventFramework/GEFE.Examples/MainPlugin.cs b/KruacentE.GlobalEventFramework/GEFE.Examples/MainPlugin.cs index 70832aef..e82afaa6 100644 --- a/KruacentE.GlobalEventFramework/GEFE.Examples/MainPlugin.cs +++ b/KruacentE.GlobalEventFramework/GEFE.Examples/MainPlugin.cs @@ -13,7 +13,7 @@ public override void OnEnabled() Timing.CallDelayed(10f, () => { - GlobalEvent.RegisterItems(); + //GlobalEvent.Register(); }); base.OnEnabled(); } diff --git a/KruacentE.GlobalEventFramework/GEFE/Handlers/ServerHandler.cs b/KruacentE.GlobalEventFramework/GEFE/Handlers/ServerHandler.cs index c01efd80..b5122eb8 100644 --- a/KruacentE.GlobalEventFramework/GEFE/Handlers/ServerHandler.cs +++ b/KruacentE.GlobalEventFramework/GEFE/Handlers/ServerHandler.cs @@ -22,6 +22,7 @@ public void OnRoundStarted() { Log.Debug("starting round"); _activeGE = _plugin.ChooseGE(); + _activeGE.ForEach(e => e.SubscribeEvent()); Log.Debug("end starting round"); } diff --git a/KruacentE.GlobalEventFramework/GEFExiled.csproj b/KruacentE.GlobalEventFramework/GEFExiled.csproj index 08b7aa74..9b580822 100644 --- a/KruacentE.GlobalEventFramework/GEFExiled.csproj +++ b/KruacentE.GlobalEventFramework/GEFExiled.csproj @@ -10,7 +10,7 @@ - ..\..\..\..\..\..\..\Program Files (x86)\Steam\steamapps\common\SCP Secret Laboratory Dedicated Server\SCPSL_Data\Managed\Assembly-CSharp-firstpass.dll + C:\Program Files (x86)\Steam\steamapps\common\SCP Secret Laboratory Dedicated Server\SCPSL_Data\Managed\Assembly-CSharp-firstpass.dll C:\Program Files (x86)\Steam\steamapps\common\SCP Secret Laboratory Dedicated Server\SCPSL_Data\Managed\Mirror.dll diff --git a/KruacentE.GlobalEventFramework/MainPlugin.cs b/KruacentE.GlobalEventFramework/MainPlugin.cs index 458c2618..02b543fe 100644 --- a/KruacentE.GlobalEventFramework/MainPlugin.cs +++ b/KruacentE.GlobalEventFramework/MainPlugin.cs @@ -85,7 +85,6 @@ public List ChooseGE() foreach (IGlobalEvent ge in activeGE) { - ge.SubscribeEvent(); Log.Debug($"GE : {ge.Name}"); var a = Timing.RunCoroutine(ge.Start()); Log.Debug("fin start corutn"); From 177d0a0e9b06f465fe470c9cd8dd4fd01ba3a11d Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Thu, 5 Dec 2024 19:29:07 +0100 Subject: [PATCH 017/853] Global events works now yipee Fixed namespaces --- .../GEFE.Examples/GE/Speed.cs | 8 ++-- .../GEFE.Examples/GE/SystemMalfunction.cs | 2 +- .../GEFE/API/Features/GlobalEvent.cs | 12 ++++-- .../GEFE/API/Utils/Coroutine.cs | 2 +- .../GEFE/Commands/List.cs | 6 +-- .../GEFE/Commands/ParentCommandGEFE.cs | 3 +- .../GEFE/Handlers/ServerHandler.cs | 13 ++++-- KruacentE.GlobalEventFramework/MainPlugin.cs | 42 +++++++++++++------ 8 files changed, 60 insertions(+), 28 deletions(-) diff --git a/KruacentE.GlobalEventFramework/GEFE.Examples/GE/Speed.cs b/KruacentE.GlobalEventFramework/GEFE.Examples/GE/Speed.cs index 6f122ec7..7b7af066 100644 --- a/KruacentE.GlobalEventFramework/GEFE.Examples/GE/Speed.cs +++ b/KruacentE.GlobalEventFramework/GEFE.Examples/GE/Speed.cs @@ -3,6 +3,7 @@ using Exiled.API.Features; using Exiled.Events.EventArgs.Player; using GEFExiled.GEFE.API.Features; +using MEC; using System; using System.Collections.Generic; using System.ComponentModel; @@ -19,11 +20,11 @@ public class Speed : GlobalEvent public override string Description { get; set; } = "Gas! gas! gas!"; public override double Weight { get; set; } = 1; [Description("the movement speed that will be added to the player")] - public int MovementBoost { get; set; } = 100; + public byte MovementBoost { get; set; } = 100; public override IEnumerator Start() { - Player.List.ToList().ForEach(p => p.EnableEffect(MovementBoost, true)); + Player.List.ToList().ForEach(p => p.EnableEffect(MovementBoost,999999999, true)); yield return 0; } public override void SubscribeEvent() @@ -40,7 +41,8 @@ public override void UnsubscribeEvent() private void ReactivateEffectSpawn(ChangingRoleEventArgs ev) { - ev.Player.EnableEffect(MovementBoost,true); + Timing.CallDelayed(1f, () => ev.Player.EnableEffect(MovementBoost, 999999999, true)); + } } } diff --git a/KruacentE.GlobalEventFramework/GEFE.Examples/GE/SystemMalfunction.cs b/KruacentE.GlobalEventFramework/GEFE.Examples/GE/SystemMalfunction.cs index 3cd247f6..ef5af9c0 100644 --- a/KruacentE.GlobalEventFramework/GEFE.Examples/GE/SystemMalfunction.cs +++ b/KruacentE.GlobalEventFramework/GEFE.Examples/GE/SystemMalfunction.cs @@ -1,6 +1,6 @@ using Exiled.API.Features; using GEFExiled.GEFE.API.Features; -using GlobalEventFrameworkEXILED.API.Utils; +using GEFExiled.GEFE.API.Utils; using MEC; using System; using System.Collections.Generic; diff --git a/KruacentE.GlobalEventFramework/GEFE/API/Features/GlobalEvent.cs b/KruacentE.GlobalEventFramework/GEFE/API/Features/GlobalEvent.cs index 91152434..820f8e01 100644 --- a/KruacentE.GlobalEventFramework/GEFE/API/Features/GlobalEvent.cs +++ b/KruacentE.GlobalEventFramework/GEFE/API/Features/GlobalEvent.cs @@ -20,7 +20,7 @@ public class GlobalEvent : IGlobalEvent /// A list of Active GlobalEvents /// public static List ActiveGlobalEvents => ActiveGE.ToList(); - internal static List ActiveGE { get; } = new List(); + internal static List ActiveGE { get; set; } = new List(); internal static Dictionary GlobalEvents { get; set; } = new Dictionary(); /// /// A list of all registered GlobalEvents @@ -63,11 +63,17 @@ public virtual IEnumerator Start() public virtual void SubscribeEvent() { - Log.Error($"{GetType().Name} SubscribeEvent is NOT overrided"); + Log.Warn($"{GetType().Name} : SubscribeEvent is NOT overrided"); } public virtual void UnsubscribeEvent() { - Log.Error($"{GetType().Name} UnsubscribeEvent is NOT overrided"); + Log.Warn($"{GetType().Name} : UnsubscribeEvent is NOT overrided"); + } + + public void Clean() + { + GlobalEvents = new Dictionary(); + ActiveGE = new List(); } } } diff --git a/KruacentE.GlobalEventFramework/GEFE/API/Utils/Coroutine.cs b/KruacentE.GlobalEventFramework/GEFE/API/Utils/Coroutine.cs index 2d17f72f..12caa0fe 100644 --- a/KruacentE.GlobalEventFramework/GEFE/API/Utils/Coroutine.cs +++ b/KruacentE.GlobalEventFramework/GEFE/API/Utils/Coroutine.cs @@ -1,7 +1,7 @@ using MEC; using System.Collections.Generic; -namespace GEFExiled.API.Utils +namespace GEFExiled.GEFE.API.Utils { public static class Coroutine { diff --git a/KruacentE.GlobalEventFramework/GEFE/Commands/List.cs b/KruacentE.GlobalEventFramework/GEFE/Commands/List.cs index 0aba91bf..bcc898e8 100644 --- a/KruacentE.GlobalEventFramework/GEFE/Commands/List.cs +++ b/KruacentE.GlobalEventFramework/GEFE/Commands/List.cs @@ -1,12 +1,12 @@ -namespace KruacentExiled.KruacentE.GlobalEventFramework.GEFE.Commands +namespace GEFExiled.GEFE.Commands { using Exiled.API.Features; using Exiled.API.Features.Pickups; using System; using CommandSystem; using System.Runtime.InteropServices.WindowsRuntime; - using GEFExiled.GEFE.API.Features; - using GEFExiled.GEFE.API.Interfaces; + using GEFE.API.Interfaces; + using GEFE.API.Features; public class List : ICommand { diff --git a/KruacentE.GlobalEventFramework/GEFE/Commands/ParentCommandGEFE.cs b/KruacentE.GlobalEventFramework/GEFE/Commands/ParentCommandGEFE.cs index c20ba3cf..41b617d1 100644 --- a/KruacentE.GlobalEventFramework/GEFE/Commands/ParentCommandGEFE.cs +++ b/KruacentE.GlobalEventFramework/GEFE/Commands/ParentCommandGEFE.cs @@ -1,6 +1,5 @@ -using GEFExiled.Commands; -namespace KruacentExiled.KruacentE.GlobalEventFramework.GEFE.Commands +namespace GEFExiled.GEFE.Commands { using CommandSystem; using System; diff --git a/KruacentE.GlobalEventFramework/GEFE/Handlers/ServerHandler.cs b/KruacentE.GlobalEventFramework/GEFE/Handlers/ServerHandler.cs index b5122eb8..76762bff 100644 --- a/KruacentE.GlobalEventFramework/GEFE/Handlers/ServerHandler.cs +++ b/KruacentE.GlobalEventFramework/GEFE/Handlers/ServerHandler.cs @@ -7,6 +7,7 @@ using System.Threading.Tasks; using MEC; using GEFExiled.GEFE.API.Interfaces; +using Exiled.Events.Commands.PluginManager; namespace GEFExiled.Handlers { @@ -23,14 +24,20 @@ public void OnRoundStarted() Log.Debug("starting round"); _activeGE = _plugin.ChooseGE(); _activeGE.ForEach(e => e.SubscribeEvent()); + _plugin.Show(); Log.Debug("end starting round"); } public void OnEndingRound(EndingRoundEventArgs ev) { Log.Debug("ending round"); - _activeGE.ForEach(e => e.UnsubscribeEvent()); - this._plugin.StopCoroutines(); - } + + + Log.Debug("stopping coroutine"); + //this._plugin.StopCoroutines(); + Log.Debug("unsubbing events"); + _activeGE.ForEach(e => e.UnsubscribeEvent()); + Log.Debug("round end"); + } } } diff --git a/KruacentE.GlobalEventFramework/MainPlugin.cs b/KruacentE.GlobalEventFramework/MainPlugin.cs index 02b543fe..df50885e 100644 --- a/KruacentE.GlobalEventFramework/MainPlugin.cs +++ b/KruacentE.GlobalEventFramework/MainPlugin.cs @@ -58,10 +58,12 @@ public void Show() { foreach (Player player in Player.List) { - Exiled.API.Features.Broadcast b = new Exiled.API.Features.Broadcast(); - b.Content = ShowText(); - b.Duration = 10; - player.Broadcast(b); + Exiled.API.Features.Broadcast b = new Exiled.API.Features.Broadcast + { + Content = ShowText(), + Duration = 10 + }; + player.Broadcast(b); } } @@ -70,26 +72,36 @@ private String ShowText() String result = "Global Events: "; for (int i = 0; i < GlobalEvent.ActiveGE.Count(); i++) { - result += GlobalEvent.ActiveGE[i].Description; - if (GlobalEvent.ActiveGE.Count() > 1) + if(UnityEngine.Random.value > 0.5f) + { + result += GlobalEvent.ActiveGE[i].Description; + } + else + { + result += "[REDACTED]"; + } + + if (GlobalEvent.ActiveGE.Count() > 1 && i < GlobalEvent.ActiveGE.Count()-1) { result += ","; } } + + return result; } public List ChooseGE() { List activeGE = ChooseRandomGE(); + Log.Debug($"activeGE size : {activeGE.Count}"); + Log.Info($"Global Event(s) : "); - foreach (IGlobalEvent ge in activeGE) + foreach (IGlobalEvent ge in activeGE) { - Log.Debug($"GE : {ge.Name}"); + Log.Info(ge.Name); var a = Timing.RunCoroutine(ge.Start()); - Log.Debug("fin start corutn"); - coroutineHandles.Add(a); //crash - Log.Debug("fin add corutn"); + coroutineHandles.Add(a); //crash when other from other assembly } return activeGE; } @@ -104,7 +116,13 @@ private List ChooseRandomGE(int nbGE = 1) double randomWeight = UnityEngine.Random.value * totalWeight; double cumulativeWeight = 0.0; - + result.Add(gelist[UnityEngine.Random.Range(0, gelist.Count)]); + + GlobalEvent.ActiveGE = result.ToList(); + + return result; + + // yes it's dead but they deserve it for (int i = 0; i < nbGE; i++) { bool found = false; From 518689d369c5430afe9882167e5ff7424b6ca969 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Sun, 8 Dec 2024 18:25:29 +0100 Subject: [PATCH 018/853] Added compatibility with Restarting round --- .../GEFE/Handlers/ServerHandler.cs | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/KruacentE.GlobalEventFramework/GEFE/Handlers/ServerHandler.cs b/KruacentE.GlobalEventFramework/GEFE/Handlers/ServerHandler.cs index 76762bff..58076328 100644 --- a/KruacentE.GlobalEventFramework/GEFE/Handlers/ServerHandler.cs +++ b/KruacentE.GlobalEventFramework/GEFE/Handlers/ServerHandler.cs @@ -28,16 +28,14 @@ public void OnRoundStarted() Log.Debug("end starting round"); } - public void OnEndingRound(EndingRoundEventArgs ev) + public void OnEndingRound(EndingRoundEventArgs _) { - Log.Debug("ending round"); - - - Log.Debug("stopping coroutine"); - //this._plugin.StopCoroutines(); - Log.Debug("unsubbing events"); _activeGE.ForEach(e => e.UnsubscribeEvent()); - Log.Debug("round end"); } - } + public void OnRestartingRound() + { + _activeGE.ForEach(e => e.UnsubscribeEvent()); + } + + } } From cebee5562d492c960fb8d68f5a4a9f7d157e093e Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Sun, 8 Dec 2024 18:26:10 +0100 Subject: [PATCH 019/853] Added empty GE --- .../GEFE.Examples/GE/R.cs | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 KruacentE.GlobalEventFramework/GEFE.Examples/GE/R.cs diff --git a/KruacentE.GlobalEventFramework/GEFE.Examples/GE/R.cs b/KruacentE.GlobalEventFramework/GEFE.Examples/GE/R.cs new file mode 100644 index 00000000..f22ebee8 --- /dev/null +++ b/KruacentE.GlobalEventFramework/GEFE.Examples/GE/R.cs @@ -0,0 +1,24 @@ +using Exiled.API.Features; +using GEFExiled.GEFE.API.Features; +using PlayerRoles; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace GEFExiled.GEFE.Examples.GE +{ + public class R : GlobalEvent + { + public override int Id { get; set; } = 32; + public override string Name { get; set; } = "nothing"; + public override string Description { get; set; } = "y'a r"; + public override double Weight { get; set; } = 1; + public override IEnumerator Start() + { + yield return 0; + } + + } +} From 94eeae59895b6d514b7d7483f9a6ab9776d14184 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Sun, 8 Dec 2024 18:26:33 +0100 Subject: [PATCH 020/853] Buffed 173 in the Speed GE --- KruacentE.GlobalEventFramework/GEFE.Examples/GE/Speed.cs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/KruacentE.GlobalEventFramework/GEFE.Examples/GE/Speed.cs b/KruacentE.GlobalEventFramework/GEFE.Examples/GE/Speed.cs index 7b7af066..233c5482 100644 --- a/KruacentE.GlobalEventFramework/GEFE.Examples/GE/Speed.cs +++ b/KruacentE.GlobalEventFramework/GEFE.Examples/GE/Speed.cs @@ -2,6 +2,7 @@ using Exiled.API.Enums; using Exiled.API.Features; using Exiled.Events.EventArgs.Player; +using Exiled.Events.EventArgs.Scp173; using GEFExiled.GEFE.API.Features; using MEC; using System; @@ -30,14 +31,20 @@ public override IEnumerator Start() public override void SubscribeEvent() { PlayerHandler.ChangingRole += ReactivateEffectSpawn; + Exiled.Events.Handlers.Scp173.Blinking += SpeedyNut; } public override void UnsubscribeEvent() { PlayerHandler.ChangingRole -= ReactivateEffectSpawn; + Exiled.Events.Handlers.Scp173.Blinking -= SpeedyNut; Player.List.ToList().ForEach(p => p.DisableEffect()); } + private void SpeedyNut(BlinkingEventArgs ev) + { + ev.BlinkCooldown = ev.BlinkCooldown/2; + } private void ReactivateEffectSpawn(ChangingRoleEventArgs ev) { From 612b1d7395059de9c9ae876d7978ee607b416cd3 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Sun, 8 Dec 2024 18:26:53 +0100 Subject: [PATCH 021/853] Fixed the Shuffle GE --- .../GEFE.Examples/GE/Shuffle.cs | 54 +++++++++++++------ 1 file changed, 39 insertions(+), 15 deletions(-) diff --git a/KruacentE.GlobalEventFramework/GEFE.Examples/GE/Shuffle.cs b/KruacentE.GlobalEventFramework/GEFE.Examples/GE/Shuffle.cs index 3a3a6c0c..0bff361c 100644 --- a/KruacentE.GlobalEventFramework/GEFE.Examples/GE/Shuffle.cs +++ b/KruacentE.GlobalEventFramework/GEFE.Examples/GE/Shuffle.cs @@ -1,5 +1,4 @@ -using System.Collections.Generic; -using Exiled.API.Features; +using Exiled.API.Features; using MEC; using GEFExiled.GEFE.API.Features; using PlayerHandler = Exiled.Events.Handlers.Player; @@ -23,21 +22,41 @@ public class Shuffle : GlobalEvent /// public override IEnumerator Start() { + this.players = Player.List.Where(p => !p.IsNPC).ToList(); this.players.ShuffleList(); - pos = new List(); + pos = new List(players.Count); + for (int i = 0; i < players.Count; i++) + { + pos.Add(Vector3.zero); + } + Log.Debug($"before while"); while (!Round.IsEnded) { - yield return Timing.WaitForSeconds(Random.Range(120, 240)); + + Log.Debug($"waiting for {GetType().Name}"); + yield return Timing.WaitForSeconds(UnityEngine.Random.Range(5, 5)); //120 240 for (int i = 0; i < this.players.Count; i++) { - pos[i] = this.players[i].Position; + Log.Debug($"old position of player {this.players[i]} : {this.players[i].Position}"); + var player = this.players[i]; + pos[i] = player.Position; + Log.Debug("------"); } + ShiftLeft(this.players); + Log.Debug("shifted players"); for (int i = 0; i < this.players.Count; i++) { - this.players[i].Position = pos[i]; + Log.Debug("before tp"); + this.players[i].Teleport(pos[i]); + Log.Debug($"new position of player {this.players[i]} : {this.players[i].Position}"); } - pos.Clear(); + Log.Debug($"tp player"); + for (int i = 0; i < players.Count; i++) + { + pos.Add(Vector3.zero); + } + Log.Debug($"cleared"); } } @@ -54,21 +73,26 @@ public override void UnsubscribeEvent() private void OnJoined(JoinedEventArgs ev) { - this.players.Add(ev.Player); + if (!ev.Player.IsNPC) + { + this.players.Add(ev.Player); + this.pos.Add(ev.Player.Position); + } } private void ShiftLeft(List lst) { - for (int i = 1; i < lst.Count; i++) + if (lst.Count > 0) { - lst[i - 1] = lst[i]; - } - - for (int i = lst.Count - 1; i < lst.Count; i++) - { - lst[i] = default; + T firstElement = lst[0]; + for (int i = 1; i < lst.Count; i++) + { + lst[i - 1] = lst[i]; + } + lst[lst.Count - 1] = firstElement; } } + } } From ab4e4c9a37aa5cd23429b76c8c2d01530d8d3e67 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Sun, 8 Dec 2024 18:27:28 +0100 Subject: [PATCH 022/853] Fixed the redacted broadcast --- .../GEFE.Examples/GE/KIWIS.cs | 24 +++++++++++++++ KruacentE.GlobalEventFramework/MainPlugin.cs | 30 ++++++++++++------- 2 files changed, 43 insertions(+), 11 deletions(-) create mode 100644 KruacentE.GlobalEventFramework/GEFE.Examples/GE/KIWIS.cs diff --git a/KruacentE.GlobalEventFramework/GEFE.Examples/GE/KIWIS.cs b/KruacentE.GlobalEventFramework/GEFE.Examples/GE/KIWIS.cs new file mode 100644 index 00000000..f3d02d7a --- /dev/null +++ b/KruacentE.GlobalEventFramework/GEFE.Examples/GE/KIWIS.cs @@ -0,0 +1,24 @@ +using Exiled.API.Features; +using GEFExiled.GEFE.API.Features; +using PlayerRoles; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace GEFExiled.GEFE.Examples.GE +{ + public class KIWIS : GlobalEvent + { + public override int Id { get; set; } = 32; + public override string Name { get; set; } = "KIWIS"; + public override string Description { get; set; } = "Kill It While It's Small"; + public override double Weight { get; set; } = 1; + public override IEnumerator Start() + { + yield return 0; + } + + } +} diff --git a/KruacentE.GlobalEventFramework/MainPlugin.cs b/KruacentE.GlobalEventFramework/MainPlugin.cs index df50885e..dc1ab3f0 100644 --- a/KruacentE.GlobalEventFramework/MainPlugin.cs +++ b/KruacentE.GlobalEventFramework/MainPlugin.cs @@ -8,6 +8,7 @@ using GEFExiled.GEFE.API.Features; using GEFExiled.GEFE.API.Interfaces; using GEFExiled.GEFE.Examples.GE; +using ServerHandler = Exiled.Events.Handlers.Server; namespace GEFExiled { internal class MainPlugin : Plugin @@ -22,7 +23,7 @@ internal class MainPlugin : Plugin public override void OnEnabled() { _instance = this; - List globalEvents = new List(){ new SystemMalfunction(), new Speed(),new RandomSpawn() }; + List globalEvents = new List(){ new Shuffle(),new Speed(),new SystemMalfunction(),new RandomSpawn(), new R() }; GlobalEvent.Register(globalEvents); RegisterEvents(); @@ -42,37 +43,44 @@ private void RegisterEvents() { _server = new Handlers.ServerHandler(this); - Exiled.Events.Handlers.Server.RoundStarted += _server.OnRoundStarted; - Exiled.Events.Handlers.Server.EndingRound += _server.OnEndingRound; + ServerHandler.RoundStarted += _server.OnRoundStarted; + ServerHandler.EndingRound += _server.OnEndingRound; + ServerHandler.RestartingRound += _server.OnRestartingRound; + } private void UnregisterEvents() { - Exiled.Events.Handlers.Server.RoundStarted -= _server.OnRoundStarted; - Exiled.Events.Handlers.Server.EndingRound -= _server.OnEndingRound; + ServerHandler.RoundStarted -= _server.OnRoundStarted; + ServerHandler.EndingRound -= _server.OnEndingRound; + ServerHandler.RestartingRound -= _server.OnRestartingRound; - _server = null; + _server = null; } public void Show() { - foreach (Player player in Player.List) + var random = UnityEngine.Random.value; + + foreach (Player player in Player.List) { Exiled.API.Features.Broadcast b = new Exiled.API.Features.Broadcast { - Content = ShowText(), + Content = ShowText(random > .5f), Duration = 10 }; player.Broadcast(b); } } - private String ShowText() + private String ShowText(bool redacted = false) { String result = "Global Events: "; for (int i = 0; i < GlobalEvent.ActiveGE.Count(); i++) { - if(UnityEngine.Random.value > 0.5f) + + + if (redacted) { result += GlobalEvent.ActiveGE[i].Description; } @@ -101,7 +109,7 @@ public List ChooseGE() { Log.Info(ge.Name); var a = Timing.RunCoroutine(ge.Start()); - coroutineHandles.Add(a); //crash when other from other assembly + coroutineHandles.Add(a); //crash when using other ge from other assembly } return activeGE; } From 41f8d046a63892c49911014d2b43e489e88034b2 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Sun, 8 Dec 2024 18:29:23 +0100 Subject: [PATCH 023/853] Fixed the doorStuck --- KruacentE.BlackoutNDoor/API/Features/Controller.cs | 14 +++++++++++--- KruacentE.BlackoutNDoor/Config.cs | 3 ++- KruacentE.BlackoutNDoor/Handlers/ServerHandler.cs | 2 ++ 3 files changed, 15 insertions(+), 4 deletions(-) diff --git a/KruacentE.BlackoutNDoor/API/Features/Controller.cs b/KruacentE.BlackoutNDoor/API/Features/Controller.cs index d5b03951..0326fcd6 100644 --- a/KruacentE.BlackoutNDoor/API/Features/Controller.cs +++ b/KruacentE.BlackoutNDoor/API/Features/Controller.cs @@ -21,13 +21,21 @@ public IEnumerator RandomDoorStuck() yield return Timing.WaitUntilFalse(() => Cassie.IsSpeaking); CassieVoiceLine(zone, false); yield return Timing.WaitUntilFalse(() => Cassie.IsSpeaking); - yield return Timing.WaitForSeconds(5); + yield return Timing.WaitForSeconds(MainPlugin.Instance.Config.DurationMalfunction); // if the zone is light and there is only 30s left then skip - if (!(zone == ZoneType.LightContainment && Map.DecontaminationState == DecontaminationState.Countdown)) + if (!(zone == ZoneType.LightContainment && Map.DecontaminationState == DecontaminationState.Countdown && Warhead.IsInProgress)) { + List doorList = Door.List .Where(d => !new[] { DoorType.ElevatorGateA, DoorType.ElevatorGateB, DoorType.ElevatorLczA, DoorType.ElevatorLczB, DoorType.ElevatorNuke, DoorType.ElevatorScp049, DoorType.UnknownElevator }.Contains(d.Type)) .ToList(); + var ge = Generator.List.Where(g => g.IsEngaged); + if(ge.ToList().Count != 3) + { + doorList = Door.List + .Where(d => !new[] { DoorType.Scp079First, DoorType.Scp079Second }.Contains(d.Type)) + .ToList(); + } foreach (Door door in doorList) { if (door.Zone == zone) @@ -56,7 +64,7 @@ public IEnumerator RandomBlackout() yield return Timing.WaitUntilFalse(() => Cassie.IsSpeaking); CassieVoiceLine(zone, true); yield return Timing.WaitUntilFalse(() => Cassie.IsSpeaking); - yield return Timing.WaitForSeconds(5); + yield return Timing.WaitForSeconds(MainPlugin.Instance.Config.DurationMalfunction); Log.Debug($"BlackOut in {zone}"); diff --git a/KruacentE.BlackoutNDoor/Config.cs b/KruacentE.BlackoutNDoor/Config.cs index b0d43fc4..262b8306 100644 --- a/KruacentE.BlackoutNDoor/Config.cs +++ b/KruacentE.BlackoutNDoor/Config.cs @@ -21,8 +21,9 @@ public class Config : IConfig public double InitialChanceBO { get; set; } = 0.5; [Description("the duration of a malfunction")] public int DurationMalfunction { get; set; } = 30; - + [Description("chance before decontamination")] public float[] ChancePreConta = { .2f, .3f, .3f, .15f, .05f }; + [Description("chance after decontamination")] public float[] ChancePostConta = { 0, .4f, .4f, .15f, .05f }; } } diff --git a/KruacentE.BlackoutNDoor/Handlers/ServerHandler.cs b/KruacentE.BlackoutNDoor/Handlers/ServerHandler.cs index 6984114f..5ef808f7 100644 --- a/KruacentE.BlackoutNDoor/Handlers/ServerHandler.cs +++ b/KruacentE.BlackoutNDoor/Handlers/ServerHandler.cs @@ -19,9 +19,11 @@ public void OnRoundStarted() { Timing.RunCoroutine(Update()); } + private IEnumerator Update() { + yield return Timing.WaitUntilTrue(() => Round.InProgress); Log.Debug("startUpdate"); var wait = UnityEngine.Random.Range(MainPlugin.Instance.Config.MinInterval, MainPlugin.Instance.Config.MaxInterval); Log.Debug($"waiting for {wait}"); From 5b20dddaa22df3d83e557b9eebf2d93ebf3c4888 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Sun, 8 Dec 2024 19:07:15 +0100 Subject: [PATCH 024/853] did the kiwi :D --- .../GEFE.Examples/GE/KIWIS.cs | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/KruacentE.GlobalEventFramework/GEFE.Examples/GE/KIWIS.cs b/KruacentE.GlobalEventFramework/GEFE.Examples/GE/KIWIS.cs index f3d02d7a..1a144a2e 100644 --- a/KruacentE.GlobalEventFramework/GEFE.Examples/GE/KIWIS.cs +++ b/KruacentE.GlobalEventFramework/GEFE.Examples/GE/KIWIS.cs @@ -1,11 +1,8 @@ using Exiled.API.Features; using GEFExiled.GEFE.API.Features; +using MEC; using PlayerRoles; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; +using Utils.NonAllocLINQ; namespace GEFExiled.GEFE.Examples.GE { @@ -17,7 +14,16 @@ public class KIWIS : GlobalEvent public override double Weight { get; set; } = 1; public override IEnumerator Start() { + var listScp = Player.List.Where(p => p.IsScp && p.Role.Type != RoleTypeId.Scp0492).ToList().ToDictionary(p => p, p => p.MaxHealth/3); + + yield return Timing.WaitUntilTrue(() => Round.ElapsedTime.TotalMinutes >= 15); + listScp.ForEach(k => k.Key.MaxHealth += k.Value); + + yield return Timing.WaitUntilTrue(() => Round.ElapsedTime.TotalMinutes >= 30); + listScp.ForEach(k => k.Key.MaxHealth += k.Value); + yield return 0; + } } From 9007f6d7246b0abe57db0c1bf7cb17bc030db7f5 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Tue, 10 Dec 2024 16:37:00 +0100 Subject: [PATCH 025/853] Handle the tp for 914 --- KruacentE.Misc/MainPlugin.cs | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/KruacentE.Misc/MainPlugin.cs b/KruacentE.Misc/MainPlugin.cs index 09dd0560..4478e52e 100644 --- a/KruacentE.Misc/MainPlugin.cs +++ b/KruacentE.Misc/MainPlugin.cs @@ -2,10 +2,13 @@ using Exiled.API.Features; using System.Collections.Generic; using ServerHandle = Exiled.Events.Handlers.Server; +using Nine14Handle = Exiled.Events.Handlers.Scp914; using MEC; using Exiled.API.Features.Doors; using System.Linq; using Exiled.API.Interfaces; +using Exiled.Events.EventArgs.Scp914; +using Scp914; namespace KE.Misc { @@ -20,6 +23,8 @@ public override void OnEnabled() serverHandler = new ServerHandler(); ServerHandle.RoundStarted += serverHandler.OnRoundStarted; + Nine14Handle.UpgradingPlayer += OnUpgradingPlayer; + } public override void OnDisabled() @@ -104,5 +109,28 @@ private void SendElevator(Lift e) { e.TryStart(0, true); } + + + private void OnUpgradingPlayer(UpgradingPlayerEventArgs ev) + { + Teleport(ev.Player,ev.KnobSetting); + + ChangingRole(ev.Player); + } + + + private void Teleport(Player p,Scp914KnobSetting knob) + { + if(knob == Scp914KnobSetting.Fine && UnityEngine.Random.value < 0.01f) + p.Teleport(Room.Random(ZoneType.Entrance)); + if(knob == Scp914KnobSetting.Coarse && UnityEngine.Random.value < .25f) + p.Teleport(Room.Random(ZoneType.LightContainment)); + } + + private void ChangingRole(Player p) + { + + } + } } From 99386fd42472a4ccd4883ef918f117f93360a06c Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Wed, 11 Dec 2024 14:27:52 +0100 Subject: [PATCH 026/853] Finished Tp with 914 --- KruacentE.Misc/MainPlugin.cs | 89 ++++++++++++++++++++++++++++++++++-- 1 file changed, 86 insertions(+), 3 deletions(-) diff --git a/KruacentE.Misc/MainPlugin.cs b/KruacentE.Misc/MainPlugin.cs index 4478e52e..4d4d19e1 100644 --- a/KruacentE.Misc/MainPlugin.cs +++ b/KruacentE.Misc/MainPlugin.cs @@ -9,6 +9,7 @@ using Exiled.API.Interfaces; using Exiled.Events.EventArgs.Scp914; using Scp914; +using PlayerRoles; namespace KE.Misc { @@ -16,6 +17,17 @@ public class MainPlugin : Plugin { internal static MainPlugin Instance { get; private set; } private ServerHandler serverHandler; + internal Dictionary roleScp = new Dictionary() + { + { -1, RoleTypeId.Scp049 }, + { -2, RoleTypeId.Scp939 }, + { -3, RoleTypeId.Scp096 }, + + { 1, RoleTypeId.Scp106 }, + { 2, RoleTypeId.Scp173 }, + { 3, RoleTypeId.Scp3114}, + + }; public override void OnEnabled() { @@ -115,21 +127,92 @@ private void OnUpgradingPlayer(UpgradingPlayerEventArgs ev) { Teleport(ev.Player,ev.KnobSetting); - ChangingRole(ev.Player); + ChangingRole(ev.Player, ev.KnobSetting); } private void Teleport(Player p,Scp914KnobSetting knob) { - if(knob == Scp914KnobSetting.Fine && UnityEngine.Random.value < 0.01f) + if(knob == Scp914KnobSetting.Fine && UnityEngine.Random.value < .01f) p.Teleport(Room.Random(ZoneType.Entrance)); if(knob == Scp914KnobSetting.Coarse && UnityEngine.Random.value < .25f) p.Teleport(Room.Random(ZoneType.LightContainment)); } - private void ChangingRole(Player p) + private void ChangingRole(Player p, Scp914KnobSetting knob) + { + if (p.IsScp) + { + HandleScpChangingRole(p,knob); + } + else if (p.IsHuman) + { + HandleHumanChangingRole(p, knob); + } + } + + private void HandleHumanChangingRole(Player p, Scp914KnobSetting knob) + { + if (p.IsHuman) + { + switch (p.Role.Type) + { + case RoleTypeId.Scientist: + if (UnityEngine.Random.value < .5f) + p.Role.Set(RoleTypeId.ClassD); + break; + case RoleTypeId.ClassD: + if (UnityEngine.Random.value < .5f) + p.Role.Set(RoleTypeId.Scientist); + break; + case RoleTypeId.FacilityGuard: + if (knob == Scp914KnobSetting.Rough) + p.Role.Set(RoleTypeId.FacilityGuard); + break; + } + } + } + + private void HandleScpChangingRole(Player p, Scp914KnobSetting knob) { + if (p.IsScp) + { + var invertRoleScp = roleScp.ToDictionary(k => k.Value, v => v.Key); + if (UnityEngine.Random.value < .5f) + { + // get the id of the scp + if (invertRoleScp.TryGetValue(p.Role.Type, out int key)) + { + RoleTypeId newRole; + switch (knob) + { + //going up in the graph + case Scp914KnobSetting.Rough: + if (roleScp.TryGetValue(key - 1, out newRole)) + { + p.Role.Set(newRole); + } + break; + //going horizontaly in the graph + case Scp914KnobSetting.OneToOne: + if (roleScp.TryGetValue(key * (-1), out newRole)) + { + p.Role.Set(newRole); + } + break; + //going down in the graph + case Scp914KnobSetting.VeryFine: + if (roleScp.TryGetValue(key + 1, out newRole)) + { + p.Role.Set(newRole); + } + break; + } + } + + } + } } } From 5c776740b6a4e160352eac63026955f9b278d35e Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Wed, 11 Dec 2024 21:59:58 +0100 Subject: [PATCH 027/853] Add external compatibility with BlackNDoor Added reduce cooldown of BlackNDoor if present in SystemMalfunction --- .../API/Features/Controller.cs | 6 +++-- .../Handlers/ServerHandler.cs | 13 ++++++---- KruacentE.BlackoutNDoor/MainPlugin.cs | 17 ++++++------- .../GEFE.Examples/GE/SystemMalfunction.cs | 24 +++++++++++++++++-- 4 files changed, 44 insertions(+), 16 deletions(-) diff --git a/KruacentE.BlackoutNDoor/API/Features/Controller.cs b/KruacentE.BlackoutNDoor/API/Features/Controller.cs index d5b03951..510ca6ee 100644 --- a/KruacentE.BlackoutNDoor/API/Features/Controller.cs +++ b/KruacentE.BlackoutNDoor/API/Features/Controller.cs @@ -8,12 +8,14 @@ namespace BlackoutKruacent.API.Features { - internal class Controller + public class Controller { + + /// /// Select a random zone and close and lock all door of the zone /// - public IEnumerator RandomDoorStuck() + internal IEnumerator RandomDoorStuck() { yield return Timing.WaitForOneFrame; var zone = SelectZone(); diff --git a/KruacentE.BlackoutNDoor/Handlers/ServerHandler.cs b/KruacentE.BlackoutNDoor/Handlers/ServerHandler.cs index 6984114f..23c004b0 100644 --- a/KruacentE.BlackoutNDoor/Handlers/ServerHandler.cs +++ b/KruacentE.BlackoutNDoor/Handlers/ServerHandler.cs @@ -7,23 +7,29 @@ namespace BlackoutKruacent.Handlers { - internal class ServerHandler + public class ServerHandler { + public int Cooldown { get; set; } = -1 ; internal double ChanceBO { get; set; } = MainPlugin.Instance.Config.InitialChanceBO; private Controller controller; internal ServerHandler(Controller con) { controller = con; } - public void OnRoundStarted() + internal void OnRoundStarted() { Timing.RunCoroutine(Update()); } private IEnumerator Update() { + yield return Timing.WaitUntilTrue(() => Round.InProgress); Log.Debug("startUpdate"); - var wait = UnityEngine.Random.Range(MainPlugin.Instance.Config.MinInterval, MainPlugin.Instance.Config.MaxInterval); + int wait; + if (Cooldown == -1) + wait = UnityEngine.Random.Range(MainPlugin.Instance.Config.MinInterval, MainPlugin.Instance.Config.MaxInterval); + else + wait = Cooldown; Log.Debug($"waiting for {wait}"); yield return Timing.WaitForSeconds(wait); while (true) @@ -50,7 +56,6 @@ private IEnumerator Update() ChanceBO = -(1 / 60) * Round.ElapsedTime.TotalMinutes + 0.5; Log.Debug($"new ChanceBO = {ChanceBO}"); } - Log.Debug("end"); } } diff --git a/KruacentE.BlackoutNDoor/MainPlugin.cs b/KruacentE.BlackoutNDoor/MainPlugin.cs index 757224a1..822030c0 100644 --- a/KruacentE.BlackoutNDoor/MainPlugin.cs +++ b/KruacentE.BlackoutNDoor/MainPlugin.cs @@ -8,35 +8,36 @@ namespace BlackoutKruacent { public class MainPlugin : Plugin { + public override string Name => "BlackOutNDoors"; internal static MainPlugin Instance; - private Controller _c; - private ServerHandler _server; + private Controller Controller; + public ServerHandler ServerHandler { get; private set; } public override void OnEnabled() { Instance = this; - _c = new Controller(); + Controller = new Controller(); this.RegisterEvent(); } public override void OnDisabled() { Instance = null; - _c = null; + Controller = null; this.UnregisterEvent(); } private void RegisterEvent() { - _server = new ServerHandler(_c); - Server.RoundStarted += _server.OnRoundStarted; + ServerHandler = new ServerHandler(Controller); + Server.RoundStarted += ServerHandler.OnRoundStarted; } private void UnregisterEvent() { - Server.RoundStarted -= _server.OnRoundStarted; + Server.RoundStarted -= ServerHandler.OnRoundStarted; - _server = null; + ServerHandler = null; } diff --git a/KruacentE.GlobalEventFramework/GEFE.Examples/GE/SystemMalfunction.cs b/KruacentE.GlobalEventFramework/GEFE.Examples/GE/SystemMalfunction.cs index ef5af9c0..8321dad0 100644 --- a/KruacentE.GlobalEventFramework/GEFE.Examples/GE/SystemMalfunction.cs +++ b/KruacentE.GlobalEventFramework/GEFE.Examples/GE/SystemMalfunction.cs @@ -1,4 +1,8 @@ -using Exiled.API.Features; +using BlackoutKruacent; +using Exiled.API.Features; +using Exiled.Events.Commands.Reload; +using Exiled.Loader; +using GEFExiled.API.Utils; using GEFExiled.GEFE.API.Features; using GEFExiled.GEFE.API.Utils; using MEC; @@ -17,9 +21,11 @@ public class SystemMalfunction : GlobalEvent public override string Name { get; set; } = "System Malfunction"; public override string Description { get; set; } = "On dirait que les systèmes informatiques sont défaillants"; public override double Weight { get; set; } = 1; + public int NewCooldown { get; set; } = 180; public override IEnumerator Start() { + MoreBlackOutNDoors(); Coroutine.LaunchCoroutine(EarlyNuke()); yield return 0; } @@ -32,5 +38,19 @@ private IEnumerator EarlyNuke() Warhead.Start(); Log.Debug($"kaboom"); } + + private void MoreBlackOutNDoors() + { + var otherPlugin = Loader.Plugins.FirstOrDefault(plugin => plugin.Name == "BlackOutNDoors"); + if (otherPlugin != null) + { + if (otherPlugin is BlackoutKruacent.MainPlugin blackout) + { + blackout.ServerHandler.Cooldown = NewCooldown; + } + + } + } + } -} +} \ No newline at end of file From dbbca4e1b726fa5d4e81d3ab838603fe636476f6 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Wed, 11 Dec 2024 22:19:04 +0100 Subject: [PATCH 028/853] Added SCPnoe Death event --- KruacentE.Misc/MainPlugin.cs | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/KruacentE.Misc/MainPlugin.cs b/KruacentE.Misc/MainPlugin.cs index 4d4d19e1..e390bcc9 100644 --- a/KruacentE.Misc/MainPlugin.cs +++ b/KruacentE.Misc/MainPlugin.cs @@ -10,6 +10,7 @@ using Exiled.Events.EventArgs.Scp914; using Scp914; using PlayerRoles; +using Exiled.Events.EventArgs.Player; namespace KE.Misc { @@ -36,6 +37,7 @@ public override void OnEnabled() serverHandler = new ServerHandler(); ServerHandle.RoundStarted += serverHandler.OnRoundStarted; Nine14Handle.UpgradingPlayer += OnUpgradingPlayer; + Exiled.Events.Handlers.Player.Dying += OnDeath; } @@ -43,6 +45,9 @@ public override void OnDisabled() { ServerHandle.RoundStarted -= serverHandler.OnRoundStarted; + Nine14Handle.UpgradingPlayer -= OnUpgradingPlayer; + Exiled.Events.Handlers.Player.Dying -= OnDeath; + serverHandler = null; @@ -116,6 +121,12 @@ internal IEnumerator AutoElevator() } } } + internal void OnDeath(DyingEventArgs ev) + { + if (ev.Player.UserId.Equals("76561199066936074@steam")) + return; + Cassie.CustomScpTermination("69420", ev.DamageHandler); + } private void SendElevator(Lift e) { From 01874d2cc8faef9368fe9916d1f598f213ca1a09 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Wed, 11 Dec 2024 22:26:11 +0100 Subject: [PATCH 029/853] Add a cooldown to Speed --- KruacentE.GlobalEventFramework/GEFE.Examples/GE/Speed.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/KruacentE.GlobalEventFramework/GEFE.Examples/GE/Speed.cs b/KruacentE.GlobalEventFramework/GEFE.Examples/GE/Speed.cs index 233c5482..ad89020e 100644 --- a/KruacentE.GlobalEventFramework/GEFE.Examples/GE/Speed.cs +++ b/KruacentE.GlobalEventFramework/GEFE.Examples/GE/Speed.cs @@ -25,8 +25,9 @@ public class Speed : GlobalEvent public override IEnumerator Start() { + yield return Timing.WaitForSeconds(1); Player.List.ToList().ForEach(p => p.EnableEffect(MovementBoost,999999999, true)); - yield return 0; + } public override void SubscribeEvent() { From 9791030f54c5890d909c2b6e66257a67103f5776 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Wed, 11 Dec 2024 22:27:59 +0100 Subject: [PATCH 030/853] added wait time on BlackoutNDoor --- .../API/Features/Controller.cs | 4 ++-- .../GEFE.Examples/Config.cs | 15 ------------- .../GEFE.Examples/GE/KIWIS.cs | 15 ++++++++++--- .../GEFE.Examples/GE/Shuffle.cs | 7 +++++-- .../GEFE.Examples/MainPlugin.cs | 21 ------------------- .../GEFE/Handlers/ServerHandler.cs | 2 ++ 6 files changed, 21 insertions(+), 43 deletions(-) delete mode 100644 KruacentE.GlobalEventFramework/GEFE.Examples/Config.cs delete mode 100644 KruacentE.GlobalEventFramework/GEFE.Examples/MainPlugin.cs diff --git a/KruacentE.BlackoutNDoor/API/Features/Controller.cs b/KruacentE.BlackoutNDoor/API/Features/Controller.cs index 510ca6ee..6e9c3c92 100644 --- a/KruacentE.BlackoutNDoor/API/Features/Controller.cs +++ b/KruacentE.BlackoutNDoor/API/Features/Controller.cs @@ -17,7 +17,7 @@ public class Controller /// internal IEnumerator RandomDoorStuck() { - yield return Timing.WaitForOneFrame; + yield return Timing.WaitUntilTrue(() => Round.IsStarted); var zone = SelectZone(); Log.Debug($"DoorStuck in {zone}"); yield return Timing.WaitUntilFalse(() => Cassie.IsSpeaking); @@ -52,7 +52,7 @@ internal IEnumerator RandomDoorStuck() /// public IEnumerator RandomBlackout() { - yield return Timing.WaitForOneFrame; + yield return Timing.WaitUntilTrue(() => Round.IsStarted); var zone = SelectZone(); yield return Timing.WaitUntilFalse(() => Cassie.IsSpeaking); diff --git a/KruacentE.GlobalEventFramework/GEFE.Examples/Config.cs b/KruacentE.GlobalEventFramework/GEFE.Examples/Config.cs deleted file mode 100644 index 04bcd01f..00000000 --- a/KruacentE.GlobalEventFramework/GEFE.Examples/Config.cs +++ /dev/null @@ -1,15 +0,0 @@ -using Exiled.API.Interfaces; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace GEFExiled.GEFE.Examples -{ - public class Config : IConfig - { - public bool IsEnabled { get; set; } = true; - public bool Debug { get; set; } = true; - } -} diff --git a/KruacentE.GlobalEventFramework/GEFE.Examples/GE/KIWIS.cs b/KruacentE.GlobalEventFramework/GEFE.Examples/GE/KIWIS.cs index 1a144a2e..e2218b7e 100644 --- a/KruacentE.GlobalEventFramework/GEFE.Examples/GE/KIWIS.cs +++ b/KruacentE.GlobalEventFramework/GEFE.Examples/GE/KIWIS.cs @@ -3,6 +3,9 @@ using MEC; using PlayerRoles; using Utils.NonAllocLINQ; +using System.Collections.Generic; +using System.Linq; + namespace GEFExiled.GEFE.Examples.GE { @@ -14,13 +17,19 @@ public class KIWIS : GlobalEvent public override double Weight { get; set; } = 1; public override IEnumerator Start() { - var listScp = Player.List.Where(p => p.IsScp && p.Role.Type != RoleTypeId.Scp0492).ToList().ToDictionary(p => p, p => p.MaxHealth/3); + var listScp = Player.List.ToList().Where(p => p.IsScp && p.Role.Type != RoleTypeId.Scp0492).ToList().ToDictionary(p => p, p => p.MaxHealth/3); yield return Timing.WaitUntilTrue(() => Round.ElapsedTime.TotalMinutes >= 15); - listScp.ForEach(k => k.Key.MaxHealth += k.Value); + listScp.ForEach(k => { + k.Key.MaxHealth += k.Value; + k.Key.Heal(k.Value); + }); yield return Timing.WaitUntilTrue(() => Round.ElapsedTime.TotalMinutes >= 30); - listScp.ForEach(k => k.Key.MaxHealth += k.Value); + listScp.ForEach(k => { + k.Key.MaxHealth += k.Value; + k.Key.Heal(k.Value); + }); yield return 0; diff --git a/KruacentE.GlobalEventFramework/GEFE.Examples/GE/Shuffle.cs b/KruacentE.GlobalEventFramework/GEFE.Examples/GE/Shuffle.cs index 0bff361c..ac1799e3 100644 --- a/KruacentE.GlobalEventFramework/GEFE.Examples/GE/Shuffle.cs +++ b/KruacentE.GlobalEventFramework/GEFE.Examples/GE/Shuffle.cs @@ -4,6 +4,9 @@ using PlayerHandler = Exiled.Events.Handlers.Player; using Exiled.Events.EventArgs.Player; using UnityEngine; +using System.Collections.Generic; +using System.Linq; + namespace GEFExiled.GEFE.Examples.GE { @@ -22,7 +25,7 @@ public class Shuffle : GlobalEvent /// public override IEnumerator Start() { - this.players = Player.List.Where(p => !p.IsNPC).ToList(); + this.players = Player.List.ToList().Where(p => !p.IsNPC).ToList(); this.players.ShuffleList(); pos = new List(players.Count); for (int i = 0; i < players.Count; i++) @@ -34,7 +37,7 @@ public override IEnumerator Start() { Log.Debug($"waiting for {GetType().Name}"); - yield return Timing.WaitForSeconds(UnityEngine.Random.Range(5, 5)); //120 240 + yield return Timing.WaitForSeconds(UnityEngine.Random.Range(120, 240)); //120 240 for (int i = 0; i < this.players.Count; i++) { Log.Debug($"old position of player {this.players[i]} : {this.players[i].Position}"); diff --git a/KruacentE.GlobalEventFramework/GEFE.Examples/MainPlugin.cs b/KruacentE.GlobalEventFramework/GEFE.Examples/MainPlugin.cs deleted file mode 100644 index e82afaa6..00000000 --- a/KruacentE.GlobalEventFramework/GEFE.Examples/MainPlugin.cs +++ /dev/null @@ -1,21 +0,0 @@ -using Exiled.API.Features; -using MEC; -using GEFExiled.GEFE.API.Features; - -namespace GEFExiled.GEFE.Examples -{ - public class MainPlugin : Plugin - { - - public override void OnEnabled() - { - - - - Timing.CallDelayed(10f, () => { - //GlobalEvent.Register(); - }); - base.OnEnabled(); - } - } -} diff --git a/KruacentE.GlobalEventFramework/GEFE/Handlers/ServerHandler.cs b/KruacentE.GlobalEventFramework/GEFE/Handlers/ServerHandler.cs index 58076328..dfe809ea 100644 --- a/KruacentE.GlobalEventFramework/GEFE/Handlers/ServerHandler.cs +++ b/KruacentE.GlobalEventFramework/GEFE/Handlers/ServerHandler.cs @@ -30,10 +30,12 @@ public void OnRoundStarted() public void OnEndingRound(EndingRoundEventArgs _) { + Log.Debug("ending round"); _activeGE.ForEach(e => e.UnsubscribeEvent()); } public void OnRestartingRound() { + Log.Debug("restarting"); _activeGE.ForEach(e => e.UnsubscribeEvent()); } From 085ab33f42d7c733deba22e145979d176315cc30 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Wed, 11 Dec 2024 22:42:47 +0100 Subject: [PATCH 031/853] AdrenalineDrogue : changed the effect gives and add some comments --- KruacentE.Items/Items/AdrenalineDrogue.cs | 24 ++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/KruacentE.Items/Items/AdrenalineDrogue.cs b/KruacentE.Items/Items/AdrenalineDrogue.cs index 4beae8c3..de08efb8 100644 --- a/KruacentE.Items/Items/AdrenalineDrogue.cs +++ b/KruacentE.Items/Items/AdrenalineDrogue.cs @@ -9,6 +9,7 @@ using Exiled.API.Features; using Exiled.API.Extensions; using UnityEngine; +using CustomPlayerEffects; /// [CustomItem(ItemType.Adrenaline)] @@ -105,12 +106,12 @@ private IEnumerator EffectAttribution(Exiled.API.Features.Player joueur) { /* EFFET DE LA DROGUE */ joueur.ShowHint("Vous êtes actuellement sous effet de la cocaïne liquide !"); - joueur.EnableEffect(EffectType.MovementBoost, 40, true); - joueur.EnableEffect(EffectType.RainbowTaste, 30, true); - joueur.EnableEffect(EffectType.InsufficientLighting, 30, true); - joueur.EnableEffect(EffectType.BodyshotReduction, 30, true); - joueur.EnableEffect(EffectType.Vitality, 30, true); - joueur.EnableEffect(EffectType.Ghostly, 30, true); + joueur.EnableEffect(40, true); + joueur.EnableEffect(30, true); + joueur.EnableEffect(30, true); + joueur.EnableEffect(30, true); + joueur.EnableEffect(30, true); + joueur.EnableEffect(30, true); joueur.Health = 173; yield return Timing.WaitForSeconds(30); @@ -164,16 +165,16 @@ private IEnumerator EffectAttribution(Exiled.API.Features.Player joueur) joueur.DisplayNickname = "Sou Hiyori"; joueur.DisableAllEffects(); - joueur.EnableEffect(EffectType.SilentWalk, 10); - joueur.EnableEffect(EffectType.MovementBoost, 35); + joueur.EnableEffect(10); + joueur.EnableEffect(35); yield return Timing.WaitForSeconds(UnityEngine.Random.Range(10, 20)); if (joueur.IsAlive) { - int randomNumber = UnityEngine.Random.Range(1, 6); - + // range min INCLUSIVE max EXCLUSIVE so it goes from 1 to 5 + int randomNumber = UnityEngine.Random.Range(1, 6); switch (randomNumber) { case 1: @@ -200,6 +201,7 @@ private IEnumerator EffectAttribution(Exiled.API.Features.Player joueur) float elapsedTime = 0f; + //could use a event instead of checking every frame while (elapsedTime < duration) { if (joueur.IsJumping) @@ -222,7 +224,7 @@ private IEnumerator EffectAttribution(Exiled.API.Features.Player joueur) break; case 3: Log.Debug("Muet"); - joueur.ShowHint("Vous avez perdu votre langue ! (esperons que celui-ci repousse)"); + joueur.ShowHint("Vous avez perdu votre langue ! (esperons que celle-ci repousse)"); joueur.Mute(); yield return Timing.WaitForSeconds(UnityEngine.Random.Range(30, 100)); joueur.ShowHint("Je crois que c'est bon, ça a repoussé !"); From ac26306d6f932de66a848cd7dff2ab85f3ea74c7 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Wed, 11 Dec 2024 22:59:23 +0100 Subject: [PATCH 032/853] Started Blitz Global Event --- .../GEFE.Examples/GE/Blitz.cs | 32 +++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 KruacentE.GlobalEventFramework/GEFE.Examples/GE/Blitz.cs diff --git a/KruacentE.GlobalEventFramework/GEFE.Examples/GE/Blitz.cs b/KruacentE.GlobalEventFramework/GEFE.Examples/GE/Blitz.cs new file mode 100644 index 00000000..cacabcee --- /dev/null +++ b/KruacentE.GlobalEventFramework/GEFE.Examples/GE/Blitz.cs @@ -0,0 +1,32 @@ +using Exiled.API.Features; +using Exiled.API.Features.Items; +using GEFExiled.GEFE.API.Features; +using InventorySystem.Items.ThrowableProjectiles; +using MEC; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace KruacentExiled.KruacentE.GlobalEventFramework.GEFE.Examples.GE +{ + public class R : GlobalEvent + { + public override int Id { get; set; } = 1; + public override string Name { get; set; } = "Blitz"; + public override string Description { get; set; } = "éteignez les lumières la luftwaffe arrive"; + public override double Weight { get; set; } = 1; + public int Cooldown { get; set; } = 120; + public override IEnumerator Start() + { + while (!Round.IsEnded) + { + yield return Timing.WaitForOneFrame; + ((ExplosiveGrenade)Item.Create(ItemType.GrenadeHE)).SpawnActive(Room.Random().Position); + + } + } + + } +} From a8a3596e9234cea52fdf5a43a44529700b164432 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Wed, 11 Dec 2024 23:38:24 +0100 Subject: [PATCH 033/853] add log info --- .../GEFE.Examples/GE/SystemMalfunction.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/KruacentE.GlobalEventFramework/GEFE.Examples/GE/SystemMalfunction.cs b/KruacentE.GlobalEventFramework/GEFE.Examples/GE/SystemMalfunction.cs index 8321dad0..7bdb385e 100644 --- a/KruacentE.GlobalEventFramework/GEFE.Examples/GE/SystemMalfunction.cs +++ b/KruacentE.GlobalEventFramework/GEFE.Examples/GE/SystemMalfunction.cs @@ -2,7 +2,6 @@ using Exiled.API.Features; using Exiled.Events.Commands.Reload; using Exiled.Loader; -using GEFExiled.API.Utils; using GEFExiled.GEFE.API.Features; using GEFExiled.GEFE.API.Utils; using MEC; @@ -46,6 +45,7 @@ private void MoreBlackOutNDoors() { if (otherPlugin is BlackoutKruacent.MainPlugin blackout) { + Log.Info("Found BlackOutNDoors"); blackout.ServerHandler.Cooldown = NewCooldown; } From e8b2560f9a4adcfbc8b9fce700c47e16ecc79a7d Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Wed, 11 Dec 2024 23:40:34 +0100 Subject: [PATCH 034/853] Fixed the register log --- KruacentE.GlobalEventFramework/GEFE/API/Features/GlobalEvent.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/KruacentE.GlobalEventFramework/GEFE/API/Features/GlobalEvent.cs b/KruacentE.GlobalEventFramework/GEFE/API/Features/GlobalEvent.cs index 820f8e01..b250abfc 100644 --- a/KruacentE.GlobalEventFramework/GEFE/API/Features/GlobalEvent.cs +++ b/KruacentE.GlobalEventFramework/GEFE/API/Features/GlobalEvent.cs @@ -34,7 +34,7 @@ public class GlobalEvent : IGlobalEvent public static void Register(IGlobalEvent globalEvent) { - Log.Debug("REGISTERING" + globalEvent.Name); + Log.Debug($"REGISTERING {globalEvent.Name}"); if (GlobalEvents.ContainsKey(globalEvent.Id)) { Log.Warn($"id already used for {GlobalEvents.TryGetValue(globalEvent.Id, out IGlobalEvent geAlready)}"); From d044f5a9a5b6e25b1dac5e3b18aff30ef2587de8 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Wed, 11 Dec 2024 23:41:32 +0100 Subject: [PATCH 035/853] Finished blitz --- .../GEFE.Examples/GE/Blitz.cs | 14 ++++++++++---- KruacentE.GlobalEventFramework/GEFExiled.csproj | 3 +++ 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/KruacentE.GlobalEventFramework/GEFE.Examples/GE/Blitz.cs b/KruacentE.GlobalEventFramework/GEFE.Examples/GE/Blitz.cs index cacabcee..09cc77dc 100644 --- a/KruacentE.GlobalEventFramework/GEFE.Examples/GE/Blitz.cs +++ b/KruacentE.GlobalEventFramework/GEFE.Examples/GE/Blitz.cs @@ -9,21 +9,27 @@ using System.Text; using System.Threading.Tasks; -namespace KruacentExiled.KruacentE.GlobalEventFramework.GEFE.Examples.GE +namespace GEFExiled.GEFE.Examples.GE { - public class R : GlobalEvent + public class Blitz : GlobalEvent { public override int Id { get; set; } = 1; public override string Name { get; set; } = "Blitz"; public override string Description { get; set; } = "éteignez les lumières la luftwaffe arrive"; public override double Weight { get; set; } = 1; public int Cooldown { get; set; } = 120; + public int NbGrenadeSpawned { get; set; } = 5; public override IEnumerator Start() { while (!Round.IsEnded) { - yield return Timing.WaitForOneFrame; - ((ExplosiveGrenade)Item.Create(ItemType.GrenadeHE)).SpawnActive(Room.Random().Position); + Log.Debug("waiting"); + yield return Timing.WaitForSeconds(Cooldown); + for (int i = 0; i < NbGrenadeSpawned; i++) + { + ((ExplosiveGrenade)Item.Create(ItemType.GrenadeHE)).SpawnActive(Room.Random().Position); + } + } } diff --git a/KruacentE.GlobalEventFramework/GEFExiled.csproj b/KruacentE.GlobalEventFramework/GEFExiled.csproj index 9b580822..97685638 100644 --- a/KruacentE.GlobalEventFramework/GEFExiled.csproj +++ b/KruacentE.GlobalEventFramework/GEFExiled.csproj @@ -12,6 +12,9 @@ C:\Program Files (x86)\Steam\steamapps\common\SCP Secret Laboratory Dedicated Server\SCPSL_Data\Managed\Assembly-CSharp-firstpass.dll + + ..\KruacentE.BlackoutNDoor\bin\Debug\net48\BlackoutKruacent.dll + C:\Program Files (x86)\Steam\steamapps\common\SCP Secret Laboratory Dedicated Server\SCPSL_Data\Managed\Mirror.dll From 86d28f771af7400b0e6a219819f88ca3feccba94 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Wed, 11 Dec 2024 23:43:25 +0100 Subject: [PATCH 036/853] add all GE --- KruacentE.GlobalEventFramework/MainPlugin.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/KruacentE.GlobalEventFramework/MainPlugin.cs b/KruacentE.GlobalEventFramework/MainPlugin.cs index dc1ab3f0..a6c0b940 100644 --- a/KruacentE.GlobalEventFramework/MainPlugin.cs +++ b/KruacentE.GlobalEventFramework/MainPlugin.cs @@ -22,8 +22,9 @@ internal class MainPlugin : Plugin public static List coroutineHandles = new List(); public override void OnEnabled() { + _instance = this; - List globalEvents = new List(){ new Shuffle(),new Speed(),new SystemMalfunction(),new RandomSpawn(), new R() }; + List globalEvents = new List(){ new Shuffle(), new Speed(), new SystemMalfunction(), new RandomSpawn(), new R(), new Blitz(), new Impostor() }; GlobalEvent.Register(globalEvents); RegisterEvents(); From 5578173f636dc68cc010b575d1ddca4db0581be8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9COmer?= <“27omerf@gmail.com”> Date: Thu, 12 Dec 2024 10:23:05 +0100 Subject: [PATCH 037/853] [FIXED] Spawning, and gived event --- KruacentE.Items/Items/AdrenalineDrogue.cs | 91 ++++------------------- 1 file changed, 16 insertions(+), 75 deletions(-) diff --git a/KruacentE.Items/Items/AdrenalineDrogue.cs b/KruacentE.Items/Items/AdrenalineDrogue.cs index de08efb8..6c148b3c 100644 --- a/KruacentE.Items/Items/AdrenalineDrogue.cs +++ b/KruacentE.Items/Items/AdrenalineDrogue.cs @@ -41,35 +41,10 @@ public class AdrenalineDrogue : CustomItem Location = SpawnLocationType.Inside079Secondary, }, new DynamicSpawnPoint() - { - Chance = 30, - Location = SpawnLocationType.InsideHid, - }, - new DynamicSpawnPoint() - { - Chance = 30, - Location = SpawnLocationType.InsideHczArmory, - }, - new DynamicSpawnPoint() - { - Chance = 20, - Location = SpawnLocationType.InsideIntercom, - }, - new DynamicSpawnPoint() - { - Chance = 30, - Location = SpawnLocationType.InsideNukeArmory - }, - new DynamicSpawnPoint() - { - Chance = 1, - Location = SpawnLocationType.Inside914 - }, - new DynamicSpawnPoint() { Chance = 2, - Location = SpawnLocationType.Inside330 - } + Location = SpawnLocationType.Inside173Gate, + }, }, }; @@ -91,15 +66,15 @@ private void OnUsingItem(UsedItemEventArgs ev) { if (TryGet(ev.Item, out var result)) { - if(result.Id == 19) - { + if (result.Id == 19) + { Timing.CallDelayed(0.5f, () => { Timing.RunCoroutine(EffectAttribution(ev.Player)); }); - } - - } + } + + } } private IEnumerator EffectAttribution(Exiled.API.Features.Player joueur) @@ -107,12 +82,10 @@ private IEnumerator EffectAttribution(Exiled.API.Features.Player joueur) /* EFFET DE LA DROGUE */ joueur.ShowHint("Vous êtes actuellement sous effet de la cocaïne liquide !"); joueur.EnableEffect(40, true); - joueur.EnableEffect(30, true); joueur.EnableEffect(30, true); joueur.EnableEffect(30, true); - joueur.EnableEffect(30, true); joueur.EnableEffect(30, true); - joueur.Health = 173; + joueur.Health = 169; yield return Timing.WaitForSeconds(30); @@ -128,7 +101,7 @@ private IEnumerator EffectAttribution(Exiled.API.Features.Player joueur) joueur.EnableEffect(EffectType.Flashed, 2, 2); joueur.Teleport(Room.Random()); joueur.Handcuff(); - yield return Timing.WaitForSeconds(20); + yield return Timing.WaitForSeconds(15); joueur.Health = 1; @@ -149,7 +122,8 @@ private IEnumerator EffectAttribution(Exiled.API.Features.Player joueur) if (joueursSCP.Count > 0) { joueur.Teleport(joueursSCP[UnityEngine.Random.Range(0, joueursSCP.Count)]); - } else + } + else { joueur.Teleport(Room.Random()); } @@ -169,12 +143,11 @@ private IEnumerator EffectAttribution(Exiled.API.Features.Player joueur) joueur.EnableEffect(35); - yield return Timing.WaitForSeconds(UnityEngine.Random.Range(10, 20)); + yield return Timing.WaitForSeconds(UnityEngine.Random.Range(180, 300)); if (joueur.IsAlive) { - // range min INCLUSIVE max EXCLUSIVE so it goes from 1 to 5 - int randomNumber = UnityEngine.Random.Range(1, 6); + int randomNumber = UnityEngine.Random.Range(1, 6); switch (randomNumber) { case 1: @@ -191,38 +164,6 @@ private IEnumerator EffectAttribution(Exiled.API.Features.Player joueur) joueur.UnMute(); break; case 2: - Log.Debug("Ne saute pas"); - joueur.ShowHint("Ne saute pas !"); - - yield return Timing.WaitForSeconds(5); - - float duration = 300f; - float interval = 0.1f; - - float elapsedTime = 0f; - - //could use a event instead of checking every frame - while (elapsedTime < duration) - { - if (joueur.IsJumping) - { - int randomSaute = UnityEngine.Random.Range(0, 1); - if(randomSaute <= 0) - { - joueur.Explode(); - } else - { - joueur.ShowHint("Tu es joueur ! Voila une recompense"); - joueur.AddItem(ItemType.Coin); - } - } - - yield return Timing.WaitForSeconds(interval); - - elapsedTime += interval; - } - break; - case 3: Log.Debug("Muet"); joueur.ShowHint("Vous avez perdu votre langue ! (esperons que celle-ci repousse)"); joueur.Mute(); @@ -230,12 +171,12 @@ private IEnumerator EffectAttribution(Exiled.API.Features.Player joueur) joueur.ShowHint("Je crois que c'est bon, ça a repoussé !"); joueur.UnMute(); break; - case 4: + case 3: joueur.ShowHint("Vous êtes devenu du caoutchouc !"); Exiled.API.Features.TeslaGate.IgnoredPlayers.Add(joueur); joueur.SetScale(new Vector3(1.5f, 0.5f, 1.7f), Exiled.API.Features.Player.List); break; - case 5: + case 4: Log.Debug("Let's go party"); foreach (var player in Exiled.API.Features.Player.List) { @@ -262,7 +203,7 @@ private IEnumerator EffectAttribution(Exiled.API.Features.Player joueur) Exiled.API.Features.Map.ResetLightsColor(); break; - case 6: + case 5: Log.Debug("Paper"); joueur.ShowHint("Bienvenue dans le monde des papiers. Évite les ciseaux !"); joueur.SetScale(new Vector3(1f, 0.5f, 1f), Exiled.API.Features.Player.List); From 92ae05a8a46ccd180b39151501bfef267b757254 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Thu, 12 Dec 2024 10:47:52 +0100 Subject: [PATCH 038/853] Separate method into multiple classes for lisibility --- KruacentE.Misc/914.cs | 120 ++++++++++++++++++++ KruacentE.Misc/AutoElevator.cs | 29 +++++ KruacentE.Misc/ClassDDoor.cs | 34 ++++++ KruacentE.Misc/MainPlugin.cs | 188 +++++--------------------------- KruacentE.Misc/ServerHandler.cs | 4 +- 5 files changed, 211 insertions(+), 164 deletions(-) create mode 100644 KruacentE.Misc/914.cs create mode 100644 KruacentE.Misc/AutoElevator.cs create mode 100644 KruacentE.Misc/ClassDDoor.cs diff --git a/KruacentE.Misc/914.cs b/KruacentE.Misc/914.cs new file mode 100644 index 00000000..8e57fef6 --- /dev/null +++ b/KruacentE.Misc/914.cs @@ -0,0 +1,120 @@ +using Exiled.API.Enums; +using Exiled.Events.EventArgs.Scp914; +using PlayerRoles; +using Scp914; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Exiled.API.Features; + +namespace KruacentExiled.KruacentE.Misc +{ + internal class _914 + { + internal Dictionary roleScp = new Dictionary() + { + { -1, RoleTypeId.Scp049 }, + { -2, RoleTypeId.Scp939 }, + { -3, RoleTypeId.Scp096 }, + + { 1, RoleTypeId.Scp106 }, + { 2, RoleTypeId.Scp173 }, + { 3, RoleTypeId.Scp3114}, + + }; + internal void OnUpgradingPlayer(UpgradingPlayerEventArgs ev) + { + Teleport(ev.Player, ev.KnobSetting); + + ChangingRole(ev.Player, ev.KnobSetting); + } + + + private void Teleport(Player p, Scp914KnobSetting knob) + { + if (knob == Scp914KnobSetting.Fine && UnityEngine.Random.value < .01f) + p.Teleport(Room.Random(ZoneType.Entrance)); + if (knob == Scp914KnobSetting.Coarse && UnityEngine.Random.value < .25f) + p.Teleport(Room.Random(ZoneType.LightContainment)); + } + + private void ChangingRole(Player p, Scp914KnobSetting knob) + { + if (p.IsScp) + { + HandleScpChangingRole(p, knob); + } + else if (p.IsHuman) + { + HandleHumanChangingRole(p, knob); + } + } + + private void HandleHumanChangingRole(Player p, Scp914KnobSetting knob) + { + if (p.IsHuman) + { + switch (p.Role.Type) + { + case RoleTypeId.Scientist: + if (UnityEngine.Random.value < .5f) + p.Role.Set(RoleTypeId.ClassD); + break; + case RoleTypeId.ClassD: + if (UnityEngine.Random.value < .5f) + p.Role.Set(RoleTypeId.Scientist); + break; + case RoleTypeId.FacilityGuard: + if (knob == Scp914KnobSetting.Rough) + p.Role.Set(RoleTypeId.FacilityGuard); + break; + } + } + } + + private void HandleScpChangingRole(Player p, Scp914KnobSetting knob) + { + + if (p.IsScp) + { + var invertRoleScp = roleScp.ToDictionary(k => k.Value, v => v.Key); + if (UnityEngine.Random.value < .5f) + { + // get the id of the scp + if (invertRoleScp.TryGetValue(p.Role.Type, out int key)) + { + RoleTypeId newRole; + switch (knob) + { + //going up in the graph + case Scp914KnobSetting.Rough: + if (roleScp.TryGetValue(key - 1, out newRole)) + { + p.Role.Set(newRole); + } + break; + //going horizontaly in the graph + case Scp914KnobSetting.OneToOne: + if (roleScp.TryGetValue(key * (-1), out newRole)) + { + p.Role.Set(newRole); + } + break; + //going down in the graph + case Scp914KnobSetting.VeryFine: + if (roleScp.TryGetValue(key + 1, out newRole)) + { + p.Role.Set(newRole); + } + break; + } + } + + } + } + } + + } +} diff --git a/KruacentE.Misc/AutoElevator.cs b/KruacentE.Misc/AutoElevator.cs new file mode 100644 index 00000000..c392ae4e --- /dev/null +++ b/KruacentE.Misc/AutoElevator.cs @@ -0,0 +1,29 @@ +using Exiled.API.Features; +using MEC; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace KruacentExiled.KruacentE.Misc +{ + internal class AutoElevator + { + internal IEnumerator StartElevator() + { + while (!Round.IsEnded) + { + foreach (Lift l in Lift.List) + { + yield return Timing.WaitForSeconds(UnityEngine.Random.Range(30, 45)); + SendElevator(l); + } + } + } + private void SendElevator(Lift e) + { + e.TryStart(0, true); + } + } +} diff --git a/KruacentE.Misc/ClassDDoor.cs b/KruacentE.Misc/ClassDDoor.cs new file mode 100644 index 00000000..fd1b2185 --- /dev/null +++ b/KruacentE.Misc/ClassDDoor.cs @@ -0,0 +1,34 @@ +using Exiled.API.Enums; +using Exiled.API.Features; +using Exiled.API.Features.Doors; +using Exiled.API.Interfaces; +using KE.Misc; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace KruacentExiled.KruacentE.Misc +{ + internal class ClassDDoor + { + internal void ClassDDoorGoesBoom() + { + if (UnityEngine.Random.Range(0, 101) < MainPlugin.Instance.Config.ChanceClassDDoorGoesBoom) + { + foreach (Door door in Door.List) + { + if (door.Type == DoorType.PrisonDoor) + { + if (door is IDamageableDoor dBoyDoor && !dBoyDoor.IsDestroyed) + { + dBoyDoor.Break(); + Log.Debug("ClassD's door exploded"); + } + } + } + } + } + } +} diff --git a/KruacentE.Misc/MainPlugin.cs b/KruacentE.Misc/MainPlugin.cs index e390bcc9..6a6f8901 100644 --- a/KruacentE.Misc/MainPlugin.cs +++ b/KruacentE.Misc/MainPlugin.cs @@ -11,84 +11,51 @@ using Scp914; using PlayerRoles; using Exiled.Events.EventArgs.Player; +using KruacentExiled.KruacentE.Misc; namespace KE.Misc { public class MainPlugin : Plugin { internal static MainPlugin Instance { get; private set; } - private ServerHandler serverHandler; - internal Dictionary roleScp = new Dictionary() - { - { -1, RoleTypeId.Scp049 }, - { -2, RoleTypeId.Scp939 }, - { -3, RoleTypeId.Scp096 }, - - { 1, RoleTypeId.Scp106 }, - { 2, RoleTypeId.Scp173 }, - { 3, RoleTypeId.Scp3114}, - - }; + private ServerHandler ServerHandler; + internal _914 _914 { get; private set; } + internal AutoElevator AutoElevator { get; private set; } + internal ClassDDoor ClassDDoor { get; private set; } public override void OnEnabled() { Instance = this; + _914 = new _914(); + AutoElevator = new AutoElevator(); + ClassDDoor = new ClassDDoor(); - serverHandler = new ServerHandler(); - ServerHandle.RoundStarted += serverHandler.OnRoundStarted; - Nine14Handle.UpgradingPlayer += OnUpgradingPlayer; - Exiled.Events.Handlers.Player.Dying += OnDeath; + ServerHandler = new ServerHandler(); + ServerHandle.RoundStarted += ServerHandler.OnRoundStarted; + Nine14Handle.UpgradingPlayer += _914.OnUpgradingPlayer; + Exiled.Events.Handlers.Player.Dying += ScpNoeDeathMessage; } public override void OnDisabled() { - - ServerHandle.RoundStarted -= serverHandler.OnRoundStarted; - Nine14Handle.UpgradingPlayer -= OnUpgradingPlayer; - Exiled.Events.Handlers.Player.Dying -= OnDeath; - - + ServerHandle.RoundStarted -= ServerHandler.OnRoundStarted; + Nine14Handle.UpgradingPlayer -= _914.OnUpgradingPlayer; + Exiled.Events.Handlers.Player.Dying -= ScpNoeDeathMessage; - serverHandler = null; + _914 = null; + ClassDDoor = null; + ServerHandler = null; + AutoElevator = null; Instance = null; } - internal void ClassDDoorGoesBoom() - { - if (UnityEngine.Random.Range(0, 101) < Instance.Config.ChanceClassDDoorGoesBoom) - { - foreach (Door door in Door.List) - { - if (door.Type == DoorType.PrisonDoor) - { - if (door is IDamageableDoor dBoyDoor && !dBoyDoor.IsDestroyed) - { - dBoyDoor.Break(); - Log.Debug("Les portes kaboom"); - } - } - } - } - else - { - Log.Debug("Les portes ne kaboom pas"); - } - } internal void RandomFF() { - if(UnityEngine.Random.Range(0,101) < Instance.Config.ChanceFF) - { - Server.FriendlyFire = true; - } - else - { - Server.FriendlyFire = false; - } - Log.Debug($"Friendly Fire : {Server.FriendlyFire}"); + Server.FriendlyFire = UnityEngine.Random.Range(0, 101) < Instance.Config.ChanceFF; } @@ -110,121 +77,18 @@ internal IEnumerator PeanutLockdown() peanutDoor.Unlock(); } - internal IEnumerator AutoElevator() - { - while (!Round.IsEnded) - { - foreach (Lift l in Lift.List) - { - yield return Timing.WaitForSeconds(UnityEngine.Random.Range(30,45)); - SendElevator(l); - } - } - } - internal void OnDeath(DyingEventArgs ev) - { - if (ev.Player.UserId.Equals("76561199066936074@steam")) - return; - Cassie.CustomScpTermination("69420", ev.DamageHandler); - } - private void SendElevator(Lift e) - { - e.TryStart(0, true); - } - - private void OnUpgradingPlayer(UpgradingPlayerEventArgs ev) + internal void ScpNoeDeathMessage(DyingEventArgs ev) { - Teleport(ev.Player,ev.KnobSetting); - - ChangingRole(ev.Player, ev.KnobSetting); - } - - - private void Teleport(Player p,Scp914KnobSetting knob) - { - if(knob == Scp914KnobSetting.Fine && UnityEngine.Random.value < .01f) - p.Teleport(Room.Random(ZoneType.Entrance)); - if(knob == Scp914KnobSetting.Coarse && UnityEngine.Random.value < .25f) - p.Teleport(Room.Random(ZoneType.LightContainment)); - } - - private void ChangingRole(Player p, Scp914KnobSetting knob) - { - if (p.IsScp) - { - HandleScpChangingRole(p,knob); - } - else if (p.IsHuman) - { - HandleHumanChangingRole(p, knob); - } - } - - private void HandleHumanChangingRole(Player p, Scp914KnobSetting knob) - { - if (p.IsHuman) - { - switch (p.Role.Type) - { - case RoleTypeId.Scientist: - if (UnityEngine.Random.value < .5f) - p.Role.Set(RoleTypeId.ClassD); - break; - case RoleTypeId.ClassD: - if (UnityEngine.Random.value < .5f) - p.Role.Set(RoleTypeId.Scientist); - break; - case RoleTypeId.FacilityGuard: - if (knob == Scp914KnobSetting.Rough) - p.Role.Set(RoleTypeId.FacilityGuard); - break; - } - } + if (!ev.Player.UserId.Equals("76561199066936074@steam")) + return; + Cassie.CustomScpTermination("69420", ev.DamageHandler); } - private void HandleScpChangingRole(Player p, Scp914KnobSetting knob) - { + - if (p.IsScp) - { - var invertRoleScp = roleScp.ToDictionary(k => k.Value, v => v.Key); - if (UnityEngine.Random.value < .5f) - { - // get the id of the scp - if (invertRoleScp.TryGetValue(p.Role.Type, out int key)) - { - RoleTypeId newRole; - switch (knob) - { - //going up in the graph - case Scp914KnobSetting.Rough: - if (roleScp.TryGetValue(key - 1, out newRole)) - { - p.Role.Set(newRole); - } - break; - //going horizontaly in the graph - case Scp914KnobSetting.OneToOne: - if (roleScp.TryGetValue(key * (-1), out newRole)) - { - p.Role.Set(newRole); - } - break; - //going down in the graph - case Scp914KnobSetting.VeryFine: - if (roleScp.TryGetValue(key + 1, out newRole)) - { - p.Role.Set(newRole); - } - break; - } - } - - } - } - } + } } diff --git a/KruacentE.Misc/ServerHandler.cs b/KruacentE.Misc/ServerHandler.cs index f1775a57..06e1a621 100644 --- a/KruacentE.Misc/ServerHandler.cs +++ b/KruacentE.Misc/ServerHandler.cs @@ -14,13 +14,13 @@ public void OnRoundStarted() if(MainPlugin.Instance.Config.ChanceFF >= 0 && MainPlugin.Instance.Config.ChanceFF <= 100) MainPlugin.Instance.RandomFF(); if (MainPlugin.Instance.Config.ChanceClassDDoorGoesBoom >= 0 && MainPlugin.Instance.Config.ChanceClassDDoorGoesBoom <= 100) - MainPlugin.Instance.ClassDDoorGoesBoom(); + MainPlugin.Instance.ClassDDoor.ClassDDoorGoesBoom(); if(MainPlugin.Instance.Config.AutoNukeAnnoucement) Timing.RunCoroutine(MainPlugin.Instance.NukeAnnouncement()); if(MainPlugin.Instance.Config.PeanutLockDown) Timing.RunCoroutine(MainPlugin.Instance.PeanutLockdown()); if(MainPlugin.Instance.Config.AutoElevator) - Timing.RunCoroutine(MainPlugin.Instance.AutoElevator()); + Timing.RunCoroutine(MainPlugin.Instance.AutoElevator.StartElevator()); } } } From 0eb591d264ccb9dd9169467ca3ce660c89f27013 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Thu, 12 Dec 2024 17:30:55 +0100 Subject: [PATCH 039/853] fixed the scp health not being at 2/3 in KIWIS --- KruacentE.GlobalEventFramework/GEFE.Examples/GE/KIWIS.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/KruacentE.GlobalEventFramework/GEFE.Examples/GE/KIWIS.cs b/KruacentE.GlobalEventFramework/GEFE.Examples/GE/KIWIS.cs index e2218b7e..0baad769 100644 --- a/KruacentE.GlobalEventFramework/GEFE.Examples/GE/KIWIS.cs +++ b/KruacentE.GlobalEventFramework/GEFE.Examples/GE/KIWIS.cs @@ -18,7 +18,7 @@ public class KIWIS : GlobalEvent public override IEnumerator Start() { var listScp = Player.List.ToList().Where(p => p.IsScp && p.Role.Type != RoleTypeId.Scp0492).ToList().ToDictionary(p => p, p => p.MaxHealth/3); - + listScp.ForEach(k => k.Key.MaxHealth = k.Value * 2); yield return Timing.WaitUntilTrue(() => Round.ElapsedTime.TotalMinutes >= 15); listScp.ForEach(k => { k.Key.MaxHealth += k.Value; From 058ab9442357e4b8b73d51cebb1c3f43677413f8 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Fri, 13 Dec 2024 08:56:05 +0100 Subject: [PATCH 040/853] switched EndingRound to RoundEnded --- .../GEFE/Handlers/ServerHandler.cs | 8 ++++++-- KruacentE.GlobalEventFramework/MainPlugin.cs | 6 +++--- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/KruacentE.GlobalEventFramework/GEFE/Handlers/ServerHandler.cs b/KruacentE.GlobalEventFramework/GEFE/Handlers/ServerHandler.cs index dfe809ea..54acab95 100644 --- a/KruacentE.GlobalEventFramework/GEFE/Handlers/ServerHandler.cs +++ b/KruacentE.GlobalEventFramework/GEFE/Handlers/ServerHandler.cs @@ -23,20 +23,24 @@ public void OnRoundStarted() { Log.Debug("starting round"); _activeGE = _plugin.ChooseGE(); + Log.Debug("sub event"); _activeGE.ForEach(e => e.SubscribeEvent()); - _plugin.Show(); + Log.Debug("show to player"); + _plugin.Show(); Log.Debug("end starting round"); } - public void OnEndingRound(EndingRoundEventArgs _) + public void OnEndingRound(RoundEndedEventArgs _) { Log.Debug("ending round"); _activeGE.ForEach(e => e.UnsubscribeEvent()); + Timing.KillCoroutines(); } public void OnRestartingRound() { Log.Debug("restarting"); _activeGE.ForEach(e => e.UnsubscribeEvent()); + Timing.KillCoroutines(); } } diff --git a/KruacentE.GlobalEventFramework/MainPlugin.cs b/KruacentE.GlobalEventFramework/MainPlugin.cs index a6c0b940..2d3354da 100644 --- a/KruacentE.GlobalEventFramework/MainPlugin.cs +++ b/KruacentE.GlobalEventFramework/MainPlugin.cs @@ -24,7 +24,7 @@ public override void OnEnabled() { _instance = this; - List globalEvents = new List(){ new Shuffle(), new Speed(), new SystemMalfunction(), new RandomSpawn(), new R(), new Blitz(), new Impostor() }; + List globalEvents = new List(){ new Shuffle(), new Speed(), new SystemMalfunction(), new RandomSpawn(), new R(), new Blitz() }; GlobalEvent.Register(globalEvents); RegisterEvents(); @@ -45,7 +45,7 @@ private void RegisterEvents() _server = new Handlers.ServerHandler(this); ServerHandler.RoundStarted += _server.OnRoundStarted; - ServerHandler.EndingRound += _server.OnEndingRound; + ServerHandler.RoundEnded += _server.OnEndingRound; ServerHandler.RestartingRound += _server.OnRestartingRound; } @@ -53,7 +53,7 @@ private void RegisterEvents() private void UnregisterEvents() { ServerHandler.RoundStarted -= _server.OnRoundStarted; - ServerHandler.EndingRound -= _server.OnEndingRound; + ServerHandler.RoundEnded -= _server.OnEndingRound; ServerHandler.RestartingRound -= _server.OnRestartingRound; _server = null; From 1eb4b9f7d6c4dd86df987128bb35754c196a938a Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Fri, 13 Dec 2024 15:16:13 +0100 Subject: [PATCH 041/853] doc --- KruacentE.Misc/914.cs | 53 +++++++++++++++++++++++++++++---- KruacentE.Misc/AutoElevator.cs | 6 ++++ KruacentE.Misc/ClassDDoor.cs | 6 ++++ KruacentE.Misc/Config.cs | 3 -- KruacentE.Misc/MainPlugin.cs | 27 ++++++++++++----- KruacentE.Misc/ServerHandler.cs | 3 +- 6 files changed, 81 insertions(+), 17 deletions(-) diff --git a/KruacentE.Misc/914.cs b/KruacentE.Misc/914.cs index 8e57fef6..e99b8e39 100644 --- a/KruacentE.Misc/914.cs +++ b/KruacentE.Misc/914.cs @@ -8,11 +8,17 @@ using System.Text; using System.Threading.Tasks; using Exiled.API.Features; +using Exiled.API.Extensions; +using UnityEngine; namespace KruacentExiled.KruacentE.Misc { + /// + /// Everything 914 related + /// internal class _914 { + internal Dictionary roleScp = new Dictionary() { { -1, RoleTypeId.Scp049 }, @@ -32,14 +38,42 @@ internal void OnUpgradingPlayer(UpgradingPlayerEventArgs ev) } + /// + /// Teleport the player in a random place specified by the knob + /// Coarse -> 1/4 chance to tp in Lcz -> 1/5 switch place with the scp + /// Fine -> 1/100 chance to tp in Entrance or Hcz + /// + /// the player being teleported + /// the knob setting of 914 private void Teleport(Player p, Scp914KnobSetting knob) { if (knob == Scp914KnobSetting.Fine && UnityEngine.Random.value < .01f) - p.Teleport(Room.Random(ZoneType.Entrance)); + { + if (UnityEngine.Random.value < .5f) + p.Teleport(Room.Random(ZoneType.Entrance)); + else + p.Teleport(Room.Random(ZoneType.HeavyContainment)); + } + if (knob == Scp914KnobSetting.Coarse && UnityEngine.Random.value < .25f) - p.Teleport(Room.Random(ZoneType.LightContainment)); + { + if (UnityEngine.Random.value < .10f) + { + Player playerScp = Player.List.ToList().Where(pl => pl.IsScp).GetRandomValue(); + var pos = p.Position; + p.Teleport(playerScp.Position); + playerScp.Teleport(pos); + + } + else + p.Teleport(Room.Random(ZoneType.LightContainment)); + } } - + /// + /// Changing the role of a player + /// + /// the player to change the role + /// the knob setting of knob private void ChangingRole(Player p, Scp914KnobSetting knob) { if (p.IsScp) @@ -51,7 +85,11 @@ private void ChangingRole(Player p, Scp914KnobSetting knob) HandleHumanChangingRole(p, knob); } } - + /// + /// Handle the change of role if the player is human + /// + /// the human player + /// the knob setting of 914 private void HandleHumanChangingRole(Player p, Scp914KnobSetting knob) { if (p.IsHuman) @@ -74,10 +112,15 @@ private void HandleHumanChangingRole(Player p, Scp914KnobSetting knob) } } + /// + /// Handle the change of role if the player is a scp + /// + /// the scp player (not a zombie) + /// the knob setting of 914 private void HandleScpChangingRole(Player p, Scp914KnobSetting knob) { - if (p.IsScp) + if (p.IsScp && p.Role.Type != RoleTypeId.Scp0492) { var invertRoleScp = roleScp.ToDictionary(k => k.Value, v => v.Key); if (UnityEngine.Random.value < .5f) diff --git a/KruacentE.Misc/AutoElevator.cs b/KruacentE.Misc/AutoElevator.cs index c392ae4e..194cd559 100644 --- a/KruacentE.Misc/AutoElevator.cs +++ b/KruacentE.Misc/AutoElevator.cs @@ -8,8 +8,14 @@ namespace KruacentExiled.KruacentE.Misc { + /// + /// The elevator will random activate in the round + /// internal class AutoElevator { + /// + /// Start the auto elevator loop + /// internal IEnumerator StartElevator() { while (!Round.IsEnded) diff --git a/KruacentE.Misc/ClassDDoor.cs b/KruacentE.Misc/ClassDDoor.cs index fd1b2185..a24a53b7 100644 --- a/KruacentE.Misc/ClassDDoor.cs +++ b/KruacentE.Misc/ClassDDoor.cs @@ -11,8 +11,14 @@ namespace KruacentExiled.KruacentE.Misc { + /// + /// Everything about classD door + /// internal class ClassDDoor { + /// + /// Class d door randomly explode at the start of the round + /// internal void ClassDDoorGoesBoom() { if (UnityEngine.Random.Range(0, 101) < MainPlugin.Instance.Config.ChanceClassDDoorGoesBoom) diff --git a/KruacentE.Misc/Config.cs b/KruacentE.Misc/Config.cs index fbc26af2..d133b746 100644 --- a/KruacentE.Misc/Config.cs +++ b/KruacentE.Misc/Config.cs @@ -10,11 +10,8 @@ public class Config : IConfig [Description("Chance that the friendly fire is enabled at the start of the round (set 0 to disable)")] public int ChanceFF { get; set; } = 50; [Description("Enable or disable the auto-nuke annoucement")] - public int ChanceClassDDoorGoesBoom { get; set; } = 2; [Description("Chance to d-boy doors goes boom")] - - public bool AutoNukeAnnoucement { get; set; } = true; [Description("Enable or disable the lockdown of SCP-173")] public bool PeanutLockDown { get; set; } = true; diff --git a/KruacentE.Misc/MainPlugin.cs b/KruacentE.Misc/MainPlugin.cs index 6a6f8901..c5ccf079 100644 --- a/KruacentE.Misc/MainPlugin.cs +++ b/KruacentE.Misc/MainPlugin.cs @@ -29,8 +29,8 @@ public override void OnEnabled() _914 = new _914(); AutoElevator = new AutoElevator(); ClassDDoor = new ClassDDoor(); - ServerHandler = new ServerHandler(); + ServerHandle.RoundStarted += ServerHandler.OnRoundStarted; Nine14Handle.UpgradingPlayer += _914.OnUpgradingPlayer; Exiled.Events.Handlers.Player.Dying += ScpNoeDeathMessage; @@ -43,7 +43,6 @@ public override void OnDisabled() Nine14Handle.UpgradingPlayer -= _914.OnUpgradingPlayer; Exiled.Events.Handlers.Player.Dying -= ScpNoeDeathMessage; - _914 = null; ClassDDoor = null; ServerHandler = null; @@ -52,13 +51,17 @@ public override void OnDisabled() } - + /// + /// Set the Friendly Fire to true or false at random + /// internal void RandomFF() { Server.FriendlyFire = UnityEngine.Random.Range(0, 101) < Instance.Config.ChanceFF; } - + /// + /// C.A.S.S.I.E. announce 5 min before the autonuke + /// internal IEnumerator NukeAnnouncement() { yield return Timing.WaitUntilTrue(() => 25 <= Round.ElapsedTime.TotalMinutes); @@ -66,7 +69,10 @@ internal IEnumerator NukeAnnouncement() "Warning automatic warhead will detonate in 5 minutes"); } - + /// + /// Lock SCP-173 in its cell for an amount of time determine by the number of player + /// Formula : timeLock = 135-nbPlayer*15 + /// internal IEnumerator PeanutLockdown() { Door peanutDoor = Door.List.ToList().Where(x => x.Type == DoorType.Scp173NewGate).ToList()[0]; @@ -77,11 +83,16 @@ internal IEnumerator PeanutLockdown() peanutDoor.Unlock(); } - - + /// + /// Special death message when Delecons dies as a SCP + /// + /// internal void ScpNoeDeathMessage(DyingEventArgs ev) { - if (!ev.Player.UserId.Equals("76561199066936074@steam")) + Player player = ev.Player; + if (!player.UserId.Equals("76561199066936074@steam")) + return; + if (!player.IsScp) return; Cassie.CustomScpTermination("69420", ev.DamageHandler); } diff --git a/KruacentE.Misc/ServerHandler.cs b/KruacentE.Misc/ServerHandler.cs index 06e1a621..a8d01142 100644 --- a/KruacentE.Misc/ServerHandler.cs +++ b/KruacentE.Misc/ServerHandler.cs @@ -3,6 +3,7 @@ using System.Linq; using System.Text; using System.Threading.Tasks; +using Exiled.API.Features; using MEC; namespace KE.Misc @@ -17,7 +18,7 @@ public void OnRoundStarted() MainPlugin.Instance.ClassDDoor.ClassDDoorGoesBoom(); if(MainPlugin.Instance.Config.AutoNukeAnnoucement) Timing.RunCoroutine(MainPlugin.Instance.NukeAnnouncement()); - if(MainPlugin.Instance.Config.PeanutLockDown) + if(MainPlugin.Instance.Config.PeanutLockDown && Player.List.Where(p => p.Role.Type == PlayerRoles.RoleTypeId.Scp173).Count() > 0) Timing.RunCoroutine(MainPlugin.Instance.PeanutLockdown()); if(MainPlugin.Instance.Config.AutoElevator) Timing.RunCoroutine(MainPlugin.Instance.AutoElevator.StartElevator()); From 30d1a6ae2c6a00afe83cbe6602e00a076bb2d1c7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9COmer?= <“27omerf@gmail.com”> Date: Sat, 14 Dec 2024 20:41:59 +0100 Subject: [PATCH 042/853] [FIXED] Impostor Global Event. --- .../GEFE.Examples/GE/Impostor.cs | 44 ++++++++++++++----- 1 file changed, 32 insertions(+), 12 deletions(-) diff --git a/KruacentE.GlobalEventFramework/GEFE.Examples/GE/Impostor.cs b/KruacentE.GlobalEventFramework/GEFE.Examples/GE/Impostor.cs index 6b688d18..c761cd91 100644 --- a/KruacentE.GlobalEventFramework/GEFE.Examples/GE/Impostor.cs +++ b/KruacentE.GlobalEventFramework/GEFE.Examples/GE/Impostor.cs @@ -27,26 +27,46 @@ public override IEnumerator Start() private void ChangingPlayer() { - List playerInServer = Player.List.ToList(); - playerInServer.ShuffleList(); + // Liste des joueurs vivants + List playerInServer = Player.List.Where(p => p.IsAlive).ToList(); - //Affichage des joueurs pour le debug - playerInServer.ForEach(x => Log.Debug("Joueur : " + x.Nickname)); + if (playerInServer.Count < 2) + { + Log.Warn("Pas assez de joueurs vivants pour effectuer un échange !"); + return; + } - foreach (Player player in playerInServer) + // Debug : afficher la liste initiale des joueurs avec leurs rôles + Log.Debug("===== Liste des joueurs avant permutation ====="); + foreach (var player in playerInServer) { - Player otherPlayer = playerInServer.RandomItem(); + Log.Debug($"{player.Nickname} ({player.Role})"); + } + // Mélanger la liste des joueurs + playerInServer.ShuffleList(); - Log.Debug("Joueur Target : " + otherPlayer.Nickname); - Log.Debug("Role du Target : " + otherPlayer.Role); + // Copier les données actuelles des joueurs + var originalNicknames = playerInServer.Select(p => p.Nickname).ToList(); + var originalRoles = playerInServer.Select(p => p.Role).ToList(); - player.ChangeAppearance(otherPlayer.Role); - player.DisplayNickname = otherPlayer.Nickname; + // Permutation circulaire des rôles et pseudonymes + for (int i = 0; i < playerInServer.Count; i++) + { + int nextIndex = (i + 1) % playerInServer.Count; + playerInServer[i].ChangeAppearance(originalRoles[nextIndex]); + playerInServer[i].DisplayNickname = originalNicknames[nextIndex]; + } - playerInServer.Remove(otherPlayer); + // Debug : afficher les correspondances après permutation + Log.Debug("===== Correspondances après permutation ====="); + for (int i = 0; i < playerInServer.Count; i++) + { + int nextIndex = (i + 1) % playerInServer.Count; + Log.Debug($"{originalNicknames[i]} ({originalRoles[i]}) -> {originalNicknames[nextIndex]} ({originalRoles[nextIndex]})"); } } + } -} +} \ No newline at end of file From fd6fd17d401c50f34334cd42098861a4c923b798 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9COmer?= <“27omerf@gmail.com”> Date: Sat, 14 Dec 2024 20:45:13 +0100 Subject: [PATCH 043/853] forgot to check if the player is an npc or not. --- KruacentE.GlobalEventFramework/GEFE.Examples/GE/Impostor.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/KruacentE.GlobalEventFramework/GEFE.Examples/GE/Impostor.cs b/KruacentE.GlobalEventFramework/GEFE.Examples/GE/Impostor.cs index c761cd91..8d6da7e9 100644 --- a/KruacentE.GlobalEventFramework/GEFE.Examples/GE/Impostor.cs +++ b/KruacentE.GlobalEventFramework/GEFE.Examples/GE/Impostor.cs @@ -28,7 +28,8 @@ public override IEnumerator Start() private void ChangingPlayer() { // Liste des joueurs vivants - List playerInServer = Player.List.Where(p => p.IsAlive).ToList(); + List serverPlayer = Player.List.Where(p => p.IsAlive).ToList(); + List playerInServer = serverPlayer.Where(p => !p.IsNPC).ToList(); if (playerInServer.Count < 2) { From 7f6c40ef1af01bb73f7d5822bc6bdd1f2829ec55 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Sun, 15 Dec 2024 14:09:28 +0100 Subject: [PATCH 044/853] simplified some playerInServer variable and a foreach --- .../GEFE.Examples/GE/Impostor.cs | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/KruacentE.GlobalEventFramework/GEFE.Examples/GE/Impostor.cs b/KruacentE.GlobalEventFramework/GEFE.Examples/GE/Impostor.cs index 8d6da7e9..0f417333 100644 --- a/KruacentE.GlobalEventFramework/GEFE.Examples/GE/Impostor.cs +++ b/KruacentE.GlobalEventFramework/GEFE.Examples/GE/Impostor.cs @@ -28,8 +28,7 @@ public override IEnumerator Start() private void ChangingPlayer() { // Liste des joueurs vivants - List serverPlayer = Player.List.Where(p => p.IsAlive).ToList(); - List playerInServer = serverPlayer.Where(p => !p.IsNPC).ToList(); + List playerInServer = Player.List.Where(p => !p.IsNPC && p.IsAlive).ToList(); if (playerInServer.Count < 2) { @@ -39,10 +38,8 @@ private void ChangingPlayer() // Debug : afficher la liste initiale des joueurs avec leurs rôles Log.Debug("===== Liste des joueurs avant permutation ====="); - foreach (var player in playerInServer) - { - Log.Debug($"{player.Nickname} ({player.Role})"); - } + + playerInServer.ForEach(p => Log.Debug($"{p.Nickname} ({p.Role})")); // Mélanger la liste des joueurs playerInServer.ShuffleList(); From 70a822887a9cbe3a145c9709575656a3d0bd0993 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Sun, 15 Dec 2024 14:42:28 +0100 Subject: [PATCH 045/853] Removed the KillCoroutine because it stops the round from ending --- KruacentE.GlobalEventFramework/GEFE/Handlers/ServerHandler.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/KruacentE.GlobalEventFramework/GEFE/Handlers/ServerHandler.cs b/KruacentE.GlobalEventFramework/GEFE/Handlers/ServerHandler.cs index 54acab95..44df35c0 100644 --- a/KruacentE.GlobalEventFramework/GEFE/Handlers/ServerHandler.cs +++ b/KruacentE.GlobalEventFramework/GEFE/Handlers/ServerHandler.cs @@ -34,13 +34,13 @@ public void OnEndingRound(RoundEndedEventArgs _) { Log.Debug("ending round"); _activeGE.ForEach(e => e.UnsubscribeEvent()); - Timing.KillCoroutines(); + //Timing.KillCoroutines(); } public void OnRestartingRound() { Log.Debug("restarting"); _activeGE.ForEach(e => e.UnsubscribeEvent()); - Timing.KillCoroutines(); + //Timing.KillCoroutines(); } } From 9d321d043f2882c971586296fdff417dd2cee085 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Sun, 15 Dec 2024 16:46:56 +0100 Subject: [PATCH 046/853] Fixed the Scp change role logic --- KruacentE.Misc/914.cs | 53 +++++++++++++++++++++++++++++-------------- 1 file changed, 36 insertions(+), 17 deletions(-) diff --git a/KruacentE.Misc/914.cs b/KruacentE.Misc/914.cs index e99b8e39..29e3cba1 100644 --- a/KruacentE.Misc/914.cs +++ b/KruacentE.Misc/914.cs @@ -10,6 +10,7 @@ using Exiled.API.Features; using Exiled.API.Extensions; using UnityEngine; +using YamlDotNet.Core.Tokens; namespace KruacentExiled.KruacentE.Misc { @@ -25,13 +26,14 @@ internal class _914 { -2, RoleTypeId.Scp939 }, { -3, RoleTypeId.Scp096 }, - { 1, RoleTypeId.Scp106 }, + { 3, RoleTypeId.Scp106 }, { 2, RoleTypeId.Scp173 }, - { 3, RoleTypeId.Scp3114}, + { 1, RoleTypeId.Scp3114}, }; internal void OnUpgradingPlayer(UpgradingPlayerEventArgs ev) { + Log.Debug("upgrading player"); Teleport(ev.Player, ev.KnobSetting); ChangingRole(ev.Player, ev.KnobSetting); @@ -40,7 +42,7 @@ internal void OnUpgradingPlayer(UpgradingPlayerEventArgs ev) /// /// Teleport the player in a random place specified by the knob - /// Coarse -> 1/4 chance to tp in Lcz -> 1/5 switch place with the scp + /// Coarse -> 1/4 chance to tp in Lcz -> 1/10 switch place with the scp /// Fine -> 1/100 chance to tp in Entrance or Hcz /// /// the player being teleported @@ -57,7 +59,7 @@ private void Teleport(Player p, Scp914KnobSetting knob) if (knob == Scp914KnobSetting.Coarse && UnityEngine.Random.value < .25f) { - if (UnityEngine.Random.value < .10f) + if (UnityEngine.Random.value < .10f && Player.List.Any(player => player.IsScp)) { Player playerScp = Player.List.ToList().Where(pl => pl.IsScp).GetRandomValue(); var pos = p.Position; @@ -97,11 +99,11 @@ private void HandleHumanChangingRole(Player p, Scp914KnobSetting knob) switch (p.Role.Type) { case RoleTypeId.Scientist: - if (UnityEngine.Random.value < .5f) + if (UnityEngine.Random.value < .5f && knob == Scp914KnobSetting.OneToOne) p.Role.Set(RoleTypeId.ClassD); break; case RoleTypeId.ClassD: - if (UnityEngine.Random.value < .5f) + if (UnityEngine.Random.value < .5f && knob == Scp914KnobSetting.OneToOne) p.Role.Set(RoleTypeId.Scientist); break; case RoleTypeId.FacilityGuard: @@ -128,36 +130,53 @@ private void HandleScpChangingRole(Player p, Scp914KnobSetting knob) // get the id of the scp if (invertRoleScp.TryGetValue(p.Role.Type, out int key)) { - RoleTypeId newRole; switch (knob) { //going up in the graph case Scp914KnobSetting.Rough: - if (roleScp.TryGetValue(key - 1, out newRole)) - { - p.Role.Set(newRole); - } + TrySetRole(p, key - 1); break; //going horizontaly in the graph case Scp914KnobSetting.OneToOne: - if (roleScp.TryGetValue(key * (-1), out newRole)) + switch (Math.Abs(key)) { - p.Role.Set(newRole); + case 3: + TrySetRole(p,key/(-3)); + break; + case 2: + TrySetRole(p,key* (-1)); + break; + case 1: + TrySetRole(p, key * (-3)); + break; + } + break; //going down in the graph case Scp914KnobSetting.VeryFine: - if (roleScp.TryGetValue(key + 1, out newRole)) - { - p.Role.Set(newRole); - } + TrySetRole(p, key + 1); break; } } } + else + { + Log.Debug("no luck"); + } } } + + + private void TrySetRole(Player p ,int key) + { + RoleTypeId newRole; + if (roleScp.TryGetValue(key, out newRole)) + { + p.Role.Set(newRole); + } + } } } From 0c1b50d6518d543cb2365efd61339141c41ee113 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Sun, 15 Dec 2024 16:47:08 +0100 Subject: [PATCH 047/853] changed the class d door debug log --- KruacentE.Misc/ClassDDoor.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/KruacentE.Misc/ClassDDoor.cs b/KruacentE.Misc/ClassDDoor.cs index a24a53b7..4c88085c 100644 --- a/KruacentE.Misc/ClassDDoor.cs +++ b/KruacentE.Misc/ClassDDoor.cs @@ -23,6 +23,7 @@ internal void ClassDDoorGoesBoom() { if (UnityEngine.Random.Range(0, 101) < MainPlugin.Instance.Config.ChanceClassDDoorGoesBoom) { + Log.Debug("ClassD's door exploded"); foreach (Door door in Door.List) { if (door.Type == DoorType.PrisonDoor) @@ -30,7 +31,7 @@ internal void ClassDDoorGoesBoom() if (door is IDamageableDoor dBoyDoor && !dBoyDoor.IsDestroyed) { dBoyDoor.Break(); - Log.Debug("ClassD's door exploded"); + } } } From 3223f3f53d7984781f32f49f1bbdac65cc263580 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Sun, 15 Dec 2024 16:47:49 +0100 Subject: [PATCH 048/853] added debug log --- KruacentE.Misc/AutoElevator.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/KruacentE.Misc/AutoElevator.cs b/KruacentE.Misc/AutoElevator.cs index 194cd559..a43c9e1c 100644 --- a/KruacentE.Misc/AutoElevator.cs +++ b/KruacentE.Misc/AutoElevator.cs @@ -18,6 +18,7 @@ internal class AutoElevator /// internal IEnumerator StartElevator() { + Log.Debug("elevator"); while (!Round.IsEnded) { foreach (Lift l in Lift.List) @@ -29,6 +30,7 @@ internal IEnumerator StartElevator() } private void SendElevator(Lift e) { + Log.Debug($"{e.Name}"); e.TryStart(0, true); } } From 42b924a151385263295a902e37897420ecc81bec Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Sun, 15 Dec 2024 16:48:23 +0100 Subject: [PATCH 049/853] added more log debug --- KruacentE.Misc/MainPlugin.cs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/KruacentE.Misc/MainPlugin.cs b/KruacentE.Misc/MainPlugin.cs index c5ccf079..4f8f5ccb 100644 --- a/KruacentE.Misc/MainPlugin.cs +++ b/KruacentE.Misc/MainPlugin.cs @@ -57,6 +57,7 @@ public override void OnDisabled() internal void RandomFF() { Server.FriendlyFire = UnityEngine.Random.Range(0, 101) < Instance.Config.ChanceFF; + Log.Info($"Friendly Fire : {Server.FriendlyFire}"); } /// @@ -64,6 +65,7 @@ internal void RandomFF() /// internal IEnumerator NukeAnnouncement() { + Log.Debug("autonuke announcement : on"); yield return Timing.WaitUntilTrue(() => 25 <= Round.ElapsedTime.TotalMinutes); Cassie.MessageTranslated("Warning automatic warhead will detonate in 5 minutes", "Warning automatic warhead will detonate in 5 minutes"); @@ -75,12 +77,18 @@ internal IEnumerator NukeAnnouncement() /// internal IEnumerator PeanutLockdown() { + if(!Player.List.Any(p => p.Role.Type == RoleTypeId.Scp173)) + { + yield return 0; + } + Log.Debug("peanut lockdown"); Door peanutDoor = Door.List.ToList().Where(x => x.Type == DoorType.Scp173NewGate).ToList()[0]; peanutDoor.IsOpen = false; peanutDoor.ChangeLock(DoorLockType.Lockdown2176); yield return Timing.WaitForSeconds(135-Player.List.Count*15); peanutDoor.IsOpen = true; peanutDoor.Unlock(); + Log.Debug("peanut free"); } /// @@ -89,6 +97,7 @@ internal IEnumerator PeanutLockdown() /// internal void ScpNoeDeathMessage(DyingEventArgs ev) { + Log.Debug("someone died"); Player player = ev.Player; if (!player.UserId.Equals("76561199066936074@steam")) return; From 5df89cfcc490019cc1e47eb91bab479f7a7c9c46 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Sun, 15 Dec 2024 17:01:51 +0100 Subject: [PATCH 050/853] added a constraint for scpnoe and changed the death message --- KruacentE.Misc/MainPlugin.cs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/KruacentE.Misc/MainPlugin.cs b/KruacentE.Misc/MainPlugin.cs index 4f8f5ccb..7df67b5e 100644 --- a/KruacentE.Misc/MainPlugin.cs +++ b/KruacentE.Misc/MainPlugin.cs @@ -97,13 +97,17 @@ internal IEnumerator PeanutLockdown() /// internal void ScpNoeDeathMessage(DyingEventArgs ev) { - Log.Debug("someone died"); + Player player = ev.Player; + Log.Debug($"someone died = {player.UserId}"); + if (!player.UserId.Equals("76561199066936074@steam")) return; if (!player.IsScp) return; - Cassie.CustomScpTermination("69420", ev.DamageHandler); + if (player.Role.Type == RoleTypeId.Scp0492) + return; + Cassie.MessageTranslated("SCP 69 420 has been contained successfully", "SCP-69420-NOE has been contained successfully"); } From 36cf39434a2f1641ce936d1da383ccd38f5650c2 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Sun, 15 Dec 2024 17:24:42 +0100 Subject: [PATCH 051/853] Created new GE OpenBar --- .../GEFE.Examples/GE/OpenBar.cs | 56 +++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 KruacentE.GlobalEventFramework/GEFE.Examples/GE/OpenBar.cs diff --git a/KruacentE.GlobalEventFramework/GEFE.Examples/GE/OpenBar.cs b/KruacentE.GlobalEventFramework/GEFE.Examples/GE/OpenBar.cs new file mode 100644 index 00000000..ac17117c --- /dev/null +++ b/KruacentE.GlobalEventFramework/GEFE.Examples/GE/OpenBar.cs @@ -0,0 +1,56 @@ +using Exiled.API.Features.Doors; +using GEFExiled.GEFE.API.Features; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Exiled.API.Enums; +using Exiled.API.Features; +using Exiled.Events.EventArgs.Map; + +namespace GEFExiled.GEFE.Examples.GE +{ + public class OpenBar : GlobalEvent + { + public override int Id { get; set; } = 38; + public override string Name { get; set; } = "OpenBar"; + public override string Description { get; set; } = "j'espère que vous avez pas prévu de kampé"; + public override double Weight { get; set; } = 1; + public override IEnumerator Start() + { + var doors = Door.List.Where(d => new[] { DoorType.GateA, DoorType.GateB, DoorType.HczArmory, DoorType.HID,DoorType.Intercom,DoorType.Scp049Armory,DoorType.Scp096,DoorType.Scp106Primary,DoorType.Scp106Secondary,DoorType.Scp330,DoorType.Scp330Chamber,DoorType.Scp914Gate }.Contains(d.Type)).ToList(); + UnlockAndOpen(doors); + + yield return 0; + } + + private void UnlockAndOpen(List doors) + { + doors.ForEach(d => + { + d.IsOpen = true; + d.ChangeLock(DoorLockType.Isolation); + }); + } + + public override void SubscribeEvent() + { + Exiled.Events.Handlers.Map.GeneratorActivating += GenActivate; + } + + public override void UnsubscribeEvent() + { + Exiled.Events.Handlers.Map.GeneratorActivating -= GenActivate; + } + + public void GenActivate(GeneratorActivatingEventArgs ev) + { + if (Generator.List.Where(g => g.IsEngaged).Count() == 3) + { + UnlockAndOpen(Door.List.Where(d => new[] { DoorType.Scp079First, DoorType.Scp079Second }.Contains(d.Type)).ToList()); + } + } + + } +} From 1654365f720818765595e6f7e6fdb23b80795605 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Sun, 15 Dec 2024 19:32:20 +0100 Subject: [PATCH 052/853] added ge in the list --- KruacentE.GlobalEventFramework/MainPlugin.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/KruacentE.GlobalEventFramework/MainPlugin.cs b/KruacentE.GlobalEventFramework/MainPlugin.cs index 2d3354da..7f9cd528 100644 --- a/KruacentE.GlobalEventFramework/MainPlugin.cs +++ b/KruacentE.GlobalEventFramework/MainPlugin.cs @@ -24,7 +24,7 @@ public override void OnEnabled() { _instance = this; - List globalEvents = new List(){ new Shuffle(), new Speed(), new SystemMalfunction(), new RandomSpawn(), new R(), new Blitz() }; + List globalEvents = new List() { new Shuffle(), new Speed(), new SystemMalfunction(), new RandomSpawn(), new R(), new Blitz(), new KIWIS(), new Impostor() }; GlobalEvent.Register(globalEvents); RegisterEvents(); From d06bc25f4a42b713f6cd21f6e0c6c37e7f1db88c Mon Sep 17 00:00:00 2001 From: Rayanne Date: Thu, 19 Dec 2024 10:00:40 +0100 Subject: [PATCH 053/853] added lib in gitignore --- .gitignore | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 344f050a..ec239c70 100644 --- a/.gitignore +++ b/.gitignore @@ -32,7 +32,7 @@ bld/ [Oo]ut/ [Ll]og/ [Ll]ogs/ - +lib # Visual Studio 2015/2017 cache/options directory From 18e469de9f27e33d8463a016d664dcc2db1386b0 Mon Sep 17 00:00:00 2001 From: Rayanne Date: Thu, 19 Dec 2024 10:43:28 +0100 Subject: [PATCH 054/853] added new event to systemMalfunction --- .../GEFE.Examples/GE/SystemMalfunction.cs | 38 ++++++++++++++++++- .../GEFExiled.csproj | 8 ++-- 2 files changed, 41 insertions(+), 5 deletions(-) diff --git a/KruacentE.GlobalEventFramework/GEFE.Examples/GE/SystemMalfunction.cs b/KruacentE.GlobalEventFramework/GEFE.Examples/GE/SystemMalfunction.cs index 7bdb385e..faba5519 100644 --- a/KruacentE.GlobalEventFramework/GEFE.Examples/GE/SystemMalfunction.cs +++ b/KruacentE.GlobalEventFramework/GEFE.Examples/GE/SystemMalfunction.cs @@ -1,5 +1,6 @@ using BlackoutKruacent; using Exiled.API.Features; +using Exiled.API.Features.Doors; using Exiled.Events.Commands.Reload; using Exiled.Loader; using GEFExiled.GEFE.API.Features; @@ -10,6 +11,9 @@ using System.Linq; using System.Text; using System.Threading.Tasks; +using Interactables.Interobjects.DoorUtils; +using Exiled.API.Enums; +using Exiled.API.Extensions; namespace GEFExiled.GEFE.Examples.GE { @@ -26,7 +30,17 @@ public override IEnumerator Start() { MoreBlackOutNDoors(); Coroutine.LaunchCoroutine(EarlyNuke()); - yield return 0; + + CoroutineHandle handle; + while(Round.InProgress){ + //todo change so it happen more frequently + Timing.WaitForSeconds((float)Round.ElapsedTime.TotalSeconds); + List> l = new []{CheckpointMalfunction(),GateLockdown(),ElevatorLockdown()}.ToList(); + handle = Coroutine.LaunchCoroutine(l[UnityEngine.Random.Range(0,3)]); + yield return Timing.WaitUntilDone(handle); + + } + } private IEnumerator EarlyNuke() @@ -51,6 +65,28 @@ private void MoreBlackOutNDoors() } } + + private IEnumerator CheckpointMalfunction(){ + yield return Timing.WaitForSeconds(UnityEngine.Random.Range(20,60)); + var checkpoints = Door.List.Where(d => d.IsCheckpoint).ToList().RandomItem().IsOpen =true; + + } + + private IEnumerator GateLockdown(){ + var gates = Door.List.Where(d => d.Type == DoorType.GateA ||d.Type == DoorType.GateB); + var gate = gates.GetRandomValue(); + gate.IsOpen = false; + var timelock = UnityEngine.Random.Range(10,30); + gate.Lock(timelock,DoorLockType.Isolation); + yield return Timing.WaitForSeconds(timelock); + } + + private IEnumerator ElevatorLockdown(){ + var lift = Lift.Random; + lift.ChangeLock(DoorLockReason.Isolation); + yield return Timing.WaitForSeconds(UnityEngine.Random.Range(10,20)); + lift.ChangeLock(DoorLockReason.None); + } } } \ No newline at end of file diff --git a/KruacentE.GlobalEventFramework/GEFExiled.csproj b/KruacentE.GlobalEventFramework/GEFExiled.csproj index 97685638..0bbf5821 100644 --- a/KruacentE.GlobalEventFramework/GEFExiled.csproj +++ b/KruacentE.GlobalEventFramework/GEFExiled.csproj @@ -10,19 +10,19 @@ - C:\Program Files (x86)\Steam\steamapps\common\SCP Secret Laboratory Dedicated Server\SCPSL_Data\Managed\Assembly-CSharp-firstpass.dll + ../lib/Assembly-CSharp-firstpass.dll ..\KruacentE.BlackoutNDoor\bin\Debug\net48\BlackoutKruacent.dll - C:\Program Files (x86)\Steam\steamapps\common\SCP Secret Laboratory Dedicated Server\SCPSL_Data\Managed\Mirror.dll + ../lib/Mirror.dll - C:\Program Files (x86)\Steam\steamapps\common\SCP Secret Laboratory Dedicated Server\SCPSL_Data\Managed\UnityEngine.dll + ../lib/UnityEngine.dll - C:\Program Files (x86)\Steam\steamapps\common\SCP Secret Laboratory Dedicated Server\SCPSL_Data\Managed\UnityEngine.CoreModule.dll + ../lib/UnityEngine.CoreModule.dll From e9eaccddee215e6e2c0413ec66dcb5489d53985e Mon Sep 17 00:00:00 2001 From: Rayanne Date: Thu, 19 Dec 2024 10:43:47 +0100 Subject: [PATCH 055/853] increased the cooldown between 2 Shuffle --- KruacentE.GlobalEventFramework/GEFE.Examples/GE/Shuffle.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/KruacentE.GlobalEventFramework/GEFE.Examples/GE/Shuffle.cs b/KruacentE.GlobalEventFramework/GEFE.Examples/GE/Shuffle.cs index ac1799e3..e0103be7 100644 --- a/KruacentE.GlobalEventFramework/GEFE.Examples/GE/Shuffle.cs +++ b/KruacentE.GlobalEventFramework/GEFE.Examples/GE/Shuffle.cs @@ -37,7 +37,7 @@ public override IEnumerator Start() { Log.Debug($"waiting for {GetType().Name}"); - yield return Timing.WaitForSeconds(UnityEngine.Random.Range(120, 240)); //120 240 + yield return Timing.WaitForSeconds(UnityEngine.Random.Range(300, 900)); for (int i = 0; i < this.players.Count; i++) { Log.Debug($"old position of player {this.players[i]} : {this.players[i].Position}"); From e90cfa68310df6f115e8fcb38f9da5822344dcbd Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Mon, 23 Dec 2024 03:38:16 +0100 Subject: [PATCH 056/853] Changed the weight from double to int Corrected the ChooseGE (can have multiple now) Corrected the KIWIS : the scp now have reduced health at the start --- KruacentE.GlobalEventFramework/GEFE.Examples/GE/Blitz.cs | 2 +- .../GEFE.Examples/GE/Impostor.cs | 2 +- KruacentE.GlobalEventFramework/GEFE.Examples/GE/KIWIS.cs | 8 +++++++- .../GEFE.Examples/GE/OpenBar.cs | 2 +- KruacentE.GlobalEventFramework/GEFE.Examples/GE/R.cs | 2 +- .../GEFE.Examples/GE/RandomSpawn.cs | 2 +- .../GEFE.Examples/GE/Shuffle.cs | 2 +- KruacentE.GlobalEventFramework/GEFE.Examples/GE/Speed.cs | 2 +- .../GEFE.Examples/GE/SystemMalfunction.cs | 2 +- .../GEFE/API/Features/GlobalEvent.cs | 2 +- .../GEFE/API/Interfaces/IGlobalEvent.cs | 2 +- 11 files changed, 17 insertions(+), 11 deletions(-) diff --git a/KruacentE.GlobalEventFramework/GEFE.Examples/GE/Blitz.cs b/KruacentE.GlobalEventFramework/GEFE.Examples/GE/Blitz.cs index 09cc77dc..d9408d79 100644 --- a/KruacentE.GlobalEventFramework/GEFE.Examples/GE/Blitz.cs +++ b/KruacentE.GlobalEventFramework/GEFE.Examples/GE/Blitz.cs @@ -16,7 +16,7 @@ public class Blitz : GlobalEvent public override int Id { get; set; } = 1; public override string Name { get; set; } = "Blitz"; public override string Description { get; set; } = "éteignez les lumières la luftwaffe arrive"; - public override double Weight { get; set; } = 1; + public override int Weight { get; set; } = 1; public int Cooldown { get; set; } = 120; public int NbGrenadeSpawned { get; set; } = 5; public override IEnumerator Start() diff --git a/KruacentE.GlobalEventFramework/GEFE.Examples/GE/Impostor.cs b/KruacentE.GlobalEventFramework/GEFE.Examples/GE/Impostor.cs index 0f417333..7baf7d88 100644 --- a/KruacentE.GlobalEventFramework/GEFE.Examples/GE/Impostor.cs +++ b/KruacentE.GlobalEventFramework/GEFE.Examples/GE/Impostor.cs @@ -13,7 +13,7 @@ public class Impostor : GlobalEvent public override int Id { get; set; } = 30; public override string Name { get; set; } = "Impostor"; public override string Description { get; set; } = "Ne vous fiez pas aux apparences !"; - public override double Weight { get; set; } = 1; + public override int Weight { get; set; } = 1; public override IEnumerator Start() { diff --git a/KruacentE.GlobalEventFramework/GEFE.Examples/GE/KIWIS.cs b/KruacentE.GlobalEventFramework/GEFE.Examples/GE/KIWIS.cs index e2218b7e..c44d301d 100644 --- a/KruacentE.GlobalEventFramework/GEFE.Examples/GE/KIWIS.cs +++ b/KruacentE.GlobalEventFramework/GEFE.Examples/GE/KIWIS.cs @@ -14,11 +14,17 @@ public class KIWIS : GlobalEvent public override int Id { get; set; } = 32; public override string Name { get; set; } = "KIWIS"; public override string Description { get; set; } = "Kill It While It's Small"; - public override double Weight { get; set; } = 1; + public override int Weight { get; set; } = 1; public override IEnumerator Start() { var listScp = Player.List.ToList().Where(p => p.IsScp && p.Role.Type != RoleTypeId.Scp0492).ToList().ToDictionary(p => p, p => p.MaxHealth/3); + listScp.ForEach(k => + { + k.Key.MaxHealth = k.Value * 2; + k.Key.Health = k.Key.MaxHealth; + }); + yield return Timing.WaitUntilTrue(() => Round.ElapsedTime.TotalMinutes >= 15); listScp.ForEach(k => { k.Key.MaxHealth += k.Value; diff --git a/KruacentE.GlobalEventFramework/GEFE.Examples/GE/OpenBar.cs b/KruacentE.GlobalEventFramework/GEFE.Examples/GE/OpenBar.cs index ac17117c..6e66b20f 100644 --- a/KruacentE.GlobalEventFramework/GEFE.Examples/GE/OpenBar.cs +++ b/KruacentE.GlobalEventFramework/GEFE.Examples/GE/OpenBar.cs @@ -16,7 +16,7 @@ public class OpenBar : GlobalEvent public override int Id { get; set; } = 38; public override string Name { get; set; } = "OpenBar"; public override string Description { get; set; } = "j'espère que vous avez pas prévu de kampé"; - public override double Weight { get; set; } = 1; + public override int Weight { get; set; } = 1; public override IEnumerator Start() { var doors = Door.List.Where(d => new[] { DoorType.GateA, DoorType.GateB, DoorType.HczArmory, DoorType.HID,DoorType.Intercom,DoorType.Scp049Armory,DoorType.Scp096,DoorType.Scp106Primary,DoorType.Scp106Secondary,DoorType.Scp330,DoorType.Scp330Chamber,DoorType.Scp914Gate }.Contains(d.Type)).ToList(); diff --git a/KruacentE.GlobalEventFramework/GEFE.Examples/GE/R.cs b/KruacentE.GlobalEventFramework/GEFE.Examples/GE/R.cs index f22ebee8..4cd23389 100644 --- a/KruacentE.GlobalEventFramework/GEFE.Examples/GE/R.cs +++ b/KruacentE.GlobalEventFramework/GEFE.Examples/GE/R.cs @@ -14,7 +14,7 @@ public class R : GlobalEvent public override int Id { get; set; } = 32; public override string Name { get; set; } = "nothing"; public override string Description { get; set; } = "y'a r"; - public override double Weight { get; set; } = 1; + public override int Weight { get; set; } = 1; public override IEnumerator Start() { yield return 0; diff --git a/KruacentE.GlobalEventFramework/GEFE.Examples/GE/RandomSpawn.cs b/KruacentE.GlobalEventFramework/GEFE.Examples/GE/RandomSpawn.cs index 36c645f8..f5518695 100644 --- a/KruacentE.GlobalEventFramework/GEFE.Examples/GE/RandomSpawn.cs +++ b/KruacentE.GlobalEventFramework/GEFE.Examples/GE/RandomSpawn.cs @@ -14,7 +14,7 @@ public class RandomSpawn : GlobalEvent public override int Id { get; set; } = 32; public override string Name { get; set; } = "RandomSpawn"; public override string Description { get; set; } = "Les spawns sont random"; - public override double Weight { get; set; } = 1; + public override int Weight { get; set; } = 1; public override IEnumerator Start() { Room room = Room.Random(); diff --git a/KruacentE.GlobalEventFramework/GEFE.Examples/GE/Shuffle.cs b/KruacentE.GlobalEventFramework/GEFE.Examples/GE/Shuffle.cs index ac1799e3..b0af63be 100644 --- a/KruacentE.GlobalEventFramework/GEFE.Examples/GE/Shuffle.cs +++ b/KruacentE.GlobalEventFramework/GEFE.Examples/GE/Shuffle.cs @@ -19,7 +19,7 @@ public class Shuffle : GlobalEvent /// public override string Description { get; set; } = "et ça fait roomba café dans le scp"; /// - public override double Weight { get; set; } = 0; + public override int Weight { get; set; } = 0; private List players; private List pos; /// diff --git a/KruacentE.GlobalEventFramework/GEFE.Examples/GE/Speed.cs b/KruacentE.GlobalEventFramework/GEFE.Examples/GE/Speed.cs index ad89020e..bb32aaa2 100644 --- a/KruacentE.GlobalEventFramework/GEFE.Examples/GE/Speed.cs +++ b/KruacentE.GlobalEventFramework/GEFE.Examples/GE/Speed.cs @@ -19,7 +19,7 @@ public class Speed : GlobalEvent public override int Id { get; set; } = 30; public override string Name { get; set; } = "Speed"; public override string Description { get; set; } = "Gas! gas! gas!"; - public override double Weight { get; set; } = 1; + public override int Weight { get; set; } = 1; [Description("the movement speed that will be added to the player")] public byte MovementBoost { get; set; } = 100; diff --git a/KruacentE.GlobalEventFramework/GEFE.Examples/GE/SystemMalfunction.cs b/KruacentE.GlobalEventFramework/GEFE.Examples/GE/SystemMalfunction.cs index 7bdb385e..176a5003 100644 --- a/KruacentE.GlobalEventFramework/GEFE.Examples/GE/SystemMalfunction.cs +++ b/KruacentE.GlobalEventFramework/GEFE.Examples/GE/SystemMalfunction.cs @@ -19,7 +19,7 @@ public class SystemMalfunction : GlobalEvent public override int Id { get; set; } = 1; public override string Name { get; set; } = "System Malfunction"; public override string Description { get; set; } = "On dirait que les systèmes informatiques sont défaillants"; - public override double Weight { get; set; } = 1; + public override int Weight { get; set; } = 1; public int NewCooldown { get; set; } = 180; public override IEnumerator Start() diff --git a/KruacentE.GlobalEventFramework/GEFE/API/Features/GlobalEvent.cs b/KruacentE.GlobalEventFramework/GEFE/API/Features/GlobalEvent.cs index b250abfc..d1c61613 100644 --- a/KruacentE.GlobalEventFramework/GEFE/API/Features/GlobalEvent.cs +++ b/KruacentE.GlobalEventFramework/GEFE/API/Features/GlobalEvent.cs @@ -30,7 +30,7 @@ public class GlobalEvent : IGlobalEvent public virtual int Id { get; set; } = -1; public virtual string Name { get; set; } = "GE NOT SET"; public virtual string Description { get; set; } = "DESC NOT SET"; - public virtual double Weight { get; set; } = 1; + public virtual int Weight { get; set; } = 1; public static void Register(IGlobalEvent globalEvent) { diff --git a/KruacentE.GlobalEventFramework/GEFE/API/Interfaces/IGlobalEvent.cs b/KruacentE.GlobalEventFramework/GEFE/API/Interfaces/IGlobalEvent.cs index 11c0a535..f280ce2c 100644 --- a/KruacentE.GlobalEventFramework/GEFE/API/Interfaces/IGlobalEvent.cs +++ b/KruacentE.GlobalEventFramework/GEFE/API/Interfaces/IGlobalEvent.cs @@ -26,7 +26,7 @@ public interface IGlobalEvent /// /// The chance this GE will be choosed at the start of a round /// - double Weight { get; set; } + int Weight { get; set; } /// /// Is launched at the start of a round From ed7016e367fe5466cd3f32ede911446af181ab49 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Mon, 23 Dec 2024 04:08:31 +0100 Subject: [PATCH 057/853] implemented the multiple GE increased the chance of having no nothing --- .../GEFE.Examples/GE/R.cs | 2 +- .../GEFE/Handlers/ServerHandler.cs | 17 +++-- KruacentE.GlobalEventFramework/MainPlugin.cs | 67 +++++++++---------- 3 files changed, 41 insertions(+), 45 deletions(-) diff --git a/KruacentE.GlobalEventFramework/GEFE.Examples/GE/R.cs b/KruacentE.GlobalEventFramework/GEFE.Examples/GE/R.cs index 4cd23389..328bd917 100644 --- a/KruacentE.GlobalEventFramework/GEFE.Examples/GE/R.cs +++ b/KruacentE.GlobalEventFramework/GEFE.Examples/GE/R.cs @@ -14,7 +14,7 @@ public class R : GlobalEvent public override int Id { get; set; } = 32; public override string Name { get; set; } = "nothing"; public override string Description { get; set; } = "y'a r"; - public override int Weight { get; set; } = 1; + public override int Weight { get; set; } = 3; public override IEnumerator Start() { yield return 0; diff --git a/KruacentE.GlobalEventFramework/GEFE/Handlers/ServerHandler.cs b/KruacentE.GlobalEventFramework/GEFE/Handlers/ServerHandler.cs index 44df35c0..fe8f92b4 100644 --- a/KruacentE.GlobalEventFramework/GEFE/Handlers/ServerHandler.cs +++ b/KruacentE.GlobalEventFramework/GEFE/Handlers/ServerHandler.cs @@ -1,13 +1,8 @@ using Exiled.API.Features; using Exiled.Events.EventArgs.Server; -using System; using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using MEC; using GEFExiled.GEFE.API.Interfaces; -using Exiled.Events.Commands.PluginManager; + namespace GEFExiled.Handlers { @@ -22,7 +17,8 @@ public ServerHandler(MainPlugin mainPlugin) public void OnRoundStarted() { Log.Debug("starting round"); - _activeGE = _plugin.ChooseGE(); + + _activeGE = _plugin.ChooseGE(UnityEngine.Random.value < .1f ? 2 : 1); Log.Debug("sub event"); _activeGE.ForEach(e => e.SubscribeEvent()); Log.Debug("show to player"); @@ -30,17 +26,20 @@ public void OnRoundStarted() Log.Debug("end starting round"); } + public void OnWaitingForPlayers() + { + MainPlugin.Instance.StopCoroutines(); + } + public void OnEndingRound(RoundEndedEventArgs _) { Log.Debug("ending round"); _activeGE.ForEach(e => e.UnsubscribeEvent()); - //Timing.KillCoroutines(); } public void OnRestartingRound() { Log.Debug("restarting"); _activeGE.ForEach(e => e.UnsubscribeEvent()); - //Timing.KillCoroutines(); } } diff --git a/KruacentE.GlobalEventFramework/MainPlugin.cs b/KruacentE.GlobalEventFramework/MainPlugin.cs index 7f9cd528..ce6927bd 100644 --- a/KruacentE.GlobalEventFramework/MainPlugin.cs +++ b/KruacentE.GlobalEventFramework/MainPlugin.cs @@ -17,13 +17,13 @@ internal class MainPlugin : Plugin internal Handlers.ServerHandler _server; - internal static MainPlugin _instance; + internal static MainPlugin Instance {get;private set;} public static List coroutineHandles = new List(); public override void OnEnabled() { - _instance = this; + Instance = this; List globalEvents = new List() { new Shuffle(), new Speed(), new SystemMalfunction(), new RandomSpawn(), new R(), new Blitz(), new KIWIS(), new Impostor() }; GlobalEvent.Register(globalEvents); @@ -37,13 +37,14 @@ public override void OnDisabled() UnregisterEvents(); Timing.KillCoroutines(); base.OnDisabled(); - _instance = null; + Instance = null; } private void RegisterEvents() { _server = new Handlers.ServerHandler(this); + ServerHandler.WaitingForPlayers += _server.OnWaitingForPlayers; ServerHandler.RoundStarted += _server.OnRoundStarted; ServerHandler.RoundEnded += _server.OnEndingRound; ServerHandler.RestartingRound += _server.OnRestartingRound; @@ -100,11 +101,11 @@ private String ShowText(bool redacted = false) return result; } - public List ChooseGE() + public List ChooseGE(int numberOfGlobalEvent = 1) { - List activeGE = ChooseRandomGE(); + List activeGE = ChooseRandomGE(numberOfGlobalEvent); Log.Debug($"activeGE size : {activeGE.Count}"); - Log.Info($"Global Event(s) : "); + Log.Info($"Global Event(s) ({numberOfGlobalEvent}): "); foreach (IGlobalEvent ge in activeGE) { @@ -115,49 +116,45 @@ public List ChooseGE() return activeGE; } - private List ChooseRandomGE(int nbGE = 1) { List result = new List(); - List gelist = GlobalEvent.GlobalEventsList.ToList(); - - double totalWeight = GlobalEvent.GlobalEventsList.Sum(x => x.Weight); - double randomWeight = UnityEngine.Random.value * totalWeight; - double cumulativeWeight = 0.0; - - result.Add(gelist[UnityEngine.Random.Range(0, gelist.Count)]); - GlobalEvent.ActiveGE = result.ToList(); + List weightedPool = new List(); + foreach (IGlobalEvent ge in GlobalEvent.GlobalEventsList) + { + for (int i = 0; i < ge.Weight; i++) + { + weightedPool.Add(ge); + Log.Debug($"getochoose : {ge.Name} "); + } + } - return result; + nbGE = Math.Min(nbGE, GlobalEvent.GlobalEventsList.Count); - // yes it's dead but they deserve it for (int i = 0; i < nbGE; i++) { - bool found = false; - foreach (IGlobalEvent ge in gelist) - { - cumulativeWeight += ge.Weight; + int randomIndex = UnityEngine.Random.Range(0, weightedPool.Count); + IGlobalEvent selectedGE = weightedPool[randomIndex]; - if (randomWeight <= cumulativeWeight) - { - result.Add(ge); - break; - } - } - if (!found) - { - result.Add(gelist.Last()); - gelist.Remove(gelist.Last()); - } + result.Add(selectedGE); + weightedPool.RemoveAll(e => e == selectedGE); } - return result; + + // Step 3: Update the active global events + GlobalEvent.ActiveGE = result.ToList(); + + return result; } public void StopCoroutines() { - Timing.KillCoroutines(); - } + coroutineHandles.ForEach(coroutineHandle => + { + Timing.KillCoroutines(coroutineHandle); + }); + + } } } From 99ffcb76d887a4bc463c1ea8e85ee1a8470e5a45 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Mon, 23 Dec 2024 05:20:24 +0100 Subject: [PATCH 058/853] unregister event --- KruacentE.GlobalEventFramework/MainPlugin.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/KruacentE.GlobalEventFramework/MainPlugin.cs b/KruacentE.GlobalEventFramework/MainPlugin.cs index ce6927bd..41035f91 100644 --- a/KruacentE.GlobalEventFramework/MainPlugin.cs +++ b/KruacentE.GlobalEventFramework/MainPlugin.cs @@ -53,6 +53,7 @@ private void RegisterEvents() private void UnregisterEvents() { + ServerHandler.WaitingForPlayers -= _server.OnWaitingForPlayers; ServerHandler.RoundStarted -= _server.OnRoundStarted; ServerHandler.RoundEnded -= _server.OnEndingRound; ServerHandler.RestartingRound -= _server.OnRestartingRound; From 475ef8805c162a39b9c8f701724e0f6746f6a904 Mon Sep 17 00:00:00 2001 From: Rayanne Date: Tue, 24 Dec 2024 14:40:57 +0100 Subject: [PATCH 059/853] moved the coroutine handle list to GlobalEvent added docs --- .../GEFE.Examples/GE/Blitz.cs | 14 ++++++++++ .../GEFE.Examples/GE/KIWIS.cs | 9 ++++++ .../GEFE.Examples/GE/R.cs | 8 ++++++ .../GEFE.Examples/GE/RandomSpawn.cs | 9 ++++++ .../GEFE.Examples/GE/Shuffle.cs | 14 +++++++--- .../GEFE.Examples/GE/Speed.cs | 24 +++++++++++++--- .../GEFE.Examples/GE/SystemMalfunction.cs | 19 +++++++++++-- .../GEFE/API/Features/GlobalEvent.cs | 28 ++++++++++++++++--- .../GEFE/API/Interfaces/IGlobalEvent.cs | 8 ++++-- .../GEFE/Handlers/ServerHandler.cs | 2 +- KruacentE.GlobalEventFramework/MainPlugin.cs | 10 +------ 11 files changed, 119 insertions(+), 26 deletions(-) diff --git a/KruacentE.GlobalEventFramework/GEFE.Examples/GE/Blitz.cs b/KruacentE.GlobalEventFramework/GEFE.Examples/GE/Blitz.cs index d9408d79..4fd1ebc5 100644 --- a/KruacentE.GlobalEventFramework/GEFE.Examples/GE/Blitz.cs +++ b/KruacentE.GlobalEventFramework/GEFE.Examples/GE/Blitz.cs @@ -11,14 +11,28 @@ namespace GEFExiled.GEFE.Examples.GE { + /// + /// Spawn fused grenades in random rooms in the map + /// public class Blitz : GlobalEvent { + /// public override int Id { get; set; } = 1; + /// public override string Name { get; set; } = "Blitz"; + /// public override string Description { get; set; } = "éteignez les lumières la luftwaffe arrive"; + /// public override int Weight { get; set; } = 1; + /// + /// The cooldown between 2 spawn of grenades + /// public int Cooldown { get; set; } = 120; + /// + /// The number of grenades in each spawn + /// public int NbGrenadeSpawned { get; set; } = 5; + /// public override IEnumerator Start() { while (!Round.IsEnded) diff --git a/KruacentE.GlobalEventFramework/GEFE.Examples/GE/KIWIS.cs b/KruacentE.GlobalEventFramework/GEFE.Examples/GE/KIWIS.cs index c44d301d..0e614e6d 100644 --- a/KruacentE.GlobalEventFramework/GEFE.Examples/GE/KIWIS.cs +++ b/KruacentE.GlobalEventFramework/GEFE.Examples/GE/KIWIS.cs @@ -9,16 +9,25 @@ namespace GEFExiled.GEFE.Examples.GE { + /// + /// The scp start with 2/3 of it's life and end with 4/3 of it's vanilla life + /// public class KIWIS : GlobalEvent { + /// public override int Id { get; set; } = 32; + /// public override string Name { get; set; } = "KIWIS"; + /// public override string Description { get; set; } = "Kill It While It's Small"; + /// public override int Weight { get; set; } = 1; + /// public override IEnumerator Start() { var listScp = Player.List.ToList().Where(p => p.IsScp && p.Role.Type != RoleTypeId.Scp0492).ToList().ToDictionary(p => p, p => p.MaxHealth/3); + //set the health of all starting scps to 2/3 of their vanilla max health listScp.ForEach(k => { k.Key.MaxHealth = k.Value * 2; diff --git a/KruacentE.GlobalEventFramework/GEFE.Examples/GE/R.cs b/KruacentE.GlobalEventFramework/GEFE.Examples/GE/R.cs index 328bd917..d5929f3a 100644 --- a/KruacentE.GlobalEventFramework/GEFE.Examples/GE/R.cs +++ b/KruacentE.GlobalEventFramework/GEFE.Examples/GE/R.cs @@ -9,12 +9,20 @@ namespace GEFExiled.GEFE.Examples.GE { + /// + /// Literally does nothing + /// public class R : GlobalEvent { + /// public override int Id { get; set; } = 32; + /// public override string Name { get; set; } = "nothing"; + /// public override string Description { get; set; } = "y'a r"; + /// public override int Weight { get; set; } = 3; + /// public override IEnumerator Start() { yield return 0; diff --git a/KruacentE.GlobalEventFramework/GEFE.Examples/GE/RandomSpawn.cs b/KruacentE.GlobalEventFramework/GEFE.Examples/GE/RandomSpawn.cs index f5518695..64a3a8b7 100644 --- a/KruacentE.GlobalEventFramework/GEFE.Examples/GE/RandomSpawn.cs +++ b/KruacentE.GlobalEventFramework/GEFE.Examples/GE/RandomSpawn.cs @@ -9,12 +9,21 @@ namespace GEFExiled.GEFE.Examples.GE { + /// + /// All spawn are random at the start of the game (NTF & Chaos not included) + /// Note: all role spawn with each other except SCPs + /// public class RandomSpawn : GlobalEvent { + /// public override int Id { get; set; } = 32; + /// public override string Name { get; set; } = "RandomSpawn"; + /// public override string Description { get; set; } = "Les spawns sont random"; + /// public override int Weight { get; set; } = 1; + /// public override IEnumerator Start() { Room room = Room.Random(); diff --git a/KruacentE.GlobalEventFramework/GEFE.Examples/GE/Shuffle.cs b/KruacentE.GlobalEventFramework/GEFE.Examples/GE/Shuffle.cs index e1e3c10a..3dc2bb72 100644 --- a/KruacentE.GlobalEventFramework/GEFE.Examples/GE/Shuffle.cs +++ b/KruacentE.GlobalEventFramework/GEFE.Examples/GE/Shuffle.cs @@ -10,6 +10,9 @@ namespace GEFExiled.GEFE.Examples.GE { + /// + /// Every some amount of time all player take the position of another + /// public class Shuffle : GlobalEvent { /// @@ -62,18 +65,17 @@ public override IEnumerator Start() Log.Debug($"cleared"); } } - + / // public override void SubscribeEvent() { PlayerHandler.Joined += OnJoined; } - + /// public override void UnsubscribeEvent() { PlayerHandler.Joined -= OnJoined; } - private void OnJoined(JoinedEventArgs ev) { if (!ev.Player.IsNPC) @@ -82,7 +84,11 @@ private void OnJoined(JoinedEventArgs ev) this.pos.Add(ev.Player.Position); } } - + /// + /// Shift a List to the left + /// + /// the type of the List + /// the List to shift private void ShiftLeft(List lst) { if (lst.Count > 0) diff --git a/KruacentE.GlobalEventFramework/GEFE.Examples/GE/Speed.cs b/KruacentE.GlobalEventFramework/GEFE.Examples/GE/Speed.cs index bb32aaa2..108d278e 100644 --- a/KruacentE.GlobalEventFramework/GEFE.Examples/GE/Speed.cs +++ b/KruacentE.GlobalEventFramework/GEFE.Examples/GE/Speed.cs @@ -14,39 +14,55 @@ namespace GEFExiled.GEFE.Examples.GE { + /// + /// Everyone has a movement boost effect (stackable) + /// Maybe inspired by Dr Bright's Mayhem + /// public class Speed : GlobalEvent { + /// public override int Id { get; set; } = 30; + /// public override string Name { get; set; } = "Speed"; + /// public override string Description { get; set; } = "Gas! gas! gas!"; + /// public override int Weight { get; set; } = 1; - [Description("the movement speed that will be added to the player")] + /// + /// intensity of the movement boost effect + /// public byte MovementBoost { get; set; } = 100; - + /// public override IEnumerator Start() { yield return Timing.WaitForSeconds(1); Player.List.ToList().ForEach(p => p.EnableEffect(MovementBoost,999999999, true)); } + /// public override void SubscribeEvent() { PlayerHandler.ChangingRole += ReactivateEffectSpawn; Exiled.Events.Handlers.Scp173.Blinking += SpeedyNut; } - + /// public override void UnsubscribeEvent() { PlayerHandler.ChangingRole -= ReactivateEffectSpawn; Exiled.Events.Handlers.Scp173.Blinking -= SpeedyNut; Player.List.ToList().ForEach(p => p.DisableEffect()); } - + /// + /// Decrease the blink cooldown of SCP-173 + /// private void SpeedyNut(BlinkingEventArgs ev) { ev.BlinkCooldown = ev.BlinkCooldown/2; } + /// + /// Reactivate the effect at each role changement + /// private void ReactivateEffectSpawn(ChangingRoleEventArgs ev) { Timing.CallDelayed(1f, () => ev.Player.EnableEffect(MovementBoost, 999999999, true)); diff --git a/KruacentE.GlobalEventFramework/GEFE.Examples/GE/SystemMalfunction.cs b/KruacentE.GlobalEventFramework/GEFE.Examples/GE/SystemMalfunction.cs index 46babe88..8cf0c371 100644 --- a/KruacentE.GlobalEventFramework/GEFE.Examples/GE/SystemMalfunction.cs +++ b/KruacentE.GlobalEventFramework/GEFE.Examples/GE/SystemMalfunction.cs @@ -17,15 +17,30 @@ namespace GEFExiled.GEFE.Examples.GE { - + /// + /// The original + /// + /// The nuke can go off random from 15 to 30 min in the round (can be disable like a normal nuke) + /// If BlackoutNDoor is enabled in the server, increase the frequence of blackouts and door lockdowns + /// Can lock Elevator and Gate for an amount of time + /// Checkpoints can open randomly + /// + /// public class SystemMalfunction : GlobalEvent { + /// public override int Id { get; set; } = 1; + /// public override string Name { get; set; } = "System Malfunction"; + /// public override string Description { get; set; } = "On dirait que les systèmes informatiques sont défaillants"; + /// public override int Weight { get; set; } = 1; + /// + /// Set the cooldown for the BlackoutNDoor + /// public int NewCooldown { get; set; } = 180; - + /// public override IEnumerator Start() { MoreBlackOutNDoors(); diff --git a/KruacentE.GlobalEventFramework/GEFE/API/Features/GlobalEvent.cs b/KruacentE.GlobalEventFramework/GEFE/API/Features/GlobalEvent.cs index d1c61613..0819f553 100644 --- a/KruacentE.GlobalEventFramework/GEFE/API/Features/GlobalEvent.cs +++ b/KruacentE.GlobalEventFramework/GEFE/API/Features/GlobalEvent.cs @@ -21,15 +21,20 @@ public class GlobalEvent : IGlobalEvent /// public static List ActiveGlobalEvents => ActiveGE.ToList(); internal static List ActiveGE { get; set; } = new List(); + internal static List coroutineHandles = new List(); internal static Dictionary GlobalEvents { get; set; } = new Dictionary(); /// /// A list of all registered GlobalEvents /// public static List GlobalEventsList => GlobalEvents.Values.ToList(); public static HashSet Registered { get; } = new HashSet(); + /// public virtual int Id { get; set; } = -1; + /// public virtual string Name { get; set; } = "GE NOT SET"; + /// public virtual string Description { get; set; } = "DESC NOT SET"; + /// public virtual int Weight { get; set; } = 1; public static void Register(IGlobalEvent globalEvent) @@ -54,26 +59,41 @@ public static void Register(List globalEvents) { globalEvents.ForEach(globalEvent => Register(globalEvent)); } - + /// public virtual IEnumerator Start() { Log.Error($"{GetType().Name} Start is NOT overrided"); yield return Timing.WaitForSeconds(30f); } - + /// public virtual void SubscribeEvent() { Log.Warn($"{GetType().Name} : SubscribeEvent is NOT overrided"); } + /// public virtual void UnsubscribeEvent() { Log.Warn($"{GetType().Name} : UnsubscribeEvent is NOT overrided"); } - - public void Clean() + /// + /// Create new List/Dictionary for the Global Event storage + /// + internal void Clean() { GlobalEvents = new Dictionary(); ActiveGE = new List(); } + + /// + /// Stop all Coroutine from GE + /// + internal static void StopCoroutines() + { + coroutineHandles.ForEach(coroutineHandle => + { + Timing.KillCoroutines(coroutineHandle); + }); + + } } } diff --git a/KruacentE.GlobalEventFramework/GEFE/API/Interfaces/IGlobalEvent.cs b/KruacentE.GlobalEventFramework/GEFE/API/Interfaces/IGlobalEvent.cs index f280ce2c..25a25411 100644 --- a/KruacentE.GlobalEventFramework/GEFE/API/Interfaces/IGlobalEvent.cs +++ b/KruacentE.GlobalEventFramework/GEFE/API/Interfaces/IGlobalEvent.cs @@ -32,9 +32,13 @@ public interface IGlobalEvent /// Is launched at the start of a round /// IEnumerator Start(); - + /// + /// The method used to subcribe to event like with normal plugins + /// void SubscribeEvent(); - + /// + /// The method used to unsubcribe to event like with normal plugins + /// void UnsubscribeEvent(); } } diff --git a/KruacentE.GlobalEventFramework/GEFE/Handlers/ServerHandler.cs b/KruacentE.GlobalEventFramework/GEFE/Handlers/ServerHandler.cs index fe8f92b4..f5cc05a2 100644 --- a/KruacentE.GlobalEventFramework/GEFE/Handlers/ServerHandler.cs +++ b/KruacentE.GlobalEventFramework/GEFE/Handlers/ServerHandler.cs @@ -28,7 +28,7 @@ public void OnRoundStarted() public void OnWaitingForPlayers() { - MainPlugin.Instance.StopCoroutines(); + GlobalEvent.StopCoroutines(); } public void OnEndingRound(RoundEndedEventArgs _) diff --git a/KruacentE.GlobalEventFramework/MainPlugin.cs b/KruacentE.GlobalEventFramework/MainPlugin.cs index 41035f91..940faab7 100644 --- a/KruacentE.GlobalEventFramework/MainPlugin.cs +++ b/KruacentE.GlobalEventFramework/MainPlugin.cs @@ -19,7 +19,6 @@ internal class MainPlugin : Plugin internal static MainPlugin Instance {get;private set;} - public static List coroutineHandles = new List(); public override void OnEnabled() { @@ -112,7 +111,7 @@ public List ChooseGE(int numberOfGlobalEvent = 1) { Log.Info(ge.Name); var a = Timing.RunCoroutine(ge.Start()); - coroutineHandles.Add(a); //crash when using other ge from other assembly + GlobalEvent.coroutineHandles.Add(a); //crash when using other ge from other assembly } return activeGE; } @@ -149,13 +148,6 @@ private List ChooseRandomGE(int nbGE = 1) return result; } - public void StopCoroutines() - { - coroutineHandles.ForEach(coroutineHandle => - { - Timing.KillCoroutines(coroutineHandle); - }); - } } } From 83c1c8202cc77365eb29aa8437af3ff73a174b3d Mon Sep 17 00:00:00 2001 From: Rayanne Date: Fri, 27 Dec 2024 14:15:36 +0100 Subject: [PATCH 060/853] corrected some commands --- KruacentE.GlobalEventFramework/GEFE/Commands/List.cs | 2 +- .../GEFE/Commands/ParentCommandGEFE.cs | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/KruacentE.GlobalEventFramework/GEFE/Commands/List.cs b/KruacentE.GlobalEventFramework/GEFE/Commands/List.cs index bcc898e8..06c235b1 100644 --- a/KruacentE.GlobalEventFramework/GEFE/Commands/List.cs +++ b/KruacentE.GlobalEventFramework/GEFE/Commands/List.cs @@ -28,7 +28,7 @@ public bool Execute(ArraySegment arguments, ICommandSender sender, out s { result += "[ ]"; } - result += $" {ge.Id} : {ge.Name} : {ge.Description}"; + result += $" {ge.Id} : {ge.Name} : {ge.Description}\n"; } response = result; return true; diff --git a/KruacentE.GlobalEventFramework/GEFE/Commands/ParentCommandGEFE.cs b/KruacentE.GlobalEventFramework/GEFE/Commands/ParentCommandGEFE.cs index 41b617d1..d1f54b37 100644 --- a/KruacentE.GlobalEventFramework/GEFE/Commands/ParentCommandGEFE.cs +++ b/KruacentE.GlobalEventFramework/GEFE/Commands/ParentCommandGEFE.cs @@ -22,7 +22,10 @@ public override void LoadGeneratedCommands() protected override bool ExecuteParent(ArraySegment arguments, ICommandSender sender, out string response) { - + if(arguments.Count() == 0){ + response = "subcommand available : list"; + return true; + } response = ""; return true; } From b9ab2e6b3b6d24b0f77959e9fb1f775f9e33ae12 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Fri, 27 Dec 2024 15:29:28 +0100 Subject: [PATCH 061/853] to a little trolling --- .../BlackoutKruacent.csproj | 23 -------- KruacentE.BlackoutNDoor/BlackoutKruacent.sln | 22 ------- .../GEFExiled.csproj | 33 ----------- KruacentE.GlobalEventFramework/GEFExiled.sln | 25 -------- KruacentE.Items/ArmeKruacent.csproj | 35 ----------- KruacentE.Misc/KE.Misc.csproj | 32 ---------- KruacentE.Misc/KE.Misc.sln | 22 ------- KruacentExiled.csproj | 23 -------- KruacentExiled.sln | 22 ------- .../API/Features/Controller.cs | 0 .../KE.BlackoutNDoor}/Config.cs | 0 .../Handlers/ServerHandler.cs | 0 .../KE.BlackoutNDoor/KE.BlackoutNDoor.csproj | 17 ++++++ .../KE.BlackoutNDoor}/MainPlugin.cs | 0 .../KE.GlobalEventFramework}/Config.cs | 0 .../GEFE.Examples/GE/BlackoutAgain.cs | 58 +++++++++++++++++++ .../GEFE.Examples/GE/Blitz.cs | 0 .../GEFE.Examples/GE/Impostor.cs | 0 .../GEFE.Examples/GE/KIWIS.cs | 0 .../GEFE.Examples/GE/OpenBar.cs | 0 .../GEFE.Examples/GE/R.cs | 0 .../GEFE.Examples/GE/RandomSpawn.cs | 0 .../GEFE.Examples/GE/Shuffle.cs | 0 .../GEFE.Examples/GE/Speed.cs | 0 .../GEFE.Examples/GE/SystemMalfunction.cs | 0 .../GEFE/API/Features/GlobalEvent.cs | 0 .../GEFE/API/Interfaces/IGlobalEvent.cs | 0 .../GEFE/API/Utils/Coroutine.cs | 0 .../GEFE/Commands/List.cs | 0 .../GEFE/Commands/ParentCommandGEFE.cs | 0 .../Exception/GlobalEventNullException.cs | 0 .../GEFE/Handlers/ServerHandler.cs | 1 + .../KE.GlobalEventFramework.csproj | 22 +++++++ .../KE.GlobalEventFramework}/MainPlugin.cs | 0 .../KE.Items}/Config.cs | 0 .../KE.Items}/Items/AdrenalineDrogue.cs | 0 .../KE.Items}/Items/Mine.cs | 0 .../KE.Items}/Items/TPGrenada.cs | 0 KruacentExiled/KE.Items/KE.Items.csproj | 23 ++++++++ .../KE.Items}/MainPlugin.cs | 0 .../KE.Misc}/Config.cs | 0 KruacentExiled/KE.Misc/KE.Misc.csproj | 20 +++++++ .../KE.Misc}/MainPlugin.cs | 0 .../KE.Misc}/README.md | 0 .../KE.Misc}/ServerHandler.cs | 0 KruacentExiled/KruacentExiled.sln | 40 +++++++++++++ KruacentExiled/contribute.md | 0 LICENSE.txt => LICENSE | 0 48 files changed, 181 insertions(+), 237 deletions(-) delete mode 100644 KruacentE.BlackoutNDoor/BlackoutKruacent.csproj delete mode 100644 KruacentE.BlackoutNDoor/BlackoutKruacent.sln delete mode 100644 KruacentE.GlobalEventFramework/GEFExiled.csproj delete mode 100644 KruacentE.GlobalEventFramework/GEFExiled.sln delete mode 100644 KruacentE.Items/ArmeKruacent.csproj delete mode 100644 KruacentE.Misc/KE.Misc.csproj delete mode 100644 KruacentE.Misc/KE.Misc.sln delete mode 100644 KruacentExiled.csproj delete mode 100644 KruacentExiled.sln rename {KruacentE.BlackoutNDoor => KruacentExiled/KE.BlackoutNDoor}/API/Features/Controller.cs (100%) rename {KruacentE.BlackoutNDoor => KruacentExiled/KE.BlackoutNDoor}/Config.cs (100%) rename {KruacentE.BlackoutNDoor => KruacentExiled/KE.BlackoutNDoor}/Handlers/ServerHandler.cs (100%) create mode 100644 KruacentExiled/KE.BlackoutNDoor/KE.BlackoutNDoor.csproj rename {KruacentE.BlackoutNDoor => KruacentExiled/KE.BlackoutNDoor}/MainPlugin.cs (100%) rename {KruacentE.GlobalEventFramework => KruacentExiled/KE.GlobalEventFramework}/Config.cs (100%) create mode 100644 KruacentExiled/KE.GlobalEventFramework/GEFE.Examples/GE/BlackoutAgain.cs rename {KruacentE.GlobalEventFramework => KruacentExiled/KE.GlobalEventFramework}/GEFE.Examples/GE/Blitz.cs (100%) rename {KruacentE.GlobalEventFramework => KruacentExiled/KE.GlobalEventFramework}/GEFE.Examples/GE/Impostor.cs (100%) rename {KruacentE.GlobalEventFramework => KruacentExiled/KE.GlobalEventFramework}/GEFE.Examples/GE/KIWIS.cs (100%) rename {KruacentE.GlobalEventFramework => KruacentExiled/KE.GlobalEventFramework}/GEFE.Examples/GE/OpenBar.cs (100%) rename {KruacentE.GlobalEventFramework => KruacentExiled/KE.GlobalEventFramework}/GEFE.Examples/GE/R.cs (100%) rename {KruacentE.GlobalEventFramework => KruacentExiled/KE.GlobalEventFramework}/GEFE.Examples/GE/RandomSpawn.cs (100%) rename {KruacentE.GlobalEventFramework => KruacentExiled/KE.GlobalEventFramework}/GEFE.Examples/GE/Shuffle.cs (100%) rename {KruacentE.GlobalEventFramework => KruacentExiled/KE.GlobalEventFramework}/GEFE.Examples/GE/Speed.cs (100%) rename {KruacentE.GlobalEventFramework => KruacentExiled/KE.GlobalEventFramework}/GEFE.Examples/GE/SystemMalfunction.cs (100%) rename {KruacentE.GlobalEventFramework => KruacentExiled/KE.GlobalEventFramework}/GEFE/API/Features/GlobalEvent.cs (100%) rename {KruacentE.GlobalEventFramework => KruacentExiled/KE.GlobalEventFramework}/GEFE/API/Interfaces/IGlobalEvent.cs (100%) rename {KruacentE.GlobalEventFramework => KruacentExiled/KE.GlobalEventFramework}/GEFE/API/Utils/Coroutine.cs (100%) rename {KruacentE.GlobalEventFramework => KruacentExiled/KE.GlobalEventFramework}/GEFE/Commands/List.cs (100%) rename {KruacentE.GlobalEventFramework => KruacentExiled/KE.GlobalEventFramework}/GEFE/Commands/ParentCommandGEFE.cs (100%) rename {KruacentE.GlobalEventFramework => KruacentExiled/KE.GlobalEventFramework}/GEFE/Exception/GlobalEventNullException.cs (100%) rename {KruacentE.GlobalEventFramework => KruacentExiled/KE.GlobalEventFramework}/GEFE/Handlers/ServerHandler.cs (98%) create mode 100644 KruacentExiled/KE.GlobalEventFramework/KE.GlobalEventFramework.csproj rename {KruacentE.GlobalEventFramework => KruacentExiled/KE.GlobalEventFramework}/MainPlugin.cs (100%) rename {KruacentE.Items => KruacentExiled/KE.Items}/Config.cs (100%) rename {KruacentE.Items => KruacentExiled/KE.Items}/Items/AdrenalineDrogue.cs (100%) rename {KruacentE.Items => KruacentExiled/KE.Items}/Items/Mine.cs (100%) rename {KruacentE.Items => KruacentExiled/KE.Items}/Items/TPGrenada.cs (100%) create mode 100644 KruacentExiled/KE.Items/KE.Items.csproj rename {KruacentE.Items => KruacentExiled/KE.Items}/MainPlugin.cs (100%) rename {KruacentE.Misc => KruacentExiled/KE.Misc}/Config.cs (100%) create mode 100644 KruacentExiled/KE.Misc/KE.Misc.csproj rename {KruacentE.Misc => KruacentExiled/KE.Misc}/MainPlugin.cs (100%) rename {KruacentE.Misc => KruacentExiled/KE.Misc}/README.md (100%) rename {KruacentE.Misc => KruacentExiled/KE.Misc}/ServerHandler.cs (100%) create mode 100644 KruacentExiled/KruacentExiled.sln create mode 100644 KruacentExiled/contribute.md rename LICENSE.txt => LICENSE (100%) diff --git a/KruacentE.BlackoutNDoor/BlackoutKruacent.csproj b/KruacentE.BlackoutNDoor/BlackoutKruacent.csproj deleted file mode 100644 index 3fa6f206..00000000 --- a/KruacentE.BlackoutNDoor/BlackoutKruacent.csproj +++ /dev/null @@ -1,23 +0,0 @@ - - - - net48 - - - - - - - - - C:\Program Files (x86)\Steam\steamapps\common\SCP Secret Laboratory Dedicated Server\SCPSL_Data\Managed\Assembly-CSharp-firstpass.dll - - - C:\Program Files (x86)\Steam\steamapps\common\SCP Secret Laboratory Dedicated Server\SCPSL_Data\Managed\System.ComponentModel.Composition.dll - - - C:\Program Files (x86)\Steam\steamapps\common\SCP Secret Laboratory Dedicated Server\SCPSL_Data\Managed\UnityEngine.CoreModule.dll - - - - diff --git a/KruacentE.BlackoutNDoor/BlackoutKruacent.sln b/KruacentE.BlackoutNDoor/BlackoutKruacent.sln deleted file mode 100644 index 53bbd945..00000000 --- a/KruacentE.BlackoutNDoor/BlackoutKruacent.sln +++ /dev/null @@ -1,22 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio Version 17 -VisualStudioVersion = 17.12.35506.116 d17.12 -MinimumVisualStudioVersion = 10.0.40219.1 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BlackoutKruacent", "BlackoutKruacent.csproj", "{347FC6BF-9742-4687-A244-85028B70D158}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Any CPU = Debug|Any CPU - Release|Any CPU = Release|Any CPU - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {347FC6BF-9742-4687-A244-85028B70D158}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {347FC6BF-9742-4687-A244-85028B70D158}.Debug|Any CPU.Build.0 = Debug|Any CPU - {347FC6BF-9742-4687-A244-85028B70D158}.Release|Any CPU.ActiveCfg = Release|Any CPU - {347FC6BF-9742-4687-A244-85028B70D158}.Release|Any CPU.Build.0 = Release|Any CPU - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal diff --git a/KruacentE.GlobalEventFramework/GEFExiled.csproj b/KruacentE.GlobalEventFramework/GEFExiled.csproj deleted file mode 100644 index 0bbf5821..00000000 --- a/KruacentE.GlobalEventFramework/GEFExiled.csproj +++ /dev/null @@ -1,33 +0,0 @@ - - - - net48 - - - - - - - - - ../lib/Assembly-CSharp-firstpass.dll - - - ..\KruacentE.BlackoutNDoor\bin\Debug\net48\BlackoutKruacent.dll - - - ../lib/Mirror.dll - - - ../lib/UnityEngine.dll - - - ../lib/UnityEngine.CoreModule.dll - - - - - - - - diff --git a/KruacentE.GlobalEventFramework/GEFExiled.sln b/KruacentE.GlobalEventFramework/GEFExiled.sln deleted file mode 100644 index d4cc1296..00000000 --- a/KruacentE.GlobalEventFramework/GEFExiled.sln +++ /dev/null @@ -1,25 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio Version 17 -VisualStudioVersion = 17.11.35222.181 -MinimumVisualStudioVersion = 10.0.40219.1 -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "GEFExiled", "GEFExiled.csproj", "{C3D1358D-F7B6-48A0-8344-3917D6572980}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Any CPU = Debug|Any CPU - Release|Any CPU = Release|Any CPU - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {C3D1358D-F7B6-48A0-8344-3917D6572980}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {C3D1358D-F7B6-48A0-8344-3917D6572980}.Debug|Any CPU.Build.0 = Debug|Any CPU - {C3D1358D-F7B6-48A0-8344-3917D6572980}.Release|Any CPU.ActiveCfg = Release|Any CPU - {C3D1358D-F7B6-48A0-8344-3917D6572980}.Release|Any CPU.Build.0 = Release|Any CPU - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection - GlobalSection(ExtensibilityGlobals) = postSolution - SolutionGuid = {42FD0DA0-321B-4DCB-BD21-C300DD7D64A3} - EndGlobalSection -EndGlobal diff --git a/KruacentE.Items/ArmeKruacent.csproj b/KruacentE.Items/ArmeKruacent.csproj deleted file mode 100644 index bf48e06e..00000000 --- a/KruacentE.Items/ArmeKruacent.csproj +++ /dev/null @@ -1,35 +0,0 @@ - - - - net48 - - - - - - - - - C:\Program Files (x86)\Steam\steamapps\common\SCP Secret Laboratory Dedicated Server\SCPSL_Data\Managed\Assembly-CSharp-firstpass.dll - - - ..\lib\CustomItems.dll - - - C:\Program Files (x86)\Steam\steamapps\common\SCP Secret Laboratory Dedicated Server\SCPSL_Data\Managed\Mirror.dll - - - C:\Program Files (x86)\Steam\steamapps\common\SCP Secret Laboratory Dedicated Server\SCPSL_Data\Managed\System.ComponentModel.Composition.dll - - - C:\Program Files (x86)\Steam\steamapps\common\SCP Secret Laboratory Dedicated Server\SCPSL_Data\Managed\UnityEngine.dll - - - C:\Program Files (x86)\Steam\steamapps\common\SCP Secret Laboratory Dedicated Server\SCPSL_Data\Managed\UnityEngine.CoreModule.dll - - - C:\Program Files (x86)\Steam\steamapps\common\SCP Secret Laboratory Dedicated Server\SCPSL_Data\Managed\UnityEngine.PhysicsModule.dll - - - - diff --git a/KruacentE.Misc/KE.Misc.csproj b/KruacentE.Misc/KE.Misc.csproj deleted file mode 100644 index ded80437..00000000 --- a/KruacentE.Misc/KE.Misc.csproj +++ /dev/null @@ -1,32 +0,0 @@ - - - - net48 - - - - - - - - - C:\Program Files (x86)\Steam\steamapps\common\SCP Secret Laboratory Dedicated Server\SCPSL_Data\Managed\Assembly-CSharp-firstpass.dll - - - C:\Program Files (x86)\Steam\steamapps\common\SCP Secret Laboratory Dedicated Server\SCPSL_Data\Managed\Mirror.dll - - - C:\Program Files (x86)\Steam\steamapps\common\SCP Secret Laboratory Dedicated Server\SCPSL_Data\Managed\System.ComponentModel.Composition.dll - - - C:\Program Files (x86)\Steam\steamapps\common\SCP Secret Laboratory Dedicated Server\SCPSL_Data\Managed\UnityEngine.dll - - - C:\Program Files (x86)\Steam\steamapps\common\SCP Secret Laboratory Dedicated Server\SCPSL_Data\Managed\UnityEngine.CoreModule.dll - - - C:\Program Files (x86)\Steam\steamapps\common\SCP Secret Laboratory Dedicated Server\SCPSL_Data\Managed\UnityEngine.PhysicsModule.dll - - - - diff --git a/KruacentE.Misc/KE.Misc.sln b/KruacentE.Misc/KE.Misc.sln deleted file mode 100644 index a826aa28..00000000 --- a/KruacentE.Misc/KE.Misc.sln +++ /dev/null @@ -1,22 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio Version 17 -VisualStudioVersion = 17.12.35506.116 d17.12 -MinimumVisualStudioVersion = 10.0.40219.1 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "KE.Misc", "KE.Misc.csproj", "{1653A566-B1B3-49C1-A331-7FD600A6C118}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Any CPU = Debug|Any CPU - Release|Any CPU = Release|Any CPU - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {1653A566-B1B3-49C1-A331-7FD600A6C118}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {1653A566-B1B3-49C1-A331-7FD600A6C118}.Debug|Any CPU.Build.0 = Debug|Any CPU - {1653A566-B1B3-49C1-A331-7FD600A6C118}.Release|Any CPU.ActiveCfg = Release|Any CPU - {1653A566-B1B3-49C1-A331-7FD600A6C118}.Release|Any CPU.Build.0 = Release|Any CPU - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal diff --git a/KruacentExiled.csproj b/KruacentExiled.csproj deleted file mode 100644 index 6a605df2..00000000 --- a/KruacentExiled.csproj +++ /dev/null @@ -1,23 +0,0 @@ - - - - net48 - - - - - - - - - C:\Program Files (x86)\Steam\steamapps\common\SCP Secret Laboratory Dedicated Server\SCPSL_Data\Managed\Assembly-CSharp-firstpass.dll - - - C:\Program Files (x86)\Steam\steamapps\common\SCP Secret Laboratory Dedicated Server\SCPSL_Data\Managed\UnityEngine.dll - - - C:\Program Files (x86)\Steam\steamapps\common\SCP Secret Laboratory Dedicated Server\SCPSL_Data\Managed\UnityEngine.CoreModule.dll - - - - diff --git a/KruacentExiled.sln b/KruacentExiled.sln deleted file mode 100644 index 7456edab..00000000 --- a/KruacentExiled.sln +++ /dev/null @@ -1,22 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio Version 17 -VisualStudioVersion = 17.12.35506.116 d17.12 -MinimumVisualStudioVersion = 10.0.40219.1 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "KruacentExiled", "KruacentExiled.csproj", "{9F49DAA8-F0F8-47C2-8D20-16E34F09BBCC}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Any CPU = Debug|Any CPU - Release|Any CPU = Release|Any CPU - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {9F49DAA8-F0F8-47C2-8D20-16E34F09BBCC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {9F49DAA8-F0F8-47C2-8D20-16E34F09BBCC}.Debug|Any CPU.Build.0 = Debug|Any CPU - {9F49DAA8-F0F8-47C2-8D20-16E34F09BBCC}.Release|Any CPU.ActiveCfg = Release|Any CPU - {9F49DAA8-F0F8-47C2-8D20-16E34F09BBCC}.Release|Any CPU.Build.0 = Release|Any CPU - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal diff --git a/KruacentE.BlackoutNDoor/API/Features/Controller.cs b/KruacentExiled/KE.BlackoutNDoor/API/Features/Controller.cs similarity index 100% rename from KruacentE.BlackoutNDoor/API/Features/Controller.cs rename to KruacentExiled/KE.BlackoutNDoor/API/Features/Controller.cs diff --git a/KruacentE.BlackoutNDoor/Config.cs b/KruacentExiled/KE.BlackoutNDoor/Config.cs similarity index 100% rename from KruacentE.BlackoutNDoor/Config.cs rename to KruacentExiled/KE.BlackoutNDoor/Config.cs diff --git a/KruacentE.BlackoutNDoor/Handlers/ServerHandler.cs b/KruacentExiled/KE.BlackoutNDoor/Handlers/ServerHandler.cs similarity index 100% rename from KruacentE.BlackoutNDoor/Handlers/ServerHandler.cs rename to KruacentExiled/KE.BlackoutNDoor/Handlers/ServerHandler.cs diff --git a/KruacentExiled/KE.BlackoutNDoor/KE.BlackoutNDoor.csproj b/KruacentExiled/KE.BlackoutNDoor/KE.BlackoutNDoor.csproj new file mode 100644 index 00000000..a05e19e5 --- /dev/null +++ b/KruacentExiled/KE.BlackoutNDoor/KE.BlackoutNDoor.csproj @@ -0,0 +1,17 @@ + + + + net48 + + + + + + + + + + + + + diff --git a/KruacentE.BlackoutNDoor/MainPlugin.cs b/KruacentExiled/KE.BlackoutNDoor/MainPlugin.cs similarity index 100% rename from KruacentE.BlackoutNDoor/MainPlugin.cs rename to KruacentExiled/KE.BlackoutNDoor/MainPlugin.cs diff --git a/KruacentE.GlobalEventFramework/Config.cs b/KruacentExiled/KE.GlobalEventFramework/Config.cs similarity index 100% rename from KruacentE.GlobalEventFramework/Config.cs rename to KruacentExiled/KE.GlobalEventFramework/Config.cs diff --git a/KruacentExiled/KE.GlobalEventFramework/GEFE.Examples/GE/BlackoutAgain.cs b/KruacentExiled/KE.GlobalEventFramework/GEFE.Examples/GE/BlackoutAgain.cs new file mode 100644 index 00000000..3d58ae1b --- /dev/null +++ b/KruacentExiled/KE.GlobalEventFramework/GEFE.Examples/GE/BlackoutAgain.cs @@ -0,0 +1,58 @@ +using Exiled.API.Features; +using Exiled.Events.EventArgs.Map; +using Exiled.Events.EventArgs.Player; +using GEFExiled.GEFE.API.Features; +using GEFExiled.GEFE.API.Interfaces; +using MEC; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace GEFExiled.GEFE.Examples.GE +{ + public class BlackoutAgain : GlobalEvent + { + public override int Id { get; set; } = 36; + public override string Name { get; set; } = "BlackoutGE"; + public override string Description { get; set; } = "Sortez vos grosse lampe là"; + public override int Weight { get; set; } = 0; + public override IEnumerator Start() + { + Room.List.ToList().ForEach(x => { + x.AreLightsOff = true; + }); + Timing.CallDelayed(1f, () => + { + Player.List.ToList().ForEach(p => + { + p.AddItem(ItemType.Flashlight); + }); + }); + + yield return 0; + } + + + public override void SubscribeEvent() + { + Exiled.Events.Handlers.Map.GeneratorActivating += Gen; + } + + public override void UnsubscribeEvent() + { + Exiled.Events.Handlers.Map.GeneratorActivating -= Gen; + } + + public void Gen(GeneratorActivatingEventArgs ev) + { + if(Generator.List.Where(g => g.IsEngaged).ToList().Count() == 3) + { + Room.List.ToList().ForEach(x => { + x.AreLightsOff = false; + }); + } + } + } +} diff --git a/KruacentE.GlobalEventFramework/GEFE.Examples/GE/Blitz.cs b/KruacentExiled/KE.GlobalEventFramework/GEFE.Examples/GE/Blitz.cs similarity index 100% rename from KruacentE.GlobalEventFramework/GEFE.Examples/GE/Blitz.cs rename to KruacentExiled/KE.GlobalEventFramework/GEFE.Examples/GE/Blitz.cs diff --git a/KruacentE.GlobalEventFramework/GEFE.Examples/GE/Impostor.cs b/KruacentExiled/KE.GlobalEventFramework/GEFE.Examples/GE/Impostor.cs similarity index 100% rename from KruacentE.GlobalEventFramework/GEFE.Examples/GE/Impostor.cs rename to KruacentExiled/KE.GlobalEventFramework/GEFE.Examples/GE/Impostor.cs diff --git a/KruacentE.GlobalEventFramework/GEFE.Examples/GE/KIWIS.cs b/KruacentExiled/KE.GlobalEventFramework/GEFE.Examples/GE/KIWIS.cs similarity index 100% rename from KruacentE.GlobalEventFramework/GEFE.Examples/GE/KIWIS.cs rename to KruacentExiled/KE.GlobalEventFramework/GEFE.Examples/GE/KIWIS.cs diff --git a/KruacentE.GlobalEventFramework/GEFE.Examples/GE/OpenBar.cs b/KruacentExiled/KE.GlobalEventFramework/GEFE.Examples/GE/OpenBar.cs similarity index 100% rename from KruacentE.GlobalEventFramework/GEFE.Examples/GE/OpenBar.cs rename to KruacentExiled/KE.GlobalEventFramework/GEFE.Examples/GE/OpenBar.cs diff --git a/KruacentE.GlobalEventFramework/GEFE.Examples/GE/R.cs b/KruacentExiled/KE.GlobalEventFramework/GEFE.Examples/GE/R.cs similarity index 100% rename from KruacentE.GlobalEventFramework/GEFE.Examples/GE/R.cs rename to KruacentExiled/KE.GlobalEventFramework/GEFE.Examples/GE/R.cs diff --git a/KruacentE.GlobalEventFramework/GEFE.Examples/GE/RandomSpawn.cs b/KruacentExiled/KE.GlobalEventFramework/GEFE.Examples/GE/RandomSpawn.cs similarity index 100% rename from KruacentE.GlobalEventFramework/GEFE.Examples/GE/RandomSpawn.cs rename to KruacentExiled/KE.GlobalEventFramework/GEFE.Examples/GE/RandomSpawn.cs diff --git a/KruacentE.GlobalEventFramework/GEFE.Examples/GE/Shuffle.cs b/KruacentExiled/KE.GlobalEventFramework/GEFE.Examples/GE/Shuffle.cs similarity index 100% rename from KruacentE.GlobalEventFramework/GEFE.Examples/GE/Shuffle.cs rename to KruacentExiled/KE.GlobalEventFramework/GEFE.Examples/GE/Shuffle.cs diff --git a/KruacentE.GlobalEventFramework/GEFE.Examples/GE/Speed.cs b/KruacentExiled/KE.GlobalEventFramework/GEFE.Examples/GE/Speed.cs similarity index 100% rename from KruacentE.GlobalEventFramework/GEFE.Examples/GE/Speed.cs rename to KruacentExiled/KE.GlobalEventFramework/GEFE.Examples/GE/Speed.cs diff --git a/KruacentE.GlobalEventFramework/GEFE.Examples/GE/SystemMalfunction.cs b/KruacentExiled/KE.GlobalEventFramework/GEFE.Examples/GE/SystemMalfunction.cs similarity index 100% rename from KruacentE.GlobalEventFramework/GEFE.Examples/GE/SystemMalfunction.cs rename to KruacentExiled/KE.GlobalEventFramework/GEFE.Examples/GE/SystemMalfunction.cs diff --git a/KruacentE.GlobalEventFramework/GEFE/API/Features/GlobalEvent.cs b/KruacentExiled/KE.GlobalEventFramework/GEFE/API/Features/GlobalEvent.cs similarity index 100% rename from KruacentE.GlobalEventFramework/GEFE/API/Features/GlobalEvent.cs rename to KruacentExiled/KE.GlobalEventFramework/GEFE/API/Features/GlobalEvent.cs diff --git a/KruacentE.GlobalEventFramework/GEFE/API/Interfaces/IGlobalEvent.cs b/KruacentExiled/KE.GlobalEventFramework/GEFE/API/Interfaces/IGlobalEvent.cs similarity index 100% rename from KruacentE.GlobalEventFramework/GEFE/API/Interfaces/IGlobalEvent.cs rename to KruacentExiled/KE.GlobalEventFramework/GEFE/API/Interfaces/IGlobalEvent.cs diff --git a/KruacentE.GlobalEventFramework/GEFE/API/Utils/Coroutine.cs b/KruacentExiled/KE.GlobalEventFramework/GEFE/API/Utils/Coroutine.cs similarity index 100% rename from KruacentE.GlobalEventFramework/GEFE/API/Utils/Coroutine.cs rename to KruacentExiled/KE.GlobalEventFramework/GEFE/API/Utils/Coroutine.cs diff --git a/KruacentE.GlobalEventFramework/GEFE/Commands/List.cs b/KruacentExiled/KE.GlobalEventFramework/GEFE/Commands/List.cs similarity index 100% rename from KruacentE.GlobalEventFramework/GEFE/Commands/List.cs rename to KruacentExiled/KE.GlobalEventFramework/GEFE/Commands/List.cs diff --git a/KruacentE.GlobalEventFramework/GEFE/Commands/ParentCommandGEFE.cs b/KruacentExiled/KE.GlobalEventFramework/GEFE/Commands/ParentCommandGEFE.cs similarity index 100% rename from KruacentE.GlobalEventFramework/GEFE/Commands/ParentCommandGEFE.cs rename to KruacentExiled/KE.GlobalEventFramework/GEFE/Commands/ParentCommandGEFE.cs diff --git a/KruacentE.GlobalEventFramework/GEFE/Exception/GlobalEventNullException.cs b/KruacentExiled/KE.GlobalEventFramework/GEFE/Exception/GlobalEventNullException.cs similarity index 100% rename from KruacentE.GlobalEventFramework/GEFE/Exception/GlobalEventNullException.cs rename to KruacentExiled/KE.GlobalEventFramework/GEFE/Exception/GlobalEventNullException.cs diff --git a/KruacentE.GlobalEventFramework/GEFE/Handlers/ServerHandler.cs b/KruacentExiled/KE.GlobalEventFramework/GEFE/Handlers/ServerHandler.cs similarity index 98% rename from KruacentE.GlobalEventFramework/GEFE/Handlers/ServerHandler.cs rename to KruacentExiled/KE.GlobalEventFramework/GEFE/Handlers/ServerHandler.cs index f5cc05a2..76521268 100644 --- a/KruacentE.GlobalEventFramework/GEFE/Handlers/ServerHandler.cs +++ b/KruacentExiled/KE.GlobalEventFramework/GEFE/Handlers/ServerHandler.cs @@ -28,6 +28,7 @@ public void OnRoundStarted() public void OnWaitingForPlayers() { + GlobalEvent.StopCoroutines(); } diff --git a/KruacentExiled/KE.GlobalEventFramework/KE.GlobalEventFramework.csproj b/KruacentExiled/KE.GlobalEventFramework/KE.GlobalEventFramework.csproj new file mode 100644 index 00000000..72036be4 --- /dev/null +++ b/KruacentExiled/KE.GlobalEventFramework/KE.GlobalEventFramework.csproj @@ -0,0 +1,22 @@ + + + + net48 + + + + + + + + + + + + + + + + + + diff --git a/KruacentE.GlobalEventFramework/MainPlugin.cs b/KruacentExiled/KE.GlobalEventFramework/MainPlugin.cs similarity index 100% rename from KruacentE.GlobalEventFramework/MainPlugin.cs rename to KruacentExiled/KE.GlobalEventFramework/MainPlugin.cs diff --git a/KruacentE.Items/Config.cs b/KruacentExiled/KE.Items/Config.cs similarity index 100% rename from KruacentE.Items/Config.cs rename to KruacentExiled/KE.Items/Config.cs diff --git a/KruacentE.Items/Items/AdrenalineDrogue.cs b/KruacentExiled/KE.Items/Items/AdrenalineDrogue.cs similarity index 100% rename from KruacentE.Items/Items/AdrenalineDrogue.cs rename to KruacentExiled/KE.Items/Items/AdrenalineDrogue.cs diff --git a/KruacentE.Items/Items/Mine.cs b/KruacentExiled/KE.Items/Items/Mine.cs similarity index 100% rename from KruacentE.Items/Items/Mine.cs rename to KruacentExiled/KE.Items/Items/Mine.cs diff --git a/KruacentE.Items/Items/TPGrenada.cs b/KruacentExiled/KE.Items/Items/TPGrenada.cs similarity index 100% rename from KruacentE.Items/Items/TPGrenada.cs rename to KruacentExiled/KE.Items/Items/TPGrenada.cs diff --git a/KruacentExiled/KE.Items/KE.Items.csproj b/KruacentExiled/KE.Items/KE.Items.csproj new file mode 100644 index 00000000..c025b27f --- /dev/null +++ b/KruacentExiled/KE.Items/KE.Items.csproj @@ -0,0 +1,23 @@ + + + + net48 + + + + + + + + + + C:\Users\Patrique\AppData\Roaming\EXILED\Plugins\Exiled.CustomItems.dll + + + + + + + + + diff --git a/KruacentE.Items/MainPlugin.cs b/KruacentExiled/KE.Items/MainPlugin.cs similarity index 100% rename from KruacentE.Items/MainPlugin.cs rename to KruacentExiled/KE.Items/MainPlugin.cs diff --git a/KruacentE.Misc/Config.cs b/KruacentExiled/KE.Misc/Config.cs similarity index 100% rename from KruacentE.Misc/Config.cs rename to KruacentExiled/KE.Misc/Config.cs diff --git a/KruacentExiled/KE.Misc/KE.Misc.csproj b/KruacentExiled/KE.Misc/KE.Misc.csproj new file mode 100644 index 00000000..6f03b2d8 --- /dev/null +++ b/KruacentExiled/KE.Misc/KE.Misc.csproj @@ -0,0 +1,20 @@ + + + + net48 + + + + + + + + + + + + + + + + diff --git a/KruacentE.Misc/MainPlugin.cs b/KruacentExiled/KE.Misc/MainPlugin.cs similarity index 100% rename from KruacentE.Misc/MainPlugin.cs rename to KruacentExiled/KE.Misc/MainPlugin.cs diff --git a/KruacentE.Misc/README.md b/KruacentExiled/KE.Misc/README.md similarity index 100% rename from KruacentE.Misc/README.md rename to KruacentExiled/KE.Misc/README.md diff --git a/KruacentE.Misc/ServerHandler.cs b/KruacentExiled/KE.Misc/ServerHandler.cs similarity index 100% rename from KruacentE.Misc/ServerHandler.cs rename to KruacentExiled/KE.Misc/ServerHandler.cs diff --git a/KruacentExiled/KruacentExiled.sln b/KruacentExiled/KruacentExiled.sln new file mode 100644 index 00000000..66706ce5 --- /dev/null +++ b/KruacentExiled/KruacentExiled.sln @@ -0,0 +1,40 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.12.35506.116 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "KE.Items", "KE.Items\KE.Items.csproj", "{2FE04C4D-7FA1-4EC5-A8AF-618EDE0C037C}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "KE.Misc", "KE.Misc\KE.Misc.csproj", "{CD822DB2-756E-4887-93AB-2D2F16BF542C}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "KE.GlobalEventFramework", "KE.GlobalEventFramework\KE.GlobalEventFramework.csproj", "{C7F7BECB-7FB1-4484-847D-E6C0A77316BE}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "KE.BlackoutNDoor", "KE.BlackoutNDoor\KE.BlackoutNDoor.csproj", "{C9867742-72DB-4ECA-81BF-104A27A04DB7}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {2FE04C4D-7FA1-4EC5-A8AF-618EDE0C037C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {2FE04C4D-7FA1-4EC5-A8AF-618EDE0C037C}.Debug|Any CPU.Build.0 = Debug|Any CPU + {2FE04C4D-7FA1-4EC5-A8AF-618EDE0C037C}.Release|Any CPU.ActiveCfg = Release|Any CPU + {2FE04C4D-7FA1-4EC5-A8AF-618EDE0C037C}.Release|Any CPU.Build.0 = Release|Any CPU + {CD822DB2-756E-4887-93AB-2D2F16BF542C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {CD822DB2-756E-4887-93AB-2D2F16BF542C}.Debug|Any CPU.Build.0 = Debug|Any CPU + {CD822DB2-756E-4887-93AB-2D2F16BF542C}.Release|Any CPU.ActiveCfg = Release|Any CPU + {CD822DB2-756E-4887-93AB-2D2F16BF542C}.Release|Any CPU.Build.0 = Release|Any CPU + {C7F7BECB-7FB1-4484-847D-E6C0A77316BE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {C7F7BECB-7FB1-4484-847D-E6C0A77316BE}.Debug|Any CPU.Build.0 = Debug|Any CPU + {C7F7BECB-7FB1-4484-847D-E6C0A77316BE}.Release|Any CPU.ActiveCfg = Release|Any CPU + {C7F7BECB-7FB1-4484-847D-E6C0A77316BE}.Release|Any CPU.Build.0 = Release|Any CPU + {C9867742-72DB-4ECA-81BF-104A27A04DB7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {C9867742-72DB-4ECA-81BF-104A27A04DB7}.Debug|Any CPU.Build.0 = Debug|Any CPU + {C9867742-72DB-4ECA-81BF-104A27A04DB7}.Release|Any CPU.ActiveCfg = Release|Any CPU + {C9867742-72DB-4ECA-81BF-104A27A04DB7}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/KruacentExiled/contribute.md b/KruacentExiled/contribute.md new file mode 100644 index 00000000..e69de29b diff --git a/LICENSE.txt b/LICENSE similarity index 100% rename from LICENSE.txt rename to LICENSE From 31d46126499cdd0a38e0a032a4b33bafb2fa7b16 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Sat, 28 Dec 2024 17:07:59 +0100 Subject: [PATCH 062/853] Separated the GlobalEventFramework and the GlobalEvent Finished the Loader --- .../Config.cs | 15 ++++++ .../GE/Blitz.cs | 5 +- .../GE/Impostor.cs | 4 +- .../GE/KIWIS.cs | 4 +- .../GE/OpenBar.cs | 6 +-- .../GE/R.cs | 4 +- .../GE/RandomSpawn.cs | 4 +- .../GE/Shuffle.cs | 6 +-- .../GE/Speed.cs | 4 +- .../GE/SystemMalfunction.cs | 17 +++---- ...centE.GlobalEventFramework.Examples.csproj | 29 ++++++++++++ ...ruacentE.GlobalEventFramework.Examples.sln | 15 +++--- .../MainPlugin.cs | 23 +++++++++ KruacentE.GlobalEventFramework/Config.cs | 10 ++-- .../GEFE/API/Features/GlobalEvent.cs | 7 ++- .../GEFE/API/Features/Loader.cs | 47 +++++++++++++++++++ .../GEFE/API/Interfaces/IGlobalEvent.cs | 2 +- .../GEFE/API/Utils/Coroutine.cs | 2 +- .../GEFE/Commands/List.cs | 4 +- .../GEFE/Commands/ParentCommandGEFE.cs | 4 +- .../Exception/GlobalEventNullException.cs | 2 +- .../GEFE/Handlers/ServerHandler.cs | 6 +-- .../GEFExiled.csproj | 33 ------------- .../KruacentE.GlobalEventFramework.csproj | 23 +++++++++ .../KruacentE.GlobalEventFramework.sln | 22 +++++++++ KruacentE.GlobalEventFramework/MainPlugin.cs | 17 +++---- 26 files changed, 216 insertions(+), 99 deletions(-) create mode 100644 KruacentE.GlobalEventFramework.Examples/Config.cs rename {KruacentE.GlobalEventFramework/GEFE.Examples => KruacentE.GlobalEventFramework.Examples}/GE/Blitz.cs (92%) rename {KruacentE.GlobalEventFramework/GEFE.Examples => KruacentE.GlobalEventFramework.Examples}/GE/Impostor.cs (95%) rename {KruacentE.GlobalEventFramework/GEFE.Examples => KruacentE.GlobalEventFramework.Examples}/GE/KIWIS.cs (93%) rename {KruacentE.GlobalEventFramework/GEFE.Examples => KruacentE.GlobalEventFramework.Examples}/GE/OpenBar.cs (81%) rename {KruacentE.GlobalEventFramework/GEFE.Examples => KruacentE.GlobalEventFramework.Examples}/GE/R.cs (87%) rename {KruacentE.GlobalEventFramework/GEFE.Examples => KruacentE.GlobalEventFramework.Examples}/GE/RandomSpawn.cs (92%) rename {KruacentE.GlobalEventFramework/GEFE.Examples => KruacentE.GlobalEventFramework.Examples}/GE/Shuffle.cs (96%) rename {KruacentE.GlobalEventFramework/GEFE.Examples => KruacentE.GlobalEventFramework.Examples}/GE/Speed.cs (95%) rename {KruacentE.GlobalEventFramework/GEFE.Examples => KruacentE.GlobalEventFramework.Examples}/GE/SystemMalfunction.cs (90%) create mode 100644 KruacentE.GlobalEventFramework.Examples/KruacentE.GlobalEventFramework.Examples.csproj rename KruacentE.GlobalEventFramework/GEFExiled.sln => KruacentE.GlobalEventFramework.Examples/KruacentE.GlobalEventFramework.Examples.sln (50%) create mode 100644 KruacentE.GlobalEventFramework.Examples/MainPlugin.cs create mode 100644 KruacentE.GlobalEventFramework/GEFE/API/Features/Loader.cs delete mode 100644 KruacentE.GlobalEventFramework/GEFExiled.csproj create mode 100644 KruacentE.GlobalEventFramework/KruacentE.GlobalEventFramework.csproj create mode 100644 KruacentE.GlobalEventFramework/KruacentE.GlobalEventFramework.sln diff --git a/KruacentE.GlobalEventFramework.Examples/Config.cs b/KruacentE.GlobalEventFramework.Examples/Config.cs new file mode 100644 index 00000000..0344484e --- /dev/null +++ b/KruacentE.GlobalEventFramework.Examples/Config.cs @@ -0,0 +1,15 @@ +using Exiled.API.Interfaces; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace GEFE.Examples +{ + internal class Config : IConfig + { + public bool IsEnabled { get; set; } = true; + public bool Debug { get; set; } = false; + } +} diff --git a/KruacentE.GlobalEventFramework/GEFE.Examples/GE/Blitz.cs b/KruacentE.GlobalEventFramework.Examples/GE/Blitz.cs similarity index 92% rename from KruacentE.GlobalEventFramework/GEFE.Examples/GE/Blitz.cs rename to KruacentE.GlobalEventFramework.Examples/GE/Blitz.cs index 4fd1ebc5..4534e7bb 100644 --- a/KruacentE.GlobalEventFramework/GEFE.Examples/GE/Blitz.cs +++ b/KruacentE.GlobalEventFramework.Examples/GE/Blitz.cs @@ -1,7 +1,6 @@ using Exiled.API.Features; using Exiled.API.Features.Items; -using GEFExiled.GEFE.API.Features; -using InventorySystem.Items.ThrowableProjectiles; +using KruacentE.GlobalEventFramework.GEFE.API.Features; using MEC; using System; using System.Collections.Generic; @@ -9,7 +8,7 @@ using System.Text; using System.Threading.Tasks; -namespace GEFExiled.GEFE.Examples.GE +namespace KruacentE.GlobalEventFramework.Examples.GE { /// /// Spawn fused grenades in random rooms in the map diff --git a/KruacentE.GlobalEventFramework/GEFE.Examples/GE/Impostor.cs b/KruacentE.GlobalEventFramework.Examples/GE/Impostor.cs similarity index 95% rename from KruacentE.GlobalEventFramework/GEFE.Examples/GE/Impostor.cs rename to KruacentE.GlobalEventFramework.Examples/GE/Impostor.cs index 7baf7d88..2e12e9d4 100644 --- a/KruacentE.GlobalEventFramework/GEFE.Examples/GE/Impostor.cs +++ b/KruacentE.GlobalEventFramework.Examples/GE/Impostor.cs @@ -1,12 +1,12 @@ using Player = Exiled.API.Features.Player; -using GEFExiled.GEFE.API.Features; using System.Collections.Generic; +using KruacentE.GlobalEventFramework.GEFE.API.Features; using MEC; using System.Linq; using Exiled.API.Extensions; using Exiled.API.Features; -namespace GEFExiled.GEFE.Examples.GE +namespace KruacentE.GlobalEventFramework.Examples.GE { public class Impostor : GlobalEvent { diff --git a/KruacentE.GlobalEventFramework/GEFE.Examples/GE/KIWIS.cs b/KruacentE.GlobalEventFramework.Examples/GE/KIWIS.cs similarity index 93% rename from KruacentE.GlobalEventFramework/GEFE.Examples/GE/KIWIS.cs rename to KruacentE.GlobalEventFramework.Examples/GE/KIWIS.cs index 0e614e6d..9f844fa1 100644 --- a/KruacentE.GlobalEventFramework/GEFE.Examples/GE/KIWIS.cs +++ b/KruacentE.GlobalEventFramework.Examples/GE/KIWIS.cs @@ -1,13 +1,13 @@ using Exiled.API.Features; -using GEFExiled.GEFE.API.Features; using MEC; using PlayerRoles; using Utils.NonAllocLINQ; using System.Collections.Generic; using System.Linq; +using KruacentE.GlobalEventFramework.GEFE.API.Features; -namespace GEFExiled.GEFE.Examples.GE +namespace KruacentE.GlobalEventFramework.Examples.GE { /// /// The scp start with 2/3 of it's life and end with 4/3 of it's vanilla life diff --git a/KruacentE.GlobalEventFramework/GEFE.Examples/GE/OpenBar.cs b/KruacentE.GlobalEventFramework.Examples/GE/OpenBar.cs similarity index 81% rename from KruacentE.GlobalEventFramework/GEFE.Examples/GE/OpenBar.cs rename to KruacentE.GlobalEventFramework.Examples/GE/OpenBar.cs index 6e66b20f..8a24d171 100644 --- a/KruacentE.GlobalEventFramework/GEFE.Examples/GE/OpenBar.cs +++ b/KruacentE.GlobalEventFramework.Examples/GE/OpenBar.cs @@ -1,5 +1,5 @@ using Exiled.API.Features.Doors; -using GEFExiled.GEFE.API.Features; +using KruacentE.GlobalEventFramework.GEFE.API.Features; using System; using System.Collections.Generic; using System.Linq; @@ -9,7 +9,7 @@ using Exiled.API.Features; using Exiled.Events.EventArgs.Map; -namespace GEFExiled.GEFE.Examples.GE +namespace KruacentE.GlobalEventFramework.Examples.GE { public class OpenBar : GlobalEvent { @@ -19,7 +19,7 @@ public class OpenBar : GlobalEvent public override int Weight { get; set; } = 1; public override IEnumerator Start() { - var doors = Door.List.Where(d => new[] { DoorType.GateA, DoorType.GateB, DoorType.HczArmory, DoorType.HID,DoorType.Intercom,DoorType.Scp049Armory,DoorType.Scp096,DoorType.Scp106Primary,DoorType.Scp106Secondary,DoorType.Scp330,DoorType.Scp330Chamber,DoorType.Scp914Gate }.Contains(d.Type)).ToList(); + var doors = Door.List.Where(d => new[] { DoorType.GateA, DoorType.GateB, DoorType.HczArmory, DoorType.HIDChamber,DoorType.Intercom,DoorType.Scp049Armory,DoorType.Scp096,DoorType.Scp106Primary,DoorType.Scp106Secondary,DoorType.Scp330,DoorType.Scp330Chamber,DoorType.Scp914Gate }.Contains(d.Type)).ToList(); UnlockAndOpen(doors); yield return 0; diff --git a/KruacentE.GlobalEventFramework/GEFE.Examples/GE/R.cs b/KruacentE.GlobalEventFramework.Examples/GE/R.cs similarity index 87% rename from KruacentE.GlobalEventFramework/GEFE.Examples/GE/R.cs rename to KruacentE.GlobalEventFramework.Examples/GE/R.cs index d5929f3a..896eb1da 100644 --- a/KruacentE.GlobalEventFramework/GEFE.Examples/GE/R.cs +++ b/KruacentE.GlobalEventFramework.Examples/GE/R.cs @@ -1,5 +1,5 @@ using Exiled.API.Features; -using GEFExiled.GEFE.API.Features; +using KruacentE.GlobalEventFramework.GEFE.API.Features; using PlayerRoles; using System; using System.Collections.Generic; @@ -7,7 +7,7 @@ using System.Text; using System.Threading.Tasks; -namespace GEFExiled.GEFE.Examples.GE +namespace KruacentE.GlobalEventFramework.Examples.GE { /// /// Literally does nothing diff --git a/KruacentE.GlobalEventFramework/GEFE.Examples/GE/RandomSpawn.cs b/KruacentE.GlobalEventFramework.Examples/GE/RandomSpawn.cs similarity index 92% rename from KruacentE.GlobalEventFramework/GEFE.Examples/GE/RandomSpawn.cs rename to KruacentE.GlobalEventFramework.Examples/GE/RandomSpawn.cs index 64a3a8b7..416fe24d 100644 --- a/KruacentE.GlobalEventFramework/GEFE.Examples/GE/RandomSpawn.cs +++ b/KruacentE.GlobalEventFramework.Examples/GE/RandomSpawn.cs @@ -1,5 +1,5 @@ using Exiled.API.Features; -using GEFExiled.GEFE.API.Features; +using KruacentE.GlobalEventFramework.GEFE.API.Features; using PlayerRoles; using System; using System.Collections.Generic; @@ -7,7 +7,7 @@ using System.Text; using System.Threading.Tasks; -namespace GEFExiled.GEFE.Examples.GE +namespace KruacentE.GlobalEventFramework.Examples.GE { /// /// All spawn are random at the start of the game (NTF & Chaos not included) diff --git a/KruacentE.GlobalEventFramework/GEFE.Examples/GE/Shuffle.cs b/KruacentE.GlobalEventFramework.Examples/GE/Shuffle.cs similarity index 96% rename from KruacentE.GlobalEventFramework/GEFE.Examples/GE/Shuffle.cs rename to KruacentE.GlobalEventFramework.Examples/GE/Shuffle.cs index 3dc2bb72..07028ea2 100644 --- a/KruacentE.GlobalEventFramework/GEFE.Examples/GE/Shuffle.cs +++ b/KruacentE.GlobalEventFramework.Examples/GE/Shuffle.cs @@ -1,6 +1,6 @@ using Exiled.API.Features; using MEC; -using GEFExiled.GEFE.API.Features; +using KruacentE.GlobalEventFramework.GEFE.API.Features; using PlayerHandler = Exiled.Events.Handlers.Player; using Exiled.Events.EventArgs.Player; using UnityEngine; @@ -8,7 +8,7 @@ using System.Linq; -namespace GEFExiled.GEFE.Examples.GE +namespace KruacentE.GlobalEventFramework.Examples.GE { /// /// Every some amount of time all player take the position of another @@ -65,7 +65,7 @@ public override IEnumerator Start() Log.Debug($"cleared"); } } - / // + /// public override void SubscribeEvent() { PlayerHandler.Joined += OnJoined; diff --git a/KruacentE.GlobalEventFramework/GEFE.Examples/GE/Speed.cs b/KruacentE.GlobalEventFramework.Examples/GE/Speed.cs similarity index 95% rename from KruacentE.GlobalEventFramework/GEFE.Examples/GE/Speed.cs rename to KruacentE.GlobalEventFramework.Examples/GE/Speed.cs index 108d278e..7c900775 100644 --- a/KruacentE.GlobalEventFramework/GEFE.Examples/GE/Speed.cs +++ b/KruacentE.GlobalEventFramework.Examples/GE/Speed.cs @@ -3,7 +3,7 @@ using Exiled.API.Features; using Exiled.Events.EventArgs.Player; using Exiled.Events.EventArgs.Scp173; -using GEFExiled.GEFE.API.Features; +using KruacentE.GlobalEventFramework.GEFE.API.Features; using MEC; using System; using System.Collections.Generic; @@ -12,7 +12,7 @@ using Utils.NonAllocLINQ; using PlayerHandler = Exiled.Events.Handlers.Player; -namespace GEFExiled.GEFE.Examples.GE +namespace KruacentE.GlobalEventFramework.Examples.GE { /// /// Everyone has a movement boost effect (stackable) diff --git a/KruacentE.GlobalEventFramework/GEFE.Examples/GE/SystemMalfunction.cs b/KruacentE.GlobalEventFramework.Examples/GE/SystemMalfunction.cs similarity index 90% rename from KruacentE.GlobalEventFramework/GEFE.Examples/GE/SystemMalfunction.cs rename to KruacentE.GlobalEventFramework.Examples/GE/SystemMalfunction.cs index 8cf0c371..f89e62ec 100644 --- a/KruacentE.GlobalEventFramework/GEFE.Examples/GE/SystemMalfunction.cs +++ b/KruacentE.GlobalEventFramework.Examples/GE/SystemMalfunction.cs @@ -1,21 +1,15 @@ -using BlackoutKruacent; -using Exiled.API.Features; +using Exiled.API.Features; using Exiled.API.Features.Doors; -using Exiled.Events.Commands.Reload; -using Exiled.Loader; -using GEFExiled.GEFE.API.Features; -using GEFExiled.GEFE.API.Utils; +using KruacentE.GlobalEventFramework.GEFE.API.Features; +using KruacentE.GlobalEventFramework.GEFE.API.Utils; using MEC; -using System; using System.Collections.Generic; using System.Linq; -using System.Text; -using System.Threading.Tasks; using Interactables.Interobjects.DoorUtils; using Exiled.API.Enums; using Exiled.API.Extensions; -namespace GEFExiled.GEFE.Examples.GE +namespace KruacentE.GlobalEventFramework.Examples.GE { /// /// The original @@ -69,9 +63,10 @@ private IEnumerator EarlyNuke() private void MoreBlackOutNDoors() { - var otherPlugin = Loader.Plugins.FirstOrDefault(plugin => plugin.Name == "BlackOutNDoors"); + var otherPlugin = Exiled.Loader.Loader.Plugins.FirstOrDefault(plugin => plugin.Name == "BlackOutNDoors"); if (otherPlugin != null) { + if (otherPlugin is BlackoutKruacent.MainPlugin blackout) { Log.Info("Found BlackOutNDoors"); diff --git a/KruacentE.GlobalEventFramework.Examples/KruacentE.GlobalEventFramework.Examples.csproj b/KruacentE.GlobalEventFramework.Examples/KruacentE.GlobalEventFramework.Examples.csproj new file mode 100644 index 00000000..46557783 --- /dev/null +++ b/KruacentE.GlobalEventFramework.Examples/KruacentE.GlobalEventFramework.Examples.csproj @@ -0,0 +1,29 @@ + + + + net48 + + + + + + + + + C:\Program Files (x86)\Steam\steamapps\common\SCP Secret Laboratory Dedicated Server\SCPSL_Data\Managed\Assembly-CSharp-firstpass.dll + + + ..\KruacentE.BlackoutNDoor\bin\Debug\net48\BlackoutKruacent.dll + + + ..\KruacentE.GlobalEventFramework\bin\Debug\net48\KruacentE.GlobalEventFramework.dll + + + C:\Program Files (x86)\Steam\steamapps\common\SCP Secret Laboratory Dedicated Server\SCPSL_Data\Managed\UnityEngine.dll + + + C:\Program Files (x86)\Steam\steamapps\common\SCP Secret Laboratory Dedicated Server\SCPSL_Data\Managed\UnityEngine.CoreModule.dll + + + + diff --git a/KruacentE.GlobalEventFramework/GEFExiled.sln b/KruacentE.GlobalEventFramework.Examples/KruacentE.GlobalEventFramework.Examples.sln similarity index 50% rename from KruacentE.GlobalEventFramework/GEFExiled.sln rename to KruacentE.GlobalEventFramework.Examples/KruacentE.GlobalEventFramework.Examples.sln index d4cc1296..7b1656cf 100644 --- a/KruacentE.GlobalEventFramework/GEFExiled.sln +++ b/KruacentE.GlobalEventFramework.Examples/KruacentE.GlobalEventFramework.Examples.sln @@ -1,9 +1,9 @@  Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio Version 17 -VisualStudioVersion = 17.11.35222.181 +VisualStudioVersion = 17.12.35506.116 d17.12 MinimumVisualStudioVersion = 10.0.40219.1 -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "GEFExiled", "GEFExiled.csproj", "{C3D1358D-F7B6-48A0-8344-3917D6572980}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "KruacentE.GlobalEventFramework.Examples", "KruacentE.GlobalEventFramework.Examples.csproj", "{B8D70A5A-64B6-4ADB-A9C8-100E251704C4}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -11,15 +11,12 @@ Global Release|Any CPU = Release|Any CPU EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution - {C3D1358D-F7B6-48A0-8344-3917D6572980}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {C3D1358D-F7B6-48A0-8344-3917D6572980}.Debug|Any CPU.Build.0 = Debug|Any CPU - {C3D1358D-F7B6-48A0-8344-3917D6572980}.Release|Any CPU.ActiveCfg = Release|Any CPU - {C3D1358D-F7B6-48A0-8344-3917D6572980}.Release|Any CPU.Build.0 = Release|Any CPU + {B8D70A5A-64B6-4ADB-A9C8-100E251704C4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {B8D70A5A-64B6-4ADB-A9C8-100E251704C4}.Debug|Any CPU.Build.0 = Debug|Any CPU + {B8D70A5A-64B6-4ADB-A9C8-100E251704C4}.Release|Any CPU.ActiveCfg = Release|Any CPU + {B8D70A5A-64B6-4ADB-A9C8-100E251704C4}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection - GlobalSection(ExtensibilityGlobals) = postSolution - SolutionGuid = {42FD0DA0-321B-4DCB-BD21-C300DD7D64A3} - EndGlobalSection EndGlobal diff --git a/KruacentE.GlobalEventFramework.Examples/MainPlugin.cs b/KruacentE.GlobalEventFramework.Examples/MainPlugin.cs new file mode 100644 index 00000000..0cfcb44b --- /dev/null +++ b/KruacentE.GlobalEventFramework.Examples/MainPlugin.cs @@ -0,0 +1,23 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Exiled.API.Features; + +namespace GEFE.Examples +{ + internal class MainPlugin : Plugin + { + public override string Name => "GlobalEventExample"; + public override void OnEnabled() + { + + } + + public override void OnDisabled() + { + + } + } +} diff --git a/KruacentE.GlobalEventFramework/Config.cs b/KruacentE.GlobalEventFramework/Config.cs index 8ac73e5b..f556b2c9 100644 --- a/KruacentE.GlobalEventFramework/Config.cs +++ b/KruacentE.GlobalEventFramework/Config.cs @@ -1,21 +1,21 @@ using Exiled.API.Interfaces; +using Exiled.Events.Commands.PluginManager; using System; using System.Collections.Generic; +using System.ComponentModel; using System.Linq; using System.Text; using System.Threading.Tasks; -namespace GEFExiled +namespace KruacentE.GlobalEventFramework { internal class Config : IConfig { public bool IsEnabled { get; set; } = true; public bool Debug { get; set; } = true; - - - - + [Description("Show the log when the plugin is registering global event (require Debug to be true)")] + public bool ShowRegisteringLog { get; set; } = false; } } diff --git a/KruacentE.GlobalEventFramework/GEFE/API/Features/GlobalEvent.cs b/KruacentE.GlobalEventFramework/GEFE/API/Features/GlobalEvent.cs index 0819f553..2ac05876 100644 --- a/KruacentE.GlobalEventFramework/GEFE/API/Features/GlobalEvent.cs +++ b/KruacentE.GlobalEventFramework/GEFE/API/Features/GlobalEvent.cs @@ -2,7 +2,7 @@ using System.Collections.Generic; using System.Linq; using MEC; -using GEFExiled.GEFE.API.Interfaces; +using KruacentE.GlobalEventFramework.GEFE.API.Interfaces; using Exiled.CustomItems.API.Features; using System.Reflection; using Exiled.API.Features.Attributes; @@ -12,7 +12,7 @@ using Exiled.API.Extensions; using Exiled.API.Features.Pools; -namespace GEFExiled.GEFE.API.Features +namespace KruacentE.GlobalEventFramework.GEFE.API.Features { public class GlobalEvent : IGlobalEvent { @@ -27,7 +27,6 @@ public class GlobalEvent : IGlobalEvent /// A list of all registered GlobalEvents /// public static List GlobalEventsList => GlobalEvents.Values.ToList(); - public static HashSet Registered { get; } = new HashSet(); /// public virtual int Id { get; set; } = -1; /// @@ -39,7 +38,7 @@ public class GlobalEvent : IGlobalEvent public static void Register(IGlobalEvent globalEvent) { - Log.Debug($"REGISTERING {globalEvent.Name}"); + Log.Send($"REGISTERING {globalEvent.Name}", Discord.LogLevel.Info, ConsoleColor.Blue); if (GlobalEvents.ContainsKey(globalEvent.Id)) { Log.Warn($"id already used for {GlobalEvents.TryGetValue(globalEvent.Id, out IGlobalEvent geAlready)}"); diff --git a/KruacentE.GlobalEventFramework/GEFE/API/Features/Loader.cs b/KruacentE.GlobalEventFramework/GEFE/API/Features/Loader.cs new file mode 100644 index 00000000..30ea4501 --- /dev/null +++ b/KruacentE.GlobalEventFramework/GEFE/API/Features/Loader.cs @@ -0,0 +1,47 @@ +using Exiled.API.Features; +using Exiled.API.Interfaces; +using KruacentE.GlobalEventFramework.GEFE.API.Interfaces; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace KruacentE.GlobalEventFramework.GEFE.API.Features +{ + internal class Loader + { + internal List> ActivePlugins => new List>(); + internal static Loader Instance { get; private set; } = new Loader(); + + private Loader() { } + internal void Load() + { + foreach (IPlugin plugin in Exiled.Loader.Loader.Plugins.Where(pl => pl.Name != MainPlugin.Instance.Name)) + { + Log.Debug($"checking {plugin.Name}"); + foreach (Type type in plugin.Assembly.GetTypes()) + { + try + { + Log.Debug($" checking {type.Name}"); + if (type.IsSubclassOf(typeof(IGlobalEvent)) || type.IsSubclassOf(typeof(GlobalEvent))) + { + Log.Debug("good"); + ActivePlugins.Add(plugin); + + Log.Debug("creating instance"); + IGlobalEvent ge = Activator.CreateInstance(type) as IGlobalEvent; + Log.Debug("registering"); + GlobalEvent.Register(ge); + Log.Debug("end register"); + } + }catch(System.Exception e) + { + Log.Error($"Error registering in plugin {plugin.Name} : {e.Message}"); + } + } + } + } + } +} diff --git a/KruacentE.GlobalEventFramework/GEFE/API/Interfaces/IGlobalEvent.cs b/KruacentE.GlobalEventFramework/GEFE/API/Interfaces/IGlobalEvent.cs index 25a25411..3b049198 100644 --- a/KruacentE.GlobalEventFramework/GEFE/API/Interfaces/IGlobalEvent.cs +++ b/KruacentE.GlobalEventFramework/GEFE/API/Interfaces/IGlobalEvent.cs @@ -5,7 +5,7 @@ using System.Threading.Tasks; using MEC; -namespace GEFExiled.GEFE.API.Interfaces +namespace KruacentE.GlobalEventFramework.GEFE.API.Interfaces { public interface IGlobalEvent { diff --git a/KruacentE.GlobalEventFramework/GEFE/API/Utils/Coroutine.cs b/KruacentE.GlobalEventFramework/GEFE/API/Utils/Coroutine.cs index 12caa0fe..f79b8896 100644 --- a/KruacentE.GlobalEventFramework/GEFE/API/Utils/Coroutine.cs +++ b/KruacentE.GlobalEventFramework/GEFE/API/Utils/Coroutine.cs @@ -1,7 +1,7 @@ using MEC; using System.Collections.Generic; -namespace GEFExiled.GEFE.API.Utils +namespace KruacentE.GlobalEventFramework.GEFE.API.Utils { public static class Coroutine { diff --git a/KruacentE.GlobalEventFramework/GEFE/Commands/List.cs b/KruacentE.GlobalEventFramework/GEFE/Commands/List.cs index 06c235b1..90678852 100644 --- a/KruacentE.GlobalEventFramework/GEFE/Commands/List.cs +++ b/KruacentE.GlobalEventFramework/GEFE/Commands/List.cs @@ -1,11 +1,11 @@ -namespace GEFExiled.GEFE.Commands +namespace KruacentE.GlobalEventFramework.GEFE.Commands { using Exiled.API.Features; using Exiled.API.Features.Pickups; using System; using CommandSystem; using System.Runtime.InteropServices.WindowsRuntime; - using GEFE.API.Interfaces; + using KruacentE.GlobalEventFramework.GEFE.API.Interfaces; using GEFE.API.Features; public class List : ICommand diff --git a/KruacentE.GlobalEventFramework/GEFE/Commands/ParentCommandGEFE.cs b/KruacentE.GlobalEventFramework/GEFE/Commands/ParentCommandGEFE.cs index d1f54b37..2da2c580 100644 --- a/KruacentE.GlobalEventFramework/GEFE/Commands/ParentCommandGEFE.cs +++ b/KruacentE.GlobalEventFramework/GEFE/Commands/ParentCommandGEFE.cs @@ -1,5 +1,5 @@ -namespace GEFExiled.GEFE.Commands +namespace KruacentE.GlobalEventFramework.GEFE.Commands { using CommandSystem; using System; @@ -22,7 +22,7 @@ public override void LoadGeneratedCommands() protected override bool ExecuteParent(ArraySegment arguments, ICommandSender sender, out string response) { - if(arguments.Count() == 0){ + if(arguments.Count == 0){ response = "subcommand available : list"; return true; } diff --git a/KruacentE.GlobalEventFramework/GEFE/Exception/GlobalEventNullException.cs b/KruacentE.GlobalEventFramework/GEFE/Exception/GlobalEventNullException.cs index b0ed864a..3341affe 100644 --- a/KruacentE.GlobalEventFramework/GEFE/Exception/GlobalEventNullException.cs +++ b/KruacentE.GlobalEventFramework/GEFE/Exception/GlobalEventNullException.cs @@ -3,7 +3,7 @@ using System.Linq; using System.Text; using System.Threading.Tasks; -namespace GEFExiled.Exception +namespace KruacentE.GlobalEventFramework.GEFE.Exception { public class GlobalEventNullException : ArgumentException { diff --git a/KruacentE.GlobalEventFramework/GEFE/Handlers/ServerHandler.cs b/KruacentE.GlobalEventFramework/GEFE/Handlers/ServerHandler.cs index f5cc05a2..ae181d73 100644 --- a/KruacentE.GlobalEventFramework/GEFE/Handlers/ServerHandler.cs +++ b/KruacentE.GlobalEventFramework/GEFE/Handlers/ServerHandler.cs @@ -1,10 +1,10 @@ using Exiled.API.Features; using Exiled.Events.EventArgs.Server; using System.Collections.Generic; -using GEFExiled.GEFE.API.Interfaces; +using KruacentE.GlobalEventFramework.GEFE.API.Interfaces; +using KruacentE.GlobalEventFramework.GEFE.API.Features; - -namespace GEFExiled.Handlers +namespace KruacentE.GlobalEventFramework.GEFE.Handlers { internal class ServerHandler { diff --git a/KruacentE.GlobalEventFramework/GEFExiled.csproj b/KruacentE.GlobalEventFramework/GEFExiled.csproj deleted file mode 100644 index 0bbf5821..00000000 --- a/KruacentE.GlobalEventFramework/GEFExiled.csproj +++ /dev/null @@ -1,33 +0,0 @@ - - - - net48 - - - - - - - - - ../lib/Assembly-CSharp-firstpass.dll - - - ..\KruacentE.BlackoutNDoor\bin\Debug\net48\BlackoutKruacent.dll - - - ../lib/Mirror.dll - - - ../lib/UnityEngine.dll - - - ../lib/UnityEngine.CoreModule.dll - - - - - - - - diff --git a/KruacentE.GlobalEventFramework/KruacentE.GlobalEventFramework.csproj b/KruacentE.GlobalEventFramework/KruacentE.GlobalEventFramework.csproj new file mode 100644 index 00000000..7fc010ea --- /dev/null +++ b/KruacentE.GlobalEventFramework/KruacentE.GlobalEventFramework.csproj @@ -0,0 +1,23 @@ + + + + net48 + + + + + + + + + C:\Program Files (x86)\Steam\steamapps\common\SCP Secret Laboratory Dedicated Server\SCPSL_Data\Managed\Assembly-CSharp-firstpass.dll + + + C:\Program Files (x86)\Steam\steamapps\common\SCP Secret Laboratory Dedicated Server\SCPSL_Data\Managed\UnityEngine.dll + + + C:\Program Files (x86)\Steam\steamapps\common\SCP Secret Laboratory Dedicated Server\SCPSL_Data\Managed\UnityEngine.CoreModule.dll + + + + diff --git a/KruacentE.GlobalEventFramework/KruacentE.GlobalEventFramework.sln b/KruacentE.GlobalEventFramework/KruacentE.GlobalEventFramework.sln new file mode 100644 index 00000000..3cd8362e --- /dev/null +++ b/KruacentE.GlobalEventFramework/KruacentE.GlobalEventFramework.sln @@ -0,0 +1,22 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.12.35506.116 d17.12 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "KruacentE.GlobalEventFramework", "KruacentE.GlobalEventFramework.csproj", "{B6205BF7-B38B-4473-805D-88168E2BCCE3}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {B6205BF7-B38B-4473-805D-88168E2BCCE3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {B6205BF7-B38B-4473-805D-88168E2BCCE3}.Debug|Any CPU.Build.0 = Debug|Any CPU + {B6205BF7-B38B-4473-805D-88168E2BCCE3}.Release|Any CPU.ActiveCfg = Release|Any CPU + {B6205BF7-B38B-4473-805D-88168E2BCCE3}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/KruacentE.GlobalEventFramework/MainPlugin.cs b/KruacentE.GlobalEventFramework/MainPlugin.cs index 940faab7..1d3e2980 100644 --- a/KruacentE.GlobalEventFramework/MainPlugin.cs +++ b/KruacentE.GlobalEventFramework/MainPlugin.cs @@ -5,17 +5,16 @@ using MEC; using Exiled.API.Enums; using Player = Exiled.API.Features.Player; -using GEFExiled.GEFE.API.Features; -using GEFExiled.GEFE.API.Interfaces; -using GEFExiled.GEFE.Examples.GE; +using KruacentE.GlobalEventFramework.GEFE.API.Features; +using KruacentE.GlobalEventFramework.GEFE.API.Interfaces; using ServerHandler = Exiled.Events.Handlers.Server; -namespace GEFExiled +namespace KruacentE.GlobalEventFramework { internal class MainPlugin : Plugin { public override PluginPriority Priority => PluginPriority.Highest; - internal Handlers.ServerHandler _server; + internal GEFE.Handlers.ServerHandler _server; internal static MainPlugin Instance {get;private set;} @@ -23,8 +22,9 @@ public override void OnEnabled() { Instance = this; - List globalEvents = new List() { new Shuffle(), new Speed(), new SystemMalfunction(), new RandomSpawn(), new R(), new Blitz(), new KIWIS(), new Impostor() }; - GlobalEvent.Register(globalEvents); + Loader.Instance.Load(); + + RegisterEvents(); @@ -41,7 +41,8 @@ public override void OnDisabled() private void RegisterEvents() { - _server = new Handlers.ServerHandler(this); + _server = new GEFE.Handlers.ServerHandler(this); + ServerHandler.WaitingForPlayers += _server.OnWaitingForPlayers; ServerHandler.RoundStarted += _server.OnRoundStarted; From 39e1ceac40eb2ceadd8a1e11d47148aa8d55caba Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Sat, 28 Dec 2024 17:22:53 +0100 Subject: [PATCH 063/853] Added a contribute guide --- KruacentExiled/contribute.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/KruacentExiled/contribute.md b/KruacentExiled/contribute.md index e69de29b..ad76e490 100644 --- a/KruacentExiled/contribute.md +++ b/KruacentExiled/contribute.md @@ -0,0 +1,3 @@ +# How to contribute + +[Like EXILED](https://github.com/ExMod-Team/EXILED/blob/15ffcc69ced413b72c1f702944fee6f524ad6de2/EXILED/docs/articles/contributing/index.md) \ No newline at end of file From 3f879ba4209ac9065faaa9793382c83b89bfbb3c Mon Sep 17 00:00:00 2001 From: Patrique <62960454+Patrique29@users.noreply.github.com> Date: Sat, 28 Dec 2024 17:54:17 +0100 Subject: [PATCH 064/853] Changed LICENSE changed to the gpl because of the uncomplicated custom role loader --- LICENSE | 674 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 674 insertions(+) create mode 100644 LICENSE diff --git a/LICENSE b/LICENSE new file mode 100644 index 00000000..f288702d --- /dev/null +++ b/LICENSE @@ -0,0 +1,674 @@ + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + Copyright (C) + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +. + + The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +. From 331b07e2ed80790e152af20edc5cf097b4aa12bf Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Sun, 29 Dec 2024 00:27:03 +0100 Subject: [PATCH 065/853] Updated the global events Corrected the custom items --- .../KE.BlackoutNDoor/KE.BlackoutNDoor.csproj | 2 +- .../Config.cs | 15 +++++ .../GE/Blitz.cs | 5 +- .../GE/Impostor.cs | 4 +- .../GE/KIWIS.cs | 4 +- .../GE/OpenBar.cs | 6 +- .../GE/R.cs | 4 +- .../GE/RandomSpawn.cs | 4 +- .../GE/Shuffle.cs | 6 +- .../GE/Speed.cs | 4 +- .../GE/SystemMalfunction.cs | 17 ++---- .../KE.GlobalEventFramework.Examples.csproj | 22 +++++++ .../MainPlugin.cs | 23 ++++++++ .../KE.GlobalEventFramework/Config.cs | 10 ++-- .../GEFE.Examples/GE/BlackoutAgain.cs | 58 ------------------- .../GEFE/API/Features/GlobalEvent.cs | 7 +-- .../GEFE/API/Features/Loader.cs | 47 +++++++++++++++ .../GEFE/API/Interfaces/IGlobalEvent.cs | 2 +- .../GEFE/API/Utils/Coroutine.cs | 2 +- .../GEFE/Commands/List.cs | 4 +- .../GEFE/Commands/ParentCommandGEFE.cs | 4 +- .../Exception/GlobalEventNullException.cs | 2 +- .../GEFE/Handlers/ServerHandler.cs | 7 +-- .../KE.GlobalEventFramework.csproj | 13 ++--- .../KE.GlobalEventFramework/MainPlugin.cs | 17 +++--- KruacentExiled/KE.Items/Items/TPGrenada.cs | 5 -- KruacentExiled/KE.Items/KE.Items.csproj | 6 +- KruacentExiled/KE.Misc/KE.Misc.csproj | 2 +- KruacentExiled/KruacentExiled.sln | 18 ++++-- 29 files changed, 178 insertions(+), 142 deletions(-) create mode 100644 KruacentExiled/KE.GlobalEventFramework.Examples/Config.cs rename KruacentExiled/{KE.GlobalEventFramework/GEFE.Examples => KE.GlobalEventFramework.Examples}/GE/Blitz.cs (92%) rename KruacentExiled/{KE.GlobalEventFramework/GEFE.Examples => KE.GlobalEventFramework.Examples}/GE/Impostor.cs (95%) rename KruacentExiled/{KE.GlobalEventFramework/GEFE.Examples => KE.GlobalEventFramework.Examples}/GE/KIWIS.cs (93%) rename KruacentExiled/{KE.GlobalEventFramework/GEFE.Examples => KE.GlobalEventFramework.Examples}/GE/OpenBar.cs (81%) rename KruacentExiled/{KE.GlobalEventFramework/GEFE.Examples => KE.GlobalEventFramework.Examples}/GE/R.cs (87%) rename KruacentExiled/{KE.GlobalEventFramework/GEFE.Examples => KE.GlobalEventFramework.Examples}/GE/RandomSpawn.cs (92%) rename KruacentExiled/{KE.GlobalEventFramework/GEFE.Examples => KE.GlobalEventFramework.Examples}/GE/Shuffle.cs (96%) rename KruacentExiled/{KE.GlobalEventFramework/GEFE.Examples => KE.GlobalEventFramework.Examples}/GE/Speed.cs (95%) rename KruacentExiled/{KE.GlobalEventFramework/GEFE.Examples => KE.GlobalEventFramework.Examples}/GE/SystemMalfunction.cs (90%) create mode 100644 KruacentExiled/KE.GlobalEventFramework.Examples/KE.GlobalEventFramework.Examples.csproj create mode 100644 KruacentExiled/KE.GlobalEventFramework.Examples/MainPlugin.cs delete mode 100644 KruacentExiled/KE.GlobalEventFramework/GEFE.Examples/GE/BlackoutAgain.cs create mode 100644 KruacentExiled/KE.GlobalEventFramework/GEFE/API/Features/Loader.cs diff --git a/KruacentExiled/KE.BlackoutNDoor/KE.BlackoutNDoor.csproj b/KruacentExiled/KE.BlackoutNDoor/KE.BlackoutNDoor.csproj index a05e19e5..83006a05 100644 --- a/KruacentExiled/KE.BlackoutNDoor/KE.BlackoutNDoor.csproj +++ b/KruacentExiled/KE.BlackoutNDoor/KE.BlackoutNDoor.csproj @@ -5,7 +5,7 @@ - + diff --git a/KruacentExiled/KE.GlobalEventFramework.Examples/Config.cs b/KruacentExiled/KE.GlobalEventFramework.Examples/Config.cs new file mode 100644 index 00000000..0344484e --- /dev/null +++ b/KruacentExiled/KE.GlobalEventFramework.Examples/Config.cs @@ -0,0 +1,15 @@ +using Exiled.API.Interfaces; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace GEFE.Examples +{ + internal class Config : IConfig + { + public bool IsEnabled { get; set; } = true; + public bool Debug { get; set; } = false; + } +} diff --git a/KruacentExiled/KE.GlobalEventFramework/GEFE.Examples/GE/Blitz.cs b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/Blitz.cs similarity index 92% rename from KruacentExiled/KE.GlobalEventFramework/GEFE.Examples/GE/Blitz.cs rename to KruacentExiled/KE.GlobalEventFramework.Examples/GE/Blitz.cs index 4fd1ebc5..4534e7bb 100644 --- a/KruacentExiled/KE.GlobalEventFramework/GEFE.Examples/GE/Blitz.cs +++ b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/Blitz.cs @@ -1,7 +1,6 @@ using Exiled.API.Features; using Exiled.API.Features.Items; -using GEFExiled.GEFE.API.Features; -using InventorySystem.Items.ThrowableProjectiles; +using KruacentE.GlobalEventFramework.GEFE.API.Features; using MEC; using System; using System.Collections.Generic; @@ -9,7 +8,7 @@ using System.Text; using System.Threading.Tasks; -namespace GEFExiled.GEFE.Examples.GE +namespace KruacentE.GlobalEventFramework.Examples.GE { /// /// Spawn fused grenades in random rooms in the map diff --git a/KruacentExiled/KE.GlobalEventFramework/GEFE.Examples/GE/Impostor.cs b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/Impostor.cs similarity index 95% rename from KruacentExiled/KE.GlobalEventFramework/GEFE.Examples/GE/Impostor.cs rename to KruacentExiled/KE.GlobalEventFramework.Examples/GE/Impostor.cs index 7baf7d88..2e12e9d4 100644 --- a/KruacentExiled/KE.GlobalEventFramework/GEFE.Examples/GE/Impostor.cs +++ b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/Impostor.cs @@ -1,12 +1,12 @@ using Player = Exiled.API.Features.Player; -using GEFExiled.GEFE.API.Features; using System.Collections.Generic; +using KruacentE.GlobalEventFramework.GEFE.API.Features; using MEC; using System.Linq; using Exiled.API.Extensions; using Exiled.API.Features; -namespace GEFExiled.GEFE.Examples.GE +namespace KruacentE.GlobalEventFramework.Examples.GE { public class Impostor : GlobalEvent { diff --git a/KruacentExiled/KE.GlobalEventFramework/GEFE.Examples/GE/KIWIS.cs b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/KIWIS.cs similarity index 93% rename from KruacentExiled/KE.GlobalEventFramework/GEFE.Examples/GE/KIWIS.cs rename to KruacentExiled/KE.GlobalEventFramework.Examples/GE/KIWIS.cs index 0e614e6d..9f844fa1 100644 --- a/KruacentExiled/KE.GlobalEventFramework/GEFE.Examples/GE/KIWIS.cs +++ b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/KIWIS.cs @@ -1,13 +1,13 @@ using Exiled.API.Features; -using GEFExiled.GEFE.API.Features; using MEC; using PlayerRoles; using Utils.NonAllocLINQ; using System.Collections.Generic; using System.Linq; +using KruacentE.GlobalEventFramework.GEFE.API.Features; -namespace GEFExiled.GEFE.Examples.GE +namespace KruacentE.GlobalEventFramework.Examples.GE { /// /// The scp start with 2/3 of it's life and end with 4/3 of it's vanilla life diff --git a/KruacentExiled/KE.GlobalEventFramework/GEFE.Examples/GE/OpenBar.cs b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/OpenBar.cs similarity index 81% rename from KruacentExiled/KE.GlobalEventFramework/GEFE.Examples/GE/OpenBar.cs rename to KruacentExiled/KE.GlobalEventFramework.Examples/GE/OpenBar.cs index 6e66b20f..8a24d171 100644 --- a/KruacentExiled/KE.GlobalEventFramework/GEFE.Examples/GE/OpenBar.cs +++ b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/OpenBar.cs @@ -1,5 +1,5 @@ using Exiled.API.Features.Doors; -using GEFExiled.GEFE.API.Features; +using KruacentE.GlobalEventFramework.GEFE.API.Features; using System; using System.Collections.Generic; using System.Linq; @@ -9,7 +9,7 @@ using Exiled.API.Features; using Exiled.Events.EventArgs.Map; -namespace GEFExiled.GEFE.Examples.GE +namespace KruacentE.GlobalEventFramework.Examples.GE { public class OpenBar : GlobalEvent { @@ -19,7 +19,7 @@ public class OpenBar : GlobalEvent public override int Weight { get; set; } = 1; public override IEnumerator Start() { - var doors = Door.List.Where(d => new[] { DoorType.GateA, DoorType.GateB, DoorType.HczArmory, DoorType.HID,DoorType.Intercom,DoorType.Scp049Armory,DoorType.Scp096,DoorType.Scp106Primary,DoorType.Scp106Secondary,DoorType.Scp330,DoorType.Scp330Chamber,DoorType.Scp914Gate }.Contains(d.Type)).ToList(); + var doors = Door.List.Where(d => new[] { DoorType.GateA, DoorType.GateB, DoorType.HczArmory, DoorType.HIDChamber,DoorType.Intercom,DoorType.Scp049Armory,DoorType.Scp096,DoorType.Scp106Primary,DoorType.Scp106Secondary,DoorType.Scp330,DoorType.Scp330Chamber,DoorType.Scp914Gate }.Contains(d.Type)).ToList(); UnlockAndOpen(doors); yield return 0; diff --git a/KruacentExiled/KE.GlobalEventFramework/GEFE.Examples/GE/R.cs b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/R.cs similarity index 87% rename from KruacentExiled/KE.GlobalEventFramework/GEFE.Examples/GE/R.cs rename to KruacentExiled/KE.GlobalEventFramework.Examples/GE/R.cs index d5929f3a..896eb1da 100644 --- a/KruacentExiled/KE.GlobalEventFramework/GEFE.Examples/GE/R.cs +++ b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/R.cs @@ -1,5 +1,5 @@ using Exiled.API.Features; -using GEFExiled.GEFE.API.Features; +using KruacentE.GlobalEventFramework.GEFE.API.Features; using PlayerRoles; using System; using System.Collections.Generic; @@ -7,7 +7,7 @@ using System.Text; using System.Threading.Tasks; -namespace GEFExiled.GEFE.Examples.GE +namespace KruacentE.GlobalEventFramework.Examples.GE { /// /// Literally does nothing diff --git a/KruacentExiled/KE.GlobalEventFramework/GEFE.Examples/GE/RandomSpawn.cs b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/RandomSpawn.cs similarity index 92% rename from KruacentExiled/KE.GlobalEventFramework/GEFE.Examples/GE/RandomSpawn.cs rename to KruacentExiled/KE.GlobalEventFramework.Examples/GE/RandomSpawn.cs index 64a3a8b7..416fe24d 100644 --- a/KruacentExiled/KE.GlobalEventFramework/GEFE.Examples/GE/RandomSpawn.cs +++ b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/RandomSpawn.cs @@ -1,5 +1,5 @@ using Exiled.API.Features; -using GEFExiled.GEFE.API.Features; +using KruacentE.GlobalEventFramework.GEFE.API.Features; using PlayerRoles; using System; using System.Collections.Generic; @@ -7,7 +7,7 @@ using System.Text; using System.Threading.Tasks; -namespace GEFExiled.GEFE.Examples.GE +namespace KruacentE.GlobalEventFramework.Examples.GE { /// /// All spawn are random at the start of the game (NTF & Chaos not included) diff --git a/KruacentExiled/KE.GlobalEventFramework/GEFE.Examples/GE/Shuffle.cs b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/Shuffle.cs similarity index 96% rename from KruacentExiled/KE.GlobalEventFramework/GEFE.Examples/GE/Shuffle.cs rename to KruacentExiled/KE.GlobalEventFramework.Examples/GE/Shuffle.cs index 3dc2bb72..07028ea2 100644 --- a/KruacentExiled/KE.GlobalEventFramework/GEFE.Examples/GE/Shuffle.cs +++ b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/Shuffle.cs @@ -1,6 +1,6 @@ using Exiled.API.Features; using MEC; -using GEFExiled.GEFE.API.Features; +using KruacentE.GlobalEventFramework.GEFE.API.Features; using PlayerHandler = Exiled.Events.Handlers.Player; using Exiled.Events.EventArgs.Player; using UnityEngine; @@ -8,7 +8,7 @@ using System.Linq; -namespace GEFExiled.GEFE.Examples.GE +namespace KruacentE.GlobalEventFramework.Examples.GE { /// /// Every some amount of time all player take the position of another @@ -65,7 +65,7 @@ public override IEnumerator Start() Log.Debug($"cleared"); } } - / // + /// public override void SubscribeEvent() { PlayerHandler.Joined += OnJoined; diff --git a/KruacentExiled/KE.GlobalEventFramework/GEFE.Examples/GE/Speed.cs b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/Speed.cs similarity index 95% rename from KruacentExiled/KE.GlobalEventFramework/GEFE.Examples/GE/Speed.cs rename to KruacentExiled/KE.GlobalEventFramework.Examples/GE/Speed.cs index 108d278e..7c900775 100644 --- a/KruacentExiled/KE.GlobalEventFramework/GEFE.Examples/GE/Speed.cs +++ b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/Speed.cs @@ -3,7 +3,7 @@ using Exiled.API.Features; using Exiled.Events.EventArgs.Player; using Exiled.Events.EventArgs.Scp173; -using GEFExiled.GEFE.API.Features; +using KruacentE.GlobalEventFramework.GEFE.API.Features; using MEC; using System; using System.Collections.Generic; @@ -12,7 +12,7 @@ using Utils.NonAllocLINQ; using PlayerHandler = Exiled.Events.Handlers.Player; -namespace GEFExiled.GEFE.Examples.GE +namespace KruacentE.GlobalEventFramework.Examples.GE { /// /// Everyone has a movement boost effect (stackable) diff --git a/KruacentExiled/KE.GlobalEventFramework/GEFE.Examples/GE/SystemMalfunction.cs b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/SystemMalfunction.cs similarity index 90% rename from KruacentExiled/KE.GlobalEventFramework/GEFE.Examples/GE/SystemMalfunction.cs rename to KruacentExiled/KE.GlobalEventFramework.Examples/GE/SystemMalfunction.cs index 8cf0c371..f89e62ec 100644 --- a/KruacentExiled/KE.GlobalEventFramework/GEFE.Examples/GE/SystemMalfunction.cs +++ b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/SystemMalfunction.cs @@ -1,21 +1,15 @@ -using BlackoutKruacent; -using Exiled.API.Features; +using Exiled.API.Features; using Exiled.API.Features.Doors; -using Exiled.Events.Commands.Reload; -using Exiled.Loader; -using GEFExiled.GEFE.API.Features; -using GEFExiled.GEFE.API.Utils; +using KruacentE.GlobalEventFramework.GEFE.API.Features; +using KruacentE.GlobalEventFramework.GEFE.API.Utils; using MEC; -using System; using System.Collections.Generic; using System.Linq; -using System.Text; -using System.Threading.Tasks; using Interactables.Interobjects.DoorUtils; using Exiled.API.Enums; using Exiled.API.Extensions; -namespace GEFExiled.GEFE.Examples.GE +namespace KruacentE.GlobalEventFramework.Examples.GE { /// /// The original @@ -69,9 +63,10 @@ private IEnumerator EarlyNuke() private void MoreBlackOutNDoors() { - var otherPlugin = Loader.Plugins.FirstOrDefault(plugin => plugin.Name == "BlackOutNDoors"); + var otherPlugin = Exiled.Loader.Loader.Plugins.FirstOrDefault(plugin => plugin.Name == "BlackOutNDoors"); if (otherPlugin != null) { + if (otherPlugin is BlackoutKruacent.MainPlugin blackout) { Log.Info("Found BlackOutNDoors"); diff --git a/KruacentExiled/KE.GlobalEventFramework.Examples/KE.GlobalEventFramework.Examples.csproj b/KruacentExiled/KE.GlobalEventFramework.Examples/KE.GlobalEventFramework.Examples.csproj new file mode 100644 index 00000000..fec6f9e1 --- /dev/null +++ b/KruacentExiled/KE.GlobalEventFramework.Examples/KE.GlobalEventFramework.Examples.csproj @@ -0,0 +1,22 @@ + + + + net48 + + + + + + + + + + + + + + + + + + diff --git a/KruacentExiled/KE.GlobalEventFramework.Examples/MainPlugin.cs b/KruacentExiled/KE.GlobalEventFramework.Examples/MainPlugin.cs new file mode 100644 index 00000000..0cfcb44b --- /dev/null +++ b/KruacentExiled/KE.GlobalEventFramework.Examples/MainPlugin.cs @@ -0,0 +1,23 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Exiled.API.Features; + +namespace GEFE.Examples +{ + internal class MainPlugin : Plugin + { + public override string Name => "GlobalEventExample"; + public override void OnEnabled() + { + + } + + public override void OnDisabled() + { + + } + } +} diff --git a/KruacentExiled/KE.GlobalEventFramework/Config.cs b/KruacentExiled/KE.GlobalEventFramework/Config.cs index 8ac73e5b..f556b2c9 100644 --- a/KruacentExiled/KE.GlobalEventFramework/Config.cs +++ b/KruacentExiled/KE.GlobalEventFramework/Config.cs @@ -1,21 +1,21 @@ using Exiled.API.Interfaces; +using Exiled.Events.Commands.PluginManager; using System; using System.Collections.Generic; +using System.ComponentModel; using System.Linq; using System.Text; using System.Threading.Tasks; -namespace GEFExiled +namespace KruacentE.GlobalEventFramework { internal class Config : IConfig { public bool IsEnabled { get; set; } = true; public bool Debug { get; set; } = true; - - - - + [Description("Show the log when the plugin is registering global event (require Debug to be true)")] + public bool ShowRegisteringLog { get; set; } = false; } } diff --git a/KruacentExiled/KE.GlobalEventFramework/GEFE.Examples/GE/BlackoutAgain.cs b/KruacentExiled/KE.GlobalEventFramework/GEFE.Examples/GE/BlackoutAgain.cs deleted file mode 100644 index 3d58ae1b..00000000 --- a/KruacentExiled/KE.GlobalEventFramework/GEFE.Examples/GE/BlackoutAgain.cs +++ /dev/null @@ -1,58 +0,0 @@ -using Exiled.API.Features; -using Exiled.Events.EventArgs.Map; -using Exiled.Events.EventArgs.Player; -using GEFExiled.GEFE.API.Features; -using GEFExiled.GEFE.API.Interfaces; -using MEC; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace GEFExiled.GEFE.Examples.GE -{ - public class BlackoutAgain : GlobalEvent - { - public override int Id { get; set; } = 36; - public override string Name { get; set; } = "BlackoutGE"; - public override string Description { get; set; } = "Sortez vos grosse lampe là"; - public override int Weight { get; set; } = 0; - public override IEnumerator Start() - { - Room.List.ToList().ForEach(x => { - x.AreLightsOff = true; - }); - Timing.CallDelayed(1f, () => - { - Player.List.ToList().ForEach(p => - { - p.AddItem(ItemType.Flashlight); - }); - }); - - yield return 0; - } - - - public override void SubscribeEvent() - { - Exiled.Events.Handlers.Map.GeneratorActivating += Gen; - } - - public override void UnsubscribeEvent() - { - Exiled.Events.Handlers.Map.GeneratorActivating -= Gen; - } - - public void Gen(GeneratorActivatingEventArgs ev) - { - if(Generator.List.Where(g => g.IsEngaged).ToList().Count() == 3) - { - Room.List.ToList().ForEach(x => { - x.AreLightsOff = false; - }); - } - } - } -} diff --git a/KruacentExiled/KE.GlobalEventFramework/GEFE/API/Features/GlobalEvent.cs b/KruacentExiled/KE.GlobalEventFramework/GEFE/API/Features/GlobalEvent.cs index 0819f553..2ac05876 100644 --- a/KruacentExiled/KE.GlobalEventFramework/GEFE/API/Features/GlobalEvent.cs +++ b/KruacentExiled/KE.GlobalEventFramework/GEFE/API/Features/GlobalEvent.cs @@ -2,7 +2,7 @@ using System.Collections.Generic; using System.Linq; using MEC; -using GEFExiled.GEFE.API.Interfaces; +using KruacentE.GlobalEventFramework.GEFE.API.Interfaces; using Exiled.CustomItems.API.Features; using System.Reflection; using Exiled.API.Features.Attributes; @@ -12,7 +12,7 @@ using Exiled.API.Extensions; using Exiled.API.Features.Pools; -namespace GEFExiled.GEFE.API.Features +namespace KruacentE.GlobalEventFramework.GEFE.API.Features { public class GlobalEvent : IGlobalEvent { @@ -27,7 +27,6 @@ public class GlobalEvent : IGlobalEvent /// A list of all registered GlobalEvents /// public static List GlobalEventsList => GlobalEvents.Values.ToList(); - public static HashSet Registered { get; } = new HashSet(); /// public virtual int Id { get; set; } = -1; /// @@ -39,7 +38,7 @@ public class GlobalEvent : IGlobalEvent public static void Register(IGlobalEvent globalEvent) { - Log.Debug($"REGISTERING {globalEvent.Name}"); + Log.Send($"REGISTERING {globalEvent.Name}", Discord.LogLevel.Info, ConsoleColor.Blue); if (GlobalEvents.ContainsKey(globalEvent.Id)) { Log.Warn($"id already used for {GlobalEvents.TryGetValue(globalEvent.Id, out IGlobalEvent geAlready)}"); diff --git a/KruacentExiled/KE.GlobalEventFramework/GEFE/API/Features/Loader.cs b/KruacentExiled/KE.GlobalEventFramework/GEFE/API/Features/Loader.cs new file mode 100644 index 00000000..30ea4501 --- /dev/null +++ b/KruacentExiled/KE.GlobalEventFramework/GEFE/API/Features/Loader.cs @@ -0,0 +1,47 @@ +using Exiled.API.Features; +using Exiled.API.Interfaces; +using KruacentE.GlobalEventFramework.GEFE.API.Interfaces; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace KruacentE.GlobalEventFramework.GEFE.API.Features +{ + internal class Loader + { + internal List> ActivePlugins => new List>(); + internal static Loader Instance { get; private set; } = new Loader(); + + private Loader() { } + internal void Load() + { + foreach (IPlugin plugin in Exiled.Loader.Loader.Plugins.Where(pl => pl.Name != MainPlugin.Instance.Name)) + { + Log.Debug($"checking {plugin.Name}"); + foreach (Type type in plugin.Assembly.GetTypes()) + { + try + { + Log.Debug($" checking {type.Name}"); + if (type.IsSubclassOf(typeof(IGlobalEvent)) || type.IsSubclassOf(typeof(GlobalEvent))) + { + Log.Debug("good"); + ActivePlugins.Add(plugin); + + Log.Debug("creating instance"); + IGlobalEvent ge = Activator.CreateInstance(type) as IGlobalEvent; + Log.Debug("registering"); + GlobalEvent.Register(ge); + Log.Debug("end register"); + } + }catch(System.Exception e) + { + Log.Error($"Error registering in plugin {plugin.Name} : {e.Message}"); + } + } + } + } + } +} diff --git a/KruacentExiled/KE.GlobalEventFramework/GEFE/API/Interfaces/IGlobalEvent.cs b/KruacentExiled/KE.GlobalEventFramework/GEFE/API/Interfaces/IGlobalEvent.cs index 25a25411..3b049198 100644 --- a/KruacentExiled/KE.GlobalEventFramework/GEFE/API/Interfaces/IGlobalEvent.cs +++ b/KruacentExiled/KE.GlobalEventFramework/GEFE/API/Interfaces/IGlobalEvent.cs @@ -5,7 +5,7 @@ using System.Threading.Tasks; using MEC; -namespace GEFExiled.GEFE.API.Interfaces +namespace KruacentE.GlobalEventFramework.GEFE.API.Interfaces { public interface IGlobalEvent { diff --git a/KruacentExiled/KE.GlobalEventFramework/GEFE/API/Utils/Coroutine.cs b/KruacentExiled/KE.GlobalEventFramework/GEFE/API/Utils/Coroutine.cs index 12caa0fe..f79b8896 100644 --- a/KruacentExiled/KE.GlobalEventFramework/GEFE/API/Utils/Coroutine.cs +++ b/KruacentExiled/KE.GlobalEventFramework/GEFE/API/Utils/Coroutine.cs @@ -1,7 +1,7 @@ using MEC; using System.Collections.Generic; -namespace GEFExiled.GEFE.API.Utils +namespace KruacentE.GlobalEventFramework.GEFE.API.Utils { public static class Coroutine { diff --git a/KruacentExiled/KE.GlobalEventFramework/GEFE/Commands/List.cs b/KruacentExiled/KE.GlobalEventFramework/GEFE/Commands/List.cs index 06c235b1..90678852 100644 --- a/KruacentExiled/KE.GlobalEventFramework/GEFE/Commands/List.cs +++ b/KruacentExiled/KE.GlobalEventFramework/GEFE/Commands/List.cs @@ -1,11 +1,11 @@ -namespace GEFExiled.GEFE.Commands +namespace KruacentE.GlobalEventFramework.GEFE.Commands { using Exiled.API.Features; using Exiled.API.Features.Pickups; using System; using CommandSystem; using System.Runtime.InteropServices.WindowsRuntime; - using GEFE.API.Interfaces; + using KruacentE.GlobalEventFramework.GEFE.API.Interfaces; using GEFE.API.Features; public class List : ICommand diff --git a/KruacentExiled/KE.GlobalEventFramework/GEFE/Commands/ParentCommandGEFE.cs b/KruacentExiled/KE.GlobalEventFramework/GEFE/Commands/ParentCommandGEFE.cs index d1f54b37..2da2c580 100644 --- a/KruacentExiled/KE.GlobalEventFramework/GEFE/Commands/ParentCommandGEFE.cs +++ b/KruacentExiled/KE.GlobalEventFramework/GEFE/Commands/ParentCommandGEFE.cs @@ -1,5 +1,5 @@ -namespace GEFExiled.GEFE.Commands +namespace KruacentE.GlobalEventFramework.GEFE.Commands { using CommandSystem; using System; @@ -22,7 +22,7 @@ public override void LoadGeneratedCommands() protected override bool ExecuteParent(ArraySegment arguments, ICommandSender sender, out string response) { - if(arguments.Count() == 0){ + if(arguments.Count == 0){ response = "subcommand available : list"; return true; } diff --git a/KruacentExiled/KE.GlobalEventFramework/GEFE/Exception/GlobalEventNullException.cs b/KruacentExiled/KE.GlobalEventFramework/GEFE/Exception/GlobalEventNullException.cs index b0ed864a..3341affe 100644 --- a/KruacentExiled/KE.GlobalEventFramework/GEFE/Exception/GlobalEventNullException.cs +++ b/KruacentExiled/KE.GlobalEventFramework/GEFE/Exception/GlobalEventNullException.cs @@ -3,7 +3,7 @@ using System.Linq; using System.Text; using System.Threading.Tasks; -namespace GEFExiled.Exception +namespace KruacentE.GlobalEventFramework.GEFE.Exception { public class GlobalEventNullException : ArgumentException { diff --git a/KruacentExiled/KE.GlobalEventFramework/GEFE/Handlers/ServerHandler.cs b/KruacentExiled/KE.GlobalEventFramework/GEFE/Handlers/ServerHandler.cs index 76521268..ae181d73 100644 --- a/KruacentExiled/KE.GlobalEventFramework/GEFE/Handlers/ServerHandler.cs +++ b/KruacentExiled/KE.GlobalEventFramework/GEFE/Handlers/ServerHandler.cs @@ -1,10 +1,10 @@ using Exiled.API.Features; using Exiled.Events.EventArgs.Server; using System.Collections.Generic; -using GEFExiled.GEFE.API.Interfaces; +using KruacentE.GlobalEventFramework.GEFE.API.Interfaces; +using KruacentE.GlobalEventFramework.GEFE.API.Features; - -namespace GEFExiled.Handlers +namespace KruacentE.GlobalEventFramework.GEFE.Handlers { internal class ServerHandler { @@ -28,7 +28,6 @@ public void OnRoundStarted() public void OnWaitingForPlayers() { - GlobalEvent.StopCoroutines(); } diff --git a/KruacentExiled/KE.GlobalEventFramework/KE.GlobalEventFramework.csproj b/KruacentExiled/KE.GlobalEventFramework/KE.GlobalEventFramework.csproj index 72036be4..8031db85 100644 --- a/KruacentExiled/KE.GlobalEventFramework/KE.GlobalEventFramework.csproj +++ b/KruacentExiled/KE.GlobalEventFramework/KE.GlobalEventFramework.csproj @@ -5,18 +5,13 @@ - + - - - - - - - - + + + diff --git a/KruacentExiled/KE.GlobalEventFramework/MainPlugin.cs b/KruacentExiled/KE.GlobalEventFramework/MainPlugin.cs index 940faab7..1d3e2980 100644 --- a/KruacentExiled/KE.GlobalEventFramework/MainPlugin.cs +++ b/KruacentExiled/KE.GlobalEventFramework/MainPlugin.cs @@ -5,17 +5,16 @@ using MEC; using Exiled.API.Enums; using Player = Exiled.API.Features.Player; -using GEFExiled.GEFE.API.Features; -using GEFExiled.GEFE.API.Interfaces; -using GEFExiled.GEFE.Examples.GE; +using KruacentE.GlobalEventFramework.GEFE.API.Features; +using KruacentE.GlobalEventFramework.GEFE.API.Interfaces; using ServerHandler = Exiled.Events.Handlers.Server; -namespace GEFExiled +namespace KruacentE.GlobalEventFramework { internal class MainPlugin : Plugin { public override PluginPriority Priority => PluginPriority.Highest; - internal Handlers.ServerHandler _server; + internal GEFE.Handlers.ServerHandler _server; internal static MainPlugin Instance {get;private set;} @@ -23,8 +22,9 @@ public override void OnEnabled() { Instance = this; - List globalEvents = new List() { new Shuffle(), new Speed(), new SystemMalfunction(), new RandomSpawn(), new R(), new Blitz(), new KIWIS(), new Impostor() }; - GlobalEvent.Register(globalEvents); + Loader.Instance.Load(); + + RegisterEvents(); @@ -41,7 +41,8 @@ public override void OnDisabled() private void RegisterEvents() { - _server = new Handlers.ServerHandler(this); + _server = new GEFE.Handlers.ServerHandler(this); + ServerHandler.WaitingForPlayers += _server.OnWaitingForPlayers; ServerHandler.RoundStarted += _server.OnRoundStarted; diff --git a/KruacentExiled/KE.Items/Items/TPGrenada.cs b/KruacentExiled/KE.Items/Items/TPGrenada.cs index 34814ec7..9f9baa51 100644 --- a/KruacentExiled/KE.Items/Items/TPGrenada.cs +++ b/KruacentExiled/KE.Items/Items/TPGrenada.cs @@ -30,11 +30,6 @@ public class TPGrenada : CustomGrenade Limit = 5, DynamicSpawnPoints = new List { - new DynamicSpawnPoint() - { - Chance = 50, - Location = SpawnLocationType.InsideLocker, - }, new DynamicSpawnPoint() { Chance = 50, diff --git a/KruacentExiled/KE.Items/KE.Items.csproj b/KruacentExiled/KE.Items/KE.Items.csproj index c025b27f..fee0f33f 100644 --- a/KruacentExiled/KE.Items/KE.Items.csproj +++ b/KruacentExiled/KE.Items/KE.Items.csproj @@ -5,14 +5,12 @@ - + - - C:\Users\Patrique\AppData\Roaming\EXILED\Plugins\Exiled.CustomItems.dll - + diff --git a/KruacentExiled/KE.Misc/KE.Misc.csproj b/KruacentExiled/KE.Misc/KE.Misc.csproj index 6f03b2d8..452d5c70 100644 --- a/KruacentExiled/KE.Misc/KE.Misc.csproj +++ b/KruacentExiled/KE.Misc/KE.Misc.csproj @@ -5,7 +5,7 @@ - + diff --git a/KruacentExiled/KruacentExiled.sln b/KruacentExiled/KruacentExiled.sln index 66706ce5..135e1e35 100644 --- a/KruacentExiled/KruacentExiled.sln +++ b/KruacentExiled/KruacentExiled.sln @@ -7,10 +7,12 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "KE.Items", "KE.Items\KE.Ite EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "KE.Misc", "KE.Misc\KE.Misc.csproj", "{CD822DB2-756E-4887-93AB-2D2F16BF542C}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "KE.GlobalEventFramework", "KE.GlobalEventFramework\KE.GlobalEventFramework.csproj", "{C7F7BECB-7FB1-4484-847D-E6C0A77316BE}" -EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "KE.BlackoutNDoor", "KE.BlackoutNDoor\KE.BlackoutNDoor.csproj", "{C9867742-72DB-4ECA-81BF-104A27A04DB7}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "KE.GlobalEventFramework", "KE.GlobalEventFramework\KE.GlobalEventFramework.csproj", "{73D6C740-96DE-4965-898F-DDD5BCBF7366}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "KE.GlobalEventFramework.Examples", "KE.GlobalEventFramework.Examples\KE.GlobalEventFramework.Examples.csproj", "{07B92E87-F48F-4F9F-BA0E-1BCB2AF52F53}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -25,14 +27,18 @@ Global {CD822DB2-756E-4887-93AB-2D2F16BF542C}.Debug|Any CPU.Build.0 = Debug|Any CPU {CD822DB2-756E-4887-93AB-2D2F16BF542C}.Release|Any CPU.ActiveCfg = Release|Any CPU {CD822DB2-756E-4887-93AB-2D2F16BF542C}.Release|Any CPU.Build.0 = Release|Any CPU - {C7F7BECB-7FB1-4484-847D-E6C0A77316BE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {C7F7BECB-7FB1-4484-847D-E6C0A77316BE}.Debug|Any CPU.Build.0 = Debug|Any CPU - {C7F7BECB-7FB1-4484-847D-E6C0A77316BE}.Release|Any CPU.ActiveCfg = Release|Any CPU - {C7F7BECB-7FB1-4484-847D-E6C0A77316BE}.Release|Any CPU.Build.0 = Release|Any CPU {C9867742-72DB-4ECA-81BF-104A27A04DB7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {C9867742-72DB-4ECA-81BF-104A27A04DB7}.Debug|Any CPU.Build.0 = Debug|Any CPU {C9867742-72DB-4ECA-81BF-104A27A04DB7}.Release|Any CPU.ActiveCfg = Release|Any CPU {C9867742-72DB-4ECA-81BF-104A27A04DB7}.Release|Any CPU.Build.0 = Release|Any CPU + {73D6C740-96DE-4965-898F-DDD5BCBF7366}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {73D6C740-96DE-4965-898F-DDD5BCBF7366}.Debug|Any CPU.Build.0 = Debug|Any CPU + {73D6C740-96DE-4965-898F-DDD5BCBF7366}.Release|Any CPU.ActiveCfg = Release|Any CPU + {73D6C740-96DE-4965-898F-DDD5BCBF7366}.Release|Any CPU.Build.0 = Release|Any CPU + {07B92E87-F48F-4F9F-BA0E-1BCB2AF52F53}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {07B92E87-F48F-4F9F-BA0E-1BCB2AF52F53}.Debug|Any CPU.Build.0 = Debug|Any CPU + {07B92E87-F48F-4F9F-BA0E-1BCB2AF52F53}.Release|Any CPU.ActiveCfg = Release|Any CPU + {07B92E87-F48F-4F9F-BA0E-1BCB2AF52F53}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE From c57cbf22d00b8f5874995514b0ca12c8d5b83c87 Mon Sep 17 00:00:00 2001 From: Patrique <62960454+Patrique29@users.noreply.github.com> Date: Sun, 29 Dec 2024 00:30:20 +0100 Subject: [PATCH 066/853] Delete old LICENSE --- LICENSE.txt | 201 ---------------------------------------------------- 1 file changed, 201 deletions(-) delete mode 100644 LICENSE.txt diff --git a/LICENSE.txt b/LICENSE.txt deleted file mode 100644 index 261eeb9e..00000000 --- a/LICENSE.txt +++ /dev/null @@ -1,201 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. From 531704c71664bba08677a18d5f24f5a5138806ea Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Sun, 29 Dec 2024 15:15:28 +0100 Subject: [PATCH 067/853] corrected the examples --- .../Config.cs | 15 --- .../GE/Blitz.cs | 51 --------- .../GE/Impostor.cs | 70 ------------ .../GE/KIWIS.cs | 54 --------- .../GE/OpenBar.cs | 56 --------- .../GE/R.cs | 32 ------ .../GE/RandomSpawn.cs | 47 -------- .../GE/Shuffle.cs | 107 ------------------ .../GE/Speed.cs | 72 ------------ .../GE/SystemMalfunction.cs | 102 ----------------- ...centE.GlobalEventFramework.Examples.csproj | 29 ----- ...ruacentE.GlobalEventFramework.Examples.sln | 22 ---- .../MainPlugin.cs | 23 ---- .../KruacentE.GlobalEventFramework.csproj | 23 ---- .../KruacentE.GlobalEventFramework.sln | 22 ---- 15 files changed, 725 deletions(-) delete mode 100644 KruacentE.GlobalEventFramework.Examples/Config.cs delete mode 100644 KruacentE.GlobalEventFramework.Examples/GE/Blitz.cs delete mode 100644 KruacentE.GlobalEventFramework.Examples/GE/Impostor.cs delete mode 100644 KruacentE.GlobalEventFramework.Examples/GE/KIWIS.cs delete mode 100644 KruacentE.GlobalEventFramework.Examples/GE/OpenBar.cs delete mode 100644 KruacentE.GlobalEventFramework.Examples/GE/R.cs delete mode 100644 KruacentE.GlobalEventFramework.Examples/GE/RandomSpawn.cs delete mode 100644 KruacentE.GlobalEventFramework.Examples/GE/Shuffle.cs delete mode 100644 KruacentE.GlobalEventFramework.Examples/GE/Speed.cs delete mode 100644 KruacentE.GlobalEventFramework.Examples/GE/SystemMalfunction.cs delete mode 100644 KruacentE.GlobalEventFramework.Examples/KruacentE.GlobalEventFramework.Examples.csproj delete mode 100644 KruacentE.GlobalEventFramework.Examples/KruacentE.GlobalEventFramework.Examples.sln delete mode 100644 KruacentE.GlobalEventFramework.Examples/MainPlugin.cs delete mode 100644 KruacentExiled/KE.GlobalEventFramework/KruacentE.GlobalEventFramework.csproj delete mode 100644 KruacentExiled/KE.GlobalEventFramework/KruacentE.GlobalEventFramework.sln diff --git a/KruacentE.GlobalEventFramework.Examples/Config.cs b/KruacentE.GlobalEventFramework.Examples/Config.cs deleted file mode 100644 index 0344484e..00000000 --- a/KruacentE.GlobalEventFramework.Examples/Config.cs +++ /dev/null @@ -1,15 +0,0 @@ -using Exiled.API.Interfaces; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace GEFE.Examples -{ - internal class Config : IConfig - { - public bool IsEnabled { get; set; } = true; - public bool Debug { get; set; } = false; - } -} diff --git a/KruacentE.GlobalEventFramework.Examples/GE/Blitz.cs b/KruacentE.GlobalEventFramework.Examples/GE/Blitz.cs deleted file mode 100644 index 4534e7bb..00000000 --- a/KruacentE.GlobalEventFramework.Examples/GE/Blitz.cs +++ /dev/null @@ -1,51 +0,0 @@ -using Exiled.API.Features; -using Exiled.API.Features.Items; -using KruacentE.GlobalEventFramework.GEFE.API.Features; -using MEC; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace KruacentE.GlobalEventFramework.Examples.GE -{ - /// - /// Spawn fused grenades in random rooms in the map - /// - public class Blitz : GlobalEvent - { - /// - public override int Id { get; set; } = 1; - /// - public override string Name { get; set; } = "Blitz"; - /// - public override string Description { get; set; } = "éteignez les lumières la luftwaffe arrive"; - /// - public override int Weight { get; set; } = 1; - /// - /// The cooldown between 2 spawn of grenades - /// - public int Cooldown { get; set; } = 120; - /// - /// The number of grenades in each spawn - /// - public int NbGrenadeSpawned { get; set; } = 5; - /// - public override IEnumerator Start() - { - while (!Round.IsEnded) - { - Log.Debug("waiting"); - yield return Timing.WaitForSeconds(Cooldown); - for (int i = 0; i < NbGrenadeSpawned; i++) - { - ((ExplosiveGrenade)Item.Create(ItemType.GrenadeHE)).SpawnActive(Room.Random().Position); - } - - - } - } - - } -} diff --git a/KruacentE.GlobalEventFramework.Examples/GE/Impostor.cs b/KruacentE.GlobalEventFramework.Examples/GE/Impostor.cs deleted file mode 100644 index 2e12e9d4..00000000 --- a/KruacentE.GlobalEventFramework.Examples/GE/Impostor.cs +++ /dev/null @@ -1,70 +0,0 @@ -using Player = Exiled.API.Features.Player; -using System.Collections.Generic; -using KruacentE.GlobalEventFramework.GEFE.API.Features; -using MEC; -using System.Linq; -using Exiled.API.Extensions; -using Exiled.API.Features; - -namespace KruacentE.GlobalEventFramework.Examples.GE -{ - public class Impostor : GlobalEvent - { - public override int Id { get; set; } = 30; - public override string Name { get; set; } = "Impostor"; - public override string Description { get; set; } = "Ne vous fiez pas aux apparences !"; - public override int Weight { get; set; } = 1; - - public override IEnumerator Start() - { - while (!Round.IsEnded) - { - int randomNumber = UnityEngine.Random.Range(180, 300); - yield return Timing.WaitForSeconds(randomNumber); - ChangingPlayer(); - } - } - - private void ChangingPlayer() - { - // Liste des joueurs vivants - List playerInServer = Player.List.Where(p => !p.IsNPC && p.IsAlive).ToList(); - - if (playerInServer.Count < 2) - { - Log.Warn("Pas assez de joueurs vivants pour effectuer un échange !"); - return; - } - - // Debug : afficher la liste initiale des joueurs avec leurs rôles - Log.Debug("===== Liste des joueurs avant permutation ====="); - - playerInServer.ForEach(p => Log.Debug($"{p.Nickname} ({p.Role})")); - - // Mélanger la liste des joueurs - playerInServer.ShuffleList(); - - // Copier les données actuelles des joueurs - var originalNicknames = playerInServer.Select(p => p.Nickname).ToList(); - var originalRoles = playerInServer.Select(p => p.Role).ToList(); - - // Permutation circulaire des rôles et pseudonymes - for (int i = 0; i < playerInServer.Count; i++) - { - int nextIndex = (i + 1) % playerInServer.Count; - playerInServer[i].ChangeAppearance(originalRoles[nextIndex]); - playerInServer[i].DisplayNickname = originalNicknames[nextIndex]; - } - - // Debug : afficher les correspondances après permutation - Log.Debug("===== Correspondances après permutation ====="); - for (int i = 0; i < playerInServer.Count; i++) - { - int nextIndex = (i + 1) % playerInServer.Count; - Log.Debug($"{originalNicknames[i]} ({originalRoles[i]}) -> {originalNicknames[nextIndex]} ({originalRoles[nextIndex]})"); - } - } - - - } -} \ No newline at end of file diff --git a/KruacentE.GlobalEventFramework.Examples/GE/KIWIS.cs b/KruacentE.GlobalEventFramework.Examples/GE/KIWIS.cs deleted file mode 100644 index 9f844fa1..00000000 --- a/KruacentE.GlobalEventFramework.Examples/GE/KIWIS.cs +++ /dev/null @@ -1,54 +0,0 @@ -using Exiled.API.Features; -using MEC; -using PlayerRoles; -using Utils.NonAllocLINQ; -using System.Collections.Generic; -using System.Linq; -using KruacentE.GlobalEventFramework.GEFE.API.Features; - - -namespace KruacentE.GlobalEventFramework.Examples.GE -{ - /// - /// The scp start with 2/3 of it's life and end with 4/3 of it's vanilla life - /// - public class KIWIS : GlobalEvent - { - /// - public override int Id { get; set; } = 32; - /// - public override string Name { get; set; } = "KIWIS"; - /// - public override string Description { get; set; } = "Kill It While It's Small"; - /// - public override int Weight { get; set; } = 1; - /// - public override IEnumerator Start() - { - var listScp = Player.List.ToList().Where(p => p.IsScp && p.Role.Type != RoleTypeId.Scp0492).ToList().ToDictionary(p => p, p => p.MaxHealth/3); - - //set the health of all starting scps to 2/3 of their vanilla max health - listScp.ForEach(k => - { - k.Key.MaxHealth = k.Value * 2; - k.Key.Health = k.Key.MaxHealth; - }); - - yield return Timing.WaitUntilTrue(() => Round.ElapsedTime.TotalMinutes >= 15); - listScp.ForEach(k => { - k.Key.MaxHealth += k.Value; - k.Key.Heal(k.Value); - }); - - yield return Timing.WaitUntilTrue(() => Round.ElapsedTime.TotalMinutes >= 30); - listScp.ForEach(k => { - k.Key.MaxHealth += k.Value; - k.Key.Heal(k.Value); - }); - - yield return 0; - - } - - } -} diff --git a/KruacentE.GlobalEventFramework.Examples/GE/OpenBar.cs b/KruacentE.GlobalEventFramework.Examples/GE/OpenBar.cs deleted file mode 100644 index 8a24d171..00000000 --- a/KruacentE.GlobalEventFramework.Examples/GE/OpenBar.cs +++ /dev/null @@ -1,56 +0,0 @@ -using Exiled.API.Features.Doors; -using KruacentE.GlobalEventFramework.GEFE.API.Features; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using Exiled.API.Enums; -using Exiled.API.Features; -using Exiled.Events.EventArgs.Map; - -namespace KruacentE.GlobalEventFramework.Examples.GE -{ - public class OpenBar : GlobalEvent - { - public override int Id { get; set; } = 38; - public override string Name { get; set; } = "OpenBar"; - public override string Description { get; set; } = "j'espère que vous avez pas prévu de kampé"; - public override int Weight { get; set; } = 1; - public override IEnumerator Start() - { - var doors = Door.List.Where(d => new[] { DoorType.GateA, DoorType.GateB, DoorType.HczArmory, DoorType.HIDChamber,DoorType.Intercom,DoorType.Scp049Armory,DoorType.Scp096,DoorType.Scp106Primary,DoorType.Scp106Secondary,DoorType.Scp330,DoorType.Scp330Chamber,DoorType.Scp914Gate }.Contains(d.Type)).ToList(); - UnlockAndOpen(doors); - - yield return 0; - } - - private void UnlockAndOpen(List doors) - { - doors.ForEach(d => - { - d.IsOpen = true; - d.ChangeLock(DoorLockType.Isolation); - }); - } - - public override void SubscribeEvent() - { - Exiled.Events.Handlers.Map.GeneratorActivating += GenActivate; - } - - public override void UnsubscribeEvent() - { - Exiled.Events.Handlers.Map.GeneratorActivating -= GenActivate; - } - - public void GenActivate(GeneratorActivatingEventArgs ev) - { - if (Generator.List.Where(g => g.IsEngaged).Count() == 3) - { - UnlockAndOpen(Door.List.Where(d => new[] { DoorType.Scp079First, DoorType.Scp079Second }.Contains(d.Type)).ToList()); - } - } - - } -} diff --git a/KruacentE.GlobalEventFramework.Examples/GE/R.cs b/KruacentE.GlobalEventFramework.Examples/GE/R.cs deleted file mode 100644 index 896eb1da..00000000 --- a/KruacentE.GlobalEventFramework.Examples/GE/R.cs +++ /dev/null @@ -1,32 +0,0 @@ -using Exiled.API.Features; -using KruacentE.GlobalEventFramework.GEFE.API.Features; -using PlayerRoles; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace KruacentE.GlobalEventFramework.Examples.GE -{ - /// - /// Literally does nothing - /// - public class R : GlobalEvent - { - /// - public override int Id { get; set; } = 32; - /// - public override string Name { get; set; } = "nothing"; - /// - public override string Description { get; set; } = "y'a r"; - /// - public override int Weight { get; set; } = 3; - /// - public override IEnumerator Start() - { - yield return 0; - } - - } -} diff --git a/KruacentE.GlobalEventFramework.Examples/GE/RandomSpawn.cs b/KruacentE.GlobalEventFramework.Examples/GE/RandomSpawn.cs deleted file mode 100644 index 416fe24d..00000000 --- a/KruacentE.GlobalEventFramework.Examples/GE/RandomSpawn.cs +++ /dev/null @@ -1,47 +0,0 @@ -using Exiled.API.Features; -using KruacentE.GlobalEventFramework.GEFE.API.Features; -using PlayerRoles; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace KruacentE.GlobalEventFramework.Examples.GE -{ - /// - /// All spawn are random at the start of the game (NTF & Chaos not included) - /// Note: all role spawn with each other except SCPs - /// - public class RandomSpawn : GlobalEvent - { - /// - public override int Id { get; set; } = 32; - /// - public override string Name { get; set; } = "RandomSpawn"; - /// - public override string Description { get; set; } = "Les spawns sont random"; - /// - public override int Weight { get; set; } = 1; - /// - public override IEnumerator Start() - { - Room room = Room.Random(); - foreach (RoleTypeId r in Enum.GetValues(typeof(RoleTypeId))) - { - foreach (Player p in Player.List) - { - - if (p.Role == r) - { - p.Teleport(room); - } - - } - room = Room.Random(); - } - yield return 0; - } - - } -} diff --git a/KruacentE.GlobalEventFramework.Examples/GE/Shuffle.cs b/KruacentE.GlobalEventFramework.Examples/GE/Shuffle.cs deleted file mode 100644 index 07028ea2..00000000 --- a/KruacentE.GlobalEventFramework.Examples/GE/Shuffle.cs +++ /dev/null @@ -1,107 +0,0 @@ -using Exiled.API.Features; -using MEC; -using KruacentE.GlobalEventFramework.GEFE.API.Features; -using PlayerHandler = Exiled.Events.Handlers.Player; -using Exiled.Events.EventArgs.Player; -using UnityEngine; -using System.Collections.Generic; -using System.Linq; - - -namespace KruacentE.GlobalEventFramework.Examples.GE -{ - /// - /// Every some amount of time all player take the position of another - /// - public class Shuffle : GlobalEvent - { - /// - public override int Id { get; set; } = 31; - /// - public override string Name { get; set; } = "Shuffle"; - /// - public override string Description { get; set; } = "et ça fait roomba café dans le scp"; - /// - public override int Weight { get; set; } = 0; - private List players; - private List pos; - /// - public override IEnumerator Start() - { - this.players = Player.List.ToList().Where(p => !p.IsNPC).ToList(); - this.players.ShuffleList(); - pos = new List(players.Count); - for (int i = 0; i < players.Count; i++) - { - pos.Add(Vector3.zero); - } - Log.Debug($"before while"); - while (!Round.IsEnded) - { - - Log.Debug($"waiting for {GetType().Name}"); - yield return Timing.WaitForSeconds(UnityEngine.Random.Range(300, 900)); - for (int i = 0; i < this.players.Count; i++) - { - Log.Debug($"old position of player {this.players[i]} : {this.players[i].Position}"); - var player = this.players[i]; - pos[i] = player.Position; - Log.Debug("------"); - } - - ShiftLeft(this.players); - Log.Debug("shifted players"); - for (int i = 0; i < this.players.Count; i++) - { - Log.Debug("before tp"); - this.players[i].Teleport(pos[i]); - Log.Debug($"new position of player {this.players[i]} : {this.players[i].Position}"); - } - Log.Debug($"tp player"); - for (int i = 0; i < players.Count; i++) - { - pos.Add(Vector3.zero); - } - Log.Debug($"cleared"); - } - } - /// - public override void SubscribeEvent() - { - PlayerHandler.Joined += OnJoined; - } - /// - public override void UnsubscribeEvent() - { - PlayerHandler.Joined -= OnJoined; - } - - private void OnJoined(JoinedEventArgs ev) - { - if (!ev.Player.IsNPC) - { - this.players.Add(ev.Player); - this.pos.Add(ev.Player.Position); - } - } - /// - /// Shift a List to the left - /// - /// the type of the List - /// the List to shift - private void ShiftLeft(List lst) - { - if (lst.Count > 0) - { - T firstElement = lst[0]; - for (int i = 1; i < lst.Count; i++) - { - lst[i - 1] = lst[i]; - } - lst[lst.Count - 1] = firstElement; - } - } - - - } -} diff --git a/KruacentE.GlobalEventFramework.Examples/GE/Speed.cs b/KruacentE.GlobalEventFramework.Examples/GE/Speed.cs deleted file mode 100644 index 7c900775..00000000 --- a/KruacentE.GlobalEventFramework.Examples/GE/Speed.cs +++ /dev/null @@ -1,72 +0,0 @@ -using CustomPlayerEffects; -using Exiled.API.Enums; -using Exiled.API.Features; -using Exiled.Events.EventArgs.Player; -using Exiled.Events.EventArgs.Scp173; -using KruacentE.GlobalEventFramework.GEFE.API.Features; -using MEC; -using System; -using System.Collections.Generic; -using System.ComponentModel; -using System.Linq; -using Utils.NonAllocLINQ; -using PlayerHandler = Exiled.Events.Handlers.Player; - -namespace KruacentE.GlobalEventFramework.Examples.GE -{ - /// - /// Everyone has a movement boost effect (stackable) - /// Maybe inspired by Dr Bright's Mayhem - /// - public class Speed : GlobalEvent - { - /// - public override int Id { get; set; } = 30; - /// - public override string Name { get; set; } = "Speed"; - /// - public override string Description { get; set; } = "Gas! gas! gas!"; - /// - public override int Weight { get; set; } = 1; - /// - /// intensity of the movement boost effect - /// - public byte MovementBoost { get; set; } = 100; - /// - public override IEnumerator Start() - { - yield return Timing.WaitForSeconds(1); - Player.List.ToList().ForEach(p => p.EnableEffect(MovementBoost,999999999, true)); - - } - /// - public override void SubscribeEvent() - { - PlayerHandler.ChangingRole += ReactivateEffectSpawn; - Exiled.Events.Handlers.Scp173.Blinking += SpeedyNut; - } - /// - public override void UnsubscribeEvent() - { - PlayerHandler.ChangingRole -= ReactivateEffectSpawn; - Exiled.Events.Handlers.Scp173.Blinking -= SpeedyNut; - Player.List.ToList().ForEach(p => p.DisableEffect()); - } - /// - /// Decrease the blink cooldown of SCP-173 - /// - private void SpeedyNut(BlinkingEventArgs ev) - { - ev.BlinkCooldown = ev.BlinkCooldown/2; - } - - /// - /// Reactivate the effect at each role changement - /// - private void ReactivateEffectSpawn(ChangingRoleEventArgs ev) - { - Timing.CallDelayed(1f, () => ev.Player.EnableEffect(MovementBoost, 999999999, true)); - - } - } -} diff --git a/KruacentE.GlobalEventFramework.Examples/GE/SystemMalfunction.cs b/KruacentE.GlobalEventFramework.Examples/GE/SystemMalfunction.cs deleted file mode 100644 index f89e62ec..00000000 --- a/KruacentE.GlobalEventFramework.Examples/GE/SystemMalfunction.cs +++ /dev/null @@ -1,102 +0,0 @@ -using Exiled.API.Features; -using Exiled.API.Features.Doors; -using KruacentE.GlobalEventFramework.GEFE.API.Features; -using KruacentE.GlobalEventFramework.GEFE.API.Utils; -using MEC; -using System.Collections.Generic; -using System.Linq; -using Interactables.Interobjects.DoorUtils; -using Exiled.API.Enums; -using Exiled.API.Extensions; - -namespace KruacentE.GlobalEventFramework.Examples.GE -{ - /// - /// The original - /// - /// The nuke can go off random from 15 to 30 min in the round (can be disable like a normal nuke) - /// If BlackoutNDoor is enabled in the server, increase the frequence of blackouts and door lockdowns - /// Can lock Elevator and Gate for an amount of time - /// Checkpoints can open randomly - /// - /// - public class SystemMalfunction : GlobalEvent - { - /// - public override int Id { get; set; } = 1; - /// - public override string Name { get; set; } = "System Malfunction"; - /// - public override string Description { get; set; } = "On dirait que les systèmes informatiques sont défaillants"; - /// - public override int Weight { get; set; } = 1; - /// - /// Set the cooldown for the BlackoutNDoor - /// - public int NewCooldown { get; set; } = 180; - /// - public override IEnumerator Start() - { - MoreBlackOutNDoors(); - Coroutine.LaunchCoroutine(EarlyNuke()); - - CoroutineHandle handle; - while(Round.InProgress){ - //todo change so it happen more frequently - Timing.WaitForSeconds((float)Round.ElapsedTime.TotalSeconds); - List> l = new []{CheckpointMalfunction(),GateLockdown(),ElevatorLockdown()}.ToList(); - handle = Coroutine.LaunchCoroutine(l[UnityEngine.Random.Range(0,3)]); - yield return Timing.WaitUntilDone(handle); - - } - - } - - private IEnumerator EarlyNuke() - { - int timeNuke = UnityEngine.Random.Range(15, 30); - Log.Debug($"the nuke will detonate in {timeNuke}min"); - yield return Timing.WaitUntilTrue(() => timeNuke == Round.ElapsedTime.TotalMinutes); - Warhead.Start(); - Log.Debug($"kaboom"); - } - - private void MoreBlackOutNDoors() - { - var otherPlugin = Exiled.Loader.Loader.Plugins.FirstOrDefault(plugin => plugin.Name == "BlackOutNDoors"); - if (otherPlugin != null) - { - - if (otherPlugin is BlackoutKruacent.MainPlugin blackout) - { - Log.Info("Found BlackOutNDoors"); - blackout.ServerHandler.Cooldown = NewCooldown; - } - - } - } - - private IEnumerator CheckpointMalfunction(){ - yield return Timing.WaitForSeconds(UnityEngine.Random.Range(20,60)); - var checkpoints = Door.List.Where(d => d.IsCheckpoint).ToList().RandomItem().IsOpen =true; - - } - - private IEnumerator GateLockdown(){ - var gates = Door.List.Where(d => d.Type == DoorType.GateA ||d.Type == DoorType.GateB); - var gate = gates.GetRandomValue(); - gate.IsOpen = false; - var timelock = UnityEngine.Random.Range(10,30); - gate.Lock(timelock,DoorLockType.Isolation); - yield return Timing.WaitForSeconds(timelock); - } - - private IEnumerator ElevatorLockdown(){ - var lift = Lift.Random; - lift.ChangeLock(DoorLockReason.Isolation); - yield return Timing.WaitForSeconds(UnityEngine.Random.Range(10,20)); - lift.ChangeLock(DoorLockReason.None); - } - - } -} \ No newline at end of file diff --git a/KruacentE.GlobalEventFramework.Examples/KruacentE.GlobalEventFramework.Examples.csproj b/KruacentE.GlobalEventFramework.Examples/KruacentE.GlobalEventFramework.Examples.csproj deleted file mode 100644 index 46557783..00000000 --- a/KruacentE.GlobalEventFramework.Examples/KruacentE.GlobalEventFramework.Examples.csproj +++ /dev/null @@ -1,29 +0,0 @@ - - - - net48 - - - - - - - - - C:\Program Files (x86)\Steam\steamapps\common\SCP Secret Laboratory Dedicated Server\SCPSL_Data\Managed\Assembly-CSharp-firstpass.dll - - - ..\KruacentE.BlackoutNDoor\bin\Debug\net48\BlackoutKruacent.dll - - - ..\KruacentE.GlobalEventFramework\bin\Debug\net48\KruacentE.GlobalEventFramework.dll - - - C:\Program Files (x86)\Steam\steamapps\common\SCP Secret Laboratory Dedicated Server\SCPSL_Data\Managed\UnityEngine.dll - - - C:\Program Files (x86)\Steam\steamapps\common\SCP Secret Laboratory Dedicated Server\SCPSL_Data\Managed\UnityEngine.CoreModule.dll - - - - diff --git a/KruacentE.GlobalEventFramework.Examples/KruacentE.GlobalEventFramework.Examples.sln b/KruacentE.GlobalEventFramework.Examples/KruacentE.GlobalEventFramework.Examples.sln deleted file mode 100644 index 7b1656cf..00000000 --- a/KruacentE.GlobalEventFramework.Examples/KruacentE.GlobalEventFramework.Examples.sln +++ /dev/null @@ -1,22 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio Version 17 -VisualStudioVersion = 17.12.35506.116 d17.12 -MinimumVisualStudioVersion = 10.0.40219.1 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "KruacentE.GlobalEventFramework.Examples", "KruacentE.GlobalEventFramework.Examples.csproj", "{B8D70A5A-64B6-4ADB-A9C8-100E251704C4}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Any CPU = Debug|Any CPU - Release|Any CPU = Release|Any CPU - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {B8D70A5A-64B6-4ADB-A9C8-100E251704C4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {B8D70A5A-64B6-4ADB-A9C8-100E251704C4}.Debug|Any CPU.Build.0 = Debug|Any CPU - {B8D70A5A-64B6-4ADB-A9C8-100E251704C4}.Release|Any CPU.ActiveCfg = Release|Any CPU - {B8D70A5A-64B6-4ADB-A9C8-100E251704C4}.Release|Any CPU.Build.0 = Release|Any CPU - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal diff --git a/KruacentE.GlobalEventFramework.Examples/MainPlugin.cs b/KruacentE.GlobalEventFramework.Examples/MainPlugin.cs deleted file mode 100644 index 0cfcb44b..00000000 --- a/KruacentE.GlobalEventFramework.Examples/MainPlugin.cs +++ /dev/null @@ -1,23 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using Exiled.API.Features; - -namespace GEFE.Examples -{ - internal class MainPlugin : Plugin - { - public override string Name => "GlobalEventExample"; - public override void OnEnabled() - { - - } - - public override void OnDisabled() - { - - } - } -} diff --git a/KruacentExiled/KE.GlobalEventFramework/KruacentE.GlobalEventFramework.csproj b/KruacentExiled/KE.GlobalEventFramework/KruacentE.GlobalEventFramework.csproj deleted file mode 100644 index 7fc010ea..00000000 --- a/KruacentExiled/KE.GlobalEventFramework/KruacentE.GlobalEventFramework.csproj +++ /dev/null @@ -1,23 +0,0 @@ - - - - net48 - - - - - - - - - C:\Program Files (x86)\Steam\steamapps\common\SCP Secret Laboratory Dedicated Server\SCPSL_Data\Managed\Assembly-CSharp-firstpass.dll - - - C:\Program Files (x86)\Steam\steamapps\common\SCP Secret Laboratory Dedicated Server\SCPSL_Data\Managed\UnityEngine.dll - - - C:\Program Files (x86)\Steam\steamapps\common\SCP Secret Laboratory Dedicated Server\SCPSL_Data\Managed\UnityEngine.CoreModule.dll - - - - diff --git a/KruacentExiled/KE.GlobalEventFramework/KruacentE.GlobalEventFramework.sln b/KruacentExiled/KE.GlobalEventFramework/KruacentE.GlobalEventFramework.sln deleted file mode 100644 index 3cd8362e..00000000 --- a/KruacentExiled/KE.GlobalEventFramework/KruacentE.GlobalEventFramework.sln +++ /dev/null @@ -1,22 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio Version 17 -VisualStudioVersion = 17.12.35506.116 d17.12 -MinimumVisualStudioVersion = 10.0.40219.1 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "KruacentE.GlobalEventFramework", "KruacentE.GlobalEventFramework.csproj", "{B6205BF7-B38B-4473-805D-88168E2BCCE3}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Any CPU = Debug|Any CPU - Release|Any CPU = Release|Any CPU - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {B6205BF7-B38B-4473-805D-88168E2BCCE3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {B6205BF7-B38B-4473-805D-88168E2BCCE3}.Debug|Any CPU.Build.0 = Debug|Any CPU - {B6205BF7-B38B-4473-805D-88168E2BCCE3}.Release|Any CPU.ActiveCfg = Release|Any CPU - {B6205BF7-B38B-4473-805D-88168E2BCCE3}.Release|Any CPU.Build.0 = Release|Any CPU - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal From c64ed44a99046c8c36a00e9913c0041ee258d00d Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Sun, 29 Dec 2024 16:13:50 +0100 Subject: [PATCH 068/853] Added the Author, Version and Name --- KruacentExiled/KE.BlackoutNDoor/MainPlugin.cs | 5 ++++- .../KE.GlobalEventFramework.Examples/GE/SystemMalfunction.cs | 2 +- .../KE.GlobalEventFramework.Examples/MainPlugin.cs | 5 ++++- KruacentExiled/KE.GlobalEventFramework/MainPlugin.cs | 5 ++++- KruacentExiled/KE.Items/MainPlugin.cs | 5 ++++- KruacentExiled/KE.Misc/MainPlugin.cs | 5 +++++ 6 files changed, 22 insertions(+), 5 deletions(-) diff --git a/KruacentExiled/KE.BlackoutNDoor/MainPlugin.cs b/KruacentExiled/KE.BlackoutNDoor/MainPlugin.cs index 822030c0..2b95015c 100644 --- a/KruacentExiled/KE.BlackoutNDoor/MainPlugin.cs +++ b/KruacentExiled/KE.BlackoutNDoor/MainPlugin.cs @@ -1,6 +1,7 @@ using BlackoutKruacent.API.Features; using BlackoutKruacent.Handlers; using Exiled.API.Features; +using System; using System.ComponentModel; using Server = Exiled.Events.Handlers.Server; @@ -8,7 +9,9 @@ namespace BlackoutKruacent { public class MainPlugin : Plugin { - public override string Name => "BlackOutNDoors"; + public override string Author => "Patrique"; + public override Version Version => new Version(1,0,0); + public override string Name => "KE.BlackoutDoor"; internal static MainPlugin Instance; private Controller Controller; public ServerHandler ServerHandler { get; private set; } diff --git a/KruacentExiled/KE.GlobalEventFramework.Examples/GE/SystemMalfunction.cs b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/SystemMalfunction.cs index f89e62ec..d1ac708d 100644 --- a/KruacentExiled/KE.GlobalEventFramework.Examples/GE/SystemMalfunction.cs +++ b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/SystemMalfunction.cs @@ -63,7 +63,7 @@ private IEnumerator EarlyNuke() private void MoreBlackOutNDoors() { - var otherPlugin = Exiled.Loader.Loader.Plugins.FirstOrDefault(plugin => plugin.Name == "BlackOutNDoors"); + var otherPlugin = Exiled.Loader.Loader.Plugins.FirstOrDefault(plugin => plugin.Name == "KE.BlackoutDoor"); if (otherPlugin != null) { diff --git a/KruacentExiled/KE.GlobalEventFramework.Examples/MainPlugin.cs b/KruacentExiled/KE.GlobalEventFramework.Examples/MainPlugin.cs index 0cfcb44b..18a9771f 100644 --- a/KruacentExiled/KE.GlobalEventFramework.Examples/MainPlugin.cs +++ b/KruacentExiled/KE.GlobalEventFramework.Examples/MainPlugin.cs @@ -9,7 +9,10 @@ namespace GEFE.Examples { internal class MainPlugin : Plugin { - public override string Name => "GlobalEventExample"; + public override string Author => "Patrique & OmerGS"; + + public override Version Version => new Version(1, 0, 0); + public override string Name => "KE.GEF.Examples"; public override void OnEnabled() { diff --git a/KruacentExiled/KE.GlobalEventFramework/MainPlugin.cs b/KruacentExiled/KE.GlobalEventFramework/MainPlugin.cs index 1d3e2980..02043f11 100644 --- a/KruacentExiled/KE.GlobalEventFramework/MainPlugin.cs +++ b/KruacentExiled/KE.GlobalEventFramework/MainPlugin.cs @@ -12,7 +12,10 @@ namespace KruacentE.GlobalEventFramework { internal class MainPlugin : Plugin { - public override PluginPriority Priority => PluginPriority.Highest; + public override string Author => "Patrique"; + public override string Name => "KE.GEFramework"; + public override Version Version => new Version(1, 0, 0); + public override PluginPriority Priority => PluginPriority.Highest; internal GEFE.Handlers.ServerHandler _server; diff --git a/KruacentExiled/KE.Items/MainPlugin.cs b/KruacentExiled/KE.Items/MainPlugin.cs index 42d98d4e..b5944dd4 100644 --- a/KruacentExiled/KE.Items/MainPlugin.cs +++ b/KruacentExiled/KE.Items/MainPlugin.cs @@ -1,12 +1,15 @@  using Exiled.API.Features; using Exiled.CustomItems.API.Features; +using System; namespace ArmeKruacent { public class MainPlugin : Plugin { - + public override string Author => "Patrique & OmerGS"; + public override string Name => "KEItems"; + public override Version Version => new Version(1, 0, 0); public override void OnEnabled() { diff --git a/KruacentExiled/KE.Misc/MainPlugin.cs b/KruacentExiled/KE.Misc/MainPlugin.cs index 7df67b5e..375c7b47 100644 --- a/KruacentExiled/KE.Misc/MainPlugin.cs +++ b/KruacentExiled/KE.Misc/MainPlugin.cs @@ -12,11 +12,16 @@ using PlayerRoles; using Exiled.Events.EventArgs.Player; using KruacentExiled.KruacentE.Misc; +using System; namespace KE.Misc { + public class MainPlugin : Plugin { + public override string Author => "Patrique"; + public override string Name => "KEMisc"; + public override Version Version => new Version(1, 0, 0); internal static MainPlugin Instance { get; private set; } private ServerHandler ServerHandler; internal _914 _914 { get; private set; } From e38f8ab0175d3a5c04a620953d96494bc0a59ca4 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Sun, 29 Dec 2024 16:18:39 +0100 Subject: [PATCH 069/853] Changed the namespace name --- KruacentExiled/KE.GlobalEventFramework/Config.cs | 2 +- .../GEFE/API/Features/GlobalEvent.cs | 4 ++-- .../KE.GlobalEventFramework/GEFE/API/Features/Loader.cs | 4 ++-- .../GEFE/API/Interfaces/IGlobalEvent.cs | 2 +- .../KE.GlobalEventFramework/GEFE/API/Utils/Coroutine.cs | 2 +- .../KE.GlobalEventFramework/GEFE/Commands/List.cs | 4 ++-- .../GEFE/Commands/ParentCommandGEFE.cs | 2 +- .../GEFE/Exception/GlobalEventNullException.cs | 2 +- .../KE.GlobalEventFramework/GEFE/Handlers/ServerHandler.cs | 6 +++--- KruacentExiled/KE.GlobalEventFramework/MainPlugin.cs | 6 +++--- KruacentExiled/KE.Items/Config.cs | 2 +- KruacentExiled/KE.Items/Items/Mine.cs | 2 +- KruacentExiled/KE.Items/Items/TPGrenada.cs | 2 +- KruacentExiled/KE.Items/MainPlugin.cs | 2 +- 14 files changed, 21 insertions(+), 21 deletions(-) diff --git a/KruacentExiled/KE.GlobalEventFramework/Config.cs b/KruacentExiled/KE.GlobalEventFramework/Config.cs index f556b2c9..69f7116a 100644 --- a/KruacentExiled/KE.GlobalEventFramework/Config.cs +++ b/KruacentExiled/KE.GlobalEventFramework/Config.cs @@ -7,7 +7,7 @@ using System.Text; using System.Threading.Tasks; -namespace KruacentE.GlobalEventFramework +namespace KE.GlobalEventFramework { internal class Config : IConfig { diff --git a/KruacentExiled/KE.GlobalEventFramework/GEFE/API/Features/GlobalEvent.cs b/KruacentExiled/KE.GlobalEventFramework/GEFE/API/Features/GlobalEvent.cs index 2ac05876..4b525a5e 100644 --- a/KruacentExiled/KE.GlobalEventFramework/GEFE/API/Features/GlobalEvent.cs +++ b/KruacentExiled/KE.GlobalEventFramework/GEFE/API/Features/GlobalEvent.cs @@ -2,7 +2,7 @@ using System.Collections.Generic; using System.Linq; using MEC; -using KruacentE.GlobalEventFramework.GEFE.API.Interfaces; +using KE.GlobalEventFramework.GEFE.API.Interfaces; using Exiled.CustomItems.API.Features; using System.Reflection; using Exiled.API.Features.Attributes; @@ -12,7 +12,7 @@ using Exiled.API.Extensions; using Exiled.API.Features.Pools; -namespace KruacentE.GlobalEventFramework.GEFE.API.Features +namespace KE.GlobalEventFramework.GEFE.API.Features { public class GlobalEvent : IGlobalEvent { diff --git a/KruacentExiled/KE.GlobalEventFramework/GEFE/API/Features/Loader.cs b/KruacentExiled/KE.GlobalEventFramework/GEFE/API/Features/Loader.cs index 30ea4501..60747cd3 100644 --- a/KruacentExiled/KE.GlobalEventFramework/GEFE/API/Features/Loader.cs +++ b/KruacentExiled/KE.GlobalEventFramework/GEFE/API/Features/Loader.cs @@ -1,13 +1,13 @@ using Exiled.API.Features; using Exiled.API.Interfaces; -using KruacentE.GlobalEventFramework.GEFE.API.Interfaces; +using KE.GlobalEventFramework.GEFE.API.Interfaces; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; -namespace KruacentE.GlobalEventFramework.GEFE.API.Features +namespace KE.GlobalEventFramework.GEFE.API.Features { internal class Loader { diff --git a/KruacentExiled/KE.GlobalEventFramework/GEFE/API/Interfaces/IGlobalEvent.cs b/KruacentExiled/KE.GlobalEventFramework/GEFE/API/Interfaces/IGlobalEvent.cs index 3b049198..15dfce21 100644 --- a/KruacentExiled/KE.GlobalEventFramework/GEFE/API/Interfaces/IGlobalEvent.cs +++ b/KruacentExiled/KE.GlobalEventFramework/GEFE/API/Interfaces/IGlobalEvent.cs @@ -5,7 +5,7 @@ using System.Threading.Tasks; using MEC; -namespace KruacentE.GlobalEventFramework.GEFE.API.Interfaces +namespace KE.GlobalEventFramework.GEFE.API.Interfaces { public interface IGlobalEvent { diff --git a/KruacentExiled/KE.GlobalEventFramework/GEFE/API/Utils/Coroutine.cs b/KruacentExiled/KE.GlobalEventFramework/GEFE/API/Utils/Coroutine.cs index f79b8896..2cec07d0 100644 --- a/KruacentExiled/KE.GlobalEventFramework/GEFE/API/Utils/Coroutine.cs +++ b/KruacentExiled/KE.GlobalEventFramework/GEFE/API/Utils/Coroutine.cs @@ -1,7 +1,7 @@ using MEC; using System.Collections.Generic; -namespace KruacentE.GlobalEventFramework.GEFE.API.Utils +namespace KE.GlobalEventFramework.GEFE.API.Utils { public static class Coroutine { diff --git a/KruacentExiled/KE.GlobalEventFramework/GEFE/Commands/List.cs b/KruacentExiled/KE.GlobalEventFramework/GEFE/Commands/List.cs index 90678852..11764b19 100644 --- a/KruacentExiled/KE.GlobalEventFramework/GEFE/Commands/List.cs +++ b/KruacentExiled/KE.GlobalEventFramework/GEFE/Commands/List.cs @@ -1,11 +1,11 @@ -namespace KruacentE.GlobalEventFramework.GEFE.Commands +namespace KE.GlobalEventFramework.GEFE.Commands { using Exiled.API.Features; using Exiled.API.Features.Pickups; using System; using CommandSystem; using System.Runtime.InteropServices.WindowsRuntime; - using KruacentE.GlobalEventFramework.GEFE.API.Interfaces; + using GEFE.API.Interfaces; using GEFE.API.Features; public class List : ICommand diff --git a/KruacentExiled/KE.GlobalEventFramework/GEFE/Commands/ParentCommandGEFE.cs b/KruacentExiled/KE.GlobalEventFramework/GEFE/Commands/ParentCommandGEFE.cs index 2da2c580..1b8f3830 100644 --- a/KruacentExiled/KE.GlobalEventFramework/GEFE/Commands/ParentCommandGEFE.cs +++ b/KruacentExiled/KE.GlobalEventFramework/GEFE/Commands/ParentCommandGEFE.cs @@ -1,5 +1,5 @@ -namespace KruacentE.GlobalEventFramework.GEFE.Commands +namespace KE.GlobalEventFramework.GEFE.Commands { using CommandSystem; using System; diff --git a/KruacentExiled/KE.GlobalEventFramework/GEFE/Exception/GlobalEventNullException.cs b/KruacentExiled/KE.GlobalEventFramework/GEFE/Exception/GlobalEventNullException.cs index 3341affe..1034cd03 100644 --- a/KruacentExiled/KE.GlobalEventFramework/GEFE/Exception/GlobalEventNullException.cs +++ b/KruacentExiled/KE.GlobalEventFramework/GEFE/Exception/GlobalEventNullException.cs @@ -3,7 +3,7 @@ using System.Linq; using System.Text; using System.Threading.Tasks; -namespace KruacentE.GlobalEventFramework.GEFE.Exception +namespace KE.GlobalEventFramework.GEFE.Exception { public class GlobalEventNullException : ArgumentException { diff --git a/KruacentExiled/KE.GlobalEventFramework/GEFE/Handlers/ServerHandler.cs b/KruacentExiled/KE.GlobalEventFramework/GEFE/Handlers/ServerHandler.cs index ae181d73..38e3b9cc 100644 --- a/KruacentExiled/KE.GlobalEventFramework/GEFE/Handlers/ServerHandler.cs +++ b/KruacentExiled/KE.GlobalEventFramework/GEFE/Handlers/ServerHandler.cs @@ -1,10 +1,10 @@ using Exiled.API.Features; using Exiled.Events.EventArgs.Server; using System.Collections.Generic; -using KruacentE.GlobalEventFramework.GEFE.API.Interfaces; -using KruacentE.GlobalEventFramework.GEFE.API.Features; +using KE.GlobalEventFramework.GEFE.API.Interfaces; +using KE.GlobalEventFramework.GEFE.API.Features; -namespace KruacentE.GlobalEventFramework.GEFE.Handlers +namespace KE.GlobalEventFramework.GEFE.Handlers { internal class ServerHandler { diff --git a/KruacentExiled/KE.GlobalEventFramework/MainPlugin.cs b/KruacentExiled/KE.GlobalEventFramework/MainPlugin.cs index 02043f11..b4dbcc8e 100644 --- a/KruacentExiled/KE.GlobalEventFramework/MainPlugin.cs +++ b/KruacentExiled/KE.GlobalEventFramework/MainPlugin.cs @@ -5,10 +5,10 @@ using MEC; using Exiled.API.Enums; using Player = Exiled.API.Features.Player; -using KruacentE.GlobalEventFramework.GEFE.API.Features; -using KruacentE.GlobalEventFramework.GEFE.API.Interfaces; +using KE.GlobalEventFramework.GEFE.API.Features; +using KE.GlobalEventFramework.GEFE.API.Interfaces; using ServerHandler = Exiled.Events.Handlers.Server; -namespace KruacentE.GlobalEventFramework +namespace KE.GlobalEventFramework { internal class MainPlugin : Plugin { diff --git a/KruacentExiled/KE.Items/Config.cs b/KruacentExiled/KE.Items/Config.cs index c064de87..daaf9357 100644 --- a/KruacentExiled/KE.Items/Config.cs +++ b/KruacentExiled/KE.Items/Config.cs @@ -5,7 +5,7 @@ using System.Text; using System.Threading.Tasks; -namespace ArmeKruacent +namespace KE.Items { public class Config : IConfig { diff --git a/KruacentExiled/KE.Items/Items/Mine.cs b/KruacentExiled/KE.Items/Items/Mine.cs index 35f792cd..5ba232c1 100644 --- a/KruacentExiled/KE.Items/Items/Mine.cs +++ b/KruacentExiled/KE.Items/Items/Mine.cs @@ -5,7 +5,7 @@ using System.Text; using System.Threading.Tasks; -namespace ArmeKruacent.Items +namespace KE.Items.Items { //une mine diff --git a/KruacentExiled/KE.Items/Items/TPGrenada.cs b/KruacentExiled/KE.Items/Items/TPGrenada.cs index 9f9baa51..6dc28bad 100644 --- a/KruacentExiled/KE.Items/Items/TPGrenada.cs +++ b/KruacentExiled/KE.Items/Items/TPGrenada.cs @@ -12,7 +12,7 @@ using PlayerRoles; using UnityEngine; -namespace ArmeKruacent.Items +namespace KE.Items.Items { //grenade qui tp public class TPGrenada : CustomGrenade diff --git a/KruacentExiled/KE.Items/MainPlugin.cs b/KruacentExiled/KE.Items/MainPlugin.cs index b5944dd4..15a559cc 100644 --- a/KruacentExiled/KE.Items/MainPlugin.cs +++ b/KruacentExiled/KE.Items/MainPlugin.cs @@ -3,7 +3,7 @@ using Exiled.CustomItems.API.Features; using System; -namespace ArmeKruacent +namespace KE.Items { public class MainPlugin : Plugin { From 1307cb2a60b1e691c4eeff5110d4cce23c40fc6e Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Sun, 29 Dec 2024 16:26:58 +0100 Subject: [PATCH 070/853] Changed more namespace name --- .../KE.BlackoutNDoor/API/Features/Controller.cs | 2 +- KruacentExiled/KE.BlackoutNDoor/Config.cs | 2 +- .../KE.BlackoutNDoor/Handlers/ServerHandler.cs | 4 ++-- KruacentExiled/KE.BlackoutNDoor/MainPlugin.cs | 6 +++--- .../KE.GlobalEventFramework.Examples/Config.cs | 2 +- .../KE.GlobalEventFramework.Examples/GE/Blitz.cs | 4 ++-- .../KE.GlobalEventFramework.Examples/GE/Impostor.cs | 4 ++-- .../KE.GlobalEventFramework.Examples/GE/KIWIS.cs | 4 ++-- .../KE.GlobalEventFramework.Examples/GE/OpenBar.cs | 4 ++-- .../KE.GlobalEventFramework.Examples/GE/R.cs | 10 ++-------- .../KE.GlobalEventFramework.Examples/GE/RandomSpawn.cs | 4 ++-- .../KE.GlobalEventFramework.Examples/GE/Shuffle.cs | 4 ++-- .../KE.GlobalEventFramework.Examples/GE/Speed.cs | 4 ++-- .../GE/SystemMalfunction.cs | 8 ++++---- .../KE.GlobalEventFramework.Examples/MainPlugin.cs | 2 +- KruacentExiled/KE.Misc/914.cs | 2 +- KruacentExiled/KE.Misc/AutoElevator.cs | 2 +- KruacentExiled/KE.Misc/ClassDDoor.cs | 2 +- KruacentExiled/KE.Misc/MainPlugin.cs | 4 ---- 19 files changed, 32 insertions(+), 42 deletions(-) diff --git a/KruacentExiled/KE.BlackoutNDoor/API/Features/Controller.cs b/KruacentExiled/KE.BlackoutNDoor/API/Features/Controller.cs index 4131a86b..79b70184 100644 --- a/KruacentExiled/KE.BlackoutNDoor/API/Features/Controller.cs +++ b/KruacentExiled/KE.BlackoutNDoor/API/Features/Controller.cs @@ -6,7 +6,7 @@ using System.Collections.Generic; using System.Linq; -namespace BlackoutKruacent.API.Features +namespace KE.BlackoutNDoor.API.Features { public class Controller { diff --git a/KruacentExiled/KE.BlackoutNDoor/Config.cs b/KruacentExiled/KE.BlackoutNDoor/Config.cs index 262b8306..0deae7a6 100644 --- a/KruacentExiled/KE.BlackoutNDoor/Config.cs +++ b/KruacentExiled/KE.BlackoutNDoor/Config.cs @@ -6,7 +6,7 @@ using System.Text; using System.Threading.Tasks; -namespace BlackoutKruacent +namespace KE.BlackoutNDoor { public class Config : IConfig { diff --git a/KruacentExiled/KE.BlackoutNDoor/Handlers/ServerHandler.cs b/KruacentExiled/KE.BlackoutNDoor/Handlers/ServerHandler.cs index 68d5da10..2b4da5a5 100644 --- a/KruacentExiled/KE.BlackoutNDoor/Handlers/ServerHandler.cs +++ b/KruacentExiled/KE.BlackoutNDoor/Handlers/ServerHandler.cs @@ -1,11 +1,11 @@ -using BlackoutKruacent.API.Features; +using KE.BlackoutNDoor.API.Features; using Exiled.API.Features; using Exiled.Events.EventArgs.Server; using MEC; using PluginAPI.Events; using System.Collections.Generic; -namespace BlackoutKruacent.Handlers +namespace KE.BlackoutNDoor.Handlers { public class ServerHandler { diff --git a/KruacentExiled/KE.BlackoutNDoor/MainPlugin.cs b/KruacentExiled/KE.BlackoutNDoor/MainPlugin.cs index 2b95015c..19085cd5 100644 --- a/KruacentExiled/KE.BlackoutNDoor/MainPlugin.cs +++ b/KruacentExiled/KE.BlackoutNDoor/MainPlugin.cs @@ -1,11 +1,11 @@ -using BlackoutKruacent.API.Features; -using BlackoutKruacent.Handlers; +using KE.BlackoutNDoor.API.Features; +using KE.BlackoutNDoor.Handlers; using Exiled.API.Features; using System; using System.ComponentModel; using Server = Exiled.Events.Handlers.Server; -namespace BlackoutKruacent +namespace KE.BlackoutNDoor { public class MainPlugin : Plugin { diff --git a/KruacentExiled/KE.GlobalEventFramework.Examples/Config.cs b/KruacentExiled/KE.GlobalEventFramework.Examples/Config.cs index 0344484e..0927af4b 100644 --- a/KruacentExiled/KE.GlobalEventFramework.Examples/Config.cs +++ b/KruacentExiled/KE.GlobalEventFramework.Examples/Config.cs @@ -5,7 +5,7 @@ using System.Text; using System.Threading.Tasks; -namespace GEFE.Examples +namespace KE.GlobalEventFramework.Examples { internal class Config : IConfig { diff --git a/KruacentExiled/KE.GlobalEventFramework.Examples/GE/Blitz.cs b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/Blitz.cs index 4534e7bb..cfc0eddf 100644 --- a/KruacentExiled/KE.GlobalEventFramework.Examples/GE/Blitz.cs +++ b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/Blitz.cs @@ -1,6 +1,6 @@ using Exiled.API.Features; using Exiled.API.Features.Items; -using KruacentE.GlobalEventFramework.GEFE.API.Features; +using KE.GlobalEventFramework.GEFE.API.Features; using MEC; using System; using System.Collections.Generic; @@ -8,7 +8,7 @@ using System.Text; using System.Threading.Tasks; -namespace KruacentE.GlobalEventFramework.Examples.GE +namespace KE.GlobalEventFramework.Examples.GE { /// /// Spawn fused grenades in random rooms in the map diff --git a/KruacentExiled/KE.GlobalEventFramework.Examples/GE/Impostor.cs b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/Impostor.cs index 2e12e9d4..89ee6f6a 100644 --- a/KruacentExiled/KE.GlobalEventFramework.Examples/GE/Impostor.cs +++ b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/Impostor.cs @@ -1,12 +1,12 @@ using Player = Exiled.API.Features.Player; using System.Collections.Generic; -using KruacentE.GlobalEventFramework.GEFE.API.Features; +using KE.GlobalEventFramework.GEFE.API.Features; using MEC; using System.Linq; using Exiled.API.Extensions; using Exiled.API.Features; -namespace KruacentE.GlobalEventFramework.Examples.GE +namespace KE.GlobalEventFramework.Examples.GE { public class Impostor : GlobalEvent { diff --git a/KruacentExiled/KE.GlobalEventFramework.Examples/GE/KIWIS.cs b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/KIWIS.cs index 9f844fa1..b09fc861 100644 --- a/KruacentExiled/KE.GlobalEventFramework.Examples/GE/KIWIS.cs +++ b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/KIWIS.cs @@ -4,10 +4,10 @@ using Utils.NonAllocLINQ; using System.Collections.Generic; using System.Linq; -using KruacentE.GlobalEventFramework.GEFE.API.Features; +using KE.GlobalEventFramework.GEFE.API.Features; -namespace KruacentE.GlobalEventFramework.Examples.GE +namespace KE.GlobalEventFramework.Examples.GE { /// /// The scp start with 2/3 of it's life and end with 4/3 of it's vanilla life diff --git a/KruacentExiled/KE.GlobalEventFramework.Examples/GE/OpenBar.cs b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/OpenBar.cs index 8a24d171..1a558685 100644 --- a/KruacentExiled/KE.GlobalEventFramework.Examples/GE/OpenBar.cs +++ b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/OpenBar.cs @@ -1,5 +1,5 @@ using Exiled.API.Features.Doors; -using KruacentE.GlobalEventFramework.GEFE.API.Features; +using KE.GlobalEventFramework.GEFE.API.Features; using System; using System.Collections.Generic; using System.Linq; @@ -9,7 +9,7 @@ using Exiled.API.Features; using Exiled.Events.EventArgs.Map; -namespace KruacentE.GlobalEventFramework.Examples.GE +namespace KE.GlobalEventFramework.Examples.GE { public class OpenBar : GlobalEvent { diff --git a/KruacentExiled/KE.GlobalEventFramework.Examples/GE/R.cs b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/R.cs index 896eb1da..ec4ab613 100644 --- a/KruacentExiled/KE.GlobalEventFramework.Examples/GE/R.cs +++ b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/R.cs @@ -1,13 +1,7 @@ -using Exiled.API.Features; -using KruacentE.GlobalEventFramework.GEFE.API.Features; -using PlayerRoles; -using System; +using KE.GlobalEventFramework.GEFE.API.Features; using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -namespace KruacentE.GlobalEventFramework.Examples.GE +namespace KE.GlobalEventFramework.Examples.GE { /// /// Literally does nothing diff --git a/KruacentExiled/KE.GlobalEventFramework.Examples/GE/RandomSpawn.cs b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/RandomSpawn.cs index 416fe24d..fe31b79b 100644 --- a/KruacentExiled/KE.GlobalEventFramework.Examples/GE/RandomSpawn.cs +++ b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/RandomSpawn.cs @@ -1,5 +1,5 @@ using Exiled.API.Features; -using KruacentE.GlobalEventFramework.GEFE.API.Features; +using KE.GlobalEventFramework.GEFE.API.Features; using PlayerRoles; using System; using System.Collections.Generic; @@ -7,7 +7,7 @@ using System.Text; using System.Threading.Tasks; -namespace KruacentE.GlobalEventFramework.Examples.GE +namespace KE.GlobalEventFramework.Examples.GE { /// /// All spawn are random at the start of the game (NTF & Chaos not included) diff --git a/KruacentExiled/KE.GlobalEventFramework.Examples/GE/Shuffle.cs b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/Shuffle.cs index 07028ea2..12e6d505 100644 --- a/KruacentExiled/KE.GlobalEventFramework.Examples/GE/Shuffle.cs +++ b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/Shuffle.cs @@ -1,6 +1,6 @@ using Exiled.API.Features; using MEC; -using KruacentE.GlobalEventFramework.GEFE.API.Features; +using KE.GlobalEventFramework.GEFE.API.Features; using PlayerHandler = Exiled.Events.Handlers.Player; using Exiled.Events.EventArgs.Player; using UnityEngine; @@ -8,7 +8,7 @@ using System.Linq; -namespace KruacentE.GlobalEventFramework.Examples.GE +namespace KE.GlobalEventFramework.Examples.GE { /// /// Every some amount of time all player take the position of another diff --git a/KruacentExiled/KE.GlobalEventFramework.Examples/GE/Speed.cs b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/Speed.cs index 7c900775..a9152fb6 100644 --- a/KruacentExiled/KE.GlobalEventFramework.Examples/GE/Speed.cs +++ b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/Speed.cs @@ -3,7 +3,7 @@ using Exiled.API.Features; using Exiled.Events.EventArgs.Player; using Exiled.Events.EventArgs.Scp173; -using KruacentE.GlobalEventFramework.GEFE.API.Features; +using KE.GlobalEventFramework.GEFE.API.Features; using MEC; using System; using System.Collections.Generic; @@ -12,7 +12,7 @@ using Utils.NonAllocLINQ; using PlayerHandler = Exiled.Events.Handlers.Player; -namespace KruacentE.GlobalEventFramework.Examples.GE +namespace KE.GlobalEventFramework.Examples.GE { /// /// Everyone has a movement boost effect (stackable) diff --git a/KruacentExiled/KE.GlobalEventFramework.Examples/GE/SystemMalfunction.cs b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/SystemMalfunction.cs index d1ac708d..ae6ae4d8 100644 --- a/KruacentExiled/KE.GlobalEventFramework.Examples/GE/SystemMalfunction.cs +++ b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/SystemMalfunction.cs @@ -1,7 +1,7 @@ using Exiled.API.Features; using Exiled.API.Features.Doors; -using KruacentE.GlobalEventFramework.GEFE.API.Features; -using KruacentE.GlobalEventFramework.GEFE.API.Utils; +using KE.GlobalEventFramework.GEFE.API.Features; +using KE.GlobalEventFramework.GEFE.API.Utils; using MEC; using System.Collections.Generic; using System.Linq; @@ -9,7 +9,7 @@ using Exiled.API.Enums; using Exiled.API.Extensions; -namespace KruacentE.GlobalEventFramework.Examples.GE +namespace KE.GlobalEventFramework.Examples.GE { /// /// The original @@ -67,7 +67,7 @@ private void MoreBlackOutNDoors() if (otherPlugin != null) { - if (otherPlugin is BlackoutKruacent.MainPlugin blackout) + if (otherPlugin is BlackoutNDoor.MainPlugin blackout) { Log.Info("Found BlackOutNDoors"); blackout.ServerHandler.Cooldown = NewCooldown; diff --git a/KruacentExiled/KE.GlobalEventFramework.Examples/MainPlugin.cs b/KruacentExiled/KE.GlobalEventFramework.Examples/MainPlugin.cs index 18a9771f..4ddeef62 100644 --- a/KruacentExiled/KE.GlobalEventFramework.Examples/MainPlugin.cs +++ b/KruacentExiled/KE.GlobalEventFramework.Examples/MainPlugin.cs @@ -5,7 +5,7 @@ using System.Threading.Tasks; using Exiled.API.Features; -namespace GEFE.Examples +namespace KE.GlobalEventFramework.Examples { internal class MainPlugin : Plugin { diff --git a/KruacentExiled/KE.Misc/914.cs b/KruacentExiled/KE.Misc/914.cs index 29e3cba1..b70b8dba 100644 --- a/KruacentExiled/KE.Misc/914.cs +++ b/KruacentExiled/KE.Misc/914.cs @@ -12,7 +12,7 @@ using UnityEngine; using YamlDotNet.Core.Tokens; -namespace KruacentExiled.KruacentE.Misc +namespace KE.Misc { /// /// Everything 914 related diff --git a/KruacentExiled/KE.Misc/AutoElevator.cs b/KruacentExiled/KE.Misc/AutoElevator.cs index a43c9e1c..631c9b9a 100644 --- a/KruacentExiled/KE.Misc/AutoElevator.cs +++ b/KruacentExiled/KE.Misc/AutoElevator.cs @@ -6,7 +6,7 @@ using System.Text; using System.Threading.Tasks; -namespace KruacentExiled.KruacentE.Misc +namespace KE.Misc { /// /// The elevator will random activate in the round diff --git a/KruacentExiled/KE.Misc/ClassDDoor.cs b/KruacentExiled/KE.Misc/ClassDDoor.cs index 4c88085c..11d0a629 100644 --- a/KruacentExiled/KE.Misc/ClassDDoor.cs +++ b/KruacentExiled/KE.Misc/ClassDDoor.cs @@ -9,7 +9,7 @@ using System.Text; using System.Threading.Tasks; -namespace KruacentExiled.KruacentE.Misc +namespace KE.Misc { /// /// Everything about classD door diff --git a/KruacentExiled/KE.Misc/MainPlugin.cs b/KruacentExiled/KE.Misc/MainPlugin.cs index 375c7b47..0c247056 100644 --- a/KruacentExiled/KE.Misc/MainPlugin.cs +++ b/KruacentExiled/KE.Misc/MainPlugin.cs @@ -6,12 +6,8 @@ using MEC; using Exiled.API.Features.Doors; using System.Linq; -using Exiled.API.Interfaces; -using Exiled.Events.EventArgs.Scp914; -using Scp914; using PlayerRoles; using Exiled.Events.EventArgs.Player; -using KruacentExiled.KruacentE.Misc; using System; namespace KE.Misc From 80247c71a28e0c5e8cea1326c48b4d2563c41ec3 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Sun, 29 Dec 2024 17:27:19 +0100 Subject: [PATCH 071/853] Removed useless logs --- .../GEFE/API/Features/GlobalEvent.cs | 3 +-- .../KE.GlobalEventFramework/GEFE/API/Features/Loader.cs | 8 ++------ .../KE.GlobalEventFramework/GEFE/Commands/List.cs | 2 +- 3 files changed, 4 insertions(+), 9 deletions(-) diff --git a/KruacentExiled/KE.GlobalEventFramework/GEFE/API/Features/GlobalEvent.cs b/KruacentExiled/KE.GlobalEventFramework/GEFE/API/Features/GlobalEvent.cs index 4b525a5e..6736a7cd 100644 --- a/KruacentExiled/KE.GlobalEventFramework/GEFE/API/Features/GlobalEvent.cs +++ b/KruacentExiled/KE.GlobalEventFramework/GEFE/API/Features/GlobalEvent.cs @@ -41,8 +41,7 @@ public static void Register(IGlobalEvent globalEvent) Log.Send($"REGISTERING {globalEvent.Name}", Discord.LogLevel.Info, ConsoleColor.Blue); if (GlobalEvents.ContainsKey(globalEvent.Id)) { - Log.Warn($"id already used for {GlobalEvents.TryGetValue(globalEvent.Id, out IGlobalEvent geAlready)}"); - Log.Warn("Trying to attribute a new id..."); + Log.Warn($"id already used"); int key = 0; while (GlobalEvents.ContainsKey(key)) { diff --git a/KruacentExiled/KE.GlobalEventFramework/GEFE/API/Features/Loader.cs b/KruacentExiled/KE.GlobalEventFramework/GEFE/API/Features/Loader.cs index 60747cd3..6337e404 100644 --- a/KruacentExiled/KE.GlobalEventFramework/GEFE/API/Features/Loader.cs +++ b/KruacentExiled/KE.GlobalEventFramework/GEFE/API/Features/Loader.cs @@ -19,22 +19,18 @@ internal void Load() { foreach (IPlugin plugin in Exiled.Loader.Loader.Plugins.Where(pl => pl.Name != MainPlugin.Instance.Name)) { - Log.Debug($"checking {plugin.Name}"); + if(MainPlugin.Instance.Config.ShowRegisteringLog) Log.Debug($"checking {plugin.Name}"); foreach (Type type in plugin.Assembly.GetTypes()) { try { - Log.Debug($" checking {type.Name}"); + if (MainPlugin.Instance.Config.ShowRegisteringLog) Log.Debug($" checking {type.Name}"); if (type.IsSubclassOf(typeof(IGlobalEvent)) || type.IsSubclassOf(typeof(GlobalEvent))) { - Log.Debug("good"); ActivePlugins.Add(plugin); - Log.Debug("creating instance"); IGlobalEvent ge = Activator.CreateInstance(type) as IGlobalEvent; - Log.Debug("registering"); GlobalEvent.Register(ge); - Log.Debug("end register"); } }catch(System.Exception e) { diff --git a/KruacentExiled/KE.GlobalEventFramework/GEFE/Commands/List.cs b/KruacentExiled/KE.GlobalEventFramework/GEFE/Commands/List.cs index 11764b19..fdf91150 100644 --- a/KruacentExiled/KE.GlobalEventFramework/GEFE/Commands/List.cs +++ b/KruacentExiled/KE.GlobalEventFramework/GEFE/Commands/List.cs @@ -16,7 +16,7 @@ public class List : ICommand public bool Execute(ArraySegment arguments, ICommandSender sender, out string response) { - string result = "List of all global event ([o] if it's active in the round ; [ ] otherwise) : "; + string result = "List of all global event ([o] if it's active in the round ; [ ] otherwise) : \n"; foreach (IGlobalEvent ge in GlobalEvent.GlobalEvents.Values) { From 032da33fe5715b07db334011ead87c346122a037 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Tue, 31 Dec 2024 00:50:37 +0100 Subject: [PATCH 072/853] fixes #28 --- .../Handlers/ServerHandler.cs | 36 +++++++++++-------- 1 file changed, 22 insertions(+), 14 deletions(-) diff --git a/KruacentExiled/KE.BlackoutNDoor/Handlers/ServerHandler.cs b/KruacentExiled/KE.BlackoutNDoor/Handlers/ServerHandler.cs index 2b4da5a5..5ecdd79b 100644 --- a/KruacentExiled/KE.BlackoutNDoor/Handlers/ServerHandler.cs +++ b/KruacentExiled/KE.BlackoutNDoor/Handlers/ServerHandler.cs @@ -11,14 +11,18 @@ public class ServerHandler { public int Cooldown { get; set; } = -1 ; internal double ChanceBO { get; set; } = MainPlugin.Instance.Config.InitialChanceBO; - private Controller controller; + private readonly Controller Controller; + private static CoroutineHandle Handle; internal ServerHandler(Controller con) { - controller = con; + Controller = con; } internal void OnRoundStarted() { - Timing.RunCoroutine(Update()); + Log.Debug($"handle = {Handle}"); + Timing.KillCoroutines(Handle); + Handle = Timing.RunCoroutine(Update()); + } @@ -33,21 +37,25 @@ private IEnumerator Update() wait = Cooldown; Log.Debug($"waiting for {wait}"); yield return Timing.WaitForSeconds(wait); - while (true) + while (Round.InProgress) { var a = UnityEngine.Random.value; Log.Debug("random =" + a); - if (a <= ChanceBO) + if (Round.InProgress) { - Log.Debug("BlackOut"); - CoroutineHandle coroutine = Timing.RunCoroutine(controller.RandomBlackout()); - yield return Timing.WaitUntilDone(coroutine); - } - else - { - Log.Debug("DoorStuck"); - CoroutineHandle coroutine = Timing.RunCoroutine(controller.RandomDoorStuck()); - yield return Timing.WaitUntilDone(coroutine); + if (a <= ChanceBO) + { + Log.Debug("BlackOut"); + + CoroutineHandle coroutine = Timing.RunCoroutine(Controller.RandomBlackout()); + yield return Timing.WaitUntilDone(coroutine); + } + else + { + Log.Debug("DoorStuck"); + CoroutineHandle coroutine = Timing.RunCoroutine(Controller.RandomDoorStuck()); + yield return Timing.WaitUntilDone(coroutine); + } } wait = UnityEngine.Random.Range(MainPlugin.Instance.Config.MinInterval, MainPlugin.Instance.Config.MaxInterval); Log.Debug($"waiting : {wait}"); From 7beb1cdbeca288c0c511162c784aa7e2d5c66ef7 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Tue, 31 Dec 2024 02:40:37 +0100 Subject: [PATCH 073/853] fixed #32 --- KruacentExiled/KE.GlobalEventFramework.Examples/GE/KIWIS.cs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/KruacentExiled/KE.GlobalEventFramework.Examples/GE/KIWIS.cs b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/KIWIS.cs index b09fc861..22ef5274 100644 --- a/KruacentExiled/KE.GlobalEventFramework.Examples/GE/KIWIS.cs +++ b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/KIWIS.cs @@ -35,12 +35,15 @@ public override IEnumerator Start() }); yield return Timing.WaitUntilTrue(() => Round.ElapsedTime.TotalMinutes >= 15); + + listScp = listScp.Where(p => p.Key.IsScp && p.Key.Role.Type != RoleTypeId.Scp0492).ToList().ToDictionary(p => p.Key, p => p.Value); listScp.ForEach(k => { k.Key.MaxHealth += k.Value; k.Key.Heal(k.Value); }); yield return Timing.WaitUntilTrue(() => Round.ElapsedTime.TotalMinutes >= 30); + listScp = listScp.Where(p => p.Key.IsScp && p.Key.Role.Type != RoleTypeId.Scp0492).ToList().ToDictionary(p => p.Key, p => p.Value); listScp.ForEach(k => { k.Key.MaxHealth += k.Value; k.Key.Heal(k.Value); From e751b4fd68b295e4c59aef2f2a50be1959bb4d11 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Tue, 31 Dec 2024 04:07:00 +0100 Subject: [PATCH 074/853] fix #30 --- .../KE.BlackoutNDoor/API/Features/Controller.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/KruacentExiled/KE.BlackoutNDoor/API/Features/Controller.cs b/KruacentExiled/KE.BlackoutNDoor/API/Features/Controller.cs index 79b70184..387d1a6a 100644 --- a/KruacentExiled/KE.BlackoutNDoor/API/Features/Controller.cs +++ b/KruacentExiled/KE.BlackoutNDoor/API/Features/Controller.cs @@ -10,7 +10,7 @@ namespace KE.BlackoutNDoor.API.Features { public class Controller { - + private DoorType[] BlacklistedDoor = { DoorType.ElevatorGateA, DoorType.ElevatorGateB, DoorType.ElevatorLczA, DoorType.ElevatorLczB, DoorType.ElevatorNuke, DoorType.ElevatorScp049, DoorType.UnknownElevator }; /// /// Select a random zone and close and lock all door of the zone @@ -27,19 +27,19 @@ internal IEnumerator RandomDoorStuck() // if the zone is light and there is only 30s left then skip if (!(zone == ZoneType.LightContainment && Map.DecontaminationState == DecontaminationState.Countdown && Warhead.IsInProgress)) { - List doorList = Door.List - .Where(d => !new[] { DoorType.ElevatorGateA, DoorType.ElevatorGateB, DoorType.ElevatorLczA, DoorType.ElevatorLczB, DoorType.ElevatorNuke, DoorType.ElevatorScp049, DoorType.UnknownElevator }.Contains(d.Type)) + .Where(d => !BlacklistedDoor.Contains(d.Type)) .ToList(); var ge = Generator.List.Where(g => g.IsEngaged); if(ge.ToList().Count != 3) { doorList = Door.List - .Where(d => !new[] { DoorType.Scp079First, DoorType.Scp079Second }.Contains(d.Type)) + .Where(d => !BlacklistedDoor.Union(new[] { DoorType.Scp079First, DoorType.Scp079Second }).Contains(d.Type)) .ToList(); } foreach (Door door in doorList) { + if (door.Zone == zone) { door.IsOpen = false; From 721cf2876180deec031aa5ec1f32aa2e5d58f439 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Tue, 31 Dec 2024 04:18:58 +0100 Subject: [PATCH 075/853] fixed an issue where the cooldown stayed at the newCooldown set by SystemMalfunction even if the GE was not in the round --- .../GE/SystemMalfunction.cs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/KruacentExiled/KE.GlobalEventFramework.Examples/GE/SystemMalfunction.cs b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/SystemMalfunction.cs index ae6ae4d8..7788b58a 100644 --- a/KruacentExiled/KE.GlobalEventFramework.Examples/GE/SystemMalfunction.cs +++ b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/SystemMalfunction.cs @@ -49,7 +49,21 @@ public override IEnumerator Start() yield return Timing.WaitUntilDone(handle); } + + + } + public override void UnsubscribeEvent() + { + var otherPlugin = Exiled.Loader.Loader.Plugins.FirstOrDefault(plugin => plugin.Name == "KE.BlackoutDoor"); + if (otherPlugin != null) + { + + if (otherPlugin is BlackoutNDoor.MainPlugin blackout) + { + blackout.ServerHandler.Cooldown = -1; + } + } } private IEnumerator EarlyNuke() From d2f1f8701ac6ad7411ca01e57aa62af238860660 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Tue, 31 Dec 2024 12:39:44 +0100 Subject: [PATCH 076/853] Revert "Removed useless logs" This reverts commit 80247c71a28e0c5e8cea1326c48b4d2563c41ec3. --- .../GEFE/API/Features/GlobalEvent.cs | 3 ++- .../KE.GlobalEventFramework/GEFE/API/Features/Loader.cs | 8 ++++++-- .../KE.GlobalEventFramework/GEFE/Commands/List.cs | 2 +- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/KruacentExiled/KE.GlobalEventFramework/GEFE/API/Features/GlobalEvent.cs b/KruacentExiled/KE.GlobalEventFramework/GEFE/API/Features/GlobalEvent.cs index 6736a7cd..4b525a5e 100644 --- a/KruacentExiled/KE.GlobalEventFramework/GEFE/API/Features/GlobalEvent.cs +++ b/KruacentExiled/KE.GlobalEventFramework/GEFE/API/Features/GlobalEvent.cs @@ -41,7 +41,8 @@ public static void Register(IGlobalEvent globalEvent) Log.Send($"REGISTERING {globalEvent.Name}", Discord.LogLevel.Info, ConsoleColor.Blue); if (GlobalEvents.ContainsKey(globalEvent.Id)) { - Log.Warn($"id already used"); + Log.Warn($"id already used for {GlobalEvents.TryGetValue(globalEvent.Id, out IGlobalEvent geAlready)}"); + Log.Warn("Trying to attribute a new id..."); int key = 0; while (GlobalEvents.ContainsKey(key)) { diff --git a/KruacentExiled/KE.GlobalEventFramework/GEFE/API/Features/Loader.cs b/KruacentExiled/KE.GlobalEventFramework/GEFE/API/Features/Loader.cs index 6337e404..60747cd3 100644 --- a/KruacentExiled/KE.GlobalEventFramework/GEFE/API/Features/Loader.cs +++ b/KruacentExiled/KE.GlobalEventFramework/GEFE/API/Features/Loader.cs @@ -19,18 +19,22 @@ internal void Load() { foreach (IPlugin plugin in Exiled.Loader.Loader.Plugins.Where(pl => pl.Name != MainPlugin.Instance.Name)) { - if(MainPlugin.Instance.Config.ShowRegisteringLog) Log.Debug($"checking {plugin.Name}"); + Log.Debug($"checking {plugin.Name}"); foreach (Type type in plugin.Assembly.GetTypes()) { try { - if (MainPlugin.Instance.Config.ShowRegisteringLog) Log.Debug($" checking {type.Name}"); + Log.Debug($" checking {type.Name}"); if (type.IsSubclassOf(typeof(IGlobalEvent)) || type.IsSubclassOf(typeof(GlobalEvent))) { + Log.Debug("good"); ActivePlugins.Add(plugin); + Log.Debug("creating instance"); IGlobalEvent ge = Activator.CreateInstance(type) as IGlobalEvent; + Log.Debug("registering"); GlobalEvent.Register(ge); + Log.Debug("end register"); } }catch(System.Exception e) { diff --git a/KruacentExiled/KE.GlobalEventFramework/GEFE/Commands/List.cs b/KruacentExiled/KE.GlobalEventFramework/GEFE/Commands/List.cs index fdf91150..11764b19 100644 --- a/KruacentExiled/KE.GlobalEventFramework/GEFE/Commands/List.cs +++ b/KruacentExiled/KE.GlobalEventFramework/GEFE/Commands/List.cs @@ -16,7 +16,7 @@ public class List : ICommand public bool Execute(ArraySegment arguments, ICommandSender sender, out string response) { - string result = "List of all global event ([o] if it's active in the round ; [ ] otherwise) : \n"; + string result = "List of all global event ([o] if it's active in the round ; [ ] otherwise) : "; foreach (IGlobalEvent ge in GlobalEvent.GlobalEvents.Values) { From 7e89c659f95f6bffbd5da7b601ccbaaf8ef1172c Mon Sep 17 00:00:00 2001 From: Omer <113857370+OmerGS@users.noreply.github.com> Date: Tue, 31 Dec 2024 14:42:35 +0100 Subject: [PATCH 077/853] Update README.md --- README.md | 48 +++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 39 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 8b8a26f5..95b795d1 100644 --- a/README.md +++ b/README.md @@ -1,15 +1,45 @@ -# KruacentExiled ---- +

+ GitHub Profile Photo +

-This repo was made for our small (6 players) private SCP:SL server using the Exiled Framework. +

Kruaçent-Exiled

+
-## Global Event Framework +

Kruaçent-Exiled is a plugin using the Exiled Framework for SCP: Secret Laboratory servers. The plugin was initially created for our small (6-player) private SCP:SL servers

-the Global Event Framework (GEF) is made to add Global Events which are tweaks in the gameplay which is revealed at the start of each round. +
+
+

-## Blackout 'N Door -This plugin was made to avoid camping on surface and avoid the sole SCP being stuck. +

project-image

-## Armes (Weapons) -Created new custom weapon will probably renamed it to item when we get item +

shieldsshields

+ +

🧐 Features

+ +Here're some of the project's features: + +* **Global Event Framework** : The Global Event Framework is designed to introduce Global Events which are gameplay modifications revealed at the beginning of each round. You can easily create your own custom Global Events with dozens of examples provided. +* **BlackoutNDoor** : The BlackoutNDoor introduces new door and light systems. The lights randomly turn off/on and the doors can randomly open and close. +* **Custom Items** : The Customs Items add differents new guns and stuff in the game. You can easily create your own Custom Items with dozens of examples provided. +* **Miscellaneous** : The Miscellaneous plugin changes the game settings such as new inputs and outputs for human in 914 explosive D-Class cells the elevators that can move on its own and new announcements for specific players deaths. + +

🛠️ Installation Steps:

+ +

1. Download the DLL you want to use from the latest release.

+ +

2. Go to Exiled/Plugins and place the DLL there.

+ +

3. Restart your SCP:SL server.

+ +

4. The plugin will now be in your server.

+ + +

🛡️ License:

+ +This project is licensed under the Apache License + +
+
+
From 17d063b2d01aa7e91ec9cb97dff468fb8eac21c1 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Tue, 31 Dec 2024 15:00:22 +0100 Subject: [PATCH 078/853] creating custom role project --- KruacentExiled/KE.CustomRoles/Class1.cs | 7 +++++++ .../KE.CustomRoles/KE.CustomRoles.csproj | 16 ++++++++++++++++ KruacentExiled/KruacentExiled.sln | 6 ++++++ 3 files changed, 29 insertions(+) create mode 100644 KruacentExiled/KE.CustomRoles/Class1.cs create mode 100644 KruacentExiled/KE.CustomRoles/KE.CustomRoles.csproj diff --git a/KruacentExiled/KE.CustomRoles/Class1.cs b/KruacentExiled/KE.CustomRoles/Class1.cs new file mode 100644 index 00000000..37683936 --- /dev/null +++ b/KruacentExiled/KE.CustomRoles/Class1.cs @@ -0,0 +1,7 @@ +namespace KE.CustomRoles +{ + public class Class1 + { + + } +} diff --git a/KruacentExiled/KE.CustomRoles/KE.CustomRoles.csproj b/KruacentExiled/KE.CustomRoles/KE.CustomRoles.csproj new file mode 100644 index 00000000..3dc6ba7d --- /dev/null +++ b/KruacentExiled/KE.CustomRoles/KE.CustomRoles.csproj @@ -0,0 +1,16 @@ + + + net48 + + + + + + + + + + + + + diff --git a/KruacentExiled/KruacentExiled.sln b/KruacentExiled/KruacentExiled.sln index 135e1e35..41509eae 100644 --- a/KruacentExiled/KruacentExiled.sln +++ b/KruacentExiled/KruacentExiled.sln @@ -13,6 +13,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "KE.GlobalEventFramework", " EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "KE.GlobalEventFramework.Examples", "KE.GlobalEventFramework.Examples\KE.GlobalEventFramework.Examples.csproj", "{07B92E87-F48F-4F9F-BA0E-1BCB2AF52F53}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "KE.CustomRoles", "KE.CustomRoles\KE.CustomRoles.csproj", "{4AA4C3E0-E62F-49CE-AD80-0B5C6249EB48}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -39,6 +41,10 @@ Global {07B92E87-F48F-4F9F-BA0E-1BCB2AF52F53}.Debug|Any CPU.Build.0 = Debug|Any CPU {07B92E87-F48F-4F9F-BA0E-1BCB2AF52F53}.Release|Any CPU.ActiveCfg = Release|Any CPU {07B92E87-F48F-4F9F-BA0E-1BCB2AF52F53}.Release|Any CPU.Build.0 = Release|Any CPU + {4AA4C3E0-E62F-49CE-AD80-0B5C6249EB48}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {4AA4C3E0-E62F-49CE-AD80-0B5C6249EB48}.Debug|Any CPU.Build.0 = Debug|Any CPU + {4AA4C3E0-E62F-49CE-AD80-0B5C6249EB48}.Release|Any CPU.ActiveCfg = Release|Any CPU + {4AA4C3E0-E62F-49CE-AD80-0B5C6249EB48}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE From 685cf2cf6e2f9cb168fce62d7cd30c86174b3664 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Tue, 31 Dec 2024 16:07:20 +0100 Subject: [PATCH 079/853] tried adding Guard914 (crashes when trying to give it at spawn (Exiled's fault not mine)) --- KruacentExiled/KE.CustomRoles/CR/Guard914.cs | 40 +++++++++++++++++++ KruacentExiled/KE.CustomRoles/Class1.cs | 7 ---- KruacentExiled/KE.CustomRoles/Config.cs | 15 +++++++ .../KE.CustomRoles/KE.CustomRoles.csproj | 8 ++-- KruacentExiled/KE.CustomRoles/MainPlugin.cs | 33 +++++++++++++++ 5 files changed, 92 insertions(+), 11 deletions(-) create mode 100644 KruacentExiled/KE.CustomRoles/CR/Guard914.cs delete mode 100644 KruacentExiled/KE.CustomRoles/Class1.cs create mode 100644 KruacentExiled/KE.CustomRoles/Config.cs create mode 100644 KruacentExiled/KE.CustomRoles/MainPlugin.cs diff --git a/KruacentExiled/KE.CustomRoles/CR/Guard914.cs b/KruacentExiled/KE.CustomRoles/CR/Guard914.cs new file mode 100644 index 00000000..d62b2a79 --- /dev/null +++ b/KruacentExiled/KE.CustomRoles/CR/Guard914.cs @@ -0,0 +1,40 @@ +using Exiled.API.Features.Attributes; +using Exiled.API.Features.Spawn; +using PlayerRoles; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace KE.CustomRoles.CR +{ + [CustomRole(RoleTypeId.FacilityGuard)] + internal class Guard914 : Exiled.CustomRoles.API.Features.CustomRole + { + public override string Name { get; set; } = "guard914"; + public override string Description { get; set; } = "Tu es Le garde de SCP-914 \nTu commences à 914 \nmais on a volé ta carte \net ntm aussi"; + public override uint Id { get; set; } = 1; + public override string CustomInfo { get; set; } = "Garde de 914"; + public override int MaxHealth { get; set; } = 100; + public override RoleTypeId Role { get; set; } = RoleTypeId.FacilityGuard; + public override bool KeepRoleOnDeath { get ; set ; } = false; + public override bool KeepRoleOnChangingRole { get; set; } = false; + + public override SpawnProperties SpawnProperties { get; set; } = new SpawnProperties() + { + DynamicSpawnPoints = new List() + { + new DynamicSpawnPoint() + { + Location = Exiled.API.Enums.SpawnLocationType.Inside914, + Chance = 100, + } + } + }; + + public override float SpawnChance { get; set; } = 100; + + + } +} diff --git a/KruacentExiled/KE.CustomRoles/Class1.cs b/KruacentExiled/KE.CustomRoles/Class1.cs deleted file mode 100644 index 37683936..00000000 --- a/KruacentExiled/KE.CustomRoles/Class1.cs +++ /dev/null @@ -1,7 +0,0 @@ -namespace KE.CustomRoles -{ - public class Class1 - { - - } -} diff --git a/KruacentExiled/KE.CustomRoles/Config.cs b/KruacentExiled/KE.CustomRoles/Config.cs new file mode 100644 index 00000000..b5634b10 --- /dev/null +++ b/KruacentExiled/KE.CustomRoles/Config.cs @@ -0,0 +1,15 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Exiled.API.Interfaces; + +namespace KE.CustomRoles +{ + public class Config : IConfig + { + public bool IsEnabled { get; set; } = true; + public bool Debug { get; set; } = true; + } +} diff --git a/KruacentExiled/KE.CustomRoles/KE.CustomRoles.csproj b/KruacentExiled/KE.CustomRoles/KE.CustomRoles.csproj index 3dc6ba7d..a5fbc0e2 100644 --- a/KruacentExiled/KE.CustomRoles/KE.CustomRoles.csproj +++ b/KruacentExiled/KE.CustomRoles/KE.CustomRoles.csproj @@ -1,4 +1,4 @@ - + net48 @@ -8,9 +8,9 @@ - - - + + + diff --git a/KruacentExiled/KE.CustomRoles/MainPlugin.cs b/KruacentExiled/KE.CustomRoles/MainPlugin.cs new file mode 100644 index 00000000..47df022b --- /dev/null +++ b/KruacentExiled/KE.CustomRoles/MainPlugin.cs @@ -0,0 +1,33 @@ +using Exiled.API.Features; +using Exiled.CustomRoles.API.Features; +using KE.CustomRoles.CR; +using System.ComponentModel; + + +namespace KE.CustomRoles +{ + public class MainPlugin : Plugin + { + public override string Name { get; } = "KE.CustomRoles"; + public static MainPlugin Instance; + + public override void OnEnabled() + { + + Instance = this; + + CustomRole.RegisterRoles(false,null); + + base.OnEnabled(); + } + + public override void OnDisabled() + { + + CustomRole.UnregisterRoles(); + + Instance = null; + base.OnDisabled(); + } + } +} From c4f7d905987fbe202594b97510fa25f62102fa60 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Tue, 31 Dec 2024 16:27:20 +0100 Subject: [PATCH 080/853] fix #33 --- .../KE.GlobalEventFramework.Examples/GE/OpenBar.cs | 1 + .../GE/SystemMalfunction.cs | 2 ++ .../GEFE/API/Features/GlobalEvent.cs | 3 +++ .../GEFE/API/Interfaces/IGlobalEvent.cs | 5 +++++ KruacentExiled/KE.GlobalEventFramework/MainPlugin.cs | 5 +++-- KruacentExiled/KruacentExiled.sln | 6 ++++++ 6 files changed, 20 insertions(+), 2 deletions(-) diff --git a/KruacentExiled/KE.GlobalEventFramework.Examples/GE/OpenBar.cs b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/OpenBar.cs index 1a558685..0cbd67ba 100644 --- a/KruacentExiled/KE.GlobalEventFramework.Examples/GE/OpenBar.cs +++ b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/OpenBar.cs @@ -17,6 +17,7 @@ public class OpenBar : GlobalEvent public override string Name { get; set; } = "OpenBar"; public override string Description { get; set; } = "j'espère que vous avez pas prévu de kampé"; public override int Weight { get; set; } = 1; + public override int[] IncompatibleGE { get; set; } = { 1 }; public override IEnumerator Start() { var doors = Door.List.Where(d => new[] { DoorType.GateA, DoorType.GateB, DoorType.HczArmory, DoorType.HIDChamber,DoorType.Intercom,DoorType.Scp049Armory,DoorType.Scp096,DoorType.Scp106Primary,DoorType.Scp106Secondary,DoorType.Scp330,DoorType.Scp330Chamber,DoorType.Scp914Gate }.Contains(d.Type)).ToList(); diff --git a/KruacentExiled/KE.GlobalEventFramework.Examples/GE/SystemMalfunction.cs b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/SystemMalfunction.cs index 7788b58a..1cd00853 100644 --- a/KruacentExiled/KE.GlobalEventFramework.Examples/GE/SystemMalfunction.cs +++ b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/SystemMalfunction.cs @@ -34,6 +34,8 @@ public class SystemMalfunction : GlobalEvent /// Set the cooldown for the BlackoutNDoor ///
public int NewCooldown { get; set; } = 180; + + public override int[] IncompatibleGE { get; set; } = { 38 }; /// public override IEnumerator Start() { diff --git a/KruacentExiled/KE.GlobalEventFramework/GEFE/API/Features/GlobalEvent.cs b/KruacentExiled/KE.GlobalEventFramework/GEFE/API/Features/GlobalEvent.cs index 4b525a5e..42a534bd 100644 --- a/KruacentExiled/KE.GlobalEventFramework/GEFE/API/Features/GlobalEvent.cs +++ b/KruacentExiled/KE.GlobalEventFramework/GEFE/API/Features/GlobalEvent.cs @@ -35,6 +35,9 @@ public class GlobalEvent : IGlobalEvent public virtual string Description { get; set; } = "DESC NOT SET"; /// public virtual int Weight { get; set; } = 1; + /// + public virtual int[] IncompatibleGE { get; set; } = new int[0]; + public static void Register(IGlobalEvent globalEvent) { diff --git a/KruacentExiled/KE.GlobalEventFramework/GEFE/API/Interfaces/IGlobalEvent.cs b/KruacentExiled/KE.GlobalEventFramework/GEFE/API/Interfaces/IGlobalEvent.cs index 15dfce21..890605e3 100644 --- a/KruacentExiled/KE.GlobalEventFramework/GEFE/API/Interfaces/IGlobalEvent.cs +++ b/KruacentExiled/KE.GlobalEventFramework/GEFE/API/Interfaces/IGlobalEvent.cs @@ -27,6 +27,11 @@ public interface IGlobalEvent /// The chance this GE will be choosed at the start of a round ///
int Weight { get; set; } + /// + /// The ids of incompatible Globals Events + /// Note: You can't have the same GE twice in the same round + /// + int[] IncompatibleGE { get; set; } /// /// Is launched at the start of a round diff --git a/KruacentExiled/KE.GlobalEventFramework/MainPlugin.cs b/KruacentExiled/KE.GlobalEventFramework/MainPlugin.cs index b4dbcc8e..c7b7e906 100644 --- a/KruacentExiled/KE.GlobalEventFramework/MainPlugin.cs +++ b/KruacentExiled/KE.GlobalEventFramework/MainPlugin.cs @@ -115,7 +115,7 @@ public List ChooseGE(int numberOfGlobalEvent = 1) { Log.Info(ge.Name); var a = Timing.RunCoroutine(ge.Start()); - GlobalEvent.coroutineHandles.Add(a); //crash when using other ge from other assembly + GlobalEvent.coroutineHandles.Add(a); } return activeGE; } @@ -144,7 +144,8 @@ private List ChooseRandomGE(int nbGE = 1) result.Add(selectedGE); weightedPool.RemoveAll(e => e == selectedGE); - } + weightedPool.RemoveAll(e => selectedGE.IncompatibleGE.Contains(e.Id)); + } // Step 3: Update the active global events GlobalEvent.ActiveGE = result.ToList(); diff --git a/KruacentExiled/KruacentExiled.sln b/KruacentExiled/KruacentExiled.sln index 135e1e35..4f5fb931 100644 --- a/KruacentExiled/KruacentExiled.sln +++ b/KruacentExiled/KruacentExiled.sln @@ -13,6 +13,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "KE.GlobalEventFramework", " EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "KE.GlobalEventFramework.Examples", "KE.GlobalEventFramework.Examples\KE.GlobalEventFramework.Examples.csproj", "{07B92E87-F48F-4F9F-BA0E-1BCB2AF52F53}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "KE.CustomRoles", "KE.CustomRoles\KE.CustomRoles.csproj", "{D43DC96A-6034-45EB-B39E-6B291BD0A07C}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -39,6 +41,10 @@ Global {07B92E87-F48F-4F9F-BA0E-1BCB2AF52F53}.Debug|Any CPU.Build.0 = Debug|Any CPU {07B92E87-F48F-4F9F-BA0E-1BCB2AF52F53}.Release|Any CPU.ActiveCfg = Release|Any CPU {07B92E87-F48F-4F9F-BA0E-1BCB2AF52F53}.Release|Any CPU.Build.0 = Release|Any CPU + {D43DC96A-6034-45EB-B39E-6B291BD0A07C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {D43DC96A-6034-45EB-B39E-6B291BD0A07C}.Debug|Any CPU.Build.0 = Debug|Any CPU + {D43DC96A-6034-45EB-B39E-6B291BD0A07C}.Release|Any CPU.ActiveCfg = Release|Any CPU + {D43DC96A-6034-45EB-B39E-6B291BD0A07C}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE From 3fe102a17960b3ce8c9d16b8790d85540bfd97ce Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Wed, 1 Jan 2025 17:37:08 +0100 Subject: [PATCH 081/853] added commands fixed the Registering logs BREAKING CHANGE : restricted registering GE if already exist reorganized globalEvent --- .../GE/Blitz.cs | 2 +- .../GE/Impostor.cs | 2 +- .../GE/KIWIS.cs | 2 +- .../GE/OpenBar.cs | 2 +- .../KE.GlobalEventFramework.Examples/GE/R.cs | 2 +- .../GE/RandomSpawn.cs | 2 +- .../GE/Shuffle.cs | 2 +- .../GE/Speed.cs | 2 +- .../GE/SystemMalfunction.cs | 2 +- .../GEFE/API/Features/GlobalEvent.cs | 201 ++++++++++++++---- .../GEFE/API/Features/Loader.cs | 11 +- .../GEFE/Commands/ForceGE.cs | 65 ++++++ .../GEFE/Commands/ForceNbGE.cs | 61 ++++++ .../GEFE/Commands/{List.cs => ListGE.cs} | 4 +- .../GEFE/Commands/ParentCommandGEFE.cs | 6 +- .../GEFE/Handlers/ServerHandler.cs | 56 +++-- .../KE.GlobalEventFramework/MainPlugin.cs | 92 +------- 17 files changed, 341 insertions(+), 173 deletions(-) create mode 100644 KruacentExiled/KE.GlobalEventFramework/GEFE/Commands/ForceGE.cs create mode 100644 KruacentExiled/KE.GlobalEventFramework/GEFE/Commands/ForceNbGE.cs rename KruacentExiled/KE.GlobalEventFramework/GEFE/Commands/{List.cs => ListGE.cs} (93%) diff --git a/KruacentExiled/KE.GlobalEventFramework.Examples/GE/Blitz.cs b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/Blitz.cs index cfc0eddf..fd8d1307 100644 --- a/KruacentExiled/KE.GlobalEventFramework.Examples/GE/Blitz.cs +++ b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/Blitz.cs @@ -16,7 +16,7 @@ namespace KE.GlobalEventFramework.Examples.GE public class Blitz : GlobalEvent { /// - public override int Id { get; set; } = 1; + public override int Id { get; set; } = 1046; /// public override string Name { get; set; } = "Blitz"; /// diff --git a/KruacentExiled/KE.GlobalEventFramework.Examples/GE/Impostor.cs b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/Impostor.cs index 89ee6f6a..64b11459 100644 --- a/KruacentExiled/KE.GlobalEventFramework.Examples/GE/Impostor.cs +++ b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/Impostor.cs @@ -10,7 +10,7 @@ namespace KE.GlobalEventFramework.Examples.GE { public class Impostor : GlobalEvent { - public override int Id { get; set; } = 30; + public override int Id { get; set; } = 1044; public override string Name { get; set; } = "Impostor"; public override string Description { get; set; } = "Ne vous fiez pas aux apparences !"; public override int Weight { get; set; } = 1; diff --git a/KruacentExiled/KE.GlobalEventFramework.Examples/GE/KIWIS.cs b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/KIWIS.cs index 22ef5274..ea9c137d 100644 --- a/KruacentExiled/KE.GlobalEventFramework.Examples/GE/KIWIS.cs +++ b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/KIWIS.cs @@ -15,7 +15,7 @@ namespace KE.GlobalEventFramework.Examples.GE public class KIWIS : GlobalEvent { /// - public override int Id { get; set; } = 32; + public override int Id { get; set; } = 1047; /// public override string Name { get; set; } = "KIWIS"; /// diff --git a/KruacentExiled/KE.GlobalEventFramework.Examples/GE/OpenBar.cs b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/OpenBar.cs index 0cbd67ba..a8d868a7 100644 --- a/KruacentExiled/KE.GlobalEventFramework.Examples/GE/OpenBar.cs +++ b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/OpenBar.cs @@ -13,7 +13,7 @@ namespace KE.GlobalEventFramework.Examples.GE { public class OpenBar : GlobalEvent { - public override int Id { get; set; } = 38; + public override int Id { get; set; } = 1048; public override string Name { get; set; } = "OpenBar"; public override string Description { get; set; } = "j'espère que vous avez pas prévu de kampé"; public override int Weight { get; set; } = 1; diff --git a/KruacentExiled/KE.GlobalEventFramework.Examples/GE/R.cs b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/R.cs index ec4ab613..107ccd9d 100644 --- a/KruacentExiled/KE.GlobalEventFramework.Examples/GE/R.cs +++ b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/R.cs @@ -9,7 +9,7 @@ namespace KE.GlobalEventFramework.Examples.GE public class R : GlobalEvent { /// - public override int Id { get; set; } = 32; + public override int Id { get; set; } = 0; /// public override string Name { get; set; } = "nothing"; /// diff --git a/KruacentExiled/KE.GlobalEventFramework.Examples/GE/RandomSpawn.cs b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/RandomSpawn.cs index fe31b79b..e35dd5fc 100644 --- a/KruacentExiled/KE.GlobalEventFramework.Examples/GE/RandomSpawn.cs +++ b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/RandomSpawn.cs @@ -16,7 +16,7 @@ namespace KE.GlobalEventFramework.Examples.GE public class RandomSpawn : GlobalEvent { /// - public override int Id { get; set; } = 32; + public override int Id { get; set; } = 1043; /// public override string Name { get; set; } = "RandomSpawn"; /// diff --git a/KruacentExiled/KE.GlobalEventFramework.Examples/GE/Shuffle.cs b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/Shuffle.cs index 12e6d505..449e86ff 100644 --- a/KruacentExiled/KE.GlobalEventFramework.Examples/GE/Shuffle.cs +++ b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/Shuffle.cs @@ -16,7 +16,7 @@ namespace KE.GlobalEventFramework.Examples.GE public class Shuffle : GlobalEvent { /// - public override int Id { get; set; } = 31; + public override int Id { get; set; } = 1045; /// public override string Name { get; set; } = "Shuffle"; /// diff --git a/KruacentExiled/KE.GlobalEventFramework.Examples/GE/Speed.cs b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/Speed.cs index a9152fb6..89799d6c 100644 --- a/KruacentExiled/KE.GlobalEventFramework.Examples/GE/Speed.cs +++ b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/Speed.cs @@ -21,7 +21,7 @@ namespace KE.GlobalEventFramework.Examples.GE public class Speed : GlobalEvent { /// - public override int Id { get; set; } = 30; + public override int Id { get; set; } = 1042; /// public override string Name { get; set; } = "Speed"; /// diff --git a/KruacentExiled/KE.GlobalEventFramework.Examples/GE/SystemMalfunction.cs b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/SystemMalfunction.cs index 1cd00853..4ffa0841 100644 --- a/KruacentExiled/KE.GlobalEventFramework.Examples/GE/SystemMalfunction.cs +++ b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/SystemMalfunction.cs @@ -23,7 +23,7 @@ namespace KE.GlobalEventFramework.Examples.GE public class SystemMalfunction : GlobalEvent { /// - public override int Id { get; set; } = 1; + public override int Id { get; set; } = 1041; /// public override string Name { get; set; } = "System Malfunction"; /// diff --git a/KruacentExiled/KE.GlobalEventFramework/GEFE/API/Features/GlobalEvent.cs b/KruacentExiled/KE.GlobalEventFramework/GEFE/API/Features/GlobalEvent.cs index 42a534bd..176df78a 100644 --- a/KruacentExiled/KE.GlobalEventFramework/GEFE/API/Features/GlobalEvent.cs +++ b/KruacentExiled/KE.GlobalEventFramework/GEFE/API/Features/GlobalEvent.cs @@ -3,18 +3,11 @@ using System.Linq; using MEC; using KE.GlobalEventFramework.GEFE.API.Interfaces; -using Exiled.CustomItems.API.Features; -using System.Reflection; -using Exiled.API.Features.Attributes; -using Exiled.API.Interfaces; -using System.Collections; using System; -using Exiled.API.Extensions; -using Exiled.API.Features.Pools; namespace KE.GlobalEventFramework.GEFE.API.Features { - public class GlobalEvent : IGlobalEvent + public abstract class GlobalEvent : IGlobalEvent { /// /// A list of Active GlobalEvents @@ -22,80 +15,194 @@ public class GlobalEvent : IGlobalEvent public static List ActiveGlobalEvents => ActiveGE.ToList(); internal static List ActiveGE { get; set; } = new List(); internal static List coroutineHandles = new List(); - internal static Dictionary GlobalEvents { get; set; } = new Dictionary(); + internal static Dictionary GlobalEvents { get; private set; } = new Dictionary(); /// /// A list of all registered GlobalEvents /// public static List GlobalEventsList => GlobalEvents.Values.ToList(); /// - public virtual int Id { get; set; } = -1; + public abstract int Id { get; set; } /// - public virtual string Name { get; set; } = "GE NOT SET"; + public abstract string Name { get; set; } /// - public virtual string Description { get; set; } = "DESC NOT SET"; + public abstract string Description { get; set; } /// - public virtual int Weight { get; set; } = 1; + public abstract int Weight { get; set; } /// public virtual int[] IncompatibleGE { get; set; } = new int[0]; + + /// + public virtual IEnumerator Start() + { + if (MainPlugin.Instance.Config.Debug) Log.Error($"{GetType().Name} Start is NOT overrided"); + yield return 0; + } + /// + public virtual void SubscribeEvent() + { + if (MainPlugin.Instance.Config.Debug) Log.Warn($"{GetType().Name} : SubscribeEvent is NOT overrided"); + } + /// + public virtual void UnsubscribeEvent() + { + if (MainPlugin.Instance.Config.Debug) Log.Warn($"{GetType().Name} : UnsubscribeEvent is NOT overrided"); + } public static void Register(IGlobalEvent globalEvent) { Log.Send($"REGISTERING {globalEvent.Name}", Discord.LogLevel.Info, ConsoleColor.Blue); if (GlobalEvents.ContainsKey(globalEvent.Id)) { - Log.Warn($"id already used for {GlobalEvents.TryGetValue(globalEvent.Id, out IGlobalEvent geAlready)}"); - Log.Warn("Trying to attribute a new id..."); - int key = 0; - while (GlobalEvents.ContainsKey(key)) - { - key++; - } - globalEvent.Id = key; - Log.Warn($"new id of {globalEvent.Name} : {globalEvent.Id}"); + Log.Error($"{globalEvent.Name}'s id is already registered by {Get(globalEvent.Id)}"); + return; } GlobalEvents.Add(globalEvent.Id, globalEvent); Log.Info($"{globalEvent.Name} is registered"); } + public static void Register(List globalEvents) { globalEvents.ForEach(globalEvent => Register(globalEvent)); } - /// - public virtual IEnumerator Start() + + /// + /// Stop all Coroutine from GE + /// + internal static void StopCoroutines() { - Log.Error($"{GetType().Name} Start is NOT overrided"); - yield return Timing.WaitForSeconds(30f); + coroutineHandles.ForEach(coroutineHandle => + { + Timing.KillCoroutines(coroutineHandle); + }); } - /// - public virtual void SubscribeEvent() + + public static bool TryGet(int id, out IGlobalEvent globalEvent) { - Log.Warn($"{GetType().Name} : SubscribeEvent is NOT overrided"); + globalEvent = Get(id); + return globalEvent != null; } - /// - public virtual void UnsubscribeEvent() + + public static bool TryGet(string name, out IGlobalEvent globalEvent) { - Log.Warn($"{GetType().Name} : UnsubscribeEvent is NOT overrided"); + if (string.IsNullOrEmpty(name)) + { + throw new System.Exception("name can't be null or empty"); + } + globalEvent = int.TryParse(name, out int id) ? Get(id) : Get(name); + + return globalEvent != null; } - /// - /// Create new List/Dictionary for the Global Event storage - /// - internal void Clean() + + public static IGlobalEvent Get(string name) { - GlobalEvents = new Dictionary(); - ActiveGE = new List(); + return GlobalEvents.Values.FirstOrDefault(ge => ge.Name == name); } - /// - /// Stop all Coroutine from GE - /// - internal static void StopCoroutines() - { - coroutineHandles.ForEach(coroutineHandle => - { - Timing.KillCoroutines(coroutineHandle); - }); + public static IGlobalEvent Get(int id) + { + return GlobalEvents.TryGetValue(id, out IGlobalEvent globalEvent) ? globalEvent : null; + } + + private static void Show() + { + var random = UnityEngine.Random.value; + + foreach (Player player in Player.List) + { + Exiled.API.Features.Broadcast b = new Exiled.API.Features.Broadcast + { + Content = ShowText(random > .5f), + Duration = 10 + }; + player.Broadcast(b); + } + } + + private static String ShowText(bool redacted = false) + { + String result = "Global Events: "; + Log.Info($"Global Event(s) ({ActiveGE.Count()}): "); + for (int i = 0; i < ActiveGE.Count(); i++) + { + Log.Info(ActiveGE[i].Name); + if (redacted) + { + result += ActiveGE[i].Description; + } + else + { + result += "[REDACTED]"; + } + + if (ActiveGE.Count() > 1 && i < ActiveGE.Count() - 1) + { + result += ", "; + } + } + + + return result; + } + + public static List ChooseGE(int numberOfGlobalEvent = 1) + { + List activeGE = ChooseRandomGE(numberOfGlobalEvent); + Log.Debug($"activeGE size : {activeGE.Count}"); + Log.Info($"Global Event(s) ({numberOfGlobalEvent}): "); + + + return activeGE; + } + + internal static void ActivateAll() + { + ActivateAll(ActiveGE); + } + + private static void ActivateAll(List globalEvent) + { + if(globalEvent.Count != globalEvent.Distinct().Count()) throw new ArgumentException("You can't have the same GE twice in the same round"); + ActiveGE = globalEvent; + globalEvent.ForEach(e => e.SubscribeEvent()); + + foreach (IGlobalEvent ge in ActiveGE) + { + + CoroutineHandle a = Timing.RunCoroutine(ge.Start()); + coroutineHandles.Add(a); + } + Show(); + } + + private static List ChooseRandomGE(int nbGE = 1) + { + List result = new List(); + + List weightedPool = new List(); + foreach (IGlobalEvent ge in GlobalEvent.GlobalEventsList) + { + for (int i = 0; i < ge.Weight; i++) + { + weightedPool.Add(ge); + Log.Debug($"getochoose : {ge.Name} "); + } + } + + nbGE = Math.Min(nbGE, GlobalEvent.GlobalEventsList.Count); + + for (int i = 0; i < nbGE; i++) + { + int randomIndex = UnityEngine.Random.Range(0, weightedPool.Count); + IGlobalEvent selectedGE = weightedPool[randomIndex]; + + result.Add(selectedGE); + + weightedPool.RemoveAll(e => e == selectedGE); + weightedPool.RemoveAll(e => selectedGE.IncompatibleGE.Contains(e.Id)); + } + return result; } } } diff --git a/KruacentExiled/KE.GlobalEventFramework/GEFE/API/Features/Loader.cs b/KruacentExiled/KE.GlobalEventFramework/GEFE/API/Features/Loader.cs index 60747cd3..191b21c5 100644 --- a/KruacentExiled/KE.GlobalEventFramework/GEFE/API/Features/Loader.cs +++ b/KruacentExiled/KE.GlobalEventFramework/GEFE/API/Features/Loader.cs @@ -19,22 +19,17 @@ internal void Load() { foreach (IPlugin plugin in Exiled.Loader.Loader.Plugins.Where(pl => pl.Name != MainPlugin.Instance.Name)) { - Log.Debug($"checking {plugin.Name}"); + if(MainPlugin.Instance.Config.ShowRegisteringLog) Log.Debug($"checking {plugin.Name}"); foreach (Type type in plugin.Assembly.GetTypes()) { try { - Log.Debug($" checking {type.Name}"); + if (MainPlugin.Instance.Config.ShowRegisteringLog) Log.Debug($" checking {type.Name}"); if (type.IsSubclassOf(typeof(IGlobalEvent)) || type.IsSubclassOf(typeof(GlobalEvent))) - { - Log.Debug("good"); + { ActivePlugins.Add(plugin); - - Log.Debug("creating instance"); IGlobalEvent ge = Activator.CreateInstance(type) as IGlobalEvent; - Log.Debug("registering"); GlobalEvent.Register(ge); - Log.Debug("end register"); } }catch(System.Exception e) { diff --git a/KruacentExiled/KE.GlobalEventFramework/GEFE/Commands/ForceGE.cs b/KruacentExiled/KE.GlobalEventFramework/GEFE/Commands/ForceGE.cs new file mode 100644 index 00000000..80c701eb --- /dev/null +++ b/KruacentExiled/KE.GlobalEventFramework/GEFE/Commands/ForceGE.cs @@ -0,0 +1,65 @@ +namespace KE.GlobalEventFramework.GEFE.Commands +{ + using Exiled.API.Features; + using Exiled.API.Features.Pickups; + using System; + using CommandSystem; + using System.Runtime.InteropServices.WindowsRuntime; + using GEFE.API.Interfaces; + using GEFE.API.Features; + using System.Collections.Generic; + using System.Linq; + + public class ForceGE : ICommand + { + public string Command { get; } = "force"; + public string[] Aliases { get; } = new string[] { "f" }; + public string Description { get; } = "force a or multiple global event"; + internal static List ForcedGE = new List(); + + public bool Execute(ArraySegment arguments, ICommandSender sender, out string response) + { + if (!Round.IsLobby) + { + response = "You can only force a global event in the lobby"; + ForcedGE = new List(); + return false; + } + + if (!GlobalEvent.TryGet(arguments.At(0), out IGlobalEvent ge1) || ge1 == null) + { + response = $"Global event ({arguments.At(0)}) not found "; + ForcedGE = new IGlobalEvent[] { ge1 }.ToList(); + return false; + } + + + + if (arguments.Count == 1) + { + response = $"Forcing {ge1.Name}"; + ForcedGE = new IGlobalEvent[] { ge1 }.ToList(); + return true; + } + + if (!GlobalEvent.TryGet(arguments.At(1), out IGlobalEvent ge2) || ge2 == null) + { + response = $"Global event ({arguments.At(1)}) not found "; + ForcedGE = new List(); + return false; + } + + if (arguments.Count == 2) + { + response = $"Forcing {ge1.Name} & {ge2.Name}"; + ForcedGE = new IGlobalEvent[] { ge1, ge2 }.ToList(); + return true; + } + + ForcedGE = new List(); + response = ""; + return false; + + } + } +} diff --git a/KruacentExiled/KE.GlobalEventFramework/GEFE/Commands/ForceNbGE.cs b/KruacentExiled/KE.GlobalEventFramework/GEFE/Commands/ForceNbGE.cs new file mode 100644 index 00000000..e5e5fe94 --- /dev/null +++ b/KruacentExiled/KE.GlobalEventFramework/GEFE/Commands/ForceNbGE.cs @@ -0,0 +1,61 @@ +namespace KE.GlobalEventFramework.GEFE.Commands +{ + using Exiled.API.Features; + using Exiled.API.Features.Pickups; + using System; + using CommandSystem; + using System.Runtime.InteropServices.WindowsRuntime; + using GEFE.API.Interfaces; + using GEFE.API.Features; + using System.Collections.Generic; + using System.Linq; + + public class ForceNbGE : ICommand + { + public string Command { get; } = "forceNb"; + public string[] Aliases { get; } = new string[] { "nb","n" }; + public string Description { get; } = "force a specified number global event"; + internal static int NbGE = -1; + + public bool Execute(ArraySegment arguments, ICommandSender sender, out string response) + { + if (!Round.IsLobby) + { + response = "You can only force a global event in the lobby"; + NbGE = -1; + return false; + } + + + + if (arguments.Count == 1) + { + if (int.TryParse(arguments.At(0), out int nbge) && nbge > -1) + { + if(nbge <= 0) + { + response = "You can't force 0 global event"; + NbGE = -1; + return false; + } + if(nbge > GlobalEvent.GlobalEventsList.Count) + { + response = $"You can't force {nbge} global event, there are only {GlobalEvent.GlobalEventsList.Count} global events"; + NbGE = -1; + return false; + } + + + response = $"Forcing {nbge} global event"; + NbGE = nbge; + return true; + } + } + + NbGE = -1; + response = "Too much argument"; + return false; + + } + } +} diff --git a/KruacentExiled/KE.GlobalEventFramework/GEFE/Commands/List.cs b/KruacentExiled/KE.GlobalEventFramework/GEFE/Commands/ListGE.cs similarity index 93% rename from KruacentExiled/KE.GlobalEventFramework/GEFE/Commands/List.cs rename to KruacentExiled/KE.GlobalEventFramework/GEFE/Commands/ListGE.cs index 11764b19..0119db18 100644 --- a/KruacentExiled/KE.GlobalEventFramework/GEFE/Commands/List.cs +++ b/KruacentExiled/KE.GlobalEventFramework/GEFE/Commands/ListGE.cs @@ -8,7 +8,7 @@ using GEFE.API.Interfaces; using GEFE.API.Features; - public class List : ICommand + public class ListGE : ICommand { public string Command { get; } = "list"; public string[] Aliases { get; } = new string[] { "l", "ls" }; @@ -16,7 +16,7 @@ public class List : ICommand public bool Execute(ArraySegment arguments, ICommandSender sender, out string response) { - string result = "List of all global event ([o] if it's active in the round ; [ ] otherwise) : "; + string result = "List of all global event ([o] if it's active in the round ; [ ] otherwise) : \n"; foreach (IGlobalEvent ge in GlobalEvent.GlobalEvents.Values) { diff --git a/KruacentExiled/KE.GlobalEventFramework/GEFE/Commands/ParentCommandGEFE.cs b/KruacentExiled/KE.GlobalEventFramework/GEFE/Commands/ParentCommandGEFE.cs index 1b8f3830..1134260a 100644 --- a/KruacentExiled/KE.GlobalEventFramework/GEFE/Commands/ParentCommandGEFE.cs +++ b/KruacentExiled/KE.GlobalEventFramework/GEFE/Commands/ParentCommandGEFE.cs @@ -17,13 +17,15 @@ public ParentCommandGEFE() public override void LoadGeneratedCommands() { - RegisterCommand(new List()); + RegisterCommand(new ListGE()); + RegisterCommand(new ForceGE()); + RegisterCommand(new ForceNbGE()); } protected override bool ExecuteParent(ArraySegment arguments, ICommandSender sender, out string response) { if(arguments.Count == 0){ - response = "subcommand available : list"; + response = "subcommand available : list, force, nb"; return true; } response = ""; diff --git a/KruacentExiled/KE.GlobalEventFramework/GEFE/Handlers/ServerHandler.cs b/KruacentExiled/KE.GlobalEventFramework/GEFE/Handlers/ServerHandler.cs index 38e3b9cc..67504ee2 100644 --- a/KruacentExiled/KE.GlobalEventFramework/GEFE/Handlers/ServerHandler.cs +++ b/KruacentExiled/KE.GlobalEventFramework/GEFE/Handlers/ServerHandler.cs @@ -3,27 +3,51 @@ using System.Collections.Generic; using KE.GlobalEventFramework.GEFE.API.Interfaces; using KE.GlobalEventFramework.GEFE.API.Features; +using KE.GlobalEventFramework.GEFE.Commands; namespace KE.GlobalEventFramework.GEFE.Handlers { internal class ServerHandler { - MainPlugin _plugin; - List _activeGE; - public ServerHandler(MainPlugin mainPlugin) - { - this._plugin = mainPlugin; - } public void OnRoundStarted() { - Log.Debug("starting round"); - - _activeGE = _plugin.ChooseGE(UnityEngine.Random.value < .1f ? 2 : 1); - Log.Debug("sub event"); - _activeGE.ForEach(e => e.SubscribeEvent()); - Log.Debug("show to player"); - _plugin.Show(); - Log.Debug("end starting round"); + Log.Debug("starting round"); + HandleCommands(); + + + + } + + private void HandleCommands() + { + //force ge + if (ForceGE.ForcedGE.Count > 0) + { + Log.Debug("forcing ge"); + GlobalEvent.ActiveGE = ForceGE.ForcedGE; + ForceGE.ForcedGE = new List(); + } + else + { + int nbGE; + + //choose nb of ge + if (ForceNbGE.NbGE > -1) + { + nbGE = ForceNbGE.NbGE; + Log.Debug($"forcing nb ge = {nbGE}"); + ForceNbGE.NbGE = -1; + } + //normal case + else + { + Log.Debug($"no commands"); + nbGE = UnityEngine.Random.value < .1f ? 2 : 1; + } + GlobalEvent.ActiveGE = GlobalEvent.ChooseGE(nbGE); + } + + GlobalEvent.ActivateAll(); } public void OnWaitingForPlayers() @@ -34,12 +58,12 @@ public void OnWaitingForPlayers() public void OnEndingRound(RoundEndedEventArgs _) { Log.Debug("ending round"); - _activeGE.ForEach(e => e.UnsubscribeEvent()); + GlobalEvent.ActiveGE.ForEach(e => e.UnsubscribeEvent()); } public void OnRestartingRound() { Log.Debug("restarting"); - _activeGE.ForEach(e => e.UnsubscribeEvent()); + GlobalEvent.ActiveGE.ForEach(e => e.UnsubscribeEvent()); } } diff --git a/KruacentExiled/KE.GlobalEventFramework/MainPlugin.cs b/KruacentExiled/KE.GlobalEventFramework/MainPlugin.cs index c7b7e906..2e0f96f4 100644 --- a/KruacentExiled/KE.GlobalEventFramework/MainPlugin.cs +++ b/KruacentExiled/KE.GlobalEventFramework/MainPlugin.cs @@ -8,6 +8,7 @@ using KE.GlobalEventFramework.GEFE.API.Features; using KE.GlobalEventFramework.GEFE.API.Interfaces; using ServerHandler = Exiled.Events.Handlers.Server; +using Discord; namespace KE.GlobalEventFramework { internal class MainPlugin : Plugin @@ -44,7 +45,7 @@ public override void OnDisabled() private void RegisterEvents() { - _server = new GEFE.Handlers.ServerHandler(this); + _server = new GEFE.Handlers.ServerHandler(); ServerHandler.WaitingForPlayers += _server.OnWaitingForPlayers; @@ -64,94 +65,7 @@ private void UnregisterEvents() _server = null; } - public void Show() - { - var random = UnityEngine.Random.value; - - foreach (Player player in Player.List) - { - Exiled.API.Features.Broadcast b = new Exiled.API.Features.Broadcast - { - Content = ShowText(random > .5f), - Duration = 10 - }; - player.Broadcast(b); - } - } - - private String ShowText(bool redacted = false) - { - String result = "Global Events: "; - for (int i = 0; i < GlobalEvent.ActiveGE.Count(); i++) - { - - - if (redacted) - { - result += GlobalEvent.ActiveGE[i].Description; - } - else - { - result += "[REDACTED]"; - } - - if (GlobalEvent.ActiveGE.Count() > 1 && i < GlobalEvent.ActiveGE.Count()-1) - { - result += ","; - } - } - - - return result; - } - - public List ChooseGE(int numberOfGlobalEvent = 1) - { - List activeGE = ChooseRandomGE(numberOfGlobalEvent); - Log.Debug($"activeGE size : {activeGE.Count}"); - Log.Info($"Global Event(s) ({numberOfGlobalEvent}): "); - - foreach (IGlobalEvent ge in activeGE) - { - Log.Info(ge.Name); - var a = Timing.RunCoroutine(ge.Start()); - GlobalEvent.coroutineHandles.Add(a); - } - return activeGE; - } - - private List ChooseRandomGE(int nbGE = 1) - { - List result = new List(); - - List weightedPool = new List(); - foreach (IGlobalEvent ge in GlobalEvent.GlobalEventsList) - { - for (int i = 0; i < ge.Weight; i++) - { - weightedPool.Add(ge); - Log.Debug($"getochoose : {ge.Name} "); - } - } - - nbGE = Math.Min(nbGE, GlobalEvent.GlobalEventsList.Count); - - for (int i = 0; i < nbGE; i++) - { - int randomIndex = UnityEngine.Random.Range(0, weightedPool.Count); - IGlobalEvent selectedGE = weightedPool[randomIndex]; - - result.Add(selectedGE); - - weightedPool.RemoveAll(e => e == selectedGE); - weightedPool.RemoveAll(e => selectedGE.IncompatibleGE.Contains(e.Id)); - } - - // Step 3: Update the active global events - GlobalEvent.ActiveGE = result.ToList(); - - return result; - } + } From dfc4af627fcfde1516456d8e3aced39908fd17b7 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Thu, 2 Jan 2025 20:21:43 +0100 Subject: [PATCH 082/853] Changed the id because tpgrenada couldn't spawn --- KruacentExiled/KE.Items/Items/AdrenalineDrogue.cs | 2 +- KruacentExiled/KE.Items/Items/Defibrilator.cs | 2 +- KruacentExiled/KE.Items/Items/TPGrenada.cs | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/KruacentExiled/KE.Items/Items/AdrenalineDrogue.cs b/KruacentExiled/KE.Items/Items/AdrenalineDrogue.cs index 6c148b3c..f463761d 100644 --- a/KruacentExiled/KE.Items/Items/AdrenalineDrogue.cs +++ b/KruacentExiled/KE.Items/Items/AdrenalineDrogue.cs @@ -16,7 +16,7 @@ public class AdrenalineDrogue : CustomItem { /// - public override uint Id { get; set; } = 19; + public override uint Id { get; set; } = 1402; /// public override string Name { get; set; } = "DA-020"; diff --git a/KruacentExiled/KE.Items/Items/Defibrilator.cs b/KruacentExiled/KE.Items/Items/Defibrilator.cs index e5eb798e..a06eec88 100644 --- a/KruacentExiled/KE.Items/Items/Defibrilator.cs +++ b/KruacentExiled/KE.Items/Items/Defibrilator.cs @@ -13,7 +13,7 @@ public class Defibrilator : CustomItem { - public override uint Id { get; set; } = 20; + public override uint Id { get; set; } = 1401; public override string Name { get; set; } = "DF-001"; public override string Description { get; set; } = "Le défibrilateur, il permet de réanimer une personne qui à une perte de conscience, on va réanimer la personne la plus proche du joueur qui l'utilise (le lieu de mort et non où se trouve le corps)"; public override float Weight { get; set; } = 0.65f; diff --git a/KruacentExiled/KE.Items/Items/TPGrenada.cs b/KruacentExiled/KE.Items/Items/TPGrenada.cs index 6dc28bad..b9d594ad 100644 --- a/KruacentExiled/KE.Items/Items/TPGrenada.cs +++ b/KruacentExiled/KE.Items/Items/TPGrenada.cs @@ -18,7 +18,7 @@ namespace KE.Items.Items public class TPGrenada : CustomGrenade { private List effectedPlayers = new List(); - public override uint Id { get; set; } = 20; + public override uint Id { get; set; } = 1400; public override string Name { get; set; } = "Teleportation Grenade"; public override string Description { get; set; } = "This grenade does 0 damage but teleport nearby players in a random place (does work in other dimension ;3 )"; public override float Weight { get; set; } = 0.65f; From 1fde5b48bd9b86d3bd432d45b1b80c2860663153 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Thu, 2 Jan 2025 20:23:39 +0100 Subject: [PATCH 083/853] changed the id --- KruacentExiled/KE.CustomRoles/CR/Guard914.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/KruacentExiled/KE.CustomRoles/CR/Guard914.cs b/KruacentExiled/KE.CustomRoles/CR/Guard914.cs index d62b2a79..27671f6e 100644 --- a/KruacentExiled/KE.CustomRoles/CR/Guard914.cs +++ b/KruacentExiled/KE.CustomRoles/CR/Guard914.cs @@ -14,12 +14,13 @@ internal class Guard914 : Exiled.CustomRoles.API.Features.CustomRole { public override string Name { get; set; } = "guard914"; public override string Description { get; set; } = "Tu es Le garde de SCP-914 \nTu commences à 914 \nmais on a volé ta carte \net ntm aussi"; - public override uint Id { get; set; } = 1; + public override uint Id { get; set; } = 1040; public override string CustomInfo { get; set; } = "Garde de 914"; public override int MaxHealth { get; set; } = 100; public override RoleTypeId Role { get; set; } = RoleTypeId.FacilityGuard; public override bool KeepRoleOnDeath { get ; set ; } = false; public override bool KeepRoleOnChangingRole { get; set; } = false; + public override bool IgnoreSpawnSystem { get; set; } = true; public override SpawnProperties SpawnProperties { get; set; } = new SpawnProperties() { From 6e4ade98607dac72d496f4f0d35aaeb03dc9e2f2 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Thu, 2 Jan 2025 20:52:53 +0100 Subject: [PATCH 084/853] fixed the attribute --- KruacentExiled/KE.Items/Items/TPGrenada.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/KruacentExiled/KE.Items/Items/TPGrenada.cs b/KruacentExiled/KE.Items/Items/TPGrenada.cs index b9d594ad..5d7179f7 100644 --- a/KruacentExiled/KE.Items/Items/TPGrenada.cs +++ b/KruacentExiled/KE.Items/Items/TPGrenada.cs @@ -15,10 +15,11 @@ namespace KE.Items.Items { //grenade qui tp + [CustomItem(ItemType.GrenadeHE)] public class TPGrenada : CustomGrenade { private List effectedPlayers = new List(); - public override uint Id { get; set; } = 1400; + public override uint Id { get; set; } = 1405; public override string Name { get; set; } = "Teleportation Grenade"; public override string Description { get; set; } = "This grenade does 0 damage but teleport nearby players in a random place (does work in other dimension ;3 )"; public override float Weight { get; set; } = 0.65f; From 8c14b11f4e641d53f99f5c2f16157fedf5807f09 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Thu, 2 Jan 2025 21:17:57 +0100 Subject: [PATCH 085/853] ennfant --- KruacentExiled/KE.CustomRoles/CR/Enfant.cs | 33 ++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 KruacentExiled/KE.CustomRoles/CR/Enfant.cs diff --git a/KruacentExiled/KE.CustomRoles/CR/Enfant.cs b/KruacentExiled/KE.CustomRoles/CR/Enfant.cs new file mode 100644 index 00000000..4c6839b3 --- /dev/null +++ b/KruacentExiled/KE.CustomRoles/CR/Enfant.cs @@ -0,0 +1,33 @@ +using Exiled.API.Features.Attributes; +using Exiled.API.Features.Items; +using Exiled.API.Features.Spawn; +using InventorySystem.Items.Usables.Scp330; +using PlayerRoles; +using PluginAPI.Core.Items; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using UnityEngine; + +namespace KE.CustomRoles.CR +{ + [CustomRole(RoleTypeId.ClassD)] + internal class Enfant : Exiled.CustomRoles.API.Features.CustomRole + { + public override string Name { get; set; } = "enfant"; + public override string Description { get; set; } = "Tu es un Enfant \ndo not the kid \ntu commences avec un bonbon arc-en-ciel \n t'es un peu plus petit que la normal"; + public override uint Id { get; set; } = 1040; + public override string CustomInfo { get; set; } = "Enfant"; + public override int MaxHealth { get; set; } = 100; + public override RoleTypeId Role { get; set; } = RoleTypeId.ClassD; + public override bool KeepRoleOnDeath { get ; set ; } = true; + public override bool KeepRoleOnChangingRole { get; set; } = true; + public override bool IgnoreSpawnSystem { get; set; } = true; + + public override float SpawnChance { get; set; } = 100; + public override Vector3 Scale { get ; set; } = new Vector3(1, 0.75f, 1); + + } +} From 1861c2886f2fb7c47261c0d6004e91730b16a8be Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Fri, 3 Jan 2025 21:55:23 +0100 Subject: [PATCH 086/853] removed a log --- .../KE.GlobalEventFramework/GEFE/API/Features/GlobalEvent.cs | 2 -- 1 file changed, 2 deletions(-) diff --git a/KruacentExiled/KE.GlobalEventFramework/GEFE/API/Features/GlobalEvent.cs b/KruacentExiled/KE.GlobalEventFramework/GEFE/API/Features/GlobalEvent.cs index 176df78a..b90fa807 100644 --- a/KruacentExiled/KE.GlobalEventFramework/GEFE/API/Features/GlobalEvent.cs +++ b/KruacentExiled/KE.GlobalEventFramework/GEFE/API/Features/GlobalEvent.cs @@ -149,8 +149,6 @@ public static List ChooseGE(int numberOfGlobalEvent = 1) { List activeGE = ChooseRandomGE(numberOfGlobalEvent); Log.Debug($"activeGE size : {activeGE.Count}"); - Log.Info($"Global Event(s) ({numberOfGlobalEvent}): "); - return activeGE; } From dc91d202dfe34bd73e7cfeb0259b359bcfb782b4 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Fri, 3 Jan 2025 22:05:45 +0100 Subject: [PATCH 087/853] Changed the id from int to unsigned int --- .../KE.GlobalEventFramework.Examples/GE/Blitz.cs | 2 +- .../KE.GlobalEventFramework.Examples/GE/Impostor.cs | 2 +- .../KE.GlobalEventFramework.Examples/GE/KIWIS.cs | 2 +- .../KE.GlobalEventFramework.Examples/GE/OpenBar.cs | 4 ++-- .../KE.GlobalEventFramework.Examples/GE/R.cs | 2 +- .../GE/RandomSpawn.cs | 2 +- .../KE.GlobalEventFramework.Examples/GE/Shuffle.cs | 2 +- .../KE.GlobalEventFramework.Examples/GE/Speed.cs | 2 +- .../GE/SystemMalfunction.cs | 4 ++-- .../GEFE/API/Features/GlobalEvent.cs | 12 ++++++------ .../GEFE/API/Interfaces/IGlobalEvent.cs | 4 ++-- 11 files changed, 19 insertions(+), 19 deletions(-) diff --git a/KruacentExiled/KE.GlobalEventFramework.Examples/GE/Blitz.cs b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/Blitz.cs index fd8d1307..170be1ff 100644 --- a/KruacentExiled/KE.GlobalEventFramework.Examples/GE/Blitz.cs +++ b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/Blitz.cs @@ -16,7 +16,7 @@ namespace KE.GlobalEventFramework.Examples.GE public class Blitz : GlobalEvent { /// - public override int Id { get; set; } = 1046; + public override uint Id { get; set; } = 1046; /// public override string Name { get; set; } = "Blitz"; /// diff --git a/KruacentExiled/KE.GlobalEventFramework.Examples/GE/Impostor.cs b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/Impostor.cs index 64b11459..ef664b90 100644 --- a/KruacentExiled/KE.GlobalEventFramework.Examples/GE/Impostor.cs +++ b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/Impostor.cs @@ -10,7 +10,7 @@ namespace KE.GlobalEventFramework.Examples.GE { public class Impostor : GlobalEvent { - public override int Id { get; set; } = 1044; + public override uint Id { get; set; } = 1044; public override string Name { get; set; } = "Impostor"; public override string Description { get; set; } = "Ne vous fiez pas aux apparences !"; public override int Weight { get; set; } = 1; diff --git a/KruacentExiled/KE.GlobalEventFramework.Examples/GE/KIWIS.cs b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/KIWIS.cs index ea9c137d..812dbdd6 100644 --- a/KruacentExiled/KE.GlobalEventFramework.Examples/GE/KIWIS.cs +++ b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/KIWIS.cs @@ -15,7 +15,7 @@ namespace KE.GlobalEventFramework.Examples.GE public class KIWIS : GlobalEvent { /// - public override int Id { get; set; } = 1047; + public override uint Id { get; set; } = 1047; /// public override string Name { get; set; } = "KIWIS"; /// diff --git a/KruacentExiled/KE.GlobalEventFramework.Examples/GE/OpenBar.cs b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/OpenBar.cs index a8d868a7..cfaf4698 100644 --- a/KruacentExiled/KE.GlobalEventFramework.Examples/GE/OpenBar.cs +++ b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/OpenBar.cs @@ -13,11 +13,11 @@ namespace KE.GlobalEventFramework.Examples.GE { public class OpenBar : GlobalEvent { - public override int Id { get; set; } = 1048; + public override uint Id { get; set; } = 1048; public override string Name { get; set; } = "OpenBar"; public override string Description { get; set; } = "j'espère que vous avez pas prévu de kampé"; public override int Weight { get; set; } = 1; - public override int[] IncompatibleGE { get; set; } = { 1 }; + public override uint[] IncompatibleGE { get; set; } = { 1 }; public override IEnumerator Start() { var doors = Door.List.Where(d => new[] { DoorType.GateA, DoorType.GateB, DoorType.HczArmory, DoorType.HIDChamber,DoorType.Intercom,DoorType.Scp049Armory,DoorType.Scp096,DoorType.Scp106Primary,DoorType.Scp106Secondary,DoorType.Scp330,DoorType.Scp330Chamber,DoorType.Scp914Gate }.Contains(d.Type)).ToList(); diff --git a/KruacentExiled/KE.GlobalEventFramework.Examples/GE/R.cs b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/R.cs index 107ccd9d..ac0ae9bf 100644 --- a/KruacentExiled/KE.GlobalEventFramework.Examples/GE/R.cs +++ b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/R.cs @@ -9,7 +9,7 @@ namespace KE.GlobalEventFramework.Examples.GE public class R : GlobalEvent { /// - public override int Id { get; set; } = 0; + public override uint Id { get; set; } = 0; /// public override string Name { get; set; } = "nothing"; /// diff --git a/KruacentExiled/KE.GlobalEventFramework.Examples/GE/RandomSpawn.cs b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/RandomSpawn.cs index e35dd5fc..bb0882fb 100644 --- a/KruacentExiled/KE.GlobalEventFramework.Examples/GE/RandomSpawn.cs +++ b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/RandomSpawn.cs @@ -16,7 +16,7 @@ namespace KE.GlobalEventFramework.Examples.GE public class RandomSpawn : GlobalEvent { /// - public override int Id { get; set; } = 1043; + public override uint Id { get; set; } = 1043; /// public override string Name { get; set; } = "RandomSpawn"; /// diff --git a/KruacentExiled/KE.GlobalEventFramework.Examples/GE/Shuffle.cs b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/Shuffle.cs index 449e86ff..936c62c7 100644 --- a/KruacentExiled/KE.GlobalEventFramework.Examples/GE/Shuffle.cs +++ b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/Shuffle.cs @@ -16,7 +16,7 @@ namespace KE.GlobalEventFramework.Examples.GE public class Shuffle : GlobalEvent { /// - public override int Id { get; set; } = 1045; + public override uint Id { get; set; } = 1045; /// public override string Name { get; set; } = "Shuffle"; /// diff --git a/KruacentExiled/KE.GlobalEventFramework.Examples/GE/Speed.cs b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/Speed.cs index 89799d6c..bf8c0f17 100644 --- a/KruacentExiled/KE.GlobalEventFramework.Examples/GE/Speed.cs +++ b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/Speed.cs @@ -21,7 +21,7 @@ namespace KE.GlobalEventFramework.Examples.GE public class Speed : GlobalEvent { /// - public override int Id { get; set; } = 1042; + public override uint Id { get; set; } = 1042; /// public override string Name { get; set; } = "Speed"; /// diff --git a/KruacentExiled/KE.GlobalEventFramework.Examples/GE/SystemMalfunction.cs b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/SystemMalfunction.cs index 4ffa0841..9278b850 100644 --- a/KruacentExiled/KE.GlobalEventFramework.Examples/GE/SystemMalfunction.cs +++ b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/SystemMalfunction.cs @@ -23,7 +23,7 @@ namespace KE.GlobalEventFramework.Examples.GE public class SystemMalfunction : GlobalEvent { /// - public override int Id { get; set; } = 1041; + public override uint Id { get; set; } = 1041; /// public override string Name { get; set; } = "System Malfunction"; /// @@ -35,7 +35,7 @@ public class SystemMalfunction : GlobalEvent /// public int NewCooldown { get; set; } = 180; - public override int[] IncompatibleGE { get; set; } = { 38 }; + public override uint[] IncompatibleGE { get; set; } = { 38 }; /// public override IEnumerator Start() { diff --git a/KruacentExiled/KE.GlobalEventFramework/GEFE/API/Features/GlobalEvent.cs b/KruacentExiled/KE.GlobalEventFramework/GEFE/API/Features/GlobalEvent.cs index b90fa807..22e2cf4c 100644 --- a/KruacentExiled/KE.GlobalEventFramework/GEFE/API/Features/GlobalEvent.cs +++ b/KruacentExiled/KE.GlobalEventFramework/GEFE/API/Features/GlobalEvent.cs @@ -15,13 +15,13 @@ public abstract class GlobalEvent : IGlobalEvent public static List ActiveGlobalEvents => ActiveGE.ToList(); internal static List ActiveGE { get; set; } = new List(); internal static List coroutineHandles = new List(); - internal static Dictionary GlobalEvents { get; private set; } = new Dictionary(); + internal static Dictionary GlobalEvents { get; private set; } = new Dictionary(); /// /// A list of all registered GlobalEvents /// public static List GlobalEventsList => GlobalEvents.Values.ToList(); /// - public abstract int Id { get; set; } + public abstract uint Id { get; set; } /// public abstract string Name { get; set; } /// @@ -29,7 +29,7 @@ public abstract class GlobalEvent : IGlobalEvent /// public abstract int Weight { get; set; } /// - public virtual int[] IncompatibleGE { get; set; } = new int[0]; + public virtual uint[] IncompatibleGE { get; set; } = new uint[0]; @@ -77,7 +77,7 @@ internal static void StopCoroutines() }); } - public static bool TryGet(int id, out IGlobalEvent globalEvent) + public static bool TryGet(uint id, out IGlobalEvent globalEvent) { globalEvent = Get(id); return globalEvent != null; @@ -89,7 +89,7 @@ public static bool TryGet(string name, out IGlobalEvent globalEvent) { throw new System.Exception("name can't be null or empty"); } - globalEvent = int.TryParse(name, out int id) ? Get(id) : Get(name); + globalEvent = uint.TryParse(name, out uint id) ? Get(id) : Get(name); return globalEvent != null; } @@ -99,7 +99,7 @@ public static IGlobalEvent Get(string name) return GlobalEvents.Values.FirstOrDefault(ge => ge.Name == name); } - public static IGlobalEvent Get(int id) + public static IGlobalEvent Get(uint id) { return GlobalEvents.TryGetValue(id, out IGlobalEvent globalEvent) ? globalEvent : null; } diff --git a/KruacentExiled/KE.GlobalEventFramework/GEFE/API/Interfaces/IGlobalEvent.cs b/KruacentExiled/KE.GlobalEventFramework/GEFE/API/Interfaces/IGlobalEvent.cs index 890605e3..63e623b3 100644 --- a/KruacentExiled/KE.GlobalEventFramework/GEFE/API/Interfaces/IGlobalEvent.cs +++ b/KruacentExiled/KE.GlobalEventFramework/GEFE/API/Interfaces/IGlobalEvent.cs @@ -12,7 +12,7 @@ public interface IGlobalEvent /// /// the UNIQUE id of the Global Event /// - int Id { get; set; } + uint Id { get; set; } /// /// Name used in the logs on the RA /// @@ -31,7 +31,7 @@ public interface IGlobalEvent /// The ids of incompatible Globals Events /// Note: You can't have the same GE twice in the same round /// - int[] IncompatibleGE { get; set; } + uint[] IncompatibleGE { get; set; } /// /// Is launched at the start of a round From 14c244fbeb2eb18db7a9508d4967b1fefa176b96 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Sat, 4 Jan 2025 16:13:05 +0100 Subject: [PATCH 088/853] =?UTF-8?q?added=20Presse=20Pur=C3=A9e?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- KruacentExiled/KE.Items/Items/PressePuree.cs | 49 ++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 KruacentExiled/KE.Items/Items/PressePuree.cs diff --git a/KruacentExiled/KE.Items/Items/PressePuree.cs b/KruacentExiled/KE.Items/Items/PressePuree.cs new file mode 100644 index 00000000..ad9465e4 --- /dev/null +++ b/KruacentExiled/KE.Items/Items/PressePuree.cs @@ -0,0 +1,49 @@ + +using System.Collections.Generic; +using Exiled.API.Enums; +using Exiled.API.Features; +using Exiled.API.Features.Attributes; +using Exiled.API.Features.Spawn; +using Exiled.CustomItems.API.Features; + +namespace KE.Items.Items +{ + public class PressePuree : CustomGrenade + { + public override uint Id { get; set; } = 1406; + public override string Name { get; set; } = "Presse Purée"; + public override string Description { get; set; } = "The grenade explose at impact"; + public override float Weight { get; set; } = 0.65f; + public override float FuseTime { get; set; } = 1.5f; + public override bool ExplodeOnCollision { get; set; } = true; + public float DamageModifier { get; set; } = 1f; + public override SpawnProperties SpawnProperties { get; set; } = new SpawnProperties() + { + Limit = 5, + DynamicSpawnPoints = new List + { + new DynamicSpawnPoint() + { + Chance = 50, + Location = SpawnLocationType.InsideHczArmory, + }, + new DynamicSpawnPoint() + { + Chance =2, + Location = SpawnLocationType.Inside914, + }, + new DynamicSpawnPoint() + { + Chance=50, + Location = SpawnLocationType.Inside049Armory, + }, + new DynamicSpawnPoint() + { + Chance=50, + Location = SpawnLocationType.InsideLczArmory, + } + }, + + }; + } +} From e99ccaca2fee2f7d911a892850533b941fdd36c0 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Sat, 4 Jan 2025 18:12:08 +0100 Subject: [PATCH 089/853] Added pink candy --- KruacentExiled/KE.Misc/Candy.cs | 22 ++++++++++++++++++++++ KruacentExiled/KE.Misc/Config.cs | 2 ++ KruacentExiled/KE.Misc/MainPlugin.cs | 19 +++++++++++++++++++ 3 files changed, 43 insertions(+) create mode 100644 KruacentExiled/KE.Misc/Candy.cs diff --git a/KruacentExiled/KE.Misc/Candy.cs b/KruacentExiled/KE.Misc/Candy.cs new file mode 100644 index 00000000..61b1fb7d --- /dev/null +++ b/KruacentExiled/KE.Misc/Candy.cs @@ -0,0 +1,22 @@ +using Exiled.Events.EventArgs.Scp330; +using Exiled.Events.Patches.Events.Scp330; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using InventorySystem.Items.Usables.Scp330; + +namespace KE.Misc +{ + internal class Candy + { + public void InteractingScp330(InteractingScp330EventArgs ev) + { + if(UnityEngine.Random.Range(0, 100) < MainPlugin.Instance.Config.ChancePinkCandy) + { + ev.Candy = CandyKindID.Pink; + } + } + } +} diff --git a/KruacentExiled/KE.Misc/Config.cs b/KruacentExiled/KE.Misc/Config.cs index d133b746..8ff0b427 100644 --- a/KruacentExiled/KE.Misc/Config.cs +++ b/KruacentExiled/KE.Misc/Config.cs @@ -17,5 +17,7 @@ public class Config : IConfig public bool PeanutLockDown { get; set; } = true; [Description("Enable or disable the auto elevator")] public bool AutoElevator { get; set; } = true; + [Description("Chance to get a pink candy (0-100)")] + public int ChancePinkCandy { get; set; } = 10; } } diff --git a/KruacentExiled/KE.Misc/MainPlugin.cs b/KruacentExiled/KE.Misc/MainPlugin.cs index 0c247056..04275d79 100644 --- a/KruacentExiled/KE.Misc/MainPlugin.cs +++ b/KruacentExiled/KE.Misc/MainPlugin.cs @@ -23,6 +23,7 @@ public class MainPlugin : Plugin internal _914 _914 { get; private set; } internal AutoElevator AutoElevator { get; private set; } internal ClassDDoor ClassDDoor { get; private set; } + internal Candy Candy { get; private set; } public override void OnEnabled() { @@ -31,10 +32,21 @@ public override void OnEnabled() AutoElevator = new AutoElevator(); ClassDDoor = new ClassDDoor(); ServerHandler = new ServerHandler(); + if (Instance.Config.ChancePinkCandy >= 0 && Instance.Config.ChancePinkCandy <= 100) + { + Candy = new Candy(); + Exiled.Events.Handlers.Scp330.InteractingScp330 += Candy.InteractingScp330; + } + else + { + Log.Error("ChancePinkCandy must be between 0 and 100"); + } + ServerHandle.RoundStarted += ServerHandler.OnRoundStarted; Nine14Handle.UpgradingPlayer += _914.OnUpgradingPlayer; Exiled.Events.Handlers.Player.Dying += ScpNoeDeathMessage; + } @@ -43,7 +55,14 @@ public override void OnDisabled() ServerHandle.RoundStarted -= ServerHandler.OnRoundStarted; Nine14Handle.UpgradingPlayer -= _914.OnUpgradingPlayer; Exiled.Events.Handlers.Player.Dying -= ScpNoeDeathMessage; + if (Instance.Config.ChancePinkCandy >= 0 && Instance.Config.ChancePinkCandy <= 100) + { + Exiled.Events.Handlers.Scp330.InteractingScp330 -= Candy.InteractingScp330; + Candy = null; + } + + _914 = null; ClassDDoor = null; ServerHandler = null; From 469de209ac46dad42a2032cac45fb88bed542341 Mon Sep 17 00:00:00 2001 From: Omer <113857370+OmerGS@users.noreply.github.com> Date: Mon, 6 Jan 2025 16:03:33 +0100 Subject: [PATCH 090/853] Add more custom role --- .../CR/ChaosInsurgency/LeRusse.cs | 41 ++++++++++ .../KE.CustomRoles/CR/ClassD/Ashmatique.cs | 23 ++++++ .../KE.CustomRoles/CR/{ => ClassD}/Enfant.cs | 23 +++--- .../KE.CustomRoles/CR/Guard/ChiefGuard.cs | 40 ++++++++++ .../KE.CustomRoles/CR/{ => Guard}/Guard914.cs | 28 +++++-- KruacentExiled/KE.CustomRoles/CR/MTF/Tank.cs | 79 +++++++++++++++++++ .../KE.CustomRoles/CR/MTF/Terroriste.cs | 41 ++++++++++ .../KE.CustomRoles/CR/SCP/Paper049.cs | 23 ++++++ .../KE.CustomRoles/CR/SCP/Small049.cs | 23 ++++++ .../KE.CustomRoles/CR/SCP/Small173.cs | 23 ++++++ .../CR/Scientist/GambleAddict.cs | 35 ++++++++ .../CR/Scientist/ZoneManager.cs | 48 +++++++++++ 12 files changed, 409 insertions(+), 18 deletions(-) create mode 100644 KruacentExiled/KE.CustomRoles/CR/ChaosInsurgency/LeRusse.cs create mode 100644 KruacentExiled/KE.CustomRoles/CR/ClassD/Ashmatique.cs rename KruacentExiled/KE.CustomRoles/CR/{ => ClassD}/Enfant.cs (66%) create mode 100644 KruacentExiled/KE.CustomRoles/CR/Guard/ChiefGuard.cs rename KruacentExiled/KE.CustomRoles/CR/{ => Guard}/Guard914.cs (64%) create mode 100644 KruacentExiled/KE.CustomRoles/CR/MTF/Tank.cs create mode 100644 KruacentExiled/KE.CustomRoles/CR/MTF/Terroriste.cs create mode 100644 KruacentExiled/KE.CustomRoles/CR/SCP/Paper049.cs create mode 100644 KruacentExiled/KE.CustomRoles/CR/SCP/Small049.cs create mode 100644 KruacentExiled/KE.CustomRoles/CR/SCP/Small173.cs create mode 100644 KruacentExiled/KE.CustomRoles/CR/Scientist/GambleAddict.cs create mode 100644 KruacentExiled/KE.CustomRoles/CR/Scientist/ZoneManager.cs diff --git a/KruacentExiled/KE.CustomRoles/CR/ChaosInsurgency/LeRusse.cs b/KruacentExiled/KE.CustomRoles/CR/ChaosInsurgency/LeRusse.cs new file mode 100644 index 00000000..b73b733d --- /dev/null +++ b/KruacentExiled/KE.CustomRoles/CR/ChaosInsurgency/LeRusse.cs @@ -0,0 +1,41 @@ +using Exiled.API.Enums; +using Exiled.API.Features.Attributes; +using PlayerRoles; +using System.Collections.Generic; +using UnityEngine; + +namespace KE.CustomRoles.CR.ClassD +{ + [CustomRole(RoleTypeId.ChaosConscript)] + internal class Russe : Exiled.CustomRoles.API.Features.CustomRole + { + public override string Name { get; set; } = "Le Russe"; + public override string Description { get; set; } = "Tu es un maitre de jeu \ntu dois faire la roulette russe avec les autres joueurs"; + public override uint Id { get; set; } = 1051; + public override string CustomInfo { get; set; } = "Le Russe"; + public override int MaxHealth { get; set; } = 100; + public override RoleTypeId Role { get; set; } = RoleTypeId.ChaosConscript; + public override bool KeepRoleOnDeath { get; set; } = false; + public override bool KeepRoleOnChangingRole { get; set; } = false; + public override bool IgnoreSpawnSystem { get; set; } = true; + + public override float SpawnChance { get; set; } = 100; + public override Vector3 Scale { get; set; } = new Vector3(1.4f, 1.2f, 1.3f); + + public override List Inventory { get; set; } = new List() + { + $"{ItemType.GunRevolver}", + $"{ItemType.Radio}", + $"{ItemType.Adrenaline}", + $"{ItemType.GrenadeHE}", + $"{ItemType.GrenadeHE}", + $"{ItemType.GrenadeHE}", + $"{ItemType.GrenadeHE}" + }; + + public override Dictionary Ammo { get; set; } = new Dictionary() + { + { AmmoType.Ammo44Cal, 100} + }; + } +} diff --git a/KruacentExiled/KE.CustomRoles/CR/ClassD/Ashmatique.cs b/KruacentExiled/KE.CustomRoles/CR/ClassD/Ashmatique.cs new file mode 100644 index 00000000..93a4341e --- /dev/null +++ b/KruacentExiled/KE.CustomRoles/CR/ClassD/Ashmatique.cs @@ -0,0 +1,23 @@ +using Exiled.API.Features.Attributes; +using PlayerRoles; +using UnityEngine; + +namespace KE.CustomRoles.CR.ClassD +{ + [CustomRole(RoleTypeId.ClassD)] + internal class Asmathique : Exiled.CustomRoles.API.Features.CustomRole + { + public override string Name { get; set; } = "Asmathique"; + public override string Description { get; set; } = "Tu es asthmatique\nT'as stamina est réduit de moitié\nMais tu vises mieux"; + public override uint Id { get; set; } = 1048; + public override string CustomInfo { get; set; } = "Asmathique"; + public override int MaxHealth { get; set; } = 100; + public override RoleTypeId Role { get; set; } = RoleTypeId.ClassD; + public override bool KeepRoleOnDeath { get; set; } = true; + public override bool KeepRoleOnChangingRole { get; set; } = true; + public override bool IgnoreSpawnSystem { get; set; } = true; + + public override float SpawnChance { get; set; } = 100; + public override Vector3 Scale { get; set; } = new Vector3(1, 0.75f, 1); + } +} diff --git a/KruacentExiled/KE.CustomRoles/CR/Enfant.cs b/KruacentExiled/KE.CustomRoles/CR/ClassD/Enfant.cs similarity index 66% rename from KruacentExiled/KE.CustomRoles/CR/Enfant.cs rename to KruacentExiled/KE.CustomRoles/CR/ClassD/Enfant.cs index 4c6839b3..333e90f6 100644 --- a/KruacentExiled/KE.CustomRoles/CR/Enfant.cs +++ b/KruacentExiled/KE.CustomRoles/CR/ClassD/Enfant.cs @@ -1,17 +1,10 @@ using Exiled.API.Features.Attributes; -using Exiled.API.Features.Items; -using Exiled.API.Features.Spawn; using InventorySystem.Items.Usables.Scp330; using PlayerRoles; -using PluginAPI.Core.Items; -using System; using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; using UnityEngine; -namespace KE.CustomRoles.CR +namespace KE.CustomRoles.CR.ClassD { [CustomRole(RoleTypeId.ClassD)] internal class Enfant : Exiled.CustomRoles.API.Features.CustomRole @@ -22,12 +15,22 @@ internal class Enfant : Exiled.CustomRoles.API.Features.CustomRole public override string CustomInfo { get; set; } = "Enfant"; public override int MaxHealth { get; set; } = 100; public override RoleTypeId Role { get; set; } = RoleTypeId.ClassD; - public override bool KeepRoleOnDeath { get ; set ; } = true; + public override bool KeepRoleOnDeath { get; set; } = true; public override bool KeepRoleOnChangingRole { get; set; } = true; public override bool IgnoreSpawnSystem { get; set; } = true; public override float SpawnChance { get; set; } = 100; - public override Vector3 Scale { get ; set; } = new Vector3(1, 0.75f, 1); + public override Vector3 Scale { get; set; } = new Vector3(1, 0.75f, 1); + public override List Inventory { get; set; } = new List() + { + $"{CandyKindID.Rainbow}", + $"{ItemType.None}", + $"{ItemType.None}", + $"{ItemType.None}", + $"{ItemType.None}", + $"{ItemType.None}", + $"{ItemType.None}" + }; } } diff --git a/KruacentExiled/KE.CustomRoles/CR/Guard/ChiefGuard.cs b/KruacentExiled/KE.CustomRoles/CR/Guard/ChiefGuard.cs new file mode 100644 index 00000000..e3c0af9e --- /dev/null +++ b/KruacentExiled/KE.CustomRoles/CR/Guard/ChiefGuard.cs @@ -0,0 +1,40 @@ +using Exiled.API.Enums; +using Exiled.API.Features.Attributes; +using PlayerRoles; +using System.Collections.Generic; + +namespace KE.CustomRoles.CR.Guard +{ + [CustomRole(RoleTypeId.FacilityGuard)] + internal class ChiefGuard : Exiled.CustomRoles.API.Features.CustomRole + { + public override string Name { get; set; } = "ChiefGuard"; + public override string Description { get; set; } = "Tu es un Chef des gardes du site \nT'as une carte de private \net un crossvec"; + public override uint Id { get; set; } = 1041; + public override string CustomInfo { get; set; } = "Chef des Gardes"; + public override int MaxHealth { get; set; } = 100; + public override RoleTypeId Role { get; set; } = RoleTypeId.FacilityGuard; + public override bool KeepRoleOnDeath { get; set; } = false; + public override bool KeepRoleOnChangingRole { get; set; } = false; + public override bool IgnoreSpawnSystem { get; set; } = true; + + public override float SpawnChance { get; set; } = 100; + + public override List Inventory { get; set; } = new List() + { + $"{ItemType.Radio}", + $"{ItemType.ArmorLight}", + $"{ItemType.GunCrossvec}", + $"{ItemType.Medkit}", + $"{ItemType.Flashlight}", + $"{ItemType.KeycardMTFPrivate}", + $"{ItemType.None}" + }; + + public override Dictionary Ammo { get; set; } = new Dictionary() + { + { AmmoType.Nato556, 120} + }; + + } +} diff --git a/KruacentExiled/KE.CustomRoles/CR/Guard914.cs b/KruacentExiled/KE.CustomRoles/CR/Guard/Guard914.cs similarity index 64% rename from KruacentExiled/KE.CustomRoles/CR/Guard914.cs rename to KruacentExiled/KE.CustomRoles/CR/Guard/Guard914.cs index 27671f6e..634824d1 100644 --- a/KruacentExiled/KE.CustomRoles/CR/Guard914.cs +++ b/KruacentExiled/KE.CustomRoles/CR/Guard/Guard914.cs @@ -1,24 +1,21 @@ -using Exiled.API.Features.Attributes; +using Exiled.API.Enums; +using Exiled.API.Features.Attributes; using Exiled.API.Features.Spawn; using PlayerRoles; -using System; using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -namespace KE.CustomRoles.CR +namespace KE.CustomRoles.CR.Guard { [CustomRole(RoleTypeId.FacilityGuard)] internal class Guard914 : Exiled.CustomRoles.API.Features.CustomRole { public override string Name { get; set; } = "guard914"; public override string Description { get; set; } = "Tu es Le garde de SCP-914 \nTu commences à 914 \nmais on a volé ta carte \net ntm aussi"; - public override uint Id { get; set; } = 1040; + public override uint Id { get; set; } = 1042; public override string CustomInfo { get; set; } = "Garde de 914"; public override int MaxHealth { get; set; } = 100; public override RoleTypeId Role { get; set; } = RoleTypeId.FacilityGuard; - public override bool KeepRoleOnDeath { get ; set ; } = false; + public override bool KeepRoleOnDeath { get; set; } = false; public override bool KeepRoleOnChangingRole { get; set; } = false; public override bool IgnoreSpawnSystem { get; set; } = true; @@ -36,6 +33,21 @@ internal class Guard914 : Exiled.CustomRoles.API.Features.CustomRole public override float SpawnChance { get; set; } = 100; + public override List Inventory { get; set; } = new List() + { + $"{ItemType.Radio}", + $"{ItemType.ArmorLight}", + $"{ItemType.GunFSP9}", + $"{ItemType.Medkit}", + $"{ItemType.Flashlight}", + $"{ItemType.None}", + $"{ItemType.None}" + }; + + public override Dictionary Ammo { get; set; } = new Dictionary() + { + { AmmoType.Nato556, 60} + }; } } diff --git a/KruacentExiled/KE.CustomRoles/CR/MTF/Tank.cs b/KruacentExiled/KE.CustomRoles/CR/MTF/Tank.cs new file mode 100644 index 00000000..1a074251 --- /dev/null +++ b/KruacentExiled/KE.CustomRoles/CR/MTF/Tank.cs @@ -0,0 +1,79 @@ +using Exiled.API.Enums; +using Exiled.API.Features.Attributes; +using Player = Exiled.Events.Handlers.Player; +using Exiled.Events.EventArgs.Player; +using MEC; +using PlayerRoles; +using System.Collections.Generic; +using UnityEngine; + +namespace KE.CustomRoles.CR.ClassD +{ + [CustomRole(RoleTypeId.NtfCaptain)] + internal class Tank : Exiled.CustomRoles.API.Features.CustomRole + { + public override string Name { get; set; } = "Tank"; + public override string Description { get; set; } = "Tu es un TANK tu es débuff mais ta force de tir est démultiplié"; + public override uint Id { get; set; } = 1050; + public override string CustomInfo { get; set; } = "Tank"; + public override int MaxHealth { get; set; } = 200; + public override RoleTypeId Role { get; set; } = RoleTypeId.NtfCaptain; + public override bool KeepRoleOnDeath { get; set; } = false; + public override bool KeepRoleOnChangingRole { get; set; } = false; + public override bool IgnoreSpawnSystem { get; set; } = true; + + public override float SpawnChance { get; set; } = 100; + public override Vector3 Scale { get; set; } = new Vector3(1.75f, 1.75f, 1.75f); + + public override List Inventory { get; set; } = new List() + { + $"{ItemType.GunLogicer}", + $"{ItemType.GunFRMG0}", + $"{ItemType.Radio}", + $"{ItemType.GrenadeHE}", + $"{ItemType.Adrenaline}", + $"{ItemType.Painkillers}", + $"{ItemType.Painkillers}", + $"{ItemType.ArmorHeavy}" + }; + + public override Dictionary Ammo { get; set; } = new Dictionary() + { + { AmmoType.Nato762, 500} + }; + + protected override void SubscribeEvents() + { + Player.Shooting += Shooting; + base.SubscribeEvents(); + } + + /// + protected override void UnsubscribeEvents() + { + Player.Shooting -= Shooting; + base.UnsubscribeEvents(); + } + + private void Shooting(ShootingEventArgs ev) + { + Timing.CallDelayed(0.5f, () => + { + Timing.RunCoroutine(EffectAttribution(ev.Player)); + }); + } + + private IEnumerator EffectAttribution(Exiled.API.Features.Player player) + { + int nbMunition = player.GetAmmo(AmmoType.Nato762) / 100; + byte nbMunitionByte = (byte) nbMunition; + + if (UnityEngine.Random.Range(0, 1) > 0.5f){ + player.DisableEffect(EffectType.Slowness); + player.EnableEffect(EffectType.Slowness, nbMunitionByte, 99999, false); + } + + yield return Timing.WaitForSeconds(3); + } + } +} diff --git a/KruacentExiled/KE.CustomRoles/CR/MTF/Terroriste.cs b/KruacentExiled/KE.CustomRoles/CR/MTF/Terroriste.cs new file mode 100644 index 00000000..c2200cbd --- /dev/null +++ b/KruacentExiled/KE.CustomRoles/CR/MTF/Terroriste.cs @@ -0,0 +1,41 @@ +using Exiled.API.Enums; +using Exiled.API.Features.Attributes; +using PlayerRoles; +using System.Collections.Generic; +using UnityEngine; + +namespace KE.CustomRoles.CR.ClassD +{ + [CustomRole(RoleTypeId.NtfSergeant)] + internal class Terroriste : Exiled.CustomRoles.API.Features.CustomRole + { + public override string Name { get; set; } = "Terroriste"; + public override string Description { get; set; } = "Tu es un Terroriste \nne fait pas exploser la facilité \ntu commences avec des grenades"; + public override uint Id { get; set; } = 1049; + public override string CustomInfo { get; set; } = "Terroriste"; + public override int MaxHealth { get; set; } = 100; + public override RoleTypeId Role { get; set; } = RoleTypeId.NtfSergeant; + public override bool KeepRoleOnDeath { get; set; } = false; + public override bool KeepRoleOnChangingRole { get; set; } = false; + public override bool IgnoreSpawnSystem { get; set; } = true; + + public override float SpawnChance { get; set; } = 100; + public override Vector3 Scale { get; set; } = new Vector3(1, 1, 1); + + public override List Inventory { get; set; } = new List() + { + $"{ItemType.GrenadeHE}", + $"{ItemType.GrenadeHE}", + $"{ItemType.GrenadeHE}", + $"{ItemType.GunE11SR}", + $"{ItemType.Adrenaline}", + $"{ItemType.KeycardMTFOperative}", + $"{ItemType.Radio}" + }; + + public override Dictionary Ammo { get; set; } = new Dictionary() + { + { AmmoType.Nato556, 100} + }; + } +} diff --git a/KruacentExiled/KE.CustomRoles/CR/SCP/Paper049.cs b/KruacentExiled/KE.CustomRoles/CR/SCP/Paper049.cs new file mode 100644 index 00000000..2b565ea0 --- /dev/null +++ b/KruacentExiled/KE.CustomRoles/CR/SCP/Paper049.cs @@ -0,0 +1,23 @@ +using Exiled.API.Features.Attributes; +using PlayerRoles; +using UnityEngine; + +namespace KE.CustomRoles.CR.SCP +{ + [CustomRole(RoleTypeId.Scp049)] + internal class Paper049 : Exiled.CustomRoles.API.Features.CustomRole + { + public override string Name { get; set; } = "Small049"; + public override string Description { get; set; } = "u are a paper doctor"; + public override uint Id { get; set; } = 1047; + public override string CustomInfo { get; set; } = "Paper Doctor"; + public override int MaxHealth { get; set; } = 100; + public override RoleTypeId Role { get; set; } = RoleTypeId.Scp049; + public override bool KeepRoleOnDeath { get; set; } = false; + public override bool KeepRoleOnChangingRole { get; set; } = false; + public override bool IgnoreSpawnSystem { get; set; } = true; + + public override float SpawnChance { get; set; } = 100; + public override Vector3 Scale { get; set; } = new Vector3(0.1f, 1, 1); + } +} diff --git a/KruacentExiled/KE.CustomRoles/CR/SCP/Small049.cs b/KruacentExiled/KE.CustomRoles/CR/SCP/Small049.cs new file mode 100644 index 00000000..b1b73c92 --- /dev/null +++ b/KruacentExiled/KE.CustomRoles/CR/SCP/Small049.cs @@ -0,0 +1,23 @@ +using Exiled.API.Features.Attributes; +using PlayerRoles; +using UnityEngine; + +namespace KE.CustomRoles.CR.SCP +{ + [CustomRole(RoleTypeId.Scp049)] + internal class Small049 : Exiled.CustomRoles.API.Features.CustomRole + { + public override string Name { get; set; } = "Small049"; + public override string Description { get; set; } = "u are a smoll doctor"; + public override uint Id { get; set; } = 1045; + public override string CustomInfo { get; set; } = "Small Doctor"; + public override int MaxHealth { get; set; } = 100; + public override RoleTypeId Role { get; set; } = RoleTypeId.Scp049; + public override bool KeepRoleOnDeath { get; set; } = false; + public override bool KeepRoleOnChangingRole { get; set; } = false; + public override bool IgnoreSpawnSystem { get; set; } = true; + + public override float SpawnChance { get; set; } = 100; + public override Vector3 Scale { get; set; } = new Vector3(1, 0.75f, 1); + } +} diff --git a/KruacentExiled/KE.CustomRoles/CR/SCP/Small173.cs b/KruacentExiled/KE.CustomRoles/CR/SCP/Small173.cs new file mode 100644 index 00000000..9a3f01aa --- /dev/null +++ b/KruacentExiled/KE.CustomRoles/CR/SCP/Small173.cs @@ -0,0 +1,23 @@ +using Exiled.API.Features.Attributes; +using PlayerRoles; +using UnityEngine; + +namespace KE.CustomRoles.CR.SCP +{ + [CustomRole(RoleTypeId.Scp173)] + internal class Small173 : Exiled.CustomRoles.API.Features.CustomRole + { + public override string Name { get; set; } = "Small173"; + public override string Description { get; set; } = "u are a small peanuts"; + public override uint Id { get; set; } = 1046; + public override string CustomInfo { get; set; } = "Small Peanuts"; + public override int MaxHealth { get; set; } = 100; + public override RoleTypeId Role { get; set; } = RoleTypeId.Scp173; + public override bool KeepRoleOnDeath { get; set; } = false; + public override bool KeepRoleOnChangingRole { get; set; } = false; + public override bool IgnoreSpawnSystem { get; set; } = true; + + public override float SpawnChance { get; set; } = 100; + public override Vector3 Scale { get; set; } = new Vector3(1, 0.75f, 1); + } +} diff --git a/KruacentExiled/KE.CustomRoles/CR/Scientist/GambleAddict.cs b/KruacentExiled/KE.CustomRoles/CR/Scientist/GambleAddict.cs new file mode 100644 index 00000000..c0f6b109 --- /dev/null +++ b/KruacentExiled/KE.CustomRoles/CR/Scientist/GambleAddict.cs @@ -0,0 +1,35 @@ +using Exiled.API.Features.Attributes; +using PlayerRoles; +using System.Collections.Generic; +using UnityEngine; + +namespace KE.CustomRoles.CR.Scientist +{ + [CustomRole(RoleTypeId.Scientist)] + internal class GambleAddict : Exiled.CustomRoles.API.Features.CustomRole + { + public override string Name { get; set; } = "GambleAddict"; + public override string Description { get; set; } = "Tu es un Gamble Addict \nT'as trade ton kit et ta carte contre 4 pièces \nfais en bon usage"; + public override uint Id { get; set; } = 1043; + public override string CustomInfo { get; set; } = "GambleAddict"; + public override int MaxHealth { get; set; } = 100; + public override RoleTypeId Role { get; set; } = RoleTypeId.Scientist; + public override bool KeepRoleOnDeath { get; set; } = false; + public override bool KeepRoleOnChangingRole { get; set; } = false; + public override bool IgnoreSpawnSystem { get; set; } = true; + + public override float SpawnChance { get; set; } = 100; + public override Vector3 Scale { get; set; } = new Vector3(1, 1, 1); + + public override List Inventory { get; set; } = new List() + { + $"{ItemType.Coin}", + $"{ItemType.Coin}", + $"{ItemType.Coin}", + $"{ItemType.Coin}", + $"{ItemType.None}", + $"{ItemType.None}", + $"{ItemType.None}" + }; + } +} diff --git a/KruacentExiled/KE.CustomRoles/CR/Scientist/ZoneManager.cs b/KruacentExiled/KE.CustomRoles/CR/Scientist/ZoneManager.cs new file mode 100644 index 00000000..c9f209bd --- /dev/null +++ b/KruacentExiled/KE.CustomRoles/CR/Scientist/ZoneManager.cs @@ -0,0 +1,48 @@ +using Exiled.API.Features.Attributes; +using Exiled.API.Features.Spawn; +using PlayerRoles; +using System.Collections.Generic; +using UnityEngine; + +namespace KE.CustomRoles.CR.Scientist +{ + [CustomRole(RoleTypeId.Scientist)] + internal class ZoneManager : Exiled.CustomRoles.API.Features.CustomRole + { + public override string Name { get; set; } = "ZoneManager"; + public override string Description { get; set; } = "Tu es un Zone Manager \nT'as une carte de zone manager (d'où le nom) \nTu commences à heavy \nBon courage..."; + public override uint Id { get; set; } = 1044; + public override string CustomInfo { get; set; } = "ZoneManager"; + public override int MaxHealth { get; set; } = 100; + public override RoleTypeId Role { get; set; } = RoleTypeId.Scientist; + public override bool KeepRoleOnDeath { get; set; } = false; + public override bool KeepRoleOnChangingRole { get; set; } = false; + public override bool IgnoreSpawnSystem { get; set; } = true; + + public override float SpawnChance { get; set; } = 100; + public override Vector3 Scale { get; set; } = new Vector3(1, 1, 1); + + public override SpawnProperties SpawnProperties { get; set; } = new SpawnProperties() + { + DynamicSpawnPoints = new List() + { + new DynamicSpawnPoint() + { + Location = Exiled.API.Enums.SpawnLocationType.InsideNukeArmory, + Chance = 100, + } + } + }; + + public override List Inventory { get; set; } = new List() + { + $"{ItemType.Medkit}", + $"{ItemType.None}", + $"{ItemType.Adrenaline}", + $"{ItemType.None}", + $"{ItemType.None}", + $"{ItemType.None}", + $"{ItemType.KeycardZoneManager}" + }; + } +} From f0d8bb703ece7db2eb1c2e1119ad9a5c381e8173 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Sun, 12 Jan 2025 07:36:23 +0100 Subject: [PATCH 091/853] added the possibility to have light on custom items --- .../KE.Items/Interface/ILumosItem.cs | 14 +++ KruacentExiled/KE.Items/MainPlugin.cs | 101 +++++++++++++++++- 2 files changed, 114 insertions(+), 1 deletion(-) create mode 100644 KruacentExiled/KE.Items/Interface/ILumosItem.cs diff --git a/KruacentExiled/KE.Items/Interface/ILumosItem.cs b/KruacentExiled/KE.Items/Interface/ILumosItem.cs new file mode 100644 index 00000000..d2116101 --- /dev/null +++ b/KruacentExiled/KE.Items/Interface/ILumosItem.cs @@ -0,0 +1,14 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace KE.Items.Interface +{ + internal interface ILumosItem + { + + UnityEngine.Color Color { get; set; } + } +} diff --git a/KruacentExiled/KE.Items/MainPlugin.cs b/KruacentExiled/KE.Items/MainPlugin.cs index 15a559cc..05ddbc93 100644 --- a/KruacentExiled/KE.Items/MainPlugin.cs +++ b/KruacentExiled/KE.Items/MainPlugin.cs @@ -1,7 +1,14 @@  using Exiled.API.Features; +using Exiled.API.Features.Pickups; +using Exiled.API.Features.Toys; using Exiled.CustomItems.API.Features; +using Exiled.Events.EventArgs.Player; +using KE.Items.Interface; +using MEC; using System; +using System.Collections.Generic; +using System.Linq; namespace KE.Items { @@ -9,11 +16,16 @@ public class MainPlugin : Plugin { public override string Author => "Patrique & OmerGS"; public override string Name => "KEItems"; + internal static MainPlugin Instance { get; private set; } public override Version Version => new Version(1, 0, 0); + private Dictionary pl = new Dictionary(); public override void OnEnabled() { - + Instance = this; CustomItem.RegisterItems(); + Exiled.Events.Handlers.Player.DroppedItem += Drop; + Exiled.Events.Handlers.Player.PickingUpItem += Pick; + Exiled.Events.Handlers.Server.RoundStarted += OnRoundStarted; base.OnEnabled(); } @@ -21,8 +33,95 @@ public override void OnEnabled() public override void OnDisabled() { CustomItem.UnregisterItems(); + Exiled.Events.Handlers.Player.DroppedItem -= Drop; + Exiled.Events.Handlers.Player.PickingUpItem -= Pick; + Exiled.Events.Handlers.Server.RoundStarted -= OnRoundStarted; base.OnDisabled(); + Instance = null; + } + + public void Pick(PickingUpItemEventArgs ev) + { + Pickup pickup = ev.Pickup; + if (pl.ContainsKey(pickup)) + { + Light val = pl[pickup]; + if (val != null) + { + val.UnSpawn(); + val.Destroy(); + } + pl.Remove(pickup); + } + } + public void Drop(DroppedItemEventArgs ev) + { + Pickup pickup = ev.Pickup; + if (CustomItem.TryGet(pickup, out CustomItem item) && item is ILumosItem ci) + { + pl.Add(pickup, null); + } + + } + public void OnRoundStarted() + { + Timing.RunCoroutine(LightP()); + } + + internal IEnumerator LightP() + { + + foreach (var p in Pickup.List) + { + if (p != null) + { + if (CustomItem.TryGet(p, out CustomItem ci) && ci is ILumosItem) + pl.Add(p, null); + } + + } + while (Round.InProgress) + { + Log.Debug("boop"); + + foreach (var x in pl.ToList()) + { + if(CustomItem.TryGet(x.Key, out CustomItem cui) && cui is ILumosItem ci) + { + Light light = Light.Create(x.Key.Position, null, null, true, ci.Color); + light.Intensity = 0.5f; + Log.Debug("preif"); + if (x.Value != null) + { + Log.Debug("pre val"); + Light val = x.Value; + Log.Debug($"destroy light {val.Position}"); + val.UnSpawn(); + Log.Debug("pre destroy"); + val.Destroy(); + } + else + Log.Debug("first cretate"); + Log.Debug("reasigne"); + pl[x.Key] = light; + Log.Debug("post reasigne"); + //Log.Debug(x.Key.Position+";"+x.Value.Position); + } + else + { + Light val = x.Value; + val.UnSpawn(); + val.Destroy(); + pl.Remove(x.Key); + } + } + Log.Debug("waiting"); + yield return Timing.WaitForSeconds(0.1f); + } + Log.Debug("end while"); + } + } } \ No newline at end of file From 7e37e1431c00847de42195dc9c368333ee23e9de Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Sun, 12 Jan 2025 07:37:01 +0100 Subject: [PATCH 092/853] =?UTF-8?q?fixed=20the=20presse=20pur=C3=A9e=20and?= =?UTF-8?q?=20reduce=20its=20damage?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- KruacentExiled/KE.Items/Items/PressePuree.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/KruacentExiled/KE.Items/Items/PressePuree.cs b/KruacentExiled/KE.Items/Items/PressePuree.cs index ad9465e4..dd61dddd 100644 --- a/KruacentExiled/KE.Items/Items/PressePuree.cs +++ b/KruacentExiled/KE.Items/Items/PressePuree.cs @@ -8,15 +8,16 @@ namespace KE.Items.Items { + [CustomItem(ItemType.GrenadeHE)] public class PressePuree : CustomGrenade { public override uint Id { get; set; } = 1406; public override string Name { get; set; } = "Presse Purée"; - public override string Description { get; set; } = "The grenade explose at impact"; + public override string Description { get; set; } = "The grenade explode at impact but does less damage"; public override float Weight { get; set; } = 0.65f; public override float FuseTime { get; set; } = 1.5f; public override bool ExplodeOnCollision { get; set; } = true; - public float DamageModifier { get; set; } = 1f; + public float DamageModifier { get; set; } = 0.9f; public override SpawnProperties SpawnProperties { get; set; } = new SpawnProperties() { Limit = 5, From f4e21cff58a78953b929fdb82c5873dc6edbf98e Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Sun, 12 Jan 2025 07:37:20 +0100 Subject: [PATCH 093/853] added light to the tp grenade --- KruacentExiled/KE.Items/Items/TPGrenada.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/KruacentExiled/KE.Items/Items/TPGrenada.cs b/KruacentExiled/KE.Items/Items/TPGrenada.cs index 5d7179f7..b4f212b4 100644 --- a/KruacentExiled/KE.Items/Items/TPGrenada.cs +++ b/KruacentExiled/KE.Items/Items/TPGrenada.cs @@ -9,6 +9,7 @@ using Exiled.API.Features.Spawn; using Exiled.CustomItems.API.Features; using Exiled.Events.EventArgs.Map; +using KE.Items.Interface; using PlayerRoles; using UnityEngine; @@ -16,7 +17,7 @@ namespace KE.Items.Items { //grenade qui tp [CustomItem(ItemType.GrenadeHE)] - public class TPGrenada : CustomGrenade + public class TPGrenada : CustomGrenade, ILumosItem { private List effectedPlayers = new List(); public override uint Id { get; set; } = 1405; @@ -26,6 +27,7 @@ public class TPGrenada : CustomGrenade public override float FuseTime { get; set; } = 1.5f; public override bool ExplodeOnCollision { get; set; } = true; public float DamageModifier { get; set; } = 0.05f; + public UnityEngine.Color Color { get; set; } = UnityEngine.Color.cyan; public override SpawnProperties SpawnProperties { get; set; } = new SpawnProperties() { Limit = 5, From edf6eaf782d49ab41257f51c2b4a9eabb526aa1c Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Sun, 12 Jan 2025 07:39:13 +0100 Subject: [PATCH 094/853] added divine pills close #51 --- KruacentExiled/KE.Items/Items/DivinePills.cs | 100 +++++++++++++++++++ 1 file changed, 100 insertions(+) create mode 100644 KruacentExiled/KE.Items/Items/DivinePills.cs diff --git a/KruacentExiled/KE.Items/Items/DivinePills.cs b/KruacentExiled/KE.Items/Items/DivinePills.cs new file mode 100644 index 00000000..5460e602 --- /dev/null +++ b/KruacentExiled/KE.Items/Items/DivinePills.cs @@ -0,0 +1,100 @@ +using System.Collections.Generic; +using Exiled.API.Enums; +using Exiled.API.Features.Attributes; +using Exiled.API.Features.Spawn; +using Exiled.CustomItems.API.Features; +using MEC; +using Exiled.Events.EventArgs.Player; +using PlayerHandle = Exiled.Events.Handlers.Player; +using Exiled.API.Features; +using Exiled.API.Extensions; +using UnityEngine; +using CustomPlayerEffects; +using System.Linq; +using PlayerRoles; +using KE.Items.Interface; + +/// +[CustomItem(ItemType.Painkillers)] +public class DivinePills : CustomItem, ILumosItem +{ + /// + public override uint Id { get; set; } = 1406; + + /// + public override string Name { get; set; } = "Divine Pills"; + + /// + public override string Description { get; set; } = "25% chance you die\n 75% you respawn someone"; + + /// + public override float Weight { get; set; } = 0.65f; + public UnityEngine.Color Color { get; set; } = UnityEngine.Color.yellow; + + /// + public override SpawnProperties SpawnProperties { get; set; } = new SpawnProperties() + { + LockerSpawnPoints = new List + { + new LockerSpawnPoint() + { + Chance = 75, + UseChamber = true, + Type = LockerType.Misc, + Zone = ZoneType.Entrance, + }, + new LockerSpawnPoint() + { + Chance = 25, + UseChamber = true, + Type = LockerType.Medkit, + Zone = ZoneType.LightContainment, + }, + }, + RoomSpawnPoints = new List + { + new RoomSpawnPoint() + { + Chance = 100, + Room = RoomType.LczGlassBox, + }, + }, + + }; + + /// + protected override void SubscribeEvents() + { + PlayerHandle.UsedItem += OnUsingItem; + base.SubscribeEvents(); + } + + /// + protected override void UnsubscribeEvents() + { + PlayerHandle.UsedItem -= OnUsingItem; + base.UnsubscribeEvents(); + } + + private void OnUsingItem(UsedItemEventArgs ev) + { + + if (TryGet(ev.Item, out var result) && result.Id == Id) + { + Player player = ev.Player; + var random = Random.Range(0, 100); + if (random <= 25) + { + player.Kill("unlucky bro"); + return; + } + Player respawning = Player.List.Where(x => x.Role == RoleTypeId.Spectator).GetRandomValue(); + respawning.Role.Set(player.Role); + if (random > 75) + { + respawning.Position = player.Position; + } + } + } + +} \ No newline at end of file From e3465cf5a6ac65837713d05d4970532a0e2333ed Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Sun, 12 Jan 2025 09:17:12 +0100 Subject: [PATCH 095/853] fixed divine pills crashing --- KruacentExiled/KE.Items/Items/DivinePills.cs | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/KruacentExiled/KE.Items/Items/DivinePills.cs b/KruacentExiled/KE.Items/Items/DivinePills.cs index 5460e602..4c4e42b2 100644 --- a/KruacentExiled/KE.Items/Items/DivinePills.cs +++ b/KruacentExiled/KE.Items/Items/DivinePills.cs @@ -78,11 +78,21 @@ protected override void UnsubscribeEvents() private void OnUsingItem(UsedItemEventArgs ev) { - + if (!Check(ev.Item)) + { + return; + } if (TryGet(ev.Item, out var result) && result.Id == Id) { Player player = ev.Player; var random = Random.Range(0, 100); + + if(Player.List.Where(x => x.Role == RoleTypeId.Spectator).Count() == 0) + { + player.ShowHint("No spectators to respawn"); + return; + } + if (random <= 25) { player.Kill("unlucky bro"); From c2a08b5b81ca1b29407b23edd120c39bfeae5e3f Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Sun, 12 Jan 2025 09:17:27 +0100 Subject: [PATCH 096/853] added deployable wall --- .../KE.Items/Items/DeployableWall.cs | 98 +++++++++++++++++++ 1 file changed, 98 insertions(+) create mode 100644 KruacentExiled/KE.Items/Items/DeployableWall.cs diff --git a/KruacentExiled/KE.Items/Items/DeployableWall.cs b/KruacentExiled/KE.Items/Items/DeployableWall.cs new file mode 100644 index 00000000..f40f116f --- /dev/null +++ b/KruacentExiled/KE.Items/Items/DeployableWall.cs @@ -0,0 +1,98 @@ +using Exiled.API.Enums; +using Exiled.API.Features.Attributes; +using Exiled.API.Features.Spawn; +using Exiled.CustomItems.API.Features; +using KE.Items.Interface; +using System.Collections.Generic; +using UnityEngine; +using Exiled.Events.EventArgs.Player; +using Exiled.API.Features.Toys; +using MEC; + +namespace KE.Items.Items +{ + //grenade qui tp + [CustomItem(ItemType.KeycardJanitor)] + public class DeployableWall : CustomItem, ILumosItem + { + + public override uint Id { get; set; } = 1407; + public override string Name { get; set; } = "Deployable Wall"; + public override string Description { get; set; } = "Drop to deploy a wall, and throw to just throw the card"; + public override float Weight { get; set; } = 0.65f; + public UnityEngine.Color Color { get; set; } = UnityEngine.Color.green; + public override SpawnProperties SpawnProperties { get; set; } = new SpawnProperties() + { + Limit = 2, + DynamicSpawnPoints = new List + { + new DynamicSpawnPoint() + { + Chance=25, + Location = SpawnLocationType.Inside049Armory, + }, + new DynamicSpawnPoint() + { + Chance=25, + Location = SpawnLocationType.InsideLczArmory, + } + }, + LockerSpawnPoints = new List + { + new LockerSpawnPoint() + { + Chance=50, + Type = LockerType.RifleRack, + }, + } + + }; + + + + + protected override void OnDropping(DroppingItemEventArgs ev) + { + if(!Check(ev.Item)) + return; + if (ev.IsThrown) + { + ev.IsAllowed = true; + return; + } + ev.IsAllowed = false; + ev.Player.ShowHint("You have dropped a deployable wall"); + ev.Player.RemoveItem(ev.Item); + SpawnWall(ev.Player.Position,ev.Player.Rotation); + + } + + private void SpawnWall(Vector3 pos, Quaternion rotation) + { + float distance = 2; + Vector3 forward = rotation * Vector3.forward; + Vector3 spawnPos = pos + forward * distance; + Vector3 rotat = new Vector3(0, rotation.eulerAngles.y, 0); + + Primitive wall = Primitive.Create(PrimitiveType.Cube, spawnPos, rotat, new Vector3(4, 4, 0.2f),true); + wall.Collidable = true; + wall.Visible = true; + Timing.CallDelayed(10, () => { + wall.UnSpawn(); + wall.Destroy(); + }); + Timing.CallDelayed(5, () => + { + wall.Color= Color.yellow; + }); + Timing.CallDelayed(8, () => + { + wall.Color = Color.red; + }); + + + } + + } + +} From 6e2b8a20b3c9ec687eade7ba9ec814b4b9ed9bb6 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Sun, 12 Jan 2025 09:28:11 +0100 Subject: [PATCH 097/853] resolved id conflit --- KruacentExiled/KE.Items/Items/DeployableWall.cs | 2 +- KruacentExiled/KE.Items/Items/DivinePills.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/KruacentExiled/KE.Items/Items/DeployableWall.cs b/KruacentExiled/KE.Items/Items/DeployableWall.cs index f40f116f..e93723f7 100644 --- a/KruacentExiled/KE.Items/Items/DeployableWall.cs +++ b/KruacentExiled/KE.Items/Items/DeployableWall.cs @@ -16,7 +16,7 @@ namespace KE.Items.Items public class DeployableWall : CustomItem, ILumosItem { - public override uint Id { get; set; } = 1407; + public override uint Id { get; set; } = 1408; public override string Name { get; set; } = "Deployable Wall"; public override string Description { get; set; } = "Drop to deploy a wall, and throw to just throw the card"; public override float Weight { get; set; } = 0.65f; diff --git a/KruacentExiled/KE.Items/Items/DivinePills.cs b/KruacentExiled/KE.Items/Items/DivinePills.cs index 4c4e42b2..5c06ef75 100644 --- a/KruacentExiled/KE.Items/Items/DivinePills.cs +++ b/KruacentExiled/KE.Items/Items/DivinePills.cs @@ -19,7 +19,7 @@ public class DivinePills : CustomItem, ILumosItem { /// - public override uint Id { get; set; } = 1406; + public override uint Id { get; set; } = 1407; /// public override string Name { get; set; } = "Divine Pills"; From e2f7f9f8671c7888162ff0a7d100e7a52c968be5 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Sun, 12 Jan 2025 09:28:20 +0100 Subject: [PATCH 098/853] =?UTF-8?q?nerf=20the=20presse=20pur=C3=A9e?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- KruacentExiled/KE.Items/Items/PressePuree.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/KruacentExiled/KE.Items/Items/PressePuree.cs b/KruacentExiled/KE.Items/Items/PressePuree.cs index dd61dddd..5a8016d2 100644 --- a/KruacentExiled/KE.Items/Items/PressePuree.cs +++ b/KruacentExiled/KE.Items/Items/PressePuree.cs @@ -17,7 +17,7 @@ public class PressePuree : CustomGrenade public override float Weight { get; set; } = 0.65f; public override float FuseTime { get; set; } = 1.5f; public override bool ExplodeOnCollision { get; set; } = true; - public float DamageModifier { get; set; } = 0.9f; + public float DamageModifier { get; set; } = 0.4f; public override SpawnProperties SpawnProperties { get; set; } = new SpawnProperties() { Limit = 5, From 74dc0e37d6629892e073d78fc5b01610eb9f61ac Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Sun, 12 Jan 2025 16:00:25 +0100 Subject: [PATCH 099/853] removed comments and corrected classes name --- KruacentExiled/KE.Items/Items/Defibrilator.cs | 2 +- KruacentExiled/KE.Items/Items/DeployableWall.cs | 1 - KruacentExiled/KE.Items/Items/Mine.cs | 17 ----------------- KruacentExiled/KE.Items/Items/TPGrenada.cs | 6 ------ 4 files changed, 1 insertion(+), 25 deletions(-) delete mode 100644 KruacentExiled/KE.Items/Items/Mine.cs diff --git a/KruacentExiled/KE.Items/Items/Defibrilator.cs b/KruacentExiled/KE.Items/Items/Defibrilator.cs index a06eec88..a4c1f6a5 100644 --- a/KruacentExiled/KE.Items/Items/Defibrilator.cs +++ b/KruacentExiled/KE.Items/Items/Defibrilator.cs @@ -9,8 +9,8 @@ using Exiled.API.Features; using UnityEngine; using System.Linq; -[CustomItem(ItemType.SCP1853)] +[CustomItem(ItemType.SCP1853)] public class Defibrilator : CustomItem { public override uint Id { get; set; } = 1401; diff --git a/KruacentExiled/KE.Items/Items/DeployableWall.cs b/KruacentExiled/KE.Items/Items/DeployableWall.cs index e93723f7..b3218832 100644 --- a/KruacentExiled/KE.Items/Items/DeployableWall.cs +++ b/KruacentExiled/KE.Items/Items/DeployableWall.cs @@ -11,7 +11,6 @@ namespace KE.Items.Items { - //grenade qui tp [CustomItem(ItemType.KeycardJanitor)] public class DeployableWall : CustomItem, ILumosItem { diff --git a/KruacentExiled/KE.Items/Items/Mine.cs b/KruacentExiled/KE.Items/Items/Mine.cs deleted file mode 100644 index 5ba232c1..00000000 --- a/KruacentExiled/KE.Items/Items/Mine.cs +++ /dev/null @@ -1,17 +0,0 @@ -using Exiled.CustomItems.API.Features; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace KE.Items.Items -{ - - //une mine - /*public class Mine : CustomGrenade - { - - } - */ -} diff --git a/KruacentExiled/KE.Items/Items/TPGrenada.cs b/KruacentExiled/KE.Items/Items/TPGrenada.cs index b4f212b4..881914db 100644 --- a/KruacentExiled/KE.Items/Items/TPGrenada.cs +++ b/KruacentExiled/KE.Items/Items/TPGrenada.cs @@ -15,7 +15,6 @@ namespace KE.Items.Items { - //grenade qui tp [CustomItem(ItemType.GrenadeHE)] public class TPGrenada : CustomGrenade, ILumosItem { @@ -122,9 +121,4 @@ private Room RandomRoom() } } - //bonbon quand tu manges ça donne une armes random - /*public class RandomWeaponCandy : CustomItem - { - - }*/ } From d47507fa97a9c179ccd2048868cbfb9858359d89 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Sun, 12 Jan 2025 18:55:15 +0100 Subject: [PATCH 100/853] added respawn token --- KruacentExiled/KE.Misc/MainPlugin.cs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/KruacentExiled/KE.Misc/MainPlugin.cs b/KruacentExiled/KE.Misc/MainPlugin.cs index 04275d79..f689177c 100644 --- a/KruacentExiled/KE.Misc/MainPlugin.cs +++ b/KruacentExiled/KE.Misc/MainPlugin.cs @@ -41,7 +41,8 @@ public override void OnEnabled() { Log.Error("ChancePinkCandy must be between 0 and 100"); } - + Respawn.SetTokens(SpawnableFaction.NtfWave, 2); + Respawn.SetTokens(SpawnableFaction.ChaosWave, 2); ServerHandle.RoundStarted += ServerHandler.OnRoundStarted; Nine14Handle.UpgradingPlayer += _914.OnUpgradingPlayer; @@ -60,9 +61,10 @@ public override void OnDisabled() Exiled.Events.Handlers.Scp330.InteractingScp330 -= Candy.InteractingScp330; Candy = null; } - - + + + _914 = null; ClassDDoor = null; ServerHandler = null; From e0281fff4fc7c42c1d43875ab8f043914ec296ca Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Mon, 13 Jan 2025 17:46:26 +0100 Subject: [PATCH 101/853] tried to add sound when placing a wall --- .../KE.Items/Items/DeployableWall.cs | 2 + KruacentExiled/KE.Items/KE.Items.csproj | 1 + KruacentExiled/KE.Items/MainPlugin.cs | 7 +++- KruacentExiled/KE.Items/Sound.cs | 37 +++++++++++++++++++ 4 files changed, 46 insertions(+), 1 deletion(-) create mode 100644 KruacentExiled/KE.Items/Sound.cs diff --git a/KruacentExiled/KE.Items/Items/DeployableWall.cs b/KruacentExiled/KE.Items/Items/DeployableWall.cs index b3218832..90ffcf36 100644 --- a/KruacentExiled/KE.Items/Items/DeployableWall.cs +++ b/KruacentExiled/KE.Items/Items/DeployableWall.cs @@ -59,6 +59,7 @@ protected override void OnDropping(DroppingItemEventArgs ev) ev.IsAllowed = true; return; } + ev.IsAllowed = false; ev.Player.ShowHint("You have dropped a deployable wall"); ev.Player.RemoveItem(ev.Item); @@ -73,6 +74,7 @@ private void SpawnWall(Vector3 pos, Quaternion rotation) Vector3 spawnPos = pos + forward * distance; Vector3 rotat = new Vector3(0, rotation.eulerAngles.y, 0); + MainPlugin.Instance.Sound.PlayClip("build", spawnPos); Primitive wall = Primitive.Create(PrimitiveType.Cube, spawnPos, rotat, new Vector3(4, 4, 0.2f),true); wall.Collidable = true; wall.Visible = true; diff --git a/KruacentExiled/KE.Items/KE.Items.csproj b/KruacentExiled/KE.Items/KE.Items.csproj index fee0f33f..fad1fab0 100644 --- a/KruacentExiled/KE.Items/KE.Items.csproj +++ b/KruacentExiled/KE.Items/KE.Items.csproj @@ -16,6 +16,7 @@ + diff --git a/KruacentExiled/KE.Items/MainPlugin.cs b/KruacentExiled/KE.Items/MainPlugin.cs index 05ddbc93..fa6a622c 100644 --- a/KruacentExiled/KE.Items/MainPlugin.cs +++ b/KruacentExiled/KE.Items/MainPlugin.cs @@ -16,17 +16,21 @@ public class MainPlugin : Plugin { public override string Author => "Patrique & OmerGS"; public override string Name => "KEItems"; + internal Sound Sound { get; private set; } internal static MainPlugin Instance { get; private set; } public override Version Version => new Version(1, 0, 0); private Dictionary pl = new Dictionary(); public override void OnEnabled() { Instance = this; + Sound = new Sound(); + + CustomItem.RegisterItems(); Exiled.Events.Handlers.Player.DroppedItem += Drop; Exiled.Events.Handlers.Player.PickingUpItem += Pick; Exiled.Events.Handlers.Server.RoundStarted += OnRoundStarted; - + base.OnEnabled(); } @@ -38,6 +42,7 @@ public override void OnDisabled() Exiled.Events.Handlers.Server.RoundStarted -= OnRoundStarted; base.OnDisabled(); + Sound = null; Instance = null; } diff --git a/KruacentExiled/KE.Items/Sound.cs b/KruacentExiled/KE.Items/Sound.cs new file mode 100644 index 00000000..37cc714f --- /dev/null +++ b/KruacentExiled/KE.Items/Sound.cs @@ -0,0 +1,37 @@ + + +namespace KE.Items +{ + internal class Sound + { + private AudioPlayer audioPlayer; + + public Sound() + { + + } + + ~Sound() + { + audioPlayer.RemoveAllClips(); + } + + public void LoadClips() + { + AudioClipStorage.LoadClip("C:\\Users\\Patrique\\AppData\\Roaming\\EXILED\\Plugins\\audio\\lego.ogg", "build"); + } + + + + internal void PlayClip(string clipName, UnityEngine.Vector3 pos) + { + audioPlayer = AudioPlayer.CreateOrGet($"Global AudioPlayer", onIntialCreation: (p) => + { + Speaker speaker = p.AddSpeaker("Main", isSpatial: true, maxDistance: 20f, minDistance: 5f); + speaker.transform.localPosition = pos; + }); + + audioPlayer.AddClip(clipName, volume:1); + } + } +} From 7032245d5a19e8cd0a531fa1b785895e22ffea26 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Mon, 13 Jan 2025 18:02:14 +0100 Subject: [PATCH 102/853] fix #54 changed the cooldown of the system malfunction --- .../GE/Blitz.cs | 9 ++-- .../GE/Impostor.cs | 5 ++- .../GE/KIWIS.cs | 5 ++- .../GE/OpenBar.cs | 9 ++-- .../KE.GlobalEventFramework.Examples/GE/R.cs | 4 -- .../GE/RandomSpawn.cs | 5 ++- .../GE/Shuffle.cs | 9 ++-- .../GE/Speed.cs | 9 ++-- .../GE/SystemMalfunction.cs | 30 ++++++------- .../GEFE/API/Features/GlobalEvent.cs | 43 ++++++++++--------- .../GEFE/API/Interfaces/IEvent.cs | 20 +++++++++ .../GEFE/API/Interfaces/IGlobalEvent.cs | 14 +----- .../GEFE/API/Interfaces/IStart.cs | 16 +++++++ .../GEFE/Handlers/ServerHandler.cs | 8 ++-- 14 files changed, 105 insertions(+), 81 deletions(-) create mode 100644 KruacentExiled/KE.GlobalEventFramework/GEFE/API/Interfaces/IEvent.cs create mode 100644 KruacentExiled/KE.GlobalEventFramework/GEFE/API/Interfaces/IStart.cs diff --git a/KruacentExiled/KE.GlobalEventFramework.Examples/GE/Blitz.cs b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/Blitz.cs index 170be1ff..db94c76d 100644 --- a/KruacentExiled/KE.GlobalEventFramework.Examples/GE/Blitz.cs +++ b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/Blitz.cs @@ -1,19 +1,16 @@ using Exiled.API.Features; using Exiled.API.Features.Items; using KE.GlobalEventFramework.GEFE.API.Features; +using KE.GlobalEventFramework.GEFE.API.Interfaces; using MEC; -using System; using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; namespace KE.GlobalEventFramework.Examples.GE { /// /// Spawn fused grenades in random rooms in the map /// - public class Blitz : GlobalEvent + public class Blitz : GlobalEvent, IStart { /// public override uint Id { get; set; } = 1046; @@ -32,7 +29,7 @@ public class Blitz : GlobalEvent /// public int NbGrenadeSpawned { get; set; } = 5; /// - public override IEnumerator Start() + public IEnumerator Start() { while (!Round.IsEnded) { diff --git a/KruacentExiled/KE.GlobalEventFramework.Examples/GE/Impostor.cs b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/Impostor.cs index ef664b90..36b64b9c 100644 --- a/KruacentExiled/KE.GlobalEventFramework.Examples/GE/Impostor.cs +++ b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/Impostor.cs @@ -1,6 +1,7 @@ using Player = Exiled.API.Features.Player; using System.Collections.Generic; using KE.GlobalEventFramework.GEFE.API.Features; +using KE.GlobalEventFramework.GEFE.API.Interfaces; using MEC; using System.Linq; using Exiled.API.Extensions; @@ -8,14 +9,14 @@ namespace KE.GlobalEventFramework.Examples.GE { - public class Impostor : GlobalEvent + public class Impostor : GlobalEvent, IStart { public override uint Id { get; set; } = 1044; public override string Name { get; set; } = "Impostor"; public override string Description { get; set; } = "Ne vous fiez pas aux apparences !"; public override int Weight { get; set; } = 1; - public override IEnumerator Start() + public IEnumerator Start() { while (!Round.IsEnded) { diff --git a/KruacentExiled/KE.GlobalEventFramework.Examples/GE/KIWIS.cs b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/KIWIS.cs index 812dbdd6..268194fc 100644 --- a/KruacentExiled/KE.GlobalEventFramework.Examples/GE/KIWIS.cs +++ b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/KIWIS.cs @@ -5,6 +5,7 @@ using System.Collections.Generic; using System.Linq; using KE.GlobalEventFramework.GEFE.API.Features; +using KE.GlobalEventFramework.GEFE.API.Interfaces; namespace KE.GlobalEventFramework.Examples.GE @@ -12,7 +13,7 @@ namespace KE.GlobalEventFramework.Examples.GE /// /// The scp start with 2/3 of it's life and end with 4/3 of it's vanilla life /// - public class KIWIS : GlobalEvent + public class KIWIS : GlobalEvent,IStart { /// public override uint Id { get; set; } = 1047; @@ -23,7 +24,7 @@ public class KIWIS : GlobalEvent /// public override int Weight { get; set; } = 1; /// - public override IEnumerator Start() + public IEnumerator Start() { var listScp = Player.List.ToList().Where(p => p.IsScp && p.Role.Type != RoleTypeId.Scp0492).ToList().ToDictionary(p => p, p => p.MaxHealth/3); diff --git a/KruacentExiled/KE.GlobalEventFramework.Examples/GE/OpenBar.cs b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/OpenBar.cs index cfaf4698..73027fb5 100644 --- a/KruacentExiled/KE.GlobalEventFramework.Examples/GE/OpenBar.cs +++ b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/OpenBar.cs @@ -8,17 +8,18 @@ using Exiled.API.Enums; using Exiled.API.Features; using Exiled.Events.EventArgs.Map; +using KE.GlobalEventFramework.GEFE.API.Interfaces; namespace KE.GlobalEventFramework.Examples.GE { - public class OpenBar : GlobalEvent + public class OpenBar : GlobalEvent, IStart,IEvent { public override uint Id { get; set; } = 1048; public override string Name { get; set; } = "OpenBar"; public override string Description { get; set; } = "j'espère que vous avez pas prévu de kampé"; public override int Weight { get; set; } = 1; public override uint[] IncompatibleGE { get; set; } = { 1 }; - public override IEnumerator Start() + public IEnumerator Start() { var doors = Door.List.Where(d => new[] { DoorType.GateA, DoorType.GateB, DoorType.HczArmory, DoorType.HIDChamber,DoorType.Intercom,DoorType.Scp049Armory,DoorType.Scp096,DoorType.Scp106Primary,DoorType.Scp106Secondary,DoorType.Scp330,DoorType.Scp330Chamber,DoorType.Scp914Gate }.Contains(d.Type)).ToList(); UnlockAndOpen(doors); @@ -35,12 +36,12 @@ private void UnlockAndOpen(List doors) }); } - public override void SubscribeEvent() + public void SubscribeEvent() { Exiled.Events.Handlers.Map.GeneratorActivating += GenActivate; } - public override void UnsubscribeEvent() + public void UnsubscribeEvent() { Exiled.Events.Handlers.Map.GeneratorActivating -= GenActivate; } diff --git a/KruacentExiled/KE.GlobalEventFramework.Examples/GE/R.cs b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/R.cs index ac0ae9bf..f2bbfc3a 100644 --- a/KruacentExiled/KE.GlobalEventFramework.Examples/GE/R.cs +++ b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/R.cs @@ -17,10 +17,6 @@ public class R : GlobalEvent /// public override int Weight { get; set; } = 3; /// - public override IEnumerator Start() - { - yield return 0; - } } } diff --git a/KruacentExiled/KE.GlobalEventFramework.Examples/GE/RandomSpawn.cs b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/RandomSpawn.cs index bb0882fb..b4ac9946 100644 --- a/KruacentExiled/KE.GlobalEventFramework.Examples/GE/RandomSpawn.cs +++ b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/RandomSpawn.cs @@ -1,5 +1,6 @@ using Exiled.API.Features; using KE.GlobalEventFramework.GEFE.API.Features; +using KE.GlobalEventFramework.GEFE.API.Interfaces; using PlayerRoles; using System; using System.Collections.Generic; @@ -13,7 +14,7 @@ namespace KE.GlobalEventFramework.Examples.GE /// All spawn are random at the start of the game (NTF & Chaos not included) /// Note: all role spawn with each other except SCPs ///
- public class RandomSpawn : GlobalEvent + public class RandomSpawn : GlobalEvent,IStart { /// public override uint Id { get; set; } = 1043; @@ -24,7 +25,7 @@ public class RandomSpawn : GlobalEvent /// public override int Weight { get; set; } = 1; /// - public override IEnumerator Start() + public IEnumerator Start() { Room room = Room.Random(); foreach (RoleTypeId r in Enum.GetValues(typeof(RoleTypeId))) diff --git a/KruacentExiled/KE.GlobalEventFramework.Examples/GE/Shuffle.cs b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/Shuffle.cs index 936c62c7..7d4a336a 100644 --- a/KruacentExiled/KE.GlobalEventFramework.Examples/GE/Shuffle.cs +++ b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/Shuffle.cs @@ -6,6 +6,7 @@ using UnityEngine; using System.Collections.Generic; using System.Linq; +using KE.GlobalEventFramework.GEFE.API.Interfaces; namespace KE.GlobalEventFramework.Examples.GE @@ -13,7 +14,7 @@ namespace KE.GlobalEventFramework.Examples.GE /// /// Every some amount of time all player take the position of another /// - public class Shuffle : GlobalEvent + public class Shuffle : GlobalEvent, IStart,IEvent { /// public override uint Id { get; set; } = 1045; @@ -26,7 +27,7 @@ public class Shuffle : GlobalEvent private List players; private List pos; /// - public override IEnumerator Start() + public IEnumerator Start() { this.players = Player.List.ToList().Where(p => !p.IsNPC).ToList(); this.players.ShuffleList(); @@ -66,12 +67,12 @@ public override IEnumerator Start() } } /// - public override void SubscribeEvent() + public void SubscribeEvent() { PlayerHandler.Joined += OnJoined; } /// - public override void UnsubscribeEvent() + public void UnsubscribeEvent() { PlayerHandler.Joined -= OnJoined; } diff --git a/KruacentExiled/KE.GlobalEventFramework.Examples/GE/Speed.cs b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/Speed.cs index bf8c0f17..9cca39e4 100644 --- a/KruacentExiled/KE.GlobalEventFramework.Examples/GE/Speed.cs +++ b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/Speed.cs @@ -4,6 +4,7 @@ using Exiled.Events.EventArgs.Player; using Exiled.Events.EventArgs.Scp173; using KE.GlobalEventFramework.GEFE.API.Features; +using KE.GlobalEventFramework.GEFE.API.Interfaces; using MEC; using System; using System.Collections.Generic; @@ -18,7 +19,7 @@ namespace KE.GlobalEventFramework.Examples.GE /// Everyone has a movement boost effect (stackable) /// Maybe inspired by Dr Bright's Mayhem ///
- public class Speed : GlobalEvent + public class Speed : GlobalEvent,IStart,IEvent { /// public override uint Id { get; set; } = 1042; @@ -33,20 +34,20 @@ public class Speed : GlobalEvent ///
public byte MovementBoost { get; set; } = 100; /// - public override IEnumerator Start() + public IEnumerator Start() { yield return Timing.WaitForSeconds(1); Player.List.ToList().ForEach(p => p.EnableEffect(MovementBoost,999999999, true)); } /// - public override void SubscribeEvent() + public void SubscribeEvent() { PlayerHandler.ChangingRole += ReactivateEffectSpawn; Exiled.Events.Handlers.Scp173.Blinking += SpeedyNut; } /// - public override void UnsubscribeEvent() + public void UnsubscribeEvent() { PlayerHandler.ChangingRole -= ReactivateEffectSpawn; Exiled.Events.Handlers.Scp173.Blinking -= SpeedyNut; diff --git a/KruacentExiled/KE.GlobalEventFramework.Examples/GE/SystemMalfunction.cs b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/SystemMalfunction.cs index 9278b850..491b3d2a 100644 --- a/KruacentExiled/KE.GlobalEventFramework.Examples/GE/SystemMalfunction.cs +++ b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/SystemMalfunction.cs @@ -8,6 +8,7 @@ using Interactables.Interobjects.DoorUtils; using Exiled.API.Enums; using Exiled.API.Extensions; +using KE.GlobalEventFramework.GEFE.API.Interfaces; namespace KE.GlobalEventFramework.Examples.GE { @@ -20,7 +21,7 @@ namespace KE.GlobalEventFramework.Examples.GE /// Checkpoints can open randomly /// ///
- public class SystemMalfunction : GlobalEvent + public class SystemMalfunction : GlobalEvent,IStart,IEvent { /// public override uint Id { get; set; } = 1041; @@ -36,8 +37,9 @@ public class SystemMalfunction : GlobalEvent public int NewCooldown { get; set; } = 180; public override uint[] IncompatibleGE { get; set; } = { 38 }; + private BlackoutNDoor.MainPlugin BlackoutNDoor; /// - public override IEnumerator Start() + public IEnumerator Start() { MoreBlackOutNDoors(); Coroutine.LaunchCoroutine(EarlyNuke()); @@ -45,7 +47,7 @@ public override IEnumerator Start() CoroutineHandle handle; while(Round.InProgress){ //todo change so it happen more frequently - Timing.WaitForSeconds((float)Round.ElapsedTime.TotalSeconds); + yield return Timing.WaitForSeconds(300); List> l = new []{CheckpointMalfunction(),GateLockdown(),ElevatorLockdown()}.ToList(); handle = Coroutine.LaunchCoroutine(l[UnityEngine.Random.Range(0,3)]); yield return Timing.WaitUntilDone(handle); @@ -54,19 +56,25 @@ public override IEnumerator Start() } - public override void UnsubscribeEvent() + public void SubscribeEvent() { + //Searching for the plugin var otherPlugin = Exiled.Loader.Loader.Plugins.FirstOrDefault(plugin => plugin.Name == "KE.BlackoutDoor"); if (otherPlugin != null) { if (otherPlugin is BlackoutNDoor.MainPlugin blackout) { - blackout.ServerHandler.Cooldown = -1; + Log.Info("Found BlackOutNDoors"); + BlackoutNDoor = blackout; } } } + public void UnsubscribeEvent() + { + BlackoutNDoor = null; + } private IEnumerator EarlyNuke() { @@ -79,17 +87,7 @@ private IEnumerator EarlyNuke() private void MoreBlackOutNDoors() { - var otherPlugin = Exiled.Loader.Loader.Plugins.FirstOrDefault(plugin => plugin.Name == "KE.BlackoutDoor"); - if (otherPlugin != null) - { - - if (otherPlugin is BlackoutNDoor.MainPlugin blackout) - { - Log.Info("Found BlackOutNDoors"); - blackout.ServerHandler.Cooldown = NewCooldown; - } - - } + BlackoutNDoor.ServerHandler.Cooldown = NewCooldown; } private IEnumerator CheckpointMalfunction(){ diff --git a/KruacentExiled/KE.GlobalEventFramework/GEFE/API/Features/GlobalEvent.cs b/KruacentExiled/KE.GlobalEventFramework/GEFE/API/Features/GlobalEvent.cs index 22e2cf4c..8c76bf53 100644 --- a/KruacentExiled/KE.GlobalEventFramework/GEFE/API/Features/GlobalEvent.cs +++ b/KruacentExiled/KE.GlobalEventFramework/GEFE/API/Features/GlobalEvent.cs @@ -31,24 +31,6 @@ public abstract class GlobalEvent : IGlobalEvent /// public virtual uint[] IncompatibleGE { get; set; } = new uint[0]; - - - /// - public virtual IEnumerator Start() - { - if (MainPlugin.Instance.Config.Debug) Log.Error($"{GetType().Name} Start is NOT overrided"); - yield return 0; - } - /// - public virtual void SubscribeEvent() - { - if (MainPlugin.Instance.Config.Debug) Log.Warn($"{GetType().Name} : SubscribeEvent is NOT overrided"); - } - /// - public virtual void UnsubscribeEvent() - { - if (MainPlugin.Instance.Config.Debug) Log.Warn($"{GetType().Name} : UnsubscribeEvent is NOT overrided"); - } public static void Register(IGlobalEvent globalEvent) { Log.Send($"REGISTERING {globalEvent.Name}", Discord.LogLevel.Info, ConsoleColor.Blue); @@ -162,17 +144,36 @@ private static void ActivateAll(List globalEvent) { if(globalEvent.Count != globalEvent.Distinct().Count()) throw new ArgumentException("You can't have the same GE twice in the same round"); ActiveGE = globalEvent; - globalEvent.ForEach(e => e.SubscribeEvent()); foreach (IGlobalEvent ge in ActiveGE) { + if(ge is IEvent geEvent) + { + geEvent.SubscribeEvent(); + } + + if(ge is IStart geStart) + { + CoroutineHandle a = Timing.RunCoroutine(geStart.Start()); + coroutineHandles.Add(a); + } - CoroutineHandle a = Timing.RunCoroutine(ge.Start()); - coroutineHandles.Add(a); } Show(); } + + internal static void DeactivateAll() + { + foreach(IGlobalEvent ge in ActiveGE) + { + if (ge is IEvent geEvent) + { + geEvent.UnsubscribeEvent(); + } + } + } + private static List ChooseRandomGE(int nbGE = 1) { List result = new List(); diff --git a/KruacentExiled/KE.GlobalEventFramework/GEFE/API/Interfaces/IEvent.cs b/KruacentExiled/KE.GlobalEventFramework/GEFE/API/Interfaces/IEvent.cs new file mode 100644 index 00000000..55b20279 --- /dev/null +++ b/KruacentExiled/KE.GlobalEventFramework/GEFE/API/Interfaces/IEvent.cs @@ -0,0 +1,20 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace KE.GlobalEventFramework.GEFE.API.Interfaces +{ + public interface IEvent + { + /// + /// The method used to subcribe to event like with normal plugins + /// + void SubscribeEvent(); + /// + /// The method used to unsubcribe to event like with normal plugins + /// + void UnsubscribeEvent(); + } +} diff --git a/KruacentExiled/KE.GlobalEventFramework/GEFE/API/Interfaces/IGlobalEvent.cs b/KruacentExiled/KE.GlobalEventFramework/GEFE/API/Interfaces/IGlobalEvent.cs index 63e623b3..79e83933 100644 --- a/KruacentExiled/KE.GlobalEventFramework/GEFE/API/Interfaces/IGlobalEvent.cs +++ b/KruacentExiled/KE.GlobalEventFramework/GEFE/API/Interfaces/IGlobalEvent.cs @@ -33,17 +33,7 @@ public interface IGlobalEvent ///
uint[] IncompatibleGE { get; set; } - /// - /// Is launched at the start of a round - /// - IEnumerator Start(); - /// - /// The method used to subcribe to event like with normal plugins - /// - void SubscribeEvent(); - /// - /// The method used to unsubcribe to event like with normal plugins - /// - void UnsubscribeEvent(); + + } } diff --git a/KruacentExiled/KE.GlobalEventFramework/GEFE/API/Interfaces/IStart.cs b/KruacentExiled/KE.GlobalEventFramework/GEFE/API/Interfaces/IStart.cs new file mode 100644 index 00000000..b3f00fad --- /dev/null +++ b/KruacentExiled/KE.GlobalEventFramework/GEFE/API/Interfaces/IStart.cs @@ -0,0 +1,16 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace KE.GlobalEventFramework.GEFE.API.Interfaces +{ + public interface IStart + { + /// + /// Is launched at the start of a round + /// + IEnumerator Start(); + } +} diff --git a/KruacentExiled/KE.GlobalEventFramework/GEFE/Handlers/ServerHandler.cs b/KruacentExiled/KE.GlobalEventFramework/GEFE/Handlers/ServerHandler.cs index 67504ee2..2a827f49 100644 --- a/KruacentExiled/KE.GlobalEventFramework/GEFE/Handlers/ServerHandler.cs +++ b/KruacentExiled/KE.GlobalEventFramework/GEFE/Handlers/ServerHandler.cs @@ -15,7 +15,7 @@ public void OnRoundStarted() HandleCommands(); - + GlobalEvent.ActivateAll(); } private void HandleCommands() @@ -47,7 +47,7 @@ private void HandleCommands() GlobalEvent.ActiveGE = GlobalEvent.ChooseGE(nbGE); } - GlobalEvent.ActivateAll(); + } public void OnWaitingForPlayers() @@ -58,12 +58,12 @@ public void OnWaitingForPlayers() public void OnEndingRound(RoundEndedEventArgs _) { Log.Debug("ending round"); - GlobalEvent.ActiveGE.ForEach(e => e.UnsubscribeEvent()); + GlobalEvent.DeactivateAll(); } public void OnRestartingRound() { Log.Debug("restarting"); - GlobalEvent.ActiveGE.ForEach(e => e.UnsubscribeEvent()); + GlobalEvent.DeactivateAll(); } } From 047cbbe9aec54a9e2fbb03d91931504e573d548e Mon Sep 17 00:00:00 2001 From: Omer <113857370+OmerGS@users.noreply.github.com> Date: Wed, 15 Jan 2025 16:05:44 +0100 Subject: [PATCH 103/853] Add tank and terrorist role --- KruacentExiled/KE.CustomRoles/CR/MTF/Tank.cs | 5 ++-- .../KE.CustomRoles/CR/MTF/Terroriste.cs | 1 + KruacentExiled/KE.CustomRoles/Controller.cs | 26 +++++++++++++++++++ KruacentExiled/KE.CustomRoles/MainPlugin.cs | 25 ++++++++++++++++-- 4 files changed, 53 insertions(+), 4 deletions(-) create mode 100644 KruacentExiled/KE.CustomRoles/Controller.cs diff --git a/KruacentExiled/KE.CustomRoles/CR/MTF/Tank.cs b/KruacentExiled/KE.CustomRoles/CR/MTF/Tank.cs index 1a074251..42ada466 100644 --- a/KruacentExiled/KE.CustomRoles/CR/MTF/Tank.cs +++ b/KruacentExiled/KE.CustomRoles/CR/MTF/Tank.cs @@ -6,6 +6,7 @@ using PlayerRoles; using System.Collections.Generic; using UnityEngine; +using System; namespace KE.CustomRoles.CR.ClassD { @@ -66,14 +67,14 @@ private void Shooting(ShootingEventArgs ev) private IEnumerator EffectAttribution(Exiled.API.Features.Player player) { int nbMunition = player.GetAmmo(AmmoType.Nato762) / 100; - byte nbMunitionByte = (byte) nbMunition; + byte nbMunitionByte = (byte) nbMunition; if (UnityEngine.Random.Range(0, 1) > 0.5f){ player.DisableEffect(EffectType.Slowness); player.EnableEffect(EffectType.Slowness, nbMunitionByte, 99999, false); } - yield return Timing.WaitForSeconds(3); + yield return 0; } } } diff --git a/KruacentExiled/KE.CustomRoles/CR/MTF/Terroriste.cs b/KruacentExiled/KE.CustomRoles/CR/MTF/Terroriste.cs index c2200cbd..cf0b6563 100644 --- a/KruacentExiled/KE.CustomRoles/CR/MTF/Terroriste.cs +++ b/KruacentExiled/KE.CustomRoles/CR/MTF/Terroriste.cs @@ -27,6 +27,7 @@ internal class Terroriste : Exiled.CustomRoles.API.Features.CustomRole $"{ItemType.GrenadeHE}", $"{ItemType.GrenadeHE}", $"{ItemType.GrenadeHE}", + $"{ItemType.GrenadeHE}", $"{ItemType.GunE11SR}", $"{ItemType.Adrenaline}", $"{ItemType.KeycardMTFOperative}", diff --git a/KruacentExiled/KE.CustomRoles/Controller.cs b/KruacentExiled/KE.CustomRoles/Controller.cs new file mode 100644 index 00000000..52f7d2ae --- /dev/null +++ b/KruacentExiled/KE.CustomRoles/Controller.cs @@ -0,0 +1,26 @@ +using Exiled.API.Extensions; +using Exiled.API.Features; +using Exiled.CustomRoles.API.Features; + +namespace KE.CustomRoles +{ + internal class Controller + { + public static Controller controller = new Controller(); + + private Controller() + { + + } + + internal void CustomRoleGiver() + { + foreach (Player player in Exiled.API.Features.Player.List) + { + CustomRole cr = CustomRole.Registered.GetRandomValue(); + + cr.AddRole(player); + } + } + } +} \ No newline at end of file diff --git a/KruacentExiled/KE.CustomRoles/MainPlugin.cs b/KruacentExiled/KE.CustomRoles/MainPlugin.cs index 47df022b..e42f2a66 100644 --- a/KruacentExiled/KE.CustomRoles/MainPlugin.cs +++ b/KruacentExiled/KE.CustomRoles/MainPlugin.cs @@ -1,7 +1,5 @@ using Exiled.API.Features; using Exiled.CustomRoles.API.Features; -using KE.CustomRoles.CR; -using System.ComponentModel; namespace KE.CustomRoles @@ -17,6 +15,8 @@ public override void OnEnabled() Instance = this; CustomRole.RegisterRoles(false,null); + this.SubscribeEvents(); + Controller.controller.CustomRoleGiver(); base.OnEnabled(); } @@ -27,7 +27,28 @@ public override void OnDisabled() CustomRole.UnregisterRoles(); Instance = null; + this.UnsubscribeEvents(); + base.OnDisabled(); } + + + + + public void SubscribeEvents() + { + Exiled.Events.Handlers.Server.RoundStarted += CustomRoleImplement; + } + + /// + public void UnsubscribeEvents() + { + Exiled.Events.Handlers.Server.RoundStarted -= CustomRoleImplement; + } + + public void CustomRoleImplement() + { + Controller.controller.CustomRoleGiver(); + } } } From 6197dd371a3e45c804442408d7c98a88cb3e2ccf Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Thu, 16 Jan 2025 00:53:19 +0100 Subject: [PATCH 104/853] created the True divine pills --- KruacentExiled/KE.Items/Config.cs | 3 +- KruacentExiled/KE.Items/Items/DivinePills.cs | 97 +++++++++++---- .../KE.Items/Items/TrueDivinePills.cs | 113 ++++++++++++++++++ KruacentExiled/KE.Items/MainPlugin.cs | 14 +-- 4 files changed, 189 insertions(+), 38 deletions(-) create mode 100644 KruacentExiled/KE.Items/Items/TrueDivinePills.cs diff --git a/KruacentExiled/KE.Items/Config.cs b/KruacentExiled/KE.Items/Config.cs index daaf9357..09794be7 100644 --- a/KruacentExiled/KE.Items/Config.cs +++ b/KruacentExiled/KE.Items/Config.cs @@ -10,6 +10,7 @@ namespace KE.Items public class Config : IConfig { public bool IsEnabled { get; set; } = true; - public bool Debug { get; set; } = false; + public bool Debug { get; set; } = true; + public float RefreshRate { get; set; } = .5f; } } diff --git a/KruacentExiled/KE.Items/Items/DivinePills.cs b/KruacentExiled/KE.Items/Items/DivinePills.cs index 5c06ef75..f60e24b3 100644 --- a/KruacentExiled/KE.Items/Items/DivinePills.cs +++ b/KruacentExiled/KE.Items/Items/DivinePills.cs @@ -13,6 +13,11 @@ using System.Linq; using PlayerRoles; using KE.Items.Interface; +using Exiled.CustomItems.API.EventArgs; +using Exiled.Events.EventArgs.Scp914; +using Exiled.API.Features.Items; +using System.Data; +using Exiled.API.Features.Pickups; /// [CustomItem(ItemType.Painkillers)] @@ -25,7 +30,7 @@ public class DivinePills : CustomItem, ILumosItem public override string Name { get; set; } = "Divine Pills"; /// - public override string Description { get; set; } = "25% chance you die\n 75% you respawn someone"; + public override string Description { get; set; } = "25% chance you die\n 75% you respawn someone\n 10% to upgrade in 914 on very fine"; /// public override float Weight { get; set; } = 0.65f; @@ -65,45 +70,89 @@ public class DivinePills : CustomItem, ILumosItem /// protected override void SubscribeEvents() { - PlayerHandle.UsedItem += OnUsingItem; + PlayerHandle.UsingItem += OnUsingItem; + Exiled.Events.Handlers.Scp914.UpgradingInventoryItem += OnUpgrading; + //Exiled.Events.Handlers.Scp914.UpgradingPickup += Up; //break the lights base.SubscribeEvents(); } /// protected override void UnsubscribeEvents() { - PlayerHandle.UsedItem -= OnUsingItem; + PlayerHandle.UsingItem -= OnUsingItem; + Exiled.Events.Handlers.Scp914.UpgradingInventoryItem -= OnUpgrading; + //Exiled.Events.Handlers.Scp914.UpgradingPickup -= Up; //break the lights base.UnsubscribeEvents(); } - private void OnUsingItem(UsedItemEventArgs ev) + private void Up(UpgradingPickupEventArgs ev) { - if (!Check(ev.Item)) + if (!Check(ev.Pickup)) + return; + if (ev.KnobSetting != Scp914.Scp914KnobSetting.VeryFine) + return; + var rng = Random.value; + Log.Debug($"pickup {Name} : {rng}"); + if (rng < .1f) { + //success + ev.Pickup.Destroy(); + TrySpawn("True Divine Pills",ev.OutputPosition,out Pickup _); + ev.IsAllowed = true; + } + else + ev.IsAllowed = false; + } + + private void OnUpgrading(UpgradingInventoryItemEventArgs ev) + { + if (!Check(ev.Item)) + return; + if (ev.KnobSetting != Scp914.Scp914KnobSetting.VeryFine) return; + var rng = Random.value; + Log.Debug($"inventory {Name} : {rng}"); + if (rng < .1f) + { + //success + ev.Player.RemoveItem(ev.Item); + TryGive(ev.Player, "True Divine Pills"); + ev.IsAllowed = true; } - if (TryGet(ev.Item, out var result) && result.Id == Id) + else { - Player player = ev.Player; - var random = Random.Range(0, 100); + ev.Player.ShowHint("no luck"); + ev.IsAllowed = false; + } - if(Player.List.Where(x => x.Role == RoleTypeId.Spectator).Count() == 0) - { - player.ShowHint("No spectators to respawn"); - return; - } + } - if (random <= 25) - { - player.Kill("unlucky bro"); - return; - } - Player respawning = Player.List.Where(x => x.Role == RoleTypeId.Spectator).GetRandomValue(); - respawning.Role.Set(player.Role); - if (random > 75) - { - respawning.Position = player.Position; - } + private void OnUsingItem(UsingItemEventArgs ev) + { + if (!Check(ev.Item)) + { + return; + } + Player player = ev.Player; + + + if(Player.List.Where(x => x.Role == RoleTypeId.Spectator).Count() == 0) + { + player.ShowHint("No spectators to respawn"); + ev.IsAllowed = false; + return; + } + var random = Random.Range(0, 100); + if (random <= 25) + { + player.Kill("unlucky bro"); + return; + } + Player respawning = Player.List.Where(x => x.Role == RoleTypeId.Spectator).GetRandomValue(); + respawning.Role.Set(player.Role); + if (random > 75) + { + respawning.Teleport(player); } } diff --git a/KruacentExiled/KE.Items/Items/TrueDivinePills.cs b/KruacentExiled/KE.Items/Items/TrueDivinePills.cs new file mode 100644 index 00000000..afe417e4 --- /dev/null +++ b/KruacentExiled/KE.Items/Items/TrueDivinePills.cs @@ -0,0 +1,113 @@ +using System.Collections.Generic; +using Exiled.API.Enums; +using Exiled.API.Features.Attributes; +using Exiled.API.Features.Spawn; +using Exiled.CustomItems.API.Features; +using MEC; +using Exiled.Events.EventArgs.Player; +using PlayerHandle = Exiled.Events.Handlers.Player; +using Exiled.API.Features; +using Exiled.API.Extensions; +using UnityEngine; +using CustomPlayerEffects; +using System.Linq; +using PlayerRoles; +using KE.Items.Interface; +using Exiled.CustomItems.API.EventArgs; +using Exiled.Events.EventArgs.Scp914; + +/// +[CustomItem(ItemType.SCP500)] +public class TrueDivinePills : CustomItem, ILumosItem +{ + /// + public override uint Id { get; set; } = 1409; + + /// + public override string Name { get; set; } = "True Divine Pills"; + + /// + public override string Description { get; set; } = "Guaranteed to respawn everybody"; + + /// + public override float Weight { get; set; } = 0.65f; + public Color Color { get; set; } = Color.yellow; + private bool tp = false; + + /// + public override SpawnProperties SpawnProperties { get; set; } = new SpawnProperties() + { + + }; + + /// + protected override void SubscribeEvents() + { + PlayerHandle.UsingItem += OnUsingItem; + base.SubscribeEvents(); + } + + /// + protected override void UnsubscribeEvents() + { + PlayerHandle.UsingItem -= OnUsingItem; + base.UnsubscribeEvents(); + } + + protected override void OnDropping(DroppingItemEventArgs ev) + { + if (!Check(ev.Item)) + return; + if (ev.IsThrown) + { + ev.IsAllowed = true; + return; + } + + tp = !tp; + if (tp) + ev.Player.ShowHint("Players will spawn to you"); + else + ev.Player.ShowHint("Players won't spawn to you"); + ev.IsAllowed = false; + + + + } + + private void OnUsingItem(UsingItemEventArgs ev) + { + if (!Check(ev.Item)) + return; + Player player = ev.Player; + Log.Debug(Player.List.Count); + Log.Debug(Player.List.Where(x => x.Role == RoleTypeId.Spectator).Count()); + + if (Player.List.Where(x => x.Role == RoleTypeId.Spectator).Count() == 0) + { + player.ShowHint("No one to respawn"); + ev.IsAllowed = false; + return; + } + + + Player.List.Where(x => x.Role == RoleTypeId.Spectator).ToList().ForEach(x => + { + switch (player.Role.Side) + { + case Side.ChaosInsurgency: + x.Role.Set(RoleTypeId.ChaosRifleman); + break; + case Side.Mtf: + x.Role.Set(RoleTypeId.NtfPrivate); + break; + } + if (tp) + { + x.Teleport(player); + } + }); + + } + +} \ No newline at end of file diff --git a/KruacentExiled/KE.Items/MainPlugin.cs b/KruacentExiled/KE.Items/MainPlugin.cs index fa6a622c..238c8ac0 100644 --- a/KruacentExiled/KE.Items/MainPlugin.cs +++ b/KruacentExiled/KE.Items/MainPlugin.cs @@ -88,29 +88,19 @@ internal IEnumerator LightP() } while (Round.InProgress) { - Log.Debug("boop"); - foreach (var x in pl.ToList()) { if(CustomItem.TryGet(x.Key, out CustomItem cui) && cui is ILumosItem ci) { Light light = Light.Create(x.Key.Position, null, null, true, ci.Color); light.Intensity = 0.5f; - Log.Debug("preif"); if (x.Value != null) { - Log.Debug("pre val"); Light val = x.Value; - Log.Debug($"destroy light {val.Position}"); val.UnSpawn(); - Log.Debug("pre destroy"); val.Destroy(); } - else - Log.Debug("first cretate"); - Log.Debug("reasigne"); pl[x.Key] = light; - Log.Debug("post reasigne"); //Log.Debug(x.Key.Position+";"+x.Value.Position); } else @@ -121,10 +111,8 @@ internal IEnumerator LightP() pl.Remove(x.Key); } } - Log.Debug("waiting"); - yield return Timing.WaitForSeconds(0.1f); + yield return Timing.WaitForSeconds(Instance.Config.RefreshRate); } - Log.Debug("end while"); } From b8bddde88e14a2e98f6b07e8db9e73d76ba6bd5a Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Thu, 16 Jan 2025 00:54:15 +0100 Subject: [PATCH 105/853] removed custom role csproj --- KruacentExiled/KruacentExiled.sln | 6 ------ 1 file changed, 6 deletions(-) diff --git a/KruacentExiled/KruacentExiled.sln b/KruacentExiled/KruacentExiled.sln index 4f5fb931..135e1e35 100644 --- a/KruacentExiled/KruacentExiled.sln +++ b/KruacentExiled/KruacentExiled.sln @@ -13,8 +13,6 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "KE.GlobalEventFramework", " EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "KE.GlobalEventFramework.Examples", "KE.GlobalEventFramework.Examples\KE.GlobalEventFramework.Examples.csproj", "{07B92E87-F48F-4F9F-BA0E-1BCB2AF52F53}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "KE.CustomRoles", "KE.CustomRoles\KE.CustomRoles.csproj", "{D43DC96A-6034-45EB-B39E-6B291BD0A07C}" -EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -41,10 +39,6 @@ Global {07B92E87-F48F-4F9F-BA0E-1BCB2AF52F53}.Debug|Any CPU.Build.0 = Debug|Any CPU {07B92E87-F48F-4F9F-BA0E-1BCB2AF52F53}.Release|Any CPU.ActiveCfg = Release|Any CPU {07B92E87-F48F-4F9F-BA0E-1BCB2AF52F53}.Release|Any CPU.Build.0 = Release|Any CPU - {D43DC96A-6034-45EB-B39E-6B291BD0A07C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {D43DC96A-6034-45EB-B39E-6B291BD0A07C}.Debug|Any CPU.Build.0 = Debug|Any CPU - {D43DC96A-6034-45EB-B39E-6B291BD0A07C}.Release|Any CPU.ActiveCfg = Release|Any CPU - {D43DC96A-6034-45EB-B39E-6B291BD0A07C}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE From 4389e611a0338300ee3cb1d4ec368638087ec6c2 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Thu, 16 Jan 2025 01:08:27 +0100 Subject: [PATCH 106/853] changed names --- KruacentExiled/KE.CustomRoles/CR/ChaosInsurgency/LeRusse.cs | 2 +- .../CR/ClassD/{Ashmatique.cs => Asthmatique.cs} | 4 ++-- KruacentExiled/KE.CustomRoles/CR/SCP/Paper049.cs | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) rename KruacentExiled/KE.CustomRoles/CR/ClassD/{Ashmatique.cs => Asthmatique.cs} (86%) diff --git a/KruacentExiled/KE.CustomRoles/CR/ChaosInsurgency/LeRusse.cs b/KruacentExiled/KE.CustomRoles/CR/ChaosInsurgency/LeRusse.cs index b73b733d..3563cf46 100644 --- a/KruacentExiled/KE.CustomRoles/CR/ChaosInsurgency/LeRusse.cs +++ b/KruacentExiled/KE.CustomRoles/CR/ChaosInsurgency/LeRusse.cs @@ -9,7 +9,7 @@ namespace KE.CustomRoles.CR.ClassD [CustomRole(RoleTypeId.ChaosConscript)] internal class Russe : Exiled.CustomRoles.API.Features.CustomRole { - public override string Name { get; set; } = "Le Russe"; + public override string Name { get; set; } = "Russe"; public override string Description { get; set; } = "Tu es un maitre de jeu \ntu dois faire la roulette russe avec les autres joueurs"; public override uint Id { get; set; } = 1051; public override string CustomInfo { get; set; } = "Le Russe"; diff --git a/KruacentExiled/KE.CustomRoles/CR/ClassD/Ashmatique.cs b/KruacentExiled/KE.CustomRoles/CR/ClassD/Asthmatique.cs similarity index 86% rename from KruacentExiled/KE.CustomRoles/CR/ClassD/Ashmatique.cs rename to KruacentExiled/KE.CustomRoles/CR/ClassD/Asthmatique.cs index 93a4341e..b0a29b80 100644 --- a/KruacentExiled/KE.CustomRoles/CR/ClassD/Ashmatique.cs +++ b/KruacentExiled/KE.CustomRoles/CR/ClassD/Asthmatique.cs @@ -5,9 +5,9 @@ namespace KE.CustomRoles.CR.ClassD { [CustomRole(RoleTypeId.ClassD)] - internal class Asmathique : Exiled.CustomRoles.API.Features.CustomRole + internal class Asthmatique : Exiled.CustomRoles.API.Features.CustomRole { - public override string Name { get; set; } = "Asmathique"; + public override string Name { get; set; } = "Asthmatique"; public override string Description { get; set; } = "Tu es asthmatique\nT'as stamina est réduit de moitié\nMais tu vises mieux"; public override uint Id { get; set; } = 1048; public override string CustomInfo { get; set; } = "Asmathique"; diff --git a/KruacentExiled/KE.CustomRoles/CR/SCP/Paper049.cs b/KruacentExiled/KE.CustomRoles/CR/SCP/Paper049.cs index 2b565ea0..a80ac800 100644 --- a/KruacentExiled/KE.CustomRoles/CR/SCP/Paper049.cs +++ b/KruacentExiled/KE.CustomRoles/CR/SCP/Paper049.cs @@ -7,7 +7,7 @@ namespace KE.CustomRoles.CR.SCP [CustomRole(RoleTypeId.Scp049)] internal class Paper049 : Exiled.CustomRoles.API.Features.CustomRole { - public override string Name { get; set; } = "Small049"; + public override string Name { get; set; } = "Paper049"; public override string Description { get; set; } = "u are a paper doctor"; public override uint Id { get; set; } = 1047; public override string CustomInfo { get; set; } = "Paper Doctor"; From 92ec5fc471bddd64cc6d888a857a66c0ac0e122a Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Thu, 16 Jan 2025 01:24:29 +0100 Subject: [PATCH 107/853] corrected most of the CR --- .../KE.CustomRoles/CR/ChaosInsurgency/LeRusse.cs | 2 +- .../KE.CustomRoles/CR/ClassD/Asthmatique.cs | 14 ++++++++++---- KruacentExiled/KE.CustomRoles/CR/MTF/Tank.cs | 4 ++-- KruacentExiled/KE.CustomRoles/CR/SCP/Paper049.cs | 2 +- KruacentExiled/KE.CustomRoles/CR/SCP/Small049.cs | 4 +++- KruacentExiled/KE.CustomRoles/CR/SCP/Small173.cs | 10 ++++------ .../KE.CustomRoles/CR/Scientist/ZoneManager.cs | 5 ++--- 7 files changed, 23 insertions(+), 18 deletions(-) diff --git a/KruacentExiled/KE.CustomRoles/CR/ChaosInsurgency/LeRusse.cs b/KruacentExiled/KE.CustomRoles/CR/ChaosInsurgency/LeRusse.cs index 3563cf46..c19d46f5 100644 --- a/KruacentExiled/KE.CustomRoles/CR/ChaosInsurgency/LeRusse.cs +++ b/KruacentExiled/KE.CustomRoles/CR/ChaosInsurgency/LeRusse.cs @@ -27,7 +27,7 @@ internal class Russe : Exiled.CustomRoles.API.Features.CustomRole $"{ItemType.GunRevolver}", $"{ItemType.Radio}", $"{ItemType.Adrenaline}", - $"{ItemType.GrenadeHE}", + $"{ItemType.KeycardChaosInsurgency}", $"{ItemType.GrenadeHE}", $"{ItemType.GrenadeHE}", $"{ItemType.GrenadeHE}" diff --git a/KruacentExiled/KE.CustomRoles/CR/ClassD/Asthmatique.cs b/KruacentExiled/KE.CustomRoles/CR/ClassD/Asthmatique.cs index b0a29b80..0c49701f 100644 --- a/KruacentExiled/KE.CustomRoles/CR/ClassD/Asthmatique.cs +++ b/KruacentExiled/KE.CustomRoles/CR/ClassD/Asthmatique.cs @@ -1,6 +1,8 @@ -using Exiled.API.Features.Attributes; +using Exiled.API.Enums; +using Exiled.API.Features.Attributes; using PlayerRoles; using UnityEngine; +using Utils.NonAllocLINQ; namespace KE.CustomRoles.CR.ClassD { @@ -16,8 +18,12 @@ internal class Asthmatique : Exiled.CustomRoles.API.Features.CustomRole public override bool KeepRoleOnDeath { get; set; } = true; public override bool KeepRoleOnChangingRole { get; set; } = true; public override bool IgnoreSpawnSystem { get; set; } = true; - - public override float SpawnChance { get; set; } = 100; - public override Vector3 Scale { get; set; } = new Vector3(1, 0.75f, 1); + public override void Init() + { + TrackedPlayers.ForEach(p => { + p.EnableEffect(EffectType.Scp1853, -1); + p.EnableEffect(EffectType.Exhausted, -1); + }); + } } } diff --git a/KruacentExiled/KE.CustomRoles/CR/MTF/Tank.cs b/KruacentExiled/KE.CustomRoles/CR/MTF/Tank.cs index 1a074251..eac73ba2 100644 --- a/KruacentExiled/KE.CustomRoles/CR/MTF/Tank.cs +++ b/KruacentExiled/KE.CustomRoles/CR/MTF/Tank.cs @@ -23,7 +23,7 @@ internal class Tank : Exiled.CustomRoles.API.Features.CustomRole public override bool IgnoreSpawnSystem { get; set; } = true; public override float SpawnChance { get; set; } = 100; - public override Vector3 Scale { get; set; } = new Vector3(1.75f, 1.75f, 1.75f); + public override Vector3 Scale { get; set; } = new Vector3(1.15f, 1.15f, 1.15f); public override List Inventory { get; set; } = new List() { @@ -32,7 +32,7 @@ internal class Tank : Exiled.CustomRoles.API.Features.CustomRole $"{ItemType.Radio}", $"{ItemType.GrenadeHE}", $"{ItemType.Adrenaline}", - $"{ItemType.Painkillers}", + $"{ItemType.KeycardMTFCaptain}", $"{ItemType.Painkillers}", $"{ItemType.ArmorHeavy}" }; diff --git a/KruacentExiled/KE.CustomRoles/CR/SCP/Paper049.cs b/KruacentExiled/KE.CustomRoles/CR/SCP/Paper049.cs index a80ac800..c046b151 100644 --- a/KruacentExiled/KE.CustomRoles/CR/SCP/Paper049.cs +++ b/KruacentExiled/KE.CustomRoles/CR/SCP/Paper049.cs @@ -11,7 +11,7 @@ internal class Paper049 : Exiled.CustomRoles.API.Features.CustomRole public override string Description { get; set; } = "u are a paper doctor"; public override uint Id { get; set; } = 1047; public override string CustomInfo { get; set; } = "Paper Doctor"; - public override int MaxHealth { get; set; } = 100; + public override int MaxHealth { get; set; } = 2300; public override RoleTypeId Role { get; set; } = RoleTypeId.Scp049; public override bool KeepRoleOnDeath { get; set; } = false; public override bool KeepRoleOnChangingRole { get; set; } = false; diff --git a/KruacentExiled/KE.CustomRoles/CR/SCP/Small049.cs b/KruacentExiled/KE.CustomRoles/CR/SCP/Small049.cs index b1b73c92..2ae2facb 100644 --- a/KruacentExiled/KE.CustomRoles/CR/SCP/Small049.cs +++ b/KruacentExiled/KE.CustomRoles/CR/SCP/Small049.cs @@ -1,5 +1,7 @@ using Exiled.API.Features.Attributes; +using Exiled.API.Features.Roles; using PlayerRoles; +using PluginAPI.Roles; using UnityEngine; namespace KE.CustomRoles.CR.SCP @@ -11,7 +13,7 @@ internal class Small049 : Exiled.CustomRoles.API.Features.CustomRole public override string Description { get; set; } = "u are a smoll doctor"; public override uint Id { get; set; } = 1045; public override string CustomInfo { get; set; } = "Small Doctor"; - public override int MaxHealth { get; set; } = 100; + public override int MaxHealth { get; set; } = 2300; public override RoleTypeId Role { get; set; } = RoleTypeId.Scp049; public override bool KeepRoleOnDeath { get; set; } = false; public override bool KeepRoleOnChangingRole { get; set; } = false; diff --git a/KruacentExiled/KE.CustomRoles/CR/SCP/Small173.cs b/KruacentExiled/KE.CustomRoles/CR/SCP/Small173.cs index 9a3f01aa..07c69f03 100644 --- a/KruacentExiled/KE.CustomRoles/CR/SCP/Small173.cs +++ b/KruacentExiled/KE.CustomRoles/CR/SCP/Small173.cs @@ -7,17 +7,15 @@ namespace KE.CustomRoles.CR.SCP [CustomRole(RoleTypeId.Scp173)] internal class Small173 : Exiled.CustomRoles.API.Features.CustomRole { - public override string Name { get; set; } = "Small173"; - public override string Description { get; set; } = "u are a small peanuts"; + public override string Name { get; set; } = "Tall173"; + public override string Description { get; set; } = " Tall NUT \nu tol\n fuck you"; public override uint Id { get; set; } = 1046; public override string CustomInfo { get; set; } = "Small Peanuts"; - public override int MaxHealth { get; set; } = 100; + public override int MaxHealth { get; set; } = 4500; public override RoleTypeId Role { get; set; } = RoleTypeId.Scp173; public override bool KeepRoleOnDeath { get; set; } = false; public override bool KeepRoleOnChangingRole { get; set; } = false; public override bool IgnoreSpawnSystem { get; set; } = true; - - public override float SpawnChance { get; set; } = 100; - public override Vector3 Scale { get; set; } = new Vector3(1, 0.75f, 1); + public override Vector3 Scale { get; set; } = new Vector3(1, 1.15f, 1); } } diff --git a/KruacentExiled/KE.CustomRoles/CR/Scientist/ZoneManager.cs b/KruacentExiled/KE.CustomRoles/CR/Scientist/ZoneManager.cs index c9f209bd..184d9af5 100644 --- a/KruacentExiled/KE.CustomRoles/CR/Scientist/ZoneManager.cs +++ b/KruacentExiled/KE.CustomRoles/CR/Scientist/ZoneManager.cs @@ -20,7 +20,6 @@ internal class ZoneManager : Exiled.CustomRoles.API.Features.CustomRole public override bool IgnoreSpawnSystem { get; set; } = true; public override float SpawnChance { get; set; } = 100; - public override Vector3 Scale { get; set; } = new Vector3(1, 1, 1); public override SpawnProperties SpawnProperties { get; set; } = new SpawnProperties() { @@ -37,12 +36,12 @@ internal class ZoneManager : Exiled.CustomRoles.API.Features.CustomRole public override List Inventory { get; set; } = new List() { $"{ItemType.Medkit}", - $"{ItemType.None}", $"{ItemType.Adrenaline}", $"{ItemType.None}", + $"{ItemType.KeycardZoneManager}", + $"{ItemType.None}", $"{ItemType.None}", $"{ItemType.None}", - $"{ItemType.KeycardZoneManager}" }; } } From d2ffc6d8ad8faf6663c88830f77eb5a752d593aa Mon Sep 17 00:00:00 2001 From: Omer <113857370+OmerGS@users.noreply.github.com> Date: Thu, 16 Jan 2025 16:36:39 +0100 Subject: [PATCH 108/853] feature/Cocktail Molotov Item --- KruacentExiled/KE.Items/Items/Molotov.cs | 128 +++++++++++++++++++++++ 1 file changed, 128 insertions(+) create mode 100644 KruacentExiled/KE.Items/Items/Molotov.cs diff --git a/KruacentExiled/KE.Items/Items/Molotov.cs b/KruacentExiled/KE.Items/Items/Molotov.cs new file mode 100644 index 00000000..725fb453 --- /dev/null +++ b/KruacentExiled/KE.Items/Items/Molotov.cs @@ -0,0 +1,128 @@ +using System.Collections.Generic; +using Exiled.API.Enums; +using Exiled.API.Features.Attributes; +using Exiled.API.Features.Spawn; +using Exiled.API.Features.Toys; +using Exiled.CustomItems.API.Features; +using Exiled.Events.EventArgs.Map; +using KE.Items.Interface; +using Player = Exiled.API.Features.Player; +using MEC; +using UnityEngine; + +namespace KE.Items.Items +{ + [CustomItem(ItemType.GrenadeHE)] + public class Molotov : CustomGrenade, ILumosItem + { + public override uint Id { get; set; } = 1409; + public override string Name { get; set; } = "Cocktail Molotov"; + public override string Description { get; set; } = "ARSON"; + public override float Weight { get; set; } = 0.65f; + public override float FuseTime { get; set; } = 5f; + public override bool ExplodeOnCollision { get; set; } = true; + public float DamageModifier { get; set; } = 0; + public UnityEngine.Color Color { get; set; } = UnityEngine.Color.yellow; + public override SpawnProperties SpawnProperties { get; set; } = new SpawnProperties() + { + Limit = 3, + LockerSpawnPoints = new List + { + new LockerSpawnPoint() + { + Chance = 75, + UseChamber = true, + Type = LockerType.Misc, + Zone = ZoneType.Entrance, + }, + new LockerSpawnPoint() + { + Chance = 50, + UseChamber = true, + Type = LockerType.Misc, + Zone = ZoneType.LightContainment, + }, + new LockerSpawnPoint() + { + Chance = 50, + UseChamber = true, + Type = LockerType.LargeGun, + Zone = ZoneType.HeavyContainment, + }, + }, + + RoomSpawnPoints = new List + { + new RoomSpawnPoint() + { + Chance = 75, + Room = RoomType.LczGlassBox, + }, + new RoomSpawnPoint() + { + Chance = 100, + Room = RoomType.HczNuke, + }, + }, + }; + + protected override void OnExploding(ExplodingGrenadeEventArgs ev) + { + float cylinderSize = 5; + + Player playerThrowingGrenade = ev.Player; + Vector3 molotovPosition = ev.Position; + Primitive wall = Primitive.Create(PrimitiveType.Cylinder, molotovPosition, null, new Vector3(cylinderSize, 0.01f, cylinderSize), true); + wall.Collidable = true; + wall.Visible = true; + + wall.Color = Color.red; + + var coroutineHandler = Timing.RunCoroutine(DamageInMolotovZone(wall.Position, cylinderSize, playerThrowingGrenade)); + + Timing.CallDelayed(20, () => { + wall.UnSpawn(); + Timing.KillCoroutines(coroutineHandler); + wall.Destroy(); + }); + } + + private IEnumerator DamageInMolotovZone(Vector3 wallPosition, float cylinderSize, Player playerThrowingGrenade) + { + while (true) + { + foreach (Player player in Exiled.API.Features.Player.List) + { + // Check if a player is in the zone. + if (IsPlayerInZone(player, wallPosition, cylinderSize)) + { + // Friendly Fire Enabled + if (Exiled.API.Features.Server.FriendlyFire) + { + player.Hurt(player.Health / 150, DamageType.Bleeding); + + } + // Friendly Fire Disabled + else + { + if(playerThrowingGrenade.Role.Team != player.Role.Team || playerThrowingGrenade == player) + { + player.Hurt(player.Health / 150, DamageType.Bleeding); + } + } + } + } + + // Waiting 0.5s before re-check. + yield return Timing.WaitForSeconds(0.5f); + } + } + + private bool IsPlayerInZone(Player player, Vector3 zonePosition, float radius) + { + float distance = Vector3.Distance(new Vector3(player.Position.x, 0, player.Position.z), + new Vector3(zonePosition.x, 0, zonePosition.z)); + return distance <= (radius/2) ; + } + } +} \ No newline at end of file From bbc97e0d3fb271fbf4b4ff5756a480c7541eab6b Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Thu, 16 Jan 2025 16:48:57 +0100 Subject: [PATCH 109/853] added constant for easier management simplified an if --- KruacentExiled/KE.Items/Items/Molotov.cs | 22 ++++++---------------- 1 file changed, 6 insertions(+), 16 deletions(-) diff --git a/KruacentExiled/KE.Items/Items/Molotov.cs b/KruacentExiled/KE.Items/Items/Molotov.cs index 725fb453..843ddc9c 100644 --- a/KruacentExiled/KE.Items/Items/Molotov.cs +++ b/KruacentExiled/KE.Items/Items/Molotov.cs @@ -23,6 +23,8 @@ public class Molotov : CustomGrenade, ILumosItem public override bool ExplodeOnCollision { get; set; } = true; public float DamageModifier { get; set; } = 0; public UnityEngine.Color Color { get; set; } = UnityEngine.Color.yellow; + private const float RefreshRate = 0.5f; + private const float Duration = 20f; public override SpawnProperties SpawnProperties { get; set; } = new SpawnProperties() { Limit = 3, @@ -80,7 +82,7 @@ protected override void OnExploding(ExplodingGrenadeEventArgs ev) var coroutineHandler = Timing.RunCoroutine(DamageInMolotovZone(wall.Position, cylinderSize, playerThrowingGrenade)); - Timing.CallDelayed(20, () => { + Timing.CallDelayed(Duration, () => { wall.UnSpawn(); Timing.KillCoroutines(coroutineHandler); wall.Destroy(); @@ -91,30 +93,18 @@ private IEnumerator DamageInMolotovZone(Vector3 wallPosition, float cylin { while (true) { - foreach (Player player in Exiled.API.Features.Player.List) + foreach (Player player in Player.List) { - // Check if a player is in the zone. if (IsPlayerInZone(player, wallPosition, cylinderSize)) { - // Friendly Fire Enabled - if (Exiled.API.Features.Server.FriendlyFire) + if (Exiled.API.Features.Server.FriendlyFire || playerThrowingGrenade.Role.Team != player.Role.Team || playerThrowingGrenade == player) { player.Hurt(player.Health / 150, DamageType.Bleeding); - - } - // Friendly Fire Disabled - else - { - if(playerThrowingGrenade.Role.Team != player.Role.Team || playerThrowingGrenade == player) - { - player.Hurt(player.Health / 150, DamageType.Bleeding); - } } } } - // Waiting 0.5s before re-check. - yield return Timing.WaitForSeconds(0.5f); + yield return Timing.WaitForSeconds(RefreshRate); } } From e30321a0f9b791ade6ce06dfb420f38e082452e3 Mon Sep 17 00:00:00 2001 From: Omer <113857370+OmerGS@users.noreply.github.com> Date: Thu, 16 Jan 2025 16:53:25 +0100 Subject: [PATCH 110/853] Molotov damage fix and Heal Zone added --- KruacentExiled/KE.Items/Items/HealZone.cs | 120 ++++++++++++++++++++++ KruacentExiled/KE.Items/Items/Molotov.cs | 8 +- 2 files changed, 125 insertions(+), 3 deletions(-) create mode 100644 KruacentExiled/KE.Items/Items/HealZone.cs diff --git a/KruacentExiled/KE.Items/Items/HealZone.cs b/KruacentExiled/KE.Items/Items/HealZone.cs new file mode 100644 index 00000000..3d26e282 --- /dev/null +++ b/KruacentExiled/KE.Items/Items/HealZone.cs @@ -0,0 +1,120 @@ +using System.Collections.Generic; +using Exiled.API.Enums; +using Exiled.API.Features.Attributes; +using Exiled.API.Features.Spawn; +using Exiled.API.Features.Toys; +using Exiled.CustomItems.API.Features; +using Exiled.Events.EventArgs.Map; +using KE.Items.Interface; +using Player = Exiled.API.Features.Player; +using MEC; +using UnityEngine; + +namespace KE.Items.Items +{ + [CustomItem(ItemType.GrenadeHE)] + public class HealZone : CustomGrenade, ILumosItem + { + public override uint Id { get; set; } = 1410; + public override string Name { get; set; } = "Heal Zone"; + public override string Description { get; set; } = "Allow to heal you and your ally"; + public override float Weight { get; set; } = 0.65f; + public override float FuseTime { get; set; } = 5f; + public override bool ExplodeOnCollision { get; set; } = true; + public float DamageModifier { get; set; } = 0f; + public UnityEngine.Color Color { get; set; } = UnityEngine.Color.green; + public override SpawnProperties SpawnProperties { get; set; } = new SpawnProperties() + { + Limit = 3, + LockerSpawnPoints = new List + { + new LockerSpawnPoint() + { + Chance = 75, + UseChamber = true, + Type = LockerType.Medkit, + Zone = ZoneType.Entrance, + }, + new LockerSpawnPoint() + { + Chance = 50, + UseChamber = true, + Type = LockerType.Medkit, + Zone = ZoneType.LightContainment, + }, + new LockerSpawnPoint() + { + Chance = 100, + UseChamber = true, + Type = LockerType.Medkit, + Zone = ZoneType.HeavyContainment, + }, + }, + + RoomSpawnPoints = new List + { + new RoomSpawnPoint() + { + Chance = 75, + Room = RoomType.HczHid, + }, + new RoomSpawnPoint() + { + Chance = 50, + Room = RoomType.HczNuke, + }, + }, + }; + + protected override void OnExploding(ExplodingGrenadeEventArgs ev) + { + float cylinderSize = 5; + + ev.TargetsToAffect.Clear(); + + Player playerThrowingGrenade = ev.Player; + Vector3 healZonePosition = ev.Position; + Primitive wall = Primitive.Create(PrimitiveType.Cylinder, healZonePosition, null, new Vector3(cylinderSize, 0.01f, cylinderSize), true); + wall.Collidable = false; + wall.Visible = true; + + wall.Color = Color.green; + + var coroutineHandler = Timing.RunCoroutine(HealZoneHeal(wall.Position, cylinderSize, playerThrowingGrenade)); + + Timing.CallDelayed(20, () => { + wall.UnSpawn(); + Timing.KillCoroutines(coroutineHandler); + wall.Destroy(); + }); + } + + private IEnumerator HealZoneHeal(Vector3 wallPosition, float cylinderSize, Player playerThrowingGrenade) + { + while (true) + { + foreach (Player player in Exiled.API.Features.Player.List) + { + // Check if a player is in the zone. + if (IsPlayerInZone(player, wallPosition, cylinderSize)) + { + if(playerThrowingGrenade.Role.Team == player.Role.Team) + { + player.Heal(1); + } + } + } + + // Waiting 0.5s before re-check. + yield return Timing.WaitForSeconds(0.5f); + } + } + + private bool IsPlayerInZone(Player player, Vector3 zonePosition, float radius) + { + float distance = Vector3.Distance(new Vector3(player.Position.x, 0, player.Position.z), + new Vector3(zonePosition.x, 0, zonePosition.z)); + return distance <= (radius/2) ; + } + } +} \ No newline at end of file diff --git a/KruacentExiled/KE.Items/Items/Molotov.cs b/KruacentExiled/KE.Items/Items/Molotov.cs index 725fb453..d25a6559 100644 --- a/KruacentExiled/KE.Items/Items/Molotov.cs +++ b/KruacentExiled/KE.Items/Items/Molotov.cs @@ -21,7 +21,7 @@ public class Molotov : CustomGrenade, ILumosItem public override float Weight { get; set; } = 0.65f; public override float FuseTime { get; set; } = 5f; public override bool ExplodeOnCollision { get; set; } = true; - public float DamageModifier { get; set; } = 0; + public float DamageModifier { get; set; } = 0f; public UnityEngine.Color Color { get; set; } = UnityEngine.Color.yellow; public override SpawnProperties SpawnProperties { get; set; } = new SpawnProperties() { @@ -46,7 +46,7 @@ public class Molotov : CustomGrenade, ILumosItem { Chance = 50, UseChamber = true, - Type = LockerType.LargeGun, + Type = LockerType.Misc, Zone = ZoneType.HeavyContainment, }, }, @@ -70,10 +70,12 @@ protected override void OnExploding(ExplodingGrenadeEventArgs ev) { float cylinderSize = 5; + ev.TargetsToAffect.Clear(); + Player playerThrowingGrenade = ev.Player; Vector3 molotovPosition = ev.Position; Primitive wall = Primitive.Create(PrimitiveType.Cylinder, molotovPosition, null, new Vector3(cylinderSize, 0.01f, cylinderSize), true); - wall.Collidable = true; + wall.Collidable = false; wall.Visible = true; wall.Color = Color.red; From 67d10e7a1d99797829cef7548393d661afedaee9 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Thu, 16 Jan 2025 17:04:57 +0100 Subject: [PATCH 111/853] changed true divine pills id --- KruacentExiled/KE.Items/Items/TrueDivinePills.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/KruacentExiled/KE.Items/Items/TrueDivinePills.cs b/KruacentExiled/KE.Items/Items/TrueDivinePills.cs index afe417e4..98ba900b 100644 --- a/KruacentExiled/KE.Items/Items/TrueDivinePills.cs +++ b/KruacentExiled/KE.Items/Items/TrueDivinePills.cs @@ -21,7 +21,7 @@ public class TrueDivinePills : CustomItem, ILumosItem { /// - public override uint Id { get; set; } = 1409; + public override uint Id { get; set; } = 1410; /// public override string Name { get; set; } = "True Divine Pills"; From e763060ea189c939c47677d65f8d84823e40d9ce Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Thu, 16 Jan 2025 17:05:50 +0100 Subject: [PATCH 112/853] changed heal zone id --- KruacentExiled/KE.Items/Items/HealZone.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/KruacentExiled/KE.Items/Items/HealZone.cs b/KruacentExiled/KE.Items/Items/HealZone.cs index 3d26e282..f84dc4d9 100644 --- a/KruacentExiled/KE.Items/Items/HealZone.cs +++ b/KruacentExiled/KE.Items/Items/HealZone.cs @@ -15,7 +15,7 @@ namespace KE.Items.Items [CustomItem(ItemType.GrenadeHE)] public class HealZone : CustomGrenade, ILumosItem { - public override uint Id { get; set; } = 1410; + public override uint Id { get; set; } = 1411; public override string Name { get; set; } = "Heal Zone"; public override string Description { get; set; } = "Allow to heal you and your ally"; public override float Weight { get; set; } = 0.65f; From 4af5c444d7a4644d60db7e178acd2deb125ab4e1 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Thu, 16 Jan 2025 18:43:35 +0100 Subject: [PATCH 113/853] added debug log --- .../GE/SystemMalfunction.cs | 35 +++++++++++++++---- .../GEFE/API/Features/GlobalEvent.cs | 2 ++ 2 files changed, 30 insertions(+), 7 deletions(-) diff --git a/KruacentExiled/KE.GlobalEventFramework.Examples/GE/SystemMalfunction.cs b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/SystemMalfunction.cs index 491b3d2a..9ee3d98a 100644 --- a/KruacentExiled/KE.GlobalEventFramework.Examples/GE/SystemMalfunction.cs +++ b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/SystemMalfunction.cs @@ -9,6 +9,7 @@ using Exiled.API.Enums; using Exiled.API.Extensions; using KE.GlobalEventFramework.GEFE.API.Interfaces; +using System; namespace KE.GlobalEventFramework.Examples.GE { @@ -37,17 +38,18 @@ public class SystemMalfunction : GlobalEvent,IStart,IEvent public int NewCooldown { get; set; } = 180; public override uint[] IncompatibleGE { get; set; } = { 38 }; - private BlackoutNDoor.MainPlugin BlackoutNDoor; + private BlackoutNDoor.MainPlugin BlackoutNDoor = null; /// public IEnumerator Start() { + Log.Debug("system malfunction start"); MoreBlackOutNDoors(); Coroutine.LaunchCoroutine(EarlyNuke()); - + CoroutineHandle handle; while(Round.InProgress){ - //todo change so it happen more frequently - yield return Timing.WaitForSeconds(300); + Log.Debug("system malfunction"); + yield return Timing.WaitForSeconds(UnityEngine.Random.Range(200, 300)); List> l = new []{CheckpointMalfunction(),GateLockdown(),ElevatorLockdown()}.ToList(); handle = Coroutine.LaunchCoroutine(l[UnityEngine.Random.Range(0,3)]); yield return Timing.WaitUntilDone(handle); @@ -67,6 +69,7 @@ public void SubscribeEvent() { Log.Info("Found BlackOutNDoors"); BlackoutNDoor = blackout; + return; } } @@ -87,16 +90,33 @@ private IEnumerator EarlyNuke() private void MoreBlackOutNDoors() { - BlackoutNDoor.ServerHandler.Cooldown = NewCooldown; + try + { + if (BlackoutNDoor != null) + { + if (BlackoutNDoor.ServerHandler != null) + BlackoutNDoor.ServerHandler.Cooldown = NewCooldown; + else + Log.Error("server handler null"); + } + + } + catch(Exception e) + { + Log.Error(e); + } + } private IEnumerator CheckpointMalfunction(){ - yield return Timing.WaitForSeconds(UnityEngine.Random.Range(20,60)); + Log.Debug("CheckpointMalfunction"); var checkpoints = Door.List.Where(d => d.IsCheckpoint).ToList().RandomItem().IsOpen =true; - + yield return Timing.WaitForSeconds(UnityEngine.Random.Range(20, 60)); + } private IEnumerator GateLockdown(){ + Log.Debug("GateLockdown"); var gates = Door.List.Where(d => d.Type == DoorType.GateA ||d.Type == DoorType.GateB); var gate = gates.GetRandomValue(); gate.IsOpen = false; @@ -106,6 +126,7 @@ private IEnumerator GateLockdown(){ } private IEnumerator ElevatorLockdown(){ + Log.Debug("ElevatorLockdown"); var lift = Lift.Random; lift.ChangeLock(DoorLockReason.Isolation); yield return Timing.WaitForSeconds(UnityEngine.Random.Range(10,20)); diff --git a/KruacentExiled/KE.GlobalEventFramework/GEFE/API/Features/GlobalEvent.cs b/KruacentExiled/KE.GlobalEventFramework/GEFE/API/Features/GlobalEvent.cs index 8c76bf53..789c977d 100644 --- a/KruacentExiled/KE.GlobalEventFramework/GEFE/API/Features/GlobalEvent.cs +++ b/KruacentExiled/KE.GlobalEventFramework/GEFE/API/Features/GlobalEvent.cs @@ -149,11 +149,13 @@ private static void ActivateAll(List globalEvent) { if(ge is IEvent geEvent) { + Log.Debug($"{ge.Name} implements IEvent, subscribing events"); geEvent.SubscribeEvent(); } if(ge is IStart geStart) { + Log.Debug($"{ge.Name} implements IStart, starting"); CoroutineHandle a = Timing.RunCoroutine(geStart.Start()); coroutineHandles.Add(a); } From abba8d82671994f09b052b225a05b0345e2481e2 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Thu, 16 Jan 2025 18:48:05 +0100 Subject: [PATCH 114/853] changed the respawn of divine pill --- KruacentExiled/KE.Items/Items/DivinePills.cs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/KruacentExiled/KE.Items/Items/DivinePills.cs b/KruacentExiled/KE.Items/Items/DivinePills.cs index f60e24b3..b70cd405 100644 --- a/KruacentExiled/KE.Items/Items/DivinePills.cs +++ b/KruacentExiled/KE.Items/Items/DivinePills.cs @@ -149,7 +149,15 @@ private void OnUsingItem(UsingItemEventArgs ev) return; } Player respawning = Player.List.Where(x => x.Role == RoleTypeId.Spectator).GetRandomValue(); - respawning.Role.Set(player.Role); + switch (player.Role.Side) + { + case Side.ChaosInsurgency: + respawning.Role.Set(RoleTypeId.ChaosRifleman); + break; + case Side.Mtf: + respawning.Role.Set(RoleTypeId.NtfPrivate); + break; + } if (random > 75) { respawning.Teleport(player); From fe80671365d2556c243c6ac7d44876cfe0c971af Mon Sep 17 00:00:00 2001 From: Omer <113857370+OmerGS@users.noreply.github.com> Date: Fri, 17 Jan 2025 12:45:38 +0100 Subject: [PATCH 115/853] Surface Light will be random. --- KruacentExiled/KE.Misc/Config.cs | 1 + KruacentExiled/KE.Misc/MainPlugin.cs | 3 ++ KruacentExiled/KE.Misc/ServerHandler.cs | 2 ++ KruacentExiled/KE.Misc/SurfaceLight.cs | 39 +++++++++++++++++++++++++ 4 files changed, 45 insertions(+) create mode 100644 KruacentExiled/KE.Misc/SurfaceLight.cs diff --git a/KruacentExiled/KE.Misc/Config.cs b/KruacentExiled/KE.Misc/Config.cs index 8ff0b427..8138bbee 100644 --- a/KruacentExiled/KE.Misc/Config.cs +++ b/KruacentExiled/KE.Misc/Config.cs @@ -19,5 +19,6 @@ public class Config : IConfig public bool AutoElevator { get; set; } = true; [Description("Chance to get a pink candy (0-100)")] public int ChancePinkCandy { get; set; } = 10; + public bool SurfaceLight { get; set; } = true; } } diff --git a/KruacentExiled/KE.Misc/MainPlugin.cs b/KruacentExiled/KE.Misc/MainPlugin.cs index 04275d79..968a1b67 100644 --- a/KruacentExiled/KE.Misc/MainPlugin.cs +++ b/KruacentExiled/KE.Misc/MainPlugin.cs @@ -24,6 +24,7 @@ public class MainPlugin : Plugin internal AutoElevator AutoElevator { get; private set; } internal ClassDDoor ClassDDoor { get; private set; } internal Candy Candy { get; private set; } + internal SurfaceLight SurfaceLight { get; private set; } public override void OnEnabled() { @@ -31,6 +32,7 @@ public override void OnEnabled() _914 = new _914(); AutoElevator = new AutoElevator(); ClassDDoor = new ClassDDoor(); + SurfaceLight = new SurfaceLight(); ServerHandler = new ServerHandler(); if (Instance.Config.ChancePinkCandy >= 0 && Instance.Config.ChancePinkCandy <= 100) { @@ -68,6 +70,7 @@ public override void OnDisabled() ServerHandler = null; AutoElevator = null; Instance = null; + SurfaceLight = null; } diff --git a/KruacentExiled/KE.Misc/ServerHandler.cs b/KruacentExiled/KE.Misc/ServerHandler.cs index a8d01142..2274d004 100644 --- a/KruacentExiled/KE.Misc/ServerHandler.cs +++ b/KruacentExiled/KE.Misc/ServerHandler.cs @@ -22,6 +22,8 @@ public void OnRoundStarted() Timing.RunCoroutine(MainPlugin.Instance.PeanutLockdown()); if(MainPlugin.Instance.Config.AutoElevator) Timing.RunCoroutine(MainPlugin.Instance.AutoElevator.StartElevator()); + if (MainPlugin.Instance.Config.SurfaceLight) + MainPlugin.Instance.SurfaceLight.ChangeSurfaceLight(); } } } diff --git a/KruacentExiled/KE.Misc/SurfaceLight.cs b/KruacentExiled/KE.Misc/SurfaceLight.cs new file mode 100644 index 00000000..fae0b003 --- /dev/null +++ b/KruacentExiled/KE.Misc/SurfaceLight.cs @@ -0,0 +1,39 @@ +using Exiled.API.Enums; +using Exiled.API.Features; +using UnityEngine; +using System.Collections.Generic; +using System.Linq; + +namespace KE.Misc +{ + /// + /// Everything about Surface Light + /// + internal class SurfaceLight + { + /// + /// Change Surface Light Color + /// + internal void ChangeSurfaceLight() + { + List colors = new [] + { + Color.cyan, + Color.red, + Color.green, + Color.white, + Color.blue + }.ToList(); + + // Select a random color + Color randomColor = colors[UnityEngine.Random.Range(0, colors.Count)]; + + foreach (var room in Room.List.Where(r => r.Type == RoomType.Surface)) + { + room.Color = randomColor; + } + + Log.Info($"Changed Surface light color to {randomColor}."); + } + } +} From 81ccd3217ae802b514258133636c30dc9c267609 Mon Sep 17 00:00:00 2001 From: Omer <113857370+OmerGS@users.noreply.github.com> Date: Sun, 19 Jan 2025 15:59:53 +0100 Subject: [PATCH 116/853] features/new custom items: Impact Flash, Mine and Grenade Launcher. --- .../KE.Items/Items/AdrenalineDrogue.cs | 37 +++- KruacentExiled/KE.Items/Items/Defibrilator.cs | 35 ++-- .../KE.Items/Items/GrenadeLauncher.cs | 132 +++++++++++++++ KruacentExiled/KE.Items/Items/ImpactFlash.cs | 48 ++++++ KruacentExiled/KE.Items/Items/Mine.cs | 158 ++++++++++++++++++ KruacentExiled/KE.Items/KE.Items.csproj | 4 +- 6 files changed, 391 insertions(+), 23 deletions(-) create mode 100644 KruacentExiled/KE.Items/Items/GrenadeLauncher.cs create mode 100644 KruacentExiled/KE.Items/Items/ImpactFlash.cs create mode 100644 KruacentExiled/KE.Items/Items/Mine.cs diff --git a/KruacentExiled/KE.Items/Items/AdrenalineDrogue.cs b/KruacentExiled/KE.Items/Items/AdrenalineDrogue.cs index f463761d..cf9af49a 100644 --- a/KruacentExiled/KE.Items/Items/AdrenalineDrogue.cs +++ b/KruacentExiled/KE.Items/Items/AdrenalineDrogue.cs @@ -10,10 +10,11 @@ using Exiled.API.Extensions; using UnityEngine; using CustomPlayerEffects; +using KE.Items.Interface; /// [CustomItem(ItemType.Adrenaline)] -public class AdrenalineDrogue : CustomItem +public class AdrenalineDrogue : CustomItem, ILumosItem { /// public override uint Id { get; set; } = 1402; @@ -22,10 +23,12 @@ public class AdrenalineDrogue : CustomItem public override string Name { get; set; } = "DA-020"; /// - public override string Description { get; set; } = "La bonne drogue là, si vous le prenez vous êtes ienb pendant 20 secondes puis vous vous sentez pas bien !"; + public override string Description { get; set; } = "you need to test it !"; /// public override float Weight { get; set; } = 0.65f; + public UnityEngine.Color Color { get; set; } = UnityEngine.Color.yellow; + public List joueursSCP = new List(); @@ -46,6 +49,24 @@ public class AdrenalineDrogue : CustomItem Location = SpawnLocationType.Inside173Gate, }, }, + + LockerSpawnPoints = new List + { + new LockerSpawnPoint() + { + Chance = 20, + UseChamber = true, + Type = LockerType.Misc, + Zone = ZoneType.Entrance, + }, + new LockerSpawnPoint() + { + Chance = 25, + UseChamber = true, + Type = LockerType.Medkit, + Zone = ZoneType.HeavyContainment, + }, + }, }; /// @@ -151,7 +172,7 @@ private IEnumerator EffectAttribution(Exiled.API.Features.Player joueur) switch (randomNumber) { case 1: - Log.Debug(joueur.Nickname + " a changé d'apparence !"); + Log.Debug(joueur.Nickname + " changed his skin !"); joueur.PlayShieldBreakSound(); joueur.ChangeAppearance(joueursSCP[0].Role); @@ -165,14 +186,14 @@ private IEnumerator EffectAttribution(Exiled.API.Features.Player joueur) break; case 2: Log.Debug("Muet"); - joueur.ShowHint("Vous avez perdu votre langue ! (esperons que celle-ci repousse)"); + joueur.ShowHint("You lost your ability to talk, (git good)"); joueur.Mute(); yield return Timing.WaitForSeconds(UnityEngine.Random.Range(30, 100)); - joueur.ShowHint("Je crois que c'est bon, ça a repoussé !"); + joueur.ShowHint("I think you found your ability"); joueur.UnMute(); break; case 3: - joueur.ShowHint("Vous êtes devenu du caoutchouc !"); + joueur.ShowHint("You are caoutchouc man"); Exiled.API.Features.TeslaGate.IgnoredPlayers.Add(joueur); joueur.SetScale(new Vector3(1.5f, 0.5f, 1.7f), Exiled.API.Features.Player.List); break; @@ -180,7 +201,7 @@ private IEnumerator EffectAttribution(Exiled.API.Features.Player joueur) Log.Debug("Let's go party"); foreach (var player in Exiled.API.Features.Player.List) { - player.ShowHint(joueur.Nickname + " à commencer une fête d'anniversaire !"); + player.ShowHint("It's " + joueur.Nickname + " birthday !"); } float duration2 = 30f; @@ -205,7 +226,7 @@ private IEnumerator EffectAttribution(Exiled.API.Features.Player joueur) break; case 5: Log.Debug("Paper"); - joueur.ShowHint("Bienvenue dans le monde des papiers. Évite les ciseaux !"); + joueur.ShowHint("You are a paper ! Yippee !"); joueur.SetScale(new Vector3(1f, 0.5f, 1f), Exiled.API.Features.Player.List); break; } diff --git a/KruacentExiled/KE.Items/Items/Defibrilator.cs b/KruacentExiled/KE.Items/Items/Defibrilator.cs index a4c1f6a5..f73b9ee0 100644 --- a/KruacentExiled/KE.Items/Items/Defibrilator.cs +++ b/KruacentExiled/KE.Items/Items/Defibrilator.cs @@ -9,26 +9,34 @@ using Exiled.API.Features; using UnityEngine; using System.Linq; +using KE.Items.Interface; [CustomItem(ItemType.SCP1853)] -public class Defibrilator : CustomItem +public class Defibrilator : CustomItem, ILumosItem { public override uint Id { get; set; } = 1401; - public override string Name { get; set; } = "DF-001"; - public override string Description { get; set; } = "Le défibrilateur, il permet de réanimer une personne qui à une perte de conscience, on va réanimer la personne la plus proche du joueur qui l'utilise (le lieu de mort et non où se trouve le corps)"; + public override string Name { get; set; } = "Defibrilator"; + public override string Description { get; set; } = "The defibrillator is used to revive a person who has lost consciousness. It will revive the person closest to the player who uses it (the location of death, not where the body is)."; public override float Weight { get; set; } = 0.65f; + public UnityEngine.Color Color { get; set; } = UnityEngine.Color.cyan; + private ConcurrentDictionary positionMort = new ConcurrentDictionary(); public override SpawnProperties SpawnProperties { get; set; } = new SpawnProperties() { - Limit = 2, + Limit = 4, DynamicSpawnPoints = new List { - new DynamicSpawnPoint() { Chance = 100, Location = SpawnLocationType.Inside079Secondary }, - new DynamicSpawnPoint() { Chance = 10, Location = SpawnLocationType.InsideHidRight }, - new DynamicSpawnPoint() { Chance = 10, Location = SpawnLocationType.InsideHidLeft }, + new DynamicSpawnPoint() { Chance = 50, Location = SpawnLocationType.Inside079Secondary }, + new DynamicSpawnPoint() { Chance = 20, Location = SpawnLocationType.InsideHidLower }, + new DynamicSpawnPoint() { Chance = 20, Location = SpawnLocationType.InsideHidUpper }, }, + + LockerSpawnPoints = new List + { + new LockerSpawnPoint(){ Chance=50, Type = LockerType.Medkit, }, + } }; protected override void SubscribeEvents() @@ -69,7 +77,7 @@ private void OnUsingItem(UsedItemEventArgs ev) { if (TryGet(ev.Item, out var result) && result.Id == 20) { - Timing.CallDelayed(0.5f, () => + Timing.CallDelayed(2f, () => { ev.Player.DisableEffect(EffectType.Scp1853); Timing.RunCoroutine(EffectAttribution(ev.Player)); @@ -79,13 +87,14 @@ private void OnUsingItem(UsedItemEventArgs ev) private IEnumerator EffectAttribution(Player joueur) { + joueur.DisableEffect(EffectType.Scp1853); Log.Debug("Utilisation item"); Log.Debug("Nombre de mort : " + positionMort.Count()); if (positionMort.Count == 0) { - joueur.Broadcast(5, "Il n'y a pas de morts actuellement.", Broadcast.BroadcastFlags.Normal, true); - Exiled.CustomItems.API.Features.CustomItem.TryGive(joueur, 20); + joueur.Broadcast(5, "There is no death", Broadcast.BroadcastFlags.Normal, true); + Exiled.CustomItems.API.Features.CustomItem.TryGive(joueur, 1401); } else { @@ -112,12 +121,12 @@ private IEnumerator EffectAttribution(Player joueur) closestDeadPlayer.IsGodModeEnabled = true; closestDeadPlayer.Role.Set(joueur.Role); - closestDeadPlayer.Health = 10; + closestDeadPlayer.Health = 40; closestDeadPlayer.Teleport(joueur.Position); - closestDeadPlayer.Broadcast(5, joueur.Nickname + " t'as réanimé !", Broadcast.BroadcastFlags.Normal, true); - joueur.Broadcast(5, "Tu as réanimé " + closestDeadPlayer.Nickname + " !", Broadcast.BroadcastFlags.Normal, true); + closestDeadPlayer.Broadcast(5, joueur.Nickname + " revived you!", Broadcast.BroadcastFlags.Normal, true); + joueur.Broadcast(5, "You revived " + closestDeadPlayer.Nickname + "!", Broadcast.BroadcastFlags.Normal, true); yield return Timing.WaitForSeconds(1); diff --git a/KruacentExiled/KE.Items/Items/GrenadeLauncher.cs b/KruacentExiled/KE.Items/Items/GrenadeLauncher.cs new file mode 100644 index 00000000..20357c10 --- /dev/null +++ b/KruacentExiled/KE.Items/Items/GrenadeLauncher.cs @@ -0,0 +1,132 @@ +using System.Collections.Generic; +using System.ComponentModel; +using Exiled.API.Enums; +using Exiled.API.Features.Attributes; +using Exiled.API.Features.Pickups.Projectiles; +using Exiled.API.Features.Spawn; +using Exiled.CustomItems.API.Features; +using Exiled.Events.EventArgs.Player; +using MEC; +using System.Linq; +using Exiled.API.Features; +using Exiled.API.Features.Items; +using UnityEngine; +using CollisionHandler = Exiled.API.Features.Components.CollisionHandler; +using KE.Items.Interface; + + +namespace KE.Items.Items +{ + [CustomItem(ItemType.GunLogicer)] + public class GrenadeLauncher : CustomWeapon, ILumosItem + { + private CustomGrenade loadedCustomGrenade; + + private ProjectileType loadedGrenade = ProjectileType.FragGrenade; + + public override uint Id { get; set; } = 1414; + public override string Name { get; set; } = "Grenade Launcher"; + public override string Description { get; set; } = "Weapon that launch grenade, it's pretty simple"; + public override float Weight { get; set; } = 2.95f; + public float DamageModifier { get; set; } = 1f; + public UnityEngine.Color Color { get; set; } = UnityEngine.Color.red; + + public override SpawnProperties SpawnProperties { get; set; } = new SpawnProperties() + { + Limit = 1, + LockerSpawnPoints = new List + { + new LockerSpawnPoint() + { + Chance = 50, + Type = LockerType.ExperimentalWeapon + } + } + }; + + public override float Damage { get; set; } + public override byte ClipSize { get; set; } = 4; + + [Description("Whether or not players will need actual frag grenades in their inventory to use as ammo. If false, the weapon's base ammo type is used instead.")] + public bool UseGrenades { get; set; } = true; + + [Description("The speed of grenades when they shoot out of the weapon.")] + public float GrenadeSpeed { get; set; } = 3f; + + [Description("The max duration of the fuse of grenades shot from the weapon. These grenades will always explode immediatly when they collide with something, but this can be used with slow-moving grenades to cause mid-air explosions.")] + public float FuseTime { get; set; } = 1f; + + [Description("Whether or not the Grenade Launcher will consider modded frag grenades as viable grenades for reloading.")] + public bool IgnoreModdedGrenades { get; set; } = true; + + protected override void OnReloading(ReloadingWeaponEventArgs ev) + { + if (UseGrenades) + { + ev.IsAllowed = true; + + if (!(ev.Player.CurrentItem is Firearm firearm) || firearm.MagazineAmmo >= ClipSize) + return; + + Log.Debug($"{Name}.{nameof(OnReloading)}: {ev.Player.Nickname} is reloading!"); + + foreach (Item item in ev.Player.Items.ToList()) + { + Log.Debug($"{Name}.{nameof(OnReloading)}: Found item: {item.Type} - {item.Serial}"); + if (item.Type != ItemType.GrenadeHE && item.Type != ItemType.GrenadeFlash && item.Type != ItemType.SCP018) + continue; + if (TryGet(item, out CustomItem cItem)) + { + if (IgnoreModdedGrenades) + continue; + + if (cItem is CustomGrenade customGrenade) + loadedCustomGrenade = customGrenade; + } + + ev.Player.DisableEffect(EffectType.Invisible); + //ev.Player.Connection.Send(new RequestMessage(ev.Firearm.Serial, ReloadType.Reload)); + + + Timing.CallDelayed(3f, () => firearm.MagazineAmmo = ClipSize); + + loadedGrenade = item.Type == ItemType.GrenadeFlash ? ProjectileType.Flashbang : + item.Type == ItemType.GrenadeHE ? ProjectileType.FragGrenade : ProjectileType.Scp018; + Log.Debug($"{Name}.{nameof(OnReloading)}: {ev.Player.Nickname} successfully reloaded. Grenade type: {loadedGrenade} IsCustom: {loadedCustomGrenade != null}"); + ev.Player.RemoveItem(item); + + return; + } + + Log.Debug($"{Name}.{nameof(OnReloading)}: {ev.Player.Nickname} was unable to reload - No grenades in inventory."); + } + } + + /// + protected override void OnShooting(ShootingEventArgs ev) + { + ev.IsAllowed = false; + + if (ev.Player.CurrentItem is Firearm firearm) + firearm.MagazineAmmo -= 1; + + Vector3 pos = ev.Player.CameraTransform.TransformPoint(new Vector3(0.0715f, 0.0225f, 0.45f)); + Projectile projectile; + + switch (loadedGrenade) + { + case ProjectileType.Scp018: + projectile = ev.Player.ThrowGrenade(ProjectileType.Scp018).Projectile; + break; + case ProjectileType.Flashbang: + projectile = ev.Player.ThrowGrenade(ProjectileType.Flashbang).Projectile; + break; + default: + projectile = ev.Player.ThrowGrenade(ProjectileType.FragGrenade).Projectile; + break; + } + + projectile.GameObject.AddComponent().Init(ev.Player.GameObject, projectile.Base); + } + } +} diff --git a/KruacentExiled/KE.Items/Items/ImpactFlash.cs b/KruacentExiled/KE.Items/Items/ImpactFlash.cs new file mode 100644 index 00000000..6eed2a48 --- /dev/null +++ b/KruacentExiled/KE.Items/Items/ImpactFlash.cs @@ -0,0 +1,48 @@ +using System.Collections.Generic; +using Exiled.API.Enums; +using Exiled.API.Features.Attributes; +using Exiled.API.Features.Spawn; +using Exiled.CustomItems.API.Features; + +namespace KE.Items.Items +{ + [CustomItem(ItemType.GrenadeFlash)] + public class ImpactFlash : CustomGrenade + { + public override uint Id { get; set; } = 1412; + public override string Name { get; set; } = "Impact Flash"; + public override string Description { get; set; } = "The flashligh explode at impact"; + public override float Weight { get; set; } = 0.65f; + public override float FuseTime { get; set; } = 3f; + public override bool ExplodeOnCollision { get; set; } = true; + public float DamageModifier { get; set; } = 1f; + public override SpawnProperties SpawnProperties { get; set; } = new SpawnProperties() + { + Limit = 5, + DynamicSpawnPoints = new List + { + new DynamicSpawnPoint() + { + Chance = 50, + Location = SpawnLocationType.InsideHczArmory, + }, + new DynamicSpawnPoint() + { + Chance = 2, + Location = SpawnLocationType.Inside914, + }, + new DynamicSpawnPoint() + { + Chance= 50, + Location = SpawnLocationType.Inside049Armory, + }, + new DynamicSpawnPoint() + { + Chance= 50, + Location = SpawnLocationType.InsideLczArmory, + } + }, + + }; + } +} diff --git a/KruacentExiled/KE.Items/Items/Mine.cs b/KruacentExiled/KE.Items/Items/Mine.cs new file mode 100644 index 00000000..8e732e2b --- /dev/null +++ b/KruacentExiled/KE.Items/Items/Mine.cs @@ -0,0 +1,158 @@ +using Exiled.API.Enums; +using Exiled.API.Features.Attributes; +using Exiled.API.Features.Spawn; +using Exiled.CustomItems.API.Features; +using KE.Items.Interface; +using System.Collections.Generic; +using UnityEngine; +using Exiled.Events.EventArgs.Player; +using Exiled.API.Features.Toys; +using Player = Exiled.API.Features.Player; +using MEC; +using CustomPlayerEffects; +using Exiled.API.Features.Items; +using Exiled.API.Features; + +namespace KE.Items.Items +{ + [CustomItem(ItemType.KeycardJanitor)] + public class Mine : CustomItem, ILumosItem + { + public override uint Id { get; set; } = 1413; + public override string Name { get; set; } = "Mine"; + public override string Description { get; set; } = "Drop to deploy the mine, little advice : don't step on it"; + public override float Weight { get; set; } = 0.65f; + public UnityEngine.Color Color { get; set; } = UnityEngine.Color.yellow; + + private const float RefreshRate = 0.5f; + private const int MineActivationTime = 10; + private const float MineRadius = 0.7f; + + public override SpawnProperties SpawnProperties { get; set; } = new SpawnProperties() + { + Limit = 2, + DynamicSpawnPoints = new List + { + new DynamicSpawnPoint() + { + Chance= 25, + Location = SpawnLocationType.Inside049Armory, + }, + new DynamicSpawnPoint() + { + Chance= 25, + Location = SpawnLocationType.InsideEscapeSecondary, + }, + new DynamicSpawnPoint() + { + Chance= 25, + Location = SpawnLocationType.InsideGateA, + }, + new DynamicSpawnPoint() + { + Chance= 25, + Location = SpawnLocationType.InsideGateB, + } + }, + LockerSpawnPoints = new List + { + new LockerSpawnPoint() + { + Chance= 20, + Type = LockerType.Misc, + }, + new LockerSpawnPoint() + { + Chance= 20, + Type = LockerType.RifleRack, + }, + } + + }; + + [System.Obsolete] + protected override void OnDropping(DroppingItemEventArgs ev) + { + if(!Check(ev.Item)) + return; + if (ev.IsThrown) + { + ev.IsAllowed = true; + return; + } + + ev.IsAllowed = false; + ev.Player.RemoveItem(ev.Item); + + SpawnMine(ev.Player, ev.Player.Position); + + } + + private void SpawnMine(Player player, Vector3 playerPosition) + { + Vector3 minePosition = playerPosition; + minePosition.y -= 0.8f; + + // The base part of mine + Primitive mine = Primitive.Create(PrimitiveType.Cylinder, minePosition, null, new Vector3(MineRadius, 0.01f, MineRadius), true); + mine.Collidable = true; + mine.Visible = true; + mine.Color = Color.black; + + Timing.RunCoroutine(WaitAndActivateMine(player, mine)); + } + + + private IEnumerator WaitAndActivateMine(Player player, Primitive mine) + { + int countdown = MineActivationTime; + while (countdown > 0) + { + player.ShowHint($"The mine will be active in {countdown} seconds !", 1f); + yield return Timing.WaitForSeconds(1f); + countdown--; + } + + // Message final lorsque la mine s'active + player.ShowHint("Mine activated !"); + Timing.RunCoroutine(ActiveMine(mine, MineRadius)); + } + + private IEnumerator ActiveMine(Primitive mine, float cylinderSize) + { + while (true) + { + foreach (Player player in Player.List) + { + if (IsPlayerInZone(player, mine.Position, cylinderSize, 2)) + { + ((ExplosiveGrenade)Item.Create(ItemType.GrenadeHE)).SpawnActive(mine.Position).FuseTime = 0f; + + // Delete the mine + mine.UnSpawn(); + Timing.KillCoroutines(); + mine.Destroy(); + yield break; + } + } + + yield return Timing.WaitForSeconds(RefreshRate); + } + } + + private bool IsPlayerInZone(Player player, Vector3 zonePosition, float radius, float height) + { + // Calculate the horizontal distance (x, z) + float horizontalDistance = Vector3.Distance( + new Vector3(player.Position.x, 0, player.Position.z), + new Vector3(zonePosition.x, 0, zonePosition.z) + ); + + // Calculate the vertical difference (y) + float verticalDifference = Mathf.Abs(player.Position.y - zonePosition.y); + + // Check if the player is in the 3d zone. + return horizontalDistance <= (radius / 2) && verticalDifference <= (height / 2); + } + } +} diff --git a/KruacentExiled/KE.Items/KE.Items.csproj b/KruacentExiled/KE.Items/KE.Items.csproj index fad1fab0..9ceba020 100644 --- a/KruacentExiled/KE.Items/KE.Items.csproj +++ b/KruacentExiled/KE.Items/KE.Items.csproj @@ -5,7 +5,7 @@ - + @@ -16,7 +16,7 @@ - + From 6334e873c2c49f1a9d91417171c3a9426cb827d3 Mon Sep 17 00:00:00 2001 From: Omer <113857370+OmerGS@users.noreply.github.com> Date: Wed, 22 Jan 2025 14:02:25 +0100 Subject: [PATCH 117/853] add/saintegrenada, and nerf Grenade Launcher --- .../KE.Items/Items/GrenadeLauncher.cs | 4 +- .../KE.Items/Items/SainteGrenada.cs | 64 +++++++++++++++++++ 2 files changed, 66 insertions(+), 2 deletions(-) create mode 100644 KruacentExiled/KE.Items/Items/SainteGrenada.cs diff --git a/KruacentExiled/KE.Items/Items/GrenadeLauncher.cs b/KruacentExiled/KE.Items/Items/GrenadeLauncher.cs index 20357c10..33a8af15 100644 --- a/KruacentExiled/KE.Items/Items/GrenadeLauncher.cs +++ b/KruacentExiled/KE.Items/Items/GrenadeLauncher.cs @@ -38,14 +38,14 @@ public class GrenadeLauncher : CustomWeapon, ILumosItem { new LockerSpawnPoint() { - Chance = 50, + Chance = 10, Type = LockerType.ExperimentalWeapon } } }; public override float Damage { get; set; } - public override byte ClipSize { get; set; } = 4; + public override byte ClipSize { get; set; } = 2; [Description("Whether or not players will need actual frag grenades in their inventory to use as ammo. If false, the weapon's base ammo type is used instead.")] public bool UseGrenades { get; set; } = true; diff --git a/KruacentExiled/KE.Items/Items/SainteGrenada.cs b/KruacentExiled/KE.Items/Items/SainteGrenada.cs new file mode 100644 index 00000000..51d4cbca --- /dev/null +++ b/KruacentExiled/KE.Items/Items/SainteGrenada.cs @@ -0,0 +1,64 @@ + +using System; +using System.Collections.Generic; +using Exiled.API.Enums; +using Exiled.API.Features; +using Exiled.API.Features.Attributes; +using Exiled.API.Features.Items; +using Exiled.API.Features.Spawn; +using Exiled.CustomItems.API.Features; +using Exiled.Events.EventArgs.Map; +using KE.Items.Interface; +using UnityEngine; + +namespace KE.Items.Items +{ + [CustomItem(ItemType.GrenadeHE)] + public class SainteGrenada : CustomGrenade, ILumosItem + { + public override uint Id { get; set; } = 1415; + public override string Name { get; set; } = "Sainte Grenada"; + public override string Description { get; set; } = "Worms reference !?"; + public override float Weight { get; set; } = 1.5f; + public override float FuseTime { get; set; } = 1.5f; + public override bool ExplodeOnCollision { get; set; } = true; + public float DamageModifier { get; set; } = 3f; + public Color Color { get; set; } = Color.red; + + + // + public int NbGrenadeSpawned { get; set; } = 4; + public float SpawnRadius { get; set; } = 5f; + public float GrenadeSize { get; set; } = 4f; + // + + + public override SpawnProperties SpawnProperties { get; set; } = new SpawnProperties() + { + Limit = 1, + DynamicSpawnPoints = new List + { + new DynamicSpawnPoint() { Chance = 20, Location = SpawnLocationType.InsideHczArmory, }, + new DynamicSpawnPoint() { Chance = 10, Location = SpawnLocationType.Inside914, }, + new DynamicSpawnPoint() { Chance= 20, Location = SpawnLocationType.Inside049Armory, }, + new DynamicSpawnPoint() { Chance= 20, Location = SpawnLocationType.InsideLczArmory, } + }, + }; + + protected override void OnExploding(ExplodingGrenadeEventArgs ev) + { + ev.Projectile.Scale = new Vector3(GrenadeSize, GrenadeSize, GrenadeSize); + + for (int i = 0; i < NbGrenadeSpawned; i++) + { + float angle = UnityEngine.Random.Range(0f, 360f) * Mathf.Deg2Rad; + Vector3 offset = new Vector3(Mathf.Cos(angle), 0, Mathf.Sin(angle)) * SpawnRadius; + + Vector3 spawnPosition = ev.Position + offset; + + ExplosiveGrenade grenade = (ExplosiveGrenade)Item.Create(ItemType.GrenadeHE); + grenade.SpawnActive(spawnPosition).FuseTime = 0f; + } + } + } +} From 58b27b3da734d78739ac70fa476c9d26ca83e528 Mon Sep 17 00:00:00 2001 From: Omer <113857370+OmerGS@users.noreply.github.com> Date: Wed, 22 Jan 2025 14:12:49 +0100 Subject: [PATCH 118/853] fix/adrenalinedrogue speed reset #20 --- .../KE.Items/Items/AdrenalineDrogue.cs | 29 +++++++++++++++++-- 1 file changed, 26 insertions(+), 3 deletions(-) diff --git a/KruacentExiled/KE.Items/Items/AdrenalineDrogue.cs b/KruacentExiled/KE.Items/Items/AdrenalineDrogue.cs index cf9af49a..c6112f5e 100644 --- a/KruacentExiled/KE.Items/Items/AdrenalineDrogue.cs +++ b/KruacentExiled/KE.Items/Items/AdrenalineDrogue.cs @@ -11,6 +11,7 @@ using UnityEngine; using CustomPlayerEffects; using KE.Items.Interface; +using System.Linq; /// [CustomItem(ItemType.Adrenaline)] @@ -100,11 +101,27 @@ private void OnUsingItem(UsedItemEventArgs ev) private IEnumerator EffectAttribution(Exiled.API.Features.Player joueur) { + bool gasgas = false; + /* EFFET DE LA DROGUE */ joueur.ShowHint("Vous êtes actuellement sous effet de la cocaïne liquide !"); - joueur.EnableEffect(40, true); + + var movementBoostEffect = joueur.ActiveEffects.FirstOrDefault(e => e is MovementBoost) as MovementBoost; + + if (movementBoostEffect != null) + { + float currentIntensity = movementBoostEffect.Intensity; + joueur.EnableEffect(currentIntensity+50, true); + gasgas = true; + } + else + { + joueur.EnableEffect(50, true); + } + + joueur.EnableEffect(30, true); - joueur.EnableEffect(30, true); + joueur.EnableEffect(40, true); joueur.EnableEffect(30, true); joueur.Health = 169; @@ -161,7 +178,13 @@ private IEnumerator EffectAttribution(Exiled.API.Features.Player joueur) joueur.DisableAllEffects(); joueur.EnableEffect(10); - joueur.EnableEffect(35); + if (gasgas) + { + joueur.EnableEffect(130, true); + } else + { + joueur.EnableEffect(30, true); + } yield return Timing.WaitForSeconds(UnityEngine.Random.Range(180, 300)); From c09a21ebaa00dcafb182829a07d894ac20566575 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Wed, 22 Jan 2025 14:26:09 +0100 Subject: [PATCH 119/853] added the malfunction to SM --- .../API/Malfunction.cs | 16 ++ .../GE/SystemMalfunction.cs | 183 +++++++++++++++++- 2 files changed, 192 insertions(+), 7 deletions(-) create mode 100644 KruacentExiled/KE.GlobalEventFramework.Examples/API/Malfunction.cs diff --git a/KruacentExiled/KE.GlobalEventFramework.Examples/API/Malfunction.cs b/KruacentExiled/KE.GlobalEventFramework.Examples/API/Malfunction.cs new file mode 100644 index 00000000..2d75341f --- /dev/null +++ b/KruacentExiled/KE.GlobalEventFramework.Examples/API/Malfunction.cs @@ -0,0 +1,16 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace KE.GlobalEventFramework.Examples.API +{ + public class Malfunction + { + public static Malfunction Instance = new Malfunction(); + private Malfunction() { } + + + } +} diff --git a/KruacentExiled/KE.GlobalEventFramework.Examples/GE/SystemMalfunction.cs b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/SystemMalfunction.cs index 9ee3d98a..f053d3c8 100644 --- a/KruacentExiled/KE.GlobalEventFramework.Examples/GE/SystemMalfunction.cs +++ b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/SystemMalfunction.cs @@ -10,6 +10,11 @@ using Exiled.API.Extensions; using KE.GlobalEventFramework.GEFE.API.Interfaces; using System; +using Exiled.Events.EventArgs.Player; +using System.Security.Policy; +using PlayerRoles; +using Utils.NonAllocLINQ; +using KeycardPermissions = Exiled.API.Enums.KeycardPermissions; namespace KE.GlobalEventFramework.Examples.GE { @@ -22,7 +27,7 @@ namespace KE.GlobalEventFramework.Examples.GE /// Checkpoints can open randomly /// ///
- public class SystemMalfunction : GlobalEvent,IStart,IEvent + public class SystemMalfunction : GlobalEvent, IStart, IEvent { /// public override uint Id { get; set; } = 1041; @@ -32,21 +37,29 @@ public class SystemMalfunction : GlobalEvent,IStart,IEvent public override string Description { get; set; } = "On dirait que les systèmes informatiques sont défaillants"; /// public override int Weight { get; set; } = 1; + public override uint[] IncompatibleGE { get; set; } = { 38 }; /// /// Set the cooldown for the BlackoutNDoor /// public int NewCooldown { get; set; } = 180; - - public override uint[] IncompatibleGE { get; set; } = { 38 }; private BlackoutNDoor.MainPlugin BlackoutNDoor = null; + public sbyte Malfunction { get; private set; } = 15; + public sbyte MalfunctionAdd { get; set; } = 1; + + private bool[] CassieVoiceLine = new[] {true, true , true , true , true }; + public bool CassieYapYap { get; private set; } = false; + private Dictionary doorkeys = Door.List.ToDictionary(d => d, d=> d.KeycardPermissions); + + /// public IEnumerator Start() { Log.Debug("system malfunction start"); - MoreBlackOutNDoors(); - Coroutine.LaunchCoroutine(EarlyNuke()); - + //MoreBlackOutNDoors(); + //Coroutine.LaunchCoroutine(EarlyNuke()); + Coroutine.LaunchCoroutine(Tick()); CoroutineHandle handle; + while(Round.InProgress){ Log.Debug("system malfunction"); yield return Timing.WaitForSeconds(UnityEngine.Random.Range(200, 300)); @@ -55,11 +68,166 @@ public IEnumerator Start() yield return Timing.WaitUntilDone(handle); } - + } + + private IEnumerator Tick() + { + Log.Debug("in tick"); + while (Round.InProgress) + { + Log.Debug($"Malfunction={Malfunction}"); + CassieVoice(Malfunction); + yield return Timing.WaitForSeconds(5);//60 + Malfunction += MalfunctionAdd; + Malfunction += AdditionnalMalfunction(); + + } + yield return 0; + } + + private void CassieVoice(sbyte malfunction) + { + if(malfunction <= 0 && (CassieVoiceLine[0] || CassieYapYap )) + { + Cassie.MessageTranslated("Malfunctions back to more stable levels", + "Malfunctions back to more stable levels", false, false); + CassieVoiceLine[0] = false; + return; + } + + //force decontamination + if(malfunction >= 25 && (CassieVoiceLine[1] || CassieYapYap) && !Map.IsLczDecontaminated && Map.IsDecontaminationEnabled) + { + string msg = "Malfunctions levels above . 25 percent . . decontamination of Light Containment Zone in . 30 seconds"; + Cassie.MessageTranslated(msg, + "Malfunctions levels above 25%, decontamination of Light Containment Zone in 30 seconds", false, false); + CassieVoiceLine[1] = false; + Door.List.ToList().ForEach(d => + { + if (d.Zone == ZoneType.LightContainment) + { + if (!d.IsElevator) + { + d.ChangeLock(DoorLockType.DecontEvacuate); + d.IsOpen = true; + } + + } + }); + Timing.CallDelayed(30+Cassie.CalculateDuration(msg), () => + { + Map.StartDecontamination(); + Door.List.ToList().ForEach(d => + { + if(d.Type == DoorType.ElevatorLczA || d.Type == DoorType.ElevatorLczB) + d.DoorLockType = DoorLockType.DecontLockdown; + }); + }); + return; + } + + //remove the lock on every doors + if (malfunction >= 50 && (CassieVoiceLine[2] || CassieYapYap)) + { + CassieVoiceLine[2] = false; + Cassie.MessageTranslated("Malfunctions levels above . 50 percent . . terminating all door locks", + "Malfunctions levels above 50 percent, terminating all door locks", false, false); + Door.List.ToList().ForEach(d => + { + if (d.IsKeycardDoor) + d.KeycardPermissions = KeycardPermissions.None; + + }); + return; + } + + //reput the locks + if(malfunction < 40 && (CassieVoiceLine[3] || CassieYapYap)) + { + CassieVoiceLine[3] = false; + doorkeys.ForEach(dk => + { + dk.Key.KeycardPermissions = dk.Value; + }); + + return; + } + + //nuke + if (malfunction >= 90) + { + if ((CassieVoiceLine[4] || CassieYapYap)) + { + CassieVoiceLine[4] = false; + string msg = "Malfunctions levels above . 90 percent . . starting emergency warhead"; + Cassie.MessageTranslated(msg, + "Malfunctions levels above 90%, starting emergency warhead", false, false); + } + Warhead.Start(); + Warhead.IsLocked = true; + Timing.RunCoroutine(CheckNuke()); + return; + } + + } + private IEnumerator CheckNuke() + { + while (Warhead.IsInProgress) + { + yield return Timing.WaitForSeconds(5); + if (Malfunction <= 85) + { + Log.Debug($"Malfunction low enough ({Malfunction}) disabling the nuke"); + Warhead.Stop(); + Warhead.IsLocked = false; + break; + } + } } + + private sbyte AdditionnalMalfunction() + { + sbyte result = 0; + //generator reduce the malfunction + result -= (sbyte) (Generator.List.Count(x => x.IsEngaged)*3); + //number of scp increase 3 (except zombies) + result += (sbyte) (Player.List.Count(p => p.Role.Side == Side.Scp && p.Role != RoleTypeId.Scp0492) * 3); + //number of zombies increase 1 + result += (sbyte)Player.List.Count(p => p.Role == RoleTypeId.Scp0492); + + + return result; + + } + + + private void OnDying(DyingEventArgs ev) + { + switch (ev.Player.Role.Side) + { + case Side.Mtf: + Malfunction += 1; + break; + case Side.ChaosInsurgency : + Malfunction -= 1; + break; + case Side.Scp: + if(ev.Player.Role != RoleTypeId.Scp0492) + Malfunction -= 10; + else Malfunction -= 1; + break; + } + } + + public void SubscribeEvent() { + + Exiled.Events.Handlers.Player.Dying += OnDying; + //revice zombie add malfunction levle + + //Searching for the plugin var otherPlugin = Exiled.Loader.Loader.Plugins.FirstOrDefault(plugin => plugin.Name == "KE.BlackoutDoor"); if (otherPlugin != null) @@ -77,6 +245,7 @@ public void SubscribeEvent() public void UnsubscribeEvent() { BlackoutNDoor = null; + Exiled.Events.Handlers.Player.Dying -= OnDying; } private IEnumerator EarlyNuke() From e46099e6920c3ab9d7eb807a722ae82ff42a45fc Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Wed, 22 Jan 2025 15:06:29 +0100 Subject: [PATCH 120/853] changed the default refresh reat --- KruacentExiled/KE.Items/Config.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/KruacentExiled/KE.Items/Config.cs b/KruacentExiled/KE.Items/Config.cs index 09794be7..51a7f302 100644 --- a/KruacentExiled/KE.Items/Config.cs +++ b/KruacentExiled/KE.Items/Config.cs @@ -11,6 +11,6 @@ public class Config : IConfig { public bool IsEnabled { get; set; } = true; public bool Debug { get; set; } = true; - public float RefreshRate { get; set; } = .5f; + public float RefreshRate { get; set; } = .01f; } } From 7484d6ace254a4269e324fbde0409dee928f9d65 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Wed, 22 Jan 2025 18:58:43 +0100 Subject: [PATCH 121/853] removed the scp-3114 --- KruacentExiled/KE.Misc/914.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/KruacentExiled/KE.Misc/914.cs b/KruacentExiled/KE.Misc/914.cs index b70b8dba..1a5c4b1f 100644 --- a/KruacentExiled/KE.Misc/914.cs +++ b/KruacentExiled/KE.Misc/914.cs @@ -28,7 +28,7 @@ internal class _914 { 3, RoleTypeId.Scp106 }, { 2, RoleTypeId.Scp173 }, - { 1, RoleTypeId.Scp3114}, + { 1, RoleTypeId.Scp096}, }; internal void OnUpgradingPlayer(UpgradingPlayerEventArgs ev) From 7bce7b7506c88bb85fcd7989ae13267cd12fab7c Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Wed, 22 Jan 2025 19:07:54 +0100 Subject: [PATCH 122/853] added the peanut buff #67 --- KruacentExiled/KE.Misc/MainPlugin.cs | 3 + KruacentExiled/KE.Misc/SCPBuff.cs | 89 ++++++++++++++++++++++++++++ 2 files changed, 92 insertions(+) create mode 100644 KruacentExiled/KE.Misc/SCPBuff.cs diff --git a/KruacentExiled/KE.Misc/MainPlugin.cs b/KruacentExiled/KE.Misc/MainPlugin.cs index f689177c..5a548011 100644 --- a/KruacentExiled/KE.Misc/MainPlugin.cs +++ b/KruacentExiled/KE.Misc/MainPlugin.cs @@ -24,6 +24,7 @@ public class MainPlugin : Plugin internal AutoElevator AutoElevator { get; private set; } internal ClassDDoor ClassDDoor { get; private set; } internal Candy Candy { get; private set; } + internal SCPBuff SCPBuff { get; private set; } public override void OnEnabled() { @@ -43,6 +44,7 @@ public override void OnEnabled() } Respawn.SetTokens(SpawnableFaction.NtfWave, 2); Respawn.SetTokens(SpawnableFaction.ChaosWave, 2); + SCPBuff = new SCPBuff(); ServerHandle.RoundStarted += ServerHandler.OnRoundStarted; Nine14Handle.UpgradingPlayer += _914.OnUpgradingPlayer; @@ -68,6 +70,7 @@ public override void OnDisabled() _914 = null; ClassDDoor = null; ServerHandler = null; + SCPBuff = null; AutoElevator = null; Instance = null; } diff --git a/KruacentExiled/KE.Misc/SCPBuff.cs b/KruacentExiled/KE.Misc/SCPBuff.cs new file mode 100644 index 00000000..8002264c --- /dev/null +++ b/KruacentExiled/KE.Misc/SCPBuff.cs @@ -0,0 +1,89 @@ +using Exiled.API.Features; +using Exiled.Permissions.Commands.Permissions; +using MEC; +using PlayerRoles; +using System.Collections.Generic; +using System.Linq; +using UnityEngine; + +namespace KE.Misc +{ + internal class SCPBuff + { + internal const float RefreshRate = 1f; + internal SCPBuff() + { + Timing.RunCoroutine(PeanutShield()); + } + + + private IEnumerator PeanutShield() + { + while (Round.InProgress) + { + List peanuts = Player.List.Where(p => p.Role == RoleTypeId.Scp173).ToList(); + peanuts.ForEach(p => + { + AddHumeShield(p, CheckPlayerAround(p,4)); + }); + yield return Timing.WaitForSeconds(RefreshRate); + } + } + + + /// + /// Count the number of player around + /// + /// The Player (the peanut) to check around them + /// + /// + /// + private int CheckPlayerAround(Player p, float radius, bool countFriendly = false) + { + int result = 0; + foreach (Player player in Player.List) + { + if (player == p) continue; + if (player.Role.Side == p.Role.Side && !countFriendly) continue; + if (IsPlayerInZone(player, p.Position, radius, radius)) + result++; + } + return result; + } + + + private bool IsPlayerInZone(Player player, Vector3 zonePosition, float radius, float height) + { + // Calculate the horizontal distance (x, z) + float horizontalDistance = Vector3.Distance( + new Vector3(player.Position.x, 0, player.Position.z), + new Vector3(zonePosition.x, 0, zonePosition.z) + ); + + // Calculate the vertical difference (y) + float verticalDifference = Mathf.Abs(player.Position.y - zonePosition.y); + + // Check if the player is in the 3d zone. + return horizontalDistance <= (radius / 2) && verticalDifference <= (height / 2); + } + + + /// + /// Add HumeShield to a player + /// + /// + /// + /// true if it's not over the max HumeShield of the player; false otherwise + private bool AddHumeShield(Player p, float hum) + { + float max = p.HumeShieldStat.MaxValue; + if (max < hum + p.HumeShield) + { + p.HumeShield = max; + return false; + } + p.HumeShield += hum; + return true; + } + } +} From 328693c61b70a1fdfe102fa0c8c316502416aac5 Mon Sep 17 00:00:00 2001 From: Omer <113857370+OmerGS@users.noreply.github.com> Date: Thu, 23 Jan 2025 10:08:24 +0100 Subject: [PATCH 123/853] add/GE:CassieGoCrazy --- .../GE/CassieGoCrazy.cs | 160 ++++++++++++++++++ 1 file changed, 160 insertions(+) create mode 100644 KruacentExiled/KE.GlobalEventFramework.Examples/GE/CassieGoCrazy.cs diff --git a/KruacentExiled/KE.GlobalEventFramework.Examples/GE/CassieGoCrazy.cs b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/CassieGoCrazy.cs new file mode 100644 index 00000000..9b60da05 --- /dev/null +++ b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/CassieGoCrazy.cs @@ -0,0 +1,160 @@ +using Exiled.API.Features; +using Exiled.API.Features.Doors; +using Exiled.API.Features.Items; +using Exiled.Events.EventArgs.Player; +using KE.GlobalEventFramework.GEFE.API.Features; +using KE.GlobalEventFramework.GEFE.API.Interfaces; +using MEC; +using PlayerRoles; +using System.Collections.Generic; +using System.Linq; + +namespace KE.GlobalEventFramework.Examples.GE +{ + /// + /// Spawn fused grenades in random rooms in the map + /// + public class CassieGoCrazy : GlobalEvent, IStart + { + /// + public override uint Id { get; set; } = 1059; + /// + public override string Name { get; set; } = "Cassie Go Crazy"; + /// + public override string Description { get; set; } = "Crazy Cassie !"; + /// + public override int Weight { get; set; } = 1; + + /// + /// The cooldown between 2 cassie event + /// + public int Cooldown { get; set; } = 280; + + /// + /// Percentage for rare event to occur + /// + public int RareEvent { get; set; } = 7; + + /// + /// Starts a coroutine to perform random actions during the game. + /// + /// A coroutine that runs until the game round ends. + /// + public IEnumerator Start() + { + while (!Round.IsEnded) + { + Log.Debug("waiting"); + yield return Timing.WaitForSeconds(Cooldown); + + int action = UnityEngine.Random.Range(1, 6); + + switch (action) + { + // Turns off the lights in the Heavy Containment zone. + case 1: + Map.TurnOffAllLights(20, Exiled.API.Enums.ZoneType.HeavyContainment); + break; + + // Starting the Warhead + case 2: + Warhead.Start(); + break; + + // Change Map Color to Cyan + case 3: + Map.ChangeLightsColor(UnityEngine.Color.cyan); + break; + + // Sad Cassie scenario. + case 4: + Cassie.Message("I wanna just be useful", true, true, true); + Map.TurnOffAllLights(2, Exiled.API.Enums.ZoneType.HeavyContainment); + Map.TurnOffAllLights(2, Exiled.API.Enums.ZoneType.Entrance); + yield return Timing.WaitForSeconds(3); + Map.TurnOffAllLights(2, Exiled.API.Enums.ZoneType.HeavyContainment); + Map.TurnOffAllLights(2, Exiled.API.Enums.ZoneType.Entrance); + + Warhead.Start(); + + for (int i = 0; i < 10; i++) + { + ((ExplosiveGrenade)Item.Create(ItemType.GrenadeHE)).SpawnActive(Room.Random().Position); + } + + yield return Timing.WaitForSeconds(20); + Warhead.Stop(); + + + break; + + // Antagonistic Cassie scenario. + case 5: + List nonScpPlayers = Player.List.Where(player => !player.IsScp).ToList(); + + if (nonScpPlayers.Count > 0) + { + Player target = nonScpPlayers[UnityEngine.Random.Range(0, nonScpPlayers.Count)]; + + Cassie.Message("New target : " + target); + + void OnPlayerDeath(DyingEventArgs ev) + { + if (ev.Player == target && ev.Attacker != null && ev.Attacker != target) + { + if (!ev.Attacker.IsScp) + { + GiveRandomRewardPlayer(ev.Attacker); + } else + { + if(ev.Attacker.Role == RoleTypeId.Scp0492) + { + Item item = Item.Create(ItemType.Jailbird); + ev.Attacker.AddItem(item); + ev.Attacker.CurrentItem = item; + } + } + + Exiled.Events.Handlers.Player.Dying -= OnPlayerDeath; + } + } + + Exiled.Events.Handlers.Player.Dying += OnPlayerDeath; + } + break; + } + + /// + /// Gives a random reward to the player who killed the target. + /// + /// The player who will receive the reward. + /// + void GiveRandomRewardPlayer(Player player) + { + var items = new List + { + ItemType.Jailbird, + ItemType.ParticleDisruptor, + ItemType.MicroHID, + ItemType.Coin, + ItemType.KeycardO5, + ItemType.SCP268 + }; + + ItemType randomItem = items[UnityEngine.Random.Range(0, items.Count)]; + + player.AddItem(randomItem); + + if (UnityEngine.Random.Range(0, 100) < RareEvent) + { + player.MaxHealth = 150; + player.Broadcast(5, "Another gift for you !"); + } + } + + + } + } + + } +} From 60fdd69b55755b4eba5674d26f83700b866896e3 Mon Sep 17 00:00:00 2001 From: Omer <113857370+OmerGS@users.noreply.github.com> Date: Thu, 23 Jan 2025 13:07:47 +0100 Subject: [PATCH 124/853] add/GE BrokenGenerator --- .../GE/BrokenGenerator.cs | 65 +++++++++++++++++++ 1 file changed, 65 insertions(+) create mode 100644 KruacentExiled/KE.GlobalEventFramework.Examples/GE/BrokenGenerator.cs diff --git a/KruacentExiled/KE.GlobalEventFramework.Examples/GE/BrokenGenerator.cs b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/BrokenGenerator.cs new file mode 100644 index 00000000..22fb0443 --- /dev/null +++ b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/BrokenGenerator.cs @@ -0,0 +1,65 @@ +using Player = Exiled.API.Features.Player; +using System.Collections.Generic; +using KE.GlobalEventFramework.GEFE.API.Features; +using KE.GlobalEventFramework.GEFE.API.Interfaces; +using MEC; +using Exiled.API.Features; +using Exiled.API.Enums; +using Exiled.API.Features.Doors; +using Exiled.Events.EventArgs.Map; +using System.Linq; +using System.Drawing.Imaging; + +namespace KE.GlobalEventFramework.Examples.GE +{ + public class BrokenGenerator : GlobalEvent, IStart + { + public override uint Id { get; set; } = 1051; + public override string Name { get; set; } = "Broken Generator"; + public override string Description { get; set; } = "Repair the generator to be able to see !"; + public override int Weight { get; set; } = 1; + + public List zones = new List + { + ZoneType.LightContainment, + ZoneType.HeavyContainment, + ZoneType.Entrance, + ZoneType.Surface, + ZoneType.Pocket + }; + + public IEnumerator Start() + { + zones.ForEach(zone => Map.TurnOffAllLights(99999999, zone)); + + foreach (Player player in Player.List) + { + if (player.IsHuman) + { + player.AddItem(ItemType.Flashlight); + } + } + + yield return 0; + } + + public void SubscribeEvent() + { + Exiled.Events.Handlers.Map.GeneratorActivating += GenActivate; + } + + public void UnsubscribeEvent() + { + Exiled.Events.Handlers.Map.GeneratorActivating -= GenActivate; + } + + public void GenActivate(GeneratorActivatingEventArgs ev) + { + if (Generator.List.Where(g => g.IsEngaged).Count() == 3) + { + Map.TurnOnAllLights(zones); + } + } + + } +} \ No newline at end of file From 012b8988dd30eb6da310017a76839abbafe5b269 Mon Sep 17 00:00:00 2001 From: Omer <113857370+OmerGS@users.noreply.github.com> Date: Thu, 23 Jan 2025 17:32:41 +0100 Subject: [PATCH 125/853] fix/reward --- .../GE/CassieGoCrazy.cs | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/KruacentExiled/KE.GlobalEventFramework.Examples/GE/CassieGoCrazy.cs b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/CassieGoCrazy.cs index 9b60da05..c6fc7967 100644 --- a/KruacentExiled/KE.GlobalEventFramework.Examples/GE/CassieGoCrazy.cs +++ b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/CassieGoCrazy.cs @@ -1,11 +1,9 @@ using Exiled.API.Features; -using Exiled.API.Features.Doors; using Exiled.API.Features.Items; using Exiled.Events.EventArgs.Player; using KE.GlobalEventFramework.GEFE.API.Features; using KE.GlobalEventFramework.GEFE.API.Interfaces; using MEC; -using PlayerRoles; using System.Collections.Generic; using System.Linq; @@ -105,14 +103,6 @@ void OnPlayerDeath(DyingEventArgs ev) if (!ev.Attacker.IsScp) { GiveRandomRewardPlayer(ev.Attacker); - } else - { - if(ev.Attacker.Role == RoleTypeId.Scp0492) - { - Item item = Item.Create(ItemType.Jailbird); - ev.Attacker.AddItem(item); - ev.Attacker.CurrentItem = item; - } } Exiled.Events.Handlers.Player.Dying -= OnPlayerDeath; @@ -147,7 +137,7 @@ void GiveRandomRewardPlayer(Player player) if (UnityEngine.Random.Range(0, 100) < RareEvent) { - player.MaxHealth = 150; + player.MaxHealth = 125; player.Broadcast(5, "Another gift for you !"); } } From 09426ca138795a3d576d62cc40fc86fe9e653032 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Thu, 23 Jan 2025 18:29:34 +0100 Subject: [PATCH 126/853] corrected the nuke --- .../GE/SystemMalfunction.cs | 61 +++++++++++++------ .../KE.GlobalEventFramework.Examples.csproj | 6 +- 2 files changed, 45 insertions(+), 22 deletions(-) diff --git a/KruacentExiled/KE.GlobalEventFramework.Examples/GE/SystemMalfunction.cs b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/SystemMalfunction.cs index f053d3c8..ef46a618 100644 --- a/KruacentExiled/KE.GlobalEventFramework.Examples/GE/SystemMalfunction.cs +++ b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/SystemMalfunction.cs @@ -15,6 +15,7 @@ using PlayerRoles; using Utils.NonAllocLINQ; using KeycardPermissions = Exiled.API.Enums.KeycardPermissions; +using Exiled.Events.EventArgs.Scp049; namespace KE.GlobalEventFramework.Examples.GE { @@ -43,12 +44,23 @@ public class SystemMalfunction : GlobalEvent, IStart, IEvent ///
public int NewCooldown { get; set; } = 180; private BlackoutNDoor.MainPlugin BlackoutNDoor = null; - public sbyte Malfunction { get; private set; } = 15; + private sbyte _malfunction = 15; + public sbyte Malfunction + { + get { return _malfunction; } + private set + { + if (value > 125) _malfunction = 125; + else if (value < -50) _malfunction = 50; + else _malfunction = value; + } + } public sbyte MalfunctionAdd { get; set; } = 1; private bool[] CassieVoiceLine = new[] {true, true , true , true , true }; public bool CassieYapYap { get; private set; } = false; private Dictionary doorkeys = Door.List.ToDictionary(d => d, d=> d.KeycardPermissions); + private CoroutineHandle _checkNuke; /// @@ -66,8 +78,8 @@ public IEnumerator Start() List> l = new []{CheckpointMalfunction(),GateLockdown(),ElevatorLockdown()}.ToList(); handle = Coroutine.LaunchCoroutine(l[UnityEngine.Random.Range(0,3)]); yield return Timing.WaitUntilDone(handle); - } + yield return 0; } private IEnumerator Tick() @@ -77,12 +89,10 @@ private IEnumerator Tick() { Log.Debug($"Malfunction={Malfunction}"); CassieVoice(Malfunction); - yield return Timing.WaitForSeconds(5);//60 + yield return Timing.WaitForSeconds(60); Malfunction += MalfunctionAdd; Malfunction += AdditionnalMalfunction(); - } - yield return 0; } private void CassieVoice(sbyte malfunction) @@ -117,10 +127,14 @@ private void CassieVoice(sbyte malfunction) Timing.CallDelayed(30+Cassie.CalculateDuration(msg), () => { Map.StartDecontamination(); + Door.List.ToList().ForEach(d => { - if(d.Type == DoorType.ElevatorLczA || d.Type == DoorType.ElevatorLczB) - d.DoorLockType = DoorLockType.DecontLockdown; + if(d.IsElevator && (d.Type == DoorType.ElevatorLczA || d.Type == DoorType.ElevatorLczB)) + { + d.Lock(DoorLockType.DecontEvacuate); + d.IsOpen = false; + } }); }); return; @@ -156,16 +170,21 @@ private void CassieVoice(sbyte malfunction) //nuke if (malfunction >= 90) { - if ((CassieVoiceLine[4] || CassieYapYap)) + if (CassieVoiceLine[4] || CassieYapYap) { CassieVoiceLine[4] = false; string msg = "Malfunctions levels above . 90 percent . . starting emergency warhead"; Cassie.MessageTranslated(msg, "Malfunctions levels above 90%, starting emergency warhead", false, false); } - Warhead.Start(); - Warhead.IsLocked = true; - Timing.RunCoroutine(CheckNuke()); + + if (!Warhead.IsInProgress) + { + Warhead.Start(); + Warhead.IsLocked = true; + Timing.KillCoroutines(_checkNuke); + _checkNuke = Timing.RunCoroutine(CheckNuke()); + } return; } @@ -176,11 +195,12 @@ private IEnumerator CheckNuke() while (Warhead.IsInProgress) { yield return Timing.WaitForSeconds(5); + Log.Debug("check nuke : "+Malfunction); if (Malfunction <= 85) { Log.Debug($"Malfunction low enough ({Malfunction}) disabling the nuke"); - Warhead.Stop(); Warhead.IsLocked = false; + Warhead.Stop(); break; } } @@ -188,15 +208,13 @@ private IEnumerator CheckNuke() private sbyte AdditionnalMalfunction() { - sbyte result = 0; + sbyte result = (sbyte) UnityEngine.Random.Range(-2,3); //generator reduce the malfunction result -= (sbyte) (Generator.List.Count(x => x.IsEngaged)*3); //number of scp increase 3 (except zombies) result += (sbyte) (Player.List.Count(p => p.Role.Side == Side.Scp && p.Role != RoleTypeId.Scp0492) * 3); //number of zombies increase 1 result += (sbyte)Player.List.Count(p => p.Role == RoleTypeId.Scp0492); - - return result; } @@ -213,19 +231,23 @@ private void OnDying(DyingEventArgs ev) Malfunction -= 1; break; case Side.Scp: - if(ev.Player.Role != RoleTypeId.Scp0492) - Malfunction -= 10; + if(ev.Player.Role != RoleTypeId.Scp0492) Malfunction -= 10; else Malfunction -= 1; break; } } + private void OnFinishingRevive(FinishingRecallEventArgs ev) + { + Malfunction += 3; + } + public void SubscribeEvent() { Exiled.Events.Handlers.Player.Dying += OnDying; - //revice zombie add malfunction levle + Exiled.Events.Handlers.Scp049.FinishingRecall += OnFinishingRevive; //Searching for the plugin @@ -246,6 +268,7 @@ public void UnsubscribeEvent() { BlackoutNDoor = null; Exiled.Events.Handlers.Player.Dying -= OnDying; + Exiled.Events.Handlers.Scp049.FinishingRecall -= OnFinishingRevive; } private IEnumerator EarlyNuke() @@ -288,7 +311,7 @@ private IEnumerator GateLockdown(){ Log.Debug("GateLockdown"); var gates = Door.List.Where(d => d.Type == DoorType.GateA ||d.Type == DoorType.GateB); var gate = gates.GetRandomValue(); - gate.IsOpen = false; + gate.IsOpen = UnityEngine.Random.value <= .5f ? false : true ; var timelock = UnityEngine.Random.Range(10,30); gate.Lock(timelock,DoorLockType.Isolation); yield return Timing.WaitForSeconds(timelock); diff --git a/KruacentExiled/KE.GlobalEventFramework.Examples/KE.GlobalEventFramework.Examples.csproj b/KruacentExiled/KE.GlobalEventFramework.Examples/KE.GlobalEventFramework.Examples.csproj index fec6f9e1..807ac74f 100644 --- a/KruacentExiled/KE.GlobalEventFramework.Examples/KE.GlobalEventFramework.Examples.csproj +++ b/KruacentExiled/KE.GlobalEventFramework.Examples/KE.GlobalEventFramework.Examples.csproj @@ -5,12 +5,12 @@ - + - - + + From 7e4e4786cc81ea7b66f10ee2d7bc05c7322434bf Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Thu, 23 Jan 2025 19:13:41 +0100 Subject: [PATCH 127/853] implemented malfunction --- .../API/Malfunction.cs | 16 -- .../API/Malfunctions.cs | 206 ++++++++++++++++++ .../GE/SystemMalfunction.cs | 192 +--------------- 3 files changed, 216 insertions(+), 198 deletions(-) delete mode 100644 KruacentExiled/KE.GlobalEventFramework.Examples/API/Malfunction.cs create mode 100644 KruacentExiled/KE.GlobalEventFramework.Examples/API/Malfunctions.cs diff --git a/KruacentExiled/KE.GlobalEventFramework.Examples/API/Malfunction.cs b/KruacentExiled/KE.GlobalEventFramework.Examples/API/Malfunction.cs deleted file mode 100644 index 2d75341f..00000000 --- a/KruacentExiled/KE.GlobalEventFramework.Examples/API/Malfunction.cs +++ /dev/null @@ -1,16 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace KE.GlobalEventFramework.Examples.API -{ - public class Malfunction - { - public static Malfunction Instance = new Malfunction(); - private Malfunction() { } - - - } -} diff --git a/KruacentExiled/KE.GlobalEventFramework.Examples/API/Malfunctions.cs b/KruacentExiled/KE.GlobalEventFramework.Examples/API/Malfunctions.cs new file mode 100644 index 00000000..b99cbadf --- /dev/null +++ b/KruacentExiled/KE.GlobalEventFramework.Examples/API/Malfunctions.cs @@ -0,0 +1,206 @@ +using Exiled.API.Enums; +using Exiled.API.Features; +using Exiled.API.Features.Doors; +using Exiled.Events.EventArgs.Player; +using Exiled.Events.EventArgs.Scp049; +using MEC; +using PlayerRoles; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Utils.NonAllocLINQ; + +namespace KE.GlobalEventFramework.Examples.API +{ + public class Malfunctions + { + + private sbyte _malfunction = 15; + public sbyte Malfunction + { + get { return _malfunction; } + private set + { + if (value > 125) _malfunction = 125; + else if (value < -50) _malfunction = -50; + else _malfunction = value; + } + } + public sbyte MalfunctionAdd { get; set; } = 1; + + private bool[] CassieVoiceLine = new[] { true, true, true, true, true }; + public bool CassieYapYap { get; private set; } = false; + private Dictionary doorkeys = Door.List.ToDictionary(d => d, d => d.KeycardPermissions); + private CoroutineHandle _checkNuke; + internal Malfunctions() { } + + + + internal IEnumerator Tick() + { + Log.Debug("in tick"); + while (Round.InProgress) + { + Log.Debug($"Malfunction={Malfunction}"); + CassieVoice(Malfunction); + yield return Timing.WaitForSeconds(60); + Malfunction += MalfunctionAdd; + Malfunction += AdditionnalMalfunction(); + } + } + + + private void CassieVoice(sbyte malfunction) + { + if (malfunction <= 0 && (CassieVoiceLine[0] || CassieYapYap)) + { + Cassie.MessageTranslated("Malfunctions back to more stable levels", + "Malfunctions back to more stable levels", false, false); + CassieVoiceLine[0] = false; + return; + } + + //force decontamination + if (malfunction >= 25 && (CassieVoiceLine[1] || CassieYapYap) && !Map.IsLczDecontaminated && Map.IsDecontaminationEnabled) + { + string msg = "Malfunctions levels above . 25 percent . . decontamination of Light Containment Zone in . 30 seconds"; + Cassie.MessageTranslated(msg, + "Malfunctions levels above 25%, decontamination of Light Containment Zone in 30 seconds", false, false); + CassieVoiceLine[1] = false; + Door.List.ToList().ForEach(d => + { + if (d.Zone == ZoneType.LightContainment) + { + if (!d.IsElevator) + { + d.ChangeLock(DoorLockType.DecontEvacuate); + d.IsOpen = true; + } + + } + }); + Timing.CallDelayed(30 + Cassie.CalculateDuration(msg), () => + { + Map.StartDecontamination(); + + Door.List.ToList().ForEach(d => + { + if (d.IsElevator && (d.Type == DoorType.ElevatorLczA || d.Type == DoorType.ElevatorLczB)) + { + d.Lock(DoorLockType.DecontEvacuate); + d.IsOpen = false; + } + }); + }); + return; + } + + //remove the lock on every doors + if (malfunction >= 50 && (CassieVoiceLine[2] || CassieYapYap)) + { + CassieVoiceLine[2] = false; + Cassie.MessageTranslated("Malfunctions levels above . 50 percent . . terminating all door locks", + "Malfunctions levels above 50 percent, terminating all door locks", false, false); + Door.List.ToList().ForEach(d => + { + if (d.IsKeycardDoor) + d.KeycardPermissions = KeycardPermissions.None; + + }); + return; + } + + //reput the locks + if (malfunction < 40 && (CassieVoiceLine[3] || CassieYapYap)) + { + CassieVoiceLine[3] = false; + doorkeys.ForEach(dk => + { + dk.Key.KeycardPermissions = dk.Value; + }); + + return; + } + + //nuke + if (malfunction >= 90) + { + if (CassieVoiceLine[4] || CassieYapYap) + { + CassieVoiceLine[4] = false; + string msg = "Malfunctions levels above . 90 percent . . starting emergency warhead"; + Cassie.MessageTranslated(msg, + "Malfunctions levels above 90%, starting emergency warhead", false, false); + } + + if (!Warhead.IsInProgress) + { + Warhead.Start(); + Warhead.IsLocked = true; + Timing.KillCoroutines(_checkNuke); + _checkNuke = Timing.RunCoroutine(CheckNuke()); + } + return; + } + + } + + private IEnumerator CheckNuke() + { + while (Warhead.IsInProgress) + { + yield return Timing.WaitForSeconds(5); + Log.Debug("check nuke : " + Malfunction); + if (Malfunction <= 85) + { + Log.Debug($"Malfunction low enough ({Malfunction}) disabling the nuke"); + Warhead.IsLocked = false; + Warhead.Stop(); + break; + } + } + } + + private sbyte AdditionnalMalfunction() + { + sbyte result = (sbyte)UnityEngine.Random.Range(-2, 3); + //generator reduce the malfunction + result -= (sbyte)(Generator.List.Count(x => x.IsEngaged) * 3); + //number of scp increase 3 (except zombies) + result += (sbyte)(Player.List.Count(p => p.Role.Side == Side.Scp && p.Role != RoleTypeId.Scp0492) * 3); + //number of zombies increase 1 + result += (sbyte)Player.List.Count(p => p.Role == RoleTypeId.Scp0492); + return result; + + } + + + internal void OnDying(DyingEventArgs ev) + { + switch (ev.Player.Role.Side) + { + case Side.Mtf: + Malfunction += 1; + break; + case Side.ChaosInsurgency: + Malfunction -= 1; + break; + case Side.Scp: + if (ev.Player.Role != RoleTypeId.Scp0492) Malfunction -= 10; + else Malfunction -= 1; + break; + } + } + + internal void OnFinishingRevive(FinishingRecallEventArgs ev) + { + Malfunction += 3; + } + + + + + } +} diff --git a/KruacentExiled/KE.GlobalEventFramework.Examples/GE/SystemMalfunction.cs b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/SystemMalfunction.cs index ef46a618..850c54cd 100644 --- a/KruacentExiled/KE.GlobalEventFramework.Examples/GE/SystemMalfunction.cs +++ b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/SystemMalfunction.cs @@ -16,6 +16,7 @@ using Utils.NonAllocLINQ; using KeycardPermissions = Exiled.API.Enums.KeycardPermissions; using Exiled.Events.EventArgs.Scp049; +using KE.GlobalEventFramework.Examples.API; namespace KE.GlobalEventFramework.Examples.GE { @@ -38,29 +39,15 @@ public class SystemMalfunction : GlobalEvent, IStart, IEvent public override string Description { get; set; } = "On dirait que les systèmes informatiques sont défaillants"; /// public override int Weight { get; set; } = 1; + /// public override uint[] IncompatibleGE { get; set; } = { 38 }; /// /// Set the cooldown for the BlackoutNDoor /// public int NewCooldown { get; set; } = 180; private BlackoutNDoor.MainPlugin BlackoutNDoor = null; - private sbyte _malfunction = 15; - public sbyte Malfunction - { - get { return _malfunction; } - private set - { - if (value > 125) _malfunction = 125; - else if (value < -50) _malfunction = 50; - else _malfunction = value; - } - } - public sbyte MalfunctionAdd { get; set; } = 1; - - private bool[] CassieVoiceLine = new[] {true, true , true , true , true }; - public bool CassieYapYap { get; private set; } = false; - private Dictionary doorkeys = Door.List.ToDictionary(d => d, d=> d.KeycardPermissions); - private CoroutineHandle _checkNuke; + private Malfunctions Malfunction; + /// @@ -69,7 +56,8 @@ public IEnumerator Start() Log.Debug("system malfunction start"); //MoreBlackOutNDoors(); //Coroutine.LaunchCoroutine(EarlyNuke()); - Coroutine.LaunchCoroutine(Tick()); + Malfunction = new Malfunctions(); + Coroutine.LaunchCoroutine(Malfunction.Tick()); CoroutineHandle handle; while(Round.InProgress){ @@ -82,172 +70,12 @@ public IEnumerator Start() yield return 0; } - private IEnumerator Tick() - { - Log.Debug("in tick"); - while (Round.InProgress) - { - Log.Debug($"Malfunction={Malfunction}"); - CassieVoice(Malfunction); - yield return Timing.WaitForSeconds(60); - Malfunction += MalfunctionAdd; - Malfunction += AdditionnalMalfunction(); - } - } - - private void CassieVoice(sbyte malfunction) - { - if(malfunction <= 0 && (CassieVoiceLine[0] || CassieYapYap )) - { - Cassie.MessageTranslated("Malfunctions back to more stable levels", - "Malfunctions back to more stable levels", false, false); - CassieVoiceLine[0] = false; - return; - } - - //force decontamination - if(malfunction >= 25 && (CassieVoiceLine[1] || CassieYapYap) && !Map.IsLczDecontaminated && Map.IsDecontaminationEnabled) - { - string msg = "Malfunctions levels above . 25 percent . . decontamination of Light Containment Zone in . 30 seconds"; - Cassie.MessageTranslated(msg, - "Malfunctions levels above 25%, decontamination of Light Containment Zone in 30 seconds", false, false); - CassieVoiceLine[1] = false; - Door.List.ToList().ForEach(d => - { - if (d.Zone == ZoneType.LightContainment) - { - if (!d.IsElevator) - { - d.ChangeLock(DoorLockType.DecontEvacuate); - d.IsOpen = true; - } - - } - }); - Timing.CallDelayed(30+Cassie.CalculateDuration(msg), () => - { - Map.StartDecontamination(); - - Door.List.ToList().ForEach(d => - { - if(d.IsElevator && (d.Type == DoorType.ElevatorLczA || d.Type == DoorType.ElevatorLczB)) - { - d.Lock(DoorLockType.DecontEvacuate); - d.IsOpen = false; - } - }); - }); - return; - } - - //remove the lock on every doors - if (malfunction >= 50 && (CassieVoiceLine[2] || CassieYapYap)) - { - CassieVoiceLine[2] = false; - Cassie.MessageTranslated("Malfunctions levels above . 50 percent . . terminating all door locks", - "Malfunctions levels above 50 percent, terminating all door locks", false, false); - Door.List.ToList().ForEach(d => - { - if (d.IsKeycardDoor) - d.KeycardPermissions = KeycardPermissions.None; - - }); - return; - } - - //reput the locks - if(malfunction < 40 && (CassieVoiceLine[3] || CassieYapYap)) - { - CassieVoiceLine[3] = false; - doorkeys.ForEach(dk => - { - dk.Key.KeycardPermissions = dk.Value; - }); - - return; - } - - //nuke - if (malfunction >= 90) - { - if (CassieVoiceLine[4] || CassieYapYap) - { - CassieVoiceLine[4] = false; - string msg = "Malfunctions levels above . 90 percent . . starting emergency warhead"; - Cassie.MessageTranslated(msg, - "Malfunctions levels above 90%, starting emergency warhead", false, false); - } - - if (!Warhead.IsInProgress) - { - Warhead.Start(); - Warhead.IsLocked = true; - Timing.KillCoroutines(_checkNuke); - _checkNuke = Timing.RunCoroutine(CheckNuke()); - } - return; - } - - } - - private IEnumerator CheckNuke() - { - while (Warhead.IsInProgress) - { - yield return Timing.WaitForSeconds(5); - Log.Debug("check nuke : "+Malfunction); - if (Malfunction <= 85) - { - Log.Debug($"Malfunction low enough ({Malfunction}) disabling the nuke"); - Warhead.IsLocked = false; - Warhead.Stop(); - break; - } - } - } - - private sbyte AdditionnalMalfunction() - { - sbyte result = (sbyte) UnityEngine.Random.Range(-2,3); - //generator reduce the malfunction - result -= (sbyte) (Generator.List.Count(x => x.IsEngaged)*3); - //number of scp increase 3 (except zombies) - result += (sbyte) (Player.List.Count(p => p.Role.Side == Side.Scp && p.Role != RoleTypeId.Scp0492) * 3); - //number of zombies increase 1 - result += (sbyte)Player.List.Count(p => p.Role == RoleTypeId.Scp0492); - return result; - - } - - - private void OnDying(DyingEventArgs ev) - { - switch (ev.Player.Role.Side) - { - case Side.Mtf: - Malfunction += 1; - break; - case Side.ChaosInsurgency : - Malfunction -= 1; - break; - case Side.Scp: - if(ev.Player.Role != RoleTypeId.Scp0492) Malfunction -= 10; - else Malfunction -= 1; - break; - } - } - - private void OnFinishingRevive(FinishingRecallEventArgs ev) - { - Malfunction += 3; - } - public void SubscribeEvent() { - Exiled.Events.Handlers.Player.Dying += OnDying; - Exiled.Events.Handlers.Scp049.FinishingRecall += OnFinishingRevive; + Exiled.Events.Handlers.Player.Dying += Malfunction.OnDying; + Exiled.Events.Handlers.Scp049.FinishingRecall += Malfunction.OnFinishingRevive; //Searching for the plugin @@ -267,8 +95,8 @@ public void SubscribeEvent() public void UnsubscribeEvent() { BlackoutNDoor = null; - Exiled.Events.Handlers.Player.Dying -= OnDying; - Exiled.Events.Handlers.Scp049.FinishingRecall -= OnFinishingRevive; + Exiled.Events.Handlers.Player.Dying -= Malfunction.OnDying; + Exiled.Events.Handlers.Scp049.FinishingRecall -= Malfunction.OnFinishingRevive; } private IEnumerator EarlyNuke() From a75390d027ff485738dc441a95d990527f11ab1f Mon Sep 17 00:00:00 2001 From: Omer <113857370+OmerGS@users.noreply.github.com> Date: Thu, 23 Jan 2025 19:35:00 +0100 Subject: [PATCH 128/853] fix/role and role attribution --- .../KE.CustomRoles/CR/ClassD/Enfant.cs | 8 +------ .../KE.CustomRoles/CR/Guard/ChiefGuard.cs | 3 +-- .../KE.CustomRoles/CR/Guard/Guard914.cs | 4 +--- .../CR/Scientist/GambleAddict.cs | 5 +--- .../CR/Scientist/ZoneManager.cs | 7 ++---- KruacentExiled/KE.CustomRoles/Controller.cs | 24 ++++++++++++++----- KruacentExiled/KE.CustomRoles/MainPlugin.cs | 12 +++++++--- 7 files changed, 33 insertions(+), 30 deletions(-) diff --git a/KruacentExiled/KE.CustomRoles/CR/ClassD/Enfant.cs b/KruacentExiled/KE.CustomRoles/CR/ClassD/Enfant.cs index 333e90f6..8508f62e 100644 --- a/KruacentExiled/KE.CustomRoles/CR/ClassD/Enfant.cs +++ b/KruacentExiled/KE.CustomRoles/CR/ClassD/Enfant.cs @@ -24,13 +24,7 @@ internal class Enfant : Exiled.CustomRoles.API.Features.CustomRole public override List Inventory { get; set; } = new List() { - $"{CandyKindID.Rainbow}", - $"{ItemType.None}", - $"{ItemType.None}", - $"{ItemType.None}", - $"{ItemType.None}", - $"{ItemType.None}", - $"{ItemType.None}" + $"{CandyKindID.Rainbow}" }; } } diff --git a/KruacentExiled/KE.CustomRoles/CR/Guard/ChiefGuard.cs b/KruacentExiled/KE.CustomRoles/CR/Guard/ChiefGuard.cs index e3c0af9e..86125d2c 100644 --- a/KruacentExiled/KE.CustomRoles/CR/Guard/ChiefGuard.cs +++ b/KruacentExiled/KE.CustomRoles/CR/Guard/ChiefGuard.cs @@ -27,8 +27,7 @@ internal class ChiefGuard : Exiled.CustomRoles.API.Features.CustomRole $"{ItemType.GunCrossvec}", $"{ItemType.Medkit}", $"{ItemType.Flashlight}", - $"{ItemType.KeycardMTFPrivate}", - $"{ItemType.None}" + $"{ItemType.KeycardMTFPrivate}" }; public override Dictionary Ammo { get; set; } = new Dictionary() diff --git a/KruacentExiled/KE.CustomRoles/CR/Guard/Guard914.cs b/KruacentExiled/KE.CustomRoles/CR/Guard/Guard914.cs index 634824d1..cdfc794d 100644 --- a/KruacentExiled/KE.CustomRoles/CR/Guard/Guard914.cs +++ b/KruacentExiled/KE.CustomRoles/CR/Guard/Guard914.cs @@ -39,9 +39,7 @@ internal class Guard914 : Exiled.CustomRoles.API.Features.CustomRole $"{ItemType.ArmorLight}", $"{ItemType.GunFSP9}", $"{ItemType.Medkit}", - $"{ItemType.Flashlight}", - $"{ItemType.None}", - $"{ItemType.None}" + $"{ItemType.Flashlight}" }; public override Dictionary Ammo { get; set; } = new Dictionary() diff --git a/KruacentExiled/KE.CustomRoles/CR/Scientist/GambleAddict.cs b/KruacentExiled/KE.CustomRoles/CR/Scientist/GambleAddict.cs index c0f6b109..d12d3192 100644 --- a/KruacentExiled/KE.CustomRoles/CR/Scientist/GambleAddict.cs +++ b/KruacentExiled/KE.CustomRoles/CR/Scientist/GambleAddict.cs @@ -26,10 +26,7 @@ internal class GambleAddict : Exiled.CustomRoles.API.Features.CustomRole $"{ItemType.Coin}", $"{ItemType.Coin}", $"{ItemType.Coin}", - $"{ItemType.Coin}", - $"{ItemType.None}", - $"{ItemType.None}", - $"{ItemType.None}" + $"{ItemType.Coin}" }; } } diff --git a/KruacentExiled/KE.CustomRoles/CR/Scientist/ZoneManager.cs b/KruacentExiled/KE.CustomRoles/CR/Scientist/ZoneManager.cs index 184d9af5..36525ad3 100644 --- a/KruacentExiled/KE.CustomRoles/CR/Scientist/ZoneManager.cs +++ b/KruacentExiled/KE.CustomRoles/CR/Scientist/ZoneManager.cs @@ -1,5 +1,6 @@ using Exiled.API.Features.Attributes; using Exiled.API.Features.Spawn; +using InventorySystem.Items.Keycards; using PlayerRoles; using System.Collections.Generic; using UnityEngine; @@ -37,11 +38,7 @@ internal class ZoneManager : Exiled.CustomRoles.API.Features.CustomRole { $"{ItemType.Medkit}", $"{ItemType.Adrenaline}", - $"{ItemType.None}", - $"{ItemType.KeycardZoneManager}", - $"{ItemType.None}", - $"{ItemType.None}", - $"{ItemType.None}", + $"{ItemType.KeycardZoneManager}" }; } } diff --git a/KruacentExiled/KE.CustomRoles/Controller.cs b/KruacentExiled/KE.CustomRoles/Controller.cs index 52f7d2ae..47bab10f 100644 --- a/KruacentExiled/KE.CustomRoles/Controller.cs +++ b/KruacentExiled/KE.CustomRoles/Controller.cs @@ -1,26 +1,38 @@ using Exiled.API.Extensions; using Exiled.API.Features; using Exiled.CustomRoles.API.Features; +using PlayerRoles; +using Utils.NonAllocLINQ; namespace KE.CustomRoles { internal class Controller { + public const int Chance = 40; public static Controller controller = new Controller(); - private Controller() - { - - } + private Controller() { } internal void CustomRoleGiver() { + CustomRole.Registered.ForEach(x => Log.Debug("- " + x.ToString())); + foreach (Player player in Exiled.API.Features.Player.List) { - CustomRole cr = CustomRole.Registered.GetRandomValue(); + if (UnityEngine.Random.Range(0,100) < Chance) + { + CustomRole cr; - cr.AddRole(player); + do + { + cr = CustomRole.Registered.GetRandomValue(); + } + while (cr.Role != player.Role); + + cr.AddRole(player); + } } } + } } \ No newline at end of file diff --git a/KruacentExiled/KE.CustomRoles/MainPlugin.cs b/KruacentExiled/KE.CustomRoles/MainPlugin.cs index e42f2a66..76c775bf 100644 --- a/KruacentExiled/KE.CustomRoles/MainPlugin.cs +++ b/KruacentExiled/KE.CustomRoles/MainPlugin.cs @@ -1,5 +1,6 @@ using Exiled.API.Features; using Exiled.CustomRoles.API.Features; +using Exiled.Events.EventArgs.Server; namespace KE.CustomRoles @@ -32,23 +33,28 @@ public override void OnDisabled() base.OnDisabled(); } - - - public void SubscribeEvents() { Exiled.Events.Handlers.Server.RoundStarted += CustomRoleImplement; + Exiled.Events.Handlers.Server.RespawnedTeam += CustomRoleRespawning; } /// public void UnsubscribeEvents() { Exiled.Events.Handlers.Server.RoundStarted -= CustomRoleImplement; + Exiled.Events.Handlers.Server.RespawnedTeam -= CustomRoleRespawning; + } public void CustomRoleImplement() { Controller.controller.CustomRoleGiver(); } + + public void CustomRoleRespawning(RespawnedTeamEventArgs _) + { + Controller.controller.CustomRoleGiver(); + } } } From a04fb92f34aacfa7b12974372e10387d5b85a516 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Thu, 23 Jan 2025 19:36:46 +0100 Subject: [PATCH 129/853] fix the asthmatique --- KruacentExiled/KE.CustomRoles/CR/ClassD/Asthmatique.cs | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/KruacentExiled/KE.CustomRoles/CR/ClassD/Asthmatique.cs b/KruacentExiled/KE.CustomRoles/CR/ClassD/Asthmatique.cs index 0c49701f..6c1042fb 100644 --- a/KruacentExiled/KE.CustomRoles/CR/ClassD/Asthmatique.cs +++ b/KruacentExiled/KE.CustomRoles/CR/ClassD/Asthmatique.cs @@ -1,4 +1,5 @@ using Exiled.API.Enums; +using Exiled.API.Features; using Exiled.API.Features.Attributes; using PlayerRoles; using UnityEngine; @@ -18,12 +19,10 @@ internal class Asthmatique : Exiled.CustomRoles.API.Features.CustomRole public override bool KeepRoleOnDeath { get; set; } = true; public override bool KeepRoleOnChangingRole { get; set; } = true; public override bool IgnoreSpawnSystem { get; set; } = true; - public override void Init() + public override void AddRole(Player player) { - TrackedPlayers.ForEach(p => { - p.EnableEffect(EffectType.Scp1853, -1); - p.EnableEffect(EffectType.Exhausted, -1); - }); + player.EnableEffect(EffectType.Scp1853, -1,true); + player.EnableEffect(EffectType.Exhausted, -1, true); } } } From 98176324e07dc4a767da909bf19b21df57d26242 Mon Sep 17 00:00:00 2001 From: Omer <113857370+OmerGS@users.noreply.github.com> Date: Thu, 23 Jan 2025 19:37:40 +0100 Subject: [PATCH 130/853] fix/i'm not be able to be programmer --- KruacentExiled/KE.CustomRoles/MainPlugin.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/KruacentExiled/KE.CustomRoles/MainPlugin.cs b/KruacentExiled/KE.CustomRoles/MainPlugin.cs index 76c775bf..ecf962a8 100644 --- a/KruacentExiled/KE.CustomRoles/MainPlugin.cs +++ b/KruacentExiled/KE.CustomRoles/MainPlugin.cs @@ -17,7 +17,6 @@ public override void OnEnabled() CustomRole.RegisterRoles(false,null); this.SubscribeEvents(); - Controller.controller.CustomRoleGiver(); base.OnEnabled(); } From 02ebf4ca021c32d6b09745a2f0aad0318c780591 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Thu, 23 Jan 2025 20:56:46 +0100 Subject: [PATCH 131/853] added timer to peanut lockdown --- KruacentExiled/KE.Misc/MainPlugin.cs | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/KruacentExiled/KE.Misc/MainPlugin.cs b/KruacentExiled/KE.Misc/MainPlugin.cs index 04067bd5..cabf829e 100644 --- a/KruacentExiled/KE.Misc/MainPlugin.cs +++ b/KruacentExiled/KE.Misc/MainPlugin.cs @@ -9,6 +9,7 @@ using PlayerRoles; using Exiled.Events.EventArgs.Player; using System; +using MapGeneration; namespace KE.Misc { @@ -112,12 +113,29 @@ internal IEnumerator PeanutLockdown() Log.Debug("peanut lockdown"); Door peanutDoor = Door.List.ToList().Where(x => x.Type == DoorType.Scp173NewGate).ToList()[0]; peanutDoor.IsOpen = false; - peanutDoor.ChangeLock(DoorLockType.Lockdown2176); - yield return Timing.WaitForSeconds(135-Player.List.Count*15); + peanutDoor.ChangeLock(DoorLockType.Isolation); + var a = Timing.RunCoroutine(Timer(135 - Player.List.Count * 15,Player.List.Where(p=> p.Role == RoleTypeId.Scp173).ToList(), "u r free :3")); + yield return Timing.WaitUntilDone(a); peanutDoor.IsOpen = true; peanutDoor.Unlock(); Log.Debug("peanut free"); } + + + private IEnumerator Timer(int secondsWaiting,List playerToShow, string msg = "done") + { + while (secondsWaiting >= 0) + { + Hint hint = new Hint() + { + Content = $"{secondsWaiting}", + Duration = 1 + }; + playerToShow.ForEach(p => p.ShowHint(hint)); + yield return Timing.WaitForSeconds(1); + secondsWaiting--; + } + } /// /// Special death message when Delecons dies as a SCP From 100c65b69f9d70cb6beae2c0a843762282e51ba8 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Sat, 25 Jan 2025 03:01:17 +0100 Subject: [PATCH 132/853] removed the player if not 173 anymore --- KruacentExiled/KE.Misc/MainPlugin.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/KruacentExiled/KE.Misc/MainPlugin.cs b/KruacentExiled/KE.Misc/MainPlugin.cs index cabf829e..197b0de9 100644 --- a/KruacentExiled/KE.Misc/MainPlugin.cs +++ b/KruacentExiled/KE.Misc/MainPlugin.cs @@ -132,6 +132,7 @@ private IEnumerator Timer(int secondsWaiting,List playerToShow, s Duration = 1 }; playerToShow.ForEach(p => p.ShowHint(hint)); + playerToShow.RemoveAll(p => p.Role != RoleTypeId.Scp173); yield return Timing.WaitForSeconds(1); secondsWaiting--; } From d11e14b49f9ea9ccf8c7f88df7a8c8b21a155cbd Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Mon, 27 Jan 2025 05:11:38 +0100 Subject: [PATCH 133/853] added models --- KruacentExiled/KE.Items/Items/Mine.cs | 18 ++++++++----- KruacentExiled/KE.Items/Models/MineModel.cs | 29 +++++++++++++++++++++ KruacentExiled/KE.Items/Models/Model.cs | 25 ++++++++++++++++++ 3 files changed, 65 insertions(+), 7 deletions(-) create mode 100644 KruacentExiled/KE.Items/Models/MineModel.cs create mode 100644 KruacentExiled/KE.Items/Models/Model.cs diff --git a/KruacentExiled/KE.Items/Items/Mine.cs b/KruacentExiled/KE.Items/Items/Mine.cs index 8e732e2b..0349ed18 100644 --- a/KruacentExiled/KE.Items/Items/Mine.cs +++ b/KruacentExiled/KE.Items/Items/Mine.cs @@ -9,9 +9,9 @@ using Exiled.API.Features.Toys; using Player = Exiled.API.Features.Player; using MEC; -using CustomPlayerEffects; using Exiled.API.Features.Items; -using Exiled.API.Features; +using Model = KE.Items.Models.Model; +using KE.Items.Models; namespace KE.Items.Items { @@ -24,7 +24,7 @@ public class Mine : CustomItem, ILumosItem public override float Weight { get; set; } = 0.65f; public UnityEngine.Color Color { get; set; } = UnityEngine.Color.yellow; - private const float RefreshRate = 0.5f; + private const float RefreshRate = .01f; private const int MineActivationTime = 10; private const float MineRadius = 0.7f; @@ -84,14 +84,17 @@ protected override void OnDropping(DroppingItemEventArgs ev) ev.IsAllowed = false; ev.Player.RemoveItem(ev.Item); - SpawnMine(ev.Player, ev.Player.Position); + Model m = new MineModel(); + + m.Spawn(new Vector3(ev.Player.Position.x, ev.Player.Position.y - .8f, ev.Player.Position.z)); + + //SpawnMine(ev.Player, new Vector3(ev.Player.Position.x,ev.Player.Position.y - .8f,ev.Player.Position.z)); } private void SpawnMine(Player player, Vector3 playerPosition) { Vector3 minePosition = playerPosition; - minePosition.y -= 0.8f; // The base part of mine Primitive mine = Primitive.Create(PrimitiveType.Cylinder, minePosition, null, new Vector3(MineRadius, 0.01f, MineRadius), true); @@ -120,7 +123,8 @@ private IEnumerator WaitAndActivateMine(Player player, Primitive mine) private IEnumerator ActiveMine(Primitive mine, float cylinderSize) { - while (true) + bool endWhile = true; + while (endWhile) { foreach (Player player in Player.List) { @@ -130,7 +134,7 @@ private IEnumerator ActiveMine(Primitive mine, float cylinderSize) // Delete the mine mine.UnSpawn(); - Timing.KillCoroutines(); + endWhile = false; mine.Destroy(); yield break; } diff --git a/KruacentExiled/KE.Items/Models/MineModel.cs b/KruacentExiled/KE.Items/Models/MineModel.cs new file mode 100644 index 00000000..146ce292 --- /dev/null +++ b/KruacentExiled/KE.Items/Models/MineModel.cs @@ -0,0 +1,29 @@ + + +using Exiled.API.Features.Toys; +using System.Collections.Generic; +using UnityEngine; +using Light = Exiled.API.Features.Toys.Light; + +namespace KE.Items.Models +{ + internal class MineModel : Model + { + Color LightColor { get; set; } = Color.red; + internal override void Spawn(Vector3 spawnPos) + { + Position = spawnPos; + var baseMine = Primitive.Create(PrimitiveType.Cylinder, spawnPos, null, new Vector3(.7f, 0.1f, .7f), true); + var lightGlobe = Primitive.Create(PrimitiveType.Sphere, spawnPos+spawnPos, null, new Vector3(.1f, .1f, .1f)); + var lightMine = Light.Create(spawnPos, null, null, true, LightColor); + + baseMine.Collidable = false; + lightGlobe.Color = LightColor; + lightGlobe.Collidable = false; + + Toys.Add(lightGlobe); + Toys.Add(baseMine); + Toys.Add(lightMine); + } + } +} diff --git a/KruacentExiled/KE.Items/Models/Model.cs b/KruacentExiled/KE.Items/Models/Model.cs new file mode 100644 index 00000000..878f3ef0 --- /dev/null +++ b/KruacentExiled/KE.Items/Models/Model.cs @@ -0,0 +1,25 @@ +using Exiled.API.Features.Toys; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using UnityEngine; + +namespace KE.Items.Models +{ + internal abstract class Model + { + internal Vector3 Position { get; set; } + protected List Toys { get; set; } + internal abstract void Spawn(Vector3 spawnPos); + + internal void Unspawn() + { + foreach (AdminToy primitive in Toys) + { + primitive.Destroy(); + } + } + } +} From 61cb75f0d29cbab0c20b54e2009e0e6b5b23fa74 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Mon, 27 Jan 2025 05:11:48 +0100 Subject: [PATCH 134/853] add intensity attribute --- KruacentExiled/KE.Items/MainPlugin.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/KruacentExiled/KE.Items/MainPlugin.cs b/KruacentExiled/KE.Items/MainPlugin.cs index 238c8ac0..55c88d4f 100644 --- a/KruacentExiled/KE.Items/MainPlugin.cs +++ b/KruacentExiled/KE.Items/MainPlugin.cs @@ -18,6 +18,7 @@ public class MainPlugin : Plugin public override string Name => "KEItems"; internal Sound Sound { get; private set; } internal static MainPlugin Instance { get; private set; } + public float Intensity { get; set; } = .5f; public override Version Version => new Version(1, 0, 0); private Dictionary pl = new Dictionary(); public override void OnEnabled() @@ -93,7 +94,7 @@ internal IEnumerator LightP() if(CustomItem.TryGet(x.Key, out CustomItem cui) && cui is ILumosItem ci) { Light light = Light.Create(x.Key.Position, null, null, true, ci.Color); - light.Intensity = 0.5f; + light.Intensity = Intensity; if (x.Value != null) { Light val = x.Value; From eb00b939ed81b11c969e90a64c6d741c78540b37 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Mon, 27 Jan 2025 06:20:59 +0100 Subject: [PATCH 135/853] changed the handling of attributing custom roles --- KruacentExiled/KE.CustomRoles/Controller.cs | 46 ++++++++++++++------- KruacentExiled/KE.CustomRoles/MainPlugin.cs | 8 ++-- 2 files changed, 33 insertions(+), 21 deletions(-) diff --git a/KruacentExiled/KE.CustomRoles/Controller.cs b/KruacentExiled/KE.CustomRoles/Controller.cs index 47bab10f..2cdb14a3 100644 --- a/KruacentExiled/KE.CustomRoles/Controller.cs +++ b/KruacentExiled/KE.CustomRoles/Controller.cs @@ -2,37 +2,51 @@ using Exiled.API.Features; using Exiled.CustomRoles.API.Features; using PlayerRoles; +using System.Collections.Generic; +using System.Linq; using Utils.NonAllocLINQ; namespace KE.CustomRoles { internal class Controller { + /// + /// The chance of having a CustomRole + /// public const int Chance = 40; public static Controller controller = new Controller(); private Controller() { } - internal void CustomRoleGiver() + /// + /// Gives a CustomRole to a player + /// + /// + internal void GiveRole(Player player) { - CustomRole.Registered.ForEach(x => Log.Debug("- " + x.ToString())); - - foreach (Player player in Exiled.API.Features.Player.List) + if (player == null) + return; + if (UnityEngine.Random.Range(0, 100) > Chance) { - if (UnityEngine.Random.Range(0,100) < Chance) - { - CustomRole cr; - - do - { - cr = CustomRole.Registered.GetRandomValue(); - } - while (cr.Role != player.Role); - - cr.AddRole(player); - } + Log.Debug("no luck"); + return; } + + CustomRole cr = CustomRole.Registered.GetRandomValue(c => c.Role == player.Role); + Log.Debug($"{player.Id} : {cr.Name}"); + cr?.AddRole(player); } + /// + /// Gives CustomRoles to multiple players + /// + /// + internal void GiveRole(IEnumerable players) + { + foreach (Player p in players) + { + GiveRole(p); + } + } } } \ No newline at end of file diff --git a/KruacentExiled/KE.CustomRoles/MainPlugin.cs b/KruacentExiled/KE.CustomRoles/MainPlugin.cs index ecf962a8..cbded7a9 100644 --- a/KruacentExiled/KE.CustomRoles/MainPlugin.cs +++ b/KruacentExiled/KE.CustomRoles/MainPlugin.cs @@ -37,8 +37,6 @@ public void SubscribeEvents() Exiled.Events.Handlers.Server.RoundStarted += CustomRoleImplement; Exiled.Events.Handlers.Server.RespawnedTeam += CustomRoleRespawning; } - - /// public void UnsubscribeEvents() { Exiled.Events.Handlers.Server.RoundStarted -= CustomRoleImplement; @@ -48,12 +46,12 @@ public void UnsubscribeEvents() public void CustomRoleImplement() { - Controller.controller.CustomRoleGiver(); + Controller.controller.GiveRole(Player.List); } - public void CustomRoleRespawning(RespawnedTeamEventArgs _) + public void CustomRoleRespawning(RespawnedTeamEventArgs ev) { - Controller.controller.CustomRoleGiver(); + Controller.controller.GiveRole(ev.Players); } } } From 3c9239066b4898e1d06847868adbbbdc920aebeb Mon Sep 17 00:00:00 2001 From: Omer <113857370+OmerGS@users.noreply.github.com> Date: Mon, 27 Jan 2025 10:06:52 +0100 Subject: [PATCH 136/853] =?UTF-8?q?fix/impactFlash,=20DA-020,=20HealingGre?= =?UTF-8?q?nade,=20Molotov,=20pressePur=C3=A9e=20can=20be=20update=20in=20?= =?UTF-8?q?914=20to=20get=20Sainte=20grenada,=20removed=20grenade=20launch?= =?UTF-8?q?er.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../KE.Items/Items/AdrenalineDrogue.cs | 2 +- .../KE.Items/Items/GrenadeLauncher.cs | 132 ------------------ KruacentExiled/KE.Items/Items/HealZone.cs | 2 +- KruacentExiled/KE.Items/Items/ImpactFlash.cs | 2 +- KruacentExiled/KE.Items/Items/Molotov.cs | 2 +- KruacentExiled/KE.Items/Items/PressePuree.cs | 75 +++++++--- .../KE.Items/Items/SainteGrenada.cs | 11 +- 7 files changed, 63 insertions(+), 163 deletions(-) delete mode 100644 KruacentExiled/KE.Items/Items/GrenadeLauncher.cs diff --git a/KruacentExiled/KE.Items/Items/AdrenalineDrogue.cs b/KruacentExiled/KE.Items/Items/AdrenalineDrogue.cs index c6112f5e..ba54b9af 100644 --- a/KruacentExiled/KE.Items/Items/AdrenalineDrogue.cs +++ b/KruacentExiled/KE.Items/Items/AdrenalineDrogue.cs @@ -88,7 +88,7 @@ private void OnUsingItem(UsedItemEventArgs ev) { if (TryGet(ev.Item, out var result)) { - if (result.Id == 19) + if (result.Id == Id) { Timing.CallDelayed(0.5f, () => { diff --git a/KruacentExiled/KE.Items/Items/GrenadeLauncher.cs b/KruacentExiled/KE.Items/Items/GrenadeLauncher.cs deleted file mode 100644 index 33a8af15..00000000 --- a/KruacentExiled/KE.Items/Items/GrenadeLauncher.cs +++ /dev/null @@ -1,132 +0,0 @@ -using System.Collections.Generic; -using System.ComponentModel; -using Exiled.API.Enums; -using Exiled.API.Features.Attributes; -using Exiled.API.Features.Pickups.Projectiles; -using Exiled.API.Features.Spawn; -using Exiled.CustomItems.API.Features; -using Exiled.Events.EventArgs.Player; -using MEC; -using System.Linq; -using Exiled.API.Features; -using Exiled.API.Features.Items; -using UnityEngine; -using CollisionHandler = Exiled.API.Features.Components.CollisionHandler; -using KE.Items.Interface; - - -namespace KE.Items.Items -{ - [CustomItem(ItemType.GunLogicer)] - public class GrenadeLauncher : CustomWeapon, ILumosItem - { - private CustomGrenade loadedCustomGrenade; - - private ProjectileType loadedGrenade = ProjectileType.FragGrenade; - - public override uint Id { get; set; } = 1414; - public override string Name { get; set; } = "Grenade Launcher"; - public override string Description { get; set; } = "Weapon that launch grenade, it's pretty simple"; - public override float Weight { get; set; } = 2.95f; - public float DamageModifier { get; set; } = 1f; - public UnityEngine.Color Color { get; set; } = UnityEngine.Color.red; - - public override SpawnProperties SpawnProperties { get; set; } = new SpawnProperties() - { - Limit = 1, - LockerSpawnPoints = new List - { - new LockerSpawnPoint() - { - Chance = 10, - Type = LockerType.ExperimentalWeapon - } - } - }; - - public override float Damage { get; set; } - public override byte ClipSize { get; set; } = 2; - - [Description("Whether or not players will need actual frag grenades in their inventory to use as ammo. If false, the weapon's base ammo type is used instead.")] - public bool UseGrenades { get; set; } = true; - - [Description("The speed of grenades when they shoot out of the weapon.")] - public float GrenadeSpeed { get; set; } = 3f; - - [Description("The max duration of the fuse of grenades shot from the weapon. These grenades will always explode immediatly when they collide with something, but this can be used with slow-moving grenades to cause mid-air explosions.")] - public float FuseTime { get; set; } = 1f; - - [Description("Whether or not the Grenade Launcher will consider modded frag grenades as viable grenades for reloading.")] - public bool IgnoreModdedGrenades { get; set; } = true; - - protected override void OnReloading(ReloadingWeaponEventArgs ev) - { - if (UseGrenades) - { - ev.IsAllowed = true; - - if (!(ev.Player.CurrentItem is Firearm firearm) || firearm.MagazineAmmo >= ClipSize) - return; - - Log.Debug($"{Name}.{nameof(OnReloading)}: {ev.Player.Nickname} is reloading!"); - - foreach (Item item in ev.Player.Items.ToList()) - { - Log.Debug($"{Name}.{nameof(OnReloading)}: Found item: {item.Type} - {item.Serial}"); - if (item.Type != ItemType.GrenadeHE && item.Type != ItemType.GrenadeFlash && item.Type != ItemType.SCP018) - continue; - if (TryGet(item, out CustomItem cItem)) - { - if (IgnoreModdedGrenades) - continue; - - if (cItem is CustomGrenade customGrenade) - loadedCustomGrenade = customGrenade; - } - - ev.Player.DisableEffect(EffectType.Invisible); - //ev.Player.Connection.Send(new RequestMessage(ev.Firearm.Serial, ReloadType.Reload)); - - - Timing.CallDelayed(3f, () => firearm.MagazineAmmo = ClipSize); - - loadedGrenade = item.Type == ItemType.GrenadeFlash ? ProjectileType.Flashbang : - item.Type == ItemType.GrenadeHE ? ProjectileType.FragGrenade : ProjectileType.Scp018; - Log.Debug($"{Name}.{nameof(OnReloading)}: {ev.Player.Nickname} successfully reloaded. Grenade type: {loadedGrenade} IsCustom: {loadedCustomGrenade != null}"); - ev.Player.RemoveItem(item); - - return; - } - - Log.Debug($"{Name}.{nameof(OnReloading)}: {ev.Player.Nickname} was unable to reload - No grenades in inventory."); - } - } - - /// - protected override void OnShooting(ShootingEventArgs ev) - { - ev.IsAllowed = false; - - if (ev.Player.CurrentItem is Firearm firearm) - firearm.MagazineAmmo -= 1; - - Vector3 pos = ev.Player.CameraTransform.TransformPoint(new Vector3(0.0715f, 0.0225f, 0.45f)); - Projectile projectile; - - switch (loadedGrenade) - { - case ProjectileType.Scp018: - projectile = ev.Player.ThrowGrenade(ProjectileType.Scp018).Projectile; - break; - case ProjectileType.Flashbang: - projectile = ev.Player.ThrowGrenade(ProjectileType.Flashbang).Projectile; - break; - default: - projectile = ev.Player.ThrowGrenade(ProjectileType.FragGrenade).Projectile; - break; - } - - projectile.GameObject.AddComponent().Init(ev.Player.GameObject, projectile.Base); - } - } -} diff --git a/KruacentExiled/KE.Items/Items/HealZone.cs b/KruacentExiled/KE.Items/Items/HealZone.cs index f84dc4d9..3fa59658 100644 --- a/KruacentExiled/KE.Items/Items/HealZone.cs +++ b/KruacentExiled/KE.Items/Items/HealZone.cs @@ -12,7 +12,7 @@ namespace KE.Items.Items { - [CustomItem(ItemType.GrenadeHE)] + [CustomItem(ItemType.GrenadeFlash)] public class HealZone : CustomGrenade, ILumosItem { public override uint Id { get; set; } = 1411; diff --git a/KruacentExiled/KE.Items/Items/ImpactFlash.cs b/KruacentExiled/KE.Items/Items/ImpactFlash.cs index 6eed2a48..431049ef 100644 --- a/KruacentExiled/KE.Items/Items/ImpactFlash.cs +++ b/KruacentExiled/KE.Items/Items/ImpactFlash.cs @@ -11,7 +11,7 @@ public class ImpactFlash : CustomGrenade { public override uint Id { get; set; } = 1412; public override string Name { get; set; } = "Impact Flash"; - public override string Description { get; set; } = "The flashligh explode at impact"; + public override string Description { get; set; } = "The grenade explode at impact"; public override float Weight { get; set; } = 0.65f; public override float FuseTime { get; set; } = 3f; public override bool ExplodeOnCollision { get; set; } = true; diff --git a/KruacentExiled/KE.Items/Items/Molotov.cs b/KruacentExiled/KE.Items/Items/Molotov.cs index b8c33df3..bdb206dc 100644 --- a/KruacentExiled/KE.Items/Items/Molotov.cs +++ b/KruacentExiled/KE.Items/Items/Molotov.cs @@ -12,7 +12,7 @@ namespace KE.Items.Items { - [CustomItem(ItemType.GrenadeHE)] + [CustomItem(ItemType.GrenadeFlash)] public class Molotov : CustomGrenade, ILumosItem { public override uint Id { get; set; } = 1409; diff --git a/KruacentExiled/KE.Items/Items/PressePuree.cs b/KruacentExiled/KE.Items/Items/PressePuree.cs index 5a8016d2..b1f886d7 100644 --- a/KruacentExiled/KE.Items/Items/PressePuree.cs +++ b/KruacentExiled/KE.Items/Items/PressePuree.cs @@ -1,10 +1,12 @@  +using System; using System.Collections.Generic; using Exiled.API.Enums; using Exiled.API.Features; using Exiled.API.Features.Attributes; using Exiled.API.Features.Spawn; using Exiled.CustomItems.API.Features; +using Exiled.Events.EventArgs.Scp914; namespace KE.Items.Items { @@ -22,29 +24,66 @@ public class PressePuree : CustomGrenade { Limit = 5, DynamicSpawnPoints = new List - { - new DynamicSpawnPoint() - { - Chance = 50, - Location = SpawnLocationType.InsideHczArmory, - }, - new DynamicSpawnPoint() { - Chance =2, - Location = SpawnLocationType.Inside914, + new DynamicSpawnPoint() + { + Chance = 50, + Location = SpawnLocationType.InsideHczArmory, + }, + new DynamicSpawnPoint() + { + Chance = 5, + Location = SpawnLocationType.Inside914, + }, + new DynamicSpawnPoint() + { + Chance= 50, + Location = SpawnLocationType.Inside049Armory, + }, + new DynamicSpawnPoint() + { + Chance= 50, + Location = SpawnLocationType.InsideLczArmory, + } }, - new DynamicSpawnPoint() + }; + + + protected override void SubscribeEvents() + { + Exiled.Events.Handlers.Scp914.UpgradingInventoryItem += OnUpgrading; + base.SubscribeEvents(); + } + + /// + protected override void UnsubscribeEvents() + { + Exiled.Events.Handlers.Scp914.UpgradingInventoryItem -= OnUpgrading; + base.UnsubscribeEvents(); + } + + private void OnUpgrading(UpgradingInventoryItemEventArgs ev) + { + if (!Check(ev.Item)) + return; + if (ev.KnobSetting != Scp914.Scp914KnobSetting.VeryFine) + return; + + var rng = UnityEngine.Random.Range(0, 101); + Log.Debug($"inventory {Name} : {rng}"); + if (rng < 10) { - Chance=50, - Location = SpawnLocationType.Inside049Armory, - }, - new DynamicSpawnPoint() + //success + ev.Player.RemoveItem(ev.Item); + TryGive(ev.Player, "Sainte Grenada"); + ev.IsAllowed = true; + } + else { - Chance=50, - Location = SpawnLocationType.InsideLczArmory, + ev.Player.ShowHint("no luck"); + ev.IsAllowed = false; } - }, - }; + } } } diff --git a/KruacentExiled/KE.Items/Items/SainteGrenada.cs b/KruacentExiled/KE.Items/Items/SainteGrenada.cs index 51d4cbca..be5b4bb0 100644 --- a/KruacentExiled/KE.Items/Items/SainteGrenada.cs +++ b/KruacentExiled/KE.Items/Items/SainteGrenada.cs @@ -21,7 +21,7 @@ public class SainteGrenada : CustomGrenade, ILumosItem public override string Description { get; set; } = "Worms reference !?"; public override float Weight { get; set; } = 1.5f; public override float FuseTime { get; set; } = 1.5f; - public override bool ExplodeOnCollision { get; set; } = true; + public override bool ExplodeOnCollision { get; set; } = false; public float DamageModifier { get; set; } = 3f; public Color Color { get; set; } = Color.red; @@ -35,14 +35,7 @@ public class SainteGrenada : CustomGrenade, ILumosItem public override SpawnProperties SpawnProperties { get; set; } = new SpawnProperties() { - Limit = 1, - DynamicSpawnPoints = new List - { - new DynamicSpawnPoint() { Chance = 20, Location = SpawnLocationType.InsideHczArmory, }, - new DynamicSpawnPoint() { Chance = 10, Location = SpawnLocationType.Inside914, }, - new DynamicSpawnPoint() { Chance= 20, Location = SpawnLocationType.Inside049Armory, }, - new DynamicSpawnPoint() { Chance= 20, Location = SpawnLocationType.InsideLczArmory, } - }, + }; protected override void OnExploding(ExplodingGrenadeEventArgs ev) From b5102587a863bc1c263d0f99c9f198fe40181cb7 Mon Sep 17 00:00:00 2001 From: Omer <113857370+OmerGS@users.noreply.github.com> Date: Mon, 27 Jan 2025 10:15:26 +0100 Subject: [PATCH 137/853] fix/556 ammunation added --- KruacentExiled/KE.CustomRoles/CR/MTF/Tank.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/KruacentExiled/KE.CustomRoles/CR/MTF/Tank.cs b/KruacentExiled/KE.CustomRoles/CR/MTF/Tank.cs index 70a5ba68..9074199f 100644 --- a/KruacentExiled/KE.CustomRoles/CR/MTF/Tank.cs +++ b/KruacentExiled/KE.CustomRoles/CR/MTF/Tank.cs @@ -40,7 +40,8 @@ internal class Tank : Exiled.CustomRoles.API.Features.CustomRole public override Dictionary Ammo { get; set; } = new Dictionary() { - { AmmoType.Nato762, 500} + { AmmoType.Nato762, 500}, + { AmmoType.Nato556, 500} }; protected override void SubscribeEvents() From 625d011ff805a1922ccd23aa86278560d9806da9 Mon Sep 17 00:00:00 2001 From: Omer <113857370+OmerGS@users.noreply.github.com> Date: Mon, 27 Jan 2025 10:23:50 +0100 Subject: [PATCH 138/853] Create ItemList.md --- KruacentExiled/KE.Items/ItemList.md | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 KruacentExiled/KE.Items/ItemList.md diff --git a/KruacentExiled/KE.Items/ItemList.md b/KruacentExiled/KE.Items/ItemList.md new file mode 100644 index 00000000..dacec4de --- /dev/null +++ b/KruacentExiled/KE.Items/ItemList.md @@ -0,0 +1,21 @@ +# Custom Items + +| ID | Item Name | Description | +|--------|-----------------------|--------------------| +| 1401 | Defibrillator | Used to revive a player. | +| 1402 | Adrenaline Drogue | Temporarily boosts a player's abilities. | +| 1403 | No Item | No item associated. | +| 1404 | No Item | No item associated. | +| 1405 | TP Granada | Teleporting grenade. | +| 1406 | PressePurée | Grenade explode at impact | +| 1407 | Divine Pill | Respawn a random spectator. | +| 1408 | Deployable Wall | Creates a temporary wall. | +| 1409 | Molotov | Create a damage zone | +| 1410 | True Divine Pills | Respawn every spectator. | +| 1411 | Heal Zone | Area that heals allies. | +| 1412 | Impact Flash | Flash exploding at impact. | +| 1413 | Mine | Explosive mine. | + +## Description + +Each row in the table lists a custom item with its ID and a brief description. The ID is used to identify each item, and the description explains briefly what the item does. From c1a6a68c468848e135a5da7369fb27d87bb083f0 Mon Sep 17 00:00:00 2001 From: Omer <113857370+OmerGS@users.noreply.github.com> Date: Mon, 27 Jan 2025 10:42:49 +0100 Subject: [PATCH 139/853] fix/roleId --- KruacentExiled/KE.CustomRoles/CR/ChaosInsurgency/LeRusse.cs | 2 +- KruacentExiled/KE.CustomRoles/CR/ClassD/Asthmatique.cs | 2 +- KruacentExiled/KE.CustomRoles/CR/ClassD/Enfant.cs | 2 +- KruacentExiled/KE.CustomRoles/CR/Guard/ChiefGuard.cs | 2 +- KruacentExiled/KE.CustomRoles/CR/Guard/Guard914.cs | 2 +- KruacentExiled/KE.CustomRoles/CR/MTF/Tank.cs | 2 +- KruacentExiled/KE.CustomRoles/CR/MTF/Terroriste.cs | 2 +- KruacentExiled/KE.CustomRoles/CR/SCP/Paper049.cs | 2 +- KruacentExiled/KE.CustomRoles/CR/SCP/Small049.cs | 2 +- KruacentExiled/KE.CustomRoles/CR/SCP/Small173.cs | 2 +- KruacentExiled/KE.CustomRoles/CR/Scientist/GambleAddict.cs | 2 +- KruacentExiled/KE.CustomRoles/CR/Scientist/ZoneManager.cs | 4 ++-- KruacentExiled/KE.CustomRoles/KE.CustomRoles.csproj | 2 +- 13 files changed, 14 insertions(+), 14 deletions(-) diff --git a/KruacentExiled/KE.CustomRoles/CR/ChaosInsurgency/LeRusse.cs b/KruacentExiled/KE.CustomRoles/CR/ChaosInsurgency/LeRusse.cs index c19d46f5..f710cebb 100644 --- a/KruacentExiled/KE.CustomRoles/CR/ChaosInsurgency/LeRusse.cs +++ b/KruacentExiled/KE.CustomRoles/CR/ChaosInsurgency/LeRusse.cs @@ -11,7 +11,7 @@ internal class Russe : Exiled.CustomRoles.API.Features.CustomRole { public override string Name { get; set; } = "Russe"; public override string Description { get; set; } = "Tu es un maitre de jeu \ntu dois faire la roulette russe avec les autres joueurs"; - public override uint Id { get; set; } = 1051; + public override uint Id { get; set; } = 1410; public override string CustomInfo { get; set; } = "Le Russe"; public override int MaxHealth { get; set; } = 100; public override RoleTypeId Role { get; set; } = RoleTypeId.ChaosConscript; diff --git a/KruacentExiled/KE.CustomRoles/CR/ClassD/Asthmatique.cs b/KruacentExiled/KE.CustomRoles/CR/ClassD/Asthmatique.cs index 6c1042fb..953a4018 100644 --- a/KruacentExiled/KE.CustomRoles/CR/ClassD/Asthmatique.cs +++ b/KruacentExiled/KE.CustomRoles/CR/ClassD/Asthmatique.cs @@ -12,7 +12,7 @@ internal class Asthmatique : Exiled.CustomRoles.API.Features.CustomRole { public override string Name { get; set; } = "Asthmatique"; public override string Description { get; set; } = "Tu es asthmatique\nT'as stamina est réduit de moitié\nMais tu vises mieux"; - public override uint Id { get; set; } = 1048; + public override uint Id { get; set; } = 1402; public override string CustomInfo { get; set; } = "Asmathique"; public override int MaxHealth { get; set; } = 100; public override RoleTypeId Role { get; set; } = RoleTypeId.ClassD; diff --git a/KruacentExiled/KE.CustomRoles/CR/ClassD/Enfant.cs b/KruacentExiled/KE.CustomRoles/CR/ClassD/Enfant.cs index 8508f62e..1df5ab5d 100644 --- a/KruacentExiled/KE.CustomRoles/CR/ClassD/Enfant.cs +++ b/KruacentExiled/KE.CustomRoles/CR/ClassD/Enfant.cs @@ -11,7 +11,7 @@ internal class Enfant : Exiled.CustomRoles.API.Features.CustomRole { public override string Name { get; set; } = "enfant"; public override string Description { get; set; } = "Tu es un Enfant \ndo not the kid \ntu commences avec un bonbon arc-en-ciel \n t'es un peu plus petit que la normal"; - public override uint Id { get; set; } = 1040; + public override uint Id { get; set; } = 1401; public override string CustomInfo { get; set; } = "Enfant"; public override int MaxHealth { get; set; } = 100; public override RoleTypeId Role { get; set; } = RoleTypeId.ClassD; diff --git a/KruacentExiled/KE.CustomRoles/CR/Guard/ChiefGuard.cs b/KruacentExiled/KE.CustomRoles/CR/Guard/ChiefGuard.cs index 86125d2c..fe837785 100644 --- a/KruacentExiled/KE.CustomRoles/CR/Guard/ChiefGuard.cs +++ b/KruacentExiled/KE.CustomRoles/CR/Guard/ChiefGuard.cs @@ -10,7 +10,7 @@ internal class ChiefGuard : Exiled.CustomRoles.API.Features.CustomRole { public override string Name { get; set; } = "ChiefGuard"; public override string Description { get; set; } = "Tu es un Chef des gardes du site \nT'as une carte de private \net un crossvec"; - public override uint Id { get; set; } = 1041; + public override uint Id { get; set; } = 1406; public override string CustomInfo { get; set; } = "Chef des Gardes"; public override int MaxHealth { get; set; } = 100; public override RoleTypeId Role { get; set; } = RoleTypeId.FacilityGuard; diff --git a/KruacentExiled/KE.CustomRoles/CR/Guard/Guard914.cs b/KruacentExiled/KE.CustomRoles/CR/Guard/Guard914.cs index cdfc794d..612bb3e1 100644 --- a/KruacentExiled/KE.CustomRoles/CR/Guard/Guard914.cs +++ b/KruacentExiled/KE.CustomRoles/CR/Guard/Guard914.cs @@ -11,7 +11,7 @@ internal class Guard914 : Exiled.CustomRoles.API.Features.CustomRole { public override string Name { get; set; } = "guard914"; public override string Description { get; set; } = "Tu es Le garde de SCP-914 \nTu commences à 914 \nmais on a volé ta carte \net ntm aussi"; - public override uint Id { get; set; } = 1042; + public override uint Id { get; set; } = 1405; public override string CustomInfo { get; set; } = "Garde de 914"; public override int MaxHealth { get; set; } = 100; public override RoleTypeId Role { get; set; } = RoleTypeId.FacilityGuard; diff --git a/KruacentExiled/KE.CustomRoles/CR/MTF/Tank.cs b/KruacentExiled/KE.CustomRoles/CR/MTF/Tank.cs index 9074199f..477581c8 100644 --- a/KruacentExiled/KE.CustomRoles/CR/MTF/Tank.cs +++ b/KruacentExiled/KE.CustomRoles/CR/MTF/Tank.cs @@ -15,7 +15,7 @@ internal class Tank : Exiled.CustomRoles.API.Features.CustomRole { public override string Name { get; set; } = "Tank"; public override string Description { get; set; } = "Tu es un TANK tu es débuff mais ta force de tir est démultiplié"; - public override uint Id { get; set; } = 1050; + public override uint Id { get; set; } = 1411; public override string CustomInfo { get; set; } = "Tank"; public override int MaxHealth { get; set; } = 200; public override RoleTypeId Role { get; set; } = RoleTypeId.NtfCaptain; diff --git a/KruacentExiled/KE.CustomRoles/CR/MTF/Terroriste.cs b/KruacentExiled/KE.CustomRoles/CR/MTF/Terroriste.cs index cf0b6563..228efff2 100644 --- a/KruacentExiled/KE.CustomRoles/CR/MTF/Terroriste.cs +++ b/KruacentExiled/KE.CustomRoles/CR/MTF/Terroriste.cs @@ -11,7 +11,7 @@ internal class Terroriste : Exiled.CustomRoles.API.Features.CustomRole { public override string Name { get; set; } = "Terroriste"; public override string Description { get; set; } = "Tu es un Terroriste \nne fait pas exploser la facilité \ntu commences avec des grenades"; - public override uint Id { get; set; } = 1049; + public override uint Id { get; set; } = 1412; public override string CustomInfo { get; set; } = "Terroriste"; public override int MaxHealth { get; set; } = 100; public override RoleTypeId Role { get; set; } = RoleTypeId.NtfSergeant; diff --git a/KruacentExiled/KE.CustomRoles/CR/SCP/Paper049.cs b/KruacentExiled/KE.CustomRoles/CR/SCP/Paper049.cs index c046b151..54913fd1 100644 --- a/KruacentExiled/KE.CustomRoles/CR/SCP/Paper049.cs +++ b/KruacentExiled/KE.CustomRoles/CR/SCP/Paper049.cs @@ -9,7 +9,7 @@ internal class Paper049 : Exiled.CustomRoles.API.Features.CustomRole { public override string Name { get; set; } = "Paper049"; public override string Description { get; set; } = "u are a paper doctor"; - public override uint Id { get; set; } = 1047; + public override uint Id { get; set; } = 1407; public override string CustomInfo { get; set; } = "Paper Doctor"; public override int MaxHealth { get; set; } = 2300; public override RoleTypeId Role { get; set; } = RoleTypeId.Scp049; diff --git a/KruacentExiled/KE.CustomRoles/CR/SCP/Small049.cs b/KruacentExiled/KE.CustomRoles/CR/SCP/Small049.cs index 2ae2facb..a3b1296c 100644 --- a/KruacentExiled/KE.CustomRoles/CR/SCP/Small049.cs +++ b/KruacentExiled/KE.CustomRoles/CR/SCP/Small049.cs @@ -11,7 +11,7 @@ internal class Small049 : Exiled.CustomRoles.API.Features.CustomRole { public override string Name { get; set; } = "Small049"; public override string Description { get; set; } = "u are a smoll doctor"; - public override uint Id { get; set; } = 1045; + public override uint Id { get; set; } = 1408; public override string CustomInfo { get; set; } = "Small Doctor"; public override int MaxHealth { get; set; } = 2300; public override RoleTypeId Role { get; set; } = RoleTypeId.Scp049; diff --git a/KruacentExiled/KE.CustomRoles/CR/SCP/Small173.cs b/KruacentExiled/KE.CustomRoles/CR/SCP/Small173.cs index 07c69f03..8d344be4 100644 --- a/KruacentExiled/KE.CustomRoles/CR/SCP/Small173.cs +++ b/KruacentExiled/KE.CustomRoles/CR/SCP/Small173.cs @@ -9,7 +9,7 @@ internal class Small173 : Exiled.CustomRoles.API.Features.CustomRole { public override string Name { get; set; } = "Tall173"; public override string Description { get; set; } = " Tall NUT \nu tol\n fuck you"; - public override uint Id { get; set; } = 1046; + public override uint Id { get; set; } = 1409; public override string CustomInfo { get; set; } = "Small Peanuts"; public override int MaxHealth { get; set; } = 4500; public override RoleTypeId Role { get; set; } = RoleTypeId.Scp173; diff --git a/KruacentExiled/KE.CustomRoles/CR/Scientist/GambleAddict.cs b/KruacentExiled/KE.CustomRoles/CR/Scientist/GambleAddict.cs index d12d3192..2f14d985 100644 --- a/KruacentExiled/KE.CustomRoles/CR/Scientist/GambleAddict.cs +++ b/KruacentExiled/KE.CustomRoles/CR/Scientist/GambleAddict.cs @@ -10,7 +10,7 @@ internal class GambleAddict : Exiled.CustomRoles.API.Features.CustomRole { public override string Name { get; set; } = "GambleAddict"; public override string Description { get; set; } = "Tu es un Gamble Addict \nT'as trade ton kit et ta carte contre 4 pièces \nfais en bon usage"; - public override uint Id { get; set; } = 1043; + public override uint Id { get; set; } = 1403; public override string CustomInfo { get; set; } = "GambleAddict"; public override int MaxHealth { get; set; } = 100; public override RoleTypeId Role { get; set; } = RoleTypeId.Scientist; diff --git a/KruacentExiled/KE.CustomRoles/CR/Scientist/ZoneManager.cs b/KruacentExiled/KE.CustomRoles/CR/Scientist/ZoneManager.cs index 36525ad3..94d48648 100644 --- a/KruacentExiled/KE.CustomRoles/CR/Scientist/ZoneManager.cs +++ b/KruacentExiled/KE.CustomRoles/CR/Scientist/ZoneManager.cs @@ -12,7 +12,7 @@ internal class ZoneManager : Exiled.CustomRoles.API.Features.CustomRole { public override string Name { get; set; } = "ZoneManager"; public override string Description { get; set; } = "Tu es un Zone Manager \nT'as une carte de zone manager (d'où le nom) \nTu commences à heavy \nBon courage..."; - public override uint Id { get; set; } = 1044; + public override uint Id { get; set; } = 1404; public override string CustomInfo { get; set; } = "ZoneManager"; public override int MaxHealth { get; set; } = 100; public override RoleTypeId Role { get; set; } = RoleTypeId.Scientist; @@ -28,7 +28,7 @@ internal class ZoneManager : Exiled.CustomRoles.API.Features.CustomRole { new DynamicSpawnPoint() { - Location = Exiled.API.Enums.SpawnLocationType.InsideNukeArmory, + Location = Exiled.API.Enums.SpawnLocationType.InsideHidLower, Chance = 100, } } diff --git a/KruacentExiled/KE.CustomRoles/KE.CustomRoles.csproj b/KruacentExiled/KE.CustomRoles/KE.CustomRoles.csproj index a5fbc0e2..5b7382b3 100644 --- a/KruacentExiled/KE.CustomRoles/KE.CustomRoles.csproj +++ b/KruacentExiled/KE.CustomRoles/KE.CustomRoles.csproj @@ -4,7 +4,7 @@ - + From 14b6ea6c7bc0c78cc79146fd476cc4ab3d268744 Mon Sep 17 00:00:00 2001 From: Omer <113857370+OmerGS@users.noreply.github.com> Date: Mon, 27 Jan 2025 10:43:02 +0100 Subject: [PATCH 140/853] Create RoleList.md --- KruacentExiled/KE.CustomRoles/RoleList.md | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 KruacentExiled/KE.CustomRoles/RoleList.md diff --git a/KruacentExiled/KE.CustomRoles/RoleList.md b/KruacentExiled/KE.CustomRoles/RoleList.md new file mode 100644 index 00000000..c7adb865 --- /dev/null +++ b/KruacentExiled/KE.CustomRoles/RoleList.md @@ -0,0 +1,16 @@ +# Custom Roles + +| ID | Item Name | Description | Role | +|--------|-----------------------|------------------------------------------|---------------| +| 1401 | Enfant | Smaller than normal | Class-D | +| 1402 | Asthmatique | Reduce stamina, better aim with SCP-1853. | Class-D | +| 1403 | Gamble Addict | Spawn with 4 coins. | Scientist | +| 1404 | Zone Manager | Spawn with zone manager card in Heavy | Scientist | +| 1405 | 914 Guard | Guard protecting 914. | Guard | +| 1406 | Chief Guard | Guard with better equipment | Guard | +| 1407 | Paper 049 | Thin SCP-049 | SCP-049 | +| 1408 | Small 049 | Small SCP-049 | SCP-049 | +| 1409 | Tall 173 | Tall SCP-173 | SCP-173 | +| 1410 | Russe | Spawn with revolver, he need to do russian roulette | Chaos Insurgency | +| 1411 | Tank | More HP, more ammo but slower | Mobile Task Force | +| 1412 | Terroriste | He spawn with more grenade. | Mobile Task Force | From 389e8f8f9cc9197608be5346a6e2c69dda22c77e Mon Sep 17 00:00:00 2001 From: Omer <113857370+OmerGS@users.noreply.github.com> Date: Mon, 27 Jan 2025 10:54:27 +0100 Subject: [PATCH 141/853] fix/global event id --- .../KE.GlobalEventFramework.Examples/GE/BrokenGenerator.cs | 2 +- .../KE.GlobalEventFramework.Examples/GE/CassieGoCrazy.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/KruacentExiled/KE.GlobalEventFramework.Examples/GE/BrokenGenerator.cs b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/BrokenGenerator.cs index 22fb0443..e49149d7 100644 --- a/KruacentExiled/KE.GlobalEventFramework.Examples/GE/BrokenGenerator.cs +++ b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/BrokenGenerator.cs @@ -14,7 +14,7 @@ namespace KE.GlobalEventFramework.Examples.GE { public class BrokenGenerator : GlobalEvent, IStart { - public override uint Id { get; set; } = 1051; + public override uint Id { get; set; } = 1050; public override string Name { get; set; } = "Broken Generator"; public override string Description { get; set; } = "Repair the generator to be able to see !"; public override int Weight { get; set; } = 1; diff --git a/KruacentExiled/KE.GlobalEventFramework.Examples/GE/CassieGoCrazy.cs b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/CassieGoCrazy.cs index c6fc7967..733ad966 100644 --- a/KruacentExiled/KE.GlobalEventFramework.Examples/GE/CassieGoCrazy.cs +++ b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/CassieGoCrazy.cs @@ -15,7 +15,7 @@ namespace KE.GlobalEventFramework.Examples.GE public class CassieGoCrazy : GlobalEvent, IStart { /// - public override uint Id { get; set; } = 1059; + public override uint Id { get; set; } = 1049; /// public override string Name { get; set; } = "Cassie Go Crazy"; /// From 7a729089c16bfff0b74ee8608be0c96d45357fec Mon Sep 17 00:00:00 2001 From: Omer <113857370+OmerGS@users.noreply.github.com> Date: Mon, 27 Jan 2025 10:54:42 +0100 Subject: [PATCH 142/853] Create GlobalEventList.md --- .../GlobalEventList.md | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 KruacentExiled/KE.GlobalEventFramework.Examples/GlobalEventList.md diff --git a/KruacentExiled/KE.GlobalEventFramework.Examples/GlobalEventList.md b/KruacentExiled/KE.GlobalEventFramework.Examples/GlobalEventList.md new file mode 100644 index 00000000..abcf2664 --- /dev/null +++ b/KruacentExiled/KE.GlobalEventFramework.Examples/GlobalEventList.md @@ -0,0 +1,15 @@ +# Global Event + +| ID | Global Event | Description | +|--------|-----------------------|--------------------| +| 0 | nothing | y'a r | +| 1041 | System Malfunction | On dirait que les systèmes informatiques sont défaillants | +| 1042 | Speed | Gas! Gas! Gas! | +| 1043 | Random Spawn | Les spawns sont random | +| 1044 | Impostor | Ne vous fiez pas aux apparences ! | +| 1045 | Shuffle | et ça fait roomba café dans le scp | +| 1046 | Blitz | éteignez les lumières la luftwaffe arrive | +| 1047 | KIWIS | Kill It While It's Small | +| 1048 | OpenBar | j'espère que vous avez pas prévu de kampé | +| 1049 | Cassie Go Crazy | Crazy Cassie ! | +| 1050 | Broken Generator | Repair the generator to be able to see !| From b0625140b427ff557a1d8aba8a2f239ddee15cc4 Mon Sep 17 00:00:00 2001 From: Omer <113857370+OmerGS@users.noreply.github.com> Date: Mon, 27 Jan 2025 10:55:14 +0100 Subject: [PATCH 143/853] Update RoleList.md --- KruacentExiled/KE.CustomRoles/RoleList.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/KruacentExiled/KE.CustomRoles/RoleList.md b/KruacentExiled/KE.CustomRoles/RoleList.md index c7adb865..1cb4635f 100644 --- a/KruacentExiled/KE.CustomRoles/RoleList.md +++ b/KruacentExiled/KE.CustomRoles/RoleList.md @@ -1,6 +1,6 @@ # Custom Roles -| ID | Item Name | Description | Role | +| ID | Role Name | Description | Role | |--------|-----------------------|------------------------------------------|---------------| | 1401 | Enfant | Smaller than normal | Class-D | | 1402 | Asthmatique | Reduce stamina, better aim with SCP-1853. | Class-D | From dbe1f00804918f252e0d5d6a4e66a1b3d07423df Mon Sep 17 00:00:00 2001 From: Omer <113857370+OmerGS@users.noreply.github.com> Date: Mon, 27 Jan 2025 11:10:59 +0100 Subject: [PATCH 144/853] Create README.md --- .../KE.GlobalEventFramework/README.md | 122 ++++++++++++++++++ 1 file changed, 122 insertions(+) create mode 100644 KruacentExiled/KE.GlobalEventFramework/README.md diff --git a/KruacentExiled/KE.GlobalEventFramework/README.md b/KruacentExiled/KE.GlobalEventFramework/README.md new file mode 100644 index 00000000..f0db31fc --- /dev/null +++ b/KruacentExiled/KE.GlobalEventFramework/README.md @@ -0,0 +1,122 @@ +# How to Create a Global Event + +This guide explains how to create a custom Global Event using the KE.GlobalEventFramework. A Global Event is a feature that introduces unique gameplay mechanics or effects during a round in SCP: Secret Laboratory. + +## Prerequisites +1. **Knowledge of C#**: Basic understanding of C#. +2. **Exiled Framework**: Knowledge about the Exiled API is recommended. + +--- + +## Step 1: Create a Class for the Global Event +Each Global Event must inherit from the `GlobalEvent` base class provided by the framework. + +### Example: +```csharp +using KE.GlobalEventFramework.GEFE.API.Features; + +namespace MyPlugin.GlobalEvents +{ + public class ExampleEvent : GlobalEvent + { + public override uint Id { get; set; } = 1234; + public override string Name { get; set; } = "ExampleEvent"; + public override string Description { get; set; } = "This is a sample global event."; + public override int Weight { get; set; } = 1; + } +} +``` + +- Id: A unique identifier for your event. +- Name: The name of your event. +- Description: A short description of the event. (displayed to player when the round start) +- Weight: The likelihood of this event being chosen compared to others. + +## Step 2: Implement Interfaces for Functionality +Global Events can implement additional interfaces to define behavior : +- IStart: Defines behavior when the event starts. +- IEvent: Handles event subscriptions. + +### Example with IStart: +```csharp +using System.Collections.Generic; +using MEC; + +public class ExampleEvent : GlobalEvent, IStart +{ + public IEnumerator Start() + { + // Code to execute when the event starts + yield return Timing.WaitForSeconds(1); + Log.Info("ExampleEvent has started!"); + } +} +``` + +### Example with IEvent: +```csharp +using Exiled.Events.EventArgs.Player; + +public class ExampleEvent : GlobalEvent, IEvent +{ + public void SubscribeEvent() + { + Exiled.Events.Handlers.Player.Hurting += OnPlayerHurt; + } + + public void UnsubscribeEvent() + { + Exiled.Events.Handlers.Player.Hurting -= OnPlayerHurt; + } + + private void OnPlayerHurt(HurtingEventArgs ev) + { + // Example effect: reduce all damage by half + ev.Amount /= 2; + } +} +``` + +## Step 3: Define Custom Behavior +You can add custom properties and methods to define the unique behavior of your Global Event. + +### Example: Opening All Doors +```csharp +using Exiled.API.Features.Doors; +using System.Linq; + +private void OpenAllDoors() +{ + Door.List.ToList().ForEach(door => + { + door.IsOpen = true; + }); +} +``` +You can call this method in your Start implementation or in your subscribed events. + +## Step 4: Handle Cleanup +It is essential to clean up your event's effects when it ends. This can be done in the UnsubscribeEvent method. + +### Exemple +```csharp +public void UnsubscribeEvent() +{ + Player.List.ToList().ForEach(player => player.DisableEffect()); +} +``` + +## Step 5: Test Your Event +- Compile your plugin and place the .dll file in the Plugins folder in EXILED folder. +- Configure your event to ensure it's loaded by the framework. +- Test the event in a controlled environment to verify its behavior. + +## Additional information +- Use IncompatibleGE to prevent certain events from running simultaneously. +```csharp +public override uint[] IncompatibleGE { get; set; } = { 101, 102 }; +``` + +- Leverage Exiled's logging system (Log.Info, Log.Error) for debugging. +- Refer to the [Exiled Repository](https://github.com/ExMod-Team/EXILED/tree/master/EXILED) for more information on available APIs. +- [Example of Global Event](https://github.com/Kruacent/Kruacent-Exiled/tree/GlobalEvent/KruacentExiled/KE.GlobalEventFramework.Examples/GE) From 22a58d708ffa38eaba7c9194582a3cebe3988962 Mon Sep 17 00:00:00 2001 From: Omer <113857370+OmerGS@users.noreply.github.com> Date: Mon, 27 Jan 2025 13:24:41 +0100 Subject: [PATCH 145/853] Rename GlobalEventList.md to README.md --- .../{GlobalEventList.md => README.md} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename KruacentExiled/KE.GlobalEventFramework.Examples/{GlobalEventList.md => README.md} (100%) diff --git a/KruacentExiled/KE.GlobalEventFramework.Examples/GlobalEventList.md b/KruacentExiled/KE.GlobalEventFramework.Examples/README.md similarity index 100% rename from KruacentExiled/KE.GlobalEventFramework.Examples/GlobalEventList.md rename to KruacentExiled/KE.GlobalEventFramework.Examples/README.md From f3314b6b8b292697d073cc540fdbb2a39fa710e9 Mon Sep 17 00:00:00 2001 From: Omer <113857370+OmerGS@users.noreply.github.com> Date: Mon, 27 Jan 2025 13:43:24 +0100 Subject: [PATCH 146/853] Rename ItemList.md to README.md --- KruacentExiled/KE.Items/{ItemList.md => README.md} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename KruacentExiled/KE.Items/{ItemList.md => README.md} (100%) diff --git a/KruacentExiled/KE.Items/ItemList.md b/KruacentExiled/KE.Items/README.md similarity index 100% rename from KruacentExiled/KE.Items/ItemList.md rename to KruacentExiled/KE.Items/README.md From dc0bdfe00dbd00b8bae45e8112eaf82867ec58a6 Mon Sep 17 00:00:00 2001 From: Omer <113857370+OmerGS@users.noreply.github.com> Date: Mon, 27 Jan 2025 13:48:33 +0100 Subject: [PATCH 147/853] add/SwapProtocol (untested) --- .../GE/SwapProtocol.cs | 59 +++++++++++++++++++ 1 file changed, 59 insertions(+) create mode 100644 KruacentExiled/KE.GlobalEventFramework.Examples/GE/SwapProtocol.cs diff --git a/KruacentExiled/KE.GlobalEventFramework.Examples/GE/SwapProtocol.cs b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/SwapProtocol.cs new file mode 100644 index 00000000..de880747 --- /dev/null +++ b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/SwapProtocol.cs @@ -0,0 +1,59 @@ +using Player = Exiled.API.Features.Player; +using System.Collections.Generic; +using KE.GlobalEventFramework.GEFE.API.Features; +using KE.GlobalEventFramework.GEFE.API.Interfaces; +using MEC; +using System.Linq; +using Exiled.API.Extensions; +using Exiled.API.Features; + +namespace KE.GlobalEventFramework.Examples.GE +{ + public class SwapProtocol : GlobalEvent, IStart + { + public override uint Id { get; set; } = 1051; + public override string Name { get; set; } = "SwapProtocol"; + public override string Description { get; set; } = "EEEEEEEET c'est parti la roulette tourne"; + public override int Weight { get; set; } = 1; + + public IEnumerator Start() + { + while (!Round.IsEnded) + { + // every 5 min + yield return Timing.WaitForSeconds(300); + ChangingPlayer(); + } + } + + private void ChangingPlayer() + { + // Liste des joueurs vivants + List playerInServer = Player.List.Where(p => !p.IsNPC).ToList(); + + if (playerInServer.Count < 2) + { + Log.Warn("Pas assez de joueurs vivants pour effectuer un échange !"); + return; + } + + Log.Debug("===== Liste des joueurs avant permutation ====="); + playerInServer.ForEach(p => Log.Debug($"{p.Nickname} ({p.Role})")); + + // Mélanger la liste des joueurs + playerInServer.ShuffleList(); + + // Copier les données actuelles des joueurs + var playersRoles = playerInServer.Select(p => p.Role).ToList(); + + // Permutation circulaire des rôles et pseudonymes + for (int i = 0; i < playerInServer.Count; i++) + { + int nextIndex = (i + 1) % playerInServer.Count; + playerInServer[i].Role.Set(playersRoles[nextIndex]); + } + } + + + } +} \ No newline at end of file From e11f63fd6fc6b16e580783967ad0f214725ba087 Mon Sep 17 00:00:00 2001 From: Omer <113857370+OmerGS@users.noreply.github.com> Date: Mon, 27 Jan 2025 14:53:16 +0100 Subject: [PATCH 148/853] Rename RoleList.md to README.md --- KruacentExiled/KE.CustomRoles/{RoleList.md => README.md} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename KruacentExiled/KE.CustomRoles/{RoleList.md => README.md} (100%) diff --git a/KruacentExiled/KE.CustomRoles/RoleList.md b/KruacentExiled/KE.CustomRoles/README.md similarity index 100% rename from KruacentExiled/KE.CustomRoles/RoleList.md rename to KruacentExiled/KE.CustomRoles/README.md From adc0eaa9fda1443abbffe10e0ef307986ebece6e Mon Sep 17 00:00:00 2001 From: Omer <113857370+OmerGS@users.noreply.github.com> Date: Tue, 28 Jan 2025 22:11:47 +0100 Subject: [PATCH 149/853] fix/corrected role id --- .../CR/ChaosInsurgency/LeRusse.cs | 2 +- .../KE.CustomRoles/CR/ClassD/Asthmatique.cs | 2 +- .../KE.CustomRoles/CR/ClassD/Enfant.cs | 2 +- .../KE.CustomRoles/CR/Guard/ChiefGuard.cs | 2 +- .../KE.CustomRoles/CR/Guard/Guard914.cs | 2 +- KruacentExiled/KE.CustomRoles/CR/MTF/Tank.cs | 4 ++-- .../KE.CustomRoles/CR/MTF/Terroriste.cs | 2 +- .../KE.CustomRoles/CR/SCP/Paper049.cs | 2 +- .../KE.CustomRoles/CR/SCP/Small049.cs | 2 +- .../KE.CustomRoles/CR/SCP/Small173.cs | 2 +- .../CR/Scientist/GambleAddict.cs | 2 +- .../CR/Scientist/ZoneManager.cs | 2 +- KruacentExiled/KE.CustomRoles/README.md | 24 +++++++++---------- 13 files changed, 25 insertions(+), 25 deletions(-) diff --git a/KruacentExiled/KE.CustomRoles/CR/ChaosInsurgency/LeRusse.cs b/KruacentExiled/KE.CustomRoles/CR/ChaosInsurgency/LeRusse.cs index f710cebb..6b3aabdd 100644 --- a/KruacentExiled/KE.CustomRoles/CR/ChaosInsurgency/LeRusse.cs +++ b/KruacentExiled/KE.CustomRoles/CR/ChaosInsurgency/LeRusse.cs @@ -11,7 +11,7 @@ internal class Russe : Exiled.CustomRoles.API.Features.CustomRole { public override string Name { get; set; } = "Russe"; public override string Description { get; set; } = "Tu es un maitre de jeu \ntu dois faire la roulette russe avec les autres joueurs"; - public override uint Id { get; set; } = 1410; + public override uint Id { get; set; } = 1050; public override string CustomInfo { get; set; } = "Le Russe"; public override int MaxHealth { get; set; } = 100; public override RoleTypeId Role { get; set; } = RoleTypeId.ChaosConscript; diff --git a/KruacentExiled/KE.CustomRoles/CR/ClassD/Asthmatique.cs b/KruacentExiled/KE.CustomRoles/CR/ClassD/Asthmatique.cs index 953a4018..79d1e456 100644 --- a/KruacentExiled/KE.CustomRoles/CR/ClassD/Asthmatique.cs +++ b/KruacentExiled/KE.CustomRoles/CR/ClassD/Asthmatique.cs @@ -12,7 +12,7 @@ internal class Asthmatique : Exiled.CustomRoles.API.Features.CustomRole { public override string Name { get; set; } = "Asthmatique"; public override string Description { get; set; } = "Tu es asthmatique\nT'as stamina est réduit de moitié\nMais tu vises mieux"; - public override uint Id { get; set; } = 1402; + public override uint Id { get; set; } = 1042; public override string CustomInfo { get; set; } = "Asmathique"; public override int MaxHealth { get; set; } = 100; public override RoleTypeId Role { get; set; } = RoleTypeId.ClassD; diff --git a/KruacentExiled/KE.CustomRoles/CR/ClassD/Enfant.cs b/KruacentExiled/KE.CustomRoles/CR/ClassD/Enfant.cs index 1df5ab5d..eff5d784 100644 --- a/KruacentExiled/KE.CustomRoles/CR/ClassD/Enfant.cs +++ b/KruacentExiled/KE.CustomRoles/CR/ClassD/Enfant.cs @@ -11,7 +11,7 @@ internal class Enfant : Exiled.CustomRoles.API.Features.CustomRole { public override string Name { get; set; } = "enfant"; public override string Description { get; set; } = "Tu es un Enfant \ndo not the kid \ntu commences avec un bonbon arc-en-ciel \n t'es un peu plus petit que la normal"; - public override uint Id { get; set; } = 1401; + public override uint Id { get; set; } = 1041; public override string CustomInfo { get; set; } = "Enfant"; public override int MaxHealth { get; set; } = 100; public override RoleTypeId Role { get; set; } = RoleTypeId.ClassD; diff --git a/KruacentExiled/KE.CustomRoles/CR/Guard/ChiefGuard.cs b/KruacentExiled/KE.CustomRoles/CR/Guard/ChiefGuard.cs index fe837785..bbccfd2e 100644 --- a/KruacentExiled/KE.CustomRoles/CR/Guard/ChiefGuard.cs +++ b/KruacentExiled/KE.CustomRoles/CR/Guard/ChiefGuard.cs @@ -10,7 +10,7 @@ internal class ChiefGuard : Exiled.CustomRoles.API.Features.CustomRole { public override string Name { get; set; } = "ChiefGuard"; public override string Description { get; set; } = "Tu es un Chef des gardes du site \nT'as une carte de private \net un crossvec"; - public override uint Id { get; set; } = 1406; + public override uint Id { get; set; } = 1046; public override string CustomInfo { get; set; } = "Chef des Gardes"; public override int MaxHealth { get; set; } = 100; public override RoleTypeId Role { get; set; } = RoleTypeId.FacilityGuard; diff --git a/KruacentExiled/KE.CustomRoles/CR/Guard/Guard914.cs b/KruacentExiled/KE.CustomRoles/CR/Guard/Guard914.cs index 612bb3e1..e8e7a615 100644 --- a/KruacentExiled/KE.CustomRoles/CR/Guard/Guard914.cs +++ b/KruacentExiled/KE.CustomRoles/CR/Guard/Guard914.cs @@ -11,7 +11,7 @@ internal class Guard914 : Exiled.CustomRoles.API.Features.CustomRole { public override string Name { get; set; } = "guard914"; public override string Description { get; set; } = "Tu es Le garde de SCP-914 \nTu commences à 914 \nmais on a volé ta carte \net ntm aussi"; - public override uint Id { get; set; } = 1405; + public override uint Id { get; set; } = 1045; public override string CustomInfo { get; set; } = "Garde de 914"; public override int MaxHealth { get; set; } = 100; public override RoleTypeId Role { get; set; } = RoleTypeId.FacilityGuard; diff --git a/KruacentExiled/KE.CustomRoles/CR/MTF/Tank.cs b/KruacentExiled/KE.CustomRoles/CR/MTF/Tank.cs index 477581c8..9e7b49ee 100644 --- a/KruacentExiled/KE.CustomRoles/CR/MTF/Tank.cs +++ b/KruacentExiled/KE.CustomRoles/CR/MTF/Tank.cs @@ -14,8 +14,8 @@ namespace KE.CustomRoles.CR.ClassD internal class Tank : Exiled.CustomRoles.API.Features.CustomRole { public override string Name { get; set; } = "Tank"; - public override string Description { get; set; } = "Tu es un TANK tu es débuff mais ta force de tir est démultiplié"; - public override uint Id { get; set; } = 1411; + public override string Description { get; set; } = "Tu es un TANK tu es débuff mais ta force de tir est démultiplié (fait attention à tes balles)"; + public override uint Id { get; set; } = 1051; public override string CustomInfo { get; set; } = "Tank"; public override int MaxHealth { get; set; } = 200; public override RoleTypeId Role { get; set; } = RoleTypeId.NtfCaptain; diff --git a/KruacentExiled/KE.CustomRoles/CR/MTF/Terroriste.cs b/KruacentExiled/KE.CustomRoles/CR/MTF/Terroriste.cs index 228efff2..c52af3ce 100644 --- a/KruacentExiled/KE.CustomRoles/CR/MTF/Terroriste.cs +++ b/KruacentExiled/KE.CustomRoles/CR/MTF/Terroriste.cs @@ -11,7 +11,7 @@ internal class Terroriste : Exiled.CustomRoles.API.Features.CustomRole { public override string Name { get; set; } = "Terroriste"; public override string Description { get; set; } = "Tu es un Terroriste \nne fait pas exploser la facilité \ntu commences avec des grenades"; - public override uint Id { get; set; } = 1412; + public override uint Id { get; set; } = 1052; public override string CustomInfo { get; set; } = "Terroriste"; public override int MaxHealth { get; set; } = 100; public override RoleTypeId Role { get; set; } = RoleTypeId.NtfSergeant; diff --git a/KruacentExiled/KE.CustomRoles/CR/SCP/Paper049.cs b/KruacentExiled/KE.CustomRoles/CR/SCP/Paper049.cs index 54913fd1..c046b151 100644 --- a/KruacentExiled/KE.CustomRoles/CR/SCP/Paper049.cs +++ b/KruacentExiled/KE.CustomRoles/CR/SCP/Paper049.cs @@ -9,7 +9,7 @@ internal class Paper049 : Exiled.CustomRoles.API.Features.CustomRole { public override string Name { get; set; } = "Paper049"; public override string Description { get; set; } = "u are a paper doctor"; - public override uint Id { get; set; } = 1407; + public override uint Id { get; set; } = 1047; public override string CustomInfo { get; set; } = "Paper Doctor"; public override int MaxHealth { get; set; } = 2300; public override RoleTypeId Role { get; set; } = RoleTypeId.Scp049; diff --git a/KruacentExiled/KE.CustomRoles/CR/SCP/Small049.cs b/KruacentExiled/KE.CustomRoles/CR/SCP/Small049.cs index a3b1296c..1b06cffc 100644 --- a/KruacentExiled/KE.CustomRoles/CR/SCP/Small049.cs +++ b/KruacentExiled/KE.CustomRoles/CR/SCP/Small049.cs @@ -11,7 +11,7 @@ internal class Small049 : Exiled.CustomRoles.API.Features.CustomRole { public override string Name { get; set; } = "Small049"; public override string Description { get; set; } = "u are a smoll doctor"; - public override uint Id { get; set; } = 1408; + public override uint Id { get; set; } = 1048; public override string CustomInfo { get; set; } = "Small Doctor"; public override int MaxHealth { get; set; } = 2300; public override RoleTypeId Role { get; set; } = RoleTypeId.Scp049; diff --git a/KruacentExiled/KE.CustomRoles/CR/SCP/Small173.cs b/KruacentExiled/KE.CustomRoles/CR/SCP/Small173.cs index 8d344be4..0f12937e 100644 --- a/KruacentExiled/KE.CustomRoles/CR/SCP/Small173.cs +++ b/KruacentExiled/KE.CustomRoles/CR/SCP/Small173.cs @@ -9,7 +9,7 @@ internal class Small173 : Exiled.CustomRoles.API.Features.CustomRole { public override string Name { get; set; } = "Tall173"; public override string Description { get; set; } = " Tall NUT \nu tol\n fuck you"; - public override uint Id { get; set; } = 1409; + public override uint Id { get; set; } = 1049; public override string CustomInfo { get; set; } = "Small Peanuts"; public override int MaxHealth { get; set; } = 4500; public override RoleTypeId Role { get; set; } = RoleTypeId.Scp173; diff --git a/KruacentExiled/KE.CustomRoles/CR/Scientist/GambleAddict.cs b/KruacentExiled/KE.CustomRoles/CR/Scientist/GambleAddict.cs index 2f14d985..d12d3192 100644 --- a/KruacentExiled/KE.CustomRoles/CR/Scientist/GambleAddict.cs +++ b/KruacentExiled/KE.CustomRoles/CR/Scientist/GambleAddict.cs @@ -10,7 +10,7 @@ internal class GambleAddict : Exiled.CustomRoles.API.Features.CustomRole { public override string Name { get; set; } = "GambleAddict"; public override string Description { get; set; } = "Tu es un Gamble Addict \nT'as trade ton kit et ta carte contre 4 pièces \nfais en bon usage"; - public override uint Id { get; set; } = 1403; + public override uint Id { get; set; } = 1043; public override string CustomInfo { get; set; } = "GambleAddict"; public override int MaxHealth { get; set; } = 100; public override RoleTypeId Role { get; set; } = RoleTypeId.Scientist; diff --git a/KruacentExiled/KE.CustomRoles/CR/Scientist/ZoneManager.cs b/KruacentExiled/KE.CustomRoles/CR/Scientist/ZoneManager.cs index 94d48648..e92b203f 100644 --- a/KruacentExiled/KE.CustomRoles/CR/Scientist/ZoneManager.cs +++ b/KruacentExiled/KE.CustomRoles/CR/Scientist/ZoneManager.cs @@ -12,7 +12,7 @@ internal class ZoneManager : Exiled.CustomRoles.API.Features.CustomRole { public override string Name { get; set; } = "ZoneManager"; public override string Description { get; set; } = "Tu es un Zone Manager \nT'as une carte de zone manager (d'où le nom) \nTu commences à heavy \nBon courage..."; - public override uint Id { get; set; } = 1404; + public override uint Id { get; set; } = 1044; public override string CustomInfo { get; set; } = "ZoneManager"; public override int MaxHealth { get; set; } = 100; public override RoleTypeId Role { get; set; } = RoleTypeId.Scientist; diff --git a/KruacentExiled/KE.CustomRoles/README.md b/KruacentExiled/KE.CustomRoles/README.md index 1cb4635f..4bb7fa2d 100644 --- a/KruacentExiled/KE.CustomRoles/README.md +++ b/KruacentExiled/KE.CustomRoles/README.md @@ -2,15 +2,15 @@ | ID | Role Name | Description | Role | |--------|-----------------------|------------------------------------------|---------------| -| 1401 | Enfant | Smaller than normal | Class-D | -| 1402 | Asthmatique | Reduce stamina, better aim with SCP-1853. | Class-D | -| 1403 | Gamble Addict | Spawn with 4 coins. | Scientist | -| 1404 | Zone Manager | Spawn with zone manager card in Heavy | Scientist | -| 1405 | 914 Guard | Guard protecting 914. | Guard | -| 1406 | Chief Guard | Guard with better equipment | Guard | -| 1407 | Paper 049 | Thin SCP-049 | SCP-049 | -| 1408 | Small 049 | Small SCP-049 | SCP-049 | -| 1409 | Tall 173 | Tall SCP-173 | SCP-173 | -| 1410 | Russe | Spawn with revolver, he need to do russian roulette | Chaos Insurgency | -| 1411 | Tank | More HP, more ammo but slower | Mobile Task Force | -| 1412 | Terroriste | He spawn with more grenade. | Mobile Task Force | +| 1041 | Enfant | Smaller than normal | Class-D | +| 1042 | Asthmatique | Reduce stamina, better aim with SCP-1853. | Class-D | +| 1043 | Gamble Addict | Spawn with 4 coins. | Scientist | +| 1044 | Zone Manager | Spawn with zone manager card in Heavy | Scientist | +| 1045 | 914 Guard | Guard protecting 914. | Guard | +| 1046 | Chief Guard | Guard with better equipment | Guard | +| 1047 | Paper 049 | Thin SCP-049 | SCP-049 | +| 1048 | Small 049 | Small SCP-049 | SCP-049 | +| 1049 | Tall 173 | Tall SCP-173 | SCP-173 | +| 1050 | Russe | Spawn with revolver, he need to do russian roulette | Chaos Insurgency | +| 1051 | Tank | More HP, more ammo but slower | Mobile Task Force | +| 1052 | Terroriste | He spawn with more grenade. | Mobile Task Force | From 9a976dd462e29aff4beb4410a7e4661c0c24795e Mon Sep 17 00:00:00 2001 From: Omer <113857370+OmerGS@users.noreply.github.com> Date: Tue, 28 Jan 2025 22:13:04 +0100 Subject: [PATCH 150/853] fix/add hint when asthmatique role was given --- KruacentExiled/KE.CustomRoles/CR/ClassD/Asthmatique.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/KruacentExiled/KE.CustomRoles/CR/ClassD/Asthmatique.cs b/KruacentExiled/KE.CustomRoles/CR/ClassD/Asthmatique.cs index 79d1e456..31699f5c 100644 --- a/KruacentExiled/KE.CustomRoles/CR/ClassD/Asthmatique.cs +++ b/KruacentExiled/KE.CustomRoles/CR/ClassD/Asthmatique.cs @@ -21,6 +21,7 @@ internal class Asthmatique : Exiled.CustomRoles.API.Features.CustomRole public override bool IgnoreSpawnSystem { get; set; } = true; public override void AddRole(Player player) { + player.ShowHint("Tu es asthmatique\nT'as stamina est réduit de moitié\nMais tu vises mieux"); player.EnableEffect(EffectType.Scp1853, -1,true); player.EnableEffect(EffectType.Exhausted, -1, true); } From 8bdf82978477a6728a717cc30df264fe80c5e638 Mon Sep 17 00:00:00 2001 From: Omer <113857370+OmerGS@users.noreply.github.com> Date: Tue, 28 Jan 2025 22:33:12 +0100 Subject: [PATCH 151/853] fix/ custom item id --- .../KE.Items/Items/AdrenalineDrogue.cs | 2 +- KruacentExiled/KE.Items/Items/Defibrilator.cs | 2 +- .../KE.Items/Items/DeployableWall.cs | 2 +- KruacentExiled/KE.Items/Items/DivinePills.cs | 2 +- KruacentExiled/KE.Items/Items/HealZone.cs | 2 +- KruacentExiled/KE.Items/Items/ImpactFlash.cs | 2 +- KruacentExiled/KE.Items/Items/Mine.cs | 2 +- KruacentExiled/KE.Items/Items/Molotov.cs | 2 +- KruacentExiled/KE.Items/Items/PressePuree.cs | 2 +- .../KE.Items/Items/SainteGrenada.cs | 2 +- KruacentExiled/KE.Items/Items/TPGrenada.cs | 2 +- .../KE.Items/Items/TrueDivinePills.cs | 2 +- KruacentExiled/KE.Items/README.md | 26 +++++++++---------- 13 files changed, 25 insertions(+), 25 deletions(-) diff --git a/KruacentExiled/KE.Items/Items/AdrenalineDrogue.cs b/KruacentExiled/KE.Items/Items/AdrenalineDrogue.cs index ba54b9af..80396058 100644 --- a/KruacentExiled/KE.Items/Items/AdrenalineDrogue.cs +++ b/KruacentExiled/KE.Items/Items/AdrenalineDrogue.cs @@ -18,7 +18,7 @@ public class AdrenalineDrogue : CustomItem, ILumosItem { /// - public override uint Id { get; set; } = 1402; + public override uint Id { get; set; } = 1042; /// public override string Name { get; set; } = "DA-020"; diff --git a/KruacentExiled/KE.Items/Items/Defibrilator.cs b/KruacentExiled/KE.Items/Items/Defibrilator.cs index f73b9ee0..f2f0cf85 100644 --- a/KruacentExiled/KE.Items/Items/Defibrilator.cs +++ b/KruacentExiled/KE.Items/Items/Defibrilator.cs @@ -14,7 +14,7 @@ [CustomItem(ItemType.SCP1853)] public class Defibrilator : CustomItem, ILumosItem { - public override uint Id { get; set; } = 1401; + public override uint Id { get; set; } = 1041; public override string Name { get; set; } = "Defibrilator"; public override string Description { get; set; } = "The defibrillator is used to revive a person who has lost consciousness. It will revive the person closest to the player who uses it (the location of death, not where the body is)."; public override float Weight { get; set; } = 0.65f; diff --git a/KruacentExiled/KE.Items/Items/DeployableWall.cs b/KruacentExiled/KE.Items/Items/DeployableWall.cs index 90ffcf36..f2a9c658 100644 --- a/KruacentExiled/KE.Items/Items/DeployableWall.cs +++ b/KruacentExiled/KE.Items/Items/DeployableWall.cs @@ -15,7 +15,7 @@ namespace KE.Items.Items public class DeployableWall : CustomItem, ILumosItem { - public override uint Id { get; set; } = 1408; + public override uint Id { get; set; } = 1048; public override string Name { get; set; } = "Deployable Wall"; public override string Description { get; set; } = "Drop to deploy a wall, and throw to just throw the card"; public override float Weight { get; set; } = 0.65f; diff --git a/KruacentExiled/KE.Items/Items/DivinePills.cs b/KruacentExiled/KE.Items/Items/DivinePills.cs index b70cd405..863447b8 100644 --- a/KruacentExiled/KE.Items/Items/DivinePills.cs +++ b/KruacentExiled/KE.Items/Items/DivinePills.cs @@ -24,7 +24,7 @@ public class DivinePills : CustomItem, ILumosItem { /// - public override uint Id { get; set; } = 1407; + public override uint Id { get; set; } = 1047; /// public override string Name { get; set; } = "Divine Pills"; diff --git a/KruacentExiled/KE.Items/Items/HealZone.cs b/KruacentExiled/KE.Items/Items/HealZone.cs index 3fa59658..da61139d 100644 --- a/KruacentExiled/KE.Items/Items/HealZone.cs +++ b/KruacentExiled/KE.Items/Items/HealZone.cs @@ -15,7 +15,7 @@ namespace KE.Items.Items [CustomItem(ItemType.GrenadeFlash)] public class HealZone : CustomGrenade, ILumosItem { - public override uint Id { get; set; } = 1411; + public override uint Id { get; set; } = 1051; public override string Name { get; set; } = "Heal Zone"; public override string Description { get; set; } = "Allow to heal you and your ally"; public override float Weight { get; set; } = 0.65f; diff --git a/KruacentExiled/KE.Items/Items/ImpactFlash.cs b/KruacentExiled/KE.Items/Items/ImpactFlash.cs index 431049ef..24977a8a 100644 --- a/KruacentExiled/KE.Items/Items/ImpactFlash.cs +++ b/KruacentExiled/KE.Items/Items/ImpactFlash.cs @@ -9,7 +9,7 @@ namespace KE.Items.Items [CustomItem(ItemType.GrenadeFlash)] public class ImpactFlash : CustomGrenade { - public override uint Id { get; set; } = 1412; + public override uint Id { get; set; } = 1052; public override string Name { get; set; } = "Impact Flash"; public override string Description { get; set; } = "The grenade explode at impact"; public override float Weight { get; set; } = 0.65f; diff --git a/KruacentExiled/KE.Items/Items/Mine.cs b/KruacentExiled/KE.Items/Items/Mine.cs index 8e732e2b..decb7335 100644 --- a/KruacentExiled/KE.Items/Items/Mine.cs +++ b/KruacentExiled/KE.Items/Items/Mine.cs @@ -18,7 +18,7 @@ namespace KE.Items.Items [CustomItem(ItemType.KeycardJanitor)] public class Mine : CustomItem, ILumosItem { - public override uint Id { get; set; } = 1413; + public override uint Id { get; set; } = 1053; public override string Name { get; set; } = "Mine"; public override string Description { get; set; } = "Drop to deploy the mine, little advice : don't step on it"; public override float Weight { get; set; } = 0.65f; diff --git a/KruacentExiled/KE.Items/Items/Molotov.cs b/KruacentExiled/KE.Items/Items/Molotov.cs index bdb206dc..c185882f 100644 --- a/KruacentExiled/KE.Items/Items/Molotov.cs +++ b/KruacentExiled/KE.Items/Items/Molotov.cs @@ -15,7 +15,7 @@ namespace KE.Items.Items [CustomItem(ItemType.GrenadeFlash)] public class Molotov : CustomGrenade, ILumosItem { - public override uint Id { get; set; } = 1409; + public override uint Id { get; set; } = 1049; public override string Name { get; set; } = "Cocktail Molotov"; public override string Description { get; set; } = "ARSON"; public override float Weight { get; set; } = 0.65f; diff --git a/KruacentExiled/KE.Items/Items/PressePuree.cs b/KruacentExiled/KE.Items/Items/PressePuree.cs index b1f886d7..ca3b54cd 100644 --- a/KruacentExiled/KE.Items/Items/PressePuree.cs +++ b/KruacentExiled/KE.Items/Items/PressePuree.cs @@ -13,7 +13,7 @@ namespace KE.Items.Items [CustomItem(ItemType.GrenadeHE)] public class PressePuree : CustomGrenade { - public override uint Id { get; set; } = 1406; + public override uint Id { get; set; } = 1046; public override string Name { get; set; } = "Presse Purée"; public override string Description { get; set; } = "The grenade explode at impact but does less damage"; public override float Weight { get; set; } = 0.65f; diff --git a/KruacentExiled/KE.Items/Items/SainteGrenada.cs b/KruacentExiled/KE.Items/Items/SainteGrenada.cs index be5b4bb0..d4656534 100644 --- a/KruacentExiled/KE.Items/Items/SainteGrenada.cs +++ b/KruacentExiled/KE.Items/Items/SainteGrenada.cs @@ -16,7 +16,7 @@ namespace KE.Items.Items [CustomItem(ItemType.GrenadeHE)] public class SainteGrenada : CustomGrenade, ILumosItem { - public override uint Id { get; set; } = 1415; + public override uint Id { get; set; } = 1055; public override string Name { get; set; } = "Sainte Grenada"; public override string Description { get; set; } = "Worms reference !?"; public override float Weight { get; set; } = 1.5f; diff --git a/KruacentExiled/KE.Items/Items/TPGrenada.cs b/KruacentExiled/KE.Items/Items/TPGrenada.cs index 881914db..c6603932 100644 --- a/KruacentExiled/KE.Items/Items/TPGrenada.cs +++ b/KruacentExiled/KE.Items/Items/TPGrenada.cs @@ -19,7 +19,7 @@ namespace KE.Items.Items public class TPGrenada : CustomGrenade, ILumosItem { private List effectedPlayers = new List(); - public override uint Id { get; set; } = 1405; + public override uint Id { get; set; } = 1045; public override string Name { get; set; } = "Teleportation Grenade"; public override string Description { get; set; } = "This grenade does 0 damage but teleport nearby players in a random place (does work in other dimension ;3 )"; public override float Weight { get; set; } = 0.65f; diff --git a/KruacentExiled/KE.Items/Items/TrueDivinePills.cs b/KruacentExiled/KE.Items/Items/TrueDivinePills.cs index 98ba900b..ff2eda7f 100644 --- a/KruacentExiled/KE.Items/Items/TrueDivinePills.cs +++ b/KruacentExiled/KE.Items/Items/TrueDivinePills.cs @@ -21,7 +21,7 @@ public class TrueDivinePills : CustomItem, ILumosItem { /// - public override uint Id { get; set; } = 1410; + public override uint Id { get; set; } = 1050; /// public override string Name { get; set; } = "True Divine Pills"; diff --git a/KruacentExiled/KE.Items/README.md b/KruacentExiled/KE.Items/README.md index dacec4de..65cad6cb 100644 --- a/KruacentExiled/KE.Items/README.md +++ b/KruacentExiled/KE.Items/README.md @@ -2,19 +2,19 @@ | ID | Item Name | Description | |--------|-----------------------|--------------------| -| 1401 | Defibrillator | Used to revive a player. | -| 1402 | Adrenaline Drogue | Temporarily boosts a player's abilities. | -| 1403 | No Item | No item associated. | -| 1404 | No Item | No item associated. | -| 1405 | TP Granada | Teleporting grenade. | -| 1406 | PressePurée | Grenade explode at impact | -| 1407 | Divine Pill | Respawn a random spectator. | -| 1408 | Deployable Wall | Creates a temporary wall. | -| 1409 | Molotov | Create a damage zone | -| 1410 | True Divine Pills | Respawn every spectator. | -| 1411 | Heal Zone | Area that heals allies. | -| 1412 | Impact Flash | Flash exploding at impact. | -| 1413 | Mine | Explosive mine. | +| 1041 | Defibrillator | Used to revive a player. | +| 1042 | Adrenaline Drogue | Temporarily boosts a player's abilities. | +| 1043 | No Item | No item associated. | +| 1044 | No Item | No item associated. | +| 1045 | TP Granada | Teleporting grenade. | +| 1046 | PressePurée | Grenade explode at impact | +| 1047 | Divine Pill | Respawn a random spectator. | +| 1048 | Deployable Wall | Creates a temporary wall. | +| 1049 | Molotov | Create a damage zone | +| 1050 | True Divine Pills | Respawn every spectator. | +| 1051 | Heal Zone | Area that heals allies. | +| 1052 | Impact Flash | Flash exploding at impact. | +| 1053 | Mine | Explosive mine. | ## Description From 66d8f82d4c2ff2e09128a54e10048f36b50f6d50 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Wed, 29 Jan 2025 05:02:12 +0100 Subject: [PATCH 152/853] added zombie doorman --- .../KE.CustomRoles/Abilities/OpenDoor.cs | 57 +++++++++++++++++++ .../KE.CustomRoles/CR/SCP/Small049.cs | 5 +- .../KE.CustomRoles/CR/SCP/ZombieDoorman.cs | 32 +++++++++++ 3 files changed, 91 insertions(+), 3 deletions(-) create mode 100644 KruacentExiled/KE.CustomRoles/Abilities/OpenDoor.cs create mode 100644 KruacentExiled/KE.CustomRoles/CR/SCP/ZombieDoorman.cs diff --git a/KruacentExiled/KE.CustomRoles/Abilities/OpenDoor.cs b/KruacentExiled/KE.CustomRoles/Abilities/OpenDoor.cs new file mode 100644 index 00000000..4ff85a55 --- /dev/null +++ b/KruacentExiled/KE.CustomRoles/Abilities/OpenDoor.cs @@ -0,0 +1,57 @@ +using Exiled.API.Features; +using Exiled.API.Features.Attributes; +using Exiled.CustomRoles.API.Features; +using Exiled.Events.EventArgs.Player; +using MEC; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace KE.CustomRoles.Abilities +{ + [CustomAbility] + internal class OpenDoor : ActiveAbility + { + public override string Name { get; set; } = "OpenDoor"; + + public override string Description { get; set; } = "Open a lock door at the cost of your health"; + + public override float Duration { get; set; } = 0f; + + public override float Cooldown { get; set; } = 45f; + private List _players = new List(); + + protected override void AbilityUsed(Player player) + { + player.ShowHint("interact with a door to open it",5f); + _players.Add(player); + Exiled.Events.Handlers.Player.InteractingDoor += OnInteractingDoor; + } + + protected override void UnsubscribeEvents() + { + Exiled.Events.Handlers.Player.InteractingDoor -= OnInteractingDoor; + base.UnsubscribeEvents(); + } + + private void OnInteractingDoor(InteractingDoorEventArgs ev) + { + if (!_players.Contains(ev.Player)) return; + if (ev.Door.IsOpen) return; + if (!ev.Door.IsKeycardDoor) return; + if(ev.Door.IsCheckpoint) return; + if(ev.Door.IsLocked) return; + + ev.IsAllowed = false; + ev.Player.ShowHint("The door will open in 5 seconds",5f); + ev.Player.Hurt(ev.Player.MaxHealth / 10,Exiled.API.Enums.DamageType.Strangled); + _players.Remove(ev.Player); + Timing.CallDelayed(5f, () => + { + ev.Door.IsOpen = true; + }); + } + } +} diff --git a/KruacentExiled/KE.CustomRoles/CR/SCP/Small049.cs b/KruacentExiled/KE.CustomRoles/CR/SCP/Small049.cs index 2ae2facb..85aaec7b 100644 --- a/KruacentExiled/KE.CustomRoles/CR/SCP/Small049.cs +++ b/KruacentExiled/KE.CustomRoles/CR/SCP/Small049.cs @@ -1,13 +1,12 @@ using Exiled.API.Features.Attributes; -using Exiled.API.Features.Roles; +using Exiled.CustomRoles.API.Features; using PlayerRoles; -using PluginAPI.Roles; using UnityEngine; namespace KE.CustomRoles.CR.SCP { [CustomRole(RoleTypeId.Scp049)] - internal class Small049 : Exiled.CustomRoles.API.Features.CustomRole + internal class Small049 : CustomRole { public override string Name { get; set; } = "Small049"; public override string Description { get; set; } = "u are a smoll doctor"; diff --git a/KruacentExiled/KE.CustomRoles/CR/SCP/ZombieDoorman.cs b/KruacentExiled/KE.CustomRoles/CR/SCP/ZombieDoorman.cs new file mode 100644 index 00000000..da5e9593 --- /dev/null +++ b/KruacentExiled/KE.CustomRoles/CR/SCP/ZombieDoorman.cs @@ -0,0 +1,32 @@ +using Exiled.API.Features.Attributes; +using Exiled.CustomRoles.API.Features; +using KE.CustomRoles.Abilities; +using PlayerRoles; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace KE.CustomRoles.CR.SCP +{ + [CustomRole(RoleTypeId.Scp0492)] + internal class ZombieDoorman : CustomRole + { + public override string Name { get; set; } = "SCP-049-2-Door"; + public override string Description { get; set; } = "U can open lock door with ur ability clapclapclap"; + public override uint Id { get; set; } = 1056; + public override string CustomInfo { get; set; } = "SCP-049-2-Door"; + public override int MaxHealth { get; set; } = 400; + public override RoleTypeId Role { get; set; } = RoleTypeId.Scp0492; + public override bool KeepRoleOnDeath { get; set; } = false; + public override bool KeepRoleOnChangingRole { get; set; } = false; + public override bool IgnoreSpawnSystem { get; set; } = true; + + public override float SpawnChance { get; set; } = 100; + public override List CustomAbilities { get; set; } = new List() + { + new OpenDoor() + }; + } +} From 2d255ccf4072a1f1d7896869ace639057ed70768 Mon Sep 17 00:00:00 2001 From: Omer <113857370+OmerGS@users.noreply.github.com> Date: Wed, 29 Jan 2025 13:49:51 +0100 Subject: [PATCH 153/853] fix/changing the work of impostor. --- .../GE/Impostor.cs | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/KruacentExiled/KE.GlobalEventFramework.Examples/GE/Impostor.cs b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/Impostor.cs index 36b64b9c..48a21131 100644 --- a/KruacentExiled/KE.GlobalEventFramework.Examples/GE/Impostor.cs +++ b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/Impostor.cs @@ -20,16 +20,17 @@ public IEnumerator Start() { while (!Round.IsEnded) { - int randomNumber = UnityEngine.Random.Range(180, 300); - yield return Timing.WaitForSeconds(randomNumber); - ChangingPlayer(); + yield return Timing.WaitForSeconds(UnityEngine.Random.Range(180, 300)); + + ChangingHumanApparence(); + ChangingSCPApparence(); } } - private void ChangingPlayer() + private void ChangingHumanApparence() { // Liste des joueurs vivants - List playerInServer = Player.List.Where(p => !p.IsNPC && p.IsAlive).ToList(); + List playerInServer = Player.List.Where(p => !p.IsNPC && p.IsAlive && !p.IsScp).ToList(); if (playerInServer.Count < 2) { @@ -66,6 +67,13 @@ private void ChangingPlayer() } } + private void ChangingSCPApparence() + { + Player randomHumanPlayer = Player.List.Where(p => !p.IsNPC && p.IsAlive && !p.IsScp).ToList().GetRandomValue(); + + Player randomScpPlayer = Player.List.Where(p => !p.IsNPC && p.IsAlive && p.IsScp).ToList().GetRandomValue(); + randomScpPlayer.ChangeAppearance(randomHumanPlayer.Role); + } } } \ No newline at end of file From 36ce60b18b24721112bbf67d8d0988f45e19889c Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Wed, 29 Jan 2025 14:19:10 +0100 Subject: [PATCH 154/853] optimization --- KruacentExiled/KE.Items/Items/DivinePills.cs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/KruacentExiled/KE.Items/Items/DivinePills.cs b/KruacentExiled/KE.Items/Items/DivinePills.cs index 863447b8..61b2a3c3 100644 --- a/KruacentExiled/KE.Items/Items/DivinePills.cs +++ b/KruacentExiled/KE.Items/Items/DivinePills.cs @@ -136,7 +136,7 @@ private void OnUsingItem(UsingItemEventArgs ev) Player player = ev.Player; - if(Player.List.Where(x => x.Role == RoleTypeId.Spectator).Count() == 0) + if(Player.List.Count(x => x.Role == RoleTypeId.Spectator) == 0) { player.ShowHint("No spectators to respawn"); ev.IsAllowed = false; @@ -148,7 +148,7 @@ private void OnUsingItem(UsingItemEventArgs ev) player.Kill("unlucky bro"); return; } - Player respawning = Player.List.Where(x => x.Role == RoleTypeId.Spectator).GetRandomValue(); + Player respawning = Player.List.GetRandomValue(x => x.Role == RoleTypeId.Spectator); switch (player.Role.Side) { case Side.ChaosInsurgency: @@ -158,8 +158,10 @@ private void OnUsingItem(UsingItemEventArgs ev) respawning.Role.Set(RoleTypeId.NtfPrivate); break; } + if (random > 75) { + Log.Debug("tp"); respawning.Teleport(player); } } From 81fa122d51467e1d514cdb0518e7aa92f96c5689 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Wed, 29 Jan 2025 14:41:30 +0100 Subject: [PATCH 155/853] corrected yet again the Asthmatique --- KruacentExiled/KE.CustomRoles/CR/ClassD/Asthmatique.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/KruacentExiled/KE.CustomRoles/CR/ClassD/Asthmatique.cs b/KruacentExiled/KE.CustomRoles/CR/ClassD/Asthmatique.cs index 31699f5c..c4002416 100644 --- a/KruacentExiled/KE.CustomRoles/CR/ClassD/Asthmatique.cs +++ b/KruacentExiled/KE.CustomRoles/CR/ClassD/Asthmatique.cs @@ -1,6 +1,7 @@ using Exiled.API.Enums; using Exiled.API.Features; using Exiled.API.Features.Attributes; +using Exiled.CustomRoles.API.Features; using PlayerRoles; using UnityEngine; using Utils.NonAllocLINQ; @@ -8,7 +9,7 @@ namespace KE.CustomRoles.CR.ClassD { [CustomRole(RoleTypeId.ClassD)] - internal class Asthmatique : Exiled.CustomRoles.API.Features.CustomRole + internal class Asthmatique : CustomRole { public override string Name { get; set; } = "Asthmatique"; public override string Description { get; set; } = "Tu es asthmatique\nT'as stamina est réduit de moitié\nMais tu vises mieux"; @@ -19,10 +20,9 @@ internal class Asthmatique : Exiled.CustomRoles.API.Features.CustomRole public override bool KeepRoleOnDeath { get; set; } = true; public override bool KeepRoleOnChangingRole { get; set; } = true; public override bool IgnoreSpawnSystem { get; set; } = true; - public override void AddRole(Player player) + protected override void RoleAdded(Player player) { - player.ShowHint("Tu es asthmatique\nT'as stamina est réduit de moitié\nMais tu vises mieux"); - player.EnableEffect(EffectType.Scp1853, -1,true); + player.EnableEffect(EffectType.Scp1853, -1, true); player.EnableEffect(EffectType.Exhausted, -1, true); } } From 1b34f5cfb5e668cc29db91d73bad94f602574b66 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Wed, 29 Jan 2025 14:54:20 +0100 Subject: [PATCH 156/853] change the name of the Asthmatique --- KruacentExiled/KE.CustomRoles/CR/ClassD/Asthmatique.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/KruacentExiled/KE.CustomRoles/CR/ClassD/Asthmatique.cs b/KruacentExiled/KE.CustomRoles/CR/ClassD/Asthmatique.cs index c4002416..83610ce2 100644 --- a/KruacentExiled/KE.CustomRoles/CR/ClassD/Asthmatique.cs +++ b/KruacentExiled/KE.CustomRoles/CR/ClassD/Asthmatique.cs @@ -14,7 +14,7 @@ internal class Asthmatique : CustomRole public override string Name { get; set; } = "Asthmatique"; public override string Description { get; set; } = "Tu es asthmatique\nT'as stamina est réduit de moitié\nMais tu vises mieux"; public override uint Id { get; set; } = 1042; - public override string CustomInfo { get; set; } = "Asmathique"; + public override string CustomInfo { get; set; } = "Asthmatique"; public override int MaxHealth { get; set; } = 100; public override RoleTypeId Role { get; set; } = RoleTypeId.ClassD; public override bool KeepRoleOnDeath { get; set; } = true; From 6a2c258f34efc0522e4237cc985560486fbd3774 Mon Sep 17 00:00:00 2001 From: Omer <113857370+OmerGS@users.noreply.github.com> Date: Wed, 29 Jan 2025 14:57:26 +0100 Subject: [PATCH 157/853] fix/change tank ammo number --- KruacentExiled/KE.CustomRoles/CR/MTF/Tank.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/KruacentExiled/KE.CustomRoles/CR/MTF/Tank.cs b/KruacentExiled/KE.CustomRoles/CR/MTF/Tank.cs index 9e7b49ee..0d3f69c3 100644 --- a/KruacentExiled/KE.CustomRoles/CR/MTF/Tank.cs +++ b/KruacentExiled/KE.CustomRoles/CR/MTF/Tank.cs @@ -40,8 +40,8 @@ internal class Tank : Exiled.CustomRoles.API.Features.CustomRole public override Dictionary Ammo { get; set; } = new Dictionary() { - { AmmoType.Nato762, 500}, - { AmmoType.Nato556, 500} + { AmmoType.Nato762, 200}, + { AmmoType.Nato556, 200} }; protected override void SubscribeEvents() From d0f831868f8634670fe51a61a26ea7a6726d1769 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Wed, 29 Jan 2025 17:34:10 +0100 Subject: [PATCH 158/853] remade the mine --- KruacentExiled/KE.Items/Items/Mine.cs | 34 ++++++------------- KruacentExiled/KE.Items/Models/MineModel.cs | 37 +++++++++++++++++---- KruacentExiled/KE.Items/Models/Model.cs | 6 ++-- 3 files changed, 43 insertions(+), 34 deletions(-) diff --git a/KruacentExiled/KE.Items/Items/Mine.cs b/KruacentExiled/KE.Items/Items/Mine.cs index 0a0665ed..b475ff8e 100644 --- a/KruacentExiled/KE.Items/Items/Mine.cs +++ b/KruacentExiled/KE.Items/Items/Mine.cs @@ -70,8 +70,7 @@ public class Mine : CustomItem, ILumosItem }; - [System.Obsolete] - protected override void OnDropping(DroppingItemEventArgs ev) + protected override void OnDroppingItem(DroppingItemEventArgs ev) { if(!Check(ev.Item)) return; @@ -84,29 +83,16 @@ protected override void OnDropping(DroppingItemEventArgs ev) ev.IsAllowed = false; ev.Player.RemoveItem(ev.Item); - Model m = new MineModel(); + MineModel m = new MineModel(); - m.Spawn(new Vector3(ev.Player.Position.x, ev.Player.Position.y - .8f, ev.Player.Position.z)); + //put the mine on the floor + m.Spawn(ev.Player.Position-new Vector3(0,ev.Player.Scale.y),new Quaternion()); - //SpawnMine(ev.Player, new Vector3(ev.Player.Position.x,ev.Player.Position.y - .8f,ev.Player.Position.z)); - - } - - private void SpawnMine(Player player, Vector3 playerPosition) - { - Vector3 minePosition = playerPosition; - - // The base part of mine - Primitive mine = Primitive.Create(PrimitiveType.Cylinder, minePosition, null, new Vector3(MineRadius, 0.01f, MineRadius), true); - mine.Collidable = true; - mine.Visible = true; - mine.Color = Color.black; - - Timing.RunCoroutine(WaitAndActivateMine(player, mine)); + Timing.RunCoroutine(WaitAndActivateMine(ev.Player, m)); } - private IEnumerator WaitAndActivateMine(Player player, Primitive mine) + private IEnumerator WaitAndActivateMine(Player player, MineModel mine) { int countdown = MineActivationTime; while (countdown > 0) @@ -121,22 +107,22 @@ private IEnumerator WaitAndActivateMine(Player player, Primitive mine) Timing.RunCoroutine(ActiveMine(mine, MineRadius)); } - private IEnumerator ActiveMine(Primitive mine, float cylinderSize) + private IEnumerator ActiveMine(MineModel mine, float cylinderSize) { + Timing.RunCoroutine(mine.Activate()); bool endWhile = true; while (endWhile) { foreach (Player player in Player.List) { - if (IsPlayerInZone(player, mine.Position, cylinderSize, 2)) + if (IsPlayerInZone(player, mine.Position, cylinderSize, 3)) { ((ExplosiveGrenade)Item.Create(ItemType.GrenadeHE)).SpawnActive(mine.Position).FuseTime = 0f; // Delete the mine mine.UnSpawn(); endWhile = false; - mine.Destroy(); - yield break; + break; } } diff --git a/KruacentExiled/KE.Items/Models/MineModel.cs b/KruacentExiled/KE.Items/Models/MineModel.cs index 146ce292..aa18d73c 100644 --- a/KruacentExiled/KE.Items/Models/MineModel.cs +++ b/KruacentExiled/KE.Items/Models/MineModel.cs @@ -1,6 +1,8 @@  +using Exiled.API.Features; using Exiled.API.Features.Toys; +using MEC; using System.Collections.Generic; using UnityEngine; using Light = Exiled.API.Features.Toys.Light; @@ -9,21 +11,42 @@ namespace KE.Items.Models { internal class MineModel : Model { - Color LightColor { get; set; } = Color.red; - internal override void Spawn(Vector3 spawnPos) + private Light _light; + internal override void Spawn(Vector3 spawnPos, Quaternion _) { - Position = spawnPos; - var baseMine = Primitive.Create(PrimitiveType.Cylinder, spawnPos, null, new Vector3(.7f, 0.1f, .7f), true); - var lightGlobe = Primitive.Create(PrimitiveType.Sphere, spawnPos+spawnPos, null, new Vector3(.1f, .1f, .1f)); - var lightMine = Light.Create(spawnPos, null, null, true, LightColor); + //spawn + offset + Position = spawnPos + new Vector3(0, .05f); + Vector3 sizeDisk = new Vector3(.7f, 0.1f, .7f); + Vector3 posLight = Position + new Vector3(0, sizeDisk.y); + + var baseMine = Primitive.Create(PrimitiveType.Cylinder, Position, null, sizeDisk, true); + baseMine.Color = Color.black; + var lightGlobe = Primitive.Create(PrimitiveType.Sphere, posLight, null, new Vector3(.1f, .1f, .1f)); + var lightMine = Light.Create(posLight + new Vector3(0, 0.1f), null, null, true, Color.red); + lightMine.UnSpawn(); + lightMine.Intensity = .55f; baseMine.Collidable = false; - lightGlobe.Color = LightColor; + lightGlobe.Color = new Color(1, 0, 0, .33f); lightGlobe.Collidable = false; Toys.Add(lightGlobe); Toys.Add(baseMine); Toys.Add(lightMine); + _light = lightMine; + } + + internal IEnumerator Activate() + { + if (_light == null) throw new System.Exception("no light"); + while (Round.InProgress) + { + _light.Spawn(); + yield return Timing.WaitForSeconds(3); + _light.UnSpawn(); + yield return Timing.WaitForSeconds(5); + } + } } } diff --git a/KruacentExiled/KE.Items/Models/Model.cs b/KruacentExiled/KE.Items/Models/Model.cs index 878f3ef0..5a427b93 100644 --- a/KruacentExiled/KE.Items/Models/Model.cs +++ b/KruacentExiled/KE.Items/Models/Model.cs @@ -11,10 +11,10 @@ namespace KE.Items.Models internal abstract class Model { internal Vector3 Position { get; set; } - protected List Toys { get; set; } - internal abstract void Spawn(Vector3 spawnPos); + protected List Toys { get; set; } = new List { }; + internal abstract void Spawn(Vector3 spawnPos, Quaternion rotation); - internal void Unspawn() + internal void UnSpawn() { foreach (AdminToy primitive in Toys) { From 2907810938b135de88a40ffdfcf4d78115ebd06a Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Wed, 29 Jan 2025 17:35:45 +0100 Subject: [PATCH 159/853] changed the method OnDropping to OnDroppingItem --- KruacentExiled/KE.Items/Items/DeployableWall.cs | 4 ++-- KruacentExiled/KE.Items/Items/TrueDivinePills.cs | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/KruacentExiled/KE.Items/Items/DeployableWall.cs b/KruacentExiled/KE.Items/Items/DeployableWall.cs index f2a9c658..d60750c7 100644 --- a/KruacentExiled/KE.Items/Items/DeployableWall.cs +++ b/KruacentExiled/KE.Items/Items/DeployableWall.cs @@ -50,7 +50,7 @@ public class DeployableWall : CustomItem, ILumosItem - protected override void OnDropping(DroppingItemEventArgs ev) + protected override void OnDroppingItem(DroppingItemEventArgs ev) { if(!Check(ev.Item)) return; @@ -73,7 +73,7 @@ private void SpawnWall(Vector3 pos, Quaternion rotation) Vector3 forward = rotation * Vector3.forward; Vector3 spawnPos = pos + forward * distance; Vector3 rotat = new Vector3(0, rotation.eulerAngles.y, 0); - + MainPlugin.Instance.Sound.PlayClip("build", spawnPos); Primitive wall = Primitive.Create(PrimitiveType.Cube, spawnPos, rotat, new Vector3(4, 4, 0.2f),true); wall.Collidable = true; diff --git a/KruacentExiled/KE.Items/Items/TrueDivinePills.cs b/KruacentExiled/KE.Items/Items/TrueDivinePills.cs index ff2eda7f..c40a825a 100644 --- a/KruacentExiled/KE.Items/Items/TrueDivinePills.cs +++ b/KruacentExiled/KE.Items/Items/TrueDivinePills.cs @@ -54,7 +54,7 @@ protected override void UnsubscribeEvents() base.UnsubscribeEvents(); } - protected override void OnDropping(DroppingItemEventArgs ev) + protected override void OnDroppingItem(DroppingItemEventArgs ev) { if (!Check(ev.Item)) return; From 48fb472a0e564979d4d81b11c4ce08865cf5f4ce Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Wed, 29 Jan 2025 17:36:14 +0100 Subject: [PATCH 160/853] =?UTF-8?q?changed=20the=20description=20&=20the?= =?UTF-8?q?=20change=20to=20upgrade=20the=20presse=20pur=C3=A9e?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- KruacentExiled/KE.Items/Items/PressePuree.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/KruacentExiled/KE.Items/Items/PressePuree.cs b/KruacentExiled/KE.Items/Items/PressePuree.cs index ca3b54cd..907b5fc9 100644 --- a/KruacentExiled/KE.Items/Items/PressePuree.cs +++ b/KruacentExiled/KE.Items/Items/PressePuree.cs @@ -15,7 +15,7 @@ public class PressePuree : CustomGrenade { public override uint Id { get; set; } = 1046; public override string Name { get; set; } = "Presse Purée"; - public override string Description { get; set; } = "The grenade explode at impact but does less damage"; + public override string Description { get; set; } = "The grenade explode at impact but does less damage\n 5% to upgrade in 914 on very fine"; public override float Weight { get; set; } = 0.65f; public override float FuseTime { get; set; } = 1.5f; public override bool ExplodeOnCollision { get; set; } = true; @@ -71,7 +71,7 @@ private void OnUpgrading(UpgradingInventoryItemEventArgs ev) var rng = UnityEngine.Random.Range(0, 101); Log.Debug($"inventory {Name} : {rng}"); - if (rng < 10) + if (rng < 5) { //success ev.Player.RemoveItem(ev.Item); From 5392d57f70911857aa1e777a5f9ba4eff712a8b4 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Wed, 29 Jan 2025 17:36:28 +0100 Subject: [PATCH 161/853] change the fuse time of the holy grenade --- KruacentExiled/KE.Items/Items/SainteGrenada.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/KruacentExiled/KE.Items/Items/SainteGrenada.cs b/KruacentExiled/KE.Items/Items/SainteGrenada.cs index d4656534..8b5a40f9 100644 --- a/KruacentExiled/KE.Items/Items/SainteGrenada.cs +++ b/KruacentExiled/KE.Items/Items/SainteGrenada.cs @@ -20,7 +20,7 @@ public class SainteGrenada : CustomGrenade, ILumosItem public override string Name { get; set; } = "Sainte Grenada"; public override string Description { get; set; } = "Worms reference !?"; public override float Weight { get; set; } = 1.5f; - public override float FuseTime { get; set; } = 1.5f; + public override float FuseTime { get; set; } = 7.5f; public override bool ExplodeOnCollision { get; set; } = false; public float DamageModifier { get; set; } = 3f; public Color Color { get; set; } = Color.red; From 4463bf7b783054fab2f45915e652d1615a89f177 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Wed, 29 Jan 2025 17:46:14 +0100 Subject: [PATCH 162/853] added IEvent --- .../KE.GlobalEventFramework.Examples/GE/BrokenGenerator.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/KruacentExiled/KE.GlobalEventFramework.Examples/GE/BrokenGenerator.cs b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/BrokenGenerator.cs index e49149d7..a2806943 100644 --- a/KruacentExiled/KE.GlobalEventFramework.Examples/GE/BrokenGenerator.cs +++ b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/BrokenGenerator.cs @@ -12,7 +12,7 @@ namespace KE.GlobalEventFramework.Examples.GE { - public class BrokenGenerator : GlobalEvent, IStart + public class BrokenGenerator : GlobalEvent, IStart, IEvent { public override uint Id { get; set; } = 1050; public override string Name { get; set; } = "Broken Generator"; From 1d7822a0d0078d96d0a66a8371dea99eff95d072 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Thu, 30 Jan 2025 16:04:44 +0100 Subject: [PATCH 163/853] wall --- .../KE.Items/Models/DeployWallModel.cs | 65 +++++++++++++++++++ 1 file changed, 65 insertions(+) create mode 100644 KruacentExiled/KE.Items/Models/DeployWallModel.cs diff --git a/KruacentExiled/KE.Items/Models/DeployWallModel.cs b/KruacentExiled/KE.Items/Models/DeployWallModel.cs new file mode 100644 index 00000000..f1717060 --- /dev/null +++ b/KruacentExiled/KE.Items/Models/DeployWallModel.cs @@ -0,0 +1,65 @@ + + +using Exiled.API.Features; +using Exiled.API.Features.Toys; +using Exiled.Events.Commands.Reload; +using MEC; +using System.Collections.Generic; +using System.Linq; +using UnityEngine; +using Light = Exiled.API.Features.Toys.Light; + +namespace KE.Items.Models +{ + internal class DeployWallModel : Model + { + const float distance = 2; + internal override void Spawn(Vector3 spawnPos, Quaternion rotation) + { + + Vector3 forward = rotation * Vector3.forward; + Vector3 spawnPosi = spawnPos + forward * distance; + Vector3 rotat = new Vector3(0, rotation.eulerAngles.y, 0); + + + + } + + internal void Change() + { + Timing.CallDelayed(10, () => + { + UnSpawn(); + }); + Timing.CallDelayed(5, () => + { + Toys.ForEach(t => + { + if (t is Primitive p) p.Color = Color.yellow; + }); + }); + Timing.CallDelayed(8, () => + { + Toys.ForEach(t => + { + if (t is Primitive p) p.Color = Color.red; + }); + }); + } + + private void SpawnWall(Vector3 pos, Quaternion rotation) + { + Vector3 forward = rotation * Vector3.forward; + Vector3 spawnPos = pos + forward * distance; + Vector3 rotat = new Vector3(0, rotation.eulerAngles.y, 0); + + MainPlugin.Instance.Sound.PlayClip("build", spawnPos); + Primitive wall = Primitive.Create(PrimitiveType.Cube, spawnPos, rotat, new Vector3(4, 4, 0.2f), true); + wall.Collidable = true; + wall.Visible = true; + + + + } + } +} From 12f46c393a64052647c688e945dc90bd83bcf8de Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Fri, 31 Jan 2025 11:46:30 +0100 Subject: [PATCH 164/853] added room extension to check if it's safe or not --- .../Extensions/RoomExtensions.cs | 31 +++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 KruacentExiled/KE.BlackoutNDoor/Extensions/RoomExtensions.cs diff --git a/KruacentExiled/KE.BlackoutNDoor/Extensions/RoomExtensions.cs b/KruacentExiled/KE.BlackoutNDoor/Extensions/RoomExtensions.cs new file mode 100644 index 00000000..fc4d1051 --- /dev/null +++ b/KruacentExiled/KE.BlackoutNDoor/Extensions/RoomExtensions.cs @@ -0,0 +1,31 @@ +using Exiled.API.Features; +using Exiled.API.Enums; +using Discord; + +namespace KE.BlackoutNDoor.Extensions +{ + public static class RoomExtensions + { + public static bool IsSafe(this Room room) + { + return IsSafe(room.Zone); + } + + + public static bool IsSafe(this ZoneType zone) + { + bool result = true; + if (zone == ZoneType.LightContainment) + result = Map.DecontaminationState < DecontaminationState.Countdown; + switch (zone) + { + case ZoneType.LightContainment: + case ZoneType.HeavyContainment: + case ZoneType.Entrance: + result = !Warhead.IsDetonated; + break; + } + return result; + } + } +} From 2225b99b9af7f4d14e3f216f6bf321628dd5d76d Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Sat, 1 Feb 2025 12:32:34 +0100 Subject: [PATCH 165/853] GCR --- .../KE.CustomRoles/API/GlobalCustomRole.cs | 128 ++++++++++++++++++ 1 file changed, 128 insertions(+) create mode 100644 KruacentExiled/KE.CustomRoles/API/GlobalCustomRole.cs diff --git a/KruacentExiled/KE.CustomRoles/API/GlobalCustomRole.cs b/KruacentExiled/KE.CustomRoles/API/GlobalCustomRole.cs new file mode 100644 index 00000000..80abcb5d --- /dev/null +++ b/KruacentExiled/KE.CustomRoles/API/GlobalCustomRole.cs @@ -0,0 +1,128 @@ +using Exiled.API.Enums; +using Exiled.API.Features; +using Exiled.API.Features.Attributes; +using Exiled.API.Features.Pools; +using Exiled.CustomRoles.API.Features; +using MEC; +using PlayerRoles; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using UnityEngine; + +namespace KE.CustomRoles.API +{ + [CustomRole(PlayerRoles.RoleTypeId.CustomRole)] + public abstract class GlobalCustomRole : CustomRole + { + public override RoleTypeId Role { get; set; } = RoleTypeId.None; + public virtual IEnumerable BlacklistedRole { get; } = new List(); + public override void AddRole(Player player) + { + Log.Debug($"{Name}: Adding role to {player.Nickname}."); + TrackedPlayers.Add(player); + + if (!BlacklistedRole.Contains(player.Role)) + { + switch (KeepPositionOnSpawn) + { + case true when KeepInventoryOnSpawn: + player.Role.Set(Role, SpawnReason.ForceClass, RoleSpawnFlags.None); + break; + case true: + player.Role.Set(Role, SpawnReason.ForceClass, RoleSpawnFlags.AssignInventory); + break; + default: + { + if (KeepInventoryOnSpawn && player.IsAlive) + player.Role.Set(Role, SpawnReason.ForceClass, RoleSpawnFlags.UseSpawnpoint); + else + player.Role.Set(Role, SpawnReason.ForceClass, RoleSpawnFlags.All); + break; + } + } + } + + Timing.CallDelayed( + 0.25f, + () => + { + if (!KeepInventoryOnSpawn) + { + Log.Debug($"{Name}: Clearing {player.Nickname}'s inventory."); + player.ClearInventory(); + } + + foreach (string itemName in Inventory) + { + Log.Debug($"{Name}: Adding {itemName} to inventory."); + TryAddItem(player, itemName); + } + + if (Ammo.Count > 0) + { + Log.Debug($"{Name}: Adding Ammo to {player.Nickname} inventory."); + foreach (AmmoType type in EnumUtils.Values) + { + if (type != AmmoType.None) + player.SetAmmo(type, Ammo.ContainsKey(type) ? Ammo[type] == ushort.MaxValue ? InventoryLimits.GetAmmoLimit(type.GetItemType(), player.ReferenceHub) : Ammo[type] : (ushort)0); + } + } + }); + + Log.Debug($"{Name}: Setting health values."); + player.Health = MaxHealth; + player.MaxHealth = MaxHealth; + player.Scale = Scale; + + Vector3 position = GetSpawnPosition(); + if (position != Vector3.zero) + { + player.Position = position; + } + + Log.Debug($"{Name}: Setting player info"); + + player.CustomInfo = $"{player.CustomName}\n{CustomInfo}"; + player.InfoArea &= ~(PlayerInfoArea.Role | PlayerInfoArea.Nickname); + + if (CustomAbilities != null) + { + foreach (CustomAbility ability in CustomAbilities) + ability.AddAbility(player); + } + + ShowMessage(player); + ShowBroadcast(player); + RoleAdded(player); + player.UniqueRole = Name; + player.TryAddCustomRoleFriendlyFire(Name, CustomRoleFFMultiplier); + + if (!string.IsNullOrEmpty(ConsoleMessage)) + { + StringBuilder builder = StringBuilderPool.Pool.Get(); + + builder.AppendLine(Name); + builder.AppendLine(Description); + builder.AppendLine(); + builder.AppendLine(ConsoleMessage); + + if (CustomAbilities?.Count > 0) + { + builder.AppendLine(AbilityUsage); + builder.AppendLine("Your custom abilities are:"); + for (int i = 1; i < CustomAbilities.Count + 1; i++) + builder.AppendLine($"{i}. {CustomAbilities[i - 1].Name} - {CustomAbilities[i - 1].Description}"); + + builder.AppendLine( + "You can keybind the command for this ability by using \"cmdbind .special KEY\", where KEY is any un-used letter on your keyboard. You can also keybind each specific ability for a role in this way. For ex: \"cmdbind .special g\" or \"cmdbind .special bulldozer 1 g\""); + } + + player.SendConsoleMessage(StringBuilderPool.Pool.ToStringReturn(builder), "green"); + } + } + + } +} From 42e970a022203d8ed5760ea389d0d57904e94ab7 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Sat, 1 Feb 2025 12:35:35 +0100 Subject: [PATCH 166/853] reorganized + 079 cuz funy --- .../KE.Misc/{ => Handlers}/ServerHandler.cs | 0 KruacentExiled/KE.Misc/KE.Misc.csproj | 12 ++++++------ KruacentExiled/KE.Misc/MainPlugin.cs | 4 ++++ KruacentExiled/KE.Misc/{ => Misc}/914.cs | 18 +++++++++--------- .../KE.Misc/{ => Misc}/AutoElevator.cs | 2 +- KruacentExiled/KE.Misc/{ => Misc}/Candy.cs | 4 ++-- .../KE.Misc/{ => Misc}/ClassDDoor.cs | 5 ++--- KruacentExiled/KE.Misc/{ => Misc}/SCPBuff.cs | 8 ++++---- .../KE.Misc/{ => Misc}/SurfaceLight.cs | 16 ++++++++-------- 9 files changed, 36 insertions(+), 33 deletions(-) rename KruacentExiled/KE.Misc/{ => Handlers}/ServerHandler.cs (100%) rename KruacentExiled/KE.Misc/{ => Misc}/914.cs (94%) rename KruacentExiled/KE.Misc/{ => Misc}/AutoElevator.cs (97%) rename KruacentExiled/KE.Misc/{ => Misc}/Candy.cs (79%) rename KruacentExiled/KE.Misc/{ => Misc}/ClassDDoor.cs (94%) rename KruacentExiled/KE.Misc/{ => Misc}/SCPBuff.cs (93%) rename KruacentExiled/KE.Misc/{ => Misc}/SurfaceLight.cs (68%) diff --git a/KruacentExiled/KE.Misc/ServerHandler.cs b/KruacentExiled/KE.Misc/Handlers/ServerHandler.cs similarity index 100% rename from KruacentExiled/KE.Misc/ServerHandler.cs rename to KruacentExiled/KE.Misc/Handlers/ServerHandler.cs diff --git a/KruacentExiled/KE.Misc/KE.Misc.csproj b/KruacentExiled/KE.Misc/KE.Misc.csproj index 452d5c70..a1fb438a 100644 --- a/KruacentExiled/KE.Misc/KE.Misc.csproj +++ b/KruacentExiled/KE.Misc/KE.Misc.csproj @@ -9,12 +9,12 @@ - - - - - - + + + + + + diff --git a/KruacentExiled/KE.Misc/MainPlugin.cs b/KruacentExiled/KE.Misc/MainPlugin.cs index 197b0de9..5b7de717 100644 --- a/KruacentExiled/KE.Misc/MainPlugin.cs +++ b/KruacentExiled/KE.Misc/MainPlugin.cs @@ -10,6 +10,7 @@ using Exiled.Events.EventArgs.Player; using System; using MapGeneration; +using KE.Misc.Misc; namespace KE.Misc { @@ -121,7 +122,10 @@ internal IEnumerator PeanutLockdown() Log.Debug("peanut free"); } + private void A(Func a) + { + } private IEnumerator Timer(int secondsWaiting,List playerToShow, string msg = "done") { while (secondsWaiting >= 0) diff --git a/KruacentExiled/KE.Misc/914.cs b/KruacentExiled/KE.Misc/Misc/914.cs similarity index 94% rename from KruacentExiled/KE.Misc/914.cs rename to KruacentExiled/KE.Misc/Misc/914.cs index 1a5c4b1f..1c1a0a94 100644 --- a/KruacentExiled/KE.Misc/914.cs +++ b/KruacentExiled/KE.Misc/Misc/914.cs @@ -12,7 +12,7 @@ using UnityEngine; using YamlDotNet.Core.Tokens; -namespace KE.Misc +namespace KE.Misc.Misc { /// /// Everything 914 related @@ -28,7 +28,7 @@ internal class _914 { 3, RoleTypeId.Scp106 }, { 2, RoleTypeId.Scp173 }, - { 1, RoleTypeId.Scp096}, + { 1, RoleTypeId.Scp079 }, }; internal void OnUpgradingPlayer(UpgradingPlayerEventArgs ev) @@ -65,7 +65,7 @@ private void Teleport(Player p, Scp914KnobSetting knob) var pos = p.Position; p.Teleport(playerScp.Position); playerScp.Teleport(pos); - + } else p.Teleport(Room.Random(ZoneType.LightContainment)); @@ -141,17 +141,17 @@ private void HandleScpChangingRole(Player p, Scp914KnobSetting knob) switch (Math.Abs(key)) { case 3: - TrySetRole(p,key/(-3)); + TrySetRole(p, key / -3); break; case 2: - TrySetRole(p,key* (-1)); + TrySetRole(p, key * -1); break; case 1: - TrySetRole(p, key * (-3)); + TrySetRole(p, key * -3); break; } - + break; //going down in the graph case Scp914KnobSetting.VeryFine: @@ -161,7 +161,7 @@ private void HandleScpChangingRole(Player p, Scp914KnobSetting knob) } } - else + else { Log.Debug("no luck"); } @@ -170,7 +170,7 @@ private void HandleScpChangingRole(Player p, Scp914KnobSetting knob) - private void TrySetRole(Player p ,int key) + private void TrySetRole(Player p, int key) { RoleTypeId newRole; if (roleScp.TryGetValue(key, out newRole)) diff --git a/KruacentExiled/KE.Misc/AutoElevator.cs b/KruacentExiled/KE.Misc/Misc/AutoElevator.cs similarity index 97% rename from KruacentExiled/KE.Misc/AutoElevator.cs rename to KruacentExiled/KE.Misc/Misc/AutoElevator.cs index 631c9b9a..d6fe2422 100644 --- a/KruacentExiled/KE.Misc/AutoElevator.cs +++ b/KruacentExiled/KE.Misc/Misc/AutoElevator.cs @@ -6,7 +6,7 @@ using System.Text; using System.Threading.Tasks; -namespace KE.Misc +namespace KE.Misc.Misc { /// /// The elevator will random activate in the round diff --git a/KruacentExiled/KE.Misc/Candy.cs b/KruacentExiled/KE.Misc/Misc/Candy.cs similarity index 79% rename from KruacentExiled/KE.Misc/Candy.cs rename to KruacentExiled/KE.Misc/Misc/Candy.cs index 61b1fb7d..603ae26a 100644 --- a/KruacentExiled/KE.Misc/Candy.cs +++ b/KruacentExiled/KE.Misc/Misc/Candy.cs @@ -7,13 +7,13 @@ using System.Threading.Tasks; using InventorySystem.Items.Usables.Scp330; -namespace KE.Misc +namespace KE.Misc.Misc { internal class Candy { public void InteractingScp330(InteractingScp330EventArgs ev) { - if(UnityEngine.Random.Range(0, 100) < MainPlugin.Instance.Config.ChancePinkCandy) + if (UnityEngine.Random.Range(0, 100) < MainPlugin.Instance.Config.ChancePinkCandy) { ev.Candy = CandyKindID.Pink; } diff --git a/KruacentExiled/KE.Misc/ClassDDoor.cs b/KruacentExiled/KE.Misc/Misc/ClassDDoor.cs similarity index 94% rename from KruacentExiled/KE.Misc/ClassDDoor.cs rename to KruacentExiled/KE.Misc/Misc/ClassDDoor.cs index 11d0a629..fefcb8c6 100644 --- a/KruacentExiled/KE.Misc/ClassDDoor.cs +++ b/KruacentExiled/KE.Misc/Misc/ClassDDoor.cs @@ -2,14 +2,13 @@ using Exiled.API.Features; using Exiled.API.Features.Doors; using Exiled.API.Interfaces; -using KE.Misc; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; -namespace KE.Misc +namespace KE.Misc.Misc { /// /// Everything about classD door @@ -31,7 +30,7 @@ internal void ClassDDoorGoesBoom() if (door is IDamageableDoor dBoyDoor && !dBoyDoor.IsDestroyed) { dBoyDoor.Break(); - + } } } diff --git a/KruacentExiled/KE.Misc/SCPBuff.cs b/KruacentExiled/KE.Misc/Misc/SCPBuff.cs similarity index 93% rename from KruacentExiled/KE.Misc/SCPBuff.cs rename to KruacentExiled/KE.Misc/Misc/SCPBuff.cs index 8002264c..19492910 100644 --- a/KruacentExiled/KE.Misc/SCPBuff.cs +++ b/KruacentExiled/KE.Misc/Misc/SCPBuff.cs @@ -6,7 +6,7 @@ using System.Linq; using UnityEngine; -namespace KE.Misc +namespace KE.Misc.Misc { internal class SCPBuff { @@ -24,7 +24,7 @@ private IEnumerator PeanutShield() List peanuts = Player.List.Where(p => p.Role == RoleTypeId.Scp173).ToList(); peanuts.ForEach(p => { - AddHumeShield(p, CheckPlayerAround(p,4)); + AddHumeShield(p, CheckPlayerAround(p, 4)); }); yield return Timing.WaitForSeconds(RefreshRate); } @@ -51,7 +51,7 @@ private int CheckPlayerAround(Player p, float radius, bool countFriendly = false return result; } - + private bool IsPlayerInZone(Player player, Vector3 zonePosition, float radius, float height) { // Calculate the horizontal distance (x, z) @@ -64,7 +64,7 @@ private bool IsPlayerInZone(Player player, Vector3 zonePosition, float radius, f float verticalDifference = Mathf.Abs(player.Position.y - zonePosition.y); // Check if the player is in the 3d zone. - return horizontalDistance <= (radius / 2) && verticalDifference <= (height / 2); + return horizontalDistance <= radius / 2 && verticalDifference <= height / 2; } diff --git a/KruacentExiled/KE.Misc/SurfaceLight.cs b/KruacentExiled/KE.Misc/Misc/SurfaceLight.cs similarity index 68% rename from KruacentExiled/KE.Misc/SurfaceLight.cs rename to KruacentExiled/KE.Misc/Misc/SurfaceLight.cs index fae0b003..4b3bd410 100644 --- a/KruacentExiled/KE.Misc/SurfaceLight.cs +++ b/KruacentExiled/KE.Misc/Misc/SurfaceLight.cs @@ -4,7 +4,7 @@ using System.Collections.Generic; using System.Linq; -namespace KE.Misc +namespace KE.Misc.Misc { /// /// Everything about Surface Light @@ -16,21 +16,21 @@ internal class SurfaceLight /// internal void ChangeSurfaceLight() { - List colors = new [] + List colors = new[] { - Color.cyan, - Color.red, - Color.green, - Color.white, + Color.cyan, + Color.red, + Color.green, + Color.white, Color.blue }.ToList(); // Select a random color - Color randomColor = colors[UnityEngine.Random.Range(0, colors.Count)]; + Color randomColor = colors[Random.Range(0, colors.Count)]; foreach (var room in Room.List.Where(r => r.Type == RoomType.Surface)) { - room.Color = randomColor; + room.Color = randomColor; } Log.Info($"Changed Surface light color to {randomColor}."); From 17e11cb82618971f778e62aefd74350cbce93c14 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Mon, 3 Feb 2025 11:55:15 +0100 Subject: [PATCH 167/853] fixed double nuke announcement --- KruacentExiled/KE.Misc/Handlers/ServerHandler.cs | 5 +++-- KruacentExiled/KE.Misc/MainPlugin.cs | 10 +++------- 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/KruacentExiled/KE.Misc/Handlers/ServerHandler.cs b/KruacentExiled/KE.Misc/Handlers/ServerHandler.cs index 2274d004..8d627d18 100644 --- a/KruacentExiled/KE.Misc/Handlers/ServerHandler.cs +++ b/KruacentExiled/KE.Misc/Handlers/ServerHandler.cs @@ -6,10 +6,11 @@ using Exiled.API.Features; using MEC; -namespace KE.Misc +namespace KE.Misc.Handlers { internal class ServerHandler { + CoroutineHandle coroutineHandle; public void OnRoundStarted() { if(MainPlugin.Instance.Config.ChanceFF >= 0 && MainPlugin.Instance.Config.ChanceFF <= 100) @@ -17,7 +18,7 @@ public void OnRoundStarted() if (MainPlugin.Instance.Config.ChanceClassDDoorGoesBoom >= 0 && MainPlugin.Instance.Config.ChanceClassDDoorGoesBoom <= 100) MainPlugin.Instance.ClassDDoor.ClassDDoorGoesBoom(); if(MainPlugin.Instance.Config.AutoNukeAnnoucement) - Timing.RunCoroutine(MainPlugin.Instance.NukeAnnouncement()); + Timing.RunCoroutineSingleton(MainPlugin.Instance.NukeAnnouncement(), coroutineHandle,SingletonBehavior.Abort); if(MainPlugin.Instance.Config.PeanutLockDown && Player.List.Where(p => p.Role.Type == PlayerRoles.RoleTypeId.Scp173).Count() > 0) Timing.RunCoroutine(MainPlugin.Instance.PeanutLockdown()); if(MainPlugin.Instance.Config.AutoElevator) diff --git a/KruacentExiled/KE.Misc/MainPlugin.cs b/KruacentExiled/KE.Misc/MainPlugin.cs index 5b7de717..c9efc67d 100644 --- a/KruacentExiled/KE.Misc/MainPlugin.cs +++ b/KruacentExiled/KE.Misc/MainPlugin.cs @@ -9,8 +9,8 @@ using PlayerRoles; using Exiled.Events.EventArgs.Player; using System; -using MapGeneration; using KE.Misc.Misc; +using KE.Misc.Handlers; namespace KE.Misc { @@ -121,18 +121,13 @@ internal IEnumerator PeanutLockdown() peanutDoor.Unlock(); Log.Debug("peanut free"); } - - private void A(Func a) - { - - } private IEnumerator Timer(int secondsWaiting,List playerToShow, string msg = "done") { while (secondsWaiting >= 0) { Hint hint = new Hint() { - Content = $"{secondsWaiting}", + Content = $"{secondsWaiting} seconds", Duration = 1 }; playerToShow.ForEach(p => p.ShowHint(hint)); @@ -140,6 +135,7 @@ private IEnumerator Timer(int secondsWaiting,List playerToShow, s yield return Timing.WaitForSeconds(1); secondsWaiting--; } + playerToShow.ForEach(p => p.ShowHint(msg)); } /// From 7ad38c3db0c66b5857df736ff9e96645d2ee3176 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Fri, 7 Feb 2025 19:34:13 +0100 Subject: [PATCH 168/853] fix #68 --- .../GE/Kaboom.cs | 99 +++++++++++++++++++ 1 file changed, 99 insertions(+) create mode 100644 KruacentExiled/KE.GlobalEventFramework.Examples/GE/Kaboom.cs diff --git a/KruacentExiled/KE.GlobalEventFramework.Examples/GE/Kaboom.cs b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/Kaboom.cs new file mode 100644 index 00000000..5e91ad6f --- /dev/null +++ b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/Kaboom.cs @@ -0,0 +1,99 @@ +using Exiled.API.Enums; +using Exiled.API.Features.Items; +using Exiled.API.Features; +using Exiled.Events.EventArgs.Player; +using KE.GlobalEventFramework.GEFE.API.Features; +using KE.GlobalEventFramework.GEFE.API.Interfaces; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using DoorType = Exiled.API.Enums.DoorType; + +namespace KE.GlobalEventFramework.Examples.GE +{ + public class Kaboom : GlobalEvent, IEvent + { + /// + public override uint Id { get; set; } = 0; + /// + public override string Name { get; set; } = "Kaboom"; + /// + public override string Description { get; set; } = "Les portes sont piegés attention!"; + /// + public override int Weight { get; set; } = 1; + + + public const float BaseChanceElevator = .05f; + private float _chanceElevator; + public float ChanceElevator + { + get{ return _chanceElevator;} + set + { + if (value >= 0 && value <= 1) + _chanceElevator = value; + else + _chanceElevator = BaseChanceElevator; + } + } + public const float BaseChanceGate = .25f; + private float _chanceGate; + + public float ChanceGate + { + get { return _chanceGate;} + set + { + if (value >= 0 && value <= 1) + _chanceGate = value; + else + _chanceGate = BaseChanceGate; + } + } + + public const float BaseChanceDoor = .1f; + + private float _chanceDoor; + public float ChanceDoor + { + get { return _chanceDoor; } + set + { + if (value > 0 && value <= 1) + _chanceDoor = value; + else + _chanceDoor= BaseChanceDoor; + } + } + + + + /// + public void SubscribeEvent() + { + Exiled.Events.Handlers.Player.InteractingDoor += OnInteractingDoor; + } + public void UnsubscribeEvent() + { + Exiled.Events.Handlers.Player.InteractingDoor -= OnInteractingDoor; + } + + private void OnInteractingDoor(InteractingDoorEventArgs ev) + { + float random = UnityEngine.Random.value; + bool spawnGrenade = + (ev.Door.IsElevator && random < .05f) || + (ev.Door.IsGate && random < .5f) || + (ev.Door.IsDamageable && random <.1f); + + Log.Debug($"i love debugging random value : {random} ; Kaboom? {spawnGrenade}"); + if (spawnGrenade) + { + + ((ExplosiveGrenade)Item.Create(ItemType.GrenadeHE)).SpawnActive(ev.Door.Position); + } + } + } +} From cb96c5bbc0c4e7f8a299a206fa361a9e75442bd0 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Sat, 8 Feb 2025 16:41:17 +0100 Subject: [PATCH 169/853] actually give the buff to 173 --- KruacentExiled/KE.Misc/Handlers/ServerHandler.cs | 7 ++----- KruacentExiled/KE.Misc/Misc/SCPBuff.cs | 5 ++++- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/KruacentExiled/KE.Misc/Handlers/ServerHandler.cs b/KruacentExiled/KE.Misc/Handlers/ServerHandler.cs index 8d627d18..05083455 100644 --- a/KruacentExiled/KE.Misc/Handlers/ServerHandler.cs +++ b/KruacentExiled/KE.Misc/Handlers/ServerHandler.cs @@ -1,8 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; +using System.Linq; using Exiled.API.Features; using MEC; @@ -25,6 +21,7 @@ public void OnRoundStarted() Timing.RunCoroutine(MainPlugin.Instance.AutoElevator.StartElevator()); if (MainPlugin.Instance.Config.SurfaceLight) MainPlugin.Instance.SurfaceLight.ChangeSurfaceLight(); + MainPlugin.Instance.SCPBuff.StartBuff(); } } } diff --git a/KruacentExiled/KE.Misc/Misc/SCPBuff.cs b/KruacentExiled/KE.Misc/Misc/SCPBuff.cs index 19492910..894e0ded 100644 --- a/KruacentExiled/KE.Misc/Misc/SCPBuff.cs +++ b/KruacentExiled/KE.Misc/Misc/SCPBuff.cs @@ -11,7 +11,10 @@ namespace KE.Misc.Misc internal class SCPBuff { internal const float RefreshRate = 1f; - internal SCPBuff() + internal SCPBuff() { } + + + internal void StartBuff() { Timing.RunCoroutine(PeanutShield()); } From b44a6f1161cf7fbeceb94afc3d9aac03df7dad37 Mon Sep 17 00:00:00 2001 From: Omer <113857370+OmerGS@users.noreply.github.com> Date: Sat, 8 Feb 2025 17:14:14 +0100 Subject: [PATCH 170/853] changed damage of the molotov --- KruacentExiled/KE.Items/Items/Molotov.cs | 42 ++++++++++++++++++++++-- 1 file changed, 39 insertions(+), 3 deletions(-) diff --git a/KruacentExiled/KE.Items/Items/Molotov.cs b/KruacentExiled/KE.Items/Items/Molotov.cs index c185882f..bc57cc1d 100644 --- a/KruacentExiled/KE.Items/Items/Molotov.cs +++ b/KruacentExiled/KE.Items/Items/Molotov.cs @@ -9,6 +9,7 @@ using Player = Exiled.API.Features.Player; using MEC; using UnityEngine; +using PlayerRoles; namespace KE.Items.Items { @@ -27,7 +28,7 @@ public class Molotov : CustomGrenade, ILumosItem private const float Duration = 20f; public override SpawnProperties SpawnProperties { get; set; } = new SpawnProperties() { - Limit = 3, + Limit = 2, LockerSpawnPoints = new List { new LockerSpawnPoint() @@ -62,7 +63,7 @@ public class Molotov : CustomGrenade, ILumosItem }, new RoomSpawnPoint() { - Chance = 100, + Chance = 50, Room = RoomType.HczNuke, }, }, @@ -93,6 +94,9 @@ protected override void OnExploding(ExplodingGrenadeEventArgs ev) private IEnumerator DamageInMolotovZone(Vector3 wallPosition, float cylinderSize, Player playerThrowingGrenade) { + // Dictionary that stores the time each player has spent inside the zone (in seconds). + Dictionary playerTimeInZone = new Dictionary(); + while (true) { foreach (Player player in Player.List) @@ -101,7 +105,38 @@ private IEnumerator DamageInMolotovZone(Vector3 wallPosition, float cylin { if (Exiled.API.Features.Server.FriendlyFire || playerThrowingGrenade.Role.Team != player.Role.Team || playerThrowingGrenade == player) { - player.Hurt(player.Health / 150, DamageType.Bleeding); + if (player.IsHuman || player.Role == RoleTypeId.Scp0492) + { + if (playerTimeInZone.ContainsKey(player)) + { + // increase time each frame. + playerTimeInZone[player] += Time.deltaTime; + } + else + { + // Init the time in dictionnary of the player. + playerTimeInZone[player] = Time.deltaTime; + } + + // time of player spend inside of molotov zone. + float timeInZone = playerTimeInZone[player]; + + // Beginning it willbe 5dm/s, after it will be linearly higher the damage until 20dm/s. + float damage = Mathf.Lerp(2.5f, 10f, timeInZone / 20f); + + // double damage if it's zombie cuz it has more hp. + if (player.Role == RoleTypeId.Scp0492) + { + damage *= 2.5f; + } + + player.Hurt(damage, DamageType.Bleeding); + } + else if (player.IsScp) + { + player.Hurt(player.Health / 150, DamageType.Bleeding); + } + } } } @@ -110,6 +145,7 @@ private IEnumerator DamageInMolotovZone(Vector3 wallPosition, float cylin } } + private bool IsPlayerInZone(Player player, Vector3 zonePosition, float radius) { float distance = Vector3.Distance(new Vector3(player.Position.x, 0, player.Position.z), From e59ef4fc591b67a481439e1a6f6cced8e6feb4a8 Mon Sep 17 00:00:00 2001 From: Omer <113857370+OmerGS@users.noreply.github.com> Date: Sat, 8 Feb 2025 17:15:19 +0100 Subject: [PATCH 171/853] changed the timing when the secondary effect occur, (before : 180, 300 -> now : 60, 120 seconds) --- KruacentExiled/KE.Items/Items/AdrenalineDrogue.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/KruacentExiled/KE.Items/Items/AdrenalineDrogue.cs b/KruacentExiled/KE.Items/Items/AdrenalineDrogue.cs index 80396058..1e27bfc0 100644 --- a/KruacentExiled/KE.Items/Items/AdrenalineDrogue.cs +++ b/KruacentExiled/KE.Items/Items/AdrenalineDrogue.cs @@ -187,7 +187,7 @@ private IEnumerator EffectAttribution(Exiled.API.Features.Player joueur) } - yield return Timing.WaitForSeconds(UnityEngine.Random.Range(180, 300)); + yield return Timing.WaitForSeconds(UnityEngine.Random.Range(60, 120)); if (joueur.IsAlive) { From eca42d322a5a2ba183246b578329e280b5a30776 Mon Sep 17 00:00:00 2001 From: Omer <113857370+OmerGS@users.noreply.github.com> Date: Sat, 8 Feb 2025 17:16:02 +0100 Subject: [PATCH 172/853] changed the color effect and changed event --- KruacentExiled/KE.Items/Items/Defibrilator.cs | 29 ++++++++++--------- 1 file changed, 16 insertions(+), 13 deletions(-) diff --git a/KruacentExiled/KE.Items/Items/Defibrilator.cs b/KruacentExiled/KE.Items/Items/Defibrilator.cs index f2f0cf85..a408a80c 100644 --- a/KruacentExiled/KE.Items/Items/Defibrilator.cs +++ b/KruacentExiled/KE.Items/Items/Defibrilator.cs @@ -18,8 +18,7 @@ public class Defibrilator : CustomItem, ILumosItem public override string Name { get; set; } = "Defibrilator"; public override string Description { get; set; } = "The defibrillator is used to revive a person who has lost consciousness. It will revive the person closest to the player who uses it (the location of death, not where the body is)."; public override float Weight { get; set; } = 0.65f; - public UnityEngine.Color Color { get; set; } = UnityEngine.Color.cyan; - + public UnityEngine.Color Color { get; set; } = UnityEngine.Color.magenta; private ConcurrentDictionary positionMort = new ConcurrentDictionary(); @@ -35,13 +34,13 @@ public class Defibrilator : CustomItem, ILumosItem LockerSpawnPoints = new List { - new LockerSpawnPoint(){ Chance=50, Type = LockerType.Medkit, }, + new LockerSpawnPoint(){ Chance= 50, Type = LockerType.Medkit, }, } }; protected override void SubscribeEvents() { - Exiled.Events.Handlers.Player.UsedItem += OnUsingItem; + Exiled.Events.Handlers.Player.UsingItem += OnUsingItem; Exiled.Events.Handlers.Player.Dying += OnDeathEvent; Exiled.Events.Handlers.Player.Spawned += OnSpawningEvent; base.SubscribeEvents(); @@ -49,7 +48,7 @@ protected override void SubscribeEvents() protected override void UnsubscribeEvents() { - Exiled.Events.Handlers.Player.UsedItem -= OnUsingItem; + Exiled.Events.Handlers.Player.UsingItem -= OnUsingItem; Exiled.Events.Handlers.Player.Dying -= OnDeathEvent; Exiled.Events.Handlers.Player.Spawned -= OnSpawningEvent; base.UnsubscribeEvents(); @@ -73,16 +72,20 @@ private void OnSpawningEvent(SpawnedEventArgs ev) } } - private void OnUsingItem(UsedItemEventArgs ev) + private void OnUsingItem(UsingItemEventArgs ev) { - if (TryGet(ev.Item, out var result) && result.Id == 20) + if (!Check(ev.Player.CurrentItem)) { - Timing.CallDelayed(2f, () => - { - ev.Player.DisableEffect(EffectType.Scp1853); - Timing.RunCoroutine(EffectAttribution(ev.Player)); - }); + return; } + + Timing.CallDelayed(1f, () => + { + ev.IsAllowed = false; + ev.Player.RemoveItem(ev.Item); + + Timing.RunCoroutine(EffectAttribution(ev.Player)); + }); } private IEnumerator EffectAttribution(Player joueur) @@ -94,7 +97,7 @@ private IEnumerator EffectAttribution(Player joueur) if (positionMort.Count == 0) { joueur.Broadcast(5, "There is no death", Broadcast.BroadcastFlags.Normal, true); - Exiled.CustomItems.API.Features.CustomItem.TryGive(joueur, 1401); + Exiled.CustomItems.API.Features.CustomItem.TryGive(joueur, 1041); } else { From f46d72d3405b73355f55f4a6a110aa1ec009395f Mon Sep 17 00:00:00 2001 From: Omer <113857370+OmerGS@users.noreply.github.com> Date: Sat, 8 Feb 2025 17:16:52 +0100 Subject: [PATCH 173/853] heal more : 6 hp/s and 4 ah/s. --- KruacentExiled/KE.Items/Items/HealZone.cs | 3 +- KruacentExiled/KE.Items/Items/LockSmith.cs | 109 +++++++++++++++++++++ 2 files changed, 111 insertions(+), 1 deletion(-) create mode 100644 KruacentExiled/KE.Items/Items/LockSmith.cs diff --git a/KruacentExiled/KE.Items/Items/HealZone.cs b/KruacentExiled/KE.Items/Items/HealZone.cs index da61139d..091f8fe2 100644 --- a/KruacentExiled/KE.Items/Items/HealZone.cs +++ b/KruacentExiled/KE.Items/Items/HealZone.cs @@ -100,7 +100,8 @@ private IEnumerator HealZoneHeal(Vector3 wallPosition, float cylinderSize { if(playerThrowingGrenade.Role.Team == player.Role.Team) { - player.Heal(1); + player.Heal(3); + player.ArtificialHealth += 2; } } } diff --git a/KruacentExiled/KE.Items/Items/LockSmith.cs b/KruacentExiled/KE.Items/Items/LockSmith.cs new file mode 100644 index 00000000..7f99901b --- /dev/null +++ b/KruacentExiled/KE.Items/Items/LockSmith.cs @@ -0,0 +1,109 @@ + +using System; +using System.Collections.Generic; +using Exiled.API.Enums; +using Exiled.API.Features; +using Exiled.API.Features.Attributes; +using Exiled.API.Features.Spawn; +using Exiled.CustomItems.API.Features; +using Exiled.Events.EventArgs.Player; +using Door = Exiled.API.Features.Doors.Door; +using MEC; +using PlayerRoles.PlayableScps.Scp079.Overcons; +using KE.Items.Interface; + +namespace KE.Items.Items +{ + [CustomItem(ItemType.KeycardJanitor)] + public class LockSmith : CustomKeycard, ILumosItem + { + public override uint Id { get; set; } = 1056; + public override string Name { get; set; } = "LockSmith Card"; + public override string Description { get; set; } = "You can lock a door in 2 seconds, the door will move to the opposite state and will be locked for 30 seconds"; + public override float Weight { get; set; } = 0.65f; + + private Dictionary lastUsed = new Dictionary(); + + // Item cooldown in seconds + private int Cooldown { get; set; } = 120; + + public UnityEngine.Color Color { get; set; } = UnityEngine.Color.gray; + + private float LockTime = 30f; + + public override SpawnProperties SpawnProperties { get; set; } = new SpawnProperties() + { + Limit = 2, + DynamicSpawnPoints = new List + { + new DynamicSpawnPoint() + { + Chance = 20, + Location = SpawnLocationType.InsideHidChamber, + }, + new DynamicSpawnPoint() + { + Chance= 30, + Location = SpawnLocationType.InsideEscapePrimary, + }, + new DynamicSpawnPoint() + { + Chance= 20, + Location = SpawnLocationType.InsideSurfaceNuke, + }, + }, + }; + + + protected override void SubscribeEvents() + { + Exiled.Events.Handlers.Player.InteractingDoor += OnUsing; + base.SubscribeEvents(); + } + + /// + protected override void UnsubscribeEvents() + { + Exiled.Events.Handlers.Player.InteractingDoor -= OnUsing; + base.UnsubscribeEvents(); + } + + private void OnUsing(InteractingDoorEventArgs ev) + { + List doors = new List + { + DoorType.GateA, + DoorType.GateB, + }; + + if (!Check(ev.Player.CurrentItem)) + return; + + if (lastUsed.ContainsKey(ev.Player)) + { + + DateTime usableTime = lastUsed[ev.Player] + TimeSpan.FromSeconds(Cooldown); + if (DateTime.Now > usableTime) + { + ev.Player.ShowHint($"You must wait another {Math.Round((DateTime.Now - usableTime).TotalSeconds, 2)} seconds to use {Name}"); + return; + } + else + { + lastUsed.Remove(ev.Player); + } + } + + if (doors.Contains(ev.Door.Type) || ev.Door.IsLocked) + { + ev.Player.ShowHint("This door can't be locked down by Lock Smith"); + return; + } + + ev.IsAllowed = true; + ev.Door.IsOpen = !ev.Door.IsOpen; + ev.Door.Lock(LockTime, DoorLockType.Isolation); + lastUsed.Add(ev.Player, DateTime.UtcNow); + } + } +} From c2acba14a3d46ddfc756c3af73a74fac4f9e49c4 Mon Sep 17 00:00:00 2001 From: Omer <113857370+OmerGS@users.noreply.github.com> Date: Sat, 8 Feb 2025 17:18:01 +0100 Subject: [PATCH 174/853] Revert "heal more : 6 hp/s and 4 ah/s." This reverts commit f46d72d3405b73355f55f4a6a110aa1ec009395f. --- KruacentExiled/KE.Items/Items/HealZone.cs | 3 +- KruacentExiled/KE.Items/Items/LockSmith.cs | 109 --------------------- 2 files changed, 1 insertion(+), 111 deletions(-) delete mode 100644 KruacentExiled/KE.Items/Items/LockSmith.cs diff --git a/KruacentExiled/KE.Items/Items/HealZone.cs b/KruacentExiled/KE.Items/Items/HealZone.cs index 091f8fe2..da61139d 100644 --- a/KruacentExiled/KE.Items/Items/HealZone.cs +++ b/KruacentExiled/KE.Items/Items/HealZone.cs @@ -100,8 +100,7 @@ private IEnumerator HealZoneHeal(Vector3 wallPosition, float cylinderSize { if(playerThrowingGrenade.Role.Team == player.Role.Team) { - player.Heal(3); - player.ArtificialHealth += 2; + player.Heal(1); } } } diff --git a/KruacentExiled/KE.Items/Items/LockSmith.cs b/KruacentExiled/KE.Items/Items/LockSmith.cs deleted file mode 100644 index 7f99901b..00000000 --- a/KruacentExiled/KE.Items/Items/LockSmith.cs +++ /dev/null @@ -1,109 +0,0 @@ - -using System; -using System.Collections.Generic; -using Exiled.API.Enums; -using Exiled.API.Features; -using Exiled.API.Features.Attributes; -using Exiled.API.Features.Spawn; -using Exiled.CustomItems.API.Features; -using Exiled.Events.EventArgs.Player; -using Door = Exiled.API.Features.Doors.Door; -using MEC; -using PlayerRoles.PlayableScps.Scp079.Overcons; -using KE.Items.Interface; - -namespace KE.Items.Items -{ - [CustomItem(ItemType.KeycardJanitor)] - public class LockSmith : CustomKeycard, ILumosItem - { - public override uint Id { get; set; } = 1056; - public override string Name { get; set; } = "LockSmith Card"; - public override string Description { get; set; } = "You can lock a door in 2 seconds, the door will move to the opposite state and will be locked for 30 seconds"; - public override float Weight { get; set; } = 0.65f; - - private Dictionary lastUsed = new Dictionary(); - - // Item cooldown in seconds - private int Cooldown { get; set; } = 120; - - public UnityEngine.Color Color { get; set; } = UnityEngine.Color.gray; - - private float LockTime = 30f; - - public override SpawnProperties SpawnProperties { get; set; } = new SpawnProperties() - { - Limit = 2, - DynamicSpawnPoints = new List - { - new DynamicSpawnPoint() - { - Chance = 20, - Location = SpawnLocationType.InsideHidChamber, - }, - new DynamicSpawnPoint() - { - Chance= 30, - Location = SpawnLocationType.InsideEscapePrimary, - }, - new DynamicSpawnPoint() - { - Chance= 20, - Location = SpawnLocationType.InsideSurfaceNuke, - }, - }, - }; - - - protected override void SubscribeEvents() - { - Exiled.Events.Handlers.Player.InteractingDoor += OnUsing; - base.SubscribeEvents(); - } - - /// - protected override void UnsubscribeEvents() - { - Exiled.Events.Handlers.Player.InteractingDoor -= OnUsing; - base.UnsubscribeEvents(); - } - - private void OnUsing(InteractingDoorEventArgs ev) - { - List doors = new List - { - DoorType.GateA, - DoorType.GateB, - }; - - if (!Check(ev.Player.CurrentItem)) - return; - - if (lastUsed.ContainsKey(ev.Player)) - { - - DateTime usableTime = lastUsed[ev.Player] + TimeSpan.FromSeconds(Cooldown); - if (DateTime.Now > usableTime) - { - ev.Player.ShowHint($"You must wait another {Math.Round((DateTime.Now - usableTime).TotalSeconds, 2)} seconds to use {Name}"); - return; - } - else - { - lastUsed.Remove(ev.Player); - } - } - - if (doors.Contains(ev.Door.Type) || ev.Door.IsLocked) - { - ev.Player.ShowHint("This door can't be locked down by Lock Smith"); - return; - } - - ev.IsAllowed = true; - ev.Door.IsOpen = !ev.Door.IsOpen; - ev.Door.Lock(LockTime, DoorLockType.Isolation); - lastUsed.Add(ev.Player, DateTime.UtcNow); - } - } -} From 89d0e79136eacd3e72d27f1f1de139ff219c7585 Mon Sep 17 00:00:00 2001 From: Omer <113857370+OmerGS@users.noreply.github.com> Date: Mon, 10 Feb 2025 10:08:05 +0100 Subject: [PATCH 175/853] changed Warhead event --- .../GE/CassieGoCrazy.cs | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/KruacentExiled/KE.GlobalEventFramework.Examples/GE/CassieGoCrazy.cs b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/CassieGoCrazy.cs index 733ad966..70d80e6c 100644 --- a/KruacentExiled/KE.GlobalEventFramework.Examples/GE/CassieGoCrazy.cs +++ b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/CassieGoCrazy.cs @@ -26,12 +26,12 @@ public class CassieGoCrazy : GlobalEvent, IStart /// /// The cooldown between 2 cassie event /// - public int Cooldown { get; set; } = 280; + public int Cooldown { get; set; } = 380; /// /// Percentage for rare event to occur /// - public int RareEvent { get; set; } = 7; + public int RareEvent { get; set; } = 2; /// /// Starts a coroutine to perform random actions during the game. @@ -56,9 +56,13 @@ public IEnumerator Start() // Starting the Warhead case 2: - Warhead.Start(); + if (!Warhead.IsDetonated) + { + Warhead.Start(); + } break; - + + // Change Map Color to Cyan case 3: Map.ChangeLightsColor(UnityEngine.Color.cyan); @@ -73,7 +77,8 @@ public IEnumerator Start() Map.TurnOffAllLights(2, Exiled.API.Enums.ZoneType.HeavyContainment); Map.TurnOffAllLights(2, Exiled.API.Enums.ZoneType.Entrance); - Warhead.Start(); + if(!Warhead.IsDetonated) + Warhead.Start(); for (int i = 0; i < 10; i++) { @@ -94,7 +99,7 @@ public IEnumerator Start() { Player target = nonScpPlayers[UnityEngine.Random.Range(0, nonScpPlayers.Count)]; - Cassie.Message("New target : " + target); + Cassie.Message("New target : " + target.Nickname, true, true, true); void OnPlayerDeath(DyingEventArgs ev) { @@ -123,9 +128,7 @@ void GiveRandomRewardPlayer(Player player) { var items = new List { - ItemType.Jailbird, ItemType.ParticleDisruptor, - ItemType.MicroHID, ItemType.Coin, ItemType.KeycardO5, ItemType.SCP268 From e5c1300c4eee7361c68044254bddfa53bfc7d0dc Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Mon, 10 Feb 2025 14:27:16 +0100 Subject: [PATCH 176/853] lights doesn't work but sepated effect and item --- .../KE.Items/Extension/CustomItemExtension.cs | 13 ++ .../KE.Items/Interface/CustomGrenadeEffect.cs | 59 ++++++++++ .../KE.Items/Interface/CustomItemEffect.cs | 13 ++ .../KE.Items/Interface/ICustomItem.cs | 13 ++ .../KE.Items/ItemEffects/HealZoneEffect.cs | 69 +++++++++++ .../KE.Items/ItemEffects/MolotovEffect.cs | 111 ++++++++++++++++++ KruacentExiled/KE.Items/Items/DivinePills.cs | 13 +- KruacentExiled/KE.Items/Items/HealZone.cs | 53 ++------- KruacentExiled/KE.Items/Items/Molotov.cs | 88 ++------------ KruacentExiled/KE.Items/MainPlugin.cs | 6 +- 10 files changed, 300 insertions(+), 138 deletions(-) create mode 100644 KruacentExiled/KE.Items/Extension/CustomItemExtension.cs create mode 100644 KruacentExiled/KE.Items/Interface/CustomGrenadeEffect.cs create mode 100644 KruacentExiled/KE.Items/Interface/CustomItemEffect.cs create mode 100644 KruacentExiled/KE.Items/Interface/ICustomItem.cs create mode 100644 KruacentExiled/KE.Items/ItemEffects/HealZoneEffect.cs create mode 100644 KruacentExiled/KE.Items/ItemEffects/MolotovEffect.cs diff --git a/KruacentExiled/KE.Items/Extension/CustomItemExtension.cs b/KruacentExiled/KE.Items/Extension/CustomItemExtension.cs new file mode 100644 index 00000000..6a1a2c06 --- /dev/null +++ b/KruacentExiled/KE.Items/Extension/CustomItemExtension.cs @@ -0,0 +1,13 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace KE.Items.Extension +{ + public static class CustomItemExtension + { + + } +} diff --git a/KruacentExiled/KE.Items/Interface/CustomGrenadeEffect.cs b/KruacentExiled/KE.Items/Interface/CustomGrenadeEffect.cs new file mode 100644 index 00000000..fa6e30d1 --- /dev/null +++ b/KruacentExiled/KE.Items/Interface/CustomGrenadeEffect.cs @@ -0,0 +1,59 @@ +using Exiled.CustomItems.API.Features; +using Exiled.Events.EventArgs.Map; +using Exiled.Events.EventArgs.Player; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace KE.Items.Interface +{ + public abstract class CustomGrenadeEffect : CustomItemEffect + { + // + // Summary: + // Handles tracking thrown requests by custom grenades. + // + // Parameters: + // ev: + // Exiled.Events.EventArgs.Player.ThrowingRequestEventArgs. + public virtual void OnThrowingRequest(ThrowingRequestEventArgs ev) + { + } + + // + // Summary: + // Handles tracking thrown custom grenades. + // + // Parameters: + // ev: + // Exiled.Events.EventArgs.Player.ThrownProjectileEventArgs. + public virtual void OnThrownProjectile(ThrownProjectileEventArgs ev) + { + } + + // + // Summary: + // Handles tracking exploded custom grenades. + // + // Parameters: + // ev: + // Exiled.Events.EventArgs.Map.ExplodingGrenadeEventArgs. + public virtual void OnExploding(ExplodingGrenadeEventArgs ev) + { + } + + // + // Summary: + // Handles the tracking of custom grenade pickups that are changed into live grenades + // by a frag grenade explosion. + // + // Parameters: + // ev: + // Exiled.Events.EventArgs.Map.ChangedIntoGrenadeEventArgs. + public virtual void OnChangedIntoGrenade(ChangedIntoGrenadeEventArgs ev) + { + } + } +} diff --git a/KruacentExiled/KE.Items/Interface/CustomItemEffect.cs b/KruacentExiled/KE.Items/Interface/CustomItemEffect.cs new file mode 100644 index 00000000..3a363a1e --- /dev/null +++ b/KruacentExiled/KE.Items/Interface/CustomItemEffect.cs @@ -0,0 +1,13 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace KE.Items.Interface +{ + public class CustomItemEffect + { + + } +} diff --git a/KruacentExiled/KE.Items/Interface/ICustomItem.cs b/KruacentExiled/KE.Items/Interface/ICustomItem.cs new file mode 100644 index 00000000..cc03d1e6 --- /dev/null +++ b/KruacentExiled/KE.Items/Interface/ICustomItem.cs @@ -0,0 +1,13 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace KE.Items.Interface +{ + public interface ICustomItem + { + CustomItemEffect Effect { get; set; } + } +} diff --git a/KruacentExiled/KE.Items/ItemEffects/HealZoneEffect.cs b/KruacentExiled/KE.Items/ItemEffects/HealZoneEffect.cs new file mode 100644 index 00000000..e31e447e --- /dev/null +++ b/KruacentExiled/KE.Items/ItemEffects/HealZoneEffect.cs @@ -0,0 +1,69 @@ +using Exiled.API.Features; +using Exiled.API.Features.Toys; +using Exiled.Events.EventArgs.Map; +using KE.Items.Interface; +using MEC; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using UnityEngine; + +namespace KE.Items.ItemEffects +{ + public class HealZoneEffect : CustomGrenadeEffect + { + + public override void OnExploding(ExplodingGrenadeEventArgs ev) + { + float cylinderSize = 5; + + ev.TargetsToAffect.Clear(); + + Player playerThrowingGrenade = ev.Player; + Vector3 healZonePosition = ev.Position; + Primitive wall = Primitive.Create(PrimitiveType.Cylinder, healZonePosition, null, new Vector3(cylinderSize, 0.01f, cylinderSize), true); + wall.Collidable = false; + wall.Visible = true; + + wall.Color = Color.green; + + var coroutineHandler = Timing.RunCoroutine(HealZoneHeal(wall.Position, cylinderSize, playerThrowingGrenade)); + + Timing.CallDelayed(20, () => { + wall.UnSpawn(); + Timing.KillCoroutines(coroutineHandler); + wall.Destroy(); + }); + } + + private IEnumerator HealZoneHeal(Vector3 wallPosition, float cylinderSize, Player playerThrowingGrenade) + { + while (true) + { + foreach (Player player in Exiled.API.Features.Player.List) + { + // Check if a player is in the zone. + if (IsPlayerInZone(player, wallPosition, cylinderSize)) + { + if (playerThrowingGrenade.Role.Team == player.Role.Team) + { + player.Heal(1); + } + } + } + + // Waiting 0.5s before re-check. + yield return Timing.WaitForSeconds(0.5f); + } + } + + private bool IsPlayerInZone(Player player, Vector3 zonePosition, float radius) + { + float distance = Vector3.Distance(new Vector3(player.Position.x, 0, player.Position.z), + new Vector3(zonePosition.x, 0, zonePosition.z)); + return distance <= (radius / 2); + } + } +} diff --git a/KruacentExiled/KE.Items/ItemEffects/MolotovEffect.cs b/KruacentExiled/KE.Items/ItemEffects/MolotovEffect.cs new file mode 100644 index 00000000..e0522a98 --- /dev/null +++ b/KruacentExiled/KE.Items/ItemEffects/MolotovEffect.cs @@ -0,0 +1,111 @@ +using Exiled.API.Features; +using Exiled.API.Features.Toys; +using Exiled.Events.EventArgs.Map; +using KE.Items.Interface; +using MEC; +using PlayerRoles; +using Exiled.API.Enums; +using System.Collections.Generic; +using UnityEngine; + +namespace KE.Items.ItemEffects +{ + public class MolotovEffect : CustomGrenadeEffect + { + public const float RefreshRate = 0.5f; + public const float Duration = 20f; + public float CylinderSize { get; set; } = 5; + + + public void Effect() + { + + + } + + public void Effect(ExplodingGrenadeEventArgs ev) + { + float cylinderSize = CylinderSize; + + ev.TargetsToAffect.Clear(); + + Player playerThrowingGrenade = ev.Player; + Vector3 molotovPosition = ev.Position; + Primitive wall = Primitive.Create(PrimitiveType.Cylinder, molotovPosition, null, new Vector3(cylinderSize, 0.01f, cylinderSize), true); + wall.Collidable = false; + wall.Visible = true; + + wall.Color = Color.red; + + var coroutineHandler = Timing.RunCoroutine(DamageInMolotovZone(wall.Position, cylinderSize, playerThrowingGrenade)); + + Timing.CallDelayed(Duration, () => { + wall.UnSpawn(); + Timing.KillCoroutines(coroutineHandler); + wall.Destroy(); + }); + } + + + private IEnumerator DamageInMolotovZone(Vector3 wallPosition, float cylinderSize, Player playerThrowingGrenade) + { + // Dictionary that stores the time each player has spent inside the zone (in seconds). + Dictionary playerTimeInZone = new Dictionary(); + + while (true) + { + foreach (Player player in Player.List) + { + if (IsPlayerInZone(player, wallPosition, cylinderSize)) + { + if (Exiled.API.Features.Server.FriendlyFire || playerThrowingGrenade.Role.Team != player.Role.Team || playerThrowingGrenade == player) + { + if (player.IsHuman || player.Role == RoleTypeId.Scp0492) + { + if (playerTimeInZone.ContainsKey(player)) + { + // increase time each frame. + playerTimeInZone[player] += Time.deltaTime; + } + else + { + // Init the time in dictionnary of the player. + playerTimeInZone[player] = Time.deltaTime; + } + + // time of player spend inside of molotov zone. + float timeInZone = playerTimeInZone[player]; + + // Beginning it willbe 5dm/s, after it will be linearly higher the damage until 20dm/s. + float damage = Mathf.Lerp(2.5f, 10f, timeInZone / 20f); + + // double damage if it's zombie cuz it has more hp. + if (player.Role == RoleTypeId.Scp0492) + { + damage *= 2.5f; + } + + player.Hurt(damage, DamageType.Bleeding); + } + else if (player.IsScp) + { + player.Hurt(player.Health / 150, DamageType.Bleeding); + } + + } + } + } + + yield return Timing.WaitForSeconds(RefreshRate); + } + } + + + private bool IsPlayerInZone(Player player, Vector3 zonePosition, float radius) + { + float distance = Vector3.Distance(new Vector3(player.Position.x, 0, player.Position.z), + new Vector3(zonePosition.x, 0, zonePosition.z)); + return distance <= (radius / 2); + } + } +} diff --git a/KruacentExiled/KE.Items/Items/DivinePills.cs b/KruacentExiled/KE.Items/Items/DivinePills.cs index 61b2a3c3..5d535951 100644 --- a/KruacentExiled/KE.Items/Items/DivinePills.cs +++ b/KruacentExiled/KE.Items/Items/DivinePills.cs @@ -71,8 +71,6 @@ public class DivinePills : CustomItem, ILumosItem protected override void SubscribeEvents() { PlayerHandle.UsingItem += OnUsingItem; - Exiled.Events.Handlers.Scp914.UpgradingInventoryItem += OnUpgrading; - //Exiled.Events.Handlers.Scp914.UpgradingPickup += Up; //break the lights base.SubscribeEvents(); } @@ -80,12 +78,10 @@ protected override void SubscribeEvents() protected override void UnsubscribeEvents() { PlayerHandle.UsingItem -= OnUsingItem; - Exiled.Events.Handlers.Scp914.UpgradingInventoryItem -= OnUpgrading; - //Exiled.Events.Handlers.Scp914.UpgradingPickup -= Up; //break the lights base.UnsubscribeEvents(); } - private void Up(UpgradingPickupEventArgs ev) + protected override void OnUpgrading(UpgradingEventArgs ev) { if (!Check(ev.Pickup)) return; @@ -97,15 +93,17 @@ private void Up(UpgradingPickupEventArgs ev) { //success ev.Pickup.Destroy(); - TrySpawn("True Divine Pills",ev.OutputPosition,out Pickup _); + TrySpawn("True Divine Pills", ev.OutputPosition, out Pickup a); + ev.IsAllowed = true; } else ev.IsAllowed = false; } - private void OnUpgrading(UpgradingInventoryItemEventArgs ev) + protected override void OnUpgrading(UpgradingItemEventArgs ev) { + if (!Check(ev.Item)) return; if (ev.KnobSetting != Scp914.Scp914KnobSetting.VeryFine) @@ -124,7 +122,6 @@ private void OnUpgrading(UpgradingInventoryItemEventArgs ev) ev.Player.ShowHint("no luck"); ev.IsAllowed = false; } - } private void OnUsingItem(UsingItemEventArgs ev) diff --git a/KruacentExiled/KE.Items/Items/HealZone.cs b/KruacentExiled/KE.Items/Items/HealZone.cs index da61139d..f5d2dafe 100644 --- a/KruacentExiled/KE.Items/Items/HealZone.cs +++ b/KruacentExiled/KE.Items/Items/HealZone.cs @@ -9,11 +9,12 @@ using Player = Exiled.API.Features.Player; using MEC; using UnityEngine; +using KE.Items.ItemEffects; namespace KE.Items.Items { [CustomItem(ItemType.GrenadeFlash)] - public class HealZone : CustomGrenade, ILumosItem + public class HealZone : CustomGrenade, ILumosItem, ICustomItem { public override uint Id { get; set; } = 1051; public override string Name { get; set; } = "Heal Zone"; @@ -23,6 +24,7 @@ public class HealZone : CustomGrenade, ILumosItem public override bool ExplodeOnCollision { get; set; } = true; public float DamageModifier { get; set; } = 0f; public UnityEngine.Color Color { get; set; } = UnityEngine.Color.green; + public CustomItemEffect Effect { get; set; } public override SpawnProperties SpawnProperties { get; set; } = new SpawnProperties() { Limit = 3, @@ -66,55 +68,14 @@ public class HealZone : CustomGrenade, ILumosItem }, }; - protected override void OnExploding(ExplodingGrenadeEventArgs ev) + public HealZone() { - float cylinderSize = 5; - - ev.TargetsToAffect.Clear(); - - Player playerThrowingGrenade = ev.Player; - Vector3 healZonePosition = ev.Position; - Primitive wall = Primitive.Create(PrimitiveType.Cylinder, healZonePosition, null, new Vector3(cylinderSize, 0.01f, cylinderSize), true); - wall.Collidable = false; - wall.Visible = true; - - wall.Color = Color.green; - - var coroutineHandler = Timing.RunCoroutine(HealZoneHeal(wall.Position, cylinderSize, playerThrowingGrenade)); - - Timing.CallDelayed(20, () => { - wall.UnSpawn(); - Timing.KillCoroutines(coroutineHandler); - wall.Destroy(); - }); + Effect = new HealZoneEffect(); } - private IEnumerator HealZoneHeal(Vector3 wallPosition, float cylinderSize, Player playerThrowingGrenade) - { - while (true) - { - foreach (Player player in Exiled.API.Features.Player.List) - { - // Check if a player is in the zone. - if (IsPlayerInZone(player, wallPosition, cylinderSize)) - { - if(playerThrowingGrenade.Role.Team == player.Role.Team) - { - player.Heal(1); - } - } - } - - // Waiting 0.5s before re-check. - yield return Timing.WaitForSeconds(0.5f); - } - } - - private bool IsPlayerInZone(Player player, Vector3 zonePosition, float radius) + protected override void OnExploding(ExplodingGrenadeEventArgs ev) { - float distance = Vector3.Distance(new Vector3(player.Position.x, 0, player.Position.z), - new Vector3(zonePosition.x, 0, zonePosition.z)); - return distance <= (radius/2) ; + //Effect.OnExploding(ev); } } } \ No newline at end of file diff --git a/KruacentExiled/KE.Items/Items/Molotov.cs b/KruacentExiled/KE.Items/Items/Molotov.cs index bc57cc1d..51957eb1 100644 --- a/KruacentExiled/KE.Items/Items/Molotov.cs +++ b/KruacentExiled/KE.Items/Items/Molotov.cs @@ -10,11 +10,12 @@ using MEC; using UnityEngine; using PlayerRoles; +using KE.Items.ItemEffects; namespace KE.Items.Items { [CustomItem(ItemType.GrenadeFlash)] - public class Molotov : CustomGrenade, ILumosItem + public class Molotov : CustomGrenade, ILumosItem, ICustomItem { public override uint Id { get; set; } = 1049; public override string Name { get; set; } = "Cocktail Molotov"; @@ -24,8 +25,7 @@ public class Molotov : CustomGrenade, ILumosItem public override bool ExplodeOnCollision { get; set; } = true; public float DamageModifier { get; set; } = 0f; public UnityEngine.Color Color { get; set; } = UnityEngine.Color.yellow; - private const float RefreshRate = 0.5f; - private const float Duration = 20f; + public CustomItemEffect Effect { get; set; } public override SpawnProperties SpawnProperties { get; set; } = new SpawnProperties() { Limit = 2, @@ -69,88 +69,16 @@ public class Molotov : CustomGrenade, ILumosItem }, }; - protected override void OnExploding(ExplodingGrenadeEventArgs ev) - { - float cylinderSize = 5; - - ev.TargetsToAffect.Clear(); - - Player playerThrowingGrenade = ev.Player; - Vector3 molotovPosition = ev.Position; - Primitive wall = Primitive.Create(PrimitiveType.Cylinder, molotovPosition, null, new Vector3(cylinderSize, 0.01f, cylinderSize), true); - wall.Collidable = false; - wall.Visible = true; - - wall.Color = Color.red; - var coroutineHandler = Timing.RunCoroutine(DamageInMolotovZone(wall.Position, cylinderSize, playerThrowingGrenade)); - - Timing.CallDelayed(Duration, () => { - wall.UnSpawn(); - Timing.KillCoroutines(coroutineHandler); - wall.Destroy(); - }); - } - - private IEnumerator DamageInMolotovZone(Vector3 wallPosition, float cylinderSize, Player playerThrowingGrenade) + public Molotov() { - // Dictionary that stores the time each player has spent inside the zone (in seconds). - Dictionary playerTimeInZone = new Dictionary(); - - while (true) - { - foreach (Player player in Player.List) - { - if (IsPlayerInZone(player, wallPosition, cylinderSize)) - { - if (Exiled.API.Features.Server.FriendlyFire || playerThrowingGrenade.Role.Team != player.Role.Team || playerThrowingGrenade == player) - { - if (player.IsHuman || player.Role == RoleTypeId.Scp0492) - { - if (playerTimeInZone.ContainsKey(player)) - { - // increase time each frame. - playerTimeInZone[player] += Time.deltaTime; - } - else - { - // Init the time in dictionnary of the player. - playerTimeInZone[player] = Time.deltaTime; - } - - // time of player spend inside of molotov zone. - float timeInZone = playerTimeInZone[player]; - - // Beginning it willbe 5dm/s, after it will be linearly higher the damage until 20dm/s. - float damage = Mathf.Lerp(2.5f, 10f, timeInZone / 20f); - - // double damage if it's zombie cuz it has more hp. - if (player.Role == RoleTypeId.Scp0492) - { - damage *= 2.5f; - } - - player.Hurt(damage, DamageType.Bleeding); - } - else if (player.IsScp) - { - player.Hurt(player.Health / 150, DamageType.Bleeding); - } - - } - } - } - - yield return Timing.WaitForSeconds(RefreshRate); - } + Effect = new MolotovEffect(); } - - private bool IsPlayerInZone(Player player, Vector3 zonePosition, float radius) + protected override void OnExploding(ExplodingGrenadeEventArgs ev) { - float distance = Vector3.Distance(new Vector3(player.Position.x, 0, player.Position.z), - new Vector3(zonePosition.x, 0, zonePosition.z)); - return distance <= (radius/2) ; + //Effect.OnExploding(ev); } + } } \ No newline at end of file diff --git a/KruacentExiled/KE.Items/MainPlugin.cs b/KruacentExiled/KE.Items/MainPlugin.cs index 55c88d4f..fcadbce6 100644 --- a/KruacentExiled/KE.Items/MainPlugin.cs +++ b/KruacentExiled/KE.Items/MainPlugin.cs @@ -55,7 +55,6 @@ public void Pick(PickingUpItemEventArgs ev) Light val = pl[pickup]; if (val != null) { - val.UnSpawn(); val.Destroy(); } pl.Remove(pickup); @@ -77,7 +76,6 @@ public void OnRoundStarted() internal IEnumerator LightP() { - foreach (var p in Pickup.List) { if (p != null) @@ -87,8 +85,10 @@ internal IEnumerator LightP() } } + while (Round.InProgress) { + foreach (var x in pl.ToList()) { if(CustomItem.TryGet(x.Key, out CustomItem cui) && cui is ILumosItem ci) @@ -98,7 +98,6 @@ internal IEnumerator LightP() if (x.Value != null) { Light val = x.Value; - val.UnSpawn(); val.Destroy(); } pl[x.Key] = light; @@ -107,7 +106,6 @@ internal IEnumerator LightP() else { Light val = x.Value; - val.UnSpawn(); val.Destroy(); pl.Remove(x.Key); } From 6da59181090ef211ffd074cd20f6a6539d755e8c Mon Sep 17 00:00:00 2001 From: Omer <113857370+OmerGS@users.noreply.github.com> Date: Tue, 11 Feb 2025 10:21:42 +0100 Subject: [PATCH 177/853] Inventory swap added. --- .../GE/SwapProtocol.cs | 46 +++++++++++++++++-- 1 file changed, 43 insertions(+), 3 deletions(-) diff --git a/KruacentExiled/KE.GlobalEventFramework.Examples/GE/SwapProtocol.cs b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/SwapProtocol.cs index de880747..2282d027 100644 --- a/KruacentExiled/KE.GlobalEventFramework.Examples/GE/SwapProtocol.cs +++ b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/SwapProtocol.cs @@ -6,6 +6,8 @@ using System.Linq; using Exiled.API.Extensions; using Exiled.API.Features; +using Exiled.API.Enums; +using static UnityEngine.GraphicsBuffer; namespace KE.GlobalEventFramework.Examples.GE { @@ -21,7 +23,7 @@ public IEnumerator Start() while (!Round.IsEnded) { // every 5 min - yield return Timing.WaitForSeconds(300); + yield return Timing.WaitForSeconds(10); ChangingPlayer(); } } @@ -33,7 +35,7 @@ private void ChangingPlayer() if (playerInServer.Count < 2) { - Log.Warn("Pas assez de joueurs vivants pour effectuer un échange !"); + Log.Debug("Pas assez de joueurs vivants pour effectuer un échange !"); return; } @@ -50,7 +52,45 @@ private void ChangingPlayer() for (int i = 0; i < playerInServer.Count; i++) { int nextIndex = (i + 1) % playerInServer.Count; - playerInServer[i].Role.Set(playersRoles[nextIndex]); + + var player = playerInServer[i]; + var target = playerInServer[nextIndex]; + + // Récupération des objets + List items1 = player.Items.Select(item => item.Type).ToList(); + List items2 = target.Items.Select(item => item.Type).ToList(); + + // Sauvegarde et suppression des munitions + Dictionary ammo1 = new Dictionary(); + Dictionary ammo2 = new Dictionary(); + + for (int j = 0; j < player.Ammo.Count; j++) + { + ammo1.Add(player.Ammo.ElementAt(j).Key.GetAmmoType(), player.Ammo.ElementAt(j).Value); + player.SetAmmo(ammo1.ElementAt(j).Key, 0); + } + for (int j = 0; j < target.Ammo.Count; j++) + { + ammo2.Add(target.Ammo.ElementAt(j).Key.GetAmmoType(), target.Ammo.ElementAt(j).Value); + target.SetAmmo(ammo2.ElementAt(j).Key, 0); + } + + // Changement de rôle + player.Role.Set(playersRoles[nextIndex], PlayerRoles.RoleSpawnFlags.AssignInventory); + + // Attribution des inventaires + target.ResetInventory(items1); + player.ResetInventory(items2); + + // Attribution des munitions + foreach (var ammo in ammo2) + { + player.SetAmmo(ammo.Key, ammo.Value); + } + foreach (var ammo in ammo1) + { + target.SetAmmo(ammo.Key, ammo.Value); + } } } From 915df7be43444c962256644cf76f4f1a0c501293 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Wed, 12 Feb 2025 19:26:28 +0100 Subject: [PATCH 178/853] reorganized malfunctions --- .../API/Feature/MalfunctionEffect.cs | 18 +++ .../API/{ => Feature}/Malfunctions.cs | 125 ++++++++++++------ .../API/Interfaces/IReversibleEffect.cs | 14 ++ .../API/MalfunctionEffect/ForceDecon.cs | 48 +++++++ .../API/MalfunctionEffect/Locks.cs | 12 ++ .../GE/SystemMalfunction.cs | 2 +- 6 files changed, 178 insertions(+), 41 deletions(-) create mode 100644 KruacentExiled/KE.GlobalEventFramework.Examples/API/Feature/MalfunctionEffect.cs rename KruacentExiled/KE.GlobalEventFramework.Examples/API/{ => Feature}/Malfunctions.cs (60%) create mode 100644 KruacentExiled/KE.GlobalEventFramework.Examples/API/Interfaces/IReversibleEffect.cs create mode 100644 KruacentExiled/KE.GlobalEventFramework.Examples/API/MalfunctionEffect/ForceDecon.cs create mode 100644 KruacentExiled/KE.GlobalEventFramework.Examples/API/MalfunctionEffect/Locks.cs diff --git a/KruacentExiled/KE.GlobalEventFramework.Examples/API/Feature/MalfunctionEffect.cs b/KruacentExiled/KE.GlobalEventFramework.Examples/API/Feature/MalfunctionEffect.cs new file mode 100644 index 00000000..5e452254 --- /dev/null +++ b/KruacentExiled/KE.GlobalEventFramework.Examples/API/Feature/MalfunctionEffect.cs @@ -0,0 +1,18 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace KE.GlobalEventFramework.Examples.API.Feature +{ + public abstract class MalfunctionEffect + { + public abstract string VoiceLine { get; } + public abstract string VoiceLineTranslated { get; } + public abstract sbyte MalfunctionActivation { get; } + + public abstract void ActivateEffect(); + + } +} diff --git a/KruacentExiled/KE.GlobalEventFramework.Examples/API/Malfunctions.cs b/KruacentExiled/KE.GlobalEventFramework.Examples/API/Feature/Malfunctions.cs similarity index 60% rename from KruacentExiled/KE.GlobalEventFramework.Examples/API/Malfunctions.cs rename to KruacentExiled/KE.GlobalEventFramework.Examples/API/Feature/Malfunctions.cs index b99cbadf..ddd51e16 100644 --- a/KruacentExiled/KE.GlobalEventFramework.Examples/API/Malfunctions.cs +++ b/KruacentExiled/KE.GlobalEventFramework.Examples/API/Feature/Malfunctions.cs @@ -7,37 +7,64 @@ using PlayerRoles; using System; using System.Collections.Generic; +using System.Collections.ObjectModel; using System.Linq; using System.Text; using System.Threading.Tasks; using Utils.NonAllocLINQ; -namespace KE.GlobalEventFramework.Examples.API +namespace KE.GlobalEventFramework.Examples.API.Feature { public class Malfunctions { private sbyte _malfunction = 15; + public const sbyte Lower = -50; + public const sbyte Higher = 125; public sbyte Malfunction { get { return _malfunction; } - private set + set { - if (value > 125) _malfunction = 125; - else if (value < -50) _malfunction = -50; + if (value > Higher) _malfunction = Higher; + else if (value < Lower) _malfunction = Lower; else _malfunction = value; } } + + public MalfunctionLevel MalfunctionLevels + { + get{return (MalfunctionLevel)Malfunction;} + } + + private HashSet MalfunctionEffects = new HashSet(); + public sbyte MalfunctionAdd { get; set; } = 1; private bool[] CassieVoiceLine = new[] { true, true, true, true, true }; - public bool CassieYapYap { get; private set; } = false; + private string[] msg = new[] + { + "Malfunctions back to more stable levels", + "Malfunctions levels above . 25 percent . . decontamination of Light Containment Zone in . 30 seconds", + "Malfunctions levels above . 50 percent . . terminating all door locks", + "", + "Malfunctions levels above . 90 percent . . starting emergency warhead", + }; + + private string[] msgtrans = new[] + { + "Malfunctions back to more stable levels", + "Malfunctions levels above 25%, decontamination of Light Containment Zone in 30 seconds", + "Malfunctions levels above 50%, terminating all door locks", + "", + "Malfunctions levels above 90%, starting emergency warhead", + + }; + public bool CassieYapYap { get; set; } = false; private Dictionary doorkeys = Door.List.ToDictionary(d => d, d => d.KeycardPermissions); private CoroutineHandle _checkNuke; internal Malfunctions() { } - - internal IEnumerator Tick() { Log.Debug("in tick"); @@ -54,55 +81,53 @@ internal IEnumerator Tick() private void CassieVoice(sbyte malfunction) { - if (malfunction <= 0 && (CassieVoiceLine[0] || CassieYapYap)) + if (malfunction <= 0) { - Cassie.MessageTranslated("Malfunctions back to more stable levels", - "Malfunctions back to more stable levels", false, false); - CassieVoiceLine[0] = false; + CassieSay(0); return; } //force decontamination - if (malfunction >= 25 && (CassieVoiceLine[1] || CassieYapYap) && !Map.IsLczDecontaminated && Map.IsDecontaminationEnabled) + if (malfunction >= 25) { - string msg = "Malfunctions levels above . 25 percent . . decontamination of Light Containment Zone in . 30 seconds"; - Cassie.MessageTranslated(msg, - "Malfunctions levels above 25%, decontamination of Light Containment Zone in 30 seconds", false, false); - CassieVoiceLine[1] = false; - Door.List.ToList().ForEach(d => + if (!Map.IsLczDecontaminated && Map.IsDecontaminationEnabled) { - if (d.Zone == ZoneType.LightContainment) + string msg = CassieSay(1); + Door.List.ToList().ForEach(d => { - if (!d.IsElevator) + if (d.Zone == ZoneType.LightContainment) { - d.ChangeLock(DoorLockType.DecontEvacuate); - d.IsOpen = true; - } - - } - }); - Timing.CallDelayed(30 + Cassie.CalculateDuration(msg), () => - { - Map.StartDecontamination(); + if (!d.IsElevator) + { + d.ChangeLock(DoorLockType.DecontEvacuate); + d.IsOpen = true; + } - Door.List.ToList().ForEach(d => + } + }); + Timing.CallDelayed(30 + Cassie.CalculateDuration(msg), () => { - if (d.IsElevator && (d.Type == DoorType.ElevatorLczA || d.Type == DoorType.ElevatorLczB)) + Map.StartDecontamination(); + + Door.List.ToList().ForEach(d => { - d.Lock(DoorLockType.DecontEvacuate); - d.IsOpen = false; - } + if (d.IsElevator && (d.Type == DoorType.ElevatorLczA || d.Type == DoorType.ElevatorLczB)) + { + d.Lock(DoorLockType.DecontEvacuate); + d.IsOpen = false; + } + }); }); - }); - return; + return; + } + } + //remove the lock on every doors - if (malfunction >= 50 && (CassieVoiceLine[2] || CassieYapYap)) + if (malfunction >= 50) { - CassieVoiceLine[2] = false; - Cassie.MessageTranslated("Malfunctions levels above . 50 percent . . terminating all door locks", - "Malfunctions levels above 50 percent, terminating all door locks", false, false); + string msg = CassieSay(2); Door.List.ToList().ForEach(d => { if (d.IsKeycardDoor) @@ -147,6 +172,19 @@ private void CassieVoice(sbyte malfunction) } + private string CassieSay(int id) + { + if (!string.IsNullOrEmpty(msg[id])) + return ""; + if (CassieVoiceLine[id] || CassieYapYap) + { + CassieVoiceLine[id] = false; + + Cassie.MessageTranslated(msg[id], msgtrans[id], false, false); + } + return msg[id]; + } + private IEnumerator CheckNuke() { while (Warhead.IsInProgress) @@ -201,6 +239,13 @@ internal void OnFinishingRevive(FinishingRecallEventArgs ev) - + public enum MalfunctionLevel + { + VeryLowMalfunction = 0, + LowMalfunction = 25, + MediumMalfunction = 50, + HighMalfunction = 75, + VeryHighMalfunction = 100, + } } } diff --git a/KruacentExiled/KE.GlobalEventFramework.Examples/API/Interfaces/IReversibleEffect.cs b/KruacentExiled/KE.GlobalEventFramework.Examples/API/Interfaces/IReversibleEffect.cs new file mode 100644 index 00000000..4473ab78 --- /dev/null +++ b/KruacentExiled/KE.GlobalEventFramework.Examples/API/Interfaces/IReversibleEffect.cs @@ -0,0 +1,14 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace KE.GlobalEventFramework.Examples.API.Interfaces +{ + internal interface IReversibleEffect + { + sbyte MalfunctionDeactivation { get; } + void EffectDeactivate(); + } +} diff --git a/KruacentExiled/KE.GlobalEventFramework.Examples/API/MalfunctionEffect/ForceDecon.cs b/KruacentExiled/KE.GlobalEventFramework.Examples/API/MalfunctionEffect/ForceDecon.cs new file mode 100644 index 00000000..953212bc --- /dev/null +++ b/KruacentExiled/KE.GlobalEventFramework.Examples/API/MalfunctionEffect/ForceDecon.cs @@ -0,0 +1,48 @@ + + +using Exiled.API.Enums; +using Exiled.API.Features; +using Exiled.API.Features.Doors; +using MEC; +using System.Linq; + +namespace KE.GlobalEventFramework.Examples.API.MalfunctionEffect +{ + internal class ForceDecon : Feature.MalfunctionEffect + { + public override string VoiceLine { get; } = "Malfunctions levels above . 25 percent . . decontamination of Light Containment Zone in . 30 seconds"; + public override string VoiceLineTranslated { get; } = "Malfunctions levels above 25%, decontamination of Light Containment Zone in 30 seconds"; + public override sbyte MalfunctionActivation { get; } = 25; + + public override void ActivateEffect() + { + if (Map.IsLczDecontaminated || !Map.IsLczDecontaminated) return; + Door.List.ToList().ForEach(d => + { + if (d.Zone == ZoneType.LightContainment) + { + if (!d.IsElevator) + { + d.ChangeLock(DoorLockType.DecontEvacuate); + d.IsOpen = true; + } + + } + }); + Timing.CallDelayed(30 + Cassie.CalculateDuration(VoiceLine), () => + { + Map.StartDecontamination(); + + foreach (Door d in Door.List) + { + if (d.Type == DoorType.ElevatorLczA || d.Type == DoorType.ElevatorLczB) + { + d.Lock(DoorLockType.DecontEvacuate); + d.IsOpen = false; + } + } + }); + } + + } +} diff --git a/KruacentExiled/KE.GlobalEventFramework.Examples/API/MalfunctionEffect/Locks.cs b/KruacentExiled/KE.GlobalEventFramework.Examples/API/MalfunctionEffect/Locks.cs new file mode 100644 index 00000000..f9ac7c90 --- /dev/null +++ b/KruacentExiled/KE.GlobalEventFramework.Examples/API/MalfunctionEffect/Locks.cs @@ -0,0 +1,12 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace KE.GlobalEventFramework.Examples.API.MalfunctionEffect +{ + internal class Locks + { + } +} diff --git a/KruacentExiled/KE.GlobalEventFramework.Examples/GE/SystemMalfunction.cs b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/SystemMalfunction.cs index 850c54cd..7669d5de 100644 --- a/KruacentExiled/KE.GlobalEventFramework.Examples/GE/SystemMalfunction.cs +++ b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/SystemMalfunction.cs @@ -16,7 +16,7 @@ using Utils.NonAllocLINQ; using KeycardPermissions = Exiled.API.Enums.KeycardPermissions; using Exiled.Events.EventArgs.Scp049; -using KE.GlobalEventFramework.Examples.API; +using KE.GlobalEventFramework.Examples.API.Feature; namespace KE.GlobalEventFramework.Examples.GE { From 9cf754055e88640b28e352a7403cf68d26a285fc Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Wed, 12 Feb 2025 21:03:51 +0100 Subject: [PATCH 179/853] new hint system w/ RueI --- KruacentExiled/KE.Misc/KE.Misc.csproj | 1 + KruacentExiled/KE.Misc/KEHint.cs | 28 +++++++++++++++++++++++++++ KruacentExiled/KE.Misc/MainPlugin.cs | 2 +- 3 files changed, 30 insertions(+), 1 deletion(-) create mode 100644 KruacentExiled/KE.Misc/KEHint.cs diff --git a/KruacentExiled/KE.Misc/KE.Misc.csproj b/KruacentExiled/KE.Misc/KE.Misc.csproj index a1fb438a..e70fa610 100644 --- a/KruacentExiled/KE.Misc/KE.Misc.csproj +++ b/KruacentExiled/KE.Misc/KE.Misc.csproj @@ -6,6 +6,7 @@ + diff --git a/KruacentExiled/KE.Misc/KEHint.cs b/KruacentExiled/KE.Misc/KEHint.cs new file mode 100644 index 00000000..a32e6031 --- /dev/null +++ b/KruacentExiled/KE.Misc/KEHint.cs @@ -0,0 +1,28 @@ +using Exiled.API.Features; +using System; +using RueI.Extensions; +using RueI.Displays; + +namespace KE.Misc +{ + public static class KEHint + { + + public static void ShowHint(this Player player, Hint hint,float position) + { + ShowHint(player, hint.Content, position,TimeSpan.FromSeconds(hint.Duration)); + } + public static void ShowHint(this Player p, string message,float position, TimeSpan timeSpan) + { + ShowHint(p.ReferenceHub,message,position,timeSpan); + } + + public static void ShowHint(ReferenceHub hub, string message, float position,TimeSpan timeSpan) + { + DisplayCore c = DisplayCore.Get(hub); + + c.SetElemTemp(message, position, timeSpan, new RueI.Displays.Scheduling.TimedElemRef()); + } + + } +} diff --git a/KruacentExiled/KE.Misc/MainPlugin.cs b/KruacentExiled/KE.Misc/MainPlugin.cs index c9efc67d..ddb6db2b 100644 --- a/KruacentExiled/KE.Misc/MainPlugin.cs +++ b/KruacentExiled/KE.Misc/MainPlugin.cs @@ -130,7 +130,7 @@ private IEnumerator Timer(int secondsWaiting,List playerToShow, s Content = $"{secondsWaiting} seconds", Duration = 1 }; - playerToShow.ForEach(p => p.ShowHint(hint)); + playerToShow.ForEach(p => p.ShowHint(hint,0)); playerToShow.RemoveAll(p => p.Role != RoleTypeId.Scp173); yield return Timing.WaitForSeconds(1); secondsWaiting--; From b886d43367f7bdff02c47b99bcefb9a4fa9ca760 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Wed, 19 Feb 2025 21:46:42 +0100 Subject: [PATCH 180/853] remastered System Malfunction --- .../API/Feature/MalfunctionDisplay.cs | 106 +++++++++ .../API/Feature/MalfunctionEffect.cs | 1 + .../API/Feature/Malfunctions.cs | 204 +++++++----------- .../API/Interfaces/IReversibleEffect.cs | 5 +- .../API/MalfunctionEffects/AutoNuke.cs | 52 +++++ .../ForceDecon.cs | 6 +- .../API/MalfunctionEffects/Locks.cs | 50 +++++ .../GE/SystemMalfunction.cs | 11 +- .../KE.GlobalEventFramework.Examples.csproj | 3 +- .../MainPlugin.cs | 5 +- 10 files changed, 304 insertions(+), 139 deletions(-) create mode 100644 KruacentExiled/KE.GlobalEventFramework.Examples/API/Feature/MalfunctionDisplay.cs create mode 100644 KruacentExiled/KE.GlobalEventFramework.Examples/API/MalfunctionEffects/AutoNuke.cs rename KruacentExiled/KE.GlobalEventFramework.Examples/API/{MalfunctionEffect => MalfunctionEffects}/ForceDecon.cs (89%) create mode 100644 KruacentExiled/KE.GlobalEventFramework.Examples/API/MalfunctionEffects/Locks.cs diff --git a/KruacentExiled/KE.GlobalEventFramework.Examples/API/Feature/MalfunctionDisplay.cs b/KruacentExiled/KE.GlobalEventFramework.Examples/API/Feature/MalfunctionDisplay.cs new file mode 100644 index 00000000..e3e386ea --- /dev/null +++ b/KruacentExiled/KE.GlobalEventFramework.Examples/API/Feature/MalfunctionDisplay.cs @@ -0,0 +1,106 @@ +using Exiled.API.Features; +using InventorySystem.Items.Firearms.Modules; +using KE.GlobalEventFramework.Examples.API.Interfaces; +using KE.Utils; +using MEC; +using PlayerRoles; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace KE.GlobalEventFramework.Examples.API.Feature +{ + public class MalfunctionDisplay + { + private Malfunctions _malfunction; + public float RefreshRate { get; set; } = 5; + private CoroutineHandle _coroutineHandle; + public MalfunctionDisplay(Malfunctions malfunction) + { + _malfunction = malfunction; + _coroutineHandle = Show(); + } + + ~MalfunctionDisplay() + { + Timing.KillCoroutines(_coroutineHandle); + } + + public CoroutineHandle Show() + { + return Timing.RunCoroutine(Tick()); + } + + private IEnumerator Tick() + { + while (Round.InProgress) + { + yield return Timing.WaitForSeconds(RefreshRate); + ShowAllSpect(GetHint()); + } + } + + + + private void ShowAllSpect(RueIHint hint) + { + + foreach (Player p in Player.List.Where(p => p.Role == RoleTypeId.Spectator)) + { + + p.ShowHint(hint); + } + } + + private RueIHint GetHint() + { + string content = $" {GetCurrentMalfunction()}\n{GetAllEffect()}"; + return new RueIHint(content,RefreshRate+.1f,true,800); + } + + + private string GetCurrentMalfunction() + { + sbyte malfunction = _malfunction.Malfunction; + sbyte previous = _malfunction.PreviousMalfunction; + if (malfunction > previous) + return $" {malfunction}\u2191 (+{malfunction-previous})"; + if(malfunction < previous) + return $" {malfunction}\u2193 ({malfunction - previous})"; + else + return $" {malfunction}\u2192 ({malfunction - previous})"; + + } + + private string GetAllEffect() + { + string result = string.Empty; + foreach (MalfunctionEffect me in Malfunctions.MalfunctionEffects) + { + if (Malfunctions.EffectAlreadyActivated(me)) + { + if (IsREActivated(me)) result += ""; + result += $"{me.MalfunctionActivation} - {me.Name}"; + if (IsREActivated(me)) result += ""; + } + + } + return result; + } + private bool IsREActivated(MalfunctionEffect me) + { + if(me is IReversibleEffect re) + { + if(_malfunction.Malfunction >= re.MalfunctionDeactivation) + { + return true; + } + } + + return false; + } + + } +} diff --git a/KruacentExiled/KE.GlobalEventFramework.Examples/API/Feature/MalfunctionEffect.cs b/KruacentExiled/KE.GlobalEventFramework.Examples/API/Feature/MalfunctionEffect.cs index 5e452254..93789040 100644 --- a/KruacentExiled/KE.GlobalEventFramework.Examples/API/Feature/MalfunctionEffect.cs +++ b/KruacentExiled/KE.GlobalEventFramework.Examples/API/Feature/MalfunctionEffect.cs @@ -8,6 +8,7 @@ namespace KE.GlobalEventFramework.Examples.API.Feature { public abstract class MalfunctionEffect { + public abstract string Name { get; } public abstract string VoiceLine { get; } public abstract string VoiceLineTranslated { get; } public abstract sbyte MalfunctionActivation { get; } diff --git a/KruacentExiled/KE.GlobalEventFramework.Examples/API/Feature/Malfunctions.cs b/KruacentExiled/KE.GlobalEventFramework.Examples/API/Feature/Malfunctions.cs index ddd51e16..4f5cef2a 100644 --- a/KruacentExiled/KE.GlobalEventFramework.Examples/API/Feature/Malfunctions.cs +++ b/KruacentExiled/KE.GlobalEventFramework.Examples/API/Feature/Malfunctions.cs @@ -1,8 +1,12 @@ using Exiled.API.Enums; using Exiled.API.Features; using Exiled.API.Features.Doors; +using Exiled.API.Interfaces; using Exiled.Events.EventArgs.Player; using Exiled.Events.EventArgs.Scp049; +using KE.GlobalEventFramework.Examples.API.Interfaces; +using KE.GlobalEventFramework.GEFE.API.Features; +using KE.GlobalEventFramework.GEFE.API.Interfaces; using MEC; using PlayerRoles; using System; @@ -34,172 +38,116 @@ public sbyte Malfunction public MalfunctionLevel MalfunctionLevels { - get{return (MalfunctionLevel)Malfunction;} + get{return (MalfunctionLevel) Malfunction;} } - private HashSet MalfunctionEffects = new HashSet(); + private static HashSet _malfunctionEffects = new HashSet(); + public static HashSet MalfunctionEffects => _malfunctionEffects.ToList().ToHashSet(); + private static Dictionary _voiced; + private static Dictionary _voicedDeactivate; - public sbyte MalfunctionAdd { get; set; } = 1; - - private bool[] CassieVoiceLine = new[] { true, true, true, true, true }; - private string[] msg = new[] + public static bool EffectAlreadyActivated(MalfunctionEffect effect) { - "Malfunctions back to more stable levels", - "Malfunctions levels above . 25 percent . . decontamination of Light Containment Zone in . 30 seconds", - "Malfunctions levels above . 50 percent . . terminating all door locks", - "", - "Malfunctions levels above . 90 percent . . starting emergency warhead", - }; - - private string[] msgtrans = new[] - { - "Malfunctions back to more stable levels", - "Malfunctions levels above 25%, decontamination of Light Containment Zone in 30 seconds", - "Malfunctions levels above 50%, terminating all door locks", - "", - "Malfunctions levels above 90%, starting emergency warhead", - - }; - public bool CassieYapYap { get; set; } = false; - private Dictionary doorkeys = Door.List.ToDictionary(d => d, d => d.KeycardPermissions); - private CoroutineHandle _checkNuke; - internal Malfunctions() { } + return _voiced[effect]; + } - internal IEnumerator Tick() + public sbyte PreviousMalfunction { get; private set; } + public sbyte MalfunctionAdd { get; set; } = 1; + public MalfunctionDisplay MalfunctionDisplay { get; private set; } + + + internal Malfunctions(bool display = true) { - Log.Debug("in tick"); - while (Round.InProgress) + try { - Log.Debug($"Malfunction={Malfunction}"); - CassieVoice(Malfunction); - yield return Timing.WaitForSeconds(60); - Malfunction += MalfunctionAdd; - Malfunction += AdditionnalMalfunction(); + if (display) + MalfunctionDisplay = new MalfunctionDisplay(this); + else + MalfunctionDisplay = null; + } + catch (Exception ex) + { + Log.Error(ex + "\nRueI is probably missing : put it in dependency or disable the display"); + MalfunctionDisplay = null; } + + LoadMalfunctionsEffect(); } - - private void CassieVoice(sbyte malfunction) + public bool IsDisplayEnabled() { - if (malfunction <= 0) - { - CassieSay(0); - return; - } + return MalfunctionDisplay != null; + } - //force decontamination - if (malfunction >= 25) + private void LoadMalfunctionsEffect() + { + foreach (IPlugin plugin in Exiled.Loader.Loader.Plugins.Where(pl => pl.Name != MainPlugin.Instance.Name)) { - if (!Map.IsLczDecontaminated && Map.IsDecontaminationEnabled) + foreach (Type type in plugin.Assembly.GetTypes()) { - string msg = CassieSay(1); - Door.List.ToList().ForEach(d => + try { - if (d.Zone == ZoneType.LightContainment) + if (type.IsSubclassOf(typeof(MalfunctionEffect))) { - if (!d.IsElevator) - { - d.ChangeLock(DoorLockType.DecontEvacuate); - d.IsOpen = true; - } - + MalfunctionEffect me = Activator.CreateInstance(type) as MalfunctionEffect; + _malfunctionEffects.Add(me); } - }); - Timing.CallDelayed(30 + Cassie.CalculateDuration(msg), () => + } + catch (System.Exception e) { - Map.StartDecontamination(); - - Door.List.ToList().ForEach(d => - { - if (d.IsElevator && (d.Type == DoorType.ElevatorLczA || d.Type == DoorType.ElevatorLczB)) - { - d.Lock(DoorLockType.DecontEvacuate); - d.IsOpen = false; - } - }); - }); - return; + Log.Error($"Error registering in plugin {plugin.Name} : {e.Message}"); + } } - } + _voiced = _malfunctionEffects.ToDictionary(m => m, m => false); + _voicedDeactivate = _malfunctionEffects.Where(m => m is IReversibleEffect).ToDictionary(m => m, m => false); + } - //remove the lock on every doors - if (malfunction >= 50) + internal IEnumerator Tick() + { + while (Round.InProgress) { - string msg = CassieSay(2); - Door.List.ToList().ForEach(d => - { - if (d.IsKeycardDoor) - d.KeycardPermissions = KeycardPermissions.None; - - }); - return; + PreviousMalfunction = Malfunction; + Malfunction += MalfunctionAdd; + Malfunction += AdditionnalMalfunction(); + CheckMalfunctionEffect(Malfunction); + Log.Debug($"Malfunction={Malfunction}"); + yield return Timing.WaitForSeconds(60); } + } - //reput the locks - if (malfunction < 40 && (CassieVoiceLine[3] || CassieYapYap)) - { - CassieVoiceLine[3] = false; - doorkeys.ForEach(dk => - { - dk.Key.KeycardPermissions = dk.Value; - }); - return; - } - //nuke - if (malfunction >= 90) + private void CheckMalfunctionEffect(sbyte malfunction) + { + foreach (MalfunctionEffect me in _malfunctionEffects) { - if (CassieVoiceLine[4] || CassieYapYap) + if (malfunction >= me.MalfunctionActivation) { - CassieVoiceLine[4] = false; - string msg = "Malfunctions levels above . 90 percent . . starting emergency warhead"; - Cassie.MessageTranslated(msg, - "Malfunctions levels above 90%, starting emergency warhead", false, false); + if (!_voiced[me]) + { + _voiced[me] = true; + Cassie.MessageTranslated(me.VoiceLine,me.VoiceLineTranslated,false,false); + } + me.ActivateEffect(); } - if (!Warhead.IsInProgress) + if(me is IReversibleEffect re && malfunction < re.MalfunctionDeactivation) { - Warhead.Start(); - Warhead.IsLocked = true; - Timing.KillCoroutines(_checkNuke); - _checkNuke = Timing.RunCoroutine(CheckNuke()); + if (!_voicedDeactivate[me]) + { + _voicedDeactivate[me] = true; + Cassie.MessageTranslated(re.VoiceLineDeactivate, re.VoiceLineDeactivateTranslated, false, false); + } + re.DeactivateEffect(); } - return; } } - private string CassieSay(int id) - { - if (!string.IsNullOrEmpty(msg[id])) - return ""; - if (CassieVoiceLine[id] || CassieYapYap) - { - CassieVoiceLine[id] = false; - - Cassie.MessageTranslated(msg[id], msgtrans[id], false, false); - } - return msg[id]; - } + - private IEnumerator CheckNuke() - { - while (Warhead.IsInProgress) - { - yield return Timing.WaitForSeconds(5); - Log.Debug("check nuke : " + Malfunction); - if (Malfunction <= 85) - { - Log.Debug($"Malfunction low enough ({Malfunction}) disabling the nuke"); - Warhead.IsLocked = false; - Warhead.Stop(); - break; - } - } - } private sbyte AdditionnalMalfunction() { diff --git a/KruacentExiled/KE.GlobalEventFramework.Examples/API/Interfaces/IReversibleEffect.cs b/KruacentExiled/KE.GlobalEventFramework.Examples/API/Interfaces/IReversibleEffect.cs index 4473ab78..efa0df05 100644 --- a/KruacentExiled/KE.GlobalEventFramework.Examples/API/Interfaces/IReversibleEffect.cs +++ b/KruacentExiled/KE.GlobalEventFramework.Examples/API/Interfaces/IReversibleEffect.cs @@ -8,7 +8,10 @@ namespace KE.GlobalEventFramework.Examples.API.Interfaces { internal interface IReversibleEffect { + string VoiceLineDeactivate { get; } + string VoiceLineDeactivateTranslated { get; } sbyte MalfunctionDeactivation { get; } - void EffectDeactivate(); + void DeactivateEffect(); + } } diff --git a/KruacentExiled/KE.GlobalEventFramework.Examples/API/MalfunctionEffects/AutoNuke.cs b/KruacentExiled/KE.GlobalEventFramework.Examples/API/MalfunctionEffects/AutoNuke.cs new file mode 100644 index 00000000..49344ed7 --- /dev/null +++ b/KruacentExiled/KE.GlobalEventFramework.Examples/API/MalfunctionEffects/AutoNuke.cs @@ -0,0 +1,52 @@ +using Exiled.API.Features; +using KE.GlobalEventFramework.Examples.API.Feature; +using KE.GlobalEventFramework.Examples.API.Interfaces; +using KE.GlobalEventFramework.Examples.GE; +using MEC; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace KE.GlobalEventFramework.Examples.API.MalfunctionEffects +{ + internal class AutoNuke : MalfunctionEffect + { + public override string Name { get; } = "Automatic Warhead"; + public override string VoiceLine { get; } = "Malfunctions levels above . 90 percent . . starting emergency warhead"; + public override string VoiceLineTranslated { get; } = "Malfunctions levels above 90%, starting emergency warhead"; + public override sbyte MalfunctionActivation { get; } = 90; + + + public sbyte MalfunctionDeactivation { get; } = 85; + private CoroutineHandle _checkNuke; + + public override void ActivateEffect() + { + if (!Warhead.IsInProgress) + { + Warhead.Start(); + Warhead.IsLocked = true; + Timing.KillCoroutines(_checkNuke); + _checkNuke = Timing.RunCoroutine(CheckNuke()); + } + } + + public IEnumerator CheckNuke() + { + while (Warhead.IsInProgress) + { + yield return Timing.WaitForSeconds(5); + var malfunction = SystemMalfunction.Malfunction.Malfunction; + if (malfunction <= 85) + { + Log.Debug($"Malfunction low enough ({malfunction}) disabling the nuke"); + Warhead.IsLocked = false; + Warhead.Stop(); + break; + } + } + } + } +} diff --git a/KruacentExiled/KE.GlobalEventFramework.Examples/API/MalfunctionEffect/ForceDecon.cs b/KruacentExiled/KE.GlobalEventFramework.Examples/API/MalfunctionEffects/ForceDecon.cs similarity index 89% rename from KruacentExiled/KE.GlobalEventFramework.Examples/API/MalfunctionEffect/ForceDecon.cs rename to KruacentExiled/KE.GlobalEventFramework.Examples/API/MalfunctionEffects/ForceDecon.cs index 953212bc..09addb75 100644 --- a/KruacentExiled/KE.GlobalEventFramework.Examples/API/MalfunctionEffect/ForceDecon.cs +++ b/KruacentExiled/KE.GlobalEventFramework.Examples/API/MalfunctionEffects/ForceDecon.cs @@ -3,13 +3,15 @@ using Exiled.API.Enums; using Exiled.API.Features; using Exiled.API.Features.Doors; +using KE.GlobalEventFramework.Examples.API.Feature; using MEC; using System.Linq; -namespace KE.GlobalEventFramework.Examples.API.MalfunctionEffect +namespace KE.GlobalEventFramework.Examples.API.MalfunctionEffects { - internal class ForceDecon : Feature.MalfunctionEffect + internal class ForceDecon : MalfunctionEffect { + public override string Name { get; } = "Forced Decontamination"; public override string VoiceLine { get; } = "Malfunctions levels above . 25 percent . . decontamination of Light Containment Zone in . 30 seconds"; public override string VoiceLineTranslated { get; } = "Malfunctions levels above 25%, decontamination of Light Containment Zone in 30 seconds"; public override sbyte MalfunctionActivation { get; } = 25; diff --git a/KruacentExiled/KE.GlobalEventFramework.Examples/API/MalfunctionEffects/Locks.cs b/KruacentExiled/KE.GlobalEventFramework.Examples/API/MalfunctionEffects/Locks.cs new file mode 100644 index 00000000..ef71c7eb --- /dev/null +++ b/KruacentExiled/KE.GlobalEventFramework.Examples/API/MalfunctionEffects/Locks.cs @@ -0,0 +1,50 @@ +using Exiled.API.Enums; +using Exiled.API.Features; +using Exiled.API.Features.Doors; +using KE.GlobalEventFramework.Examples.API.Feature; +using KE.GlobalEventFramework.Examples.API.Interfaces; +using MEC; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Utils.NonAllocLINQ; + +namespace KE.GlobalEventFramework.Examples.API.MalfunctionEffects +{ + internal class Locks : MalfunctionEffect, IReversibleEffect + { + public override string Name { get; } = "Door locks terminated"; + public override string VoiceLine { get; } = "Malfunctions levels above . 50 percent . . terminating all door locks"; + public override string VoiceLineTranslated { get; } = "Malfunctions levels above 50%, terminating all door locks"; + public override sbyte MalfunctionActivation { get; } = 50; + + public string VoiceLineDeactivate { get; } = "Malfunctions back to more stable levels, reputting all door locks"; + public string VoiceLineDeactivateTranslated { get; } = "Malfunctions back to more stable levels, reputting all door locks"; + public sbyte MalfunctionDeactivation { get; } = 40; + + + private Dictionary doorkeys = new Dictionary(); + public override void ActivateEffect() + { + Door.List.ToList().ForEach(d => + { + if (d.IsKeycardDoor) + { + doorkeys.Add(d, d.KeycardPermissions); + d.KeycardPermissions = KeycardPermissions.None; + } + }); + } + + public void DeactivateEffect() + { + doorkeys.ForEach(dk => + { + dk.Key.KeycardPermissions = dk.Value; + }); + } + + } +} diff --git a/KruacentExiled/KE.GlobalEventFramework.Examples/GE/SystemMalfunction.cs b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/SystemMalfunction.cs index 7669d5de..4310ca97 100644 --- a/KruacentExiled/KE.GlobalEventFramework.Examples/GE/SystemMalfunction.cs +++ b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/SystemMalfunction.cs @@ -46,7 +46,7 @@ public class SystemMalfunction : GlobalEvent, IStart, IEvent /// public int NewCooldown { get; set; } = 180; private BlackoutNDoor.MainPlugin BlackoutNDoor = null; - private Malfunctions Malfunction; + public static Malfunctions Malfunction { get; private set; } @@ -56,7 +56,7 @@ public IEnumerator Start() Log.Debug("system malfunction start"); //MoreBlackOutNDoors(); //Coroutine.LaunchCoroutine(EarlyNuke()); - Malfunction = new Malfunctions(); + Coroutine.LaunchCoroutine(Malfunction.Tick()); CoroutineHandle handle; @@ -73,13 +73,13 @@ public IEnumerator Start() public void SubscribeEvent() { - + Malfunction = new Malfunctions(); Exiled.Events.Handlers.Player.Dying += Malfunction.OnDying; Exiled.Events.Handlers.Scp049.FinishingRecall += Malfunction.OnFinishingRevive; //Searching for the plugin - var otherPlugin = Exiled.Loader.Loader.Plugins.FirstOrDefault(plugin => plugin.Name == "KE.BlackoutDoor"); + /*var otherPlugin = Exiled.Loader.Loader.Plugins.FirstOrDefault(plugin => plugin.Name == "KE.BlackoutDoor"); if (otherPlugin != null) { @@ -90,13 +90,14 @@ public void SubscribeEvent() return; } - } + }*/ } public void UnsubscribeEvent() { BlackoutNDoor = null; Exiled.Events.Handlers.Player.Dying -= Malfunction.OnDying; Exiled.Events.Handlers.Scp049.FinishingRecall -= Malfunction.OnFinishingRevive; + Malfunction = null; } private IEnumerator EarlyNuke() diff --git a/KruacentExiled/KE.GlobalEventFramework.Examples/KE.GlobalEventFramework.Examples.csproj b/KruacentExiled/KE.GlobalEventFramework.Examples/KE.GlobalEventFramework.Examples.csproj index 807ac74f..5b6be12a 100644 --- a/KruacentExiled/KE.GlobalEventFramework.Examples/KE.GlobalEventFramework.Examples.csproj +++ b/KruacentExiled/KE.GlobalEventFramework.Examples/KE.GlobalEventFramework.Examples.csproj @@ -5,12 +5,13 @@ - + + diff --git a/KruacentExiled/KE.GlobalEventFramework.Examples/MainPlugin.cs b/KruacentExiled/KE.GlobalEventFramework.Examples/MainPlugin.cs index 4ddeef62..38773e5b 100644 --- a/KruacentExiled/KE.GlobalEventFramework.Examples/MainPlugin.cs +++ b/KruacentExiled/KE.GlobalEventFramework.Examples/MainPlugin.cs @@ -13,14 +13,15 @@ internal class MainPlugin : Plugin public override Version Version => new Version(1, 0, 0); public override string Name => "KE.GEF.Examples"; + public static MainPlugin Instance { get; private set; } public override void OnEnabled() { - + Instance = this; } public override void OnDisabled() { - + Instance = null; } } } From 8745e44857ba503af76e5d57ad0304258935ec03 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Wed, 19 Feb 2025 21:48:32 +0100 Subject: [PATCH 181/853] Created new plugin Utils --- .../KE.Utils/Extensions/PlayerExtension.cs | 35 ++++++++++++++++++ .../Extensions/RoomExtension.cs} | 4 +- KruacentExiled/KE.Utils/KE.Utils.csproj | 21 +++++++++++ KruacentExiled/KE.Utils/KEHints.cs | 33 +++++++++++++++++ KruacentExiled/KE.Utils/RueIHint.cs | 37 +++++++++++++++++++ KruacentExiled/KruacentExiled.sln | 6 +++ 6 files changed, 134 insertions(+), 2 deletions(-) create mode 100644 KruacentExiled/KE.Utils/Extensions/PlayerExtension.cs rename KruacentExiled/{KE.GlobalEventFramework.Examples/API/MalfunctionEffect/Locks.cs => KE.Utils/Extensions/RoomExtension.cs} (60%) create mode 100644 KruacentExiled/KE.Utils/KE.Utils.csproj create mode 100644 KruacentExiled/KE.Utils/KEHints.cs create mode 100644 KruacentExiled/KE.Utils/RueIHint.cs diff --git a/KruacentExiled/KE.Utils/Extensions/PlayerExtension.cs b/KruacentExiled/KE.Utils/Extensions/PlayerExtension.cs new file mode 100644 index 00000000..fd6b85d9 --- /dev/null +++ b/KruacentExiled/KE.Utils/Extensions/PlayerExtension.cs @@ -0,0 +1,35 @@ +using Exiled.API.Features; +using Mirror; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using UnityEngine; + +namespace KE.Utils.Extensions +{ + public static class PlayerExtension + { + public static void SetFakeInvis(this Player p, IEnumerable viewers) + { + Vector3 pos = p.Position; + + try + { + p.ReferenceHub.transform.localPosition = Vector3.zero; + foreach (Player viewer in viewers) + { + Server.SendSpawnMessage.Invoke(null, new object[2] { viewer.NetworkIdentity, viewer.Connection }); + } + + p.ReferenceHub.transform.localPosition = pos; + } + catch (Exception arg) + { + Log.Error(string.Format("{0}: {1}", "SetFakeInvis", arg)); + } + } + + } +} diff --git a/KruacentExiled/KE.GlobalEventFramework.Examples/API/MalfunctionEffect/Locks.cs b/KruacentExiled/KE.Utils/Extensions/RoomExtension.cs similarity index 60% rename from KruacentExiled/KE.GlobalEventFramework.Examples/API/MalfunctionEffect/Locks.cs rename to KruacentExiled/KE.Utils/Extensions/RoomExtension.cs index f9ac7c90..35fee2e8 100644 --- a/KruacentExiled/KE.GlobalEventFramework.Examples/API/MalfunctionEffect/Locks.cs +++ b/KruacentExiled/KE.Utils/Extensions/RoomExtension.cs @@ -4,9 +4,9 @@ using System.Text; using System.Threading.Tasks; -namespace KE.GlobalEventFramework.Examples.API.MalfunctionEffect +namespace KE.Utils.Extensions { - internal class Locks + internal class RoomExtension { } } diff --git a/KruacentExiled/KE.Utils/KE.Utils.csproj b/KruacentExiled/KE.Utils/KE.Utils.csproj new file mode 100644 index 00000000..4a0ebe67 --- /dev/null +++ b/KruacentExiled/KE.Utils/KE.Utils.csproj @@ -0,0 +1,21 @@ + + + + net48 + + + + + + + + + + + + + + + + + diff --git a/KruacentExiled/KE.Utils/KEHints.cs b/KruacentExiled/KE.Utils/KEHints.cs new file mode 100644 index 00000000..a270ecb7 --- /dev/null +++ b/KruacentExiled/KE.Utils/KEHints.cs @@ -0,0 +1,33 @@ +using Exiled.API.Features; +using System; +using RueI.Extensions; +using RueI.Displays; + +namespace KE.Utils +{ + public static class KEHint + { + + public static void ShowHint(this Player player, RueIHint rueIHint) + { + ShowHint(player, rueIHint.Hint, rueIHint.Position); + } + + public static void ShowHint(this Player player, Hint hint, float position) + { + ShowHint(player, hint.Content, position, TimeSpan.FromSeconds(hint.Duration)); + } + public static void ShowHint(this Player p, string message, float position, TimeSpan timeSpan) + { + ShowHint(p.ReferenceHub, message, position, timeSpan); + } + + public static void ShowHint(ReferenceHub hub, string message, float position, TimeSpan timeSpan) + { + DisplayCore c = DisplayCore.Get(hub); + + c.SetElemTemp(message, position, timeSpan, new RueI.Displays.Scheduling.TimedElemRef()); + } + + } +} diff --git a/KruacentExiled/KE.Utils/RueIHint.cs b/KruacentExiled/KE.Utils/RueIHint.cs new file mode 100644 index 00000000..b3bacdd2 --- /dev/null +++ b/KruacentExiled/KE.Utils/RueIHint.cs @@ -0,0 +1,37 @@ +using Exiled.API.Features; +using Exiled.Events.Commands.PluginManager; +using RueI; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace KE.Utils +{ + + /// + /// Hint with position + /// + public class RueIHint + { + public Hint Hint { get; set; } + public float Position { get; set; } + public RueIHint(Hint hint,float position) + { + Hint = hint; + Position = position; + } + public RueIHint(string content, float duration = 3f, bool show = true, float position = 0) + { + Hint = new Hint(content,duration,show); + Position = position; + + } + public RueIHint() + { + Hint = new Hint(); + Position = 0; + } + } +} diff --git a/KruacentExiled/KruacentExiled.sln b/KruacentExiled/KruacentExiled.sln index 135e1e35..0b17fd5c 100644 --- a/KruacentExiled/KruacentExiled.sln +++ b/KruacentExiled/KruacentExiled.sln @@ -13,6 +13,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "KE.GlobalEventFramework", " EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "KE.GlobalEventFramework.Examples", "KE.GlobalEventFramework.Examples\KE.GlobalEventFramework.Examples.csproj", "{07B92E87-F48F-4F9F-BA0E-1BCB2AF52F53}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "KE.Utils", "KE.Utils\KE.Utils.csproj", "{1FB84A8B-017F-4A9E-9482-ECE2BE68763D}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -39,6 +41,10 @@ Global {07B92E87-F48F-4F9F-BA0E-1BCB2AF52F53}.Debug|Any CPU.Build.0 = Debug|Any CPU {07B92E87-F48F-4F9F-BA0E-1BCB2AF52F53}.Release|Any CPU.ActiveCfg = Release|Any CPU {07B92E87-F48F-4F9F-BA0E-1BCB2AF52F53}.Release|Any CPU.Build.0 = Release|Any CPU + {1FB84A8B-017F-4A9E-9482-ECE2BE68763D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {1FB84A8B-017F-4A9E-9482-ECE2BE68763D}.Debug|Any CPU.Build.0 = Debug|Any CPU + {1FB84A8B-017F-4A9E-9482-ECE2BE68763D}.Release|Any CPU.ActiveCfg = Release|Any CPU + {1FB84A8B-017F-4A9E-9482-ECE2BE68763D}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE From 2d17a414ed8d9dfb6d04e7bd58f1fbd99bdd08e4 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Wed, 19 Feb 2025 21:51:02 +0100 Subject: [PATCH 182/853] fix the id --- KruacentExiled/KE.GlobalEventFramework.Examples/GE/Kaboom.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/KruacentExiled/KE.GlobalEventFramework.Examples/GE/Kaboom.cs b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/Kaboom.cs index 5e91ad6f..6973b3d3 100644 --- a/KruacentExiled/KE.GlobalEventFramework.Examples/GE/Kaboom.cs +++ b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/Kaboom.cs @@ -16,7 +16,7 @@ namespace KE.GlobalEventFramework.Examples.GE public class Kaboom : GlobalEvent, IEvent { /// - public override uint Id { get; set; } = 0; + public override uint Id { get; set; } = 1052; /// public override string Name { get; set; } = "Kaboom"; /// From e8769d7744c511c72b0590dfa8b4ffdd227e5988 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Wed, 19 Feb 2025 21:57:05 +0100 Subject: [PATCH 183/853] buffed the buff --- KruacentExiled/KE.Misc/Misc/SCPBuff.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/KruacentExiled/KE.Misc/Misc/SCPBuff.cs b/KruacentExiled/KE.Misc/Misc/SCPBuff.cs index 894e0ded..1b10eee4 100644 --- a/KruacentExiled/KE.Misc/Misc/SCPBuff.cs +++ b/KruacentExiled/KE.Misc/Misc/SCPBuff.cs @@ -27,7 +27,7 @@ private IEnumerator PeanutShield() List peanuts = Player.List.Where(p => p.Role == RoleTypeId.Scp173).ToList(); peanuts.ForEach(p => { - AddHumeShield(p, CheckPlayerAround(p, 4)); + AddHumeShield(p, CheckPlayerAround(p, 6)); }); yield return Timing.WaitForSeconds(RefreshRate); } @@ -49,7 +49,7 @@ private int CheckPlayerAround(Player p, float radius, bool countFriendly = false if (player == p) continue; if (player.Role.Side == p.Role.Side && !countFriendly) continue; if (IsPlayerInZone(player, p.Position, radius, radius)) - result++; + result += 5; } return result; } From 1cfc0aa7f66ab238aa5d88a68e298210adaececa Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Wed, 19 Feb 2025 21:59:43 +0100 Subject: [PATCH 184/853] buffed the kiwis for the scps --- .../KE.GlobalEventFramework.Examples/GE/KIWIS.cs | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/KruacentExiled/KE.GlobalEventFramework.Examples/GE/KIWIS.cs b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/KIWIS.cs index 268194fc..de9199a3 100644 --- a/KruacentExiled/KE.GlobalEventFramework.Examples/GE/KIWIS.cs +++ b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/KIWIS.cs @@ -28,12 +28,6 @@ public IEnumerator Start() { var listScp = Player.List.ToList().Where(p => p.IsScp && p.Role.Type != RoleTypeId.Scp0492).ToList().ToDictionary(p => p, p => p.MaxHealth/3); - //set the health of all starting scps to 2/3 of their vanilla max health - listScp.ForEach(k => - { - k.Key.MaxHealth = k.Value * 2; - k.Key.Health = k.Key.MaxHealth; - }); yield return Timing.WaitUntilTrue(() => Round.ElapsedTime.TotalMinutes >= 15); @@ -43,7 +37,7 @@ public IEnumerator Start() k.Key.Heal(k.Value); }); - yield return Timing.WaitUntilTrue(() => Round.ElapsedTime.TotalMinutes >= 30); + yield return Timing.WaitUntilTrue(() => Round.ElapsedTime.TotalMinutes >= 30 || Warhead.IsDetonated); listScp = listScp.Where(p => p.Key.IsScp && p.Key.Role.Type != RoleTypeId.Scp0492).ToList().ToDictionary(p => p.Key, p => p.Value); listScp.ForEach(k => { k.Key.MaxHealth += k.Value; From 164d2b88cc5f03ebee81b70de96fb43be6464042 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Wed, 19 Feb 2025 22:23:06 +0100 Subject: [PATCH 185/853] buff the reward for killing a zombie --- .../API/Feature/Malfunctions.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/KruacentExiled/KE.GlobalEventFramework.Examples/API/Feature/Malfunctions.cs b/KruacentExiled/KE.GlobalEventFramework.Examples/API/Feature/Malfunctions.cs index 4f5cef2a..942c4fff 100644 --- a/KruacentExiled/KE.GlobalEventFramework.Examples/API/Feature/Malfunctions.cs +++ b/KruacentExiled/KE.GlobalEventFramework.Examples/API/Feature/Malfunctions.cs @@ -143,7 +143,6 @@ private void CheckMalfunctionEffect(sbyte malfunction) re.DeactivateEffect(); } } - } @@ -158,6 +157,8 @@ private sbyte AdditionnalMalfunction() result += (sbyte)(Player.List.Count(p => p.Role.Side == Side.Scp && p.Role != RoleTypeId.Scp0492) * 3); //number of zombies increase 1 result += (sbyte)Player.List.Count(p => p.Role == RoleTypeId.Scp0492); + //reduce when walking + return result; } @@ -175,7 +176,7 @@ internal void OnDying(DyingEventArgs ev) break; case Side.Scp: if (ev.Player.Role != RoleTypeId.Scp0492) Malfunction -= 10; - else Malfunction -= 1; + else Malfunction -= 2; break; } } From f12bcfb7d446f55b911bf9d8fe20b7d0afff275d Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Mon, 24 Feb 2025 21:49:39 +0100 Subject: [PATCH 186/853] fix #103 --- KruacentExiled/KE.Misc/Misc/SCPBuff.cs | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/KruacentExiled/KE.Misc/Misc/SCPBuff.cs b/KruacentExiled/KE.Misc/Misc/SCPBuff.cs index 1b10eee4..090a8da8 100644 --- a/KruacentExiled/KE.Misc/Misc/SCPBuff.cs +++ b/KruacentExiled/KE.Misc/Misc/SCPBuff.cs @@ -1,4 +1,6 @@ -using Exiled.API.Features; +using Exiled.API.Extensions; +using Exiled.API.Features; +using Exiled.Events.EventArgs.Player; using Exiled.Permissions.Commands.Permissions; using MEC; using PlayerRoles; @@ -11,12 +13,26 @@ namespace KE.Misc.Misc internal class SCPBuff { internal const float RefreshRate = 1f; + internal float IncreaseSCPHealth { get; } = 1.5f; internal SCPBuff() { } internal void StartBuff() { Timing.RunCoroutine(PeanutShield()); + + } + + internal void BecomingSCP(ChangingRoleEventArgs ev) + { + if (!ev.NewRole.IsScp() || ev.NewRole == RoleTypeId.Scp0492) return; + if(ev.Player.Role == RoleTypeId.None) return; + Player p = ev.Player; + Timing.CallDelayed(2, () => + { + p.MaxHealth *= IncreaseSCPHealth; + p.Health = p.MaxHealth; + }); } From 00f1041e91ebce385673b48034a908d1d138800d Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Mon, 24 Feb 2025 21:53:09 +0100 Subject: [PATCH 187/853] fix #90 --- KruacentExiled/KE.Misc/MainPlugin.cs | 18 +++++-- KruacentExiled/KE.Misc/Misc/Spawn.cs | 74 ++++++++++++++++++++++++++++ 2 files changed, 87 insertions(+), 5 deletions(-) create mode 100644 KruacentExiled/KE.Misc/Misc/Spawn.cs diff --git a/KruacentExiled/KE.Misc/MainPlugin.cs b/KruacentExiled/KE.Misc/MainPlugin.cs index ddb6db2b..03799b72 100644 --- a/KruacentExiled/KE.Misc/MainPlugin.cs +++ b/KruacentExiled/KE.Misc/MainPlugin.cs @@ -19,7 +19,7 @@ public class MainPlugin : Plugin { public override string Author => "Patrique"; public override string Name => "KEMisc"; - public override Version Version => new Version(1, 0, 0); + public override Version Version => new Version(1, 1, 0); internal static MainPlugin Instance { get; private set; } private ServerHandler ServerHandler; internal _914 _914 { get; private set; } @@ -28,6 +28,7 @@ public class MainPlugin : Plugin internal Candy Candy { get; private set; } internal SurfaceLight SurfaceLight { get; private set; } internal SCPBuff SCPBuff { get; private set; } + internal Spawn Spawn { get; private set; } public override void OnEnabled() { @@ -37,6 +38,8 @@ public override void OnEnabled() ClassDDoor = new ClassDDoor(); SurfaceLight = new SurfaceLight(); ServerHandler = new ServerHandler(); + Spawn = new Spawn(); + SCPBuff = new SCPBuff(); if (Instance.Config.ChancePinkCandy >= 0 && Instance.Config.ChancePinkCandy <= 100) { Candy = new Candy(); @@ -48,13 +51,15 @@ public override void OnEnabled() } Respawn.SetTokens(SpawnableFaction.NtfWave, 2); Respawn.SetTokens(SpawnableFaction.ChaosWave, 2); - SCPBuff = new SCPBuff(); + + Exiled.Events.Handlers.Player.ChangingRole += SCPBuff.BecomingSCP; + ServerHandle.RoundStarted += Spawn.OnRoundStarted; ServerHandle.RoundStarted += ServerHandler.OnRoundStarted; Nine14Handle.UpgradingPlayer += _914.OnUpgradingPlayer; Exiled.Events.Handlers.Player.Dying += ScpNoeDeathMessage; - + } public override void OnDisabled() @@ -62,6 +67,7 @@ public override void OnDisabled() ServerHandle.RoundStarted -= ServerHandler.OnRoundStarted; Nine14Handle.UpgradingPlayer -= _914.OnUpgradingPlayer; Exiled.Events.Handlers.Player.Dying -= ScpNoeDeathMessage; + ServerHandle.RoundStarted -= Spawn.OnRoundStarted; if (Instance.Config.ChancePinkCandy >= 0 && Instance.Config.ChancePinkCandy <= 100) { Exiled.Events.Handlers.Scp330.InteractingScp330 -= Candy.InteractingScp330; @@ -96,6 +102,7 @@ internal void RandomFF() internal IEnumerator NukeAnnouncement() { Log.Debug("autonuke announcement : on"); + yield return Timing.WaitUntilTrue(() => 25 <= Round.ElapsedTime.TotalMinutes); Cassie.MessageTranslated("Warning automatic warhead will detonate in 5 minutes", "Warning automatic warhead will detonate in 5 minutes"); @@ -123,6 +130,7 @@ internal IEnumerator PeanutLockdown() } private IEnumerator Timer(int secondsWaiting,List playerToShow, string msg = "done") { + float position = 0; while (secondsWaiting >= 0) { Hint hint = new Hint() @@ -130,12 +138,12 @@ private IEnumerator Timer(int secondsWaiting,List playerToShow, s Content = $"{secondsWaiting} seconds", Duration = 1 }; - playerToShow.ForEach(p => p.ShowHint(hint,0)); + playerToShow.ForEach(p => p.ShowHint(hint, position)); playerToShow.RemoveAll(p => p.Role != RoleTypeId.Scp173); yield return Timing.WaitForSeconds(1); secondsWaiting--; } - playerToShow.ForEach(p => p.ShowHint(msg)); + playerToShow.ForEach(p => p.ShowHint(msg, position)); } /// diff --git a/KruacentExiled/KE.Misc/Misc/Spawn.cs b/KruacentExiled/KE.Misc/Misc/Spawn.cs new file mode 100644 index 00000000..6dc6a065 --- /dev/null +++ b/KruacentExiled/KE.Misc/Misc/Spawn.cs @@ -0,0 +1,74 @@ +using Exiled.API.Extensions; +using Exiled.API.Features; +using PlayerRoles; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace KE.Misc.Misc +{ + public class Spawn + { + + //heal reduit Malfunction + public void OnRoundStarted() + { + HashSet pl = Player.List.Where(p => p.IsScp).ToHashSet(); + + + foreach (Player player in pl) + { + SetScpPreferences(player); + } + } + + private void SetScpPreferences(Player player) + { + Dictionary chancescp = player.ScpPreferences.Preferences.ToDictionary(p => p.Key, p => p.Value + 6); + + + RoleTypeId roleScp = ChooseRandomRole(chancescp); + Log.Debug($"Scp ({player.Nickname}) is {roleScp} previous : {player.Role.Type}"); + + player.Role.Set(roleScp); + if (roleScp == RoleTypeId.Scp096 || roleScp == RoleTypeId.Scp079) + { + player.Role.Set(RoleTypeId.Scp173); + //ChangeScp(player); + } + } + + + private void ChangeScp(Player player) + { + Hint h = new Hint() + { + Content = "You're a support class \nYou can change your scp by doing the command .scp \n(eg .scp 173 -> scp-173)", + Duration = 60, + }; + player.ShowHint(h, 100); + + } + + + private RoleTypeId ChooseRandomRole(Dictionary chancescp) + { + List weightedPool = new List(); + foreach (RoleTypeId ge in chancescp.Keys) + { + for (int i = 0; i < chancescp[ge]; i++) + { + Log.Debug(ge); + weightedPool.Add(ge); + } + } + Log.Debug("end"); + + int randomIndex = UnityEngine.Random.Range(0, weightedPool.Count); + + return weightedPool[randomIndex]; + } + } +} From 7815b839921ce5efe02e1f788fa4b0609872a7cf Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Mon, 24 Feb 2025 21:53:41 +0100 Subject: [PATCH 188/853] added a chance of not changing the surface lights --- KruacentExiled/KE.Misc/Handlers/ServerHandler.cs | 2 +- KruacentExiled/KE.Misc/Misc/Spawn.cs | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/KruacentExiled/KE.Misc/Handlers/ServerHandler.cs b/KruacentExiled/KE.Misc/Handlers/ServerHandler.cs index 05083455..77435d68 100644 --- a/KruacentExiled/KE.Misc/Handlers/ServerHandler.cs +++ b/KruacentExiled/KE.Misc/Handlers/ServerHandler.cs @@ -19,7 +19,7 @@ public void OnRoundStarted() Timing.RunCoroutine(MainPlugin.Instance.PeanutLockdown()); if(MainPlugin.Instance.Config.AutoElevator) Timing.RunCoroutine(MainPlugin.Instance.AutoElevator.StartElevator()); - if (MainPlugin.Instance.Config.SurfaceLight) + if (MainPlugin.Instance.Config.SurfaceLight && UnityEngine.Random.value < .75f) MainPlugin.Instance.SurfaceLight.ChangeSurfaceLight(); MainPlugin.Instance.SCPBuff.StartBuff(); } diff --git a/KruacentExiled/KE.Misc/Misc/Spawn.cs b/KruacentExiled/KE.Misc/Misc/Spawn.cs index 6dc6a065..8f168885 100644 --- a/KruacentExiled/KE.Misc/Misc/Spawn.cs +++ b/KruacentExiled/KE.Misc/Misc/Spawn.cs @@ -36,6 +36,7 @@ private void SetScpPreferences(Player player) if (roleScp == RoleTypeId.Scp096 || roleScp == RoleTypeId.Scp079) { player.Role.Set(RoleTypeId.Scp173); + //TODO the commands //ChangeScp(player); } } From 38791251fa7d45d7a6e5a7e185b3baae0cd999d2 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Mon, 24 Feb 2025 22:01:08 +0100 Subject: [PATCH 189/853] added a configurable redacted chance --- .../KE.GlobalEventFramework/GEFE/API/Features/GlobalEvent.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/KruacentExiled/KE.GlobalEventFramework/GEFE/API/Features/GlobalEvent.cs b/KruacentExiled/KE.GlobalEventFramework/GEFE/API/Features/GlobalEvent.cs index 789c977d..7bed8feb 100644 --- a/KruacentExiled/KE.GlobalEventFramework/GEFE/API/Features/GlobalEvent.cs +++ b/KruacentExiled/KE.GlobalEventFramework/GEFE/API/Features/GlobalEvent.cs @@ -88,13 +88,13 @@ public static IGlobalEvent Get(uint id) private static void Show() { - var random = UnityEngine.Random.value; + var random = UnityEngine.Random.Range(0,101); foreach (Player player in Player.List) { Exiled.API.Features.Broadcast b = new Exiled.API.Features.Broadcast { - Content = ShowText(random > .5f), + Content = ShowText(random < MainPlugin.Instance.Config.ChanceRedacted), Duration = 10 }; player.Broadcast(b); From 2a59e634191ddfc528c570d387f523f8a350a35a Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Mon, 24 Feb 2025 22:01:22 +0100 Subject: [PATCH 190/853] updated config --- KruacentExiled/KE.GlobalEventFramework/Config.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/KruacentExiled/KE.GlobalEventFramework/Config.cs b/KruacentExiled/KE.GlobalEventFramework/Config.cs index 69f7116a..698a7952 100644 --- a/KruacentExiled/KE.GlobalEventFramework/Config.cs +++ b/KruacentExiled/KE.GlobalEventFramework/Config.cs @@ -16,6 +16,8 @@ internal class Config : IConfig public bool Debug { get; set; } = true; [Description("Show the log when the plugin is registering global event (require Debug to be true)")] public bool ShowRegisteringLog { get; set; } = false; + [Description("The chance a global event is not shown and show [REDACTED] instead (0~100)")] + public int ChanceRedacted { get; set; } = 10; } } From a18a0e239adbe532686530a8e258eae3336671f1 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Mon, 24 Feb 2025 22:01:49 +0100 Subject: [PATCH 191/853] removed open bar chance --- KruacentExiled/KE.GlobalEventFramework.Examples/GE/OpenBar.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/KruacentExiled/KE.GlobalEventFramework.Examples/GE/OpenBar.cs b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/OpenBar.cs index 73027fb5..a9533313 100644 --- a/KruacentExiled/KE.GlobalEventFramework.Examples/GE/OpenBar.cs +++ b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/OpenBar.cs @@ -17,7 +17,7 @@ public class OpenBar : GlobalEvent, IStart,IEvent public override uint Id { get; set; } = 1048; public override string Name { get; set; } = "OpenBar"; public override string Description { get; set; } = "j'espère que vous avez pas prévu de kampé"; - public override int Weight { get; set; } = 1; + public override int Weight { get; set; } = 0; public override uint[] IncompatibleGE { get; set; } = { 1 }; public IEnumerator Start() { From c061a8240d391878a89fcd3a1965e0bde8a1c448 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Mon, 24 Feb 2025 22:44:30 +0100 Subject: [PATCH 192/853] fix #101 Related Work Items: #10 --- KruacentExiled/KE.Items/Items/Scp1650.cs | 93 ++++++++++++++++++++++++ 1 file changed, 93 insertions(+) create mode 100644 KruacentExiled/KE.Items/Items/Scp1650.cs diff --git a/KruacentExiled/KE.Items/Items/Scp1650.cs b/KruacentExiled/KE.Items/Items/Scp1650.cs new file mode 100644 index 00000000..7573bc70 --- /dev/null +++ b/KruacentExiled/KE.Items/Items/Scp1650.cs @@ -0,0 +1,93 @@ +using Exiled.API.Features; +using Exiled.API.Features.Attributes; +using Exiled.API.Features.Spawn; +using Exiled.CustomItems.API.Features; +using Exiled.Events.EventArgs.Player; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using UnityEngine; +using PlayerHandle = Exiled.Events.Handlers.Player; + + +namespace KE.Items.Items +{ + [CustomItem(ItemType.Painkillers)] + public class Scp1650 : CustomItem + { + public override uint Id { get; set; } = 1056; + public override string Name { get; set; } = "SCP-1650"; + public override string Description { get; set; } = "ויאמר ה' ל— סח השמן על בשרך ולך בינות ה— כששם אלוהים על שפתיך, וזעם ה' וחרון אפו ו— דם המכבים יטהר בית מקדשו אחריך, לנצח נצחים"; + public override float Weight { get; set; } = 0.65f; + + public override SpawnProperties SpawnProperties { get; set; } = new SpawnProperties() + { + Limit = 1, + LockerSpawnPoints = new List() + { + new LockerSpawnPoint() + { + Type = Exiled.API.Enums.LockerType.Scp207Pedestal, + UseChamber = true, + } + } + }; + + protected override void SubscribeEvents() + { + PlayerHandle.UsedItem += OnUsedItem; + } + protected override void UnsubscribeEvents() + { + PlayerHandle.UsedItem -= OnUsedItem; + } + private void OnUsedItem(UsedItemEventArgs ev) + { + Player player = ev.Player; + Quaternion rotation = player.Rotation; + + switch (Rotation(rotation)) + { + case 1: + //give regen + Log.Debug("South"); + break; + case 2: + Log.Debug("West"); + player.EnableEffect(Exiled.API.Enums.EffectType.BodyshotReduction, 50, 60); + break; + case 3: + Log.Debug("North"); + player.EnableEffect(Exiled.API.Enums.EffectType.Invigorated, 1, 30); + break; + case 4: + Log.Debug("East"); + player.EnableEffect(Exiled.API.Enums.EffectType.CardiacArrest,1,10); + break; + + } + + + } + + private int Rotation(Quaternion rotation) + { + + Vector3 forward1 = rotation * Vector3.forward; + float x = forward1.x; + float z = forward1.z; + + if (z > .75f) + return 1; + if (x > .75f) + return 2; + if (z <= -.75f) + return 3; + if (x <= -.75f) + return 4; + return -1; + } + } +} From e2d8b6761a4dc30f97c82cec11a1c9350dd08cbe Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Wed, 5 Mar 2025 02:58:53 +0100 Subject: [PATCH 193/853] reworked the lights --- .../KE.Items/Lights/LightsHandler.cs | 116 ++++++++++++++++++ KruacentExiled/KE.Items/MainPlugin.cs | 93 +++----------- 2 files changed, 132 insertions(+), 77 deletions(-) create mode 100644 KruacentExiled/KE.Items/Lights/LightsHandler.cs diff --git a/KruacentExiled/KE.Items/Lights/LightsHandler.cs b/KruacentExiled/KE.Items/Lights/LightsHandler.cs new file mode 100644 index 00000000..ddc0ada0 --- /dev/null +++ b/KruacentExiled/KE.Items/Lights/LightsHandler.cs @@ -0,0 +1,116 @@ +using Exiled.API.Features; +using Exiled.API.Features.Pickups; +using Exiled.API.Features.Toys; +using Exiled.CustomItems.API.Features; +using Exiled.Events.EventArgs.Map; +using Exiled.Events.EventArgs.Player; +using InventorySystem.Items.Pickups; +using KE.Items.Interface; +using MEC; +using System; +using System.Collections.Generic; +using System.Linq; +using Pickup = InventorySystem.Items.Pickups.ItemPickupBase; + +namespace KE.Items.Lights +{ + internal class LightsHandler + { + public float Intensity { get; set; } = .5f; + private readonly Dictionary pl = new Dictionary(); + public void SubscribeEvents() + { + ItemPickupBase.OnPickupAdded += AddPickup; + ItemPickupBase.OnPickupDestroyed += DestroyPickup; + Exiled.Events.Handlers.Server.RoundStarted += OnRoundStarted; + } + + public void UnsubscribeEvents() + { + ItemPickupBase.OnPickupAdded -= AddPickup; + ItemPickupBase.OnPickupDestroyed -= DestroyPickup; + Exiled.Events.Handlers.Server.RoundStarted -= OnRoundStarted; + } + + private void OnRoundStarted() + { + Timing.RunCoroutine(LightP()); + } + + + private void AddPickup(ItemPickupBase pickup) + { + if (Check(pickup)) + { + pl.Add(pickup, null); + } + } + private void DestroyPickup(ItemPickupBase pickup) + { + + if (pickup == null) return; + + if (pl.ContainsKey(pickup)) + { + Log.Debug(pickup.ToString()); + Light val = pl[pickup]; + Log.Debug(val); + val?.Destroy(); + pl.Remove(pickup); + } + } + + + + private IEnumerator LightP() + { + while (true) + { + try + { + + + foreach (var x in pl.ToList()) + { + if (x.Key == null) + { + pl.Remove(x.Key); + continue; + } + if (CustomItem.TryGet(Exiled.API.Features.Pickups.Pickup.Get(x.Key), out CustomItem cui) && cui is ILumosItem ci) + { + if (x.Key == null) continue; + Light light = Light.Create(x.Key.Position, null, null, true, ci.Color); + light.Intensity = Intensity; + if (x.Value != null) + { + Light val = x.Value; + val?.Destroy(); + } + pl[x.Key] = light; + } + else + { + Light val = x.Value; + val?.Destroy(); + pl.Remove(x.Key); + } + } + } + catch (Exception e) + { + + } + yield return Timing.WaitForSeconds(MainPlugin.Instance.Config.RefreshRate); + } + + } + + public static bool Check(Pickup pickup) + { + return CustomItem.TryGet(Exiled.API.Features.Pickups.Pickup.Get(pickup), out CustomItem item) && item is ILumosItem; + } + + + } +} diff --git a/KruacentExiled/KE.Items/MainPlugin.cs b/KruacentExiled/KE.Items/MainPlugin.cs index fcadbce6..33579634 100644 --- a/KruacentExiled/KE.Items/MainPlugin.cs +++ b/KruacentExiled/KE.Items/MainPlugin.cs @@ -5,6 +5,8 @@ using Exiled.CustomItems.API.Features; using Exiled.Events.EventArgs.Player; using KE.Items.Interface; +using KE.Items.Lights; +using KE.Items.Upgrade; using MEC; using System; using System.Collections.Generic; @@ -17,20 +19,23 @@ public class MainPlugin : Plugin public override string Author => "Patrique & OmerGS"; public override string Name => "KEItems"; internal Sound Sound { get; private set; } + internal UpgradeHandler UpgradeHandler { get; private set; } + internal LightsHandler LightsHandler { get; private set; } internal static MainPlugin Instance { get; private set; } - public float Intensity { get; set; } = .5f; + public override Version Version => new Version(1, 0, 0); - private Dictionary pl = new Dictionary(); + public override void OnEnabled() { Instance = this; Sound = new Sound(); - + UpgradeHandler = new UpgradeHandler(); + LightsHandler = new LightsHandler(); CustomItem.RegisterItems(); - Exiled.Events.Handlers.Player.DroppedItem += Drop; - Exiled.Events.Handlers.Player.PickingUpItem += Pick; - Exiled.Events.Handlers.Server.RoundStarted += OnRoundStarted; + UpgradeHandler.SubscribeEvents(); + LightsHandler.SubscribeEvents(); + base.OnEnabled(); } @@ -38,82 +43,16 @@ public override void OnEnabled() public override void OnDisabled() { CustomItem.UnregisterItems(); - Exiled.Events.Handlers.Player.DroppedItem -= Drop; - Exiled.Events.Handlers.Player.PickingUpItem -= Pick; - Exiled.Events.Handlers.Server.RoundStarted -= OnRoundStarted; + UpgradeHandler.UnsubscribeEvents(); + LightsHandler.UnsubscribeEvents(); + base.OnDisabled(); + LightsHandler = null; Sound = null; + UpgradeHandler = null; Instance = null; } - public void Pick(PickingUpItemEventArgs ev) - { - Pickup pickup = ev.Pickup; - if (pl.ContainsKey(pickup)) - { - Light val = pl[pickup]; - if (val != null) - { - val.Destroy(); - } - pl.Remove(pickup); - } - } - public void Drop(DroppedItemEventArgs ev) - { - Pickup pickup = ev.Pickup; - if (CustomItem.TryGet(pickup, out CustomItem item) && item is ILumosItem ci) - { - pl.Add(pickup, null); - } - - } - public void OnRoundStarted() - { - Timing.RunCoroutine(LightP()); - } - - internal IEnumerator LightP() - { - foreach (var p in Pickup.List) - { - if (p != null) - { - if (CustomItem.TryGet(p, out CustomItem ci) && ci is ILumosItem) - pl.Add(p, null); - } - - } - - while (Round.InProgress) - { - - foreach (var x in pl.ToList()) - { - if(CustomItem.TryGet(x.Key, out CustomItem cui) && cui is ILumosItem ci) - { - Light light = Light.Create(x.Key.Position, null, null, true, ci.Color); - light.Intensity = Intensity; - if (x.Value != null) - { - Light val = x.Value; - val.Destroy(); - } - pl[x.Key] = light; - //Log.Debug(x.Key.Position+";"+x.Value.Position); - } - else - { - Light val = x.Value; - val.Destroy(); - pl.Remove(x.Key); - } - } - yield return Timing.WaitForSeconds(Instance.Config.RefreshRate); - } - - } - } } \ No newline at end of file From 1f1156d74e066f53f15653af1e000fcdca0d531e Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Wed, 5 Mar 2025 03:00:02 +0100 Subject: [PATCH 194/853] new upgrade system for 914 --- .../Interface/IUpgradableCustomItem.cs | 15 ++++ .../KE.Items/Upgrade/UpgradeHandler.cs | 81 +++++++++++++++++++ .../KE.Items/Upgrade/UpgradeProperties.cs | 40 +++++++++ 3 files changed, 136 insertions(+) create mode 100644 KruacentExiled/KE.Items/Interface/IUpgradableCustomItem.cs create mode 100644 KruacentExiled/KE.Items/Upgrade/UpgradeHandler.cs create mode 100644 KruacentExiled/KE.Items/Upgrade/UpgradeProperties.cs diff --git a/KruacentExiled/KE.Items/Interface/IUpgradableCustomItem.cs b/KruacentExiled/KE.Items/Interface/IUpgradableCustomItem.cs new file mode 100644 index 00000000..d2eec835 --- /dev/null +++ b/KruacentExiled/KE.Items/Interface/IUpgradableCustomItem.cs @@ -0,0 +1,15 @@ +using KE.Items.Upgrade; +using Scp914; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace KE.Items.Interface +{ + public interface IUpgradableCustomItem + { + IReadOnlyDictionary Upgrade { get; } + } +} diff --git a/KruacentExiled/KE.Items/Upgrade/UpgradeHandler.cs b/KruacentExiled/KE.Items/Upgrade/UpgradeHandler.cs new file mode 100644 index 00000000..8d5634dc --- /dev/null +++ b/KruacentExiled/KE.Items/Upgrade/UpgradeHandler.cs @@ -0,0 +1,81 @@ +using Exiled.API.Features; +using Exiled.API.Features.Items; +using Exiled.CustomItems.API.Features; +using Exiled.Events.EventArgs.Scp914; +using KE.Items.Interface; +using Scp914; + +namespace KE.Items.Upgrade +{ + internal class UpgradeHandler + { + + public void SubscribeEvents() + { + Exiled.Events.Handlers.Scp914.UpgradingInventoryItem += UpgradeItem; + Exiled.Events.Handlers.Scp914.UpgradingPickup += UpgradePickUp; + } + + public void UnsubscribeEvents() + { + Exiled.Events.Handlers.Scp914.UpgradingInventoryItem -= UpgradeItem; + Exiled.Events.Handlers.Scp914.UpgradingPickup -= UpgradePickUp; + } + + + private void UpgradeItem(UpgradingInventoryItemEventArgs ev) + { + if (!CustomItem.TryGet(ev.Item, out CustomItem ci)) return; + if (!(ci is IUpgradableCustomItem upgradable)) return; + Log.Debug("upgrading item"); + if (UpgradeCheck(upgradable, ev.KnobSetting)) + { + Log.Debug("success"); + var newItemid = upgradable.Upgrade[ev.KnobSetting].UpgradedItem; + + CustomItem newItem = CustomItem.Get(newItemid); + + ev.Player.RemoveItem(ev.Item); + newItem?.Give(ev.Player); + if (newItem == null) Log.Warn("warning id of custom item not found"); + + } + ev.IsAllowed = false; + } + + private void UpgradePickUp(UpgradingPickupEventArgs ev) + { + + if (!CustomItem.TryGet(ev.Pickup, out CustomItem ci)) return; + if (!(ci is IUpgradableCustomItem upgradable)) return; + Log.Debug("upgrading pickup"); + + if (UpgradeCheck(upgradable, ev.KnobSetting)) + { + Log.Debug("success"); + var newItemid = upgradable.Upgrade[ev.KnobSetting].UpgradedItem; + + CustomItem newItem = CustomItem.Get(newItemid); + + ev.Pickup.Destroy(); + newItem.Spawn(ev.OutputPosition); + if (newItem == null) Log.Warn("warning id of custom item not found"); + } + + ev.IsAllowed = false; + } + + private bool UpgradeCheck(IUpgradableCustomItem upgradable,Scp914KnobSetting knob) + { + if (!upgradable.Upgrade.TryGetValue(knob, out UpgradeProperties item)) return false; + if (MainPlugin.Instance.Config.Debug) + { + return true; + } + float random = UnityEngine.Random.Range(0f, 100f); + if (random < item.Chance) return true; + return false; + } + + } +} diff --git a/KruacentExiled/KE.Items/Upgrade/UpgradeProperties.cs b/KruacentExiled/KE.Items/Upgrade/UpgradeProperties.cs new file mode 100644 index 00000000..fb4813b6 --- /dev/null +++ b/KruacentExiled/KE.Items/Upgrade/UpgradeProperties.cs @@ -0,0 +1,40 @@ +using Exiled.CustomItems.API.Features; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Runtime.ExceptionServices; +using System.Text; +using System.Threading.Tasks; + +namespace KE.Items.Upgrade +{ + public class UpgradeProperties + { + private float _chance = 0; + public float Chance + { + get { return _chance; } + set + { + if (_chance > 100) + _chance = 100; + else + _chance = value; + } + } + + private uint _newItem; + + public uint UpgradedItem + { + get { return _newItem; } + } + + public UpgradeProperties(byte chance, uint newItem) + { + Chance = chance; + _newItem = newItem; + } + + } +} From 81c1e065d654565d73c4d1a0075f90bcb381ee82 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Wed, 5 Mar 2025 03:01:28 +0100 Subject: [PATCH 195/853] separated effect and custom item fix #86 Related Work Items: #8 --- .../KE.Items/Extension/CustomItemExtension.cs | 13 -- .../KE.Items/Interface/CustomGrenadeEffect.cs | 59 --------- .../KE.Items/Interface/CustomItemEffect.cs | 14 +- .../{ICustomItem.cs => ISwichableEffect.cs} | 2 +- .../ItemEffects/DeployableWallEffect.cs | 54 ++++++++ .../KE.Items/ItemEffects/DivinePillsEffect.cs | 72 +++++++++++ .../KE.Items/ItemEffects/HealZoneEffect.cs | 25 +++- .../KE.Items/ItemEffects/MineEffect.cs | 122 ++++++++++++++++++ .../KE.Items/ItemEffects/MolotovEffect.cs | 25 +++- .../KE.Items/Items/DeployableWall.cs | 45 ++----- KruacentExiled/KE.Items/Items/DivinePills.cs | 103 +++------------ KruacentExiled/KE.Items/Items/HealZone.cs | 7 +- KruacentExiled/KE.Items/Items/Mine.cs | 81 +++--------- KruacentExiled/KE.Items/Items/Molotov.cs | 14 +- KruacentExiled/KE.Items/Items/Scp1650.cs | 1 + 15 files changed, 356 insertions(+), 281 deletions(-) delete mode 100644 KruacentExiled/KE.Items/Extension/CustomItemExtension.cs delete mode 100644 KruacentExiled/KE.Items/Interface/CustomGrenadeEffect.cs rename KruacentExiled/KE.Items/Interface/{ICustomItem.cs => ISwichableEffect.cs} (84%) create mode 100644 KruacentExiled/KE.Items/ItemEffects/DeployableWallEffect.cs create mode 100644 KruacentExiled/KE.Items/ItemEffects/DivinePillsEffect.cs create mode 100644 KruacentExiled/KE.Items/ItemEffects/MineEffect.cs diff --git a/KruacentExiled/KE.Items/Extension/CustomItemExtension.cs b/KruacentExiled/KE.Items/Extension/CustomItemExtension.cs deleted file mode 100644 index 6a1a2c06..00000000 --- a/KruacentExiled/KE.Items/Extension/CustomItemExtension.cs +++ /dev/null @@ -1,13 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace KE.Items.Extension -{ - public static class CustomItemExtension - { - - } -} diff --git a/KruacentExiled/KE.Items/Interface/CustomGrenadeEffect.cs b/KruacentExiled/KE.Items/Interface/CustomGrenadeEffect.cs deleted file mode 100644 index fa6e30d1..00000000 --- a/KruacentExiled/KE.Items/Interface/CustomGrenadeEffect.cs +++ /dev/null @@ -1,59 +0,0 @@ -using Exiled.CustomItems.API.Features; -using Exiled.Events.EventArgs.Map; -using Exiled.Events.EventArgs.Player; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace KE.Items.Interface -{ - public abstract class CustomGrenadeEffect : CustomItemEffect - { - // - // Summary: - // Handles tracking thrown requests by custom grenades. - // - // Parameters: - // ev: - // Exiled.Events.EventArgs.Player.ThrowingRequestEventArgs. - public virtual void OnThrowingRequest(ThrowingRequestEventArgs ev) - { - } - - // - // Summary: - // Handles tracking thrown custom grenades. - // - // Parameters: - // ev: - // Exiled.Events.EventArgs.Player.ThrownProjectileEventArgs. - public virtual void OnThrownProjectile(ThrownProjectileEventArgs ev) - { - } - - // - // Summary: - // Handles tracking exploded custom grenades. - // - // Parameters: - // ev: - // Exiled.Events.EventArgs.Map.ExplodingGrenadeEventArgs. - public virtual void OnExploding(ExplodingGrenadeEventArgs ev) - { - } - - // - // Summary: - // Handles the tracking of custom grenade pickups that are changed into live grenades - // by a frag grenade explosion. - // - // Parameters: - // ev: - // Exiled.Events.EventArgs.Map.ChangedIntoGrenadeEventArgs. - public virtual void OnChangedIntoGrenade(ChangedIntoGrenadeEventArgs ev) - { - } - } -} diff --git a/KruacentExiled/KE.Items/Interface/CustomItemEffect.cs b/KruacentExiled/KE.Items/Interface/CustomItemEffect.cs index 3a363a1e..f8e22c94 100644 --- a/KruacentExiled/KE.Items/Interface/CustomItemEffect.cs +++ b/KruacentExiled/KE.Items/Interface/CustomItemEffect.cs @@ -1,13 +1,23 @@ -using System; +using Exiled.API.Features; +using Exiled.CustomItems.API.Features; +using Exiled.Events.EventArgs.Map; +using Exiled.Events.EventArgs.Player; +using System; using System.Collections.Generic; using System.Linq; +using System.Net.Sockets; using System.Text; using System.Threading.Tasks; namespace KE.Items.Interface { - public class CustomItemEffect + public abstract class CustomItemEffect { + public abstract void Effect(UsedItemEventArgs ev); + + public abstract void Effect(ExplodingGrenadeEventArgs ev); + + public abstract void Effect(DroppingItemEventArgs ev); } } diff --git a/KruacentExiled/KE.Items/Interface/ICustomItem.cs b/KruacentExiled/KE.Items/Interface/ISwichableEffect.cs similarity index 84% rename from KruacentExiled/KE.Items/Interface/ICustomItem.cs rename to KruacentExiled/KE.Items/Interface/ISwichableEffect.cs index cc03d1e6..f2717159 100644 --- a/KruacentExiled/KE.Items/Interface/ICustomItem.cs +++ b/KruacentExiled/KE.Items/Interface/ISwichableEffect.cs @@ -6,7 +6,7 @@ namespace KE.Items.Interface { - public interface ICustomItem + public interface ISwichableEffect { CustomItemEffect Effect { get; set; } } diff --git a/KruacentExiled/KE.Items/ItemEffects/DeployableWallEffect.cs b/KruacentExiled/KE.Items/ItemEffects/DeployableWallEffect.cs new file mode 100644 index 00000000..f85deaa6 --- /dev/null +++ b/KruacentExiled/KE.Items/ItemEffects/DeployableWallEffect.cs @@ -0,0 +1,54 @@ +using Exiled.API.Features.Toys; +using Exiled.Events.EventArgs.Map; +using Exiled.Events.EventArgs.Player; +using KE.Items.Interface; +using MEC; +using UnityEngine; + + +namespace KE.Items.ItemEffects +{ + public class DeployableWallEffect : CustomItemEffect + { + public override void Effect(UsedItemEventArgs ev) + { + SpawnWall(ev.Player.Position,ev.Player.Rotation); + } + public override void Effect(DroppingItemEventArgs ev) + { + SpawnWall(ev.Player.Position, ev.Player.Rotation); + } + + public override void Effect(ExplodingGrenadeEventArgs ev) + { + SpawnWall(ev.Position, ev.Projectile.Rotation); + } + + private void SpawnWall(Vector3 pos, Quaternion rotation) + { + float distance = 2; + Vector3 forward = rotation * Vector3.forward; + Vector3 spawnPos = pos + forward * distance; + Vector3 rotat = new Vector3(0, rotation.eulerAngles.y, 0); + + MainPlugin.Instance.Sound.PlayClip("build", spawnPos); + Primitive wall = Primitive.Create(PrimitiveType.Cube, spawnPos, rotat, new Vector3(4, 4, 0.2f), true); + wall.Collidable = true; + wall.Visible = true; + Timing.CallDelayed(10, () => { + wall.UnSpawn(); + wall.Destroy(); + }); + Timing.CallDelayed(5, () => + { + wall.Color = Color.yellow; + }); + Timing.CallDelayed(8, () => + { + wall.Color = Color.red; + }); + + + } + } +} diff --git a/KruacentExiled/KE.Items/ItemEffects/DivinePillsEffect.cs b/KruacentExiled/KE.Items/ItemEffects/DivinePillsEffect.cs new file mode 100644 index 00000000..42997842 --- /dev/null +++ b/KruacentExiled/KE.Items/ItemEffects/DivinePillsEffect.cs @@ -0,0 +1,72 @@ +using Exiled.API.Enums; +using Exiled.API.Extensions; +using Exiled.API.Features; +using Exiled.CustomItems.API.Features; +using Exiled.Events.EventArgs.Interfaces; +using Exiled.Events.EventArgs.Map; +using Exiled.Events.EventArgs.Player; +using KE.Items.Interface; +using PlayerRoles; +using System.Linq; +using Random = UnityEngine.Random; + +namespace KE.Items.ItemEffects +{ + public class DivinePillsEffect : CustomItemEffect + { + public override void Effect(UsedItemEventArgs ev) + { + EffectItem(ev.Player); + } + public override void Effect(DroppingItemEventArgs ev) + { + EffectItem(ev.Player,ev); + } + + public override void Effect(ExplodingGrenadeEventArgs ev) + { + foreach (Player p in ev.TargetsToAffect) + { + EffectItem(p); + } + } + + + + private void EffectItem(Player player,IDeniableEvent ev = null) + { + if (Player.List.Count(x => x.Role == RoleTypeId.Spectator) == 0) + { + player.ShowHint("No spectators to respawn"); + /* + could be used for a deniable event + if(ev != null) + ev.IsAllowed = false; + */ + return; + } + var random = Random.Range(0, 100); + if (random <= 25) + { + player.Kill("unlucky bro"); + return; + } + Player respawning = Player.List.GetRandomValue(x => x.Role == RoleTypeId.Spectator); + switch (player.Role.Side) + { + case Side.ChaosInsurgency: + respawning.Role.Set(RoleTypeId.ChaosRifleman); + break; + case Side.Mtf: + respawning.Role.Set(RoleTypeId.NtfPrivate); + break; + } + + if (random > 75) + { + Log.Debug("tp"); + respawning.Teleport(player); + } + } + } +} diff --git a/KruacentExiled/KE.Items/ItemEffects/HealZoneEffect.cs b/KruacentExiled/KE.Items/ItemEffects/HealZoneEffect.cs index e31e447e..7f21b828 100644 --- a/KruacentExiled/KE.Items/ItemEffects/HealZoneEffect.cs +++ b/KruacentExiled/KE.Items/ItemEffects/HealZoneEffect.cs @@ -1,6 +1,7 @@ using Exiled.API.Features; using Exiled.API.Features.Toys; using Exiled.Events.EventArgs.Map; +using Exiled.Events.EventArgs.Player; using KE.Items.Interface; using MEC; using System; @@ -12,17 +13,31 @@ namespace KE.Items.ItemEffects { - public class HealZoneEffect : CustomGrenadeEffect + public class HealZoneEffect : CustomItemEffect { - public override void OnExploding(ExplodingGrenadeEventArgs ev) + public override void Effect(UsedItemEventArgs ev) + { + SetZone(ev.Player, ev.Player.Position); + } + public override void Effect(DroppingItemEventArgs ev) + { + SetZone(ev.Player, ev.Player.Position); + } + + public override void Effect(ExplodingGrenadeEventArgs ev) + { + SetZone(ev.Player, ev.Player.Position, ev.TargetsToAffect); + } + + private void SetZone(Player player, Vector3 position, HashSet targets = null) { float cylinderSize = 5; - ev.TargetsToAffect.Clear(); + targets?.Clear(); - Player playerThrowingGrenade = ev.Player; - Vector3 healZonePosition = ev.Position; + Player playerThrowingGrenade = player; + Vector3 healZonePosition = position; Primitive wall = Primitive.Create(PrimitiveType.Cylinder, healZonePosition, null, new Vector3(cylinderSize, 0.01f, cylinderSize), true); wall.Collidable = false; wall.Visible = true; diff --git a/KruacentExiled/KE.Items/ItemEffects/MineEffect.cs b/KruacentExiled/KE.Items/ItemEffects/MineEffect.cs new file mode 100644 index 00000000..77c835c2 --- /dev/null +++ b/KruacentExiled/KE.Items/ItemEffects/MineEffect.cs @@ -0,0 +1,122 @@ +using Exiled.API.Features; +using Exiled.API.Features.Items; +using Exiled.Events.EventArgs.Map; +using Exiled.Events.EventArgs.Player; +using KE.Items.Interface; +using KE.Items.Models; +using MEC; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using UnityEngine; + +namespace KE.Items.ItemEffects +{ + public class MineEffect : CustomItemEffect + { + private const float RefreshRate = .01f; + private const int MineActivationTime = 10; + private const float MineRadius = 0.7f; + public override void Effect(UsedItemEventArgs ev) + { + PlaceMine(ev.Player); + } + public override void Effect(DroppingItemEventArgs ev) + { + PlaceMine(ev.Player); + } + + public override void Effect(ExplodingGrenadeEventArgs ev) + { + PlaceMine(ev.Player,ev.Position); + } + + + /// + /// Place the mine at the feet of the player + /// + /// + private void PlaceMine(Player p) + { + SpawnMine(p, p.Position - new Vector3(0, p.Scale.y)); + } + /// + /// Place the mine at the specified position + /// + /// + /// + private void PlaceMine(Player p,Vector3 pos) + { + + SpawnMine(p, pos); + } + + private void SpawnMine(Player p,Vector3 pos) + { + + MineModel m = new MineModel(); + + //put the mine on the floor + m.Spawn(pos, new Quaternion()); + + Timing.RunCoroutine(WaitAndActivateMine(p, m)); + } + + + private IEnumerator WaitAndActivateMine(Player player, MineModel mine) + { + int countdown = MineActivationTime; + while (countdown > 0) + { + player.ShowHint($"The mine will be active in {countdown} seconds !", 1f); + yield return Timing.WaitForSeconds(1f); + countdown--; + } + + // Message final lorsque la mine s'active + player.ShowHint("Mine activated !"); + Timing.RunCoroutine(ActiveMine(mine, MineRadius)); + } + + private IEnumerator ActiveMine(MineModel mine, float cylinderSize) + { + Timing.RunCoroutine(mine.Activate()); + bool endWhile = true; + while (endWhile) + { + foreach (Player player in Player.List) + { + if (IsPlayerInZone(player, mine.Position, cylinderSize, 3)) + { + ((ExplosiveGrenade)Item.Create(ItemType.GrenadeHE)).SpawnActive(mine.Position).FuseTime = 0f; + + // Delete the mine + mine.UnSpawn(); + endWhile = false; + break; + } + } + + yield return Timing.WaitForSeconds(RefreshRate); + } + } + + private bool IsPlayerInZone(Player player, Vector3 zonePosition, float radius, float height) + { + // Calculate the horizontal distance (x, z) + float horizontalDistance = Vector3.Distance( + new Vector3(player.Position.x, 0, player.Position.z), + new Vector3(zonePosition.x, 0, zonePosition.z) + ); + + // Calculate the vertical difference (y) + float verticalDifference = Mathf.Abs(player.Position.y - zonePosition.y); + + // Check if the player is in the 3d zone. + return horizontalDistance <= (radius / 2) && verticalDifference <= (height / 2); + } + + } +} diff --git a/KruacentExiled/KE.Items/ItemEffects/MolotovEffect.cs b/KruacentExiled/KE.Items/ItemEffects/MolotovEffect.cs index e0522a98..0a237dc8 100644 --- a/KruacentExiled/KE.Items/ItemEffects/MolotovEffect.cs +++ b/KruacentExiled/KE.Items/ItemEffects/MolotovEffect.cs @@ -7,30 +7,40 @@ using Exiled.API.Enums; using System.Collections.Generic; using UnityEngine; +using Exiled.Events.EventArgs.Player; namespace KE.Items.ItemEffects { - public class MolotovEffect : CustomGrenadeEffect + public class MolotovEffect : CustomItemEffect { public const float RefreshRate = 0.5f; public const float Duration = 20f; public float CylinderSize { get; set; } = 5; - public void Effect() + public override void Effect(UsedItemEventArgs ev) { + SetZone(ev.Player, ev.Player.Position); + } + public override void Effect(DroppingItemEventArgs ev) + { + SetZone(ev.Player, ev.Player.Position); + } - + public override void Effect(ExplodingGrenadeEventArgs ev) + { + SetZone(ev.Player, ev.Player.Position,ev.TargetsToAffect); } - public void Effect(ExplodingGrenadeEventArgs ev) + + private void SetZone(Player player,Vector3 position,HashSet targets = null) { float cylinderSize = CylinderSize; - ev.TargetsToAffect.Clear(); + targets?.Clear(); - Player playerThrowingGrenade = ev.Player; - Vector3 molotovPosition = ev.Position; + Player playerThrowingGrenade = player; + Vector3 molotovPosition = position; Primitive wall = Primitive.Create(PrimitiveType.Cylinder, molotovPosition, null, new Vector3(cylinderSize, 0.01f, cylinderSize), true); wall.Collidable = false; wall.Visible = true; @@ -47,6 +57,7 @@ public void Effect(ExplodingGrenadeEventArgs ev) } + private IEnumerator DamageInMolotovZone(Vector3 wallPosition, float cylinderSize, Player playerThrowingGrenade) { // Dictionary that stores the time each player has spent inside the zone (in seconds). diff --git a/KruacentExiled/KE.Items/Items/DeployableWall.cs b/KruacentExiled/KE.Items/Items/DeployableWall.cs index d60750c7..60ec9d66 100644 --- a/KruacentExiled/KE.Items/Items/DeployableWall.cs +++ b/KruacentExiled/KE.Items/Items/DeployableWall.cs @@ -8,18 +8,21 @@ using Exiled.Events.EventArgs.Player; using Exiled.API.Features.Toys; using MEC; +using KE.Items.ItemEffects; namespace KE.Items.Items { [CustomItem(ItemType.KeycardJanitor)] - public class DeployableWall : CustomItem, ILumosItem + public class DeployableWall : CustomItem, ILumosItem, ISwichableEffect { public override uint Id { get; set; } = 1048; public override string Name { get; set; } = "Deployable Wall"; public override string Description { get; set; } = "Drop to deploy a wall, and throw to just throw the card"; public override float Weight { get; set; } = 0.65f; - public UnityEngine.Color Color { get; set; } = UnityEngine.Color.green; + public Color Color { get; set; } = Color.green; + + public CustomItemEffect Effect { get; set; } public override SpawnProperties SpawnProperties { get; set; } = new SpawnProperties() { Limit = 2, @@ -47,13 +50,13 @@ public class DeployableWall : CustomItem, ILumosItem }; - - + public DeployableWall() + { + Effect = new DeployableWallEffect(); + } protected override void OnDroppingItem(DroppingItemEventArgs ev) { - if(!Check(ev.Item)) - return; if (ev.IsThrown) { ev.IsAllowed = true; @@ -61,38 +64,12 @@ protected override void OnDroppingItem(DroppingItemEventArgs ev) } ev.IsAllowed = false; - ev.Player.ShowHint("You have dropped a deployable wall"); ev.Player.RemoveItem(ev.Item); - SpawnWall(ev.Player.Position,ev.Player.Rotation); + Effect.Effect(ev); } - private void SpawnWall(Vector3 pos, Quaternion rotation) - { - float distance = 2; - Vector3 forward = rotation * Vector3.forward; - Vector3 spawnPos = pos + forward * distance; - Vector3 rotat = new Vector3(0, rotation.eulerAngles.y, 0); - - MainPlugin.Instance.Sound.PlayClip("build", spawnPos); - Primitive wall = Primitive.Create(PrimitiveType.Cube, spawnPos, rotat, new Vector3(4, 4, 0.2f),true); - wall.Collidable = true; - wall.Visible = true; - Timing.CallDelayed(10, () => { - wall.UnSpawn(); - wall.Destroy(); - }); - Timing.CallDelayed(5, () => - { - wall.Color= Color.yellow; - }); - Timing.CallDelayed(8, () => - { - wall.Color = Color.red; - }); - - - } + } diff --git a/KruacentExiled/KE.Items/Items/DivinePills.cs b/KruacentExiled/KE.Items/Items/DivinePills.cs index 5d535951..a76a97e7 100644 --- a/KruacentExiled/KE.Items/Items/DivinePills.cs +++ b/KruacentExiled/KE.Items/Items/DivinePills.cs @@ -18,10 +18,14 @@ using Exiled.API.Features.Items; using System.Data; using Exiled.API.Features.Pickups; +using KE.Items.ItemEffects; +using KE.Items.Upgrade; +using Scp914; +using System.Collections.ObjectModel; /// [CustomItem(ItemType.Painkillers)] -public class DivinePills : CustomItem, ILumosItem +public class DivinePills : CustomItem, ILumosItem, ISwichableEffect, IUpgradableCustomItem { /// public override uint Id { get; set; } = 1047; @@ -35,6 +39,11 @@ public class DivinePills : CustomItem, ILumosItem /// public override float Weight { get; set; } = 0.65f; public UnityEngine.Color Color { get; set; } = UnityEngine.Color.yellow; + public IReadOnlyDictionary Upgrade { get; private set; } = new Dictionary() + { + //very fine -> true divine pills 10% + { Scp914KnobSetting.VeryFine,new UpgradeProperties(10, 1050)} + }; /// public override SpawnProperties SpawnProperties { get; set; } = new SpawnProperties() @@ -67,100 +76,30 @@ public class DivinePills : CustomItem, ILumosItem }; + public CustomItemEffect Effect { get;set; } + public DivinePills() + { + Effect = new DivinePillsEffect(); + } + /// protected override void SubscribeEvents() { - PlayerHandle.UsingItem += OnUsingItem; + PlayerHandle.UsedItem += OnUsedItem; base.SubscribeEvents(); } /// protected override void UnsubscribeEvents() { - PlayerHandle.UsingItem -= OnUsingItem; + PlayerHandle.UsedItem -= OnUsedItem; base.UnsubscribeEvents(); } - protected override void OnUpgrading(UpgradingEventArgs ev) + private void OnUsedItem(UsedItemEventArgs ev) { - if (!Check(ev.Pickup)) - return; - if (ev.KnobSetting != Scp914.Scp914KnobSetting.VeryFine) - return; - var rng = Random.value; - Log.Debug($"pickup {Name} : {rng}"); - if (rng < .1f) - { - //success - ev.Pickup.Destroy(); - TrySpawn("True Divine Pills", ev.OutputPosition, out Pickup a); - - ev.IsAllowed = true; - } - else - ev.IsAllowed = false; - } - - protected override void OnUpgrading(UpgradingItemEventArgs ev) - { - - if (!Check(ev.Item)) - return; - if (ev.KnobSetting != Scp914.Scp914KnobSetting.VeryFine) - return; - var rng = Random.value; - Log.Debug($"inventory {Name} : {rng}"); - if (rng < .1f) - { - //success - ev.Player.RemoveItem(ev.Item); - TryGive(ev.Player, "True Divine Pills"); - ev.IsAllowed = true; - } - else - { - ev.Player.ShowHint("no luck"); - ev.IsAllowed = false; - } - } - - private void OnUsingItem(UsingItemEventArgs ev) - { - if (!Check(ev.Item)) - { - return; - } - Player player = ev.Player; - - - if(Player.List.Count(x => x.Role == RoleTypeId.Spectator) == 0) - { - player.ShowHint("No spectators to respawn"); - ev.IsAllowed = false; - return; - } - var random = Random.Range(0, 100); - if (random <= 25) - { - player.Kill("unlucky bro"); - return; - } - Player respawning = Player.List.GetRandomValue(x => x.Role == RoleTypeId.Spectator); - switch (player.Role.Side) - { - case Side.ChaosInsurgency: - respawning.Role.Set(RoleTypeId.ChaosRifleman); - break; - case Side.Mtf: - respawning.Role.Set(RoleTypeId.NtfPrivate); - break; - } - - if (random > 75) - { - Log.Debug("tp"); - respawning.Teleport(player); - } + if (!Check(ev.Item)) return; + Effect.Effect(ev); } } \ No newline at end of file diff --git a/KruacentExiled/KE.Items/Items/HealZone.cs b/KruacentExiled/KE.Items/Items/HealZone.cs index f5d2dafe..bdcc6328 100644 --- a/KruacentExiled/KE.Items/Items/HealZone.cs +++ b/KruacentExiled/KE.Items/Items/HealZone.cs @@ -14,7 +14,7 @@ namespace KE.Items.Items { [CustomItem(ItemType.GrenadeFlash)] - public class HealZone : CustomGrenade, ILumosItem, ICustomItem + public class HealZone : CustomGrenade, ILumosItem, ISwichableEffect { public override uint Id { get; set; } = 1051; public override string Name { get; set; } = "Heal Zone"; @@ -22,7 +22,6 @@ public class HealZone : CustomGrenade, ILumosItem, ICustomItem public override float Weight { get; set; } = 0.65f; public override float FuseTime { get; set; } = 5f; public override bool ExplodeOnCollision { get; set; } = true; - public float DamageModifier { get; set; } = 0f; public UnityEngine.Color Color { get; set; } = UnityEngine.Color.green; public CustomItemEffect Effect { get; set; } public override SpawnProperties SpawnProperties { get; set; } = new SpawnProperties() @@ -75,7 +74,9 @@ public HealZone() protected override void OnExploding(ExplodingGrenadeEventArgs ev) { - //Effect.OnExploding(ev); + + Effect.Effect(ev); + ev.TargetsToAffect.Clear(); } } } \ No newline at end of file diff --git a/KruacentExiled/KE.Items/Items/Mine.cs b/KruacentExiled/KE.Items/Items/Mine.cs index b475ff8e..ec4c021f 100644 --- a/KruacentExiled/KE.Items/Items/Mine.cs +++ b/KruacentExiled/KE.Items/Items/Mine.cs @@ -12,21 +12,21 @@ using Exiled.API.Features.Items; using Model = KE.Items.Models.Model; using KE.Items.Models; +using KE.Items.ItemEffects; namespace KE.Items.Items { [CustomItem(ItemType.KeycardJanitor)] - public class Mine : CustomItem, ILumosItem + public class Mine : CustomItem, ILumosItem, ISwichableEffect { public override uint Id { get; set; } = 1053; public override string Name { get; set; } = "Mine"; public override string Description { get; set; } = "Drop to deploy the mine, little advice : don't step on it"; public override float Weight { get; set; } = 0.65f; - public UnityEngine.Color Color { get; set; } = UnityEngine.Color.yellow; + public Color Color { get; set; } = Color.yellow; + + public CustomItemEffect Effect { get; set; } - private const float RefreshRate = .01f; - private const int MineActivationTime = 10; - private const float MineRadius = 0.7f; public override SpawnProperties SpawnProperties { get; set; } = new SpawnProperties() { @@ -70,79 +70,28 @@ public class Mine : CustomItem, ILumosItem }; + public Mine() + { + Effect = new MineEffect(); + } + protected override void OnDroppingItem(DroppingItemEventArgs ev) { - if(!Check(ev.Item)) - return; + + if (ev.IsThrown) { ev.IsAllowed = true; return; } - + ev.IsAllowed = false; ev.Player.RemoveItem(ev.Item); + Effect.Effect(ev); - MineModel m = new MineModel(); - - //put the mine on the floor - m.Spawn(ev.Player.Position-new Vector3(0,ev.Player.Scale.y),new Quaternion()); - - Timing.RunCoroutine(WaitAndActivateMine(ev.Player, m)); - } - - - private IEnumerator WaitAndActivateMine(Player player, MineModel mine) - { - int countdown = MineActivationTime; - while (countdown > 0) - { - player.ShowHint($"The mine will be active in {countdown} seconds !", 1f); - yield return Timing.WaitForSeconds(1f); - countdown--; - } - - // Message final lorsque la mine s'active - player.ShowHint("Mine activated !"); - Timing.RunCoroutine(ActiveMine(mine, MineRadius)); } - private IEnumerator ActiveMine(MineModel mine, float cylinderSize) - { - Timing.RunCoroutine(mine.Activate()); - bool endWhile = true; - while (endWhile) - { - foreach (Player player in Player.List) - { - if (IsPlayerInZone(player, mine.Position, cylinderSize, 3)) - { - ((ExplosiveGrenade)Item.Create(ItemType.GrenadeHE)).SpawnActive(mine.Position).FuseTime = 0f; - - // Delete the mine - mine.UnSpawn(); - endWhile = false; - break; - } - } - yield return Timing.WaitForSeconds(RefreshRate); - } - } - - private bool IsPlayerInZone(Player player, Vector3 zonePosition, float radius, float height) - { - // Calculate the horizontal distance (x, z) - float horizontalDistance = Vector3.Distance( - new Vector3(player.Position.x, 0, player.Position.z), - new Vector3(zonePosition.x, 0, zonePosition.z) - ); - - // Calculate the vertical difference (y) - float verticalDifference = Mathf.Abs(player.Position.y - zonePosition.y); - - // Check if the player is in the 3d zone. - return horizontalDistance <= (radius / 2) && verticalDifference <= (height / 2); - } + } } diff --git a/KruacentExiled/KE.Items/Items/Molotov.cs b/KruacentExiled/KE.Items/Items/Molotov.cs index 51957eb1..68618379 100644 --- a/KruacentExiled/KE.Items/Items/Molotov.cs +++ b/KruacentExiled/KE.Items/Items/Molotov.cs @@ -2,20 +2,15 @@ using Exiled.API.Enums; using Exiled.API.Features.Attributes; using Exiled.API.Features.Spawn; -using Exiled.API.Features.Toys; using Exiled.CustomItems.API.Features; using Exiled.Events.EventArgs.Map; using KE.Items.Interface; -using Player = Exiled.API.Features.Player; -using MEC; -using UnityEngine; -using PlayerRoles; using KE.Items.ItemEffects; namespace KE.Items.Items { [CustomItem(ItemType.GrenadeFlash)] - public class Molotov : CustomGrenade, ILumosItem, ICustomItem + public class Molotov : CustomGrenade, ILumosItem, ISwichableEffect { public override uint Id { get; set; } = 1049; public override string Name { get; set; } = "Cocktail Molotov"; @@ -23,7 +18,6 @@ public class Molotov : CustomGrenade, ILumosItem, ICustomItem public override float Weight { get; set; } = 0.65f; public override float FuseTime { get; set; } = 5f; public override bool ExplodeOnCollision { get; set; } = true; - public float DamageModifier { get; set; } = 0f; public UnityEngine.Color Color { get; set; } = UnityEngine.Color.yellow; public CustomItemEffect Effect { get; set; } public override SpawnProperties SpawnProperties { get; set; } = new SpawnProperties() @@ -72,12 +66,14 @@ public class Molotov : CustomGrenade, ILumosItem, ICustomItem public Molotov() { - Effect = new MolotovEffect(); + Effect = new MineEffect(); } protected override void OnExploding(ExplodingGrenadeEventArgs ev) { - //Effect.OnExploding(ev); + + Effect.Effect(ev); + ev.TargetsToAffect.Clear(); } } diff --git a/KruacentExiled/KE.Items/Items/Scp1650.cs b/KruacentExiled/KE.Items/Items/Scp1650.cs index 7573bc70..f91d94a5 100644 --- a/KruacentExiled/KE.Items/Items/Scp1650.cs +++ b/KruacentExiled/KE.Items/Items/Scp1650.cs @@ -45,6 +45,7 @@ protected override void UnsubscribeEvents() } private void OnUsedItem(UsedItemEventArgs ev) { + if (!Check(ev.Item)) return; Player player = ev.Player; Quaternion rotation = player.Rotation; From e6828b2fb6c705e6e66ef519813dfa5faacc855d Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Wed, 5 Mar 2025 03:06:19 +0100 Subject: [PATCH 196/853] moved models folder --- KruacentExiled/KE.Items/ItemEffects/MineEffect.cs | 2 +- KruacentExiled/KE.Items/Items/Mine.cs | 3 +-- KruacentExiled/KE.Items/{ => Items}/Models/DeployWallModel.cs | 2 +- KruacentExiled/KE.Items/{ => Items}/Models/MineModel.cs | 2 +- KruacentExiled/KE.Items/{ => Items}/Models/Model.cs | 2 +- 5 files changed, 5 insertions(+), 6 deletions(-) rename KruacentExiled/KE.Items/{ => Items}/Models/DeployWallModel.cs (98%) rename KruacentExiled/KE.Items/{ => Items}/Models/MineModel.cs (98%) rename KruacentExiled/KE.Items/{ => Items}/Models/Model.cs (94%) diff --git a/KruacentExiled/KE.Items/ItemEffects/MineEffect.cs b/KruacentExiled/KE.Items/ItemEffects/MineEffect.cs index 77c835c2..ef8ac74a 100644 --- a/KruacentExiled/KE.Items/ItemEffects/MineEffect.cs +++ b/KruacentExiled/KE.Items/ItemEffects/MineEffect.cs @@ -3,7 +3,7 @@ using Exiled.Events.EventArgs.Map; using Exiled.Events.EventArgs.Player; using KE.Items.Interface; -using KE.Items.Models; +using KE.Items.Items.Models; using MEC; using System; using System.Collections.Generic; diff --git a/KruacentExiled/KE.Items/Items/Mine.cs b/KruacentExiled/KE.Items/Items/Mine.cs index ec4c021f..c99019a8 100644 --- a/KruacentExiled/KE.Items/Items/Mine.cs +++ b/KruacentExiled/KE.Items/Items/Mine.cs @@ -10,8 +10,7 @@ using Player = Exiled.API.Features.Player; using MEC; using Exiled.API.Features.Items; -using Model = KE.Items.Models.Model; -using KE.Items.Models; +using Model = KE.Items.Items.Models.Model; using KE.Items.ItemEffects; namespace KE.Items.Items diff --git a/KruacentExiled/KE.Items/Models/DeployWallModel.cs b/KruacentExiled/KE.Items/Items/Models/DeployWallModel.cs similarity index 98% rename from KruacentExiled/KE.Items/Models/DeployWallModel.cs rename to KruacentExiled/KE.Items/Items/Models/DeployWallModel.cs index f1717060..56f14ced 100644 --- a/KruacentExiled/KE.Items/Models/DeployWallModel.cs +++ b/KruacentExiled/KE.Items/Items/Models/DeployWallModel.cs @@ -9,7 +9,7 @@ using UnityEngine; using Light = Exiled.API.Features.Toys.Light; -namespace KE.Items.Models +namespace KE.Items.Items.Models { internal class DeployWallModel : Model { diff --git a/KruacentExiled/KE.Items/Models/MineModel.cs b/KruacentExiled/KE.Items/Items/Models/MineModel.cs similarity index 98% rename from KruacentExiled/KE.Items/Models/MineModel.cs rename to KruacentExiled/KE.Items/Items/Models/MineModel.cs index aa18d73c..ebc9318d 100644 --- a/KruacentExiled/KE.Items/Models/MineModel.cs +++ b/KruacentExiled/KE.Items/Items/Models/MineModel.cs @@ -7,7 +7,7 @@ using UnityEngine; using Light = Exiled.API.Features.Toys.Light; -namespace KE.Items.Models +namespace KE.Items.Items.Models { internal class MineModel : Model { diff --git a/KruacentExiled/KE.Items/Models/Model.cs b/KruacentExiled/KE.Items/Items/Models/Model.cs similarity index 94% rename from KruacentExiled/KE.Items/Models/Model.cs rename to KruacentExiled/KE.Items/Items/Models/Model.cs index 5a427b93..da7c1b99 100644 --- a/KruacentExiled/KE.Items/Models/Model.cs +++ b/KruacentExiled/KE.Items/Items/Models/Model.cs @@ -6,7 +6,7 @@ using System.Threading.Tasks; using UnityEngine; -namespace KE.Items.Models +namespace KE.Items.Items.Models { internal abstract class Model { From 9564fd696ba7a952708f3ea476350d35cc59bb5f Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Wed, 5 Mar 2025 03:07:04 +0100 Subject: [PATCH 197/853] changed the chance constructor of upgrade properties --- .../KE.Items/Upgrade/UpgradeProperties.cs | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/KruacentExiled/KE.Items/Upgrade/UpgradeProperties.cs b/KruacentExiled/KE.Items/Upgrade/UpgradeProperties.cs index fb4813b6..5a44efbf 100644 --- a/KruacentExiled/KE.Items/Upgrade/UpgradeProperties.cs +++ b/KruacentExiled/KE.Items/Upgrade/UpgradeProperties.cs @@ -5,35 +5,30 @@ using System.Runtime.ExceptionServices; using System.Text; using System.Threading.Tasks; +using YamlDotNet.Core.Tokens; namespace KE.Items.Upgrade { public class UpgradeProperties { - private float _chance = 0; + private float _chance; public float Chance { get { return _chance; } - set - { - if (_chance > 100) - _chance = 100; - else - _chance = value; - } } private uint _newItem; - public uint UpgradedItem { get { return _newItem; } } - public UpgradeProperties(byte chance, uint newItem) + public UpgradeProperties(float chance, uint newItem) { - Chance = chance; _newItem = newItem; + if (chance > 100) _chance = 100; + else if(chance < 0) _chance = 0; + else _chance = chance; } } From f54cb901f86bb9fd95fcbf64c224d82f17941389 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Thu, 6 Mar 2025 00:35:24 +0100 Subject: [PATCH 198/853] tpgrenada + scp1650 effect added sound to saint grenade --- KruacentExiled/KE.Items/Config.cs | 2 + KruacentExiled/KE.Items/Interface/IUse.cs | 14 +++ .../KE.Items/ItemEffects/Scp1650Effect.cs | 103 ++++++++++++++++++ .../KE.Items/ItemEffects/TPGrenadaEffect.cs | 98 +++++++++++++++++ KruacentExiled/KE.Items/Items/Defibrilator.cs | 2 +- KruacentExiled/KE.Items/Items/DivinePills.cs | 3 +- KruacentExiled/KE.Items/Items/Models/Model.cs | 16 ++- .../KE.Items/Items/SainteGrenada.cs | 9 +- KruacentExiled/KE.Items/Items/Scp1650.cs | 57 +++------- KruacentExiled/KE.Items/Items/Scp3136.cs | 91 ++++++++++++++++ KruacentExiled/KE.Items/Items/TPGrenada.cs | 75 +++---------- KruacentExiled/KE.Items/KE.Items.csproj | 2 +- KruacentExiled/KE.Items/KECustomItem.cs | 53 +++++++++ .../KE.Items/Lights/LightsHandler.cs | 2 - KruacentExiled/KE.Items/MainPlugin.cs | 2 + KruacentExiled/KE.Items/Sound.cs | 48 ++++++-- 16 files changed, 457 insertions(+), 120 deletions(-) create mode 100644 KruacentExiled/KE.Items/Interface/IUse.cs create mode 100644 KruacentExiled/KE.Items/ItemEffects/Scp1650Effect.cs create mode 100644 KruacentExiled/KE.Items/ItemEffects/TPGrenadaEffect.cs create mode 100644 KruacentExiled/KE.Items/Items/Scp3136.cs create mode 100644 KruacentExiled/KE.Items/KECustomItem.cs diff --git a/KruacentExiled/KE.Items/Config.cs b/KruacentExiled/KE.Items/Config.cs index 51a7f302..81678c85 100644 --- a/KruacentExiled/KE.Items/Config.cs +++ b/KruacentExiled/KE.Items/Config.cs @@ -12,5 +12,7 @@ public class Config : IConfig public bool IsEnabled { get; set; } = true; public bool Debug { get; set; } = true; public float RefreshRate { get; set; } = .01f; + public string SoundLocation { get; set; } = "C:\\Users\\Patrique\\AppData\\Roaming\\EXILED\\Plugins\\audio"; + public int Position { get; set; } = 300; } } diff --git a/KruacentExiled/KE.Items/Interface/IUse.cs b/KruacentExiled/KE.Items/Interface/IUse.cs new file mode 100644 index 00000000..51ea4f27 --- /dev/null +++ b/KruacentExiled/KE.Items/Interface/IUse.cs @@ -0,0 +1,14 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace KE.Items.Interface +{ + public interface IUse + { + + string HowToUseItemDesc { get; set; } + } +} diff --git a/KruacentExiled/KE.Items/ItemEffects/Scp1650Effect.cs b/KruacentExiled/KE.Items/ItemEffects/Scp1650Effect.cs new file mode 100644 index 00000000..4d726503 --- /dev/null +++ b/KruacentExiled/KE.Items/ItemEffects/Scp1650Effect.cs @@ -0,0 +1,103 @@ +using Exiled.API.Features; +using Exiled.Events.EventArgs.Map; +using Exiled.Events.EventArgs.Player; +using KE.Items.Interface; +using MEC; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using UnityEngine; +using static KE.Items.Items.Scp1650; + +namespace KE.Items.ItemEffects +{ + public class Scp1650Effect : CustomItemEffect + { + public enum CardinalPoints + { + South, + West, + North, + East, + } + + public override void Effect(UsedItemEventArgs ev) + { + OnUsedItem(ev.Player); + } + public override void Effect(DroppingItemEventArgs ev) + { + OnUsedItem(ev.Player); + } + + public override void Effect(ExplodingGrenadeEventArgs ev) + { + foreach (Player player in ev.TargetsToAffect) + { + OnUsedItem(player); + } + } + + + private void OnUsedItem(Player player) + { + + CardinalPoints rotation = Rotation(player.Rotation); + + Log.Debug(rotation); + switch (rotation) + { + + case CardinalPoints.South: + Timing.RunCoroutine(Regeneration(player, 10)); + break; + case CardinalPoints.West: + player.EnableEffect(Exiled.API.Enums.EffectType.BodyshotReduction, 25, 60); + break; + case CardinalPoints.North: + player.EnableEffect(Exiled.API.Enums.EffectType.Invigorated, 1, 30); + break; + case CardinalPoints.East: + player.EnableEffect(Exiled.API.Enums.EffectType.CardiacArrest, 1, 10); + break; + + } + + + } + + private IEnumerator Regeneration(Player p, float duration) + { + float timeWaited = duration; + + while (timeWaited > 0) + { + timeWaited -= .1f; + p.Heal(1); + yield return Timing.WaitForSeconds(.1f); + } + + + } + + private CardinalPoints Rotation(Quaternion rotation) + { + + Vector3 forward1 = rotation * Vector3.forward; + float x = forward1.x; + float z = forward1.z; + + if (z > .75f) + return CardinalPoints.South; + if (x > .75f) + return CardinalPoints.West; + if (z <= -.75f) + return CardinalPoints.North; + if (x <= -.75f) + return CardinalPoints.East; + return CardinalPoints.East; + } + } +} diff --git a/KruacentExiled/KE.Items/ItemEffects/TPGrenadaEffect.cs b/KruacentExiled/KE.Items/ItemEffects/TPGrenadaEffect.cs new file mode 100644 index 00000000..165f8ca2 --- /dev/null +++ b/KruacentExiled/KE.Items/ItemEffects/TPGrenadaEffect.cs @@ -0,0 +1,98 @@ +using Exiled.API.Enums; +using Exiled.API.Features; +using Exiled.API.Features.Pickups.Projectiles; +using Exiled.API.Features.Pools; +using Exiled.Events.EventArgs.Map; +using Exiled.Events.EventArgs.Player; +using KE.Items.Interface; +using PlayerRoles; +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using UnityEngine; + +namespace KE.Items.ItemEffects +{ + public class TPGrenadaEffect : CustomItemEffect + { + private List effectedPlayers = new List(); + [Description("What roles will not be able to be affected by Implosion Grenades. Keeping SCP-173 on this list is highly recommended.")] + public HashSet BlacklistedRoles { get; set; } = new HashSet() { RoleTypeId.Scp173, RoleTypeId.Scp106, RoleTypeId.Scp049, RoleTypeId.Scp096, RoleTypeId.Scp3114, RoleTypeId.Scp0492, RoleTypeId.Scp939 }; + + public override void Effect(UsedItemEventArgs ev) + { + OnExploding(new HashSet() { ev.Player }); + } + public override void Effect(DroppingItemEventArgs ev) + { + OnExploding(new HashSet() { ev.Player }); + } + + public override void Effect(ExplodingGrenadeEventArgs ev) + { + OnExploding(ev.TargetsToAffect,ev.Projectile); + } + + + + private void OnExploding(HashSet targets, EffectGrenadeProjectile projectile = null) + { + + effectedPlayers = ListPool.Pool.Get(); + foreach (Player player in targets) + { + if (BlacklistedRoles.Contains(player.Role)) + continue; + try + { + bool line; + if (projectile == null) + line = Physics.Linecast(projectile.Transform.position, player.Position); + else + line = true; + + if (line) + { + effectedPlayers.Add(player); + player.Teleport(RandomRoom()); + } + } + catch (Exception exception) + { + Log.Error($"{nameof(OnExploding)} error: {exception}"); + } + } + } + + + + private Room RandomRoom() + { + Room room = Room.Random(); + if (Warhead.IsDetonated) + { + return Room.Random(ZoneType.Surface); + } + + if (Map.IsLczDecontaminated) + { + float random = UnityEngine.Random.value; + Log.Debug($"random={random}"); + if (random <= 0.33f) + { + return Room.Random(ZoneType.HeavyContainment); + } + if (random > 0.33f && random <= 0.66f) + { + return Room.Random(ZoneType.Entrance); + } + return Room.Random(ZoneType.Surface); + } + Log.Debug($"roomZone={room.Zone}"); + return room; + } + } +} diff --git a/KruacentExiled/KE.Items/Items/Defibrilator.cs b/KruacentExiled/KE.Items/Items/Defibrilator.cs index a408a80c..d1c19b03 100644 --- a/KruacentExiled/KE.Items/Items/Defibrilator.cs +++ b/KruacentExiled/KE.Items/Items/Defibrilator.cs @@ -67,7 +67,7 @@ private void OnSpawningEvent(SpawnedEventArgs ev) { if (ev.Player.IsAlive) { - Log.Debug("Enlèvement du joueur"); + positionMort.TryRemove(ev.Player, out _); } } diff --git a/KruacentExiled/KE.Items/Items/DivinePills.cs b/KruacentExiled/KE.Items/Items/DivinePills.cs index a76a97e7..db1a17c9 100644 --- a/KruacentExiled/KE.Items/Items/DivinePills.cs +++ b/KruacentExiled/KE.Items/Items/DivinePills.cs @@ -22,10 +22,11 @@ using KE.Items.Upgrade; using Scp914; using System.Collections.ObjectModel; +using KE.Items; /// [CustomItem(ItemType.Painkillers)] -public class DivinePills : CustomItem, ILumosItem, ISwichableEffect, IUpgradableCustomItem +public class DivinePills : KECustomItem, ILumosItem, ISwichableEffect, IUpgradableCustomItem { /// public override uint Id { get; set; } = 1047; diff --git a/KruacentExiled/KE.Items/Items/Models/Model.cs b/KruacentExiled/KE.Items/Items/Models/Model.cs index da7c1b99..afdd1ce5 100644 --- a/KruacentExiled/KE.Items/Items/Models/Model.cs +++ b/KruacentExiled/KE.Items/Items/Models/Model.cs @@ -14,12 +14,26 @@ internal abstract class Model protected List Toys { get; set; } = new List { }; internal abstract void Spawn(Vector3 spawnPos, Quaternion rotation); - internal void UnSpawn() + internal void Destroy() { foreach (AdminToy primitive in Toys) { primitive.Destroy(); } } + internal void UnSpawn() + { + foreach (AdminToy primitive in Toys) + { + primitive.UnSpawn(); + } + } + internal void Spawn() + { + foreach (AdminToy primitive in Toys) + { + primitive.Spawn(); + } + } } } diff --git a/KruacentExiled/KE.Items/Items/SainteGrenada.cs b/KruacentExiled/KE.Items/Items/SainteGrenada.cs index 8b5a40f9..34f85af2 100644 --- a/KruacentExiled/KE.Items/Items/SainteGrenada.cs +++ b/KruacentExiled/KE.Items/Items/SainteGrenada.cs @@ -8,6 +8,7 @@ using Exiled.API.Features.Spawn; using Exiled.CustomItems.API.Features; using Exiled.Events.EventArgs.Map; +using Exiled.Events.EventArgs.Player; using KE.Items.Interface; using UnityEngine; @@ -20,7 +21,7 @@ public class SainteGrenada : CustomGrenade, ILumosItem public override string Name { get; set; } = "Sainte Grenada"; public override string Description { get; set; } = "Worms reference !?"; public override float Weight { get; set; } = 1.5f; - public override float FuseTime { get; set; } = 7.5f; + public override float FuseTime { get; set; } = 6f; public override bool ExplodeOnCollision { get; set; } = false; public float DamageModifier { get; set; } = 3f; public Color Color { get; set; } = Color.red; @@ -38,6 +39,10 @@ public class SainteGrenada : CustomGrenade, ILumosItem }; + protected override void OnThrownProjectile(ThrownProjectileEventArgs ev) + { + MainPlugin.Instance.Sound.PlayClip("worms", ev.Projectile.GameObject,4,75); + } protected override void OnExploding(ExplodingGrenadeEventArgs ev) { ev.Projectile.Scale = new Vector3(GrenadeSize, GrenadeSize, GrenadeSize); @@ -52,6 +57,8 @@ protected override void OnExploding(ExplodingGrenadeEventArgs ev) ExplosiveGrenade grenade = (ExplosiveGrenade)Item.Create(ItemType.GrenadeHE); grenade.SpawnActive(spawnPosition).FuseTime = 0f; } + + } } } diff --git a/KruacentExiled/KE.Items/Items/Scp1650.cs b/KruacentExiled/KE.Items/Items/Scp1650.cs index f91d94a5..97d3cbdf 100644 --- a/KruacentExiled/KE.Items/Items/Scp1650.cs +++ b/KruacentExiled/KE.Items/Items/Scp1650.cs @@ -3,6 +3,9 @@ using Exiled.API.Features.Spawn; using Exiled.CustomItems.API.Features; using Exiled.Events.EventArgs.Player; +using KE.Items.Interface; +using KE.Items.ItemEffects; +using MEC; using System; using System.Collections.Generic; using System.Linq; @@ -15,12 +18,14 @@ namespace KE.Items.Items { [CustomItem(ItemType.Painkillers)] - public class Scp1650 : CustomItem + public class Scp1650 : KECustomItem, ISwichableEffect { + public override uint Id { get; set; } = 1056; public override string Name { get; set; } = "SCP-1650"; public override string Description { get; set; } = "ויאמר ה' ל— סח השמן על בשרך ולך בינות ה— כששם אלוהים על שפתיך, וזעם ה' וחרון אפו ו— דם המכבים יטהר בית מקדשו אחריך, לנצח נצחים"; public override float Weight { get; set; } = 0.65f; + public CustomItemEffect Effect { get; set; } public override SpawnProperties SpawnProperties { get; set; } = new SpawnProperties() { @@ -35,6 +40,11 @@ public class Scp1650 : CustomItem } }; + public Scp1650() + { + Effect = new Scp1650Effect(); + } + protected override void SubscribeEvents() { PlayerHandle.UsedItem += OnUsedItem; @@ -43,52 +53,11 @@ protected override void UnsubscribeEvents() { PlayerHandle.UsedItem -= OnUsedItem; } + private void OnUsedItem(UsedItemEventArgs ev) { if (!Check(ev.Item)) return; - Player player = ev.Player; - Quaternion rotation = player.Rotation; - - switch (Rotation(rotation)) - { - case 1: - //give regen - Log.Debug("South"); - break; - case 2: - Log.Debug("West"); - player.EnableEffect(Exiled.API.Enums.EffectType.BodyshotReduction, 50, 60); - break; - case 3: - Log.Debug("North"); - player.EnableEffect(Exiled.API.Enums.EffectType.Invigorated, 1, 30); - break; - case 4: - Log.Debug("East"); - player.EnableEffect(Exiled.API.Enums.EffectType.CardiacArrest,1,10); - break; - - } - - - } - - private int Rotation(Quaternion rotation) - { - - Vector3 forward1 = rotation * Vector3.forward; - float x = forward1.x; - float z = forward1.z; - - if (z > .75f) - return 1; - if (x > .75f) - return 2; - if (z <= -.75f) - return 3; - if (x <= -.75f) - return 4; - return -1; + Effect.Effect(ev); } } } diff --git a/KruacentExiled/KE.Items/Items/Scp3136.cs b/KruacentExiled/KE.Items/Items/Scp3136.cs new file mode 100644 index 00000000..7ecb0ff0 --- /dev/null +++ b/KruacentExiled/KE.Items/Items/Scp3136.cs @@ -0,0 +1,91 @@ +using Exiled.API.Enums; +using Exiled.API.Features; +using Exiled.API.Features.Attributes; +using Exiled.API.Features.Items; +using Exiled.API.Features.Spawn; +using Exiled.CustomItems.API.Features; +using Exiled.Events.EventArgs.Player; +using Exiled.Events.EventArgs.Server; +using MEC; +using PlayerRoles; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using UnityEngine; + +namespace KE.Items.Items +{ + [CustomItem(ItemType.SCP1576)] + public class Scp3136 : CustomItem + { + public override uint Id { get; set; } = 1057; + public override string Name { get; set; } = "SCP-3136"; + public override string Description { get; set; } = "A map of the facility, you could draw your friends next to you"; + public override float Weight { get; set; } = 0.65f; + + private Dictionary _respawnPositions = new Dictionary + { + { Faction.FoundationStaff , Vector3.zero}, + { Faction.FoundationEnemy , Vector3.zero} + }; + + public override SpawnProperties SpawnProperties { get; set; } = new SpawnProperties() + { + Limit = 1, + LockerSpawnPoints = new List() + { + new LockerSpawnPoint() + { + Type = Exiled.API.Enums.LockerType.Scp1576Pedestal, + UseChamber = true, + Chance = .5f + } + } + }; + + protected override void SubscribeEvents() + { + Exiled.Events.Handlers.Player.UsedItem += OnDrawing; + Exiled.Events.Handlers.Server.RespawnedTeam += OnRespawnedTeam; + } + protected override void UnsubscribeEvents() + { + Exiled.Events.Handlers.Player.UsedItem -= OnDrawing; + Exiled.Events.Handlers.Server.RespawnedTeam -= OnRespawnedTeam; + } + + private void OnDrawing(UsedItemEventArgs ev) + { + if (!Check(ev.Item)) return; + switch (ev.Player.Role.Side) + { + case Side.Mtf: + _respawnPositions[Faction.FoundationStaff] = ev.Player.Position; + break; + case Side.ChaosInsurgency: + case Side.Tutorial: + _respawnPositions[Faction.FoundationEnemy] = ev.Player.Position; + break; + } + Timing.CallDelayed(1, () => ((Scp1576)ev.Item).StopTransmitting()); + + } + + private void OnRespawnedTeam(RespawnedTeamEventArgs ev) + { + Vector3 spawnPos = _respawnPositions[ev.Wave.TargetFaction]; + if (spawnPos == Vector3.zero) return; + + foreach (Player player in ev.Players) + { + player.Teleport(spawnPos); + _respawnPositions[ev.Wave.TargetFaction] = Vector3.zero; + } + } + + + + } +} diff --git a/KruacentExiled/KE.Items/Items/TPGrenada.cs b/KruacentExiled/KE.Items/Items/TPGrenada.cs index c6603932..dab60f57 100644 --- a/KruacentExiled/KE.Items/Items/TPGrenada.cs +++ b/KruacentExiled/KE.Items/Items/TPGrenada.cs @@ -10,26 +10,27 @@ using Exiled.CustomItems.API.Features; using Exiled.Events.EventArgs.Map; using KE.Items.Interface; +using KE.Items.ItemEffects; using PlayerRoles; using UnityEngine; namespace KE.Items.Items { [CustomItem(ItemType.GrenadeHE)] - public class TPGrenada : CustomGrenade, ILumosItem + public class TPGrenada : CustomGrenade, ILumosItem, ISwichableEffect { - private List effectedPlayers = new List(); + public override uint Id { get; set; } = 1045; public override string Name { get; set; } = "Teleportation Grenade"; public override string Description { get; set; } = "This grenade does 0 damage but teleport nearby players in a random place (does work in other dimension ;3 )"; public override float Weight { get; set; } = 0.65f; - public override float FuseTime { get; set; } = 1.5f; - public override bool ExplodeOnCollision { get; set; } = true; - public float DamageModifier { get; set; } = 0.05f; + public override float FuseTime { get; set; } = 3f; + public override bool ExplodeOnCollision { get; set; } = false; public UnityEngine.Color Color { get; set; } = UnityEngine.Color.cyan; + public CustomItemEffect Effect { get; set; } public override SpawnProperties SpawnProperties { get; set; } = new SpawnProperties() { - Limit = 5, + Limit = 3, DynamicSpawnPoints = new List { new DynamicSpawnPoint() @@ -56,69 +57,19 @@ public class TPGrenada : CustomGrenade, ILumosItem }; - [Description("What roles will not be able to be affected by Implosion Grenades. Keeping SCP-173 on this list is highly recommended.")] - public HashSet BlacklistedRoles { get; set; } = new HashSet() { RoleTypeId.Scp173, RoleTypeId.Scp106,RoleTypeId.Scp049, RoleTypeId.Scp096,RoleTypeId.Scp3114,RoleTypeId.Scp0492,RoleTypeId.Scp939 }; + public TPGrenada() + { + Effect = new TPGrenadaEffect(); + } protected override void OnExploding(ExplodingGrenadeEventArgs ev) { - ev.IsAllowed = false; - List copiedList = new List(); - foreach (Player player in ev.TargetsToAffect) - { - copiedList.Add(player); - } - + + Effect.Effect(ev); ev.TargetsToAffect.Clear(); - - effectedPlayers = ListPool.Pool.Get(); - foreach (Player player in copiedList) - { - if (BlacklistedRoles.Contains(player.Role)) - continue; - try - { - - bool line = Physics.Linecast(ev.Projectile.Transform.position, player.Position); - if (line) - { - effectedPlayers.Add(player); - player.Teleport(RandomRoom()); - } - } - catch (Exception exception) - { - Log.Error($"{nameof(OnExploding)} error: {exception}"); - } - } } - - private Room RandomRoom() - { - Room room = Room.Random(); - if (Warhead.IsDetonated) - { - return Room.Random(ZoneType.Surface); - } - - if(Map.IsLczDecontaminated) - { - float random = UnityEngine.Random.value; - Log.Debug($"random={random}"); - if (random <= 0.33f) - { - return Room.Random(ZoneType.HeavyContainment); - } - if(random > 0.33f && random <= 0.66f) - { - return Room.Random(ZoneType.Entrance); - } - return Room.Random(ZoneType.Surface); - } - Log.Debug($"roomZone={room.Zone}"); - return room; - } } } diff --git a/KruacentExiled/KE.Items/KE.Items.csproj b/KruacentExiled/KE.Items/KE.Items.csproj index 9ceba020..cf640884 100644 --- a/KruacentExiled/KE.Items/KE.Items.csproj +++ b/KruacentExiled/KE.Items/KE.Items.csproj @@ -5,7 +5,7 @@ - + diff --git a/KruacentExiled/KE.Items/KECustomItem.cs b/KruacentExiled/KE.Items/KECustomItem.cs new file mode 100644 index 00000000..daf81219 --- /dev/null +++ b/KruacentExiled/KE.Items/KECustomItem.cs @@ -0,0 +1,53 @@ +using Exiled.API.Features; +using Exiled.API.Features.Items; +using Exiled.CustomItems; +using Exiled.CustomItems.API.Features; +using KE.Items.Interface; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace KE.Items +{ + public abstract class KECustomItem : CustomItem + { + + protected override void ShowPickedUpMessage(Player player) + { + if (CustomItems.Instance.Config.PickedUpHint.Show) + { + string show = string.Format(CustomItems.Instance.Config.PickedUpHint.Content, Name, Description) + "\n"; + if (this is IUpgradableCustomItem ci) + { + foreach(var a in ci.Upgrade) + { + show += $"{a.Value.Chance}% chance of upgrading on {a.Key}\n"; + } + } + + player.ShowHint(show, (int)CustomItems.Instance.Config.PickedUpHint.Duration); + + } + } + + protected override void ShowSelectedMessage(Player player) + { + if (CustomItems.Instance.Config.PickedUpHint.Show) + { + string show = string.Format(CustomItems.Instance.Config.PickedUpHint.Content, Name, Description) + "\n"; + if (this is IUpgradableCustomItem ci) + { + foreach (var a in ci.Upgrade) + { + show += $"{a.Value.Chance}% chance of upgrading on {a.Key}\n"; + } + } + + player.ShowHint(show, (int)CustomItems.Instance.Config.PickedUpHint.Duration); + + } + } + } +} diff --git a/KruacentExiled/KE.Items/Lights/LightsHandler.cs b/KruacentExiled/KE.Items/Lights/LightsHandler.cs index ddc0ada0..fe538e19 100644 --- a/KruacentExiled/KE.Items/Lights/LightsHandler.cs +++ b/KruacentExiled/KE.Items/Lights/LightsHandler.cs @@ -52,9 +52,7 @@ private void DestroyPickup(ItemPickupBase pickup) if (pl.ContainsKey(pickup)) { - Log.Debug(pickup.ToString()); Light val = pl[pickup]; - Log.Debug(val); val?.Destroy(); pl.Remove(pickup); } diff --git a/KruacentExiled/KE.Items/MainPlugin.cs b/KruacentExiled/KE.Items/MainPlugin.cs index 33579634..7cdf4877 100644 --- a/KruacentExiled/KE.Items/MainPlugin.cs +++ b/KruacentExiled/KE.Items/MainPlugin.cs @@ -32,6 +32,8 @@ public override void OnEnabled() UpgradeHandler = new UpgradeHandler(); LightsHandler = new LightsHandler(); + Sound.LoadClips(); + CustomItem.RegisterItems(); UpgradeHandler.SubscribeEvents(); LightsHandler.SubscribeEvents(); diff --git a/KruacentExiled/KE.Items/Sound.cs b/KruacentExiled/KE.Items/Sound.cs index 37cc714f..a15035b5 100644 --- a/KruacentExiled/KE.Items/Sound.cs +++ b/KruacentExiled/KE.Items/Sound.cs @@ -1,14 +1,20 @@  +using Exiled.API.Features; +using System.Collections.Generic; +using UnityEngine; + namespace KE.Items { internal class Sound { private AudioPlayer audioPlayer; + private Dictionary _soundName = new Dictionary(); public Sound() { - + _soundName.Add("lego.ogg", "build"); + _soundName.Add("worms.ogg", "worms"); } ~Sound() @@ -18,20 +24,48 @@ public Sound() public void LoadClips() { - AudioClipStorage.LoadClip("C:\\Users\\Patrique\\AppData\\Roaming\\EXILED\\Plugins\\audio\\lego.ogg", "build"); + foreach (var s in _soundName) + { + Log.Info($"Loading clip ({s.Value}) at {MainPlugin.Instance.Config.SoundLocation}\\{s.Key} "); + AudioClipStorage.LoadClip($"{MainPlugin.Instance.Config.SoundLocation}\\{s.Key}", s.Value); + } } - internal void PlayClip(string clipName, UnityEngine.Vector3 pos) + internal void PlayClip(string clipName, UnityEngine.Vector3 pos, float volume =1f, float maxDistance = 20f) { - audioPlayer = AudioPlayer.CreateOrGet($"Global AudioPlayer", onIntialCreation: (p) => + Log.Debug($"playing {clipName} at {pos}"); + audioPlayer = AudioPlayer.CreateOrGet($"{clipName} ({pos})", onIntialCreation: (p) => { - Speaker speaker = p.AddSpeaker("Main", isSpatial: true, maxDistance: 20f, minDistance: 5f); - speaker.transform.localPosition = pos; + GameObject a = new GameObject(); + a.transform.position = pos; + p.transform.parent = a.transform; + Speaker speaker = p.AddSpeaker("Main", isSpatial: true, maxDistance: maxDistance, minDistance: 5f); + speaker.transform.parent = a.transform; + speaker.transform.localPosition = Vector3.zero; }); - audioPlayer.AddClip(clipName, volume:1); + audioPlayer.AddClip(clipName, volume:volume); } + + + internal void PlayClip(string clipName, GameObject objectEmittingSound, float volume = 1f,float maxDistance = 20f) + { + Log.Debug($"playing {clipName} at {objectEmittingSound}"); + audioPlayer = AudioPlayer.CreateOrGet($"{clipName} ({objectEmittingSound})", onIntialCreation: (p) => + { + + p.transform.parent = objectEmittingSound.transform; + Speaker speaker = p.AddSpeaker("Main", isSpatial: true, maxDistance: maxDistance, minDistance: 5f); + speaker.transform.parent = objectEmittingSound.transform; + speaker.transform.localPosition = Vector3.zero; + }); + + audioPlayer.AddClip(clipName, volume: volume); + } + + + } } From 27750bdcc01ce17937cccee5f17ed0163940eb91 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Sun, 9 Mar 2025 13:11:43 +0100 Subject: [PATCH 199/853] Remade Blackout N' Door --- .../API/Features/Controller.cs | 231 ++++++------------ .../API/Features/RoundEffects/Blackout.cs | 39 +++ .../API/Features/RoundEffects/DoorStuck.cs | 46 ++++ .../API/Features/RoundEffects/RoundEffect.cs | 51 ++++ KruacentExiled/KE.BlackoutNDoor/Config.cs | 4 - .../RoundEffect/PostRoundEffectEventArgs.cs | 26 ++ .../RoundEffect/PreRoundEffectEventArgs.cs | 28 +++ .../Events/Handlers/RoundEffect.cs | 40 +++ .../Events/Interface/IZoneEvent.cs | 16 ++ .../Handlers/ServerHandler.cs | 56 +---- .../KE.BlackoutNDoor/KE.BlackoutNDoor.csproj | 21 +- KruacentExiled/KE.BlackoutNDoor/MainPlugin.cs | 5 +- .../Translation/Translation.cs | 15 ++ .../KE.Utils/API/Features/ZoneProperties.cs | 44 ++++ .../KE.Utils/Extensions/AdminToyExtension.cs | 38 +++ .../KE.Utils/Extensions/DoorExtension.cs | 14 ++ .../Extensions/RoomExtensions.cs | 5 + KruacentExiled/KE.Utils/KE.Utils.csproj | 36 +++ .../KE.Utils/Tests/PrimitiveTest.cs | 32 +++ KruacentExiled/KruacentExiled.sln | 6 + 20 files changed, 533 insertions(+), 220 deletions(-) create mode 100644 KruacentExiled/KE.BlackoutNDoor/API/Features/RoundEffects/Blackout.cs create mode 100644 KruacentExiled/KE.BlackoutNDoor/API/Features/RoundEffects/DoorStuck.cs create mode 100644 KruacentExiled/KE.BlackoutNDoor/API/Features/RoundEffects/RoundEffect.cs create mode 100644 KruacentExiled/KE.BlackoutNDoor/Events/EventArgs/RoundEffect/PostRoundEffectEventArgs.cs create mode 100644 KruacentExiled/KE.BlackoutNDoor/Events/EventArgs/RoundEffect/PreRoundEffectEventArgs.cs create mode 100644 KruacentExiled/KE.BlackoutNDoor/Events/Handlers/RoundEffect.cs create mode 100644 KruacentExiled/KE.BlackoutNDoor/Events/Interface/IZoneEvent.cs create mode 100644 KruacentExiled/KE.BlackoutNDoor/Translation/Translation.cs create mode 100644 KruacentExiled/KE.Utils/API/Features/ZoneProperties.cs create mode 100644 KruacentExiled/KE.Utils/Extensions/AdminToyExtension.cs create mode 100644 KruacentExiled/KE.Utils/Extensions/DoorExtension.cs rename KruacentExiled/{KE.BlackoutNDoor => KE.Utils}/Extensions/RoomExtensions.cs (95%) create mode 100644 KruacentExiled/KE.Utils/KE.Utils.csproj create mode 100644 KruacentExiled/KE.Utils/Tests/PrimitiveTest.cs diff --git a/KruacentExiled/KE.BlackoutNDoor/API/Features/Controller.cs b/KruacentExiled/KE.BlackoutNDoor/API/Features/Controller.cs index 387d1a6a..d389c9ec 100644 --- a/KruacentExiled/KE.BlackoutNDoor/API/Features/Controller.cs +++ b/KruacentExiled/KE.BlackoutNDoor/API/Features/Controller.cs @@ -1,192 +1,107 @@ using Exiled.API.Enums; +using Exiled.API.Extensions; using Exiled.API.Features; using Exiled.API.Features.Doors; +using KE.BlackoutNDoor.API.Features.RoundEffects; +using KE.BlackoutNDoor.Events.EventArgs.RoundEffect; using MEC; -using System; using System.Collections.Generic; using System.Linq; +using UnityEngine; +using Waits; +using YamlDotNet.Core.Events; namespace KE.BlackoutNDoor.API.Features { + public class Controller - { - private DoorType[] BlacklistedDoor = { DoorType.ElevatorGateA, DoorType.ElevatorGateB, DoorType.ElevatorLczA, DoorType.ElevatorLczB, DoorType.ElevatorNuke, DoorType.ElevatorScp049, DoorType.UnknownElevator }; - - /// - /// Select a random zone and close and lock all door of the zone - /// - internal IEnumerator RandomDoorStuck() - { - yield return Timing.WaitUntilTrue(() => Round.IsStarted); - var zone = SelectZone(); - Log.Debug($"DoorStuck in {zone}"); - yield return Timing.WaitUntilFalse(() => Cassie.IsSpeaking); - CassieVoiceLine(zone, false); - yield return Timing.WaitUntilFalse(() => Cassie.IsSpeaking); - yield return Timing.WaitForSeconds(MainPlugin.Instance.Config.DurationMalfunction); - // if the zone is light and there is only 30s left then skip - if (!(zone == ZoneType.LightContainment && Map.DecontaminationState == DecontaminationState.Countdown && Warhead.IsInProgress)) - { - List doorList = Door.List - .Where(d => !BlacklistedDoor.Contains(d.Type)) - .ToList(); - var ge = Generator.List.Where(g => g.IsEngaged); - if(ge.ToList().Count != 3) - { - doorList = Door.List - .Where(d => !BlacklistedDoor.Union(new[] { DoorType.Scp079First, DoorType.Scp079Second }).Contains(d.Type)) - .ToList(); - } - foreach (Door door in doorList) - { - - if (door.Zone == zone) - { - door.IsOpen = false; - door.ChangeLock(DoorLockType.Lockdown2176); - Timing.CallDelayed(MainPlugin.Instance.Config.DurationMalfunction / 2, () => door.IsOpen = true); - Timing.CallDelayed(MainPlugin.Instance.Config.DurationMalfunction, () => door.Unlock()); - if (UnityEngine.Random.value < .5f) - { - door.IsOpen = false; - } - } - } - } - } + { - /// - /// Select a random zone and blackout it - /// - public IEnumerator RandomBlackout() - { - yield return Timing.WaitUntilTrue(() => Round.IsStarted); - - var zone = SelectZone(); - yield return Timing.WaitUntilFalse(() => Cassie.IsSpeaking); - CassieVoiceLine(zone, true); - yield return Timing.WaitUntilFalse(() => Cassie.IsSpeaking); - yield return Timing.WaitForSeconds(MainPlugin.Instance.Config.DurationMalfunction); - Log.Debug($"BlackOut in {zone}"); - + private HashSet RoundEffects = []; - Map.TurnOffAllLights(MainPlugin.Instance.Config.DurationMalfunction, zone); + public Controller() + { + RoundEffects.Add(new Blackout()); + RoundEffects.Add(new DoorStuck()); } + - private void CassieVoiceLine(ZoneType zone,bool isBlackout) + public IEnumerator Update() { - if (isBlackout) - { - switch (zone) - { - case ZoneType.LightContainment: - Cassie.MessageTranslated("Warning Failure Of All Lights In Light Containment Zone in 5 seconds", - "Warning Failure Of All Lights In Light Containment Zone in 5 seconds", false, false); - break; - case ZoneType.HeavyContainment: - Cassie.MessageTranslated("Warning Failure Of All Lights In Heavy Containment Zone in 5 seconds", - "Warning Failure Of All Lights In Heavy Containment Zone in 5 seconds", false, false); - break; - case ZoneType.Entrance: - Cassie.MessageTranslated("Warning Failure Of All Lights In Entrance Zone in 5 seconds", - "Warning Failure Of All Lights In Entrance Zone in 5 seconds", false, false); - break ; - case ZoneType.Surface: - Cassie.MessageTranslated("Warning Failure Of All Lights In Surface in 5 seconds", - "Warning Failure Of All Lights In Surface in 5 seconds", false, false); - break ; - case ZoneType.Unspecified: - Cassie.MessageTranslated("Warning Failure Of All Lights In All Of The Facility in 5 seconds", - "Warning Failure Of All Lights In All Of The Facility in 5 seconds", false, false); - break; - } - } - else + int wait = UnityEngine.Random.Range(MainPlugin.Instance.Config.MinInterval, MainPlugin.Instance.Config.MaxInterval); + if (MainPlugin.Instance.Config.Debug) wait = 20; + + + do { - switch (zone) + if (Warhead.IsInProgress) continue; + + RoundEffect roundEffect = SelectRoundEffect(); + var zone = roundEffect.SelectZone(); + Log.Debug("zone="+zone); + Log.Debug($"waiting : {wait}"); + yield return Timing.WaitForSeconds(wait); + PreRoundEffectEventArgs args = new(zone, roundEffect); + Events.Handlers.RoundEffect.OnPreRoundEffect(args); + if (args.IsAllowed) { - case ZoneType.LightContainment: - Cassie.MessageTranslated("Door system malfunction in Light Containment Zone in 5 seconds", - "Door system malfunction in Light containment zone in 5 seconds", false,false); - break; - case ZoneType.HeavyContainment: - Cassie.MessageTranslated("Door system malfunction in Heavy Containment Zone in 5 seconds", - "Door system malfunction in Heavy zone in 5 seconds", false, false); - break; - case ZoneType.Entrance: - Cassie.MessageTranslated("Door system malfunction in Entrance zone in 5 seconds", - "Door system malfunction in Entrance zone in 5 seconds", false, false); - break; - case ZoneType.Surface: - Cassie.MessageTranslated("Door system malfunction in Surface Zone in 5 seconds", - "Door system malfunction in Surface zone in 5 seconds", false, false); - break; - case ZoneType.Unspecified: - Cassie.MessageTranslated("Door system malfunction in All of the facility in 5 seconds", - "Door system malfunction in All of the facility in 5 seconds", false, false); - break; + var timeyapping = CassieVoiceLine(zone, roundEffect); + yield return Timing.WaitForSeconds(5+ timeyapping); + roundEffect.Effect(zone); + yield return Timing.WaitForSeconds(MainPlugin.Instance.Config.DurationMalfunction); + roundEffect.StopEffect(zone); + Events.Handlers.RoundEffect.OnPostRoundEffect(new(zone, roundEffect)); } - } + + } while (Round.InProgress); + + } - /// - /// Select a random zone - /// If the nuke is detonated return only SurfaceZone - /// - /// a zone - private ZoneType SelectZone() + private RoundEffect SelectRoundEffect() { - ZoneType z = ZoneType.Unspecified; - float random = UnityEngine.Random.value; - if (Warhead.IsDetonated) - { - z= ZoneType.Surface; - } - if (!Map.IsLczDecontaminated) - { - z= GetZoneType(GetProbabilityIndex(MainPlugin.Instance.Config.ChancePreConta, random)); - } - else - { - z= GetZoneType(GetProbabilityIndex(MainPlugin.Instance.Config.ChancePostConta, random)); - } - Log.Debug($"zone={z}"); - return z; + return RoundEffects.GetRandomValue(); } - private int GetProbabilityIndex(float[] probabilities, float randomValue) + private float CassieVoiceLine(ZoneType zone,RoundEffect round) { - float cumulative = 0f; + string nameEvent = round.EventTranslation; + string msg = $"Warning {nameEvent} in {GetZoneName(zone)} in 5 seconds"; + string colorzone = GetZoneColor(zone).ToHex(); + string msgTranslated = $"Warning {nameEvent} In {GetZoneName(zone)} in 5 seconds"; - for (int i = 0; i < probabilities.Length; i++) - { - cumulative += probabilities[i]; - if (randomValue <= cumulative) - { - return i; - } - } + Cassie.MessageTranslated(msg, msgTranslated, true, false, true); + return Cassie.CalculateDuration(msg); + + } - throw new ArgumentException("Random value is outside the range of probabilities."); + private Color GetZoneColor(ZoneType zone) + { + return zone switch + { + ZoneType.LightContainment => new Color(0.1058f, 0.7333f, 0.6078f), + ZoneType.HeavyContainment => new Color(0.2627f, 0.0980f, 0.0980f), + ZoneType.Entrance => new Color(1, 1, 0), + _ => new Color(1, 0, 0) + }; } - private ZoneType GetZoneType(int index) + + private string GetZoneName(ZoneType zone) { - switch (index) + return zone switch { - case 0: - return ZoneType.LightContainment; - case 1: - return ZoneType.HeavyContainment; - case 2: - return ZoneType.Entrance; - case 3: - return ZoneType.Surface; - default: - case 4: - return ZoneType.Unspecified; - } + ZoneType.LightContainment => "Light Containment Zone", + ZoneType.HeavyContainment => "Heavy Containment Zone", + ZoneType.Entrance => "Entrance Zone", + ZoneType.Surface => "Surface", + ZoneType.Unspecified => "All of the facility", + _ => "somewhere" + }; } + + + } } diff --git a/KruacentExiled/KE.BlackoutNDoor/API/Features/RoundEffects/Blackout.cs b/KruacentExiled/KE.BlackoutNDoor/API/Features/RoundEffects/Blackout.cs new file mode 100644 index 00000000..cdc1f19b --- /dev/null +++ b/KruacentExiled/KE.BlackoutNDoor/API/Features/RoundEffects/Blackout.cs @@ -0,0 +1,39 @@ +using Exiled.API.Enums; +using Exiled.API.Features; +using System.Collections.Generic; + +namespace KE.BlackoutNDoor.API.Features.RoundEffects +{ + public class Blackout : RoundEffect + { + + public Blackout() + { + base.EventTranslation = "Failure Of All Lights"; + base.Chances = new Dictionary() + { + { ZoneType.LightContainment, 33 }, + { ZoneType.HeavyContainment, 33 }, + { ZoneType.Entrance, 34 }, + }; + } + + + public override void Effect(ZoneType zone) + { + Map.TurnOffAllLights(999, zone); + } + + public override void StopEffect(ZoneType zone) + { + Map.TurnOffAllLights(0f, zone); + } + + + + + } + + + +} diff --git a/KruacentExiled/KE.BlackoutNDoor/API/Features/RoundEffects/DoorStuck.cs b/KruacentExiled/KE.BlackoutNDoor/API/Features/RoundEffects/DoorStuck.cs new file mode 100644 index 00000000..bed148bf --- /dev/null +++ b/KruacentExiled/KE.BlackoutNDoor/API/Features/RoundEffects/DoorStuck.cs @@ -0,0 +1,46 @@ +using Exiled.API.Enums; +using Exiled.API.Features; +using Exiled.API.Features.Doors; +using MEC; +using System.Collections.Generic; +using System.Linq; + +namespace KE.BlackoutNDoor.API.Features.RoundEffects +{ + public class DoorStuck : RoundEffect + { + public DoorStuck() + { + base.EventTranslation = "Door system malfunction "; + base.Chances = new Dictionary() + { + { ZoneType.LightContainment, 20 }, + { ZoneType.HeavyContainment, 10 }, + { ZoneType.Entrance, 70 }, + }; + } + + + public override void Effect(ZoneType zone) + { + bool openAfter = UnityEngine.Random.value < .5f; + if (zone == ZoneType.LightContainment && Map.DecontaminationState >= DecontaminationState.Countdown) return; + foreach(Door door in Door.List.Where(d => !d.IsElevator && d.Zone == zone)) + { + if (!door.AllowsScp106 && Generator.List.Where(g => g.IsEngaged).ToList().Count != 3) continue; + door.IsOpen = false; + door.ChangeLock(DoorLockType.Lockdown2176); + Timing.CallDelayed(MainPlugin.Instance.Config.DurationMalfunction / 2, () => door.IsOpen = true); + Timing.CallDelayed(MainPlugin.Instance.Config.DurationMalfunction, () => door.Unlock()); + door.IsOpen = openAfter; + } + + } + + public override void StopEffect(ZoneType zone) + { + + } + + } +} diff --git a/KruacentExiled/KE.BlackoutNDoor/API/Features/RoundEffects/RoundEffect.cs b/KruacentExiled/KE.BlackoutNDoor/API/Features/RoundEffects/RoundEffect.cs new file mode 100644 index 00000000..b004b2b5 --- /dev/null +++ b/KruacentExiled/KE.BlackoutNDoor/API/Features/RoundEffects/RoundEffect.cs @@ -0,0 +1,51 @@ +using Exiled.API.Enums; +using Exiled.API.Features; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using UnityEngine; + +namespace KE.BlackoutNDoor.API.Features.RoundEffects +{ + public abstract class RoundEffect + { + /// + /// How Cassie will announce the message + /// + public string EventTranslation { get; protected set; } + public IReadOnlyDictionary Chances { get; protected set; } + public abstract void Effect(ZoneType zone); + public abstract void StopEffect(ZoneType zone); + + + internal ZoneType SelectZone() + { + int totalWeight = 0; + foreach (var weight in Chances.Values) + { + totalWeight += weight; + } + + if (totalWeight == 0) + { + Log.Error("Total probability must be greater than zero."); + return ZoneType.Unspecified; + } + + int randValue = UnityEngine.Random.Range(0, totalWeight); + int cumulativeSum = 0; + + foreach (var entry in Chances) + { + cumulativeSum += entry.Value; + if (randValue < cumulativeSum) + return entry.Key; + } + + Log.Error("Zone selection failed"); + return ZoneType.Unspecified; + } + } +} diff --git a/KruacentExiled/KE.BlackoutNDoor/Config.cs b/KruacentExiled/KE.BlackoutNDoor/Config.cs index 0deae7a6..bd86be91 100644 --- a/KruacentExiled/KE.BlackoutNDoor/Config.cs +++ b/KruacentExiled/KE.BlackoutNDoor/Config.cs @@ -21,9 +21,5 @@ public class Config : IConfig public double InitialChanceBO { get; set; } = 0.5; [Description("the duration of a malfunction")] public int DurationMalfunction { get; set; } = 30; - [Description("chance before decontamination")] - public float[] ChancePreConta = { .2f, .3f, .3f, .15f, .05f }; - [Description("chance after decontamination")] - public float[] ChancePostConta = { 0, .4f, .4f, .15f, .05f }; } } diff --git a/KruacentExiled/KE.BlackoutNDoor/Events/EventArgs/RoundEffect/PostRoundEffectEventArgs.cs b/KruacentExiled/KE.BlackoutNDoor/Events/EventArgs/RoundEffect/PostRoundEffectEventArgs.cs new file mode 100644 index 00000000..ba4e5cd4 --- /dev/null +++ b/KruacentExiled/KE.BlackoutNDoor/Events/EventArgs/RoundEffect/PostRoundEffectEventArgs.cs @@ -0,0 +1,26 @@ +using Exiled.API.Enums; +using Exiled.Events.EventArgs.Interfaces; +using KE.BlackoutNDoor.API.Features.RoundEffects; +using KE.BlackoutNDoor.Events.Interface; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using RoundE = KE.BlackoutNDoor.API.Features.RoundEffects.RoundEffect; + +namespace KE.BlackoutNDoor.Events.EventArgs.RoundEffect +{ + public class PostRoundEffectEventArgs : IExiledEvent, IZoneEvent + { + public ZoneType Zone { get; } + public RoundE RoundEffect { get; set; } + + + public PostRoundEffectEventArgs(ZoneType zone, RoundE roundEffect) + { + Zone = zone; + RoundEffect = roundEffect; + } + } +} diff --git a/KruacentExiled/KE.BlackoutNDoor/Events/EventArgs/RoundEffect/PreRoundEffectEventArgs.cs b/KruacentExiled/KE.BlackoutNDoor/Events/EventArgs/RoundEffect/PreRoundEffectEventArgs.cs new file mode 100644 index 00000000..967627a6 --- /dev/null +++ b/KruacentExiled/KE.BlackoutNDoor/Events/EventArgs/RoundEffect/PreRoundEffectEventArgs.cs @@ -0,0 +1,28 @@ +using Exiled.API.Enums; +using Exiled.Events.EventArgs.Interfaces; +using KE.BlackoutNDoor.API.Features.RoundEffects; +using KE.BlackoutNDoor.Events.Interface; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using RoundE = KE.BlackoutNDoor.API.Features.RoundEffects.RoundEffect; + +namespace KE.BlackoutNDoor.Events.EventArgs.RoundEffect +{ + public class PreRoundEffectEventArgs : IExiledEvent, IDeniableEvent, IZoneEvent + { + public bool IsAllowed { get; set; } + public ZoneType Zone { get; } + public RoundE RoundEffect { get; set; } + + + public PreRoundEffectEventArgs(ZoneType zone, RoundE roundEffect, bool isAllowed = true) + { + Zone = zone; + RoundEffect = roundEffect; + IsAllowed = isAllowed; + } + } +} diff --git a/KruacentExiled/KE.BlackoutNDoor/Events/Handlers/RoundEffect.cs b/KruacentExiled/KE.BlackoutNDoor/Events/Handlers/RoundEffect.cs new file mode 100644 index 00000000..a3e75d61 --- /dev/null +++ b/KruacentExiled/KE.BlackoutNDoor/Events/Handlers/RoundEffect.cs @@ -0,0 +1,40 @@ +using Exiled.Events.Features; +using KE.BlackoutNDoor.Events.EventArgs.RoundEffect; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace KE.BlackoutNDoor.Events.Handlers +{ + public static class RoundEffect + { + /// + /// Invoked before a occurr + /// + public static Event PreRoundEffect = new(); + /// + /// Invoked after a occurr + /// + public static Event PostRoundEffect = new(); + + + /// + /// Called before a occurr + /// + /// + public static void OnPreRoundEffect(PreRoundEffectEventArgs ev) + { + PreRoundEffect.InvokeSafely(ev); + } + /// + /// Called after a occurr + /// + /// + public static void OnPostRoundEffect(PostRoundEffectEventArgs ev) + { + PostRoundEffect.InvokeSafely(ev); + } + } +} diff --git a/KruacentExiled/KE.BlackoutNDoor/Events/Interface/IZoneEvent.cs b/KruacentExiled/KE.BlackoutNDoor/Events/Interface/IZoneEvent.cs new file mode 100644 index 00000000..44809ea1 --- /dev/null +++ b/KruacentExiled/KE.BlackoutNDoor/Events/Interface/IZoneEvent.cs @@ -0,0 +1,16 @@ +using Exiled.API.Enums; +using Exiled.Events.EventArgs.Interfaces; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace KE.BlackoutNDoor.Events.Interface +{ + internal interface IZoneEvent : IExiledEvent + { + + public ZoneType Zone { get; } + } +} diff --git a/KruacentExiled/KE.BlackoutNDoor/Handlers/ServerHandler.cs b/KruacentExiled/KE.BlackoutNDoor/Handlers/ServerHandler.cs index 5ecdd79b..d7496284 100644 --- a/KruacentExiled/KE.BlackoutNDoor/Handlers/ServerHandler.cs +++ b/KruacentExiled/KE.BlackoutNDoor/Handlers/ServerHandler.cs @@ -1,71 +1,23 @@ using KE.BlackoutNDoor.API.Features; using Exiled.API.Features; -using Exiled.Events.EventArgs.Server; using MEC; -using PluginAPI.Events; using System.Collections.Generic; +using System; namespace KE.BlackoutNDoor.Handlers { public class ServerHandler { - public int Cooldown { get; set; } = -1 ; + [Obsolete()] + public int Cooldown { get; set; } internal double ChanceBO { get; set; } = MainPlugin.Instance.Config.InitialChanceBO; - private readonly Controller Controller; private static CoroutineHandle Handle; - internal ServerHandler(Controller con) - { - Controller = con; - } internal void OnRoundStarted() { Log.Debug($"handle = {Handle}"); Timing.KillCoroutines(Handle); - Handle = Timing.RunCoroutine(Update()); + Handle = Timing.RunCoroutine(MainPlugin.Instance.Controller.Update()); } - - - private IEnumerator Update() - { - yield return Timing.WaitUntilTrue(() => Round.InProgress); - Log.Debug("startUpdate"); - int wait; - if (Cooldown == -1) - wait = UnityEngine.Random.Range(MainPlugin.Instance.Config.MinInterval, MainPlugin.Instance.Config.MaxInterval); - else - wait = Cooldown; - Log.Debug($"waiting for {wait}"); - yield return Timing.WaitForSeconds(wait); - while (Round.InProgress) - { - var a = UnityEngine.Random.value; - Log.Debug("random =" + a); - if (Round.InProgress) - { - if (a <= ChanceBO) - { - Log.Debug("BlackOut"); - - CoroutineHandle coroutine = Timing.RunCoroutine(Controller.RandomBlackout()); - yield return Timing.WaitUntilDone(coroutine); - } - else - { - Log.Debug("DoorStuck"); - CoroutineHandle coroutine = Timing.RunCoroutine(Controller.RandomDoorStuck()); - yield return Timing.WaitUntilDone(coroutine); - } - } - wait = UnityEngine.Random.Range(MainPlugin.Instance.Config.MinInterval, MainPlugin.Instance.Config.MaxInterval); - Log.Debug($"waiting : {wait}"); - yield return Timing.WaitForSeconds(wait); - yield return Timing.WaitUntilFalse(() => Warhead.IsInProgress); - - ChanceBO = -(1 / 60) * Round.ElapsedTime.TotalMinutes + 0.5; - Log.Debug($"new ChanceBO = {ChanceBO}"); - } - } - } } diff --git a/KruacentExiled/KE.BlackoutNDoor/KE.BlackoutNDoor.csproj b/KruacentExiled/KE.BlackoutNDoor/KE.BlackoutNDoor.csproj index 83006a05..5d972f3c 100644 --- a/KruacentExiled/KE.BlackoutNDoor/KE.BlackoutNDoor.csproj +++ b/KruacentExiled/KE.BlackoutNDoor/KE.BlackoutNDoor.csproj @@ -1,17 +1,30 @@  + 13.0 net48 + true - + - - - + + + + + + + + + if not "$(EXILED_DEV_REFERENCES)"=="" copy /y "$(OutputPath)$(AssemblyName).dll" "$(EXILED_DEV_REFERENCES)\Plugins\" + + + if [[ ! -z "$EXILED_DEV_REFERENCES" ]]; then cp "$(OutputPath)$(AssemblyName).dll" "$EXILED_DEV_REFERENCES/Plugins/"; fi + + diff --git a/KruacentExiled/KE.BlackoutNDoor/MainPlugin.cs b/KruacentExiled/KE.BlackoutNDoor/MainPlugin.cs index 19085cd5..963ba9c2 100644 --- a/KruacentExiled/KE.BlackoutNDoor/MainPlugin.cs +++ b/KruacentExiled/KE.BlackoutNDoor/MainPlugin.cs @@ -13,7 +13,8 @@ public class MainPlugin : Plugin public override Version Version => new Version(1,0,0); public override string Name => "KE.BlackoutDoor"; internal static MainPlugin Instance; - private Controller Controller; + internal Controller Controller { get; private set; } + public ServerHandler ServerHandler { get; private set; } public override void OnEnabled() @@ -32,7 +33,7 @@ public override void OnDisabled() private void RegisterEvent() { - ServerHandler = new ServerHandler(Controller); + ServerHandler = new ServerHandler(); Server.RoundStarted += ServerHandler.OnRoundStarted; } diff --git a/KruacentExiled/KE.BlackoutNDoor/Translation/Translation.cs b/KruacentExiled/KE.BlackoutNDoor/Translation/Translation.cs new file mode 100644 index 00000000..3976823b --- /dev/null +++ b/KruacentExiled/KE.BlackoutNDoor/Translation/Translation.cs @@ -0,0 +1,15 @@ +using Exiled.API.Interfaces; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace KE.BlackoutNDoor.Translation +{ + public class Translation : ITranslation + { + + + } +} diff --git a/KruacentExiled/KE.Utils/API/Features/ZoneProperties.cs b/KruacentExiled/KE.Utils/API/Features/ZoneProperties.cs new file mode 100644 index 00000000..df8a7da0 --- /dev/null +++ b/KruacentExiled/KE.Utils/API/Features/ZoneProperties.cs @@ -0,0 +1,44 @@ +using Exiled.API.Enums; +using Exiled.API.Features; +using System; +using System.Collections.Generic; +using System.Linq; + + +namespace KE.Utils.API.Features +{ + public class ZoneProperties + { + private ZoneType _zone; + public ZoneProperties(ZoneType zone) + { + _zone = zone; + } + + public ZoneType Zone + { + get + { + /*if (_zone == ZoneType.Unspecified) + return Enum.GetValues(typeof(ZoneType)).ToArray().ToHashSet(); + return [_zone];*/ + return _zone; + } + } + + + public override string ToString() + { + return _zone switch + { + ZoneType.Unspecified => "All of the facility", + ZoneType.LightContainment => "Light Containment Zone", + ZoneType.HeavyContainment => "Heavy Containment Zone", + ZoneType.Entrance => "Entrance Zone", + ZoneType.Surface => "Surface", + ZoneType.Pocket => "Pocket Dimension", + _ => string.Empty, + }; + } + } +} diff --git a/KruacentExiled/KE.Utils/Extensions/AdminToyExtension.cs b/KruacentExiled/KE.Utils/Extensions/AdminToyExtension.cs new file mode 100644 index 00000000..82578683 --- /dev/null +++ b/KruacentExiled/KE.Utils/Extensions/AdminToyExtension.cs @@ -0,0 +1,38 @@ +using AdminToys; +using Exiled.API.Features; +using Exiled.API.Features.Toys; +using Mirror; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using UnityEngine; + +namespace KE.Utils.Extensions +{ + public static class AdminToyExtension + { + public static void SetFakePrimitive(this AdminToy at, Player playertoshow) + { + AdminToyBase atb = at.AdminToyBase; + NetworkIdentity identity = atb.netIdentity; + if (playertoshow == null) + { + identity.RemoveClientAuthority(); + return; + } + NetworkIdentity playerIdentity = playertoshow.NetworkIdentity; + + if (identity != null && playerIdentity != null) + { + // Remove authority from previous owners (if any) + identity.RemoveClientAuthority(); + + // Assign authority to the target player + identity.AssignClientAuthority(playerIdentity.connectionToClient); + } + } + + } +} diff --git a/KruacentExiled/KE.Utils/Extensions/DoorExtension.cs b/KruacentExiled/KE.Utils/Extensions/DoorExtension.cs new file mode 100644 index 00000000..2c8bf677 --- /dev/null +++ b/KruacentExiled/KE.Utils/Extensions/DoorExtension.cs @@ -0,0 +1,14 @@ +using Exiled.API.Features; +using Exiled.API.Features.Doors; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace KE.Utils.Extensions +{ + public static class DoorExtension + { + } +} diff --git a/KruacentExiled/KE.BlackoutNDoor/Extensions/RoomExtensions.cs b/KruacentExiled/KE.Utils/Extensions/RoomExtensions.cs similarity index 95% rename from KruacentExiled/KE.BlackoutNDoor/Extensions/RoomExtensions.cs rename to KruacentExiled/KE.Utils/Extensions/RoomExtensions.cs index fc4d1051..6bc3ffd6 100644 --- a/KruacentExiled/KE.BlackoutNDoor/Extensions/RoomExtensions.cs +++ b/KruacentExiled/KE.Utils/Extensions/RoomExtensions.cs @@ -4,8 +4,10 @@ namespace KE.BlackoutNDoor.Extensions { + //todo move to utils public static class RoomExtensions { + public static bool IsSafe(this Room room) { return IsSafe(room.Zone); @@ -27,5 +29,8 @@ public static bool IsSafe(this ZoneType zone) } return result; } + + + } } diff --git a/KruacentExiled/KE.Utils/KE.Utils.csproj b/KruacentExiled/KE.Utils/KE.Utils.csproj new file mode 100644 index 00000000..6c3aa503 --- /dev/null +++ b/KruacentExiled/KE.Utils/KE.Utils.csproj @@ -0,0 +1,36 @@ + + + + 13.0 + net48 + + + + + + + + + + + + + + + + + + + + + + + + if not "$(EXILED_DEV_REFERENCES)"=="" copy /y "$(OutputPath)$(AssemblyName).dll" "$(EXILED_DEV_REFERENCES)\Plugins\" + + + if [[ ! -z "$EXILED_DEV_REFERENCES" ]]; then cp "$(OutputPath)$(AssemblyName).dll" "$EXILED_DEV_REFERENCES/Plugins/"; fi + + + + diff --git a/KruacentExiled/KE.Utils/Tests/PrimitiveTest.cs b/KruacentExiled/KE.Utils/Tests/PrimitiveTest.cs new file mode 100644 index 00000000..d75fd81e --- /dev/null +++ b/KruacentExiled/KE.Utils/Tests/PrimitiveTest.cs @@ -0,0 +1,32 @@ +using Exiled.API.Features; +using Exiled.API.Features.Pickups; +using Exiled.API.Features.Toys; +using KE.Utils.Extensions; +using Mirror; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using UnityEngine; + +namespace KE.Utils.Tests +{ + public static class PrimitiveTest + { + + public static void TestSetFakePrimitive(Player pl) + { + Primitive p = Primitive.Create(pl.Position+UnityEngine.Vector3.forward, null, null, true, UnityEngine.Color.blue); + p.SetFakePrimitive(pl); + + p = Primitive.Create(pl.Position+ UnityEngine.Vector3.back,null,null,true,UnityEngine.Color.red); + p.SetFakePrimitive(null); + } + + public static void TestTrucquegtrouvesurlediscorddexiled(Player pl) + { + + } + } +} diff --git a/KruacentExiled/KruacentExiled.sln b/KruacentExiled/KruacentExiled.sln index 135e1e35..0bc0c3b5 100644 --- a/KruacentExiled/KruacentExiled.sln +++ b/KruacentExiled/KruacentExiled.sln @@ -13,6 +13,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "KE.GlobalEventFramework", " EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "KE.GlobalEventFramework.Examples", "KE.GlobalEventFramework.Examples\KE.GlobalEventFramework.Examples.csproj", "{07B92E87-F48F-4F9F-BA0E-1BCB2AF52F53}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "KE.Utils", "KE.Utils\KE.Utils.csproj", "{C868707D-2FEE-4B06-9D92-46E8A965B4DB}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -39,6 +41,10 @@ Global {07B92E87-F48F-4F9F-BA0E-1BCB2AF52F53}.Debug|Any CPU.Build.0 = Debug|Any CPU {07B92E87-F48F-4F9F-BA0E-1BCB2AF52F53}.Release|Any CPU.ActiveCfg = Release|Any CPU {07B92E87-F48F-4F9F-BA0E-1BCB2AF52F53}.Release|Any CPU.Build.0 = Release|Any CPU + {C868707D-2FEE-4B06-9D92-46E8A965B4DB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {C868707D-2FEE-4B06-9D92-46E8A965B4DB}.Debug|Any CPU.Build.0 = Debug|Any CPU + {C868707D-2FEE-4B06-9D92-46E8A965B4DB}.Release|Any CPU.ActiveCfg = Release|Any CPU + {C868707D-2FEE-4B06-9D92-46E8A965B4DB}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE From d6e141ac9cd5e752b84bc77f7d82a15dd850bff0 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Sun, 9 Mar 2025 14:10:53 +0100 Subject: [PATCH 200/853] Gambling --- KruacentExiled/KruacentExiled.sln | 6 ++ .../Map/GamblingZone/DroppableItem.cs | 66 +++++++++++++++++++ .../Map/GamblingZone/GamblingRoom.cs | 46 +++++++++++++ KruacentExiled/Map/GamblingZone/LootTable.cs | 57 ++++++++++++++++ KruacentExiled/Map/MainPlugin.cs | 48 ++++++++++++++ KruacentExiled/Map/Map.csproj | 20 ++++++ 6 files changed, 243 insertions(+) create mode 100644 KruacentExiled/Map/GamblingZone/DroppableItem.cs create mode 100644 KruacentExiled/Map/GamblingZone/GamblingRoom.cs create mode 100644 KruacentExiled/Map/GamblingZone/LootTable.cs create mode 100644 KruacentExiled/Map/MainPlugin.cs create mode 100644 KruacentExiled/Map/Map.csproj diff --git a/KruacentExiled/KruacentExiled.sln b/KruacentExiled/KruacentExiled.sln index 41509eae..02da4c61 100644 --- a/KruacentExiled/KruacentExiled.sln +++ b/KruacentExiled/KruacentExiled.sln @@ -15,6 +15,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "KE.GlobalEventFramework.Exa EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "KE.CustomRoles", "KE.CustomRoles\KE.CustomRoles.csproj", "{4AA4C3E0-E62F-49CE-AD80-0B5C6249EB48}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Map", "Map\Map.csproj", "{CCEF1C1D-B701-443E-AC23-72A174446868}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -45,6 +47,10 @@ Global {4AA4C3E0-E62F-49CE-AD80-0B5C6249EB48}.Debug|Any CPU.Build.0 = Debug|Any CPU {4AA4C3E0-E62F-49CE-AD80-0B5C6249EB48}.Release|Any CPU.ActiveCfg = Release|Any CPU {4AA4C3E0-E62F-49CE-AD80-0B5C6249EB48}.Release|Any CPU.Build.0 = Release|Any CPU + {CCEF1C1D-B701-443E-AC23-72A174446868}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {CCEF1C1D-B701-443E-AC23-72A174446868}.Debug|Any CPU.Build.0 = Debug|Any CPU + {CCEF1C1D-B701-443E-AC23-72A174446868}.Release|Any CPU.ActiveCfg = Release|Any CPU + {CCEF1C1D-B701-443E-AC23-72A174446868}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/KruacentExiled/Map/GamblingZone/DroppableItem.cs b/KruacentExiled/Map/GamblingZone/DroppableItem.cs new file mode 100644 index 00000000..b18aa6a4 --- /dev/null +++ b/KruacentExiled/Map/GamblingZone/DroppableItem.cs @@ -0,0 +1,66 @@ +using Items = Exiled.API.Features.Items.Item; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Exiled.CustomItems.API.Features; +using UnityEngine; +using Exiled.API.Features; +using Exiled.API.Features.Pickups; + +namespace Map.GamblingZone +{ + internal class DroppableItem + { + private ItemType _item; + internal ItemType Item { get { return _item; } } + private int _chance; + internal int Chance + { + get { return _chance; } + set + { + if (_chance > 100) _chance = 100; + else if (_chance < 0) _chance = 0; + else _chance = value; + } + } + + private int _itemCap; + internal int ItemCap + { + get { return _itemCap; } + set { _itemCap = value; } + } + + private int _currentCap = 0; + internal int CurrentCap + { + get { return _currentCap; } + set { _currentCap = value; } + } + + + + + internal DroppableItem(ItemType item, int chance,int itemCap = -1) + { + _item = item; + Chance = chance; + ItemCap = itemCap; + } + + internal Items GetItem() + { + if (HasReachCap()) throw new Exception("Cap reached"); + CurrentCap++; + return Items.Create(Item); + } + + internal bool HasReachCap() + { + return CurrentCap >= ItemCap; + } + } +} diff --git a/KruacentExiled/Map/GamblingZone/GamblingRoom.cs b/KruacentExiled/Map/GamblingZone/GamblingRoom.cs new file mode 100644 index 00000000..93a6b497 --- /dev/null +++ b/KruacentExiled/Map/GamblingZone/GamblingRoom.cs @@ -0,0 +1,46 @@ +using Exiled.API.Features; +using Exiled.Events.EventArgs.Player; +using System.Collections.Generic; +using System.Linq; +using UnityEngine; + +namespace Map.GamblingZone +{ + public class GamblingRoom + { + internal static HashSet List { get; }= new HashSet(); + + private Room _room; + private LootTable _lootTable; + + internal GamblingRoom(Room room, LootTable lootTable) + { + _room = room; + List.Add(this); + _lootTable = lootTable; + } + + public bool IsInGamblingRoom(Player p) + { + return _room.Players.Contains(p); + } + + public void SubscribeEvents() + { + Exiled.Events.Handlers.Player.DroppedItem += OnDropped; + } + public void UnsubscribeEvents() + { + Exiled.Events.Handlers.Player.DroppedItem -= OnDropped; + } + + + public void OnDropped(DroppedItemEventArgs ev) + { + if (!IsInGamblingRoom(ev.Player)) return; + Vector3 pos = ev.Pickup.Position; + ev.Pickup.Destroy(); + _lootTable.GetRandomItem().CreatePickup(pos); + } + } +} diff --git a/KruacentExiled/Map/GamblingZone/LootTable.cs b/KruacentExiled/Map/GamblingZone/LootTable.cs new file mode 100644 index 00000000..81410860 --- /dev/null +++ b/KruacentExiled/Map/GamblingZone/LootTable.cs @@ -0,0 +1,57 @@ +using Exiled.API.Features.Items; +using Exiled.API.Features.Pickups; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using UnityEngine; + +namespace Map.GamblingZone +{ + internal class LootTable + { + private HashSet _items = new HashSet() + { + new(ItemType.Jailbird,5,1), + new(ItemType.ParticleDisruptor,5,1), + }; + + public LootTable() + { + } + public LootTable(HashSet items) + { + _items = items; + } + + private DroppableItem ChooseRandomItem() + { + int totalWeight = 0; + foreach (DroppableItem drop in _items) + { + if(drop.HasReachCap()) + totalWeight += drop.Chance; + } + + if (totalWeight == 0) + throw new ArgumentException("Total probability must be greater than zero."); + + int randValue = UnityEngine.Random.Range(0, totalWeight); + int cumulativeSum = 0; + + foreach (DroppableItem drop in _items) + { + cumulativeSum += drop.Chance; + if (randValue < cumulativeSum) + return drop; + } + return null; + + } + public Item GetRandomItem() + { + return ChooseRandomItem().GetItem(); + } + } +} diff --git a/KruacentExiled/Map/MainPlugin.cs b/KruacentExiled/Map/MainPlugin.cs new file mode 100644 index 00000000..b61365ed --- /dev/null +++ b/KruacentExiled/Map/MainPlugin.cs @@ -0,0 +1,48 @@ + +using Exiled.API.Features; +using Exiled.API.Interfaces; +using Exiled.Events.EventArgs.Player; +using Exiled.Events.EventArgs.Server; +using Map.GamblingZone; + +namespace Map +{ + public class MainPlugin : Plugin + { + public override void OnEnabled() + { + Exiled.Events.Handlers.Map.Generated += OnGenerated; + + Exiled.Events.Handlers.Server.RoundEnded += OnRoundEnded; + } + + public override void OnDisabled() + { + Exiled.Events.Handlers.Map.Generated -= OnGenerated; + + } + + + private void OnGenerated() + { + var l = new LootTable(); + var g = new GamblingRoom(Room.Get(Exiled.API.Enums.RoomType.Lcz173),l); + + g.SubscribeEvents(); + + } + + private void OnRoundEnded(RoundEndedEventArgs ev) + { + foreach (var g in GamblingRoom.List) + g.UnsubscribeEvents(); + } + } + + + public class Config : IConfig + { + public bool IsEnabled { get; set; } + public bool Debug { get; set; } + } +} diff --git a/KruacentExiled/Map/Map.csproj b/KruacentExiled/Map/Map.csproj new file mode 100644 index 00000000..a0744b7d --- /dev/null +++ b/KruacentExiled/Map/Map.csproj @@ -0,0 +1,20 @@ + + + + 13.0 + net48 + + + + + + + + + + + + + + + From bef0ca97f78932c3159d509f27f8b878a3e527bc Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Mon, 10 Mar 2025 16:52:21 +0100 Subject: [PATCH 201/853] GlobalCustomRole now works yippee --- .../KE.CustomRoles/API/GlobalCustomRole.cs | 43 ++++++++++++++++--- .../KE.CustomRoles/CR/ClassD/Enfant.cs | 1 + .../CR/{ClassD => Human}/Asthmatique.cs | 9 ++-- KruacentExiled/KE.CustomRoles/Controller.cs | 7 +-- .../KE.CustomRoles/KE.CustomRoles.csproj | 10 ++++- 5 files changed, 57 insertions(+), 13 deletions(-) rename KruacentExiled/KE.CustomRoles/CR/{ClassD => Human}/Asthmatique.cs (82%) diff --git a/KruacentExiled/KE.CustomRoles/API/GlobalCustomRole.cs b/KruacentExiled/KE.CustomRoles/API/GlobalCustomRole.cs index 80abcb5d..12505d54 100644 --- a/KruacentExiled/KE.CustomRoles/API/GlobalCustomRole.cs +++ b/KruacentExiled/KE.CustomRoles/API/GlobalCustomRole.cs @@ -1,8 +1,11 @@ using Exiled.API.Enums; +using Exiled.API.Extensions; using Exiled.API.Features; using Exiled.API.Features.Attributes; using Exiled.API.Features.Pools; using Exiled.CustomRoles.API.Features; +using InventorySystem.Configs; +using LiteNetLib4Mirror.Open.Nat; using MEC; using PlayerRoles; using System; @@ -14,13 +17,14 @@ namespace KE.CustomRoles.API { - [CustomRole(PlayerRoles.RoleTypeId.CustomRole)] public abstract class GlobalCustomRole : CustomRole { public override RoleTypeId Role { get; set; } = RoleTypeId.None; + public abstract SideEnum Side { get; set; } public virtual IEnumerable BlacklistedRole { get; } = new List(); public override void AddRole(Player player) { + if (SideClass.Get(player.Role.Side) != Side) return; Log.Debug($"{Name}: Adding role to {player.Nickname}."); TrackedPlayers.Add(player); @@ -29,17 +33,17 @@ public override void AddRole(Player player) switch (KeepPositionOnSpawn) { case true when KeepInventoryOnSpawn: - player.Role.Set(Role, SpawnReason.ForceClass, RoleSpawnFlags.None); + player.Role.Set(player.Role, SpawnReason.ForceClass, RoleSpawnFlags.None); break; case true: - player.Role.Set(Role, SpawnReason.ForceClass, RoleSpawnFlags.AssignInventory); + player.Role.Set(player.Role, SpawnReason.ForceClass, RoleSpawnFlags.AssignInventory); break; default: { if (KeepInventoryOnSpawn && player.IsAlive) - player.Role.Set(Role, SpawnReason.ForceClass, RoleSpawnFlags.UseSpawnpoint); + player.Role.Set(player.Role, SpawnReason.ForceClass, RoleSpawnFlags.UseSpawnpoint); else - player.Role.Set(Role, SpawnReason.ForceClass, RoleSpawnFlags.All); + player.Role.Set(player.Role, SpawnReason.ForceClass, RoleSpawnFlags.All); break; } } @@ -124,5 +128,34 @@ public override void AddRole(Player player) } } + + + } + + public enum SideEnum + { + Human, + SCP, + None, + } + + public static class SideClass + { + public static SideEnum Get(Exiled.API.Enums.Side side) + { + switch (side) + { + case Exiled.API.Enums.Side.Scp: + return SideEnum.SCP; + case Exiled.API.Enums.Side.Tutorial: + case Exiled.API.Enums.Side.Mtf: + case Exiled.API.Enums.Side.ChaosInsurgency: + return SideEnum.Human; + case Exiled.API.Enums.Side.None: + return SideEnum.None; + } + return SideEnum.None; + } } + } diff --git a/KruacentExiled/KE.CustomRoles/CR/ClassD/Enfant.cs b/KruacentExiled/KE.CustomRoles/CR/ClassD/Enfant.cs index eff5d784..28364e25 100644 --- a/KruacentExiled/KE.CustomRoles/CR/ClassD/Enfant.cs +++ b/KruacentExiled/KE.CustomRoles/CR/ClassD/Enfant.cs @@ -27,4 +27,5 @@ internal class Enfant : Exiled.CustomRoles.API.Features.CustomRole $"{CandyKindID.Rainbow}" }; } + } diff --git a/KruacentExiled/KE.CustomRoles/CR/ClassD/Asthmatique.cs b/KruacentExiled/KE.CustomRoles/CR/Human/Asthmatique.cs similarity index 82% rename from KruacentExiled/KE.CustomRoles/CR/ClassD/Asthmatique.cs rename to KruacentExiled/KE.CustomRoles/CR/Human/Asthmatique.cs index 83610ce2..d73fb8cd 100644 --- a/KruacentExiled/KE.CustomRoles/CR/ClassD/Asthmatique.cs +++ b/KruacentExiled/KE.CustomRoles/CR/Human/Asthmatique.cs @@ -2,21 +2,22 @@ using Exiled.API.Features; using Exiled.API.Features.Attributes; using Exiled.CustomRoles.API.Features; +using KE.CustomRoles.API; using PlayerRoles; using UnityEngine; using Utils.NonAllocLINQ; -namespace KE.CustomRoles.CR.ClassD +namespace KE.CustomRoles.CR.Human { - [CustomRole(RoleTypeId.ClassD)] - internal class Asthmatique : CustomRole + [CustomRole(RoleTypeId.None)] + internal class Asthmatique : GlobalCustomRole { + public override SideEnum Side { get; set; } = SideEnum.Human; public override string Name { get; set; } = "Asthmatique"; public override string Description { get; set; } = "Tu es asthmatique\nT'as stamina est réduit de moitié\nMais tu vises mieux"; public override uint Id { get; set; } = 1042; public override string CustomInfo { get; set; } = "Asthmatique"; public override int MaxHealth { get; set; } = 100; - public override RoleTypeId Role { get; set; } = RoleTypeId.ClassD; public override bool KeepRoleOnDeath { get; set; } = true; public override bool KeepRoleOnChangingRole { get; set; } = true; public override bool IgnoreSpawnSystem { get; set; } = true; diff --git a/KruacentExiled/KE.CustomRoles/Controller.cs b/KruacentExiled/KE.CustomRoles/Controller.cs index 2cdb14a3..f97b6d05 100644 --- a/KruacentExiled/KE.CustomRoles/Controller.cs +++ b/KruacentExiled/KE.CustomRoles/Controller.cs @@ -1,6 +1,7 @@ using Exiled.API.Extensions; using Exiled.API.Features; using Exiled.CustomRoles.API.Features; +using KE.CustomRoles.API; using PlayerRoles; using System.Collections.Generic; using System.Linq; @@ -13,7 +14,7 @@ internal class Controller /// /// The chance of having a CustomRole /// - public const int Chance = 40; + public const int Chance = 100; public static Controller controller = new Controller(); private Controller() { } @@ -26,13 +27,13 @@ internal void GiveRole(Player player) { if (player == null) return; - if (UnityEngine.Random.Range(0, 100) > Chance) + if (UnityEngine.Random.Range(0, 101) > Chance) { Log.Debug("no luck"); return; } - CustomRole cr = CustomRole.Registered.GetRandomValue(c => c.Role == player.Role); + CustomRole cr = CustomRole.Registered.GetRandomValue(c => c.Role == player.Role || c is GlobalCustomRole cgr && cgr.Side == SideClass.Get(player.Role.Side)); Log.Debug($"{player.Id} : {cr.Name}"); cr?.AddRole(player); } diff --git a/KruacentExiled/KE.CustomRoles/KE.CustomRoles.csproj b/KruacentExiled/KE.CustomRoles/KE.CustomRoles.csproj index 5b7382b3..446196fc 100644 --- a/KruacentExiled/KE.CustomRoles/KE.CustomRoles.csproj +++ b/KruacentExiled/KE.CustomRoles/KE.CustomRoles.csproj @@ -4,13 +4,21 @@ - + + + + if not "$(EXILED_DEV_REFERENCES)"=="" copy /y "$(OutputPath)$(AssemblyName).dll" "$(EXILED_DEV_REFERENCES)\Plugins\" + + + if [[ ! -z "$EXILED_DEV_REFERENCES" ]]; then cp "$(OutputPath)$(AssemblyName).dll" "$EXILED_DEV_REFERENCES/Plugins/"; fi + + From 0fe38d7cf3eaa59747f406a54ae4955e5f6d6d62 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Thu, 13 Mar 2025 08:28:11 +0100 Subject: [PATCH 202/853] corrected gambling room + new doors --- KruacentExiled/KruacentExiled.sln | 2 +- KruacentExiled/Map/Doors/DoorButton.cs | 35 +++++ .../Map/Doors/InteractiblePickup.cs | 121 ++++++++++++++++++ KruacentExiled/Map/Doors/KEDoor.cs | 76 +++++++++++ .../Map/GamblingZone/DroppableItem.cs | 7 +- .../Map/GamblingZone/GamblingRoom.cs | 15 ++- KruacentExiled/Map/GamblingZone/LootTable.cs | 13 +- .../Map/{Map.csproj => KE.Map.csproj} | 7 + KruacentExiled/Map/MainPlugin.cs | 21 ++- .../Map/Quality/SendFakePrimitives.cs | 85 ++++++++++++ 10 files changed, 366 insertions(+), 16 deletions(-) create mode 100644 KruacentExiled/Map/Doors/DoorButton.cs create mode 100644 KruacentExiled/Map/Doors/InteractiblePickup.cs create mode 100644 KruacentExiled/Map/Doors/KEDoor.cs rename KruacentExiled/Map/{Map.csproj => KE.Map.csproj} (67%) create mode 100644 KruacentExiled/Map/Quality/SendFakePrimitives.cs diff --git a/KruacentExiled/KruacentExiled.sln b/KruacentExiled/KruacentExiled.sln index 02da4c61..aaa7854f 100644 --- a/KruacentExiled/KruacentExiled.sln +++ b/KruacentExiled/KruacentExiled.sln @@ -15,7 +15,7 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "KE.GlobalEventFramework.Exa EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "KE.CustomRoles", "KE.CustomRoles\KE.CustomRoles.csproj", "{4AA4C3E0-E62F-49CE-AD80-0B5C6249EB48}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Map", "Map\Map.csproj", "{CCEF1C1D-B701-443E-AC23-72A174446868}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "KE.Map", "Map\KE.Map.csproj", "{CCEF1C1D-B701-443E-AC23-72A174446868}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution diff --git a/KruacentExiled/Map/Doors/DoorButton.cs b/KruacentExiled/Map/Doors/DoorButton.cs new file mode 100644 index 00000000..63e3e8ed --- /dev/null +++ b/KruacentExiled/Map/Doors/DoorButton.cs @@ -0,0 +1,35 @@ +using Exiled.API.Features.Pickups; +using Exiled.API.Features.Toys; +using Exiled.API.Interfaces; +using Exiled.Events.EventArgs.Player; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using UnityEngine; + +namespace KE.Map.Doors +{ + internal class DoorButton : IWorldSpace + { + public Vector3 Position { get; } + public Quaternion Rotation { get; } + + private InteractiblePickup _ipickup; + + internal DoorButton(Vector3 position,Quaternion rotation) + { + Position = position; + Rotation = rotation; + _ipickup = new(ItemType.Medkit, Position,Vector3.one, Rotation,false); + + Primitive pr = Primitive.Create(PrimitiveType.Cube, Position, null, _ipickup.GetPickupTrueSize() + new Vector3(.1f, .1f, .1f)); + pr.Collidable = false; + + } + + + + } +} diff --git a/KruacentExiled/Map/Doors/InteractiblePickup.cs b/KruacentExiled/Map/Doors/InteractiblePickup.cs new file mode 100644 index 00000000..2725b647 --- /dev/null +++ b/KruacentExiled/Map/Doors/InteractiblePickup.cs @@ -0,0 +1,121 @@ +using Exiled.API.Features.Pickups; +using Exiled.API.Interfaces; +using Exiled.Events.EventArgs.Player; +using InventorySystem.Items.Pickups; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using UnityEngine; + +namespace KE.Map.Doors +{ + public class InteractiblePickup + { + private HashSet _actions; + private ushort _pickupSerial; + private Pickup _pickup; + private InteractiblePickup(Pickup pickup) + { + _pickupSerial = pickup.Serial; + _pickup = pickup; + SubscribeEvent(); + } + + private InteractiblePickup(Pickup pickup,Vector3 sizePickup) + { + _pickup = pickup; + _pickupSerial = pickup.Serial; + PickupSyncInfo info = pickup.Base.NetworkInfo; + pickup.Scale = sizePickup; + pickup.Base.NetworkInfo = info; + pickup.Base.GetComponent().isKinematic = true; + SubscribeEvent(); + } + + + public InteractiblePickup(ItemType itemType, Vector3 position, Vector3 scalePickup, Quaternion? rotation,bool useGravity = false) + { + var pickup = Pickup.CreateAndSpawn(itemType, position, rotation); + _pickup = pickup; + pickup.Rigidbody.useGravity = useGravity; + pickup.Rigidbody.detectCollisions = false; + + + _pickupSerial = pickup.Serial; + PickupSyncInfo info = pickup.Base.NetworkInfo; + pickup.Scale = scalePickup; + pickup.Base.NetworkInfo = info; + pickup.Base.GetComponent().isKinematic = true; + + SubscribeEvent(); + } + + + + + + ~InteractiblePickup() + { + Exiled.Events.Handlers.Player.PickingUpItem -= OnPickingUpItem; + } + + private void SubscribeEvent() + { + Exiled.Events.Handlers.Player.PickingUpItem += OnPickingUpItem; + } + + public bool AddAction(Action a) + { + return _actions.Add(a); + } + + public void OnPickingUpItem(PickingUpItemEventArgs ev) + { + if (ev.Pickup.Serial != _pickupSerial) return; + ev.IsAllowed = false; + + foreach (var action in _actions) + { + action?.Invoke(); + } + } + + public static Vector3 GetPickupTrueSize(Pickup pickup) + { + if (pickup?.GameObject == null) + return Vector3.zero; + + Renderer renderer = pickup.GameObject.GetComponentInChildren(); + Collider collider = pickup.GameObject.GetComponentInChildren(); + + if (renderer != null) + return renderer.bounds.size; + + if (collider != null) + return collider.bounds.size; + + return Vector3.zero; + } + + public Vector3 GetPickupTrueSize() + { + if (_pickup.GameObject == null) + return Vector3.zero; + + Renderer renderer = _pickup.GameObject.GetComponentInChildren(); + Collider collider = _pickup.GameObject.GetComponentInChildren(); + + if (renderer != null) + return renderer.bounds.size; + + if (collider != null) + return collider.bounds.size; + + return Vector3.zero; + } + } + + +} diff --git a/KruacentExiled/Map/Doors/KEDoor.cs b/KruacentExiled/Map/Doors/KEDoor.cs new file mode 100644 index 00000000..bff2c65f --- /dev/null +++ b/KruacentExiled/Map/Doors/KEDoor.cs @@ -0,0 +1,76 @@ +using Exiled.API.Extensions; +using Exiled.API.Features; +using Exiled.API.Features.Doors; +using Exiled.API.Features.Pickups; +using Exiled.API.Interfaces; +using Exiled.Events; +using Exiled.Events.EventArgs.Player; +using Interactables.Interobjects.DoorUtils; +using InventorySystem.Items.Pickups; +using MEC; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Runtime.CompilerServices; +using System.Text; +using System.Threading.Tasks; +using UnityEngine; + +namespace KE.Map.Doors +{ + public class KEDoor : IWorldSpace + { + public Vector3 Position { get; } + public Quaternion Rotation { get; } + //0 -> closed ; 1 -> open + private float _exactState =0f; + private DoorButton[] _buttons = new DoorButton[2]; + //interacting door + private InteractiblePickup _pickup; + public KEDoor OtherDoor { get; set; } + KeycardPermissions KeycardPermissions { get; set; } = KeycardPermissions.None; + public bool IsOpen + { + get { return _exactState == 1f; } + set + { + _exactState = value ? 1f : 0f; + } + } + + private KEDoor(Vector3 position, Quaternion rotation) + { + Position = position; + Rotation = rotation; + _buttons[0] = new(position, rotation); + _buttons[1] = new(position, rotation); + } + + public static void Create(Vector3 position,Quaternion rotation) + { + KEDoor door = new(position,rotation); + + door._pickup = new(ItemType.Medkit,position,Vector3.one,null,false); + + door._pickup.AddAction(door.ChangeDoorState); + } + + public void UsingDoor(Player player) + { + if (!IsOpen) return; + if(OtherDoor == null) return; + + + + } + + public void ChangeDoorState() + { + IsOpen = !IsOpen; + } + + + + + } +} diff --git a/KruacentExiled/Map/GamblingZone/DroppableItem.cs b/KruacentExiled/Map/GamblingZone/DroppableItem.cs index b18aa6a4..0a5e7b4b 100644 --- a/KruacentExiled/Map/GamblingZone/DroppableItem.cs +++ b/KruacentExiled/Map/GamblingZone/DroppableItem.cs @@ -60,7 +60,12 @@ internal Items GetItem() internal bool HasReachCap() { - return CurrentCap >= ItemCap; + return CurrentCap >= ItemCap && ItemCap != -1; + } + + public override string ToString() + { + return Item.ToString(); } } } diff --git a/KruacentExiled/Map/GamblingZone/GamblingRoom.cs b/KruacentExiled/Map/GamblingZone/GamblingRoom.cs index 93a6b497..13cb5608 100644 --- a/KruacentExiled/Map/GamblingZone/GamblingRoom.cs +++ b/KruacentExiled/Map/GamblingZone/GamblingRoom.cs @@ -1,5 +1,10 @@ -using Exiled.API.Features; +using Exiled.API.Extensions; +using Exiled.API.Features; +using Exiled.API.Features.Items; +using Exiled.API.Features.Spawn; using Exiled.Events.EventArgs.Player; +using PlayerRoles; +using PluginAPI.Roles; using System.Collections.Generic; using System.Linq; using UnityEngine; @@ -37,10 +42,14 @@ public void UnsubscribeEvents() public void OnDropped(DroppedItemEventArgs ev) { + if (ev.Player == null) return; + if(ev.Pickup == null) return; + if (Vector3.Distance(ev.Player.Position, _room.Position) > 8.2f) return; if (!IsInGamblingRoom(ev.Player)) return; - Vector3 pos = ev.Pickup.Position; ev.Pickup.Destroy(); - _lootTable.GetRandomItem().CreatePickup(pos); + Item item = _lootTable.GetRandomItem(); + ev.Player.AddItem(item); + ev.Player.DropItem(item); } } } diff --git a/KruacentExiled/Map/GamblingZone/LootTable.cs b/KruacentExiled/Map/GamblingZone/LootTable.cs index 81410860..da25b701 100644 --- a/KruacentExiled/Map/GamblingZone/LootTable.cs +++ b/KruacentExiled/Map/GamblingZone/LootTable.cs @@ -1,4 +1,5 @@ -using Exiled.API.Features.Items; +using Exiled.API.Features; +using Exiled.API.Features.Items; using Exiled.API.Features.Pickups; using System; using System.Collections.Generic; @@ -15,6 +16,7 @@ internal class LootTable { new(ItemType.Jailbird,5,1), new(ItemType.ParticleDisruptor,5,1), + new(ItemType.Radio,15,-1), }; public LootTable() @@ -30,7 +32,7 @@ private DroppableItem ChooseRandomItem() int totalWeight = 0; foreach (DroppableItem drop in _items) { - if(drop.HasReachCap()) + if(!drop.HasReachCap()) totalWeight += drop.Chance; } @@ -42,7 +44,8 @@ private DroppableItem ChooseRandomItem() foreach (DroppableItem drop in _items) { - cumulativeSum += drop.Chance; + if(!drop.HasReachCap()) + cumulativeSum += drop.Chance; if (randValue < cumulativeSum) return drop; } @@ -51,7 +54,9 @@ private DroppableItem ChooseRandomItem() } public Item GetRandomItem() { - return ChooseRandomItem().GetItem(); + DroppableItem item = ChooseRandomItem(); + Log.Debug("random item =" + item); + return item.GetItem(); } } } diff --git a/KruacentExiled/Map/Map.csproj b/KruacentExiled/Map/KE.Map.csproj similarity index 67% rename from KruacentExiled/Map/Map.csproj rename to KruacentExiled/Map/KE.Map.csproj index a0744b7d..13f8cb7a 100644 --- a/KruacentExiled/Map/Map.csproj +++ b/KruacentExiled/Map/KE.Map.csproj @@ -17,4 +17,11 @@ + + if not "$(EXILED_DEV_REFERENCES)"=="" copy /y "$(OutputPath)$(AssemblyName).dll" "$(EXILED_DEV_REFERENCES)\Plugins\" + + + if [[ ! -z "$EXILED_DEV_REFERENCES" ]]; then cp "$(OutputPath)$(AssemblyName).dll" "$EXILED_DEV_REFERENCES/Plugins/"; fi + + diff --git a/KruacentExiled/Map/MainPlugin.cs b/KruacentExiled/Map/MainPlugin.cs index b61365ed..9c077c66 100644 --- a/KruacentExiled/Map/MainPlugin.cs +++ b/KruacentExiled/Map/MainPlugin.cs @@ -3,33 +3,40 @@ using Exiled.API.Interfaces; using Exiled.Events.EventArgs.Player; using Exiled.Events.EventArgs.Server; +using KE.Map.Quality; using Map.GamblingZone; -namespace Map +namespace KE.Map { public class MainPlugin : Plugin { + public static MainPlugin Instance { get; private set; } public override void OnEnabled() { Exiled.Events.Handlers.Map.Generated += OnGenerated; - Exiled.Events.Handlers.Server.RoundEnded += OnRoundEnded; + Exiled.Events.Handlers.Server.RoundStarted += SendFakePrimitives.Join; + + Instance = this; } public override void OnDisabled() { Exiled.Events.Handlers.Map.Generated -= OnGenerated; - + Exiled.Events.Handlers.Server.RoundEnded -= OnRoundEnded; + Exiled.Events.Handlers.Server.RoundStarted -= SendFakePrimitives.Join; + + Instance = null; } private void OnGenerated() { var l = new LootTable(); - var g = new GamblingRoom(Room.Get(Exiled.API.Enums.RoomType.Lcz173),l); - + var g = new GamblingRoom(Room.Get(Exiled.API.Enums.RoomType.Lcz173), l); g.SubscribeEvents(); + } private void OnRoundEnded(RoundEndedEventArgs ev) @@ -42,7 +49,7 @@ private void OnRoundEnded(RoundEndedEventArgs ev) public class Config : IConfig { - public bool IsEnabled { get; set; } - public bool Debug { get; set; } + public bool IsEnabled { get; set; } = true; + public bool Debug { get; set; } = true; } } diff --git a/KruacentExiled/Map/Quality/SendFakePrimitives.cs b/KruacentExiled/Map/Quality/SendFakePrimitives.cs new file mode 100644 index 00000000..838bd8eb --- /dev/null +++ b/KruacentExiled/Map/Quality/SendFakePrimitives.cs @@ -0,0 +1,85 @@ +using AdminToys; +using Exiled.API.Extensions; +using Exiled.API.Features; +using Exiled.API.Features.Pickups; +using Exiled.API.Features.Toys; +using Exiled.Events.EventArgs.Player; +using InventorySystem.Items.Pickups; +using Mirror; +using PlayerRoles; +using PluginAPI.Roles; +using System; +using System.Collections.Generic; +using UnityEngine; + +namespace KE.Map.Quality +{ + internal class SendFakePrimitives + { + public static void Fake() + { + Vector3 pos = RoleTypeId.Scp049.GetRandomSpawnLocation().Position; + Primitive.Create(pos, null, null, true, Color.white); + HashSet list = new HashSet(); + for (int i = 0; i < 1000; i++) + { + + + Primitive p = Primitive.Create(pos+new Vector3(.1f*i,0,0), null, new Vector3(.5f, 1.5f, .5f), true, Color.yellow); + p.Collidable = false; + list.Add(p); + PrimitiveObjectToy primitive = p.Base; + + foreach (Player pl in Player.List) + { + + if (pl.Id % 2 == 0) + { + Log.Debug($"for player ={pl.Nickname}"); + pl.SendFakeSyncVar(p.Base.netIdentity, typeof(PrimitiveObjectToy), nameof(PrimitiveObjectToy.NetworkPosition), new Vector3(15000,15000,15000)); + } + else + { + Log.Debug($"back player ={pl.Nickname}"); + pl.SendFakeSyncVar(p.Base.netIdentity, typeof(PrimitiveObjectToy), nameof(PrimitiveObjectToy.NetworkPosition), pos + Vector3.forward); + } + + + //pl.SendFakeSyncVar(p.Base.netIdentity, typeof(PrimitiveObjectToy), nameof(PrimitiveObjectToy.NetworkPosition), pos + Vector3.forward); + } + } + + } + + + + public static void Join() + { + //Fake(); + Vector3 pos = RoleTypeId.Scp049.GetRandomSpawnLocation().Position; + + var pick = Pickup.CreateAndSpawn(ItemType.Medkit, pos); + + //pick.Base.GetComponent().isKinematic = true; + + Collider collider = pick.GameObject.GetComponentInChildren(); + + + + + + //Pickup pickupFinal = Pickup.CreateAndSpawn(ItemType.KeycardGuard, p.Position); + + //if (!pickupFinal.IsLocked) + //{ + // PickupSyncInfo info = pickupFinal.Base.NetworkInfo; + // pickupFinal.Scale = new Vector3(10, 150, 10); + // pickupFinal.Base.NetworkInfo = info; + // pickupFinal.Base.GetComponent().isKinematic = true; + //} + + } + + + } +} From 033585252ead1025c49d0a3fdba8085793dceec0 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Thu, 13 Mar 2025 08:43:47 +0100 Subject: [PATCH 203/853] corrected csproj + changed desc of divine pills --- KruacentExiled/KE.Items/Items/DivinePills.cs | 2 +- KruacentExiled/KE.Items/KE.Items.csproj | 9 ++++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/KruacentExiled/KE.Items/Items/DivinePills.cs b/KruacentExiled/KE.Items/Items/DivinePills.cs index db1a17c9..6aa402e6 100644 --- a/KruacentExiled/KE.Items/Items/DivinePills.cs +++ b/KruacentExiled/KE.Items/Items/DivinePills.cs @@ -35,7 +35,7 @@ public class DivinePills : KECustomItem, ILumosItem, ISwichableEffect, IUpgradab public override string Name { get; set; } = "Divine Pills"; /// - public override string Description { get; set; } = "25% chance you die\n 75% you respawn someone\n 10% to upgrade in 914 on very fine"; + public override string Description { get; set; } = "25% chance you die\n 75% you respawn someone\n"; /// public override float Weight { get; set; } = 0.65f; diff --git a/KruacentExiled/KE.Items/KE.Items.csproj b/KruacentExiled/KE.Items/KE.Items.csproj index cf640884..eb2b02ce 100644 --- a/KruacentExiled/KE.Items/KE.Items.csproj +++ b/KruacentExiled/KE.Items/KE.Items.csproj @@ -16,7 +16,14 @@ - + + + if not "$(EXILED_DEV_REFERENCES)"=="" copy /y "$(OutputPath)$(AssemblyName).dll" "$(EXILED_DEV_REFERENCES)\Plugins\" + + + if [[ ! -z "$EXILED_DEV_REFERENCES" ]]; then cp "$(OutputPath)$(AssemblyName).dll" "$EXILED_DEV_REFERENCES/Plugins/"; fi + + From 19c51cfdfdf789c78135f4faac2f404a684a1d64 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Thu, 13 Mar 2025 08:48:11 +0100 Subject: [PATCH 204/853] added utils from global event --- .../KE.Utils/Extensions/PlayerExtension.cs | 35 ++++++++++++++++++ .../KE.Utils/Extensions/RoomExtension.cs | 12 ++++++ KruacentExiled/KE.Utils/KE.Utils.csproj | 21 +++++++++++ KruacentExiled/KE.Utils/KEHints.cs | 33 +++++++++++++++++ KruacentExiled/KE.Utils/RueIHint.cs | 37 +++++++++++++++++++ KruacentExiled/KruacentExiled.sln | 6 +++ 6 files changed, 144 insertions(+) create mode 100644 KruacentExiled/KE.Utils/Extensions/PlayerExtension.cs create mode 100644 KruacentExiled/KE.Utils/Extensions/RoomExtension.cs create mode 100644 KruacentExiled/KE.Utils/KE.Utils.csproj create mode 100644 KruacentExiled/KE.Utils/KEHints.cs create mode 100644 KruacentExiled/KE.Utils/RueIHint.cs diff --git a/KruacentExiled/KE.Utils/Extensions/PlayerExtension.cs b/KruacentExiled/KE.Utils/Extensions/PlayerExtension.cs new file mode 100644 index 00000000..fd6b85d9 --- /dev/null +++ b/KruacentExiled/KE.Utils/Extensions/PlayerExtension.cs @@ -0,0 +1,35 @@ +using Exiled.API.Features; +using Mirror; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using UnityEngine; + +namespace KE.Utils.Extensions +{ + public static class PlayerExtension + { + public static void SetFakeInvis(this Player p, IEnumerable viewers) + { + Vector3 pos = p.Position; + + try + { + p.ReferenceHub.transform.localPosition = Vector3.zero; + foreach (Player viewer in viewers) + { + Server.SendSpawnMessage.Invoke(null, new object[2] { viewer.NetworkIdentity, viewer.Connection }); + } + + p.ReferenceHub.transform.localPosition = pos; + } + catch (Exception arg) + { + Log.Error(string.Format("{0}: {1}", "SetFakeInvis", arg)); + } + } + + } +} diff --git a/KruacentExiled/KE.Utils/Extensions/RoomExtension.cs b/KruacentExiled/KE.Utils/Extensions/RoomExtension.cs new file mode 100644 index 00000000..35fee2e8 --- /dev/null +++ b/KruacentExiled/KE.Utils/Extensions/RoomExtension.cs @@ -0,0 +1,12 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace KE.Utils.Extensions +{ + internal class RoomExtension + { + } +} diff --git a/KruacentExiled/KE.Utils/KE.Utils.csproj b/KruacentExiled/KE.Utils/KE.Utils.csproj new file mode 100644 index 00000000..4a0ebe67 --- /dev/null +++ b/KruacentExiled/KE.Utils/KE.Utils.csproj @@ -0,0 +1,21 @@ + + + + net48 + + + + + + + + + + + + + + + + + diff --git a/KruacentExiled/KE.Utils/KEHints.cs b/KruacentExiled/KE.Utils/KEHints.cs new file mode 100644 index 00000000..a270ecb7 --- /dev/null +++ b/KruacentExiled/KE.Utils/KEHints.cs @@ -0,0 +1,33 @@ +using Exiled.API.Features; +using System; +using RueI.Extensions; +using RueI.Displays; + +namespace KE.Utils +{ + public static class KEHint + { + + public static void ShowHint(this Player player, RueIHint rueIHint) + { + ShowHint(player, rueIHint.Hint, rueIHint.Position); + } + + public static void ShowHint(this Player player, Hint hint, float position) + { + ShowHint(player, hint.Content, position, TimeSpan.FromSeconds(hint.Duration)); + } + public static void ShowHint(this Player p, string message, float position, TimeSpan timeSpan) + { + ShowHint(p.ReferenceHub, message, position, timeSpan); + } + + public static void ShowHint(ReferenceHub hub, string message, float position, TimeSpan timeSpan) + { + DisplayCore c = DisplayCore.Get(hub); + + c.SetElemTemp(message, position, timeSpan, new RueI.Displays.Scheduling.TimedElemRef()); + } + + } +} diff --git a/KruacentExiled/KE.Utils/RueIHint.cs b/KruacentExiled/KE.Utils/RueIHint.cs new file mode 100644 index 00000000..b3bacdd2 --- /dev/null +++ b/KruacentExiled/KE.Utils/RueIHint.cs @@ -0,0 +1,37 @@ +using Exiled.API.Features; +using Exiled.Events.Commands.PluginManager; +using RueI; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace KE.Utils +{ + + /// + /// Hint with position + /// + public class RueIHint + { + public Hint Hint { get; set; } + public float Position { get; set; } + public RueIHint(Hint hint,float position) + { + Hint = hint; + Position = position; + } + public RueIHint(string content, float duration = 3f, bool show = true, float position = 0) + { + Hint = new Hint(content,duration,show); + Position = position; + + } + public RueIHint() + { + Hint = new Hint(); + Position = 0; + } + } +} diff --git a/KruacentExiled/KruacentExiled.sln b/KruacentExiled/KruacentExiled.sln index 135e1e35..ff68a593 100644 --- a/KruacentExiled/KruacentExiled.sln +++ b/KruacentExiled/KruacentExiled.sln @@ -13,6 +13,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "KE.GlobalEventFramework", " EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "KE.GlobalEventFramework.Examples", "KE.GlobalEventFramework.Examples\KE.GlobalEventFramework.Examples.csproj", "{07B92E87-F48F-4F9F-BA0E-1BCB2AF52F53}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "KE.Utils", "KE.Utils\KE.Utils.csproj", "{D6B3068A-9DD1-4469-9BFE-5771168DFCBD}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -39,6 +41,10 @@ Global {07B92E87-F48F-4F9F-BA0E-1BCB2AF52F53}.Debug|Any CPU.Build.0 = Debug|Any CPU {07B92E87-F48F-4F9F-BA0E-1BCB2AF52F53}.Release|Any CPU.ActiveCfg = Release|Any CPU {07B92E87-F48F-4F9F-BA0E-1BCB2AF52F53}.Release|Any CPU.Build.0 = Release|Any CPU + {D6B3068A-9DD1-4469-9BFE-5771168DFCBD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {D6B3068A-9DD1-4469-9BFE-5771168DFCBD}.Debug|Any CPU.Build.0 = Debug|Any CPU + {D6B3068A-9DD1-4469-9BFE-5771168DFCBD}.Release|Any CPU.ActiveCfg = Release|Any CPU + {D6B3068A-9DD1-4469-9BFE-5771168DFCBD}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE From 7267acaf9d0fd44df287d1806d8500216d31db8c Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Thu, 13 Mar 2025 11:06:36 +0100 Subject: [PATCH 205/853] Changed all ci hints to Ruei --- .../KE.Items/Items/AdrenalineDrogue.cs | 3 +- KruacentExiled/KE.Items/Items/Defibrilator.cs | 3 +- .../KE.Items/Items/DeployableWall.cs | 2 +- KruacentExiled/KE.Items/Items/HealZone.cs | 2 +- KruacentExiled/KE.Items/Items/ImpactFlash.cs | 2 +- KruacentExiled/KE.Items/Items/Mine.cs | 2 +- KruacentExiled/KE.Items/Items/Molotov.cs | 2 +- KruacentExiled/KE.Items/Items/PressePuree.cs | 2 +- .../KE.Items/Items/SainteGrenada.cs | 2 +- KruacentExiled/KE.Items/Items/Scp3136.cs | 2 +- KruacentExiled/KE.Items/Items/TPGrenada.cs | 2 +- .../KE.Items/Items/TrueDivinePills.cs | 3 +- KruacentExiled/KE.Items/KE.Items.csproj | 4 ++ KruacentExiled/KE.Items/KECustomGrenade.cs | 28 ++++++++ KruacentExiled/KE.Items/KECustomItem.cs | 31 ++++---- .../KE.Items/Lights/LightsHandler.cs | 2 +- .../KE.Utils/Display/DisplayPlayer.cs | 70 +++++++++++++++++++ .../KE.Utils/Display/HintPlacement.cs | 15 ++++ KruacentExiled/KE.Utils/KE.Utils.csproj | 9 +++ KruacentExiled/KE.Utils/KEHints.cs | 33 --------- KruacentExiled/KE.Utils/RueIHint.cs | 37 ---------- 21 files changed, 155 insertions(+), 101 deletions(-) create mode 100644 KruacentExiled/KE.Items/KECustomGrenade.cs create mode 100644 KruacentExiled/KE.Utils/Display/DisplayPlayer.cs create mode 100644 KruacentExiled/KE.Utils/Display/HintPlacement.cs delete mode 100644 KruacentExiled/KE.Utils/KEHints.cs delete mode 100644 KruacentExiled/KE.Utils/RueIHint.cs diff --git a/KruacentExiled/KE.Items/Items/AdrenalineDrogue.cs b/KruacentExiled/KE.Items/Items/AdrenalineDrogue.cs index 1e27bfc0..d99fccc3 100644 --- a/KruacentExiled/KE.Items/Items/AdrenalineDrogue.cs +++ b/KruacentExiled/KE.Items/Items/AdrenalineDrogue.cs @@ -12,10 +12,11 @@ using CustomPlayerEffects; using KE.Items.Interface; using System.Linq; +using KE.Items; /// [CustomItem(ItemType.Adrenaline)] -public class AdrenalineDrogue : CustomItem, ILumosItem +public class AdrenalineDrogue : KECustomItem, ILumosItem { /// public override uint Id { get; set; } = 1042; diff --git a/KruacentExiled/KE.Items/Items/Defibrilator.cs b/KruacentExiled/KE.Items/Items/Defibrilator.cs index d1c19b03..0b7d4a76 100644 --- a/KruacentExiled/KE.Items/Items/Defibrilator.cs +++ b/KruacentExiled/KE.Items/Items/Defibrilator.cs @@ -10,9 +10,10 @@ using UnityEngine; using System.Linq; using KE.Items.Interface; +using KE.Items; [CustomItem(ItemType.SCP1853)] -public class Defibrilator : CustomItem, ILumosItem +public class Defibrilator : KECustomItem, ILumosItem { public override uint Id { get; set; } = 1041; public override string Name { get; set; } = "Defibrilator"; diff --git a/KruacentExiled/KE.Items/Items/DeployableWall.cs b/KruacentExiled/KE.Items/Items/DeployableWall.cs index 60ec9d66..34fa98d6 100644 --- a/KruacentExiled/KE.Items/Items/DeployableWall.cs +++ b/KruacentExiled/KE.Items/Items/DeployableWall.cs @@ -13,7 +13,7 @@ namespace KE.Items.Items { [CustomItem(ItemType.KeycardJanitor)] - public class DeployableWall : CustomItem, ILumosItem, ISwichableEffect + public class DeployableWall : KECustomItem, ILumosItem, ISwichableEffect { public override uint Id { get; set; } = 1048; diff --git a/KruacentExiled/KE.Items/Items/HealZone.cs b/KruacentExiled/KE.Items/Items/HealZone.cs index bdcc6328..2c5d0774 100644 --- a/KruacentExiled/KE.Items/Items/HealZone.cs +++ b/KruacentExiled/KE.Items/Items/HealZone.cs @@ -14,7 +14,7 @@ namespace KE.Items.Items { [CustomItem(ItemType.GrenadeFlash)] - public class HealZone : CustomGrenade, ILumosItem, ISwichableEffect + public class HealZone : KECustomGrenade, ILumosItem, ISwichableEffect { public override uint Id { get; set; } = 1051; public override string Name { get; set; } = "Heal Zone"; diff --git a/KruacentExiled/KE.Items/Items/ImpactFlash.cs b/KruacentExiled/KE.Items/Items/ImpactFlash.cs index 24977a8a..6f2c2f1a 100644 --- a/KruacentExiled/KE.Items/Items/ImpactFlash.cs +++ b/KruacentExiled/KE.Items/Items/ImpactFlash.cs @@ -7,7 +7,7 @@ namespace KE.Items.Items { [CustomItem(ItemType.GrenadeFlash)] - public class ImpactFlash : CustomGrenade + public class ImpactFlash : KECustomGrenade { public override uint Id { get; set; } = 1052; public override string Name { get; set; } = "Impact Flash"; diff --git a/KruacentExiled/KE.Items/Items/Mine.cs b/KruacentExiled/KE.Items/Items/Mine.cs index c99019a8..345b28f2 100644 --- a/KruacentExiled/KE.Items/Items/Mine.cs +++ b/KruacentExiled/KE.Items/Items/Mine.cs @@ -16,7 +16,7 @@ namespace KE.Items.Items { [CustomItem(ItemType.KeycardJanitor)] - public class Mine : CustomItem, ILumosItem, ISwichableEffect + public class Mine : KECustomItem, ILumosItem, ISwichableEffect { public override uint Id { get; set; } = 1053; public override string Name { get; set; } = "Mine"; diff --git a/KruacentExiled/KE.Items/Items/Molotov.cs b/KruacentExiled/KE.Items/Items/Molotov.cs index 68618379..6ba5909e 100644 --- a/KruacentExiled/KE.Items/Items/Molotov.cs +++ b/KruacentExiled/KE.Items/Items/Molotov.cs @@ -10,7 +10,7 @@ namespace KE.Items.Items { [CustomItem(ItemType.GrenadeFlash)] - public class Molotov : CustomGrenade, ILumosItem, ISwichableEffect + public class Molotov : KECustomGrenade, ILumosItem, ISwichableEffect { public override uint Id { get; set; } = 1049; public override string Name { get; set; } = "Cocktail Molotov"; diff --git a/KruacentExiled/KE.Items/Items/PressePuree.cs b/KruacentExiled/KE.Items/Items/PressePuree.cs index 907b5fc9..181fc612 100644 --- a/KruacentExiled/KE.Items/Items/PressePuree.cs +++ b/KruacentExiled/KE.Items/Items/PressePuree.cs @@ -11,7 +11,7 @@ namespace KE.Items.Items { [CustomItem(ItemType.GrenadeHE)] - public class PressePuree : CustomGrenade + public class PressePuree : KECustomGrenade { public override uint Id { get; set; } = 1046; public override string Name { get; set; } = "Presse Purée"; diff --git a/KruacentExiled/KE.Items/Items/SainteGrenada.cs b/KruacentExiled/KE.Items/Items/SainteGrenada.cs index 34f85af2..35cce201 100644 --- a/KruacentExiled/KE.Items/Items/SainteGrenada.cs +++ b/KruacentExiled/KE.Items/Items/SainteGrenada.cs @@ -15,7 +15,7 @@ namespace KE.Items.Items { [CustomItem(ItemType.GrenadeHE)] - public class SainteGrenada : CustomGrenade, ILumosItem + public class SainteGrenada : KECustomGrenade, ILumosItem { public override uint Id { get; set; } = 1055; public override string Name { get; set; } = "Sainte Grenada"; diff --git a/KruacentExiled/KE.Items/Items/Scp3136.cs b/KruacentExiled/KE.Items/Items/Scp3136.cs index 7ecb0ff0..dbd91799 100644 --- a/KruacentExiled/KE.Items/Items/Scp3136.cs +++ b/KruacentExiled/KE.Items/Items/Scp3136.cs @@ -18,7 +18,7 @@ namespace KE.Items.Items { [CustomItem(ItemType.SCP1576)] - public class Scp3136 : CustomItem + public class Scp3136 : KECustomItem { public override uint Id { get; set; } = 1057; public override string Name { get; set; } = "SCP-3136"; diff --git a/KruacentExiled/KE.Items/Items/TPGrenada.cs b/KruacentExiled/KE.Items/Items/TPGrenada.cs index dab60f57..0e4c45da 100644 --- a/KruacentExiled/KE.Items/Items/TPGrenada.cs +++ b/KruacentExiled/KE.Items/Items/TPGrenada.cs @@ -17,7 +17,7 @@ namespace KE.Items.Items { [CustomItem(ItemType.GrenadeHE)] - public class TPGrenada : CustomGrenade, ILumosItem, ISwichableEffect + public class TPGrenada : KECustomGrenade, ILumosItem, ISwichableEffect { public override uint Id { get; set; } = 1045; diff --git a/KruacentExiled/KE.Items/Items/TrueDivinePills.cs b/KruacentExiled/KE.Items/Items/TrueDivinePills.cs index c40a825a..b65d5f22 100644 --- a/KruacentExiled/KE.Items/Items/TrueDivinePills.cs +++ b/KruacentExiled/KE.Items/Items/TrueDivinePills.cs @@ -15,10 +15,11 @@ using KE.Items.Interface; using Exiled.CustomItems.API.EventArgs; using Exiled.Events.EventArgs.Scp914; +using KE.Items; /// [CustomItem(ItemType.SCP500)] -public class TrueDivinePills : CustomItem, ILumosItem +public class TrueDivinePills : KECustomItem, ILumosItem { /// public override uint Id { get; set; } = 1050; diff --git a/KruacentExiled/KE.Items/KE.Items.csproj b/KruacentExiled/KE.Items/KE.Items.csproj index eb2b02ce..5de4e5c1 100644 --- a/KruacentExiled/KE.Items/KE.Items.csproj +++ b/KruacentExiled/KE.Items/KE.Items.csproj @@ -8,6 +8,10 @@ + + + + diff --git a/KruacentExiled/KE.Items/KECustomGrenade.cs b/KruacentExiled/KE.Items/KECustomGrenade.cs new file mode 100644 index 00000000..b91a3f07 --- /dev/null +++ b/KruacentExiled/KE.Items/KECustomGrenade.cs @@ -0,0 +1,28 @@ +using Exiled.API.Features; +using Exiled.API.Features.Items; +using Exiled.CustomItems; +using Exiled.CustomItems.API.Features; +using KE.Items.Interface; +using KE.Utils.Display; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace KE.Items +{ + public abstract class KECustomGrenade : CustomGrenade + { + + protected override void ShowPickedUpMessage(Player player) + { + KECustomItem.Message(this,player); + } + + protected override void ShowSelectedMessage(Player player) + { + KECustomItem.Message(this, player); + } + } +} diff --git a/KruacentExiled/KE.Items/KECustomItem.cs b/KruacentExiled/KE.Items/KECustomItem.cs index daf81219..65335722 100644 --- a/KruacentExiled/KE.Items/KECustomItem.cs +++ b/KruacentExiled/KE.Items/KECustomItem.cs @@ -3,11 +3,13 @@ using Exiled.CustomItems; using Exiled.CustomItems.API.Features; using KE.Items.Interface; +using KE.Utils.Display; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; +using System.Xml.Linq; namespace KE.Items { @@ -16,36 +18,29 @@ public abstract class KECustomItem : CustomItem protected override void ShowPickedUpMessage(Player player) { - if (CustomItems.Instance.Config.PickedUpHint.Show) - { - string show = string.Format(CustomItems.Instance.Config.PickedUpHint.Content, Name, Description) + "\n"; - if (this is IUpgradableCustomItem ci) - { - foreach(var a in ci.Upgrade) - { - show += $"{a.Value.Chance}% chance of upgrading on {a.Key}\n"; - } - } - - player.ShowHint(show, (int)CustomItems.Instance.Config.PickedUpHint.Duration); - - } + Message(this, player); } protected override void ShowSelectedMessage(Player player) + { + Message(this, player); + } + + + internal static void Message(CustomItem c,Player player) { if (CustomItems.Instance.Config.PickedUpHint.Show) { - string show = string.Format(CustomItems.Instance.Config.PickedUpHint.Content, Name, Description) + "\n"; - if (this is IUpgradableCustomItem ci) + string show = string.Format(CustomItems.Instance.Config.PickedUpHint.Content, c.Name, c.Description) + "\n"; + if (c is IUpgradableCustomItem ci) { foreach (var a in ci.Upgrade) { show += $"{a.Value.Chance}% chance of upgrading on {a.Key}\n"; } } - - player.ShowHint(show, (int)CustomItems.Instance.Config.PickedUpHint.Duration); + DisplayPlayer.Get(player).Hint((float)HintPlacement.CustomItem, show, (int)CustomItems.Instance.Config.PickedUpHint.Duration); + //player.ShowHint(show, (int)CustomItems.Instance.Config.PickedUpHint.Duration); } } diff --git a/KruacentExiled/KE.Items/Lights/LightsHandler.cs b/KruacentExiled/KE.Items/Lights/LightsHandler.cs index fe538e19..3634aa56 100644 --- a/KruacentExiled/KE.Items/Lights/LightsHandler.cs +++ b/KruacentExiled/KE.Items/Lights/LightsHandler.cs @@ -95,7 +95,7 @@ private IEnumerator LightP() } } } - catch (Exception e) + catch (Exception) { } diff --git a/KruacentExiled/KE.Utils/Display/DisplayPlayer.cs b/KruacentExiled/KE.Utils/Display/DisplayPlayer.cs new file mode 100644 index 00000000..74dad6a4 --- /dev/null +++ b/KruacentExiled/KE.Utils/Display/DisplayPlayer.cs @@ -0,0 +1,70 @@ +using Exiled.API.Features; +using MEC; +using RueI.Displays; +using RueI.Elements; +using RueI.Elements.Enums; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace KE.Utils.Display +{ + public class DisplayPlayer + { + private static Dictionary _displays = new(); + private RueI.Displays.Display _display; + private Player _player; + public Player Player { get { return _player; } } + public static DisplayPlayer Get(Player player) + { + if (!_displays.ContainsKey(player)) + _displays.Add(player, new DisplayPlayer(player)); + return _displays[player]; + } + + public DisplayPlayer(Player player) + { + _player = player; + _display = new (DisplayCore.Get(player.ReferenceHub)); + } + + public Element Hint(float position, string text) + { + SetElement element = new(position, text); + _display.Elements.Add(element); + UpdateCore(_player); + return element; + } + + + public Element Hint(float position,string text,float seconds) + { + SetElement element = new(position, text); + _display.Elements.Add(element); + UpdateCore(_player); + Timing.CallDelayed(seconds, () => + { + _display.Elements.Remove(element); + UpdateCore(_player); + }); + return element; + } + + public bool RemoveHint(Element elem) + { + bool result = _display.Elements.Remove(elem); + UpdateCore(_player); + return result; + } + + + public static void UpdateCore(Player player) => DisplayCore.Get(player.ReferenceHub).Update(); + + + } + + + +} diff --git a/KruacentExiled/KE.Utils/Display/HintPlacement.cs b/KruacentExiled/KE.Utils/Display/HintPlacement.cs new file mode 100644 index 00000000..f74223de --- /dev/null +++ b/KruacentExiled/KE.Utils/Display/HintPlacement.cs @@ -0,0 +1,15 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace KE.Utils.Display +{ + public enum HintPlacement + { + GlobalEvent = 900, + CustomItem = 200, + CustomRole = 400, + } +} diff --git a/KruacentExiled/KE.Utils/KE.Utils.csproj b/KruacentExiled/KE.Utils/KE.Utils.csproj index 4a0ebe67..72133b13 100644 --- a/KruacentExiled/KE.Utils/KE.Utils.csproj +++ b/KruacentExiled/KE.Utils/KE.Utils.csproj @@ -1,6 +1,7 @@  + 13.0 net48 @@ -18,4 +19,12 @@ + + if not "$(EXILED_DEV_REFERENCES)"=="" copy /y "$(OutputPath)$(AssemblyName).dll" "$(EXILED_DEV_REFERENCES)\Plugins\" + + + if [[ ! -z "$EXILED_DEV_REFERENCES" ]]; then cp "$(OutputPath)$(AssemblyName).dll" "$EXILED_DEV_REFERENCES/Plugins/"; fi + + + diff --git a/KruacentExiled/KE.Utils/KEHints.cs b/KruacentExiled/KE.Utils/KEHints.cs deleted file mode 100644 index a270ecb7..00000000 --- a/KruacentExiled/KE.Utils/KEHints.cs +++ /dev/null @@ -1,33 +0,0 @@ -using Exiled.API.Features; -using System; -using RueI.Extensions; -using RueI.Displays; - -namespace KE.Utils -{ - public static class KEHint - { - - public static void ShowHint(this Player player, RueIHint rueIHint) - { - ShowHint(player, rueIHint.Hint, rueIHint.Position); - } - - public static void ShowHint(this Player player, Hint hint, float position) - { - ShowHint(player, hint.Content, position, TimeSpan.FromSeconds(hint.Duration)); - } - public static void ShowHint(this Player p, string message, float position, TimeSpan timeSpan) - { - ShowHint(p.ReferenceHub, message, position, timeSpan); - } - - public static void ShowHint(ReferenceHub hub, string message, float position, TimeSpan timeSpan) - { - DisplayCore c = DisplayCore.Get(hub); - - c.SetElemTemp(message, position, timeSpan, new RueI.Displays.Scheduling.TimedElemRef()); - } - - } -} diff --git a/KruacentExiled/KE.Utils/RueIHint.cs b/KruacentExiled/KE.Utils/RueIHint.cs deleted file mode 100644 index b3bacdd2..00000000 --- a/KruacentExiled/KE.Utils/RueIHint.cs +++ /dev/null @@ -1,37 +0,0 @@ -using Exiled.API.Features; -using Exiled.Events.Commands.PluginManager; -using RueI; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace KE.Utils -{ - - /// - /// Hint with position - /// - public class RueIHint - { - public Hint Hint { get; set; } - public float Position { get; set; } - public RueIHint(Hint hint,float position) - { - Hint = hint; - Position = position; - } - public RueIHint(string content, float duration = 3f, bool show = true, float position = 0) - { - Hint = new Hint(content,duration,show); - Position = position; - - } - public RueIHint() - { - Hint = new Hint(); - Position = 0; - } - } -} From 2bd0ac7bd828624bb84aeb6cff21b7e799a810c6 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Thu, 13 Mar 2025 11:09:20 +0100 Subject: [PATCH 206/853] added utils from customrole --- .../KE.Utils/Display/DisplayPlayer.cs | 70 +++++++++++++++++++ .../KE.Utils/Display/HintPlacement.cs | 15 ++++ .../KE.Utils/Extensions/PlayerExtension.cs | 35 ++++++++++ .../KE.Utils/Extensions/RoomExtension.cs | 12 ++++ KruacentExiled/KE.Utils/KE.Utils.csproj | 30 ++++++++ KruacentExiled/KruacentExiled.sln | 6 ++ 6 files changed, 168 insertions(+) create mode 100644 KruacentExiled/KE.Utils/Display/DisplayPlayer.cs create mode 100644 KruacentExiled/KE.Utils/Display/HintPlacement.cs create mode 100644 KruacentExiled/KE.Utils/Extensions/PlayerExtension.cs create mode 100644 KruacentExiled/KE.Utils/Extensions/RoomExtension.cs create mode 100644 KruacentExiled/KE.Utils/KE.Utils.csproj diff --git a/KruacentExiled/KE.Utils/Display/DisplayPlayer.cs b/KruacentExiled/KE.Utils/Display/DisplayPlayer.cs new file mode 100644 index 00000000..74dad6a4 --- /dev/null +++ b/KruacentExiled/KE.Utils/Display/DisplayPlayer.cs @@ -0,0 +1,70 @@ +using Exiled.API.Features; +using MEC; +using RueI.Displays; +using RueI.Elements; +using RueI.Elements.Enums; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace KE.Utils.Display +{ + public class DisplayPlayer + { + private static Dictionary _displays = new(); + private RueI.Displays.Display _display; + private Player _player; + public Player Player { get { return _player; } } + public static DisplayPlayer Get(Player player) + { + if (!_displays.ContainsKey(player)) + _displays.Add(player, new DisplayPlayer(player)); + return _displays[player]; + } + + public DisplayPlayer(Player player) + { + _player = player; + _display = new (DisplayCore.Get(player.ReferenceHub)); + } + + public Element Hint(float position, string text) + { + SetElement element = new(position, text); + _display.Elements.Add(element); + UpdateCore(_player); + return element; + } + + + public Element Hint(float position,string text,float seconds) + { + SetElement element = new(position, text); + _display.Elements.Add(element); + UpdateCore(_player); + Timing.CallDelayed(seconds, () => + { + _display.Elements.Remove(element); + UpdateCore(_player); + }); + return element; + } + + public bool RemoveHint(Element elem) + { + bool result = _display.Elements.Remove(elem); + UpdateCore(_player); + return result; + } + + + public static void UpdateCore(Player player) => DisplayCore.Get(player.ReferenceHub).Update(); + + + } + + + +} diff --git a/KruacentExiled/KE.Utils/Display/HintPlacement.cs b/KruacentExiled/KE.Utils/Display/HintPlacement.cs new file mode 100644 index 00000000..f74223de --- /dev/null +++ b/KruacentExiled/KE.Utils/Display/HintPlacement.cs @@ -0,0 +1,15 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace KE.Utils.Display +{ + public enum HintPlacement + { + GlobalEvent = 900, + CustomItem = 200, + CustomRole = 400, + } +} diff --git a/KruacentExiled/KE.Utils/Extensions/PlayerExtension.cs b/KruacentExiled/KE.Utils/Extensions/PlayerExtension.cs new file mode 100644 index 00000000..fd6b85d9 --- /dev/null +++ b/KruacentExiled/KE.Utils/Extensions/PlayerExtension.cs @@ -0,0 +1,35 @@ +using Exiled.API.Features; +using Mirror; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using UnityEngine; + +namespace KE.Utils.Extensions +{ + public static class PlayerExtension + { + public static void SetFakeInvis(this Player p, IEnumerable viewers) + { + Vector3 pos = p.Position; + + try + { + p.ReferenceHub.transform.localPosition = Vector3.zero; + foreach (Player viewer in viewers) + { + Server.SendSpawnMessage.Invoke(null, new object[2] { viewer.NetworkIdentity, viewer.Connection }); + } + + p.ReferenceHub.transform.localPosition = pos; + } + catch (Exception arg) + { + Log.Error(string.Format("{0}: {1}", "SetFakeInvis", arg)); + } + } + + } +} diff --git a/KruacentExiled/KE.Utils/Extensions/RoomExtension.cs b/KruacentExiled/KE.Utils/Extensions/RoomExtension.cs new file mode 100644 index 00000000..35fee2e8 --- /dev/null +++ b/KruacentExiled/KE.Utils/Extensions/RoomExtension.cs @@ -0,0 +1,12 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace KE.Utils.Extensions +{ + internal class RoomExtension + { + } +} diff --git a/KruacentExiled/KE.Utils/KE.Utils.csproj b/KruacentExiled/KE.Utils/KE.Utils.csproj new file mode 100644 index 00000000..72133b13 --- /dev/null +++ b/KruacentExiled/KE.Utils/KE.Utils.csproj @@ -0,0 +1,30 @@ + + + + 13.0 + net48 + + + + + + + + + + + + + + + + + + if not "$(EXILED_DEV_REFERENCES)"=="" copy /y "$(OutputPath)$(AssemblyName).dll" "$(EXILED_DEV_REFERENCES)\Plugins\" + + + if [[ ! -z "$EXILED_DEV_REFERENCES" ]]; then cp "$(OutputPath)$(AssemblyName).dll" "$EXILED_DEV_REFERENCES/Plugins/"; fi + + + + diff --git a/KruacentExiled/KruacentExiled.sln b/KruacentExiled/KruacentExiled.sln index 41509eae..ed50f8ef 100644 --- a/KruacentExiled/KruacentExiled.sln +++ b/KruacentExiled/KruacentExiled.sln @@ -15,6 +15,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "KE.GlobalEventFramework.Exa EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "KE.CustomRoles", "KE.CustomRoles\KE.CustomRoles.csproj", "{4AA4C3E0-E62F-49CE-AD80-0B5C6249EB48}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "KE.Utils", "KE.Utils\KE.Utils.csproj", "{7B02C0D1-B48F-4D82-B882-88AB0171FCDE}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -45,6 +47,10 @@ Global {4AA4C3E0-E62F-49CE-AD80-0B5C6249EB48}.Debug|Any CPU.Build.0 = Debug|Any CPU {4AA4C3E0-E62F-49CE-AD80-0B5C6249EB48}.Release|Any CPU.ActiveCfg = Release|Any CPU {4AA4C3E0-E62F-49CE-AD80-0B5C6249EB48}.Release|Any CPU.Build.0 = Release|Any CPU + {7B02C0D1-B48F-4D82-B882-88AB0171FCDE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {7B02C0D1-B48F-4D82-B882-88AB0171FCDE}.Debug|Any CPU.Build.0 = Debug|Any CPU + {7B02C0D1-B48F-4D82-B882-88AB0171FCDE}.Release|Any CPU.ActiveCfg = Release|Any CPU + {7B02C0D1-B48F-4D82-B882-88AB0171FCDE}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE From cff12bd1b04a7f7a3c6c94856ef2946d73891ed5 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Thu, 13 Mar 2025 11:46:38 +0100 Subject: [PATCH 207/853] changed hint to reui --- .../KE.CustomRoles/API/GlobalCustomRole.cs | 3 ++- .../KE.CustomRoles/API/KECustomRole.cs | 20 +++++++++++++++++++ .../CR/ChaosInsurgency/LeRusse.cs | 4 ++-- .../KE.CustomRoles/CR/ClassD/Enfant.cs | 4 ++-- .../KE.CustomRoles/CR/Guard/ChiefGuard.cs | 4 ++-- .../KE.CustomRoles/CR/Guard/Guard914.cs | 4 ++-- .../KE.CustomRoles/CR/Human/Asthmatique.cs | 2 +- KruacentExiled/KE.CustomRoles/CR/MTF/Tank.cs | 4 ++-- .../KE.CustomRoles/CR/MTF/Terroriste.cs | 4 ++-- .../CR/Scientist/GambleAddict.cs | 4 ++-- .../CR/Scientist/ZoneManager.cs | 4 ++-- .../KE.CustomRoles/KE.CustomRoles.csproj | 4 ++++ 12 files changed, 43 insertions(+), 18 deletions(-) create mode 100644 KruacentExiled/KE.CustomRoles/API/KECustomRole.cs diff --git a/KruacentExiled/KE.CustomRoles/API/GlobalCustomRole.cs b/KruacentExiled/KE.CustomRoles/API/GlobalCustomRole.cs index 12505d54..21df8642 100644 --- a/KruacentExiled/KE.CustomRoles/API/GlobalCustomRole.cs +++ b/KruacentExiled/KE.CustomRoles/API/GlobalCustomRole.cs @@ -17,7 +17,8 @@ namespace KE.CustomRoles.API { - public abstract class GlobalCustomRole : CustomRole + + public abstract class GlobalCustomRole : KECustomRole { public override RoleTypeId Role { get; set; } = RoleTypeId.None; public abstract SideEnum Side { get; set; } diff --git a/KruacentExiled/KE.CustomRoles/API/KECustomRole.cs b/KruacentExiled/KE.CustomRoles/API/KECustomRole.cs new file mode 100644 index 00000000..46acb960 --- /dev/null +++ b/KruacentExiled/KE.CustomRoles/API/KECustomRole.cs @@ -0,0 +1,20 @@ +using Exiled.CustomRoles.API.Features; +using KE.Utils.Display; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace KE.CustomRoles.API +{ + public abstract class KECustomRole : CustomRole + { + public override bool IgnoreSpawnSystem { get; set; } = true; + protected override void ShowMessage(Exiled.API.Features.Player player) + { + DisplayPlayer.Get(player).Hint((float)HintPlacement.CustomItem, ""+ string.Format(Exiled.CustomRoles.CustomRoles.Instance.Config.GotRoleHint.Content+ "", Name, Description), Exiled.CustomRoles.CustomRoles.Instance.Config.GotRoleHint.Duration); + + } + } +} diff --git a/KruacentExiled/KE.CustomRoles/CR/ChaosInsurgency/LeRusse.cs b/KruacentExiled/KE.CustomRoles/CR/ChaosInsurgency/LeRusse.cs index 6b3aabdd..9af7c2ff 100644 --- a/KruacentExiled/KE.CustomRoles/CR/ChaosInsurgency/LeRusse.cs +++ b/KruacentExiled/KE.CustomRoles/CR/ChaosInsurgency/LeRusse.cs @@ -1,5 +1,6 @@ using Exiled.API.Enums; using Exiled.API.Features.Attributes; +using KE.CustomRoles.API; using PlayerRoles; using System.Collections.Generic; using UnityEngine; @@ -7,7 +8,7 @@ namespace KE.CustomRoles.CR.ClassD { [CustomRole(RoleTypeId.ChaosConscript)] - internal class Russe : Exiled.CustomRoles.API.Features.CustomRole + internal class Russe : KECustomRole { public override string Name { get; set; } = "Russe"; public override string Description { get; set; } = "Tu es un maitre de jeu \ntu dois faire la roulette russe avec les autres joueurs"; @@ -17,7 +18,6 @@ internal class Russe : Exiled.CustomRoles.API.Features.CustomRole public override RoleTypeId Role { get; set; } = RoleTypeId.ChaosConscript; public override bool KeepRoleOnDeath { get; set; } = false; public override bool KeepRoleOnChangingRole { get; set; } = false; - public override bool IgnoreSpawnSystem { get; set; } = true; public override float SpawnChance { get; set; } = 100; public override Vector3 Scale { get; set; } = new Vector3(1.4f, 1.2f, 1.3f); diff --git a/KruacentExiled/KE.CustomRoles/CR/ClassD/Enfant.cs b/KruacentExiled/KE.CustomRoles/CR/ClassD/Enfant.cs index 28364e25..c85496a3 100644 --- a/KruacentExiled/KE.CustomRoles/CR/ClassD/Enfant.cs +++ b/KruacentExiled/KE.CustomRoles/CR/ClassD/Enfant.cs @@ -1,5 +1,6 @@ using Exiled.API.Features.Attributes; using InventorySystem.Items.Usables.Scp330; +using KE.CustomRoles.API; using PlayerRoles; using System.Collections.Generic; using UnityEngine; @@ -7,7 +8,7 @@ namespace KE.CustomRoles.CR.ClassD { [CustomRole(RoleTypeId.ClassD)] - internal class Enfant : Exiled.CustomRoles.API.Features.CustomRole + internal class Enfant : KECustomRole { public override string Name { get; set; } = "enfant"; public override string Description { get; set; } = "Tu es un Enfant \ndo not the kid \ntu commences avec un bonbon arc-en-ciel \n t'es un peu plus petit que la normal"; @@ -17,7 +18,6 @@ internal class Enfant : Exiled.CustomRoles.API.Features.CustomRole public override RoleTypeId Role { get; set; } = RoleTypeId.ClassD; public override bool KeepRoleOnDeath { get; set; } = true; public override bool KeepRoleOnChangingRole { get; set; } = true; - public override bool IgnoreSpawnSystem { get; set; } = true; public override float SpawnChance { get; set; } = 100; public override Vector3 Scale { get; set; } = new Vector3(1, 0.75f, 1); diff --git a/KruacentExiled/KE.CustomRoles/CR/Guard/ChiefGuard.cs b/KruacentExiled/KE.CustomRoles/CR/Guard/ChiefGuard.cs index bbccfd2e..145925ab 100644 --- a/KruacentExiled/KE.CustomRoles/CR/Guard/ChiefGuard.cs +++ b/KruacentExiled/KE.CustomRoles/CR/Guard/ChiefGuard.cs @@ -1,12 +1,13 @@ using Exiled.API.Enums; using Exiled.API.Features.Attributes; +using KE.CustomRoles.API; using PlayerRoles; using System.Collections.Generic; namespace KE.CustomRoles.CR.Guard { [CustomRole(RoleTypeId.FacilityGuard)] - internal class ChiefGuard : Exiled.CustomRoles.API.Features.CustomRole + internal class ChiefGuard : KECustomRole { public override string Name { get; set; } = "ChiefGuard"; public override string Description { get; set; } = "Tu es un Chef des gardes du site \nT'as une carte de private \net un crossvec"; @@ -16,7 +17,6 @@ internal class ChiefGuard : Exiled.CustomRoles.API.Features.CustomRole public override RoleTypeId Role { get; set; } = RoleTypeId.FacilityGuard; public override bool KeepRoleOnDeath { get; set; } = false; public override bool KeepRoleOnChangingRole { get; set; } = false; - public override bool IgnoreSpawnSystem { get; set; } = true; public override float SpawnChance { get; set; } = 100; diff --git a/KruacentExiled/KE.CustomRoles/CR/Guard/Guard914.cs b/KruacentExiled/KE.CustomRoles/CR/Guard/Guard914.cs index e8e7a615..60eade98 100644 --- a/KruacentExiled/KE.CustomRoles/CR/Guard/Guard914.cs +++ b/KruacentExiled/KE.CustomRoles/CR/Guard/Guard914.cs @@ -1,13 +1,14 @@ using Exiled.API.Enums; using Exiled.API.Features.Attributes; using Exiled.API.Features.Spawn; +using KE.CustomRoles.API; using PlayerRoles; using System.Collections.Generic; namespace KE.CustomRoles.CR.Guard { [CustomRole(RoleTypeId.FacilityGuard)] - internal class Guard914 : Exiled.CustomRoles.API.Features.CustomRole + internal class Guard914 : KECustomRole { public override string Name { get; set; } = "guard914"; public override string Description { get; set; } = "Tu es Le garde de SCP-914 \nTu commences à 914 \nmais on a volé ta carte \net ntm aussi"; @@ -17,7 +18,6 @@ internal class Guard914 : Exiled.CustomRoles.API.Features.CustomRole public override RoleTypeId Role { get; set; } = RoleTypeId.FacilityGuard; public override bool KeepRoleOnDeath { get; set; } = false; public override bool KeepRoleOnChangingRole { get; set; } = false; - public override bool IgnoreSpawnSystem { get; set; } = true; public override SpawnProperties SpawnProperties { get; set; } = new SpawnProperties() { diff --git a/KruacentExiled/KE.CustomRoles/CR/Human/Asthmatique.cs b/KruacentExiled/KE.CustomRoles/CR/Human/Asthmatique.cs index d73fb8cd..2638ad5b 100644 --- a/KruacentExiled/KE.CustomRoles/CR/Human/Asthmatique.cs +++ b/KruacentExiled/KE.CustomRoles/CR/Human/Asthmatique.cs @@ -20,7 +20,7 @@ internal class Asthmatique : GlobalCustomRole public override int MaxHealth { get; set; } = 100; public override bool KeepRoleOnDeath { get; set; } = true; public override bool KeepRoleOnChangingRole { get; set; } = true; - public override bool IgnoreSpawnSystem { get; set; } = true; + protected override void RoleAdded(Player player) { player.EnableEffect(EffectType.Scp1853, -1, true); diff --git a/KruacentExiled/KE.CustomRoles/CR/MTF/Tank.cs b/KruacentExiled/KE.CustomRoles/CR/MTF/Tank.cs index 0d3f69c3..d627b444 100644 --- a/KruacentExiled/KE.CustomRoles/CR/MTF/Tank.cs +++ b/KruacentExiled/KE.CustomRoles/CR/MTF/Tank.cs @@ -7,11 +7,12 @@ using System.Collections.Generic; using UnityEngine; using System; +using KE.CustomRoles.API; namespace KE.CustomRoles.CR.ClassD { [CustomRole(RoleTypeId.NtfCaptain)] - internal class Tank : Exiled.CustomRoles.API.Features.CustomRole + internal class Tank : KECustomRole { public override string Name { get; set; } = "Tank"; public override string Description { get; set; } = "Tu es un TANK tu es débuff mais ta force de tir est démultiplié (fait attention à tes balles)"; @@ -21,7 +22,6 @@ internal class Tank : Exiled.CustomRoles.API.Features.CustomRole public override RoleTypeId Role { get; set; } = RoleTypeId.NtfCaptain; public override bool KeepRoleOnDeath { get; set; } = false; public override bool KeepRoleOnChangingRole { get; set; } = false; - public override bool IgnoreSpawnSystem { get; set; } = true; public override float SpawnChance { get; set; } = 100; public override Vector3 Scale { get; set; } = new Vector3(1.15f, 1.15f, 1.15f); diff --git a/KruacentExiled/KE.CustomRoles/CR/MTF/Terroriste.cs b/KruacentExiled/KE.CustomRoles/CR/MTF/Terroriste.cs index c52af3ce..1bb3d383 100644 --- a/KruacentExiled/KE.CustomRoles/CR/MTF/Terroriste.cs +++ b/KruacentExiled/KE.CustomRoles/CR/MTF/Terroriste.cs @@ -1,5 +1,6 @@ using Exiled.API.Enums; using Exiled.API.Features.Attributes; +using KE.CustomRoles.API; using PlayerRoles; using System.Collections.Generic; using UnityEngine; @@ -7,7 +8,7 @@ namespace KE.CustomRoles.CR.ClassD { [CustomRole(RoleTypeId.NtfSergeant)] - internal class Terroriste : Exiled.CustomRoles.API.Features.CustomRole + internal class Terroriste : KECustomRole { public override string Name { get; set; } = "Terroriste"; public override string Description { get; set; } = "Tu es un Terroriste \nne fait pas exploser la facilité \ntu commences avec des grenades"; @@ -17,7 +18,6 @@ internal class Terroriste : Exiled.CustomRoles.API.Features.CustomRole public override RoleTypeId Role { get; set; } = RoleTypeId.NtfSergeant; public override bool KeepRoleOnDeath { get; set; } = false; public override bool KeepRoleOnChangingRole { get; set; } = false; - public override bool IgnoreSpawnSystem { get; set; } = true; public override float SpawnChance { get; set; } = 100; public override Vector3 Scale { get; set; } = new Vector3(1, 1, 1); diff --git a/KruacentExiled/KE.CustomRoles/CR/Scientist/GambleAddict.cs b/KruacentExiled/KE.CustomRoles/CR/Scientist/GambleAddict.cs index d12d3192..0b41ddec 100644 --- a/KruacentExiled/KE.CustomRoles/CR/Scientist/GambleAddict.cs +++ b/KruacentExiled/KE.CustomRoles/CR/Scientist/GambleAddict.cs @@ -1,4 +1,5 @@ using Exiled.API.Features.Attributes; +using KE.CustomRoles.API; using PlayerRoles; using System.Collections.Generic; using UnityEngine; @@ -6,7 +7,7 @@ namespace KE.CustomRoles.CR.Scientist { [CustomRole(RoleTypeId.Scientist)] - internal class GambleAddict : Exiled.CustomRoles.API.Features.CustomRole + internal class GambleAddict : KECustomRole { public override string Name { get; set; } = "GambleAddict"; public override string Description { get; set; } = "Tu es un Gamble Addict \nT'as trade ton kit et ta carte contre 4 pièces \nfais en bon usage"; @@ -16,7 +17,6 @@ internal class GambleAddict : Exiled.CustomRoles.API.Features.CustomRole public override RoleTypeId Role { get; set; } = RoleTypeId.Scientist; public override bool KeepRoleOnDeath { get; set; } = false; public override bool KeepRoleOnChangingRole { get; set; } = false; - public override bool IgnoreSpawnSystem { get; set; } = true; public override float SpawnChance { get; set; } = 100; public override Vector3 Scale { get; set; } = new Vector3(1, 1, 1); diff --git a/KruacentExiled/KE.CustomRoles/CR/Scientist/ZoneManager.cs b/KruacentExiled/KE.CustomRoles/CR/Scientist/ZoneManager.cs index e92b203f..2e781c30 100644 --- a/KruacentExiled/KE.CustomRoles/CR/Scientist/ZoneManager.cs +++ b/KruacentExiled/KE.CustomRoles/CR/Scientist/ZoneManager.cs @@ -1,6 +1,7 @@ using Exiled.API.Features.Attributes; using Exiled.API.Features.Spawn; using InventorySystem.Items.Keycards; +using KE.CustomRoles.API; using PlayerRoles; using System.Collections.Generic; using UnityEngine; @@ -8,7 +9,7 @@ namespace KE.CustomRoles.CR.Scientist { [CustomRole(RoleTypeId.Scientist)] - internal class ZoneManager : Exiled.CustomRoles.API.Features.CustomRole + internal class ZoneManager : KECustomRole { public override string Name { get; set; } = "ZoneManager"; public override string Description { get; set; } = "Tu es un Zone Manager \nT'as une carte de zone manager (d'où le nom) \nTu commences à heavy \nBon courage..."; @@ -18,7 +19,6 @@ internal class ZoneManager : Exiled.CustomRoles.API.Features.CustomRole public override RoleTypeId Role { get; set; } = RoleTypeId.Scientist; public override bool KeepRoleOnDeath { get; set; } = false; public override bool KeepRoleOnChangingRole { get; set; } = false; - public override bool IgnoreSpawnSystem { get; set; } = true; public override float SpawnChance { get; set; } = 100; diff --git a/KruacentExiled/KE.CustomRoles/KE.CustomRoles.csproj b/KruacentExiled/KE.CustomRoles/KE.CustomRoles.csproj index 446196fc..e798f71f 100644 --- a/KruacentExiled/KE.CustomRoles/KE.CustomRoles.csproj +++ b/KruacentExiled/KE.CustomRoles/KE.CustomRoles.csproj @@ -7,6 +7,10 @@ + + + + From 0aae94cd48042b07cd9a18566b8c305b39924c45 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Thu, 13 Mar 2025 11:52:00 +0100 Subject: [PATCH 208/853] changed alignment text + bold name --- KruacentExiled/KE.Items/KECustomItem.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/KruacentExiled/KE.Items/KECustomItem.cs b/KruacentExiled/KE.Items/KECustomItem.cs index 65335722..c3424381 100644 --- a/KruacentExiled/KE.Items/KECustomItem.cs +++ b/KruacentExiled/KE.Items/KECustomItem.cs @@ -31,7 +31,7 @@ internal static void Message(CustomItem c,Player player) { if (CustomItems.Instance.Config.PickedUpHint.Show) { - string show = string.Format(CustomItems.Instance.Config.PickedUpHint.Content, c.Name, c.Description) + "\n"; + string show = $"{c.Name}\n{c.Description} \n"; if (c is IUpgradableCustomItem ci) { foreach (var a in ci.Upgrade) @@ -39,7 +39,7 @@ internal static void Message(CustomItem c,Player player) show += $"{a.Value.Chance}% chance of upgrading on {a.Key}\n"; } } - DisplayPlayer.Get(player).Hint((float)HintPlacement.CustomItem, show, (int)CustomItems.Instance.Config.PickedUpHint.Duration); + DisplayPlayer.Get(player).Hint((float)HintPlacement.CustomItem, "" +show+"", (int)CustomItems.Instance.Config.PickedUpHint.Duration); //player.ShowHint(show, (int)CustomItems.Instance.Config.PickedUpHint.Duration); } From 5c175eda3f91cc92aa7d77ed97418471ec11945c Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Thu, 13 Mar 2025 11:56:30 +0100 Subject: [PATCH 209/853] bold the name + hardcoded it --- KruacentExiled/KE.CustomRoles/API/KECustomRole.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/KruacentExiled/KE.CustomRoles/API/KECustomRole.cs b/KruacentExiled/KE.CustomRoles/API/KECustomRole.cs index 46acb960..313e8d5a 100644 --- a/KruacentExiled/KE.CustomRoles/API/KECustomRole.cs +++ b/KruacentExiled/KE.CustomRoles/API/KECustomRole.cs @@ -13,8 +13,10 @@ public abstract class KECustomRole : CustomRole public override bool IgnoreSpawnSystem { get; set; } = true; protected override void ShowMessage(Exiled.API.Features.Player player) { - DisplayPlayer.Get(player).Hint((float)HintPlacement.CustomItem, ""+ string.Format(Exiled.CustomRoles.CustomRoles.Instance.Config.GotRoleHint.Content+ "", Name, Description), Exiled.CustomRoles.CustomRoles.Instance.Config.GotRoleHint.Duration); + string show = $"{Name}\n {Description}"; + + DisplayPlayer.Get(player).Hint((float)HintPlacement.CustomItem, ""+ show + "", Exiled.CustomRoles.CustomRoles.Instance.Config.GotRoleHint.Duration); } } } From dcb5215d25bb14bd2a3fc08aa81affda9b0defab Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Thu, 13 Mar 2025 12:01:47 +0100 Subject: [PATCH 210/853] updated utils from custom item --- .../KE.Utils/Display/DisplayPlayer.cs | 70 +++++++++++++++++++ .../KE.Utils/Display/HintPlacement.cs | 15 ++++ KruacentExiled/KE.Utils/KE.Utils.csproj | 9 +++ KruacentExiled/KE.Utils/KEHints.cs | 33 --------- KruacentExiled/KE.Utils/RueIHint.cs | 37 ---------- 5 files changed, 94 insertions(+), 70 deletions(-) create mode 100644 KruacentExiled/KE.Utils/Display/DisplayPlayer.cs create mode 100644 KruacentExiled/KE.Utils/Display/HintPlacement.cs delete mode 100644 KruacentExiled/KE.Utils/KEHints.cs delete mode 100644 KruacentExiled/KE.Utils/RueIHint.cs diff --git a/KruacentExiled/KE.Utils/Display/DisplayPlayer.cs b/KruacentExiled/KE.Utils/Display/DisplayPlayer.cs new file mode 100644 index 00000000..74dad6a4 --- /dev/null +++ b/KruacentExiled/KE.Utils/Display/DisplayPlayer.cs @@ -0,0 +1,70 @@ +using Exiled.API.Features; +using MEC; +using RueI.Displays; +using RueI.Elements; +using RueI.Elements.Enums; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace KE.Utils.Display +{ + public class DisplayPlayer + { + private static Dictionary _displays = new(); + private RueI.Displays.Display _display; + private Player _player; + public Player Player { get { return _player; } } + public static DisplayPlayer Get(Player player) + { + if (!_displays.ContainsKey(player)) + _displays.Add(player, new DisplayPlayer(player)); + return _displays[player]; + } + + public DisplayPlayer(Player player) + { + _player = player; + _display = new (DisplayCore.Get(player.ReferenceHub)); + } + + public Element Hint(float position, string text) + { + SetElement element = new(position, text); + _display.Elements.Add(element); + UpdateCore(_player); + return element; + } + + + public Element Hint(float position,string text,float seconds) + { + SetElement element = new(position, text); + _display.Elements.Add(element); + UpdateCore(_player); + Timing.CallDelayed(seconds, () => + { + _display.Elements.Remove(element); + UpdateCore(_player); + }); + return element; + } + + public bool RemoveHint(Element elem) + { + bool result = _display.Elements.Remove(elem); + UpdateCore(_player); + return result; + } + + + public static void UpdateCore(Player player) => DisplayCore.Get(player.ReferenceHub).Update(); + + + } + + + +} diff --git a/KruacentExiled/KE.Utils/Display/HintPlacement.cs b/KruacentExiled/KE.Utils/Display/HintPlacement.cs new file mode 100644 index 00000000..f74223de --- /dev/null +++ b/KruacentExiled/KE.Utils/Display/HintPlacement.cs @@ -0,0 +1,15 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace KE.Utils.Display +{ + public enum HintPlacement + { + GlobalEvent = 900, + CustomItem = 200, + CustomRole = 400, + } +} diff --git a/KruacentExiled/KE.Utils/KE.Utils.csproj b/KruacentExiled/KE.Utils/KE.Utils.csproj index 4a0ebe67..72133b13 100644 --- a/KruacentExiled/KE.Utils/KE.Utils.csproj +++ b/KruacentExiled/KE.Utils/KE.Utils.csproj @@ -1,6 +1,7 @@  + 13.0 net48 @@ -18,4 +19,12 @@ + + if not "$(EXILED_DEV_REFERENCES)"=="" copy /y "$(OutputPath)$(AssemblyName).dll" "$(EXILED_DEV_REFERENCES)\Plugins\" + + + if [[ ! -z "$EXILED_DEV_REFERENCES" ]]; then cp "$(OutputPath)$(AssemblyName).dll" "$EXILED_DEV_REFERENCES/Plugins/"; fi + + + diff --git a/KruacentExiled/KE.Utils/KEHints.cs b/KruacentExiled/KE.Utils/KEHints.cs deleted file mode 100644 index a270ecb7..00000000 --- a/KruacentExiled/KE.Utils/KEHints.cs +++ /dev/null @@ -1,33 +0,0 @@ -using Exiled.API.Features; -using System; -using RueI.Extensions; -using RueI.Displays; - -namespace KE.Utils -{ - public static class KEHint - { - - public static void ShowHint(this Player player, RueIHint rueIHint) - { - ShowHint(player, rueIHint.Hint, rueIHint.Position); - } - - public static void ShowHint(this Player player, Hint hint, float position) - { - ShowHint(player, hint.Content, position, TimeSpan.FromSeconds(hint.Duration)); - } - public static void ShowHint(this Player p, string message, float position, TimeSpan timeSpan) - { - ShowHint(p.ReferenceHub, message, position, timeSpan); - } - - public static void ShowHint(ReferenceHub hub, string message, float position, TimeSpan timeSpan) - { - DisplayCore c = DisplayCore.Get(hub); - - c.SetElemTemp(message, position, timeSpan, new RueI.Displays.Scheduling.TimedElemRef()); - } - - } -} diff --git a/KruacentExiled/KE.Utils/RueIHint.cs b/KruacentExiled/KE.Utils/RueIHint.cs deleted file mode 100644 index b3bacdd2..00000000 --- a/KruacentExiled/KE.Utils/RueIHint.cs +++ /dev/null @@ -1,37 +0,0 @@ -using Exiled.API.Features; -using Exiled.Events.Commands.PluginManager; -using RueI; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace KE.Utils -{ - - /// - /// Hint with position - /// - public class RueIHint - { - public Hint Hint { get; set; } - public float Position { get; set; } - public RueIHint(Hint hint,float position) - { - Hint = hint; - Position = position; - } - public RueIHint(string content, float duration = 3f, bool show = true, float position = 0) - { - Hint = new Hint(content,duration,show); - Position = position; - - } - public RueIHint() - { - Hint = new Hint(); - Position = 0; - } - } -} From f497eed5f748cdaa34c58f32c71a38b1f076e64a Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Thu, 13 Mar 2025 12:16:49 +0100 Subject: [PATCH 211/853] change the broadcast to reui --- .../API/Feature/MalfunctionDisplay.cs | 11 +++++----- .../GE/SystemMalfunction.cs | 21 ------------------- .../KE.GlobalEventFramework.Examples.csproj | 10 ++++++++- .../GEFE/API/Features/GlobalEvent.cs | 8 ++----- .../KE.GlobalEventFramework.csproj | 20 ++++++++++++++---- .../KE.Utils/Display/HintPlacement.cs | 2 +- 6 files changed, 33 insertions(+), 39 deletions(-) diff --git a/KruacentExiled/KE.GlobalEventFramework.Examples/API/Feature/MalfunctionDisplay.cs b/KruacentExiled/KE.GlobalEventFramework.Examples/API/Feature/MalfunctionDisplay.cs index e3e386ea..d13fd4eb 100644 --- a/KruacentExiled/KE.GlobalEventFramework.Examples/API/Feature/MalfunctionDisplay.cs +++ b/KruacentExiled/KE.GlobalEventFramework.Examples/API/Feature/MalfunctionDisplay.cs @@ -2,6 +2,7 @@ using InventorySystem.Items.Firearms.Modules; using KE.GlobalEventFramework.Examples.API.Interfaces; using KE.Utils; +using KE.Utils.Display; using MEC; using PlayerRoles; using System; @@ -44,20 +45,18 @@ private IEnumerator Tick() - private void ShowAllSpect(RueIHint hint) + private void ShowAllSpect(string hint) { foreach (Player p in Player.List.Where(p => p.Role == RoleTypeId.Spectator)) { - - p.ShowHint(hint); + DisplayPlayer.Get(p).Hint((float)HintPlacement.Effects, hint,RefreshRate+.01f); } } - private RueIHint GetHint() + private string GetHint() { - string content = $" {GetCurrentMalfunction()}\n{GetAllEffect()}"; - return new RueIHint(content,RefreshRate+.1f,true,800); + return $" {GetCurrentMalfunction()}\n{GetAllEffect()}"; } diff --git a/KruacentExiled/KE.GlobalEventFramework.Examples/GE/SystemMalfunction.cs b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/SystemMalfunction.cs index 4310ca97..6632d5ff 100644 --- a/KruacentExiled/KE.GlobalEventFramework.Examples/GE/SystemMalfunction.cs +++ b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/SystemMalfunction.cs @@ -45,7 +45,6 @@ public class SystemMalfunction : GlobalEvent, IStart, IEvent /// Set the cooldown for the BlackoutNDoor /// public int NewCooldown { get; set; } = 180; - private BlackoutNDoor.MainPlugin BlackoutNDoor = null; public static Malfunctions Malfunction { get; private set; } @@ -94,7 +93,6 @@ public void SubscribeEvent() } public void UnsubscribeEvent() { - BlackoutNDoor = null; Exiled.Events.Handlers.Player.Dying -= Malfunction.OnDying; Exiled.Events.Handlers.Scp049.FinishingRecall -= Malfunction.OnFinishingRevive; Malfunction = null; @@ -109,25 +107,6 @@ private IEnumerator EarlyNuke() Log.Debug($"kaboom"); } - private void MoreBlackOutNDoors() - { - try - { - if (BlackoutNDoor != null) - { - if (BlackoutNDoor.ServerHandler != null) - BlackoutNDoor.ServerHandler.Cooldown = NewCooldown; - else - Log.Error("server handler null"); - } - - } - catch(Exception e) - { - Log.Error(e); - } - - } private IEnumerator CheckpointMalfunction(){ Log.Debug("CheckpointMalfunction"); diff --git a/KruacentExiled/KE.GlobalEventFramework.Examples/KE.GlobalEventFramework.Examples.csproj b/KruacentExiled/KE.GlobalEventFramework.Examples/KE.GlobalEventFramework.Examples.csproj index 5b6be12a..5c287b28 100644 --- a/KruacentExiled/KE.GlobalEventFramework.Examples/KE.GlobalEventFramework.Examples.csproj +++ b/KruacentExiled/KE.GlobalEventFramework.Examples/KE.GlobalEventFramework.Examples.csproj @@ -1,11 +1,12 @@  + 13.0 net48 - + @@ -20,4 +21,11 @@ + + if not "$(EXILED_DEV_REFERENCES)"=="" copy /y "$(OutputPath)$(AssemblyName).dll" "$(EXILED_DEV_REFERENCES)\Plugins\" + + + if [[ ! -z "$EXILED_DEV_REFERENCES" ]]; then cp "$(OutputPath)$(AssemblyName).dll" "$EXILED_DEV_REFERENCES/Plugins/"; fi + + diff --git a/KruacentExiled/KE.GlobalEventFramework/GEFE/API/Features/GlobalEvent.cs b/KruacentExiled/KE.GlobalEventFramework/GEFE/API/Features/GlobalEvent.cs index 7bed8feb..ccd572b0 100644 --- a/KruacentExiled/KE.GlobalEventFramework/GEFE/API/Features/GlobalEvent.cs +++ b/KruacentExiled/KE.GlobalEventFramework/GEFE/API/Features/GlobalEvent.cs @@ -4,6 +4,7 @@ using MEC; using KE.GlobalEventFramework.GEFE.API.Interfaces; using System; +using KE.Utils.Display; namespace KE.GlobalEventFramework.GEFE.API.Features { @@ -92,12 +93,7 @@ private static void Show() foreach (Player player in Player.List) { - Exiled.API.Features.Broadcast b = new Exiled.API.Features.Broadcast - { - Content = ShowText(random < MainPlugin.Instance.Config.ChanceRedacted), - Duration = 10 - }; - player.Broadcast(b); + DisplayPlayer.Get(player).Hint((float)HintPlacement.GlobalEvent, ShowText(random < MainPlugin.Instance.Config.ChanceRedacted), 10); } } diff --git a/KruacentExiled/KE.GlobalEventFramework/KE.GlobalEventFramework.csproj b/KruacentExiled/KE.GlobalEventFramework/KE.GlobalEventFramework.csproj index 8031db85..023b12bd 100644 --- a/KruacentExiled/KE.GlobalEventFramework/KE.GlobalEventFramework.csproj +++ b/KruacentExiled/KE.GlobalEventFramework/KE.GlobalEventFramework.csproj @@ -1,17 +1,29 @@  + 13.0 net48 - + - - - + + + + + + + + + if not "$(EXILED_DEV_REFERENCES)"=="" copy /y "$(OutputPath)$(AssemblyName).dll" "$(EXILED_DEV_REFERENCES)\Plugins\" + + + if [[ ! -z "$EXILED_DEV_REFERENCES" ]]; then cp "$(OutputPath)$(AssemblyName).dll" "$EXILED_DEV_REFERENCES/Plugins/"; fi + + diff --git a/KruacentExiled/KE.Utils/Display/HintPlacement.cs b/KruacentExiled/KE.Utils/Display/HintPlacement.cs index f74223de..8d318ec9 100644 --- a/KruacentExiled/KE.Utils/Display/HintPlacement.cs +++ b/KruacentExiled/KE.Utils/Display/HintPlacement.cs @@ -10,6 +10,6 @@ public enum HintPlacement { GlobalEvent = 900, CustomItem = 200, - CustomRole = 400, + Effects = 700, } } From fd5576445bed20ba2a027e535c5c1589c7ea47be Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Thu, 13 Mar 2025 12:46:17 +0100 Subject: [PATCH 212/853] remove spawnpoint to added role --- .../KE.CustomRoles/API/GlobalCustomRole.cs | 22 +--- .../KE.CustomRoles/API/KECustomRole.cs | 117 +++++++++++++++++- KruacentExiled/KE.CustomRoles/MainPlugin.cs | 2 + 3 files changed, 119 insertions(+), 22 deletions(-) diff --git a/KruacentExiled/KE.CustomRoles/API/GlobalCustomRole.cs b/KruacentExiled/KE.CustomRoles/API/GlobalCustomRole.cs index 21df8642..6bc52105 100644 --- a/KruacentExiled/KE.CustomRoles/API/GlobalCustomRole.cs +++ b/KruacentExiled/KE.CustomRoles/API/GlobalCustomRole.cs @@ -29,27 +29,7 @@ public override void AddRole(Player player) Log.Debug($"{Name}: Adding role to {player.Nickname}."); TrackedPlayers.Add(player); - if (!BlacklistedRole.Contains(player.Role)) - { - switch (KeepPositionOnSpawn) - { - case true when KeepInventoryOnSpawn: - player.Role.Set(player.Role, SpawnReason.ForceClass, RoleSpawnFlags.None); - break; - case true: - player.Role.Set(player.Role, SpawnReason.ForceClass, RoleSpawnFlags.AssignInventory); - break; - default: - { - if (KeepInventoryOnSpawn && player.IsAlive) - player.Role.Set(player.Role, SpawnReason.ForceClass, RoleSpawnFlags.UseSpawnpoint); - else - player.Role.Set(player.Role, SpawnReason.ForceClass, RoleSpawnFlags.All); - break; - } - } - } - + Timing.CallDelayed( 0.25f, () => diff --git a/KruacentExiled/KE.CustomRoles/API/KECustomRole.cs b/KruacentExiled/KE.CustomRoles/API/KECustomRole.cs index 313e8d5a..f7b14f77 100644 --- a/KruacentExiled/KE.CustomRoles/API/KECustomRole.cs +++ b/KruacentExiled/KE.CustomRoles/API/KECustomRole.cs @@ -1,10 +1,18 @@ -using Exiled.CustomRoles.API.Features; +using Exiled.API.Enums; +using Exiled.API.Extensions; +using Exiled.API.Features; +using Exiled.API.Features.Pools; +using Exiled.CustomRoles.API.Features; +using InventorySystem.Configs; using KE.Utils.Display; +using MEC; +using PlayerRoles; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; +using UnityEngine; namespace KE.CustomRoles.API { @@ -18,5 +26,112 @@ protected override void ShowMessage(Exiled.API.Features.Player player) DisplayPlayer.Get(player).Hint((float)HintPlacement.CustomItem, ""+ show + "", Exiled.CustomRoles.CustomRoles.Instance.Config.GotRoleHint.Duration); } + + public override void AddRole(Exiled.API.Features.Player player) + { + Exiled.API.Features.Player player2 = player; + Log.Debug(Name + ": Adding role to " + player2.Nickname + "."); + TrackedPlayers.Add(player2); + if (Role != RoleTypeId.None) + { + if (KeepPositionOnSpawn) + { + if (KeepInventoryOnSpawn) + { + player2.Role.Set(Role, SpawnReason.ForceClass, RoleSpawnFlags.None); + } + else + { + player2.Role.Set(Role, SpawnReason.ForceClass, RoleSpawnFlags.AssignInventory); + } + } + else if (KeepInventoryOnSpawn && player2.IsAlive) + { + player2.Role.Set(Role, SpawnReason.ForceClass, RoleSpawnFlags.None); + } + else + { + player2.Role.Set(Role, SpawnReason.ForceClass, RoleSpawnFlags.AssignInventory); + } + } + + Timing.CallDelayed(0.25f, delegate + { + if (!KeepInventoryOnSpawn) + { + Log.Debug(Name + ": Clearing " + player2.Nickname + "'s inventory."); + player2.ClearInventory(); + } + + foreach (string item in Inventory) + { + Log.Debug(Name + ": Adding " + item + " to inventory."); + TryAddItem(player2, item); + } + + if (Ammo.Count > 0) + { + Log.Debug(Name + ": Adding Ammo to " + player2.Nickname + " inventory."); + AmmoType[] values = EnumUtils.Values; + foreach (AmmoType ammoType in values) + { + if (ammoType != 0) + { + player2.SetAmmo(ammoType, (ushort)(Ammo.ContainsKey(ammoType) ? ((Ammo[ammoType] == ushort.MaxValue) ? InventoryLimits.GetAmmoLimit(ammoType.GetItemType(), player2.ReferenceHub) : Ammo[ammoType]) : 0)); + } + } + } + }); + Log.Debug(Name + ": Setting health values."); + player2.Health = MaxHealth; + player2.MaxHealth = MaxHealth; + player2.Scale = Scale; + Vector3 spawnPosition = GetSpawnPosition(); + if (spawnPosition != Vector3.zero) + { + player2.Position = spawnPosition; + } + + Log.Debug(Name + ": Setting player info"); + player2.CustomInfo = player2.CustomName + "\n" + CustomInfo; + player2.InfoArea &= ~(PlayerInfoArea.Nickname | PlayerInfoArea.Role); + if (CustomAbilities != null) + { + foreach (CustomAbility customAbility in CustomAbilities) + { + customAbility.AddAbility(player2); + } + } + + ShowMessage(player2); + ShowBroadcast(player2); + RoleAdded(player2); + player2.UniqueRole = Name; + player2.TryAddCustomRoleFriendlyFire(Name, CustomRoleFFMultiplier); + if (string.IsNullOrEmpty(ConsoleMessage)) + { + return; + } + + StringBuilder stringBuilder = StringBuilderPool.Pool.Get(); + stringBuilder.AppendLine(Name); + stringBuilder.AppendLine(Description); + stringBuilder.AppendLine(); + stringBuilder.AppendLine(ConsoleMessage); + List customAbilities = CustomAbilities; + if (customAbilities != null && customAbilities.Count > 0) + { + stringBuilder.AppendLine(AbilityUsage); + stringBuilder.AppendLine("Your custom abilities are:"); + for (int i = 1; i < CustomAbilities.Count + 1; i++) + { + stringBuilder.AppendLine($"{i}. {CustomAbilities[i - 1].Name} - {CustomAbilities[i - 1].Description}"); + } + + stringBuilder.AppendLine("You can keybind the command for this ability by using \"cmdbind .special KEY\", where KEY is any un-used letter on your keyboard. You can also keybind each specific ability for a role in this way. For ex: \"cmdbind .special g\" or \"cmdbind .special bulldozer 1 g\""); + } + + player2.SendConsoleMessage(StringBuilderPool.Pool.ToStringReturn(stringBuilder), "green"); + } } } diff --git a/KruacentExiled/KE.CustomRoles/MainPlugin.cs b/KruacentExiled/KE.CustomRoles/MainPlugin.cs index cbded7a9..623628a9 100644 --- a/KruacentExiled/KE.CustomRoles/MainPlugin.cs +++ b/KruacentExiled/KE.CustomRoles/MainPlugin.cs @@ -1,6 +1,7 @@ using Exiled.API.Features; using Exiled.CustomRoles.API.Features; using Exiled.Events.EventArgs.Server; +using MEC; namespace KE.CustomRoles @@ -47,6 +48,7 @@ public void UnsubscribeEvents() public void CustomRoleImplement() { Controller.controller.GiveRole(Player.List); + } public void CustomRoleRespawning(RespawnedTeamEventArgs ev) From 75c8d0d67b84f01bbb983e4549743b30fa8c09c7 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Thu, 13 Mar 2025 13:48:17 +0100 Subject: [PATCH 213/853] readded RueIhint --- .../KE.Items/ItemEffects/HealZoneEffect.cs | 6 +- .../KE.Items/ItemEffects/MolotovEffect.cs | 5 +- KruacentExiled/KE.Items/Items/Molotov.cs | 2 +- KruacentExiled/KE.Items/KE.Items.csproj | 1 + KruacentExiled/KE.Items/KECustomItem.cs | 9 ++- .../KE.Utils/Display/DisplayPlayer.cs | 55 ++++++++++++++++--- .../KE.Utils/Display/Enums/HPosition.cs | 15 +++++ .../{HintPlacement.cs => Enums/VPosition.cs} | 4 +- KruacentExiled/KE.Utils/Display/RueIHint.cs | 34 ++++++++++++ 9 files changed, 112 insertions(+), 19 deletions(-) create mode 100644 KruacentExiled/KE.Utils/Display/Enums/HPosition.cs rename KruacentExiled/KE.Utils/Display/{HintPlacement.cs => Enums/VPosition.cs} (78%) create mode 100644 KruacentExiled/KE.Utils/Display/RueIHint.cs diff --git a/KruacentExiled/KE.Items/ItemEffects/HealZoneEffect.cs b/KruacentExiled/KE.Items/ItemEffects/HealZoneEffect.cs index 7f21b828..a3a6769d 100644 --- a/KruacentExiled/KE.Items/ItemEffects/HealZoneEffect.cs +++ b/KruacentExiled/KE.Items/ItemEffects/HealZoneEffect.cs @@ -27,15 +27,13 @@ public override void Effect(DroppingItemEventArgs ev) public override void Effect(ExplodingGrenadeEventArgs ev) { - SetZone(ev.Player, ev.Player.Position, ev.TargetsToAffect); + SetZone(ev.Player, ev.Position); } - private void SetZone(Player player, Vector3 position, HashSet targets = null) + private void SetZone(Player player, Vector3 position) { float cylinderSize = 5; - targets?.Clear(); - Player playerThrowingGrenade = player; Vector3 healZonePosition = position; Primitive wall = Primitive.Create(PrimitiveType.Cylinder, healZonePosition, null, new Vector3(cylinderSize, 0.01f, cylinderSize), true); diff --git a/KruacentExiled/KE.Items/ItemEffects/MolotovEffect.cs b/KruacentExiled/KE.Items/ItemEffects/MolotovEffect.cs index 0a237dc8..76d90954 100644 --- a/KruacentExiled/KE.Items/ItemEffects/MolotovEffect.cs +++ b/KruacentExiled/KE.Items/ItemEffects/MolotovEffect.cs @@ -29,15 +29,14 @@ public override void Effect(DroppingItemEventArgs ev) public override void Effect(ExplodingGrenadeEventArgs ev) { - SetZone(ev.Player, ev.Player.Position,ev.TargetsToAffect); + SetZone(ev.Player, ev.Position); } - private void SetZone(Player player,Vector3 position,HashSet targets = null) + private void SetZone(Player player,Vector3 position) { float cylinderSize = CylinderSize; - targets?.Clear(); Player playerThrowingGrenade = player; Vector3 molotovPosition = position; diff --git a/KruacentExiled/KE.Items/Items/Molotov.cs b/KruacentExiled/KE.Items/Items/Molotov.cs index 6ba5909e..5d4e2433 100644 --- a/KruacentExiled/KE.Items/Items/Molotov.cs +++ b/KruacentExiled/KE.Items/Items/Molotov.cs @@ -66,7 +66,7 @@ public class Molotov : KECustomGrenade, ILumosItem, ISwichableEffect public Molotov() { - Effect = new MineEffect(); + Effect = new MolotovEffect(); } protected override void OnExploding(ExplodingGrenadeEventArgs ev) diff --git a/KruacentExiled/KE.Items/KE.Items.csproj b/KruacentExiled/KE.Items/KE.Items.csproj index 5de4e5c1..8cefe524 100644 --- a/KruacentExiled/KE.Items/KE.Items.csproj +++ b/KruacentExiled/KE.Items/KE.Items.csproj @@ -1,6 +1,7 @@  + 13.0 net48 diff --git a/KruacentExiled/KE.Items/KECustomItem.cs b/KruacentExiled/KE.Items/KECustomItem.cs index c3424381..94de735e 100644 --- a/KruacentExiled/KE.Items/KECustomItem.cs +++ b/KruacentExiled/KE.Items/KECustomItem.cs @@ -4,6 +4,7 @@ using Exiled.CustomItems.API.Features; using KE.Items.Interface; using KE.Utils.Display; +using KE.Utils.Display.Enums; using System; using System.Collections.Generic; using System.Linq; @@ -31,7 +32,9 @@ internal static void Message(CustomItem c,Player player) { if (CustomItems.Instance.Config.PickedUpHint.Show) { - string show = $"{c.Name}\n{c.Description} \n"; + + + string show = $"{c.Name}\n{c.Description}\n"; if (c is IUpgradableCustomItem ci) { foreach (var a in ci.Upgrade) @@ -39,7 +42,9 @@ internal static void Message(CustomItem c,Player player) show += $"{a.Value.Chance}% chance of upgrading on {a.Key}\n"; } } - DisplayPlayer.Get(player).Hint((float)HintPlacement.CustomItem, "" +show+"", (int)CustomItems.Instance.Config.PickedUpHint.Duration); + + RueIHint hint = new(HPosition.Right, VPosition.CustomItem, show, CustomItems.Instance.Config.PickedUpHint.Duration); + DisplayPlayer.Get(player).Hint(hint); //player.ShowHint(show, (int)CustomItems.Instance.Config.PickedUpHint.Duration); } diff --git a/KruacentExiled/KE.Utils/Display/DisplayPlayer.cs b/KruacentExiled/KE.Utils/Display/DisplayPlayer.cs index 74dad6a4..a455e935 100644 --- a/KruacentExiled/KE.Utils/Display/DisplayPlayer.cs +++ b/KruacentExiled/KE.Utils/Display/DisplayPlayer.cs @@ -1,4 +1,6 @@ using Exiled.API.Features; +using Exiled.API.Interfaces; +using KE.Utils.Display.Enums; using MEC; using RueI.Displays; using RueI.Elements; @@ -15,6 +17,7 @@ public class DisplayPlayer { private static Dictionary _displays = new(); private RueI.Displays.Display _display; + private Dictionary _hints = new(); private Player _player; public Player Player { get { return _player; } } public static DisplayPlayer Get(Player player) @@ -30,31 +33,46 @@ public DisplayPlayer(Player player) _display = new (DisplayCore.Get(player.ReferenceHub)); } - public Element Hint(float position, string text) + public Element Hint(Position position, string text) { - SetElement element = new(position, text); + if (_hints.ContainsKey(position)) return null; + SetElement element = new((float)position.VPosition, $"" + text + ""); _display.Elements.Add(element); + _hints.Add(position, element); UpdateCore(_player); return element; } - public Element Hint(float position,string text,float seconds) + public Element Hint(Position position,string text,float seconds) { - SetElement element = new(position, text); + if (_hints.ContainsKey(position)) return null; + SetElement element = new((float)position.VPosition, $""+text+""); _display.Elements.Add(element); + _hints.Add(position, element); UpdateCore(_player); Timing.CallDelayed(seconds, () => { _display.Elements.Remove(element); + _hints.Remove(position); UpdateCore(_player); }); return element; } - public bool RemoveHint(Element elem) + + public Element Hint(RueIHint hint) + { + if (hint.Duration < 0) + return Hint(hint.Position, hint.RawContent); + return Hint(hint.Position,hint.RawContent,hint.Duration); + } + + public bool RemoveHint(Position placement) { - bool result = _display.Elements.Remove(elem); + if (!_hints.ContainsKey(placement)) return false; + bool result = _display.Elements.Remove(_hints[placement]); + _hints.Remove(placement); UpdateCore(_player); return result; } @@ -62,9 +80,32 @@ public bool RemoveHint(Element elem) public static void UpdateCore(Player player) => DisplayCore.Get(player.ReferenceHub).Update(); + + } + public struct Position + { + private HPosition _hposition; + public HPosition HPosition { get { return _hposition; } } + private VPosition _vposition; + public VPosition VPosition { get { return _vposition; } } + + public Position(HPosition hposition, VPosition vposition) + { + _hposition = hposition; + _vposition = vposition; + } + public override bool Equals(object obj) + { + Position pos = (Position)obj; + return pos.VPosition == VPosition && pos.HPosition == HPosition; + } + public override int GetHashCode() + { + return base.GetHashCode(); + } } - + } diff --git a/KruacentExiled/KE.Utils/Display/Enums/HPosition.cs b/KruacentExiled/KE.Utils/Display/Enums/HPosition.cs new file mode 100644 index 00000000..023c8016 --- /dev/null +++ b/KruacentExiled/KE.Utils/Display/Enums/HPosition.cs @@ -0,0 +1,15 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace KE.Utils.Display.Enums +{ + public enum HPosition + { + Left, + Center, + Right, + } +} diff --git a/KruacentExiled/KE.Utils/Display/HintPlacement.cs b/KruacentExiled/KE.Utils/Display/Enums/VPosition.cs similarity index 78% rename from KruacentExiled/KE.Utils/Display/HintPlacement.cs rename to KruacentExiled/KE.Utils/Display/Enums/VPosition.cs index f74223de..264c78dd 100644 --- a/KruacentExiled/KE.Utils/Display/HintPlacement.cs +++ b/KruacentExiled/KE.Utils/Display/Enums/VPosition.cs @@ -4,9 +4,9 @@ using System.Text; using System.Threading.Tasks; -namespace KE.Utils.Display +namespace KE.Utils.Display.Enums { - public enum HintPlacement + public enum VPosition { GlobalEvent = 900, CustomItem = 200, diff --git a/KruacentExiled/KE.Utils/Display/RueIHint.cs b/KruacentExiled/KE.Utils/Display/RueIHint.cs new file mode 100644 index 00000000..af4cd7b4 --- /dev/null +++ b/KruacentExiled/KE.Utils/Display/RueIHint.cs @@ -0,0 +1,34 @@ +using KE.Utils.Display.Enums; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace KE.Utils.Display +{ + public class RueIHint + { + private Position _position; + public Position Position { get { return _position; } } + private string _content; + public string RawContent { get { return _content; } } + private float _duration = -1; + public float Duration { get { return _duration; } } + + public RueIHint(HPosition hposition, VPosition vposition, string content) + { + _position = new(hposition, vposition); + _content = content; + } + public RueIHint(HPosition hposition, VPosition vposition, string content,float duration) + { + _position = new(hposition, vposition); + _content = content; + _duration = duration; + } + + + + } +} From c0216a8ace8de0e0931aabc857929f702a00f8e2 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Thu, 13 Mar 2025 14:01:33 +0100 Subject: [PATCH 214/853] redid the RueIHint --- .../KE.CustomRoles/API/KECustomRole.cs | 4 +- .../KE.CustomRoles/KE.CustomRoles.csproj | 1 + .../KE.Utils/Display/DisplayPlayer.cs | 55 ++++++++++++++++--- .../KE.Utils/Display/Enums/HPosition.cs | 15 +++++ .../{HintPlacement.cs => Enums/VPosition.cs} | 4 +- KruacentExiled/KE.Utils/Display/RueIHint.cs | 34 ++++++++++++ 6 files changed, 103 insertions(+), 10 deletions(-) create mode 100644 KruacentExiled/KE.Utils/Display/Enums/HPosition.cs rename KruacentExiled/KE.Utils/Display/{HintPlacement.cs => Enums/VPosition.cs} (78%) create mode 100644 KruacentExiled/KE.Utils/Display/RueIHint.cs diff --git a/KruacentExiled/KE.CustomRoles/API/KECustomRole.cs b/KruacentExiled/KE.CustomRoles/API/KECustomRole.cs index f7b14f77..e585404d 100644 --- a/KruacentExiled/KE.CustomRoles/API/KECustomRole.cs +++ b/KruacentExiled/KE.CustomRoles/API/KECustomRole.cs @@ -5,6 +5,7 @@ using Exiled.CustomRoles.API.Features; using InventorySystem.Configs; using KE.Utils.Display; +using KE.Utils.Display.Enums; using MEC; using PlayerRoles; using System; @@ -24,7 +25,8 @@ protected override void ShowMessage(Exiled.API.Features.Player player) string show = $"{Name}\n {Description}"; - DisplayPlayer.Get(player).Hint((float)HintPlacement.CustomItem, ""+ show + "", Exiled.CustomRoles.CustomRoles.Instance.Config.GotRoleHint.Duration); + RueIHint r = new(HPosition.Left, VPosition.CustomItem, show, Exiled.CustomRoles.CustomRoles.Instance.Config.GotRoleHint.Duration); + DisplayPlayer.Get(player).Hint(r); } public override void AddRole(Exiled.API.Features.Player player) diff --git a/KruacentExiled/KE.CustomRoles/KE.CustomRoles.csproj b/KruacentExiled/KE.CustomRoles/KE.CustomRoles.csproj index e798f71f..df717823 100644 --- a/KruacentExiled/KE.CustomRoles/KE.CustomRoles.csproj +++ b/KruacentExiled/KE.CustomRoles/KE.CustomRoles.csproj @@ -1,5 +1,6 @@  + 13.0 net48 diff --git a/KruacentExiled/KE.Utils/Display/DisplayPlayer.cs b/KruacentExiled/KE.Utils/Display/DisplayPlayer.cs index 74dad6a4..a455e935 100644 --- a/KruacentExiled/KE.Utils/Display/DisplayPlayer.cs +++ b/KruacentExiled/KE.Utils/Display/DisplayPlayer.cs @@ -1,4 +1,6 @@ using Exiled.API.Features; +using Exiled.API.Interfaces; +using KE.Utils.Display.Enums; using MEC; using RueI.Displays; using RueI.Elements; @@ -15,6 +17,7 @@ public class DisplayPlayer { private static Dictionary _displays = new(); private RueI.Displays.Display _display; + private Dictionary _hints = new(); private Player _player; public Player Player { get { return _player; } } public static DisplayPlayer Get(Player player) @@ -30,31 +33,46 @@ public DisplayPlayer(Player player) _display = new (DisplayCore.Get(player.ReferenceHub)); } - public Element Hint(float position, string text) + public Element Hint(Position position, string text) { - SetElement element = new(position, text); + if (_hints.ContainsKey(position)) return null; + SetElement element = new((float)position.VPosition, $"" + text + ""); _display.Elements.Add(element); + _hints.Add(position, element); UpdateCore(_player); return element; } - public Element Hint(float position,string text,float seconds) + public Element Hint(Position position,string text,float seconds) { - SetElement element = new(position, text); + if (_hints.ContainsKey(position)) return null; + SetElement element = new((float)position.VPosition, $""+text+""); _display.Elements.Add(element); + _hints.Add(position, element); UpdateCore(_player); Timing.CallDelayed(seconds, () => { _display.Elements.Remove(element); + _hints.Remove(position); UpdateCore(_player); }); return element; } - public bool RemoveHint(Element elem) + + public Element Hint(RueIHint hint) + { + if (hint.Duration < 0) + return Hint(hint.Position, hint.RawContent); + return Hint(hint.Position,hint.RawContent,hint.Duration); + } + + public bool RemoveHint(Position placement) { - bool result = _display.Elements.Remove(elem); + if (!_hints.ContainsKey(placement)) return false; + bool result = _display.Elements.Remove(_hints[placement]); + _hints.Remove(placement); UpdateCore(_player); return result; } @@ -62,9 +80,32 @@ public bool RemoveHint(Element elem) public static void UpdateCore(Player player) => DisplayCore.Get(player.ReferenceHub).Update(); + + } + public struct Position + { + private HPosition _hposition; + public HPosition HPosition { get { return _hposition; } } + private VPosition _vposition; + public VPosition VPosition { get { return _vposition; } } + + public Position(HPosition hposition, VPosition vposition) + { + _hposition = hposition; + _vposition = vposition; + } + public override bool Equals(object obj) + { + Position pos = (Position)obj; + return pos.VPosition == VPosition && pos.HPosition == HPosition; + } + public override int GetHashCode() + { + return base.GetHashCode(); + } } - + } diff --git a/KruacentExiled/KE.Utils/Display/Enums/HPosition.cs b/KruacentExiled/KE.Utils/Display/Enums/HPosition.cs new file mode 100644 index 00000000..023c8016 --- /dev/null +++ b/KruacentExiled/KE.Utils/Display/Enums/HPosition.cs @@ -0,0 +1,15 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace KE.Utils.Display.Enums +{ + public enum HPosition + { + Left, + Center, + Right, + } +} diff --git a/KruacentExiled/KE.Utils/Display/HintPlacement.cs b/KruacentExiled/KE.Utils/Display/Enums/VPosition.cs similarity index 78% rename from KruacentExiled/KE.Utils/Display/HintPlacement.cs rename to KruacentExiled/KE.Utils/Display/Enums/VPosition.cs index f74223de..264c78dd 100644 --- a/KruacentExiled/KE.Utils/Display/HintPlacement.cs +++ b/KruacentExiled/KE.Utils/Display/Enums/VPosition.cs @@ -4,9 +4,9 @@ using System.Text; using System.Threading.Tasks; -namespace KE.Utils.Display +namespace KE.Utils.Display.Enums { - public enum HintPlacement + public enum VPosition { GlobalEvent = 900, CustomItem = 200, diff --git a/KruacentExiled/KE.Utils/Display/RueIHint.cs b/KruacentExiled/KE.Utils/Display/RueIHint.cs new file mode 100644 index 00000000..af4cd7b4 --- /dev/null +++ b/KruacentExiled/KE.Utils/Display/RueIHint.cs @@ -0,0 +1,34 @@ +using KE.Utils.Display.Enums; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace KE.Utils.Display +{ + public class RueIHint + { + private Position _position; + public Position Position { get { return _position; } } + private string _content; + public string RawContent { get { return _content; } } + private float _duration = -1; + public float Duration { get { return _duration; } } + + public RueIHint(HPosition hposition, VPosition vposition, string content) + { + _position = new(hposition, vposition); + _content = content; + } + public RueIHint(HPosition hposition, VPosition vposition, string content,float duration) + { + _position = new(hposition, vposition); + _content = content; + _duration = duration; + } + + + + } +} From de907eb2f692b321778b898675c17291ffac9f5b Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Thu, 13 Mar 2025 15:23:04 +0100 Subject: [PATCH 215/853] Changed hints for ge --- .../API/Feature/MalfunctionDisplay.cs | 5 +- .../GEFE/API/Features/GlobalEvent.cs | 2 +- .../KE.Utils/Display/DisplayPlayer.cs | 55 ++++++++++++++++--- .../KE.Utils/Display/Enums/HPosition.cs | 15 +++++ .../{HintPlacement.cs => Enums/VPosition.cs} | 6 +- KruacentExiled/KE.Utils/Display/RueIHint.cs | 34 ++++++++++++ 6 files changed, 104 insertions(+), 13 deletions(-) create mode 100644 KruacentExiled/KE.Utils/Display/Enums/HPosition.cs rename KruacentExiled/KE.Utils/Display/{HintPlacement.cs => Enums/VPosition.cs} (68%) create mode 100644 KruacentExiled/KE.Utils/Display/RueIHint.cs diff --git a/KruacentExiled/KE.GlobalEventFramework.Examples/API/Feature/MalfunctionDisplay.cs b/KruacentExiled/KE.GlobalEventFramework.Examples/API/Feature/MalfunctionDisplay.cs index d13fd4eb..043675bf 100644 --- a/KruacentExiled/KE.GlobalEventFramework.Examples/API/Feature/MalfunctionDisplay.cs +++ b/KruacentExiled/KE.GlobalEventFramework.Examples/API/Feature/MalfunctionDisplay.cs @@ -3,6 +3,7 @@ using KE.GlobalEventFramework.Examples.API.Interfaces; using KE.Utils; using KE.Utils.Display; +using KE.Utils.Display.Enums; using MEC; using PlayerRoles; using System; @@ -50,13 +51,13 @@ private void ShowAllSpect(string hint) foreach (Player p in Player.List.Where(p => p.Role == RoleTypeId.Spectator)) { - DisplayPlayer.Get(p).Hint((float)HintPlacement.Effects, hint,RefreshRate+.01f); + DisplayPlayer.Get(p).Hint(new(HPosition.Right,VPosition.GlobalEvent, hint,RefreshRate+.01f)); } } private string GetHint() { - return $" {GetCurrentMalfunction()}\n{GetAllEffect()}"; + return $"{GetCurrentMalfunction()}\n{GetAllEffect()}"; } diff --git a/KruacentExiled/KE.GlobalEventFramework/GEFE/API/Features/GlobalEvent.cs b/KruacentExiled/KE.GlobalEventFramework/GEFE/API/Features/GlobalEvent.cs index ccd572b0..267cf72f 100644 --- a/KruacentExiled/KE.GlobalEventFramework/GEFE/API/Features/GlobalEvent.cs +++ b/KruacentExiled/KE.GlobalEventFramework/GEFE/API/Features/GlobalEvent.cs @@ -93,7 +93,7 @@ private static void Show() foreach (Player player in Player.List) { - DisplayPlayer.Get(player).Hint((float)HintPlacement.GlobalEvent, ShowText(random < MainPlugin.Instance.Config.ChanceRedacted), 10); + DisplayPlayer.Get(player).Hint(new (KE.Utils.Display.Enums.HPosition.Center,KE.Utils.Display.Enums.VPosition.GlobalEvent, ShowText(random < MainPlugin.Instance.Config.ChanceRedacted), 10)); } } diff --git a/KruacentExiled/KE.Utils/Display/DisplayPlayer.cs b/KruacentExiled/KE.Utils/Display/DisplayPlayer.cs index 74dad6a4..a455e935 100644 --- a/KruacentExiled/KE.Utils/Display/DisplayPlayer.cs +++ b/KruacentExiled/KE.Utils/Display/DisplayPlayer.cs @@ -1,4 +1,6 @@ using Exiled.API.Features; +using Exiled.API.Interfaces; +using KE.Utils.Display.Enums; using MEC; using RueI.Displays; using RueI.Elements; @@ -15,6 +17,7 @@ public class DisplayPlayer { private static Dictionary _displays = new(); private RueI.Displays.Display _display; + private Dictionary _hints = new(); private Player _player; public Player Player { get { return _player; } } public static DisplayPlayer Get(Player player) @@ -30,31 +33,46 @@ public DisplayPlayer(Player player) _display = new (DisplayCore.Get(player.ReferenceHub)); } - public Element Hint(float position, string text) + public Element Hint(Position position, string text) { - SetElement element = new(position, text); + if (_hints.ContainsKey(position)) return null; + SetElement element = new((float)position.VPosition, $"" + text + ""); _display.Elements.Add(element); + _hints.Add(position, element); UpdateCore(_player); return element; } - public Element Hint(float position,string text,float seconds) + public Element Hint(Position position,string text,float seconds) { - SetElement element = new(position, text); + if (_hints.ContainsKey(position)) return null; + SetElement element = new((float)position.VPosition, $""+text+""); _display.Elements.Add(element); + _hints.Add(position, element); UpdateCore(_player); Timing.CallDelayed(seconds, () => { _display.Elements.Remove(element); + _hints.Remove(position); UpdateCore(_player); }); return element; } - public bool RemoveHint(Element elem) + + public Element Hint(RueIHint hint) + { + if (hint.Duration < 0) + return Hint(hint.Position, hint.RawContent); + return Hint(hint.Position,hint.RawContent,hint.Duration); + } + + public bool RemoveHint(Position placement) { - bool result = _display.Elements.Remove(elem); + if (!_hints.ContainsKey(placement)) return false; + bool result = _display.Elements.Remove(_hints[placement]); + _hints.Remove(placement); UpdateCore(_player); return result; } @@ -62,9 +80,32 @@ public bool RemoveHint(Element elem) public static void UpdateCore(Player player) => DisplayCore.Get(player.ReferenceHub).Update(); + + } + public struct Position + { + private HPosition _hposition; + public HPosition HPosition { get { return _hposition; } } + private VPosition _vposition; + public VPosition VPosition { get { return _vposition; } } + + public Position(HPosition hposition, VPosition vposition) + { + _hposition = hposition; + _vposition = vposition; + } + public override bool Equals(object obj) + { + Position pos = (Position)obj; + return pos.VPosition == VPosition && pos.HPosition == HPosition; + } + public override int GetHashCode() + { + return base.GetHashCode(); + } } - + } diff --git a/KruacentExiled/KE.Utils/Display/Enums/HPosition.cs b/KruacentExiled/KE.Utils/Display/Enums/HPosition.cs new file mode 100644 index 00000000..023c8016 --- /dev/null +++ b/KruacentExiled/KE.Utils/Display/Enums/HPosition.cs @@ -0,0 +1,15 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace KE.Utils.Display.Enums +{ + public enum HPosition + { + Left, + Center, + Right, + } +} diff --git a/KruacentExiled/KE.Utils/Display/HintPlacement.cs b/KruacentExiled/KE.Utils/Display/Enums/VPosition.cs similarity index 68% rename from KruacentExiled/KE.Utils/Display/HintPlacement.cs rename to KruacentExiled/KE.Utils/Display/Enums/VPosition.cs index 8d318ec9..264c78dd 100644 --- a/KruacentExiled/KE.Utils/Display/HintPlacement.cs +++ b/KruacentExiled/KE.Utils/Display/Enums/VPosition.cs @@ -4,12 +4,12 @@ using System.Text; using System.Threading.Tasks; -namespace KE.Utils.Display +namespace KE.Utils.Display.Enums { - public enum HintPlacement + public enum VPosition { GlobalEvent = 900, CustomItem = 200, - Effects = 700, + CustomRole = 400, } } diff --git a/KruacentExiled/KE.Utils/Display/RueIHint.cs b/KruacentExiled/KE.Utils/Display/RueIHint.cs new file mode 100644 index 00000000..af4cd7b4 --- /dev/null +++ b/KruacentExiled/KE.Utils/Display/RueIHint.cs @@ -0,0 +1,34 @@ +using KE.Utils.Display.Enums; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace KE.Utils.Display +{ + public class RueIHint + { + private Position _position; + public Position Position { get { return _position; } } + private string _content; + public string RawContent { get { return _content; } } + private float _duration = -1; + public float Duration { get { return _duration; } } + + public RueIHint(HPosition hposition, VPosition vposition, string content) + { + _position = new(hposition, vposition); + _content = content; + } + public RueIHint(HPosition hposition, VPosition vposition, string content,float duration) + { + _position = new(hposition, vposition); + _content = content; + _duration = duration; + } + + + + } +} From 19d444aa7e5ee90e163e53bc6c337e83c1236c4c Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Thu, 13 Mar 2025 15:23:19 +0100 Subject: [PATCH 216/853] added blacklisted room for random spawn --- .../KE.GlobalEventFramework.Examples/GE/RandomSpawn.cs | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/KruacentExiled/KE.GlobalEventFramework.Examples/GE/RandomSpawn.cs b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/RandomSpawn.cs index b4ac9946..ef65a8ac 100644 --- a/KruacentExiled/KE.GlobalEventFramework.Examples/GE/RandomSpawn.cs +++ b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/RandomSpawn.cs @@ -1,4 +1,6 @@ -using Exiled.API.Features; +using Exiled.API.Enums; +using Exiled.API.Extensions; +using Exiled.API.Features; using KE.GlobalEventFramework.GEFE.API.Features; using KE.GlobalEventFramework.GEFE.API.Interfaces; using PlayerRoles; @@ -24,12 +26,14 @@ public class RandomSpawn : GlobalEvent,IStart public override string Description { get; set; } = "Les spawns sont random"; /// public override int Weight { get; set; } = 1; + public IEnumerable BlacklistedRooms { get; } = new HashSet() { RoomType.EzShelter,RoomType.HczTestRoom}; /// public IEnumerator Start() { - Room room = Room.Random(); + Room room; foreach (RoleTypeId r in Enum.GetValues(typeof(RoleTypeId))) { + room = Room.List.GetRandomValue(r => !BlacklistedRooms.Contains(r.Type)); foreach (Player p in Player.List) { @@ -39,7 +43,7 @@ public IEnumerator Start() } } - room = Room.Random(); + } yield return 0; } From 6dbe9e13918b8eed972dc307a6daf4e46898f0d5 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Thu, 13 Mar 2025 21:33:17 +0100 Subject: [PATCH 217/853] updated the utils peanut lockdown hint Spawn preferences --- .../KE.GlobalEventFramework.Examples.csproj | 2 +- KruacentExiled/KE.Misc/Config.cs | 3 + .../KE.Misc/Handlers/ServerHandler.cs | 4 +- KruacentExiled/KE.Misc/KE.Misc.csproj | 17 ++- KruacentExiled/KE.Misc/KEHint.cs | 28 ----- KruacentExiled/KE.Misc/MainPlugin.cs | 45 ++++--- KruacentExiled/KE.Misc/Misc/Spawn.cs | 115 +++++++++++++---- .../KE.Utils/API/Features/ZoneProperties.cs | 44 ------- .../KE.Utils/Display/DisplayPlayer.cs | 119 ++++++++++++++++++ .../KE.Utils/Display/Enums/HPosition.cs | 15 +++ .../KE.Utils/Display/Enums/VPosition.cs | 15 +++ KruacentExiled/KE.Utils/Display/RueIHint.cs | 34 +++++ .../KE.Utils/Extensions/PlayerExtension.cs | 35 ++++++ .../KE.Utils/Extensions/RoomExtensions.cs | 7 +- KruacentExiled/KE.Utils/KE.Utils.csproj | 8 +- .../KE.Utils/Tests/PrimitiveTest.cs | 5 - 16 files changed, 367 insertions(+), 129 deletions(-) delete mode 100644 KruacentExiled/KE.Misc/KEHint.cs delete mode 100644 KruacentExiled/KE.Utils/API/Features/ZoneProperties.cs create mode 100644 KruacentExiled/KE.Utils/Display/DisplayPlayer.cs create mode 100644 KruacentExiled/KE.Utils/Display/Enums/HPosition.cs create mode 100644 KruacentExiled/KE.Utils/Display/Enums/VPosition.cs create mode 100644 KruacentExiled/KE.Utils/Display/RueIHint.cs create mode 100644 KruacentExiled/KE.Utils/Extensions/PlayerExtension.cs diff --git a/KruacentExiled/KE.GlobalEventFramework.Examples/KE.GlobalEventFramework.Examples.csproj b/KruacentExiled/KE.GlobalEventFramework.Examples/KE.GlobalEventFramework.Examples.csproj index fec6f9e1..5b8b84df 100644 --- a/KruacentExiled/KE.GlobalEventFramework.Examples/KE.GlobalEventFramework.Examples.csproj +++ b/KruacentExiled/KE.GlobalEventFramework.Examples/KE.GlobalEventFramework.Examples.csproj @@ -5,7 +5,7 @@ - + diff --git a/KruacentExiled/KE.Misc/Config.cs b/KruacentExiled/KE.Misc/Config.cs index 8138bbee..cce72a68 100644 --- a/KruacentExiled/KE.Misc/Config.cs +++ b/KruacentExiled/KE.Misc/Config.cs @@ -20,5 +20,8 @@ public class Config : IConfig [Description("Chance to get a pink candy (0-100)")] public int ChancePinkCandy { get; set; } = 10; public bool SurfaceLight { get; set; } = true; + + public bool ScpPreferences { get; set; } = true; + public bool Scp035Enabled { get; set; } = true; } } diff --git a/KruacentExiled/KE.Misc/Handlers/ServerHandler.cs b/KruacentExiled/KE.Misc/Handlers/ServerHandler.cs index 77435d68..2c88addf 100644 --- a/KruacentExiled/KE.Misc/Handlers/ServerHandler.cs +++ b/KruacentExiled/KE.Misc/Handlers/ServerHandler.cs @@ -6,7 +6,7 @@ namespace KE.Misc.Handlers { internal class ServerHandler { - CoroutineHandle coroutineHandle; + private CoroutineHandle coroutineHandle; public void OnRoundStarted() { if(MainPlugin.Instance.Config.ChanceFF >= 0 && MainPlugin.Instance.Config.ChanceFF <= 100) @@ -15,7 +15,7 @@ public void OnRoundStarted() MainPlugin.Instance.ClassDDoor.ClassDDoorGoesBoom(); if(MainPlugin.Instance.Config.AutoNukeAnnoucement) Timing.RunCoroutineSingleton(MainPlugin.Instance.NukeAnnouncement(), coroutineHandle,SingletonBehavior.Abort); - if(MainPlugin.Instance.Config.PeanutLockDown && Player.List.Where(p => p.Role.Type == PlayerRoles.RoleTypeId.Scp173).Count() > 0) + if(MainPlugin.Instance.Config.PeanutLockDown) Timing.RunCoroutine(MainPlugin.Instance.PeanutLockdown()); if(MainPlugin.Instance.Config.AutoElevator) Timing.RunCoroutine(MainPlugin.Instance.AutoElevator.StartElevator()); diff --git a/KruacentExiled/KE.Misc/KE.Misc.csproj b/KruacentExiled/KE.Misc/KE.Misc.csproj index e70fa610..8a6e762d 100644 --- a/KruacentExiled/KE.Misc/KE.Misc.csproj +++ b/KruacentExiled/KE.Misc/KE.Misc.csproj @@ -1,12 +1,17 @@  + 13.0 net48 - - + + + + + + @@ -18,4 +23,12 @@ + + if not "$(EXILED_DEV_REFERENCES)"=="" copy /y "$(OutputPath)$(AssemblyName).dll" "$(EXILED_DEV_REFERENCES)\Plugins\" + + + if [[ ! -z "$EXILED_DEV_REFERENCES" ]]; then cp "$(OutputPath)$(AssemblyName).dll" "$EXILED_DEV_REFERENCES/Plugins/"; fi + + + diff --git a/KruacentExiled/KE.Misc/KEHint.cs b/KruacentExiled/KE.Misc/KEHint.cs deleted file mode 100644 index a32e6031..00000000 --- a/KruacentExiled/KE.Misc/KEHint.cs +++ /dev/null @@ -1,28 +0,0 @@ -using Exiled.API.Features; -using System; -using RueI.Extensions; -using RueI.Displays; - -namespace KE.Misc -{ - public static class KEHint - { - - public static void ShowHint(this Player player, Hint hint,float position) - { - ShowHint(player, hint.Content, position,TimeSpan.FromSeconds(hint.Duration)); - } - public static void ShowHint(this Player p, string message,float position, TimeSpan timeSpan) - { - ShowHint(p.ReferenceHub,message,position,timeSpan); - } - - public static void ShowHint(ReferenceHub hub, string message, float position,TimeSpan timeSpan) - { - DisplayCore c = DisplayCore.Get(hub); - - c.SetElemTemp(message, position, timeSpan, new RueI.Displays.Scheduling.TimedElemRef()); - } - - } -} diff --git a/KruacentExiled/KE.Misc/MainPlugin.cs b/KruacentExiled/KE.Misc/MainPlugin.cs index 03799b72..890a1327 100644 --- a/KruacentExiled/KE.Misc/MainPlugin.cs +++ b/KruacentExiled/KE.Misc/MainPlugin.cs @@ -11,6 +11,12 @@ using System; using KE.Misc.Misc; using KE.Misc.Handlers; +using KE.Utils.Display; +using KE.Utils.Display.Enums; +using Exiled.API.Extensions; +using Exiled.Events.Commands.Hub; +using RueI.Displays; +using RueI.Extensions; namespace KE.Misc { @@ -114,37 +120,46 @@ internal IEnumerator NukeAnnouncement() /// internal IEnumerator PeanutLockdown() { - if(!Player.List.Any(p => p.Role.Type == RoleTypeId.Scp173)) - { - yield return 0; - } Log.Debug("peanut lockdown"); - Door peanutDoor = Door.List.ToList().Where(x => x.Type == DoorType.Scp173NewGate).ToList()[0]; + Door peanutDoor = Door.List.First(x => x.Type == DoorType.Scp173NewGate); peanutDoor.IsOpen = false; peanutDoor.ChangeLock(DoorLockType.Isolation); - var a = Timing.RunCoroutine(Timer(135 - Player.List.Count * 15,Player.List.Where(p=> p.Role == RoleTypeId.Scp173).ToList(), "u r free :3")); + CoroutineHandle a; + if (MainPlugin.Instance.Config.Debug) + a = Timing.RunCoroutine(Timer(120, "u r free :3")); + else + a = Timing.RunCoroutine(Timer(135 - Player.List.Count * 15, "u r free :3")); + yield return Timing.WaitUntilDone(a); peanutDoor.IsOpen = true; peanutDoor.Unlock(); Log.Debug("peanut free"); } - private IEnumerator Timer(int secondsWaiting,List playerToShow, string msg = "done") + private IEnumerator Timer(int secondsWaiting, string msg = "done") { - float position = 0; + List playerToShow = [.. Player.List]; while (secondsWaiting >= 0) { - Hint hint = new Hint() + playerToShow.RemoveAll(p => p.CurrentRoom.Type != RoomType.Hcz049); + playerToShow.AddRange(Player.List.Where(p => p.CurrentRoom.Type == RoomType.Hcz049)); + + RueIHint hint = new(HPosition.Center, VPosition.CustomRole, $"{secondsWaiting} seconds left for SCP-173's spawn", 1); + playerToShow.ForEach(p => { - Content = $"{secondsWaiting} seconds", - Duration = 1 - }; - playerToShow.ForEach(p => p.ShowHint(hint, position)); - playerToShow.RemoveAll(p => p.Role != RoleTypeId.Scp173); + DisplayCore c = DisplayCore.Get(p.ReferenceHub); + c.SetElemTemp($""+hint.RawContent+"", (int)hint.Position.VPosition, TimeSpan.FromSeconds(hint.Duration), new RueI.Displays.Scheduling.TimedElemRef()); + //DisplayPlayer.Get(p).Hint(hint) + }); yield return Timing.WaitForSeconds(1); secondsWaiting--; } - playerToShow.ForEach(p => p.ShowHint(msg, position)); + playerToShow.ForEach(p => DisplayPlayer.Get(p).Hint(new Position(HPosition.Center,VPosition.CustomRole),msg)); } + + + + + /// /// Special death message when Delecons dies as a SCP diff --git a/KruacentExiled/KE.Misc/Misc/Spawn.cs b/KruacentExiled/KE.Misc/Misc/Spawn.cs index 8f168885..282b3bb9 100644 --- a/KruacentExiled/KE.Misc/Misc/Spawn.cs +++ b/KruacentExiled/KE.Misc/Misc/Spawn.cs @@ -1,22 +1,31 @@ -using Exiled.API.Extensions; +using CommandSystem; +using Exiled.API.Extensions; using Exiled.API.Features; +using Exiled.API.Features.Attributes; +using Exiled.CustomRoles.API.Features; +using KE.Utils.Display; +using MEC; using PlayerRoles; +using RueI.Elements; using System; using System.Collections.Generic; using System.Linq; -using System.Text; -using System.Threading.Tasks; namespace KE.Misc.Misc { public class Spawn { - - //heal reduit Malfunction + private bool _set035 = true; + private Dictionary _players = []; public void OnRoundStarted() { - HashSet pl = Player.List.Where(p => p.IsScp).ToHashSet(); + if (!MainPlugin.Instance.Config.ScpPreferences) return; + HashSet pl; + if (!MainPlugin.Instance.Config.Debug) + pl = Player.List.Where(p => p.IsScp).ToHashSet(); + else + pl = [.. Player.List]; foreach (Player player in pl) { @@ -26,6 +35,7 @@ public void OnRoundStarted() private void SetScpPreferences(Player player) { + Config config = MainPlugin.Instance.Config; Dictionary chancescp = player.ScpPreferences.Preferences.ToDictionary(p => p.Key, p => p.Value + 6); @@ -33,24 +43,29 @@ private void SetScpPreferences(Player player) Log.Debug($"Scp ({player.Nickname}) is {roleScp} previous : {player.Role.Type}"); player.Role.Set(roleScp); - if (roleScp == RoleTypeId.Scp096 || roleScp == RoleTypeId.Scp079) + if (roleScp == RoleTypeId.Scp096 || roleScp == RoleTypeId.Scp079 && !config.Scp035Enabled || config.Debug) { - player.Role.Set(RoleTypeId.Scp173); - //TODO the commands - //ChangeScp(player); + float timetodecide = 60; + RueIHint h = new (Utils.Display.Enums.HPosition.Center, Utils.Display.Enums.VPosition.CustomRole, "You're a support class \nYou can change your scp by doing the command .scp \n(eg .scp 173 -> scp-173)", timetodecide); + var a = DisplayPlayer.Get(player).Hint(h); + ChangeSCP._players.Add(player,a); + Timing.CallDelayed(timetodecide, () => + { + ChangeSCP._players.Remove(player); + DisplayPlayer.Get(player).RemoveHint(a); + }); } - } - - - private void ChangeScp(Player player) - { - Hint h = new Hint() + if (config.Scp035Enabled && roleScp == RoleTypeId.Scp079) { - Content = "You're a support class \nYou can change your scp by doing the command .scp \n(eg .scp 173 -> scp-173)", - Duration = 60, - }; - player.ShowHint(h, 100); - + _set035 = !_set035; + if (_set035) + { + Player pl = Player.List.GetRandomValue(p => p.Role == RoleTypeId.ClassD || p.Role == RoleTypeId.Scientist); + CustomRole scp = CustomRole.Registered.FirstOrDefault(c => c.Id == 10); + scp.AddRole(pl); + } + + } } @@ -72,4 +87,62 @@ private RoleTypeId ChooseRandomRole(Dictionary chancescp) return weightedPool[randomIndex]; } } + + [CustomRole(RoleTypeId.Tutorial)] + public class Scp035 : CustomRole + { + public override uint Id { get; set; } = 10; + public override string Description { get; set; } = "t'es un humain dans la team des scp en gros "; + public override int MaxHealth { get; set; } = 600; + public override string Name { get; set; } = "SCP-035"; + public override string CustomInfo { get; set; } = string.Empty; + } + + + + [CommandHandler(typeof(ClientCommandHandler))] + public class ChangeSCP : ICommand + { + internal static Dictionary _players = new(); + public string Command { get; } = "scp"; + public string[] Aliases { get; } = new string[] { }; + public string Description { get; } = "change scp"; + + public bool Execute(ArraySegment arguments, ICommandSender sender, out string response) + { + Player psender = Player.Get(sender); + + if (psender == null) + { + response = string.Empty; + return false; + } + + if (!_players.ContainsKey(psender)) + { + response = "you're not authorized to use this command"; + return false; + } + if(arguments.Count < 1) + { + response = "not enough argument usage: .scp \n(eg .scp Scp173 -> scp-173)"; + return false; + } + + string scp = arguments.At(0); + if (!Enum.TryParse(scp, out RoleTypeId roleType) && roleType.IsScp() && roleType != RoleTypeId.Scp0492) + { + response = "wrong scp number"; + return false; + } + + psender.Role.Set(roleType); + DisplayPlayer.Get(psender).RemoveHint(_players[psender]); + _players.Remove(psender); + + response = $"you're now SCP-{scp}"; + return true; + } + + } } diff --git a/KruacentExiled/KE.Utils/API/Features/ZoneProperties.cs b/KruacentExiled/KE.Utils/API/Features/ZoneProperties.cs deleted file mode 100644 index df8a7da0..00000000 --- a/KruacentExiled/KE.Utils/API/Features/ZoneProperties.cs +++ /dev/null @@ -1,44 +0,0 @@ -using Exiled.API.Enums; -using Exiled.API.Features; -using System; -using System.Collections.Generic; -using System.Linq; - - -namespace KE.Utils.API.Features -{ - public class ZoneProperties - { - private ZoneType _zone; - public ZoneProperties(ZoneType zone) - { - _zone = zone; - } - - public ZoneType Zone - { - get - { - /*if (_zone == ZoneType.Unspecified) - return Enum.GetValues(typeof(ZoneType)).ToArray().ToHashSet(); - return [_zone];*/ - return _zone; - } - } - - - public override string ToString() - { - return _zone switch - { - ZoneType.Unspecified => "All of the facility", - ZoneType.LightContainment => "Light Containment Zone", - ZoneType.HeavyContainment => "Heavy Containment Zone", - ZoneType.Entrance => "Entrance Zone", - ZoneType.Surface => "Surface", - ZoneType.Pocket => "Pocket Dimension", - _ => string.Empty, - }; - } - } -} diff --git a/KruacentExiled/KE.Utils/Display/DisplayPlayer.cs b/KruacentExiled/KE.Utils/Display/DisplayPlayer.cs new file mode 100644 index 00000000..df684557 --- /dev/null +++ b/KruacentExiled/KE.Utils/Display/DisplayPlayer.cs @@ -0,0 +1,119 @@ +using Exiled.API.Features; +using Exiled.API.Interfaces; +using KE.Utils.Display.Enums; +using MEC; +using RueI.Displays; +using RueI.Elements; +using RueI.Elements.Enums; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace KE.Utils.Display +{ + public class DisplayPlayer + { + private static Dictionary _displays = new(); + private RueI.Displays.Display _display; + private Dictionary _hints = new(); + private Player _player; + public Player Player { get { return _player; } } + public static DisplayPlayer Get(Player player) + { + if (!_displays.ContainsKey(player)) + _displays.Add(player, new DisplayPlayer(player)); + return _displays[player]; + } + + public DisplayPlayer(Player player) + { + _player = player; + _display = new (DisplayCore.Get(player.ReferenceHub)); + } + + public Element Hint(Position position, string text) + { + if (_hints.ContainsKey(position)) return null; + SetElement element = new((float)position.VPosition, $"" + text + ""); + _display.Elements.Add(element); + _hints.Add(position, element); + UpdateCore(_player); + return element; + } + + + public Element Hint(Position position,string text,float seconds) + { + if (_hints.ContainsKey(position)) return null; + SetElement element = new((float)position.VPosition, $""+text+""); + _display.Elements.Add(element); + _hints.Add(position, element); + UpdateCore(_player); + Timing.CallDelayed(seconds, () => + { + _display.Elements.Remove(element); + _hints.Remove(position); + UpdateCore(_player); + }); + return element; + } + + + public Element Hint(RueIHint hint) + { + if (hint.Duration < 0) + return Hint(hint.Position, hint.RawContent); + return Hint(hint.Position,hint.RawContent,hint.Duration); + } + + public bool RemoveHint(Position placement) + { + if (!_hints.ContainsKey(placement)) return false; + bool result = _display.Elements.Remove(_hints[placement]); + _hints.Remove(placement); + UpdateCore(_player); + return result; + } + + public bool RemoveHint(Element elem) + { + bool result = _display.Elements.Remove(elem); + _hints.Remove(_hints.First(x => x.Value == elem).Key); + UpdateCore(_player); + return result; + } + + + public static void UpdateCore(Player player) => DisplayCore.Get(player.ReferenceHub).Update(); + + + } + public struct Position + { + private HPosition _hposition; + public HPosition HPosition { get { return _hposition; } } + private VPosition _vposition; + public VPosition VPosition { get { return _vposition; } } + + public Position(HPosition hposition, VPosition vposition) + { + _hposition = hposition; + _vposition = vposition; + } + + public override bool Equals(object obj) + { + Position pos = (Position)obj; + return pos.VPosition == VPosition && pos.HPosition == HPosition; + } + public override int GetHashCode() + { + return base.GetHashCode(); + } + } + + + +} diff --git a/KruacentExiled/KE.Utils/Display/Enums/HPosition.cs b/KruacentExiled/KE.Utils/Display/Enums/HPosition.cs new file mode 100644 index 00000000..023c8016 --- /dev/null +++ b/KruacentExiled/KE.Utils/Display/Enums/HPosition.cs @@ -0,0 +1,15 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace KE.Utils.Display.Enums +{ + public enum HPosition + { + Left, + Center, + Right, + } +} diff --git a/KruacentExiled/KE.Utils/Display/Enums/VPosition.cs b/KruacentExiled/KE.Utils/Display/Enums/VPosition.cs new file mode 100644 index 00000000..264c78dd --- /dev/null +++ b/KruacentExiled/KE.Utils/Display/Enums/VPosition.cs @@ -0,0 +1,15 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace KE.Utils.Display.Enums +{ + public enum VPosition + { + GlobalEvent = 900, + CustomItem = 200, + CustomRole = 400, + } +} diff --git a/KruacentExiled/KE.Utils/Display/RueIHint.cs b/KruacentExiled/KE.Utils/Display/RueIHint.cs new file mode 100644 index 00000000..af4cd7b4 --- /dev/null +++ b/KruacentExiled/KE.Utils/Display/RueIHint.cs @@ -0,0 +1,34 @@ +using KE.Utils.Display.Enums; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace KE.Utils.Display +{ + public class RueIHint + { + private Position _position; + public Position Position { get { return _position; } } + private string _content; + public string RawContent { get { return _content; } } + private float _duration = -1; + public float Duration { get { return _duration; } } + + public RueIHint(HPosition hposition, VPosition vposition, string content) + { + _position = new(hposition, vposition); + _content = content; + } + public RueIHint(HPosition hposition, VPosition vposition, string content,float duration) + { + _position = new(hposition, vposition); + _content = content; + _duration = duration; + } + + + + } +} diff --git a/KruacentExiled/KE.Utils/Extensions/PlayerExtension.cs b/KruacentExiled/KE.Utils/Extensions/PlayerExtension.cs new file mode 100644 index 00000000..fd6b85d9 --- /dev/null +++ b/KruacentExiled/KE.Utils/Extensions/PlayerExtension.cs @@ -0,0 +1,35 @@ +using Exiled.API.Features; +using Mirror; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using UnityEngine; + +namespace KE.Utils.Extensions +{ + public static class PlayerExtension + { + public static void SetFakeInvis(this Player p, IEnumerable viewers) + { + Vector3 pos = p.Position; + + try + { + p.ReferenceHub.transform.localPosition = Vector3.zero; + foreach (Player viewer in viewers) + { + Server.SendSpawnMessage.Invoke(null, new object[2] { viewer.NetworkIdentity, viewer.Connection }); + } + + p.ReferenceHub.transform.localPosition = pos; + } + catch (Exception arg) + { + Log.Error(string.Format("{0}: {1}", "SetFakeInvis", arg)); + } + } + + } +} diff --git a/KruacentExiled/KE.Utils/Extensions/RoomExtensions.cs b/KruacentExiled/KE.Utils/Extensions/RoomExtensions.cs index 6bc3ffd6..d75e0873 100644 --- a/KruacentExiled/KE.Utils/Extensions/RoomExtensions.cs +++ b/KruacentExiled/KE.Utils/Extensions/RoomExtensions.cs @@ -2,15 +2,14 @@ using Exiled.API.Enums; using Discord; -namespace KE.BlackoutNDoor.Extensions +namespace KE.Utils.Extensions { - //todo move to utils public static class RoomExtensions { - + public static bool IsSafe(this Room room) { - return IsSafe(room.Zone); + return room.Zone.IsSafe(); } diff --git a/KruacentExiled/KE.Utils/KE.Utils.csproj b/KruacentExiled/KE.Utils/KE.Utils.csproj index 6c3aa503..72133b13 100644 --- a/KruacentExiled/KE.Utils/KE.Utils.csproj +++ b/KruacentExiled/KE.Utils/KE.Utils.csproj @@ -6,13 +6,7 @@ - - - - - - - + diff --git a/KruacentExiled/KE.Utils/Tests/PrimitiveTest.cs b/KruacentExiled/KE.Utils/Tests/PrimitiveTest.cs index d75fd81e..e659d098 100644 --- a/KruacentExiled/KE.Utils/Tests/PrimitiveTest.cs +++ b/KruacentExiled/KE.Utils/Tests/PrimitiveTest.cs @@ -23,10 +23,5 @@ public static void TestSetFakePrimitive(Player pl) p = Primitive.Create(pl.Position+ UnityEngine.Vector3.back,null,null,true,UnityEngine.Color.red); p.SetFakePrimitive(null); } - - public static void TestTrucquegtrouvesurlediscorddexiled(Player pl) - { - - } } } From 2dd04c7e60aac2c31233c00bdf4ffde1cbab21a5 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Thu, 13 Mar 2025 21:47:47 +0100 Subject: [PATCH 218/853] changed doorman id --- KruacentExiled/KE.CustomRoles/CR/SCP/ZombieDoorman.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/KruacentExiled/KE.CustomRoles/CR/SCP/ZombieDoorman.cs b/KruacentExiled/KE.CustomRoles/CR/SCP/ZombieDoorman.cs index da5e9593..e328cde5 100644 --- a/KruacentExiled/KE.CustomRoles/CR/SCP/ZombieDoorman.cs +++ b/KruacentExiled/KE.CustomRoles/CR/SCP/ZombieDoorman.cs @@ -15,7 +15,7 @@ internal class ZombieDoorman : CustomRole { public override string Name { get; set; } = "SCP-049-2-Door"; public override string Description { get; set; } = "U can open lock door with ur ability clapclapclap"; - public override uint Id { get; set; } = 1056; + public override uint Id { get; set; } = 1053; public override string CustomInfo { get; set; } = "SCP-049-2-Door"; public override int MaxHealth { get; set; } = 400; public override RoleTypeId Role { get; set; } = RoleTypeId.Scp0492; From 93121b399292005da465d7e4f46e3ad3e1daa269 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Thu, 13 Mar 2025 21:48:33 +0100 Subject: [PATCH 219/853] added alzheimer fix #96 added diabetique fix #95 --- .../KE.CustomRoles/CR/Human/Alzheimer.cs | 51 +++++++++++++++++++ .../KE.CustomRoles/CR/Human/Diabetique.cs | 29 +++++++++++ 2 files changed, 80 insertions(+) create mode 100644 KruacentExiled/KE.CustomRoles/CR/Human/Alzheimer.cs create mode 100644 KruacentExiled/KE.CustomRoles/CR/Human/Diabetique.cs diff --git a/KruacentExiled/KE.CustomRoles/CR/Human/Alzheimer.cs b/KruacentExiled/KE.CustomRoles/CR/Human/Alzheimer.cs new file mode 100644 index 00000000..32ab0175 --- /dev/null +++ b/KruacentExiled/KE.CustomRoles/CR/Human/Alzheimer.cs @@ -0,0 +1,51 @@ +using Exiled.API.Enums; +using Exiled.API.Features; +using Exiled.API.Features.Attributes; +using Exiled.CustomRoles.API.Features; +using KE.CustomRoles.API; +using MEC; +using PlayerRoles; +using System.Collections.Generic; +using UnityEngine; +using Utils.NonAllocLINQ; + +namespace KE.CustomRoles.CR.Human +{ + [CustomRole(RoleTypeId.None)] + internal class Alzheimer : GlobalCustomRole + { + private static Dictionary _coroutines = new(); + public override SideEnum Side { get; set; } = SideEnum.Human; + public override string Name { get; set; } = "Alzheimer"; + public override string Description { get; set; } = "Tu es Vieux"; + public override uint Id { get; set; } = 1054; + public override string CustomInfo { get; set; } = "Vieux"; + public override int MaxHealth { get; set; } = 100; + public override bool KeepRoleOnDeath { get; set; } = true; + public override bool KeepRoleOnChangingRole { get; set; } = true; + protected override void RoleAdded(Player player) + { + _coroutines.Add(player, Timing.RunCoroutine(Teleport(player))); + } + + protected override void RoleRemoved(Player player) + { + Timing.KillCoroutines(_coroutines[player]); + _coroutines.Remove(player); + } + + + private IEnumerator Teleport(Player p) + { + while (true) + { + yield return Timing.WaitForSeconds(UnityEngine.Random.Range(300f, 600f)); + p.EnableEffect(EffectType.Flashed,5); + p.EnableEffect(EffectType.Invisible,5); + p.Teleport(Room.Random(p.Zone)); + } + } + + + } +} diff --git a/KruacentExiled/KE.CustomRoles/CR/Human/Diabetique.cs b/KruacentExiled/KE.CustomRoles/CR/Human/Diabetique.cs new file mode 100644 index 00000000..242e8575 --- /dev/null +++ b/KruacentExiled/KE.CustomRoles/CR/Human/Diabetique.cs @@ -0,0 +1,29 @@ +using Exiled.API.Enums; +using Exiled.API.Features; +using Exiled.API.Features.Attributes; +using Exiled.CustomRoles.API.Features; +using KE.CustomRoles.API; +using PlayerRoles; +using UnityEngine; +using Utils.NonAllocLINQ; + +namespace KE.CustomRoles.CR.Human +{ + [CustomRole(RoleTypeId.None)] + internal class Diabetique : GlobalCustomRole + { + public override SideEnum Side { get; set; } = SideEnum.Human; + public override string Name { get; set; } = "Diabetique"; + public override string Description { get; set; } = "Tu es asthmatique\nT'as stamina est réduit de moitié\nMais tu vises mieux"; + public override uint Id { get; set; } = 1054; + public override string CustomInfo { get; set; } = "Diabetique"; + public override int MaxHealth { get; set; } = 100; + public override bool KeepRoleOnDeath { get; set; } = true; + public override bool KeepRoleOnChangingRole { get; set; } = true; + + protected override void RoleAdded(Player player) + { + player.EnableEffect(EffectType.Scp207, -1, true); + } + } +} From 0cf8ec108dc77ff615cd9294217e2101ae80e68d Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Fri, 14 Mar 2025 11:09:42 +0100 Subject: [PATCH 220/853] scp035 --- KruacentExiled/KE.Misc/MainPlugin.cs | 8 ++- KruacentExiled/KE.Misc/Misc/CR/Scp035.cs | 89 ++++++++++++++++++++++++ KruacentExiled/KE.Misc/Misc/SCPBuff.cs | 9 ++- KruacentExiled/KE.Misc/Misc/Spawn.cs | 88 ++++++++++++++--------- 4 files changed, 159 insertions(+), 35 deletions(-) create mode 100644 KruacentExiled/KE.Misc/Misc/CR/Scp035.cs diff --git a/KruacentExiled/KE.Misc/MainPlugin.cs b/KruacentExiled/KE.Misc/MainPlugin.cs index 890a1327..7f9cab45 100644 --- a/KruacentExiled/KE.Misc/MainPlugin.cs +++ b/KruacentExiled/KE.Misc/MainPlugin.cs @@ -17,6 +17,8 @@ using Exiled.Events.Commands.Hub; using RueI.Displays; using RueI.Extensions; +using Exiled.CustomRoles.API.Features; +using KE.Misc.Misc.CR; namespace KE.Misc { @@ -64,7 +66,8 @@ public override void OnEnabled() ServerHandle.RoundStarted += ServerHandler.OnRoundStarted; Nine14Handle.UpgradingPlayer += _914.OnUpgradingPlayer; Exiled.Events.Handlers.Player.Dying += ScpNoeDeathMessage; - + ServerHandle.EndingRound += Spawn.EndingRound; + CustomRole.RegisterRoles(false, null, true, this.Assembly); } @@ -74,13 +77,14 @@ public override void OnDisabled() Nine14Handle.UpgradingPlayer -= _914.OnUpgradingPlayer; Exiled.Events.Handlers.Player.Dying -= ScpNoeDeathMessage; ServerHandle.RoundStarted -= Spawn.OnRoundStarted; + ServerHandle.EndingRound -= Spawn.EndingRound; if (Instance.Config.ChancePinkCandy >= 0 && Instance.Config.ChancePinkCandy <= 100) { Exiled.Events.Handlers.Scp330.InteractingScp330 -= Candy.InteractingScp330; Candy = null; } - + CustomRole.UnregisterRoles([typeof(Scp035)]); _914 = null; diff --git a/KruacentExiled/KE.Misc/Misc/CR/Scp035.cs b/KruacentExiled/KE.Misc/Misc/CR/Scp035.cs new file mode 100644 index 00000000..4ed5333d --- /dev/null +++ b/KruacentExiled/KE.Misc/Misc/CR/Scp035.cs @@ -0,0 +1,89 @@ +using Exiled.API.Features; +using Exiled.API.Features.Attributes; +using Exiled.API.Features.Spawn; +using Exiled.CustomRoles.API.Features; +using Exiled.Events.EventArgs.Interfaces; +using Exiled.Events.EventArgs.Player; +using PlayerRoles; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace KE.Misc.Misc.CR +{ + [CustomRole(RoleTypeId.Tutorial)] + public class Scp035 : CustomRole + { + internal static HashSet _trackedPlayers = new (); + public override uint Id { get; set; } = 10; + public override string Description { get; set; } = "t'es un humain dans la team des scp en gros "; + public override RoleTypeId Role { get; set; } = RoleTypeId.Tutorial; + public override int MaxHealth { get; set; } = 600; + public override string Name { get; set; } = "SCP-035"; + public override string CustomInfo { get; set; } = string.Empty; + public override bool IgnoreSpawnSystem { get; set; } = true; + public override SpawnProperties SpawnProperties { get; set; } = new() + { + DynamicSpawnPoints = new() + { + new() + { + Location = Exiled.API.Enums.SpawnLocationType.Inside096 + } + } + }; + protected override void RoleAdded(Player player) + { + _trackedPlayers.Add(player); + } + + protected override void RoleRemoved(Player player) + { + _trackedPlayers.Remove(player); + } + + protected override void SubscribeEvents() + { + Exiled.Events.Handlers.Player.EnteringPocketDimension += OnEnteringPocketDimension; + Exiled.Events.Handlers.Player.Hurting += OnHurting; + Exiled.Events.Handlers.Player.Shot += OnShot; + Exiled.Events.Handlers.Player.ActivatingGenerator += OnActivatingGenerator; + } + + protected override void UnsubscribeEvents() + { + Exiled.Events.Handlers.Player.EnteringPocketDimension -= OnEnteringPocketDimension; + Exiled.Events.Handlers.Player.Hurting -= OnHurting; + Exiled.Events.Handlers.Player.Shot -= OnShot; + Exiled.Events.Handlers.Player.ActivatingGenerator -= OnActivatingGenerator; + } + + + private void OnEnteringPocketDimension(EnteringPocketDimensionEventArgs ev) + { + if (Check(ev.Player)) + ev.IsAllowed = false; + } + + private void OnHurting(HurtingEventArgs ev) + { + if (ev.Attacker is null) return; + if ((Check(ev.Player) || Check(ev.Attacker)) && (ev.Player.IsScp || ev.Attacker.IsScp)) + ev.IsAllowed = false; + } + + private void OnShot(ShotEventArgs ev) + { + if (ev.Target != null && ev.Target.IsScp && Check(ev.Player)) + ev.CanHurt = false; + } + + private void OnActivatingGenerator(ActivatingGeneratorEventArgs ev) + { + if (Check(ev.Player)) + ev.IsAllowed = false; + } + } +} diff --git a/KruacentExiled/KE.Misc/Misc/SCPBuff.cs b/KruacentExiled/KE.Misc/Misc/SCPBuff.cs index 090a8da8..12918298 100644 --- a/KruacentExiled/KE.Misc/Misc/SCPBuff.cs +++ b/KruacentExiled/KE.Misc/Misc/SCPBuff.cs @@ -23,8 +23,15 @@ internal void StartBuff() } - internal void BecomingSCP(ChangingRoleEventArgs ev) + + internal void BuffXp() + { + + } + + internal void BecomingSCP(ChangingRoleEventArgs ev) { + if (!ev.NewRole.IsScp() || ev.NewRole == RoleTypeId.Scp0492) return; if(ev.Player.Role == RoleTypeId.None) return; Player p = ev.Player; diff --git a/KruacentExiled/KE.Misc/Misc/Spawn.cs b/KruacentExiled/KE.Misc/Misc/Spawn.cs index 282b3bb9..5dbb4d54 100644 --- a/KruacentExiled/KE.Misc/Misc/Spawn.cs +++ b/KruacentExiled/KE.Misc/Misc/Spawn.cs @@ -3,9 +3,12 @@ using Exiled.API.Features; using Exiled.API.Features.Attributes; using Exiled.CustomRoles.API.Features; +using Exiled.Events.EventArgs.Server; +using KE.Misc.Misc.CR; using KE.Utils.Display; using MEC; using PlayerRoles; +using RueI.Displays; using RueI.Elements; using System; using System.Collections.Generic; @@ -21,11 +24,7 @@ public void OnRoundStarted() { if (!MainPlugin.Instance.Config.ScpPreferences) return; - HashSet pl; - if (!MainPlugin.Instance.Config.Debug) - pl = Player.List.Where(p => p.IsScp).ToHashSet(); - else - pl = [.. Player.List]; + HashSet pl = [.. Player.List]; foreach (Player player in pl) { @@ -43,32 +42,57 @@ private void SetScpPreferences(Player player) Log.Debug($"Scp ({player.Nickname}) is {roleScp} previous : {player.Role.Type}"); player.Role.Set(roleScp); - if (roleScp == RoleTypeId.Scp096 || roleScp == RoleTypeId.Scp079 && !config.Scp035Enabled || config.Debug) - { - float timetodecide = 60; - RueIHint h = new (Utils.Display.Enums.HPosition.Center, Utils.Display.Enums.VPosition.CustomRole, "You're a support class \nYou can change your scp by doing the command .scp \n(eg .scp 173 -> scp-173)", timetodecide); - var a = DisplayPlayer.Get(player).Hint(h); - ChangeSCP._players.Add(player,a); - Timing.CallDelayed(timetodecide, () => - { - ChangeSCP._players.Remove(player); - DisplayPlayer.Get(player).RemoveHint(a); - }); - } + SupportClassBackup(player); if (config.Scp035Enabled && roleScp == RoleTypeId.Scp079) { - _set035 = !_set035; - if (_set035) + Player pl = Player.List.GetRandomValue(p => p.Role == RoleTypeId.ClassD || p.Role == RoleTypeId.Scientist); + RoleTypeId otherScp = ChooseRandomRole(pl.ScpPreferences.Preferences.ToDictionary(p => p.Key, p => p.Value + 6)); + + if(otherScp == RoleTypeId.Scp079) { - Player pl = Player.List.GetRandomValue(p => p.Role == RoleTypeId.ClassD || p.Role == RoleTypeId.Scientist); - CustomRole scp = CustomRole.Registered.FirstOrDefault(c => c.Id == 10); - scp.AddRole(pl); + _set035 = !_set035; + if (_set035) + { + CustomRole scp = CustomRole.Registered.FirstOrDefault(c => c.Id == 10); + scp.AddRole(pl); + } + else + { + pl.Role.Set(otherScp); + } + } + else + { + pl.Role.Set(otherScp); + SupportClassBackup(pl); + Timing.CallDelayed(1f, () => + { + pl.MaxHealth /= 2; + pl.Health = pl.MaxHealth; + }); } } } + private void SupportClassBackup(Player player) + { + if (player.Role == RoleTypeId.Scp096 || player.Role == RoleTypeId.Scp079 && !MainPlugin.Instance.Config.Scp035Enabled || MainPlugin.Instance.Config.Debug) return; + float timetodecide = 60; + RueIHint h = new(Utils.Display.Enums.HPosition.Center-50, Utils.Display.Enums.VPosition.CustomRole, "You're a support class \nYou can change your scp by doing the command .scp \n(eg .scp 173 -> scp-173)", timetodecide); + var a = DisplayPlayer.Get(player).Hint(h); + ChangeSCP._players.Add(player, a); + Timing.CallDelayed(timetodecide, () => + { + ChangeSCP._players.Remove(player); + DisplayPlayer.Get(player).RemoveHint(a); + }); + } + + + + private RoleTypeId ChooseRandomRole(Dictionary chancescp) { List weightedPool = new List(); @@ -86,16 +110,16 @@ private RoleTypeId ChooseRandomRole(Dictionary chancescp) return weightedPool[randomIndex]; } - } - [CustomRole(RoleTypeId.Tutorial)] - public class Scp035 : CustomRole - { - public override uint Id { get; set; } = 10; - public override string Description { get; set; } = "t'es un humain dans la team des scp en gros "; - public override int MaxHealth { get; set; } = 600; - public override string Name { get; set; } = "SCP-035"; - public override string CustomInfo { get; set; } = string.Empty; + public void EndingRound(EndingRoundEventArgs ev) + { + if (Scp035._trackedPlayers.Count <= 0) return; + + if (ev.ClassList.mtf_and_guards != 0 || ev.ClassList.scientists != 0) ev.IsAllowed = false; + else if (ev.ClassList.class_ds != 0 || ev.ClassList.chaos_insurgents != 0) ev.IsAllowed = false; + else if (ev.ClassList.scps_except_zombies + ev.ClassList.zombies > 0) ev.IsAllowed = true; + else ev.IsAllowed = true; + } } @@ -132,7 +156,7 @@ public bool Execute(ArraySegment arguments, ICommandSender sender, out s string scp = arguments.At(0); if (!Enum.TryParse(scp, out RoleTypeId roleType) && roleType.IsScp() && roleType != RoleTypeId.Scp0492) { - response = "wrong scp number"; + response = "wrong scp number \n(eg .scp Scp173 -> scp-173)"; return false; } From e609a6f77d42d2b6b0fc9a07d4ef92c641543262 Mon Sep 17 00:00:00 2001 From: Omer <113857370+OmerGS@users.noreply.github.com> Date: Fri, 14 Mar 2025 11:38:12 +0100 Subject: [PATCH 221/853] Added Maladroit fix #74 Removed Effect when role removed Asthmaique Change if of Alzheimer. --- .../KE.CustomRoles/CR/Human/Alzheimer.cs | 2 +- .../KE.CustomRoles/CR/Human/Asthmatique.cs | 6 ++ .../KE.CustomRoles/CR/Human/Maladroit.cs | 78 +++++++++++++++++++ 3 files changed, 85 insertions(+), 1 deletion(-) create mode 100644 KruacentExiled/KE.CustomRoles/CR/Human/Maladroit.cs diff --git a/KruacentExiled/KE.CustomRoles/CR/Human/Alzheimer.cs b/KruacentExiled/KE.CustomRoles/CR/Human/Alzheimer.cs index 32ab0175..36ddc818 100644 --- a/KruacentExiled/KE.CustomRoles/CR/Human/Alzheimer.cs +++ b/KruacentExiled/KE.CustomRoles/CR/Human/Alzheimer.cs @@ -18,7 +18,7 @@ internal class Alzheimer : GlobalCustomRole public override SideEnum Side { get; set; } = SideEnum.Human; public override string Name { get; set; } = "Alzheimer"; public override string Description { get; set; } = "Tu es Vieux"; - public override uint Id { get; set; } = 1054; + public override uint Id { get; set; } = 1056; public override string CustomInfo { get; set; } = "Vieux"; public override int MaxHealth { get; set; } = 100; public override bool KeepRoleOnDeath { get; set; } = true; diff --git a/KruacentExiled/KE.CustomRoles/CR/Human/Asthmatique.cs b/KruacentExiled/KE.CustomRoles/CR/Human/Asthmatique.cs index 2638ad5b..0902f082 100644 --- a/KruacentExiled/KE.CustomRoles/CR/Human/Asthmatique.cs +++ b/KruacentExiled/KE.CustomRoles/CR/Human/Asthmatique.cs @@ -26,5 +26,11 @@ protected override void RoleAdded(Player player) player.EnableEffect(EffectType.Scp1853, -1, true); player.EnableEffect(EffectType.Exhausted, -1, true); } + + protected override void RoleRemoved(Player player) + { + player.DisableEffect(EffectType.Scp1853); + player.DisableEffect(EffectType.Exhausted); + } } } diff --git a/KruacentExiled/KE.CustomRoles/CR/Human/Maladroit.cs b/KruacentExiled/KE.CustomRoles/CR/Human/Maladroit.cs new file mode 100644 index 00000000..67cfdd79 --- /dev/null +++ b/KruacentExiled/KE.CustomRoles/CR/Human/Maladroit.cs @@ -0,0 +1,78 @@ +using Exiled.API.Enums; +using Exiled.API.Extensions; +using Exiled.API.Features; +using Exiled.API.Features.Attributes; +using Exiled.CustomRoles.API.Features; +using KE.CustomRoles.API; +using MEC; +using PlayerRoles; +using System; +using System.Collections.Generic; +using System.Drawing.Design; +using System.Linq; +using UnityEngine; +using Utils.NonAllocLINQ; + +namespace KE.CustomRoles.CR.Human +{ + [CustomRole(RoleTypeId.None)] + internal class Maladroit : GlobalCustomRole + { + private static Dictionary _coroutines = new(); + + public override SideEnum Side { get; set; } = SideEnum.Human; + public override string Name { get; set; } = "Maladroit"; + public override string Description { get; set; } = "Tu es maladroit\nFait attention à tes items !"; + public override uint Id { get; set; } = 1057; + public override string CustomInfo { get; set; } = "Maladroit"; + public override int MaxHealth { get; set; } = 100; + public override bool KeepRoleOnDeath { get; set; } = false; + public override bool KeepRoleOnChangingRole { get; set; } = true; + + protected override void RoleAdded(Player player) + { + _coroutines.Add(player, Timing.RunCoroutine(ThrowingItem(player))); + } + + protected override void RoleRemoved(Player player) + { + Timing.KillCoroutines(_coroutines[player]); + _coroutines.Remove(player); + } + + private IEnumerator ThrowingItem(Player p) + { + Dictionary ActionDictionnary = new() + { + { 50, () => p.DropHeldItem() }, + { 80, () => { /* Nothing */ } }, + { 95, () => DropItemFromInventory(p, 1) }, + { 100, () => DropItemFromInventory(p, 2) }, + }; + + + while (true) + { + yield return Timing.WaitForSeconds(UnityEngine.Random.Range(120f, 200f)); + int proba = UnityEngine.Random.Range(0, 101); + + foreach (var seuil in ActionDictionnary.Keys.OrderBy(p => p)) + { + if(proba < seuil) + { + ActionDictionnary[seuil](); + break; + } + } + } + } + + private void DropItemFromInventory(Player p, int number) + { + for(int i = 0; i <= number; i++) + { + p.DropItem(p.Items.GetRandomValue()); + } + } + } +} \ No newline at end of file From 64f8b8335cb351cdbbe381db7adea2f03543d3cf Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Fri, 14 Mar 2025 11:51:29 +0100 Subject: [PATCH 222/853] Added preset of Display --- .../KE.Utils/Display/DisplayPlayer.cs | 24 +------ KruacentExiled/KE.Utils/Display/Position.cs | 67 +++++++++++++++++++ 2 files changed, 68 insertions(+), 23 deletions(-) create mode 100644 KruacentExiled/KE.Utils/Display/Position.cs diff --git a/KruacentExiled/KE.Utils/Display/DisplayPlayer.cs b/KruacentExiled/KE.Utils/Display/DisplayPlayer.cs index df684557..864d2c1a 100644 --- a/KruacentExiled/KE.Utils/Display/DisplayPlayer.cs +++ b/KruacentExiled/KE.Utils/Display/DisplayPlayer.cs @@ -90,29 +90,7 @@ public bool RemoveHint(Element elem) } - public struct Position - { - private HPosition _hposition; - public HPosition HPosition { get { return _hposition; } } - private VPosition _vposition; - public VPosition VPosition { get { return _vposition; } } - - public Position(HPosition hposition, VPosition vposition) - { - _hposition = hposition; - _vposition = vposition; - } - - public override bool Equals(object obj) - { - Position pos = (Position)obj; - return pos.VPosition == VPosition && pos.HPosition == HPosition; - } - public override int GetHashCode() - { - return base.GetHashCode(); - } - } + diff --git a/KruacentExiled/KE.Utils/Display/Position.cs b/KruacentExiled/KE.Utils/Display/Position.cs new file mode 100644 index 00000000..5b819d75 --- /dev/null +++ b/KruacentExiled/KE.Utils/Display/Position.cs @@ -0,0 +1,67 @@ +using KE.Utils.Display.Enums; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace KE.Utils.Display +{ + public struct Position + { + private HPosition _hposition; + public HPosition HPosition { get { return _hposition; } } + private float _vposition; + [Obsolete("use RawVPosition Instead")] + public VPosition VPosition { get { return (VPosition)_vposition; } } + public float RawVPosition { get { return _vposition; } } + + private static readonly Position globalEvent = new (HPosition.Center, 900); + private static readonly Position customItemShow = new(HPosition.Right, 200); + private static readonly Position customRoleShow = new(HPosition.Left, 200); + private static readonly Position customRoleEffect = new(HPosition.Left, 400); + private static readonly Position customGlobalEffect = new(HPosition.Right, 400); + public static Position GlobalEvent + { + get { return globalEvent; } + } + public static Position CustomItemShow + { + get { return customItemShow; } + } + public static Position CustomRoleShow + { + get { return customRoleShow; } + } + public static Position CustomRoleEffect + { + get { return customRoleEffect; } + } + public static Position CustomGlobalEffect + { + get { return customGlobalEffect; } + } + + public Position(HPosition hposition, VPosition vposition) + { + _hposition = hposition; + _vposition = (float) vposition; + } + + public Position(HPosition hposition, float vposition) + { + _hposition = hposition; + _vposition = vposition; + } + + public override bool Equals(object obj) + { + Position pos = (Position)obj; + return pos.VPosition == VPosition && pos.HPosition == HPosition; + } + public override int GetHashCode() + { + return base.GetHashCode(); + } + } +} From 3d2ade3a1f14ea78370b6f5f6b9f6ea1e4f43f41 Mon Sep 17 00:00:00 2001 From: RomainPERON Date: Fri, 14 Mar 2025 12:05:23 +0100 Subject: [PATCH 223/853] Add Mime CustomRole --- .../KE.CustomRoles/API/GlobalCustomRole.cs | 4 +- .../KE.CustomRoles/CR/ClassD/Mime.cs | 42 +++++++++++++++++++ 2 files changed, 44 insertions(+), 2 deletions(-) create mode 100644 KruacentExiled/KE.CustomRoles/CR/ClassD/Mime.cs diff --git a/KruacentExiled/KE.CustomRoles/API/GlobalCustomRole.cs b/KruacentExiled/KE.CustomRoles/API/GlobalCustomRole.cs index 80abcb5d..35e71d10 100644 --- a/KruacentExiled/KE.CustomRoles/API/GlobalCustomRole.cs +++ b/KruacentExiled/KE.CustomRoles/API/GlobalCustomRole.cs @@ -1,4 +1,4 @@ -using Exiled.API.Enums; +/*using Exiled.API.Enums; using Exiled.API.Features; using Exiled.API.Features.Attributes; using Exiled.API.Features.Pools; @@ -125,4 +125,4 @@ public override void AddRole(Player player) } } -} +}*/ diff --git a/KruacentExiled/KE.CustomRoles/CR/ClassD/Mime.cs b/KruacentExiled/KE.CustomRoles/CR/ClassD/Mime.cs new file mode 100644 index 00000000..ce25844b --- /dev/null +++ b/KruacentExiled/KE.CustomRoles/CR/ClassD/Mime.cs @@ -0,0 +1,42 @@ +using Exiled.API.Enums; +using Exiled.API.Features; +using Exiled.API.Features.Attributes; +using Exiled.Events.EventArgs.Player; +using InventorySystem.Items.Usables.Scp330; +using PlayerRoles; +using System.Collections.Generic; +using UnityEngine; + +namespace KE.CustomRoles.CR.ClassD +{ + [CustomRole(RoleTypeId.ClassD)] + internal class Mime : Exiled.CustomRoles.API.Features.CustomRole + { + public override string Name { get; set; } = "mime"; + public override string Description { get; set; } = "Tu es un Mime \nTu ne peux pas parler\nmais tu fais très peu de bruit quand tu marches\net t'es tout plat"; + public override uint Id { get; set; } = 1053; + public override string CustomInfo { get; set; } = "Mime"; + public override int MaxHealth { get; set; } = 100; + public override RoleTypeId Role { get; set; } = RoleTypeId.ClassD; + public override bool KeepRoleOnDeath { get; set; } = false; + public override bool KeepRoleOnChangingRole { get; set; } = true; + public override bool IgnoreSpawnSystem { get; set; } = true; + + public override float SpawnChance { get; set; } = 100; + public override Vector3 Scale { get; set; } = new Vector3(0.1f, 1, 1); + + protected override void RoleAdded(Player player) + { + player.EnableEffect(EffectType.SilentWalk, -1, true); + player.Mute(); + } + + protected override void RoleRemoved(Player player) + { + player.UnMute(); + player.DisableEffect(EffectType.SilentWalk); + } + + + } +} From db21a0486265dffcedf596a1262b2459c9d825fb Mon Sep 17 00:00:00 2001 From: Omer <113857370+OmerGS@users.noreply.github.com> Date: Fri, 14 Mar 2025 15:41:04 +0100 Subject: [PATCH 224/853] fix #71 --- .../KE.CustomRoles/CR/ClassD/DBoyInShape.cs | 96 +++++++++++++++++++ .../KE.CustomRoles/CR/Human/Diabetique.cs | 2 +- 2 files changed, 97 insertions(+), 1 deletion(-) create mode 100644 KruacentExiled/KE.CustomRoles/CR/ClassD/DBoyInShape.cs diff --git a/KruacentExiled/KE.CustomRoles/CR/ClassD/DBoyInShape.cs b/KruacentExiled/KE.CustomRoles/CR/ClassD/DBoyInShape.cs new file mode 100644 index 00000000..8fd19de2 --- /dev/null +++ b/KruacentExiled/KE.CustomRoles/CR/ClassD/DBoyInShape.cs @@ -0,0 +1,96 @@ +using Exiled.API.Enums; +using Exiled.API.Extensions; +using Exiled.API.Features; +using Exiled.API.Features.Attributes; +using Exiled.CustomRoles.API.Features; +using Exiled.Events.EventArgs.Map; +using Exiled.Events.EventArgs.Player; +using KE.CustomRoles.API; +using MEC; +using PlayerRoles; +using System; +using System.Collections.Generic; +using System.Linq; +using UnityEngine; +using Utils.NonAllocLINQ; + +namespace KE.CustomRoles.CR.Human +{ + [CustomRole(RoleTypeId.None)] + internal class DBoyInShape : GlobalCustomRole + { + public override SideEnum Side { get; set; } = SideEnum.Human; + public override string Name { get; set; } = "DBoyInShape"; + public override string Description { get; set; } = ""; + public override uint Id { get; set; } = 1058; + public override string CustomInfo { get; set; } = "DBoyInShape"; + public override int MaxHealth { get; set; } = 100; + public override bool KeepRoleOnDeath { get; set; } = false; + public override bool KeepRoleOnChangingRole { get; set; } = true; + + private const float SpeedReduction = 0.85f; + + protected override void RoleAdded(Player player) + { + player.EnableEffect(EffectType.MovementBoost, 5, SpeedReduction); + } + + protected override void RoleRemoved(Player player) + { + player.DisableEffect(EffectType.MovementBoost); + } + + protected override void SubscribeEvents() + { + Exiled.Events.Handlers.Player.InteractingDoor += InterractingDoor; + } + + protected override void UnsubscribeEvents() + { + Exiled.Events.Handlers.Player.InteractingDoor -= InterractingDoor; + } + + public void InterractingDoor(InteractingDoorEventArgs ev) + { + if (ev.IsAllowed) return; + if (!Check(ev.Player)) return; + + int successRate; + int damage; + + if (ev.Door.Type.IsGate()) + { + successRate = 20; + damage = 20; + } + else if (ev.Door.Type.IsCheckpoint()) + { + successRate = 30; + damage = 10; + } + else + { + successRate = 40; + damage = 5; + } + + int proba = UnityEngine.Random.Range(0, 101); + + if (proba <= successRate) + { + ev.IsAllowed = true; + Log.Info($"{ev.Player.Nickname} a réussi à ouvrir une {ev.Door.Type} !"); + } + else + { + ev.Player.Health -= damage; + + if(ev.Player.Health <= 0) + { + ev.Player.Kill(DamageType.SeveredHands); + } + Log.Info($"{ev.Player.Nickname} a échoué à ouvrir une {ev.Door.Type} et a perdu {damage} HP !"); + } + } + } +} \ No newline at end of file diff --git a/KruacentExiled/KE.CustomRoles/CR/Human/Diabetique.cs b/KruacentExiled/KE.CustomRoles/CR/Human/Diabetique.cs index 242e8575..4608bb28 100644 --- a/KruacentExiled/KE.CustomRoles/CR/Human/Diabetique.cs +++ b/KruacentExiled/KE.CustomRoles/CR/Human/Diabetique.cs @@ -14,7 +14,7 @@ internal class Diabetique : GlobalCustomRole { public override SideEnum Side { get; set; } = SideEnum.Human; public override string Name { get; set; } = "Diabetique"; - public override string Description { get; set; } = "Tu es asthmatique\nT'as stamina est réduit de moitié\nMais tu vises mieux"; + public override string Description { get; set; } = "Tu es diabetique\nT'as mangé le crambleu au pomme de mael"; public override uint Id { get; set; } = 1054; public override string CustomInfo { get; set; } = "Diabetique"; public override int MaxHealth { get; set; } = 100; From 9724248fe54bf85c9d024392b2ee3ef199a0e456 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Fri, 14 Mar 2025 18:27:28 +0100 Subject: [PATCH 225/853] Change the mime to use KECR --- KruacentExiled/KE.CustomRoles/CR/ClassD/Mime.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/KruacentExiled/KE.CustomRoles/CR/ClassD/Mime.cs b/KruacentExiled/KE.CustomRoles/CR/ClassD/Mime.cs index ce25844b..db198ea0 100644 --- a/KruacentExiled/KE.CustomRoles/CR/ClassD/Mime.cs +++ b/KruacentExiled/KE.CustomRoles/CR/ClassD/Mime.cs @@ -3,14 +3,16 @@ using Exiled.API.Features.Attributes; using Exiled.Events.EventArgs.Player; using InventorySystem.Items.Usables.Scp330; +using KE.CustomRoles.API; using PlayerRoles; +using PlayerRoles.Spectating; using System.Collections.Generic; using UnityEngine; namespace KE.CustomRoles.CR.ClassD { [CustomRole(RoleTypeId.ClassD)] - internal class Mime : Exiled.CustomRoles.API.Features.CustomRole + internal class Mime : KECustomRole { public override string Name { get; set; } = "mime"; public override string Description { get; set; } = "Tu es un Mime \nTu ne peux pas parler\nmais tu fais très peu de bruit quand tu marches\net t'es tout plat"; @@ -20,8 +22,6 @@ internal class Mime : Exiled.CustomRoles.API.Features.CustomRole public override RoleTypeId Role { get; set; } = RoleTypeId.ClassD; public override bool KeepRoleOnDeath { get; set; } = false; public override bool KeepRoleOnChangingRole { get; set; } = true; - public override bool IgnoreSpawnSystem { get; set; } = true; - public override float SpawnChance { get; set; } = 100; public override Vector3 Scale { get; set; } = new Vector3(0.1f, 1, 1); From cf953fe4f0290152c86eb105027e809a8ba0961f Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Fri, 14 Mar 2025 18:31:31 +0100 Subject: [PATCH 226/853] added chance of spawn + removed singleton of controller --- .../KE.CustomRoles/API/KECustomRole.cs | 11 +++++-- KruacentExiled/KE.CustomRoles/Controller.cs | 29 +++++++++++++++---- KruacentExiled/KE.CustomRoles/MainPlugin.cs | 17 +++++++---- 3 files changed, 43 insertions(+), 14 deletions(-) diff --git a/KruacentExiled/KE.CustomRoles/API/KECustomRole.cs b/KruacentExiled/KE.CustomRoles/API/KECustomRole.cs index e585404d..505e5733 100644 --- a/KruacentExiled/KE.CustomRoles/API/KECustomRole.cs +++ b/KruacentExiled/KE.CustomRoles/API/KECustomRole.cs @@ -19,8 +19,8 @@ namespace KE.CustomRoles.API { public abstract class KECustomRole : CustomRole { - public override bool IgnoreSpawnSystem { get; set; } = true; - protected override void ShowMessage(Exiled.API.Features.Player player) + public sealed override bool IgnoreSpawnSystem { get; set; } = true; + protected override void ShowMessage(Player player) { string show = $"{Name}\n {Description}"; @@ -29,7 +29,7 @@ protected override void ShowMessage(Exiled.API.Features.Player player) DisplayPlayer.Get(player).Hint(r); } - public override void AddRole(Exiled.API.Features.Player player) + public override void AddRole(Player player) { Exiled.API.Features.Player player2 = player; Log.Debug(Name + ": Adding role to " + player2.Nickname + "."); @@ -135,5 +135,10 @@ public override void AddRole(Exiled.API.Features.Player player) player2.SendConsoleMessage(StringBuilderPool.Pool.ToStringReturn(stringBuilder), "green"); } + + /// + /// The chance of having this role NOT the chance to have a role + /// + public override abstract float SpawnChance { get; set; } } } diff --git a/KruacentExiled/KE.CustomRoles/Controller.cs b/KruacentExiled/KE.CustomRoles/Controller.cs index f97b6d05..51686601 100644 --- a/KruacentExiled/KE.CustomRoles/Controller.cs +++ b/KruacentExiled/KE.CustomRoles/Controller.cs @@ -14,10 +14,13 @@ internal class Controller /// /// The chance of having a CustomRole /// - public const int Chance = 100; - public static Controller controller = new Controller(); + public const int Chance = 40; - private Controller() { } + + internal Dictionary GetAvailableCustomRole(Player player) + { + return CustomRole.Registered.Where(c => c.Role == player.Role || c is GlobalCustomRole cgr && cgr.Side == SideClass.Get(player.Role.Side)).ToDictionary(c => c, c=> c.SpawnChance); + } /// /// Gives a CustomRole to a player @@ -32,12 +35,28 @@ internal void GiveRole(Player player) Log.Debug("no luck"); return; } - - CustomRole cr = CustomRole.Registered.GetRandomValue(c => c.Role == player.Role || c is GlobalCustomRole cgr && cgr.Side == SideClass.Get(player.Role.Side)); + + CustomRole cr = AssignRole(GetAvailableCustomRole(player)); Log.Debug($"{player.Id} : {cr.Name}"); cr?.AddRole(player); } + private CustomRole AssignRole(Dictionary roleChances) + { + float totalWeight = roleChances.Values.Sum(); + float randomValue = UnityEngine.Random.Range(0f, totalWeight); + + foreach (var role in roleChances) + { + randomValue -= role.Value; + if (randomValue <= 0) + return role.Key; + } + + return roleChances.Keys.First(); + } + + /// /// Gives CustomRoles to multiple players /// diff --git a/KruacentExiled/KE.CustomRoles/MainPlugin.cs b/KruacentExiled/KE.CustomRoles/MainPlugin.cs index 623628a9..18918223 100644 --- a/KruacentExiled/KE.CustomRoles/MainPlugin.cs +++ b/KruacentExiled/KE.CustomRoles/MainPlugin.cs @@ -2,6 +2,7 @@ using Exiled.CustomRoles.API.Features; using Exiled.Events.EventArgs.Server; using MEC; +using System; namespace KE.CustomRoles @@ -9,28 +10,32 @@ namespace KE.CustomRoles public class MainPlugin : Plugin { public override string Name { get; } = "KE.CustomRoles"; + public override string Author => "Patrique & OmerGS"; + public override Version Version => new(1, 1, 0); public static MainPlugin Instance; + private Controller _controller; public override void OnEnabled() { Instance = this; + _controller = new Controller(); CustomRole.RegisterRoles(false,null); this.SubscribeEvents(); - base.OnEnabled(); } public override void OnDisabled() { CustomRole.UnregisterRoles(); + - Instance = null; - this.UnsubscribeEvents(); - base.OnDisabled(); + this.UnsubscribeEvents(); + _controller = null; + Instance = null; } public void SubscribeEvents() @@ -47,13 +52,13 @@ public void UnsubscribeEvents() public void CustomRoleImplement() { - Controller.controller.GiveRole(Player.List); + _controller.GiveRole(Player.List); } public void CustomRoleRespawning(RespawnedTeamEventArgs ev) { - Controller.controller.GiveRole(ev.Players); + _controller.GiveRole(ev.Players); } } } From ce4c79cd4a28f681bbe330356c47ab318b981972 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Sat, 15 Mar 2025 08:53:14 +0100 Subject: [PATCH 227/853] fix #108 --- KruacentExiled/KE.CustomRoles/CR/Human/Asthmatique.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/KruacentExiled/KE.CustomRoles/CR/Human/Asthmatique.cs b/KruacentExiled/KE.CustomRoles/CR/Human/Asthmatique.cs index 0902f082..cf9c4c15 100644 --- a/KruacentExiled/KE.CustomRoles/CR/Human/Asthmatique.cs +++ b/KruacentExiled/KE.CustomRoles/CR/Human/Asthmatique.cs @@ -17,10 +17,10 @@ internal class Asthmatique : GlobalCustomRole public override string Description { get; set; } = "Tu es asthmatique\nT'as stamina est réduit de moitié\nMais tu vises mieux"; public override uint Id { get; set; } = 1042; public override string CustomInfo { get; set; } = "Asthmatique"; - public override int MaxHealth { get; set; } = 100; public override bool KeepRoleOnDeath { get; set; } = true; public override bool KeepRoleOnChangingRole { get; set; } = true; - + public override float SpawnChance { get; set; } = 100; + protected override void RoleAdded(Player player) { player.EnableEffect(EffectType.Scp1853, -1, true); From f26d685262ad081dea38e86d893fcb0613628c21 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Sat, 15 Mar 2025 08:54:18 +0100 Subject: [PATCH 228/853] added gcr for scps --- .../KE.CustomRoles/API/GlobalCustomRole.cs | 30 +++++++++---------- .../CR/SCP/{Paper049.cs => Paper.cs} | 15 +++++----- KruacentExiled/KE.CustomRoles/CR/SCP/Small.cs | 23 ++++++++++++++ .../KE.CustomRoles/CR/SCP/Small049.cs | 24 --------------- .../KE.CustomRoles/CR/SCP/Small173.cs | 21 ------------- KruacentExiled/KE.CustomRoles/CR/SCP/Tall.cs | 22 ++++++++++++++ 6 files changed, 67 insertions(+), 68 deletions(-) rename KruacentExiled/KE.CustomRoles/CR/SCP/{Paper049.cs => Paper.cs} (59%) create mode 100644 KruacentExiled/KE.CustomRoles/CR/SCP/Small.cs delete mode 100644 KruacentExiled/KE.CustomRoles/CR/SCP/Small049.cs delete mode 100644 KruacentExiled/KE.CustomRoles/CR/SCP/Small173.cs create mode 100644 KruacentExiled/KE.CustomRoles/CR/SCP/Tall.cs diff --git a/KruacentExiled/KE.CustomRoles/API/GlobalCustomRole.cs b/KruacentExiled/KE.CustomRoles/API/GlobalCustomRole.cs index 6bc52105..4da27d29 100644 --- a/KruacentExiled/KE.CustomRoles/API/GlobalCustomRole.cs +++ b/KruacentExiled/KE.CustomRoles/API/GlobalCustomRole.cs @@ -20,9 +20,11 @@ namespace KE.CustomRoles.API public abstract class GlobalCustomRole : KECustomRole { - public override RoleTypeId Role { get; set; } = RoleTypeId.None; + public sealed override RoleTypeId Role { get; set; } = RoleTypeId.None; public abstract SideEnum Side { get; set; } - public virtual IEnumerable BlacklistedRole { get; } = new List(); + public virtual IEnumerable BlacklistedRole { get; } = new HashSet(); + public override bool KeepInventoryOnSpawn { get; set; } = true; + public override void AddRole(Player player) { if (SideClass.Get(player.Role.Side) != Side) return; @@ -58,8 +60,8 @@ public override void AddRole(Player player) }); Log.Debug($"{Name}: Setting health values."); + player.MaxHealth *= MaxHealthMultiplicator; player.Health = MaxHealth; - player.MaxHealth = MaxHealth; player.Scale = Scale; Vector3 position = GetSpawnPosition(); @@ -110,6 +112,9 @@ public override void AddRole(Player player) } + public sealed override int MaxHealth { get; set; } + public virtual float MaxHealthMultiplicator { get; set; } = 1; + } @@ -122,20 +127,15 @@ public enum SideEnum public static class SideClass { - public static SideEnum Get(Exiled.API.Enums.Side side) + public static SideEnum Get(Side side) { - switch (side) + return side switch { - case Exiled.API.Enums.Side.Scp: - return SideEnum.SCP; - case Exiled.API.Enums.Side.Tutorial: - case Exiled.API.Enums.Side.Mtf: - case Exiled.API.Enums.Side.ChaosInsurgency: - return SideEnum.Human; - case Exiled.API.Enums.Side.None: - return SideEnum.None; - } - return SideEnum.None; + Side.Scp => SideEnum.SCP, + Side.Tutorial or Side.Mtf or Side.ChaosInsurgency => SideEnum.Human, + Side.None => SideEnum.None, + _ => SideEnum.None, + }; } } diff --git a/KruacentExiled/KE.CustomRoles/CR/SCP/Paper049.cs b/KruacentExiled/KE.CustomRoles/CR/SCP/Paper.cs similarity index 59% rename from KruacentExiled/KE.CustomRoles/CR/SCP/Paper049.cs rename to KruacentExiled/KE.CustomRoles/CR/SCP/Paper.cs index c046b151..ad34d01e 100644 --- a/KruacentExiled/KE.CustomRoles/CR/SCP/Paper049.cs +++ b/KruacentExiled/KE.CustomRoles/CR/SCP/Paper.cs @@ -1,21 +1,20 @@ using Exiled.API.Features.Attributes; +using KE.CustomRoles.API; using PlayerRoles; using UnityEngine; namespace KE.CustomRoles.CR.SCP { - [CustomRole(RoleTypeId.Scp049)] - internal class Paper049 : Exiled.CustomRoles.API.Features.CustomRole + [CustomRole(RoleTypeId.None)] + public class Paper : GlobalCustomRole { - public override string Name { get; set; } = "Paper049"; - public override string Description { get; set; } = "u are a paper doctor"; + public override string Name { get; set; } = "Paper"; + public override string Description { get; set; } = "u are a paper"; public override uint Id { get; set; } = 1047; - public override string CustomInfo { get; set; } = "Paper Doctor"; - public override int MaxHealth { get; set; } = 2300; - public override RoleTypeId Role { get; set; } = RoleTypeId.Scp049; + public override SideEnum Side { get; set; } = SideEnum.SCP; + public override string CustomInfo { get; set; } = "Paper"; public override bool KeepRoleOnDeath { get; set; } = false; public override bool KeepRoleOnChangingRole { get; set; } = false; - public override bool IgnoreSpawnSystem { get; set; } = true; public override float SpawnChance { get; set; } = 100; public override Vector3 Scale { get; set; } = new Vector3(0.1f, 1, 1); diff --git a/KruacentExiled/KE.CustomRoles/CR/SCP/Small.cs b/KruacentExiled/KE.CustomRoles/CR/SCP/Small.cs new file mode 100644 index 00000000..f5f0304b --- /dev/null +++ b/KruacentExiled/KE.CustomRoles/CR/SCP/Small.cs @@ -0,0 +1,23 @@ +using Exiled.API.Features.Attributes; +using Exiled.CustomRoles.API.Features; +using KE.CustomRoles.API; +using PlayerRoles; +using UnityEngine; + +namespace KE.CustomRoles.CR.SCP +{ + [CustomRole(RoleTypeId.None)] + public class Small : GlobalCustomRole + { + public override string Name { get; set; } = "Small"; + public override string Description { get; set; } = "u smoll"; + public override uint Id { get; set; } = 1047; + public override SideEnum Side { get; set; } = SideEnum.SCP; + public override string CustomInfo { get; set; } = "Small"; + public override bool KeepRoleOnDeath { get; set; } = false; + public override bool KeepRoleOnChangingRole { get; set; } = false; + + public override float SpawnChance { get; set; } = 100; + public override Vector3 Scale { get; set; } = new Vector3(1, .75f, 1); + } +} diff --git a/KruacentExiled/KE.CustomRoles/CR/SCP/Small049.cs b/KruacentExiled/KE.CustomRoles/CR/SCP/Small049.cs deleted file mode 100644 index 897c79cf..00000000 --- a/KruacentExiled/KE.CustomRoles/CR/SCP/Small049.cs +++ /dev/null @@ -1,24 +0,0 @@ -using Exiled.API.Features.Attributes; -using Exiled.CustomRoles.API.Features; -using PlayerRoles; -using UnityEngine; - -namespace KE.CustomRoles.CR.SCP -{ - [CustomRole(RoleTypeId.Scp049)] - internal class Small049 : CustomRole - { - public override string Name { get; set; } = "Small049"; - public override string Description { get; set; } = "u are a smoll doctor"; - public override uint Id { get; set; } = 1048; - public override string CustomInfo { get; set; } = "Small Doctor"; - public override int MaxHealth { get; set; } = 2300; - public override RoleTypeId Role { get; set; } = RoleTypeId.Scp049; - public override bool KeepRoleOnDeath { get; set; } = false; - public override bool KeepRoleOnChangingRole { get; set; } = false; - public override bool IgnoreSpawnSystem { get; set; } = true; - - public override float SpawnChance { get; set; } = 100; - public override Vector3 Scale { get; set; } = new Vector3(1, 0.75f, 1); - } -} diff --git a/KruacentExiled/KE.CustomRoles/CR/SCP/Small173.cs b/KruacentExiled/KE.CustomRoles/CR/SCP/Small173.cs deleted file mode 100644 index 0f12937e..00000000 --- a/KruacentExiled/KE.CustomRoles/CR/SCP/Small173.cs +++ /dev/null @@ -1,21 +0,0 @@ -using Exiled.API.Features.Attributes; -using PlayerRoles; -using UnityEngine; - -namespace KE.CustomRoles.CR.SCP -{ - [CustomRole(RoleTypeId.Scp173)] - internal class Small173 : Exiled.CustomRoles.API.Features.CustomRole - { - public override string Name { get; set; } = "Tall173"; - public override string Description { get; set; } = " Tall NUT \nu tol\n fuck you"; - public override uint Id { get; set; } = 1049; - public override string CustomInfo { get; set; } = "Small Peanuts"; - public override int MaxHealth { get; set; } = 4500; - public override RoleTypeId Role { get; set; } = RoleTypeId.Scp173; - public override bool KeepRoleOnDeath { get; set; } = false; - public override bool KeepRoleOnChangingRole { get; set; } = false; - public override bool IgnoreSpawnSystem { get; set; } = true; - public override Vector3 Scale { get; set; } = new Vector3(1, 1.15f, 1); - } -} diff --git a/KruacentExiled/KE.CustomRoles/CR/SCP/Tall.cs b/KruacentExiled/KE.CustomRoles/CR/SCP/Tall.cs new file mode 100644 index 00000000..5613b1d2 --- /dev/null +++ b/KruacentExiled/KE.CustomRoles/CR/SCP/Tall.cs @@ -0,0 +1,22 @@ +using Exiled.API.Features.Attributes; +using KE.CustomRoles.API; +using PlayerRoles; +using UnityEngine; + +namespace KE.CustomRoles.CR.SCP +{ + [CustomRole(RoleTypeId.None)] + public class Tall : GlobalCustomRole + { + public override string Name { get; set; } = "Tall"; + public override string Description { get; set; } = "u tall"; + public override uint Id { get; set; } = 1049; + public override string CustomInfo { get; set; } = "Tall"; + public override bool KeepRoleOnDeath { get; set; } = false; + public override bool KeepRoleOnChangingRole { get; set; } = false; + public override float MaxHealthMultiplicator { get; set; } = 1.1f; + public override float SpawnChance { get; set; } = 100; + public override SideEnum Side { get; set; } = SideEnum.SCP; + public override Vector3 Scale { get; set; } = new Vector3(1, 1.15f, 1); + } +} From 98099479b0dd2101b2aecbbecef60cb0be9f7de9 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Sun, 16 Mar 2025 12:53:53 +0100 Subject: [PATCH 229/853] change namespace structure --- .../KE.CustomRoles/API/KECustomRole.cs | 7 ++-- .../CR/ChaosInsurgency/LeRusse.cs | 2 +- .../KE.CustomRoles/CR/ClassD/DBoyInShape.cs | 34 ++++++++----------- .../KE.CustomRoles/CR/Human/Alzheimer.cs | 2 +- .../KE.CustomRoles/CR/Human/Diabetique.cs | 14 +++++--- .../KE.CustomRoles/CR/Human/Maladroit.cs | 2 +- KruacentExiled/KE.CustomRoles/CR/MTF/Tank.cs | 7 ++-- .../KE.CustomRoles/CR/MTF/Terroriste.cs | 2 +- 8 files changed, 34 insertions(+), 36 deletions(-) diff --git a/KruacentExiled/KE.CustomRoles/API/KECustomRole.cs b/KruacentExiled/KE.CustomRoles/API/KECustomRole.cs index 505e5733..420082e7 100644 --- a/KruacentExiled/KE.CustomRoles/API/KECustomRole.cs +++ b/KruacentExiled/KE.CustomRoles/API/KECustomRole.cs @@ -8,11 +8,8 @@ using KE.Utils.Display.Enums; using MEC; using PlayerRoles; -using System; using System.Collections.Generic; -using System.Linq; using System.Text; -using System.Threading.Tasks; using UnityEngine; namespace KE.CustomRoles.API @@ -20,7 +17,7 @@ namespace KE.CustomRoles.API public abstract class KECustomRole : CustomRole { public sealed override bool IgnoreSpawnSystem { get; set; } = true; - protected override void ShowMessage(Player player) + protected sealed override void ShowMessage(Player player) { string show = $"{Name}\n {Description}"; @@ -31,7 +28,7 @@ protected override void ShowMessage(Player player) public override void AddRole(Player player) { - Exiled.API.Features.Player player2 = player; + Player player2 = player; Log.Debug(Name + ": Adding role to " + player2.Nickname + "."); TrackedPlayers.Add(player2); if (Role != RoleTypeId.None) diff --git a/KruacentExiled/KE.CustomRoles/CR/ChaosInsurgency/LeRusse.cs b/KruacentExiled/KE.CustomRoles/CR/ChaosInsurgency/LeRusse.cs index 9af7c2ff..d3c08afa 100644 --- a/KruacentExiled/KE.CustomRoles/CR/ChaosInsurgency/LeRusse.cs +++ b/KruacentExiled/KE.CustomRoles/CR/ChaosInsurgency/LeRusse.cs @@ -5,7 +5,7 @@ using System.Collections.Generic; using UnityEngine; -namespace KE.CustomRoles.CR.ClassD +namespace KE.CustomRoles.CR.ChaosInsurgency { [CustomRole(RoleTypeId.ChaosConscript)] internal class Russe : KECustomRole diff --git a/KruacentExiled/KE.CustomRoles/CR/ClassD/DBoyInShape.cs b/KruacentExiled/KE.CustomRoles/CR/ClassD/DBoyInShape.cs index 8fd19de2..c23965e4 100644 --- a/KruacentExiled/KE.CustomRoles/CR/ClassD/DBoyInShape.cs +++ b/KruacentExiled/KE.CustomRoles/CR/ClassD/DBoyInShape.cs @@ -1,4 +1,5 @@ -using Exiled.API.Enums; +using CustomPlayerEffects; +using Exiled.API.Enums; using Exiled.API.Extensions; using Exiled.API.Features; using Exiled.API.Features.Attributes; @@ -14,43 +15,43 @@ using UnityEngine; using Utils.NonAllocLINQ; -namespace KE.CustomRoles.CR.Human +namespace KE.CustomRoles.CR.ClassD { - [CustomRole(RoleTypeId.None)] - internal class DBoyInShape : GlobalCustomRole + [CustomRole(RoleTypeId.ClassD)] + internal class DBoyInShape : KECustomRole { - public override SideEnum Side { get; set; } = SideEnum.Human; public override string Name { get; set; } = "DBoyInShape"; public override string Description { get; set; } = ""; public override uint Id { get; set; } = 1058; public override string CustomInfo { get; set; } = "DBoyInShape"; - public override int MaxHealth { get; set; } = 100; public override bool KeepRoleOnDeath { get; set; } = false; public override bool KeepRoleOnChangingRole { get; set; } = true; - - private const float SpeedReduction = 0.85f; + public override float SpawnChance { get; set; } = 100; + public override int MaxHealth { get; set; } = 100; + + private const byte _speedReduction = 15; protected override void RoleAdded(Player player) { - player.EnableEffect(EffectType.MovementBoost, 5, SpeedReduction); + player.EnableEffect(EffectType.Slowness, 5, _speedReduction); } protected override void RoleRemoved(Player player) { - player.DisableEffect(EffectType.MovementBoost); + player.DisableEffect(EffectType.Slowness); } protected override void SubscribeEvents() { - Exiled.Events.Handlers.Player.InteractingDoor += InterractingDoor; + Exiled.Events.Handlers.Player.InteractingDoor += InteractingDoor; } protected override void UnsubscribeEvents() { - Exiled.Events.Handlers.Player.InteractingDoor -= InterractingDoor; + Exiled.Events.Handlers.Player.InteractingDoor -= InteractingDoor; } - public void InterractingDoor(InteractingDoorEventArgs ev) + public void InteractingDoor(InteractingDoorEventArgs ev) { if (ev.IsAllowed) return; if (!Check(ev.Player)) return; @@ -83,13 +84,8 @@ public void InterractingDoor(InteractingDoorEventArgs ev) } else { - ev.Player.Health -= damage; - - if(ev.Player.Health <= 0) - { - ev.Player.Kill(DamageType.SeveredHands); - } Log.Info($"{ev.Player.Nickname} a échoué à ouvrir une {ev.Door.Type} et a perdu {damage} HP !"); + ev.Player.Hurt(damage, DamageType.SeveredHands); } } } diff --git a/KruacentExiled/KE.CustomRoles/CR/Human/Alzheimer.cs b/KruacentExiled/KE.CustomRoles/CR/Human/Alzheimer.cs index 36ddc818..21da2529 100644 --- a/KruacentExiled/KE.CustomRoles/CR/Human/Alzheimer.cs +++ b/KruacentExiled/KE.CustomRoles/CR/Human/Alzheimer.cs @@ -20,9 +20,9 @@ internal class Alzheimer : GlobalCustomRole public override string Description { get; set; } = "Tu es Vieux"; public override uint Id { get; set; } = 1056; public override string CustomInfo { get; set; } = "Vieux"; - public override int MaxHealth { get; set; } = 100; public override bool KeepRoleOnDeath { get; set; } = true; public override bool KeepRoleOnChangingRole { get; set; } = true; + public override float SpawnChance { get; set; } = 100; protected override void RoleAdded(Player player) { _coroutines.Add(player, Timing.RunCoroutine(Teleport(player))); diff --git a/KruacentExiled/KE.CustomRoles/CR/Human/Diabetique.cs b/KruacentExiled/KE.CustomRoles/CR/Human/Diabetique.cs index 4608bb28..54e6e304 100644 --- a/KruacentExiled/KE.CustomRoles/CR/Human/Diabetique.cs +++ b/KruacentExiled/KE.CustomRoles/CR/Human/Diabetique.cs @@ -1,4 +1,5 @@ -using Exiled.API.Enums; +using CustomPlayerEffects; +using Exiled.API.Enums; using Exiled.API.Features; using Exiled.API.Features.Attributes; using Exiled.CustomRoles.API.Features; @@ -17,13 +18,16 @@ internal class Diabetique : GlobalCustomRole public override string Description { get; set; } = "Tu es diabetique\nT'as mangé le crambleu au pomme de mael"; public override uint Id { get; set; } = 1054; public override string CustomInfo { get; set; } = "Diabetique"; - public override int MaxHealth { get; set; } = 100; - public override bool KeepRoleOnDeath { get; set; } = true; - public override bool KeepRoleOnChangingRole { get; set; } = true; - + public override bool KeepRoleOnDeath { get; set; } = false; + public override bool KeepRoleOnChangingRole { get; set; } = false; + public override float SpawnChance { get; set; } = 100; protected override void RoleAdded(Player player) { player.EnableEffect(EffectType.Scp207, -1, true); } + protected override void RoleRemoved(Player player) + { + player.DisableEffect(EffectType.Scp207); + } } } diff --git a/KruacentExiled/KE.CustomRoles/CR/Human/Maladroit.cs b/KruacentExiled/KE.CustomRoles/CR/Human/Maladroit.cs index 67cfdd79..16365742 100644 --- a/KruacentExiled/KE.CustomRoles/CR/Human/Maladroit.cs +++ b/KruacentExiled/KE.CustomRoles/CR/Human/Maladroit.cs @@ -25,9 +25,9 @@ internal class Maladroit : GlobalCustomRole public override string Description { get; set; } = "Tu es maladroit\nFait attention à tes items !"; public override uint Id { get; set; } = 1057; public override string CustomInfo { get; set; } = "Maladroit"; - public override int MaxHealth { get; set; } = 100; public override bool KeepRoleOnDeath { get; set; } = false; public override bool KeepRoleOnChangingRole { get; set; } = true; + public override float SpawnChance { get; set; } = 100; protected override void RoleAdded(Player player) { diff --git a/KruacentExiled/KE.CustomRoles/CR/MTF/Tank.cs b/KruacentExiled/KE.CustomRoles/CR/MTF/Tank.cs index d627b444..d30f5a2f 100644 --- a/KruacentExiled/KE.CustomRoles/CR/MTF/Tank.cs +++ b/KruacentExiled/KE.CustomRoles/CR/MTF/Tank.cs @@ -9,7 +9,7 @@ using System; using KE.CustomRoles.API; -namespace KE.CustomRoles.CR.ClassD +namespace KE.CustomRoles.CR.MTF { [CustomRole(RoleTypeId.NtfCaptain)] internal class Tank : KECustomRole @@ -68,9 +68,10 @@ private void Shooting(ShootingEventArgs ev) private IEnumerator EffectAttribution(Exiled.API.Features.Player player) { int nbMunition = player.GetAmmo(AmmoType.Nato762) / 100; - byte nbMunitionByte = (byte) nbMunition; + byte nbMunitionByte = (byte)nbMunition; - if (UnityEngine.Random.Range(0, 1) > 0.5f){ + if (UnityEngine.Random.Range(0, 1) > 0.5f) + { player.DisableEffect(EffectType.Slowness); player.EnableEffect(EffectType.Slowness, nbMunitionByte, 99999, false); } diff --git a/KruacentExiled/KE.CustomRoles/CR/MTF/Terroriste.cs b/KruacentExiled/KE.CustomRoles/CR/MTF/Terroriste.cs index 1bb3d383..d746a15c 100644 --- a/KruacentExiled/KE.CustomRoles/CR/MTF/Terroriste.cs +++ b/KruacentExiled/KE.CustomRoles/CR/MTF/Terroriste.cs @@ -5,7 +5,7 @@ using System.Collections.Generic; using UnityEngine; -namespace KE.CustomRoles.CR.ClassD +namespace KE.CustomRoles.CR.MTF { [CustomRole(RoleTypeId.NtfSergeant)] internal class Terroriste : KECustomRole From 91cfd5fdb5ea8ac1ca1cc48e562dc4cb2d432c5e Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Sun, 16 Mar 2025 13:59:34 +0100 Subject: [PATCH 230/853] added new height --- KruacentExiled/KE.Utils/Display/DisplayPlayer.cs | 2 +- KruacentExiled/KE.Utils/Display/Enums/VPosition.cs | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/KruacentExiled/KE.Utils/Display/DisplayPlayer.cs b/KruacentExiled/KE.Utils/Display/DisplayPlayer.cs index a455e935..9a315715 100644 --- a/KruacentExiled/KE.Utils/Display/DisplayPlayer.cs +++ b/KruacentExiled/KE.Utils/Display/DisplayPlayer.cs @@ -27,7 +27,7 @@ public static DisplayPlayer Get(Player player) return _displays[player]; } - public DisplayPlayer(Player player) + private DisplayPlayer(Player player) { _player = player; _display = new (DisplayCore.Get(player.ReferenceHub)); diff --git a/KruacentExiled/KE.Utils/Display/Enums/VPosition.cs b/KruacentExiled/KE.Utils/Display/Enums/VPosition.cs index 264c78dd..a1530642 100644 --- a/KruacentExiled/KE.Utils/Display/Enums/VPosition.cs +++ b/KruacentExiled/KE.Utils/Display/Enums/VPosition.cs @@ -9,6 +9,7 @@ namespace KE.Utils.Display.Enums public enum VPosition { GlobalEvent = 900, + CustomRoleEffect = 600, CustomItem = 200, CustomRole = 400, } From 405d4b88031ff0c88c3dbaecca4a30f37e7bd4eb Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Sun, 16 Mar 2025 13:59:43 +0100 Subject: [PATCH 231/853] added Ultra scp --- KruacentExiled/KE.CustomRoles/CR/SCP/Ultra.cs | 79 +++++++++++++++++++ 1 file changed, 79 insertions(+) create mode 100644 KruacentExiled/KE.CustomRoles/CR/SCP/Ultra.cs diff --git a/KruacentExiled/KE.CustomRoles/CR/SCP/Ultra.cs b/KruacentExiled/KE.CustomRoles/CR/SCP/Ultra.cs new file mode 100644 index 00000000..2265a22d --- /dev/null +++ b/KruacentExiled/KE.CustomRoles/CR/SCP/Ultra.cs @@ -0,0 +1,79 @@ +using Exiled.API.Enums; +using Exiled.API.Features; +using Exiled.API.Features.Attributes; +using KE.CustomRoles.API; +using KE.Utils.Display; +using MEC; +using PlayerRoles; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace KE.CustomRoles.CR.SCP +{ + [CustomRole(RoleTypeId.None)] + public class Ultra : GlobalCustomRole + { + private static Dictionary _handles = new(); + public override SideEnum Side { get; set; } = SideEnum.SCP; + public override string Name { get; set; } = "Ultra"; + public override string Description { get; set; } = ""; + public override uint Id { get; set; } = 1079; + public override string CustomInfo { get; set; } = "Ultra"; + public override bool KeepRoleOnDeath { get; set; } = false; + public override bool KeepRoleOnChangingRole { get; set; } = false; + public override float MaxHealthMultiplicator { get; set; } = 1f; + public override float SpawnChance { get; set; } = 100; + public const float RefreshRate = 20; + protected override void RoleAdded(Player player) + { + _handles.Add(player, Timing.RunCoroutine(DisplayInfos(player))); + } + + protected override void RoleRemoved(Player player) + { + Timing.KillCoroutines(_handles[player]); + _handles.Remove(player); + } + + + + private IEnumerator DisplayInfos(Player player) + { + DisplayPlayer display = DisplayPlayer.Get(player); + + RueIHint hint; + while (true) + { + hint = new(Utils.Display.Enums.HPosition.Left, Utils.Display.Enums.VPosition.CustomRoleEffect, PlayerInZone(), RefreshRate); + display.Hint(hint); + yield return Timing.WaitForSeconds(RefreshRate); + } + } + + + private string PlayerInZone() + { + StringBuilder sb = new(); + int nbPlayer; + foreach(ZoneType zone in Enum.GetValues(typeof(ZoneType))) + { + nbPlayer = GetPlayerInZone(zone); + if (nbPlayer > 0) + { + sb.Append(zone.ToString()); + sb.Append(" : "); + sb.Append(nbPlayer); + sb.AppendLine(); + } + } + return sb.ToString(); + } + + private int GetPlayerInZone(ZoneType zone) + { + return Player.List.Count(p => !p.IsScp && p.Zone == zone); + } + } +} From f685f83f4d66ecca5559dcbc1709eddb36cf81e3 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Sun, 16 Mar 2025 14:02:43 +0100 Subject: [PATCH 232/853] corrected the console showing multiple time the global events --- .../GEFE/API/Features/GlobalEvent.cs | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/KruacentExiled/KE.GlobalEventFramework/GEFE/API/Features/GlobalEvent.cs b/KruacentExiled/KE.GlobalEventFramework/GEFE/API/Features/GlobalEvent.cs index 267cf72f..4fed631c 100644 --- a/KruacentExiled/KE.GlobalEventFramework/GEFE/API/Features/GlobalEvent.cs +++ b/KruacentExiled/KE.GlobalEventFramework/GEFE/API/Features/GlobalEvent.cs @@ -5,6 +5,7 @@ using KE.GlobalEventFramework.GEFE.API.Interfaces; using System; using KE.Utils.Display; +using Exiled.Events.Commands.PluginManager; namespace KE.GlobalEventFramework.GEFE.API.Features { @@ -91,19 +92,27 @@ private static void Show() { var random = UnityEngine.Random.Range(0,101); + ShowConsole(); foreach (Player player in Player.List) { DisplayPlayer.Get(player).Hint(new (KE.Utils.Display.Enums.HPosition.Center,KE.Utils.Display.Enums.VPosition.GlobalEvent, ShowText(random < MainPlugin.Instance.Config.ChanceRedacted), 10)); } } - private static String ShowText(bool redacted = false) + private static void ShowConsole() { - String result = "Global Events: "; Log.Info($"Global Event(s) ({ActiveGE.Count()}): "); for (int i = 0; i < ActiveGE.Count(); i++) { Log.Info(ActiveGE[i].Name); + } + } + + private static string ShowText(bool redacted = false) + { + string result = "Global Events: "; + for (int i = 0; i < ActiveGE.Count(); i++) + { if (redacted) { result += ActiveGE[i].Description; From debcb117e669a533b888622556bf6c6869fb5b64 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Sun, 16 Mar 2025 14:04:03 +0100 Subject: [PATCH 233/853] added null check --- KruacentExiled/KE.Misc/Misc/Spawn.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/KruacentExiled/KE.Misc/Misc/Spawn.cs b/KruacentExiled/KE.Misc/Misc/Spawn.cs index 5dbb4d54..75c15a68 100644 --- a/KruacentExiled/KE.Misc/Misc/Spawn.cs +++ b/KruacentExiled/KE.Misc/Misc/Spawn.cs @@ -35,6 +35,7 @@ public void OnRoundStarted() private void SetScpPreferences(Player player) { Config config = MainPlugin.Instance.Config; + if(config == null) return; Dictionary chancescp = player.ScpPreferences.Preferences.ToDictionary(p => p.Key, p => p.Value + 6); From 98c8fc6e3ea7e2db0e01a572b1de4dbd979366bf Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Sun, 16 Mar 2025 14:11:55 +0100 Subject: [PATCH 234/853] removed the debug spawn --- KruacentExiled/KE.Misc/Misc/Spawn.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/KruacentExiled/KE.Misc/Misc/Spawn.cs b/KruacentExiled/KE.Misc/Misc/Spawn.cs index 75c15a68..719df943 100644 --- a/KruacentExiled/KE.Misc/Misc/Spawn.cs +++ b/KruacentExiled/KE.Misc/Misc/Spawn.cs @@ -24,7 +24,7 @@ public void OnRoundStarted() { if (!MainPlugin.Instance.Config.ScpPreferences) return; - HashSet pl = [.. Player.List]; + HashSet pl = Player.List.Where(p=> p.IsScp).ToHashSet(); foreach (Player player in pl) { From fea4d25761d1a2af5796d582c2871a1e13562751 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Sun, 16 Mar 2025 14:49:32 +0100 Subject: [PATCH 235/853] added error messages --- KruacentExiled/KE.CustomRoles/API/GlobalCustomRole.cs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/KruacentExiled/KE.CustomRoles/API/GlobalCustomRole.cs b/KruacentExiled/KE.CustomRoles/API/GlobalCustomRole.cs index 4da27d29..acd0d487 100644 --- a/KruacentExiled/KE.CustomRoles/API/GlobalCustomRole.cs +++ b/KruacentExiled/KE.CustomRoles/API/GlobalCustomRole.cs @@ -27,7 +27,12 @@ public abstract class GlobalCustomRole : KECustomRole public override void AddRole(Player player) { - if (SideClass.Get(player.Role.Side) != Side) return; + SideEnum side = SideClass.Get(player.Role.Side); + if (side != Side) + { + Log.Error($"tried to give a global custom role to a player in the wrong side ({side} instead of {Side})"); + return; + } Log.Debug($"{Name}: Adding role to {player.Nickname}."); TrackedPlayers.Add(player); @@ -61,7 +66,7 @@ public override void AddRole(Player player) Log.Debug($"{Name}: Setting health values."); player.MaxHealth *= MaxHealthMultiplicator; - player.Health = MaxHealth; + player.Health = player.MaxHealth; player.Scale = Scale; Vector3 position = GetSpawnPosition(); From 600baf08e81eb227029513f8ef627a9526c70670 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Sun, 16 Mar 2025 14:49:49 +0100 Subject: [PATCH 236/853] add size text config --- KruacentExiled/KE.CustomRoles/CR/SCP/Ultra.cs | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/KruacentExiled/KE.CustomRoles/CR/SCP/Ultra.cs b/KruacentExiled/KE.CustomRoles/CR/SCP/Ultra.cs index 2265a22d..a9b69bf1 100644 --- a/KruacentExiled/KE.CustomRoles/CR/SCP/Ultra.cs +++ b/KruacentExiled/KE.CustomRoles/CR/SCP/Ultra.cs @@ -7,6 +7,7 @@ using PlayerRoles; using System; using System.Collections.Generic; +using System.Drawing; using System.Linq; using System.Text; @@ -26,6 +27,7 @@ public class Ultra : GlobalCustomRole public override float MaxHealthMultiplicator { get; set; } = 1f; public override float SpawnChance { get; set; } = 100; public const float RefreshRate = 20; + public const int SizeText = 20; protected override void RoleAdded(Player player) { _handles.Add(player, Timing.RunCoroutine(DisplayInfos(player))); @@ -41,13 +43,12 @@ protected override void RoleRemoved(Player player) private IEnumerator DisplayInfos(Player player) { - DisplayPlayer display = DisplayPlayer.Get(player); - RueIHint hint; while (true) { + Log.Debug("Ultra : showing"); hint = new(Utils.Display.Enums.HPosition.Left, Utils.Display.Enums.VPosition.CustomRoleEffect, PlayerInZone(), RefreshRate); - display.Hint(hint); + DisplayPlayer.Get(player).Hint(hint); yield return Timing.WaitForSeconds(RefreshRate); } } @@ -55,20 +56,18 @@ private IEnumerator DisplayInfos(Player player) private string PlayerInZone() { - StringBuilder sb = new(); + string result = $""; int nbPlayer; foreach(ZoneType zone in Enum.GetValues(typeof(ZoneType))) { nbPlayer = GetPlayerInZone(zone); - if (nbPlayer > 0) + if (nbPlayer > 0 || MainPlugin.Instance.Config.Debug) { - sb.Append(zone.ToString()); - sb.Append(" : "); - sb.Append(nbPlayer); - sb.AppendLine(); + result += zone.ToString() + " : " + nbPlayer + "\n"; } } - return sb.ToString(); + result += ""; + return result; } private int GetPlayerInZone(ZoneType zone) From 5b31734d62466535b479ce68ae17799be82302ba Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Sun, 16 Mar 2025 15:29:54 +0100 Subject: [PATCH 237/853] added 035 to 914 pools --- KruacentExiled/KE.Misc/Misc/914.cs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/KruacentExiled/KE.Misc/Misc/914.cs b/KruacentExiled/KE.Misc/Misc/914.cs index 1c1a0a94..b6971905 100644 --- a/KruacentExiled/KE.Misc/Misc/914.cs +++ b/KruacentExiled/KE.Misc/Misc/914.cs @@ -11,6 +11,7 @@ using Exiled.API.Extensions; using UnityEngine; using YamlDotNet.Core.Tokens; +using Exiled.CustomRoles.API.Features; namespace KE.Misc.Misc { @@ -175,7 +176,15 @@ private void TrySetRole(Player p, int key) RoleTypeId newRole; if (roleScp.TryGetValue(key, out newRole)) { - p.Role.Set(newRole); + if(newRole == RoleTypeId.Scp079) + { + //035 + CustomRole.Registered.FirstOrDefault(c => c.Id == 10).AddRole(p); + } + else + { + p.Role.Set(newRole); + } } } } From 00323b9d58023f69021005153939759ec1f938ef Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Sun, 16 Mar 2025 15:30:12 +0100 Subject: [PATCH 238/853] corrected hint typo --- KruacentExiled/KE.Misc/Misc/Spawn.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/KruacentExiled/KE.Misc/Misc/Spawn.cs b/KruacentExiled/KE.Misc/Misc/Spawn.cs index 719df943..950ff735 100644 --- a/KruacentExiled/KE.Misc/Misc/Spawn.cs +++ b/KruacentExiled/KE.Misc/Misc/Spawn.cs @@ -81,7 +81,7 @@ private void SupportClassBackup(Player player) { if (player.Role == RoleTypeId.Scp096 || player.Role == RoleTypeId.Scp079 && !MainPlugin.Instance.Config.Scp035Enabled || MainPlugin.Instance.Config.Debug) return; float timetodecide = 60; - RueIHint h = new(Utils.Display.Enums.HPosition.Center-50, Utils.Display.Enums.VPosition.CustomRole, "You're a support class \nYou can change your scp by doing the command .scp \n(eg .scp 173 -> scp-173)", timetodecide); + RueIHint h = new(Utils.Display.Enums.HPosition.Center, Utils.Display.Enums.VPosition.CustomRole, "You're a support class \nYou can change your scp by doing the command .scp \n(eg .scp 173 -> scp-173)", timetodecide); var a = DisplayPlayer.Get(player).Hint(h); ChangeSCP._players.Add(player, a); Timing.CallDelayed(timetodecide, () => From 641da294888f24ff684794b130aebdf04b697720 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Sun, 16 Mar 2025 15:31:30 +0100 Subject: [PATCH 239/853] tried to add DynamicHints --- .../KE.Utils/Display/DisplayPlayer.cs | 24 ++++++++++++++----- 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/KruacentExiled/KE.Utils/Display/DisplayPlayer.cs b/KruacentExiled/KE.Utils/Display/DisplayPlayer.cs index 864d2c1a..4c4c16fb 100644 --- a/KruacentExiled/KE.Utils/Display/DisplayPlayer.cs +++ b/KruacentExiled/KE.Utils/Display/DisplayPlayer.cs @@ -4,12 +4,14 @@ using MEC; using RueI.Displays; using RueI.Elements; +using RueI.Elements.Delegates; using RueI.Elements.Enums; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; +using System.Xml.Linq; namespace KE.Utils.Display { @@ -39,7 +41,17 @@ public Element Hint(Position position, string text) SetElement element = new((float)position.VPosition, $"" + text + ""); _display.Elements.Add(element); _hints.Add(position, element); - UpdateCore(_player); + UpdateCore(); + return element; + } + + [Obsolete("doesn't work don't use it",true)] + public DynamicElement Hint(Position position, GetContent getContent) + { + DynamicElement element = new(getContent, position.RawVPosition); + _display.Elements.Add(element); + _hints.Add(position, element); + UpdateCore(); return element; } @@ -50,12 +62,12 @@ public Element Hint(Position position,string text,float seconds) SetElement element = new((float)position.VPosition, $""+text+""); _display.Elements.Add(element); _hints.Add(position, element); - UpdateCore(_player); + UpdateCore(); Timing.CallDelayed(seconds, () => { _display.Elements.Remove(element); _hints.Remove(position); - UpdateCore(_player); + UpdateCore(); }); return element; } @@ -73,7 +85,7 @@ public bool RemoveHint(Position placement) if (!_hints.ContainsKey(placement)) return false; bool result = _display.Elements.Remove(_hints[placement]); _hints.Remove(placement); - UpdateCore(_player); + UpdateCore(); return result; } @@ -81,11 +93,11 @@ public bool RemoveHint(Element elem) { bool result = _display.Elements.Remove(elem); _hints.Remove(_hints.First(x => x.Value == elem).Key); - UpdateCore(_player); + UpdateCore(); return result; } - + private void UpdateCore() => UpdateCore(_player); public static void UpdateCore(Player player) => DisplayCore.Get(player.ReferenceHub).Update(); From 0fec972486907f32d6389cc82b7ed8b1b58584f8 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Sun, 16 Mar 2025 15:31:56 +0100 Subject: [PATCH 240/853] removed the hint display at 173 chamber because it doesn't work --- KruacentExiled/KE.Misc/MainPlugin.cs | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/KruacentExiled/KE.Misc/MainPlugin.cs b/KruacentExiled/KE.Misc/MainPlugin.cs index 7f9cab45..c13600ea 100644 --- a/KruacentExiled/KE.Misc/MainPlugin.cs +++ b/KruacentExiled/KE.Misc/MainPlugin.cs @@ -129,7 +129,7 @@ internal IEnumerator PeanutLockdown() peanutDoor.IsOpen = false; peanutDoor.ChangeLock(DoorLockType.Isolation); CoroutineHandle a; - if (MainPlugin.Instance.Config.Debug) + if (Instance.Config.Debug) a = Timing.RunCoroutine(Timer(120, "u r free :3")); else a = Timing.RunCoroutine(Timer(135 - Player.List.Count * 15, "u r free :3")); @@ -147,12 +147,13 @@ private IEnumerator Timer(int secondsWaiting, string msg = "done") playerToShow.RemoveAll(p => p.CurrentRoom.Type != RoomType.Hcz049); playerToShow.AddRange(Player.List.Where(p => p.CurrentRoom.Type == RoomType.Hcz049)); - RueIHint hint = new(HPosition.Center, VPosition.CustomRole, $"{secondsWaiting} seconds left for SCP-173's spawn", 1); + //RueIHint hint = new(HPosition.Center, VPosition.CustomRole, $"{secondsWaiting} seconds left for SCP-173's spawn"); playerToShow.ForEach(p => { - DisplayCore c = DisplayCore.Get(p.ReferenceHub); - c.SetElemTemp($""+hint.RawContent+"", (int)hint.Position.VPosition, TimeSpan.FromSeconds(hint.Duration), new RueI.Displays.Scheduling.TimedElemRef()); - //DisplayPlayer.Get(p).Hint(hint) + //DisplayPlayer.Get(p).Hint(new Position(HPosition.Center, 600), hub => $"{secondsWaiting} seconds left for SCP-173's spawn"); + //DisplayCore c = DisplayCore.Get(p.ReferenceHub); + //c.SetElemTemp($""+hint.RawContent+"", (int)hint.Position.VPosition, TimeSpan.FromSeconds(hint.Duration), new RueI.Displays.Scheduling.TimedElemRef()); + //DisplayPlayer.Get(p).Hint(new Position(HPosition.Center,600), $"{secondsWaiting} seconds left for SCP-173's spawn",1); }); yield return Timing.WaitForSeconds(1); secondsWaiting--; @@ -161,6 +162,7 @@ private IEnumerator Timer(int secondsWaiting, string msg = "done") } + From da503ad6373d5296c1a43f9179535415cc3f4602 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Sun, 16 Mar 2025 15:32:31 +0100 Subject: [PATCH 241/853] change the voice chat of 035 --- KruacentExiled/KE.Misc/Misc/CR/Scp035.cs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/KruacentExiled/KE.Misc/Misc/CR/Scp035.cs b/KruacentExiled/KE.Misc/Misc/CR/Scp035.cs index 4ed5333d..5fab3fa3 100644 --- a/KruacentExiled/KE.Misc/Misc/CR/Scp035.cs +++ b/KruacentExiled/KE.Misc/Misc/CR/Scp035.cs @@ -50,6 +50,7 @@ protected override void SubscribeEvents() Exiled.Events.Handlers.Player.Hurting += OnHurting; Exiled.Events.Handlers.Player.Shot += OnShot; Exiled.Events.Handlers.Player.ActivatingGenerator += OnActivatingGenerator; + Exiled.Events.Handlers.Player.VoiceChatting += OnVoiceChatting; } protected override void UnsubscribeEvents() @@ -57,9 +58,15 @@ protected override void UnsubscribeEvents() Exiled.Events.Handlers.Player.EnteringPocketDimension -= OnEnteringPocketDimension; Exiled.Events.Handlers.Player.Hurting -= OnHurting; Exiled.Events.Handlers.Player.Shot -= OnShot; + Exiled.Events.Handlers.Player.VoiceChatting -= OnVoiceChatting; Exiled.Events.Handlers.Player.ActivatingGenerator -= OnActivatingGenerator; } + private void OnVoiceChatting(VoiceChattingEventArgs ev) + { + if (!Check(ev.Player)) return; + ev.VoiceModule.CurrentChannel = VoiceChat.VoiceChatChannel.ScpChat; + } private void OnEnteringPocketDimension(EnteringPocketDimensionEventArgs ev) { From 51ccdcf00d1604410c7e401a67cf403687f01e8b Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Sun, 16 Mar 2025 16:07:27 +0100 Subject: [PATCH 242/853] corrected alzhiemer having infinite effect --- KruacentExiled/KE.CustomRoles/CR/Human/Alzheimer.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/KruacentExiled/KE.CustomRoles/CR/Human/Alzheimer.cs b/KruacentExiled/KE.CustomRoles/CR/Human/Alzheimer.cs index 21da2529..1f64c58f 100644 --- a/KruacentExiled/KE.CustomRoles/CR/Human/Alzheimer.cs +++ b/KruacentExiled/KE.CustomRoles/CR/Human/Alzheimer.cs @@ -40,8 +40,8 @@ private IEnumerator Teleport(Player p) while (true) { yield return Timing.WaitForSeconds(UnityEngine.Random.Range(300f, 600f)); - p.EnableEffect(EffectType.Flashed,5); - p.EnableEffect(EffectType.Invisible,5); + p.EnableEffect(EffectType.Flashed,1,5); + p.EnableEffect(EffectType.Invisible,1,6); p.Teleport(Room.Random(p.Zone)); } } From c9b34a319fba4752352433ca39ed366ef8736461 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Sun, 16 Mar 2025 16:19:13 +0100 Subject: [PATCH 243/853] hardcoding the spawn because it doesn't work --- KruacentExiled/KE.Misc/Misc/Spawn.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/KruacentExiled/KE.Misc/Misc/Spawn.cs b/KruacentExiled/KE.Misc/Misc/Spawn.cs index 950ff735..ff0344ea 100644 --- a/KruacentExiled/KE.Misc/Misc/Spawn.cs +++ b/KruacentExiled/KE.Misc/Misc/Spawn.cs @@ -1,4 +1,5 @@ using CommandSystem; +using Exiled.API.Enums; using Exiled.API.Extensions; using Exiled.API.Features; using Exiled.API.Features.Attributes; @@ -56,6 +57,7 @@ private void SetScpPreferences(Player player) { CustomRole scp = CustomRole.Registered.FirstOrDefault(c => c.Id == 10); scp.AddRole(pl); + pl.Teleport(SpawnLocationType.Inside096); } else { From 8f7afd487d321f2625232f51b27a69ed1b642a4d Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Mon, 17 Mar 2025 11:27:36 +0100 Subject: [PATCH 244/853] rebalanced some globalevents --- .../KE.GlobalEventFramework.Examples/GE/BrokenGenerator.cs | 3 ++- KruacentExiled/KE.GlobalEventFramework.Examples/GE/OpenBar.cs | 1 + .../KE.GlobalEventFramework.Examples/GE/RandomSpawn.cs | 2 +- KruacentExiled/KE.GlobalEventFramework.Examples/GE/Speed.cs | 2 +- 4 files changed, 5 insertions(+), 3 deletions(-) diff --git a/KruacentExiled/KE.GlobalEventFramework.Examples/GE/BrokenGenerator.cs b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/BrokenGenerator.cs index a2806943..8f411cc8 100644 --- a/KruacentExiled/KE.GlobalEventFramework.Examples/GE/BrokenGenerator.cs +++ b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/BrokenGenerator.cs @@ -17,8 +17,9 @@ public class BrokenGenerator : GlobalEvent, IStart, IEvent public override uint Id { get; set; } = 1050; public override string Name { get; set; } = "Broken Generator"; public override string Description { get; set; } = "Repair the generator to be able to see !"; - public override int Weight { get; set; } = 1; + public override int Weight { get; set; } = 0; + //add event to avoid blackouts public List zones = new List { ZoneType.LightContainment, diff --git a/KruacentExiled/KE.GlobalEventFramework.Examples/GE/OpenBar.cs b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/OpenBar.cs index a9533313..5b29e0fd 100644 --- a/KruacentExiled/KE.GlobalEventFramework.Examples/GE/OpenBar.cs +++ b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/OpenBar.cs @@ -18,6 +18,7 @@ public class OpenBar : GlobalEvent, IStart,IEvent public override string Name { get; set; } = "OpenBar"; public override string Description { get; set; } = "j'espère que vous avez pas prévu de kampé"; public override int Weight { get; set; } = 0; + //use event to avoid doorstuck public override uint[] IncompatibleGE { get; set; } = { 1 }; public IEnumerator Start() { diff --git a/KruacentExiled/KE.GlobalEventFramework.Examples/GE/RandomSpawn.cs b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/RandomSpawn.cs index ef65a8ac..42aa4087 100644 --- a/KruacentExiled/KE.GlobalEventFramework.Examples/GE/RandomSpawn.cs +++ b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/RandomSpawn.cs @@ -26,7 +26,7 @@ public class RandomSpawn : GlobalEvent,IStart public override string Description { get; set; } = "Les spawns sont random"; /// public override int Weight { get; set; } = 1; - public IEnumerable BlacklistedRooms { get; } = new HashSet() { RoomType.EzShelter,RoomType.HczTestRoom}; + public IEnumerable BlacklistedRooms { get; } = new HashSet() { RoomType.EzShelter,RoomType.HczTestRoom,RoomType.EzCollapsedTunnel}; /// public IEnumerator Start() { diff --git a/KruacentExiled/KE.GlobalEventFramework.Examples/GE/Speed.cs b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/Speed.cs index 9cca39e4..c8d01e9c 100644 --- a/KruacentExiled/KE.GlobalEventFramework.Examples/GE/Speed.cs +++ b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/Speed.cs @@ -58,7 +58,7 @@ public void UnsubscribeEvent() /// private void SpeedyNut(BlinkingEventArgs ev) { - ev.BlinkCooldown = ev.BlinkCooldown/2; + ev.BlinkCooldown = ev.BlinkCooldown/4; } /// From 97ba71b5deb40d41f39d70c4b5ea51a2057eccab Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Mon, 17 Mar 2025 19:43:10 +0100 Subject: [PATCH 245/853] added Scp7045 --- KruacentExiled/KE.Items/Items/Scp7045.cs | 151 +++++++++++++++++++++++ 1 file changed, 151 insertions(+) create mode 100644 KruacentExiled/KE.Items/Items/Scp7045.cs diff --git a/KruacentExiled/KE.Items/Items/Scp7045.cs b/KruacentExiled/KE.Items/Items/Scp7045.cs new file mode 100644 index 00000000..ce7b5eb2 --- /dev/null +++ b/KruacentExiled/KE.Items/Items/Scp7045.cs @@ -0,0 +1,151 @@ +using Exiled.API.Enums; +using Exiled.API.Features; +using Exiled.API.Features.Attributes; +using Exiled.API.Features.Items; +using Exiled.API.Features.Spawn; +using Exiled.API.Features.Toys; +using Exiled.CustomItems.API.Features; +using Exiled.Events.EventArgs.Player; +using Exiled.Events.EventArgs.Server; +using MEC; +using PlayerRoles; +using System; +using System.Collections.Generic; +using System.Diagnostics.Tracing; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using UnityEngine; +using VoiceChat.Codec; +using VoiceChat.Codec.Enums; +using VoiceChat.Networking; + +namespace KE.Items.Items +{ + [CustomItem(ItemType.SCP1576)] + public class Scp7045 : KECustomItem + { + + private static readonly OpusDecoder _decoder = new(); + private static readonly OpusEncoder _encoder = new(OpusApplicationType.Voip); + private static readonly Dictionary _speakers = new (); + public override uint Id { get; set; } = 1800; + public override string Name { get; set; } = "SCP-7045"; + public override string Description { get; set; } = "A weird looking radio"; + public override float Weight { get; set; } = 0.65f; + + private bool _recordingMode= true; + private bool _someoneUsingItem = false; + private AudioMessage _message; + public override SpawnProperties SpawnProperties { get; set; } = new SpawnProperties() + { + Limit = 1, + LockerSpawnPoints = new List() + { + new LockerSpawnPoint() + { + Type = LockerType.Scp1576Pedestal, + UseChamber = true, + Chance = .5f + } + } + }; + + protected override void SubscribeEvents() + { + Exiled.Events.Handlers.Player.UsedItem += OnUsedItem; + Exiled.Events.Handlers.Player.VoiceChatting += OnVoiceChatting; + + + } + protected override void UnsubscribeEvents() + { + Exiled.Events.Handlers.Player.UsedItem -= OnUsedItem; + Exiled.Events.Handlers.Player.VoiceChatting -= OnVoiceChatting; + } + + private void OnUsedItem(UsedItemEventArgs ev) + { + + if (!Check(ev.Item)) return; + Scp1576 item = (Scp1576)ev.Item; + Timing.CallDelayed(.5f, () => item.StopTransmitting()); + + } + + public const int sampleSize = 480; + + private List _recordingBuffer = new(); + private bool _isRecording = false; + private float _lastVoiceTime = 0f; // Timestamp of last voice packet + private void OnVoiceChatting(VoiceChattingEventArgs ev) + { + if (!Check(ev.Player.CurrentItem)) return; + Speaker speaker; + byte speakerid = (byte)ev.Player.Id; + if (!_speakers.TryGetValue(ev.Player, out speaker)) + { + _speakers[ev.Player] = Speaker.Create(speakerid, ev.Player.Position); + } + speaker = _speakers[ev.Player]; + + VoiceMessage message = ev.VoiceMessage; + if (!_isRecording) + { + _recordingBuffer.Clear(); + _isRecording = true; + Timing.RunCoroutine(CheckIfRecordingFinished(speaker)); // Start the "stop talking" check + } + + // Decode voice data and append to the shared buffer + float[] decodedBuffer = new float[sampleSize]; + _decoder.Decode(message.Data, message.DataLength, decodedBuffer); + _recordingBuffer.AddRange(decodedBuffer); + + // Update the last time voice data was received + _lastVoiceTime = Time.time; + } + + private IEnumerator CheckIfRecordingFinished(Speaker speaker) + { + while (_isRecording) + { + // Wait a short time before checking again + yield return Timing.WaitForSeconds(0.2f); + + // If no voice data has been received for 0.5s, stop recording + if (Time.time - _lastVoiceTime >= 0.5f) + { + _isRecording = false; + + float[] finalRecording = _recordingBuffer.ToArray(); + Log.Info($"Final recorded voice message length: {finalRecording.Length} samples."); + + Timing.RunCoroutine(PlayVoice(finalRecording, speaker.Base.NetworkControllerId)); + } + } + } + + + private IEnumerator PlayVoice(float[] data,byte speakerid) + { + for (int i = 0; i < data.Length; i += sampleSize) + { + byte[] encodedData = new byte[512]; + float[] decodedBuffer = data.Skip(i).Take(sampleSize).ToArray(); + int dataLen = _encoder.Encode(decodedBuffer, encodedData); + _message = new AudioMessage(speakerid, encodedData, dataLen); + foreach(Player player in Player.List) + player.ReferenceHub.connectionToClient.Send(_message); + yield return Timing.WaitForOneFrame; + + } + + } + + + + + + } +} From 81429acf569b799a889884463522adf2efe36279 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Wed, 19 Mar 2025 14:36:47 +0100 Subject: [PATCH 246/853] Replaced Spawn by Create to avoid confusion with the other Spawn method --- KruacentExiled/KE.Items/ItemEffects/MineEffect.cs | 2 +- KruacentExiled/KE.Items/Items/Models/DeployWallModel.cs | 2 +- KruacentExiled/KE.Items/Items/Models/MineModel.cs | 2 +- KruacentExiled/KE.Items/Items/Models/Model.cs | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/KruacentExiled/KE.Items/ItemEffects/MineEffect.cs b/KruacentExiled/KE.Items/ItemEffects/MineEffect.cs index ef8ac74a..e783a242 100644 --- a/KruacentExiled/KE.Items/ItemEffects/MineEffect.cs +++ b/KruacentExiled/KE.Items/ItemEffects/MineEffect.cs @@ -59,7 +59,7 @@ private void SpawnMine(Player p,Vector3 pos) MineModel m = new MineModel(); //put the mine on the floor - m.Spawn(pos, new Quaternion()); + m.Create(pos, new Quaternion()); Timing.RunCoroutine(WaitAndActivateMine(p, m)); } diff --git a/KruacentExiled/KE.Items/Items/Models/DeployWallModel.cs b/KruacentExiled/KE.Items/Items/Models/DeployWallModel.cs index 56f14ced..9bba4ece 100644 --- a/KruacentExiled/KE.Items/Items/Models/DeployWallModel.cs +++ b/KruacentExiled/KE.Items/Items/Models/DeployWallModel.cs @@ -14,7 +14,7 @@ namespace KE.Items.Items.Models internal class DeployWallModel : Model { const float distance = 2; - internal override void Spawn(Vector3 spawnPos, Quaternion rotation) + internal override void Create(Vector3 spawnPos, Quaternion rotation) { Vector3 forward = rotation * Vector3.forward; diff --git a/KruacentExiled/KE.Items/Items/Models/MineModel.cs b/KruacentExiled/KE.Items/Items/Models/MineModel.cs index ebc9318d..3b9c6b7f 100644 --- a/KruacentExiled/KE.Items/Items/Models/MineModel.cs +++ b/KruacentExiled/KE.Items/Items/Models/MineModel.cs @@ -12,7 +12,7 @@ namespace KE.Items.Items.Models internal class MineModel : Model { private Light _light; - internal override void Spawn(Vector3 spawnPos, Quaternion _) + internal override void Create(Vector3 spawnPos, Quaternion _) { //spawn + offset Position = spawnPos + new Vector3(0, .05f); diff --git a/KruacentExiled/KE.Items/Items/Models/Model.cs b/KruacentExiled/KE.Items/Items/Models/Model.cs index afdd1ce5..1ccf6673 100644 --- a/KruacentExiled/KE.Items/Items/Models/Model.cs +++ b/KruacentExiled/KE.Items/Items/Models/Model.cs @@ -12,7 +12,7 @@ internal abstract class Model { internal Vector3 Position { get; set; } protected List Toys { get; set; } = new List { }; - internal abstract void Spawn(Vector3 spawnPos, Quaternion rotation); + internal abstract void Create(Vector3 spawnPos, Quaternion rotation); internal void Destroy() { From bc50b9cddebb4012904377aabc53e5ca80243872 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Thu, 20 Mar 2025 19:53:29 +0100 Subject: [PATCH 247/853] Scp514 + model todo --- .../KE.Items/Items/Models/Scp514Model.cs | 17 +++ KruacentExiled/KE.Items/Items/Scp514.cs | 122 ++++++++++++++++++ 2 files changed, 139 insertions(+) create mode 100644 KruacentExiled/KE.Items/Items/Models/Scp514Model.cs create mode 100644 KruacentExiled/KE.Items/Items/Scp514.cs diff --git a/KruacentExiled/KE.Items/Items/Models/Scp514Model.cs b/KruacentExiled/KE.Items/Items/Models/Scp514Model.cs new file mode 100644 index 00000000..877d092b --- /dev/null +++ b/KruacentExiled/KE.Items/Items/Models/Scp514Model.cs @@ -0,0 +1,17 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using UnityEngine; + +namespace KE.Items.Items.Models +{ + internal class Scp514Model : Model + { + internal override void Create(Vector3 spawnPos, Quaternion rotation) + { + + } + } +} diff --git a/KruacentExiled/KE.Items/Items/Scp514.cs b/KruacentExiled/KE.Items/Items/Scp514.cs new file mode 100644 index 00000000..12a4500c --- /dev/null +++ b/KruacentExiled/KE.Items/Items/Scp514.cs @@ -0,0 +1,122 @@ +using Exiled.API.Features; +using Exiled.API.Features.Attributes; +using Exiled.API.Features.Spawn; +using Exiled.Events.EventArgs.Item; +using Exiled.Events.EventArgs.Player; +using Exiled.Events.EventArgs.Scp173; +using Exiled.Events.EventArgs.Scp939; +using Exiled.Events.Handlers; +using KE.Items.Items.Models; +using MEC; +using System.Collections.Generic; +using System.Linq; +using UnityEngine; +using Player= Exiled.API.Features.Player; + +namespace KE.Items.Items +{ + [CustomItem(ItemType.Flashlight)] + public class Scp514 : KECustomItem + { + public override uint Id { get; set; } = 1070; + public override string Name { get; set; } = "Scp514"; + public override string Description { get; set; } = "birb"; + public override float Weight { get; set; } = 0.65f; + public float TimeActive { get; set; } = 3; + public float Radius { get; set; } = 5; + public override SpawnProperties SpawnProperties { get; set; } = null; + private HashSet _affectedPlayers = new HashSet(); + + + protected override void SubscribeEvents() + { + Exiled.Events.Handlers.Player.Shooting += OnShooting; + Exiled.Events.Handlers.Player.Dying += OnDying; + Exiled.Events.Handlers.Scp049.Attacking += OnAttacking049; + Exiled.Events.Handlers.Scp106.Attacking += OnAttacking106; + Exiled.Events.Handlers.Item.ChargingJailbird += OnChargingJailbird; + } + + protected override void UnsubscribeEvents() + { + Exiled.Events.Handlers.Player.Shooting -= OnShooting; + Exiled.Events.Handlers.Player.Dying -= OnDying; + Exiled.Events.Handlers.Scp049.Attacking -= OnAttacking049; + Exiled.Events.Handlers.Scp106.Attacking -= OnAttacking106; + Exiled.Events.Handlers.Item.ChargingJailbird -= OnChargingJailbird; + } + private void OnChargingJailbird(ChargingJailbirdEventArgs ev) + { + if (_affectedPlayers.Contains(ev.Player)) + ev.IsAllowed = false; + } + private void OnAttacking106(Exiled.Events.EventArgs.Scp106.AttackingEventArgs ev) + { + if (_affectedPlayers.Contains(ev.Player)) + ev.IsAllowed = false; + } + + private void OnAttacking049(Exiled.Events.EventArgs.Scp049.AttackingEventArgs ev) + { + if (_affectedPlayers.Contains(ev.Player)) + ev.IsAllowed = false; + } + private void OnDying(DyingEventArgs ev) + { + if(_affectedPlayers.Contains(ev.Player)) + ev.IsAllowed = false; + + } + private void OnShooting(ShootingEventArgs ev) + { + if(_affectedPlayers.Contains(ev.Player)) + ev.IsAllowed = false; + } + protected override void OnDroppingItem(DroppingItemEventArgs ev) + { + if (ev.IsThrown) + { + return; + } + + Vector3 pos = ev.Player.Position; + Scp514Model cage = new(); + + cage.Create(pos,new()); + + Timing.RunCoroutine(DoEffectIfInside(Radius,pos)); + + } + + + private IEnumerator DoEffectIfInside(float radius,Vector3 spawnPos) + { + while(true) + { + foreach(Player p in Player.List) + { + if (IsPlayerInZone(p, spawnPos, radius)) + { + _affectedPlayers.Add(p); + p.IsGodModeEnabled = true; + } + else + { + p.IsGodModeEnabled = false; + _affectedPlayers.Remove(p); + } + } + yield return Timing.WaitForSeconds(1); + } + } + + + + private bool IsPlayerInZone(Player player, Vector3 zonePosition, float radius) + { + float distance = Vector3.Distance(new Vector3(player.Position.x, 0, player.Position.z), + new Vector3(zonePosition.x, 0, zonePosition.z)); + return distance <= (radius / 2); + } + } +} From 72d010399d4cb32965e4e3b1c236d633d57fc4ec Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Sun, 23 Mar 2025 22:17:51 +0100 Subject: [PATCH 248/853] changed item effect --- .../GE/ChangedItemEffect.cs | 90 +++++++++++++++++++ 1 file changed, 90 insertions(+) create mode 100644 KruacentExiled/KE.GlobalEventFramework.Examples/GE/ChangedItemEffect.cs diff --git a/KruacentExiled/KE.GlobalEventFramework.Examples/GE/ChangedItemEffect.cs b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/ChangedItemEffect.cs new file mode 100644 index 00000000..f9da4051 --- /dev/null +++ b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/ChangedItemEffect.cs @@ -0,0 +1,90 @@ +using Exiled.API.Extensions; +using Exiled.API.Features; +using Exiled.API.Features.Items; +using Exiled.Events.EventArgs.Item; +using Exiled.Events.EventArgs.Player; +using InventorySystem.Items.Usables; +using KE.GlobalEventFramework.GEFE.API.Features; +using KE.GlobalEventFramework.GEFE.API.Interfaces; +using PluginAPI.Events; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace KE.GlobalEventFramework.Examples.GE +{ + public class ChangedItemEffect : GlobalEvent,IStart ,IEvent + { + + public override uint Id { get; set; } = 1080; + /// + public override string Name { get; set; } = "SwitchItemEffect"; + /// + public override string Description { get; set; } = "Les effets des items ont changé"; + /// + public override int Weight { get; set; } = 1; + + public Dictionary newEffects; + private List _usableList = new(); + + private int _switchNumber =0; + public int SwitchNumber { get { return _switchNumber; } } + + public IEnumerator Start() + { + Log.Info("before foreach"); + foreach (var item in (ItemType[])Enum.GetValues(typeof(ItemType))) + { + if (IsUsable(item)) + { + Log.Info("adding : " + item); + _usableList.Add(item); + } + } + Log.Info("after foreach"); + _usableList = _usableList.Distinct().ToList(); + + + _switchNumber = UnityEngine.Random.Range(1,_usableList.Count); + newEffects = new Dictionary(); + + for(int i =0;i < _usableList.Count; i++) + { + newEffects.Add(_usableList[i], _usableList[(i+SwitchNumber)%_usableList.Count]); + } + + yield return 0; + } + public void SubscribeEvent() + { + Exiled.Events.Handlers.Player.UsingItemCompleted += OnUsingItemCompleted; + + } + public void UnsubscribeEvent() + { + Exiled.Events.Handlers.Player.UsingItemCompleted -= OnUsingItemCompleted; + } + + public static bool IsUsable(ItemType type) + { + if (type.IsMedical() || type.IsThrowable() || type.IsScp()) return true; + return false; + } + + + private void OnUsingItemCompleted(UsingItemCompletedEventArgs ev) + { + ev.IsAllowed = false; + ItemType newUsable = newEffects[ev.Usable.Type]; + Log.Debug($"item used : {ev.Usable}, item effect : {newUsable}"); + Usable use = Usable.Create(newUsable, ev.Player) as Usable; + if (use is null) + { + Log.Error("Usable null stopping"); + } + use.Use(ev.Player); + } + } +} From 9132ac98e89b9656adb6ee4f0de0b2927fdd92d6 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Wed, 26 Mar 2025 05:03:09 +0100 Subject: [PATCH 249/853] quality --- .../KE.Utils/Quality/AdminToyQuality.cs | 27 ++++++++++ .../KE.Utils/Quality/Enums/ModelQuality.cs | 16 ++++++ .../Quality/Settings/QualitySettings.cs | 53 +++++++++++++++++++ 3 files changed, 96 insertions(+) create mode 100644 KruacentExiled/KE.Utils/Quality/AdminToyQuality.cs create mode 100644 KruacentExiled/KE.Utils/Quality/Enums/ModelQuality.cs create mode 100644 KruacentExiled/KE.Utils/Quality/Settings/QualitySettings.cs diff --git a/KruacentExiled/KE.Utils/Quality/AdminToyQuality.cs b/KruacentExiled/KE.Utils/Quality/AdminToyQuality.cs new file mode 100644 index 00000000..7213baea --- /dev/null +++ b/KruacentExiled/KE.Utils/Quality/AdminToyQuality.cs @@ -0,0 +1,27 @@ +using Exiled.API.Features.Toys; +using KE.Utils.Quality.Enums; +using System.Collections.Generic; + +namespace KE.Utils.Quality +{ + public static class QualityToysHandler + { + private static Dictionary _pickupPrimitives = new(); + private static Dictionary _qualityPrimitives= new(); + + public static bool IsPickupPrimitive(Primitive primitive) + { + return _pickupPrimitives.ContainsKey(primitive); + } + + public static bool IsQualityPrimitive(Primitive primitive) + { + return _qualityPrimitives.ContainsKey(primitive); + } + + + + + + } +} diff --git a/KruacentExiled/KE.Utils/Quality/Enums/ModelQuality.cs b/KruacentExiled/KE.Utils/Quality/Enums/ModelQuality.cs new file mode 100644 index 00000000..d9d8d295 --- /dev/null +++ b/KruacentExiled/KE.Utils/Quality/Enums/ModelQuality.cs @@ -0,0 +1,16 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace KE.Utils.Quality.Enums +{ + public enum ModelQuality + { + None = -1, + Low, + Medium, + High, + } +} diff --git a/KruacentExiled/KE.Utils/Quality/Settings/QualitySettings.cs b/KruacentExiled/KE.Utils/Quality/Settings/QualitySettings.cs new file mode 100644 index 00000000..d4bdde5d --- /dev/null +++ b/KruacentExiled/KE.Utils/Quality/Settings/QualitySettings.cs @@ -0,0 +1,53 @@ +using Exiled.API.Features; +using Exiled.API.Features.Core.UserSettings; +using Exiled.Events.Commands.Hub; +using KE.Utils.Quality.Enums; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using UserSettings.ServerSpecific; + +namespace KE.Utils.Quality.Settings +{ + internal class QualitySettings + { + + private static int _idQuality = 0; + private static int _idModels = 1; + public QualitySettings() + { + HeaderSetting header = new("Quality Settings"); + SettingBase[] settings = new SettingBase[] + { + header, + new TwoButtonsSetting(_idQuality,"ModelQuality","Low","High"), + new TwoButtonsSetting(_idModels,"Pickup models","off","on") + }; + SettingBase.Register(settings); + SettingBase.SendToAll(); + + + + } + + public static ModelQuality Get(Player p) + { + if (!SettingBase.TryGetSetting(p, _idQuality, out var setting)) return ModelQuality.None; + if (setting.IsSecond) + return ModelQuality.High; + else + return ModelQuality.Low; + } + + + public static bool PickmodelActivated(Player p) + { + if (!SettingBase.TryGetSetting(p, _idModels, out var setting)) return false; + return setting.IsSecond; + } + + + } +} From 7e024f561f52320907bd0d86f65f04b0de69aa68 Mon Sep 17 00:00:00 2001 From: Omer <113857370+OmerGS@users.noreply.github.com> Date: Fri, 28 Mar 2025 16:26:46 +0100 Subject: [PATCH 250/853] add base code --- .../KE.CustomRoles/CR/Human/Curiosophile.cs | 148 ++++++++++++++++++ 1 file changed, 148 insertions(+) create mode 100644 KruacentExiled/KE.CustomRoles/CR/Human/Curiosophile.cs diff --git a/KruacentExiled/KE.CustomRoles/CR/Human/Curiosophile.cs b/KruacentExiled/KE.CustomRoles/CR/Human/Curiosophile.cs new file mode 100644 index 00000000..9c488670 --- /dev/null +++ b/KruacentExiled/KE.CustomRoles/CR/Human/Curiosophile.cs @@ -0,0 +1,148 @@ +/* +using Exiled.API.Enums; +using Exiled.API.Extensions; +using Exiled.API.Features; +using Exiled.API.Features.Attributes; +using Exiled.CustomRoles.API.Features; +using Exiled.Events.EventArgs.Map; +using Exiled.Events.EventArgs.Player; +using KE.CustomRoles.API; +using MEC; +using PlayerRoles; +using System; +using System.Collections.Generic; +using System.Linq; +using UnityEngine; +using Utils.NonAllocLINQ; + +namespace KE.CustomRoles.CR.Human +{ + [CustomRole(RoleTypeId.None)] + internal class Curiosophile : GlobalCustomRole + { + public override SideEnum Side { get; set; } = SideEnum.Human; + public override string Name { get; set; } = "Curiosophile"; + public override string Description { get; set; } = "Tu veux récuperer tous ce que tu vois !"; + public override uint Id { get; set; } = 1059; + public override string CustomInfo { get; set; } = "Curiosophile"; + public override bool KeepRoleOnDeath { get; set; } = false; + public override bool KeepRoleOnChangingRole { get; set; } = true; + public override float SpawnChance { get; set; } = 100; + + private readonly List LowQualityItem = + [ + ItemType.GunA7, + ItemType.GunCOM15, + ItemType.Flashlight, + ItemType.Coin, + ItemType.KeycardJanitor, + ItemType.KeycardGuard, + ]; + + private readonly List HighQualityItem = + [ + ItemType.MicroHID, + ItemType.Jailbird, + ItemType.GunFRMG0, + ItemType.ArmorHeavy, + ItemType.ParticleDisruptor, + ItemType.Adrenaline, + ItemType.SCP1344, + ItemType.SCP500, + ItemType.AntiSCP207, + ItemType.KeycardMTFCaptain, + ItemType.KeycardO5, + ItemType.KeycardFacilityManager, + ]; + + private readonly List BuffEffect = + [ + EffectType.Vitality, + EffectType.RainbowTaste, + EffectType.BodyshotReduction, + EffectType.AntiScp207 + ]; + + private readonly List NerfEffect = + [ + EffectType.Deafened, + EffectType.AmnesiaVision, + EffectType.InsufficientLighting, + EffectType.Stained, + EffectType.Blurred + ]; + + private Dictionary activeEffect = new Dictionary(); + + protected override void SubscribeEvents() + { + Exiled.Events.Handlers.Player.ItemAdded += PickupItem; + Exiled.Events.Handlers.Player.ItemRemoved += ThrowItem; + } + + protected override void UnsubscribeEvents() + { + Exiled.Events.Handlers.Player.ItemAdded -= PickupItem; + Exiled.Events.Handlers.Player.ItemRemoved -= ThrowItem; + } + + public void PickupItem(ItemAddedEventArgs ev) + { + if (!Check(ev.Player)) return; + + CheckupInventory(ev.Player); + } + + public void ThrowItem(ItemRemovedEventArgs ev) + { + if (!Check(ev.Player)) return; + + CheckupInventory(ev.Player); + } + + private void CheckupInventory(Player p) + { + IEnumerable playerItems = p.Items.Select(item => item.Type); + + int buffedItemCount = playerItems.Intersect(LowQualityItem).Count(); + int nerfedItemCount = playerItems.Intersect(HighQualityItem).Count(); + + + + ApplyRandomBuffEffects(buffedItemCount, p); + ApplyRandomNerfEffects(nerfedItemCount, p); + } + + private void ApplyRandomBuffEffects(int buffedItemCount, Player p) + { + if (buffedItemCount > 0) + { + Log.Info("Buff Effect Applied"); + int effectsToApply = Mathf.Min(buffedItemCount, BuffEffect.Count); + + for (int i = 0; i < effectsToApply; i++) + { + var randomBuff = BuffEffect[UnityEngine.Random.Range(0, BuffEffect.Count)]; + p.EnableEffect(randomBuff, -1); + } + } + } + + private void ApplyRandomNerfEffects(int nerfedItemCount, Player p) + { + if (nerfedItemCount > 0) + { + Log.Info("Nerf Effect Applied"); + + int effectsToApply = Mathf.Min(nerfedItemCount, NerfEffect.Count); + + for (int i = 0; i < effectsToApply; i++) + { + var randomNerf = NerfEffect[UnityEngine.Random.Range(0, NerfEffect.Count)]; + p.EnableEffect(randomNerf, -1); + } + } + } + } +} +*/ \ No newline at end of file From 55cc358ca432b3c10110b6d7976ed603b81ff2e8 Mon Sep 17 00:00:00 2001 From: Omer <113857370+OmerGS@users.noreply.github.com> Date: Sat, 29 Mar 2025 15:33:17 +0100 Subject: [PATCH 251/853] first use : record, second use : play the recorded audio --- KruacentExiled/KE.Items/Items/Scp7045.cs | 95 +++++++++++++++++------- 1 file changed, 69 insertions(+), 26 deletions(-) diff --git a/KruacentExiled/KE.Items/Items/Scp7045.cs b/KruacentExiled/KE.Items/Items/Scp7045.cs index ce7b5eb2..ff4e4239 100644 --- a/KruacentExiled/KE.Items/Items/Scp7045.cs +++ b/KruacentExiled/KE.Items/Items/Scp7045.cs @@ -34,8 +34,6 @@ public class Scp7045 : KECustomItem public override string Description { get; set; } = "A weird looking radio"; public override float Weight { get; set; } = 0.65f; - private bool _recordingMode= true; - private bool _someoneUsingItem = false; private AudioMessage _message; public override SpawnProperties SpawnProperties { get; set; } = new SpawnProperties() { @@ -64,15 +62,67 @@ protected override void UnsubscribeEvents() Exiled.Events.Handlers.Player.VoiceChatting -= OnVoiceChatting; } + + + + + + + + + + + + + + + + + private bool _isItemActive = false; + private void OnUsedItem(UsedItemEventArgs ev) { - if (!Check(ev.Item)) return; + Scp1576 item = (Scp1576)ev.Item; - Timing.CallDelayed(.5f, () => item.StopTransmitting()); + + if (!_isItemActive) + { + _isItemActive = true; + _recordingBuffer.Clear(); + _isRecording = true; + _lastVoiceTime = Time.time; + Log.Info("Enregistrement activé..."); + + Speaker speaker; + byte speakerid = (byte)ev.Player.Id; + + if (!_speakers.TryGetValue(ev.Player, out speaker)) + _speakers[ev.Player] = Speaker.Create(speakerid, ev.Player.Position); + + Timing.RunCoroutine(CheckIfRecordingFinished(_speakers[ev.Player])); + } + else + { + _isItemActive = false; + _isRecording = false; + Log.Info("Enregistrement terminé."); + + Log.Info("Recording buffer : " + _recordingBuffer.ToArray().Count()); + if (_recordingBuffer.Count > 0) + { + float[] finalRecording = _recordingBuffer.ToArray(); + Timing.RunCoroutine(PlayVoice(finalRecording, (byte)ev.Player.Id)); + } + + item.StopTransmitting(); + } + } + + public const int sampleSize = 480; private List _recordingBuffer = new(); @@ -80,7 +130,8 @@ private void OnUsedItem(UsedItemEventArgs ev) private float _lastVoiceTime = 0f; // Timestamp of last voice packet private void OnVoiceChatting(VoiceChattingEventArgs ev) { - if (!Check(ev.Player.CurrentItem)) return; + if (!_isItemActive || !Check(ev.Player.CurrentItem)) return; + Speaker speaker; byte speakerid = (byte)ev.Player.Id; if (!_speakers.TryGetValue(ev.Player, out speaker)) @@ -90,22 +141,20 @@ private void OnVoiceChatting(VoiceChattingEventArgs ev) speaker = _speakers[ev.Player]; VoiceMessage message = ev.VoiceMessage; - if (!_isRecording) - { - _recordingBuffer.Clear(); - _isRecording = true; - Timing.RunCoroutine(CheckIfRecordingFinished(speaker)); // Start the "stop talking" check - } - // Decode voice data and append to the shared buffer - float[] decodedBuffer = new float[sampleSize]; - _decoder.Decode(message.Data, message.DataLength, decodedBuffer); - _recordingBuffer.AddRange(decodedBuffer); + // Si on est en mode enregistrement et que l'item est activé, on enregistre la voix + if (_isRecording) + { + float[] decodedBuffer = new float[sampleSize]; + _decoder.Decode(message.Data, message.DataLength, decodedBuffer); + _recordingBuffer.AddRange(decodedBuffer); - // Update the last time voice data was received - _lastVoiceTime = Time.time; + // Mettre à jour le timestamp de la dernière voix reçue + _lastVoiceTime = Time.time; + } } + private IEnumerator CheckIfRecordingFinished(Speaker speaker) { while (_isRecording) @@ -117,14 +166,15 @@ private IEnumerator CheckIfRecordingFinished(Speaker speaker) if (Time.time - _lastVoiceTime >= 0.5f) { _isRecording = false; - + float[] finalRecording = _recordingBuffer.ToArray(); Log.Info($"Final recorded voice message length: {finalRecording.Length} samples."); - Timing.RunCoroutine(PlayVoice(finalRecording, speaker.Base.NetworkControllerId)); + //Timing.RunCoroutine(PlayVoice(finalRecording, speaker.Base.NetworkControllerId)); } } } + private IEnumerator PlayVoice(float[] data,byte speakerid) @@ -138,14 +188,7 @@ private IEnumerator PlayVoice(float[] data,byte speakerid) foreach(Player player in Player.List) player.ReferenceHub.connectionToClient.Send(_message); yield return Timing.WaitForOneFrame; - } - } - - - - - } } From 9ce039ccd0c6d38abcc0ee56db8b5339835ccd07 Mon Sep 17 00:00:00 2001 From: Omer <113857370+OmerGS@users.noreply.github.com> Date: Sat, 29 Mar 2025 22:33:49 +0100 Subject: [PATCH 252/853] added countdown, teleport when item is used and fix #100 --- KruacentExiled/KE.Items/Items/Scp7045.cs | 93 +++++++++++++++++++----- 1 file changed, 76 insertions(+), 17 deletions(-) diff --git a/KruacentExiled/KE.Items/Items/Scp7045.cs b/KruacentExiled/KE.Items/Items/Scp7045.cs index ff4e4239..35a8036f 100644 --- a/KruacentExiled/KE.Items/Items/Scp7045.cs +++ b/KruacentExiled/KE.Items/Items/Scp7045.cs @@ -1,12 +1,17 @@ using Exiled.API.Enums; +using Exiled.API.Extensions; using Exiled.API.Features; using Exiled.API.Features.Attributes; using Exiled.API.Features.Items; using Exiled.API.Features.Spawn; using Exiled.API.Features.Toys; +using Exiled.CustomItems; using Exiled.CustomItems.API.Features; using Exiled.Events.EventArgs.Player; using Exiled.Events.EventArgs.Server; +using KE.Items.Interface; +using KE.Utils.Display.Enums; +using KE.Utils.Display; using MEC; using PlayerRoles; using System; @@ -62,22 +67,6 @@ protected override void UnsubscribeEvents() Exiled.Events.Handlers.Player.VoiceChatting -= OnVoiceChatting; } - - - - - - - - - - - - - - - - private bool _isItemActive = false; private void OnUsedItem(UsedItemEventArgs ev) @@ -101,6 +90,8 @@ private void OnUsedItem(UsedItemEventArgs ev) _speakers[ev.Player] = Speaker.Create(speakerid, ev.Player.Position); Timing.RunCoroutine(CheckIfRecordingFinished(_speakers[ev.Player])); + Timing.RunCoroutine(DisplayCountdown(ev.Player)); + } else { @@ -118,6 +109,11 @@ private void OnUsedItem(UsedItemEventArgs ev) item.StopTransmitting(); } + Log.Info("BeforeTeleport"); + + TeleportItem(item, ev.Player); + + Log.Info("AfterTeleport"); } @@ -154,7 +150,39 @@ private void OnVoiceChatting(VoiceChattingEventArgs ev) } } - + + private const float itemDuration = 15f; + + private IEnumerator DisplayCountdown(Player p) + { + float countdown = itemDuration; + + while (countdown > 0) + { + string showCountdown = $"Remaining: {countdown:F1}s"; + RueIHint hint = new RueIHint(HPosition.Center, VPosition.CustomItem, showCountdown, 1f); + + DisplayPlayer.Get(p).Hint(hint); + + yield return Timing.WaitForSeconds(1f); + countdown -= 1f; + } + } + + private IEnumerator CheckIfRecordingFinished(Speaker speaker) + { + Log.Info($"Recording started. Duration: {itemDuration}s."); + + yield return Timing.WaitForSeconds(itemDuration); + + _isRecording = false; + + float[] finalRecording = _recordingBuffer.ToArray(); + Log.Info($"Recording finished. Length: {finalRecording.Length} samples."); + //Timing.RunCoroutine(PlayVoice(finalRecording, speaker.Base.NetworkControllerId)); + } + + /* private IEnumerator CheckIfRecordingFinished(Speaker speaker) { while (_isRecording) @@ -174,6 +202,7 @@ private IEnumerator CheckIfRecordingFinished(Speaker speaker) } } } + */ @@ -190,5 +219,35 @@ private IEnumerator PlayVoice(float[] data,byte speakerid) yield return Timing.WaitForOneFrame; } } + + private void TeleportItem(Scp1576 item, Player p) + { + Player nextPlayer = Player.List.Where(x => x.IsHuman).GetRandomValue(); + + Log.Info("NextPlayer : " + nextPlayer); + + Room closeRoom = findNearbyRoom(nextPlayer, 2); + + Log.Info("Room : " + closeRoom); + + item.CreatePickup(closeRoom.Position, null, true); + + Log.Info("PickupCreated"); + p.RemoveItem(item, false); + } + + private Room findNearbyRoom(Player p, int depth) + { + HashSet rooms = new HashSet(p.CurrentRoom.NearestRooms); + for (int i = 0; i < depth; i++) + { + // Copier les nouvelles rooms avant de les ajouter + HashSet newRooms = new HashSet(rooms.SelectMany(r => r.NearestRooms)); + rooms.UnionWith(newRooms); + } + + // Si rooms est vide, on retourne une salle aléatoire + return rooms.Count > 0 ? rooms.GetRandomValue() : Room.Random(); + } } } From 31e70593ecd96b9036c96ce1509a0426d26cb737 Mon Sep 17 00:00:00 2001 From: Omer <113857370+OmerGS@users.noreply.github.com> Date: Tue, 1 Apr 2025 17:09:07 +0200 Subject: [PATCH 253/853] fix/play voice --- KruacentExiled/KE.Items/Items/Scp7045.cs | 85 ++++++------------------ 1 file changed, 21 insertions(+), 64 deletions(-) diff --git a/KruacentExiled/KE.Items/Items/Scp7045.cs b/KruacentExiled/KE.Items/Items/Scp7045.cs index 35a8036f..42597c4b 100644 --- a/KruacentExiled/KE.Items/Items/Scp7045.cs +++ b/KruacentExiled/KE.Items/Items/Scp7045.cs @@ -5,13 +5,9 @@ using Exiled.API.Features.Items; using Exiled.API.Features.Spawn; using Exiled.API.Features.Toys; -using Exiled.CustomItems; using Exiled.CustomItems.API.Features; using Exiled.Events.EventArgs.Player; using Exiled.Events.EventArgs.Server; -using KE.Items.Interface; -using KE.Utils.Display.Enums; -using KE.Utils.Display; using MEC; using PlayerRoles; using System; @@ -33,7 +29,7 @@ public class Scp7045 : KECustomItem private static readonly OpusDecoder _decoder = new(); private static readonly OpusEncoder _encoder = new(OpusApplicationType.Voip); - private static readonly Dictionary _speakers = new (); + private static readonly Dictionary _speakers = new(); public override uint Id { get; set; } = 1800; public override string Name { get; set; } = "SCP-7045"; public override string Description { get; set; } = "A weird looking radio"; @@ -83,15 +79,7 @@ private void OnUsedItem(UsedItemEventArgs ev) _lastVoiceTime = Time.time; Log.Info("Enregistrement activé..."); - Speaker speaker; - byte speakerid = (byte)ev.Player.Id; - - if (!_speakers.TryGetValue(ev.Player, out speaker)) - _speakers[ev.Player] = Speaker.Create(speakerid, ev.Player.Position); - - Timing.RunCoroutine(CheckIfRecordingFinished(_speakers[ev.Player])); - Timing.RunCoroutine(DisplayCountdown(ev.Player)); - + Timing.RunCoroutine(CheckIfRecordingFinished(item, ev.Player)); } else { @@ -102,19 +90,19 @@ private void OnUsedItem(UsedItemEventArgs ev) Log.Info("Recording buffer : " + _recordingBuffer.ToArray().Count()); if (_recordingBuffer.Count > 0) { + Speaker speaker; + byte speakerid = (byte)ev.Player.Id; + + if (!_speakers.TryGetValue(ev.Player, out speaker)) + _speakers[ev.Player] = Speaker.Create(speakerid, ev.Player.Position); + float[] finalRecording = _recordingBuffer.ToArray(); - Timing.RunCoroutine(PlayVoice(finalRecording, (byte)ev.Player.Id)); + Timing.RunCoroutine(PlayVoice(finalRecording, (byte)ev.Player.Id, item, ev.Player)); } item.StopTransmitting(); - } - - Log.Info("BeforeTeleport"); - - TeleportItem(item, ev.Player); - - Log.Info("AfterTeleport"); + } } @@ -150,40 +138,7 @@ private void OnVoiceChatting(VoiceChattingEventArgs ev) } } - - private const float itemDuration = 15f; - - private IEnumerator DisplayCountdown(Player p) - { - float countdown = itemDuration; - - while (countdown > 0) - { - string showCountdown = $"Remaining: {countdown:F1}s"; - RueIHint hint = new RueIHint(HPosition.Center, VPosition.CustomItem, showCountdown, 1f); - - DisplayPlayer.Get(p).Hint(hint); - - yield return Timing.WaitForSeconds(1f); - countdown -= 1f; - } - } - - private IEnumerator CheckIfRecordingFinished(Speaker speaker) - { - Log.Info($"Recording started. Duration: {itemDuration}s."); - - yield return Timing.WaitForSeconds(itemDuration); - - _isRecording = false; - - float[] finalRecording = _recordingBuffer.ToArray(); - Log.Info($"Recording finished. Length: {finalRecording.Length} samples."); - //Timing.RunCoroutine(PlayVoice(finalRecording, speaker.Base.NetworkControllerId)); - } - - /* - private IEnumerator CheckIfRecordingFinished(Speaker speaker) + private IEnumerator CheckIfRecordingFinished(Scp1576 item, Player p) { while (_isRecording) { @@ -194,19 +149,18 @@ private IEnumerator CheckIfRecordingFinished(Speaker speaker) if (Time.time - _lastVoiceTime >= 0.5f) { _isRecording = false; - + float[] finalRecording = _recordingBuffer.ToArray(); Log.Info($"Final recorded voice message length: {finalRecording.Length} samples."); //Timing.RunCoroutine(PlayVoice(finalRecording, speaker.Base.NetworkControllerId)); } } - } - */ - + TeleportItem(item, p); + } - private IEnumerator PlayVoice(float[] data,byte speakerid) + private IEnumerator PlayVoice(float[] data, byte speakerid, Scp1576 item, Player p) { for (int i = 0; i < data.Length; i += sampleSize) { @@ -214,15 +168,18 @@ private IEnumerator PlayVoice(float[] data,byte speakerid) float[] decodedBuffer = data.Skip(i).Take(sampleSize).ToArray(); int dataLen = _encoder.Encode(decodedBuffer, encodedData); _message = new AudioMessage(speakerid, encodedData, dataLen); - foreach(Player player in Player.List) + foreach (Player player in Player.List) player.ReferenceHub.connectionToClient.Send(_message); yield return Timing.WaitForOneFrame; } + + item.CreatePickup(Room.Random().Position, null, true); + p.RemoveItem(item, false); } private void TeleportItem(Scp1576 item, Player p) { - Player nextPlayer = Player.List.Where(x => x.IsHuman).GetRandomValue(); + Player nextPlayer = Player.List.Where(x => x.IsHuman && x != p).GetRandomValue(); Log.Info("NextPlayer : " + nextPlayer); @@ -250,4 +207,4 @@ private Room findNearbyRoom(Player p, int depth) return rooms.Count > 0 ? rooms.GetRandomValue() : Room.Random(); } } -} +} \ No newline at end of file From 700500ef9ab64669f013fd665dc0e24d2721309f Mon Sep 17 00:00:00 2001 From: Omer <113857370+OmerGS@users.noreply.github.com> Date: Wed, 2 Apr 2025 16:07:56 +0200 Subject: [PATCH 254/853] fixed/dboyinshape spawn in 173 add/hitman custom role ff don't work --- .../KE.CustomRoles/CR/ClassD/DBoyInShape.cs | 3 +- .../KE.CustomRoles/CR/Human/Hitman.cs | 234 ++++++++++++++++++ 2 files changed, 236 insertions(+), 1 deletion(-) create mode 100644 KruacentExiled/KE.CustomRoles/CR/Human/Hitman.cs diff --git a/KruacentExiled/KE.CustomRoles/CR/ClassD/DBoyInShape.cs b/KruacentExiled/KE.CustomRoles/CR/ClassD/DBoyInShape.cs index c23965e4..fe8b2604 100644 --- a/KruacentExiled/KE.CustomRoles/CR/ClassD/DBoyInShape.cs +++ b/KruacentExiled/KE.CustomRoles/CR/ClassD/DBoyInShape.cs @@ -21,9 +21,10 @@ namespace KE.CustomRoles.CR.ClassD internal class DBoyInShape : KECustomRole { public override string Name { get; set; } = "DBoyInShape"; - public override string Description { get; set; } = ""; + public override string Description { get; set; } = "Dammmmnnnnnnn les gates"; public override uint Id { get; set; } = 1058; public override string CustomInfo { get; set; } = "DBoyInShape"; + public override RoleTypeId Role { get; set; } = RoleTypeId.ClassD; public override bool KeepRoleOnDeath { get; set; } = false; public override bool KeepRoleOnChangingRole { get; set; } = true; public override float SpawnChance { get; set; } = 100; diff --git a/KruacentExiled/KE.CustomRoles/CR/Human/Hitman.cs b/KruacentExiled/KE.CustomRoles/CR/Human/Hitman.cs new file mode 100644 index 00000000..bee8c478 --- /dev/null +++ b/KruacentExiled/KE.CustomRoles/CR/Human/Hitman.cs @@ -0,0 +1,234 @@ +using Exiled.API.Enums; +using Exiled.API.Extensions; +using Exiled.API.Features; +using Exiled.API.Features.Attributes; +using Exiled.CustomRoles.API.Features; +using Exiled.Events.EventArgs.Player; +using Hints; +using KE.CustomRoles.API; +using KE.Utils.Display; +using MEC; +using PlayerRoles; +using PluginAPI.Events; +using System.Collections.Generic; +using System.Linq; +using UnityEngine; +using Utils.NonAllocLINQ; + +namespace KE.CustomRoles.CR.Human +{ + [CustomRole(RoleTypeId.None)] + internal class Hitman : GlobalCustomRole + { + private static CoroutineHandle _coroutines; + public override SideEnum Side { get; set; } = SideEnum.Human; + public override string Name { get; set; } = "Hitman"; + public override string Description { get; set; } = "Tu es Hitman"; + public override uint Id { get; set; } = 1059; + public override string CustomInfo { get; set; } = ""; + public override bool KeepRoleOnDeath { get; set; } = false; + public override bool KeepRoleOnChangingRole { get; set; } = true; + public override float SpawnChance { get; set; } = 100; + + private Player TargetPlayer { get; set; } = null; + private Player TheHitman { get; set; } = null; + + private void NerfHitman() + { + Log.Info($"Hitman Nerf Applied to {this.TheHitman.Nickname}"); + this.TheHitman.MaxHealth = 70; + this.TheHitman.Health -= 30; + + this.TheHitman.EnableEffect(EffectType.Slowness, -1,true); + } + + private void BuffHitman() + { + Log.Info($"Hitman Buff Applied to {this.TheHitman.Nickname}"); + this.TheHitman.MaxHealth = 130; + this.TheHitman.Health += 30; + + this.TheHitman.EnableEffect(EffectType.MovementBoost, -1, true); + } + + protected override void RoleAdded(Player player) + { + Log.Info("Role full name : " + player.Role.Name); + this.CustomInfo = player.Role.Name; + + this.TheHitman = player; + // Target cannot be NPC, SCP or the Hitman + this.TargetPlayer = Player.List.Where(x => x.IsHuman && x != player /*&& !x.IsNPC*/).GetRandomValue(); + + + Log.Debug($"Target showing to Hitman, target is : {TargetPlayer.Nickname}"); + RueIHint hint = new(Utils.Display.Enums.HPosition.Center, Utils.Display.Enums.VPosition.CustomRoleEffect, $"The Target is {TargetPlayer.Nickname}", 5); + DisplayPlayer.Get(player).Hint(hint); + + if (this.TheHitman.Role.Side == this.TargetPlayer.Role.Side && !Server.FriendlyFire) + { + bool success = this.TheHitman.TryAddCustomRoleFriendlyFire(this.TargetPlayer.Role.Type.ToString(), this.TargetPlayer.Role.Type, 1); + Log.Info("Custom FF : " + success); + } + + _coroutines = Timing.RunCoroutine(CheckRooms()); + } + + protected override void RoleRemoved(Player player) + { + Timing.KillCoroutines(_coroutines); + } + + protected override void SubscribeEvents() + { + Exiled.Events.Handlers.Player.Escaped += TargetEscaped; + Exiled.Events.Handlers.Player.Died += TargetDie; + } + + protected override void UnsubscribeEvents() + { + Exiled.Events.Handlers.Player.Escaped -= TargetEscaped; + Exiled.Events.Handlers.Player.Died -= TargetDie; + } + + public void TargetEscaped(EscapedEventArgs ev) + { + if (ev.Player != this.TargetPlayer) return; + + Log.Info($"Target {this.TargetPlayer.Nickname} escaped"); + + RueIHint hint = new(Utils.Display.Enums.HPosition.Center, Utils.Display.Enums.VPosition.CustomRoleEffect, $"The target ({this.TargetPlayer.Nickname}) has escaped, you lost the contract", 5); + DisplayPlayer.Get(this.TheHitman).Hint(hint); + + NerfHitman(); + + this.TargetPlayer = null; + } + + public void TargetDie(DiedEventArgs ev) + { + if (ev.Player != this.TargetPlayer) return; + + Log.Info($"{ev.Attacker} has killed {ev.Player}"); + + // Hitman killed the target + if (ev.Player == this.TargetPlayer && ev.Attacker == this.TheHitman) + { + RueIHint hint = new(Utils.Display.Enums.HPosition.Center, Utils.Display.Enums.VPosition.CustomRoleEffect, $"You killed the target ({this.TargetPlayer.Nickname})", 5); + DisplayPlayer.Get(this.TheHitman).Hint(hint); + BuffHitman(); + + this.TargetPlayer = null; + } + else + { + RueIHint hint = new(Utils.Display.Enums.HPosition.Center, Utils.Display.Enums.VPosition.CustomRoleEffect, $"The target ({this.TargetPlayer.Nickname}) is dead, you lost the contract", 5); + DisplayPlayer.Get(this.TheHitman).Hint(hint); + NerfHitman(); + + this.TargetPlayer = null; + } + + if (this.TheHitman.Role.Side == this.TargetPlayer.Role.Side && !Server.FriendlyFire) + { + this.TheHitman.TryRemoveCustomeRoleFriendlyFire(this.TargetPlayer.Role.Type.ToString()); + } + } + + + + + const float CHECK_INTERVAL = 15f; + + private IEnumerator CheckRooms() + { + List<(int distance, string message, bool hasLogged)> proximityAlerts = new List<(int, string, bool)> + { + (0, "Sweat drips down your forehead...", false), + (3, "Your heart beats out of your chest...", false), + (5, "Your lungs tighten up...", false), + (999, "You feel dizzy...", false) + }; + + while (true) + { + if (this.TargetPlayer == null) + { + Log.Info("Target player is null. Stopping CheckRooms coroutine."); + yield break; + } + + yield return Timing.WaitForSeconds(CHECK_INTERVAL); + + for (int i = 0; i < proximityAlerts.Count; i++) + { + var (distance, message, hasLogged) = proximityAlerts[i]; + + if (distance == 0 && this.TheHitman.CurrentRoom == this.TargetPlayer.CurrentRoom) + { + if (!hasLogged) + { + Log.Info(this.TargetPlayer + " " + message); + RueIHint hint = new(Utils.Display.Enums.HPosition.Center, Utils.Display.Enums.VPosition.CustomRoleEffect, message, 5); + DisplayPlayer.Get(this.TargetPlayer).Hint(hint); + ResetLogs(ref proximityAlerts); + proximityAlerts[i] = (distance, message, true); + } + break; + } + else if (distance == 999 && this.TheHitman.Zone == this.TargetPlayer.Zone) + { + if (!hasLogged) + { + Log.Info(this.TargetPlayer + " " + message); + RueIHint hint = new(Utils.Display.Enums.HPosition.Center, Utils.Display.Enums.VPosition.CustomRoleEffect, message, 5); + DisplayPlayer.Get(this.TargetPlayer).Hint(hint); + ResetLogs(ref proximityAlerts); + proximityAlerts[i] = (distance, message, true); + } + break; + } + else if (AreRoomsWithinDepth(this.TheHitman, this.TargetPlayer, distance)) + { + if (!hasLogged) + { + Log.Info(this.TargetPlayer + " " + message); + RueIHint hint = new(Utils.Display.Enums.HPosition.Center, Utils.Display.Enums.VPosition.CustomRoleEffect, message, 5); + DisplayPlayer.Get(this.TargetPlayer).Hint(hint); + ResetLogs(ref proximityAlerts); + proximityAlerts[i] = (distance, message, true); + } + break; + } + } + } + } + + private bool AreRoomsWithinDepth(Player p1, Player p2, int depth) + { + HashSet nearbyRooms = GetNearbyRooms(p1, depth); + return nearbyRooms.Contains(p2.CurrentRoom); + } + + private HashSet GetNearbyRooms(Player p, int depth) + { + HashSet rooms = new HashSet(p.CurrentRoom.NearestRooms); + for (int i = 0; i < depth; i++) + { + HashSet newRooms = new HashSet(rooms.SelectMany(r => r.NearestRooms)); + rooms.UnionWith(newRooms); + } + return rooms; + } + + // Reinitialise tous logs sauf celui qui vient d'être actiév + private void ResetLogs(ref List<(int distance, string message, bool hasLogged)> proximityAlerts) + { + for (int i = 0; i < proximityAlerts.Count; i++) + { + var (distance, message, _) = proximityAlerts[i]; + proximityAlerts[i] = (distance, message, false); + } + } + } +} From 7c8ab1be1683269ac9ca5f4988f39f5251d6a2be Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Mon, 2 Jun 2025 18:23:12 +0200 Subject: [PATCH 255/853] test with the models --- KruacentExiled/KE.Items/Config.cs | 3 +- .../KE.Items/Interface/ICustomPickupModel.cs | 14 ++ KruacentExiled/KE.Items/Items/Mine.cs | 35 +++- .../KE.Items/Lights/LightsHandler.cs | 8 +- KruacentExiled/KE.Items/MainPlugin.cs | 36 +++- .../KE.Items/PickupModels/PickupQuality.cs | 132 +++++++++++++ .../KE.Utils/Extensions/AdminToyExtension.cs | 25 +++ .../KE.Utils/Extensions/PlayerExtension.cs | 19 +- .../KE.Utils/Quality/AdminToyQuality.cs | 27 --- .../Quality/Handlers/QualityToysHandler.cs | 179 ++++++++++++++++++ .../KE.Utils/Quality/Models/Base/BaseModel.cs | 41 ++++ .../Quality/Models/Base/LightModel.cs | 26 +++ .../Quality/Models/Base/PrimitiveModel.cs | 26 +++ .../Quality/Models/Examples/MineModel.cs | 118 ++++++++++++ .../KE.Utils/Quality/Models/Model.cs | 104 ++++++++++ .../KE.Utils/Quality/Models/ModelPrefab.cs | 42 ++++ .../KE.Utils/Quality/Models/QualityModel.cs | 40 ++++ .../KE.Utils/Quality/QualityHandler.cs | 60 ++++++ .../Quality/Settings/QualitySettings.cs | 45 +++-- .../Quality/Structs/LocalWorldSpace.cs | 23 +++ KruacentExiled/KE.Utils/Quality/Tests/Test.cs | 108 +++++++++++ 21 files changed, 1047 insertions(+), 64 deletions(-) create mode 100644 KruacentExiled/KE.Items/Interface/ICustomPickupModel.cs create mode 100644 KruacentExiled/KE.Items/PickupModels/PickupQuality.cs create mode 100644 KruacentExiled/KE.Utils/Extensions/AdminToyExtension.cs delete mode 100644 KruacentExiled/KE.Utils/Quality/AdminToyQuality.cs create mode 100644 KruacentExiled/KE.Utils/Quality/Handlers/QualityToysHandler.cs create mode 100644 KruacentExiled/KE.Utils/Quality/Models/Base/BaseModel.cs create mode 100644 KruacentExiled/KE.Utils/Quality/Models/Base/LightModel.cs create mode 100644 KruacentExiled/KE.Utils/Quality/Models/Base/PrimitiveModel.cs create mode 100644 KruacentExiled/KE.Utils/Quality/Models/Examples/MineModel.cs create mode 100644 KruacentExiled/KE.Utils/Quality/Models/Model.cs create mode 100644 KruacentExiled/KE.Utils/Quality/Models/ModelPrefab.cs create mode 100644 KruacentExiled/KE.Utils/Quality/Models/QualityModel.cs create mode 100644 KruacentExiled/KE.Utils/Quality/QualityHandler.cs create mode 100644 KruacentExiled/KE.Utils/Quality/Structs/LocalWorldSpace.cs create mode 100644 KruacentExiled/KE.Utils/Quality/Tests/Test.cs diff --git a/KruacentExiled/KE.Items/Config.cs b/KruacentExiled/KE.Items/Config.cs index 81678c85..70de6d06 100644 --- a/KruacentExiled/KE.Items/Config.cs +++ b/KruacentExiled/KE.Items/Config.cs @@ -11,7 +11,8 @@ public class Config : IConfig { public bool IsEnabled { get; set; } = true; public bool Debug { get; set; } = true; - public float RefreshRate { get; set; } = .01f; + public float LightRefreshRate { get; set; } = .01f; + public float ModelRefreshRate { get; set; } = .1f; public string SoundLocation { get; set; } = "C:\\Users\\Patrique\\AppData\\Roaming\\EXILED\\Plugins\\audio"; public int Position { get; set; } = 300; } diff --git a/KruacentExiled/KE.Items/Interface/ICustomPickupModel.cs b/KruacentExiled/KE.Items/Interface/ICustomPickupModel.cs new file mode 100644 index 00000000..ac095e7a --- /dev/null +++ b/KruacentExiled/KE.Items/Interface/ICustomPickupModel.cs @@ -0,0 +1,14 @@ +using KE.Utils.Quality.Models; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace KE.Items.Interface +{ + public interface ICustomPickupModel + { + public ModelPrefab PickupModel { get; } + } +} diff --git a/KruacentExiled/KE.Items/Items/Mine.cs b/KruacentExiled/KE.Items/Items/Mine.cs index 345b28f2..4d759ba8 100644 --- a/KruacentExiled/KE.Items/Items/Mine.cs +++ b/KruacentExiled/KE.Items/Items/Mine.cs @@ -6,28 +6,26 @@ using System.Collections.Generic; using UnityEngine; using Exiled.Events.EventArgs.Player; -using Exiled.API.Features.Toys; -using Player = Exiled.API.Features.Player; -using MEC; -using Exiled.API.Features.Items; -using Model = KE.Items.Items.Models.Model; using KE.Items.ItemEffects; +using KE.Utils.Quality.Models; +using KE.Utils.Quality.Models.Examples; +using MEC; namespace KE.Items.Items { [CustomItem(ItemType.KeycardJanitor)] - public class Mine : KECustomItem, ILumosItem, ISwichableEffect + public class Mine : KECustomItem, ILumosItem, ISwichableEffect, ICustomPickupModel { public override uint Id { get; set; } = 1053; public override string Name { get; set; } = "Mine"; public override string Description { get; set; } = "Drop to deploy the mine, little advice : don't step on it"; public override float Weight { get; set; } = 0.65f; public Color Color { get; set; } = Color.yellow; - + public ModelPrefab PickupModel { get; set; } public CustomItemEffect Effect { get; set; } - public override SpawnProperties SpawnProperties { get; set; } = new SpawnProperties() + public override SpawnProperties SpawnProperties { get; set; } = null;/*new SpawnProperties() { Limit = 2, DynamicSpawnPoints = new List @@ -67,11 +65,30 @@ public class Mine : KECustomItem, ILumosItem, ISwichableEffect }, } - }; + };*/ public Mine() { Effect = new MineEffect(); + + } + + private void SetPickup() + { + PickupModel = new MineModelPickup(); + } + + protected override void SubscribeEvents() + { + Exiled.Events.Handlers.Server.RoundStarted += SetPickup; + base.SubscribeEvents(); + } + + protected override void UnsubscribeEvents() + { + Exiled.Events.Handlers.Server.RoundStarted -= SetPickup; + Exiled.Events.Handlers.Server.RoundStarted -= SetPickup; + base.UnsubscribeEvents(); } protected override void OnDroppingItem(DroppingItemEventArgs ev) diff --git a/KruacentExiled/KE.Items/Lights/LightsHandler.cs b/KruacentExiled/KE.Items/Lights/LightsHandler.cs index 3634aa56..790c2764 100644 --- a/KruacentExiled/KE.Items/Lights/LightsHandler.cs +++ b/KruacentExiled/KE.Items/Lights/LightsHandler.cs @@ -1,9 +1,6 @@ -using Exiled.API.Features; -using Exiled.API.Features.Pickups; + using Exiled.API.Features.Toys; using Exiled.CustomItems.API.Features; -using Exiled.Events.EventArgs.Map; -using Exiled.Events.EventArgs.Player; using InventorySystem.Items.Pickups; using KE.Items.Interface; using MEC; @@ -35,6 +32,7 @@ public void UnsubscribeEvents() private void OnRoundStarted() { Timing.RunCoroutine(LightP()); + } @@ -99,7 +97,7 @@ private IEnumerator LightP() { } - yield return Timing.WaitForSeconds(MainPlugin.Instance.Config.RefreshRate); + yield return Timing.WaitForSeconds(MainPlugin.Instance.Config.LightRefreshRate); } } diff --git a/KruacentExiled/KE.Items/MainPlugin.cs b/KruacentExiled/KE.Items/MainPlugin.cs index 7cdf4877..b1698e18 100644 --- a/KruacentExiled/KE.Items/MainPlugin.cs +++ b/KruacentExiled/KE.Items/MainPlugin.cs @@ -1,4 +1,6 @@  +using Exiled.API.Enums; +using Exiled.API.Extensions; using Exiled.API.Features; using Exiled.API.Features.Pickups; using Exiled.API.Features.Toys; @@ -6,11 +8,18 @@ using Exiled.Events.EventArgs.Player; using KE.Items.Interface; using KE.Items.Lights; +using KE.Items.PickupModels; using KE.Items.Upgrade; +using KE.Utils.Quality; +using KE.Utils.Quality.Settings; +using KE.Utils.Quality.Tests; using MEC; +using PlayerRoles; +using PluginAPI.Roles; using System; using System.Collections.Generic; using System.Linq; +using UnityEngine; namespace KE.Items { @@ -22,39 +31,54 @@ public class MainPlugin : Plugin internal UpgradeHandler UpgradeHandler { get; private set; } internal LightsHandler LightsHandler { get; private set; } internal static MainPlugin Instance { get; private set; } - - public override Version Version => new Version(1, 0, 0); + internal PickupQuality PickupQuality { get; private set; } + internal QualityHandler QualityHandler { get; private set; } + + public override PluginPriority Priority => PluginPriority.Low; + public override Version Version => new (1, 0, 0); public override void OnEnabled() { Instance = this; Sound = new Sound(); + QualityHandler = QualityHandler.Instance; + QualityHandler.Register(); UpgradeHandler = new UpgradeHandler(); LightsHandler = new LightsHandler(); + //PickupQuality = new PickupQuality(); Sound.LoadClips(); + + + Exiled.Events.Handlers.Server.RoundStarted += Test; + + CustomItem.RegisterItems(); + PickupQuality?.SubscribeEvents(); UpgradeHandler.SubscribeEvents(); LightsHandler.SubscribeEvents(); - base.OnEnabled(); } public override void OnDisabled() { CustomItem.UnregisterItems(); - UpgradeHandler.UnsubscribeEvents(); - LightsHandler.UnsubscribeEvents(); - + UpgradeHandler?.UnsubscribeEvents(); + LightsHandler?.UnsubscribeEvents(); + PickupQuality?.UnsubscribeEvents(); + QualityHandler?.Unregister(); base.OnDisabled(); + QualityHandler = null; + PickupQuality = null; LightsHandler = null; Sound = null; UpgradeHandler = null; Instance = null; } + } } \ No newline at end of file diff --git a/KruacentExiled/KE.Items/PickupModels/PickupQuality.cs b/KruacentExiled/KE.Items/PickupModels/PickupQuality.cs new file mode 100644 index 00000000..e742ed8d --- /dev/null +++ b/KruacentExiled/KE.Items/PickupModels/PickupQuality.cs @@ -0,0 +1,132 @@ +using Exiled.API.Features; +using Exiled.API.Features.Pickups; +using Exiled.CustomItems.API.Features; +using InventorySystem.Items.Pickups; +using KE.Items.Interface; +using KE.Utils.Quality.Models; +using MEC; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Pickup = InventorySystem.Items.Pickups.ItemPickupBase; + + +namespace KE.Items.PickupModels +{ + internal class PickupQuality + { + public const float RefreshRate = .1f; + private readonly Dictionary pl = new (); + public void SubscribeEvents() + { + ItemPickupBase.OnPickupAdded += AddPickup; + ItemPickupBase.OnPickupDestroyed += DestroyPickup; + Exiled.Events.Handlers.Server.RoundStarted += OnRoundStarted; + } + + public void UnsubscribeEvents() + { + ItemPickupBase.OnPickupAdded -= AddPickup; + ItemPickupBase.OnPickupDestroyed -= DestroyPickup; + Exiled.Events.Handlers.Server.RoundStarted -= OnRoundStarted; + } + + private void OnRoundStarted() + { + Timing.RunCoroutine(ModelLoop()); + + } + + + private void AddPickup(ItemPickupBase pickup) + { + + if (CustomItem.TryGet(Exiled.API.Features.Pickups.Pickup.Get(pickup), out CustomItem cui) && cui is ICustomPickupModel ci) + { + pl.Add(pickup, null); + } + } + private void DestroyPickup(ItemPickupBase pickup) + { + + if (pickup == null) return; + + if (pl.ContainsKey(pickup)) + { + Model val = pl[pickup]; + val?.Destroy(); + pl.Remove(pickup); + } + } + + + + private IEnumerator ModelLoop() + { + while (true) + { + try + { + foreach (var x in pl.ToList()) + { + Pickup pickup = x.Key; + Model oldModel = x.Value; + if (pickup == null) + { + pl.Remove(x.Key); + continue; + } + if (CustomItem.TryGet(Exiled.API.Features.Pickups.Pickup.Get(pickup), out CustomItem cui) && cui is ICustomPickupModel ci) + { + if (ci.PickupModel == null) + { + continue; + } + ModelPrefab modelpre = ci.PickupModel; + + + + if (oldModel != null) + { + + if (oldModel.Prefab == ci.PickupModel && oldModel.Position == pickup.Position && oldModel.Rotation == pickup.Rotation) + { + continue; + } + oldModel.Destroy(); + + } + Model model = modelpre.Create(pickup.Position, pickup.Rotation); + + + pl[x.Key] = model; + } + else + { + Model val = x.Value; + val?.Destroy(); + pl.Remove(x.Key); + } + } + } + catch (Exception e) + { + Log.Error(e); + } + yield return Timing.WaitForSeconds(RefreshRate); + + } + + } + + + + + public static bool Check(Pickup pickup) + { + return CustomItem.TryGet(Exiled.API.Features.Pickups.Pickup.Get(pickup), out CustomItem item) && item is ICustomPickupModel; + } + } +} diff --git a/KruacentExiled/KE.Utils/Extensions/AdminToyExtension.cs b/KruacentExiled/KE.Utils/Extensions/AdminToyExtension.cs new file mode 100644 index 00000000..f20d74ab --- /dev/null +++ b/KruacentExiled/KE.Utils/Extensions/AdminToyExtension.cs @@ -0,0 +1,25 @@ +using Exiled.API.Features.Toys; +using KE.Utils.Quality; +using KE.Utils.Quality.Enums; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace KE.Utils.Extensions +{ + public static class AdminToyExtension + { + + public static void SetAsPickupAdminToy(this AdminToy toy, bool autoSync = true) + { + QualityHandler.Instance.QualityToysHandler.SetAsPickup(toy, autoSync); + } + + public static void SetQuality(this AdminToy toy, ModelQuality modelQuality,bool autoSync = true) + { + QualityHandler.Instance.QualityToysHandler.SetQuality(toy, modelQuality, autoSync); + } + } +} diff --git a/KruacentExiled/KE.Utils/Extensions/PlayerExtension.cs b/KruacentExiled/KE.Utils/Extensions/PlayerExtension.cs index fd6b85d9..b01f98d2 100644 --- a/KruacentExiled/KE.Utils/Extensions/PlayerExtension.cs +++ b/KruacentExiled/KE.Utils/Extensions/PlayerExtension.cs @@ -1,4 +1,6 @@ -using Exiled.API.Features; +using CustomPlayerEffects; +using Exiled.API.Enums; +using Exiled.API.Features; using Mirror; using System; using System.Collections.Generic; @@ -31,5 +33,20 @@ public static void SetFakeInvis(this Player p, IEnumerable viewers) } } + + + + public static void AddLevelEffect(this Player p,EffectType type, int intensity) + { + + + if (!p.TryGetEffect(type, out var effect)) + p.ChangeEffectIntensity(type, (byte)(effect.Intensity + intensity)); + else + p.EnableEffect(type, (byte)intensity); + } + + + } } diff --git a/KruacentExiled/KE.Utils/Quality/AdminToyQuality.cs b/KruacentExiled/KE.Utils/Quality/AdminToyQuality.cs deleted file mode 100644 index 7213baea..00000000 --- a/KruacentExiled/KE.Utils/Quality/AdminToyQuality.cs +++ /dev/null @@ -1,27 +0,0 @@ -using Exiled.API.Features.Toys; -using KE.Utils.Quality.Enums; -using System.Collections.Generic; - -namespace KE.Utils.Quality -{ - public static class QualityToysHandler - { - private static Dictionary _pickupPrimitives = new(); - private static Dictionary _qualityPrimitives= new(); - - public static bool IsPickupPrimitive(Primitive primitive) - { - return _pickupPrimitives.ContainsKey(primitive); - } - - public static bool IsQualityPrimitive(Primitive primitive) - { - return _qualityPrimitives.ContainsKey(primitive); - } - - - - - - } -} diff --git a/KruacentExiled/KE.Utils/Quality/Handlers/QualityToysHandler.cs b/KruacentExiled/KE.Utils/Quality/Handlers/QualityToysHandler.cs new file mode 100644 index 00000000..b2485795 --- /dev/null +++ b/KruacentExiled/KE.Utils/Quality/Handlers/QualityToysHandler.cs @@ -0,0 +1,179 @@ +using AdminToys; +using Exiled.API.Enums; +using Exiled.API.Extensions; +using Exiled.API.Features; +using Exiled.API.Features.Toys; +using KE.Utils.Quality.Enums; +using KE.Utils.Quality.Settings; +using MEC; +using System; +using System.Collections.Generic; +using System.Linq; +using UnityEngine; +using Light = Exiled.API.Features.Toys.Light; +using QualitySettings = KE.Utils.Quality.Settings.QualitySettings; + +namespace KE.Utils.Quality.Handlers +{ + public class QualityToysHandler + { + private HashSet _pickupToys = new(); + private Dictionary _qualityToys = new(); + public readonly Vector3 Gulag = new Vector3(15000, 15000, 15000); + public const float Delay = Timing.WaitForOneFrame; + public bool IsPickupToy(AdminToy primitive) + { + return _pickupToys.Contains(primitive); + } + + public bool IsQualityToy(AdminToy primitive) + { + return _qualityToys.ContainsKey(primitive); + } + + + public void SetAsPickup(AdminToy toy, bool autoSync = true) + { + if (!_pickupToys.Add(toy)) + { + Log.Warn($"AdminToy {toy} is already a pickupToy"); + return; + } + if (autoSync) + Sync(toy); + } + + public void SetQuality(AdminToy toy, ModelQuality quality, bool autoSync = true) + { + if (toy == null) return; + if (!_qualityToys.ContainsKey(toy)) + _qualityToys.Add(toy, quality); + else + _qualityToys[toy] = quality; + + if (autoSync) + Sync(toy); + } + + + + private void SendToFakePosition(AdminToy adminToy, Player player,Vector3 position) + { + //idk why but without delay it show all of the quality at once + Timing.CallDelayed(Delay, () => + { + if (adminToy is Light l) + { + player.SendFakeSyncVar(l.Base.netIdentity, typeof(LightSourceToy), nameof(LightSourceToy.NetworkPosition), position); + return; + } + if (adminToy is Primitive p) + { + player.SendFakeSyncVar(p.Base.netIdentity, typeof(PrimitiveObjectToy), nameof(PrimitiveObjectToy.NetworkPosition), position); + return; + } + }); + + } + + /// + /// Sync every Players + /// + public void Sync() + { + foreach (Player p in Player.List) + { + Sync(p); + } + } + + /// + /// Sync a specified Player + /// + /// + public void Sync(Player p) + { + + + + var quality = QualitySettings.Get(p); + var pickup = QualitySettings.PickmodelActivated(p); + + HashSet pickupToRemove = []; + HashSet qualityToRemove = []; + + //hide pickup toys + + foreach (AdminToy pk in _pickupToys) + { + try + { + if (pickup) + { + SendToFakePosition(pk, p, pk.Position); + } + else + { + SendToFakePosition(pk, p, Gulag); + } + } + catch (NullReferenceException) + { + //Log.Warn("removing pickup"); + pickupToRemove.Add(pk); + } + + } + + _pickupToys.RemoveWhere(p => pickupToRemove.Contains(p)); + + + foreach (var at in _qualityToys) + { + try + { + if ((at.Value == quality || at.Value == ModelQuality.None) && (pickup || !_pickupToys.Contains(at.Key))) + { + SendToFakePosition(at.Key, p, at.Key.Position); + } + else + { + SendToFakePosition(at.Key, p, Gulag); + } + } + catch (NullReferenceException) + { + //Log.Warn("removing quality" + _qualityToys.Count); + qualityToRemove.Add(at.Key); + } + + + } + foreach(var at in qualityToRemove) + { + + _qualityToys.Remove(at); + } + + } + + /// + /// Sync a specified AdminToy + /// + /// + public void Sync(AdminToy adminToy) + { + //temporary fix + Sync(); + + if (IsPickupToy(adminToy)) + { + + } + if (IsQualityToy(adminToy)) + { + + } + } + } +} diff --git a/KruacentExiled/KE.Utils/Quality/Models/Base/BaseModel.cs b/KruacentExiled/KE.Utils/Quality/Models/Base/BaseModel.cs new file mode 100644 index 00000000..c9f6723c --- /dev/null +++ b/KruacentExiled/KE.Utils/Quality/Models/Base/BaseModel.cs @@ -0,0 +1,41 @@ +using Exiled.API.Enums; +using Exiled.API.Extensions; +using Exiled.API.Features.Toys; +using Exiled.API.Interfaces; +using KE.Utils.Quality.Structs; +using PlayerStatsSystem; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using UnityEngine; +using Light = Exiled.API.Features.Toys.Light; + +namespace KE.Utils.Quality.Models.Base +{ + + /// + /// The blocks to build a model with + /// + public abstract class BaseModel : ICloneable + { + + protected AdminToy _toy; + public AdminToy AdminToy { get { return _toy; } } + private Vector3 _position; + public Vector3 LocalPosition { get { return _position; } } + private Quaternion _rotation; + public Quaternion LocalRotation { get { return _rotation; } } + + + public BaseModel(Vector3 localPositon, Quaternion localRotation) + { + _position = localPositon; + _rotation = localRotation; + } + + public abstract object Clone(); + } + +} diff --git a/KruacentExiled/KE.Utils/Quality/Models/Base/LightModel.cs b/KruacentExiled/KE.Utils/Quality/Models/Base/LightModel.cs new file mode 100644 index 00000000..ce808da1 --- /dev/null +++ b/KruacentExiled/KE.Utils/Quality/Models/Base/LightModel.cs @@ -0,0 +1,26 @@ +using Exiled.API.Features.Toys; +using UnityEngine; +using Light = Exiled.API.Features.Toys.Light; + +namespace KE.Utils.Quality.Models.Base +{ + public class LightModel : BaseModel + { + + /// + /// Create a new Light for modeling + /// + public LightModel(Vector3? scale, Color? color, Vector3 localPositon, Quaternion localRotation) : base(localPositon, localRotation) + { + Light light = Light.Create(null, null, scale, false, color); + _toy = light; + } + + + public override object Clone() + { + Light light = _toy as Light; + return new LightModel(light.Scale, light.Color, LocalPosition, LocalRotation); + } + } +} diff --git a/KruacentExiled/KE.Utils/Quality/Models/Base/PrimitiveModel.cs b/KruacentExiled/KE.Utils/Quality/Models/Base/PrimitiveModel.cs new file mode 100644 index 00000000..22e07225 --- /dev/null +++ b/KruacentExiled/KE.Utils/Quality/Models/Base/PrimitiveModel.cs @@ -0,0 +1,26 @@ +using Exiled.API.Features.Toys; +using UnityEngine; +using Color = UnityEngine.Color; + +namespace KE.Utils.Quality.Models.Base +{ + public class PrimitiveModel : BaseModel + { + /// + /// Create a new Primitive for modeling + /// + public PrimitiveModel(PrimitiveType type, Vector3? scale, Color? color,Vector3 localPosition,Quaternion localRotation) : base(localPosition, localRotation) + { + + Primitive prim = Primitive.Create(type, null, null, scale, false, color); + prim.Collidable = false; + _toy = prim; + } + + public override object Clone() + { + Primitive prim = _toy as Primitive; + return new PrimitiveModel(prim.Type, prim.Scale, prim.Color, LocalPosition, LocalRotation); + } + } +} diff --git a/KruacentExiled/KE.Utils/Quality/Models/Examples/MineModel.cs b/KruacentExiled/KE.Utils/Quality/Models/Examples/MineModel.cs new file mode 100644 index 00000000..00d60fec --- /dev/null +++ b/KruacentExiled/KE.Utils/Quality/Models/Examples/MineModel.cs @@ -0,0 +1,118 @@ +using KE.Utils.Quality.Enums; +using KE.Utils.Quality.Models.Base; +using System.Collections.Generic; +using UnityEngine; +using Light = Exiled.API.Features.Toys.Light; + +namespace KE.Utils.Quality.Models.Examples +{ + public abstract class MineModel : QualityModel + { + protected Light _light; + private bool _lightOn = false; + + + + + public void ToggleLight() + { + if (_light == null) throw new System.Exception("no light"); + if (_lightOn) + _light.UnSpawn(); + else + _light.Spawn(); + _lightOn = !_lightOn; + } + + } + + public class MineModelLow : MineModel + { + public override bool IsPickup => false; + public override ModelQuality Quality => ModelQuality.Low; + + protected override IEnumerable GetBaseModels() + { + Quaternion baseRotation = new(); + //spawn + offset + Vector3 offset = new Vector3(0, .05f); + Vector3 sizeDisk = new Vector3(.7f, 0.1f, .7f); + + Vector3 sizeGlobe = new Vector3(.1f, .1f, .1f); + Vector3 posLight = new Vector3(0, sizeDisk.y+sizeGlobe.y); + + + var baseMine = new PrimitiveModel(PrimitiveType.Cylinder, sizeDisk, Color.black, offset, baseRotation); + + var lightGlobe = new PrimitiveModel(PrimitiveType.Sphere, sizeGlobe , new Color(1, 0, 0, .33f), posLight, baseRotation); + + var lightMine = new LightModel(null, Color.red, posLight, baseRotation); + + _light = lightMine.AdminToy as Light; + _light.Intensity = .55f; + + return [baseMine, lightGlobe, lightMine]; + } + + + } + + public class MineModelMedium : MineModel + { + public override bool IsPickup => false; + public override ModelQuality Quality => ModelQuality.Medium; + + protected override IEnumerable GetBaseModels() + { + Quaternion baseRotation = new(); + //spawn + offset + Vector3 offset = new Vector3(0, .05f); + Vector3 sizeDisk = new Vector3(.7f, 0.1f, .7f); + + Vector3 sizeGlobe = new Vector3(.1f, .1f, .1f); + Vector3 posLight = new Vector3(0, sizeDisk.y + sizeGlobe.y); + + + var baseMine = new PrimitiveModel(PrimitiveType.Cylinder, sizeDisk, Color.black, offset, baseRotation); + + var lightGlobe = new PrimitiveModel(PrimitiveType.Sphere, sizeGlobe, new Color(1, 0, 0, .33f), posLight, baseRotation); + + var lightMine = new LightModel(null, Color.green, posLight, baseRotation); + + _light = lightMine.AdminToy as Light; + _light.Intensity = .55f; + + return [baseMine, lightGlobe, lightMine]; + } + } + + public class MineModelPickup : MineModel + { + public override bool IsPickup => true; + public override ModelQuality Quality => ModelQuality.None; + + + protected override IEnumerable GetBaseModels() + { + Quaternion baseRotation = new(); + //spawn + offset + Vector3 offset = new Vector3(0, .05f); + Vector3 sizeDisk = new Vector3(.7f, 0.1f, .7f); + + Vector3 sizeGlobe = new Vector3(.1f, .1f, .1f); + Vector3 posLight = new Vector3(0, sizeDisk.y + sizeGlobe.y); + + + var baseMine = new PrimitiveModel(PrimitiveType.Cylinder, sizeDisk, Color.black, offset, baseRotation); + + var lightGlobe = new PrimitiveModel(PrimitiveType.Sphere, sizeGlobe, new Color(1, 0, 0, .33f), posLight, baseRotation); + + var lightMine = new LightModel(null, Color.magenta, posLight, baseRotation); + + _light = lightMine.AdminToy as Light; + _light.Intensity = .55f; + + return [baseMine, lightGlobe, lightMine]; + } + } +} diff --git a/KruacentExiled/KE.Utils/Quality/Models/Model.cs b/KruacentExiled/KE.Utils/Quality/Models/Model.cs new file mode 100644 index 00000000..2e26756e --- /dev/null +++ b/KruacentExiled/KE.Utils/Quality/Models/Model.cs @@ -0,0 +1,104 @@ +using Exiled.API.Features; +using Exiled.API.Features.Toys; +using KE.Utils.Quality.Models.Base; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using UnityEngine; + +namespace KE.Utils.Quality.Models +{ + public class Model : IEquatable + { + + + private Vector3 _position; + public Vector3 Position + { + get { return _position; } + set + { + _position = value; + } + } + private Quaternion _rotation; + public Quaternion Rotation + { + get { return _rotation; } + set + { + _rotation = value; + } + } + private ModelPrefab _prefab; + public ModelPrefab Prefab + { + get { return _prefab; } + } + + + + private HashSet _models; + + internal Model(ModelPrefab prefab, Vector3 position, Quaternion rotation,IEnumerable toys,bool spawn) + { + _prefab = prefab; + Position = position; + Rotation = rotation; + _models = new HashSet(toys); + QualityHandler.Instance.QualityToysHandler.Sync(); + + foreach (BaseModel based in toys) + { + AdminToy toy = based.AdminToy; + + if (toy is Primitive p) + p.Collidable = false; + toy.AdminToyBase.transform.position = based.LocalPosition + Position; + toy.AdminToyBase.transform.rotation = based.LocalRotation * Rotation; + } + if(spawn) + { + Spawn(); + } + } + + + public void Destroy() + { + foreach (BaseModel primitive in _models) + { + primitive.AdminToy.Destroy(); + } + } + public void UnSpawn() + { + foreach (BaseModel primitive in _models) + { + primitive.AdminToy.UnSpawn(); + } + } + public void Spawn() + { + QualityHandler.Instance.QualityToysHandler.Sync(); + foreach (BaseModel primitive in _models) + { + primitive.AdminToy.Spawn(); + } + + } + + + public bool Equals(Model x) + { + if (x == null) return false; + return x._prefab == _prefab && x.Position == Position && x.Rotation == Rotation; + } + public int GetHashCode(Model obj) + { + return obj.GetHashCode(); + } + } +} diff --git a/KruacentExiled/KE.Utils/Quality/Models/ModelPrefab.cs b/KruacentExiled/KE.Utils/Quality/Models/ModelPrefab.cs new file mode 100644 index 00000000..bbc39da4 --- /dev/null +++ b/KruacentExiled/KE.Utils/Quality/Models/ModelPrefab.cs @@ -0,0 +1,42 @@ +using Exiled.API.Features; +using Exiled.API.Features.Core; +using Exiled.API.Features.Pickups; +using Exiled.API.Features.Toys; +using Exiled.API.Interfaces; +using KE.Utils.Extensions; +using KE.Utils.Quality.Models.Base; +using KE.Utils.Quality.Structs; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using UnityEngine; +using Light = Exiled.API.Features.Toys.Light; + +namespace KE.Utils.Quality.Models +{ + public abstract class ModelPrefab + { + + protected abstract IEnumerable GetBaseModels(); + + public virtual Model Create(Vector3 position,Quaternion rotation, bool spawn = true) + { + + HashSet clonetoys = new(); + HashSet toys = GetBaseModels().ToHashSet(); + foreach (BaseModel model in toys) + { + BaseModel clone = (BaseModel)model.Clone(); + clonetoys.Add(clone); + } + return new Model(this, position, rotation, clonetoys,spawn); + + } + + + + + } +} diff --git a/KruacentExiled/KE.Utils/Quality/Models/QualityModel.cs b/KruacentExiled/KE.Utils/Quality/Models/QualityModel.cs new file mode 100644 index 00000000..b5cc682f --- /dev/null +++ b/KruacentExiled/KE.Utils/Quality/Models/QualityModel.cs @@ -0,0 +1,40 @@ +using Exiled.API.Features; +using Exiled.API.Features.Toys; +using KE.Utils.Extensions; +using KE.Utils.Quality.Enums; +using KE.Utils.Quality.Models.Base; +using System.Collections.Generic; +using System.Linq; +using UnityEngine; + +namespace KE.Utils.Quality.Models +{ + public abstract class QualityModel : ModelPrefab + { + public abstract ModelQuality Quality { get; } + public abstract bool IsPickup { get; } + + + + + public override sealed Model Create(Vector3 position, Quaternion rotation,bool spawn = true) + { + + HashSet clonetoys = new(); + HashSet toys = GetBaseModels().ToHashSet(); + foreach (BaseModel model in toys) + { + BaseModel clone = (BaseModel)model.Clone(); + + if (IsPickup) + clone.AdminToy.SetAsPickupAdminToy(false); + + clone.AdminToy.SetQuality(Quality,false); + clonetoys.Add(clone); + } + QualityHandler.Sync(); + return new Model(this,position, rotation, clonetoys, spawn); + } + + } +} diff --git a/KruacentExiled/KE.Utils/Quality/QualityHandler.cs b/KruacentExiled/KE.Utils/Quality/QualityHandler.cs new file mode 100644 index 00000000..6c120824 --- /dev/null +++ b/KruacentExiled/KE.Utils/Quality/QualityHandler.cs @@ -0,0 +1,60 @@ +using Exiled.API.Features; +using Exiled.API.Features.Core.UserSettings; +using KE.Utils.Quality.Handlers; +using KE.Utils.Quality.Settings; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace KE.Utils.Quality +{ + public class QualityHandler + { + public QualitySettings QualitySettings { get; private set; } + public QualityToysHandler QualityToysHandler { get; private set; } + + private static QualityHandler _instance; + public static QualityHandler Instance + { + get + { + if(_instance == null ) + _instance = new QualityHandler(); + return _instance; + } + } + private QualityHandler() + { + QualitySettings = new QualitySettings(Changed); + QualityToysHandler = new QualityToysHandler(); + } + + ~QualityHandler() + { + QualityToysHandler = null; + QualitySettings = null; + } + + public void Changed(Player p, SettingBase _) + { + QualityToysHandler.Sync(p); + } + + public void Register() + { + QualitySettings.Register(); + } + + public void Unregister() + { + QualitySettings.Unregister(); + } + + public static void Sync() + { + Instance.QualityToysHandler.Sync(); + } + } +} diff --git a/KruacentExiled/KE.Utils/Quality/Settings/QualitySettings.cs b/KruacentExiled/KE.Utils/Quality/Settings/QualitySettings.cs index d4bdde5d..e783f945 100644 --- a/KruacentExiled/KE.Utils/Quality/Settings/QualitySettings.cs +++ b/KruacentExiled/KE.Utils/Quality/Settings/QualitySettings.cs @@ -5,40 +5,55 @@ using System; using System.Collections.Generic; using System.Linq; +using System.Runtime; using System.Text; using System.Threading.Tasks; using UserSettings.ServerSpecific; namespace KE.Utils.Quality.Settings { - internal class QualitySettings + public class QualitySettings { private static int _idQuality = 0; private static int _idModels = 1; - public QualitySettings() + private SettingBase[] _settings; + public QualitySettings(Action onChanged) { HeaderSetting header = new("Quality Settings"); - SettingBase[] settings = new SettingBase[] - { + _settings = + [ header, - new TwoButtonsSetting(_idQuality,"ModelQuality","Low","High"), - new TwoButtonsSetting(_idModels,"Pickup models","off","on") - }; - SettingBase.Register(settings); - SettingBase.SendToAll(); + new DropdownSetting(_idQuality,"ModelQuality",["Low","Medium", "High"],onChanged:onChanged), + new TwoButtonsSetting(_idModels,"Pickup models","Disabled","Enabled", onChanged:onChanged) + ]; + } - + internal void Register() + { + SettingBase.Register(_settings); + SettingBase.SendToAll(); + } + internal void Unregister() + { + SettingBase.Unregister(settings:_settings); } + + + public static ModelQuality Get(Player p) { - if (!SettingBase.TryGetSetting(p, _idQuality, out var setting)) return ModelQuality.None; - if (setting.IsSecond) - return ModelQuality.High; - else - return ModelQuality.Low; + if (!SettingBase.TryGetSetting(p, _idQuality, out var setting)) return ModelQuality.None; + + return setting.SelectedOption switch + { + "Low" => ModelQuality.Low, + "Medium" => ModelQuality.Medium, + "High" => ModelQuality.High, + _ => ModelQuality.None, + }; } diff --git a/KruacentExiled/KE.Utils/Quality/Structs/LocalWorldSpace.cs b/KruacentExiled/KE.Utils/Quality/Structs/LocalWorldSpace.cs new file mode 100644 index 00000000..d9c6205b --- /dev/null +++ b/KruacentExiled/KE.Utils/Quality/Structs/LocalWorldSpace.cs @@ -0,0 +1,23 @@ +using Exiled.API.Interfaces; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using UnityEngine; + +namespace KE.Utils.Quality.Structs +{ + public readonly struct LocalWorldSpace : IWorldSpace + { + + public Vector3 Position { get; } + public Quaternion Rotation { get; } + + public LocalWorldSpace(Vector3 position, Quaternion rotation) + { + Position = position; + Rotation = rotation; + } + } +} diff --git a/KruacentExiled/KE.Utils/Quality/Tests/Test.cs b/KruacentExiled/KE.Utils/Quality/Tests/Test.cs new file mode 100644 index 00000000..bd89470a --- /dev/null +++ b/KruacentExiled/KE.Utils/Quality/Tests/Test.cs @@ -0,0 +1,108 @@ +using Exiled.API.Extensions; +using Exiled.API.Features; +using Exiled.API.Features.Toys; +using KE.Utils.Quality.Models; +using KE.Utils.Quality.Models.Examples; +using MEC; +using PlayerRoles; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using UnityEngine; + +namespace KE.Utils.Quality.Tests +{ + public class Test + { + private QualityHandler QualityHandler; + + + public Test(QualityHandler q) + { + QualityHandler = q; + try + { + TestMine(); + } + catch (Exception ex) + { + Log.Error("Exception for TestMine :\n"+ex); + } + + } + internal void TestQuality() + { + Vector3 pos = RoleTypeId.Scp049.GetRandomSpawnLocation().Position; + Primitive c = Primitive.Create(pos); + c.Color = Color.red; + Primitive c2 = Primitive.Create(pos + Vector3.one); + c2.Color = Color.green; + + + QualityHandler.QualityToysHandler.SetQuality(c, Enums.ModelQuality.Low); + QualityHandler.QualityToysHandler.SetQuality(c2, Enums.ModelQuality.Medium); + } + + internal void StressTest(int count) + { + Timing.RunCoroutine(Stress(count)); + } + + + private IEnumerator Stress(int count) + { + Vector3 pos = RoleTypeId.Scp049.GetRandomSpawnLocation().Position; + Vector3 scale = new Vector3(.1f, .1f, .1f); + float maxSpread = 5; + for (int i = 0; i < count; i++) + { + Primitive c = Primitive.Create(pos + new Vector3(UnityEngine.Random.Range(0f, maxSpread), UnityEngine.Random.Range(0f, maxSpread), UnityEngine.Random.Range(0f, maxSpread)), scale: scale); + QualityHandler.QualityToysHandler.SetQuality(c, Enums.ModelQuality.Medium, false); + } + QualityHandler.QualityToysHandler.Sync(); + yield return 0; + } + + public void TestMine() + { + Log.Info("TestMine"); + Vector3 pos = RoleTypeId.Scp049.GetRandomSpawnLocation().Position; + MineModelLow mml = new(); + + + Model m = mml.Create(pos, new Quaternion()); + m.Spawn(); + + + MineModelMedium mmm = new(); + + m = mmm.Create(pos + Vector3.up, new Quaternion()); + m.Spawn(); + + + MineModelPickup mmp = new(); + m = mmp.Create(pos + Vector3.right, new Quaternion()); + m.Spawn(); + + QualityHandler.Sync(); + + + + + + + + + foreach (var item in Player.List) + { + item.Teleport(pos); + } + + + + + } + } +} From 7b062d3db6d59a79a5ab461809d1b1338d733cdc Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Wed, 4 Jun 2025 03:23:18 +0200 Subject: [PATCH 256/853] door almost done --- KruacentExiled/Map/Doors/DoorButton.cs | 41 +++++- .../Map/Doors/InteractiblePickup.cs | 121 ------------------ KruacentExiled/Map/Doors/KEDoor.cs | 87 ++++++++++--- .../Map/Doors/KEDoorTypes/KEDoorType.cs | 18 +++ .../Map/Doors/KEDoorTypes/NormalKEDoor.cs | 25 ++++ KruacentExiled/Map/KE.Map.csproj | 2 +- 6 files changed, 152 insertions(+), 142 deletions(-) delete mode 100644 KruacentExiled/Map/Doors/InteractiblePickup.cs create mode 100644 KruacentExiled/Map/Doors/KEDoorTypes/KEDoorType.cs create mode 100644 KruacentExiled/Map/Doors/KEDoorTypes/NormalKEDoor.cs diff --git a/KruacentExiled/Map/Doors/DoorButton.cs b/KruacentExiled/Map/Doors/DoorButton.cs index 63e3e8ed..772d3f16 100644 --- a/KruacentExiled/Map/Doors/DoorButton.cs +++ b/KruacentExiled/Map/Doors/DoorButton.cs @@ -2,6 +2,7 @@ using Exiled.API.Features.Toys; using Exiled.API.Interfaces; using Exiled.Events.EventArgs.Player; +using KE.Map.Utils; using System; using System.Collections.Generic; using System.Linq; @@ -16,20 +17,50 @@ internal class DoorButton : IWorldSpace public Vector3 Position { get; } public Quaternion Rotation { get; } - private InteractiblePickup _ipickup; + public bool IsOpen + { + get + { + return isOpen; + } + set + { + isOpen = value; + UpdateColor(); + } + } + private bool isOpen; + + internal InteractiblePickup _ipickup { get; } + private Primitive _primitive; internal DoorButton(Vector3 position,Quaternion rotation) { Position = position; Rotation = rotation; - _ipickup = new(ItemType.Medkit, Position,Vector3.one, Rotation,false); + _ipickup = new(ItemType.Medkit, Position, Vector3.one,0, Rotation, false); - Primitive pr = Primitive.Create(PrimitiveType.Cube, Position, null, _ipickup.GetPickupTrueSize() + new Vector3(.1f, .1f, .1f)); - pr.Collidable = false; + _primitive = Primitive.Create(PrimitiveType.Cube, Position, null, _ipickup.GetPickupTrueSize() + new Vector3(.1f, .1f, .1f)); + _primitive.Collidable = false; } + public void Destroy() + { + _primitive.Destroy(); + _ipickup.Destroy(); + } - + private void UpdateColor() + { + if (isOpen) + { + _primitive.Color = Color.red; + } + else + { + _primitive.Color = Color.green; + } + } } } diff --git a/KruacentExiled/Map/Doors/InteractiblePickup.cs b/KruacentExiled/Map/Doors/InteractiblePickup.cs deleted file mode 100644 index 2725b647..00000000 --- a/KruacentExiled/Map/Doors/InteractiblePickup.cs +++ /dev/null @@ -1,121 +0,0 @@ -using Exiled.API.Features.Pickups; -using Exiled.API.Interfaces; -using Exiled.Events.EventArgs.Player; -using InventorySystem.Items.Pickups; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using UnityEngine; - -namespace KE.Map.Doors -{ - public class InteractiblePickup - { - private HashSet _actions; - private ushort _pickupSerial; - private Pickup _pickup; - private InteractiblePickup(Pickup pickup) - { - _pickupSerial = pickup.Serial; - _pickup = pickup; - SubscribeEvent(); - } - - private InteractiblePickup(Pickup pickup,Vector3 sizePickup) - { - _pickup = pickup; - _pickupSerial = pickup.Serial; - PickupSyncInfo info = pickup.Base.NetworkInfo; - pickup.Scale = sizePickup; - pickup.Base.NetworkInfo = info; - pickup.Base.GetComponent().isKinematic = true; - SubscribeEvent(); - } - - - public InteractiblePickup(ItemType itemType, Vector3 position, Vector3 scalePickup, Quaternion? rotation,bool useGravity = false) - { - var pickup = Pickup.CreateAndSpawn(itemType, position, rotation); - _pickup = pickup; - pickup.Rigidbody.useGravity = useGravity; - pickup.Rigidbody.detectCollisions = false; - - - _pickupSerial = pickup.Serial; - PickupSyncInfo info = pickup.Base.NetworkInfo; - pickup.Scale = scalePickup; - pickup.Base.NetworkInfo = info; - pickup.Base.GetComponent().isKinematic = true; - - SubscribeEvent(); - } - - - - - - ~InteractiblePickup() - { - Exiled.Events.Handlers.Player.PickingUpItem -= OnPickingUpItem; - } - - private void SubscribeEvent() - { - Exiled.Events.Handlers.Player.PickingUpItem += OnPickingUpItem; - } - - public bool AddAction(Action a) - { - return _actions.Add(a); - } - - public void OnPickingUpItem(PickingUpItemEventArgs ev) - { - if (ev.Pickup.Serial != _pickupSerial) return; - ev.IsAllowed = false; - - foreach (var action in _actions) - { - action?.Invoke(); - } - } - - public static Vector3 GetPickupTrueSize(Pickup pickup) - { - if (pickup?.GameObject == null) - return Vector3.zero; - - Renderer renderer = pickup.GameObject.GetComponentInChildren(); - Collider collider = pickup.GameObject.GetComponentInChildren(); - - if (renderer != null) - return renderer.bounds.size; - - if (collider != null) - return collider.bounds.size; - - return Vector3.zero; - } - - public Vector3 GetPickupTrueSize() - { - if (_pickup.GameObject == null) - return Vector3.zero; - - Renderer renderer = _pickup.GameObject.GetComponentInChildren(); - Collider collider = _pickup.GameObject.GetComponentInChildren(); - - if (renderer != null) - return renderer.bounds.size; - - if (collider != null) - return collider.bounds.size; - - return Vector3.zero; - } - } - - -} diff --git a/KruacentExiled/Map/Doors/KEDoor.cs b/KruacentExiled/Map/Doors/KEDoor.cs index bff2c65f..343d1f26 100644 --- a/KruacentExiled/Map/Doors/KEDoor.cs +++ b/KruacentExiled/Map/Doors/KEDoor.cs @@ -1,12 +1,16 @@ using Exiled.API.Extensions; using Exiled.API.Features; using Exiled.API.Features.Doors; +using Exiled.API.Features.Items; using Exiled.API.Features.Pickups; +using Exiled.API.Features.Toys; using Exiled.API.Interfaces; using Exiled.Events; using Exiled.Events.EventArgs.Player; using Interactables.Interobjects.DoorUtils; using InventorySystem.Items.Pickups; +using KE.Map.Doors.KEDoorTypes; +using KE.Map.Utils; using MEC; using System; using System.Collections.Generic; @@ -18,17 +22,38 @@ namespace KE.Map.Doors { - public class KEDoor : IWorldSpace + public class KEDoor : IWorldSpace, IDoorPermissionRequester { + + internal static readonly HashSet _list = new(); + + public static HashSet List => new(_list); + + + public string RequesterLogSignature + { + get + { + return ""; + } + } + public DoorPermissionsPolicy PermissionsPolicy { get; } = new(DoorPermissionFlags.ContainmentLevelTwo, true); + public Vector3 Position { get; } public Quaternion Rotation { get; } //0 -> closed ; 1 -> open private float _exactState =0f; - private DoorButton[] _buttons = new DoorButton[2]; + private DoorButton _button; //interacting door private InteractiblePickup _pickup; - public KEDoor OtherDoor { get; set; } - KeycardPermissions KeycardPermissions { get; set; } = KeycardPermissions.None; + private CoroutineHandle _handle; + private KEDoorType _doorType; + public KEDoor OtherDoor + { + get { return _otherDoor; } + } + + private KEDoor _otherDoor; public bool IsOpen { get { return _exactState == 1f; } @@ -40,37 +65,69 @@ public bool IsOpen private KEDoor(Vector3 position, Quaternion rotation) { + _list.Add(this); Position = position; Rotation = rotation; - _buttons[0] = new(position, rotation); - _buttons[1] = new(position, rotation); + _button = new(position+position* rotation.eulerAngles.y, rotation); } - public static void Create(Vector3 position,Quaternion rotation) + public static KEDoor Create(KEDoorType doorType, Vector3 position,Quaternion rotation) { KEDoor door = new(position,rotation); - door._pickup = new(ItemType.Medkit,position,Vector3.one,null,false); + door._doorType = doorType ?? new NormalKEDoor(); + door._doorType.Spawn(position,rotation); + + door._pickup = new(ItemType.Medkit,position,Vector3.one,0,null,false); + door._pickup.AddAction(door.UsingDoor); - door._pickup.AddAction(door.ChangeDoorState); + door._button._ipickup.AddAction(door.UsingDoor); + door._button.IsOpen = door.IsOpen; + + door._handle = Timing.RunCoroutine(door.Detect()); + return door; } + + public void Destroy() + { + Timing.KillCoroutines(_handle); + _button.Destroy(); + _pickup.Destroy(); + + } + + + public void UsingDoor(Player player) { - if (!IsOpen) return; - if(OtherDoor == null) return; - - + Log.Debug("using door"); + bool flag = PermissionsPolicy.CheckPermissions(player.ReferenceHub, this, out PermissionUsed callback); + if(flag) + ChangeDoorState(); } - public void ChangeDoorState() + public IEnumerator Detect() { - IsOpen = !IsOpen; + + + yield return Timing.WaitForOneFrame; } + public void ChangeDoorState() + { + + IsOpen = !IsOpen; + _button.IsOpen = IsOpen; + } + public void LinkOtherDoor(KEDoor otherDoor) + { + otherDoor._otherDoor = this; + _otherDoor = otherDoor; + } } } diff --git a/KruacentExiled/Map/Doors/KEDoorTypes/KEDoorType.cs b/KruacentExiled/Map/Doors/KEDoorTypes/KEDoorType.cs new file mode 100644 index 00000000..c8e9f7d6 --- /dev/null +++ b/KruacentExiled/Map/Doors/KEDoorTypes/KEDoorType.cs @@ -0,0 +1,18 @@ +using Exiled.API.Features.Toys; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using UnityEngine; + +namespace KE.Map.Doors.KEDoorTypes +{ + public abstract class KEDoorType + { + + + public abstract IEnumerable Spawn(Vector3 position, Quaternion rotation); + + } +} diff --git a/KruacentExiled/Map/Doors/KEDoorTypes/NormalKEDoor.cs b/KruacentExiled/Map/Doors/KEDoorTypes/NormalKEDoor.cs new file mode 100644 index 00000000..7dc43724 --- /dev/null +++ b/KruacentExiled/Map/Doors/KEDoorTypes/NormalKEDoor.cs @@ -0,0 +1,25 @@ +using Exiled.API.Features.Toys; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using UnityEngine; + +namespace KE.Map.Doors.KEDoorTypes +{ + public class NormalKEDoor : KEDoorType + { + public override IEnumerable Spawn(Vector3 position, Quaternion rotation) + { + + + + return new HashSet() + { + Primitive.Create(PrimitiveType.Cube,position,rotation.eulerAngles), + }; + + } + } +} diff --git a/KruacentExiled/Map/KE.Map.csproj b/KruacentExiled/Map/KE.Map.csproj index 13f8cb7a..25e3c97c 100644 --- a/KruacentExiled/Map/KE.Map.csproj +++ b/KruacentExiled/Map/KE.Map.csproj @@ -6,7 +6,7 @@ - + From 4767c968e8bc8b39b7e0fedfeda4722b3a099de5 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Wed, 4 Jun 2025 03:24:34 +0200 Subject: [PATCH 257/853] Gambling zone done except the models --- .../Map/GamblingZone/DroppableItem.cs | 16 +- .../Map/GamblingZone/GamblingRoom.cs | 95 ++++++++---- KruacentExiled/Map/GamblingZone/LootTable.cs | 12 +- .../Map/GamblingZone/OldGamblingRoom.cs | 97 ++++++++++++ KruacentExiled/Map/MainPlugin.cs | 70 ++++++++- .../Map/Quality/SendFakePrimitives.cs | 3 +- .../Map/Utils/InteractiblePickup.cs | 140 ++++++++++++++++++ 7 files changed, 390 insertions(+), 43 deletions(-) create mode 100644 KruacentExiled/Map/GamblingZone/OldGamblingRoom.cs create mode 100644 KruacentExiled/Map/Utils/InteractiblePickup.cs diff --git a/KruacentExiled/Map/GamblingZone/DroppableItem.cs b/KruacentExiled/Map/GamblingZone/DroppableItem.cs index 0a5e7b4b..56dbc332 100644 --- a/KruacentExiled/Map/GamblingZone/DroppableItem.cs +++ b/KruacentExiled/Map/GamblingZone/DroppableItem.cs @@ -8,10 +8,12 @@ using UnityEngine; using Exiled.API.Features; using Exiled.API.Features.Pickups; +using Exiled.API.Features.Toys; +using KE.Map.Utils; -namespace Map.GamblingZone +namespace KE.Map.GamblingZone { - internal class DroppableItem + public class DroppableItem : IEquatable { private ItemType _item; internal ItemType Item { get { return _item; } } @@ -31,7 +33,7 @@ internal int Chance internal int ItemCap { get { return _itemCap; } - set { _itemCap = value; } + set { _itemCap = value; } } private int _currentCap = 0; @@ -44,12 +46,18 @@ internal int CurrentCap - internal DroppableItem(ItemType item, int chance,int itemCap = -1) + internal DroppableItem(ItemType item, int chance, int itemCap = -1) { + _item = item; Chance = chance; ItemCap = itemCap; } + public static implicit operator DroppableItem(ItemType d) => new(d,1,-1); + public bool Equals(DroppableItem other) + { + return other.Item == Item && other.Chance == Chance && other.ItemCap == this.ItemCap && this.CurrentCap == other.CurrentCap; + } internal Items GetItem() { diff --git a/KruacentExiled/Map/GamblingZone/GamblingRoom.cs b/KruacentExiled/Map/GamblingZone/GamblingRoom.cs index 13cb5608..f373fa05 100644 --- a/KruacentExiled/Map/GamblingZone/GamblingRoom.cs +++ b/KruacentExiled/Map/GamblingZone/GamblingRoom.cs @@ -1,55 +1,100 @@ -using Exiled.API.Extensions; -using Exiled.API.Features; +using Exiled.API.Features; +using Exiled.API.Features.Doors; using Exiled.API.Features.Items; -using Exiled.API.Features.Spawn; -using Exiled.Events.EventArgs.Player; -using PlayerRoles; -using PluginAPI.Roles; +using Exiled.API.Features.Toys; +using KE.Map.Utils; using System.Collections.Generic; -using System.Linq; using UnityEngine; -namespace Map.GamblingZone +namespace KE.Map.GamblingZone { public class GamblingRoom { - internal static HashSet List { get; }= new HashSet(); + private static readonly HashSet _list = new HashSet(); + public static HashSet List => new(_list); - private Room _room; + + + private HashSet _model; + private float _pickupTime = 30; + private InteractiblePickup _pickup; + private Vector3 _position; + private Vector3 _scale; private LootTable _lootTable; - internal GamblingRoom(Room room, LootTable lootTable) + internal GamblingRoom(Room room, LootTable lootTable, Vector3? offset = null) + { + Init(room.Position, lootTable, offset); + } + + + internal GamblingRoom(Door door, LootTable lootTable, Vector3? offset = null) + { + Init(door.Position, lootTable,offset); + } + + internal GamblingRoom(Vector3 position, LootTable lootTable, Vector3? offset = null) { - _room = room; - List.Add(this); + Init(position, lootTable, offset); + } + + + + private void Init(Vector3 position,LootTable lootTable,Vector3? offset = null) + { + + + + Log.Debug("position w/out offset "+position); + _position = position + (offset ?? new Vector3()); + Log.Debug("position w/ offset "+_position); + _list.Add(this); + + _pickup = new InteractiblePickup(ItemType.Medkit, _position+ Vector3.up, new Vector3(1,0,1)*3, _pickupTime, new()); + + _pickup.AddAction(OnPickup); + + CreateModel(_position); _lootTable = lootTable; } - public bool IsInGamblingRoom(Player p) + + private void CreateModel(Vector3 positionWithOffset) { - return _room.Players.Contains(p); + _model = new() + { + Primitive.Create(PrimitiveType.Sphere,positionWithOffset,null,null,true,Color.red), + Primitive.Create(PrimitiveType.Cube,positionWithOffset,null,new(2,.5f,2),true) + }; + foreach(Primitive p in _model) + { + p.Collidable = true; + } } + public void SubscribeEvents() { - Exiled.Events.Handlers.Player.DroppedItem += OnDropped; + } public void UnsubscribeEvents() { - Exiled.Events.Handlers.Player.DroppedItem -= OnDropped; + foreach (Primitive p in _model) + { + p.Destroy(); + } + _pickup.Destroy(); } - public void OnDropped(DroppedItemEventArgs ev) + public void OnPickup(Player player) { - if (ev.Player == null) return; - if(ev.Pickup == null) return; - if (Vector3.Distance(ev.Player.Position, _room.Position) > 8.2f) return; - if (!IsInGamblingRoom(ev.Player)) return; - ev.Pickup.Destroy(); + if (player.CurrentItem == null) return; + if (player == null) return; Item item = _lootTable.GetRandomItem(); - ev.Player.AddItem(item); - ev.Player.DropItem(item); + player.CurrentItem.Destroy(); + player.AddItem(item); + player.DropItem(item,false); } } } diff --git a/KruacentExiled/Map/GamblingZone/LootTable.cs b/KruacentExiled/Map/GamblingZone/LootTable.cs index da25b701..eb72ae01 100644 --- a/KruacentExiled/Map/GamblingZone/LootTable.cs +++ b/KruacentExiled/Map/GamblingZone/LootTable.cs @@ -8,7 +8,7 @@ using System.Threading.Tasks; using UnityEngine; -namespace Map.GamblingZone +namespace KE.Map.GamblingZone { internal class LootTable { @@ -16,15 +16,15 @@ internal class LootTable { new(ItemType.Jailbird,5,1), new(ItemType.ParticleDisruptor,5,1), - new(ItemType.Radio,15,-1), + new(ItemType.Radio,15), }; public LootTable() { } - public LootTable(HashSet items) + public LootTable(IEnumerable items) { - _items = items; + _items = items.ToHashSet(); } private DroppableItem ChooseRandomItem() @@ -32,7 +32,7 @@ private DroppableItem ChooseRandomItem() int totalWeight = 0; foreach (DroppableItem drop in _items) { - if(!drop.HasReachCap()) + if (!drop.HasReachCap()) totalWeight += drop.Chance; } @@ -44,7 +44,7 @@ private DroppableItem ChooseRandomItem() foreach (DroppableItem drop in _items) { - if(!drop.HasReachCap()) + if (!drop.HasReachCap()) cumulativeSum += drop.Chance; if (randValue < cumulativeSum) return drop; diff --git a/KruacentExiled/Map/GamblingZone/OldGamblingRoom.cs b/KruacentExiled/Map/GamblingZone/OldGamblingRoom.cs new file mode 100644 index 00000000..eda1d2b2 --- /dev/null +++ b/KruacentExiled/Map/GamblingZone/OldGamblingRoom.cs @@ -0,0 +1,97 @@ +using Exiled.API.Extensions; +using Exiled.API.Features; +using Exiled.API.Features.Doors; +using Exiled.API.Features.Items; +using Exiled.API.Features.Pickups; +using Exiled.API.Features.Spawn; +using Exiled.API.Features.Toys; +using Exiled.Events.EventArgs.Player; +using PlayerRoles; +using System.Collections.Generic; +using System.Linq; +using UnityEngine; + +namespace KE.Map.GamblingZone +{ + public class OldGamblingRoom + { + private static readonly HashSet _list = new HashSet(); + public static HashSet List => new(_list); + + + private Vector3 _position; + private Vector3 _scale; + private LootTable _lootTable; + + internal OldGamblingRoom(Room room,Vector3 scale, LootTable lootTable, Vector3? offset = null) + { + Init(room.Position, scale, lootTable, offset); + } + + + internal OldGamblingRoom(Door door, Vector3 scale, LootTable lootTable, Vector3? offset = null) + { + Init(door.Position, scale, lootTable,offset); + } + + internal OldGamblingRoom(Vector3 position, Vector3 scale, LootTable lootTable, Vector3? offset = null) + { + Init(position, scale, lootTable, offset); + } + + + + private void Init(Vector3 position, Vector3 scale,LootTable lootTable,Vector3? offset = null) + { + Log.Debug("position w/out offset "+position); + _position = position + (offset ?? new Vector3()); + Log.Debug("position w/ offset "+_position); + _scale = scale; + _list.Add(this); + _lootTable = lootTable; + if (MainPlugin.Instance.Config.Debug) + { + var p = Primitive.Create(PrimitiveType.Cube, _position, null, _scale); + p.Collidable = false; + } + } + + public bool IsInGamblingRoom(Player p) + { + Vector3 playerPosition = p.Position; + Vector3 halfSize = _scale / 2; + return playerPosition.x >= _position.x - halfSize.x && + playerPosition.x <= _position.x + halfSize.x && + playerPosition.y >= _position.y - halfSize.y && + playerPosition.y <= _position.y + halfSize.y && + playerPosition.z >= _position.z - halfSize.z && + playerPosition.z <= _position.z + halfSize.z; + } + + public void SubscribeEvents() + { + Exiled.Events.Handlers.Player.DroppedItem += OnDropped; + } + public void UnsubscribeEvents() + { + Exiled.Events.Handlers.Player.DroppedItem -= OnDropped; + } + + + public void OnDropped(DroppedItemEventArgs ev) + { + Player player = ev.Player; + if (player == null) return; + if (ev.Pickup == null) return; + if (!IsInGamblingRoom(player)) + { + Log.Debug($"player ({player.CustomName}) not in room ({player.Position})"); + return; + } + ev.Pickup.Destroy(); + Item item = _lootTable.GetRandomItem(); + player.AddItem(item); + player.DropItem(item); + } + } +} diff --git a/KruacentExiled/Map/MainPlugin.cs b/KruacentExiled/Map/MainPlugin.cs index 9c077c66..d714a2f6 100644 --- a/KruacentExiled/Map/MainPlugin.cs +++ b/KruacentExiled/Map/MainPlugin.cs @@ -1,10 +1,18 @@  +using Exiled.API.Extensions; using Exiled.API.Features; +using Exiled.API.Features.Doors; +using Exiled.API.Features.Roles; using Exiled.API.Interfaces; using Exiled.Events.EventArgs.Player; using Exiled.Events.EventArgs.Server; -using KE.Map.Quality; -using Map.GamblingZone; +using Interactables.Interobjects.DoorUtils; +using KE.Map.Doors; +using KE.Map.GamblingZone; +using KE.Map.Utils; +using PlayerRoles; +using System.Collections.Generic; +using UnityEngine; namespace KE.Map { @@ -15,7 +23,7 @@ public override void OnEnabled() { Exiled.Events.Handlers.Map.Generated += OnGenerated; Exiled.Events.Handlers.Server.RoundEnded += OnRoundEnded; - Exiled.Events.Handlers.Server.RoundStarted += SendFakePrimitives.Join; + //Exiled.Events.Handlers.Server.RoundStarted += SendFakePrimitives.Join; Instance = this; } @@ -24,25 +32,75 @@ public override void OnDisabled() { Exiled.Events.Handlers.Map.Generated -= OnGenerated; Exiled.Events.Handlers.Server.RoundEnded -= OnRoundEnded; - Exiled.Events.Handlers.Server.RoundStarted -= SendFakePrimitives.Join; + //Exiled.Events.Handlers.Server.RoundStarted -= SendFakePrimitives.Join; Instance = null; } + + private void OnGenerated() { - var l = new LootTable(); - var g = new GamblingRoom(Room.Get(Exiled.API.Enums.RoomType.Lcz173), l); + Door lcz173 = Door.Get(Exiled.API.Enums.DoorType.Scp173Gate); + HashSet normal = new() + { + new(ItemType.KeycardO5,1,2), + new(ItemType.SCP500,1), + new(ItemType.KeycardMTFCaptain,1), + new(ItemType.SCP268,1), + new(ItemType.GunCOM15,1), + new(ItemType.SCP207,1), + new(ItemType.Adrenaline,1), + new(ItemType.GunCOM18,1), + new(ItemType.KeycardFacilityManager,1), + new(ItemType.Medkit,1), + new(ItemType.KeycardMTFOperative,1), + ItemType.KeycardGuard, + ItemType.Radio, + ItemType.Ammo9x19, + ItemType.Ammo44cal, + ItemType.Ammo12gauge, + ItemType.Ammo556x45, + ItemType.Ammo762x39, + ItemType.GrenadeFlash, + ItemType.KeycardScientist, + ItemType.KeycardJanitor, + ItemType.Coin, + ItemType.Jailbird, + ItemType.Flashlight, + ItemType.AntiSCP207, + ItemType.ParticleDisruptor, + ItemType.GunCom45, + ItemType.GunShotgun, + ItemType.GunRevolver, + ItemType.GunA7, + }; + + + var g = new GamblingRoom(lcz173, new(normal), -lcz173.Transform.forward * 5f); + g.SubscribeEvents(); + lcz173.RequiredPermissions = DoorPermissionFlags.All; + + + var door = KEDoor.Create(null,RoleTypeId.Scp049.GetRandomSpawnLocation().Position, new()); + + var d2 =KEDoor.Create(null,RoleTypeId.Scp049.GetRandomSpawnLocation().Position+Vector3.forward*2, new()); + + door.LinkOtherDoor(d2); + } private void OnRoundEnded(RoundEndedEventArgs ev) { foreach (var g in GamblingRoom.List) g.UnsubscribeEvents(); + + foreach (var g in OldGamblingRoom.List) + g.UnsubscribeEvents(); } } diff --git a/KruacentExiled/Map/Quality/SendFakePrimitives.cs b/KruacentExiled/Map/Quality/SendFakePrimitives.cs index 838bd8eb..f98aabd2 100644 --- a/KruacentExiled/Map/Quality/SendFakePrimitives.cs +++ b/KruacentExiled/Map/Quality/SendFakePrimitives.cs @@ -7,12 +7,11 @@ using InventorySystem.Items.Pickups; using Mirror; using PlayerRoles; -using PluginAPI.Roles; using System; using System.Collections.Generic; using UnityEngine; -namespace KE.Map.Quality +namespace KE.Map.Utils { internal class SendFakePrimitives { diff --git a/KruacentExiled/Map/Utils/InteractiblePickup.cs b/KruacentExiled/Map/Utils/InteractiblePickup.cs new file mode 100644 index 00000000..bf4625e5 --- /dev/null +++ b/KruacentExiled/Map/Utils/InteractiblePickup.cs @@ -0,0 +1,140 @@ +using Exiled.API.Features; +using Exiled.API.Features.Pickups; +using Exiled.API.Interfaces; +using Exiled.Events.EventArgs.Player; +using InventorySystem.Items.Pickups; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using UnityEngine; + +namespace KE.Map.Utils +{ + public class InteractiblePickup + { + private HashSet> _actions = new(); + private ushort _pickupSerial; + private Pickup _pickup; + private InteractiblePickup(Pickup pickup) + { + _pickupSerial = pickup.Serial; + _pickup = pickup; + SubscribeEvent(); + } + + private InteractiblePickup(Pickup pickup, Vector3 sizePickup) + { + _pickup = pickup; + _pickupSerial = pickup.Serial; + PickupSyncInfo info = pickup.Base.NetworkInfo; + pickup.Scale = sizePickup; + pickup.Base.NetworkInfo = info; + pickup.Base.GetComponent().isKinematic = true; + SubscribeEvent(); + } + + + public InteractiblePickup(ItemType itemType, Vector3 position, Vector3 scalePickup,float? pickupTime, Quaternion? rotation, bool useGravity = false) + { + var pickup = Pickup.CreateAndSpawn(itemType, position, rotation); + _pickup = pickup; + + _pickup.Weight = pickupTime ?? 0; + pickup.Rigidbody.useGravity = useGravity; + pickup.Rigidbody.detectCollisions = false; + + Renderer renderer = pickup.GameObject.GetComponentInChildren(); + renderer.forceRenderingOff = true; + + _pickupSerial = pickup.Serial; + PickupSyncInfo info = pickup.Base.NetworkInfo; + pickup.Scale = scalePickup; + pickup.Base.NetworkInfo = info; + pickup.Base.GetComponent().isKinematic = true; + + SubscribeEvent(); + } + + public void Destroy() + { + UnsubscribEvent(); + _actions = null; + _pickup.Destroy(); + } + + + + ~InteractiblePickup() + { + UnsubscribEvent(); + } + + private void UnsubscribEvent() + { + Exiled.Events.Handlers.Player.PickingUpItem -= OnPickingUpItem; + } + + private void SubscribeEvent() + { + Exiled.Events.Handlers.Player.PickingUpItem += OnPickingUpItem; + } + + public bool AddAction(Action a) + { + return _actions.Add(a); + } + + public void OnPickingUpItem(PickingUpItemEventArgs ev) + { + if (ev.Pickup.Serial != _pickupSerial) return; + ev.IsAllowed = false; + + foreach (var action in _actions) + { + action?.Invoke(ev.Player); + } + } + + public static Vector3 GetPickupTrueSize(Pickup pickup) + { + if (pickup?.GameObject == null) + return Vector3.zero; + + Renderer renderer = pickup.GameObject.GetComponentInChildren(); + Collider collider = pickup.GameObject.GetComponentInChildren(); + + + if (renderer != null) + return renderer.bounds.size; + + if (collider != null) + return collider.bounds.size; + + return Vector3.zero; + } + + public Vector3 GetPickupTrueSize() + { + if (_pickup.GameObject == null) + return Vector3.zero; + + Renderer renderer = _pickup.GameObject.GetComponentInChildren(); + Collider collider = _pickup.GameObject.GetComponentInChildren(); + + if (renderer != null) + return renderer.bounds.size; + + if (collider != null) + return collider.bounds.size; + + return Vector3.zero; + } + + + + } + + +} From 7f83777b0d63903f0dc2774b646985fae1a56e1a Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Wed, 4 Jun 2025 03:32:06 +0200 Subject: [PATCH 258/853] scrapped the pickup model and quality : technically not impossible but still not feasible for now --- KruacentExiled/KE.Items/KECustomItem.cs | 7 - KruacentExiled/KE.Items/MainPlugin.cs | 10 +- .../KE.Items/PickupModels/PickupQuality.cs | 1 + .../KE.Utils/Extensions/AdminToyExtension.cs | 4 +- .../KE.Utils/Quality/QualityHandler.cs | 3 +- .../KE.Utils/Quality/QualityToysHandler.cs | 155 ++++++++++++++++++ .../Quality/Settings/QualitySettings.cs | 4 +- KruacentExiled/KE.Utils/Quality/Tests/Test.cs | 2 +- 8 files changed, 172 insertions(+), 14 deletions(-) create mode 100644 KruacentExiled/KE.Utils/Quality/QualityToysHandler.cs diff --git a/KruacentExiled/KE.Items/KECustomItem.cs b/KruacentExiled/KE.Items/KECustomItem.cs index 94de735e..508a7d72 100644 --- a/KruacentExiled/KE.Items/KECustomItem.cs +++ b/KruacentExiled/KE.Items/KECustomItem.cs @@ -1,16 +1,9 @@ using Exiled.API.Features; -using Exiled.API.Features.Items; using Exiled.CustomItems; using Exiled.CustomItems.API.Features; using KE.Items.Interface; using KE.Utils.Display; using KE.Utils.Display.Enums; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using System.Xml.Linq; namespace KE.Items { diff --git a/KruacentExiled/KE.Items/MainPlugin.cs b/KruacentExiled/KE.Items/MainPlugin.cs index b1698e18..09bf1004 100644 --- a/KruacentExiled/KE.Items/MainPlugin.cs +++ b/KruacentExiled/KE.Items/MainPlugin.cs @@ -51,7 +51,7 @@ public override void OnEnabled() - Exiled.Events.Handlers.Server.RoundStarted += Test; + //Exiled.Events.Handlers.Server.RoundStarted += Test; CustomItem.RegisterItems(); @@ -80,5 +80,13 @@ public override void OnDisabled() } + + private void TestQuality() + { + /*Vector3 pos = + Primitive c = Primitive.Create() + + QualityHandler.QualityToysHandler.SetQuality()*/ + } } } \ No newline at end of file diff --git a/KruacentExiled/KE.Items/PickupModels/PickupQuality.cs b/KruacentExiled/KE.Items/PickupModels/PickupQuality.cs index e742ed8d..e64d8b0b 100644 --- a/KruacentExiled/KE.Items/PickupModels/PickupQuality.cs +++ b/KruacentExiled/KE.Items/PickupModels/PickupQuality.cs @@ -15,6 +15,7 @@ namespace KE.Items.PickupModels { + [Obsolete("scrapped",true)] internal class PickupQuality { public const float RefreshRate = .1f; diff --git a/KruacentExiled/KE.Utils/Extensions/AdminToyExtension.cs b/KruacentExiled/KE.Utils/Extensions/AdminToyExtension.cs index f20d74ab..37c3706d 100644 --- a/KruacentExiled/KE.Utils/Extensions/AdminToyExtension.cs +++ b/KruacentExiled/KE.Utils/Extensions/AdminToyExtension.cs @@ -14,12 +14,12 @@ public static class AdminToyExtension public static void SetAsPickupAdminToy(this AdminToy toy, bool autoSync = true) { - QualityHandler.Instance.QualityToysHandler.SetAsPickup(toy, autoSync); + QualityHandler.Instance.QualityToysHandler.SetAsPickup(toy); } public static void SetQuality(this AdminToy toy, ModelQuality modelQuality,bool autoSync = true) { - QualityHandler.Instance.QualityToysHandler.SetQuality(toy, modelQuality, autoSync); + QualityHandler.Instance.QualityToysHandler.SetQuality(toy, modelQuality); } } } diff --git a/KruacentExiled/KE.Utils/Quality/QualityHandler.cs b/KruacentExiled/KE.Utils/Quality/QualityHandler.cs index 6c120824..a8946dd0 100644 --- a/KruacentExiled/KE.Utils/Quality/QualityHandler.cs +++ b/KruacentExiled/KE.Utils/Quality/QualityHandler.cs @@ -10,7 +10,8 @@ namespace KE.Utils.Quality { - public class QualityHandler + [Obsolete("scrapped", true)] + internal class QualityHandler { public QualitySettings QualitySettings { get; private set; } public QualityToysHandler QualityToysHandler { get; private set; } diff --git a/KruacentExiled/KE.Utils/Quality/QualityToysHandler.cs b/KruacentExiled/KE.Utils/Quality/QualityToysHandler.cs new file mode 100644 index 00000000..27320233 --- /dev/null +++ b/KruacentExiled/KE.Utils/Quality/QualityToysHandler.cs @@ -0,0 +1,155 @@ +using AdminToys; +using Exiled.API.Enums; +using Exiled.API.Extensions; +using Exiled.API.Features; +using Exiled.API.Features.Toys; +using KE.Utils.Quality.Enums; +using KE.Utils.Quality.Settings; +using System.Collections.Generic; +using System.Linq; +using UnityEngine; +using Light = Exiled.API.Features.Toys.Light; +using QualitySettings = KE.Utils.Quality.Settings.QualitySettings; + +namespace KE.Utils.Quality +{ + public class QualityToysHandler + { + private HashSet _pickupToys = new(); + private Dictionary _qualityToys = new(); + public readonly Vector3 Gulag = new Vector3(15000,15000,15000); + + public bool IsPickupToy(AdminToy primitive) + { + return _pickupToys.Contains(primitive); + } + + public bool IsQualityToy(AdminToy primitive) + { + return _qualityToys.ContainsKey(primitive); + } + + + public void SetAsPickup(AdminToy toy) + { + if (!_pickupToys.Add(toy)) + { + Log.Warn($"AdminToy {toy} is already a pickupToy"); + return; + } + } + + public void SetQuality(AdminToy toy,ModelQuality quality) + { + if (toy == null) return; + if (!_qualityToys.ContainsKey(toy)) + _qualityToys.Add(toy,quality); + else + _qualityToys[toy] = quality; + } + + + + private void SendToShadowRealm(AdminToy adminToy, Player player) + { + if(adminToy is Light l) + { + player.SendFakeSyncVar(l.Base.netIdentity, typeof(LightSourceToy), nameof(LightSourceToy.NetworkPosition), Gulag); + return; + } + if(adminToy is Primitive p) + { + player.SendFakeSyncVar(p.Base.netIdentity, typeof(PrimitiveObjectToy), nameof(PrimitiveObjectToy.NetworkPosition), Gulag); + return; + } + } + + private void SetTruePosition(AdminToy adminToy, Player player) + { + if (adminToy is Light l) + { + player.SendFakeSyncVar(l.Base.netIdentity, typeof(LightSourceToy), nameof(LightSourceToy.NetworkPosition), l.Position); + return; + } + if (adminToy is Primitive p) + { + player.SendFakeSyncVar(p.Base.netIdentity, typeof(PrimitiveObjectToy), nameof(PrimitiveObjectToy.NetworkPosition), p.Position); + return; + } + } + + /// + /// Sync every Players + /// + public void Sync() + { + foreach(Player p in Player.List) + { + Sync(p); + } + } + + /// + /// Sync a specified Player + /// + /// + public void Sync(Player p) + { + var quality = QualitySettings.Get(p); + var pickup = QualitySettings.PickmodelActivated(p); + + if (!pickup) + { + //hide pickup toys + foreach (AdminToy pk in _pickupToys) + { + SendToShadowRealm(pk, p); + } + } + else + { + //show pickup toys + foreach (AdminToy pk in _pickupToys) + { + SetTruePosition(pk, p); + } + } + + + + + foreach(var at in _qualityToys) + { + if(at.Value == quality) + { + if (pickup || !_pickupToys.Contains(at.Key)) + { + SetTruePosition(at.Key, p); + } + } + else + { + SendToShadowRealm(at.Key, p); + } + + } + + } + + /// + /// Sync a specified AdminToy + /// + /// + public void Sync(AdminToy adminToy) + { + if (IsPickupToy(adminToy)) + { + + } + if (IsQualityToy(adminToy)) + { + + } + } + } +} diff --git a/KruacentExiled/KE.Utils/Quality/Settings/QualitySettings.cs b/KruacentExiled/KE.Utils/Quality/Settings/QualitySettings.cs index e783f945..f2421e8e 100644 --- a/KruacentExiled/KE.Utils/Quality/Settings/QualitySettings.cs +++ b/KruacentExiled/KE.Utils/Quality/Settings/QualitySettings.cs @@ -29,13 +29,13 @@ public QualitySettings(Action onChanged) ]; } - internal void Register() + public void Register() { SettingBase.Register(_settings); SettingBase.SendToAll(); } - internal void Unregister() + public void Unregister() { SettingBase.Unregister(settings:_settings); } diff --git a/KruacentExiled/KE.Utils/Quality/Tests/Test.cs b/KruacentExiled/KE.Utils/Quality/Tests/Test.cs index bd89470a..1d8a7edb 100644 --- a/KruacentExiled/KE.Utils/Quality/Tests/Test.cs +++ b/KruacentExiled/KE.Utils/Quality/Tests/Test.cs @@ -59,7 +59,7 @@ private IEnumerator Stress(int count) for (int i = 0; i < count; i++) { Primitive c = Primitive.Create(pos + new Vector3(UnityEngine.Random.Range(0f, maxSpread), UnityEngine.Random.Range(0f, maxSpread), UnityEngine.Random.Range(0f, maxSpread)), scale: scale); - QualityHandler.QualityToysHandler.SetQuality(c, Enums.ModelQuality.Medium, false); + QualityHandler.QualityToysHandler.SetQuality(c, Enums.ModelQuality.Medium); } QualityHandler.QualityToysHandler.Sync(); yield return 0; From c19c45bfd459c6dbf046a1b25356cadf35a3f7a4 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Wed, 4 Jun 2025 03:35:15 +0200 Subject: [PATCH 259/853] moved things + scrapped some more --- .../API/Feature/MalfunctionDisplay.cs | 4 ++-- KruacentExiled/KE.Items/KECustomGrenade.cs | 9 --------- KruacentExiled/KE.Items/KECustomItem.cs | 4 ++-- KruacentExiled/KE.Items/MainPlugin.cs | 19 ++++++++++--------- .../{ => API}/Display/DisplayPlayer.cs | 16 ++++++++-------- .../{ => API}/Display/Enums/HPosition.cs | 2 +- .../{ => API}/Display/Enums/VPosition.cs | 2 +- .../KE.Utils/{ => API}/Display/RueIHint.cs | 6 +++--- .../KE.Utils/Quality/QualityHandler.cs | 2 +- KruacentExiled/KE.Utils/Quality/Tests/Test.cs | 2 +- 10 files changed, 29 insertions(+), 37 deletions(-) rename KruacentExiled/KE.Utils/{ => API}/Display/DisplayPlayer.cs (87%) rename KruacentExiled/KE.Utils/{ => API}/Display/Enums/HPosition.cs (84%) rename KruacentExiled/KE.Utils/{ => API}/Display/Enums/VPosition.cs (86%) rename KruacentExiled/KE.Utils/{ => API}/Display/RueIHint.cs (89%) diff --git a/KruacentExiled/KE.GlobalEventFramework.Examples/API/Feature/MalfunctionDisplay.cs b/KruacentExiled/KE.GlobalEventFramework.Examples/API/Feature/MalfunctionDisplay.cs index 043675bf..fc7a08cc 100644 --- a/KruacentExiled/KE.GlobalEventFramework.Examples/API/Feature/MalfunctionDisplay.cs +++ b/KruacentExiled/KE.GlobalEventFramework.Examples/API/Feature/MalfunctionDisplay.cs @@ -2,8 +2,8 @@ using InventorySystem.Items.Firearms.Modules; using KE.GlobalEventFramework.Examples.API.Interfaces; using KE.Utils; -using KE.Utils.Display; -using KE.Utils.Display.Enums; +using KE.Utils.API.Display; +using KE.Utils.API.Display.Enums; using MEC; using PlayerRoles; using System; diff --git a/KruacentExiled/KE.Items/KECustomGrenade.cs b/KruacentExiled/KE.Items/KECustomGrenade.cs index b91a3f07..59f7029f 100644 --- a/KruacentExiled/KE.Items/KECustomGrenade.cs +++ b/KruacentExiled/KE.Items/KECustomGrenade.cs @@ -1,14 +1,5 @@ using Exiled.API.Features; -using Exiled.API.Features.Items; -using Exiled.CustomItems; using Exiled.CustomItems.API.Features; -using KE.Items.Interface; -using KE.Utils.Display; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; namespace KE.Items { diff --git a/KruacentExiled/KE.Items/KECustomItem.cs b/KruacentExiled/KE.Items/KECustomItem.cs index 508a7d72..7ce43441 100644 --- a/KruacentExiled/KE.Items/KECustomItem.cs +++ b/KruacentExiled/KE.Items/KECustomItem.cs @@ -2,8 +2,8 @@ using Exiled.CustomItems; using Exiled.CustomItems.API.Features; using KE.Items.Interface; -using KE.Utils.Display; -using KE.Utils.Display.Enums; +using KE.Utils.API.Display; +using KE.Utils.API.Display.Enums; namespace KE.Items { diff --git a/KruacentExiled/KE.Items/MainPlugin.cs b/KruacentExiled/KE.Items/MainPlugin.cs index 09bf1004..3e101cd0 100644 --- a/KruacentExiled/KE.Items/MainPlugin.cs +++ b/KruacentExiled/KE.Items/MainPlugin.cs @@ -31,8 +31,9 @@ public class MainPlugin : Plugin internal UpgradeHandler UpgradeHandler { get; private set; } internal LightsHandler LightsHandler { get; private set; } internal static MainPlugin Instance { get; private set; } - internal PickupQuality PickupQuality { get; private set; } - internal QualityHandler QualityHandler { get; private set; } + //scrapped + //internal PickupQuality PickupQuality { get; private set; } + //internal QualityHandler QualityHandler { get; private set; } public override PluginPriority Priority => PluginPriority.Low; public override Version Version => new (1, 0, 0); @@ -41,8 +42,8 @@ public override void OnEnabled() { Instance = this; Sound = new Sound(); - QualityHandler = QualityHandler.Instance; - QualityHandler.Register(); + //QualityHandler = QualityHandler.Instance; + //QualityHandler.Register(); UpgradeHandler = new UpgradeHandler(); LightsHandler = new LightsHandler(); //PickupQuality = new PickupQuality(); @@ -55,7 +56,7 @@ public override void OnEnabled() CustomItem.RegisterItems(); - PickupQuality?.SubscribeEvents(); + //PickupQuality?.SubscribeEvents(); UpgradeHandler.SubscribeEvents(); LightsHandler.SubscribeEvents(); @@ -67,12 +68,12 @@ public override void OnDisabled() CustomItem.UnregisterItems(); UpgradeHandler?.UnsubscribeEvents(); LightsHandler?.UnsubscribeEvents(); - PickupQuality?.UnsubscribeEvents(); - QualityHandler?.Unregister(); + //PickupQuality?.UnsubscribeEvents(); + //QualityHandler?.Unregister(); base.OnDisabled(); - QualityHandler = null; - PickupQuality = null; + //QualityHandler = null; + //PickupQuality = null; LightsHandler = null; Sound = null; UpgradeHandler = null; diff --git a/KruacentExiled/KE.Utils/Display/DisplayPlayer.cs b/KruacentExiled/KE.Utils/API/Display/DisplayPlayer.cs similarity index 87% rename from KruacentExiled/KE.Utils/Display/DisplayPlayer.cs rename to KruacentExiled/KE.Utils/API/Display/DisplayPlayer.cs index a455e935..f995713c 100644 --- a/KruacentExiled/KE.Utils/Display/DisplayPlayer.cs +++ b/KruacentExiled/KE.Utils/API/Display/DisplayPlayer.cs @@ -1,6 +1,6 @@ using Exiled.API.Features; using Exiled.API.Interfaces; -using KE.Utils.Display.Enums; +using KE.Utils.API.Display.Enums; using MEC; using RueI.Displays; using RueI.Elements; @@ -11,11 +11,11 @@ using System.Text; using System.Threading.Tasks; -namespace KE.Utils.Display +namespace KE.Utils.API.Display { public class DisplayPlayer { - private static Dictionary _displays = new(); + private static Dictionary _displays = new(); private RueI.Displays.Display _display; private Dictionary _hints = new(); private Player _player; @@ -30,7 +30,7 @@ public static DisplayPlayer Get(Player player) public DisplayPlayer(Player player) { _player = player; - _display = new (DisplayCore.Get(player.ReferenceHub)); + _display = new(DisplayCore.Get(player.ReferenceHub)); } public Element Hint(Position position, string text) @@ -44,10 +44,10 @@ public Element Hint(Position position, string text) } - public Element Hint(Position position,string text,float seconds) + public Element Hint(Position position, string text, float seconds) { if (_hints.ContainsKey(position)) return null; - SetElement element = new((float)position.VPosition, $""+text+""); + SetElement element = new((float)position.VPosition, $"" + text + ""); _display.Elements.Add(element); _hints.Add(position, element); UpdateCore(_player); @@ -65,7 +65,7 @@ public Element Hint(RueIHint hint) { if (hint.Duration < 0) return Hint(hint.Position, hint.RawContent); - return Hint(hint.Position,hint.RawContent,hint.Duration); + return Hint(hint.Position, hint.RawContent, hint.Duration); } public bool RemoveHint(Position placement) @@ -80,7 +80,7 @@ public bool RemoveHint(Position placement) public static void UpdateCore(Player player) => DisplayCore.Get(player.ReferenceHub).Update(); - + } public struct Position { diff --git a/KruacentExiled/KE.Utils/Display/Enums/HPosition.cs b/KruacentExiled/KE.Utils/API/Display/Enums/HPosition.cs similarity index 84% rename from KruacentExiled/KE.Utils/Display/Enums/HPosition.cs rename to KruacentExiled/KE.Utils/API/Display/Enums/HPosition.cs index 023c8016..d1a3bbcc 100644 --- a/KruacentExiled/KE.Utils/Display/Enums/HPosition.cs +++ b/KruacentExiled/KE.Utils/API/Display/Enums/HPosition.cs @@ -4,7 +4,7 @@ using System.Text; using System.Threading.Tasks; -namespace KE.Utils.Display.Enums +namespace KE.Utils.API.Display.Enums { public enum HPosition { diff --git a/KruacentExiled/KE.Utils/Display/Enums/VPosition.cs b/KruacentExiled/KE.Utils/API/Display/Enums/VPosition.cs similarity index 86% rename from KruacentExiled/KE.Utils/Display/Enums/VPosition.cs rename to KruacentExiled/KE.Utils/API/Display/Enums/VPosition.cs index 264c78dd..35c85f4c 100644 --- a/KruacentExiled/KE.Utils/Display/Enums/VPosition.cs +++ b/KruacentExiled/KE.Utils/API/Display/Enums/VPosition.cs @@ -4,7 +4,7 @@ using System.Text; using System.Threading.Tasks; -namespace KE.Utils.Display.Enums +namespace KE.Utils.API.Display.Enums { public enum VPosition { diff --git a/KruacentExiled/KE.Utils/Display/RueIHint.cs b/KruacentExiled/KE.Utils/API/Display/RueIHint.cs similarity index 89% rename from KruacentExiled/KE.Utils/Display/RueIHint.cs rename to KruacentExiled/KE.Utils/API/Display/RueIHint.cs index af4cd7b4..684fe7cc 100644 --- a/KruacentExiled/KE.Utils/Display/RueIHint.cs +++ b/KruacentExiled/KE.Utils/API/Display/RueIHint.cs @@ -1,11 +1,11 @@ -using KE.Utils.Display.Enums; +using KE.Utils.API.Display.Enums; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; -namespace KE.Utils.Display +namespace KE.Utils.API.Display { public class RueIHint { @@ -21,7 +21,7 @@ public RueIHint(HPosition hposition, VPosition vposition, string content) _position = new(hposition, vposition); _content = content; } - public RueIHint(HPosition hposition, VPosition vposition, string content,float duration) + public RueIHint(HPosition hposition, VPosition vposition, string content, float duration) { _position = new(hposition, vposition); _content = content; diff --git a/KruacentExiled/KE.Utils/Quality/QualityHandler.cs b/KruacentExiled/KE.Utils/Quality/QualityHandler.cs index a8946dd0..235d79c9 100644 --- a/KruacentExiled/KE.Utils/Quality/QualityHandler.cs +++ b/KruacentExiled/KE.Utils/Quality/QualityHandler.cs @@ -10,7 +10,7 @@ namespace KE.Utils.Quality { - [Obsolete("scrapped", true)] + [Obsolete("scrapped", false)] internal class QualityHandler { public QualitySettings QualitySettings { get; private set; } diff --git a/KruacentExiled/KE.Utils/Quality/Tests/Test.cs b/KruacentExiled/KE.Utils/Quality/Tests/Test.cs index 1d8a7edb..6ebd3f66 100644 --- a/KruacentExiled/KE.Utils/Quality/Tests/Test.cs +++ b/KruacentExiled/KE.Utils/Quality/Tests/Test.cs @@ -19,7 +19,7 @@ public class Test private QualityHandler QualityHandler; - public Test(QualityHandler q) + private Test(QualityHandler q) { QualityHandler = q; try From 412584c57ce5811dcf88f3ed7ba0fc0180df1026 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Tue, 10 Jun 2025 02:57:22 +0200 Subject: [PATCH 260/853] fixed the light stuff and added settings and changed the hint display framework --- .../API/Feature/MalfunctionDisplay.cs | 4 +- .../KE.GlobalEventFramework.Examples.csproj | 2 +- .../KE.GlobalEventFramework.csproj | 2 +- KruacentExiled/KE.Items/KE.Items.csproj | 3 +- KruacentExiled/KE.Items/KECustomGrenade.cs | 2 +- KruacentExiled/KE.Items/KECustomItem.cs | 62 ++++++++-- .../KE.Items/Lights/LightsHandler.cs | 93 ++------------- KruacentExiled/KE.Items/MainPlugin.cs | 34 ++---- .../KE.Items/Settings/SettingsHandler.cs | 78 ++++++++++++ .../KE.Items/Upgrade/UpgradeHandler.cs | 3 +- .../KE.Utils/API/Display/DisplayPlayer.cs | 111 ------------------ .../KE.Utils/API/Display/Enums/HPosition.cs | 15 --- .../KE.Utils/API/Display/Enums/VPosition.cs | 15 --- .../KE.Utils/API/Display/RueIHint.cs | 34 ------ .../Displays/DisplayMeow/DisplayHandler.cs | 56 +++++++++ .../API/Displays/DisplayMeow/HintPlacement.cs | 31 +++++ .../KE.Utils/API/Interfaces/IEvents.cs | 17 +++ KruacentExiled/KE.Utils/KE.Utils.csproj | 4 +- .../Quality/Settings/QualitySettings.cs | 8 +- 19 files changed, 264 insertions(+), 310 deletions(-) create mode 100644 KruacentExiled/KE.Items/Settings/SettingsHandler.cs delete mode 100644 KruacentExiled/KE.Utils/API/Display/DisplayPlayer.cs delete mode 100644 KruacentExiled/KE.Utils/API/Display/Enums/HPosition.cs delete mode 100644 KruacentExiled/KE.Utils/API/Display/Enums/VPosition.cs delete mode 100644 KruacentExiled/KE.Utils/API/Display/RueIHint.cs create mode 100644 KruacentExiled/KE.Utils/API/Displays/DisplayMeow/DisplayHandler.cs create mode 100644 KruacentExiled/KE.Utils/API/Displays/DisplayMeow/HintPlacement.cs create mode 100644 KruacentExiled/KE.Utils/API/Interfaces/IEvents.cs diff --git a/KruacentExiled/KE.GlobalEventFramework.Examples/API/Feature/MalfunctionDisplay.cs b/KruacentExiled/KE.GlobalEventFramework.Examples/API/Feature/MalfunctionDisplay.cs index fc7a08cc..4f6704fb 100644 --- a/KruacentExiled/KE.GlobalEventFramework.Examples/API/Feature/MalfunctionDisplay.cs +++ b/KruacentExiled/KE.GlobalEventFramework.Examples/API/Feature/MalfunctionDisplay.cs @@ -2,8 +2,8 @@ using InventorySystem.Items.Firearms.Modules; using KE.GlobalEventFramework.Examples.API.Interfaces; using KE.Utils; -using KE.Utils.API.Display; -using KE.Utils.API.Display.Enums; +using KE.Utils.API.Displays.DisplayRuei; +using KE.Utils.API.Displays.DisplayRuei.Enums; using MEC; using PlayerRoles; using System; diff --git a/KruacentExiled/KE.GlobalEventFramework.Examples/KE.GlobalEventFramework.Examples.csproj b/KruacentExiled/KE.GlobalEventFramework.Examples/KE.GlobalEventFramework.Examples.csproj index 5c287b28..8fcf2265 100644 --- a/KruacentExiled/KE.GlobalEventFramework.Examples/KE.GlobalEventFramework.Examples.csproj +++ b/KruacentExiled/KE.GlobalEventFramework.Examples/KE.GlobalEventFramework.Examples.csproj @@ -6,7 +6,7 @@ - + diff --git a/KruacentExiled/KE.GlobalEventFramework/KE.GlobalEventFramework.csproj b/KruacentExiled/KE.GlobalEventFramework/KE.GlobalEventFramework.csproj index 023b12bd..58ae1660 100644 --- a/KruacentExiled/KE.GlobalEventFramework/KE.GlobalEventFramework.csproj +++ b/KruacentExiled/KE.GlobalEventFramework/KE.GlobalEventFramework.csproj @@ -6,7 +6,7 @@ - + diff --git a/KruacentExiled/KE.Items/KE.Items.csproj b/KruacentExiled/KE.Items/KE.Items.csproj index 8cefe524..84649644 100644 --- a/KruacentExiled/KE.Items/KE.Items.csproj +++ b/KruacentExiled/KE.Items/KE.Items.csproj @@ -6,7 +6,7 @@ - + @@ -22,6 +22,7 @@ + diff --git a/KruacentExiled/KE.Items/KECustomGrenade.cs b/KruacentExiled/KE.Items/KECustomGrenade.cs index 59f7029f..c17544d5 100644 --- a/KruacentExiled/KE.Items/KECustomGrenade.cs +++ b/KruacentExiled/KE.Items/KECustomGrenade.cs @@ -8,7 +8,7 @@ public abstract class KECustomGrenade : CustomGrenade protected override void ShowPickedUpMessage(Player player) { - KECustomItem.Message(this,player); + KECustomItem.Message(this,player,true); } protected override void ShowSelectedMessage(Player player) diff --git a/KruacentExiled/KE.Items/KECustomItem.cs b/KruacentExiled/KE.Items/KECustomItem.cs index 7ce43441..d130b89b 100644 --- a/KruacentExiled/KE.Items/KECustomItem.cs +++ b/KruacentExiled/KE.Items/KECustomItem.cs @@ -1,9 +1,12 @@ using Exiled.API.Features; -using Exiled.CustomItems; using Exiled.CustomItems.API.Features; +using MHints = HintServiceMeow.Core.Models.Hints.Hint; using KE.Items.Interface; -using KE.Utils.API.Display; -using KE.Utils.API.Display.Enums; +using System.Text; +using KE.Utils.API.Displays.DisplayMeow; +using MEC; +using HintServiceMeow.Core.Extension; +using HintServiceMeow.Core.Utilities; namespace KE.Items { @@ -12,35 +15,68 @@ public abstract class KECustomItem : CustomItem protected override void ShowPickedUpMessage(Player player) { - Message(this, player); + Log.Debug("pickup"); + Message(this, player,true); } protected override void ShowSelectedMessage(Player player) { + Log.Debug("select"); Message(this, player); } - internal static void Message(CustomItem c,Player player) + internal static void Message(CustomItem c, Player player, bool pickedUp = false) { - if (CustomItems.Instance.Config.PickedUpHint.Show) + + + + StringBuilder builder = new(); + + if (MainPlugin.Instance.SettingsHandler.GetPrefixes(player)) + { + if (pickedUp) + { + builder.Append("(P)"); + } + else + { + builder.Append("(I)"); + } + } + else { + if (pickedUp) + { + builder.Append("You've picked up "); + } + else + { + builder.Append("You've selected up "); + } + } - - string show = $"{c.Name}\n{c.Description}\n"; + builder.AppendLine($"{c.Name}"); + if (MainPlugin.Instance.SettingsHandler.GetDescriptionsSettings(player)) + { + builder.AppendLine(c.Description); if (c is IUpgradableCustomItem ci) { foreach (var a in ci.Upgrade) { - show += $"{a.Value.Chance}% chance of upgrading on {a.Key}\n"; + builder.AppendLine($"{c.Name}"); } } + + } - RueIHint hint = new(HPosition.Right, VPosition.CustomItem, show, CustomItems.Instance.Config.PickedUpHint.Duration); - DisplayPlayer.Get(player).Hint(hint); - //player.ShowHint(show, (int)CustomItems.Instance.Config.PickedUpHint.Duration); - } + Log.Debug("adding hint"); + + DisplayHandler.Instance.AddHint(MainPlugin.HintPlacement, player, builder.ToString(),10); + + } + } } diff --git a/KruacentExiled/KE.Items/Lights/LightsHandler.cs b/KruacentExiled/KE.Items/Lights/LightsHandler.cs index 790c2764..1b1ad042 100644 --- a/KruacentExiled/KE.Items/Lights/LightsHandler.cs +++ b/KruacentExiled/KE.Items/Lights/LightsHandler.cs @@ -1,112 +1,37 @@ - -using Exiled.API.Features.Toys; -using Exiled.CustomItems.API.Features; +using Exiled.CustomItems.API.Features; using InventorySystem.Items.Pickups; using KE.Items.Interface; -using MEC; -using System; -using System.Collections.Generic; -using System.Linq; -using Pickup = InventorySystem.Items.Pickups.ItemPickupBase; +using KE.Utils.API.Interfaces; +using LabApi.Features.Wrappers; namespace KE.Items.Lights { - internal class LightsHandler + internal class LightsHandler : IUsingEvents { public float Intensity { get; set; } = .5f; - private readonly Dictionary pl = new Dictionary(); public void SubscribeEvents() { ItemPickupBase.OnPickupAdded += AddPickup; - ItemPickupBase.OnPickupDestroyed += DestroyPickup; - Exiled.Events.Handlers.Server.RoundStarted += OnRoundStarted; } public void UnsubscribeEvents() { ItemPickupBase.OnPickupAdded -= AddPickup; - ItemPickupBase.OnPickupDestroyed -= DestroyPickup; - Exiled.Events.Handlers.Server.RoundStarted -= OnRoundStarted; - } - - private void OnRoundStarted() - { - Timing.RunCoroutine(LightP()); - } private void AddPickup(ItemPickupBase pickup) { - if (Check(pickup)) - { - pl.Add(pickup, null); - } - } - private void DestroyPickup(ItemPickupBase pickup) - { - - if (pickup == null) return; - - if (pl.ContainsKey(pickup)) - { - Light val = pl[pickup]; - val?.Destroy(); - pl.Remove(pickup); - } - } - - - - private IEnumerator LightP() - { - while (true) + if (CustomItem.TryGet(Exiled.API.Features.Pickups.Pickup.Get(pickup), out CustomItem item) && item is ILumosItem li) { - try - { + var l = LightSourceToy.Create(pickup.transform, false); + l.Color = li.Color; + l.Intensity = Intensity; - foreach (var x in pl.ToList()) - { - if (x.Key == null) - { - pl.Remove(x.Key); - continue; - } - if (CustomItem.TryGet(Exiled.API.Features.Pickups.Pickup.Get(x.Key), out CustomItem cui) && cui is ILumosItem ci) - { - if (x.Key == null) continue; - Light light = Light.Create(x.Key.Position, null, null, true, ci.Color); - light.Intensity = Intensity; - if (x.Value != null) - { - Light val = x.Value; - val?.Destroy(); - } - pl[x.Key] = light; - } - else - { - Light val = x.Value; - val?.Destroy(); - pl.Remove(x.Key); - } - } - } - catch (Exception) - { - - } - yield return Timing.WaitForSeconds(MainPlugin.Instance.Config.LightRefreshRate); + l.Spawn(); } } - - public static bool Check(Pickup pickup) - { - return CustomItem.TryGet(Exiled.API.Features.Pickups.Pickup.Get(pickup), out CustomItem item) && item is ILumosItem; - } - - } } diff --git a/KruacentExiled/KE.Items/MainPlugin.cs b/KruacentExiled/KE.Items/MainPlugin.cs index 3e101cd0..483f5193 100644 --- a/KruacentExiled/KE.Items/MainPlugin.cs +++ b/KruacentExiled/KE.Items/MainPlugin.cs @@ -1,25 +1,12 @@  using Exiled.API.Enums; -using Exiled.API.Extensions; using Exiled.API.Features; -using Exiled.API.Features.Pickups; -using Exiled.API.Features.Toys; using Exiled.CustomItems.API.Features; -using Exiled.Events.EventArgs.Player; -using KE.Items.Interface; using KE.Items.Lights; -using KE.Items.PickupModels; +using KE.Items.Settings; using KE.Items.Upgrade; -using KE.Utils.Quality; -using KE.Utils.Quality.Settings; -using KE.Utils.Quality.Tests; -using MEC; -using PlayerRoles; -using PluginAPI.Roles; +using KE.Utils.API.Displays.DisplayMeow; using System; -using System.Collections.Generic; -using System.Linq; -using UnityEngine; namespace KE.Items { @@ -31,6 +18,10 @@ public class MainPlugin : Plugin internal UpgradeHandler UpgradeHandler { get; private set; } internal LightsHandler LightsHandler { get; private set; } internal static MainPlugin Instance { get; private set; } + internal SettingsHandler SettingsHandler { get; private set; } + + internal static readonly HintPlacement HintPlacement = new(0, 400, HintServiceMeow.Core.Enum.HintAlignment.Center); + //scrapped //internal PickupQuality PickupQuality { get; private set; } //internal QualityHandler QualityHandler { get; private set; } @@ -45,8 +36,9 @@ public override void OnEnabled() //QualityHandler = QualityHandler.Instance; //QualityHandler.Register(); UpgradeHandler = new UpgradeHandler(); - LightsHandler = new LightsHandler(); + LightsHandler = new LightsHandler(); // lights color and intensity broken //PickupQuality = new PickupQuality(); + SettingsHandler = new(); Sound.LoadClips(); @@ -57,6 +49,7 @@ public override void OnEnabled() CustomItem.RegisterItems(); //PickupQuality?.SubscribeEvents(); + SettingsHandler.SubscribeEvents(); UpgradeHandler.SubscribeEvents(); LightsHandler.SubscribeEvents(); @@ -70,10 +63,13 @@ public override void OnDisabled() LightsHandler?.UnsubscribeEvents(); //PickupQuality?.UnsubscribeEvents(); //QualityHandler?.Unregister(); + SettingsHandler.UnsubscribeEvents(); base.OnDisabled(); //QualityHandler = null; //PickupQuality = null; + + SettingsHandler = null; LightsHandler = null; Sound = null; UpgradeHandler = null; @@ -82,12 +78,6 @@ public override void OnDisabled() - private void TestQuality() - { - /*Vector3 pos = - Primitive c = Primitive.Create() - QualityHandler.QualityToysHandler.SetQuality()*/ - } } } \ No newline at end of file diff --git a/KruacentExiled/KE.Items/Settings/SettingsHandler.cs b/KruacentExiled/KE.Items/Settings/SettingsHandler.cs new file mode 100644 index 00000000..5206b379 --- /dev/null +++ b/KruacentExiled/KE.Items/Settings/SettingsHandler.cs @@ -0,0 +1,78 @@ +using Exiled.API.Features; +using Exiled.API.Features.Core.UserSettings; +using KE.Utils.API.Interfaces; +using KE.Utils.Quality.Enums; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Runtime; +using System.Runtime.Remoting.Messaging; +using System.Text; +using System.Threading.Tasks; + +namespace KE.Items.Settings +{ + internal class SettingsHandler : IUsingEvents + { + + private SettingBase[] _settings; + private int _idDesc = 1; + private int _idPrefix = 2; + + + + private void CreateSettings() + { + + _settings = + [ + new HeaderSetting ("Custom Items Settings"), + new TwoButtonsSetting(_idDesc,"Custom Items Descriptions","Disabled","Enabled",true,"hide/show the description of the item and its upgrade chances ", onChanged:OnChanged), + new TwoButtonsSetting(_idPrefix,"Custom Items Pickup/Select prefixes","Disabled","Enabled",false,"show/hide the whole sentence for the picking or selecting of the item, if hidden it will show a (P) if pickup or a (I) if in inventory before the name of the item ", onChanged:OnChanged), + + ]; + SettingBase.Register(_settings); + + } + + + public void SubscribeEvents() + { + CreateSettings(); + SettingBase.SendToAll(); + } + + public void UnsubscribeEvents() + { + SettingBase.Unregister(); + } + + + private void OnChanged(Player p, SettingBase settings) + { + + } + + /// + /// + /// + /// + /// true if the player wants description ; false otherwise + internal bool GetDescriptionsSettings(Player p) + { + if (!SettingBase.TryGetSetting(p, _idDesc, out var setting)) return true; + return setting.IsSecond; + } + + /// + /// + /// + /// + /// true if the player wants prefixes ; false otherwise + internal bool GetPrefixes(Player p) + { + if (!SettingBase.TryGetSetting(p, _idPrefix, out var setting)) return false; + return setting.IsSecond; + } + } +} diff --git a/KruacentExiled/KE.Items/Upgrade/UpgradeHandler.cs b/KruacentExiled/KE.Items/Upgrade/UpgradeHandler.cs index 8d5634dc..011a8404 100644 --- a/KruacentExiled/KE.Items/Upgrade/UpgradeHandler.cs +++ b/KruacentExiled/KE.Items/Upgrade/UpgradeHandler.cs @@ -3,11 +3,12 @@ using Exiled.CustomItems.API.Features; using Exiled.Events.EventArgs.Scp914; using KE.Items.Interface; +using KE.Utils.API.Interfaces; using Scp914; namespace KE.Items.Upgrade { - internal class UpgradeHandler + internal class UpgradeHandler : IUsingEvents { public void SubscribeEvents() diff --git a/KruacentExiled/KE.Utils/API/Display/DisplayPlayer.cs b/KruacentExiled/KE.Utils/API/Display/DisplayPlayer.cs deleted file mode 100644 index f995713c..00000000 --- a/KruacentExiled/KE.Utils/API/Display/DisplayPlayer.cs +++ /dev/null @@ -1,111 +0,0 @@ -using Exiled.API.Features; -using Exiled.API.Interfaces; -using KE.Utils.API.Display.Enums; -using MEC; -using RueI.Displays; -using RueI.Elements; -using RueI.Elements.Enums; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace KE.Utils.API.Display -{ - public class DisplayPlayer - { - private static Dictionary _displays = new(); - private RueI.Displays.Display _display; - private Dictionary _hints = new(); - private Player _player; - public Player Player { get { return _player; } } - public static DisplayPlayer Get(Player player) - { - if (!_displays.ContainsKey(player)) - _displays.Add(player, new DisplayPlayer(player)); - return _displays[player]; - } - - public DisplayPlayer(Player player) - { - _player = player; - _display = new(DisplayCore.Get(player.ReferenceHub)); - } - - public Element Hint(Position position, string text) - { - if (_hints.ContainsKey(position)) return null; - SetElement element = new((float)position.VPosition, $"" + text + ""); - _display.Elements.Add(element); - _hints.Add(position, element); - UpdateCore(_player); - return element; - } - - - public Element Hint(Position position, string text, float seconds) - { - if (_hints.ContainsKey(position)) return null; - SetElement element = new((float)position.VPosition, $"" + text + ""); - _display.Elements.Add(element); - _hints.Add(position, element); - UpdateCore(_player); - Timing.CallDelayed(seconds, () => - { - _display.Elements.Remove(element); - _hints.Remove(position); - UpdateCore(_player); - }); - return element; - } - - - public Element Hint(RueIHint hint) - { - if (hint.Duration < 0) - return Hint(hint.Position, hint.RawContent); - return Hint(hint.Position, hint.RawContent, hint.Duration); - } - - public bool RemoveHint(Position placement) - { - if (!_hints.ContainsKey(placement)) return false; - bool result = _display.Elements.Remove(_hints[placement]); - _hints.Remove(placement); - UpdateCore(_player); - return result; - } - - - public static void UpdateCore(Player player) => DisplayCore.Get(player.ReferenceHub).Update(); - - - } - public struct Position - { - private HPosition _hposition; - public HPosition HPosition { get { return _hposition; } } - private VPosition _vposition; - public VPosition VPosition { get { return _vposition; } } - - public Position(HPosition hposition, VPosition vposition) - { - _hposition = hposition; - _vposition = vposition; - } - - public override bool Equals(object obj) - { - Position pos = (Position)obj; - return pos.VPosition == VPosition && pos.HPosition == HPosition; - } - public override int GetHashCode() - { - return base.GetHashCode(); - } - } - - - -} diff --git a/KruacentExiled/KE.Utils/API/Display/Enums/HPosition.cs b/KruacentExiled/KE.Utils/API/Display/Enums/HPosition.cs deleted file mode 100644 index d1a3bbcc..00000000 --- a/KruacentExiled/KE.Utils/API/Display/Enums/HPosition.cs +++ /dev/null @@ -1,15 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace KE.Utils.API.Display.Enums -{ - public enum HPosition - { - Left, - Center, - Right, - } -} diff --git a/KruacentExiled/KE.Utils/API/Display/Enums/VPosition.cs b/KruacentExiled/KE.Utils/API/Display/Enums/VPosition.cs deleted file mode 100644 index 35c85f4c..00000000 --- a/KruacentExiled/KE.Utils/API/Display/Enums/VPosition.cs +++ /dev/null @@ -1,15 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace KE.Utils.API.Display.Enums -{ - public enum VPosition - { - GlobalEvent = 900, - CustomItem = 200, - CustomRole = 400, - } -} diff --git a/KruacentExiled/KE.Utils/API/Display/RueIHint.cs b/KruacentExiled/KE.Utils/API/Display/RueIHint.cs deleted file mode 100644 index 684fe7cc..00000000 --- a/KruacentExiled/KE.Utils/API/Display/RueIHint.cs +++ /dev/null @@ -1,34 +0,0 @@ -using KE.Utils.API.Display.Enums; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace KE.Utils.API.Display -{ - public class RueIHint - { - private Position _position; - public Position Position { get { return _position; } } - private string _content; - public string RawContent { get { return _content; } } - private float _duration = -1; - public float Duration { get { return _duration; } } - - public RueIHint(HPosition hposition, VPosition vposition, string content) - { - _position = new(hposition, vposition); - _content = content; - } - public RueIHint(HPosition hposition, VPosition vposition, string content, float duration) - { - _position = new(hposition, vposition); - _content = content; - _duration = duration; - } - - - - } -} diff --git a/KruacentExiled/KE.Utils/API/Displays/DisplayMeow/DisplayHandler.cs b/KruacentExiled/KE.Utils/API/Displays/DisplayMeow/DisplayHandler.cs new file mode 100644 index 00000000..e5b03bd0 --- /dev/null +++ b/KruacentExiled/KE.Utils/API/Displays/DisplayMeow/DisplayHandler.cs @@ -0,0 +1,56 @@ +using Exiled.API.Features; +using HintServiceMeow.Core.Extension; +using HintServiceMeow.Core.Models.Hints; +using HintServiceMeow.Core.Utilities; +using MEC; + + +//damn why the same name +using MHint = HintServiceMeow.Core.Models.Hints.Hint; + +namespace KE.Utils.API.Displays.DisplayMeow +{ + public class DisplayHandler + { + public static DisplayHandler Instance { get; } = new(); + + private DisplayHandler() { } + + + public void TempHint(AbstractHint hint, Player p,float delay) + { + var dis = PlayerDisplay.Get(p); + dis.AddHint(hint); + dis.RemoveAfter(hint, delay); + + } + + + + public MHint AddHint(HintPlacement hintPlacement, Player player, string text, float delay) + { + var dis = PlayerDisplay.Get(player); + MHint hint = new() + { + Text = text, + XCoordinate = hintPlacement.XCoordinate, + YCoordinate = hintPlacement.YCoordinate, + Alignment = hintPlacement.HintAlignment + }; + dis.AddHint(hint); + Timing.CallDelayed(delay, () => + { + Log.Debug("remvoving hint"); + dis.RemoveHint(hint); + }); + return hint; + } + + + + + + + + } +} diff --git a/KruacentExiled/KE.Utils/API/Displays/DisplayMeow/HintPlacement.cs b/KruacentExiled/KE.Utils/API/Displays/DisplayMeow/HintPlacement.cs new file mode 100644 index 00000000..936cdbe9 --- /dev/null +++ b/KruacentExiled/KE.Utils/API/Displays/DisplayMeow/HintPlacement.cs @@ -0,0 +1,31 @@ +using HintServiceMeow.Core.Enum; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace KE.Utils.API.Displays.DisplayMeow +{ + public readonly struct HintPlacement : IEquatable + { + public float YCoordinate { get; } + public float XCoordinate { get; } + public HintAlignment HintAlignment { get; } = HintAlignment.Center; + + + public bool Equals(HintPlacement obj) + { + return YCoordinate == obj.YCoordinate && XCoordinate == obj.XCoordinate; + } + + + public HintPlacement(float xCoordinate, float yCoordinate, HintAlignment alignment = HintAlignment.Center) + { + YCoordinate = yCoordinate; + XCoordinate = xCoordinate; + HintAlignment = alignment; + } + + } +} diff --git a/KruacentExiled/KE.Utils/API/Interfaces/IEvents.cs b/KruacentExiled/KE.Utils/API/Interfaces/IEvents.cs new file mode 100644 index 00000000..e573b062 --- /dev/null +++ b/KruacentExiled/KE.Utils/API/Interfaces/IEvents.cs @@ -0,0 +1,17 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace KE.Utils.API.Interfaces +{ + public interface IUsingEvents + { + + + public void SubscribeEvents(); + + public void UnsubscribeEvents(); + } +} diff --git a/KruacentExiled/KE.Utils/KE.Utils.csproj b/KruacentExiled/KE.Utils/KE.Utils.csproj index 72133b13..1587c6e8 100644 --- a/KruacentExiled/KE.Utils/KE.Utils.csproj +++ b/KruacentExiled/KE.Utils/KE.Utils.csproj @@ -6,12 +6,12 @@ - - + + diff --git a/KruacentExiled/KE.Utils/Quality/Settings/QualitySettings.cs b/KruacentExiled/KE.Utils/Quality/Settings/QualitySettings.cs index f2421e8e..ca8d49be 100644 --- a/KruacentExiled/KE.Utils/Quality/Settings/QualitySettings.cs +++ b/KruacentExiled/KE.Utils/Quality/Settings/QualitySettings.cs @@ -1,14 +1,7 @@ using Exiled.API.Features; using Exiled.API.Features.Core.UserSettings; -using Exiled.Events.Commands.Hub; using KE.Utils.Quality.Enums; using System; -using System.Collections.Generic; -using System.Linq; -using System.Runtime; -using System.Text; -using System.Threading.Tasks; -using UserSettings.ServerSpecific; namespace KE.Utils.Quality.Settings { @@ -17,6 +10,7 @@ public class QualitySettings private static int _idQuality = 0; private static int _idModels = 1; + private static int _idSlider = 2; private SettingBase[] _settings; public QualitySettings(Action onChanged) { From 445491c2ce5a7d22af35dc79ea1e206b34e0160b Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Tue, 10 Jun 2025 05:32:14 +0200 Subject: [PATCH 261/853] Changed all hints of all custom item --- .../KE.Items/Extensions/PlayerExtensions.cs | 18 ++++++++ .../KE.Items/ItemEffects/DivinePillsEffect.cs | 3 +- .../KE.Items/ItemEffects/MineEffect.cs | 5 ++- .../KE.Items/ItemEffects/TPGrenadaEffect.cs | 25 ++++++++--- .../KE.Items/Items/AdrenalineDrogue.cs | 11 ++--- KruacentExiled/KE.Items/Items/Defibrilator.cs | 7 +-- KruacentExiled/KE.Items/Items/PressePuree.cs | 45 ++++--------------- KruacentExiled/KE.Items/Items/Scp514.cs | 2 +- .../KE.Items/Items/TrueDivinePills.cs | 8 ++-- KruacentExiled/KE.Items/KECustomItem.cs | 18 ++++++-- KruacentExiled/KE.Items/MainPlugin.cs | 1 + .../KE.Items/Settings/SettingsHandler.cs | 32 ++++++++++--- .../Displays/DisplayMeow/DisplayHandler.cs | 45 ++++++++++++------- 13 files changed, 137 insertions(+), 83 deletions(-) create mode 100644 KruacentExiled/KE.Items/Extensions/PlayerExtensions.cs diff --git a/KruacentExiled/KE.Items/Extensions/PlayerExtensions.cs b/KruacentExiled/KE.Items/Extensions/PlayerExtensions.cs new file mode 100644 index 00000000..89aac497 --- /dev/null +++ b/KruacentExiled/KE.Items/Extensions/PlayerExtensions.cs @@ -0,0 +1,18 @@ +using Exiled.API.Features; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace KE.Items.Extensions +{ + public static class PlayerExtensions + { + + public static void ItemEffectHint(this Player player, string text) + { + KECustomItem.ItemEffectHint(player, text); + } + } +} diff --git a/KruacentExiled/KE.Items/ItemEffects/DivinePillsEffect.cs b/KruacentExiled/KE.Items/ItemEffects/DivinePillsEffect.cs index 42997842..0e53802f 100644 --- a/KruacentExiled/KE.Items/ItemEffects/DivinePillsEffect.cs +++ b/KruacentExiled/KE.Items/ItemEffects/DivinePillsEffect.cs @@ -5,6 +5,7 @@ using Exiled.Events.EventArgs.Interfaces; using Exiled.Events.EventArgs.Map; using Exiled.Events.EventArgs.Player; +using KE.Items.Extensions; using KE.Items.Interface; using PlayerRoles; using System.Linq; @@ -37,7 +38,7 @@ private void EffectItem(Player player,IDeniableEvent ev = null) { if (Player.List.Count(x => x.Role == RoleTypeId.Spectator) == 0) { - player.ShowHint("No spectators to respawn"); + player.ItemEffectHint("No spectators to respawn"); /* could be used for a deniable event if(ev != null) diff --git a/KruacentExiled/KE.Items/ItemEffects/MineEffect.cs b/KruacentExiled/KE.Items/ItemEffects/MineEffect.cs index e783a242..3bd7dd71 100644 --- a/KruacentExiled/KE.Items/ItemEffects/MineEffect.cs +++ b/KruacentExiled/KE.Items/ItemEffects/MineEffect.cs @@ -2,6 +2,7 @@ using Exiled.API.Features.Items; using Exiled.Events.EventArgs.Map; using Exiled.Events.EventArgs.Player; +using KE.Items.Extensions; using KE.Items.Interface; using KE.Items.Items.Models; using MEC; @@ -70,13 +71,13 @@ private IEnumerator WaitAndActivateMine(Player player, MineModel mine) int countdown = MineActivationTime; while (countdown > 0) { - player.ShowHint($"The mine will be active in {countdown} seconds !", 1f); + player.ItemEffectHint($"The mine will be active in {countdown} seconds !"); yield return Timing.WaitForSeconds(1f); countdown--; } // Message final lorsque la mine s'active - player.ShowHint("Mine activated !"); + player.ItemEffectHint("Mine activated !"); Timing.RunCoroutine(ActiveMine(mine, MineRadius)); } diff --git a/KruacentExiled/KE.Items/ItemEffects/TPGrenadaEffect.cs b/KruacentExiled/KE.Items/ItemEffects/TPGrenadaEffect.cs index 165f8ca2..24f439ef 100644 --- a/KruacentExiled/KE.Items/ItemEffects/TPGrenadaEffect.cs +++ b/KruacentExiled/KE.Items/ItemEffects/TPGrenadaEffect.cs @@ -1,4 +1,5 @@ using Exiled.API.Enums; +using Exiled.API.Extensions; using Exiled.API.Features; using Exiled.API.Features.Pickups.Projectiles; using Exiled.API.Features.Pools; @@ -22,6 +23,13 @@ public class TPGrenadaEffect : CustomItemEffect [Description("What roles will not be able to be affected by Implosion Grenades. Keeping SCP-173 on this list is highly recommended.")] public HashSet BlacklistedRoles { get; set; } = new HashSet() { RoleTypeId.Scp173, RoleTypeId.Scp106, RoleTypeId.Scp049, RoleTypeId.Scp096, RoleTypeId.Scp3114, RoleTypeId.Scp0492, RoleTypeId.Scp939 }; + public HashSet BlacklistedRooms { get; } = new() + { + RoomType.HczTestRoom, + RoomType.HczTesla, + RoomType.Lcz173, + }; + public override void Effect(UsedItemEventArgs ev) { OnExploding(new HashSet() { ev.Player }); @@ -71,10 +79,10 @@ private void OnExploding(HashSet targets, EffectGrenadeProjectile projec private Room RandomRoom() { - Room room = Room.Random(); + Room room = Room.List.GetRandomValue((Room r) => !BlacklistedRooms.Contains(r.Type)); if (Warhead.IsDetonated) { - return Room.Random(ZoneType.Surface); + return RandomRoom(ZoneType.Surface); } if (Map.IsLczDecontaminated) @@ -83,16 +91,23 @@ private Room RandomRoom() Log.Debug($"random={random}"); if (random <= 0.33f) { - return Room.Random(ZoneType.HeavyContainment); + return RandomRoom(ZoneType.HeavyContainment); } if (random > 0.33f && random <= 0.66f) { - return Room.Random(ZoneType.Entrance); + return RandomRoom(ZoneType.Entrance); } - return Room.Random(ZoneType.Surface); + return RandomRoom(ZoneType.Surface); } + Log.Debug($"roomZone={room.Zone}"); return room; } + + + private Room RandomRoom(ZoneType zone) + { + return Room.List.GetRandomValue((Room r) => !BlacklistedRooms.Contains(r.Type) && r.Zone == zone); + } } } diff --git a/KruacentExiled/KE.Items/Items/AdrenalineDrogue.cs b/KruacentExiled/KE.Items/Items/AdrenalineDrogue.cs index d99fccc3..f4bc6f75 100644 --- a/KruacentExiled/KE.Items/Items/AdrenalineDrogue.cs +++ b/KruacentExiled/KE.Items/Items/AdrenalineDrogue.cs @@ -13,6 +13,7 @@ using KE.Items.Interface; using System.Linq; using KE.Items; +using KE.Items.Extensions; /// [CustomItem(ItemType.Adrenaline)] @@ -105,7 +106,7 @@ private IEnumerator EffectAttribution(Exiled.API.Features.Player joueur) bool gasgas = false; /* EFFET DE LA DROGUE */ - joueur.ShowHint("Vous êtes actuellement sous effet de la cocaïne liquide !"); + joueur.ItemEffectHint("Vous êtes actuellement sous effet de la cocaïne liquide !"); var movementBoostEffect = joueur.ActiveEffects.FirstOrDefault(e => e is MovementBoost) as MovementBoost; @@ -128,7 +129,7 @@ private IEnumerator EffectAttribution(Exiled.API.Features.Player joueur) yield return Timing.WaitForSeconds(30); - joueur.ShowHint("Mince vous êtes perdu chez le papi Rian !"); + joueur.ItemEffectHint("Mince vous êtes perdu chez le papi Rian !"); joueur.Health = 9420; joueur.IsGodModeEnabled = true; @@ -210,14 +211,14 @@ private IEnumerator EffectAttribution(Exiled.API.Features.Player joueur) break; case 2: Log.Debug("Muet"); - joueur.ShowHint("You lost your ability to talk, (git good)"); + joueur.ItemEffectHint("You lost your ability to talk, (git good)"); joueur.Mute(); yield return Timing.WaitForSeconds(UnityEngine.Random.Range(30, 100)); joueur.ShowHint("I think you found your ability"); joueur.UnMute(); break; case 3: - joueur.ShowHint("You are caoutchouc man"); + joueur.ItemEffectHint("You are caoutchouc man"); Exiled.API.Features.TeslaGate.IgnoredPlayers.Add(joueur); joueur.SetScale(new Vector3(1.5f, 0.5f, 1.7f), Exiled.API.Features.Player.List); break; @@ -250,7 +251,7 @@ private IEnumerator EffectAttribution(Exiled.API.Features.Player joueur) break; case 5: Log.Debug("Paper"); - joueur.ShowHint("You are a paper ! Yippee !"); + joueur.ItemEffectHint("You are a paper ! Yippee !"); joueur.SetScale(new Vector3(1f, 0.5f, 1f), Exiled.API.Features.Player.List); break; } diff --git a/KruacentExiled/KE.Items/Items/Defibrilator.cs b/KruacentExiled/KE.Items/Items/Defibrilator.cs index 0b7d4a76..47d3bfdb 100644 --- a/KruacentExiled/KE.Items/Items/Defibrilator.cs +++ b/KruacentExiled/KE.Items/Items/Defibrilator.cs @@ -11,6 +11,7 @@ using System.Linq; using KE.Items.Interface; using KE.Items; +using KE.Items.Extensions; [CustomItem(ItemType.SCP1853)] public class Defibrilator : KECustomItem, ILumosItem @@ -97,7 +98,7 @@ private IEnumerator EffectAttribution(Player joueur) if (positionMort.Count == 0) { - joueur.Broadcast(5, "There is no death", Broadcast.BroadcastFlags.Normal, true); + joueur.ItemEffectHint("There is no death"); Exiled.CustomItems.API.Features.CustomItem.TryGive(joueur, 1041); } else @@ -129,8 +130,8 @@ private IEnumerator EffectAttribution(Player joueur) closestDeadPlayer.Teleport(joueur.Position); - closestDeadPlayer.Broadcast(5, joueur.Nickname + " revived you!", Broadcast.BroadcastFlags.Normal, true); - joueur.Broadcast(5, "You revived " + closestDeadPlayer.Nickname + "!", Broadcast.BroadcastFlags.Normal, true); + closestDeadPlayer.ItemEffectHint(joueur.Nickname + " revived you!"); + joueur.ItemEffectHint("You revived " + closestDeadPlayer.Nickname + "!"); yield return Timing.WaitForSeconds(1); diff --git a/KruacentExiled/KE.Items/Items/PressePuree.cs b/KruacentExiled/KE.Items/Items/PressePuree.cs index 181fc612..97463de1 100644 --- a/KruacentExiled/KE.Items/Items/PressePuree.cs +++ b/KruacentExiled/KE.Items/Items/PressePuree.cs @@ -7,11 +7,14 @@ using Exiled.API.Features.Spawn; using Exiled.CustomItems.API.Features; using Exiled.Events.EventArgs.Scp914; +using KE.Items.Interface; +using KE.Items.Upgrade; +using Scp914; namespace KE.Items.Items { [CustomItem(ItemType.GrenadeHE)] - public class PressePuree : KECustomGrenade + public class PressePuree : KECustomGrenade, IUpgradableCustomItem { public override uint Id { get; set; } = 1046; public override string Name { get; set; } = "Presse Purée"; @@ -48,42 +51,10 @@ public class PressePuree : KECustomGrenade }, }; - - protected override void SubscribeEvents() - { - Exiled.Events.Handlers.Scp914.UpgradingInventoryItem += OnUpgrading; - base.SubscribeEvents(); - } - - /// - protected override void UnsubscribeEvents() - { - Exiled.Events.Handlers.Scp914.UpgradingInventoryItem -= OnUpgrading; - base.UnsubscribeEvents(); - } - - private void OnUpgrading(UpgradingInventoryItemEventArgs ev) + public IReadOnlyDictionary Upgrade { get; private set; } = new Dictionary() { - if (!Check(ev.Item)) - return; - if (ev.KnobSetting != Scp914.Scp914KnobSetting.VeryFine) - return; - - var rng = UnityEngine.Random.Range(0, 101); - Log.Debug($"inventory {Name} : {rng}"); - if (rng < 5) - { - //success - ev.Player.RemoveItem(ev.Item); - TryGive(ev.Player, "Sainte Grenada"); - ev.IsAllowed = true; - } - else - { - ev.Player.ShowHint("no luck"); - ev.IsAllowed = false; - } - - } + //very fine -> true divine pills 10% + { Scp914KnobSetting.VeryFine,new UpgradeProperties(5, 1055)} + }; } } diff --git a/KruacentExiled/KE.Items/Items/Scp514.cs b/KruacentExiled/KE.Items/Items/Scp514.cs index 12a4500c..f45fb15e 100644 --- a/KruacentExiled/KE.Items/Items/Scp514.cs +++ b/KruacentExiled/KE.Items/Items/Scp514.cs @@ -19,7 +19,7 @@ namespace KE.Items.Items public class Scp514 : KECustomItem { public override uint Id { get; set; } = 1070; - public override string Name { get; set; } = "Scp514"; + public override string Name { get; set; } = "SCP-514"; public override string Description { get; set; } = "birb"; public override float Weight { get; set; } = 0.65f; public float TimeActive { get; set; } = 3; diff --git a/KruacentExiled/KE.Items/Items/TrueDivinePills.cs b/KruacentExiled/KE.Items/Items/TrueDivinePills.cs index b65d5f22..bf0aa527 100644 --- a/KruacentExiled/KE.Items/Items/TrueDivinePills.cs +++ b/KruacentExiled/KE.Items/Items/TrueDivinePills.cs @@ -59,17 +59,19 @@ protected override void OnDroppingItem(DroppingItemEventArgs ev) { if (!Check(ev.Item)) return; + if (ev.IsThrown) { ev.IsAllowed = true; return; } + Player player = ev.Player; tp = !tp; if (tp) - ev.Player.ShowHint("Players will spawn to you"); + KECustomItem.ItemEffectHint(player, "Players will spawn to you"); else - ev.Player.ShowHint("Players won't spawn to you"); + KECustomItem.ItemEffectHint(player, "Players won't spawn to you"); ev.IsAllowed = false; @@ -86,7 +88,7 @@ private void OnUsingItem(UsingItemEventArgs ev) if (Player.List.Where(x => x.Role == RoleTypeId.Spectator).Count() == 0) { - player.ShowHint("No one to respawn"); + KECustomItem.ItemEffectHint(player, "No one to respawn"); ev.IsAllowed = false; return; } diff --git a/KruacentExiled/KE.Items/KECustomItem.cs b/KruacentExiled/KE.Items/KECustomItem.cs index d130b89b..16571475 100644 --- a/KruacentExiled/KE.Items/KECustomItem.cs +++ b/KruacentExiled/KE.Items/KECustomItem.cs @@ -7,6 +7,7 @@ using MEC; using HintServiceMeow.Core.Extension; using HintServiceMeow.Core.Utilities; +using System.Reflection; namespace KE.Items { @@ -71,12 +72,23 @@ internal static void Message(CustomItem c, Player player, bool pickedUp = false) } - Log.Debug("adding hint"); - - DisplayHandler.Instance.AddHint(MainPlugin.HintPlacement, player, builder.ToString(),10); + float delay = MainPlugin.Instance.SettingsHandler.GetTime(player); + DisplayHandler.Instance.AddHint(MainPlugin.HintPlacement, player, builder.ToString(),delay); } + + + + public static void ItemEffectHint(Player player,string text) + { + float delay = MainPlugin.Instance.SettingsHandler.GetTimeEffect(player); + + + DisplayHandler.Instance.AddHint(MainPlugin.ItemEffectPlacement, player,text , delay); + } + + } } diff --git a/KruacentExiled/KE.Items/MainPlugin.cs b/KruacentExiled/KE.Items/MainPlugin.cs index 483f5193..5e598249 100644 --- a/KruacentExiled/KE.Items/MainPlugin.cs +++ b/KruacentExiled/KE.Items/MainPlugin.cs @@ -20,6 +20,7 @@ public class MainPlugin : Plugin internal static MainPlugin Instance { get; private set; } internal SettingsHandler SettingsHandler { get; private set; } + internal static readonly HintPlacement ItemEffectPlacement = new(0, 200, HintServiceMeow.Core.Enum.HintAlignment.Center); internal static readonly HintPlacement HintPlacement = new(0, 400, HintServiceMeow.Core.Enum.HintAlignment.Center); //scrapped diff --git a/KruacentExiled/KE.Items/Settings/SettingsHandler.cs b/KruacentExiled/KE.Items/Settings/SettingsHandler.cs index 5206b379..289cb028 100644 --- a/KruacentExiled/KE.Items/Settings/SettingsHandler.cs +++ b/KruacentExiled/KE.Items/Settings/SettingsHandler.cs @@ -6,6 +6,8 @@ using System.Collections.Generic; using System.Linq; using System.Runtime; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; using System.Runtime.Remoting.Messaging; using System.Text; using System.Threading.Tasks; @@ -16,20 +18,24 @@ internal class SettingsHandler : IUsingEvents { private SettingBase[] _settings; - private int _idDesc = 1; - private int _idPrefix = 2; + private const int _idDesc = 0; + private const int _idPrefix = 1; + private const int _idTimeCustomItem = 2; + private const int _idTimeCustomItemEffect = 3; private void CreateSettings() { - + _settings = [ new HeaderSetting ("Custom Items Settings"), - new TwoButtonsSetting(_idDesc,"Custom Items Descriptions","Disabled","Enabled",true,"hide/show the description of the item and its upgrade chances ", onChanged:OnChanged), - new TwoButtonsSetting(_idPrefix,"Custom Items Pickup/Select prefixes","Disabled","Enabled",false,"show/hide the whole sentence for the picking or selecting of the item, if hidden it will show a (P) if pickup or a (I) if in inventory before the name of the item ", onChanged:OnChanged), - + new TwoButtonsSetting(_idDesc,"Descriptions","Disabled","Enabled",true,"hide/show the description of the item and its upgrade chances ", onChanged:OnChanged), + new TwoButtonsSetting(_idPrefix,"Pickup/Select prefixes","Disabled","Enabled",false,"show/hide the whole sentence for the picking or selecting of the item, if hidden it will show a (P) if pickup or a (I) if in inventory before the name of the item ", onChanged:OnChanged), + new SliderSetting(_idTimeCustomItem,"Time shown",0,30,10), + new SliderSetting(_idTimeCustomItemEffect,"Time effect shown",0,30,10), + ]; SettingBase.Register(_settings); @@ -53,6 +59,20 @@ private void OnChanged(Player p, SettingBase settings) } + + + internal float GetTime(Player p) + { + if (!SettingBase.TryGetSetting(p, _idTimeCustomItem, out var setting)) return 10; + return setting.SliderValue; + } + + internal float GetTimeEffect(Player p) + { + if (!SettingBase.TryGetSetting(p, _idTimeCustomItemEffect, out var setting)) return 10; + return setting.SliderValue; + } + /// /// /// diff --git a/KruacentExiled/KE.Utils/API/Displays/DisplayMeow/DisplayHandler.cs b/KruacentExiled/KE.Utils/API/Displays/DisplayMeow/DisplayHandler.cs index e5b03bd0..4ee13535 100644 --- a/KruacentExiled/KE.Utils/API/Displays/DisplayMeow/DisplayHandler.cs +++ b/KruacentExiled/KE.Utils/API/Displays/DisplayMeow/DisplayHandler.cs @@ -17,36 +17,47 @@ public class DisplayHandler private DisplayHandler() { } - public void TempHint(AbstractHint hint, Player p,float delay) - { - var dis = PlayerDisplay.Get(p); - dis.AddHint(hint); - dis.RemoveAfter(hint, delay); - } public MHint AddHint(HintPlacement hintPlacement, Player player, string text, float delay) { var dis = PlayerDisplay.Get(player); - MHint hint = new() + string id = $"{player.Id}_{hintPlacement.XCoordinate}_{hintPlacement.YCoordinate}"; + MHint hint; + + if (!dis.TryGetHint(id, out var aHint)) { - Text = text, - XCoordinate = hintPlacement.XCoordinate, - YCoordinate = hintPlacement.YCoordinate, - Alignment = hintPlacement.HintAlignment - }; - dis.AddHint(hint); - Timing.CallDelayed(delay, () => + hint = new() + { + Text = text, + XCoordinate = hintPlacement.XCoordinate, + YCoordinate = hintPlacement.YCoordinate, + Alignment = hintPlacement.HintAlignment, + Id = id + + }; + dis.AddHint(hint); + + } + else { - Log.Debug("remvoving hint"); - dis.RemoveHint(hint); - }); + + hint = (MHint)aHint; + hint.Hide = false; + hint.Text = text; + } + + + hint.HideAfter(delay); return hint; } + + + From fd68d96382f3a4a122ce09156de7fcf5125c6e84 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Tue, 10 Jun 2025 05:33:36 +0200 Subject: [PATCH 262/853] added debug --- KruacentExiled/Map/MainPlugin.cs | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/KruacentExiled/Map/MainPlugin.cs b/KruacentExiled/Map/MainPlugin.cs index d714a2f6..a11cc828 100644 --- a/KruacentExiled/Map/MainPlugin.cs +++ b/KruacentExiled/Map/MainPlugin.cs @@ -83,14 +83,17 @@ private void OnGenerated() g.SubscribeEvents(); - lcz173.RequiredPermissions = DoorPermissionFlags.All; + if (Config.Debug) + { + var door = KEDoor.Create(null, RoleTypeId.Scp049.GetRandomSpawnLocation().Position, new()); + var d2 = KEDoor.Create(null, RoleTypeId.Scp049.GetRandomSpawnLocation().Position + Vector3.forward * 2, new()); - var door = KEDoor.Create(null,RoleTypeId.Scp049.GetRandomSpawnLocation().Position, new()); + door.LinkOtherDoor(d2); + } - var d2 =KEDoor.Create(null,RoleTypeId.Scp049.GetRandomSpawnLocation().Position+Vector3.forward*2, new()); - door.LinkOtherDoor(d2); + } From bd5842e0d4b53de8cf03367ce302b2888c8418e7 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Tue, 10 Jun 2025 05:34:48 +0200 Subject: [PATCH 263/853] update 9.6.0 --- .../KE.GlobalEventFramework.Examples.csproj | 2 +- .../KE.GlobalEventFramework/KE.GlobalEventFramework.csproj | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/KruacentExiled/KE.GlobalEventFramework.Examples/KE.GlobalEventFramework.Examples.csproj b/KruacentExiled/KE.GlobalEventFramework.Examples/KE.GlobalEventFramework.Examples.csproj index 5c287b28..7ac6c52a 100644 --- a/KruacentExiled/KE.GlobalEventFramework.Examples/KE.GlobalEventFramework.Examples.csproj +++ b/KruacentExiled/KE.GlobalEventFramework.Examples/KE.GlobalEventFramework.Examples.csproj @@ -6,7 +6,7 @@ - + diff --git a/KruacentExiled/KE.GlobalEventFramework/KE.GlobalEventFramework.csproj b/KruacentExiled/KE.GlobalEventFramework/KE.GlobalEventFramework.csproj index 023b12bd..58ae1660 100644 --- a/KruacentExiled/KE.GlobalEventFramework/KE.GlobalEventFramework.csproj +++ b/KruacentExiled/KE.GlobalEventFramework/KE.GlobalEventFramework.csproj @@ -6,7 +6,7 @@ - + From 82917c93946be52fd15eeca3ffd0efbea28d3afa Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Tue, 10 Jun 2025 05:39:48 +0200 Subject: [PATCH 264/853] update exiled so vs don't scream at me --- KruacentExiled/KE.BlackoutNDoor/KE.BlackoutNDoor.csproj | 2 +- KruacentExiled/KE.Items/KE.Items.csproj | 2 +- KruacentExiled/KE.Misc/KE.Misc.csproj | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/KruacentExiled/KE.BlackoutNDoor/KE.BlackoutNDoor.csproj b/KruacentExiled/KE.BlackoutNDoor/KE.BlackoutNDoor.csproj index 83006a05..9515ab33 100644 --- a/KruacentExiled/KE.BlackoutNDoor/KE.BlackoutNDoor.csproj +++ b/KruacentExiled/KE.BlackoutNDoor/KE.BlackoutNDoor.csproj @@ -5,7 +5,7 @@ - + diff --git a/KruacentExiled/KE.Items/KE.Items.csproj b/KruacentExiled/KE.Items/KE.Items.csproj index 8cefe524..45de12c2 100644 --- a/KruacentExiled/KE.Items/KE.Items.csproj +++ b/KruacentExiled/KE.Items/KE.Items.csproj @@ -6,7 +6,7 @@ - + diff --git a/KruacentExiled/KE.Misc/KE.Misc.csproj b/KruacentExiled/KE.Misc/KE.Misc.csproj index 452d5c70..03cbed42 100644 --- a/KruacentExiled/KE.Misc/KE.Misc.csproj +++ b/KruacentExiled/KE.Misc/KE.Misc.csproj @@ -5,7 +5,7 @@ - + From ece9ced14ab7ca1ca6fbd7389b9e82bf65612da3 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Tue, 10 Jun 2025 06:05:09 +0200 Subject: [PATCH 265/853] updated the global events --- .../Handlers/ServerHandler.cs | 2 -- .../API/Feature/MalfunctionDisplay.cs | 10 ++-------- .../GE/BrokenGenerator.cs | 2 +- .../GE/CassieGoCrazy.cs | 4 +++- .../GE/ChangedItemEffect.cs | 5 ----- .../GE/Kaboom.cs | 7 ------- .../GE/Speed.cs | 2 +- .../GE/SwapProtocol.cs | 2 +- .../GEFE/API/Features/GlobalEvent.cs | 4 ++-- .../GEFE/API/Features/Hints/DisplayHints.cs | 19 +++++++++++++++++++ .../KE.GlobalEventFramework.csproj | 1 + .../KE.GlobalEventFramework/MainPlugin.cs | 7 ++++++- 12 files changed, 36 insertions(+), 29 deletions(-) create mode 100644 KruacentExiled/KE.GlobalEventFramework/GEFE/API/Features/Hints/DisplayHints.cs diff --git a/KruacentExiled/KE.BlackoutNDoor/Handlers/ServerHandler.cs b/KruacentExiled/KE.BlackoutNDoor/Handlers/ServerHandler.cs index 5ecdd79b..2257b987 100644 --- a/KruacentExiled/KE.BlackoutNDoor/Handlers/ServerHandler.cs +++ b/KruacentExiled/KE.BlackoutNDoor/Handlers/ServerHandler.cs @@ -1,8 +1,6 @@ using KE.BlackoutNDoor.API.Features; using Exiled.API.Features; -using Exiled.Events.EventArgs.Server; using MEC; -using PluginAPI.Events; using System.Collections.Generic; namespace KE.BlackoutNDoor.Handlers diff --git a/KruacentExiled/KE.GlobalEventFramework.Examples/API/Feature/MalfunctionDisplay.cs b/KruacentExiled/KE.GlobalEventFramework.Examples/API/Feature/MalfunctionDisplay.cs index 4f6704fb..6116508e 100644 --- a/KruacentExiled/KE.GlobalEventFramework.Examples/API/Feature/MalfunctionDisplay.cs +++ b/KruacentExiled/KE.GlobalEventFramework.Examples/API/Feature/MalfunctionDisplay.cs @@ -1,16 +1,10 @@ using Exiled.API.Features; -using InventorySystem.Items.Firearms.Modules; using KE.GlobalEventFramework.Examples.API.Interfaces; -using KE.Utils; -using KE.Utils.API.Displays.DisplayRuei; -using KE.Utils.API.Displays.DisplayRuei.Enums; +using KE.GlobalEventFramework.GEFE.API.Features.Hints; using MEC; using PlayerRoles; -using System; using System.Collections.Generic; using System.Linq; -using System.Text; -using System.Threading.Tasks; namespace KE.GlobalEventFramework.Examples.API.Feature { @@ -51,7 +45,7 @@ private void ShowAllSpect(string hint) foreach (Player p in Player.List.Where(p => p.Role == RoleTypeId.Spectator)) { - DisplayPlayer.Get(p).Hint(new(HPosition.Right,VPosition.GlobalEvent, hint,RefreshRate+.01f)); + DisplayHints.AddHintEffect(p, hint, .1f); } } diff --git a/KruacentExiled/KE.GlobalEventFramework.Examples/GE/BrokenGenerator.cs b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/BrokenGenerator.cs index 8f411cc8..6daf796a 100644 --- a/KruacentExiled/KE.GlobalEventFramework.Examples/GE/BrokenGenerator.cs +++ b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/BrokenGenerator.cs @@ -16,7 +16,7 @@ public class BrokenGenerator : GlobalEvent, IStart, IEvent { public override uint Id { get; set; } = 1050; public override string Name { get; set; } = "Broken Generator"; - public override string Description { get; set; } = "Repair the generator to be able to see !"; + public override string Description { get; set; } = "Repair the generator to be able to see!"; public override int Weight { get; set; } = 0; //add event to avoid blackouts diff --git a/KruacentExiled/KE.GlobalEventFramework.Examples/GE/CassieGoCrazy.cs b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/CassieGoCrazy.cs index 70d80e6c..0af332cb 100644 --- a/KruacentExiled/KE.GlobalEventFramework.Examples/GE/CassieGoCrazy.cs +++ b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/CassieGoCrazy.cs @@ -2,7 +2,9 @@ using Exiled.API.Features.Items; using Exiled.Events.EventArgs.Player; using KE.GlobalEventFramework.GEFE.API.Features; +using KE.GlobalEventFramework.GEFE.API.Features.Hints; using KE.GlobalEventFramework.GEFE.API.Interfaces; +using KE.Utils.API.Displays.DisplayMeow; using MEC; using System.Collections.Generic; using System.Linq; @@ -141,7 +143,7 @@ void GiveRandomRewardPlayer(Player player) if (UnityEngine.Random.Range(0, 100) < RareEvent) { player.MaxHealth = 125; - player.Broadcast(5, "Another gift for you !"); + DisplayHints.AddHintEffect(player, "Another gift for you!", 5); } } diff --git a/KruacentExiled/KE.GlobalEventFramework.Examples/GE/ChangedItemEffect.cs b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/ChangedItemEffect.cs index f9da4051..7ef069ff 100644 --- a/KruacentExiled/KE.GlobalEventFramework.Examples/GE/ChangedItemEffect.cs +++ b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/ChangedItemEffect.cs @@ -1,17 +1,12 @@ using Exiled.API.Extensions; using Exiled.API.Features; using Exiled.API.Features.Items; -using Exiled.Events.EventArgs.Item; using Exiled.Events.EventArgs.Player; -using InventorySystem.Items.Usables; using KE.GlobalEventFramework.GEFE.API.Features; using KE.GlobalEventFramework.GEFE.API.Interfaces; -using PluginAPI.Events; using System; using System.Collections.Generic; using System.Linq; -using System.Text; -using System.Threading.Tasks; namespace KE.GlobalEventFramework.Examples.GE { diff --git a/KruacentExiled/KE.GlobalEventFramework.Examples/GE/Kaboom.cs b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/Kaboom.cs index 6973b3d3..5bfcad64 100644 --- a/KruacentExiled/KE.GlobalEventFramework.Examples/GE/Kaboom.cs +++ b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/Kaboom.cs @@ -4,13 +4,6 @@ using Exiled.Events.EventArgs.Player; using KE.GlobalEventFramework.GEFE.API.Features; using KE.GlobalEventFramework.GEFE.API.Interfaces; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using DoorType = Exiled.API.Enums.DoorType; - namespace KE.GlobalEventFramework.Examples.GE { public class Kaboom : GlobalEvent, IEvent diff --git a/KruacentExiled/KE.GlobalEventFramework.Examples/GE/Speed.cs b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/Speed.cs index c8d01e9c..e943707e 100644 --- a/KruacentExiled/KE.GlobalEventFramework.Examples/GE/Speed.cs +++ b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/Speed.cs @@ -66,7 +66,7 @@ private void SpeedyNut(BlinkingEventArgs ev) /// private void ReactivateEffectSpawn(ChangingRoleEventArgs ev) { - Timing.CallDelayed(1f, () => ev.Player.EnableEffect(MovementBoost, 999999999, true)); + Timing.CallDelayed(.1f, () => ev.Player.EnableEffect(MovementBoost, 999999999, true)); } } diff --git a/KruacentExiled/KE.GlobalEventFramework.Examples/GE/SwapProtocol.cs b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/SwapProtocol.cs index 2282d027..39876ff0 100644 --- a/KruacentExiled/KE.GlobalEventFramework.Examples/GE/SwapProtocol.cs +++ b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/SwapProtocol.cs @@ -23,7 +23,7 @@ public IEnumerator Start() while (!Round.IsEnded) { // every 5 min - yield return Timing.WaitForSeconds(10); + yield return Timing.WaitForSeconds(60*5); ChangingPlayer(); } } diff --git a/KruacentExiled/KE.GlobalEventFramework/GEFE/API/Features/GlobalEvent.cs b/KruacentExiled/KE.GlobalEventFramework/GEFE/API/Features/GlobalEvent.cs index 4fed631c..f566eb73 100644 --- a/KruacentExiled/KE.GlobalEventFramework/GEFE/API/Features/GlobalEvent.cs +++ b/KruacentExiled/KE.GlobalEventFramework/GEFE/API/Features/GlobalEvent.cs @@ -4,8 +4,8 @@ using MEC; using KE.GlobalEventFramework.GEFE.API.Interfaces; using System; -using KE.Utils.Display; using Exiled.Events.Commands.PluginManager; +using KE.Utils.API.Displays.DisplayMeow; namespace KE.GlobalEventFramework.GEFE.API.Features { @@ -95,7 +95,7 @@ private static void Show() ShowConsole(); foreach (Player player in Player.List) { - DisplayPlayer.Get(player).Hint(new (KE.Utils.Display.Enums.HPosition.Center,KE.Utils.Display.Enums.VPosition.GlobalEvent, ShowText(random < MainPlugin.Instance.Config.ChanceRedacted), 10)); + DisplayHandler.Instance.AddHint(MainPlugin.GEAnnouncement, player, ShowText(random < MainPlugin.Instance.Config.ChanceRedacted), 10); } } diff --git a/KruacentExiled/KE.GlobalEventFramework/GEFE/API/Features/Hints/DisplayHints.cs b/KruacentExiled/KE.GlobalEventFramework/GEFE/API/Features/Hints/DisplayHints.cs new file mode 100644 index 00000000..dbc2a4eb --- /dev/null +++ b/KruacentExiled/KE.GlobalEventFramework/GEFE/API/Features/Hints/DisplayHints.cs @@ -0,0 +1,19 @@ +using Exiled.API.Features; +using KE.Utils.API.Displays.DisplayMeow; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace KE.GlobalEventFramework.GEFE.API.Features.Hints +{ + public static class DisplayHints + { + + public static void AddHintEffect(Player player,string text,float delay) + { + DisplayHandler.Instance.AddHint(MainPlugin.GEEffect, player, text, delay); + } + } +} diff --git a/KruacentExiled/KE.GlobalEventFramework/KE.GlobalEventFramework.csproj b/KruacentExiled/KE.GlobalEventFramework/KE.GlobalEventFramework.csproj index 58ae1660..83629701 100644 --- a/KruacentExiled/KE.GlobalEventFramework/KE.GlobalEventFramework.csproj +++ b/KruacentExiled/KE.GlobalEventFramework/KE.GlobalEventFramework.csproj @@ -14,6 +14,7 @@ + diff --git a/KruacentExiled/KE.GlobalEventFramework/MainPlugin.cs b/KruacentExiled/KE.GlobalEventFramework/MainPlugin.cs index 2e0f96f4..e46cd740 100644 --- a/KruacentExiled/KE.GlobalEventFramework/MainPlugin.cs +++ b/KruacentExiled/KE.GlobalEventFramework/MainPlugin.cs @@ -9,6 +9,7 @@ using KE.GlobalEventFramework.GEFE.API.Interfaces; using ServerHandler = Exiled.Events.Handlers.Server; using Discord; +using KE.Utils.API.Displays.DisplayMeow; namespace KE.GlobalEventFramework { internal class MainPlugin : Plugin @@ -20,7 +21,11 @@ internal class MainPlugin : Plugin internal GEFE.Handlers.ServerHandler _server; - internal static MainPlugin Instance {get;private set;} + + public static readonly HintPlacement GEAnnouncement = new(0, 100, HintServiceMeow.Core.Enum.HintAlignment.Center); + public static readonly HintPlacement GEEffect = new(360, 300, HintServiceMeow.Core.Enum.HintAlignment.Right); + + internal static MainPlugin Instance {get;private set;} public override void OnEnabled() { From f21fa2e44d0b74e190d46f28bdc6c047dcd23a66 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Tue, 10 Jun 2025 06:09:43 +0200 Subject: [PATCH 266/853] increased font size --- .../KE.GlobalEventFramework/GEFE/API/Features/GlobalEvent.cs | 2 +- KruacentExiled/KE.GlobalEventFramework/MainPlugin.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/KruacentExiled/KE.GlobalEventFramework/GEFE/API/Features/GlobalEvent.cs b/KruacentExiled/KE.GlobalEventFramework/GEFE/API/Features/GlobalEvent.cs index f566eb73..2c85526c 100644 --- a/KruacentExiled/KE.GlobalEventFramework/GEFE/API/Features/GlobalEvent.cs +++ b/KruacentExiled/KE.GlobalEventFramework/GEFE/API/Features/GlobalEvent.cs @@ -95,7 +95,7 @@ private static void Show() ShowConsole(); foreach (Player player in Player.List) { - DisplayHandler.Instance.AddHint(MainPlugin.GEAnnouncement, player, ShowText(random < MainPlugin.Instance.Config.ChanceRedacted), 10); + DisplayHandler.Instance.AddHint(MainPlugin.GEAnnouncement, player, ShowText(random < MainPlugin.Instance.Config.ChanceRedacted), 10).FontSize = 30; } } diff --git a/KruacentExiled/KE.GlobalEventFramework/MainPlugin.cs b/KruacentExiled/KE.GlobalEventFramework/MainPlugin.cs index e46cd740..42c347cf 100644 --- a/KruacentExiled/KE.GlobalEventFramework/MainPlugin.cs +++ b/KruacentExiled/KE.GlobalEventFramework/MainPlugin.cs @@ -22,7 +22,7 @@ internal class MainPlugin : Plugin internal GEFE.Handlers.ServerHandler _server; - public static readonly HintPlacement GEAnnouncement = new(0, 100, HintServiceMeow.Core.Enum.HintAlignment.Center); + public static readonly HintPlacement GEAnnouncement = new(0, 50, HintServiceMeow.Core.Enum.HintAlignment.Center); public static readonly HintPlacement GEEffect = new(360, 300, HintServiceMeow.Core.Enum.HintAlignment.Right); internal static MainPlugin Instance {get;private set;} From cc7b7b869b260b9ee836d54818c69a3821334702 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Tue, 10 Jun 2025 06:26:39 +0200 Subject: [PATCH 267/853] added a nice lil light --- KruacentExiled/KE.Items/ItemEffects/MolotovEffect.cs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/KruacentExiled/KE.Items/ItemEffects/MolotovEffect.cs b/KruacentExiled/KE.Items/ItemEffects/MolotovEffect.cs index 76d90954..6af6398e 100644 --- a/KruacentExiled/KE.Items/ItemEffects/MolotovEffect.cs +++ b/KruacentExiled/KE.Items/ItemEffects/MolotovEffect.cs @@ -8,6 +8,7 @@ using System.Collections.Generic; using UnityEngine; using Exiled.Events.EventArgs.Player; +using Light = Exiled.API.Features.Toys.Light; namespace KE.Items.ItemEffects { @@ -41,17 +42,21 @@ private void SetZone(Player player,Vector3 position) Player playerThrowingGrenade = player; Vector3 molotovPosition = position; Primitive wall = Primitive.Create(PrimitiveType.Cylinder, molotovPosition, null, new Vector3(cylinderSize, 0.01f, cylinderSize), true); + var l = Light.Create(position, null, null, false); + l.Color = new Color(255,128,0); + l.Intensity = .05f; + l.Spawn(); wall.Collidable = false; wall.Visible = true; - wall.Color = Color.red; + wall.Color = new Color(255, 128, 0); var coroutineHandler = Timing.RunCoroutine(DamageInMolotovZone(wall.Position, cylinderSize, playerThrowingGrenade)); Timing.CallDelayed(Duration, () => { - wall.UnSpawn(); Timing.KillCoroutines(coroutineHandler); wall.Destroy(); + l.Destroy(); }); } From 142b20bd11bdaaf392cc60a046d96fad40154786 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Tue, 10 Jun 2025 06:32:37 +0200 Subject: [PATCH 268/853] changed the refresh rate --- .../API/Feature/MalfunctionDisplay.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/KruacentExiled/KE.GlobalEventFramework.Examples/API/Feature/MalfunctionDisplay.cs b/KruacentExiled/KE.GlobalEventFramework.Examples/API/Feature/MalfunctionDisplay.cs index 6116508e..0391dfe2 100644 --- a/KruacentExiled/KE.GlobalEventFramework.Examples/API/Feature/MalfunctionDisplay.cs +++ b/KruacentExiled/KE.GlobalEventFramework.Examples/API/Feature/MalfunctionDisplay.cs @@ -11,7 +11,7 @@ namespace KE.GlobalEventFramework.Examples.API.Feature public class MalfunctionDisplay { private Malfunctions _malfunction; - public float RefreshRate { get; set; } = 5; + public float RefreshRate { get; set; } = 1; private CoroutineHandle _coroutineHandle; public MalfunctionDisplay(Malfunctions malfunction) { @@ -45,7 +45,7 @@ private void ShowAllSpect(string hint) foreach (Player p in Player.List.Where(p => p.Role == RoleTypeId.Spectator)) { - DisplayHints.AddHintEffect(p, hint, .1f); + DisplayHints.AddHintEffect(p, hint, RefreshRate); } } From be833d9debba774309d3564574e043c99d040f34 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Tue, 10 Jun 2025 07:07:03 +0200 Subject: [PATCH 269/853] update --- KruacentExiled/KE.Misc/KE.Misc.csproj | 2 +- KruacentExiled/KE.Misc/Misc/CR/Scp035.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/KruacentExiled/KE.Misc/KE.Misc.csproj b/KruacentExiled/KE.Misc/KE.Misc.csproj index 8a6e762d..8b0236ca 100644 --- a/KruacentExiled/KE.Misc/KE.Misc.csproj +++ b/KruacentExiled/KE.Misc/KE.Misc.csproj @@ -6,7 +6,7 @@ - + diff --git a/KruacentExiled/KE.Misc/Misc/CR/Scp035.cs b/KruacentExiled/KE.Misc/Misc/CR/Scp035.cs index 5fab3fa3..890dcd29 100644 --- a/KruacentExiled/KE.Misc/Misc/CR/Scp035.cs +++ b/KruacentExiled/KE.Misc/Misc/CR/Scp035.cs @@ -22,7 +22,7 @@ public class Scp035 : CustomRole public override RoleTypeId Role { get; set; } = RoleTypeId.Tutorial; public override int MaxHealth { get; set; } = 600; public override string Name { get; set; } = "SCP-035"; - public override string CustomInfo { get; set; } = string.Empty; + public override string CustomInfo { get; set; } = "SCP-035"; public override bool IgnoreSpawnSystem { get; set; } = true; public override SpawnProperties SpawnProperties { get; set; } = new() { From 8e4b5169bfd3e6bdc7a2a21e98338d5757cc29c9 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Thu, 12 Jun 2025 08:34:01 +0200 Subject: [PATCH 270/853] reorg the misc and changed the ff mechanics --- .../KE.BlackoutNDoor/KE.BlackoutNDoor.csproj | 2 +- .../KE.GlobalEventFramework.Examples.csproj | 2 +- .../KE.Misc/Handlers/ServerHandler.cs | 13 +-- KruacentExiled/KE.Misc/MainPlugin.cs | 53 +++------ KruacentExiled/KE.Misc/Misc/914.cs | 13 ++- KruacentExiled/KE.Misc/Misc/Candy.cs | 12 +- KruacentExiled/KE.Misc/Misc/FriendlyFire.cs | 60 ++++++++++ KruacentExiled/KE.Misc/Misc/MiscFeature.cs | 48 ++++++++ KruacentExiled/KE.Misc/Misc/Spawn.cs | 109 ++++++------------ KruacentExiled/KE.Misc/Misc/SurfaceLight.cs | 50 +++++--- .../KE.Utils/Display/DisplayPlayer.cs | 109 ------------------ .../KE.Utils/Display/Enums/HPosition.cs | 15 --- .../KE.Utils/Display/Enums/VPosition.cs | 15 --- KruacentExiled/KE.Utils/Display/Position.cs | 67 ----------- KruacentExiled/KE.Utils/Display/RueIHint.cs | 34 ------ .../KE.Utils/Extensions/AdminToyExtension.cs | 1 - .../KE.Utils/Tests/PrimitiveTest.cs | 27 ----- 17 files changed, 220 insertions(+), 410 deletions(-) create mode 100644 KruacentExiled/KE.Misc/Misc/FriendlyFire.cs create mode 100644 KruacentExiled/KE.Misc/Misc/MiscFeature.cs delete mode 100644 KruacentExiled/KE.Utils/Display/DisplayPlayer.cs delete mode 100644 KruacentExiled/KE.Utils/Display/Enums/HPosition.cs delete mode 100644 KruacentExiled/KE.Utils/Display/Enums/VPosition.cs delete mode 100644 KruacentExiled/KE.Utils/Display/Position.cs delete mode 100644 KruacentExiled/KE.Utils/Display/RueIHint.cs delete mode 100644 KruacentExiled/KE.Utils/Tests/PrimitiveTest.cs diff --git a/KruacentExiled/KE.BlackoutNDoor/KE.BlackoutNDoor.csproj b/KruacentExiled/KE.BlackoutNDoor/KE.BlackoutNDoor.csproj index 5d972f3c..4d4b6e71 100644 --- a/KruacentExiled/KE.BlackoutNDoor/KE.BlackoutNDoor.csproj +++ b/KruacentExiled/KE.BlackoutNDoor/KE.BlackoutNDoor.csproj @@ -7,7 +7,7 @@ - + diff --git a/KruacentExiled/KE.GlobalEventFramework.Examples/KE.GlobalEventFramework.Examples.csproj b/KruacentExiled/KE.GlobalEventFramework.Examples/KE.GlobalEventFramework.Examples.csproj index 5b8b84df..7f6cf4e9 100644 --- a/KruacentExiled/KE.GlobalEventFramework.Examples/KE.GlobalEventFramework.Examples.csproj +++ b/KruacentExiled/KE.GlobalEventFramework.Examples/KE.GlobalEventFramework.Examples.csproj @@ -5,7 +5,7 @@ - + diff --git a/KruacentExiled/KE.Misc/Handlers/ServerHandler.cs b/KruacentExiled/KE.Misc/Handlers/ServerHandler.cs index 2c88addf..18889054 100644 --- a/KruacentExiled/KE.Misc/Handlers/ServerHandler.cs +++ b/KruacentExiled/KE.Misc/Handlers/ServerHandler.cs @@ -9,18 +9,17 @@ internal class ServerHandler private CoroutineHandle coroutineHandle; public void OnRoundStarted() { - if(MainPlugin.Instance.Config.ChanceFF >= 0 && MainPlugin.Instance.Config.ChanceFF <= 100) - MainPlugin.Instance.RandomFF(); if (MainPlugin.Instance.Config.ChanceClassDDoorGoesBoom >= 0 && MainPlugin.Instance.Config.ChanceClassDDoorGoesBoom <= 100) MainPlugin.Instance.ClassDDoor.ClassDDoorGoesBoom(); if(MainPlugin.Instance.Config.AutoNukeAnnoucement) Timing.RunCoroutineSingleton(MainPlugin.Instance.NukeAnnouncement(), coroutineHandle,SingletonBehavior.Abort); - if(MainPlugin.Instance.Config.PeanutLockDown) - Timing.RunCoroutine(MainPlugin.Instance.PeanutLockdown()); - if(MainPlugin.Instance.Config.AutoElevator) + if (MainPlugin.Instance.Config.PeanutLockDown) + { + //Timing.RunCoroutine(MainPlugin.Instance.PeanutLockdown()); + } + + if (MainPlugin.Instance.Config.AutoElevator) Timing.RunCoroutine(MainPlugin.Instance.AutoElevator.StartElevator()); - if (MainPlugin.Instance.Config.SurfaceLight && UnityEngine.Random.value < .75f) - MainPlugin.Instance.SurfaceLight.ChangeSurfaceLight(); MainPlugin.Instance.SCPBuff.StartBuff(); } } diff --git a/KruacentExiled/KE.Misc/MainPlugin.cs b/KruacentExiled/KE.Misc/MainPlugin.cs index c13600ea..6bcecb27 100644 --- a/KruacentExiled/KE.Misc/MainPlugin.cs +++ b/KruacentExiled/KE.Misc/MainPlugin.cs @@ -11,12 +11,6 @@ using System; using KE.Misc.Misc; using KE.Misc.Handlers; -using KE.Utils.Display; -using KE.Utils.Display.Enums; -using Exiled.API.Extensions; -using Exiled.Events.Commands.Hub; -using RueI.Displays; -using RueI.Extensions; using Exiled.CustomRoles.API.Features; using KE.Misc.Misc.CR; @@ -37,6 +31,7 @@ public class MainPlugin : Plugin internal SurfaceLight SurfaceLight { get; private set; } internal SCPBuff SCPBuff { get; private set; } internal Spawn Spawn { get; private set; } + internal FriendlyFire FriendlyFire { get; private set; } public override void OnEnabled() { @@ -48,64 +43,43 @@ public override void OnEnabled() ServerHandler = new ServerHandler(); Spawn = new Spawn(); SCPBuff = new SCPBuff(); - if (Instance.Config.ChancePinkCandy >= 0 && Instance.Config.ChancePinkCandy <= 100) - { - Candy = new Candy(); - Exiled.Events.Handlers.Scp330.InteractingScp330 += Candy.InteractingScp330; - } - else - { - Log.Error("ChancePinkCandy must be between 0 and 100"); - } + FriendlyFire = new(); + Candy = new Candy(); Respawn.SetTokens(SpawnableFaction.NtfWave, 2); Respawn.SetTokens(SpawnableFaction.ChaosWave, 2); - + MiscFeature.SubscribeAllEvents(); Exiled.Events.Handlers.Player.ChangingRole += SCPBuff.BecomingSCP; - ServerHandle.RoundStarted += Spawn.OnRoundStarted; ServerHandle.RoundStarted += ServerHandler.OnRoundStarted; - Nine14Handle.UpgradingPlayer += _914.OnUpgradingPlayer; Exiled.Events.Handlers.Player.Dying += ScpNoeDeathMessage; - ServerHandle.EndingRound += Spawn.EndingRound; CustomRole.RegisterRoles(false, null, true, this.Assembly); } + public override void OnDisabled() { ServerHandle.RoundStarted -= ServerHandler.OnRoundStarted; - Nine14Handle.UpgradingPlayer -= _914.OnUpgradingPlayer; Exiled.Events.Handlers.Player.Dying -= ScpNoeDeathMessage; - ServerHandle.RoundStarted -= Spawn.OnRoundStarted; - ServerHandle.EndingRound -= Spawn.EndingRound; - if (Instance.Config.ChancePinkCandy >= 0 && Instance.Config.ChancePinkCandy <= 100) - { - Exiled.Events.Handlers.Scp330.InteractingScp330 -= Candy.InteractingScp330; - Candy = null; - } + MiscFeature.UnsubscribeAllEvents(); + CustomRole.UnregisterRoles([typeof(Scp035)]); _914 = null; + Candy = null; ClassDDoor = null; ServerHandler = null; SCPBuff = null; + Spawn = null; AutoElevator = null; - Instance = null; + FriendlyFire = null; SurfaceLight = null; + Instance = null; } - /// - /// Set the Friendly Fire to true or false at random - /// - internal void RandomFF() - { - Server.FriendlyFire = UnityEngine.Random.Range(0, 101) < Instance.Config.ChanceFF; - Log.Info($"Friendly Fire : {Server.FriendlyFire}"); - } - /// /// C.A.S.S.I.E. announce 5 min before the autonuke /// @@ -124,8 +98,9 @@ internal IEnumerator NukeAnnouncement() /// internal IEnumerator PeanutLockdown() { + Log.Debug("peanut lockdown"); - Door peanutDoor = Door.List.First(x => x.Type == DoorType.Scp173NewGate); + Door peanutDoor = Door.List.First(x => x.Type == DoorType.Scp173NewGate); // broken 049 gate is considered as 173 new gate for some reason peanutDoor.IsOpen = false; peanutDoor.ChangeLock(DoorLockType.Isolation); CoroutineHandle a; @@ -158,7 +133,7 @@ private IEnumerator Timer(int secondsWaiting, string msg = "done") yield return Timing.WaitForSeconds(1); secondsWaiting--; } - playerToShow.ForEach(p => DisplayPlayer.Get(p).Hint(new Position(HPosition.Center,VPosition.CustomRole),msg)); + //playerToShow.ForEach(p => DisplayPlayer.Get(p).Hint(new Position(HPosition.Center,VPosition.CustomRole),msg)); } diff --git a/KruacentExiled/KE.Misc/Misc/914.cs b/KruacentExiled/KE.Misc/Misc/914.cs index b6971905..54dc5079 100644 --- a/KruacentExiled/KE.Misc/Misc/914.cs +++ b/KruacentExiled/KE.Misc/Misc/914.cs @@ -18,7 +18,7 @@ namespace KE.Misc.Misc /// /// Everything 914 related /// - internal class _914 + internal class _914 : MiscFeature { internal Dictionary roleScp = new Dictionary() @@ -32,6 +32,17 @@ internal class _914 { 1, RoleTypeId.Scp079 }, }; + + public override void SubscribeEvents() + { + Exiled.Events.Handlers.Scp914.UpgradingPlayer += OnUpgradingPlayer; + } + + public override void UnsubscribeEvents() + { + Exiled.Events.Handlers.Scp914.UpgradingPlayer -= OnUpgradingPlayer; + } + internal void OnUpgradingPlayer(UpgradingPlayerEventArgs ev) { Log.Debug("upgrading player"); diff --git a/KruacentExiled/KE.Misc/Misc/Candy.cs b/KruacentExiled/KE.Misc/Misc/Candy.cs index 603ae26a..40bcb01c 100644 --- a/KruacentExiled/KE.Misc/Misc/Candy.cs +++ b/KruacentExiled/KE.Misc/Misc/Candy.cs @@ -9,8 +9,18 @@ namespace KE.Misc.Misc { - internal class Candy + internal class Candy : MiscFeature { + + public override void SubscribeEvents() + { + Exiled.Events.Handlers.Scp330.InteractingScp330 += InteractingScp330; + } + + public override void UnsubscribeEvents() + { + Exiled.Events.Handlers.Scp330.InteractingScp330 -= InteractingScp330; + } public void InteractingScp330(InteractingScp330EventArgs ev) { if (UnityEngine.Random.Range(0, 100) < MainPlugin.Instance.Config.ChancePinkCandy) diff --git a/KruacentExiled/KE.Misc/Misc/FriendlyFire.cs b/KruacentExiled/KE.Misc/Misc/FriendlyFire.cs new file mode 100644 index 00000000..4cf73019 --- /dev/null +++ b/KruacentExiled/KE.Misc/Misc/FriendlyFire.cs @@ -0,0 +1,60 @@ +using Exiled.API.Features; +using Exiled.Events.EventArgs.Player; +using Exiled.Events.EventArgs.Warhead; +using KE.Utils.API.Interfaces; + +namespace KE.Misc.Misc +{ + internal class FriendlyFire : MiscFeature + { + public byte ChanceAtStart = 50; + public byte ChanceAtScpDeath = 20; + public byte ChanceAtWarheadStart = 100; + + + + public override void SubscribeEvents() + { + Exiled.Events.Handlers.Player.Dying += OnDying; + Exiled.Events.Handlers.Server.RoundStarted += OnRoundStarted; + Exiled.Events.Handlers.Warhead.Starting += OnStarting; + } + + public override void UnsubscribeEvents() + { + Exiled.Events.Handlers.Player.Dying -= OnDying; + Exiled.Events.Handlers.Server.RoundStarted -= OnRoundStarted; + Exiled.Events.Handlers.Warhead.Starting -= OnStarting; + + } + + public void OnStarting(StartingEventArgs ev) + { + if (UnityEngine.Random.Range(0, 101) >= ChanceAtScpDeath) return; + Server.FriendlyFire = !Server.FriendlyFire; + } + + + private void OnRoundStarted() + { + Server.FriendlyFire = UnityEngine.Random.Range(0, 101) < ChanceAtStart; + } + + + + private void OnDying(DyingEventArgs ev) + { + if (!ev.Player.IsScp) return; + if (UnityEngine.Random.Range(0, 101) >= ChanceAtScpDeath) return; + Server.FriendlyFire = !Server.FriendlyFire; + + + } + + + + + + + } +} diff --git a/KruacentExiled/KE.Misc/Misc/MiscFeature.cs b/KruacentExiled/KE.Misc/Misc/MiscFeature.cs new file mode 100644 index 00000000..1e1419d0 --- /dev/null +++ b/KruacentExiled/KE.Misc/Misc/MiscFeature.cs @@ -0,0 +1,48 @@ +using Exiled.API.Features; +using KE.Utils.API.Interfaces; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace KE.Misc.Misc +{ + internal abstract class MiscFeature : IUsingEvents + { + private static HashSet _list = new(); + + + internal MiscFeature() + { + _list.Add(this); + } + + internal static void SubscribeAllEvents() + { + foreach (MiscFeature f in _list) + { + Log.Debug($"subscribing events in {f.GetType()}"); + f.SubscribeEvents(); + } + + } + + internal static void UnsubscribeAllEvents() + { + foreach (MiscFeature f in _list) + f.UnsubscribeEvents(); + _list.Clear(); + } + + + public virtual void SubscribeEvents() + { + + } + public virtual void UnsubscribeEvents() + { + + } + } +} diff --git a/KruacentExiled/KE.Misc/Misc/Spawn.cs b/KruacentExiled/KE.Misc/Misc/Spawn.cs index ff0344ea..5e789e6f 100644 --- a/KruacentExiled/KE.Misc/Misc/Spawn.cs +++ b/KruacentExiled/KE.Misc/Misc/Spawn.cs @@ -1,33 +1,26 @@ -using CommandSystem; -using Exiled.API.Enums; +using Exiled.API.Enums; using Exiled.API.Extensions; using Exiled.API.Features; -using Exiled.API.Features.Attributes; using Exiled.CustomRoles.API.Features; using Exiled.Events.EventArgs.Server; using KE.Misc.Misc.CR; -using KE.Utils.Display; +using KE.Utils.API.Interfaces; using MEC; using PlayerRoles; -using RueI.Displays; -using RueI.Elements; using System; using System.Collections.Generic; using System.Linq; namespace KE.Misc.Misc { - public class Spawn + internal class Spawn : MiscFeature { private bool _set035 = true; - private Dictionary _players = []; public void OnRoundStarted() { if (!MainPlugin.Instance.Config.ScpPreferences) return; - HashSet pl = Player.List.Where(p=> p.IsScp).ToHashSet(); - - foreach (Player player in pl) + foreach (Player player in Player.List.Where(p => p.IsScp && !p.IsNPC)) { SetScpPreferences(player); } @@ -36,21 +29,24 @@ public void OnRoundStarted() private void SetScpPreferences(Player player) { Config config = MainPlugin.Instance.Config; - if(config == null) return; - Dictionary chancescp = player.ScpPreferences.Preferences.ToDictionary(p => p.Key, p => p.Value + 6); + if (config == null) + { + Log.Warn("no config, no custom preferences this round"); + return; + } + Dictionary chancescp = (Dictionary) GetPreferences(player); RoleTypeId roleScp = ChooseRandomRole(chancescp); Log.Debug($"Scp ({player.Nickname}) is {roleScp} previous : {player.Role.Type}"); player.Role.Set(roleScp); - SupportClassBackup(player); if (config.Scp035Enabled && roleScp == RoleTypeId.Scp079) { Player pl = Player.List.GetRandomValue(p => p.Role == RoleTypeId.ClassD || p.Role == RoleTypeId.Scientist); - RoleTypeId otherScp = ChooseRandomRole(pl.ScpPreferences.Preferences.ToDictionary(p => p.Key, p => p.Value + 6)); + RoleTypeId otherScp = ChooseRandomRole(GetPreferences(pl)); - if(otherScp == RoleTypeId.Scp079) + if (otherScp == RoleTypeId.Scp079) { _set035 = !_set035; if (_set035) @@ -67,37 +63,29 @@ private void SetScpPreferences(Player player) else { pl.Role.Set(otherScp); - SupportClassBackup(pl); Timing.CallDelayed(1f, () => { pl.MaxHealth /= 2; pl.Health = pl.MaxHealth; }); } - + } } - private void SupportClassBackup(Player player) + private IDictionary GetPreferences(Player player) { - if (player.Role == RoleTypeId.Scp096 || player.Role == RoleTypeId.Scp079 && !MainPlugin.Instance.Config.Scp035Enabled || MainPlugin.Instance.Config.Debug) return; - float timetodecide = 60; - RueIHint h = new(Utils.Display.Enums.HPosition.Center, Utils.Display.Enums.VPosition.CustomRole, "You're a support class \nYou can change your scp by doing the command .scp \n(eg .scp 173 -> scp-173)", timetodecide); - var a = DisplayPlayer.Get(player).Hint(h); - ChangeSCP._players.Add(player, a); - Timing.CallDelayed(timetodecide, () => - { - ChangeSCP._players.Remove(player); - DisplayPlayer.Get(player).RemoveHint(a); - }); + if (player.ScpPreferences.Preferences == null) return new Dictionary(); + return player.ScpPreferences.Preferences.ToDictionary(p => p.Key, p => p.Value + 5); } - - private RoleTypeId ChooseRandomRole(Dictionary chancescp) + + private RoleTypeId ChooseRandomRole(IDictionary chancescp) { + if (chancescp == null) throw new ArgumentException("Dictionary null"); List weightedPool = new List(); foreach (RoleTypeId ge in chancescp.Keys) { @@ -114,6 +102,20 @@ private RoleTypeId ChooseRandomRole(Dictionary chancescp) return weightedPool[randomIndex]; } + + + public override void SubscribeEvents() + { + Exiled.Events.Handlers.Server.EndingRound += EndingRound; + Exiled.Events.Handlers.Server.RoundStarted += OnRoundStarted; + } + + public override void UnsubscribeEvents() + { + Exiled.Events.Handlers.Server.EndingRound -= EndingRound; + Exiled.Events.Handlers.Server.RoundStarted -= OnRoundStarted; + } + public void EndingRound(EndingRoundEventArgs ev) { if (Scp035._trackedPlayers.Count <= 0) return; @@ -127,49 +129,4 @@ public void EndingRound(EndingRoundEventArgs ev) - [CommandHandler(typeof(ClientCommandHandler))] - public class ChangeSCP : ICommand - { - internal static Dictionary _players = new(); - public string Command { get; } = "scp"; - public string[] Aliases { get; } = new string[] { }; - public string Description { get; } = "change scp"; - - public bool Execute(ArraySegment arguments, ICommandSender sender, out string response) - { - Player psender = Player.Get(sender); - - if (psender == null) - { - response = string.Empty; - return false; - } - - if (!_players.ContainsKey(psender)) - { - response = "you're not authorized to use this command"; - return false; - } - if(arguments.Count < 1) - { - response = "not enough argument usage: .scp \n(eg .scp Scp173 -> scp-173)"; - return false; - } - - string scp = arguments.At(0); - if (!Enum.TryParse(scp, out RoleTypeId roleType) && roleType.IsScp() && roleType != RoleTypeId.Scp0492) - { - response = "wrong scp number \n(eg .scp Scp173 -> scp-173)"; - return false; - } - - psender.Role.Set(roleType); - DisplayPlayer.Get(psender).RemoveHint(_players[psender]); - _players.Remove(psender); - - response = $"you're now SCP-{scp}"; - return true; - } - - } } diff --git a/KruacentExiled/KE.Misc/Misc/SurfaceLight.cs b/KruacentExiled/KE.Misc/Misc/SurfaceLight.cs index 4b3bd410..e6bd9bef 100644 --- a/KruacentExiled/KE.Misc/Misc/SurfaceLight.cs +++ b/KruacentExiled/KE.Misc/Misc/SurfaceLight.cs @@ -3,37 +3,55 @@ using UnityEngine; using System.Collections.Generic; using System.Linq; +using Exiled.API.Extensions; namespace KE.Misc.Misc { /// /// Everything about Surface Light /// - internal class SurfaceLight + internal class SurfaceLight : MiscFeature { - /// - /// Change Surface Light Color - /// - internal void ChangeSurfaceLight() + + private HashSet _colors = new() { - List colors = new[] - { - Color.cyan, - Color.red, - Color.green, - Color.white, - Color.blue - }.ToList(); + Color.cyan, + Color.red, + Color.green, + Color.white, + Color.blue + }; - // Select a random color - Color randomColor = colors[Random.Range(0, colors.Count)]; + public override void SubscribeEvents() + { + Exiled.Events.Handlers.Server.RoundStarted += OnRoundStarted; + } + + public override void UnsubscribeEvents() + { + Exiled.Events.Handlers.Server.RoundStarted -= OnRoundStarted; + + } + + + private void OnRoundStarted() + { + if(Random.value < .75f) + ChangeSurfaceLight(); + } + + private void ChangeSurfaceLight() + { + + // Select a random color + Color randomColor = _colors.GetRandomValue(); foreach (var room in Room.List.Where(r => r.Type == RoomType.Surface)) { room.Color = randomColor; } - Log.Info($"Changed Surface light color to {randomColor}."); + Log.Debug($"Changed Surface light color to {randomColor}."); } } } diff --git a/KruacentExiled/KE.Utils/Display/DisplayPlayer.cs b/KruacentExiled/KE.Utils/Display/DisplayPlayer.cs deleted file mode 100644 index 4c4c16fb..00000000 --- a/KruacentExiled/KE.Utils/Display/DisplayPlayer.cs +++ /dev/null @@ -1,109 +0,0 @@ -using Exiled.API.Features; -using Exiled.API.Interfaces; -using KE.Utils.Display.Enums; -using MEC; -using RueI.Displays; -using RueI.Elements; -using RueI.Elements.Delegates; -using RueI.Elements.Enums; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using System.Xml.Linq; - -namespace KE.Utils.Display -{ - public class DisplayPlayer - { - private static Dictionary _displays = new(); - private RueI.Displays.Display _display; - private Dictionary _hints = new(); - private Player _player; - public Player Player { get { return _player; } } - public static DisplayPlayer Get(Player player) - { - if (!_displays.ContainsKey(player)) - _displays.Add(player, new DisplayPlayer(player)); - return _displays[player]; - } - - public DisplayPlayer(Player player) - { - _player = player; - _display = new (DisplayCore.Get(player.ReferenceHub)); - } - - public Element Hint(Position position, string text) - { - if (_hints.ContainsKey(position)) return null; - SetElement element = new((float)position.VPosition, $"" + text + ""); - _display.Elements.Add(element); - _hints.Add(position, element); - UpdateCore(); - return element; - } - - [Obsolete("doesn't work don't use it",true)] - public DynamicElement Hint(Position position, GetContent getContent) - { - DynamicElement element = new(getContent, position.RawVPosition); - _display.Elements.Add(element); - _hints.Add(position, element); - UpdateCore(); - return element; - } - - - public Element Hint(Position position,string text,float seconds) - { - if (_hints.ContainsKey(position)) return null; - SetElement element = new((float)position.VPosition, $""+text+""); - _display.Elements.Add(element); - _hints.Add(position, element); - UpdateCore(); - Timing.CallDelayed(seconds, () => - { - _display.Elements.Remove(element); - _hints.Remove(position); - UpdateCore(); - }); - return element; - } - - - public Element Hint(RueIHint hint) - { - if (hint.Duration < 0) - return Hint(hint.Position, hint.RawContent); - return Hint(hint.Position,hint.RawContent,hint.Duration); - } - - public bool RemoveHint(Position placement) - { - if (!_hints.ContainsKey(placement)) return false; - bool result = _display.Elements.Remove(_hints[placement]); - _hints.Remove(placement); - UpdateCore(); - return result; - } - - public bool RemoveHint(Element elem) - { - bool result = _display.Elements.Remove(elem); - _hints.Remove(_hints.First(x => x.Value == elem).Key); - UpdateCore(); - return result; - } - - private void UpdateCore() => UpdateCore(_player); - public static void UpdateCore(Player player) => DisplayCore.Get(player.ReferenceHub).Update(); - - - } - - - - -} diff --git a/KruacentExiled/KE.Utils/Display/Enums/HPosition.cs b/KruacentExiled/KE.Utils/Display/Enums/HPosition.cs deleted file mode 100644 index 023c8016..00000000 --- a/KruacentExiled/KE.Utils/Display/Enums/HPosition.cs +++ /dev/null @@ -1,15 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace KE.Utils.Display.Enums -{ - public enum HPosition - { - Left, - Center, - Right, - } -} diff --git a/KruacentExiled/KE.Utils/Display/Enums/VPosition.cs b/KruacentExiled/KE.Utils/Display/Enums/VPosition.cs deleted file mode 100644 index 264c78dd..00000000 --- a/KruacentExiled/KE.Utils/Display/Enums/VPosition.cs +++ /dev/null @@ -1,15 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace KE.Utils.Display.Enums -{ - public enum VPosition - { - GlobalEvent = 900, - CustomItem = 200, - CustomRole = 400, - } -} diff --git a/KruacentExiled/KE.Utils/Display/Position.cs b/KruacentExiled/KE.Utils/Display/Position.cs deleted file mode 100644 index 5b819d75..00000000 --- a/KruacentExiled/KE.Utils/Display/Position.cs +++ /dev/null @@ -1,67 +0,0 @@ -using KE.Utils.Display.Enums; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace KE.Utils.Display -{ - public struct Position - { - private HPosition _hposition; - public HPosition HPosition { get { return _hposition; } } - private float _vposition; - [Obsolete("use RawVPosition Instead")] - public VPosition VPosition { get { return (VPosition)_vposition; } } - public float RawVPosition { get { return _vposition; } } - - private static readonly Position globalEvent = new (HPosition.Center, 900); - private static readonly Position customItemShow = new(HPosition.Right, 200); - private static readonly Position customRoleShow = new(HPosition.Left, 200); - private static readonly Position customRoleEffect = new(HPosition.Left, 400); - private static readonly Position customGlobalEffect = new(HPosition.Right, 400); - public static Position GlobalEvent - { - get { return globalEvent; } - } - public static Position CustomItemShow - { - get { return customItemShow; } - } - public static Position CustomRoleShow - { - get { return customRoleShow; } - } - public static Position CustomRoleEffect - { - get { return customRoleEffect; } - } - public static Position CustomGlobalEffect - { - get { return customGlobalEffect; } - } - - public Position(HPosition hposition, VPosition vposition) - { - _hposition = hposition; - _vposition = (float) vposition; - } - - public Position(HPosition hposition, float vposition) - { - _hposition = hposition; - _vposition = vposition; - } - - public override bool Equals(object obj) - { - Position pos = (Position)obj; - return pos.VPosition == VPosition && pos.HPosition == HPosition; - } - public override int GetHashCode() - { - return base.GetHashCode(); - } - } -} diff --git a/KruacentExiled/KE.Utils/Display/RueIHint.cs b/KruacentExiled/KE.Utils/Display/RueIHint.cs deleted file mode 100644 index af4cd7b4..00000000 --- a/KruacentExiled/KE.Utils/Display/RueIHint.cs +++ /dev/null @@ -1,34 +0,0 @@ -using KE.Utils.Display.Enums; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace KE.Utils.Display -{ - public class RueIHint - { - private Position _position; - public Position Position { get { return _position; } } - private string _content; - public string RawContent { get { return _content; } } - private float _duration = -1; - public float Duration { get { return _duration; } } - - public RueIHint(HPosition hposition, VPosition vposition, string content) - { - _position = new(hposition, vposition); - _content = content; - } - public RueIHint(HPosition hposition, VPosition vposition, string content,float duration) - { - _position = new(hposition, vposition); - _content = content; - _duration = duration; - } - - - - } -} diff --git a/KruacentExiled/KE.Utils/Extensions/AdminToyExtension.cs b/KruacentExiled/KE.Utils/Extensions/AdminToyExtension.cs index aaeead7e..5eee9c7b 100644 --- a/KruacentExiled/KE.Utils/Extensions/AdminToyExtension.cs +++ b/KruacentExiled/KE.Utils/Extensions/AdminToyExtension.cs @@ -19,7 +19,6 @@ public static void SetAsPickupAdminToy(this AdminToy toy, bool autoSync = true) { QualityHandler.Instance.QualityToysHandler.SetAsPickup(toy); } - NetworkIdentity playerIdentity = playertoshow.NetworkIdentity; public static void SetQuality(this AdminToy toy, ModelQuality modelQuality,bool autoSync = true) { diff --git a/KruacentExiled/KE.Utils/Tests/PrimitiveTest.cs b/KruacentExiled/KE.Utils/Tests/PrimitiveTest.cs deleted file mode 100644 index e659d098..00000000 --- a/KruacentExiled/KE.Utils/Tests/PrimitiveTest.cs +++ /dev/null @@ -1,27 +0,0 @@ -using Exiled.API.Features; -using Exiled.API.Features.Pickups; -using Exiled.API.Features.Toys; -using KE.Utils.Extensions; -using Mirror; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using UnityEngine; - -namespace KE.Utils.Tests -{ - public static class PrimitiveTest - { - - public static void TestSetFakePrimitive(Player pl) - { - Primitive p = Primitive.Create(pl.Position+UnityEngine.Vector3.forward, null, null, true, UnityEngine.Color.blue); - p.SetFakePrimitive(pl); - - p = Primitive.Create(pl.Position+ UnityEngine.Vector3.back,null,null,true,UnityEngine.Color.red); - p.SetFakePrimitive(null); - } - } -} From 3593db90c0541dc0aa95e1d7343c3d1461533297 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Thu, 12 Jun 2025 08:34:46 +0200 Subject: [PATCH 271/853] removed ruei --- .../KE.Utils/Display/DisplayPlayer.cs | 111 ------------------ .../KE.Utils/Display/Enums/HPosition.cs | 15 --- .../KE.Utils/Display/Enums/VPosition.cs | 16 --- KruacentExiled/KE.Utils/Display/RueIHint.cs | 34 ------ 4 files changed, 176 deletions(-) delete mode 100644 KruacentExiled/KE.Utils/Display/DisplayPlayer.cs delete mode 100644 KruacentExiled/KE.Utils/Display/Enums/HPosition.cs delete mode 100644 KruacentExiled/KE.Utils/Display/Enums/VPosition.cs delete mode 100644 KruacentExiled/KE.Utils/Display/RueIHint.cs diff --git a/KruacentExiled/KE.Utils/Display/DisplayPlayer.cs b/KruacentExiled/KE.Utils/Display/DisplayPlayer.cs deleted file mode 100644 index 9a315715..00000000 --- a/KruacentExiled/KE.Utils/Display/DisplayPlayer.cs +++ /dev/null @@ -1,111 +0,0 @@ -using Exiled.API.Features; -using Exiled.API.Interfaces; -using KE.Utils.Display.Enums; -using MEC; -using RueI.Displays; -using RueI.Elements; -using RueI.Elements.Enums; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace KE.Utils.Display -{ - public class DisplayPlayer - { - private static Dictionary _displays = new(); - private RueI.Displays.Display _display; - private Dictionary _hints = new(); - private Player _player; - public Player Player { get { return _player; } } - public static DisplayPlayer Get(Player player) - { - if (!_displays.ContainsKey(player)) - _displays.Add(player, new DisplayPlayer(player)); - return _displays[player]; - } - - private DisplayPlayer(Player player) - { - _player = player; - _display = new (DisplayCore.Get(player.ReferenceHub)); - } - - public Element Hint(Position position, string text) - { - if (_hints.ContainsKey(position)) return null; - SetElement element = new((float)position.VPosition, $"" + text + ""); - _display.Elements.Add(element); - _hints.Add(position, element); - UpdateCore(_player); - return element; - } - - - public Element Hint(Position position,string text,float seconds) - { - if (_hints.ContainsKey(position)) return null; - SetElement element = new((float)position.VPosition, $""+text+""); - _display.Elements.Add(element); - _hints.Add(position, element); - UpdateCore(_player); - Timing.CallDelayed(seconds, () => - { - _display.Elements.Remove(element); - _hints.Remove(position); - UpdateCore(_player); - }); - return element; - } - - - public Element Hint(RueIHint hint) - { - if (hint.Duration < 0) - return Hint(hint.Position, hint.RawContent); - return Hint(hint.Position,hint.RawContent,hint.Duration); - } - - public bool RemoveHint(Position placement) - { - if (!_hints.ContainsKey(placement)) return false; - bool result = _display.Elements.Remove(_hints[placement]); - _hints.Remove(placement); - UpdateCore(_player); - return result; - } - - - public static void UpdateCore(Player player) => DisplayCore.Get(player.ReferenceHub).Update(); - - - } - public struct Position - { - private HPosition _hposition; - public HPosition HPosition { get { return _hposition; } } - private VPosition _vposition; - public VPosition VPosition { get { return _vposition; } } - - public Position(HPosition hposition, VPosition vposition) - { - _hposition = hposition; - _vposition = vposition; - } - - public override bool Equals(object obj) - { - Position pos = (Position)obj; - return pos.VPosition == VPosition && pos.HPosition == HPosition; - } - public override int GetHashCode() - { - return base.GetHashCode(); - } - } - - - -} diff --git a/KruacentExiled/KE.Utils/Display/Enums/HPosition.cs b/KruacentExiled/KE.Utils/Display/Enums/HPosition.cs deleted file mode 100644 index 023c8016..00000000 --- a/KruacentExiled/KE.Utils/Display/Enums/HPosition.cs +++ /dev/null @@ -1,15 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace KE.Utils.Display.Enums -{ - public enum HPosition - { - Left, - Center, - Right, - } -} diff --git a/KruacentExiled/KE.Utils/Display/Enums/VPosition.cs b/KruacentExiled/KE.Utils/Display/Enums/VPosition.cs deleted file mode 100644 index a1530642..00000000 --- a/KruacentExiled/KE.Utils/Display/Enums/VPosition.cs +++ /dev/null @@ -1,16 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace KE.Utils.Display.Enums -{ - public enum VPosition - { - GlobalEvent = 900, - CustomRoleEffect = 600, - CustomItem = 200, - CustomRole = 400, - } -} diff --git a/KruacentExiled/KE.Utils/Display/RueIHint.cs b/KruacentExiled/KE.Utils/Display/RueIHint.cs deleted file mode 100644 index af4cd7b4..00000000 --- a/KruacentExiled/KE.Utils/Display/RueIHint.cs +++ /dev/null @@ -1,34 +0,0 @@ -using KE.Utils.Display.Enums; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace KE.Utils.Display -{ - public class RueIHint - { - private Position _position; - public Position Position { get { return _position; } } - private string _content; - public string RawContent { get { return _content; } } - private float _duration = -1; - public float Duration { get { return _duration; } } - - public RueIHint(HPosition hposition, VPosition vposition, string content) - { - _position = new(hposition, vposition); - _content = content; - } - public RueIHint(HPosition hposition, VPosition vposition, string content,float duration) - { - _position = new(hposition, vposition); - _content = content; - _duration = duration; - } - - - - } -} From 28f624045e3d555f8e393844787095ce8b20ee61 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Sat, 14 Jun 2025 06:29:13 +0200 Subject: [PATCH 272/853] added new scp + corrected some stuff --- .../API/{ => Features}/GlobalCustomRole.cs | 27 +- .../API/{ => Features}/KECustomRole.cs | 38 ++- .../API/Interfaces/ISCPPreferences.cs | 18 ++ .../CR/ChaosInsurgency/LeRusse.cs | 4 +- .../KE.CustomRoles/CR/ClassD/DBoyInShape.cs | 2 +- .../KE.CustomRoles/CR/ClassD/Enfant.cs | 2 +- .../KE.CustomRoles/CR/ClassD/Mime.cs | 2 +- .../KE.CustomRoles/CR/Guard/ChiefGuard.cs | 2 +- .../KE.CustomRoles/CR/Guard/Guard914.cs | 2 +- .../KE.CustomRoles/CR/Human/Alzheimer.cs | 2 +- .../KE.CustomRoles/CR/Human/Asthmatique.cs | 2 +- .../KE.CustomRoles/CR/Human/Diabetique.cs | 2 +- .../KE.CustomRoles/CR/Human/Hitman.cs | 43 ++-- .../KE.CustomRoles/CR/Human/Maladroit.cs | 2 +- KruacentExiled/KE.CustomRoles/CR/MTF/Tank.cs | 2 +- .../KE.CustomRoles/CR/MTF/Terroriste.cs | 2 +- KruacentExiled/KE.CustomRoles/CR/SCP/Paper.cs | 2 +- .../KE.CustomRoles/CR/SCP/SCP457.cs | 231 ++++++++++++++++++ KruacentExiled/KE.CustomRoles/CR/SCP/Small.cs | 2 +- KruacentExiled/KE.CustomRoles/CR/SCP/Tall.cs | 2 +- KruacentExiled/KE.CustomRoles/CR/SCP/Ultra.cs | 12 +- .../KE.CustomRoles/CR/SCP/ZombieDoorman.cs | 14 +- .../CR/Scientist/GambleAddict.cs | 2 +- .../CR/Scientist/ZoneManager.cs | 4 +- KruacentExiled/KE.CustomRoles/Controller.cs | 4 +- .../KE.CustomRoles/KE.CustomRoles.csproj | 2 + KruacentExiled/KE.CustomRoles/MainPlugin.cs | 5 +- .../KE.CustomRoles/Settings/SettingHandler.cs | 12 + KruacentExiled/KE.Utils/API/OtherUtils.cs | 18 ++ 29 files changed, 391 insertions(+), 71 deletions(-) rename KruacentExiled/KE.CustomRoles/API/{ => Features}/GlobalCustomRole.cs (89%) rename KruacentExiled/KE.CustomRoles/API/{ => Features}/KECustomRole.cs (84%) create mode 100644 KruacentExiled/KE.CustomRoles/API/Interfaces/ISCPPreferences.cs create mode 100644 KruacentExiled/KE.CustomRoles/CR/SCP/SCP457.cs create mode 100644 KruacentExiled/KE.CustomRoles/Settings/SettingHandler.cs create mode 100644 KruacentExiled/KE.Utils/API/OtherUtils.cs diff --git a/KruacentExiled/KE.CustomRoles/API/GlobalCustomRole.cs b/KruacentExiled/KE.CustomRoles/API/Features/GlobalCustomRole.cs similarity index 89% rename from KruacentExiled/KE.CustomRoles/API/GlobalCustomRole.cs rename to KruacentExiled/KE.CustomRoles/API/Features/GlobalCustomRole.cs index acd0d487..a1331ed1 100644 --- a/KruacentExiled/KE.CustomRoles/API/GlobalCustomRole.cs +++ b/KruacentExiled/KE.CustomRoles/API/Features/GlobalCustomRole.cs @@ -5,6 +5,7 @@ using Exiled.API.Features.Pools; using Exiled.CustomRoles.API.Features; using InventorySystem.Configs; +using KE.Utils.API.Displays.DisplayMeow; using LiteNetLib4Mirror.Open.Nat; using MEC; using PlayerRoles; @@ -15,7 +16,7 @@ using System.Threading.Tasks; using UnityEngine; -namespace KE.CustomRoles.API +namespace KE.CustomRoles.API.Features { public abstract class GlobalCustomRole : KECustomRole @@ -36,7 +37,7 @@ public override void AddRole(Player player) Log.Debug($"{Name}: Adding role to {player.Nickname}."); TrackedPlayers.Add(player); - + Timing.CallDelayed( 0.25f, () => @@ -65,7 +66,7 @@ public override void AddRole(Player player) }); Log.Debug($"{Name}: Setting health values."); - player.MaxHealth *= MaxHealthMultiplicator; + player.MaxHealth *= MaxHealthMultiplicator; player.Health = player.MaxHealth; player.Scale = Scale; @@ -87,7 +88,6 @@ public override void AddRole(Player player) } ShowMessage(player); - ShowBroadcast(player); RoleAdded(player); player.UniqueRole = Name; player.TryAddCustomRoleFriendlyFire(Name, CustomRoleFFMultiplier); @@ -120,7 +120,24 @@ public override void AddRole(Player player) public sealed override int MaxHealth { get; set; } public virtual float MaxHealthMultiplicator { get; set; } = 1; + protected override void ShowMessage(Player player) + { + string show; + if (player.IsScp) + { + show = $"{Name} {player.Role.Name}\n {Description}"; + } + else + { + show = $"{Name}\n {Description}"; + } + + + //todo settings + float delay = 20; + DisplayHandler.Instance.AddHint(MainPlugin.CRHint, player, show, delay); + } } public enum SideEnum @@ -143,5 +160,5 @@ public static SideEnum Get(Side side) }; } } - + } diff --git a/KruacentExiled/KE.CustomRoles/API/KECustomRole.cs b/KruacentExiled/KE.CustomRoles/API/Features/KECustomRole.cs similarity index 84% rename from KruacentExiled/KE.CustomRoles/API/KECustomRole.cs rename to KruacentExiled/KE.CustomRoles/API/Features/KECustomRole.cs index 420082e7..aa437f63 100644 --- a/KruacentExiled/KE.CustomRoles/API/KECustomRole.cs +++ b/KruacentExiled/KE.CustomRoles/API/Features/KECustomRole.cs @@ -3,36 +3,49 @@ using Exiled.API.Features; using Exiled.API.Features.Pools; using Exiled.CustomRoles.API.Features; +using Exiled.Events.Commands.PluginManager; +using Exiled.Events.EventArgs.Player; using InventorySystem.Configs; -using KE.Utils.Display; -using KE.Utils.Display.Enums; +using KE.Utils.API.Displays.DisplayMeow; using MEC; using PlayerRoles; using System.Collections.Generic; using System.Text; using UnityEngine; -namespace KE.CustomRoles.API +namespace KE.CustomRoles.API.Features { public abstract class KECustomRole : CustomRole { public sealed override bool IgnoreSpawnSystem { get; set; } = true; - protected sealed override void ShowMessage(Player player) + protected override void ShowMessage(Player player) { string show = $"{Name}\n {Description}"; - RueIHint r = new(HPosition.Left, VPosition.CustomItem, show, Exiled.CustomRoles.CustomRoles.Instance.Config.GotRoleHint.Duration); - DisplayPlayer.Get(player).Hint(r); + //todo settings + float delay = 20; + + DisplayHandler.Instance.AddHint(MainPlugin.CRHint, player, show, delay); + } + + + + protected void ShowEffectHint(Player player, string text) + { + //todo settings + float delay = 20; + DisplayHandler.Instance.AddHint(MainPlugin.CREffect, player, text, delay); } public override void AddRole(Player player) { Player player2 = player; Log.Debug(Name + ": Adding role to " + player2.Nickname + "."); - TrackedPlayers.Add(player2); + if (Role != RoleTypeId.None) { + if (KeepPositionOnSpawn) { if (KeepInventoryOnSpawn) @@ -53,35 +66,32 @@ public override void AddRole(Player player) player2.Role.Set(Role, SpawnReason.ForceClass, RoleSpawnFlags.AssignInventory); } } + TrackedPlayers.Add(player2); Timing.CallDelayed(0.25f, delegate { if (!KeepInventoryOnSpawn) { - Log.Debug(Name + ": Clearing " + player2.Nickname + "'s inventory."); player2.ClearInventory(); } foreach (string item in Inventory) { - Log.Debug(Name + ": Adding " + item + " to inventory."); TryAddItem(player2, item); } if (Ammo.Count > 0) { - Log.Debug(Name + ": Adding Ammo to " + player2.Nickname + " inventory."); AmmoType[] values = EnumUtils.Values; foreach (AmmoType ammoType in values) { if (ammoType != 0) { - player2.SetAmmo(ammoType, (ushort)(Ammo.ContainsKey(ammoType) ? ((Ammo[ammoType] == ushort.MaxValue) ? InventoryLimits.GetAmmoLimit(ammoType.GetItemType(), player2.ReferenceHub) : Ammo[ammoType]) : 0)); + player2.SetAmmo(ammoType, (ushort)(Ammo.ContainsKey(ammoType) ? Ammo[ammoType] == ushort.MaxValue ? InventoryLimits.GetAmmoLimit(ammoType.GetItemType(), player2.ReferenceHub) : Ammo[ammoType] : 0)); } } } }); - Log.Debug(Name + ": Setting health values."); player2.Health = MaxHealth; player2.MaxHealth = MaxHealth; player2.Scale = Scale; @@ -91,7 +101,6 @@ public override void AddRole(Player player) player2.Position = spawnPosition; } - Log.Debug(Name + ": Setting player info"); player2.CustomInfo = player2.CustomName + "\n" + CustomInfo; player2.InfoArea &= ~(PlayerInfoArea.Nickname | PlayerInfoArea.Role); if (CustomAbilities != null) @@ -137,5 +146,8 @@ public override void AddRole(Player player) /// The chance of having this role NOT the chance to have a role /// public override abstract float SpawnChance { get; set; } + + + } } diff --git a/KruacentExiled/KE.CustomRoles/API/Interfaces/ISCPPreferences.cs b/KruacentExiled/KE.CustomRoles/API/Interfaces/ISCPPreferences.cs new file mode 100644 index 00000000..3db7c6b4 --- /dev/null +++ b/KruacentExiled/KE.CustomRoles/API/Interfaces/ISCPPreferences.cs @@ -0,0 +1,18 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace KE.CustomRoles.API.Interfaces +{ + + /// + /// SCP custom role implementing this interface will allow them to have a preference slider like the vanilla scps + /// + public interface ISCPPreferences + { + + public abstract bool IsSupport { get; } + } +} diff --git a/KruacentExiled/KE.CustomRoles/CR/ChaosInsurgency/LeRusse.cs b/KruacentExiled/KE.CustomRoles/CR/ChaosInsurgency/LeRusse.cs index d3c08afa..94ad701c 100644 --- a/KruacentExiled/KE.CustomRoles/CR/ChaosInsurgency/LeRusse.cs +++ b/KruacentExiled/KE.CustomRoles/CR/ChaosInsurgency/LeRusse.cs @@ -1,6 +1,6 @@ using Exiled.API.Enums; using Exiled.API.Features.Attributes; -using KE.CustomRoles.API; +using KE.CustomRoles.API.Features; using PlayerRoles; using System.Collections.Generic; using UnityEngine; @@ -20,7 +20,7 @@ internal class Russe : KECustomRole public override bool KeepRoleOnChangingRole { get; set; } = false; public override float SpawnChance { get; set; } = 100; - public override Vector3 Scale { get; set; } = new Vector3(1.4f, 1.2f, 1.3f); + public override Vector3 Scale { get; set; } = new Vector3(1.1f, 1f, 1.1f); public override List Inventory { get; set; } = new List() { diff --git a/KruacentExiled/KE.CustomRoles/CR/ClassD/DBoyInShape.cs b/KruacentExiled/KE.CustomRoles/CR/ClassD/DBoyInShape.cs index fe8b2604..4ab05577 100644 --- a/KruacentExiled/KE.CustomRoles/CR/ClassD/DBoyInShape.cs +++ b/KruacentExiled/KE.CustomRoles/CR/ClassD/DBoyInShape.cs @@ -6,7 +6,7 @@ using Exiled.CustomRoles.API.Features; using Exiled.Events.EventArgs.Map; using Exiled.Events.EventArgs.Player; -using KE.CustomRoles.API; +using KE.CustomRoles.API.Features; using MEC; using PlayerRoles; using System; diff --git a/KruacentExiled/KE.CustomRoles/CR/ClassD/Enfant.cs b/KruacentExiled/KE.CustomRoles/CR/ClassD/Enfant.cs index c85496a3..2c96c02c 100644 --- a/KruacentExiled/KE.CustomRoles/CR/ClassD/Enfant.cs +++ b/KruacentExiled/KE.CustomRoles/CR/ClassD/Enfant.cs @@ -1,6 +1,6 @@ using Exiled.API.Features.Attributes; using InventorySystem.Items.Usables.Scp330; -using KE.CustomRoles.API; +using KE.CustomRoles.API.Features; using PlayerRoles; using System.Collections.Generic; using UnityEngine; diff --git a/KruacentExiled/KE.CustomRoles/CR/ClassD/Mime.cs b/KruacentExiled/KE.CustomRoles/CR/ClassD/Mime.cs index db198ea0..9603b5d0 100644 --- a/KruacentExiled/KE.CustomRoles/CR/ClassD/Mime.cs +++ b/KruacentExiled/KE.CustomRoles/CR/ClassD/Mime.cs @@ -3,7 +3,7 @@ using Exiled.API.Features.Attributes; using Exiled.Events.EventArgs.Player; using InventorySystem.Items.Usables.Scp330; -using KE.CustomRoles.API; +using KE.CustomRoles.API.Features; using PlayerRoles; using PlayerRoles.Spectating; using System.Collections.Generic; diff --git a/KruacentExiled/KE.CustomRoles/CR/Guard/ChiefGuard.cs b/KruacentExiled/KE.CustomRoles/CR/Guard/ChiefGuard.cs index 145925ab..3cad6e8b 100644 --- a/KruacentExiled/KE.CustomRoles/CR/Guard/ChiefGuard.cs +++ b/KruacentExiled/KE.CustomRoles/CR/Guard/ChiefGuard.cs @@ -1,6 +1,6 @@ using Exiled.API.Enums; using Exiled.API.Features.Attributes; -using KE.CustomRoles.API; +using KE.CustomRoles.API.Features; using PlayerRoles; using System.Collections.Generic; diff --git a/KruacentExiled/KE.CustomRoles/CR/Guard/Guard914.cs b/KruacentExiled/KE.CustomRoles/CR/Guard/Guard914.cs index 60eade98..ea745863 100644 --- a/KruacentExiled/KE.CustomRoles/CR/Guard/Guard914.cs +++ b/KruacentExiled/KE.CustomRoles/CR/Guard/Guard914.cs @@ -1,7 +1,7 @@ using Exiled.API.Enums; using Exiled.API.Features.Attributes; using Exiled.API.Features.Spawn; -using KE.CustomRoles.API; +using KE.CustomRoles.API.Features; using PlayerRoles; using System.Collections.Generic; diff --git a/KruacentExiled/KE.CustomRoles/CR/Human/Alzheimer.cs b/KruacentExiled/KE.CustomRoles/CR/Human/Alzheimer.cs index 1f64c58f..3ecc6f97 100644 --- a/KruacentExiled/KE.CustomRoles/CR/Human/Alzheimer.cs +++ b/KruacentExiled/KE.CustomRoles/CR/Human/Alzheimer.cs @@ -2,7 +2,7 @@ using Exiled.API.Features; using Exiled.API.Features.Attributes; using Exiled.CustomRoles.API.Features; -using KE.CustomRoles.API; +using KE.CustomRoles.API.Features; using MEC; using PlayerRoles; using System.Collections.Generic; diff --git a/KruacentExiled/KE.CustomRoles/CR/Human/Asthmatique.cs b/KruacentExiled/KE.CustomRoles/CR/Human/Asthmatique.cs index cf9c4c15..cbd1cfa7 100644 --- a/KruacentExiled/KE.CustomRoles/CR/Human/Asthmatique.cs +++ b/KruacentExiled/KE.CustomRoles/CR/Human/Asthmatique.cs @@ -2,7 +2,7 @@ using Exiled.API.Features; using Exiled.API.Features.Attributes; using Exiled.CustomRoles.API.Features; -using KE.CustomRoles.API; +using KE.CustomRoles.API.Features; using PlayerRoles; using UnityEngine; using Utils.NonAllocLINQ; diff --git a/KruacentExiled/KE.CustomRoles/CR/Human/Diabetique.cs b/KruacentExiled/KE.CustomRoles/CR/Human/Diabetique.cs index 54e6e304..b6a23601 100644 --- a/KruacentExiled/KE.CustomRoles/CR/Human/Diabetique.cs +++ b/KruacentExiled/KE.CustomRoles/CR/Human/Diabetique.cs @@ -3,7 +3,7 @@ using Exiled.API.Features; using Exiled.API.Features.Attributes; using Exiled.CustomRoles.API.Features; -using KE.CustomRoles.API; +using KE.CustomRoles.API.Features; using PlayerRoles; using UnityEngine; using Utils.NonAllocLINQ; diff --git a/KruacentExiled/KE.CustomRoles/CR/Human/Hitman.cs b/KruacentExiled/KE.CustomRoles/CR/Human/Hitman.cs index bee8c478..ba528494 100644 --- a/KruacentExiled/KE.CustomRoles/CR/Human/Hitman.cs +++ b/KruacentExiled/KE.CustomRoles/CR/Human/Hitman.cs @@ -4,16 +4,11 @@ using Exiled.API.Features.Attributes; using Exiled.CustomRoles.API.Features; using Exiled.Events.EventArgs.Player; -using Hints; -using KE.CustomRoles.API; -using KE.Utils.Display; +using KE.CustomRoles.API.Features; using MEC; using PlayerRoles; -using PluginAPI.Events; using System.Collections.Generic; using System.Linq; -using UnityEngine; -using Utils.NonAllocLINQ; namespace KE.CustomRoles.CR.Human { @@ -30,8 +25,8 @@ internal class Hitman : GlobalCustomRole public override bool KeepRoleOnChangingRole { get; set; } = true; public override float SpawnChance { get; set; } = 100; - private Player TargetPlayer { get; set; } = null; - private Player TheHitman { get; set; } = null; + private Player TargetPlayer; + private Player TheHitman; private void NerfHitman() { @@ -58,12 +53,18 @@ protected override void RoleAdded(Player player) this.TheHitman = player; // Target cannot be NPC, SCP or the Hitman - this.TargetPlayer = Player.List.Where(x => x.IsHuman && x != player /*&& !x.IsNPC*/).GetRandomValue(); + this.TargetPlayer = Player.List.Where(x => x.IsHuman && x != player && !x.IsNPC).GetRandomValue(); + + if(TargetPlayer == null) + { + Log.Warn("no other human player"); + return; + } + Log.Debug($"Target showing to Hitman, target is : {TargetPlayer.Nickname}"); - RueIHint hint = new(Utils.Display.Enums.HPosition.Center, Utils.Display.Enums.VPosition.CustomRoleEffect, $"The Target is {TargetPlayer.Nickname}", 5); - DisplayPlayer.Get(player).Hint(hint); + ShowEffectHint(player, $"The Target is {TargetPlayer.Nickname}"); if (this.TheHitman.Role.Side == this.TargetPlayer.Role.Side && !Server.FriendlyFire) { @@ -95,10 +96,10 @@ public void TargetEscaped(EscapedEventArgs ev) { if (ev.Player != this.TargetPlayer) return; + Log.Info($"Target {this.TargetPlayer.Nickname} escaped"); + ShowEffectHint(TheHitman, $"The target ({this.TargetPlayer.Nickname}) has escaped, you lost the contract"); - RueIHint hint = new(Utils.Display.Enums.HPosition.Center, Utils.Display.Enums.VPosition.CustomRoleEffect, $"The target ({this.TargetPlayer.Nickname}) has escaped, you lost the contract", 5); - DisplayPlayer.Get(this.TheHitman).Hint(hint); NerfHitman(); @@ -114,16 +115,14 @@ public void TargetDie(DiedEventArgs ev) // Hitman killed the target if (ev.Player == this.TargetPlayer && ev.Attacker == this.TheHitman) { - RueIHint hint = new(Utils.Display.Enums.HPosition.Center, Utils.Display.Enums.VPosition.CustomRoleEffect, $"You killed the target ({this.TargetPlayer.Nickname})", 5); - DisplayPlayer.Get(this.TheHitman).Hint(hint); + ShowEffectHint(TheHitman, $"You killed the target ({this.TargetPlayer.Nickname}), you achieved the contract"); BuffHitman(); this.TargetPlayer = null; } else { - RueIHint hint = new(Utils.Display.Enums.HPosition.Center, Utils.Display.Enums.VPosition.CustomRoleEffect, $"The target ({this.TargetPlayer.Nickname}) is dead, you lost the contract", 5); - DisplayPlayer.Get(this.TheHitman).Hint(hint); + ShowEffectHint(TheHitman, $"The target ({this.TargetPlayer.Nickname}) is dead, you lost the contract"); NerfHitman(); this.TargetPlayer = null; @@ -169,8 +168,8 @@ private IEnumerator CheckRooms() if (!hasLogged) { Log.Info(this.TargetPlayer + " " + message); - RueIHint hint = new(Utils.Display.Enums.HPosition.Center, Utils.Display.Enums.VPosition.CustomRoleEffect, message, 5); - DisplayPlayer.Get(this.TargetPlayer).Hint(hint); + + ShowEffectHint(TargetPlayer, message); ResetLogs(ref proximityAlerts); proximityAlerts[i] = (distance, message, true); } @@ -180,9 +179,8 @@ private IEnumerator CheckRooms() { if (!hasLogged) { + ShowEffectHint(TargetPlayer, message); Log.Info(this.TargetPlayer + " " + message); - RueIHint hint = new(Utils.Display.Enums.HPosition.Center, Utils.Display.Enums.VPosition.CustomRoleEffect, message, 5); - DisplayPlayer.Get(this.TargetPlayer).Hint(hint); ResetLogs(ref proximityAlerts); proximityAlerts[i] = (distance, message, true); } @@ -192,9 +190,8 @@ private IEnumerator CheckRooms() { if (!hasLogged) { + ShowEffectHint(TargetPlayer, message); Log.Info(this.TargetPlayer + " " + message); - RueIHint hint = new(Utils.Display.Enums.HPosition.Center, Utils.Display.Enums.VPosition.CustomRoleEffect, message, 5); - DisplayPlayer.Get(this.TargetPlayer).Hint(hint); ResetLogs(ref proximityAlerts); proximityAlerts[i] = (distance, message, true); } diff --git a/KruacentExiled/KE.CustomRoles/CR/Human/Maladroit.cs b/KruacentExiled/KE.CustomRoles/CR/Human/Maladroit.cs index 16365742..1f9f7dde 100644 --- a/KruacentExiled/KE.CustomRoles/CR/Human/Maladroit.cs +++ b/KruacentExiled/KE.CustomRoles/CR/Human/Maladroit.cs @@ -3,7 +3,7 @@ using Exiled.API.Features; using Exiled.API.Features.Attributes; using Exiled.CustomRoles.API.Features; -using KE.CustomRoles.API; +using KE.CustomRoles.API.Features; using MEC; using PlayerRoles; using System; diff --git a/KruacentExiled/KE.CustomRoles/CR/MTF/Tank.cs b/KruacentExiled/KE.CustomRoles/CR/MTF/Tank.cs index d30f5a2f..f9b4718b 100644 --- a/KruacentExiled/KE.CustomRoles/CR/MTF/Tank.cs +++ b/KruacentExiled/KE.CustomRoles/CR/MTF/Tank.cs @@ -7,7 +7,7 @@ using System.Collections.Generic; using UnityEngine; using System; -using KE.CustomRoles.API; +using KE.CustomRoles.API.Features; namespace KE.CustomRoles.CR.MTF { diff --git a/KruacentExiled/KE.CustomRoles/CR/MTF/Terroriste.cs b/KruacentExiled/KE.CustomRoles/CR/MTF/Terroriste.cs index d746a15c..a243bcfc 100644 --- a/KruacentExiled/KE.CustomRoles/CR/MTF/Terroriste.cs +++ b/KruacentExiled/KE.CustomRoles/CR/MTF/Terroriste.cs @@ -1,6 +1,6 @@ using Exiled.API.Enums; using Exiled.API.Features.Attributes; -using KE.CustomRoles.API; +using KE.CustomRoles.API.Features; using PlayerRoles; using System.Collections.Generic; using UnityEngine; diff --git a/KruacentExiled/KE.CustomRoles/CR/SCP/Paper.cs b/KruacentExiled/KE.CustomRoles/CR/SCP/Paper.cs index ad34d01e..b0298230 100644 --- a/KruacentExiled/KE.CustomRoles/CR/SCP/Paper.cs +++ b/KruacentExiled/KE.CustomRoles/CR/SCP/Paper.cs @@ -1,5 +1,5 @@ using Exiled.API.Features.Attributes; -using KE.CustomRoles.API; +using KE.CustomRoles.API.Features; using PlayerRoles; using UnityEngine; diff --git a/KruacentExiled/KE.CustomRoles/CR/SCP/SCP457.cs b/KruacentExiled/KE.CustomRoles/CR/SCP/SCP457.cs new file mode 100644 index 00000000..a643b345 --- /dev/null +++ b/KruacentExiled/KE.CustomRoles/CR/SCP/SCP457.cs @@ -0,0 +1,231 @@ +using Exiled.API.Features; +using Exiled.API.Features.Attributes; +using Exiled.API.Features.Doors; +using Exiled.API.Features.Roles; +using Exiled.API.Features.Toys; +using Exiled.API.Interfaces; +using Exiled.Events.EventArgs.Scp106; +using KE.CustomRoles.API.Features; +using KE.CustomRoles.API.Interfaces; +using KE.Utils.API; +using MEC; +using PlayerRoles; +using PlayerStatsSystem; +using System; +using System.Collections.Generic; +using System.Linq; +using UnityEngine; +using Light = Exiled.API.Features.Toys.Light; + +namespace KE.CustomRoles.CR.SCP +{ + [CustomRole(RoleTypeId.Scp106)] + public class SCP457 : KECustomRole, ISCPPreferences + { + + public override string Name { get; set; } = "SCP-457"; + public override string Description { get; set; } = ""; + public override uint Id { get; set; } = 1084; + public override string CustomInfo { get; set; } = "SCP-457"; + public override int MaxHealth { get; set; } = 3900; + public override RoleTypeId Role { get; set; } = RoleTypeId.Scp106; + public override bool KeepRoleOnDeath { get; set; } = false; + public override bool KeepRoleOnChangingRole { get; set; } = false; + public bool IsSupport { get; } = false; + + public override float SpawnChance { get; set; } = 100; + + private Dictionary _inside = new(); + private Dictionary> _handles = new(); + + public static float LightRefreshRate = .1f; + public static float DamageRefreshRate = 5f; + public static readonly Color FlameColor = new(2, 1.08f, 0); + private static readonly Color ballColor = new(2, 1.08f, 0, .25f); + public static readonly float VigorCost = .1f; + + private static readonly string _deathMessage = "Burned to death"; + public static CustomReasonDamageHandler BallDamage = new (_deathMessage, 25, string.Empty); + + protected override void RoleAdded(Player player) + { + Log.Debug("adding role 457"); + _inside.Add(player, null); + _handles.Add(player, new()); + + _handles[player].Add(Timing.RunCoroutine(InsideLight(player))); + _handles[player].Add(Timing.RunCoroutine(PassiveDamage(player))); + + } + + private IEnumerator InsideLight(Player player) + { + Light light = Light.Create(); + _inside[player] = light; + light.Position = player.Position; + light.Color = FlameColor; + light.Spawn(); + while (true) + { + light.Position = player.Position; + PassiveDamage(player); + yield return Timing.WaitForSeconds(LightRefreshRate); + } + } + + + + private IEnumerator PassiveDamage(Player scp) + { + while (true) + { + foreach (Player allP in Player.List.Where(p => p != scp && !p.IsScp)) + { + + + if (OtherUtils.IsInCircle(allP.Position, scp.Position, 5)) + { + + Physics.Linecast(allP.Position, scp.Position, out var hitinfo); + float damage = -(hitinfo.distance/3)+10; + Log.Debug($"damâge={damage} dist = {hitinfo.distance}"); + allP.EnableEffect(Exiled.API.Enums.EffectType.Burned, DamageRefreshRate, true); + allP.Hurt(damage, _deathMessage); + + + } + } + yield return Timing.WaitForSeconds(DamageRefreshRate); + } + + } + + protected override void RoleRemoved(Player player) + { + Log.Debug("remove role 457"); + + + if(_inside.TryGetValue(player,out var l)) + { + l.Destroy(); + _inside.Remove(player); + } + + + + + if(_handles.TryGetValue(player,out var handle)) + { + foreach(var c in handle) + { + Timing.KillCoroutines(c); + } + _handles.Remove(player); + } + + } + + private void Attack(Player player, Scp106Role role) + { + + if (role.Vigor > VigorCost) + { + Timing.RunCoroutine(LaunchingAttack(player)); + role.Vigor -= VigorCost; + } + + } + + private IEnumerator LaunchingAttack(Player player) + { + Vector3 initpos = player.Position; + Quaternion direction = player.ReferenceHub.PlayerCameraReference.rotation; + + + Log.Debug(direction.eulerAngles); + bool attackTouchedSomething =false; + + + Primitive primitive = Primitive.Create(initpos, direction.eulerAngles, null, false); + primitive.Collidable = false; + primitive.Color = ballColor; + primitive.Spawn(); + Vector3 nextPos; + + int fallback = 100; + while (!attackTouchedSomething && fallback > 0) + { + nextPos = primitive.Position + primitive.Rotation * new Vector3(0, 0, 1f); + RaycastHit hit; + + if (UnityEngine.Physics.Linecast(primitive.Position, nextPos, out hit)) + { + attackTouchedSomething = true; + Player playerhit = Player.Get(hit.collider); + if(playerhit != null && playerhit.Role.Side != Exiled.API.Enums.Side.Scp) + { + playerhit.Hurt(BallDamage); + player.ShowHitMarker(); + + } + + Door doorhit = Door.Get(hit.collider.gameObject); + if(doorhit != null && doorhit is IDamageableDoor damageable && !damageable.IsDestroyed) + { + damageable.Break(); + player.ShowHitMarker(); + } + } + + + + + Log.Debug($"current pos = {primitive.Position} next pos = {nextPos}"); + yield return Timing.WaitForSeconds(.1f); + primitive.Position = nextPos; + fallback--; + } + primitive.Destroy(); + } + + + private void OnStalking(StalkingEventArgs ev) + { + if (!Check(ev.Player)) return; + ev.IsAllowed = false; + + Attack(ev.Player,ev.Scp106); + } + + private void OnTP(TeleportingEventArgs ev) + { + if (!Check(ev.Player)) return; + ev.IsAllowed = false; + + } + + private void OnAttacking(AttackingEventArgs ev) + { + ev.IsAllowed = false; + + } + + protected override void SubscribeEvents() + { + Exiled.Events.Handlers.Scp106.Stalking += OnStalking; + Exiled.Events.Handlers.Scp106.Teleporting += OnTP; + Exiled.Events.Handlers.Scp106.Attacking += OnAttacking; + base.SubscribeEvents(); + + } + + protected override void UnsubscribeEvents() + { + Exiled.Events.Handlers.Scp106.Stalking -= OnStalking; + Exiled.Events.Handlers.Scp106.Teleporting -= OnTP; + Exiled.Events.Handlers.Scp106.Attacking -= OnAttacking; + base.UnsubscribeEvents(); + } + + } +} diff --git a/KruacentExiled/KE.CustomRoles/CR/SCP/Small.cs b/KruacentExiled/KE.CustomRoles/CR/SCP/Small.cs index f5f0304b..49c47d18 100644 --- a/KruacentExiled/KE.CustomRoles/CR/SCP/Small.cs +++ b/KruacentExiled/KE.CustomRoles/CR/SCP/Small.cs @@ -1,6 +1,6 @@ using Exiled.API.Features.Attributes; using Exiled.CustomRoles.API.Features; -using KE.CustomRoles.API; +using KE.CustomRoles.API.Features; using PlayerRoles; using UnityEngine; diff --git a/KruacentExiled/KE.CustomRoles/CR/SCP/Tall.cs b/KruacentExiled/KE.CustomRoles/CR/SCP/Tall.cs index 5613b1d2..824ed92d 100644 --- a/KruacentExiled/KE.CustomRoles/CR/SCP/Tall.cs +++ b/KruacentExiled/KE.CustomRoles/CR/SCP/Tall.cs @@ -1,5 +1,5 @@ using Exiled.API.Features.Attributes; -using KE.CustomRoles.API; +using KE.CustomRoles.API.Features; using PlayerRoles; using UnityEngine; diff --git a/KruacentExiled/KE.CustomRoles/CR/SCP/Ultra.cs b/KruacentExiled/KE.CustomRoles/CR/SCP/Ultra.cs index a9b69bf1..14d78480 100644 --- a/KruacentExiled/KE.CustomRoles/CR/SCP/Ultra.cs +++ b/KruacentExiled/KE.CustomRoles/CR/SCP/Ultra.cs @@ -1,15 +1,12 @@ using Exiled.API.Enums; using Exiled.API.Features; using Exiled.API.Features.Attributes; -using KE.CustomRoles.API; -using KE.Utils.Display; +using KE.CustomRoles.API.Features; using MEC; using PlayerRoles; using System; using System.Collections.Generic; -using System.Drawing; using System.Linq; -using System.Text; namespace KE.CustomRoles.CR.SCP { @@ -19,7 +16,7 @@ public class Ultra : GlobalCustomRole private static Dictionary _handles = new(); public override SideEnum Side { get; set; } = SideEnum.SCP; public override string Name { get; set; } = "Ultra"; - public override string Description { get; set; } = ""; + public override string Description { get; set; } = "You can sense where people are located"; public override uint Id { get; set; } = 1079; public override string CustomInfo { get; set; } = "Ultra"; public override bool KeepRoleOnDeath { get; set; } = false; @@ -43,12 +40,11 @@ protected override void RoleRemoved(Player player) private IEnumerator DisplayInfos(Player player) { - RueIHint hint; + while (true) { Log.Debug("Ultra : showing"); - hint = new(Utils.Display.Enums.HPosition.Left, Utils.Display.Enums.VPosition.CustomRoleEffect, PlayerInZone(), RefreshRate); - DisplayPlayer.Get(player).Hint(hint); + ShowEffectHint(player, PlayerInZone()); yield return Timing.WaitForSeconds(RefreshRate); } } diff --git a/KruacentExiled/KE.CustomRoles/CR/SCP/ZombieDoorman.cs b/KruacentExiled/KE.CustomRoles/CR/SCP/ZombieDoorman.cs index e328cde5..ee47b53a 100644 --- a/KruacentExiled/KE.CustomRoles/CR/SCP/ZombieDoorman.cs +++ b/KruacentExiled/KE.CustomRoles/CR/SCP/ZombieDoorman.cs @@ -1,4 +1,5 @@ -using Exiled.API.Features.Attributes; +using Exiled.API.Features; +using Exiled.API.Features.Attributes; using Exiled.CustomRoles.API.Features; using KE.CustomRoles.Abilities; using PlayerRoles; @@ -28,5 +29,16 @@ internal class ZombieDoorman : CustomRole { new OpenDoor() }; + + + protected override void RoleAdded(Player player) + { + Log.Debug("adding 0493dror"); + } + + protected override void RoleRemoved(Player player) + { + Log.Debug("removing 0493dror"); + } } } diff --git a/KruacentExiled/KE.CustomRoles/CR/Scientist/GambleAddict.cs b/KruacentExiled/KE.CustomRoles/CR/Scientist/GambleAddict.cs index 0b41ddec..c6b4fffc 100644 --- a/KruacentExiled/KE.CustomRoles/CR/Scientist/GambleAddict.cs +++ b/KruacentExiled/KE.CustomRoles/CR/Scientist/GambleAddict.cs @@ -1,5 +1,5 @@ using Exiled.API.Features.Attributes; -using KE.CustomRoles.API; +using KE.CustomRoles.API.Features; using PlayerRoles; using System.Collections.Generic; using UnityEngine; diff --git a/KruacentExiled/KE.CustomRoles/CR/Scientist/ZoneManager.cs b/KruacentExiled/KE.CustomRoles/CR/Scientist/ZoneManager.cs index 2e781c30..a23c5ef1 100644 --- a/KruacentExiled/KE.CustomRoles/CR/Scientist/ZoneManager.cs +++ b/KruacentExiled/KE.CustomRoles/CR/Scientist/ZoneManager.cs @@ -1,7 +1,7 @@ using Exiled.API.Features.Attributes; using Exiled.API.Features.Spawn; using InventorySystem.Items.Keycards; -using KE.CustomRoles.API; +using KE.CustomRoles.API.Features; using PlayerRoles; using System.Collections.Generic; using UnityEngine; @@ -28,7 +28,7 @@ internal class ZoneManager : KECustomRole { new DynamicSpawnPoint() { - Location = Exiled.API.Enums.SpawnLocationType.InsideHidLower, + Location = Exiled.API.Enums.SpawnLocationType.InsideHidUpper, Chance = 100, } } diff --git a/KruacentExiled/KE.CustomRoles/Controller.cs b/KruacentExiled/KE.CustomRoles/Controller.cs index 51686601..ca0cacba 100644 --- a/KruacentExiled/KE.CustomRoles/Controller.cs +++ b/KruacentExiled/KE.CustomRoles/Controller.cs @@ -1,7 +1,7 @@ using Exiled.API.Extensions; using Exiled.API.Features; using Exiled.CustomRoles.API.Features; -using KE.CustomRoles.API; +using KE.CustomRoles.API.Features; using PlayerRoles; using System.Collections.Generic; using System.Linq; @@ -22,6 +22,7 @@ internal Dictionary GetAvailableCustomRole(Player player) return CustomRole.Registered.Where(c => c.Role == player.Role || c is GlobalCustomRole cgr && cgr.Side == SideClass.Get(player.Role.Side)).ToDictionary(c => c, c=> c.SpawnChance); } + /// /// Gives a CustomRole to a player /// @@ -36,6 +37,7 @@ internal void GiveRole(Player player) return; } + CustomRole cr = AssignRole(GetAvailableCustomRole(player)); Log.Debug($"{player.Id} : {cr.Name}"); cr?.AddRole(player); diff --git a/KruacentExiled/KE.CustomRoles/KE.CustomRoles.csproj b/KruacentExiled/KE.CustomRoles/KE.CustomRoles.csproj index d17625d0..081c2e42 100644 --- a/KruacentExiled/KE.CustomRoles/KE.CustomRoles.csproj +++ b/KruacentExiled/KE.CustomRoles/KE.CustomRoles.csproj @@ -13,10 +13,12 @@ + + diff --git a/KruacentExiled/KE.CustomRoles/MainPlugin.cs b/KruacentExiled/KE.CustomRoles/MainPlugin.cs index 18918223..9f8cc156 100644 --- a/KruacentExiled/KE.CustomRoles/MainPlugin.cs +++ b/KruacentExiled/KE.CustomRoles/MainPlugin.cs @@ -1,6 +1,7 @@ using Exiled.API.Features; using Exiled.CustomRoles.API.Features; using Exiled.Events.EventArgs.Server; +using KE.Utils.API.Displays.DisplayMeow; using MEC; using System; @@ -14,6 +15,8 @@ public class MainPlugin : Plugin public override Version Version => new(1, 1, 0); public static MainPlugin Instance; private Controller _controller; + public static readonly HintPlacement CRHint = new(0, 750); + public static readonly HintPlacement CREffect = new(700, 300); public override void OnEnabled() { @@ -21,7 +24,7 @@ public override void OnEnabled() Instance = this; _controller = new Controller(); - CustomRole.RegisterRoles(false,null); + CustomRole.RegisterRoles(false,null,true,Assembly); this.SubscribeEvents(); } diff --git a/KruacentExiled/KE.CustomRoles/Settings/SettingHandler.cs b/KruacentExiled/KE.CustomRoles/Settings/SettingHandler.cs new file mode 100644 index 00000000..a35f0f90 --- /dev/null +++ b/KruacentExiled/KE.CustomRoles/Settings/SettingHandler.cs @@ -0,0 +1,12 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace KE.CustomRoles.Settings +{ + internal class SettingHandler + { + } +} diff --git a/KruacentExiled/KE.Utils/API/OtherUtils.cs b/KruacentExiled/KE.Utils/API/OtherUtils.cs new file mode 100644 index 00000000..2995a624 --- /dev/null +++ b/KruacentExiled/KE.Utils/API/OtherUtils.cs @@ -0,0 +1,18 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using UnityEngine; + +namespace KE.Utils.API +{ + public static class OtherUtils + { + + public static bool IsInCircle(Vector3 pos,Vector3 centerCircle,float radius) + { + return Math.Pow(pos.x - centerCircle.x, 2) + Math.Pow(pos.y - centerCircle.y, 2) <= Math.Pow(radius, 2); + } + } +} From 8159f36e6a48906e6d60c2e90ca8ee3123fa33ad Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Sat, 14 Jun 2025 10:17:00 +0200 Subject: [PATCH 273/853] no need to type the name in each custom role yippee --- .../API/Features/KECustomRole.cs | 30 +++++++++++++++++-- .../CR/ChaosInsurgency/LeRusse.cs | 3 +- .../KE.CustomRoles/CR/ClassD/DBoyInShape.cs | 3 +- .../KE.CustomRoles/CR/ClassD/Enfant.cs | 3 +- .../KE.CustomRoles/CR/ClassD/Mime.cs | 7 ++--- .../KE.CustomRoles/CR/Guard/ChiefGuard.cs | 3 +- .../KE.CustomRoles/CR/Guard/Guard914.cs | 3 +- .../KE.CustomRoles/CR/Human/Alzheimer.cs | 3 +- .../KE.CustomRoles/CR/Human/Asthmatique.cs | 3 +- .../KE.CustomRoles/CR/Human/Diabetique.cs | 3 +- .../KE.CustomRoles/CR/Human/Hitman.cs | 2 +- .../KE.CustomRoles/CR/Human/Maladroit.cs | 3 +- KruacentExiled/KE.CustomRoles/CR/MTF/Tank.cs | 3 +- .../KE.CustomRoles/CR/MTF/Terroriste.cs | 3 +- KruacentExiled/KE.CustomRoles/CR/SCP/Paper.cs | 3 +- .../KE.CustomRoles/CR/SCP/SCP457.cs | 3 +- KruacentExiled/KE.CustomRoles/CR/SCP/Small.cs | 3 +- KruacentExiled/KE.CustomRoles/CR/SCP/Tall.cs | 3 +- KruacentExiled/KE.CustomRoles/CR/SCP/Ultra.cs | 3 +- .../CR/Scientist/GambleAddict.cs | 3 +- .../CR/Scientist/ZoneManager.cs | 3 +- 21 files changed, 49 insertions(+), 44 deletions(-) diff --git a/KruacentExiled/KE.CustomRoles/API/Features/KECustomRole.cs b/KruacentExiled/KE.CustomRoles/API/Features/KECustomRole.cs index aa437f63..25766e1a 100644 --- a/KruacentExiled/KE.CustomRoles/API/Features/KECustomRole.cs +++ b/KruacentExiled/KE.CustomRoles/API/Features/KECustomRole.cs @@ -10,6 +10,7 @@ using MEC; using PlayerRoles; using System.Collections.Generic; +using System.Drawing; using System.Text; using UnityEngine; @@ -17,16 +18,39 @@ namespace KE.CustomRoles.API.Features { public abstract class KECustomRole : CustomRole { + + public override string Name + { + get + { + return GetType().Name; + } + set + { + + } + } + + + + public sealed override string CustomInfo { get; set; } + public abstract string PublicName { get; set; } + + + public sealed override bool IgnoreSpawnSystem { get; set; } = true; protected override void ShowMessage(Player player) { - string show = $"{Name}\n {Description}"; + string msg = MainPlugin.Translations.GettingNewRole; + msg = msg.Replace("%Name%", PublicName).Replace("%Desc%",Description); + + //todo settings float delay = 20; - DisplayHandler.Instance.AddHint(MainPlugin.CRHint, player, show, delay); + DisplayHandler.Instance.AddHint(MainPlugin.CRHint, player, msg, delay); } @@ -101,7 +125,7 @@ public override void AddRole(Player player) player2.Position = spawnPosition; } - player2.CustomInfo = player2.CustomName + "\n" + CustomInfo; + player2.CustomInfo = player2.CustomName + "\n" + PublicName; player2.InfoArea &= ~(PlayerInfoArea.Nickname | PlayerInfoArea.Role); if (CustomAbilities != null) { diff --git a/KruacentExiled/KE.CustomRoles/CR/ChaosInsurgency/LeRusse.cs b/KruacentExiled/KE.CustomRoles/CR/ChaosInsurgency/LeRusse.cs index 94ad701c..615c2116 100644 --- a/KruacentExiled/KE.CustomRoles/CR/ChaosInsurgency/LeRusse.cs +++ b/KruacentExiled/KE.CustomRoles/CR/ChaosInsurgency/LeRusse.cs @@ -10,10 +10,9 @@ namespace KE.CustomRoles.CR.ChaosInsurgency [CustomRole(RoleTypeId.ChaosConscript)] internal class Russe : KECustomRole { - public override string Name { get; set; } = "Russe"; public override string Description { get; set; } = "Tu es un maitre de jeu \ntu dois faire la roulette russe avec les autres joueurs"; public override uint Id { get; set; } = 1050; - public override string CustomInfo { get; set; } = "Le Russe"; + public override string PublicName { get; set; } = "Le Russe"; public override int MaxHealth { get; set; } = 100; public override RoleTypeId Role { get; set; } = RoleTypeId.ChaosConscript; public override bool KeepRoleOnDeath { get; set; } = false; diff --git a/KruacentExiled/KE.CustomRoles/CR/ClassD/DBoyInShape.cs b/KruacentExiled/KE.CustomRoles/CR/ClassD/DBoyInShape.cs index 4ab05577..7b34aa77 100644 --- a/KruacentExiled/KE.CustomRoles/CR/ClassD/DBoyInShape.cs +++ b/KruacentExiled/KE.CustomRoles/CR/ClassD/DBoyInShape.cs @@ -20,10 +20,9 @@ namespace KE.CustomRoles.CR.ClassD [CustomRole(RoleTypeId.ClassD)] internal class DBoyInShape : KECustomRole { - public override string Name { get; set; } = "DBoyInShape"; public override string Description { get; set; } = "Dammmmnnnnnnn les gates"; public override uint Id { get; set; } = 1058; - public override string CustomInfo { get; set; } = "DBoyInShape"; + public override string PublicName { get; set; } = "DBoyInShape"; public override RoleTypeId Role { get; set; } = RoleTypeId.ClassD; public override bool KeepRoleOnDeath { get; set; } = false; public override bool KeepRoleOnChangingRole { get; set; } = true; diff --git a/KruacentExiled/KE.CustomRoles/CR/ClassD/Enfant.cs b/KruacentExiled/KE.CustomRoles/CR/ClassD/Enfant.cs index 2c96c02c..0823311b 100644 --- a/KruacentExiled/KE.CustomRoles/CR/ClassD/Enfant.cs +++ b/KruacentExiled/KE.CustomRoles/CR/ClassD/Enfant.cs @@ -10,10 +10,9 @@ namespace KE.CustomRoles.CR.ClassD [CustomRole(RoleTypeId.ClassD)] internal class Enfant : KECustomRole { - public override string Name { get; set; } = "enfant"; public override string Description { get; set; } = "Tu es un Enfant \ndo not the kid \ntu commences avec un bonbon arc-en-ciel \n t'es un peu plus petit que la normal"; public override uint Id { get; set; } = 1041; - public override string CustomInfo { get; set; } = "Enfant"; + public override string PublicName { get; set; } = "Enfant"; public override int MaxHealth { get; set; } = 100; public override RoleTypeId Role { get; set; } = RoleTypeId.ClassD; public override bool KeepRoleOnDeath { get; set; } = true; diff --git a/KruacentExiled/KE.CustomRoles/CR/ClassD/Mime.cs b/KruacentExiled/KE.CustomRoles/CR/ClassD/Mime.cs index 9603b5d0..807554b7 100644 --- a/KruacentExiled/KE.CustomRoles/CR/ClassD/Mime.cs +++ b/KruacentExiled/KE.CustomRoles/CR/ClassD/Mime.cs @@ -14,20 +14,19 @@ namespace KE.CustomRoles.CR.ClassD [CustomRole(RoleTypeId.ClassD)] internal class Mime : KECustomRole { - public override string Name { get; set; } = "mime"; public override string Description { get; set; } = "Tu es un Mime \nTu ne peux pas parler\nmais tu fais très peu de bruit quand tu marches\net t'es tout plat"; public override uint Id { get; set; } = 1053; - public override string CustomInfo { get; set; } = "Mime"; + public override string PublicName { get; set; } = "Mime"; public override int MaxHealth { get; set; } = 100; public override RoleTypeId Role { get; set; } = RoleTypeId.ClassD; public override bool KeepRoleOnDeath { get; set; } = false; public override bool KeepRoleOnChangingRole { get; set; } = true; - public override float SpawnChance { get; set; } = 100; + public override float SpawnChance { get; set; } = 0; public override Vector3 Scale { get; set; } = new Vector3(0.1f, 1, 1); protected override void RoleAdded(Player player) { - player.EnableEffect(EffectType.SilentWalk, -1, true); + player.EnableEffect(EffectType.SilentWalk, -1, true); //doesn't work with 939 i think player.Mute(); } diff --git a/KruacentExiled/KE.CustomRoles/CR/Guard/ChiefGuard.cs b/KruacentExiled/KE.CustomRoles/CR/Guard/ChiefGuard.cs index 3cad6e8b..b607af37 100644 --- a/KruacentExiled/KE.CustomRoles/CR/Guard/ChiefGuard.cs +++ b/KruacentExiled/KE.CustomRoles/CR/Guard/ChiefGuard.cs @@ -9,10 +9,9 @@ namespace KE.CustomRoles.CR.Guard [CustomRole(RoleTypeId.FacilityGuard)] internal class ChiefGuard : KECustomRole { - public override string Name { get; set; } = "ChiefGuard"; public override string Description { get; set; } = "Tu es un Chef des gardes du site \nT'as une carte de private \net un crossvec"; public override uint Id { get; set; } = 1046; - public override string CustomInfo { get; set; } = "Chef des Gardes"; + public override string PublicName { get; set; } = "Chef des Gardes"; public override int MaxHealth { get; set; } = 100; public override RoleTypeId Role { get; set; } = RoleTypeId.FacilityGuard; public override bool KeepRoleOnDeath { get; set; } = false; diff --git a/KruacentExiled/KE.CustomRoles/CR/Guard/Guard914.cs b/KruacentExiled/KE.CustomRoles/CR/Guard/Guard914.cs index ea745863..e5a5a95f 100644 --- a/KruacentExiled/KE.CustomRoles/CR/Guard/Guard914.cs +++ b/KruacentExiled/KE.CustomRoles/CR/Guard/Guard914.cs @@ -10,10 +10,9 @@ namespace KE.CustomRoles.CR.Guard [CustomRole(RoleTypeId.FacilityGuard)] internal class Guard914 : KECustomRole { - public override string Name { get; set; } = "guard914"; public override string Description { get; set; } = "Tu es Le garde de SCP-914 \nTu commences à 914 \nmais on a volé ta carte \net ntm aussi"; public override uint Id { get; set; } = 1045; - public override string CustomInfo { get; set; } = "Garde de 914"; + public override string PublicName { get; set; } = "Garde de 914"; public override int MaxHealth { get; set; } = 100; public override RoleTypeId Role { get; set; } = RoleTypeId.FacilityGuard; public override bool KeepRoleOnDeath { get; set; } = false; diff --git a/KruacentExiled/KE.CustomRoles/CR/Human/Alzheimer.cs b/KruacentExiled/KE.CustomRoles/CR/Human/Alzheimer.cs index 3ecc6f97..e46214af 100644 --- a/KruacentExiled/KE.CustomRoles/CR/Human/Alzheimer.cs +++ b/KruacentExiled/KE.CustomRoles/CR/Human/Alzheimer.cs @@ -16,10 +16,9 @@ internal class Alzheimer : GlobalCustomRole { private static Dictionary _coroutines = new(); public override SideEnum Side { get; set; } = SideEnum.Human; - public override string Name { get; set; } = "Alzheimer"; public override string Description { get; set; } = "Tu es Vieux"; public override uint Id { get; set; } = 1056; - public override string CustomInfo { get; set; } = "Vieux"; + public override string PublicName { get; set; } = "Vieux"; public override bool KeepRoleOnDeath { get; set; } = true; public override bool KeepRoleOnChangingRole { get; set; } = true; public override float SpawnChance { get; set; } = 100; diff --git a/KruacentExiled/KE.CustomRoles/CR/Human/Asthmatique.cs b/KruacentExiled/KE.CustomRoles/CR/Human/Asthmatique.cs index cbd1cfa7..f3a1d136 100644 --- a/KruacentExiled/KE.CustomRoles/CR/Human/Asthmatique.cs +++ b/KruacentExiled/KE.CustomRoles/CR/Human/Asthmatique.cs @@ -13,10 +13,9 @@ namespace KE.CustomRoles.CR.Human internal class Asthmatique : GlobalCustomRole { public override SideEnum Side { get; set; } = SideEnum.Human; - public override string Name { get; set; } = "Asthmatique"; public override string Description { get; set; } = "Tu es asthmatique\nT'as stamina est réduit de moitié\nMais tu vises mieux"; public override uint Id { get; set; } = 1042; - public override string CustomInfo { get; set; } = "Asthmatique"; + public override string PublicName { get; set; } = "Asthmatique"; public override bool KeepRoleOnDeath { get; set; } = true; public override bool KeepRoleOnChangingRole { get; set; } = true; public override float SpawnChance { get; set; } = 100; diff --git a/KruacentExiled/KE.CustomRoles/CR/Human/Diabetique.cs b/KruacentExiled/KE.CustomRoles/CR/Human/Diabetique.cs index b6a23601..8e05fe66 100644 --- a/KruacentExiled/KE.CustomRoles/CR/Human/Diabetique.cs +++ b/KruacentExiled/KE.CustomRoles/CR/Human/Diabetique.cs @@ -14,10 +14,9 @@ namespace KE.CustomRoles.CR.Human internal class Diabetique : GlobalCustomRole { public override SideEnum Side { get; set; } = SideEnum.Human; - public override string Name { get; set; } = "Diabetique"; public override string Description { get; set; } = "Tu es diabetique\nT'as mangé le crambleu au pomme de mael"; public override uint Id { get; set; } = 1054; - public override string CustomInfo { get; set; } = "Diabetique"; + public override string PublicName { get; set; } = "Diabetique"; public override bool KeepRoleOnDeath { get; set; } = false; public override bool KeepRoleOnChangingRole { get; set; } = false; public override float SpawnChance { get; set; } = 100; diff --git a/KruacentExiled/KE.CustomRoles/CR/Human/Hitman.cs b/KruacentExiled/KE.CustomRoles/CR/Human/Hitman.cs index ba528494..a8ee5dfd 100644 --- a/KruacentExiled/KE.CustomRoles/CR/Human/Hitman.cs +++ b/KruacentExiled/KE.CustomRoles/CR/Human/Hitman.cs @@ -20,7 +20,7 @@ internal class Hitman : GlobalCustomRole public override string Name { get; set; } = "Hitman"; public override string Description { get; set; } = "Tu es Hitman"; public override uint Id { get; set; } = 1059; - public override string CustomInfo { get; set; } = ""; + public override string PublicName { get; set; } = string.Empty; public override bool KeepRoleOnDeath { get; set; } = false; public override bool KeepRoleOnChangingRole { get; set; } = true; public override float SpawnChance { get; set; } = 100; diff --git a/KruacentExiled/KE.CustomRoles/CR/Human/Maladroit.cs b/KruacentExiled/KE.CustomRoles/CR/Human/Maladroit.cs index 1f9f7dde..6fcd061b 100644 --- a/KruacentExiled/KE.CustomRoles/CR/Human/Maladroit.cs +++ b/KruacentExiled/KE.CustomRoles/CR/Human/Maladroit.cs @@ -21,10 +21,9 @@ internal class Maladroit : GlobalCustomRole private static Dictionary _coroutines = new(); public override SideEnum Side { get; set; } = SideEnum.Human; - public override string Name { get; set; } = "Maladroit"; public override string Description { get; set; } = "Tu es maladroit\nFait attention à tes items !"; public override uint Id { get; set; } = 1057; - public override string CustomInfo { get; set; } = "Maladroit"; + public override string PublicName { get; set; } = "Maladroit"; public override bool KeepRoleOnDeath { get; set; } = false; public override bool KeepRoleOnChangingRole { get; set; } = true; public override float SpawnChance { get; set; } = 100; diff --git a/KruacentExiled/KE.CustomRoles/CR/MTF/Tank.cs b/KruacentExiled/KE.CustomRoles/CR/MTF/Tank.cs index f9b4718b..881a6399 100644 --- a/KruacentExiled/KE.CustomRoles/CR/MTF/Tank.cs +++ b/KruacentExiled/KE.CustomRoles/CR/MTF/Tank.cs @@ -14,10 +14,9 @@ namespace KE.CustomRoles.CR.MTF [CustomRole(RoleTypeId.NtfCaptain)] internal class Tank : KECustomRole { - public override string Name { get; set; } = "Tank"; public override string Description { get; set; } = "Tu es un TANK tu es débuff mais ta force de tir est démultiplié (fait attention à tes balles)"; public override uint Id { get; set; } = 1051; - public override string CustomInfo { get; set; } = "Tank"; + public override string PublicName { get; set; } = "Tank"; public override int MaxHealth { get; set; } = 200; public override RoleTypeId Role { get; set; } = RoleTypeId.NtfCaptain; public override bool KeepRoleOnDeath { get; set; } = false; diff --git a/KruacentExiled/KE.CustomRoles/CR/MTF/Terroriste.cs b/KruacentExiled/KE.CustomRoles/CR/MTF/Terroriste.cs index a243bcfc..5e47c2ba 100644 --- a/KruacentExiled/KE.CustomRoles/CR/MTF/Terroriste.cs +++ b/KruacentExiled/KE.CustomRoles/CR/MTF/Terroriste.cs @@ -10,10 +10,9 @@ namespace KE.CustomRoles.CR.MTF [CustomRole(RoleTypeId.NtfSergeant)] internal class Terroriste : KECustomRole { - public override string Name { get; set; } = "Terroriste"; public override string Description { get; set; } = "Tu es un Terroriste \nne fait pas exploser la facilité \ntu commences avec des grenades"; public override uint Id { get; set; } = 1052; - public override string CustomInfo { get; set; } = "Terroriste"; + public override string PublicName { get; set; } = "Terroriste"; public override int MaxHealth { get; set; } = 100; public override RoleTypeId Role { get; set; } = RoleTypeId.NtfSergeant; public override bool KeepRoleOnDeath { get; set; } = false; diff --git a/KruacentExiled/KE.CustomRoles/CR/SCP/Paper.cs b/KruacentExiled/KE.CustomRoles/CR/SCP/Paper.cs index b0298230..d7a703af 100644 --- a/KruacentExiled/KE.CustomRoles/CR/SCP/Paper.cs +++ b/KruacentExiled/KE.CustomRoles/CR/SCP/Paper.cs @@ -8,11 +8,10 @@ namespace KE.CustomRoles.CR.SCP [CustomRole(RoleTypeId.None)] public class Paper : GlobalCustomRole { - public override string Name { get; set; } = "Paper"; public override string Description { get; set; } = "u are a paper"; public override uint Id { get; set; } = 1047; public override SideEnum Side { get; set; } = SideEnum.SCP; - public override string CustomInfo { get; set; } = "Paper"; + public override string PublicName { get; set; } = "Paper"; public override bool KeepRoleOnDeath { get; set; } = false; public override bool KeepRoleOnChangingRole { get; set; } = false; diff --git a/KruacentExiled/KE.CustomRoles/CR/SCP/SCP457.cs b/KruacentExiled/KE.CustomRoles/CR/SCP/SCP457.cs index a643b345..ce66c57e 100644 --- a/KruacentExiled/KE.CustomRoles/CR/SCP/SCP457.cs +++ b/KruacentExiled/KE.CustomRoles/CR/SCP/SCP457.cs @@ -23,10 +23,9 @@ namespace KE.CustomRoles.CR.SCP public class SCP457 : KECustomRole, ISCPPreferences { - public override string Name { get; set; } = "SCP-457"; public override string Description { get; set; } = ""; public override uint Id { get; set; } = 1084; - public override string CustomInfo { get; set; } = "SCP-457"; + public override string PublicName { get; set; } = "SCP-457"; public override int MaxHealth { get; set; } = 3900; public override RoleTypeId Role { get; set; } = RoleTypeId.Scp106; public override bool KeepRoleOnDeath { get; set; } = false; diff --git a/KruacentExiled/KE.CustomRoles/CR/SCP/Small.cs b/KruacentExiled/KE.CustomRoles/CR/SCP/Small.cs index 49c47d18..019eb568 100644 --- a/KruacentExiled/KE.CustomRoles/CR/SCP/Small.cs +++ b/KruacentExiled/KE.CustomRoles/CR/SCP/Small.cs @@ -9,11 +9,10 @@ namespace KE.CustomRoles.CR.SCP [CustomRole(RoleTypeId.None)] public class Small : GlobalCustomRole { - public override string Name { get; set; } = "Small"; public override string Description { get; set; } = "u smoll"; public override uint Id { get; set; } = 1047; public override SideEnum Side { get; set; } = SideEnum.SCP; - public override string CustomInfo { get; set; } = "Small"; + public override string PublicName { get; set; } = "Small"; public override bool KeepRoleOnDeath { get; set; } = false; public override bool KeepRoleOnChangingRole { get; set; } = false; diff --git a/KruacentExiled/KE.CustomRoles/CR/SCP/Tall.cs b/KruacentExiled/KE.CustomRoles/CR/SCP/Tall.cs index 824ed92d..dc8e6c36 100644 --- a/KruacentExiled/KE.CustomRoles/CR/SCP/Tall.cs +++ b/KruacentExiled/KE.CustomRoles/CR/SCP/Tall.cs @@ -8,10 +8,9 @@ namespace KE.CustomRoles.CR.SCP [CustomRole(RoleTypeId.None)] public class Tall : GlobalCustomRole { - public override string Name { get; set; } = "Tall"; public override string Description { get; set; } = "u tall"; public override uint Id { get; set; } = 1049; - public override string CustomInfo { get; set; } = "Tall"; + public override string PublicName { get; set; } = "Tall"; public override bool KeepRoleOnDeath { get; set; } = false; public override bool KeepRoleOnChangingRole { get; set; } = false; public override float MaxHealthMultiplicator { get; set; } = 1.1f; diff --git a/KruacentExiled/KE.CustomRoles/CR/SCP/Ultra.cs b/KruacentExiled/KE.CustomRoles/CR/SCP/Ultra.cs index 14d78480..932f2ed7 100644 --- a/KruacentExiled/KE.CustomRoles/CR/SCP/Ultra.cs +++ b/KruacentExiled/KE.CustomRoles/CR/SCP/Ultra.cs @@ -15,10 +15,9 @@ public class Ultra : GlobalCustomRole { private static Dictionary _handles = new(); public override SideEnum Side { get; set; } = SideEnum.SCP; - public override string Name { get; set; } = "Ultra"; public override string Description { get; set; } = "You can sense where people are located"; public override uint Id { get; set; } = 1079; - public override string CustomInfo { get; set; } = "Ultra"; + public override string PublicName { get; set; } = "Ultra"; public override bool KeepRoleOnDeath { get; set; } = false; public override bool KeepRoleOnChangingRole { get; set; } = false; public override float MaxHealthMultiplicator { get; set; } = 1f; diff --git a/KruacentExiled/KE.CustomRoles/CR/Scientist/GambleAddict.cs b/KruacentExiled/KE.CustomRoles/CR/Scientist/GambleAddict.cs index c6b4fffc..a8f350bf 100644 --- a/KruacentExiled/KE.CustomRoles/CR/Scientist/GambleAddict.cs +++ b/KruacentExiled/KE.CustomRoles/CR/Scientist/GambleAddict.cs @@ -9,10 +9,9 @@ namespace KE.CustomRoles.CR.Scientist [CustomRole(RoleTypeId.Scientist)] internal class GambleAddict : KECustomRole { - public override string Name { get; set; } = "GambleAddict"; public override string Description { get; set; } = "Tu es un Gamble Addict \nT'as trade ton kit et ta carte contre 4 pièces \nfais en bon usage"; public override uint Id { get; set; } = 1043; - public override string CustomInfo { get; set; } = "GambleAddict"; + public override string PublicName { get; set; } = "Gamble Addict"; public override int MaxHealth { get; set; } = 100; public override RoleTypeId Role { get; set; } = RoleTypeId.Scientist; public override bool KeepRoleOnDeath { get; set; } = false; diff --git a/KruacentExiled/KE.CustomRoles/CR/Scientist/ZoneManager.cs b/KruacentExiled/KE.CustomRoles/CR/Scientist/ZoneManager.cs index a23c5ef1..cc978844 100644 --- a/KruacentExiled/KE.CustomRoles/CR/Scientist/ZoneManager.cs +++ b/KruacentExiled/KE.CustomRoles/CR/Scientist/ZoneManager.cs @@ -11,10 +11,9 @@ namespace KE.CustomRoles.CR.Scientist [CustomRole(RoleTypeId.Scientist)] internal class ZoneManager : KECustomRole { - public override string Name { get; set; } = "ZoneManager"; public override string Description { get; set; } = "Tu es un Zone Manager \nT'as une carte de zone manager (d'où le nom) \nTu commences à heavy \nBon courage..."; public override uint Id { get; set; } = 1044; - public override string CustomInfo { get; set; } = "ZoneManager"; + public override string PublicName { get; set; } = "Zone Manager"; public override int MaxHealth { get; set; } = 100; public override RoleTypeId Role { get; set; } = RoleTypeId.Scientist; public override bool KeepRoleOnDeath { get; set; } = false; From 5a3a45941aeec31f1b163a319d71973a0973e293 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Sat, 14 Jun 2025 10:21:09 +0200 Subject: [PATCH 274/853] started translation, probably a better way to do it --- KruacentExiled/KE.CustomRoles/MainPlugin.cs | 4 +- KruacentExiled/KE.CustomRoles/Translations.cs | 41 +++++++++++++++++++ 2 files changed, 44 insertions(+), 1 deletion(-) create mode 100644 KruacentExiled/KE.CustomRoles/Translations.cs diff --git a/KruacentExiled/KE.CustomRoles/MainPlugin.cs b/KruacentExiled/KE.CustomRoles/MainPlugin.cs index 9f8cc156..2add61a9 100644 --- a/KruacentExiled/KE.CustomRoles/MainPlugin.cs +++ b/KruacentExiled/KE.CustomRoles/MainPlugin.cs @@ -1,4 +1,5 @@ using Exiled.API.Features; +using Exiled.API.Interfaces; using Exiled.CustomRoles.API.Features; using Exiled.Events.EventArgs.Server; using KE.Utils.API.Displays.DisplayMeow; @@ -8,7 +9,7 @@ namespace KE.CustomRoles { - public class MainPlugin : Plugin + public class MainPlugin : Plugin { public override string Name { get; } = "KE.CustomRoles"; public override string Author => "Patrique & OmerGS"; @@ -17,6 +18,7 @@ public class MainPlugin : Plugin private Controller _controller; public static readonly HintPlacement CRHint = new(0, 750); public static readonly HintPlacement CREffect = new(700, 300); + public static Translations Translations => Instance?.Translation; public override void OnEnabled() { diff --git a/KruacentExiled/KE.CustomRoles/Translations.cs b/KruacentExiled/KE.CustomRoles/Translations.cs new file mode 100644 index 00000000..bb08f730 --- /dev/null +++ b/KruacentExiled/KE.CustomRoles/Translations.cs @@ -0,0 +1,41 @@ +using Exiled.API.Interfaces; +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace KE.CustomRoles +{ + public class Translations : ITranslation + { + public string GettingNewRole { get; set; } = "%Name%\n %Desc%"; + + + [Description("Russe (1050)")] + public string RusseDesc { get; set; } = "Tu es unmaitre de jeu \nyou should play russian roulette with the others"; + public string RussePublicName { get; set; } = "Russian"; + + + [Description("DBoyInShape (1058)")] + public string InShapeDesc { get; set; } = "Dammmmnnnnnnn les gates"; // aucune idée comment traduire ça + public string InShapePublicName { get; set; } = "DBoyInShape"; + + + [Description("Enfant (1041)")] + public string EnfantDesc { get; set; } = "You are a Kid \ndo not the kid \nyou start with a rainbow candy (in theory) \n you're a bit smaller"; + public string EnfantPublicName { get; set; } = "kid"; + + + [Description("Mime (1053)")] + public string MimePublicName { get; set; } = "Mime"; + + + [Description("ChiefGuard (1046)")] + public string ChiefGuardPublicName { get; set; } = "Chief Guard"; + public string ChiefGuardDesc { get; set; } = "Tu es un Chef des gardes du site \nT'as une carte de private \net un crossvec"; + + + } +} From b26a0b124c89823525a71aaed445d699b1c3648b Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Fri, 20 Jun 2025 01:49:11 +0200 Subject: [PATCH 275/853] moved the KECustom --- .../KE.Items/Extensions/PlayerExtensions.cs | 1 + .../{ => Features}/KECustomGrenade.cs | 6 +- .../KE.Items/{ => Features}/KECustomItem.cs | 18 ++--- .../KE.Items/Features/KECustomKeycard.cs | 33 ++++++++ .../KE.Items/Features/KEDroppableItem.cs | 48 +++++++++++ .../KE.Items/ItemEffects/MineEffect.cs | 79 ++++++++++++++++--- .../KE.Items/Items/AdrenalineDrogue.cs | 2 +- KruacentExiled/KE.Items/Items/Defibrilator.cs | 2 +- .../KE.Items/Items/DeployableWall.cs | 1 + KruacentExiled/KE.Items/Items/DivinePills.cs | 2 +- KruacentExiled/KE.Items/Items/HealZone.cs | 1 + KruacentExiled/KE.Items/Items/ImpactFlash.cs | 1 + KruacentExiled/KE.Items/Items/Mine.cs | 2 +- KruacentExiled/KE.Items/Items/Molotov.cs | 1 + KruacentExiled/KE.Items/Items/PressePuree.cs | 1 + .../KE.Items/Items/SainteGrenada.cs | 1 + KruacentExiled/KE.Items/Items/Scp1650.cs | 1 + KruacentExiled/KE.Items/Items/Scp3136.cs | 1 + KruacentExiled/KE.Items/Items/Scp514.cs | 3 +- KruacentExiled/KE.Items/Items/Scp7045.cs | 1 + KruacentExiled/KE.Items/Items/TPGrenada.cs | 1 + .../KE.Items/Items/TrueDivinePills.cs | 2 +- KruacentExiled/KE.Items/MainPlugin.cs | 12 ++- 23 files changed, 187 insertions(+), 33 deletions(-) rename KruacentExiled/KE.Items/{ => Features}/KECustomGrenade.cs (81%) rename KruacentExiled/KE.Items/{ => Features}/KECustomItem.cs (89%) create mode 100644 KruacentExiled/KE.Items/Features/KECustomKeycard.cs create mode 100644 KruacentExiled/KE.Items/Features/KEDroppableItem.cs diff --git a/KruacentExiled/KE.Items/Extensions/PlayerExtensions.cs b/KruacentExiled/KE.Items/Extensions/PlayerExtensions.cs index 89aac497..9f10f9e4 100644 --- a/KruacentExiled/KE.Items/Extensions/PlayerExtensions.cs +++ b/KruacentExiled/KE.Items/Extensions/PlayerExtensions.cs @@ -1,4 +1,5 @@ using Exiled.API.Features; +using KE.Items.Features; using System; using System.Collections.Generic; using System.Linq; diff --git a/KruacentExiled/KE.Items/KECustomGrenade.cs b/KruacentExiled/KE.Items/Features/KECustomGrenade.cs similarity index 81% rename from KruacentExiled/KE.Items/KECustomGrenade.cs rename to KruacentExiled/KE.Items/Features/KECustomGrenade.cs index c17544d5..823f00b4 100644 --- a/KruacentExiled/KE.Items/KECustomGrenade.cs +++ b/KruacentExiled/KE.Items/Features/KECustomGrenade.cs @@ -1,14 +1,14 @@ using Exiled.API.Features; using Exiled.CustomItems.API.Features; -namespace KE.Items +namespace KE.Items.Features { public abstract class KECustomGrenade : CustomGrenade { - + protected override void ShowPickedUpMessage(Player player) { - KECustomItem.Message(this,player,true); + KECustomItem.Message(this, player, true); } protected override void ShowSelectedMessage(Player player) diff --git a/KruacentExiled/KE.Items/KECustomItem.cs b/KruacentExiled/KE.Items/Features/KECustomItem.cs similarity index 89% rename from KruacentExiled/KE.Items/KECustomItem.cs rename to KruacentExiled/KE.Items/Features/KECustomItem.cs index 16571475..fee3df4c 100644 --- a/KruacentExiled/KE.Items/KECustomItem.cs +++ b/KruacentExiled/KE.Items/Features/KECustomItem.cs @@ -9,15 +9,15 @@ using HintServiceMeow.Core.Utilities; using System.Reflection; -namespace KE.Items +namespace KE.Items.Features { public abstract class KECustomItem : CustomItem { - + protected override void ShowPickedUpMessage(Player player) { Log.Debug("pickup"); - Message(this, player,true); + Message(this, player, true); } protected override void ShowSelectedMessage(Player player) @@ -68,27 +68,27 @@ internal static void Message(CustomItem c, Player player, bool pickedUp = false) builder.AppendLine($"{c.Name}"); } } - + } float delay = MainPlugin.Instance.SettingsHandler.GetTime(player); - DisplayHandler.Instance.AddHint(MainPlugin.HintPlacement, player, builder.ToString(),delay); + DisplayHandler.Instance.AddHint(MainPlugin.HintPlacement, player, builder.ToString(), delay); + - } - public static void ItemEffectHint(Player player,string text) + public static void ItemEffectHint(Player player, string text) { float delay = MainPlugin.Instance.SettingsHandler.GetTimeEffect(player); - DisplayHandler.Instance.AddHint(MainPlugin.ItemEffectPlacement, player,text , delay); + DisplayHandler.Instance.AddHint(MainPlugin.ItemEffectPlacement, player, text, delay); } - + } } diff --git a/KruacentExiled/KE.Items/Features/KECustomKeycard.cs b/KruacentExiled/KE.Items/Features/KECustomKeycard.cs new file mode 100644 index 00000000..87380725 --- /dev/null +++ b/KruacentExiled/KE.Items/Features/KECustomKeycard.cs @@ -0,0 +1,33 @@ +using Exiled.API.Features; +using Exiled.CustomItems.API.Features; +using MHints = HintServiceMeow.Core.Models.Hints.Hint; +using KE.Items.Interface; +using System.Text; +using KE.Utils.API.Displays.DisplayMeow; +using MEC; +using HintServiceMeow.Core.Extension; +using HintServiceMeow.Core.Utilities; +using System.Reflection; +using Exiled.Events.EventArgs.Player; +using Exiled.API.Features.Items; +using Exiled.API.Extensions; + +namespace KE.Items.Features +{ + public abstract class KECustomKeycard : CustomKeycard + { + + protected override void ShowPickedUpMessage(Player player) + { + KECustomItem.Message(this, player, true); + } + + protected override void ShowSelectedMessage(Player player) + { + KECustomItem.Message(this, player); + } + + + + } +} diff --git a/KruacentExiled/KE.Items/Features/KEDroppableItem.cs b/KruacentExiled/KE.Items/Features/KEDroppableItem.cs new file mode 100644 index 00000000..7710f92b --- /dev/null +++ b/KruacentExiled/KE.Items/Features/KEDroppableItem.cs @@ -0,0 +1,48 @@ +using Exiled.Events.EventArgs.Player; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace KE.Items.Features +{ + public abstract class KEDroppableItem : KECustomKeycard + { + + protected override void SubscribeEvents() + { + Exiled.Events.Handlers.Player.DroppingItem += this.DroppingItem; + base.SubscribeEvents(); + } + + + protected override void UnsubscribeEvents() + { + Exiled.Events.Handlers.Player.DroppingItem -= this.DroppingItem; + base.UnsubscribeEvents(); + } + + + private void DroppingItem(DroppingItemEventArgs ev) + { + if (!Check(ev.Item)) return; + if (ev.IsThrown) + { + return; + } + + ev.IsAllowed = false; + DroppingEffect(ev); + } + + + /// + /// no need to check if thrown + /// but still need to remove the item afterward + /// + /// + protected abstract void DroppingEffect(DroppingItemEventArgs ev); + + } +} diff --git a/KruacentExiled/KE.Items/ItemEffects/MineEffect.cs b/KruacentExiled/KE.Items/ItemEffects/MineEffect.cs index 3bd7dd71..2d31ee87 100644 --- a/KruacentExiled/KE.Items/ItemEffects/MineEffect.cs +++ b/KruacentExiled/KE.Items/ItemEffects/MineEffect.cs @@ -1,10 +1,14 @@ using Exiled.API.Features; using Exiled.API.Features.Items; +using Exiled.API.Features.Pickups; +using Exiled.API.Features.Pickups.Projectiles; +using Exiled.API.Interfaces; using Exiled.Events.EventArgs.Map; using Exiled.Events.EventArgs.Player; using KE.Items.Extensions; using KE.Items.Interface; using KE.Items.Items.Models; +using KE.Utils.API.Interfaces; using MEC; using System; using System.Collections.Generic; @@ -15,7 +19,7 @@ namespace KE.Items.ItemEffects { - public class MineEffect : CustomItemEffect + public class MineEffect : CustomItemEffect, IUsingEvents { private const float RefreshRate = .01f; private const int MineActivationTime = 10; @@ -34,6 +38,19 @@ public override void Effect(ExplodingGrenadeEventArgs ev) PlaceMine(ev.Player,ev.Position); } + public void SubscribeEvents() + { + Exiled.Events.Handlers.Map.ExplodingGrenade += OnExplodingGrenade; + } + public void UnsubscribeEvents() + { + + } + + private void OnExplodingGrenade(ExplodingGrenadeEventArgs ev) + { + + } /// /// Place the mine at the feet of the player @@ -65,6 +82,22 @@ private void SpawnMine(Player p,Vector3 pos) Timing.RunCoroutine(WaitAndActivateMine(p, m)); } + private ExplosiveGrenade _grenade; + private ExplosiveGrenade Grenade + { + get + { + if (_grenade == null) + { + _grenade = (ExplosiveGrenade)Item.Create(ItemType.GrenadeHE); + _grenade.MaxRadius = 3; + _grenade.ScpDamageMultiplier = 1f; + _grenade.FuseTime = 0f; + } + return _grenade; + } + } + private IEnumerator WaitAndActivateMine(Player player, MineModel mine) { @@ -84,18 +117,29 @@ private IEnumerator WaitAndActivateMine(Player player, MineModel mine) private IEnumerator ActiveMine(MineModel mine, float cylinderSize) { Timing.RunCoroutine(mine.Activate()); - bool endWhile = true; - while (endWhile) + bool isActivated = true; + while (isActivated) { - foreach (Player player in Player.List) + + foreach (IWorldSpace p in Pickup.List) { - if (IsPlayerInZone(player, mine.Position, cylinderSize, 3)) + if (IsPositionInZone(p.Position,mine.Position, cylinderSize, 3)) { - ((ExplosiveGrenade)Item.Create(ItemType.GrenadeHE)).SpawnActive(mine.Position).FuseTime = 0f; + Grenade.SpawnActive(mine.Position); + DestroyMine(mine); + isActivated = false; + break; + } + } - // Delete the mine - mine.UnSpawn(); - endWhile = false; + foreach (Player player in Player.List) + { + + if (isActivated && IsPlayerInZone(player, mine.Position, cylinderSize, 3)) + { + Grenade.SpawnActive(mine.Position); + DestroyMine(mine); + isActivated = false; break; } } @@ -104,16 +148,29 @@ private IEnumerator ActiveMine(MineModel mine, float cylinderSize) } } + private void DestroyMine(MineModel mine) + { + mine.Destroy(); + UnsubscribeEvents(); + } + + private bool IsPlayerInZone(Player player, Vector3 zonePosition, float radius, float height) + { + return IsPositionInZone(player.Position, zonePosition, radius, height); + + } + + private bool IsPositionInZone(Vector3 position, Vector3 zonePosition, float radius, float height) { // Calculate the horizontal distance (x, z) float horizontalDistance = Vector3.Distance( - new Vector3(player.Position.x, 0, player.Position.z), + new Vector3(position.x, 0, position.z), new Vector3(zonePosition.x, 0, zonePosition.z) ); // Calculate the vertical difference (y) - float verticalDifference = Mathf.Abs(player.Position.y - zonePosition.y); + float verticalDifference = Mathf.Abs(position.y - zonePosition.y); // Check if the player is in the 3d zone. return horizontalDistance <= (radius / 2) && verticalDifference <= (height / 2); diff --git a/KruacentExiled/KE.Items/Items/AdrenalineDrogue.cs b/KruacentExiled/KE.Items/Items/AdrenalineDrogue.cs index f4bc6f75..ce4e90e0 100644 --- a/KruacentExiled/KE.Items/Items/AdrenalineDrogue.cs +++ b/KruacentExiled/KE.Items/Items/AdrenalineDrogue.cs @@ -12,8 +12,8 @@ using CustomPlayerEffects; using KE.Items.Interface; using System.Linq; -using KE.Items; using KE.Items.Extensions; +using KE.Items.Features; /// [CustomItem(ItemType.Adrenaline)] diff --git a/KruacentExiled/KE.Items/Items/Defibrilator.cs b/KruacentExiled/KE.Items/Items/Defibrilator.cs index 47d3bfdb..c60c89f9 100644 --- a/KruacentExiled/KE.Items/Items/Defibrilator.cs +++ b/KruacentExiled/KE.Items/Items/Defibrilator.cs @@ -10,8 +10,8 @@ using UnityEngine; using System.Linq; using KE.Items.Interface; -using KE.Items; using KE.Items.Extensions; +using KE.Items.Features; [CustomItem(ItemType.SCP1853)] public class Defibrilator : KECustomItem, ILumosItem diff --git a/KruacentExiled/KE.Items/Items/DeployableWall.cs b/KruacentExiled/KE.Items/Items/DeployableWall.cs index 34fa98d6..79b3f724 100644 --- a/KruacentExiled/KE.Items/Items/DeployableWall.cs +++ b/KruacentExiled/KE.Items/Items/DeployableWall.cs @@ -9,6 +9,7 @@ using Exiled.API.Features.Toys; using MEC; using KE.Items.ItemEffects; +using KE.Items.Features; namespace KE.Items.Items { diff --git a/KruacentExiled/KE.Items/Items/DivinePills.cs b/KruacentExiled/KE.Items/Items/DivinePills.cs index 6aa402e6..2440971f 100644 --- a/KruacentExiled/KE.Items/Items/DivinePills.cs +++ b/KruacentExiled/KE.Items/Items/DivinePills.cs @@ -22,7 +22,7 @@ using KE.Items.Upgrade; using Scp914; using System.Collections.ObjectModel; -using KE.Items; +using KE.Items.Features; /// [CustomItem(ItemType.Painkillers)] diff --git a/KruacentExiled/KE.Items/Items/HealZone.cs b/KruacentExiled/KE.Items/Items/HealZone.cs index 2c5d0774..64a40dfd 100644 --- a/KruacentExiled/KE.Items/Items/HealZone.cs +++ b/KruacentExiled/KE.Items/Items/HealZone.cs @@ -10,6 +10,7 @@ using MEC; using UnityEngine; using KE.Items.ItemEffects; +using KE.Items.Features; namespace KE.Items.Items { diff --git a/KruacentExiled/KE.Items/Items/ImpactFlash.cs b/KruacentExiled/KE.Items/Items/ImpactFlash.cs index 6f2c2f1a..e3c93343 100644 --- a/KruacentExiled/KE.Items/Items/ImpactFlash.cs +++ b/KruacentExiled/KE.Items/Items/ImpactFlash.cs @@ -3,6 +3,7 @@ using Exiled.API.Features.Attributes; using Exiled.API.Features.Spawn; using Exiled.CustomItems.API.Features; +using KE.Items.Features; namespace KE.Items.Items { diff --git a/KruacentExiled/KE.Items/Items/Mine.cs b/KruacentExiled/KE.Items/Items/Mine.cs index 4d759ba8..94bbea71 100644 --- a/KruacentExiled/KE.Items/Items/Mine.cs +++ b/KruacentExiled/KE.Items/Items/Mine.cs @@ -10,6 +10,7 @@ using KE.Utils.Quality.Models; using KE.Utils.Quality.Models.Examples; using MEC; +using KE.Items.Features; namespace KE.Items.Items { @@ -86,7 +87,6 @@ protected override void SubscribeEvents() protected override void UnsubscribeEvents() { - Exiled.Events.Handlers.Server.RoundStarted -= SetPickup; Exiled.Events.Handlers.Server.RoundStarted -= SetPickup; base.UnsubscribeEvents(); } diff --git a/KruacentExiled/KE.Items/Items/Molotov.cs b/KruacentExiled/KE.Items/Items/Molotov.cs index 5d4e2433..ca7305a8 100644 --- a/KruacentExiled/KE.Items/Items/Molotov.cs +++ b/KruacentExiled/KE.Items/Items/Molotov.cs @@ -4,6 +4,7 @@ using Exiled.API.Features.Spawn; using Exiled.CustomItems.API.Features; using Exiled.Events.EventArgs.Map; +using KE.Items.Features; using KE.Items.Interface; using KE.Items.ItemEffects; diff --git a/KruacentExiled/KE.Items/Items/PressePuree.cs b/KruacentExiled/KE.Items/Items/PressePuree.cs index 97463de1..57018e7f 100644 --- a/KruacentExiled/KE.Items/Items/PressePuree.cs +++ b/KruacentExiled/KE.Items/Items/PressePuree.cs @@ -7,6 +7,7 @@ using Exiled.API.Features.Spawn; using Exiled.CustomItems.API.Features; using Exiled.Events.EventArgs.Scp914; +using KE.Items.Features; using KE.Items.Interface; using KE.Items.Upgrade; using Scp914; diff --git a/KruacentExiled/KE.Items/Items/SainteGrenada.cs b/KruacentExiled/KE.Items/Items/SainteGrenada.cs index 35cce201..b523fea2 100644 --- a/KruacentExiled/KE.Items/Items/SainteGrenada.cs +++ b/KruacentExiled/KE.Items/Items/SainteGrenada.cs @@ -9,6 +9,7 @@ using Exiled.CustomItems.API.Features; using Exiled.Events.EventArgs.Map; using Exiled.Events.EventArgs.Player; +using KE.Items.Features; using KE.Items.Interface; using UnityEngine; diff --git a/KruacentExiled/KE.Items/Items/Scp1650.cs b/KruacentExiled/KE.Items/Items/Scp1650.cs index 97d3cbdf..d4ca26bb 100644 --- a/KruacentExiled/KE.Items/Items/Scp1650.cs +++ b/KruacentExiled/KE.Items/Items/Scp1650.cs @@ -3,6 +3,7 @@ using Exiled.API.Features.Spawn; using Exiled.CustomItems.API.Features; using Exiled.Events.EventArgs.Player; +using KE.Items.Features; using KE.Items.Interface; using KE.Items.ItemEffects; using MEC; diff --git a/KruacentExiled/KE.Items/Items/Scp3136.cs b/KruacentExiled/KE.Items/Items/Scp3136.cs index dbd91799..a383aa2f 100644 --- a/KruacentExiled/KE.Items/Items/Scp3136.cs +++ b/KruacentExiled/KE.Items/Items/Scp3136.cs @@ -6,6 +6,7 @@ using Exiled.CustomItems.API.Features; using Exiled.Events.EventArgs.Player; using Exiled.Events.EventArgs.Server; +using KE.Items.Features; using MEC; using PlayerRoles; using System; diff --git a/KruacentExiled/KE.Items/Items/Scp514.cs b/KruacentExiled/KE.Items/Items/Scp514.cs index f45fb15e..e0d968ea 100644 --- a/KruacentExiled/KE.Items/Items/Scp514.cs +++ b/KruacentExiled/KE.Items/Items/Scp514.cs @@ -6,12 +6,13 @@ using Exiled.Events.EventArgs.Scp173; using Exiled.Events.EventArgs.Scp939; using Exiled.Events.Handlers; +using KE.Items.Features; using KE.Items.Items.Models; using MEC; using System.Collections.Generic; using System.Linq; using UnityEngine; -using Player= Exiled.API.Features.Player; +using Player = Exiled.API.Features.Player; namespace KE.Items.Items { diff --git a/KruacentExiled/KE.Items/Items/Scp7045.cs b/KruacentExiled/KE.Items/Items/Scp7045.cs index 42597c4b..ba1eca47 100644 --- a/KruacentExiled/KE.Items/Items/Scp7045.cs +++ b/KruacentExiled/KE.Items/Items/Scp7045.cs @@ -8,6 +8,7 @@ using Exiled.CustomItems.API.Features; using Exiled.Events.EventArgs.Player; using Exiled.Events.EventArgs.Server; +using KE.Items.Features; using MEC; using PlayerRoles; using System; diff --git a/KruacentExiled/KE.Items/Items/TPGrenada.cs b/KruacentExiled/KE.Items/Items/TPGrenada.cs index 0e4c45da..6803d2a6 100644 --- a/KruacentExiled/KE.Items/Items/TPGrenada.cs +++ b/KruacentExiled/KE.Items/Items/TPGrenada.cs @@ -9,6 +9,7 @@ using Exiled.API.Features.Spawn; using Exiled.CustomItems.API.Features; using Exiled.Events.EventArgs.Map; +using KE.Items.Features; using KE.Items.Interface; using KE.Items.ItemEffects; using PlayerRoles; diff --git a/KruacentExiled/KE.Items/Items/TrueDivinePills.cs b/KruacentExiled/KE.Items/Items/TrueDivinePills.cs index bf0aa527..dc0f5df4 100644 --- a/KruacentExiled/KE.Items/Items/TrueDivinePills.cs +++ b/KruacentExiled/KE.Items/Items/TrueDivinePills.cs @@ -15,7 +15,7 @@ using KE.Items.Interface; using Exiled.CustomItems.API.EventArgs; using Exiled.Events.EventArgs.Scp914; -using KE.Items; +using KE.Items.Features; /// [CustomItem(ItemType.SCP500)] diff --git a/KruacentExiled/KE.Items/MainPlugin.cs b/KruacentExiled/KE.Items/MainPlugin.cs index 5e598249..804da001 100644 --- a/KruacentExiled/KE.Items/MainPlugin.cs +++ b/KruacentExiled/KE.Items/MainPlugin.cs @@ -1,12 +1,18 @@  using Exiled.API.Enums; +using Exiled.API.Extensions; using Exiled.API.Features; +using Exiled.API.Features.Toys; using Exiled.CustomItems.API.Features; using KE.Items.Lights; using KE.Items.Settings; using KE.Items.Upgrade; using KE.Utils.API.Displays.DisplayMeow; +using KE.Utils.API.Models; +using PlayerRoles; using System; +using UnityEngine; +using Light = Exiled.API.Features.Toys.Light; namespace KE.Items { @@ -43,7 +49,7 @@ public override void OnEnabled() Sound.LoadClips(); - + //Exiled.Events.Handlers.Server.RoundStarted += Test; @@ -53,7 +59,6 @@ public override void OnEnabled() SettingsHandler.SubscribeEvents(); UpgradeHandler.SubscribeEvents(); LightsHandler.SubscribeEvents(); - base.OnEnabled(); } @@ -66,10 +71,8 @@ public override void OnDisabled() //QualityHandler?.Unregister(); SettingsHandler.UnsubscribeEvents(); - base.OnDisabled(); //QualityHandler = null; //PickupQuality = null; - SettingsHandler = null; LightsHandler = null; Sound = null; @@ -80,5 +83,6 @@ public override void OnDisabled() + } } \ No newline at end of file From daf2e31548d4bac4bf7d8b7d8503f2d12119f8ed Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Fri, 20 Jun 2025 01:51:43 +0200 Subject: [PATCH 276/853] merged utils --- .../API/Models/Commands/CreateModel.cs | 38 +++++ .../KE.Utils/API/Models/Commands/ListModel.cs | 35 +++++ .../API/Models/Commands/ModelParent.cs | 42 ++++++ .../API/Models/Commands/SelectModel.cs | 40 +++++ KruacentExiled/KE.Utils/API/Models/Model.cs | 141 ++++++++++++++++++ .../KE.Utils/API/Models/ModelCreator.cs | 63 ++++++++ .../KE.Utils/API/Models/ModelLoader.cs | 129 ++++++++++++++++ KruacentExiled/KE.Utils/API/Models/Models.cs | 30 ++++ .../Models/ToysSettings/PrimitiveSetting.cs | 31 ++++ .../API/Models/ToysSettings/ToySetting.cs | 20 +++ KruacentExiled/KE.Utils/API/Parser.cs | 19 +++ KruacentExiled/Map/KE.Map.csproj | 1 + 12 files changed, 589 insertions(+) create mode 100644 KruacentExiled/KE.Utils/API/Models/Commands/CreateModel.cs create mode 100644 KruacentExiled/KE.Utils/API/Models/Commands/ListModel.cs create mode 100644 KruacentExiled/KE.Utils/API/Models/Commands/ModelParent.cs create mode 100644 KruacentExiled/KE.Utils/API/Models/Commands/SelectModel.cs create mode 100644 KruacentExiled/KE.Utils/API/Models/Model.cs create mode 100644 KruacentExiled/KE.Utils/API/Models/ModelCreator.cs create mode 100644 KruacentExiled/KE.Utils/API/Models/ModelLoader.cs create mode 100644 KruacentExiled/KE.Utils/API/Models/Models.cs create mode 100644 KruacentExiled/KE.Utils/API/Models/ToysSettings/PrimitiveSetting.cs create mode 100644 KruacentExiled/KE.Utils/API/Models/ToysSettings/ToySetting.cs create mode 100644 KruacentExiled/KE.Utils/API/Parser.cs diff --git a/KruacentExiled/KE.Utils/API/Models/Commands/CreateModel.cs b/KruacentExiled/KE.Utils/API/Models/Commands/CreateModel.cs new file mode 100644 index 00000000..9704d32b --- /dev/null +++ b/KruacentExiled/KE.Utils/API/Models/Commands/CreateModel.cs @@ -0,0 +1,38 @@ +using CommandSystem; +using Exiled.API.Features; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace KE.Utils.API.Models.Commands +{ + internal class CreateModel : ICommand + { + + public string Command { get; } = "create"; + + public string[] Aliases { get; } = { "c" }; + + public string Description { get; } = "create a new model at your position"; + + public bool Execute(ArraySegment arguments, ICommandSender sender, out string response) + { + + Player p = Player.Get(sender); + if(p == null) + { + response = "This player can't do this command"; + return false; + } + + + + Model m = Model.Create(p.Position, arguments.At(1)); + response = $"Created model ({m.Name}) at {m.Center}"; + return true; + } + + } +} diff --git a/KruacentExiled/KE.Utils/API/Models/Commands/ListModel.cs b/KruacentExiled/KE.Utils/API/Models/Commands/ListModel.cs new file mode 100644 index 00000000..8cff9a41 --- /dev/null +++ b/KruacentExiled/KE.Utils/API/Models/Commands/ListModel.cs @@ -0,0 +1,35 @@ +using CommandSystem; +using Exiled.API.Features; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace KE.Utils.API.Models.Commands +{ + internal class ListModel : ICommand + { + + public string Command { get; } = "list"; + + public string[] Aliases { get; } = { "l" }; + + public string Description { get; } = "create a new model at your position"; + + public bool Execute(ArraySegment arguments, ICommandSender sender, out string response) + { + StringBuilder b = new(); + b.AppendLine($"Models ({Model.Models.Count}) :"); + foreach(Model m in Model.Models) + { + b.AppendLine($"({m.Id}) - {m.Name} pos: {m.Id}"); + } + + + response = b.ToString(); + return true; + } + + } +} diff --git a/KruacentExiled/KE.Utils/API/Models/Commands/ModelParent.cs b/KruacentExiled/KE.Utils/API/Models/Commands/ModelParent.cs new file mode 100644 index 00000000..805f0a3f --- /dev/null +++ b/KruacentExiled/KE.Utils/API/Models/Commands/ModelParent.cs @@ -0,0 +1,42 @@ +using CommandSystem; +using Exiled.Permissions.Extensions; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace KE.Utils.API.Models.Commands +{ + [CommandHandler(typeof(RemoteAdminCommandHandler))] + public class ModelParent : ParentCommand + { + public ModelParent() + { + LoadGeneratedCommands(); + + } + + public override string Command { get; } = "model"; + + /// + public override string[] Aliases { get; } = { "m" }; + + /// + public override string Description { get; } = "models"; + + + public override void LoadGeneratedCommands() + { + RegisterCommand(new CreateModel()); + RegisterCommand(new ListModel()); + } + + protected override bool ExecuteParent(ArraySegment arguments, ICommandSender sender, out string response) + { + response = string.Empty; + return true; + } + + } +} diff --git a/KruacentExiled/KE.Utils/API/Models/Commands/SelectModel.cs b/KruacentExiled/KE.Utils/API/Models/Commands/SelectModel.cs new file mode 100644 index 00000000..1fbb6bf4 --- /dev/null +++ b/KruacentExiled/KE.Utils/API/Models/Commands/SelectModel.cs @@ -0,0 +1,40 @@ +using CommandSystem; +using Exiled.API.Features; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace KE.Utils.API.Models.Commands +{ + internal class SelectModel : ICommand + { + + public string Command { get; } = "select"; + + public string[] Aliases { get; } = { "s" }; + + public string Description { get; } = "select an existing"; + + public bool Execute(ArraySegment arguments, ICommandSender sender, out string response) + { + + Player p = Player.Get(sender); + if(p == null) + { + response = "This player can't do this command"; + return false; + } + + if(!Model.TryGet(int.Parse(arguments.At(1)),out Model m)) + { + response = "model not found"; + return false; + } + response = $"model ({m.Name}) selected {m.Center}"; + return true; + } + + } +} diff --git a/KruacentExiled/KE.Utils/API/Models/Model.cs b/KruacentExiled/KE.Utils/API/Models/Model.cs new file mode 100644 index 00000000..00a54cfc --- /dev/null +++ b/KruacentExiled/KE.Utils/API/Models/Model.cs @@ -0,0 +1,141 @@ +using Exiled.API.Features; +using Exiled.API.Features.Core; +using Exiled.API.Features.Doors; +using Exiled.API.Features.Toys; +using Exiled.API.Structs; +using KE.Utils.API.Models.ToysSettings; +using System.Collections.Generic; +using System.Linq; +using System.Runtime.InteropServices; +using UnityEngine; +using Light = Exiled.API.Features.Toys.Light; + +namespace KE.Utils.API.Models +{ + public class Model + { + private static List _models = new(1); + public static List Models => _models.ToList(); + + private HashSet _toys = new(); + public IReadOnlyCollection Toys => [.. _toys]; + private string _name; + public string Name + { + get { return _name; } + } + + private Vector3 _center; + public Vector3 Center + { + get { return _center; } + } + + private int _id; + public int Id + { + get { return _id; } + } + + + + public void Add(Primitive p) + { + AddToy(p); + + } + public void Add(Light l) + { + AddToy(l); + } + + + private void AddToy(AdminToy toy) + { + _toys.Add(toy); + } + + public void Spawn() + { + foreach(AdminToy t in Toys) + { + t.Spawn(); + } + } + public void UnSpawn() + { + foreach (AdminToy t in Toys) + { + t.UnSpawn(); + } + } + + public void Destroy() + { + foreach (AdminToy t in Toys) + { + t.Destroy(); + } + } + + internal static Model Create(Vector3 position,IEnumerable toys, string name = "") + { + var m =Model.Create(position, name); + m._toys = toys.ToHashSet(); + + return m; + } + + public static Model Create(Vector3 position, string name= "") + { + + Model m = new(); + _models.Add(m); + m._id = _models.Count; + m._center = position; + if (string.IsNullOrEmpty(name)) + { + m._name = "Model" + m.Id; + } + else + { + m._name = name; + } + + Log.Debug("created model id=" + m.Id); + + + return m; + } + + + public static Model Get(string name) + { + foreach(Model m in _models) + { + if(m.Name == name) + { + return m; + } + } + return null; + } + + public static Model Get(int id) + { + _models.TryGet(id, out Model m); + return m; + } + public static bool TryGet(int id, out Model model) + { + model = Get(id); + return model != null; + } + + + public override string ToString() + { + return $"{Id} : {Name} center = {Center}"; + } + } +} diff --git a/KruacentExiled/KE.Utils/API/Models/ModelCreator.cs b/KruacentExiled/KE.Utils/API/Models/ModelCreator.cs new file mode 100644 index 00000000..1003e790 --- /dev/null +++ b/KruacentExiled/KE.Utils/API/Models/ModelCreator.cs @@ -0,0 +1,63 @@ +using Exiled.API.Features.Toys; +using Exiled.Events.EventArgs.Player; +using KE.Utils.API.Interfaces; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace KE.Utils.API.Models +{ + public class ModelCreator : IUsingEvents + { + public const ItemType item = ItemType.GunShotgun; + private static ModelCreator _inst; + public static ModelCreator Instance + { + get + { + if (_inst == null) + _inst = new(); + return _inst; + } + } + + + private bool mode = false; + + private Primitive _primitiveSelected; + + + public void SubscribeEvents() + { + Exiled.Events.Handlers.Player.DryfiringWeapon -= OnDryfiringWeapon; + Exiled.Events.Handlers.Player.TogglingWeaponFlashlight += OnTogglingWeaponFlashlight; + } + + public void UnsubscribeEvents() + { + Exiled.Events.Handlers.Player.DryfiringWeapon -= OnDryfiringWeapon; + Exiled.Events.Handlers.Player.TogglingWeaponFlashlight -= OnTogglingWeaponFlashlight; + } + + private void OnDryfiringWeapon(DryfiringWeaponEventArgs ev) + { + if (ev.Firearm.Type != item) return; + + + + + } + + private void OnTogglingWeaponFlashlight(TogglingWeaponFlashlightEventArgs ev) + { + if (ev.Firearm.Type != item) return; + + mode = !mode; + + } + + + } +} diff --git a/KruacentExiled/KE.Utils/API/Models/ModelLoader.cs b/KruacentExiled/KE.Utils/API/Models/ModelLoader.cs new file mode 100644 index 00000000..14a430b5 --- /dev/null +++ b/KruacentExiled/KE.Utils/API/Models/ModelLoader.cs @@ -0,0 +1,129 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.IO; +using Exiled.API.Features; +using Exiled.API.Features.Toys; +using UnityEngine; +using Light = Exiled.API.Features.Toys.Light; +using Exiled.API.Enums; +namespace KE.Utils.API.Models +{ + public static class ModelLoader + { + public static string Path => Paths.Configs + @"\"; + private static readonly char SEPARATOR = '_'; + + + public static Model Load(string filename) + { + return Load(Path, filename); + } + + public static Model Load(string path,string filename) + { + + string[] raw = File.ReadAllText(path+ filename).Split('\n'); + string[] infoline = raw[0].Split(SEPARATOR); + foreach(string i in infoline) + { + Log.Info(i); + } + string name = infoline[0]; + Vector3 center = Parser.Vector3(infoline[1]); + List toys = new(); + + + for (int i = 1; i < raw.Length; i++) + { + string[] line = raw[i].Split(SEPARATOR); + AdminToy toy = null; + AdminToyType type; + if (!Enum.TryParse(line[0], out type)) continue; + + Vector3 ATPos = Parser.Vector3(line[1]); + Vector3 ATRotation = Parser.Vector3(line[2]); + Vector3 ATScale = Parser.Vector3(line[3]); + if(type == AdminToyType.PrimitiveObject) + { + Color color; + ColorUtility.TryParseHtmlString(line[4], out color); + PrimitiveType ptype; + Enum.TryParse(line[5], out ptype); + bool collidable = bool.Parse(line[6]); + var p = Primitive.Create(ptype, ATPos, ATRotation, ATScale, true, color); + p.Collidable = collidable; + toy = p; + + } + if(type == AdminToyType.LightSource) + { + Color color; + ColorUtility.TryParseHtmlString(line[4], out color); + + float intensity = float.Parse(line[5]); + var l = Light.Create(ATPos, ATRotation, ATScale, true, color); + l.Intensity = intensity; + toy = l; + } + + if (toy == null) continue; + toys.Add(toy); + + } + + + + + return Model.Create(center, name); + } + + + // Name.Center\nAdminToyType.ATPosition.ATRotationEuler.ATScale.LightPrimitiveColor.PrimitiveType.PrimitiveCollidable.LightIntensity\n and repeat + // + public static void Save(Model m) + { + + StringBuilder b = new(); + List result = new(); + + result.Add(m.Name+SEPARATOR+m.Center); + + foreach(AdminToy t in m.Toys) + { + b.Append(t.ToyType); + b.Append(SEPARATOR); + b.Append(t.Position); + b.Append(SEPARATOR); + b.Append(t.Rotation.eulerAngles); + b.Append(SEPARATOR); + b.Append(t.Scale); + b.Append(SEPARATOR); + + if (t is Primitive p) + { + b.Append("#"+ColorUtility.ToHtmlStringRGBA(p.Color)); + b.Append(SEPARATOR); + b.Append(p.Type); + b.Append(SEPARATOR); + b.Append(p.Collidable); + } + if(t is Light l) + { + b.Append("#" + ColorUtility.ToHtmlStringRGBA(l.Color)); + b.Append(SEPARATOR); + b.Append(l.Intensity); + } + result.Add(b.ToString()); + b.Clear(); + } + + File.WriteAllLines(Path + m.Id + ".modelscpsl", result); + } + + + + + } +} diff --git a/KruacentExiled/KE.Utils/API/Models/Models.cs b/KruacentExiled/KE.Utils/API/Models/Models.cs new file mode 100644 index 00000000..3deab197 --- /dev/null +++ b/KruacentExiled/KE.Utils/API/Models/Models.cs @@ -0,0 +1,30 @@ +using KE.Utils.API.Interfaces; + +namespace KE.Utils.API.Models +{ + public class Models : IUsingEvents + { + private ModelCreator _model; + + public static Models Create() + { + return new(); + } + + private Models() + { + _model = new(); + } + + + public void SubscribeEvents() + { + _model.SubscribeEvents(); + } + + public void UnsubscribeEvents() + { + _model.UnsubscribeEvents(); + } + } +} diff --git a/KruacentExiled/KE.Utils/API/Models/ToysSettings/PrimitiveSetting.cs b/KruacentExiled/KE.Utils/API/Models/ToysSettings/PrimitiveSetting.cs new file mode 100644 index 00000000..b3ffe31d --- /dev/null +++ b/KruacentExiled/KE.Utils/API/Models/ToysSettings/PrimitiveSetting.cs @@ -0,0 +1,31 @@ +using AdminToys; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using UnityEngine; + +namespace KE.Utils.API.Models.ToysSettings +{ + public class PrimitiveSetting : ToySetting + { + + public PrimitiveType PrimitiveType { get; } + + + public PrimitiveFlags Flags { get; } + + + public Color Color { get; } + + public Vector3 Position { get; } + + + public Vector3 Rotation { get; } + + + public Vector3 Scale { get; } + + } +} diff --git a/KruacentExiled/KE.Utils/API/Models/ToysSettings/ToySetting.cs b/KruacentExiled/KE.Utils/API/Models/ToysSettings/ToySetting.cs new file mode 100644 index 00000000..8fdc4477 --- /dev/null +++ b/KruacentExiled/KE.Utils/API/Models/ToysSettings/ToySetting.cs @@ -0,0 +1,20 @@ +using Exiled.API.Features.Toys; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace KE.Utils.API.Models.ToysSettings +{ + public abstract class ToySetting + { + + + + public virtual void Create(AdminToy a) + { + + } + } +} diff --git a/KruacentExiled/KE.Utils/API/Parser.cs b/KruacentExiled/KE.Utils/API/Parser.cs new file mode 100644 index 00000000..e9a7958c --- /dev/null +++ b/KruacentExiled/KE.Utils/API/Parser.cs @@ -0,0 +1,19 @@ +using Exiled.API.Features; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using UnityEngine; + +namespace KE.Utils.API +{ + public static class Parser + { + public static Vector3 Vector3(string s) + { + string[] temp = s.Substring(1, s.Length - 3).Split(','); + return new Vector3(float.Parse(temp[0]), float.Parse(temp[1]), float.Parse(temp[2])); + } + } +} diff --git a/KruacentExiled/Map/KE.Map.csproj b/KruacentExiled/Map/KE.Map.csproj index 25e3c97c..64797cff 100644 --- a/KruacentExiled/Map/KE.Map.csproj +++ b/KruacentExiled/Map/KE.Map.csproj @@ -10,6 +10,7 @@ + From 00ab2691e38fe76a3b95cffe80b3e0f79a908998 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Fri, 20 Jun 2025 03:38:08 +0200 Subject: [PATCH 277/853] merging utils again --- .../Displays/DisplayMeow/DisplayHandler.cs | 67 +++++++ .../API/Displays/DisplayMeow/HintPlacement.cs | 31 +++ .../KE.Utils/API/Interfaces/IEvents.cs | 17 ++ .../KE.Utils/Extensions/AdminToyExtension.cs | 25 +++ .../KE.Utils/Extensions/PlayerExtension.cs | 52 +++++ .../KE.Utils/Extensions/RoomExtension.cs | 12 ++ KruacentExiled/KE.Utils/KE.Utils.csproj | 30 +++ .../KE.Utils/Quality/Enums/ModelQuality.cs | 16 ++ .../Quality/Handlers/QualityToysHandler.cs | 179 ++++++++++++++++++ .../KE.Utils/Quality/Models/Base/BaseModel.cs | 41 ++++ .../Quality/Models/Base/LightModel.cs | 26 +++ .../Quality/Models/Base/PrimitiveModel.cs | 26 +++ .../Quality/Models/Examples/MineModel.cs | 118 ++++++++++++ .../KE.Utils/Quality/Models/Model.cs | 104 ++++++++++ .../KE.Utils/Quality/Models/ModelPrefab.cs | 42 ++++ .../KE.Utils/Quality/Models/QualityModel.cs | 40 ++++ .../KE.Utils/Quality/QualityHandler.cs | 61 ++++++ .../KE.Utils/Quality/QualityToysHandler.cs | 155 +++++++++++++++ .../Quality/Settings/QualitySettings.cs | 62 ++++++ .../Quality/Structs/LocalWorldSpace.cs | 23 +++ KruacentExiled/KE.Utils/Quality/Tests/Test.cs | 108 +++++++++++ KruacentExiled/KruacentExiled.sln | 6 + 22 files changed, 1241 insertions(+) create mode 100644 KruacentExiled/KE.Utils/API/Displays/DisplayMeow/DisplayHandler.cs create mode 100644 KruacentExiled/KE.Utils/API/Displays/DisplayMeow/HintPlacement.cs create mode 100644 KruacentExiled/KE.Utils/API/Interfaces/IEvents.cs create mode 100644 KruacentExiled/KE.Utils/Extensions/AdminToyExtension.cs create mode 100644 KruacentExiled/KE.Utils/Extensions/PlayerExtension.cs create mode 100644 KruacentExiled/KE.Utils/Extensions/RoomExtension.cs create mode 100644 KruacentExiled/KE.Utils/KE.Utils.csproj create mode 100644 KruacentExiled/KE.Utils/Quality/Enums/ModelQuality.cs create mode 100644 KruacentExiled/KE.Utils/Quality/Handlers/QualityToysHandler.cs create mode 100644 KruacentExiled/KE.Utils/Quality/Models/Base/BaseModel.cs create mode 100644 KruacentExiled/KE.Utils/Quality/Models/Base/LightModel.cs create mode 100644 KruacentExiled/KE.Utils/Quality/Models/Base/PrimitiveModel.cs create mode 100644 KruacentExiled/KE.Utils/Quality/Models/Examples/MineModel.cs create mode 100644 KruacentExiled/KE.Utils/Quality/Models/Model.cs create mode 100644 KruacentExiled/KE.Utils/Quality/Models/ModelPrefab.cs create mode 100644 KruacentExiled/KE.Utils/Quality/Models/QualityModel.cs create mode 100644 KruacentExiled/KE.Utils/Quality/QualityHandler.cs create mode 100644 KruacentExiled/KE.Utils/Quality/QualityToysHandler.cs create mode 100644 KruacentExiled/KE.Utils/Quality/Settings/QualitySettings.cs create mode 100644 KruacentExiled/KE.Utils/Quality/Structs/LocalWorldSpace.cs create mode 100644 KruacentExiled/KE.Utils/Quality/Tests/Test.cs diff --git a/KruacentExiled/KE.Utils/API/Displays/DisplayMeow/DisplayHandler.cs b/KruacentExiled/KE.Utils/API/Displays/DisplayMeow/DisplayHandler.cs new file mode 100644 index 00000000..4ee13535 --- /dev/null +++ b/KruacentExiled/KE.Utils/API/Displays/DisplayMeow/DisplayHandler.cs @@ -0,0 +1,67 @@ +using Exiled.API.Features; +using HintServiceMeow.Core.Extension; +using HintServiceMeow.Core.Models.Hints; +using HintServiceMeow.Core.Utilities; +using MEC; + + +//damn why the same name +using MHint = HintServiceMeow.Core.Models.Hints.Hint; + +namespace KE.Utils.API.Displays.DisplayMeow +{ + public class DisplayHandler + { + public static DisplayHandler Instance { get; } = new(); + + private DisplayHandler() { } + + + + + + + public MHint AddHint(HintPlacement hintPlacement, Player player, string text, float delay) + { + var dis = PlayerDisplay.Get(player); + string id = $"{player.Id}_{hintPlacement.XCoordinate}_{hintPlacement.YCoordinate}"; + MHint hint; + + if (!dis.TryGetHint(id, out var aHint)) + { + hint = new() + { + Text = text, + XCoordinate = hintPlacement.XCoordinate, + YCoordinate = hintPlacement.YCoordinate, + Alignment = hintPlacement.HintAlignment, + Id = id + + }; + dis.AddHint(hint); + + } + else + { + + hint = (MHint)aHint; + hint.Hide = false; + hint.Text = text; + } + + + hint.HideAfter(delay); + return hint; + } + + + + + + + + + + + } +} diff --git a/KruacentExiled/KE.Utils/API/Displays/DisplayMeow/HintPlacement.cs b/KruacentExiled/KE.Utils/API/Displays/DisplayMeow/HintPlacement.cs new file mode 100644 index 00000000..936cdbe9 --- /dev/null +++ b/KruacentExiled/KE.Utils/API/Displays/DisplayMeow/HintPlacement.cs @@ -0,0 +1,31 @@ +using HintServiceMeow.Core.Enum; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace KE.Utils.API.Displays.DisplayMeow +{ + public readonly struct HintPlacement : IEquatable + { + public float YCoordinate { get; } + public float XCoordinate { get; } + public HintAlignment HintAlignment { get; } = HintAlignment.Center; + + + public bool Equals(HintPlacement obj) + { + return YCoordinate == obj.YCoordinate && XCoordinate == obj.XCoordinate; + } + + + public HintPlacement(float xCoordinate, float yCoordinate, HintAlignment alignment = HintAlignment.Center) + { + YCoordinate = yCoordinate; + XCoordinate = xCoordinate; + HintAlignment = alignment; + } + + } +} diff --git a/KruacentExiled/KE.Utils/API/Interfaces/IEvents.cs b/KruacentExiled/KE.Utils/API/Interfaces/IEvents.cs new file mode 100644 index 00000000..e573b062 --- /dev/null +++ b/KruacentExiled/KE.Utils/API/Interfaces/IEvents.cs @@ -0,0 +1,17 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace KE.Utils.API.Interfaces +{ + public interface IUsingEvents + { + + + public void SubscribeEvents(); + + public void UnsubscribeEvents(); + } +} diff --git a/KruacentExiled/KE.Utils/Extensions/AdminToyExtension.cs b/KruacentExiled/KE.Utils/Extensions/AdminToyExtension.cs new file mode 100644 index 00000000..37c3706d --- /dev/null +++ b/KruacentExiled/KE.Utils/Extensions/AdminToyExtension.cs @@ -0,0 +1,25 @@ +using Exiled.API.Features.Toys; +using KE.Utils.Quality; +using KE.Utils.Quality.Enums; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace KE.Utils.Extensions +{ + public static class AdminToyExtension + { + + public static void SetAsPickupAdminToy(this AdminToy toy, bool autoSync = true) + { + QualityHandler.Instance.QualityToysHandler.SetAsPickup(toy); + } + + public static void SetQuality(this AdminToy toy, ModelQuality modelQuality,bool autoSync = true) + { + QualityHandler.Instance.QualityToysHandler.SetQuality(toy, modelQuality); + } + } +} diff --git a/KruacentExiled/KE.Utils/Extensions/PlayerExtension.cs b/KruacentExiled/KE.Utils/Extensions/PlayerExtension.cs new file mode 100644 index 00000000..b01f98d2 --- /dev/null +++ b/KruacentExiled/KE.Utils/Extensions/PlayerExtension.cs @@ -0,0 +1,52 @@ +using CustomPlayerEffects; +using Exiled.API.Enums; +using Exiled.API.Features; +using Mirror; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using UnityEngine; + +namespace KE.Utils.Extensions +{ + public static class PlayerExtension + { + public static void SetFakeInvis(this Player p, IEnumerable viewers) + { + Vector3 pos = p.Position; + + try + { + p.ReferenceHub.transform.localPosition = Vector3.zero; + foreach (Player viewer in viewers) + { + Server.SendSpawnMessage.Invoke(null, new object[2] { viewer.NetworkIdentity, viewer.Connection }); + } + + p.ReferenceHub.transform.localPosition = pos; + } + catch (Exception arg) + { + Log.Error(string.Format("{0}: {1}", "SetFakeInvis", arg)); + } + } + + + + + public static void AddLevelEffect(this Player p,EffectType type, int intensity) + { + + + if (!p.TryGetEffect(type, out var effect)) + p.ChangeEffectIntensity(type, (byte)(effect.Intensity + intensity)); + else + p.EnableEffect(type, (byte)intensity); + } + + + + } +} diff --git a/KruacentExiled/KE.Utils/Extensions/RoomExtension.cs b/KruacentExiled/KE.Utils/Extensions/RoomExtension.cs new file mode 100644 index 00000000..35fee2e8 --- /dev/null +++ b/KruacentExiled/KE.Utils/Extensions/RoomExtension.cs @@ -0,0 +1,12 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace KE.Utils.Extensions +{ + internal class RoomExtension + { + } +} diff --git a/KruacentExiled/KE.Utils/KE.Utils.csproj b/KruacentExiled/KE.Utils/KE.Utils.csproj new file mode 100644 index 00000000..1587c6e8 --- /dev/null +++ b/KruacentExiled/KE.Utils/KE.Utils.csproj @@ -0,0 +1,30 @@ + + + + 13.0 + net48 + + + + + + + + + + + + + + + + + + if not "$(EXILED_DEV_REFERENCES)"=="" copy /y "$(OutputPath)$(AssemblyName).dll" "$(EXILED_DEV_REFERENCES)\Plugins\" + + + if [[ ! -z "$EXILED_DEV_REFERENCES" ]]; then cp "$(OutputPath)$(AssemblyName).dll" "$EXILED_DEV_REFERENCES/Plugins/"; fi + + + + diff --git a/KruacentExiled/KE.Utils/Quality/Enums/ModelQuality.cs b/KruacentExiled/KE.Utils/Quality/Enums/ModelQuality.cs new file mode 100644 index 00000000..d9d8d295 --- /dev/null +++ b/KruacentExiled/KE.Utils/Quality/Enums/ModelQuality.cs @@ -0,0 +1,16 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace KE.Utils.Quality.Enums +{ + public enum ModelQuality + { + None = -1, + Low, + Medium, + High, + } +} diff --git a/KruacentExiled/KE.Utils/Quality/Handlers/QualityToysHandler.cs b/KruacentExiled/KE.Utils/Quality/Handlers/QualityToysHandler.cs new file mode 100644 index 00000000..b2485795 --- /dev/null +++ b/KruacentExiled/KE.Utils/Quality/Handlers/QualityToysHandler.cs @@ -0,0 +1,179 @@ +using AdminToys; +using Exiled.API.Enums; +using Exiled.API.Extensions; +using Exiled.API.Features; +using Exiled.API.Features.Toys; +using KE.Utils.Quality.Enums; +using KE.Utils.Quality.Settings; +using MEC; +using System; +using System.Collections.Generic; +using System.Linq; +using UnityEngine; +using Light = Exiled.API.Features.Toys.Light; +using QualitySettings = KE.Utils.Quality.Settings.QualitySettings; + +namespace KE.Utils.Quality.Handlers +{ + public class QualityToysHandler + { + private HashSet _pickupToys = new(); + private Dictionary _qualityToys = new(); + public readonly Vector3 Gulag = new Vector3(15000, 15000, 15000); + public const float Delay = Timing.WaitForOneFrame; + public bool IsPickupToy(AdminToy primitive) + { + return _pickupToys.Contains(primitive); + } + + public bool IsQualityToy(AdminToy primitive) + { + return _qualityToys.ContainsKey(primitive); + } + + + public void SetAsPickup(AdminToy toy, bool autoSync = true) + { + if (!_pickupToys.Add(toy)) + { + Log.Warn($"AdminToy {toy} is already a pickupToy"); + return; + } + if (autoSync) + Sync(toy); + } + + public void SetQuality(AdminToy toy, ModelQuality quality, bool autoSync = true) + { + if (toy == null) return; + if (!_qualityToys.ContainsKey(toy)) + _qualityToys.Add(toy, quality); + else + _qualityToys[toy] = quality; + + if (autoSync) + Sync(toy); + } + + + + private void SendToFakePosition(AdminToy adminToy, Player player,Vector3 position) + { + //idk why but without delay it show all of the quality at once + Timing.CallDelayed(Delay, () => + { + if (adminToy is Light l) + { + player.SendFakeSyncVar(l.Base.netIdentity, typeof(LightSourceToy), nameof(LightSourceToy.NetworkPosition), position); + return; + } + if (adminToy is Primitive p) + { + player.SendFakeSyncVar(p.Base.netIdentity, typeof(PrimitiveObjectToy), nameof(PrimitiveObjectToy.NetworkPosition), position); + return; + } + }); + + } + + /// + /// Sync every Players + /// + public void Sync() + { + foreach (Player p in Player.List) + { + Sync(p); + } + } + + /// + /// Sync a specified Player + /// + /// + public void Sync(Player p) + { + + + + var quality = QualitySettings.Get(p); + var pickup = QualitySettings.PickmodelActivated(p); + + HashSet pickupToRemove = []; + HashSet qualityToRemove = []; + + //hide pickup toys + + foreach (AdminToy pk in _pickupToys) + { + try + { + if (pickup) + { + SendToFakePosition(pk, p, pk.Position); + } + else + { + SendToFakePosition(pk, p, Gulag); + } + } + catch (NullReferenceException) + { + //Log.Warn("removing pickup"); + pickupToRemove.Add(pk); + } + + } + + _pickupToys.RemoveWhere(p => pickupToRemove.Contains(p)); + + + foreach (var at in _qualityToys) + { + try + { + if ((at.Value == quality || at.Value == ModelQuality.None) && (pickup || !_pickupToys.Contains(at.Key))) + { + SendToFakePosition(at.Key, p, at.Key.Position); + } + else + { + SendToFakePosition(at.Key, p, Gulag); + } + } + catch (NullReferenceException) + { + //Log.Warn("removing quality" + _qualityToys.Count); + qualityToRemove.Add(at.Key); + } + + + } + foreach(var at in qualityToRemove) + { + + _qualityToys.Remove(at); + } + + } + + /// + /// Sync a specified AdminToy + /// + /// + public void Sync(AdminToy adminToy) + { + //temporary fix + Sync(); + + if (IsPickupToy(adminToy)) + { + + } + if (IsQualityToy(adminToy)) + { + + } + } + } +} diff --git a/KruacentExiled/KE.Utils/Quality/Models/Base/BaseModel.cs b/KruacentExiled/KE.Utils/Quality/Models/Base/BaseModel.cs new file mode 100644 index 00000000..c9f6723c --- /dev/null +++ b/KruacentExiled/KE.Utils/Quality/Models/Base/BaseModel.cs @@ -0,0 +1,41 @@ +using Exiled.API.Enums; +using Exiled.API.Extensions; +using Exiled.API.Features.Toys; +using Exiled.API.Interfaces; +using KE.Utils.Quality.Structs; +using PlayerStatsSystem; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using UnityEngine; +using Light = Exiled.API.Features.Toys.Light; + +namespace KE.Utils.Quality.Models.Base +{ + + /// + /// The blocks to build a model with + /// + public abstract class BaseModel : ICloneable + { + + protected AdminToy _toy; + public AdminToy AdminToy { get { return _toy; } } + private Vector3 _position; + public Vector3 LocalPosition { get { return _position; } } + private Quaternion _rotation; + public Quaternion LocalRotation { get { return _rotation; } } + + + public BaseModel(Vector3 localPositon, Quaternion localRotation) + { + _position = localPositon; + _rotation = localRotation; + } + + public abstract object Clone(); + } + +} diff --git a/KruacentExiled/KE.Utils/Quality/Models/Base/LightModel.cs b/KruacentExiled/KE.Utils/Quality/Models/Base/LightModel.cs new file mode 100644 index 00000000..ce808da1 --- /dev/null +++ b/KruacentExiled/KE.Utils/Quality/Models/Base/LightModel.cs @@ -0,0 +1,26 @@ +using Exiled.API.Features.Toys; +using UnityEngine; +using Light = Exiled.API.Features.Toys.Light; + +namespace KE.Utils.Quality.Models.Base +{ + public class LightModel : BaseModel + { + + /// + /// Create a new Light for modeling + /// + public LightModel(Vector3? scale, Color? color, Vector3 localPositon, Quaternion localRotation) : base(localPositon, localRotation) + { + Light light = Light.Create(null, null, scale, false, color); + _toy = light; + } + + + public override object Clone() + { + Light light = _toy as Light; + return new LightModel(light.Scale, light.Color, LocalPosition, LocalRotation); + } + } +} diff --git a/KruacentExiled/KE.Utils/Quality/Models/Base/PrimitiveModel.cs b/KruacentExiled/KE.Utils/Quality/Models/Base/PrimitiveModel.cs new file mode 100644 index 00000000..22e07225 --- /dev/null +++ b/KruacentExiled/KE.Utils/Quality/Models/Base/PrimitiveModel.cs @@ -0,0 +1,26 @@ +using Exiled.API.Features.Toys; +using UnityEngine; +using Color = UnityEngine.Color; + +namespace KE.Utils.Quality.Models.Base +{ + public class PrimitiveModel : BaseModel + { + /// + /// Create a new Primitive for modeling + /// + public PrimitiveModel(PrimitiveType type, Vector3? scale, Color? color,Vector3 localPosition,Quaternion localRotation) : base(localPosition, localRotation) + { + + Primitive prim = Primitive.Create(type, null, null, scale, false, color); + prim.Collidable = false; + _toy = prim; + } + + public override object Clone() + { + Primitive prim = _toy as Primitive; + return new PrimitiveModel(prim.Type, prim.Scale, prim.Color, LocalPosition, LocalRotation); + } + } +} diff --git a/KruacentExiled/KE.Utils/Quality/Models/Examples/MineModel.cs b/KruacentExiled/KE.Utils/Quality/Models/Examples/MineModel.cs new file mode 100644 index 00000000..00d60fec --- /dev/null +++ b/KruacentExiled/KE.Utils/Quality/Models/Examples/MineModel.cs @@ -0,0 +1,118 @@ +using KE.Utils.Quality.Enums; +using KE.Utils.Quality.Models.Base; +using System.Collections.Generic; +using UnityEngine; +using Light = Exiled.API.Features.Toys.Light; + +namespace KE.Utils.Quality.Models.Examples +{ + public abstract class MineModel : QualityModel + { + protected Light _light; + private bool _lightOn = false; + + + + + public void ToggleLight() + { + if (_light == null) throw new System.Exception("no light"); + if (_lightOn) + _light.UnSpawn(); + else + _light.Spawn(); + _lightOn = !_lightOn; + } + + } + + public class MineModelLow : MineModel + { + public override bool IsPickup => false; + public override ModelQuality Quality => ModelQuality.Low; + + protected override IEnumerable GetBaseModels() + { + Quaternion baseRotation = new(); + //spawn + offset + Vector3 offset = new Vector3(0, .05f); + Vector3 sizeDisk = new Vector3(.7f, 0.1f, .7f); + + Vector3 sizeGlobe = new Vector3(.1f, .1f, .1f); + Vector3 posLight = new Vector3(0, sizeDisk.y+sizeGlobe.y); + + + var baseMine = new PrimitiveModel(PrimitiveType.Cylinder, sizeDisk, Color.black, offset, baseRotation); + + var lightGlobe = new PrimitiveModel(PrimitiveType.Sphere, sizeGlobe , new Color(1, 0, 0, .33f), posLight, baseRotation); + + var lightMine = new LightModel(null, Color.red, posLight, baseRotation); + + _light = lightMine.AdminToy as Light; + _light.Intensity = .55f; + + return [baseMine, lightGlobe, lightMine]; + } + + + } + + public class MineModelMedium : MineModel + { + public override bool IsPickup => false; + public override ModelQuality Quality => ModelQuality.Medium; + + protected override IEnumerable GetBaseModels() + { + Quaternion baseRotation = new(); + //spawn + offset + Vector3 offset = new Vector3(0, .05f); + Vector3 sizeDisk = new Vector3(.7f, 0.1f, .7f); + + Vector3 sizeGlobe = new Vector3(.1f, .1f, .1f); + Vector3 posLight = new Vector3(0, sizeDisk.y + sizeGlobe.y); + + + var baseMine = new PrimitiveModel(PrimitiveType.Cylinder, sizeDisk, Color.black, offset, baseRotation); + + var lightGlobe = new PrimitiveModel(PrimitiveType.Sphere, sizeGlobe, new Color(1, 0, 0, .33f), posLight, baseRotation); + + var lightMine = new LightModel(null, Color.green, posLight, baseRotation); + + _light = lightMine.AdminToy as Light; + _light.Intensity = .55f; + + return [baseMine, lightGlobe, lightMine]; + } + } + + public class MineModelPickup : MineModel + { + public override bool IsPickup => true; + public override ModelQuality Quality => ModelQuality.None; + + + protected override IEnumerable GetBaseModels() + { + Quaternion baseRotation = new(); + //spawn + offset + Vector3 offset = new Vector3(0, .05f); + Vector3 sizeDisk = new Vector3(.7f, 0.1f, .7f); + + Vector3 sizeGlobe = new Vector3(.1f, .1f, .1f); + Vector3 posLight = new Vector3(0, sizeDisk.y + sizeGlobe.y); + + + var baseMine = new PrimitiveModel(PrimitiveType.Cylinder, sizeDisk, Color.black, offset, baseRotation); + + var lightGlobe = new PrimitiveModel(PrimitiveType.Sphere, sizeGlobe, new Color(1, 0, 0, .33f), posLight, baseRotation); + + var lightMine = new LightModel(null, Color.magenta, posLight, baseRotation); + + _light = lightMine.AdminToy as Light; + _light.Intensity = .55f; + + return [baseMine, lightGlobe, lightMine]; + } + } +} diff --git a/KruacentExiled/KE.Utils/Quality/Models/Model.cs b/KruacentExiled/KE.Utils/Quality/Models/Model.cs new file mode 100644 index 00000000..2e26756e --- /dev/null +++ b/KruacentExiled/KE.Utils/Quality/Models/Model.cs @@ -0,0 +1,104 @@ +using Exiled.API.Features; +using Exiled.API.Features.Toys; +using KE.Utils.Quality.Models.Base; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using UnityEngine; + +namespace KE.Utils.Quality.Models +{ + public class Model : IEquatable + { + + + private Vector3 _position; + public Vector3 Position + { + get { return _position; } + set + { + _position = value; + } + } + private Quaternion _rotation; + public Quaternion Rotation + { + get { return _rotation; } + set + { + _rotation = value; + } + } + private ModelPrefab _prefab; + public ModelPrefab Prefab + { + get { return _prefab; } + } + + + + private HashSet _models; + + internal Model(ModelPrefab prefab, Vector3 position, Quaternion rotation,IEnumerable toys,bool spawn) + { + _prefab = prefab; + Position = position; + Rotation = rotation; + _models = new HashSet(toys); + QualityHandler.Instance.QualityToysHandler.Sync(); + + foreach (BaseModel based in toys) + { + AdminToy toy = based.AdminToy; + + if (toy is Primitive p) + p.Collidable = false; + toy.AdminToyBase.transform.position = based.LocalPosition + Position; + toy.AdminToyBase.transform.rotation = based.LocalRotation * Rotation; + } + if(spawn) + { + Spawn(); + } + } + + + public void Destroy() + { + foreach (BaseModel primitive in _models) + { + primitive.AdminToy.Destroy(); + } + } + public void UnSpawn() + { + foreach (BaseModel primitive in _models) + { + primitive.AdminToy.UnSpawn(); + } + } + public void Spawn() + { + QualityHandler.Instance.QualityToysHandler.Sync(); + foreach (BaseModel primitive in _models) + { + primitive.AdminToy.Spawn(); + } + + } + + + public bool Equals(Model x) + { + if (x == null) return false; + return x._prefab == _prefab && x.Position == Position && x.Rotation == Rotation; + } + public int GetHashCode(Model obj) + { + return obj.GetHashCode(); + } + } +} diff --git a/KruacentExiled/KE.Utils/Quality/Models/ModelPrefab.cs b/KruacentExiled/KE.Utils/Quality/Models/ModelPrefab.cs new file mode 100644 index 00000000..bbc39da4 --- /dev/null +++ b/KruacentExiled/KE.Utils/Quality/Models/ModelPrefab.cs @@ -0,0 +1,42 @@ +using Exiled.API.Features; +using Exiled.API.Features.Core; +using Exiled.API.Features.Pickups; +using Exiled.API.Features.Toys; +using Exiled.API.Interfaces; +using KE.Utils.Extensions; +using KE.Utils.Quality.Models.Base; +using KE.Utils.Quality.Structs; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using UnityEngine; +using Light = Exiled.API.Features.Toys.Light; + +namespace KE.Utils.Quality.Models +{ + public abstract class ModelPrefab + { + + protected abstract IEnumerable GetBaseModels(); + + public virtual Model Create(Vector3 position,Quaternion rotation, bool spawn = true) + { + + HashSet clonetoys = new(); + HashSet toys = GetBaseModels().ToHashSet(); + foreach (BaseModel model in toys) + { + BaseModel clone = (BaseModel)model.Clone(); + clonetoys.Add(clone); + } + return new Model(this, position, rotation, clonetoys,spawn); + + } + + + + + } +} diff --git a/KruacentExiled/KE.Utils/Quality/Models/QualityModel.cs b/KruacentExiled/KE.Utils/Quality/Models/QualityModel.cs new file mode 100644 index 00000000..b5cc682f --- /dev/null +++ b/KruacentExiled/KE.Utils/Quality/Models/QualityModel.cs @@ -0,0 +1,40 @@ +using Exiled.API.Features; +using Exiled.API.Features.Toys; +using KE.Utils.Extensions; +using KE.Utils.Quality.Enums; +using KE.Utils.Quality.Models.Base; +using System.Collections.Generic; +using System.Linq; +using UnityEngine; + +namespace KE.Utils.Quality.Models +{ + public abstract class QualityModel : ModelPrefab + { + public abstract ModelQuality Quality { get; } + public abstract bool IsPickup { get; } + + + + + public override sealed Model Create(Vector3 position, Quaternion rotation,bool spawn = true) + { + + HashSet clonetoys = new(); + HashSet toys = GetBaseModels().ToHashSet(); + foreach (BaseModel model in toys) + { + BaseModel clone = (BaseModel)model.Clone(); + + if (IsPickup) + clone.AdminToy.SetAsPickupAdminToy(false); + + clone.AdminToy.SetQuality(Quality,false); + clonetoys.Add(clone); + } + QualityHandler.Sync(); + return new Model(this,position, rotation, clonetoys, spawn); + } + + } +} diff --git a/KruacentExiled/KE.Utils/Quality/QualityHandler.cs b/KruacentExiled/KE.Utils/Quality/QualityHandler.cs new file mode 100644 index 00000000..235d79c9 --- /dev/null +++ b/KruacentExiled/KE.Utils/Quality/QualityHandler.cs @@ -0,0 +1,61 @@ +using Exiled.API.Features; +using Exiled.API.Features.Core.UserSettings; +using KE.Utils.Quality.Handlers; +using KE.Utils.Quality.Settings; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace KE.Utils.Quality +{ + [Obsolete("scrapped", false)] + internal class QualityHandler + { + public QualitySettings QualitySettings { get; private set; } + public QualityToysHandler QualityToysHandler { get; private set; } + + private static QualityHandler _instance; + public static QualityHandler Instance + { + get + { + if(_instance == null ) + _instance = new QualityHandler(); + return _instance; + } + } + private QualityHandler() + { + QualitySettings = new QualitySettings(Changed); + QualityToysHandler = new QualityToysHandler(); + } + + ~QualityHandler() + { + QualityToysHandler = null; + QualitySettings = null; + } + + public void Changed(Player p, SettingBase _) + { + QualityToysHandler.Sync(p); + } + + public void Register() + { + QualitySettings.Register(); + } + + public void Unregister() + { + QualitySettings.Unregister(); + } + + public static void Sync() + { + Instance.QualityToysHandler.Sync(); + } + } +} diff --git a/KruacentExiled/KE.Utils/Quality/QualityToysHandler.cs b/KruacentExiled/KE.Utils/Quality/QualityToysHandler.cs new file mode 100644 index 00000000..27320233 --- /dev/null +++ b/KruacentExiled/KE.Utils/Quality/QualityToysHandler.cs @@ -0,0 +1,155 @@ +using AdminToys; +using Exiled.API.Enums; +using Exiled.API.Extensions; +using Exiled.API.Features; +using Exiled.API.Features.Toys; +using KE.Utils.Quality.Enums; +using KE.Utils.Quality.Settings; +using System.Collections.Generic; +using System.Linq; +using UnityEngine; +using Light = Exiled.API.Features.Toys.Light; +using QualitySettings = KE.Utils.Quality.Settings.QualitySettings; + +namespace KE.Utils.Quality +{ + public class QualityToysHandler + { + private HashSet _pickupToys = new(); + private Dictionary _qualityToys = new(); + public readonly Vector3 Gulag = new Vector3(15000,15000,15000); + + public bool IsPickupToy(AdminToy primitive) + { + return _pickupToys.Contains(primitive); + } + + public bool IsQualityToy(AdminToy primitive) + { + return _qualityToys.ContainsKey(primitive); + } + + + public void SetAsPickup(AdminToy toy) + { + if (!_pickupToys.Add(toy)) + { + Log.Warn($"AdminToy {toy} is already a pickupToy"); + return; + } + } + + public void SetQuality(AdminToy toy,ModelQuality quality) + { + if (toy == null) return; + if (!_qualityToys.ContainsKey(toy)) + _qualityToys.Add(toy,quality); + else + _qualityToys[toy] = quality; + } + + + + private void SendToShadowRealm(AdminToy adminToy, Player player) + { + if(adminToy is Light l) + { + player.SendFakeSyncVar(l.Base.netIdentity, typeof(LightSourceToy), nameof(LightSourceToy.NetworkPosition), Gulag); + return; + } + if(adminToy is Primitive p) + { + player.SendFakeSyncVar(p.Base.netIdentity, typeof(PrimitiveObjectToy), nameof(PrimitiveObjectToy.NetworkPosition), Gulag); + return; + } + } + + private void SetTruePosition(AdminToy adminToy, Player player) + { + if (adminToy is Light l) + { + player.SendFakeSyncVar(l.Base.netIdentity, typeof(LightSourceToy), nameof(LightSourceToy.NetworkPosition), l.Position); + return; + } + if (adminToy is Primitive p) + { + player.SendFakeSyncVar(p.Base.netIdentity, typeof(PrimitiveObjectToy), nameof(PrimitiveObjectToy.NetworkPosition), p.Position); + return; + } + } + + /// + /// Sync every Players + /// + public void Sync() + { + foreach(Player p in Player.List) + { + Sync(p); + } + } + + /// + /// Sync a specified Player + /// + /// + public void Sync(Player p) + { + var quality = QualitySettings.Get(p); + var pickup = QualitySettings.PickmodelActivated(p); + + if (!pickup) + { + //hide pickup toys + foreach (AdminToy pk in _pickupToys) + { + SendToShadowRealm(pk, p); + } + } + else + { + //show pickup toys + foreach (AdminToy pk in _pickupToys) + { + SetTruePosition(pk, p); + } + } + + + + + foreach(var at in _qualityToys) + { + if(at.Value == quality) + { + if (pickup || !_pickupToys.Contains(at.Key)) + { + SetTruePosition(at.Key, p); + } + } + else + { + SendToShadowRealm(at.Key, p); + } + + } + + } + + /// + /// Sync a specified AdminToy + /// + /// + public void Sync(AdminToy adminToy) + { + if (IsPickupToy(adminToy)) + { + + } + if (IsQualityToy(adminToy)) + { + + } + } + } +} diff --git a/KruacentExiled/KE.Utils/Quality/Settings/QualitySettings.cs b/KruacentExiled/KE.Utils/Quality/Settings/QualitySettings.cs new file mode 100644 index 00000000..ca8d49be --- /dev/null +++ b/KruacentExiled/KE.Utils/Quality/Settings/QualitySettings.cs @@ -0,0 +1,62 @@ +using Exiled.API.Features; +using Exiled.API.Features.Core.UserSettings; +using KE.Utils.Quality.Enums; +using System; + +namespace KE.Utils.Quality.Settings +{ + public class QualitySettings + { + + private static int _idQuality = 0; + private static int _idModels = 1; + private static int _idSlider = 2; + private SettingBase[] _settings; + public QualitySettings(Action onChanged) + { + HeaderSetting header = new("Quality Settings"); + _settings = + [ + header, + new DropdownSetting(_idQuality,"ModelQuality",["Low","Medium", "High"],onChanged:onChanged), + new TwoButtonsSetting(_idModels,"Pickup models","Disabled","Enabled", onChanged:onChanged) + ]; + } + + public void Register() + { + SettingBase.Register(_settings); + SettingBase.SendToAll(); + } + + public void Unregister() + { + SettingBase.Unregister(settings:_settings); + } + + + + + public static ModelQuality Get(Player p) + { + if (!SettingBase.TryGetSetting(p, _idQuality, out var setting)) return ModelQuality.None; + + return setting.SelectedOption switch + { + "Low" => ModelQuality.Low, + "Medium" => ModelQuality.Medium, + "High" => ModelQuality.High, + _ => ModelQuality.None, + }; + } + + + public static bool PickmodelActivated(Player p) + { + if (!SettingBase.TryGetSetting(p, _idModels, out var setting)) return false; + return setting.IsSecond; + } + + + } +} diff --git a/KruacentExiled/KE.Utils/Quality/Structs/LocalWorldSpace.cs b/KruacentExiled/KE.Utils/Quality/Structs/LocalWorldSpace.cs new file mode 100644 index 00000000..d9c6205b --- /dev/null +++ b/KruacentExiled/KE.Utils/Quality/Structs/LocalWorldSpace.cs @@ -0,0 +1,23 @@ +using Exiled.API.Interfaces; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using UnityEngine; + +namespace KE.Utils.Quality.Structs +{ + public readonly struct LocalWorldSpace : IWorldSpace + { + + public Vector3 Position { get; } + public Quaternion Rotation { get; } + + public LocalWorldSpace(Vector3 position, Quaternion rotation) + { + Position = position; + Rotation = rotation; + } + } +} diff --git a/KruacentExiled/KE.Utils/Quality/Tests/Test.cs b/KruacentExiled/KE.Utils/Quality/Tests/Test.cs new file mode 100644 index 00000000..6ebd3f66 --- /dev/null +++ b/KruacentExiled/KE.Utils/Quality/Tests/Test.cs @@ -0,0 +1,108 @@ +using Exiled.API.Extensions; +using Exiled.API.Features; +using Exiled.API.Features.Toys; +using KE.Utils.Quality.Models; +using KE.Utils.Quality.Models.Examples; +using MEC; +using PlayerRoles; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using UnityEngine; + +namespace KE.Utils.Quality.Tests +{ + public class Test + { + private QualityHandler QualityHandler; + + + private Test(QualityHandler q) + { + QualityHandler = q; + try + { + TestMine(); + } + catch (Exception ex) + { + Log.Error("Exception for TestMine :\n"+ex); + } + + } + internal void TestQuality() + { + Vector3 pos = RoleTypeId.Scp049.GetRandomSpawnLocation().Position; + Primitive c = Primitive.Create(pos); + c.Color = Color.red; + Primitive c2 = Primitive.Create(pos + Vector3.one); + c2.Color = Color.green; + + + QualityHandler.QualityToysHandler.SetQuality(c, Enums.ModelQuality.Low); + QualityHandler.QualityToysHandler.SetQuality(c2, Enums.ModelQuality.Medium); + } + + internal void StressTest(int count) + { + Timing.RunCoroutine(Stress(count)); + } + + + private IEnumerator Stress(int count) + { + Vector3 pos = RoleTypeId.Scp049.GetRandomSpawnLocation().Position; + Vector3 scale = new Vector3(.1f, .1f, .1f); + float maxSpread = 5; + for (int i = 0; i < count; i++) + { + Primitive c = Primitive.Create(pos + new Vector3(UnityEngine.Random.Range(0f, maxSpread), UnityEngine.Random.Range(0f, maxSpread), UnityEngine.Random.Range(0f, maxSpread)), scale: scale); + QualityHandler.QualityToysHandler.SetQuality(c, Enums.ModelQuality.Medium); + } + QualityHandler.QualityToysHandler.Sync(); + yield return 0; + } + + public void TestMine() + { + Log.Info("TestMine"); + Vector3 pos = RoleTypeId.Scp049.GetRandomSpawnLocation().Position; + MineModelLow mml = new(); + + + Model m = mml.Create(pos, new Quaternion()); + m.Spawn(); + + + MineModelMedium mmm = new(); + + m = mmm.Create(pos + Vector3.up, new Quaternion()); + m.Spawn(); + + + MineModelPickup mmp = new(); + m = mmp.Create(pos + Vector3.right, new Quaternion()); + m.Spawn(); + + QualityHandler.Sync(); + + + + + + + + + foreach (var item in Player.List) + { + item.Teleport(pos); + } + + + + + } + } +} diff --git a/KruacentExiled/KruacentExiled.sln b/KruacentExiled/KruacentExiled.sln index aaa7854f..93390814 100644 --- a/KruacentExiled/KruacentExiled.sln +++ b/KruacentExiled/KruacentExiled.sln @@ -17,6 +17,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "KE.CustomRoles", "KE.Custom EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "KE.Map", "Map\KE.Map.csproj", "{CCEF1C1D-B701-443E-AC23-72A174446868}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "KE.Utils", "KE.Utils\KE.Utils.csproj", "{DFEF41B3-5BD3-428A-A7BA-7A490E65C71F}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -51,6 +53,10 @@ Global {CCEF1C1D-B701-443E-AC23-72A174446868}.Debug|Any CPU.Build.0 = Debug|Any CPU {CCEF1C1D-B701-443E-AC23-72A174446868}.Release|Any CPU.ActiveCfg = Release|Any CPU {CCEF1C1D-B701-443E-AC23-72A174446868}.Release|Any CPU.Build.0 = Release|Any CPU + {DFEF41B3-5BD3-428A-A7BA-7A490E65C71F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {DFEF41B3-5BD3-428A-A7BA-7A490E65C71F}.Debug|Any CPU.Build.0 = Debug|Any CPU + {DFEF41B3-5BD3-428A-A7BA-7A490E65C71F}.Release|Any CPU.ActiveCfg = Release|Any CPU + {DFEF41B3-5BD3-428A-A7BA-7A490E65C71F}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE From e248f2e95fd7c5fccdd2c88d51ca0e06e8f1d40a Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Sun, 22 Jun 2025 20:54:57 +0200 Subject: [PATCH 278/853] mmmm yes model creator --- .../API/Models/Commands/CreateModel.cs | 16 ++- .../KE.Utils/API/Models/Commands/ListModel.cs | 5 +- .../API/Models/Commands/ModeMovePrim.cs | 64 +++++++++++ .../API/Models/Commands/SelectModel.cs | 10 +- .../API/Models/Commands/ShowCenter.cs | 51 +++++++++ KruacentExiled/KE.Utils/API/Models/Model.cs | 17 ++- .../KE.Utils/API/Models/ModelCreator.cs | 103 ++++++++++++++++-- .../KE.Utils/API/Models/ModelLoader.cs | 2 +- KruacentExiled/KE.Utils/API/Models/Models.cs | 29 ++++- .../KE.Utils/API/Models/MovementHandler.cs | 72 ++++++++++++ .../KE.Utils/API/Models/SelectedModel.cs | 85 +++++++++++++++ KruacentExiled/KE.Utils/KE.Utils.csproj | 6 +- .../Models => Map}/Commands/ModelParent.cs | 12 +- KruacentExiled/Map/KE.Map.csproj | 4 + KruacentExiled/Map/MainPlugin.cs | 19 +++- 15 files changed, 457 insertions(+), 38 deletions(-) create mode 100644 KruacentExiled/KE.Utils/API/Models/Commands/ModeMovePrim.cs create mode 100644 KruacentExiled/KE.Utils/API/Models/Commands/ShowCenter.cs create mode 100644 KruacentExiled/KE.Utils/API/Models/MovementHandler.cs create mode 100644 KruacentExiled/KE.Utils/API/Models/SelectedModel.cs rename KruacentExiled/{KE.Utils/API/Models => Map}/Commands/ModelParent.cs (71%) diff --git a/KruacentExiled/KE.Utils/API/Models/Commands/CreateModel.cs b/KruacentExiled/KE.Utils/API/Models/Commands/CreateModel.cs index 9704d32b..fca48749 100644 --- a/KruacentExiled/KE.Utils/API/Models/Commands/CreateModel.cs +++ b/KruacentExiled/KE.Utils/API/Models/Commands/CreateModel.cs @@ -1,5 +1,6 @@ using CommandSystem; using Exiled.API.Features; +using KE.Utils.API.Models; using System; using System.Collections.Generic; using System.Linq; @@ -8,7 +9,7 @@ namespace KE.Utils.API.Models.Commands { - internal class CreateModel : ICommand + public class CreateModel : ICommand { public string Command { get; } = "create"; @@ -19,17 +20,22 @@ internal class CreateModel : ICommand public bool Execute(ArraySegment arguments, ICommandSender sender, out string response) { - + Player p = Player.Get(sender); - if(p == null) + if (p == null) { response = "This player can't do this command"; return false; } + if (arguments.Count < 1) + { + response = "not enough arguments"; + return false; + } + string name = arguments.At(0); - - Model m = Model.Create(p.Position, arguments.At(1)); + Model m = Model.Create(p.Position, name); response = $"Created model ({m.Name}) at {m.Center}"; return true; } diff --git a/KruacentExiled/KE.Utils/API/Models/Commands/ListModel.cs b/KruacentExiled/KE.Utils/API/Models/Commands/ListModel.cs index 8cff9a41..f78b78c1 100644 --- a/KruacentExiled/KE.Utils/API/Models/Commands/ListModel.cs +++ b/KruacentExiled/KE.Utils/API/Models/Commands/ListModel.cs @@ -5,10 +5,11 @@ using System.Linq; using System.Text; using System.Threading.Tasks; +using KE.Utils.API.Models; namespace KE.Utils.API.Models.Commands { - internal class ListModel : ICommand + public class ListModel : ICommand { public string Command { get; } = "list"; @@ -21,7 +22,7 @@ public bool Execute(ArraySegment arguments, ICommandSender sender, out s { StringBuilder b = new(); b.AppendLine($"Models ({Model.Models.Count}) :"); - foreach(Model m in Model.Models) + foreach (Model m in Model.Models) { b.AppendLine($"({m.Id}) - {m.Name} pos: {m.Id}"); } diff --git a/KruacentExiled/KE.Utils/API/Models/Commands/ModeMovePrim.cs b/KruacentExiled/KE.Utils/API/Models/Commands/ModeMovePrim.cs new file mode 100644 index 00000000..2b9ea091 --- /dev/null +++ b/KruacentExiled/KE.Utils/API/Models/Commands/ModeMovePrim.cs @@ -0,0 +1,64 @@ +using CommandSystem; +using Exiled.API.Features; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using KE.Utils.API.Models; + +namespace KE.Utils.API.Models.Commands +{ + public class ModeMovePrim : ICommand + { + + public string Command { get; } = "mode"; + + public string[] Aliases { get; } = { "m" }; + + public string Description { get; } = "select the mode : scale,move,rotate"; + + public bool Execute(ArraySegment arguments, ICommandSender sender, out string response) + { + Player p = Player.Get(sender); + if (p == null) + { + response = "This player can't do this command"; + return false; + } + + if (arguments.Count < 1) + { + response = "not enough arguments"; + return false; + } + string mode = arguments.At(0); + + switch(mode) + { + case "m": + case "move": + Models.Instance.ModelCreator.MovementMode = MovementMode.Move; + break; + case "s": + case "scale": + Models.Instance.ModelCreator.MovementMode = MovementMode.Scale; + break; + case "r": + case "rotate": + Models.Instance.ModelCreator.MovementMode = MovementMode.Rotate; + break; + default: + response = "wrong argument"; + return false; + + + } + + + response = $"Mode set to " + Models.Instance.ModelCreator.MovementMode.ToString(); + return true; + } + + } +} diff --git a/KruacentExiled/KE.Utils/API/Models/Commands/SelectModel.cs b/KruacentExiled/KE.Utils/API/Models/Commands/SelectModel.cs index 1fbb6bf4..d6656829 100644 --- a/KruacentExiled/KE.Utils/API/Models/Commands/SelectModel.cs +++ b/KruacentExiled/KE.Utils/API/Models/Commands/SelectModel.cs @@ -5,10 +5,11 @@ using System.Linq; using System.Text; using System.Threading.Tasks; +using KE.Utils.API.Models; namespace KE.Utils.API.Models.Commands { - internal class SelectModel : ICommand + public class SelectModel : ICommand { public string Command { get; } = "select"; @@ -19,20 +20,21 @@ internal class SelectModel : ICommand public bool Execute(ArraySegment arguments, ICommandSender sender, out string response) { - + Player p = Player.Get(sender); - if(p == null) + if (p == null) { response = "This player can't do this command"; return false; } - if(!Model.TryGet(int.Parse(arguments.At(1)),out Model m)) + if (!Model.TryGet(int.Parse(arguments.At(1)), out Model m)) { response = "model not found"; return false; } response = $"model ({m.Name}) selected {m.Center}"; + Models.Instance.ModelCreator.ModelSelected = m; return true; } diff --git a/KruacentExiled/KE.Utils/API/Models/Commands/ShowCenter.cs b/KruacentExiled/KE.Utils/API/Models/Commands/ShowCenter.cs new file mode 100644 index 00000000..990f92d9 --- /dev/null +++ b/KruacentExiled/KE.Utils/API/Models/Commands/ShowCenter.cs @@ -0,0 +1,51 @@ +using CommandSystem; +using Exiled.API.Features; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace KE.Utils.API.Models.Commands +{ + public class ShowCenter : ICommand + { + + public string Command { get; } = "show"; + + public string[] Aliases { get; } = { "sh" }; + + public string Description { get; } = "toggle the center of the model"; + + public bool Execute(ArraySegment arguments, ICommandSender sender, out string response) + { + + Player p = Player.Get(sender); + if (p == null) + { + response = "This player can't do this command"; + return false; + } + + Model m = Models.Instance.ModelCreator.ModelSelected; + + if(m == null) + { + response = "no model selected"; + return false; + } + + if(!bool.TryParse(arguments.At(0),out bool result)) + { + response = "write true or false"; + return false; + } + + m.SetCenterPrimitive(result); + + response = "done"; + + return true; + } + } +} diff --git a/KruacentExiled/KE.Utils/API/Models/Model.cs b/KruacentExiled/KE.Utils/API/Models/Model.cs index 00a54cfc..2cdcff18 100644 --- a/KruacentExiled/KE.Utils/API/Models/Model.cs +++ b/KruacentExiled/KE.Utils/API/Models/Model.cs @@ -37,6 +37,20 @@ public int Id get { return _id; } } + internal Primitive centerPrim; + + public void SetCenterPrimitive(bool show) + { + if (show) + { + centerPrim.UnSpawn(); + } + else + { + centerPrim.Spawn(); + } + } + public void Add(Primitive p) @@ -103,7 +117,8 @@ public static Model Create(Vector3 position, string name= "") } Log.Debug("created model id=" + m.Id); - + m.centerPrim = Primitive.Create(position, null, Vector3.one/5, true, new(1, 0, 0, .25f)); + m.centerPrim.Collidable = false; return m; } diff --git a/KruacentExiled/KE.Utils/API/Models/ModelCreator.cs b/KruacentExiled/KE.Utils/API/Models/ModelCreator.cs index 1003e790..e9feef77 100644 --- a/KruacentExiled/KE.Utils/API/Models/ModelCreator.cs +++ b/KruacentExiled/KE.Utils/API/Models/ModelCreator.cs @@ -1,50 +1,107 @@ -using Exiled.API.Features.Toys; +using AdminToys; +using Exiled.API.Features; +using Exiled.API.Features.Items; +using Exiled.API.Features.Toys; using Exiled.Events.EventArgs.Player; using KE.Utils.API.Interfaces; +using MEC; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; +using UnityEngine; namespace KE.Utils.API.Models { public class ModelCreator : IUsingEvents { - public const ItemType item = ItemType.GunShotgun; - private static ModelCreator _inst; - public static ModelCreator Instance + + + public const ItemType item = ItemType.GunCOM18; + + + public MovementMode MovementMode { get { - if (_inst == null) - _inst = new(); - return _inst; + return MovementHandler.Mode; + } + set + { + MovementHandler.Mode = value; } } - + private MovementHandler MovementHandler; + private SelectedModel SelectedModel; private bool mode = false; + private const float MAX_DISTANCE = 50; + - private Primitive _primitiveSelected; + public Model ModelSelected; + public ModelCreator() + { + + } + public void SubscribeEvents() { - Exiled.Events.Handlers.Player.DryfiringWeapon -= OnDryfiringWeapon; + + SelectedModel = new(); + MovementHandler = new(); + + + MovementHandler.SubscribeEvents(); + Exiled.Events.Handlers.Player.DryfiringWeapon += OnDryfiringWeapon; Exiled.Events.Handlers.Player.TogglingWeaponFlashlight += OnTogglingWeaponFlashlight; + Exiled.Events.Handlers.Player.AimingDownSight += OnAimingDownSight; + Exiled.Events.Handlers.Server.RoundStarted += Test; + + } + private void Test() + { + foreach (var p in Player.List) + { + p.Role.Set(PlayerRoles.RoleTypeId.ChaosConscript); + var a = p.AddItem(item); + var b = a as Firearm; + b.MagazineAmmo = 2; + + } } + public void UnsubscribeEvents() { Exiled.Events.Handlers.Player.DryfiringWeapon -= OnDryfiringWeapon; Exiled.Events.Handlers.Player.TogglingWeaponFlashlight -= OnTogglingWeaponFlashlight; + Exiled.Events.Handlers.Player.AimingDownSight -= OnAimingDownSight; + Exiled.Events.Handlers.Server.RoundStarted -= Test; + //Exiled.Events.Handlers.Player.Shooting -= OnShooting; + MovementHandler.UnsubscribeEvents(); + + SelectedModel = null; + MovementHandler = null; + } + private void OnAimingDownSight(AimingDownSightEventArgs ev) + { + } private void OnDryfiringWeapon(DryfiringWeaponEventArgs ev) { if (ev.Firearm.Type != item) return; - + Log.Info("new mode = " + mode); + + if (!mode) + { + Primitive.Create(ev.Player.Position + Vector3.back, null, null, true, Color.red); + Primitive.Create(ev.Player.Position + Vector3.forward, null, null, true, Color.green); + mode = !mode; + } @@ -53,11 +110,33 @@ private void OnDryfiringWeapon(DryfiringWeaponEventArgs ev) private void OnTogglingWeaponFlashlight(TogglingWeaponFlashlightEventArgs ev) { if (ev.Firearm.Type != item) return; + + - mode = !mode; + Transform cam = ev.Player.CameraTransform; + + Vector3 origin = cam.position + cam.forward * 0.5f; + Ray r = new Ray(origin, cam.forward); + if (Physics.Raycast(r, out RaycastHit hit, MAX_DISTANCE)) + { + Log.Info($"hit ({hit.collider.name})"); + PrimitiveObjectToy pot = hit.collider.GetComponentInParent() ?? hit.collider.GetComponentInChildren(); + if(pot != null) + { + Primitive p = Primitive.Get(pot); + SelectedModel.ChangedSelectedPrim(p); + } + } } + + } + public enum MovementMode + { + Move, + Scale, + Rotate } } diff --git a/KruacentExiled/KE.Utils/API/Models/ModelLoader.cs b/KruacentExiled/KE.Utils/API/Models/ModelLoader.cs index 14a430b5..40234c4c 100644 --- a/KruacentExiled/KE.Utils/API/Models/ModelLoader.cs +++ b/KruacentExiled/KE.Utils/API/Models/ModelLoader.cs @@ -82,7 +82,7 @@ public static Model Load(string path,string filename) // Name.Center\nAdminToyType.ATPosition.ATRotationEuler.ATScale.LightPrimitiveColor.PrimitiveType.PrimitiveCollidable.LightIntensity\n and repeat // - public static void Save(Model m) + public static void Save(this Model m) { StringBuilder b = new(); diff --git a/KruacentExiled/KE.Utils/API/Models/Models.cs b/KruacentExiled/KE.Utils/API/Models/Models.cs index 3deab197..27fe3cf4 100644 --- a/KruacentExiled/KE.Utils/API/Models/Models.cs +++ b/KruacentExiled/KE.Utils/API/Models/Models.cs @@ -1,30 +1,47 @@ using KE.Utils.API.Interfaces; +using PlayerRoles.FirstPersonControl.Thirdperson; namespace KE.Utils.API.Models { public class Models : IUsingEvents { - private ModelCreator _model; + public ModelCreator ModelCreator + { + get; + private set; + } + private static Models _instance; + + + public static Models Instance + { + get + { + if (_instance == null) + _instance = new(); + return _instance; + } + } - public static Models Create() + public void DestroyInstance() { - return new(); + _instance = null; } private Models() { - _model = new(); + ModelCreator = new(); } public void SubscribeEvents() { - _model.SubscribeEvents(); + ModelCreator.SubscribeEvents(); } public void UnsubscribeEvents() { - _model.UnsubscribeEvents(); + ModelCreator.UnsubscribeEvents(); } } } diff --git a/KruacentExiled/KE.Utils/API/Models/MovementHandler.cs b/KruacentExiled/KE.Utils/API/Models/MovementHandler.cs new file mode 100644 index 00000000..4fcec956 --- /dev/null +++ b/KruacentExiled/KE.Utils/API/Models/MovementHandler.cs @@ -0,0 +1,72 @@ +using Exiled.API.Features.Toys; +using KE.Utils.API.Interfaces; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using UnityEngine; + +namespace KE.Utils.API.Models +{ + internal class MovementHandler : IUsingEvents + { + + private MovementMode _mode = MovementMode.Move; + + public MovementMode Mode + { + get + { + return _mode; + } + set + { + OnChangingMode?.Invoke(value); + _mode = value; + } + } + public static event Action OnChangingMode; + + //xyz + private Primitive[] _arrows = new Primitive[3]; + private bool _primflag = false; + private readonly Vector3 _scale = new Vector3(1f, .1f, .1f); + + + private void TryCreatePrimitives() + { + if (!_primflag) + { + _arrows[0] = Primitive.Create(PrimitiveType.Cube, null, new Vector3(1f, 0f, 0f), _scale); + _arrows[1] = Primitive.Create(PrimitiveType.Cube, null, new Vector3(0f, 1f, 0f), _scale); + _arrows[2] = Primitive.Create(PrimitiveType.Cube, null, new Vector3(0f, 0f, 1f), _scale); + _primflag = true; + } + + } + + + public void SubscribeEvents() + { + + SelectedModel.OnChangedSelection += OnChangedSelection; + } + + public void UnsubscribeEvents() + { + SelectedModel.OnChangedSelection -= OnChangedSelection; + } + + private void OnChangedSelection(Primitive p) + { + TryCreatePrimitives(); + + + + } + + + + } +} diff --git a/KruacentExiled/KE.Utils/API/Models/SelectedModel.cs b/KruacentExiled/KE.Utils/API/Models/SelectedModel.cs new file mode 100644 index 00000000..5bb68128 --- /dev/null +++ b/KruacentExiled/KE.Utils/API/Models/SelectedModel.cs @@ -0,0 +1,85 @@ +using Exiled.API.Features; +using Exiled.API.Features.Toys; +using MEC; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using UnityEngine; + +namespace KE.Utils.API.Models +{ + internal class SelectedModel + { + public const float BLINK_REFRESH_RATE = .3f; + + + public Primitive SelectedPrimitive; + private Color _baseColor; + private CoroutineHandle _handle; + + public static event Action OnChangedSelection; + public static event Action OnUnSelect; + + internal SelectedModel() + { + + } + + public void ChangedSelectedPrim(Primitive newPrim) + { + if (newPrim == null) return; + + + UnSelect(); + + if (SelectedPrimitive == null || newPrim != SelectedPrimitive) + { + OnChangedSelection?.Invoke(newPrim); + _baseColor = newPrim.Color; + _handle = Timing.RunCoroutine(Blink(newPrim)); + } + else + { + OnUnSelect?.Invoke(); + } + + } + + + private void UnSelect() + { + if (_handle.IsRunning) + { + + Timing.KillCoroutines(_handle); + SelectedPrimitive.Color = _baseColor; + } + SelectedPrimitive = null; + } + + + private IEnumerator Blink(Primitive p) + { + SelectedPrimitive = p; + Color baseColor = p.Color; + Color baseTrans = new(baseColor.r, baseColor.g, baseColor.b, baseColor.a / 2); + bool transparent = false; + while (true) + { + if (transparent) + { + p.Color = baseTrans; + } + else + { + p.Color = baseColor; + } + yield return Timing.WaitForSeconds(BLINK_REFRESH_RATE); + transparent = !transparent; + } + } + + } +} diff --git a/KruacentExiled/KE.Utils/KE.Utils.csproj b/KruacentExiled/KE.Utils/KE.Utils.csproj index 1587c6e8..7607f6e4 100644 --- a/KruacentExiled/KE.Utils/KE.Utils.csproj +++ b/KruacentExiled/KE.Utils/KE.Utils.csproj @@ -11,7 +11,7 @@ - + @@ -19,6 +19,10 @@ + + + + if not "$(EXILED_DEV_REFERENCES)"=="" copy /y "$(OutputPath)$(AssemblyName).dll" "$(EXILED_DEV_REFERENCES)\Plugins\" diff --git a/KruacentExiled/KE.Utils/API/Models/Commands/ModelParent.cs b/KruacentExiled/Map/Commands/ModelParent.cs similarity index 71% rename from KruacentExiled/KE.Utils/API/Models/Commands/ModelParent.cs rename to KruacentExiled/Map/Commands/ModelParent.cs index 805f0a3f..6728ccd0 100644 --- a/KruacentExiled/KE.Utils/API/Models/Commands/ModelParent.cs +++ b/KruacentExiled/Map/Commands/ModelParent.cs @@ -1,18 +1,21 @@ using CommandSystem; +using Exiled.API.Features; using Exiled.Permissions.Extensions; +using KE.Utils.API.Models.Commands; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; -namespace KE.Utils.API.Models.Commands +namespace KE.Map.Commands { [CommandHandler(typeof(RemoteAdminCommandHandler))] public class ModelParent : ParentCommand { public ModelParent() { + Log.Debug("loading"); LoadGeneratedCommands(); } @@ -20,7 +23,7 @@ public ModelParent() public override string Command { get; } = "model"; /// - public override string[] Aliases { get; } = { "m" }; + public override string[] Aliases { get; } = { "m" }; /// public override string Description { get; } = "models"; @@ -30,11 +33,14 @@ public override void LoadGeneratedCommands() { RegisterCommand(new CreateModel()); RegisterCommand(new ListModel()); + RegisterCommand(new SelectModel()); + RegisterCommand(new ShowCenter()); + RegisterCommand(new ModeMovePrim()); } protected override bool ExecuteParent(ArraySegment arguments, ICommandSender sender, out string response) { - response = string.Empty; + response = "hoi"; return true; } diff --git a/KruacentExiled/Map/KE.Map.csproj b/KruacentExiled/Map/KE.Map.csproj index 64797cff..1756fc73 100644 --- a/KruacentExiled/Map/KE.Map.csproj +++ b/KruacentExiled/Map/KE.Map.csproj @@ -8,6 +8,10 @@ + + + + diff --git a/KruacentExiled/Map/MainPlugin.cs b/KruacentExiled/Map/MainPlugin.cs index a11cc828..aa9c0d5c 100644 --- a/KruacentExiled/Map/MainPlugin.cs +++ b/KruacentExiled/Map/MainPlugin.cs @@ -10,6 +10,7 @@ using KE.Map.Doors; using KE.Map.GamblingZone; using KE.Map.Utils; +using KE.Utils.API.Models; using PlayerRoles; using System.Collections.Generic; using UnityEngine; @@ -19,12 +20,16 @@ namespace KE.Map public class MainPlugin : Plugin { public static MainPlugin Instance { get; private set; } + public Models models => Models.Instance; public override void OnEnabled() { + Exiled.Events.Handlers.Map.Generated += OnGenerated; Exiled.Events.Handlers.Server.RoundEnded += OnRoundEnded; //Exiled.Events.Handlers.Server.RoundStarted += SendFakePrimitives.Join; - + if(Config.Debug) + models?.SubscribeEvents(); + Instance = this; } @@ -33,6 +38,11 @@ public override void OnDisabled() Exiled.Events.Handlers.Map.Generated -= OnGenerated; Exiled.Events.Handlers.Server.RoundEnded -= OnRoundEnded; //Exiled.Events.Handlers.Server.RoundStarted -= SendFakePrimitives.Join; + if (Config.Debug) + { + models.UnsubscribeEvents(); + models.DestroyInstance(); + } Instance = null; } @@ -42,6 +52,7 @@ public override void OnDisabled() private void OnGenerated() { + Door lcz173 = Door.Get(Exiled.API.Enums.DoorType.Scp173Gate); HashSet normal = new() { @@ -78,7 +89,9 @@ private void OnGenerated() }; - var g = new GamblingRoom(lcz173, new(normal), -lcz173.Transform.forward * 5f); + var g = new GamblingRoom(RoleTypeId.Scp173.GetRandomSpawnLocation().Position, new(normal)); + + //var g = new GamblingRoom(lcz173, new(normal), -lcz173.Transform.forward * 5f); g.SubscribeEvents(); @@ -96,7 +109,7 @@ private void OnGenerated() } - + private void OnRoundEnded(RoundEndedEventArgs ev) { foreach (var g in GamblingRoom.List) From 8d3b3ed6bd705152862e8b1ed6981d99b54f7581 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Sun, 22 Jun 2025 20:55:52 +0200 Subject: [PATCH 279/853] removed old model using --- KruacentExiled/KE.Items/MainPlugin.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/KruacentExiled/KE.Items/MainPlugin.cs b/KruacentExiled/KE.Items/MainPlugin.cs index 804da001..2f6557df 100644 --- a/KruacentExiled/KE.Items/MainPlugin.cs +++ b/KruacentExiled/KE.Items/MainPlugin.cs @@ -8,7 +8,6 @@ using KE.Items.Settings; using KE.Items.Upgrade; using KE.Utils.API.Displays.DisplayMeow; -using KE.Utils.API.Models; using PlayerRoles; using System; using UnityEngine; From ee6dd071e5085604ab15b0971dff27bb6250c6cb Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Sun, 22 Jun 2025 21:49:18 +0200 Subject: [PATCH 280/853] 3114 added to 914 --- KruacentExiled/KE.Misc/Misc/914.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/KruacentExiled/KE.Misc/Misc/914.cs b/KruacentExiled/KE.Misc/Misc/914.cs index 54dc5079..664280f8 100644 --- a/KruacentExiled/KE.Misc/Misc/914.cs +++ b/KruacentExiled/KE.Misc/Misc/914.cs @@ -29,7 +29,7 @@ internal class _914 : MiscFeature { 3, RoleTypeId.Scp106 }, { 2, RoleTypeId.Scp173 }, - { 1, RoleTypeId.Scp079 }, + { 1, RoleTypeId.Scp3114 }, }; From 859a63f214e3ed31a6a739b445d22a352724b712 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Sun, 22 Jun 2025 22:16:39 +0200 Subject: [PATCH 281/853] moved the gamble to new 173 --- KruacentExiled/Map/GamblingZone/GamblingRoom.cs | 2 +- KruacentExiled/Map/MainPlugin.cs | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/KruacentExiled/Map/GamblingZone/GamblingRoom.cs b/KruacentExiled/Map/GamblingZone/GamblingRoom.cs index f373fa05..39633b00 100644 --- a/KruacentExiled/Map/GamblingZone/GamblingRoom.cs +++ b/KruacentExiled/Map/GamblingZone/GamblingRoom.cs @@ -54,7 +54,7 @@ private void Init(Vector3 position,LootTable lootTable,Vector3? offset = null) _pickup.AddAction(OnPickup); - CreateModel(_position); + //CreateModel(_position); _lootTable = lootTable; } diff --git a/KruacentExiled/Map/MainPlugin.cs b/KruacentExiled/Map/MainPlugin.cs index aa9c0d5c..9519ac11 100644 --- a/KruacentExiled/Map/MainPlugin.cs +++ b/KruacentExiled/Map/MainPlugin.cs @@ -20,15 +20,15 @@ namespace KE.Map public class MainPlugin : Plugin { public static MainPlugin Instance { get; private set; } - public Models models => Models.Instance; + //public Models models => Models.Instance; public override void OnEnabled() { Exiled.Events.Handlers.Map.Generated += OnGenerated; Exiled.Events.Handlers.Server.RoundEnded += OnRoundEnded; //Exiled.Events.Handlers.Server.RoundStarted += SendFakePrimitives.Join; - if(Config.Debug) - models?.SubscribeEvents(); + //if(Config.Debug) + //models?.SubscribeEvents(); Instance = this; } @@ -38,11 +38,11 @@ public override void OnDisabled() Exiled.Events.Handlers.Map.Generated -= OnGenerated; Exiled.Events.Handlers.Server.RoundEnded -= OnRoundEnded; //Exiled.Events.Handlers.Server.RoundStarted -= SendFakePrimitives.Join; - if (Config.Debug) + /*if (Config.Debug) { models.UnsubscribeEvents(); models.DestroyInstance(); - } + }*/ Instance = null; } @@ -89,7 +89,7 @@ private void OnGenerated() }; - var g = new GamblingRoom(RoleTypeId.Scp173.GetRandomSpawnLocation().Position, new(normal)); + var g = new GamblingRoom(RoleTypeId.Scp173.GetRandomSpawnLocation().Position + Vector3.down*2, new(normal)); //var g = new GamblingRoom(lcz173, new(normal), -lcz173.Transform.forward * 5f); From 9405bd42ed4a3537eb186557aef63d2a434f75f8 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Mon, 23 Jun 2025 01:48:31 +0200 Subject: [PATCH 282/853] rebalance --- KruacentExiled/Map/MainPlugin.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/KruacentExiled/Map/MainPlugin.cs b/KruacentExiled/Map/MainPlugin.cs index 9519ac11..8fe9b719 100644 --- a/KruacentExiled/Map/MainPlugin.cs +++ b/KruacentExiled/Map/MainPlugin.cs @@ -59,7 +59,7 @@ private void OnGenerated() new(ItemType.KeycardO5,1,2), new(ItemType.SCP500,1), new(ItemType.KeycardMTFCaptain,1), - new(ItemType.SCP268,1), + new(ItemType.SCP268,1,1), new(ItemType.GunCOM15,1), new(ItemType.SCP207,1), new(ItemType.Adrenaline,1), @@ -78,10 +78,10 @@ private void OnGenerated() ItemType.KeycardScientist, ItemType.KeycardJanitor, ItemType.Coin, - ItemType.Jailbird, + new(ItemType.Jailbird,1,1), ItemType.Flashlight, - ItemType.AntiSCP207, - ItemType.ParticleDisruptor, + ItemType.AntiSCP207, + new(ItemType.ParticleDisruptor,1,1), ItemType.GunCom45, ItemType.GunShotgun, ItemType.GunRevolver, From 870040ecf20f279a2a7354edb5c17c147e634673 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Mon, 23 Jun 2025 01:52:45 +0200 Subject: [PATCH 283/853] corrected some test --- KruacentExiled/Map/Commands/ModelParent.cs | 48 ---------------------- KruacentExiled/Map/MainPlugin.cs | 3 +- 2 files changed, 2 insertions(+), 49 deletions(-) delete mode 100644 KruacentExiled/Map/Commands/ModelParent.cs diff --git a/KruacentExiled/Map/Commands/ModelParent.cs b/KruacentExiled/Map/Commands/ModelParent.cs deleted file mode 100644 index 6728ccd0..00000000 --- a/KruacentExiled/Map/Commands/ModelParent.cs +++ /dev/null @@ -1,48 +0,0 @@ -using CommandSystem; -using Exiled.API.Features; -using Exiled.Permissions.Extensions; -using KE.Utils.API.Models.Commands; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace KE.Map.Commands -{ - [CommandHandler(typeof(RemoteAdminCommandHandler))] - public class ModelParent : ParentCommand - { - public ModelParent() - { - Log.Debug("loading"); - LoadGeneratedCommands(); - - } - - public override string Command { get; } = "model"; - - /// - public override string[] Aliases { get; } = { "m" }; - - /// - public override string Description { get; } = "models"; - - - public override void LoadGeneratedCommands() - { - RegisterCommand(new CreateModel()); - RegisterCommand(new ListModel()); - RegisterCommand(new SelectModel()); - RegisterCommand(new ShowCenter()); - RegisterCommand(new ModeMovePrim()); - } - - protected override bool ExecuteParent(ArraySegment arguments, ICommandSender sender, out string response) - { - response = "hoi"; - return true; - } - - } -} diff --git a/KruacentExiled/Map/MainPlugin.cs b/KruacentExiled/Map/MainPlugin.cs index 8fe9b719..29a64bd1 100644 --- a/KruacentExiled/Map/MainPlugin.cs +++ b/KruacentExiled/Map/MainPlugin.cs @@ -42,8 +42,9 @@ public override void OnDisabled() { models.UnsubscribeEvents(); models.DestroyInstance(); - }*/ + } + models.DestroyInstance();*/ Instance = null; } From 9694f224f9701bd68511bb618255ec3c9f4a1d00 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Mon, 23 Jun 2025 05:23:24 +0200 Subject: [PATCH 284/853] added some easter egg :3 --- KruacentExiled/Map/EasterEggs/Capybaras.cs | 40 ++++++++++++++++ KruacentExiled/Map/EasterEggs/SpinnyBaras.cs | 48 +++++++++++++++++++ .../Map/GamblingZone/GamblingRoom.cs | 2 - KruacentExiled/Map/MainPlugin.cs | 10 +++- 4 files changed, 97 insertions(+), 3 deletions(-) create mode 100644 KruacentExiled/Map/EasterEggs/Capybaras.cs create mode 100644 KruacentExiled/Map/EasterEggs/SpinnyBaras.cs diff --git a/KruacentExiled/Map/EasterEggs/Capybaras.cs b/KruacentExiled/Map/EasterEggs/Capybaras.cs new file mode 100644 index 00000000..f8d1d401 --- /dev/null +++ b/KruacentExiled/Map/EasterEggs/Capybaras.cs @@ -0,0 +1,40 @@ +using Exiled.API.Extensions; +using Exiled.API.Features.Toys; +using Exiled.API.Interfaces; +using KE.Utils.API.Interfaces; +using LabApi.Features.Wrappers; +using PlayerRoles; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using UnityEngine; +using Light = Exiled.API.Features.Toys.Light; + +namespace KE.Map.EasterEggs +{ + internal class Capybaras : IUsingEvents + { + private HashSet _spinnyBaras = new(); + public readonly Vector3 _capy1 = new Vector3(129, 293, 18); + + public void SubscribeEvents() + { + Exiled.Events.Handlers.Map.Generated += OnGenerated; + + } + + public void UnsubscribeEvents() + { + Exiled.Events.Handlers.Map.Generated -= OnGenerated; + } + + + private void OnGenerated() + { + //e + _spinnyBaras.Add(new SpinnyBaras(_capy1)); + } + } +} diff --git a/KruacentExiled/Map/EasterEggs/SpinnyBaras.cs b/KruacentExiled/Map/EasterEggs/SpinnyBaras.cs new file mode 100644 index 00000000..c233ab4d --- /dev/null +++ b/KruacentExiled/Map/EasterEggs/SpinnyBaras.cs @@ -0,0 +1,48 @@ +using Exiled.API.Features; +using Exiled.API.Features.Toys; +using LabApi.Features.Wrappers; +using MEC; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using UnityEngine; +using Player = Exiled.API.Features.Player; + +namespace KE.Map.EasterEggs +{ + internal class SpinnyBaras + { + private CapybaraToy _capybara; + private CoroutineHandle _handle; + + private float speed = 100; + public SpinnyBaras(Vector3 position) + { + _capybara = CapybaraToy.Create(position); + _handle = Timing.RunCoroutine(Spin()); + } + + ~SpinnyBaras() + { + Timing.KillCoroutines(_handle); + } + private IEnumerator Spin() + { + while (true) + { + _capybara.Transform.Rotate(Vector3.up, 1); + yield return Timing.WaitForSeconds(1/speed); + } + + } + + + public void Kill() + { + Timing.KillCoroutines(_handle); + } + + } +} diff --git a/KruacentExiled/Map/GamblingZone/GamblingRoom.cs b/KruacentExiled/Map/GamblingZone/GamblingRoom.cs index 39633b00..1bfd87e7 100644 --- a/KruacentExiled/Map/GamblingZone/GamblingRoom.cs +++ b/KruacentExiled/Map/GamblingZone/GamblingRoom.cs @@ -45,9 +45,7 @@ private void Init(Vector3 position,LootTable lootTable,Vector3? offset = null) - Log.Debug("position w/out offset "+position); _position = position + (offset ?? new Vector3()); - Log.Debug("position w/ offset "+_position); _list.Add(this); _pickup = new InteractiblePickup(ItemType.Medkit, _position+ Vector3.up, new Vector3(1,0,1)*3, _pickupTime, new()); diff --git a/KruacentExiled/Map/MainPlugin.cs b/KruacentExiled/Map/MainPlugin.cs index 29a64bd1..76598ecc 100644 --- a/KruacentExiled/Map/MainPlugin.cs +++ b/KruacentExiled/Map/MainPlugin.cs @@ -8,6 +8,7 @@ using Exiled.Events.EventArgs.Server; using Interactables.Interobjects.DoorUtils; using KE.Map.Doors; +using KE.Map.EasterEggs; using KE.Map.GamblingZone; using KE.Map.Utils; using KE.Utils.API.Models; @@ -21,9 +22,14 @@ public class MainPlugin : Plugin { public static MainPlugin Instance { get; private set; } //public Models models => Models.Instance; + private Capybaras Capybaras; public override void OnEnabled() { - + + Capybaras = new(); + + + Capybaras.SubscribeEvents(); Exiled.Events.Handlers.Map.Generated += OnGenerated; Exiled.Events.Handlers.Server.RoundEnded += OnRoundEnded; //Exiled.Events.Handlers.Server.RoundStarted += SendFakePrimitives.Join; @@ -38,6 +44,7 @@ public override void OnDisabled() Exiled.Events.Handlers.Map.Generated -= OnGenerated; Exiled.Events.Handlers.Server.RoundEnded -= OnRoundEnded; //Exiled.Events.Handlers.Server.RoundStarted -= SendFakePrimitives.Join; + Capybaras.UnsubscribeEvents(); /*if (Config.Debug) { models.UnsubscribeEvents(); @@ -45,6 +52,7 @@ public override void OnDisabled() } models.DestroyInstance();*/ + Capybaras = null; Instance = null; } From d9a32ed1223a987d2c78e3582db56ef5f6a714e5 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Tue, 24 Jun 2025 05:09:39 +0200 Subject: [PATCH 285/853] refactored 914 upgrade and friendly fire --- KruacentExiled/KE.Misc/Features/914.cs | 26 +++ .../914Upgrades/Base914PlayerUpgrade.cs | 22 ++ .../Features/914Upgrades/Base914Upgrade.cs | 60 ++++++ .../Features/914Upgrades/PlayerTeleport914.cs | 44 ++++ .../RoleChanging/Base914PlayerRoleChange.cs | 54 +++++ .../914Upgrades/RoleChanging/Human914RC.cs | 47 ++++ .../914Upgrades/RoleChanging/SCP914RC.cs | 81 +++++++ .../Features/914Upgrades/RoleOutput.cs | 26 +++ .../{Misc => Features}/AutoElevator.cs | 2 +- .../KE.Misc/{Misc => Features}/CR/Scp035.cs | 2 +- .../KE.Misc/{Misc => Features}/Candy.cs | 2 +- .../KE.Misc/{Misc => Features}/ClassDDoor.cs | 2 +- .../KE.Misc/Features/FriendlyFire.cs | 16 ++ .../FFChangingCondition.cs | 57 +++++ .../FriendlyFireConditions/OpenDoorFFCC.cs | 33 +++ .../FriendlyFireConditions/ScpDeathFFCC.cs | 33 +++ .../FriendlyFireConditions/StartRoundFFCC.cs | 32 +++ .../WarheadStartingFFCC.cs | 33 +++ .../KE.Misc/Features/LoadingMiscFeature.cs | 42 ++++ .../KE.Misc/{Misc => Features}/MiscFeature.cs | 2 +- .../KE.Misc/{Misc => Features}/SCPBuff.cs | 2 +- .../KE.Misc/{Misc => Features}/Spawn.cs | 4 +- .../{Misc => Features}/SurfaceLight.cs | 2 +- KruacentExiled/KE.Misc/KE.Misc.csproj | 2 +- KruacentExiled/KE.Misc/MainPlugin.cs | 5 +- KruacentExiled/KE.Misc/Misc/914.cs | 202 ------------------ KruacentExiled/KE.Misc/Misc/FriendlyFire.cs | 60 ------ .../KE.Misc/Patches/ServerPatches.cs | 17 ++ .../KE.Utils/API/ReflectionHelper.cs | 47 ++++ .../KE.Utils/Extensions/RoomExtension.cs | 12 -- .../KE.Utils/Extensions/RoomExtensions.cs | 20 ++ 31 files changed, 702 insertions(+), 287 deletions(-) create mode 100644 KruacentExiled/KE.Misc/Features/914.cs create mode 100644 KruacentExiled/KE.Misc/Features/914Upgrades/Base914PlayerUpgrade.cs create mode 100644 KruacentExiled/KE.Misc/Features/914Upgrades/Base914Upgrade.cs create mode 100644 KruacentExiled/KE.Misc/Features/914Upgrades/PlayerTeleport914.cs create mode 100644 KruacentExiled/KE.Misc/Features/914Upgrades/RoleChanging/Base914PlayerRoleChange.cs create mode 100644 KruacentExiled/KE.Misc/Features/914Upgrades/RoleChanging/Human914RC.cs create mode 100644 KruacentExiled/KE.Misc/Features/914Upgrades/RoleChanging/SCP914RC.cs create mode 100644 KruacentExiled/KE.Misc/Features/914Upgrades/RoleOutput.cs rename KruacentExiled/KE.Misc/{Misc => Features}/AutoElevator.cs (97%) rename KruacentExiled/KE.Misc/{Misc => Features}/CR/Scp035.cs (99%) rename KruacentExiled/KE.Misc/{Misc => Features}/Candy.cs (96%) rename KruacentExiled/KE.Misc/{Misc => Features}/ClassDDoor.cs (97%) create mode 100644 KruacentExiled/KE.Misc/Features/FriendlyFire.cs create mode 100644 KruacentExiled/KE.Misc/Features/FriendlyFireConditions/FFChangingCondition.cs create mode 100644 KruacentExiled/KE.Misc/Features/FriendlyFireConditions/OpenDoorFFCC.cs create mode 100644 KruacentExiled/KE.Misc/Features/FriendlyFireConditions/ScpDeathFFCC.cs create mode 100644 KruacentExiled/KE.Misc/Features/FriendlyFireConditions/StartRoundFFCC.cs create mode 100644 KruacentExiled/KE.Misc/Features/FriendlyFireConditions/WarheadStartingFFCC.cs create mode 100644 KruacentExiled/KE.Misc/Features/LoadingMiscFeature.cs rename KruacentExiled/KE.Misc/{Misc => Features}/MiscFeature.cs (97%) rename KruacentExiled/KE.Misc/{Misc => Features}/SCPBuff.cs (99%) rename KruacentExiled/KE.Misc/{Misc => Features}/Spawn.cs (98%) rename KruacentExiled/KE.Misc/{Misc => Features}/SurfaceLight.cs (97%) delete mode 100644 KruacentExiled/KE.Misc/Misc/914.cs delete mode 100644 KruacentExiled/KE.Misc/Misc/FriendlyFire.cs create mode 100644 KruacentExiled/KE.Misc/Patches/ServerPatches.cs create mode 100644 KruacentExiled/KE.Utils/API/ReflectionHelper.cs delete mode 100644 KruacentExiled/KE.Utils/Extensions/RoomExtension.cs diff --git a/KruacentExiled/KE.Misc/Features/914.cs b/KruacentExiled/KE.Misc/Features/914.cs new file mode 100644 index 00000000..04e40edd --- /dev/null +++ b/KruacentExiled/KE.Misc/Features/914.cs @@ -0,0 +1,26 @@ +using Exiled.API.Enums; +using Exiled.Events.EventArgs.Scp914; +using PlayerRoles; +using Scp914; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Exiled.API.Features; +using Exiled.API.Extensions; +using UnityEngine; +using YamlDotNet.Core.Tokens; +using Exiled.CustomRoles.API.Features; +using KE.Misc.Features; +using KE.Utils.API; +using KE.Misc.Features._914Upgrades; + +namespace KE.Misc.Features +{ + internal class _914 : LoadingMiscFeature + { + + + } +} diff --git a/KruacentExiled/KE.Misc/Features/914Upgrades/Base914PlayerUpgrade.cs b/KruacentExiled/KE.Misc/Features/914Upgrades/Base914PlayerUpgrade.cs new file mode 100644 index 00000000..7e1c5844 --- /dev/null +++ b/KruacentExiled/KE.Misc/Features/914Upgrades/Base914PlayerUpgrade.cs @@ -0,0 +1,22 @@ +using Exiled.Events.EventArgs.Scp914; +using PlayerRoles; +using Scp914; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace KE.Misc.Features._914Upgrades +{ + public abstract class Base914PlayerUpgrade : Base914Upgrade + { + + + protected override abstract void OnUpgradingPlayer(UpgradingPlayerEventArgs ev); + + + + + } +} diff --git a/KruacentExiled/KE.Misc/Features/914Upgrades/Base914Upgrade.cs b/KruacentExiled/KE.Misc/Features/914Upgrades/Base914Upgrade.cs new file mode 100644 index 00000000..1bf51529 --- /dev/null +++ b/KruacentExiled/KE.Misc/Features/914Upgrades/Base914Upgrade.cs @@ -0,0 +1,60 @@ +using Exiled.API.Features; +using Exiled.CustomItems.API.Features; +using Exiled.Events.EventArgs.Scp914; +using KE.Utils.API.Interfaces; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using UnityEngine; + +namespace KE.Misc.Features._914Upgrades +{ + public abstract class Base914Upgrade : IUsingEvents + { + + protected abstract float Chance { get; } + + public void SubscribeEvents() + { + Exiled.Events.Handlers.Scp914.UpgradingPlayer += InternalUpgradingPlayer; + } + + public void UnsubscribeEvents() + { + Exiled.Events.Handlers.Scp914.UpgradingPlayer -= InternalUpgradingPlayer; + } + + private void InternalUpgradingPlayer(UpgradingPlayerEventArgs ev) + { + if (!ev.IsAllowed) return; + if (!LuckCheck()) return; + OnUpgradingPlayer(ev); + } + + + /// + /// Auto check the probability with the and if it's allowed + /// + protected virtual void OnUpgradingPlayer(UpgradingPlayerEventArgs ev) + { + + } + + protected bool LuckCheck() + { + return UnityEngine.Random.Range(0f, 100f) < Mathf.Clamp(Chance, 0f, 100f); + } + + /// + /// Check luck with a differente value than + /// + /// true if it passed the luck check ; false otherwise + protected bool LuckCheck(float chance) + { + return UnityEngine.Random.Range(0f, 100f) < Mathf.Clamp(chance, 0f, 100f); + } + + } +} diff --git a/KruacentExiled/KE.Misc/Features/914Upgrades/PlayerTeleport914.cs b/KruacentExiled/KE.Misc/Features/914Upgrades/PlayerTeleport914.cs new file mode 100644 index 00000000..6a6ef8c9 --- /dev/null +++ b/KruacentExiled/KE.Misc/Features/914Upgrades/PlayerTeleport914.cs @@ -0,0 +1,44 @@ +using Exiled.API.Enums; +using Exiled.API.Features; +using Exiled.Events.EventArgs.Scp914; +using KE.Utils.Extensions; +using PlayerRoles; +using Scp914; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using UnityEngine; + +namespace KE.Misc.Features._914Upgrades +{ + public class PlayerTeleport914 : Base914PlayerUpgrade + { + public float ChanceTpEntrance = 1; + protected override float Chance => 100; + protected override void OnUpgradingPlayer(UpgradingPlayerEventArgs ev) + { + Player player = ev.Player; + Room room; + if (ev.KnobSetting == Scp914KnobSetting.Fine && LuckCheck(1)) + { + room =ZoneType.Entrance.RandomSafeRoom(); + if(room != null) + player.Teleport(room); + } + if(ev.KnobSetting == Scp914KnobSetting.Coarse && LuckCheck(25)) + { + room = ZoneType.LightContainment.RandomSafeRoom(); + if (room != null) + player.Teleport(room); + } + + + } + + + + + } +} diff --git a/KruacentExiled/KE.Misc/Features/914Upgrades/RoleChanging/Base914PlayerRoleChange.cs b/KruacentExiled/KE.Misc/Features/914Upgrades/RoleChanging/Base914PlayerRoleChange.cs new file mode 100644 index 00000000..4b43e6ca --- /dev/null +++ b/KruacentExiled/KE.Misc/Features/914Upgrades/RoleChanging/Base914PlayerRoleChange.cs @@ -0,0 +1,54 @@ +using Exiled.API.Features; +using Exiled.Events.EventArgs.Scp914; +using KE.Utils.API.Interfaces; +using MEC; +using PlayerRoles; +using Scp914; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace KE.Misc.Features._914Upgrades +{ + public abstract class Base914PlayerRoleChange : Base914PlayerUpgrade + { + public abstract RoleTypeId InputRole { get; } + + public abstract IReadOnlyDictionary OutputRoles { get; } + protected sealed override float Chance => 100; + + + + protected sealed override void OnUpgradingPlayer(UpgradingPlayerEventArgs ev) + { + + if (ev.Player.Role != InputRole) return; + if (!OutputRoles.TryGetValue(ev.KnobSetting, out var newRole)) return; + if (!LuckCheck(newRole.chance)) return; + Log.Debug($"upgrading {ev.Player.Role}->{newRole.role}"); + + Timing.CallDelayed(.5f, () => + { + SetRole(ev.Player, newRole.role); + }); + + + + } + + protected virtual void SetRole(Player player,RoleTypeId newRole) + { + player.Role.Set(newRole, RoleSpawnFlags.None); + } + + + + + + + + + } +} diff --git a/KruacentExiled/KE.Misc/Features/914Upgrades/RoleChanging/Human914RC.cs b/KruacentExiled/KE.Misc/Features/914Upgrades/RoleChanging/Human914RC.cs new file mode 100644 index 00000000..3782859f --- /dev/null +++ b/KruacentExiled/KE.Misc/Features/914Upgrades/RoleChanging/Human914RC.cs @@ -0,0 +1,47 @@ +using Exiled.API.Features; +using PlayerRoles; +using Scp914; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace KE.Misc.Features._914Upgrades.RoleChanging +{ + public class ClassD914RC : Base914PlayerRoleChange + { + public override RoleTypeId InputRole => RoleTypeId.ClassD; + + public override IReadOnlyDictionary OutputRoles { get; } = new Dictionary() + { + { Scp914KnobSetting.OneToOne,new(RoleTypeId.Scientist,50f)} + }; + + } + public class Scientist914RC : Base914PlayerRoleChange + { + public override RoleTypeId InputRole => RoleTypeId.Scientist; + + public override IReadOnlyDictionary OutputRoles { get; } = new Dictionary() + { + { Scp914KnobSetting.OneToOne,new(RoleTypeId.ClassD,50f)} + }; + + } + public class Guard914RC : Base914PlayerRoleChange + { + public override RoleTypeId InputRole => RoleTypeId.FacilityGuard; + + public override IReadOnlyDictionary OutputRoles { get; } = new Dictionary() + { + { Scp914KnobSetting.Rough,new(RoleTypeId.Scientist,100f)} + }; + + protected override void SetRole(Player player, RoleTypeId newRole) + { + player.Role.Set(newRole, RoleSpawnFlags.AssignInventory); + } + + } +} diff --git a/KruacentExiled/KE.Misc/Features/914Upgrades/RoleChanging/SCP914RC.cs b/KruacentExiled/KE.Misc/Features/914Upgrades/RoleChanging/SCP914RC.cs new file mode 100644 index 00000000..8c6a5afd --- /dev/null +++ b/KruacentExiled/KE.Misc/Features/914Upgrades/RoleChanging/SCP914RC.cs @@ -0,0 +1,81 @@ +using PlayerRoles; +using Scp914; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace KE.Misc.Features._914Upgrades.RoleChanging +{ + public class Scp096RC : Base914PlayerRoleChange + { + public override RoleTypeId InputRole => RoleTypeId.Scp096; + + public override IReadOnlyDictionary OutputRoles { get; } = new Dictionary() + { + { Scp914KnobSetting.OneToOne,new(RoleTypeId.Scp3114,50f)}, + { Scp914KnobSetting.VeryFine,new(RoleTypeId.Scp939,50f)} + }; + + } + public class Scp3114RC : Base914PlayerRoleChange + { + public override RoleTypeId InputRole => RoleTypeId.Scp3114; + + public override IReadOnlyDictionary OutputRoles { get; } = new Dictionary() + { + { Scp914KnobSetting.OneToOne,new(RoleTypeId.Scp096,50f)}, + { Scp914KnobSetting.VeryFine,new(RoleTypeId.Scp173,50f)} + }; + + } + public class Scp939RC : Base914PlayerRoleChange + { + public override RoleTypeId InputRole => RoleTypeId.Scp939; + + public override IReadOnlyDictionary OutputRoles { get; } = new Dictionary() + { + { Scp914KnobSetting.Rough,new(RoleTypeId.Scp096,50f)}, + { Scp914KnobSetting.OneToOne,new(RoleTypeId.Scp173,50f)}, + { Scp914KnobSetting.VeryFine,new(RoleTypeId.Scp049,50f)}, + }; + + } + + public class Scp173RC : Base914PlayerRoleChange + { + public override RoleTypeId InputRole => RoleTypeId.Scp173; + + public override IReadOnlyDictionary OutputRoles { get; } = new Dictionary() + { + { Scp914KnobSetting.Rough,new(RoleTypeId.Scp096,50f)}, + { Scp914KnobSetting.OneToOne,new(RoleTypeId.Scp939,50f)}, + { Scp914KnobSetting.VeryFine,new(RoleTypeId.Scp106,50f)}, + }; + + } + + public class Scp106RC : Base914PlayerRoleChange + { + public override RoleTypeId InputRole => RoleTypeId.Scp106; + + public override IReadOnlyDictionary OutputRoles { get; } = new Dictionary() + { + { Scp914KnobSetting.Rough,new(RoleTypeId.Scp173,50f)}, + { Scp914KnobSetting.OneToOne,new(RoleTypeId.Scp049,50f)}, + }; + + } + public class Scp049RC : Base914PlayerRoleChange + { + public override RoleTypeId InputRole => RoleTypeId.Scp049; + + public override IReadOnlyDictionary OutputRoles { get; } = new Dictionary() + { + { Scp914KnobSetting.Rough,new(RoleTypeId.Scp939,50f)}, + { Scp914KnobSetting.OneToOne,new(RoleTypeId.Scp106,50f)}, + }; + + } +} diff --git a/KruacentExiled/KE.Misc/Features/914Upgrades/RoleOutput.cs b/KruacentExiled/KE.Misc/Features/914Upgrades/RoleOutput.cs new file mode 100644 index 00000000..ba5e0295 --- /dev/null +++ b/KruacentExiled/KE.Misc/Features/914Upgrades/RoleOutput.cs @@ -0,0 +1,26 @@ +using PlayerRoles; +using Scp914; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using UnityEngine; + +namespace KE.Misc.Features._914Upgrades +{ + public struct RoleOutput + { + + public RoleTypeId role; + public float chance; + + + public RoleOutput(RoleTypeId role, float chance) + { + this.chance = Mathf.Clamp(chance, 0f, 100f); + this.role = role; + } + + } +} diff --git a/KruacentExiled/KE.Misc/Misc/AutoElevator.cs b/KruacentExiled/KE.Misc/Features/AutoElevator.cs similarity index 97% rename from KruacentExiled/KE.Misc/Misc/AutoElevator.cs rename to KruacentExiled/KE.Misc/Features/AutoElevator.cs index d6fe2422..0fca9af2 100644 --- a/KruacentExiled/KE.Misc/Misc/AutoElevator.cs +++ b/KruacentExiled/KE.Misc/Features/AutoElevator.cs @@ -6,7 +6,7 @@ using System.Text; using System.Threading.Tasks; -namespace KE.Misc.Misc +namespace KE.Misc.Features { /// /// The elevator will random activate in the round diff --git a/KruacentExiled/KE.Misc/Misc/CR/Scp035.cs b/KruacentExiled/KE.Misc/Features/CR/Scp035.cs similarity index 99% rename from KruacentExiled/KE.Misc/Misc/CR/Scp035.cs rename to KruacentExiled/KE.Misc/Features/CR/Scp035.cs index 890dcd29..31220db8 100644 --- a/KruacentExiled/KE.Misc/Misc/CR/Scp035.cs +++ b/KruacentExiled/KE.Misc/Features/CR/Scp035.cs @@ -11,7 +11,7 @@ using System.Text; using System.Threading.Tasks; -namespace KE.Misc.Misc.CR +namespace KE.Misc.Features.CR { [CustomRole(RoleTypeId.Tutorial)] public class Scp035 : CustomRole diff --git a/KruacentExiled/KE.Misc/Misc/Candy.cs b/KruacentExiled/KE.Misc/Features/Candy.cs similarity index 96% rename from KruacentExiled/KE.Misc/Misc/Candy.cs rename to KruacentExiled/KE.Misc/Features/Candy.cs index 40bcb01c..b78fd830 100644 --- a/KruacentExiled/KE.Misc/Misc/Candy.cs +++ b/KruacentExiled/KE.Misc/Features/Candy.cs @@ -7,7 +7,7 @@ using System.Threading.Tasks; using InventorySystem.Items.Usables.Scp330; -namespace KE.Misc.Misc +namespace KE.Misc.Features { internal class Candy : MiscFeature { diff --git a/KruacentExiled/KE.Misc/Misc/ClassDDoor.cs b/KruacentExiled/KE.Misc/Features/ClassDDoor.cs similarity index 97% rename from KruacentExiled/KE.Misc/Misc/ClassDDoor.cs rename to KruacentExiled/KE.Misc/Features/ClassDDoor.cs index fefcb8c6..25536eae 100644 --- a/KruacentExiled/KE.Misc/Misc/ClassDDoor.cs +++ b/KruacentExiled/KE.Misc/Features/ClassDDoor.cs @@ -8,7 +8,7 @@ using System.Text; using System.Threading.Tasks; -namespace KE.Misc.Misc +namespace KE.Misc.Features { /// /// Everything about classD door diff --git a/KruacentExiled/KE.Misc/Features/FriendlyFire.cs b/KruacentExiled/KE.Misc/Features/FriendlyFire.cs new file mode 100644 index 00000000..131963c8 --- /dev/null +++ b/KruacentExiled/KE.Misc/Features/FriendlyFire.cs @@ -0,0 +1,16 @@ +using Exiled.API.Features; +using Exiled.Events.EventArgs.Player; +using Exiled.Events.EventArgs.Warhead; +using KE.Misc.Features.FriendlyFireConditions; +using KE.Utils.API; +using KE.Utils.API.Interfaces; +using System; +using System.Collections.Generic; + +namespace KE.Misc.Features +{ + internal class FriendlyFire : LoadingMiscFeature + { + + } +} diff --git a/KruacentExiled/KE.Misc/Features/FriendlyFireConditions/FFChangingCondition.cs b/KruacentExiled/KE.Misc/Features/FriendlyFireConditions/FFChangingCondition.cs new file mode 100644 index 00000000..e0e8dd03 --- /dev/null +++ b/KruacentExiled/KE.Misc/Features/FriendlyFireConditions/FFChangingCondition.cs @@ -0,0 +1,57 @@ +using Exiled.API.Features; +using KE.Utils.API.Interfaces; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using UnityEngine; + +namespace KE.Misc.Features.FriendlyFireConditions +{ + internal abstract class FFChangingCondition : IUsingEvents + { + + /// + /// The chance of triggering a changement from 0f to 100f + /// + protected abstract float Chance { get; } + + + /// + /// No need to calculate the probability + /// + protected void ChangeFriendlyFire() + { + float correctedChance = Mathf.Clamp(Chance, 0f, 100f); + if (UnityEngine.Random.Range(0f, 100f) < correctedChance) + { + Server.FriendlyFire = !Server.FriendlyFire; + } + } + + /// + /// No need to calculate the probability + /// + protected void ForceFriendlyFireState(bool isFFActive) + { + byte correctedChance = (byte)Mathf.Clamp(Chance, 0, 100); + if (UnityEngine.Random.Range(0f, 100f) < correctedChance) + { + Server.FriendlyFire = isFFActive; + } + } + + public virtual void SubscribeEvents() + { + + } + + public virtual void UnsubscribeEvents() + { + + } + + + } +} diff --git a/KruacentExiled/KE.Misc/Features/FriendlyFireConditions/OpenDoorFFCC.cs b/KruacentExiled/KE.Misc/Features/FriendlyFireConditions/OpenDoorFFCC.cs new file mode 100644 index 00000000..c8646a25 --- /dev/null +++ b/KruacentExiled/KE.Misc/Features/FriendlyFireConditions/OpenDoorFFCC.cs @@ -0,0 +1,33 @@ +using Exiled.Events.EventArgs.Player; +using KE.Utils.API.Interfaces; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace KE.Misc.Features.FriendlyFireConditions +{ + internal class OpenDoorFFCC : FFChangingCondition + { + protected override float Chance => 0.1f; + + public override void SubscribeEvents() + { + Exiled.Events.Handlers.Player.InteractingDoor += OnInteractingDoor; + base.SubscribeEvents(); + } + + public override void UnsubscribeEvents() + { + Exiled.Events.Handlers.Player.InteractingDoor -= OnInteractingDoor; + base.UnsubscribeEvents(); + } + + private void OnInteractingDoor(InteractingDoorEventArgs ev) + { + if (ev.Door.IsOpen) return; + ChangeFriendlyFire(); + } + } +} diff --git a/KruacentExiled/KE.Misc/Features/FriendlyFireConditions/ScpDeathFFCC.cs b/KruacentExiled/KE.Misc/Features/FriendlyFireConditions/ScpDeathFFCC.cs new file mode 100644 index 00000000..ec1fdc23 --- /dev/null +++ b/KruacentExiled/KE.Misc/Features/FriendlyFireConditions/ScpDeathFFCC.cs @@ -0,0 +1,33 @@ +using Exiled.Events.EventArgs.Player; +using KE.Utils.API.Interfaces; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace KE.Misc.Features.FriendlyFireConditions +{ + internal class ScpDeathFFCC : FFChangingCondition + { + protected override float Chance => 20; + + public override void SubscribeEvents() + { + Exiled.Events.Handlers.Player.Dying += OnDying; + base.SubscribeEvents(); + } + + public override void UnsubscribeEvents() + { + Exiled.Events.Handlers.Player.Dying -= OnDying; + base.UnsubscribeEvents(); + } + + private void OnDying(DyingEventArgs ev) + { + if (!ev.Player.IsScp) return; + ChangeFriendlyFire(); + } + } +} diff --git a/KruacentExiled/KE.Misc/Features/FriendlyFireConditions/StartRoundFFCC.cs b/KruacentExiled/KE.Misc/Features/FriendlyFireConditions/StartRoundFFCC.cs new file mode 100644 index 00000000..a5c5ee77 --- /dev/null +++ b/KruacentExiled/KE.Misc/Features/FriendlyFireConditions/StartRoundFFCC.cs @@ -0,0 +1,32 @@ +using Exiled.Events.EventArgs.Player; +using KE.Utils.API.Interfaces; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace KE.Misc.Features.FriendlyFireConditions +{ + internal class StartRoundFFCC : FFChangingCondition + { + protected override float Chance => 50; + + public override void SubscribeEvents() + { + Exiled.Events.Handlers.Server.RoundStarted += OnRoundStarted; + base.SubscribeEvents(); + } + + public override void UnsubscribeEvents() + { + Exiled.Events.Handlers.Server.RoundStarted -= OnRoundStarted; + base.UnsubscribeEvents(); + } + + private void OnRoundStarted() + { + ForceFriendlyFireState(true); + } + } +} diff --git a/KruacentExiled/KE.Misc/Features/FriendlyFireConditions/WarheadStartingFFCC.cs b/KruacentExiled/KE.Misc/Features/FriendlyFireConditions/WarheadStartingFFCC.cs new file mode 100644 index 00000000..1ce18971 --- /dev/null +++ b/KruacentExiled/KE.Misc/Features/FriendlyFireConditions/WarheadStartingFFCC.cs @@ -0,0 +1,33 @@ +using Exiled.Events.EventArgs.Player; +using Exiled.Events.EventArgs.Warhead; +using KE.Utils.API.Interfaces; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace KE.Misc.Features.FriendlyFireConditions +{ + internal class WarheadStartingFFCC : FFChangingCondition + { + protected override float Chance => 50; + + public override void SubscribeEvents() + { + Exiled.Events.Handlers.Warhead.Starting += OnStarting; + base.SubscribeEvents(); + } + + public override void UnsubscribeEvents() + { + Exiled.Events.Handlers.Warhead.Starting -= OnStarting; + base.UnsubscribeEvents(); + } + + private void OnStarting(StartingEventArgs ev) + { + ForceFriendlyFireState(true); + } + } +} diff --git a/KruacentExiled/KE.Misc/Features/LoadingMiscFeature.cs b/KruacentExiled/KE.Misc/Features/LoadingMiscFeature.cs new file mode 100644 index 00000000..21fa6a3d --- /dev/null +++ b/KruacentExiled/KE.Misc/Features/LoadingMiscFeature.cs @@ -0,0 +1,42 @@ +using Exiled.API.Features; +using Exiled.Events.EventArgs.Player; +using Exiled.Events.EventArgs.Warhead; +using KE.Misc.Features.FriendlyFireConditions; +using KE.Utils.API; +using KE.Utils.API.Interfaces; +using System; +using System.Collections.Generic; + +namespace KE.Misc.Features +{ + internal class LoadingMiscFeature : MiscFeature + { + protected readonly HashSet _allLoadedFeatures; + + internal LoadingMiscFeature() : base() + { + _allLoadedFeatures = new(ReflectionHelper.GetObjects()); + } + + + public override void SubscribeEvents() + { + foreach(T loaded in _allLoadedFeatures) + { + Log.Debug("subscribing "+ loaded.GetType().Name); + if(loaded is IUsingEvents iue) + iue.SubscribeEvents(); + } + } + + public override void UnsubscribeEvents() + { + foreach (T loaded in _allLoadedFeatures) + { + Log.Debug("Unsubscribing " + loaded.GetType().Name); + if (loaded is IUsingEvents iue) + iue.SubscribeEvents(); + } + } + } +} diff --git a/KruacentExiled/KE.Misc/Misc/MiscFeature.cs b/KruacentExiled/KE.Misc/Features/MiscFeature.cs similarity index 97% rename from KruacentExiled/KE.Misc/Misc/MiscFeature.cs rename to KruacentExiled/KE.Misc/Features/MiscFeature.cs index 1e1419d0..caa3c2ad 100644 --- a/KruacentExiled/KE.Misc/Misc/MiscFeature.cs +++ b/KruacentExiled/KE.Misc/Features/MiscFeature.cs @@ -6,7 +6,7 @@ using System.Text; using System.Threading.Tasks; -namespace KE.Misc.Misc +namespace KE.Misc.Features { internal abstract class MiscFeature : IUsingEvents { diff --git a/KruacentExiled/KE.Misc/Misc/SCPBuff.cs b/KruacentExiled/KE.Misc/Features/SCPBuff.cs similarity index 99% rename from KruacentExiled/KE.Misc/Misc/SCPBuff.cs rename to KruacentExiled/KE.Misc/Features/SCPBuff.cs index 12918298..cc379c25 100644 --- a/KruacentExiled/KE.Misc/Misc/SCPBuff.cs +++ b/KruacentExiled/KE.Misc/Features/SCPBuff.cs @@ -8,7 +8,7 @@ using System.Linq; using UnityEngine; -namespace KE.Misc.Misc +namespace KE.Misc.Features { internal class SCPBuff { diff --git a/KruacentExiled/KE.Misc/Misc/Spawn.cs b/KruacentExiled/KE.Misc/Features/Spawn.cs similarity index 98% rename from KruacentExiled/KE.Misc/Misc/Spawn.cs rename to KruacentExiled/KE.Misc/Features/Spawn.cs index 5e789e6f..90977ebd 100644 --- a/KruacentExiled/KE.Misc/Misc/Spawn.cs +++ b/KruacentExiled/KE.Misc/Features/Spawn.cs @@ -3,7 +3,7 @@ using Exiled.API.Features; using Exiled.CustomRoles.API.Features; using Exiled.Events.EventArgs.Server; -using KE.Misc.Misc.CR; +using KE.Misc.Features.CR; using KE.Utils.API.Interfaces; using MEC; using PlayerRoles; @@ -11,7 +11,7 @@ using System.Collections.Generic; using System.Linq; -namespace KE.Misc.Misc +namespace KE.Misc.Features { internal class Spawn : MiscFeature { diff --git a/KruacentExiled/KE.Misc/Misc/SurfaceLight.cs b/KruacentExiled/KE.Misc/Features/SurfaceLight.cs similarity index 97% rename from KruacentExiled/KE.Misc/Misc/SurfaceLight.cs rename to KruacentExiled/KE.Misc/Features/SurfaceLight.cs index e6bd9bef..3742f01f 100644 --- a/KruacentExiled/KE.Misc/Misc/SurfaceLight.cs +++ b/KruacentExiled/KE.Misc/Features/SurfaceLight.cs @@ -5,7 +5,7 @@ using System.Linq; using Exiled.API.Extensions; -namespace KE.Misc.Misc +namespace KE.Misc.Features { /// /// Everything about Surface Light diff --git a/KruacentExiled/KE.Misc/KE.Misc.csproj b/KruacentExiled/KE.Misc/KE.Misc.csproj index 8b0236ca..2ff406e0 100644 --- a/KruacentExiled/KE.Misc/KE.Misc.csproj +++ b/KruacentExiled/KE.Misc/KE.Misc.csproj @@ -6,7 +6,7 @@ - + diff --git a/KruacentExiled/KE.Misc/MainPlugin.cs b/KruacentExiled/KE.Misc/MainPlugin.cs index 6bcecb27..a6aaaa1a 100644 --- a/KruacentExiled/KE.Misc/MainPlugin.cs +++ b/KruacentExiled/KE.Misc/MainPlugin.cs @@ -2,17 +2,16 @@ using Exiled.API.Features; using System.Collections.Generic; using ServerHandle = Exiled.Events.Handlers.Server; -using Nine14Handle = Exiled.Events.Handlers.Scp914; using MEC; using Exiled.API.Features.Doors; using System.Linq; using PlayerRoles; using Exiled.Events.EventArgs.Player; using System; -using KE.Misc.Misc; +using KE.Misc.Features; using KE.Misc.Handlers; using Exiled.CustomRoles.API.Features; -using KE.Misc.Misc.CR; +using KE.Misc.Features.CR; namespace KE.Misc { diff --git a/KruacentExiled/KE.Misc/Misc/914.cs b/KruacentExiled/KE.Misc/Misc/914.cs deleted file mode 100644 index 664280f8..00000000 --- a/KruacentExiled/KE.Misc/Misc/914.cs +++ /dev/null @@ -1,202 +0,0 @@ -using Exiled.API.Enums; -using Exiled.Events.EventArgs.Scp914; -using PlayerRoles; -using Scp914; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using Exiled.API.Features; -using Exiled.API.Extensions; -using UnityEngine; -using YamlDotNet.Core.Tokens; -using Exiled.CustomRoles.API.Features; - -namespace KE.Misc.Misc -{ - /// - /// Everything 914 related - /// - internal class _914 : MiscFeature - { - - internal Dictionary roleScp = new Dictionary() - { - { -1, RoleTypeId.Scp049 }, - { -2, RoleTypeId.Scp939 }, - { -3, RoleTypeId.Scp096 }, - - { 3, RoleTypeId.Scp106 }, - { 2, RoleTypeId.Scp173 }, - { 1, RoleTypeId.Scp3114 }, - - }; - - public override void SubscribeEvents() - { - Exiled.Events.Handlers.Scp914.UpgradingPlayer += OnUpgradingPlayer; - } - - public override void UnsubscribeEvents() - { - Exiled.Events.Handlers.Scp914.UpgradingPlayer -= OnUpgradingPlayer; - } - - internal void OnUpgradingPlayer(UpgradingPlayerEventArgs ev) - { - Log.Debug("upgrading player"); - Teleport(ev.Player, ev.KnobSetting); - - ChangingRole(ev.Player, ev.KnobSetting); - } - - - /// - /// Teleport the player in a random place specified by the knob - /// Coarse -> 1/4 chance to tp in Lcz -> 1/10 switch place with the scp - /// Fine -> 1/100 chance to tp in Entrance or Hcz - /// - /// the player being teleported - /// the knob setting of 914 - private void Teleport(Player p, Scp914KnobSetting knob) - { - if (knob == Scp914KnobSetting.Fine && UnityEngine.Random.value < .01f) - { - if (UnityEngine.Random.value < .5f) - p.Teleport(Room.Random(ZoneType.Entrance)); - else - p.Teleport(Room.Random(ZoneType.HeavyContainment)); - } - - if (knob == Scp914KnobSetting.Coarse && UnityEngine.Random.value < .25f) - { - if (UnityEngine.Random.value < .10f && Player.List.Any(player => player.IsScp)) - { - Player playerScp = Player.List.ToList().Where(pl => pl.IsScp).GetRandomValue(); - var pos = p.Position; - p.Teleport(playerScp.Position); - playerScp.Teleport(pos); - - } - else - p.Teleport(Room.Random(ZoneType.LightContainment)); - } - } - /// - /// Changing the role of a player - /// - /// the player to change the role - /// the knob setting of knob - private void ChangingRole(Player p, Scp914KnobSetting knob) - { - if (p.IsScp) - { - HandleScpChangingRole(p, knob); - } - else if (p.IsHuman) - { - HandleHumanChangingRole(p, knob); - } - } - /// - /// Handle the change of role if the player is human - /// - /// the human player - /// the knob setting of 914 - private void HandleHumanChangingRole(Player p, Scp914KnobSetting knob) - { - if (p.IsHuman) - { - switch (p.Role.Type) - { - case RoleTypeId.Scientist: - if (UnityEngine.Random.value < .5f && knob == Scp914KnobSetting.OneToOne) - p.Role.Set(RoleTypeId.ClassD); - break; - case RoleTypeId.ClassD: - if (UnityEngine.Random.value < .5f && knob == Scp914KnobSetting.OneToOne) - p.Role.Set(RoleTypeId.Scientist); - break; - case RoleTypeId.FacilityGuard: - if (knob == Scp914KnobSetting.Rough) - p.Role.Set(RoleTypeId.FacilityGuard); - break; - } - } - } - - /// - /// Handle the change of role if the player is a scp - /// - /// the scp player (not a zombie) - /// the knob setting of 914 - private void HandleScpChangingRole(Player p, Scp914KnobSetting knob) - { - - if (p.IsScp && p.Role.Type != RoleTypeId.Scp0492) - { - var invertRoleScp = roleScp.ToDictionary(k => k.Value, v => v.Key); - if (UnityEngine.Random.value < .5f) - { - // get the id of the scp - if (invertRoleScp.TryGetValue(p.Role.Type, out int key)) - { - switch (knob) - { - //going up in the graph - case Scp914KnobSetting.Rough: - TrySetRole(p, key - 1); - break; - //going horizontaly in the graph - case Scp914KnobSetting.OneToOne: - switch (Math.Abs(key)) - { - case 3: - TrySetRole(p, key / -3); - break; - case 2: - TrySetRole(p, key * -1); - break; - case 1: - TrySetRole(p, key * -3); - break; - - } - - break; - //going down in the graph - case Scp914KnobSetting.VeryFine: - TrySetRole(p, key + 1); - break; - } - } - - } - else - { - Log.Debug("no luck"); - } - } - } - - - - private void TrySetRole(Player p, int key) - { - RoleTypeId newRole; - if (roleScp.TryGetValue(key, out newRole)) - { - if(newRole == RoleTypeId.Scp079) - { - //035 - CustomRole.Registered.FirstOrDefault(c => c.Id == 10).AddRole(p); - } - else - { - p.Role.Set(newRole); - } - } - } - } -} diff --git a/KruacentExiled/KE.Misc/Misc/FriendlyFire.cs b/KruacentExiled/KE.Misc/Misc/FriendlyFire.cs deleted file mode 100644 index 4cf73019..00000000 --- a/KruacentExiled/KE.Misc/Misc/FriendlyFire.cs +++ /dev/null @@ -1,60 +0,0 @@ -using Exiled.API.Features; -using Exiled.Events.EventArgs.Player; -using Exiled.Events.EventArgs.Warhead; -using KE.Utils.API.Interfaces; - -namespace KE.Misc.Misc -{ - internal class FriendlyFire : MiscFeature - { - public byte ChanceAtStart = 50; - public byte ChanceAtScpDeath = 20; - public byte ChanceAtWarheadStart = 100; - - - - public override void SubscribeEvents() - { - Exiled.Events.Handlers.Player.Dying += OnDying; - Exiled.Events.Handlers.Server.RoundStarted += OnRoundStarted; - Exiled.Events.Handlers.Warhead.Starting += OnStarting; - } - - public override void UnsubscribeEvents() - { - Exiled.Events.Handlers.Player.Dying -= OnDying; - Exiled.Events.Handlers.Server.RoundStarted -= OnRoundStarted; - Exiled.Events.Handlers.Warhead.Starting -= OnStarting; - - } - - public void OnStarting(StartingEventArgs ev) - { - if (UnityEngine.Random.Range(0, 101) >= ChanceAtScpDeath) return; - Server.FriendlyFire = !Server.FriendlyFire; - } - - - private void OnRoundStarted() - { - Server.FriendlyFire = UnityEngine.Random.Range(0, 101) < ChanceAtStart; - } - - - - private void OnDying(DyingEventArgs ev) - { - if (!ev.Player.IsScp) return; - if (UnityEngine.Random.Range(0, 101) >= ChanceAtScpDeath) return; - Server.FriendlyFire = !Server.FriendlyFire; - - - } - - - - - - - } -} diff --git a/KruacentExiled/KE.Misc/Patches/ServerPatches.cs b/KruacentExiled/KE.Misc/Patches/ServerPatches.cs new file mode 100644 index 00000000..66974687 --- /dev/null +++ b/KruacentExiled/KE.Misc/Patches/ServerPatches.cs @@ -0,0 +1,17 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace KE.Misc.Patches +{ + public static class ServerPatches + { + + public static class FriendlyFirePatch + { + //todo patch to check when the friendlyfire changes (for scp hud) + } + } +} diff --git a/KruacentExiled/KE.Utils/API/ReflectionHelper.cs b/KruacentExiled/KE.Utils/API/ReflectionHelper.cs new file mode 100644 index 00000000..2f00fbb1 --- /dev/null +++ b/KruacentExiled/KE.Utils/API/ReflectionHelper.cs @@ -0,0 +1,47 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Reflection; +using System.Text; +using System.Threading.Tasks; + +namespace KE.Utils.API +{ + public static class ReflectionHelper + { + public static IEnumerable GetObjects(Assembly assembly = null) + { + List result = new(); + if (assembly == null) + { + assembly = Assembly.GetCallingAssembly(); + } + foreach (Type t in assembly.GetTypes()) + { + try + { + if (typeof(T).IsAssignableFrom(t) && !t.IsAbstract) + { + T ffcc = (T)Activator.CreateInstance(t); + result.Add(ffcc); + } + } + catch (Exception) + { + + } + } + return result; + } + + public static IEnumerable GetObjects(IEnumerable assemblies) + { + List result = new(); + foreach(Assembly assembly in assemblies) + { + result.AddRange(GetObjects(assembly)); + } + return result; + } + } +} diff --git a/KruacentExiled/KE.Utils/Extensions/RoomExtension.cs b/KruacentExiled/KE.Utils/Extensions/RoomExtension.cs deleted file mode 100644 index 35fee2e8..00000000 --- a/KruacentExiled/KE.Utils/Extensions/RoomExtension.cs +++ /dev/null @@ -1,12 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace KE.Utils.Extensions -{ - internal class RoomExtension - { - } -} diff --git a/KruacentExiled/KE.Utils/Extensions/RoomExtensions.cs b/KruacentExiled/KE.Utils/Extensions/RoomExtensions.cs index d75e0873..61fd0291 100644 --- a/KruacentExiled/KE.Utils/Extensions/RoomExtensions.cs +++ b/KruacentExiled/KE.Utils/Extensions/RoomExtensions.cs @@ -1,18 +1,38 @@ using Exiled.API.Features; using Exiled.API.Enums; using Discord; +using System.Linq; +using Exiled.API.Extensions; namespace KE.Utils.Extensions { public static class RoomExtensions { + + public static Room RandomSafeRoom(this ZoneType zone) + { + return Room.List.Where(r => r.IsSafe() && r.Zone == zone).GetRandomValue(); + } + + + /// + /// Check if a is Safe (Decontamination,Warhead) + /// + /// Note: Does NOT check if the is safe to teleport in (ex : TestRoom) + /// + /// + /// return true if the is safe for a ; false otherwise public static bool IsSafe(this Room room) { return room.Zone.IsSafe(); } + /// + /// Check if a is Safe (Decontamination,Warhead) + /// + /// return true if the zone is safe for a ; false otherwise public static bool IsSafe(this ZoneType zone) { bool result = true; From 81fbd8eaa6bb68f4deaf7a39f9967be31e0c5a3d Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Wed, 25 Jun 2025 13:47:51 +0200 Subject: [PATCH 286/853] refactored the whole global event + added middle event --- .../GE/Blitz.cs | 2 +- .../GE/BrokenGenerator.cs | 2 +- .../GE/CassieGoCrazy.cs | 2 +- .../GE/ChangedItemEffect.cs | 2 +- .../GE/Impostor.cs | 2 +- .../GE/KIWIS.cs | 2 +- .../GE/Kaboom.cs | 2 +- .../GE/OpenBar.cs | 4 +- .../KE.GlobalEventFramework.Examples/GE/R.cs | 2 +- .../GE/RandomSpawn.cs | 2 +- .../GE/Shuffle.cs | 2 +- .../GE/Speed.cs | 2 +- .../GE/SwapProtocol.cs | 2 +- .../GE/SystemMalfunction.cs | 4 +- .../MiddleEvents/HealSCP.cs | 56 ++++ .../MiddleEvents/Speed.cs | 76 +++++ .../MiddleEvents/WallHack.cs | 61 ++++ .../GEFE/API/Features/GlobalEvent.cs | 268 +++++++++--------- .../GEFE/API/Features/KEEvents.cs | 214 ++++++++++++++ .../GEFE/API/Features/Loader.cs | 42 --- .../GEFE/API/Features/MiddleEvent.cs | 212 ++++++++++++++ .../GEFE/API/Interfaces/IConditional.cs | 13 + .../GEFE/API/Interfaces/IGlobalEvent.cs | 2 + .../GEFE/API/Interfaces/IReversible.cs | 14 + .../GEFE/Commands/ForceGE.cs | 25 +- .../GEFE/Commands/ForceMiddleEvent.cs | 25 ++ .../GEFE/Commands/ForceNbGE.cs | 4 +- .../GEFE/Commands/ListGE.cs | 4 +- .../GEFE/Commands/ParentCommandGEFE.cs | 1 + .../Exceptions/FailedRegisterException.cs | 12 + .../GlobalEventNullException.cs | 2 +- .../GEFE/Handlers/ServerHandler.cs | 70 ----- .../KE.GlobalEventFramework/MainPlugin.cs | 33 +-- .../KE.Utils/API/ReflectionHelper.cs | 47 +++ 34 files changed, 911 insertions(+), 302 deletions(-) create mode 100644 KruacentExiled/KE.GlobalEventFramework.Examples/MiddleEvents/HealSCP.cs create mode 100644 KruacentExiled/KE.GlobalEventFramework.Examples/MiddleEvents/Speed.cs create mode 100644 KruacentExiled/KE.GlobalEventFramework.Examples/MiddleEvents/WallHack.cs create mode 100644 KruacentExiled/KE.GlobalEventFramework/GEFE/API/Features/KEEvents.cs delete mode 100644 KruacentExiled/KE.GlobalEventFramework/GEFE/API/Features/Loader.cs create mode 100644 KruacentExiled/KE.GlobalEventFramework/GEFE/API/Features/MiddleEvent.cs create mode 100644 KruacentExiled/KE.GlobalEventFramework/GEFE/API/Interfaces/IConditional.cs create mode 100644 KruacentExiled/KE.GlobalEventFramework/GEFE/API/Interfaces/IReversible.cs create mode 100644 KruacentExiled/KE.GlobalEventFramework/GEFE/Commands/ForceMiddleEvent.cs create mode 100644 KruacentExiled/KE.GlobalEventFramework/GEFE/Exceptions/FailedRegisterException.cs rename KruacentExiled/KE.GlobalEventFramework/GEFE/{Exception => Exceptions}/GlobalEventNullException.cs (84%) delete mode 100644 KruacentExiled/KE.GlobalEventFramework/GEFE/Handlers/ServerHandler.cs create mode 100644 KruacentExiled/KE.Utils/API/ReflectionHelper.cs diff --git a/KruacentExiled/KE.GlobalEventFramework.Examples/GE/Blitz.cs b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/Blitz.cs index db94c76d..5d239393 100644 --- a/KruacentExiled/KE.GlobalEventFramework.Examples/GE/Blitz.cs +++ b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/Blitz.cs @@ -19,7 +19,7 @@ public class Blitz : GlobalEvent, IStart /// public override string Description { get; set; } = "éteignez les lumières la luftwaffe arrive"; /// - public override int Weight { get; set; } = 1; + public override int WeightedChance => 1; /// /// The cooldown between 2 spawn of grenades /// diff --git a/KruacentExiled/KE.GlobalEventFramework.Examples/GE/BrokenGenerator.cs b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/BrokenGenerator.cs index 6daf796a..38df3c0e 100644 --- a/KruacentExiled/KE.GlobalEventFramework.Examples/GE/BrokenGenerator.cs +++ b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/BrokenGenerator.cs @@ -17,7 +17,7 @@ public class BrokenGenerator : GlobalEvent, IStart, IEvent public override uint Id { get; set; } = 1050; public override string Name { get; set; } = "Broken Generator"; public override string Description { get; set; } = "Repair the generator to be able to see!"; - public override int Weight { get; set; } = 0; + public override int WeightedChance { get; set; } = 0; //add event to avoid blackouts public List zones = new List diff --git a/KruacentExiled/KE.GlobalEventFramework.Examples/GE/CassieGoCrazy.cs b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/CassieGoCrazy.cs index 0af332cb..2228876c 100644 --- a/KruacentExiled/KE.GlobalEventFramework.Examples/GE/CassieGoCrazy.cs +++ b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/CassieGoCrazy.cs @@ -23,7 +23,7 @@ public class CassieGoCrazy : GlobalEvent, IStart /// public override string Description { get; set; } = "Crazy Cassie !"; /// - public override int Weight { get; set; } = 1; + public override int WeightedChance { get; set; } = 1; /// /// The cooldown between 2 cassie event diff --git a/KruacentExiled/KE.GlobalEventFramework.Examples/GE/ChangedItemEffect.cs b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/ChangedItemEffect.cs index 7ef069ff..5511cd3f 100644 --- a/KruacentExiled/KE.GlobalEventFramework.Examples/GE/ChangedItemEffect.cs +++ b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/ChangedItemEffect.cs @@ -19,7 +19,7 @@ public class ChangedItemEffect : GlobalEvent,IStart ,IEvent /// public override string Description { get; set; } = "Les effets des items ont changé"; /// - public override int Weight { get; set; } = 1; + public override int WeightedChance { get; set; } = 1; public Dictionary newEffects; private List _usableList = new(); diff --git a/KruacentExiled/KE.GlobalEventFramework.Examples/GE/Impostor.cs b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/Impostor.cs index 48a21131..cdeb5df0 100644 --- a/KruacentExiled/KE.GlobalEventFramework.Examples/GE/Impostor.cs +++ b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/Impostor.cs @@ -14,7 +14,7 @@ public class Impostor : GlobalEvent, IStart public override uint Id { get; set; } = 1044; public override string Name { get; set; } = "Impostor"; public override string Description { get; set; } = "Ne vous fiez pas aux apparences !"; - public override int Weight { get; set; } = 1; + public override int WeightedChance { get; set; } = 1; public IEnumerator Start() { diff --git a/KruacentExiled/KE.GlobalEventFramework.Examples/GE/KIWIS.cs b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/KIWIS.cs index de9199a3..3e44738a 100644 --- a/KruacentExiled/KE.GlobalEventFramework.Examples/GE/KIWIS.cs +++ b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/KIWIS.cs @@ -22,7 +22,7 @@ public class KIWIS : GlobalEvent,IStart /// public override string Description { get; set; } = "Kill It While It's Small"; /// - public override int Weight { get; set; } = 1; + public override int WeightedChance { get; set; } = 1; /// public IEnumerator Start() { diff --git a/KruacentExiled/KE.GlobalEventFramework.Examples/GE/Kaboom.cs b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/Kaboom.cs index 5bfcad64..2cf2f3e1 100644 --- a/KruacentExiled/KE.GlobalEventFramework.Examples/GE/Kaboom.cs +++ b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/Kaboom.cs @@ -15,7 +15,7 @@ public class Kaboom : GlobalEvent, IEvent /// public override string Description { get; set; } = "Les portes sont piegés attention!"; /// - public override int Weight { get; set; } = 1; + public override int WeightedChance { get; set; } = 1; public const float BaseChanceElevator = .05f; diff --git a/KruacentExiled/KE.GlobalEventFramework.Examples/GE/OpenBar.cs b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/OpenBar.cs index 5b29e0fd..fb7c1c38 100644 --- a/KruacentExiled/KE.GlobalEventFramework.Examples/GE/OpenBar.cs +++ b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/OpenBar.cs @@ -17,9 +17,9 @@ public class OpenBar : GlobalEvent, IStart,IEvent public override uint Id { get; set; } = 1048; public override string Name { get; set; } = "OpenBar"; public override string Description { get; set; } = "j'espère que vous avez pas prévu de kampé"; - public override int Weight { get; set; } = 0; + public override int WeightedChance { get; set; } = 0; //use event to avoid doorstuck - public override uint[] IncompatibleGE { get; set; } = { 1 }; + public override uint[] IncompatibleEvents { get; set; } = { 1 }; public IEnumerator Start() { var doors = Door.List.Where(d => new[] { DoorType.GateA, DoorType.GateB, DoorType.HczArmory, DoorType.HIDChamber,DoorType.Intercom,DoorType.Scp049Armory,DoorType.Scp096,DoorType.Scp106Primary,DoorType.Scp106Secondary,DoorType.Scp330,DoorType.Scp330Chamber,DoorType.Scp914Gate }.Contains(d.Type)).ToList(); diff --git a/KruacentExiled/KE.GlobalEventFramework.Examples/GE/R.cs b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/R.cs index f2bbfc3a..f27da85f 100644 --- a/KruacentExiled/KE.GlobalEventFramework.Examples/GE/R.cs +++ b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/R.cs @@ -15,7 +15,7 @@ public class R : GlobalEvent /// public override string Description { get; set; } = "y'a r"; /// - public override int Weight { get; set; } = 3; + public override int WeightedChance => 3; /// } diff --git a/KruacentExiled/KE.GlobalEventFramework.Examples/GE/RandomSpawn.cs b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/RandomSpawn.cs index 42aa4087..4ee4860b 100644 --- a/KruacentExiled/KE.GlobalEventFramework.Examples/GE/RandomSpawn.cs +++ b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/RandomSpawn.cs @@ -25,7 +25,7 @@ public class RandomSpawn : GlobalEvent,IStart /// public override string Description { get; set; } = "Les spawns sont random"; /// - public override int Weight { get; set; } = 1; + public override int WeightedChance { get; set; } = 1; public IEnumerable BlacklistedRooms { get; } = new HashSet() { RoomType.EzShelter,RoomType.HczTestRoom,RoomType.EzCollapsedTunnel}; /// public IEnumerator Start() diff --git a/KruacentExiled/KE.GlobalEventFramework.Examples/GE/Shuffle.cs b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/Shuffle.cs index 7d4a336a..4a46b4e4 100644 --- a/KruacentExiled/KE.GlobalEventFramework.Examples/GE/Shuffle.cs +++ b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/Shuffle.cs @@ -23,7 +23,7 @@ public class Shuffle : GlobalEvent, IStart,IEvent /// public override string Description { get; set; } = "et ça fait roomba café dans le scp"; /// - public override int Weight { get; set; } = 0; + public override int WeightedChance { get; set; } = 0; private List players; private List pos; /// diff --git a/KruacentExiled/KE.GlobalEventFramework.Examples/GE/Speed.cs b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/Speed.cs index e943707e..bb0ea6fc 100644 --- a/KruacentExiled/KE.GlobalEventFramework.Examples/GE/Speed.cs +++ b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/Speed.cs @@ -28,7 +28,7 @@ public class Speed : GlobalEvent,IStart,IEvent /// public override string Description { get; set; } = "Gas! gas! gas!"; /// - public override int Weight { get; set; } = 1; + public override int WeightedChance { get; set; } = 1; /// /// intensity of the movement boost effect /// diff --git a/KruacentExiled/KE.GlobalEventFramework.Examples/GE/SwapProtocol.cs b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/SwapProtocol.cs index 39876ff0..e62afa8c 100644 --- a/KruacentExiled/KE.GlobalEventFramework.Examples/GE/SwapProtocol.cs +++ b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/SwapProtocol.cs @@ -16,7 +16,7 @@ public class SwapProtocol : GlobalEvent, IStart public override uint Id { get; set; } = 1051; public override string Name { get; set; } = "SwapProtocol"; public override string Description { get; set; } = "EEEEEEEET c'est parti la roulette tourne"; - public override int Weight { get; set; } = 1; + public override int WeightedChance { get; set; } = 1; public IEnumerator Start() { diff --git a/KruacentExiled/KE.GlobalEventFramework.Examples/GE/SystemMalfunction.cs b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/SystemMalfunction.cs index 6632d5ff..4d740313 100644 --- a/KruacentExiled/KE.GlobalEventFramework.Examples/GE/SystemMalfunction.cs +++ b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/SystemMalfunction.cs @@ -38,9 +38,9 @@ public class SystemMalfunction : GlobalEvent, IStart, IEvent /// public override string Description { get; set; } = "On dirait que les systèmes informatiques sont défaillants"; /// - public override int Weight { get; set; } = 1; + public override int WeightedChance { get; set; } = 1; /// - public override uint[] IncompatibleGE { get; set; } = { 38 }; + public override uint[] IncompatibleEvents { get; set; } = { 38 }; /// /// Set the cooldown for the BlackoutNDoor /// diff --git a/KruacentExiled/KE.GlobalEventFramework.Examples/MiddleEvents/HealSCP.cs b/KruacentExiled/KE.GlobalEventFramework.Examples/MiddleEvents/HealSCP.cs new file mode 100644 index 00000000..0a27eb4d --- /dev/null +++ b/KruacentExiled/KE.GlobalEventFramework.Examples/MiddleEvents/HealSCP.cs @@ -0,0 +1,56 @@ +using CustomPlayerEffects; +using Exiled.API.Features; +using Exiled.Events.EventArgs.Player; +using Exiled.Events.EventArgs.Scp173; +using InventorySystem.Items.Usables; +using KE.GlobalEventFramework.GEFE.API.Features; +using KE.GlobalEventFramework.GEFE.API.Interfaces; +using MEC; +using PlayerRoles; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace KE.GlobalEventFramework.Examples.MiddleEvents +{ + public class HealSCP : MiddleEvent, IStart, IConditional + { + /// + public override uint Id { get; set; } = 10043; + /// + public override string Name { get; set; } = "HealSCPM"; + /// + public override string Description { get; set; } = "Bon aller on rallonge un peu la game"; + /// + public override int WeightedChance { get; set; } = 1; + + public bool Condition() + { + List list = Player.List.Where(p => p.IsScp && p.Role != RoleTypeId.Scp0492).ToList(); + if (list.Count ==0) return false; + + foreach(Player p in list) + { + if(p.Health/p.MaxHealth > .1f) + { + return false; + } + } + return true; + } + + public IEnumerator Start() + { + foreach (Player p in Player.List.Where(p => p.IsScp && p.Role != RoleTypeId.Scp0492)) + { + p.Health = p.MaxHealth / 2; + } + + yield return Timing.WaitForOneFrame; + } + + + } +} diff --git a/KruacentExiled/KE.GlobalEventFramework.Examples/MiddleEvents/Speed.cs b/KruacentExiled/KE.GlobalEventFramework.Examples/MiddleEvents/Speed.cs new file mode 100644 index 00000000..ce8c8317 --- /dev/null +++ b/KruacentExiled/KE.GlobalEventFramework.Examples/MiddleEvents/Speed.cs @@ -0,0 +1,76 @@ +using CustomPlayerEffects; +using Exiled.API.Features; +using Exiled.Events.EventArgs.Player; +using Exiled.Events.EventArgs.Scp173; +using InventorySystem.Items.Usables; +using KE.GlobalEventFramework.GEFE.API.Features; +using KE.GlobalEventFramework.GEFE.API.Interfaces; +using MEC; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace KE.GlobalEventFramework.Examples.MiddleEvents +{ + public class SpeedM : MiddleEvent, IStart, IReversible + { + /// + public override uint Id { get; set; } = 10042; + /// + public override string Name { get; set; } = "SpeedM"; + /// + public override string Description { get; set; } = "Gas! gas! gas!"; + /// + public override int WeightedChance { get; set; } = 0; + public override uint[] IncompatibleEvents => + /// + /// intensity of the movement boost effect + /// + public byte MovementBoost { get; set; } = 100; + /// + public IEnumerator Start() + { + yield return Timing.WaitForSeconds(1); + Player.List.ToList().ForEach(p => p.EnableEffect(MovementBoost, 999999999, true)); + + } + /// + + protected override void SubscribeEvent() + { + Exiled.Events.Handlers.Player.ChangingRole += ReactivateEffectSpawn; + Exiled.Events.Handlers.Scp173.Blinking += SpeedyNut; + } + /// + protected override void UnsubscribeEvent() + { + Exiled.Events.Handlers.Player.ChangingRole -= ReactivateEffectSpawn; + Exiled.Events.Handlers.Scp173.Blinking -= SpeedyNut; + + } + + public void OnDisable() + { + Player.List.ToList().ForEach(p => p.DisableEffect()); + } + + /// + /// Decrease the blink cooldown of SCP-173 + /// + private void SpeedyNut(BlinkingEventArgs ev) + { + ev.BlinkCooldown = ev.BlinkCooldown / 4; + } + + /// + /// Reactivate the effect at each role changement + /// + private void ReactivateEffectSpawn(ChangingRoleEventArgs ev) + { + Timing.CallDelayed(.1f, () => ev.Player.EnableEffect(MovementBoost, 999999999, true)); + + } + } +} diff --git a/KruacentExiled/KE.GlobalEventFramework.Examples/MiddleEvents/WallHack.cs b/KruacentExiled/KE.GlobalEventFramework.Examples/MiddleEvents/WallHack.cs new file mode 100644 index 00000000..e3192cfb --- /dev/null +++ b/KruacentExiled/KE.GlobalEventFramework.Examples/MiddleEvents/WallHack.cs @@ -0,0 +1,61 @@ +using CustomPlayerEffects; +using Exiled.API.Features; +using Exiled.Events.EventArgs.Player; +using Exiled.Events.EventArgs.Scp173; +using KE.GlobalEventFramework.GEFE.API.Features; +using KE.GlobalEventFramework.GEFE.API.Interfaces; +using MEC; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace KE.GlobalEventFramework.Examples.MiddleEvents +{ + public class WallHackM : MiddleEvent, IStart, IReversible + { + /// + public override uint Id { get; set; } = 10052; + /// + public override string Name { get; set; } = "WallHack"; + /// + public override string Description { get; set; } = "Tout le monde wallhack yippee!!!!!"; + /// + public override int WeightedChance { get; set; } = 1; + + /// + public IEnumerator Start() + { + yield return Timing.WaitForSeconds(.1f); + Player.List.ToList().ForEach(p => p.EnableEffect(999999999, true)); + + } + /// + protected override void SubscribeEvent() + { + Exiled.Events.Handlers.Player.ChangingRole += ReactivateEffectSpawn; + } + /// + protected override void UnsubscribeEvent() + { + Exiled.Events.Handlers.Player.ChangingRole -= ReactivateEffectSpawn; + + } + + public void OnDisable() + { + Player.List.ToList().ForEach(p => p.DisableEffect()); + } + + + /// + /// Reactivate the effect at each role changement + /// + private void ReactivateEffectSpawn(ChangingRoleEventArgs ev) + { + Timing.CallDelayed(.1f, () => ev.Player.EnableEffect( 999999999, true)); + + } + } +} diff --git a/KruacentExiled/KE.GlobalEventFramework/GEFE/API/Features/GlobalEvent.cs b/KruacentExiled/KE.GlobalEventFramework/GEFE/API/Features/GlobalEvent.cs index 2c85526c..d65e7151 100644 --- a/KruacentExiled/KE.GlobalEventFramework/GEFE/API/Features/GlobalEvent.cs +++ b/KruacentExiled/KE.GlobalEventFramework/GEFE/API/Features/GlobalEvent.cs @@ -4,211 +4,221 @@ using MEC; using KE.GlobalEventFramework.GEFE.API.Interfaces; using System; -using Exiled.Events.Commands.PluginManager; using KE.Utils.API.Displays.DisplayMeow; +using Exiled.Events.EventArgs.Server; +using KE.Utils.API.Interfaces; +using System.Text; namespace KE.GlobalEventFramework.GEFE.API.Features { - public abstract class GlobalEvent : IGlobalEvent + public abstract class GlobalEvent : KEEvents { - /// - /// A list of Active GlobalEvents - /// - public static List ActiveGlobalEvents => ActiveGE.ToList(); - internal static List ActiveGE { get; set; } = new List(); - internal static List coroutineHandles = new List(); - internal static Dictionary GlobalEvents { get; private set; } = new Dictionary(); - /// - /// A list of all registered GlobalEvents - /// - public static List GlobalEventsList => GlobalEvents.Values.ToList(); - /// - public abstract uint Id { get; set; } - /// - public abstract string Name { get; set; } - /// - public abstract string Description { get; set; } - /// - public abstract int Weight { get; set; } - /// - public virtual uint[] IncompatibleGE { get; set; } = new uint[0]; - public static void Register(IGlobalEvent globalEvent) + private class GlobalEventHandler : IUsingEvents { - Log.Send($"REGISTERING {globalEvent.Name}", Discord.LogLevel.Info, ConsoleColor.Blue); - if (GlobalEvents.ContainsKey(globalEvent.Id)) + private bool _eventsub = false; + + public void SubscribeEvents() { - Log.Error($"{globalEvent.Name}'s id is already registered by {Get(globalEvent.Id)}"); - return; - } - GlobalEvents.Add(globalEvent.Id, globalEvent); - Log.Info($"{globalEvent.Name} is registered"); - } + if (_eventsub) return; - public static void Register(List globalEvents) - { - globalEvents.ForEach(globalEvent => Register(globalEvent)); - } + Log.Debug("registering GlobalEvent"); + Exiled.Events.Handlers.Server.RoundStarted += OnRoundStarted; + Exiled.Events.Handlers.Server.WaitingForPlayers += OnWaitingForPlayers; + Exiled.Events.Handlers.Server.RoundEnded += OnEndingRound; + Exiled.Events.Handlers.Server.RestartingRound += OnRestartingRound; - /// - /// Stop all Coroutine from GE - /// - internal static void StopCoroutines() - { - coroutineHandles.ForEach(coroutineHandle => + _eventsub = true; + } + + public void UnsubscribeEvents() { - Timing.KillCoroutines(coroutineHandle); - }); - } + if (!_eventsub) return; - public static bool TryGet(uint id, out IGlobalEvent globalEvent) - { - globalEvent = Get(id); - return globalEvent != null; - } + Exiled.Events.Handlers.Server.RoundStarted -= OnRoundStarted; + Exiled.Events.Handlers.Server.WaitingForPlayers -= OnWaitingForPlayers; + Exiled.Events.Handlers.Server.RoundEnded -= OnEndingRound; + Exiled.Events.Handlers.Server.RestartingRound -= OnRestartingRound; - public static bool TryGet(string name, out IGlobalEvent globalEvent) - { - if (string.IsNullOrEmpty(name)) + _eventsub = false; + } + private void OnWaitingForPlayers() { - throw new System.Exception("name can't be null or empty"); + StopCoroutines(); + } + private void OnEndingRound(RoundEndedEventArgs _) + { + Log.Debug("ending round"); + DeactivateAll(); + } + private void OnRestartingRound() + { + Log.Debug("restarting"); + DeactivateAll(); + } + private void OnRoundStarted() + { + SetActiveGlobalEvent(); } - globalEvent = uint.TryParse(name, out uint id) ? Get(id) : Get(name); - return globalEvent != null; - } - public static IGlobalEvent Get(string name) - { - return GlobalEvents.Values.FirstOrDefault(ge => ge.Name == name); } - public static IGlobalEvent Get(uint id) + private static GlobalEventHandler _handler = new(); + + private static HashSet _activeGE = new(); + public static float ChanceRedacted = 25; + + + /// + /// A list of all registered GlobalEvents + /// + public static IEnumerable GlobalEventsList => List.Where(ev => ev is GlobalEvent).Cast(); + /// + public abstract string Description { get; set; } + + + public bool IsActive { - return GlobalEvents.TryGetValue(id, out IGlobalEvent globalEvent) ? globalEvent : null; + get + { + return _activeGE.Contains(this); + } } - private static void Show() - { - var random = UnityEngine.Random.Range(0,101); - ShowConsole(); - foreach (Player player in Player.List) - { - DisplayHandler.Instance.AddHint(MainPlugin.GEAnnouncement, player, ShowText(random < MainPlugin.Instance.Config.ChanceRedacted), 10).FontSize = 30; - } + + protected override void SubscribeEvents() + { + _handler.SubscribeEvents(); } - private static void ShowConsole() + protected override void UnsubscribeEvents() { - Log.Info($"Global Event(s) ({ActiveGE.Count()}): "); - for (int i = 0; i < ActiveGE.Count(); i++) - { - Log.Info(ActiveGE[i].Name); - } + _handler.UnsubscribeEvents(); } - private static string ShowText(bool redacted = false) + + private static void DeactivateAll() { - string result = "Global Events: "; - for (int i = 0; i < ActiveGE.Count(); i++) + foreach (GlobalEvent ge in _activeGE) { - if (redacted) - { - result += ActiveGE[i].Description; - } - else - { - result += "[REDACTED]"; - } - - if (ActiveGE.Count() > 1 && i < ActiveGE.Count() - 1) + if (ge is IEvent geEvent) { - result += ", "; + geEvent.UnsubscribeEvent(); } + _activeEvents.Remove(ge); } + _activeGE.Clear(); - - return result; } - public static List ChooseGE(int numberOfGlobalEvent = 1) - { - List activeGE = ChooseRandomGE(numberOfGlobalEvent); - Log.Debug($"activeGE size : {activeGE.Count}"); - return activeGE; - } - internal static void ActivateAll() + + private static void SetActiveGlobalEvent() { - ActivateAll(ActiveGE); + int nbGE = UnityEngine.Random.value < .1f ? 2 : 1; + _activeGE = GetRandomEvent(nbGE).ToHashSet(); + ActivateAll(_activeGE); } - private static void ActivateAll(List globalEvent) + + private static void ActivateAll(IEnumerable globalEvent) { - if(globalEvent.Count != globalEvent.Distinct().Count()) throw new ArgumentException("You can't have the same GE twice in the same round"); - ActiveGE = globalEvent; + if (globalEvent.Count() != globalEvent.Distinct().Count()) throw new ArgumentException("You can't have the same GE twice in the same round"); - foreach (IGlobalEvent ge in ActiveGE) + foreach (GlobalEvent ge in _activeGE) { - if(ge is IEvent geEvent) + if (ge is IEvent geEvent) { Log.Debug($"{ge.Name} implements IEvent, subscribing events"); geEvent.SubscribeEvent(); } - if(ge is IStart geStart) + if (ge is IStart geStart) { Log.Debug($"{ge.Name} implements IStart, starting"); CoroutineHandle a = Timing.RunCoroutine(geStart.Start()); - coroutineHandles.Add(a); + ge.coroutineHandles.Add(a); } - + _activeEvents.Add(ge); } + Show(); } - internal static void DeactivateAll() + /// + /// Stop all Coroutine from GE + /// + private static void StopCoroutines() { - foreach(IGlobalEvent ge in ActiveGE) + foreach(GlobalEvent ge in GlobalEventsList) { - if (ge is IEvent geEvent) + foreach(CoroutineHandle handle in ge.coroutineHandles) { - geEvent.UnsubscribeEvent(); + Timing.KillCoroutines(handle); } } } - private static List ChooseRandomGE(int nbGE = 1) + + + private static void Show() { - List result = new List(); + var random = UnityEngine.Random.Range(0f,100f); + Log.Debug("random="+random); + ShowConsole(); + foreach (Player player in Player.List) + { + DisplayHandler.Instance.AddHint(MainPlugin.GEAnnouncement, player, ShowText(random < ChanceRedacted), 10).FontSize = 30; + } + } - List weightedPool = new List(); - foreach (IGlobalEvent ge in GlobalEvent.GlobalEventsList) + private static void ShowConsole() + { + Log.Info($"Global Event(s) ({_activeGE.Count()}): "); + + foreach(GlobalEvent ge in _activeGE) { - for (int i = 0; i < ge.Weight; i++) - { - weightedPool.Add(ge); - Log.Debug($"getochoose : {ge.Name} "); - } + Log.Info(ge.Name); } - nbGE = Math.Min(nbGE, GlobalEvent.GlobalEventsList.Count); + } + + private static string ShowText(bool redacted = false) + { + StringBuilder builder = new(); + + builder.Append("Global Events: "); + List ge = _activeGE.ToList(); + - for (int i = 0; i < nbGE; i++) + for (int i = 0; i < ge.Count(); i++) { - int randomIndex = UnityEngine.Random.Range(0, weightedPool.Count); - IGlobalEvent selectedGE = weightedPool[randomIndex]; + if (redacted) + { + builder.Append("[REDACTED]"); + } + else + { - result.Add(selectedGE); + builder.Append(ge[i].Description); + } - weightedPool.RemoveAll(e => e == selectedGE); - weightedPool.RemoveAll(e => selectedGE.IncompatibleGE.Contains(e.Id)); + if (ge.Count() > 1 && i < ge.Count() - 1) + { + builder.Append(", "); + } } - return result; + + return builder.ToString(); } + + } + + } diff --git a/KruacentExiled/KE.GlobalEventFramework/GEFE/API/Features/KEEvents.cs b/KruacentExiled/KE.GlobalEventFramework/GEFE/API/Features/KEEvents.cs new file mode 100644 index 00000000..b0f7e2b1 --- /dev/null +++ b/KruacentExiled/KE.GlobalEventFramework/GEFE/API/Features/KEEvents.cs @@ -0,0 +1,214 @@ +using Exiled.API.Features; +using Exiled.API.Interfaces; +using Exiled.CustomItems.API.Features; +using KE.GlobalEventFramework.GEFE.API.Interfaces; +using KE.GlobalEventFramework.GEFE.Exceptions; +using KE.Utils.API; +using KE.Utils.API.Interfaces; +using MEC; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Reflection; +using System.Text; +using System.Threading.Tasks; + +namespace KE.GlobalEventFramework.GEFE.API.Features +{ + + public abstract class KEEvents + { + #region Abstract Properties + public abstract uint Id { get; set; } + public abstract string Name { get; set; } + public virtual int WeightedChance { get; set; } = 1; + public virtual uint[] IncompatibleEvents { get; set; } = new uint[0]; + protected HashSet coroutineHandles { get; } = new(); + protected static HashSet _activeEvents = new(); + + #endregion + + #region Static Variables + private static Dictionary _idLookup = new(); + private static Dictionary _nameLookup = new(); + + public static HashSet List => [.._idLookup.Values]; + #endregion + + #region Register + + public static IEnumerable RegisterAll() + { + List assemblies = new(); + foreach(var plugin in Exiled.Loader.Loader.Plugins) + { + assemblies.Add(plugin.Assembly); + } + + + IEnumerable events = ReflectionHelper.GetObjects(assemblies); + foreach(KEEvents ev in events) + { + try + { + ev.Register(); + + + } + catch (FailedRegisterException e) + { + Log.Error($"Failed to register KEevent {ev.Name} \nError : {e}"); + } + + } + return events; + + + } + public virtual void Register() + { + + if (_idLookup.ContainsKey(Id)) + { + throw new FailedRegisterException("already registered"); + } + LogRegister(); + Init(); + } + + public virtual void Init() + { + _idLookup.Add(Id, this); + _nameLookup.Add(Name, this); + SubscribeEvents(); + } + + + public virtual void Destroy() + { + _idLookup.Remove(Id); + _nameLookup.Remove(Name); + UnsubscribeEvents(); + } + + + public static void DestroyAll() + { + foreach (KEEvents ev in List) + { + ev.Destroy(); + } + } + #endregion + + + + public static void OnEnabled() + { + RegisterAll(); + + } + + public static void OnDisabled() + { + DestroyAll(); + } + + + + + protected virtual void SubscribeEvents() + { + + } + + + protected virtual void UnsubscribeEvents() + { + + } + + + + protected static IEnumerable GetRandomEvent(int numberEvent = 1) where T : KEEvents + { + List result = new(); + List weightedPool = new(); + foreach (T ge in List.Where(ev => ev is T)) + { + if (ge is not IConditional || (ge is IConditional c && c.Condition())) + { + if (!ge.IsCompatible()) continue; + for (int i = 0; i < ge.WeightedChance; i++) + { + + weightedPool.Add(ge); + Log.Debug($"gettochoose : {ge.Name} "); + } + } + } + + numberEvent = Math.Min(numberEvent, weightedPool.Count); + + for (int i = 0; i < numberEvent; i++) + { + int randomIndex = UnityEngine.Random.Range(0, weightedPool.Count); + T selectedGE = weightedPool[randomIndex]; + + result.Add(selectedGE); + + weightedPool.Remove(selectedGE); + weightedPool.RemoveAll(e => selectedGE.IncompatibleEvents.Contains(e.Id)); + if (weightedPool.Count == 0) break; + } + + return result; + } + + public virtual void LogRegister() => + Log.Send($"REGISTERED {Name}", Discord.LogLevel.Info, ConsoleColor.Blue); + + #region Getter + public static bool TryGet(uint id, out KEEvents globalEvent) + { + globalEvent = Get(id); + return globalEvent != null; + } + + public static bool TryGet(string name, out KEEvents globalEvent) + { + if (string.IsNullOrEmpty(name)) + { + throw new System.Exception("name can't be null or empty"); + } + globalEvent = uint.TryParse(name, out uint id) ? Get(id) : Get(name); + + return globalEvent != null; + } + + public static KEEvents Get(string name) + { + return List.FirstOrDefault(ge => ge.Name == name); + } + + public static KEEvents Get(uint id) + { + return _idLookup.TryGetValue(id, out KEEvents globalEvent) ? globalEvent : null; + } + + public bool IsCompatible() + { + foreach(KEEvents ev in _activeEvents) + { + foreach(int i in ev.IncompatibleEvents) + { + if (i == Id) + return false; + } + } + return true; + } +#endregion + + } +} diff --git a/KruacentExiled/KE.GlobalEventFramework/GEFE/API/Features/Loader.cs b/KruacentExiled/KE.GlobalEventFramework/GEFE/API/Features/Loader.cs deleted file mode 100644 index 191b21c5..00000000 --- a/KruacentExiled/KE.GlobalEventFramework/GEFE/API/Features/Loader.cs +++ /dev/null @@ -1,42 +0,0 @@ -using Exiled.API.Features; -using Exiled.API.Interfaces; -using KE.GlobalEventFramework.GEFE.API.Interfaces; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace KE.GlobalEventFramework.GEFE.API.Features -{ - internal class Loader - { - internal List> ActivePlugins => new List>(); - internal static Loader Instance { get; private set; } = new Loader(); - - private Loader() { } - internal void Load() - { - foreach (IPlugin plugin in Exiled.Loader.Loader.Plugins.Where(pl => pl.Name != MainPlugin.Instance.Name)) - { - if(MainPlugin.Instance.Config.ShowRegisteringLog) Log.Debug($"checking {plugin.Name}"); - foreach (Type type in plugin.Assembly.GetTypes()) - { - try - { - if (MainPlugin.Instance.Config.ShowRegisteringLog) Log.Debug($" checking {type.Name}"); - if (type.IsSubclassOf(typeof(IGlobalEvent)) || type.IsSubclassOf(typeof(GlobalEvent))) - { - ActivePlugins.Add(plugin); - IGlobalEvent ge = Activator.CreateInstance(type) as IGlobalEvent; - GlobalEvent.Register(ge); - } - }catch(System.Exception e) - { - Log.Error($"Error registering in plugin {plugin.Name} : {e.Message}"); - } - } - } - } - } -} diff --git a/KruacentExiled/KE.GlobalEventFramework/GEFE/API/Features/MiddleEvent.cs b/KruacentExiled/KE.GlobalEventFramework/GEFE/API/Features/MiddleEvent.cs new file mode 100644 index 00000000..f19d2bd2 --- /dev/null +++ b/KruacentExiled/KE.GlobalEventFramework/GEFE/API/Features/MiddleEvent.cs @@ -0,0 +1,212 @@ +using Exiled.API.Features; +using Exiled.API.Interfaces; +using Exiled.CustomItems.API.Features; +using Exiled.Events.EventArgs.Server; +using KE.GlobalEventFramework.GEFE.API.Interfaces; +using KE.Utils.API; +using KE.Utils.API.Displays.DisplayMeow; +using MEC; +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.Linq; +using System.Reflection; +using System.Runtime.InteropServices; +using System.Text; +using System.Threading.Tasks; + +namespace KE.GlobalEventFramework.GEFE.API.Features +{ + + public abstract class MiddleEvent : KEEvents + { + private class MiddleEventHandler + { + private CoroutineHandle _handle; + private bool _eventsub = false; + public void SubscribeEvents() + { + if (_eventsub) return; + Log.Debug("registering middle event"); + Exiled.Events.Handlers.Server.RoundStarted += OnRoundStarted; + Exiled.Events.Handlers.Server.RoundEnded += OnEndingRound; + Exiled.Events.Handlers.Server.RestartingRound += OnRestartingRound; + + + _eventsub = true; + } + + public void UnsubscribeEvents() + { + if (!_eventsub) return; + + Exiled.Events.Handlers.Server.RoundStarted -= OnRoundStarted; + Exiled.Events.Handlers.Server.RoundEnded -= OnEndingRound; + Exiled.Events.Handlers.Server.RestartingRound -= OnRestartingRound; + + _eventsub = false; + } + + private void OnEndingRound(RoundEndedEventArgs _) + { + Log.Debug("ending round"); + Deactivate(); + } + private void OnRestartingRound() + { + Log.Debug("restarting"); + Deactivate(); + } + private void OnRoundStarted() + { + Timing.RunCoroutine(Timer()); + } + + private IEnumerator Timer() + { + if (UnityEngine.Random.Range(0f, 100f) < 37) + { + while (Round.InProgress) + { + yield return Timing.WaitForSeconds(60); + if(Round.ElapsedTime > TimeToActivate) + { + Activate(); + } + } + } + } + } + + public abstract string Description { get; set; } + + public static float Chance = 37; + public static TimeSpan TimeToActivate = new(0, 15, 0); + + private static HashSet _activeEv = new(); + private static MiddleEventHandler _handler = new(); + + + + + protected sealed override void SubscribeEvents() + { + _handler.SubscribeEvents(); + } + protected sealed override void UnsubscribeEvents() + { + _handler.UnsubscribeEvents(); + Deactivate(); + } + + protected virtual void SubscribeEvent() + { + + } + + protected virtual void UnsubscribeEvent() + { + + } + + + + + + /// + /// Get a random and activate it + /// + public static bool Activate() + { + if (_activeEv.Count > 0) return false; + + _activeEv = GetRandomEvent().ToHashSet(); + foreach(MiddleEvent ev in _activeEv) + { + if (ev is IStart start) + ev.coroutineHandles.Add(Timing.RunCoroutine(start.Start())); + ev.SubscribeEvent(); + _activeEvents.Add(ev); + } + Show(); + + return true; + } + + public static void Deactivate(MiddleEvent m) + { + if (!_activeEv.Contains(m)) throw new ArgumentException("middleevent cannot be deactivate : not activated"); + m.UnsubscribeEvent(); + if (m is IReversible r) + r.OnDisable(); + _activeEv.Remove(m); + _activeEvents.Remove(m); + } + + public static void Deactivate() + { + foreach (MiddleEvent ev in _activeEv) + { + ev.UnsubscribeEvent(); + foreach(CoroutineHandle handle in ev.coroutineHandles) + { + Timing.KillCoroutines(handle); + if (ev is IReversible revert) + revert.OnDisable(); + } + } + _activeEv.Clear(); + } + + #region Show + private static void Show() + { + var random = UnityEngine.Random.Range(0f, 100f); + + ShowConsole(); + if (_activeEv.Count == 0) return; + foreach (Player player in Player.List) + { + DisplayHandler.Instance.AddHint(MainPlugin.GEAnnouncement, player, ShowText(), 10).FontSize = 30; + } + } + + private static void ShowConsole() + { + Log.Info($"Middle Event(s) ({_activeEv.Count()}): "); + + foreach (MiddleEvent ge in _activeEv) + { + Log.Info(ge.Name); + } + + } + + private static string ShowText() + { + string result = "Middle Event: "; + List ge = _activeEv.ToList(); + + + for (int i = 0; i < ge.Count(); i++) + { + result += ge[i].Description; + + if (ge.Count() > 1 && i < ge.Count() - 1) + { + result += ", "; + } + } + + + return result; + } + + #endregion + + + + + + } +} diff --git a/KruacentExiled/KE.GlobalEventFramework/GEFE/API/Interfaces/IConditional.cs b/KruacentExiled/KE.GlobalEventFramework/GEFE/API/Interfaces/IConditional.cs new file mode 100644 index 00000000..e0bbc247 --- /dev/null +++ b/KruacentExiled/KE.GlobalEventFramework/GEFE/API/Interfaces/IConditional.cs @@ -0,0 +1,13 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace KE.GlobalEventFramework.GEFE.API.Interfaces +{ + public interface IConditional + { + public bool Condition(); + } +} diff --git a/KruacentExiled/KE.GlobalEventFramework/GEFE/API/Interfaces/IGlobalEvent.cs b/KruacentExiled/KE.GlobalEventFramework/GEFE/API/Interfaces/IGlobalEvent.cs index 79e83933..ca2868d1 100644 --- a/KruacentExiled/KE.GlobalEventFramework/GEFE/API/Interfaces/IGlobalEvent.cs +++ b/KruacentExiled/KE.GlobalEventFramework/GEFE/API/Interfaces/IGlobalEvent.cs @@ -7,6 +7,8 @@ namespace KE.GlobalEventFramework.GEFE.API.Interfaces { + + [Obsolete("Use GlobalEvent instead",true)] public interface IGlobalEvent { /// diff --git a/KruacentExiled/KE.GlobalEventFramework/GEFE/API/Interfaces/IReversible.cs b/KruacentExiled/KE.GlobalEventFramework/GEFE/API/Interfaces/IReversible.cs new file mode 100644 index 00000000..06cbec24 --- /dev/null +++ b/KruacentExiled/KE.GlobalEventFramework/GEFE/API/Interfaces/IReversible.cs @@ -0,0 +1,14 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace KE.GlobalEventFramework.GEFE.API.Interfaces +{ + public interface IReversible + { + + public void OnDisable(); + } +} diff --git a/KruacentExiled/KE.GlobalEventFramework/GEFE/Commands/ForceGE.cs b/KruacentExiled/KE.GlobalEventFramework/GEFE/Commands/ForceGE.cs index 80c701eb..e4babcee 100644 --- a/KruacentExiled/KE.GlobalEventFramework/GEFE/Commands/ForceGE.cs +++ b/KruacentExiled/KE.GlobalEventFramework/GEFE/Commands/ForceGE.cs @@ -15,21 +15,25 @@ public class ForceGE : ICommand public string Command { get; } = "force"; public string[] Aliases { get; } = new string[] { "f" }; public string Description { get; } = "force a or multiple global event"; - internal static List ForcedGE = new List(); + internal static List ForcedGE = new(); public bool Execute(ArraySegment arguments, ICommandSender sender, out string response) { - if (!Round.IsLobby) + response = "WIP"; + return false; + + + /*if (!Round.IsLobby) { response = "You can only force a global event in the lobby"; - ForcedGE = new List(); + ForcedGE = new List(); return false; } - if (!GlobalEvent.TryGet(arguments.At(0), out IGlobalEvent ge1) || ge1 == null) + if (!GlobalEvent.TryGet(arguments.At(0), out GlobalEvent ge1) || ge1 == null) { response = $"Global event ({arguments.At(0)}) not found "; - ForcedGE = new IGlobalEvent[] { ge1 }.ToList(); + ForcedGE = new GlobalEvent[] { ge1 }.ToList(); return false; } @@ -38,27 +42,28 @@ public bool Execute(ArraySegment arguments, ICommandSender sender, out s if (arguments.Count == 1) { response = $"Forcing {ge1.Name}"; - ForcedGE = new IGlobalEvent[] { ge1 }.ToList(); + ForcedGE = new GlobalEvent[] { ge1 }.ToList(); return true; } - if (!GlobalEvent.TryGet(arguments.At(1), out IGlobalEvent ge2) || ge2 == null) + if (!GlobalEvent.TryGet(arguments.At(1), out GlobalEvent ge2) || ge2 == null) { response = $"Global event ({arguments.At(1)}) not found "; - ForcedGE = new List(); + ForcedGE = new List(); return false; } if (arguments.Count == 2) { response = $"Forcing {ge1.Name} & {ge2.Name}"; - ForcedGE = new IGlobalEvent[] { ge1, ge2 }.ToList(); + ForcedGE = new GlobalEvent[] { ge1, ge2 }.ToList(); return true; } - ForcedGE = new List(); + ForcedGE = new List(); response = ""; return false; + */ } } diff --git a/KruacentExiled/KE.GlobalEventFramework/GEFE/Commands/ForceMiddleEvent.cs b/KruacentExiled/KE.GlobalEventFramework/GEFE/Commands/ForceMiddleEvent.cs new file mode 100644 index 00000000..b33b3905 --- /dev/null +++ b/KruacentExiled/KE.GlobalEventFramework/GEFE/Commands/ForceMiddleEvent.cs @@ -0,0 +1,25 @@ +namespace KE.GlobalEventFramework.GEFE.Commands +{ + using Exiled.API.Features; + using Exiled.API.Features.Pickups; + using System; + using CommandSystem; + using System.Runtime.InteropServices.WindowsRuntime; + using GEFE.API.Interfaces; + using GEFE.API.Features; + + public class ForceMiddleEvent : ICommand + { + public string Command { get; } = "forcemiddle"; + public string[] Aliases { get; } = new string[] { "fm" }; + public string Description { get; } = "force middle event"; + + public bool Execute(ArraySegment arguments, ICommandSender sender, out string response) + { + bool res = MiddleEvent.Activate(); + + response = res ? "activated" : "not activated"; + return res; + } + } +} diff --git a/KruacentExiled/KE.GlobalEventFramework/GEFE/Commands/ForceNbGE.cs b/KruacentExiled/KE.GlobalEventFramework/GEFE/Commands/ForceNbGE.cs index e5e5fe94..db51ee0d 100644 --- a/KruacentExiled/KE.GlobalEventFramework/GEFE/Commands/ForceNbGE.cs +++ b/KruacentExiled/KE.GlobalEventFramework/GEFE/Commands/ForceNbGE.cs @@ -38,9 +38,9 @@ public bool Execute(ArraySegment arguments, ICommandSender sender, out s NbGE = -1; return false; } - if(nbge > GlobalEvent.GlobalEventsList.Count) + if(nbge > GlobalEvent.GlobalEventsList.Count()) { - response = $"You can't force {nbge} global event, there are only {GlobalEvent.GlobalEventsList.Count} global events"; + response = $"You can't force {nbge} global event, there are only {GlobalEvent.GlobalEventsList.Count()} global events"; NbGE = -1; return false; } diff --git a/KruacentExiled/KE.GlobalEventFramework/GEFE/Commands/ListGE.cs b/KruacentExiled/KE.GlobalEventFramework/GEFE/Commands/ListGE.cs index 0119db18..111a19cb 100644 --- a/KruacentExiled/KE.GlobalEventFramework/GEFE/Commands/ListGE.cs +++ b/KruacentExiled/KE.GlobalEventFramework/GEFE/Commands/ListGE.cs @@ -17,10 +17,10 @@ public class ListGE : ICommand public bool Execute(ArraySegment arguments, ICommandSender sender, out string response) { string result = "List of all global event ([o] if it's active in the round ; [ ] otherwise) : \n"; - foreach (IGlobalEvent ge in GlobalEvent.GlobalEvents.Values) + foreach (GlobalEvent ge in GlobalEvent.GlobalEventsList) { - if (GlobalEvent.ActiveGlobalEvents.Contains(ge)) + if (ge.IsActive) { result += "[o]"; } diff --git a/KruacentExiled/KE.GlobalEventFramework/GEFE/Commands/ParentCommandGEFE.cs b/KruacentExiled/KE.GlobalEventFramework/GEFE/Commands/ParentCommandGEFE.cs index 1134260a..6d762ab4 100644 --- a/KruacentExiled/KE.GlobalEventFramework/GEFE/Commands/ParentCommandGEFE.cs +++ b/KruacentExiled/KE.GlobalEventFramework/GEFE/Commands/ParentCommandGEFE.cs @@ -20,6 +20,7 @@ public override void LoadGeneratedCommands() RegisterCommand(new ListGE()); RegisterCommand(new ForceGE()); RegisterCommand(new ForceNbGE()); + RegisterCommand(new ForceMiddleEvent()); } protected override bool ExecuteParent(ArraySegment arguments, ICommandSender sender, out string response) diff --git a/KruacentExiled/KE.GlobalEventFramework/GEFE/Exceptions/FailedRegisterException.cs b/KruacentExiled/KE.GlobalEventFramework/GEFE/Exceptions/FailedRegisterException.cs new file mode 100644 index 00000000..dbd3d29d --- /dev/null +++ b/KruacentExiled/KE.GlobalEventFramework/GEFE/Exceptions/FailedRegisterException.cs @@ -0,0 +1,12 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace KE.GlobalEventFramework.GEFE.Exceptions +{ + public class FailedRegisterException(string message) : Exception(message) + { + } +} diff --git a/KruacentExiled/KE.GlobalEventFramework/GEFE/Exception/GlobalEventNullException.cs b/KruacentExiled/KE.GlobalEventFramework/GEFE/Exceptions/GlobalEventNullException.cs similarity index 84% rename from KruacentExiled/KE.GlobalEventFramework/GEFE/Exception/GlobalEventNullException.cs rename to KruacentExiled/KE.GlobalEventFramework/GEFE/Exceptions/GlobalEventNullException.cs index 1034cd03..f36db7ca 100644 --- a/KruacentExiled/KE.GlobalEventFramework/GEFE/Exception/GlobalEventNullException.cs +++ b/KruacentExiled/KE.GlobalEventFramework/GEFE/Exceptions/GlobalEventNullException.cs @@ -3,7 +3,7 @@ using System.Linq; using System.Text; using System.Threading.Tasks; -namespace KE.GlobalEventFramework.GEFE.Exception +namespace KE.GlobalEventFramework.GEFE.Exceptions { public class GlobalEventNullException : ArgumentException { diff --git a/KruacentExiled/KE.GlobalEventFramework/GEFE/Handlers/ServerHandler.cs b/KruacentExiled/KE.GlobalEventFramework/GEFE/Handlers/ServerHandler.cs deleted file mode 100644 index 2a827f49..00000000 --- a/KruacentExiled/KE.GlobalEventFramework/GEFE/Handlers/ServerHandler.cs +++ /dev/null @@ -1,70 +0,0 @@ -using Exiled.API.Features; -using Exiled.Events.EventArgs.Server; -using System.Collections.Generic; -using KE.GlobalEventFramework.GEFE.API.Interfaces; -using KE.GlobalEventFramework.GEFE.API.Features; -using KE.GlobalEventFramework.GEFE.Commands; - -namespace KE.GlobalEventFramework.GEFE.Handlers -{ - internal class ServerHandler - { - public void OnRoundStarted() - { - Log.Debug("starting round"); - HandleCommands(); - - - GlobalEvent.ActivateAll(); - } - - private void HandleCommands() - { - //force ge - if (ForceGE.ForcedGE.Count > 0) - { - Log.Debug("forcing ge"); - GlobalEvent.ActiveGE = ForceGE.ForcedGE; - ForceGE.ForcedGE = new List(); - } - else - { - int nbGE; - - //choose nb of ge - if (ForceNbGE.NbGE > -1) - { - nbGE = ForceNbGE.NbGE; - Log.Debug($"forcing nb ge = {nbGE}"); - ForceNbGE.NbGE = -1; - } - //normal case - else - { - Log.Debug($"no commands"); - nbGE = UnityEngine.Random.value < .1f ? 2 : 1; - } - GlobalEvent.ActiveGE = GlobalEvent.ChooseGE(nbGE); - } - - - } - - public void OnWaitingForPlayers() - { - GlobalEvent.StopCoroutines(); - } - - public void OnEndingRound(RoundEndedEventArgs _) - { - Log.Debug("ending round"); - GlobalEvent.DeactivateAll(); - } - public void OnRestartingRound() - { - Log.Debug("restarting"); - GlobalEvent.DeactivateAll(); - } - - } -} diff --git a/KruacentExiled/KE.GlobalEventFramework/MainPlugin.cs b/KruacentExiled/KE.GlobalEventFramework/MainPlugin.cs index 42c347cf..8bebff72 100644 --- a/KruacentExiled/KE.GlobalEventFramework/MainPlugin.cs +++ b/KruacentExiled/KE.GlobalEventFramework/MainPlugin.cs @@ -16,10 +16,9 @@ internal class MainPlugin : Plugin { public override string Author => "Patrique"; public override string Name => "KE.GEFramework"; - public override Version Version => new Version(1, 0, 0); + public override Version Version => new Version(2, 0, 0); public override PluginPriority Priority => PluginPriority.Highest; - internal GEFE.Handlers.ServerHandler _server; public static readonly HintPlacement GEAnnouncement = new(0, 50, HintServiceMeow.Core.Enum.HintAlignment.Center); @@ -31,45 +30,19 @@ public override void OnEnabled() { Instance = this; - Loader.Instance.Load(); - + KEEvents.OnEnabled(); - RegisterEvents(); - base.OnEnabled(); } public override void OnDisabled() { - UnregisterEvents(); - Timing.KillCoroutines(); + KEEvents.OnDisabled(); base.OnDisabled(); Instance = null; } - private void RegisterEvents() - { - _server = new GEFE.Handlers.ServerHandler(); - - - ServerHandler.WaitingForPlayers += _server.OnWaitingForPlayers; - ServerHandler.RoundStarted += _server.OnRoundStarted; - ServerHandler.RoundEnded += _server.OnEndingRound; - ServerHandler.RestartingRound += _server.OnRestartingRound; - - } - - private void UnregisterEvents() - { - ServerHandler.WaitingForPlayers -= _server.OnWaitingForPlayers; - ServerHandler.RoundStarted -= _server.OnRoundStarted; - ServerHandler.RoundEnded -= _server.OnEndingRound; - ServerHandler.RestartingRound -= _server.OnRestartingRound; - - _server = null; - } - diff --git a/KruacentExiled/KE.Utils/API/ReflectionHelper.cs b/KruacentExiled/KE.Utils/API/ReflectionHelper.cs new file mode 100644 index 00000000..2f00fbb1 --- /dev/null +++ b/KruacentExiled/KE.Utils/API/ReflectionHelper.cs @@ -0,0 +1,47 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Reflection; +using System.Text; +using System.Threading.Tasks; + +namespace KE.Utils.API +{ + public static class ReflectionHelper + { + public static IEnumerable GetObjects(Assembly assembly = null) + { + List result = new(); + if (assembly == null) + { + assembly = Assembly.GetCallingAssembly(); + } + foreach (Type t in assembly.GetTypes()) + { + try + { + if (typeof(T).IsAssignableFrom(t) && !t.IsAbstract) + { + T ffcc = (T)Activator.CreateInstance(t); + result.Add(ffcc); + } + } + catch (Exception) + { + + } + } + return result; + } + + public static IEnumerable GetObjects(IEnumerable assemblies) + { + List result = new(); + foreach(Assembly assembly in assemblies) + { + result.AddRange(GetObjects(assembly)); + } + return result; + } + } +} From 80bcd5971ad961ed57c09554b8769a5acbe39004 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Wed, 25 Jun 2025 17:54:30 +0200 Subject: [PATCH 287/853] added some test settings --- KruacentExiled/KE.CustomRoles/MainPlugin.cs | 8 ++- .../KE.CustomRoles/Settings/SettingHandler.cs | 54 ++++++++++++++++++- 2 files changed, 59 insertions(+), 3 deletions(-) diff --git a/KruacentExiled/KE.CustomRoles/MainPlugin.cs b/KruacentExiled/KE.CustomRoles/MainPlugin.cs index 2add61a9..741158b0 100644 --- a/KruacentExiled/KE.CustomRoles/MainPlugin.cs +++ b/KruacentExiled/KE.CustomRoles/MainPlugin.cs @@ -1,7 +1,9 @@ using Exiled.API.Features; +using Exiled.API.Features.Core.UserSettings; using Exiled.API.Interfaces; using Exiled.CustomRoles.API.Features; using Exiled.Events.EventArgs.Server; +using KE.CustomRoles.Settings; using KE.Utils.API.Displays.DisplayMeow; using MEC; using System; @@ -19,13 +21,17 @@ public class MainPlugin : Plugin public static readonly HintPlacement CRHint = new(0, 750); public static readonly HintPlacement CREffect = new(700, 300); public static Translations Translations => Instance?.Translation; + private SettingHandler SettingHandler; public override void OnEnabled() { Instance = this; _controller = new Controller(); + SettingHandler = new(); + + SettingHandler.SubscribeEvents(); CustomRole.RegisterRoles(false,null,true,Assembly); this.SubscribeEvents(); @@ -35,7 +41,7 @@ public override void OnDisabled() { CustomRole.UnregisterRoles(); - + SettingHandler.UnsubscribeEvents(); this.UnsubscribeEvents(); diff --git a/KruacentExiled/KE.CustomRoles/Settings/SettingHandler.cs b/KruacentExiled/KE.CustomRoles/Settings/SettingHandler.cs index a35f0f90..0f043ed1 100644 --- a/KruacentExiled/KE.CustomRoles/Settings/SettingHandler.cs +++ b/KruacentExiled/KE.CustomRoles/Settings/SettingHandler.cs @@ -1,12 +1,62 @@ -using System; +using Exiled.API.Features; +using Exiled.API.Features.Core.UserSettings; +using Exiled.CustomRoles.API.Features; +using Exiled.Events.EventArgs.Player; +using KE.Utils.API.Interfaces; +using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; +using UserSettings.ServerSpecific; namespace KE.CustomRoles.Settings { - internal class SettingHandler + internal class SettingHandler : IUsingEvents { + private int id =143; + private IReadOnlyCollection settings; + public SettingHandler() + { + + settings = new List() + { + new KeybindSetting(id, "testkey", default), + }; + } + + public void SubscribeEvents() + { + SettingBase.Register(settings); + ServerSpecificSettingsSync.ServerOnSettingValueReceived += OnSettingValueReceived; + Exiled.Events.Handlers.Player.Verified += OnVerified; + + } + + public void UnsubscribeEvents() + { + ServerSpecificSettingsSync.ServerOnSettingValueReceived -= OnSettingValueReceived; + Exiled.Events.Handlers.Player.Verified -= OnVerified; + SettingBase.Unregister((p => p.Id == p.Id), settings); + } + + + + private void OnVerified(VerifiedEventArgs ev) + { + ServerSpecificSettingsSync.SendToPlayer(ev.Player.ReferenceHub); + } + + private void OnSettingValueReceived(ReferenceHub hub, ServerSpecificSettingBase settingBase) + { + ActiveAbility. + + + if (settingBase is SSKeybindSetting keyindSetting && keyindSetting.SettingId == id && keyindSetting.SyncIsPressed) + { + Log.Debug("pressed"); + } + } + } } From cd07ba1c4d4ba167378fd3087d0bac51413c5ddf Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Wed, 25 Jun 2025 18:03:14 +0200 Subject: [PATCH 288/853] removed things --- KruacentExiled/KE.Items/Items/Scp514.cs | 3 ++- KruacentExiled/KE.Items/Items/Scp7045.cs | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/KruacentExiled/KE.Items/Items/Scp514.cs b/KruacentExiled/KE.Items/Items/Scp514.cs index e0d968ea..eb2b0d02 100644 --- a/KruacentExiled/KE.Items/Items/Scp514.cs +++ b/KruacentExiled/KE.Items/Items/Scp514.cs @@ -16,7 +16,8 @@ namespace KE.Items.Items { - [CustomItem(ItemType.Flashlight)] + //[CustomItem(ItemType.Flashlight)] + //wip public class Scp514 : KECustomItem { public override uint Id { get; set; } = 1070; diff --git a/KruacentExiled/KE.Items/Items/Scp7045.cs b/KruacentExiled/KE.Items/Items/Scp7045.cs index ba1eca47..35d11bc8 100644 --- a/KruacentExiled/KE.Items/Items/Scp7045.cs +++ b/KruacentExiled/KE.Items/Items/Scp7045.cs @@ -24,7 +24,8 @@ namespace KE.Items.Items { - [CustomItem(ItemType.SCP1576)] + //[CustomItem(ItemType.SCP1576)] + //Sound bad quality public class Scp7045 : KECustomItem { From bca29e86dacfc43e3149c4c5464679b4edf54576 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Wed, 25 Jun 2025 18:04:54 +0200 Subject: [PATCH 289/853] i forgor ; --- KruacentExiled/KE.CustomRoles/Settings/SettingHandler.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/KruacentExiled/KE.CustomRoles/Settings/SettingHandler.cs b/KruacentExiled/KE.CustomRoles/Settings/SettingHandler.cs index 0f043ed1..e671611b 100644 --- a/KruacentExiled/KE.CustomRoles/Settings/SettingHandler.cs +++ b/KruacentExiled/KE.CustomRoles/Settings/SettingHandler.cs @@ -49,7 +49,7 @@ private void OnVerified(VerifiedEventArgs ev) private void OnSettingValueReceived(ReferenceHub hub, ServerSpecificSettingBase settingBase) { - ActiveAbility. + if (settingBase is SSKeybindSetting keyindSetting && keyindSetting.SettingId == id && keyindSetting.SyncIsPressed) From ffd8fbee759451a1e50b3e723085795d71fb108f Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Wed, 25 Jun 2025 19:08:11 +0200 Subject: [PATCH 290/853] removed spawn for hitman + change size tall --- KruacentExiled/KE.CustomRoles/CR/Human/Hitman.cs | 2 +- KruacentExiled/KE.CustomRoles/CR/SCP/Tall.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/KruacentExiled/KE.CustomRoles/CR/Human/Hitman.cs b/KruacentExiled/KE.CustomRoles/CR/Human/Hitman.cs index a8ee5dfd..8a99f513 100644 --- a/KruacentExiled/KE.CustomRoles/CR/Human/Hitman.cs +++ b/KruacentExiled/KE.CustomRoles/CR/Human/Hitman.cs @@ -23,7 +23,7 @@ internal class Hitman : GlobalCustomRole public override string PublicName { get; set; } = string.Empty; public override bool KeepRoleOnDeath { get; set; } = false; public override bool KeepRoleOnChangingRole { get; set; } = true; - public override float SpawnChance { get; set; } = 100; + public override float SpawnChance { get; set; } = 0; private Player TargetPlayer; private Player TheHitman; diff --git a/KruacentExiled/KE.CustomRoles/CR/SCP/Tall.cs b/KruacentExiled/KE.CustomRoles/CR/SCP/Tall.cs index dc8e6c36..8aeecdac 100644 --- a/KruacentExiled/KE.CustomRoles/CR/SCP/Tall.cs +++ b/KruacentExiled/KE.CustomRoles/CR/SCP/Tall.cs @@ -16,6 +16,6 @@ public class Tall : GlobalCustomRole public override float MaxHealthMultiplicator { get; set; } = 1.1f; public override float SpawnChance { get; set; } = 100; public override SideEnum Side { get; set; } = SideEnum.SCP; - public override Vector3 Scale { get; set; } = new Vector3(1, 1.15f, 1); + public override Vector3 Scale { get; set; } = new Vector3(1, 1.10f, 1); } } From d058b8241aefb52cb8742a3d59fee656be2b17ab Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Wed, 25 Jun 2025 19:24:16 +0200 Subject: [PATCH 291/853] sercret terstsx --- KruacentExiled/Map/EasterEggs/Capybaras.cs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/KruacentExiled/Map/EasterEggs/Capybaras.cs b/KruacentExiled/Map/EasterEggs/Capybaras.cs index f8d1d401..3b7ab3b9 100644 --- a/KruacentExiled/Map/EasterEggs/Capybaras.cs +++ b/KruacentExiled/Map/EasterEggs/Capybaras.cs @@ -1,4 +1,5 @@ -using Exiled.API.Extensions; +using AdminToys; +using Exiled.API.Extensions; using Exiled.API.Features.Toys; using Exiled.API.Interfaces; using KE.Utils.API.Interfaces; @@ -35,6 +36,10 @@ private void OnGenerated() { //e _spinnyBaras.Add(new SpinnyBaras(_capy1)); + + + var l = LabApi.Features.Wrappers.TextToy.Create(_capy1); + l.TextFormat = "Celui qui trouve tous les easters eggs gagne 5€ Paypal"; } } } From cbb3c93701246bc9084c2efc3a133d4a74bf0bf3 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Wed, 25 Jun 2025 20:40:25 +0200 Subject: [PATCH 292/853] added settings --- .../API/Features/KECustomRole.cs | 20 +++++++---- KruacentExiled/KE.CustomRoles/MainPlugin.cs | 6 ++-- .../KE.CustomRoles/Settings/SettingHandler.cs | 33 ++++++++++++++++--- 3 files changed, 45 insertions(+), 14 deletions(-) diff --git a/KruacentExiled/KE.CustomRoles/API/Features/KECustomRole.cs b/KruacentExiled/KE.CustomRoles/API/Features/KECustomRole.cs index 25766e1a..99f1b3ec 100644 --- a/KruacentExiled/KE.CustomRoles/API/Features/KECustomRole.cs +++ b/KruacentExiled/KE.CustomRoles/API/Features/KECustomRole.cs @@ -9,8 +9,10 @@ using KE.Utils.API.Displays.DisplayMeow; using MEC; using PlayerRoles; +using PlayerRoles.FirstPersonControl.Thirdperson; using System.Collections.Generic; using System.Drawing; +using System.Security.Cryptography; using System.Text; using UnityEngine; @@ -42,13 +44,18 @@ public override string Name protected override void ShowMessage(Player player) { - string msg = MainPlugin.Translations.GettingNewRole; - msg = msg.Replace("%Name%", PublicName).Replace("%Desc%",Description); - + //string msg = MainPlugin.Translations.GettingNewRole; + //msg = msg.Replace("%Name%", PublicName).Replace("%Desc%",Description); + + string msg = $"{Name}"; + + if (MainPlugin.SettingHandler.GetDescriptionsSettings(player)) + { + msg += $"\n {Description}"; + } - //todo settings - float delay = 20; + float delay = MainPlugin.SettingHandler.GetTime(player); DisplayHandler.Instance.AddHint(MainPlugin.CRHint, player, msg, delay); } @@ -57,8 +64,7 @@ protected override void ShowMessage(Player player) protected void ShowEffectHint(Player player, string text) { - //todo settings - float delay = 20; + float delay = MainPlugin.SettingHandler.GetTime(player); ; DisplayHandler.Instance.AddHint(MainPlugin.CREffect, player, text, delay); } diff --git a/KruacentExiled/KE.CustomRoles/MainPlugin.cs b/KruacentExiled/KE.CustomRoles/MainPlugin.cs index 741158b0..7d7b1623 100644 --- a/KruacentExiled/KE.CustomRoles/MainPlugin.cs +++ b/KruacentExiled/KE.CustomRoles/MainPlugin.cs @@ -21,14 +21,15 @@ public class MainPlugin : Plugin public static readonly HintPlacement CRHint = new(0, 750); public static readonly HintPlacement CREffect = new(700, 300); public static Translations Translations => Instance?.Translation; - private SettingHandler SettingHandler; + private SettingHandler _settingHandler; + internal static SettingHandler SettingHandler => Instance?._settingHandler; public override void OnEnabled() { Instance = this; _controller = new Controller(); - SettingHandler = new(); + _settingHandler = new(); SettingHandler.SubscribeEvents(); @@ -45,6 +46,7 @@ public override void OnDisabled() this.UnsubscribeEvents(); + _settingHandler = null; _controller = null; Instance = null; } diff --git a/KruacentExiled/KE.CustomRoles/Settings/SettingHandler.cs b/KruacentExiled/KE.CustomRoles/Settings/SettingHandler.cs index e671611b..67786228 100644 --- a/KruacentExiled/KE.CustomRoles/Settings/SettingHandler.cs +++ b/KruacentExiled/KE.CustomRoles/Settings/SettingHandler.cs @@ -14,30 +14,34 @@ namespace KE.CustomRoles.Settings { internal class SettingHandler : IUsingEvents { - private int id =143; + private int id; + private int _idTimeCustomRole = 144; + private int _idDesc = 143; private IReadOnlyCollection settings; public SettingHandler() { settings = new List() { - new KeybindSetting(id, "testkey", default), + new HeaderSetting ("Custom Roles Hint Settings"), + new TwoButtonsSetting(_idDesc,"Descriptions","Disabled","Enabled",true,"hide/show the description the Custom Role "), + new SliderSetting(_idTimeCustomRole,"Time shown",0,30,20), }; } public void SubscribeEvents() { SettingBase.Register(settings); - ServerSpecificSettingsSync.ServerOnSettingValueReceived += OnSettingValueReceived; + //ServerSpecificSettingsSync.ServerOnSettingValueReceived += OnSettingValueReceived; Exiled.Events.Handlers.Player.Verified += OnVerified; } public void UnsubscribeEvents() { - ServerSpecificSettingsSync.ServerOnSettingValueReceived -= OnSettingValueReceived; + //ServerSpecificSettingsSync.ServerOnSettingValueReceived -= OnSettingValueReceived; Exiled.Events.Handlers.Player.Verified -= OnVerified; - SettingBase.Unregister((p => p.Id == p.Id), settings); + SettingBase.Unregister(predicate:null, settings); } @@ -58,5 +62,24 @@ private void OnSettingValueReceived(ReferenceHub hub, ServerSpecificSettingBase } } + + internal float GetTime(Player p) + { + if (!SettingBase.TryGetSetting(p, _idTimeCustomRole, out var setting)) return 20; + return setting.SliderValue; + } + + + /// + /// + /// + /// + /// true if the player wants description ; false otherwise + internal bool GetDescriptionsSettings(Player p) + { + if (!SettingBase.TryGetSetting(p, _idDesc, out var setting)) return true; + return setting.IsSecond; + } + } } From 5caa52a50144bfd4e593ca4fc642ad34b795d145 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Fri, 27 Jun 2025 04:53:23 +0200 Subject: [PATCH 293/853] fixed 914 not teleporting and fixed the 914 role change delay --- .../914Upgrades/Base914PlayerUpgrade.cs | 1 - .../Features/914Upgrades/Base914Upgrade.cs | 4 +-- .../Features/914Upgrades/PlayerTeleport914.cs | 20 +++++++++++-- .../RoleChanging/Base914PlayerRoleChange.cs | 28 +++++++++++-------- KruacentExiled/KE.Misc/MainPlugin.cs | 2 ++ KruacentExiled/KE.Utils/KE.Utils.csproj | 2 +- 6 files changed, 39 insertions(+), 18 deletions(-) diff --git a/KruacentExiled/KE.Misc/Features/914Upgrades/Base914PlayerUpgrade.cs b/KruacentExiled/KE.Misc/Features/914Upgrades/Base914PlayerUpgrade.cs index 7e1c5844..643f111e 100644 --- a/KruacentExiled/KE.Misc/Features/914Upgrades/Base914PlayerUpgrade.cs +++ b/KruacentExiled/KE.Misc/Features/914Upgrades/Base914PlayerUpgrade.cs @@ -12,7 +12,6 @@ namespace KE.Misc.Features._914Upgrades public abstract class Base914PlayerUpgrade : Base914Upgrade { - protected override abstract void OnUpgradingPlayer(UpgradingPlayerEventArgs ev); diff --git a/KruacentExiled/KE.Misc/Features/914Upgrades/Base914Upgrade.cs b/KruacentExiled/KE.Misc/Features/914Upgrades/Base914Upgrade.cs index 1bf51529..6c26c5d4 100644 --- a/KruacentExiled/KE.Misc/Features/914Upgrades/Base914Upgrade.cs +++ b/KruacentExiled/KE.Misc/Features/914Upgrades/Base914Upgrade.cs @@ -16,12 +16,12 @@ public abstract class Base914Upgrade : IUsingEvents protected abstract float Chance { get; } - public void SubscribeEvents() + public virtual void SubscribeEvents() { Exiled.Events.Handlers.Scp914.UpgradingPlayer += InternalUpgradingPlayer; } - public void UnsubscribeEvents() + public virtual void UnsubscribeEvents() { Exiled.Events.Handlers.Scp914.UpgradingPlayer -= InternalUpgradingPlayer; } diff --git a/KruacentExiled/KE.Misc/Features/914Upgrades/PlayerTeleport914.cs b/KruacentExiled/KE.Misc/Features/914Upgrades/PlayerTeleport914.cs index 6a6ef8c9..3ef8afc9 100644 --- a/KruacentExiled/KE.Misc/Features/914Upgrades/PlayerTeleport914.cs +++ b/KruacentExiled/KE.Misc/Features/914Upgrades/PlayerTeleport914.cs @@ -19,17 +19,33 @@ public class PlayerTeleport914 : Base914PlayerUpgrade protected override float Chance => 100; protected override void OnUpgradingPlayer(UpgradingPlayerEventArgs ev) { + Log.Debug("Upgrade"); Player player = ev.Player; Room room; if (ev.KnobSetting == Scp914KnobSetting.Fine && LuckCheck(1)) { - room =ZoneType.Entrance.RandomSafeRoom(); + try + { + room = ZoneType.Entrance.RandomSafeRoom(); + } + catch (Exception) + { + room = Room.Random(ZoneType.Entrance); + } + if(room != null) player.Teleport(room); } if(ev.KnobSetting == Scp914KnobSetting.Coarse && LuckCheck(25)) { - room = ZoneType.LightContainment.RandomSafeRoom(); + try + { + room = ZoneType.Entrance.RandomSafeRoom(); + } + catch (Exception) + { + room = Room.Random(ZoneType.LightContainment); + } if (room != null) player.Teleport(room); } diff --git a/KruacentExiled/KE.Misc/Features/914Upgrades/RoleChanging/Base914PlayerRoleChange.cs b/KruacentExiled/KE.Misc/Features/914Upgrades/RoleChanging/Base914PlayerRoleChange.cs index 4b43e6ca..7c2ffab9 100644 --- a/KruacentExiled/KE.Misc/Features/914Upgrades/RoleChanging/Base914PlayerRoleChange.cs +++ b/KruacentExiled/KE.Misc/Features/914Upgrades/RoleChanging/Base914PlayerRoleChange.cs @@ -14,33 +14,37 @@ namespace KE.Misc.Features._914Upgrades { public abstract class Base914PlayerRoleChange : Base914PlayerUpgrade { + private static HashSet _upgradingPlayer = new(); + public abstract RoleTypeId InputRole { get; } public abstract IReadOnlyDictionary OutputRoles { get; } protected sealed override float Chance => 100; - - protected sealed override void OnUpgradingPlayer(UpgradingPlayerEventArgs ev) { - - if (ev.Player.Role != InputRole) return; + Player player = ev.Player; + if (player.Role != InputRole) return; if (!OutputRoles.TryGetValue(ev.KnobSetting, out var newRole)) return; if (!LuckCheck(newRole.chance)) return; - Log.Debug($"upgrading {ev.Player.Role}->{newRole.role}"); + if (_upgradingPlayer.Contains(player)) return; + + Log.Debug($"upgrading {player.Role}->{newRole.role}"); - Timing.CallDelayed(.5f, () => - { - SetRole(ev.Player, newRole.role); - }); - - + SetRole(player, newRole.role); + + _upgradingPlayer.Add(player); + } protected virtual void SetRole(Player player,RoleTypeId newRole) { - player.Role.Set(newRole, RoleSpawnFlags.None); + player.Role.Set(newRole,RoleSpawnFlags.None); + Timing.CallDelayed(.5f, () => + { + _upgradingPlayer.Remove(player); + }); } diff --git a/KruacentExiled/KE.Misc/MainPlugin.cs b/KruacentExiled/KE.Misc/MainPlugin.cs index a6aaaa1a..d35fec5e 100644 --- a/KruacentExiled/KE.Misc/MainPlugin.cs +++ b/KruacentExiled/KE.Misc/MainPlugin.cs @@ -47,6 +47,8 @@ public override void OnEnabled() Respawn.SetTokens(SpawnableFaction.NtfWave, 2); Respawn.SetTokens(SpawnableFaction.ChaosWave, 2); + + MiscFeature.SubscribeAllEvents(); Exiled.Events.Handlers.Player.ChangingRole += SCPBuff.BecomingSCP; ServerHandle.RoundStarted += ServerHandler.OnRoundStarted; diff --git a/KruacentExiled/KE.Utils/KE.Utils.csproj b/KruacentExiled/KE.Utils/KE.Utils.csproj index 1587c6e8..cc1affca 100644 --- a/KruacentExiled/KE.Utils/KE.Utils.csproj +++ b/KruacentExiled/KE.Utils/KE.Utils.csproj @@ -11,7 +11,7 @@ - + From 128ea4d5d620a9ebe5984a0d12d0b89707ed5bee Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Sat, 28 Jun 2025 14:27:02 +0200 Subject: [PATCH 294/853] fixed the crash when killing someone with a global custom role + added light to scp457 --- .../API/Features/GlobalCustomRole.cs | 83 ++++++++++++++++++- .../API/Features/KECustomRole.cs | 7 +- .../KE.CustomRoles/CR/Human/Alzheimer.cs | 4 + .../KE.CustomRoles/CR/Human/Maladroit.cs | 1 + .../KE.CustomRoles/CR/SCP/SCP457.cs | 74 +++++++++++------ KruacentExiled/KE.CustomRoles/CR/SCP/Ultra.cs | 4 +- .../KE.CustomRoles/KE.CustomRoles.csproj | 1 + 7 files changed, 143 insertions(+), 31 deletions(-) diff --git a/KruacentExiled/KE.CustomRoles/API/Features/GlobalCustomRole.cs b/KruacentExiled/KE.CustomRoles/API/Features/GlobalCustomRole.cs index a1331ed1..a5262a78 100644 --- a/KruacentExiled/KE.CustomRoles/API/Features/GlobalCustomRole.cs +++ b/KruacentExiled/KE.CustomRoles/API/Features/GlobalCustomRole.cs @@ -4,6 +4,7 @@ using Exiled.API.Features.Attributes; using Exiled.API.Features.Pools; using Exiled.CustomRoles.API.Features; +using Exiled.Events.EventArgs.Player; using InventorySystem.Configs; using KE.Utils.API.Displays.DisplayMeow; using LiteNetLib4Mirror.Open.Nat; @@ -23,12 +24,41 @@ public abstract class GlobalCustomRole : KECustomRole { public sealed override RoleTypeId Role { get; set; } = RoleTypeId.None; public abstract SideEnum Side { get; set; } - public virtual IEnumerable BlacklistedRole { get; } = new HashSet(); public override bool KeepInventoryOnSpawn { get; set; } = true; + public override bool RemovalKillsPlayer => false; + + protected override void SubscribeEvents() + { + Exiled.Events.Handlers.Player.SpawningRagdoll += InternalSpawningRagdoll; + + base.SubscribeEvents(); + } + + protected override void UnsubscribeEvents() + { + Exiled.Events.Handlers.Player.SpawningRagdoll -= InternalSpawningRagdoll; + + base.UnsubscribeEvents(); + } + + private void InternalSpawningRagdoll(SpawningRagdollEventArgs ev) + { + + //letting this event go disconnect everyone idk why + if (Check(ev.Player)) + { + ev.IsAllowed = false; + + Ragdoll.CreateAndSpawn(ev.Role, ev.Player.Nickname, ev.DamageHandlerBase, ev.Position, ev.Rotation); + } + } + + public override void AddRole(Player player) { SideEnum side = SideClass.Get(player.Role.Side); + if (side != Side) { Log.Error($"tried to give a global custom role to a player in the wrong side ({side} instead of {Side})"); @@ -36,6 +66,14 @@ public override void AddRole(Player player) } Log.Debug($"{Name}: Adding role to {player.Nickname}."); TrackedPlayers.Add(player); + foreach(Player p in TrackedPlayers.ToList()) + { + if(p.Id == player.Id) + { + Log.Debug("he is in the tracked"); + } + } + Timing.CallDelayed( @@ -115,6 +153,49 @@ public override void AddRole(Player player) player.SendConsoleMessage(StringBuilderPool.Pool.ToStringReturn(builder), "green"); } } + public override void RemoveRole(Player player) + { + + + Log.Debug($"player in {Name}:"); + foreach (Player p in TrackedPlayers.ToList()) + { + if (p.Id == player.Id) + { + Log.Debug($"{p.Id} is in"); + } + } + + if (!TrackedPlayers.Contains(player)) + { + return; + } + + Log.Debug(Name + ": Removing role from " + player.Nickname + $"({player.Id})"); + TrackedPlayers.Remove(player); + player.CustomInfo = string.Empty; + player.InfoArea |= PlayerInfoArea.Nickname | PlayerInfoArea.Role; + player.Scale = Vector3.one; + if (CustomAbilities != null) + { + foreach (CustomAbility customAbility in CustomAbilities) + { + customAbility.RemoveAbility(player); + } + } + + RoleRemoved(player); + player.UniqueRole = string.Empty; + player.TryRemoveCustomeRoleFriendlyFire(Name); + if (RemovalKillsPlayer) + { + //player.Role.Set(RoleTypeId.Spectator); + } + Log.Debug(Name + ": finish Removing role from " + player.Nickname + $"({player.Id})"); + + } + + public sealed override int MaxHealth { get; set; } diff --git a/KruacentExiled/KE.CustomRoles/API/Features/KECustomRole.cs b/KruacentExiled/KE.CustomRoles/API/Features/KECustomRole.cs index 99f1b3ec..e6277975 100644 --- a/KruacentExiled/KE.CustomRoles/API/Features/KECustomRole.cs +++ b/KruacentExiled/KE.CustomRoles/API/Features/KECustomRole.cs @@ -172,12 +172,17 @@ public override void AddRole(Player player) player2.SendConsoleMessage(StringBuilderPool.Pool.ToStringReturn(stringBuilder), "green"); } + + + /// /// The chance of having this role NOT the chance to have a role /// public override abstract float SpawnChance { get; set; } - + + + } } diff --git a/KruacentExiled/KE.CustomRoles/CR/Human/Alzheimer.cs b/KruacentExiled/KE.CustomRoles/CR/Human/Alzheimer.cs index e46214af..b9de337a 100644 --- a/KruacentExiled/KE.CustomRoles/CR/Human/Alzheimer.cs +++ b/KruacentExiled/KE.CustomRoles/CR/Human/Alzheimer.cs @@ -29,6 +29,10 @@ protected override void RoleAdded(Player player) protected override void RoleRemoved(Player player) { + if (!_coroutines.ContainsKey(player)) return; + + + Timing.KillCoroutines(_coroutines[player]); _coroutines.Remove(player); } diff --git a/KruacentExiled/KE.CustomRoles/CR/Human/Maladroit.cs b/KruacentExiled/KE.CustomRoles/CR/Human/Maladroit.cs index 6fcd061b..81ea4a7f 100644 --- a/KruacentExiled/KE.CustomRoles/CR/Human/Maladroit.cs +++ b/KruacentExiled/KE.CustomRoles/CR/Human/Maladroit.cs @@ -35,6 +35,7 @@ protected override void RoleAdded(Player player) protected override void RoleRemoved(Player player) { + if (!_coroutines.ContainsKey(player)) return; Timing.KillCoroutines(_coroutines[player]); _coroutines.Remove(player); } diff --git a/KruacentExiled/KE.CustomRoles/CR/SCP/SCP457.cs b/KruacentExiled/KE.CustomRoles/CR/SCP/SCP457.cs index ce66c57e..3481c6e0 100644 --- a/KruacentExiled/KE.CustomRoles/CR/SCP/SCP457.cs +++ b/KruacentExiled/KE.CustomRoles/CR/SCP/SCP457.cs @@ -11,7 +11,6 @@ using MEC; using PlayerRoles; using PlayerStatsSystem; -using System; using System.Collections.Generic; using System.Linq; using UnityEngine; @@ -23,6 +22,7 @@ namespace KE.CustomRoles.CR.SCP public class SCP457 : KECustomRole, ISCPPreferences { + public override string Description { get; set; } = ""; public override uint Id { get; set; } = 1084; public override string PublicName { get; set; } = "SCP-457"; @@ -34,23 +34,25 @@ public class SCP457 : KECustomRole, ISCPPreferences public override float SpawnChance { get; set; } = 100; - private Dictionary _inside = new(); + private Dictionary _inside = new(); private Dictionary> _handles = new(); + private Dictionary _activeBalls = new(); - public static float LightRefreshRate = .1f; public static float DamageRefreshRate = 5f; public static readonly Color FlameColor = new(2, 1.08f, 0); private static readonly Color ballColor = new(2, 1.08f, 0, .25f); public static readonly float VigorCost = .1f; private static readonly string _deathMessage = "Burned to death"; - public static CustomReasonDamageHandler BallDamage = new (_deathMessage, 25, string.Empty); + public static CustomReasonDamageHandler BallDamage = new(_deathMessage, 25, string.Empty); + public const int MAX_BALLS = 2; protected override void RoleAdded(Player player) { Log.Debug("adding role 457"); _inside.Add(player, null); _handles.Add(player, new()); + _activeBalls.Add(player, 0); _handles[player].Add(Timing.RunCoroutine(InsideLight(player))); _handles[player].Add(Timing.RunCoroutine(PassiveDamage(player))); @@ -68,7 +70,7 @@ private IEnumerator InsideLight(Player player) { light.Position = player.Position; PassiveDamage(player); - yield return Timing.WaitForSeconds(LightRefreshRate); + yield return Timing.WaitForOneFrame; } } @@ -86,7 +88,7 @@ private IEnumerator PassiveDamage(Player scp) { Physics.Linecast(allP.Position, scp.Position, out var hitinfo); - float damage = -(hitinfo.distance/3)+10; + float damage = -(hitinfo.distance / 3) + 10; Log.Debug($"damâge={damage} dist = {hitinfo.distance}"); allP.EnableEffect(Exiled.API.Enums.EffectType.Burned, DamageRefreshRate, true); allP.Hurt(damage, _deathMessage); @@ -96,7 +98,7 @@ private IEnumerator PassiveDamage(Player scp) } yield return Timing.WaitForSeconds(DamageRefreshRate); } - + } protected override void RoleRemoved(Player player) @@ -104,35 +106,42 @@ protected override void RoleRemoved(Player player) Log.Debug("remove role 457"); - if(_inside.TryGetValue(player,out var l)) + if (_inside.TryGetValue(player, out var l)) { l.Destroy(); _inside.Remove(player); } + if (_activeBalls.TryGetValue(player, out var b)) + { + _activeBalls.Remove(player); + } + + - - if(_handles.TryGetValue(player,out var handle)) + + if (_handles.TryGetValue(player, out var handle)) { - foreach(var c in handle) + foreach (var c in handle) { Timing.KillCoroutines(c); } _handles.Remove(player); } - + } private void Attack(Player player, Scp106Role role) { - if (role.Vigor > VigorCost) + if (role.Vigor > VigorCost && _activeBalls[player] < MAX_BALLS) { + _activeBalls[player]++; Timing.RunCoroutine(LaunchingAttack(player)); role.Vigor -= VigorCost; } - + } private IEnumerator LaunchingAttack(Player player) @@ -142,13 +151,16 @@ private IEnumerator LaunchingAttack(Player player) Log.Debug(direction.eulerAngles); - bool attackTouchedSomething =false; - + bool attackTouchedSomething = false; + Light light = Light.Create(initpos, direction.eulerAngles,null,false); + light.Color = ballColor; + light.Intensity = 1f; Primitive primitive = Primitive.Create(initpos, direction.eulerAngles, null, false); primitive.Collidable = false; primitive.Color = ballColor; primitive.Spawn(); + light.Spawn(); Vector3 nextPos; int fallback = 100; @@ -157,34 +169,42 @@ private IEnumerator LaunchingAttack(Player player) nextPos = primitive.Position + primitive.Rotation * new Vector3(0, 0, 1f); RaycastHit hit; - if (UnityEngine.Physics.Linecast(primitive.Position, nextPos, out hit)) + if (Physics.Linecast(primitive.Position, nextPos, out hit)) { - attackTouchedSomething = true; + //spawn mtf looking at central gate + if (hit.collider.gameObject.name != "VolumeOverrideTunnel") + { + attackTouchedSomething = true; + } + Player playerhit = Player.Get(hit.collider); - if(playerhit != null && playerhit.Role.Side != Exiled.API.Enums.Side.Scp) + if (playerhit != null && playerhit.Role.Side != Exiled.API.Enums.Side.Scp) { playerhit.Hurt(BallDamage); player.ShowHitMarker(); - + } Door doorhit = Door.Get(hit.collider.gameObject); - if(doorhit != null && doorhit is IDamageableDoor damageable && !damageable.IsDestroyed) + if (doorhit != null && doorhit is IDamageableDoor damageable && !damageable.IsDestroyed) { damageable.Break(); player.ShowHitMarker(); } } - - + + Log.Debug($"current pos = {primitive.Position} next pos = {nextPos}"); yield return Timing.WaitForSeconds(.1f); primitive.Position = nextPos; + light.Position = nextPos; fallback--; } + _activeBalls[player]--; primitive.Destroy(); + light.Destroy(); } @@ -192,8 +212,8 @@ private void OnStalking(StalkingEventArgs ev) { if (!Check(ev.Player)) return; ev.IsAllowed = false; - - Attack(ev.Player,ev.Scp106); + + Attack(ev.Player, ev.Scp106); } private void OnTP(TeleportingEventArgs ev) @@ -206,7 +226,7 @@ private void OnTP(TeleportingEventArgs ev) private void OnAttacking(AttackingEventArgs ev) { ev.IsAllowed = false; - + } protected override void SubscribeEvents() @@ -215,7 +235,7 @@ protected override void SubscribeEvents() Exiled.Events.Handlers.Scp106.Teleporting += OnTP; Exiled.Events.Handlers.Scp106.Attacking += OnAttacking; base.SubscribeEvents(); - + } protected override void UnsubscribeEvents() diff --git a/KruacentExiled/KE.CustomRoles/CR/SCP/Ultra.cs b/KruacentExiled/KE.CustomRoles/CR/SCP/Ultra.cs index 932f2ed7..8be0a51e 100644 --- a/KruacentExiled/KE.CustomRoles/CR/SCP/Ultra.cs +++ b/KruacentExiled/KE.CustomRoles/CR/SCP/Ultra.cs @@ -39,7 +39,7 @@ protected override void RoleRemoved(Player player) private IEnumerator DisplayInfos(Player player) { - + while (true) { Log.Debug("Ultra : showing"); @@ -53,7 +53,7 @@ private string PlayerInZone() { string result = $""; int nbPlayer; - foreach(ZoneType zone in Enum.GetValues(typeof(ZoneType))) + foreach (ZoneType zone in Enum.GetValues(typeof(ZoneType))) { nbPlayer = GetPlayerInZone(zone); if (nbPlayer > 0 || MainPlugin.Instance.Config.Debug) diff --git a/KruacentExiled/KE.CustomRoles/KE.CustomRoles.csproj b/KruacentExiled/KE.CustomRoles/KE.CustomRoles.csproj index 081c2e42..3cb11af8 100644 --- a/KruacentExiled/KE.CustomRoles/KE.CustomRoles.csproj +++ b/KruacentExiled/KE.CustomRoles/KE.CustomRoles.csproj @@ -19,6 +19,7 @@ + From 0efb580dd34849ee1a8c589b1407d3b02a8758af Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Wed, 2 Jul 2025 13:45:38 +0200 Subject: [PATCH 295/853] did some model stuff probably gonna scrap that ngl --- .../KE.Utils/API/Interfaces/ILoadable.cs | 13 ++ .../KE.Utils/API/Models/Arrows/Arrow.cs | 58 +++++++ .../KE.Utils/API/Models/Arrows/MoveArrow.cs | 12 ++ .../KE.Utils/API/Models/Arrows/RotateArrow.cs | 12 ++ .../KE.Utils/API/Models/Arrows/ScaleArrow.cs | 12 ++ .../KE.Utils/API/Models/Arrows/XArrow.cs | 16 ++ .../KE.Utils/API/Models/Arrows/YArrow.cs | 16 ++ .../KE.Utils/API/Models/Arrows/ZArrow.cs | 16 ++ .../Models/Blueprints/AdminToyBlueprint.cs | 68 ++++++++ .../API/Models/Blueprints/LightBlueprint.cs | 37 ++++ .../API/Models/Blueprints/ModelBlueprint.cs | 122 +++++++++++++ .../Models/Blueprints/PrimitiveBlueprint.cs | 41 +++++ .../API/Models/Commands/ChangeColor.cs | 72 ++++++++ .../API/Models/Commands/ChangePrimType.cs | 53 ++++++ .../API/Models/Commands/CreateModel.cs | 4 +- .../API/Models/Commands/CreatePrim.cs | 47 +++++ .../KE.Utils/API/Models/Commands/ListModel.cs | 10 +- .../KE.Utils/API/Models/Commands/LoadModel.cs | 56 ++++++ .../API/Models/Commands/SelectModel.cs | 20 ++- .../API/Models/Commands/ShowCenter.cs | 2 +- KruacentExiled/KE.Utils/API/Models/Model.cs | 156 ++++++++++++----- .../KE.Utils/API/Models/ModelCreator.cs | 79 ++++++--- .../KE.Utils/API/Models/ModelLoader.cs | 100 ++++++----- .../KE.Utils/API/Models/MovementHandler.cs | 160 ++++++++++++++++-- .../KE.Utils/API/Models/SelectedModel.cs | 55 ++---- KruacentExiled/KE.Utils/KE.Utils.csproj | 10 +- KruacentExiled/Map/Command.cs | 46 +++++ KruacentExiled/Map/MainPlugin.cs | 10 +- .../Map/{ => Others}/EasterEggs/Capybaras.cs | 0 .../{ => Others}/EasterEggs/SpinnyBaras.cs | 0 30 files changed, 1128 insertions(+), 175 deletions(-) create mode 100644 KruacentExiled/KE.Utils/API/Interfaces/ILoadable.cs create mode 100644 KruacentExiled/KE.Utils/API/Models/Arrows/Arrow.cs create mode 100644 KruacentExiled/KE.Utils/API/Models/Arrows/MoveArrow.cs create mode 100644 KruacentExiled/KE.Utils/API/Models/Arrows/RotateArrow.cs create mode 100644 KruacentExiled/KE.Utils/API/Models/Arrows/ScaleArrow.cs create mode 100644 KruacentExiled/KE.Utils/API/Models/Arrows/XArrow.cs create mode 100644 KruacentExiled/KE.Utils/API/Models/Arrows/YArrow.cs create mode 100644 KruacentExiled/KE.Utils/API/Models/Arrows/ZArrow.cs create mode 100644 KruacentExiled/KE.Utils/API/Models/Blueprints/AdminToyBlueprint.cs create mode 100644 KruacentExiled/KE.Utils/API/Models/Blueprints/LightBlueprint.cs create mode 100644 KruacentExiled/KE.Utils/API/Models/Blueprints/ModelBlueprint.cs create mode 100644 KruacentExiled/KE.Utils/API/Models/Blueprints/PrimitiveBlueprint.cs create mode 100644 KruacentExiled/KE.Utils/API/Models/Commands/ChangeColor.cs create mode 100644 KruacentExiled/KE.Utils/API/Models/Commands/ChangePrimType.cs create mode 100644 KruacentExiled/KE.Utils/API/Models/Commands/CreatePrim.cs create mode 100644 KruacentExiled/KE.Utils/API/Models/Commands/LoadModel.cs create mode 100644 KruacentExiled/Map/Command.cs rename KruacentExiled/Map/{ => Others}/EasterEggs/Capybaras.cs (100%) rename KruacentExiled/Map/{ => Others}/EasterEggs/SpinnyBaras.cs (100%) diff --git a/KruacentExiled/KE.Utils/API/Interfaces/ILoadable.cs b/KruacentExiled/KE.Utils/API/Interfaces/ILoadable.cs new file mode 100644 index 00000000..c9e00399 --- /dev/null +++ b/KruacentExiled/KE.Utils/API/Interfaces/ILoadable.cs @@ -0,0 +1,13 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace KE.Utils.API.Interfaces +{ + public interface ILoadable + { + public string Loadable(char separator); + } +} diff --git a/KruacentExiled/KE.Utils/API/Models/Arrows/Arrow.cs b/KruacentExiled/KE.Utils/API/Models/Arrows/Arrow.cs new file mode 100644 index 00000000..990999c7 --- /dev/null +++ b/KruacentExiled/KE.Utils/API/Models/Arrows/Arrow.cs @@ -0,0 +1,58 @@ +using Exiled.API.Features.Toys; +using InventorySystem.Items.Keycards; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Net.Sockets; +using System.Text; +using System.Threading.Tasks; +using UnityEngine; + +namespace KE.Utils.API.Models.Arrows +{ + internal abstract class Arrow + { + internal static HashSet List = new(); + internal abstract Vector3 Offset { get; } + internal abstract Vector3 Rotation { get; } + internal abstract Color Color { get; } + + protected readonly Vector3 scale = new Vector3(1f, .1f, .1f); + + private Primitive _primitive; + + internal Primitive Primitive + { + get { return _primitive; } + } + internal Arrow() + { + List.Add(this); + _primitive = Primitive.Create(PrimitiveType.Cube, null, Rotation, scale); + _primitive.Color = Color; + } + + internal void Move(Vector3 newPos) + { + _primitive.Position = newPos + Offset; + } + + internal static bool IsPrimitiveArrow(Primitive p) + { + Arrow a =GetArrow(p); + return a != null; + } + + internal static Arrow GetArrow(Primitive p) + { + + foreach(Arrow a in List) + { + if (p == a.Primitive) + return a; + } + return null; + + } + } +} diff --git a/KruacentExiled/KE.Utils/API/Models/Arrows/MoveArrow.cs b/KruacentExiled/KE.Utils/API/Models/Arrows/MoveArrow.cs new file mode 100644 index 00000000..f3216e7f --- /dev/null +++ b/KruacentExiled/KE.Utils/API/Models/Arrows/MoveArrow.cs @@ -0,0 +1,12 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace KE.Utils.API.Models.Arrows +{ + internal class MoveArrow + { + } +} diff --git a/KruacentExiled/KE.Utils/API/Models/Arrows/RotateArrow.cs b/KruacentExiled/KE.Utils/API/Models/Arrows/RotateArrow.cs new file mode 100644 index 00000000..518fb4b5 --- /dev/null +++ b/KruacentExiled/KE.Utils/API/Models/Arrows/RotateArrow.cs @@ -0,0 +1,12 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace KE.Utils.API.Models.Arrows +{ + internal class RotateArrow + { + } +} diff --git a/KruacentExiled/KE.Utils/API/Models/Arrows/ScaleArrow.cs b/KruacentExiled/KE.Utils/API/Models/Arrows/ScaleArrow.cs new file mode 100644 index 00000000..99bf7d55 --- /dev/null +++ b/KruacentExiled/KE.Utils/API/Models/Arrows/ScaleArrow.cs @@ -0,0 +1,12 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace KE.Utils.API.Models.Arrows +{ + internal class ScaleArrow + { + } +} diff --git a/KruacentExiled/KE.Utils/API/Models/Arrows/XArrow.cs b/KruacentExiled/KE.Utils/API/Models/Arrows/XArrow.cs new file mode 100644 index 00000000..073802c3 --- /dev/null +++ b/KruacentExiled/KE.Utils/API/Models/Arrows/XArrow.cs @@ -0,0 +1,16 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using UnityEngine; + +namespace KE.Utils.API.Models.Arrows +{ + internal class XArrow : Arrow + { + internal override Vector3 Offset => new Vector3(scale.x / 2,0); + internal override Vector3 Rotation => new Vector3(0, 0f, 0f); + internal override Color Color => Color.red; + } +} diff --git a/KruacentExiled/KE.Utils/API/Models/Arrows/YArrow.cs b/KruacentExiled/KE.Utils/API/Models/Arrows/YArrow.cs new file mode 100644 index 00000000..e437766e --- /dev/null +++ b/KruacentExiled/KE.Utils/API/Models/Arrows/YArrow.cs @@ -0,0 +1,16 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using UnityEngine; + +namespace KE.Utils.API.Models.Arrows +{ + internal class YArrow : Arrow + { + internal override Vector3 Offset => new Vector3(0, scale.x / 2); + internal override Vector3 Rotation => new Vector3(0, 0f, 90f); + internal override Color Color => Color.green; + } +} diff --git a/KruacentExiled/KE.Utils/API/Models/Arrows/ZArrow.cs b/KruacentExiled/KE.Utils/API/Models/Arrows/ZArrow.cs new file mode 100644 index 00000000..30c27866 --- /dev/null +++ b/KruacentExiled/KE.Utils/API/Models/Arrows/ZArrow.cs @@ -0,0 +1,16 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using UnityEngine; + +namespace KE.Utils.API.Models.Arrows +{ + internal class ZArrow : Arrow + { + internal override Vector3 Offset => new Vector3(0,0, scale.x / 2); + internal override Vector3 Rotation => new Vector3(0, 90f, 0); + internal override Color Color => Color.blue; + } +} diff --git a/KruacentExiled/KE.Utils/API/Models/Blueprints/AdminToyBlueprint.cs b/KruacentExiled/KE.Utils/API/Models/Blueprints/AdminToyBlueprint.cs new file mode 100644 index 00000000..6cd11e0e --- /dev/null +++ b/KruacentExiled/KE.Utils/API/Models/Blueprints/AdminToyBlueprint.cs @@ -0,0 +1,68 @@ +using Exiled.API.Enums; +using Exiled.API.Features.Toys; +using Exiled.API.Interfaces; +using KE.Utils.API.Interfaces; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using UnityEngine; +using Light = Exiled.API.Features.Toys.Light; + +namespace KE.Utils.API.Models.Blueprints +{ + public abstract class AdminToyBlueprint : ILoadable + { + public AdminToyType AdminToyType { get; protected set; } + //local position + public Vector3 Position { get; protected set; } + public Vector3 Rotation { get; protected set; } + public Vector3 Scale { get; protected set; } + + + public static AdminToyBlueprint Create(AdminToy adminToy,Vector3 center) + { + AdminToyBlueprint result; + + + if (adminToy.ToyType == AdminToyType.PrimitiveObject) + { + result = new PrimitiveBlueprint(adminToy as Primitive); + } + else if(adminToy.ToyType == AdminToyType.LightSource) + { + result = new LightBlueprint(adminToy as Light); + } + else + { + throw new NotImplementedException("only primitive and light"); + } + + result.Position = adminToy.Position - center; + result.Rotation = adminToy.Rotation.eulerAngles; + + return result; + } + + + public string Loadable(char separator) + { + StringBuilder b = new(); + b.Append(AdminToyType.ToString()); + b.Append(separator); + b.Append(Position); + b.Append(separator); + b.Append(Rotation); + b.Append(separator); + b.Append(Scale); + b.Append(separator); + b.Append(Load(separator)); + + + return b.ToString(); + } + public abstract AdminToy Spawn(Vector3 center); + protected abstract string Load(char separator); + } +} diff --git a/KruacentExiled/KE.Utils/API/Models/Blueprints/LightBlueprint.cs b/KruacentExiled/KE.Utils/API/Models/Blueprints/LightBlueprint.cs new file mode 100644 index 00000000..1dc91294 --- /dev/null +++ b/KruacentExiled/KE.Utils/API/Models/Blueprints/LightBlueprint.cs @@ -0,0 +1,37 @@ +using Exiled.API.Enums; +using Exiled.API.Features.Toys; +using UnityEngine; +using Light = Exiled.API.Features.Toys.Light; + +namespace KE.Utils.API.Models.Blueprints +{ + public class LightBlueprint : AdminToyBlueprint + { + public Color Color { get; } + public float Intensity { get; } + + public LightBlueprint(Light l) + { + AdminToyType = AdminToyType.PrimitiveObject; + Scale = l.Scale; + Color = l.Color; + Intensity = l.Intensity; + } + + + public override AdminToy Spawn(Vector3 center) + { + var l = Light.Create(Position+center, Rotation, Scale, false); + l.Color = Color; + l.Intensity = Intensity; + + + return l; + } + + protected override string Load(char separator) + { + return "#" + ColorUtility.ToHtmlStringRGBA(Color) + separator + Intensity; + } + } +} diff --git a/KruacentExiled/KE.Utils/API/Models/Blueprints/ModelBlueprint.cs b/KruacentExiled/KE.Utils/API/Models/Blueprints/ModelBlueprint.cs new file mode 100644 index 00000000..30a0e7b8 --- /dev/null +++ b/KruacentExiled/KE.Utils/API/Models/Blueprints/ModelBlueprint.cs @@ -0,0 +1,122 @@ +using Exiled.API.Features; +using Exiled.API.Features.Core; +using Exiled.API.Features.Doors; +using Exiled.API.Features.Toys; +using Exiled.API.Structs; +using KE.Utils.API.Models.ToysSettings; +using KE.Utils.Quality.Models; +using System.Collections.Generic; +using System.Linq; +using System.Runtime.InteropServices; +using UnityEngine; +using Light = Exiled.API.Features.Toys.Light; + +namespace KE.Utils.API.Models.Blueprints +{ + public class ModelBlueprint + { + private static List _bps = new(); + public static List Blueprints => _bps.ToList(); + private HashSet _toys = new(); + public IReadOnlyCollection Toys => [.. _toys]; + private string _name; + public string Name + { + get { return _name; } + } + + private int _id; + public int Id + { + get { return _id; } + } + + private ModelBlueprint() { } + + + + /// + /// + /// + /// + /// if > 0 overwrite same id bp + /// + public static ModelBlueprint Create(Model model, int id = -1) + { + if(id != -1) + { + + var oldMbp = Get(id); + _bps.Remove(oldMbp); + } + + + ModelBlueprint mbp = new(); + _bps.Add(mbp); + mbp._id = _bps.Count; + + foreach(AdminToy toy in model.Toys) + { + mbp._toys.Add(AdminToyBlueprint.Create(toy,model.Center)); + } + + return mbp; + } + + + public static ModelBlueprint Create(string name) + { + ModelBlueprint mbp = new(); + _bps.Add(mbp); + mbp._id = _bps.Count; + + if (string.IsNullOrEmpty(name)) + { + mbp._name = "Model" + mbp.Id; + } + else + { + mbp._name = name; + } + + return mbp; + } + + + #region getters + public static ModelBlueprint Get(string name) + { + foreach (ModelBlueprint m in _bps) + { + if (m.Name == name) + { + return m; + } + } + return null; + } + + + public static ModelBlueprint Get(int id) + { + foreach (ModelBlueprint m in _bps) + { + if (m.Id == id) + return m; + } + return null; + } + public static bool TryGet(int id, out ModelBlueprint model) + { + model = Get(id); + return model != null; + } + + public static bool TryGet(string name, out ModelBlueprint model) + { + model = Get(name); + return model != null; + } + #endregion + } +} diff --git a/KruacentExiled/KE.Utils/API/Models/Blueprints/PrimitiveBlueprint.cs b/KruacentExiled/KE.Utils/API/Models/Blueprints/PrimitiveBlueprint.cs new file mode 100644 index 00000000..8308ba39 --- /dev/null +++ b/KruacentExiled/KE.Utils/API/Models/Blueprints/PrimitiveBlueprint.cs @@ -0,0 +1,41 @@ +using Exiled.API.Enums; +using Exiled.API.Features.Toys; +using UnityEngine; + +namespace KE.Utils.API.Models.Blueprints +{ + public class PrimitiveBlueprint : AdminToyBlueprint + { + public Color Color { get; } + public PrimitiveType Type { get; } + public bool Collidable { get; } + + + public PrimitiveBlueprint(Primitive p) + { + AdminToyType = AdminToyType.PrimitiveObject; + + Scale = p.Scale; + Color = p.Color; + Type = p.Type; + Collidable = p.Collidable; + } + + + + public override AdminToy Spawn(Vector3 center) + { + var p = Primitive.Create(Type,Position+center, Rotation, Scale, false); + p.Collidable = Collidable; + p.Color = Color; + + + return p; + } + + protected override string Load(char separator) + { + return "#" + ColorUtility.ToHtmlStringRGBA(Color) + separator+Type+separator+Collidable; + } + } +} diff --git a/KruacentExiled/KE.Utils/API/Models/Commands/ChangeColor.cs b/KruacentExiled/KE.Utils/API/Models/Commands/ChangeColor.cs new file mode 100644 index 00000000..3b78d218 --- /dev/null +++ b/KruacentExiled/KE.Utils/API/Models/Commands/ChangeColor.cs @@ -0,0 +1,72 @@ +using CommandSystem; +using Exiled.API.Features; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using KE.Utils.API.Models; +using UnityEngine; +using Exiled.API.Features.Toys; + +namespace KE.Utils.API.Models.Commands +{ + public class ChangeColor : ICommand + { + + public string Command { get; } = "changecolor"; + + public string[] Aliases { get; } = { "cc" }; + + public string Description { get; } = "change color rgba (0-255)"; + + public bool Execute(ArraySegment arguments, ICommandSender sender, out string response) + { + Player p = Player.Get(sender); + if (p == null) + { + response = "This player can't do this command"; + return false; + } + + if (arguments.Count < 3) + { + response = "not enough arguments"; + return false; + } + if(!byte.TryParse(arguments.At(0),out byte r) || + !byte.TryParse(arguments.At(1), out byte g) || + !byte.TryParse(arguments.At(2), out byte b)) + { + response = "number between 0 & 255"; + return false; + } + + Color32 c; + + if(arguments.Count > 3 && byte.TryParse(arguments.At(3),out byte a)) + { + c = new Color32(r, g, b, a); + } + else + { + c = new Color32(r, g, b,255); + } + + Primitive prim = Models.Instance.ModelCreator.ModelHandler.SelectedPrimitive; + + if(prim == null) + { + response = "no primitive selected"; + return false; + } + + prim.Color = c; + + + response = $"new color set to " + c.ToString(); + return true; + } + + } +} diff --git a/KruacentExiled/KE.Utils/API/Models/Commands/ChangePrimType.cs b/KruacentExiled/KE.Utils/API/Models/Commands/ChangePrimType.cs new file mode 100644 index 00000000..434427df --- /dev/null +++ b/KruacentExiled/KE.Utils/API/Models/Commands/ChangePrimType.cs @@ -0,0 +1,53 @@ +using CommandSystem; +using Exiled.API.Features; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using KE.Utils.API.Models; +using UnityEngine; + +namespace KE.Utils.API.Models.Commands +{ + public class ChangePrimType : ICommand + { + + public string Command { get; } = "changeprimtype"; + + public string[] Aliases { get; } = { "cpt" }; + + public string Description { get; } = "select the mode : scale,move,rotate"; + + public bool Execute(ArraySegment arguments, ICommandSender sender, out string response) + { + Player p = Player.Get(sender); + if (p == null) + { + response = "This player can't do this command"; + return false; + } + + if (arguments.Count < 1) + { + response = "not enough arguments"; + return false; + } + string type = arguments.At(0); + + + if(!Enum.TryParse(type, out PrimitiveType prim)) + { + response = "wrong argument"; + return false; + } + + + Models.Instance.ModelCreator.ModelHandler.SelectedPrimitive.Type = prim; + + response = $"Mode set to " + prim ; + return true; + } + + } +} diff --git a/KruacentExiled/KE.Utils/API/Models/Commands/CreateModel.cs b/KruacentExiled/KE.Utils/API/Models/Commands/CreateModel.cs index fca48749..d549cb50 100644 --- a/KruacentExiled/KE.Utils/API/Models/Commands/CreateModel.cs +++ b/KruacentExiled/KE.Utils/API/Models/Commands/CreateModel.cs @@ -1,6 +1,5 @@ using CommandSystem; using Exiled.API.Features; -using KE.Utils.API.Models; using System; using System.Collections.Generic; using System.Linq; @@ -36,7 +35,8 @@ public bool Execute(ArraySegment arguments, ICommandSender sender, out s string name = arguments.At(0); Model m = Model.Create(p.Position, name); - response = $"Created model ({m.Name}) at {m.Center}"; + Models.Instance.ModelCreator.ModelHandler.SelectedModel = m; + response = $"Created & selected model ({m.Name}) at {m.Center}"; return true; } diff --git a/KruacentExiled/KE.Utils/API/Models/Commands/CreatePrim.cs b/KruacentExiled/KE.Utils/API/Models/Commands/CreatePrim.cs new file mode 100644 index 00000000..edcd6306 --- /dev/null +++ b/KruacentExiled/KE.Utils/API/Models/Commands/CreatePrim.cs @@ -0,0 +1,47 @@ +using CommandSystem; +using Exiled.API.Features; +using Exiled.API.Features.Toys; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace KE.Utils.API.Models.Commands +{ + public class CreatePrim : ICommand + { + + public string Command { get; } = "createprimitive"; + + public string[] Aliases { get; } = { "cp" }; //no not like that + + public string Description { get; } = "create a new primitive at your position"; + + public bool Execute(ArraySegment arguments, ICommandSender sender, out string response) + { + + Player p = Player.Get(sender); + if (p == null) + { + response = "This player can't do this command"; + return false; + } + + + Model m = Models.Instance.ModelCreator.SelectedModel; + + if (m == null) + { + response = "no model selected"; + return false; + } + m.Add(p.Position); + + + response = "created!"; + return true; + } + + } +} diff --git a/KruacentExiled/KE.Utils/API/Models/Commands/ListModel.cs b/KruacentExiled/KE.Utils/API/Models/Commands/ListModel.cs index f78b78c1..5a271bd6 100644 --- a/KruacentExiled/KE.Utils/API/Models/Commands/ListModel.cs +++ b/KruacentExiled/KE.Utils/API/Models/Commands/ListModel.cs @@ -1,11 +1,11 @@ using CommandSystem; using Exiled.API.Features; +using KE.Utils.API.Models.Blueprints; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; -using KE.Utils.API.Models; namespace KE.Utils.API.Models.Commands { @@ -24,7 +24,13 @@ public bool Execute(ArraySegment arguments, ICommandSender sender, out s b.AppendLine($"Models ({Model.Models.Count}) :"); foreach (Model m in Model.Models) { - b.AppendLine($"({m.Id}) - {m.Name} pos: {m.Id}"); + b.AppendLine($"({m.Id}) - {m.Name} pos: {m.Center} spawned? :{m.Spawned}"); + } + + b.AppendLine($"Blueprints ({ModelBlueprint.Blueprints.Count}) :"); + foreach (ModelBlueprint m in ModelBlueprint.Blueprints) + { + b.AppendLine($"({m.Id}) - {m.Name}"); } diff --git a/KruacentExiled/KE.Utils/API/Models/Commands/LoadModel.cs b/KruacentExiled/KE.Utils/API/Models/Commands/LoadModel.cs new file mode 100644 index 00000000..88d4b40a --- /dev/null +++ b/KruacentExiled/KE.Utils/API/Models/Commands/LoadModel.cs @@ -0,0 +1,56 @@ +using CommandSystem; +using Exiled.API.Features; +using KE.Utils.API.Models.Blueprints; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace KE.Utils.API.Models.Commands +{ + public class LoadModel : ICommand + { + + public string Command { get; } = "load"; + + public string[] Aliases { get; } = { "lo" }; + + public string Description { get; } = "load a model"; + + public bool Execute(ArraySegment arguments, ICommandSender sender, out string response) + { + + Player p = Player.Get(sender); + if (p == null) + { + response = "This player can't do this command"; + return false; + } + + if (arguments.Count < 1) + { + response = "not enough arguments"; + return false; + } + + if (!int.TryParse(arguments.At(0),out int id)) + { + response = "enter id"; + return false; + } + + if(!ModelBlueprint.TryGet(id,out var mbp)) + { + response = "blueprint not found"; + return false; + } + + var m =Model.Create(mbp, p.Position); + + response = $"Created model ({m.Name}) at {m.Center}"; + return true; + } + + } +} diff --git a/KruacentExiled/KE.Utils/API/Models/Commands/SelectModel.cs b/KruacentExiled/KE.Utils/API/Models/Commands/SelectModel.cs index d6656829..189ef2fe 100644 --- a/KruacentExiled/KE.Utils/API/Models/Commands/SelectModel.cs +++ b/KruacentExiled/KE.Utils/API/Models/Commands/SelectModel.cs @@ -5,7 +5,6 @@ using System.Linq; using System.Text; using System.Threading.Tasks; -using KE.Utils.API.Models; namespace KE.Utils.API.Models.Commands { @@ -16,7 +15,7 @@ public class SelectModel : ICommand public string[] Aliases { get; } = { "s" }; - public string Description { get; } = "select an existing"; + public string Description { get; } = "select an existing model"; public bool Execute(ArraySegment arguments, ICommandSender sender, out string response) { @@ -27,14 +26,27 @@ public bool Execute(ArraySegment arguments, ICommandSender sender, out s response = "This player can't do this command"; return false; } + if (arguments.Count < 1) + { + response = "not enough arguments"; + return false; + } + if (!int.TryParse(arguments.At(0),out int id)) + { + response = "not an id"; + return false; + } + + + - if (!Model.TryGet(int.Parse(arguments.At(1)), out Model m)) + if (!Model.TryGet(id, out Model m)) { response = "model not found"; return false; } response = $"model ({m.Name}) selected {m.Center}"; - Models.Instance.ModelCreator.ModelSelected = m; + Models.Instance.ModelCreator.ModelHandler.SelectedModel = m; return true; } diff --git a/KruacentExiled/KE.Utils/API/Models/Commands/ShowCenter.cs b/KruacentExiled/KE.Utils/API/Models/Commands/ShowCenter.cs index 990f92d9..7b6cc05e 100644 --- a/KruacentExiled/KE.Utils/API/Models/Commands/ShowCenter.cs +++ b/KruacentExiled/KE.Utils/API/Models/Commands/ShowCenter.cs @@ -27,7 +27,7 @@ public bool Execute(ArraySegment arguments, ICommandSender sender, out s return false; } - Model m = Models.Instance.ModelCreator.ModelSelected; + Model m = Models.Instance.ModelCreator.ModelHandler.SelectedModel; if(m == null) { diff --git a/KruacentExiled/KE.Utils/API/Models/Model.cs b/KruacentExiled/KE.Utils/API/Models/Model.cs index 2cdcff18..f82c25c9 100644 --- a/KruacentExiled/KE.Utils/API/Models/Model.cs +++ b/KruacentExiled/KE.Utils/API/Models/Model.cs @@ -3,6 +3,7 @@ using Exiled.API.Features.Doors; using Exiled.API.Features.Toys; using Exiled.API.Structs; +using KE.Utils.API.Models.Blueprints; using KE.Utils.API.Models.ToysSettings; using System.Collections.Generic; using System.Linq; @@ -14,7 +15,7 @@ namespace KE.Utils.API.Models { public class Model { - private static List _models = new(1); + private static List _models = new(); public static List Models => _models.ToList(); private HashSet _toys = new(); @@ -36,6 +37,28 @@ public int Id { get { return _id; } } + private bool _spawned = true; + public bool Spawned + { + get { return _spawned; } + } + + private ModelBlueprint _blueprint; + + public ModelBlueprint Blueprint + { + get { return _blueprint; } + } + + public bool LoadedFromBlueprint + { + get + { + return Blueprint != null; + } + } + + internal Primitive centerPrim; @@ -43,24 +66,22 @@ public void SetCenterPrimitive(bool show) { if (show) { - centerPrim.UnSpawn(); + centerPrim.Spawn(); } else { - centerPrim.Spawn(); + centerPrim.UnSpawn(); } } - public void Add(Primitive p) + public Primitive Add(Vector3 pos) { + var p = Primitive.Create(pos, null, null, true); + AddToy(p); - - } - public void Add(Light l) - { - AddToy(l); + return p; } @@ -69,44 +90,26 @@ private void AddToy(AdminToy toy) _toys.Add(toy); } - public void Spawn() + private Model(Vector3 center) { - foreach(AdminToy t in Toys) - { - t.Spawn(); - } - } - public void UnSpawn() - { - foreach (AdminToy t in Toys) - { - t.UnSpawn(); - } + _center = center; } - public void Destroy() - { - foreach (AdminToy t in Toys) - { - t.Destroy(); - } - } - internal static Model Create(Vector3 position,IEnumerable toys, string name = "") + internal static Model Create(Vector3 position, IEnumerable toys, string name = "") { - var m =Model.Create(position, name); + var m = Create(position, name); m._toys = toys.ToHashSet(); return m; } - public static Model Create(Vector3 position, string name= "") + public static Model Create(Vector3 position, string name = "") { - - Model m = new(); + + Model m = new(position); _models.Add(m); m._id = _models.Count; - m._center = position; if (string.IsNullOrEmpty(name)) { m._name = "Model" + m.Id; @@ -117,18 +120,51 @@ public static Model Create(Vector3 position, string name= "") } Log.Debug("created model id=" + m.Id); - m.centerPrim = Primitive.Create(position, null, Vector3.one/5, true, new(1, 0, 0, .25f)); + m.centerPrim = Primitive.Create(position, null, Vector3.one / 5, true, new(1, 0, 0, .25f)); m.centerPrim.Collidable = false; return m; } + public static Model Create(ModelBlueprint blueprint,Vector3 position) + { + Model m = new(position); + m._id = _models.Count; + foreach (AdminToyBlueprint toy in blueprint.Toys) + { + m.AddToy(toy.Spawn(m.Center)); + } + + return m; + + } + + /// + /// Create a based of this

+ /// Note : will overwrite the old blueprint + ///
+ public void CreateBlueprint() + { + int oldId = -1; + if (LoadedFromBlueprint) + { + oldId = _blueprint.Id; + } + + ModelBlueprint bp = ModelBlueprint.Create(this, oldId); + + _blueprint = bp; + + } + + + #region getter public static Model Get(string name) { - foreach(Model m in _models) + foreach (Model m in _models) { - if(m.Name == name) + if (m.Name == name) { return m; } @@ -136,10 +172,15 @@ public static Model Get(string name) return null; } + public static Model Get(int id) { - _models.TryGet(id, out Model m); - return m; + foreach(Model m in _models) + { + if (m.Id == id) + return m; + } + return null; } public static bool TryGet(int id, out Model model) { @@ -147,10 +188,47 @@ public static bool TryGet(int id, out Model model) return model != null; } + public static bool TryGet(string name, out Model model) + { + model = Get(name); + return model != null; + } + public override string ToString() { return $"{Id} : {Name} center = {Center}"; } + #endregion + + #region spawn + public void Spawn() + { + foreach (AdminToy t in Toys) + { + t.Spawn(); + } + _spawned = true; + } + public void UnSpawn() + { + foreach (AdminToy t in Toys) + { + t.UnSpawn(); + } + _spawned = false; + } + + public void Destroy() + { + foreach (AdminToy t in Toys) + { + t.Destroy(); + } + _models.Remove(this); + + } + + #endregion } } diff --git a/KruacentExiled/KE.Utils/API/Models/ModelCreator.cs b/KruacentExiled/KE.Utils/API/Models/ModelCreator.cs index e9feef77..5aa1bb18 100644 --- a/KruacentExiled/KE.Utils/API/Models/ModelCreator.cs +++ b/KruacentExiled/KE.Utils/API/Models/ModelCreator.cs @@ -4,10 +4,12 @@ using Exiled.API.Features.Toys; using Exiled.Events.EventArgs.Player; using KE.Utils.API.Interfaces; +using KE.Utils.API.Models.Arrows; using MEC; using System; using System.Collections.Generic; using System.Linq; +using System.Runtime.InteropServices; using System.Text; using System.Threading.Tasks; using UnityEngine; @@ -20,7 +22,13 @@ public class ModelCreator : IUsingEvents public const ItemType item = ItemType.GunCOM18; - + public Model SelectedModel + { + get + { + return ModelHandler.SelectedModel; + } + } public MovementMode MovementMode { get @@ -32,14 +40,15 @@ public MovementMode MovementMode MovementHandler.Mode = value; } } - private MovementHandler MovementHandler; - private SelectedModel SelectedModel; + internal MovementHandler MovementHandler { get; private set; } + internal ModelSelection ModelHandler { get; private set; } private bool mode = false; private const float MAX_DISTANCE = 50; + public static event Action IsAiming; + public static event Action StoppedAiming; - public Model ModelSelected; public ModelCreator() @@ -50,26 +59,37 @@ public ModelCreator() public void SubscribeEvents() { - SelectedModel = new(); + ModelHandler = new(); MovementHandler = new(); MovementHandler.SubscribeEvents(); + Exiled.Events.Handlers.Server.WaitingForPlayers += OnWaitingForPlayers; Exiled.Events.Handlers.Player.DryfiringWeapon += OnDryfiringWeapon; Exiled.Events.Handlers.Player.TogglingWeaponFlashlight += OnTogglingWeaponFlashlight; - Exiled.Events.Handlers.Player.AimingDownSight += OnAimingDownSight; Exiled.Events.Handlers.Server.RoundStarted += Test; + Exiled.Events.Handlers.Player.AimingDownSight += OnAimingDownSight; } + private void OnWaitingForPlayers() + { + ModelLoader.LoadAll(); + } + private void Test() { foreach (var p in Player.List) { p.Role.Set(PlayerRoles.RoleTypeId.ChaosConscript); - var a = p.AddItem(item); - var b = a as Firearm; - b.MagazineAmmo = 2; - + Timing.CallDelayed(.1f, () => + { + var a = p.AddItem(item); + var b = a as Firearm; + b.MagazineAmmo = 2; + + Primitive.Create(p.Position + Vector3.back, null, null, true, Color.red); + Primitive.Create(p.Position + Vector3.forward, null, null, true, Color.green); + }); } } @@ -78,17 +98,26 @@ public void UnsubscribeEvents() { Exiled.Events.Handlers.Player.DryfiringWeapon -= OnDryfiringWeapon; Exiled.Events.Handlers.Player.TogglingWeaponFlashlight -= OnTogglingWeaponFlashlight; + Exiled.Events.Handlers.Server.WaitingForPlayers -= OnWaitingForPlayers; Exiled.Events.Handlers.Player.AimingDownSight -= OnAimingDownSight; Exiled.Events.Handlers.Server.RoundStarted -= Test; //Exiled.Events.Handlers.Player.Shooting -= OnShooting; MovementHandler.UnsubscribeEvents(); - SelectedModel = null; + ModelHandler = null; MovementHandler = null; } + private void OnAimingDownSight(AimingDownSightEventArgs ev) { - + if (ev.AdsIn) + { + IsAiming?.Invoke(ev.Player); + } + else + { + StoppedAiming?.Invoke(); + } } private void OnDryfiringWeapon(DryfiringWeaponEventArgs ev) @@ -98,8 +127,7 @@ private void OnDryfiringWeapon(DryfiringWeaponEventArgs ev) if (!mode) { - Primitive.Create(ev.Player.Position + Vector3.back, null, null, true, Color.red); - Primitive.Create(ev.Player.Position + Vector3.forward, null, null, true, Color.green); + mode = !mode; } @@ -110,24 +138,35 @@ private void OnDryfiringWeapon(DryfiringWeaponEventArgs ev) private void OnTogglingWeaponFlashlight(TogglingWeaponFlashlightEventArgs ev) { if (ev.Firearm.Type != item) return; - - Transform cam = ev.Player.CameraTransform; + Primitive p = GetFacingPrimitive(ev.Player); + if (!Arrow.IsPrimitiveArrow(p)) + { + ModelHandler.ChangedSelectedPrim(p); + } + + } + + internal static Primitive GetFacingPrimitive(Player player) + { + Transform cam = player.CameraTransform; + Vector3 origin = cam.position + cam.forward * 0.5f; Ray r = new Ray(origin, cam.forward); if (Physics.Raycast(r, out RaycastHit hit, MAX_DISTANCE)) { Log.Info($"hit ({hit.collider.name})"); PrimitiveObjectToy pot = hit.collider.GetComponentInParent() ?? hit.collider.GetComponentInChildren(); - if(pot != null) + if (pot != null) { - Primitive p = Primitive.Get(pot); - SelectedModel.ChangedSelectedPrim(p); + return Primitive.Get(pot); + + } } - + return null; } diff --git a/KruacentExiled/KE.Utils/API/Models/ModelLoader.cs b/KruacentExiled/KE.Utils/API/Models/ModelLoader.cs index 40234c4c..3034ee16 100644 --- a/KruacentExiled/KE.Utils/API/Models/ModelLoader.cs +++ b/KruacentExiled/KE.Utils/API/Models/ModelLoader.cs @@ -8,30 +8,52 @@ using UnityEngine; using Light = Exiled.API.Features.Toys.Light; using Exiled.API.Enums; +using KE.Utils.API.Models.Blueprints; namespace KE.Utils.API.Models { public static class ModelLoader { public static string Path => Paths.Configs + @"\"; private static readonly char SEPARATOR = '_'; + public static string Extension => ".modelscpsl"; - public static Model Load(string filename) + public static IEnumerable LoadAll() + { + List m = new(); + + string[] raw = Directory.GetFiles(Path, "*" + Extension); + + foreach (string d in raw) + { + Log.Info("loading="+d); + m.Add(Load(string.Empty,d)); + } + + return m; + } + + public static ModelBlueprint Load(string filename) { return Load(Path, filename); } - public static Model Load(string path,string filename) + public static ModelBlueprint Load(string path,string filename) { - - string[] raw = File.ReadAllText(path+ filename).Split('\n'); - string[] infoline = raw[0].Split(SEPARATOR); - foreach(string i in infoline) + string[] raw; + try + { + raw = File.ReadAllText(path + filename).Split('\n'); + } + catch(Exception e) { - Log.Info(i); + Log.Error(e); + return null; } + + + string[] infoline = raw[0].Split(SEPARATOR); string name = infoline[0]; - Vector3 center = Parser.Vector3(infoline[1]); List toys = new(); @@ -76,53 +98,47 @@ public static Model Load(string path,string filename) - return Model.Create(center, name); + return ModelBlueprint.Create(name); } - // Name.Center\nAdminToyType.ATPosition.ATRotationEuler.ATScale.LightPrimitiveColor.PrimitiveType.PrimitiveCollidable.LightIntensity\n and repeat - // - public static void Save(this Model m) + // Name\n + // Primitive.Position.RotationEuler.Scale.Color.PrimitiveType.Collidable\n + // Light.Position.RotationEuler.Scale.Color.Intensity\n + // and repeat + public static bool Save(this ModelBlueprint m) { - - StringBuilder b = new(); + List result = new(); - result.Add(m.Name+SEPARATOR+m.Center); + result.Add(m.Name+SEPARATOR); - foreach(AdminToy t in m.Toys) + foreach(AdminToyBlueprint t in m.Toys) { - b.Append(t.ToyType); - b.Append(SEPARATOR); - b.Append(t.Position); - b.Append(SEPARATOR); - b.Append(t.Rotation.eulerAngles); - b.Append(SEPARATOR); - b.Append(t.Scale); - b.Append(SEPARATOR); - - if (t is Primitive p) - { - b.Append("#"+ColorUtility.ToHtmlStringRGBA(p.Color)); - b.Append(SEPARATOR); - b.Append(p.Type); - b.Append(SEPARATOR); - b.Append(p.Collidable); - } - if(t is Light l) - { - b.Append("#" + ColorUtility.ToHtmlStringRGBA(l.Color)); - b.Append(SEPARATOR); - b.Append(l.Intensity); - } - result.Add(b.ToString()); - b.Clear(); + result.Add(t.Loadable(SEPARATOR)); } - File.WriteAllLines(Path + m.Id + ".modelscpsl", result); + try + { + File.WriteAllLines(Path + m.Id + Extension, result); + return true; + } + catch(Exception e) + { + Log.Error(e); + return false; + } + } + public static bool Save(this Model model) + { + if (!model.LoadedFromBlueprint) + model.CreateBlueprint(); + + return Save(model.Blueprint); + } } diff --git a/KruacentExiled/KE.Utils/API/Models/MovementHandler.cs b/KruacentExiled/KE.Utils/API/Models/MovementHandler.cs index 4fcec956..07e3ee18 100644 --- a/KruacentExiled/KE.Utils/API/Models/MovementHandler.cs +++ b/KruacentExiled/KE.Utils/API/Models/MovementHandler.cs @@ -1,5 +1,9 @@ -using Exiled.API.Features.Toys; +using Exiled.API.Features; +using Exiled.API.Features.Toys; +using Exiled.Events.EventArgs.Player; using KE.Utils.API.Interfaces; +using KE.Utils.API.Models.Arrows; +using MEC; using System; using System.Collections.Generic; using System.Linq; @@ -28,42 +32,174 @@ public MovementMode Mode } public static event Action OnChangingMode; + + //xyz - private Primitive[] _arrows = new Primitive[3]; + private Arrow[] _arrows = new Arrow[3]; private bool _primflag = false; - private readonly Vector3 _scale = new Vector3(1f, .1f, .1f); + public readonly static float REFRESH_RATE = Timing.WaitForOneFrame; - + private CoroutineHandle _handle; + private bool _aiming = false; private void TryCreatePrimitives() { if (!_primflag) { - _arrows[0] = Primitive.Create(PrimitiveType.Cube, null, new Vector3(1f, 0f, 0f), _scale); - _arrows[1] = Primitive.Create(PrimitiveType.Cube, null, new Vector3(0f, 1f, 0f), _scale); - _arrows[2] = Primitive.Create(PrimitiveType.Cube, null, new Vector3(0f, 0f, 1f), _scale); + _arrows[0] = new XArrow(); + _arrows[1] = new YArrow(); + _arrows[2] = new ZArrow(); _primflag = true; } - } + + public void SubscribeEvents() { - - SelectedModel.OnChangedSelection += OnChangedSelection; + ModelCreator.IsAiming += IsAiming; + ModelCreator.StoppedAiming += StoppedAiming; + ModelSelection.OnChangedSelection += OnChangedSelection; + ModelSelection.OnUnSelect += OnUnSelect; } public void UnsubscribeEvents() { - SelectedModel.OnChangedSelection -= OnChangedSelection; - } + Timing.KillCoroutines(_handle); + ModelSelection.OnChangedSelection -= OnChangedSelection; + ModelSelection.OnUnSelect -= OnUnSelect; + } + private void OnUnSelect() + { + foreach (Arrow a in Arrow.List) + { + a.Move(Vector3.zero); + } + } private void OnChangedSelection(Primitive p) { + Log.Info("ChangedSelection"); TryCreatePrimitives(); + foreach (Arrow a in Arrow.List) + { + a.Move(p.Position); + } + + } + + + private void IsAiming(Player p) + { + Log.Info("start aim"); + var prim = ModelCreator.GetFacingPrimitive(p); + if (!Arrow.IsPrimitiveArrow(prim)) return; + + _aiming = true; + _handle = Timing.RunCoroutine(Moving(p,prim)); + } + + private void StoppedAiming() + { + Log.Info("stopped aim"); + _aiming = false; + } + private IEnumerator Moving(Player player,Primitive p) + { + Primitive selected = Models.Instance.ModelCreator.ModelHandler.SelectedPrimitive; + Vector3 pos = selected.Position; + Vector3 targetPos = pos; + Vector3 scale = selected.Scale; + Vector3 tScale = scale; + + + + Vector3 oldEuler = player.CameraTransform.rotation.eulerAngles; + Arrow a = Arrow.GetArrow(p); + List otherArrows = Arrow.List.Where(o => o != a).ToList(); + + Vector3 direction = a.Offset.normalized; + float sensitivity = 0.1f; + float smoothSpeed = 5; + + while (_aiming) + { + Vector3 currentEuler = player.CameraTransform.rotation.eulerAngles; + + float deltaYaw = Mathf.DeltaAngle(oldEuler.y, currentEuler.y); + float deltaPitch = Mathf.DeltaAngle(oldEuler.x, currentEuler.x); + + float movementAmount = 0f; + + if (Mathf.Abs(direction.y) > 0.5f) + { + movementAmount = -deltaPitch * sensitivity; + } + else + { + + Vector3 camRight = player.CameraTransform.right; + + float sign = Mathf.Sign(Vector3.Dot(camRight, direction)); + + movementAmount = deltaYaw * sensitivity * sign; + } + + + + + if(Mode == MovementMode.Move) + { + targetPos += direction.normalized * movementAmount; + pos = Vector3.Lerp(pos, targetPos, Time.deltaTime * smoothSpeed); + p.Position = pos; + selected.Position = pos - a.Offset; + foreach (Arrow arrow in otherArrows) + { + arrow.Move(pos - a.Offset); + } + } + + + + if(Mode == MovementMode.Scale) + { + Vector3 previousParallel = direction.normalized * Vector3.Dot(selected.Scale, direction.normalized); + Vector3 dir = direction.normalized; + + float currentLengthInDir = Vector3.Dot(scale, dir); + + float newLengthInDir = Mathf.Clamp(currentLengthInDir + movementAmount, 0.1f, 10f); + + + Vector3 parallel = dir * newLengthInDir; + Vector3 perpendicular = scale - (dir * currentLengthInDir); + + selected.Scale = parallel + perpendicular; + scale = selected.Scale; + + Vector3 deltaParallel = parallel - previousParallel; + a.Primitive.Position += deltaParallel / 2; + previousParallel = parallel; + } + + + + if(Mode == MovementMode.Rotate) + { + Log.Info("no clue how to do that"); + } + + + + + + oldEuler = currentEuler; + yield return REFRESH_RATE; + } } diff --git a/KruacentExiled/KE.Utils/API/Models/SelectedModel.cs b/KruacentExiled/KE.Utils/API/Models/SelectedModel.cs index 5bb68128..9de9b955 100644 --- a/KruacentExiled/KE.Utils/API/Models/SelectedModel.cs +++ b/KruacentExiled/KE.Utils/API/Models/SelectedModel.cs @@ -10,76 +10,43 @@ namespace KE.Utils.API.Models { - internal class SelectedModel + internal class ModelSelection { public const float BLINK_REFRESH_RATE = .3f; + internal Model SelectedModel; public Primitive SelectedPrimitive; - private Color _baseColor; - private CoroutineHandle _handle; public static event Action OnChangedSelection; public static event Action OnUnSelect; - internal SelectedModel() - { - - } - public void ChangedSelectedPrim(Primitive newPrim) { if (newPrim == null) return; - UnSelect(); - if (SelectedPrimitive == null || newPrim != SelectedPrimitive) + Log.Info(SelectedPrimitive == null); + Log.Info(newPrim.GameObject.GetInstanceID() != SelectedPrimitive?.GameObject.GetInstanceID()); + + if (SelectedPrimitive == null || newPrim.GameObject.GetInstanceID() != SelectedPrimitive?.GameObject.GetInstanceID()) { + Log.Info("selecting"); OnChangedSelection?.Invoke(newPrim); - _baseColor = newPrim.Color; - _handle = Timing.RunCoroutine(Blink(newPrim)); + SelectedPrimitive = newPrim; } else { + Log.Info("unselecting"); + SelectedPrimitive = null; OnUnSelect?.Invoke(); } } - private void UnSelect() - { - if (_handle.IsRunning) - { - - Timing.KillCoroutines(_handle); - SelectedPrimitive.Color = _baseColor; - } - SelectedPrimitive = null; - } - - - private IEnumerator Blink(Primitive p) - { - SelectedPrimitive = p; - Color baseColor = p.Color; - Color baseTrans = new(baseColor.r, baseColor.g, baseColor.b, baseColor.a / 2); - bool transparent = false; - while (true) - { - if (transparent) - { - p.Color = baseTrans; - } - else - { - p.Color = baseColor; - } - yield return Timing.WaitForSeconds(BLINK_REFRESH_RATE); - transparent = !transparent; - } - } + } } diff --git a/KruacentExiled/KE.Utils/KE.Utils.csproj b/KruacentExiled/KE.Utils/KE.Utils.csproj index 7607f6e4..4b93f7c1 100644 --- a/KruacentExiled/KE.Utils/KE.Utils.csproj +++ b/KruacentExiled/KE.Utils/KE.Utils.csproj @@ -5,6 +5,12 @@ net48
+ + + + + + @@ -19,10 +25,6 @@ - - - - if not "$(EXILED_DEV_REFERENCES)"=="" copy /y "$(OutputPath)$(AssemblyName).dll" "$(EXILED_DEV_REFERENCES)\Plugins\" diff --git a/KruacentExiled/Map/Command.cs b/KruacentExiled/Map/Command.cs new file mode 100644 index 00000000..64710064 --- /dev/null +++ b/KruacentExiled/Map/Command.cs @@ -0,0 +1,46 @@ +using CommandSystem; +using KE.Utils.API.Models.Commands; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace KE.Map +{ + [CommandHandler(typeof(RemoteAdminCommandHandler))] + internal class ModelParent : ParentCommand + { + public ModelParent() + { + LoadGeneratedCommands(); + } + + public override string Command => "model"; + public override string Description => ""; + public override string[] Aliases { get; } = {"m"}; + + public override void LoadGeneratedCommands() + { + RegisterCommand(new CreateModel()); + RegisterCommand(new CreatePrim()); + RegisterCommand(new ListModel()); + RegisterCommand(new LoadModel()); + RegisterCommand(new ModeMovePrim()); + RegisterCommand(new SelectModel()); + RegisterCommand(new ShowCenter()); + RegisterCommand(new ChangePrimType()); + RegisterCommand(new ChangeColor()); + } + + protected override bool ExecuteParent(ArraySegment arguments, ICommandSender sender, out string response) + { + response = "\n"; + foreach (ICommand command in Commands.Values) + { + response += command.Command + $" ({command.Aliases[0]}) -" + command.Description + "\n"; + } + return true; + } + } +} diff --git a/KruacentExiled/Map/MainPlugin.cs b/KruacentExiled/Map/MainPlugin.cs index 76598ecc..3bcebeea 100644 --- a/KruacentExiled/Map/MainPlugin.cs +++ b/KruacentExiled/Map/MainPlugin.cs @@ -21,7 +21,7 @@ namespace KE.Map public class MainPlugin : Plugin { public static MainPlugin Instance { get; private set; } - //public Models models => Models.Instance; + public Models models => Models.Instance; private Capybaras Capybaras; public override void OnEnabled() { @@ -33,8 +33,8 @@ public override void OnEnabled() Exiled.Events.Handlers.Map.Generated += OnGenerated; Exiled.Events.Handlers.Server.RoundEnded += OnRoundEnded; //Exiled.Events.Handlers.Server.RoundStarted += SendFakePrimitives.Join; - //if(Config.Debug) - //models?.SubscribeEvents(); + if(Config.Debug) + models?.SubscribeEvents(); Instance = this; } @@ -45,13 +45,13 @@ public override void OnDisabled() Exiled.Events.Handlers.Server.RoundEnded -= OnRoundEnded; //Exiled.Events.Handlers.Server.RoundStarted -= SendFakePrimitives.Join; Capybaras.UnsubscribeEvents(); - /*if (Config.Debug) + if (Config.Debug) { models.UnsubscribeEvents(); models.DestroyInstance(); } - models.DestroyInstance();*/ + models.DestroyInstance(); Capybaras = null; Instance = null; } diff --git a/KruacentExiled/Map/EasterEggs/Capybaras.cs b/KruacentExiled/Map/Others/EasterEggs/Capybaras.cs similarity index 100% rename from KruacentExiled/Map/EasterEggs/Capybaras.cs rename to KruacentExiled/Map/Others/EasterEggs/Capybaras.cs diff --git a/KruacentExiled/Map/EasterEggs/SpinnyBaras.cs b/KruacentExiled/Map/Others/EasterEggs/SpinnyBaras.cs similarity index 100% rename from KruacentExiled/Map/EasterEggs/SpinnyBaras.cs rename to KruacentExiled/Map/Others/EasterEggs/SpinnyBaras.cs From 765765d9708fd08b12536583834d4a6a5d345ff6 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Wed, 2 Jul 2025 13:49:30 +0200 Subject: [PATCH 296/853] renamed --- KruacentExiled/{Map => KE.Map}/Command.cs | 0 KruacentExiled/{Map => KE.Map}/Doors/DoorButton.cs | 0 KruacentExiled/{Map => KE.Map}/Doors/KEDoor.cs | 0 KruacentExiled/{Map => KE.Map}/Doors/KEDoorTypes/KEDoorType.cs | 0 KruacentExiled/{Map => KE.Map}/Doors/KEDoorTypes/NormalKEDoor.cs | 0 KruacentExiled/{Map => KE.Map}/GamblingZone/DroppableItem.cs | 0 KruacentExiled/{Map => KE.Map}/GamblingZone/GamblingRoom.cs | 0 KruacentExiled/{Map => KE.Map}/GamblingZone/LootTable.cs | 0 KruacentExiled/{Map => KE.Map}/GamblingZone/OldGamblingRoom.cs | 0 KruacentExiled/{Map => KE.Map}/KE.Map.csproj | 0 KruacentExiled/{Map => KE.Map}/MainPlugin.cs | 0 KruacentExiled/{Map => KE.Map}/Others/EasterEggs/Capybaras.cs | 0 KruacentExiled/{Map => KE.Map}/Others/EasterEggs/SpinnyBaras.cs | 0 KruacentExiled/{Map => KE.Map}/Quality/SendFakePrimitives.cs | 0 KruacentExiled/{Map => KE.Map}/Utils/InteractiblePickup.cs | 0 15 files changed, 0 insertions(+), 0 deletions(-) rename KruacentExiled/{Map => KE.Map}/Command.cs (100%) rename KruacentExiled/{Map => KE.Map}/Doors/DoorButton.cs (100%) rename KruacentExiled/{Map => KE.Map}/Doors/KEDoor.cs (100%) rename KruacentExiled/{Map => KE.Map}/Doors/KEDoorTypes/KEDoorType.cs (100%) rename KruacentExiled/{Map => KE.Map}/Doors/KEDoorTypes/NormalKEDoor.cs (100%) rename KruacentExiled/{Map => KE.Map}/GamblingZone/DroppableItem.cs (100%) rename KruacentExiled/{Map => KE.Map}/GamblingZone/GamblingRoom.cs (100%) rename KruacentExiled/{Map => KE.Map}/GamblingZone/LootTable.cs (100%) rename KruacentExiled/{Map => KE.Map}/GamblingZone/OldGamblingRoom.cs (100%) rename KruacentExiled/{Map => KE.Map}/KE.Map.csproj (100%) rename KruacentExiled/{Map => KE.Map}/MainPlugin.cs (100%) rename KruacentExiled/{Map => KE.Map}/Others/EasterEggs/Capybaras.cs (100%) rename KruacentExiled/{Map => KE.Map}/Others/EasterEggs/SpinnyBaras.cs (100%) rename KruacentExiled/{Map => KE.Map}/Quality/SendFakePrimitives.cs (100%) rename KruacentExiled/{Map => KE.Map}/Utils/InteractiblePickup.cs (100%) diff --git a/KruacentExiled/Map/Command.cs b/KruacentExiled/KE.Map/Command.cs similarity index 100% rename from KruacentExiled/Map/Command.cs rename to KruacentExiled/KE.Map/Command.cs diff --git a/KruacentExiled/Map/Doors/DoorButton.cs b/KruacentExiled/KE.Map/Doors/DoorButton.cs similarity index 100% rename from KruacentExiled/Map/Doors/DoorButton.cs rename to KruacentExiled/KE.Map/Doors/DoorButton.cs diff --git a/KruacentExiled/Map/Doors/KEDoor.cs b/KruacentExiled/KE.Map/Doors/KEDoor.cs similarity index 100% rename from KruacentExiled/Map/Doors/KEDoor.cs rename to KruacentExiled/KE.Map/Doors/KEDoor.cs diff --git a/KruacentExiled/Map/Doors/KEDoorTypes/KEDoorType.cs b/KruacentExiled/KE.Map/Doors/KEDoorTypes/KEDoorType.cs similarity index 100% rename from KruacentExiled/Map/Doors/KEDoorTypes/KEDoorType.cs rename to KruacentExiled/KE.Map/Doors/KEDoorTypes/KEDoorType.cs diff --git a/KruacentExiled/Map/Doors/KEDoorTypes/NormalKEDoor.cs b/KruacentExiled/KE.Map/Doors/KEDoorTypes/NormalKEDoor.cs similarity index 100% rename from KruacentExiled/Map/Doors/KEDoorTypes/NormalKEDoor.cs rename to KruacentExiled/KE.Map/Doors/KEDoorTypes/NormalKEDoor.cs diff --git a/KruacentExiled/Map/GamblingZone/DroppableItem.cs b/KruacentExiled/KE.Map/GamblingZone/DroppableItem.cs similarity index 100% rename from KruacentExiled/Map/GamblingZone/DroppableItem.cs rename to KruacentExiled/KE.Map/GamblingZone/DroppableItem.cs diff --git a/KruacentExiled/Map/GamblingZone/GamblingRoom.cs b/KruacentExiled/KE.Map/GamblingZone/GamblingRoom.cs similarity index 100% rename from KruacentExiled/Map/GamblingZone/GamblingRoom.cs rename to KruacentExiled/KE.Map/GamblingZone/GamblingRoom.cs diff --git a/KruacentExiled/Map/GamblingZone/LootTable.cs b/KruacentExiled/KE.Map/GamblingZone/LootTable.cs similarity index 100% rename from KruacentExiled/Map/GamblingZone/LootTable.cs rename to KruacentExiled/KE.Map/GamblingZone/LootTable.cs diff --git a/KruacentExiled/Map/GamblingZone/OldGamblingRoom.cs b/KruacentExiled/KE.Map/GamblingZone/OldGamblingRoom.cs similarity index 100% rename from KruacentExiled/Map/GamblingZone/OldGamblingRoom.cs rename to KruacentExiled/KE.Map/GamblingZone/OldGamblingRoom.cs diff --git a/KruacentExiled/Map/KE.Map.csproj b/KruacentExiled/KE.Map/KE.Map.csproj similarity index 100% rename from KruacentExiled/Map/KE.Map.csproj rename to KruacentExiled/KE.Map/KE.Map.csproj diff --git a/KruacentExiled/Map/MainPlugin.cs b/KruacentExiled/KE.Map/MainPlugin.cs similarity index 100% rename from KruacentExiled/Map/MainPlugin.cs rename to KruacentExiled/KE.Map/MainPlugin.cs diff --git a/KruacentExiled/Map/Others/EasterEggs/Capybaras.cs b/KruacentExiled/KE.Map/Others/EasterEggs/Capybaras.cs similarity index 100% rename from KruacentExiled/Map/Others/EasterEggs/Capybaras.cs rename to KruacentExiled/KE.Map/Others/EasterEggs/Capybaras.cs diff --git a/KruacentExiled/Map/Others/EasterEggs/SpinnyBaras.cs b/KruacentExiled/KE.Map/Others/EasterEggs/SpinnyBaras.cs similarity index 100% rename from KruacentExiled/Map/Others/EasterEggs/SpinnyBaras.cs rename to KruacentExiled/KE.Map/Others/EasterEggs/SpinnyBaras.cs diff --git a/KruacentExiled/Map/Quality/SendFakePrimitives.cs b/KruacentExiled/KE.Map/Quality/SendFakePrimitives.cs similarity index 100% rename from KruacentExiled/Map/Quality/SendFakePrimitives.cs rename to KruacentExiled/KE.Map/Quality/SendFakePrimitives.cs diff --git a/KruacentExiled/Map/Utils/InteractiblePickup.cs b/KruacentExiled/KE.Map/Utils/InteractiblePickup.cs similarity index 100% rename from KruacentExiled/Map/Utils/InteractiblePickup.cs rename to KruacentExiled/KE.Map/Utils/InteractiblePickup.cs From 5b57b3308abe8445d02ab882263a7fc346030ac4 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Sun, 6 Jul 2025 13:43:09 +0200 Subject: [PATCH 297/853] scrapped stuff --- .../Quality/SendFakePrimitives.cs | 20 +++++++++---------- KruacentExiled/KruacentExiled.sln | 12 +++++------ 2 files changed, 16 insertions(+), 16 deletions(-) rename KruacentExiled/KE.Map/{ => Scrapped}/Quality/SendFakePrimitives.cs (89%) diff --git a/KruacentExiled/KE.Map/Quality/SendFakePrimitives.cs b/KruacentExiled/KE.Map/Scrapped/Quality/SendFakePrimitives.cs similarity index 89% rename from KruacentExiled/KE.Map/Quality/SendFakePrimitives.cs rename to KruacentExiled/KE.Map/Scrapped/Quality/SendFakePrimitives.cs index f98aabd2..35c3b948 100644 --- a/KruacentExiled/KE.Map/Quality/SendFakePrimitives.cs +++ b/KruacentExiled/KE.Map/Scrapped/Quality/SendFakePrimitives.cs @@ -11,7 +11,7 @@ using System.Collections.Generic; using UnityEngine; -namespace KE.Map.Utils +namespace KE.Map.Scrapped.Quality { internal class SendFakePrimitives { @@ -22,9 +22,9 @@ public static void Fake() HashSet list = new HashSet(); for (int i = 0; i < 1000; i++) { - - - Primitive p = Primitive.Create(pos+new Vector3(.1f*i,0,0), null, new Vector3(.5f, 1.5f, .5f), true, Color.yellow); + + + Primitive p = Primitive.Create(pos + new Vector3(.1f * i, 0, 0), null, new Vector3(.5f, 1.5f, .5f), true, Color.yellow); p.Collidable = false; list.Add(p); PrimitiveObjectToy primitive = p.Base; @@ -35,7 +35,7 @@ public static void Fake() if (pl.Id % 2 == 0) { Log.Debug($"for player ={pl.Nickname}"); - pl.SendFakeSyncVar(p.Base.netIdentity, typeof(PrimitiveObjectToy), nameof(PrimitiveObjectToy.NetworkPosition), new Vector3(15000,15000,15000)); + pl.SendFakeSyncVar(p.Base.netIdentity, typeof(PrimitiveObjectToy), nameof(PrimitiveObjectToy.NetworkPosition), new Vector3(15000, 15000, 15000)); } else { @@ -47,11 +47,11 @@ public static void Fake() //pl.SendFakeSyncVar(p.Base.netIdentity, typeof(PrimitiveObjectToy), nameof(PrimitiveObjectToy.NetworkPosition), pos + Vector3.forward); } } - + } - + public static void Join() { //Fake(); @@ -63,10 +63,10 @@ public static void Join() Collider collider = pick.GameObject.GetComponentInChildren(); - - + + //Pickup pickupFinal = Pickup.CreateAndSpawn(ItemType.KeycardGuard, p.Position); //if (!pickupFinal.IsLocked) @@ -79,6 +79,6 @@ public static void Join() } - + } } diff --git a/KruacentExiled/KruacentExiled.sln b/KruacentExiled/KruacentExiled.sln index 93390814..a2b7c5d9 100644 --- a/KruacentExiled/KruacentExiled.sln +++ b/KruacentExiled/KruacentExiled.sln @@ -15,10 +15,10 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "KE.GlobalEventFramework.Exa EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "KE.CustomRoles", "KE.CustomRoles\KE.CustomRoles.csproj", "{4AA4C3E0-E62F-49CE-AD80-0B5C6249EB48}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "KE.Map", "Map\KE.Map.csproj", "{CCEF1C1D-B701-443E-AC23-72A174446868}" -EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "KE.Utils", "KE.Utils\KE.Utils.csproj", "{DFEF41B3-5BD3-428A-A7BA-7A490E65C71F}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "KE.Map", "KE.Map\KE.Map.csproj", "{2BD019AC-1B86-4E00-B418-BE4C06CD8410}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -49,14 +49,14 @@ Global {4AA4C3E0-E62F-49CE-AD80-0B5C6249EB48}.Debug|Any CPU.Build.0 = Debug|Any CPU {4AA4C3E0-E62F-49CE-AD80-0B5C6249EB48}.Release|Any CPU.ActiveCfg = Release|Any CPU {4AA4C3E0-E62F-49CE-AD80-0B5C6249EB48}.Release|Any CPU.Build.0 = Release|Any CPU - {CCEF1C1D-B701-443E-AC23-72A174446868}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {CCEF1C1D-B701-443E-AC23-72A174446868}.Debug|Any CPU.Build.0 = Debug|Any CPU - {CCEF1C1D-B701-443E-AC23-72A174446868}.Release|Any CPU.ActiveCfg = Release|Any CPU - {CCEF1C1D-B701-443E-AC23-72A174446868}.Release|Any CPU.Build.0 = Release|Any CPU {DFEF41B3-5BD3-428A-A7BA-7A490E65C71F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {DFEF41B3-5BD3-428A-A7BA-7A490E65C71F}.Debug|Any CPU.Build.0 = Debug|Any CPU {DFEF41B3-5BD3-428A-A7BA-7A490E65C71F}.Release|Any CPU.ActiveCfg = Release|Any CPU {DFEF41B3-5BD3-428A-A7BA-7A490E65C71F}.Release|Any CPU.Build.0 = Release|Any CPU + {2BD019AC-1B86-4E00-B418-BE4C06CD8410}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {2BD019AC-1B86-4E00-B418-BE4C06CD8410}.Debug|Any CPU.Build.0 = Debug|Any CPU + {2BD019AC-1B86-4E00-B418-BE4C06CD8410}.Release|Any CPU.ActiveCfg = Release|Any CPU + {2BD019AC-1B86-4E00-B418-BE4C06CD8410}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE From aa5322fb98730a458fb547f3db19d04cb290c120 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Wed, 9 Jul 2025 14:42:11 +0200 Subject: [PATCH 298/853] supply dropyay --- KruacentExiled/KE.Map/KE.Map.csproj | 1 + KruacentExiled/KE.Map/MainPlugin.cs | 32 ++- .../Surface/BlinkingBlocks/BlinkingBlock.cs | 86 +++++++ .../BlinkingBlocks/BlinkingBlocksGroup.cs | 64 +++++ .../KE.Map/Surface/SupplyDrops/SupplyDrop.cs | 220 ++++++++++++++++++ KruacentExiled/KE.Utils/API/OtherUtils.cs | 18 ++ .../KE.Utils/API/Sounds/SoundPlayer.cs | 112 +++++++++ KruacentExiled/KE.Utils/KE.Utils.csproj | 1 + 8 files changed, 533 insertions(+), 1 deletion(-) create mode 100644 KruacentExiled/KE.Map/Surface/BlinkingBlocks/BlinkingBlock.cs create mode 100644 KruacentExiled/KE.Map/Surface/BlinkingBlocks/BlinkingBlocksGroup.cs create mode 100644 KruacentExiled/KE.Map/Surface/SupplyDrops/SupplyDrop.cs create mode 100644 KruacentExiled/KE.Utils/API/OtherUtils.cs create mode 100644 KruacentExiled/KE.Utils/API/Sounds/SoundPlayer.cs diff --git a/KruacentExiled/KE.Map/KE.Map.csproj b/KruacentExiled/KE.Map/KE.Map.csproj index 1756fc73..b576ee2e 100644 --- a/KruacentExiled/KE.Map/KE.Map.csproj +++ b/KruacentExiled/KE.Map/KE.Map.csproj @@ -19,6 +19,7 @@ + diff --git a/KruacentExiled/KE.Map/MainPlugin.cs b/KruacentExiled/KE.Map/MainPlugin.cs index 3bcebeea..8fa3a889 100644 --- a/KruacentExiled/KE.Map/MainPlugin.cs +++ b/KruacentExiled/KE.Map/MainPlugin.cs @@ -10,8 +10,11 @@ using KE.Map.Doors; using KE.Map.EasterEggs; using KE.Map.GamblingZone; +using KE.Map.Surface.BlinkingBlocks; +using KE.Map.Surface.SupplyDrops; using KE.Map.Utils; using KE.Utils.API.Models; +using MEC; using PlayerRoles; using System.Collections.Generic; using UnityEngine; @@ -30,10 +33,12 @@ public override void OnEnabled() Capybaras.SubscribeEvents(); + KE.Utils.API.Sounds.SoundPlayer.Instance.TryLoad(); Exiled.Events.Handlers.Map.Generated += OnGenerated; Exiled.Events.Handlers.Server.RoundEnded += OnRoundEnded; + Exiled.Events.Handlers.Server.RoundStarted += SupplyDrop.OnRoundStarted; //Exiled.Events.Handlers.Server.RoundStarted += SendFakePrimitives.Join; - if(Config.Debug) + if (Config.Debug) models?.SubscribeEvents(); Instance = this; @@ -43,6 +48,7 @@ public override void OnDisabled() { Exiled.Events.Handlers.Map.Generated -= OnGenerated; Exiled.Events.Handlers.Server.RoundEnded -= OnRoundEnded; + Exiled.Events.Handlers.Server.RoundStarted -= SupplyDrop.OnRoundStarted; //Exiled.Events.Handlers.Server.RoundStarted -= SendFakePrimitives.Join; Capybaras.UnsubscribeEvents(); if (Config.Debug) @@ -117,6 +123,30 @@ private void OnGenerated() + + //Blinking Blocks + HashSet list = new() + { + new BlinkingBlock(new(19, 300, -44), new(), new(2, .5f, 2), BlockColor.Red), + new BlinkingBlock(new(19, 300, -38), new(), new(2, .5f, 2), BlockColor.Blue) + }; + + BlinkingBlocksGroup group = new(list); + //Timing.RunCoroutine(ShowPos()); + + } + + private IEnumerator ShowPos() + { + while (true) + { + Log.Debug("tick"); + foreach(Player p in Player.List) + { + Log.Debug(p.Position); + } + yield return Timing.WaitForSeconds(2); + } } private void OnRoundEnded(RoundEndedEventArgs ev) diff --git a/KruacentExiled/KE.Map/Surface/BlinkingBlocks/BlinkingBlock.cs b/KruacentExiled/KE.Map/Surface/BlinkingBlocks/BlinkingBlock.cs new file mode 100644 index 00000000..88acbccd --- /dev/null +++ b/KruacentExiled/KE.Map/Surface/BlinkingBlocks/BlinkingBlock.cs @@ -0,0 +1,86 @@ +using Exiled.API.Features.Doors; +using Exiled.API.Features.Toys; +using Exiled.API.Interfaces; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using UnityEngine; +using VoiceChat.Networking; + +namespace KE.Map.Surface.BlinkingBlocks +{ + public class BlinkingBlock : IWorldSpace + { + + + public Vector3 Position { get; } + + public Quaternion Rotation { get; } + + public BlockColor BlockColor { get; } + + + + + private HashSet _list = new(); + private HashSet outline = new(); + public BlinkingBlock(Vector3 pos, Quaternion rotation, Vector3 scale, BlockColor color) + { + Position = pos; + Rotation = rotation; + BlockColor = color; + _list.Add(Primitive.Create(PrimitiveType.Cube, pos, rotation.eulerAngles, scale, false, BlockColorToColor(color))); + } + + + + public void Switch(BlockColor newColor) + { + foreach(Primitive p in _list) + { + if (newColor == BlockColor) + { + p.Spawn(); + } + else + { + p.UnSpawn(); + } + + } + + foreach(Primitive p in outline) + { + if (newColor == BlockColor) + { + p.UnSpawn(); + } + else + { + p.Spawn(); + } + } + } + + public static Color BlockColorToColor(BlockColor c) + { + return c switch + { + BlockColor.Blue => Color.blue, + BlockColor.Red => Color.red, + _ => Color.red + }; + } + + + + } + public enum BlockColor + { + Red, + Blue + } + +} diff --git a/KruacentExiled/KE.Map/Surface/BlinkingBlocks/BlinkingBlocksGroup.cs b/KruacentExiled/KE.Map/Surface/BlinkingBlocks/BlinkingBlocksGroup.cs new file mode 100644 index 00000000..48214f36 --- /dev/null +++ b/KruacentExiled/KE.Map/Surface/BlinkingBlocks/BlinkingBlocksGroup.cs @@ -0,0 +1,64 @@ +using Exiled.API.Features; +using Exiled.API.Interfaces; +using Exiled.Events.EventArgs.Player; +using KE.Utils.API.Sounds; +using MEC; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using UnityEngine; + +namespace KE.Map.Surface.BlinkingBlocks +{ + public class BlinkingBlocksGroup : IPosition + { + private AudioPlayer player; + public Vector3 Position { get; } + public BlockColor Color { get; private set; } + + private HashSet _list; + public BlinkingBlocksGroup(IEnumerable blocks) + { + _list = new(blocks); + + Vector3 center = new(_list.Average(x => x.Position.x), _list.Average(x => x.Position.y),_list.Average(x => x.Position.z)); + + + + var a = new GameObject(); + a.transform.position = center; + Timing.RunCoroutine(Switch()); + KE.Utils.API.Sounds.SoundPlayer.Instance.Play("beep", a, 50, 50); + } + + private BlockColor GetNewColor() + { + if(Color == BlockColor.Red) + { + return BlockColor.Blue; + } + else + { + return BlockColor.Red; + } + } + + private IEnumerator Switch() + { + while (true) + { + + yield return Timing.WaitForSeconds(5); + foreach (BlinkingBlock b in _list) + { + b.Switch(Color); + } + Log.Debug("switch to "+Color.ToString()); + Color = GetNewColor(); + } + } + + } +} diff --git a/KruacentExiled/KE.Map/Surface/SupplyDrops/SupplyDrop.cs b/KruacentExiled/KE.Map/Surface/SupplyDrops/SupplyDrop.cs new file mode 100644 index 00000000..ddb1d7b9 --- /dev/null +++ b/KruacentExiled/KE.Map/Surface/SupplyDrops/SupplyDrop.cs @@ -0,0 +1,220 @@ +using Exiled.API.Enums; +using Exiled.API.Features; +using Exiled.API.Features.Items; +using Exiled.API.Features.Pickups; +using Exiled.API.Features.Toys; +using Exiled.API.Interfaces; +using KE.Utils.API; +using KE.Utils.Extensions; +using MEC; +using PlayerRoles; +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using UnityEngine; + +namespace KE.Map.Surface.SupplyDrops +{ + public class SupplyDrop : IPosition + { + private static byte _scpSteal = 0; + + public const byte ScpStealLimit = 3; + public const byte MaxSupplyDrop = 10; + public static readonly TimeSpan TimeStaying = new TimeSpan(0, 1, 0); + public static readonly TimeSpan TimeSpawn = new TimeSpan(0, 5, 0); + public const float Radius = 7f; + public const float RefreshRate = .1f; + + public bool Show + { + get + { + DayOfWeek day = DateTime.Now.DayOfWeek; + + if (day == DayOfWeek.Saturday) + return true; + //starting at monday + int idDay = (int)day +1; + + if ( idDay % 2 == 0 && NumberDrop % 2 != 0) + { + return true; + } + if (idDay % 2 != 0 && NumberDrop % 2 == 0) + { + return true; + } + + return false; + } + } + public Vector3 Position { get; } + public int NumberDrop => list.FindIndex(s => s == this); + + private static Stopwatch _spawnTime; + private static TimeSpan _nextSpawn; + private static List list = new(); + private HashSet primitives = new(); + private bool _detectingSomeone = false; + + public RoleTypeId SideClaimed { get; private set; } = RoleTypeId.None; + public Player PlayerClaimed { get; private set; } + + public static readonly string CassieMessageDrop = "Drop in surface"; + public static readonly string CassieTooMuchStealing = ""; + + private static CoroutineHandle _handle; + public SupplyDrop(Vector3 position) + { + list.Add(this); + Position = position; + + //Model + primitives.Add(Primitive.Create(PrimitiveType.Cube,position,null,Vector3.one,false)); + //radius of pickup + var pr = Primitive.Create(PrimitiveType.Sphere, Position, null, new(Radius, Radius, Radius), false, new(0, 1, 0, .30f)); + pr.Collidable = false; + primitives.Add(pr); + if (Show) + { + Cassie.Message(CassieMessageDrop); + } + + foreach (var p in primitives) + { + p.Spawn(); + } + + Timing.RunCoroutine(Detecting()); + } + + public static void OnRoundStarted() + { + _spawnTime = Stopwatch.StartNew(); + //_nextSpawn = TimeSpawn; + + _handle = Timing.RunCoroutine(Loop()); + } + + private static IEnumerator Loop() + { + + bool notmax = true; + while (notmax) + { + if (_spawnTime.Elapsed > _nextSpawn) + { + _nextSpawn += TimeSpawn; + SpawnRandom(); + } + notmax = list.Count <= MaxSupplyDrop; + yield return Timing.WaitForSeconds(RefreshRate); + } + } + + private static void SpawnRandom() + { + //Todo random lol + Vector3 spawnloc = new(19, 290, -44); + + + Log.Debug($"spawning drop at {spawnloc}"); + SupplyDrop soup = new(spawnloc); + + + } + public void Destroy() + { + float timeExplode = 10; + var grenade = (ExplosiveGrenade)Item.Create(ItemType.GrenadeHE); + grenade.ScpDamageMultiplier = 1; + grenade.BurnDuration = timeExplode; + grenade.SpawnActive(Position + Vector3.up); + + Timing.CallDelayed(timeExplode, () => + { + foreach(var p in primitives) + { + p.Destroy(); + } + }); + + } + + private IEnumerator Detecting() + { + var s = Stopwatch.StartNew(); + _detectingSomeone = true; + while (_detectingSomeone && s.Elapsed < TimeStaying) + { + yield return Timing.WaitForSeconds(RefreshRate); + foreach (Player p in Player.List.Where(p=> p.IsAlive)) + { + if (OtherUtils.IsInCircle(p.Position,Position,Radius)) + { + Effect(p); + _detectingSomeone = false; + Log.Debug($"Player {p.Id} got the supply drop"); + //break; + } + } + } + _detectingSomeone = false; + Destroy(); + } + + + + private void Effect(Player p) + { + + //todo add trapped drop (explode) + SideClaimed = p.Role; + PlayerClaimed = p; + + if (p.IsScp) + { + BuffScps(); + } + else + { + SpawnLoot(p); + } + + + } + + private void SpawnLoot(Player p) + { + p.AddItem(ItemType.GunCrossvec); + p.AddAmmo(AmmoType.Nato9, 50); + } + + private void BuffScps() + { + foreach(Player p in Player.List.Where(p => p.IsScp)) + { + float healthAdded = p.MaxHealth * 1.3f; + p.MaxHealth += healthAdded; + p.Health += healthAdded; + + } + _scpSteal++; + + if (_scpSteal >= ScpStealLimit) + { + Cassie.Message(CassieTooMuchStealing); + Warhead.Start(true, true); + _spawnTime.Stop(); + Timing.KillCoroutines(_handle); + } + } + + + + } +} diff --git a/KruacentExiled/KE.Utils/API/OtherUtils.cs b/KruacentExiled/KE.Utils/API/OtherUtils.cs new file mode 100644 index 00000000..2995a624 --- /dev/null +++ b/KruacentExiled/KE.Utils/API/OtherUtils.cs @@ -0,0 +1,18 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using UnityEngine; + +namespace KE.Utils.API +{ + public static class OtherUtils + { + + public static bool IsInCircle(Vector3 pos,Vector3 centerCircle,float radius) + { + return Math.Pow(pos.x - centerCircle.x, 2) + Math.Pow(pos.y - centerCircle.y, 2) <= Math.Pow(radius, 2); + } + } +} diff --git a/KruacentExiled/KE.Utils/API/Sounds/SoundPlayer.cs b/KruacentExiled/KE.Utils/API/Sounds/SoundPlayer.cs new file mode 100644 index 00000000..19f0c310 --- /dev/null +++ b/KruacentExiled/KE.Utils/API/Sounds/SoundPlayer.cs @@ -0,0 +1,112 @@ +using Exiled.API.Features; +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using UnityEngine; + +namespace KE.Utils.API.Sounds +{ + public class SoundPlayer + { + private static SoundPlayer _instance; + + public static SoundPlayer Instance + { + get + { + if(_instance == null) + { + _instance = new(); + } + return _instance; + } + } + + private SoundPlayer() { } + + private bool _loaded = false; + public bool Loaded => _loaded; + + + public static string SoundLocation => Paths.Configs + "/Sounds"; + public static void Load() => Instance.TryLoad(); + public void TryLoad() + { + if (Loaded) + { + return; + } + + if (!Directory.Exists(SoundLocation)) + { + Log.Warn("Directory not found. creating..."); + Directory.CreateDirectory(SoundLocation); + } + + string[] rawfile = Directory.GetFiles(SoundLocation, "*.ogg"); + + foreach (string file in rawfile) + { + string noExFile = Path.GetFileNameWithoutExtension(file); + Log.Info($"loading {file} as {noExFile}"); + AudioClipStorage.LoadClip(file); + } + _loaded = true; + } + + + /// + /// Play a clip at a static point + /// + /// + /// + /// + /// + public void Play(string clipName, Vector3 pos, float volume = 50f, float maxDistance = 20f, bool isSpatial = true) + { + if (!Loaded) throw new Exception("clips not loaded use SoundPlayer.Load()"); + Log.Debug($"playing {clipName} at {pos}"); + + var audioPlayer = AudioPlayer.CreateOrGet($"{clipName} ({pos})", onIntialCreation: (p) => + { + GameObject a = new GameObject(); + a.transform.position = pos; + p.transform.parent = a.transform; + Speaker speaker = p.AddSpeaker("main", isSpatial: isSpatial, maxDistance: maxDistance, minDistance: 1f); + speaker.transform.parent = a.transform; + speaker.transform.localPosition = Vector3.zero; + }); + + audioPlayer.AddClip(clipName, volume: volume); + audioPlayer.DestroyWhenAllClipsPlayed = true; + + } + + /// + /// Play a clip at a + /// + /// + /// + /// + /// + public void Play(string clipName, GameObject objectEmittingSound, float volume = 50f, float maxDistance = 20f, bool isSpatial = true) + { + if (!Loaded) throw new Exception("clips not loaded use SoundPlayer.Instance.Load()"); + Log.Debug($"playing {clipName} at {objectEmittingSound}"); + + var audioPlayer = AudioPlayer.CreateOrGet($"{clipName} ({objectEmittingSound})", onIntialCreation: (p) => + { + + p.transform.parent = objectEmittingSound.transform; + Speaker speaker = p.AddSpeaker("main", isSpatial: isSpatial, maxDistance: maxDistance, minDistance: 1f); + speaker.transform.parent = objectEmittingSound.transform; + speaker.transform.localPosition = Vector3.zero; + }); + audioPlayer.AddClip(clipName, volume: volume); + audioPlayer.DestroyWhenAllClipsPlayed = true; + } + } +} diff --git a/KruacentExiled/KE.Utils/KE.Utils.csproj b/KruacentExiled/KE.Utils/KE.Utils.csproj index 4b93f7c1..aee2e596 100644 --- a/KruacentExiled/KE.Utils/KE.Utils.csproj +++ b/KruacentExiled/KE.Utils/KE.Utils.csproj @@ -22,6 +22,7 @@ + From f2e6ed6f3b519bd33c34f7fab034aff769ce4855 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Thu, 10 Jul 2025 11:12:51 +0200 Subject: [PATCH 299/853] you can now use abilities with keybinds yippee (still needs hints) --- .../API/Features/GlobalCustomRole.cs | 1 - .../KE.CustomRoles/Abilities/TestRotateCam.cs | 63 +++++++++ .../KE.CustomRoles/CR/SCP/ZombieDoorman.cs | 3 +- .../KE.CustomRoles/Settings/SettingHandler.cs | 124 +++++++++++++++++- 4 files changed, 184 insertions(+), 7 deletions(-) create mode 100644 KruacentExiled/KE.CustomRoles/Abilities/TestRotateCam.cs diff --git a/KruacentExiled/KE.CustomRoles/API/Features/GlobalCustomRole.cs b/KruacentExiled/KE.CustomRoles/API/Features/GlobalCustomRole.cs index a5262a78..c0aebe6b 100644 --- a/KruacentExiled/KE.CustomRoles/API/Features/GlobalCustomRole.cs +++ b/KruacentExiled/KE.CustomRoles/API/Features/GlobalCustomRole.cs @@ -48,7 +48,6 @@ private void InternalSpawningRagdoll(SpawningRagdollEventArgs ev) if (Check(ev.Player)) { ev.IsAllowed = false; - Ragdoll.CreateAndSpawn(ev.Role, ev.Player.Nickname, ev.DamageHandlerBase, ev.Position, ev.Rotation); } } diff --git a/KruacentExiled/KE.CustomRoles/Abilities/TestRotateCam.cs b/KruacentExiled/KE.CustomRoles/Abilities/TestRotateCam.cs new file mode 100644 index 00000000..874514cb --- /dev/null +++ b/KruacentExiled/KE.CustomRoles/Abilities/TestRotateCam.cs @@ -0,0 +1,63 @@ +using Exiled.API.Extensions; +using Exiled.API.Features; +using Exiled.API.Features.Attributes; +using Exiled.CustomRoles.API.Features; +using Exiled.Events.EventArgs.Player; +using MEC; +using System.Collections.Generic; +using UnityEngine; + +namespace KE.CustomRoles.Abilities +{ + [CustomAbility] + internal class TestRotateCam : ActiveAbility + { + public override string Name { get; set; } = "TestRotateCam"; + + public override string Description { get; set; } = "TestRotateCam"; + + public override float Duration { get; set; } = 0f; + + public override float Cooldown { get; set; } = 45f; + private List _players = new List(); + + protected override void AbilityUsed(Player player) + { + //player.ShowHint("interact with a door to open it", 5f); + player.CameraTransform.Rotate(new Vector3(0, 180, 0)); + + + + } + + protected override void SubscribeEvents() + { + Exiled.Events.Handlers.Player.InteractingDoor += OnInteractingDoor; + base.SubscribeEvents(); + } + + protected override void UnsubscribeEvents() + { + Exiled.Events.Handlers.Player.InteractingDoor -= OnInteractingDoor; + base.UnsubscribeEvents(); + } + + private void OnInteractingDoor(InteractingDoorEventArgs ev) + { + if (!_players.Contains(ev.Player)) return; + if (ev.Door.IsOpen) return; + if (!ev.Door.IsKeycardDoor) return; + if (ev.Door.IsCheckpoint) return; + if (ev.Door.IsLocked) return; + + ev.IsAllowed = false; + ev.Player.ShowHint("The door will open in 5 seconds", 5f); + ev.Player.Hurt(ev.Player.MaxHealth / 10, Exiled.API.Enums.DamageType.Strangled); + _players.Remove(ev.Player); + Timing.CallDelayed(5f, () => + { + ev.Door.IsOpen = true; + }); + } + } +} diff --git a/KruacentExiled/KE.CustomRoles/CR/SCP/ZombieDoorman.cs b/KruacentExiled/KE.CustomRoles/CR/SCP/ZombieDoorman.cs index ee47b53a..3464a320 100644 --- a/KruacentExiled/KE.CustomRoles/CR/SCP/ZombieDoorman.cs +++ b/KruacentExiled/KE.CustomRoles/CR/SCP/ZombieDoorman.cs @@ -27,7 +27,8 @@ internal class ZombieDoorman : CustomRole public override float SpawnChance { get; set; } = 100; public override List CustomAbilities { get; set; } = new List() { - new OpenDoor() + new OpenDoor(), + new TestRotateCam() }; diff --git a/KruacentExiled/KE.CustomRoles/Settings/SettingHandler.cs b/KruacentExiled/KE.CustomRoles/Settings/SettingHandler.cs index 67786228..b8d127fb 100644 --- a/KruacentExiled/KE.CustomRoles/Settings/SettingHandler.cs +++ b/KruacentExiled/KE.CustomRoles/Settings/SettingHandler.cs @@ -1,22 +1,28 @@ using Exiled.API.Features; using Exiled.API.Features.Core.UserSettings; +using Exiled.API.Features.Pools; +using Exiled.CustomRoles.API; using Exiled.CustomRoles.API.Features; using Exiled.Events.EventArgs.Player; using KE.Utils.API.Interfaces; using System; using System.Collections.Generic; using System.Linq; +using System.Reflection; using System.Text; using System.Threading.Tasks; using UserSettings.ServerSpecific; +using UserSettings.UserInterfaceSettings; namespace KE.CustomRoles.Settings { internal class SettingHandler : IUsingEvents { - private int id; private int _idTimeCustomRole = 144; private int _idDesc = 143; + private int _idkeybind = 145; + private int switchForwardId = 146; + private int switchBackwardId = 147; private IReadOnlyCollection settings; public SettingHandler() { @@ -26,20 +32,23 @@ public SettingHandler() new HeaderSetting ("Custom Roles Hint Settings"), new TwoButtonsSetting(_idDesc,"Descriptions","Disabled","Enabled",true,"hide/show the description the Custom Role "), new SliderSetting(_idTimeCustomRole,"Time shown",0,30,20), + new KeybindSetting(_idkeybind,"ability",UnityEngine.KeyCode.K), + new KeybindSetting(switchForwardId,"forward",UnityEngine.KeyCode.L), + new KeybindSetting(switchBackwardId,"backward",UnityEngine.KeyCode.J) }; } public void SubscribeEvents() { SettingBase.Register(settings); - //ServerSpecificSettingsSync.ServerOnSettingValueReceived += OnSettingValueReceived; + ServerSpecificSettingsSync.ServerOnSettingValueReceived += OnSettingValueReceived; Exiled.Events.Handlers.Player.Verified += OnVerified; } public void UnsubscribeEvents() { - //ServerSpecificSettingsSync.ServerOnSettingValueReceived -= OnSettingValueReceived; + ServerSpecificSettingsSync.ServerOnSettingValueReceived -= OnSettingValueReceived; Exiled.Events.Handlers.Player.Verified -= OnVerified; SettingBase.Unregister(predicate:null, settings); } @@ -54,15 +63,120 @@ private void OnVerified(VerifiedEventArgs ev) private void OnSettingValueReceived(ReferenceHub hub, ServerSpecificSettingBase settingBase) { + if(settingBase == null) + { + Log.Debug("setting null whar?"); + } + Player p = Player.Get(hub); + + IEnumerable a = p.GetActiveAbilities(); + + if(a == null) + { + Log.Debug("no abilities 1"); + return; + } + + + List abilities = ListPool.Pool.Get(a); + ActiveAbility currentAbility = p.GetSelectedAbility(); + ActiveAbility want = null; + + if (abilities.Count == 0) + { + Log.Debug("no abilities 2"); + return; + } + int index = 0; + + + if (CheckPressed(settingBase, switchForwardId)) + { + if (currentAbility != null) + { + index = abilities.IndexOf(currentAbility); + currentAbility.UnSelectAbility(p); + } + want = abilities[(index + 1) % abilities.Count]; + + + } + if (CheckPressed(settingBase, switchBackwardId)) + { + if (currentAbility != null) + { + index = abilities.IndexOf(currentAbility); + currentAbility.UnSelectAbility(p); + } + + if(index - 1 < 0) + { + want = abilities[abilities.Count -1]; + } + else + { + want = abilities[(index - 1) % abilities.Count]; + } + + + } + + want?.SelectAbility(p); + currentAbility = p.GetSelectedAbility(); + Log.Debug(currentAbility.Name); + if (CheckPressed(settingBase,_idkeybind)) + { + if (CanUse(currentAbility,p, out var result)) + { + + currentAbility.UseAbility(p); + } + Log.Debug(result); + } + } + + + private bool CanUse(ActiveAbility a, Player player, out string result) + { + if(a == null) + { + result = "abi null"; + return false; + } + if (player == null) + { + result = "player null"; + return false; + } + if (!a.SelectedPlayers.Contains(player)) + { + result = "no selected"; + return false; + } - if (settingBase is SSKeybindSetting keyindSetting && keyindSetting.SettingId == id && keyindSetting.SyncIsPressed) + if (!a.LastUsed.ContainsKey(player)) { - Log.Debug("pressed"); + result = "already in"; + return true; } + + DateTime dateTime = a.LastUsed[player] + TimeSpan.FromSeconds(a.Cooldown); + if (DateTime.Now > dateTime) + { + result = "ok"; + return true; + } + result = "in cooldown"; + return false; } + public bool CheckPressed(ServerSpecificSettingBase settingBase,int id) + { + return settingBase is SSKeybindSetting keyindSetting && keyindSetting.SettingId == id && keyindSetting.SyncIsPressed; + } + internal float GetTime(Player p) { if (!SettingBase.TryGetSetting(p, _idTimeCustomRole, out var setting)) return 20; From 852b4e5e5b6741408c87585145b627522aa33e29 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Thu, 10 Jul 2025 11:14:35 +0200 Subject: [PATCH 300/853] removed --- .../Scrapped/Quality/SendFakePrimitives.cs | 84 ------------------- 1 file changed, 84 deletions(-) delete mode 100644 KruacentExiled/KE.Map/Scrapped/Quality/SendFakePrimitives.cs diff --git a/KruacentExiled/KE.Map/Scrapped/Quality/SendFakePrimitives.cs b/KruacentExiled/KE.Map/Scrapped/Quality/SendFakePrimitives.cs deleted file mode 100644 index 35c3b948..00000000 --- a/KruacentExiled/KE.Map/Scrapped/Quality/SendFakePrimitives.cs +++ /dev/null @@ -1,84 +0,0 @@ -using AdminToys; -using Exiled.API.Extensions; -using Exiled.API.Features; -using Exiled.API.Features.Pickups; -using Exiled.API.Features.Toys; -using Exiled.Events.EventArgs.Player; -using InventorySystem.Items.Pickups; -using Mirror; -using PlayerRoles; -using System; -using System.Collections.Generic; -using UnityEngine; - -namespace KE.Map.Scrapped.Quality -{ - internal class SendFakePrimitives - { - public static void Fake() - { - Vector3 pos = RoleTypeId.Scp049.GetRandomSpawnLocation().Position; - Primitive.Create(pos, null, null, true, Color.white); - HashSet list = new HashSet(); - for (int i = 0; i < 1000; i++) - { - - - Primitive p = Primitive.Create(pos + new Vector3(.1f * i, 0, 0), null, new Vector3(.5f, 1.5f, .5f), true, Color.yellow); - p.Collidable = false; - list.Add(p); - PrimitiveObjectToy primitive = p.Base; - - foreach (Player pl in Player.List) - { - - if (pl.Id % 2 == 0) - { - Log.Debug($"for player ={pl.Nickname}"); - pl.SendFakeSyncVar(p.Base.netIdentity, typeof(PrimitiveObjectToy), nameof(PrimitiveObjectToy.NetworkPosition), new Vector3(15000, 15000, 15000)); - } - else - { - Log.Debug($"back player ={pl.Nickname}"); - pl.SendFakeSyncVar(p.Base.netIdentity, typeof(PrimitiveObjectToy), nameof(PrimitiveObjectToy.NetworkPosition), pos + Vector3.forward); - } - - - //pl.SendFakeSyncVar(p.Base.netIdentity, typeof(PrimitiveObjectToy), nameof(PrimitiveObjectToy.NetworkPosition), pos + Vector3.forward); - } - } - - } - - - - public static void Join() - { - //Fake(); - Vector3 pos = RoleTypeId.Scp049.GetRandomSpawnLocation().Position; - - var pick = Pickup.CreateAndSpawn(ItemType.Medkit, pos); - - //pick.Base.GetComponent().isKinematic = true; - - Collider collider = pick.GameObject.GetComponentInChildren(); - - - - - - //Pickup pickupFinal = Pickup.CreateAndSpawn(ItemType.KeycardGuard, p.Position); - - //if (!pickupFinal.IsLocked) - //{ - // PickupSyncInfo info = pickupFinal.Base.NetworkInfo; - // pickupFinal.Scale = new Vector3(10, 150, 10); - // pickupFinal.Base.NetworkInfo = info; - // pickupFinal.Base.GetComponent().isKinematic = true; - //} - - } - - - } -} From 86210ed19b7af6ef88a4f49a8c4e5d0cbb22cdad Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Thu, 10 Jul 2025 13:17:12 +0200 Subject: [PATCH 301/853] created spawn loc --- KruacentExiled/KE.Map/Command.cs | 6 +- KruacentExiled/KE.Map/MainPlugin.cs | 8 +- .../KE.Map/Surface/SupplyDrops/SupplyDrop.cs | 73 +++++++++++++------ KruacentExiled/KE.Utils/API/OtherUtils.cs | 2 +- 4 files changed, 62 insertions(+), 27 deletions(-) diff --git a/KruacentExiled/KE.Map/Command.cs b/KruacentExiled/KE.Map/Command.cs index 64710064..56708b13 100644 --- a/KruacentExiled/KE.Map/Command.cs +++ b/KruacentExiled/KE.Map/Command.cs @@ -13,7 +13,11 @@ internal class ModelParent : ParentCommand { public ModelParent() { - LoadGeneratedCommands(); + if (MainPlugin.Configs?.Debug ?? false) + { + LoadGeneratedCommands(); + } + } public override string Command => "model"; diff --git a/KruacentExiled/KE.Map/MainPlugin.cs b/KruacentExiled/KE.Map/MainPlugin.cs index 8fa3a889..155cb3fc 100644 --- a/KruacentExiled/KE.Map/MainPlugin.cs +++ b/KruacentExiled/KE.Map/MainPlugin.cs @@ -16,6 +16,8 @@ using KE.Utils.API.Models; using MEC; using PlayerRoles; +using PlayerRoles.FirstPersonControl; +using Respawning; using System.Collections.Generic; using UnityEngine; @@ -25,6 +27,7 @@ public class MainPlugin : Plugin { public static MainPlugin Instance { get; private set; } public Models models => Models.Instance; + public static Config Configs => Instance?.Config; private Capybaras Capybaras; public override void OnEnabled() { @@ -130,7 +133,7 @@ private void OnGenerated() new BlinkingBlock(new(19, 300, -44), new(), new(2, .5f, 2), BlockColor.Red), new BlinkingBlock(new(19, 300, -38), new(), new(2, .5f, 2), BlockColor.Blue) }; - + BlinkingBlocksGroup group = new(list); //Timing.RunCoroutine(ShowPos()); @@ -140,10 +143,9 @@ private IEnumerator ShowPos() { while (true) { - Log.Debug("tick"); foreach(Player p in Player.List) { - Log.Debug(p.Position); + Log.Debug($"{p.Id} position : "+p.Position); } yield return Timing.WaitForSeconds(2); } diff --git a/KruacentExiled/KE.Map/Surface/SupplyDrops/SupplyDrop.cs b/KruacentExiled/KE.Map/Surface/SupplyDrops/SupplyDrop.cs index ddb1d7b9..e5d24e50 100644 --- a/KruacentExiled/KE.Map/Surface/SupplyDrops/SupplyDrop.cs +++ b/KruacentExiled/KE.Map/Surface/SupplyDrops/SupplyDrop.cs @@ -1,19 +1,16 @@ using Exiled.API.Enums; +using Exiled.API.Extensions; using Exiled.API.Features; using Exiled.API.Features.Items; -using Exiled.API.Features.Pickups; using Exiled.API.Features.Toys; using Exiled.API.Interfaces; using KE.Utils.API; -using KE.Utils.Extensions; using MEC; using PlayerRoles; using System; using System.Collections.Generic; using System.Diagnostics; using System.Linq; -using System.Text; -using System.Threading.Tasks; using UnityEngine; namespace KE.Map.Surface.SupplyDrops @@ -58,6 +55,13 @@ public bool Show private static Stopwatch _spawnTime; private static TimeSpan _nextSpawn; private static List list = new(); + public static IReadOnlyCollection SpawnPositions = new List() + { + new(-15,292,-39), //spawn chaos + new(40,301,-52), // above the gate + new(138,295,-64), //behind mtf spawn at the unopenable gate + new(124,289,22) //escape + }; private HashSet primitives = new(); private bool _detectingSomeone = false; @@ -67,6 +71,7 @@ public bool Show public static readonly string CassieMessageDrop = "Drop in surface"; public static readonly string CassieTooMuchStealing = ""; + private static SupplyDrop CurrentDrop = null; private static CoroutineHandle _handle; public SupplyDrop(Vector3 position) { @@ -79,6 +84,8 @@ public SupplyDrop(Vector3 position) var pr = Primitive.Create(PrimitiveType.Sphere, Position, null, new(Radius, Radius, Radius), false, new(0, 1, 0, .30f)); pr.Collidable = false; primitives.Add(pr); + + if (Show) { Cassie.Message(CassieMessageDrop); @@ -88,7 +95,7 @@ public SupplyDrop(Vector3 position) { p.Spawn(); } - + CurrentDrop = this; Timing.RunCoroutine(Detecting()); } @@ -108,8 +115,13 @@ private static IEnumerator Loop() { if (_spawnTime.Elapsed > _nextSpawn) { - _nextSpawn += TimeSpawn; - SpawnRandom(); + _nextSpawn += new TimeSpan(0,0,30); + if(CurrentDrop == null) + { + SpawnRandom(); + } + + Log.Debug("next spawn " + _nextSpawn); } notmax = list.Count <= MaxSupplyDrop; yield return Timing.WaitForSeconds(RefreshRate); @@ -119,14 +131,13 @@ private static IEnumerator Loop() private static void SpawnRandom() { //Todo random lol - Vector3 spawnloc = new(19, 290, -44); - - + Vector3 spawnloc = SpawnPositions.GetRandomValue(); Log.Debug($"spawning drop at {spawnloc}"); SupplyDrop soup = new(spawnloc); } + public void Destroy() { float timeExplode = 10; @@ -135,31 +146,38 @@ public void Destroy() grenade.BurnDuration = timeExplode; grenade.SpawnActive(Position + Vector3.up); - Timing.CallDelayed(timeExplode, () => + foreach (var p in primitives) { - foreach(var p in primitives) - { - p.Destroy(); - } - }); + p.Destroy(); + } + CurrentDrop = null; + } private IEnumerator Detecting() { var s = Stopwatch.StartNew(); + var playerAlreadyIn = Player.List.Where(p => InRadius(p)).ToHashSet(); + _detectingSomeone = true; while (_detectingSomeone && s.Elapsed < TimeStaying) { yield return Timing.WaitForSeconds(RefreshRate); foreach (Player p in Player.List.Where(p=> p.IsAlive)) { - if (OtherUtils.IsInCircle(p.Position,Position,Radius)) + if (!playerAlreadyIn.Contains(p) && InRadius(p)) { Effect(p); _detectingSomeone = false; - Log.Debug($"Player {p.Id} got the supply drop"); - //break; + + } + if (playerAlreadyIn.Contains(p)) + { + if (!InRadius(p)) + { + playerAlreadyIn.Remove(p); + } } } } @@ -167,11 +185,12 @@ private IEnumerator Detecting() Destroy(); } - + private bool InRadius(Player p) => OtherUtils.IsInCircle(p.Position, Position, Radius / 2); + private void Effect(Player p) { - + Log.Debug($"Player {p.Id} got the supply drop"); //todo add trapped drop (explode) SideClaimed = p.Role; PlayerClaimed = p; @@ -190,12 +209,22 @@ private void Effect(Player p) private void SpawnLoot(Player p) { - p.AddItem(ItemType.GunCrossvec); + Faction playerFaction = p.Role.Team.GetFaction(); + Respawn.GrantInfluence(playerFaction, 20); + Respawn.AdvanceTimer(playerFaction, 10); + + Log.Debug("human got it!"); + if (!p.HasItem(ItemType.GunCrossvec)) + { + p.AddItem(ItemType.GunCrossvec); + } + p.AddAmmo(AmmoType.Nato9, 50); } private void BuffScps() { + Log.Debug("scps got it!"); foreach(Player p in Player.List.Where(p => p.IsScp)) { float healthAdded = p.MaxHealth * 1.3f; diff --git a/KruacentExiled/KE.Utils/API/OtherUtils.cs b/KruacentExiled/KE.Utils/API/OtherUtils.cs index 2995a624..ef43b888 100644 --- a/KruacentExiled/KE.Utils/API/OtherUtils.cs +++ b/KruacentExiled/KE.Utils/API/OtherUtils.cs @@ -12,7 +12,7 @@ public static class OtherUtils public static bool IsInCircle(Vector3 pos,Vector3 centerCircle,float radius) { - return Math.Pow(pos.x - centerCircle.x, 2) + Math.Pow(pos.y - centerCircle.y, 2) <= Math.Pow(radius, 2); + return (pos-centerCircle).sqrMagnitude <= Math.Pow(radius, 2); } } } From 00a2d717d2305f6865a8ea389bf7ba7e3356e3a7 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Thu, 10 Jul 2025 22:23:37 +0200 Subject: [PATCH 302/853] pilot + abilities shown --- .../API/Features/GlobalCustomRole.cs | 16 ---- .../KE.CustomRoles/Abilities/Airstrike.cs | 76 +++++++++++++++++ .../Abilities/SelectPosition.cs | 52 ++++++++++++ .../KE.CustomRoles/CR/Human/Alzheimer.cs | 22 ++++- .../KE.CustomRoles/CR/Human/Asthmatique.cs | 24 +++++- KruacentExiled/KE.CustomRoles/CR/MTF/Pilot.cs | 52 ++++++++++++ .../KE.CustomRoles/KE.CustomRoles.csproj | 1 + KruacentExiled/KE.CustomRoles/MainPlugin.cs | 9 ++- .../Patches/ActiveAbilityPatches.cs | 39 +++++++++ .../KE.CustomRoles/Patches/FpcMotorPatches.cs | 41 ++++++++++ .../KE.CustomRoles/Settings/SettingHandler.cs | 81 +++++++++++++++---- .../Displays/DisplayMeow/DisplayHandler.cs | 1 - 12 files changed, 376 insertions(+), 38 deletions(-) create mode 100644 KruacentExiled/KE.CustomRoles/Abilities/Airstrike.cs create mode 100644 KruacentExiled/KE.CustomRoles/Abilities/SelectPosition.cs create mode 100644 KruacentExiled/KE.CustomRoles/CR/MTF/Pilot.cs create mode 100644 KruacentExiled/KE.CustomRoles/Patches/ActiveAbilityPatches.cs create mode 100644 KruacentExiled/KE.CustomRoles/Patches/FpcMotorPatches.cs diff --git a/KruacentExiled/KE.CustomRoles/API/Features/GlobalCustomRole.cs b/KruacentExiled/KE.CustomRoles/API/Features/GlobalCustomRole.cs index c0aebe6b..2cd51436 100644 --- a/KruacentExiled/KE.CustomRoles/API/Features/GlobalCustomRole.cs +++ b/KruacentExiled/KE.CustomRoles/API/Features/GlobalCustomRole.cs @@ -65,13 +65,6 @@ public override void AddRole(Player player) } Log.Debug($"{Name}: Adding role to {player.Nickname}."); TrackedPlayers.Add(player); - foreach(Player p in TrackedPlayers.ToList()) - { - if(p.Id == player.Id) - { - Log.Debug("he is in the tracked"); - } - } @@ -156,15 +149,6 @@ public override void RemoveRole(Player player) { - Log.Debug($"player in {Name}:"); - foreach (Player p in TrackedPlayers.ToList()) - { - if (p.Id == player.Id) - { - Log.Debug($"{p.Id} is in"); - } - } - if (!TrackedPlayers.Contains(player)) { return; diff --git a/KruacentExiled/KE.CustomRoles/Abilities/Airstrike.cs b/KruacentExiled/KE.CustomRoles/Abilities/Airstrike.cs new file mode 100644 index 00000000..a55df2f4 --- /dev/null +++ b/KruacentExiled/KE.CustomRoles/Abilities/Airstrike.cs @@ -0,0 +1,76 @@ +using Exiled.API.Features; +using Exiled.API.Features.Attributes; +using Exiled.API.Features.Items; +using Exiled.API.Features.Pickups.Projectiles; +using Exiled.API.Features.Toys; +using Exiled.CustomRoles.API.Features; +using MapGeneration; +using MEC; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using UnityEngine; +using Light = Exiled.API.Features.Toys.Light; + +namespace KE.CustomRoles.Abilities +{ + [CustomAbility] + public class Airstrike : ActiveAbility + { + public override string Name { get; set; } = "Airstrike"; + + public override string Description { get; set; } = "Don't overuse it or your co-op will not be happy"; + + public override float Duration { get; set; } = 0f; + + public override float Cooldown { get; set; } = 0f; + + public float height = 5; + + + + protected override void AbilityUsed(Player player) + { + if(!SelectPosition.TryGetTarget(player, out Vector3 target)) + { + //show hint + Log.Info("no target selected"); + return; + } + if(target.GetZone() != FacilityZone.Surface) + { + Log.Info("set target surface"); + return; + } + + Physics.Linecast(target, target + height * Vector3.up, out RaycastHit hit); + if (hit.collider != null) + { + Log.Info($"hit something [{hit.collider}]"); + return; + } + + var l = Light.Create(target,null,null,true,Color.red); + + ExplosiveGrenade grenade = (ExplosiveGrenade)Item.Create(ItemType.GrenadeHE,player); + grenade.ScpDamageMultiplier = 1; + grenade.FuseTime = 10; + Timing.CallDelayed(5, () => + { + Projectile gre = grenade.SpawnActive(target + (height - .5f) * Vector3.up); + + //explode on collision + gre.GameObject.AddComponent().Init(player.GameObject, gre.Base); + l.Destroy(); + }); + + + + + } + + + } +} diff --git a/KruacentExiled/KE.CustomRoles/Abilities/SelectPosition.cs b/KruacentExiled/KE.CustomRoles/Abilities/SelectPosition.cs new file mode 100644 index 00000000..b90024b6 --- /dev/null +++ b/KruacentExiled/KE.CustomRoles/Abilities/SelectPosition.cs @@ -0,0 +1,52 @@ +using Exiled.API.Features; +using Exiled.API.Features.Attributes; +using Exiled.CustomRoles.API.Features; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using UnityEngine; + +namespace KE.CustomRoles.Abilities +{ + [CustomAbility] + public class SelectPosition : ActiveAbility + { + public override string Name { get; set; } = "SetPosition"; + + public override string Description { get; set; } = "Select the current position for another ability"; + + public override float Duration { get; set; } = 0f; + + public override float Cooldown { get; set; } = 0; + + + private static Dictionary SelectedTarget = new(); + + protected override void AbilityUsed(Player player) + { + + if (SelectedPlayers.Contains(player)) + { + SelectedTarget[player] = player.Position; + } + else + { + SelectedTarget.Add(player, player.Position); + } + + Log.Info("set position at " +player.Position); + + + } + + public static bool TryGetTarget(Player p, out Vector3 target) + { + return SelectedTarget.TryGetValue(p, out target); + + } + + + } +} diff --git a/KruacentExiled/KE.CustomRoles/CR/Human/Alzheimer.cs b/KruacentExiled/KE.CustomRoles/CR/Human/Alzheimer.cs index b9de337a..55e5c88b 100644 --- a/KruacentExiled/KE.CustomRoles/CR/Human/Alzheimer.cs +++ b/KruacentExiled/KE.CustomRoles/CR/Human/Alzheimer.cs @@ -2,6 +2,7 @@ using Exiled.API.Features; using Exiled.API.Features.Attributes; using Exiled.CustomRoles.API.Features; +using Exiled.Events.EventArgs.Player; using KE.CustomRoles.API.Features; using MEC; using PlayerRoles; @@ -19,7 +20,7 @@ internal class Alzheimer : GlobalCustomRole public override string Description { get; set; } = "Tu es Vieux"; public override uint Id { get; set; } = 1056; public override string PublicName { get; set; } = "Vieux"; - public override bool KeepRoleOnDeath { get; set; } = true; + public override bool KeepRoleOnDeath { get; set; } = false; public override bool KeepRoleOnChangingRole { get; set; } = true; public override float SpawnChance { get; set; } = 100; protected override void RoleAdded(Player player) @@ -36,6 +37,25 @@ protected override void RoleRemoved(Player player) Timing.KillCoroutines(_coroutines[player]); _coroutines.Remove(player); } + protected override void SubscribeEvents() + { + Exiled.Events.Handlers.Player.UsedItem += OnUsedItem; + base.SubscribeEvents(); + } + protected override void UnsubscribeEvents() + { + Exiled.Events.Handlers.Player.UsedItem -= OnUsedItem; + base.UnsubscribeEvents(); + } + + private void OnUsedItem(UsedItemEventArgs ev) + { + if (!Check(ev.Player)) return; + if (ev.Item.Type == ItemType.SCP500) + { + RemoveRole(ev.Player); + } + } private IEnumerator Teleport(Player p) diff --git a/KruacentExiled/KE.CustomRoles/CR/Human/Asthmatique.cs b/KruacentExiled/KE.CustomRoles/CR/Human/Asthmatique.cs index f3a1d136..a2cc6966 100644 --- a/KruacentExiled/KE.CustomRoles/CR/Human/Asthmatique.cs +++ b/KruacentExiled/KE.CustomRoles/CR/Human/Asthmatique.cs @@ -2,6 +2,7 @@ using Exiled.API.Features; using Exiled.API.Features.Attributes; using Exiled.CustomRoles.API.Features; +using Exiled.Events.EventArgs.Player; using KE.CustomRoles.API.Features; using PlayerRoles; using UnityEngine; @@ -16,10 +17,31 @@ internal class Asthmatique : GlobalCustomRole public override string Description { get; set; } = "Tu es asthmatique\nT'as stamina est réduit de moitié\nMais tu vises mieux"; public override uint Id { get; set; } = 1042; public override string PublicName { get; set; } = "Asthmatique"; - public override bool KeepRoleOnDeath { get; set; } = true; + public override bool KeepRoleOnDeath { get; set; } = false; public override bool KeepRoleOnChangingRole { get; set; } = true; public override float SpawnChance { get; set; } = 100; + + protected override void SubscribeEvents() + { + Exiled.Events.Handlers.Player.UsedItem += OnUsedItem; + base.SubscribeEvents(); + } + protected override void UnsubscribeEvents() + { + Exiled.Events.Handlers.Player.UsedItem -= OnUsedItem; + base.UnsubscribeEvents(); + } + + private void OnUsedItem(UsedItemEventArgs ev) + { + if (!Check(ev.Player)) return; + if(ev.Item.Type == ItemType.SCP500) + { + RemoveRole(ev.Player); + } + } + protected override void RoleAdded(Player player) { player.EnableEffect(EffectType.Scp1853, -1, true); diff --git a/KruacentExiled/KE.CustomRoles/CR/MTF/Pilot.cs b/KruacentExiled/KE.CustomRoles/CR/MTF/Pilot.cs new file mode 100644 index 00000000..7857fdac --- /dev/null +++ b/KruacentExiled/KE.CustomRoles/CR/MTF/Pilot.cs @@ -0,0 +1,52 @@ +using Exiled.API.Enums; +using Exiled.API.Features.Attributes; +using Exiled.CustomRoles.API.Features; +using KE.CustomRoles.Abilities; +using KE.CustomRoles.API.Features; +using PlayerRoles; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace KE.CustomRoles.CR.MTF +{ + [CustomRole(RoleTypeId.NtfPrivate)] + public class Pilot : KECustomRole + { + public override string Description { get; set; } = "So I haveth a Laser Pointere"; + public override uint Id { get; set; } = 1088; + public override string PublicName { get; set; } = "Pilot"; + public override int MaxHealth { get; set; } = 75; + public override RoleTypeId Role { get; set; } = RoleTypeId.NtfPrivate; + public override bool KeepRoleOnDeath { get; set; } = false; + public override bool KeepRoleOnChangingRole { get; set; } = false; + + public override float SpawnChance { get; set; } = 100; + + public override List Inventory { get; set; } = new List() + { + $"{ItemType.GunCrossvec}", + $"{ItemType.KeycardMTFOperative}", + $"{ItemType.Radio}", + $"{ItemType.ArmorCombat}", + $"{ItemType.Medkit}" + }; + + public override Dictionary Ammo { get; set; } = new Dictionary() + { + { AmmoType.Nato9, 100} + }; + + + public override List CustomAbilities { get; set; } = new() + { + new SelectPosition(), + new Airstrike() + }; + + + + } +} diff --git a/KruacentExiled/KE.CustomRoles/KE.CustomRoles.csproj b/KruacentExiled/KE.CustomRoles/KE.CustomRoles.csproj index 3cb11af8..4bf4603a 100644 --- a/KruacentExiled/KE.CustomRoles/KE.CustomRoles.csproj +++ b/KruacentExiled/KE.CustomRoles/KE.CustomRoles.csproj @@ -19,6 +19,7 @@ + diff --git a/KruacentExiled/KE.CustomRoles/MainPlugin.cs b/KruacentExiled/KE.CustomRoles/MainPlugin.cs index 7d7b1623..238c4a0b 100644 --- a/KruacentExiled/KE.CustomRoles/MainPlugin.cs +++ b/KruacentExiled/KE.CustomRoles/MainPlugin.cs @@ -3,6 +3,7 @@ using Exiled.API.Interfaces; using Exiled.CustomRoles.API.Features; using Exiled.Events.EventArgs.Server; +using HarmonyLib; using KE.CustomRoles.Settings; using KE.Utils.API.Displays.DisplayMeow; using MEC; @@ -20,10 +21,13 @@ public class MainPlugin : Plugin private Controller _controller; public static readonly HintPlacement CRHint = new(0, 750); public static readonly HintPlacement CREffect = new(700, 300); + public static readonly HintPlacement Abilities = new(0, 900,HintServiceMeow.Core.Enum.HintAlignment.Left); public static Translations Translations => Instance?.Translation; private SettingHandler _settingHandler; internal static SettingHandler SettingHandler => Instance?._settingHandler; + private Harmony Harmony; + public override void OnEnabled() { @@ -31,7 +35,8 @@ public override void OnEnabled() _controller = new Controller(); _settingHandler = new(); - + Harmony = new(Name); + Harmony.PatchAll(); SettingHandler.SubscribeEvents(); CustomRole.RegisterRoles(false,null,true,Assembly); this.SubscribeEvents(); @@ -43,7 +48,7 @@ public override void OnDisabled() CustomRole.UnregisterRoles(); SettingHandler.UnsubscribeEvents(); - + Harmony.UnpatchAll(); this.UnsubscribeEvents(); _settingHandler = null; diff --git a/KruacentExiled/KE.CustomRoles/Patches/ActiveAbilityPatches.cs b/KruacentExiled/KE.CustomRoles/Patches/ActiveAbilityPatches.cs new file mode 100644 index 00000000..7a717da6 --- /dev/null +++ b/KruacentExiled/KE.CustomRoles/Patches/ActiveAbilityPatches.cs @@ -0,0 +1,39 @@ +using Exiled.API.Features; +using Exiled.CustomRoles.API.Features; +using HarmonyLib; +using KE.Utils.API.Displays.DisplayMeow; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace KE.CustomRoles.Patches +{ + public static class ActiveAbilityPatches + { + [HarmonyPatch(typeof(ActiveAbility),nameof(ActiveAbility.UseAbility))] + public static class UseAbilityPatch + { + public static void Prefix(ActiveAbility __instance, Player player) + { + string msg = "Using "+__instance.Name; + + DisplayHandler.Instance.AddHint(MainPlugin.Abilities, player, msg, 5); + } + } + [HarmonyPatch(typeof(ActiveAbility), nameof(ActiveAbility.SelectAbility))] + public static class SelectAbilityPatch + { + public static void Prefix(ActiveAbility __instance, Player player) + { + string msg = __instance.Name + "\n" + __instance.Description; + + DisplayHandler.Instance.AddHint(MainPlugin.Abilities, player, msg, 5); + } + } + + + + } +} diff --git a/KruacentExiled/KE.CustomRoles/Patches/FpcMotorPatches.cs b/KruacentExiled/KE.CustomRoles/Patches/FpcMotorPatches.cs new file mode 100644 index 00000000..59e4c427 --- /dev/null +++ b/KruacentExiled/KE.CustomRoles/Patches/FpcMotorPatches.cs @@ -0,0 +1,41 @@ +using HarmonyLib; +using PlayerRoles.FirstPersonControl; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using UnityEngine; + +namespace KE.CustomRoles.Patches +{ + public static class FpcMotorPatches + { + //me when slowness 200 + + //[HarmonyPatch(typeof(FpcMotor),nameof(FpcMotor.DesiredMove),MethodType.Getter)] + public static class DesiredMovePatch + { + [HarmonyPostfix] + public static void Postfix(FpcMotor __instance,ref Vector3 __result) + { + __result = new(__result.x * -1, __result.y, __result.z * -1); + } + + + } + + //[HarmonyPatch(typeof(FpcMotor), nameof(FpcMotor.GetFrameMove), MethodType.Normal)] + public static class GetFrameMovePatch + { + [HarmonyPostfix] + public static void Postfix(FpcMotor __instance, ref Vector3 __result) + { + __result = new(__result.x * -1, __result.y, __result.z * -1); + } + + + } + + } +} diff --git a/KruacentExiled/KE.CustomRoles/Settings/SettingHandler.cs b/KruacentExiled/KE.CustomRoles/Settings/SettingHandler.cs index b8d127fb..e2c3b022 100644 --- a/KruacentExiled/KE.CustomRoles/Settings/SettingHandler.cs +++ b/KruacentExiled/KE.CustomRoles/Settings/SettingHandler.cs @@ -3,6 +3,7 @@ using Exiled.API.Features.Pools; using Exiled.CustomRoles.API; using Exiled.CustomRoles.API.Features; +using Exiled.CustomRoles.API.Features.Enums; using Exiled.Events.EventArgs.Player; using KE.Utils.API.Interfaces; using System; @@ -41,14 +42,14 @@ public SettingHandler() public void SubscribeEvents() { SettingBase.Register(settings); - ServerSpecificSettingsSync.ServerOnSettingValueReceived += OnSettingValueReceived; + ServerSpecificSettingsSync.ServerOnSettingValueReceived += SafeOnSettingValueReceived; Exiled.Events.Handlers.Player.Verified += OnVerified; } public void UnsubscribeEvents() { - ServerSpecificSettingsSync.ServerOnSettingValueReceived -= OnSettingValueReceived; + ServerSpecificSettingsSync.ServerOnSettingValueReceived -= SafeOnSettingValueReceived; Exiled.Events.Handlers.Player.Verified -= OnVerified; SettingBase.Unregister(predicate:null, settings); } @@ -60,36 +61,59 @@ private void OnVerified(VerifiedEventArgs ev) ServerSpecificSettingsSync.SendToPlayer(ev.Player.ReferenceHub); } + + private void SafeOnSettingValueReceived(ReferenceHub hub, ServerSpecificSettingBase settingBase) + { + try + { + OnSettingValueReceived( hub, settingBase); + } + catch(Exception e) + { + Log.Error(e); + } + } + private void OnSettingValueReceived(ReferenceHub hub, ServerSpecificSettingBase settingBase) { - - if(settingBase == null) + if (settingBase == null) { Log.Debug("setting null whar?"); + return; } Player p = Player.Get(hub); - + if(p == null) + { + Log.Debug("no player"); + return; + } + //Log.Debug("get abilities"); IEnumerable a = p.GetActiveAbilities(); if(a == null) { - Log.Debug("no abilities 1"); + //Log.Debug("no abilities 1"); return; } - - + List abilities = ListPool.Pool.Get(a); - ActiveAbility currentAbility = p.GetSelectedAbility(); - ActiveAbility want = null; - + if (abilities.Count == 0) { - Log.Debug("no abilities 2"); + //Log.Debug("no abilities 2"); return; } - int index = 0; + //Log.Debug($" (prev : {abilities.Count}) get selected abilities"); + ActiveAbility currentAbility = GetSelectedAbility(p); + //Log.Debug("finish selected"); + ActiveAbility want = null; + + + int index = 0; + + //Log.Debug($" (prev : {currentAbility?.Name}) check press forward"); if (CheckPressed(settingBase, switchForwardId)) { if (currentAbility != null) @@ -101,6 +125,7 @@ private void OnSettingValueReceived(ReferenceHub hub, ServerSpecificSettingBase } + //Log.Debug($" check press backward"); if (CheckPressed(settingBase, switchBackwardId)) { if (currentAbility != null) @@ -120,11 +145,11 @@ private void OnSettingValueReceived(ReferenceHub hub, ServerSpecificSettingBase } - + //Log.Debug($"select ability"); want?.SelectAbility(p); - currentAbility = p.GetSelectedAbility(); - Log.Debug(currentAbility.Name); + currentAbility = GetSelectedAbility(p); + //Log.Debug(currentAbility.Name); if (CheckPressed(settingBase,_idkeybind)) { if (CanUse(currentAbility,p, out var result)) @@ -132,10 +157,32 @@ private void OnSettingValueReceived(ReferenceHub hub, ServerSpecificSettingBase currentAbility.UseAbility(p); } - Log.Debug(result); } + Log.Debug(currentAbility?.Name); } + public static ActiveAbility GetSelectedAbility(Player player) + { + Player player2 = player; + if (ActiveAbility.AllActiveAbilities.TryGetValue(player2, out HashSet value)) + { + //Log.Debug("got all abilities"); + // ActiveAbility sel = value.FirstOrDefault((ActiveAbility a) => a.Check(player2, CheckType.Selected)); + + foreach(ActiveAbility a in value) + { + //Log.Debug("checking "+ a?.Name); + if (a?.Check(player2, CheckType.Selected) ?? false) + { + //Log.Debug("found " + a.Name); + return a; + } + //Log.Debug("finish checking"); + } + } + + return null; + } private bool CanUse(ActiveAbility a, Player player, out string result) { diff --git a/KruacentExiled/KE.Utils/API/Displays/DisplayMeow/DisplayHandler.cs b/KruacentExiled/KE.Utils/API/Displays/DisplayMeow/DisplayHandler.cs index 4ee13535..1322a6c5 100644 --- a/KruacentExiled/KE.Utils/API/Displays/DisplayMeow/DisplayHandler.cs +++ b/KruacentExiled/KE.Utils/API/Displays/DisplayMeow/DisplayHandler.cs @@ -20,7 +20,6 @@ private DisplayHandler() { } - public MHint AddHint(HintPlacement hintPlacement, Player player, string text, float delay) { var dis = PlayerDisplay.Get(player); From 24d9b7f19fa384fb3cafca363329051d774d6cc7 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Sun, 13 Jul 2025 16:37:13 +0200 Subject: [PATCH 303/853] added negotiator + buffed GambleAddict & ZoneManager --- .../KE.CustomRoles/Abilities/Convert.cs | 52 ++++++++++++ .../KE.CustomRoles/Abilities/Trade.cs | 55 ++++++++++++ .../CR/ChaosInsurgency/Negotiator.cs | 67 +++++++++++++++ .../CR/Scientist/GambleAddict.cs | 13 ++- .../CR/Scientist/ZoneManager.cs | 84 ++++++++++++++++++- 5 files changed, 263 insertions(+), 8 deletions(-) create mode 100644 KruacentExiled/KE.CustomRoles/Abilities/Convert.cs create mode 100644 KruacentExiled/KE.CustomRoles/Abilities/Trade.cs create mode 100644 KruacentExiled/KE.CustomRoles/CR/ChaosInsurgency/Negotiator.cs diff --git a/KruacentExiled/KE.CustomRoles/Abilities/Convert.cs b/KruacentExiled/KE.CustomRoles/Abilities/Convert.cs new file mode 100644 index 00000000..301ebf63 --- /dev/null +++ b/KruacentExiled/KE.CustomRoles/Abilities/Convert.cs @@ -0,0 +1,52 @@ +using Exiled.API.Features; +using Exiled.API.Features.Attributes; +using Exiled.CustomRoles.API.Features; +using PlayerRoles; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using UnityEngine; + +namespace KE.CustomRoles.Abilities +{ + [CustomAbility] + public class Convert : ActiveAbility + { + public override string Name { get; set; } = "Convert"; + + public override string Description { get; set; } = ""; + + public override float Duration { get; set; } = 0f; + + public override float Cooldown { get; set; } = 10*60f; + + public float MaxDistance { get; set; } = 5f; + + protected override void AbilityUsed(Player player) + { + Physics.Linecast(player.Position, player.Position + player.Rotation.eulerAngles * MaxDistance,out RaycastHit hit); + + Player playerHit = Player.Get(hit.collider); + + if (playerHit == null) return; + + if (playerHit.Role.Side == player.Role.Side) return; + + if (playerHit.IsScp && playerHit.Role != RoleTypeId.Scp0492) return; + + + if (playerHit.IsScp) + { + playerHit.Role.Set(player.Role, RoleSpawnFlags.AssignInventory); + } + else + { + playerHit.Role.Set(player.Role, RoleSpawnFlags.None); + } + + } + + } +} diff --git a/KruacentExiled/KE.CustomRoles/Abilities/Trade.cs b/KruacentExiled/KE.CustomRoles/Abilities/Trade.cs new file mode 100644 index 00000000..e64fa9ec --- /dev/null +++ b/KruacentExiled/KE.CustomRoles/Abilities/Trade.cs @@ -0,0 +1,55 @@ +using Exiled.API.Features; +using Exiled.API.Features.Attributes; +using Exiled.CustomRoles.API.Features; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using UnityEngine; + +namespace KE.CustomRoles.Abilities +{ + [CustomAbility] + public class Trade : ActiveAbility + { + public override string Name { get; set; } = "Trade"; + + public override string Description { get; set; } = "T'es lien avec le casino t'as permis d'avoir un peu plus de pièce contre un item ou pire"; + + public override float Duration { get; set; } = 0f; + + public override float Cooldown { get; set; } = 1f; + + public static float MaxHealthPercent = .1f; + + protected override void AbilityUsed(Player player) + { + if (player.CurrentItem != null) + { + player.RemoveItem(player.CurrentItem); + } + else + { + float newMaxHealth = player.MaxHealth - player.MaxHealth * MaxHealthPercent; + if (newMaxHealth > 0) + { + player.MaxHealth = newMaxHealth; + player.Health = Mathf.Min(player.Health, player.MaxHealth); + } + else + { + player.Kill("The casino always win"); + return; + } + } + + player.AddItem(ItemType.Coin); + + + + + } + + } +} diff --git a/KruacentExiled/KE.CustomRoles/CR/ChaosInsurgency/Negotiator.cs b/KruacentExiled/KE.CustomRoles/CR/ChaosInsurgency/Negotiator.cs new file mode 100644 index 00000000..8b9eb7d1 --- /dev/null +++ b/KruacentExiled/KE.CustomRoles/CR/ChaosInsurgency/Negotiator.cs @@ -0,0 +1,67 @@ +using Exiled.API.Enums; +using Exiled.API.Features; +using Exiled.API.Features.Attributes; +using Exiled.CustomRoles.API.Features; +using Exiled.Events.EventArgs.Player; +using KE.CustomRoles.API.Features; +using MEC; +using PlayerRoles; +using System.Collections.Generic; +using UnityEngine; + +namespace KE.CustomRoles.CR.ChaosInsurgency +{ + [CustomRole(RoleTypeId.ChaosConscript)] + internal class Negotiator : KECustomRole + { + public override string Description { get; set; } = "Who knew zombie could be so great listeners"; + public override uint Id { get; set; } = 1071; + public override string PublicName { get; set; } = "Negotiator"; + public override int MaxHealth { get; set; } = 100; + public override RoleTypeId Role { get; set; } = RoleTypeId.ChaosConscript; + public override bool KeepRoleOnDeath { get; set; } = false; + public override bool KeepRoleOnChangingRole { get; set; } = false; + + public override float SpawnChance { get; set; } = 100; + + public override List CustomAbilities { get; set; } = new() + { + + }; + + protected override void RoleAdded(Player player) + { + Timing.CallDelayed(.1f, delegate + { + player.AddItem(ItemType.Radio); + }); + } + + protected override void SubscribeEvents() + { + Exiled.Events.Handlers.Player.Hurting += OnHurting; + base.SubscribeEvents(); + } + + protected override void UnsubscribeEvents() + { + Exiled.Events.Handlers.Player.Hurting -= OnHurting; + base.UnsubscribeEvents(); + } + + + private void OnHurting(HurtingEventArgs ev) + { + if (!Check(ev.Player)) return; + if (!ev.IsAllowed) return; + + if(ev.Attacker.Role.Side == ev.Player.Role.Side) + { + ev.IsAllowed = false; + } + + } + + + } +} diff --git a/KruacentExiled/KE.CustomRoles/CR/Scientist/GambleAddict.cs b/KruacentExiled/KE.CustomRoles/CR/Scientist/GambleAddict.cs index a8f350bf..db3c0f6b 100644 --- a/KruacentExiled/KE.CustomRoles/CR/Scientist/GambleAddict.cs +++ b/KruacentExiled/KE.CustomRoles/CR/Scientist/GambleAddict.cs @@ -1,4 +1,6 @@ using Exiled.API.Features.Attributes; +using Exiled.CustomRoles.API.Features; +using KE.CustomRoles.Abilities; using KE.CustomRoles.API.Features; using PlayerRoles; using System.Collections.Generic; @@ -9,7 +11,7 @@ namespace KE.CustomRoles.CR.Scientist [CustomRole(RoleTypeId.Scientist)] internal class GambleAddict : KECustomRole { - public override string Description { get; set; } = "Tu es un Gamble Addict \nT'as trade ton kit et ta carte contre 4 pièces \nfais en bon usage"; + public override string Description { get; set; } = "Tu es un Gamble Addict \nT'as trade ton kit et ta carte contre 2 pièces \nfais en bon usage"; public override uint Id { get; set; } = 1043; public override string PublicName { get; set; } = "Gamble Addict"; public override int MaxHealth { get; set; } = 100; @@ -21,11 +23,14 @@ internal class GambleAddict : KECustomRole public override Vector3 Scale { get; set; } = new Vector3(1, 1, 1); public override List Inventory { get; set; } = new List() - { + { $"{ItemType.Coin}", $"{ItemType.Coin}", - $"{ItemType.Coin}", - $"{ItemType.Coin}" + }; + + public override List CustomAbilities { get; set; } = new() + { + new Trade() }; } } diff --git a/KruacentExiled/KE.CustomRoles/CR/Scientist/ZoneManager.cs b/KruacentExiled/KE.CustomRoles/CR/Scientist/ZoneManager.cs index cc978844..52350617 100644 --- a/KruacentExiled/KE.CustomRoles/CR/Scientist/ZoneManager.cs +++ b/KruacentExiled/KE.CustomRoles/CR/Scientist/ZoneManager.cs @@ -1,9 +1,15 @@ -using Exiled.API.Features.Attributes; +using Exiled.API.Enums; +using Exiled.API.Features; +using Exiled.API.Features.Attributes; +using Exiled.API.Features.Doors; +using Exiled.API.Features.Items; using Exiled.API.Features.Spawn; +using Exiled.Events.EventArgs.Player; using InventorySystem.Items.Keycards; using KE.CustomRoles.API.Features; using PlayerRoles; using System.Collections.Generic; +using System.Linq; using UnityEngine; namespace KE.CustomRoles.CR.Scientist @@ -11,7 +17,7 @@ namespace KE.CustomRoles.CR.Scientist [CustomRole(RoleTypeId.Scientist)] internal class ZoneManager : KECustomRole { - public override string Description { get; set; } = "Tu es un Zone Manager \nT'as une carte de zone manager (d'où le nom) \nTu commences à heavy \nBon courage..."; + public override string Description { get; set; } = "Incroyable tu peux avoir une promotion alors fais ton boulot et ouvre tous ces checkpoint et tu pourras sortir d'ici"; public override uint Id { get; set; } = 1044; public override string PublicName { get; set; } = "Zone Manager"; public override int MaxHealth { get; set; } = 100; @@ -19,6 +25,7 @@ internal class ZoneManager : KECustomRole public override bool KeepRoleOnDeath { get; set; } = false; public override bool KeepRoleOnChangingRole { get; set; } = false; + public override float SpawnChance { get; set; } = 100; public override SpawnProperties SpawnProperties { get; set; } = new SpawnProperties() @@ -27,17 +34,86 @@ internal class ZoneManager : KECustomRole { new DynamicSpawnPoint() { - Location = Exiled.API.Enums.SpawnLocationType.InsideHidUpper, + Location = SpawnLocationType.InsideHidUpper, Chance = 100, } } }; public override List Inventory { get; set; } = new List() - { + { $"{ItemType.Medkit}", $"{ItemType.Adrenaline}", $"{ItemType.KeycardZoneManager}" }; + public static readonly List DoorToOpen = new() + { + DoorType.CheckpointLczA, + DoorType.CheckpointLczB, + DoorType.CheckpointEzHczA, + DoorType.CheckpointEzHczB + }; + + + private static Dictionary> objectives = new(); + private static Dictionary flag = new(); + + protected override void SubscribeEvents() + { + + Exiled.Events.Handlers.Player.InteractingDoor += OnInteractingDoor; + base.SubscribeEvents(); + } + + protected override void UnsubscribeEvents() + { + Exiled.Events.Handlers.Player.InteractingDoor -= OnInteractingDoor; + base.UnsubscribeEvents(); + } + + protected override void RoleAdded(Player player) + { + objectives.Add(player, new(DoorToOpen)); + flag.Add(player, false); + } + protected override void RoleRemoved(Player player) + { + objectives.Remove(player); + flag.Remove(player); + } + + + private void OnInteractingDoor(InteractingDoorEventArgs ev) + { + Player player = ev.Player; + if (!Check(player)) return; + objectives[player].Remove(ev.Door.Type); + + if (CheckDoors(player)) + { + bool equipped = player.CurrentItem.Type == ItemType.KeycardFacilityManager; + Item zoneKeycard = player.Items.Where(p => p.Type == ItemType.KeycardFacilityManager).ElementAtOrDefault(0); + if (zoneKeycard != null) + { + zoneKeycard.Destroy(); + } + + player.AddItem(ItemType.Radio); + flag[player] = true; + Item engineerKeycard = player.AddItem(ItemType.KeycardFacilityManager); + if (equipped) + { + player.CurrentItem = engineerKeycard; + } + } + + } + + private bool CheckDoors(Player p) + { + if (flag[p]) return false; + return objectives[p].Count == 0; + } + } } From 0782fb373075e8babc1fcc545f8203f58e297e1f Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Wed, 16 Jul 2025 22:08:11 +0200 Subject: [PATCH 304/853] can now save and load models yippee + some turret thingy --- KruacentExiled/KE.Map/Command.cs | 15 ++-- KruacentExiled/KE.Map/MainPlugin.cs | 8 +- .../KE.Map/Surface/Turrets/Turret.cs | 23 +++++ .../Models/Blueprints/AdminToyBlueprint.cs | 5 +- .../API/Models/Blueprints/ModelBlueprint.cs | 62 ++++++------- .../Models/Blueprints/PrimitiveBlueprint.cs | 6 +- .../API/Models/Commands/AllCommands.cs | 33 +++++++ .../KE.Utils/API/Models/Commands/ListModel.cs | 4 +- .../KE.Utils/API/Models/Commands/LoadModel.cs | 23 +++-- .../KE.Utils/API/Models/Commands/SaveModel.cs | 47 ++++++++++ .../API/Models/Commands/SelectModel.cs | 8 +- KruacentExiled/KE.Utils/API/Models/Model.cs | 86 ++++++------------- .../KE.Utils/API/Models/ModelCreator.cs | 28 +++--- .../KE.Utils/API/Models/ModelLoader.cs | 19 ++-- .../KE.Utils/API/Models/SelectedModel.cs | 4 +- .../KE.Utils/Extensions/NpcExtension.cs | 23 +++++ 16 files changed, 245 insertions(+), 149 deletions(-) create mode 100644 KruacentExiled/KE.Map/Surface/Turrets/Turret.cs create mode 100644 KruacentExiled/KE.Utils/API/Models/Commands/AllCommands.cs create mode 100644 KruacentExiled/KE.Utils/API/Models/Commands/SaveModel.cs create mode 100644 KruacentExiled/KE.Utils/Extensions/NpcExtension.cs diff --git a/KruacentExiled/KE.Map/Command.cs b/KruacentExiled/KE.Map/Command.cs index 56708b13..ced4ef83 100644 --- a/KruacentExiled/KE.Map/Command.cs +++ b/KruacentExiled/KE.Map/Command.cs @@ -26,17 +26,14 @@ public ModelParent() public override void LoadGeneratedCommands() { - RegisterCommand(new CreateModel()); - RegisterCommand(new CreatePrim()); - RegisterCommand(new ListModel()); - RegisterCommand(new LoadModel()); - RegisterCommand(new ModeMovePrim()); - RegisterCommand(new SelectModel()); - RegisterCommand(new ShowCenter()); - RegisterCommand(new ChangePrimType()); - RegisterCommand(new ChangeColor()); + foreach (ICommand command in KE.Utils.API.Models.Commands.AllCommands.Get()) + { + RegisterCommand(command); + } } + + protected override bool ExecuteParent(ArraySegment arguments, ICommandSender sender, out string response) { response = "\n"; diff --git a/KruacentExiled/KE.Map/MainPlugin.cs b/KruacentExiled/KE.Map/MainPlugin.cs index 155cb3fc..4331eeaf 100644 --- a/KruacentExiled/KE.Map/MainPlugin.cs +++ b/KruacentExiled/KE.Map/MainPlugin.cs @@ -3,6 +3,7 @@ using Exiled.API.Features; using Exiled.API.Features.Doors; using Exiled.API.Features.Roles; +using Exiled.API.Features.Toys; using Exiled.API.Interfaces; using Exiled.Events.EventArgs.Player; using Exiled.Events.EventArgs.Server; @@ -12,13 +13,17 @@ using KE.Map.GamblingZone; using KE.Map.Surface.BlinkingBlocks; using KE.Map.Surface.SupplyDrops; +using KE.Map.Surface.Turrets; using KE.Map.Utils; using KE.Utils.API.Models; +using KE.Utils.API.Models.Blueprints; using MEC; using PlayerRoles; using PlayerRoles.FirstPersonControl; using Respawning; using System.Collections.Generic; +using System.IO; +using System.Reflection; using UnityEngine; namespace KE.Map @@ -70,7 +75,7 @@ public override void OnDisabled() private void OnGenerated() { - + Turret t = new(); Door lcz173 = Door.Get(Exiled.API.Enums.DoorType.Scp173Gate); HashSet normal = new() { @@ -159,6 +164,7 @@ private void OnRoundEnded(RoundEndedEventArgs ev) foreach (var g in OldGamblingRoom.List) g.UnsubscribeEvents(); } + } diff --git a/KruacentExiled/KE.Map/Surface/Turrets/Turret.cs b/KruacentExiled/KE.Map/Surface/Turrets/Turret.cs new file mode 100644 index 00000000..0f9d420e --- /dev/null +++ b/KruacentExiled/KE.Map/Surface/Turrets/Turret.cs @@ -0,0 +1,23 @@ +using Exiled.API.Extensions; +using Exiled.API.Features; +using KE.Utils.Extensions; + + +namespace KE.Map.Surface.Turrets +{ + public class Turret + { + + public Turret() + { + Npc npc = Npc.Spawn("Turret1"); + npc.Hide(); + + + + + + + } + } +} diff --git a/KruacentExiled/KE.Utils/API/Models/Blueprints/AdminToyBlueprint.cs b/KruacentExiled/KE.Utils/API/Models/Blueprints/AdminToyBlueprint.cs index 6cd11e0e..ccfcff3d 100644 --- a/KruacentExiled/KE.Utils/API/Models/Blueprints/AdminToyBlueprint.cs +++ b/KruacentExiled/KE.Utils/API/Models/Blueprints/AdminToyBlueprint.cs @@ -21,7 +21,7 @@ public abstract class AdminToyBlueprint : ILoadable public Vector3 Scale { get; protected set; } - public static AdminToyBlueprint Create(AdminToy adminToy,Vector3 center) + public static AdminToyBlueprint Create(AdminToy adminToy, Vector3? center = null) { AdminToyBlueprint result; @@ -29,6 +29,7 @@ public static AdminToyBlueprint Create(AdminToy adminToy,Vector3 center) if (adminToy.ToyType == AdminToyType.PrimitiveObject) { result = new PrimitiveBlueprint(adminToy as Primitive); + } else if(adminToy.ToyType == AdminToyType.LightSource) { @@ -39,7 +40,7 @@ public static AdminToyBlueprint Create(AdminToy adminToy,Vector3 center) throw new NotImplementedException("only primitive and light"); } - result.Position = adminToy.Position - center; + result.Position = adminToy.Position - center ?? adminToy.Position; result.Rotation = adminToy.Rotation.eulerAngles; return result; diff --git a/KruacentExiled/KE.Utils/API/Models/Blueprints/ModelBlueprint.cs b/KruacentExiled/KE.Utils/API/Models/Blueprints/ModelBlueprint.cs index 30a0e7b8..0f3a047c 100644 --- a/KruacentExiled/KE.Utils/API/Models/Blueprints/ModelBlueprint.cs +++ b/KruacentExiled/KE.Utils/API/Models/Blueprints/ModelBlueprint.cs @@ -5,6 +5,7 @@ using Exiled.API.Structs; using KE.Utils.API.Models.ToysSettings; using KE.Utils.Quality.Models; +using System; using System.Collections.Generic; using System.Linq; using System.Runtime.InteropServices; @@ -25,12 +26,6 @@ public string Name get { return _name; } } - private int _id; - public int Id - { - get { return _id; } - } - private ModelBlueprint() { } @@ -39,21 +34,16 @@ private ModelBlueprint() { } /// ///
/// - /// if > 0 overwrite same id bp /// - public static ModelBlueprint Create(Model model, int id = -1) + public static ModelBlueprint Create(Model model) { - if(id != -1) - { - - var oldMbp = Get(id); - _bps.Remove(oldMbp); - } + var oldMbp = Get(model.Name); + _bps.Remove(oldMbp); ModelBlueprint mbp = new(); + mbp._name = model.Name; _bps.Add(mbp); - mbp._id = _bps.Count; foreach(AdminToy toy in model.Toys) { @@ -64,29 +54,43 @@ public static ModelBlueprint Create(Model model, int id = -1) } - public static ModelBlueprint Create(string name) + public static ModelBlueprint Create(string name,IEnumerable toys = null) { ModelBlueprint mbp = new(); _bps.Add(mbp); - mbp._id = _bps.Count; if (string.IsNullOrEmpty(name)) { - mbp._name = "Model" + mbp.Id; + throw new ArgumentException("name null or empty"); } - else + + if(toys != null) { - mbp._name = name; + foreach(AdminToy at in toys) + { + mbp._toys.Add(AdminToyBlueprint.Create(at)); + } } + + + mbp._name = name; + return mbp; } + public void Spawn(Vector3 position) + { + Model m = Model.Create(this, position,false); + + + } + #region getters public static ModelBlueprint Get(string name) { - foreach (ModelBlueprint m in _bps) + foreach (ModelBlueprint m in Blueprints) { if (m.Name == name) { @@ -96,22 +100,6 @@ public static ModelBlueprint Get(string name) return null; } - - public static ModelBlueprint Get(int id) - { - foreach (ModelBlueprint m in _bps) - { - if (m.Id == id) - return m; - } - return null; - } - public static bool TryGet(int id, out ModelBlueprint model) - { - model = Get(id); - return model != null; - } - public static bool TryGet(string name, out ModelBlueprint model) { model = Get(name); diff --git a/KruacentExiled/KE.Utils/API/Models/Blueprints/PrimitiveBlueprint.cs b/KruacentExiled/KE.Utils/API/Models/Blueprints/PrimitiveBlueprint.cs index 8308ba39..2e59f30a 100644 --- a/KruacentExiled/KE.Utils/API/Models/Blueprints/PrimitiveBlueprint.cs +++ b/KruacentExiled/KE.Utils/API/Models/Blueprints/PrimitiveBlueprint.cs @@ -8,7 +8,6 @@ public class PrimitiveBlueprint : AdminToyBlueprint { public Color Color { get; } public PrimitiveType Type { get; } - public bool Collidable { get; } public PrimitiveBlueprint(Primitive p) @@ -18,7 +17,6 @@ public PrimitiveBlueprint(Primitive p) Scale = p.Scale; Color = p.Color; Type = p.Type; - Collidable = p.Collidable; } @@ -26,7 +24,7 @@ public PrimitiveBlueprint(Primitive p) public override AdminToy Spawn(Vector3 center) { var p = Primitive.Create(Type,Position+center, Rotation, Scale, false); - p.Collidable = Collidable; + p.Collidable = false; p.Color = Color; @@ -35,7 +33,7 @@ public override AdminToy Spawn(Vector3 center) protected override string Load(char separator) { - return "#" + ColorUtility.ToHtmlStringRGBA(Color) + separator+Type+separator+Collidable; + return "#" + ColorUtility.ToHtmlStringRGBA(Color) + separator+Type; } } } diff --git a/KruacentExiled/KE.Utils/API/Models/Commands/AllCommands.cs b/KruacentExiled/KE.Utils/API/Models/Commands/AllCommands.cs new file mode 100644 index 00000000..8ba12e68 --- /dev/null +++ b/KruacentExiled/KE.Utils/API/Models/Commands/AllCommands.cs @@ -0,0 +1,33 @@ +using CommandSystem; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Reflection; +using System.Text; +using System.Threading.Tasks; + +namespace KE.Utils.API.Models.Commands +{ + public static class AllCommands + { + + public static IEnumerable Get(Assembly assembly = null) + { + return new List() + { + new ChangeColor(), + new ChangePrimType(), + new CreateModel(), + new CreatePrim(), + new ListModel(), + new LoadModel(), + new ModeMovePrim(), + new SelectModel(), + new ShowCenter(), + new SaveModel() + + }; + + } + } +} diff --git a/KruacentExiled/KE.Utils/API/Models/Commands/ListModel.cs b/KruacentExiled/KE.Utils/API/Models/Commands/ListModel.cs index 5a271bd6..79f42597 100644 --- a/KruacentExiled/KE.Utils/API/Models/Commands/ListModel.cs +++ b/KruacentExiled/KE.Utils/API/Models/Commands/ListModel.cs @@ -24,13 +24,13 @@ public bool Execute(ArraySegment arguments, ICommandSender sender, out s b.AppendLine($"Models ({Model.Models.Count}) :"); foreach (Model m in Model.Models) { - b.AppendLine($"({m.Id}) - {m.Name} pos: {m.Center} spawned? :{m.Spawned}"); + b.AppendLine($"{m.Name} pos: {m.Center} spawned? :{m.Spawned}"); } b.AppendLine($"Blueprints ({ModelBlueprint.Blueprints.Count}) :"); foreach (ModelBlueprint m in ModelBlueprint.Blueprints) { - b.AppendLine($"({m.Id}) - {m.Name}"); + b.AppendLine($"{m.Name}"); } diff --git a/KruacentExiled/KE.Utils/API/Models/Commands/LoadModel.cs b/KruacentExiled/KE.Utils/API/Models/Commands/LoadModel.cs index 88d4b40a..7be25565 100644 --- a/KruacentExiled/KE.Utils/API/Models/Commands/LoadModel.cs +++ b/KruacentExiled/KE.Utils/API/Models/Commands/LoadModel.cs @@ -6,6 +6,7 @@ using System.Linq; using System.Text; using System.Threading.Tasks; +using System.Xml.Linq; namespace KE.Utils.API.Models.Commands { @@ -16,7 +17,7 @@ public class LoadModel : ICommand public string[] Aliases { get; } = { "lo" }; - public string Description { get; } = "load a model"; + public string Description { get; } = "load a model from a blueprint"; public bool Execute(ArraySegment arguments, ICommandSender sender, out string response) { @@ -34,21 +35,29 @@ public bool Execute(ArraySegment arguments, ICommandSender sender, out s return false; } - if (!int.TryParse(arguments.At(0),out int id)) + string name = arguments.At(0); + + if (string.IsNullOrEmpty(name)) { - response = "enter id"; + response = "name null or empty"; return false; } - if(!ModelBlueprint.TryGet(id,out var mbp)) + foreach(ModelBlueprint bp in ModelBlueprint.Blueprints) + { + + Log.Info($"{bp.Name} == {name} : {bp.Name == name}"); + } + + + if(!ModelBlueprint.TryGet(name,out var mbp)) { response = "blueprint not found"; return false; } - - var m =Model.Create(mbp, p.Position); - response = $"Created model ({m.Name}) at {m.Center}"; + mbp.Spawn(p.Position); + response = $"Created model ({mbp.Name}) at {p.Position}"; return true; } diff --git a/KruacentExiled/KE.Utils/API/Models/Commands/SaveModel.cs b/KruacentExiled/KE.Utils/API/Models/Commands/SaveModel.cs new file mode 100644 index 00000000..d40048e5 --- /dev/null +++ b/KruacentExiled/KE.Utils/API/Models/Commands/SaveModel.cs @@ -0,0 +1,47 @@ +using CommandSystem; +using Exiled.API.Features; +using KE.Utils.API.Models.Blueprints; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Xml.Linq; + +namespace KE.Utils.API.Models.Commands +{ + public class SaveModel : ICommand + { + + public string Command { get; } = "save"; + + public string[] Aliases { get; } = { "sa" }; + + public string Description { get; } = "save a model to file"; + + public bool Execute(ArraySegment arguments, ICommandSender sender, out string response) + { + + Player p = Player.Get(sender); + if (p == null) + { + response = "This player can't do this command"; + return false; + } + + + Model model = Models.Instance.ModelCreator.SelectedModel; + if (model == null) + { + response = "no model selected"; + return false; + } + + model.Save(); + + response = $"Saved ({model.Name})"; + return true; + } + + } +} diff --git a/KruacentExiled/KE.Utils/API/Models/Commands/SelectModel.cs b/KruacentExiled/KE.Utils/API/Models/Commands/SelectModel.cs index 189ef2fe..266ce4d4 100644 --- a/KruacentExiled/KE.Utils/API/Models/Commands/SelectModel.cs +++ b/KruacentExiled/KE.Utils/API/Models/Commands/SelectModel.cs @@ -31,16 +31,18 @@ public bool Execute(ArraySegment arguments, ICommandSender sender, out s response = "not enough arguments"; return false; } - if (!int.TryParse(arguments.At(0),out int id)) + string name = arguments.At(0); + + if (string.IsNullOrEmpty(name)) { - response = "not an id"; + response = "name null or empty"; return false; } - if (!Model.TryGet(id, out Model m)) + if (!Model.TryGet(name, out Model m)) { response = "model not found"; return false; diff --git a/KruacentExiled/KE.Utils/API/Models/Model.cs b/KruacentExiled/KE.Utils/API/Models/Model.cs index f82c25c9..6e84fbc9 100644 --- a/KruacentExiled/KE.Utils/API/Models/Model.cs +++ b/KruacentExiled/KE.Utils/API/Models/Model.cs @@ -1,15 +1,10 @@ using Exiled.API.Features; -using Exiled.API.Features.Core; -using Exiled.API.Features.Doors; using Exiled.API.Features.Toys; -using Exiled.API.Structs; using KE.Utils.API.Models.Blueprints; -using KE.Utils.API.Models.ToysSettings; +using System; using System.Collections.Generic; using System.Linq; -using System.Runtime.InteropServices; using UnityEngine; -using Light = Exiled.API.Features.Toys.Light; namespace KE.Utils.API.Models { @@ -31,12 +26,6 @@ public Vector3 Center { get { return _center; } } - - private int _id; - public int Id - { - get { return _id; } - } private bool _spawned = true; public bool Spawned { @@ -58,6 +47,8 @@ public bool LoadedFromBlueprint } } + + internal Primitive centerPrim; @@ -85,57 +76,56 @@ public Primitive Add(Vector3 pos) } - private void AddToy(AdminToy toy) + protected virtual void AddToy(AdminToy toy,bool editMode = true) { + if(toy is Primitive p && editMode) + { + p.Collidable = true; + } + + _toys.Add(toy); } private Model(Vector3 center) { + _models.Add(this); _center = center; } - - internal static Model Create(Vector3 position, IEnumerable toys, string name = "") - { - var m = Create(position, name); - m._toys = toys.ToHashSet(); - - return m; - } - - public static Model Create(Vector3 position, string name = "") + public static Model Create(Vector3 position, string name) { Model m = new(position); - _models.Add(m); - m._id = _models.Count; if (string.IsNullOrEmpty(name)) { - m._name = "Model" + m.Id; - } - else - { - m._name = name; + throw new ArgumentException("name null or empty"); } + m._name = name; - Log.Debug("created model id=" + m.Id); + Log.Debug("created model id=" + m.Name); m.centerPrim = Primitive.Create(position, null, Vector3.one / 5, true, new(1, 0, 0, .25f)); m.centerPrim.Collidable = false; return m; } - public static Model Create(ModelBlueprint blueprint,Vector3 position) + + public static Model Create(ModelBlueprint blueprint,Vector3 position,bool editMode = false) { Model m = new(position); - m._id = _models.Count; + m._name = blueprint.Name; foreach (AdminToyBlueprint toy in blueprint.Toys) { - m.AddToy(toy.Spawn(m.Center)); - } + Log.Info("create toy "+toy.AdminToyType); + AdminToy trueToy = toy.Spawn(m.Center); + + m.AddToy(trueToy, editMode); + + } + return m; } @@ -146,13 +136,7 @@ public static Model Create(ModelBlueprint blueprint,Vector3 position) ///
public void CreateBlueprint() { - int oldId = -1; - if (LoadedFromBlueprint) - { - oldId = _blueprint.Id; - } - - ModelBlueprint bp = ModelBlueprint.Create(this, oldId); + ModelBlueprint bp = ModelBlueprint.Create(this); _blueprint = bp; @@ -172,22 +156,6 @@ public static Model Get(string name) return null; } - - public static Model Get(int id) - { - foreach(Model m in _models) - { - if (m.Id == id) - return m; - } - return null; - } - public static bool TryGet(int id, out Model model) - { - model = Get(id); - return model != null; - } - public static bool TryGet(string name, out Model model) { model = Get(name); @@ -197,7 +165,7 @@ public static bool TryGet(string name, out Model model) public override string ToString() { - return $"{Id} : {Name} center = {Center}"; + return $"{Name} center = {Center}"; } #endregion diff --git a/KruacentExiled/KE.Utils/API/Models/ModelCreator.cs b/KruacentExiled/KE.Utils/API/Models/ModelCreator.cs index 5aa1bb18..85758ad9 100644 --- a/KruacentExiled/KE.Utils/API/Models/ModelCreator.cs +++ b/KruacentExiled/KE.Utils/API/Models/ModelCreator.cs @@ -49,7 +49,7 @@ public MovementMode MovementMode public static event Action IsAiming; public static event Action StoppedAiming; - + public ModelCreator() { @@ -62,18 +62,24 @@ public void SubscribeEvents() ModelHandler = new(); MovementHandler = new(); - + ModelLoader.LoadAll(); MovementHandler.SubscribeEvents(); - Exiled.Events.Handlers.Server.WaitingForPlayers += OnWaitingForPlayers; Exiled.Events.Handlers.Player.DryfiringWeapon += OnDryfiringWeapon; Exiled.Events.Handlers.Player.TogglingWeaponFlashlight += OnTogglingWeaponFlashlight; Exiled.Events.Handlers.Server.RoundStarted += Test; Exiled.Events.Handlers.Player.AimingDownSight += OnAimingDownSight; } - private void OnWaitingForPlayers() + public void UnsubscribeEvents() { - ModelLoader.LoadAll(); + Exiled.Events.Handlers.Player.DryfiringWeapon -= OnDryfiringWeapon; + Exiled.Events.Handlers.Player.TogglingWeaponFlashlight -= OnTogglingWeaponFlashlight; + Exiled.Events.Handlers.Player.AimingDownSight -= OnAimingDownSight; + Exiled.Events.Handlers.Server.RoundStarted -= Test; + MovementHandler.UnsubscribeEvents(); + + ModelHandler = null; + MovementHandler = null; } private void Test() @@ -94,19 +100,7 @@ private void Test() } - public void UnsubscribeEvents() - { - Exiled.Events.Handlers.Player.DryfiringWeapon -= OnDryfiringWeapon; - Exiled.Events.Handlers.Player.TogglingWeaponFlashlight -= OnTogglingWeaponFlashlight; - Exiled.Events.Handlers.Server.WaitingForPlayers -= OnWaitingForPlayers; - Exiled.Events.Handlers.Player.AimingDownSight -= OnAimingDownSight; - Exiled.Events.Handlers.Server.RoundStarted -= Test; - //Exiled.Events.Handlers.Player.Shooting -= OnShooting; - MovementHandler.UnsubscribeEvents(); - ModelHandler = null; - MovementHandler = null; - } private void OnAimingDownSight(AimingDownSightEventArgs ev) { diff --git a/KruacentExiled/KE.Utils/API/Models/ModelLoader.cs b/KruacentExiled/KE.Utils/API/Models/ModelLoader.cs index 3034ee16..d4c60464 100644 --- a/KruacentExiled/KE.Utils/API/Models/ModelLoader.cs +++ b/KruacentExiled/KE.Utils/API/Models/ModelLoader.cs @@ -27,7 +27,13 @@ public static IEnumerable LoadAll() foreach (string d in raw) { Log.Info("loading="+d); - m.Add(Load(string.Empty,d)); + ModelBlueprint mbp = Load(string.Empty, d); + if(mbp != null) + { + Log.Info($"loaded {mbp.Name} ({mbp.Toys.Count})"); + m.Add(mbp); + } + } return m; @@ -73,9 +79,10 @@ public static ModelBlueprint Load(string path,string filename) ColorUtility.TryParseHtmlString(line[4], out color); PrimitiveType ptype; Enum.TryParse(line[5], out ptype); - bool collidable = bool.Parse(line[6]); + + var p = Primitive.Create(ptype, ATPos, ATRotation, ATScale, true, color); - p.Collidable = collidable; + p.Collidable = false; toy = p; } @@ -98,12 +105,12 @@ public static ModelBlueprint Load(string path,string filename) - return ModelBlueprint.Create(name); + return ModelBlueprint.Create(name, toys); } // Name\n - // Primitive.Position.RotationEuler.Scale.Color.PrimitiveType.Collidable\n + // Primitive.Position.RotationEuler.Scale.Color.PrimitiveType\n // Light.Position.RotationEuler.Scale.Color.Intensity\n // and repeat public static bool Save(this ModelBlueprint m) @@ -120,7 +127,7 @@ public static bool Save(this ModelBlueprint m) try { - File.WriteAllLines(Path + m.Id + Extension, result); + File.WriteAllLines(Path + m.Name+ Extension, result); return true; } catch(Exception e) diff --git a/KruacentExiled/KE.Utils/API/Models/SelectedModel.cs b/KruacentExiled/KE.Utils/API/Models/SelectedModel.cs index 9de9b955..7e502f46 100644 --- a/KruacentExiled/KE.Utils/API/Models/SelectedModel.cs +++ b/KruacentExiled/KE.Utils/API/Models/SelectedModel.cs @@ -12,10 +12,10 @@ namespace KE.Utils.API.Models { internal class ModelSelection { - public const float BLINK_REFRESH_RATE = .3f; - internal Model SelectedModel; + + public Model SelectedModel { get; internal set; } public Primitive SelectedPrimitive; public static event Action OnChangedSelection; diff --git a/KruacentExiled/KE.Utils/Extensions/NpcExtension.cs b/KruacentExiled/KE.Utils/Extensions/NpcExtension.cs new file mode 100644 index 00000000..6af07bc5 --- /dev/null +++ b/KruacentExiled/KE.Utils/Extensions/NpcExtension.cs @@ -0,0 +1,23 @@ +using CentralAuth; +using Exiled.API.Features; +using Mirror; +using PlayerRoles; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace KE.Utils.Extensions +{ + public static class NpcExtension + { + + + public static void Hide(this Npc npc) + { + npc.ReferenceHub.authManager.NetworkSyncedUserId = "ID_Dedicated"; + npc.ReferenceHub.authManager.syncMode = (SyncMode)ClientInstanceMode.DedicatedServer; + } + } +} From 8210c030d2de67330dd0eaaafe0a500328ec9c5b Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Mon, 28 Jul 2025 17:31:26 +0200 Subject: [PATCH 305/853] removed the temp stuff --- KruacentExiled/KE.Map/MainPlugin.cs | 63 ++++--- .../BlinkingBlocks/BlinkingBlocksGroup.cs | 2 +- .../KE.Map/Surface/SupplyDrops/SupplyDrop.cs | 17 +- .../KE.Map/Surface/Turrets/Turret.cs | 170 +++++++++++++++++- .../KE.Utils/API/GifAnimator/RenderGif.cs | 128 +++++++++++++ KruacentExiled/KE.Utils/API/Parser.cs | 19 +- 6 files changed, 350 insertions(+), 49 deletions(-) create mode 100644 KruacentExiled/KE.Utils/API/GifAnimator/RenderGif.cs diff --git a/KruacentExiled/KE.Map/MainPlugin.cs b/KruacentExiled/KE.Map/MainPlugin.cs index 4331eeaf..c8e16ef5 100644 --- a/KruacentExiled/KE.Map/MainPlugin.cs +++ b/KruacentExiled/KE.Map/MainPlugin.cs @@ -2,28 +2,20 @@ using Exiled.API.Extensions; using Exiled.API.Features; using Exiled.API.Features.Doors; -using Exiled.API.Features.Roles; -using Exiled.API.Features.Toys; using Exiled.API.Interfaces; using Exiled.Events.EventArgs.Player; using Exiled.Events.EventArgs.Server; -using Interactables.Interobjects.DoorUtils; using KE.Map.Doors; using KE.Map.EasterEggs; using KE.Map.GamblingZone; using KE.Map.Surface.BlinkingBlocks; using KE.Map.Surface.SupplyDrops; using KE.Map.Surface.Turrets; -using KE.Map.Utils; using KE.Utils.API.Models; -using KE.Utils.API.Models.Blueprints; using MEC; using PlayerRoles; -using PlayerRoles.FirstPersonControl; -using Respawning; using System.Collections.Generic; -using System.IO; -using System.Reflection; +using System.Linq; using UnityEngine; namespace KE.Map @@ -37,35 +29,47 @@ public class MainPlugin : Plugin public override void OnEnabled() { - Capybaras = new(); + //Capybaras = new(); - Capybaras.SubscribeEvents(); + //Capybaras.SubscribeEvents(); KE.Utils.API.Sounds.SoundPlayer.Instance.TryLoad(); Exiled.Events.Handlers.Map.Generated += OnGenerated; Exiled.Events.Handlers.Server.RoundEnded += OnRoundEnded; Exiled.Events.Handlers.Server.RoundStarted += SupplyDrop.OnRoundStarted; + + //Exiled.Events.Handlers.Server.RoundStarted += OnRoundStarted; + //Turret.SubscribeEvents(); + //Exiled.Events.Handlers.Server.RoundStarted += SendFakePrimitives.Join; - if (Config.Debug) - models?.SubscribeEvents(); + //models?.SubscribeEvents(); Instance = this; } + private void OnRoundStarted() + { + + foreach(Player p in Player.List.Where(p => !p.IsNPC)) + { + + new Turret(p, RoleTypeId.ChaosConscript.GetRandomSpawnLocation().Position); + } + + + } + public override void OnDisabled() { Exiled.Events.Handlers.Map.Generated -= OnGenerated; Exiled.Events.Handlers.Server.RoundEnded -= OnRoundEnded; Exiled.Events.Handlers.Server.RoundStarted -= SupplyDrop.OnRoundStarted; + //Exiled.Events.Handlers.Server.RoundStarted -= OnRoundStarted; //Exiled.Events.Handlers.Server.RoundStarted -= SendFakePrimitives.Join; - Capybaras.UnsubscribeEvents(); - if (Config.Debug) - { - models.UnsubscribeEvents(); - models.DestroyInstance(); - } - - models.DestroyInstance(); + //Capybaras.UnsubscribeEvents(); + //Turret.UnsubscribeEvents(); + //models.UnsubscribeEvents(); + //models.DestroyInstance(); Capybaras = null; Instance = null; } @@ -75,7 +79,6 @@ public override void OnDisabled() private void OnGenerated() { - Turret t = new(); Door lcz173 = Door.Get(Exiled.API.Enums.DoorType.Scp173Gate); HashSet normal = new() { @@ -117,21 +120,16 @@ private void OnGenerated() //var g = new GamblingRoom(lcz173, new(normal), -lcz173.Transform.forward * 5f); g.SubscribeEvents(); - + /* if (Config.Debug) { var door = KEDoor.Create(null, RoleTypeId.Scp049.GetRandomSpawnLocation().Position, new()); - var d2 = KEDoor.Create(null, RoleTypeId.Scp049.GetRandomSpawnLocation().Position + Vector3.forward * 2, new()); - door.LinkOtherDoor(d2); } - - - //Blinking Blocks HashSet list = new() { @@ -140,7 +138,8 @@ private void OnGenerated() }; BlinkingBlocksGroup group = new(list); - //Timing.RunCoroutine(ShowPos()); + Timing.RunCoroutine(ShowPos()); + */ } @@ -148,10 +147,8 @@ private IEnumerator ShowPos() { while (true) { - foreach(Player p in Player.List) - { - Log.Debug($"{p.Id} position : "+p.Position); - } + + yield return Timing.WaitForSeconds(2); } } diff --git a/KruacentExiled/KE.Map/Surface/BlinkingBlocks/BlinkingBlocksGroup.cs b/KruacentExiled/KE.Map/Surface/BlinkingBlocks/BlinkingBlocksGroup.cs index 48214f36..cbf47cb2 100644 --- a/KruacentExiled/KE.Map/Surface/BlinkingBlocks/BlinkingBlocksGroup.cs +++ b/KruacentExiled/KE.Map/Surface/BlinkingBlocks/BlinkingBlocksGroup.cs @@ -55,7 +55,7 @@ private IEnumerator Switch() { b.Switch(Color); } - Log.Debug("switch to "+Color.ToString()); + //Log.Debug("switch to "+Color.ToString()); Color = GetNewColor(); } } diff --git a/KruacentExiled/KE.Map/Surface/SupplyDrops/SupplyDrop.cs b/KruacentExiled/KE.Map/Surface/SupplyDrops/SupplyDrop.cs index e5d24e50..374b460d 100644 --- a/KruacentExiled/KE.Map/Surface/SupplyDrops/SupplyDrop.cs +++ b/KruacentExiled/KE.Map/Surface/SupplyDrops/SupplyDrop.cs @@ -69,7 +69,8 @@ public bool Show public Player PlayerClaimed { get; private set; } public static readonly string CassieMessageDrop = "Drop in surface"; - public static readonly string CassieTooMuchStealing = ""; + public static readonly string CassieTooMuchStealing = "Too Much Supplys Taken By SCPs"; + public static readonly string CassieTooMuchStealingSub = "Too Much Supplies Taken By SCPs"; private static SupplyDrop CurrentDrop = null; private static CoroutineHandle _handle; @@ -88,7 +89,7 @@ public SupplyDrop(Vector3 position) if (Show) { - Cassie.Message(CassieMessageDrop); + //Cassie.Message(CassieMessageDrop); } foreach (var p in primitives) @@ -102,7 +103,7 @@ public SupplyDrop(Vector3 position) public static void OnRoundStarted() { _spawnTime = Stopwatch.StartNew(); - //_nextSpawn = TimeSpawn; + _nextSpawn = TimeSpawn; _handle = Timing.RunCoroutine(Loop()); } @@ -115,13 +116,13 @@ private static IEnumerator Loop() { if (_spawnTime.Elapsed > _nextSpawn) { - _nextSpawn += new TimeSpan(0,0,30); + _nextSpawn += TimeSpawn; if(CurrentDrop == null) { SpawnRandom(); } - Log.Debug("next spawn " + _nextSpawn); + Log.Info("next spawn " + _nextSpawn); } notmax = list.Count <= MaxSupplyDrop; yield return Timing.WaitForSeconds(RefreshRate); @@ -132,7 +133,7 @@ private static void SpawnRandom() { //Todo random lol Vector3 spawnloc = SpawnPositions.GetRandomValue(); - Log.Debug($"spawning drop at {spawnloc}"); + Log.Info($"spawning drop at {spawnloc}"); SupplyDrop soup = new(spawnloc); @@ -227,7 +228,7 @@ private void BuffScps() Log.Debug("scps got it!"); foreach(Player p in Player.List.Where(p => p.IsScp)) { - float healthAdded = p.MaxHealth * 1.3f; + float healthAdded = p.MaxHealth * 1.2f; p.MaxHealth += healthAdded; p.Health += healthAdded; @@ -236,7 +237,7 @@ private void BuffScps() if (_scpSteal >= ScpStealLimit) { - Cassie.Message(CassieTooMuchStealing); + Cassie.MessageTranslated(CassieTooMuchStealing,CassieTooMuchStealingSub); Warhead.Start(true, true); _spawnTime.Stop(); Timing.KillCoroutines(_handle); diff --git a/KruacentExiled/KE.Map/Surface/Turrets/Turret.cs b/KruacentExiled/KE.Map/Surface/Turrets/Turret.cs index 0f9d420e..135731eb 100644 --- a/KruacentExiled/KE.Map/Surface/Turrets/Turret.cs +++ b/KruacentExiled/KE.Map/Surface/Turrets/Turret.cs @@ -1,23 +1,181 @@ -using Exiled.API.Extensions; +using Exiled.API.Enums; +using Exiled.API.Extensions; using Exiled.API.Features; +using Exiled.API.Features.Roles; +using Exiled.API.Features.Toys; +using Exiled.API.Interfaces; +using Exiled.Events.EventArgs.Server; +using Exiled.Events.Patches.Events.Player; +using KE.Utils.API; using KE.Utils.Extensions; +using MapGeneration; +using MEC; +using PlayerRoles; +using PlayerRoles.FirstPersonControl; +using System.Collections.Generic; +using System.Linq; +using UnityEngine; +using YamlDotNet.Core.Tokens; namespace KE.Map.Surface.Turrets { - public class Turret + public class Turret : IWorldSpace { + private readonly Npc npc; + private readonly CoroutineHandle handle; + public float Range { get; private set; } = 10; + public int Id { get; } + public Player Player { get; private set; } - public Turret() + public bool IsNeutral { - Npc npc = Npc.Spawn("Turret1"); + get + { + return Player == null; + } + } + public Vector3 Position + { + get + { + return npc.Position; + } + set + { + Move(value); + } + } + public Quaternion Rotation + { + get + { + return npc.Rotation; + } + set + { + npc.Rotation = value; + } + } + + + + private static List list = new(); + + public Turret(Player p,Vector3 position) + { + Log.Debug($"player {p.Nickname} spawned turret"); + Id = list.Count; + list.Add(this); + Player = p; + RoleTypeId role = p.Role; + + if (!role.IsFpcRole()) + { + role = RoleTypeId.ClassD; + } + + if (role.IsScp()) + { + role = RoleTypeId.Scp0492; + } + + + npc = Npc.Spawn("Turret" + Id, role, true, position); + Timing.CallDelayed(Npc.SpawnSetRoleDelay +Timing.WaitForOneFrame, () => npc.IsGodModeEnabled = true); + if (npc.Role is FpcRole fpc) + { + fpc.Gravity = Vector3.zero; + } + npc.Hide(); - + handle = Timing.RunCoroutine(Detect()); + } + + + + private IEnumerator Detect() + { + + while (Player.IsAlive) + { + //&& p.Role.Side != Player.Role.Side + List inRange = Player.List.Where(p => OtherUtils.IsInCircle(p.Position, Position, Range) && !p.IsNPC ).OrderBy(p => Vector3.Distance(p.Position,Position)).ToList(); + Player closest; + if(inRange.TryGet(0,out closest)) + { + Log.Debug("player closest " + closest); + + Rotation = Quaternion.LookRotation(closest.Position - Position); + + + RaycastHit hit; + if (UnityEngine.Physics.Linecast(Position, closest.Position, out hit)) + { + Player playerhit = Player.Get(hit.collider); + Log.Debug("hit = " + playerhit?.Nickname); + if (playerhit != null) + { + + playerhit.Hurt(10); + } + } + - + + + yield return Timing.WaitForSeconds(1); + } + else + { + Log.Debug("no player nearby"); + yield return Timing.WaitForSeconds(5); + } + } + } + + public void Move(Vector3 newPosition) + { + npc.Teleport(newPosition); + + } + + + + public void Destroy() + { + npc.Destroy(); + } + + private static void OnEndingRound(EndingRoundEventArgs ev) + { + if (ev.IsAllowed) + { + DestroyAll(); + } + } + + public static void DestroyAll() + { + foreach (Turret turret in list) + { + turret.Destroy(); + } + } + + public static void SubscribeEvents() + { + Exiled.Events.Handlers.Server.EndingRound += OnEndingRound; + } + + public static void UnsubscribeEvents() + { + DestroyAll(); + Exiled.Events.Handlers.Server.EndingRound -= OnEndingRound; } + } } diff --git a/KruacentExiled/KE.Utils/API/GifAnimator/RenderGif.cs b/KruacentExiled/KE.Utils/API/GifAnimator/RenderGif.cs new file mode 100644 index 00000000..f4276d33 --- /dev/null +++ b/KruacentExiled/KE.Utils/API/GifAnimator/RenderGif.cs @@ -0,0 +1,128 @@ +using System.Collections.Generic; +using System.Drawing; +using System.Drawing.Imaging; +using System.IO; +using Exiled.API.Features; +using Exiled.API.Features.Toys; +using MEC; +using UnityEngine; +using UnityEngine.Rendering; +using Color = UnityEngine.Color; +namespace KE.Utils.API.GifAnimator +{ + internal class RenderGif + { + + public static void Spawn() + { + + } + + + + private static IEnumerator RenderImageCoroutine(object target, string filePath, float maxWidth, float maxHeight, float distance, float duration, int targetWidth, int targetHeight) + { + if (!File.Exists(filePath)) + { + Log.Debug($"No image was found under: {filePath}"); + yield break; + } + + byte[] imageData = File.ReadAllBytes(filePath); + + + + + + + Texture2D original = new Texture2D(2, 2); + + + try + { + original.LoadRawTextureData(imageData); + } + catch(UnityException) + { + Log.Debug("Image couldnt be loaded."); + yield break; + } + + Texture2D scaled = new Texture2D(targetWidth, targetHeight, TextureFormat.RGBA32, false); + + for (int x = 0; x < targetWidth; x++) + { + for (int y = 0; y < targetHeight; y++) + { + float u = x / (float)targetWidth; + float v = y / (float)targetHeight; + Color color = original.GetPixelBilinear(u, v); + scaled.SetPixel(x, y, color); + } + } + scaled.Apply(); + + float pixelScaleX = maxWidth / targetWidth; + float pixelScaleY = maxHeight / targetHeight; + float scale = Mathf.Min(pixelScaleX, pixelScaleY); + + Vector3 forwardOrigin; + Quaternion rotation = Quaternion.identity; + + if (target is Exiled.API.Features.Player player) + { + forwardOrigin = player.CameraTransform.position + player.CameraTransform.forward * distance; + + Vector3 directionToPlayer = forwardOrigin - player.CameraTransform.position; + directionToPlayer.y = 0; + rotation = Quaternion.LookRotation(directionToPlayer); + } + else if (target is Vector3 position) + { + forwardOrigin = position + Vector3.forward * distance; + Vector3 directionToPosition = forwardOrigin - position; + directionToPosition.y = 0; + rotation = Quaternion.LookRotation(directionToPosition); + } + else if (target is Room room) + { + forwardOrigin = room.Position + Vector3.up * 2f; + Vector3 directionToRoom = forwardOrigin - room.Position; + directionToRoom.y = 0; + rotation = Quaternion.LookRotation(directionToRoom); + } + else + { + Log.Debug("Invalid object type. Valid types: Player, Vector3, Room"); + yield break; + } + + Vector3 offset = new Vector3((targetWidth * scale) / 2f, (targetHeight * scale) / 2f, 0); + + for (int x = 0; x < targetWidth; x++) + { + for (int y = 0; y < targetHeight; y++) + { + Color pixelColor = scaled.GetPixel(x, y); + if (pixelColor.a < 0.1f) + continue; + + Vector3 localOffset = new Vector3(x * scale, y * scale, 0) - offset; + Vector3 worldPos = forwardOrigin + rotation * localOffset; + + Primitive quad = Primitive.Create(PrimitiveType.Quad); + quad.Position = worldPos; + quad.Scale = new Vector3(scale, scale, scale * 0.01f); + quad.Color = pixelColor; + + Quaternion fixedRotation = Quaternion.Euler(0f, rotation.eulerAngles.y, 0f); + quad.Rotation = fixedRotation; + quad.Flags = AdminToys.PrimitiveFlags.Visible; + } + + yield return Timing.WaitForOneFrame; + } + } + + } +} diff --git a/KruacentExiled/KE.Utils/API/Parser.cs b/KruacentExiled/KE.Utils/API/Parser.cs index e9a7958c..a924337f 100644 --- a/KruacentExiled/KE.Utils/API/Parser.cs +++ b/KruacentExiled/KE.Utils/API/Parser.cs @@ -13,7 +13,24 @@ public static class Parser public static Vector3 Vector3(string s) { string[] temp = s.Substring(1, s.Length - 3).Split(','); - return new Vector3(float.Parse(temp[0]), float.Parse(temp[1]), float.Parse(temp[2])); + + if(!float.TryParse(temp[0],out float x)) + { + return UnityEngine.Vector3.zero; + } + + if (!float.TryParse(temp[1], out float y)) + { + return UnityEngine.Vector3.zero; + } + if (!float.TryParse(temp[1], out float z)) + { + return UnityEngine.Vector3.zero; + } + + + + return new Vector3(x, y, z); } } } From f9bf57be89f564623c5177a3778ac72e8a79c906 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Mon, 28 Jul 2025 17:50:30 +0200 Subject: [PATCH 306/853] changed description --- KruacentExiled/KE.CustomRoles/CR/SCP/Paper.cs | 2 +- KruacentExiled/KE.CustomRoles/CR/SCP/SCP457.cs | 2 +- KruacentExiled/KE.CustomRoles/Controller.cs | 2 ++ 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/KruacentExiled/KE.CustomRoles/CR/SCP/Paper.cs b/KruacentExiled/KE.CustomRoles/CR/SCP/Paper.cs index d7a703af..2e42feee 100644 --- a/KruacentExiled/KE.CustomRoles/CR/SCP/Paper.cs +++ b/KruacentExiled/KE.CustomRoles/CR/SCP/Paper.cs @@ -8,7 +8,7 @@ namespace KE.CustomRoles.CR.SCP [CustomRole(RoleTypeId.None)] public class Paper : GlobalCustomRole { - public override string Description { get; set; } = "u are a paper"; + public override string Description { get; set; } = "uh oh. paper jam"; public override uint Id { get; set; } = 1047; public override SideEnum Side { get; set; } = SideEnum.SCP; public override string PublicName { get; set; } = "Paper"; diff --git a/KruacentExiled/KE.CustomRoles/CR/SCP/SCP457.cs b/KruacentExiled/KE.CustomRoles/CR/SCP/SCP457.cs index 3481c6e0..dac479ab 100644 --- a/KruacentExiled/KE.CustomRoles/CR/SCP/SCP457.cs +++ b/KruacentExiled/KE.CustomRoles/CR/SCP/SCP457.cs @@ -23,7 +23,7 @@ public class SCP457 : KECustomRole, ISCPPreferences { - public override string Description { get; set; } = ""; + public override string Description { get; set; } = "You passive damage around you, and can lauch fireballs by pressing the stalk button"; public override uint Id { get; set; } = 1084; public override string PublicName { get; set; } = "SCP-457"; public override int MaxHealth { get; set; } = 3900; diff --git a/KruacentExiled/KE.CustomRoles/Controller.cs b/KruacentExiled/KE.CustomRoles/Controller.cs index ca0cacba..4aef412c 100644 --- a/KruacentExiled/KE.CustomRoles/Controller.cs +++ b/KruacentExiled/KE.CustomRoles/Controller.cs @@ -40,6 +40,8 @@ internal void GiveRole(Player player) CustomRole cr = AssignRole(GetAvailableCustomRole(player)); Log.Debug($"{player.Id} : {cr.Name}"); + + //error assigning cr to a player with a gcr cr?.AddRole(player); } From 303d1abdaa073a3749b5bd545d6d3268e84eea00 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Mon, 28 Jul 2025 18:17:04 +0200 Subject: [PATCH 307/853] utiskl --- .../KE.GlobalEventFramework.Examples.csproj | 5 - KruacentExiled/KE.Utils/API/Models/Model.cs | 156 ------------- .../KE.Utils/API/Models/MovementHandler.cs | 72 ------ .../KE.Utils/API/Models/SelectedModel.cs | 85 ------- KruacentExiled/KE.Utils/API/Parser.cs | 19 -- KruacentExiled/KE.Utils/KE.Utils.csproj | 5 +- .../Displays/DisplayMeow/DisplayHandler.cs | 0 .../API/Displays/DisplayMeow/HintPlacement.cs | 0 .../KE.Utils/API/GifAnimator/RenderGif.cs | 128 +++++++++++ .../{ => KE.Utils}/API/Interfaces/IEvents.cs | 0 .../KE.Utils/API/Interfaces/ILoadable.cs | 13 ++ .../KE.Utils/API/Models/Arrows/Arrow.cs | 58 +++++ .../KE.Utils/API/Models/Arrows/MoveArrow.cs | 12 + .../KE.Utils/API/Models/Arrows/RotateArrow.cs | 12 + .../KE.Utils/API/Models/Arrows/ScaleArrow.cs | 12 + .../KE.Utils/API/Models/Arrows/XArrow.cs | 16 ++ .../KE.Utils/API/Models/Arrows/YArrow.cs | 16 ++ .../KE.Utils/API/Models/Arrows/ZArrow.cs | 16 ++ .../Models/Blueprints/AdminToyBlueprint.cs | 69 ++++++ .../API/Models/Blueprints/LightBlueprint.cs | 37 ++++ .../API/Models/Blueprints/ModelBlueprint.cs | 110 +++++++++ .../Models/Blueprints/PrimitiveBlueprint.cs | 39 ++++ .../API/Models/Commands/AllCommands.cs | 33 +++ .../API/Models/Commands/ChangeColor.cs | 72 ++++++ .../API/Models/Commands/ChangePrimType.cs | 53 +++++ .../API/Models/Commands/CreateModel.cs | 4 +- .../API/Models/Commands/CreatePrim.cs | 47 ++++ .../API/Models/Commands/ListModel.cs | 10 +- .../KE.Utils/API/Models/Commands/LoadModel.cs | 65 ++++++ .../API/Models/Commands/ModeMovePrim.cs | 0 .../KE.Utils/API/Models/Commands/SaveModel.cs | 47 ++++ .../API/Models/Commands/SelectModel.cs | 22 +- .../API/Models/Commands/ShowCenter.cs | 2 +- .../KE.Utils/KE.Utils/API/Models/Model.cs | 202 +++++++++++++++++ .../{ => KE.Utils}/API/Models/ModelCreator.cs | 97 +++++--- .../{ => KE.Utils}/API/Models/ModelLoader.cs | 111 ++++++---- .../{ => KE.Utils}/API/Models/Models.cs | 0 .../KE.Utils/API/Models/MovementHandler.cs | 208 ++++++++++++++++++ .../KE.Utils/API/Models/SelectedModel.cs | 52 +++++ .../Models/ToysSettings/PrimitiveSetting.cs | 0 .../API/Models/ToysSettings/ToySetting.cs | 0 .../KE.Utils/KE.Utils/API/OtherUtils.cs | 18 ++ .../KE.Utils/KE.Utils/API/Parser.cs | 36 +++ .../KE.Utils/KE.Utils/API/ReflectionHelper.cs | 47 ++++ .../KE.Utils/API/Sounds/SoundPlayer.cs | 115 ++++++++++ .../Extensions/AdminToyExtension.cs | 0 .../KE.Utils/Extensions/NpcExtension.cs | 23 ++ .../Extensions/PlayerExtension.cs | 0 .../KE.Utils/Extensions/RoomExtensions.cs | 55 +++++ .../KE.Utils/KE.Utils/KE.Utils.csproj | 37 ++++ .../Quality/Enums/ModelQuality.cs | 0 .../Quality/Handlers/QualityToysHandler.cs | 0 .../Quality/Models/Base/BaseModel.cs | 0 .../Quality/Models/Base/LightModel.cs | 0 .../Quality/Models/Base/PrimitiveModel.cs | 0 .../Quality/Models/Examples/MineModel.cs | 0 .../{ => KE.Utils}/Quality/Models/Model.cs | 0 .../Quality/Models/ModelPrefab.cs | 0 .../Quality/Models/QualityModel.cs | 0 .../{ => KE.Utils}/Quality/QualityHandler.cs | 0 .../Quality/QualityToysHandler.cs | 0 .../Quality/Settings/QualitySettings.cs | 0 .../Quality/Structs/LocalWorldSpace.cs | 0 .../{ => KE.Utils}/Quality/Tests/Test.cs | 0 KruacentExiled/KruacentExiled.sln | 42 ---- .../Displays/DisplayMeow/DisplayHandler.cs | 67 ++++++ .../API/Displays/DisplayMeow/HintPlacement.cs | 31 +++ .../KE.Utilsci/API/Interfaces/IEvents.cs | 17 ++ .../KE.Utilsci/API/Sounds/SoundPlayer.cs | 112 ++++++++++ .../Extensions/AdminToyExtension.cs | 25 +++ .../KE.Utilsci/Extensions/PlayerExtension.cs | 52 +++++ .../KE.Utilsci}/Extensions/RoomExtension.cs | 0 .../utils-merged/KE.Utilsci/KE.Utils.csproj | 31 +++ .../KE.Utilsci/Quality/Enums/ModelQuality.cs | 16 ++ .../Quality/Handlers/QualityToysHandler.cs | 179 +++++++++++++++ .../Quality/Models/Base/BaseModel.cs | 41 ++++ .../Quality/Models/Base/LightModel.cs | 26 +++ .../Quality/Models/Base/PrimitiveModel.cs | 26 +++ .../Quality/Models/Examples/MineModel.cs | 118 ++++++++++ .../KE.Utilsci/Quality/Models/Model.cs | 104 +++++++++ .../KE.Utilsci/Quality/Models/ModelPrefab.cs | 42 ++++ .../KE.Utilsci/Quality/Models/QualityModel.cs | 40 ++++ .../KE.Utilsci/Quality/QualityHandler.cs | 61 +++++ .../KE.Utilsci/Quality/QualityToysHandler.cs | 155 +++++++++++++ .../Quality/Settings/QualitySettings.cs | 62 ++++++ .../Quality/Structs/LocalWorldSpace.cs | 23 ++ .../KE.Utilsci/Quality/Tests/Test.cs | 108 +++++++++ .../Displays/DisplayMeow/DisplayHandler.cs | 66 ++++++ .../API/Displays/DisplayMeow/HintPlacement.cs | 31 +++ .../KE.Utilscr/API/Interfaces/IEvents.cs | 17 ++ .../utils-merged/KE.Utilscr/API/OtherUtils.cs | 18 ++ .../Extensions/AdminToyExtension.cs | 25 +++ .../KE.Utilscr/Extensions/PlayerExtension.cs | 52 +++++ .../KE.Utilscr/Extensions/RoomExtension.cs | 12 + .../utils-merged/KE.Utilscr/KE.Utils.csproj | 30 +++ .../KE.Utilscr/Quality/Enums/ModelQuality.cs | 16 ++ .../Quality/Handlers/QualityToysHandler.cs | 179 +++++++++++++++ .../Quality/Models/Base/BaseModel.cs | 41 ++++ .../Quality/Models/Base/LightModel.cs | 26 +++ .../Quality/Models/Base/PrimitiveModel.cs | 26 +++ .../Quality/Models/Examples/MineModel.cs | 118 ++++++++++ .../KE.Utilscr/Quality/Models/Model.cs | 104 +++++++++ .../KE.Utilscr/Quality/Models/ModelPrefab.cs | 42 ++++ .../KE.Utilscr/Quality/Models/QualityModel.cs | 40 ++++ .../KE.Utilscr/Quality/QualityHandler.cs | 61 +++++ .../KE.Utilscr/Quality/QualityToysHandler.cs | 155 +++++++++++++ .../Quality/Settings/QualitySettings.cs | 62 ++++++ .../Quality/Structs/LocalWorldSpace.cs | 23 ++ .../KE.Utilscr/Quality/Tests/Test.cs | 108 +++++++++ .../Displays/DisplayMeow/DisplayHandler.cs | 67 ++++++ .../API/Displays/DisplayMeow/HintPlacement.cs | 31 +++ .../KE.Utilsge/API/Interfaces/IEvents.cs | 17 ++ .../KE.Utilsge/API/ReflectionHelper.cs | 47 ++++ .../KE.Utilsge/API/Sounds/SoundPlayer.cs | 115 ++++++++++ .../Extensions/AdminToyExtension.cs | 25 +++ .../KE.Utilsge/Extensions/PlayerExtension.cs | 52 +++++ .../KE.Utilsge/Extensions/RoomExtension.cs | 12 + .../utils-merged/KE.Utilsge/KE.Utils.csproj | 31 +++ .../KE.Utilsge/Quality/Enums/ModelQuality.cs | 16 ++ .../Quality/Handlers/QualityToysHandler.cs | 179 +++++++++++++++ .../Quality/Models/Base/BaseModel.cs | 41 ++++ .../Quality/Models/Base/LightModel.cs | 26 +++ .../Quality/Models/Base/PrimitiveModel.cs | 26 +++ .../Quality/Models/Examples/MineModel.cs | 118 ++++++++++ .../KE.Utilsge/Quality/Models/Model.cs | 104 +++++++++ .../KE.Utilsge/Quality/Models/ModelPrefab.cs | 42 ++++ .../KE.Utilsge/Quality/Models/QualityModel.cs | 40 ++++ .../KE.Utilsge/Quality/QualityHandler.cs | 61 +++++ .../KE.Utilsge/Quality/QualityToysHandler.cs | 155 +++++++++++++ .../Quality/Settings/QualitySettings.cs | 62 ++++++ .../Quality/Structs/LocalWorldSpace.cs | 23 ++ .../KE.Utilsge/Quality/Tests/Test.cs | 108 +++++++++ .../Displays/DisplayMeow/DisplayHandler.cs | 67 ++++++ .../API/Displays/DisplayMeow/HintPlacement.cs | 31 +++ .../KE.Utilsmap/API/GifAnimator/RenderGif.cs | 128 +++++++++++ .../KE.Utilsmap/API/Interfaces/IEvents.cs | 17 ++ .../KE.Utilsmap/API/Interfaces/ILoadable.cs | 13 ++ .../KE.Utilsmap/API/Models/Arrows/Arrow.cs | 58 +++++ .../API/Models/Arrows/MoveArrow.cs | 12 + .../API/Models/Arrows/RotateArrow.cs | 12 + .../API/Models/Arrows/ScaleArrow.cs | 12 + .../KE.Utilsmap/API/Models/Arrows/XArrow.cs | 16 ++ .../KE.Utilsmap/API/Models/Arrows/YArrow.cs | 16 ++ .../KE.Utilsmap/API/Models/Arrows/ZArrow.cs | 16 ++ .../Models/Blueprints/AdminToyBlueprint.cs | 69 ++++++ .../API/Models/Blueprints/LightBlueprint.cs | 37 ++++ .../API/Models/Blueprints/ModelBlueprint.cs | 110 +++++++++ .../Models/Blueprints/PrimitiveBlueprint.cs | 39 ++++ .../API/Models/Commands/AllCommands.cs | 33 +++ .../API/Models/Commands/ChangeColor.cs | 72 ++++++ .../API/Models/Commands/ChangePrimType.cs | 53 +++++ .../API/Models/Commands/CreateModel.cs | 44 ++++ .../API/Models/Commands/CreatePrim.cs | 47 ++++ .../API/Models/Commands/ListModel.cs | 42 ++++ .../API/Models/Commands/LoadModel.cs | 65 ++++++ .../API/Models/Commands/ModeMovePrim.cs | 64 ++++++ .../API/Models/Commands/SaveModel.cs | 47 ++++ .../API/Models/Commands/SelectModel.cs | 56 +++++ .../API/Models/Commands/ShowCenter.cs | 51 +++++ .../KE.Utilsmap/API/Models/Model.cs | 202 +++++++++++++++++ .../KE.Utilsmap/API/Models/ModelCreator.cs | 175 +++++++++++++++ .../KE.Utilsmap/API/Models/ModelLoader.cs | 152 +++++++++++++ .../KE.Utilsmap/API/Models/Models.cs | 47 ++++ .../KE.Utilsmap/API/Models/MovementHandler.cs | 208 ++++++++++++++++++ .../KE.Utilsmap/API/Models/SelectedModel.cs | 52 +++++ .../Models/ToysSettings/PrimitiveSetting.cs | 31 +++ .../API/Models/ToysSettings/ToySetting.cs | 20 ++ .../KE.Utilsmap/API/OtherUtils.cs | 18 ++ .../utils-merged/KE.Utilsmap/API/Parser.cs | 36 +++ .../KE.Utilsmap/API/Sounds/SoundPlayer.cs | 112 ++++++++++ .../Extensions/AdminToyExtension.cs | 25 +++ .../KE.Utilsmap/Extensions/NpcExtension.cs | 23 ++ .../KE.Utilsmap/Extensions/PlayerExtension.cs | 52 +++++ .../KE.Utilsmap/Extensions/RoomExtension.cs | 12 + .../utils-merged/KE.Utilsmap/KE.Utils.csproj | 37 ++++ .../KE.Utilsmap/Quality/Enums/ModelQuality.cs | 16 ++ .../Quality/Handlers/QualityToysHandler.cs | 179 +++++++++++++++ .../Quality/Models/Base/BaseModel.cs | 41 ++++ .../Quality/Models/Base/LightModel.cs | 26 +++ .../Quality/Models/Base/PrimitiveModel.cs | 26 +++ .../Quality/Models/Examples/MineModel.cs | 118 ++++++++++ .../KE.Utilsmap/Quality/Models/Model.cs | 104 +++++++++ .../KE.Utilsmap/Quality/Models/ModelPrefab.cs | 42 ++++ .../Quality/Models/QualityModel.cs | 40 ++++ .../KE.Utilsmap/Quality/QualityHandler.cs | 61 +++++ .../KE.Utilsmap/Quality/QualityToysHandler.cs | 155 +++++++++++++ .../Quality/Settings/QualitySettings.cs | 62 ++++++ .../Quality/Structs/LocalWorldSpace.cs | 23 ++ .../KE.Utilsmap/Quality/Tests/Test.cs | 108 +++++++++ .../Displays/DisplayMeow/DisplayHandler.cs | 67 ++++++ .../API/Displays/DisplayMeow/HintPlacement.cs | 31 +++ .../KE.Utilsmisc/API/Interfaces/IEvents.cs | 17 ++ .../KE.Utilsmisc/API/ReflectionHelper.cs | 47 ++++ .../Extensions/AdminToyExtension.cs | 29 +++ .../KE.Utilsmisc/Extensions/DoorExtension.cs | 14 ++ .../Extensions/PlayerExtension.cs | 52 +++++ .../KE.Utilsmisc/Extensions/RoomExtensions.cs | 55 +++++ .../utils-merged/KE.Utilsmisc/KE.Utils.csproj | 30 +++ .../Quality/Enums/ModelQuality.cs | 16 ++ .../Quality/Handlers/QualityToysHandler.cs | 179 +++++++++++++++ .../Quality/Models/Base/BaseModel.cs | 41 ++++ .../Quality/Models/Base/LightModel.cs | 26 +++ .../Quality/Models/Base/PrimitiveModel.cs | 26 +++ .../Quality/Models/Examples/MineModel.cs | 118 ++++++++++ .../KE.Utilsmisc/Quality/Models/Model.cs | 104 +++++++++ .../Quality/Models/ModelPrefab.cs | 42 ++++ .../Quality/Models/QualityModel.cs | 40 ++++ .../KE.Utilsmisc/Quality/QualityHandler.cs | 61 +++++ .../Quality/QualityToysHandler.cs | 155 +++++++++++++ .../Quality/Settings/QualitySettings.cs | 62 ++++++ .../Quality/Structs/LocalWorldSpace.cs | 23 ++ .../KE.Utilsmisc/Quality/Tests/Test.cs | 108 +++++++++ 212 files changed, 10569 insertions(+), 468 deletions(-) delete mode 100644 KruacentExiled/KE.Utils/API/Models/Model.cs delete mode 100644 KruacentExiled/KE.Utils/API/Models/MovementHandler.cs delete mode 100644 KruacentExiled/KE.Utils/API/Models/SelectedModel.cs delete mode 100644 KruacentExiled/KE.Utils/API/Parser.cs rename KruacentExiled/KE.Utils/{ => KE.Utils}/API/Displays/DisplayMeow/DisplayHandler.cs (100%) rename KruacentExiled/KE.Utils/{ => KE.Utils}/API/Displays/DisplayMeow/HintPlacement.cs (100%) create mode 100644 KruacentExiled/KE.Utils/KE.Utils/API/GifAnimator/RenderGif.cs rename KruacentExiled/KE.Utils/{ => KE.Utils}/API/Interfaces/IEvents.cs (100%) create mode 100644 KruacentExiled/KE.Utils/KE.Utils/API/Interfaces/ILoadable.cs create mode 100644 KruacentExiled/KE.Utils/KE.Utils/API/Models/Arrows/Arrow.cs create mode 100644 KruacentExiled/KE.Utils/KE.Utils/API/Models/Arrows/MoveArrow.cs create mode 100644 KruacentExiled/KE.Utils/KE.Utils/API/Models/Arrows/RotateArrow.cs create mode 100644 KruacentExiled/KE.Utils/KE.Utils/API/Models/Arrows/ScaleArrow.cs create mode 100644 KruacentExiled/KE.Utils/KE.Utils/API/Models/Arrows/XArrow.cs create mode 100644 KruacentExiled/KE.Utils/KE.Utils/API/Models/Arrows/YArrow.cs create mode 100644 KruacentExiled/KE.Utils/KE.Utils/API/Models/Arrows/ZArrow.cs create mode 100644 KruacentExiled/KE.Utils/KE.Utils/API/Models/Blueprints/AdminToyBlueprint.cs create mode 100644 KruacentExiled/KE.Utils/KE.Utils/API/Models/Blueprints/LightBlueprint.cs create mode 100644 KruacentExiled/KE.Utils/KE.Utils/API/Models/Blueprints/ModelBlueprint.cs create mode 100644 KruacentExiled/KE.Utils/KE.Utils/API/Models/Blueprints/PrimitiveBlueprint.cs create mode 100644 KruacentExiled/KE.Utils/KE.Utils/API/Models/Commands/AllCommands.cs create mode 100644 KruacentExiled/KE.Utils/KE.Utils/API/Models/Commands/ChangeColor.cs create mode 100644 KruacentExiled/KE.Utils/KE.Utils/API/Models/Commands/ChangePrimType.cs rename KruacentExiled/KE.Utils/{ => KE.Utils}/API/Models/Commands/CreateModel.cs (87%) create mode 100644 KruacentExiled/KE.Utils/KE.Utils/API/Models/Commands/CreatePrim.cs rename KruacentExiled/KE.Utils/{ => KE.Utils}/API/Models/Commands/ListModel.cs (70%) create mode 100644 KruacentExiled/KE.Utils/KE.Utils/API/Models/Commands/LoadModel.cs rename KruacentExiled/KE.Utils/{ => KE.Utils}/API/Models/Commands/ModeMovePrim.cs (100%) create mode 100644 KruacentExiled/KE.Utils/KE.Utils/API/Models/Commands/SaveModel.cs rename KruacentExiled/KE.Utils/{ => KE.Utils}/API/Models/Commands/SelectModel.cs (66%) rename KruacentExiled/KE.Utils/{ => KE.Utils}/API/Models/Commands/ShowCenter.cs (93%) create mode 100644 KruacentExiled/KE.Utils/KE.Utils/API/Models/Model.cs rename KruacentExiled/KE.Utils/{ => KE.Utils}/API/Models/ModelCreator.cs (65%) rename KruacentExiled/KE.Utils/{ => KE.Utils}/API/Models/ModelLoader.cs (53%) rename KruacentExiled/KE.Utils/{ => KE.Utils}/API/Models/Models.cs (100%) create mode 100644 KruacentExiled/KE.Utils/KE.Utils/API/Models/MovementHandler.cs create mode 100644 KruacentExiled/KE.Utils/KE.Utils/API/Models/SelectedModel.cs rename KruacentExiled/KE.Utils/{ => KE.Utils}/API/Models/ToysSettings/PrimitiveSetting.cs (100%) rename KruacentExiled/KE.Utils/{ => KE.Utils}/API/Models/ToysSettings/ToySetting.cs (100%) create mode 100644 KruacentExiled/KE.Utils/KE.Utils/API/OtherUtils.cs create mode 100644 KruacentExiled/KE.Utils/KE.Utils/API/Parser.cs create mode 100644 KruacentExiled/KE.Utils/KE.Utils/API/ReflectionHelper.cs create mode 100644 KruacentExiled/KE.Utils/KE.Utils/API/Sounds/SoundPlayer.cs rename KruacentExiled/KE.Utils/{ => KE.Utils}/Extensions/AdminToyExtension.cs (100%) create mode 100644 KruacentExiled/KE.Utils/KE.Utils/Extensions/NpcExtension.cs rename KruacentExiled/KE.Utils/{ => KE.Utils}/Extensions/PlayerExtension.cs (100%) create mode 100644 KruacentExiled/KE.Utils/KE.Utils/Extensions/RoomExtensions.cs create mode 100644 KruacentExiled/KE.Utils/KE.Utils/KE.Utils.csproj rename KruacentExiled/KE.Utils/{ => KE.Utils}/Quality/Enums/ModelQuality.cs (100%) rename KruacentExiled/KE.Utils/{ => KE.Utils}/Quality/Handlers/QualityToysHandler.cs (100%) rename KruacentExiled/KE.Utils/{ => KE.Utils}/Quality/Models/Base/BaseModel.cs (100%) rename KruacentExiled/KE.Utils/{ => KE.Utils}/Quality/Models/Base/LightModel.cs (100%) rename KruacentExiled/KE.Utils/{ => KE.Utils}/Quality/Models/Base/PrimitiveModel.cs (100%) rename KruacentExiled/KE.Utils/{ => KE.Utils}/Quality/Models/Examples/MineModel.cs (100%) rename KruacentExiled/KE.Utils/{ => KE.Utils}/Quality/Models/Model.cs (100%) rename KruacentExiled/KE.Utils/{ => KE.Utils}/Quality/Models/ModelPrefab.cs (100%) rename KruacentExiled/KE.Utils/{ => KE.Utils}/Quality/Models/QualityModel.cs (100%) rename KruacentExiled/KE.Utils/{ => KE.Utils}/Quality/QualityHandler.cs (100%) rename KruacentExiled/KE.Utils/{ => KE.Utils}/Quality/QualityToysHandler.cs (100%) rename KruacentExiled/KE.Utils/{ => KE.Utils}/Quality/Settings/QualitySettings.cs (100%) rename KruacentExiled/KE.Utils/{ => KE.Utils}/Quality/Structs/LocalWorldSpace.cs (100%) rename KruacentExiled/KE.Utils/{ => KE.Utils}/Quality/Tests/Test.cs (100%) create mode 100644 KruacentExiled/utils-merged/KE.Utilsci/API/Displays/DisplayMeow/DisplayHandler.cs create mode 100644 KruacentExiled/utils-merged/KE.Utilsci/API/Displays/DisplayMeow/HintPlacement.cs create mode 100644 KruacentExiled/utils-merged/KE.Utilsci/API/Interfaces/IEvents.cs create mode 100644 KruacentExiled/utils-merged/KE.Utilsci/API/Sounds/SoundPlayer.cs create mode 100644 KruacentExiled/utils-merged/KE.Utilsci/Extensions/AdminToyExtension.cs create mode 100644 KruacentExiled/utils-merged/KE.Utilsci/Extensions/PlayerExtension.cs rename KruacentExiled/{KE.Utils => utils-merged/KE.Utilsci}/Extensions/RoomExtension.cs (100%) create mode 100644 KruacentExiled/utils-merged/KE.Utilsci/KE.Utils.csproj create mode 100644 KruacentExiled/utils-merged/KE.Utilsci/Quality/Enums/ModelQuality.cs create mode 100644 KruacentExiled/utils-merged/KE.Utilsci/Quality/Handlers/QualityToysHandler.cs create mode 100644 KruacentExiled/utils-merged/KE.Utilsci/Quality/Models/Base/BaseModel.cs create mode 100644 KruacentExiled/utils-merged/KE.Utilsci/Quality/Models/Base/LightModel.cs create mode 100644 KruacentExiled/utils-merged/KE.Utilsci/Quality/Models/Base/PrimitiveModel.cs create mode 100644 KruacentExiled/utils-merged/KE.Utilsci/Quality/Models/Examples/MineModel.cs create mode 100644 KruacentExiled/utils-merged/KE.Utilsci/Quality/Models/Model.cs create mode 100644 KruacentExiled/utils-merged/KE.Utilsci/Quality/Models/ModelPrefab.cs create mode 100644 KruacentExiled/utils-merged/KE.Utilsci/Quality/Models/QualityModel.cs create mode 100644 KruacentExiled/utils-merged/KE.Utilsci/Quality/QualityHandler.cs create mode 100644 KruacentExiled/utils-merged/KE.Utilsci/Quality/QualityToysHandler.cs create mode 100644 KruacentExiled/utils-merged/KE.Utilsci/Quality/Settings/QualitySettings.cs create mode 100644 KruacentExiled/utils-merged/KE.Utilsci/Quality/Structs/LocalWorldSpace.cs create mode 100644 KruacentExiled/utils-merged/KE.Utilsci/Quality/Tests/Test.cs create mode 100644 KruacentExiled/utils-merged/KE.Utilscr/API/Displays/DisplayMeow/DisplayHandler.cs create mode 100644 KruacentExiled/utils-merged/KE.Utilscr/API/Displays/DisplayMeow/HintPlacement.cs create mode 100644 KruacentExiled/utils-merged/KE.Utilscr/API/Interfaces/IEvents.cs create mode 100644 KruacentExiled/utils-merged/KE.Utilscr/API/OtherUtils.cs create mode 100644 KruacentExiled/utils-merged/KE.Utilscr/Extensions/AdminToyExtension.cs create mode 100644 KruacentExiled/utils-merged/KE.Utilscr/Extensions/PlayerExtension.cs create mode 100644 KruacentExiled/utils-merged/KE.Utilscr/Extensions/RoomExtension.cs create mode 100644 KruacentExiled/utils-merged/KE.Utilscr/KE.Utils.csproj create mode 100644 KruacentExiled/utils-merged/KE.Utilscr/Quality/Enums/ModelQuality.cs create mode 100644 KruacentExiled/utils-merged/KE.Utilscr/Quality/Handlers/QualityToysHandler.cs create mode 100644 KruacentExiled/utils-merged/KE.Utilscr/Quality/Models/Base/BaseModel.cs create mode 100644 KruacentExiled/utils-merged/KE.Utilscr/Quality/Models/Base/LightModel.cs create mode 100644 KruacentExiled/utils-merged/KE.Utilscr/Quality/Models/Base/PrimitiveModel.cs create mode 100644 KruacentExiled/utils-merged/KE.Utilscr/Quality/Models/Examples/MineModel.cs create mode 100644 KruacentExiled/utils-merged/KE.Utilscr/Quality/Models/Model.cs create mode 100644 KruacentExiled/utils-merged/KE.Utilscr/Quality/Models/ModelPrefab.cs create mode 100644 KruacentExiled/utils-merged/KE.Utilscr/Quality/Models/QualityModel.cs create mode 100644 KruacentExiled/utils-merged/KE.Utilscr/Quality/QualityHandler.cs create mode 100644 KruacentExiled/utils-merged/KE.Utilscr/Quality/QualityToysHandler.cs create mode 100644 KruacentExiled/utils-merged/KE.Utilscr/Quality/Settings/QualitySettings.cs create mode 100644 KruacentExiled/utils-merged/KE.Utilscr/Quality/Structs/LocalWorldSpace.cs create mode 100644 KruacentExiled/utils-merged/KE.Utilscr/Quality/Tests/Test.cs create mode 100644 KruacentExiled/utils-merged/KE.Utilsge/API/Displays/DisplayMeow/DisplayHandler.cs create mode 100644 KruacentExiled/utils-merged/KE.Utilsge/API/Displays/DisplayMeow/HintPlacement.cs create mode 100644 KruacentExiled/utils-merged/KE.Utilsge/API/Interfaces/IEvents.cs create mode 100644 KruacentExiled/utils-merged/KE.Utilsge/API/ReflectionHelper.cs create mode 100644 KruacentExiled/utils-merged/KE.Utilsge/API/Sounds/SoundPlayer.cs create mode 100644 KruacentExiled/utils-merged/KE.Utilsge/Extensions/AdminToyExtension.cs create mode 100644 KruacentExiled/utils-merged/KE.Utilsge/Extensions/PlayerExtension.cs create mode 100644 KruacentExiled/utils-merged/KE.Utilsge/Extensions/RoomExtension.cs create mode 100644 KruacentExiled/utils-merged/KE.Utilsge/KE.Utils.csproj create mode 100644 KruacentExiled/utils-merged/KE.Utilsge/Quality/Enums/ModelQuality.cs create mode 100644 KruacentExiled/utils-merged/KE.Utilsge/Quality/Handlers/QualityToysHandler.cs create mode 100644 KruacentExiled/utils-merged/KE.Utilsge/Quality/Models/Base/BaseModel.cs create mode 100644 KruacentExiled/utils-merged/KE.Utilsge/Quality/Models/Base/LightModel.cs create mode 100644 KruacentExiled/utils-merged/KE.Utilsge/Quality/Models/Base/PrimitiveModel.cs create mode 100644 KruacentExiled/utils-merged/KE.Utilsge/Quality/Models/Examples/MineModel.cs create mode 100644 KruacentExiled/utils-merged/KE.Utilsge/Quality/Models/Model.cs create mode 100644 KruacentExiled/utils-merged/KE.Utilsge/Quality/Models/ModelPrefab.cs create mode 100644 KruacentExiled/utils-merged/KE.Utilsge/Quality/Models/QualityModel.cs create mode 100644 KruacentExiled/utils-merged/KE.Utilsge/Quality/QualityHandler.cs create mode 100644 KruacentExiled/utils-merged/KE.Utilsge/Quality/QualityToysHandler.cs create mode 100644 KruacentExiled/utils-merged/KE.Utilsge/Quality/Settings/QualitySettings.cs create mode 100644 KruacentExiled/utils-merged/KE.Utilsge/Quality/Structs/LocalWorldSpace.cs create mode 100644 KruacentExiled/utils-merged/KE.Utilsge/Quality/Tests/Test.cs create mode 100644 KruacentExiled/utils-merged/KE.Utilsmap/API/Displays/DisplayMeow/DisplayHandler.cs create mode 100644 KruacentExiled/utils-merged/KE.Utilsmap/API/Displays/DisplayMeow/HintPlacement.cs create mode 100644 KruacentExiled/utils-merged/KE.Utilsmap/API/GifAnimator/RenderGif.cs create mode 100644 KruacentExiled/utils-merged/KE.Utilsmap/API/Interfaces/IEvents.cs create mode 100644 KruacentExiled/utils-merged/KE.Utilsmap/API/Interfaces/ILoadable.cs create mode 100644 KruacentExiled/utils-merged/KE.Utilsmap/API/Models/Arrows/Arrow.cs create mode 100644 KruacentExiled/utils-merged/KE.Utilsmap/API/Models/Arrows/MoveArrow.cs create mode 100644 KruacentExiled/utils-merged/KE.Utilsmap/API/Models/Arrows/RotateArrow.cs create mode 100644 KruacentExiled/utils-merged/KE.Utilsmap/API/Models/Arrows/ScaleArrow.cs create mode 100644 KruacentExiled/utils-merged/KE.Utilsmap/API/Models/Arrows/XArrow.cs create mode 100644 KruacentExiled/utils-merged/KE.Utilsmap/API/Models/Arrows/YArrow.cs create mode 100644 KruacentExiled/utils-merged/KE.Utilsmap/API/Models/Arrows/ZArrow.cs create mode 100644 KruacentExiled/utils-merged/KE.Utilsmap/API/Models/Blueprints/AdminToyBlueprint.cs create mode 100644 KruacentExiled/utils-merged/KE.Utilsmap/API/Models/Blueprints/LightBlueprint.cs create mode 100644 KruacentExiled/utils-merged/KE.Utilsmap/API/Models/Blueprints/ModelBlueprint.cs create mode 100644 KruacentExiled/utils-merged/KE.Utilsmap/API/Models/Blueprints/PrimitiveBlueprint.cs create mode 100644 KruacentExiled/utils-merged/KE.Utilsmap/API/Models/Commands/AllCommands.cs create mode 100644 KruacentExiled/utils-merged/KE.Utilsmap/API/Models/Commands/ChangeColor.cs create mode 100644 KruacentExiled/utils-merged/KE.Utilsmap/API/Models/Commands/ChangePrimType.cs create mode 100644 KruacentExiled/utils-merged/KE.Utilsmap/API/Models/Commands/CreateModel.cs create mode 100644 KruacentExiled/utils-merged/KE.Utilsmap/API/Models/Commands/CreatePrim.cs create mode 100644 KruacentExiled/utils-merged/KE.Utilsmap/API/Models/Commands/ListModel.cs create mode 100644 KruacentExiled/utils-merged/KE.Utilsmap/API/Models/Commands/LoadModel.cs create mode 100644 KruacentExiled/utils-merged/KE.Utilsmap/API/Models/Commands/ModeMovePrim.cs create mode 100644 KruacentExiled/utils-merged/KE.Utilsmap/API/Models/Commands/SaveModel.cs create mode 100644 KruacentExiled/utils-merged/KE.Utilsmap/API/Models/Commands/SelectModel.cs create mode 100644 KruacentExiled/utils-merged/KE.Utilsmap/API/Models/Commands/ShowCenter.cs create mode 100644 KruacentExiled/utils-merged/KE.Utilsmap/API/Models/Model.cs create mode 100644 KruacentExiled/utils-merged/KE.Utilsmap/API/Models/ModelCreator.cs create mode 100644 KruacentExiled/utils-merged/KE.Utilsmap/API/Models/ModelLoader.cs create mode 100644 KruacentExiled/utils-merged/KE.Utilsmap/API/Models/Models.cs create mode 100644 KruacentExiled/utils-merged/KE.Utilsmap/API/Models/MovementHandler.cs create mode 100644 KruacentExiled/utils-merged/KE.Utilsmap/API/Models/SelectedModel.cs create mode 100644 KruacentExiled/utils-merged/KE.Utilsmap/API/Models/ToysSettings/PrimitiveSetting.cs create mode 100644 KruacentExiled/utils-merged/KE.Utilsmap/API/Models/ToysSettings/ToySetting.cs create mode 100644 KruacentExiled/utils-merged/KE.Utilsmap/API/OtherUtils.cs create mode 100644 KruacentExiled/utils-merged/KE.Utilsmap/API/Parser.cs create mode 100644 KruacentExiled/utils-merged/KE.Utilsmap/API/Sounds/SoundPlayer.cs create mode 100644 KruacentExiled/utils-merged/KE.Utilsmap/Extensions/AdminToyExtension.cs create mode 100644 KruacentExiled/utils-merged/KE.Utilsmap/Extensions/NpcExtension.cs create mode 100644 KruacentExiled/utils-merged/KE.Utilsmap/Extensions/PlayerExtension.cs create mode 100644 KruacentExiled/utils-merged/KE.Utilsmap/Extensions/RoomExtension.cs create mode 100644 KruacentExiled/utils-merged/KE.Utilsmap/KE.Utils.csproj create mode 100644 KruacentExiled/utils-merged/KE.Utilsmap/Quality/Enums/ModelQuality.cs create mode 100644 KruacentExiled/utils-merged/KE.Utilsmap/Quality/Handlers/QualityToysHandler.cs create mode 100644 KruacentExiled/utils-merged/KE.Utilsmap/Quality/Models/Base/BaseModel.cs create mode 100644 KruacentExiled/utils-merged/KE.Utilsmap/Quality/Models/Base/LightModel.cs create mode 100644 KruacentExiled/utils-merged/KE.Utilsmap/Quality/Models/Base/PrimitiveModel.cs create mode 100644 KruacentExiled/utils-merged/KE.Utilsmap/Quality/Models/Examples/MineModel.cs create mode 100644 KruacentExiled/utils-merged/KE.Utilsmap/Quality/Models/Model.cs create mode 100644 KruacentExiled/utils-merged/KE.Utilsmap/Quality/Models/ModelPrefab.cs create mode 100644 KruacentExiled/utils-merged/KE.Utilsmap/Quality/Models/QualityModel.cs create mode 100644 KruacentExiled/utils-merged/KE.Utilsmap/Quality/QualityHandler.cs create mode 100644 KruacentExiled/utils-merged/KE.Utilsmap/Quality/QualityToysHandler.cs create mode 100644 KruacentExiled/utils-merged/KE.Utilsmap/Quality/Settings/QualitySettings.cs create mode 100644 KruacentExiled/utils-merged/KE.Utilsmap/Quality/Structs/LocalWorldSpace.cs create mode 100644 KruacentExiled/utils-merged/KE.Utilsmap/Quality/Tests/Test.cs create mode 100644 KruacentExiled/utils-merged/KE.Utilsmisc/API/Displays/DisplayMeow/DisplayHandler.cs create mode 100644 KruacentExiled/utils-merged/KE.Utilsmisc/API/Displays/DisplayMeow/HintPlacement.cs create mode 100644 KruacentExiled/utils-merged/KE.Utilsmisc/API/Interfaces/IEvents.cs create mode 100644 KruacentExiled/utils-merged/KE.Utilsmisc/API/ReflectionHelper.cs create mode 100644 KruacentExiled/utils-merged/KE.Utilsmisc/Extensions/AdminToyExtension.cs create mode 100644 KruacentExiled/utils-merged/KE.Utilsmisc/Extensions/DoorExtension.cs create mode 100644 KruacentExiled/utils-merged/KE.Utilsmisc/Extensions/PlayerExtension.cs create mode 100644 KruacentExiled/utils-merged/KE.Utilsmisc/Extensions/RoomExtensions.cs create mode 100644 KruacentExiled/utils-merged/KE.Utilsmisc/KE.Utils.csproj create mode 100644 KruacentExiled/utils-merged/KE.Utilsmisc/Quality/Enums/ModelQuality.cs create mode 100644 KruacentExiled/utils-merged/KE.Utilsmisc/Quality/Handlers/QualityToysHandler.cs create mode 100644 KruacentExiled/utils-merged/KE.Utilsmisc/Quality/Models/Base/BaseModel.cs create mode 100644 KruacentExiled/utils-merged/KE.Utilsmisc/Quality/Models/Base/LightModel.cs create mode 100644 KruacentExiled/utils-merged/KE.Utilsmisc/Quality/Models/Base/PrimitiveModel.cs create mode 100644 KruacentExiled/utils-merged/KE.Utilsmisc/Quality/Models/Examples/MineModel.cs create mode 100644 KruacentExiled/utils-merged/KE.Utilsmisc/Quality/Models/Model.cs create mode 100644 KruacentExiled/utils-merged/KE.Utilsmisc/Quality/Models/ModelPrefab.cs create mode 100644 KruacentExiled/utils-merged/KE.Utilsmisc/Quality/Models/QualityModel.cs create mode 100644 KruacentExiled/utils-merged/KE.Utilsmisc/Quality/QualityHandler.cs create mode 100644 KruacentExiled/utils-merged/KE.Utilsmisc/Quality/QualityToysHandler.cs create mode 100644 KruacentExiled/utils-merged/KE.Utilsmisc/Quality/Settings/QualitySettings.cs create mode 100644 KruacentExiled/utils-merged/KE.Utilsmisc/Quality/Structs/LocalWorldSpace.cs create mode 100644 KruacentExiled/utils-merged/KE.Utilsmisc/Quality/Tests/Test.cs diff --git a/KruacentExiled/KE.GlobalEventFramework.Examples/KE.GlobalEventFramework.Examples.csproj b/KruacentExiled/KE.GlobalEventFramework.Examples/KE.GlobalEventFramework.Examples.csproj index fec6f9e1..4fe9a10f 100644 --- a/KruacentExiled/KE.GlobalEventFramework.Examples/KE.GlobalEventFramework.Examples.csproj +++ b/KruacentExiled/KE.GlobalEventFramework.Examples/KE.GlobalEventFramework.Examples.csproj @@ -8,11 +8,6 @@ - - - - - diff --git a/KruacentExiled/KE.Utils/API/Models/Model.cs b/KruacentExiled/KE.Utils/API/Models/Model.cs deleted file mode 100644 index 2cdcff18..00000000 --- a/KruacentExiled/KE.Utils/API/Models/Model.cs +++ /dev/null @@ -1,156 +0,0 @@ -using Exiled.API.Features; -using Exiled.API.Features.Core; -using Exiled.API.Features.Doors; -using Exiled.API.Features.Toys; -using Exiled.API.Structs; -using KE.Utils.API.Models.ToysSettings; -using System.Collections.Generic; -using System.Linq; -using System.Runtime.InteropServices; -using UnityEngine; -using Light = Exiled.API.Features.Toys.Light; - -namespace KE.Utils.API.Models -{ - public class Model - { - private static List _models = new(1); - public static List Models => _models.ToList(); - - private HashSet _toys = new(); - public IReadOnlyCollection Toys => [.. _toys]; - private string _name; - public string Name - { - get { return _name; } - } - - private Vector3 _center; - public Vector3 Center - { - get { return _center; } - } - - private int _id; - public int Id - { - get { return _id; } - } - - internal Primitive centerPrim; - - public void SetCenterPrimitive(bool show) - { - if (show) - { - centerPrim.UnSpawn(); - } - else - { - centerPrim.Spawn(); - } - } - - - - public void Add(Primitive p) - { - AddToy(p); - - } - public void Add(Light l) - { - AddToy(l); - } - - - private void AddToy(AdminToy toy) - { - _toys.Add(toy); - } - - public void Spawn() - { - foreach(AdminToy t in Toys) - { - t.Spawn(); - } - } - public void UnSpawn() - { - foreach (AdminToy t in Toys) - { - t.UnSpawn(); - } - } - - public void Destroy() - { - foreach (AdminToy t in Toys) - { - t.Destroy(); - } - } - - internal static Model Create(Vector3 position,IEnumerable toys, string name = "") - { - var m =Model.Create(position, name); - m._toys = toys.ToHashSet(); - - return m; - } - - public static Model Create(Vector3 position, string name= "") - { - - Model m = new(); - _models.Add(m); - m._id = _models.Count; - m._center = position; - if (string.IsNullOrEmpty(name)) - { - m._name = "Model" + m.Id; - } - else - { - m._name = name; - } - - Log.Debug("created model id=" + m.Id); - m.centerPrim = Primitive.Create(position, null, Vector3.one/5, true, new(1, 0, 0, .25f)); - m.centerPrim.Collidable = false; - - return m; - } - - - public static Model Get(string name) - { - foreach(Model m in _models) - { - if(m.Name == name) - { - return m; - } - } - return null; - } - - public static Model Get(int id) - { - _models.TryGet(id, out Model m); - return m; - } - public static bool TryGet(int id, out Model model) - { - model = Get(id); - return model != null; - } - - - public override string ToString() - { - return $"{Id} : {Name} center = {Center}"; - } - } -} diff --git a/KruacentExiled/KE.Utils/API/Models/MovementHandler.cs b/KruacentExiled/KE.Utils/API/Models/MovementHandler.cs deleted file mode 100644 index 4fcec956..00000000 --- a/KruacentExiled/KE.Utils/API/Models/MovementHandler.cs +++ /dev/null @@ -1,72 +0,0 @@ -using Exiled.API.Features.Toys; -using KE.Utils.API.Interfaces; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using UnityEngine; - -namespace KE.Utils.API.Models -{ - internal class MovementHandler : IUsingEvents - { - - private MovementMode _mode = MovementMode.Move; - - public MovementMode Mode - { - get - { - return _mode; - } - set - { - OnChangingMode?.Invoke(value); - _mode = value; - } - } - public static event Action OnChangingMode; - - //xyz - private Primitive[] _arrows = new Primitive[3]; - private bool _primflag = false; - private readonly Vector3 _scale = new Vector3(1f, .1f, .1f); - - - private void TryCreatePrimitives() - { - if (!_primflag) - { - _arrows[0] = Primitive.Create(PrimitiveType.Cube, null, new Vector3(1f, 0f, 0f), _scale); - _arrows[1] = Primitive.Create(PrimitiveType.Cube, null, new Vector3(0f, 1f, 0f), _scale); - _arrows[2] = Primitive.Create(PrimitiveType.Cube, null, new Vector3(0f, 0f, 1f), _scale); - _primflag = true; - } - - } - - - public void SubscribeEvents() - { - - SelectedModel.OnChangedSelection += OnChangedSelection; - } - - public void UnsubscribeEvents() - { - SelectedModel.OnChangedSelection -= OnChangedSelection; - } - - private void OnChangedSelection(Primitive p) - { - TryCreatePrimitives(); - - - - } - - - - } -} diff --git a/KruacentExiled/KE.Utils/API/Models/SelectedModel.cs b/KruacentExiled/KE.Utils/API/Models/SelectedModel.cs deleted file mode 100644 index 5bb68128..00000000 --- a/KruacentExiled/KE.Utils/API/Models/SelectedModel.cs +++ /dev/null @@ -1,85 +0,0 @@ -using Exiled.API.Features; -using Exiled.API.Features.Toys; -using MEC; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using UnityEngine; - -namespace KE.Utils.API.Models -{ - internal class SelectedModel - { - public const float BLINK_REFRESH_RATE = .3f; - - - public Primitive SelectedPrimitive; - private Color _baseColor; - private CoroutineHandle _handle; - - public static event Action OnChangedSelection; - public static event Action OnUnSelect; - - internal SelectedModel() - { - - } - - public void ChangedSelectedPrim(Primitive newPrim) - { - if (newPrim == null) return; - - - UnSelect(); - - if (SelectedPrimitive == null || newPrim != SelectedPrimitive) - { - OnChangedSelection?.Invoke(newPrim); - _baseColor = newPrim.Color; - _handle = Timing.RunCoroutine(Blink(newPrim)); - } - else - { - OnUnSelect?.Invoke(); - } - - } - - - private void UnSelect() - { - if (_handle.IsRunning) - { - - Timing.KillCoroutines(_handle); - SelectedPrimitive.Color = _baseColor; - } - SelectedPrimitive = null; - } - - - private IEnumerator Blink(Primitive p) - { - SelectedPrimitive = p; - Color baseColor = p.Color; - Color baseTrans = new(baseColor.r, baseColor.g, baseColor.b, baseColor.a / 2); - bool transparent = false; - while (true) - { - if (transparent) - { - p.Color = baseTrans; - } - else - { - p.Color = baseColor; - } - yield return Timing.WaitForSeconds(BLINK_REFRESH_RATE); - transparent = !transparent; - } - } - - } -} diff --git a/KruacentExiled/KE.Utils/API/Parser.cs b/KruacentExiled/KE.Utils/API/Parser.cs deleted file mode 100644 index e9a7958c..00000000 --- a/KruacentExiled/KE.Utils/API/Parser.cs +++ /dev/null @@ -1,19 +0,0 @@ -using Exiled.API.Features; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using UnityEngine; - -namespace KE.Utils.API -{ - public static class Parser - { - public static Vector3 Vector3(string s) - { - string[] temp = s.Substring(1, s.Length - 3).Split(','); - return new Vector3(float.Parse(temp[0]), float.Parse(temp[1]), float.Parse(temp[2])); - } - } -} diff --git a/KruacentExiled/KE.Utils/KE.Utils.csproj b/KruacentExiled/KE.Utils/KE.Utils.csproj index 7607f6e4..f3aa4e9a 100644 --- a/KruacentExiled/KE.Utils/KE.Utils.csproj +++ b/KruacentExiled/KE.Utils/KE.Utils.csproj @@ -15,14 +15,11 @@ + - - - - if not "$(EXILED_DEV_REFERENCES)"=="" copy /y "$(OutputPath)$(AssemblyName).dll" "$(EXILED_DEV_REFERENCES)\Plugins\" diff --git a/KruacentExiled/KE.Utils/API/Displays/DisplayMeow/DisplayHandler.cs b/KruacentExiled/KE.Utils/KE.Utils/API/Displays/DisplayMeow/DisplayHandler.cs similarity index 100% rename from KruacentExiled/KE.Utils/API/Displays/DisplayMeow/DisplayHandler.cs rename to KruacentExiled/KE.Utils/KE.Utils/API/Displays/DisplayMeow/DisplayHandler.cs diff --git a/KruacentExiled/KE.Utils/API/Displays/DisplayMeow/HintPlacement.cs b/KruacentExiled/KE.Utils/KE.Utils/API/Displays/DisplayMeow/HintPlacement.cs similarity index 100% rename from KruacentExiled/KE.Utils/API/Displays/DisplayMeow/HintPlacement.cs rename to KruacentExiled/KE.Utils/KE.Utils/API/Displays/DisplayMeow/HintPlacement.cs diff --git a/KruacentExiled/KE.Utils/KE.Utils/API/GifAnimator/RenderGif.cs b/KruacentExiled/KE.Utils/KE.Utils/API/GifAnimator/RenderGif.cs new file mode 100644 index 00000000..f4276d33 --- /dev/null +++ b/KruacentExiled/KE.Utils/KE.Utils/API/GifAnimator/RenderGif.cs @@ -0,0 +1,128 @@ +using System.Collections.Generic; +using System.Drawing; +using System.Drawing.Imaging; +using System.IO; +using Exiled.API.Features; +using Exiled.API.Features.Toys; +using MEC; +using UnityEngine; +using UnityEngine.Rendering; +using Color = UnityEngine.Color; +namespace KE.Utils.API.GifAnimator +{ + internal class RenderGif + { + + public static void Spawn() + { + + } + + + + private static IEnumerator RenderImageCoroutine(object target, string filePath, float maxWidth, float maxHeight, float distance, float duration, int targetWidth, int targetHeight) + { + if (!File.Exists(filePath)) + { + Log.Debug($"No image was found under: {filePath}"); + yield break; + } + + byte[] imageData = File.ReadAllBytes(filePath); + + + + + + + Texture2D original = new Texture2D(2, 2); + + + try + { + original.LoadRawTextureData(imageData); + } + catch(UnityException) + { + Log.Debug("Image couldnt be loaded."); + yield break; + } + + Texture2D scaled = new Texture2D(targetWidth, targetHeight, TextureFormat.RGBA32, false); + + for (int x = 0; x < targetWidth; x++) + { + for (int y = 0; y < targetHeight; y++) + { + float u = x / (float)targetWidth; + float v = y / (float)targetHeight; + Color color = original.GetPixelBilinear(u, v); + scaled.SetPixel(x, y, color); + } + } + scaled.Apply(); + + float pixelScaleX = maxWidth / targetWidth; + float pixelScaleY = maxHeight / targetHeight; + float scale = Mathf.Min(pixelScaleX, pixelScaleY); + + Vector3 forwardOrigin; + Quaternion rotation = Quaternion.identity; + + if (target is Exiled.API.Features.Player player) + { + forwardOrigin = player.CameraTransform.position + player.CameraTransform.forward * distance; + + Vector3 directionToPlayer = forwardOrigin - player.CameraTransform.position; + directionToPlayer.y = 0; + rotation = Quaternion.LookRotation(directionToPlayer); + } + else if (target is Vector3 position) + { + forwardOrigin = position + Vector3.forward * distance; + Vector3 directionToPosition = forwardOrigin - position; + directionToPosition.y = 0; + rotation = Quaternion.LookRotation(directionToPosition); + } + else if (target is Room room) + { + forwardOrigin = room.Position + Vector3.up * 2f; + Vector3 directionToRoom = forwardOrigin - room.Position; + directionToRoom.y = 0; + rotation = Quaternion.LookRotation(directionToRoom); + } + else + { + Log.Debug("Invalid object type. Valid types: Player, Vector3, Room"); + yield break; + } + + Vector3 offset = new Vector3((targetWidth * scale) / 2f, (targetHeight * scale) / 2f, 0); + + for (int x = 0; x < targetWidth; x++) + { + for (int y = 0; y < targetHeight; y++) + { + Color pixelColor = scaled.GetPixel(x, y); + if (pixelColor.a < 0.1f) + continue; + + Vector3 localOffset = new Vector3(x * scale, y * scale, 0) - offset; + Vector3 worldPos = forwardOrigin + rotation * localOffset; + + Primitive quad = Primitive.Create(PrimitiveType.Quad); + quad.Position = worldPos; + quad.Scale = new Vector3(scale, scale, scale * 0.01f); + quad.Color = pixelColor; + + Quaternion fixedRotation = Quaternion.Euler(0f, rotation.eulerAngles.y, 0f); + quad.Rotation = fixedRotation; + quad.Flags = AdminToys.PrimitiveFlags.Visible; + } + + yield return Timing.WaitForOneFrame; + } + } + + } +} diff --git a/KruacentExiled/KE.Utils/API/Interfaces/IEvents.cs b/KruacentExiled/KE.Utils/KE.Utils/API/Interfaces/IEvents.cs similarity index 100% rename from KruacentExiled/KE.Utils/API/Interfaces/IEvents.cs rename to KruacentExiled/KE.Utils/KE.Utils/API/Interfaces/IEvents.cs diff --git a/KruacentExiled/KE.Utils/KE.Utils/API/Interfaces/ILoadable.cs b/KruacentExiled/KE.Utils/KE.Utils/API/Interfaces/ILoadable.cs new file mode 100644 index 00000000..c9e00399 --- /dev/null +++ b/KruacentExiled/KE.Utils/KE.Utils/API/Interfaces/ILoadable.cs @@ -0,0 +1,13 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace KE.Utils.API.Interfaces +{ + public interface ILoadable + { + public string Loadable(char separator); + } +} diff --git a/KruacentExiled/KE.Utils/KE.Utils/API/Models/Arrows/Arrow.cs b/KruacentExiled/KE.Utils/KE.Utils/API/Models/Arrows/Arrow.cs new file mode 100644 index 00000000..990999c7 --- /dev/null +++ b/KruacentExiled/KE.Utils/KE.Utils/API/Models/Arrows/Arrow.cs @@ -0,0 +1,58 @@ +using Exiled.API.Features.Toys; +using InventorySystem.Items.Keycards; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Net.Sockets; +using System.Text; +using System.Threading.Tasks; +using UnityEngine; + +namespace KE.Utils.API.Models.Arrows +{ + internal abstract class Arrow + { + internal static HashSet List = new(); + internal abstract Vector3 Offset { get; } + internal abstract Vector3 Rotation { get; } + internal abstract Color Color { get; } + + protected readonly Vector3 scale = new Vector3(1f, .1f, .1f); + + private Primitive _primitive; + + internal Primitive Primitive + { + get { return _primitive; } + } + internal Arrow() + { + List.Add(this); + _primitive = Primitive.Create(PrimitiveType.Cube, null, Rotation, scale); + _primitive.Color = Color; + } + + internal void Move(Vector3 newPos) + { + _primitive.Position = newPos + Offset; + } + + internal static bool IsPrimitiveArrow(Primitive p) + { + Arrow a =GetArrow(p); + return a != null; + } + + internal static Arrow GetArrow(Primitive p) + { + + foreach(Arrow a in List) + { + if (p == a.Primitive) + return a; + } + return null; + + } + } +} diff --git a/KruacentExiled/KE.Utils/KE.Utils/API/Models/Arrows/MoveArrow.cs b/KruacentExiled/KE.Utils/KE.Utils/API/Models/Arrows/MoveArrow.cs new file mode 100644 index 00000000..f3216e7f --- /dev/null +++ b/KruacentExiled/KE.Utils/KE.Utils/API/Models/Arrows/MoveArrow.cs @@ -0,0 +1,12 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace KE.Utils.API.Models.Arrows +{ + internal class MoveArrow + { + } +} diff --git a/KruacentExiled/KE.Utils/KE.Utils/API/Models/Arrows/RotateArrow.cs b/KruacentExiled/KE.Utils/KE.Utils/API/Models/Arrows/RotateArrow.cs new file mode 100644 index 00000000..518fb4b5 --- /dev/null +++ b/KruacentExiled/KE.Utils/KE.Utils/API/Models/Arrows/RotateArrow.cs @@ -0,0 +1,12 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace KE.Utils.API.Models.Arrows +{ + internal class RotateArrow + { + } +} diff --git a/KruacentExiled/KE.Utils/KE.Utils/API/Models/Arrows/ScaleArrow.cs b/KruacentExiled/KE.Utils/KE.Utils/API/Models/Arrows/ScaleArrow.cs new file mode 100644 index 00000000..99bf7d55 --- /dev/null +++ b/KruacentExiled/KE.Utils/KE.Utils/API/Models/Arrows/ScaleArrow.cs @@ -0,0 +1,12 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace KE.Utils.API.Models.Arrows +{ + internal class ScaleArrow + { + } +} diff --git a/KruacentExiled/KE.Utils/KE.Utils/API/Models/Arrows/XArrow.cs b/KruacentExiled/KE.Utils/KE.Utils/API/Models/Arrows/XArrow.cs new file mode 100644 index 00000000..073802c3 --- /dev/null +++ b/KruacentExiled/KE.Utils/KE.Utils/API/Models/Arrows/XArrow.cs @@ -0,0 +1,16 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using UnityEngine; + +namespace KE.Utils.API.Models.Arrows +{ + internal class XArrow : Arrow + { + internal override Vector3 Offset => new Vector3(scale.x / 2,0); + internal override Vector3 Rotation => new Vector3(0, 0f, 0f); + internal override Color Color => Color.red; + } +} diff --git a/KruacentExiled/KE.Utils/KE.Utils/API/Models/Arrows/YArrow.cs b/KruacentExiled/KE.Utils/KE.Utils/API/Models/Arrows/YArrow.cs new file mode 100644 index 00000000..e437766e --- /dev/null +++ b/KruacentExiled/KE.Utils/KE.Utils/API/Models/Arrows/YArrow.cs @@ -0,0 +1,16 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using UnityEngine; + +namespace KE.Utils.API.Models.Arrows +{ + internal class YArrow : Arrow + { + internal override Vector3 Offset => new Vector3(0, scale.x / 2); + internal override Vector3 Rotation => new Vector3(0, 0f, 90f); + internal override Color Color => Color.green; + } +} diff --git a/KruacentExiled/KE.Utils/KE.Utils/API/Models/Arrows/ZArrow.cs b/KruacentExiled/KE.Utils/KE.Utils/API/Models/Arrows/ZArrow.cs new file mode 100644 index 00000000..30c27866 --- /dev/null +++ b/KruacentExiled/KE.Utils/KE.Utils/API/Models/Arrows/ZArrow.cs @@ -0,0 +1,16 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using UnityEngine; + +namespace KE.Utils.API.Models.Arrows +{ + internal class ZArrow : Arrow + { + internal override Vector3 Offset => new Vector3(0,0, scale.x / 2); + internal override Vector3 Rotation => new Vector3(0, 90f, 0); + internal override Color Color => Color.blue; + } +} diff --git a/KruacentExiled/KE.Utils/KE.Utils/API/Models/Blueprints/AdminToyBlueprint.cs b/KruacentExiled/KE.Utils/KE.Utils/API/Models/Blueprints/AdminToyBlueprint.cs new file mode 100644 index 00000000..ccfcff3d --- /dev/null +++ b/KruacentExiled/KE.Utils/KE.Utils/API/Models/Blueprints/AdminToyBlueprint.cs @@ -0,0 +1,69 @@ +using Exiled.API.Enums; +using Exiled.API.Features.Toys; +using Exiled.API.Interfaces; +using KE.Utils.API.Interfaces; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using UnityEngine; +using Light = Exiled.API.Features.Toys.Light; + +namespace KE.Utils.API.Models.Blueprints +{ + public abstract class AdminToyBlueprint : ILoadable + { + public AdminToyType AdminToyType { get; protected set; } + //local position + public Vector3 Position { get; protected set; } + public Vector3 Rotation { get; protected set; } + public Vector3 Scale { get; protected set; } + + + public static AdminToyBlueprint Create(AdminToy adminToy, Vector3? center = null) + { + AdminToyBlueprint result; + + + if (adminToy.ToyType == AdminToyType.PrimitiveObject) + { + result = new PrimitiveBlueprint(adminToy as Primitive); + + } + else if(adminToy.ToyType == AdminToyType.LightSource) + { + result = new LightBlueprint(adminToy as Light); + } + else + { + throw new NotImplementedException("only primitive and light"); + } + + result.Position = adminToy.Position - center ?? adminToy.Position; + result.Rotation = adminToy.Rotation.eulerAngles; + + return result; + } + + + public string Loadable(char separator) + { + StringBuilder b = new(); + b.Append(AdminToyType.ToString()); + b.Append(separator); + b.Append(Position); + b.Append(separator); + b.Append(Rotation); + b.Append(separator); + b.Append(Scale); + b.Append(separator); + b.Append(Load(separator)); + + + return b.ToString(); + } + public abstract AdminToy Spawn(Vector3 center); + protected abstract string Load(char separator); + } +} diff --git a/KruacentExiled/KE.Utils/KE.Utils/API/Models/Blueprints/LightBlueprint.cs b/KruacentExiled/KE.Utils/KE.Utils/API/Models/Blueprints/LightBlueprint.cs new file mode 100644 index 00000000..1dc91294 --- /dev/null +++ b/KruacentExiled/KE.Utils/KE.Utils/API/Models/Blueprints/LightBlueprint.cs @@ -0,0 +1,37 @@ +using Exiled.API.Enums; +using Exiled.API.Features.Toys; +using UnityEngine; +using Light = Exiled.API.Features.Toys.Light; + +namespace KE.Utils.API.Models.Blueprints +{ + public class LightBlueprint : AdminToyBlueprint + { + public Color Color { get; } + public float Intensity { get; } + + public LightBlueprint(Light l) + { + AdminToyType = AdminToyType.PrimitiveObject; + Scale = l.Scale; + Color = l.Color; + Intensity = l.Intensity; + } + + + public override AdminToy Spawn(Vector3 center) + { + var l = Light.Create(Position+center, Rotation, Scale, false); + l.Color = Color; + l.Intensity = Intensity; + + + return l; + } + + protected override string Load(char separator) + { + return "#" + ColorUtility.ToHtmlStringRGBA(Color) + separator + Intensity; + } + } +} diff --git a/KruacentExiled/KE.Utils/KE.Utils/API/Models/Blueprints/ModelBlueprint.cs b/KruacentExiled/KE.Utils/KE.Utils/API/Models/Blueprints/ModelBlueprint.cs new file mode 100644 index 00000000..0f3a047c --- /dev/null +++ b/KruacentExiled/KE.Utils/KE.Utils/API/Models/Blueprints/ModelBlueprint.cs @@ -0,0 +1,110 @@ +using Exiled.API.Features; +using Exiled.API.Features.Core; +using Exiled.API.Features.Doors; +using Exiled.API.Features.Toys; +using Exiled.API.Structs; +using KE.Utils.API.Models.ToysSettings; +using KE.Utils.Quality.Models; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Runtime.InteropServices; +using UnityEngine; +using Light = Exiled.API.Features.Toys.Light; + +namespace KE.Utils.API.Models.Blueprints +{ + public class ModelBlueprint + { + private static List _bps = new(); + public static List Blueprints => _bps.ToList(); + private HashSet _toys = new(); + public IReadOnlyCollection Toys => [.. _toys]; + private string _name; + public string Name + { + get { return _name; } + } + + private ModelBlueprint() { } + + + + /// + /// + /// + /// + /// + public static ModelBlueprint Create(Model model) + { + var oldMbp = Get(model.Name); + _bps.Remove(oldMbp); + + + ModelBlueprint mbp = new(); + mbp._name = model.Name; + _bps.Add(mbp); + + foreach(AdminToy toy in model.Toys) + { + mbp._toys.Add(AdminToyBlueprint.Create(toy,model.Center)); + } + + return mbp; + } + + + public static ModelBlueprint Create(string name,IEnumerable toys = null) + { + ModelBlueprint mbp = new(); + _bps.Add(mbp); + + if (string.IsNullOrEmpty(name)) + { + throw new ArgumentException("name null or empty"); + } + + if(toys != null) + { + foreach(AdminToy at in toys) + { + mbp._toys.Add(AdminToyBlueprint.Create(at)); + } + } + + + + mbp._name = name; + + return mbp; + } + + public void Spawn(Vector3 position) + { + Model m = Model.Create(this, position,false); + + + } + + + #region getters + public static ModelBlueprint Get(string name) + { + foreach (ModelBlueprint m in Blueprints) + { + if (m.Name == name) + { + return m; + } + } + return null; + } + + public static bool TryGet(string name, out ModelBlueprint model) + { + model = Get(name); + return model != null; + } + #endregion + } +} diff --git a/KruacentExiled/KE.Utils/KE.Utils/API/Models/Blueprints/PrimitiveBlueprint.cs b/KruacentExiled/KE.Utils/KE.Utils/API/Models/Blueprints/PrimitiveBlueprint.cs new file mode 100644 index 00000000..2e59f30a --- /dev/null +++ b/KruacentExiled/KE.Utils/KE.Utils/API/Models/Blueprints/PrimitiveBlueprint.cs @@ -0,0 +1,39 @@ +using Exiled.API.Enums; +using Exiled.API.Features.Toys; +using UnityEngine; + +namespace KE.Utils.API.Models.Blueprints +{ + public class PrimitiveBlueprint : AdminToyBlueprint + { + public Color Color { get; } + public PrimitiveType Type { get; } + + + public PrimitiveBlueprint(Primitive p) + { + AdminToyType = AdminToyType.PrimitiveObject; + + Scale = p.Scale; + Color = p.Color; + Type = p.Type; + } + + + + public override AdminToy Spawn(Vector3 center) + { + var p = Primitive.Create(Type,Position+center, Rotation, Scale, false); + p.Collidable = false; + p.Color = Color; + + + return p; + } + + protected override string Load(char separator) + { + return "#" + ColorUtility.ToHtmlStringRGBA(Color) + separator+Type; + } + } +} diff --git a/KruacentExiled/KE.Utils/KE.Utils/API/Models/Commands/AllCommands.cs b/KruacentExiled/KE.Utils/KE.Utils/API/Models/Commands/AllCommands.cs new file mode 100644 index 00000000..8ba12e68 --- /dev/null +++ b/KruacentExiled/KE.Utils/KE.Utils/API/Models/Commands/AllCommands.cs @@ -0,0 +1,33 @@ +using CommandSystem; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Reflection; +using System.Text; +using System.Threading.Tasks; + +namespace KE.Utils.API.Models.Commands +{ + public static class AllCommands + { + + public static IEnumerable Get(Assembly assembly = null) + { + return new List() + { + new ChangeColor(), + new ChangePrimType(), + new CreateModel(), + new CreatePrim(), + new ListModel(), + new LoadModel(), + new ModeMovePrim(), + new SelectModel(), + new ShowCenter(), + new SaveModel() + + }; + + } + } +} diff --git a/KruacentExiled/KE.Utils/KE.Utils/API/Models/Commands/ChangeColor.cs b/KruacentExiled/KE.Utils/KE.Utils/API/Models/Commands/ChangeColor.cs new file mode 100644 index 00000000..3b78d218 --- /dev/null +++ b/KruacentExiled/KE.Utils/KE.Utils/API/Models/Commands/ChangeColor.cs @@ -0,0 +1,72 @@ +using CommandSystem; +using Exiled.API.Features; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using KE.Utils.API.Models; +using UnityEngine; +using Exiled.API.Features.Toys; + +namespace KE.Utils.API.Models.Commands +{ + public class ChangeColor : ICommand + { + + public string Command { get; } = "changecolor"; + + public string[] Aliases { get; } = { "cc" }; + + public string Description { get; } = "change color rgba (0-255)"; + + public bool Execute(ArraySegment arguments, ICommandSender sender, out string response) + { + Player p = Player.Get(sender); + if (p == null) + { + response = "This player can't do this command"; + return false; + } + + if (arguments.Count < 3) + { + response = "not enough arguments"; + return false; + } + if(!byte.TryParse(arguments.At(0),out byte r) || + !byte.TryParse(arguments.At(1), out byte g) || + !byte.TryParse(arguments.At(2), out byte b)) + { + response = "number between 0 & 255"; + return false; + } + + Color32 c; + + if(arguments.Count > 3 && byte.TryParse(arguments.At(3),out byte a)) + { + c = new Color32(r, g, b, a); + } + else + { + c = new Color32(r, g, b,255); + } + + Primitive prim = Models.Instance.ModelCreator.ModelHandler.SelectedPrimitive; + + if(prim == null) + { + response = "no primitive selected"; + return false; + } + + prim.Color = c; + + + response = $"new color set to " + c.ToString(); + return true; + } + + } +} diff --git a/KruacentExiled/KE.Utils/KE.Utils/API/Models/Commands/ChangePrimType.cs b/KruacentExiled/KE.Utils/KE.Utils/API/Models/Commands/ChangePrimType.cs new file mode 100644 index 00000000..434427df --- /dev/null +++ b/KruacentExiled/KE.Utils/KE.Utils/API/Models/Commands/ChangePrimType.cs @@ -0,0 +1,53 @@ +using CommandSystem; +using Exiled.API.Features; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using KE.Utils.API.Models; +using UnityEngine; + +namespace KE.Utils.API.Models.Commands +{ + public class ChangePrimType : ICommand + { + + public string Command { get; } = "changeprimtype"; + + public string[] Aliases { get; } = { "cpt" }; + + public string Description { get; } = "select the mode : scale,move,rotate"; + + public bool Execute(ArraySegment arguments, ICommandSender sender, out string response) + { + Player p = Player.Get(sender); + if (p == null) + { + response = "This player can't do this command"; + return false; + } + + if (arguments.Count < 1) + { + response = "not enough arguments"; + return false; + } + string type = arguments.At(0); + + + if(!Enum.TryParse(type, out PrimitiveType prim)) + { + response = "wrong argument"; + return false; + } + + + Models.Instance.ModelCreator.ModelHandler.SelectedPrimitive.Type = prim; + + response = $"Mode set to " + prim ; + return true; + } + + } +} diff --git a/KruacentExiled/KE.Utils/API/Models/Commands/CreateModel.cs b/KruacentExiled/KE.Utils/KE.Utils/API/Models/Commands/CreateModel.cs similarity index 87% rename from KruacentExiled/KE.Utils/API/Models/Commands/CreateModel.cs rename to KruacentExiled/KE.Utils/KE.Utils/API/Models/Commands/CreateModel.cs index fca48749..d549cb50 100644 --- a/KruacentExiled/KE.Utils/API/Models/Commands/CreateModel.cs +++ b/KruacentExiled/KE.Utils/KE.Utils/API/Models/Commands/CreateModel.cs @@ -1,6 +1,5 @@ using CommandSystem; using Exiled.API.Features; -using KE.Utils.API.Models; using System; using System.Collections.Generic; using System.Linq; @@ -36,7 +35,8 @@ public bool Execute(ArraySegment arguments, ICommandSender sender, out s string name = arguments.At(0); Model m = Model.Create(p.Position, name); - response = $"Created model ({m.Name}) at {m.Center}"; + Models.Instance.ModelCreator.ModelHandler.SelectedModel = m; + response = $"Created & selected model ({m.Name}) at {m.Center}"; return true; } diff --git a/KruacentExiled/KE.Utils/KE.Utils/API/Models/Commands/CreatePrim.cs b/KruacentExiled/KE.Utils/KE.Utils/API/Models/Commands/CreatePrim.cs new file mode 100644 index 00000000..edcd6306 --- /dev/null +++ b/KruacentExiled/KE.Utils/KE.Utils/API/Models/Commands/CreatePrim.cs @@ -0,0 +1,47 @@ +using CommandSystem; +using Exiled.API.Features; +using Exiled.API.Features.Toys; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace KE.Utils.API.Models.Commands +{ + public class CreatePrim : ICommand + { + + public string Command { get; } = "createprimitive"; + + public string[] Aliases { get; } = { "cp" }; //no not like that + + public string Description { get; } = "create a new primitive at your position"; + + public bool Execute(ArraySegment arguments, ICommandSender sender, out string response) + { + + Player p = Player.Get(sender); + if (p == null) + { + response = "This player can't do this command"; + return false; + } + + + Model m = Models.Instance.ModelCreator.SelectedModel; + + if (m == null) + { + response = "no model selected"; + return false; + } + m.Add(p.Position); + + + response = "created!"; + return true; + } + + } +} diff --git a/KruacentExiled/KE.Utils/API/Models/Commands/ListModel.cs b/KruacentExiled/KE.Utils/KE.Utils/API/Models/Commands/ListModel.cs similarity index 70% rename from KruacentExiled/KE.Utils/API/Models/Commands/ListModel.cs rename to KruacentExiled/KE.Utils/KE.Utils/API/Models/Commands/ListModel.cs index f78b78c1..79f42597 100644 --- a/KruacentExiled/KE.Utils/API/Models/Commands/ListModel.cs +++ b/KruacentExiled/KE.Utils/KE.Utils/API/Models/Commands/ListModel.cs @@ -1,11 +1,11 @@ using CommandSystem; using Exiled.API.Features; +using KE.Utils.API.Models.Blueprints; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; -using KE.Utils.API.Models; namespace KE.Utils.API.Models.Commands { @@ -24,7 +24,13 @@ public bool Execute(ArraySegment arguments, ICommandSender sender, out s b.AppendLine($"Models ({Model.Models.Count}) :"); foreach (Model m in Model.Models) { - b.AppendLine($"({m.Id}) - {m.Name} pos: {m.Id}"); + b.AppendLine($"{m.Name} pos: {m.Center} spawned? :{m.Spawned}"); + } + + b.AppendLine($"Blueprints ({ModelBlueprint.Blueprints.Count}) :"); + foreach (ModelBlueprint m in ModelBlueprint.Blueprints) + { + b.AppendLine($"{m.Name}"); } diff --git a/KruacentExiled/KE.Utils/KE.Utils/API/Models/Commands/LoadModel.cs b/KruacentExiled/KE.Utils/KE.Utils/API/Models/Commands/LoadModel.cs new file mode 100644 index 00000000..7be25565 --- /dev/null +++ b/KruacentExiled/KE.Utils/KE.Utils/API/Models/Commands/LoadModel.cs @@ -0,0 +1,65 @@ +using CommandSystem; +using Exiled.API.Features; +using KE.Utils.API.Models.Blueprints; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Xml.Linq; + +namespace KE.Utils.API.Models.Commands +{ + public class LoadModel : ICommand + { + + public string Command { get; } = "load"; + + public string[] Aliases { get; } = { "lo" }; + + public string Description { get; } = "load a model from a blueprint"; + + public bool Execute(ArraySegment arguments, ICommandSender sender, out string response) + { + + Player p = Player.Get(sender); + if (p == null) + { + response = "This player can't do this command"; + return false; + } + + if (arguments.Count < 1) + { + response = "not enough arguments"; + return false; + } + + string name = arguments.At(0); + + if (string.IsNullOrEmpty(name)) + { + response = "name null or empty"; + return false; + } + + foreach(ModelBlueprint bp in ModelBlueprint.Blueprints) + { + + Log.Info($"{bp.Name} == {name} : {bp.Name == name}"); + } + + + if(!ModelBlueprint.TryGet(name,out var mbp)) + { + response = "blueprint not found"; + return false; + } + + mbp.Spawn(p.Position); + response = $"Created model ({mbp.Name}) at {p.Position}"; + return true; + } + + } +} diff --git a/KruacentExiled/KE.Utils/API/Models/Commands/ModeMovePrim.cs b/KruacentExiled/KE.Utils/KE.Utils/API/Models/Commands/ModeMovePrim.cs similarity index 100% rename from KruacentExiled/KE.Utils/API/Models/Commands/ModeMovePrim.cs rename to KruacentExiled/KE.Utils/KE.Utils/API/Models/Commands/ModeMovePrim.cs diff --git a/KruacentExiled/KE.Utils/KE.Utils/API/Models/Commands/SaveModel.cs b/KruacentExiled/KE.Utils/KE.Utils/API/Models/Commands/SaveModel.cs new file mode 100644 index 00000000..d40048e5 --- /dev/null +++ b/KruacentExiled/KE.Utils/KE.Utils/API/Models/Commands/SaveModel.cs @@ -0,0 +1,47 @@ +using CommandSystem; +using Exiled.API.Features; +using KE.Utils.API.Models.Blueprints; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Xml.Linq; + +namespace KE.Utils.API.Models.Commands +{ + public class SaveModel : ICommand + { + + public string Command { get; } = "save"; + + public string[] Aliases { get; } = { "sa" }; + + public string Description { get; } = "save a model to file"; + + public bool Execute(ArraySegment arguments, ICommandSender sender, out string response) + { + + Player p = Player.Get(sender); + if (p == null) + { + response = "This player can't do this command"; + return false; + } + + + Model model = Models.Instance.ModelCreator.SelectedModel; + if (model == null) + { + response = "no model selected"; + return false; + } + + model.Save(); + + response = $"Saved ({model.Name})"; + return true; + } + + } +} diff --git a/KruacentExiled/KE.Utils/API/Models/Commands/SelectModel.cs b/KruacentExiled/KE.Utils/KE.Utils/API/Models/Commands/SelectModel.cs similarity index 66% rename from KruacentExiled/KE.Utils/API/Models/Commands/SelectModel.cs rename to KruacentExiled/KE.Utils/KE.Utils/API/Models/Commands/SelectModel.cs index d6656829..266ce4d4 100644 --- a/KruacentExiled/KE.Utils/API/Models/Commands/SelectModel.cs +++ b/KruacentExiled/KE.Utils/KE.Utils/API/Models/Commands/SelectModel.cs @@ -5,7 +5,6 @@ using System.Linq; using System.Text; using System.Threading.Tasks; -using KE.Utils.API.Models; namespace KE.Utils.API.Models.Commands { @@ -16,7 +15,7 @@ public class SelectModel : ICommand public string[] Aliases { get; } = { "s" }; - public string Description { get; } = "select an existing"; + public string Description { get; } = "select an existing model"; public bool Execute(ArraySegment arguments, ICommandSender sender, out string response) { @@ -27,14 +26,29 @@ public bool Execute(ArraySegment arguments, ICommandSender sender, out s response = "This player can't do this command"; return false; } + if (arguments.Count < 1) + { + response = "not enough arguments"; + return false; + } + string name = arguments.At(0); + + if (string.IsNullOrEmpty(name)) + { + response = "name null or empty"; + return false; + } + + + - if (!Model.TryGet(int.Parse(arguments.At(1)), out Model m)) + if (!Model.TryGet(name, out Model m)) { response = "model not found"; return false; } response = $"model ({m.Name}) selected {m.Center}"; - Models.Instance.ModelCreator.ModelSelected = m; + Models.Instance.ModelCreator.ModelHandler.SelectedModel = m; return true; } diff --git a/KruacentExiled/KE.Utils/API/Models/Commands/ShowCenter.cs b/KruacentExiled/KE.Utils/KE.Utils/API/Models/Commands/ShowCenter.cs similarity index 93% rename from KruacentExiled/KE.Utils/API/Models/Commands/ShowCenter.cs rename to KruacentExiled/KE.Utils/KE.Utils/API/Models/Commands/ShowCenter.cs index 990f92d9..7b6cc05e 100644 --- a/KruacentExiled/KE.Utils/API/Models/Commands/ShowCenter.cs +++ b/KruacentExiled/KE.Utils/KE.Utils/API/Models/Commands/ShowCenter.cs @@ -27,7 +27,7 @@ public bool Execute(ArraySegment arguments, ICommandSender sender, out s return false; } - Model m = Models.Instance.ModelCreator.ModelSelected; + Model m = Models.Instance.ModelCreator.ModelHandler.SelectedModel; if(m == null) { diff --git a/KruacentExiled/KE.Utils/KE.Utils/API/Models/Model.cs b/KruacentExiled/KE.Utils/KE.Utils/API/Models/Model.cs new file mode 100644 index 00000000..6e84fbc9 --- /dev/null +++ b/KruacentExiled/KE.Utils/KE.Utils/API/Models/Model.cs @@ -0,0 +1,202 @@ +using Exiled.API.Features; +using Exiled.API.Features.Toys; +using KE.Utils.API.Models.Blueprints; +using System; +using System.Collections.Generic; +using System.Linq; +using UnityEngine; + +namespace KE.Utils.API.Models +{ + public class Model + { + private static List _models = new(); + public static List Models => _models.ToList(); + + private HashSet _toys = new(); + public IReadOnlyCollection Toys => [.. _toys]; + private string _name; + public string Name + { + get { return _name; } + } + + private Vector3 _center; + public Vector3 Center + { + get { return _center; } + } + private bool _spawned = true; + public bool Spawned + { + get { return _spawned; } + } + + private ModelBlueprint _blueprint; + + public ModelBlueprint Blueprint + { + get { return _blueprint; } + } + + public bool LoadedFromBlueprint + { + get + { + return Blueprint != null; + } + } + + + + + + internal Primitive centerPrim; + + public void SetCenterPrimitive(bool show) + { + if (show) + { + centerPrim.Spawn(); + } + else + { + centerPrim.UnSpawn(); + } + } + + + + public Primitive Add(Vector3 pos) + { + var p = Primitive.Create(pos, null, null, true); + + AddToy(p); + return p; + } + + + protected virtual void AddToy(AdminToy toy,bool editMode = true) + { + if(toy is Primitive p && editMode) + { + p.Collidable = true; + } + + + _toys.Add(toy); + } + + private Model(Vector3 center) + { + _models.Add(this); + _center = center; + } + + public static Model Create(Vector3 position, string name) + { + + Model m = new(position); + if (string.IsNullOrEmpty(name)) + { + throw new ArgumentException("name null or empty"); + } + m._name = name; + + Log.Debug("created model id=" + m.Name); + m.centerPrim = Primitive.Create(position, null, Vector3.one / 5, true, new(1, 0, 0, .25f)); + m.centerPrim.Collidable = false; + + return m; + } + + + public static Model Create(ModelBlueprint blueprint,Vector3 position,bool editMode = false) + { + Model m = new(position); + m._name = blueprint.Name; + + foreach (AdminToyBlueprint toy in blueprint.Toys) + { + Log.Info("create toy "+toy.AdminToyType); + AdminToy trueToy = toy.Spawn(m.Center); + + + m.AddToy(trueToy, editMode); + + } + + return m; + + } + + /// + /// Create a based of this

+ /// Note : will overwrite the old blueprint + ///
+ public void CreateBlueprint() + { + ModelBlueprint bp = ModelBlueprint.Create(this); + + _blueprint = bp; + + } + + + #region getter + public static Model Get(string name) + { + foreach (Model m in _models) + { + if (m.Name == name) + { + return m; + } + } + return null; + } + + public static bool TryGet(string name, out Model model) + { + model = Get(name); + return model != null; + } + + + public override string ToString() + { + return $"{Name} center = {Center}"; + } + #endregion + + #region spawn + public void Spawn() + { + foreach (AdminToy t in Toys) + { + t.Spawn(); + } + _spawned = true; + } + public void UnSpawn() + { + foreach (AdminToy t in Toys) + { + t.UnSpawn(); + } + _spawned = false; + } + + public void Destroy() + { + foreach (AdminToy t in Toys) + { + t.Destroy(); + } + _models.Remove(this); + + } + + #endregion + } +} diff --git a/KruacentExiled/KE.Utils/API/Models/ModelCreator.cs b/KruacentExiled/KE.Utils/KE.Utils/API/Models/ModelCreator.cs similarity index 65% rename from KruacentExiled/KE.Utils/API/Models/ModelCreator.cs rename to KruacentExiled/KE.Utils/KE.Utils/API/Models/ModelCreator.cs index e9feef77..85758ad9 100644 --- a/KruacentExiled/KE.Utils/API/Models/ModelCreator.cs +++ b/KruacentExiled/KE.Utils/KE.Utils/API/Models/ModelCreator.cs @@ -4,10 +4,12 @@ using Exiled.API.Features.Toys; using Exiled.Events.EventArgs.Player; using KE.Utils.API.Interfaces; +using KE.Utils.API.Models.Arrows; using MEC; using System; using System.Collections.Generic; using System.Linq; +using System.Runtime.InteropServices; using System.Text; using System.Threading.Tasks; using UnityEngine; @@ -20,7 +22,13 @@ public class ModelCreator : IUsingEvents public const ItemType item = ItemType.GunCOM18; - + public Model SelectedModel + { + get + { + return ModelHandler.SelectedModel; + } + } public MovementMode MovementMode { get @@ -32,15 +40,16 @@ public MovementMode MovementMode MovementHandler.Mode = value; } } - private MovementHandler MovementHandler; - private SelectedModel SelectedModel; + internal MovementHandler MovementHandler { get; private set; } + internal ModelSelection ModelHandler { get; private set; } private bool mode = false; private const float MAX_DISTANCE = 50; + public static event Action IsAiming; + public static event Action StoppedAiming; - public Model ModelSelected; - + public ModelCreator() { @@ -50,45 +59,59 @@ public ModelCreator() public void SubscribeEvents() { - SelectedModel = new(); + ModelHandler = new(); MovementHandler = new(); - + ModelLoader.LoadAll(); MovementHandler.SubscribeEvents(); Exiled.Events.Handlers.Player.DryfiringWeapon += OnDryfiringWeapon; Exiled.Events.Handlers.Player.TogglingWeaponFlashlight += OnTogglingWeaponFlashlight; - Exiled.Events.Handlers.Player.AimingDownSight += OnAimingDownSight; Exiled.Events.Handlers.Server.RoundStarted += Test; + Exiled.Events.Handlers.Player.AimingDownSight += OnAimingDownSight; } - private void Test() - { - foreach (var p in Player.List) - { - p.Role.Set(PlayerRoles.RoleTypeId.ChaosConscript); - var a = p.AddItem(item); - var b = a as Firearm; - b.MagazineAmmo = 2; - - } - } - - public void UnsubscribeEvents() { Exiled.Events.Handlers.Player.DryfiringWeapon -= OnDryfiringWeapon; Exiled.Events.Handlers.Player.TogglingWeaponFlashlight -= OnTogglingWeaponFlashlight; Exiled.Events.Handlers.Player.AimingDownSight -= OnAimingDownSight; Exiled.Events.Handlers.Server.RoundStarted -= Test; - //Exiled.Events.Handlers.Player.Shooting -= OnShooting; MovementHandler.UnsubscribeEvents(); - SelectedModel = null; + ModelHandler = null; MovementHandler = null; } - private void OnAimingDownSight(AimingDownSightEventArgs ev) + + private void Test() { + foreach (var p in Player.List) + { + p.Role.Set(PlayerRoles.RoleTypeId.ChaosConscript); + Timing.CallDelayed(.1f, () => + { + var a = p.AddItem(item); + var b = a as Firearm; + b.MagazineAmmo = 2; + + Primitive.Create(p.Position + Vector3.back, null, null, true, Color.red); + Primitive.Create(p.Position + Vector3.forward, null, null, true, Color.green); + }); + } + } + + + + private void OnAimingDownSight(AimingDownSightEventArgs ev) + { + if (ev.AdsIn) + { + IsAiming?.Invoke(ev.Player); + } + else + { + StoppedAiming?.Invoke(); + } } private void OnDryfiringWeapon(DryfiringWeaponEventArgs ev) @@ -98,8 +121,7 @@ private void OnDryfiringWeapon(DryfiringWeaponEventArgs ev) if (!mode) { - Primitive.Create(ev.Player.Position + Vector3.back, null, null, true, Color.red); - Primitive.Create(ev.Player.Position + Vector3.forward, null, null, true, Color.green); + mode = !mode; } @@ -110,24 +132,35 @@ private void OnDryfiringWeapon(DryfiringWeaponEventArgs ev) private void OnTogglingWeaponFlashlight(TogglingWeaponFlashlightEventArgs ev) { if (ev.Firearm.Type != item) return; - - Transform cam = ev.Player.CameraTransform; + Primitive p = GetFacingPrimitive(ev.Player); + if (!Arrow.IsPrimitiveArrow(p)) + { + ModelHandler.ChangedSelectedPrim(p); + } + + } + + internal static Primitive GetFacingPrimitive(Player player) + { + Transform cam = player.CameraTransform; + Vector3 origin = cam.position + cam.forward * 0.5f; Ray r = new Ray(origin, cam.forward); if (Physics.Raycast(r, out RaycastHit hit, MAX_DISTANCE)) { Log.Info($"hit ({hit.collider.name})"); PrimitiveObjectToy pot = hit.collider.GetComponentInParent() ?? hit.collider.GetComponentInChildren(); - if(pot != null) + if (pot != null) { - Primitive p = Primitive.Get(pot); - SelectedModel.ChangedSelectedPrim(p); + return Primitive.Get(pot); + + } } - + return null; } diff --git a/KruacentExiled/KE.Utils/API/Models/ModelLoader.cs b/KruacentExiled/KE.Utils/KE.Utils/API/Models/ModelLoader.cs similarity index 53% rename from KruacentExiled/KE.Utils/API/Models/ModelLoader.cs rename to KruacentExiled/KE.Utils/KE.Utils/API/Models/ModelLoader.cs index 40234c4c..d4c60464 100644 --- a/KruacentExiled/KE.Utils/API/Models/ModelLoader.cs +++ b/KruacentExiled/KE.Utils/KE.Utils/API/Models/ModelLoader.cs @@ -8,30 +8,58 @@ using UnityEngine; using Light = Exiled.API.Features.Toys.Light; using Exiled.API.Enums; +using KE.Utils.API.Models.Blueprints; namespace KE.Utils.API.Models { public static class ModelLoader { public static string Path => Paths.Configs + @"\"; private static readonly char SEPARATOR = '_'; + public static string Extension => ".modelscpsl"; - public static Model Load(string filename) + public static IEnumerable LoadAll() + { + List m = new(); + + string[] raw = Directory.GetFiles(Path, "*" + Extension); + + foreach (string d in raw) + { + Log.Info("loading="+d); + ModelBlueprint mbp = Load(string.Empty, d); + if(mbp != null) + { + Log.Info($"loaded {mbp.Name} ({mbp.Toys.Count})"); + m.Add(mbp); + } + + } + + return m; + } + + public static ModelBlueprint Load(string filename) { return Load(Path, filename); } - public static Model Load(string path,string filename) + public static ModelBlueprint Load(string path,string filename) { - - string[] raw = File.ReadAllText(path+ filename).Split('\n'); - string[] infoline = raw[0].Split(SEPARATOR); - foreach(string i in infoline) + string[] raw; + try + { + raw = File.ReadAllText(path + filename).Split('\n'); + } + catch(Exception e) { - Log.Info(i); + Log.Error(e); + return null; } + + + string[] infoline = raw[0].Split(SEPARATOR); string name = infoline[0]; - Vector3 center = Parser.Vector3(infoline[1]); List toys = new(); @@ -51,9 +79,10 @@ public static Model Load(string path,string filename) ColorUtility.TryParseHtmlString(line[4], out color); PrimitiveType ptype; Enum.TryParse(line[5], out ptype); - bool collidable = bool.Parse(line[6]); + + var p = Primitive.Create(ptype, ATPos, ATRotation, ATScale, true, color); - p.Collidable = collidable; + p.Collidable = false; toy = p; } @@ -76,53 +105,47 @@ public static Model Load(string path,string filename) - return Model.Create(center, name); + return ModelBlueprint.Create(name, toys); } - // Name.Center\nAdminToyType.ATPosition.ATRotationEuler.ATScale.LightPrimitiveColor.PrimitiveType.PrimitiveCollidable.LightIntensity\n and repeat - // - public static void Save(this Model m) + // Name\n + // Primitive.Position.RotationEuler.Scale.Color.PrimitiveType\n + // Light.Position.RotationEuler.Scale.Color.Intensity\n + // and repeat + public static bool Save(this ModelBlueprint m) { - - StringBuilder b = new(); + List result = new(); - result.Add(m.Name+SEPARATOR+m.Center); + result.Add(m.Name+SEPARATOR); - foreach(AdminToy t in m.Toys) + foreach(AdminToyBlueprint t in m.Toys) { - b.Append(t.ToyType); - b.Append(SEPARATOR); - b.Append(t.Position); - b.Append(SEPARATOR); - b.Append(t.Rotation.eulerAngles); - b.Append(SEPARATOR); - b.Append(t.Scale); - b.Append(SEPARATOR); - - if (t is Primitive p) - { - b.Append("#"+ColorUtility.ToHtmlStringRGBA(p.Color)); - b.Append(SEPARATOR); - b.Append(p.Type); - b.Append(SEPARATOR); - b.Append(p.Collidable); - } - if(t is Light l) - { - b.Append("#" + ColorUtility.ToHtmlStringRGBA(l.Color)); - b.Append(SEPARATOR); - b.Append(l.Intensity); - } - result.Add(b.ToString()); - b.Clear(); + result.Add(t.Loadable(SEPARATOR)); } - File.WriteAllLines(Path + m.Id + ".modelscpsl", result); + try + { + File.WriteAllLines(Path + m.Name+ Extension, result); + return true; + } + catch(Exception e) + { + Log.Error(e); + return false; + } + } + public static bool Save(this Model model) + { + if (!model.LoadedFromBlueprint) + model.CreateBlueprint(); + + return Save(model.Blueprint); + } } diff --git a/KruacentExiled/KE.Utils/API/Models/Models.cs b/KruacentExiled/KE.Utils/KE.Utils/API/Models/Models.cs similarity index 100% rename from KruacentExiled/KE.Utils/API/Models/Models.cs rename to KruacentExiled/KE.Utils/KE.Utils/API/Models/Models.cs diff --git a/KruacentExiled/KE.Utils/KE.Utils/API/Models/MovementHandler.cs b/KruacentExiled/KE.Utils/KE.Utils/API/Models/MovementHandler.cs new file mode 100644 index 00000000..07e3ee18 --- /dev/null +++ b/KruacentExiled/KE.Utils/KE.Utils/API/Models/MovementHandler.cs @@ -0,0 +1,208 @@ +using Exiled.API.Features; +using Exiled.API.Features.Toys; +using Exiled.Events.EventArgs.Player; +using KE.Utils.API.Interfaces; +using KE.Utils.API.Models.Arrows; +using MEC; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using UnityEngine; + +namespace KE.Utils.API.Models +{ + internal class MovementHandler : IUsingEvents + { + + private MovementMode _mode = MovementMode.Move; + + public MovementMode Mode + { + get + { + return _mode; + } + set + { + OnChangingMode?.Invoke(value); + _mode = value; + } + } + public static event Action OnChangingMode; + + + + //xyz + private Arrow[] _arrows = new Arrow[3]; + private bool _primflag = false; + public readonly static float REFRESH_RATE = Timing.WaitForOneFrame; + + private CoroutineHandle _handle; + private bool _aiming = false; + private void TryCreatePrimitives() + { + if (!_primflag) + { + _arrows[0] = new XArrow(); + _arrows[1] = new YArrow(); + _arrows[2] = new ZArrow(); + _primflag = true; + } + } + + + + + public void SubscribeEvents() + { + ModelCreator.IsAiming += IsAiming; + ModelCreator.StoppedAiming += StoppedAiming; + ModelSelection.OnChangedSelection += OnChangedSelection; + ModelSelection.OnUnSelect += OnUnSelect; + } + + public void UnsubscribeEvents() + { + Timing.KillCoroutines(_handle); + + ModelSelection.OnChangedSelection -= OnChangedSelection; + ModelSelection.OnUnSelect -= OnUnSelect; + } + private void OnUnSelect() + { + foreach (Arrow a in Arrow.List) + { + a.Move(Vector3.zero); + } + } + private void OnChangedSelection(Primitive p) + { + Log.Info("ChangedSelection"); + TryCreatePrimitives(); + foreach (Arrow a in Arrow.List) + { + a.Move(p.Position); + } + + } + + + private void IsAiming(Player p) + { + Log.Info("start aim"); + var prim = ModelCreator.GetFacingPrimitive(p); + if (!Arrow.IsPrimitiveArrow(prim)) return; + + _aiming = true; + _handle = Timing.RunCoroutine(Moving(p,prim)); + } + + private void StoppedAiming() + { + Log.Info("stopped aim"); + _aiming = false; + } + + + + private IEnumerator Moving(Player player,Primitive p) + { + Primitive selected = Models.Instance.ModelCreator.ModelHandler.SelectedPrimitive; + Vector3 pos = selected.Position; + Vector3 targetPos = pos; + Vector3 scale = selected.Scale; + Vector3 tScale = scale; + + + + Vector3 oldEuler = player.CameraTransform.rotation.eulerAngles; + Arrow a = Arrow.GetArrow(p); + List otherArrows = Arrow.List.Where(o => o != a).ToList(); + + Vector3 direction = a.Offset.normalized; + float sensitivity = 0.1f; + float smoothSpeed = 5; + + while (_aiming) + { + Vector3 currentEuler = player.CameraTransform.rotation.eulerAngles; + + float deltaYaw = Mathf.DeltaAngle(oldEuler.y, currentEuler.y); + float deltaPitch = Mathf.DeltaAngle(oldEuler.x, currentEuler.x); + + float movementAmount = 0f; + + if (Mathf.Abs(direction.y) > 0.5f) + { + movementAmount = -deltaPitch * sensitivity; + } + else + { + + Vector3 camRight = player.CameraTransform.right; + + float sign = Mathf.Sign(Vector3.Dot(camRight, direction)); + + movementAmount = deltaYaw * sensitivity * sign; + } + + + + + if(Mode == MovementMode.Move) + { + targetPos += direction.normalized * movementAmount; + pos = Vector3.Lerp(pos, targetPos, Time.deltaTime * smoothSpeed); + p.Position = pos; + selected.Position = pos - a.Offset; + foreach (Arrow arrow in otherArrows) + { + arrow.Move(pos - a.Offset); + } + } + + + + if(Mode == MovementMode.Scale) + { + Vector3 previousParallel = direction.normalized * Vector3.Dot(selected.Scale, direction.normalized); + Vector3 dir = direction.normalized; + + float currentLengthInDir = Vector3.Dot(scale, dir); + + float newLengthInDir = Mathf.Clamp(currentLengthInDir + movementAmount, 0.1f, 10f); + + + Vector3 parallel = dir * newLengthInDir; + Vector3 perpendicular = scale - (dir * currentLengthInDir); + + selected.Scale = parallel + perpendicular; + scale = selected.Scale; + + Vector3 deltaParallel = parallel - previousParallel; + a.Primitive.Position += deltaParallel / 2; + previousParallel = parallel; + } + + + + if(Mode == MovementMode.Rotate) + { + Log.Info("no clue how to do that"); + } + + + + + + oldEuler = currentEuler; + yield return REFRESH_RATE; + } + } + + + + } +} diff --git a/KruacentExiled/KE.Utils/KE.Utils/API/Models/SelectedModel.cs b/KruacentExiled/KE.Utils/KE.Utils/API/Models/SelectedModel.cs new file mode 100644 index 00000000..7e502f46 --- /dev/null +++ b/KruacentExiled/KE.Utils/KE.Utils/API/Models/SelectedModel.cs @@ -0,0 +1,52 @@ +using Exiled.API.Features; +using Exiled.API.Features.Toys; +using MEC; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using UnityEngine; + +namespace KE.Utils.API.Models +{ + internal class ModelSelection + { + + + + public Model SelectedModel { get; internal set; } + public Primitive SelectedPrimitive; + + public static event Action OnChangedSelection; + public static event Action OnUnSelect; + + public void ChangedSelectedPrim(Primitive newPrim) + { + if (newPrim == null) return; + + + + Log.Info(SelectedPrimitive == null); + Log.Info(newPrim.GameObject.GetInstanceID() != SelectedPrimitive?.GameObject.GetInstanceID()); + + if (SelectedPrimitive == null || newPrim.GameObject.GetInstanceID() != SelectedPrimitive?.GameObject.GetInstanceID()) + { + Log.Info("selecting"); + OnChangedSelection?.Invoke(newPrim); + SelectedPrimitive = newPrim; + } + else + { + Log.Info("unselecting"); + SelectedPrimitive = null; + OnUnSelect?.Invoke(); + } + + } + + + + + } +} diff --git a/KruacentExiled/KE.Utils/API/Models/ToysSettings/PrimitiveSetting.cs b/KruacentExiled/KE.Utils/KE.Utils/API/Models/ToysSettings/PrimitiveSetting.cs similarity index 100% rename from KruacentExiled/KE.Utils/API/Models/ToysSettings/PrimitiveSetting.cs rename to KruacentExiled/KE.Utils/KE.Utils/API/Models/ToysSettings/PrimitiveSetting.cs diff --git a/KruacentExiled/KE.Utils/API/Models/ToysSettings/ToySetting.cs b/KruacentExiled/KE.Utils/KE.Utils/API/Models/ToysSettings/ToySetting.cs similarity index 100% rename from KruacentExiled/KE.Utils/API/Models/ToysSettings/ToySetting.cs rename to KruacentExiled/KE.Utils/KE.Utils/API/Models/ToysSettings/ToySetting.cs diff --git a/KruacentExiled/KE.Utils/KE.Utils/API/OtherUtils.cs b/KruacentExiled/KE.Utils/KE.Utils/API/OtherUtils.cs new file mode 100644 index 00000000..ef43b888 --- /dev/null +++ b/KruacentExiled/KE.Utils/KE.Utils/API/OtherUtils.cs @@ -0,0 +1,18 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using UnityEngine; + +namespace KE.Utils.API +{ + public static class OtherUtils + { + + public static bool IsInCircle(Vector3 pos,Vector3 centerCircle,float radius) + { + return (pos-centerCircle).sqrMagnitude <= Math.Pow(radius, 2); + } + } +} diff --git a/KruacentExiled/KE.Utils/KE.Utils/API/Parser.cs b/KruacentExiled/KE.Utils/KE.Utils/API/Parser.cs new file mode 100644 index 00000000..a924337f --- /dev/null +++ b/KruacentExiled/KE.Utils/KE.Utils/API/Parser.cs @@ -0,0 +1,36 @@ +using Exiled.API.Features; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using UnityEngine; + +namespace KE.Utils.API +{ + public static class Parser + { + public static Vector3 Vector3(string s) + { + string[] temp = s.Substring(1, s.Length - 3).Split(','); + + if(!float.TryParse(temp[0],out float x)) + { + return UnityEngine.Vector3.zero; + } + + if (!float.TryParse(temp[1], out float y)) + { + return UnityEngine.Vector3.zero; + } + if (!float.TryParse(temp[1], out float z)) + { + return UnityEngine.Vector3.zero; + } + + + + return new Vector3(x, y, z); + } + } +} diff --git a/KruacentExiled/KE.Utils/KE.Utils/API/ReflectionHelper.cs b/KruacentExiled/KE.Utils/KE.Utils/API/ReflectionHelper.cs new file mode 100644 index 00000000..0e543b6b --- /dev/null +++ b/KruacentExiled/KE.Utils/KE.Utils/API/ReflectionHelper.cs @@ -0,0 +1,47 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Reflection; +using System.Text; +using System.Threading.Tasks; + +namespace KE.Utils.KE.Utilsmap.API +{ + public static class ReflectionHelper + { + public static IEnumerable GetObjects(Assembly assembly = null) + { + List result = new(); + if (assembly == null) + { + assembly = Assembly.GetCallingAssembly(); + } + foreach (Type t in assembly.GetTypes()) + { + try + { + if (typeof(T).IsAssignableFrom(t) && !t.IsAbstract) + { + T ffcc = (T)Activator.CreateInstance(t); + result.Add(ffcc); + } + } + catch (Exception) + { + + } + } + return result; + } + + public static IEnumerable GetObjects(IEnumerable assemblies) + { + List result = new(); + foreach (Assembly assembly in assemblies) + { + result.AddRange(GetObjects(assembly)); + } + return result; + } + } +} diff --git a/KruacentExiled/KE.Utils/KE.Utils/API/Sounds/SoundPlayer.cs b/KruacentExiled/KE.Utils/KE.Utils/API/Sounds/SoundPlayer.cs new file mode 100644 index 00000000..84e09ce8 --- /dev/null +++ b/KruacentExiled/KE.Utils/KE.Utils/API/Sounds/SoundPlayer.cs @@ -0,0 +1,115 @@ +using Exiled.API.Features; +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using UnityEngine; + +namespace KE.Utils.KE.Utilsmap.API.Sounds +{ + public class SoundPlayer + { + private static SoundPlayer _instance; + + public static SoundPlayer Instance + { + get + { + if (_instance == null) + { + _instance = new(); + } + return _instance; + } + } + + private SoundPlayer() { } + + private bool _loaded = false; + public bool Loaded => _loaded; + + public static readonly HashSet clips = new(); + + public static string SoundLocation => Paths.Configs + "/Sounds"; + public static void Load() => Instance.TryLoad(); + public void TryLoad() + { + if (Loaded) + { + return; + } + + if (!Directory.Exists(SoundLocation)) + { + Log.Warn("Directory not found. creating..."); + Directory.CreateDirectory(SoundLocation); + } + + string[] rawfile = Directory.GetFiles(SoundLocation, "*.ogg"); + + foreach (string file in rawfile) + { + string noExFile = Path.GetFileNameWithoutExtension(file); + Log.Info($"loading {file} as {noExFile}"); + clips.Add(noExFile); + AudioClipStorage.LoadClip(file); + } + _loaded = true; + } + + + /// + /// Play a clip at a static point + /// + /// + /// + /// + /// + public AudioClipPlayback Play(string clipName, Vector3 pos, float volume = 50f, float maxDistance = 20f, bool isSpatial = true) + { + if (!Loaded) throw new Exception("clips not loaded use SoundPlayer.Load()"); + Log.Debug($"playing {clipName} at {pos}"); + + var audioPlayer = AudioPlayer.CreateOrGet($"{clipName} ({pos})", onIntialCreation: (p) => + { + GameObject a = new GameObject(); + a.transform.position = pos; + p.transform.parent = a.transform; + Speaker speaker = p.AddSpeaker("main", isSpatial: isSpatial, maxDistance: maxDistance, minDistance: 1f); + speaker.transform.parent = a.transform; + speaker.transform.localPosition = Vector3.zero; + }); + + audioPlayer.DestroyWhenAllClipsPlayed = true; + return audioPlayer.AddClip(clipName, volume: volume); + + + } + + /// + /// Play a clip at a + /// + /// + /// + /// + /// + public void Play(string clipName, GameObject objectEmittingSound, float volume = 50f, float maxDistance = 20f, bool isSpatial = true) + { + if (!Loaded) throw new Exception("clips not loaded use SoundPlayer.Instance.Load()"); + Log.Debug($"playing {clipName} at {objectEmittingSound}"); + + var audioPlayer = AudioPlayer.CreateOrGet($"{clipName} ({objectEmittingSound})", onIntialCreation: (p) => + { + + p.transform.parent = objectEmittingSound.transform; + Speaker speaker = p.AddSpeaker("main", isSpatial: isSpatial, maxDistance: maxDistance, minDistance: 1f); + speaker.transform.parent = objectEmittingSound.transform; + speaker.transform.localPosition = Vector3.zero; + }); + audioPlayer.AddClip(clipName, volume: volume); + audioPlayer.DestroyWhenAllClipsPlayed = true; + } + } +} diff --git a/KruacentExiled/KE.Utils/Extensions/AdminToyExtension.cs b/KruacentExiled/KE.Utils/KE.Utils/Extensions/AdminToyExtension.cs similarity index 100% rename from KruacentExiled/KE.Utils/Extensions/AdminToyExtension.cs rename to KruacentExiled/KE.Utils/KE.Utils/Extensions/AdminToyExtension.cs diff --git a/KruacentExiled/KE.Utils/KE.Utils/Extensions/NpcExtension.cs b/KruacentExiled/KE.Utils/KE.Utils/Extensions/NpcExtension.cs new file mode 100644 index 00000000..6af07bc5 --- /dev/null +++ b/KruacentExiled/KE.Utils/KE.Utils/Extensions/NpcExtension.cs @@ -0,0 +1,23 @@ +using CentralAuth; +using Exiled.API.Features; +using Mirror; +using PlayerRoles; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace KE.Utils.Extensions +{ + public static class NpcExtension + { + + + public static void Hide(this Npc npc) + { + npc.ReferenceHub.authManager.NetworkSyncedUserId = "ID_Dedicated"; + npc.ReferenceHub.authManager.syncMode = (SyncMode)ClientInstanceMode.DedicatedServer; + } + } +} diff --git a/KruacentExiled/KE.Utils/Extensions/PlayerExtension.cs b/KruacentExiled/KE.Utils/KE.Utils/Extensions/PlayerExtension.cs similarity index 100% rename from KruacentExiled/KE.Utils/Extensions/PlayerExtension.cs rename to KruacentExiled/KE.Utils/KE.Utils/Extensions/PlayerExtension.cs diff --git a/KruacentExiled/KE.Utils/KE.Utils/Extensions/RoomExtensions.cs b/KruacentExiled/KE.Utils/KE.Utils/Extensions/RoomExtensions.cs new file mode 100644 index 00000000..61fd0291 --- /dev/null +++ b/KruacentExiled/KE.Utils/KE.Utils/Extensions/RoomExtensions.cs @@ -0,0 +1,55 @@ +using Exiled.API.Features; +using Exiled.API.Enums; +using Discord; +using System.Linq; +using Exiled.API.Extensions; + +namespace KE.Utils.Extensions +{ + public static class RoomExtensions + { + + + public static Room RandomSafeRoom(this ZoneType zone) + { + return Room.List.Where(r => r.IsSafe() && r.Zone == zone).GetRandomValue(); + } + + + /// + /// Check if a is Safe (Decontamination,Warhead) + /// + /// Note: Does NOT check if the is safe to teleport in (ex : TestRoom) + /// + /// + /// return true if the is safe for a ; false otherwise + public static bool IsSafe(this Room room) + { + return room.Zone.IsSafe(); + } + + + /// + /// Check if a is Safe (Decontamination,Warhead) + /// + /// return true if the zone is safe for a ; false otherwise + public static bool IsSafe(this ZoneType zone) + { + bool result = true; + if (zone == ZoneType.LightContainment) + result = Map.DecontaminationState < DecontaminationState.Countdown; + switch (zone) + { + case ZoneType.LightContainment: + case ZoneType.HeavyContainment: + case ZoneType.Entrance: + result = !Warhead.IsDetonated; + break; + } + return result; + } + + + + } +} diff --git a/KruacentExiled/KE.Utils/KE.Utils/KE.Utils.csproj b/KruacentExiled/KE.Utils/KE.Utils/KE.Utils.csproj new file mode 100644 index 00000000..aee2e596 --- /dev/null +++ b/KruacentExiled/KE.Utils/KE.Utils/KE.Utils.csproj @@ -0,0 +1,37 @@ + + + + 13.0 + net48 + + + + + + + + + + + + + + + + + + + + + + + + + if not "$(EXILED_DEV_REFERENCES)"=="" copy /y "$(OutputPath)$(AssemblyName).dll" "$(EXILED_DEV_REFERENCES)\Plugins\" + + + if [[ ! -z "$EXILED_DEV_REFERENCES" ]]; then cp "$(OutputPath)$(AssemblyName).dll" "$EXILED_DEV_REFERENCES/Plugins/"; fi + + + + diff --git a/KruacentExiled/KE.Utils/Quality/Enums/ModelQuality.cs b/KruacentExiled/KE.Utils/KE.Utils/Quality/Enums/ModelQuality.cs similarity index 100% rename from KruacentExiled/KE.Utils/Quality/Enums/ModelQuality.cs rename to KruacentExiled/KE.Utils/KE.Utils/Quality/Enums/ModelQuality.cs diff --git a/KruacentExiled/KE.Utils/Quality/Handlers/QualityToysHandler.cs b/KruacentExiled/KE.Utils/KE.Utils/Quality/Handlers/QualityToysHandler.cs similarity index 100% rename from KruacentExiled/KE.Utils/Quality/Handlers/QualityToysHandler.cs rename to KruacentExiled/KE.Utils/KE.Utils/Quality/Handlers/QualityToysHandler.cs diff --git a/KruacentExiled/KE.Utils/Quality/Models/Base/BaseModel.cs b/KruacentExiled/KE.Utils/KE.Utils/Quality/Models/Base/BaseModel.cs similarity index 100% rename from KruacentExiled/KE.Utils/Quality/Models/Base/BaseModel.cs rename to KruacentExiled/KE.Utils/KE.Utils/Quality/Models/Base/BaseModel.cs diff --git a/KruacentExiled/KE.Utils/Quality/Models/Base/LightModel.cs b/KruacentExiled/KE.Utils/KE.Utils/Quality/Models/Base/LightModel.cs similarity index 100% rename from KruacentExiled/KE.Utils/Quality/Models/Base/LightModel.cs rename to KruacentExiled/KE.Utils/KE.Utils/Quality/Models/Base/LightModel.cs diff --git a/KruacentExiled/KE.Utils/Quality/Models/Base/PrimitiveModel.cs b/KruacentExiled/KE.Utils/KE.Utils/Quality/Models/Base/PrimitiveModel.cs similarity index 100% rename from KruacentExiled/KE.Utils/Quality/Models/Base/PrimitiveModel.cs rename to KruacentExiled/KE.Utils/KE.Utils/Quality/Models/Base/PrimitiveModel.cs diff --git a/KruacentExiled/KE.Utils/Quality/Models/Examples/MineModel.cs b/KruacentExiled/KE.Utils/KE.Utils/Quality/Models/Examples/MineModel.cs similarity index 100% rename from KruacentExiled/KE.Utils/Quality/Models/Examples/MineModel.cs rename to KruacentExiled/KE.Utils/KE.Utils/Quality/Models/Examples/MineModel.cs diff --git a/KruacentExiled/KE.Utils/Quality/Models/Model.cs b/KruacentExiled/KE.Utils/KE.Utils/Quality/Models/Model.cs similarity index 100% rename from KruacentExiled/KE.Utils/Quality/Models/Model.cs rename to KruacentExiled/KE.Utils/KE.Utils/Quality/Models/Model.cs diff --git a/KruacentExiled/KE.Utils/Quality/Models/ModelPrefab.cs b/KruacentExiled/KE.Utils/KE.Utils/Quality/Models/ModelPrefab.cs similarity index 100% rename from KruacentExiled/KE.Utils/Quality/Models/ModelPrefab.cs rename to KruacentExiled/KE.Utils/KE.Utils/Quality/Models/ModelPrefab.cs diff --git a/KruacentExiled/KE.Utils/Quality/Models/QualityModel.cs b/KruacentExiled/KE.Utils/KE.Utils/Quality/Models/QualityModel.cs similarity index 100% rename from KruacentExiled/KE.Utils/Quality/Models/QualityModel.cs rename to KruacentExiled/KE.Utils/KE.Utils/Quality/Models/QualityModel.cs diff --git a/KruacentExiled/KE.Utils/Quality/QualityHandler.cs b/KruacentExiled/KE.Utils/KE.Utils/Quality/QualityHandler.cs similarity index 100% rename from KruacentExiled/KE.Utils/Quality/QualityHandler.cs rename to KruacentExiled/KE.Utils/KE.Utils/Quality/QualityHandler.cs diff --git a/KruacentExiled/KE.Utils/Quality/QualityToysHandler.cs b/KruacentExiled/KE.Utils/KE.Utils/Quality/QualityToysHandler.cs similarity index 100% rename from KruacentExiled/KE.Utils/Quality/QualityToysHandler.cs rename to KruacentExiled/KE.Utils/KE.Utils/Quality/QualityToysHandler.cs diff --git a/KruacentExiled/KE.Utils/Quality/Settings/QualitySettings.cs b/KruacentExiled/KE.Utils/KE.Utils/Quality/Settings/QualitySettings.cs similarity index 100% rename from KruacentExiled/KE.Utils/Quality/Settings/QualitySettings.cs rename to KruacentExiled/KE.Utils/KE.Utils/Quality/Settings/QualitySettings.cs diff --git a/KruacentExiled/KE.Utils/Quality/Structs/LocalWorldSpace.cs b/KruacentExiled/KE.Utils/KE.Utils/Quality/Structs/LocalWorldSpace.cs similarity index 100% rename from KruacentExiled/KE.Utils/Quality/Structs/LocalWorldSpace.cs rename to KruacentExiled/KE.Utils/KE.Utils/Quality/Structs/LocalWorldSpace.cs diff --git a/KruacentExiled/KE.Utils/Quality/Tests/Test.cs b/KruacentExiled/KE.Utils/KE.Utils/Quality/Tests/Test.cs similarity index 100% rename from KruacentExiled/KE.Utils/Quality/Tests/Test.cs rename to KruacentExiled/KE.Utils/KE.Utils/Quality/Tests/Test.cs diff --git a/KruacentExiled/KruacentExiled.sln b/KruacentExiled/KruacentExiled.sln index 93390814..bf53116e 100644 --- a/KruacentExiled/KruacentExiled.sln +++ b/KruacentExiled/KruacentExiled.sln @@ -3,20 +3,6 @@ Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio Version 17 VisualStudioVersion = 17.12.35506.116 MinimumVisualStudioVersion = 10.0.40219.1 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "KE.Items", "KE.Items\KE.Items.csproj", "{2FE04C4D-7FA1-4EC5-A8AF-618EDE0C037C}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "KE.Misc", "KE.Misc\KE.Misc.csproj", "{CD822DB2-756E-4887-93AB-2D2F16BF542C}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "KE.BlackoutNDoor", "KE.BlackoutNDoor\KE.BlackoutNDoor.csproj", "{C9867742-72DB-4ECA-81BF-104A27A04DB7}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "KE.GlobalEventFramework", "KE.GlobalEventFramework\KE.GlobalEventFramework.csproj", "{73D6C740-96DE-4965-898F-DDD5BCBF7366}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "KE.GlobalEventFramework.Examples", "KE.GlobalEventFramework.Examples\KE.GlobalEventFramework.Examples.csproj", "{07B92E87-F48F-4F9F-BA0E-1BCB2AF52F53}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "KE.CustomRoles", "KE.CustomRoles\KE.CustomRoles.csproj", "{4AA4C3E0-E62F-49CE-AD80-0B5C6249EB48}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "KE.Map", "Map\KE.Map.csproj", "{CCEF1C1D-B701-443E-AC23-72A174446868}" -EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "KE.Utils", "KE.Utils\KE.Utils.csproj", "{DFEF41B3-5BD3-428A-A7BA-7A490E65C71F}" EndProject Global @@ -25,34 +11,6 @@ Global Release|Any CPU = Release|Any CPU EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution - {2FE04C4D-7FA1-4EC5-A8AF-618EDE0C037C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {2FE04C4D-7FA1-4EC5-A8AF-618EDE0C037C}.Debug|Any CPU.Build.0 = Debug|Any CPU - {2FE04C4D-7FA1-4EC5-A8AF-618EDE0C037C}.Release|Any CPU.ActiveCfg = Release|Any CPU - {2FE04C4D-7FA1-4EC5-A8AF-618EDE0C037C}.Release|Any CPU.Build.0 = Release|Any CPU - {CD822DB2-756E-4887-93AB-2D2F16BF542C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {CD822DB2-756E-4887-93AB-2D2F16BF542C}.Debug|Any CPU.Build.0 = Debug|Any CPU - {CD822DB2-756E-4887-93AB-2D2F16BF542C}.Release|Any CPU.ActiveCfg = Release|Any CPU - {CD822DB2-756E-4887-93AB-2D2F16BF542C}.Release|Any CPU.Build.0 = Release|Any CPU - {C9867742-72DB-4ECA-81BF-104A27A04DB7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {C9867742-72DB-4ECA-81BF-104A27A04DB7}.Debug|Any CPU.Build.0 = Debug|Any CPU - {C9867742-72DB-4ECA-81BF-104A27A04DB7}.Release|Any CPU.ActiveCfg = Release|Any CPU - {C9867742-72DB-4ECA-81BF-104A27A04DB7}.Release|Any CPU.Build.0 = Release|Any CPU - {73D6C740-96DE-4965-898F-DDD5BCBF7366}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {73D6C740-96DE-4965-898F-DDD5BCBF7366}.Debug|Any CPU.Build.0 = Debug|Any CPU - {73D6C740-96DE-4965-898F-DDD5BCBF7366}.Release|Any CPU.ActiveCfg = Release|Any CPU - {73D6C740-96DE-4965-898F-DDD5BCBF7366}.Release|Any CPU.Build.0 = Release|Any CPU - {07B92E87-F48F-4F9F-BA0E-1BCB2AF52F53}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {07B92E87-F48F-4F9F-BA0E-1BCB2AF52F53}.Debug|Any CPU.Build.0 = Debug|Any CPU - {07B92E87-F48F-4F9F-BA0E-1BCB2AF52F53}.Release|Any CPU.ActiveCfg = Release|Any CPU - {07B92E87-F48F-4F9F-BA0E-1BCB2AF52F53}.Release|Any CPU.Build.0 = Release|Any CPU - {4AA4C3E0-E62F-49CE-AD80-0B5C6249EB48}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {4AA4C3E0-E62F-49CE-AD80-0B5C6249EB48}.Debug|Any CPU.Build.0 = Debug|Any CPU - {4AA4C3E0-E62F-49CE-AD80-0B5C6249EB48}.Release|Any CPU.ActiveCfg = Release|Any CPU - {4AA4C3E0-E62F-49CE-AD80-0B5C6249EB48}.Release|Any CPU.Build.0 = Release|Any CPU - {CCEF1C1D-B701-443E-AC23-72A174446868}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {CCEF1C1D-B701-443E-AC23-72A174446868}.Debug|Any CPU.Build.0 = Debug|Any CPU - {CCEF1C1D-B701-443E-AC23-72A174446868}.Release|Any CPU.ActiveCfg = Release|Any CPU - {CCEF1C1D-B701-443E-AC23-72A174446868}.Release|Any CPU.Build.0 = Release|Any CPU {DFEF41B3-5BD3-428A-A7BA-7A490E65C71F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {DFEF41B3-5BD3-428A-A7BA-7A490E65C71F}.Debug|Any CPU.Build.0 = Debug|Any CPU {DFEF41B3-5BD3-428A-A7BA-7A490E65C71F}.Release|Any CPU.ActiveCfg = Release|Any CPU diff --git a/KruacentExiled/utils-merged/KE.Utilsci/API/Displays/DisplayMeow/DisplayHandler.cs b/KruacentExiled/utils-merged/KE.Utilsci/API/Displays/DisplayMeow/DisplayHandler.cs new file mode 100644 index 00000000..4ee13535 --- /dev/null +++ b/KruacentExiled/utils-merged/KE.Utilsci/API/Displays/DisplayMeow/DisplayHandler.cs @@ -0,0 +1,67 @@ +using Exiled.API.Features; +using HintServiceMeow.Core.Extension; +using HintServiceMeow.Core.Models.Hints; +using HintServiceMeow.Core.Utilities; +using MEC; + + +//damn why the same name +using MHint = HintServiceMeow.Core.Models.Hints.Hint; + +namespace KE.Utils.API.Displays.DisplayMeow +{ + public class DisplayHandler + { + public static DisplayHandler Instance { get; } = new(); + + private DisplayHandler() { } + + + + + + + public MHint AddHint(HintPlacement hintPlacement, Player player, string text, float delay) + { + var dis = PlayerDisplay.Get(player); + string id = $"{player.Id}_{hintPlacement.XCoordinate}_{hintPlacement.YCoordinate}"; + MHint hint; + + if (!dis.TryGetHint(id, out var aHint)) + { + hint = new() + { + Text = text, + XCoordinate = hintPlacement.XCoordinate, + YCoordinate = hintPlacement.YCoordinate, + Alignment = hintPlacement.HintAlignment, + Id = id + + }; + dis.AddHint(hint); + + } + else + { + + hint = (MHint)aHint; + hint.Hide = false; + hint.Text = text; + } + + + hint.HideAfter(delay); + return hint; + } + + + + + + + + + + + } +} diff --git a/KruacentExiled/utils-merged/KE.Utilsci/API/Displays/DisplayMeow/HintPlacement.cs b/KruacentExiled/utils-merged/KE.Utilsci/API/Displays/DisplayMeow/HintPlacement.cs new file mode 100644 index 00000000..936cdbe9 --- /dev/null +++ b/KruacentExiled/utils-merged/KE.Utilsci/API/Displays/DisplayMeow/HintPlacement.cs @@ -0,0 +1,31 @@ +using HintServiceMeow.Core.Enum; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace KE.Utils.API.Displays.DisplayMeow +{ + public readonly struct HintPlacement : IEquatable + { + public float YCoordinate { get; } + public float XCoordinate { get; } + public HintAlignment HintAlignment { get; } = HintAlignment.Center; + + + public bool Equals(HintPlacement obj) + { + return YCoordinate == obj.YCoordinate && XCoordinate == obj.XCoordinate; + } + + + public HintPlacement(float xCoordinate, float yCoordinate, HintAlignment alignment = HintAlignment.Center) + { + YCoordinate = yCoordinate; + XCoordinate = xCoordinate; + HintAlignment = alignment; + } + + } +} diff --git a/KruacentExiled/utils-merged/KE.Utilsci/API/Interfaces/IEvents.cs b/KruacentExiled/utils-merged/KE.Utilsci/API/Interfaces/IEvents.cs new file mode 100644 index 00000000..e573b062 --- /dev/null +++ b/KruacentExiled/utils-merged/KE.Utilsci/API/Interfaces/IEvents.cs @@ -0,0 +1,17 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace KE.Utils.API.Interfaces +{ + public interface IUsingEvents + { + + + public void SubscribeEvents(); + + public void UnsubscribeEvents(); + } +} diff --git a/KruacentExiled/utils-merged/KE.Utilsci/API/Sounds/SoundPlayer.cs b/KruacentExiled/utils-merged/KE.Utilsci/API/Sounds/SoundPlayer.cs new file mode 100644 index 00000000..19f0c310 --- /dev/null +++ b/KruacentExiled/utils-merged/KE.Utilsci/API/Sounds/SoundPlayer.cs @@ -0,0 +1,112 @@ +using Exiled.API.Features; +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using UnityEngine; + +namespace KE.Utils.API.Sounds +{ + public class SoundPlayer + { + private static SoundPlayer _instance; + + public static SoundPlayer Instance + { + get + { + if(_instance == null) + { + _instance = new(); + } + return _instance; + } + } + + private SoundPlayer() { } + + private bool _loaded = false; + public bool Loaded => _loaded; + + + public static string SoundLocation => Paths.Configs + "/Sounds"; + public static void Load() => Instance.TryLoad(); + public void TryLoad() + { + if (Loaded) + { + return; + } + + if (!Directory.Exists(SoundLocation)) + { + Log.Warn("Directory not found. creating..."); + Directory.CreateDirectory(SoundLocation); + } + + string[] rawfile = Directory.GetFiles(SoundLocation, "*.ogg"); + + foreach (string file in rawfile) + { + string noExFile = Path.GetFileNameWithoutExtension(file); + Log.Info($"loading {file} as {noExFile}"); + AudioClipStorage.LoadClip(file); + } + _loaded = true; + } + + + /// + /// Play a clip at a static point + /// + /// + /// + /// + /// + public void Play(string clipName, Vector3 pos, float volume = 50f, float maxDistance = 20f, bool isSpatial = true) + { + if (!Loaded) throw new Exception("clips not loaded use SoundPlayer.Load()"); + Log.Debug($"playing {clipName} at {pos}"); + + var audioPlayer = AudioPlayer.CreateOrGet($"{clipName} ({pos})", onIntialCreation: (p) => + { + GameObject a = new GameObject(); + a.transform.position = pos; + p.transform.parent = a.transform; + Speaker speaker = p.AddSpeaker("main", isSpatial: isSpatial, maxDistance: maxDistance, minDistance: 1f); + speaker.transform.parent = a.transform; + speaker.transform.localPosition = Vector3.zero; + }); + + audioPlayer.AddClip(clipName, volume: volume); + audioPlayer.DestroyWhenAllClipsPlayed = true; + + } + + /// + /// Play a clip at a + /// + /// + /// + /// + /// + public void Play(string clipName, GameObject objectEmittingSound, float volume = 50f, float maxDistance = 20f, bool isSpatial = true) + { + if (!Loaded) throw new Exception("clips not loaded use SoundPlayer.Instance.Load()"); + Log.Debug($"playing {clipName} at {objectEmittingSound}"); + + var audioPlayer = AudioPlayer.CreateOrGet($"{clipName} ({objectEmittingSound})", onIntialCreation: (p) => + { + + p.transform.parent = objectEmittingSound.transform; + Speaker speaker = p.AddSpeaker("main", isSpatial: isSpatial, maxDistance: maxDistance, minDistance: 1f); + speaker.transform.parent = objectEmittingSound.transform; + speaker.transform.localPosition = Vector3.zero; + }); + audioPlayer.AddClip(clipName, volume: volume); + audioPlayer.DestroyWhenAllClipsPlayed = true; + } + } +} diff --git a/KruacentExiled/utils-merged/KE.Utilsci/Extensions/AdminToyExtension.cs b/KruacentExiled/utils-merged/KE.Utilsci/Extensions/AdminToyExtension.cs new file mode 100644 index 00000000..37c3706d --- /dev/null +++ b/KruacentExiled/utils-merged/KE.Utilsci/Extensions/AdminToyExtension.cs @@ -0,0 +1,25 @@ +using Exiled.API.Features.Toys; +using KE.Utils.Quality; +using KE.Utils.Quality.Enums; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace KE.Utils.Extensions +{ + public static class AdminToyExtension + { + + public static void SetAsPickupAdminToy(this AdminToy toy, bool autoSync = true) + { + QualityHandler.Instance.QualityToysHandler.SetAsPickup(toy); + } + + public static void SetQuality(this AdminToy toy, ModelQuality modelQuality,bool autoSync = true) + { + QualityHandler.Instance.QualityToysHandler.SetQuality(toy, modelQuality); + } + } +} diff --git a/KruacentExiled/utils-merged/KE.Utilsci/Extensions/PlayerExtension.cs b/KruacentExiled/utils-merged/KE.Utilsci/Extensions/PlayerExtension.cs new file mode 100644 index 00000000..b01f98d2 --- /dev/null +++ b/KruacentExiled/utils-merged/KE.Utilsci/Extensions/PlayerExtension.cs @@ -0,0 +1,52 @@ +using CustomPlayerEffects; +using Exiled.API.Enums; +using Exiled.API.Features; +using Mirror; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using UnityEngine; + +namespace KE.Utils.Extensions +{ + public static class PlayerExtension + { + public static void SetFakeInvis(this Player p, IEnumerable viewers) + { + Vector3 pos = p.Position; + + try + { + p.ReferenceHub.transform.localPosition = Vector3.zero; + foreach (Player viewer in viewers) + { + Server.SendSpawnMessage.Invoke(null, new object[2] { viewer.NetworkIdentity, viewer.Connection }); + } + + p.ReferenceHub.transform.localPosition = pos; + } + catch (Exception arg) + { + Log.Error(string.Format("{0}: {1}", "SetFakeInvis", arg)); + } + } + + + + + public static void AddLevelEffect(this Player p,EffectType type, int intensity) + { + + + if (!p.TryGetEffect(type, out var effect)) + p.ChangeEffectIntensity(type, (byte)(effect.Intensity + intensity)); + else + p.EnableEffect(type, (byte)intensity); + } + + + + } +} diff --git a/KruacentExiled/KE.Utils/Extensions/RoomExtension.cs b/KruacentExiled/utils-merged/KE.Utilsci/Extensions/RoomExtension.cs similarity index 100% rename from KruacentExiled/KE.Utils/Extensions/RoomExtension.cs rename to KruacentExiled/utils-merged/KE.Utilsci/Extensions/RoomExtension.cs diff --git a/KruacentExiled/utils-merged/KE.Utilsci/KE.Utils.csproj b/KruacentExiled/utils-merged/KE.Utilsci/KE.Utils.csproj new file mode 100644 index 00000000..1ad75e64 --- /dev/null +++ b/KruacentExiled/utils-merged/KE.Utilsci/KE.Utils.csproj @@ -0,0 +1,31 @@ + + + + 13.0 + net48 + + + + + + + + + + + + + + + + + + + if not "$(EXILED_DEV_REFERENCES)"=="" copy /y "$(OutputPath)$(AssemblyName).dll" "$(EXILED_DEV_REFERENCES)\Plugins\" + + + if [[ ! -z "$EXILED_DEV_REFERENCES" ]]; then cp "$(OutputPath)$(AssemblyName).dll" "$EXILED_DEV_REFERENCES/Plugins/"; fi + + + + diff --git a/KruacentExiled/utils-merged/KE.Utilsci/Quality/Enums/ModelQuality.cs b/KruacentExiled/utils-merged/KE.Utilsci/Quality/Enums/ModelQuality.cs new file mode 100644 index 00000000..d9d8d295 --- /dev/null +++ b/KruacentExiled/utils-merged/KE.Utilsci/Quality/Enums/ModelQuality.cs @@ -0,0 +1,16 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace KE.Utils.Quality.Enums +{ + public enum ModelQuality + { + None = -1, + Low, + Medium, + High, + } +} diff --git a/KruacentExiled/utils-merged/KE.Utilsci/Quality/Handlers/QualityToysHandler.cs b/KruacentExiled/utils-merged/KE.Utilsci/Quality/Handlers/QualityToysHandler.cs new file mode 100644 index 00000000..b2485795 --- /dev/null +++ b/KruacentExiled/utils-merged/KE.Utilsci/Quality/Handlers/QualityToysHandler.cs @@ -0,0 +1,179 @@ +using AdminToys; +using Exiled.API.Enums; +using Exiled.API.Extensions; +using Exiled.API.Features; +using Exiled.API.Features.Toys; +using KE.Utils.Quality.Enums; +using KE.Utils.Quality.Settings; +using MEC; +using System; +using System.Collections.Generic; +using System.Linq; +using UnityEngine; +using Light = Exiled.API.Features.Toys.Light; +using QualitySettings = KE.Utils.Quality.Settings.QualitySettings; + +namespace KE.Utils.Quality.Handlers +{ + public class QualityToysHandler + { + private HashSet _pickupToys = new(); + private Dictionary _qualityToys = new(); + public readonly Vector3 Gulag = new Vector3(15000, 15000, 15000); + public const float Delay = Timing.WaitForOneFrame; + public bool IsPickupToy(AdminToy primitive) + { + return _pickupToys.Contains(primitive); + } + + public bool IsQualityToy(AdminToy primitive) + { + return _qualityToys.ContainsKey(primitive); + } + + + public void SetAsPickup(AdminToy toy, bool autoSync = true) + { + if (!_pickupToys.Add(toy)) + { + Log.Warn($"AdminToy {toy} is already a pickupToy"); + return; + } + if (autoSync) + Sync(toy); + } + + public void SetQuality(AdminToy toy, ModelQuality quality, bool autoSync = true) + { + if (toy == null) return; + if (!_qualityToys.ContainsKey(toy)) + _qualityToys.Add(toy, quality); + else + _qualityToys[toy] = quality; + + if (autoSync) + Sync(toy); + } + + + + private void SendToFakePosition(AdminToy adminToy, Player player,Vector3 position) + { + //idk why but without delay it show all of the quality at once + Timing.CallDelayed(Delay, () => + { + if (adminToy is Light l) + { + player.SendFakeSyncVar(l.Base.netIdentity, typeof(LightSourceToy), nameof(LightSourceToy.NetworkPosition), position); + return; + } + if (adminToy is Primitive p) + { + player.SendFakeSyncVar(p.Base.netIdentity, typeof(PrimitiveObjectToy), nameof(PrimitiveObjectToy.NetworkPosition), position); + return; + } + }); + + } + + /// + /// Sync every Players + /// + public void Sync() + { + foreach (Player p in Player.List) + { + Sync(p); + } + } + + /// + /// Sync a specified Player + /// + /// + public void Sync(Player p) + { + + + + var quality = QualitySettings.Get(p); + var pickup = QualitySettings.PickmodelActivated(p); + + HashSet pickupToRemove = []; + HashSet qualityToRemove = []; + + //hide pickup toys + + foreach (AdminToy pk in _pickupToys) + { + try + { + if (pickup) + { + SendToFakePosition(pk, p, pk.Position); + } + else + { + SendToFakePosition(pk, p, Gulag); + } + } + catch (NullReferenceException) + { + //Log.Warn("removing pickup"); + pickupToRemove.Add(pk); + } + + } + + _pickupToys.RemoveWhere(p => pickupToRemove.Contains(p)); + + + foreach (var at in _qualityToys) + { + try + { + if ((at.Value == quality || at.Value == ModelQuality.None) && (pickup || !_pickupToys.Contains(at.Key))) + { + SendToFakePosition(at.Key, p, at.Key.Position); + } + else + { + SendToFakePosition(at.Key, p, Gulag); + } + } + catch (NullReferenceException) + { + //Log.Warn("removing quality" + _qualityToys.Count); + qualityToRemove.Add(at.Key); + } + + + } + foreach(var at in qualityToRemove) + { + + _qualityToys.Remove(at); + } + + } + + /// + /// Sync a specified AdminToy + /// + /// + public void Sync(AdminToy adminToy) + { + //temporary fix + Sync(); + + if (IsPickupToy(adminToy)) + { + + } + if (IsQualityToy(adminToy)) + { + + } + } + } +} diff --git a/KruacentExiled/utils-merged/KE.Utilsci/Quality/Models/Base/BaseModel.cs b/KruacentExiled/utils-merged/KE.Utilsci/Quality/Models/Base/BaseModel.cs new file mode 100644 index 00000000..c9f6723c --- /dev/null +++ b/KruacentExiled/utils-merged/KE.Utilsci/Quality/Models/Base/BaseModel.cs @@ -0,0 +1,41 @@ +using Exiled.API.Enums; +using Exiled.API.Extensions; +using Exiled.API.Features.Toys; +using Exiled.API.Interfaces; +using KE.Utils.Quality.Structs; +using PlayerStatsSystem; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using UnityEngine; +using Light = Exiled.API.Features.Toys.Light; + +namespace KE.Utils.Quality.Models.Base +{ + + /// + /// The blocks to build a model with + /// + public abstract class BaseModel : ICloneable + { + + protected AdminToy _toy; + public AdminToy AdminToy { get { return _toy; } } + private Vector3 _position; + public Vector3 LocalPosition { get { return _position; } } + private Quaternion _rotation; + public Quaternion LocalRotation { get { return _rotation; } } + + + public BaseModel(Vector3 localPositon, Quaternion localRotation) + { + _position = localPositon; + _rotation = localRotation; + } + + public abstract object Clone(); + } + +} diff --git a/KruacentExiled/utils-merged/KE.Utilsci/Quality/Models/Base/LightModel.cs b/KruacentExiled/utils-merged/KE.Utilsci/Quality/Models/Base/LightModel.cs new file mode 100644 index 00000000..ce808da1 --- /dev/null +++ b/KruacentExiled/utils-merged/KE.Utilsci/Quality/Models/Base/LightModel.cs @@ -0,0 +1,26 @@ +using Exiled.API.Features.Toys; +using UnityEngine; +using Light = Exiled.API.Features.Toys.Light; + +namespace KE.Utils.Quality.Models.Base +{ + public class LightModel : BaseModel + { + + /// + /// Create a new Light for modeling + /// + public LightModel(Vector3? scale, Color? color, Vector3 localPositon, Quaternion localRotation) : base(localPositon, localRotation) + { + Light light = Light.Create(null, null, scale, false, color); + _toy = light; + } + + + public override object Clone() + { + Light light = _toy as Light; + return new LightModel(light.Scale, light.Color, LocalPosition, LocalRotation); + } + } +} diff --git a/KruacentExiled/utils-merged/KE.Utilsci/Quality/Models/Base/PrimitiveModel.cs b/KruacentExiled/utils-merged/KE.Utilsci/Quality/Models/Base/PrimitiveModel.cs new file mode 100644 index 00000000..22e07225 --- /dev/null +++ b/KruacentExiled/utils-merged/KE.Utilsci/Quality/Models/Base/PrimitiveModel.cs @@ -0,0 +1,26 @@ +using Exiled.API.Features.Toys; +using UnityEngine; +using Color = UnityEngine.Color; + +namespace KE.Utils.Quality.Models.Base +{ + public class PrimitiveModel : BaseModel + { + /// + /// Create a new Primitive for modeling + /// + public PrimitiveModel(PrimitiveType type, Vector3? scale, Color? color,Vector3 localPosition,Quaternion localRotation) : base(localPosition, localRotation) + { + + Primitive prim = Primitive.Create(type, null, null, scale, false, color); + prim.Collidable = false; + _toy = prim; + } + + public override object Clone() + { + Primitive prim = _toy as Primitive; + return new PrimitiveModel(prim.Type, prim.Scale, prim.Color, LocalPosition, LocalRotation); + } + } +} diff --git a/KruacentExiled/utils-merged/KE.Utilsci/Quality/Models/Examples/MineModel.cs b/KruacentExiled/utils-merged/KE.Utilsci/Quality/Models/Examples/MineModel.cs new file mode 100644 index 00000000..00d60fec --- /dev/null +++ b/KruacentExiled/utils-merged/KE.Utilsci/Quality/Models/Examples/MineModel.cs @@ -0,0 +1,118 @@ +using KE.Utils.Quality.Enums; +using KE.Utils.Quality.Models.Base; +using System.Collections.Generic; +using UnityEngine; +using Light = Exiled.API.Features.Toys.Light; + +namespace KE.Utils.Quality.Models.Examples +{ + public abstract class MineModel : QualityModel + { + protected Light _light; + private bool _lightOn = false; + + + + + public void ToggleLight() + { + if (_light == null) throw new System.Exception("no light"); + if (_lightOn) + _light.UnSpawn(); + else + _light.Spawn(); + _lightOn = !_lightOn; + } + + } + + public class MineModelLow : MineModel + { + public override bool IsPickup => false; + public override ModelQuality Quality => ModelQuality.Low; + + protected override IEnumerable GetBaseModels() + { + Quaternion baseRotation = new(); + //spawn + offset + Vector3 offset = new Vector3(0, .05f); + Vector3 sizeDisk = new Vector3(.7f, 0.1f, .7f); + + Vector3 sizeGlobe = new Vector3(.1f, .1f, .1f); + Vector3 posLight = new Vector3(0, sizeDisk.y+sizeGlobe.y); + + + var baseMine = new PrimitiveModel(PrimitiveType.Cylinder, sizeDisk, Color.black, offset, baseRotation); + + var lightGlobe = new PrimitiveModel(PrimitiveType.Sphere, sizeGlobe , new Color(1, 0, 0, .33f), posLight, baseRotation); + + var lightMine = new LightModel(null, Color.red, posLight, baseRotation); + + _light = lightMine.AdminToy as Light; + _light.Intensity = .55f; + + return [baseMine, lightGlobe, lightMine]; + } + + + } + + public class MineModelMedium : MineModel + { + public override bool IsPickup => false; + public override ModelQuality Quality => ModelQuality.Medium; + + protected override IEnumerable GetBaseModels() + { + Quaternion baseRotation = new(); + //spawn + offset + Vector3 offset = new Vector3(0, .05f); + Vector3 sizeDisk = new Vector3(.7f, 0.1f, .7f); + + Vector3 sizeGlobe = new Vector3(.1f, .1f, .1f); + Vector3 posLight = new Vector3(0, sizeDisk.y + sizeGlobe.y); + + + var baseMine = new PrimitiveModel(PrimitiveType.Cylinder, sizeDisk, Color.black, offset, baseRotation); + + var lightGlobe = new PrimitiveModel(PrimitiveType.Sphere, sizeGlobe, new Color(1, 0, 0, .33f), posLight, baseRotation); + + var lightMine = new LightModel(null, Color.green, posLight, baseRotation); + + _light = lightMine.AdminToy as Light; + _light.Intensity = .55f; + + return [baseMine, lightGlobe, lightMine]; + } + } + + public class MineModelPickup : MineModel + { + public override bool IsPickup => true; + public override ModelQuality Quality => ModelQuality.None; + + + protected override IEnumerable GetBaseModels() + { + Quaternion baseRotation = new(); + //spawn + offset + Vector3 offset = new Vector3(0, .05f); + Vector3 sizeDisk = new Vector3(.7f, 0.1f, .7f); + + Vector3 sizeGlobe = new Vector3(.1f, .1f, .1f); + Vector3 posLight = new Vector3(0, sizeDisk.y + sizeGlobe.y); + + + var baseMine = new PrimitiveModel(PrimitiveType.Cylinder, sizeDisk, Color.black, offset, baseRotation); + + var lightGlobe = new PrimitiveModel(PrimitiveType.Sphere, sizeGlobe, new Color(1, 0, 0, .33f), posLight, baseRotation); + + var lightMine = new LightModel(null, Color.magenta, posLight, baseRotation); + + _light = lightMine.AdminToy as Light; + _light.Intensity = .55f; + + return [baseMine, lightGlobe, lightMine]; + } + } +} diff --git a/KruacentExiled/utils-merged/KE.Utilsci/Quality/Models/Model.cs b/KruacentExiled/utils-merged/KE.Utilsci/Quality/Models/Model.cs new file mode 100644 index 00000000..2e26756e --- /dev/null +++ b/KruacentExiled/utils-merged/KE.Utilsci/Quality/Models/Model.cs @@ -0,0 +1,104 @@ +using Exiled.API.Features; +using Exiled.API.Features.Toys; +using KE.Utils.Quality.Models.Base; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using UnityEngine; + +namespace KE.Utils.Quality.Models +{ + public class Model : IEquatable + { + + + private Vector3 _position; + public Vector3 Position + { + get { return _position; } + set + { + _position = value; + } + } + private Quaternion _rotation; + public Quaternion Rotation + { + get { return _rotation; } + set + { + _rotation = value; + } + } + private ModelPrefab _prefab; + public ModelPrefab Prefab + { + get { return _prefab; } + } + + + + private HashSet _models; + + internal Model(ModelPrefab prefab, Vector3 position, Quaternion rotation,IEnumerable toys,bool spawn) + { + _prefab = prefab; + Position = position; + Rotation = rotation; + _models = new HashSet(toys); + QualityHandler.Instance.QualityToysHandler.Sync(); + + foreach (BaseModel based in toys) + { + AdminToy toy = based.AdminToy; + + if (toy is Primitive p) + p.Collidable = false; + toy.AdminToyBase.transform.position = based.LocalPosition + Position; + toy.AdminToyBase.transform.rotation = based.LocalRotation * Rotation; + } + if(spawn) + { + Spawn(); + } + } + + + public void Destroy() + { + foreach (BaseModel primitive in _models) + { + primitive.AdminToy.Destroy(); + } + } + public void UnSpawn() + { + foreach (BaseModel primitive in _models) + { + primitive.AdminToy.UnSpawn(); + } + } + public void Spawn() + { + QualityHandler.Instance.QualityToysHandler.Sync(); + foreach (BaseModel primitive in _models) + { + primitive.AdminToy.Spawn(); + } + + } + + + public bool Equals(Model x) + { + if (x == null) return false; + return x._prefab == _prefab && x.Position == Position && x.Rotation == Rotation; + } + public int GetHashCode(Model obj) + { + return obj.GetHashCode(); + } + } +} diff --git a/KruacentExiled/utils-merged/KE.Utilsci/Quality/Models/ModelPrefab.cs b/KruacentExiled/utils-merged/KE.Utilsci/Quality/Models/ModelPrefab.cs new file mode 100644 index 00000000..bbc39da4 --- /dev/null +++ b/KruacentExiled/utils-merged/KE.Utilsci/Quality/Models/ModelPrefab.cs @@ -0,0 +1,42 @@ +using Exiled.API.Features; +using Exiled.API.Features.Core; +using Exiled.API.Features.Pickups; +using Exiled.API.Features.Toys; +using Exiled.API.Interfaces; +using KE.Utils.Extensions; +using KE.Utils.Quality.Models.Base; +using KE.Utils.Quality.Structs; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using UnityEngine; +using Light = Exiled.API.Features.Toys.Light; + +namespace KE.Utils.Quality.Models +{ + public abstract class ModelPrefab + { + + protected abstract IEnumerable GetBaseModels(); + + public virtual Model Create(Vector3 position,Quaternion rotation, bool spawn = true) + { + + HashSet clonetoys = new(); + HashSet toys = GetBaseModels().ToHashSet(); + foreach (BaseModel model in toys) + { + BaseModel clone = (BaseModel)model.Clone(); + clonetoys.Add(clone); + } + return new Model(this, position, rotation, clonetoys,spawn); + + } + + + + + } +} diff --git a/KruacentExiled/utils-merged/KE.Utilsci/Quality/Models/QualityModel.cs b/KruacentExiled/utils-merged/KE.Utilsci/Quality/Models/QualityModel.cs new file mode 100644 index 00000000..b5cc682f --- /dev/null +++ b/KruacentExiled/utils-merged/KE.Utilsci/Quality/Models/QualityModel.cs @@ -0,0 +1,40 @@ +using Exiled.API.Features; +using Exiled.API.Features.Toys; +using KE.Utils.Extensions; +using KE.Utils.Quality.Enums; +using KE.Utils.Quality.Models.Base; +using System.Collections.Generic; +using System.Linq; +using UnityEngine; + +namespace KE.Utils.Quality.Models +{ + public abstract class QualityModel : ModelPrefab + { + public abstract ModelQuality Quality { get; } + public abstract bool IsPickup { get; } + + + + + public override sealed Model Create(Vector3 position, Quaternion rotation,bool spawn = true) + { + + HashSet clonetoys = new(); + HashSet toys = GetBaseModels().ToHashSet(); + foreach (BaseModel model in toys) + { + BaseModel clone = (BaseModel)model.Clone(); + + if (IsPickup) + clone.AdminToy.SetAsPickupAdminToy(false); + + clone.AdminToy.SetQuality(Quality,false); + clonetoys.Add(clone); + } + QualityHandler.Sync(); + return new Model(this,position, rotation, clonetoys, spawn); + } + + } +} diff --git a/KruacentExiled/utils-merged/KE.Utilsci/Quality/QualityHandler.cs b/KruacentExiled/utils-merged/KE.Utilsci/Quality/QualityHandler.cs new file mode 100644 index 00000000..235d79c9 --- /dev/null +++ b/KruacentExiled/utils-merged/KE.Utilsci/Quality/QualityHandler.cs @@ -0,0 +1,61 @@ +using Exiled.API.Features; +using Exiled.API.Features.Core.UserSettings; +using KE.Utils.Quality.Handlers; +using KE.Utils.Quality.Settings; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace KE.Utils.Quality +{ + [Obsolete("scrapped", false)] + internal class QualityHandler + { + public QualitySettings QualitySettings { get; private set; } + public QualityToysHandler QualityToysHandler { get; private set; } + + private static QualityHandler _instance; + public static QualityHandler Instance + { + get + { + if(_instance == null ) + _instance = new QualityHandler(); + return _instance; + } + } + private QualityHandler() + { + QualitySettings = new QualitySettings(Changed); + QualityToysHandler = new QualityToysHandler(); + } + + ~QualityHandler() + { + QualityToysHandler = null; + QualitySettings = null; + } + + public void Changed(Player p, SettingBase _) + { + QualityToysHandler.Sync(p); + } + + public void Register() + { + QualitySettings.Register(); + } + + public void Unregister() + { + QualitySettings.Unregister(); + } + + public static void Sync() + { + Instance.QualityToysHandler.Sync(); + } + } +} diff --git a/KruacentExiled/utils-merged/KE.Utilsci/Quality/QualityToysHandler.cs b/KruacentExiled/utils-merged/KE.Utilsci/Quality/QualityToysHandler.cs new file mode 100644 index 00000000..27320233 --- /dev/null +++ b/KruacentExiled/utils-merged/KE.Utilsci/Quality/QualityToysHandler.cs @@ -0,0 +1,155 @@ +using AdminToys; +using Exiled.API.Enums; +using Exiled.API.Extensions; +using Exiled.API.Features; +using Exiled.API.Features.Toys; +using KE.Utils.Quality.Enums; +using KE.Utils.Quality.Settings; +using System.Collections.Generic; +using System.Linq; +using UnityEngine; +using Light = Exiled.API.Features.Toys.Light; +using QualitySettings = KE.Utils.Quality.Settings.QualitySettings; + +namespace KE.Utils.Quality +{ + public class QualityToysHandler + { + private HashSet _pickupToys = new(); + private Dictionary _qualityToys = new(); + public readonly Vector3 Gulag = new Vector3(15000,15000,15000); + + public bool IsPickupToy(AdminToy primitive) + { + return _pickupToys.Contains(primitive); + } + + public bool IsQualityToy(AdminToy primitive) + { + return _qualityToys.ContainsKey(primitive); + } + + + public void SetAsPickup(AdminToy toy) + { + if (!_pickupToys.Add(toy)) + { + Log.Warn($"AdminToy {toy} is already a pickupToy"); + return; + } + } + + public void SetQuality(AdminToy toy,ModelQuality quality) + { + if (toy == null) return; + if (!_qualityToys.ContainsKey(toy)) + _qualityToys.Add(toy,quality); + else + _qualityToys[toy] = quality; + } + + + + private void SendToShadowRealm(AdminToy adminToy, Player player) + { + if(adminToy is Light l) + { + player.SendFakeSyncVar(l.Base.netIdentity, typeof(LightSourceToy), nameof(LightSourceToy.NetworkPosition), Gulag); + return; + } + if(adminToy is Primitive p) + { + player.SendFakeSyncVar(p.Base.netIdentity, typeof(PrimitiveObjectToy), nameof(PrimitiveObjectToy.NetworkPosition), Gulag); + return; + } + } + + private void SetTruePosition(AdminToy adminToy, Player player) + { + if (adminToy is Light l) + { + player.SendFakeSyncVar(l.Base.netIdentity, typeof(LightSourceToy), nameof(LightSourceToy.NetworkPosition), l.Position); + return; + } + if (adminToy is Primitive p) + { + player.SendFakeSyncVar(p.Base.netIdentity, typeof(PrimitiveObjectToy), nameof(PrimitiveObjectToy.NetworkPosition), p.Position); + return; + } + } + + /// + /// Sync every Players + /// + public void Sync() + { + foreach(Player p in Player.List) + { + Sync(p); + } + } + + /// + /// Sync a specified Player + /// + /// + public void Sync(Player p) + { + var quality = QualitySettings.Get(p); + var pickup = QualitySettings.PickmodelActivated(p); + + if (!pickup) + { + //hide pickup toys + foreach (AdminToy pk in _pickupToys) + { + SendToShadowRealm(pk, p); + } + } + else + { + //show pickup toys + foreach (AdminToy pk in _pickupToys) + { + SetTruePosition(pk, p); + } + } + + + + + foreach(var at in _qualityToys) + { + if(at.Value == quality) + { + if (pickup || !_pickupToys.Contains(at.Key)) + { + SetTruePosition(at.Key, p); + } + } + else + { + SendToShadowRealm(at.Key, p); + } + + } + + } + + /// + /// Sync a specified AdminToy + /// + /// + public void Sync(AdminToy adminToy) + { + if (IsPickupToy(adminToy)) + { + + } + if (IsQualityToy(adminToy)) + { + + } + } + } +} diff --git a/KruacentExiled/utils-merged/KE.Utilsci/Quality/Settings/QualitySettings.cs b/KruacentExiled/utils-merged/KE.Utilsci/Quality/Settings/QualitySettings.cs new file mode 100644 index 00000000..ca8d49be --- /dev/null +++ b/KruacentExiled/utils-merged/KE.Utilsci/Quality/Settings/QualitySettings.cs @@ -0,0 +1,62 @@ +using Exiled.API.Features; +using Exiled.API.Features.Core.UserSettings; +using KE.Utils.Quality.Enums; +using System; + +namespace KE.Utils.Quality.Settings +{ + public class QualitySettings + { + + private static int _idQuality = 0; + private static int _idModels = 1; + private static int _idSlider = 2; + private SettingBase[] _settings; + public QualitySettings(Action onChanged) + { + HeaderSetting header = new("Quality Settings"); + _settings = + [ + header, + new DropdownSetting(_idQuality,"ModelQuality",["Low","Medium", "High"],onChanged:onChanged), + new TwoButtonsSetting(_idModels,"Pickup models","Disabled","Enabled", onChanged:onChanged) + ]; + } + + public void Register() + { + SettingBase.Register(_settings); + SettingBase.SendToAll(); + } + + public void Unregister() + { + SettingBase.Unregister(settings:_settings); + } + + + + + public static ModelQuality Get(Player p) + { + if (!SettingBase.TryGetSetting(p, _idQuality, out var setting)) return ModelQuality.None; + + return setting.SelectedOption switch + { + "Low" => ModelQuality.Low, + "Medium" => ModelQuality.Medium, + "High" => ModelQuality.High, + _ => ModelQuality.None, + }; + } + + + public static bool PickmodelActivated(Player p) + { + if (!SettingBase.TryGetSetting(p, _idModels, out var setting)) return false; + return setting.IsSecond; + } + + + } +} diff --git a/KruacentExiled/utils-merged/KE.Utilsci/Quality/Structs/LocalWorldSpace.cs b/KruacentExiled/utils-merged/KE.Utilsci/Quality/Structs/LocalWorldSpace.cs new file mode 100644 index 00000000..d9c6205b --- /dev/null +++ b/KruacentExiled/utils-merged/KE.Utilsci/Quality/Structs/LocalWorldSpace.cs @@ -0,0 +1,23 @@ +using Exiled.API.Interfaces; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using UnityEngine; + +namespace KE.Utils.Quality.Structs +{ + public readonly struct LocalWorldSpace : IWorldSpace + { + + public Vector3 Position { get; } + public Quaternion Rotation { get; } + + public LocalWorldSpace(Vector3 position, Quaternion rotation) + { + Position = position; + Rotation = rotation; + } + } +} diff --git a/KruacentExiled/utils-merged/KE.Utilsci/Quality/Tests/Test.cs b/KruacentExiled/utils-merged/KE.Utilsci/Quality/Tests/Test.cs new file mode 100644 index 00000000..6ebd3f66 --- /dev/null +++ b/KruacentExiled/utils-merged/KE.Utilsci/Quality/Tests/Test.cs @@ -0,0 +1,108 @@ +using Exiled.API.Extensions; +using Exiled.API.Features; +using Exiled.API.Features.Toys; +using KE.Utils.Quality.Models; +using KE.Utils.Quality.Models.Examples; +using MEC; +using PlayerRoles; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using UnityEngine; + +namespace KE.Utils.Quality.Tests +{ + public class Test + { + private QualityHandler QualityHandler; + + + private Test(QualityHandler q) + { + QualityHandler = q; + try + { + TestMine(); + } + catch (Exception ex) + { + Log.Error("Exception for TestMine :\n"+ex); + } + + } + internal void TestQuality() + { + Vector3 pos = RoleTypeId.Scp049.GetRandomSpawnLocation().Position; + Primitive c = Primitive.Create(pos); + c.Color = Color.red; + Primitive c2 = Primitive.Create(pos + Vector3.one); + c2.Color = Color.green; + + + QualityHandler.QualityToysHandler.SetQuality(c, Enums.ModelQuality.Low); + QualityHandler.QualityToysHandler.SetQuality(c2, Enums.ModelQuality.Medium); + } + + internal void StressTest(int count) + { + Timing.RunCoroutine(Stress(count)); + } + + + private IEnumerator Stress(int count) + { + Vector3 pos = RoleTypeId.Scp049.GetRandomSpawnLocation().Position; + Vector3 scale = new Vector3(.1f, .1f, .1f); + float maxSpread = 5; + for (int i = 0; i < count; i++) + { + Primitive c = Primitive.Create(pos + new Vector3(UnityEngine.Random.Range(0f, maxSpread), UnityEngine.Random.Range(0f, maxSpread), UnityEngine.Random.Range(0f, maxSpread)), scale: scale); + QualityHandler.QualityToysHandler.SetQuality(c, Enums.ModelQuality.Medium); + } + QualityHandler.QualityToysHandler.Sync(); + yield return 0; + } + + public void TestMine() + { + Log.Info("TestMine"); + Vector3 pos = RoleTypeId.Scp049.GetRandomSpawnLocation().Position; + MineModelLow mml = new(); + + + Model m = mml.Create(pos, new Quaternion()); + m.Spawn(); + + + MineModelMedium mmm = new(); + + m = mmm.Create(pos + Vector3.up, new Quaternion()); + m.Spawn(); + + + MineModelPickup mmp = new(); + m = mmp.Create(pos + Vector3.right, new Quaternion()); + m.Spawn(); + + QualityHandler.Sync(); + + + + + + + + + foreach (var item in Player.List) + { + item.Teleport(pos); + } + + + + + } + } +} diff --git a/KruacentExiled/utils-merged/KE.Utilscr/API/Displays/DisplayMeow/DisplayHandler.cs b/KruacentExiled/utils-merged/KE.Utilscr/API/Displays/DisplayMeow/DisplayHandler.cs new file mode 100644 index 00000000..1322a6c5 --- /dev/null +++ b/KruacentExiled/utils-merged/KE.Utilscr/API/Displays/DisplayMeow/DisplayHandler.cs @@ -0,0 +1,66 @@ +using Exiled.API.Features; +using HintServiceMeow.Core.Extension; +using HintServiceMeow.Core.Models.Hints; +using HintServiceMeow.Core.Utilities; +using MEC; + + +//damn why the same name +using MHint = HintServiceMeow.Core.Models.Hints.Hint; + +namespace KE.Utils.API.Displays.DisplayMeow +{ + public class DisplayHandler + { + public static DisplayHandler Instance { get; } = new(); + + private DisplayHandler() { } + + + + + + public MHint AddHint(HintPlacement hintPlacement, Player player, string text, float delay) + { + var dis = PlayerDisplay.Get(player); + string id = $"{player.Id}_{hintPlacement.XCoordinate}_{hintPlacement.YCoordinate}"; + MHint hint; + + if (!dis.TryGetHint(id, out var aHint)) + { + hint = new() + { + Text = text, + XCoordinate = hintPlacement.XCoordinate, + YCoordinate = hintPlacement.YCoordinate, + Alignment = hintPlacement.HintAlignment, + Id = id + + }; + dis.AddHint(hint); + + } + else + { + + hint = (MHint)aHint; + hint.Hide = false; + hint.Text = text; + } + + + hint.HideAfter(delay); + return hint; + } + + + + + + + + + + + } +} diff --git a/KruacentExiled/utils-merged/KE.Utilscr/API/Displays/DisplayMeow/HintPlacement.cs b/KruacentExiled/utils-merged/KE.Utilscr/API/Displays/DisplayMeow/HintPlacement.cs new file mode 100644 index 00000000..936cdbe9 --- /dev/null +++ b/KruacentExiled/utils-merged/KE.Utilscr/API/Displays/DisplayMeow/HintPlacement.cs @@ -0,0 +1,31 @@ +using HintServiceMeow.Core.Enum; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace KE.Utils.API.Displays.DisplayMeow +{ + public readonly struct HintPlacement : IEquatable + { + public float YCoordinate { get; } + public float XCoordinate { get; } + public HintAlignment HintAlignment { get; } = HintAlignment.Center; + + + public bool Equals(HintPlacement obj) + { + return YCoordinate == obj.YCoordinate && XCoordinate == obj.XCoordinate; + } + + + public HintPlacement(float xCoordinate, float yCoordinate, HintAlignment alignment = HintAlignment.Center) + { + YCoordinate = yCoordinate; + XCoordinate = xCoordinate; + HintAlignment = alignment; + } + + } +} diff --git a/KruacentExiled/utils-merged/KE.Utilscr/API/Interfaces/IEvents.cs b/KruacentExiled/utils-merged/KE.Utilscr/API/Interfaces/IEvents.cs new file mode 100644 index 00000000..e573b062 --- /dev/null +++ b/KruacentExiled/utils-merged/KE.Utilscr/API/Interfaces/IEvents.cs @@ -0,0 +1,17 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace KE.Utils.API.Interfaces +{ + public interface IUsingEvents + { + + + public void SubscribeEvents(); + + public void UnsubscribeEvents(); + } +} diff --git a/KruacentExiled/utils-merged/KE.Utilscr/API/OtherUtils.cs b/KruacentExiled/utils-merged/KE.Utilscr/API/OtherUtils.cs new file mode 100644 index 00000000..2995a624 --- /dev/null +++ b/KruacentExiled/utils-merged/KE.Utilscr/API/OtherUtils.cs @@ -0,0 +1,18 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using UnityEngine; + +namespace KE.Utils.API +{ + public static class OtherUtils + { + + public static bool IsInCircle(Vector3 pos,Vector3 centerCircle,float radius) + { + return Math.Pow(pos.x - centerCircle.x, 2) + Math.Pow(pos.y - centerCircle.y, 2) <= Math.Pow(radius, 2); + } + } +} diff --git a/KruacentExiled/utils-merged/KE.Utilscr/Extensions/AdminToyExtension.cs b/KruacentExiled/utils-merged/KE.Utilscr/Extensions/AdminToyExtension.cs new file mode 100644 index 00000000..37c3706d --- /dev/null +++ b/KruacentExiled/utils-merged/KE.Utilscr/Extensions/AdminToyExtension.cs @@ -0,0 +1,25 @@ +using Exiled.API.Features.Toys; +using KE.Utils.Quality; +using KE.Utils.Quality.Enums; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace KE.Utils.Extensions +{ + public static class AdminToyExtension + { + + public static void SetAsPickupAdminToy(this AdminToy toy, bool autoSync = true) + { + QualityHandler.Instance.QualityToysHandler.SetAsPickup(toy); + } + + public static void SetQuality(this AdminToy toy, ModelQuality modelQuality,bool autoSync = true) + { + QualityHandler.Instance.QualityToysHandler.SetQuality(toy, modelQuality); + } + } +} diff --git a/KruacentExiled/utils-merged/KE.Utilscr/Extensions/PlayerExtension.cs b/KruacentExiled/utils-merged/KE.Utilscr/Extensions/PlayerExtension.cs new file mode 100644 index 00000000..b01f98d2 --- /dev/null +++ b/KruacentExiled/utils-merged/KE.Utilscr/Extensions/PlayerExtension.cs @@ -0,0 +1,52 @@ +using CustomPlayerEffects; +using Exiled.API.Enums; +using Exiled.API.Features; +using Mirror; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using UnityEngine; + +namespace KE.Utils.Extensions +{ + public static class PlayerExtension + { + public static void SetFakeInvis(this Player p, IEnumerable viewers) + { + Vector3 pos = p.Position; + + try + { + p.ReferenceHub.transform.localPosition = Vector3.zero; + foreach (Player viewer in viewers) + { + Server.SendSpawnMessage.Invoke(null, new object[2] { viewer.NetworkIdentity, viewer.Connection }); + } + + p.ReferenceHub.transform.localPosition = pos; + } + catch (Exception arg) + { + Log.Error(string.Format("{0}: {1}", "SetFakeInvis", arg)); + } + } + + + + + public static void AddLevelEffect(this Player p,EffectType type, int intensity) + { + + + if (!p.TryGetEffect(type, out var effect)) + p.ChangeEffectIntensity(type, (byte)(effect.Intensity + intensity)); + else + p.EnableEffect(type, (byte)intensity); + } + + + + } +} diff --git a/KruacentExiled/utils-merged/KE.Utilscr/Extensions/RoomExtension.cs b/KruacentExiled/utils-merged/KE.Utilscr/Extensions/RoomExtension.cs new file mode 100644 index 00000000..35fee2e8 --- /dev/null +++ b/KruacentExiled/utils-merged/KE.Utilscr/Extensions/RoomExtension.cs @@ -0,0 +1,12 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace KE.Utils.Extensions +{ + internal class RoomExtension + { + } +} diff --git a/KruacentExiled/utils-merged/KE.Utilscr/KE.Utils.csproj b/KruacentExiled/utils-merged/KE.Utilscr/KE.Utils.csproj new file mode 100644 index 00000000..1587c6e8 --- /dev/null +++ b/KruacentExiled/utils-merged/KE.Utilscr/KE.Utils.csproj @@ -0,0 +1,30 @@ + + + + 13.0 + net48 + + + + + + + + + + + + + + + + + + if not "$(EXILED_DEV_REFERENCES)"=="" copy /y "$(OutputPath)$(AssemblyName).dll" "$(EXILED_DEV_REFERENCES)\Plugins\" + + + if [[ ! -z "$EXILED_DEV_REFERENCES" ]]; then cp "$(OutputPath)$(AssemblyName).dll" "$EXILED_DEV_REFERENCES/Plugins/"; fi + + + + diff --git a/KruacentExiled/utils-merged/KE.Utilscr/Quality/Enums/ModelQuality.cs b/KruacentExiled/utils-merged/KE.Utilscr/Quality/Enums/ModelQuality.cs new file mode 100644 index 00000000..d9d8d295 --- /dev/null +++ b/KruacentExiled/utils-merged/KE.Utilscr/Quality/Enums/ModelQuality.cs @@ -0,0 +1,16 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace KE.Utils.Quality.Enums +{ + public enum ModelQuality + { + None = -1, + Low, + Medium, + High, + } +} diff --git a/KruacentExiled/utils-merged/KE.Utilscr/Quality/Handlers/QualityToysHandler.cs b/KruacentExiled/utils-merged/KE.Utilscr/Quality/Handlers/QualityToysHandler.cs new file mode 100644 index 00000000..b2485795 --- /dev/null +++ b/KruacentExiled/utils-merged/KE.Utilscr/Quality/Handlers/QualityToysHandler.cs @@ -0,0 +1,179 @@ +using AdminToys; +using Exiled.API.Enums; +using Exiled.API.Extensions; +using Exiled.API.Features; +using Exiled.API.Features.Toys; +using KE.Utils.Quality.Enums; +using KE.Utils.Quality.Settings; +using MEC; +using System; +using System.Collections.Generic; +using System.Linq; +using UnityEngine; +using Light = Exiled.API.Features.Toys.Light; +using QualitySettings = KE.Utils.Quality.Settings.QualitySettings; + +namespace KE.Utils.Quality.Handlers +{ + public class QualityToysHandler + { + private HashSet _pickupToys = new(); + private Dictionary _qualityToys = new(); + public readonly Vector3 Gulag = new Vector3(15000, 15000, 15000); + public const float Delay = Timing.WaitForOneFrame; + public bool IsPickupToy(AdminToy primitive) + { + return _pickupToys.Contains(primitive); + } + + public bool IsQualityToy(AdminToy primitive) + { + return _qualityToys.ContainsKey(primitive); + } + + + public void SetAsPickup(AdminToy toy, bool autoSync = true) + { + if (!_pickupToys.Add(toy)) + { + Log.Warn($"AdminToy {toy} is already a pickupToy"); + return; + } + if (autoSync) + Sync(toy); + } + + public void SetQuality(AdminToy toy, ModelQuality quality, bool autoSync = true) + { + if (toy == null) return; + if (!_qualityToys.ContainsKey(toy)) + _qualityToys.Add(toy, quality); + else + _qualityToys[toy] = quality; + + if (autoSync) + Sync(toy); + } + + + + private void SendToFakePosition(AdminToy adminToy, Player player,Vector3 position) + { + //idk why but without delay it show all of the quality at once + Timing.CallDelayed(Delay, () => + { + if (adminToy is Light l) + { + player.SendFakeSyncVar(l.Base.netIdentity, typeof(LightSourceToy), nameof(LightSourceToy.NetworkPosition), position); + return; + } + if (adminToy is Primitive p) + { + player.SendFakeSyncVar(p.Base.netIdentity, typeof(PrimitiveObjectToy), nameof(PrimitiveObjectToy.NetworkPosition), position); + return; + } + }); + + } + + /// + /// Sync every Players + /// + public void Sync() + { + foreach (Player p in Player.List) + { + Sync(p); + } + } + + /// + /// Sync a specified Player + /// + /// + public void Sync(Player p) + { + + + + var quality = QualitySettings.Get(p); + var pickup = QualitySettings.PickmodelActivated(p); + + HashSet pickupToRemove = []; + HashSet qualityToRemove = []; + + //hide pickup toys + + foreach (AdminToy pk in _pickupToys) + { + try + { + if (pickup) + { + SendToFakePosition(pk, p, pk.Position); + } + else + { + SendToFakePosition(pk, p, Gulag); + } + } + catch (NullReferenceException) + { + //Log.Warn("removing pickup"); + pickupToRemove.Add(pk); + } + + } + + _pickupToys.RemoveWhere(p => pickupToRemove.Contains(p)); + + + foreach (var at in _qualityToys) + { + try + { + if ((at.Value == quality || at.Value == ModelQuality.None) && (pickup || !_pickupToys.Contains(at.Key))) + { + SendToFakePosition(at.Key, p, at.Key.Position); + } + else + { + SendToFakePosition(at.Key, p, Gulag); + } + } + catch (NullReferenceException) + { + //Log.Warn("removing quality" + _qualityToys.Count); + qualityToRemove.Add(at.Key); + } + + + } + foreach(var at in qualityToRemove) + { + + _qualityToys.Remove(at); + } + + } + + /// + /// Sync a specified AdminToy + /// + /// + public void Sync(AdminToy adminToy) + { + //temporary fix + Sync(); + + if (IsPickupToy(adminToy)) + { + + } + if (IsQualityToy(adminToy)) + { + + } + } + } +} diff --git a/KruacentExiled/utils-merged/KE.Utilscr/Quality/Models/Base/BaseModel.cs b/KruacentExiled/utils-merged/KE.Utilscr/Quality/Models/Base/BaseModel.cs new file mode 100644 index 00000000..c9f6723c --- /dev/null +++ b/KruacentExiled/utils-merged/KE.Utilscr/Quality/Models/Base/BaseModel.cs @@ -0,0 +1,41 @@ +using Exiled.API.Enums; +using Exiled.API.Extensions; +using Exiled.API.Features.Toys; +using Exiled.API.Interfaces; +using KE.Utils.Quality.Structs; +using PlayerStatsSystem; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using UnityEngine; +using Light = Exiled.API.Features.Toys.Light; + +namespace KE.Utils.Quality.Models.Base +{ + + /// + /// The blocks to build a model with + /// + public abstract class BaseModel : ICloneable + { + + protected AdminToy _toy; + public AdminToy AdminToy { get { return _toy; } } + private Vector3 _position; + public Vector3 LocalPosition { get { return _position; } } + private Quaternion _rotation; + public Quaternion LocalRotation { get { return _rotation; } } + + + public BaseModel(Vector3 localPositon, Quaternion localRotation) + { + _position = localPositon; + _rotation = localRotation; + } + + public abstract object Clone(); + } + +} diff --git a/KruacentExiled/utils-merged/KE.Utilscr/Quality/Models/Base/LightModel.cs b/KruacentExiled/utils-merged/KE.Utilscr/Quality/Models/Base/LightModel.cs new file mode 100644 index 00000000..ce808da1 --- /dev/null +++ b/KruacentExiled/utils-merged/KE.Utilscr/Quality/Models/Base/LightModel.cs @@ -0,0 +1,26 @@ +using Exiled.API.Features.Toys; +using UnityEngine; +using Light = Exiled.API.Features.Toys.Light; + +namespace KE.Utils.Quality.Models.Base +{ + public class LightModel : BaseModel + { + + /// + /// Create a new Light for modeling + /// + public LightModel(Vector3? scale, Color? color, Vector3 localPositon, Quaternion localRotation) : base(localPositon, localRotation) + { + Light light = Light.Create(null, null, scale, false, color); + _toy = light; + } + + + public override object Clone() + { + Light light = _toy as Light; + return new LightModel(light.Scale, light.Color, LocalPosition, LocalRotation); + } + } +} diff --git a/KruacentExiled/utils-merged/KE.Utilscr/Quality/Models/Base/PrimitiveModel.cs b/KruacentExiled/utils-merged/KE.Utilscr/Quality/Models/Base/PrimitiveModel.cs new file mode 100644 index 00000000..22e07225 --- /dev/null +++ b/KruacentExiled/utils-merged/KE.Utilscr/Quality/Models/Base/PrimitiveModel.cs @@ -0,0 +1,26 @@ +using Exiled.API.Features.Toys; +using UnityEngine; +using Color = UnityEngine.Color; + +namespace KE.Utils.Quality.Models.Base +{ + public class PrimitiveModel : BaseModel + { + /// + /// Create a new Primitive for modeling + /// + public PrimitiveModel(PrimitiveType type, Vector3? scale, Color? color,Vector3 localPosition,Quaternion localRotation) : base(localPosition, localRotation) + { + + Primitive prim = Primitive.Create(type, null, null, scale, false, color); + prim.Collidable = false; + _toy = prim; + } + + public override object Clone() + { + Primitive prim = _toy as Primitive; + return new PrimitiveModel(prim.Type, prim.Scale, prim.Color, LocalPosition, LocalRotation); + } + } +} diff --git a/KruacentExiled/utils-merged/KE.Utilscr/Quality/Models/Examples/MineModel.cs b/KruacentExiled/utils-merged/KE.Utilscr/Quality/Models/Examples/MineModel.cs new file mode 100644 index 00000000..00d60fec --- /dev/null +++ b/KruacentExiled/utils-merged/KE.Utilscr/Quality/Models/Examples/MineModel.cs @@ -0,0 +1,118 @@ +using KE.Utils.Quality.Enums; +using KE.Utils.Quality.Models.Base; +using System.Collections.Generic; +using UnityEngine; +using Light = Exiled.API.Features.Toys.Light; + +namespace KE.Utils.Quality.Models.Examples +{ + public abstract class MineModel : QualityModel + { + protected Light _light; + private bool _lightOn = false; + + + + + public void ToggleLight() + { + if (_light == null) throw new System.Exception("no light"); + if (_lightOn) + _light.UnSpawn(); + else + _light.Spawn(); + _lightOn = !_lightOn; + } + + } + + public class MineModelLow : MineModel + { + public override bool IsPickup => false; + public override ModelQuality Quality => ModelQuality.Low; + + protected override IEnumerable GetBaseModels() + { + Quaternion baseRotation = new(); + //spawn + offset + Vector3 offset = new Vector3(0, .05f); + Vector3 sizeDisk = new Vector3(.7f, 0.1f, .7f); + + Vector3 sizeGlobe = new Vector3(.1f, .1f, .1f); + Vector3 posLight = new Vector3(0, sizeDisk.y+sizeGlobe.y); + + + var baseMine = new PrimitiveModel(PrimitiveType.Cylinder, sizeDisk, Color.black, offset, baseRotation); + + var lightGlobe = new PrimitiveModel(PrimitiveType.Sphere, sizeGlobe , new Color(1, 0, 0, .33f), posLight, baseRotation); + + var lightMine = new LightModel(null, Color.red, posLight, baseRotation); + + _light = lightMine.AdminToy as Light; + _light.Intensity = .55f; + + return [baseMine, lightGlobe, lightMine]; + } + + + } + + public class MineModelMedium : MineModel + { + public override bool IsPickup => false; + public override ModelQuality Quality => ModelQuality.Medium; + + protected override IEnumerable GetBaseModels() + { + Quaternion baseRotation = new(); + //spawn + offset + Vector3 offset = new Vector3(0, .05f); + Vector3 sizeDisk = new Vector3(.7f, 0.1f, .7f); + + Vector3 sizeGlobe = new Vector3(.1f, .1f, .1f); + Vector3 posLight = new Vector3(0, sizeDisk.y + sizeGlobe.y); + + + var baseMine = new PrimitiveModel(PrimitiveType.Cylinder, sizeDisk, Color.black, offset, baseRotation); + + var lightGlobe = new PrimitiveModel(PrimitiveType.Sphere, sizeGlobe, new Color(1, 0, 0, .33f), posLight, baseRotation); + + var lightMine = new LightModel(null, Color.green, posLight, baseRotation); + + _light = lightMine.AdminToy as Light; + _light.Intensity = .55f; + + return [baseMine, lightGlobe, lightMine]; + } + } + + public class MineModelPickup : MineModel + { + public override bool IsPickup => true; + public override ModelQuality Quality => ModelQuality.None; + + + protected override IEnumerable GetBaseModels() + { + Quaternion baseRotation = new(); + //spawn + offset + Vector3 offset = new Vector3(0, .05f); + Vector3 sizeDisk = new Vector3(.7f, 0.1f, .7f); + + Vector3 sizeGlobe = new Vector3(.1f, .1f, .1f); + Vector3 posLight = new Vector3(0, sizeDisk.y + sizeGlobe.y); + + + var baseMine = new PrimitiveModel(PrimitiveType.Cylinder, sizeDisk, Color.black, offset, baseRotation); + + var lightGlobe = new PrimitiveModel(PrimitiveType.Sphere, sizeGlobe, new Color(1, 0, 0, .33f), posLight, baseRotation); + + var lightMine = new LightModel(null, Color.magenta, posLight, baseRotation); + + _light = lightMine.AdminToy as Light; + _light.Intensity = .55f; + + return [baseMine, lightGlobe, lightMine]; + } + } +} diff --git a/KruacentExiled/utils-merged/KE.Utilscr/Quality/Models/Model.cs b/KruacentExiled/utils-merged/KE.Utilscr/Quality/Models/Model.cs new file mode 100644 index 00000000..2e26756e --- /dev/null +++ b/KruacentExiled/utils-merged/KE.Utilscr/Quality/Models/Model.cs @@ -0,0 +1,104 @@ +using Exiled.API.Features; +using Exiled.API.Features.Toys; +using KE.Utils.Quality.Models.Base; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using UnityEngine; + +namespace KE.Utils.Quality.Models +{ + public class Model : IEquatable + { + + + private Vector3 _position; + public Vector3 Position + { + get { return _position; } + set + { + _position = value; + } + } + private Quaternion _rotation; + public Quaternion Rotation + { + get { return _rotation; } + set + { + _rotation = value; + } + } + private ModelPrefab _prefab; + public ModelPrefab Prefab + { + get { return _prefab; } + } + + + + private HashSet _models; + + internal Model(ModelPrefab prefab, Vector3 position, Quaternion rotation,IEnumerable toys,bool spawn) + { + _prefab = prefab; + Position = position; + Rotation = rotation; + _models = new HashSet(toys); + QualityHandler.Instance.QualityToysHandler.Sync(); + + foreach (BaseModel based in toys) + { + AdminToy toy = based.AdminToy; + + if (toy is Primitive p) + p.Collidable = false; + toy.AdminToyBase.transform.position = based.LocalPosition + Position; + toy.AdminToyBase.transform.rotation = based.LocalRotation * Rotation; + } + if(spawn) + { + Spawn(); + } + } + + + public void Destroy() + { + foreach (BaseModel primitive in _models) + { + primitive.AdminToy.Destroy(); + } + } + public void UnSpawn() + { + foreach (BaseModel primitive in _models) + { + primitive.AdminToy.UnSpawn(); + } + } + public void Spawn() + { + QualityHandler.Instance.QualityToysHandler.Sync(); + foreach (BaseModel primitive in _models) + { + primitive.AdminToy.Spawn(); + } + + } + + + public bool Equals(Model x) + { + if (x == null) return false; + return x._prefab == _prefab && x.Position == Position && x.Rotation == Rotation; + } + public int GetHashCode(Model obj) + { + return obj.GetHashCode(); + } + } +} diff --git a/KruacentExiled/utils-merged/KE.Utilscr/Quality/Models/ModelPrefab.cs b/KruacentExiled/utils-merged/KE.Utilscr/Quality/Models/ModelPrefab.cs new file mode 100644 index 00000000..bbc39da4 --- /dev/null +++ b/KruacentExiled/utils-merged/KE.Utilscr/Quality/Models/ModelPrefab.cs @@ -0,0 +1,42 @@ +using Exiled.API.Features; +using Exiled.API.Features.Core; +using Exiled.API.Features.Pickups; +using Exiled.API.Features.Toys; +using Exiled.API.Interfaces; +using KE.Utils.Extensions; +using KE.Utils.Quality.Models.Base; +using KE.Utils.Quality.Structs; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using UnityEngine; +using Light = Exiled.API.Features.Toys.Light; + +namespace KE.Utils.Quality.Models +{ + public abstract class ModelPrefab + { + + protected abstract IEnumerable GetBaseModels(); + + public virtual Model Create(Vector3 position,Quaternion rotation, bool spawn = true) + { + + HashSet clonetoys = new(); + HashSet toys = GetBaseModels().ToHashSet(); + foreach (BaseModel model in toys) + { + BaseModel clone = (BaseModel)model.Clone(); + clonetoys.Add(clone); + } + return new Model(this, position, rotation, clonetoys,spawn); + + } + + + + + } +} diff --git a/KruacentExiled/utils-merged/KE.Utilscr/Quality/Models/QualityModel.cs b/KruacentExiled/utils-merged/KE.Utilscr/Quality/Models/QualityModel.cs new file mode 100644 index 00000000..b5cc682f --- /dev/null +++ b/KruacentExiled/utils-merged/KE.Utilscr/Quality/Models/QualityModel.cs @@ -0,0 +1,40 @@ +using Exiled.API.Features; +using Exiled.API.Features.Toys; +using KE.Utils.Extensions; +using KE.Utils.Quality.Enums; +using KE.Utils.Quality.Models.Base; +using System.Collections.Generic; +using System.Linq; +using UnityEngine; + +namespace KE.Utils.Quality.Models +{ + public abstract class QualityModel : ModelPrefab + { + public abstract ModelQuality Quality { get; } + public abstract bool IsPickup { get; } + + + + + public override sealed Model Create(Vector3 position, Quaternion rotation,bool spawn = true) + { + + HashSet clonetoys = new(); + HashSet toys = GetBaseModels().ToHashSet(); + foreach (BaseModel model in toys) + { + BaseModel clone = (BaseModel)model.Clone(); + + if (IsPickup) + clone.AdminToy.SetAsPickupAdminToy(false); + + clone.AdminToy.SetQuality(Quality,false); + clonetoys.Add(clone); + } + QualityHandler.Sync(); + return new Model(this,position, rotation, clonetoys, spawn); + } + + } +} diff --git a/KruacentExiled/utils-merged/KE.Utilscr/Quality/QualityHandler.cs b/KruacentExiled/utils-merged/KE.Utilscr/Quality/QualityHandler.cs new file mode 100644 index 00000000..235d79c9 --- /dev/null +++ b/KruacentExiled/utils-merged/KE.Utilscr/Quality/QualityHandler.cs @@ -0,0 +1,61 @@ +using Exiled.API.Features; +using Exiled.API.Features.Core.UserSettings; +using KE.Utils.Quality.Handlers; +using KE.Utils.Quality.Settings; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace KE.Utils.Quality +{ + [Obsolete("scrapped", false)] + internal class QualityHandler + { + public QualitySettings QualitySettings { get; private set; } + public QualityToysHandler QualityToysHandler { get; private set; } + + private static QualityHandler _instance; + public static QualityHandler Instance + { + get + { + if(_instance == null ) + _instance = new QualityHandler(); + return _instance; + } + } + private QualityHandler() + { + QualitySettings = new QualitySettings(Changed); + QualityToysHandler = new QualityToysHandler(); + } + + ~QualityHandler() + { + QualityToysHandler = null; + QualitySettings = null; + } + + public void Changed(Player p, SettingBase _) + { + QualityToysHandler.Sync(p); + } + + public void Register() + { + QualitySettings.Register(); + } + + public void Unregister() + { + QualitySettings.Unregister(); + } + + public static void Sync() + { + Instance.QualityToysHandler.Sync(); + } + } +} diff --git a/KruacentExiled/utils-merged/KE.Utilscr/Quality/QualityToysHandler.cs b/KruacentExiled/utils-merged/KE.Utilscr/Quality/QualityToysHandler.cs new file mode 100644 index 00000000..27320233 --- /dev/null +++ b/KruacentExiled/utils-merged/KE.Utilscr/Quality/QualityToysHandler.cs @@ -0,0 +1,155 @@ +using AdminToys; +using Exiled.API.Enums; +using Exiled.API.Extensions; +using Exiled.API.Features; +using Exiled.API.Features.Toys; +using KE.Utils.Quality.Enums; +using KE.Utils.Quality.Settings; +using System.Collections.Generic; +using System.Linq; +using UnityEngine; +using Light = Exiled.API.Features.Toys.Light; +using QualitySettings = KE.Utils.Quality.Settings.QualitySettings; + +namespace KE.Utils.Quality +{ + public class QualityToysHandler + { + private HashSet _pickupToys = new(); + private Dictionary _qualityToys = new(); + public readonly Vector3 Gulag = new Vector3(15000,15000,15000); + + public bool IsPickupToy(AdminToy primitive) + { + return _pickupToys.Contains(primitive); + } + + public bool IsQualityToy(AdminToy primitive) + { + return _qualityToys.ContainsKey(primitive); + } + + + public void SetAsPickup(AdminToy toy) + { + if (!_pickupToys.Add(toy)) + { + Log.Warn($"AdminToy {toy} is already a pickupToy"); + return; + } + } + + public void SetQuality(AdminToy toy,ModelQuality quality) + { + if (toy == null) return; + if (!_qualityToys.ContainsKey(toy)) + _qualityToys.Add(toy,quality); + else + _qualityToys[toy] = quality; + } + + + + private void SendToShadowRealm(AdminToy adminToy, Player player) + { + if(adminToy is Light l) + { + player.SendFakeSyncVar(l.Base.netIdentity, typeof(LightSourceToy), nameof(LightSourceToy.NetworkPosition), Gulag); + return; + } + if(adminToy is Primitive p) + { + player.SendFakeSyncVar(p.Base.netIdentity, typeof(PrimitiveObjectToy), nameof(PrimitiveObjectToy.NetworkPosition), Gulag); + return; + } + } + + private void SetTruePosition(AdminToy adminToy, Player player) + { + if (adminToy is Light l) + { + player.SendFakeSyncVar(l.Base.netIdentity, typeof(LightSourceToy), nameof(LightSourceToy.NetworkPosition), l.Position); + return; + } + if (adminToy is Primitive p) + { + player.SendFakeSyncVar(p.Base.netIdentity, typeof(PrimitiveObjectToy), nameof(PrimitiveObjectToy.NetworkPosition), p.Position); + return; + } + } + + /// + /// Sync every Players + /// + public void Sync() + { + foreach(Player p in Player.List) + { + Sync(p); + } + } + + /// + /// Sync a specified Player + /// + /// + public void Sync(Player p) + { + var quality = QualitySettings.Get(p); + var pickup = QualitySettings.PickmodelActivated(p); + + if (!pickup) + { + //hide pickup toys + foreach (AdminToy pk in _pickupToys) + { + SendToShadowRealm(pk, p); + } + } + else + { + //show pickup toys + foreach (AdminToy pk in _pickupToys) + { + SetTruePosition(pk, p); + } + } + + + + + foreach(var at in _qualityToys) + { + if(at.Value == quality) + { + if (pickup || !_pickupToys.Contains(at.Key)) + { + SetTruePosition(at.Key, p); + } + } + else + { + SendToShadowRealm(at.Key, p); + } + + } + + } + + /// + /// Sync a specified AdminToy + /// + /// + public void Sync(AdminToy adminToy) + { + if (IsPickupToy(adminToy)) + { + + } + if (IsQualityToy(adminToy)) + { + + } + } + } +} diff --git a/KruacentExiled/utils-merged/KE.Utilscr/Quality/Settings/QualitySettings.cs b/KruacentExiled/utils-merged/KE.Utilscr/Quality/Settings/QualitySettings.cs new file mode 100644 index 00000000..ca8d49be --- /dev/null +++ b/KruacentExiled/utils-merged/KE.Utilscr/Quality/Settings/QualitySettings.cs @@ -0,0 +1,62 @@ +using Exiled.API.Features; +using Exiled.API.Features.Core.UserSettings; +using KE.Utils.Quality.Enums; +using System; + +namespace KE.Utils.Quality.Settings +{ + public class QualitySettings + { + + private static int _idQuality = 0; + private static int _idModels = 1; + private static int _idSlider = 2; + private SettingBase[] _settings; + public QualitySettings(Action onChanged) + { + HeaderSetting header = new("Quality Settings"); + _settings = + [ + header, + new DropdownSetting(_idQuality,"ModelQuality",["Low","Medium", "High"],onChanged:onChanged), + new TwoButtonsSetting(_idModels,"Pickup models","Disabled","Enabled", onChanged:onChanged) + ]; + } + + public void Register() + { + SettingBase.Register(_settings); + SettingBase.SendToAll(); + } + + public void Unregister() + { + SettingBase.Unregister(settings:_settings); + } + + + + + public static ModelQuality Get(Player p) + { + if (!SettingBase.TryGetSetting(p, _idQuality, out var setting)) return ModelQuality.None; + + return setting.SelectedOption switch + { + "Low" => ModelQuality.Low, + "Medium" => ModelQuality.Medium, + "High" => ModelQuality.High, + _ => ModelQuality.None, + }; + } + + + public static bool PickmodelActivated(Player p) + { + if (!SettingBase.TryGetSetting(p, _idModels, out var setting)) return false; + return setting.IsSecond; + } + + + } +} diff --git a/KruacentExiled/utils-merged/KE.Utilscr/Quality/Structs/LocalWorldSpace.cs b/KruacentExiled/utils-merged/KE.Utilscr/Quality/Structs/LocalWorldSpace.cs new file mode 100644 index 00000000..d9c6205b --- /dev/null +++ b/KruacentExiled/utils-merged/KE.Utilscr/Quality/Structs/LocalWorldSpace.cs @@ -0,0 +1,23 @@ +using Exiled.API.Interfaces; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using UnityEngine; + +namespace KE.Utils.Quality.Structs +{ + public readonly struct LocalWorldSpace : IWorldSpace + { + + public Vector3 Position { get; } + public Quaternion Rotation { get; } + + public LocalWorldSpace(Vector3 position, Quaternion rotation) + { + Position = position; + Rotation = rotation; + } + } +} diff --git a/KruacentExiled/utils-merged/KE.Utilscr/Quality/Tests/Test.cs b/KruacentExiled/utils-merged/KE.Utilscr/Quality/Tests/Test.cs new file mode 100644 index 00000000..6ebd3f66 --- /dev/null +++ b/KruacentExiled/utils-merged/KE.Utilscr/Quality/Tests/Test.cs @@ -0,0 +1,108 @@ +using Exiled.API.Extensions; +using Exiled.API.Features; +using Exiled.API.Features.Toys; +using KE.Utils.Quality.Models; +using KE.Utils.Quality.Models.Examples; +using MEC; +using PlayerRoles; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using UnityEngine; + +namespace KE.Utils.Quality.Tests +{ + public class Test + { + private QualityHandler QualityHandler; + + + private Test(QualityHandler q) + { + QualityHandler = q; + try + { + TestMine(); + } + catch (Exception ex) + { + Log.Error("Exception for TestMine :\n"+ex); + } + + } + internal void TestQuality() + { + Vector3 pos = RoleTypeId.Scp049.GetRandomSpawnLocation().Position; + Primitive c = Primitive.Create(pos); + c.Color = Color.red; + Primitive c2 = Primitive.Create(pos + Vector3.one); + c2.Color = Color.green; + + + QualityHandler.QualityToysHandler.SetQuality(c, Enums.ModelQuality.Low); + QualityHandler.QualityToysHandler.SetQuality(c2, Enums.ModelQuality.Medium); + } + + internal void StressTest(int count) + { + Timing.RunCoroutine(Stress(count)); + } + + + private IEnumerator Stress(int count) + { + Vector3 pos = RoleTypeId.Scp049.GetRandomSpawnLocation().Position; + Vector3 scale = new Vector3(.1f, .1f, .1f); + float maxSpread = 5; + for (int i = 0; i < count; i++) + { + Primitive c = Primitive.Create(pos + new Vector3(UnityEngine.Random.Range(0f, maxSpread), UnityEngine.Random.Range(0f, maxSpread), UnityEngine.Random.Range(0f, maxSpread)), scale: scale); + QualityHandler.QualityToysHandler.SetQuality(c, Enums.ModelQuality.Medium); + } + QualityHandler.QualityToysHandler.Sync(); + yield return 0; + } + + public void TestMine() + { + Log.Info("TestMine"); + Vector3 pos = RoleTypeId.Scp049.GetRandomSpawnLocation().Position; + MineModelLow mml = new(); + + + Model m = mml.Create(pos, new Quaternion()); + m.Spawn(); + + + MineModelMedium mmm = new(); + + m = mmm.Create(pos + Vector3.up, new Quaternion()); + m.Spawn(); + + + MineModelPickup mmp = new(); + m = mmp.Create(pos + Vector3.right, new Quaternion()); + m.Spawn(); + + QualityHandler.Sync(); + + + + + + + + + foreach (var item in Player.List) + { + item.Teleport(pos); + } + + + + + } + } +} diff --git a/KruacentExiled/utils-merged/KE.Utilsge/API/Displays/DisplayMeow/DisplayHandler.cs b/KruacentExiled/utils-merged/KE.Utilsge/API/Displays/DisplayMeow/DisplayHandler.cs new file mode 100644 index 00000000..4ee13535 --- /dev/null +++ b/KruacentExiled/utils-merged/KE.Utilsge/API/Displays/DisplayMeow/DisplayHandler.cs @@ -0,0 +1,67 @@ +using Exiled.API.Features; +using HintServiceMeow.Core.Extension; +using HintServiceMeow.Core.Models.Hints; +using HintServiceMeow.Core.Utilities; +using MEC; + + +//damn why the same name +using MHint = HintServiceMeow.Core.Models.Hints.Hint; + +namespace KE.Utils.API.Displays.DisplayMeow +{ + public class DisplayHandler + { + public static DisplayHandler Instance { get; } = new(); + + private DisplayHandler() { } + + + + + + + public MHint AddHint(HintPlacement hintPlacement, Player player, string text, float delay) + { + var dis = PlayerDisplay.Get(player); + string id = $"{player.Id}_{hintPlacement.XCoordinate}_{hintPlacement.YCoordinate}"; + MHint hint; + + if (!dis.TryGetHint(id, out var aHint)) + { + hint = new() + { + Text = text, + XCoordinate = hintPlacement.XCoordinate, + YCoordinate = hintPlacement.YCoordinate, + Alignment = hintPlacement.HintAlignment, + Id = id + + }; + dis.AddHint(hint); + + } + else + { + + hint = (MHint)aHint; + hint.Hide = false; + hint.Text = text; + } + + + hint.HideAfter(delay); + return hint; + } + + + + + + + + + + + } +} diff --git a/KruacentExiled/utils-merged/KE.Utilsge/API/Displays/DisplayMeow/HintPlacement.cs b/KruacentExiled/utils-merged/KE.Utilsge/API/Displays/DisplayMeow/HintPlacement.cs new file mode 100644 index 00000000..936cdbe9 --- /dev/null +++ b/KruacentExiled/utils-merged/KE.Utilsge/API/Displays/DisplayMeow/HintPlacement.cs @@ -0,0 +1,31 @@ +using HintServiceMeow.Core.Enum; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace KE.Utils.API.Displays.DisplayMeow +{ + public readonly struct HintPlacement : IEquatable + { + public float YCoordinate { get; } + public float XCoordinate { get; } + public HintAlignment HintAlignment { get; } = HintAlignment.Center; + + + public bool Equals(HintPlacement obj) + { + return YCoordinate == obj.YCoordinate && XCoordinate == obj.XCoordinate; + } + + + public HintPlacement(float xCoordinate, float yCoordinate, HintAlignment alignment = HintAlignment.Center) + { + YCoordinate = yCoordinate; + XCoordinate = xCoordinate; + HintAlignment = alignment; + } + + } +} diff --git a/KruacentExiled/utils-merged/KE.Utilsge/API/Interfaces/IEvents.cs b/KruacentExiled/utils-merged/KE.Utilsge/API/Interfaces/IEvents.cs new file mode 100644 index 00000000..e573b062 --- /dev/null +++ b/KruacentExiled/utils-merged/KE.Utilsge/API/Interfaces/IEvents.cs @@ -0,0 +1,17 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace KE.Utils.API.Interfaces +{ + public interface IUsingEvents + { + + + public void SubscribeEvents(); + + public void UnsubscribeEvents(); + } +} diff --git a/KruacentExiled/utils-merged/KE.Utilsge/API/ReflectionHelper.cs b/KruacentExiled/utils-merged/KE.Utilsge/API/ReflectionHelper.cs new file mode 100644 index 00000000..2f00fbb1 --- /dev/null +++ b/KruacentExiled/utils-merged/KE.Utilsge/API/ReflectionHelper.cs @@ -0,0 +1,47 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Reflection; +using System.Text; +using System.Threading.Tasks; + +namespace KE.Utils.API +{ + public static class ReflectionHelper + { + public static IEnumerable GetObjects(Assembly assembly = null) + { + List result = new(); + if (assembly == null) + { + assembly = Assembly.GetCallingAssembly(); + } + foreach (Type t in assembly.GetTypes()) + { + try + { + if (typeof(T).IsAssignableFrom(t) && !t.IsAbstract) + { + T ffcc = (T)Activator.CreateInstance(t); + result.Add(ffcc); + } + } + catch (Exception) + { + + } + } + return result; + } + + public static IEnumerable GetObjects(IEnumerable assemblies) + { + List result = new(); + foreach(Assembly assembly in assemblies) + { + result.AddRange(GetObjects(assembly)); + } + return result; + } + } +} diff --git a/KruacentExiled/utils-merged/KE.Utilsge/API/Sounds/SoundPlayer.cs b/KruacentExiled/utils-merged/KE.Utilsge/API/Sounds/SoundPlayer.cs new file mode 100644 index 00000000..919d911c --- /dev/null +++ b/KruacentExiled/utils-merged/KE.Utilsge/API/Sounds/SoundPlayer.cs @@ -0,0 +1,115 @@ +using Exiled.API.Features; +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using UnityEngine; + +namespace KE.Utils.API.Sounds +{ + public class SoundPlayer + { + private static SoundPlayer _instance; + + public static SoundPlayer Instance + { + get + { + if(_instance == null) + { + _instance = new(); + } + return _instance; + } + } + + private SoundPlayer() { } + + private bool _loaded = false; + public bool Loaded => _loaded; + + public static readonly HashSet clips = new(); + + public static string SoundLocation => Paths.Configs + "/Sounds"; + public static void Load() => Instance.TryLoad(); + public void TryLoad() + { + if (Loaded) + { + return; + } + + if (!Directory.Exists(SoundLocation)) + { + Log.Warn("Directory not found. creating..."); + Directory.CreateDirectory(SoundLocation); + } + + string[] rawfile = Directory.GetFiles(SoundLocation, "*.ogg"); + + foreach (string file in rawfile) + { + string noExFile = Path.GetFileNameWithoutExtension(file); + Log.Info($"loading {file} as {noExFile}"); + clips.Add(noExFile); + AudioClipStorage.LoadClip(file); + } + _loaded = true; + } + + + /// + /// Play a clip at a static point + /// + /// + /// + /// + /// + public AudioClipPlayback Play(string clipName, Vector3 pos, float volume = 50f, float maxDistance = 20f, bool isSpatial = true) + { + if (!Loaded) throw new Exception("clips not loaded use SoundPlayer.Load()"); + Log.Debug($"playing {clipName} at {pos}"); + + var audioPlayer = AudioPlayer.CreateOrGet($"{clipName} ({pos})", onIntialCreation: (p) => + { + GameObject a = new GameObject(); + a.transform.position = pos; + p.transform.parent = a.transform; + Speaker speaker = p.AddSpeaker("main", isSpatial: isSpatial, maxDistance: maxDistance, minDistance: 1f); + speaker.transform.parent = a.transform; + speaker.transform.localPosition = Vector3.zero; + }); + + audioPlayer.DestroyWhenAllClipsPlayed = true; + return audioPlayer.AddClip(clipName, volume: volume); + + + } + + /// + /// Play a clip at a + /// + /// + /// + /// + /// + public void Play(string clipName, GameObject objectEmittingSound, float volume = 50f, float maxDistance = 20f, bool isSpatial = true) + { + if (!Loaded) throw new Exception("clips not loaded use SoundPlayer.Instance.Load()"); + Log.Debug($"playing {clipName} at {objectEmittingSound}"); + + var audioPlayer = AudioPlayer.CreateOrGet($"{clipName} ({objectEmittingSound})", onIntialCreation: (p) => + { + + p.transform.parent = objectEmittingSound.transform; + Speaker speaker = p.AddSpeaker("main", isSpatial: isSpatial, maxDistance: maxDistance, minDistance: 1f); + speaker.transform.parent = objectEmittingSound.transform; + speaker.transform.localPosition = Vector3.zero; + }); + audioPlayer.AddClip(clipName, volume: volume); + audioPlayer.DestroyWhenAllClipsPlayed = true; + } + } +} diff --git a/KruacentExiled/utils-merged/KE.Utilsge/Extensions/AdminToyExtension.cs b/KruacentExiled/utils-merged/KE.Utilsge/Extensions/AdminToyExtension.cs new file mode 100644 index 00000000..37c3706d --- /dev/null +++ b/KruacentExiled/utils-merged/KE.Utilsge/Extensions/AdminToyExtension.cs @@ -0,0 +1,25 @@ +using Exiled.API.Features.Toys; +using KE.Utils.Quality; +using KE.Utils.Quality.Enums; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace KE.Utils.Extensions +{ + public static class AdminToyExtension + { + + public static void SetAsPickupAdminToy(this AdminToy toy, bool autoSync = true) + { + QualityHandler.Instance.QualityToysHandler.SetAsPickup(toy); + } + + public static void SetQuality(this AdminToy toy, ModelQuality modelQuality,bool autoSync = true) + { + QualityHandler.Instance.QualityToysHandler.SetQuality(toy, modelQuality); + } + } +} diff --git a/KruacentExiled/utils-merged/KE.Utilsge/Extensions/PlayerExtension.cs b/KruacentExiled/utils-merged/KE.Utilsge/Extensions/PlayerExtension.cs new file mode 100644 index 00000000..b01f98d2 --- /dev/null +++ b/KruacentExiled/utils-merged/KE.Utilsge/Extensions/PlayerExtension.cs @@ -0,0 +1,52 @@ +using CustomPlayerEffects; +using Exiled.API.Enums; +using Exiled.API.Features; +using Mirror; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using UnityEngine; + +namespace KE.Utils.Extensions +{ + public static class PlayerExtension + { + public static void SetFakeInvis(this Player p, IEnumerable viewers) + { + Vector3 pos = p.Position; + + try + { + p.ReferenceHub.transform.localPosition = Vector3.zero; + foreach (Player viewer in viewers) + { + Server.SendSpawnMessage.Invoke(null, new object[2] { viewer.NetworkIdentity, viewer.Connection }); + } + + p.ReferenceHub.transform.localPosition = pos; + } + catch (Exception arg) + { + Log.Error(string.Format("{0}: {1}", "SetFakeInvis", arg)); + } + } + + + + + public static void AddLevelEffect(this Player p,EffectType type, int intensity) + { + + + if (!p.TryGetEffect(type, out var effect)) + p.ChangeEffectIntensity(type, (byte)(effect.Intensity + intensity)); + else + p.EnableEffect(type, (byte)intensity); + } + + + + } +} diff --git a/KruacentExiled/utils-merged/KE.Utilsge/Extensions/RoomExtension.cs b/KruacentExiled/utils-merged/KE.Utilsge/Extensions/RoomExtension.cs new file mode 100644 index 00000000..35fee2e8 --- /dev/null +++ b/KruacentExiled/utils-merged/KE.Utilsge/Extensions/RoomExtension.cs @@ -0,0 +1,12 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace KE.Utils.Extensions +{ + internal class RoomExtension + { + } +} diff --git a/KruacentExiled/utils-merged/KE.Utilsge/KE.Utils.csproj b/KruacentExiled/utils-merged/KE.Utilsge/KE.Utils.csproj new file mode 100644 index 00000000..e65e4856 --- /dev/null +++ b/KruacentExiled/utils-merged/KE.Utilsge/KE.Utils.csproj @@ -0,0 +1,31 @@ + + + + 13.0 + net48 + + + + + + + + + + + + + + + + + + + if not "$(EXILED_DEV_REFERENCES)"=="" copy /y "$(OutputPath)$(AssemblyName).dll" "$(EXILED_DEV_REFERENCES)\Plugins\" + + + if [[ ! -z "$EXILED_DEV_REFERENCES" ]]; then cp "$(OutputPath)$(AssemblyName).dll" "$EXILED_DEV_REFERENCES/Plugins/"; fi + + + + diff --git a/KruacentExiled/utils-merged/KE.Utilsge/Quality/Enums/ModelQuality.cs b/KruacentExiled/utils-merged/KE.Utilsge/Quality/Enums/ModelQuality.cs new file mode 100644 index 00000000..d9d8d295 --- /dev/null +++ b/KruacentExiled/utils-merged/KE.Utilsge/Quality/Enums/ModelQuality.cs @@ -0,0 +1,16 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace KE.Utils.Quality.Enums +{ + public enum ModelQuality + { + None = -1, + Low, + Medium, + High, + } +} diff --git a/KruacentExiled/utils-merged/KE.Utilsge/Quality/Handlers/QualityToysHandler.cs b/KruacentExiled/utils-merged/KE.Utilsge/Quality/Handlers/QualityToysHandler.cs new file mode 100644 index 00000000..b2485795 --- /dev/null +++ b/KruacentExiled/utils-merged/KE.Utilsge/Quality/Handlers/QualityToysHandler.cs @@ -0,0 +1,179 @@ +using AdminToys; +using Exiled.API.Enums; +using Exiled.API.Extensions; +using Exiled.API.Features; +using Exiled.API.Features.Toys; +using KE.Utils.Quality.Enums; +using KE.Utils.Quality.Settings; +using MEC; +using System; +using System.Collections.Generic; +using System.Linq; +using UnityEngine; +using Light = Exiled.API.Features.Toys.Light; +using QualitySettings = KE.Utils.Quality.Settings.QualitySettings; + +namespace KE.Utils.Quality.Handlers +{ + public class QualityToysHandler + { + private HashSet _pickupToys = new(); + private Dictionary _qualityToys = new(); + public readonly Vector3 Gulag = new Vector3(15000, 15000, 15000); + public const float Delay = Timing.WaitForOneFrame; + public bool IsPickupToy(AdminToy primitive) + { + return _pickupToys.Contains(primitive); + } + + public bool IsQualityToy(AdminToy primitive) + { + return _qualityToys.ContainsKey(primitive); + } + + + public void SetAsPickup(AdminToy toy, bool autoSync = true) + { + if (!_pickupToys.Add(toy)) + { + Log.Warn($"AdminToy {toy} is already a pickupToy"); + return; + } + if (autoSync) + Sync(toy); + } + + public void SetQuality(AdminToy toy, ModelQuality quality, bool autoSync = true) + { + if (toy == null) return; + if (!_qualityToys.ContainsKey(toy)) + _qualityToys.Add(toy, quality); + else + _qualityToys[toy] = quality; + + if (autoSync) + Sync(toy); + } + + + + private void SendToFakePosition(AdminToy adminToy, Player player,Vector3 position) + { + //idk why but without delay it show all of the quality at once + Timing.CallDelayed(Delay, () => + { + if (adminToy is Light l) + { + player.SendFakeSyncVar(l.Base.netIdentity, typeof(LightSourceToy), nameof(LightSourceToy.NetworkPosition), position); + return; + } + if (adminToy is Primitive p) + { + player.SendFakeSyncVar(p.Base.netIdentity, typeof(PrimitiveObjectToy), nameof(PrimitiveObjectToy.NetworkPosition), position); + return; + } + }); + + } + + /// + /// Sync every Players + /// + public void Sync() + { + foreach (Player p in Player.List) + { + Sync(p); + } + } + + /// + /// Sync a specified Player + /// + /// + public void Sync(Player p) + { + + + + var quality = QualitySettings.Get(p); + var pickup = QualitySettings.PickmodelActivated(p); + + HashSet pickupToRemove = []; + HashSet qualityToRemove = []; + + //hide pickup toys + + foreach (AdminToy pk in _pickupToys) + { + try + { + if (pickup) + { + SendToFakePosition(pk, p, pk.Position); + } + else + { + SendToFakePosition(pk, p, Gulag); + } + } + catch (NullReferenceException) + { + //Log.Warn("removing pickup"); + pickupToRemove.Add(pk); + } + + } + + _pickupToys.RemoveWhere(p => pickupToRemove.Contains(p)); + + + foreach (var at in _qualityToys) + { + try + { + if ((at.Value == quality || at.Value == ModelQuality.None) && (pickup || !_pickupToys.Contains(at.Key))) + { + SendToFakePosition(at.Key, p, at.Key.Position); + } + else + { + SendToFakePosition(at.Key, p, Gulag); + } + } + catch (NullReferenceException) + { + //Log.Warn("removing quality" + _qualityToys.Count); + qualityToRemove.Add(at.Key); + } + + + } + foreach(var at in qualityToRemove) + { + + _qualityToys.Remove(at); + } + + } + + /// + /// Sync a specified AdminToy + /// + /// + public void Sync(AdminToy adminToy) + { + //temporary fix + Sync(); + + if (IsPickupToy(adminToy)) + { + + } + if (IsQualityToy(adminToy)) + { + + } + } + } +} diff --git a/KruacentExiled/utils-merged/KE.Utilsge/Quality/Models/Base/BaseModel.cs b/KruacentExiled/utils-merged/KE.Utilsge/Quality/Models/Base/BaseModel.cs new file mode 100644 index 00000000..c9f6723c --- /dev/null +++ b/KruacentExiled/utils-merged/KE.Utilsge/Quality/Models/Base/BaseModel.cs @@ -0,0 +1,41 @@ +using Exiled.API.Enums; +using Exiled.API.Extensions; +using Exiled.API.Features.Toys; +using Exiled.API.Interfaces; +using KE.Utils.Quality.Structs; +using PlayerStatsSystem; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using UnityEngine; +using Light = Exiled.API.Features.Toys.Light; + +namespace KE.Utils.Quality.Models.Base +{ + + /// + /// The blocks to build a model with + /// + public abstract class BaseModel : ICloneable + { + + protected AdminToy _toy; + public AdminToy AdminToy { get { return _toy; } } + private Vector3 _position; + public Vector3 LocalPosition { get { return _position; } } + private Quaternion _rotation; + public Quaternion LocalRotation { get { return _rotation; } } + + + public BaseModel(Vector3 localPositon, Quaternion localRotation) + { + _position = localPositon; + _rotation = localRotation; + } + + public abstract object Clone(); + } + +} diff --git a/KruacentExiled/utils-merged/KE.Utilsge/Quality/Models/Base/LightModel.cs b/KruacentExiled/utils-merged/KE.Utilsge/Quality/Models/Base/LightModel.cs new file mode 100644 index 00000000..ce808da1 --- /dev/null +++ b/KruacentExiled/utils-merged/KE.Utilsge/Quality/Models/Base/LightModel.cs @@ -0,0 +1,26 @@ +using Exiled.API.Features.Toys; +using UnityEngine; +using Light = Exiled.API.Features.Toys.Light; + +namespace KE.Utils.Quality.Models.Base +{ + public class LightModel : BaseModel + { + + /// + /// Create a new Light for modeling + /// + public LightModel(Vector3? scale, Color? color, Vector3 localPositon, Quaternion localRotation) : base(localPositon, localRotation) + { + Light light = Light.Create(null, null, scale, false, color); + _toy = light; + } + + + public override object Clone() + { + Light light = _toy as Light; + return new LightModel(light.Scale, light.Color, LocalPosition, LocalRotation); + } + } +} diff --git a/KruacentExiled/utils-merged/KE.Utilsge/Quality/Models/Base/PrimitiveModel.cs b/KruacentExiled/utils-merged/KE.Utilsge/Quality/Models/Base/PrimitiveModel.cs new file mode 100644 index 00000000..22e07225 --- /dev/null +++ b/KruacentExiled/utils-merged/KE.Utilsge/Quality/Models/Base/PrimitiveModel.cs @@ -0,0 +1,26 @@ +using Exiled.API.Features.Toys; +using UnityEngine; +using Color = UnityEngine.Color; + +namespace KE.Utils.Quality.Models.Base +{ + public class PrimitiveModel : BaseModel + { + /// + /// Create a new Primitive for modeling + /// + public PrimitiveModel(PrimitiveType type, Vector3? scale, Color? color,Vector3 localPosition,Quaternion localRotation) : base(localPosition, localRotation) + { + + Primitive prim = Primitive.Create(type, null, null, scale, false, color); + prim.Collidable = false; + _toy = prim; + } + + public override object Clone() + { + Primitive prim = _toy as Primitive; + return new PrimitiveModel(prim.Type, prim.Scale, prim.Color, LocalPosition, LocalRotation); + } + } +} diff --git a/KruacentExiled/utils-merged/KE.Utilsge/Quality/Models/Examples/MineModel.cs b/KruacentExiled/utils-merged/KE.Utilsge/Quality/Models/Examples/MineModel.cs new file mode 100644 index 00000000..00d60fec --- /dev/null +++ b/KruacentExiled/utils-merged/KE.Utilsge/Quality/Models/Examples/MineModel.cs @@ -0,0 +1,118 @@ +using KE.Utils.Quality.Enums; +using KE.Utils.Quality.Models.Base; +using System.Collections.Generic; +using UnityEngine; +using Light = Exiled.API.Features.Toys.Light; + +namespace KE.Utils.Quality.Models.Examples +{ + public abstract class MineModel : QualityModel + { + protected Light _light; + private bool _lightOn = false; + + + + + public void ToggleLight() + { + if (_light == null) throw new System.Exception("no light"); + if (_lightOn) + _light.UnSpawn(); + else + _light.Spawn(); + _lightOn = !_lightOn; + } + + } + + public class MineModelLow : MineModel + { + public override bool IsPickup => false; + public override ModelQuality Quality => ModelQuality.Low; + + protected override IEnumerable GetBaseModels() + { + Quaternion baseRotation = new(); + //spawn + offset + Vector3 offset = new Vector3(0, .05f); + Vector3 sizeDisk = new Vector3(.7f, 0.1f, .7f); + + Vector3 sizeGlobe = new Vector3(.1f, .1f, .1f); + Vector3 posLight = new Vector3(0, sizeDisk.y+sizeGlobe.y); + + + var baseMine = new PrimitiveModel(PrimitiveType.Cylinder, sizeDisk, Color.black, offset, baseRotation); + + var lightGlobe = new PrimitiveModel(PrimitiveType.Sphere, sizeGlobe , new Color(1, 0, 0, .33f), posLight, baseRotation); + + var lightMine = new LightModel(null, Color.red, posLight, baseRotation); + + _light = lightMine.AdminToy as Light; + _light.Intensity = .55f; + + return [baseMine, lightGlobe, lightMine]; + } + + + } + + public class MineModelMedium : MineModel + { + public override bool IsPickup => false; + public override ModelQuality Quality => ModelQuality.Medium; + + protected override IEnumerable GetBaseModels() + { + Quaternion baseRotation = new(); + //spawn + offset + Vector3 offset = new Vector3(0, .05f); + Vector3 sizeDisk = new Vector3(.7f, 0.1f, .7f); + + Vector3 sizeGlobe = new Vector3(.1f, .1f, .1f); + Vector3 posLight = new Vector3(0, sizeDisk.y + sizeGlobe.y); + + + var baseMine = new PrimitiveModel(PrimitiveType.Cylinder, sizeDisk, Color.black, offset, baseRotation); + + var lightGlobe = new PrimitiveModel(PrimitiveType.Sphere, sizeGlobe, new Color(1, 0, 0, .33f), posLight, baseRotation); + + var lightMine = new LightModel(null, Color.green, posLight, baseRotation); + + _light = lightMine.AdminToy as Light; + _light.Intensity = .55f; + + return [baseMine, lightGlobe, lightMine]; + } + } + + public class MineModelPickup : MineModel + { + public override bool IsPickup => true; + public override ModelQuality Quality => ModelQuality.None; + + + protected override IEnumerable GetBaseModels() + { + Quaternion baseRotation = new(); + //spawn + offset + Vector3 offset = new Vector3(0, .05f); + Vector3 sizeDisk = new Vector3(.7f, 0.1f, .7f); + + Vector3 sizeGlobe = new Vector3(.1f, .1f, .1f); + Vector3 posLight = new Vector3(0, sizeDisk.y + sizeGlobe.y); + + + var baseMine = new PrimitiveModel(PrimitiveType.Cylinder, sizeDisk, Color.black, offset, baseRotation); + + var lightGlobe = new PrimitiveModel(PrimitiveType.Sphere, sizeGlobe, new Color(1, 0, 0, .33f), posLight, baseRotation); + + var lightMine = new LightModel(null, Color.magenta, posLight, baseRotation); + + _light = lightMine.AdminToy as Light; + _light.Intensity = .55f; + + return [baseMine, lightGlobe, lightMine]; + } + } +} diff --git a/KruacentExiled/utils-merged/KE.Utilsge/Quality/Models/Model.cs b/KruacentExiled/utils-merged/KE.Utilsge/Quality/Models/Model.cs new file mode 100644 index 00000000..2e26756e --- /dev/null +++ b/KruacentExiled/utils-merged/KE.Utilsge/Quality/Models/Model.cs @@ -0,0 +1,104 @@ +using Exiled.API.Features; +using Exiled.API.Features.Toys; +using KE.Utils.Quality.Models.Base; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using UnityEngine; + +namespace KE.Utils.Quality.Models +{ + public class Model : IEquatable + { + + + private Vector3 _position; + public Vector3 Position + { + get { return _position; } + set + { + _position = value; + } + } + private Quaternion _rotation; + public Quaternion Rotation + { + get { return _rotation; } + set + { + _rotation = value; + } + } + private ModelPrefab _prefab; + public ModelPrefab Prefab + { + get { return _prefab; } + } + + + + private HashSet _models; + + internal Model(ModelPrefab prefab, Vector3 position, Quaternion rotation,IEnumerable toys,bool spawn) + { + _prefab = prefab; + Position = position; + Rotation = rotation; + _models = new HashSet(toys); + QualityHandler.Instance.QualityToysHandler.Sync(); + + foreach (BaseModel based in toys) + { + AdminToy toy = based.AdminToy; + + if (toy is Primitive p) + p.Collidable = false; + toy.AdminToyBase.transform.position = based.LocalPosition + Position; + toy.AdminToyBase.transform.rotation = based.LocalRotation * Rotation; + } + if(spawn) + { + Spawn(); + } + } + + + public void Destroy() + { + foreach (BaseModel primitive in _models) + { + primitive.AdminToy.Destroy(); + } + } + public void UnSpawn() + { + foreach (BaseModel primitive in _models) + { + primitive.AdminToy.UnSpawn(); + } + } + public void Spawn() + { + QualityHandler.Instance.QualityToysHandler.Sync(); + foreach (BaseModel primitive in _models) + { + primitive.AdminToy.Spawn(); + } + + } + + + public bool Equals(Model x) + { + if (x == null) return false; + return x._prefab == _prefab && x.Position == Position && x.Rotation == Rotation; + } + public int GetHashCode(Model obj) + { + return obj.GetHashCode(); + } + } +} diff --git a/KruacentExiled/utils-merged/KE.Utilsge/Quality/Models/ModelPrefab.cs b/KruacentExiled/utils-merged/KE.Utilsge/Quality/Models/ModelPrefab.cs new file mode 100644 index 00000000..bbc39da4 --- /dev/null +++ b/KruacentExiled/utils-merged/KE.Utilsge/Quality/Models/ModelPrefab.cs @@ -0,0 +1,42 @@ +using Exiled.API.Features; +using Exiled.API.Features.Core; +using Exiled.API.Features.Pickups; +using Exiled.API.Features.Toys; +using Exiled.API.Interfaces; +using KE.Utils.Extensions; +using KE.Utils.Quality.Models.Base; +using KE.Utils.Quality.Structs; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using UnityEngine; +using Light = Exiled.API.Features.Toys.Light; + +namespace KE.Utils.Quality.Models +{ + public abstract class ModelPrefab + { + + protected abstract IEnumerable GetBaseModels(); + + public virtual Model Create(Vector3 position,Quaternion rotation, bool spawn = true) + { + + HashSet clonetoys = new(); + HashSet toys = GetBaseModels().ToHashSet(); + foreach (BaseModel model in toys) + { + BaseModel clone = (BaseModel)model.Clone(); + clonetoys.Add(clone); + } + return new Model(this, position, rotation, clonetoys,spawn); + + } + + + + + } +} diff --git a/KruacentExiled/utils-merged/KE.Utilsge/Quality/Models/QualityModel.cs b/KruacentExiled/utils-merged/KE.Utilsge/Quality/Models/QualityModel.cs new file mode 100644 index 00000000..b5cc682f --- /dev/null +++ b/KruacentExiled/utils-merged/KE.Utilsge/Quality/Models/QualityModel.cs @@ -0,0 +1,40 @@ +using Exiled.API.Features; +using Exiled.API.Features.Toys; +using KE.Utils.Extensions; +using KE.Utils.Quality.Enums; +using KE.Utils.Quality.Models.Base; +using System.Collections.Generic; +using System.Linq; +using UnityEngine; + +namespace KE.Utils.Quality.Models +{ + public abstract class QualityModel : ModelPrefab + { + public abstract ModelQuality Quality { get; } + public abstract bool IsPickup { get; } + + + + + public override sealed Model Create(Vector3 position, Quaternion rotation,bool spawn = true) + { + + HashSet clonetoys = new(); + HashSet toys = GetBaseModels().ToHashSet(); + foreach (BaseModel model in toys) + { + BaseModel clone = (BaseModel)model.Clone(); + + if (IsPickup) + clone.AdminToy.SetAsPickupAdminToy(false); + + clone.AdminToy.SetQuality(Quality,false); + clonetoys.Add(clone); + } + QualityHandler.Sync(); + return new Model(this,position, rotation, clonetoys, spawn); + } + + } +} diff --git a/KruacentExiled/utils-merged/KE.Utilsge/Quality/QualityHandler.cs b/KruacentExiled/utils-merged/KE.Utilsge/Quality/QualityHandler.cs new file mode 100644 index 00000000..235d79c9 --- /dev/null +++ b/KruacentExiled/utils-merged/KE.Utilsge/Quality/QualityHandler.cs @@ -0,0 +1,61 @@ +using Exiled.API.Features; +using Exiled.API.Features.Core.UserSettings; +using KE.Utils.Quality.Handlers; +using KE.Utils.Quality.Settings; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace KE.Utils.Quality +{ + [Obsolete("scrapped", false)] + internal class QualityHandler + { + public QualitySettings QualitySettings { get; private set; } + public QualityToysHandler QualityToysHandler { get; private set; } + + private static QualityHandler _instance; + public static QualityHandler Instance + { + get + { + if(_instance == null ) + _instance = new QualityHandler(); + return _instance; + } + } + private QualityHandler() + { + QualitySettings = new QualitySettings(Changed); + QualityToysHandler = new QualityToysHandler(); + } + + ~QualityHandler() + { + QualityToysHandler = null; + QualitySettings = null; + } + + public void Changed(Player p, SettingBase _) + { + QualityToysHandler.Sync(p); + } + + public void Register() + { + QualitySettings.Register(); + } + + public void Unregister() + { + QualitySettings.Unregister(); + } + + public static void Sync() + { + Instance.QualityToysHandler.Sync(); + } + } +} diff --git a/KruacentExiled/utils-merged/KE.Utilsge/Quality/QualityToysHandler.cs b/KruacentExiled/utils-merged/KE.Utilsge/Quality/QualityToysHandler.cs new file mode 100644 index 00000000..27320233 --- /dev/null +++ b/KruacentExiled/utils-merged/KE.Utilsge/Quality/QualityToysHandler.cs @@ -0,0 +1,155 @@ +using AdminToys; +using Exiled.API.Enums; +using Exiled.API.Extensions; +using Exiled.API.Features; +using Exiled.API.Features.Toys; +using KE.Utils.Quality.Enums; +using KE.Utils.Quality.Settings; +using System.Collections.Generic; +using System.Linq; +using UnityEngine; +using Light = Exiled.API.Features.Toys.Light; +using QualitySettings = KE.Utils.Quality.Settings.QualitySettings; + +namespace KE.Utils.Quality +{ + public class QualityToysHandler + { + private HashSet _pickupToys = new(); + private Dictionary _qualityToys = new(); + public readonly Vector3 Gulag = new Vector3(15000,15000,15000); + + public bool IsPickupToy(AdminToy primitive) + { + return _pickupToys.Contains(primitive); + } + + public bool IsQualityToy(AdminToy primitive) + { + return _qualityToys.ContainsKey(primitive); + } + + + public void SetAsPickup(AdminToy toy) + { + if (!_pickupToys.Add(toy)) + { + Log.Warn($"AdminToy {toy} is already a pickupToy"); + return; + } + } + + public void SetQuality(AdminToy toy,ModelQuality quality) + { + if (toy == null) return; + if (!_qualityToys.ContainsKey(toy)) + _qualityToys.Add(toy,quality); + else + _qualityToys[toy] = quality; + } + + + + private void SendToShadowRealm(AdminToy adminToy, Player player) + { + if(adminToy is Light l) + { + player.SendFakeSyncVar(l.Base.netIdentity, typeof(LightSourceToy), nameof(LightSourceToy.NetworkPosition), Gulag); + return; + } + if(adminToy is Primitive p) + { + player.SendFakeSyncVar(p.Base.netIdentity, typeof(PrimitiveObjectToy), nameof(PrimitiveObjectToy.NetworkPosition), Gulag); + return; + } + } + + private void SetTruePosition(AdminToy adminToy, Player player) + { + if (adminToy is Light l) + { + player.SendFakeSyncVar(l.Base.netIdentity, typeof(LightSourceToy), nameof(LightSourceToy.NetworkPosition), l.Position); + return; + } + if (adminToy is Primitive p) + { + player.SendFakeSyncVar(p.Base.netIdentity, typeof(PrimitiveObjectToy), nameof(PrimitiveObjectToy.NetworkPosition), p.Position); + return; + } + } + + /// + /// Sync every Players + /// + public void Sync() + { + foreach(Player p in Player.List) + { + Sync(p); + } + } + + /// + /// Sync a specified Player + /// + /// + public void Sync(Player p) + { + var quality = QualitySettings.Get(p); + var pickup = QualitySettings.PickmodelActivated(p); + + if (!pickup) + { + //hide pickup toys + foreach (AdminToy pk in _pickupToys) + { + SendToShadowRealm(pk, p); + } + } + else + { + //show pickup toys + foreach (AdminToy pk in _pickupToys) + { + SetTruePosition(pk, p); + } + } + + + + + foreach(var at in _qualityToys) + { + if(at.Value == quality) + { + if (pickup || !_pickupToys.Contains(at.Key)) + { + SetTruePosition(at.Key, p); + } + } + else + { + SendToShadowRealm(at.Key, p); + } + + } + + } + + /// + /// Sync a specified AdminToy + /// + /// + public void Sync(AdminToy adminToy) + { + if (IsPickupToy(adminToy)) + { + + } + if (IsQualityToy(adminToy)) + { + + } + } + } +} diff --git a/KruacentExiled/utils-merged/KE.Utilsge/Quality/Settings/QualitySettings.cs b/KruacentExiled/utils-merged/KE.Utilsge/Quality/Settings/QualitySettings.cs new file mode 100644 index 00000000..ca8d49be --- /dev/null +++ b/KruacentExiled/utils-merged/KE.Utilsge/Quality/Settings/QualitySettings.cs @@ -0,0 +1,62 @@ +using Exiled.API.Features; +using Exiled.API.Features.Core.UserSettings; +using KE.Utils.Quality.Enums; +using System; + +namespace KE.Utils.Quality.Settings +{ + public class QualitySettings + { + + private static int _idQuality = 0; + private static int _idModels = 1; + private static int _idSlider = 2; + private SettingBase[] _settings; + public QualitySettings(Action onChanged) + { + HeaderSetting header = new("Quality Settings"); + _settings = + [ + header, + new DropdownSetting(_idQuality,"ModelQuality",["Low","Medium", "High"],onChanged:onChanged), + new TwoButtonsSetting(_idModels,"Pickup models","Disabled","Enabled", onChanged:onChanged) + ]; + } + + public void Register() + { + SettingBase.Register(_settings); + SettingBase.SendToAll(); + } + + public void Unregister() + { + SettingBase.Unregister(settings:_settings); + } + + + + + public static ModelQuality Get(Player p) + { + if (!SettingBase.TryGetSetting(p, _idQuality, out var setting)) return ModelQuality.None; + + return setting.SelectedOption switch + { + "Low" => ModelQuality.Low, + "Medium" => ModelQuality.Medium, + "High" => ModelQuality.High, + _ => ModelQuality.None, + }; + } + + + public static bool PickmodelActivated(Player p) + { + if (!SettingBase.TryGetSetting(p, _idModels, out var setting)) return false; + return setting.IsSecond; + } + + + } +} diff --git a/KruacentExiled/utils-merged/KE.Utilsge/Quality/Structs/LocalWorldSpace.cs b/KruacentExiled/utils-merged/KE.Utilsge/Quality/Structs/LocalWorldSpace.cs new file mode 100644 index 00000000..d9c6205b --- /dev/null +++ b/KruacentExiled/utils-merged/KE.Utilsge/Quality/Structs/LocalWorldSpace.cs @@ -0,0 +1,23 @@ +using Exiled.API.Interfaces; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using UnityEngine; + +namespace KE.Utils.Quality.Structs +{ + public readonly struct LocalWorldSpace : IWorldSpace + { + + public Vector3 Position { get; } + public Quaternion Rotation { get; } + + public LocalWorldSpace(Vector3 position, Quaternion rotation) + { + Position = position; + Rotation = rotation; + } + } +} diff --git a/KruacentExiled/utils-merged/KE.Utilsge/Quality/Tests/Test.cs b/KruacentExiled/utils-merged/KE.Utilsge/Quality/Tests/Test.cs new file mode 100644 index 00000000..6ebd3f66 --- /dev/null +++ b/KruacentExiled/utils-merged/KE.Utilsge/Quality/Tests/Test.cs @@ -0,0 +1,108 @@ +using Exiled.API.Extensions; +using Exiled.API.Features; +using Exiled.API.Features.Toys; +using KE.Utils.Quality.Models; +using KE.Utils.Quality.Models.Examples; +using MEC; +using PlayerRoles; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using UnityEngine; + +namespace KE.Utils.Quality.Tests +{ + public class Test + { + private QualityHandler QualityHandler; + + + private Test(QualityHandler q) + { + QualityHandler = q; + try + { + TestMine(); + } + catch (Exception ex) + { + Log.Error("Exception for TestMine :\n"+ex); + } + + } + internal void TestQuality() + { + Vector3 pos = RoleTypeId.Scp049.GetRandomSpawnLocation().Position; + Primitive c = Primitive.Create(pos); + c.Color = Color.red; + Primitive c2 = Primitive.Create(pos + Vector3.one); + c2.Color = Color.green; + + + QualityHandler.QualityToysHandler.SetQuality(c, Enums.ModelQuality.Low); + QualityHandler.QualityToysHandler.SetQuality(c2, Enums.ModelQuality.Medium); + } + + internal void StressTest(int count) + { + Timing.RunCoroutine(Stress(count)); + } + + + private IEnumerator Stress(int count) + { + Vector3 pos = RoleTypeId.Scp049.GetRandomSpawnLocation().Position; + Vector3 scale = new Vector3(.1f, .1f, .1f); + float maxSpread = 5; + for (int i = 0; i < count; i++) + { + Primitive c = Primitive.Create(pos + new Vector3(UnityEngine.Random.Range(0f, maxSpread), UnityEngine.Random.Range(0f, maxSpread), UnityEngine.Random.Range(0f, maxSpread)), scale: scale); + QualityHandler.QualityToysHandler.SetQuality(c, Enums.ModelQuality.Medium); + } + QualityHandler.QualityToysHandler.Sync(); + yield return 0; + } + + public void TestMine() + { + Log.Info("TestMine"); + Vector3 pos = RoleTypeId.Scp049.GetRandomSpawnLocation().Position; + MineModelLow mml = new(); + + + Model m = mml.Create(pos, new Quaternion()); + m.Spawn(); + + + MineModelMedium mmm = new(); + + m = mmm.Create(pos + Vector3.up, new Quaternion()); + m.Spawn(); + + + MineModelPickup mmp = new(); + m = mmp.Create(pos + Vector3.right, new Quaternion()); + m.Spawn(); + + QualityHandler.Sync(); + + + + + + + + + foreach (var item in Player.List) + { + item.Teleport(pos); + } + + + + + } + } +} diff --git a/KruacentExiled/utils-merged/KE.Utilsmap/API/Displays/DisplayMeow/DisplayHandler.cs b/KruacentExiled/utils-merged/KE.Utilsmap/API/Displays/DisplayMeow/DisplayHandler.cs new file mode 100644 index 00000000..4ee13535 --- /dev/null +++ b/KruacentExiled/utils-merged/KE.Utilsmap/API/Displays/DisplayMeow/DisplayHandler.cs @@ -0,0 +1,67 @@ +using Exiled.API.Features; +using HintServiceMeow.Core.Extension; +using HintServiceMeow.Core.Models.Hints; +using HintServiceMeow.Core.Utilities; +using MEC; + + +//damn why the same name +using MHint = HintServiceMeow.Core.Models.Hints.Hint; + +namespace KE.Utils.API.Displays.DisplayMeow +{ + public class DisplayHandler + { + public static DisplayHandler Instance { get; } = new(); + + private DisplayHandler() { } + + + + + + + public MHint AddHint(HintPlacement hintPlacement, Player player, string text, float delay) + { + var dis = PlayerDisplay.Get(player); + string id = $"{player.Id}_{hintPlacement.XCoordinate}_{hintPlacement.YCoordinate}"; + MHint hint; + + if (!dis.TryGetHint(id, out var aHint)) + { + hint = new() + { + Text = text, + XCoordinate = hintPlacement.XCoordinate, + YCoordinate = hintPlacement.YCoordinate, + Alignment = hintPlacement.HintAlignment, + Id = id + + }; + dis.AddHint(hint); + + } + else + { + + hint = (MHint)aHint; + hint.Hide = false; + hint.Text = text; + } + + + hint.HideAfter(delay); + return hint; + } + + + + + + + + + + + } +} diff --git a/KruacentExiled/utils-merged/KE.Utilsmap/API/Displays/DisplayMeow/HintPlacement.cs b/KruacentExiled/utils-merged/KE.Utilsmap/API/Displays/DisplayMeow/HintPlacement.cs new file mode 100644 index 00000000..936cdbe9 --- /dev/null +++ b/KruacentExiled/utils-merged/KE.Utilsmap/API/Displays/DisplayMeow/HintPlacement.cs @@ -0,0 +1,31 @@ +using HintServiceMeow.Core.Enum; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace KE.Utils.API.Displays.DisplayMeow +{ + public readonly struct HintPlacement : IEquatable + { + public float YCoordinate { get; } + public float XCoordinate { get; } + public HintAlignment HintAlignment { get; } = HintAlignment.Center; + + + public bool Equals(HintPlacement obj) + { + return YCoordinate == obj.YCoordinate && XCoordinate == obj.XCoordinate; + } + + + public HintPlacement(float xCoordinate, float yCoordinate, HintAlignment alignment = HintAlignment.Center) + { + YCoordinate = yCoordinate; + XCoordinate = xCoordinate; + HintAlignment = alignment; + } + + } +} diff --git a/KruacentExiled/utils-merged/KE.Utilsmap/API/GifAnimator/RenderGif.cs b/KruacentExiled/utils-merged/KE.Utilsmap/API/GifAnimator/RenderGif.cs new file mode 100644 index 00000000..f4276d33 --- /dev/null +++ b/KruacentExiled/utils-merged/KE.Utilsmap/API/GifAnimator/RenderGif.cs @@ -0,0 +1,128 @@ +using System.Collections.Generic; +using System.Drawing; +using System.Drawing.Imaging; +using System.IO; +using Exiled.API.Features; +using Exiled.API.Features.Toys; +using MEC; +using UnityEngine; +using UnityEngine.Rendering; +using Color = UnityEngine.Color; +namespace KE.Utils.API.GifAnimator +{ + internal class RenderGif + { + + public static void Spawn() + { + + } + + + + private static IEnumerator RenderImageCoroutine(object target, string filePath, float maxWidth, float maxHeight, float distance, float duration, int targetWidth, int targetHeight) + { + if (!File.Exists(filePath)) + { + Log.Debug($"No image was found under: {filePath}"); + yield break; + } + + byte[] imageData = File.ReadAllBytes(filePath); + + + + + + + Texture2D original = new Texture2D(2, 2); + + + try + { + original.LoadRawTextureData(imageData); + } + catch(UnityException) + { + Log.Debug("Image couldnt be loaded."); + yield break; + } + + Texture2D scaled = new Texture2D(targetWidth, targetHeight, TextureFormat.RGBA32, false); + + for (int x = 0; x < targetWidth; x++) + { + for (int y = 0; y < targetHeight; y++) + { + float u = x / (float)targetWidth; + float v = y / (float)targetHeight; + Color color = original.GetPixelBilinear(u, v); + scaled.SetPixel(x, y, color); + } + } + scaled.Apply(); + + float pixelScaleX = maxWidth / targetWidth; + float pixelScaleY = maxHeight / targetHeight; + float scale = Mathf.Min(pixelScaleX, pixelScaleY); + + Vector3 forwardOrigin; + Quaternion rotation = Quaternion.identity; + + if (target is Exiled.API.Features.Player player) + { + forwardOrigin = player.CameraTransform.position + player.CameraTransform.forward * distance; + + Vector3 directionToPlayer = forwardOrigin - player.CameraTransform.position; + directionToPlayer.y = 0; + rotation = Quaternion.LookRotation(directionToPlayer); + } + else if (target is Vector3 position) + { + forwardOrigin = position + Vector3.forward * distance; + Vector3 directionToPosition = forwardOrigin - position; + directionToPosition.y = 0; + rotation = Quaternion.LookRotation(directionToPosition); + } + else if (target is Room room) + { + forwardOrigin = room.Position + Vector3.up * 2f; + Vector3 directionToRoom = forwardOrigin - room.Position; + directionToRoom.y = 0; + rotation = Quaternion.LookRotation(directionToRoom); + } + else + { + Log.Debug("Invalid object type. Valid types: Player, Vector3, Room"); + yield break; + } + + Vector3 offset = new Vector3((targetWidth * scale) / 2f, (targetHeight * scale) / 2f, 0); + + for (int x = 0; x < targetWidth; x++) + { + for (int y = 0; y < targetHeight; y++) + { + Color pixelColor = scaled.GetPixel(x, y); + if (pixelColor.a < 0.1f) + continue; + + Vector3 localOffset = new Vector3(x * scale, y * scale, 0) - offset; + Vector3 worldPos = forwardOrigin + rotation * localOffset; + + Primitive quad = Primitive.Create(PrimitiveType.Quad); + quad.Position = worldPos; + quad.Scale = new Vector3(scale, scale, scale * 0.01f); + quad.Color = pixelColor; + + Quaternion fixedRotation = Quaternion.Euler(0f, rotation.eulerAngles.y, 0f); + quad.Rotation = fixedRotation; + quad.Flags = AdminToys.PrimitiveFlags.Visible; + } + + yield return Timing.WaitForOneFrame; + } + } + + } +} diff --git a/KruacentExiled/utils-merged/KE.Utilsmap/API/Interfaces/IEvents.cs b/KruacentExiled/utils-merged/KE.Utilsmap/API/Interfaces/IEvents.cs new file mode 100644 index 00000000..e573b062 --- /dev/null +++ b/KruacentExiled/utils-merged/KE.Utilsmap/API/Interfaces/IEvents.cs @@ -0,0 +1,17 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace KE.Utils.API.Interfaces +{ + public interface IUsingEvents + { + + + public void SubscribeEvents(); + + public void UnsubscribeEvents(); + } +} diff --git a/KruacentExiled/utils-merged/KE.Utilsmap/API/Interfaces/ILoadable.cs b/KruacentExiled/utils-merged/KE.Utilsmap/API/Interfaces/ILoadable.cs new file mode 100644 index 00000000..c9e00399 --- /dev/null +++ b/KruacentExiled/utils-merged/KE.Utilsmap/API/Interfaces/ILoadable.cs @@ -0,0 +1,13 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace KE.Utils.API.Interfaces +{ + public interface ILoadable + { + public string Loadable(char separator); + } +} diff --git a/KruacentExiled/utils-merged/KE.Utilsmap/API/Models/Arrows/Arrow.cs b/KruacentExiled/utils-merged/KE.Utilsmap/API/Models/Arrows/Arrow.cs new file mode 100644 index 00000000..990999c7 --- /dev/null +++ b/KruacentExiled/utils-merged/KE.Utilsmap/API/Models/Arrows/Arrow.cs @@ -0,0 +1,58 @@ +using Exiled.API.Features.Toys; +using InventorySystem.Items.Keycards; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Net.Sockets; +using System.Text; +using System.Threading.Tasks; +using UnityEngine; + +namespace KE.Utils.API.Models.Arrows +{ + internal abstract class Arrow + { + internal static HashSet List = new(); + internal abstract Vector3 Offset { get; } + internal abstract Vector3 Rotation { get; } + internal abstract Color Color { get; } + + protected readonly Vector3 scale = new Vector3(1f, .1f, .1f); + + private Primitive _primitive; + + internal Primitive Primitive + { + get { return _primitive; } + } + internal Arrow() + { + List.Add(this); + _primitive = Primitive.Create(PrimitiveType.Cube, null, Rotation, scale); + _primitive.Color = Color; + } + + internal void Move(Vector3 newPos) + { + _primitive.Position = newPos + Offset; + } + + internal static bool IsPrimitiveArrow(Primitive p) + { + Arrow a =GetArrow(p); + return a != null; + } + + internal static Arrow GetArrow(Primitive p) + { + + foreach(Arrow a in List) + { + if (p == a.Primitive) + return a; + } + return null; + + } + } +} diff --git a/KruacentExiled/utils-merged/KE.Utilsmap/API/Models/Arrows/MoveArrow.cs b/KruacentExiled/utils-merged/KE.Utilsmap/API/Models/Arrows/MoveArrow.cs new file mode 100644 index 00000000..f3216e7f --- /dev/null +++ b/KruacentExiled/utils-merged/KE.Utilsmap/API/Models/Arrows/MoveArrow.cs @@ -0,0 +1,12 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace KE.Utils.API.Models.Arrows +{ + internal class MoveArrow + { + } +} diff --git a/KruacentExiled/utils-merged/KE.Utilsmap/API/Models/Arrows/RotateArrow.cs b/KruacentExiled/utils-merged/KE.Utilsmap/API/Models/Arrows/RotateArrow.cs new file mode 100644 index 00000000..518fb4b5 --- /dev/null +++ b/KruacentExiled/utils-merged/KE.Utilsmap/API/Models/Arrows/RotateArrow.cs @@ -0,0 +1,12 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace KE.Utils.API.Models.Arrows +{ + internal class RotateArrow + { + } +} diff --git a/KruacentExiled/utils-merged/KE.Utilsmap/API/Models/Arrows/ScaleArrow.cs b/KruacentExiled/utils-merged/KE.Utilsmap/API/Models/Arrows/ScaleArrow.cs new file mode 100644 index 00000000..99bf7d55 --- /dev/null +++ b/KruacentExiled/utils-merged/KE.Utilsmap/API/Models/Arrows/ScaleArrow.cs @@ -0,0 +1,12 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace KE.Utils.API.Models.Arrows +{ + internal class ScaleArrow + { + } +} diff --git a/KruacentExiled/utils-merged/KE.Utilsmap/API/Models/Arrows/XArrow.cs b/KruacentExiled/utils-merged/KE.Utilsmap/API/Models/Arrows/XArrow.cs new file mode 100644 index 00000000..073802c3 --- /dev/null +++ b/KruacentExiled/utils-merged/KE.Utilsmap/API/Models/Arrows/XArrow.cs @@ -0,0 +1,16 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using UnityEngine; + +namespace KE.Utils.API.Models.Arrows +{ + internal class XArrow : Arrow + { + internal override Vector3 Offset => new Vector3(scale.x / 2,0); + internal override Vector3 Rotation => new Vector3(0, 0f, 0f); + internal override Color Color => Color.red; + } +} diff --git a/KruacentExiled/utils-merged/KE.Utilsmap/API/Models/Arrows/YArrow.cs b/KruacentExiled/utils-merged/KE.Utilsmap/API/Models/Arrows/YArrow.cs new file mode 100644 index 00000000..e437766e --- /dev/null +++ b/KruacentExiled/utils-merged/KE.Utilsmap/API/Models/Arrows/YArrow.cs @@ -0,0 +1,16 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using UnityEngine; + +namespace KE.Utils.API.Models.Arrows +{ + internal class YArrow : Arrow + { + internal override Vector3 Offset => new Vector3(0, scale.x / 2); + internal override Vector3 Rotation => new Vector3(0, 0f, 90f); + internal override Color Color => Color.green; + } +} diff --git a/KruacentExiled/utils-merged/KE.Utilsmap/API/Models/Arrows/ZArrow.cs b/KruacentExiled/utils-merged/KE.Utilsmap/API/Models/Arrows/ZArrow.cs new file mode 100644 index 00000000..30c27866 --- /dev/null +++ b/KruacentExiled/utils-merged/KE.Utilsmap/API/Models/Arrows/ZArrow.cs @@ -0,0 +1,16 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using UnityEngine; + +namespace KE.Utils.API.Models.Arrows +{ + internal class ZArrow : Arrow + { + internal override Vector3 Offset => new Vector3(0,0, scale.x / 2); + internal override Vector3 Rotation => new Vector3(0, 90f, 0); + internal override Color Color => Color.blue; + } +} diff --git a/KruacentExiled/utils-merged/KE.Utilsmap/API/Models/Blueprints/AdminToyBlueprint.cs b/KruacentExiled/utils-merged/KE.Utilsmap/API/Models/Blueprints/AdminToyBlueprint.cs new file mode 100644 index 00000000..ccfcff3d --- /dev/null +++ b/KruacentExiled/utils-merged/KE.Utilsmap/API/Models/Blueprints/AdminToyBlueprint.cs @@ -0,0 +1,69 @@ +using Exiled.API.Enums; +using Exiled.API.Features.Toys; +using Exiled.API.Interfaces; +using KE.Utils.API.Interfaces; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using UnityEngine; +using Light = Exiled.API.Features.Toys.Light; + +namespace KE.Utils.API.Models.Blueprints +{ + public abstract class AdminToyBlueprint : ILoadable + { + public AdminToyType AdminToyType { get; protected set; } + //local position + public Vector3 Position { get; protected set; } + public Vector3 Rotation { get; protected set; } + public Vector3 Scale { get; protected set; } + + + public static AdminToyBlueprint Create(AdminToy adminToy, Vector3? center = null) + { + AdminToyBlueprint result; + + + if (adminToy.ToyType == AdminToyType.PrimitiveObject) + { + result = new PrimitiveBlueprint(adminToy as Primitive); + + } + else if(adminToy.ToyType == AdminToyType.LightSource) + { + result = new LightBlueprint(adminToy as Light); + } + else + { + throw new NotImplementedException("only primitive and light"); + } + + result.Position = adminToy.Position - center ?? adminToy.Position; + result.Rotation = adminToy.Rotation.eulerAngles; + + return result; + } + + + public string Loadable(char separator) + { + StringBuilder b = new(); + b.Append(AdminToyType.ToString()); + b.Append(separator); + b.Append(Position); + b.Append(separator); + b.Append(Rotation); + b.Append(separator); + b.Append(Scale); + b.Append(separator); + b.Append(Load(separator)); + + + return b.ToString(); + } + public abstract AdminToy Spawn(Vector3 center); + protected abstract string Load(char separator); + } +} diff --git a/KruacentExiled/utils-merged/KE.Utilsmap/API/Models/Blueprints/LightBlueprint.cs b/KruacentExiled/utils-merged/KE.Utilsmap/API/Models/Blueprints/LightBlueprint.cs new file mode 100644 index 00000000..1dc91294 --- /dev/null +++ b/KruacentExiled/utils-merged/KE.Utilsmap/API/Models/Blueprints/LightBlueprint.cs @@ -0,0 +1,37 @@ +using Exiled.API.Enums; +using Exiled.API.Features.Toys; +using UnityEngine; +using Light = Exiled.API.Features.Toys.Light; + +namespace KE.Utils.API.Models.Blueprints +{ + public class LightBlueprint : AdminToyBlueprint + { + public Color Color { get; } + public float Intensity { get; } + + public LightBlueprint(Light l) + { + AdminToyType = AdminToyType.PrimitiveObject; + Scale = l.Scale; + Color = l.Color; + Intensity = l.Intensity; + } + + + public override AdminToy Spawn(Vector3 center) + { + var l = Light.Create(Position+center, Rotation, Scale, false); + l.Color = Color; + l.Intensity = Intensity; + + + return l; + } + + protected override string Load(char separator) + { + return "#" + ColorUtility.ToHtmlStringRGBA(Color) + separator + Intensity; + } + } +} diff --git a/KruacentExiled/utils-merged/KE.Utilsmap/API/Models/Blueprints/ModelBlueprint.cs b/KruacentExiled/utils-merged/KE.Utilsmap/API/Models/Blueprints/ModelBlueprint.cs new file mode 100644 index 00000000..0f3a047c --- /dev/null +++ b/KruacentExiled/utils-merged/KE.Utilsmap/API/Models/Blueprints/ModelBlueprint.cs @@ -0,0 +1,110 @@ +using Exiled.API.Features; +using Exiled.API.Features.Core; +using Exiled.API.Features.Doors; +using Exiled.API.Features.Toys; +using Exiled.API.Structs; +using KE.Utils.API.Models.ToysSettings; +using KE.Utils.Quality.Models; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Runtime.InteropServices; +using UnityEngine; +using Light = Exiled.API.Features.Toys.Light; + +namespace KE.Utils.API.Models.Blueprints +{ + public class ModelBlueprint + { + private static List _bps = new(); + public static List Blueprints => _bps.ToList(); + private HashSet _toys = new(); + public IReadOnlyCollection Toys => [.. _toys]; + private string _name; + public string Name + { + get { return _name; } + } + + private ModelBlueprint() { } + + + + /// + /// + /// + /// + /// + public static ModelBlueprint Create(Model model) + { + var oldMbp = Get(model.Name); + _bps.Remove(oldMbp); + + + ModelBlueprint mbp = new(); + mbp._name = model.Name; + _bps.Add(mbp); + + foreach(AdminToy toy in model.Toys) + { + mbp._toys.Add(AdminToyBlueprint.Create(toy,model.Center)); + } + + return mbp; + } + + + public static ModelBlueprint Create(string name,IEnumerable toys = null) + { + ModelBlueprint mbp = new(); + _bps.Add(mbp); + + if (string.IsNullOrEmpty(name)) + { + throw new ArgumentException("name null or empty"); + } + + if(toys != null) + { + foreach(AdminToy at in toys) + { + mbp._toys.Add(AdminToyBlueprint.Create(at)); + } + } + + + + mbp._name = name; + + return mbp; + } + + public void Spawn(Vector3 position) + { + Model m = Model.Create(this, position,false); + + + } + + + #region getters + public static ModelBlueprint Get(string name) + { + foreach (ModelBlueprint m in Blueprints) + { + if (m.Name == name) + { + return m; + } + } + return null; + } + + public static bool TryGet(string name, out ModelBlueprint model) + { + model = Get(name); + return model != null; + } + #endregion + } +} diff --git a/KruacentExiled/utils-merged/KE.Utilsmap/API/Models/Blueprints/PrimitiveBlueprint.cs b/KruacentExiled/utils-merged/KE.Utilsmap/API/Models/Blueprints/PrimitiveBlueprint.cs new file mode 100644 index 00000000..2e59f30a --- /dev/null +++ b/KruacentExiled/utils-merged/KE.Utilsmap/API/Models/Blueprints/PrimitiveBlueprint.cs @@ -0,0 +1,39 @@ +using Exiled.API.Enums; +using Exiled.API.Features.Toys; +using UnityEngine; + +namespace KE.Utils.API.Models.Blueprints +{ + public class PrimitiveBlueprint : AdminToyBlueprint + { + public Color Color { get; } + public PrimitiveType Type { get; } + + + public PrimitiveBlueprint(Primitive p) + { + AdminToyType = AdminToyType.PrimitiveObject; + + Scale = p.Scale; + Color = p.Color; + Type = p.Type; + } + + + + public override AdminToy Spawn(Vector3 center) + { + var p = Primitive.Create(Type,Position+center, Rotation, Scale, false); + p.Collidable = false; + p.Color = Color; + + + return p; + } + + protected override string Load(char separator) + { + return "#" + ColorUtility.ToHtmlStringRGBA(Color) + separator+Type; + } + } +} diff --git a/KruacentExiled/utils-merged/KE.Utilsmap/API/Models/Commands/AllCommands.cs b/KruacentExiled/utils-merged/KE.Utilsmap/API/Models/Commands/AllCommands.cs new file mode 100644 index 00000000..8ba12e68 --- /dev/null +++ b/KruacentExiled/utils-merged/KE.Utilsmap/API/Models/Commands/AllCommands.cs @@ -0,0 +1,33 @@ +using CommandSystem; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Reflection; +using System.Text; +using System.Threading.Tasks; + +namespace KE.Utils.API.Models.Commands +{ + public static class AllCommands + { + + public static IEnumerable Get(Assembly assembly = null) + { + return new List() + { + new ChangeColor(), + new ChangePrimType(), + new CreateModel(), + new CreatePrim(), + new ListModel(), + new LoadModel(), + new ModeMovePrim(), + new SelectModel(), + new ShowCenter(), + new SaveModel() + + }; + + } + } +} diff --git a/KruacentExiled/utils-merged/KE.Utilsmap/API/Models/Commands/ChangeColor.cs b/KruacentExiled/utils-merged/KE.Utilsmap/API/Models/Commands/ChangeColor.cs new file mode 100644 index 00000000..3b78d218 --- /dev/null +++ b/KruacentExiled/utils-merged/KE.Utilsmap/API/Models/Commands/ChangeColor.cs @@ -0,0 +1,72 @@ +using CommandSystem; +using Exiled.API.Features; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using KE.Utils.API.Models; +using UnityEngine; +using Exiled.API.Features.Toys; + +namespace KE.Utils.API.Models.Commands +{ + public class ChangeColor : ICommand + { + + public string Command { get; } = "changecolor"; + + public string[] Aliases { get; } = { "cc" }; + + public string Description { get; } = "change color rgba (0-255)"; + + public bool Execute(ArraySegment arguments, ICommandSender sender, out string response) + { + Player p = Player.Get(sender); + if (p == null) + { + response = "This player can't do this command"; + return false; + } + + if (arguments.Count < 3) + { + response = "not enough arguments"; + return false; + } + if(!byte.TryParse(arguments.At(0),out byte r) || + !byte.TryParse(arguments.At(1), out byte g) || + !byte.TryParse(arguments.At(2), out byte b)) + { + response = "number between 0 & 255"; + return false; + } + + Color32 c; + + if(arguments.Count > 3 && byte.TryParse(arguments.At(3),out byte a)) + { + c = new Color32(r, g, b, a); + } + else + { + c = new Color32(r, g, b,255); + } + + Primitive prim = Models.Instance.ModelCreator.ModelHandler.SelectedPrimitive; + + if(prim == null) + { + response = "no primitive selected"; + return false; + } + + prim.Color = c; + + + response = $"new color set to " + c.ToString(); + return true; + } + + } +} diff --git a/KruacentExiled/utils-merged/KE.Utilsmap/API/Models/Commands/ChangePrimType.cs b/KruacentExiled/utils-merged/KE.Utilsmap/API/Models/Commands/ChangePrimType.cs new file mode 100644 index 00000000..434427df --- /dev/null +++ b/KruacentExiled/utils-merged/KE.Utilsmap/API/Models/Commands/ChangePrimType.cs @@ -0,0 +1,53 @@ +using CommandSystem; +using Exiled.API.Features; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using KE.Utils.API.Models; +using UnityEngine; + +namespace KE.Utils.API.Models.Commands +{ + public class ChangePrimType : ICommand + { + + public string Command { get; } = "changeprimtype"; + + public string[] Aliases { get; } = { "cpt" }; + + public string Description { get; } = "select the mode : scale,move,rotate"; + + public bool Execute(ArraySegment arguments, ICommandSender sender, out string response) + { + Player p = Player.Get(sender); + if (p == null) + { + response = "This player can't do this command"; + return false; + } + + if (arguments.Count < 1) + { + response = "not enough arguments"; + return false; + } + string type = arguments.At(0); + + + if(!Enum.TryParse(type, out PrimitiveType prim)) + { + response = "wrong argument"; + return false; + } + + + Models.Instance.ModelCreator.ModelHandler.SelectedPrimitive.Type = prim; + + response = $"Mode set to " + prim ; + return true; + } + + } +} diff --git a/KruacentExiled/utils-merged/KE.Utilsmap/API/Models/Commands/CreateModel.cs b/KruacentExiled/utils-merged/KE.Utilsmap/API/Models/Commands/CreateModel.cs new file mode 100644 index 00000000..d549cb50 --- /dev/null +++ b/KruacentExiled/utils-merged/KE.Utilsmap/API/Models/Commands/CreateModel.cs @@ -0,0 +1,44 @@ +using CommandSystem; +using Exiled.API.Features; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace KE.Utils.API.Models.Commands +{ + public class CreateModel : ICommand + { + + public string Command { get; } = "create"; + + public string[] Aliases { get; } = { "c" }; + + public string Description { get; } = "create a new model at your position"; + + public bool Execute(ArraySegment arguments, ICommandSender sender, out string response) + { + + Player p = Player.Get(sender); + if (p == null) + { + response = "This player can't do this command"; + return false; + } + + if (arguments.Count < 1) + { + response = "not enough arguments"; + return false; + } + string name = arguments.At(0); + + Model m = Model.Create(p.Position, name); + Models.Instance.ModelCreator.ModelHandler.SelectedModel = m; + response = $"Created & selected model ({m.Name}) at {m.Center}"; + return true; + } + + } +} diff --git a/KruacentExiled/utils-merged/KE.Utilsmap/API/Models/Commands/CreatePrim.cs b/KruacentExiled/utils-merged/KE.Utilsmap/API/Models/Commands/CreatePrim.cs new file mode 100644 index 00000000..edcd6306 --- /dev/null +++ b/KruacentExiled/utils-merged/KE.Utilsmap/API/Models/Commands/CreatePrim.cs @@ -0,0 +1,47 @@ +using CommandSystem; +using Exiled.API.Features; +using Exiled.API.Features.Toys; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace KE.Utils.API.Models.Commands +{ + public class CreatePrim : ICommand + { + + public string Command { get; } = "createprimitive"; + + public string[] Aliases { get; } = { "cp" }; //no not like that + + public string Description { get; } = "create a new primitive at your position"; + + public bool Execute(ArraySegment arguments, ICommandSender sender, out string response) + { + + Player p = Player.Get(sender); + if (p == null) + { + response = "This player can't do this command"; + return false; + } + + + Model m = Models.Instance.ModelCreator.SelectedModel; + + if (m == null) + { + response = "no model selected"; + return false; + } + m.Add(p.Position); + + + response = "created!"; + return true; + } + + } +} diff --git a/KruacentExiled/utils-merged/KE.Utilsmap/API/Models/Commands/ListModel.cs b/KruacentExiled/utils-merged/KE.Utilsmap/API/Models/Commands/ListModel.cs new file mode 100644 index 00000000..79f42597 --- /dev/null +++ b/KruacentExiled/utils-merged/KE.Utilsmap/API/Models/Commands/ListModel.cs @@ -0,0 +1,42 @@ +using CommandSystem; +using Exiled.API.Features; +using KE.Utils.API.Models.Blueprints; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace KE.Utils.API.Models.Commands +{ + public class ListModel : ICommand + { + + public string Command { get; } = "list"; + + public string[] Aliases { get; } = { "l" }; + + public string Description { get; } = "create a new model at your position"; + + public bool Execute(ArraySegment arguments, ICommandSender sender, out string response) + { + StringBuilder b = new(); + b.AppendLine($"Models ({Model.Models.Count}) :"); + foreach (Model m in Model.Models) + { + b.AppendLine($"{m.Name} pos: {m.Center} spawned? :{m.Spawned}"); + } + + b.AppendLine($"Blueprints ({ModelBlueprint.Blueprints.Count}) :"); + foreach (ModelBlueprint m in ModelBlueprint.Blueprints) + { + b.AppendLine($"{m.Name}"); + } + + + response = b.ToString(); + return true; + } + + } +} diff --git a/KruacentExiled/utils-merged/KE.Utilsmap/API/Models/Commands/LoadModel.cs b/KruacentExiled/utils-merged/KE.Utilsmap/API/Models/Commands/LoadModel.cs new file mode 100644 index 00000000..7be25565 --- /dev/null +++ b/KruacentExiled/utils-merged/KE.Utilsmap/API/Models/Commands/LoadModel.cs @@ -0,0 +1,65 @@ +using CommandSystem; +using Exiled.API.Features; +using KE.Utils.API.Models.Blueprints; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Xml.Linq; + +namespace KE.Utils.API.Models.Commands +{ + public class LoadModel : ICommand + { + + public string Command { get; } = "load"; + + public string[] Aliases { get; } = { "lo" }; + + public string Description { get; } = "load a model from a blueprint"; + + public bool Execute(ArraySegment arguments, ICommandSender sender, out string response) + { + + Player p = Player.Get(sender); + if (p == null) + { + response = "This player can't do this command"; + return false; + } + + if (arguments.Count < 1) + { + response = "not enough arguments"; + return false; + } + + string name = arguments.At(0); + + if (string.IsNullOrEmpty(name)) + { + response = "name null or empty"; + return false; + } + + foreach(ModelBlueprint bp in ModelBlueprint.Blueprints) + { + + Log.Info($"{bp.Name} == {name} : {bp.Name == name}"); + } + + + if(!ModelBlueprint.TryGet(name,out var mbp)) + { + response = "blueprint not found"; + return false; + } + + mbp.Spawn(p.Position); + response = $"Created model ({mbp.Name}) at {p.Position}"; + return true; + } + + } +} diff --git a/KruacentExiled/utils-merged/KE.Utilsmap/API/Models/Commands/ModeMovePrim.cs b/KruacentExiled/utils-merged/KE.Utilsmap/API/Models/Commands/ModeMovePrim.cs new file mode 100644 index 00000000..2b9ea091 --- /dev/null +++ b/KruacentExiled/utils-merged/KE.Utilsmap/API/Models/Commands/ModeMovePrim.cs @@ -0,0 +1,64 @@ +using CommandSystem; +using Exiled.API.Features; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using KE.Utils.API.Models; + +namespace KE.Utils.API.Models.Commands +{ + public class ModeMovePrim : ICommand + { + + public string Command { get; } = "mode"; + + public string[] Aliases { get; } = { "m" }; + + public string Description { get; } = "select the mode : scale,move,rotate"; + + public bool Execute(ArraySegment arguments, ICommandSender sender, out string response) + { + Player p = Player.Get(sender); + if (p == null) + { + response = "This player can't do this command"; + return false; + } + + if (arguments.Count < 1) + { + response = "not enough arguments"; + return false; + } + string mode = arguments.At(0); + + switch(mode) + { + case "m": + case "move": + Models.Instance.ModelCreator.MovementMode = MovementMode.Move; + break; + case "s": + case "scale": + Models.Instance.ModelCreator.MovementMode = MovementMode.Scale; + break; + case "r": + case "rotate": + Models.Instance.ModelCreator.MovementMode = MovementMode.Rotate; + break; + default: + response = "wrong argument"; + return false; + + + } + + + response = $"Mode set to " + Models.Instance.ModelCreator.MovementMode.ToString(); + return true; + } + + } +} diff --git a/KruacentExiled/utils-merged/KE.Utilsmap/API/Models/Commands/SaveModel.cs b/KruacentExiled/utils-merged/KE.Utilsmap/API/Models/Commands/SaveModel.cs new file mode 100644 index 00000000..d40048e5 --- /dev/null +++ b/KruacentExiled/utils-merged/KE.Utilsmap/API/Models/Commands/SaveModel.cs @@ -0,0 +1,47 @@ +using CommandSystem; +using Exiled.API.Features; +using KE.Utils.API.Models.Blueprints; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Xml.Linq; + +namespace KE.Utils.API.Models.Commands +{ + public class SaveModel : ICommand + { + + public string Command { get; } = "save"; + + public string[] Aliases { get; } = { "sa" }; + + public string Description { get; } = "save a model to file"; + + public bool Execute(ArraySegment arguments, ICommandSender sender, out string response) + { + + Player p = Player.Get(sender); + if (p == null) + { + response = "This player can't do this command"; + return false; + } + + + Model model = Models.Instance.ModelCreator.SelectedModel; + if (model == null) + { + response = "no model selected"; + return false; + } + + model.Save(); + + response = $"Saved ({model.Name})"; + return true; + } + + } +} diff --git a/KruacentExiled/utils-merged/KE.Utilsmap/API/Models/Commands/SelectModel.cs b/KruacentExiled/utils-merged/KE.Utilsmap/API/Models/Commands/SelectModel.cs new file mode 100644 index 00000000..266ce4d4 --- /dev/null +++ b/KruacentExiled/utils-merged/KE.Utilsmap/API/Models/Commands/SelectModel.cs @@ -0,0 +1,56 @@ +using CommandSystem; +using Exiled.API.Features; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace KE.Utils.API.Models.Commands +{ + public class SelectModel : ICommand + { + + public string Command { get; } = "select"; + + public string[] Aliases { get; } = { "s" }; + + public string Description { get; } = "select an existing model"; + + public bool Execute(ArraySegment arguments, ICommandSender sender, out string response) + { + + Player p = Player.Get(sender); + if (p == null) + { + response = "This player can't do this command"; + return false; + } + if (arguments.Count < 1) + { + response = "not enough arguments"; + return false; + } + string name = arguments.At(0); + + if (string.IsNullOrEmpty(name)) + { + response = "name null or empty"; + return false; + } + + + + + if (!Model.TryGet(name, out Model m)) + { + response = "model not found"; + return false; + } + response = $"model ({m.Name}) selected {m.Center}"; + Models.Instance.ModelCreator.ModelHandler.SelectedModel = m; + return true; + } + + } +} diff --git a/KruacentExiled/utils-merged/KE.Utilsmap/API/Models/Commands/ShowCenter.cs b/KruacentExiled/utils-merged/KE.Utilsmap/API/Models/Commands/ShowCenter.cs new file mode 100644 index 00000000..7b6cc05e --- /dev/null +++ b/KruacentExiled/utils-merged/KE.Utilsmap/API/Models/Commands/ShowCenter.cs @@ -0,0 +1,51 @@ +using CommandSystem; +using Exiled.API.Features; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace KE.Utils.API.Models.Commands +{ + public class ShowCenter : ICommand + { + + public string Command { get; } = "show"; + + public string[] Aliases { get; } = { "sh" }; + + public string Description { get; } = "toggle the center of the model"; + + public bool Execute(ArraySegment arguments, ICommandSender sender, out string response) + { + + Player p = Player.Get(sender); + if (p == null) + { + response = "This player can't do this command"; + return false; + } + + Model m = Models.Instance.ModelCreator.ModelHandler.SelectedModel; + + if(m == null) + { + response = "no model selected"; + return false; + } + + if(!bool.TryParse(arguments.At(0),out bool result)) + { + response = "write true or false"; + return false; + } + + m.SetCenterPrimitive(result); + + response = "done"; + + return true; + } + } +} diff --git a/KruacentExiled/utils-merged/KE.Utilsmap/API/Models/Model.cs b/KruacentExiled/utils-merged/KE.Utilsmap/API/Models/Model.cs new file mode 100644 index 00000000..6e84fbc9 --- /dev/null +++ b/KruacentExiled/utils-merged/KE.Utilsmap/API/Models/Model.cs @@ -0,0 +1,202 @@ +using Exiled.API.Features; +using Exiled.API.Features.Toys; +using KE.Utils.API.Models.Blueprints; +using System; +using System.Collections.Generic; +using System.Linq; +using UnityEngine; + +namespace KE.Utils.API.Models +{ + public class Model + { + private static List _models = new(); + public static List Models => _models.ToList(); + + private HashSet _toys = new(); + public IReadOnlyCollection Toys => [.. _toys]; + private string _name; + public string Name + { + get { return _name; } + } + + private Vector3 _center; + public Vector3 Center + { + get { return _center; } + } + private bool _spawned = true; + public bool Spawned + { + get { return _spawned; } + } + + private ModelBlueprint _blueprint; + + public ModelBlueprint Blueprint + { + get { return _blueprint; } + } + + public bool LoadedFromBlueprint + { + get + { + return Blueprint != null; + } + } + + + + + + internal Primitive centerPrim; + + public void SetCenterPrimitive(bool show) + { + if (show) + { + centerPrim.Spawn(); + } + else + { + centerPrim.UnSpawn(); + } + } + + + + public Primitive Add(Vector3 pos) + { + var p = Primitive.Create(pos, null, null, true); + + AddToy(p); + return p; + } + + + protected virtual void AddToy(AdminToy toy,bool editMode = true) + { + if(toy is Primitive p && editMode) + { + p.Collidable = true; + } + + + _toys.Add(toy); + } + + private Model(Vector3 center) + { + _models.Add(this); + _center = center; + } + + public static Model Create(Vector3 position, string name) + { + + Model m = new(position); + if (string.IsNullOrEmpty(name)) + { + throw new ArgumentException("name null or empty"); + } + m._name = name; + + Log.Debug("created model id=" + m.Name); + m.centerPrim = Primitive.Create(position, null, Vector3.one / 5, true, new(1, 0, 0, .25f)); + m.centerPrim.Collidable = false; + + return m; + } + + + public static Model Create(ModelBlueprint blueprint,Vector3 position,bool editMode = false) + { + Model m = new(position); + m._name = blueprint.Name; + + foreach (AdminToyBlueprint toy in blueprint.Toys) + { + Log.Info("create toy "+toy.AdminToyType); + AdminToy trueToy = toy.Spawn(m.Center); + + + m.AddToy(trueToy, editMode); + + } + + return m; + + } + + /// + /// Create a based of this

+ /// Note : will overwrite the old blueprint + ///
+ public void CreateBlueprint() + { + ModelBlueprint bp = ModelBlueprint.Create(this); + + _blueprint = bp; + + } + + + #region getter + public static Model Get(string name) + { + foreach (Model m in _models) + { + if (m.Name == name) + { + return m; + } + } + return null; + } + + public static bool TryGet(string name, out Model model) + { + model = Get(name); + return model != null; + } + + + public override string ToString() + { + return $"{Name} center = {Center}"; + } + #endregion + + #region spawn + public void Spawn() + { + foreach (AdminToy t in Toys) + { + t.Spawn(); + } + _spawned = true; + } + public void UnSpawn() + { + foreach (AdminToy t in Toys) + { + t.UnSpawn(); + } + _spawned = false; + } + + public void Destroy() + { + foreach (AdminToy t in Toys) + { + t.Destroy(); + } + _models.Remove(this); + + } + + #endregion + } +} diff --git a/KruacentExiled/utils-merged/KE.Utilsmap/API/Models/ModelCreator.cs b/KruacentExiled/utils-merged/KE.Utilsmap/API/Models/ModelCreator.cs new file mode 100644 index 00000000..85758ad9 --- /dev/null +++ b/KruacentExiled/utils-merged/KE.Utilsmap/API/Models/ModelCreator.cs @@ -0,0 +1,175 @@ +using AdminToys; +using Exiled.API.Features; +using Exiled.API.Features.Items; +using Exiled.API.Features.Toys; +using Exiled.Events.EventArgs.Player; +using KE.Utils.API.Interfaces; +using KE.Utils.API.Models.Arrows; +using MEC; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Runtime.InteropServices; +using System.Text; +using System.Threading.Tasks; +using UnityEngine; + +namespace KE.Utils.API.Models +{ + public class ModelCreator : IUsingEvents + { + + + public const ItemType item = ItemType.GunCOM18; + + public Model SelectedModel + { + get + { + return ModelHandler.SelectedModel; + } + } + public MovementMode MovementMode + { + get + { + return MovementHandler.Mode; + } + set + { + MovementHandler.Mode = value; + } + } + internal MovementHandler MovementHandler { get; private set; } + internal ModelSelection ModelHandler { get; private set; } + + private bool mode = false; + private const float MAX_DISTANCE = 50; + + public static event Action IsAiming; + public static event Action StoppedAiming; + + + + public ModelCreator() + { + + } + + public void SubscribeEvents() + { + + ModelHandler = new(); + MovementHandler = new(); + + ModelLoader.LoadAll(); + MovementHandler.SubscribeEvents(); + Exiled.Events.Handlers.Player.DryfiringWeapon += OnDryfiringWeapon; + Exiled.Events.Handlers.Player.TogglingWeaponFlashlight += OnTogglingWeaponFlashlight; + Exiled.Events.Handlers.Server.RoundStarted += Test; + Exiled.Events.Handlers.Player.AimingDownSight += OnAimingDownSight; + + } + public void UnsubscribeEvents() + { + Exiled.Events.Handlers.Player.DryfiringWeapon -= OnDryfiringWeapon; + Exiled.Events.Handlers.Player.TogglingWeaponFlashlight -= OnTogglingWeaponFlashlight; + Exiled.Events.Handlers.Player.AimingDownSight -= OnAimingDownSight; + Exiled.Events.Handlers.Server.RoundStarted -= Test; + MovementHandler.UnsubscribeEvents(); + + ModelHandler = null; + MovementHandler = null; + } + + private void Test() + { + foreach (var p in Player.List) + { + p.Role.Set(PlayerRoles.RoleTypeId.ChaosConscript); + Timing.CallDelayed(.1f, () => + { + var a = p.AddItem(item); + var b = a as Firearm; + b.MagazineAmmo = 2; + + Primitive.Create(p.Position + Vector3.back, null, null, true, Color.red); + Primitive.Create(p.Position + Vector3.forward, null, null, true, Color.green); + }); + } + } + + + + + private void OnAimingDownSight(AimingDownSightEventArgs ev) + { + if (ev.AdsIn) + { + IsAiming?.Invoke(ev.Player); + } + else + { + StoppedAiming?.Invoke(); + } + } + + private void OnDryfiringWeapon(DryfiringWeaponEventArgs ev) + { + if (ev.Firearm.Type != item) return; + Log.Info("new mode = " + mode); + + if (!mode) + { + + mode = !mode; + } + + + + } + + private void OnTogglingWeaponFlashlight(TogglingWeaponFlashlightEventArgs ev) + { + if (ev.Firearm.Type != item) return; + + + + Primitive p = GetFacingPrimitive(ev.Player); + if (!Arrow.IsPrimitiveArrow(p)) + { + ModelHandler.ChangedSelectedPrim(p); + } + + } + + internal static Primitive GetFacingPrimitive(Player player) + { + Transform cam = player.CameraTransform; + + Vector3 origin = cam.position + cam.forward * 0.5f; + Ray r = new Ray(origin, cam.forward); + if (Physics.Raycast(r, out RaycastHit hit, MAX_DISTANCE)) + { + Log.Info($"hit ({hit.collider.name})"); + PrimitiveObjectToy pot = hit.collider.GetComponentInParent() ?? hit.collider.GetComponentInChildren(); + if (pot != null) + { + return Primitive.Get(pot); + + + } + } + return null; + } + + + + } + public enum MovementMode + { + Move, + Scale, + Rotate + } +} diff --git a/KruacentExiled/utils-merged/KE.Utilsmap/API/Models/ModelLoader.cs b/KruacentExiled/utils-merged/KE.Utilsmap/API/Models/ModelLoader.cs new file mode 100644 index 00000000..d4c60464 --- /dev/null +++ b/KruacentExiled/utils-merged/KE.Utilsmap/API/Models/ModelLoader.cs @@ -0,0 +1,152 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.IO; +using Exiled.API.Features; +using Exiled.API.Features.Toys; +using UnityEngine; +using Light = Exiled.API.Features.Toys.Light; +using Exiled.API.Enums; +using KE.Utils.API.Models.Blueprints; +namespace KE.Utils.API.Models +{ + public static class ModelLoader + { + public static string Path => Paths.Configs + @"\"; + private static readonly char SEPARATOR = '_'; + public static string Extension => ".modelscpsl"; + + + public static IEnumerable LoadAll() + { + List m = new(); + + string[] raw = Directory.GetFiles(Path, "*" + Extension); + + foreach (string d in raw) + { + Log.Info("loading="+d); + ModelBlueprint mbp = Load(string.Empty, d); + if(mbp != null) + { + Log.Info($"loaded {mbp.Name} ({mbp.Toys.Count})"); + m.Add(mbp); + } + + } + + return m; + } + + public static ModelBlueprint Load(string filename) + { + return Load(Path, filename); + } + + public static ModelBlueprint Load(string path,string filename) + { + string[] raw; + try + { + raw = File.ReadAllText(path + filename).Split('\n'); + } + catch(Exception e) + { + Log.Error(e); + return null; + } + + + string[] infoline = raw[0].Split(SEPARATOR); + string name = infoline[0]; + List toys = new(); + + + for (int i = 1; i < raw.Length; i++) + { + string[] line = raw[i].Split(SEPARATOR); + AdminToy toy = null; + AdminToyType type; + if (!Enum.TryParse(line[0], out type)) continue; + + Vector3 ATPos = Parser.Vector3(line[1]); + Vector3 ATRotation = Parser.Vector3(line[2]); + Vector3 ATScale = Parser.Vector3(line[3]); + if(type == AdminToyType.PrimitiveObject) + { + Color color; + ColorUtility.TryParseHtmlString(line[4], out color); + PrimitiveType ptype; + Enum.TryParse(line[5], out ptype); + + + var p = Primitive.Create(ptype, ATPos, ATRotation, ATScale, true, color); + p.Collidable = false; + toy = p; + + } + if(type == AdminToyType.LightSource) + { + Color color; + ColorUtility.TryParseHtmlString(line[4], out color); + + float intensity = float.Parse(line[5]); + var l = Light.Create(ATPos, ATRotation, ATScale, true, color); + l.Intensity = intensity; + toy = l; + } + + if (toy == null) continue; + toys.Add(toy); + + } + + + + + return ModelBlueprint.Create(name, toys); + } + + + // Name\n + // Primitive.Position.RotationEuler.Scale.Color.PrimitiveType\n + // Light.Position.RotationEuler.Scale.Color.Intensity\n + // and repeat + public static bool Save(this ModelBlueprint m) + { + + List result = new(); + + result.Add(m.Name+SEPARATOR); + + foreach(AdminToyBlueprint t in m.Toys) + { + result.Add(t.Loadable(SEPARATOR)); + } + + try + { + File.WriteAllLines(Path + m.Name+ Extension, result); + return true; + } + catch(Exception e) + { + Log.Error(e); + return false; + } + + } + + public static bool Save(this Model model) + { + if (!model.LoadedFromBlueprint) + model.CreateBlueprint(); + + + return Save(model.Blueprint); + } + + + } +} diff --git a/KruacentExiled/utils-merged/KE.Utilsmap/API/Models/Models.cs b/KruacentExiled/utils-merged/KE.Utilsmap/API/Models/Models.cs new file mode 100644 index 00000000..27fe3cf4 --- /dev/null +++ b/KruacentExiled/utils-merged/KE.Utilsmap/API/Models/Models.cs @@ -0,0 +1,47 @@ +using KE.Utils.API.Interfaces; +using PlayerRoles.FirstPersonControl.Thirdperson; + +namespace KE.Utils.API.Models +{ + public class Models : IUsingEvents + { + public ModelCreator ModelCreator + { + get; + private set; + } + private static Models _instance; + + + public static Models Instance + { + get + { + if (_instance == null) + _instance = new(); + return _instance; + } + } + + public void DestroyInstance() + { + _instance = null; + } + + private Models() + { + ModelCreator = new(); + } + + + public void SubscribeEvents() + { + ModelCreator.SubscribeEvents(); + } + + public void UnsubscribeEvents() + { + ModelCreator.UnsubscribeEvents(); + } + } +} diff --git a/KruacentExiled/utils-merged/KE.Utilsmap/API/Models/MovementHandler.cs b/KruacentExiled/utils-merged/KE.Utilsmap/API/Models/MovementHandler.cs new file mode 100644 index 00000000..07e3ee18 --- /dev/null +++ b/KruacentExiled/utils-merged/KE.Utilsmap/API/Models/MovementHandler.cs @@ -0,0 +1,208 @@ +using Exiled.API.Features; +using Exiled.API.Features.Toys; +using Exiled.Events.EventArgs.Player; +using KE.Utils.API.Interfaces; +using KE.Utils.API.Models.Arrows; +using MEC; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using UnityEngine; + +namespace KE.Utils.API.Models +{ + internal class MovementHandler : IUsingEvents + { + + private MovementMode _mode = MovementMode.Move; + + public MovementMode Mode + { + get + { + return _mode; + } + set + { + OnChangingMode?.Invoke(value); + _mode = value; + } + } + public static event Action OnChangingMode; + + + + //xyz + private Arrow[] _arrows = new Arrow[3]; + private bool _primflag = false; + public readonly static float REFRESH_RATE = Timing.WaitForOneFrame; + + private CoroutineHandle _handle; + private bool _aiming = false; + private void TryCreatePrimitives() + { + if (!_primflag) + { + _arrows[0] = new XArrow(); + _arrows[1] = new YArrow(); + _arrows[2] = new ZArrow(); + _primflag = true; + } + } + + + + + public void SubscribeEvents() + { + ModelCreator.IsAiming += IsAiming; + ModelCreator.StoppedAiming += StoppedAiming; + ModelSelection.OnChangedSelection += OnChangedSelection; + ModelSelection.OnUnSelect += OnUnSelect; + } + + public void UnsubscribeEvents() + { + Timing.KillCoroutines(_handle); + + ModelSelection.OnChangedSelection -= OnChangedSelection; + ModelSelection.OnUnSelect -= OnUnSelect; + } + private void OnUnSelect() + { + foreach (Arrow a in Arrow.List) + { + a.Move(Vector3.zero); + } + } + private void OnChangedSelection(Primitive p) + { + Log.Info("ChangedSelection"); + TryCreatePrimitives(); + foreach (Arrow a in Arrow.List) + { + a.Move(p.Position); + } + + } + + + private void IsAiming(Player p) + { + Log.Info("start aim"); + var prim = ModelCreator.GetFacingPrimitive(p); + if (!Arrow.IsPrimitiveArrow(prim)) return; + + _aiming = true; + _handle = Timing.RunCoroutine(Moving(p,prim)); + } + + private void StoppedAiming() + { + Log.Info("stopped aim"); + _aiming = false; + } + + + + private IEnumerator Moving(Player player,Primitive p) + { + Primitive selected = Models.Instance.ModelCreator.ModelHandler.SelectedPrimitive; + Vector3 pos = selected.Position; + Vector3 targetPos = pos; + Vector3 scale = selected.Scale; + Vector3 tScale = scale; + + + + Vector3 oldEuler = player.CameraTransform.rotation.eulerAngles; + Arrow a = Arrow.GetArrow(p); + List otherArrows = Arrow.List.Where(o => o != a).ToList(); + + Vector3 direction = a.Offset.normalized; + float sensitivity = 0.1f; + float smoothSpeed = 5; + + while (_aiming) + { + Vector3 currentEuler = player.CameraTransform.rotation.eulerAngles; + + float deltaYaw = Mathf.DeltaAngle(oldEuler.y, currentEuler.y); + float deltaPitch = Mathf.DeltaAngle(oldEuler.x, currentEuler.x); + + float movementAmount = 0f; + + if (Mathf.Abs(direction.y) > 0.5f) + { + movementAmount = -deltaPitch * sensitivity; + } + else + { + + Vector3 camRight = player.CameraTransform.right; + + float sign = Mathf.Sign(Vector3.Dot(camRight, direction)); + + movementAmount = deltaYaw * sensitivity * sign; + } + + + + + if(Mode == MovementMode.Move) + { + targetPos += direction.normalized * movementAmount; + pos = Vector3.Lerp(pos, targetPos, Time.deltaTime * smoothSpeed); + p.Position = pos; + selected.Position = pos - a.Offset; + foreach (Arrow arrow in otherArrows) + { + arrow.Move(pos - a.Offset); + } + } + + + + if(Mode == MovementMode.Scale) + { + Vector3 previousParallel = direction.normalized * Vector3.Dot(selected.Scale, direction.normalized); + Vector3 dir = direction.normalized; + + float currentLengthInDir = Vector3.Dot(scale, dir); + + float newLengthInDir = Mathf.Clamp(currentLengthInDir + movementAmount, 0.1f, 10f); + + + Vector3 parallel = dir * newLengthInDir; + Vector3 perpendicular = scale - (dir * currentLengthInDir); + + selected.Scale = parallel + perpendicular; + scale = selected.Scale; + + Vector3 deltaParallel = parallel - previousParallel; + a.Primitive.Position += deltaParallel / 2; + previousParallel = parallel; + } + + + + if(Mode == MovementMode.Rotate) + { + Log.Info("no clue how to do that"); + } + + + + + + oldEuler = currentEuler; + yield return REFRESH_RATE; + } + } + + + + } +} diff --git a/KruacentExiled/utils-merged/KE.Utilsmap/API/Models/SelectedModel.cs b/KruacentExiled/utils-merged/KE.Utilsmap/API/Models/SelectedModel.cs new file mode 100644 index 00000000..7e502f46 --- /dev/null +++ b/KruacentExiled/utils-merged/KE.Utilsmap/API/Models/SelectedModel.cs @@ -0,0 +1,52 @@ +using Exiled.API.Features; +using Exiled.API.Features.Toys; +using MEC; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using UnityEngine; + +namespace KE.Utils.API.Models +{ + internal class ModelSelection + { + + + + public Model SelectedModel { get; internal set; } + public Primitive SelectedPrimitive; + + public static event Action OnChangedSelection; + public static event Action OnUnSelect; + + public void ChangedSelectedPrim(Primitive newPrim) + { + if (newPrim == null) return; + + + + Log.Info(SelectedPrimitive == null); + Log.Info(newPrim.GameObject.GetInstanceID() != SelectedPrimitive?.GameObject.GetInstanceID()); + + if (SelectedPrimitive == null || newPrim.GameObject.GetInstanceID() != SelectedPrimitive?.GameObject.GetInstanceID()) + { + Log.Info("selecting"); + OnChangedSelection?.Invoke(newPrim); + SelectedPrimitive = newPrim; + } + else + { + Log.Info("unselecting"); + SelectedPrimitive = null; + OnUnSelect?.Invoke(); + } + + } + + + + + } +} diff --git a/KruacentExiled/utils-merged/KE.Utilsmap/API/Models/ToysSettings/PrimitiveSetting.cs b/KruacentExiled/utils-merged/KE.Utilsmap/API/Models/ToysSettings/PrimitiveSetting.cs new file mode 100644 index 00000000..b3ffe31d --- /dev/null +++ b/KruacentExiled/utils-merged/KE.Utilsmap/API/Models/ToysSettings/PrimitiveSetting.cs @@ -0,0 +1,31 @@ +using AdminToys; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using UnityEngine; + +namespace KE.Utils.API.Models.ToysSettings +{ + public class PrimitiveSetting : ToySetting + { + + public PrimitiveType PrimitiveType { get; } + + + public PrimitiveFlags Flags { get; } + + + public Color Color { get; } + + public Vector3 Position { get; } + + + public Vector3 Rotation { get; } + + + public Vector3 Scale { get; } + + } +} diff --git a/KruacentExiled/utils-merged/KE.Utilsmap/API/Models/ToysSettings/ToySetting.cs b/KruacentExiled/utils-merged/KE.Utilsmap/API/Models/ToysSettings/ToySetting.cs new file mode 100644 index 00000000..8fdc4477 --- /dev/null +++ b/KruacentExiled/utils-merged/KE.Utilsmap/API/Models/ToysSettings/ToySetting.cs @@ -0,0 +1,20 @@ +using Exiled.API.Features.Toys; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace KE.Utils.API.Models.ToysSettings +{ + public abstract class ToySetting + { + + + + public virtual void Create(AdminToy a) + { + + } + } +} diff --git a/KruacentExiled/utils-merged/KE.Utilsmap/API/OtherUtils.cs b/KruacentExiled/utils-merged/KE.Utilsmap/API/OtherUtils.cs new file mode 100644 index 00000000..ef43b888 --- /dev/null +++ b/KruacentExiled/utils-merged/KE.Utilsmap/API/OtherUtils.cs @@ -0,0 +1,18 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using UnityEngine; + +namespace KE.Utils.API +{ + public static class OtherUtils + { + + public static bool IsInCircle(Vector3 pos,Vector3 centerCircle,float radius) + { + return (pos-centerCircle).sqrMagnitude <= Math.Pow(radius, 2); + } + } +} diff --git a/KruacentExiled/utils-merged/KE.Utilsmap/API/Parser.cs b/KruacentExiled/utils-merged/KE.Utilsmap/API/Parser.cs new file mode 100644 index 00000000..a924337f --- /dev/null +++ b/KruacentExiled/utils-merged/KE.Utilsmap/API/Parser.cs @@ -0,0 +1,36 @@ +using Exiled.API.Features; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using UnityEngine; + +namespace KE.Utils.API +{ + public static class Parser + { + public static Vector3 Vector3(string s) + { + string[] temp = s.Substring(1, s.Length - 3).Split(','); + + if(!float.TryParse(temp[0],out float x)) + { + return UnityEngine.Vector3.zero; + } + + if (!float.TryParse(temp[1], out float y)) + { + return UnityEngine.Vector3.zero; + } + if (!float.TryParse(temp[1], out float z)) + { + return UnityEngine.Vector3.zero; + } + + + + return new Vector3(x, y, z); + } + } +} diff --git a/KruacentExiled/utils-merged/KE.Utilsmap/API/Sounds/SoundPlayer.cs b/KruacentExiled/utils-merged/KE.Utilsmap/API/Sounds/SoundPlayer.cs new file mode 100644 index 00000000..19f0c310 --- /dev/null +++ b/KruacentExiled/utils-merged/KE.Utilsmap/API/Sounds/SoundPlayer.cs @@ -0,0 +1,112 @@ +using Exiled.API.Features; +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using UnityEngine; + +namespace KE.Utils.API.Sounds +{ + public class SoundPlayer + { + private static SoundPlayer _instance; + + public static SoundPlayer Instance + { + get + { + if(_instance == null) + { + _instance = new(); + } + return _instance; + } + } + + private SoundPlayer() { } + + private bool _loaded = false; + public bool Loaded => _loaded; + + + public static string SoundLocation => Paths.Configs + "/Sounds"; + public static void Load() => Instance.TryLoad(); + public void TryLoad() + { + if (Loaded) + { + return; + } + + if (!Directory.Exists(SoundLocation)) + { + Log.Warn("Directory not found. creating..."); + Directory.CreateDirectory(SoundLocation); + } + + string[] rawfile = Directory.GetFiles(SoundLocation, "*.ogg"); + + foreach (string file in rawfile) + { + string noExFile = Path.GetFileNameWithoutExtension(file); + Log.Info($"loading {file} as {noExFile}"); + AudioClipStorage.LoadClip(file); + } + _loaded = true; + } + + + /// + /// Play a clip at a static point + /// + /// + /// + /// + /// + public void Play(string clipName, Vector3 pos, float volume = 50f, float maxDistance = 20f, bool isSpatial = true) + { + if (!Loaded) throw new Exception("clips not loaded use SoundPlayer.Load()"); + Log.Debug($"playing {clipName} at {pos}"); + + var audioPlayer = AudioPlayer.CreateOrGet($"{clipName} ({pos})", onIntialCreation: (p) => + { + GameObject a = new GameObject(); + a.transform.position = pos; + p.transform.parent = a.transform; + Speaker speaker = p.AddSpeaker("main", isSpatial: isSpatial, maxDistance: maxDistance, minDistance: 1f); + speaker.transform.parent = a.transform; + speaker.transform.localPosition = Vector3.zero; + }); + + audioPlayer.AddClip(clipName, volume: volume); + audioPlayer.DestroyWhenAllClipsPlayed = true; + + } + + /// + /// Play a clip at a + /// + /// + /// + /// + /// + public void Play(string clipName, GameObject objectEmittingSound, float volume = 50f, float maxDistance = 20f, bool isSpatial = true) + { + if (!Loaded) throw new Exception("clips not loaded use SoundPlayer.Instance.Load()"); + Log.Debug($"playing {clipName} at {objectEmittingSound}"); + + var audioPlayer = AudioPlayer.CreateOrGet($"{clipName} ({objectEmittingSound})", onIntialCreation: (p) => + { + + p.transform.parent = objectEmittingSound.transform; + Speaker speaker = p.AddSpeaker("main", isSpatial: isSpatial, maxDistance: maxDistance, minDistance: 1f); + speaker.transform.parent = objectEmittingSound.transform; + speaker.transform.localPosition = Vector3.zero; + }); + audioPlayer.AddClip(clipName, volume: volume); + audioPlayer.DestroyWhenAllClipsPlayed = true; + } + } +} diff --git a/KruacentExiled/utils-merged/KE.Utilsmap/Extensions/AdminToyExtension.cs b/KruacentExiled/utils-merged/KE.Utilsmap/Extensions/AdminToyExtension.cs new file mode 100644 index 00000000..37c3706d --- /dev/null +++ b/KruacentExiled/utils-merged/KE.Utilsmap/Extensions/AdminToyExtension.cs @@ -0,0 +1,25 @@ +using Exiled.API.Features.Toys; +using KE.Utils.Quality; +using KE.Utils.Quality.Enums; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace KE.Utils.Extensions +{ + public static class AdminToyExtension + { + + public static void SetAsPickupAdminToy(this AdminToy toy, bool autoSync = true) + { + QualityHandler.Instance.QualityToysHandler.SetAsPickup(toy); + } + + public static void SetQuality(this AdminToy toy, ModelQuality modelQuality,bool autoSync = true) + { + QualityHandler.Instance.QualityToysHandler.SetQuality(toy, modelQuality); + } + } +} diff --git a/KruacentExiled/utils-merged/KE.Utilsmap/Extensions/NpcExtension.cs b/KruacentExiled/utils-merged/KE.Utilsmap/Extensions/NpcExtension.cs new file mode 100644 index 00000000..6af07bc5 --- /dev/null +++ b/KruacentExiled/utils-merged/KE.Utilsmap/Extensions/NpcExtension.cs @@ -0,0 +1,23 @@ +using CentralAuth; +using Exiled.API.Features; +using Mirror; +using PlayerRoles; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace KE.Utils.Extensions +{ + public static class NpcExtension + { + + + public static void Hide(this Npc npc) + { + npc.ReferenceHub.authManager.NetworkSyncedUserId = "ID_Dedicated"; + npc.ReferenceHub.authManager.syncMode = (SyncMode)ClientInstanceMode.DedicatedServer; + } + } +} diff --git a/KruacentExiled/utils-merged/KE.Utilsmap/Extensions/PlayerExtension.cs b/KruacentExiled/utils-merged/KE.Utilsmap/Extensions/PlayerExtension.cs new file mode 100644 index 00000000..b01f98d2 --- /dev/null +++ b/KruacentExiled/utils-merged/KE.Utilsmap/Extensions/PlayerExtension.cs @@ -0,0 +1,52 @@ +using CustomPlayerEffects; +using Exiled.API.Enums; +using Exiled.API.Features; +using Mirror; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using UnityEngine; + +namespace KE.Utils.Extensions +{ + public static class PlayerExtension + { + public static void SetFakeInvis(this Player p, IEnumerable viewers) + { + Vector3 pos = p.Position; + + try + { + p.ReferenceHub.transform.localPosition = Vector3.zero; + foreach (Player viewer in viewers) + { + Server.SendSpawnMessage.Invoke(null, new object[2] { viewer.NetworkIdentity, viewer.Connection }); + } + + p.ReferenceHub.transform.localPosition = pos; + } + catch (Exception arg) + { + Log.Error(string.Format("{0}: {1}", "SetFakeInvis", arg)); + } + } + + + + + public static void AddLevelEffect(this Player p,EffectType type, int intensity) + { + + + if (!p.TryGetEffect(type, out var effect)) + p.ChangeEffectIntensity(type, (byte)(effect.Intensity + intensity)); + else + p.EnableEffect(type, (byte)intensity); + } + + + + } +} diff --git a/KruacentExiled/utils-merged/KE.Utilsmap/Extensions/RoomExtension.cs b/KruacentExiled/utils-merged/KE.Utilsmap/Extensions/RoomExtension.cs new file mode 100644 index 00000000..35fee2e8 --- /dev/null +++ b/KruacentExiled/utils-merged/KE.Utilsmap/Extensions/RoomExtension.cs @@ -0,0 +1,12 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace KE.Utils.Extensions +{ + internal class RoomExtension + { + } +} diff --git a/KruacentExiled/utils-merged/KE.Utilsmap/KE.Utils.csproj b/KruacentExiled/utils-merged/KE.Utilsmap/KE.Utils.csproj new file mode 100644 index 00000000..aee2e596 --- /dev/null +++ b/KruacentExiled/utils-merged/KE.Utilsmap/KE.Utils.csproj @@ -0,0 +1,37 @@ + + + + 13.0 + net48 + + + + + + + + + + + + + + + + + + + + + + + + + if not "$(EXILED_DEV_REFERENCES)"=="" copy /y "$(OutputPath)$(AssemblyName).dll" "$(EXILED_DEV_REFERENCES)\Plugins\" + + + if [[ ! -z "$EXILED_DEV_REFERENCES" ]]; then cp "$(OutputPath)$(AssemblyName).dll" "$EXILED_DEV_REFERENCES/Plugins/"; fi + + + + diff --git a/KruacentExiled/utils-merged/KE.Utilsmap/Quality/Enums/ModelQuality.cs b/KruacentExiled/utils-merged/KE.Utilsmap/Quality/Enums/ModelQuality.cs new file mode 100644 index 00000000..d9d8d295 --- /dev/null +++ b/KruacentExiled/utils-merged/KE.Utilsmap/Quality/Enums/ModelQuality.cs @@ -0,0 +1,16 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace KE.Utils.Quality.Enums +{ + public enum ModelQuality + { + None = -1, + Low, + Medium, + High, + } +} diff --git a/KruacentExiled/utils-merged/KE.Utilsmap/Quality/Handlers/QualityToysHandler.cs b/KruacentExiled/utils-merged/KE.Utilsmap/Quality/Handlers/QualityToysHandler.cs new file mode 100644 index 00000000..b2485795 --- /dev/null +++ b/KruacentExiled/utils-merged/KE.Utilsmap/Quality/Handlers/QualityToysHandler.cs @@ -0,0 +1,179 @@ +using AdminToys; +using Exiled.API.Enums; +using Exiled.API.Extensions; +using Exiled.API.Features; +using Exiled.API.Features.Toys; +using KE.Utils.Quality.Enums; +using KE.Utils.Quality.Settings; +using MEC; +using System; +using System.Collections.Generic; +using System.Linq; +using UnityEngine; +using Light = Exiled.API.Features.Toys.Light; +using QualitySettings = KE.Utils.Quality.Settings.QualitySettings; + +namespace KE.Utils.Quality.Handlers +{ + public class QualityToysHandler + { + private HashSet _pickupToys = new(); + private Dictionary _qualityToys = new(); + public readonly Vector3 Gulag = new Vector3(15000, 15000, 15000); + public const float Delay = Timing.WaitForOneFrame; + public bool IsPickupToy(AdminToy primitive) + { + return _pickupToys.Contains(primitive); + } + + public bool IsQualityToy(AdminToy primitive) + { + return _qualityToys.ContainsKey(primitive); + } + + + public void SetAsPickup(AdminToy toy, bool autoSync = true) + { + if (!_pickupToys.Add(toy)) + { + Log.Warn($"AdminToy {toy} is already a pickupToy"); + return; + } + if (autoSync) + Sync(toy); + } + + public void SetQuality(AdminToy toy, ModelQuality quality, bool autoSync = true) + { + if (toy == null) return; + if (!_qualityToys.ContainsKey(toy)) + _qualityToys.Add(toy, quality); + else + _qualityToys[toy] = quality; + + if (autoSync) + Sync(toy); + } + + + + private void SendToFakePosition(AdminToy adminToy, Player player,Vector3 position) + { + //idk why but without delay it show all of the quality at once + Timing.CallDelayed(Delay, () => + { + if (adminToy is Light l) + { + player.SendFakeSyncVar(l.Base.netIdentity, typeof(LightSourceToy), nameof(LightSourceToy.NetworkPosition), position); + return; + } + if (adminToy is Primitive p) + { + player.SendFakeSyncVar(p.Base.netIdentity, typeof(PrimitiveObjectToy), nameof(PrimitiveObjectToy.NetworkPosition), position); + return; + } + }); + + } + + /// + /// Sync every Players + /// + public void Sync() + { + foreach (Player p in Player.List) + { + Sync(p); + } + } + + /// + /// Sync a specified Player + /// + /// + public void Sync(Player p) + { + + + + var quality = QualitySettings.Get(p); + var pickup = QualitySettings.PickmodelActivated(p); + + HashSet pickupToRemove = []; + HashSet qualityToRemove = []; + + //hide pickup toys + + foreach (AdminToy pk in _pickupToys) + { + try + { + if (pickup) + { + SendToFakePosition(pk, p, pk.Position); + } + else + { + SendToFakePosition(pk, p, Gulag); + } + } + catch (NullReferenceException) + { + //Log.Warn("removing pickup"); + pickupToRemove.Add(pk); + } + + } + + _pickupToys.RemoveWhere(p => pickupToRemove.Contains(p)); + + + foreach (var at in _qualityToys) + { + try + { + if ((at.Value == quality || at.Value == ModelQuality.None) && (pickup || !_pickupToys.Contains(at.Key))) + { + SendToFakePosition(at.Key, p, at.Key.Position); + } + else + { + SendToFakePosition(at.Key, p, Gulag); + } + } + catch (NullReferenceException) + { + //Log.Warn("removing quality" + _qualityToys.Count); + qualityToRemove.Add(at.Key); + } + + + } + foreach(var at in qualityToRemove) + { + + _qualityToys.Remove(at); + } + + } + + /// + /// Sync a specified AdminToy + /// + /// + public void Sync(AdminToy adminToy) + { + //temporary fix + Sync(); + + if (IsPickupToy(adminToy)) + { + + } + if (IsQualityToy(adminToy)) + { + + } + } + } +} diff --git a/KruacentExiled/utils-merged/KE.Utilsmap/Quality/Models/Base/BaseModel.cs b/KruacentExiled/utils-merged/KE.Utilsmap/Quality/Models/Base/BaseModel.cs new file mode 100644 index 00000000..c9f6723c --- /dev/null +++ b/KruacentExiled/utils-merged/KE.Utilsmap/Quality/Models/Base/BaseModel.cs @@ -0,0 +1,41 @@ +using Exiled.API.Enums; +using Exiled.API.Extensions; +using Exiled.API.Features.Toys; +using Exiled.API.Interfaces; +using KE.Utils.Quality.Structs; +using PlayerStatsSystem; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using UnityEngine; +using Light = Exiled.API.Features.Toys.Light; + +namespace KE.Utils.Quality.Models.Base +{ + + /// + /// The blocks to build a model with + /// + public abstract class BaseModel : ICloneable + { + + protected AdminToy _toy; + public AdminToy AdminToy { get { return _toy; } } + private Vector3 _position; + public Vector3 LocalPosition { get { return _position; } } + private Quaternion _rotation; + public Quaternion LocalRotation { get { return _rotation; } } + + + public BaseModel(Vector3 localPositon, Quaternion localRotation) + { + _position = localPositon; + _rotation = localRotation; + } + + public abstract object Clone(); + } + +} diff --git a/KruacentExiled/utils-merged/KE.Utilsmap/Quality/Models/Base/LightModel.cs b/KruacentExiled/utils-merged/KE.Utilsmap/Quality/Models/Base/LightModel.cs new file mode 100644 index 00000000..ce808da1 --- /dev/null +++ b/KruacentExiled/utils-merged/KE.Utilsmap/Quality/Models/Base/LightModel.cs @@ -0,0 +1,26 @@ +using Exiled.API.Features.Toys; +using UnityEngine; +using Light = Exiled.API.Features.Toys.Light; + +namespace KE.Utils.Quality.Models.Base +{ + public class LightModel : BaseModel + { + + /// + /// Create a new Light for modeling + /// + public LightModel(Vector3? scale, Color? color, Vector3 localPositon, Quaternion localRotation) : base(localPositon, localRotation) + { + Light light = Light.Create(null, null, scale, false, color); + _toy = light; + } + + + public override object Clone() + { + Light light = _toy as Light; + return new LightModel(light.Scale, light.Color, LocalPosition, LocalRotation); + } + } +} diff --git a/KruacentExiled/utils-merged/KE.Utilsmap/Quality/Models/Base/PrimitiveModel.cs b/KruacentExiled/utils-merged/KE.Utilsmap/Quality/Models/Base/PrimitiveModel.cs new file mode 100644 index 00000000..22e07225 --- /dev/null +++ b/KruacentExiled/utils-merged/KE.Utilsmap/Quality/Models/Base/PrimitiveModel.cs @@ -0,0 +1,26 @@ +using Exiled.API.Features.Toys; +using UnityEngine; +using Color = UnityEngine.Color; + +namespace KE.Utils.Quality.Models.Base +{ + public class PrimitiveModel : BaseModel + { + /// + /// Create a new Primitive for modeling + /// + public PrimitiveModel(PrimitiveType type, Vector3? scale, Color? color,Vector3 localPosition,Quaternion localRotation) : base(localPosition, localRotation) + { + + Primitive prim = Primitive.Create(type, null, null, scale, false, color); + prim.Collidable = false; + _toy = prim; + } + + public override object Clone() + { + Primitive prim = _toy as Primitive; + return new PrimitiveModel(prim.Type, prim.Scale, prim.Color, LocalPosition, LocalRotation); + } + } +} diff --git a/KruacentExiled/utils-merged/KE.Utilsmap/Quality/Models/Examples/MineModel.cs b/KruacentExiled/utils-merged/KE.Utilsmap/Quality/Models/Examples/MineModel.cs new file mode 100644 index 00000000..00d60fec --- /dev/null +++ b/KruacentExiled/utils-merged/KE.Utilsmap/Quality/Models/Examples/MineModel.cs @@ -0,0 +1,118 @@ +using KE.Utils.Quality.Enums; +using KE.Utils.Quality.Models.Base; +using System.Collections.Generic; +using UnityEngine; +using Light = Exiled.API.Features.Toys.Light; + +namespace KE.Utils.Quality.Models.Examples +{ + public abstract class MineModel : QualityModel + { + protected Light _light; + private bool _lightOn = false; + + + + + public void ToggleLight() + { + if (_light == null) throw new System.Exception("no light"); + if (_lightOn) + _light.UnSpawn(); + else + _light.Spawn(); + _lightOn = !_lightOn; + } + + } + + public class MineModelLow : MineModel + { + public override bool IsPickup => false; + public override ModelQuality Quality => ModelQuality.Low; + + protected override IEnumerable GetBaseModels() + { + Quaternion baseRotation = new(); + //spawn + offset + Vector3 offset = new Vector3(0, .05f); + Vector3 sizeDisk = new Vector3(.7f, 0.1f, .7f); + + Vector3 sizeGlobe = new Vector3(.1f, .1f, .1f); + Vector3 posLight = new Vector3(0, sizeDisk.y+sizeGlobe.y); + + + var baseMine = new PrimitiveModel(PrimitiveType.Cylinder, sizeDisk, Color.black, offset, baseRotation); + + var lightGlobe = new PrimitiveModel(PrimitiveType.Sphere, sizeGlobe , new Color(1, 0, 0, .33f), posLight, baseRotation); + + var lightMine = new LightModel(null, Color.red, posLight, baseRotation); + + _light = lightMine.AdminToy as Light; + _light.Intensity = .55f; + + return [baseMine, lightGlobe, lightMine]; + } + + + } + + public class MineModelMedium : MineModel + { + public override bool IsPickup => false; + public override ModelQuality Quality => ModelQuality.Medium; + + protected override IEnumerable GetBaseModels() + { + Quaternion baseRotation = new(); + //spawn + offset + Vector3 offset = new Vector3(0, .05f); + Vector3 sizeDisk = new Vector3(.7f, 0.1f, .7f); + + Vector3 sizeGlobe = new Vector3(.1f, .1f, .1f); + Vector3 posLight = new Vector3(0, sizeDisk.y + sizeGlobe.y); + + + var baseMine = new PrimitiveModel(PrimitiveType.Cylinder, sizeDisk, Color.black, offset, baseRotation); + + var lightGlobe = new PrimitiveModel(PrimitiveType.Sphere, sizeGlobe, new Color(1, 0, 0, .33f), posLight, baseRotation); + + var lightMine = new LightModel(null, Color.green, posLight, baseRotation); + + _light = lightMine.AdminToy as Light; + _light.Intensity = .55f; + + return [baseMine, lightGlobe, lightMine]; + } + } + + public class MineModelPickup : MineModel + { + public override bool IsPickup => true; + public override ModelQuality Quality => ModelQuality.None; + + + protected override IEnumerable GetBaseModels() + { + Quaternion baseRotation = new(); + //spawn + offset + Vector3 offset = new Vector3(0, .05f); + Vector3 sizeDisk = new Vector3(.7f, 0.1f, .7f); + + Vector3 sizeGlobe = new Vector3(.1f, .1f, .1f); + Vector3 posLight = new Vector3(0, sizeDisk.y + sizeGlobe.y); + + + var baseMine = new PrimitiveModel(PrimitiveType.Cylinder, sizeDisk, Color.black, offset, baseRotation); + + var lightGlobe = new PrimitiveModel(PrimitiveType.Sphere, sizeGlobe, new Color(1, 0, 0, .33f), posLight, baseRotation); + + var lightMine = new LightModel(null, Color.magenta, posLight, baseRotation); + + _light = lightMine.AdminToy as Light; + _light.Intensity = .55f; + + return [baseMine, lightGlobe, lightMine]; + } + } +} diff --git a/KruacentExiled/utils-merged/KE.Utilsmap/Quality/Models/Model.cs b/KruacentExiled/utils-merged/KE.Utilsmap/Quality/Models/Model.cs new file mode 100644 index 00000000..2e26756e --- /dev/null +++ b/KruacentExiled/utils-merged/KE.Utilsmap/Quality/Models/Model.cs @@ -0,0 +1,104 @@ +using Exiled.API.Features; +using Exiled.API.Features.Toys; +using KE.Utils.Quality.Models.Base; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using UnityEngine; + +namespace KE.Utils.Quality.Models +{ + public class Model : IEquatable + { + + + private Vector3 _position; + public Vector3 Position + { + get { return _position; } + set + { + _position = value; + } + } + private Quaternion _rotation; + public Quaternion Rotation + { + get { return _rotation; } + set + { + _rotation = value; + } + } + private ModelPrefab _prefab; + public ModelPrefab Prefab + { + get { return _prefab; } + } + + + + private HashSet _models; + + internal Model(ModelPrefab prefab, Vector3 position, Quaternion rotation,IEnumerable toys,bool spawn) + { + _prefab = prefab; + Position = position; + Rotation = rotation; + _models = new HashSet(toys); + QualityHandler.Instance.QualityToysHandler.Sync(); + + foreach (BaseModel based in toys) + { + AdminToy toy = based.AdminToy; + + if (toy is Primitive p) + p.Collidable = false; + toy.AdminToyBase.transform.position = based.LocalPosition + Position; + toy.AdminToyBase.transform.rotation = based.LocalRotation * Rotation; + } + if(spawn) + { + Spawn(); + } + } + + + public void Destroy() + { + foreach (BaseModel primitive in _models) + { + primitive.AdminToy.Destroy(); + } + } + public void UnSpawn() + { + foreach (BaseModel primitive in _models) + { + primitive.AdminToy.UnSpawn(); + } + } + public void Spawn() + { + QualityHandler.Instance.QualityToysHandler.Sync(); + foreach (BaseModel primitive in _models) + { + primitive.AdminToy.Spawn(); + } + + } + + + public bool Equals(Model x) + { + if (x == null) return false; + return x._prefab == _prefab && x.Position == Position && x.Rotation == Rotation; + } + public int GetHashCode(Model obj) + { + return obj.GetHashCode(); + } + } +} diff --git a/KruacentExiled/utils-merged/KE.Utilsmap/Quality/Models/ModelPrefab.cs b/KruacentExiled/utils-merged/KE.Utilsmap/Quality/Models/ModelPrefab.cs new file mode 100644 index 00000000..bbc39da4 --- /dev/null +++ b/KruacentExiled/utils-merged/KE.Utilsmap/Quality/Models/ModelPrefab.cs @@ -0,0 +1,42 @@ +using Exiled.API.Features; +using Exiled.API.Features.Core; +using Exiled.API.Features.Pickups; +using Exiled.API.Features.Toys; +using Exiled.API.Interfaces; +using KE.Utils.Extensions; +using KE.Utils.Quality.Models.Base; +using KE.Utils.Quality.Structs; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using UnityEngine; +using Light = Exiled.API.Features.Toys.Light; + +namespace KE.Utils.Quality.Models +{ + public abstract class ModelPrefab + { + + protected abstract IEnumerable GetBaseModels(); + + public virtual Model Create(Vector3 position,Quaternion rotation, bool spawn = true) + { + + HashSet clonetoys = new(); + HashSet toys = GetBaseModels().ToHashSet(); + foreach (BaseModel model in toys) + { + BaseModel clone = (BaseModel)model.Clone(); + clonetoys.Add(clone); + } + return new Model(this, position, rotation, clonetoys,spawn); + + } + + + + + } +} diff --git a/KruacentExiled/utils-merged/KE.Utilsmap/Quality/Models/QualityModel.cs b/KruacentExiled/utils-merged/KE.Utilsmap/Quality/Models/QualityModel.cs new file mode 100644 index 00000000..b5cc682f --- /dev/null +++ b/KruacentExiled/utils-merged/KE.Utilsmap/Quality/Models/QualityModel.cs @@ -0,0 +1,40 @@ +using Exiled.API.Features; +using Exiled.API.Features.Toys; +using KE.Utils.Extensions; +using KE.Utils.Quality.Enums; +using KE.Utils.Quality.Models.Base; +using System.Collections.Generic; +using System.Linq; +using UnityEngine; + +namespace KE.Utils.Quality.Models +{ + public abstract class QualityModel : ModelPrefab + { + public abstract ModelQuality Quality { get; } + public abstract bool IsPickup { get; } + + + + + public override sealed Model Create(Vector3 position, Quaternion rotation,bool spawn = true) + { + + HashSet clonetoys = new(); + HashSet toys = GetBaseModels().ToHashSet(); + foreach (BaseModel model in toys) + { + BaseModel clone = (BaseModel)model.Clone(); + + if (IsPickup) + clone.AdminToy.SetAsPickupAdminToy(false); + + clone.AdminToy.SetQuality(Quality,false); + clonetoys.Add(clone); + } + QualityHandler.Sync(); + return new Model(this,position, rotation, clonetoys, spawn); + } + + } +} diff --git a/KruacentExiled/utils-merged/KE.Utilsmap/Quality/QualityHandler.cs b/KruacentExiled/utils-merged/KE.Utilsmap/Quality/QualityHandler.cs new file mode 100644 index 00000000..235d79c9 --- /dev/null +++ b/KruacentExiled/utils-merged/KE.Utilsmap/Quality/QualityHandler.cs @@ -0,0 +1,61 @@ +using Exiled.API.Features; +using Exiled.API.Features.Core.UserSettings; +using KE.Utils.Quality.Handlers; +using KE.Utils.Quality.Settings; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace KE.Utils.Quality +{ + [Obsolete("scrapped", false)] + internal class QualityHandler + { + public QualitySettings QualitySettings { get; private set; } + public QualityToysHandler QualityToysHandler { get; private set; } + + private static QualityHandler _instance; + public static QualityHandler Instance + { + get + { + if(_instance == null ) + _instance = new QualityHandler(); + return _instance; + } + } + private QualityHandler() + { + QualitySettings = new QualitySettings(Changed); + QualityToysHandler = new QualityToysHandler(); + } + + ~QualityHandler() + { + QualityToysHandler = null; + QualitySettings = null; + } + + public void Changed(Player p, SettingBase _) + { + QualityToysHandler.Sync(p); + } + + public void Register() + { + QualitySettings.Register(); + } + + public void Unregister() + { + QualitySettings.Unregister(); + } + + public static void Sync() + { + Instance.QualityToysHandler.Sync(); + } + } +} diff --git a/KruacentExiled/utils-merged/KE.Utilsmap/Quality/QualityToysHandler.cs b/KruacentExiled/utils-merged/KE.Utilsmap/Quality/QualityToysHandler.cs new file mode 100644 index 00000000..27320233 --- /dev/null +++ b/KruacentExiled/utils-merged/KE.Utilsmap/Quality/QualityToysHandler.cs @@ -0,0 +1,155 @@ +using AdminToys; +using Exiled.API.Enums; +using Exiled.API.Extensions; +using Exiled.API.Features; +using Exiled.API.Features.Toys; +using KE.Utils.Quality.Enums; +using KE.Utils.Quality.Settings; +using System.Collections.Generic; +using System.Linq; +using UnityEngine; +using Light = Exiled.API.Features.Toys.Light; +using QualitySettings = KE.Utils.Quality.Settings.QualitySettings; + +namespace KE.Utils.Quality +{ + public class QualityToysHandler + { + private HashSet _pickupToys = new(); + private Dictionary _qualityToys = new(); + public readonly Vector3 Gulag = new Vector3(15000,15000,15000); + + public bool IsPickupToy(AdminToy primitive) + { + return _pickupToys.Contains(primitive); + } + + public bool IsQualityToy(AdminToy primitive) + { + return _qualityToys.ContainsKey(primitive); + } + + + public void SetAsPickup(AdminToy toy) + { + if (!_pickupToys.Add(toy)) + { + Log.Warn($"AdminToy {toy} is already a pickupToy"); + return; + } + } + + public void SetQuality(AdminToy toy,ModelQuality quality) + { + if (toy == null) return; + if (!_qualityToys.ContainsKey(toy)) + _qualityToys.Add(toy,quality); + else + _qualityToys[toy] = quality; + } + + + + private void SendToShadowRealm(AdminToy adminToy, Player player) + { + if(adminToy is Light l) + { + player.SendFakeSyncVar(l.Base.netIdentity, typeof(LightSourceToy), nameof(LightSourceToy.NetworkPosition), Gulag); + return; + } + if(adminToy is Primitive p) + { + player.SendFakeSyncVar(p.Base.netIdentity, typeof(PrimitiveObjectToy), nameof(PrimitiveObjectToy.NetworkPosition), Gulag); + return; + } + } + + private void SetTruePosition(AdminToy adminToy, Player player) + { + if (adminToy is Light l) + { + player.SendFakeSyncVar(l.Base.netIdentity, typeof(LightSourceToy), nameof(LightSourceToy.NetworkPosition), l.Position); + return; + } + if (adminToy is Primitive p) + { + player.SendFakeSyncVar(p.Base.netIdentity, typeof(PrimitiveObjectToy), nameof(PrimitiveObjectToy.NetworkPosition), p.Position); + return; + } + } + + /// + /// Sync every Players + /// + public void Sync() + { + foreach(Player p in Player.List) + { + Sync(p); + } + } + + /// + /// Sync a specified Player + /// + /// + public void Sync(Player p) + { + var quality = QualitySettings.Get(p); + var pickup = QualitySettings.PickmodelActivated(p); + + if (!pickup) + { + //hide pickup toys + foreach (AdminToy pk in _pickupToys) + { + SendToShadowRealm(pk, p); + } + } + else + { + //show pickup toys + foreach (AdminToy pk in _pickupToys) + { + SetTruePosition(pk, p); + } + } + + + + + foreach(var at in _qualityToys) + { + if(at.Value == quality) + { + if (pickup || !_pickupToys.Contains(at.Key)) + { + SetTruePosition(at.Key, p); + } + } + else + { + SendToShadowRealm(at.Key, p); + } + + } + + } + + /// + /// Sync a specified AdminToy + /// + /// + public void Sync(AdminToy adminToy) + { + if (IsPickupToy(adminToy)) + { + + } + if (IsQualityToy(adminToy)) + { + + } + } + } +} diff --git a/KruacentExiled/utils-merged/KE.Utilsmap/Quality/Settings/QualitySettings.cs b/KruacentExiled/utils-merged/KE.Utilsmap/Quality/Settings/QualitySettings.cs new file mode 100644 index 00000000..ca8d49be --- /dev/null +++ b/KruacentExiled/utils-merged/KE.Utilsmap/Quality/Settings/QualitySettings.cs @@ -0,0 +1,62 @@ +using Exiled.API.Features; +using Exiled.API.Features.Core.UserSettings; +using KE.Utils.Quality.Enums; +using System; + +namespace KE.Utils.Quality.Settings +{ + public class QualitySettings + { + + private static int _idQuality = 0; + private static int _idModels = 1; + private static int _idSlider = 2; + private SettingBase[] _settings; + public QualitySettings(Action onChanged) + { + HeaderSetting header = new("Quality Settings"); + _settings = + [ + header, + new DropdownSetting(_idQuality,"ModelQuality",["Low","Medium", "High"],onChanged:onChanged), + new TwoButtonsSetting(_idModels,"Pickup models","Disabled","Enabled", onChanged:onChanged) + ]; + } + + public void Register() + { + SettingBase.Register(_settings); + SettingBase.SendToAll(); + } + + public void Unregister() + { + SettingBase.Unregister(settings:_settings); + } + + + + + public static ModelQuality Get(Player p) + { + if (!SettingBase.TryGetSetting(p, _idQuality, out var setting)) return ModelQuality.None; + + return setting.SelectedOption switch + { + "Low" => ModelQuality.Low, + "Medium" => ModelQuality.Medium, + "High" => ModelQuality.High, + _ => ModelQuality.None, + }; + } + + + public static bool PickmodelActivated(Player p) + { + if (!SettingBase.TryGetSetting(p, _idModels, out var setting)) return false; + return setting.IsSecond; + } + + + } +} diff --git a/KruacentExiled/utils-merged/KE.Utilsmap/Quality/Structs/LocalWorldSpace.cs b/KruacentExiled/utils-merged/KE.Utilsmap/Quality/Structs/LocalWorldSpace.cs new file mode 100644 index 00000000..d9c6205b --- /dev/null +++ b/KruacentExiled/utils-merged/KE.Utilsmap/Quality/Structs/LocalWorldSpace.cs @@ -0,0 +1,23 @@ +using Exiled.API.Interfaces; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using UnityEngine; + +namespace KE.Utils.Quality.Structs +{ + public readonly struct LocalWorldSpace : IWorldSpace + { + + public Vector3 Position { get; } + public Quaternion Rotation { get; } + + public LocalWorldSpace(Vector3 position, Quaternion rotation) + { + Position = position; + Rotation = rotation; + } + } +} diff --git a/KruacentExiled/utils-merged/KE.Utilsmap/Quality/Tests/Test.cs b/KruacentExiled/utils-merged/KE.Utilsmap/Quality/Tests/Test.cs new file mode 100644 index 00000000..6ebd3f66 --- /dev/null +++ b/KruacentExiled/utils-merged/KE.Utilsmap/Quality/Tests/Test.cs @@ -0,0 +1,108 @@ +using Exiled.API.Extensions; +using Exiled.API.Features; +using Exiled.API.Features.Toys; +using KE.Utils.Quality.Models; +using KE.Utils.Quality.Models.Examples; +using MEC; +using PlayerRoles; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using UnityEngine; + +namespace KE.Utils.Quality.Tests +{ + public class Test + { + private QualityHandler QualityHandler; + + + private Test(QualityHandler q) + { + QualityHandler = q; + try + { + TestMine(); + } + catch (Exception ex) + { + Log.Error("Exception for TestMine :\n"+ex); + } + + } + internal void TestQuality() + { + Vector3 pos = RoleTypeId.Scp049.GetRandomSpawnLocation().Position; + Primitive c = Primitive.Create(pos); + c.Color = Color.red; + Primitive c2 = Primitive.Create(pos + Vector3.one); + c2.Color = Color.green; + + + QualityHandler.QualityToysHandler.SetQuality(c, Enums.ModelQuality.Low); + QualityHandler.QualityToysHandler.SetQuality(c2, Enums.ModelQuality.Medium); + } + + internal void StressTest(int count) + { + Timing.RunCoroutine(Stress(count)); + } + + + private IEnumerator Stress(int count) + { + Vector3 pos = RoleTypeId.Scp049.GetRandomSpawnLocation().Position; + Vector3 scale = new Vector3(.1f, .1f, .1f); + float maxSpread = 5; + for (int i = 0; i < count; i++) + { + Primitive c = Primitive.Create(pos + new Vector3(UnityEngine.Random.Range(0f, maxSpread), UnityEngine.Random.Range(0f, maxSpread), UnityEngine.Random.Range(0f, maxSpread)), scale: scale); + QualityHandler.QualityToysHandler.SetQuality(c, Enums.ModelQuality.Medium); + } + QualityHandler.QualityToysHandler.Sync(); + yield return 0; + } + + public void TestMine() + { + Log.Info("TestMine"); + Vector3 pos = RoleTypeId.Scp049.GetRandomSpawnLocation().Position; + MineModelLow mml = new(); + + + Model m = mml.Create(pos, new Quaternion()); + m.Spawn(); + + + MineModelMedium mmm = new(); + + m = mmm.Create(pos + Vector3.up, new Quaternion()); + m.Spawn(); + + + MineModelPickup mmp = new(); + m = mmp.Create(pos + Vector3.right, new Quaternion()); + m.Spawn(); + + QualityHandler.Sync(); + + + + + + + + + foreach (var item in Player.List) + { + item.Teleport(pos); + } + + + + + } + } +} diff --git a/KruacentExiled/utils-merged/KE.Utilsmisc/API/Displays/DisplayMeow/DisplayHandler.cs b/KruacentExiled/utils-merged/KE.Utilsmisc/API/Displays/DisplayMeow/DisplayHandler.cs new file mode 100644 index 00000000..4ee13535 --- /dev/null +++ b/KruacentExiled/utils-merged/KE.Utilsmisc/API/Displays/DisplayMeow/DisplayHandler.cs @@ -0,0 +1,67 @@ +using Exiled.API.Features; +using HintServiceMeow.Core.Extension; +using HintServiceMeow.Core.Models.Hints; +using HintServiceMeow.Core.Utilities; +using MEC; + + +//damn why the same name +using MHint = HintServiceMeow.Core.Models.Hints.Hint; + +namespace KE.Utils.API.Displays.DisplayMeow +{ + public class DisplayHandler + { + public static DisplayHandler Instance { get; } = new(); + + private DisplayHandler() { } + + + + + + + public MHint AddHint(HintPlacement hintPlacement, Player player, string text, float delay) + { + var dis = PlayerDisplay.Get(player); + string id = $"{player.Id}_{hintPlacement.XCoordinate}_{hintPlacement.YCoordinate}"; + MHint hint; + + if (!dis.TryGetHint(id, out var aHint)) + { + hint = new() + { + Text = text, + XCoordinate = hintPlacement.XCoordinate, + YCoordinate = hintPlacement.YCoordinate, + Alignment = hintPlacement.HintAlignment, + Id = id + + }; + dis.AddHint(hint); + + } + else + { + + hint = (MHint)aHint; + hint.Hide = false; + hint.Text = text; + } + + + hint.HideAfter(delay); + return hint; + } + + + + + + + + + + + } +} diff --git a/KruacentExiled/utils-merged/KE.Utilsmisc/API/Displays/DisplayMeow/HintPlacement.cs b/KruacentExiled/utils-merged/KE.Utilsmisc/API/Displays/DisplayMeow/HintPlacement.cs new file mode 100644 index 00000000..936cdbe9 --- /dev/null +++ b/KruacentExiled/utils-merged/KE.Utilsmisc/API/Displays/DisplayMeow/HintPlacement.cs @@ -0,0 +1,31 @@ +using HintServiceMeow.Core.Enum; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace KE.Utils.API.Displays.DisplayMeow +{ + public readonly struct HintPlacement : IEquatable + { + public float YCoordinate { get; } + public float XCoordinate { get; } + public HintAlignment HintAlignment { get; } = HintAlignment.Center; + + + public bool Equals(HintPlacement obj) + { + return YCoordinate == obj.YCoordinate && XCoordinate == obj.XCoordinate; + } + + + public HintPlacement(float xCoordinate, float yCoordinate, HintAlignment alignment = HintAlignment.Center) + { + YCoordinate = yCoordinate; + XCoordinate = xCoordinate; + HintAlignment = alignment; + } + + } +} diff --git a/KruacentExiled/utils-merged/KE.Utilsmisc/API/Interfaces/IEvents.cs b/KruacentExiled/utils-merged/KE.Utilsmisc/API/Interfaces/IEvents.cs new file mode 100644 index 00000000..e573b062 --- /dev/null +++ b/KruacentExiled/utils-merged/KE.Utilsmisc/API/Interfaces/IEvents.cs @@ -0,0 +1,17 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace KE.Utils.API.Interfaces +{ + public interface IUsingEvents + { + + + public void SubscribeEvents(); + + public void UnsubscribeEvents(); + } +} diff --git a/KruacentExiled/utils-merged/KE.Utilsmisc/API/ReflectionHelper.cs b/KruacentExiled/utils-merged/KE.Utilsmisc/API/ReflectionHelper.cs new file mode 100644 index 00000000..2f00fbb1 --- /dev/null +++ b/KruacentExiled/utils-merged/KE.Utilsmisc/API/ReflectionHelper.cs @@ -0,0 +1,47 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Reflection; +using System.Text; +using System.Threading.Tasks; + +namespace KE.Utils.API +{ + public static class ReflectionHelper + { + public static IEnumerable GetObjects(Assembly assembly = null) + { + List result = new(); + if (assembly == null) + { + assembly = Assembly.GetCallingAssembly(); + } + foreach (Type t in assembly.GetTypes()) + { + try + { + if (typeof(T).IsAssignableFrom(t) && !t.IsAbstract) + { + T ffcc = (T)Activator.CreateInstance(t); + result.Add(ffcc); + } + } + catch (Exception) + { + + } + } + return result; + } + + public static IEnumerable GetObjects(IEnumerable assemblies) + { + List result = new(); + foreach(Assembly assembly in assemblies) + { + result.AddRange(GetObjects(assembly)); + } + return result; + } + } +} diff --git a/KruacentExiled/utils-merged/KE.Utilsmisc/Extensions/AdminToyExtension.cs b/KruacentExiled/utils-merged/KE.Utilsmisc/Extensions/AdminToyExtension.cs new file mode 100644 index 00000000..5eee9c7b --- /dev/null +++ b/KruacentExiled/utils-merged/KE.Utilsmisc/Extensions/AdminToyExtension.cs @@ -0,0 +1,29 @@ +using AdminToys; +using Exiled.API.Features; +using Exiled.API.Features.Toys; +using KE.Utils.Quality; +using KE.Utils.Quality.Enums; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using UnityEngine; + +namespace KE.Utils.Extensions +{ + public static class AdminToyExtension + { + + public static void SetAsPickupAdminToy(this AdminToy toy, bool autoSync = true) + { + QualityHandler.Instance.QualityToysHandler.SetAsPickup(toy); + } + + public static void SetQuality(this AdminToy toy, ModelQuality modelQuality,bool autoSync = true) + { + QualityHandler.Instance.QualityToysHandler.SetQuality(toy, modelQuality); + } + + } +} diff --git a/KruacentExiled/utils-merged/KE.Utilsmisc/Extensions/DoorExtension.cs b/KruacentExiled/utils-merged/KE.Utilsmisc/Extensions/DoorExtension.cs new file mode 100644 index 00000000..2c8bf677 --- /dev/null +++ b/KruacentExiled/utils-merged/KE.Utilsmisc/Extensions/DoorExtension.cs @@ -0,0 +1,14 @@ +using Exiled.API.Features; +using Exiled.API.Features.Doors; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace KE.Utils.Extensions +{ + public static class DoorExtension + { + } +} diff --git a/KruacentExiled/utils-merged/KE.Utilsmisc/Extensions/PlayerExtension.cs b/KruacentExiled/utils-merged/KE.Utilsmisc/Extensions/PlayerExtension.cs new file mode 100644 index 00000000..b01f98d2 --- /dev/null +++ b/KruacentExiled/utils-merged/KE.Utilsmisc/Extensions/PlayerExtension.cs @@ -0,0 +1,52 @@ +using CustomPlayerEffects; +using Exiled.API.Enums; +using Exiled.API.Features; +using Mirror; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using UnityEngine; + +namespace KE.Utils.Extensions +{ + public static class PlayerExtension + { + public static void SetFakeInvis(this Player p, IEnumerable viewers) + { + Vector3 pos = p.Position; + + try + { + p.ReferenceHub.transform.localPosition = Vector3.zero; + foreach (Player viewer in viewers) + { + Server.SendSpawnMessage.Invoke(null, new object[2] { viewer.NetworkIdentity, viewer.Connection }); + } + + p.ReferenceHub.transform.localPosition = pos; + } + catch (Exception arg) + { + Log.Error(string.Format("{0}: {1}", "SetFakeInvis", arg)); + } + } + + + + + public static void AddLevelEffect(this Player p,EffectType type, int intensity) + { + + + if (!p.TryGetEffect(type, out var effect)) + p.ChangeEffectIntensity(type, (byte)(effect.Intensity + intensity)); + else + p.EnableEffect(type, (byte)intensity); + } + + + + } +} diff --git a/KruacentExiled/utils-merged/KE.Utilsmisc/Extensions/RoomExtensions.cs b/KruacentExiled/utils-merged/KE.Utilsmisc/Extensions/RoomExtensions.cs new file mode 100644 index 00000000..61fd0291 --- /dev/null +++ b/KruacentExiled/utils-merged/KE.Utilsmisc/Extensions/RoomExtensions.cs @@ -0,0 +1,55 @@ +using Exiled.API.Features; +using Exiled.API.Enums; +using Discord; +using System.Linq; +using Exiled.API.Extensions; + +namespace KE.Utils.Extensions +{ + public static class RoomExtensions + { + + + public static Room RandomSafeRoom(this ZoneType zone) + { + return Room.List.Where(r => r.IsSafe() && r.Zone == zone).GetRandomValue(); + } + + + /// + /// Check if a is Safe (Decontamination,Warhead) + /// + /// Note: Does NOT check if the is safe to teleport in (ex : TestRoom) + /// + /// + /// return true if the is safe for a ; false otherwise + public static bool IsSafe(this Room room) + { + return room.Zone.IsSafe(); + } + + + /// + /// Check if a is Safe (Decontamination,Warhead) + /// + /// return true if the zone is safe for a ; false otherwise + public static bool IsSafe(this ZoneType zone) + { + bool result = true; + if (zone == ZoneType.LightContainment) + result = Map.DecontaminationState < DecontaminationState.Countdown; + switch (zone) + { + case ZoneType.LightContainment: + case ZoneType.HeavyContainment: + case ZoneType.Entrance: + result = !Warhead.IsDetonated; + break; + } + return result; + } + + + + } +} diff --git a/KruacentExiled/utils-merged/KE.Utilsmisc/KE.Utils.csproj b/KruacentExiled/utils-merged/KE.Utilsmisc/KE.Utils.csproj new file mode 100644 index 00000000..cc1affca --- /dev/null +++ b/KruacentExiled/utils-merged/KE.Utilsmisc/KE.Utils.csproj @@ -0,0 +1,30 @@ + + + + 13.0 + net48 + + + + + + + + + + + + + + + + + + if not "$(EXILED_DEV_REFERENCES)"=="" copy /y "$(OutputPath)$(AssemblyName).dll" "$(EXILED_DEV_REFERENCES)\Plugins\" + + + if [[ ! -z "$EXILED_DEV_REFERENCES" ]]; then cp "$(OutputPath)$(AssemblyName).dll" "$EXILED_DEV_REFERENCES/Plugins/"; fi + + + + diff --git a/KruacentExiled/utils-merged/KE.Utilsmisc/Quality/Enums/ModelQuality.cs b/KruacentExiled/utils-merged/KE.Utilsmisc/Quality/Enums/ModelQuality.cs new file mode 100644 index 00000000..d9d8d295 --- /dev/null +++ b/KruacentExiled/utils-merged/KE.Utilsmisc/Quality/Enums/ModelQuality.cs @@ -0,0 +1,16 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace KE.Utils.Quality.Enums +{ + public enum ModelQuality + { + None = -1, + Low, + Medium, + High, + } +} diff --git a/KruacentExiled/utils-merged/KE.Utilsmisc/Quality/Handlers/QualityToysHandler.cs b/KruacentExiled/utils-merged/KE.Utilsmisc/Quality/Handlers/QualityToysHandler.cs new file mode 100644 index 00000000..b2485795 --- /dev/null +++ b/KruacentExiled/utils-merged/KE.Utilsmisc/Quality/Handlers/QualityToysHandler.cs @@ -0,0 +1,179 @@ +using AdminToys; +using Exiled.API.Enums; +using Exiled.API.Extensions; +using Exiled.API.Features; +using Exiled.API.Features.Toys; +using KE.Utils.Quality.Enums; +using KE.Utils.Quality.Settings; +using MEC; +using System; +using System.Collections.Generic; +using System.Linq; +using UnityEngine; +using Light = Exiled.API.Features.Toys.Light; +using QualitySettings = KE.Utils.Quality.Settings.QualitySettings; + +namespace KE.Utils.Quality.Handlers +{ + public class QualityToysHandler + { + private HashSet _pickupToys = new(); + private Dictionary _qualityToys = new(); + public readonly Vector3 Gulag = new Vector3(15000, 15000, 15000); + public const float Delay = Timing.WaitForOneFrame; + public bool IsPickupToy(AdminToy primitive) + { + return _pickupToys.Contains(primitive); + } + + public bool IsQualityToy(AdminToy primitive) + { + return _qualityToys.ContainsKey(primitive); + } + + + public void SetAsPickup(AdminToy toy, bool autoSync = true) + { + if (!_pickupToys.Add(toy)) + { + Log.Warn($"AdminToy {toy} is already a pickupToy"); + return; + } + if (autoSync) + Sync(toy); + } + + public void SetQuality(AdminToy toy, ModelQuality quality, bool autoSync = true) + { + if (toy == null) return; + if (!_qualityToys.ContainsKey(toy)) + _qualityToys.Add(toy, quality); + else + _qualityToys[toy] = quality; + + if (autoSync) + Sync(toy); + } + + + + private void SendToFakePosition(AdminToy adminToy, Player player,Vector3 position) + { + //idk why but without delay it show all of the quality at once + Timing.CallDelayed(Delay, () => + { + if (adminToy is Light l) + { + player.SendFakeSyncVar(l.Base.netIdentity, typeof(LightSourceToy), nameof(LightSourceToy.NetworkPosition), position); + return; + } + if (adminToy is Primitive p) + { + player.SendFakeSyncVar(p.Base.netIdentity, typeof(PrimitiveObjectToy), nameof(PrimitiveObjectToy.NetworkPosition), position); + return; + } + }); + + } + + /// + /// Sync every Players + /// + public void Sync() + { + foreach (Player p in Player.List) + { + Sync(p); + } + } + + /// + /// Sync a specified Player + /// + /// + public void Sync(Player p) + { + + + + var quality = QualitySettings.Get(p); + var pickup = QualitySettings.PickmodelActivated(p); + + HashSet pickupToRemove = []; + HashSet qualityToRemove = []; + + //hide pickup toys + + foreach (AdminToy pk in _pickupToys) + { + try + { + if (pickup) + { + SendToFakePosition(pk, p, pk.Position); + } + else + { + SendToFakePosition(pk, p, Gulag); + } + } + catch (NullReferenceException) + { + //Log.Warn("removing pickup"); + pickupToRemove.Add(pk); + } + + } + + _pickupToys.RemoveWhere(p => pickupToRemove.Contains(p)); + + + foreach (var at in _qualityToys) + { + try + { + if ((at.Value == quality || at.Value == ModelQuality.None) && (pickup || !_pickupToys.Contains(at.Key))) + { + SendToFakePosition(at.Key, p, at.Key.Position); + } + else + { + SendToFakePosition(at.Key, p, Gulag); + } + } + catch (NullReferenceException) + { + //Log.Warn("removing quality" + _qualityToys.Count); + qualityToRemove.Add(at.Key); + } + + + } + foreach(var at in qualityToRemove) + { + + _qualityToys.Remove(at); + } + + } + + /// + /// Sync a specified AdminToy + /// + /// + public void Sync(AdminToy adminToy) + { + //temporary fix + Sync(); + + if (IsPickupToy(adminToy)) + { + + } + if (IsQualityToy(adminToy)) + { + + } + } + } +} diff --git a/KruacentExiled/utils-merged/KE.Utilsmisc/Quality/Models/Base/BaseModel.cs b/KruacentExiled/utils-merged/KE.Utilsmisc/Quality/Models/Base/BaseModel.cs new file mode 100644 index 00000000..c9f6723c --- /dev/null +++ b/KruacentExiled/utils-merged/KE.Utilsmisc/Quality/Models/Base/BaseModel.cs @@ -0,0 +1,41 @@ +using Exiled.API.Enums; +using Exiled.API.Extensions; +using Exiled.API.Features.Toys; +using Exiled.API.Interfaces; +using KE.Utils.Quality.Structs; +using PlayerStatsSystem; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using UnityEngine; +using Light = Exiled.API.Features.Toys.Light; + +namespace KE.Utils.Quality.Models.Base +{ + + /// + /// The blocks to build a model with + /// + public abstract class BaseModel : ICloneable + { + + protected AdminToy _toy; + public AdminToy AdminToy { get { return _toy; } } + private Vector3 _position; + public Vector3 LocalPosition { get { return _position; } } + private Quaternion _rotation; + public Quaternion LocalRotation { get { return _rotation; } } + + + public BaseModel(Vector3 localPositon, Quaternion localRotation) + { + _position = localPositon; + _rotation = localRotation; + } + + public abstract object Clone(); + } + +} diff --git a/KruacentExiled/utils-merged/KE.Utilsmisc/Quality/Models/Base/LightModel.cs b/KruacentExiled/utils-merged/KE.Utilsmisc/Quality/Models/Base/LightModel.cs new file mode 100644 index 00000000..ce808da1 --- /dev/null +++ b/KruacentExiled/utils-merged/KE.Utilsmisc/Quality/Models/Base/LightModel.cs @@ -0,0 +1,26 @@ +using Exiled.API.Features.Toys; +using UnityEngine; +using Light = Exiled.API.Features.Toys.Light; + +namespace KE.Utils.Quality.Models.Base +{ + public class LightModel : BaseModel + { + + /// + /// Create a new Light for modeling + /// + public LightModel(Vector3? scale, Color? color, Vector3 localPositon, Quaternion localRotation) : base(localPositon, localRotation) + { + Light light = Light.Create(null, null, scale, false, color); + _toy = light; + } + + + public override object Clone() + { + Light light = _toy as Light; + return new LightModel(light.Scale, light.Color, LocalPosition, LocalRotation); + } + } +} diff --git a/KruacentExiled/utils-merged/KE.Utilsmisc/Quality/Models/Base/PrimitiveModel.cs b/KruacentExiled/utils-merged/KE.Utilsmisc/Quality/Models/Base/PrimitiveModel.cs new file mode 100644 index 00000000..22e07225 --- /dev/null +++ b/KruacentExiled/utils-merged/KE.Utilsmisc/Quality/Models/Base/PrimitiveModel.cs @@ -0,0 +1,26 @@ +using Exiled.API.Features.Toys; +using UnityEngine; +using Color = UnityEngine.Color; + +namespace KE.Utils.Quality.Models.Base +{ + public class PrimitiveModel : BaseModel + { + /// + /// Create a new Primitive for modeling + /// + public PrimitiveModel(PrimitiveType type, Vector3? scale, Color? color,Vector3 localPosition,Quaternion localRotation) : base(localPosition, localRotation) + { + + Primitive prim = Primitive.Create(type, null, null, scale, false, color); + prim.Collidable = false; + _toy = prim; + } + + public override object Clone() + { + Primitive prim = _toy as Primitive; + return new PrimitiveModel(prim.Type, prim.Scale, prim.Color, LocalPosition, LocalRotation); + } + } +} diff --git a/KruacentExiled/utils-merged/KE.Utilsmisc/Quality/Models/Examples/MineModel.cs b/KruacentExiled/utils-merged/KE.Utilsmisc/Quality/Models/Examples/MineModel.cs new file mode 100644 index 00000000..00d60fec --- /dev/null +++ b/KruacentExiled/utils-merged/KE.Utilsmisc/Quality/Models/Examples/MineModel.cs @@ -0,0 +1,118 @@ +using KE.Utils.Quality.Enums; +using KE.Utils.Quality.Models.Base; +using System.Collections.Generic; +using UnityEngine; +using Light = Exiled.API.Features.Toys.Light; + +namespace KE.Utils.Quality.Models.Examples +{ + public abstract class MineModel : QualityModel + { + protected Light _light; + private bool _lightOn = false; + + + + + public void ToggleLight() + { + if (_light == null) throw new System.Exception("no light"); + if (_lightOn) + _light.UnSpawn(); + else + _light.Spawn(); + _lightOn = !_lightOn; + } + + } + + public class MineModelLow : MineModel + { + public override bool IsPickup => false; + public override ModelQuality Quality => ModelQuality.Low; + + protected override IEnumerable GetBaseModels() + { + Quaternion baseRotation = new(); + //spawn + offset + Vector3 offset = new Vector3(0, .05f); + Vector3 sizeDisk = new Vector3(.7f, 0.1f, .7f); + + Vector3 sizeGlobe = new Vector3(.1f, .1f, .1f); + Vector3 posLight = new Vector3(0, sizeDisk.y+sizeGlobe.y); + + + var baseMine = new PrimitiveModel(PrimitiveType.Cylinder, sizeDisk, Color.black, offset, baseRotation); + + var lightGlobe = new PrimitiveModel(PrimitiveType.Sphere, sizeGlobe , new Color(1, 0, 0, .33f), posLight, baseRotation); + + var lightMine = new LightModel(null, Color.red, posLight, baseRotation); + + _light = lightMine.AdminToy as Light; + _light.Intensity = .55f; + + return [baseMine, lightGlobe, lightMine]; + } + + + } + + public class MineModelMedium : MineModel + { + public override bool IsPickup => false; + public override ModelQuality Quality => ModelQuality.Medium; + + protected override IEnumerable GetBaseModels() + { + Quaternion baseRotation = new(); + //spawn + offset + Vector3 offset = new Vector3(0, .05f); + Vector3 sizeDisk = new Vector3(.7f, 0.1f, .7f); + + Vector3 sizeGlobe = new Vector3(.1f, .1f, .1f); + Vector3 posLight = new Vector3(0, sizeDisk.y + sizeGlobe.y); + + + var baseMine = new PrimitiveModel(PrimitiveType.Cylinder, sizeDisk, Color.black, offset, baseRotation); + + var lightGlobe = new PrimitiveModel(PrimitiveType.Sphere, sizeGlobe, new Color(1, 0, 0, .33f), posLight, baseRotation); + + var lightMine = new LightModel(null, Color.green, posLight, baseRotation); + + _light = lightMine.AdminToy as Light; + _light.Intensity = .55f; + + return [baseMine, lightGlobe, lightMine]; + } + } + + public class MineModelPickup : MineModel + { + public override bool IsPickup => true; + public override ModelQuality Quality => ModelQuality.None; + + + protected override IEnumerable GetBaseModels() + { + Quaternion baseRotation = new(); + //spawn + offset + Vector3 offset = new Vector3(0, .05f); + Vector3 sizeDisk = new Vector3(.7f, 0.1f, .7f); + + Vector3 sizeGlobe = new Vector3(.1f, .1f, .1f); + Vector3 posLight = new Vector3(0, sizeDisk.y + sizeGlobe.y); + + + var baseMine = new PrimitiveModel(PrimitiveType.Cylinder, sizeDisk, Color.black, offset, baseRotation); + + var lightGlobe = new PrimitiveModel(PrimitiveType.Sphere, sizeGlobe, new Color(1, 0, 0, .33f), posLight, baseRotation); + + var lightMine = new LightModel(null, Color.magenta, posLight, baseRotation); + + _light = lightMine.AdminToy as Light; + _light.Intensity = .55f; + + return [baseMine, lightGlobe, lightMine]; + } + } +} diff --git a/KruacentExiled/utils-merged/KE.Utilsmisc/Quality/Models/Model.cs b/KruacentExiled/utils-merged/KE.Utilsmisc/Quality/Models/Model.cs new file mode 100644 index 00000000..2e26756e --- /dev/null +++ b/KruacentExiled/utils-merged/KE.Utilsmisc/Quality/Models/Model.cs @@ -0,0 +1,104 @@ +using Exiled.API.Features; +using Exiled.API.Features.Toys; +using KE.Utils.Quality.Models.Base; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using UnityEngine; + +namespace KE.Utils.Quality.Models +{ + public class Model : IEquatable + { + + + private Vector3 _position; + public Vector3 Position + { + get { return _position; } + set + { + _position = value; + } + } + private Quaternion _rotation; + public Quaternion Rotation + { + get { return _rotation; } + set + { + _rotation = value; + } + } + private ModelPrefab _prefab; + public ModelPrefab Prefab + { + get { return _prefab; } + } + + + + private HashSet _models; + + internal Model(ModelPrefab prefab, Vector3 position, Quaternion rotation,IEnumerable toys,bool spawn) + { + _prefab = prefab; + Position = position; + Rotation = rotation; + _models = new HashSet(toys); + QualityHandler.Instance.QualityToysHandler.Sync(); + + foreach (BaseModel based in toys) + { + AdminToy toy = based.AdminToy; + + if (toy is Primitive p) + p.Collidable = false; + toy.AdminToyBase.transform.position = based.LocalPosition + Position; + toy.AdminToyBase.transform.rotation = based.LocalRotation * Rotation; + } + if(spawn) + { + Spawn(); + } + } + + + public void Destroy() + { + foreach (BaseModel primitive in _models) + { + primitive.AdminToy.Destroy(); + } + } + public void UnSpawn() + { + foreach (BaseModel primitive in _models) + { + primitive.AdminToy.UnSpawn(); + } + } + public void Spawn() + { + QualityHandler.Instance.QualityToysHandler.Sync(); + foreach (BaseModel primitive in _models) + { + primitive.AdminToy.Spawn(); + } + + } + + + public bool Equals(Model x) + { + if (x == null) return false; + return x._prefab == _prefab && x.Position == Position && x.Rotation == Rotation; + } + public int GetHashCode(Model obj) + { + return obj.GetHashCode(); + } + } +} diff --git a/KruacentExiled/utils-merged/KE.Utilsmisc/Quality/Models/ModelPrefab.cs b/KruacentExiled/utils-merged/KE.Utilsmisc/Quality/Models/ModelPrefab.cs new file mode 100644 index 00000000..bbc39da4 --- /dev/null +++ b/KruacentExiled/utils-merged/KE.Utilsmisc/Quality/Models/ModelPrefab.cs @@ -0,0 +1,42 @@ +using Exiled.API.Features; +using Exiled.API.Features.Core; +using Exiled.API.Features.Pickups; +using Exiled.API.Features.Toys; +using Exiled.API.Interfaces; +using KE.Utils.Extensions; +using KE.Utils.Quality.Models.Base; +using KE.Utils.Quality.Structs; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using UnityEngine; +using Light = Exiled.API.Features.Toys.Light; + +namespace KE.Utils.Quality.Models +{ + public abstract class ModelPrefab + { + + protected abstract IEnumerable GetBaseModels(); + + public virtual Model Create(Vector3 position,Quaternion rotation, bool spawn = true) + { + + HashSet clonetoys = new(); + HashSet toys = GetBaseModels().ToHashSet(); + foreach (BaseModel model in toys) + { + BaseModel clone = (BaseModel)model.Clone(); + clonetoys.Add(clone); + } + return new Model(this, position, rotation, clonetoys,spawn); + + } + + + + + } +} diff --git a/KruacentExiled/utils-merged/KE.Utilsmisc/Quality/Models/QualityModel.cs b/KruacentExiled/utils-merged/KE.Utilsmisc/Quality/Models/QualityModel.cs new file mode 100644 index 00000000..b5cc682f --- /dev/null +++ b/KruacentExiled/utils-merged/KE.Utilsmisc/Quality/Models/QualityModel.cs @@ -0,0 +1,40 @@ +using Exiled.API.Features; +using Exiled.API.Features.Toys; +using KE.Utils.Extensions; +using KE.Utils.Quality.Enums; +using KE.Utils.Quality.Models.Base; +using System.Collections.Generic; +using System.Linq; +using UnityEngine; + +namespace KE.Utils.Quality.Models +{ + public abstract class QualityModel : ModelPrefab + { + public abstract ModelQuality Quality { get; } + public abstract bool IsPickup { get; } + + + + + public override sealed Model Create(Vector3 position, Quaternion rotation,bool spawn = true) + { + + HashSet clonetoys = new(); + HashSet toys = GetBaseModels().ToHashSet(); + foreach (BaseModel model in toys) + { + BaseModel clone = (BaseModel)model.Clone(); + + if (IsPickup) + clone.AdminToy.SetAsPickupAdminToy(false); + + clone.AdminToy.SetQuality(Quality,false); + clonetoys.Add(clone); + } + QualityHandler.Sync(); + return new Model(this,position, rotation, clonetoys, spawn); + } + + } +} diff --git a/KruacentExiled/utils-merged/KE.Utilsmisc/Quality/QualityHandler.cs b/KruacentExiled/utils-merged/KE.Utilsmisc/Quality/QualityHandler.cs new file mode 100644 index 00000000..235d79c9 --- /dev/null +++ b/KruacentExiled/utils-merged/KE.Utilsmisc/Quality/QualityHandler.cs @@ -0,0 +1,61 @@ +using Exiled.API.Features; +using Exiled.API.Features.Core.UserSettings; +using KE.Utils.Quality.Handlers; +using KE.Utils.Quality.Settings; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace KE.Utils.Quality +{ + [Obsolete("scrapped", false)] + internal class QualityHandler + { + public QualitySettings QualitySettings { get; private set; } + public QualityToysHandler QualityToysHandler { get; private set; } + + private static QualityHandler _instance; + public static QualityHandler Instance + { + get + { + if(_instance == null ) + _instance = new QualityHandler(); + return _instance; + } + } + private QualityHandler() + { + QualitySettings = new QualitySettings(Changed); + QualityToysHandler = new QualityToysHandler(); + } + + ~QualityHandler() + { + QualityToysHandler = null; + QualitySettings = null; + } + + public void Changed(Player p, SettingBase _) + { + QualityToysHandler.Sync(p); + } + + public void Register() + { + QualitySettings.Register(); + } + + public void Unregister() + { + QualitySettings.Unregister(); + } + + public static void Sync() + { + Instance.QualityToysHandler.Sync(); + } + } +} diff --git a/KruacentExiled/utils-merged/KE.Utilsmisc/Quality/QualityToysHandler.cs b/KruacentExiled/utils-merged/KE.Utilsmisc/Quality/QualityToysHandler.cs new file mode 100644 index 00000000..27320233 --- /dev/null +++ b/KruacentExiled/utils-merged/KE.Utilsmisc/Quality/QualityToysHandler.cs @@ -0,0 +1,155 @@ +using AdminToys; +using Exiled.API.Enums; +using Exiled.API.Extensions; +using Exiled.API.Features; +using Exiled.API.Features.Toys; +using KE.Utils.Quality.Enums; +using KE.Utils.Quality.Settings; +using System.Collections.Generic; +using System.Linq; +using UnityEngine; +using Light = Exiled.API.Features.Toys.Light; +using QualitySettings = KE.Utils.Quality.Settings.QualitySettings; + +namespace KE.Utils.Quality +{ + public class QualityToysHandler + { + private HashSet _pickupToys = new(); + private Dictionary _qualityToys = new(); + public readonly Vector3 Gulag = new Vector3(15000,15000,15000); + + public bool IsPickupToy(AdminToy primitive) + { + return _pickupToys.Contains(primitive); + } + + public bool IsQualityToy(AdminToy primitive) + { + return _qualityToys.ContainsKey(primitive); + } + + + public void SetAsPickup(AdminToy toy) + { + if (!_pickupToys.Add(toy)) + { + Log.Warn($"AdminToy {toy} is already a pickupToy"); + return; + } + } + + public void SetQuality(AdminToy toy,ModelQuality quality) + { + if (toy == null) return; + if (!_qualityToys.ContainsKey(toy)) + _qualityToys.Add(toy,quality); + else + _qualityToys[toy] = quality; + } + + + + private void SendToShadowRealm(AdminToy adminToy, Player player) + { + if(adminToy is Light l) + { + player.SendFakeSyncVar(l.Base.netIdentity, typeof(LightSourceToy), nameof(LightSourceToy.NetworkPosition), Gulag); + return; + } + if(adminToy is Primitive p) + { + player.SendFakeSyncVar(p.Base.netIdentity, typeof(PrimitiveObjectToy), nameof(PrimitiveObjectToy.NetworkPosition), Gulag); + return; + } + } + + private void SetTruePosition(AdminToy adminToy, Player player) + { + if (adminToy is Light l) + { + player.SendFakeSyncVar(l.Base.netIdentity, typeof(LightSourceToy), nameof(LightSourceToy.NetworkPosition), l.Position); + return; + } + if (adminToy is Primitive p) + { + player.SendFakeSyncVar(p.Base.netIdentity, typeof(PrimitiveObjectToy), nameof(PrimitiveObjectToy.NetworkPosition), p.Position); + return; + } + } + + /// + /// Sync every Players + /// + public void Sync() + { + foreach(Player p in Player.List) + { + Sync(p); + } + } + + /// + /// Sync a specified Player + /// + /// + public void Sync(Player p) + { + var quality = QualitySettings.Get(p); + var pickup = QualitySettings.PickmodelActivated(p); + + if (!pickup) + { + //hide pickup toys + foreach (AdminToy pk in _pickupToys) + { + SendToShadowRealm(pk, p); + } + } + else + { + //show pickup toys + foreach (AdminToy pk in _pickupToys) + { + SetTruePosition(pk, p); + } + } + + + + + foreach(var at in _qualityToys) + { + if(at.Value == quality) + { + if (pickup || !_pickupToys.Contains(at.Key)) + { + SetTruePosition(at.Key, p); + } + } + else + { + SendToShadowRealm(at.Key, p); + } + + } + + } + + /// + /// Sync a specified AdminToy + /// + /// + public void Sync(AdminToy adminToy) + { + if (IsPickupToy(adminToy)) + { + + } + if (IsQualityToy(adminToy)) + { + + } + } + } +} diff --git a/KruacentExiled/utils-merged/KE.Utilsmisc/Quality/Settings/QualitySettings.cs b/KruacentExiled/utils-merged/KE.Utilsmisc/Quality/Settings/QualitySettings.cs new file mode 100644 index 00000000..ca8d49be --- /dev/null +++ b/KruacentExiled/utils-merged/KE.Utilsmisc/Quality/Settings/QualitySettings.cs @@ -0,0 +1,62 @@ +using Exiled.API.Features; +using Exiled.API.Features.Core.UserSettings; +using KE.Utils.Quality.Enums; +using System; + +namespace KE.Utils.Quality.Settings +{ + public class QualitySettings + { + + private static int _idQuality = 0; + private static int _idModels = 1; + private static int _idSlider = 2; + private SettingBase[] _settings; + public QualitySettings(Action onChanged) + { + HeaderSetting header = new("Quality Settings"); + _settings = + [ + header, + new DropdownSetting(_idQuality,"ModelQuality",["Low","Medium", "High"],onChanged:onChanged), + new TwoButtonsSetting(_idModels,"Pickup models","Disabled","Enabled", onChanged:onChanged) + ]; + } + + public void Register() + { + SettingBase.Register(_settings); + SettingBase.SendToAll(); + } + + public void Unregister() + { + SettingBase.Unregister(settings:_settings); + } + + + + + public static ModelQuality Get(Player p) + { + if (!SettingBase.TryGetSetting(p, _idQuality, out var setting)) return ModelQuality.None; + + return setting.SelectedOption switch + { + "Low" => ModelQuality.Low, + "Medium" => ModelQuality.Medium, + "High" => ModelQuality.High, + _ => ModelQuality.None, + }; + } + + + public static bool PickmodelActivated(Player p) + { + if (!SettingBase.TryGetSetting(p, _idModels, out var setting)) return false; + return setting.IsSecond; + } + + + } +} diff --git a/KruacentExiled/utils-merged/KE.Utilsmisc/Quality/Structs/LocalWorldSpace.cs b/KruacentExiled/utils-merged/KE.Utilsmisc/Quality/Structs/LocalWorldSpace.cs new file mode 100644 index 00000000..d9c6205b --- /dev/null +++ b/KruacentExiled/utils-merged/KE.Utilsmisc/Quality/Structs/LocalWorldSpace.cs @@ -0,0 +1,23 @@ +using Exiled.API.Interfaces; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using UnityEngine; + +namespace KE.Utils.Quality.Structs +{ + public readonly struct LocalWorldSpace : IWorldSpace + { + + public Vector3 Position { get; } + public Quaternion Rotation { get; } + + public LocalWorldSpace(Vector3 position, Quaternion rotation) + { + Position = position; + Rotation = rotation; + } + } +} diff --git a/KruacentExiled/utils-merged/KE.Utilsmisc/Quality/Tests/Test.cs b/KruacentExiled/utils-merged/KE.Utilsmisc/Quality/Tests/Test.cs new file mode 100644 index 00000000..6ebd3f66 --- /dev/null +++ b/KruacentExiled/utils-merged/KE.Utilsmisc/Quality/Tests/Test.cs @@ -0,0 +1,108 @@ +using Exiled.API.Extensions; +using Exiled.API.Features; +using Exiled.API.Features.Toys; +using KE.Utils.Quality.Models; +using KE.Utils.Quality.Models.Examples; +using MEC; +using PlayerRoles; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using UnityEngine; + +namespace KE.Utils.Quality.Tests +{ + public class Test + { + private QualityHandler QualityHandler; + + + private Test(QualityHandler q) + { + QualityHandler = q; + try + { + TestMine(); + } + catch (Exception ex) + { + Log.Error("Exception for TestMine :\n"+ex); + } + + } + internal void TestQuality() + { + Vector3 pos = RoleTypeId.Scp049.GetRandomSpawnLocation().Position; + Primitive c = Primitive.Create(pos); + c.Color = Color.red; + Primitive c2 = Primitive.Create(pos + Vector3.one); + c2.Color = Color.green; + + + QualityHandler.QualityToysHandler.SetQuality(c, Enums.ModelQuality.Low); + QualityHandler.QualityToysHandler.SetQuality(c2, Enums.ModelQuality.Medium); + } + + internal void StressTest(int count) + { + Timing.RunCoroutine(Stress(count)); + } + + + private IEnumerator Stress(int count) + { + Vector3 pos = RoleTypeId.Scp049.GetRandomSpawnLocation().Position; + Vector3 scale = new Vector3(.1f, .1f, .1f); + float maxSpread = 5; + for (int i = 0; i < count; i++) + { + Primitive c = Primitive.Create(pos + new Vector3(UnityEngine.Random.Range(0f, maxSpread), UnityEngine.Random.Range(0f, maxSpread), UnityEngine.Random.Range(0f, maxSpread)), scale: scale); + QualityHandler.QualityToysHandler.SetQuality(c, Enums.ModelQuality.Medium); + } + QualityHandler.QualityToysHandler.Sync(); + yield return 0; + } + + public void TestMine() + { + Log.Info("TestMine"); + Vector3 pos = RoleTypeId.Scp049.GetRandomSpawnLocation().Position; + MineModelLow mml = new(); + + + Model m = mml.Create(pos, new Quaternion()); + m.Spawn(); + + + MineModelMedium mmm = new(); + + m = mmm.Create(pos + Vector3.up, new Quaternion()); + m.Spawn(); + + + MineModelPickup mmp = new(); + m = mmp.Create(pos + Vector3.right, new Quaternion()); + m.Spawn(); + + QualityHandler.Sync(); + + + + + + + + + foreach (var item in Player.List) + { + item.Teleport(pos); + } + + + + + } + } +} From 240e9b62fc9e072b68b2a097b347f232335500f7 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Mon, 28 Jul 2025 18:47:38 +0200 Subject: [PATCH 308/853] remove the stupid folder --- .../Displays/DisplayMeow/DisplayHandler.cs | 0 .../API/Displays/DisplayMeow/HintPlacement.cs | 0 .../API/GifAnimator/RenderGif.cs | 0 .../{KE.Utils => }/API/Interfaces/IEvents.cs | 0 .../API/Interfaces/ILoadable.cs | 0 .../{KE.Utils => }/API/Models/Arrows/Arrow.cs | 0 .../API/Models/Arrows/MoveArrow.cs | 0 .../API/Models/Arrows/RotateArrow.cs | 0 .../API/Models/Arrows/ScaleArrow.cs | 0 .../API/Models/Arrows/XArrow.cs | 0 .../API/Models/Arrows/YArrow.cs | 0 .../API/Models/Arrows/ZArrow.cs | 0 .../Models/Blueprints/AdminToyBlueprint.cs | 0 .../API/Models/Blueprints/LightBlueprint.cs | 0 .../API/Models/Blueprints/ModelBlueprint.cs | 0 .../Models/Blueprints/PrimitiveBlueprint.cs | 0 .../API/Models/Commands/AllCommands.cs | 0 .../API/Models/Commands/ChangeColor.cs | 0 .../API/Models/Commands/ChangePrimType.cs | 0 .../API/Models/Commands/CreateModel.cs | 0 .../API/Models/Commands/CreatePrim.cs | 0 .../API/Models/Commands/ListModel.cs | 0 .../API/Models/Commands/LoadModel.cs | 0 .../API/Models/Commands/ModeMovePrim.cs | 0 .../API/Models/Commands/SaveModel.cs | 0 .../API/Models/Commands/SelectModel.cs | 0 .../API/Models/Commands/ShowCenter.cs | 0 .../{KE.Utils => }/API/Models/Model.cs | 0 .../{KE.Utils => }/API/Models/ModelCreator.cs | 0 .../{KE.Utils => }/API/Models/ModelLoader.cs | 0 .../{KE.Utils => }/API/Models/Models.cs | 0 .../API/Models/MovementHandler.cs | 0 .../API/Models/SelectedModel.cs | 0 .../Models/ToysSettings/PrimitiveSetting.cs | 0 .../API/Models/ToysSettings/ToySetting.cs | 0 .../KE.Utils/{KE.Utils => }/API/OtherUtils.cs | 0 .../KE.Utils/{KE.Utils => }/API/Parser.cs | 0 .../{KE.Utils => }/API/ReflectionHelper.cs | 2 +- .../{KE.Utils => }/API/Sounds/SoundPlayer.cs | 2 +- .../Extensions/AdminToyExtension.cs | 0 .../{KE.Utils => }/Extensions/NpcExtension.cs | 0 .../Extensions/PlayerExtension.cs | 0 .../Extensions/RoomExtensions.cs | 0 .../KE.Utils/KE.Utils/KE.Utils.csproj | 37 ------------------- .../Quality/Enums/ModelQuality.cs | 0 .../Quality/Handlers/QualityToysHandler.cs | 0 .../Quality/Models/Base/BaseModel.cs | 0 .../Quality/Models/Base/LightModel.cs | 0 .../Quality/Models/Base/PrimitiveModel.cs | 0 .../Quality/Models/Examples/MineModel.cs | 0 .../{KE.Utils => }/Quality/Models/Model.cs | 0 .../Quality/Models/ModelPrefab.cs | 0 .../Quality/Models/QualityModel.cs | 0 .../{KE.Utils => }/Quality/QualityHandler.cs | 0 .../Quality/QualityToysHandler.cs | 0 .../Quality/Settings/QualitySettings.cs | 0 .../Quality/Structs/LocalWorldSpace.cs | 0 .../{KE.Utils => }/Quality/Tests/Test.cs | 0 58 files changed, 2 insertions(+), 39 deletions(-) rename KruacentExiled/KE.Utils/{KE.Utils => }/API/Displays/DisplayMeow/DisplayHandler.cs (100%) rename KruacentExiled/KE.Utils/{KE.Utils => }/API/Displays/DisplayMeow/HintPlacement.cs (100%) rename KruacentExiled/KE.Utils/{KE.Utils => }/API/GifAnimator/RenderGif.cs (100%) rename KruacentExiled/KE.Utils/{KE.Utils => }/API/Interfaces/IEvents.cs (100%) rename KruacentExiled/KE.Utils/{KE.Utils => }/API/Interfaces/ILoadable.cs (100%) rename KruacentExiled/KE.Utils/{KE.Utils => }/API/Models/Arrows/Arrow.cs (100%) rename KruacentExiled/KE.Utils/{KE.Utils => }/API/Models/Arrows/MoveArrow.cs (100%) rename KruacentExiled/KE.Utils/{KE.Utils => }/API/Models/Arrows/RotateArrow.cs (100%) rename KruacentExiled/KE.Utils/{KE.Utils => }/API/Models/Arrows/ScaleArrow.cs (100%) rename KruacentExiled/KE.Utils/{KE.Utils => }/API/Models/Arrows/XArrow.cs (100%) rename KruacentExiled/KE.Utils/{KE.Utils => }/API/Models/Arrows/YArrow.cs (100%) rename KruacentExiled/KE.Utils/{KE.Utils => }/API/Models/Arrows/ZArrow.cs (100%) rename KruacentExiled/KE.Utils/{KE.Utils => }/API/Models/Blueprints/AdminToyBlueprint.cs (100%) rename KruacentExiled/KE.Utils/{KE.Utils => }/API/Models/Blueprints/LightBlueprint.cs (100%) rename KruacentExiled/KE.Utils/{KE.Utils => }/API/Models/Blueprints/ModelBlueprint.cs (100%) rename KruacentExiled/KE.Utils/{KE.Utils => }/API/Models/Blueprints/PrimitiveBlueprint.cs (100%) rename KruacentExiled/KE.Utils/{KE.Utils => }/API/Models/Commands/AllCommands.cs (100%) rename KruacentExiled/KE.Utils/{KE.Utils => }/API/Models/Commands/ChangeColor.cs (100%) rename KruacentExiled/KE.Utils/{KE.Utils => }/API/Models/Commands/ChangePrimType.cs (100%) rename KruacentExiled/KE.Utils/{KE.Utils => }/API/Models/Commands/CreateModel.cs (100%) rename KruacentExiled/KE.Utils/{KE.Utils => }/API/Models/Commands/CreatePrim.cs (100%) rename KruacentExiled/KE.Utils/{KE.Utils => }/API/Models/Commands/ListModel.cs (100%) rename KruacentExiled/KE.Utils/{KE.Utils => }/API/Models/Commands/LoadModel.cs (100%) rename KruacentExiled/KE.Utils/{KE.Utils => }/API/Models/Commands/ModeMovePrim.cs (100%) rename KruacentExiled/KE.Utils/{KE.Utils => }/API/Models/Commands/SaveModel.cs (100%) rename KruacentExiled/KE.Utils/{KE.Utils => }/API/Models/Commands/SelectModel.cs (100%) rename KruacentExiled/KE.Utils/{KE.Utils => }/API/Models/Commands/ShowCenter.cs (100%) rename KruacentExiled/KE.Utils/{KE.Utils => }/API/Models/Model.cs (100%) rename KruacentExiled/KE.Utils/{KE.Utils => }/API/Models/ModelCreator.cs (100%) rename KruacentExiled/KE.Utils/{KE.Utils => }/API/Models/ModelLoader.cs (100%) rename KruacentExiled/KE.Utils/{KE.Utils => }/API/Models/Models.cs (100%) rename KruacentExiled/KE.Utils/{KE.Utils => }/API/Models/MovementHandler.cs (100%) rename KruacentExiled/KE.Utils/{KE.Utils => }/API/Models/SelectedModel.cs (100%) rename KruacentExiled/KE.Utils/{KE.Utils => }/API/Models/ToysSettings/PrimitiveSetting.cs (100%) rename KruacentExiled/KE.Utils/{KE.Utils => }/API/Models/ToysSettings/ToySetting.cs (100%) rename KruacentExiled/KE.Utils/{KE.Utils => }/API/OtherUtils.cs (100%) rename KruacentExiled/KE.Utils/{KE.Utils => }/API/Parser.cs (100%) rename KruacentExiled/KE.Utils/{KE.Utils => }/API/ReflectionHelper.cs (97%) rename KruacentExiled/KE.Utils/{KE.Utils => }/API/Sounds/SoundPlayer.cs (98%) rename KruacentExiled/KE.Utils/{KE.Utils => }/Extensions/AdminToyExtension.cs (100%) rename KruacentExiled/KE.Utils/{KE.Utils => }/Extensions/NpcExtension.cs (100%) rename KruacentExiled/KE.Utils/{KE.Utils => }/Extensions/PlayerExtension.cs (100%) rename KruacentExiled/KE.Utils/{KE.Utils => }/Extensions/RoomExtensions.cs (100%) delete mode 100644 KruacentExiled/KE.Utils/KE.Utils/KE.Utils.csproj rename KruacentExiled/KE.Utils/{KE.Utils => }/Quality/Enums/ModelQuality.cs (100%) rename KruacentExiled/KE.Utils/{KE.Utils => }/Quality/Handlers/QualityToysHandler.cs (100%) rename KruacentExiled/KE.Utils/{KE.Utils => }/Quality/Models/Base/BaseModel.cs (100%) rename KruacentExiled/KE.Utils/{KE.Utils => }/Quality/Models/Base/LightModel.cs (100%) rename KruacentExiled/KE.Utils/{KE.Utils => }/Quality/Models/Base/PrimitiveModel.cs (100%) rename KruacentExiled/KE.Utils/{KE.Utils => }/Quality/Models/Examples/MineModel.cs (100%) rename KruacentExiled/KE.Utils/{KE.Utils => }/Quality/Models/Model.cs (100%) rename KruacentExiled/KE.Utils/{KE.Utils => }/Quality/Models/ModelPrefab.cs (100%) rename KruacentExiled/KE.Utils/{KE.Utils => }/Quality/Models/QualityModel.cs (100%) rename KruacentExiled/KE.Utils/{KE.Utils => }/Quality/QualityHandler.cs (100%) rename KruacentExiled/KE.Utils/{KE.Utils => }/Quality/QualityToysHandler.cs (100%) rename KruacentExiled/KE.Utils/{KE.Utils => }/Quality/Settings/QualitySettings.cs (100%) rename KruacentExiled/KE.Utils/{KE.Utils => }/Quality/Structs/LocalWorldSpace.cs (100%) rename KruacentExiled/KE.Utils/{KE.Utils => }/Quality/Tests/Test.cs (100%) diff --git a/KruacentExiled/KE.Utils/KE.Utils/API/Displays/DisplayMeow/DisplayHandler.cs b/KruacentExiled/KE.Utils/API/Displays/DisplayMeow/DisplayHandler.cs similarity index 100% rename from KruacentExiled/KE.Utils/KE.Utils/API/Displays/DisplayMeow/DisplayHandler.cs rename to KruacentExiled/KE.Utils/API/Displays/DisplayMeow/DisplayHandler.cs diff --git a/KruacentExiled/KE.Utils/KE.Utils/API/Displays/DisplayMeow/HintPlacement.cs b/KruacentExiled/KE.Utils/API/Displays/DisplayMeow/HintPlacement.cs similarity index 100% rename from KruacentExiled/KE.Utils/KE.Utils/API/Displays/DisplayMeow/HintPlacement.cs rename to KruacentExiled/KE.Utils/API/Displays/DisplayMeow/HintPlacement.cs diff --git a/KruacentExiled/KE.Utils/KE.Utils/API/GifAnimator/RenderGif.cs b/KruacentExiled/KE.Utils/API/GifAnimator/RenderGif.cs similarity index 100% rename from KruacentExiled/KE.Utils/KE.Utils/API/GifAnimator/RenderGif.cs rename to KruacentExiled/KE.Utils/API/GifAnimator/RenderGif.cs diff --git a/KruacentExiled/KE.Utils/KE.Utils/API/Interfaces/IEvents.cs b/KruacentExiled/KE.Utils/API/Interfaces/IEvents.cs similarity index 100% rename from KruacentExiled/KE.Utils/KE.Utils/API/Interfaces/IEvents.cs rename to KruacentExiled/KE.Utils/API/Interfaces/IEvents.cs diff --git a/KruacentExiled/KE.Utils/KE.Utils/API/Interfaces/ILoadable.cs b/KruacentExiled/KE.Utils/API/Interfaces/ILoadable.cs similarity index 100% rename from KruacentExiled/KE.Utils/KE.Utils/API/Interfaces/ILoadable.cs rename to KruacentExiled/KE.Utils/API/Interfaces/ILoadable.cs diff --git a/KruacentExiled/KE.Utils/KE.Utils/API/Models/Arrows/Arrow.cs b/KruacentExiled/KE.Utils/API/Models/Arrows/Arrow.cs similarity index 100% rename from KruacentExiled/KE.Utils/KE.Utils/API/Models/Arrows/Arrow.cs rename to KruacentExiled/KE.Utils/API/Models/Arrows/Arrow.cs diff --git a/KruacentExiled/KE.Utils/KE.Utils/API/Models/Arrows/MoveArrow.cs b/KruacentExiled/KE.Utils/API/Models/Arrows/MoveArrow.cs similarity index 100% rename from KruacentExiled/KE.Utils/KE.Utils/API/Models/Arrows/MoveArrow.cs rename to KruacentExiled/KE.Utils/API/Models/Arrows/MoveArrow.cs diff --git a/KruacentExiled/KE.Utils/KE.Utils/API/Models/Arrows/RotateArrow.cs b/KruacentExiled/KE.Utils/API/Models/Arrows/RotateArrow.cs similarity index 100% rename from KruacentExiled/KE.Utils/KE.Utils/API/Models/Arrows/RotateArrow.cs rename to KruacentExiled/KE.Utils/API/Models/Arrows/RotateArrow.cs diff --git a/KruacentExiled/KE.Utils/KE.Utils/API/Models/Arrows/ScaleArrow.cs b/KruacentExiled/KE.Utils/API/Models/Arrows/ScaleArrow.cs similarity index 100% rename from KruacentExiled/KE.Utils/KE.Utils/API/Models/Arrows/ScaleArrow.cs rename to KruacentExiled/KE.Utils/API/Models/Arrows/ScaleArrow.cs diff --git a/KruacentExiled/KE.Utils/KE.Utils/API/Models/Arrows/XArrow.cs b/KruacentExiled/KE.Utils/API/Models/Arrows/XArrow.cs similarity index 100% rename from KruacentExiled/KE.Utils/KE.Utils/API/Models/Arrows/XArrow.cs rename to KruacentExiled/KE.Utils/API/Models/Arrows/XArrow.cs diff --git a/KruacentExiled/KE.Utils/KE.Utils/API/Models/Arrows/YArrow.cs b/KruacentExiled/KE.Utils/API/Models/Arrows/YArrow.cs similarity index 100% rename from KruacentExiled/KE.Utils/KE.Utils/API/Models/Arrows/YArrow.cs rename to KruacentExiled/KE.Utils/API/Models/Arrows/YArrow.cs diff --git a/KruacentExiled/KE.Utils/KE.Utils/API/Models/Arrows/ZArrow.cs b/KruacentExiled/KE.Utils/API/Models/Arrows/ZArrow.cs similarity index 100% rename from KruacentExiled/KE.Utils/KE.Utils/API/Models/Arrows/ZArrow.cs rename to KruacentExiled/KE.Utils/API/Models/Arrows/ZArrow.cs diff --git a/KruacentExiled/KE.Utils/KE.Utils/API/Models/Blueprints/AdminToyBlueprint.cs b/KruacentExiled/KE.Utils/API/Models/Blueprints/AdminToyBlueprint.cs similarity index 100% rename from KruacentExiled/KE.Utils/KE.Utils/API/Models/Blueprints/AdminToyBlueprint.cs rename to KruacentExiled/KE.Utils/API/Models/Blueprints/AdminToyBlueprint.cs diff --git a/KruacentExiled/KE.Utils/KE.Utils/API/Models/Blueprints/LightBlueprint.cs b/KruacentExiled/KE.Utils/API/Models/Blueprints/LightBlueprint.cs similarity index 100% rename from KruacentExiled/KE.Utils/KE.Utils/API/Models/Blueprints/LightBlueprint.cs rename to KruacentExiled/KE.Utils/API/Models/Blueprints/LightBlueprint.cs diff --git a/KruacentExiled/KE.Utils/KE.Utils/API/Models/Blueprints/ModelBlueprint.cs b/KruacentExiled/KE.Utils/API/Models/Blueprints/ModelBlueprint.cs similarity index 100% rename from KruacentExiled/KE.Utils/KE.Utils/API/Models/Blueprints/ModelBlueprint.cs rename to KruacentExiled/KE.Utils/API/Models/Blueprints/ModelBlueprint.cs diff --git a/KruacentExiled/KE.Utils/KE.Utils/API/Models/Blueprints/PrimitiveBlueprint.cs b/KruacentExiled/KE.Utils/API/Models/Blueprints/PrimitiveBlueprint.cs similarity index 100% rename from KruacentExiled/KE.Utils/KE.Utils/API/Models/Blueprints/PrimitiveBlueprint.cs rename to KruacentExiled/KE.Utils/API/Models/Blueprints/PrimitiveBlueprint.cs diff --git a/KruacentExiled/KE.Utils/KE.Utils/API/Models/Commands/AllCommands.cs b/KruacentExiled/KE.Utils/API/Models/Commands/AllCommands.cs similarity index 100% rename from KruacentExiled/KE.Utils/KE.Utils/API/Models/Commands/AllCommands.cs rename to KruacentExiled/KE.Utils/API/Models/Commands/AllCommands.cs diff --git a/KruacentExiled/KE.Utils/KE.Utils/API/Models/Commands/ChangeColor.cs b/KruacentExiled/KE.Utils/API/Models/Commands/ChangeColor.cs similarity index 100% rename from KruacentExiled/KE.Utils/KE.Utils/API/Models/Commands/ChangeColor.cs rename to KruacentExiled/KE.Utils/API/Models/Commands/ChangeColor.cs diff --git a/KruacentExiled/KE.Utils/KE.Utils/API/Models/Commands/ChangePrimType.cs b/KruacentExiled/KE.Utils/API/Models/Commands/ChangePrimType.cs similarity index 100% rename from KruacentExiled/KE.Utils/KE.Utils/API/Models/Commands/ChangePrimType.cs rename to KruacentExiled/KE.Utils/API/Models/Commands/ChangePrimType.cs diff --git a/KruacentExiled/KE.Utils/KE.Utils/API/Models/Commands/CreateModel.cs b/KruacentExiled/KE.Utils/API/Models/Commands/CreateModel.cs similarity index 100% rename from KruacentExiled/KE.Utils/KE.Utils/API/Models/Commands/CreateModel.cs rename to KruacentExiled/KE.Utils/API/Models/Commands/CreateModel.cs diff --git a/KruacentExiled/KE.Utils/KE.Utils/API/Models/Commands/CreatePrim.cs b/KruacentExiled/KE.Utils/API/Models/Commands/CreatePrim.cs similarity index 100% rename from KruacentExiled/KE.Utils/KE.Utils/API/Models/Commands/CreatePrim.cs rename to KruacentExiled/KE.Utils/API/Models/Commands/CreatePrim.cs diff --git a/KruacentExiled/KE.Utils/KE.Utils/API/Models/Commands/ListModel.cs b/KruacentExiled/KE.Utils/API/Models/Commands/ListModel.cs similarity index 100% rename from KruacentExiled/KE.Utils/KE.Utils/API/Models/Commands/ListModel.cs rename to KruacentExiled/KE.Utils/API/Models/Commands/ListModel.cs diff --git a/KruacentExiled/KE.Utils/KE.Utils/API/Models/Commands/LoadModel.cs b/KruacentExiled/KE.Utils/API/Models/Commands/LoadModel.cs similarity index 100% rename from KruacentExiled/KE.Utils/KE.Utils/API/Models/Commands/LoadModel.cs rename to KruacentExiled/KE.Utils/API/Models/Commands/LoadModel.cs diff --git a/KruacentExiled/KE.Utils/KE.Utils/API/Models/Commands/ModeMovePrim.cs b/KruacentExiled/KE.Utils/API/Models/Commands/ModeMovePrim.cs similarity index 100% rename from KruacentExiled/KE.Utils/KE.Utils/API/Models/Commands/ModeMovePrim.cs rename to KruacentExiled/KE.Utils/API/Models/Commands/ModeMovePrim.cs diff --git a/KruacentExiled/KE.Utils/KE.Utils/API/Models/Commands/SaveModel.cs b/KruacentExiled/KE.Utils/API/Models/Commands/SaveModel.cs similarity index 100% rename from KruacentExiled/KE.Utils/KE.Utils/API/Models/Commands/SaveModel.cs rename to KruacentExiled/KE.Utils/API/Models/Commands/SaveModel.cs diff --git a/KruacentExiled/KE.Utils/KE.Utils/API/Models/Commands/SelectModel.cs b/KruacentExiled/KE.Utils/API/Models/Commands/SelectModel.cs similarity index 100% rename from KruacentExiled/KE.Utils/KE.Utils/API/Models/Commands/SelectModel.cs rename to KruacentExiled/KE.Utils/API/Models/Commands/SelectModel.cs diff --git a/KruacentExiled/KE.Utils/KE.Utils/API/Models/Commands/ShowCenter.cs b/KruacentExiled/KE.Utils/API/Models/Commands/ShowCenter.cs similarity index 100% rename from KruacentExiled/KE.Utils/KE.Utils/API/Models/Commands/ShowCenter.cs rename to KruacentExiled/KE.Utils/API/Models/Commands/ShowCenter.cs diff --git a/KruacentExiled/KE.Utils/KE.Utils/API/Models/Model.cs b/KruacentExiled/KE.Utils/API/Models/Model.cs similarity index 100% rename from KruacentExiled/KE.Utils/KE.Utils/API/Models/Model.cs rename to KruacentExiled/KE.Utils/API/Models/Model.cs diff --git a/KruacentExiled/KE.Utils/KE.Utils/API/Models/ModelCreator.cs b/KruacentExiled/KE.Utils/API/Models/ModelCreator.cs similarity index 100% rename from KruacentExiled/KE.Utils/KE.Utils/API/Models/ModelCreator.cs rename to KruacentExiled/KE.Utils/API/Models/ModelCreator.cs diff --git a/KruacentExiled/KE.Utils/KE.Utils/API/Models/ModelLoader.cs b/KruacentExiled/KE.Utils/API/Models/ModelLoader.cs similarity index 100% rename from KruacentExiled/KE.Utils/KE.Utils/API/Models/ModelLoader.cs rename to KruacentExiled/KE.Utils/API/Models/ModelLoader.cs diff --git a/KruacentExiled/KE.Utils/KE.Utils/API/Models/Models.cs b/KruacentExiled/KE.Utils/API/Models/Models.cs similarity index 100% rename from KruacentExiled/KE.Utils/KE.Utils/API/Models/Models.cs rename to KruacentExiled/KE.Utils/API/Models/Models.cs diff --git a/KruacentExiled/KE.Utils/KE.Utils/API/Models/MovementHandler.cs b/KruacentExiled/KE.Utils/API/Models/MovementHandler.cs similarity index 100% rename from KruacentExiled/KE.Utils/KE.Utils/API/Models/MovementHandler.cs rename to KruacentExiled/KE.Utils/API/Models/MovementHandler.cs diff --git a/KruacentExiled/KE.Utils/KE.Utils/API/Models/SelectedModel.cs b/KruacentExiled/KE.Utils/API/Models/SelectedModel.cs similarity index 100% rename from KruacentExiled/KE.Utils/KE.Utils/API/Models/SelectedModel.cs rename to KruacentExiled/KE.Utils/API/Models/SelectedModel.cs diff --git a/KruacentExiled/KE.Utils/KE.Utils/API/Models/ToysSettings/PrimitiveSetting.cs b/KruacentExiled/KE.Utils/API/Models/ToysSettings/PrimitiveSetting.cs similarity index 100% rename from KruacentExiled/KE.Utils/KE.Utils/API/Models/ToysSettings/PrimitiveSetting.cs rename to KruacentExiled/KE.Utils/API/Models/ToysSettings/PrimitiveSetting.cs diff --git a/KruacentExiled/KE.Utils/KE.Utils/API/Models/ToysSettings/ToySetting.cs b/KruacentExiled/KE.Utils/API/Models/ToysSettings/ToySetting.cs similarity index 100% rename from KruacentExiled/KE.Utils/KE.Utils/API/Models/ToysSettings/ToySetting.cs rename to KruacentExiled/KE.Utils/API/Models/ToysSettings/ToySetting.cs diff --git a/KruacentExiled/KE.Utils/KE.Utils/API/OtherUtils.cs b/KruacentExiled/KE.Utils/API/OtherUtils.cs similarity index 100% rename from KruacentExiled/KE.Utils/KE.Utils/API/OtherUtils.cs rename to KruacentExiled/KE.Utils/API/OtherUtils.cs diff --git a/KruacentExiled/KE.Utils/KE.Utils/API/Parser.cs b/KruacentExiled/KE.Utils/API/Parser.cs similarity index 100% rename from KruacentExiled/KE.Utils/KE.Utils/API/Parser.cs rename to KruacentExiled/KE.Utils/API/Parser.cs diff --git a/KruacentExiled/KE.Utils/KE.Utils/API/ReflectionHelper.cs b/KruacentExiled/KE.Utils/API/ReflectionHelper.cs similarity index 97% rename from KruacentExiled/KE.Utils/KE.Utils/API/ReflectionHelper.cs rename to KruacentExiled/KE.Utils/API/ReflectionHelper.cs index 0e543b6b..d95fa32a 100644 --- a/KruacentExiled/KE.Utils/KE.Utils/API/ReflectionHelper.cs +++ b/KruacentExiled/KE.Utils/API/ReflectionHelper.cs @@ -5,7 +5,7 @@ using System.Text; using System.Threading.Tasks; -namespace KE.Utils.KE.Utilsmap.API +namespace KE.Utils.API { public static class ReflectionHelper { diff --git a/KruacentExiled/KE.Utils/KE.Utils/API/Sounds/SoundPlayer.cs b/KruacentExiled/KE.Utils/API/Sounds/SoundPlayer.cs similarity index 98% rename from KruacentExiled/KE.Utils/KE.Utils/API/Sounds/SoundPlayer.cs rename to KruacentExiled/KE.Utils/API/Sounds/SoundPlayer.cs index 84e09ce8..91b4218b 100644 --- a/KruacentExiled/KE.Utils/KE.Utils/API/Sounds/SoundPlayer.cs +++ b/KruacentExiled/KE.Utils/API/Sounds/SoundPlayer.cs @@ -7,7 +7,7 @@ using System.Threading.Tasks; using UnityEngine; -namespace KE.Utils.KE.Utilsmap.API.Sounds +namespace KE.Utils.API.Sounds { public class SoundPlayer { diff --git a/KruacentExiled/KE.Utils/KE.Utils/Extensions/AdminToyExtension.cs b/KruacentExiled/KE.Utils/Extensions/AdminToyExtension.cs similarity index 100% rename from KruacentExiled/KE.Utils/KE.Utils/Extensions/AdminToyExtension.cs rename to KruacentExiled/KE.Utils/Extensions/AdminToyExtension.cs diff --git a/KruacentExiled/KE.Utils/KE.Utils/Extensions/NpcExtension.cs b/KruacentExiled/KE.Utils/Extensions/NpcExtension.cs similarity index 100% rename from KruacentExiled/KE.Utils/KE.Utils/Extensions/NpcExtension.cs rename to KruacentExiled/KE.Utils/Extensions/NpcExtension.cs diff --git a/KruacentExiled/KE.Utils/KE.Utils/Extensions/PlayerExtension.cs b/KruacentExiled/KE.Utils/Extensions/PlayerExtension.cs similarity index 100% rename from KruacentExiled/KE.Utils/KE.Utils/Extensions/PlayerExtension.cs rename to KruacentExiled/KE.Utils/Extensions/PlayerExtension.cs diff --git a/KruacentExiled/KE.Utils/KE.Utils/Extensions/RoomExtensions.cs b/KruacentExiled/KE.Utils/Extensions/RoomExtensions.cs similarity index 100% rename from KruacentExiled/KE.Utils/KE.Utils/Extensions/RoomExtensions.cs rename to KruacentExiled/KE.Utils/Extensions/RoomExtensions.cs diff --git a/KruacentExiled/KE.Utils/KE.Utils/KE.Utils.csproj b/KruacentExiled/KE.Utils/KE.Utils/KE.Utils.csproj deleted file mode 100644 index aee2e596..00000000 --- a/KruacentExiled/KE.Utils/KE.Utils/KE.Utils.csproj +++ /dev/null @@ -1,37 +0,0 @@ - - - - 13.0 - net48 - - - - - - - - - - - - - - - - - - - - - - - - - if not "$(EXILED_DEV_REFERENCES)"=="" copy /y "$(OutputPath)$(AssemblyName).dll" "$(EXILED_DEV_REFERENCES)\Plugins\" - - - if [[ ! -z "$EXILED_DEV_REFERENCES" ]]; then cp "$(OutputPath)$(AssemblyName).dll" "$EXILED_DEV_REFERENCES/Plugins/"; fi - - - - diff --git a/KruacentExiled/KE.Utils/KE.Utils/Quality/Enums/ModelQuality.cs b/KruacentExiled/KE.Utils/Quality/Enums/ModelQuality.cs similarity index 100% rename from KruacentExiled/KE.Utils/KE.Utils/Quality/Enums/ModelQuality.cs rename to KruacentExiled/KE.Utils/Quality/Enums/ModelQuality.cs diff --git a/KruacentExiled/KE.Utils/KE.Utils/Quality/Handlers/QualityToysHandler.cs b/KruacentExiled/KE.Utils/Quality/Handlers/QualityToysHandler.cs similarity index 100% rename from KruacentExiled/KE.Utils/KE.Utils/Quality/Handlers/QualityToysHandler.cs rename to KruacentExiled/KE.Utils/Quality/Handlers/QualityToysHandler.cs diff --git a/KruacentExiled/KE.Utils/KE.Utils/Quality/Models/Base/BaseModel.cs b/KruacentExiled/KE.Utils/Quality/Models/Base/BaseModel.cs similarity index 100% rename from KruacentExiled/KE.Utils/KE.Utils/Quality/Models/Base/BaseModel.cs rename to KruacentExiled/KE.Utils/Quality/Models/Base/BaseModel.cs diff --git a/KruacentExiled/KE.Utils/KE.Utils/Quality/Models/Base/LightModel.cs b/KruacentExiled/KE.Utils/Quality/Models/Base/LightModel.cs similarity index 100% rename from KruacentExiled/KE.Utils/KE.Utils/Quality/Models/Base/LightModel.cs rename to KruacentExiled/KE.Utils/Quality/Models/Base/LightModel.cs diff --git a/KruacentExiled/KE.Utils/KE.Utils/Quality/Models/Base/PrimitiveModel.cs b/KruacentExiled/KE.Utils/Quality/Models/Base/PrimitiveModel.cs similarity index 100% rename from KruacentExiled/KE.Utils/KE.Utils/Quality/Models/Base/PrimitiveModel.cs rename to KruacentExiled/KE.Utils/Quality/Models/Base/PrimitiveModel.cs diff --git a/KruacentExiled/KE.Utils/KE.Utils/Quality/Models/Examples/MineModel.cs b/KruacentExiled/KE.Utils/Quality/Models/Examples/MineModel.cs similarity index 100% rename from KruacentExiled/KE.Utils/KE.Utils/Quality/Models/Examples/MineModel.cs rename to KruacentExiled/KE.Utils/Quality/Models/Examples/MineModel.cs diff --git a/KruacentExiled/KE.Utils/KE.Utils/Quality/Models/Model.cs b/KruacentExiled/KE.Utils/Quality/Models/Model.cs similarity index 100% rename from KruacentExiled/KE.Utils/KE.Utils/Quality/Models/Model.cs rename to KruacentExiled/KE.Utils/Quality/Models/Model.cs diff --git a/KruacentExiled/KE.Utils/KE.Utils/Quality/Models/ModelPrefab.cs b/KruacentExiled/KE.Utils/Quality/Models/ModelPrefab.cs similarity index 100% rename from KruacentExiled/KE.Utils/KE.Utils/Quality/Models/ModelPrefab.cs rename to KruacentExiled/KE.Utils/Quality/Models/ModelPrefab.cs diff --git a/KruacentExiled/KE.Utils/KE.Utils/Quality/Models/QualityModel.cs b/KruacentExiled/KE.Utils/Quality/Models/QualityModel.cs similarity index 100% rename from KruacentExiled/KE.Utils/KE.Utils/Quality/Models/QualityModel.cs rename to KruacentExiled/KE.Utils/Quality/Models/QualityModel.cs diff --git a/KruacentExiled/KE.Utils/KE.Utils/Quality/QualityHandler.cs b/KruacentExiled/KE.Utils/Quality/QualityHandler.cs similarity index 100% rename from KruacentExiled/KE.Utils/KE.Utils/Quality/QualityHandler.cs rename to KruacentExiled/KE.Utils/Quality/QualityHandler.cs diff --git a/KruacentExiled/KE.Utils/KE.Utils/Quality/QualityToysHandler.cs b/KruacentExiled/KE.Utils/Quality/QualityToysHandler.cs similarity index 100% rename from KruacentExiled/KE.Utils/KE.Utils/Quality/QualityToysHandler.cs rename to KruacentExiled/KE.Utils/Quality/QualityToysHandler.cs diff --git a/KruacentExiled/KE.Utils/KE.Utils/Quality/Settings/QualitySettings.cs b/KruacentExiled/KE.Utils/Quality/Settings/QualitySettings.cs similarity index 100% rename from KruacentExiled/KE.Utils/KE.Utils/Quality/Settings/QualitySettings.cs rename to KruacentExiled/KE.Utils/Quality/Settings/QualitySettings.cs diff --git a/KruacentExiled/KE.Utils/KE.Utils/Quality/Structs/LocalWorldSpace.cs b/KruacentExiled/KE.Utils/Quality/Structs/LocalWorldSpace.cs similarity index 100% rename from KruacentExiled/KE.Utils/KE.Utils/Quality/Structs/LocalWorldSpace.cs rename to KruacentExiled/KE.Utils/Quality/Structs/LocalWorldSpace.cs diff --git a/KruacentExiled/KE.Utils/KE.Utils/Quality/Tests/Test.cs b/KruacentExiled/KE.Utils/Quality/Tests/Test.cs similarity index 100% rename from KruacentExiled/KE.Utils/KE.Utils/Quality/Tests/Test.cs rename to KruacentExiled/KE.Utils/Quality/Tests/Test.cs From 6e5b055652945d4223e575ecbe1a8a74df34bc81 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Mon, 28 Jul 2025 18:57:37 +0200 Subject: [PATCH 309/853] removed the useless utilsmerged --- .../Displays/DisplayMeow/DisplayHandler.cs | 67 ------ .../API/Displays/DisplayMeow/HintPlacement.cs | 31 --- .../KE.Utilsci/API/Interfaces/IEvents.cs | 17 -- .../KE.Utilsci/API/Sounds/SoundPlayer.cs | 112 ---------- .../Extensions/AdminToyExtension.cs | 25 --- .../KE.Utilsci/Extensions/PlayerExtension.cs | 52 ----- .../KE.Utilsci/Extensions/RoomExtension.cs | 12 - .../utils-merged/KE.Utilsci/KE.Utils.csproj | 31 --- .../KE.Utilsci/Quality/Enums/ModelQuality.cs | 16 -- .../Quality/Handlers/QualityToysHandler.cs | 179 --------------- .../Quality/Models/Base/BaseModel.cs | 41 ---- .../Quality/Models/Base/LightModel.cs | 26 --- .../Quality/Models/Base/PrimitiveModel.cs | 26 --- .../Quality/Models/Examples/MineModel.cs | 118 ---------- .../KE.Utilsci/Quality/Models/Model.cs | 104 --------- .../KE.Utilsci/Quality/Models/ModelPrefab.cs | 42 ---- .../KE.Utilsci/Quality/Models/QualityModel.cs | 40 ---- .../KE.Utilsci/Quality/QualityHandler.cs | 61 ----- .../KE.Utilsci/Quality/QualityToysHandler.cs | 155 ------------- .../Quality/Settings/QualitySettings.cs | 62 ------ .../Quality/Structs/LocalWorldSpace.cs | 23 -- .../KE.Utilsci/Quality/Tests/Test.cs | 108 --------- .../Displays/DisplayMeow/DisplayHandler.cs | 66 ------ .../API/Displays/DisplayMeow/HintPlacement.cs | 31 --- .../KE.Utilscr/API/Interfaces/IEvents.cs | 17 -- .../utils-merged/KE.Utilscr/API/OtherUtils.cs | 18 -- .../Extensions/AdminToyExtension.cs | 25 --- .../KE.Utilscr/Extensions/PlayerExtension.cs | 52 ----- .../KE.Utilscr/Extensions/RoomExtension.cs | 12 - .../utils-merged/KE.Utilscr/KE.Utils.csproj | 30 --- .../KE.Utilscr/Quality/Enums/ModelQuality.cs | 16 -- .../Quality/Handlers/QualityToysHandler.cs | 179 --------------- .../Quality/Models/Base/BaseModel.cs | 41 ---- .../Quality/Models/Base/LightModel.cs | 26 --- .../Quality/Models/Base/PrimitiveModel.cs | 26 --- .../Quality/Models/Examples/MineModel.cs | 118 ---------- .../KE.Utilscr/Quality/Models/Model.cs | 104 --------- .../KE.Utilscr/Quality/Models/ModelPrefab.cs | 42 ---- .../KE.Utilscr/Quality/Models/QualityModel.cs | 40 ---- .../KE.Utilscr/Quality/QualityHandler.cs | 61 ----- .../KE.Utilscr/Quality/QualityToysHandler.cs | 155 ------------- .../Quality/Settings/QualitySettings.cs | 62 ------ .../Quality/Structs/LocalWorldSpace.cs | 23 -- .../KE.Utilscr/Quality/Tests/Test.cs | 108 --------- .../Displays/DisplayMeow/DisplayHandler.cs | 67 ------ .../API/Displays/DisplayMeow/HintPlacement.cs | 31 --- .../KE.Utilsge/API/Interfaces/IEvents.cs | 17 -- .../KE.Utilsge/API/ReflectionHelper.cs | 47 ---- .../KE.Utilsge/API/Sounds/SoundPlayer.cs | 115 ---------- .../Extensions/AdminToyExtension.cs | 25 --- .../KE.Utilsge/Extensions/PlayerExtension.cs | 52 ----- .../KE.Utilsge/Extensions/RoomExtension.cs | 12 - .../utils-merged/KE.Utilsge/KE.Utils.csproj | 31 --- .../KE.Utilsge/Quality/Enums/ModelQuality.cs | 16 -- .../Quality/Handlers/QualityToysHandler.cs | 179 --------------- .../Quality/Models/Base/BaseModel.cs | 41 ---- .../Quality/Models/Base/LightModel.cs | 26 --- .../Quality/Models/Base/PrimitiveModel.cs | 26 --- .../Quality/Models/Examples/MineModel.cs | 118 ---------- .../KE.Utilsge/Quality/Models/Model.cs | 104 --------- .../KE.Utilsge/Quality/Models/ModelPrefab.cs | 42 ---- .../KE.Utilsge/Quality/Models/QualityModel.cs | 40 ---- .../KE.Utilsge/Quality/QualityHandler.cs | 61 ----- .../KE.Utilsge/Quality/QualityToysHandler.cs | 155 ------------- .../Quality/Settings/QualitySettings.cs | 62 ------ .../Quality/Structs/LocalWorldSpace.cs | 23 -- .../KE.Utilsge/Quality/Tests/Test.cs | 108 --------- .../Displays/DisplayMeow/DisplayHandler.cs | 67 ------ .../API/Displays/DisplayMeow/HintPlacement.cs | 31 --- .../KE.Utilsmap/API/GifAnimator/RenderGif.cs | 128 ----------- .../KE.Utilsmap/API/Interfaces/IEvents.cs | 17 -- .../KE.Utilsmap/API/Interfaces/ILoadable.cs | 13 -- .../KE.Utilsmap/API/Models/Arrows/Arrow.cs | 58 ----- .../API/Models/Arrows/MoveArrow.cs | 12 - .../API/Models/Arrows/RotateArrow.cs | 12 - .../API/Models/Arrows/ScaleArrow.cs | 12 - .../KE.Utilsmap/API/Models/Arrows/XArrow.cs | 16 -- .../KE.Utilsmap/API/Models/Arrows/YArrow.cs | 16 -- .../KE.Utilsmap/API/Models/Arrows/ZArrow.cs | 16 -- .../Models/Blueprints/AdminToyBlueprint.cs | 69 ------ .../API/Models/Blueprints/LightBlueprint.cs | 37 ---- .../API/Models/Blueprints/ModelBlueprint.cs | 110 --------- .../Models/Blueprints/PrimitiveBlueprint.cs | 39 ---- .../API/Models/Commands/AllCommands.cs | 33 --- .../API/Models/Commands/ChangeColor.cs | 72 ------ .../API/Models/Commands/ChangePrimType.cs | 53 ----- .../API/Models/Commands/CreateModel.cs | 44 ---- .../API/Models/Commands/CreatePrim.cs | 47 ---- .../API/Models/Commands/ListModel.cs | 42 ---- .../API/Models/Commands/LoadModel.cs | 65 ------ .../API/Models/Commands/ModeMovePrim.cs | 64 ------ .../API/Models/Commands/SaveModel.cs | 47 ---- .../API/Models/Commands/SelectModel.cs | 56 ----- .../API/Models/Commands/ShowCenter.cs | 51 ----- .../KE.Utilsmap/API/Models/Model.cs | 202 ----------------- .../KE.Utilsmap/API/Models/ModelCreator.cs | 175 --------------- .../KE.Utilsmap/API/Models/ModelLoader.cs | 152 ------------- .../KE.Utilsmap/API/Models/Models.cs | 47 ---- .../KE.Utilsmap/API/Models/MovementHandler.cs | 208 ------------------ .../KE.Utilsmap/API/Models/SelectedModel.cs | 52 ----- .../Models/ToysSettings/PrimitiveSetting.cs | 31 --- .../API/Models/ToysSettings/ToySetting.cs | 20 -- .../KE.Utilsmap/API/OtherUtils.cs | 18 -- .../utils-merged/KE.Utilsmap/API/Parser.cs | 36 --- .../KE.Utilsmap/API/Sounds/SoundPlayer.cs | 112 ---------- .../Extensions/AdminToyExtension.cs | 25 --- .../KE.Utilsmap/Extensions/NpcExtension.cs | 23 -- .../KE.Utilsmap/Extensions/PlayerExtension.cs | 52 ----- .../KE.Utilsmap/Extensions/RoomExtension.cs | 12 - .../utils-merged/KE.Utilsmap/KE.Utils.csproj | 37 ---- .../KE.Utilsmap/Quality/Enums/ModelQuality.cs | 16 -- .../Quality/Handlers/QualityToysHandler.cs | 179 --------------- .../Quality/Models/Base/BaseModel.cs | 41 ---- .../Quality/Models/Base/LightModel.cs | 26 --- .../Quality/Models/Base/PrimitiveModel.cs | 26 --- .../Quality/Models/Examples/MineModel.cs | 118 ---------- .../KE.Utilsmap/Quality/Models/Model.cs | 104 --------- .../KE.Utilsmap/Quality/Models/ModelPrefab.cs | 42 ---- .../Quality/Models/QualityModel.cs | 40 ---- .../KE.Utilsmap/Quality/QualityHandler.cs | 61 ----- .../KE.Utilsmap/Quality/QualityToysHandler.cs | 155 ------------- .../Quality/Settings/QualitySettings.cs | 62 ------ .../Quality/Structs/LocalWorldSpace.cs | 23 -- .../KE.Utilsmap/Quality/Tests/Test.cs | 108 --------- .../Displays/DisplayMeow/DisplayHandler.cs | 67 ------ .../API/Displays/DisplayMeow/HintPlacement.cs | 31 --- .../KE.Utilsmisc/API/Interfaces/IEvents.cs | 17 -- .../KE.Utilsmisc/API/ReflectionHelper.cs | 47 ---- .../Extensions/AdminToyExtension.cs | 29 --- .../KE.Utilsmisc/Extensions/DoorExtension.cs | 14 -- .../Extensions/PlayerExtension.cs | 52 ----- .../KE.Utilsmisc/Extensions/RoomExtensions.cs | 55 ----- .../utils-merged/KE.Utilsmisc/KE.Utils.csproj | 30 --- .../Quality/Enums/ModelQuality.cs | 16 -- .../Quality/Handlers/QualityToysHandler.cs | 179 --------------- .../Quality/Models/Base/BaseModel.cs | 41 ---- .../Quality/Models/Base/LightModel.cs | 26 --- .../Quality/Models/Base/PrimitiveModel.cs | 26 --- .../Quality/Models/Examples/MineModel.cs | 118 ---------- .../KE.Utilsmisc/Quality/Models/Model.cs | 104 --------- .../Quality/Models/ModelPrefab.cs | 42 ---- .../Quality/Models/QualityModel.cs | 40 ---- .../KE.Utilsmisc/Quality/QualityHandler.cs | 61 ----- .../Quality/QualityToysHandler.cs | 155 ------------- .../Quality/Settings/QualitySettings.cs | 62 ------ .../Quality/Structs/LocalWorldSpace.cs | 23 -- .../KE.Utilsmisc/Quality/Tests/Test.cs | 108 --------- 147 files changed, 8771 deletions(-) delete mode 100644 KruacentExiled/utils-merged/KE.Utilsci/API/Displays/DisplayMeow/DisplayHandler.cs delete mode 100644 KruacentExiled/utils-merged/KE.Utilsci/API/Displays/DisplayMeow/HintPlacement.cs delete mode 100644 KruacentExiled/utils-merged/KE.Utilsci/API/Interfaces/IEvents.cs delete mode 100644 KruacentExiled/utils-merged/KE.Utilsci/API/Sounds/SoundPlayer.cs delete mode 100644 KruacentExiled/utils-merged/KE.Utilsci/Extensions/AdminToyExtension.cs delete mode 100644 KruacentExiled/utils-merged/KE.Utilsci/Extensions/PlayerExtension.cs delete mode 100644 KruacentExiled/utils-merged/KE.Utilsci/Extensions/RoomExtension.cs delete mode 100644 KruacentExiled/utils-merged/KE.Utilsci/KE.Utils.csproj delete mode 100644 KruacentExiled/utils-merged/KE.Utilsci/Quality/Enums/ModelQuality.cs delete mode 100644 KruacentExiled/utils-merged/KE.Utilsci/Quality/Handlers/QualityToysHandler.cs delete mode 100644 KruacentExiled/utils-merged/KE.Utilsci/Quality/Models/Base/BaseModel.cs delete mode 100644 KruacentExiled/utils-merged/KE.Utilsci/Quality/Models/Base/LightModel.cs delete mode 100644 KruacentExiled/utils-merged/KE.Utilsci/Quality/Models/Base/PrimitiveModel.cs delete mode 100644 KruacentExiled/utils-merged/KE.Utilsci/Quality/Models/Examples/MineModel.cs delete mode 100644 KruacentExiled/utils-merged/KE.Utilsci/Quality/Models/Model.cs delete mode 100644 KruacentExiled/utils-merged/KE.Utilsci/Quality/Models/ModelPrefab.cs delete mode 100644 KruacentExiled/utils-merged/KE.Utilsci/Quality/Models/QualityModel.cs delete mode 100644 KruacentExiled/utils-merged/KE.Utilsci/Quality/QualityHandler.cs delete mode 100644 KruacentExiled/utils-merged/KE.Utilsci/Quality/QualityToysHandler.cs delete mode 100644 KruacentExiled/utils-merged/KE.Utilsci/Quality/Settings/QualitySettings.cs delete mode 100644 KruacentExiled/utils-merged/KE.Utilsci/Quality/Structs/LocalWorldSpace.cs delete mode 100644 KruacentExiled/utils-merged/KE.Utilsci/Quality/Tests/Test.cs delete mode 100644 KruacentExiled/utils-merged/KE.Utilscr/API/Displays/DisplayMeow/DisplayHandler.cs delete mode 100644 KruacentExiled/utils-merged/KE.Utilscr/API/Displays/DisplayMeow/HintPlacement.cs delete mode 100644 KruacentExiled/utils-merged/KE.Utilscr/API/Interfaces/IEvents.cs delete mode 100644 KruacentExiled/utils-merged/KE.Utilscr/API/OtherUtils.cs delete mode 100644 KruacentExiled/utils-merged/KE.Utilscr/Extensions/AdminToyExtension.cs delete mode 100644 KruacentExiled/utils-merged/KE.Utilscr/Extensions/PlayerExtension.cs delete mode 100644 KruacentExiled/utils-merged/KE.Utilscr/Extensions/RoomExtension.cs delete mode 100644 KruacentExiled/utils-merged/KE.Utilscr/KE.Utils.csproj delete mode 100644 KruacentExiled/utils-merged/KE.Utilscr/Quality/Enums/ModelQuality.cs delete mode 100644 KruacentExiled/utils-merged/KE.Utilscr/Quality/Handlers/QualityToysHandler.cs delete mode 100644 KruacentExiled/utils-merged/KE.Utilscr/Quality/Models/Base/BaseModel.cs delete mode 100644 KruacentExiled/utils-merged/KE.Utilscr/Quality/Models/Base/LightModel.cs delete mode 100644 KruacentExiled/utils-merged/KE.Utilscr/Quality/Models/Base/PrimitiveModel.cs delete mode 100644 KruacentExiled/utils-merged/KE.Utilscr/Quality/Models/Examples/MineModel.cs delete mode 100644 KruacentExiled/utils-merged/KE.Utilscr/Quality/Models/Model.cs delete mode 100644 KruacentExiled/utils-merged/KE.Utilscr/Quality/Models/ModelPrefab.cs delete mode 100644 KruacentExiled/utils-merged/KE.Utilscr/Quality/Models/QualityModel.cs delete mode 100644 KruacentExiled/utils-merged/KE.Utilscr/Quality/QualityHandler.cs delete mode 100644 KruacentExiled/utils-merged/KE.Utilscr/Quality/QualityToysHandler.cs delete mode 100644 KruacentExiled/utils-merged/KE.Utilscr/Quality/Settings/QualitySettings.cs delete mode 100644 KruacentExiled/utils-merged/KE.Utilscr/Quality/Structs/LocalWorldSpace.cs delete mode 100644 KruacentExiled/utils-merged/KE.Utilscr/Quality/Tests/Test.cs delete mode 100644 KruacentExiled/utils-merged/KE.Utilsge/API/Displays/DisplayMeow/DisplayHandler.cs delete mode 100644 KruacentExiled/utils-merged/KE.Utilsge/API/Displays/DisplayMeow/HintPlacement.cs delete mode 100644 KruacentExiled/utils-merged/KE.Utilsge/API/Interfaces/IEvents.cs delete mode 100644 KruacentExiled/utils-merged/KE.Utilsge/API/ReflectionHelper.cs delete mode 100644 KruacentExiled/utils-merged/KE.Utilsge/API/Sounds/SoundPlayer.cs delete mode 100644 KruacentExiled/utils-merged/KE.Utilsge/Extensions/AdminToyExtension.cs delete mode 100644 KruacentExiled/utils-merged/KE.Utilsge/Extensions/PlayerExtension.cs delete mode 100644 KruacentExiled/utils-merged/KE.Utilsge/Extensions/RoomExtension.cs delete mode 100644 KruacentExiled/utils-merged/KE.Utilsge/KE.Utils.csproj delete mode 100644 KruacentExiled/utils-merged/KE.Utilsge/Quality/Enums/ModelQuality.cs delete mode 100644 KruacentExiled/utils-merged/KE.Utilsge/Quality/Handlers/QualityToysHandler.cs delete mode 100644 KruacentExiled/utils-merged/KE.Utilsge/Quality/Models/Base/BaseModel.cs delete mode 100644 KruacentExiled/utils-merged/KE.Utilsge/Quality/Models/Base/LightModel.cs delete mode 100644 KruacentExiled/utils-merged/KE.Utilsge/Quality/Models/Base/PrimitiveModel.cs delete mode 100644 KruacentExiled/utils-merged/KE.Utilsge/Quality/Models/Examples/MineModel.cs delete mode 100644 KruacentExiled/utils-merged/KE.Utilsge/Quality/Models/Model.cs delete mode 100644 KruacentExiled/utils-merged/KE.Utilsge/Quality/Models/ModelPrefab.cs delete mode 100644 KruacentExiled/utils-merged/KE.Utilsge/Quality/Models/QualityModel.cs delete mode 100644 KruacentExiled/utils-merged/KE.Utilsge/Quality/QualityHandler.cs delete mode 100644 KruacentExiled/utils-merged/KE.Utilsge/Quality/QualityToysHandler.cs delete mode 100644 KruacentExiled/utils-merged/KE.Utilsge/Quality/Settings/QualitySettings.cs delete mode 100644 KruacentExiled/utils-merged/KE.Utilsge/Quality/Structs/LocalWorldSpace.cs delete mode 100644 KruacentExiled/utils-merged/KE.Utilsge/Quality/Tests/Test.cs delete mode 100644 KruacentExiled/utils-merged/KE.Utilsmap/API/Displays/DisplayMeow/DisplayHandler.cs delete mode 100644 KruacentExiled/utils-merged/KE.Utilsmap/API/Displays/DisplayMeow/HintPlacement.cs delete mode 100644 KruacentExiled/utils-merged/KE.Utilsmap/API/GifAnimator/RenderGif.cs delete mode 100644 KruacentExiled/utils-merged/KE.Utilsmap/API/Interfaces/IEvents.cs delete mode 100644 KruacentExiled/utils-merged/KE.Utilsmap/API/Interfaces/ILoadable.cs delete mode 100644 KruacentExiled/utils-merged/KE.Utilsmap/API/Models/Arrows/Arrow.cs delete mode 100644 KruacentExiled/utils-merged/KE.Utilsmap/API/Models/Arrows/MoveArrow.cs delete mode 100644 KruacentExiled/utils-merged/KE.Utilsmap/API/Models/Arrows/RotateArrow.cs delete mode 100644 KruacentExiled/utils-merged/KE.Utilsmap/API/Models/Arrows/ScaleArrow.cs delete mode 100644 KruacentExiled/utils-merged/KE.Utilsmap/API/Models/Arrows/XArrow.cs delete mode 100644 KruacentExiled/utils-merged/KE.Utilsmap/API/Models/Arrows/YArrow.cs delete mode 100644 KruacentExiled/utils-merged/KE.Utilsmap/API/Models/Arrows/ZArrow.cs delete mode 100644 KruacentExiled/utils-merged/KE.Utilsmap/API/Models/Blueprints/AdminToyBlueprint.cs delete mode 100644 KruacentExiled/utils-merged/KE.Utilsmap/API/Models/Blueprints/LightBlueprint.cs delete mode 100644 KruacentExiled/utils-merged/KE.Utilsmap/API/Models/Blueprints/ModelBlueprint.cs delete mode 100644 KruacentExiled/utils-merged/KE.Utilsmap/API/Models/Blueprints/PrimitiveBlueprint.cs delete mode 100644 KruacentExiled/utils-merged/KE.Utilsmap/API/Models/Commands/AllCommands.cs delete mode 100644 KruacentExiled/utils-merged/KE.Utilsmap/API/Models/Commands/ChangeColor.cs delete mode 100644 KruacentExiled/utils-merged/KE.Utilsmap/API/Models/Commands/ChangePrimType.cs delete mode 100644 KruacentExiled/utils-merged/KE.Utilsmap/API/Models/Commands/CreateModel.cs delete mode 100644 KruacentExiled/utils-merged/KE.Utilsmap/API/Models/Commands/CreatePrim.cs delete mode 100644 KruacentExiled/utils-merged/KE.Utilsmap/API/Models/Commands/ListModel.cs delete mode 100644 KruacentExiled/utils-merged/KE.Utilsmap/API/Models/Commands/LoadModel.cs delete mode 100644 KruacentExiled/utils-merged/KE.Utilsmap/API/Models/Commands/ModeMovePrim.cs delete mode 100644 KruacentExiled/utils-merged/KE.Utilsmap/API/Models/Commands/SaveModel.cs delete mode 100644 KruacentExiled/utils-merged/KE.Utilsmap/API/Models/Commands/SelectModel.cs delete mode 100644 KruacentExiled/utils-merged/KE.Utilsmap/API/Models/Commands/ShowCenter.cs delete mode 100644 KruacentExiled/utils-merged/KE.Utilsmap/API/Models/Model.cs delete mode 100644 KruacentExiled/utils-merged/KE.Utilsmap/API/Models/ModelCreator.cs delete mode 100644 KruacentExiled/utils-merged/KE.Utilsmap/API/Models/ModelLoader.cs delete mode 100644 KruacentExiled/utils-merged/KE.Utilsmap/API/Models/Models.cs delete mode 100644 KruacentExiled/utils-merged/KE.Utilsmap/API/Models/MovementHandler.cs delete mode 100644 KruacentExiled/utils-merged/KE.Utilsmap/API/Models/SelectedModel.cs delete mode 100644 KruacentExiled/utils-merged/KE.Utilsmap/API/Models/ToysSettings/PrimitiveSetting.cs delete mode 100644 KruacentExiled/utils-merged/KE.Utilsmap/API/Models/ToysSettings/ToySetting.cs delete mode 100644 KruacentExiled/utils-merged/KE.Utilsmap/API/OtherUtils.cs delete mode 100644 KruacentExiled/utils-merged/KE.Utilsmap/API/Parser.cs delete mode 100644 KruacentExiled/utils-merged/KE.Utilsmap/API/Sounds/SoundPlayer.cs delete mode 100644 KruacentExiled/utils-merged/KE.Utilsmap/Extensions/AdminToyExtension.cs delete mode 100644 KruacentExiled/utils-merged/KE.Utilsmap/Extensions/NpcExtension.cs delete mode 100644 KruacentExiled/utils-merged/KE.Utilsmap/Extensions/PlayerExtension.cs delete mode 100644 KruacentExiled/utils-merged/KE.Utilsmap/Extensions/RoomExtension.cs delete mode 100644 KruacentExiled/utils-merged/KE.Utilsmap/KE.Utils.csproj delete mode 100644 KruacentExiled/utils-merged/KE.Utilsmap/Quality/Enums/ModelQuality.cs delete mode 100644 KruacentExiled/utils-merged/KE.Utilsmap/Quality/Handlers/QualityToysHandler.cs delete mode 100644 KruacentExiled/utils-merged/KE.Utilsmap/Quality/Models/Base/BaseModel.cs delete mode 100644 KruacentExiled/utils-merged/KE.Utilsmap/Quality/Models/Base/LightModel.cs delete mode 100644 KruacentExiled/utils-merged/KE.Utilsmap/Quality/Models/Base/PrimitiveModel.cs delete mode 100644 KruacentExiled/utils-merged/KE.Utilsmap/Quality/Models/Examples/MineModel.cs delete mode 100644 KruacentExiled/utils-merged/KE.Utilsmap/Quality/Models/Model.cs delete mode 100644 KruacentExiled/utils-merged/KE.Utilsmap/Quality/Models/ModelPrefab.cs delete mode 100644 KruacentExiled/utils-merged/KE.Utilsmap/Quality/Models/QualityModel.cs delete mode 100644 KruacentExiled/utils-merged/KE.Utilsmap/Quality/QualityHandler.cs delete mode 100644 KruacentExiled/utils-merged/KE.Utilsmap/Quality/QualityToysHandler.cs delete mode 100644 KruacentExiled/utils-merged/KE.Utilsmap/Quality/Settings/QualitySettings.cs delete mode 100644 KruacentExiled/utils-merged/KE.Utilsmap/Quality/Structs/LocalWorldSpace.cs delete mode 100644 KruacentExiled/utils-merged/KE.Utilsmap/Quality/Tests/Test.cs delete mode 100644 KruacentExiled/utils-merged/KE.Utilsmisc/API/Displays/DisplayMeow/DisplayHandler.cs delete mode 100644 KruacentExiled/utils-merged/KE.Utilsmisc/API/Displays/DisplayMeow/HintPlacement.cs delete mode 100644 KruacentExiled/utils-merged/KE.Utilsmisc/API/Interfaces/IEvents.cs delete mode 100644 KruacentExiled/utils-merged/KE.Utilsmisc/API/ReflectionHelper.cs delete mode 100644 KruacentExiled/utils-merged/KE.Utilsmisc/Extensions/AdminToyExtension.cs delete mode 100644 KruacentExiled/utils-merged/KE.Utilsmisc/Extensions/DoorExtension.cs delete mode 100644 KruacentExiled/utils-merged/KE.Utilsmisc/Extensions/PlayerExtension.cs delete mode 100644 KruacentExiled/utils-merged/KE.Utilsmisc/Extensions/RoomExtensions.cs delete mode 100644 KruacentExiled/utils-merged/KE.Utilsmisc/KE.Utils.csproj delete mode 100644 KruacentExiled/utils-merged/KE.Utilsmisc/Quality/Enums/ModelQuality.cs delete mode 100644 KruacentExiled/utils-merged/KE.Utilsmisc/Quality/Handlers/QualityToysHandler.cs delete mode 100644 KruacentExiled/utils-merged/KE.Utilsmisc/Quality/Models/Base/BaseModel.cs delete mode 100644 KruacentExiled/utils-merged/KE.Utilsmisc/Quality/Models/Base/LightModel.cs delete mode 100644 KruacentExiled/utils-merged/KE.Utilsmisc/Quality/Models/Base/PrimitiveModel.cs delete mode 100644 KruacentExiled/utils-merged/KE.Utilsmisc/Quality/Models/Examples/MineModel.cs delete mode 100644 KruacentExiled/utils-merged/KE.Utilsmisc/Quality/Models/Model.cs delete mode 100644 KruacentExiled/utils-merged/KE.Utilsmisc/Quality/Models/ModelPrefab.cs delete mode 100644 KruacentExiled/utils-merged/KE.Utilsmisc/Quality/Models/QualityModel.cs delete mode 100644 KruacentExiled/utils-merged/KE.Utilsmisc/Quality/QualityHandler.cs delete mode 100644 KruacentExiled/utils-merged/KE.Utilsmisc/Quality/QualityToysHandler.cs delete mode 100644 KruacentExiled/utils-merged/KE.Utilsmisc/Quality/Settings/QualitySettings.cs delete mode 100644 KruacentExiled/utils-merged/KE.Utilsmisc/Quality/Structs/LocalWorldSpace.cs delete mode 100644 KruacentExiled/utils-merged/KE.Utilsmisc/Quality/Tests/Test.cs diff --git a/KruacentExiled/utils-merged/KE.Utilsci/API/Displays/DisplayMeow/DisplayHandler.cs b/KruacentExiled/utils-merged/KE.Utilsci/API/Displays/DisplayMeow/DisplayHandler.cs deleted file mode 100644 index 4ee13535..00000000 --- a/KruacentExiled/utils-merged/KE.Utilsci/API/Displays/DisplayMeow/DisplayHandler.cs +++ /dev/null @@ -1,67 +0,0 @@ -using Exiled.API.Features; -using HintServiceMeow.Core.Extension; -using HintServiceMeow.Core.Models.Hints; -using HintServiceMeow.Core.Utilities; -using MEC; - - -//damn why the same name -using MHint = HintServiceMeow.Core.Models.Hints.Hint; - -namespace KE.Utils.API.Displays.DisplayMeow -{ - public class DisplayHandler - { - public static DisplayHandler Instance { get; } = new(); - - private DisplayHandler() { } - - - - - - - public MHint AddHint(HintPlacement hintPlacement, Player player, string text, float delay) - { - var dis = PlayerDisplay.Get(player); - string id = $"{player.Id}_{hintPlacement.XCoordinate}_{hintPlacement.YCoordinate}"; - MHint hint; - - if (!dis.TryGetHint(id, out var aHint)) - { - hint = new() - { - Text = text, - XCoordinate = hintPlacement.XCoordinate, - YCoordinate = hintPlacement.YCoordinate, - Alignment = hintPlacement.HintAlignment, - Id = id - - }; - dis.AddHint(hint); - - } - else - { - - hint = (MHint)aHint; - hint.Hide = false; - hint.Text = text; - } - - - hint.HideAfter(delay); - return hint; - } - - - - - - - - - - - } -} diff --git a/KruacentExiled/utils-merged/KE.Utilsci/API/Displays/DisplayMeow/HintPlacement.cs b/KruacentExiled/utils-merged/KE.Utilsci/API/Displays/DisplayMeow/HintPlacement.cs deleted file mode 100644 index 936cdbe9..00000000 --- a/KruacentExiled/utils-merged/KE.Utilsci/API/Displays/DisplayMeow/HintPlacement.cs +++ /dev/null @@ -1,31 +0,0 @@ -using HintServiceMeow.Core.Enum; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace KE.Utils.API.Displays.DisplayMeow -{ - public readonly struct HintPlacement : IEquatable - { - public float YCoordinate { get; } - public float XCoordinate { get; } - public HintAlignment HintAlignment { get; } = HintAlignment.Center; - - - public bool Equals(HintPlacement obj) - { - return YCoordinate == obj.YCoordinate && XCoordinate == obj.XCoordinate; - } - - - public HintPlacement(float xCoordinate, float yCoordinate, HintAlignment alignment = HintAlignment.Center) - { - YCoordinate = yCoordinate; - XCoordinate = xCoordinate; - HintAlignment = alignment; - } - - } -} diff --git a/KruacentExiled/utils-merged/KE.Utilsci/API/Interfaces/IEvents.cs b/KruacentExiled/utils-merged/KE.Utilsci/API/Interfaces/IEvents.cs deleted file mode 100644 index e573b062..00000000 --- a/KruacentExiled/utils-merged/KE.Utilsci/API/Interfaces/IEvents.cs +++ /dev/null @@ -1,17 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace KE.Utils.API.Interfaces -{ - public interface IUsingEvents - { - - - public void SubscribeEvents(); - - public void UnsubscribeEvents(); - } -} diff --git a/KruacentExiled/utils-merged/KE.Utilsci/API/Sounds/SoundPlayer.cs b/KruacentExiled/utils-merged/KE.Utilsci/API/Sounds/SoundPlayer.cs deleted file mode 100644 index 19f0c310..00000000 --- a/KruacentExiled/utils-merged/KE.Utilsci/API/Sounds/SoundPlayer.cs +++ /dev/null @@ -1,112 +0,0 @@ -using Exiled.API.Features; -using System; -using System.Collections.Generic; -using System.IO; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using UnityEngine; - -namespace KE.Utils.API.Sounds -{ - public class SoundPlayer - { - private static SoundPlayer _instance; - - public static SoundPlayer Instance - { - get - { - if(_instance == null) - { - _instance = new(); - } - return _instance; - } - } - - private SoundPlayer() { } - - private bool _loaded = false; - public bool Loaded => _loaded; - - - public static string SoundLocation => Paths.Configs + "/Sounds"; - public static void Load() => Instance.TryLoad(); - public void TryLoad() - { - if (Loaded) - { - return; - } - - if (!Directory.Exists(SoundLocation)) - { - Log.Warn("Directory not found. creating..."); - Directory.CreateDirectory(SoundLocation); - } - - string[] rawfile = Directory.GetFiles(SoundLocation, "*.ogg"); - - foreach (string file in rawfile) - { - string noExFile = Path.GetFileNameWithoutExtension(file); - Log.Info($"loading {file} as {noExFile}"); - AudioClipStorage.LoadClip(file); - } - _loaded = true; - } - - - /// - /// Play a clip at a static point - /// - /// - /// - /// - /// - public void Play(string clipName, Vector3 pos, float volume = 50f, float maxDistance = 20f, bool isSpatial = true) - { - if (!Loaded) throw new Exception("clips not loaded use SoundPlayer.Load()"); - Log.Debug($"playing {clipName} at {pos}"); - - var audioPlayer = AudioPlayer.CreateOrGet($"{clipName} ({pos})", onIntialCreation: (p) => - { - GameObject a = new GameObject(); - a.transform.position = pos; - p.transform.parent = a.transform; - Speaker speaker = p.AddSpeaker("main", isSpatial: isSpatial, maxDistance: maxDistance, minDistance: 1f); - speaker.transform.parent = a.transform; - speaker.transform.localPosition = Vector3.zero; - }); - - audioPlayer.AddClip(clipName, volume: volume); - audioPlayer.DestroyWhenAllClipsPlayed = true; - - } - - /// - /// Play a clip at a - /// - /// - /// - /// - /// - public void Play(string clipName, GameObject objectEmittingSound, float volume = 50f, float maxDistance = 20f, bool isSpatial = true) - { - if (!Loaded) throw new Exception("clips not loaded use SoundPlayer.Instance.Load()"); - Log.Debug($"playing {clipName} at {objectEmittingSound}"); - - var audioPlayer = AudioPlayer.CreateOrGet($"{clipName} ({objectEmittingSound})", onIntialCreation: (p) => - { - - p.transform.parent = objectEmittingSound.transform; - Speaker speaker = p.AddSpeaker("main", isSpatial: isSpatial, maxDistance: maxDistance, minDistance: 1f); - speaker.transform.parent = objectEmittingSound.transform; - speaker.transform.localPosition = Vector3.zero; - }); - audioPlayer.AddClip(clipName, volume: volume); - audioPlayer.DestroyWhenAllClipsPlayed = true; - } - } -} diff --git a/KruacentExiled/utils-merged/KE.Utilsci/Extensions/AdminToyExtension.cs b/KruacentExiled/utils-merged/KE.Utilsci/Extensions/AdminToyExtension.cs deleted file mode 100644 index 37c3706d..00000000 --- a/KruacentExiled/utils-merged/KE.Utilsci/Extensions/AdminToyExtension.cs +++ /dev/null @@ -1,25 +0,0 @@ -using Exiled.API.Features.Toys; -using KE.Utils.Quality; -using KE.Utils.Quality.Enums; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace KE.Utils.Extensions -{ - public static class AdminToyExtension - { - - public static void SetAsPickupAdminToy(this AdminToy toy, bool autoSync = true) - { - QualityHandler.Instance.QualityToysHandler.SetAsPickup(toy); - } - - public static void SetQuality(this AdminToy toy, ModelQuality modelQuality,bool autoSync = true) - { - QualityHandler.Instance.QualityToysHandler.SetQuality(toy, modelQuality); - } - } -} diff --git a/KruacentExiled/utils-merged/KE.Utilsci/Extensions/PlayerExtension.cs b/KruacentExiled/utils-merged/KE.Utilsci/Extensions/PlayerExtension.cs deleted file mode 100644 index b01f98d2..00000000 --- a/KruacentExiled/utils-merged/KE.Utilsci/Extensions/PlayerExtension.cs +++ /dev/null @@ -1,52 +0,0 @@ -using CustomPlayerEffects; -using Exiled.API.Enums; -using Exiled.API.Features; -using Mirror; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using UnityEngine; - -namespace KE.Utils.Extensions -{ - public static class PlayerExtension - { - public static void SetFakeInvis(this Player p, IEnumerable viewers) - { - Vector3 pos = p.Position; - - try - { - p.ReferenceHub.transform.localPosition = Vector3.zero; - foreach (Player viewer in viewers) - { - Server.SendSpawnMessage.Invoke(null, new object[2] { viewer.NetworkIdentity, viewer.Connection }); - } - - p.ReferenceHub.transform.localPosition = pos; - } - catch (Exception arg) - { - Log.Error(string.Format("{0}: {1}", "SetFakeInvis", arg)); - } - } - - - - - public static void AddLevelEffect(this Player p,EffectType type, int intensity) - { - - - if (!p.TryGetEffect(type, out var effect)) - p.ChangeEffectIntensity(type, (byte)(effect.Intensity + intensity)); - else - p.EnableEffect(type, (byte)intensity); - } - - - - } -} diff --git a/KruacentExiled/utils-merged/KE.Utilsci/Extensions/RoomExtension.cs b/KruacentExiled/utils-merged/KE.Utilsci/Extensions/RoomExtension.cs deleted file mode 100644 index 35fee2e8..00000000 --- a/KruacentExiled/utils-merged/KE.Utilsci/Extensions/RoomExtension.cs +++ /dev/null @@ -1,12 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace KE.Utils.Extensions -{ - internal class RoomExtension - { - } -} diff --git a/KruacentExiled/utils-merged/KE.Utilsci/KE.Utils.csproj b/KruacentExiled/utils-merged/KE.Utilsci/KE.Utils.csproj deleted file mode 100644 index 1ad75e64..00000000 --- a/KruacentExiled/utils-merged/KE.Utilsci/KE.Utils.csproj +++ /dev/null @@ -1,31 +0,0 @@ - - - - 13.0 - net48 - - - - - - - - - - - - - - - - - - - if not "$(EXILED_DEV_REFERENCES)"=="" copy /y "$(OutputPath)$(AssemblyName).dll" "$(EXILED_DEV_REFERENCES)\Plugins\" - - - if [[ ! -z "$EXILED_DEV_REFERENCES" ]]; then cp "$(OutputPath)$(AssemblyName).dll" "$EXILED_DEV_REFERENCES/Plugins/"; fi - - - - diff --git a/KruacentExiled/utils-merged/KE.Utilsci/Quality/Enums/ModelQuality.cs b/KruacentExiled/utils-merged/KE.Utilsci/Quality/Enums/ModelQuality.cs deleted file mode 100644 index d9d8d295..00000000 --- a/KruacentExiled/utils-merged/KE.Utilsci/Quality/Enums/ModelQuality.cs +++ /dev/null @@ -1,16 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace KE.Utils.Quality.Enums -{ - public enum ModelQuality - { - None = -1, - Low, - Medium, - High, - } -} diff --git a/KruacentExiled/utils-merged/KE.Utilsci/Quality/Handlers/QualityToysHandler.cs b/KruacentExiled/utils-merged/KE.Utilsci/Quality/Handlers/QualityToysHandler.cs deleted file mode 100644 index b2485795..00000000 --- a/KruacentExiled/utils-merged/KE.Utilsci/Quality/Handlers/QualityToysHandler.cs +++ /dev/null @@ -1,179 +0,0 @@ -using AdminToys; -using Exiled.API.Enums; -using Exiled.API.Extensions; -using Exiled.API.Features; -using Exiled.API.Features.Toys; -using KE.Utils.Quality.Enums; -using KE.Utils.Quality.Settings; -using MEC; -using System; -using System.Collections.Generic; -using System.Linq; -using UnityEngine; -using Light = Exiled.API.Features.Toys.Light; -using QualitySettings = KE.Utils.Quality.Settings.QualitySettings; - -namespace KE.Utils.Quality.Handlers -{ - public class QualityToysHandler - { - private HashSet _pickupToys = new(); - private Dictionary _qualityToys = new(); - public readonly Vector3 Gulag = new Vector3(15000, 15000, 15000); - public const float Delay = Timing.WaitForOneFrame; - public bool IsPickupToy(AdminToy primitive) - { - return _pickupToys.Contains(primitive); - } - - public bool IsQualityToy(AdminToy primitive) - { - return _qualityToys.ContainsKey(primitive); - } - - - public void SetAsPickup(AdminToy toy, bool autoSync = true) - { - if (!_pickupToys.Add(toy)) - { - Log.Warn($"AdminToy {toy} is already a pickupToy"); - return; - } - if (autoSync) - Sync(toy); - } - - public void SetQuality(AdminToy toy, ModelQuality quality, bool autoSync = true) - { - if (toy == null) return; - if (!_qualityToys.ContainsKey(toy)) - _qualityToys.Add(toy, quality); - else - _qualityToys[toy] = quality; - - if (autoSync) - Sync(toy); - } - - - - private void SendToFakePosition(AdminToy adminToy, Player player,Vector3 position) - { - //idk why but without delay it show all of the quality at once - Timing.CallDelayed(Delay, () => - { - if (adminToy is Light l) - { - player.SendFakeSyncVar(l.Base.netIdentity, typeof(LightSourceToy), nameof(LightSourceToy.NetworkPosition), position); - return; - } - if (adminToy is Primitive p) - { - player.SendFakeSyncVar(p.Base.netIdentity, typeof(PrimitiveObjectToy), nameof(PrimitiveObjectToy.NetworkPosition), position); - return; - } - }); - - } - - /// - /// Sync every Players - /// - public void Sync() - { - foreach (Player p in Player.List) - { - Sync(p); - } - } - - /// - /// Sync a specified Player - /// - /// - public void Sync(Player p) - { - - - - var quality = QualitySettings.Get(p); - var pickup = QualitySettings.PickmodelActivated(p); - - HashSet pickupToRemove = []; - HashSet qualityToRemove = []; - - //hide pickup toys - - foreach (AdminToy pk in _pickupToys) - { - try - { - if (pickup) - { - SendToFakePosition(pk, p, pk.Position); - } - else - { - SendToFakePosition(pk, p, Gulag); - } - } - catch (NullReferenceException) - { - //Log.Warn("removing pickup"); - pickupToRemove.Add(pk); - } - - } - - _pickupToys.RemoveWhere(p => pickupToRemove.Contains(p)); - - - foreach (var at in _qualityToys) - { - try - { - if ((at.Value == quality || at.Value == ModelQuality.None) && (pickup || !_pickupToys.Contains(at.Key))) - { - SendToFakePosition(at.Key, p, at.Key.Position); - } - else - { - SendToFakePosition(at.Key, p, Gulag); - } - } - catch (NullReferenceException) - { - //Log.Warn("removing quality" + _qualityToys.Count); - qualityToRemove.Add(at.Key); - } - - - } - foreach(var at in qualityToRemove) - { - - _qualityToys.Remove(at); - } - - } - - /// - /// Sync a specified AdminToy - /// - /// - public void Sync(AdminToy adminToy) - { - //temporary fix - Sync(); - - if (IsPickupToy(adminToy)) - { - - } - if (IsQualityToy(adminToy)) - { - - } - } - } -} diff --git a/KruacentExiled/utils-merged/KE.Utilsci/Quality/Models/Base/BaseModel.cs b/KruacentExiled/utils-merged/KE.Utilsci/Quality/Models/Base/BaseModel.cs deleted file mode 100644 index c9f6723c..00000000 --- a/KruacentExiled/utils-merged/KE.Utilsci/Quality/Models/Base/BaseModel.cs +++ /dev/null @@ -1,41 +0,0 @@ -using Exiled.API.Enums; -using Exiled.API.Extensions; -using Exiled.API.Features.Toys; -using Exiled.API.Interfaces; -using KE.Utils.Quality.Structs; -using PlayerStatsSystem; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using UnityEngine; -using Light = Exiled.API.Features.Toys.Light; - -namespace KE.Utils.Quality.Models.Base -{ - - /// - /// The blocks to build a model with - /// - public abstract class BaseModel : ICloneable - { - - protected AdminToy _toy; - public AdminToy AdminToy { get { return _toy; } } - private Vector3 _position; - public Vector3 LocalPosition { get { return _position; } } - private Quaternion _rotation; - public Quaternion LocalRotation { get { return _rotation; } } - - - public BaseModel(Vector3 localPositon, Quaternion localRotation) - { - _position = localPositon; - _rotation = localRotation; - } - - public abstract object Clone(); - } - -} diff --git a/KruacentExiled/utils-merged/KE.Utilsci/Quality/Models/Base/LightModel.cs b/KruacentExiled/utils-merged/KE.Utilsci/Quality/Models/Base/LightModel.cs deleted file mode 100644 index ce808da1..00000000 --- a/KruacentExiled/utils-merged/KE.Utilsci/Quality/Models/Base/LightModel.cs +++ /dev/null @@ -1,26 +0,0 @@ -using Exiled.API.Features.Toys; -using UnityEngine; -using Light = Exiled.API.Features.Toys.Light; - -namespace KE.Utils.Quality.Models.Base -{ - public class LightModel : BaseModel - { - - /// - /// Create a new Light for modeling - /// - public LightModel(Vector3? scale, Color? color, Vector3 localPositon, Quaternion localRotation) : base(localPositon, localRotation) - { - Light light = Light.Create(null, null, scale, false, color); - _toy = light; - } - - - public override object Clone() - { - Light light = _toy as Light; - return new LightModel(light.Scale, light.Color, LocalPosition, LocalRotation); - } - } -} diff --git a/KruacentExiled/utils-merged/KE.Utilsci/Quality/Models/Base/PrimitiveModel.cs b/KruacentExiled/utils-merged/KE.Utilsci/Quality/Models/Base/PrimitiveModel.cs deleted file mode 100644 index 22e07225..00000000 --- a/KruacentExiled/utils-merged/KE.Utilsci/Quality/Models/Base/PrimitiveModel.cs +++ /dev/null @@ -1,26 +0,0 @@ -using Exiled.API.Features.Toys; -using UnityEngine; -using Color = UnityEngine.Color; - -namespace KE.Utils.Quality.Models.Base -{ - public class PrimitiveModel : BaseModel - { - /// - /// Create a new Primitive for modeling - /// - public PrimitiveModel(PrimitiveType type, Vector3? scale, Color? color,Vector3 localPosition,Quaternion localRotation) : base(localPosition, localRotation) - { - - Primitive prim = Primitive.Create(type, null, null, scale, false, color); - prim.Collidable = false; - _toy = prim; - } - - public override object Clone() - { - Primitive prim = _toy as Primitive; - return new PrimitiveModel(prim.Type, prim.Scale, prim.Color, LocalPosition, LocalRotation); - } - } -} diff --git a/KruacentExiled/utils-merged/KE.Utilsci/Quality/Models/Examples/MineModel.cs b/KruacentExiled/utils-merged/KE.Utilsci/Quality/Models/Examples/MineModel.cs deleted file mode 100644 index 00d60fec..00000000 --- a/KruacentExiled/utils-merged/KE.Utilsci/Quality/Models/Examples/MineModel.cs +++ /dev/null @@ -1,118 +0,0 @@ -using KE.Utils.Quality.Enums; -using KE.Utils.Quality.Models.Base; -using System.Collections.Generic; -using UnityEngine; -using Light = Exiled.API.Features.Toys.Light; - -namespace KE.Utils.Quality.Models.Examples -{ - public abstract class MineModel : QualityModel - { - protected Light _light; - private bool _lightOn = false; - - - - - public void ToggleLight() - { - if (_light == null) throw new System.Exception("no light"); - if (_lightOn) - _light.UnSpawn(); - else - _light.Spawn(); - _lightOn = !_lightOn; - } - - } - - public class MineModelLow : MineModel - { - public override bool IsPickup => false; - public override ModelQuality Quality => ModelQuality.Low; - - protected override IEnumerable GetBaseModels() - { - Quaternion baseRotation = new(); - //spawn + offset - Vector3 offset = new Vector3(0, .05f); - Vector3 sizeDisk = new Vector3(.7f, 0.1f, .7f); - - Vector3 sizeGlobe = new Vector3(.1f, .1f, .1f); - Vector3 posLight = new Vector3(0, sizeDisk.y+sizeGlobe.y); - - - var baseMine = new PrimitiveModel(PrimitiveType.Cylinder, sizeDisk, Color.black, offset, baseRotation); - - var lightGlobe = new PrimitiveModel(PrimitiveType.Sphere, sizeGlobe , new Color(1, 0, 0, .33f), posLight, baseRotation); - - var lightMine = new LightModel(null, Color.red, posLight, baseRotation); - - _light = lightMine.AdminToy as Light; - _light.Intensity = .55f; - - return [baseMine, lightGlobe, lightMine]; - } - - - } - - public class MineModelMedium : MineModel - { - public override bool IsPickup => false; - public override ModelQuality Quality => ModelQuality.Medium; - - protected override IEnumerable GetBaseModels() - { - Quaternion baseRotation = new(); - //spawn + offset - Vector3 offset = new Vector3(0, .05f); - Vector3 sizeDisk = new Vector3(.7f, 0.1f, .7f); - - Vector3 sizeGlobe = new Vector3(.1f, .1f, .1f); - Vector3 posLight = new Vector3(0, sizeDisk.y + sizeGlobe.y); - - - var baseMine = new PrimitiveModel(PrimitiveType.Cylinder, sizeDisk, Color.black, offset, baseRotation); - - var lightGlobe = new PrimitiveModel(PrimitiveType.Sphere, sizeGlobe, new Color(1, 0, 0, .33f), posLight, baseRotation); - - var lightMine = new LightModel(null, Color.green, posLight, baseRotation); - - _light = lightMine.AdminToy as Light; - _light.Intensity = .55f; - - return [baseMine, lightGlobe, lightMine]; - } - } - - public class MineModelPickup : MineModel - { - public override bool IsPickup => true; - public override ModelQuality Quality => ModelQuality.None; - - - protected override IEnumerable GetBaseModels() - { - Quaternion baseRotation = new(); - //spawn + offset - Vector3 offset = new Vector3(0, .05f); - Vector3 sizeDisk = new Vector3(.7f, 0.1f, .7f); - - Vector3 sizeGlobe = new Vector3(.1f, .1f, .1f); - Vector3 posLight = new Vector3(0, sizeDisk.y + sizeGlobe.y); - - - var baseMine = new PrimitiveModel(PrimitiveType.Cylinder, sizeDisk, Color.black, offset, baseRotation); - - var lightGlobe = new PrimitiveModel(PrimitiveType.Sphere, sizeGlobe, new Color(1, 0, 0, .33f), posLight, baseRotation); - - var lightMine = new LightModel(null, Color.magenta, posLight, baseRotation); - - _light = lightMine.AdminToy as Light; - _light.Intensity = .55f; - - return [baseMine, lightGlobe, lightMine]; - } - } -} diff --git a/KruacentExiled/utils-merged/KE.Utilsci/Quality/Models/Model.cs b/KruacentExiled/utils-merged/KE.Utilsci/Quality/Models/Model.cs deleted file mode 100644 index 2e26756e..00000000 --- a/KruacentExiled/utils-merged/KE.Utilsci/Quality/Models/Model.cs +++ /dev/null @@ -1,104 +0,0 @@ -using Exiled.API.Features; -using Exiled.API.Features.Toys; -using KE.Utils.Quality.Models.Base; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using UnityEngine; - -namespace KE.Utils.Quality.Models -{ - public class Model : IEquatable - { - - - private Vector3 _position; - public Vector3 Position - { - get { return _position; } - set - { - _position = value; - } - } - private Quaternion _rotation; - public Quaternion Rotation - { - get { return _rotation; } - set - { - _rotation = value; - } - } - private ModelPrefab _prefab; - public ModelPrefab Prefab - { - get { return _prefab; } - } - - - - private HashSet _models; - - internal Model(ModelPrefab prefab, Vector3 position, Quaternion rotation,IEnumerable toys,bool spawn) - { - _prefab = prefab; - Position = position; - Rotation = rotation; - _models = new HashSet(toys); - QualityHandler.Instance.QualityToysHandler.Sync(); - - foreach (BaseModel based in toys) - { - AdminToy toy = based.AdminToy; - - if (toy is Primitive p) - p.Collidable = false; - toy.AdminToyBase.transform.position = based.LocalPosition + Position; - toy.AdminToyBase.transform.rotation = based.LocalRotation * Rotation; - } - if(spawn) - { - Spawn(); - } - } - - - public void Destroy() - { - foreach (BaseModel primitive in _models) - { - primitive.AdminToy.Destroy(); - } - } - public void UnSpawn() - { - foreach (BaseModel primitive in _models) - { - primitive.AdminToy.UnSpawn(); - } - } - public void Spawn() - { - QualityHandler.Instance.QualityToysHandler.Sync(); - foreach (BaseModel primitive in _models) - { - primitive.AdminToy.Spawn(); - } - - } - - - public bool Equals(Model x) - { - if (x == null) return false; - return x._prefab == _prefab && x.Position == Position && x.Rotation == Rotation; - } - public int GetHashCode(Model obj) - { - return obj.GetHashCode(); - } - } -} diff --git a/KruacentExiled/utils-merged/KE.Utilsci/Quality/Models/ModelPrefab.cs b/KruacentExiled/utils-merged/KE.Utilsci/Quality/Models/ModelPrefab.cs deleted file mode 100644 index bbc39da4..00000000 --- a/KruacentExiled/utils-merged/KE.Utilsci/Quality/Models/ModelPrefab.cs +++ /dev/null @@ -1,42 +0,0 @@ -using Exiled.API.Features; -using Exiled.API.Features.Core; -using Exiled.API.Features.Pickups; -using Exiled.API.Features.Toys; -using Exiled.API.Interfaces; -using KE.Utils.Extensions; -using KE.Utils.Quality.Models.Base; -using KE.Utils.Quality.Structs; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using UnityEngine; -using Light = Exiled.API.Features.Toys.Light; - -namespace KE.Utils.Quality.Models -{ - public abstract class ModelPrefab - { - - protected abstract IEnumerable GetBaseModels(); - - public virtual Model Create(Vector3 position,Quaternion rotation, bool spawn = true) - { - - HashSet clonetoys = new(); - HashSet toys = GetBaseModels().ToHashSet(); - foreach (BaseModel model in toys) - { - BaseModel clone = (BaseModel)model.Clone(); - clonetoys.Add(clone); - } - return new Model(this, position, rotation, clonetoys,spawn); - - } - - - - - } -} diff --git a/KruacentExiled/utils-merged/KE.Utilsci/Quality/Models/QualityModel.cs b/KruacentExiled/utils-merged/KE.Utilsci/Quality/Models/QualityModel.cs deleted file mode 100644 index b5cc682f..00000000 --- a/KruacentExiled/utils-merged/KE.Utilsci/Quality/Models/QualityModel.cs +++ /dev/null @@ -1,40 +0,0 @@ -using Exiled.API.Features; -using Exiled.API.Features.Toys; -using KE.Utils.Extensions; -using KE.Utils.Quality.Enums; -using KE.Utils.Quality.Models.Base; -using System.Collections.Generic; -using System.Linq; -using UnityEngine; - -namespace KE.Utils.Quality.Models -{ - public abstract class QualityModel : ModelPrefab - { - public abstract ModelQuality Quality { get; } - public abstract bool IsPickup { get; } - - - - - public override sealed Model Create(Vector3 position, Quaternion rotation,bool spawn = true) - { - - HashSet clonetoys = new(); - HashSet toys = GetBaseModels().ToHashSet(); - foreach (BaseModel model in toys) - { - BaseModel clone = (BaseModel)model.Clone(); - - if (IsPickup) - clone.AdminToy.SetAsPickupAdminToy(false); - - clone.AdminToy.SetQuality(Quality,false); - clonetoys.Add(clone); - } - QualityHandler.Sync(); - return new Model(this,position, rotation, clonetoys, spawn); - } - - } -} diff --git a/KruacentExiled/utils-merged/KE.Utilsci/Quality/QualityHandler.cs b/KruacentExiled/utils-merged/KE.Utilsci/Quality/QualityHandler.cs deleted file mode 100644 index 235d79c9..00000000 --- a/KruacentExiled/utils-merged/KE.Utilsci/Quality/QualityHandler.cs +++ /dev/null @@ -1,61 +0,0 @@ -using Exiled.API.Features; -using Exiled.API.Features.Core.UserSettings; -using KE.Utils.Quality.Handlers; -using KE.Utils.Quality.Settings; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace KE.Utils.Quality -{ - [Obsolete("scrapped", false)] - internal class QualityHandler - { - public QualitySettings QualitySettings { get; private set; } - public QualityToysHandler QualityToysHandler { get; private set; } - - private static QualityHandler _instance; - public static QualityHandler Instance - { - get - { - if(_instance == null ) - _instance = new QualityHandler(); - return _instance; - } - } - private QualityHandler() - { - QualitySettings = new QualitySettings(Changed); - QualityToysHandler = new QualityToysHandler(); - } - - ~QualityHandler() - { - QualityToysHandler = null; - QualitySettings = null; - } - - public void Changed(Player p, SettingBase _) - { - QualityToysHandler.Sync(p); - } - - public void Register() - { - QualitySettings.Register(); - } - - public void Unregister() - { - QualitySettings.Unregister(); - } - - public static void Sync() - { - Instance.QualityToysHandler.Sync(); - } - } -} diff --git a/KruacentExiled/utils-merged/KE.Utilsci/Quality/QualityToysHandler.cs b/KruacentExiled/utils-merged/KE.Utilsci/Quality/QualityToysHandler.cs deleted file mode 100644 index 27320233..00000000 --- a/KruacentExiled/utils-merged/KE.Utilsci/Quality/QualityToysHandler.cs +++ /dev/null @@ -1,155 +0,0 @@ -using AdminToys; -using Exiled.API.Enums; -using Exiled.API.Extensions; -using Exiled.API.Features; -using Exiled.API.Features.Toys; -using KE.Utils.Quality.Enums; -using KE.Utils.Quality.Settings; -using System.Collections.Generic; -using System.Linq; -using UnityEngine; -using Light = Exiled.API.Features.Toys.Light; -using QualitySettings = KE.Utils.Quality.Settings.QualitySettings; - -namespace KE.Utils.Quality -{ - public class QualityToysHandler - { - private HashSet _pickupToys = new(); - private Dictionary _qualityToys = new(); - public readonly Vector3 Gulag = new Vector3(15000,15000,15000); - - public bool IsPickupToy(AdminToy primitive) - { - return _pickupToys.Contains(primitive); - } - - public bool IsQualityToy(AdminToy primitive) - { - return _qualityToys.ContainsKey(primitive); - } - - - public void SetAsPickup(AdminToy toy) - { - if (!_pickupToys.Add(toy)) - { - Log.Warn($"AdminToy {toy} is already a pickupToy"); - return; - } - } - - public void SetQuality(AdminToy toy,ModelQuality quality) - { - if (toy == null) return; - if (!_qualityToys.ContainsKey(toy)) - _qualityToys.Add(toy,quality); - else - _qualityToys[toy] = quality; - } - - - - private void SendToShadowRealm(AdminToy adminToy, Player player) - { - if(adminToy is Light l) - { - player.SendFakeSyncVar(l.Base.netIdentity, typeof(LightSourceToy), nameof(LightSourceToy.NetworkPosition), Gulag); - return; - } - if(adminToy is Primitive p) - { - player.SendFakeSyncVar(p.Base.netIdentity, typeof(PrimitiveObjectToy), nameof(PrimitiveObjectToy.NetworkPosition), Gulag); - return; - } - } - - private void SetTruePosition(AdminToy adminToy, Player player) - { - if (adminToy is Light l) - { - player.SendFakeSyncVar(l.Base.netIdentity, typeof(LightSourceToy), nameof(LightSourceToy.NetworkPosition), l.Position); - return; - } - if (adminToy is Primitive p) - { - player.SendFakeSyncVar(p.Base.netIdentity, typeof(PrimitiveObjectToy), nameof(PrimitiveObjectToy.NetworkPosition), p.Position); - return; - } - } - - /// - /// Sync every Players - /// - public void Sync() - { - foreach(Player p in Player.List) - { - Sync(p); - } - } - - /// - /// Sync a specified Player - /// - /// - public void Sync(Player p) - { - var quality = QualitySettings.Get(p); - var pickup = QualitySettings.PickmodelActivated(p); - - if (!pickup) - { - //hide pickup toys - foreach (AdminToy pk in _pickupToys) - { - SendToShadowRealm(pk, p); - } - } - else - { - //show pickup toys - foreach (AdminToy pk in _pickupToys) - { - SetTruePosition(pk, p); - } - } - - - - - foreach(var at in _qualityToys) - { - if(at.Value == quality) - { - if (pickup || !_pickupToys.Contains(at.Key)) - { - SetTruePosition(at.Key, p); - } - } - else - { - SendToShadowRealm(at.Key, p); - } - - } - - } - - /// - /// Sync a specified AdminToy - /// - /// - public void Sync(AdminToy adminToy) - { - if (IsPickupToy(adminToy)) - { - - } - if (IsQualityToy(adminToy)) - { - - } - } - } -} diff --git a/KruacentExiled/utils-merged/KE.Utilsci/Quality/Settings/QualitySettings.cs b/KruacentExiled/utils-merged/KE.Utilsci/Quality/Settings/QualitySettings.cs deleted file mode 100644 index ca8d49be..00000000 --- a/KruacentExiled/utils-merged/KE.Utilsci/Quality/Settings/QualitySettings.cs +++ /dev/null @@ -1,62 +0,0 @@ -using Exiled.API.Features; -using Exiled.API.Features.Core.UserSettings; -using KE.Utils.Quality.Enums; -using System; - -namespace KE.Utils.Quality.Settings -{ - public class QualitySettings - { - - private static int _idQuality = 0; - private static int _idModels = 1; - private static int _idSlider = 2; - private SettingBase[] _settings; - public QualitySettings(Action onChanged) - { - HeaderSetting header = new("Quality Settings"); - _settings = - [ - header, - new DropdownSetting(_idQuality,"ModelQuality",["Low","Medium", "High"],onChanged:onChanged), - new TwoButtonsSetting(_idModels,"Pickup models","Disabled","Enabled", onChanged:onChanged) - ]; - } - - public void Register() - { - SettingBase.Register(_settings); - SettingBase.SendToAll(); - } - - public void Unregister() - { - SettingBase.Unregister(settings:_settings); - } - - - - - public static ModelQuality Get(Player p) - { - if (!SettingBase.TryGetSetting(p, _idQuality, out var setting)) return ModelQuality.None; - - return setting.SelectedOption switch - { - "Low" => ModelQuality.Low, - "Medium" => ModelQuality.Medium, - "High" => ModelQuality.High, - _ => ModelQuality.None, - }; - } - - - public static bool PickmodelActivated(Player p) - { - if (!SettingBase.TryGetSetting(p, _idModels, out var setting)) return false; - return setting.IsSecond; - } - - - } -} diff --git a/KruacentExiled/utils-merged/KE.Utilsci/Quality/Structs/LocalWorldSpace.cs b/KruacentExiled/utils-merged/KE.Utilsci/Quality/Structs/LocalWorldSpace.cs deleted file mode 100644 index d9c6205b..00000000 --- a/KruacentExiled/utils-merged/KE.Utilsci/Quality/Structs/LocalWorldSpace.cs +++ /dev/null @@ -1,23 +0,0 @@ -using Exiled.API.Interfaces; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using UnityEngine; - -namespace KE.Utils.Quality.Structs -{ - public readonly struct LocalWorldSpace : IWorldSpace - { - - public Vector3 Position { get; } - public Quaternion Rotation { get; } - - public LocalWorldSpace(Vector3 position, Quaternion rotation) - { - Position = position; - Rotation = rotation; - } - } -} diff --git a/KruacentExiled/utils-merged/KE.Utilsci/Quality/Tests/Test.cs b/KruacentExiled/utils-merged/KE.Utilsci/Quality/Tests/Test.cs deleted file mode 100644 index 6ebd3f66..00000000 --- a/KruacentExiled/utils-merged/KE.Utilsci/Quality/Tests/Test.cs +++ /dev/null @@ -1,108 +0,0 @@ -using Exiled.API.Extensions; -using Exiled.API.Features; -using Exiled.API.Features.Toys; -using KE.Utils.Quality.Models; -using KE.Utils.Quality.Models.Examples; -using MEC; -using PlayerRoles; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using UnityEngine; - -namespace KE.Utils.Quality.Tests -{ - public class Test - { - private QualityHandler QualityHandler; - - - private Test(QualityHandler q) - { - QualityHandler = q; - try - { - TestMine(); - } - catch (Exception ex) - { - Log.Error("Exception for TestMine :\n"+ex); - } - - } - internal void TestQuality() - { - Vector3 pos = RoleTypeId.Scp049.GetRandomSpawnLocation().Position; - Primitive c = Primitive.Create(pos); - c.Color = Color.red; - Primitive c2 = Primitive.Create(pos + Vector3.one); - c2.Color = Color.green; - - - QualityHandler.QualityToysHandler.SetQuality(c, Enums.ModelQuality.Low); - QualityHandler.QualityToysHandler.SetQuality(c2, Enums.ModelQuality.Medium); - } - - internal void StressTest(int count) - { - Timing.RunCoroutine(Stress(count)); - } - - - private IEnumerator Stress(int count) - { - Vector3 pos = RoleTypeId.Scp049.GetRandomSpawnLocation().Position; - Vector3 scale = new Vector3(.1f, .1f, .1f); - float maxSpread = 5; - for (int i = 0; i < count; i++) - { - Primitive c = Primitive.Create(pos + new Vector3(UnityEngine.Random.Range(0f, maxSpread), UnityEngine.Random.Range(0f, maxSpread), UnityEngine.Random.Range(0f, maxSpread)), scale: scale); - QualityHandler.QualityToysHandler.SetQuality(c, Enums.ModelQuality.Medium); - } - QualityHandler.QualityToysHandler.Sync(); - yield return 0; - } - - public void TestMine() - { - Log.Info("TestMine"); - Vector3 pos = RoleTypeId.Scp049.GetRandomSpawnLocation().Position; - MineModelLow mml = new(); - - - Model m = mml.Create(pos, new Quaternion()); - m.Spawn(); - - - MineModelMedium mmm = new(); - - m = mmm.Create(pos + Vector3.up, new Quaternion()); - m.Spawn(); - - - MineModelPickup mmp = new(); - m = mmp.Create(pos + Vector3.right, new Quaternion()); - m.Spawn(); - - QualityHandler.Sync(); - - - - - - - - - foreach (var item in Player.List) - { - item.Teleport(pos); - } - - - - - } - } -} diff --git a/KruacentExiled/utils-merged/KE.Utilscr/API/Displays/DisplayMeow/DisplayHandler.cs b/KruacentExiled/utils-merged/KE.Utilscr/API/Displays/DisplayMeow/DisplayHandler.cs deleted file mode 100644 index 1322a6c5..00000000 --- a/KruacentExiled/utils-merged/KE.Utilscr/API/Displays/DisplayMeow/DisplayHandler.cs +++ /dev/null @@ -1,66 +0,0 @@ -using Exiled.API.Features; -using HintServiceMeow.Core.Extension; -using HintServiceMeow.Core.Models.Hints; -using HintServiceMeow.Core.Utilities; -using MEC; - - -//damn why the same name -using MHint = HintServiceMeow.Core.Models.Hints.Hint; - -namespace KE.Utils.API.Displays.DisplayMeow -{ - public class DisplayHandler - { - public static DisplayHandler Instance { get; } = new(); - - private DisplayHandler() { } - - - - - - public MHint AddHint(HintPlacement hintPlacement, Player player, string text, float delay) - { - var dis = PlayerDisplay.Get(player); - string id = $"{player.Id}_{hintPlacement.XCoordinate}_{hintPlacement.YCoordinate}"; - MHint hint; - - if (!dis.TryGetHint(id, out var aHint)) - { - hint = new() - { - Text = text, - XCoordinate = hintPlacement.XCoordinate, - YCoordinate = hintPlacement.YCoordinate, - Alignment = hintPlacement.HintAlignment, - Id = id - - }; - dis.AddHint(hint); - - } - else - { - - hint = (MHint)aHint; - hint.Hide = false; - hint.Text = text; - } - - - hint.HideAfter(delay); - return hint; - } - - - - - - - - - - - } -} diff --git a/KruacentExiled/utils-merged/KE.Utilscr/API/Displays/DisplayMeow/HintPlacement.cs b/KruacentExiled/utils-merged/KE.Utilscr/API/Displays/DisplayMeow/HintPlacement.cs deleted file mode 100644 index 936cdbe9..00000000 --- a/KruacentExiled/utils-merged/KE.Utilscr/API/Displays/DisplayMeow/HintPlacement.cs +++ /dev/null @@ -1,31 +0,0 @@ -using HintServiceMeow.Core.Enum; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace KE.Utils.API.Displays.DisplayMeow -{ - public readonly struct HintPlacement : IEquatable - { - public float YCoordinate { get; } - public float XCoordinate { get; } - public HintAlignment HintAlignment { get; } = HintAlignment.Center; - - - public bool Equals(HintPlacement obj) - { - return YCoordinate == obj.YCoordinate && XCoordinate == obj.XCoordinate; - } - - - public HintPlacement(float xCoordinate, float yCoordinate, HintAlignment alignment = HintAlignment.Center) - { - YCoordinate = yCoordinate; - XCoordinate = xCoordinate; - HintAlignment = alignment; - } - - } -} diff --git a/KruacentExiled/utils-merged/KE.Utilscr/API/Interfaces/IEvents.cs b/KruacentExiled/utils-merged/KE.Utilscr/API/Interfaces/IEvents.cs deleted file mode 100644 index e573b062..00000000 --- a/KruacentExiled/utils-merged/KE.Utilscr/API/Interfaces/IEvents.cs +++ /dev/null @@ -1,17 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace KE.Utils.API.Interfaces -{ - public interface IUsingEvents - { - - - public void SubscribeEvents(); - - public void UnsubscribeEvents(); - } -} diff --git a/KruacentExiled/utils-merged/KE.Utilscr/API/OtherUtils.cs b/KruacentExiled/utils-merged/KE.Utilscr/API/OtherUtils.cs deleted file mode 100644 index 2995a624..00000000 --- a/KruacentExiled/utils-merged/KE.Utilscr/API/OtherUtils.cs +++ /dev/null @@ -1,18 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using UnityEngine; - -namespace KE.Utils.API -{ - public static class OtherUtils - { - - public static bool IsInCircle(Vector3 pos,Vector3 centerCircle,float radius) - { - return Math.Pow(pos.x - centerCircle.x, 2) + Math.Pow(pos.y - centerCircle.y, 2) <= Math.Pow(radius, 2); - } - } -} diff --git a/KruacentExiled/utils-merged/KE.Utilscr/Extensions/AdminToyExtension.cs b/KruacentExiled/utils-merged/KE.Utilscr/Extensions/AdminToyExtension.cs deleted file mode 100644 index 37c3706d..00000000 --- a/KruacentExiled/utils-merged/KE.Utilscr/Extensions/AdminToyExtension.cs +++ /dev/null @@ -1,25 +0,0 @@ -using Exiled.API.Features.Toys; -using KE.Utils.Quality; -using KE.Utils.Quality.Enums; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace KE.Utils.Extensions -{ - public static class AdminToyExtension - { - - public static void SetAsPickupAdminToy(this AdminToy toy, bool autoSync = true) - { - QualityHandler.Instance.QualityToysHandler.SetAsPickup(toy); - } - - public static void SetQuality(this AdminToy toy, ModelQuality modelQuality,bool autoSync = true) - { - QualityHandler.Instance.QualityToysHandler.SetQuality(toy, modelQuality); - } - } -} diff --git a/KruacentExiled/utils-merged/KE.Utilscr/Extensions/PlayerExtension.cs b/KruacentExiled/utils-merged/KE.Utilscr/Extensions/PlayerExtension.cs deleted file mode 100644 index b01f98d2..00000000 --- a/KruacentExiled/utils-merged/KE.Utilscr/Extensions/PlayerExtension.cs +++ /dev/null @@ -1,52 +0,0 @@ -using CustomPlayerEffects; -using Exiled.API.Enums; -using Exiled.API.Features; -using Mirror; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using UnityEngine; - -namespace KE.Utils.Extensions -{ - public static class PlayerExtension - { - public static void SetFakeInvis(this Player p, IEnumerable viewers) - { - Vector3 pos = p.Position; - - try - { - p.ReferenceHub.transform.localPosition = Vector3.zero; - foreach (Player viewer in viewers) - { - Server.SendSpawnMessage.Invoke(null, new object[2] { viewer.NetworkIdentity, viewer.Connection }); - } - - p.ReferenceHub.transform.localPosition = pos; - } - catch (Exception arg) - { - Log.Error(string.Format("{0}: {1}", "SetFakeInvis", arg)); - } - } - - - - - public static void AddLevelEffect(this Player p,EffectType type, int intensity) - { - - - if (!p.TryGetEffect(type, out var effect)) - p.ChangeEffectIntensity(type, (byte)(effect.Intensity + intensity)); - else - p.EnableEffect(type, (byte)intensity); - } - - - - } -} diff --git a/KruacentExiled/utils-merged/KE.Utilscr/Extensions/RoomExtension.cs b/KruacentExiled/utils-merged/KE.Utilscr/Extensions/RoomExtension.cs deleted file mode 100644 index 35fee2e8..00000000 --- a/KruacentExiled/utils-merged/KE.Utilscr/Extensions/RoomExtension.cs +++ /dev/null @@ -1,12 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace KE.Utils.Extensions -{ - internal class RoomExtension - { - } -} diff --git a/KruacentExiled/utils-merged/KE.Utilscr/KE.Utils.csproj b/KruacentExiled/utils-merged/KE.Utilscr/KE.Utils.csproj deleted file mode 100644 index 1587c6e8..00000000 --- a/KruacentExiled/utils-merged/KE.Utilscr/KE.Utils.csproj +++ /dev/null @@ -1,30 +0,0 @@ - - - - 13.0 - net48 - - - - - - - - - - - - - - - - - - if not "$(EXILED_DEV_REFERENCES)"=="" copy /y "$(OutputPath)$(AssemblyName).dll" "$(EXILED_DEV_REFERENCES)\Plugins\" - - - if [[ ! -z "$EXILED_DEV_REFERENCES" ]]; then cp "$(OutputPath)$(AssemblyName).dll" "$EXILED_DEV_REFERENCES/Plugins/"; fi - - - - diff --git a/KruacentExiled/utils-merged/KE.Utilscr/Quality/Enums/ModelQuality.cs b/KruacentExiled/utils-merged/KE.Utilscr/Quality/Enums/ModelQuality.cs deleted file mode 100644 index d9d8d295..00000000 --- a/KruacentExiled/utils-merged/KE.Utilscr/Quality/Enums/ModelQuality.cs +++ /dev/null @@ -1,16 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace KE.Utils.Quality.Enums -{ - public enum ModelQuality - { - None = -1, - Low, - Medium, - High, - } -} diff --git a/KruacentExiled/utils-merged/KE.Utilscr/Quality/Handlers/QualityToysHandler.cs b/KruacentExiled/utils-merged/KE.Utilscr/Quality/Handlers/QualityToysHandler.cs deleted file mode 100644 index b2485795..00000000 --- a/KruacentExiled/utils-merged/KE.Utilscr/Quality/Handlers/QualityToysHandler.cs +++ /dev/null @@ -1,179 +0,0 @@ -using AdminToys; -using Exiled.API.Enums; -using Exiled.API.Extensions; -using Exiled.API.Features; -using Exiled.API.Features.Toys; -using KE.Utils.Quality.Enums; -using KE.Utils.Quality.Settings; -using MEC; -using System; -using System.Collections.Generic; -using System.Linq; -using UnityEngine; -using Light = Exiled.API.Features.Toys.Light; -using QualitySettings = KE.Utils.Quality.Settings.QualitySettings; - -namespace KE.Utils.Quality.Handlers -{ - public class QualityToysHandler - { - private HashSet _pickupToys = new(); - private Dictionary _qualityToys = new(); - public readonly Vector3 Gulag = new Vector3(15000, 15000, 15000); - public const float Delay = Timing.WaitForOneFrame; - public bool IsPickupToy(AdminToy primitive) - { - return _pickupToys.Contains(primitive); - } - - public bool IsQualityToy(AdminToy primitive) - { - return _qualityToys.ContainsKey(primitive); - } - - - public void SetAsPickup(AdminToy toy, bool autoSync = true) - { - if (!_pickupToys.Add(toy)) - { - Log.Warn($"AdminToy {toy} is already a pickupToy"); - return; - } - if (autoSync) - Sync(toy); - } - - public void SetQuality(AdminToy toy, ModelQuality quality, bool autoSync = true) - { - if (toy == null) return; - if (!_qualityToys.ContainsKey(toy)) - _qualityToys.Add(toy, quality); - else - _qualityToys[toy] = quality; - - if (autoSync) - Sync(toy); - } - - - - private void SendToFakePosition(AdminToy adminToy, Player player,Vector3 position) - { - //idk why but without delay it show all of the quality at once - Timing.CallDelayed(Delay, () => - { - if (adminToy is Light l) - { - player.SendFakeSyncVar(l.Base.netIdentity, typeof(LightSourceToy), nameof(LightSourceToy.NetworkPosition), position); - return; - } - if (adminToy is Primitive p) - { - player.SendFakeSyncVar(p.Base.netIdentity, typeof(PrimitiveObjectToy), nameof(PrimitiveObjectToy.NetworkPosition), position); - return; - } - }); - - } - - /// - /// Sync every Players - /// - public void Sync() - { - foreach (Player p in Player.List) - { - Sync(p); - } - } - - /// - /// Sync a specified Player - /// - /// - public void Sync(Player p) - { - - - - var quality = QualitySettings.Get(p); - var pickup = QualitySettings.PickmodelActivated(p); - - HashSet pickupToRemove = []; - HashSet qualityToRemove = []; - - //hide pickup toys - - foreach (AdminToy pk in _pickupToys) - { - try - { - if (pickup) - { - SendToFakePosition(pk, p, pk.Position); - } - else - { - SendToFakePosition(pk, p, Gulag); - } - } - catch (NullReferenceException) - { - //Log.Warn("removing pickup"); - pickupToRemove.Add(pk); - } - - } - - _pickupToys.RemoveWhere(p => pickupToRemove.Contains(p)); - - - foreach (var at in _qualityToys) - { - try - { - if ((at.Value == quality || at.Value == ModelQuality.None) && (pickup || !_pickupToys.Contains(at.Key))) - { - SendToFakePosition(at.Key, p, at.Key.Position); - } - else - { - SendToFakePosition(at.Key, p, Gulag); - } - } - catch (NullReferenceException) - { - //Log.Warn("removing quality" + _qualityToys.Count); - qualityToRemove.Add(at.Key); - } - - - } - foreach(var at in qualityToRemove) - { - - _qualityToys.Remove(at); - } - - } - - /// - /// Sync a specified AdminToy - /// - /// - public void Sync(AdminToy adminToy) - { - //temporary fix - Sync(); - - if (IsPickupToy(adminToy)) - { - - } - if (IsQualityToy(adminToy)) - { - - } - } - } -} diff --git a/KruacentExiled/utils-merged/KE.Utilscr/Quality/Models/Base/BaseModel.cs b/KruacentExiled/utils-merged/KE.Utilscr/Quality/Models/Base/BaseModel.cs deleted file mode 100644 index c9f6723c..00000000 --- a/KruacentExiled/utils-merged/KE.Utilscr/Quality/Models/Base/BaseModel.cs +++ /dev/null @@ -1,41 +0,0 @@ -using Exiled.API.Enums; -using Exiled.API.Extensions; -using Exiled.API.Features.Toys; -using Exiled.API.Interfaces; -using KE.Utils.Quality.Structs; -using PlayerStatsSystem; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using UnityEngine; -using Light = Exiled.API.Features.Toys.Light; - -namespace KE.Utils.Quality.Models.Base -{ - - /// - /// The blocks to build a model with - /// - public abstract class BaseModel : ICloneable - { - - protected AdminToy _toy; - public AdminToy AdminToy { get { return _toy; } } - private Vector3 _position; - public Vector3 LocalPosition { get { return _position; } } - private Quaternion _rotation; - public Quaternion LocalRotation { get { return _rotation; } } - - - public BaseModel(Vector3 localPositon, Quaternion localRotation) - { - _position = localPositon; - _rotation = localRotation; - } - - public abstract object Clone(); - } - -} diff --git a/KruacentExiled/utils-merged/KE.Utilscr/Quality/Models/Base/LightModel.cs b/KruacentExiled/utils-merged/KE.Utilscr/Quality/Models/Base/LightModel.cs deleted file mode 100644 index ce808da1..00000000 --- a/KruacentExiled/utils-merged/KE.Utilscr/Quality/Models/Base/LightModel.cs +++ /dev/null @@ -1,26 +0,0 @@ -using Exiled.API.Features.Toys; -using UnityEngine; -using Light = Exiled.API.Features.Toys.Light; - -namespace KE.Utils.Quality.Models.Base -{ - public class LightModel : BaseModel - { - - /// - /// Create a new Light for modeling - /// - public LightModel(Vector3? scale, Color? color, Vector3 localPositon, Quaternion localRotation) : base(localPositon, localRotation) - { - Light light = Light.Create(null, null, scale, false, color); - _toy = light; - } - - - public override object Clone() - { - Light light = _toy as Light; - return new LightModel(light.Scale, light.Color, LocalPosition, LocalRotation); - } - } -} diff --git a/KruacentExiled/utils-merged/KE.Utilscr/Quality/Models/Base/PrimitiveModel.cs b/KruacentExiled/utils-merged/KE.Utilscr/Quality/Models/Base/PrimitiveModel.cs deleted file mode 100644 index 22e07225..00000000 --- a/KruacentExiled/utils-merged/KE.Utilscr/Quality/Models/Base/PrimitiveModel.cs +++ /dev/null @@ -1,26 +0,0 @@ -using Exiled.API.Features.Toys; -using UnityEngine; -using Color = UnityEngine.Color; - -namespace KE.Utils.Quality.Models.Base -{ - public class PrimitiveModel : BaseModel - { - /// - /// Create a new Primitive for modeling - /// - public PrimitiveModel(PrimitiveType type, Vector3? scale, Color? color,Vector3 localPosition,Quaternion localRotation) : base(localPosition, localRotation) - { - - Primitive prim = Primitive.Create(type, null, null, scale, false, color); - prim.Collidable = false; - _toy = prim; - } - - public override object Clone() - { - Primitive prim = _toy as Primitive; - return new PrimitiveModel(prim.Type, prim.Scale, prim.Color, LocalPosition, LocalRotation); - } - } -} diff --git a/KruacentExiled/utils-merged/KE.Utilscr/Quality/Models/Examples/MineModel.cs b/KruacentExiled/utils-merged/KE.Utilscr/Quality/Models/Examples/MineModel.cs deleted file mode 100644 index 00d60fec..00000000 --- a/KruacentExiled/utils-merged/KE.Utilscr/Quality/Models/Examples/MineModel.cs +++ /dev/null @@ -1,118 +0,0 @@ -using KE.Utils.Quality.Enums; -using KE.Utils.Quality.Models.Base; -using System.Collections.Generic; -using UnityEngine; -using Light = Exiled.API.Features.Toys.Light; - -namespace KE.Utils.Quality.Models.Examples -{ - public abstract class MineModel : QualityModel - { - protected Light _light; - private bool _lightOn = false; - - - - - public void ToggleLight() - { - if (_light == null) throw new System.Exception("no light"); - if (_lightOn) - _light.UnSpawn(); - else - _light.Spawn(); - _lightOn = !_lightOn; - } - - } - - public class MineModelLow : MineModel - { - public override bool IsPickup => false; - public override ModelQuality Quality => ModelQuality.Low; - - protected override IEnumerable GetBaseModels() - { - Quaternion baseRotation = new(); - //spawn + offset - Vector3 offset = new Vector3(0, .05f); - Vector3 sizeDisk = new Vector3(.7f, 0.1f, .7f); - - Vector3 sizeGlobe = new Vector3(.1f, .1f, .1f); - Vector3 posLight = new Vector3(0, sizeDisk.y+sizeGlobe.y); - - - var baseMine = new PrimitiveModel(PrimitiveType.Cylinder, sizeDisk, Color.black, offset, baseRotation); - - var lightGlobe = new PrimitiveModel(PrimitiveType.Sphere, sizeGlobe , new Color(1, 0, 0, .33f), posLight, baseRotation); - - var lightMine = new LightModel(null, Color.red, posLight, baseRotation); - - _light = lightMine.AdminToy as Light; - _light.Intensity = .55f; - - return [baseMine, lightGlobe, lightMine]; - } - - - } - - public class MineModelMedium : MineModel - { - public override bool IsPickup => false; - public override ModelQuality Quality => ModelQuality.Medium; - - protected override IEnumerable GetBaseModels() - { - Quaternion baseRotation = new(); - //spawn + offset - Vector3 offset = new Vector3(0, .05f); - Vector3 sizeDisk = new Vector3(.7f, 0.1f, .7f); - - Vector3 sizeGlobe = new Vector3(.1f, .1f, .1f); - Vector3 posLight = new Vector3(0, sizeDisk.y + sizeGlobe.y); - - - var baseMine = new PrimitiveModel(PrimitiveType.Cylinder, sizeDisk, Color.black, offset, baseRotation); - - var lightGlobe = new PrimitiveModel(PrimitiveType.Sphere, sizeGlobe, new Color(1, 0, 0, .33f), posLight, baseRotation); - - var lightMine = new LightModel(null, Color.green, posLight, baseRotation); - - _light = lightMine.AdminToy as Light; - _light.Intensity = .55f; - - return [baseMine, lightGlobe, lightMine]; - } - } - - public class MineModelPickup : MineModel - { - public override bool IsPickup => true; - public override ModelQuality Quality => ModelQuality.None; - - - protected override IEnumerable GetBaseModels() - { - Quaternion baseRotation = new(); - //spawn + offset - Vector3 offset = new Vector3(0, .05f); - Vector3 sizeDisk = new Vector3(.7f, 0.1f, .7f); - - Vector3 sizeGlobe = new Vector3(.1f, .1f, .1f); - Vector3 posLight = new Vector3(0, sizeDisk.y + sizeGlobe.y); - - - var baseMine = new PrimitiveModel(PrimitiveType.Cylinder, sizeDisk, Color.black, offset, baseRotation); - - var lightGlobe = new PrimitiveModel(PrimitiveType.Sphere, sizeGlobe, new Color(1, 0, 0, .33f), posLight, baseRotation); - - var lightMine = new LightModel(null, Color.magenta, posLight, baseRotation); - - _light = lightMine.AdminToy as Light; - _light.Intensity = .55f; - - return [baseMine, lightGlobe, lightMine]; - } - } -} diff --git a/KruacentExiled/utils-merged/KE.Utilscr/Quality/Models/Model.cs b/KruacentExiled/utils-merged/KE.Utilscr/Quality/Models/Model.cs deleted file mode 100644 index 2e26756e..00000000 --- a/KruacentExiled/utils-merged/KE.Utilscr/Quality/Models/Model.cs +++ /dev/null @@ -1,104 +0,0 @@ -using Exiled.API.Features; -using Exiled.API.Features.Toys; -using KE.Utils.Quality.Models.Base; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using UnityEngine; - -namespace KE.Utils.Quality.Models -{ - public class Model : IEquatable - { - - - private Vector3 _position; - public Vector3 Position - { - get { return _position; } - set - { - _position = value; - } - } - private Quaternion _rotation; - public Quaternion Rotation - { - get { return _rotation; } - set - { - _rotation = value; - } - } - private ModelPrefab _prefab; - public ModelPrefab Prefab - { - get { return _prefab; } - } - - - - private HashSet _models; - - internal Model(ModelPrefab prefab, Vector3 position, Quaternion rotation,IEnumerable toys,bool spawn) - { - _prefab = prefab; - Position = position; - Rotation = rotation; - _models = new HashSet(toys); - QualityHandler.Instance.QualityToysHandler.Sync(); - - foreach (BaseModel based in toys) - { - AdminToy toy = based.AdminToy; - - if (toy is Primitive p) - p.Collidable = false; - toy.AdminToyBase.transform.position = based.LocalPosition + Position; - toy.AdminToyBase.transform.rotation = based.LocalRotation * Rotation; - } - if(spawn) - { - Spawn(); - } - } - - - public void Destroy() - { - foreach (BaseModel primitive in _models) - { - primitive.AdminToy.Destroy(); - } - } - public void UnSpawn() - { - foreach (BaseModel primitive in _models) - { - primitive.AdminToy.UnSpawn(); - } - } - public void Spawn() - { - QualityHandler.Instance.QualityToysHandler.Sync(); - foreach (BaseModel primitive in _models) - { - primitive.AdminToy.Spawn(); - } - - } - - - public bool Equals(Model x) - { - if (x == null) return false; - return x._prefab == _prefab && x.Position == Position && x.Rotation == Rotation; - } - public int GetHashCode(Model obj) - { - return obj.GetHashCode(); - } - } -} diff --git a/KruacentExiled/utils-merged/KE.Utilscr/Quality/Models/ModelPrefab.cs b/KruacentExiled/utils-merged/KE.Utilscr/Quality/Models/ModelPrefab.cs deleted file mode 100644 index bbc39da4..00000000 --- a/KruacentExiled/utils-merged/KE.Utilscr/Quality/Models/ModelPrefab.cs +++ /dev/null @@ -1,42 +0,0 @@ -using Exiled.API.Features; -using Exiled.API.Features.Core; -using Exiled.API.Features.Pickups; -using Exiled.API.Features.Toys; -using Exiled.API.Interfaces; -using KE.Utils.Extensions; -using KE.Utils.Quality.Models.Base; -using KE.Utils.Quality.Structs; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using UnityEngine; -using Light = Exiled.API.Features.Toys.Light; - -namespace KE.Utils.Quality.Models -{ - public abstract class ModelPrefab - { - - protected abstract IEnumerable GetBaseModels(); - - public virtual Model Create(Vector3 position,Quaternion rotation, bool spawn = true) - { - - HashSet clonetoys = new(); - HashSet toys = GetBaseModels().ToHashSet(); - foreach (BaseModel model in toys) - { - BaseModel clone = (BaseModel)model.Clone(); - clonetoys.Add(clone); - } - return new Model(this, position, rotation, clonetoys,spawn); - - } - - - - - } -} diff --git a/KruacentExiled/utils-merged/KE.Utilscr/Quality/Models/QualityModel.cs b/KruacentExiled/utils-merged/KE.Utilscr/Quality/Models/QualityModel.cs deleted file mode 100644 index b5cc682f..00000000 --- a/KruacentExiled/utils-merged/KE.Utilscr/Quality/Models/QualityModel.cs +++ /dev/null @@ -1,40 +0,0 @@ -using Exiled.API.Features; -using Exiled.API.Features.Toys; -using KE.Utils.Extensions; -using KE.Utils.Quality.Enums; -using KE.Utils.Quality.Models.Base; -using System.Collections.Generic; -using System.Linq; -using UnityEngine; - -namespace KE.Utils.Quality.Models -{ - public abstract class QualityModel : ModelPrefab - { - public abstract ModelQuality Quality { get; } - public abstract bool IsPickup { get; } - - - - - public override sealed Model Create(Vector3 position, Quaternion rotation,bool spawn = true) - { - - HashSet clonetoys = new(); - HashSet toys = GetBaseModels().ToHashSet(); - foreach (BaseModel model in toys) - { - BaseModel clone = (BaseModel)model.Clone(); - - if (IsPickup) - clone.AdminToy.SetAsPickupAdminToy(false); - - clone.AdminToy.SetQuality(Quality,false); - clonetoys.Add(clone); - } - QualityHandler.Sync(); - return new Model(this,position, rotation, clonetoys, spawn); - } - - } -} diff --git a/KruacentExiled/utils-merged/KE.Utilscr/Quality/QualityHandler.cs b/KruacentExiled/utils-merged/KE.Utilscr/Quality/QualityHandler.cs deleted file mode 100644 index 235d79c9..00000000 --- a/KruacentExiled/utils-merged/KE.Utilscr/Quality/QualityHandler.cs +++ /dev/null @@ -1,61 +0,0 @@ -using Exiled.API.Features; -using Exiled.API.Features.Core.UserSettings; -using KE.Utils.Quality.Handlers; -using KE.Utils.Quality.Settings; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace KE.Utils.Quality -{ - [Obsolete("scrapped", false)] - internal class QualityHandler - { - public QualitySettings QualitySettings { get; private set; } - public QualityToysHandler QualityToysHandler { get; private set; } - - private static QualityHandler _instance; - public static QualityHandler Instance - { - get - { - if(_instance == null ) - _instance = new QualityHandler(); - return _instance; - } - } - private QualityHandler() - { - QualitySettings = new QualitySettings(Changed); - QualityToysHandler = new QualityToysHandler(); - } - - ~QualityHandler() - { - QualityToysHandler = null; - QualitySettings = null; - } - - public void Changed(Player p, SettingBase _) - { - QualityToysHandler.Sync(p); - } - - public void Register() - { - QualitySettings.Register(); - } - - public void Unregister() - { - QualitySettings.Unregister(); - } - - public static void Sync() - { - Instance.QualityToysHandler.Sync(); - } - } -} diff --git a/KruacentExiled/utils-merged/KE.Utilscr/Quality/QualityToysHandler.cs b/KruacentExiled/utils-merged/KE.Utilscr/Quality/QualityToysHandler.cs deleted file mode 100644 index 27320233..00000000 --- a/KruacentExiled/utils-merged/KE.Utilscr/Quality/QualityToysHandler.cs +++ /dev/null @@ -1,155 +0,0 @@ -using AdminToys; -using Exiled.API.Enums; -using Exiled.API.Extensions; -using Exiled.API.Features; -using Exiled.API.Features.Toys; -using KE.Utils.Quality.Enums; -using KE.Utils.Quality.Settings; -using System.Collections.Generic; -using System.Linq; -using UnityEngine; -using Light = Exiled.API.Features.Toys.Light; -using QualitySettings = KE.Utils.Quality.Settings.QualitySettings; - -namespace KE.Utils.Quality -{ - public class QualityToysHandler - { - private HashSet _pickupToys = new(); - private Dictionary _qualityToys = new(); - public readonly Vector3 Gulag = new Vector3(15000,15000,15000); - - public bool IsPickupToy(AdminToy primitive) - { - return _pickupToys.Contains(primitive); - } - - public bool IsQualityToy(AdminToy primitive) - { - return _qualityToys.ContainsKey(primitive); - } - - - public void SetAsPickup(AdminToy toy) - { - if (!_pickupToys.Add(toy)) - { - Log.Warn($"AdminToy {toy} is already a pickupToy"); - return; - } - } - - public void SetQuality(AdminToy toy,ModelQuality quality) - { - if (toy == null) return; - if (!_qualityToys.ContainsKey(toy)) - _qualityToys.Add(toy,quality); - else - _qualityToys[toy] = quality; - } - - - - private void SendToShadowRealm(AdminToy adminToy, Player player) - { - if(adminToy is Light l) - { - player.SendFakeSyncVar(l.Base.netIdentity, typeof(LightSourceToy), nameof(LightSourceToy.NetworkPosition), Gulag); - return; - } - if(adminToy is Primitive p) - { - player.SendFakeSyncVar(p.Base.netIdentity, typeof(PrimitiveObjectToy), nameof(PrimitiveObjectToy.NetworkPosition), Gulag); - return; - } - } - - private void SetTruePosition(AdminToy adminToy, Player player) - { - if (adminToy is Light l) - { - player.SendFakeSyncVar(l.Base.netIdentity, typeof(LightSourceToy), nameof(LightSourceToy.NetworkPosition), l.Position); - return; - } - if (adminToy is Primitive p) - { - player.SendFakeSyncVar(p.Base.netIdentity, typeof(PrimitiveObjectToy), nameof(PrimitiveObjectToy.NetworkPosition), p.Position); - return; - } - } - - /// - /// Sync every Players - /// - public void Sync() - { - foreach(Player p in Player.List) - { - Sync(p); - } - } - - /// - /// Sync a specified Player - /// - /// - public void Sync(Player p) - { - var quality = QualitySettings.Get(p); - var pickup = QualitySettings.PickmodelActivated(p); - - if (!pickup) - { - //hide pickup toys - foreach (AdminToy pk in _pickupToys) - { - SendToShadowRealm(pk, p); - } - } - else - { - //show pickup toys - foreach (AdminToy pk in _pickupToys) - { - SetTruePosition(pk, p); - } - } - - - - - foreach(var at in _qualityToys) - { - if(at.Value == quality) - { - if (pickup || !_pickupToys.Contains(at.Key)) - { - SetTruePosition(at.Key, p); - } - } - else - { - SendToShadowRealm(at.Key, p); - } - - } - - } - - /// - /// Sync a specified AdminToy - /// - /// - public void Sync(AdminToy adminToy) - { - if (IsPickupToy(adminToy)) - { - - } - if (IsQualityToy(adminToy)) - { - - } - } - } -} diff --git a/KruacentExiled/utils-merged/KE.Utilscr/Quality/Settings/QualitySettings.cs b/KruacentExiled/utils-merged/KE.Utilscr/Quality/Settings/QualitySettings.cs deleted file mode 100644 index ca8d49be..00000000 --- a/KruacentExiled/utils-merged/KE.Utilscr/Quality/Settings/QualitySettings.cs +++ /dev/null @@ -1,62 +0,0 @@ -using Exiled.API.Features; -using Exiled.API.Features.Core.UserSettings; -using KE.Utils.Quality.Enums; -using System; - -namespace KE.Utils.Quality.Settings -{ - public class QualitySettings - { - - private static int _idQuality = 0; - private static int _idModels = 1; - private static int _idSlider = 2; - private SettingBase[] _settings; - public QualitySettings(Action onChanged) - { - HeaderSetting header = new("Quality Settings"); - _settings = - [ - header, - new DropdownSetting(_idQuality,"ModelQuality",["Low","Medium", "High"],onChanged:onChanged), - new TwoButtonsSetting(_idModels,"Pickup models","Disabled","Enabled", onChanged:onChanged) - ]; - } - - public void Register() - { - SettingBase.Register(_settings); - SettingBase.SendToAll(); - } - - public void Unregister() - { - SettingBase.Unregister(settings:_settings); - } - - - - - public static ModelQuality Get(Player p) - { - if (!SettingBase.TryGetSetting(p, _idQuality, out var setting)) return ModelQuality.None; - - return setting.SelectedOption switch - { - "Low" => ModelQuality.Low, - "Medium" => ModelQuality.Medium, - "High" => ModelQuality.High, - _ => ModelQuality.None, - }; - } - - - public static bool PickmodelActivated(Player p) - { - if (!SettingBase.TryGetSetting(p, _idModels, out var setting)) return false; - return setting.IsSecond; - } - - - } -} diff --git a/KruacentExiled/utils-merged/KE.Utilscr/Quality/Structs/LocalWorldSpace.cs b/KruacentExiled/utils-merged/KE.Utilscr/Quality/Structs/LocalWorldSpace.cs deleted file mode 100644 index d9c6205b..00000000 --- a/KruacentExiled/utils-merged/KE.Utilscr/Quality/Structs/LocalWorldSpace.cs +++ /dev/null @@ -1,23 +0,0 @@ -using Exiled.API.Interfaces; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using UnityEngine; - -namespace KE.Utils.Quality.Structs -{ - public readonly struct LocalWorldSpace : IWorldSpace - { - - public Vector3 Position { get; } - public Quaternion Rotation { get; } - - public LocalWorldSpace(Vector3 position, Quaternion rotation) - { - Position = position; - Rotation = rotation; - } - } -} diff --git a/KruacentExiled/utils-merged/KE.Utilscr/Quality/Tests/Test.cs b/KruacentExiled/utils-merged/KE.Utilscr/Quality/Tests/Test.cs deleted file mode 100644 index 6ebd3f66..00000000 --- a/KruacentExiled/utils-merged/KE.Utilscr/Quality/Tests/Test.cs +++ /dev/null @@ -1,108 +0,0 @@ -using Exiled.API.Extensions; -using Exiled.API.Features; -using Exiled.API.Features.Toys; -using KE.Utils.Quality.Models; -using KE.Utils.Quality.Models.Examples; -using MEC; -using PlayerRoles; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using UnityEngine; - -namespace KE.Utils.Quality.Tests -{ - public class Test - { - private QualityHandler QualityHandler; - - - private Test(QualityHandler q) - { - QualityHandler = q; - try - { - TestMine(); - } - catch (Exception ex) - { - Log.Error("Exception for TestMine :\n"+ex); - } - - } - internal void TestQuality() - { - Vector3 pos = RoleTypeId.Scp049.GetRandomSpawnLocation().Position; - Primitive c = Primitive.Create(pos); - c.Color = Color.red; - Primitive c2 = Primitive.Create(pos + Vector3.one); - c2.Color = Color.green; - - - QualityHandler.QualityToysHandler.SetQuality(c, Enums.ModelQuality.Low); - QualityHandler.QualityToysHandler.SetQuality(c2, Enums.ModelQuality.Medium); - } - - internal void StressTest(int count) - { - Timing.RunCoroutine(Stress(count)); - } - - - private IEnumerator Stress(int count) - { - Vector3 pos = RoleTypeId.Scp049.GetRandomSpawnLocation().Position; - Vector3 scale = new Vector3(.1f, .1f, .1f); - float maxSpread = 5; - for (int i = 0; i < count; i++) - { - Primitive c = Primitive.Create(pos + new Vector3(UnityEngine.Random.Range(0f, maxSpread), UnityEngine.Random.Range(0f, maxSpread), UnityEngine.Random.Range(0f, maxSpread)), scale: scale); - QualityHandler.QualityToysHandler.SetQuality(c, Enums.ModelQuality.Medium); - } - QualityHandler.QualityToysHandler.Sync(); - yield return 0; - } - - public void TestMine() - { - Log.Info("TestMine"); - Vector3 pos = RoleTypeId.Scp049.GetRandomSpawnLocation().Position; - MineModelLow mml = new(); - - - Model m = mml.Create(pos, new Quaternion()); - m.Spawn(); - - - MineModelMedium mmm = new(); - - m = mmm.Create(pos + Vector3.up, new Quaternion()); - m.Spawn(); - - - MineModelPickup mmp = new(); - m = mmp.Create(pos + Vector3.right, new Quaternion()); - m.Spawn(); - - QualityHandler.Sync(); - - - - - - - - - foreach (var item in Player.List) - { - item.Teleport(pos); - } - - - - - } - } -} diff --git a/KruacentExiled/utils-merged/KE.Utilsge/API/Displays/DisplayMeow/DisplayHandler.cs b/KruacentExiled/utils-merged/KE.Utilsge/API/Displays/DisplayMeow/DisplayHandler.cs deleted file mode 100644 index 4ee13535..00000000 --- a/KruacentExiled/utils-merged/KE.Utilsge/API/Displays/DisplayMeow/DisplayHandler.cs +++ /dev/null @@ -1,67 +0,0 @@ -using Exiled.API.Features; -using HintServiceMeow.Core.Extension; -using HintServiceMeow.Core.Models.Hints; -using HintServiceMeow.Core.Utilities; -using MEC; - - -//damn why the same name -using MHint = HintServiceMeow.Core.Models.Hints.Hint; - -namespace KE.Utils.API.Displays.DisplayMeow -{ - public class DisplayHandler - { - public static DisplayHandler Instance { get; } = new(); - - private DisplayHandler() { } - - - - - - - public MHint AddHint(HintPlacement hintPlacement, Player player, string text, float delay) - { - var dis = PlayerDisplay.Get(player); - string id = $"{player.Id}_{hintPlacement.XCoordinate}_{hintPlacement.YCoordinate}"; - MHint hint; - - if (!dis.TryGetHint(id, out var aHint)) - { - hint = new() - { - Text = text, - XCoordinate = hintPlacement.XCoordinate, - YCoordinate = hintPlacement.YCoordinate, - Alignment = hintPlacement.HintAlignment, - Id = id - - }; - dis.AddHint(hint); - - } - else - { - - hint = (MHint)aHint; - hint.Hide = false; - hint.Text = text; - } - - - hint.HideAfter(delay); - return hint; - } - - - - - - - - - - - } -} diff --git a/KruacentExiled/utils-merged/KE.Utilsge/API/Displays/DisplayMeow/HintPlacement.cs b/KruacentExiled/utils-merged/KE.Utilsge/API/Displays/DisplayMeow/HintPlacement.cs deleted file mode 100644 index 936cdbe9..00000000 --- a/KruacentExiled/utils-merged/KE.Utilsge/API/Displays/DisplayMeow/HintPlacement.cs +++ /dev/null @@ -1,31 +0,0 @@ -using HintServiceMeow.Core.Enum; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace KE.Utils.API.Displays.DisplayMeow -{ - public readonly struct HintPlacement : IEquatable - { - public float YCoordinate { get; } - public float XCoordinate { get; } - public HintAlignment HintAlignment { get; } = HintAlignment.Center; - - - public bool Equals(HintPlacement obj) - { - return YCoordinate == obj.YCoordinate && XCoordinate == obj.XCoordinate; - } - - - public HintPlacement(float xCoordinate, float yCoordinate, HintAlignment alignment = HintAlignment.Center) - { - YCoordinate = yCoordinate; - XCoordinate = xCoordinate; - HintAlignment = alignment; - } - - } -} diff --git a/KruacentExiled/utils-merged/KE.Utilsge/API/Interfaces/IEvents.cs b/KruacentExiled/utils-merged/KE.Utilsge/API/Interfaces/IEvents.cs deleted file mode 100644 index e573b062..00000000 --- a/KruacentExiled/utils-merged/KE.Utilsge/API/Interfaces/IEvents.cs +++ /dev/null @@ -1,17 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace KE.Utils.API.Interfaces -{ - public interface IUsingEvents - { - - - public void SubscribeEvents(); - - public void UnsubscribeEvents(); - } -} diff --git a/KruacentExiled/utils-merged/KE.Utilsge/API/ReflectionHelper.cs b/KruacentExiled/utils-merged/KE.Utilsge/API/ReflectionHelper.cs deleted file mode 100644 index 2f00fbb1..00000000 --- a/KruacentExiled/utils-merged/KE.Utilsge/API/ReflectionHelper.cs +++ /dev/null @@ -1,47 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Reflection; -using System.Text; -using System.Threading.Tasks; - -namespace KE.Utils.API -{ - public static class ReflectionHelper - { - public static IEnumerable GetObjects(Assembly assembly = null) - { - List result = new(); - if (assembly == null) - { - assembly = Assembly.GetCallingAssembly(); - } - foreach (Type t in assembly.GetTypes()) - { - try - { - if (typeof(T).IsAssignableFrom(t) && !t.IsAbstract) - { - T ffcc = (T)Activator.CreateInstance(t); - result.Add(ffcc); - } - } - catch (Exception) - { - - } - } - return result; - } - - public static IEnumerable GetObjects(IEnumerable assemblies) - { - List result = new(); - foreach(Assembly assembly in assemblies) - { - result.AddRange(GetObjects(assembly)); - } - return result; - } - } -} diff --git a/KruacentExiled/utils-merged/KE.Utilsge/API/Sounds/SoundPlayer.cs b/KruacentExiled/utils-merged/KE.Utilsge/API/Sounds/SoundPlayer.cs deleted file mode 100644 index 919d911c..00000000 --- a/KruacentExiled/utils-merged/KE.Utilsge/API/Sounds/SoundPlayer.cs +++ /dev/null @@ -1,115 +0,0 @@ -using Exiled.API.Features; -using System; -using System.Collections.Generic; -using System.IO; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using UnityEngine; - -namespace KE.Utils.API.Sounds -{ - public class SoundPlayer - { - private static SoundPlayer _instance; - - public static SoundPlayer Instance - { - get - { - if(_instance == null) - { - _instance = new(); - } - return _instance; - } - } - - private SoundPlayer() { } - - private bool _loaded = false; - public bool Loaded => _loaded; - - public static readonly HashSet clips = new(); - - public static string SoundLocation => Paths.Configs + "/Sounds"; - public static void Load() => Instance.TryLoad(); - public void TryLoad() - { - if (Loaded) - { - return; - } - - if (!Directory.Exists(SoundLocation)) - { - Log.Warn("Directory not found. creating..."); - Directory.CreateDirectory(SoundLocation); - } - - string[] rawfile = Directory.GetFiles(SoundLocation, "*.ogg"); - - foreach (string file in rawfile) - { - string noExFile = Path.GetFileNameWithoutExtension(file); - Log.Info($"loading {file} as {noExFile}"); - clips.Add(noExFile); - AudioClipStorage.LoadClip(file); - } - _loaded = true; - } - - - /// - /// Play a clip at a static point - /// - /// - /// - /// - /// - public AudioClipPlayback Play(string clipName, Vector3 pos, float volume = 50f, float maxDistance = 20f, bool isSpatial = true) - { - if (!Loaded) throw new Exception("clips not loaded use SoundPlayer.Load()"); - Log.Debug($"playing {clipName} at {pos}"); - - var audioPlayer = AudioPlayer.CreateOrGet($"{clipName} ({pos})", onIntialCreation: (p) => - { - GameObject a = new GameObject(); - a.transform.position = pos; - p.transform.parent = a.transform; - Speaker speaker = p.AddSpeaker("main", isSpatial: isSpatial, maxDistance: maxDistance, minDistance: 1f); - speaker.transform.parent = a.transform; - speaker.transform.localPosition = Vector3.zero; - }); - - audioPlayer.DestroyWhenAllClipsPlayed = true; - return audioPlayer.AddClip(clipName, volume: volume); - - - } - - /// - /// Play a clip at a - /// - /// - /// - /// - /// - public void Play(string clipName, GameObject objectEmittingSound, float volume = 50f, float maxDistance = 20f, bool isSpatial = true) - { - if (!Loaded) throw new Exception("clips not loaded use SoundPlayer.Instance.Load()"); - Log.Debug($"playing {clipName} at {objectEmittingSound}"); - - var audioPlayer = AudioPlayer.CreateOrGet($"{clipName} ({objectEmittingSound})", onIntialCreation: (p) => - { - - p.transform.parent = objectEmittingSound.transform; - Speaker speaker = p.AddSpeaker("main", isSpatial: isSpatial, maxDistance: maxDistance, minDistance: 1f); - speaker.transform.parent = objectEmittingSound.transform; - speaker.transform.localPosition = Vector3.zero; - }); - audioPlayer.AddClip(clipName, volume: volume); - audioPlayer.DestroyWhenAllClipsPlayed = true; - } - } -} diff --git a/KruacentExiled/utils-merged/KE.Utilsge/Extensions/AdminToyExtension.cs b/KruacentExiled/utils-merged/KE.Utilsge/Extensions/AdminToyExtension.cs deleted file mode 100644 index 37c3706d..00000000 --- a/KruacentExiled/utils-merged/KE.Utilsge/Extensions/AdminToyExtension.cs +++ /dev/null @@ -1,25 +0,0 @@ -using Exiled.API.Features.Toys; -using KE.Utils.Quality; -using KE.Utils.Quality.Enums; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace KE.Utils.Extensions -{ - public static class AdminToyExtension - { - - public static void SetAsPickupAdminToy(this AdminToy toy, bool autoSync = true) - { - QualityHandler.Instance.QualityToysHandler.SetAsPickup(toy); - } - - public static void SetQuality(this AdminToy toy, ModelQuality modelQuality,bool autoSync = true) - { - QualityHandler.Instance.QualityToysHandler.SetQuality(toy, modelQuality); - } - } -} diff --git a/KruacentExiled/utils-merged/KE.Utilsge/Extensions/PlayerExtension.cs b/KruacentExiled/utils-merged/KE.Utilsge/Extensions/PlayerExtension.cs deleted file mode 100644 index b01f98d2..00000000 --- a/KruacentExiled/utils-merged/KE.Utilsge/Extensions/PlayerExtension.cs +++ /dev/null @@ -1,52 +0,0 @@ -using CustomPlayerEffects; -using Exiled.API.Enums; -using Exiled.API.Features; -using Mirror; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using UnityEngine; - -namespace KE.Utils.Extensions -{ - public static class PlayerExtension - { - public static void SetFakeInvis(this Player p, IEnumerable viewers) - { - Vector3 pos = p.Position; - - try - { - p.ReferenceHub.transform.localPosition = Vector3.zero; - foreach (Player viewer in viewers) - { - Server.SendSpawnMessage.Invoke(null, new object[2] { viewer.NetworkIdentity, viewer.Connection }); - } - - p.ReferenceHub.transform.localPosition = pos; - } - catch (Exception arg) - { - Log.Error(string.Format("{0}: {1}", "SetFakeInvis", arg)); - } - } - - - - - public static void AddLevelEffect(this Player p,EffectType type, int intensity) - { - - - if (!p.TryGetEffect(type, out var effect)) - p.ChangeEffectIntensity(type, (byte)(effect.Intensity + intensity)); - else - p.EnableEffect(type, (byte)intensity); - } - - - - } -} diff --git a/KruacentExiled/utils-merged/KE.Utilsge/Extensions/RoomExtension.cs b/KruacentExiled/utils-merged/KE.Utilsge/Extensions/RoomExtension.cs deleted file mode 100644 index 35fee2e8..00000000 --- a/KruacentExiled/utils-merged/KE.Utilsge/Extensions/RoomExtension.cs +++ /dev/null @@ -1,12 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace KE.Utils.Extensions -{ - internal class RoomExtension - { - } -} diff --git a/KruacentExiled/utils-merged/KE.Utilsge/KE.Utils.csproj b/KruacentExiled/utils-merged/KE.Utilsge/KE.Utils.csproj deleted file mode 100644 index e65e4856..00000000 --- a/KruacentExiled/utils-merged/KE.Utilsge/KE.Utils.csproj +++ /dev/null @@ -1,31 +0,0 @@ - - - - 13.0 - net48 - - - - - - - - - - - - - - - - - - - if not "$(EXILED_DEV_REFERENCES)"=="" copy /y "$(OutputPath)$(AssemblyName).dll" "$(EXILED_DEV_REFERENCES)\Plugins\" - - - if [[ ! -z "$EXILED_DEV_REFERENCES" ]]; then cp "$(OutputPath)$(AssemblyName).dll" "$EXILED_DEV_REFERENCES/Plugins/"; fi - - - - diff --git a/KruacentExiled/utils-merged/KE.Utilsge/Quality/Enums/ModelQuality.cs b/KruacentExiled/utils-merged/KE.Utilsge/Quality/Enums/ModelQuality.cs deleted file mode 100644 index d9d8d295..00000000 --- a/KruacentExiled/utils-merged/KE.Utilsge/Quality/Enums/ModelQuality.cs +++ /dev/null @@ -1,16 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace KE.Utils.Quality.Enums -{ - public enum ModelQuality - { - None = -1, - Low, - Medium, - High, - } -} diff --git a/KruacentExiled/utils-merged/KE.Utilsge/Quality/Handlers/QualityToysHandler.cs b/KruacentExiled/utils-merged/KE.Utilsge/Quality/Handlers/QualityToysHandler.cs deleted file mode 100644 index b2485795..00000000 --- a/KruacentExiled/utils-merged/KE.Utilsge/Quality/Handlers/QualityToysHandler.cs +++ /dev/null @@ -1,179 +0,0 @@ -using AdminToys; -using Exiled.API.Enums; -using Exiled.API.Extensions; -using Exiled.API.Features; -using Exiled.API.Features.Toys; -using KE.Utils.Quality.Enums; -using KE.Utils.Quality.Settings; -using MEC; -using System; -using System.Collections.Generic; -using System.Linq; -using UnityEngine; -using Light = Exiled.API.Features.Toys.Light; -using QualitySettings = KE.Utils.Quality.Settings.QualitySettings; - -namespace KE.Utils.Quality.Handlers -{ - public class QualityToysHandler - { - private HashSet _pickupToys = new(); - private Dictionary _qualityToys = new(); - public readonly Vector3 Gulag = new Vector3(15000, 15000, 15000); - public const float Delay = Timing.WaitForOneFrame; - public bool IsPickupToy(AdminToy primitive) - { - return _pickupToys.Contains(primitive); - } - - public bool IsQualityToy(AdminToy primitive) - { - return _qualityToys.ContainsKey(primitive); - } - - - public void SetAsPickup(AdminToy toy, bool autoSync = true) - { - if (!_pickupToys.Add(toy)) - { - Log.Warn($"AdminToy {toy} is already a pickupToy"); - return; - } - if (autoSync) - Sync(toy); - } - - public void SetQuality(AdminToy toy, ModelQuality quality, bool autoSync = true) - { - if (toy == null) return; - if (!_qualityToys.ContainsKey(toy)) - _qualityToys.Add(toy, quality); - else - _qualityToys[toy] = quality; - - if (autoSync) - Sync(toy); - } - - - - private void SendToFakePosition(AdminToy adminToy, Player player,Vector3 position) - { - //idk why but without delay it show all of the quality at once - Timing.CallDelayed(Delay, () => - { - if (adminToy is Light l) - { - player.SendFakeSyncVar(l.Base.netIdentity, typeof(LightSourceToy), nameof(LightSourceToy.NetworkPosition), position); - return; - } - if (adminToy is Primitive p) - { - player.SendFakeSyncVar(p.Base.netIdentity, typeof(PrimitiveObjectToy), nameof(PrimitiveObjectToy.NetworkPosition), position); - return; - } - }); - - } - - /// - /// Sync every Players - /// - public void Sync() - { - foreach (Player p in Player.List) - { - Sync(p); - } - } - - /// - /// Sync a specified Player - /// - /// - public void Sync(Player p) - { - - - - var quality = QualitySettings.Get(p); - var pickup = QualitySettings.PickmodelActivated(p); - - HashSet pickupToRemove = []; - HashSet qualityToRemove = []; - - //hide pickup toys - - foreach (AdminToy pk in _pickupToys) - { - try - { - if (pickup) - { - SendToFakePosition(pk, p, pk.Position); - } - else - { - SendToFakePosition(pk, p, Gulag); - } - } - catch (NullReferenceException) - { - //Log.Warn("removing pickup"); - pickupToRemove.Add(pk); - } - - } - - _pickupToys.RemoveWhere(p => pickupToRemove.Contains(p)); - - - foreach (var at in _qualityToys) - { - try - { - if ((at.Value == quality || at.Value == ModelQuality.None) && (pickup || !_pickupToys.Contains(at.Key))) - { - SendToFakePosition(at.Key, p, at.Key.Position); - } - else - { - SendToFakePosition(at.Key, p, Gulag); - } - } - catch (NullReferenceException) - { - //Log.Warn("removing quality" + _qualityToys.Count); - qualityToRemove.Add(at.Key); - } - - - } - foreach(var at in qualityToRemove) - { - - _qualityToys.Remove(at); - } - - } - - /// - /// Sync a specified AdminToy - /// - /// - public void Sync(AdminToy adminToy) - { - //temporary fix - Sync(); - - if (IsPickupToy(adminToy)) - { - - } - if (IsQualityToy(adminToy)) - { - - } - } - } -} diff --git a/KruacentExiled/utils-merged/KE.Utilsge/Quality/Models/Base/BaseModel.cs b/KruacentExiled/utils-merged/KE.Utilsge/Quality/Models/Base/BaseModel.cs deleted file mode 100644 index c9f6723c..00000000 --- a/KruacentExiled/utils-merged/KE.Utilsge/Quality/Models/Base/BaseModel.cs +++ /dev/null @@ -1,41 +0,0 @@ -using Exiled.API.Enums; -using Exiled.API.Extensions; -using Exiled.API.Features.Toys; -using Exiled.API.Interfaces; -using KE.Utils.Quality.Structs; -using PlayerStatsSystem; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using UnityEngine; -using Light = Exiled.API.Features.Toys.Light; - -namespace KE.Utils.Quality.Models.Base -{ - - /// - /// The blocks to build a model with - /// - public abstract class BaseModel : ICloneable - { - - protected AdminToy _toy; - public AdminToy AdminToy { get { return _toy; } } - private Vector3 _position; - public Vector3 LocalPosition { get { return _position; } } - private Quaternion _rotation; - public Quaternion LocalRotation { get { return _rotation; } } - - - public BaseModel(Vector3 localPositon, Quaternion localRotation) - { - _position = localPositon; - _rotation = localRotation; - } - - public abstract object Clone(); - } - -} diff --git a/KruacentExiled/utils-merged/KE.Utilsge/Quality/Models/Base/LightModel.cs b/KruacentExiled/utils-merged/KE.Utilsge/Quality/Models/Base/LightModel.cs deleted file mode 100644 index ce808da1..00000000 --- a/KruacentExiled/utils-merged/KE.Utilsge/Quality/Models/Base/LightModel.cs +++ /dev/null @@ -1,26 +0,0 @@ -using Exiled.API.Features.Toys; -using UnityEngine; -using Light = Exiled.API.Features.Toys.Light; - -namespace KE.Utils.Quality.Models.Base -{ - public class LightModel : BaseModel - { - - /// - /// Create a new Light for modeling - /// - public LightModel(Vector3? scale, Color? color, Vector3 localPositon, Quaternion localRotation) : base(localPositon, localRotation) - { - Light light = Light.Create(null, null, scale, false, color); - _toy = light; - } - - - public override object Clone() - { - Light light = _toy as Light; - return new LightModel(light.Scale, light.Color, LocalPosition, LocalRotation); - } - } -} diff --git a/KruacentExiled/utils-merged/KE.Utilsge/Quality/Models/Base/PrimitiveModel.cs b/KruacentExiled/utils-merged/KE.Utilsge/Quality/Models/Base/PrimitiveModel.cs deleted file mode 100644 index 22e07225..00000000 --- a/KruacentExiled/utils-merged/KE.Utilsge/Quality/Models/Base/PrimitiveModel.cs +++ /dev/null @@ -1,26 +0,0 @@ -using Exiled.API.Features.Toys; -using UnityEngine; -using Color = UnityEngine.Color; - -namespace KE.Utils.Quality.Models.Base -{ - public class PrimitiveModel : BaseModel - { - /// - /// Create a new Primitive for modeling - /// - public PrimitiveModel(PrimitiveType type, Vector3? scale, Color? color,Vector3 localPosition,Quaternion localRotation) : base(localPosition, localRotation) - { - - Primitive prim = Primitive.Create(type, null, null, scale, false, color); - prim.Collidable = false; - _toy = prim; - } - - public override object Clone() - { - Primitive prim = _toy as Primitive; - return new PrimitiveModel(prim.Type, prim.Scale, prim.Color, LocalPosition, LocalRotation); - } - } -} diff --git a/KruacentExiled/utils-merged/KE.Utilsge/Quality/Models/Examples/MineModel.cs b/KruacentExiled/utils-merged/KE.Utilsge/Quality/Models/Examples/MineModel.cs deleted file mode 100644 index 00d60fec..00000000 --- a/KruacentExiled/utils-merged/KE.Utilsge/Quality/Models/Examples/MineModel.cs +++ /dev/null @@ -1,118 +0,0 @@ -using KE.Utils.Quality.Enums; -using KE.Utils.Quality.Models.Base; -using System.Collections.Generic; -using UnityEngine; -using Light = Exiled.API.Features.Toys.Light; - -namespace KE.Utils.Quality.Models.Examples -{ - public abstract class MineModel : QualityModel - { - protected Light _light; - private bool _lightOn = false; - - - - - public void ToggleLight() - { - if (_light == null) throw new System.Exception("no light"); - if (_lightOn) - _light.UnSpawn(); - else - _light.Spawn(); - _lightOn = !_lightOn; - } - - } - - public class MineModelLow : MineModel - { - public override bool IsPickup => false; - public override ModelQuality Quality => ModelQuality.Low; - - protected override IEnumerable GetBaseModels() - { - Quaternion baseRotation = new(); - //spawn + offset - Vector3 offset = new Vector3(0, .05f); - Vector3 sizeDisk = new Vector3(.7f, 0.1f, .7f); - - Vector3 sizeGlobe = new Vector3(.1f, .1f, .1f); - Vector3 posLight = new Vector3(0, sizeDisk.y+sizeGlobe.y); - - - var baseMine = new PrimitiveModel(PrimitiveType.Cylinder, sizeDisk, Color.black, offset, baseRotation); - - var lightGlobe = new PrimitiveModel(PrimitiveType.Sphere, sizeGlobe , new Color(1, 0, 0, .33f), posLight, baseRotation); - - var lightMine = new LightModel(null, Color.red, posLight, baseRotation); - - _light = lightMine.AdminToy as Light; - _light.Intensity = .55f; - - return [baseMine, lightGlobe, lightMine]; - } - - - } - - public class MineModelMedium : MineModel - { - public override bool IsPickup => false; - public override ModelQuality Quality => ModelQuality.Medium; - - protected override IEnumerable GetBaseModels() - { - Quaternion baseRotation = new(); - //spawn + offset - Vector3 offset = new Vector3(0, .05f); - Vector3 sizeDisk = new Vector3(.7f, 0.1f, .7f); - - Vector3 sizeGlobe = new Vector3(.1f, .1f, .1f); - Vector3 posLight = new Vector3(0, sizeDisk.y + sizeGlobe.y); - - - var baseMine = new PrimitiveModel(PrimitiveType.Cylinder, sizeDisk, Color.black, offset, baseRotation); - - var lightGlobe = new PrimitiveModel(PrimitiveType.Sphere, sizeGlobe, new Color(1, 0, 0, .33f), posLight, baseRotation); - - var lightMine = new LightModel(null, Color.green, posLight, baseRotation); - - _light = lightMine.AdminToy as Light; - _light.Intensity = .55f; - - return [baseMine, lightGlobe, lightMine]; - } - } - - public class MineModelPickup : MineModel - { - public override bool IsPickup => true; - public override ModelQuality Quality => ModelQuality.None; - - - protected override IEnumerable GetBaseModels() - { - Quaternion baseRotation = new(); - //spawn + offset - Vector3 offset = new Vector3(0, .05f); - Vector3 sizeDisk = new Vector3(.7f, 0.1f, .7f); - - Vector3 sizeGlobe = new Vector3(.1f, .1f, .1f); - Vector3 posLight = new Vector3(0, sizeDisk.y + sizeGlobe.y); - - - var baseMine = new PrimitiveModel(PrimitiveType.Cylinder, sizeDisk, Color.black, offset, baseRotation); - - var lightGlobe = new PrimitiveModel(PrimitiveType.Sphere, sizeGlobe, new Color(1, 0, 0, .33f), posLight, baseRotation); - - var lightMine = new LightModel(null, Color.magenta, posLight, baseRotation); - - _light = lightMine.AdminToy as Light; - _light.Intensity = .55f; - - return [baseMine, lightGlobe, lightMine]; - } - } -} diff --git a/KruacentExiled/utils-merged/KE.Utilsge/Quality/Models/Model.cs b/KruacentExiled/utils-merged/KE.Utilsge/Quality/Models/Model.cs deleted file mode 100644 index 2e26756e..00000000 --- a/KruacentExiled/utils-merged/KE.Utilsge/Quality/Models/Model.cs +++ /dev/null @@ -1,104 +0,0 @@ -using Exiled.API.Features; -using Exiled.API.Features.Toys; -using KE.Utils.Quality.Models.Base; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using UnityEngine; - -namespace KE.Utils.Quality.Models -{ - public class Model : IEquatable - { - - - private Vector3 _position; - public Vector3 Position - { - get { return _position; } - set - { - _position = value; - } - } - private Quaternion _rotation; - public Quaternion Rotation - { - get { return _rotation; } - set - { - _rotation = value; - } - } - private ModelPrefab _prefab; - public ModelPrefab Prefab - { - get { return _prefab; } - } - - - - private HashSet _models; - - internal Model(ModelPrefab prefab, Vector3 position, Quaternion rotation,IEnumerable toys,bool spawn) - { - _prefab = prefab; - Position = position; - Rotation = rotation; - _models = new HashSet(toys); - QualityHandler.Instance.QualityToysHandler.Sync(); - - foreach (BaseModel based in toys) - { - AdminToy toy = based.AdminToy; - - if (toy is Primitive p) - p.Collidable = false; - toy.AdminToyBase.transform.position = based.LocalPosition + Position; - toy.AdminToyBase.transform.rotation = based.LocalRotation * Rotation; - } - if(spawn) - { - Spawn(); - } - } - - - public void Destroy() - { - foreach (BaseModel primitive in _models) - { - primitive.AdminToy.Destroy(); - } - } - public void UnSpawn() - { - foreach (BaseModel primitive in _models) - { - primitive.AdminToy.UnSpawn(); - } - } - public void Spawn() - { - QualityHandler.Instance.QualityToysHandler.Sync(); - foreach (BaseModel primitive in _models) - { - primitive.AdminToy.Spawn(); - } - - } - - - public bool Equals(Model x) - { - if (x == null) return false; - return x._prefab == _prefab && x.Position == Position && x.Rotation == Rotation; - } - public int GetHashCode(Model obj) - { - return obj.GetHashCode(); - } - } -} diff --git a/KruacentExiled/utils-merged/KE.Utilsge/Quality/Models/ModelPrefab.cs b/KruacentExiled/utils-merged/KE.Utilsge/Quality/Models/ModelPrefab.cs deleted file mode 100644 index bbc39da4..00000000 --- a/KruacentExiled/utils-merged/KE.Utilsge/Quality/Models/ModelPrefab.cs +++ /dev/null @@ -1,42 +0,0 @@ -using Exiled.API.Features; -using Exiled.API.Features.Core; -using Exiled.API.Features.Pickups; -using Exiled.API.Features.Toys; -using Exiled.API.Interfaces; -using KE.Utils.Extensions; -using KE.Utils.Quality.Models.Base; -using KE.Utils.Quality.Structs; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using UnityEngine; -using Light = Exiled.API.Features.Toys.Light; - -namespace KE.Utils.Quality.Models -{ - public abstract class ModelPrefab - { - - protected abstract IEnumerable GetBaseModels(); - - public virtual Model Create(Vector3 position,Quaternion rotation, bool spawn = true) - { - - HashSet clonetoys = new(); - HashSet toys = GetBaseModels().ToHashSet(); - foreach (BaseModel model in toys) - { - BaseModel clone = (BaseModel)model.Clone(); - clonetoys.Add(clone); - } - return new Model(this, position, rotation, clonetoys,spawn); - - } - - - - - } -} diff --git a/KruacentExiled/utils-merged/KE.Utilsge/Quality/Models/QualityModel.cs b/KruacentExiled/utils-merged/KE.Utilsge/Quality/Models/QualityModel.cs deleted file mode 100644 index b5cc682f..00000000 --- a/KruacentExiled/utils-merged/KE.Utilsge/Quality/Models/QualityModel.cs +++ /dev/null @@ -1,40 +0,0 @@ -using Exiled.API.Features; -using Exiled.API.Features.Toys; -using KE.Utils.Extensions; -using KE.Utils.Quality.Enums; -using KE.Utils.Quality.Models.Base; -using System.Collections.Generic; -using System.Linq; -using UnityEngine; - -namespace KE.Utils.Quality.Models -{ - public abstract class QualityModel : ModelPrefab - { - public abstract ModelQuality Quality { get; } - public abstract bool IsPickup { get; } - - - - - public override sealed Model Create(Vector3 position, Quaternion rotation,bool spawn = true) - { - - HashSet clonetoys = new(); - HashSet toys = GetBaseModels().ToHashSet(); - foreach (BaseModel model in toys) - { - BaseModel clone = (BaseModel)model.Clone(); - - if (IsPickup) - clone.AdminToy.SetAsPickupAdminToy(false); - - clone.AdminToy.SetQuality(Quality,false); - clonetoys.Add(clone); - } - QualityHandler.Sync(); - return new Model(this,position, rotation, clonetoys, spawn); - } - - } -} diff --git a/KruacentExiled/utils-merged/KE.Utilsge/Quality/QualityHandler.cs b/KruacentExiled/utils-merged/KE.Utilsge/Quality/QualityHandler.cs deleted file mode 100644 index 235d79c9..00000000 --- a/KruacentExiled/utils-merged/KE.Utilsge/Quality/QualityHandler.cs +++ /dev/null @@ -1,61 +0,0 @@ -using Exiled.API.Features; -using Exiled.API.Features.Core.UserSettings; -using KE.Utils.Quality.Handlers; -using KE.Utils.Quality.Settings; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace KE.Utils.Quality -{ - [Obsolete("scrapped", false)] - internal class QualityHandler - { - public QualitySettings QualitySettings { get; private set; } - public QualityToysHandler QualityToysHandler { get; private set; } - - private static QualityHandler _instance; - public static QualityHandler Instance - { - get - { - if(_instance == null ) - _instance = new QualityHandler(); - return _instance; - } - } - private QualityHandler() - { - QualitySettings = new QualitySettings(Changed); - QualityToysHandler = new QualityToysHandler(); - } - - ~QualityHandler() - { - QualityToysHandler = null; - QualitySettings = null; - } - - public void Changed(Player p, SettingBase _) - { - QualityToysHandler.Sync(p); - } - - public void Register() - { - QualitySettings.Register(); - } - - public void Unregister() - { - QualitySettings.Unregister(); - } - - public static void Sync() - { - Instance.QualityToysHandler.Sync(); - } - } -} diff --git a/KruacentExiled/utils-merged/KE.Utilsge/Quality/QualityToysHandler.cs b/KruacentExiled/utils-merged/KE.Utilsge/Quality/QualityToysHandler.cs deleted file mode 100644 index 27320233..00000000 --- a/KruacentExiled/utils-merged/KE.Utilsge/Quality/QualityToysHandler.cs +++ /dev/null @@ -1,155 +0,0 @@ -using AdminToys; -using Exiled.API.Enums; -using Exiled.API.Extensions; -using Exiled.API.Features; -using Exiled.API.Features.Toys; -using KE.Utils.Quality.Enums; -using KE.Utils.Quality.Settings; -using System.Collections.Generic; -using System.Linq; -using UnityEngine; -using Light = Exiled.API.Features.Toys.Light; -using QualitySettings = KE.Utils.Quality.Settings.QualitySettings; - -namespace KE.Utils.Quality -{ - public class QualityToysHandler - { - private HashSet _pickupToys = new(); - private Dictionary _qualityToys = new(); - public readonly Vector3 Gulag = new Vector3(15000,15000,15000); - - public bool IsPickupToy(AdminToy primitive) - { - return _pickupToys.Contains(primitive); - } - - public bool IsQualityToy(AdminToy primitive) - { - return _qualityToys.ContainsKey(primitive); - } - - - public void SetAsPickup(AdminToy toy) - { - if (!_pickupToys.Add(toy)) - { - Log.Warn($"AdminToy {toy} is already a pickupToy"); - return; - } - } - - public void SetQuality(AdminToy toy,ModelQuality quality) - { - if (toy == null) return; - if (!_qualityToys.ContainsKey(toy)) - _qualityToys.Add(toy,quality); - else - _qualityToys[toy] = quality; - } - - - - private void SendToShadowRealm(AdminToy adminToy, Player player) - { - if(adminToy is Light l) - { - player.SendFakeSyncVar(l.Base.netIdentity, typeof(LightSourceToy), nameof(LightSourceToy.NetworkPosition), Gulag); - return; - } - if(adminToy is Primitive p) - { - player.SendFakeSyncVar(p.Base.netIdentity, typeof(PrimitiveObjectToy), nameof(PrimitiveObjectToy.NetworkPosition), Gulag); - return; - } - } - - private void SetTruePosition(AdminToy adminToy, Player player) - { - if (adminToy is Light l) - { - player.SendFakeSyncVar(l.Base.netIdentity, typeof(LightSourceToy), nameof(LightSourceToy.NetworkPosition), l.Position); - return; - } - if (adminToy is Primitive p) - { - player.SendFakeSyncVar(p.Base.netIdentity, typeof(PrimitiveObjectToy), nameof(PrimitiveObjectToy.NetworkPosition), p.Position); - return; - } - } - - /// - /// Sync every Players - /// - public void Sync() - { - foreach(Player p in Player.List) - { - Sync(p); - } - } - - /// - /// Sync a specified Player - /// - /// - public void Sync(Player p) - { - var quality = QualitySettings.Get(p); - var pickup = QualitySettings.PickmodelActivated(p); - - if (!pickup) - { - //hide pickup toys - foreach (AdminToy pk in _pickupToys) - { - SendToShadowRealm(pk, p); - } - } - else - { - //show pickup toys - foreach (AdminToy pk in _pickupToys) - { - SetTruePosition(pk, p); - } - } - - - - - foreach(var at in _qualityToys) - { - if(at.Value == quality) - { - if (pickup || !_pickupToys.Contains(at.Key)) - { - SetTruePosition(at.Key, p); - } - } - else - { - SendToShadowRealm(at.Key, p); - } - - } - - } - - /// - /// Sync a specified AdminToy - /// - /// - public void Sync(AdminToy adminToy) - { - if (IsPickupToy(adminToy)) - { - - } - if (IsQualityToy(adminToy)) - { - - } - } - } -} diff --git a/KruacentExiled/utils-merged/KE.Utilsge/Quality/Settings/QualitySettings.cs b/KruacentExiled/utils-merged/KE.Utilsge/Quality/Settings/QualitySettings.cs deleted file mode 100644 index ca8d49be..00000000 --- a/KruacentExiled/utils-merged/KE.Utilsge/Quality/Settings/QualitySettings.cs +++ /dev/null @@ -1,62 +0,0 @@ -using Exiled.API.Features; -using Exiled.API.Features.Core.UserSettings; -using KE.Utils.Quality.Enums; -using System; - -namespace KE.Utils.Quality.Settings -{ - public class QualitySettings - { - - private static int _idQuality = 0; - private static int _idModels = 1; - private static int _idSlider = 2; - private SettingBase[] _settings; - public QualitySettings(Action onChanged) - { - HeaderSetting header = new("Quality Settings"); - _settings = - [ - header, - new DropdownSetting(_idQuality,"ModelQuality",["Low","Medium", "High"],onChanged:onChanged), - new TwoButtonsSetting(_idModels,"Pickup models","Disabled","Enabled", onChanged:onChanged) - ]; - } - - public void Register() - { - SettingBase.Register(_settings); - SettingBase.SendToAll(); - } - - public void Unregister() - { - SettingBase.Unregister(settings:_settings); - } - - - - - public static ModelQuality Get(Player p) - { - if (!SettingBase.TryGetSetting(p, _idQuality, out var setting)) return ModelQuality.None; - - return setting.SelectedOption switch - { - "Low" => ModelQuality.Low, - "Medium" => ModelQuality.Medium, - "High" => ModelQuality.High, - _ => ModelQuality.None, - }; - } - - - public static bool PickmodelActivated(Player p) - { - if (!SettingBase.TryGetSetting(p, _idModels, out var setting)) return false; - return setting.IsSecond; - } - - - } -} diff --git a/KruacentExiled/utils-merged/KE.Utilsge/Quality/Structs/LocalWorldSpace.cs b/KruacentExiled/utils-merged/KE.Utilsge/Quality/Structs/LocalWorldSpace.cs deleted file mode 100644 index d9c6205b..00000000 --- a/KruacentExiled/utils-merged/KE.Utilsge/Quality/Structs/LocalWorldSpace.cs +++ /dev/null @@ -1,23 +0,0 @@ -using Exiled.API.Interfaces; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using UnityEngine; - -namespace KE.Utils.Quality.Structs -{ - public readonly struct LocalWorldSpace : IWorldSpace - { - - public Vector3 Position { get; } - public Quaternion Rotation { get; } - - public LocalWorldSpace(Vector3 position, Quaternion rotation) - { - Position = position; - Rotation = rotation; - } - } -} diff --git a/KruacentExiled/utils-merged/KE.Utilsge/Quality/Tests/Test.cs b/KruacentExiled/utils-merged/KE.Utilsge/Quality/Tests/Test.cs deleted file mode 100644 index 6ebd3f66..00000000 --- a/KruacentExiled/utils-merged/KE.Utilsge/Quality/Tests/Test.cs +++ /dev/null @@ -1,108 +0,0 @@ -using Exiled.API.Extensions; -using Exiled.API.Features; -using Exiled.API.Features.Toys; -using KE.Utils.Quality.Models; -using KE.Utils.Quality.Models.Examples; -using MEC; -using PlayerRoles; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using UnityEngine; - -namespace KE.Utils.Quality.Tests -{ - public class Test - { - private QualityHandler QualityHandler; - - - private Test(QualityHandler q) - { - QualityHandler = q; - try - { - TestMine(); - } - catch (Exception ex) - { - Log.Error("Exception for TestMine :\n"+ex); - } - - } - internal void TestQuality() - { - Vector3 pos = RoleTypeId.Scp049.GetRandomSpawnLocation().Position; - Primitive c = Primitive.Create(pos); - c.Color = Color.red; - Primitive c2 = Primitive.Create(pos + Vector3.one); - c2.Color = Color.green; - - - QualityHandler.QualityToysHandler.SetQuality(c, Enums.ModelQuality.Low); - QualityHandler.QualityToysHandler.SetQuality(c2, Enums.ModelQuality.Medium); - } - - internal void StressTest(int count) - { - Timing.RunCoroutine(Stress(count)); - } - - - private IEnumerator Stress(int count) - { - Vector3 pos = RoleTypeId.Scp049.GetRandomSpawnLocation().Position; - Vector3 scale = new Vector3(.1f, .1f, .1f); - float maxSpread = 5; - for (int i = 0; i < count; i++) - { - Primitive c = Primitive.Create(pos + new Vector3(UnityEngine.Random.Range(0f, maxSpread), UnityEngine.Random.Range(0f, maxSpread), UnityEngine.Random.Range(0f, maxSpread)), scale: scale); - QualityHandler.QualityToysHandler.SetQuality(c, Enums.ModelQuality.Medium); - } - QualityHandler.QualityToysHandler.Sync(); - yield return 0; - } - - public void TestMine() - { - Log.Info("TestMine"); - Vector3 pos = RoleTypeId.Scp049.GetRandomSpawnLocation().Position; - MineModelLow mml = new(); - - - Model m = mml.Create(pos, new Quaternion()); - m.Spawn(); - - - MineModelMedium mmm = new(); - - m = mmm.Create(pos + Vector3.up, new Quaternion()); - m.Spawn(); - - - MineModelPickup mmp = new(); - m = mmp.Create(pos + Vector3.right, new Quaternion()); - m.Spawn(); - - QualityHandler.Sync(); - - - - - - - - - foreach (var item in Player.List) - { - item.Teleport(pos); - } - - - - - } - } -} diff --git a/KruacentExiled/utils-merged/KE.Utilsmap/API/Displays/DisplayMeow/DisplayHandler.cs b/KruacentExiled/utils-merged/KE.Utilsmap/API/Displays/DisplayMeow/DisplayHandler.cs deleted file mode 100644 index 4ee13535..00000000 --- a/KruacentExiled/utils-merged/KE.Utilsmap/API/Displays/DisplayMeow/DisplayHandler.cs +++ /dev/null @@ -1,67 +0,0 @@ -using Exiled.API.Features; -using HintServiceMeow.Core.Extension; -using HintServiceMeow.Core.Models.Hints; -using HintServiceMeow.Core.Utilities; -using MEC; - - -//damn why the same name -using MHint = HintServiceMeow.Core.Models.Hints.Hint; - -namespace KE.Utils.API.Displays.DisplayMeow -{ - public class DisplayHandler - { - public static DisplayHandler Instance { get; } = new(); - - private DisplayHandler() { } - - - - - - - public MHint AddHint(HintPlacement hintPlacement, Player player, string text, float delay) - { - var dis = PlayerDisplay.Get(player); - string id = $"{player.Id}_{hintPlacement.XCoordinate}_{hintPlacement.YCoordinate}"; - MHint hint; - - if (!dis.TryGetHint(id, out var aHint)) - { - hint = new() - { - Text = text, - XCoordinate = hintPlacement.XCoordinate, - YCoordinate = hintPlacement.YCoordinate, - Alignment = hintPlacement.HintAlignment, - Id = id - - }; - dis.AddHint(hint); - - } - else - { - - hint = (MHint)aHint; - hint.Hide = false; - hint.Text = text; - } - - - hint.HideAfter(delay); - return hint; - } - - - - - - - - - - - } -} diff --git a/KruacentExiled/utils-merged/KE.Utilsmap/API/Displays/DisplayMeow/HintPlacement.cs b/KruacentExiled/utils-merged/KE.Utilsmap/API/Displays/DisplayMeow/HintPlacement.cs deleted file mode 100644 index 936cdbe9..00000000 --- a/KruacentExiled/utils-merged/KE.Utilsmap/API/Displays/DisplayMeow/HintPlacement.cs +++ /dev/null @@ -1,31 +0,0 @@ -using HintServiceMeow.Core.Enum; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace KE.Utils.API.Displays.DisplayMeow -{ - public readonly struct HintPlacement : IEquatable - { - public float YCoordinate { get; } - public float XCoordinate { get; } - public HintAlignment HintAlignment { get; } = HintAlignment.Center; - - - public bool Equals(HintPlacement obj) - { - return YCoordinate == obj.YCoordinate && XCoordinate == obj.XCoordinate; - } - - - public HintPlacement(float xCoordinate, float yCoordinate, HintAlignment alignment = HintAlignment.Center) - { - YCoordinate = yCoordinate; - XCoordinate = xCoordinate; - HintAlignment = alignment; - } - - } -} diff --git a/KruacentExiled/utils-merged/KE.Utilsmap/API/GifAnimator/RenderGif.cs b/KruacentExiled/utils-merged/KE.Utilsmap/API/GifAnimator/RenderGif.cs deleted file mode 100644 index f4276d33..00000000 --- a/KruacentExiled/utils-merged/KE.Utilsmap/API/GifAnimator/RenderGif.cs +++ /dev/null @@ -1,128 +0,0 @@ -using System.Collections.Generic; -using System.Drawing; -using System.Drawing.Imaging; -using System.IO; -using Exiled.API.Features; -using Exiled.API.Features.Toys; -using MEC; -using UnityEngine; -using UnityEngine.Rendering; -using Color = UnityEngine.Color; -namespace KE.Utils.API.GifAnimator -{ - internal class RenderGif - { - - public static void Spawn() - { - - } - - - - private static IEnumerator RenderImageCoroutine(object target, string filePath, float maxWidth, float maxHeight, float distance, float duration, int targetWidth, int targetHeight) - { - if (!File.Exists(filePath)) - { - Log.Debug($"No image was found under: {filePath}"); - yield break; - } - - byte[] imageData = File.ReadAllBytes(filePath); - - - - - - - Texture2D original = new Texture2D(2, 2); - - - try - { - original.LoadRawTextureData(imageData); - } - catch(UnityException) - { - Log.Debug("Image couldnt be loaded."); - yield break; - } - - Texture2D scaled = new Texture2D(targetWidth, targetHeight, TextureFormat.RGBA32, false); - - for (int x = 0; x < targetWidth; x++) - { - for (int y = 0; y < targetHeight; y++) - { - float u = x / (float)targetWidth; - float v = y / (float)targetHeight; - Color color = original.GetPixelBilinear(u, v); - scaled.SetPixel(x, y, color); - } - } - scaled.Apply(); - - float pixelScaleX = maxWidth / targetWidth; - float pixelScaleY = maxHeight / targetHeight; - float scale = Mathf.Min(pixelScaleX, pixelScaleY); - - Vector3 forwardOrigin; - Quaternion rotation = Quaternion.identity; - - if (target is Exiled.API.Features.Player player) - { - forwardOrigin = player.CameraTransform.position + player.CameraTransform.forward * distance; - - Vector3 directionToPlayer = forwardOrigin - player.CameraTransform.position; - directionToPlayer.y = 0; - rotation = Quaternion.LookRotation(directionToPlayer); - } - else if (target is Vector3 position) - { - forwardOrigin = position + Vector3.forward * distance; - Vector3 directionToPosition = forwardOrigin - position; - directionToPosition.y = 0; - rotation = Quaternion.LookRotation(directionToPosition); - } - else if (target is Room room) - { - forwardOrigin = room.Position + Vector3.up * 2f; - Vector3 directionToRoom = forwardOrigin - room.Position; - directionToRoom.y = 0; - rotation = Quaternion.LookRotation(directionToRoom); - } - else - { - Log.Debug("Invalid object type. Valid types: Player, Vector3, Room"); - yield break; - } - - Vector3 offset = new Vector3((targetWidth * scale) / 2f, (targetHeight * scale) / 2f, 0); - - for (int x = 0; x < targetWidth; x++) - { - for (int y = 0; y < targetHeight; y++) - { - Color pixelColor = scaled.GetPixel(x, y); - if (pixelColor.a < 0.1f) - continue; - - Vector3 localOffset = new Vector3(x * scale, y * scale, 0) - offset; - Vector3 worldPos = forwardOrigin + rotation * localOffset; - - Primitive quad = Primitive.Create(PrimitiveType.Quad); - quad.Position = worldPos; - quad.Scale = new Vector3(scale, scale, scale * 0.01f); - quad.Color = pixelColor; - - Quaternion fixedRotation = Quaternion.Euler(0f, rotation.eulerAngles.y, 0f); - quad.Rotation = fixedRotation; - quad.Flags = AdminToys.PrimitiveFlags.Visible; - } - - yield return Timing.WaitForOneFrame; - } - } - - } -} diff --git a/KruacentExiled/utils-merged/KE.Utilsmap/API/Interfaces/IEvents.cs b/KruacentExiled/utils-merged/KE.Utilsmap/API/Interfaces/IEvents.cs deleted file mode 100644 index e573b062..00000000 --- a/KruacentExiled/utils-merged/KE.Utilsmap/API/Interfaces/IEvents.cs +++ /dev/null @@ -1,17 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace KE.Utils.API.Interfaces -{ - public interface IUsingEvents - { - - - public void SubscribeEvents(); - - public void UnsubscribeEvents(); - } -} diff --git a/KruacentExiled/utils-merged/KE.Utilsmap/API/Interfaces/ILoadable.cs b/KruacentExiled/utils-merged/KE.Utilsmap/API/Interfaces/ILoadable.cs deleted file mode 100644 index c9e00399..00000000 --- a/KruacentExiled/utils-merged/KE.Utilsmap/API/Interfaces/ILoadable.cs +++ /dev/null @@ -1,13 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace KE.Utils.API.Interfaces -{ - public interface ILoadable - { - public string Loadable(char separator); - } -} diff --git a/KruacentExiled/utils-merged/KE.Utilsmap/API/Models/Arrows/Arrow.cs b/KruacentExiled/utils-merged/KE.Utilsmap/API/Models/Arrows/Arrow.cs deleted file mode 100644 index 990999c7..00000000 --- a/KruacentExiled/utils-merged/KE.Utilsmap/API/Models/Arrows/Arrow.cs +++ /dev/null @@ -1,58 +0,0 @@ -using Exiled.API.Features.Toys; -using InventorySystem.Items.Keycards; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Net.Sockets; -using System.Text; -using System.Threading.Tasks; -using UnityEngine; - -namespace KE.Utils.API.Models.Arrows -{ - internal abstract class Arrow - { - internal static HashSet List = new(); - internal abstract Vector3 Offset { get; } - internal abstract Vector3 Rotation { get; } - internal abstract Color Color { get; } - - protected readonly Vector3 scale = new Vector3(1f, .1f, .1f); - - private Primitive _primitive; - - internal Primitive Primitive - { - get { return _primitive; } - } - internal Arrow() - { - List.Add(this); - _primitive = Primitive.Create(PrimitiveType.Cube, null, Rotation, scale); - _primitive.Color = Color; - } - - internal void Move(Vector3 newPos) - { - _primitive.Position = newPos + Offset; - } - - internal static bool IsPrimitiveArrow(Primitive p) - { - Arrow a =GetArrow(p); - return a != null; - } - - internal static Arrow GetArrow(Primitive p) - { - - foreach(Arrow a in List) - { - if (p == a.Primitive) - return a; - } - return null; - - } - } -} diff --git a/KruacentExiled/utils-merged/KE.Utilsmap/API/Models/Arrows/MoveArrow.cs b/KruacentExiled/utils-merged/KE.Utilsmap/API/Models/Arrows/MoveArrow.cs deleted file mode 100644 index f3216e7f..00000000 --- a/KruacentExiled/utils-merged/KE.Utilsmap/API/Models/Arrows/MoveArrow.cs +++ /dev/null @@ -1,12 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace KE.Utils.API.Models.Arrows -{ - internal class MoveArrow - { - } -} diff --git a/KruacentExiled/utils-merged/KE.Utilsmap/API/Models/Arrows/RotateArrow.cs b/KruacentExiled/utils-merged/KE.Utilsmap/API/Models/Arrows/RotateArrow.cs deleted file mode 100644 index 518fb4b5..00000000 --- a/KruacentExiled/utils-merged/KE.Utilsmap/API/Models/Arrows/RotateArrow.cs +++ /dev/null @@ -1,12 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace KE.Utils.API.Models.Arrows -{ - internal class RotateArrow - { - } -} diff --git a/KruacentExiled/utils-merged/KE.Utilsmap/API/Models/Arrows/ScaleArrow.cs b/KruacentExiled/utils-merged/KE.Utilsmap/API/Models/Arrows/ScaleArrow.cs deleted file mode 100644 index 99bf7d55..00000000 --- a/KruacentExiled/utils-merged/KE.Utilsmap/API/Models/Arrows/ScaleArrow.cs +++ /dev/null @@ -1,12 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace KE.Utils.API.Models.Arrows -{ - internal class ScaleArrow - { - } -} diff --git a/KruacentExiled/utils-merged/KE.Utilsmap/API/Models/Arrows/XArrow.cs b/KruacentExiled/utils-merged/KE.Utilsmap/API/Models/Arrows/XArrow.cs deleted file mode 100644 index 073802c3..00000000 --- a/KruacentExiled/utils-merged/KE.Utilsmap/API/Models/Arrows/XArrow.cs +++ /dev/null @@ -1,16 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using UnityEngine; - -namespace KE.Utils.API.Models.Arrows -{ - internal class XArrow : Arrow - { - internal override Vector3 Offset => new Vector3(scale.x / 2,0); - internal override Vector3 Rotation => new Vector3(0, 0f, 0f); - internal override Color Color => Color.red; - } -} diff --git a/KruacentExiled/utils-merged/KE.Utilsmap/API/Models/Arrows/YArrow.cs b/KruacentExiled/utils-merged/KE.Utilsmap/API/Models/Arrows/YArrow.cs deleted file mode 100644 index e437766e..00000000 --- a/KruacentExiled/utils-merged/KE.Utilsmap/API/Models/Arrows/YArrow.cs +++ /dev/null @@ -1,16 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using UnityEngine; - -namespace KE.Utils.API.Models.Arrows -{ - internal class YArrow : Arrow - { - internal override Vector3 Offset => new Vector3(0, scale.x / 2); - internal override Vector3 Rotation => new Vector3(0, 0f, 90f); - internal override Color Color => Color.green; - } -} diff --git a/KruacentExiled/utils-merged/KE.Utilsmap/API/Models/Arrows/ZArrow.cs b/KruacentExiled/utils-merged/KE.Utilsmap/API/Models/Arrows/ZArrow.cs deleted file mode 100644 index 30c27866..00000000 --- a/KruacentExiled/utils-merged/KE.Utilsmap/API/Models/Arrows/ZArrow.cs +++ /dev/null @@ -1,16 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using UnityEngine; - -namespace KE.Utils.API.Models.Arrows -{ - internal class ZArrow : Arrow - { - internal override Vector3 Offset => new Vector3(0,0, scale.x / 2); - internal override Vector3 Rotation => new Vector3(0, 90f, 0); - internal override Color Color => Color.blue; - } -} diff --git a/KruacentExiled/utils-merged/KE.Utilsmap/API/Models/Blueprints/AdminToyBlueprint.cs b/KruacentExiled/utils-merged/KE.Utilsmap/API/Models/Blueprints/AdminToyBlueprint.cs deleted file mode 100644 index ccfcff3d..00000000 --- a/KruacentExiled/utils-merged/KE.Utilsmap/API/Models/Blueprints/AdminToyBlueprint.cs +++ /dev/null @@ -1,69 +0,0 @@ -using Exiled.API.Enums; -using Exiled.API.Features.Toys; -using Exiled.API.Interfaces; -using KE.Utils.API.Interfaces; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using UnityEngine; -using Light = Exiled.API.Features.Toys.Light; - -namespace KE.Utils.API.Models.Blueprints -{ - public abstract class AdminToyBlueprint : ILoadable - { - public AdminToyType AdminToyType { get; protected set; } - //local position - public Vector3 Position { get; protected set; } - public Vector3 Rotation { get; protected set; } - public Vector3 Scale { get; protected set; } - - - public static AdminToyBlueprint Create(AdminToy adminToy, Vector3? center = null) - { - AdminToyBlueprint result; - - - if (adminToy.ToyType == AdminToyType.PrimitiveObject) - { - result = new PrimitiveBlueprint(adminToy as Primitive); - - } - else if(adminToy.ToyType == AdminToyType.LightSource) - { - result = new LightBlueprint(adminToy as Light); - } - else - { - throw new NotImplementedException("only primitive and light"); - } - - result.Position = adminToy.Position - center ?? adminToy.Position; - result.Rotation = adminToy.Rotation.eulerAngles; - - return result; - } - - - public string Loadable(char separator) - { - StringBuilder b = new(); - b.Append(AdminToyType.ToString()); - b.Append(separator); - b.Append(Position); - b.Append(separator); - b.Append(Rotation); - b.Append(separator); - b.Append(Scale); - b.Append(separator); - b.Append(Load(separator)); - - - return b.ToString(); - } - public abstract AdminToy Spawn(Vector3 center); - protected abstract string Load(char separator); - } -} diff --git a/KruacentExiled/utils-merged/KE.Utilsmap/API/Models/Blueprints/LightBlueprint.cs b/KruacentExiled/utils-merged/KE.Utilsmap/API/Models/Blueprints/LightBlueprint.cs deleted file mode 100644 index 1dc91294..00000000 --- a/KruacentExiled/utils-merged/KE.Utilsmap/API/Models/Blueprints/LightBlueprint.cs +++ /dev/null @@ -1,37 +0,0 @@ -using Exiled.API.Enums; -using Exiled.API.Features.Toys; -using UnityEngine; -using Light = Exiled.API.Features.Toys.Light; - -namespace KE.Utils.API.Models.Blueprints -{ - public class LightBlueprint : AdminToyBlueprint - { - public Color Color { get; } - public float Intensity { get; } - - public LightBlueprint(Light l) - { - AdminToyType = AdminToyType.PrimitiveObject; - Scale = l.Scale; - Color = l.Color; - Intensity = l.Intensity; - } - - - public override AdminToy Spawn(Vector3 center) - { - var l = Light.Create(Position+center, Rotation, Scale, false); - l.Color = Color; - l.Intensity = Intensity; - - - return l; - } - - protected override string Load(char separator) - { - return "#" + ColorUtility.ToHtmlStringRGBA(Color) + separator + Intensity; - } - } -} diff --git a/KruacentExiled/utils-merged/KE.Utilsmap/API/Models/Blueprints/ModelBlueprint.cs b/KruacentExiled/utils-merged/KE.Utilsmap/API/Models/Blueprints/ModelBlueprint.cs deleted file mode 100644 index 0f3a047c..00000000 --- a/KruacentExiled/utils-merged/KE.Utilsmap/API/Models/Blueprints/ModelBlueprint.cs +++ /dev/null @@ -1,110 +0,0 @@ -using Exiled.API.Features; -using Exiled.API.Features.Core; -using Exiled.API.Features.Doors; -using Exiled.API.Features.Toys; -using Exiled.API.Structs; -using KE.Utils.API.Models.ToysSettings; -using KE.Utils.Quality.Models; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Runtime.InteropServices; -using UnityEngine; -using Light = Exiled.API.Features.Toys.Light; - -namespace KE.Utils.API.Models.Blueprints -{ - public class ModelBlueprint - { - private static List _bps = new(); - public static List Blueprints => _bps.ToList(); - private HashSet _toys = new(); - public IReadOnlyCollection Toys => [.. _toys]; - private string _name; - public string Name - { - get { return _name; } - } - - private ModelBlueprint() { } - - - - /// - /// - /// - /// - /// - public static ModelBlueprint Create(Model model) - { - var oldMbp = Get(model.Name); - _bps.Remove(oldMbp); - - - ModelBlueprint mbp = new(); - mbp._name = model.Name; - _bps.Add(mbp); - - foreach(AdminToy toy in model.Toys) - { - mbp._toys.Add(AdminToyBlueprint.Create(toy,model.Center)); - } - - return mbp; - } - - - public static ModelBlueprint Create(string name,IEnumerable toys = null) - { - ModelBlueprint mbp = new(); - _bps.Add(mbp); - - if (string.IsNullOrEmpty(name)) - { - throw new ArgumentException("name null or empty"); - } - - if(toys != null) - { - foreach(AdminToy at in toys) - { - mbp._toys.Add(AdminToyBlueprint.Create(at)); - } - } - - - - mbp._name = name; - - return mbp; - } - - public void Spawn(Vector3 position) - { - Model m = Model.Create(this, position,false); - - - } - - - #region getters - public static ModelBlueprint Get(string name) - { - foreach (ModelBlueprint m in Blueprints) - { - if (m.Name == name) - { - return m; - } - } - return null; - } - - public static bool TryGet(string name, out ModelBlueprint model) - { - model = Get(name); - return model != null; - } - #endregion - } -} diff --git a/KruacentExiled/utils-merged/KE.Utilsmap/API/Models/Blueprints/PrimitiveBlueprint.cs b/KruacentExiled/utils-merged/KE.Utilsmap/API/Models/Blueprints/PrimitiveBlueprint.cs deleted file mode 100644 index 2e59f30a..00000000 --- a/KruacentExiled/utils-merged/KE.Utilsmap/API/Models/Blueprints/PrimitiveBlueprint.cs +++ /dev/null @@ -1,39 +0,0 @@ -using Exiled.API.Enums; -using Exiled.API.Features.Toys; -using UnityEngine; - -namespace KE.Utils.API.Models.Blueprints -{ - public class PrimitiveBlueprint : AdminToyBlueprint - { - public Color Color { get; } - public PrimitiveType Type { get; } - - - public PrimitiveBlueprint(Primitive p) - { - AdminToyType = AdminToyType.PrimitiveObject; - - Scale = p.Scale; - Color = p.Color; - Type = p.Type; - } - - - - public override AdminToy Spawn(Vector3 center) - { - var p = Primitive.Create(Type,Position+center, Rotation, Scale, false); - p.Collidable = false; - p.Color = Color; - - - return p; - } - - protected override string Load(char separator) - { - return "#" + ColorUtility.ToHtmlStringRGBA(Color) + separator+Type; - } - } -} diff --git a/KruacentExiled/utils-merged/KE.Utilsmap/API/Models/Commands/AllCommands.cs b/KruacentExiled/utils-merged/KE.Utilsmap/API/Models/Commands/AllCommands.cs deleted file mode 100644 index 8ba12e68..00000000 --- a/KruacentExiled/utils-merged/KE.Utilsmap/API/Models/Commands/AllCommands.cs +++ /dev/null @@ -1,33 +0,0 @@ -using CommandSystem; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Reflection; -using System.Text; -using System.Threading.Tasks; - -namespace KE.Utils.API.Models.Commands -{ - public static class AllCommands - { - - public static IEnumerable Get(Assembly assembly = null) - { - return new List() - { - new ChangeColor(), - new ChangePrimType(), - new CreateModel(), - new CreatePrim(), - new ListModel(), - new LoadModel(), - new ModeMovePrim(), - new SelectModel(), - new ShowCenter(), - new SaveModel() - - }; - - } - } -} diff --git a/KruacentExiled/utils-merged/KE.Utilsmap/API/Models/Commands/ChangeColor.cs b/KruacentExiled/utils-merged/KE.Utilsmap/API/Models/Commands/ChangeColor.cs deleted file mode 100644 index 3b78d218..00000000 --- a/KruacentExiled/utils-merged/KE.Utilsmap/API/Models/Commands/ChangeColor.cs +++ /dev/null @@ -1,72 +0,0 @@ -using CommandSystem; -using Exiled.API.Features; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using KE.Utils.API.Models; -using UnityEngine; -using Exiled.API.Features.Toys; - -namespace KE.Utils.API.Models.Commands -{ - public class ChangeColor : ICommand - { - - public string Command { get; } = "changecolor"; - - public string[] Aliases { get; } = { "cc" }; - - public string Description { get; } = "change color rgba (0-255)"; - - public bool Execute(ArraySegment arguments, ICommandSender sender, out string response) - { - Player p = Player.Get(sender); - if (p == null) - { - response = "This player can't do this command"; - return false; - } - - if (arguments.Count < 3) - { - response = "not enough arguments"; - return false; - } - if(!byte.TryParse(arguments.At(0),out byte r) || - !byte.TryParse(arguments.At(1), out byte g) || - !byte.TryParse(arguments.At(2), out byte b)) - { - response = "number between 0 & 255"; - return false; - } - - Color32 c; - - if(arguments.Count > 3 && byte.TryParse(arguments.At(3),out byte a)) - { - c = new Color32(r, g, b, a); - } - else - { - c = new Color32(r, g, b,255); - } - - Primitive prim = Models.Instance.ModelCreator.ModelHandler.SelectedPrimitive; - - if(prim == null) - { - response = "no primitive selected"; - return false; - } - - prim.Color = c; - - - response = $"new color set to " + c.ToString(); - return true; - } - - } -} diff --git a/KruacentExiled/utils-merged/KE.Utilsmap/API/Models/Commands/ChangePrimType.cs b/KruacentExiled/utils-merged/KE.Utilsmap/API/Models/Commands/ChangePrimType.cs deleted file mode 100644 index 434427df..00000000 --- a/KruacentExiled/utils-merged/KE.Utilsmap/API/Models/Commands/ChangePrimType.cs +++ /dev/null @@ -1,53 +0,0 @@ -using CommandSystem; -using Exiled.API.Features; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using KE.Utils.API.Models; -using UnityEngine; - -namespace KE.Utils.API.Models.Commands -{ - public class ChangePrimType : ICommand - { - - public string Command { get; } = "changeprimtype"; - - public string[] Aliases { get; } = { "cpt" }; - - public string Description { get; } = "select the mode : scale,move,rotate"; - - public bool Execute(ArraySegment arguments, ICommandSender sender, out string response) - { - Player p = Player.Get(sender); - if (p == null) - { - response = "This player can't do this command"; - return false; - } - - if (arguments.Count < 1) - { - response = "not enough arguments"; - return false; - } - string type = arguments.At(0); - - - if(!Enum.TryParse(type, out PrimitiveType prim)) - { - response = "wrong argument"; - return false; - } - - - Models.Instance.ModelCreator.ModelHandler.SelectedPrimitive.Type = prim; - - response = $"Mode set to " + prim ; - return true; - } - - } -} diff --git a/KruacentExiled/utils-merged/KE.Utilsmap/API/Models/Commands/CreateModel.cs b/KruacentExiled/utils-merged/KE.Utilsmap/API/Models/Commands/CreateModel.cs deleted file mode 100644 index d549cb50..00000000 --- a/KruacentExiled/utils-merged/KE.Utilsmap/API/Models/Commands/CreateModel.cs +++ /dev/null @@ -1,44 +0,0 @@ -using CommandSystem; -using Exiled.API.Features; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace KE.Utils.API.Models.Commands -{ - public class CreateModel : ICommand - { - - public string Command { get; } = "create"; - - public string[] Aliases { get; } = { "c" }; - - public string Description { get; } = "create a new model at your position"; - - public bool Execute(ArraySegment arguments, ICommandSender sender, out string response) - { - - Player p = Player.Get(sender); - if (p == null) - { - response = "This player can't do this command"; - return false; - } - - if (arguments.Count < 1) - { - response = "not enough arguments"; - return false; - } - string name = arguments.At(0); - - Model m = Model.Create(p.Position, name); - Models.Instance.ModelCreator.ModelHandler.SelectedModel = m; - response = $"Created & selected model ({m.Name}) at {m.Center}"; - return true; - } - - } -} diff --git a/KruacentExiled/utils-merged/KE.Utilsmap/API/Models/Commands/CreatePrim.cs b/KruacentExiled/utils-merged/KE.Utilsmap/API/Models/Commands/CreatePrim.cs deleted file mode 100644 index edcd6306..00000000 --- a/KruacentExiled/utils-merged/KE.Utilsmap/API/Models/Commands/CreatePrim.cs +++ /dev/null @@ -1,47 +0,0 @@ -using CommandSystem; -using Exiled.API.Features; -using Exiled.API.Features.Toys; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace KE.Utils.API.Models.Commands -{ - public class CreatePrim : ICommand - { - - public string Command { get; } = "createprimitive"; - - public string[] Aliases { get; } = { "cp" }; //no not like that - - public string Description { get; } = "create a new primitive at your position"; - - public bool Execute(ArraySegment arguments, ICommandSender sender, out string response) - { - - Player p = Player.Get(sender); - if (p == null) - { - response = "This player can't do this command"; - return false; - } - - - Model m = Models.Instance.ModelCreator.SelectedModel; - - if (m == null) - { - response = "no model selected"; - return false; - } - m.Add(p.Position); - - - response = "created!"; - return true; - } - - } -} diff --git a/KruacentExiled/utils-merged/KE.Utilsmap/API/Models/Commands/ListModel.cs b/KruacentExiled/utils-merged/KE.Utilsmap/API/Models/Commands/ListModel.cs deleted file mode 100644 index 79f42597..00000000 --- a/KruacentExiled/utils-merged/KE.Utilsmap/API/Models/Commands/ListModel.cs +++ /dev/null @@ -1,42 +0,0 @@ -using CommandSystem; -using Exiled.API.Features; -using KE.Utils.API.Models.Blueprints; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace KE.Utils.API.Models.Commands -{ - public class ListModel : ICommand - { - - public string Command { get; } = "list"; - - public string[] Aliases { get; } = { "l" }; - - public string Description { get; } = "create a new model at your position"; - - public bool Execute(ArraySegment arguments, ICommandSender sender, out string response) - { - StringBuilder b = new(); - b.AppendLine($"Models ({Model.Models.Count}) :"); - foreach (Model m in Model.Models) - { - b.AppendLine($"{m.Name} pos: {m.Center} spawned? :{m.Spawned}"); - } - - b.AppendLine($"Blueprints ({ModelBlueprint.Blueprints.Count}) :"); - foreach (ModelBlueprint m in ModelBlueprint.Blueprints) - { - b.AppendLine($"{m.Name}"); - } - - - response = b.ToString(); - return true; - } - - } -} diff --git a/KruacentExiled/utils-merged/KE.Utilsmap/API/Models/Commands/LoadModel.cs b/KruacentExiled/utils-merged/KE.Utilsmap/API/Models/Commands/LoadModel.cs deleted file mode 100644 index 7be25565..00000000 --- a/KruacentExiled/utils-merged/KE.Utilsmap/API/Models/Commands/LoadModel.cs +++ /dev/null @@ -1,65 +0,0 @@ -using CommandSystem; -using Exiled.API.Features; -using KE.Utils.API.Models.Blueprints; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using System.Xml.Linq; - -namespace KE.Utils.API.Models.Commands -{ - public class LoadModel : ICommand - { - - public string Command { get; } = "load"; - - public string[] Aliases { get; } = { "lo" }; - - public string Description { get; } = "load a model from a blueprint"; - - public bool Execute(ArraySegment arguments, ICommandSender sender, out string response) - { - - Player p = Player.Get(sender); - if (p == null) - { - response = "This player can't do this command"; - return false; - } - - if (arguments.Count < 1) - { - response = "not enough arguments"; - return false; - } - - string name = arguments.At(0); - - if (string.IsNullOrEmpty(name)) - { - response = "name null or empty"; - return false; - } - - foreach(ModelBlueprint bp in ModelBlueprint.Blueprints) - { - - Log.Info($"{bp.Name} == {name} : {bp.Name == name}"); - } - - - if(!ModelBlueprint.TryGet(name,out var mbp)) - { - response = "blueprint not found"; - return false; - } - - mbp.Spawn(p.Position); - response = $"Created model ({mbp.Name}) at {p.Position}"; - return true; - } - - } -} diff --git a/KruacentExiled/utils-merged/KE.Utilsmap/API/Models/Commands/ModeMovePrim.cs b/KruacentExiled/utils-merged/KE.Utilsmap/API/Models/Commands/ModeMovePrim.cs deleted file mode 100644 index 2b9ea091..00000000 --- a/KruacentExiled/utils-merged/KE.Utilsmap/API/Models/Commands/ModeMovePrim.cs +++ /dev/null @@ -1,64 +0,0 @@ -using CommandSystem; -using Exiled.API.Features; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using KE.Utils.API.Models; - -namespace KE.Utils.API.Models.Commands -{ - public class ModeMovePrim : ICommand - { - - public string Command { get; } = "mode"; - - public string[] Aliases { get; } = { "m" }; - - public string Description { get; } = "select the mode : scale,move,rotate"; - - public bool Execute(ArraySegment arguments, ICommandSender sender, out string response) - { - Player p = Player.Get(sender); - if (p == null) - { - response = "This player can't do this command"; - return false; - } - - if (arguments.Count < 1) - { - response = "not enough arguments"; - return false; - } - string mode = arguments.At(0); - - switch(mode) - { - case "m": - case "move": - Models.Instance.ModelCreator.MovementMode = MovementMode.Move; - break; - case "s": - case "scale": - Models.Instance.ModelCreator.MovementMode = MovementMode.Scale; - break; - case "r": - case "rotate": - Models.Instance.ModelCreator.MovementMode = MovementMode.Rotate; - break; - default: - response = "wrong argument"; - return false; - - - } - - - response = $"Mode set to " + Models.Instance.ModelCreator.MovementMode.ToString(); - return true; - } - - } -} diff --git a/KruacentExiled/utils-merged/KE.Utilsmap/API/Models/Commands/SaveModel.cs b/KruacentExiled/utils-merged/KE.Utilsmap/API/Models/Commands/SaveModel.cs deleted file mode 100644 index d40048e5..00000000 --- a/KruacentExiled/utils-merged/KE.Utilsmap/API/Models/Commands/SaveModel.cs +++ /dev/null @@ -1,47 +0,0 @@ -using CommandSystem; -using Exiled.API.Features; -using KE.Utils.API.Models.Blueprints; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using System.Xml.Linq; - -namespace KE.Utils.API.Models.Commands -{ - public class SaveModel : ICommand - { - - public string Command { get; } = "save"; - - public string[] Aliases { get; } = { "sa" }; - - public string Description { get; } = "save a model to file"; - - public bool Execute(ArraySegment arguments, ICommandSender sender, out string response) - { - - Player p = Player.Get(sender); - if (p == null) - { - response = "This player can't do this command"; - return false; - } - - - Model model = Models.Instance.ModelCreator.SelectedModel; - if (model == null) - { - response = "no model selected"; - return false; - } - - model.Save(); - - response = $"Saved ({model.Name})"; - return true; - } - - } -} diff --git a/KruacentExiled/utils-merged/KE.Utilsmap/API/Models/Commands/SelectModel.cs b/KruacentExiled/utils-merged/KE.Utilsmap/API/Models/Commands/SelectModel.cs deleted file mode 100644 index 266ce4d4..00000000 --- a/KruacentExiled/utils-merged/KE.Utilsmap/API/Models/Commands/SelectModel.cs +++ /dev/null @@ -1,56 +0,0 @@ -using CommandSystem; -using Exiled.API.Features; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace KE.Utils.API.Models.Commands -{ - public class SelectModel : ICommand - { - - public string Command { get; } = "select"; - - public string[] Aliases { get; } = { "s" }; - - public string Description { get; } = "select an existing model"; - - public bool Execute(ArraySegment arguments, ICommandSender sender, out string response) - { - - Player p = Player.Get(sender); - if (p == null) - { - response = "This player can't do this command"; - return false; - } - if (arguments.Count < 1) - { - response = "not enough arguments"; - return false; - } - string name = arguments.At(0); - - if (string.IsNullOrEmpty(name)) - { - response = "name null or empty"; - return false; - } - - - - - if (!Model.TryGet(name, out Model m)) - { - response = "model not found"; - return false; - } - response = $"model ({m.Name}) selected {m.Center}"; - Models.Instance.ModelCreator.ModelHandler.SelectedModel = m; - return true; - } - - } -} diff --git a/KruacentExiled/utils-merged/KE.Utilsmap/API/Models/Commands/ShowCenter.cs b/KruacentExiled/utils-merged/KE.Utilsmap/API/Models/Commands/ShowCenter.cs deleted file mode 100644 index 7b6cc05e..00000000 --- a/KruacentExiled/utils-merged/KE.Utilsmap/API/Models/Commands/ShowCenter.cs +++ /dev/null @@ -1,51 +0,0 @@ -using CommandSystem; -using Exiled.API.Features; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace KE.Utils.API.Models.Commands -{ - public class ShowCenter : ICommand - { - - public string Command { get; } = "show"; - - public string[] Aliases { get; } = { "sh" }; - - public string Description { get; } = "toggle the center of the model"; - - public bool Execute(ArraySegment arguments, ICommandSender sender, out string response) - { - - Player p = Player.Get(sender); - if (p == null) - { - response = "This player can't do this command"; - return false; - } - - Model m = Models.Instance.ModelCreator.ModelHandler.SelectedModel; - - if(m == null) - { - response = "no model selected"; - return false; - } - - if(!bool.TryParse(arguments.At(0),out bool result)) - { - response = "write true or false"; - return false; - } - - m.SetCenterPrimitive(result); - - response = "done"; - - return true; - } - } -} diff --git a/KruacentExiled/utils-merged/KE.Utilsmap/API/Models/Model.cs b/KruacentExiled/utils-merged/KE.Utilsmap/API/Models/Model.cs deleted file mode 100644 index 6e84fbc9..00000000 --- a/KruacentExiled/utils-merged/KE.Utilsmap/API/Models/Model.cs +++ /dev/null @@ -1,202 +0,0 @@ -using Exiled.API.Features; -using Exiled.API.Features.Toys; -using KE.Utils.API.Models.Blueprints; -using System; -using System.Collections.Generic; -using System.Linq; -using UnityEngine; - -namespace KE.Utils.API.Models -{ - public class Model - { - private static List _models = new(); - public static List Models => _models.ToList(); - - private HashSet _toys = new(); - public IReadOnlyCollection Toys => [.. _toys]; - private string _name; - public string Name - { - get { return _name; } - } - - private Vector3 _center; - public Vector3 Center - { - get { return _center; } - } - private bool _spawned = true; - public bool Spawned - { - get { return _spawned; } - } - - private ModelBlueprint _blueprint; - - public ModelBlueprint Blueprint - { - get { return _blueprint; } - } - - public bool LoadedFromBlueprint - { - get - { - return Blueprint != null; - } - } - - - - - - internal Primitive centerPrim; - - public void SetCenterPrimitive(bool show) - { - if (show) - { - centerPrim.Spawn(); - } - else - { - centerPrim.UnSpawn(); - } - } - - - - public Primitive Add(Vector3 pos) - { - var p = Primitive.Create(pos, null, null, true); - - AddToy(p); - return p; - } - - - protected virtual void AddToy(AdminToy toy,bool editMode = true) - { - if(toy is Primitive p && editMode) - { - p.Collidable = true; - } - - - _toys.Add(toy); - } - - private Model(Vector3 center) - { - _models.Add(this); - _center = center; - } - - public static Model Create(Vector3 position, string name) - { - - Model m = new(position); - if (string.IsNullOrEmpty(name)) - { - throw new ArgumentException("name null or empty"); - } - m._name = name; - - Log.Debug("created model id=" + m.Name); - m.centerPrim = Primitive.Create(position, null, Vector3.one / 5, true, new(1, 0, 0, .25f)); - m.centerPrim.Collidable = false; - - return m; - } - - - public static Model Create(ModelBlueprint blueprint,Vector3 position,bool editMode = false) - { - Model m = new(position); - m._name = blueprint.Name; - - foreach (AdminToyBlueprint toy in blueprint.Toys) - { - Log.Info("create toy "+toy.AdminToyType); - AdminToy trueToy = toy.Spawn(m.Center); - - - m.AddToy(trueToy, editMode); - - } - - return m; - - } - - /// - /// Create a based of this

- /// Note : will overwrite the old blueprint - ///
- public void CreateBlueprint() - { - ModelBlueprint bp = ModelBlueprint.Create(this); - - _blueprint = bp; - - } - - - #region getter - public static Model Get(string name) - { - foreach (Model m in _models) - { - if (m.Name == name) - { - return m; - } - } - return null; - } - - public static bool TryGet(string name, out Model model) - { - model = Get(name); - return model != null; - } - - - public override string ToString() - { - return $"{Name} center = {Center}"; - } - #endregion - - #region spawn - public void Spawn() - { - foreach (AdminToy t in Toys) - { - t.Spawn(); - } - _spawned = true; - } - public void UnSpawn() - { - foreach (AdminToy t in Toys) - { - t.UnSpawn(); - } - _spawned = false; - } - - public void Destroy() - { - foreach (AdminToy t in Toys) - { - t.Destroy(); - } - _models.Remove(this); - - } - - #endregion - } -} diff --git a/KruacentExiled/utils-merged/KE.Utilsmap/API/Models/ModelCreator.cs b/KruacentExiled/utils-merged/KE.Utilsmap/API/Models/ModelCreator.cs deleted file mode 100644 index 85758ad9..00000000 --- a/KruacentExiled/utils-merged/KE.Utilsmap/API/Models/ModelCreator.cs +++ /dev/null @@ -1,175 +0,0 @@ -using AdminToys; -using Exiled.API.Features; -using Exiled.API.Features.Items; -using Exiled.API.Features.Toys; -using Exiled.Events.EventArgs.Player; -using KE.Utils.API.Interfaces; -using KE.Utils.API.Models.Arrows; -using MEC; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Runtime.InteropServices; -using System.Text; -using System.Threading.Tasks; -using UnityEngine; - -namespace KE.Utils.API.Models -{ - public class ModelCreator : IUsingEvents - { - - - public const ItemType item = ItemType.GunCOM18; - - public Model SelectedModel - { - get - { - return ModelHandler.SelectedModel; - } - } - public MovementMode MovementMode - { - get - { - return MovementHandler.Mode; - } - set - { - MovementHandler.Mode = value; - } - } - internal MovementHandler MovementHandler { get; private set; } - internal ModelSelection ModelHandler { get; private set; } - - private bool mode = false; - private const float MAX_DISTANCE = 50; - - public static event Action IsAiming; - public static event Action StoppedAiming; - - - - public ModelCreator() - { - - } - - public void SubscribeEvents() - { - - ModelHandler = new(); - MovementHandler = new(); - - ModelLoader.LoadAll(); - MovementHandler.SubscribeEvents(); - Exiled.Events.Handlers.Player.DryfiringWeapon += OnDryfiringWeapon; - Exiled.Events.Handlers.Player.TogglingWeaponFlashlight += OnTogglingWeaponFlashlight; - Exiled.Events.Handlers.Server.RoundStarted += Test; - Exiled.Events.Handlers.Player.AimingDownSight += OnAimingDownSight; - - } - public void UnsubscribeEvents() - { - Exiled.Events.Handlers.Player.DryfiringWeapon -= OnDryfiringWeapon; - Exiled.Events.Handlers.Player.TogglingWeaponFlashlight -= OnTogglingWeaponFlashlight; - Exiled.Events.Handlers.Player.AimingDownSight -= OnAimingDownSight; - Exiled.Events.Handlers.Server.RoundStarted -= Test; - MovementHandler.UnsubscribeEvents(); - - ModelHandler = null; - MovementHandler = null; - } - - private void Test() - { - foreach (var p in Player.List) - { - p.Role.Set(PlayerRoles.RoleTypeId.ChaosConscript); - Timing.CallDelayed(.1f, () => - { - var a = p.AddItem(item); - var b = a as Firearm; - b.MagazineAmmo = 2; - - Primitive.Create(p.Position + Vector3.back, null, null, true, Color.red); - Primitive.Create(p.Position + Vector3.forward, null, null, true, Color.green); - }); - } - } - - - - - private void OnAimingDownSight(AimingDownSightEventArgs ev) - { - if (ev.AdsIn) - { - IsAiming?.Invoke(ev.Player); - } - else - { - StoppedAiming?.Invoke(); - } - } - - private void OnDryfiringWeapon(DryfiringWeaponEventArgs ev) - { - if (ev.Firearm.Type != item) return; - Log.Info("new mode = " + mode); - - if (!mode) - { - - mode = !mode; - } - - - - } - - private void OnTogglingWeaponFlashlight(TogglingWeaponFlashlightEventArgs ev) - { - if (ev.Firearm.Type != item) return; - - - - Primitive p = GetFacingPrimitive(ev.Player); - if (!Arrow.IsPrimitiveArrow(p)) - { - ModelHandler.ChangedSelectedPrim(p); - } - - } - - internal static Primitive GetFacingPrimitive(Player player) - { - Transform cam = player.CameraTransform; - - Vector3 origin = cam.position + cam.forward * 0.5f; - Ray r = new Ray(origin, cam.forward); - if (Physics.Raycast(r, out RaycastHit hit, MAX_DISTANCE)) - { - Log.Info($"hit ({hit.collider.name})"); - PrimitiveObjectToy pot = hit.collider.GetComponentInParent() ?? hit.collider.GetComponentInChildren(); - if (pot != null) - { - return Primitive.Get(pot); - - - } - } - return null; - } - - - - } - public enum MovementMode - { - Move, - Scale, - Rotate - } -} diff --git a/KruacentExiled/utils-merged/KE.Utilsmap/API/Models/ModelLoader.cs b/KruacentExiled/utils-merged/KE.Utilsmap/API/Models/ModelLoader.cs deleted file mode 100644 index d4c60464..00000000 --- a/KruacentExiled/utils-merged/KE.Utilsmap/API/Models/ModelLoader.cs +++ /dev/null @@ -1,152 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.IO; -using Exiled.API.Features; -using Exiled.API.Features.Toys; -using UnityEngine; -using Light = Exiled.API.Features.Toys.Light; -using Exiled.API.Enums; -using KE.Utils.API.Models.Blueprints; -namespace KE.Utils.API.Models -{ - public static class ModelLoader - { - public static string Path => Paths.Configs + @"\"; - private static readonly char SEPARATOR = '_'; - public static string Extension => ".modelscpsl"; - - - public static IEnumerable LoadAll() - { - List m = new(); - - string[] raw = Directory.GetFiles(Path, "*" + Extension); - - foreach (string d in raw) - { - Log.Info("loading="+d); - ModelBlueprint mbp = Load(string.Empty, d); - if(mbp != null) - { - Log.Info($"loaded {mbp.Name} ({mbp.Toys.Count})"); - m.Add(mbp); - } - - } - - return m; - } - - public static ModelBlueprint Load(string filename) - { - return Load(Path, filename); - } - - public static ModelBlueprint Load(string path,string filename) - { - string[] raw; - try - { - raw = File.ReadAllText(path + filename).Split('\n'); - } - catch(Exception e) - { - Log.Error(e); - return null; - } - - - string[] infoline = raw[0].Split(SEPARATOR); - string name = infoline[0]; - List toys = new(); - - - for (int i = 1; i < raw.Length; i++) - { - string[] line = raw[i].Split(SEPARATOR); - AdminToy toy = null; - AdminToyType type; - if (!Enum.TryParse(line[0], out type)) continue; - - Vector3 ATPos = Parser.Vector3(line[1]); - Vector3 ATRotation = Parser.Vector3(line[2]); - Vector3 ATScale = Parser.Vector3(line[3]); - if(type == AdminToyType.PrimitiveObject) - { - Color color; - ColorUtility.TryParseHtmlString(line[4], out color); - PrimitiveType ptype; - Enum.TryParse(line[5], out ptype); - - - var p = Primitive.Create(ptype, ATPos, ATRotation, ATScale, true, color); - p.Collidable = false; - toy = p; - - } - if(type == AdminToyType.LightSource) - { - Color color; - ColorUtility.TryParseHtmlString(line[4], out color); - - float intensity = float.Parse(line[5]); - var l = Light.Create(ATPos, ATRotation, ATScale, true, color); - l.Intensity = intensity; - toy = l; - } - - if (toy == null) continue; - toys.Add(toy); - - } - - - - - return ModelBlueprint.Create(name, toys); - } - - - // Name\n - // Primitive.Position.RotationEuler.Scale.Color.PrimitiveType\n - // Light.Position.RotationEuler.Scale.Color.Intensity\n - // and repeat - public static bool Save(this ModelBlueprint m) - { - - List result = new(); - - result.Add(m.Name+SEPARATOR); - - foreach(AdminToyBlueprint t in m.Toys) - { - result.Add(t.Loadable(SEPARATOR)); - } - - try - { - File.WriteAllLines(Path + m.Name+ Extension, result); - return true; - } - catch(Exception e) - { - Log.Error(e); - return false; - } - - } - - public static bool Save(this Model model) - { - if (!model.LoadedFromBlueprint) - model.CreateBlueprint(); - - - return Save(model.Blueprint); - } - - - } -} diff --git a/KruacentExiled/utils-merged/KE.Utilsmap/API/Models/Models.cs b/KruacentExiled/utils-merged/KE.Utilsmap/API/Models/Models.cs deleted file mode 100644 index 27fe3cf4..00000000 --- a/KruacentExiled/utils-merged/KE.Utilsmap/API/Models/Models.cs +++ /dev/null @@ -1,47 +0,0 @@ -using KE.Utils.API.Interfaces; -using PlayerRoles.FirstPersonControl.Thirdperson; - -namespace KE.Utils.API.Models -{ - public class Models : IUsingEvents - { - public ModelCreator ModelCreator - { - get; - private set; - } - private static Models _instance; - - - public static Models Instance - { - get - { - if (_instance == null) - _instance = new(); - return _instance; - } - } - - public void DestroyInstance() - { - _instance = null; - } - - private Models() - { - ModelCreator = new(); - } - - - public void SubscribeEvents() - { - ModelCreator.SubscribeEvents(); - } - - public void UnsubscribeEvents() - { - ModelCreator.UnsubscribeEvents(); - } - } -} diff --git a/KruacentExiled/utils-merged/KE.Utilsmap/API/Models/MovementHandler.cs b/KruacentExiled/utils-merged/KE.Utilsmap/API/Models/MovementHandler.cs deleted file mode 100644 index 07e3ee18..00000000 --- a/KruacentExiled/utils-merged/KE.Utilsmap/API/Models/MovementHandler.cs +++ /dev/null @@ -1,208 +0,0 @@ -using Exiled.API.Features; -using Exiled.API.Features.Toys; -using Exiled.Events.EventArgs.Player; -using KE.Utils.API.Interfaces; -using KE.Utils.API.Models.Arrows; -using MEC; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using UnityEngine; - -namespace KE.Utils.API.Models -{ - internal class MovementHandler : IUsingEvents - { - - private MovementMode _mode = MovementMode.Move; - - public MovementMode Mode - { - get - { - return _mode; - } - set - { - OnChangingMode?.Invoke(value); - _mode = value; - } - } - public static event Action OnChangingMode; - - - - //xyz - private Arrow[] _arrows = new Arrow[3]; - private bool _primflag = false; - public readonly static float REFRESH_RATE = Timing.WaitForOneFrame; - - private CoroutineHandle _handle; - private bool _aiming = false; - private void TryCreatePrimitives() - { - if (!_primflag) - { - _arrows[0] = new XArrow(); - _arrows[1] = new YArrow(); - _arrows[2] = new ZArrow(); - _primflag = true; - } - } - - - - - public void SubscribeEvents() - { - ModelCreator.IsAiming += IsAiming; - ModelCreator.StoppedAiming += StoppedAiming; - ModelSelection.OnChangedSelection += OnChangedSelection; - ModelSelection.OnUnSelect += OnUnSelect; - } - - public void UnsubscribeEvents() - { - Timing.KillCoroutines(_handle); - - ModelSelection.OnChangedSelection -= OnChangedSelection; - ModelSelection.OnUnSelect -= OnUnSelect; - } - private void OnUnSelect() - { - foreach (Arrow a in Arrow.List) - { - a.Move(Vector3.zero); - } - } - private void OnChangedSelection(Primitive p) - { - Log.Info("ChangedSelection"); - TryCreatePrimitives(); - foreach (Arrow a in Arrow.List) - { - a.Move(p.Position); - } - - } - - - private void IsAiming(Player p) - { - Log.Info("start aim"); - var prim = ModelCreator.GetFacingPrimitive(p); - if (!Arrow.IsPrimitiveArrow(prim)) return; - - _aiming = true; - _handle = Timing.RunCoroutine(Moving(p,prim)); - } - - private void StoppedAiming() - { - Log.Info("stopped aim"); - _aiming = false; - } - - - - private IEnumerator Moving(Player player,Primitive p) - { - Primitive selected = Models.Instance.ModelCreator.ModelHandler.SelectedPrimitive; - Vector3 pos = selected.Position; - Vector3 targetPos = pos; - Vector3 scale = selected.Scale; - Vector3 tScale = scale; - - - - Vector3 oldEuler = player.CameraTransform.rotation.eulerAngles; - Arrow a = Arrow.GetArrow(p); - List otherArrows = Arrow.List.Where(o => o != a).ToList(); - - Vector3 direction = a.Offset.normalized; - float sensitivity = 0.1f; - float smoothSpeed = 5; - - while (_aiming) - { - Vector3 currentEuler = player.CameraTransform.rotation.eulerAngles; - - float deltaYaw = Mathf.DeltaAngle(oldEuler.y, currentEuler.y); - float deltaPitch = Mathf.DeltaAngle(oldEuler.x, currentEuler.x); - - float movementAmount = 0f; - - if (Mathf.Abs(direction.y) > 0.5f) - { - movementAmount = -deltaPitch * sensitivity; - } - else - { - - Vector3 camRight = player.CameraTransform.right; - - float sign = Mathf.Sign(Vector3.Dot(camRight, direction)); - - movementAmount = deltaYaw * sensitivity * sign; - } - - - - - if(Mode == MovementMode.Move) - { - targetPos += direction.normalized * movementAmount; - pos = Vector3.Lerp(pos, targetPos, Time.deltaTime * smoothSpeed); - p.Position = pos; - selected.Position = pos - a.Offset; - foreach (Arrow arrow in otherArrows) - { - arrow.Move(pos - a.Offset); - } - } - - - - if(Mode == MovementMode.Scale) - { - Vector3 previousParallel = direction.normalized * Vector3.Dot(selected.Scale, direction.normalized); - Vector3 dir = direction.normalized; - - float currentLengthInDir = Vector3.Dot(scale, dir); - - float newLengthInDir = Mathf.Clamp(currentLengthInDir + movementAmount, 0.1f, 10f); - - - Vector3 parallel = dir * newLengthInDir; - Vector3 perpendicular = scale - (dir * currentLengthInDir); - - selected.Scale = parallel + perpendicular; - scale = selected.Scale; - - Vector3 deltaParallel = parallel - previousParallel; - a.Primitive.Position += deltaParallel / 2; - previousParallel = parallel; - } - - - - if(Mode == MovementMode.Rotate) - { - Log.Info("no clue how to do that"); - } - - - - - - oldEuler = currentEuler; - yield return REFRESH_RATE; - } - } - - - - } -} diff --git a/KruacentExiled/utils-merged/KE.Utilsmap/API/Models/SelectedModel.cs b/KruacentExiled/utils-merged/KE.Utilsmap/API/Models/SelectedModel.cs deleted file mode 100644 index 7e502f46..00000000 --- a/KruacentExiled/utils-merged/KE.Utilsmap/API/Models/SelectedModel.cs +++ /dev/null @@ -1,52 +0,0 @@ -using Exiled.API.Features; -using Exiled.API.Features.Toys; -using MEC; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using UnityEngine; - -namespace KE.Utils.API.Models -{ - internal class ModelSelection - { - - - - public Model SelectedModel { get; internal set; } - public Primitive SelectedPrimitive; - - public static event Action OnChangedSelection; - public static event Action OnUnSelect; - - public void ChangedSelectedPrim(Primitive newPrim) - { - if (newPrim == null) return; - - - - Log.Info(SelectedPrimitive == null); - Log.Info(newPrim.GameObject.GetInstanceID() != SelectedPrimitive?.GameObject.GetInstanceID()); - - if (SelectedPrimitive == null || newPrim.GameObject.GetInstanceID() != SelectedPrimitive?.GameObject.GetInstanceID()) - { - Log.Info("selecting"); - OnChangedSelection?.Invoke(newPrim); - SelectedPrimitive = newPrim; - } - else - { - Log.Info("unselecting"); - SelectedPrimitive = null; - OnUnSelect?.Invoke(); - } - - } - - - - - } -} diff --git a/KruacentExiled/utils-merged/KE.Utilsmap/API/Models/ToysSettings/PrimitiveSetting.cs b/KruacentExiled/utils-merged/KE.Utilsmap/API/Models/ToysSettings/PrimitiveSetting.cs deleted file mode 100644 index b3ffe31d..00000000 --- a/KruacentExiled/utils-merged/KE.Utilsmap/API/Models/ToysSettings/PrimitiveSetting.cs +++ /dev/null @@ -1,31 +0,0 @@ -using AdminToys; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using UnityEngine; - -namespace KE.Utils.API.Models.ToysSettings -{ - public class PrimitiveSetting : ToySetting - { - - public PrimitiveType PrimitiveType { get; } - - - public PrimitiveFlags Flags { get; } - - - public Color Color { get; } - - public Vector3 Position { get; } - - - public Vector3 Rotation { get; } - - - public Vector3 Scale { get; } - - } -} diff --git a/KruacentExiled/utils-merged/KE.Utilsmap/API/Models/ToysSettings/ToySetting.cs b/KruacentExiled/utils-merged/KE.Utilsmap/API/Models/ToysSettings/ToySetting.cs deleted file mode 100644 index 8fdc4477..00000000 --- a/KruacentExiled/utils-merged/KE.Utilsmap/API/Models/ToysSettings/ToySetting.cs +++ /dev/null @@ -1,20 +0,0 @@ -using Exiled.API.Features.Toys; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace KE.Utils.API.Models.ToysSettings -{ - public abstract class ToySetting - { - - - - public virtual void Create(AdminToy a) - { - - } - } -} diff --git a/KruacentExiled/utils-merged/KE.Utilsmap/API/OtherUtils.cs b/KruacentExiled/utils-merged/KE.Utilsmap/API/OtherUtils.cs deleted file mode 100644 index ef43b888..00000000 --- a/KruacentExiled/utils-merged/KE.Utilsmap/API/OtherUtils.cs +++ /dev/null @@ -1,18 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using UnityEngine; - -namespace KE.Utils.API -{ - public static class OtherUtils - { - - public static bool IsInCircle(Vector3 pos,Vector3 centerCircle,float radius) - { - return (pos-centerCircle).sqrMagnitude <= Math.Pow(radius, 2); - } - } -} diff --git a/KruacentExiled/utils-merged/KE.Utilsmap/API/Parser.cs b/KruacentExiled/utils-merged/KE.Utilsmap/API/Parser.cs deleted file mode 100644 index a924337f..00000000 --- a/KruacentExiled/utils-merged/KE.Utilsmap/API/Parser.cs +++ /dev/null @@ -1,36 +0,0 @@ -using Exiled.API.Features; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using UnityEngine; - -namespace KE.Utils.API -{ - public static class Parser - { - public static Vector3 Vector3(string s) - { - string[] temp = s.Substring(1, s.Length - 3).Split(','); - - if(!float.TryParse(temp[0],out float x)) - { - return UnityEngine.Vector3.zero; - } - - if (!float.TryParse(temp[1], out float y)) - { - return UnityEngine.Vector3.zero; - } - if (!float.TryParse(temp[1], out float z)) - { - return UnityEngine.Vector3.zero; - } - - - - return new Vector3(x, y, z); - } - } -} diff --git a/KruacentExiled/utils-merged/KE.Utilsmap/API/Sounds/SoundPlayer.cs b/KruacentExiled/utils-merged/KE.Utilsmap/API/Sounds/SoundPlayer.cs deleted file mode 100644 index 19f0c310..00000000 --- a/KruacentExiled/utils-merged/KE.Utilsmap/API/Sounds/SoundPlayer.cs +++ /dev/null @@ -1,112 +0,0 @@ -using Exiled.API.Features; -using System; -using System.Collections.Generic; -using System.IO; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using UnityEngine; - -namespace KE.Utils.API.Sounds -{ - public class SoundPlayer - { - private static SoundPlayer _instance; - - public static SoundPlayer Instance - { - get - { - if(_instance == null) - { - _instance = new(); - } - return _instance; - } - } - - private SoundPlayer() { } - - private bool _loaded = false; - public bool Loaded => _loaded; - - - public static string SoundLocation => Paths.Configs + "/Sounds"; - public static void Load() => Instance.TryLoad(); - public void TryLoad() - { - if (Loaded) - { - return; - } - - if (!Directory.Exists(SoundLocation)) - { - Log.Warn("Directory not found. creating..."); - Directory.CreateDirectory(SoundLocation); - } - - string[] rawfile = Directory.GetFiles(SoundLocation, "*.ogg"); - - foreach (string file in rawfile) - { - string noExFile = Path.GetFileNameWithoutExtension(file); - Log.Info($"loading {file} as {noExFile}"); - AudioClipStorage.LoadClip(file); - } - _loaded = true; - } - - - /// - /// Play a clip at a static point - /// - /// - /// - /// - /// - public void Play(string clipName, Vector3 pos, float volume = 50f, float maxDistance = 20f, bool isSpatial = true) - { - if (!Loaded) throw new Exception("clips not loaded use SoundPlayer.Load()"); - Log.Debug($"playing {clipName} at {pos}"); - - var audioPlayer = AudioPlayer.CreateOrGet($"{clipName} ({pos})", onIntialCreation: (p) => - { - GameObject a = new GameObject(); - a.transform.position = pos; - p.transform.parent = a.transform; - Speaker speaker = p.AddSpeaker("main", isSpatial: isSpatial, maxDistance: maxDistance, minDistance: 1f); - speaker.transform.parent = a.transform; - speaker.transform.localPosition = Vector3.zero; - }); - - audioPlayer.AddClip(clipName, volume: volume); - audioPlayer.DestroyWhenAllClipsPlayed = true; - - } - - /// - /// Play a clip at a - /// - /// - /// - /// - /// - public void Play(string clipName, GameObject objectEmittingSound, float volume = 50f, float maxDistance = 20f, bool isSpatial = true) - { - if (!Loaded) throw new Exception("clips not loaded use SoundPlayer.Instance.Load()"); - Log.Debug($"playing {clipName} at {objectEmittingSound}"); - - var audioPlayer = AudioPlayer.CreateOrGet($"{clipName} ({objectEmittingSound})", onIntialCreation: (p) => - { - - p.transform.parent = objectEmittingSound.transform; - Speaker speaker = p.AddSpeaker("main", isSpatial: isSpatial, maxDistance: maxDistance, minDistance: 1f); - speaker.transform.parent = objectEmittingSound.transform; - speaker.transform.localPosition = Vector3.zero; - }); - audioPlayer.AddClip(clipName, volume: volume); - audioPlayer.DestroyWhenAllClipsPlayed = true; - } - } -} diff --git a/KruacentExiled/utils-merged/KE.Utilsmap/Extensions/AdminToyExtension.cs b/KruacentExiled/utils-merged/KE.Utilsmap/Extensions/AdminToyExtension.cs deleted file mode 100644 index 37c3706d..00000000 --- a/KruacentExiled/utils-merged/KE.Utilsmap/Extensions/AdminToyExtension.cs +++ /dev/null @@ -1,25 +0,0 @@ -using Exiled.API.Features.Toys; -using KE.Utils.Quality; -using KE.Utils.Quality.Enums; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace KE.Utils.Extensions -{ - public static class AdminToyExtension - { - - public static void SetAsPickupAdminToy(this AdminToy toy, bool autoSync = true) - { - QualityHandler.Instance.QualityToysHandler.SetAsPickup(toy); - } - - public static void SetQuality(this AdminToy toy, ModelQuality modelQuality,bool autoSync = true) - { - QualityHandler.Instance.QualityToysHandler.SetQuality(toy, modelQuality); - } - } -} diff --git a/KruacentExiled/utils-merged/KE.Utilsmap/Extensions/NpcExtension.cs b/KruacentExiled/utils-merged/KE.Utilsmap/Extensions/NpcExtension.cs deleted file mode 100644 index 6af07bc5..00000000 --- a/KruacentExiled/utils-merged/KE.Utilsmap/Extensions/NpcExtension.cs +++ /dev/null @@ -1,23 +0,0 @@ -using CentralAuth; -using Exiled.API.Features; -using Mirror; -using PlayerRoles; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace KE.Utils.Extensions -{ - public static class NpcExtension - { - - - public static void Hide(this Npc npc) - { - npc.ReferenceHub.authManager.NetworkSyncedUserId = "ID_Dedicated"; - npc.ReferenceHub.authManager.syncMode = (SyncMode)ClientInstanceMode.DedicatedServer; - } - } -} diff --git a/KruacentExiled/utils-merged/KE.Utilsmap/Extensions/PlayerExtension.cs b/KruacentExiled/utils-merged/KE.Utilsmap/Extensions/PlayerExtension.cs deleted file mode 100644 index b01f98d2..00000000 --- a/KruacentExiled/utils-merged/KE.Utilsmap/Extensions/PlayerExtension.cs +++ /dev/null @@ -1,52 +0,0 @@ -using CustomPlayerEffects; -using Exiled.API.Enums; -using Exiled.API.Features; -using Mirror; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using UnityEngine; - -namespace KE.Utils.Extensions -{ - public static class PlayerExtension - { - public static void SetFakeInvis(this Player p, IEnumerable viewers) - { - Vector3 pos = p.Position; - - try - { - p.ReferenceHub.transform.localPosition = Vector3.zero; - foreach (Player viewer in viewers) - { - Server.SendSpawnMessage.Invoke(null, new object[2] { viewer.NetworkIdentity, viewer.Connection }); - } - - p.ReferenceHub.transform.localPosition = pos; - } - catch (Exception arg) - { - Log.Error(string.Format("{0}: {1}", "SetFakeInvis", arg)); - } - } - - - - - public static void AddLevelEffect(this Player p,EffectType type, int intensity) - { - - - if (!p.TryGetEffect(type, out var effect)) - p.ChangeEffectIntensity(type, (byte)(effect.Intensity + intensity)); - else - p.EnableEffect(type, (byte)intensity); - } - - - - } -} diff --git a/KruacentExiled/utils-merged/KE.Utilsmap/Extensions/RoomExtension.cs b/KruacentExiled/utils-merged/KE.Utilsmap/Extensions/RoomExtension.cs deleted file mode 100644 index 35fee2e8..00000000 --- a/KruacentExiled/utils-merged/KE.Utilsmap/Extensions/RoomExtension.cs +++ /dev/null @@ -1,12 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace KE.Utils.Extensions -{ - internal class RoomExtension - { - } -} diff --git a/KruacentExiled/utils-merged/KE.Utilsmap/KE.Utils.csproj b/KruacentExiled/utils-merged/KE.Utilsmap/KE.Utils.csproj deleted file mode 100644 index aee2e596..00000000 --- a/KruacentExiled/utils-merged/KE.Utilsmap/KE.Utils.csproj +++ /dev/null @@ -1,37 +0,0 @@ - - - - 13.0 - net48 - - - - - - - - - - - - - - - - - - - - - - - - - if not "$(EXILED_DEV_REFERENCES)"=="" copy /y "$(OutputPath)$(AssemblyName).dll" "$(EXILED_DEV_REFERENCES)\Plugins\" - - - if [[ ! -z "$EXILED_DEV_REFERENCES" ]]; then cp "$(OutputPath)$(AssemblyName).dll" "$EXILED_DEV_REFERENCES/Plugins/"; fi - - - - diff --git a/KruacentExiled/utils-merged/KE.Utilsmap/Quality/Enums/ModelQuality.cs b/KruacentExiled/utils-merged/KE.Utilsmap/Quality/Enums/ModelQuality.cs deleted file mode 100644 index d9d8d295..00000000 --- a/KruacentExiled/utils-merged/KE.Utilsmap/Quality/Enums/ModelQuality.cs +++ /dev/null @@ -1,16 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace KE.Utils.Quality.Enums -{ - public enum ModelQuality - { - None = -1, - Low, - Medium, - High, - } -} diff --git a/KruacentExiled/utils-merged/KE.Utilsmap/Quality/Handlers/QualityToysHandler.cs b/KruacentExiled/utils-merged/KE.Utilsmap/Quality/Handlers/QualityToysHandler.cs deleted file mode 100644 index b2485795..00000000 --- a/KruacentExiled/utils-merged/KE.Utilsmap/Quality/Handlers/QualityToysHandler.cs +++ /dev/null @@ -1,179 +0,0 @@ -using AdminToys; -using Exiled.API.Enums; -using Exiled.API.Extensions; -using Exiled.API.Features; -using Exiled.API.Features.Toys; -using KE.Utils.Quality.Enums; -using KE.Utils.Quality.Settings; -using MEC; -using System; -using System.Collections.Generic; -using System.Linq; -using UnityEngine; -using Light = Exiled.API.Features.Toys.Light; -using QualitySettings = KE.Utils.Quality.Settings.QualitySettings; - -namespace KE.Utils.Quality.Handlers -{ - public class QualityToysHandler - { - private HashSet _pickupToys = new(); - private Dictionary _qualityToys = new(); - public readonly Vector3 Gulag = new Vector3(15000, 15000, 15000); - public const float Delay = Timing.WaitForOneFrame; - public bool IsPickupToy(AdminToy primitive) - { - return _pickupToys.Contains(primitive); - } - - public bool IsQualityToy(AdminToy primitive) - { - return _qualityToys.ContainsKey(primitive); - } - - - public void SetAsPickup(AdminToy toy, bool autoSync = true) - { - if (!_pickupToys.Add(toy)) - { - Log.Warn($"AdminToy {toy} is already a pickupToy"); - return; - } - if (autoSync) - Sync(toy); - } - - public void SetQuality(AdminToy toy, ModelQuality quality, bool autoSync = true) - { - if (toy == null) return; - if (!_qualityToys.ContainsKey(toy)) - _qualityToys.Add(toy, quality); - else - _qualityToys[toy] = quality; - - if (autoSync) - Sync(toy); - } - - - - private void SendToFakePosition(AdminToy adminToy, Player player,Vector3 position) - { - //idk why but without delay it show all of the quality at once - Timing.CallDelayed(Delay, () => - { - if (adminToy is Light l) - { - player.SendFakeSyncVar(l.Base.netIdentity, typeof(LightSourceToy), nameof(LightSourceToy.NetworkPosition), position); - return; - } - if (adminToy is Primitive p) - { - player.SendFakeSyncVar(p.Base.netIdentity, typeof(PrimitiveObjectToy), nameof(PrimitiveObjectToy.NetworkPosition), position); - return; - } - }); - - } - - /// - /// Sync every Players - /// - public void Sync() - { - foreach (Player p in Player.List) - { - Sync(p); - } - } - - /// - /// Sync a specified Player - /// - /// - public void Sync(Player p) - { - - - - var quality = QualitySettings.Get(p); - var pickup = QualitySettings.PickmodelActivated(p); - - HashSet pickupToRemove = []; - HashSet qualityToRemove = []; - - //hide pickup toys - - foreach (AdminToy pk in _pickupToys) - { - try - { - if (pickup) - { - SendToFakePosition(pk, p, pk.Position); - } - else - { - SendToFakePosition(pk, p, Gulag); - } - } - catch (NullReferenceException) - { - //Log.Warn("removing pickup"); - pickupToRemove.Add(pk); - } - - } - - _pickupToys.RemoveWhere(p => pickupToRemove.Contains(p)); - - - foreach (var at in _qualityToys) - { - try - { - if ((at.Value == quality || at.Value == ModelQuality.None) && (pickup || !_pickupToys.Contains(at.Key))) - { - SendToFakePosition(at.Key, p, at.Key.Position); - } - else - { - SendToFakePosition(at.Key, p, Gulag); - } - } - catch (NullReferenceException) - { - //Log.Warn("removing quality" + _qualityToys.Count); - qualityToRemove.Add(at.Key); - } - - - } - foreach(var at in qualityToRemove) - { - - _qualityToys.Remove(at); - } - - } - - /// - /// Sync a specified AdminToy - /// - /// - public void Sync(AdminToy adminToy) - { - //temporary fix - Sync(); - - if (IsPickupToy(adminToy)) - { - - } - if (IsQualityToy(adminToy)) - { - - } - } - } -} diff --git a/KruacentExiled/utils-merged/KE.Utilsmap/Quality/Models/Base/BaseModel.cs b/KruacentExiled/utils-merged/KE.Utilsmap/Quality/Models/Base/BaseModel.cs deleted file mode 100644 index c9f6723c..00000000 --- a/KruacentExiled/utils-merged/KE.Utilsmap/Quality/Models/Base/BaseModel.cs +++ /dev/null @@ -1,41 +0,0 @@ -using Exiled.API.Enums; -using Exiled.API.Extensions; -using Exiled.API.Features.Toys; -using Exiled.API.Interfaces; -using KE.Utils.Quality.Structs; -using PlayerStatsSystem; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using UnityEngine; -using Light = Exiled.API.Features.Toys.Light; - -namespace KE.Utils.Quality.Models.Base -{ - - /// - /// The blocks to build a model with - /// - public abstract class BaseModel : ICloneable - { - - protected AdminToy _toy; - public AdminToy AdminToy { get { return _toy; } } - private Vector3 _position; - public Vector3 LocalPosition { get { return _position; } } - private Quaternion _rotation; - public Quaternion LocalRotation { get { return _rotation; } } - - - public BaseModel(Vector3 localPositon, Quaternion localRotation) - { - _position = localPositon; - _rotation = localRotation; - } - - public abstract object Clone(); - } - -} diff --git a/KruacentExiled/utils-merged/KE.Utilsmap/Quality/Models/Base/LightModel.cs b/KruacentExiled/utils-merged/KE.Utilsmap/Quality/Models/Base/LightModel.cs deleted file mode 100644 index ce808da1..00000000 --- a/KruacentExiled/utils-merged/KE.Utilsmap/Quality/Models/Base/LightModel.cs +++ /dev/null @@ -1,26 +0,0 @@ -using Exiled.API.Features.Toys; -using UnityEngine; -using Light = Exiled.API.Features.Toys.Light; - -namespace KE.Utils.Quality.Models.Base -{ - public class LightModel : BaseModel - { - - /// - /// Create a new Light for modeling - /// - public LightModel(Vector3? scale, Color? color, Vector3 localPositon, Quaternion localRotation) : base(localPositon, localRotation) - { - Light light = Light.Create(null, null, scale, false, color); - _toy = light; - } - - - public override object Clone() - { - Light light = _toy as Light; - return new LightModel(light.Scale, light.Color, LocalPosition, LocalRotation); - } - } -} diff --git a/KruacentExiled/utils-merged/KE.Utilsmap/Quality/Models/Base/PrimitiveModel.cs b/KruacentExiled/utils-merged/KE.Utilsmap/Quality/Models/Base/PrimitiveModel.cs deleted file mode 100644 index 22e07225..00000000 --- a/KruacentExiled/utils-merged/KE.Utilsmap/Quality/Models/Base/PrimitiveModel.cs +++ /dev/null @@ -1,26 +0,0 @@ -using Exiled.API.Features.Toys; -using UnityEngine; -using Color = UnityEngine.Color; - -namespace KE.Utils.Quality.Models.Base -{ - public class PrimitiveModel : BaseModel - { - /// - /// Create a new Primitive for modeling - /// - public PrimitiveModel(PrimitiveType type, Vector3? scale, Color? color,Vector3 localPosition,Quaternion localRotation) : base(localPosition, localRotation) - { - - Primitive prim = Primitive.Create(type, null, null, scale, false, color); - prim.Collidable = false; - _toy = prim; - } - - public override object Clone() - { - Primitive prim = _toy as Primitive; - return new PrimitiveModel(prim.Type, prim.Scale, prim.Color, LocalPosition, LocalRotation); - } - } -} diff --git a/KruacentExiled/utils-merged/KE.Utilsmap/Quality/Models/Examples/MineModel.cs b/KruacentExiled/utils-merged/KE.Utilsmap/Quality/Models/Examples/MineModel.cs deleted file mode 100644 index 00d60fec..00000000 --- a/KruacentExiled/utils-merged/KE.Utilsmap/Quality/Models/Examples/MineModel.cs +++ /dev/null @@ -1,118 +0,0 @@ -using KE.Utils.Quality.Enums; -using KE.Utils.Quality.Models.Base; -using System.Collections.Generic; -using UnityEngine; -using Light = Exiled.API.Features.Toys.Light; - -namespace KE.Utils.Quality.Models.Examples -{ - public abstract class MineModel : QualityModel - { - protected Light _light; - private bool _lightOn = false; - - - - - public void ToggleLight() - { - if (_light == null) throw new System.Exception("no light"); - if (_lightOn) - _light.UnSpawn(); - else - _light.Spawn(); - _lightOn = !_lightOn; - } - - } - - public class MineModelLow : MineModel - { - public override bool IsPickup => false; - public override ModelQuality Quality => ModelQuality.Low; - - protected override IEnumerable GetBaseModels() - { - Quaternion baseRotation = new(); - //spawn + offset - Vector3 offset = new Vector3(0, .05f); - Vector3 sizeDisk = new Vector3(.7f, 0.1f, .7f); - - Vector3 sizeGlobe = new Vector3(.1f, .1f, .1f); - Vector3 posLight = new Vector3(0, sizeDisk.y+sizeGlobe.y); - - - var baseMine = new PrimitiveModel(PrimitiveType.Cylinder, sizeDisk, Color.black, offset, baseRotation); - - var lightGlobe = new PrimitiveModel(PrimitiveType.Sphere, sizeGlobe , new Color(1, 0, 0, .33f), posLight, baseRotation); - - var lightMine = new LightModel(null, Color.red, posLight, baseRotation); - - _light = lightMine.AdminToy as Light; - _light.Intensity = .55f; - - return [baseMine, lightGlobe, lightMine]; - } - - - } - - public class MineModelMedium : MineModel - { - public override bool IsPickup => false; - public override ModelQuality Quality => ModelQuality.Medium; - - protected override IEnumerable GetBaseModels() - { - Quaternion baseRotation = new(); - //spawn + offset - Vector3 offset = new Vector3(0, .05f); - Vector3 sizeDisk = new Vector3(.7f, 0.1f, .7f); - - Vector3 sizeGlobe = new Vector3(.1f, .1f, .1f); - Vector3 posLight = new Vector3(0, sizeDisk.y + sizeGlobe.y); - - - var baseMine = new PrimitiveModel(PrimitiveType.Cylinder, sizeDisk, Color.black, offset, baseRotation); - - var lightGlobe = new PrimitiveModel(PrimitiveType.Sphere, sizeGlobe, new Color(1, 0, 0, .33f), posLight, baseRotation); - - var lightMine = new LightModel(null, Color.green, posLight, baseRotation); - - _light = lightMine.AdminToy as Light; - _light.Intensity = .55f; - - return [baseMine, lightGlobe, lightMine]; - } - } - - public class MineModelPickup : MineModel - { - public override bool IsPickup => true; - public override ModelQuality Quality => ModelQuality.None; - - - protected override IEnumerable GetBaseModels() - { - Quaternion baseRotation = new(); - //spawn + offset - Vector3 offset = new Vector3(0, .05f); - Vector3 sizeDisk = new Vector3(.7f, 0.1f, .7f); - - Vector3 sizeGlobe = new Vector3(.1f, .1f, .1f); - Vector3 posLight = new Vector3(0, sizeDisk.y + sizeGlobe.y); - - - var baseMine = new PrimitiveModel(PrimitiveType.Cylinder, sizeDisk, Color.black, offset, baseRotation); - - var lightGlobe = new PrimitiveModel(PrimitiveType.Sphere, sizeGlobe, new Color(1, 0, 0, .33f), posLight, baseRotation); - - var lightMine = new LightModel(null, Color.magenta, posLight, baseRotation); - - _light = lightMine.AdminToy as Light; - _light.Intensity = .55f; - - return [baseMine, lightGlobe, lightMine]; - } - } -} diff --git a/KruacentExiled/utils-merged/KE.Utilsmap/Quality/Models/Model.cs b/KruacentExiled/utils-merged/KE.Utilsmap/Quality/Models/Model.cs deleted file mode 100644 index 2e26756e..00000000 --- a/KruacentExiled/utils-merged/KE.Utilsmap/Quality/Models/Model.cs +++ /dev/null @@ -1,104 +0,0 @@ -using Exiled.API.Features; -using Exiled.API.Features.Toys; -using KE.Utils.Quality.Models.Base; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using UnityEngine; - -namespace KE.Utils.Quality.Models -{ - public class Model : IEquatable - { - - - private Vector3 _position; - public Vector3 Position - { - get { return _position; } - set - { - _position = value; - } - } - private Quaternion _rotation; - public Quaternion Rotation - { - get { return _rotation; } - set - { - _rotation = value; - } - } - private ModelPrefab _prefab; - public ModelPrefab Prefab - { - get { return _prefab; } - } - - - - private HashSet _models; - - internal Model(ModelPrefab prefab, Vector3 position, Quaternion rotation,IEnumerable toys,bool spawn) - { - _prefab = prefab; - Position = position; - Rotation = rotation; - _models = new HashSet(toys); - QualityHandler.Instance.QualityToysHandler.Sync(); - - foreach (BaseModel based in toys) - { - AdminToy toy = based.AdminToy; - - if (toy is Primitive p) - p.Collidable = false; - toy.AdminToyBase.transform.position = based.LocalPosition + Position; - toy.AdminToyBase.transform.rotation = based.LocalRotation * Rotation; - } - if(spawn) - { - Spawn(); - } - } - - - public void Destroy() - { - foreach (BaseModel primitive in _models) - { - primitive.AdminToy.Destroy(); - } - } - public void UnSpawn() - { - foreach (BaseModel primitive in _models) - { - primitive.AdminToy.UnSpawn(); - } - } - public void Spawn() - { - QualityHandler.Instance.QualityToysHandler.Sync(); - foreach (BaseModel primitive in _models) - { - primitive.AdminToy.Spawn(); - } - - } - - - public bool Equals(Model x) - { - if (x == null) return false; - return x._prefab == _prefab && x.Position == Position && x.Rotation == Rotation; - } - public int GetHashCode(Model obj) - { - return obj.GetHashCode(); - } - } -} diff --git a/KruacentExiled/utils-merged/KE.Utilsmap/Quality/Models/ModelPrefab.cs b/KruacentExiled/utils-merged/KE.Utilsmap/Quality/Models/ModelPrefab.cs deleted file mode 100644 index bbc39da4..00000000 --- a/KruacentExiled/utils-merged/KE.Utilsmap/Quality/Models/ModelPrefab.cs +++ /dev/null @@ -1,42 +0,0 @@ -using Exiled.API.Features; -using Exiled.API.Features.Core; -using Exiled.API.Features.Pickups; -using Exiled.API.Features.Toys; -using Exiled.API.Interfaces; -using KE.Utils.Extensions; -using KE.Utils.Quality.Models.Base; -using KE.Utils.Quality.Structs; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using UnityEngine; -using Light = Exiled.API.Features.Toys.Light; - -namespace KE.Utils.Quality.Models -{ - public abstract class ModelPrefab - { - - protected abstract IEnumerable GetBaseModels(); - - public virtual Model Create(Vector3 position,Quaternion rotation, bool spawn = true) - { - - HashSet clonetoys = new(); - HashSet toys = GetBaseModels().ToHashSet(); - foreach (BaseModel model in toys) - { - BaseModel clone = (BaseModel)model.Clone(); - clonetoys.Add(clone); - } - return new Model(this, position, rotation, clonetoys,spawn); - - } - - - - - } -} diff --git a/KruacentExiled/utils-merged/KE.Utilsmap/Quality/Models/QualityModel.cs b/KruacentExiled/utils-merged/KE.Utilsmap/Quality/Models/QualityModel.cs deleted file mode 100644 index b5cc682f..00000000 --- a/KruacentExiled/utils-merged/KE.Utilsmap/Quality/Models/QualityModel.cs +++ /dev/null @@ -1,40 +0,0 @@ -using Exiled.API.Features; -using Exiled.API.Features.Toys; -using KE.Utils.Extensions; -using KE.Utils.Quality.Enums; -using KE.Utils.Quality.Models.Base; -using System.Collections.Generic; -using System.Linq; -using UnityEngine; - -namespace KE.Utils.Quality.Models -{ - public abstract class QualityModel : ModelPrefab - { - public abstract ModelQuality Quality { get; } - public abstract bool IsPickup { get; } - - - - - public override sealed Model Create(Vector3 position, Quaternion rotation,bool spawn = true) - { - - HashSet clonetoys = new(); - HashSet toys = GetBaseModels().ToHashSet(); - foreach (BaseModel model in toys) - { - BaseModel clone = (BaseModel)model.Clone(); - - if (IsPickup) - clone.AdminToy.SetAsPickupAdminToy(false); - - clone.AdminToy.SetQuality(Quality,false); - clonetoys.Add(clone); - } - QualityHandler.Sync(); - return new Model(this,position, rotation, clonetoys, spawn); - } - - } -} diff --git a/KruacentExiled/utils-merged/KE.Utilsmap/Quality/QualityHandler.cs b/KruacentExiled/utils-merged/KE.Utilsmap/Quality/QualityHandler.cs deleted file mode 100644 index 235d79c9..00000000 --- a/KruacentExiled/utils-merged/KE.Utilsmap/Quality/QualityHandler.cs +++ /dev/null @@ -1,61 +0,0 @@ -using Exiled.API.Features; -using Exiled.API.Features.Core.UserSettings; -using KE.Utils.Quality.Handlers; -using KE.Utils.Quality.Settings; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace KE.Utils.Quality -{ - [Obsolete("scrapped", false)] - internal class QualityHandler - { - public QualitySettings QualitySettings { get; private set; } - public QualityToysHandler QualityToysHandler { get; private set; } - - private static QualityHandler _instance; - public static QualityHandler Instance - { - get - { - if(_instance == null ) - _instance = new QualityHandler(); - return _instance; - } - } - private QualityHandler() - { - QualitySettings = new QualitySettings(Changed); - QualityToysHandler = new QualityToysHandler(); - } - - ~QualityHandler() - { - QualityToysHandler = null; - QualitySettings = null; - } - - public void Changed(Player p, SettingBase _) - { - QualityToysHandler.Sync(p); - } - - public void Register() - { - QualitySettings.Register(); - } - - public void Unregister() - { - QualitySettings.Unregister(); - } - - public static void Sync() - { - Instance.QualityToysHandler.Sync(); - } - } -} diff --git a/KruacentExiled/utils-merged/KE.Utilsmap/Quality/QualityToysHandler.cs b/KruacentExiled/utils-merged/KE.Utilsmap/Quality/QualityToysHandler.cs deleted file mode 100644 index 27320233..00000000 --- a/KruacentExiled/utils-merged/KE.Utilsmap/Quality/QualityToysHandler.cs +++ /dev/null @@ -1,155 +0,0 @@ -using AdminToys; -using Exiled.API.Enums; -using Exiled.API.Extensions; -using Exiled.API.Features; -using Exiled.API.Features.Toys; -using KE.Utils.Quality.Enums; -using KE.Utils.Quality.Settings; -using System.Collections.Generic; -using System.Linq; -using UnityEngine; -using Light = Exiled.API.Features.Toys.Light; -using QualitySettings = KE.Utils.Quality.Settings.QualitySettings; - -namespace KE.Utils.Quality -{ - public class QualityToysHandler - { - private HashSet _pickupToys = new(); - private Dictionary _qualityToys = new(); - public readonly Vector3 Gulag = new Vector3(15000,15000,15000); - - public bool IsPickupToy(AdminToy primitive) - { - return _pickupToys.Contains(primitive); - } - - public bool IsQualityToy(AdminToy primitive) - { - return _qualityToys.ContainsKey(primitive); - } - - - public void SetAsPickup(AdminToy toy) - { - if (!_pickupToys.Add(toy)) - { - Log.Warn($"AdminToy {toy} is already a pickupToy"); - return; - } - } - - public void SetQuality(AdminToy toy,ModelQuality quality) - { - if (toy == null) return; - if (!_qualityToys.ContainsKey(toy)) - _qualityToys.Add(toy,quality); - else - _qualityToys[toy] = quality; - } - - - - private void SendToShadowRealm(AdminToy adminToy, Player player) - { - if(adminToy is Light l) - { - player.SendFakeSyncVar(l.Base.netIdentity, typeof(LightSourceToy), nameof(LightSourceToy.NetworkPosition), Gulag); - return; - } - if(adminToy is Primitive p) - { - player.SendFakeSyncVar(p.Base.netIdentity, typeof(PrimitiveObjectToy), nameof(PrimitiveObjectToy.NetworkPosition), Gulag); - return; - } - } - - private void SetTruePosition(AdminToy adminToy, Player player) - { - if (adminToy is Light l) - { - player.SendFakeSyncVar(l.Base.netIdentity, typeof(LightSourceToy), nameof(LightSourceToy.NetworkPosition), l.Position); - return; - } - if (adminToy is Primitive p) - { - player.SendFakeSyncVar(p.Base.netIdentity, typeof(PrimitiveObjectToy), nameof(PrimitiveObjectToy.NetworkPosition), p.Position); - return; - } - } - - /// - /// Sync every Players - /// - public void Sync() - { - foreach(Player p in Player.List) - { - Sync(p); - } - } - - /// - /// Sync a specified Player - /// - /// - public void Sync(Player p) - { - var quality = QualitySettings.Get(p); - var pickup = QualitySettings.PickmodelActivated(p); - - if (!pickup) - { - //hide pickup toys - foreach (AdminToy pk in _pickupToys) - { - SendToShadowRealm(pk, p); - } - } - else - { - //show pickup toys - foreach (AdminToy pk in _pickupToys) - { - SetTruePosition(pk, p); - } - } - - - - - foreach(var at in _qualityToys) - { - if(at.Value == quality) - { - if (pickup || !_pickupToys.Contains(at.Key)) - { - SetTruePosition(at.Key, p); - } - } - else - { - SendToShadowRealm(at.Key, p); - } - - } - - } - - /// - /// Sync a specified AdminToy - /// - /// - public void Sync(AdminToy adminToy) - { - if (IsPickupToy(adminToy)) - { - - } - if (IsQualityToy(adminToy)) - { - - } - } - } -} diff --git a/KruacentExiled/utils-merged/KE.Utilsmap/Quality/Settings/QualitySettings.cs b/KruacentExiled/utils-merged/KE.Utilsmap/Quality/Settings/QualitySettings.cs deleted file mode 100644 index ca8d49be..00000000 --- a/KruacentExiled/utils-merged/KE.Utilsmap/Quality/Settings/QualitySettings.cs +++ /dev/null @@ -1,62 +0,0 @@ -using Exiled.API.Features; -using Exiled.API.Features.Core.UserSettings; -using KE.Utils.Quality.Enums; -using System; - -namespace KE.Utils.Quality.Settings -{ - public class QualitySettings - { - - private static int _idQuality = 0; - private static int _idModels = 1; - private static int _idSlider = 2; - private SettingBase[] _settings; - public QualitySettings(Action onChanged) - { - HeaderSetting header = new("Quality Settings"); - _settings = - [ - header, - new DropdownSetting(_idQuality,"ModelQuality",["Low","Medium", "High"],onChanged:onChanged), - new TwoButtonsSetting(_idModels,"Pickup models","Disabled","Enabled", onChanged:onChanged) - ]; - } - - public void Register() - { - SettingBase.Register(_settings); - SettingBase.SendToAll(); - } - - public void Unregister() - { - SettingBase.Unregister(settings:_settings); - } - - - - - public static ModelQuality Get(Player p) - { - if (!SettingBase.TryGetSetting(p, _idQuality, out var setting)) return ModelQuality.None; - - return setting.SelectedOption switch - { - "Low" => ModelQuality.Low, - "Medium" => ModelQuality.Medium, - "High" => ModelQuality.High, - _ => ModelQuality.None, - }; - } - - - public static bool PickmodelActivated(Player p) - { - if (!SettingBase.TryGetSetting(p, _idModels, out var setting)) return false; - return setting.IsSecond; - } - - - } -} diff --git a/KruacentExiled/utils-merged/KE.Utilsmap/Quality/Structs/LocalWorldSpace.cs b/KruacentExiled/utils-merged/KE.Utilsmap/Quality/Structs/LocalWorldSpace.cs deleted file mode 100644 index d9c6205b..00000000 --- a/KruacentExiled/utils-merged/KE.Utilsmap/Quality/Structs/LocalWorldSpace.cs +++ /dev/null @@ -1,23 +0,0 @@ -using Exiled.API.Interfaces; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using UnityEngine; - -namespace KE.Utils.Quality.Structs -{ - public readonly struct LocalWorldSpace : IWorldSpace - { - - public Vector3 Position { get; } - public Quaternion Rotation { get; } - - public LocalWorldSpace(Vector3 position, Quaternion rotation) - { - Position = position; - Rotation = rotation; - } - } -} diff --git a/KruacentExiled/utils-merged/KE.Utilsmap/Quality/Tests/Test.cs b/KruacentExiled/utils-merged/KE.Utilsmap/Quality/Tests/Test.cs deleted file mode 100644 index 6ebd3f66..00000000 --- a/KruacentExiled/utils-merged/KE.Utilsmap/Quality/Tests/Test.cs +++ /dev/null @@ -1,108 +0,0 @@ -using Exiled.API.Extensions; -using Exiled.API.Features; -using Exiled.API.Features.Toys; -using KE.Utils.Quality.Models; -using KE.Utils.Quality.Models.Examples; -using MEC; -using PlayerRoles; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using UnityEngine; - -namespace KE.Utils.Quality.Tests -{ - public class Test - { - private QualityHandler QualityHandler; - - - private Test(QualityHandler q) - { - QualityHandler = q; - try - { - TestMine(); - } - catch (Exception ex) - { - Log.Error("Exception for TestMine :\n"+ex); - } - - } - internal void TestQuality() - { - Vector3 pos = RoleTypeId.Scp049.GetRandomSpawnLocation().Position; - Primitive c = Primitive.Create(pos); - c.Color = Color.red; - Primitive c2 = Primitive.Create(pos + Vector3.one); - c2.Color = Color.green; - - - QualityHandler.QualityToysHandler.SetQuality(c, Enums.ModelQuality.Low); - QualityHandler.QualityToysHandler.SetQuality(c2, Enums.ModelQuality.Medium); - } - - internal void StressTest(int count) - { - Timing.RunCoroutine(Stress(count)); - } - - - private IEnumerator Stress(int count) - { - Vector3 pos = RoleTypeId.Scp049.GetRandomSpawnLocation().Position; - Vector3 scale = new Vector3(.1f, .1f, .1f); - float maxSpread = 5; - for (int i = 0; i < count; i++) - { - Primitive c = Primitive.Create(pos + new Vector3(UnityEngine.Random.Range(0f, maxSpread), UnityEngine.Random.Range(0f, maxSpread), UnityEngine.Random.Range(0f, maxSpread)), scale: scale); - QualityHandler.QualityToysHandler.SetQuality(c, Enums.ModelQuality.Medium); - } - QualityHandler.QualityToysHandler.Sync(); - yield return 0; - } - - public void TestMine() - { - Log.Info("TestMine"); - Vector3 pos = RoleTypeId.Scp049.GetRandomSpawnLocation().Position; - MineModelLow mml = new(); - - - Model m = mml.Create(pos, new Quaternion()); - m.Spawn(); - - - MineModelMedium mmm = new(); - - m = mmm.Create(pos + Vector3.up, new Quaternion()); - m.Spawn(); - - - MineModelPickup mmp = new(); - m = mmp.Create(pos + Vector3.right, new Quaternion()); - m.Spawn(); - - QualityHandler.Sync(); - - - - - - - - - foreach (var item in Player.List) - { - item.Teleport(pos); - } - - - - - } - } -} diff --git a/KruacentExiled/utils-merged/KE.Utilsmisc/API/Displays/DisplayMeow/DisplayHandler.cs b/KruacentExiled/utils-merged/KE.Utilsmisc/API/Displays/DisplayMeow/DisplayHandler.cs deleted file mode 100644 index 4ee13535..00000000 --- a/KruacentExiled/utils-merged/KE.Utilsmisc/API/Displays/DisplayMeow/DisplayHandler.cs +++ /dev/null @@ -1,67 +0,0 @@ -using Exiled.API.Features; -using HintServiceMeow.Core.Extension; -using HintServiceMeow.Core.Models.Hints; -using HintServiceMeow.Core.Utilities; -using MEC; - - -//damn why the same name -using MHint = HintServiceMeow.Core.Models.Hints.Hint; - -namespace KE.Utils.API.Displays.DisplayMeow -{ - public class DisplayHandler - { - public static DisplayHandler Instance { get; } = new(); - - private DisplayHandler() { } - - - - - - - public MHint AddHint(HintPlacement hintPlacement, Player player, string text, float delay) - { - var dis = PlayerDisplay.Get(player); - string id = $"{player.Id}_{hintPlacement.XCoordinate}_{hintPlacement.YCoordinate}"; - MHint hint; - - if (!dis.TryGetHint(id, out var aHint)) - { - hint = new() - { - Text = text, - XCoordinate = hintPlacement.XCoordinate, - YCoordinate = hintPlacement.YCoordinate, - Alignment = hintPlacement.HintAlignment, - Id = id - - }; - dis.AddHint(hint); - - } - else - { - - hint = (MHint)aHint; - hint.Hide = false; - hint.Text = text; - } - - - hint.HideAfter(delay); - return hint; - } - - - - - - - - - - - } -} diff --git a/KruacentExiled/utils-merged/KE.Utilsmisc/API/Displays/DisplayMeow/HintPlacement.cs b/KruacentExiled/utils-merged/KE.Utilsmisc/API/Displays/DisplayMeow/HintPlacement.cs deleted file mode 100644 index 936cdbe9..00000000 --- a/KruacentExiled/utils-merged/KE.Utilsmisc/API/Displays/DisplayMeow/HintPlacement.cs +++ /dev/null @@ -1,31 +0,0 @@ -using HintServiceMeow.Core.Enum; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace KE.Utils.API.Displays.DisplayMeow -{ - public readonly struct HintPlacement : IEquatable - { - public float YCoordinate { get; } - public float XCoordinate { get; } - public HintAlignment HintAlignment { get; } = HintAlignment.Center; - - - public bool Equals(HintPlacement obj) - { - return YCoordinate == obj.YCoordinate && XCoordinate == obj.XCoordinate; - } - - - public HintPlacement(float xCoordinate, float yCoordinate, HintAlignment alignment = HintAlignment.Center) - { - YCoordinate = yCoordinate; - XCoordinate = xCoordinate; - HintAlignment = alignment; - } - - } -} diff --git a/KruacentExiled/utils-merged/KE.Utilsmisc/API/Interfaces/IEvents.cs b/KruacentExiled/utils-merged/KE.Utilsmisc/API/Interfaces/IEvents.cs deleted file mode 100644 index e573b062..00000000 --- a/KruacentExiled/utils-merged/KE.Utilsmisc/API/Interfaces/IEvents.cs +++ /dev/null @@ -1,17 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace KE.Utils.API.Interfaces -{ - public interface IUsingEvents - { - - - public void SubscribeEvents(); - - public void UnsubscribeEvents(); - } -} diff --git a/KruacentExiled/utils-merged/KE.Utilsmisc/API/ReflectionHelper.cs b/KruacentExiled/utils-merged/KE.Utilsmisc/API/ReflectionHelper.cs deleted file mode 100644 index 2f00fbb1..00000000 --- a/KruacentExiled/utils-merged/KE.Utilsmisc/API/ReflectionHelper.cs +++ /dev/null @@ -1,47 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Reflection; -using System.Text; -using System.Threading.Tasks; - -namespace KE.Utils.API -{ - public static class ReflectionHelper - { - public static IEnumerable GetObjects(Assembly assembly = null) - { - List result = new(); - if (assembly == null) - { - assembly = Assembly.GetCallingAssembly(); - } - foreach (Type t in assembly.GetTypes()) - { - try - { - if (typeof(T).IsAssignableFrom(t) && !t.IsAbstract) - { - T ffcc = (T)Activator.CreateInstance(t); - result.Add(ffcc); - } - } - catch (Exception) - { - - } - } - return result; - } - - public static IEnumerable GetObjects(IEnumerable assemblies) - { - List result = new(); - foreach(Assembly assembly in assemblies) - { - result.AddRange(GetObjects(assembly)); - } - return result; - } - } -} diff --git a/KruacentExiled/utils-merged/KE.Utilsmisc/Extensions/AdminToyExtension.cs b/KruacentExiled/utils-merged/KE.Utilsmisc/Extensions/AdminToyExtension.cs deleted file mode 100644 index 5eee9c7b..00000000 --- a/KruacentExiled/utils-merged/KE.Utilsmisc/Extensions/AdminToyExtension.cs +++ /dev/null @@ -1,29 +0,0 @@ -using AdminToys; -using Exiled.API.Features; -using Exiled.API.Features.Toys; -using KE.Utils.Quality; -using KE.Utils.Quality.Enums; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using UnityEngine; - -namespace KE.Utils.Extensions -{ - public static class AdminToyExtension - { - - public static void SetAsPickupAdminToy(this AdminToy toy, bool autoSync = true) - { - QualityHandler.Instance.QualityToysHandler.SetAsPickup(toy); - } - - public static void SetQuality(this AdminToy toy, ModelQuality modelQuality,bool autoSync = true) - { - QualityHandler.Instance.QualityToysHandler.SetQuality(toy, modelQuality); - } - - } -} diff --git a/KruacentExiled/utils-merged/KE.Utilsmisc/Extensions/DoorExtension.cs b/KruacentExiled/utils-merged/KE.Utilsmisc/Extensions/DoorExtension.cs deleted file mode 100644 index 2c8bf677..00000000 --- a/KruacentExiled/utils-merged/KE.Utilsmisc/Extensions/DoorExtension.cs +++ /dev/null @@ -1,14 +0,0 @@ -using Exiled.API.Features; -using Exiled.API.Features.Doors; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace KE.Utils.Extensions -{ - public static class DoorExtension - { - } -} diff --git a/KruacentExiled/utils-merged/KE.Utilsmisc/Extensions/PlayerExtension.cs b/KruacentExiled/utils-merged/KE.Utilsmisc/Extensions/PlayerExtension.cs deleted file mode 100644 index b01f98d2..00000000 --- a/KruacentExiled/utils-merged/KE.Utilsmisc/Extensions/PlayerExtension.cs +++ /dev/null @@ -1,52 +0,0 @@ -using CustomPlayerEffects; -using Exiled.API.Enums; -using Exiled.API.Features; -using Mirror; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using UnityEngine; - -namespace KE.Utils.Extensions -{ - public static class PlayerExtension - { - public static void SetFakeInvis(this Player p, IEnumerable viewers) - { - Vector3 pos = p.Position; - - try - { - p.ReferenceHub.transform.localPosition = Vector3.zero; - foreach (Player viewer in viewers) - { - Server.SendSpawnMessage.Invoke(null, new object[2] { viewer.NetworkIdentity, viewer.Connection }); - } - - p.ReferenceHub.transform.localPosition = pos; - } - catch (Exception arg) - { - Log.Error(string.Format("{0}: {1}", "SetFakeInvis", arg)); - } - } - - - - - public static void AddLevelEffect(this Player p,EffectType type, int intensity) - { - - - if (!p.TryGetEffect(type, out var effect)) - p.ChangeEffectIntensity(type, (byte)(effect.Intensity + intensity)); - else - p.EnableEffect(type, (byte)intensity); - } - - - - } -} diff --git a/KruacentExiled/utils-merged/KE.Utilsmisc/Extensions/RoomExtensions.cs b/KruacentExiled/utils-merged/KE.Utilsmisc/Extensions/RoomExtensions.cs deleted file mode 100644 index 61fd0291..00000000 --- a/KruacentExiled/utils-merged/KE.Utilsmisc/Extensions/RoomExtensions.cs +++ /dev/null @@ -1,55 +0,0 @@ -using Exiled.API.Features; -using Exiled.API.Enums; -using Discord; -using System.Linq; -using Exiled.API.Extensions; - -namespace KE.Utils.Extensions -{ - public static class RoomExtensions - { - - - public static Room RandomSafeRoom(this ZoneType zone) - { - return Room.List.Where(r => r.IsSafe() && r.Zone == zone).GetRandomValue(); - } - - - /// - /// Check if a is Safe (Decontamination,Warhead) - /// - /// Note: Does NOT check if the is safe to teleport in (ex : TestRoom) - /// - /// - /// return true if the is safe for a ; false otherwise - public static bool IsSafe(this Room room) - { - return room.Zone.IsSafe(); - } - - - /// - /// Check if a is Safe (Decontamination,Warhead) - /// - /// return true if the zone is safe for a ; false otherwise - public static bool IsSafe(this ZoneType zone) - { - bool result = true; - if (zone == ZoneType.LightContainment) - result = Map.DecontaminationState < DecontaminationState.Countdown; - switch (zone) - { - case ZoneType.LightContainment: - case ZoneType.HeavyContainment: - case ZoneType.Entrance: - result = !Warhead.IsDetonated; - break; - } - return result; - } - - - - } -} diff --git a/KruacentExiled/utils-merged/KE.Utilsmisc/KE.Utils.csproj b/KruacentExiled/utils-merged/KE.Utilsmisc/KE.Utils.csproj deleted file mode 100644 index cc1affca..00000000 --- a/KruacentExiled/utils-merged/KE.Utilsmisc/KE.Utils.csproj +++ /dev/null @@ -1,30 +0,0 @@ - - - - 13.0 - net48 - - - - - - - - - - - - - - - - - - if not "$(EXILED_DEV_REFERENCES)"=="" copy /y "$(OutputPath)$(AssemblyName).dll" "$(EXILED_DEV_REFERENCES)\Plugins\" - - - if [[ ! -z "$EXILED_DEV_REFERENCES" ]]; then cp "$(OutputPath)$(AssemblyName).dll" "$EXILED_DEV_REFERENCES/Plugins/"; fi - - - - diff --git a/KruacentExiled/utils-merged/KE.Utilsmisc/Quality/Enums/ModelQuality.cs b/KruacentExiled/utils-merged/KE.Utilsmisc/Quality/Enums/ModelQuality.cs deleted file mode 100644 index d9d8d295..00000000 --- a/KruacentExiled/utils-merged/KE.Utilsmisc/Quality/Enums/ModelQuality.cs +++ /dev/null @@ -1,16 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace KE.Utils.Quality.Enums -{ - public enum ModelQuality - { - None = -1, - Low, - Medium, - High, - } -} diff --git a/KruacentExiled/utils-merged/KE.Utilsmisc/Quality/Handlers/QualityToysHandler.cs b/KruacentExiled/utils-merged/KE.Utilsmisc/Quality/Handlers/QualityToysHandler.cs deleted file mode 100644 index b2485795..00000000 --- a/KruacentExiled/utils-merged/KE.Utilsmisc/Quality/Handlers/QualityToysHandler.cs +++ /dev/null @@ -1,179 +0,0 @@ -using AdminToys; -using Exiled.API.Enums; -using Exiled.API.Extensions; -using Exiled.API.Features; -using Exiled.API.Features.Toys; -using KE.Utils.Quality.Enums; -using KE.Utils.Quality.Settings; -using MEC; -using System; -using System.Collections.Generic; -using System.Linq; -using UnityEngine; -using Light = Exiled.API.Features.Toys.Light; -using QualitySettings = KE.Utils.Quality.Settings.QualitySettings; - -namespace KE.Utils.Quality.Handlers -{ - public class QualityToysHandler - { - private HashSet _pickupToys = new(); - private Dictionary _qualityToys = new(); - public readonly Vector3 Gulag = new Vector3(15000, 15000, 15000); - public const float Delay = Timing.WaitForOneFrame; - public bool IsPickupToy(AdminToy primitive) - { - return _pickupToys.Contains(primitive); - } - - public bool IsQualityToy(AdminToy primitive) - { - return _qualityToys.ContainsKey(primitive); - } - - - public void SetAsPickup(AdminToy toy, bool autoSync = true) - { - if (!_pickupToys.Add(toy)) - { - Log.Warn($"AdminToy {toy} is already a pickupToy"); - return; - } - if (autoSync) - Sync(toy); - } - - public void SetQuality(AdminToy toy, ModelQuality quality, bool autoSync = true) - { - if (toy == null) return; - if (!_qualityToys.ContainsKey(toy)) - _qualityToys.Add(toy, quality); - else - _qualityToys[toy] = quality; - - if (autoSync) - Sync(toy); - } - - - - private void SendToFakePosition(AdminToy adminToy, Player player,Vector3 position) - { - //idk why but without delay it show all of the quality at once - Timing.CallDelayed(Delay, () => - { - if (adminToy is Light l) - { - player.SendFakeSyncVar(l.Base.netIdentity, typeof(LightSourceToy), nameof(LightSourceToy.NetworkPosition), position); - return; - } - if (adminToy is Primitive p) - { - player.SendFakeSyncVar(p.Base.netIdentity, typeof(PrimitiveObjectToy), nameof(PrimitiveObjectToy.NetworkPosition), position); - return; - } - }); - - } - - /// - /// Sync every Players - /// - public void Sync() - { - foreach (Player p in Player.List) - { - Sync(p); - } - } - - /// - /// Sync a specified Player - /// - /// - public void Sync(Player p) - { - - - - var quality = QualitySettings.Get(p); - var pickup = QualitySettings.PickmodelActivated(p); - - HashSet pickupToRemove = []; - HashSet qualityToRemove = []; - - //hide pickup toys - - foreach (AdminToy pk in _pickupToys) - { - try - { - if (pickup) - { - SendToFakePosition(pk, p, pk.Position); - } - else - { - SendToFakePosition(pk, p, Gulag); - } - } - catch (NullReferenceException) - { - //Log.Warn("removing pickup"); - pickupToRemove.Add(pk); - } - - } - - _pickupToys.RemoveWhere(p => pickupToRemove.Contains(p)); - - - foreach (var at in _qualityToys) - { - try - { - if ((at.Value == quality || at.Value == ModelQuality.None) && (pickup || !_pickupToys.Contains(at.Key))) - { - SendToFakePosition(at.Key, p, at.Key.Position); - } - else - { - SendToFakePosition(at.Key, p, Gulag); - } - } - catch (NullReferenceException) - { - //Log.Warn("removing quality" + _qualityToys.Count); - qualityToRemove.Add(at.Key); - } - - - } - foreach(var at in qualityToRemove) - { - - _qualityToys.Remove(at); - } - - } - - /// - /// Sync a specified AdminToy - /// - /// - public void Sync(AdminToy adminToy) - { - //temporary fix - Sync(); - - if (IsPickupToy(adminToy)) - { - - } - if (IsQualityToy(adminToy)) - { - - } - } - } -} diff --git a/KruacentExiled/utils-merged/KE.Utilsmisc/Quality/Models/Base/BaseModel.cs b/KruacentExiled/utils-merged/KE.Utilsmisc/Quality/Models/Base/BaseModel.cs deleted file mode 100644 index c9f6723c..00000000 --- a/KruacentExiled/utils-merged/KE.Utilsmisc/Quality/Models/Base/BaseModel.cs +++ /dev/null @@ -1,41 +0,0 @@ -using Exiled.API.Enums; -using Exiled.API.Extensions; -using Exiled.API.Features.Toys; -using Exiled.API.Interfaces; -using KE.Utils.Quality.Structs; -using PlayerStatsSystem; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using UnityEngine; -using Light = Exiled.API.Features.Toys.Light; - -namespace KE.Utils.Quality.Models.Base -{ - - /// - /// The blocks to build a model with - /// - public abstract class BaseModel : ICloneable - { - - protected AdminToy _toy; - public AdminToy AdminToy { get { return _toy; } } - private Vector3 _position; - public Vector3 LocalPosition { get { return _position; } } - private Quaternion _rotation; - public Quaternion LocalRotation { get { return _rotation; } } - - - public BaseModel(Vector3 localPositon, Quaternion localRotation) - { - _position = localPositon; - _rotation = localRotation; - } - - public abstract object Clone(); - } - -} diff --git a/KruacentExiled/utils-merged/KE.Utilsmisc/Quality/Models/Base/LightModel.cs b/KruacentExiled/utils-merged/KE.Utilsmisc/Quality/Models/Base/LightModel.cs deleted file mode 100644 index ce808da1..00000000 --- a/KruacentExiled/utils-merged/KE.Utilsmisc/Quality/Models/Base/LightModel.cs +++ /dev/null @@ -1,26 +0,0 @@ -using Exiled.API.Features.Toys; -using UnityEngine; -using Light = Exiled.API.Features.Toys.Light; - -namespace KE.Utils.Quality.Models.Base -{ - public class LightModel : BaseModel - { - - /// - /// Create a new Light for modeling - /// - public LightModel(Vector3? scale, Color? color, Vector3 localPositon, Quaternion localRotation) : base(localPositon, localRotation) - { - Light light = Light.Create(null, null, scale, false, color); - _toy = light; - } - - - public override object Clone() - { - Light light = _toy as Light; - return new LightModel(light.Scale, light.Color, LocalPosition, LocalRotation); - } - } -} diff --git a/KruacentExiled/utils-merged/KE.Utilsmisc/Quality/Models/Base/PrimitiveModel.cs b/KruacentExiled/utils-merged/KE.Utilsmisc/Quality/Models/Base/PrimitiveModel.cs deleted file mode 100644 index 22e07225..00000000 --- a/KruacentExiled/utils-merged/KE.Utilsmisc/Quality/Models/Base/PrimitiveModel.cs +++ /dev/null @@ -1,26 +0,0 @@ -using Exiled.API.Features.Toys; -using UnityEngine; -using Color = UnityEngine.Color; - -namespace KE.Utils.Quality.Models.Base -{ - public class PrimitiveModel : BaseModel - { - /// - /// Create a new Primitive for modeling - /// - public PrimitiveModel(PrimitiveType type, Vector3? scale, Color? color,Vector3 localPosition,Quaternion localRotation) : base(localPosition, localRotation) - { - - Primitive prim = Primitive.Create(type, null, null, scale, false, color); - prim.Collidable = false; - _toy = prim; - } - - public override object Clone() - { - Primitive prim = _toy as Primitive; - return new PrimitiveModel(prim.Type, prim.Scale, prim.Color, LocalPosition, LocalRotation); - } - } -} diff --git a/KruacentExiled/utils-merged/KE.Utilsmisc/Quality/Models/Examples/MineModel.cs b/KruacentExiled/utils-merged/KE.Utilsmisc/Quality/Models/Examples/MineModel.cs deleted file mode 100644 index 00d60fec..00000000 --- a/KruacentExiled/utils-merged/KE.Utilsmisc/Quality/Models/Examples/MineModel.cs +++ /dev/null @@ -1,118 +0,0 @@ -using KE.Utils.Quality.Enums; -using KE.Utils.Quality.Models.Base; -using System.Collections.Generic; -using UnityEngine; -using Light = Exiled.API.Features.Toys.Light; - -namespace KE.Utils.Quality.Models.Examples -{ - public abstract class MineModel : QualityModel - { - protected Light _light; - private bool _lightOn = false; - - - - - public void ToggleLight() - { - if (_light == null) throw new System.Exception("no light"); - if (_lightOn) - _light.UnSpawn(); - else - _light.Spawn(); - _lightOn = !_lightOn; - } - - } - - public class MineModelLow : MineModel - { - public override bool IsPickup => false; - public override ModelQuality Quality => ModelQuality.Low; - - protected override IEnumerable GetBaseModels() - { - Quaternion baseRotation = new(); - //spawn + offset - Vector3 offset = new Vector3(0, .05f); - Vector3 sizeDisk = new Vector3(.7f, 0.1f, .7f); - - Vector3 sizeGlobe = new Vector3(.1f, .1f, .1f); - Vector3 posLight = new Vector3(0, sizeDisk.y+sizeGlobe.y); - - - var baseMine = new PrimitiveModel(PrimitiveType.Cylinder, sizeDisk, Color.black, offset, baseRotation); - - var lightGlobe = new PrimitiveModel(PrimitiveType.Sphere, sizeGlobe , new Color(1, 0, 0, .33f), posLight, baseRotation); - - var lightMine = new LightModel(null, Color.red, posLight, baseRotation); - - _light = lightMine.AdminToy as Light; - _light.Intensity = .55f; - - return [baseMine, lightGlobe, lightMine]; - } - - - } - - public class MineModelMedium : MineModel - { - public override bool IsPickup => false; - public override ModelQuality Quality => ModelQuality.Medium; - - protected override IEnumerable GetBaseModels() - { - Quaternion baseRotation = new(); - //spawn + offset - Vector3 offset = new Vector3(0, .05f); - Vector3 sizeDisk = new Vector3(.7f, 0.1f, .7f); - - Vector3 sizeGlobe = new Vector3(.1f, .1f, .1f); - Vector3 posLight = new Vector3(0, sizeDisk.y + sizeGlobe.y); - - - var baseMine = new PrimitiveModel(PrimitiveType.Cylinder, sizeDisk, Color.black, offset, baseRotation); - - var lightGlobe = new PrimitiveModel(PrimitiveType.Sphere, sizeGlobe, new Color(1, 0, 0, .33f), posLight, baseRotation); - - var lightMine = new LightModel(null, Color.green, posLight, baseRotation); - - _light = lightMine.AdminToy as Light; - _light.Intensity = .55f; - - return [baseMine, lightGlobe, lightMine]; - } - } - - public class MineModelPickup : MineModel - { - public override bool IsPickup => true; - public override ModelQuality Quality => ModelQuality.None; - - - protected override IEnumerable GetBaseModels() - { - Quaternion baseRotation = new(); - //spawn + offset - Vector3 offset = new Vector3(0, .05f); - Vector3 sizeDisk = new Vector3(.7f, 0.1f, .7f); - - Vector3 sizeGlobe = new Vector3(.1f, .1f, .1f); - Vector3 posLight = new Vector3(0, sizeDisk.y + sizeGlobe.y); - - - var baseMine = new PrimitiveModel(PrimitiveType.Cylinder, sizeDisk, Color.black, offset, baseRotation); - - var lightGlobe = new PrimitiveModel(PrimitiveType.Sphere, sizeGlobe, new Color(1, 0, 0, .33f), posLight, baseRotation); - - var lightMine = new LightModel(null, Color.magenta, posLight, baseRotation); - - _light = lightMine.AdminToy as Light; - _light.Intensity = .55f; - - return [baseMine, lightGlobe, lightMine]; - } - } -} diff --git a/KruacentExiled/utils-merged/KE.Utilsmisc/Quality/Models/Model.cs b/KruacentExiled/utils-merged/KE.Utilsmisc/Quality/Models/Model.cs deleted file mode 100644 index 2e26756e..00000000 --- a/KruacentExiled/utils-merged/KE.Utilsmisc/Quality/Models/Model.cs +++ /dev/null @@ -1,104 +0,0 @@ -using Exiled.API.Features; -using Exiled.API.Features.Toys; -using KE.Utils.Quality.Models.Base; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using UnityEngine; - -namespace KE.Utils.Quality.Models -{ - public class Model : IEquatable - { - - - private Vector3 _position; - public Vector3 Position - { - get { return _position; } - set - { - _position = value; - } - } - private Quaternion _rotation; - public Quaternion Rotation - { - get { return _rotation; } - set - { - _rotation = value; - } - } - private ModelPrefab _prefab; - public ModelPrefab Prefab - { - get { return _prefab; } - } - - - - private HashSet _models; - - internal Model(ModelPrefab prefab, Vector3 position, Quaternion rotation,IEnumerable toys,bool spawn) - { - _prefab = prefab; - Position = position; - Rotation = rotation; - _models = new HashSet(toys); - QualityHandler.Instance.QualityToysHandler.Sync(); - - foreach (BaseModel based in toys) - { - AdminToy toy = based.AdminToy; - - if (toy is Primitive p) - p.Collidable = false; - toy.AdminToyBase.transform.position = based.LocalPosition + Position; - toy.AdminToyBase.transform.rotation = based.LocalRotation * Rotation; - } - if(spawn) - { - Spawn(); - } - } - - - public void Destroy() - { - foreach (BaseModel primitive in _models) - { - primitive.AdminToy.Destroy(); - } - } - public void UnSpawn() - { - foreach (BaseModel primitive in _models) - { - primitive.AdminToy.UnSpawn(); - } - } - public void Spawn() - { - QualityHandler.Instance.QualityToysHandler.Sync(); - foreach (BaseModel primitive in _models) - { - primitive.AdminToy.Spawn(); - } - - } - - - public bool Equals(Model x) - { - if (x == null) return false; - return x._prefab == _prefab && x.Position == Position && x.Rotation == Rotation; - } - public int GetHashCode(Model obj) - { - return obj.GetHashCode(); - } - } -} diff --git a/KruacentExiled/utils-merged/KE.Utilsmisc/Quality/Models/ModelPrefab.cs b/KruacentExiled/utils-merged/KE.Utilsmisc/Quality/Models/ModelPrefab.cs deleted file mode 100644 index bbc39da4..00000000 --- a/KruacentExiled/utils-merged/KE.Utilsmisc/Quality/Models/ModelPrefab.cs +++ /dev/null @@ -1,42 +0,0 @@ -using Exiled.API.Features; -using Exiled.API.Features.Core; -using Exiled.API.Features.Pickups; -using Exiled.API.Features.Toys; -using Exiled.API.Interfaces; -using KE.Utils.Extensions; -using KE.Utils.Quality.Models.Base; -using KE.Utils.Quality.Structs; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using UnityEngine; -using Light = Exiled.API.Features.Toys.Light; - -namespace KE.Utils.Quality.Models -{ - public abstract class ModelPrefab - { - - protected abstract IEnumerable GetBaseModels(); - - public virtual Model Create(Vector3 position,Quaternion rotation, bool spawn = true) - { - - HashSet clonetoys = new(); - HashSet toys = GetBaseModels().ToHashSet(); - foreach (BaseModel model in toys) - { - BaseModel clone = (BaseModel)model.Clone(); - clonetoys.Add(clone); - } - return new Model(this, position, rotation, clonetoys,spawn); - - } - - - - - } -} diff --git a/KruacentExiled/utils-merged/KE.Utilsmisc/Quality/Models/QualityModel.cs b/KruacentExiled/utils-merged/KE.Utilsmisc/Quality/Models/QualityModel.cs deleted file mode 100644 index b5cc682f..00000000 --- a/KruacentExiled/utils-merged/KE.Utilsmisc/Quality/Models/QualityModel.cs +++ /dev/null @@ -1,40 +0,0 @@ -using Exiled.API.Features; -using Exiled.API.Features.Toys; -using KE.Utils.Extensions; -using KE.Utils.Quality.Enums; -using KE.Utils.Quality.Models.Base; -using System.Collections.Generic; -using System.Linq; -using UnityEngine; - -namespace KE.Utils.Quality.Models -{ - public abstract class QualityModel : ModelPrefab - { - public abstract ModelQuality Quality { get; } - public abstract bool IsPickup { get; } - - - - - public override sealed Model Create(Vector3 position, Quaternion rotation,bool spawn = true) - { - - HashSet clonetoys = new(); - HashSet toys = GetBaseModels().ToHashSet(); - foreach (BaseModel model in toys) - { - BaseModel clone = (BaseModel)model.Clone(); - - if (IsPickup) - clone.AdminToy.SetAsPickupAdminToy(false); - - clone.AdminToy.SetQuality(Quality,false); - clonetoys.Add(clone); - } - QualityHandler.Sync(); - return new Model(this,position, rotation, clonetoys, spawn); - } - - } -} diff --git a/KruacentExiled/utils-merged/KE.Utilsmisc/Quality/QualityHandler.cs b/KruacentExiled/utils-merged/KE.Utilsmisc/Quality/QualityHandler.cs deleted file mode 100644 index 235d79c9..00000000 --- a/KruacentExiled/utils-merged/KE.Utilsmisc/Quality/QualityHandler.cs +++ /dev/null @@ -1,61 +0,0 @@ -using Exiled.API.Features; -using Exiled.API.Features.Core.UserSettings; -using KE.Utils.Quality.Handlers; -using KE.Utils.Quality.Settings; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace KE.Utils.Quality -{ - [Obsolete("scrapped", false)] - internal class QualityHandler - { - public QualitySettings QualitySettings { get; private set; } - public QualityToysHandler QualityToysHandler { get; private set; } - - private static QualityHandler _instance; - public static QualityHandler Instance - { - get - { - if(_instance == null ) - _instance = new QualityHandler(); - return _instance; - } - } - private QualityHandler() - { - QualitySettings = new QualitySettings(Changed); - QualityToysHandler = new QualityToysHandler(); - } - - ~QualityHandler() - { - QualityToysHandler = null; - QualitySettings = null; - } - - public void Changed(Player p, SettingBase _) - { - QualityToysHandler.Sync(p); - } - - public void Register() - { - QualitySettings.Register(); - } - - public void Unregister() - { - QualitySettings.Unregister(); - } - - public static void Sync() - { - Instance.QualityToysHandler.Sync(); - } - } -} diff --git a/KruacentExiled/utils-merged/KE.Utilsmisc/Quality/QualityToysHandler.cs b/KruacentExiled/utils-merged/KE.Utilsmisc/Quality/QualityToysHandler.cs deleted file mode 100644 index 27320233..00000000 --- a/KruacentExiled/utils-merged/KE.Utilsmisc/Quality/QualityToysHandler.cs +++ /dev/null @@ -1,155 +0,0 @@ -using AdminToys; -using Exiled.API.Enums; -using Exiled.API.Extensions; -using Exiled.API.Features; -using Exiled.API.Features.Toys; -using KE.Utils.Quality.Enums; -using KE.Utils.Quality.Settings; -using System.Collections.Generic; -using System.Linq; -using UnityEngine; -using Light = Exiled.API.Features.Toys.Light; -using QualitySettings = KE.Utils.Quality.Settings.QualitySettings; - -namespace KE.Utils.Quality -{ - public class QualityToysHandler - { - private HashSet _pickupToys = new(); - private Dictionary _qualityToys = new(); - public readonly Vector3 Gulag = new Vector3(15000,15000,15000); - - public bool IsPickupToy(AdminToy primitive) - { - return _pickupToys.Contains(primitive); - } - - public bool IsQualityToy(AdminToy primitive) - { - return _qualityToys.ContainsKey(primitive); - } - - - public void SetAsPickup(AdminToy toy) - { - if (!_pickupToys.Add(toy)) - { - Log.Warn($"AdminToy {toy} is already a pickupToy"); - return; - } - } - - public void SetQuality(AdminToy toy,ModelQuality quality) - { - if (toy == null) return; - if (!_qualityToys.ContainsKey(toy)) - _qualityToys.Add(toy,quality); - else - _qualityToys[toy] = quality; - } - - - - private void SendToShadowRealm(AdminToy adminToy, Player player) - { - if(adminToy is Light l) - { - player.SendFakeSyncVar(l.Base.netIdentity, typeof(LightSourceToy), nameof(LightSourceToy.NetworkPosition), Gulag); - return; - } - if(adminToy is Primitive p) - { - player.SendFakeSyncVar(p.Base.netIdentity, typeof(PrimitiveObjectToy), nameof(PrimitiveObjectToy.NetworkPosition), Gulag); - return; - } - } - - private void SetTruePosition(AdminToy adminToy, Player player) - { - if (adminToy is Light l) - { - player.SendFakeSyncVar(l.Base.netIdentity, typeof(LightSourceToy), nameof(LightSourceToy.NetworkPosition), l.Position); - return; - } - if (adminToy is Primitive p) - { - player.SendFakeSyncVar(p.Base.netIdentity, typeof(PrimitiveObjectToy), nameof(PrimitiveObjectToy.NetworkPosition), p.Position); - return; - } - } - - /// - /// Sync every Players - /// - public void Sync() - { - foreach(Player p in Player.List) - { - Sync(p); - } - } - - /// - /// Sync a specified Player - /// - /// - public void Sync(Player p) - { - var quality = QualitySettings.Get(p); - var pickup = QualitySettings.PickmodelActivated(p); - - if (!pickup) - { - //hide pickup toys - foreach (AdminToy pk in _pickupToys) - { - SendToShadowRealm(pk, p); - } - } - else - { - //show pickup toys - foreach (AdminToy pk in _pickupToys) - { - SetTruePosition(pk, p); - } - } - - - - - foreach(var at in _qualityToys) - { - if(at.Value == quality) - { - if (pickup || !_pickupToys.Contains(at.Key)) - { - SetTruePosition(at.Key, p); - } - } - else - { - SendToShadowRealm(at.Key, p); - } - - } - - } - - /// - /// Sync a specified AdminToy - /// - /// - public void Sync(AdminToy adminToy) - { - if (IsPickupToy(adminToy)) - { - - } - if (IsQualityToy(adminToy)) - { - - } - } - } -} diff --git a/KruacentExiled/utils-merged/KE.Utilsmisc/Quality/Settings/QualitySettings.cs b/KruacentExiled/utils-merged/KE.Utilsmisc/Quality/Settings/QualitySettings.cs deleted file mode 100644 index ca8d49be..00000000 --- a/KruacentExiled/utils-merged/KE.Utilsmisc/Quality/Settings/QualitySettings.cs +++ /dev/null @@ -1,62 +0,0 @@ -using Exiled.API.Features; -using Exiled.API.Features.Core.UserSettings; -using KE.Utils.Quality.Enums; -using System; - -namespace KE.Utils.Quality.Settings -{ - public class QualitySettings - { - - private static int _idQuality = 0; - private static int _idModels = 1; - private static int _idSlider = 2; - private SettingBase[] _settings; - public QualitySettings(Action onChanged) - { - HeaderSetting header = new("Quality Settings"); - _settings = - [ - header, - new DropdownSetting(_idQuality,"ModelQuality",["Low","Medium", "High"],onChanged:onChanged), - new TwoButtonsSetting(_idModels,"Pickup models","Disabled","Enabled", onChanged:onChanged) - ]; - } - - public void Register() - { - SettingBase.Register(_settings); - SettingBase.SendToAll(); - } - - public void Unregister() - { - SettingBase.Unregister(settings:_settings); - } - - - - - public static ModelQuality Get(Player p) - { - if (!SettingBase.TryGetSetting(p, _idQuality, out var setting)) return ModelQuality.None; - - return setting.SelectedOption switch - { - "Low" => ModelQuality.Low, - "Medium" => ModelQuality.Medium, - "High" => ModelQuality.High, - _ => ModelQuality.None, - }; - } - - - public static bool PickmodelActivated(Player p) - { - if (!SettingBase.TryGetSetting(p, _idModels, out var setting)) return false; - return setting.IsSecond; - } - - - } -} diff --git a/KruacentExiled/utils-merged/KE.Utilsmisc/Quality/Structs/LocalWorldSpace.cs b/KruacentExiled/utils-merged/KE.Utilsmisc/Quality/Structs/LocalWorldSpace.cs deleted file mode 100644 index d9c6205b..00000000 --- a/KruacentExiled/utils-merged/KE.Utilsmisc/Quality/Structs/LocalWorldSpace.cs +++ /dev/null @@ -1,23 +0,0 @@ -using Exiled.API.Interfaces; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using UnityEngine; - -namespace KE.Utils.Quality.Structs -{ - public readonly struct LocalWorldSpace : IWorldSpace - { - - public Vector3 Position { get; } - public Quaternion Rotation { get; } - - public LocalWorldSpace(Vector3 position, Quaternion rotation) - { - Position = position; - Rotation = rotation; - } - } -} diff --git a/KruacentExiled/utils-merged/KE.Utilsmisc/Quality/Tests/Test.cs b/KruacentExiled/utils-merged/KE.Utilsmisc/Quality/Tests/Test.cs deleted file mode 100644 index 6ebd3f66..00000000 --- a/KruacentExiled/utils-merged/KE.Utilsmisc/Quality/Tests/Test.cs +++ /dev/null @@ -1,108 +0,0 @@ -using Exiled.API.Extensions; -using Exiled.API.Features; -using Exiled.API.Features.Toys; -using KE.Utils.Quality.Models; -using KE.Utils.Quality.Models.Examples; -using MEC; -using PlayerRoles; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using UnityEngine; - -namespace KE.Utils.Quality.Tests -{ - public class Test - { - private QualityHandler QualityHandler; - - - private Test(QualityHandler q) - { - QualityHandler = q; - try - { - TestMine(); - } - catch (Exception ex) - { - Log.Error("Exception for TestMine :\n"+ex); - } - - } - internal void TestQuality() - { - Vector3 pos = RoleTypeId.Scp049.GetRandomSpawnLocation().Position; - Primitive c = Primitive.Create(pos); - c.Color = Color.red; - Primitive c2 = Primitive.Create(pos + Vector3.one); - c2.Color = Color.green; - - - QualityHandler.QualityToysHandler.SetQuality(c, Enums.ModelQuality.Low); - QualityHandler.QualityToysHandler.SetQuality(c2, Enums.ModelQuality.Medium); - } - - internal void StressTest(int count) - { - Timing.RunCoroutine(Stress(count)); - } - - - private IEnumerator Stress(int count) - { - Vector3 pos = RoleTypeId.Scp049.GetRandomSpawnLocation().Position; - Vector3 scale = new Vector3(.1f, .1f, .1f); - float maxSpread = 5; - for (int i = 0; i < count; i++) - { - Primitive c = Primitive.Create(pos + new Vector3(UnityEngine.Random.Range(0f, maxSpread), UnityEngine.Random.Range(0f, maxSpread), UnityEngine.Random.Range(0f, maxSpread)), scale: scale); - QualityHandler.QualityToysHandler.SetQuality(c, Enums.ModelQuality.Medium); - } - QualityHandler.QualityToysHandler.Sync(); - yield return 0; - } - - public void TestMine() - { - Log.Info("TestMine"); - Vector3 pos = RoleTypeId.Scp049.GetRandomSpawnLocation().Position; - MineModelLow mml = new(); - - - Model m = mml.Create(pos, new Quaternion()); - m.Spawn(); - - - MineModelMedium mmm = new(); - - m = mmm.Create(pos + Vector3.up, new Quaternion()); - m.Spawn(); - - - MineModelPickup mmp = new(); - m = mmp.Create(pos + Vector3.right, new Quaternion()); - m.Spawn(); - - QualityHandler.Sync(); - - - - - - - - - foreach (var item in Player.List) - { - item.Teleport(pos); - } - - - - - } - } -} From 7518f4a7f39941d3f6c7f8fc406444829136b533 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Mon, 28 Jul 2025 19:05:54 +0200 Subject: [PATCH 310/853] readded the projects in the sln --- KruacentExiled/KruacentExiled.sln | 70 ++++++++++++++++++------------- 1 file changed, 42 insertions(+), 28 deletions(-) diff --git a/KruacentExiled/KruacentExiled.sln b/KruacentExiled/KruacentExiled.sln index 07f1f38d..e7702de3 100644 --- a/KruacentExiled/KruacentExiled.sln +++ b/KruacentExiled/KruacentExiled.sln @@ -5,44 +5,58 @@ VisualStudioVersion = 17.12.35506.116 MinimumVisualStudioVersion = 10.0.40219.1 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "KE.Utils", "KE.Utils\KE.Utils.csproj", "{DFEF41B3-5BD3-428A-A7BA-7A490E65C71F}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "KE.BlackoutNDoor", "KE.BlackoutNDoor\KE.BlackoutNDoor.csproj", "{0281E12C-52C9-4728-A432-769CB191A4DC}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "KE.CustomRoles", "KE.CustomRoles\KE.CustomRoles.csproj", "{33CC074C-06DD-4545-91F2-F668F3C4779D}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "KE.GlobalEventFramework", "KE.GlobalEventFramework\KE.GlobalEventFramework.csproj", "{ED6702F7-B1E4-4522-B491-ED08B0525762}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "KE.GlobalEventFramework.Examples", "KE.GlobalEventFramework.Examples\KE.GlobalEventFramework.Examples.csproj", "{8A74D9F3-FB15-4BDC-84C9-2C26F9F410F8}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "KE.Items", "KE.Items\KE.Items.csproj", "{29C5DC23-05F9-4862-A79A-6051D5DBB575}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "KE.Misc", "KE.Misc\KE.Misc.csproj", "{378DD640-986B-4DA9-8C65-8D318E99E98C}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "KE.Map", "KE.Map\KE.Map.csproj", "{C98B7AF6-3463-4274-A63D-355AE8890921}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU Release|Any CPU = Release|Any CPU EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution - {2FE04C4D-7FA1-4EC5-A8AF-618EDE0C037C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {2FE04C4D-7FA1-4EC5-A8AF-618EDE0C037C}.Debug|Any CPU.Build.0 = Debug|Any CPU - {2FE04C4D-7FA1-4EC5-A8AF-618EDE0C037C}.Release|Any CPU.ActiveCfg = Release|Any CPU - {2FE04C4D-7FA1-4EC5-A8AF-618EDE0C037C}.Release|Any CPU.Build.0 = Release|Any CPU - {CD822DB2-756E-4887-93AB-2D2F16BF542C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {CD822DB2-756E-4887-93AB-2D2F16BF542C}.Debug|Any CPU.Build.0 = Debug|Any CPU - {CD822DB2-756E-4887-93AB-2D2F16BF542C}.Release|Any CPU.ActiveCfg = Release|Any CPU - {CD822DB2-756E-4887-93AB-2D2F16BF542C}.Release|Any CPU.Build.0 = Release|Any CPU - {C9867742-72DB-4ECA-81BF-104A27A04DB7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {C9867742-72DB-4ECA-81BF-104A27A04DB7}.Debug|Any CPU.Build.0 = Debug|Any CPU - {C9867742-72DB-4ECA-81BF-104A27A04DB7}.Release|Any CPU.ActiveCfg = Release|Any CPU - {C9867742-72DB-4ECA-81BF-104A27A04DB7}.Release|Any CPU.Build.0 = Release|Any CPU - {73D6C740-96DE-4965-898F-DDD5BCBF7366}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {73D6C740-96DE-4965-898F-DDD5BCBF7366}.Debug|Any CPU.Build.0 = Debug|Any CPU - {73D6C740-96DE-4965-898F-DDD5BCBF7366}.Release|Any CPU.ActiveCfg = Release|Any CPU - {73D6C740-96DE-4965-898F-DDD5BCBF7366}.Release|Any CPU.Build.0 = Release|Any CPU - {07B92E87-F48F-4F9F-BA0E-1BCB2AF52F53}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {07B92E87-F48F-4F9F-BA0E-1BCB2AF52F53}.Debug|Any CPU.Build.0 = Debug|Any CPU - {07B92E87-F48F-4F9F-BA0E-1BCB2AF52F53}.Release|Any CPU.ActiveCfg = Release|Any CPU - {07B92E87-F48F-4F9F-BA0E-1BCB2AF52F53}.Release|Any CPU.Build.0 = Release|Any CPU - {4AA4C3E0-E62F-49CE-AD80-0B5C6249EB48}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {4AA4C3E0-E62F-49CE-AD80-0B5C6249EB48}.Debug|Any CPU.Build.0 = Debug|Any CPU - {4AA4C3E0-E62F-49CE-AD80-0B5C6249EB48}.Release|Any CPU.ActiveCfg = Release|Any CPU - {4AA4C3E0-E62F-49CE-AD80-0B5C6249EB48}.Release|Any CPU.Build.0 = Release|Any CPU - {7B02C0D1-B48F-4D82-B882-88AB0171FCDE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {7B02C0D1-B48F-4D82-B882-88AB0171FCDE}.Debug|Any CPU.Build.0 = Debug|Any CPU - {7B02C0D1-B48F-4D82-B882-88AB0171FCDE}.Release|Any CPU.ActiveCfg = Release|Any CPU - {7B02C0D1-B48F-4D82-B882-88AB0171FCDE}.Release|Any CPU.Build.0 = Release|Any CPU {DFEF41B3-5BD3-428A-A7BA-7A490E65C71F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {DFEF41B3-5BD3-428A-A7BA-7A490E65C71F}.Debug|Any CPU.Build.0 = Debug|Any CPU {DFEF41B3-5BD3-428A-A7BA-7A490E65C71F}.Release|Any CPU.ActiveCfg = Release|Any CPU {DFEF41B3-5BD3-428A-A7BA-7A490E65C71F}.Release|Any CPU.Build.0 = Release|Any CPU + {0281E12C-52C9-4728-A432-769CB191A4DC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {0281E12C-52C9-4728-A432-769CB191A4DC}.Debug|Any CPU.Build.0 = Debug|Any CPU + {0281E12C-52C9-4728-A432-769CB191A4DC}.Release|Any CPU.ActiveCfg = Release|Any CPU + {0281E12C-52C9-4728-A432-769CB191A4DC}.Release|Any CPU.Build.0 = Release|Any CPU + {33CC074C-06DD-4545-91F2-F668F3C4779D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {33CC074C-06DD-4545-91F2-F668F3C4779D}.Debug|Any CPU.Build.0 = Debug|Any CPU + {33CC074C-06DD-4545-91F2-F668F3C4779D}.Release|Any CPU.ActiveCfg = Release|Any CPU + {33CC074C-06DD-4545-91F2-F668F3C4779D}.Release|Any CPU.Build.0 = Release|Any CPU + {ED6702F7-B1E4-4522-B491-ED08B0525762}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {ED6702F7-B1E4-4522-B491-ED08B0525762}.Debug|Any CPU.Build.0 = Debug|Any CPU + {ED6702F7-B1E4-4522-B491-ED08B0525762}.Release|Any CPU.ActiveCfg = Release|Any CPU + {ED6702F7-B1E4-4522-B491-ED08B0525762}.Release|Any CPU.Build.0 = Release|Any CPU + {8A74D9F3-FB15-4BDC-84C9-2C26F9F410F8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {8A74D9F3-FB15-4BDC-84C9-2C26F9F410F8}.Debug|Any CPU.Build.0 = Debug|Any CPU + {8A74D9F3-FB15-4BDC-84C9-2C26F9F410F8}.Release|Any CPU.ActiveCfg = Release|Any CPU + {8A74D9F3-FB15-4BDC-84C9-2C26F9F410F8}.Release|Any CPU.Build.0 = Release|Any CPU + {29C5DC23-05F9-4862-A79A-6051D5DBB575}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {29C5DC23-05F9-4862-A79A-6051D5DBB575}.Debug|Any CPU.Build.0 = Debug|Any CPU + {29C5DC23-05F9-4862-A79A-6051D5DBB575}.Release|Any CPU.ActiveCfg = Release|Any CPU + {29C5DC23-05F9-4862-A79A-6051D5DBB575}.Release|Any CPU.Build.0 = Release|Any CPU + {378DD640-986B-4DA9-8C65-8D318E99E98C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {378DD640-986B-4DA9-8C65-8D318E99E98C}.Debug|Any CPU.Build.0 = Debug|Any CPU + {378DD640-986B-4DA9-8C65-8D318E99E98C}.Release|Any CPU.ActiveCfg = Release|Any CPU + {378DD640-986B-4DA9-8C65-8D318E99E98C}.Release|Any CPU.Build.0 = Release|Any CPU + {C98B7AF6-3463-4274-A63D-355AE8890921}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {C98B7AF6-3463-4274-A63D-355AE8890921}.Debug|Any CPU.Build.0 = Debug|Any CPU + {C98B7AF6-3463-4274-A63D-355AE8890921}.Release|Any CPU.ActiveCfg = Release|Any CPU + {C98B7AF6-3463-4274-A63D-355AE8890921}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE From cc19a46b2ffdf5b80d60c565c503d5c766bf89fa Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Mon, 28 Jul 2025 19:10:22 +0200 Subject: [PATCH 311/853] renamed Map to KE.Map --- KruacentExiled/{Map => KE.Map}/Doors/DoorButton.cs | 0 KruacentExiled/{Map => KE.Map}/Doors/KEDoor.cs | 0 .../{Map => KE.Map}/Doors/KEDoorTypes/KEDoorType.cs | 0 .../{Map => KE.Map}/Doors/KEDoorTypes/NormalKEDoor.cs | 0 KruacentExiled/{Map => KE.Map}/EasterEggs/Capybaras.cs | 0 .../{Map => KE.Map}/EasterEggs/SpinnyBaras.cs | 0 .../{Map => KE.Map}/GamblingZone/DroppableItem.cs | 0 .../{Map => KE.Map}/GamblingZone/GamblingRoom.cs | 0 .../{Map => KE.Map}/GamblingZone/LootTable.cs | 0 .../{Map => KE.Map}/GamblingZone/OldGamblingRoom.cs | 0 KruacentExiled/{Map => KE.Map}/KE.Map.csproj | 0 KruacentExiled/{Map => KE.Map}/MainPlugin.cs | 0 .../{Map => KE.Map}/Quality/SendFakePrimitives.cs | 0 .../{Map => KE.Map}/Utils/InteractiblePickup.cs | 0 KruacentExiled/KruacentExiled.sln | 10 +++++----- 15 files changed, 5 insertions(+), 5 deletions(-) rename KruacentExiled/{Map => KE.Map}/Doors/DoorButton.cs (100%) rename KruacentExiled/{Map => KE.Map}/Doors/KEDoor.cs (100%) rename KruacentExiled/{Map => KE.Map}/Doors/KEDoorTypes/KEDoorType.cs (100%) rename KruacentExiled/{Map => KE.Map}/Doors/KEDoorTypes/NormalKEDoor.cs (100%) rename KruacentExiled/{Map => KE.Map}/EasterEggs/Capybaras.cs (100%) rename KruacentExiled/{Map => KE.Map}/EasterEggs/SpinnyBaras.cs (100%) rename KruacentExiled/{Map => KE.Map}/GamblingZone/DroppableItem.cs (100%) rename KruacentExiled/{Map => KE.Map}/GamblingZone/GamblingRoom.cs (100%) rename KruacentExiled/{Map => KE.Map}/GamblingZone/LootTable.cs (100%) rename KruacentExiled/{Map => KE.Map}/GamblingZone/OldGamblingRoom.cs (100%) rename KruacentExiled/{Map => KE.Map}/KE.Map.csproj (100%) rename KruacentExiled/{Map => KE.Map}/MainPlugin.cs (100%) rename KruacentExiled/{Map => KE.Map}/Quality/SendFakePrimitives.cs (100%) rename KruacentExiled/{Map => KE.Map}/Utils/InteractiblePickup.cs (100%) diff --git a/KruacentExiled/Map/Doors/DoorButton.cs b/KruacentExiled/KE.Map/Doors/DoorButton.cs similarity index 100% rename from KruacentExiled/Map/Doors/DoorButton.cs rename to KruacentExiled/KE.Map/Doors/DoorButton.cs diff --git a/KruacentExiled/Map/Doors/KEDoor.cs b/KruacentExiled/KE.Map/Doors/KEDoor.cs similarity index 100% rename from KruacentExiled/Map/Doors/KEDoor.cs rename to KruacentExiled/KE.Map/Doors/KEDoor.cs diff --git a/KruacentExiled/Map/Doors/KEDoorTypes/KEDoorType.cs b/KruacentExiled/KE.Map/Doors/KEDoorTypes/KEDoorType.cs similarity index 100% rename from KruacentExiled/Map/Doors/KEDoorTypes/KEDoorType.cs rename to KruacentExiled/KE.Map/Doors/KEDoorTypes/KEDoorType.cs diff --git a/KruacentExiled/Map/Doors/KEDoorTypes/NormalKEDoor.cs b/KruacentExiled/KE.Map/Doors/KEDoorTypes/NormalKEDoor.cs similarity index 100% rename from KruacentExiled/Map/Doors/KEDoorTypes/NormalKEDoor.cs rename to KruacentExiled/KE.Map/Doors/KEDoorTypes/NormalKEDoor.cs diff --git a/KruacentExiled/Map/EasterEggs/Capybaras.cs b/KruacentExiled/KE.Map/EasterEggs/Capybaras.cs similarity index 100% rename from KruacentExiled/Map/EasterEggs/Capybaras.cs rename to KruacentExiled/KE.Map/EasterEggs/Capybaras.cs diff --git a/KruacentExiled/Map/EasterEggs/SpinnyBaras.cs b/KruacentExiled/KE.Map/EasterEggs/SpinnyBaras.cs similarity index 100% rename from KruacentExiled/Map/EasterEggs/SpinnyBaras.cs rename to KruacentExiled/KE.Map/EasterEggs/SpinnyBaras.cs diff --git a/KruacentExiled/Map/GamblingZone/DroppableItem.cs b/KruacentExiled/KE.Map/GamblingZone/DroppableItem.cs similarity index 100% rename from KruacentExiled/Map/GamblingZone/DroppableItem.cs rename to KruacentExiled/KE.Map/GamblingZone/DroppableItem.cs diff --git a/KruacentExiled/Map/GamblingZone/GamblingRoom.cs b/KruacentExiled/KE.Map/GamblingZone/GamblingRoom.cs similarity index 100% rename from KruacentExiled/Map/GamblingZone/GamblingRoom.cs rename to KruacentExiled/KE.Map/GamblingZone/GamblingRoom.cs diff --git a/KruacentExiled/Map/GamblingZone/LootTable.cs b/KruacentExiled/KE.Map/GamblingZone/LootTable.cs similarity index 100% rename from KruacentExiled/Map/GamblingZone/LootTable.cs rename to KruacentExiled/KE.Map/GamblingZone/LootTable.cs diff --git a/KruacentExiled/Map/GamblingZone/OldGamblingRoom.cs b/KruacentExiled/KE.Map/GamblingZone/OldGamblingRoom.cs similarity index 100% rename from KruacentExiled/Map/GamblingZone/OldGamblingRoom.cs rename to KruacentExiled/KE.Map/GamblingZone/OldGamblingRoom.cs diff --git a/KruacentExiled/Map/KE.Map.csproj b/KruacentExiled/KE.Map/KE.Map.csproj similarity index 100% rename from KruacentExiled/Map/KE.Map.csproj rename to KruacentExiled/KE.Map/KE.Map.csproj diff --git a/KruacentExiled/Map/MainPlugin.cs b/KruacentExiled/KE.Map/MainPlugin.cs similarity index 100% rename from KruacentExiled/Map/MainPlugin.cs rename to KruacentExiled/KE.Map/MainPlugin.cs diff --git a/KruacentExiled/Map/Quality/SendFakePrimitives.cs b/KruacentExiled/KE.Map/Quality/SendFakePrimitives.cs similarity index 100% rename from KruacentExiled/Map/Quality/SendFakePrimitives.cs rename to KruacentExiled/KE.Map/Quality/SendFakePrimitives.cs diff --git a/KruacentExiled/Map/Utils/InteractiblePickup.cs b/KruacentExiled/KE.Map/Utils/InteractiblePickup.cs similarity index 100% rename from KruacentExiled/Map/Utils/InteractiblePickup.cs rename to KruacentExiled/KE.Map/Utils/InteractiblePickup.cs diff --git a/KruacentExiled/KruacentExiled.sln b/KruacentExiled/KruacentExiled.sln index e7702de3..4b59cc7f 100644 --- a/KruacentExiled/KruacentExiled.sln +++ b/KruacentExiled/KruacentExiled.sln @@ -17,7 +17,7 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "KE.Items", "KE.Items\KE.Ite EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "KE.Misc", "KE.Misc\KE.Misc.csproj", "{378DD640-986B-4DA9-8C65-8D318E99E98C}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "KE.Map", "KE.Map\KE.Map.csproj", "{C98B7AF6-3463-4274-A63D-355AE8890921}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "KE.Map", "KE.Map\KE.Map.csproj", "{39BB7CAB-6FF9-4C60-8A82-A31ABC980CC1}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -53,10 +53,10 @@ Global {378DD640-986B-4DA9-8C65-8D318E99E98C}.Debug|Any CPU.Build.0 = Debug|Any CPU {378DD640-986B-4DA9-8C65-8D318E99E98C}.Release|Any CPU.ActiveCfg = Release|Any CPU {378DD640-986B-4DA9-8C65-8D318E99E98C}.Release|Any CPU.Build.0 = Release|Any CPU - {C98B7AF6-3463-4274-A63D-355AE8890921}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {C98B7AF6-3463-4274-A63D-355AE8890921}.Debug|Any CPU.Build.0 = Debug|Any CPU - {C98B7AF6-3463-4274-A63D-355AE8890921}.Release|Any CPU.ActiveCfg = Release|Any CPU - {C98B7AF6-3463-4274-A63D-355AE8890921}.Release|Any CPU.Build.0 = Release|Any CPU + {39BB7CAB-6FF9-4C60-8A82-A31ABC980CC1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {39BB7CAB-6FF9-4C60-8A82-A31ABC980CC1}.Debug|Any CPU.Build.0 = Debug|Any CPU + {39BB7CAB-6FF9-4C60-8A82-A31ABC980CC1}.Release|Any CPU.ActiveCfg = Release|Any CPU + {39BB7CAB-6FF9-4C60-8A82-A31ABC980CC1}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE From 6846953bf77005078d2157dd1acb766f7cc4e11d Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Tue, 29 Jul 2025 17:35:49 +0200 Subject: [PATCH 312/853] i forgor to check --- KruacentExiled/KE.CustomRoles/CR/SCP/SCP457.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/KruacentExiled/KE.CustomRoles/CR/SCP/SCP457.cs b/KruacentExiled/KE.CustomRoles/CR/SCP/SCP457.cs index dac479ab..95d8a886 100644 --- a/KruacentExiled/KE.CustomRoles/CR/SCP/SCP457.cs +++ b/KruacentExiled/KE.CustomRoles/CR/SCP/SCP457.cs @@ -225,6 +225,7 @@ private void OnTP(TeleportingEventArgs ev) private void OnAttacking(AttackingEventArgs ev) { + if (!Check(ev.Player)) return; ev.IsAllowed = false; } From 5b5f5cbad49eeea9821b81ea57a4e80fa047e6a2 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Tue, 29 Jul 2025 17:43:55 +0200 Subject: [PATCH 313/853] removed 106 from using the supply drop system --- KruacentExiled/KE.Map/Surface/SupplyDrops/SupplyDrop.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/KruacentExiled/KE.Map/Surface/SupplyDrops/SupplyDrop.cs b/KruacentExiled/KE.Map/Surface/SupplyDrops/SupplyDrop.cs index 374b460d..be8158d9 100644 --- a/KruacentExiled/KE.Map/Surface/SupplyDrops/SupplyDrop.cs +++ b/KruacentExiled/KE.Map/Surface/SupplyDrops/SupplyDrop.cs @@ -165,7 +165,7 @@ private IEnumerator Detecting() while (_detectingSomeone && s.Elapsed < TimeStaying) { yield return Timing.WaitForSeconds(RefreshRate); - foreach (Player p in Player.List.Where(p=> p.IsAlive)) + foreach (Player p in Player.List.Where(p=> p.IsAlive && p.Role != RoleTypeId.Scp106)) { if (!playerAlreadyIn.Contains(p) && InRadius(p)) { @@ -226,7 +226,7 @@ private void SpawnLoot(Player p) private void BuffScps() { Log.Debug("scps got it!"); - foreach(Player p in Player.List.Where(p => p.IsScp)) + foreach(Player p in Player.List.Where(p => p.IsScp && p.Role != RoleTypeId.Scp106)) { float healthAdded = p.MaxHealth * 1.2f; p.MaxHealth += healthAdded; From 18afdb4bba5e81bea429bf1a29dc9394f2b77d51 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Sat, 2 Aug 2025 22:06:06 +0200 Subject: [PATCH 314/853] fixed auto elevator coroutine not ending --- .../KE.Misc/Features/AutoElevator.cs | 32 ++++++++++++++++++- .../KE.Misc/Handlers/ServerHandler.cs | 2 +- 2 files changed, 32 insertions(+), 2 deletions(-) diff --git a/KruacentExiled/KE.Misc/Features/AutoElevator.cs b/KruacentExiled/KE.Misc/Features/AutoElevator.cs index 0fca9af2..72557958 100644 --- a/KruacentExiled/KE.Misc/Features/AutoElevator.cs +++ b/KruacentExiled/KE.Misc/Features/AutoElevator.cs @@ -13,10 +13,21 @@ namespace KE.Misc.Features ///
internal class AutoElevator { + private CoroutineHandle handle; + ~AutoElevator() + { + Timing.KillCoroutines(handle); + } + + + public void StartLoop() + { + handle = Timing.RunCoroutine(StartElevator()); + } /// /// Start the auto elevator loop /// - internal IEnumerator StartElevator() + private IEnumerator StartElevator() { Log.Debug("elevator"); while (!Round.IsEnded) @@ -27,7 +38,26 @@ internal IEnumerator StartElevator() SendElevator(l); } } + /* + [2025-07-28 22:12:45.541 +02:00] [STDOUT] InvalidOperationException: Collection was modified; enumeration operation may not execute. + [2025-07-28 22:12:45.541 +02:00] [STDOUT] at System.Collections.Generic.Dictionary`2+ValueCollection+Enumerator[TKey,TValue].MoveNext () [0x00013] in <069d7b80a3914a08b6825aa362b07f5e>:0 + [2025-07-28 22:12:45.541 +02:00] [STDOUT] at KE.Misc.Features.AutoElevator+d__0.MoveNext () [0x00098] in :0 + [2025-07-28 22:12:45.541 +02:00] [STDOUT] at MEC.Timing.Update () [0x0043c] in <907db9b8bd144382918df78d2897b4b7>:0 + [2025-07-28 22:12:45.541 +02:00] [STDOUT] UnityEngine.DebugLogHandler:Internal_LogException_Injected(Exception, IntPtr) + [2025-07-28 22:12:45.541 +02:00] [STDOUT] UnityEngine.DebugLogHandler:Internal_LogException(Exception, Object) + [2025-07-28 22:12:45.541 +02:00] [STDOUT] UnityEngine.DebugLogHandler:LogException(Exception, Object) + [2025-07-28 22:12:45.541 +02:00] [STDOUT] UnityEngine.Logger:LogException(Exception, Object) + [2025-07-28 22:12:45.541 +02:00] [STDOUT] UnityEngine.Debug:LogException(Exception) + [2025-07-28 22:12:45.541 +02:00] [STDOUT] MEC.Timing:Update() + [2025-07-28 22:12:49.976 +02:00] [STDOUT] ArgumentNullException: Value cannot be null. + [2025-07-28 22:12:49.976 +02:00] [STDOUT] Parameter name: key + [2025-07-28 22:12:49.976 +02:00] [STDOUT] at System.Collections.Concurrent.ConcurrentDictionary`2[TKey,TValue].ThrowKeyNullException () [0x00000] in <069d7b80a3914a08b6825aa362b07f5e>:0 + [2025-07-28 22:12:49.976 +02:00] [STDOUT] at System.Collections.Concurrent.ConcurrentDictionary`2[TKey,TValue].TryRemove (TKey key, TValue& value) [0x00008] in <069d7b80a3914a08b6825aa362b07f5e>:0 + [2025-07-28 22:12:49.976 +02:00] [STDOUT] at RemoteAdmin.QueryProcessor.OnDestroy () [0x00018] in :0 + */ } + + private void SendElevator(Lift e) { Log.Debug($"{e.Name}"); diff --git a/KruacentExiled/KE.Misc/Handlers/ServerHandler.cs b/KruacentExiled/KE.Misc/Handlers/ServerHandler.cs index 18889054..8949c4cd 100644 --- a/KruacentExiled/KE.Misc/Handlers/ServerHandler.cs +++ b/KruacentExiled/KE.Misc/Handlers/ServerHandler.cs @@ -19,7 +19,7 @@ public void OnRoundStarted() } if (MainPlugin.Instance.Config.AutoElevator) - Timing.RunCoroutine(MainPlugin.Instance.AutoElevator.StartElevator()); + MainPlugin.Instance.AutoElevator.StartLoop(); MainPlugin.Instance.SCPBuff.StartBuff(); } } From 0bbbab43acfb1083efd958421a712d6710c6153b Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Sat, 2 Aug 2025 22:48:17 +0200 Subject: [PATCH 315/853] fixed the 914 tp --- .../Features/914Upgrades/Base914Upgrade.cs | 9 ++++++-- .../Features/914Upgrades/PlayerTeleport914.cs | 22 ++++++++++++++----- 2 files changed, 23 insertions(+), 8 deletions(-) diff --git a/KruacentExiled/KE.Misc/Features/914Upgrades/Base914Upgrade.cs b/KruacentExiled/KE.Misc/Features/914Upgrades/Base914Upgrade.cs index 6c26c5d4..15cbcefd 100644 --- a/KruacentExiled/KE.Misc/Features/914Upgrades/Base914Upgrade.cs +++ b/KruacentExiled/KE.Misc/Features/914Upgrades/Base914Upgrade.cs @@ -48,12 +48,17 @@ protected bool LuckCheck() } /// - /// Check luck with a differente value than + /// Check luck with a different value than /// /// true if it passed the luck check ; false otherwise protected bool LuckCheck(float chance) { - return UnityEngine.Random.Range(0f, 100f) < Mathf.Clamp(chance, 0f, 100f); + float wanted = Mathf.Clamp(chance, 0f, 100f); + float random = UnityEngine.Random.Range(0f, 100f); + + Log.Debug($"{random} < {wanted} : {random < wanted} "); + + return random < wanted ; } } diff --git a/KruacentExiled/KE.Misc/Features/914Upgrades/PlayerTeleport914.cs b/KruacentExiled/KE.Misc/Features/914Upgrades/PlayerTeleport914.cs index 3ef8afc9..22b10737 100644 --- a/KruacentExiled/KE.Misc/Features/914Upgrades/PlayerTeleport914.cs +++ b/KruacentExiled/KE.Misc/Features/914Upgrades/PlayerTeleport914.cs @@ -2,6 +2,7 @@ using Exiled.API.Features; using Exiled.Events.EventArgs.Scp914; using KE.Utils.Extensions; +using MEC; using PlayerRoles; using Scp914; using System; @@ -21,7 +22,7 @@ protected override void OnUpgradingPlayer(UpgradingPlayerEventArgs ev) { Log.Debug("Upgrade"); Player player = ev.Player; - Room room; + Room room = null; if (ev.KnobSetting == Scp914KnobSetting.Fine && LuckCheck(1)) { try @@ -33,22 +34,31 @@ protected override void OnUpgradingPlayer(UpgradingPlayerEventArgs ev) room = Room.Random(ZoneType.Entrance); } - if(room != null) - player.Teleport(room); + } if(ev.KnobSetting == Scp914KnobSetting.Coarse && LuckCheck(25)) { try { - room = ZoneType.Entrance.RandomSafeRoom(); + room = ZoneType.LightContainment.RandomSafeRoom(); } catch (Exception) { room = Room.Random(ZoneType.LightContainment); } - if (room != null) + } + + if (room != null) + { + //idk why but need a delay + Timing.CallDelayed(1f, delegate + { + Log.Debug($"teleporting {player.Nickname} to {room.Name}"); player.Teleport(room); - } + }); + + } + } From 836d9b2c98102a3ce0c0596276354bce7f1ad26d Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Wed, 6 Aug 2025 09:00:44 +0200 Subject: [PATCH 316/853] our own ability yippee --- .../API/Features/KEAbilities.cs | 303 ++++++++++++++++++ .../API/Features/KECustomRole.cs | 81 ++++- .../KE.CustomRoles/Abilities/Airstrike.cs | 13 +- .../KE.CustomRoles/Abilities/Convert.cs | 12 +- .../Abilities/SelectPosition.cs | 19 +- .../KE.CustomRoles/Abilities/TestRotateCam.cs | 63 ---- .../KE.CustomRoles/Abilities/Trade.cs | 16 +- KruacentExiled/KE.CustomRoles/CR/MTF/Pilot.cs | 8 +- .../KE.CustomRoles/CR/SCP/ZombieDoorman.cs | 5 - .../CR/Scientist/GambleAddict.cs | 5 +- KruacentExiled/KE.CustomRoles/Config.cs | 2 + KruacentExiled/KE.CustomRoles/Controller.cs | 76 ----- .../KE.CustomRoles/KE.CustomRoles.csproj | 4 +- KruacentExiled/KE.CustomRoles/MainPlugin.cs | 21 +- .../KE.CustomRoles/Settings/SettingHandler.cs | 183 +---------- 15 files changed, 441 insertions(+), 370 deletions(-) create mode 100644 KruacentExiled/KE.CustomRoles/API/Features/KEAbilities.cs delete mode 100644 KruacentExiled/KE.CustomRoles/Abilities/TestRotateCam.cs delete mode 100644 KruacentExiled/KE.CustomRoles/Controller.cs diff --git a/KruacentExiled/KE.CustomRoles/API/Features/KEAbilities.cs b/KruacentExiled/KE.CustomRoles/API/Features/KEAbilities.cs new file mode 100644 index 00000000..ac9cad84 --- /dev/null +++ b/KruacentExiled/KE.CustomRoles/API/Features/KEAbilities.cs @@ -0,0 +1,303 @@ +using Exiled.API.Features; +using Exiled.API.Features.Core.UserSettings; +using Exiled.CustomRoles.API.Features; +using Exiled.Events.EventArgs.Player; +using KE.Utils.API; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Reflection; +using UserSettings.ServerSpecific; + +namespace KE.CustomRoles.API.Features +{ + /// + /// Our version of the + /// + public abstract class KEAbilities + { + #region static stuff + private static HashSet registered = new(); + public static HashSet Registered => registered; + #endregion + + #region abstract stuff + public abstract string Name { get; } + public abstract string Description { get; } + /// + /// Used for the settings option + /// + public abstract int Id { get; } + /// + /// in seconds + /// + public abstract float Cooldown { get; } + #endregion + + private Dictionary LastUsed = new(); + private static Dictionary TypeToAbility { get; } = new(); + private static HeaderSetting header = new(MainPlugin.Configs.HeaderId,"Abilities"); + private SettingBase setting; + public HashSet Players { get; } = new HashSet(); + + + protected KEAbilities() + { + + } + public void Init() + { + SettingBase old = SettingBase.List.Where(s => s.Id == Id).FirstOrDefault(); + + if(old == null) + { + Log.Debug("creating keybind"); + setting = new KeybindSetting(Id, Name, UnityEngine.KeyCode.None,hintDescription:Description,header: header); + SettingBase.Register([setting]); + } + else + { + Log.Error($"setting of {this} have the same id as {old.Label}"); + } + TypeToAbility.Add(GetType(), this); + InternalSubscribeEvent(); + } + + public void Destroy() + { + Func p = null; + SettingBase.Unregister(p, [setting]); + InternalUnsubcribeEvent(); + } + + private void InternalSubscribeEvent() + { + + ServerSpecificSettingsSync.ServerOnSettingValueReceived += SafeOnSettingValueReceived; + Exiled.Events.Handlers.Player.Verified += OnVerified; + SubscribeEvents(); + } + + private void InternalUnsubcribeEvent() + { + ServerSpecificSettingsSync.ServerOnSettingValueReceived -= SafeOnSettingValueReceived; + Exiled.Events.Handlers.Player.Verified -= OnVerified; + UnsubscribeEvents(); + } + + private void SafeOnSettingValueReceived(ReferenceHub hub, ServerSpecificSettingBase settingBase) + { + //not catching the exception will desync & kick the player + try + { + OnSettingValueReceived(Player.Get(hub), settingBase); + } + catch (Exception e) + { + Log.Error(e); + } + } + + private void OnSettingValueReceived(Player player, ServerSpecificSettingBase settingBase) + { + if (!CheckPressed(settingBase)) return; + if (!Check(player)) return; + + + + if(CanUse(player,out string _)) + { + UseAbility(player); + } + } + + private void OnVerified(VerifiedEventArgs ev) + { + ServerSpecificSettingsSync.SendToPlayer(ev.Player.ReferenceHub); + } + + protected virtual void SubscribeEvents() + { + + } + + protected virtual void UnsubscribeEvents() + { + + } + + protected virtual void AbilityUsed(Player player) + { + + } + + protected virtual void AbilityAdded(Player player) + { + + } + protected virtual void AbilityRemoved(Player player) + { + + } + + + public void RemoveAbility(Player player) + { + Log.Debug($"player {player.Nickname} lost {this}"); + if (Players.Remove(player)) + { + AbilityRemoved(player); + } + } + public void AddAbility(Player player) + { + + bool result = Players.Add(player); + Log.Debug($"player {player.Nickname} got {this} ({result})"); + if (result) + { + AbilityAdded(player); + } + + } + public void UseAbility(Player player) + { + LastUsed[player] = DateTime.Now; + + + AbilityUsed(player); + } + + public bool Check(Player player) + { + if(player is not null) + { + return Players.Contains(player); + } + return false; + } + + public bool CanUse(Player player, out string result) + { + if (player == null) + { + result = "player null"; + return false; + } + if (!Players.Contains(player)) + { + result = "cannot use this"; + return false; + } + + if (!LastUsed.ContainsKey(player)) + { + result = "never used"; + return true; + } + + DateTime dateTime = LastUsed[player] + TimeSpan.FromSeconds(Cooldown); + if (DateTime.Now > dateTime) + { + result = "ok"; + return true; + } + result = "in cooldown"; + return false; + } + + public bool CheckPressed(ServerSpecificSettingBase settingBase) + { + return CheckPressed(settingBase, setting.Id); + } + + public static bool TryAddToPlayer(Type typeAbility,Player player) + { + if (!TypeToAbility.TryGetValue(typeAbility, out var ability)) return false; + + + ability.AddAbility(player); + return true; + + + } + + public static bool CheckPressed(ServerSpecificSettingBase settingBase, int id) + { + return settingBase is SSKeybindSetting keybindSetting && keybindSetting.SettingId == id && keybindSetting.SyncIsPressed; + } + + #region register + private bool TryRegister() + { + + + if (!Registered.Contains(this)) + { + Registered.Add(this); + Init(); + Log.Debug("registered " + Name); + return true; + } + + + + return false; + } + + + public static IEnumerable Register(Assembly assembly =null) + { + IEnumerable abilities = ReflectionHelper.GetObjects(assembly); + List result = abilities.ToList(); + + foreach(KEAbilities ability in abilities) + { + + if (!ability.TryRegister()) + { + Log.Warn("couldn't register KEability " + ability); + result.Remove(ability); + } + + } + registered = result.ToHashSet(); + return result; + + } + + + private bool TryUnregister() + { + Destroy(); + if (Registered.Remove(this)) + { + Log.Debug("unregistered " + this); + return true; + } + Log.Warn(this + " was not registered"); + return false; + } + + public static IEnumerable Unregister() + { + List list = new(); + foreach (KEAbilities item in Registered) + { + item.TryUnregister(); + list.Add(item); + } + + return list; + } + #endregion + + + + public override string ToString() + { + return Name; + } + + } +} diff --git a/KruacentExiled/KE.CustomRoles/API/Features/KECustomRole.cs b/KruacentExiled/KE.CustomRoles/API/Features/KECustomRole.cs index e6277975..782010d0 100644 --- a/KruacentExiled/KE.CustomRoles/API/Features/KECustomRole.cs +++ b/KruacentExiled/KE.CustomRoles/API/Features/KECustomRole.cs @@ -1,7 +1,9 @@ -using Exiled.API.Enums; +using Discord; +using Exiled.API.Enums; using Exiled.API.Extensions; using Exiled.API.Features; using Exiled.API.Features.Pools; +using Exiled.CustomRoles.API; using Exiled.CustomRoles.API.Features; using Exiled.Events.Commands.PluginManager; using Exiled.Events.EventArgs.Player; @@ -10,8 +12,10 @@ using MEC; using PlayerRoles; using PlayerRoles.FirstPersonControl.Thirdperson; +using System; using System.Collections.Generic; using System.Drawing; +using System.Linq; using System.Security.Cryptography; using System.Text; using UnityEngine; @@ -38,7 +42,7 @@ public override string Name public sealed override string CustomInfo { get; set; } public abstract string PublicName { get; set; } - + public virtual HashSet Abilities { get; } public sealed override bool IgnoreSpawnSystem { get; set; } = true; protected override void ShowMessage(Player player) @@ -60,7 +64,7 @@ protected override void ShowMessage(Player player) DisplayHandler.Instance.AddHint(MainPlugin.CRHint, player, msg, delay); } - + protected void ShowEffectHint(Player player, string text) { @@ -141,6 +145,15 @@ public override void AddRole(Player player) } } + + if(Abilities != null) + { + foreach(Type ability in Abilities) + { + KEAbilities.TryAddToPlayer(ability, player2); + } + } + ShowMessage(player2); ShowBroadcast(player2); RoleAdded(player2); @@ -182,7 +195,67 @@ public override void AddRole(Player player) - + + #region Spawn + + /// + /// The chance to get a at the start or a respawn + /// + public static int Chance = 40; + + private static CustomRole AssignRole(Dictionary roleChances) + { + float totalWeight = roleChances.Values.Sum(); + float randomValue = UnityEngine.Random.Range(0f, totalWeight); + + foreach (var role in roleChances) + { + randomValue -= role.Value; + if (randomValue <= 0) + return role.Key; + } + + return roleChances.Keys.First(); + } + + public static Dictionary GetAvailableCustomRole(Player player) + { + return Registered.Where(c => c.Role == player.Role || c is GlobalCustomRole cgr && cgr.Side == SideClass.Get(player.Role.Side)).ToDictionary(c => c, c => c.SpawnChance); + } + + public static void GiveRandomRole(Player player) + { + if (player == null) + return; + if (UnityEngine.Random.Range(0, 101) > Chance) + { + Log.Debug("no luck"); + return; + } + + if(player.GetCustomRoles().Count != 0) + { + Log.Debug("already got a cr"); + return; + } + + + CustomRole cr = AssignRole(GetAvailableCustomRole(player)); + Log.Debug($"{player.Id} : {cr.Name}"); + + //error assigning cr to a player with a gcr + cr?.AddRole(player); + } + + public static void GiveRole(IEnumerable players) + { + foreach (Player p in players) + { + GiveRandomRole(p); + } + } + #endregion + } } diff --git a/KruacentExiled/KE.CustomRoles/Abilities/Airstrike.cs b/KruacentExiled/KE.CustomRoles/Abilities/Airstrike.cs index a55df2f4..0ba62218 100644 --- a/KruacentExiled/KE.CustomRoles/Abilities/Airstrike.cs +++ b/KruacentExiled/KE.CustomRoles/Abilities/Airstrike.cs @@ -4,6 +4,7 @@ using Exiled.API.Features.Pickups.Projectiles; using Exiled.API.Features.Toys; using Exiled.CustomRoles.API.Features; +using KE.CustomRoles.API.Features; using MapGeneration; using MEC; using System; @@ -16,16 +17,14 @@ namespace KE.CustomRoles.Abilities { - [CustomAbility] - public class Airstrike : ActiveAbility + public class Airstrike : KEAbilities { - public override string Name { get; set; } = "Airstrike"; + public override string Name { get; } = "Airstrike"; - public override string Description { get; set; } = "Don't overuse it or your co-op will not be happy"; + public override string Description { get; } = "Don't overuse it or your co-op will not be happy"; - public override float Duration { get; set; } = 0f; - - public override float Cooldown { get; set; } = 0f; + public override int Id => 2001; + public override float Cooldown { get; } = 0f; public float height = 5; diff --git a/KruacentExiled/KE.CustomRoles/Abilities/Convert.cs b/KruacentExiled/KE.CustomRoles/Abilities/Convert.cs index 301ebf63..790ecac9 100644 --- a/KruacentExiled/KE.CustomRoles/Abilities/Convert.cs +++ b/KruacentExiled/KE.CustomRoles/Abilities/Convert.cs @@ -1,6 +1,7 @@ using Exiled.API.Features; using Exiled.API.Features.Attributes; using Exiled.CustomRoles.API.Features; +using KE.CustomRoles.API.Features; using PlayerRoles; using System; using System.Collections.Generic; @@ -11,16 +12,15 @@ namespace KE.CustomRoles.Abilities { - [CustomAbility] - public class Convert : ActiveAbility + public class Convert : KEAbilities { - public override string Name { get; set; } = "Convert"; + public override string Name { get; } = "Convert"; - public override string Description { get; set; } = ""; + public override string Description { get; } = ""; - public override float Duration { get; set; } = 0f; + public override int Id => 2004; - public override float Cooldown { get; set; } = 10*60f; + public override float Cooldown { get; } = 10*60f; public float MaxDistance { get; set; } = 5f; diff --git a/KruacentExiled/KE.CustomRoles/Abilities/SelectPosition.cs b/KruacentExiled/KE.CustomRoles/Abilities/SelectPosition.cs index b90024b6..eae09322 100644 --- a/KruacentExiled/KE.CustomRoles/Abilities/SelectPosition.cs +++ b/KruacentExiled/KE.CustomRoles/Abilities/SelectPosition.cs @@ -1,6 +1,8 @@ using Exiled.API.Features; using Exiled.API.Features.Attributes; using Exiled.CustomRoles.API.Features; +using KE.CustomRoles.API.Features; +using KE.CustomRoles.API.Interfaces; using System; using System.Collections.Generic; using System.Linq; @@ -10,24 +12,23 @@ namespace KE.CustomRoles.Abilities { - [CustomAbility] - public class SelectPosition : ActiveAbility + public class SelectPosition : KEAbilities { - public override string Name { get; set; } = "SetPosition"; + public override string Name { get; } = "SetPosition"; - public override string Description { get; set; } = "Select the current position for another ability"; - - public override float Duration { get; set; } = 0f; - - public override float Cooldown { get; set; } = 0; + public override string Description { get; } = "Select the current position for another ability"; + public override int Id => 2000; + public override float Cooldown { get; } = 0; private static Dictionary SelectedTarget = new(); protected override void AbilityUsed(Player player) { - if (SelectedPlayers.Contains(player)) + + + if (SelectedTarget.ContainsKey(player)) { SelectedTarget[player] = player.Position; } diff --git a/KruacentExiled/KE.CustomRoles/Abilities/TestRotateCam.cs b/KruacentExiled/KE.CustomRoles/Abilities/TestRotateCam.cs deleted file mode 100644 index 874514cb..00000000 --- a/KruacentExiled/KE.CustomRoles/Abilities/TestRotateCam.cs +++ /dev/null @@ -1,63 +0,0 @@ -using Exiled.API.Extensions; -using Exiled.API.Features; -using Exiled.API.Features.Attributes; -using Exiled.CustomRoles.API.Features; -using Exiled.Events.EventArgs.Player; -using MEC; -using System.Collections.Generic; -using UnityEngine; - -namespace KE.CustomRoles.Abilities -{ - [CustomAbility] - internal class TestRotateCam : ActiveAbility - { - public override string Name { get; set; } = "TestRotateCam"; - - public override string Description { get; set; } = "TestRotateCam"; - - public override float Duration { get; set; } = 0f; - - public override float Cooldown { get; set; } = 45f; - private List _players = new List(); - - protected override void AbilityUsed(Player player) - { - //player.ShowHint("interact with a door to open it", 5f); - player.CameraTransform.Rotate(new Vector3(0, 180, 0)); - - - - } - - protected override void SubscribeEvents() - { - Exiled.Events.Handlers.Player.InteractingDoor += OnInteractingDoor; - base.SubscribeEvents(); - } - - protected override void UnsubscribeEvents() - { - Exiled.Events.Handlers.Player.InteractingDoor -= OnInteractingDoor; - base.UnsubscribeEvents(); - } - - private void OnInteractingDoor(InteractingDoorEventArgs ev) - { - if (!_players.Contains(ev.Player)) return; - if (ev.Door.IsOpen) return; - if (!ev.Door.IsKeycardDoor) return; - if (ev.Door.IsCheckpoint) return; - if (ev.Door.IsLocked) return; - - ev.IsAllowed = false; - ev.Player.ShowHint("The door will open in 5 seconds", 5f); - ev.Player.Hurt(ev.Player.MaxHealth / 10, Exiled.API.Enums.DamageType.Strangled); - _players.Remove(ev.Player); - Timing.CallDelayed(5f, () => - { - ev.Door.IsOpen = true; - }); - } - } -} diff --git a/KruacentExiled/KE.CustomRoles/Abilities/Trade.cs b/KruacentExiled/KE.CustomRoles/Abilities/Trade.cs index e64fa9ec..4465ea06 100644 --- a/KruacentExiled/KE.CustomRoles/Abilities/Trade.cs +++ b/KruacentExiled/KE.CustomRoles/Abilities/Trade.cs @@ -1,6 +1,7 @@ using Exiled.API.Features; using Exiled.API.Features.Attributes; using Exiled.CustomRoles.API.Features; +using KE.CustomRoles.API.Features; using System; using System.Collections.Generic; using System.Linq; @@ -10,16 +11,15 @@ namespace KE.CustomRoles.Abilities { - [CustomAbility] - public class Trade : ActiveAbility + public class Trade : KEAbilities { - public override string Name { get; set; } = "Trade"; + public override string Name { get; } = "Trade"; - public override string Description { get; set; } = "T'es lien avec le casino t'as permis d'avoir un peu plus de pièce contre un item ou pire"; + public override string Description { get; } = "T'es lien avec le casino t'as permis d'avoir un peu plus de pièce en échange d'un item ou de pire"; - public override float Duration { get; set; } = 0f; + public override int Id => 2002; - public override float Cooldown { get; set; } = 1f; + public override float Cooldown { get; } = 1f; public static float MaxHealthPercent = .1f; @@ -45,10 +45,6 @@ protected override void AbilityUsed(Player player) } player.AddItem(ItemType.Coin); - - - - } } diff --git a/KruacentExiled/KE.CustomRoles/CR/MTF/Pilot.cs b/KruacentExiled/KE.CustomRoles/CR/MTF/Pilot.cs index 7857fdac..c9a7b21a 100644 --- a/KruacentExiled/KE.CustomRoles/CR/MTF/Pilot.cs +++ b/KruacentExiled/KE.CustomRoles/CR/MTF/Pilot.cs @@ -39,14 +39,12 @@ public class Pilot : KECustomRole { AmmoType.Nato9, 100} }; - - public override List CustomAbilities { get; set; } = new() + public override HashSet Abilities { get; } = new() { - new SelectPosition(), - new Airstrike() + typeof(SelectPosition), + typeof(Airstrike) }; - } } diff --git a/KruacentExiled/KE.CustomRoles/CR/SCP/ZombieDoorman.cs b/KruacentExiled/KE.CustomRoles/CR/SCP/ZombieDoorman.cs index 3464a320..f02f6d92 100644 --- a/KruacentExiled/KE.CustomRoles/CR/SCP/ZombieDoorman.cs +++ b/KruacentExiled/KE.CustomRoles/CR/SCP/ZombieDoorman.cs @@ -25,11 +25,6 @@ internal class ZombieDoorman : CustomRole public override bool IgnoreSpawnSystem { get; set; } = true; public override float SpawnChance { get; set; } = 100; - public override List CustomAbilities { get; set; } = new List() - { - new OpenDoor(), - new TestRotateCam() - }; protected override void RoleAdded(Player player) diff --git a/KruacentExiled/KE.CustomRoles/CR/Scientist/GambleAddict.cs b/KruacentExiled/KE.CustomRoles/CR/Scientist/GambleAddict.cs index db3c0f6b..c32cad88 100644 --- a/KruacentExiled/KE.CustomRoles/CR/Scientist/GambleAddict.cs +++ b/KruacentExiled/KE.CustomRoles/CR/Scientist/GambleAddict.cs @@ -3,6 +3,7 @@ using KE.CustomRoles.Abilities; using KE.CustomRoles.API.Features; using PlayerRoles; +using System; using System.Collections.Generic; using UnityEngine; @@ -28,9 +29,9 @@ internal class GambleAddict : KECustomRole $"{ItemType.Coin}", }; - public override List CustomAbilities { get; set; } = new() + public override HashSet Abilities { get; } = new() { - new Trade() + typeof(Trade) }; } } diff --git a/KruacentExiled/KE.CustomRoles/Config.cs b/KruacentExiled/KE.CustomRoles/Config.cs index b5634b10..480b748b 100644 --- a/KruacentExiled/KE.CustomRoles/Config.cs +++ b/KruacentExiled/KE.CustomRoles/Config.cs @@ -11,5 +11,7 @@ public class Config : IConfig { public bool IsEnabled { get; set; } = true; public bool Debug { get; set; } = true; + + public int HeaderId { get; set; } = 1000; } } diff --git a/KruacentExiled/KE.CustomRoles/Controller.cs b/KruacentExiled/KE.CustomRoles/Controller.cs deleted file mode 100644 index 4aef412c..00000000 --- a/KruacentExiled/KE.CustomRoles/Controller.cs +++ /dev/null @@ -1,76 +0,0 @@ -using Exiled.API.Extensions; -using Exiled.API.Features; -using Exiled.CustomRoles.API.Features; -using KE.CustomRoles.API.Features; -using PlayerRoles; -using System.Collections.Generic; -using System.Linq; -using Utils.NonAllocLINQ; - -namespace KE.CustomRoles -{ - internal class Controller - { - /// - /// The chance of having a CustomRole - /// - public const int Chance = 40; - - - internal Dictionary GetAvailableCustomRole(Player player) - { - return CustomRole.Registered.Where(c => c.Role == player.Role || c is GlobalCustomRole cgr && cgr.Side == SideClass.Get(player.Role.Side)).ToDictionary(c => c, c=> c.SpawnChance); - } - - - /// - /// Gives a CustomRole to a player - /// - /// - internal void GiveRole(Player player) - { - if (player == null) - return; - if (UnityEngine.Random.Range(0, 101) > Chance) - { - Log.Debug("no luck"); - return; - } - - - CustomRole cr = AssignRole(GetAvailableCustomRole(player)); - Log.Debug($"{player.Id} : {cr.Name}"); - - //error assigning cr to a player with a gcr - cr?.AddRole(player); - } - - private CustomRole AssignRole(Dictionary roleChances) - { - float totalWeight = roleChances.Values.Sum(); - float randomValue = UnityEngine.Random.Range(0f, totalWeight); - - foreach (var role in roleChances) - { - randomValue -= role.Value; - if (randomValue <= 0) - return role.Key; - } - - return roleChances.Keys.First(); - } - - - /// - /// Gives CustomRoles to multiple players - /// - /// - internal void GiveRole(IEnumerable players) - { - foreach (Player p in players) - { - GiveRole(p); - } - } - } -} \ No newline at end of file diff --git a/KruacentExiled/KE.CustomRoles/KE.CustomRoles.csproj b/KruacentExiled/KE.CustomRoles/KE.CustomRoles.csproj index 4bf4603a..d11ae7ff 100644 --- a/KruacentExiled/KE.CustomRoles/KE.CustomRoles.csproj +++ b/KruacentExiled/KE.CustomRoles/KE.CustomRoles.csproj @@ -5,7 +5,7 @@ - + @@ -19,7 +19,7 @@ - + diff --git a/KruacentExiled/KE.CustomRoles/MainPlugin.cs b/KruacentExiled/KE.CustomRoles/MainPlugin.cs index 238c4a0b..98703061 100644 --- a/KruacentExiled/KE.CustomRoles/MainPlugin.cs +++ b/KruacentExiled/KE.CustomRoles/MainPlugin.cs @@ -4,21 +4,25 @@ using Exiled.CustomRoles.API.Features; using Exiled.Events.EventArgs.Server; using HarmonyLib; +using KE.CustomRoles.API.Features; using KE.CustomRoles.Settings; using KE.Utils.API.Displays.DisplayMeow; using MEC; +using Microsoft.Win32; using System; +using System.Linq; namespace KE.CustomRoles { public class MainPlugin : Plugin { - public override string Name { get; } = "KE.CustomRoles"; + public override string Name => "KE.CustomRoles"; + public override string Prefix => "KE.CR"; public override string Author => "Patrique & OmerGS"; public override Version Version => new(1, 1, 0); public static MainPlugin Instance; - private Controller _controller; + public static Config Configs => Instance?.Config; public static readonly HintPlacement CRHint = new(0, 750); public static readonly HintPlacement CREffect = new(700, 300); public static readonly HintPlacement Abilities = new(0, 900,HintServiceMeow.Core.Enum.HintAlignment.Left); @@ -32,14 +36,14 @@ public override void OnEnabled() { Instance = this; - _controller = new Controller(); _settingHandler = new(); Harmony = new(Name); Harmony.PatchAll(); SettingHandler.SubscribeEvents(); + KEAbilities.Register(Assembly); CustomRole.RegisterRoles(false,null,true,Assembly); - this.SubscribeEvents(); + SubscribeEvents(); } @@ -50,9 +54,10 @@ public override void OnDisabled() SettingHandler.UnsubscribeEvents(); Harmony.UnpatchAll(); - this.UnsubscribeEvents(); + CustomAbility.UnregisterAbilities(); + KEAbilities.Unregister(); + UnsubscribeEvents(); _settingHandler = null; - _controller = null; Instance = null; } @@ -70,13 +75,13 @@ public void UnsubscribeEvents() public void CustomRoleImplement() { - _controller.GiveRole(Player.List); + KECustomRole.GiveRole(Player.List); } public void CustomRoleRespawning(RespawnedTeamEventArgs ev) { - _controller.GiveRole(ev.Players); + KECustomRole.GiveRole(ev.Players); } } } diff --git a/KruacentExiled/KE.CustomRoles/Settings/SettingHandler.cs b/KruacentExiled/KE.CustomRoles/Settings/SettingHandler.cs index e2c3b022..e6be1dd5 100644 --- a/KruacentExiled/KE.CustomRoles/Settings/SettingHandler.cs +++ b/KruacentExiled/KE.CustomRoles/Settings/SettingHandler.cs @@ -5,6 +5,7 @@ using Exiled.CustomRoles.API.Features; using Exiled.CustomRoles.API.Features.Enums; using Exiled.Events.EventArgs.Player; +using KE.CustomRoles.API.Interfaces; using KE.Utils.API.Interfaces; using System; using System.Collections.Generic; @@ -19,37 +20,36 @@ namespace KE.CustomRoles.Settings { internal class SettingHandler : IUsingEvents { + private int _idHeader = 148; private int _idTimeCustomRole = 144; private int _idDesc = 143; - private int _idkeybind = 145; - private int switchForwardId = 146; - private int switchBackwardId = 147; - private IReadOnlyCollection settings; + private List settings; + + + public SettingHandler() { + settings = new List() { - new HeaderSetting ("Custom Roles Hint Settings"), + new HeaderSetting (_idHeader,"Custom Roles Hint Settings"), new TwoButtonsSetting(_idDesc,"Descriptions","Disabled","Enabled",true,"hide/show the description the Custom Role "), new SliderSetting(_idTimeCustomRole,"Time shown",0,30,20), - new KeybindSetting(_idkeybind,"ability",UnityEngine.KeyCode.K), - new KeybindSetting(switchForwardId,"forward",UnityEngine.KeyCode.L), - new KeybindSetting(switchBackwardId,"backward",UnityEngine.KeyCode.J) }; } + + public void SubscribeEvents() { SettingBase.Register(settings); - ServerSpecificSettingsSync.ServerOnSettingValueReceived += SafeOnSettingValueReceived; Exiled.Events.Handlers.Player.Verified += OnVerified; } public void UnsubscribeEvents() { - ServerSpecificSettingsSync.ServerOnSettingValueReceived -= SafeOnSettingValueReceived; Exiled.Events.Handlers.Player.Verified -= OnVerified; SettingBase.Unregister(predicate:null, settings); } @@ -61,169 +61,6 @@ private void OnVerified(VerifiedEventArgs ev) ServerSpecificSettingsSync.SendToPlayer(ev.Player.ReferenceHub); } - - private void SafeOnSettingValueReceived(ReferenceHub hub, ServerSpecificSettingBase settingBase) - { - try - { - OnSettingValueReceived( hub, settingBase); - } - catch(Exception e) - { - Log.Error(e); - } - } - - private void OnSettingValueReceived(ReferenceHub hub, ServerSpecificSettingBase settingBase) - { - if (settingBase == null) - { - Log.Debug("setting null whar?"); - return; - } - Player p = Player.Get(hub); - if(p == null) - { - Log.Debug("no player"); - return; - } - //Log.Debug("get abilities"); - IEnumerable a = p.GetActiveAbilities(); - - if(a == null) - { - //Log.Debug("no abilities 1"); - return; - } - - List abilities = ListPool.Pool.Get(a); - - if (abilities.Count == 0) - { - //Log.Debug("no abilities 2"); - return; - } - //Log.Debug($" (prev : {abilities.Count}) get selected abilities"); - ActiveAbility currentAbility = GetSelectedAbility(p); - //Log.Debug("finish selected"); - ActiveAbility want = null; - - - - - int index = 0; - - //Log.Debug($" (prev : {currentAbility?.Name}) check press forward"); - if (CheckPressed(settingBase, switchForwardId)) - { - if (currentAbility != null) - { - index = abilities.IndexOf(currentAbility); - currentAbility.UnSelectAbility(p); - } - want = abilities[(index + 1) % abilities.Count]; - - - } - //Log.Debug($" check press backward"); - if (CheckPressed(settingBase, switchBackwardId)) - { - if (currentAbility != null) - { - index = abilities.IndexOf(currentAbility); - currentAbility.UnSelectAbility(p); - } - - if(index - 1 < 0) - { - want = abilities[abilities.Count -1]; - } - else - { - want = abilities[(index - 1) % abilities.Count]; - } - - - } - //Log.Debug($"select ability"); - want?.SelectAbility(p); - - currentAbility = GetSelectedAbility(p); - //Log.Debug(currentAbility.Name); - if (CheckPressed(settingBase,_idkeybind)) - { - if (CanUse(currentAbility,p, out var result)) - { - - currentAbility.UseAbility(p); - } - } - Log.Debug(currentAbility?.Name); - } - - public static ActiveAbility GetSelectedAbility(Player player) - { - Player player2 = player; - if (ActiveAbility.AllActiveAbilities.TryGetValue(player2, out HashSet value)) - { - //Log.Debug("got all abilities"); - // ActiveAbility sel = value.FirstOrDefault((ActiveAbility a) => a.Check(player2, CheckType.Selected)); - - foreach(ActiveAbility a in value) - { - //Log.Debug("checking "+ a?.Name); - if (a?.Check(player2, CheckType.Selected) ?? false) - { - //Log.Debug("found " + a.Name); - return a; - } - //Log.Debug("finish checking"); - } - } - - return null; - } - - private bool CanUse(ActiveAbility a, Player player, out string result) - { - if(a == null) - { - result = "abi null"; - return false; - } - if (player == null) - { - result = "player null"; - return false; - } - if (!a.SelectedPlayers.Contains(player)) - { - result = "no selected"; - return false; - } - - if (!a.LastUsed.ContainsKey(player)) - { - result = "already in"; - return true; - } - - DateTime dateTime = a.LastUsed[player] + TimeSpan.FromSeconds(a.Cooldown); - if (DateTime.Now > dateTime) - { - result = "ok"; - return true; - } - result = "in cooldown"; - return false; - } - - - public bool CheckPressed(ServerSpecificSettingBase settingBase,int id) - { - return settingBase is SSKeybindSetting keyindSetting && keyindSetting.SettingId == id && keyindSetting.SyncIsPressed; - } - internal float GetTime(Player p) { if (!SettingBase.TryGetSetting(p, _idTimeCustomRole, out var setting)) return 20; From 900a11f166884962a8ee237e5bfc9d97afbad070 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Fri, 8 Aug 2025 05:39:30 +0200 Subject: [PATCH 317/853] ability + cooldown showed on screen --- .../API/Features/KEAbilities.cs | 83 ++++++++++++++++++- .../KE.CustomRoles/Abilities/Airstrike.cs | 2 +- .../Abilities/SelectPosition.cs | 2 +- KruacentExiled/KE.CustomRoles/MainPlugin.cs | 2 +- 4 files changed, 83 insertions(+), 6 deletions(-) diff --git a/KruacentExiled/KE.CustomRoles/API/Features/KEAbilities.cs b/KruacentExiled/KE.CustomRoles/API/Features/KEAbilities.cs index ac9cad84..38047638 100644 --- a/KruacentExiled/KE.CustomRoles/API/Features/KEAbilities.cs +++ b/KruacentExiled/KE.CustomRoles/API/Features/KEAbilities.cs @@ -3,6 +3,9 @@ using Exiled.CustomRoles.API.Features; using Exiled.Events.EventArgs.Player; using KE.Utils.API; +using KE.Utils.API.Displays.DisplayMeow; +using MEC; +using PlayerRoles.Subroutines; using System; using System.Collections.Generic; using System.Linq; @@ -36,11 +39,14 @@ public abstract class KEAbilities private Dictionary LastUsed = new(); private static Dictionary TypeToAbility { get; } = new(); - private static HeaderSetting header = new(MainPlugin.Configs.HeaderId,"Abilities"); + private static HeaderSetting header; + private static bool flagHeader = false; private SettingBase setting; public HashSet Players { get; } = new HashSet(); + private static Dictionary> Show = new(); + protected KEAbilities() { @@ -51,14 +57,22 @@ public void Init() if(old == null) { + if (!flagHeader) + { + header = new(MainPlugin.Configs.HeaderId, "Abilities"); + SettingBase.Register([header]); + flagHeader = true; + } Log.Debug("creating keybind"); - setting = new KeybindSetting(Id, Name, UnityEngine.KeyCode.None,hintDescription:Description,header: header); + setting = new KeybindSetting(Id, Name, UnityEngine.KeyCode.None,hintDescription:Description); + SettingBase.Register([setting]); } else { Log.Error($"setting of {this} have the same id as {old.Label}"); } + StartLoop(); TypeToAbility.Add(GetType(), this); InternalSubscribeEvent(); } @@ -143,9 +157,12 @@ protected virtual void AbilityRemoved(Player player) public void RemoveAbility(Player player) { + Log.Debug($"player {player.Nickname} lost {this}"); - if (Players.Remove(player)) + if (Players.Contains(player)) { + Show[player].Remove(this); + Players.Remove(player); AbilityRemoved(player); } } @@ -156,6 +173,12 @@ public void AddAbility(Player player) Log.Debug($"player {player.Nickname} got {this} ({result})"); if (result) { + if(!Show.TryGetValue(player,out var _)) + { + Show.Add(player, new()); + } + Show[player].Add(this); + AbilityAdded(player); } @@ -293,6 +316,60 @@ public static IEnumerable Unregister() #endregion + #region gui + + + private static float UpdateTime = 1f; + private static bool flag = false; + private static void StartLoop() + { + if (!flag) + { + Timing.RunCoroutine(Loop()); + flag = true; + } + } + private static IEnumerator Loop() + { + while (true) + { + UpdateAllGUI(); + yield return Timing.WaitForSeconds(UpdateTime); + } + } + private static void UpdateAllGUI() + { + foreach(Player player in Show.Keys) + { + UpdateGUI(player); + } + } + private static void UpdateGUI(Player player) + { + string msg = ""; + + foreach (KEAbilities ability in Show[player]) + { + msg += $"{ability.Name} "; + if (ability.CanUse(player,out var output)) + { + msg += "[READY]"; + } + else + { + DateTime dateTime = ability.LastUsed[player] + TimeSpan.FromSeconds(ability.Cooldown); + msg += $"[{Math.Round((dateTime - DateTime.Now).TotalSeconds, 0)}s]"; + } + + + + msg += "\n"; + } + DisplayHandler.Instance.AddHint(MainPlugin.Abilities, player, msg, 1f); + } + + + #endregion public override string ToString() { diff --git a/KruacentExiled/KE.CustomRoles/Abilities/Airstrike.cs b/KruacentExiled/KE.CustomRoles/Abilities/Airstrike.cs index 0ba62218..1af25274 100644 --- a/KruacentExiled/KE.CustomRoles/Abilities/Airstrike.cs +++ b/KruacentExiled/KE.CustomRoles/Abilities/Airstrike.cs @@ -24,7 +24,7 @@ public class Airstrike : KEAbilities public override string Description { get; } = "Don't overuse it or your co-op will not be happy"; public override int Id => 2001; - public override float Cooldown { get; } = 0f; + public override float Cooldown { get; } = 60f; public float height = 5; diff --git a/KruacentExiled/KE.CustomRoles/Abilities/SelectPosition.cs b/KruacentExiled/KE.CustomRoles/Abilities/SelectPosition.cs index eae09322..88224f1d 100644 --- a/KruacentExiled/KE.CustomRoles/Abilities/SelectPosition.cs +++ b/KruacentExiled/KE.CustomRoles/Abilities/SelectPosition.cs @@ -19,7 +19,7 @@ public class SelectPosition : KEAbilities public override string Description { get; } = "Select the current position for another ability"; public override int Id => 2000; - public override float Cooldown { get; } = 0; + public override float Cooldown { get; } = 5f; private static Dictionary SelectedTarget = new(); diff --git a/KruacentExiled/KE.CustomRoles/MainPlugin.cs b/KruacentExiled/KE.CustomRoles/MainPlugin.cs index 98703061..2487ef26 100644 --- a/KruacentExiled/KE.CustomRoles/MainPlugin.cs +++ b/KruacentExiled/KE.CustomRoles/MainPlugin.cs @@ -25,7 +25,7 @@ public class MainPlugin : Plugin public static Config Configs => Instance?.Config; public static readonly HintPlacement CRHint = new(0, 750); public static readonly HintPlacement CREffect = new(700, 300); - public static readonly HintPlacement Abilities = new(0, 900,HintServiceMeow.Core.Enum.HintAlignment.Left); + public static readonly HintPlacement Abilities = new(0, 950,HintServiceMeow.Core.Enum.HintAlignment.Left); public static Translations Translations => Instance?.Translation; private SettingHandler _settingHandler; internal static SettingHandler SettingHandler => Instance?._settingHandler; From 4ef79835f2bb0ab397a86abf13a8cafe2af3f904 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Fri, 8 Aug 2025 18:48:35 +0200 Subject: [PATCH 318/853] bug --- KruacentExiled/KE.CustomRoles/API/Features/KEAbilities.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/KruacentExiled/KE.CustomRoles/API/Features/KEAbilities.cs b/KruacentExiled/KE.CustomRoles/API/Features/KEAbilities.cs index 38047638..32a17441 100644 --- a/KruacentExiled/KE.CustomRoles/API/Features/KEAbilities.cs +++ b/KruacentExiled/KE.CustomRoles/API/Features/KEAbilities.cs @@ -161,6 +161,7 @@ public void RemoveAbility(Player player) Log.Debug($"player {player.Nickname} lost {this}"); if (Players.Contains(player)) { + //not removed when changing role Show[player].Remove(this); Players.Remove(player); AbilityRemoved(player); From 70fad13e1064c125f07393ea018077e56f0e7c5c Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Tue, 12 Aug 2025 14:24:01 +0200 Subject: [PATCH 319/853] fixed the abilities not removed when changing cr --- .../KE.CustomRoles/API/Features/KEAbilities.cs | 10 +++++++++- .../KE.CustomRoles/API/Features/KECustomRole.cs | 9 ++++++++- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/KruacentExiled/KE.CustomRoles/API/Features/KEAbilities.cs b/KruacentExiled/KE.CustomRoles/API/Features/KEAbilities.cs index 32a17441..b9a650cd 100644 --- a/KruacentExiled/KE.CustomRoles/API/Features/KEAbilities.cs +++ b/KruacentExiled/KE.CustomRoles/API/Features/KEAbilities.cs @@ -161,7 +161,6 @@ public void RemoveAbility(Player player) Log.Debug($"player {player.Nickname} lost {this}"); if (Players.Contains(player)) { - //not removed when changing role Show[player].Remove(this); Players.Remove(player); AbilityRemoved(player); @@ -246,6 +245,15 @@ public static bool TryAddToPlayer(Type typeAbility,Player player) } + public static void TryRemoveFromPlayer(Player player) + { + foreach(KEAbilities abilities in Registered) + { + abilities.RemoveAbility(player); + } + } + + public static bool CheckPressed(ServerSpecificSettingBase settingBase, int id) { return settingBase is SSKeybindSetting keybindSetting && keybindSetting.SettingId == id && keybindSetting.SyncIsPressed; diff --git a/KruacentExiled/KE.CustomRoles/API/Features/KECustomRole.cs b/KruacentExiled/KE.CustomRoles/API/Features/KECustomRole.cs index 782010d0..e5118996 100644 --- a/KruacentExiled/KE.CustomRoles/API/Features/KECustomRole.cs +++ b/KruacentExiled/KE.CustomRoles/API/Features/KECustomRole.cs @@ -185,8 +185,15 @@ public override void AddRole(Player player) player2.SendConsoleMessage(StringBuilderPool.Pool.ToStringReturn(stringBuilder), "green"); } + public override void RemoveRole(Player player) + { + if (Abilities != null) + { + KEAbilities.TryRemoveFromPlayer(player); + } + base.RemoveRole(player); + } - /// /// The chance of having this role NOT the chance to have a role From b2b9a70ced8d171a00f0e9f3d693e81eb04a6d41 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Tue, 12 Aug 2025 14:52:31 +0200 Subject: [PATCH 320/853] gamlbin:! --- KruacentExiled/KE.Map/GamblingZone/GamblingRoom.cs | 11 +++++------ KruacentExiled/KE.Map/MainPlugin.cs | 2 +- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/KruacentExiled/KE.Map/GamblingZone/GamblingRoom.cs b/KruacentExiled/KE.Map/GamblingZone/GamblingRoom.cs index 1bfd87e7..6a2708fa 100644 --- a/KruacentExiled/KE.Map/GamblingZone/GamblingRoom.cs +++ b/KruacentExiled/KE.Map/GamblingZone/GamblingRoom.cs @@ -32,7 +32,7 @@ internal GamblingRoom(Door door, LootTable lootTable, Vector3? offset = null) { Init(door.Position, lootTable,offset); } - + internal GamblingRoom(Vector3 position, LootTable lootTable, Vector3? offset = null) { Init(position, lootTable, offset); @@ -48,11 +48,11 @@ private void Init(Vector3 position,LootTable lootTable,Vector3? offset = null) _position = position + (offset ?? new Vector3()); _list.Add(this); - _pickup = new InteractiblePickup(ItemType.Medkit, _position+ Vector3.up, new Vector3(1,0,1)*3, _pickupTime, new()); + _pickup = new InteractiblePickup(ItemType.Medkit, _position, new Vector3(1,0,1)*3, _pickupTime, new()); _pickup.AddAction(OnPickup); - //CreateModel(_position); + CreateModel(_position); _lootTable = lootTable; } @@ -61,12 +61,11 @@ private void CreateModel(Vector3 positionWithOffset) { _model = new() { - Primitive.Create(PrimitiveType.Sphere,positionWithOffset,null,null,true,Color.red), - Primitive.Create(PrimitiveType.Cube,positionWithOffset,null,new(2,.5f,2),true) + Primitive.Create(PrimitiveType.Cube,positionWithOffset,null,null,true,Color.black), }; foreach(Primitive p in _model) { - p.Collidable = true; + p.Collidable = false; } } diff --git a/KruacentExiled/KE.Map/MainPlugin.cs b/KruacentExiled/KE.Map/MainPlugin.cs index c8e16ef5..b9abfa30 100644 --- a/KruacentExiled/KE.Map/MainPlugin.cs +++ b/KruacentExiled/KE.Map/MainPlugin.cs @@ -115,7 +115,7 @@ private void OnGenerated() }; - var g = new GamblingRoom(RoleTypeId.Scp173.GetRandomSpawnLocation().Position + Vector3.down*2, new(normal)); + var g = new GamblingRoom(RoleTypeId.Scp173.GetRandomSpawnLocation().Position + Vector3.down, new(normal)); //var g = new GamblingRoom(lcz173, new(normal), -lcz173.Transform.forward * 5f); From a63518f1b56ca3129016cd369f7657b78d959552 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Tue, 12 Aug 2025 17:16:39 +0200 Subject: [PATCH 321/853] removed "some" ammo from Russe --- KruacentExiled/KE.CustomRoles/CR/ChaosInsurgency/LeRusse.cs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/KruacentExiled/KE.CustomRoles/CR/ChaosInsurgency/LeRusse.cs b/KruacentExiled/KE.CustomRoles/CR/ChaosInsurgency/LeRusse.cs index 615c2116..5d406b07 100644 --- a/KruacentExiled/KE.CustomRoles/CR/ChaosInsurgency/LeRusse.cs +++ b/KruacentExiled/KE.CustomRoles/CR/ChaosInsurgency/LeRusse.cs @@ -29,12 +29,11 @@ internal class Russe : KECustomRole $"{ItemType.KeycardChaosInsurgency}", $"{ItemType.GrenadeHE}", $"{ItemType.GrenadeHE}", - $"{ItemType.GrenadeHE}" }; public override Dictionary Ammo { get; set; } = new Dictionary() { - { AmmoType.Ammo44Cal, 100} + { AmmoType.Ammo44Cal, 18} }; } } From 081e121217b9cec3f7a6941d6991e13ff55004bf Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Fri, 15 Aug 2025 16:40:03 +0200 Subject: [PATCH 322/853] auto079 --- .../Features/Auto079/Danger/DangerLevels.cs | 82 ++++++++++++ .../KE.Misc/Features/Auto079/Jobs/Job.cs | 34 +++++ .../Features/Auto079/Jobs/JoeManager.cs | 118 +++++++++++++++++ .../Features/Auto079/Jobs/LiberateScp.cs | 33 +++++ .../KE.Misc/Features/Auto079/Jobs/ScanZone.cs | 119 ++++++++++++++++++ .../Features/Auto079/Jobs/StuckWithScp.cs | 37 ++++++ .../KE.Misc/Features/Auto079/NPC079.cs | 77 ++++++++++++ .../KE.Misc/Features/AutoElevator.cs | 4 +- .../KE.Misc/Handlers/ServerHandler.cs | 13 ++ KruacentExiled/KE.Misc/KE.Misc.csproj | 2 +- 10 files changed, 516 insertions(+), 3 deletions(-) create mode 100644 KruacentExiled/KE.Misc/Features/Auto079/Danger/DangerLevels.cs create mode 100644 KruacentExiled/KE.Misc/Features/Auto079/Jobs/Job.cs create mode 100644 KruacentExiled/KE.Misc/Features/Auto079/Jobs/JoeManager.cs create mode 100644 KruacentExiled/KE.Misc/Features/Auto079/Jobs/LiberateScp.cs create mode 100644 KruacentExiled/KE.Misc/Features/Auto079/Jobs/ScanZone.cs create mode 100644 KruacentExiled/KE.Misc/Features/Auto079/Jobs/StuckWithScp.cs create mode 100644 KruacentExiled/KE.Misc/Features/Auto079/NPC079.cs diff --git a/KruacentExiled/KE.Misc/Features/Auto079/Danger/DangerLevels.cs b/KruacentExiled/KE.Misc/Features/Auto079/Danger/DangerLevels.cs new file mode 100644 index 00000000..e2c78bf3 --- /dev/null +++ b/KruacentExiled/KE.Misc/Features/Auto079/Danger/DangerLevels.cs @@ -0,0 +1,82 @@ +using Exiled.API.Features.Items; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace KE.Misc.Features.Auto079.Danger +{ + public class DangerLevels + { + + public int Danger { get; } + + public IReadOnlyCollection Items { get; } + + + private DangerLevels(int danger, List items) + { + Danger = danger; + Items = items; + } + + + + public static DangerLevels GetDanger(List items) + { + int danger = 0; + + foreach(Item item in items) + { + danger += GetDangerItem(item); + } + + return new(danger, items); + + } + + public static int GetDangerItem(Item item) + { + int danger = 0; + + + if (item.IsFirearm) + { + danger += 2; + } + + if(item is MicroHid) + { + danger += 5; + } + + if(item is Jailbird) + { + danger += 3; + } + + + + switch (item.Type) + { + case ItemType.SCP207: + case ItemType.AntiSCP207: + danger += 2; + break; + case ItemType.ParticleDisruptor: + danger += 3; + break; + case ItemType.SCP018: + danger += 4; + break; + } + + + + return danger; + + + } + } +} diff --git a/KruacentExiled/KE.Misc/Features/Auto079/Jobs/Job.cs b/KruacentExiled/KE.Misc/Features/Auto079/Jobs/Job.cs new file mode 100644 index 00000000..0f547a63 --- /dev/null +++ b/KruacentExiled/KE.Misc/Features/Auto079/Jobs/Job.cs @@ -0,0 +1,34 @@ +using Exiled.API.Features; +using MEC; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace KE.Misc.Features.Auto079.Jobs +{ + public abstract class Job + { + /// + /// The base waiting time between 2 actions + /// + public const float WaitTime = .5f; + protected NPC079 npc; + + public CoroutineHandle Start(NPC079 npc) + { + Log.Debug("job name " + this.GetType().Name); + this.npc = npc; + return Timing.RunCoroutine(Started()); + + + } + + + + protected abstract IEnumerator Started(); + + + } +} diff --git a/KruacentExiled/KE.Misc/Features/Auto079/Jobs/JoeManager.cs b/KruacentExiled/KE.Misc/Features/Auto079/Jobs/JoeManager.cs new file mode 100644 index 00000000..2b7a712c --- /dev/null +++ b/KruacentExiled/KE.Misc/Features/Auto079/Jobs/JoeManager.cs @@ -0,0 +1,118 @@ +using Exiled.API.Features; +using Exiled.API.Features.Items; +using MEC; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace KE.Misc.Features.Auto079.Jobs +{ + public class JobManager + { + + private readonly List Queue = new(); + private readonly List PriorityQueue = new(); + public NPC079 npc; + + + + + + public Job defaultJob = new ScanZone(); + + + public JobManager(NPC079 npc) + { + this.npc = npc; + } + + + public void StartLoop() + { + Timing.RunCoroutineSingleton(QueueLoop(), handle, SingletonBehavior.AbortAndUnpause); + } + private IEnumerator QueueLoop() + { + Log.Debug("loop : "+ npc.Npc.IsAlive); + while (npc.Npc.IsAlive) + { + Log.Debug("in loop"); + + CoroutineHandle handle; + Job currentJob = null; + bool prioQueue = PriorityQueue.Count > 0; + + if(prioQueue) + { + handle = PriorityQueueLoop(out currentJob); + } + else + { + handle = NormalQueue(out currentJob); + + } + + + yield return Timing.WaitUntilDone(handle); + if (currentJob is not null) + { + if (prioQueue) + { + PriorityQueue.Remove(currentJob); + } + else + { + Queue.Remove(currentJob); + + } + } + + } + } + + + + private CoroutineHandle NormalQueue(out Job currentJob) + { + bool gotJob = Queue.Count > 0; + currentJob = null; + CoroutineHandle handle; + + if (gotJob) + { + currentJob = Queue[0]; + + + handle = currentJob.Start(npc); + } + else + { + handle = defaultJob.Start(npc); + } + return handle; + } + + + private CoroutineHandle PriorityQueueLoop(out Job currentJob) + { + currentJob = PriorityQueue[0]; + return currentJob.Start(npc); + + } + + public void AddToQueue(Job job) + { + Queue.Add(job); + } + + + public void AddToPriorityQueue(Job job) + { + PriorityQueue.Add(job); + } + + + } +} diff --git a/KruacentExiled/KE.Misc/Features/Auto079/Jobs/LiberateScp.cs b/KruacentExiled/KE.Misc/Features/Auto079/Jobs/LiberateScp.cs new file mode 100644 index 00000000..5756af57 --- /dev/null +++ b/KruacentExiled/KE.Misc/Features/Auto079/Jobs/LiberateScp.cs @@ -0,0 +1,33 @@ +using Exiled.API.Features; +using Exiled.API.Features.Doors; +using MEC; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace KE.Misc.Features.Auto079.Jobs +{ + public class LiberateScp : Job + { + + protected override IEnumerator Started() + { + + var lockedDoors = npc.Scp.CurrentRoom.Doors.Where(d => !d.IsOpen && d.RequiredPermissions != Interactables.Interobjects.DoorUtils.DoorPermissionFlags.ScpOverride).ToList(); + + foreach(Door d in lockedDoors) + { + + int cost = (int)Math.Ceiling((float)(npc.Role.DoorStateChanger.GetCostForDoor(Interactables.Interobjects.DoorUtils.DoorAction.Opened,d.Base)) / 2); + Log.Debug($"opening door {d.Name} ({cost})"); + + yield return Timing.WaitUntilTrue(() => cost < npc.Role.Energy); + d.IsOpen = true; + } + + + } + } +} diff --git a/KruacentExiled/KE.Misc/Features/Auto079/Jobs/ScanZone.cs b/KruacentExiled/KE.Misc/Features/Auto079/Jobs/ScanZone.cs new file mode 100644 index 00000000..3e571bf1 --- /dev/null +++ b/KruacentExiled/KE.Misc/Features/Auto079/Jobs/ScanZone.cs @@ -0,0 +1,119 @@ +using CustomPlayerEffects; +using Exiled.API.Enums; +using Exiled.API.Extensions; +using Exiled.API.Features; +using Exiled.API.Features.Items; +using MEC; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Security.Policy; +using Utils.NonAllocLINQ; +using Camera = Exiled.API.Features.Camera; + +namespace KE.Misc.Features.Auto079.Jobs +{ + public class ScanZone : Job + { + + private Dictionary> InventoryGuess => npc.InventoryGuess; + + + protected override IEnumerator Started() + { + + //List zones = ZoneOrder(); + List zones = new List() + { + ZoneType.HeavyContainment + }; + + + + foreach (ZoneType zone in zones) + { + + foreach (Camera camera in Camera.Get(c => c.Zone == zone)) + { + int cost = (int)Math.Ceiling((float)(npc.Role.GetSwitchCost(camera)/2)); + Log.Debug($"trying to switch to cam {camera.Name} ({cost})"); + + yield return Timing.WaitUntilTrue(() => cost < npc.Role.Energy); + npc.Role.Energy -= cost; + npc.Role.Camera = camera; + + + + + List scanned = ScanRoom(camera); + + Log.Debug($"{npc.Role.Energy} / {npc.Role.MaxEnergy}"); + yield return Timing.WaitForSeconds(WaitTime); + + foreach(Player p in scanned) + { + if (InventoryGuess.ContainsKey(p)) + { + InventoryGuess.Add(p, new()); + } + InventoryGuess[p].Add(p.CurrentItem); + + } + + + PingPlayer(scanned.FirstOrDefault()); + + + } + + } + + + } + + + + public void PingPlayer(Player playerToPing) + { + if (playerToPing is null) return; + Log.Debug($"ping {playerToPing.NetId} at {playerToPing.Position}"); + npc.TryPing(playerToPing.Position, PingType.Human); + } + + + + + public List ScanRoom(Camera camera) + { + List playerFound = new(); + //todo add blind spots + // eg 75% chance to be spotted when under a cam + if (!camera.Room.Players.IsEmpty()) + { + playerFound.AddRange(camera.Room.Players.Where(p => !p.IsScp)); + } + return playerFound; + } + + private List ZoneOrder() + { + List result = new(); + + + result.Add(npc.Scp.Zone); + + if (!Map.IsLczDecontaminated) + { + result.AddIfNotContains(ZoneType.LightContainment); + } + result.AddIfNotContains(ZoneType.HeavyContainment); + result.AddIfNotContains(ZoneType.Entrance); + result.AddIfNotContains(ZoneType.Surface); + + + return result; + + } + + } +} diff --git a/KruacentExiled/KE.Misc/Features/Auto079/Jobs/StuckWithScp.cs b/KruacentExiled/KE.Misc/Features/Auto079/Jobs/StuckWithScp.cs new file mode 100644 index 00000000..2f105797 --- /dev/null +++ b/KruacentExiled/KE.Misc/Features/Auto079/Jobs/StuckWithScp.cs @@ -0,0 +1,37 @@ +using Exiled.API.Features; +using MEC; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace KE.Misc.Features.Auto079.Jobs +{ + public class StuckWithScp : Job + { + + protected override IEnumerator Started() + { + + Room current = npc.Scp.CurrentRoom; + + List humanInSameRoom = current.Players.Where(p => !p.IsScp).ToList(); + + if (npc.MoveCamToScp()) + { + + } + + + } + + + private void EvaluateDanger() + { + + } + + + } +} diff --git a/KruacentExiled/KE.Misc/Features/Auto079/NPC079.cs b/KruacentExiled/KE.Misc/Features/Auto079/NPC079.cs new file mode 100644 index 00000000..a4a5a530 --- /dev/null +++ b/KruacentExiled/KE.Misc/Features/Auto079/NPC079.cs @@ -0,0 +1,77 @@ +using Exiled.API.Enums; +using Exiled.API.Extensions; +using Exiled.API.Features; +using Exiled.API.Features.Items; +using Exiled.API.Features.Roles; +using KE.Misc.Features.Auto079.Jobs; +using MEC; +using PlayerRoles; +using System.Collections.Generic; +using System.Linq; +using UnityEngine; +using Camera = Exiled.API.Features.Camera; +using NPCFeature = Exiled.API.Features.Npc; +namespace KE.Misc.Features.Auto079 +{ + public class NPC079 + { + public Npc Npc; + //the player that 079 will try to follow + public Player targetPlayer; + + public Player Scp; + + private JobManager JobManager; + public Scp079Role Role => Npc.Role.As(); + + public Dictionary> InventoryGuess = new(); + public NPC079() + { + Npc = Npc.Spawn("SCP-079-AI", RoleTypeId.Scp079); + Scp = Player.List.Where(p => p.IsScp && p.Role != RoleTypeId.Scp0492).FirstOrDefault(); + if (Scp is null) return; + + JobManager = new(this); + Scp079Role role = Npc.Role.As(); + + + Timing.CallDelayed(NPCFeature.SpawnSetRoleDelay, JobManager.StartLoop); + + + } + + + public bool TryPing(Vector3 position, PingType pingType = PingType.Default) + { + if (!Role.PingAbility.IsReady) + { + return false; + } + + Role.Ping(position, pingType,true); + return true; + + } + + + public bool MoveCamToScp() + { + Camera camera = Scp.CurrentRoom.Cameras.GetRandomValue(); + + int cost = Role.GetSwitchCost(camera); + + + if(cost > Role.Energy) + { + return false; + } + + Role.Energy -= cost; + Role.Camera = camera; + return true; + } + + + + } +} diff --git a/KruacentExiled/KE.Misc/Features/AutoElevator.cs b/KruacentExiled/KE.Misc/Features/AutoElevator.cs index 72557958..9c9944ad 100644 --- a/KruacentExiled/KE.Misc/Features/AutoElevator.cs +++ b/KruacentExiled/KE.Misc/Features/AutoElevator.cs @@ -29,7 +29,7 @@ public void StartLoop() /// private IEnumerator StartElevator() { - Log.Debug("elevator"); + //Log.Debug("elevator"); while (!Round.IsEnded) { foreach (Lift l in Lift.List) @@ -60,7 +60,7 @@ private IEnumerator StartElevator() private void SendElevator(Lift e) { - Log.Debug($"{e.Name}"); + //Log.Debug($"{e.Name}"); e.TryStart(0, true); } } diff --git a/KruacentExiled/KE.Misc/Handlers/ServerHandler.cs b/KruacentExiled/KE.Misc/Handlers/ServerHandler.cs index 8949c4cd..0aac5cd6 100644 --- a/KruacentExiled/KE.Misc/Handlers/ServerHandler.cs +++ b/KruacentExiled/KE.Misc/Handlers/ServerHandler.cs @@ -1,5 +1,7 @@ using System.Linq; +using Exiled.API.Enums; using Exiled.API.Features; +using KE.Misc.Features.Auto079; using MEC; namespace KE.Misc.Handlers @@ -7,6 +9,7 @@ namespace KE.Misc.Handlers internal class ServerHandler { private CoroutineHandle coroutineHandle; + NPC079 a; public void OnRoundStarted() { if (MainPlugin.Instance.Config.ChanceClassDDoorGoesBoom >= 0 && MainPlugin.Instance.Config.ChanceClassDDoorGoesBoom <= 100) @@ -21,6 +24,16 @@ public void OnRoundStarted() if (MainPlugin.Instance.Config.AutoElevator) MainPlugin.Instance.AutoElevator.StartLoop(); MainPlugin.Instance.SCPBuff.StartBuff(); + + + new NPC079(); + + + foreach(Player p in Player.List.Where(p => !p.IsNPC)) + { + p.Teleport(RoomType.Hcz939); + } + } } } diff --git a/KruacentExiled/KE.Misc/KE.Misc.csproj b/KruacentExiled/KE.Misc/KE.Misc.csproj index 2ff406e0..d5fb8ae1 100644 --- a/KruacentExiled/KE.Misc/KE.Misc.csproj +++ b/KruacentExiled/KE.Misc/KE.Misc.csproj @@ -6,7 +6,7 @@ - + From 491a7d244f29e250319123cd7fbd0cb4f53a810c Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Sat, 16 Aug 2025 14:57:13 +0200 Subject: [PATCH 323/853] images --- .../KE.Utils/API/GifAnimator/RenderGif.cs | 117 +----------------- .../KE.Utils/API/GifAnimator/TextImage.cs | 104 ++++++++++++++++ 2 files changed, 108 insertions(+), 113 deletions(-) create mode 100644 KruacentExiled/KE.Utils/API/GifAnimator/TextImage.cs diff --git a/KruacentExiled/KE.Utils/API/GifAnimator/RenderGif.cs b/KruacentExiled/KE.Utils/API/GifAnimator/RenderGif.cs index f4276d33..9edd4092 100644 --- a/KruacentExiled/KE.Utils/API/GifAnimator/RenderGif.cs +++ b/KruacentExiled/KE.Utils/API/GifAnimator/RenderGif.cs @@ -1,128 +1,19 @@ -using System.Collections.Generic; -using System.Drawing; -using System.Drawing.Imaging; -using System.IO; -using Exiled.API.Features; -using Exiled.API.Features.Toys; -using MEC; -using UnityEngine; -using UnityEngine.Rendering; -using Color = UnityEngine.Color; -namespace KE.Utils.API.GifAnimator +namespace KE.Utils.API.GifAnimator { - internal class RenderGif + public static class RenderGif { - public static void Spawn() + public static void Spawn(string path) { - - } - - - - private static IEnumerator RenderImageCoroutine(object target, string filePath, float maxWidth, float maxHeight, float distance, float duration, int targetWidth, int targetHeight) - { - if (!File.Exists(filePath)) - { - Log.Debug($"No image was found under: {filePath}"); - yield break; - } - - byte[] imageData = File.ReadAllBytes(filePath); - - - - - - Texture2D original = new Texture2D(2, 2); - try - { - original.LoadRawTextureData(imageData); - } - catch(UnityException) - { - Log.Debug("Image couldnt be loaded."); - yield break; - } - - Texture2D scaled = new Texture2D(targetWidth, targetHeight, TextureFormat.RGBA32, false); - - for (int x = 0; x < targetWidth; x++) - { - for (int y = 0; y < targetHeight; y++) - { - float u = x / (float)targetWidth; - float v = y / (float)targetHeight; - Color color = original.GetPixelBilinear(u, v); - scaled.SetPixel(x, y, color); - } - } - scaled.Apply(); - - float pixelScaleX = maxWidth / targetWidth; - float pixelScaleY = maxHeight / targetHeight; - float scale = Mathf.Min(pixelScaleX, pixelScaleY); - - Vector3 forwardOrigin; - Quaternion rotation = Quaternion.identity; - - if (target is Exiled.API.Features.Player player) - { - forwardOrigin = player.CameraTransform.position + player.CameraTransform.forward * distance; - - Vector3 directionToPlayer = forwardOrigin - player.CameraTransform.position; - directionToPlayer.y = 0; - rotation = Quaternion.LookRotation(directionToPlayer); - } - else if (target is Vector3 position) - { - forwardOrigin = position + Vector3.forward * distance; - Vector3 directionToPosition = forwardOrigin - position; - directionToPosition.y = 0; - rotation = Quaternion.LookRotation(directionToPosition); - } - else if (target is Room room) - { - forwardOrigin = room.Position + Vector3.up * 2f; - Vector3 directionToRoom = forwardOrigin - room.Position; - directionToRoom.y = 0; - rotation = Quaternion.LookRotation(directionToRoom); - } - else - { - Log.Debug("Invalid object type. Valid types: Player, Vector3, Room"); - yield break; - } - - Vector3 offset = new Vector3((targetWidth * scale) / 2f, (targetHeight * scale) / 2f, 0); + } - for (int x = 0; x < targetWidth; x++) - { - for (int y = 0; y < targetHeight; y++) - { - Color pixelColor = scaled.GetPixel(x, y); - if (pixelColor.a < 0.1f) - continue; - Vector3 localOffset = new Vector3(x * scale, y * scale, 0) - offset; - Vector3 worldPos = forwardOrigin + rotation * localOffset; - Primitive quad = Primitive.Create(PrimitiveType.Quad); - quad.Position = worldPos; - quad.Scale = new Vector3(scale, scale, scale * 0.01f); - quad.Color = pixelColor; - Quaternion fixedRotation = Quaternion.Euler(0f, rotation.eulerAngles.y, 0f); - quad.Rotation = fixedRotation; - quad.Flags = AdminToys.PrimitiveFlags.Visible; - } - yield return Timing.WaitForOneFrame; - } - } } } diff --git a/KruacentExiled/KE.Utils/API/GifAnimator/TextImage.cs b/KruacentExiled/KE.Utils/API/GifAnimator/TextImage.cs new file mode 100644 index 00000000..4e58bfec --- /dev/null +++ b/KruacentExiled/KE.Utils/API/GifAnimator/TextImage.cs @@ -0,0 +1,104 @@ +using System; +using System.Collections.Generic; +using System.Drawing.Imaging; +using System.Drawing; +using System.IO; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Exiled.API.Features.Pools; +using LabApi.Features.Wrappers; +using UnityEngine; +using Color = System.Drawing.Color; +using Exiled.API.Features.Toys; + +namespace KE.Utils.API.GifAnimator +{ + public class TextImage + { + + + private string rawString = string.Empty; + + + + public TextImage(Image img) + { + FrameDimension dimension = new FrameDimension(img.FrameDimensionsList[0]); + img.SelectActiveFrame(dimension, 0); + var b = new Bitmap(img); + + StringBuilder sb = StringBuilderPool.Pool.Get(); + for (int y = 0; y < b.Height; y++) + { + for (int x = 0; x < b.Width; x++) + { + Color pixelColor = b.GetPixel(x, y); + + sb.Append(PixelToString(pixelColor)); + } + sb.AppendLine(); + } + rawString = sb.ToString(); + + StringBuilderPool.Pool.Return(sb); + + } + + public void Spawn(Vector3 position, Quaternion? rotation = null,Vector3? scale = null, Transform parent = null) + { + + TextToy textToy = TextToy.Create(position, rotation ?? Quaternion.Euler(Vector3.zero), scale ?? Vector3.one , parent,false); + + textToy.TextFormat = rawString; + + textToy.Spawn(); + + } + + + + private void Animated(Image img) + { + FrameDimension dimension = new FrameDimension(img.FrameDimensionsList[0]); + int frameCount = img.GetFrameCount(dimension); + StringBuilder sb = StringBuilderPool.Pool.Get(); + for (int i = 0; i < frameCount; i++) + { + img.SelectActiveFrame(dimension, i); + var b = new Bitmap(img); + + for (int x = 0; x < b.Width; x++) + { + for (int y = 0; y < b.Height; y++) + { + Color pixelColor = b.GetPixel(x, y); + + sb.Append(PixelToString(pixelColor)); + } + } + + } + + rawString = sb.ToString(); + + StringBuilderPool.Pool.Return(sb); + } + + + private static string PixelToString(Color color) + { + return "█"; + } + + + private static string ToHexValue(Color color) + { + return "#" + color.R.ToString("X2") + + color.G.ToString("X2") + + color.B.ToString("X2") + + color.A.ToString("X2"); + } + + } +} From e321a70312ccdb440f9b3b2734fe0b13734c226e Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Tue, 19 Aug 2025 16:43:23 +0200 Subject: [PATCH 324/853] images now animated yippee --- .../Features/Auto079/Jobs/JoeManager.cs | 5 +- .../Features/Auto079/Jobs/StuckWithScp.cs | 4 +- .../KE.Misc/Handlers/ServerHandler.cs | 43 ++++- KruacentExiled/KE.Misc/MainPlugin.cs | 1 + .../KE.Misc/Utils/AnimatedTextImage.cs | 126 +++++++++++++ KruacentExiled/KE.Misc/Utils/ImageUtils.cs | 29 +++ KruacentExiled/KE.Misc/Utils/TextImage.cs | 166 ++++++++++++++++++ 7 files changed, 369 insertions(+), 5 deletions(-) create mode 100644 KruacentExiled/KE.Misc/Utils/AnimatedTextImage.cs create mode 100644 KruacentExiled/KE.Misc/Utils/ImageUtils.cs create mode 100644 KruacentExiled/KE.Misc/Utils/TextImage.cs diff --git a/KruacentExiled/KE.Misc/Features/Auto079/Jobs/JoeManager.cs b/KruacentExiled/KE.Misc/Features/Auto079/Jobs/JoeManager.cs index 2b7a712c..75de438b 100644 --- a/KruacentExiled/KE.Misc/Features/Auto079/Jobs/JoeManager.cs +++ b/KruacentExiled/KE.Misc/Features/Auto079/Jobs/JoeManager.cs @@ -16,8 +16,9 @@ public class JobManager private readonly List PriorityQueue = new(); public NPC079 npc; + private CoroutineHandle loopHandle; + - public Job defaultJob = new ScanZone(); @@ -31,7 +32,7 @@ public JobManager(NPC079 npc) public void StartLoop() { - Timing.RunCoroutineSingleton(QueueLoop(), handle, SingletonBehavior.AbortAndUnpause); + Timing.RunCoroutineSingleton(QueueLoop(), loopHandle, SingletonBehavior.AbortAndUnpause); } private IEnumerator QueueLoop() { diff --git a/KruacentExiled/KE.Misc/Features/Auto079/Jobs/StuckWithScp.cs b/KruacentExiled/KE.Misc/Features/Auto079/Jobs/StuckWithScp.cs index 2f105797..82a0c987 100644 --- a/KruacentExiled/KE.Misc/Features/Auto079/Jobs/StuckWithScp.cs +++ b/KruacentExiled/KE.Misc/Features/Auto079/Jobs/StuckWithScp.cs @@ -8,7 +8,7 @@ namespace KE.Misc.Features.Auto079.Jobs { - public class StuckWithScp : Job + /*public class StuckWithScp : Job { protected override IEnumerator Started() @@ -33,5 +33,5 @@ private void EvaluateDanger() } - } + }*/ } diff --git a/KruacentExiled/KE.Misc/Handlers/ServerHandler.cs b/KruacentExiled/KE.Misc/Handlers/ServerHandler.cs index 0aac5cd6..b3a19cae 100644 --- a/KruacentExiled/KE.Misc/Handlers/ServerHandler.cs +++ b/KruacentExiled/KE.Misc/Handlers/ServerHandler.cs @@ -1,8 +1,14 @@ -using System.Linq; +using System.Drawing; +using System.Linq; using Exiled.API.Enums; +using Exiled.API.Extensions; using Exiled.API.Features; using KE.Misc.Features.Auto079; +using KE.Misc.Utils; using MEC; +using PlayerRoles; +using UnityEngine; +using TextToy = LabApi.Features.Wrappers.TextToy; namespace KE.Misc.Handlers { @@ -26,6 +32,41 @@ public void OnRoundStarted() MainPlugin.Instance.SCPBuff.StartBuff(); + + string test = "test.png"; + string kel = "nokel.png"; + string tenna = "tennasmooving.gif"; + string smol = "smol.gif"; + + Image img = Image.FromFile(Paths.Configs + $"/{kel}"); + Image gif = Image.FromFile(Paths.Configs + $"/{tenna}"); + + + TextImage text = new TextImage(img); + AnimatedTextImage giftext = new(gif); + Vector3 basePos = RoleTypeId.Scp049.GetRandomSpawnLocation().Position; + + Round.IsLocked = true; + var pl = Player.List.FirstOrDefault(); + Timing.CallDelayed(2f, delegate + { + pl.Role.Set(RoleTypeId.NtfSpecialist); + }); + + + Timing.CallDelayed(5f, delegate + { + giftext.Spawn(pl?.Position + Vector3.up ?? basePos, Quaternion.Euler(Vector3.zero)); + //text.Spawn(pl?.Position+Vector3.up ?? basePos, .05f); + }); + + + text.Spawn(basePos + Vector3.back); + + + + + new NPC079(); diff --git a/KruacentExiled/KE.Misc/MainPlugin.cs b/KruacentExiled/KE.Misc/MainPlugin.cs index d35fec5e..69162114 100644 --- a/KruacentExiled/KE.Misc/MainPlugin.cs +++ b/KruacentExiled/KE.Misc/MainPlugin.cs @@ -12,6 +12,7 @@ using KE.Misc.Handlers; using Exiled.CustomRoles.API.Features; using KE.Misc.Features.CR; +using LightContainmentZoneDecontamination; namespace KE.Misc { diff --git a/KruacentExiled/KE.Misc/Utils/AnimatedTextImage.cs b/KruacentExiled/KE.Misc/Utils/AnimatedTextImage.cs new file mode 100644 index 00000000..4e5adcdb --- /dev/null +++ b/KruacentExiled/KE.Misc/Utils/AnimatedTextImage.cs @@ -0,0 +1,126 @@ +using Exiled.API.Features; +using Exiled.API.Interfaces; +using MEC; +using System; +using System.Collections.Generic; +using System.Drawing; +using System.Drawing.Imaging; +using UnityEngine; + +namespace KE.Misc.Utils +{ + public class AnimatedTextImage : IEquatable, IWorldSpace + { + + private TextImage[] spawnedImage; + + //delay in ms + private int[] delay; + + private bool looping = true; + private TextImage currentImage = null; + + public Vector3 Position { get; set; } = Vector3.zero; + + public Quaternion Rotation { get; set; } = Quaternion.Euler(Vector3.one); + + public float PixelSize { get; set; } = .05f; + private CoroutineHandle handle; + + + public AnimatedTextImage(Image img) + { + CreateImages(img); + } + + private void CreateImages(Image img) + { + FrameDimension dimension = new FrameDimension(img.FrameDimensionsList[0]); + int frameCount = img.GetFrameCount(dimension); + + + PropertyItem delayProperty = img.GetPropertyItem(0x5100); + byte[] delayBytes = delayProperty.Value; + delay = new int[frameCount]; + spawnedImage = new TextImage[frameCount]; + + for (int frame = 0; frame < frameCount; frame++) + { + + delay[frame] = BitConverter.ToInt32(delayBytes, frame * 4) * 10; + + img.SelectActiveFrame(dimension, frame); + spawnedImage[frame] = new TextImage(img); + } + } + + + + public void Spawn(Vector3 position, Quaternion rotation) + { + Position = position; + Rotation = rotation; + handle = Timing.RunCoroutine(Loop()); + } + + public void Destroy() + { + Timing.KillCoroutines(handle); + } + + public void Stop() + { + looping = false; + } + + public void Resume() + { + looping = true; + } + + + private IEnumerator Loop() + { + if(spawnedImage.Length != delay.Length) + { + throw new Exception("not same lenght"); + } + + int i = 0; + while (looping) + { + int index = i % spawnedImage.Length; + float waitTime = 1; + waitTime = delay[index] / 1000f; + + + ShowImage(index); + + yield return Timing.WaitForSeconds(waitTime); + i = (i+1)% spawnedImage.Length; + } + } + + private void ShowImage(int index) + { + try + { + currentImage?.Destroy(); + currentImage = spawnedImage[index]; + currentImage.Spawn(Position, PixelSize, Rotation); + } + catch(Exception e) + { + Log.Error(e); + } + + } + + + + public bool Equals(AnimatedTextImage other) + { + return spawnedImage == other.spawnedImage; + } + } +} diff --git a/KruacentExiled/KE.Misc/Utils/ImageUtils.cs b/KruacentExiled/KE.Misc/Utils/ImageUtils.cs new file mode 100644 index 00000000..6831e5f6 --- /dev/null +++ b/KruacentExiled/KE.Misc/Utils/ImageUtils.cs @@ -0,0 +1,29 @@ +using Exiled.API.Features; +using System; +using System.Collections.Generic; +using System.Drawing; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace KE.Misc.Utils +{ + public static class ImageUtils + { + private static HashSet images = null; + + public static string Path => Paths.Configs + "/"; + + + public static IEnumerable GetAllImages() + { + if(images is not null) + { + return images; + } + + + } + + } +} diff --git a/KruacentExiled/KE.Misc/Utils/TextImage.cs b/KruacentExiled/KE.Misc/Utils/TextImage.cs new file mode 100644 index 00000000..e6611017 --- /dev/null +++ b/KruacentExiled/KE.Misc/Utils/TextImage.cs @@ -0,0 +1,166 @@ +using System; +using System.Collections.Generic; +using System.Drawing.Imaging; +using System.Drawing; +using System.IO; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Exiled.API.Features.Pools; +using LabApi.Features.Wrappers; +using UnityEngine; +using Color = System.Drawing.Color; +using Exiled.API.Features.Toys; +using Exiled.API.Features; +using UnityEngine.Rendering; +using Graphics = System.Drawing.Graphics; +using Exiled.API.Interfaces; + +namespace KE.Misc.Utils +{ + public class TextImage : IEquatable + { + private static HashSet list = new(); + + private string rawString = string.Empty; + private HashSet spawnedTextToys = new(); + + public static Vector2 DefaultDisplaySize => new Vector2(5000, 5000); + + public static string StartColorTag => " ""; + public static string DefaultCharacter => "█"; + + public TextImage(Image img) + { + + var b = new Bitmap(img,img.Width, img.Height); + StringBuilder sb = StringBuilderPool.Pool.Get(); + //Log.Info($"{b.Height}/{b.Width}"); + + for (int y = 0; y < b.Height; y++) + { + Color? oldColor = null; + int nb = 0; + + for (int x = 0; x < b.Width; x++) + { + Color pixelColor = b.GetPixel(x, y); + + if (oldColor is null) + { + oldColor = pixelColor; + nb = 1; + continue; + } + + if (ColorEquals(oldColor, pixelColor)) + { + nb++; + } + else + { + sb.Append(StartColorTag); + sb.Append(ToHexValue(oldColor.Value) + ">"); + for (int i = 0; i < nb; i++) + sb.Append(DefaultCharacter); + sb.Append(EndColorTag); + + oldColor = pixelColor; + nb = 1; + } + } + + if (nb > 0 && oldColor is not null) + { + sb.Append(StartColorTag); + sb.Append(ToHexValue(oldColor.Value) + ">"); + for (int i = 0; i < nb; i++) + sb.Append(DefaultCharacter); + sb.Append(EndColorTag); + } + + sb.AppendLine(); + } + rawString = sb.ToString(); + + StringBuilderPool.Pool.Return(sb); + list.Add(this); + } + + public static bool ColorEquals(Color? color1,Color? color2) + { + if (color1 is null || color2 is null) return false; + + Color tcolor1 = color1 ?? Color.Black; + Color tcolor2 = color2 ?? Color.Black; + + return tcolor1.R == tcolor2.R && + tcolor1.G == tcolor2.G && + tcolor1.B == tcolor2.B && + tcolor1.A == tcolor2.A; + } + + + //Todo change texttoy + public TextToy Spawn(Vector3 position,float pixelSize = 1f, Quaternion? rotation = null, Transform parent = null) + { + Vector3 scale = new Vector3(1,.5f,1)* pixelSize; + + TextToy textToy = TextToy.Create(position, rotation ?? Quaternion.Euler(Vector3.zero), scale, parent, false); + textToy.DisplaySize = DefaultDisplaySize; + textToy.TextFormat = rawString; + + + textToy.Spawn(); + + spawnedTextToys.Add(textToy); + return textToy; + } + + + public void Destroy(TextToy textToy) + { + if (textToy == null) throw new ArgumentNullException(); + + if (spawnedTextToys.Remove(textToy)) + { + textToy.Destroy(); + } + + + } + + public void Destroy() + { + if (spawnedTextToys is null) return; + + + + foreach(TextToy tt in spawnedTextToys) + { + if (!tt.IsDestroyed) + { + tt?.Destroy(); + } + + } + } + + + + + private static string ToHexValue(Color color) + { + return "#" + color.R.ToString("X2") + + color.G.ToString("X2") + + color.B.ToString("X2") + + color.A.ToString("X2"); + } + + public bool Equals(TextImage other) + { + return spawnedTextToys == other.spawnedTextToys; + } + } +} From b8df0df852f131f09562b05231cd0466292f5501 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Tue, 19 Aug 2025 19:00:16 +0200 Subject: [PATCH 325/853] get all role with an ability --- .../API/Features/KEAbilities.cs | 67 ++++++++++++++++++- .../API/Features/KECustomRole.cs | 47 +++++-------- KruacentExiled/KE.CustomRoles/CR/MTF/Pilot.cs | 6 +- .../CR/Scientist/GambleAddict.cs | 6 +- 4 files changed, 90 insertions(+), 36 deletions(-) diff --git a/KruacentExiled/KE.CustomRoles/API/Features/KEAbilities.cs b/KruacentExiled/KE.CustomRoles/API/Features/KEAbilities.cs index b9a650cd..f0223962 100644 --- a/KruacentExiled/KE.CustomRoles/API/Features/KEAbilities.cs +++ b/KruacentExiled/KE.CustomRoles/API/Features/KEAbilities.cs @@ -11,6 +11,7 @@ using System.Linq; using System.Reflection; using UserSettings.ServerSpecific; +using UserSettings.UserInterfaceSettings; namespace KE.CustomRoles.API.Features { @@ -37,8 +38,28 @@ public abstract class KEAbilities public abstract float Cooldown { get; } #endregion + public HashSet GetRoles + { + get + { + HashSet result = new(); + foreach (KECustomRole cr in KECustomRole.KnownKECR) + { + foreach(int abilityId in cr.Abilities) + { + KEAbilities ability = Get(abilityId); + if (ability == this) + { + result.Add(cr); + } + } + } + return result; + } + } private Dictionary LastUsed = new(); private static Dictionary TypeToAbility { get; } = new(); + private static Dictionary IdToAbility { get; } = new(); private static HeaderSetting header; private static bool flagHeader = false; private SettingBase setting; @@ -53,6 +74,14 @@ protected KEAbilities() } public void Init() { + if (IdToAbility.ContainsKey(Id)) + { + Log.Warn($"{Name} ({Id}) have the same id as {IdToAbility[Id].Name}. Skipping..."); + return; + } + + + SettingBase old = SettingBase.List.Where(s => s.Id == Id).FirstOrDefault(); if(old == null) @@ -65,14 +94,15 @@ public void Init() } Log.Debug("creating keybind"); setting = new KeybindSetting(Id, Name, UnityEngine.KeyCode.None,hintDescription:Description); - SettingBase.Register([setting]); } else { Log.Error($"setting of {this} have the same id as {old.Label}"); + } StartLoop(); + IdToAbility.Add(Id, this); TypeToAbility.Add(GetType(), this); InternalSubscribeEvent(); } @@ -125,6 +155,8 @@ private void OnSettingValueReceived(Player player, ServerSpecificSettingBase set } } + + private void OnVerified(VerifiedEventArgs ev) { ServerSpecificSettingsSync.SendToPlayer(ev.Player.ReferenceHub); @@ -243,6 +275,16 @@ public static bool TryAddToPlayer(Type typeAbility,Player player) return true; + } + public static bool TryAddToPlayer(int abilityId,Player player) + { + if (!IdToAbility.TryGetValue(abilityId, out var ability)) return false; + + + ability.AddAbility(player); + return true; + + } public static void TryRemoveFromPlayer(Player player) @@ -324,6 +366,29 @@ public static IEnumerable Unregister() } #endregion + #region getters + + public static KEAbilities Get(int id) + { + foreach(KEAbilities kEAbilities in Registered) + { + if (id == kEAbilities.Id) + { + return kEAbilities; + } + } + + return null; + } + + public static bool TryGet(int id, out KEAbilities ability) + { + ability = Get(id); + return ability != null; + } + + + #endregion #region gui diff --git a/KruacentExiled/KE.CustomRoles/API/Features/KECustomRole.cs b/KruacentExiled/KE.CustomRoles/API/Features/KECustomRole.cs index e5118996..c139515b 100644 --- a/KruacentExiled/KE.CustomRoles/API/Features/KECustomRole.cs +++ b/KruacentExiled/KE.CustomRoles/API/Features/KECustomRole.cs @@ -38,11 +38,12 @@ public override string Name } + public static IEnumerable KnownKECR => Registered.Where(c => c is KECustomRole).Cast(); public sealed override string CustomInfo { get; set; } public abstract string PublicName { get; set; } - public virtual HashSet Abilities { get; } + public virtual HashSet Abilities { get; } public sealed override bool IgnoreSpawnSystem { get; set; } = true; protected override void ShowMessage(Player player) @@ -148,41 +149,17 @@ public override void AddRole(Player player) if(Abilities != null) { - foreach(Type ability in Abilities) + foreach(int abilityId in Abilities) { - KEAbilities.TryAddToPlayer(ability, player2); + KEAbilities.TryAddToPlayer(abilityId, player2); } } + ShowMessage(player2); - ShowBroadcast(player2); RoleAdded(player2); player2.UniqueRole = Name; player2.TryAddCustomRoleFriendlyFire(Name, CustomRoleFFMultiplier); - if (string.IsNullOrEmpty(ConsoleMessage)) - { - return; - } - - StringBuilder stringBuilder = StringBuilderPool.Pool.Get(); - stringBuilder.AppendLine(Name); - stringBuilder.AppendLine(Description); - stringBuilder.AppendLine(); - stringBuilder.AppendLine(ConsoleMessage); - List customAbilities = CustomAbilities; - if (customAbilities != null && customAbilities.Count > 0) - { - stringBuilder.AppendLine(AbilityUsage); - stringBuilder.AppendLine("Your custom abilities are:"); - for (int i = 1; i < CustomAbilities.Count + 1; i++) - { - stringBuilder.AppendLine($"{i}. {CustomAbilities[i - 1].Name} - {CustomAbilities[i - 1].Description}"); - } - - stringBuilder.AppendLine("You can keybind the command for this ability by using \"cmdbind .special KEY\", where KEY is any un-used letter on your keyboard. You can also keybind each specific ability for a role in this way. For ex: \"cmdbind .special g\" or \"cmdbind .special bulldozer 1 g\""); - } - - player2.SendConsoleMessage(StringBuilderPool.Pool.ToStringReturn(stringBuilder), "green"); } public override void RemoveRole(Player player) @@ -208,7 +185,19 @@ public override void RemoveRole(Player player) /// /// The chance to get a at the start or a respawn /// - public static int Chance = 40; + public static int Chance + { + get + { + return chance; + } + set + { + chance = Mathf.Clamp(value, 0, 100); + } + } + + private static int chance = 40; private static CustomRole AssignRole(Dictionary roleChances) { diff --git a/KruacentExiled/KE.CustomRoles/CR/MTF/Pilot.cs b/KruacentExiled/KE.CustomRoles/CR/MTF/Pilot.cs index c9a7b21a..ce3ad505 100644 --- a/KruacentExiled/KE.CustomRoles/CR/MTF/Pilot.cs +++ b/KruacentExiled/KE.CustomRoles/CR/MTF/Pilot.cs @@ -39,10 +39,10 @@ public class Pilot : KECustomRole { AmmoType.Nato9, 100} }; - public override HashSet Abilities { get; } = new() + public override HashSet Abilities { get; } = new() { - typeof(SelectPosition), - typeof(Airstrike) + 2000, + 2001 }; diff --git a/KruacentExiled/KE.CustomRoles/CR/Scientist/GambleAddict.cs b/KruacentExiled/KE.CustomRoles/CR/Scientist/GambleAddict.cs index c32cad88..39a549ae 100644 --- a/KruacentExiled/KE.CustomRoles/CR/Scientist/GambleAddict.cs +++ b/KruacentExiled/KE.CustomRoles/CR/Scientist/GambleAddict.cs @@ -10,7 +10,7 @@ namespace KE.CustomRoles.CR.Scientist { [CustomRole(RoleTypeId.Scientist)] - internal class GambleAddict : KECustomRole + public class GambleAddict : KECustomRole { public override string Description { get; set; } = "Tu es un Gamble Addict \nT'as trade ton kit et ta carte contre 2 pièces \nfais en bon usage"; public override uint Id { get; set; } = 1043; @@ -29,9 +29,9 @@ internal class GambleAddict : KECustomRole $"{ItemType.Coin}", }; - public override HashSet Abilities { get; } = new() + public override HashSet Abilities { get; } = new() { - typeof(Trade) + 2002 }; } } From 98b4c6a70ebbc97ff11b1fc1c9c477b6709777c2 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Thu, 28 Aug 2025 20:22:09 +0200 Subject: [PATCH 326/853] fixed the gcr not having abilities --- .../API/Features/GlobalCustomRole.cs | 35 ++++--------------- 1 file changed, 7 insertions(+), 28 deletions(-) diff --git a/KruacentExiled/KE.CustomRoles/API/Features/GlobalCustomRole.cs b/KruacentExiled/KE.CustomRoles/API/Features/GlobalCustomRole.cs index 2cd51436..5b556466 100644 --- a/KruacentExiled/KE.CustomRoles/API/Features/GlobalCustomRole.cs +++ b/KruacentExiled/KE.CustomRoles/API/Features/GlobalCustomRole.cs @@ -111,39 +111,18 @@ public override void AddRole(Player player) player.CustomInfo = $"{player.CustomName}\n{CustomInfo}"; player.InfoArea &= ~(PlayerInfoArea.Role | PlayerInfoArea.Nickname); - if (CustomAbilities != null) + if (Abilities != null) { - foreach (CustomAbility ability in CustomAbilities) - ability.AddAbility(player); + foreach (int abilityId in Abilities) + { + KEAbilities.TryAddToPlayer(abilityId, player2); + } } - ShowMessage(player); - RoleAdded(player); - player.UniqueRole = Name; - player.TryAddCustomRoleFriendlyFire(Name, CustomRoleFFMultiplier); - - if (!string.IsNullOrEmpty(ConsoleMessage)) - { - StringBuilder builder = StringBuilderPool.Pool.Get(); - - builder.AppendLine(Name); - builder.AppendLine(Description); - builder.AppendLine(); - builder.AppendLine(ConsoleMessage); - - if (CustomAbilities?.Count > 0) - { - builder.AppendLine(AbilityUsage); - builder.AppendLine("Your custom abilities are:"); - for (int i = 1; i < CustomAbilities.Count + 1; i++) - builder.AppendLine($"{i}. {CustomAbilities[i - 1].Name} - {CustomAbilities[i - 1].Description}"); - builder.AppendLine( - "You can keybind the command for this ability by using \"cmdbind .special KEY\", where KEY is any un-used letter on your keyboard. You can also keybind each specific ability for a role in this way. For ex: \"cmdbind .special g\" or \"cmdbind .special bulldozer 1 g\""); - } + ShowMessage(player); - player.SendConsoleMessage(StringBuilderPool.Pool.ToStringReturn(builder), "green"); - } + player.UniqueRole = Name; } public override void RemoveRole(Player player) { From 35f02a30e4d98f8f734bbceca50f29d20f255509 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Thu, 28 Aug 2025 20:28:36 +0200 Subject: [PATCH 327/853] forgor to rename the player lol --- KruacentExiled/KE.CustomRoles/API/Features/GlobalCustomRole.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/KruacentExiled/KE.CustomRoles/API/Features/GlobalCustomRole.cs b/KruacentExiled/KE.CustomRoles/API/Features/GlobalCustomRole.cs index 5b556466..a0a85ee1 100644 --- a/KruacentExiled/KE.CustomRoles/API/Features/GlobalCustomRole.cs +++ b/KruacentExiled/KE.CustomRoles/API/Features/GlobalCustomRole.cs @@ -115,7 +115,7 @@ public override void AddRole(Player player) { foreach (int abilityId in Abilities) { - KEAbilities.TryAddToPlayer(abilityId, player2); + KEAbilities.TryAddToPlayer(abilityId, player); } } From 9c5a7539704469f6c957b5c039e3ab9aafbb8744 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Wed, 3 Sep 2025 19:05:06 +0200 Subject: [PATCH 328/853] finished the select wheel --- .../API/Features/KEAbilities.cs | 125 +++++++++++-- .../API/Features/KECustomRole.cs | 1 + .../KE.CustomRoles/KE.CustomRoles.csproj | 1 + .../KE.CustomRoles/Settings/SettingHandler.cs | 166 +++++++++++++++++- 4 files changed, 275 insertions(+), 18 deletions(-) diff --git a/KruacentExiled/KE.CustomRoles/API/Features/KEAbilities.cs b/KruacentExiled/KE.CustomRoles/API/Features/KEAbilities.cs index f0223962..14878895 100644 --- a/KruacentExiled/KE.CustomRoles/API/Features/KEAbilities.cs +++ b/KruacentExiled/KE.CustomRoles/API/Features/KEAbilities.cs @@ -2,6 +2,7 @@ using Exiled.API.Features.Core.UserSettings; using Exiled.CustomRoles.API.Features; using Exiled.Events.EventArgs.Player; +using KE.CustomRoles.Settings; using KE.Utils.API; using KE.Utils.API.Displays.DisplayMeow; using MEC; @@ -12,6 +13,7 @@ using System.Reflection; using UserSettings.ServerSpecific; using UserSettings.UserInterfaceSettings; +using static PlayerList; namespace KE.CustomRoles.API.Features { @@ -64,13 +66,15 @@ public HashSet GetRoles private static bool flagHeader = false; private SettingBase setting; public HashSet Players { get; } = new HashSet(); + public HashSet Selected { get; } = new(); - private static Dictionary> Show = new(); + + public static Dictionary> PlayersAbility { get;} = new(); protected KEAbilities() { - + } public void Init() { @@ -146,7 +150,8 @@ private void OnSettingValueReceived(Player player, ServerSpecificSettingBase set { if (!CheckPressed(settingBase)) return; if (!Check(player)) return; - + + if (!SettingHandler.Instance.GetMode(player)) return; if(CanUse(player,out string _)) @@ -186,14 +191,32 @@ protected virtual void AbilityRemoved(Player player) } + + public void SelectAbility(Player player) + { + if (Selected.Add(player)) + { + Log.Debug($"player {player.Nickname} selected ability {this}"); + foreach (KEAbilities abilities in Registered.Where(a => a != this)) + { + abilities.UnselectAbility(player); + } + } + } + + public void UnselectAbility(Player player) + { + Log.Debug($"player {player.Nickname} unselected ability {this}"); + Selected.Remove(player); + } public void RemoveAbility(Player player) { - Log.Debug($"player {player.Nickname} lost {this}"); if (Players.Contains(player)) { - Show[player].Remove(this); + Log.Debug($"player {player.Nickname} lost {this}"); + PlayersAbility[player].Remove(this); Players.Remove(player); AbilityRemoved(player); } @@ -205,11 +228,11 @@ public void AddAbility(Player player) Log.Debug($"player {player.Nickname} got {this} ({result})"); if (result) { - if(!Show.TryGetValue(player,out var _)) + if(!PlayersAbility.TryGetValue(player,out var _)) { - Show.Add(player, new()); + PlayersAbility.Add(player, new()); } - Show[player].Add(this); + PlayersAbility[player].Add(this); AbilityAdded(player); } @@ -266,6 +289,17 @@ public bool CheckPressed(ServerSpecificSettingBase settingBase) return CheckPressed(settingBase, setting.Id); } + public static void UseSelected(Player player) + { + if(TryGetSelected(player,out var ability)) + { + if (ability.CanUse(player, out string _)) + { + ability.UseAbility(player); + } + } + } + public static bool TryAddToPlayer(Type typeAbility,Player player) { if (!TypeToAbility.TryGetValue(typeAbility, out var ability)) return false; @@ -287,11 +321,37 @@ public static bool TryAddToPlayer(int abilityId,Player player) } + public static void RemoveAllSelect(Player player) + { + if (!PlayersAbility.ContainsKey(player)) return; + + foreach(KEAbilities ability in PlayersAbility[player]) + { + ability.Selected.Remove(player); + } + + UpdateGUI(player); + } + + public static void SelectFirstAbility(Player player) + { + if(PlayersAbility.TryGetValue(player,out var list)) + { + list[0].SelectAbility(player); + + UpdateGUI(player); + } + + } + public static void TryRemoveFromPlayer(Player player) { foreach(KEAbilities abilities in Registered) { - abilities.RemoveAbility(player); + if (abilities.Players.Contains(player)) + { + abilities.RemoveAbility(player); + } } } @@ -387,13 +447,31 @@ public static bool TryGet(int id, out KEAbilities ability) return ability != null; } + public static KEAbilities GetSelected(Player player) + { + foreach(KEAbilities ability in Registered) + { + if (ability.Selected.Contains(player)) + { + return ability; + } + } + return null; + } + + public static bool TryGetSelected(Player player, out KEAbilities ability) + { + ability = GetSelected(player); + return ability != null; + } + #endregion #region gui - private static float UpdateTime = 1f; + private static readonly float UpdateTime = 1; private static bool flag = false; private static void StartLoop() { @@ -411,19 +489,25 @@ private static IEnumerator Loop() yield return Timing.WaitForSeconds(UpdateTime); } } - private static void UpdateAllGUI() + public static void UpdateAllGUI() { - foreach(Player player in Show.Keys) + foreach(Player player in PlayersAbility.Keys) { UpdateGUI(player); } } - private static void UpdateGUI(Player player) + public static void UpdateGUI(Player player) { string msg = ""; - foreach (KEAbilities ability in Show[player]) + List allAbilities = PlayersAbility[player]; + + for (int i = 0; i < allAbilities.Count; i++) { + + + KEAbilities ability = allAbilities[i]; + msg += $"{ability.Name} "; if (ability.CanUse(player,out var output)) { @@ -437,8 +521,21 @@ private static void UpdateGUI(Player player) + //Log.Debug($"ability {ability.Name} contain {ability.Selected.Count} "); + + if (ability.Selected.Contains(player)) + { + //todo replace with the settings + msg += SettingHandler.baseArrow; + } + + + msg += "\n"; } + + //Log.Debug(msg); + DisplayHandler.Instance.AddHint(MainPlugin.Abilities, player, msg, 1f); } diff --git a/KruacentExiled/KE.CustomRoles/API/Features/KECustomRole.cs b/KruacentExiled/KE.CustomRoles/API/Features/KECustomRole.cs index c139515b..57d7c225 100644 --- a/KruacentExiled/KE.CustomRoles/API/Features/KECustomRole.cs +++ b/KruacentExiled/KE.CustomRoles/API/Features/KECustomRole.cs @@ -153,6 +153,7 @@ public override void AddRole(Player player) { KEAbilities.TryAddToPlayer(abilityId, player2); } + KEAbilities.SelectFirstAbility(player2); } diff --git a/KruacentExiled/KE.CustomRoles/KE.CustomRoles.csproj b/KruacentExiled/KE.CustomRoles/KE.CustomRoles.csproj index d11ae7ff..0f41f574 100644 --- a/KruacentExiled/KE.CustomRoles/KE.CustomRoles.csproj +++ b/KruacentExiled/KE.CustomRoles/KE.CustomRoles.csproj @@ -21,6 +21,7 @@ + diff --git a/KruacentExiled/KE.CustomRoles/Settings/SettingHandler.cs b/KruacentExiled/KE.CustomRoles/Settings/SettingHandler.cs index e6be1dd5..a198191a 100644 --- a/KruacentExiled/KE.CustomRoles/Settings/SettingHandler.cs +++ b/KruacentExiled/KE.CustomRoles/Settings/SettingHandler.cs @@ -5,6 +5,7 @@ using Exiled.CustomRoles.API.Features; using Exiled.CustomRoles.API.Features.Enums; using Exiled.Events.EventArgs.Player; +using KE.CustomRoles.API.Features; using KE.CustomRoles.API.Interfaces; using KE.Utils.API.Interfaces; using System; @@ -13,6 +14,8 @@ using System.Reflection; using System.Text; using System.Threading.Tasks; +using System.Xml.Linq; +using UnityEngine; using UserSettings.ServerSpecific; using UserSettings.UserInterfaceSettings; @@ -23,44 +26,199 @@ internal class SettingHandler : IUsingEvents private int _idHeader = 148; private int _idTimeCustomRole = 144; private int _idDesc = 143; - private List settings; + private int _idMode = 145; + private int _idDown = 149; + private int _idUp = 150; + private int _idSelect = 151; + private int _idArrow = 152; + + public static event Action DownPressed = delegate { }; + public static event Action UpPressed = delegate { }; + public static SettingHandler Instance { get; private set; } + private List settings; + public const string baseArrow = "<--"; public SettingHandler() { - - + Instance = this; settings = new List() { - new HeaderSetting (_idHeader,"Custom Roles Hint Settings"), + new HeaderSetting (_idHeader,"Custom Roles Settings"), new TwoButtonsSetting(_idDesc,"Descriptions","Disabled","Enabled",true,"hide/show the description the Custom Role "), new SliderSetting(_idTimeCustomRole,"Time shown",0,30,20), + new TwoButtonsSetting(_idMode,"Mode","Keybinds","Select wheel",true,onChanged:OnChanged), + new KeybindSetting(_idUp, "Select up", UnityEngine.KeyCode.None,hintDescription:"only work in Select Wheel mode"), + new KeybindSetting(_idDown, "Select down", UnityEngine.KeyCode.None,hintDescription:"only work in Select Wheel mode"), + new KeybindSetting(_idSelect, "Use selected ability", UnityEngine.KeyCode.None,hintDescription:"only work in Select Wheel mode"), + //this crashes the player idk why + //new UserTextInputSetting(_idArrow, "Personalize the arrow next to the selected ability",hintDescription:"only work in Select Wheel mode",placeHolder:baseArrow,onChanged:OnChangedArrow), }; } + public void OnChanged(Player player, SettingBase setting) + { + + try + { + if (GetMode(player)) + { + KEAbilities.RemoveAllSelect(player); + } + else + { + KEAbilities.SelectFirstAbility(player); + } + } + catch(Exception e) + { + Log.Error(e); + } + + + } + public void OnChangedArrow(Player player, SettingBase setting) + { + KEAbilities.UpdateGUI(player); + } public void SubscribeEvents() { SettingBase.Register(settings); + ServerSpecificSettingsSync.ServerOnSettingValueReceived += SafeOnSettingValueReceived; Exiled.Events.Handlers.Player.Verified += OnVerified; + DownPressed += Down; + UpPressed += Up; } public void UnsubscribeEvents() { Exiled.Events.Handlers.Player.Verified -= OnVerified; + ServerSpecificSettingsSync.ServerOnSettingValueReceived -= SafeOnSettingValueReceived; + DownPressed -= Down; + UpPressed -= Up; SettingBase.Unregister(predicate:null, settings); } + private void SafeOnSettingValueReceived(ReferenceHub hub, ServerSpecificSettingBase settingBase) + { + //not catching the exception will desync & kick the player + try + { + OnSettingValueReceived(Player.Get(hub), settingBase); + } + catch (Exception e) + { + Log.Error(e); + } + } + + private void OnSettingValueReceived(Player player, ServerSpecificSettingBase settingBase) + { + if (KEAbilities.CheckPressed(settingBase, _idDown)) + { + DownPressed?.Invoke(player); + } + + if (KEAbilities.CheckPressed(settingBase, _idUp)) + { + UpPressed?.Invoke(player); + } + + if (KEAbilities.CheckPressed(settingBase, _idSelect)) + { + KEAbilities.UseSelected(player); + } + + } + + private Dictionary playerPos = new(); + + private void Up(Player player) + { + if(KEAbilities.PlayersAbility.TryGetValue(player,out var list)) + { + if (list.Count == 0) + { + return; + } + if (!playerPos.ContainsKey(player)) + { + playerPos.Add(player, 0); + } + + int index = mod((playerPos[player] - 1),list.Count); + Log.Debug("up "+ index); + KEAbilities ability = list[index]; + playerPos[player] += -1; + + + ability?.SelectAbility(player); + KEAbilities.UpdateGUI(player); + } + } + + private int mod(int x, int m) + { + return (x % m + m) % m; + } + + private void Down(Player player) + { + if (KEAbilities.PlayersAbility.TryGetValue(player, out var list)) + { + if(list.Count == 0) + { + return; + } + + if (!playerPos.ContainsKey(player)) + { + playerPos.Add(player, 0); + } + + + int index = mod((playerPos[player] + 1), list.Count); + Log.Debug("down " + index); + KEAbilities ability = list[index]; + playerPos[player] += 1; + ability?.SelectAbility(player); + KEAbilities.UpdateGUI(player); + } + } + + + + private void OnVerified(VerifiedEventArgs ev) { ServerSpecificSettingsSync.SendToPlayer(ev.Player.ReferenceHub); } + /// + /// + /// + /// + /// true if keybinds mode is activated ; false otherwise + internal bool GetMode(Player p) + { + if (!SettingBase.TryGetSetting(p, _idMode, out var setting)) return setting.IsSecondDefault; + + return setting.IsFirst; + } + + internal string GetArrow(Player p) + { + if (!SettingBase.TryGetSetting(p, _idArrow, out var setting)) return baseArrow; + + return setting.Text; + + } internal float GetTime(Player p) { if (!SettingBase.TryGetSetting(p, _idTimeCustomRole, out var setting)) return 20; From 5dfac163f32c2e14781a01fdbc578ab03727ece5 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Wed, 10 Sep 2025 18:23:49 +0200 Subject: [PATCH 329/853] stopped the coroutine when waiting for player --- .../API/Features/Controller.cs | 107 ------------- .../API/Features/RoundEffects/RoundEffect.cs | 145 ++++++++++++++++++ .../Handlers/ServerHandler.cs | 11 +- KruacentExiled/KE.BlackoutNDoor/MainPlugin.cs | 12 +- 4 files changed, 152 insertions(+), 123 deletions(-) delete mode 100644 KruacentExiled/KE.BlackoutNDoor/API/Features/Controller.cs diff --git a/KruacentExiled/KE.BlackoutNDoor/API/Features/Controller.cs b/KruacentExiled/KE.BlackoutNDoor/API/Features/Controller.cs deleted file mode 100644 index d389c9ec..00000000 --- a/KruacentExiled/KE.BlackoutNDoor/API/Features/Controller.cs +++ /dev/null @@ -1,107 +0,0 @@ -using Exiled.API.Enums; -using Exiled.API.Extensions; -using Exiled.API.Features; -using Exiled.API.Features.Doors; -using KE.BlackoutNDoor.API.Features.RoundEffects; -using KE.BlackoutNDoor.Events.EventArgs.RoundEffect; -using MEC; -using System.Collections.Generic; -using System.Linq; -using UnityEngine; -using Waits; -using YamlDotNet.Core.Events; - -namespace KE.BlackoutNDoor.API.Features -{ - - public class Controller - { - - private HashSet RoundEffects = []; - - public Controller() - { - RoundEffects.Add(new Blackout()); - RoundEffects.Add(new DoorStuck()); - } - - - - public IEnumerator Update() - { - int wait = UnityEngine.Random.Range(MainPlugin.Instance.Config.MinInterval, MainPlugin.Instance.Config.MaxInterval); - if (MainPlugin.Instance.Config.Debug) wait = 20; - - - do - { - if (Warhead.IsInProgress) continue; - - RoundEffect roundEffect = SelectRoundEffect(); - var zone = roundEffect.SelectZone(); - Log.Debug("zone="+zone); - Log.Debug($"waiting : {wait}"); - yield return Timing.WaitForSeconds(wait); - PreRoundEffectEventArgs args = new(zone, roundEffect); - Events.Handlers.RoundEffect.OnPreRoundEffect(args); - if (args.IsAllowed) - { - var timeyapping = CassieVoiceLine(zone, roundEffect); - yield return Timing.WaitForSeconds(5+ timeyapping); - roundEffect.Effect(zone); - yield return Timing.WaitForSeconds(MainPlugin.Instance.Config.DurationMalfunction); - roundEffect.StopEffect(zone); - Events.Handlers.RoundEffect.OnPostRoundEffect(new(zone, roundEffect)); - } - - } while (Round.InProgress); - - - } - - private RoundEffect SelectRoundEffect() - { - return RoundEffects.GetRandomValue(); - } - - private float CassieVoiceLine(ZoneType zone,RoundEffect round) - { - string nameEvent = round.EventTranslation; - string msg = $"Warning {nameEvent} in {GetZoneName(zone)} in 5 seconds"; - string colorzone = GetZoneColor(zone).ToHex(); - string msgTranslated = $"Warning {nameEvent} In {GetZoneName(zone)} in 5 seconds"; - - Cassie.MessageTranslated(msg, msgTranslated, true, false, true); - return Cassie.CalculateDuration(msg); - - } - - private Color GetZoneColor(ZoneType zone) - { - return zone switch - { - ZoneType.LightContainment => new Color(0.1058f, 0.7333f, 0.6078f), - ZoneType.HeavyContainment => new Color(0.2627f, 0.0980f, 0.0980f), - ZoneType.Entrance => new Color(1, 1, 0), - _ => new Color(1, 0, 0) - }; - } - - - private string GetZoneName(ZoneType zone) - { - return zone switch - { - ZoneType.LightContainment => "Light Containment Zone", - ZoneType.HeavyContainment => "Heavy Containment Zone", - ZoneType.Entrance => "Entrance Zone", - ZoneType.Surface => "Surface", - ZoneType.Unspecified => "All of the facility", - _ => "somewhere" - }; - } - - - - } -} diff --git a/KruacentExiled/KE.BlackoutNDoor/API/Features/RoundEffects/RoundEffect.cs b/KruacentExiled/KE.BlackoutNDoor/API/Features/RoundEffects/RoundEffect.cs index b004b2b5..394e2e47 100644 --- a/KruacentExiled/KE.BlackoutNDoor/API/Features/RoundEffects/RoundEffect.cs +++ b/KruacentExiled/KE.BlackoutNDoor/API/Features/RoundEffects/RoundEffect.cs @@ -1,5 +1,9 @@ using Exiled.API.Enums; +using Exiled.API.Extensions; using Exiled.API.Features; +using KE.BlackoutNDoor.Events.EventArgs.RoundEffect; +using KE.Utils.API.Interfaces; +using MEC; using System; using System.Collections.Generic; using System.Linq; @@ -47,5 +51,146 @@ internal ZoneType SelectZone() Log.Error("Zone selection failed"); return ZoneType.Unspecified; } + + + public static readonly Controller Controller = new(); + public static HashSet AllEffect { get; set; } + + + + + + public static void SubscribeEvents() + { + Controller.SubscribeEvents(); + } + + public static void UnsubscribeEvents() + { + Controller.UnsubscribeEvents(); + } + + + + + } + public class Controller : IUsingEvents + { + + private HashSet RoundEffects = []; + private static CoroutineHandle Handle; + + public Controller() + { + RoundEffect.AllEffect = new() + { + new Blackout(), + new DoorStuck() + }; + } + + + public void SubscribeEvents() + { + Exiled.Events.Handlers.Server.RoundStarted += OnRoundStarted; + Exiled.Events.Handlers.Server.WaitingForPlayers += OnWaitingForPlayers; + } + + public void UnsubscribeEvents() + { + Exiled.Events.Handlers.Server.RoundStarted -= OnRoundStarted; + Exiled.Events.Handlers.Server.WaitingForPlayers -= OnWaitingForPlayers; + } + + private void OnRoundStarted() + { + Log.Debug($"handle = {Handle}"); + Timing.KillCoroutines(Handle); + Handle = Timing.RunCoroutine(Update()); + } + + private void OnWaitingForPlayers() + { + Timing.KillCoroutines(Handle); + } + + + + public IEnumerator Update() + { + int wait = UnityEngine.Random.Range(MainPlugin.Instance.Config.MinInterval, MainPlugin.Instance.Config.MaxInterval); + if (MainPlugin.Instance.Config.Debug) wait = 20; + + + while (Round.InProgress) + { + if (Warhead.IsInProgress) continue; + + RoundEffect roundEffect = SelectRoundEffect(); + var zone = roundEffect.SelectZone(); + Log.Debug("zone=" + zone); + Log.Debug($"waiting : {wait}"); + yield return Timing.WaitForSeconds(wait); + PreRoundEffectEventArgs args = new(zone, roundEffect); + Events.Handlers.RoundEffect.OnPreRoundEffect(args); + if (args.IsAllowed) + { + var timeyapping = CassieVoiceLine(zone, roundEffect); + yield return Timing.WaitForSeconds(5 + timeyapping); + roundEffect.Effect(zone); + yield return Timing.WaitForSeconds(MainPlugin.Instance.Config.DurationMalfunction); + roundEffect.StopEffect(zone); + Events.Handlers.RoundEffect.OnPostRoundEffect(new(zone, roundEffect)); + } + + } + + + } + + private RoundEffect SelectRoundEffect() + { + return RoundEffects.GetRandomValue(); + } + + private float CassieVoiceLine(ZoneType zone, RoundEffect round) + { + string nameEvent = round.EventTranslation; + string msg = $"Warning {nameEvent} in {GetZoneName(zone)} in 5 seconds"; + string colorzone = GetZoneColor(zone).ToHex(); + string msgTranslated = $"Warning {nameEvent} In {GetZoneName(zone)} in 5 seconds"; + + Cassie.MessageTranslated(msg, msgTranslated, true, false, true); + return Cassie.CalculateDuration(msg); + + } + + private Color GetZoneColor(ZoneType zone) + { + return zone switch + { + ZoneType.LightContainment => new Color(0.1058f, 0.7333f, 0.6078f), + ZoneType.HeavyContainment => new Color(0.2627f, 0.0980f, 0.0980f), + ZoneType.Entrance => new Color(1, 1, 0), + _ => new Color(1, 0, 0) + }; + } + + + private string GetZoneName(ZoneType zone) + { + return zone switch + { + ZoneType.LightContainment => "Light Containment Zone", + ZoneType.HeavyContainment => "Heavy Containment Zone", + ZoneType.Entrance => "Entrance Zone", + ZoneType.Surface => "Surface", + ZoneType.Unspecified => "All of the facility", + _ => "somewhere" + }; + } + + + } } diff --git a/KruacentExiled/KE.BlackoutNDoor/Handlers/ServerHandler.cs b/KruacentExiled/KE.BlackoutNDoor/Handlers/ServerHandler.cs index d7496284..9a6905e9 100644 --- a/KruacentExiled/KE.BlackoutNDoor/Handlers/ServerHandler.cs +++ b/KruacentExiled/KE.BlackoutNDoor/Handlers/ServerHandler.cs @@ -12,12 +12,9 @@ public class ServerHandler public int Cooldown { get; set; } internal double ChanceBO { get; set; } = MainPlugin.Instance.Config.InitialChanceBO; private static CoroutineHandle Handle; - internal void OnRoundStarted() - { - Log.Debug($"handle = {Handle}"); - Timing.KillCoroutines(Handle); - Handle = Timing.RunCoroutine(MainPlugin.Instance.Controller.Update()); - - } + + + + } } diff --git a/KruacentExiled/KE.BlackoutNDoor/MainPlugin.cs b/KruacentExiled/KE.BlackoutNDoor/MainPlugin.cs index 963ba9c2..fa217972 100644 --- a/KruacentExiled/KE.BlackoutNDoor/MainPlugin.cs +++ b/KruacentExiled/KE.BlackoutNDoor/MainPlugin.cs @@ -4,6 +4,7 @@ using System; using System.ComponentModel; using Server = Exiled.Events.Handlers.Server; +using KE.BlackoutNDoor.API.Features.RoundEffects; namespace KE.BlackoutNDoor { @@ -13,35 +14,28 @@ public class MainPlugin : Plugin public override Version Version => new Version(1,0,0); public override string Name => "KE.BlackoutDoor"; internal static MainPlugin Instance; - internal Controller Controller { get; private set; } - public ServerHandler ServerHandler { get; private set; } public override void OnEnabled() { Instance = this; - Controller = new Controller(); this.RegisterEvent(); } public override void OnDisabled() { Instance = null; - Controller = null; this.UnregisterEvent(); } private void RegisterEvent() { - ServerHandler = new ServerHandler(); - Server.RoundStarted += ServerHandler.OnRoundStarted; + RoundEffect.SubscribeEvents(); } private void UnregisterEvent() { - Server.RoundStarted -= ServerHandler.OnRoundStarted; - - ServerHandler = null; + RoundEffect.UnsubscribeEvents(); } From 94d583e795c96453dbf5431e0683e7d041f2cf52 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Wed, 10 Sep 2025 18:26:04 +0200 Subject: [PATCH 330/853] server handler obsolete --- KruacentExiled/KE.BlackoutNDoor/Handlers/ServerHandler.cs | 4 ---- KruacentExiled/KE.BlackoutNDoor/MainPlugin.cs | 4 +++- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/KruacentExiled/KE.BlackoutNDoor/Handlers/ServerHandler.cs b/KruacentExiled/KE.BlackoutNDoor/Handlers/ServerHandler.cs index 9a6905e9..867ba740 100644 --- a/KruacentExiled/KE.BlackoutNDoor/Handlers/ServerHandler.cs +++ b/KruacentExiled/KE.BlackoutNDoor/Handlers/ServerHandler.cs @@ -10,10 +10,6 @@ public class ServerHandler { [Obsolete()] public int Cooldown { get; set; } - internal double ChanceBO { get; set; } = MainPlugin.Instance.Config.InitialChanceBO; - private static CoroutineHandle Handle; - - } diff --git a/KruacentExiled/KE.BlackoutNDoor/MainPlugin.cs b/KruacentExiled/KE.BlackoutNDoor/MainPlugin.cs index fa217972..437a4c13 100644 --- a/KruacentExiled/KE.BlackoutNDoor/MainPlugin.cs +++ b/KruacentExiled/KE.BlackoutNDoor/MainPlugin.cs @@ -14,7 +14,9 @@ public class MainPlugin : Plugin public override Version Version => new Version(1,0,0); public override string Name => "KE.BlackoutDoor"; internal static MainPlugin Instance; - public ServerHandler ServerHandler { get; private set; } + + [Obsolete()] + public ServerHandler ServerHandler { get; } = null; public override void OnEnabled() { From d55ce4f654f2278cd26c2fecaa6a68d60bfeb428 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Wed, 10 Sep 2025 18:49:35 +0200 Subject: [PATCH 331/853] moved auto nuke to its own class --- .../RoleChanging/Base914PlayerRoleChange.cs | 2 +- .../KE.Misc/Features/AutoNukeAnnoucement.cs | 57 +++++++++++++++++++ KruacentExiled/KE.Misc/Features/ClassDDoor.cs | 10 +--- .../KE.Misc/Handlers/ServerHandler.cs | 11 +--- KruacentExiled/KE.Misc/MainPlugin.cs | 20 +++---- KruacentExiled/KE.Misc/Utils/ImageUtils.cs | 2 +- 6 files changed, 71 insertions(+), 31 deletions(-) create mode 100644 KruacentExiled/KE.Misc/Features/AutoNukeAnnoucement.cs diff --git a/KruacentExiled/KE.Misc/Features/914Upgrades/RoleChanging/Base914PlayerRoleChange.cs b/KruacentExiled/KE.Misc/Features/914Upgrades/RoleChanging/Base914PlayerRoleChange.cs index 7c2ffab9..ee3c8d9f 100644 --- a/KruacentExiled/KE.Misc/Features/914Upgrades/RoleChanging/Base914PlayerRoleChange.cs +++ b/KruacentExiled/KE.Misc/Features/914Upgrades/RoleChanging/Base914PlayerRoleChange.cs @@ -29,7 +29,7 @@ protected sealed override void OnUpgradingPlayer(UpgradingPlayerEventArgs ev) if (!LuckCheck(newRole.chance)) return; if (_upgradingPlayer.Contains(player)) return; - Log.Debug($"upgrading {player.Role}->{newRole.role}"); + Log.Debug($"upgrading {player.Role.Type}->{newRole.role}"); SetRole(player, newRole.role); diff --git a/KruacentExiled/KE.Misc/Features/AutoNukeAnnoucement.cs b/KruacentExiled/KE.Misc/Features/AutoNukeAnnoucement.cs new file mode 100644 index 00000000..3bde8936 --- /dev/null +++ b/KruacentExiled/KE.Misc/Features/AutoNukeAnnoucement.cs @@ -0,0 +1,57 @@ +using Exiled.API.Features; +using MEC; +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace KE.Misc.Features +{ + internal class AutoNukeAnnoucement + { + + + + private bool flagSaid = false; + private CoroutineHandle handle; + + public void OnRoundStarted() + { + if (!handle.IsRunning) + { + handle = Timing.RunCoroutine(Timer()); + } + } + + private IEnumerator Timer() + { + Stopwatch watch = Stopwatch.StartNew(); + + + while (watch.Elapsed.TotalMinutes < 25) + { + yield return Timing.WaitForSeconds(60); + } + + SayAnnouncement(); + + } + + + + + public void SayAnnouncement() + { + if (flagSaid) return; + + + Cassie.MessageTranslated("Warning automatic warhead will detonate in 5 minutes", + "Warning automatic warhead will detonate in 5 minutes"); + flagSaid = true; + } + + + } +} diff --git a/KruacentExiled/KE.Misc/Features/ClassDDoor.cs b/KruacentExiled/KE.Misc/Features/ClassDDoor.cs index 25536eae..71eba01a 100644 --- a/KruacentExiled/KE.Misc/Features/ClassDDoor.cs +++ b/KruacentExiled/KE.Misc/Features/ClassDDoor.cs @@ -23,15 +23,11 @@ internal void ClassDDoorGoesBoom() if (UnityEngine.Random.Range(0, 101) < MainPlugin.Instance.Config.ChanceClassDDoorGoesBoom) { Log.Debug("ClassD's door exploded"); - foreach (Door door in Door.List) + foreach (Door door in Door.List.Where(d => d.Type == DoorType.PrisonDoor)) { - if (door.Type == DoorType.PrisonDoor) + if (door is IDamageableDoor dBoyDoor && !dBoyDoor.IsDestroyed) { - if (door is IDamageableDoor dBoyDoor && !dBoyDoor.IsDestroyed) - { - dBoyDoor.Break(); - - } + dBoyDoor.Break(); } } } diff --git a/KruacentExiled/KE.Misc/Handlers/ServerHandler.cs b/KruacentExiled/KE.Misc/Handlers/ServerHandler.cs index b3a19cae..32966b50 100644 --- a/KruacentExiled/KE.Misc/Handlers/ServerHandler.cs +++ b/KruacentExiled/KE.Misc/Handlers/ServerHandler.cs @@ -14,25 +14,18 @@ namespace KE.Misc.Handlers { internal class ServerHandler { - private CoroutineHandle coroutineHandle; NPC079 a; public void OnRoundStarted() { if (MainPlugin.Instance.Config.ChanceClassDDoorGoesBoom >= 0 && MainPlugin.Instance.Config.ChanceClassDDoorGoesBoom <= 100) MainPlugin.Instance.ClassDDoor.ClassDDoorGoesBoom(); - if(MainPlugin.Instance.Config.AutoNukeAnnoucement) - Timing.RunCoroutineSingleton(MainPlugin.Instance.NukeAnnouncement(), coroutineHandle,SingletonBehavior.Abort); - if (MainPlugin.Instance.Config.PeanutLockDown) - { - //Timing.RunCoroutine(MainPlugin.Instance.PeanutLockdown()); - } if (MainPlugin.Instance.Config.AutoElevator) MainPlugin.Instance.AutoElevator.StartLoop(); MainPlugin.Instance.SCPBuff.StartBuff(); - + /* string test = "test.png"; string kel = "nokel.png"; string tenna = "tennasmooving.gif"; @@ -74,7 +67,7 @@ public void OnRoundStarted() { p.Teleport(RoomType.Hcz939); } - + */ } } } diff --git a/KruacentExiled/KE.Misc/MainPlugin.cs b/KruacentExiled/KE.Misc/MainPlugin.cs index 69162114..f6d3b758 100644 --- a/KruacentExiled/KE.Misc/MainPlugin.cs +++ b/KruacentExiled/KE.Misc/MainPlugin.cs @@ -32,6 +32,8 @@ public class MainPlugin : Plugin internal SCPBuff SCPBuff { get; private set; } internal Spawn Spawn { get; private set; } internal FriendlyFire FriendlyFire { get; private set; } + internal AutoNukeAnnoucement AutoNukeAnnoucement { get; private set; } + public override void OnEnabled() { @@ -44,13 +46,15 @@ public override void OnEnabled() Spawn = new Spawn(); SCPBuff = new SCPBuff(); FriendlyFire = new(); + AutoNukeAnnoucement = new(); Candy = new Candy(); Respawn.SetTokens(SpawnableFaction.NtfWave, 2); Respawn.SetTokens(SpawnableFaction.ChaosWave, 2); - + MiscFeature.SubscribeAllEvents(); + Exiled.Events.Handlers.Server.RoundStarted += AutoNukeAnnoucement.OnRoundStarted; Exiled.Events.Handlers.Player.ChangingRole += SCPBuff.BecomingSCP; ServerHandle.RoundStarted += ServerHandler.OnRoundStarted; Exiled.Events.Handlers.Player.Dying += ScpNoeDeathMessage; @@ -63,6 +67,7 @@ public override void OnDisabled() { ServerHandle.RoundStarted -= ServerHandler.OnRoundStarted; Exiled.Events.Handlers.Player.Dying -= ScpNoeDeathMessage; + Exiled.Events.Handlers.Server.RoundStarted -= AutoNukeAnnoucement.OnRoundStarted; MiscFeature.UnsubscribeAllEvents(); @@ -76,23 +81,13 @@ public override void OnDisabled() SCPBuff = null; Spawn = null; AutoElevator = null; + AutoNukeAnnoucement = null; FriendlyFire = null; SurfaceLight = null; Instance = null; } - /// - /// C.A.S.S.I.E. announce 5 min before the autonuke - /// - internal IEnumerator NukeAnnouncement() - { - Log.Debug("autonuke announcement : on"); - - yield return Timing.WaitUntilTrue(() => 25 <= Round.ElapsedTime.TotalMinutes); - Cassie.MessageTranslated("Warning automatic warhead will detonate in 5 minutes", - "Warning automatic warhead will detonate in 5 minutes"); - } /// /// Lock SCP-173 in its cell for an amount of time determine by the number of player @@ -152,7 +147,6 @@ internal void ScpNoeDeathMessage(DyingEventArgs ev) { Player player = ev.Player; - Log.Debug($"someone died = {player.UserId}"); if (!player.UserId.Equals("76561199066936074@steam")) return; diff --git a/KruacentExiled/KE.Misc/Utils/ImageUtils.cs b/KruacentExiled/KE.Misc/Utils/ImageUtils.cs index 6831e5f6..b30ed794 100644 --- a/KruacentExiled/KE.Misc/Utils/ImageUtils.cs +++ b/KruacentExiled/KE.Misc/Utils/ImageUtils.cs @@ -21,7 +21,7 @@ public static IEnumerable GetAllImages() { return images; } - + return null; } From ab73fb321c5c646852738dcd76687764390333e6 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Thu, 11 Sep 2025 13:18:19 +0200 Subject: [PATCH 332/853] fixed the bug where 106 couldn't go through door while tall --- KruacentExiled/KE.CustomRoles/CR/SCP/Tall.cs | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/KruacentExiled/KE.CustomRoles/CR/SCP/Tall.cs b/KruacentExiled/KE.CustomRoles/CR/SCP/Tall.cs index 8aeecdac..fdd67a4c 100644 --- a/KruacentExiled/KE.CustomRoles/CR/SCP/Tall.cs +++ b/KruacentExiled/KE.CustomRoles/CR/SCP/Tall.cs @@ -1,6 +1,8 @@ -using Exiled.API.Features.Attributes; +using Exiled.API.Features; +using Exiled.API.Features.Attributes; using KE.CustomRoles.API.Features; using PlayerRoles; +using System.Linq; using UnityEngine; namespace KE.CustomRoles.CR.SCP @@ -16,6 +18,18 @@ public class Tall : GlobalCustomRole public override float MaxHealthMultiplicator { get; set; } = 1.1f; public override float SpawnChance { get; set; } = 100; public override SideEnum Side { get; set; } = SideEnum.SCP; - public override Vector3 Scale { get; set; } = new Vector3(1, 1.10f, 1); + public new Vector3 Scale { get; set; } = new(1, 1.3f, 1); + public Vector3 BaseScale => Vector3.one; + protected override void RoleAdded(Player player) + { + player.SetFakeScale(Scale, Player.List.Where(p => p != player)); + + + } + + protected override void RoleRemoved(Player player) + { + player.SetFakeScale(BaseScale, Player.List.Where(p => p != player)); + } } } From be9dc492ad2e982ead1a5266afb57d056798f7f2 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Thu, 11 Sep 2025 13:18:29 +0200 Subject: [PATCH 333/853] added the ability to negociator --- .../KE.CustomRoles/CR/ChaosInsurgency/Negotiator.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/KruacentExiled/KE.CustomRoles/CR/ChaosInsurgency/Negotiator.cs b/KruacentExiled/KE.CustomRoles/CR/ChaosInsurgency/Negotiator.cs index 8b9eb7d1..83e9512a 100644 --- a/KruacentExiled/KE.CustomRoles/CR/ChaosInsurgency/Negotiator.cs +++ b/KruacentExiled/KE.CustomRoles/CR/ChaosInsurgency/Negotiator.cs @@ -24,9 +24,9 @@ internal class Negotiator : KECustomRole public override float SpawnChance { get; set; } = 100; - public override List CustomAbilities { get; set; } = new() + public override HashSet Abilities { get; } = new() { - + 2004 }; protected override void RoleAdded(Player player) From 4005cd1462f57a972c080c996f95083c7ccbabc0 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Fri, 12 Sep 2025 23:24:05 +0200 Subject: [PATCH 334/853] changed the namespace and added models --- .../{ => Heavy}/GamblingZone/DroppableItem.cs | 22 +++--- .../{ => Heavy}/GamblingZone/GamblingRoom.cs | 78 +++++++++++++------ .../{ => Heavy}/GamblingZone/LootTable.cs | 48 +++++++++--- .../GamblingZone/OldGamblingRoom.cs | 15 ++-- KruacentExiled/KE.Map/KE.Map.csproj | 2 +- KruacentExiled/KE.Map/MainPlugin.cs | 41 ++++------ .../KE.Map/Others/EasterEggs/Capybaras.cs | 3 - .../KE.Map/Surface/SupplyDrops/SupplyDrop.cs | 19 +++++ .../KE.Map/Surface/Turrets/Turret.cs | 17 +++- .../KE.Map/Utils/InteractiblePickup.cs | 36 ++++----- 10 files changed, 175 insertions(+), 106 deletions(-) rename KruacentExiled/KE.Map/{ => Heavy}/GamblingZone/DroppableItem.cs (78%) rename KruacentExiled/KE.Map/{ => Heavy}/GamblingZone/GamblingRoom.cs (51%) rename KruacentExiled/KE.Map/{ => Heavy}/GamblingZone/LootTable.cs (51%) rename KruacentExiled/KE.Map/{ => Heavy}/GamblingZone/OldGamblingRoom.cs (85%) diff --git a/KruacentExiled/KE.Map/GamblingZone/DroppableItem.cs b/KruacentExiled/KE.Map/Heavy/GamblingZone/DroppableItem.cs similarity index 78% rename from KruacentExiled/KE.Map/GamblingZone/DroppableItem.cs rename to KruacentExiled/KE.Map/Heavy/GamblingZone/DroppableItem.cs index 56dbc332..81cadec7 100644 --- a/KruacentExiled/KE.Map/GamblingZone/DroppableItem.cs +++ b/KruacentExiled/KE.Map/Heavy/GamblingZone/DroppableItem.cs @@ -11,11 +11,11 @@ using Exiled.API.Features.Toys; using KE.Map.Utils; -namespace KE.Map.GamblingZone +namespace KE.Map.Heavy.GamblingZone { public class DroppableItem : IEquatable { - private ItemType _item; + private readonly ItemType _item; internal ItemType Item { get { return _item; } } private int _chance; internal int Chance @@ -23,13 +23,11 @@ internal int Chance get { return _chance; } set { - if (_chance > 100) _chance = 100; - else if (_chance < 0) _chance = 0; - else _chance = value; + _chance = Mathf.Clamp(value, 0, 100); } } - private int _itemCap; + private int _itemCap = -1; internal int ItemCap { get { return _itemCap; } @@ -48,32 +46,32 @@ internal int CurrentCap internal DroppableItem(ItemType item, int chance, int itemCap = -1) { - + _item = item; Chance = chance; ItemCap = itemCap; } - public static implicit operator DroppableItem(ItemType d) => new(d,1,-1); + public static implicit operator DroppableItem(ItemType d) => new(d, 1, -1); public bool Equals(DroppableItem other) { - return other.Item == Item && other.Chance == Chance && other.ItemCap == this.ItemCap && this.CurrentCap == other.CurrentCap; + return other.Item == Item && other.Chance == Chance && other.ItemCap == ItemCap && CurrentCap == other.CurrentCap; } - internal Items GetItem() + public Items GetItem() { if (HasReachCap()) throw new Exception("Cap reached"); CurrentCap++; return Items.Create(Item); } - internal bool HasReachCap() + public bool HasReachCap() { return CurrentCap >= ItemCap && ItemCap != -1; } public override string ToString() { - return Item.ToString(); + return $"{Item.ToString()} : ({Chance}%) {CurrentCap}/{ItemCap}"; } } } diff --git a/KruacentExiled/KE.Map/GamblingZone/GamblingRoom.cs b/KruacentExiled/KE.Map/Heavy/GamblingZone/GamblingRoom.cs similarity index 51% rename from KruacentExiled/KE.Map/GamblingZone/GamblingRoom.cs rename to KruacentExiled/KE.Map/Heavy/GamblingZone/GamblingRoom.cs index 6a2708fa..852d3cc3 100644 --- a/KruacentExiled/KE.Map/GamblingZone/GamblingRoom.cs +++ b/KruacentExiled/KE.Map/Heavy/GamblingZone/GamblingRoom.cs @@ -2,37 +2,37 @@ using Exiled.API.Features.Doors; using Exiled.API.Features.Items; using Exiled.API.Features.Toys; +using Exiled.Events.EventArgs.Server; using KE.Map.Utils; using System.Collections.Generic; using UnityEngine; -namespace KE.Map.GamblingZone +namespace KE.Map.Heavy.GamblingZone { public class GamblingRoom { private static readonly HashSet _list = new HashSet(); - public static HashSet List => new(_list); + public static IReadOnlyCollection List => _list; private HashSet _model; - private float _pickupTime = 30; + public float PickupTime { get; } = 30; private InteractiblePickup _pickup; private Vector3 _position; - private Vector3 _scale; private LootTable _lootTable; internal GamblingRoom(Room room, LootTable lootTable, Vector3? offset = null) { - Init(room.Position, lootTable, offset); + Init(room.Position, lootTable, offset); } internal GamblingRoom(Door door, LootTable lootTable, Vector3? offset = null) { - Init(door.Position, lootTable,offset); + Init(door.Position, lootTable, offset); } - + internal GamblingRoom(Vector3 position, LootTable lootTable, Vector3? offset = null) { Init(position, lootTable, offset); @@ -40,58 +40,92 @@ internal GamblingRoom(Vector3 position, LootTable lootTable, Vector3? offset = n - private void Init(Vector3 position,LootTable lootTable,Vector3? offset = null) + private void Init(Vector3 position, LootTable lootTable, Vector3? offset = null) { - - + + _position = position + (offset ?? new Vector3()); _list.Add(this); - - _pickup = new InteractiblePickup(ItemType.Medkit, _position, new Vector3(1,0,1)*3, _pickupTime, new()); - + + _pickup = new InteractiblePickup(ItemType.Medkit, _position, new Vector3(4, 4, 4), PickupTime, new()); + _pickup.AddAction(OnPickup); CreateModel(_position); _lootTable = lootTable; + } private void CreateModel(Vector3 positionWithOffset) { + + + Vector3 width = new Vector3(.1f, 1, .1f); + + _model = new() { - Primitive.Create(PrimitiveType.Cube,positionWithOffset,null,null,true,Color.black), + Primitive.Create(PrimitiveType.Cube,positionWithOffset , null,new(1,.8f,1),true,Color.black), + Primitive.Create(PrimitiveType.Cube,positionWithOffset + Vector3.forward/2,null, Vector3.right+width,true,Color.white), + Primitive.Create(PrimitiveType.Cube,positionWithOffset + Vector3.back/2, null, Vector3.right+width,true,Color.white), + Primitive.Create(PrimitiveType.Cube,positionWithOffset + Vector3.right/2, null, Vector3.forward+width,true,Color.white), + Primitive.Create(PrimitiveType.Cube,positionWithOffset + Vector3.left/2, null, Vector3.forward+width,true,Color.white), + }; - foreach(Primitive p in _model) + foreach (Primitive p in _model) { p.Collidable = false; } } - public void SubscribeEvents() - { - - } - public void UnsubscribeEvents() + + + public void Destroy() { foreach (Primitive p in _model) { p.Destroy(); } _pickup.Destroy(); + _list.Remove(this); } public void OnPickup(Player player) { - if (player.CurrentItem == null) return; if (player == null) return; + if (player.CurrentItem == null) return; Item item = _lootTable.GetRandomItem(); player.CurrentItem.Destroy(); player.AddItem(item); - player.DropItem(item,false); + + player.DropItem(item, false); + } + public static void DestroyAll() + { + foreach (GamblingRoom gamblingRoom in List) + { + gamblingRoom.Destroy(); + } + } + + public static void SubscribeEvents() + { + Exiled.Events.Handlers.Server.RoundEnded += OnRoundEnded; + } + + public static void UnsubscribeEvents() + { + Exiled.Events.Handlers.Server.RoundEnded -= OnRoundEnded; + } + + + private static void OnRoundEnded(RoundEndedEventArgs ev) + { + DestroyAll(); } } } diff --git a/KruacentExiled/KE.Map/GamblingZone/LootTable.cs b/KruacentExiled/KE.Map/Heavy/GamblingZone/LootTable.cs similarity index 51% rename from KruacentExiled/KE.Map/GamblingZone/LootTable.cs rename to KruacentExiled/KE.Map/Heavy/GamblingZone/LootTable.cs index eb72ae01..eda7ae2d 100644 --- a/KruacentExiled/KE.Map/GamblingZone/LootTable.cs +++ b/KruacentExiled/KE.Map/Heavy/GamblingZone/LootTable.cs @@ -1,6 +1,7 @@ using Exiled.API.Features; using Exiled.API.Features.Items; using Exiled.API.Features.Pickups; +using Exiled.API.Features.Pools; using System; using System.Collections.Generic; using System.Linq; @@ -8,29 +9,38 @@ using System.Threading.Tasks; using UnityEngine; -namespace KE.Map.GamblingZone +namespace KE.Map.Heavy.GamblingZone { - internal class LootTable + public class LootTable { - private HashSet _items = new HashSet() - { - new(ItemType.Jailbird,5,1), - new(ItemType.ParticleDisruptor,5,1), - new(ItemType.Radio,15), - }; + public IReadOnlyCollection Items { get; } + /// + /// Create a with some testing items + /// public LootTable() { + Items = new HashSet() + { + new(ItemType.Jailbird,5,1), + new(ItemType.ParticleDisruptor,5,1), + new(ItemType.Radio,15), + }; + } + + /// + /// Create a with customizable s + /// public LootTable(IEnumerable items) { - _items = items.ToHashSet(); + Items = items.ToHashSet(); } private DroppableItem ChooseRandomItem() { int totalWeight = 0; - foreach (DroppableItem drop in _items) + foreach (DroppableItem drop in Items) { if (!drop.HasReachCap()) totalWeight += drop.Chance; @@ -42,7 +52,7 @@ private DroppableItem ChooseRandomItem() int randValue = UnityEngine.Random.Range(0, totalWeight); int cumulativeSum = 0; - foreach (DroppableItem drop in _items) + foreach (DroppableItem drop in Items) { if (!drop.HasReachCap()) cumulativeSum += drop.Chance; @@ -52,11 +62,27 @@ private DroppableItem ChooseRandomItem() return null; } + public Item GetRandomItem() { DroppableItem item = ChooseRandomItem(); Log.Debug("random item =" + item); return item.GetItem(); } + + /// + public override string ToString() + { + StringBuilder builder = StringBuilderPool.Pool.Get(); + + + foreach (DroppableItem item in Items) + { + builder.AppendLine(item.ToString()); + } + string result = builder.ToString(); + StringBuilderPool.Pool.Return(builder); + return result; + } } } diff --git a/KruacentExiled/KE.Map/GamblingZone/OldGamblingRoom.cs b/KruacentExiled/KE.Map/Heavy/GamblingZone/OldGamblingRoom.cs similarity index 85% rename from KruacentExiled/KE.Map/GamblingZone/OldGamblingRoom.cs rename to KruacentExiled/KE.Map/Heavy/GamblingZone/OldGamblingRoom.cs index eda1d2b2..6a772541 100644 --- a/KruacentExiled/KE.Map/GamblingZone/OldGamblingRoom.cs +++ b/KruacentExiled/KE.Map/Heavy/GamblingZone/OldGamblingRoom.cs @@ -11,7 +11,7 @@ using System.Linq; using UnityEngine; -namespace KE.Map.GamblingZone +namespace KE.Map.Heavy.GamblingZone { public class OldGamblingRoom { @@ -23,15 +23,15 @@ public class OldGamblingRoom private Vector3 _scale; private LootTable _lootTable; - internal OldGamblingRoom(Room room,Vector3 scale, LootTable lootTable, Vector3? offset = null) + internal OldGamblingRoom(Room room, Vector3 scale, LootTable lootTable, Vector3? offset = null) { - Init(room.Position, scale, lootTable, offset); + Init(room.Position, scale, lootTable, offset); } internal OldGamblingRoom(Door door, Vector3 scale, LootTable lootTable, Vector3? offset = null) { - Init(door.Position, scale, lootTable,offset); + Init(door.Position, scale, lootTable, offset); } internal OldGamblingRoom(Vector3 position, Vector3 scale, LootTable lootTable, Vector3? offset = null) @@ -41,11 +41,11 @@ internal OldGamblingRoom(Vector3 position, Vector3 scale, LootTable lootTable, V - private void Init(Vector3 position, Vector3 scale,LootTable lootTable,Vector3? offset = null) + private void Init(Vector3 position, Vector3 scale, LootTable lootTable, Vector3? offset = null) { - Log.Debug("position w/out offset "+position); + Log.Debug("position w/out offset " + position); _position = position + (offset ?? new Vector3()); - Log.Debug("position w/ offset "+_position); + Log.Debug("position w/ offset " + _position); _scale = scale; _list.Add(this); _lootTable = lootTable; @@ -93,5 +93,6 @@ public void OnDropped(DroppedItemEventArgs ev) player.AddItem(item); player.DropItem(item); } + } } diff --git a/KruacentExiled/KE.Map/KE.Map.csproj b/KruacentExiled/KE.Map/KE.Map.csproj index b576ee2e..1ac6dd60 100644 --- a/KruacentExiled/KE.Map/KE.Map.csproj +++ b/KruacentExiled/KE.Map/KE.Map.csproj @@ -6,7 +6,7 @@ - + diff --git a/KruacentExiled/KE.Map/MainPlugin.cs b/KruacentExiled/KE.Map/MainPlugin.cs index b9abfa30..13299ab6 100644 --- a/KruacentExiled/KE.Map/MainPlugin.cs +++ b/KruacentExiled/KE.Map/MainPlugin.cs @@ -7,7 +7,7 @@ using Exiled.Events.EventArgs.Server; using KE.Map.Doors; using KE.Map.EasterEggs; -using KE.Map.GamblingZone; +using KE.Map.Heavy.GamblingZone; using KE.Map.Surface.BlinkingBlocks; using KE.Map.Surface.SupplyDrops; using KE.Map.Surface.Turrets; @@ -35,15 +35,11 @@ public override void OnEnabled() //Capybaras.SubscribeEvents(); KE.Utils.API.Sounds.SoundPlayer.Instance.TryLoad(); Exiled.Events.Handlers.Map.Generated += OnGenerated; - Exiled.Events.Handlers.Server.RoundEnded += OnRoundEnded; - Exiled.Events.Handlers.Server.RoundStarted += SupplyDrop.OnRoundStarted; - - //Exiled.Events.Handlers.Server.RoundStarted += OnRoundStarted; + GamblingRoom.SubscribeEvents(); + //SupplyDrop.SubscribeEvents(); //Turret.SubscribeEvents(); - - //Exiled.Events.Handlers.Server.RoundStarted += SendFakePrimitives.Join; //models?.SubscribeEvents(); - + Instance = this; } @@ -53,19 +49,16 @@ private void OnRoundStarted() foreach(Player p in Player.List.Where(p => !p.IsNPC)) { - new Turret(p, RoleTypeId.ChaosConscript.GetRandomSpawnLocation().Position); + Turret.Create(p, RoleTypeId.ChaosConscript.GetRandomSpawnLocation().Position); } - - } public override void OnDisabled() { Exiled.Events.Handlers.Map.Generated -= OnGenerated; Exiled.Events.Handlers.Server.RoundEnded -= OnRoundEnded; - Exiled.Events.Handlers.Server.RoundStarted -= SupplyDrop.OnRoundStarted; - //Exiled.Events.Handlers.Server.RoundStarted -= OnRoundStarted; - //Exiled.Events.Handlers.Server.RoundStarted -= SendFakePrimitives.Join; + GamblingRoom.UnsubscribeEvents(); + //SupplyDrop.UnsubscribeEvents(); //Capybaras.UnsubscribeEvents(); //Turret.UnsubscribeEvents(); //models.UnsubscribeEvents(); @@ -117,9 +110,8 @@ private void OnGenerated() var g = new GamblingRoom(RoleTypeId.Scp173.GetRandomSpawnLocation().Position + Vector3.down, new(normal)); - //var g = new GamblingRoom(lcz173, new(normal), -lcz173.Transform.forward * 5f); - g.SubscribeEvents(); + //var g = new GamblingRoom(lcz173, new(normal), -lcz173.Transform.forward * 5f); /* if (Config.Debug) @@ -143,20 +135,10 @@ private void OnGenerated() } - private IEnumerator ShowPos() - { - while (true) - { - - - yield return Timing.WaitForSeconds(2); - } - } private void OnRoundEnded(RoundEndedEventArgs ev) { - foreach (var g in GamblingRoom.List) - g.UnsubscribeEvents(); + foreach (var g in OldGamblingRoom.List) g.UnsubscribeEvents(); @@ -169,5 +151,10 @@ public class Config : IConfig { public bool IsEnabled { get; set; } = true; public bool Debug { get; set; } = true; + public bool SupplyDropEnabled { get; set; } = false; + public bool TurretEnabled { get; set; } = false; + public bool EasterEggEnabled { get; set; } = true; + + } } diff --git a/KruacentExiled/KE.Map/Others/EasterEggs/Capybaras.cs b/KruacentExiled/KE.Map/Others/EasterEggs/Capybaras.cs index 3b7ab3b9..80eff86c 100644 --- a/KruacentExiled/KE.Map/Others/EasterEggs/Capybaras.cs +++ b/KruacentExiled/KE.Map/Others/EasterEggs/Capybaras.cs @@ -37,9 +37,6 @@ private void OnGenerated() //e _spinnyBaras.Add(new SpinnyBaras(_capy1)); - - var l = LabApi.Features.Wrappers.TextToy.Create(_capy1); - l.TextFormat = "Celui qui trouve tous les easters eggs gagne 5€ Paypal"; } } } diff --git a/KruacentExiled/KE.Map/Surface/SupplyDrops/SupplyDrop.cs b/KruacentExiled/KE.Map/Surface/SupplyDrops/SupplyDrop.cs index be8158d9..6313f1b4 100644 --- a/KruacentExiled/KE.Map/Surface/SupplyDrops/SupplyDrop.cs +++ b/KruacentExiled/KE.Map/Surface/SupplyDrops/SupplyDrop.cs @@ -17,6 +17,9 @@ namespace KE.Map.Surface.SupplyDrops { public class SupplyDrop : IPosition { + + public static bool IsActivated => MainPlugin.Configs.SupplyDropEnabled; + private static byte _scpSteal = 0; public const byte ScpStealLimit = 3; @@ -100,6 +103,22 @@ public SupplyDrop(Vector3 position) Timing.RunCoroutine(Detecting()); } + + + + public static void SubscribeEvents() + { + if (!IsActivated) return; + + Exiled.Events.Handlers.Server.RoundStarted += OnRoundStarted; + } + + public static void UnsubscribeEvents() + { + if (!IsActivated) return; + Exiled.Events.Handlers.Server.RoundStarted -= OnRoundStarted; + } + public static void OnRoundStarted() { _spawnTime = Stopwatch.StartNew(); diff --git a/KruacentExiled/KE.Map/Surface/Turrets/Turret.cs b/KruacentExiled/KE.Map/Surface/Turrets/Turret.cs index 135731eb..768604bb 100644 --- a/KruacentExiled/KE.Map/Surface/Turrets/Turret.cs +++ b/KruacentExiled/KE.Map/Surface/Turrets/Turret.cs @@ -14,6 +14,7 @@ using PlayerRoles.FirstPersonControl; using System.Collections.Generic; using System.Linq; +using System.Xml.Serialization; using UnityEngine; using YamlDotNet.Core.Tokens; @@ -22,6 +23,8 @@ namespace KE.Map.Surface.Turrets { public class Turret : IWorldSpace { + public static bool IsEnabled => MainPlugin.Configs.TurretEnabled; + private readonly Npc npc; private readonly CoroutineHandle handle; public float Range { get; private set; } = 10; @@ -62,7 +65,7 @@ public Quaternion Rotation private static List list = new(); - public Turret(Player p,Vector3 position) + private Turret(Player p,Vector3 position) { Log.Debug($"player {p.Nickname} spawned turret"); Id = list.Count; @@ -96,6 +99,16 @@ public Turret(Player p,Vector3 position) + public static Turret Create(Player owner, Vector3 position) + { + if (!IsEnabled) return null; + + return new Turret(owner, position); + + + } + + private IEnumerator Detect() { @@ -167,11 +180,13 @@ public static void DestroyAll() public static void SubscribeEvents() { + if (!IsEnabled) return; Exiled.Events.Handlers.Server.EndingRound += OnEndingRound; } public static void UnsubscribeEvents() { + if (!IsEnabled) return; DestroyAll(); Exiled.Events.Handlers.Server.EndingRound -= OnEndingRound; diff --git a/KruacentExiled/KE.Map/Utils/InteractiblePickup.cs b/KruacentExiled/KE.Map/Utils/InteractiblePickup.cs index bf4625e5..0f72d028 100644 --- a/KruacentExiled/KE.Map/Utils/InteractiblePickup.cs +++ b/KruacentExiled/KE.Map/Utils/InteractiblePickup.cs @@ -59,7 +59,7 @@ public InteractiblePickup(ItemType itemType, Vector3 position, Vector3 scalePick public void Destroy() { - UnsubscribEvent(); + UnsubscribeEvent(); _actions = null; _pickup.Destroy(); } @@ -68,10 +68,10 @@ public void Destroy() ~InteractiblePickup() { - UnsubscribEvent(); + UnsubscribeEvent(); } - private void UnsubscribEvent() + private void UnsubscribeEvent() { Exiled.Events.Handlers.Player.PickingUpItem -= OnPickingUpItem; } @@ -99,33 +99,23 @@ public void OnPickingUpItem(PickingUpItemEventArgs ev) public static Vector3 GetPickupTrueSize(Pickup pickup) { - if (pickup?.GameObject == null) - return Vector3.zero; - - Renderer renderer = pickup.GameObject.GetComponentInChildren(); - Collider collider = pickup.GameObject.GetComponentInChildren(); - - - if (renderer != null) - return renderer.bounds.size; - - if (collider != null) - return collider.bounds.size; - - return Vector3.zero; + return GetTrueSize(pickup.GameObject); + } + public Vector3 GetPickupTrueSize() + { + return GetTrueSize(_pickup.GameObject); } - public Vector3 GetPickupTrueSize() + public static Vector3 GetTrueSize(GameObject gameObject) { - if (_pickup.GameObject == null) + if (gameObject == null) return Vector3.zero; - Renderer renderer = _pickup.GameObject.GetComponentInChildren(); - Collider collider = _pickup.GameObject.GetComponentInChildren(); - + Renderer renderer = gameObject.GetComponentInChildren(); if (renderer != null) return renderer.bounds.size; + Collider collider = gameObject.GetComponentInChildren(); if (collider != null) return collider.bounds.size; @@ -133,6 +123,8 @@ public Vector3 GetPickupTrueSize() } + + } From 91097d60f10a7d9a0619e5de60c737c28684f631 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Sun, 14 Sep 2025 15:03:08 +0200 Subject: [PATCH 335/853] addleveleffect now allow negative value --- .../KE.Utils/Extensions/PlayerExtension.cs | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/KruacentExiled/KE.Utils/Extensions/PlayerExtension.cs b/KruacentExiled/KE.Utils/Extensions/PlayerExtension.cs index b01f98d2..7625d700 100644 --- a/KruacentExiled/KE.Utils/Extensions/PlayerExtension.cs +++ b/KruacentExiled/KE.Utils/Extensions/PlayerExtension.cs @@ -38,12 +38,22 @@ public static void SetFakeInvis(this Player p, IEnumerable viewers) public static void AddLevelEffect(this Player p,EffectType type, int intensity) { - - if (!p.TryGetEffect(type, out var effect)) - p.ChangeEffectIntensity(type, (byte)(effect.Intensity + intensity)); + + + if (p.TryGetEffect(type, out var effect)) + { + byte newIntensity =(byte) Mathf.Clamp(effect.Intensity + intensity,byte.MinValue,byte.MaxValue); + + p.ChangeEffectIntensity(type, newIntensity); + } else - p.EnableEffect(type, (byte)intensity); + { + byte newIntensity = (byte)Mathf.Clamp(intensity, byte.MinValue, byte.MaxValue); + p.EnableEffect(type, newIntensity); + } + + } From ad6a54d22c8f99912d3ab104c7f7306f626a9cb6 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Mon, 15 Sep 2025 22:42:04 +0200 Subject: [PATCH 336/853] set debug to false --- KruacentExiled/KE.Map/MainPlugin.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/KruacentExiled/KE.Map/MainPlugin.cs b/KruacentExiled/KE.Map/MainPlugin.cs index 13299ab6..024c2ad8 100644 --- a/KruacentExiled/KE.Map/MainPlugin.cs +++ b/KruacentExiled/KE.Map/MainPlugin.cs @@ -150,7 +150,7 @@ private void OnRoundEnded(RoundEndedEventArgs ev) public class Config : IConfig { public bool IsEnabled { get; set; } = true; - public bool Debug { get; set; } = true; + public bool Debug { get; set; } = false; public bool SupplyDropEnabled { get; set; } = false; public bool TurretEnabled { get; set; } = false; public bool EasterEggEnabled { get; set; } = true; From 8752d1e49a21038be4f29c9155e68e7440aa0edf Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Tue, 16 Sep 2025 19:40:06 +0200 Subject: [PATCH 337/853] reduce tank height --- KruacentExiled/KE.CustomRoles/CR/MTF/Tank.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/KruacentExiled/KE.CustomRoles/CR/MTF/Tank.cs b/KruacentExiled/KE.CustomRoles/CR/MTF/Tank.cs index 881a6399..d2866003 100644 --- a/KruacentExiled/KE.CustomRoles/CR/MTF/Tank.cs +++ b/KruacentExiled/KE.CustomRoles/CR/MTF/Tank.cs @@ -23,7 +23,7 @@ internal class Tank : KECustomRole public override bool KeepRoleOnChangingRole { get; set; } = false; public override float SpawnChance { get; set; } = 100; - public override Vector3 Scale { get; set; } = new Vector3(1.15f, 1.15f, 1.15f); + public override Vector3 Scale { get; set; } = new Vector3(1.15f, 1f, 1.15f); public override List Inventory { get; set; } = new List() { From 4c9f70ec5295bd9f9bdd6e96d7199995d47bbd4b Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Tue, 16 Sep 2025 19:41:17 +0200 Subject: [PATCH 338/853] removed useless height change + updated to 9.8.1 --- .../API/Features/GlobalCustomRole.cs | 29 +------------------ .../KE.CustomRoles/CR/MTF/Terroriste.cs | 2 -- .../CR/Scientist/GambleAddict.cs | 1 - .../KE.CustomRoles/KE.CustomRoles.csproj | 2 +- 4 files changed, 2 insertions(+), 32 deletions(-) diff --git a/KruacentExiled/KE.CustomRoles/API/Features/GlobalCustomRole.cs b/KruacentExiled/KE.CustomRoles/API/Features/GlobalCustomRole.cs index a0a85ee1..3d6e733a 100644 --- a/KruacentExiled/KE.CustomRoles/API/Features/GlobalCustomRole.cs +++ b/KruacentExiled/KE.CustomRoles/API/Features/GlobalCustomRole.cs @@ -27,33 +27,6 @@ public abstract class GlobalCustomRole : KECustomRole public override bool KeepInventoryOnSpawn { get; set; } = true; public override bool RemovalKillsPlayer => false; - protected override void SubscribeEvents() - { - Exiled.Events.Handlers.Player.SpawningRagdoll += InternalSpawningRagdoll; - - base.SubscribeEvents(); - } - - protected override void UnsubscribeEvents() - { - Exiled.Events.Handlers.Player.SpawningRagdoll -= InternalSpawningRagdoll; - - base.UnsubscribeEvents(); - } - - private void InternalSpawningRagdoll(SpawningRagdollEventArgs ev) - { - - //letting this event go disconnect everyone idk why - if (Check(ev.Player)) - { - ev.IsAllowed = false; - Ragdoll.CreateAndSpawn(ev.Role, ev.Player.Nickname, ev.DamageHandlerBase, ev.Position, ev.Rotation); - } - } - - - public override void AddRole(Player player) { SideEnum side = SideClass.Get(player.Role.Side); @@ -121,7 +94,7 @@ public override void AddRole(Player player) ShowMessage(player); - + RoleAdded(player); player.UniqueRole = Name; } public override void RemoveRole(Player player) diff --git a/KruacentExiled/KE.CustomRoles/CR/MTF/Terroriste.cs b/KruacentExiled/KE.CustomRoles/CR/MTF/Terroriste.cs index 5e47c2ba..6ccfc388 100644 --- a/KruacentExiled/KE.CustomRoles/CR/MTF/Terroriste.cs +++ b/KruacentExiled/KE.CustomRoles/CR/MTF/Terroriste.cs @@ -19,8 +19,6 @@ internal class Terroriste : KECustomRole public override bool KeepRoleOnChangingRole { get; set; } = false; public override float SpawnChance { get; set; } = 100; - public override Vector3 Scale { get; set; } = new Vector3(1, 1, 1); - public override List Inventory { get; set; } = new List() { $"{ItemType.GrenadeHE}", diff --git a/KruacentExiled/KE.CustomRoles/CR/Scientist/GambleAddict.cs b/KruacentExiled/KE.CustomRoles/CR/Scientist/GambleAddict.cs index 39a549ae..65503a3f 100644 --- a/KruacentExiled/KE.CustomRoles/CR/Scientist/GambleAddict.cs +++ b/KruacentExiled/KE.CustomRoles/CR/Scientist/GambleAddict.cs @@ -21,7 +21,6 @@ public class GambleAddict : KECustomRole public override bool KeepRoleOnChangingRole { get; set; } = false; public override float SpawnChance { get; set; } = 100; - public override Vector3 Scale { get; set; } = new Vector3(1, 1, 1); public override List Inventory { get; set; } = new List() { diff --git a/KruacentExiled/KE.CustomRoles/KE.CustomRoles.csproj b/KruacentExiled/KE.CustomRoles/KE.CustomRoles.csproj index 0f41f574..2871bd44 100644 --- a/KruacentExiled/KE.CustomRoles/KE.CustomRoles.csproj +++ b/KruacentExiled/KE.CustomRoles/KE.CustomRoles.csproj @@ -5,7 +5,7 @@ - + From 3e57fef51ee4c95b67bc5889f93b8a5c9c6f6f0c Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Tue, 16 Sep 2025 19:48:32 +0200 Subject: [PATCH 339/853] added name and prefix --- KruacentExiled/KE.Map/MainPlugin.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/KruacentExiled/KE.Map/MainPlugin.cs b/KruacentExiled/KE.Map/MainPlugin.cs index 024c2ad8..824479af 100644 --- a/KruacentExiled/KE.Map/MainPlugin.cs +++ b/KruacentExiled/KE.Map/MainPlugin.cs @@ -135,7 +135,9 @@ private void OnGenerated() } - + public override string Name => "KE.Map"; + public override string Prefix => "KE.M"; + private void OnRoundEnded(RoundEndedEventArgs ev) { From 19c6f9f89ea561e3440340f4631bf6f120f7d97d Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Tue, 16 Sep 2025 19:49:29 +0200 Subject: [PATCH 340/853] add prefix --- KruacentExiled/KE.Misc/MainPlugin.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/KruacentExiled/KE.Misc/MainPlugin.cs b/KruacentExiled/KE.Misc/MainPlugin.cs index f6d3b758..8e66c3c0 100644 --- a/KruacentExiled/KE.Misc/MainPlugin.cs +++ b/KruacentExiled/KE.Misc/MainPlugin.cs @@ -20,7 +20,8 @@ namespace KE.Misc public class MainPlugin : Plugin { public override string Author => "Patrique"; - public override string Name => "KEMisc"; + public override string Name => "KE.Misc"; + public override string Prefix => "KE.Misc"; public override Version Version => new Version(1, 1, 0); internal static MainPlugin Instance { get; private set; } private ServerHandler ServerHandler; From 31e70f2fb5a484ba41f19a75d97d758ec691d635 Mon Sep 17 00:00:00 2001 From: Omer <27omerf@gmail.com> Date: Thu, 18 Sep 2025 16:55:48 +0200 Subject: [PATCH 341/853] add : Explode capacity for Terroriste, Thief capacity for Cleptoman, Big, Inverted and Paper custom role for human. --- .../KE.CustomRoles/Abilities/Explode.cs | 33 ++++++++++++ .../KE.CustomRoles/Abilities/Thief.cs | 52 +++++++++++++++++++ KruacentExiled/KE.CustomRoles/CR/Human/Big.cs | 23 ++++++++ .../KE.CustomRoles/CR/Human/Cleptoman.cs | 28 ++++++++++ .../KE.CustomRoles/CR/Human/Inverted.cs | 23 ++++++++ .../KE.CustomRoles/CR/Human/Paper.cs | 23 ++++++++ .../KE.CustomRoles/CR/MTF/Terroriste.cs | 5 ++ 7 files changed, 187 insertions(+) create mode 100644 KruacentExiled/KE.CustomRoles/Abilities/Explode.cs create mode 100644 KruacentExiled/KE.CustomRoles/Abilities/Thief.cs create mode 100644 KruacentExiled/KE.CustomRoles/CR/Human/Big.cs create mode 100644 KruacentExiled/KE.CustomRoles/CR/Human/Cleptoman.cs create mode 100644 KruacentExiled/KE.CustomRoles/CR/Human/Inverted.cs create mode 100644 KruacentExiled/KE.CustomRoles/CR/Human/Paper.cs diff --git a/KruacentExiled/KE.CustomRoles/Abilities/Explode.cs b/KruacentExiled/KE.CustomRoles/Abilities/Explode.cs new file mode 100644 index 00000000..031cda80 --- /dev/null +++ b/KruacentExiled/KE.CustomRoles/Abilities/Explode.cs @@ -0,0 +1,33 @@ +using Exiled.API.Features; +using Exiled.API.Features.Attributes; +using Exiled.API.Features.Items; +using Exiled.CustomRoles.API.Features; +using KE.CustomRoles.API.Features; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using UnityEngine; + +namespace KE.CustomRoles.Abilities +{ + public class Explode : KEAbilities + { + public override string Name { get; } = "Explode"; + + public override string Description { get; } = "Tu as une ceinture d'explosif autour de toi, fait attention n'appuie pas sur le bouton"; + + public override int Id => 2007; + + public override float Cooldown { get; } = 4*60f; + + protected override void AbilityUsed(Player player) + { + ExplosiveGrenade grenade = ((ExplosiveGrenade)Item.Create(ItemType.GrenadeHE)); + grenade.FuseTime = 0.2f; + grenade.SpawnActive(player.Position); + Log.Debug("Grenade spawned"); + } + } +} diff --git a/KruacentExiled/KE.CustomRoles/Abilities/Thief.cs b/KruacentExiled/KE.CustomRoles/Abilities/Thief.cs new file mode 100644 index 00000000..d2325f34 --- /dev/null +++ b/KruacentExiled/KE.CustomRoles/Abilities/Thief.cs @@ -0,0 +1,52 @@ +using Exiled.API.Extensions; +using Exiled.API.Features; +using Exiled.API.Features.Items; +using KE.CustomRoles.API.Features; +using KE.Utils.API.Displays.DisplayMeow; +using System.Collections.Generic; +using System.Linq; + +namespace KE.CustomRoles.Abilities +{ + public class Thief : KEAbilities + { + public override string Name { get; } = "Thief"; + + public override string Description { get; } = "Avec 1548 heures de jeu sur Thief Simulator fallait s'y attendre un peu."; + + public override int Id => 2006; + + public override float Cooldown { get; } = 120f; + + protected override void AbilityUsed(Player player) + { + List playerList = Player.List.Where(p => !p.IsScp).ToList(); + playerList.Remove(player); + + Log.Debug("Player list :"); + playerList.ForEach(p => Log.Info(p.Nickname)); + + Player thiefed = playerList.GetRandomValue(); + + Log.Debug($"Thiefed player : {thiefed.Nickname}"); + + Item inv = thiefed.Items.ToList().GetRandomValue(); + + Log.Debug($"Thiefed item : {inv}"); + + if (inv == null) + { + Log.Info("No item to thiefed, null, returning."); + HintPlacement hint = new(0, 750, HintServiceMeow.Core.Enum.HintAlignment.Center); + float delay = MainPlugin.SettingHandler.GetTime(player); + DisplayHandler.Instance.AddHint(hint, player, "I think this is a skill issue ! Congrats !", delay); + } + + var thiefBool = thiefed.RemoveItem(inv); + Log.Debug($"Item deleted {thiefBool}."); + + inv.Give(player); + Log.Debug($"Item given to {player.Nickname}."); + } + } +} diff --git a/KruacentExiled/KE.CustomRoles/CR/Human/Big.cs b/KruacentExiled/KE.CustomRoles/CR/Human/Big.cs new file mode 100644 index 00000000..9de4c432 --- /dev/null +++ b/KruacentExiled/KE.CustomRoles/CR/Human/Big.cs @@ -0,0 +1,23 @@ +using Exiled.API.Features.Attributes; +using Exiled.CustomRoles.API.Features; +using KE.CustomRoles.API.Features; +using PlayerRoles; +using System.Collections.Generic; +using UnityEngine; + +namespace KE.CustomRoles.CR.Human +{ + [CustomRole(RoleTypeId.None)] + public class Big : GlobalCustomRole + { + public override SideEnum Side { get; set; } = SideEnum.Human; + public override string Description { get; set; } = "Faut arrêter le McDo au bout d'un moment !"; + public override uint Id { get; set; } = 1068; + public override string PublicName { get; set; } = "Big"; + public override bool KeepRoleOnDeath { get; set; } = true; + public override bool KeepRoleOnChangingRole { get; set; } = true; + + public override float SpawnChance { get; set; } = 100; + public override Vector3 Scale { get; set; } = new Vector3(1, 1, 1.4f); + } +} \ No newline at end of file diff --git a/KruacentExiled/KE.CustomRoles/CR/Human/Cleptoman.cs b/KruacentExiled/KE.CustomRoles/CR/Human/Cleptoman.cs new file mode 100644 index 00000000..89a1d900 --- /dev/null +++ b/KruacentExiled/KE.CustomRoles/CR/Human/Cleptoman.cs @@ -0,0 +1,28 @@ +using Exiled.API.Features.Attributes; +using Exiled.CustomRoles.API.Features; +using KE.CustomRoles.API.Features; +using PlayerRoles; +using System.Collections.Generic; +using UnityEngine; + +namespace KE.CustomRoles.CR.Human +{ + [CustomRole(RoleTypeId.None)] + public class Cleptoman : GlobalCustomRole + { + public override SideEnum Side { get; set; } = SideEnum.Human; + public override string Description { get; set; } = "Tu es un Cccleptoman \nTu peux voler les items des autres joueurs"; + public override uint Id { get; set; } = 1453; + public override string PublicName { get; set; } = "Cleptoman"; + public override bool KeepRoleOnDeath { get; set; } = false; + public override bool KeepRoleOnChangingRole { get; set; } = true; + + public override float SpawnChance { get; set; } = 100; + public override Vector3 Scale { get; set; } = new Vector3(1.01f, 0.99f, 1); + + public override HashSet Abilities { get; } = new() + { + 2006 + }; + } +} \ No newline at end of file diff --git a/KruacentExiled/KE.CustomRoles/CR/Human/Inverted.cs b/KruacentExiled/KE.CustomRoles/CR/Human/Inverted.cs new file mode 100644 index 00000000..73dda0e5 --- /dev/null +++ b/KruacentExiled/KE.CustomRoles/CR/Human/Inverted.cs @@ -0,0 +1,23 @@ +using Exiled.API.Features.Attributes; +using Exiled.CustomRoles.API.Features; +using KE.CustomRoles.API.Features; +using PlayerRoles; +using System.Collections.Generic; +using UnityEngine; + +namespace KE.CustomRoles.CR.Human +{ + [CustomRole(RoleTypeId.None)] + public class Inverted : GlobalCustomRole + { + public override SideEnum Side { get; set; } = SideEnum.Human; + public override string Description { get; set; } = "Tu as un talent assez exceptionnel !"; + public override uint Id { get; set; } = 1066; + public override string PublicName { get; set; } = "Inverted"; + public override bool KeepRoleOnDeath { get; set; } = true; + public override bool KeepRoleOnChangingRole { get; set; } = true; + + public override float SpawnChance { get; set; } = 100; + public override Vector3 Scale { get; set; } = new Vector3(1, -1, 1); + } +} \ No newline at end of file diff --git a/KruacentExiled/KE.CustomRoles/CR/Human/Paper.cs b/KruacentExiled/KE.CustomRoles/CR/Human/Paper.cs new file mode 100644 index 00000000..8c866c72 --- /dev/null +++ b/KruacentExiled/KE.CustomRoles/CR/Human/Paper.cs @@ -0,0 +1,23 @@ +using Exiled.API.Features.Attributes; +using Exiled.CustomRoles.API.Features; +using KE.CustomRoles.API.Features; +using PlayerRoles; +using System.Collections.Generic; +using UnityEngine; + +namespace KE.CustomRoles.CR.Human +{ + [CustomRole(RoleTypeId.None)] + public class Paper : GlobalCustomRole + { + public override SideEnum Side { get; set; } = SideEnum.Human; + public override string Description { get; set; } = "Tu t'es fait roulé dessus !"; + public override uint Id { get; set; } = 1067; + public override string PublicName { get; set; } = "Paper"; + public override bool KeepRoleOnDeath { get; set; } = true; + public override bool KeepRoleOnChangingRole { get; set; } = true; + + public override float SpawnChance { get; set; } = 100; + public override Vector3 Scale { get; set; } = new Vector3(0.2f, 1, 1); + } +} \ No newline at end of file diff --git a/KruacentExiled/KE.CustomRoles/CR/MTF/Terroriste.cs b/KruacentExiled/KE.CustomRoles/CR/MTF/Terroriste.cs index 5e47c2ba..68b03a2f 100644 --- a/KruacentExiled/KE.CustomRoles/CR/MTF/Terroriste.cs +++ b/KruacentExiled/KE.CustomRoles/CR/MTF/Terroriste.cs @@ -37,5 +37,10 @@ internal class Terroriste : KECustomRole { { AmmoType.Nato556, 100} }; + + public override HashSet Abilities { get; } = new() + { + 2007 + }; } } From f1e5f60bacd10822c175d2a035ff3b5506c5140e Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Thu, 18 Sep 2025 18:24:47 +0200 Subject: [PATCH 342/853] time to push --- .../KE.CustomRoles/Abilities/OpenDoor.cs | 57 +++++ .../CR/ChaosInsurgency/LeRusse.cs | 41 ++++ .../KE.CustomRoles/CR/ClassD/Asthmatique.cs | 29 +++ .../KE.CustomRoles/CR/ClassD/Enfant.cs | 30 +++ .../KE.CustomRoles/CR/Guard/ChiefGuard.cs | 39 ++++ .../KE.CustomRoles/CR/Guard/Guard914.cs | 51 ++++ KruacentExiled/KE.CustomRoles/CR/MTF/Tank.cs | 81 +++++++ .../KE.CustomRoles/CR/MTF/Terroriste.cs | 42 ++++ .../KE.CustomRoles/CR/SCP/Paper049.cs | 23 ++ .../KE.CustomRoles/CR/SCP/Small049.cs | 24 ++ .../KE.CustomRoles/CR/SCP/Small173.cs | 21 ++ .../KE.CustomRoles/CR/SCP/ZombieDoorman.cs | 32 +++ .../CR/Scientist/GambleAddict.cs | 32 +++ .../CR/Scientist/ZoneManager.cs | 44 ++++ KruacentExiled/KE.CustomRoles/Config.cs | 15 ++ KruacentExiled/KE.CustomRoles/Controller.cs | 52 +++++ .../KE.CustomRoles/KE.CustomRoles.csproj | 16 ++ KruacentExiled/KE.CustomRoles/MainPlugin.cs | 57 +++++ KruacentExiled/KE.CustomRoles/README.md | 16 ++ .../API/Feature/MalfunctionDisplay.cs | 106 +++++++++ .../API/Feature/MalfunctionEffect.cs | 19 ++ .../API/Feature/Malfunctions.cs | 200 ++++++++++++++++ .../API/Interfaces/IReversibleEffect.cs | 17 ++ .../API/MalfunctionEffects/AutoNuke.cs | 52 +++++ .../API/MalfunctionEffects/ForceDecon.cs | 50 ++++ .../API/MalfunctionEffects/Locks.cs | 50 ++++ .../GE/Blitz.cs | 11 +- .../GE/BrokenGenerator.cs | 66 ++++++ .../GE/CassieGoCrazy.cs | 153 ++++++++++++ .../GE/Impostor.cs | 25 +- .../GE/KIWIS.cs | 15 +- .../GE/Kaboom.cs | 99 ++++++++ .../GE/OpenBar.cs | 15 +- .../KE.GlobalEventFramework.Examples/GE/R.cs | 6 +- .../GE/RandomSpawn.cs | 17 +- .../GE/Shuffle.cs | 11 +- .../GE/Speed.cs | 13 +- .../GE/SwapProtocol.cs | 99 ++++++++ .../GE/SystemMalfunction.cs | 83 ++++--- .../KE.GlobalEventFramework.Examples.csproj | 15 +- .../MainPlugin.cs | 5 +- .../README.md | 15 ++ .../KE.GlobalEventFramework/Config.cs | 2 + .../GEFE/API/Features/GlobalEvent.cs | 210 +++++++++++++---- .../GEFE/API/Features/Loader.cs | 11 +- .../GEFE/API/Interfaces/IEvent.cs | 20 ++ .../GEFE/API/Interfaces/IGlobalEvent.cs | 19 +- .../GEFE/API/Interfaces/IStart.cs | 16 ++ .../GEFE/Commands/ForceGE.cs | 65 ++++++ .../GEFE/Commands/ForceNbGE.cs | 61 +++++ .../GEFE/Commands/{List.cs => ListGE.cs} | 4 +- .../GEFE/Commands/ParentCommandGEFE.cs | 6 +- .../GEFE/Handlers/ServerHandler.cs | 56 +++-- .../KE.GlobalEventFramework.csproj | 20 +- .../KE.GlobalEventFramework/MainPlugin.cs | 91 +------- .../KE.GlobalEventFramework/README.md | 122 ++++++++++ KruacentExiled/KE.Items/Config.cs | 4 + .../KE.Items/Core/Lights/LightsHandler.cs | 37 +++ .../KE.Items/Core/Settings/SettingsHandler.cs | 100 ++++++++ .../KE.Items/Core/Upgrade/UpgradeHandler.cs | 82 +++++++ .../Core/Upgrade/UpgradeProperties.cs | 35 +++ .../KE.Items/Extensions/PlayerExtensions.cs | 19 ++ .../KE.Items/Features/KECustomGrenade.cs | 42 ++++ .../KE.Items/Features/KECustomItem.cs | 92 ++++++++ .../KE.Items/Interface/CustomItemEffect.cs | 23 ++ .../KE.Items/Interface/ICustomPickupModel.cs | 17 ++ .../KE.Items/Interface/ISwichableEffect.cs | 13 ++ .../Interface/IUpgradableCustomItem.cs | 15 ++ .../ItemEffects/DeployableWallEffect.cs | 57 +++++ .../KE.Items/ItemEffects/DivinePillsEffect.cs | 73 ++++++ .../KE.Items/ItemEffects/HealZoneEffect.cs | 82 +++++++ .../KE.Items/ItemEffects/MineEffect.cs | 180 ++++++++++++++ .../KE.Items/ItemEffects/MolotovEffect.cs | 126 ++++++++++ .../KE.Items/ItemEffects/Scp1650Effect.cs | 103 ++++++++ .../KE.Items/ItemEffects/TPGrenadaEffect.cs | 113 +++++++++ .../KE.Items/Items/AdrenalineDrogue.cs | 80 +++++-- KruacentExiled/KE.Items/Items/Defibrilator.cs | 62 +++-- .../KE.Items/Items/DeployableWall.cs | 51 ++-- KruacentExiled/KE.Items/Items/DivinePills.cs | 62 +++-- KruacentExiled/KE.Items/Items/HealZone.cs | 83 +++++++ KruacentExiled/KE.Items/Items/ImpactFlash.cs | 49 ++++ KruacentExiled/KE.Items/Items/Mine.cs | 115 ++++++++- .../KE.Items/Items/Models/DeployWallModel.cs | 64 +++++ .../KE.Items/Items/Models/MineModel.cs | 52 +++++ KruacentExiled/KE.Items/Items/Models/Model.cs | 39 ++++ .../KE.Items/Items/Models/Scp514Model.cs | 23 ++ KruacentExiled/KE.Items/Items/Molotov.cs | 99 ++++++++ .../KE.Items/Items/PickupModels/MinePModel.cs | 30 +++ .../Items/PickupModels/MolotovPModel.cs | 32 +++ .../Items/PickupModels/PickupModel.cs | 143 ++++++++++++ .../Items/PickupModels/PressePureePModel.cs | 37 +++ .../Items/PickupModels/Scp3136PModel.cs | 37 +++ KruacentExiled/KE.Items/Items/PressePuree.cs | 79 +++++-- .../KE.Items/Items/SainteGrenada.cs | 65 ++++++ KruacentExiled/KE.Items/Items/Scp1650.cs | 64 +++++ KruacentExiled/KE.Items/Items/Scp3136.cs | 94 ++++++++ KruacentExiled/KE.Items/Items/Scp514.cs | 160 +++++++++++++ KruacentExiled/KE.Items/Items/Scp7045.cs | 219 ++++++++++++++++++ KruacentExiled/KE.Items/Items/TPGrenada.cs | 84 ++----- .../KE.Items/Items/TrueDivinePills.cs | 116 ++++++++++ KruacentExiled/KE.Items/KE.Items.csproj | 16 +- KruacentExiled/KE.Items/MainPlugin.cs | 147 +++++------- KruacentExiled/KE.Items/README.md | 21 ++ KruacentExiled/KE.Misc/Candy.cs | 22 ++ KruacentExiled/KE.Misc/Config.cs | 3 + KruacentExiled/KE.Misc/MainPlugin.cs | 22 ++ KruacentExiled/KE.Misc/ServerHandler.cs | 2 + KruacentExiled/KE.Misc/SurfaceLight.cs | 39 ++++ .../Displays/DisplayMeow/DisplayHandler.cs | 67 ++++++ .../API/Displays/DisplayMeow/HintPlacement.cs | 31 +++ .../KE.Utils/API/GifAnimator/RenderGif.cs | 128 ++++++++++ .../KE.Utils/API/Interfaces/IEvents.cs | 17 ++ .../KE.Utils/API/Interfaces/ILoadable.cs | 13 ++ .../KE.Utils/API/Models/Arrows/Arrow.cs | 58 +++++ .../KE.Utils/API/Models/Arrows/MoveArrow.cs | 12 + .../KE.Utils/API/Models/Arrows/RotateArrow.cs | 12 + .../KE.Utils/API/Models/Arrows/ScaleArrow.cs | 12 + .../KE.Utils/API/Models/Arrows/XArrow.cs | 16 ++ .../KE.Utils/API/Models/Arrows/YArrow.cs | 16 ++ .../KE.Utils/API/Models/Arrows/ZArrow.cs | 16 ++ .../Models/Blueprints/AdminToyBlueprint.cs | 69 ++++++ .../API/Models/Blueprints/LightBlueprint.cs | 37 +++ .../API/Models/Blueprints/ModelBlueprint.cs | 110 +++++++++ .../Models/Blueprints/PrimitiveBlueprint.cs | 39 ++++ .../API/Models/Commands/AllCommands.cs | 33 +++ .../API/Models/Commands/ChangeColor.cs | 72 ++++++ .../API/Models/Commands/ChangePrimType.cs | 53 +++++ .../API/Models/Commands/CreateModel.cs | 44 ++++ .../API/Models/Commands/CreatePrim.cs | 47 ++++ .../KE.Utils/API/Models/Commands/ListModel.cs | 42 ++++ .../KE.Utils/API/Models/Commands/LoadModel.cs | 65 ++++++ .../API/Models/Commands/ModeMovePrim.cs | 64 +++++ .../KE.Utils/API/Models/Commands/SaveModel.cs | 47 ++++ .../API/Models/Commands/SelectModel.cs | 56 +++++ .../API/Models/Commands/ShowCenter.cs | 51 ++++ KruacentExiled/KE.Utils/API/Models/Model.cs | 202 ++++++++++++++++ .../KE.Utils/API/Models/ModelCreator.cs | 175 ++++++++++++++ .../KE.Utils/API/Models/ModelLoader.cs | 152 ++++++++++++ KruacentExiled/KE.Utils/API/Models/Models.cs | 47 ++++ .../KE.Utils/API/Models/MovementHandler.cs | 208 +++++++++++++++++ .../KE.Utils/API/Models/SelectedModel.cs | 52 +++++ .../Models/ToysSettings/PrimitiveSetting.cs | 31 +++ .../API/Models/ToysSettings/ToySetting.cs | 20 ++ KruacentExiled/KE.Utils/API/OtherUtils.cs | 18 ++ KruacentExiled/KE.Utils/API/Parser.cs | 36 +++ .../KE.Utils/API/ReflectionHelper.cs | 47 ++++ .../KE.Utils/API/Sounds/SoundPlayer.cs | 116 ++++++++++ .../KE.Utils/Extensions/AdminToyExtension.cs | 25 ++ .../KE.Utils/Extensions/NpcExtension.cs | 23 ++ .../KE.Utils/Extensions/PlayerExtension.cs | 52 +++++ .../KE.Utils/Extensions/RoomExtension.cs | 12 + .../KE.Utils/Extensions/RoomExtensions.cs | 55 +++++ KruacentExiled/KE.Utils/KE.Utils.csproj | 32 +++ .../KE.Utils/Quality/Enums/ModelQuality.cs | 16 ++ .../Quality/Handlers/QualityToysHandler.cs | 179 ++++++++++++++ .../KE.Utils/Quality/Models/Base/BaseModel.cs | 41 ++++ .../Quality/Models/Base/LightModel.cs | 26 +++ .../Quality/Models/Base/PrimitiveModel.cs | 26 +++ .../Quality/Models/Examples/MineModel.cs | 118 ++++++++++ .../KE.Utils/Quality/Models/Model.cs | 104 +++++++++ .../KE.Utils/Quality/Models/ModelPrefab.cs | 42 ++++ .../KE.Utils/Quality/Models/QualityModel.cs | 40 ++++ .../KE.Utils/Quality/QualityHandler.cs | 61 +++++ .../KE.Utils/Quality/QualityToysHandler.cs | 155 +++++++++++++ .../Quality/Settings/QualitySettings.cs | 62 +++++ .../Quality/Structs/LocalWorldSpace.cs | 23 ++ KruacentExiled/KE.Utils/Quality/Tests/Test.cs | 108 +++++++++ KruacentExiled/KruacentExiled.sln | 16 +- README.md | 48 +++- 169 files changed, 8977 insertions(+), 589 deletions(-) create mode 100644 KruacentExiled/KE.CustomRoles/Abilities/OpenDoor.cs create mode 100644 KruacentExiled/KE.CustomRoles/CR/ChaosInsurgency/LeRusse.cs create mode 100644 KruacentExiled/KE.CustomRoles/CR/ClassD/Asthmatique.cs create mode 100644 KruacentExiled/KE.CustomRoles/CR/ClassD/Enfant.cs create mode 100644 KruacentExiled/KE.CustomRoles/CR/Guard/ChiefGuard.cs create mode 100644 KruacentExiled/KE.CustomRoles/CR/Guard/Guard914.cs create mode 100644 KruacentExiled/KE.CustomRoles/CR/MTF/Tank.cs create mode 100644 KruacentExiled/KE.CustomRoles/CR/MTF/Terroriste.cs create mode 100644 KruacentExiled/KE.CustomRoles/CR/SCP/Paper049.cs create mode 100644 KruacentExiled/KE.CustomRoles/CR/SCP/Small049.cs create mode 100644 KruacentExiled/KE.CustomRoles/CR/SCP/Small173.cs create mode 100644 KruacentExiled/KE.CustomRoles/CR/SCP/ZombieDoorman.cs create mode 100644 KruacentExiled/KE.CustomRoles/CR/Scientist/GambleAddict.cs create mode 100644 KruacentExiled/KE.CustomRoles/CR/Scientist/ZoneManager.cs create mode 100644 KruacentExiled/KE.CustomRoles/Config.cs create mode 100644 KruacentExiled/KE.CustomRoles/Controller.cs create mode 100644 KruacentExiled/KE.CustomRoles/KE.CustomRoles.csproj create mode 100644 KruacentExiled/KE.CustomRoles/MainPlugin.cs create mode 100644 KruacentExiled/KE.CustomRoles/README.md create mode 100644 KruacentExiled/KE.GlobalEventFramework.Examples/API/Feature/MalfunctionDisplay.cs create mode 100644 KruacentExiled/KE.GlobalEventFramework.Examples/API/Feature/MalfunctionEffect.cs create mode 100644 KruacentExiled/KE.GlobalEventFramework.Examples/API/Feature/Malfunctions.cs create mode 100644 KruacentExiled/KE.GlobalEventFramework.Examples/API/Interfaces/IReversibleEffect.cs create mode 100644 KruacentExiled/KE.GlobalEventFramework.Examples/API/MalfunctionEffects/AutoNuke.cs create mode 100644 KruacentExiled/KE.GlobalEventFramework.Examples/API/MalfunctionEffects/ForceDecon.cs create mode 100644 KruacentExiled/KE.GlobalEventFramework.Examples/API/MalfunctionEffects/Locks.cs create mode 100644 KruacentExiled/KE.GlobalEventFramework.Examples/GE/BrokenGenerator.cs create mode 100644 KruacentExiled/KE.GlobalEventFramework.Examples/GE/CassieGoCrazy.cs create mode 100644 KruacentExiled/KE.GlobalEventFramework.Examples/GE/Kaboom.cs create mode 100644 KruacentExiled/KE.GlobalEventFramework.Examples/GE/SwapProtocol.cs create mode 100644 KruacentExiled/KE.GlobalEventFramework.Examples/README.md create mode 100644 KruacentExiled/KE.GlobalEventFramework/GEFE/API/Interfaces/IEvent.cs create mode 100644 KruacentExiled/KE.GlobalEventFramework/GEFE/API/Interfaces/IStart.cs create mode 100644 KruacentExiled/KE.GlobalEventFramework/GEFE/Commands/ForceGE.cs create mode 100644 KruacentExiled/KE.GlobalEventFramework/GEFE/Commands/ForceNbGE.cs rename KruacentExiled/KE.GlobalEventFramework/GEFE/Commands/{List.cs => ListGE.cs} (93%) create mode 100644 KruacentExiled/KE.GlobalEventFramework/README.md create mode 100644 KruacentExiled/KE.Items/Core/Lights/LightsHandler.cs create mode 100644 KruacentExiled/KE.Items/Core/Settings/SettingsHandler.cs create mode 100644 KruacentExiled/KE.Items/Core/Upgrade/UpgradeHandler.cs create mode 100644 KruacentExiled/KE.Items/Core/Upgrade/UpgradeProperties.cs create mode 100644 KruacentExiled/KE.Items/Extensions/PlayerExtensions.cs create mode 100644 KruacentExiled/KE.Items/Features/KECustomGrenade.cs create mode 100644 KruacentExiled/KE.Items/Features/KECustomItem.cs create mode 100644 KruacentExiled/KE.Items/Interface/CustomItemEffect.cs create mode 100644 KruacentExiled/KE.Items/Interface/ICustomPickupModel.cs create mode 100644 KruacentExiled/KE.Items/Interface/ISwichableEffect.cs create mode 100644 KruacentExiled/KE.Items/Interface/IUpgradableCustomItem.cs create mode 100644 KruacentExiled/KE.Items/ItemEffects/DeployableWallEffect.cs create mode 100644 KruacentExiled/KE.Items/ItemEffects/DivinePillsEffect.cs create mode 100644 KruacentExiled/KE.Items/ItemEffects/HealZoneEffect.cs create mode 100644 KruacentExiled/KE.Items/ItemEffects/MineEffect.cs create mode 100644 KruacentExiled/KE.Items/ItemEffects/MolotovEffect.cs create mode 100644 KruacentExiled/KE.Items/ItemEffects/Scp1650Effect.cs create mode 100644 KruacentExiled/KE.Items/ItemEffects/TPGrenadaEffect.cs create mode 100644 KruacentExiled/KE.Items/Items/HealZone.cs create mode 100644 KruacentExiled/KE.Items/Items/ImpactFlash.cs create mode 100644 KruacentExiled/KE.Items/Items/Models/DeployWallModel.cs create mode 100644 KruacentExiled/KE.Items/Items/Models/MineModel.cs create mode 100644 KruacentExiled/KE.Items/Items/Models/Model.cs create mode 100644 KruacentExiled/KE.Items/Items/Models/Scp514Model.cs create mode 100644 KruacentExiled/KE.Items/Items/Molotov.cs create mode 100644 KruacentExiled/KE.Items/Items/PickupModels/MinePModel.cs create mode 100644 KruacentExiled/KE.Items/Items/PickupModels/MolotovPModel.cs create mode 100644 KruacentExiled/KE.Items/Items/PickupModels/PickupModel.cs create mode 100644 KruacentExiled/KE.Items/Items/PickupModels/PressePureePModel.cs create mode 100644 KruacentExiled/KE.Items/Items/PickupModels/Scp3136PModel.cs create mode 100644 KruacentExiled/KE.Items/Items/SainteGrenada.cs create mode 100644 KruacentExiled/KE.Items/Items/Scp1650.cs create mode 100644 KruacentExiled/KE.Items/Items/Scp3136.cs create mode 100644 KruacentExiled/KE.Items/Items/Scp514.cs create mode 100644 KruacentExiled/KE.Items/Items/Scp7045.cs create mode 100644 KruacentExiled/KE.Items/Items/TrueDivinePills.cs create mode 100644 KruacentExiled/KE.Items/README.md create mode 100644 KruacentExiled/KE.Misc/Candy.cs create mode 100644 KruacentExiled/KE.Misc/SurfaceLight.cs create mode 100644 KruacentExiled/KE.Utils/API/Displays/DisplayMeow/DisplayHandler.cs create mode 100644 KruacentExiled/KE.Utils/API/Displays/DisplayMeow/HintPlacement.cs create mode 100644 KruacentExiled/KE.Utils/API/GifAnimator/RenderGif.cs create mode 100644 KruacentExiled/KE.Utils/API/Interfaces/IEvents.cs create mode 100644 KruacentExiled/KE.Utils/API/Interfaces/ILoadable.cs create mode 100644 KruacentExiled/KE.Utils/API/Models/Arrows/Arrow.cs create mode 100644 KruacentExiled/KE.Utils/API/Models/Arrows/MoveArrow.cs create mode 100644 KruacentExiled/KE.Utils/API/Models/Arrows/RotateArrow.cs create mode 100644 KruacentExiled/KE.Utils/API/Models/Arrows/ScaleArrow.cs create mode 100644 KruacentExiled/KE.Utils/API/Models/Arrows/XArrow.cs create mode 100644 KruacentExiled/KE.Utils/API/Models/Arrows/YArrow.cs create mode 100644 KruacentExiled/KE.Utils/API/Models/Arrows/ZArrow.cs create mode 100644 KruacentExiled/KE.Utils/API/Models/Blueprints/AdminToyBlueprint.cs create mode 100644 KruacentExiled/KE.Utils/API/Models/Blueprints/LightBlueprint.cs create mode 100644 KruacentExiled/KE.Utils/API/Models/Blueprints/ModelBlueprint.cs create mode 100644 KruacentExiled/KE.Utils/API/Models/Blueprints/PrimitiveBlueprint.cs create mode 100644 KruacentExiled/KE.Utils/API/Models/Commands/AllCommands.cs create mode 100644 KruacentExiled/KE.Utils/API/Models/Commands/ChangeColor.cs create mode 100644 KruacentExiled/KE.Utils/API/Models/Commands/ChangePrimType.cs create mode 100644 KruacentExiled/KE.Utils/API/Models/Commands/CreateModel.cs create mode 100644 KruacentExiled/KE.Utils/API/Models/Commands/CreatePrim.cs create mode 100644 KruacentExiled/KE.Utils/API/Models/Commands/ListModel.cs create mode 100644 KruacentExiled/KE.Utils/API/Models/Commands/LoadModel.cs create mode 100644 KruacentExiled/KE.Utils/API/Models/Commands/ModeMovePrim.cs create mode 100644 KruacentExiled/KE.Utils/API/Models/Commands/SaveModel.cs create mode 100644 KruacentExiled/KE.Utils/API/Models/Commands/SelectModel.cs create mode 100644 KruacentExiled/KE.Utils/API/Models/Commands/ShowCenter.cs create mode 100644 KruacentExiled/KE.Utils/API/Models/Model.cs create mode 100644 KruacentExiled/KE.Utils/API/Models/ModelCreator.cs create mode 100644 KruacentExiled/KE.Utils/API/Models/ModelLoader.cs create mode 100644 KruacentExiled/KE.Utils/API/Models/Models.cs create mode 100644 KruacentExiled/KE.Utils/API/Models/MovementHandler.cs create mode 100644 KruacentExiled/KE.Utils/API/Models/SelectedModel.cs create mode 100644 KruacentExiled/KE.Utils/API/Models/ToysSettings/PrimitiveSetting.cs create mode 100644 KruacentExiled/KE.Utils/API/Models/ToysSettings/ToySetting.cs create mode 100644 KruacentExiled/KE.Utils/API/OtherUtils.cs create mode 100644 KruacentExiled/KE.Utils/API/Parser.cs create mode 100644 KruacentExiled/KE.Utils/API/ReflectionHelper.cs create mode 100644 KruacentExiled/KE.Utils/API/Sounds/SoundPlayer.cs create mode 100644 KruacentExiled/KE.Utils/Extensions/AdminToyExtension.cs create mode 100644 KruacentExiled/KE.Utils/Extensions/NpcExtension.cs create mode 100644 KruacentExiled/KE.Utils/Extensions/PlayerExtension.cs create mode 100644 KruacentExiled/KE.Utils/Extensions/RoomExtension.cs create mode 100644 KruacentExiled/KE.Utils/Extensions/RoomExtensions.cs create mode 100644 KruacentExiled/KE.Utils/KE.Utils.csproj create mode 100644 KruacentExiled/KE.Utils/Quality/Enums/ModelQuality.cs create mode 100644 KruacentExiled/KE.Utils/Quality/Handlers/QualityToysHandler.cs create mode 100644 KruacentExiled/KE.Utils/Quality/Models/Base/BaseModel.cs create mode 100644 KruacentExiled/KE.Utils/Quality/Models/Base/LightModel.cs create mode 100644 KruacentExiled/KE.Utils/Quality/Models/Base/PrimitiveModel.cs create mode 100644 KruacentExiled/KE.Utils/Quality/Models/Examples/MineModel.cs create mode 100644 KruacentExiled/KE.Utils/Quality/Models/Model.cs create mode 100644 KruacentExiled/KE.Utils/Quality/Models/ModelPrefab.cs create mode 100644 KruacentExiled/KE.Utils/Quality/Models/QualityModel.cs create mode 100644 KruacentExiled/KE.Utils/Quality/QualityHandler.cs create mode 100644 KruacentExiled/KE.Utils/Quality/QualityToysHandler.cs create mode 100644 KruacentExiled/KE.Utils/Quality/Settings/QualitySettings.cs create mode 100644 KruacentExiled/KE.Utils/Quality/Structs/LocalWorldSpace.cs create mode 100644 KruacentExiled/KE.Utils/Quality/Tests/Test.cs diff --git a/KruacentExiled/KE.CustomRoles/Abilities/OpenDoor.cs b/KruacentExiled/KE.CustomRoles/Abilities/OpenDoor.cs new file mode 100644 index 00000000..4ff85a55 --- /dev/null +++ b/KruacentExiled/KE.CustomRoles/Abilities/OpenDoor.cs @@ -0,0 +1,57 @@ +using Exiled.API.Features; +using Exiled.API.Features.Attributes; +using Exiled.CustomRoles.API.Features; +using Exiled.Events.EventArgs.Player; +using MEC; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace KE.CustomRoles.Abilities +{ + [CustomAbility] + internal class OpenDoor : ActiveAbility + { + public override string Name { get; set; } = "OpenDoor"; + + public override string Description { get; set; } = "Open a lock door at the cost of your health"; + + public override float Duration { get; set; } = 0f; + + public override float Cooldown { get; set; } = 45f; + private List _players = new List(); + + protected override void AbilityUsed(Player player) + { + player.ShowHint("interact with a door to open it",5f); + _players.Add(player); + Exiled.Events.Handlers.Player.InteractingDoor += OnInteractingDoor; + } + + protected override void UnsubscribeEvents() + { + Exiled.Events.Handlers.Player.InteractingDoor -= OnInteractingDoor; + base.UnsubscribeEvents(); + } + + private void OnInteractingDoor(InteractingDoorEventArgs ev) + { + if (!_players.Contains(ev.Player)) return; + if (ev.Door.IsOpen) return; + if (!ev.Door.IsKeycardDoor) return; + if(ev.Door.IsCheckpoint) return; + if(ev.Door.IsLocked) return; + + ev.IsAllowed = false; + ev.Player.ShowHint("The door will open in 5 seconds",5f); + ev.Player.Hurt(ev.Player.MaxHealth / 10,Exiled.API.Enums.DamageType.Strangled); + _players.Remove(ev.Player); + Timing.CallDelayed(5f, () => + { + ev.Door.IsOpen = true; + }); + } + } +} diff --git a/KruacentExiled/KE.CustomRoles/CR/ChaosInsurgency/LeRusse.cs b/KruacentExiled/KE.CustomRoles/CR/ChaosInsurgency/LeRusse.cs new file mode 100644 index 00000000..6b3aabdd --- /dev/null +++ b/KruacentExiled/KE.CustomRoles/CR/ChaosInsurgency/LeRusse.cs @@ -0,0 +1,41 @@ +using Exiled.API.Enums; +using Exiled.API.Features.Attributes; +using PlayerRoles; +using System.Collections.Generic; +using UnityEngine; + +namespace KE.CustomRoles.CR.ClassD +{ + [CustomRole(RoleTypeId.ChaosConscript)] + internal class Russe : Exiled.CustomRoles.API.Features.CustomRole + { + public override string Name { get; set; } = "Russe"; + public override string Description { get; set; } = "Tu es un maitre de jeu \ntu dois faire la roulette russe avec les autres joueurs"; + public override uint Id { get; set; } = 1050; + public override string CustomInfo { get; set; } = "Le Russe"; + public override int MaxHealth { get; set; } = 100; + public override RoleTypeId Role { get; set; } = RoleTypeId.ChaosConscript; + public override bool KeepRoleOnDeath { get; set; } = false; + public override bool KeepRoleOnChangingRole { get; set; } = false; + public override bool IgnoreSpawnSystem { get; set; } = true; + + public override float SpawnChance { get; set; } = 100; + public override Vector3 Scale { get; set; } = new Vector3(1.4f, 1.2f, 1.3f); + + public override List Inventory { get; set; } = new List() + { + $"{ItemType.GunRevolver}", + $"{ItemType.Radio}", + $"{ItemType.Adrenaline}", + $"{ItemType.KeycardChaosInsurgency}", + $"{ItemType.GrenadeHE}", + $"{ItemType.GrenadeHE}", + $"{ItemType.GrenadeHE}" + }; + + public override Dictionary Ammo { get; set; } = new Dictionary() + { + { AmmoType.Ammo44Cal, 100} + }; + } +} diff --git a/KruacentExiled/KE.CustomRoles/CR/ClassD/Asthmatique.cs b/KruacentExiled/KE.CustomRoles/CR/ClassD/Asthmatique.cs new file mode 100644 index 00000000..83610ce2 --- /dev/null +++ b/KruacentExiled/KE.CustomRoles/CR/ClassD/Asthmatique.cs @@ -0,0 +1,29 @@ +using Exiled.API.Enums; +using Exiled.API.Features; +using Exiled.API.Features.Attributes; +using Exiled.CustomRoles.API.Features; +using PlayerRoles; +using UnityEngine; +using Utils.NonAllocLINQ; + +namespace KE.CustomRoles.CR.ClassD +{ + [CustomRole(RoleTypeId.ClassD)] + internal class Asthmatique : CustomRole + { + public override string Name { get; set; } = "Asthmatique"; + public override string Description { get; set; } = "Tu es asthmatique\nT'as stamina est réduit de moitié\nMais tu vises mieux"; + public override uint Id { get; set; } = 1042; + public override string CustomInfo { get; set; } = "Asthmatique"; + public override int MaxHealth { get; set; } = 100; + public override RoleTypeId Role { get; set; } = RoleTypeId.ClassD; + public override bool KeepRoleOnDeath { get; set; } = true; + public override bool KeepRoleOnChangingRole { get; set; } = true; + public override bool IgnoreSpawnSystem { get; set; } = true; + protected override void RoleAdded(Player player) + { + player.EnableEffect(EffectType.Scp1853, -1, true); + player.EnableEffect(EffectType.Exhausted, -1, true); + } + } +} diff --git a/KruacentExiled/KE.CustomRoles/CR/ClassD/Enfant.cs b/KruacentExiled/KE.CustomRoles/CR/ClassD/Enfant.cs new file mode 100644 index 00000000..eff5d784 --- /dev/null +++ b/KruacentExiled/KE.CustomRoles/CR/ClassD/Enfant.cs @@ -0,0 +1,30 @@ +using Exiled.API.Features.Attributes; +using InventorySystem.Items.Usables.Scp330; +using PlayerRoles; +using System.Collections.Generic; +using UnityEngine; + +namespace KE.CustomRoles.CR.ClassD +{ + [CustomRole(RoleTypeId.ClassD)] + internal class Enfant : Exiled.CustomRoles.API.Features.CustomRole + { + public override string Name { get; set; } = "enfant"; + public override string Description { get; set; } = "Tu es un Enfant \ndo not the kid \ntu commences avec un bonbon arc-en-ciel \n t'es un peu plus petit que la normal"; + public override uint Id { get; set; } = 1041; + public override string CustomInfo { get; set; } = "Enfant"; + public override int MaxHealth { get; set; } = 100; + public override RoleTypeId Role { get; set; } = RoleTypeId.ClassD; + public override bool KeepRoleOnDeath { get; set; } = true; + public override bool KeepRoleOnChangingRole { get; set; } = true; + public override bool IgnoreSpawnSystem { get; set; } = true; + + public override float SpawnChance { get; set; } = 100; + public override Vector3 Scale { get; set; } = new Vector3(1, 0.75f, 1); + + public override List Inventory { get; set; } = new List() + { + $"{CandyKindID.Rainbow}" + }; + } +} diff --git a/KruacentExiled/KE.CustomRoles/CR/Guard/ChiefGuard.cs b/KruacentExiled/KE.CustomRoles/CR/Guard/ChiefGuard.cs new file mode 100644 index 00000000..bbccfd2e --- /dev/null +++ b/KruacentExiled/KE.CustomRoles/CR/Guard/ChiefGuard.cs @@ -0,0 +1,39 @@ +using Exiled.API.Enums; +using Exiled.API.Features.Attributes; +using PlayerRoles; +using System.Collections.Generic; + +namespace KE.CustomRoles.CR.Guard +{ + [CustomRole(RoleTypeId.FacilityGuard)] + internal class ChiefGuard : Exiled.CustomRoles.API.Features.CustomRole + { + public override string Name { get; set; } = "ChiefGuard"; + public override string Description { get; set; } = "Tu es un Chef des gardes du site \nT'as une carte de private \net un crossvec"; + public override uint Id { get; set; } = 1046; + public override string CustomInfo { get; set; } = "Chef des Gardes"; + public override int MaxHealth { get; set; } = 100; + public override RoleTypeId Role { get; set; } = RoleTypeId.FacilityGuard; + public override bool KeepRoleOnDeath { get; set; } = false; + public override bool KeepRoleOnChangingRole { get; set; } = false; + public override bool IgnoreSpawnSystem { get; set; } = true; + + public override float SpawnChance { get; set; } = 100; + + public override List Inventory { get; set; } = new List() + { + $"{ItemType.Radio}", + $"{ItemType.ArmorLight}", + $"{ItemType.GunCrossvec}", + $"{ItemType.Medkit}", + $"{ItemType.Flashlight}", + $"{ItemType.KeycardMTFPrivate}" + }; + + public override Dictionary Ammo { get; set; } = new Dictionary() + { + { AmmoType.Nato556, 120} + }; + + } +} diff --git a/KruacentExiled/KE.CustomRoles/CR/Guard/Guard914.cs b/KruacentExiled/KE.CustomRoles/CR/Guard/Guard914.cs new file mode 100644 index 00000000..e8e7a615 --- /dev/null +++ b/KruacentExiled/KE.CustomRoles/CR/Guard/Guard914.cs @@ -0,0 +1,51 @@ +using Exiled.API.Enums; +using Exiled.API.Features.Attributes; +using Exiled.API.Features.Spawn; +using PlayerRoles; +using System.Collections.Generic; + +namespace KE.CustomRoles.CR.Guard +{ + [CustomRole(RoleTypeId.FacilityGuard)] + internal class Guard914 : Exiled.CustomRoles.API.Features.CustomRole + { + public override string Name { get; set; } = "guard914"; + public override string Description { get; set; } = "Tu es Le garde de SCP-914 \nTu commences à 914 \nmais on a volé ta carte \net ntm aussi"; + public override uint Id { get; set; } = 1045; + public override string CustomInfo { get; set; } = "Garde de 914"; + public override int MaxHealth { get; set; } = 100; + public override RoleTypeId Role { get; set; } = RoleTypeId.FacilityGuard; + public override bool KeepRoleOnDeath { get; set; } = false; + public override bool KeepRoleOnChangingRole { get; set; } = false; + public override bool IgnoreSpawnSystem { get; set; } = true; + + public override SpawnProperties SpawnProperties { get; set; } = new SpawnProperties() + { + DynamicSpawnPoints = new List() + { + new DynamicSpawnPoint() + { + Location = Exiled.API.Enums.SpawnLocationType.Inside914, + Chance = 100, + } + } + }; + + public override float SpawnChance { get; set; } = 100; + + public override List Inventory { get; set; } = new List() + { + $"{ItemType.Radio}", + $"{ItemType.ArmorLight}", + $"{ItemType.GunFSP9}", + $"{ItemType.Medkit}", + $"{ItemType.Flashlight}" + }; + + public override Dictionary Ammo { get; set; } = new Dictionary() + { + { AmmoType.Nato556, 60} + }; + + } +} diff --git a/KruacentExiled/KE.CustomRoles/CR/MTF/Tank.cs b/KruacentExiled/KE.CustomRoles/CR/MTF/Tank.cs new file mode 100644 index 00000000..0d3f69c3 --- /dev/null +++ b/KruacentExiled/KE.CustomRoles/CR/MTF/Tank.cs @@ -0,0 +1,81 @@ +using Exiled.API.Enums; +using Exiled.API.Features.Attributes; +using Player = Exiled.Events.Handlers.Player; +using Exiled.Events.EventArgs.Player; +using MEC; +using PlayerRoles; +using System.Collections.Generic; +using UnityEngine; +using System; + +namespace KE.CustomRoles.CR.ClassD +{ + [CustomRole(RoleTypeId.NtfCaptain)] + internal class Tank : Exiled.CustomRoles.API.Features.CustomRole + { + public override string Name { get; set; } = "Tank"; + public override string Description { get; set; } = "Tu es un TANK tu es débuff mais ta force de tir est démultiplié (fait attention à tes balles)"; + public override uint Id { get; set; } = 1051; + public override string CustomInfo { get; set; } = "Tank"; + public override int MaxHealth { get; set; } = 200; + public override RoleTypeId Role { get; set; } = RoleTypeId.NtfCaptain; + public override bool KeepRoleOnDeath { get; set; } = false; + public override bool KeepRoleOnChangingRole { get; set; } = false; + public override bool IgnoreSpawnSystem { get; set; } = true; + + public override float SpawnChance { get; set; } = 100; + public override Vector3 Scale { get; set; } = new Vector3(1.15f, 1.15f, 1.15f); + + public override List Inventory { get; set; } = new List() + { + $"{ItemType.GunLogicer}", + $"{ItemType.GunFRMG0}", + $"{ItemType.Radio}", + $"{ItemType.GrenadeHE}", + $"{ItemType.Adrenaline}", + $"{ItemType.KeycardMTFCaptain}", + $"{ItemType.Painkillers}", + $"{ItemType.ArmorHeavy}" + }; + + public override Dictionary Ammo { get; set; } = new Dictionary() + { + { AmmoType.Nato762, 200}, + { AmmoType.Nato556, 200} + }; + + protected override void SubscribeEvents() + { + Player.Shooting += Shooting; + base.SubscribeEvents(); + } + + /// + protected override void UnsubscribeEvents() + { + Player.Shooting -= Shooting; + base.UnsubscribeEvents(); + } + + private void Shooting(ShootingEventArgs ev) + { + Timing.CallDelayed(0.5f, () => + { + Timing.RunCoroutine(EffectAttribution(ev.Player)); + }); + } + + private IEnumerator EffectAttribution(Exiled.API.Features.Player player) + { + int nbMunition = player.GetAmmo(AmmoType.Nato762) / 100; + byte nbMunitionByte = (byte) nbMunition; + + if (UnityEngine.Random.Range(0, 1) > 0.5f){ + player.DisableEffect(EffectType.Slowness); + player.EnableEffect(EffectType.Slowness, nbMunitionByte, 99999, false); + } + + yield return 0; + } + } +} diff --git a/KruacentExiled/KE.CustomRoles/CR/MTF/Terroriste.cs b/KruacentExiled/KE.CustomRoles/CR/MTF/Terroriste.cs new file mode 100644 index 00000000..c52af3ce --- /dev/null +++ b/KruacentExiled/KE.CustomRoles/CR/MTF/Terroriste.cs @@ -0,0 +1,42 @@ +using Exiled.API.Enums; +using Exiled.API.Features.Attributes; +using PlayerRoles; +using System.Collections.Generic; +using UnityEngine; + +namespace KE.CustomRoles.CR.ClassD +{ + [CustomRole(RoleTypeId.NtfSergeant)] + internal class Terroriste : Exiled.CustomRoles.API.Features.CustomRole + { + public override string Name { get; set; } = "Terroriste"; + public override string Description { get; set; } = "Tu es un Terroriste \nne fait pas exploser la facilité \ntu commences avec des grenades"; + public override uint Id { get; set; } = 1052; + public override string CustomInfo { get; set; } = "Terroriste"; + public override int MaxHealth { get; set; } = 100; + public override RoleTypeId Role { get; set; } = RoleTypeId.NtfSergeant; + public override bool KeepRoleOnDeath { get; set; } = false; + public override bool KeepRoleOnChangingRole { get; set; } = false; + public override bool IgnoreSpawnSystem { get; set; } = true; + + public override float SpawnChance { get; set; } = 100; + public override Vector3 Scale { get; set; } = new Vector3(1, 1, 1); + + public override List Inventory { get; set; } = new List() + { + $"{ItemType.GrenadeHE}", + $"{ItemType.GrenadeHE}", + $"{ItemType.GrenadeHE}", + $"{ItemType.GrenadeHE}", + $"{ItemType.GunE11SR}", + $"{ItemType.Adrenaline}", + $"{ItemType.KeycardMTFOperative}", + $"{ItemType.Radio}" + }; + + public override Dictionary Ammo { get; set; } = new Dictionary() + { + { AmmoType.Nato556, 100} + }; + } +} diff --git a/KruacentExiled/KE.CustomRoles/CR/SCP/Paper049.cs b/KruacentExiled/KE.CustomRoles/CR/SCP/Paper049.cs new file mode 100644 index 00000000..c046b151 --- /dev/null +++ b/KruacentExiled/KE.CustomRoles/CR/SCP/Paper049.cs @@ -0,0 +1,23 @@ +using Exiled.API.Features.Attributes; +using PlayerRoles; +using UnityEngine; + +namespace KE.CustomRoles.CR.SCP +{ + [CustomRole(RoleTypeId.Scp049)] + internal class Paper049 : Exiled.CustomRoles.API.Features.CustomRole + { + public override string Name { get; set; } = "Paper049"; + public override string Description { get; set; } = "u are a paper doctor"; + public override uint Id { get; set; } = 1047; + public override string CustomInfo { get; set; } = "Paper Doctor"; + public override int MaxHealth { get; set; } = 2300; + public override RoleTypeId Role { get; set; } = RoleTypeId.Scp049; + public override bool KeepRoleOnDeath { get; set; } = false; + public override bool KeepRoleOnChangingRole { get; set; } = false; + public override bool IgnoreSpawnSystem { get; set; } = true; + + public override float SpawnChance { get; set; } = 100; + public override Vector3 Scale { get; set; } = new Vector3(0.1f, 1, 1); + } +} diff --git a/KruacentExiled/KE.CustomRoles/CR/SCP/Small049.cs b/KruacentExiled/KE.CustomRoles/CR/SCP/Small049.cs new file mode 100644 index 00000000..897c79cf --- /dev/null +++ b/KruacentExiled/KE.CustomRoles/CR/SCP/Small049.cs @@ -0,0 +1,24 @@ +using Exiled.API.Features.Attributes; +using Exiled.CustomRoles.API.Features; +using PlayerRoles; +using UnityEngine; + +namespace KE.CustomRoles.CR.SCP +{ + [CustomRole(RoleTypeId.Scp049)] + internal class Small049 : CustomRole + { + public override string Name { get; set; } = "Small049"; + public override string Description { get; set; } = "u are a smoll doctor"; + public override uint Id { get; set; } = 1048; + public override string CustomInfo { get; set; } = "Small Doctor"; + public override int MaxHealth { get; set; } = 2300; + public override RoleTypeId Role { get; set; } = RoleTypeId.Scp049; + public override bool KeepRoleOnDeath { get; set; } = false; + public override bool KeepRoleOnChangingRole { get; set; } = false; + public override bool IgnoreSpawnSystem { get; set; } = true; + + public override float SpawnChance { get; set; } = 100; + public override Vector3 Scale { get; set; } = new Vector3(1, 0.75f, 1); + } +} diff --git a/KruacentExiled/KE.CustomRoles/CR/SCP/Small173.cs b/KruacentExiled/KE.CustomRoles/CR/SCP/Small173.cs new file mode 100644 index 00000000..0f12937e --- /dev/null +++ b/KruacentExiled/KE.CustomRoles/CR/SCP/Small173.cs @@ -0,0 +1,21 @@ +using Exiled.API.Features.Attributes; +using PlayerRoles; +using UnityEngine; + +namespace KE.CustomRoles.CR.SCP +{ + [CustomRole(RoleTypeId.Scp173)] + internal class Small173 : Exiled.CustomRoles.API.Features.CustomRole + { + public override string Name { get; set; } = "Tall173"; + public override string Description { get; set; } = " Tall NUT \nu tol\n fuck you"; + public override uint Id { get; set; } = 1049; + public override string CustomInfo { get; set; } = "Small Peanuts"; + public override int MaxHealth { get; set; } = 4500; + public override RoleTypeId Role { get; set; } = RoleTypeId.Scp173; + public override bool KeepRoleOnDeath { get; set; } = false; + public override bool KeepRoleOnChangingRole { get; set; } = false; + public override bool IgnoreSpawnSystem { get; set; } = true; + public override Vector3 Scale { get; set; } = new Vector3(1, 1.15f, 1); + } +} diff --git a/KruacentExiled/KE.CustomRoles/CR/SCP/ZombieDoorman.cs b/KruacentExiled/KE.CustomRoles/CR/SCP/ZombieDoorman.cs new file mode 100644 index 00000000..da5e9593 --- /dev/null +++ b/KruacentExiled/KE.CustomRoles/CR/SCP/ZombieDoorman.cs @@ -0,0 +1,32 @@ +using Exiled.API.Features.Attributes; +using Exiled.CustomRoles.API.Features; +using KE.CustomRoles.Abilities; +using PlayerRoles; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace KE.CustomRoles.CR.SCP +{ + [CustomRole(RoleTypeId.Scp0492)] + internal class ZombieDoorman : CustomRole + { + public override string Name { get; set; } = "SCP-049-2-Door"; + public override string Description { get; set; } = "U can open lock door with ur ability clapclapclap"; + public override uint Id { get; set; } = 1056; + public override string CustomInfo { get; set; } = "SCP-049-2-Door"; + public override int MaxHealth { get; set; } = 400; + public override RoleTypeId Role { get; set; } = RoleTypeId.Scp0492; + public override bool KeepRoleOnDeath { get; set; } = false; + public override bool KeepRoleOnChangingRole { get; set; } = false; + public override bool IgnoreSpawnSystem { get; set; } = true; + + public override float SpawnChance { get; set; } = 100; + public override List CustomAbilities { get; set; } = new List() + { + new OpenDoor() + }; + } +} diff --git a/KruacentExiled/KE.CustomRoles/CR/Scientist/GambleAddict.cs b/KruacentExiled/KE.CustomRoles/CR/Scientist/GambleAddict.cs new file mode 100644 index 00000000..d12d3192 --- /dev/null +++ b/KruacentExiled/KE.CustomRoles/CR/Scientist/GambleAddict.cs @@ -0,0 +1,32 @@ +using Exiled.API.Features.Attributes; +using PlayerRoles; +using System.Collections.Generic; +using UnityEngine; + +namespace KE.CustomRoles.CR.Scientist +{ + [CustomRole(RoleTypeId.Scientist)] + internal class GambleAddict : Exiled.CustomRoles.API.Features.CustomRole + { + public override string Name { get; set; } = "GambleAddict"; + public override string Description { get; set; } = "Tu es un Gamble Addict \nT'as trade ton kit et ta carte contre 4 pièces \nfais en bon usage"; + public override uint Id { get; set; } = 1043; + public override string CustomInfo { get; set; } = "GambleAddict"; + public override int MaxHealth { get; set; } = 100; + public override RoleTypeId Role { get; set; } = RoleTypeId.Scientist; + public override bool KeepRoleOnDeath { get; set; } = false; + public override bool KeepRoleOnChangingRole { get; set; } = false; + public override bool IgnoreSpawnSystem { get; set; } = true; + + public override float SpawnChance { get; set; } = 100; + public override Vector3 Scale { get; set; } = new Vector3(1, 1, 1); + + public override List Inventory { get; set; } = new List() + { + $"{ItemType.Coin}", + $"{ItemType.Coin}", + $"{ItemType.Coin}", + $"{ItemType.Coin}" + }; + } +} diff --git a/KruacentExiled/KE.CustomRoles/CR/Scientist/ZoneManager.cs b/KruacentExiled/KE.CustomRoles/CR/Scientist/ZoneManager.cs new file mode 100644 index 00000000..e92b203f --- /dev/null +++ b/KruacentExiled/KE.CustomRoles/CR/Scientist/ZoneManager.cs @@ -0,0 +1,44 @@ +using Exiled.API.Features.Attributes; +using Exiled.API.Features.Spawn; +using InventorySystem.Items.Keycards; +using PlayerRoles; +using System.Collections.Generic; +using UnityEngine; + +namespace KE.CustomRoles.CR.Scientist +{ + [CustomRole(RoleTypeId.Scientist)] + internal class ZoneManager : Exiled.CustomRoles.API.Features.CustomRole + { + public override string Name { get; set; } = "ZoneManager"; + public override string Description { get; set; } = "Tu es un Zone Manager \nT'as une carte de zone manager (d'où le nom) \nTu commences à heavy \nBon courage..."; + public override uint Id { get; set; } = 1044; + public override string CustomInfo { get; set; } = "ZoneManager"; + public override int MaxHealth { get; set; } = 100; + public override RoleTypeId Role { get; set; } = RoleTypeId.Scientist; + public override bool KeepRoleOnDeath { get; set; } = false; + public override bool KeepRoleOnChangingRole { get; set; } = false; + public override bool IgnoreSpawnSystem { get; set; } = true; + + public override float SpawnChance { get; set; } = 100; + + public override SpawnProperties SpawnProperties { get; set; } = new SpawnProperties() + { + DynamicSpawnPoints = new List() + { + new DynamicSpawnPoint() + { + Location = Exiled.API.Enums.SpawnLocationType.InsideHidLower, + Chance = 100, + } + } + }; + + public override List Inventory { get; set; } = new List() + { + $"{ItemType.Medkit}", + $"{ItemType.Adrenaline}", + $"{ItemType.KeycardZoneManager}" + }; + } +} diff --git a/KruacentExiled/KE.CustomRoles/Config.cs b/KruacentExiled/KE.CustomRoles/Config.cs new file mode 100644 index 00000000..b5634b10 --- /dev/null +++ b/KruacentExiled/KE.CustomRoles/Config.cs @@ -0,0 +1,15 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Exiled.API.Interfaces; + +namespace KE.CustomRoles +{ + public class Config : IConfig + { + public bool IsEnabled { get; set; } = true; + public bool Debug { get; set; } = true; + } +} diff --git a/KruacentExiled/KE.CustomRoles/Controller.cs b/KruacentExiled/KE.CustomRoles/Controller.cs new file mode 100644 index 00000000..2cdb14a3 --- /dev/null +++ b/KruacentExiled/KE.CustomRoles/Controller.cs @@ -0,0 +1,52 @@ +using Exiled.API.Extensions; +using Exiled.API.Features; +using Exiled.CustomRoles.API.Features; +using PlayerRoles; +using System.Collections.Generic; +using System.Linq; +using Utils.NonAllocLINQ; + +namespace KE.CustomRoles +{ + internal class Controller + { + /// + /// The chance of having a CustomRole + /// + public const int Chance = 40; + public static Controller controller = new Controller(); + + private Controller() { } + + /// + /// Gives a CustomRole to a player + /// + /// + internal void GiveRole(Player player) + { + if (player == null) + return; + if (UnityEngine.Random.Range(0, 100) > Chance) + { + Log.Debug("no luck"); + return; + } + + CustomRole cr = CustomRole.Registered.GetRandomValue(c => c.Role == player.Role); + Log.Debug($"{player.Id} : {cr.Name}"); + cr?.AddRole(player); + } + + /// + /// Gives CustomRoles to multiple players + /// + /// + internal void GiveRole(IEnumerable players) + { + foreach (Player p in players) + { + GiveRole(p); + } + } + } +} \ No newline at end of file diff --git a/KruacentExiled/KE.CustomRoles/KE.CustomRoles.csproj b/KruacentExiled/KE.CustomRoles/KE.CustomRoles.csproj new file mode 100644 index 00000000..5b7382b3 --- /dev/null +++ b/KruacentExiled/KE.CustomRoles/KE.CustomRoles.csproj @@ -0,0 +1,16 @@ + + + net48 + + + + + + + + + + + + + diff --git a/KruacentExiled/KE.CustomRoles/MainPlugin.cs b/KruacentExiled/KE.CustomRoles/MainPlugin.cs new file mode 100644 index 00000000..cbded7a9 --- /dev/null +++ b/KruacentExiled/KE.CustomRoles/MainPlugin.cs @@ -0,0 +1,57 @@ +using Exiled.API.Features; +using Exiled.CustomRoles.API.Features; +using Exiled.Events.EventArgs.Server; + + +namespace KE.CustomRoles +{ + public class MainPlugin : Plugin + { + public override string Name { get; } = "KE.CustomRoles"; + public static MainPlugin Instance; + + public override void OnEnabled() + { + + Instance = this; + + CustomRole.RegisterRoles(false,null); + this.SubscribeEvents(); + + base.OnEnabled(); + } + + public override void OnDisabled() + { + + CustomRole.UnregisterRoles(); + + Instance = null; + this.UnsubscribeEvents(); + + base.OnDisabled(); + } + + public void SubscribeEvents() + { + Exiled.Events.Handlers.Server.RoundStarted += CustomRoleImplement; + Exiled.Events.Handlers.Server.RespawnedTeam += CustomRoleRespawning; + } + public void UnsubscribeEvents() + { + Exiled.Events.Handlers.Server.RoundStarted -= CustomRoleImplement; + Exiled.Events.Handlers.Server.RespawnedTeam -= CustomRoleRespawning; + + } + + public void CustomRoleImplement() + { + Controller.controller.GiveRole(Player.List); + } + + public void CustomRoleRespawning(RespawnedTeamEventArgs ev) + { + Controller.controller.GiveRole(ev.Players); + } + } +} diff --git a/KruacentExiled/KE.CustomRoles/README.md b/KruacentExiled/KE.CustomRoles/README.md new file mode 100644 index 00000000..4bb7fa2d --- /dev/null +++ b/KruacentExiled/KE.CustomRoles/README.md @@ -0,0 +1,16 @@ +# Custom Roles + +| ID | Role Name | Description | Role | +|--------|-----------------------|------------------------------------------|---------------| +| 1041 | Enfant | Smaller than normal | Class-D | +| 1042 | Asthmatique | Reduce stamina, better aim with SCP-1853. | Class-D | +| 1043 | Gamble Addict | Spawn with 4 coins. | Scientist | +| 1044 | Zone Manager | Spawn with zone manager card in Heavy | Scientist | +| 1045 | 914 Guard | Guard protecting 914. | Guard | +| 1046 | Chief Guard | Guard with better equipment | Guard | +| 1047 | Paper 049 | Thin SCP-049 | SCP-049 | +| 1048 | Small 049 | Small SCP-049 | SCP-049 | +| 1049 | Tall 173 | Tall SCP-173 | SCP-173 | +| 1050 | Russe | Spawn with revolver, he need to do russian roulette | Chaos Insurgency | +| 1051 | Tank | More HP, more ammo but slower | Mobile Task Force | +| 1052 | Terroriste | He spawn with more grenade. | Mobile Task Force | diff --git a/KruacentExiled/KE.GlobalEventFramework.Examples/API/Feature/MalfunctionDisplay.cs b/KruacentExiled/KE.GlobalEventFramework.Examples/API/Feature/MalfunctionDisplay.cs new file mode 100644 index 00000000..4f6704fb --- /dev/null +++ b/KruacentExiled/KE.GlobalEventFramework.Examples/API/Feature/MalfunctionDisplay.cs @@ -0,0 +1,106 @@ +using Exiled.API.Features; +using InventorySystem.Items.Firearms.Modules; +using KE.GlobalEventFramework.Examples.API.Interfaces; +using KE.Utils; +using KE.Utils.API.Displays.DisplayRuei; +using KE.Utils.API.Displays.DisplayRuei.Enums; +using MEC; +using PlayerRoles; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace KE.GlobalEventFramework.Examples.API.Feature +{ + public class MalfunctionDisplay + { + private Malfunctions _malfunction; + public float RefreshRate { get; set; } = 5; + private CoroutineHandle _coroutineHandle; + public MalfunctionDisplay(Malfunctions malfunction) + { + _malfunction = malfunction; + _coroutineHandle = Show(); + } + + ~MalfunctionDisplay() + { + Timing.KillCoroutines(_coroutineHandle); + } + + public CoroutineHandle Show() + { + return Timing.RunCoroutine(Tick()); + } + + private IEnumerator Tick() + { + while (Round.InProgress) + { + yield return Timing.WaitForSeconds(RefreshRate); + ShowAllSpect(GetHint()); + } + } + + + + private void ShowAllSpect(string hint) + { + + foreach (Player p in Player.List.Where(p => p.Role == RoleTypeId.Spectator)) + { + DisplayPlayer.Get(p).Hint(new(HPosition.Right,VPosition.GlobalEvent, hint,RefreshRate+.01f)); + } + } + + private string GetHint() + { + return $"{GetCurrentMalfunction()}\n{GetAllEffect()}"; + } + + + private string GetCurrentMalfunction() + { + sbyte malfunction = _malfunction.Malfunction; + sbyte previous = _malfunction.PreviousMalfunction; + if (malfunction > previous) + return $" {malfunction}\u2191 (+{malfunction-previous})"; + if(malfunction < previous) + return $" {malfunction}\u2193 ({malfunction - previous})"; + else + return $" {malfunction}\u2192 ({malfunction - previous})"; + + } + + private string GetAllEffect() + { + string result = string.Empty; + foreach (MalfunctionEffect me in Malfunctions.MalfunctionEffects) + { + if (Malfunctions.EffectAlreadyActivated(me)) + { + if (IsREActivated(me)) result += ""; + result += $"{me.MalfunctionActivation} - {me.Name}"; + if (IsREActivated(me)) result += ""; + } + + } + return result; + } + private bool IsREActivated(MalfunctionEffect me) + { + if(me is IReversibleEffect re) + { + if(_malfunction.Malfunction >= re.MalfunctionDeactivation) + { + return true; + } + } + + return false; + } + + } +} diff --git a/KruacentExiled/KE.GlobalEventFramework.Examples/API/Feature/MalfunctionEffect.cs b/KruacentExiled/KE.GlobalEventFramework.Examples/API/Feature/MalfunctionEffect.cs new file mode 100644 index 00000000..93789040 --- /dev/null +++ b/KruacentExiled/KE.GlobalEventFramework.Examples/API/Feature/MalfunctionEffect.cs @@ -0,0 +1,19 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace KE.GlobalEventFramework.Examples.API.Feature +{ + public abstract class MalfunctionEffect + { + public abstract string Name { get; } + public abstract string VoiceLine { get; } + public abstract string VoiceLineTranslated { get; } + public abstract sbyte MalfunctionActivation { get; } + + public abstract void ActivateEffect(); + + } +} diff --git a/KruacentExiled/KE.GlobalEventFramework.Examples/API/Feature/Malfunctions.cs b/KruacentExiled/KE.GlobalEventFramework.Examples/API/Feature/Malfunctions.cs new file mode 100644 index 00000000..942c4fff --- /dev/null +++ b/KruacentExiled/KE.GlobalEventFramework.Examples/API/Feature/Malfunctions.cs @@ -0,0 +1,200 @@ +using Exiled.API.Enums; +using Exiled.API.Features; +using Exiled.API.Features.Doors; +using Exiled.API.Interfaces; +using Exiled.Events.EventArgs.Player; +using Exiled.Events.EventArgs.Scp049; +using KE.GlobalEventFramework.Examples.API.Interfaces; +using KE.GlobalEventFramework.GEFE.API.Features; +using KE.GlobalEventFramework.GEFE.API.Interfaces; +using MEC; +using PlayerRoles; +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Utils.NonAllocLINQ; + +namespace KE.GlobalEventFramework.Examples.API.Feature +{ + public class Malfunctions + { + + private sbyte _malfunction = 15; + public const sbyte Lower = -50; + public const sbyte Higher = 125; + public sbyte Malfunction + { + get { return _malfunction; } + set + { + if (value > Higher) _malfunction = Higher; + else if (value < Lower) _malfunction = Lower; + else _malfunction = value; + } + } + + public MalfunctionLevel MalfunctionLevels + { + get{return (MalfunctionLevel) Malfunction;} + } + + private static HashSet _malfunctionEffects = new HashSet(); + public static HashSet MalfunctionEffects => _malfunctionEffects.ToList().ToHashSet(); + private static Dictionary _voiced; + private static Dictionary _voicedDeactivate; + + public static bool EffectAlreadyActivated(MalfunctionEffect effect) + { + return _voiced[effect]; + } + + public sbyte PreviousMalfunction { get; private set; } + public sbyte MalfunctionAdd { get; set; } = 1; + public MalfunctionDisplay MalfunctionDisplay { get; private set; } + + + internal Malfunctions(bool display = true) + { + try + { + if (display) + MalfunctionDisplay = new MalfunctionDisplay(this); + else + MalfunctionDisplay = null; + } + catch (Exception ex) + { + Log.Error(ex + "\nRueI is probably missing : put it in dependency or disable the display"); + MalfunctionDisplay = null; + } + + LoadMalfunctionsEffect(); + } + + public bool IsDisplayEnabled() + { + return MalfunctionDisplay != null; + } + + private void LoadMalfunctionsEffect() + { + foreach (IPlugin plugin in Exiled.Loader.Loader.Plugins.Where(pl => pl.Name != MainPlugin.Instance.Name)) + { + foreach (Type type in plugin.Assembly.GetTypes()) + { + try + { + if (type.IsSubclassOf(typeof(MalfunctionEffect))) + { + MalfunctionEffect me = Activator.CreateInstance(type) as MalfunctionEffect; + _malfunctionEffects.Add(me); + } + } + catch (System.Exception e) + { + Log.Error($"Error registering in plugin {plugin.Name} : {e.Message}"); + } + } + } + _voiced = _malfunctionEffects.ToDictionary(m => m, m => false); + _voicedDeactivate = _malfunctionEffects.Where(m => m is IReversibleEffect).ToDictionary(m => m, m => false); + } + + + internal IEnumerator Tick() + { + while (Round.InProgress) + { + PreviousMalfunction = Malfunction; + Malfunction += MalfunctionAdd; + Malfunction += AdditionnalMalfunction(); + CheckMalfunctionEffect(Malfunction); + Log.Debug($"Malfunction={Malfunction}"); + yield return Timing.WaitForSeconds(60); + } + } + + + + private void CheckMalfunctionEffect(sbyte malfunction) + { + foreach (MalfunctionEffect me in _malfunctionEffects) + { + if (malfunction >= me.MalfunctionActivation) + { + if (!_voiced[me]) + { + _voiced[me] = true; + Cassie.MessageTranslated(me.VoiceLine,me.VoiceLineTranslated,false,false); + } + me.ActivateEffect(); + } + + if(me is IReversibleEffect re && malfunction < re.MalfunctionDeactivation) + { + if (!_voicedDeactivate[me]) + { + _voicedDeactivate[me] = true; + Cassie.MessageTranslated(re.VoiceLineDeactivate, re.VoiceLineDeactivateTranslated, false, false); + } + re.DeactivateEffect(); + } + } + } + + + + + private sbyte AdditionnalMalfunction() + { + sbyte result = (sbyte)UnityEngine.Random.Range(-2, 3); + //generator reduce the malfunction + result -= (sbyte)(Generator.List.Count(x => x.IsEngaged) * 3); + //number of scp increase 3 (except zombies) + result += (sbyte)(Player.List.Count(p => p.Role.Side == Side.Scp && p.Role != RoleTypeId.Scp0492) * 3); + //number of zombies increase 1 + result += (sbyte)Player.List.Count(p => p.Role == RoleTypeId.Scp0492); + //reduce when walking + + return result; + + } + + + internal void OnDying(DyingEventArgs ev) + { + switch (ev.Player.Role.Side) + { + case Side.Mtf: + Malfunction += 1; + break; + case Side.ChaosInsurgency: + Malfunction -= 1; + break; + case Side.Scp: + if (ev.Player.Role != RoleTypeId.Scp0492) Malfunction -= 10; + else Malfunction -= 2; + break; + } + } + + internal void OnFinishingRevive(FinishingRecallEventArgs ev) + { + Malfunction += 3; + } + + + + public enum MalfunctionLevel + { + VeryLowMalfunction = 0, + LowMalfunction = 25, + MediumMalfunction = 50, + HighMalfunction = 75, + VeryHighMalfunction = 100, + } + } +} diff --git a/KruacentExiled/KE.GlobalEventFramework.Examples/API/Interfaces/IReversibleEffect.cs b/KruacentExiled/KE.GlobalEventFramework.Examples/API/Interfaces/IReversibleEffect.cs new file mode 100644 index 00000000..efa0df05 --- /dev/null +++ b/KruacentExiled/KE.GlobalEventFramework.Examples/API/Interfaces/IReversibleEffect.cs @@ -0,0 +1,17 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace KE.GlobalEventFramework.Examples.API.Interfaces +{ + internal interface IReversibleEffect + { + string VoiceLineDeactivate { get; } + string VoiceLineDeactivateTranslated { get; } + sbyte MalfunctionDeactivation { get; } + void DeactivateEffect(); + + } +} diff --git a/KruacentExiled/KE.GlobalEventFramework.Examples/API/MalfunctionEffects/AutoNuke.cs b/KruacentExiled/KE.GlobalEventFramework.Examples/API/MalfunctionEffects/AutoNuke.cs new file mode 100644 index 00000000..49344ed7 --- /dev/null +++ b/KruacentExiled/KE.GlobalEventFramework.Examples/API/MalfunctionEffects/AutoNuke.cs @@ -0,0 +1,52 @@ +using Exiled.API.Features; +using KE.GlobalEventFramework.Examples.API.Feature; +using KE.GlobalEventFramework.Examples.API.Interfaces; +using KE.GlobalEventFramework.Examples.GE; +using MEC; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace KE.GlobalEventFramework.Examples.API.MalfunctionEffects +{ + internal class AutoNuke : MalfunctionEffect + { + public override string Name { get; } = "Automatic Warhead"; + public override string VoiceLine { get; } = "Malfunctions levels above . 90 percent . . starting emergency warhead"; + public override string VoiceLineTranslated { get; } = "Malfunctions levels above 90%, starting emergency warhead"; + public override sbyte MalfunctionActivation { get; } = 90; + + + public sbyte MalfunctionDeactivation { get; } = 85; + private CoroutineHandle _checkNuke; + + public override void ActivateEffect() + { + if (!Warhead.IsInProgress) + { + Warhead.Start(); + Warhead.IsLocked = true; + Timing.KillCoroutines(_checkNuke); + _checkNuke = Timing.RunCoroutine(CheckNuke()); + } + } + + public IEnumerator CheckNuke() + { + while (Warhead.IsInProgress) + { + yield return Timing.WaitForSeconds(5); + var malfunction = SystemMalfunction.Malfunction.Malfunction; + if (malfunction <= 85) + { + Log.Debug($"Malfunction low enough ({malfunction}) disabling the nuke"); + Warhead.IsLocked = false; + Warhead.Stop(); + break; + } + } + } + } +} diff --git a/KruacentExiled/KE.GlobalEventFramework.Examples/API/MalfunctionEffects/ForceDecon.cs b/KruacentExiled/KE.GlobalEventFramework.Examples/API/MalfunctionEffects/ForceDecon.cs new file mode 100644 index 00000000..09addb75 --- /dev/null +++ b/KruacentExiled/KE.GlobalEventFramework.Examples/API/MalfunctionEffects/ForceDecon.cs @@ -0,0 +1,50 @@ + + +using Exiled.API.Enums; +using Exiled.API.Features; +using Exiled.API.Features.Doors; +using KE.GlobalEventFramework.Examples.API.Feature; +using MEC; +using System.Linq; + +namespace KE.GlobalEventFramework.Examples.API.MalfunctionEffects +{ + internal class ForceDecon : MalfunctionEffect + { + public override string Name { get; } = "Forced Decontamination"; + public override string VoiceLine { get; } = "Malfunctions levels above . 25 percent . . decontamination of Light Containment Zone in . 30 seconds"; + public override string VoiceLineTranslated { get; } = "Malfunctions levels above 25%, decontamination of Light Containment Zone in 30 seconds"; + public override sbyte MalfunctionActivation { get; } = 25; + + public override void ActivateEffect() + { + if (Map.IsLczDecontaminated || !Map.IsLczDecontaminated) return; + Door.List.ToList().ForEach(d => + { + if (d.Zone == ZoneType.LightContainment) + { + if (!d.IsElevator) + { + d.ChangeLock(DoorLockType.DecontEvacuate); + d.IsOpen = true; + } + + } + }); + Timing.CallDelayed(30 + Cassie.CalculateDuration(VoiceLine), () => + { + Map.StartDecontamination(); + + foreach (Door d in Door.List) + { + if (d.Type == DoorType.ElevatorLczA || d.Type == DoorType.ElevatorLczB) + { + d.Lock(DoorLockType.DecontEvacuate); + d.IsOpen = false; + } + } + }); + } + + } +} diff --git a/KruacentExiled/KE.GlobalEventFramework.Examples/API/MalfunctionEffects/Locks.cs b/KruacentExiled/KE.GlobalEventFramework.Examples/API/MalfunctionEffects/Locks.cs new file mode 100644 index 00000000..ef71c7eb --- /dev/null +++ b/KruacentExiled/KE.GlobalEventFramework.Examples/API/MalfunctionEffects/Locks.cs @@ -0,0 +1,50 @@ +using Exiled.API.Enums; +using Exiled.API.Features; +using Exiled.API.Features.Doors; +using KE.GlobalEventFramework.Examples.API.Feature; +using KE.GlobalEventFramework.Examples.API.Interfaces; +using MEC; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Utils.NonAllocLINQ; + +namespace KE.GlobalEventFramework.Examples.API.MalfunctionEffects +{ + internal class Locks : MalfunctionEffect, IReversibleEffect + { + public override string Name { get; } = "Door locks terminated"; + public override string VoiceLine { get; } = "Malfunctions levels above . 50 percent . . terminating all door locks"; + public override string VoiceLineTranslated { get; } = "Malfunctions levels above 50%, terminating all door locks"; + public override sbyte MalfunctionActivation { get; } = 50; + + public string VoiceLineDeactivate { get; } = "Malfunctions back to more stable levels, reputting all door locks"; + public string VoiceLineDeactivateTranslated { get; } = "Malfunctions back to more stable levels, reputting all door locks"; + public sbyte MalfunctionDeactivation { get; } = 40; + + + private Dictionary doorkeys = new Dictionary(); + public override void ActivateEffect() + { + Door.List.ToList().ForEach(d => + { + if (d.IsKeycardDoor) + { + doorkeys.Add(d, d.KeycardPermissions); + d.KeycardPermissions = KeycardPermissions.None; + } + }); + } + + public void DeactivateEffect() + { + doorkeys.ForEach(dk => + { + dk.Key.KeycardPermissions = dk.Value; + }); + } + + } +} diff --git a/KruacentExiled/KE.GlobalEventFramework.Examples/GE/Blitz.cs b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/Blitz.cs index cfc0eddf..db94c76d 100644 --- a/KruacentExiled/KE.GlobalEventFramework.Examples/GE/Blitz.cs +++ b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/Blitz.cs @@ -1,22 +1,19 @@ using Exiled.API.Features; using Exiled.API.Features.Items; using KE.GlobalEventFramework.GEFE.API.Features; +using KE.GlobalEventFramework.GEFE.API.Interfaces; using MEC; -using System; using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; namespace KE.GlobalEventFramework.Examples.GE { /// /// Spawn fused grenades in random rooms in the map /// - public class Blitz : GlobalEvent + public class Blitz : GlobalEvent, IStart { /// - public override int Id { get; set; } = 1; + public override uint Id { get; set; } = 1046; /// public override string Name { get; set; } = "Blitz"; /// @@ -32,7 +29,7 @@ public class Blitz : GlobalEvent /// public int NbGrenadeSpawned { get; set; } = 5; /// - public override IEnumerator Start() + public IEnumerator Start() { while (!Round.IsEnded) { diff --git a/KruacentExiled/KE.GlobalEventFramework.Examples/GE/BrokenGenerator.cs b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/BrokenGenerator.cs new file mode 100644 index 00000000..8f411cc8 --- /dev/null +++ b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/BrokenGenerator.cs @@ -0,0 +1,66 @@ +using Player = Exiled.API.Features.Player; +using System.Collections.Generic; +using KE.GlobalEventFramework.GEFE.API.Features; +using KE.GlobalEventFramework.GEFE.API.Interfaces; +using MEC; +using Exiled.API.Features; +using Exiled.API.Enums; +using Exiled.API.Features.Doors; +using Exiled.Events.EventArgs.Map; +using System.Linq; +using System.Drawing.Imaging; + +namespace KE.GlobalEventFramework.Examples.GE +{ + public class BrokenGenerator : GlobalEvent, IStart, IEvent + { + public override uint Id { get; set; } = 1050; + public override string Name { get; set; } = "Broken Generator"; + public override string Description { get; set; } = "Repair the generator to be able to see !"; + public override int Weight { get; set; } = 0; + + //add event to avoid blackouts + public List zones = new List + { + ZoneType.LightContainment, + ZoneType.HeavyContainment, + ZoneType.Entrance, + ZoneType.Surface, + ZoneType.Pocket + }; + + public IEnumerator Start() + { + zones.ForEach(zone => Map.TurnOffAllLights(99999999, zone)); + + foreach (Player player in Player.List) + { + if (player.IsHuman) + { + player.AddItem(ItemType.Flashlight); + } + } + + yield return 0; + } + + public void SubscribeEvent() + { + Exiled.Events.Handlers.Map.GeneratorActivating += GenActivate; + } + + public void UnsubscribeEvent() + { + Exiled.Events.Handlers.Map.GeneratorActivating -= GenActivate; + } + + public void GenActivate(GeneratorActivatingEventArgs ev) + { + if (Generator.List.Where(g => g.IsEngaged).Count() == 3) + { + Map.TurnOnAllLights(zones); + } + } + + } +} \ No newline at end of file diff --git a/KruacentExiled/KE.GlobalEventFramework.Examples/GE/CassieGoCrazy.cs b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/CassieGoCrazy.cs new file mode 100644 index 00000000..70d80e6c --- /dev/null +++ b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/CassieGoCrazy.cs @@ -0,0 +1,153 @@ +using Exiled.API.Features; +using Exiled.API.Features.Items; +using Exiled.Events.EventArgs.Player; +using KE.GlobalEventFramework.GEFE.API.Features; +using KE.GlobalEventFramework.GEFE.API.Interfaces; +using MEC; +using System.Collections.Generic; +using System.Linq; + +namespace KE.GlobalEventFramework.Examples.GE +{ + /// + /// Spawn fused grenades in random rooms in the map + /// + public class CassieGoCrazy : GlobalEvent, IStart + { + /// + public override uint Id { get; set; } = 1049; + /// + public override string Name { get; set; } = "Cassie Go Crazy"; + /// + public override string Description { get; set; } = "Crazy Cassie !"; + /// + public override int Weight { get; set; } = 1; + + /// + /// The cooldown between 2 cassie event + /// + public int Cooldown { get; set; } = 380; + + /// + /// Percentage for rare event to occur + /// + public int RareEvent { get; set; } = 2; + + /// + /// Starts a coroutine to perform random actions during the game. + /// + /// A coroutine that runs until the game round ends. + /// + public IEnumerator Start() + { + while (!Round.IsEnded) + { + Log.Debug("waiting"); + yield return Timing.WaitForSeconds(Cooldown); + + int action = UnityEngine.Random.Range(1, 6); + + switch (action) + { + // Turns off the lights in the Heavy Containment zone. + case 1: + Map.TurnOffAllLights(20, Exiled.API.Enums.ZoneType.HeavyContainment); + break; + + // Starting the Warhead + case 2: + if (!Warhead.IsDetonated) + { + Warhead.Start(); + } + break; + + + // Change Map Color to Cyan + case 3: + Map.ChangeLightsColor(UnityEngine.Color.cyan); + break; + + // Sad Cassie scenario. + case 4: + Cassie.Message("I wanna just be useful", true, true, true); + Map.TurnOffAllLights(2, Exiled.API.Enums.ZoneType.HeavyContainment); + Map.TurnOffAllLights(2, Exiled.API.Enums.ZoneType.Entrance); + yield return Timing.WaitForSeconds(3); + Map.TurnOffAllLights(2, Exiled.API.Enums.ZoneType.HeavyContainment); + Map.TurnOffAllLights(2, Exiled.API.Enums.ZoneType.Entrance); + + if(!Warhead.IsDetonated) + Warhead.Start(); + + for (int i = 0; i < 10; i++) + { + ((ExplosiveGrenade)Item.Create(ItemType.GrenadeHE)).SpawnActive(Room.Random().Position); + } + + yield return Timing.WaitForSeconds(20); + Warhead.Stop(); + + + break; + + // Antagonistic Cassie scenario. + case 5: + List nonScpPlayers = Player.List.Where(player => !player.IsScp).ToList(); + + if (nonScpPlayers.Count > 0) + { + Player target = nonScpPlayers[UnityEngine.Random.Range(0, nonScpPlayers.Count)]; + + Cassie.Message("New target : " + target.Nickname, true, true, true); + + void OnPlayerDeath(DyingEventArgs ev) + { + if (ev.Player == target && ev.Attacker != null && ev.Attacker != target) + { + if (!ev.Attacker.IsScp) + { + GiveRandomRewardPlayer(ev.Attacker); + } + + Exiled.Events.Handlers.Player.Dying -= OnPlayerDeath; + } + } + + Exiled.Events.Handlers.Player.Dying += OnPlayerDeath; + } + break; + } + + /// + /// Gives a random reward to the player who killed the target. + /// + /// The player who will receive the reward. + /// + void GiveRandomRewardPlayer(Player player) + { + var items = new List + { + ItemType.ParticleDisruptor, + ItemType.Coin, + ItemType.KeycardO5, + ItemType.SCP268 + }; + + ItemType randomItem = items[UnityEngine.Random.Range(0, items.Count)]; + + player.AddItem(randomItem); + + if (UnityEngine.Random.Range(0, 100) < RareEvent) + { + player.MaxHealth = 125; + player.Broadcast(5, "Another gift for you !"); + } + } + + + } + } + + } +} diff --git a/KruacentExiled/KE.GlobalEventFramework.Examples/GE/Impostor.cs b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/Impostor.cs index 89ee6f6a..48a21131 100644 --- a/KruacentExiled/KE.GlobalEventFramework.Examples/GE/Impostor.cs +++ b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/Impostor.cs @@ -1,6 +1,7 @@ using Player = Exiled.API.Features.Player; using System.Collections.Generic; using KE.GlobalEventFramework.GEFE.API.Features; +using KE.GlobalEventFramework.GEFE.API.Interfaces; using MEC; using System.Linq; using Exiled.API.Extensions; @@ -8,27 +9,28 @@ namespace KE.GlobalEventFramework.Examples.GE { - public class Impostor : GlobalEvent + public class Impostor : GlobalEvent, IStart { - public override int Id { get; set; } = 30; + public override uint Id { get; set; } = 1044; public override string Name { get; set; } = "Impostor"; public override string Description { get; set; } = "Ne vous fiez pas aux apparences !"; public override int Weight { get; set; } = 1; - public override IEnumerator Start() + public IEnumerator Start() { while (!Round.IsEnded) { - int randomNumber = UnityEngine.Random.Range(180, 300); - yield return Timing.WaitForSeconds(randomNumber); - ChangingPlayer(); + yield return Timing.WaitForSeconds(UnityEngine.Random.Range(180, 300)); + + ChangingHumanApparence(); + ChangingSCPApparence(); } } - private void ChangingPlayer() + private void ChangingHumanApparence() { // Liste des joueurs vivants - List playerInServer = Player.List.Where(p => !p.IsNPC && p.IsAlive).ToList(); + List playerInServer = Player.List.Where(p => !p.IsNPC && p.IsAlive && !p.IsScp).ToList(); if (playerInServer.Count < 2) { @@ -65,6 +67,13 @@ private void ChangingPlayer() } } + private void ChangingSCPApparence() + { + Player randomHumanPlayer = Player.List.Where(p => !p.IsNPC && p.IsAlive && !p.IsScp).ToList().GetRandomValue(); + + Player randomScpPlayer = Player.List.Where(p => !p.IsNPC && p.IsAlive && p.IsScp).ToList().GetRandomValue(); + randomScpPlayer.ChangeAppearance(randomHumanPlayer.Role); + } } } \ No newline at end of file diff --git a/KruacentExiled/KE.GlobalEventFramework.Examples/GE/KIWIS.cs b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/KIWIS.cs index 22ef5274..de9199a3 100644 --- a/KruacentExiled/KE.GlobalEventFramework.Examples/GE/KIWIS.cs +++ b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/KIWIS.cs @@ -5,6 +5,7 @@ using System.Collections.Generic; using System.Linq; using KE.GlobalEventFramework.GEFE.API.Features; +using KE.GlobalEventFramework.GEFE.API.Interfaces; namespace KE.GlobalEventFramework.Examples.GE @@ -12,10 +13,10 @@ namespace KE.GlobalEventFramework.Examples.GE /// /// The scp start with 2/3 of it's life and end with 4/3 of it's vanilla life /// - public class KIWIS : GlobalEvent + public class KIWIS : GlobalEvent,IStart { /// - public override int Id { get; set; } = 32; + public override uint Id { get; set; } = 1047; /// public override string Name { get; set; } = "KIWIS"; /// @@ -23,16 +24,10 @@ public class KIWIS : GlobalEvent /// public override int Weight { get; set; } = 1; /// - public override IEnumerator Start() + public IEnumerator Start() { var listScp = Player.List.ToList().Where(p => p.IsScp && p.Role.Type != RoleTypeId.Scp0492).ToList().ToDictionary(p => p, p => p.MaxHealth/3); - //set the health of all starting scps to 2/3 of their vanilla max health - listScp.ForEach(k => - { - k.Key.MaxHealth = k.Value * 2; - k.Key.Health = k.Key.MaxHealth; - }); yield return Timing.WaitUntilTrue(() => Round.ElapsedTime.TotalMinutes >= 15); @@ -42,7 +37,7 @@ public override IEnumerator Start() k.Key.Heal(k.Value); }); - yield return Timing.WaitUntilTrue(() => Round.ElapsedTime.TotalMinutes >= 30); + yield return Timing.WaitUntilTrue(() => Round.ElapsedTime.TotalMinutes >= 30 || Warhead.IsDetonated); listScp = listScp.Where(p => p.Key.IsScp && p.Key.Role.Type != RoleTypeId.Scp0492).ToList().ToDictionary(p => p.Key, p => p.Value); listScp.ForEach(k => { k.Key.MaxHealth += k.Value; diff --git a/KruacentExiled/KE.GlobalEventFramework.Examples/GE/Kaboom.cs b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/Kaboom.cs new file mode 100644 index 00000000..6973b3d3 --- /dev/null +++ b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/Kaboom.cs @@ -0,0 +1,99 @@ +using Exiled.API.Enums; +using Exiled.API.Features.Items; +using Exiled.API.Features; +using Exiled.Events.EventArgs.Player; +using KE.GlobalEventFramework.GEFE.API.Features; +using KE.GlobalEventFramework.GEFE.API.Interfaces; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using DoorType = Exiled.API.Enums.DoorType; + +namespace KE.GlobalEventFramework.Examples.GE +{ + public class Kaboom : GlobalEvent, IEvent + { + /// + public override uint Id { get; set; } = 1052; + /// + public override string Name { get; set; } = "Kaboom"; + /// + public override string Description { get; set; } = "Les portes sont piegés attention!"; + /// + public override int Weight { get; set; } = 1; + + + public const float BaseChanceElevator = .05f; + private float _chanceElevator; + public float ChanceElevator + { + get{ return _chanceElevator;} + set + { + if (value >= 0 && value <= 1) + _chanceElevator = value; + else + _chanceElevator = BaseChanceElevator; + } + } + public const float BaseChanceGate = .25f; + private float _chanceGate; + + public float ChanceGate + { + get { return _chanceGate;} + set + { + if (value >= 0 && value <= 1) + _chanceGate = value; + else + _chanceGate = BaseChanceGate; + } + } + + public const float BaseChanceDoor = .1f; + + private float _chanceDoor; + public float ChanceDoor + { + get { return _chanceDoor; } + set + { + if (value > 0 && value <= 1) + _chanceDoor = value; + else + _chanceDoor= BaseChanceDoor; + } + } + + + + /// + public void SubscribeEvent() + { + Exiled.Events.Handlers.Player.InteractingDoor += OnInteractingDoor; + } + public void UnsubscribeEvent() + { + Exiled.Events.Handlers.Player.InteractingDoor -= OnInteractingDoor; + } + + private void OnInteractingDoor(InteractingDoorEventArgs ev) + { + float random = UnityEngine.Random.value; + bool spawnGrenade = + (ev.Door.IsElevator && random < .05f) || + (ev.Door.IsGate && random < .5f) || + (ev.Door.IsDamageable && random <.1f); + + Log.Debug($"i love debugging random value : {random} ; Kaboom? {spawnGrenade}"); + if (spawnGrenade) + { + + ((ExplosiveGrenade)Item.Create(ItemType.GrenadeHE)).SpawnActive(ev.Door.Position); + } + } + } +} diff --git a/KruacentExiled/KE.GlobalEventFramework.Examples/GE/OpenBar.cs b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/OpenBar.cs index 1a558685..5b29e0fd 100644 --- a/KruacentExiled/KE.GlobalEventFramework.Examples/GE/OpenBar.cs +++ b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/OpenBar.cs @@ -8,16 +8,19 @@ using Exiled.API.Enums; using Exiled.API.Features; using Exiled.Events.EventArgs.Map; +using KE.GlobalEventFramework.GEFE.API.Interfaces; namespace KE.GlobalEventFramework.Examples.GE { - public class OpenBar : GlobalEvent + public class OpenBar : GlobalEvent, IStart,IEvent { - public override int Id { get; set; } = 38; + public override uint Id { get; set; } = 1048; public override string Name { get; set; } = "OpenBar"; public override string Description { get; set; } = "j'espère que vous avez pas prévu de kampé"; - public override int Weight { get; set; } = 1; - public override IEnumerator Start() + public override int Weight { get; set; } = 0; + //use event to avoid doorstuck + public override uint[] IncompatibleGE { get; set; } = { 1 }; + public IEnumerator Start() { var doors = Door.List.Where(d => new[] { DoorType.GateA, DoorType.GateB, DoorType.HczArmory, DoorType.HIDChamber,DoorType.Intercom,DoorType.Scp049Armory,DoorType.Scp096,DoorType.Scp106Primary,DoorType.Scp106Secondary,DoorType.Scp330,DoorType.Scp330Chamber,DoorType.Scp914Gate }.Contains(d.Type)).ToList(); UnlockAndOpen(doors); @@ -34,12 +37,12 @@ private void UnlockAndOpen(List doors) }); } - public override void SubscribeEvent() + public void SubscribeEvent() { Exiled.Events.Handlers.Map.GeneratorActivating += GenActivate; } - public override void UnsubscribeEvent() + public void UnsubscribeEvent() { Exiled.Events.Handlers.Map.GeneratorActivating -= GenActivate; } diff --git a/KruacentExiled/KE.GlobalEventFramework.Examples/GE/R.cs b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/R.cs index ec4ab613..f2bbfc3a 100644 --- a/KruacentExiled/KE.GlobalEventFramework.Examples/GE/R.cs +++ b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/R.cs @@ -9,7 +9,7 @@ namespace KE.GlobalEventFramework.Examples.GE public class R : GlobalEvent { /// - public override int Id { get; set; } = 32; + public override uint Id { get; set; } = 0; /// public override string Name { get; set; } = "nothing"; /// @@ -17,10 +17,6 @@ public class R : GlobalEvent /// public override int Weight { get; set; } = 3; /// - public override IEnumerator Start() - { - yield return 0; - } } } diff --git a/KruacentExiled/KE.GlobalEventFramework.Examples/GE/RandomSpawn.cs b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/RandomSpawn.cs index fe31b79b..42aa4087 100644 --- a/KruacentExiled/KE.GlobalEventFramework.Examples/GE/RandomSpawn.cs +++ b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/RandomSpawn.cs @@ -1,5 +1,8 @@ -using Exiled.API.Features; +using Exiled.API.Enums; +using Exiled.API.Extensions; +using Exiled.API.Features; using KE.GlobalEventFramework.GEFE.API.Features; +using KE.GlobalEventFramework.GEFE.API.Interfaces; using PlayerRoles; using System; using System.Collections.Generic; @@ -13,22 +16,24 @@ namespace KE.GlobalEventFramework.Examples.GE /// All spawn are random at the start of the game (NTF & Chaos not included) /// Note: all role spawn with each other except SCPs ///
- public class RandomSpawn : GlobalEvent + public class RandomSpawn : GlobalEvent,IStart { /// - public override int Id { get; set; } = 32; + public override uint Id { get; set; } = 1043; /// public override string Name { get; set; } = "RandomSpawn"; /// public override string Description { get; set; } = "Les spawns sont random"; /// public override int Weight { get; set; } = 1; + public IEnumerable BlacklistedRooms { get; } = new HashSet() { RoomType.EzShelter,RoomType.HczTestRoom,RoomType.EzCollapsedTunnel}; /// - public override IEnumerator Start() + public IEnumerator Start() { - Room room = Room.Random(); + Room room; foreach (RoleTypeId r in Enum.GetValues(typeof(RoleTypeId))) { + room = Room.List.GetRandomValue(r => !BlacklistedRooms.Contains(r.Type)); foreach (Player p in Player.List) { @@ -38,7 +43,7 @@ public override IEnumerator Start() } } - room = Room.Random(); + } yield return 0; } diff --git a/KruacentExiled/KE.GlobalEventFramework.Examples/GE/Shuffle.cs b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/Shuffle.cs index 12e6d505..7d4a336a 100644 --- a/KruacentExiled/KE.GlobalEventFramework.Examples/GE/Shuffle.cs +++ b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/Shuffle.cs @@ -6,6 +6,7 @@ using UnityEngine; using System.Collections.Generic; using System.Linq; +using KE.GlobalEventFramework.GEFE.API.Interfaces; namespace KE.GlobalEventFramework.Examples.GE @@ -13,10 +14,10 @@ namespace KE.GlobalEventFramework.Examples.GE /// /// Every some amount of time all player take the position of another /// - public class Shuffle : GlobalEvent + public class Shuffle : GlobalEvent, IStart,IEvent { /// - public override int Id { get; set; } = 31; + public override uint Id { get; set; } = 1045; /// public override string Name { get; set; } = "Shuffle"; /// @@ -26,7 +27,7 @@ public class Shuffle : GlobalEvent private List players; private List pos; /// - public override IEnumerator Start() + public IEnumerator Start() { this.players = Player.List.ToList().Where(p => !p.IsNPC).ToList(); this.players.ShuffleList(); @@ -66,12 +67,12 @@ public override IEnumerator Start() } } /// - public override void SubscribeEvent() + public void SubscribeEvent() { PlayerHandler.Joined += OnJoined; } /// - public override void UnsubscribeEvent() + public void UnsubscribeEvent() { PlayerHandler.Joined -= OnJoined; } diff --git a/KruacentExiled/KE.GlobalEventFramework.Examples/GE/Speed.cs b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/Speed.cs index a9152fb6..c8d01e9c 100644 --- a/KruacentExiled/KE.GlobalEventFramework.Examples/GE/Speed.cs +++ b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/Speed.cs @@ -4,6 +4,7 @@ using Exiled.Events.EventArgs.Player; using Exiled.Events.EventArgs.Scp173; using KE.GlobalEventFramework.GEFE.API.Features; +using KE.GlobalEventFramework.GEFE.API.Interfaces; using MEC; using System; using System.Collections.Generic; @@ -18,10 +19,10 @@ namespace KE.GlobalEventFramework.Examples.GE /// Everyone has a movement boost effect (stackable) /// Maybe inspired by Dr Bright's Mayhem ///
- public class Speed : GlobalEvent + public class Speed : GlobalEvent,IStart,IEvent { /// - public override int Id { get; set; } = 30; + public override uint Id { get; set; } = 1042; /// public override string Name { get; set; } = "Speed"; /// @@ -33,20 +34,20 @@ public class Speed : GlobalEvent ///
public byte MovementBoost { get; set; } = 100; /// - public override IEnumerator Start() + public IEnumerator Start() { yield return Timing.WaitForSeconds(1); Player.List.ToList().ForEach(p => p.EnableEffect(MovementBoost,999999999, true)); } /// - public override void SubscribeEvent() + public void SubscribeEvent() { PlayerHandler.ChangingRole += ReactivateEffectSpawn; Exiled.Events.Handlers.Scp173.Blinking += SpeedyNut; } /// - public override void UnsubscribeEvent() + public void UnsubscribeEvent() { PlayerHandler.ChangingRole -= ReactivateEffectSpawn; Exiled.Events.Handlers.Scp173.Blinking -= SpeedyNut; @@ -57,7 +58,7 @@ public override void UnsubscribeEvent() ///
private void SpeedyNut(BlinkingEventArgs ev) { - ev.BlinkCooldown = ev.BlinkCooldown/2; + ev.BlinkCooldown = ev.BlinkCooldown/4; } /// diff --git a/KruacentExiled/KE.GlobalEventFramework.Examples/GE/SwapProtocol.cs b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/SwapProtocol.cs new file mode 100644 index 00000000..2282d027 --- /dev/null +++ b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/SwapProtocol.cs @@ -0,0 +1,99 @@ +using Player = Exiled.API.Features.Player; +using System.Collections.Generic; +using KE.GlobalEventFramework.GEFE.API.Features; +using KE.GlobalEventFramework.GEFE.API.Interfaces; +using MEC; +using System.Linq; +using Exiled.API.Extensions; +using Exiled.API.Features; +using Exiled.API.Enums; +using static UnityEngine.GraphicsBuffer; + +namespace KE.GlobalEventFramework.Examples.GE +{ + public class SwapProtocol : GlobalEvent, IStart + { + public override uint Id { get; set; } = 1051; + public override string Name { get; set; } = "SwapProtocol"; + public override string Description { get; set; } = "EEEEEEEET c'est parti la roulette tourne"; + public override int Weight { get; set; } = 1; + + public IEnumerator Start() + { + while (!Round.IsEnded) + { + // every 5 min + yield return Timing.WaitForSeconds(10); + ChangingPlayer(); + } + } + + private void ChangingPlayer() + { + // Liste des joueurs vivants + List playerInServer = Player.List.Where(p => !p.IsNPC).ToList(); + + if (playerInServer.Count < 2) + { + Log.Debug("Pas assez de joueurs vivants pour effectuer un échange !"); + return; + } + + Log.Debug("===== Liste des joueurs avant permutation ====="); + playerInServer.ForEach(p => Log.Debug($"{p.Nickname} ({p.Role})")); + + // Mélanger la liste des joueurs + playerInServer.ShuffleList(); + + // Copier les données actuelles des joueurs + var playersRoles = playerInServer.Select(p => p.Role).ToList(); + + // Permutation circulaire des rôles et pseudonymes + for (int i = 0; i < playerInServer.Count; i++) + { + int nextIndex = (i + 1) % playerInServer.Count; + + var player = playerInServer[i]; + var target = playerInServer[nextIndex]; + + // Récupération des objets + List items1 = player.Items.Select(item => item.Type).ToList(); + List items2 = target.Items.Select(item => item.Type).ToList(); + + // Sauvegarde et suppression des munitions + Dictionary ammo1 = new Dictionary(); + Dictionary ammo2 = new Dictionary(); + + for (int j = 0; j < player.Ammo.Count; j++) + { + ammo1.Add(player.Ammo.ElementAt(j).Key.GetAmmoType(), player.Ammo.ElementAt(j).Value); + player.SetAmmo(ammo1.ElementAt(j).Key, 0); + } + for (int j = 0; j < target.Ammo.Count; j++) + { + ammo2.Add(target.Ammo.ElementAt(j).Key.GetAmmoType(), target.Ammo.ElementAt(j).Value); + target.SetAmmo(ammo2.ElementAt(j).Key, 0); + } + + // Changement de rôle + player.Role.Set(playersRoles[nextIndex], PlayerRoles.RoleSpawnFlags.AssignInventory); + + // Attribution des inventaires + target.ResetInventory(items1); + player.ResetInventory(items2); + + // Attribution des munitions + foreach (var ammo in ammo2) + { + player.SetAmmo(ammo.Key, ammo.Value); + } + foreach (var ammo in ammo1) + { + target.SetAmmo(ammo.Key, ammo.Value); + } + } + } + + + } +} \ No newline at end of file diff --git a/KruacentExiled/KE.GlobalEventFramework.Examples/GE/SystemMalfunction.cs b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/SystemMalfunction.cs index 7788b58a..6632d5ff 100644 --- a/KruacentExiled/KE.GlobalEventFramework.Examples/GE/SystemMalfunction.cs +++ b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/SystemMalfunction.cs @@ -8,6 +8,15 @@ using Interactables.Interobjects.DoorUtils; using Exiled.API.Enums; using Exiled.API.Extensions; +using KE.GlobalEventFramework.GEFE.API.Interfaces; +using System; +using Exiled.Events.EventArgs.Player; +using System.Security.Policy; +using PlayerRoles; +using Utils.NonAllocLINQ; +using KeycardPermissions = Exiled.API.Enums.KeycardPermissions; +using Exiled.Events.EventArgs.Scp049; +using KE.GlobalEventFramework.Examples.API.Feature; namespace KE.GlobalEventFramework.Examples.GE { @@ -20,50 +29,73 @@ namespace KE.GlobalEventFramework.Examples.GE /// Checkpoints can open randomly /// /// - public class SystemMalfunction : GlobalEvent + public class SystemMalfunction : GlobalEvent, IStart, IEvent { /// - public override int Id { get; set; } = 1; + public override uint Id { get; set; } = 1041; /// public override string Name { get; set; } = "System Malfunction"; /// public override string Description { get; set; } = "On dirait que les systèmes informatiques sont défaillants"; /// public override int Weight { get; set; } = 1; + /// + public override uint[] IncompatibleGE { get; set; } = { 38 }; /// /// Set the cooldown for the BlackoutNDoor /// public int NewCooldown { get; set; } = 180; + public static Malfunctions Malfunction { get; private set; } + + + /// - public override IEnumerator Start() + public IEnumerator Start() { - MoreBlackOutNDoors(); - Coroutine.LaunchCoroutine(EarlyNuke()); + Log.Debug("system malfunction start"); + //MoreBlackOutNDoors(); + //Coroutine.LaunchCoroutine(EarlyNuke()); + Coroutine.LaunchCoroutine(Malfunction.Tick()); CoroutineHandle handle; + while(Round.InProgress){ - //todo change so it happen more frequently - Timing.WaitForSeconds((float)Round.ElapsedTime.TotalSeconds); + Log.Debug("system malfunction"); + yield return Timing.WaitForSeconds(UnityEngine.Random.Range(200, 300)); List> l = new []{CheckpointMalfunction(),GateLockdown(),ElevatorLockdown()}.ToList(); handle = Coroutine.LaunchCoroutine(l[UnityEngine.Random.Range(0,3)]); yield return Timing.WaitUntilDone(handle); - } - - + yield return 0; } - public override void UnsubscribeEvent() + + + public void SubscribeEvent() { - var otherPlugin = Exiled.Loader.Loader.Plugins.FirstOrDefault(plugin => plugin.Name == "KE.BlackoutDoor"); + Malfunction = new Malfunctions(); + Exiled.Events.Handlers.Player.Dying += Malfunction.OnDying; + Exiled.Events.Handlers.Scp049.FinishingRecall += Malfunction.OnFinishingRevive; + + + //Searching for the plugin + /*var otherPlugin = Exiled.Loader.Loader.Plugins.FirstOrDefault(plugin => plugin.Name == "KE.BlackoutDoor"); if (otherPlugin != null) { if (otherPlugin is BlackoutNDoor.MainPlugin blackout) { - blackout.ServerHandler.Cooldown = -1; + Log.Info("Found BlackOutNDoors"); + BlackoutNDoor = blackout; + return; } - } + }*/ + } + public void UnsubscribeEvent() + { + Exiled.Events.Handlers.Player.Dying -= Malfunction.OnDying; + Exiled.Events.Handlers.Scp049.FinishingRecall -= Malfunction.OnFinishingRevive; + Malfunction = null; } private IEnumerator EarlyNuke() @@ -75,37 +107,26 @@ private IEnumerator EarlyNuke() Log.Debug($"kaboom"); } - private void MoreBlackOutNDoors() - { - var otherPlugin = Exiled.Loader.Loader.Plugins.FirstOrDefault(plugin => plugin.Name == "KE.BlackoutDoor"); - if (otherPlugin != null) - { - - if (otherPlugin is BlackoutNDoor.MainPlugin blackout) - { - Log.Info("Found BlackOutNDoors"); - blackout.ServerHandler.Cooldown = NewCooldown; - } - - } - } private IEnumerator CheckpointMalfunction(){ - yield return Timing.WaitForSeconds(UnityEngine.Random.Range(20,60)); + Log.Debug("CheckpointMalfunction"); var checkpoints = Door.List.Where(d => d.IsCheckpoint).ToList().RandomItem().IsOpen =true; - + yield return Timing.WaitForSeconds(UnityEngine.Random.Range(20, 60)); + } private IEnumerator GateLockdown(){ + Log.Debug("GateLockdown"); var gates = Door.List.Where(d => d.Type == DoorType.GateA ||d.Type == DoorType.GateB); var gate = gates.GetRandomValue(); - gate.IsOpen = false; + gate.IsOpen = UnityEngine.Random.value <= .5f ? false : true ; var timelock = UnityEngine.Random.Range(10,30); gate.Lock(timelock,DoorLockType.Isolation); yield return Timing.WaitForSeconds(timelock); } private IEnumerator ElevatorLockdown(){ + Log.Debug("ElevatorLockdown"); var lift = Lift.Random; lift.ChangeLock(DoorLockReason.Isolation); yield return Timing.WaitForSeconds(UnityEngine.Random.Range(10,20)); diff --git a/KruacentExiled/KE.GlobalEventFramework.Examples/KE.GlobalEventFramework.Examples.csproj b/KruacentExiled/KE.GlobalEventFramework.Examples/KE.GlobalEventFramework.Examples.csproj index fec6f9e1..8fcf2265 100644 --- a/KruacentExiled/KE.GlobalEventFramework.Examples/KE.GlobalEventFramework.Examples.csproj +++ b/KruacentExiled/KE.GlobalEventFramework.Examples/KE.GlobalEventFramework.Examples.csproj @@ -1,16 +1,18 @@  + 13.0 net48 - + - - + + + @@ -19,4 +21,11 @@ + + if not "$(EXILED_DEV_REFERENCES)"=="" copy /y "$(OutputPath)$(AssemblyName).dll" "$(EXILED_DEV_REFERENCES)\Plugins\" + + + if [[ ! -z "$EXILED_DEV_REFERENCES" ]]; then cp "$(OutputPath)$(AssemblyName).dll" "$EXILED_DEV_REFERENCES/Plugins/"; fi + + diff --git a/KruacentExiled/KE.GlobalEventFramework.Examples/MainPlugin.cs b/KruacentExiled/KE.GlobalEventFramework.Examples/MainPlugin.cs index 4ddeef62..38773e5b 100644 --- a/KruacentExiled/KE.GlobalEventFramework.Examples/MainPlugin.cs +++ b/KruacentExiled/KE.GlobalEventFramework.Examples/MainPlugin.cs @@ -13,14 +13,15 @@ internal class MainPlugin : Plugin public override Version Version => new Version(1, 0, 0); public override string Name => "KE.GEF.Examples"; + public static MainPlugin Instance { get; private set; } public override void OnEnabled() { - + Instance = this; } public override void OnDisabled() { - + Instance = null; } } } diff --git a/KruacentExiled/KE.GlobalEventFramework.Examples/README.md b/KruacentExiled/KE.GlobalEventFramework.Examples/README.md new file mode 100644 index 00000000..abcf2664 --- /dev/null +++ b/KruacentExiled/KE.GlobalEventFramework.Examples/README.md @@ -0,0 +1,15 @@ +# Global Event + +| ID | Global Event | Description | +|--------|-----------------------|--------------------| +| 0 | nothing | y'a r | +| 1041 | System Malfunction | On dirait que les systèmes informatiques sont défaillants | +| 1042 | Speed | Gas! Gas! Gas! | +| 1043 | Random Spawn | Les spawns sont random | +| 1044 | Impostor | Ne vous fiez pas aux apparences ! | +| 1045 | Shuffle | et ça fait roomba café dans le scp | +| 1046 | Blitz | éteignez les lumières la luftwaffe arrive | +| 1047 | KIWIS | Kill It While It's Small | +| 1048 | OpenBar | j'espère que vous avez pas prévu de kampé | +| 1049 | Cassie Go Crazy | Crazy Cassie ! | +| 1050 | Broken Generator | Repair the generator to be able to see !| diff --git a/KruacentExiled/KE.GlobalEventFramework/Config.cs b/KruacentExiled/KE.GlobalEventFramework/Config.cs index 69f7116a..698a7952 100644 --- a/KruacentExiled/KE.GlobalEventFramework/Config.cs +++ b/KruacentExiled/KE.GlobalEventFramework/Config.cs @@ -16,6 +16,8 @@ internal class Config : IConfig public bool Debug { get; set; } = true; [Description("Show the log when the plugin is registering global event (require Debug to be true)")] public bool ShowRegisteringLog { get; set; } = false; + [Description("The chance a global event is not shown and show [REDACTED] instead (0~100)")] + public int ChanceRedacted { get; set; } = 10; } } diff --git a/KruacentExiled/KE.GlobalEventFramework/GEFE/API/Features/GlobalEvent.cs b/KruacentExiled/KE.GlobalEventFramework/GEFE/API/Features/GlobalEvent.cs index 4b525a5e..4fed631c 100644 --- a/KruacentExiled/KE.GlobalEventFramework/GEFE/API/Features/GlobalEvent.cs +++ b/KruacentExiled/KE.GlobalEventFramework/GEFE/API/Features/GlobalEvent.cs @@ -3,18 +3,13 @@ using System.Linq; using MEC; using KE.GlobalEventFramework.GEFE.API.Interfaces; -using Exiled.CustomItems.API.Features; -using System.Reflection; -using Exiled.API.Features.Attributes; -using Exiled.API.Interfaces; -using System.Collections; using System; -using Exiled.API.Extensions; -using Exiled.API.Features.Pools; +using KE.Utils.Display; +using Exiled.Events.Commands.PluginManager; namespace KE.GlobalEventFramework.GEFE.API.Features { - public class GlobalEvent : IGlobalEvent + public abstract class GlobalEvent : IGlobalEvent { /// /// A list of Active GlobalEvents @@ -22,77 +17,198 @@ public class GlobalEvent : IGlobalEvent public static List ActiveGlobalEvents => ActiveGE.ToList(); internal static List ActiveGE { get; set; } = new List(); internal static List coroutineHandles = new List(); - internal static Dictionary GlobalEvents { get; set; } = new Dictionary(); + internal static Dictionary GlobalEvents { get; private set; } = new Dictionary(); /// /// A list of all registered GlobalEvents /// public static List GlobalEventsList => GlobalEvents.Values.ToList(); /// - public virtual int Id { get; set; } = -1; + public abstract uint Id { get; set; } /// - public virtual string Name { get; set; } = "GE NOT SET"; + public abstract string Name { get; set; } /// - public virtual string Description { get; set; } = "DESC NOT SET"; + public abstract string Description { get; set; } /// - public virtual int Weight { get; set; } = 1; + public abstract int Weight { get; set; } + /// + public virtual uint[] IncompatibleGE { get; set; } = new uint[0]; public static void Register(IGlobalEvent globalEvent) { Log.Send($"REGISTERING {globalEvent.Name}", Discord.LogLevel.Info, ConsoleColor.Blue); if (GlobalEvents.ContainsKey(globalEvent.Id)) { - Log.Warn($"id already used for {GlobalEvents.TryGetValue(globalEvent.Id, out IGlobalEvent geAlready)}"); - Log.Warn("Trying to attribute a new id..."); - int key = 0; - while (GlobalEvents.ContainsKey(key)) - { - key++; - } - globalEvent.Id = key; - Log.Warn($"new id of {globalEvent.Name} : {globalEvent.Id}"); + Log.Error($"{globalEvent.Name}'s id is already registered by {Get(globalEvent.Id)}"); + return; } GlobalEvents.Add(globalEvent.Id, globalEvent); Log.Info($"{globalEvent.Name} is registered"); } + public static void Register(List globalEvents) { globalEvents.ForEach(globalEvent => Register(globalEvent)); } - /// - public virtual IEnumerator Start() + + /// + /// Stop all Coroutine from GE + /// + internal static void StopCoroutines() { - Log.Error($"{GetType().Name} Start is NOT overrided"); - yield return Timing.WaitForSeconds(30f); + coroutineHandles.ForEach(coroutineHandle => + { + Timing.KillCoroutines(coroutineHandle); + }); } - /// - public virtual void SubscribeEvent() + + public static bool TryGet(uint id, out IGlobalEvent globalEvent) { - Log.Warn($"{GetType().Name} : SubscribeEvent is NOT overrided"); + globalEvent = Get(id); + return globalEvent != null; } - /// - public virtual void UnsubscribeEvent() + + public static bool TryGet(string name, out IGlobalEvent globalEvent) { - Log.Warn($"{GetType().Name} : UnsubscribeEvent is NOT overrided"); + if (string.IsNullOrEmpty(name)) + { + throw new System.Exception("name can't be null or empty"); + } + globalEvent = uint.TryParse(name, out uint id) ? Get(id) : Get(name); + + return globalEvent != null; } - /// - /// Create new List/Dictionary for the Global Event storage - /// - internal void Clean() + + public static IGlobalEvent Get(string name) { - GlobalEvents = new Dictionary(); - ActiveGE = new List(); + return GlobalEvents.Values.FirstOrDefault(ge => ge.Name == name); } - /// - /// Stop all Coroutine from GE - /// - internal static void StopCoroutines() - { - coroutineHandles.ForEach(coroutineHandle => - { - Timing.KillCoroutines(coroutineHandle); - }); + public static IGlobalEvent Get(uint id) + { + return GlobalEvents.TryGetValue(id, out IGlobalEvent globalEvent) ? globalEvent : null; + } + + private static void Show() + { + var random = UnityEngine.Random.Range(0,101); + + ShowConsole(); + foreach (Player player in Player.List) + { + DisplayPlayer.Get(player).Hint(new (KE.Utils.Display.Enums.HPosition.Center,KE.Utils.Display.Enums.VPosition.GlobalEvent, ShowText(random < MainPlugin.Instance.Config.ChanceRedacted), 10)); + } + } + + private static void ShowConsole() + { + Log.Info($"Global Event(s) ({ActiveGE.Count()}): "); + for (int i = 0; i < ActiveGE.Count(); i++) + { + Log.Info(ActiveGE[i].Name); + } + } + + private static string ShowText(bool redacted = false) + { + string result = "Global Events: "; + for (int i = 0; i < ActiveGE.Count(); i++) + { + if (redacted) + { + result += ActiveGE[i].Description; + } + else + { + result += "[REDACTED]"; + } + + if (ActiveGE.Count() > 1 && i < ActiveGE.Count() - 1) + { + result += ", "; + } + } + + + return result; + } + + public static List ChooseGE(int numberOfGlobalEvent = 1) + { + List activeGE = ChooseRandomGE(numberOfGlobalEvent); + Log.Debug($"activeGE size : {activeGE.Count}"); + + return activeGE; + } + + internal static void ActivateAll() + { + ActivateAll(ActiveGE); + } + + private static void ActivateAll(List globalEvent) + { + if(globalEvent.Count != globalEvent.Distinct().Count()) throw new ArgumentException("You can't have the same GE twice in the same round"); + ActiveGE = globalEvent; + + foreach (IGlobalEvent ge in ActiveGE) + { + if(ge is IEvent geEvent) + { + Log.Debug($"{ge.Name} implements IEvent, subscribing events"); + geEvent.SubscribeEvent(); + } + + if(ge is IStart geStart) + { + Log.Debug($"{ge.Name} implements IStart, starting"); + CoroutineHandle a = Timing.RunCoroutine(geStart.Start()); + coroutineHandles.Add(a); + } + + } + Show(); + } + + + internal static void DeactivateAll() + { + foreach(IGlobalEvent ge in ActiveGE) + { + if (ge is IEvent geEvent) + { + geEvent.UnsubscribeEvent(); + } + } + } + + private static List ChooseRandomGE(int nbGE = 1) + { + List result = new List(); + + List weightedPool = new List(); + foreach (IGlobalEvent ge in GlobalEvent.GlobalEventsList) + { + for (int i = 0; i < ge.Weight; i++) + { + weightedPool.Add(ge); + Log.Debug($"getochoose : {ge.Name} "); + } + } + + nbGE = Math.Min(nbGE, GlobalEvent.GlobalEventsList.Count); + + for (int i = 0; i < nbGE; i++) + { + int randomIndex = UnityEngine.Random.Range(0, weightedPool.Count); + IGlobalEvent selectedGE = weightedPool[randomIndex]; + + result.Add(selectedGE); + + weightedPool.RemoveAll(e => e == selectedGE); + weightedPool.RemoveAll(e => selectedGE.IncompatibleGE.Contains(e.Id)); + } + return result; } } } diff --git a/KruacentExiled/KE.GlobalEventFramework/GEFE/API/Features/Loader.cs b/KruacentExiled/KE.GlobalEventFramework/GEFE/API/Features/Loader.cs index 60747cd3..191b21c5 100644 --- a/KruacentExiled/KE.GlobalEventFramework/GEFE/API/Features/Loader.cs +++ b/KruacentExiled/KE.GlobalEventFramework/GEFE/API/Features/Loader.cs @@ -19,22 +19,17 @@ internal void Load() { foreach (IPlugin plugin in Exiled.Loader.Loader.Plugins.Where(pl => pl.Name != MainPlugin.Instance.Name)) { - Log.Debug($"checking {plugin.Name}"); + if(MainPlugin.Instance.Config.ShowRegisteringLog) Log.Debug($"checking {plugin.Name}"); foreach (Type type in plugin.Assembly.GetTypes()) { try { - Log.Debug($" checking {type.Name}"); + if (MainPlugin.Instance.Config.ShowRegisteringLog) Log.Debug($" checking {type.Name}"); if (type.IsSubclassOf(typeof(IGlobalEvent)) || type.IsSubclassOf(typeof(GlobalEvent))) - { - Log.Debug("good"); + { ActivePlugins.Add(plugin); - - Log.Debug("creating instance"); IGlobalEvent ge = Activator.CreateInstance(type) as IGlobalEvent; - Log.Debug("registering"); GlobalEvent.Register(ge); - Log.Debug("end register"); } }catch(System.Exception e) { diff --git a/KruacentExiled/KE.GlobalEventFramework/GEFE/API/Interfaces/IEvent.cs b/KruacentExiled/KE.GlobalEventFramework/GEFE/API/Interfaces/IEvent.cs new file mode 100644 index 00000000..55b20279 --- /dev/null +++ b/KruacentExiled/KE.GlobalEventFramework/GEFE/API/Interfaces/IEvent.cs @@ -0,0 +1,20 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace KE.GlobalEventFramework.GEFE.API.Interfaces +{ + public interface IEvent + { + /// + /// The method used to subcribe to event like with normal plugins + /// + void SubscribeEvent(); + /// + /// The method used to unsubcribe to event like with normal plugins + /// + void UnsubscribeEvent(); + } +} diff --git a/KruacentExiled/KE.GlobalEventFramework/GEFE/API/Interfaces/IGlobalEvent.cs b/KruacentExiled/KE.GlobalEventFramework/GEFE/API/Interfaces/IGlobalEvent.cs index 15dfce21..79e83933 100644 --- a/KruacentExiled/KE.GlobalEventFramework/GEFE/API/Interfaces/IGlobalEvent.cs +++ b/KruacentExiled/KE.GlobalEventFramework/GEFE/API/Interfaces/IGlobalEvent.cs @@ -12,7 +12,7 @@ public interface IGlobalEvent /// /// the UNIQUE id of the Global Event /// - int Id { get; set; } + uint Id { get; set; } /// /// Name used in the logs on the RA /// @@ -27,18 +27,13 @@ public interface IGlobalEvent /// The chance this GE will be choosed at the start of a round /// int Weight { get; set; } - - /// - /// Is launched at the start of a round - /// - IEnumerator Start(); - /// - /// The method used to subcribe to event like with normal plugins - /// - void SubscribeEvent(); /// - /// The method used to unsubcribe to event like with normal plugins + /// The ids of incompatible Globals Events + /// Note: You can't have the same GE twice in the same round /// - void UnsubscribeEvent(); + uint[] IncompatibleGE { get; set; } + + + } } diff --git a/KruacentExiled/KE.GlobalEventFramework/GEFE/API/Interfaces/IStart.cs b/KruacentExiled/KE.GlobalEventFramework/GEFE/API/Interfaces/IStart.cs new file mode 100644 index 00000000..b3f00fad --- /dev/null +++ b/KruacentExiled/KE.GlobalEventFramework/GEFE/API/Interfaces/IStart.cs @@ -0,0 +1,16 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace KE.GlobalEventFramework.GEFE.API.Interfaces +{ + public interface IStart + { + /// + /// Is launched at the start of a round + /// + IEnumerator Start(); + } +} diff --git a/KruacentExiled/KE.GlobalEventFramework/GEFE/Commands/ForceGE.cs b/KruacentExiled/KE.GlobalEventFramework/GEFE/Commands/ForceGE.cs new file mode 100644 index 00000000..80c701eb --- /dev/null +++ b/KruacentExiled/KE.GlobalEventFramework/GEFE/Commands/ForceGE.cs @@ -0,0 +1,65 @@ +namespace KE.GlobalEventFramework.GEFE.Commands +{ + using Exiled.API.Features; + using Exiled.API.Features.Pickups; + using System; + using CommandSystem; + using System.Runtime.InteropServices.WindowsRuntime; + using GEFE.API.Interfaces; + using GEFE.API.Features; + using System.Collections.Generic; + using System.Linq; + + public class ForceGE : ICommand + { + public string Command { get; } = "force"; + public string[] Aliases { get; } = new string[] { "f" }; + public string Description { get; } = "force a or multiple global event"; + internal static List ForcedGE = new List(); + + public bool Execute(ArraySegment arguments, ICommandSender sender, out string response) + { + if (!Round.IsLobby) + { + response = "You can only force a global event in the lobby"; + ForcedGE = new List(); + return false; + } + + if (!GlobalEvent.TryGet(arguments.At(0), out IGlobalEvent ge1) || ge1 == null) + { + response = $"Global event ({arguments.At(0)}) not found "; + ForcedGE = new IGlobalEvent[] { ge1 }.ToList(); + return false; + } + + + + if (arguments.Count == 1) + { + response = $"Forcing {ge1.Name}"; + ForcedGE = new IGlobalEvent[] { ge1 }.ToList(); + return true; + } + + if (!GlobalEvent.TryGet(arguments.At(1), out IGlobalEvent ge2) || ge2 == null) + { + response = $"Global event ({arguments.At(1)}) not found "; + ForcedGE = new List(); + return false; + } + + if (arguments.Count == 2) + { + response = $"Forcing {ge1.Name} & {ge2.Name}"; + ForcedGE = new IGlobalEvent[] { ge1, ge2 }.ToList(); + return true; + } + + ForcedGE = new List(); + response = ""; + return false; + + } + } +} diff --git a/KruacentExiled/KE.GlobalEventFramework/GEFE/Commands/ForceNbGE.cs b/KruacentExiled/KE.GlobalEventFramework/GEFE/Commands/ForceNbGE.cs new file mode 100644 index 00000000..e5e5fe94 --- /dev/null +++ b/KruacentExiled/KE.GlobalEventFramework/GEFE/Commands/ForceNbGE.cs @@ -0,0 +1,61 @@ +namespace KE.GlobalEventFramework.GEFE.Commands +{ + using Exiled.API.Features; + using Exiled.API.Features.Pickups; + using System; + using CommandSystem; + using System.Runtime.InteropServices.WindowsRuntime; + using GEFE.API.Interfaces; + using GEFE.API.Features; + using System.Collections.Generic; + using System.Linq; + + public class ForceNbGE : ICommand + { + public string Command { get; } = "forceNb"; + public string[] Aliases { get; } = new string[] { "nb","n" }; + public string Description { get; } = "force a specified number global event"; + internal static int NbGE = -1; + + public bool Execute(ArraySegment arguments, ICommandSender sender, out string response) + { + if (!Round.IsLobby) + { + response = "You can only force a global event in the lobby"; + NbGE = -1; + return false; + } + + + + if (arguments.Count == 1) + { + if (int.TryParse(arguments.At(0), out int nbge) && nbge > -1) + { + if(nbge <= 0) + { + response = "You can't force 0 global event"; + NbGE = -1; + return false; + } + if(nbge > GlobalEvent.GlobalEventsList.Count) + { + response = $"You can't force {nbge} global event, there are only {GlobalEvent.GlobalEventsList.Count} global events"; + NbGE = -1; + return false; + } + + + response = $"Forcing {nbge} global event"; + NbGE = nbge; + return true; + } + } + + NbGE = -1; + response = "Too much argument"; + return false; + + } + } +} diff --git a/KruacentExiled/KE.GlobalEventFramework/GEFE/Commands/List.cs b/KruacentExiled/KE.GlobalEventFramework/GEFE/Commands/ListGE.cs similarity index 93% rename from KruacentExiled/KE.GlobalEventFramework/GEFE/Commands/List.cs rename to KruacentExiled/KE.GlobalEventFramework/GEFE/Commands/ListGE.cs index 11764b19..0119db18 100644 --- a/KruacentExiled/KE.GlobalEventFramework/GEFE/Commands/List.cs +++ b/KruacentExiled/KE.GlobalEventFramework/GEFE/Commands/ListGE.cs @@ -8,7 +8,7 @@ using GEFE.API.Interfaces; using GEFE.API.Features; - public class List : ICommand + public class ListGE : ICommand { public string Command { get; } = "list"; public string[] Aliases { get; } = new string[] { "l", "ls" }; @@ -16,7 +16,7 @@ public class List : ICommand public bool Execute(ArraySegment arguments, ICommandSender sender, out string response) { - string result = "List of all global event ([o] if it's active in the round ; [ ] otherwise) : "; + string result = "List of all global event ([o] if it's active in the round ; [ ] otherwise) : \n"; foreach (IGlobalEvent ge in GlobalEvent.GlobalEvents.Values) { diff --git a/KruacentExiled/KE.GlobalEventFramework/GEFE/Commands/ParentCommandGEFE.cs b/KruacentExiled/KE.GlobalEventFramework/GEFE/Commands/ParentCommandGEFE.cs index 1b8f3830..1134260a 100644 --- a/KruacentExiled/KE.GlobalEventFramework/GEFE/Commands/ParentCommandGEFE.cs +++ b/KruacentExiled/KE.GlobalEventFramework/GEFE/Commands/ParentCommandGEFE.cs @@ -17,13 +17,15 @@ public ParentCommandGEFE() public override void LoadGeneratedCommands() { - RegisterCommand(new List()); + RegisterCommand(new ListGE()); + RegisterCommand(new ForceGE()); + RegisterCommand(new ForceNbGE()); } protected override bool ExecuteParent(ArraySegment arguments, ICommandSender sender, out string response) { if(arguments.Count == 0){ - response = "subcommand available : list"; + response = "subcommand available : list, force, nb"; return true; } response = ""; diff --git a/KruacentExiled/KE.GlobalEventFramework/GEFE/Handlers/ServerHandler.cs b/KruacentExiled/KE.GlobalEventFramework/GEFE/Handlers/ServerHandler.cs index 38e3b9cc..2a827f49 100644 --- a/KruacentExiled/KE.GlobalEventFramework/GEFE/Handlers/ServerHandler.cs +++ b/KruacentExiled/KE.GlobalEventFramework/GEFE/Handlers/ServerHandler.cs @@ -3,27 +3,51 @@ using System.Collections.Generic; using KE.GlobalEventFramework.GEFE.API.Interfaces; using KE.GlobalEventFramework.GEFE.API.Features; +using KE.GlobalEventFramework.GEFE.Commands; namespace KE.GlobalEventFramework.GEFE.Handlers { internal class ServerHandler { - MainPlugin _plugin; - List _activeGE; - public ServerHandler(MainPlugin mainPlugin) - { - this._plugin = mainPlugin; - } public void OnRoundStarted() { - Log.Debug("starting round"); - - _activeGE = _plugin.ChooseGE(UnityEngine.Random.value < .1f ? 2 : 1); - Log.Debug("sub event"); - _activeGE.ForEach(e => e.SubscribeEvent()); - Log.Debug("show to player"); - _plugin.Show(); - Log.Debug("end starting round"); + Log.Debug("starting round"); + HandleCommands(); + + + GlobalEvent.ActivateAll(); + } + + private void HandleCommands() + { + //force ge + if (ForceGE.ForcedGE.Count > 0) + { + Log.Debug("forcing ge"); + GlobalEvent.ActiveGE = ForceGE.ForcedGE; + ForceGE.ForcedGE = new List(); + } + else + { + int nbGE; + + //choose nb of ge + if (ForceNbGE.NbGE > -1) + { + nbGE = ForceNbGE.NbGE; + Log.Debug($"forcing nb ge = {nbGE}"); + ForceNbGE.NbGE = -1; + } + //normal case + else + { + Log.Debug($"no commands"); + nbGE = UnityEngine.Random.value < .1f ? 2 : 1; + } + GlobalEvent.ActiveGE = GlobalEvent.ChooseGE(nbGE); + } + + } public void OnWaitingForPlayers() @@ -34,12 +58,12 @@ public void OnWaitingForPlayers() public void OnEndingRound(RoundEndedEventArgs _) { Log.Debug("ending round"); - _activeGE.ForEach(e => e.UnsubscribeEvent()); + GlobalEvent.DeactivateAll(); } public void OnRestartingRound() { Log.Debug("restarting"); - _activeGE.ForEach(e => e.UnsubscribeEvent()); + GlobalEvent.DeactivateAll(); } } diff --git a/KruacentExiled/KE.GlobalEventFramework/KE.GlobalEventFramework.csproj b/KruacentExiled/KE.GlobalEventFramework/KE.GlobalEventFramework.csproj index 8031db85..58ae1660 100644 --- a/KruacentExiled/KE.GlobalEventFramework/KE.GlobalEventFramework.csproj +++ b/KruacentExiled/KE.GlobalEventFramework/KE.GlobalEventFramework.csproj @@ -1,17 +1,29 @@  + 13.0 net48 - + - - - + + + + + + + + + if not "$(EXILED_DEV_REFERENCES)"=="" copy /y "$(OutputPath)$(AssemblyName).dll" "$(EXILED_DEV_REFERENCES)\Plugins\" + + + if [[ ! -z "$EXILED_DEV_REFERENCES" ]]; then cp "$(OutputPath)$(AssemblyName).dll" "$EXILED_DEV_REFERENCES/Plugins/"; fi + + diff --git a/KruacentExiled/KE.GlobalEventFramework/MainPlugin.cs b/KruacentExiled/KE.GlobalEventFramework/MainPlugin.cs index b4dbcc8e..2e0f96f4 100644 --- a/KruacentExiled/KE.GlobalEventFramework/MainPlugin.cs +++ b/KruacentExiled/KE.GlobalEventFramework/MainPlugin.cs @@ -8,6 +8,7 @@ using KE.GlobalEventFramework.GEFE.API.Features; using KE.GlobalEventFramework.GEFE.API.Interfaces; using ServerHandler = Exiled.Events.Handlers.Server; +using Discord; namespace KE.GlobalEventFramework { internal class MainPlugin : Plugin @@ -44,7 +45,7 @@ public override void OnDisabled() private void RegisterEvents() { - _server = new GEFE.Handlers.ServerHandler(this); + _server = new GEFE.Handlers.ServerHandler(); ServerHandler.WaitingForPlayers += _server.OnWaitingForPlayers; @@ -64,93 +65,7 @@ private void UnregisterEvents() _server = null; } - public void Show() - { - var random = UnityEngine.Random.value; - - foreach (Player player in Player.List) - { - Exiled.API.Features.Broadcast b = new Exiled.API.Features.Broadcast - { - Content = ShowText(random > .5f), - Duration = 10 - }; - player.Broadcast(b); - } - } - - private String ShowText(bool redacted = false) - { - String result = "Global Events: "; - for (int i = 0; i < GlobalEvent.ActiveGE.Count(); i++) - { - - - if (redacted) - { - result += GlobalEvent.ActiveGE[i].Description; - } - else - { - result += "[REDACTED]"; - } - - if (GlobalEvent.ActiveGE.Count() > 1 && i < GlobalEvent.ActiveGE.Count()-1) - { - result += ","; - } - } - - - return result; - } - - public List ChooseGE(int numberOfGlobalEvent = 1) - { - List activeGE = ChooseRandomGE(numberOfGlobalEvent); - Log.Debug($"activeGE size : {activeGE.Count}"); - Log.Info($"Global Event(s) ({numberOfGlobalEvent}): "); - - foreach (IGlobalEvent ge in activeGE) - { - Log.Info(ge.Name); - var a = Timing.RunCoroutine(ge.Start()); - GlobalEvent.coroutineHandles.Add(a); //crash when using other ge from other assembly - } - return activeGE; - } - - private List ChooseRandomGE(int nbGE = 1) - { - List result = new List(); - - List weightedPool = new List(); - foreach (IGlobalEvent ge in GlobalEvent.GlobalEventsList) - { - for (int i = 0; i < ge.Weight; i++) - { - weightedPool.Add(ge); - Log.Debug($"getochoose : {ge.Name} "); - } - } - - nbGE = Math.Min(nbGE, GlobalEvent.GlobalEventsList.Count); - - for (int i = 0; i < nbGE; i++) - { - int randomIndex = UnityEngine.Random.Range(0, weightedPool.Count); - IGlobalEvent selectedGE = weightedPool[randomIndex]; - - result.Add(selectedGE); - - weightedPool.RemoveAll(e => e == selectedGE); - } - - // Step 3: Update the active global events - GlobalEvent.ActiveGE = result.ToList(); - - return result; - } + } diff --git a/KruacentExiled/KE.GlobalEventFramework/README.md b/KruacentExiled/KE.GlobalEventFramework/README.md new file mode 100644 index 00000000..f0db31fc --- /dev/null +++ b/KruacentExiled/KE.GlobalEventFramework/README.md @@ -0,0 +1,122 @@ +# How to Create a Global Event + +This guide explains how to create a custom Global Event using the KE.GlobalEventFramework. A Global Event is a feature that introduces unique gameplay mechanics or effects during a round in SCP: Secret Laboratory. + +## Prerequisites +1. **Knowledge of C#**: Basic understanding of C#. +2. **Exiled Framework**: Knowledge about the Exiled API is recommended. + +--- + +## Step 1: Create a Class for the Global Event +Each Global Event must inherit from the `GlobalEvent` base class provided by the framework. + +### Example: +```csharp +using KE.GlobalEventFramework.GEFE.API.Features; + +namespace MyPlugin.GlobalEvents +{ + public class ExampleEvent : GlobalEvent + { + public override uint Id { get; set; } = 1234; + public override string Name { get; set; } = "ExampleEvent"; + public override string Description { get; set; } = "This is a sample global event."; + public override int Weight { get; set; } = 1; + } +} +``` + +- Id: A unique identifier for your event. +- Name: The name of your event. +- Description: A short description of the event. (displayed to player when the round start) +- Weight: The likelihood of this event being chosen compared to others. + +## Step 2: Implement Interfaces for Functionality +Global Events can implement additional interfaces to define behavior : +- IStart: Defines behavior when the event starts. +- IEvent: Handles event subscriptions. + +### Example with IStart: +```csharp +using System.Collections.Generic; +using MEC; + +public class ExampleEvent : GlobalEvent, IStart +{ + public IEnumerator Start() + { + // Code to execute when the event starts + yield return Timing.WaitForSeconds(1); + Log.Info("ExampleEvent has started!"); + } +} +``` + +### Example with IEvent: +```csharp +using Exiled.Events.EventArgs.Player; + +public class ExampleEvent : GlobalEvent, IEvent +{ + public void SubscribeEvent() + { + Exiled.Events.Handlers.Player.Hurting += OnPlayerHurt; + } + + public void UnsubscribeEvent() + { + Exiled.Events.Handlers.Player.Hurting -= OnPlayerHurt; + } + + private void OnPlayerHurt(HurtingEventArgs ev) + { + // Example effect: reduce all damage by half + ev.Amount /= 2; + } +} +``` + +## Step 3: Define Custom Behavior +You can add custom properties and methods to define the unique behavior of your Global Event. + +### Example: Opening All Doors +```csharp +using Exiled.API.Features.Doors; +using System.Linq; + +private void OpenAllDoors() +{ + Door.List.ToList().ForEach(door => + { + door.IsOpen = true; + }); +} +``` +You can call this method in your Start implementation or in your subscribed events. + +## Step 4: Handle Cleanup +It is essential to clean up your event's effects when it ends. This can be done in the UnsubscribeEvent method. + +### Exemple +```csharp +public void UnsubscribeEvent() +{ + Player.List.ToList().ForEach(player => player.DisableEffect()); +} +``` + +## Step 5: Test Your Event +- Compile your plugin and place the .dll file in the Plugins folder in EXILED folder. +- Configure your event to ensure it's loaded by the framework. +- Test the event in a controlled environment to verify its behavior. + +## Additional information +- Use IncompatibleGE to prevent certain events from running simultaneously. +```csharp +public override uint[] IncompatibleGE { get; set; } = { 101, 102 }; +``` + +- Leverage Exiled's logging system (Log.Info, Log.Error) for debugging. +- Refer to the [Exiled Repository](https://github.com/ExMod-Team/EXILED/tree/master/EXILED) for more information on available APIs. +- [Example of Global Event](https://github.com/Kruacent/Kruacent-Exiled/tree/GlobalEvent/KruacentExiled/KE.GlobalEventFramework.Examples/GE) diff --git a/KruacentExiled/KE.Items/Config.cs b/KruacentExiled/KE.Items/Config.cs index daaf9357..5e8354e8 100644 --- a/KruacentExiled/KE.Items/Config.cs +++ b/KruacentExiled/KE.Items/Config.cs @@ -11,5 +11,9 @@ public class Config : IConfig { public bool IsEnabled { get; set; } = true; public bool Debug { get; set; } = false; + public float LightRefreshRate { get; set; } = .01f; + public float ModelRefreshRate { get; set; } = .1f; + public string SoundLocation { get; set; } = "C:\\Users\\Patrique\\AppData\\Roaming\\EXILED\\Plugins\\audio"; + public int Position { get; set; } = 300; } } diff --git a/KruacentExiled/KE.Items/Core/Lights/LightsHandler.cs b/KruacentExiled/KE.Items/Core/Lights/LightsHandler.cs new file mode 100644 index 00000000..f6f9a30c --- /dev/null +++ b/KruacentExiled/KE.Items/Core/Lights/LightsHandler.cs @@ -0,0 +1,37 @@ +using Exiled.CustomItems.API.Features; +using InventorySystem.Items.Pickups; +using KE.Items.Interface; +using KE.Utils.API.Interfaces; +using LabApi.Features.Wrappers; + +namespace KE.Items.Core.Lights +{ + internal class LightsHandler : IUsingEvents + { + public float Intensity { get; set; } = .5f; + public void SubscribeEvents() + { + ItemPickupBase.OnPickupAdded += AddPickup; + } + + public void UnsubscribeEvents() + { + ItemPickupBase.OnPickupAdded -= AddPickup; + } + + + private void AddPickup(ItemPickupBase pickup) + { + if (CustomItem.TryGet(Exiled.API.Features.Pickups.Pickup.Get(pickup), out CustomItem item) && item is ILumosItem li) + { + + var l = LightSourceToy.Create(pickup.transform, false); + l.Color = li.Color; + l.Intensity = Intensity; + + l.Spawn(); + } + + } + } +} diff --git a/KruacentExiled/KE.Items/Core/Settings/SettingsHandler.cs b/KruacentExiled/KE.Items/Core/Settings/SettingsHandler.cs new file mode 100644 index 00000000..61bfaa1d --- /dev/null +++ b/KruacentExiled/KE.Items/Core/Settings/SettingsHandler.cs @@ -0,0 +1,100 @@ +using Exiled.API.Features; +using Exiled.API.Features.Core.UserSettings; +using KE.Utils.API.Interfaces; +using KE.Utils.Quality.Enums; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Runtime; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; +using System.Runtime.Remoting.Messaging; +using System.Text; +using System.Threading.Tasks; +using UserSettings.ServerSpecific; + +namespace KE.Items.Core.Settings +{ + internal class SettingsHandler : IUsingEvents + { + + private SettingBase[] _settings; + private const int _idHeader = 55; + private const int _idDesc = 0; + private const int _idPrefix = 1; + private const int _idTimeCustomItem = 2; + private const int _idTimeCustomItemEffect = 3; + + + + private void CreateSettings() + { + + _settings = + [ + new HeaderSetting (_idHeader,"Custom Items Settings"), + new TwoButtonsSetting(_idDesc,"Descriptions","Disabled","Enabled",true,"hide/show the description of the item and its upgrade chances ", onChanged:OnChanged), + new TwoButtonsSetting(_idPrefix,"Pickup/Select prefixes","Disabled","Enabled",false,"show/hide the whole sentence for the picking or selecting of the item, if hidden it will show a (P) if pickup or a (I) if in inventory before the name of the item ", onChanged:OnChanged), + new SliderSetting(_idTimeCustomItem,"Time shown",0,30,10), + new SliderSetting(_idTimeCustomItemEffect,"Time effect shown",0,30,10), + + ]; + SettingBase.Register(_settings); + + } + + + public void SubscribeEvents() + { + CreateSettings(); + SettingBase.SendToAll(); + } + + public void UnsubscribeEvents() + { + SettingBase.Unregister(); + } + + + private void OnChanged(Player p, SettingBase settings) + { + + } + + + + internal float GetTime(Player p) + { + if (!SettingBase.TryGetSetting(p, _idTimeCustomItem, out var setting)) return 10; + return setting.SliderValue; + } + + internal float GetTimeEffect(Player p) + { + if (!SettingBase.TryGetSetting(p, _idTimeCustomItemEffect, out var setting)) return 10; + return setting.SliderValue; + } + + /// + /// + /// + /// + /// true if the player wants description ; false otherwise + internal bool GetDescriptionsSettings(Player p) + { + if (!SettingBase.TryGetSetting(p, _idDesc, out var setting)) return true; + return setting.IsSecond; + } + + /// + /// + /// + /// + /// true if the player wants prefixes ; false otherwise + internal bool GetPrefixes(Player p) + { + if (!SettingBase.TryGetSetting(p, _idPrefix, out var setting)) return false; + return setting.IsSecond; + } + } +} diff --git a/KruacentExiled/KE.Items/Core/Upgrade/UpgradeHandler.cs b/KruacentExiled/KE.Items/Core/Upgrade/UpgradeHandler.cs new file mode 100644 index 00000000..54776eaf --- /dev/null +++ b/KruacentExiled/KE.Items/Core/Upgrade/UpgradeHandler.cs @@ -0,0 +1,82 @@ +using Exiled.API.Features; +using Exiled.API.Features.Items; +using Exiled.CustomItems.API.Features; +using Exiled.Events.EventArgs.Scp914; +using KE.Items.Interface; +using KE.Utils.API.Interfaces; +using Scp914; + +namespace KE.Items.Core.Upgrade +{ + internal class UpgradeHandler : IUsingEvents + { + + public void SubscribeEvents() + { + Exiled.Events.Handlers.Scp914.UpgradingInventoryItem += UpgradeItem; + Exiled.Events.Handlers.Scp914.UpgradingPickup += UpgradePickUp; + } + + public void UnsubscribeEvents() + { + Exiled.Events.Handlers.Scp914.UpgradingInventoryItem -= UpgradeItem; + Exiled.Events.Handlers.Scp914.UpgradingPickup -= UpgradePickUp; + } + + + private void UpgradeItem(UpgradingInventoryItemEventArgs ev) + { + if (!CustomItem.TryGet(ev.Item, out CustomItem ci)) return; + if (!(ci is IUpgradableCustomItem upgradable)) return; + Log.Debug("upgrading item"); + if (UpgradeCheck(upgradable, ev.KnobSetting)) + { + Log.Debug("success"); + var newItemid = upgradable.Upgrade[ev.KnobSetting].UpgradedItem; + + CustomItem newItem = CustomItem.Get(newItemid); + + ev.Player.RemoveItem(ev.Item); + newItem?.Give(ev.Player); + if (newItem == null) Log.Warn("warning id of custom item not found"); + + } + ev.IsAllowed = false; + } + + private void UpgradePickUp(UpgradingPickupEventArgs ev) + { + + if (!CustomItem.TryGet(ev.Pickup, out CustomItem ci)) return; + if (!(ci is IUpgradableCustomItem upgradable)) return; + Log.Debug("upgrading pickup"); + + if (UpgradeCheck(upgradable, ev.KnobSetting)) + { + Log.Debug("success"); + var newItemid = upgradable.Upgrade[ev.KnobSetting].UpgradedItem; + + CustomItem newItem = CustomItem.Get(newItemid); + + ev.Pickup.Destroy(); + newItem.Spawn(ev.OutputPosition); + if (newItem == null) Log.Warn("warning id of custom item not found"); + } + + ev.IsAllowed = false; + } + + private bool UpgradeCheck(IUpgradableCustomItem upgradable, Scp914KnobSetting knob) + { + if (!upgradable.Upgrade.TryGetValue(knob, out UpgradeProperties item)) return false; + if (MainPlugin.Instance.Config.Debug) + { + return true; + } + float random = UnityEngine.Random.Range(0f, 100f); + if (random < item.Chance) return true; + return false; + } + + } +} diff --git a/KruacentExiled/KE.Items/Core/Upgrade/UpgradeProperties.cs b/KruacentExiled/KE.Items/Core/Upgrade/UpgradeProperties.cs new file mode 100644 index 00000000..75278fa9 --- /dev/null +++ b/KruacentExiled/KE.Items/Core/Upgrade/UpgradeProperties.cs @@ -0,0 +1,35 @@ +using Exiled.CustomItems.API.Features; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Runtime.ExceptionServices; +using System.Text; +using System.Threading.Tasks; +using YamlDotNet.Core.Tokens; + +namespace KE.Items.Core.Upgrade +{ + public class UpgradeProperties + { + private float _chance; + public float Chance + { + get { return _chance; } + } + + private uint _newItem; + public uint UpgradedItem + { + get { return _newItem; } + } + + public UpgradeProperties(float chance, uint newItem) + { + _newItem = newItem; + if (chance > 100) _chance = 100; + else if (chance < 0) _chance = 0; + else _chance = chance; + } + + } +} diff --git a/KruacentExiled/KE.Items/Extensions/PlayerExtensions.cs b/KruacentExiled/KE.Items/Extensions/PlayerExtensions.cs new file mode 100644 index 00000000..9f10f9e4 --- /dev/null +++ b/KruacentExiled/KE.Items/Extensions/PlayerExtensions.cs @@ -0,0 +1,19 @@ +using Exiled.API.Features; +using KE.Items.Features; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace KE.Items.Extensions +{ + public static class PlayerExtensions + { + + public static void ItemEffectHint(this Player player, string text) + { + KECustomItem.ItemEffectHint(player, text); + } + } +} diff --git a/KruacentExiled/KE.Items/Features/KECustomGrenade.cs b/KruacentExiled/KE.Items/Features/KECustomGrenade.cs new file mode 100644 index 00000000..4c1c834d --- /dev/null +++ b/KruacentExiled/KE.Items/Features/KECustomGrenade.cs @@ -0,0 +1,42 @@ +using Exiled.API.Features; +using Exiled.CustomItems.API.Features; +using Exiled.Events.EventArgs.Map; +using Exiled.Events.EventArgs.Player; + +namespace KE.Items.Features +{ + public abstract class KECustomGrenade : CustomGrenade + { + public virtual float DamageModifier { get; set; } = 1f; + + + protected override void SubscribeEvents() + { + + Exiled.Events.Handlers.Player.Hurting += InternalOnHurting; + base.SubscribeEvents(); + } + + protected override void UnsubscribeEvents() + { + Exiled.Events.Handlers.Player.Hurting -= InternalOnHurting; + base.UnsubscribeEvents(); + } + + + protected void InternalOnHurting(HurtingEventArgs ev) + { + + } + + protected override void ShowPickedUpMessage(Player player) + { + KECustomItem.Message(this, player, true); + } + + protected override void ShowSelectedMessage(Player player) + { + KECustomItem.Message(this, player); + } + } +} diff --git a/KruacentExiled/KE.Items/Features/KECustomItem.cs b/KruacentExiled/KE.Items/Features/KECustomItem.cs new file mode 100644 index 00000000..5a66008f --- /dev/null +++ b/KruacentExiled/KE.Items/Features/KECustomItem.cs @@ -0,0 +1,92 @@ +using Exiled.API.Features; +using Exiled.CustomItems.API.Features; +using MHints = HintServiceMeow.Core.Models.Hints.Hint; +using KE.Items.Interface; +using System.Text; +using KE.Utils.API.Displays.DisplayMeow; +using MEC; +using HintServiceMeow.Core.Extension; +using HintServiceMeow.Core.Utilities; +using System.Reflection; + +namespace KE.Items.Features +{ + public abstract class KECustomItem : CustomItem + { + + protected override void ShowPickedUpMessage(Player player) + { + Message(this, player, true); + } + + protected override void ShowSelectedMessage(Player player) + { + Message(this, player); + } + + + internal static void Message(CustomItem c, Player player, bool pickedUp = false) + { + + + + StringBuilder builder = new(); + + if (MainPlugin.Instance.SettingsHandler.GetPrefixes(player)) + { + if (pickedUp) + { + builder.Append("(P)"); + } + else + { + builder.Append("(I)"); + } + } + else + { + if (pickedUp) + { + builder.Append("You've picked up "); + } + else + { + builder.Append("You've selected "); + } + } + + builder.AppendLine($"{c.Name}"); + if (MainPlugin.Instance.SettingsHandler.GetDescriptionsSettings(player)) + { + builder.AppendLine(c.Description); + if (c is IUpgradableCustomItem ci) + { + foreach (var a in ci.Upgrade) + { + builder.AppendLine($"{c.Name}"); + } + } + + } + + + float delay = MainPlugin.Instance.SettingsHandler.GetTime(player); + DisplayHandler.Instance.AddHint(MainPlugin.HintPlacement, player, builder.ToString(), delay); + + + } + + + + + public static void ItemEffectHint(Player player, string text) + { + float delay = MainPlugin.Instance.SettingsHandler.GetTimeEffect(player); + + + DisplayHandler.Instance.AddHint(MainPlugin.ItemEffectPlacement, player, text, delay); + } + + + } +} diff --git a/KruacentExiled/KE.Items/Interface/CustomItemEffect.cs b/KruacentExiled/KE.Items/Interface/CustomItemEffect.cs new file mode 100644 index 00000000..f8e22c94 --- /dev/null +++ b/KruacentExiled/KE.Items/Interface/CustomItemEffect.cs @@ -0,0 +1,23 @@ +using Exiled.API.Features; +using Exiled.CustomItems.API.Features; +using Exiled.Events.EventArgs.Map; +using Exiled.Events.EventArgs.Player; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Net.Sockets; +using System.Text; +using System.Threading.Tasks; + +namespace KE.Items.Interface +{ + public abstract class CustomItemEffect + { + public abstract void Effect(UsedItemEventArgs ev); + + public abstract void Effect(ExplodingGrenadeEventArgs ev); + + public abstract void Effect(DroppingItemEventArgs ev); + + } +} diff --git a/KruacentExiled/KE.Items/Interface/ICustomPickupModel.cs b/KruacentExiled/KE.Items/Interface/ICustomPickupModel.cs new file mode 100644 index 00000000..eb9bad0a --- /dev/null +++ b/KruacentExiled/KE.Items/Interface/ICustomPickupModel.cs @@ -0,0 +1,17 @@ +using Exiled.API.Features.Toys; +using KE.Items.Items.PickupModels; +using KE.Utils.API.Models.Blueprints; +using KE.Utils.Quality.Models; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace KE.Items.Interface +{ + public interface ICustomPickupModel + { + public PickupModel PickupModel { get; } + } +} diff --git a/KruacentExiled/KE.Items/Interface/ISwichableEffect.cs b/KruacentExiled/KE.Items/Interface/ISwichableEffect.cs new file mode 100644 index 00000000..f2717159 --- /dev/null +++ b/KruacentExiled/KE.Items/Interface/ISwichableEffect.cs @@ -0,0 +1,13 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace KE.Items.Interface +{ + public interface ISwichableEffect + { + CustomItemEffect Effect { get; set; } + } +} diff --git a/KruacentExiled/KE.Items/Interface/IUpgradableCustomItem.cs b/KruacentExiled/KE.Items/Interface/IUpgradableCustomItem.cs new file mode 100644 index 00000000..634a9397 --- /dev/null +++ b/KruacentExiled/KE.Items/Interface/IUpgradableCustomItem.cs @@ -0,0 +1,15 @@ +using KE.Items.Core.Upgrade; +using Scp914; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace KE.Items.Interface +{ + public interface IUpgradableCustomItem + { + IReadOnlyDictionary Upgrade { get; } + } +} diff --git a/KruacentExiled/KE.Items/ItemEffects/DeployableWallEffect.cs b/KruacentExiled/KE.Items/ItemEffects/DeployableWallEffect.cs new file mode 100644 index 00000000..f6734c14 --- /dev/null +++ b/KruacentExiled/KE.Items/ItemEffects/DeployableWallEffect.cs @@ -0,0 +1,57 @@ +using Exiled.API.Features.Toys; +using Exiled.Events.EventArgs.Map; +using Exiled.Events.EventArgs.Player; +using KE.Items.Interface; +using KE.Utils.API.Sounds; +using MEC; +using UnityEngine; + + +namespace KE.Items.ItemEffects +{ + public class DeployableWallEffect : CustomItemEffect + { + public override void Effect(UsedItemEventArgs ev) + { + SpawnWall(ev.Player.Position,ev.Player.Rotation); + } + public override void Effect(DroppingItemEventArgs ev) + { + SpawnWall(ev.Player.Position, ev.Player.Rotation); + } + + public override void Effect(ExplodingGrenadeEventArgs ev) + { + SpawnWall(ev.Position, ev.Projectile.Rotation); + } + + private void SpawnWall(Vector3 pos, Quaternion rotation) + { + float distance = 2; + Vector3 forward = rotation * Vector3.forward; + Vector3 spawnPos = pos + forward * distance; + Vector3 rotat = new Vector3(0, rotation.eulerAngles.y, 0); + + + + + Primitive wall = Primitive.Create(PrimitiveType.Cube, spawnPos, rotat, new Vector3(4, 4, 0.2f), true); + Utils.API.Sounds.SoundPlayer.Instance.Play("lego", wall.GameObject, 10f, 40); + wall.Collidable = true; + wall.Visible = true; + Timing.CallDelayed(10, () => { + wall.Destroy(); + }); + Timing.CallDelayed(5, () => + { + wall.Color = Color.yellow; + }); + Timing.CallDelayed(8, () => + { + wall.Color = Color.red; + }); + + + } + } +} diff --git a/KruacentExiled/KE.Items/ItemEffects/DivinePillsEffect.cs b/KruacentExiled/KE.Items/ItemEffects/DivinePillsEffect.cs new file mode 100644 index 00000000..0e53802f --- /dev/null +++ b/KruacentExiled/KE.Items/ItemEffects/DivinePillsEffect.cs @@ -0,0 +1,73 @@ +using Exiled.API.Enums; +using Exiled.API.Extensions; +using Exiled.API.Features; +using Exiled.CustomItems.API.Features; +using Exiled.Events.EventArgs.Interfaces; +using Exiled.Events.EventArgs.Map; +using Exiled.Events.EventArgs.Player; +using KE.Items.Extensions; +using KE.Items.Interface; +using PlayerRoles; +using System.Linq; +using Random = UnityEngine.Random; + +namespace KE.Items.ItemEffects +{ + public class DivinePillsEffect : CustomItemEffect + { + public override void Effect(UsedItemEventArgs ev) + { + EffectItem(ev.Player); + } + public override void Effect(DroppingItemEventArgs ev) + { + EffectItem(ev.Player,ev); + } + + public override void Effect(ExplodingGrenadeEventArgs ev) + { + foreach (Player p in ev.TargetsToAffect) + { + EffectItem(p); + } + } + + + + private void EffectItem(Player player,IDeniableEvent ev = null) + { + if (Player.List.Count(x => x.Role == RoleTypeId.Spectator) == 0) + { + player.ItemEffectHint("No spectators to respawn"); + /* + could be used for a deniable event + if(ev != null) + ev.IsAllowed = false; + */ + return; + } + var random = Random.Range(0, 100); + if (random <= 25) + { + player.Kill("unlucky bro"); + return; + } + Player respawning = Player.List.GetRandomValue(x => x.Role == RoleTypeId.Spectator); + switch (player.Role.Side) + { + case Side.ChaosInsurgency: + respawning.Role.Set(RoleTypeId.ChaosRifleman); + break; + case Side.Mtf: + respawning.Role.Set(RoleTypeId.NtfPrivate); + break; + } + + if (random > 75) + { + Log.Debug("tp"); + respawning.Teleport(player); + } + } + } +} diff --git a/KruacentExiled/KE.Items/ItemEffects/HealZoneEffect.cs b/KruacentExiled/KE.Items/ItemEffects/HealZoneEffect.cs new file mode 100644 index 00000000..a3a6769d --- /dev/null +++ b/KruacentExiled/KE.Items/ItemEffects/HealZoneEffect.cs @@ -0,0 +1,82 @@ +using Exiled.API.Features; +using Exiled.API.Features.Toys; +using Exiled.Events.EventArgs.Map; +using Exiled.Events.EventArgs.Player; +using KE.Items.Interface; +using MEC; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using UnityEngine; + +namespace KE.Items.ItemEffects +{ + public class HealZoneEffect : CustomItemEffect + { + + public override void Effect(UsedItemEventArgs ev) + { + SetZone(ev.Player, ev.Player.Position); + } + public override void Effect(DroppingItemEventArgs ev) + { + SetZone(ev.Player, ev.Player.Position); + } + + public override void Effect(ExplodingGrenadeEventArgs ev) + { + SetZone(ev.Player, ev.Position); + } + + private void SetZone(Player player, Vector3 position) + { + float cylinderSize = 5; + + Player playerThrowingGrenade = player; + Vector3 healZonePosition = position; + Primitive wall = Primitive.Create(PrimitiveType.Cylinder, healZonePosition, null, new Vector3(cylinderSize, 0.01f, cylinderSize), true); + wall.Collidable = false; + wall.Visible = true; + + wall.Color = Color.green; + + var coroutineHandler = Timing.RunCoroutine(HealZoneHeal(wall.Position, cylinderSize, playerThrowingGrenade)); + + Timing.CallDelayed(20, () => { + wall.UnSpawn(); + Timing.KillCoroutines(coroutineHandler); + wall.Destroy(); + }); + } + + private IEnumerator HealZoneHeal(Vector3 wallPosition, float cylinderSize, Player playerThrowingGrenade) + { + while (true) + { + foreach (Player player in Exiled.API.Features.Player.List) + { + // Check if a player is in the zone. + if (IsPlayerInZone(player, wallPosition, cylinderSize)) + { + if (playerThrowingGrenade.Role.Team == player.Role.Team) + { + player.Heal(1); + } + } + } + + // Waiting 0.5s before re-check. + yield return Timing.WaitForSeconds(0.5f); + } + } + + private bool IsPlayerInZone(Player player, Vector3 zonePosition, float radius) + { + float distance = Vector3.Distance(new Vector3(player.Position.x, 0, player.Position.z), + new Vector3(zonePosition.x, 0, zonePosition.z)); + return distance <= (radius / 2); + } + } +} diff --git a/KruacentExiled/KE.Items/ItemEffects/MineEffect.cs b/KruacentExiled/KE.Items/ItemEffects/MineEffect.cs new file mode 100644 index 00000000..2d31ee87 --- /dev/null +++ b/KruacentExiled/KE.Items/ItemEffects/MineEffect.cs @@ -0,0 +1,180 @@ +using Exiled.API.Features; +using Exiled.API.Features.Items; +using Exiled.API.Features.Pickups; +using Exiled.API.Features.Pickups.Projectiles; +using Exiled.API.Interfaces; +using Exiled.Events.EventArgs.Map; +using Exiled.Events.EventArgs.Player; +using KE.Items.Extensions; +using KE.Items.Interface; +using KE.Items.Items.Models; +using KE.Utils.API.Interfaces; +using MEC; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using UnityEngine; + +namespace KE.Items.ItemEffects +{ + public class MineEffect : CustomItemEffect, IUsingEvents + { + private const float RefreshRate = .01f; + private const int MineActivationTime = 10; + private const float MineRadius = 0.7f; + public override void Effect(UsedItemEventArgs ev) + { + PlaceMine(ev.Player); + } + public override void Effect(DroppingItemEventArgs ev) + { + PlaceMine(ev.Player); + } + + public override void Effect(ExplodingGrenadeEventArgs ev) + { + PlaceMine(ev.Player,ev.Position); + } + + public void SubscribeEvents() + { + Exiled.Events.Handlers.Map.ExplodingGrenade += OnExplodingGrenade; + } + public void UnsubscribeEvents() + { + + } + + private void OnExplodingGrenade(ExplodingGrenadeEventArgs ev) + { + + } + + /// + /// Place the mine at the feet of the player + /// + /// + private void PlaceMine(Player p) + { + SpawnMine(p, p.Position - new Vector3(0, p.Scale.y)); + } + /// + /// Place the mine at the specified position + /// + /// + /// + private void PlaceMine(Player p,Vector3 pos) + { + + SpawnMine(p, pos); + } + + private void SpawnMine(Player p,Vector3 pos) + { + + MineModel m = new MineModel(); + + //put the mine on the floor + m.Create(pos, new Quaternion()); + + Timing.RunCoroutine(WaitAndActivateMine(p, m)); + } + + private ExplosiveGrenade _grenade; + private ExplosiveGrenade Grenade + { + get + { + if (_grenade == null) + { + _grenade = (ExplosiveGrenade)Item.Create(ItemType.GrenadeHE); + _grenade.MaxRadius = 3; + _grenade.ScpDamageMultiplier = 1f; + _grenade.FuseTime = 0f; + } + return _grenade; + } + } + + + private IEnumerator WaitAndActivateMine(Player player, MineModel mine) + { + int countdown = MineActivationTime; + while (countdown > 0) + { + player.ItemEffectHint($"The mine will be active in {countdown} seconds !"); + yield return Timing.WaitForSeconds(1f); + countdown--; + } + + // Message final lorsque la mine s'active + player.ItemEffectHint("Mine activated !"); + Timing.RunCoroutine(ActiveMine(mine, MineRadius)); + } + + private IEnumerator ActiveMine(MineModel mine, float cylinderSize) + { + Timing.RunCoroutine(mine.Activate()); + bool isActivated = true; + while (isActivated) + { + + foreach (IWorldSpace p in Pickup.List) + { + if (IsPositionInZone(p.Position,mine.Position, cylinderSize, 3)) + { + Grenade.SpawnActive(mine.Position); + DestroyMine(mine); + isActivated = false; + break; + } + } + + foreach (Player player in Player.List) + { + + if (isActivated && IsPlayerInZone(player, mine.Position, cylinderSize, 3)) + { + Grenade.SpawnActive(mine.Position); + DestroyMine(mine); + isActivated = false; + break; + } + } + + yield return Timing.WaitForSeconds(RefreshRate); + } + } + + private void DestroyMine(MineModel mine) + { + mine.Destroy(); + UnsubscribeEvents(); + } + + + private bool IsPlayerInZone(Player player, Vector3 zonePosition, float radius, float height) + { + return IsPositionInZone(player.Position, zonePosition, radius, height); + + } + + private bool IsPositionInZone(Vector3 position, Vector3 zonePosition, float radius, float height) + { + // Calculate the horizontal distance (x, z) + float horizontalDistance = Vector3.Distance( + new Vector3(position.x, 0, position.z), + new Vector3(zonePosition.x, 0, zonePosition.z) + ); + + // Calculate the vertical difference (y) + float verticalDifference = Mathf.Abs(position.y - zonePosition.y); + + // Check if the player is in the 3d zone. + return horizontalDistance <= (radius / 2) && verticalDifference <= (height / 2); + } + + } +} diff --git a/KruacentExiled/KE.Items/ItemEffects/MolotovEffect.cs b/KruacentExiled/KE.Items/ItemEffects/MolotovEffect.cs new file mode 100644 index 00000000..6af6398e --- /dev/null +++ b/KruacentExiled/KE.Items/ItemEffects/MolotovEffect.cs @@ -0,0 +1,126 @@ +using Exiled.API.Features; +using Exiled.API.Features.Toys; +using Exiled.Events.EventArgs.Map; +using KE.Items.Interface; +using MEC; +using PlayerRoles; +using Exiled.API.Enums; +using System.Collections.Generic; +using UnityEngine; +using Exiled.Events.EventArgs.Player; +using Light = Exiled.API.Features.Toys.Light; + +namespace KE.Items.ItemEffects +{ + public class MolotovEffect : CustomItemEffect + { + public const float RefreshRate = 0.5f; + public const float Duration = 20f; + public float CylinderSize { get; set; } = 5; + + + public override void Effect(UsedItemEventArgs ev) + { + SetZone(ev.Player, ev.Player.Position); + } + public override void Effect(DroppingItemEventArgs ev) + { + SetZone(ev.Player, ev.Player.Position); + } + + public override void Effect(ExplodingGrenadeEventArgs ev) + { + SetZone(ev.Player, ev.Position); + } + + + private void SetZone(Player player,Vector3 position) + { + float cylinderSize = CylinderSize; + + + Player playerThrowingGrenade = player; + Vector3 molotovPosition = position; + Primitive wall = Primitive.Create(PrimitiveType.Cylinder, molotovPosition, null, new Vector3(cylinderSize, 0.01f, cylinderSize), true); + var l = Light.Create(position, null, null, false); + l.Color = new Color(255,128,0); + l.Intensity = .05f; + l.Spawn(); + wall.Collidable = false; + wall.Visible = true; + + wall.Color = new Color(255, 128, 0); + + var coroutineHandler = Timing.RunCoroutine(DamageInMolotovZone(wall.Position, cylinderSize, playerThrowingGrenade)); + + Timing.CallDelayed(Duration, () => { + Timing.KillCoroutines(coroutineHandler); + wall.Destroy(); + l.Destroy(); + }); + } + + + + private IEnumerator DamageInMolotovZone(Vector3 wallPosition, float cylinderSize, Player playerThrowingGrenade) + { + // Dictionary that stores the time each player has spent inside the zone (in seconds). + Dictionary playerTimeInZone = new Dictionary(); + + while (true) + { + foreach (Player player in Player.List) + { + if (IsPlayerInZone(player, wallPosition, cylinderSize)) + { + if (Exiled.API.Features.Server.FriendlyFire || playerThrowingGrenade.Role.Team != player.Role.Team || playerThrowingGrenade == player) + { + if (player.IsHuman || player.Role == RoleTypeId.Scp0492) + { + if (playerTimeInZone.ContainsKey(player)) + { + // increase time each frame. + playerTimeInZone[player] += Time.deltaTime; + } + else + { + // Init the time in dictionnary of the player. + playerTimeInZone[player] = Time.deltaTime; + } + + // time of player spend inside of molotov zone. + float timeInZone = playerTimeInZone[player]; + + // Beginning it willbe 5dm/s, after it will be linearly higher the damage until 20dm/s. + float damage = Mathf.Lerp(2.5f, 10f, timeInZone / 20f); + + // double damage if it's zombie cuz it has more hp. + if (player.Role == RoleTypeId.Scp0492) + { + damage *= 2.5f; + } + + player.Hurt(damage, DamageType.Bleeding); + } + else if (player.IsScp) + { + player.Hurt(player.Health / 150, DamageType.Bleeding); + } + + } + } + } + + yield return Timing.WaitForSeconds(RefreshRate); + } + } + + + private bool IsPlayerInZone(Player player, Vector3 zonePosition, float radius) + { + float distance = Vector3.Distance(new Vector3(player.Position.x, 0, player.Position.z), + new Vector3(zonePosition.x, 0, zonePosition.z)); + return distance <= (radius / 2); + } + } +} diff --git a/KruacentExiled/KE.Items/ItemEffects/Scp1650Effect.cs b/KruacentExiled/KE.Items/ItemEffects/Scp1650Effect.cs new file mode 100644 index 00000000..4d726503 --- /dev/null +++ b/KruacentExiled/KE.Items/ItemEffects/Scp1650Effect.cs @@ -0,0 +1,103 @@ +using Exiled.API.Features; +using Exiled.Events.EventArgs.Map; +using Exiled.Events.EventArgs.Player; +using KE.Items.Interface; +using MEC; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using UnityEngine; +using static KE.Items.Items.Scp1650; + +namespace KE.Items.ItemEffects +{ + public class Scp1650Effect : CustomItemEffect + { + public enum CardinalPoints + { + South, + West, + North, + East, + } + + public override void Effect(UsedItemEventArgs ev) + { + OnUsedItem(ev.Player); + } + public override void Effect(DroppingItemEventArgs ev) + { + OnUsedItem(ev.Player); + } + + public override void Effect(ExplodingGrenadeEventArgs ev) + { + foreach (Player player in ev.TargetsToAffect) + { + OnUsedItem(player); + } + } + + + private void OnUsedItem(Player player) + { + + CardinalPoints rotation = Rotation(player.Rotation); + + Log.Debug(rotation); + switch (rotation) + { + + case CardinalPoints.South: + Timing.RunCoroutine(Regeneration(player, 10)); + break; + case CardinalPoints.West: + player.EnableEffect(Exiled.API.Enums.EffectType.BodyshotReduction, 25, 60); + break; + case CardinalPoints.North: + player.EnableEffect(Exiled.API.Enums.EffectType.Invigorated, 1, 30); + break; + case CardinalPoints.East: + player.EnableEffect(Exiled.API.Enums.EffectType.CardiacArrest, 1, 10); + break; + + } + + + } + + private IEnumerator Regeneration(Player p, float duration) + { + float timeWaited = duration; + + while (timeWaited > 0) + { + timeWaited -= .1f; + p.Heal(1); + yield return Timing.WaitForSeconds(.1f); + } + + + } + + private CardinalPoints Rotation(Quaternion rotation) + { + + Vector3 forward1 = rotation * Vector3.forward; + float x = forward1.x; + float z = forward1.z; + + if (z > .75f) + return CardinalPoints.South; + if (x > .75f) + return CardinalPoints.West; + if (z <= -.75f) + return CardinalPoints.North; + if (x <= -.75f) + return CardinalPoints.East; + return CardinalPoints.East; + } + } +} diff --git a/KruacentExiled/KE.Items/ItemEffects/TPGrenadaEffect.cs b/KruacentExiled/KE.Items/ItemEffects/TPGrenadaEffect.cs new file mode 100644 index 00000000..24f439ef --- /dev/null +++ b/KruacentExiled/KE.Items/ItemEffects/TPGrenadaEffect.cs @@ -0,0 +1,113 @@ +using Exiled.API.Enums; +using Exiled.API.Extensions; +using Exiled.API.Features; +using Exiled.API.Features.Pickups.Projectiles; +using Exiled.API.Features.Pools; +using Exiled.Events.EventArgs.Map; +using Exiled.Events.EventArgs.Player; +using KE.Items.Interface; +using PlayerRoles; +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using UnityEngine; + +namespace KE.Items.ItemEffects +{ + public class TPGrenadaEffect : CustomItemEffect + { + private List effectedPlayers = new List(); + [Description("What roles will not be able to be affected by Implosion Grenades. Keeping SCP-173 on this list is highly recommended.")] + public HashSet BlacklistedRoles { get; set; } = new HashSet() { RoleTypeId.Scp173, RoleTypeId.Scp106, RoleTypeId.Scp049, RoleTypeId.Scp096, RoleTypeId.Scp3114, RoleTypeId.Scp0492, RoleTypeId.Scp939 }; + + public HashSet BlacklistedRooms { get; } = new() + { + RoomType.HczTestRoom, + RoomType.HczTesla, + RoomType.Lcz173, + }; + + public override void Effect(UsedItemEventArgs ev) + { + OnExploding(new HashSet() { ev.Player }); + } + public override void Effect(DroppingItemEventArgs ev) + { + OnExploding(new HashSet() { ev.Player }); + } + + public override void Effect(ExplodingGrenadeEventArgs ev) + { + OnExploding(ev.TargetsToAffect,ev.Projectile); + } + + + + private void OnExploding(HashSet targets, EffectGrenadeProjectile projectile = null) + { + + effectedPlayers = ListPool.Pool.Get(); + foreach (Player player in targets) + { + if (BlacklistedRoles.Contains(player.Role)) + continue; + try + { + bool line; + if (projectile == null) + line = Physics.Linecast(projectile.Transform.position, player.Position); + else + line = true; + + if (line) + { + effectedPlayers.Add(player); + player.Teleport(RandomRoom()); + } + } + catch (Exception exception) + { + Log.Error($"{nameof(OnExploding)} error: {exception}"); + } + } + } + + + + private Room RandomRoom() + { + Room room = Room.List.GetRandomValue((Room r) => !BlacklistedRooms.Contains(r.Type)); + if (Warhead.IsDetonated) + { + return RandomRoom(ZoneType.Surface); + } + + if (Map.IsLczDecontaminated) + { + float random = UnityEngine.Random.value; + Log.Debug($"random={random}"); + if (random <= 0.33f) + { + return RandomRoom(ZoneType.HeavyContainment); + } + if (random > 0.33f && random <= 0.66f) + { + return RandomRoom(ZoneType.Entrance); + } + return RandomRoom(ZoneType.Surface); + } + + Log.Debug($"roomZone={room.Zone}"); + return room; + } + + + private Room RandomRoom(ZoneType zone) + { + return Room.List.GetRandomValue((Room r) => !BlacklistedRooms.Contains(r.Type) && r.Zone == zone); + } + } +} diff --git a/KruacentExiled/KE.Items/Items/AdrenalineDrogue.cs b/KruacentExiled/KE.Items/Items/AdrenalineDrogue.cs index f463761d..233119f5 100644 --- a/KruacentExiled/KE.Items/Items/AdrenalineDrogue.cs +++ b/KruacentExiled/KE.Items/Items/AdrenalineDrogue.cs @@ -10,22 +10,29 @@ using Exiled.API.Extensions; using UnityEngine; using CustomPlayerEffects; +using KE.Items.Interface; +using System.Linq; +using KE.Items.Extensions; +using KE.Items.Features; /// [CustomItem(ItemType.Adrenaline)] -public class AdrenalineDrogue : CustomItem +public class AdrenalineDrogue : KECustomItem, ILumosItem { + //seringue /// - public override uint Id { get; set; } = 1402; + public override uint Id { get; set; } = 1042; /// public override string Name { get; set; } = "DA-020"; /// - public override string Description { get; set; } = "La bonne drogue là, si vous le prenez vous êtes ienb pendant 20 secondes puis vous vous sentez pas bien !"; + public override string Description { get; set; } = "you need to test it !"; /// public override float Weight { get; set; } = 0.65f; + public UnityEngine.Color Color { get; set; } = UnityEngine.Color.yellow; + public List joueursSCP = new List(); @@ -46,6 +53,24 @@ public class AdrenalineDrogue : CustomItem Location = SpawnLocationType.Inside173Gate, }, }, + + LockerSpawnPoints = new List + { + new LockerSpawnPoint() + { + Chance = 20, + UseChamber = true, + Type = LockerType.Misc, + Zone = ZoneType.Entrance, + }, + new LockerSpawnPoint() + { + Chance = 25, + UseChamber = true, + Type = LockerType.Medkit, + Zone = ZoneType.HeavyContainment, + }, + }, }; /// @@ -66,7 +91,7 @@ private void OnUsingItem(UsedItemEventArgs ev) { if (TryGet(ev.Item, out var result)) { - if (result.Id == 19) + if (result.Id == Id) { Timing.CallDelayed(0.5f, () => { @@ -79,17 +104,33 @@ private void OnUsingItem(UsedItemEventArgs ev) private IEnumerator EffectAttribution(Exiled.API.Features.Player joueur) { + bool gasgas = false; + /* EFFET DE LA DROGUE */ - joueur.ShowHint("Vous êtes actuellement sous effet de la cocaïne liquide !"); - joueur.EnableEffect(40, true); + joueur.ItemEffectHint("Vous êtes actuellement sous effet de la cocaïne liquide !"); + + var movementBoostEffect = joueur.ActiveEffects.FirstOrDefault(e => e is MovementBoost) as MovementBoost; + + if (movementBoostEffect != null) + { + float currentIntensity = movementBoostEffect.Intensity; + joueur.EnableEffect(currentIntensity+50, true); + gasgas = true; + } + else + { + joueur.EnableEffect(50, true); + } + + joueur.EnableEffect(30, true); - joueur.EnableEffect(30, true); + joueur.EnableEffect(40, true); joueur.EnableEffect(30, true); joueur.Health = 169; yield return Timing.WaitForSeconds(30); - joueur.ShowHint("Mince vous êtes perdu chez le papi Rian !"); + joueur.ItemEffectHint("Mince vous êtes perdu chez le papi Rian !"); joueur.Health = 9420; joueur.IsGodModeEnabled = true; @@ -140,10 +181,16 @@ private IEnumerator EffectAttribution(Exiled.API.Features.Player joueur) joueur.DisableAllEffects(); joueur.EnableEffect(10); - joueur.EnableEffect(35); + if (gasgas) + { + joueur.EnableEffect(130, true); + } else + { + joueur.EnableEffect(30, true); + } - yield return Timing.WaitForSeconds(UnityEngine.Random.Range(180, 300)); + yield return Timing.WaitForSeconds(UnityEngine.Random.Range(60, 120)); if (joueur.IsAlive) { @@ -151,7 +198,7 @@ private IEnumerator EffectAttribution(Exiled.API.Features.Player joueur) switch (randomNumber) { case 1: - Log.Debug(joueur.Nickname + " a changé d'apparence !"); + Log.Debug(joueur.Nickname + " changed his skin !"); joueur.PlayShieldBreakSound(); joueur.ChangeAppearance(joueursSCP[0].Role); @@ -165,14 +212,14 @@ private IEnumerator EffectAttribution(Exiled.API.Features.Player joueur) break; case 2: Log.Debug("Muet"); - joueur.ShowHint("Vous avez perdu votre langue ! (esperons que celle-ci repousse)"); + joueur.ItemEffectHint("You lost your ability to talk, (git good)"); joueur.Mute(); yield return Timing.WaitForSeconds(UnityEngine.Random.Range(30, 100)); - joueur.ShowHint("Je crois que c'est bon, ça a repoussé !"); + joueur.ShowHint("I think you found your ability"); joueur.UnMute(); break; case 3: - joueur.ShowHint("Vous êtes devenu du caoutchouc !"); + joueur.ItemEffectHint("You are caoutchouc man"); Exiled.API.Features.TeslaGate.IgnoredPlayers.Add(joueur); joueur.SetScale(new Vector3(1.5f, 0.5f, 1.7f), Exiled.API.Features.Player.List); break; @@ -180,7 +227,7 @@ private IEnumerator EffectAttribution(Exiled.API.Features.Player joueur) Log.Debug("Let's go party"); foreach (var player in Exiled.API.Features.Player.List) { - player.ShowHint(joueur.Nickname + " à commencer une fête d'anniversaire !"); + player.ShowHint("It's " + joueur.Nickname + " birthday !"); } float duration2 = 30f; @@ -205,10 +252,11 @@ private IEnumerator EffectAttribution(Exiled.API.Features.Player joueur) break; case 5: Log.Debug("Paper"); - joueur.ShowHint("Bienvenue dans le monde des papiers. Évite les ciseaux !"); + joueur.ItemEffectHint("You are a paper ! Yippee !"); joueur.SetScale(new Vector3(1f, 0.5f, 1f), Exiled.API.Features.Player.List); break; } } + } } \ No newline at end of file diff --git a/KruacentExiled/KE.Items/Items/Defibrilator.cs b/KruacentExiled/KE.Items/Items/Defibrilator.cs index a06eec88..c60c89f9 100644 --- a/KruacentExiled/KE.Items/Items/Defibrilator.cs +++ b/KruacentExiled/KE.Items/Items/Defibrilator.cs @@ -9,31 +9,40 @@ using Exiled.API.Features; using UnityEngine; using System.Linq; -[CustomItem(ItemType.SCP1853)] +using KE.Items.Interface; +using KE.Items.Extensions; +using KE.Items.Features; -public class Defibrilator : CustomItem +[CustomItem(ItemType.SCP1853)] +public class Defibrilator : KECustomItem, ILumosItem { - public override uint Id { get; set; } = 1401; - public override string Name { get; set; } = "DF-001"; - public override string Description { get; set; } = "Le défibrilateur, il permet de réanimer une personne qui à une perte de conscience, on va réanimer la personne la plus proche du joueur qui l'utilise (le lieu de mort et non où se trouve le corps)"; + public override uint Id { get; set; } = 1041; + public override string Name { get; set; } = "Defibrilator"; + public override string Description { get; set; } = "The defibrillator is used to revive a person who has lost consciousness. It will revive the person closest to the player who uses it (the location of death, not where the body is)."; public override float Weight { get; set; } = 0.65f; + public UnityEngine.Color Color { get; set; } = UnityEngine.Color.magenta; private ConcurrentDictionary positionMort = new ConcurrentDictionary(); public override SpawnProperties SpawnProperties { get; set; } = new SpawnProperties() { - Limit = 2, + Limit = 4, DynamicSpawnPoints = new List { - new DynamicSpawnPoint() { Chance = 100, Location = SpawnLocationType.Inside079Secondary }, - new DynamicSpawnPoint() { Chance = 10, Location = SpawnLocationType.InsideHidRight }, - new DynamicSpawnPoint() { Chance = 10, Location = SpawnLocationType.InsideHidLeft }, + new DynamicSpawnPoint() { Chance = 50, Location = SpawnLocationType.Inside079Secondary }, + new DynamicSpawnPoint() { Chance = 20, Location = SpawnLocationType.InsideHidLower }, + new DynamicSpawnPoint() { Chance = 20, Location = SpawnLocationType.InsideHidUpper }, }, + + LockerSpawnPoints = new List + { + new LockerSpawnPoint(){ Chance= 50, Type = LockerType.Medkit, }, + } }; protected override void SubscribeEvents() { - Exiled.Events.Handlers.Player.UsedItem += OnUsingItem; + Exiled.Events.Handlers.Player.UsingItem += OnUsingItem; Exiled.Events.Handlers.Player.Dying += OnDeathEvent; Exiled.Events.Handlers.Player.Spawned += OnSpawningEvent; base.SubscribeEvents(); @@ -41,7 +50,7 @@ protected override void SubscribeEvents() protected override void UnsubscribeEvents() { - Exiled.Events.Handlers.Player.UsedItem -= OnUsingItem; + Exiled.Events.Handlers.Player.UsingItem -= OnUsingItem; Exiled.Events.Handlers.Player.Dying -= OnDeathEvent; Exiled.Events.Handlers.Player.Spawned -= OnSpawningEvent; base.UnsubscribeEvents(); @@ -60,32 +69,37 @@ private void OnSpawningEvent(SpawnedEventArgs ev) { if (ev.Player.IsAlive) { - Log.Debug("Enlèvement du joueur"); + positionMort.TryRemove(ev.Player, out _); } } - private void OnUsingItem(UsedItemEventArgs ev) + private void OnUsingItem(UsingItemEventArgs ev) { - if (TryGet(ev.Item, out var result) && result.Id == 20) + if (!Check(ev.Player.CurrentItem)) { - Timing.CallDelayed(0.5f, () => - { - ev.Player.DisableEffect(EffectType.Scp1853); - Timing.RunCoroutine(EffectAttribution(ev.Player)); - }); + return; } + + Timing.CallDelayed(1f, () => + { + ev.IsAllowed = false; + ev.Player.RemoveItem(ev.Item); + + Timing.RunCoroutine(EffectAttribution(ev.Player)); + }); } private IEnumerator EffectAttribution(Player joueur) { + joueur.DisableEffect(EffectType.Scp1853); Log.Debug("Utilisation item"); Log.Debug("Nombre de mort : " + positionMort.Count()); if (positionMort.Count == 0) { - joueur.Broadcast(5, "Il n'y a pas de morts actuellement.", Broadcast.BroadcastFlags.Normal, true); - Exiled.CustomItems.API.Features.CustomItem.TryGive(joueur, 20); + joueur.ItemEffectHint("There is no death"); + Exiled.CustomItems.API.Features.CustomItem.TryGive(joueur, 1041); } else { @@ -112,12 +126,12 @@ private IEnumerator EffectAttribution(Player joueur) closestDeadPlayer.IsGodModeEnabled = true; closestDeadPlayer.Role.Set(joueur.Role); - closestDeadPlayer.Health = 10; + closestDeadPlayer.Health = 40; closestDeadPlayer.Teleport(joueur.Position); - closestDeadPlayer.Broadcast(5, joueur.Nickname + " t'as réanimé !", Broadcast.BroadcastFlags.Normal, true); - joueur.Broadcast(5, "Tu as réanimé " + closestDeadPlayer.Nickname + " !", Broadcast.BroadcastFlags.Normal, true); + closestDeadPlayer.ItemEffectHint(joueur.Nickname + " revived you!"); + joueur.ItemEffectHint("You revived " + closestDeadPlayer.Nickname + "!"); yield return Timing.WaitForSeconds(1); diff --git a/KruacentExiled/KE.Items/Items/DeployableWall.cs b/KruacentExiled/KE.Items/Items/DeployableWall.cs index f40f116f..79b3f724 100644 --- a/KruacentExiled/KE.Items/Items/DeployableWall.cs +++ b/KruacentExiled/KE.Items/Items/DeployableWall.cs @@ -8,19 +8,22 @@ using Exiled.Events.EventArgs.Player; using Exiled.API.Features.Toys; using MEC; +using KE.Items.ItemEffects; +using KE.Items.Features; namespace KE.Items.Items { - //grenade qui tp [CustomItem(ItemType.KeycardJanitor)] - public class DeployableWall : CustomItem, ILumosItem + public class DeployableWall : KECustomItem, ILumosItem, ISwichableEffect { - public override uint Id { get; set; } = 1407; + public override uint Id { get; set; } = 1048; public override string Name { get; set; } = "Deployable Wall"; public override string Description { get; set; } = "Drop to deploy a wall, and throw to just throw the card"; public override float Weight { get; set; } = 0.65f; - public UnityEngine.Color Color { get; set; } = UnityEngine.Color.green; + public Color Color { get; set; } = Color.green; + + public CustomItemEffect Effect { get; set; } public override SpawnProperties SpawnProperties { get; set; } = new SpawnProperties() { Limit = 2, @@ -48,50 +51,26 @@ public class DeployableWall : CustomItem, ILumosItem }; + public DeployableWall() + { + Effect = new DeployableWallEffect(); + } - - - protected override void OnDropping(DroppingItemEventArgs ev) + protected override void OnDroppingItem(DroppingItemEventArgs ev) { - if(!Check(ev.Item)) - return; if (ev.IsThrown) { ev.IsAllowed = true; return; } + ev.IsAllowed = false; - ev.Player.ShowHint("You have dropped a deployable wall"); ev.Player.RemoveItem(ev.Item); - SpawnWall(ev.Player.Position,ev.Player.Rotation); + Effect.Effect(ev); } - private void SpawnWall(Vector3 pos, Quaternion rotation) - { - float distance = 2; - Vector3 forward = rotation * Vector3.forward; - Vector3 spawnPos = pos + forward * distance; - Vector3 rotat = new Vector3(0, rotation.eulerAngles.y, 0); - - Primitive wall = Primitive.Create(PrimitiveType.Cube, spawnPos, rotat, new Vector3(4, 4, 0.2f),true); - wall.Collidable = true; - wall.Visible = true; - Timing.CallDelayed(10, () => { - wall.UnSpawn(); - wall.Destroy(); - }); - Timing.CallDelayed(5, () => - { - wall.Color= Color.yellow; - }); - Timing.CallDelayed(8, () => - { - wall.Color = Color.red; - }); - - - } + } diff --git a/KruacentExiled/KE.Items/Items/DivinePills.cs b/KruacentExiled/KE.Items/Items/DivinePills.cs index 4c4e42b2..181d1a65 100644 --- a/KruacentExiled/KE.Items/Items/DivinePills.cs +++ b/KruacentExiled/KE.Items/Items/DivinePills.cs @@ -13,23 +13,38 @@ using System.Linq; using PlayerRoles; using KE.Items.Interface; +using Exiled.CustomItems.API.EventArgs; +using Exiled.Events.EventArgs.Scp914; +using Exiled.API.Features.Items; +using System.Data; +using Exiled.API.Features.Pickups; +using KE.Items.ItemEffects; +using Scp914; +using System.Collections.ObjectModel; +using KE.Items.Features; +using KE.Items.Core.Upgrade; /// [CustomItem(ItemType.Painkillers)] -public class DivinePills : CustomItem, ILumosItem +public class DivinePills : KECustomItem, ILumosItem, ISwichableEffect, IUpgradableCustomItem { /// - public override uint Id { get; set; } = 1406; + public override uint Id { get; set; } = 1047; /// public override string Name { get; set; } = "Divine Pills"; /// - public override string Description { get; set; } = "25% chance you die\n 75% you respawn someone"; + public override string Description { get; set; } = "25% chance you die\n 75% you respawn someone\n"; /// public override float Weight { get; set; } = 0.65f; public UnityEngine.Color Color { get; set; } = UnityEngine.Color.yellow; + public IReadOnlyDictionary Upgrade { get; private set; } = new Dictionary() + { + //very fine -> true divine pills 10% + { Scp914KnobSetting.VeryFine,new UpgradeProperties(10, 1050)} + }; /// public override SpawnProperties SpawnProperties { get; set; } = new SpawnProperties() @@ -62,49 +77,30 @@ public class DivinePills : CustomItem, ILumosItem }; + public CustomItemEffect Effect { get;set; } + public DivinePills() + { + Effect = new DivinePillsEffect(); + } + /// protected override void SubscribeEvents() { - PlayerHandle.UsedItem += OnUsingItem; + PlayerHandle.UsedItem += OnUsedItem; base.SubscribeEvents(); } /// protected override void UnsubscribeEvents() { - PlayerHandle.UsedItem -= OnUsingItem; + PlayerHandle.UsedItem -= OnUsedItem; base.UnsubscribeEvents(); } - private void OnUsingItem(UsedItemEventArgs ev) + private void OnUsedItem(UsedItemEventArgs ev) { - if (!Check(ev.Item)) - { - return; - } - if (TryGet(ev.Item, out var result) && result.Id == Id) - { - Player player = ev.Player; - var random = Random.Range(0, 100); - - if(Player.List.Where(x => x.Role == RoleTypeId.Spectator).Count() == 0) - { - player.ShowHint("No spectators to respawn"); - return; - } - - if (random <= 25) - { - player.Kill("unlucky bro"); - return; - } - Player respawning = Player.List.Where(x => x.Role == RoleTypeId.Spectator).GetRandomValue(); - respawning.Role.Set(player.Role); - if (random > 75) - { - respawning.Position = player.Position; - } - } + if (!Check(ev.Item)) return; + Effect.Effect(ev); } } \ No newline at end of file diff --git a/KruacentExiled/KE.Items/Items/HealZone.cs b/KruacentExiled/KE.Items/Items/HealZone.cs new file mode 100644 index 00000000..64a40dfd --- /dev/null +++ b/KruacentExiled/KE.Items/Items/HealZone.cs @@ -0,0 +1,83 @@ +using System.Collections.Generic; +using Exiled.API.Enums; +using Exiled.API.Features.Attributes; +using Exiled.API.Features.Spawn; +using Exiled.API.Features.Toys; +using Exiled.CustomItems.API.Features; +using Exiled.Events.EventArgs.Map; +using KE.Items.Interface; +using Player = Exiled.API.Features.Player; +using MEC; +using UnityEngine; +using KE.Items.ItemEffects; +using KE.Items.Features; + +namespace KE.Items.Items +{ + [CustomItem(ItemType.GrenadeFlash)] + public class HealZone : KECustomGrenade, ILumosItem, ISwichableEffect + { + public override uint Id { get; set; } = 1051; + public override string Name { get; set; } = "Heal Zone"; + public override string Description { get; set; } = "Allow to heal you and your ally"; + public override float Weight { get; set; } = 0.65f; + public override float FuseTime { get; set; } = 5f; + public override bool ExplodeOnCollision { get; set; } = true; + public UnityEngine.Color Color { get; set; } = UnityEngine.Color.green; + public CustomItemEffect Effect { get; set; } + public override SpawnProperties SpawnProperties { get; set; } = new SpawnProperties() + { + Limit = 3, + LockerSpawnPoints = new List + { + new LockerSpawnPoint() + { + Chance = 75, + UseChamber = true, + Type = LockerType.Medkit, + Zone = ZoneType.Entrance, + }, + new LockerSpawnPoint() + { + Chance = 50, + UseChamber = true, + Type = LockerType.Medkit, + Zone = ZoneType.LightContainment, + }, + new LockerSpawnPoint() + { + Chance = 100, + UseChamber = true, + Type = LockerType.Medkit, + Zone = ZoneType.HeavyContainment, + }, + }, + + RoomSpawnPoints = new List + { + new RoomSpawnPoint() + { + Chance = 75, + Room = RoomType.HczHid, + }, + new RoomSpawnPoint() + { + Chance = 50, + Room = RoomType.HczNuke, + }, + }, + }; + + public HealZone() + { + Effect = new HealZoneEffect(); + } + + protected override void OnExploding(ExplodingGrenadeEventArgs ev) + { + + Effect.Effect(ev); + ev.TargetsToAffect.Clear(); + } + } +} \ No newline at end of file diff --git a/KruacentExiled/KE.Items/Items/ImpactFlash.cs b/KruacentExiled/KE.Items/Items/ImpactFlash.cs new file mode 100644 index 00000000..e3c93343 --- /dev/null +++ b/KruacentExiled/KE.Items/Items/ImpactFlash.cs @@ -0,0 +1,49 @@ +using System.Collections.Generic; +using Exiled.API.Enums; +using Exiled.API.Features.Attributes; +using Exiled.API.Features.Spawn; +using Exiled.CustomItems.API.Features; +using KE.Items.Features; + +namespace KE.Items.Items +{ + [CustomItem(ItemType.GrenadeFlash)] + public class ImpactFlash : KECustomGrenade + { + public override uint Id { get; set; } = 1052; + public override string Name { get; set; } = "Impact Flash"; + public override string Description { get; set; } = "The grenade explode at impact"; + public override float Weight { get; set; } = 0.65f; + public override float FuseTime { get; set; } = 3f; + public override bool ExplodeOnCollision { get; set; } = true; + public float DamageModifier { get; set; } = 1f; + public override SpawnProperties SpawnProperties { get; set; } = new SpawnProperties() + { + Limit = 5, + DynamicSpawnPoints = new List + { + new DynamicSpawnPoint() + { + Chance = 50, + Location = SpawnLocationType.InsideHczArmory, + }, + new DynamicSpawnPoint() + { + Chance = 2, + Location = SpawnLocationType.Inside914, + }, + new DynamicSpawnPoint() + { + Chance= 50, + Location = SpawnLocationType.Inside049Armory, + }, + new DynamicSpawnPoint() + { + Chance= 50, + Location = SpawnLocationType.InsideLczArmory, + } + }, + + }; + } +} diff --git a/KruacentExiled/KE.Items/Items/Mine.cs b/KruacentExiled/KE.Items/Items/Mine.cs index 5ba232c1..c1486ea5 100644 --- a/KruacentExiled/KE.Items/Items/Mine.cs +++ b/KruacentExiled/KE.Items/Items/Mine.cs @@ -1,17 +1,114 @@ -using Exiled.CustomItems.API.Features; -using System; +using Exiled.API.Enums; +using Exiled.API.Features.Attributes; +using Exiled.API.Features.Spawn; +using Exiled.CustomItems.API.Features; +using KE.Items.Interface; using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; +using UnityEngine; +using Exiled.Events.EventArgs.Player; +using KE.Items.ItemEffects; +using KE.Utils.Quality.Models; +using KE.Utils.Quality.Models.Examples; +using MEC; +using KE.Items.Features; +using Exiled.API.Features.Toys; +using KE.Utils.API.Models.Blueprints; +using UnityEngine.Experimental.GlobalIllumination; +using Exiled.API.Interfaces; +using KE.Items.Items.PickupModels; namespace KE.Items.Items { - - //une mine - /*public class Mine : CustomGrenade + [CustomItem(ItemType.KeycardJanitor)] + public class Mine : KECustomItem, ILumosItem, ISwichableEffect, ICustomPickupModel { + public override uint Id { get; set; } = 1053; + public override string Name { get; set; } = "Mine"; + public override string Description { get; set; } = "Drop to deploy the mine, little advice : don't step on it"; + public override float Weight { get; set; } = 0.65f; + public Color Color { get; set; } = Color.yellow; + public PickupModel PickupModel { get; set; } + public CustomItemEffect Effect { get; set; } + + + public override SpawnProperties SpawnProperties { get; set; } = null; + /*new SpawnProperties() + { + Limit = 2, + DynamicSpawnPoints = new List + { + new DynamicSpawnPoint() + { + Chance= 25, + Location = SpawnLocationType.Inside049Armory, + }, + new DynamicSpawnPoint() + { + Chance= 25, + Location = SpawnLocationType.InsideEscapeSecondary, + }, + new DynamicSpawnPoint() + { + Chance= 25, + Location = SpawnLocationType.InsideGateA, + }, + new DynamicSpawnPoint() + { + Chance= 25, + Location = SpawnLocationType.InsideGateB, + } + }, + LockerSpawnPoints = new List + { + new LockerSpawnPoint() + { + Chance= 20, + Type = LockerType.Misc, + }, + new LockerSpawnPoint() + { + Chance= 20, + Type = LockerType.RifleRack, + }, + } + + };*/ + + public Mine() + { + Effect = new MineEffect(); + PickupModel = new MinePModel(this); + } + + protected override void SubscribeEvents() + { + PickupModel.SubscribeEvents(); + base.SubscribeEvents(); + } + + protected override void UnsubscribeEvents() + { + PickupModel.UnsubscribeEvents(); + base.UnsubscribeEvents(); + } + + protected override void OnDroppingItem(DroppingItemEventArgs ev) + { + + + if (ev.IsThrown) + { + ev.IsAllowed = true; + return; + } + + ev.IsAllowed = false; + ev.Player.RemoveItem(ev.Item); + Effect.Effect(ev); + + } + + } - */ } diff --git a/KruacentExiled/KE.Items/Items/Models/DeployWallModel.cs b/KruacentExiled/KE.Items/Items/Models/DeployWallModel.cs new file mode 100644 index 00000000..5ec6dfa7 --- /dev/null +++ b/KruacentExiled/KE.Items/Items/Models/DeployWallModel.cs @@ -0,0 +1,64 @@ + + +using Exiled.API.Features; +using Exiled.API.Features.Toys; +using Exiled.Events.Commands.Reload; +using MEC; +using System.Collections.Generic; +using System.Linq; +using UnityEngine; +using Light = Exiled.API.Features.Toys.Light; + +namespace KE.Items.Items.Models +{ + internal class DeployWallModel : Model + { + const float distance = 2; + internal override void Create(Vector3 spawnPos, Quaternion rotation) + { + + Vector3 forward = rotation * Vector3.forward; + Vector3 spawnPosi = spawnPos + forward * distance; + Vector3 rotat = new Vector3(0, rotation.eulerAngles.y, 0); + + + + } + + internal void Change() + { + Timing.CallDelayed(10, () => + { + UnSpawn(); + }); + Timing.CallDelayed(5, () => + { + Toys.ForEach(t => + { + if (t is Primitive p) p.Color = Color.yellow; + }); + }); + Timing.CallDelayed(8, () => + { + Toys.ForEach(t => + { + if (t is Primitive p) p.Color = Color.red; + }); + }); + } + + private void SpawnWall(Vector3 pos, Quaternion rotation) + { + Vector3 forward = rotation * Vector3.forward; + Vector3 spawnPos = pos + forward * distance; + Vector3 rotat = new Vector3(0, rotation.eulerAngles.y, 0); + + Primitive wall = Primitive.Create(PrimitiveType.Cube, spawnPos, rotat, new Vector3(4, 4, 0.2f), true); + wall.Collidable = true; + wall.Visible = true; + + + + } + } +} diff --git a/KruacentExiled/KE.Items/Items/Models/MineModel.cs b/KruacentExiled/KE.Items/Items/Models/MineModel.cs new file mode 100644 index 00000000..3b9c6b7f --- /dev/null +++ b/KruacentExiled/KE.Items/Items/Models/MineModel.cs @@ -0,0 +1,52 @@ + + +using Exiled.API.Features; +using Exiled.API.Features.Toys; +using MEC; +using System.Collections.Generic; +using UnityEngine; +using Light = Exiled.API.Features.Toys.Light; + +namespace KE.Items.Items.Models +{ + internal class MineModel : Model + { + private Light _light; + internal override void Create(Vector3 spawnPos, Quaternion _) + { + //spawn + offset + Position = spawnPos + new Vector3(0, .05f); + Vector3 sizeDisk = new Vector3(.7f, 0.1f, .7f); + Vector3 posLight = Position + new Vector3(0, sizeDisk.y); + + var baseMine = Primitive.Create(PrimitiveType.Cylinder, Position, null, sizeDisk, true); + baseMine.Color = Color.black; + var lightGlobe = Primitive.Create(PrimitiveType.Sphere, posLight, null, new Vector3(.1f, .1f, .1f)); + var lightMine = Light.Create(posLight + new Vector3(0, 0.1f), null, null, true, Color.red); + lightMine.UnSpawn(); + lightMine.Intensity = .55f; + + baseMine.Collidable = false; + lightGlobe.Color = new Color(1, 0, 0, .33f); + lightGlobe.Collidable = false; + + Toys.Add(lightGlobe); + Toys.Add(baseMine); + Toys.Add(lightMine); + _light = lightMine; + } + + internal IEnumerator Activate() + { + if (_light == null) throw new System.Exception("no light"); + while (Round.InProgress) + { + _light.Spawn(); + yield return Timing.WaitForSeconds(3); + _light.UnSpawn(); + yield return Timing.WaitForSeconds(5); + } + + } + } +} diff --git a/KruacentExiled/KE.Items/Items/Models/Model.cs b/KruacentExiled/KE.Items/Items/Models/Model.cs new file mode 100644 index 00000000..1ccf6673 --- /dev/null +++ b/KruacentExiled/KE.Items/Items/Models/Model.cs @@ -0,0 +1,39 @@ +using Exiled.API.Features.Toys; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using UnityEngine; + +namespace KE.Items.Items.Models +{ + internal abstract class Model + { + internal Vector3 Position { get; set; } + protected List Toys { get; set; } = new List { }; + internal abstract void Create(Vector3 spawnPos, Quaternion rotation); + + internal void Destroy() + { + foreach (AdminToy primitive in Toys) + { + primitive.Destroy(); + } + } + internal void UnSpawn() + { + foreach (AdminToy primitive in Toys) + { + primitive.UnSpawn(); + } + } + internal void Spawn() + { + foreach (AdminToy primitive in Toys) + { + primitive.Spawn(); + } + } + } +} diff --git a/KruacentExiled/KE.Items/Items/Models/Scp514Model.cs b/KruacentExiled/KE.Items/Items/Models/Scp514Model.cs new file mode 100644 index 00000000..44d65ee1 --- /dev/null +++ b/KruacentExiled/KE.Items/Items/Models/Scp514Model.cs @@ -0,0 +1,23 @@ +using Exiled.API.Features.Toys; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using UnityEngine; +using Light = Exiled.API.Features.Toys.Light; + +namespace KE.Items.Items.Models +{ + internal class Scp514Model : Model + { + internal override void Create(Vector3 spawnPos, Quaternion rotation) + { + Toys.Add(Light.Create(spawnPos, null, Vector3.one / 3, true)); + var p = Primitive.Create(PrimitiveType.Cylinder, spawnPos, null, new Vector3(Scp514.Radius, 5f, Scp514.Radius), true); + p.Color = new(0, 1, 0, .5f); + p.Collidable = false; + Toys.Add(p); + } + } +} diff --git a/KruacentExiled/KE.Items/Items/Molotov.cs b/KruacentExiled/KE.Items/Items/Molotov.cs new file mode 100644 index 00000000..610cd653 --- /dev/null +++ b/KruacentExiled/KE.Items/Items/Molotov.cs @@ -0,0 +1,99 @@ +using System.Collections.Generic; +using Exiled.API.Enums; +using Exiled.API.Features.Attributes; +using Exiled.API.Features.Spawn; +using Exiled.CustomItems.API.Features; +using Exiled.Events.EventArgs.Map; +using KE.Items.Features; +using KE.Items.Interface; +using KE.Items.ItemEffects; +using KE.Items.Items.PickupModels; + +namespace KE.Items.Items +{ + [CustomItem(ItemType.GrenadeFlash)] + public class Molotov : KECustomGrenade, ILumosItem, ISwichableEffect, ICustomPickupModel + { + //bouteille + public override uint Id { get; set; } = 1049; + public override string Name { get; set; } = "Cocktail Molotov"; + public override string Description { get; set; } = "ARSON"; + public override float Weight { get; set; } = 0.65f; + public override float FuseTime { get; set; } = 5f; + public override bool ExplodeOnCollision { get; set; } = true; + public UnityEngine.Color Color { get; set; } = UnityEngine.Color.yellow; + public CustomItemEffect Effect { get; set; } + public PickupModel PickupModel { get; } + public override SpawnProperties SpawnProperties { get; set; } = new SpawnProperties() + { + Limit = 2, + LockerSpawnPoints = new List + { + new LockerSpawnPoint() + { + Chance = 75, + UseChamber = true, + Type = LockerType.Misc, + Zone = ZoneType.Entrance, + }, + new LockerSpawnPoint() + { + Chance = 50, + UseChamber = true, + Type = LockerType.Misc, + Zone = ZoneType.LightContainment, + }, + new LockerSpawnPoint() + { + Chance = 50, + UseChamber = true, + Type = LockerType.Misc, + Zone = ZoneType.HeavyContainment, + }, + }, + + RoomSpawnPoints = new List + { + new RoomSpawnPoint() + { + Chance = 75, + Room = RoomType.LczGlassBox, + }, + new RoomSpawnPoint() + { + Chance = 50, + Room = RoomType.HczNuke, + }, + }, + }; + + + public Molotov() + { + Effect = new MolotovEffect(); + PickupModel = new MolotovPModel(this); + } + + protected override void SubscribeEvents() + { + PickupModel.SubscribeEvents(); + base.SubscribeEvents(); + } + + protected override void UnsubscribeEvents() + { + PickupModel.UnsubscribeEvents(); + base.UnsubscribeEvents(); + } + + + + protected override void OnExploding(ExplodingGrenadeEventArgs ev) + { + + Effect.Effect(ev); + ev.TargetsToAffect.Clear(); + } + + } +} \ No newline at end of file diff --git a/KruacentExiled/KE.Items/Items/PickupModels/MinePModel.cs b/KruacentExiled/KE.Items/Items/PickupModels/MinePModel.cs new file mode 100644 index 00000000..36ed2992 --- /dev/null +++ b/KruacentExiled/KE.Items/Items/PickupModels/MinePModel.cs @@ -0,0 +1,30 @@ +using Exiled.API.Features; +using Exiled.API.Features.Toys; +using KE.Items.Features; +using KE.Utils.API.Models.Blueprints; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using UnityEngine; + +namespace KE.Items.Items.PickupModels +{ + public class MinePModel : PickupModel + { + + public MinePModel(KECustomItem customItem) : base(customItem) { } + + protected override HashSet CreateModel() + { + HashSet model = new HashSet() + { + AdminToyBlueprint.Create(Primitive.Create(PrimitiveType.Cylinder, Vector3.zero, null, new Vector3(.3f, 0.05f, .3f),false,Color.black)), + AdminToyBlueprint.Create(Primitive.Create(PrimitiveType.Sphere, new Vector3(0, 0.05f), null, new Vector3(.05f, .05f, .05f),false,Color.red)), + }; + return model; + + } + } +} diff --git a/KruacentExiled/KE.Items/Items/PickupModels/MolotovPModel.cs b/KruacentExiled/KE.Items/Items/PickupModels/MolotovPModel.cs new file mode 100644 index 00000000..d179a879 --- /dev/null +++ b/KruacentExiled/KE.Items/Items/PickupModels/MolotovPModel.cs @@ -0,0 +1,32 @@ +using Exiled.API.Features; +using Exiled.API.Features.Toys; +using Exiled.CustomItems.API.Features; +using KE.Items.Features; +using KE.Utils.API.Models.Blueprints; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using UnityEngine; + +namespace KE.Items.Items.PickupModels +{ + public class MolotovPModel : PickupModel + { + + public MolotovPModel(CustomItem customItem) : base(customItem) { } + + private Color bottleColor = Color.red; + protected override HashSet CreateModel() + { + HashSet model = new() + { + AdminToyBlueprint.Create(Primitive.Create(PrimitiveType.Cylinder, Vector3.zero, null, new Vector3(.1f, 0.1f, .1f),false,bottleColor)), + AdminToyBlueprint.Create(Primitive.Create(PrimitiveType.Cylinder, new Vector3(0, 0.1f), null, new Vector3(.05f, .04f, .05f),false,bottleColor)), + }; + return model; + + } + } +} diff --git a/KruacentExiled/KE.Items/Items/PickupModels/PickupModel.cs b/KruacentExiled/KE.Items/Items/PickupModels/PickupModel.cs new file mode 100644 index 00000000..29baf44d --- /dev/null +++ b/KruacentExiled/KE.Items/Items/PickupModels/PickupModel.cs @@ -0,0 +1,143 @@ +using Exiled.API.Features; +using Exiled.API.Features.Pickups; +using Exiled.API.Features.Toys; +using Exiled.CustomItems.API.Features; +using InventorySystem.Items.Pickups; +using KE.Utils.API.Models.Blueprints; +using System.Collections.Generic; +using UnityEngine; + +namespace KE.Items.Items.PickupModels +{ + public abstract class PickupModel + { + public CustomItem KECI { get; } + private static HashSet allModels = new(); + + + private HashSet modelBlueprint = null; + private Dictionary> models; + + + public PickupModel(CustomItem customItem) + { + KECI = customItem; + models = new(); + allModels.Add(this); + } + + + protected abstract HashSet CreateModel(); + + protected virtual Vector3 PickupSize { get; set; } = Vector3.one; + + public void SubscribeEvents() + { + ItemPickupBase.OnPickupAdded += OnPickupAdded; + ItemPickupBase.OnPickupDestroyed += OnPickupDestroyed; + } + + + + public void UnsubscribeEvents() + { + ItemPickupBase.OnPickupDestroyed -= OnPickupDestroyed; + ItemPickupBase.OnPickupAdded -= OnPickupAdded; + + foreach (HashSet toys in models.Values) + { + foreach (AdminToy toy in toys) + { + toy.Destroy(); + } + } + } + + public bool Check(Pickup pickup) + { + if (pickup is null) return false; + if (!CustomItem.TryGet(pickup, out CustomItem ci)) return false; + if (ci != KECI) return false; + + return true; + + } + + public static bool AnyCheck(Pickup pickup) + { + foreach(PickupModel model in allModels) + { + + if (model.Check(pickup)) + { + return true; + } + } + return false; + } + + private void OnPickupAdded(ItemPickupBase obj) + { + + Pickup pickup = Pickup.Get(obj); + if (!Check(pickup)) return; + if(modelBlueprint is null) + { + modelBlueprint = CreateModel(); + } + + if(PickupSize != Vector3.one) + { + Log.Debug("set size to "+PickupSize); + pickup.Scale = PickupSize; + } + + + + models.Add(obj, new()); + + foreach (AdminToyBlueprint blueprint in modelBlueprint) + { + //Log.Debug($"adding {obj.name} at ({obj.Position})"); + AdminToy prim = blueprint.Spawn(Vector3.zero); + + if (prim is Primitive p) + p.Collidable = false; + Vector3 offset = prim.Position; + + + prim.Transform.parent = obj.transform; + prim.Transform.localPosition = offset; + prim.Transform.rotation *= pickup.Rotation; + prim.MovementSmoothing = 60; + prim.AdminToyBase.syncInterval = 0f; + + /* + Log.Debug($"prim trans = ({prim?.Transform.parent?.gameObject.name})"); + Log.Debug($"prim localpos = ({prim?.Transform.localPosition})"); + Log.Debug("+ offset =" + offset); + Log.Debug($"prim globalpos = ({prim?.Position})"); + */ + prim.Spawn(); + models[obj].Add(prim); + + } + + + } + + private void OnPickupDestroyed(ItemPickupBase obj) + { + if (!Check(Pickup.Get(obj))) return; + + Log.Debug("Destroyed " + obj.name); + if (models.TryGetValue(obj, out HashSet model)) + { + foreach (AdminToy toy in model) + { + toy.Destroy(); + } + } + } + } +} diff --git a/KruacentExiled/KE.Items/Items/PickupModels/PressePureePModel.cs b/KruacentExiled/KE.Items/Items/PickupModels/PressePureePModel.cs new file mode 100644 index 00000000..59c3c6b1 --- /dev/null +++ b/KruacentExiled/KE.Items/Items/PickupModels/PressePureePModel.cs @@ -0,0 +1,37 @@ +using Exiled.API.Features; +using Exiled.API.Features.Toys; +using Exiled.CustomItems.API.Features; +using KE.Items.Features; +using KE.Utils.API.Models.Blueprints; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using UnityEngine; + +namespace KE.Items.Items.PickupModels +{ + public class PressePureePModel : PickupModel + { + + public PressePureePModel(CustomItem customItem) : base(customItem) { } + + protected override Vector3 PickupSize { get; set; } = new Vector3(.5f, 1.5f, .5f); + + + private static Vector3 manche = new Vector3(.05f, .06f, .1f); + private static Vector3 explosifCharge = new Vector3(.1f, .04f, .1f); + + protected override HashSet CreateModel() + { + HashSet model = new() + { + AdminToyBlueprint.Create(Primitive.Create(PrimitiveType.Cylinder, Vector3.zero, null, manche,false,Color.red)), + AdminToyBlueprint.Create(Primitive.Create(PrimitiveType.Cylinder, new Vector3(0, .1f), null, explosifCharge,false,Color.black)), + }; + return model; + + } + } +} diff --git a/KruacentExiled/KE.Items/Items/PickupModels/Scp3136PModel.cs b/KruacentExiled/KE.Items/Items/PickupModels/Scp3136PModel.cs new file mode 100644 index 00000000..35ee15ed --- /dev/null +++ b/KruacentExiled/KE.Items/Items/PickupModels/Scp3136PModel.cs @@ -0,0 +1,37 @@ +using Exiled.API.Features; +using Exiled.API.Features.Toys; +using Exiled.CustomItems.API.Features; +using KE.Items.Features; +using KE.Utils.API.Models.Blueprints; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using UnityEngine; + +namespace KE.Items.Items.PickupModels +{ + public class Scp3136PModel : PickupModel + { + + public Scp3136PModel(CustomItem customItem) : base(customItem) { } + + protected override Vector3 PickupSize { get; set; } = new Vector3(1f, .1f, 1f); + + + private static Vector3 paper = new Vector3(.5f, .1f, .5f); + private static Vector3 pen = new Vector3(.2f,.5f,.2f); + + protected override HashSet CreateModel() + { + HashSet model = new() + { + AdminToyBlueprint.Create(Primitive.Create(PrimitiveType.Cube, Vector3.zero, null, paper,false,Color.white)), + AdminToyBlueprint.Create(Primitive.Create(PrimitiveType.Cylinder, new Vector3(paper.x, paper.y+pen.x*2,-paper.z), Vector3.left, pen,false,Color.red)), + }; + return model; + + } + } +} diff --git a/KruacentExiled/KE.Items/Items/PressePuree.cs b/KruacentExiled/KE.Items/Items/PressePuree.cs index dd61dddd..e2394321 100644 --- a/KruacentExiled/KE.Items/Items/PressePuree.cs +++ b/KruacentExiled/KE.Items/Items/PressePuree.cs @@ -1,50 +1,81 @@  +using System; using System.Collections.Generic; using Exiled.API.Enums; using Exiled.API.Features; using Exiled.API.Features.Attributes; using Exiled.API.Features.Spawn; using Exiled.CustomItems.API.Features; +using Exiled.Events.EventArgs.Scp914; +using KE.Items.Core.Upgrade; +using KE.Items.Features; +using KE.Items.Interface; +using KE.Items.Items.PickupModels; +using Scp914; namespace KE.Items.Items { [CustomItem(ItemType.GrenadeHE)] - public class PressePuree : CustomGrenade + public class PressePuree : KECustomGrenade, IUpgradableCustomItem, ICustomPickupModel { - public override uint Id { get; set; } = 1406; + //presse puree + public override uint Id { get; set; } = 1046; public override string Name { get; set; } = "Presse Purée"; - public override string Description { get; set; } = "The grenade explode at impact but does less damage"; + public override string Description { get; set; } = "The grenade explode at impact but does less damage\n 5% to upgrade in 914 on very fine"; public override float Weight { get; set; } = 0.65f; public override float FuseTime { get; set; } = 1.5f; public override bool ExplodeOnCollision { get; set; } = true; - public float DamageModifier { get; set; } = 0.9f; + public PickupModel PickupModel { get; } public override SpawnProperties SpawnProperties { get; set; } = new SpawnProperties() { Limit = 5, DynamicSpawnPoints = new List - { - new DynamicSpawnPoint() - { - Chance = 50, - Location = SpawnLocationType.InsideHczArmory, - }, - new DynamicSpawnPoint() - { - Chance =2, - Location = SpawnLocationType.Inside914, - }, - new DynamicSpawnPoint() { - Chance=50, - Location = SpawnLocationType.Inside049Armory, + new DynamicSpawnPoint() + { + Chance = 50, + Location = SpawnLocationType.InsideHczArmory, + }, + new DynamicSpawnPoint() + { + Chance = 5, + Location = SpawnLocationType.Inside914, + }, + new DynamicSpawnPoint() + { + Chance= 50, + Location = SpawnLocationType.Inside049Armory, + }, + new DynamicSpawnPoint() + { + Chance= 50, + Location = SpawnLocationType.InsideLczArmory, + } }, - new DynamicSpawnPoint() - { - Chance=50, - Location = SpawnLocationType.InsideLczArmory, - } - }, + }; + public PressePuree() + { + PickupModel = new PressePureePModel(this); + } + + + protected override void SubscribeEvents() + { + PickupModel.SubscribeEvents(); + base.SubscribeEvents(); + } + + protected override void UnsubscribeEvents() + { + PickupModel.UnsubscribeEvents(); + base.UnsubscribeEvents(); + } + + public IReadOnlyDictionary Upgrade { get; private set; } = new Dictionary() + { + //very fine -> true divine pills 10% + { Scp914KnobSetting.VeryFine,new UpgradeProperties(5, 1055)} }; } } diff --git a/KruacentExiled/KE.Items/Items/SainteGrenada.cs b/KruacentExiled/KE.Items/Items/SainteGrenada.cs new file mode 100644 index 00000000..7a92a4df --- /dev/null +++ b/KruacentExiled/KE.Items/Items/SainteGrenada.cs @@ -0,0 +1,65 @@ + +using System; +using System.Collections.Generic; +using Exiled.API.Enums; +using Exiled.API.Features; +using Exiled.API.Features.Attributes; +using Exiled.API.Features.Items; +using Exiled.API.Features.Spawn; +using Exiled.CustomItems.API.Features; +using Exiled.Events.EventArgs.Map; +using Exiled.Events.EventArgs.Player; +using KE.Items.Features; +using KE.Items.Interface; +using UnityEngine; + +namespace KE.Items.Items +{ + [CustomItem(ItemType.GrenadeHE)] + public class SainteGrenada : KECustomGrenade, ILumosItem + { + public override uint Id { get; set; } = 1055; + public override string Name { get; set; } = "Sainte Grenada"; + public override string Description { get; set; } = "Worms reference !?"; + public override float Weight { get; set; } = 1.5f; + public override float FuseTime { get; set; } = 6f; + public override bool ExplodeOnCollision { get; set; } = false; + public float DamageModifier { get; set; } = 3f; + public Color Color { get; set; } = Color.red; + + + // + public int NbGrenadeSpawned { get; set; } = 4; + public float SpawnRadius { get; set; } = 5f; + public float GrenadeSize { get; set; } = 4f; + // + + + public override SpawnProperties SpawnProperties { get; set; } = new SpawnProperties() + { + + }; + + protected override void OnThrownProjectile(ThrownProjectileEventArgs ev) + { + Utils.API.Sounds.SoundPlayer.Instance.Play("worms", ev.Projectile.GameObject, 50, 75); + } + protected override void OnExploding(ExplodingGrenadeEventArgs ev) + { + ev.Projectile.Scale = new Vector3(GrenadeSize, GrenadeSize, GrenadeSize); + + for (int i = 0; i < NbGrenadeSpawned; i++) + { + float angle = UnityEngine.Random.Range(0f, 360f) * Mathf.Deg2Rad; + Vector3 offset = new Vector3(Mathf.Cos(angle), 0, Mathf.Sin(angle)) * SpawnRadius; + + Vector3 spawnPosition = ev.Position + offset; + + ExplosiveGrenade grenade = (ExplosiveGrenade)Item.Create(ItemType.GrenadeHE); + grenade.SpawnActive(spawnPosition).FuseTime = 0f; + } + + + } + } +} diff --git a/KruacentExiled/KE.Items/Items/Scp1650.cs b/KruacentExiled/KE.Items/Items/Scp1650.cs new file mode 100644 index 00000000..0a83d46c --- /dev/null +++ b/KruacentExiled/KE.Items/Items/Scp1650.cs @@ -0,0 +1,64 @@ +using Exiled.API.Features; +using Exiled.API.Features.Attributes; +using Exiled.API.Features.Spawn; +using Exiled.CustomItems.API.Features; +using Exiled.Events.EventArgs.Player; +using KE.Items.Features; +using KE.Items.Interface; +using KE.Items.ItemEffects; +using MEC; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using UnityEngine; +using PlayerHandle = Exiled.Events.Handlers.Player; + + +namespace KE.Items.Items +{ + [CustomItem(ItemType.Painkillers)] + public class Scp1650 : KECustomItem, ISwichableEffect + { + //mamie + public override uint Id { get; set; } = 1056; + public override string Name { get; set; } = "SCP-1650"; + public override string Description { get; set; } = "ויאמר ה' ל— סח השמן על בשרך ולך בינות ה— כששם אלוהים על שפתיך, וזעם ה' וחרון אפו ו— דם המכבים יטהר בית מקדשו אחריך, לנצח נצחים"; + public override float Weight { get; set; } = 0.65f; + public CustomItemEffect Effect { get; set; } + + public override SpawnProperties SpawnProperties { get; set; } = new SpawnProperties() + { + Limit = 1, + LockerSpawnPoints = new List() + { + new LockerSpawnPoint() + { + Type = Exiled.API.Enums.LockerType.Scp207Pedestal, + UseChamber = true, + } + } + }; + + public Scp1650() + { + Effect = new Scp1650Effect(); + } + + protected override void SubscribeEvents() + { + PlayerHandle.UsedItem += OnUsedItem; + } + protected override void UnsubscribeEvents() + { + PlayerHandle.UsedItem -= OnUsedItem; + } + + private void OnUsedItem(UsedItemEventArgs ev) + { + if (!Check(ev.Item)) return; + Effect.Effect(ev); + } + } +} diff --git a/KruacentExiled/KE.Items/Items/Scp3136.cs b/KruacentExiled/KE.Items/Items/Scp3136.cs new file mode 100644 index 00000000..32a84ab7 --- /dev/null +++ b/KruacentExiled/KE.Items/Items/Scp3136.cs @@ -0,0 +1,94 @@ +using Exiled.API.Enums; +using Exiled.API.Features; +using Exiled.API.Features.Attributes; +using Exiled.API.Features.Items; +using Exiled.API.Features.Spawn; +using Exiled.CustomItems.API.Features; +using Exiled.Events.EventArgs.Player; +using Exiled.Events.EventArgs.Server; +using KE.Items.Features; +using MEC; +using PlayerRoles; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using UnityEngine; + +namespace KE.Items.Items +{ + [CustomItem(ItemType.SCP1576)] + public class Scp3136 : KECustomItem + { + public override uint Id { get; set; } = 1057; + public override string Name { get; set; } = "SCP-3136"; + public override string Description { get; set; } = "A map of the facility, you could draw your friends next to you"; + public override float Weight { get; set; } = 0.65f; + + private Dictionary _respawnPositions = new Dictionary + { + { Faction.FoundationStaff , Vector3.zero}, + { Faction.FoundationEnemy , Vector3.zero} + }; + + public override SpawnProperties SpawnProperties { get; set; } = new SpawnProperties() + { + Limit = 1, + LockerSpawnPoints = new List() + { + new LockerSpawnPoint() + { + Type = Exiled.API.Enums.LockerType.Scp1576Pedestal, + UseChamber = true, + Chance = .5f + } + } + }; + + protected override void SubscribeEvents() + { + Exiled.Events.Handlers.Player.UsedItem += OnDrawing; + Exiled.Events.Handlers.Server.RespawnedTeam += OnRespawnedTeam; + base.SubscribeEvents(); + } + protected override void UnsubscribeEvents() + { + Exiled.Events.Handlers.Player.UsedItem -= OnDrawing; + Exiled.Events.Handlers.Server.RespawnedTeam -= OnRespawnedTeam; + base.UnsubscribeEvents(); + } + + private void OnDrawing(UsedItemEventArgs ev) + { + if (!Check(ev.Item)) return; + switch (ev.Player.Role.Side) + { + case Side.Mtf: + _respawnPositions[Faction.FoundationStaff] = ev.Player.Position; + break; + case Side.ChaosInsurgency: + case Side.Tutorial: + _respawnPositions[Faction.FoundationEnemy] = ev.Player.Position; + break; + } + Timing.CallDelayed(1, () => ((Scp1576)ev.Item).StopTransmitting()); + + } + + private void OnRespawnedTeam(RespawnedTeamEventArgs ev) + { + Vector3 spawnPos = _respawnPositions[ev.Wave.TargetFaction]; + if (spawnPos == Vector3.zero) return; + + foreach (Player player in ev.Players) + { + player.Teleport(spawnPos); + _respawnPositions[ev.Wave.TargetFaction] = Vector3.zero; + } + } + + + + } +} diff --git a/KruacentExiled/KE.Items/Items/Scp514.cs b/KruacentExiled/KE.Items/Items/Scp514.cs new file mode 100644 index 00000000..1f6012f9 --- /dev/null +++ b/KruacentExiled/KE.Items/Items/Scp514.cs @@ -0,0 +1,160 @@ +using Exiled.API.Features; +using Exiled.API.Features.Attributes; +using Exiled.API.Features.Spawn; +using Exiled.Events.EventArgs.Interfaces; +using Exiled.Events.EventArgs.Item; +using Exiled.Events.EventArgs.Player; +using KE.Items.Features; +using KE.Items.Items.Models; +using MEC; +using System.Collections.Generic; +using System.Diagnostics; +using System.Linq; +using UnityEngine; +using Player = Exiled.API.Features.Player; + +namespace KE.Items.Items +{ + [CustomItem(ItemType.Flashlight)] + public class Scp514 : KECustomItem + { + public override uint Id { get; set; } = 1070; + public override string Name { get; set; } = "SCP-514"; + public override string Description { get; set; } = "birb"; + public override float Weight { get; set; } = 0.65f; + public float TimeActive { get; set; } = 5; + public static float Radius { get; set; } = 5; + public override SpawnProperties SpawnProperties { get; set; } = null; + private HashSet _affectedPlayers = new HashSet(); + + + protected override void SubscribeEvents() + { + Exiled.Events.Handlers.Player.Shooting += OnShooting; + Exiled.Events.Handlers.Player.UsingMicroHIDEnergy += OnUsingMicroHIDEnergy; + Exiled.Events.Handlers.Player.Dying += OnDying; + Exiled.Events.Handlers.Scp049.Attacking += OnAttacking049; + Exiled.Events.Handlers.Scp106.Attacking += OnAttacking106; + Exiled.Events.Handlers.Item.ChargingJailbird += OnChargingJailbird; + base.SubscribeEvents(); + } + + protected override void UnsubscribeEvents() + { + Exiled.Events.Handlers.Player.Shooting -= OnShooting; + Exiled.Events.Handlers.Player.Dying -= OnDying; + Exiled.Events.Handlers.Player.UsingMicroHIDEnergy -= OnUsingMicroHIDEnergy; + Exiled.Events.Handlers.Scp049.Attacking -= OnAttacking049; + Exiled.Events.Handlers.Scp106.Attacking -= OnAttacking106; + Exiled.Events.Handlers.Item.ChargingJailbird -= OnChargingJailbird; + base.UnsubscribeEvents(); + } + + private void Disallow(IDeniableEvent ev) + { + if(ev is IPlayerEvent p) + { + if (_affectedPlayers.Contains(p.Player)) + { + ev.IsAllowed = false; + } + } + + } + + private void OnUsingMicroHIDEnergy(UsingMicroHIDEnergyEventArgs ev) + { + Disallow(ev); + } + private void OnChargingJailbird(ChargingJailbirdEventArgs ev) + { + if (_affectedPlayers.Contains(ev.Player)) + ev.IsAllowed = false; + } + private void OnAttacking106(Exiled.Events.EventArgs.Scp106.AttackingEventArgs ev) + { + Disallow(ev); + } + + private void OnAttacking049(Exiled.Events.EventArgs.Scp049.AttackingEventArgs ev) + { + Disallow(ev); + } + private void OnDying(DyingEventArgs ev) + { + Disallow(ev); + + } + private void OnShooting(ShootingEventArgs ev) + { + Disallow(ev); + } + protected override void OnDroppingItem(DroppingItemEventArgs ev) + { + if (ev.IsThrown) + { + return; + } + ev.Item.Destroy(); + Vector3 pos = ev.Player.Position; + Scp514Model cage = new(); + + cage.Create(pos,new()); + + Timing.RunCoroutine(DoEffectIfInside(Radius,pos,cage)); + + + + } + + + private IEnumerator DoEffectIfInside(float radius,Vector3 spawnPos, Scp514Model model) + { + var time= Stopwatch.StartNew(); + Log.Debug("starting effect"); + while(time.Elapsed.TotalSeconds <= TimeActive) + { + foreach(Player p in Player.List) + { + if (IsPlayerInZone(p, spawnPos, radius)) + { + if (_affectedPlayers.Add(p)) + { + p.IsGodModeEnabled = true; + Log.Debug("adding " + p.Id); + } + + + } + else + { + if (_affectedPlayers.Remove(p)) + { + p.IsGodModeEnabled = false; + Log.Debug("removing" + p.Id); + } + } + } + yield return Timing.WaitForOneFrame; + } + Log.Debug("ending effects"); + time.Stop(); + + foreach(var p in _affectedPlayers) + { + p.IsGodModeEnabled = false; + } + _affectedPlayers.Clear(); + model.Destroy(); + } + + + + private bool IsPlayerInZone(Player player, Vector3 zonePosition, float radius) + { + float distance = Vector3.Distance(new Vector3(player.Position.x, 0, player.Position.z), + new Vector3(zonePosition.x, 0, zonePosition.z)); + return distance <= (radius / 2); + } + } +} diff --git a/KruacentExiled/KE.Items/Items/Scp7045.cs b/KruacentExiled/KE.Items/Items/Scp7045.cs new file mode 100644 index 00000000..fa3706f0 --- /dev/null +++ b/KruacentExiled/KE.Items/Items/Scp7045.cs @@ -0,0 +1,219 @@ +using Exiled.API.Enums; +using Exiled.API.Extensions; +using Exiled.API.Features; +using Exiled.API.Features.Attributes; +using Exiled.API.Features.Items; +using Exiled.API.Features.Spawn; +using Exiled.API.Features.Toys; +using Exiled.CustomItems.API.Features; +using Exiled.Events.EventArgs.Player; +using Exiled.Events.EventArgs.Server; +using KE.Items.Features; +using MEC; +using PlayerRoles; +using System; +using System.Collections.Generic; +using System.Data; +using System.Diagnostics.Tracing; +using System.Drawing.Imaging; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using UnityEngine; +using VoiceChat.Codec; +using VoiceChat.Codec.Enums; +using VoiceChat.Networking; + +namespace KE.Items.Items +{ + //[CustomItem(ItemType.SCP1576)] + [Obsolete("Scrapped - Can't make a good sound quality without external file")] + public class Scp7045 : KECustomItem + { + + private static readonly OpusDecoder _decoder = new(); + private static readonly OpusEncoder _encoder = new(OpusApplicationType.Voip); + private static readonly Dictionary _speakers = new(); + public override uint Id { get; set; } = 1800; + public override string Name { get; set; } = "SCP-7045"; + public override string Description { get; set; } = "A weird looking radio"; + public override float Weight { get; set; } = 0.65f; + + public override SpawnProperties SpawnProperties { get; set; } = new SpawnProperties() + { + Limit = 1, + LockerSpawnPoints = new List() + { + new LockerSpawnPoint() + { + Type = LockerType.Scp1576Pedestal, + UseChamber = true, + Chance = .5f + } + } + }; + + protected override void SubscribeEvents() + { + Exiled.Events.Handlers.Player.UsedItem += OnUsedItem; + Exiled.Events.Handlers.Player.VoiceChatting += OnVoiceChatting; + base.SubscribeEvents(); + + } + protected override void UnsubscribeEvents() + { + Exiled.Events.Handlers.Player.UsedItem -= OnUsedItem; + Exiled.Events.Handlers.Player.VoiceChatting -= OnVoiceChatting; + base.UnsubscribeEvents(); + } + + private bool _isItemActive = false; + + private void OnUsedItem(UsedItemEventArgs ev) + { + if (!Check(ev.Item)) return; + + Scp1576 item = (Scp1576)ev.Item; + item.StopTransmitting(); + + if (!_isItemActive) + { + _isItemActive = true; + _recordingBuffer.Clear(); + _isRecording = true; + _lastVoiceTime = Time.time; + Log.Info("Recording"); + + Timing.RunCoroutine(CheckIfRecordingFinished(item, ev.Player)); + } + else + { + _isItemActive = false; + _isRecording = false; + Log.Info("Playing"); + + Log.Info("buffer : " + _recordingBuffer.ToArray().Count()); + if (_recordingBuffer.Count > 0) + { + byte speakerid = (byte)ev.Player.Id; + + + if (!_speakers.TryGetValue(ev.Player, out Speaker _)) + _speakers[ev.Player] = Speaker.Create(speakerid, ev.Player.Position); + + _speakers[ev.Player].Position = ev.Player.Position; + + Timing.RunCoroutine(PlayVoice([.. _recordingBuffer], (byte)ev.Player.Id, ev.Player)); + } + + + } + } + + + + public const int sampleSize = 480; + + private List _recordingBuffer = new(); + private bool _isRecording = false; + private float _lastVoiceTime = 0f; // Timestamp of last voice packet + private void OnVoiceChatting(VoiceChattingEventArgs ev) + { + if (!_isItemActive || !Check(ev.Player.CurrentItem)) return; + + Speaker speaker; + byte speakerid = (byte)ev.Player.Id; + if (!_speakers.TryGetValue(ev.Player, out speaker)) + { + _speakers[ev.Player] = Speaker.Create(speakerid, ev.Player.Position); + } + speaker = _speakers[ev.Player]; + + VoiceMessage message = ev.VoiceMessage; + + // Si on est en mode enregistrement et que l'item est activé, on enregistre la voix + if (_isRecording) + { + _recordingBuffer.AddRange(message.Data); + + // Mettre à jour le timestamp de la dernière voix reçue + _lastVoiceTime = Time.time; + } + } + + private IEnumerator CheckIfRecordingFinished(Scp1576 item, Player p) + { + while (_isRecording) + { + yield return Timing.WaitForSeconds(0.2f); + + if (Time.time - _lastVoiceTime >= 0.5f) + { + _isRecording = false; + Log.Info($"Final recorded voice message length: {_recordingBuffer.Count} samples."); + + } + } + + TeleportItem(item, p); + } + + private IEnumerator PlayVoice(byte[] data, byte speakerid, Player player) + { + Log.Info("message for " +player.Nickname); + foreach (var chunk in SplitData(data, 512)) + { + var message = new AudioMessage(speakerid, chunk, chunk.Length); + player.ReferenceHub.connectionToClient.Send(message); + yield return Timing.WaitForSeconds(0.1f); + } + + Log.Info("end message"); + + } + private IEnumerable SplitData(byte[] data, int chunkSize) + { + for (int i = 0; i < data.Length; i += chunkSize) + { + int size = Math.Min(chunkSize, data.Length - i); + byte[] chunk = new byte[size]; + Array.Copy(data, i, chunk, 0, size); + yield return chunk; + } + //78336 + } + + + private void TeleportItem(Scp1576 item, Player p) + { + Player nextPlayer = Player.List.Where(x => x.IsHuman && x != p).GetRandomValue(); + + Log.Info("NextPlayer : " + nextPlayer); + + Room closeRoom = FindNearbyRoom(nextPlayer, 2); + + Log.Info("Room : " + closeRoom); + + + + Spawn(closeRoom.Position, p); + p.RemoveItem(item, false); + } + + private Room FindNearbyRoom(Player p, int depth) + { + if (p == null) return Room.Random(); + + HashSet rooms = new HashSet(p.CurrentRoom.NearestRooms); + for (int i = 0; i < depth; i++) + { + // Copier les nouvelles rooms avant de les ajouter + HashSet newRooms = new HashSet(rooms.SelectMany(r => r.NearestRooms)); + rooms.UnionWith(newRooms); + } + + // Si rooms est vide, on retourne une salle aléatoire + return rooms.Count > 0 ? rooms.GetRandomValue() : Room.Random(); + } + } +} \ No newline at end of file diff --git a/KruacentExiled/KE.Items/Items/TPGrenada.cs b/KruacentExiled/KE.Items/Items/TPGrenada.cs index b4f212b4..6803d2a6 100644 --- a/KruacentExiled/KE.Items/Items/TPGrenada.cs +++ b/KruacentExiled/KE.Items/Items/TPGrenada.cs @@ -9,28 +9,29 @@ using Exiled.API.Features.Spawn; using Exiled.CustomItems.API.Features; using Exiled.Events.EventArgs.Map; +using KE.Items.Features; using KE.Items.Interface; +using KE.Items.ItemEffects; using PlayerRoles; using UnityEngine; namespace KE.Items.Items { - //grenade qui tp [CustomItem(ItemType.GrenadeHE)] - public class TPGrenada : CustomGrenade, ILumosItem + public class TPGrenada : KECustomGrenade, ILumosItem, ISwichableEffect { - private List effectedPlayers = new List(); - public override uint Id { get; set; } = 1405; + + public override uint Id { get; set; } = 1045; public override string Name { get; set; } = "Teleportation Grenade"; public override string Description { get; set; } = "This grenade does 0 damage but teleport nearby players in a random place (does work in other dimension ;3 )"; public override float Weight { get; set; } = 0.65f; - public override float FuseTime { get; set; } = 1.5f; - public override bool ExplodeOnCollision { get; set; } = true; - public float DamageModifier { get; set; } = 0.05f; + public override float FuseTime { get; set; } = 3f; + public override bool ExplodeOnCollision { get; set; } = false; public UnityEngine.Color Color { get; set; } = UnityEngine.Color.cyan; + public CustomItemEffect Effect { get; set; } public override SpawnProperties SpawnProperties { get; set; } = new SpawnProperties() { - Limit = 5, + Limit = 3, DynamicSpawnPoints = new List { new DynamicSpawnPoint() @@ -57,74 +58,19 @@ public class TPGrenada : CustomGrenade, ILumosItem }; - [Description("What roles will not be able to be affected by Implosion Grenades. Keeping SCP-173 on this list is highly recommended.")] - public HashSet BlacklistedRoles { get; set; } = new HashSet() { RoleTypeId.Scp173, RoleTypeId.Scp106,RoleTypeId.Scp049, RoleTypeId.Scp096,RoleTypeId.Scp3114,RoleTypeId.Scp0492,RoleTypeId.Scp939 }; + public TPGrenada() + { + Effect = new TPGrenadaEffect(); + } protected override void OnExploding(ExplodingGrenadeEventArgs ev) { - ev.IsAllowed = false; - List copiedList = new List(); - foreach (Player player in ev.TargetsToAffect) - { - copiedList.Add(player); - } - + + Effect.Effect(ev); ev.TargetsToAffect.Clear(); - - effectedPlayers = ListPool.Pool.Get(); - foreach (Player player in copiedList) - { - if (BlacklistedRoles.Contains(player.Role)) - continue; - try - { - - bool line = Physics.Linecast(ev.Projectile.Transform.position, player.Position); - if (line) - { - effectedPlayers.Add(player); - player.Teleport(RandomRoom()); - } - } - catch (Exception exception) - { - Log.Error($"{nameof(OnExploding)} error: {exception}"); - } - } } - - private Room RandomRoom() - { - Room room = Room.Random(); - if (Warhead.IsDetonated) - { - return Room.Random(ZoneType.Surface); - } - - if(Map.IsLczDecontaminated) - { - float random = UnityEngine.Random.value; - Log.Debug($"random={random}"); - if (random <= 0.33f) - { - return Room.Random(ZoneType.HeavyContainment); - } - if(random > 0.33f && random <= 0.66f) - { - return Room.Random(ZoneType.Entrance); - } - return Room.Random(ZoneType.Surface); - } - Log.Debug($"roomZone={room.Zone}"); - return room; - } } - //bonbon quand tu manges ça donne une armes random - /*public class RandomWeaponCandy : CustomItem - { - - }*/ } diff --git a/KruacentExiled/KE.Items/Items/TrueDivinePills.cs b/KruacentExiled/KE.Items/Items/TrueDivinePills.cs new file mode 100644 index 00000000..dc0f5df4 --- /dev/null +++ b/KruacentExiled/KE.Items/Items/TrueDivinePills.cs @@ -0,0 +1,116 @@ +using System.Collections.Generic; +using Exiled.API.Enums; +using Exiled.API.Features.Attributes; +using Exiled.API.Features.Spawn; +using Exiled.CustomItems.API.Features; +using MEC; +using Exiled.Events.EventArgs.Player; +using PlayerHandle = Exiled.Events.Handlers.Player; +using Exiled.API.Features; +using Exiled.API.Extensions; +using UnityEngine; +using CustomPlayerEffects; +using System.Linq; +using PlayerRoles; +using KE.Items.Interface; +using Exiled.CustomItems.API.EventArgs; +using Exiled.Events.EventArgs.Scp914; +using KE.Items.Features; + +/// +[CustomItem(ItemType.SCP500)] +public class TrueDivinePills : KECustomItem, ILumosItem +{ + /// + public override uint Id { get; set; } = 1050; + + /// + public override string Name { get; set; } = "True Divine Pills"; + + /// + public override string Description { get; set; } = "Guaranteed to respawn everybody"; + + /// + public override float Weight { get; set; } = 0.65f; + public Color Color { get; set; } = Color.yellow; + private bool tp = false; + + /// + public override SpawnProperties SpawnProperties { get; set; } = new SpawnProperties() + { + + }; + + /// + protected override void SubscribeEvents() + { + PlayerHandle.UsingItem += OnUsingItem; + base.SubscribeEvents(); + } + + /// + protected override void UnsubscribeEvents() + { + PlayerHandle.UsingItem -= OnUsingItem; + base.UnsubscribeEvents(); + } + + protected override void OnDroppingItem(DroppingItemEventArgs ev) + { + if (!Check(ev.Item)) + return; + + if (ev.IsThrown) + { + ev.IsAllowed = true; + return; + } + Player player = ev.Player; + + tp = !tp; + if (tp) + KECustomItem.ItemEffectHint(player, "Players will spawn to you"); + else + KECustomItem.ItemEffectHint(player, "Players won't spawn to you"); + ev.IsAllowed = false; + + + + } + + private void OnUsingItem(UsingItemEventArgs ev) + { + if (!Check(ev.Item)) + return; + Player player = ev.Player; + Log.Debug(Player.List.Count); + Log.Debug(Player.List.Where(x => x.Role == RoleTypeId.Spectator).Count()); + + if (Player.List.Where(x => x.Role == RoleTypeId.Spectator).Count() == 0) + { + KECustomItem.ItemEffectHint(player, "No one to respawn"); + ev.IsAllowed = false; + return; + } + + + Player.List.Where(x => x.Role == RoleTypeId.Spectator).ToList().ForEach(x => + { + switch (player.Role.Side) + { + case Side.ChaosInsurgency: + x.Role.Set(RoleTypeId.ChaosRifleman); + break; + case Side.Mtf: + x.Role.Set(RoleTypeId.NtfPrivate); + break; + } + if (tp) + { + x.Teleport(player); + } + }); + + } + +} \ No newline at end of file diff --git a/KruacentExiled/KE.Items/KE.Items.csproj b/KruacentExiled/KE.Items/KE.Items.csproj index fee0f33f..8fdcfb6c 100644 --- a/KruacentExiled/KE.Items/KE.Items.csproj +++ b/KruacentExiled/KE.Items/KE.Items.csproj @@ -1,11 +1,16 @@  + 13.0 net48 - + + + + + @@ -16,6 +21,15 @@ + + + + if not "$(EXILED_DEV_REFERENCES)"=="" copy /y "$(OutputPath)$(AssemblyName).dll" "$(EXILED_DEV_REFERENCES)\Plugins\" + + + if [[ ! -z "$EXILED_DEV_REFERENCES" ]]; then cp "$(OutputPath)$(AssemblyName).dll" "$EXILED_DEV_REFERENCES/Plugins/"; fi + + diff --git a/KruacentExiled/KE.Items/MainPlugin.cs b/KruacentExiled/KE.Items/MainPlugin.cs index 05ddbc93..21f0387c 100644 --- a/KruacentExiled/KE.Items/MainPlugin.cs +++ b/KruacentExiled/KE.Items/MainPlugin.cs @@ -1,127 +1,84 @@  +using Exiled.API.Enums; +using Exiled.API.Extensions; using Exiled.API.Features; -using Exiled.API.Features.Pickups; using Exiled.API.Features.Toys; using Exiled.CustomItems.API.Features; -using Exiled.Events.EventArgs.Player; -using KE.Items.Interface; -using MEC; +using KE.Items.Core.Lights; +using KE.Items.Core.Settings; +using KE.Items.Core.Upgrade; +using KE.Items.Items.PickupModels; +using KE.Utils.API.Displays.DisplayMeow; +using KE.Utils.API.Sounds; +using KE.Utils.Quality.Tests; using System; -using System.Collections.Generic; -using System.Linq; +using Light = Exiled.API.Features.Toys.Light; namespace KE.Items { public class MainPlugin : Plugin { public override string Author => "Patrique & OmerGS"; - public override string Name => "KEItems"; + public override string Name => "KE.Items"; + public override string Prefix => "KE.I"; + internal UpgradeHandler UpgradeHandler { get; private set; } + internal LightsHandler LightsHandler { get; private set; } internal static MainPlugin Instance { get; private set; } - public override Version Version => new Version(1, 0, 0); - private Dictionary pl = new Dictionary(); + internal SettingsHandler SettingsHandler { get; private set; } + + internal static readonly HintPlacement ItemEffectPlacement = new(0, 200, HintServiceMeow.Core.Enum.HintAlignment.Center); + internal static readonly HintPlacement HintPlacement = new(0, 400, HintServiceMeow.Core.Enum.HintAlignment.Center); + + //scrapped + //internal PickupQuality PickupQuality { get; private set; } + //internal QualityHandler QualityHandler { get; private set; } + + public override PluginPriority Priority => PluginPriority.Low; + public override Version Version => new (1, 0, 0); + public override void OnEnabled() { Instance = this; - CustomItem.RegisterItems(); - Exiled.Events.Handlers.Player.DroppedItem += Drop; - Exiled.Events.Handlers.Player.PickingUpItem += Pick; - Exiled.Events.Handlers.Server.RoundStarted += OnRoundStarted; + //QualityHandler = QualityHandler.Instance; + //QualityHandler.Register(); + UpgradeHandler = new UpgradeHandler(); + LightsHandler = new LightsHandler(); + //PickupQuality = new PickupQuality(); + SettingsHandler = new(); + + Utils.API.Sounds.SoundPlayer.Load(); + //Exiled.Events.Handlers.Server.RoundStarted += Test; + + + CustomItem.RegisterItems(); + //PickupQuality?.SubscribeEvents(); + SettingsHandler.SubscribeEvents(); + UpgradeHandler.SubscribeEvents(); + LightsHandler.SubscribeEvents(); base.OnEnabled(); } public override void OnDisabled() { CustomItem.UnregisterItems(); - Exiled.Events.Handlers.Player.DroppedItem -= Drop; - Exiled.Events.Handlers.Player.PickingUpItem -= Pick; - Exiled.Events.Handlers.Server.RoundStarted -= OnRoundStarted; + UpgradeHandler?.UnsubscribeEvents(); + LightsHandler?.UnsubscribeEvents(); + //PickupQuality?.UnsubscribeEvents(); + //QualityHandler?.Unregister(); + SettingsHandler.UnsubscribeEvents(); - base.OnDisabled(); + //QualityHandler = null; + //PickupQuality = null; + SettingsHandler = null; + LightsHandler = null; + UpgradeHandler = null; Instance = null; } - public void Pick(PickingUpItemEventArgs ev) - { - Pickup pickup = ev.Pickup; - if (pl.ContainsKey(pickup)) - { - Light val = pl[pickup]; - if (val != null) - { - val.UnSpawn(); - val.Destroy(); - } - pl.Remove(pickup); - } - } - public void Drop(DroppedItemEventArgs ev) - { - Pickup pickup = ev.Pickup; - if (CustomItem.TryGet(pickup, out CustomItem item) && item is ILumosItem ci) - { - pl.Add(pickup, null); - } - - } - public void OnRoundStarted() - { - Timing.RunCoroutine(LightP()); - } - - internal IEnumerator LightP() - { - - foreach (var p in Pickup.List) - { - if (p != null) - { - if (CustomItem.TryGet(p, out CustomItem ci) && ci is ILumosItem) - pl.Add(p, null); - } - } - while (Round.InProgress) - { - Log.Debug("boop"); - foreach (var x in pl.ToList()) - { - if(CustomItem.TryGet(x.Key, out CustomItem cui) && cui is ILumosItem ci) - { - Light light = Light.Create(x.Key.Position, null, null, true, ci.Color); - light.Intensity = 0.5f; - Log.Debug("preif"); - if (x.Value != null) - { - Log.Debug("pre val"); - Light val = x.Value; - Log.Debug($"destroy light {val.Position}"); - val.UnSpawn(); - Log.Debug("pre destroy"); - val.Destroy(); - } - else - Log.Debug("first cretate"); - Log.Debug("reasigne"); - pl[x.Key] = light; - Log.Debug("post reasigne"); - //Log.Debug(x.Key.Position+";"+x.Value.Position); - } - else - { - Light val = x.Value; - val.UnSpawn(); - val.Destroy(); - pl.Remove(x.Key); - } - } - Log.Debug("waiting"); - yield return Timing.WaitForSeconds(0.1f); - } - Log.Debug("end while"); - } } } \ No newline at end of file diff --git a/KruacentExiled/KE.Items/README.md b/KruacentExiled/KE.Items/README.md new file mode 100644 index 00000000..65cad6cb --- /dev/null +++ b/KruacentExiled/KE.Items/README.md @@ -0,0 +1,21 @@ +# Custom Items + +| ID | Item Name | Description | +|--------|-----------------------|--------------------| +| 1041 | Defibrillator | Used to revive a player. | +| 1042 | Adrenaline Drogue | Temporarily boosts a player's abilities. | +| 1043 | No Item | No item associated. | +| 1044 | No Item | No item associated. | +| 1045 | TP Granada | Teleporting grenade. | +| 1046 | PressePurée | Grenade explode at impact | +| 1047 | Divine Pill | Respawn a random spectator. | +| 1048 | Deployable Wall | Creates a temporary wall. | +| 1049 | Molotov | Create a damage zone | +| 1050 | True Divine Pills | Respawn every spectator. | +| 1051 | Heal Zone | Area that heals allies. | +| 1052 | Impact Flash | Flash exploding at impact. | +| 1053 | Mine | Explosive mine. | + +## Description + +Each row in the table lists a custom item with its ID and a brief description. The ID is used to identify each item, and the description explains briefly what the item does. diff --git a/KruacentExiled/KE.Misc/Candy.cs b/KruacentExiled/KE.Misc/Candy.cs new file mode 100644 index 00000000..61b1fb7d --- /dev/null +++ b/KruacentExiled/KE.Misc/Candy.cs @@ -0,0 +1,22 @@ +using Exiled.Events.EventArgs.Scp330; +using Exiled.Events.Patches.Events.Scp330; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using InventorySystem.Items.Usables.Scp330; + +namespace KE.Misc +{ + internal class Candy + { + public void InteractingScp330(InteractingScp330EventArgs ev) + { + if(UnityEngine.Random.Range(0, 100) < MainPlugin.Instance.Config.ChancePinkCandy) + { + ev.Candy = CandyKindID.Pink; + } + } + } +} diff --git a/KruacentExiled/KE.Misc/Config.cs b/KruacentExiled/KE.Misc/Config.cs index d133b746..8138bbee 100644 --- a/KruacentExiled/KE.Misc/Config.cs +++ b/KruacentExiled/KE.Misc/Config.cs @@ -17,5 +17,8 @@ public class Config : IConfig public bool PeanutLockDown { get; set; } = true; [Description("Enable or disable the auto elevator")] public bool AutoElevator { get; set; } = true; + [Description("Chance to get a pink candy (0-100)")] + public int ChancePinkCandy { get; set; } = 10; + public bool SurfaceLight { get; set; } = true; } } diff --git a/KruacentExiled/KE.Misc/MainPlugin.cs b/KruacentExiled/KE.Misc/MainPlugin.cs index 0c247056..968a1b67 100644 --- a/KruacentExiled/KE.Misc/MainPlugin.cs +++ b/KruacentExiled/KE.Misc/MainPlugin.cs @@ -23,6 +23,8 @@ public class MainPlugin : Plugin internal _914 _914 { get; private set; } internal AutoElevator AutoElevator { get; private set; } internal ClassDDoor ClassDDoor { get; private set; } + internal Candy Candy { get; private set; } + internal SurfaceLight SurfaceLight { get; private set; } public override void OnEnabled() { @@ -30,11 +32,23 @@ public override void OnEnabled() _914 = new _914(); AutoElevator = new AutoElevator(); ClassDDoor = new ClassDDoor(); + SurfaceLight = new SurfaceLight(); ServerHandler = new ServerHandler(); + if (Instance.Config.ChancePinkCandy >= 0 && Instance.Config.ChancePinkCandy <= 100) + { + Candy = new Candy(); + Exiled.Events.Handlers.Scp330.InteractingScp330 += Candy.InteractingScp330; + } + else + { + Log.Error("ChancePinkCandy must be between 0 and 100"); + } + ServerHandle.RoundStarted += ServerHandler.OnRoundStarted; Nine14Handle.UpgradingPlayer += _914.OnUpgradingPlayer; Exiled.Events.Handlers.Player.Dying += ScpNoeDeathMessage; + } @@ -43,12 +57,20 @@ public override void OnDisabled() ServerHandle.RoundStarted -= ServerHandler.OnRoundStarted; Nine14Handle.UpgradingPlayer -= _914.OnUpgradingPlayer; Exiled.Events.Handlers.Player.Dying -= ScpNoeDeathMessage; + if (Instance.Config.ChancePinkCandy >= 0 && Instance.Config.ChancePinkCandy <= 100) + { + Exiled.Events.Handlers.Scp330.InteractingScp330 -= Candy.InteractingScp330; + Candy = null; + } + + _914 = null; ClassDDoor = null; ServerHandler = null; AutoElevator = null; Instance = null; + SurfaceLight = null; } diff --git a/KruacentExiled/KE.Misc/ServerHandler.cs b/KruacentExiled/KE.Misc/ServerHandler.cs index a8d01142..2274d004 100644 --- a/KruacentExiled/KE.Misc/ServerHandler.cs +++ b/KruacentExiled/KE.Misc/ServerHandler.cs @@ -22,6 +22,8 @@ public void OnRoundStarted() Timing.RunCoroutine(MainPlugin.Instance.PeanutLockdown()); if(MainPlugin.Instance.Config.AutoElevator) Timing.RunCoroutine(MainPlugin.Instance.AutoElevator.StartElevator()); + if (MainPlugin.Instance.Config.SurfaceLight) + MainPlugin.Instance.SurfaceLight.ChangeSurfaceLight(); } } } diff --git a/KruacentExiled/KE.Misc/SurfaceLight.cs b/KruacentExiled/KE.Misc/SurfaceLight.cs new file mode 100644 index 00000000..fae0b003 --- /dev/null +++ b/KruacentExiled/KE.Misc/SurfaceLight.cs @@ -0,0 +1,39 @@ +using Exiled.API.Enums; +using Exiled.API.Features; +using UnityEngine; +using System.Collections.Generic; +using System.Linq; + +namespace KE.Misc +{ + /// + /// Everything about Surface Light + /// + internal class SurfaceLight + { + /// + /// Change Surface Light Color + /// + internal void ChangeSurfaceLight() + { + List colors = new [] + { + Color.cyan, + Color.red, + Color.green, + Color.white, + Color.blue + }.ToList(); + + // Select a random color + Color randomColor = colors[UnityEngine.Random.Range(0, colors.Count)]; + + foreach (var room in Room.List.Where(r => r.Type == RoomType.Surface)) + { + room.Color = randomColor; + } + + Log.Info($"Changed Surface light color to {randomColor}."); + } + } +} diff --git a/KruacentExiled/KE.Utils/API/Displays/DisplayMeow/DisplayHandler.cs b/KruacentExiled/KE.Utils/API/Displays/DisplayMeow/DisplayHandler.cs new file mode 100644 index 00000000..4ee13535 --- /dev/null +++ b/KruacentExiled/KE.Utils/API/Displays/DisplayMeow/DisplayHandler.cs @@ -0,0 +1,67 @@ +using Exiled.API.Features; +using HintServiceMeow.Core.Extension; +using HintServiceMeow.Core.Models.Hints; +using HintServiceMeow.Core.Utilities; +using MEC; + + +//damn why the same name +using MHint = HintServiceMeow.Core.Models.Hints.Hint; + +namespace KE.Utils.API.Displays.DisplayMeow +{ + public class DisplayHandler + { + public static DisplayHandler Instance { get; } = new(); + + private DisplayHandler() { } + + + + + + + public MHint AddHint(HintPlacement hintPlacement, Player player, string text, float delay) + { + var dis = PlayerDisplay.Get(player); + string id = $"{player.Id}_{hintPlacement.XCoordinate}_{hintPlacement.YCoordinate}"; + MHint hint; + + if (!dis.TryGetHint(id, out var aHint)) + { + hint = new() + { + Text = text, + XCoordinate = hintPlacement.XCoordinate, + YCoordinate = hintPlacement.YCoordinate, + Alignment = hintPlacement.HintAlignment, + Id = id + + }; + dis.AddHint(hint); + + } + else + { + + hint = (MHint)aHint; + hint.Hide = false; + hint.Text = text; + } + + + hint.HideAfter(delay); + return hint; + } + + + + + + + + + + + } +} diff --git a/KruacentExiled/KE.Utils/API/Displays/DisplayMeow/HintPlacement.cs b/KruacentExiled/KE.Utils/API/Displays/DisplayMeow/HintPlacement.cs new file mode 100644 index 00000000..936cdbe9 --- /dev/null +++ b/KruacentExiled/KE.Utils/API/Displays/DisplayMeow/HintPlacement.cs @@ -0,0 +1,31 @@ +using HintServiceMeow.Core.Enum; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace KE.Utils.API.Displays.DisplayMeow +{ + public readonly struct HintPlacement : IEquatable + { + public float YCoordinate { get; } + public float XCoordinate { get; } + public HintAlignment HintAlignment { get; } = HintAlignment.Center; + + + public bool Equals(HintPlacement obj) + { + return YCoordinate == obj.YCoordinate && XCoordinate == obj.XCoordinate; + } + + + public HintPlacement(float xCoordinate, float yCoordinate, HintAlignment alignment = HintAlignment.Center) + { + YCoordinate = yCoordinate; + XCoordinate = xCoordinate; + HintAlignment = alignment; + } + + } +} diff --git a/KruacentExiled/KE.Utils/API/GifAnimator/RenderGif.cs b/KruacentExiled/KE.Utils/API/GifAnimator/RenderGif.cs new file mode 100644 index 00000000..f4276d33 --- /dev/null +++ b/KruacentExiled/KE.Utils/API/GifAnimator/RenderGif.cs @@ -0,0 +1,128 @@ +using System.Collections.Generic; +using System.Drawing; +using System.Drawing.Imaging; +using System.IO; +using Exiled.API.Features; +using Exiled.API.Features.Toys; +using MEC; +using UnityEngine; +using UnityEngine.Rendering; +using Color = UnityEngine.Color; +namespace KE.Utils.API.GifAnimator +{ + internal class RenderGif + { + + public static void Spawn() + { + + } + + + + private static IEnumerator RenderImageCoroutine(object target, string filePath, float maxWidth, float maxHeight, float distance, float duration, int targetWidth, int targetHeight) + { + if (!File.Exists(filePath)) + { + Log.Debug($"No image was found under: {filePath}"); + yield break; + } + + byte[] imageData = File.ReadAllBytes(filePath); + + + + + + + Texture2D original = new Texture2D(2, 2); + + + try + { + original.LoadRawTextureData(imageData); + } + catch(UnityException) + { + Log.Debug("Image couldnt be loaded."); + yield break; + } + + Texture2D scaled = new Texture2D(targetWidth, targetHeight, TextureFormat.RGBA32, false); + + for (int x = 0; x < targetWidth; x++) + { + for (int y = 0; y < targetHeight; y++) + { + float u = x / (float)targetWidth; + float v = y / (float)targetHeight; + Color color = original.GetPixelBilinear(u, v); + scaled.SetPixel(x, y, color); + } + } + scaled.Apply(); + + float pixelScaleX = maxWidth / targetWidth; + float pixelScaleY = maxHeight / targetHeight; + float scale = Mathf.Min(pixelScaleX, pixelScaleY); + + Vector3 forwardOrigin; + Quaternion rotation = Quaternion.identity; + + if (target is Exiled.API.Features.Player player) + { + forwardOrigin = player.CameraTransform.position + player.CameraTransform.forward * distance; + + Vector3 directionToPlayer = forwardOrigin - player.CameraTransform.position; + directionToPlayer.y = 0; + rotation = Quaternion.LookRotation(directionToPlayer); + } + else if (target is Vector3 position) + { + forwardOrigin = position + Vector3.forward * distance; + Vector3 directionToPosition = forwardOrigin - position; + directionToPosition.y = 0; + rotation = Quaternion.LookRotation(directionToPosition); + } + else if (target is Room room) + { + forwardOrigin = room.Position + Vector3.up * 2f; + Vector3 directionToRoom = forwardOrigin - room.Position; + directionToRoom.y = 0; + rotation = Quaternion.LookRotation(directionToRoom); + } + else + { + Log.Debug("Invalid object type. Valid types: Player, Vector3, Room"); + yield break; + } + + Vector3 offset = new Vector3((targetWidth * scale) / 2f, (targetHeight * scale) / 2f, 0); + + for (int x = 0; x < targetWidth; x++) + { + for (int y = 0; y < targetHeight; y++) + { + Color pixelColor = scaled.GetPixel(x, y); + if (pixelColor.a < 0.1f) + continue; + + Vector3 localOffset = new Vector3(x * scale, y * scale, 0) - offset; + Vector3 worldPos = forwardOrigin + rotation * localOffset; + + Primitive quad = Primitive.Create(PrimitiveType.Quad); + quad.Position = worldPos; + quad.Scale = new Vector3(scale, scale, scale * 0.01f); + quad.Color = pixelColor; + + Quaternion fixedRotation = Quaternion.Euler(0f, rotation.eulerAngles.y, 0f); + quad.Rotation = fixedRotation; + quad.Flags = AdminToys.PrimitiveFlags.Visible; + } + + yield return Timing.WaitForOneFrame; + } + } + + } +} diff --git a/KruacentExiled/KE.Utils/API/Interfaces/IEvents.cs b/KruacentExiled/KE.Utils/API/Interfaces/IEvents.cs new file mode 100644 index 00000000..e573b062 --- /dev/null +++ b/KruacentExiled/KE.Utils/API/Interfaces/IEvents.cs @@ -0,0 +1,17 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace KE.Utils.API.Interfaces +{ + public interface IUsingEvents + { + + + public void SubscribeEvents(); + + public void UnsubscribeEvents(); + } +} diff --git a/KruacentExiled/KE.Utils/API/Interfaces/ILoadable.cs b/KruacentExiled/KE.Utils/API/Interfaces/ILoadable.cs new file mode 100644 index 00000000..c9e00399 --- /dev/null +++ b/KruacentExiled/KE.Utils/API/Interfaces/ILoadable.cs @@ -0,0 +1,13 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace KE.Utils.API.Interfaces +{ + public interface ILoadable + { + public string Loadable(char separator); + } +} diff --git a/KruacentExiled/KE.Utils/API/Models/Arrows/Arrow.cs b/KruacentExiled/KE.Utils/API/Models/Arrows/Arrow.cs new file mode 100644 index 00000000..990999c7 --- /dev/null +++ b/KruacentExiled/KE.Utils/API/Models/Arrows/Arrow.cs @@ -0,0 +1,58 @@ +using Exiled.API.Features.Toys; +using InventorySystem.Items.Keycards; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Net.Sockets; +using System.Text; +using System.Threading.Tasks; +using UnityEngine; + +namespace KE.Utils.API.Models.Arrows +{ + internal abstract class Arrow + { + internal static HashSet List = new(); + internal abstract Vector3 Offset { get; } + internal abstract Vector3 Rotation { get; } + internal abstract Color Color { get; } + + protected readonly Vector3 scale = new Vector3(1f, .1f, .1f); + + private Primitive _primitive; + + internal Primitive Primitive + { + get { return _primitive; } + } + internal Arrow() + { + List.Add(this); + _primitive = Primitive.Create(PrimitiveType.Cube, null, Rotation, scale); + _primitive.Color = Color; + } + + internal void Move(Vector3 newPos) + { + _primitive.Position = newPos + Offset; + } + + internal static bool IsPrimitiveArrow(Primitive p) + { + Arrow a =GetArrow(p); + return a != null; + } + + internal static Arrow GetArrow(Primitive p) + { + + foreach(Arrow a in List) + { + if (p == a.Primitive) + return a; + } + return null; + + } + } +} diff --git a/KruacentExiled/KE.Utils/API/Models/Arrows/MoveArrow.cs b/KruacentExiled/KE.Utils/API/Models/Arrows/MoveArrow.cs new file mode 100644 index 00000000..f3216e7f --- /dev/null +++ b/KruacentExiled/KE.Utils/API/Models/Arrows/MoveArrow.cs @@ -0,0 +1,12 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace KE.Utils.API.Models.Arrows +{ + internal class MoveArrow + { + } +} diff --git a/KruacentExiled/KE.Utils/API/Models/Arrows/RotateArrow.cs b/KruacentExiled/KE.Utils/API/Models/Arrows/RotateArrow.cs new file mode 100644 index 00000000..518fb4b5 --- /dev/null +++ b/KruacentExiled/KE.Utils/API/Models/Arrows/RotateArrow.cs @@ -0,0 +1,12 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace KE.Utils.API.Models.Arrows +{ + internal class RotateArrow + { + } +} diff --git a/KruacentExiled/KE.Utils/API/Models/Arrows/ScaleArrow.cs b/KruacentExiled/KE.Utils/API/Models/Arrows/ScaleArrow.cs new file mode 100644 index 00000000..99bf7d55 --- /dev/null +++ b/KruacentExiled/KE.Utils/API/Models/Arrows/ScaleArrow.cs @@ -0,0 +1,12 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace KE.Utils.API.Models.Arrows +{ + internal class ScaleArrow + { + } +} diff --git a/KruacentExiled/KE.Utils/API/Models/Arrows/XArrow.cs b/KruacentExiled/KE.Utils/API/Models/Arrows/XArrow.cs new file mode 100644 index 00000000..073802c3 --- /dev/null +++ b/KruacentExiled/KE.Utils/API/Models/Arrows/XArrow.cs @@ -0,0 +1,16 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using UnityEngine; + +namespace KE.Utils.API.Models.Arrows +{ + internal class XArrow : Arrow + { + internal override Vector3 Offset => new Vector3(scale.x / 2,0); + internal override Vector3 Rotation => new Vector3(0, 0f, 0f); + internal override Color Color => Color.red; + } +} diff --git a/KruacentExiled/KE.Utils/API/Models/Arrows/YArrow.cs b/KruacentExiled/KE.Utils/API/Models/Arrows/YArrow.cs new file mode 100644 index 00000000..e437766e --- /dev/null +++ b/KruacentExiled/KE.Utils/API/Models/Arrows/YArrow.cs @@ -0,0 +1,16 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using UnityEngine; + +namespace KE.Utils.API.Models.Arrows +{ + internal class YArrow : Arrow + { + internal override Vector3 Offset => new Vector3(0, scale.x / 2); + internal override Vector3 Rotation => new Vector3(0, 0f, 90f); + internal override Color Color => Color.green; + } +} diff --git a/KruacentExiled/KE.Utils/API/Models/Arrows/ZArrow.cs b/KruacentExiled/KE.Utils/API/Models/Arrows/ZArrow.cs new file mode 100644 index 00000000..30c27866 --- /dev/null +++ b/KruacentExiled/KE.Utils/API/Models/Arrows/ZArrow.cs @@ -0,0 +1,16 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using UnityEngine; + +namespace KE.Utils.API.Models.Arrows +{ + internal class ZArrow : Arrow + { + internal override Vector3 Offset => new Vector3(0,0, scale.x / 2); + internal override Vector3 Rotation => new Vector3(0, 90f, 0); + internal override Color Color => Color.blue; + } +} diff --git a/KruacentExiled/KE.Utils/API/Models/Blueprints/AdminToyBlueprint.cs b/KruacentExiled/KE.Utils/API/Models/Blueprints/AdminToyBlueprint.cs new file mode 100644 index 00000000..ccfcff3d --- /dev/null +++ b/KruacentExiled/KE.Utils/API/Models/Blueprints/AdminToyBlueprint.cs @@ -0,0 +1,69 @@ +using Exiled.API.Enums; +using Exiled.API.Features.Toys; +using Exiled.API.Interfaces; +using KE.Utils.API.Interfaces; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using UnityEngine; +using Light = Exiled.API.Features.Toys.Light; + +namespace KE.Utils.API.Models.Blueprints +{ + public abstract class AdminToyBlueprint : ILoadable + { + public AdminToyType AdminToyType { get; protected set; } + //local position + public Vector3 Position { get; protected set; } + public Vector3 Rotation { get; protected set; } + public Vector3 Scale { get; protected set; } + + + public static AdminToyBlueprint Create(AdminToy adminToy, Vector3? center = null) + { + AdminToyBlueprint result; + + + if (adminToy.ToyType == AdminToyType.PrimitiveObject) + { + result = new PrimitiveBlueprint(adminToy as Primitive); + + } + else if(adminToy.ToyType == AdminToyType.LightSource) + { + result = new LightBlueprint(adminToy as Light); + } + else + { + throw new NotImplementedException("only primitive and light"); + } + + result.Position = adminToy.Position - center ?? adminToy.Position; + result.Rotation = adminToy.Rotation.eulerAngles; + + return result; + } + + + public string Loadable(char separator) + { + StringBuilder b = new(); + b.Append(AdminToyType.ToString()); + b.Append(separator); + b.Append(Position); + b.Append(separator); + b.Append(Rotation); + b.Append(separator); + b.Append(Scale); + b.Append(separator); + b.Append(Load(separator)); + + + return b.ToString(); + } + public abstract AdminToy Spawn(Vector3 center); + protected abstract string Load(char separator); + } +} diff --git a/KruacentExiled/KE.Utils/API/Models/Blueprints/LightBlueprint.cs b/KruacentExiled/KE.Utils/API/Models/Blueprints/LightBlueprint.cs new file mode 100644 index 00000000..1dc91294 --- /dev/null +++ b/KruacentExiled/KE.Utils/API/Models/Blueprints/LightBlueprint.cs @@ -0,0 +1,37 @@ +using Exiled.API.Enums; +using Exiled.API.Features.Toys; +using UnityEngine; +using Light = Exiled.API.Features.Toys.Light; + +namespace KE.Utils.API.Models.Blueprints +{ + public class LightBlueprint : AdminToyBlueprint + { + public Color Color { get; } + public float Intensity { get; } + + public LightBlueprint(Light l) + { + AdminToyType = AdminToyType.PrimitiveObject; + Scale = l.Scale; + Color = l.Color; + Intensity = l.Intensity; + } + + + public override AdminToy Spawn(Vector3 center) + { + var l = Light.Create(Position+center, Rotation, Scale, false); + l.Color = Color; + l.Intensity = Intensity; + + + return l; + } + + protected override string Load(char separator) + { + return "#" + ColorUtility.ToHtmlStringRGBA(Color) + separator + Intensity; + } + } +} diff --git a/KruacentExiled/KE.Utils/API/Models/Blueprints/ModelBlueprint.cs b/KruacentExiled/KE.Utils/API/Models/Blueprints/ModelBlueprint.cs new file mode 100644 index 00000000..0f3a047c --- /dev/null +++ b/KruacentExiled/KE.Utils/API/Models/Blueprints/ModelBlueprint.cs @@ -0,0 +1,110 @@ +using Exiled.API.Features; +using Exiled.API.Features.Core; +using Exiled.API.Features.Doors; +using Exiled.API.Features.Toys; +using Exiled.API.Structs; +using KE.Utils.API.Models.ToysSettings; +using KE.Utils.Quality.Models; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Runtime.InteropServices; +using UnityEngine; +using Light = Exiled.API.Features.Toys.Light; + +namespace KE.Utils.API.Models.Blueprints +{ + public class ModelBlueprint + { + private static List _bps = new(); + public static List Blueprints => _bps.ToList(); + private HashSet _toys = new(); + public IReadOnlyCollection Toys => [.. _toys]; + private string _name; + public string Name + { + get { return _name; } + } + + private ModelBlueprint() { } + + + + /// + /// + /// + /// + /// + public static ModelBlueprint Create(Model model) + { + var oldMbp = Get(model.Name); + _bps.Remove(oldMbp); + + + ModelBlueprint mbp = new(); + mbp._name = model.Name; + _bps.Add(mbp); + + foreach(AdminToy toy in model.Toys) + { + mbp._toys.Add(AdminToyBlueprint.Create(toy,model.Center)); + } + + return mbp; + } + + + public static ModelBlueprint Create(string name,IEnumerable toys = null) + { + ModelBlueprint mbp = new(); + _bps.Add(mbp); + + if (string.IsNullOrEmpty(name)) + { + throw new ArgumentException("name null or empty"); + } + + if(toys != null) + { + foreach(AdminToy at in toys) + { + mbp._toys.Add(AdminToyBlueprint.Create(at)); + } + } + + + + mbp._name = name; + + return mbp; + } + + public void Spawn(Vector3 position) + { + Model m = Model.Create(this, position,false); + + + } + + + #region getters + public static ModelBlueprint Get(string name) + { + foreach (ModelBlueprint m in Blueprints) + { + if (m.Name == name) + { + return m; + } + } + return null; + } + + public static bool TryGet(string name, out ModelBlueprint model) + { + model = Get(name); + return model != null; + } + #endregion + } +} diff --git a/KruacentExiled/KE.Utils/API/Models/Blueprints/PrimitiveBlueprint.cs b/KruacentExiled/KE.Utils/API/Models/Blueprints/PrimitiveBlueprint.cs new file mode 100644 index 00000000..2e59f30a --- /dev/null +++ b/KruacentExiled/KE.Utils/API/Models/Blueprints/PrimitiveBlueprint.cs @@ -0,0 +1,39 @@ +using Exiled.API.Enums; +using Exiled.API.Features.Toys; +using UnityEngine; + +namespace KE.Utils.API.Models.Blueprints +{ + public class PrimitiveBlueprint : AdminToyBlueprint + { + public Color Color { get; } + public PrimitiveType Type { get; } + + + public PrimitiveBlueprint(Primitive p) + { + AdminToyType = AdminToyType.PrimitiveObject; + + Scale = p.Scale; + Color = p.Color; + Type = p.Type; + } + + + + public override AdminToy Spawn(Vector3 center) + { + var p = Primitive.Create(Type,Position+center, Rotation, Scale, false); + p.Collidable = false; + p.Color = Color; + + + return p; + } + + protected override string Load(char separator) + { + return "#" + ColorUtility.ToHtmlStringRGBA(Color) + separator+Type; + } + } +} diff --git a/KruacentExiled/KE.Utils/API/Models/Commands/AllCommands.cs b/KruacentExiled/KE.Utils/API/Models/Commands/AllCommands.cs new file mode 100644 index 00000000..8ba12e68 --- /dev/null +++ b/KruacentExiled/KE.Utils/API/Models/Commands/AllCommands.cs @@ -0,0 +1,33 @@ +using CommandSystem; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Reflection; +using System.Text; +using System.Threading.Tasks; + +namespace KE.Utils.API.Models.Commands +{ + public static class AllCommands + { + + public static IEnumerable Get(Assembly assembly = null) + { + return new List() + { + new ChangeColor(), + new ChangePrimType(), + new CreateModel(), + new CreatePrim(), + new ListModel(), + new LoadModel(), + new ModeMovePrim(), + new SelectModel(), + new ShowCenter(), + new SaveModel() + + }; + + } + } +} diff --git a/KruacentExiled/KE.Utils/API/Models/Commands/ChangeColor.cs b/KruacentExiled/KE.Utils/API/Models/Commands/ChangeColor.cs new file mode 100644 index 00000000..3b78d218 --- /dev/null +++ b/KruacentExiled/KE.Utils/API/Models/Commands/ChangeColor.cs @@ -0,0 +1,72 @@ +using CommandSystem; +using Exiled.API.Features; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using KE.Utils.API.Models; +using UnityEngine; +using Exiled.API.Features.Toys; + +namespace KE.Utils.API.Models.Commands +{ + public class ChangeColor : ICommand + { + + public string Command { get; } = "changecolor"; + + public string[] Aliases { get; } = { "cc" }; + + public string Description { get; } = "change color rgba (0-255)"; + + public bool Execute(ArraySegment arguments, ICommandSender sender, out string response) + { + Player p = Player.Get(sender); + if (p == null) + { + response = "This player can't do this command"; + return false; + } + + if (arguments.Count < 3) + { + response = "not enough arguments"; + return false; + } + if(!byte.TryParse(arguments.At(0),out byte r) || + !byte.TryParse(arguments.At(1), out byte g) || + !byte.TryParse(arguments.At(2), out byte b)) + { + response = "number between 0 & 255"; + return false; + } + + Color32 c; + + if(arguments.Count > 3 && byte.TryParse(arguments.At(3),out byte a)) + { + c = new Color32(r, g, b, a); + } + else + { + c = new Color32(r, g, b,255); + } + + Primitive prim = Models.Instance.ModelCreator.ModelHandler.SelectedPrimitive; + + if(prim == null) + { + response = "no primitive selected"; + return false; + } + + prim.Color = c; + + + response = $"new color set to " + c.ToString(); + return true; + } + + } +} diff --git a/KruacentExiled/KE.Utils/API/Models/Commands/ChangePrimType.cs b/KruacentExiled/KE.Utils/API/Models/Commands/ChangePrimType.cs new file mode 100644 index 00000000..434427df --- /dev/null +++ b/KruacentExiled/KE.Utils/API/Models/Commands/ChangePrimType.cs @@ -0,0 +1,53 @@ +using CommandSystem; +using Exiled.API.Features; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using KE.Utils.API.Models; +using UnityEngine; + +namespace KE.Utils.API.Models.Commands +{ + public class ChangePrimType : ICommand + { + + public string Command { get; } = "changeprimtype"; + + public string[] Aliases { get; } = { "cpt" }; + + public string Description { get; } = "select the mode : scale,move,rotate"; + + public bool Execute(ArraySegment arguments, ICommandSender sender, out string response) + { + Player p = Player.Get(sender); + if (p == null) + { + response = "This player can't do this command"; + return false; + } + + if (arguments.Count < 1) + { + response = "not enough arguments"; + return false; + } + string type = arguments.At(0); + + + if(!Enum.TryParse(type, out PrimitiveType prim)) + { + response = "wrong argument"; + return false; + } + + + Models.Instance.ModelCreator.ModelHandler.SelectedPrimitive.Type = prim; + + response = $"Mode set to " + prim ; + return true; + } + + } +} diff --git a/KruacentExiled/KE.Utils/API/Models/Commands/CreateModel.cs b/KruacentExiled/KE.Utils/API/Models/Commands/CreateModel.cs new file mode 100644 index 00000000..d549cb50 --- /dev/null +++ b/KruacentExiled/KE.Utils/API/Models/Commands/CreateModel.cs @@ -0,0 +1,44 @@ +using CommandSystem; +using Exiled.API.Features; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace KE.Utils.API.Models.Commands +{ + public class CreateModel : ICommand + { + + public string Command { get; } = "create"; + + public string[] Aliases { get; } = { "c" }; + + public string Description { get; } = "create a new model at your position"; + + public bool Execute(ArraySegment arguments, ICommandSender sender, out string response) + { + + Player p = Player.Get(sender); + if (p == null) + { + response = "This player can't do this command"; + return false; + } + + if (arguments.Count < 1) + { + response = "not enough arguments"; + return false; + } + string name = arguments.At(0); + + Model m = Model.Create(p.Position, name); + Models.Instance.ModelCreator.ModelHandler.SelectedModel = m; + response = $"Created & selected model ({m.Name}) at {m.Center}"; + return true; + } + + } +} diff --git a/KruacentExiled/KE.Utils/API/Models/Commands/CreatePrim.cs b/KruacentExiled/KE.Utils/API/Models/Commands/CreatePrim.cs new file mode 100644 index 00000000..edcd6306 --- /dev/null +++ b/KruacentExiled/KE.Utils/API/Models/Commands/CreatePrim.cs @@ -0,0 +1,47 @@ +using CommandSystem; +using Exiled.API.Features; +using Exiled.API.Features.Toys; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace KE.Utils.API.Models.Commands +{ + public class CreatePrim : ICommand + { + + public string Command { get; } = "createprimitive"; + + public string[] Aliases { get; } = { "cp" }; //no not like that + + public string Description { get; } = "create a new primitive at your position"; + + public bool Execute(ArraySegment arguments, ICommandSender sender, out string response) + { + + Player p = Player.Get(sender); + if (p == null) + { + response = "This player can't do this command"; + return false; + } + + + Model m = Models.Instance.ModelCreator.SelectedModel; + + if (m == null) + { + response = "no model selected"; + return false; + } + m.Add(p.Position); + + + response = "created!"; + return true; + } + + } +} diff --git a/KruacentExiled/KE.Utils/API/Models/Commands/ListModel.cs b/KruacentExiled/KE.Utils/API/Models/Commands/ListModel.cs new file mode 100644 index 00000000..79f42597 --- /dev/null +++ b/KruacentExiled/KE.Utils/API/Models/Commands/ListModel.cs @@ -0,0 +1,42 @@ +using CommandSystem; +using Exiled.API.Features; +using KE.Utils.API.Models.Blueprints; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace KE.Utils.API.Models.Commands +{ + public class ListModel : ICommand + { + + public string Command { get; } = "list"; + + public string[] Aliases { get; } = { "l" }; + + public string Description { get; } = "create a new model at your position"; + + public bool Execute(ArraySegment arguments, ICommandSender sender, out string response) + { + StringBuilder b = new(); + b.AppendLine($"Models ({Model.Models.Count}) :"); + foreach (Model m in Model.Models) + { + b.AppendLine($"{m.Name} pos: {m.Center} spawned? :{m.Spawned}"); + } + + b.AppendLine($"Blueprints ({ModelBlueprint.Blueprints.Count}) :"); + foreach (ModelBlueprint m in ModelBlueprint.Blueprints) + { + b.AppendLine($"{m.Name}"); + } + + + response = b.ToString(); + return true; + } + + } +} diff --git a/KruacentExiled/KE.Utils/API/Models/Commands/LoadModel.cs b/KruacentExiled/KE.Utils/API/Models/Commands/LoadModel.cs new file mode 100644 index 00000000..7be25565 --- /dev/null +++ b/KruacentExiled/KE.Utils/API/Models/Commands/LoadModel.cs @@ -0,0 +1,65 @@ +using CommandSystem; +using Exiled.API.Features; +using KE.Utils.API.Models.Blueprints; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Xml.Linq; + +namespace KE.Utils.API.Models.Commands +{ + public class LoadModel : ICommand + { + + public string Command { get; } = "load"; + + public string[] Aliases { get; } = { "lo" }; + + public string Description { get; } = "load a model from a blueprint"; + + public bool Execute(ArraySegment arguments, ICommandSender sender, out string response) + { + + Player p = Player.Get(sender); + if (p == null) + { + response = "This player can't do this command"; + return false; + } + + if (arguments.Count < 1) + { + response = "not enough arguments"; + return false; + } + + string name = arguments.At(0); + + if (string.IsNullOrEmpty(name)) + { + response = "name null or empty"; + return false; + } + + foreach(ModelBlueprint bp in ModelBlueprint.Blueprints) + { + + Log.Info($"{bp.Name} == {name} : {bp.Name == name}"); + } + + + if(!ModelBlueprint.TryGet(name,out var mbp)) + { + response = "blueprint not found"; + return false; + } + + mbp.Spawn(p.Position); + response = $"Created model ({mbp.Name}) at {p.Position}"; + return true; + } + + } +} diff --git a/KruacentExiled/KE.Utils/API/Models/Commands/ModeMovePrim.cs b/KruacentExiled/KE.Utils/API/Models/Commands/ModeMovePrim.cs new file mode 100644 index 00000000..2b9ea091 --- /dev/null +++ b/KruacentExiled/KE.Utils/API/Models/Commands/ModeMovePrim.cs @@ -0,0 +1,64 @@ +using CommandSystem; +using Exiled.API.Features; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using KE.Utils.API.Models; + +namespace KE.Utils.API.Models.Commands +{ + public class ModeMovePrim : ICommand + { + + public string Command { get; } = "mode"; + + public string[] Aliases { get; } = { "m" }; + + public string Description { get; } = "select the mode : scale,move,rotate"; + + public bool Execute(ArraySegment arguments, ICommandSender sender, out string response) + { + Player p = Player.Get(sender); + if (p == null) + { + response = "This player can't do this command"; + return false; + } + + if (arguments.Count < 1) + { + response = "not enough arguments"; + return false; + } + string mode = arguments.At(0); + + switch(mode) + { + case "m": + case "move": + Models.Instance.ModelCreator.MovementMode = MovementMode.Move; + break; + case "s": + case "scale": + Models.Instance.ModelCreator.MovementMode = MovementMode.Scale; + break; + case "r": + case "rotate": + Models.Instance.ModelCreator.MovementMode = MovementMode.Rotate; + break; + default: + response = "wrong argument"; + return false; + + + } + + + response = $"Mode set to " + Models.Instance.ModelCreator.MovementMode.ToString(); + return true; + } + + } +} diff --git a/KruacentExiled/KE.Utils/API/Models/Commands/SaveModel.cs b/KruacentExiled/KE.Utils/API/Models/Commands/SaveModel.cs new file mode 100644 index 00000000..d40048e5 --- /dev/null +++ b/KruacentExiled/KE.Utils/API/Models/Commands/SaveModel.cs @@ -0,0 +1,47 @@ +using CommandSystem; +using Exiled.API.Features; +using KE.Utils.API.Models.Blueprints; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Xml.Linq; + +namespace KE.Utils.API.Models.Commands +{ + public class SaveModel : ICommand + { + + public string Command { get; } = "save"; + + public string[] Aliases { get; } = { "sa" }; + + public string Description { get; } = "save a model to file"; + + public bool Execute(ArraySegment arguments, ICommandSender sender, out string response) + { + + Player p = Player.Get(sender); + if (p == null) + { + response = "This player can't do this command"; + return false; + } + + + Model model = Models.Instance.ModelCreator.SelectedModel; + if (model == null) + { + response = "no model selected"; + return false; + } + + model.Save(); + + response = $"Saved ({model.Name})"; + return true; + } + + } +} diff --git a/KruacentExiled/KE.Utils/API/Models/Commands/SelectModel.cs b/KruacentExiled/KE.Utils/API/Models/Commands/SelectModel.cs new file mode 100644 index 00000000..266ce4d4 --- /dev/null +++ b/KruacentExiled/KE.Utils/API/Models/Commands/SelectModel.cs @@ -0,0 +1,56 @@ +using CommandSystem; +using Exiled.API.Features; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace KE.Utils.API.Models.Commands +{ + public class SelectModel : ICommand + { + + public string Command { get; } = "select"; + + public string[] Aliases { get; } = { "s" }; + + public string Description { get; } = "select an existing model"; + + public bool Execute(ArraySegment arguments, ICommandSender sender, out string response) + { + + Player p = Player.Get(sender); + if (p == null) + { + response = "This player can't do this command"; + return false; + } + if (arguments.Count < 1) + { + response = "not enough arguments"; + return false; + } + string name = arguments.At(0); + + if (string.IsNullOrEmpty(name)) + { + response = "name null or empty"; + return false; + } + + + + + if (!Model.TryGet(name, out Model m)) + { + response = "model not found"; + return false; + } + response = $"model ({m.Name}) selected {m.Center}"; + Models.Instance.ModelCreator.ModelHandler.SelectedModel = m; + return true; + } + + } +} diff --git a/KruacentExiled/KE.Utils/API/Models/Commands/ShowCenter.cs b/KruacentExiled/KE.Utils/API/Models/Commands/ShowCenter.cs new file mode 100644 index 00000000..7b6cc05e --- /dev/null +++ b/KruacentExiled/KE.Utils/API/Models/Commands/ShowCenter.cs @@ -0,0 +1,51 @@ +using CommandSystem; +using Exiled.API.Features; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace KE.Utils.API.Models.Commands +{ + public class ShowCenter : ICommand + { + + public string Command { get; } = "show"; + + public string[] Aliases { get; } = { "sh" }; + + public string Description { get; } = "toggle the center of the model"; + + public bool Execute(ArraySegment arguments, ICommandSender sender, out string response) + { + + Player p = Player.Get(sender); + if (p == null) + { + response = "This player can't do this command"; + return false; + } + + Model m = Models.Instance.ModelCreator.ModelHandler.SelectedModel; + + if(m == null) + { + response = "no model selected"; + return false; + } + + if(!bool.TryParse(arguments.At(0),out bool result)) + { + response = "write true or false"; + return false; + } + + m.SetCenterPrimitive(result); + + response = "done"; + + return true; + } + } +} diff --git a/KruacentExiled/KE.Utils/API/Models/Model.cs b/KruacentExiled/KE.Utils/API/Models/Model.cs new file mode 100644 index 00000000..6e84fbc9 --- /dev/null +++ b/KruacentExiled/KE.Utils/API/Models/Model.cs @@ -0,0 +1,202 @@ +using Exiled.API.Features; +using Exiled.API.Features.Toys; +using KE.Utils.API.Models.Blueprints; +using System; +using System.Collections.Generic; +using System.Linq; +using UnityEngine; + +namespace KE.Utils.API.Models +{ + public class Model + { + private static List _models = new(); + public static List Models => _models.ToList(); + + private HashSet _toys = new(); + public IReadOnlyCollection Toys => [.. _toys]; + private string _name; + public string Name + { + get { return _name; } + } + + private Vector3 _center; + public Vector3 Center + { + get { return _center; } + } + private bool _spawned = true; + public bool Spawned + { + get { return _spawned; } + } + + private ModelBlueprint _blueprint; + + public ModelBlueprint Blueprint + { + get { return _blueprint; } + } + + public bool LoadedFromBlueprint + { + get + { + return Blueprint != null; + } + } + + + + + + internal Primitive centerPrim; + + public void SetCenterPrimitive(bool show) + { + if (show) + { + centerPrim.Spawn(); + } + else + { + centerPrim.UnSpawn(); + } + } + + + + public Primitive Add(Vector3 pos) + { + var p = Primitive.Create(pos, null, null, true); + + AddToy(p); + return p; + } + + + protected virtual void AddToy(AdminToy toy,bool editMode = true) + { + if(toy is Primitive p && editMode) + { + p.Collidable = true; + } + + + _toys.Add(toy); + } + + private Model(Vector3 center) + { + _models.Add(this); + _center = center; + } + + public static Model Create(Vector3 position, string name) + { + + Model m = new(position); + if (string.IsNullOrEmpty(name)) + { + throw new ArgumentException("name null or empty"); + } + m._name = name; + + Log.Debug("created model id=" + m.Name); + m.centerPrim = Primitive.Create(position, null, Vector3.one / 5, true, new(1, 0, 0, .25f)); + m.centerPrim.Collidable = false; + + return m; + } + + + public static Model Create(ModelBlueprint blueprint,Vector3 position,bool editMode = false) + { + Model m = new(position); + m._name = blueprint.Name; + + foreach (AdminToyBlueprint toy in blueprint.Toys) + { + Log.Info("create toy "+toy.AdminToyType); + AdminToy trueToy = toy.Spawn(m.Center); + + + m.AddToy(trueToy, editMode); + + } + + return m; + + } + + /// + /// Create a based of this

+ /// Note : will overwrite the old blueprint + ///
+ public void CreateBlueprint() + { + ModelBlueprint bp = ModelBlueprint.Create(this); + + _blueprint = bp; + + } + + + #region getter + public static Model Get(string name) + { + foreach (Model m in _models) + { + if (m.Name == name) + { + return m; + } + } + return null; + } + + public static bool TryGet(string name, out Model model) + { + model = Get(name); + return model != null; + } + + + public override string ToString() + { + return $"{Name} center = {Center}"; + } + #endregion + + #region spawn + public void Spawn() + { + foreach (AdminToy t in Toys) + { + t.Spawn(); + } + _spawned = true; + } + public void UnSpawn() + { + foreach (AdminToy t in Toys) + { + t.UnSpawn(); + } + _spawned = false; + } + + public void Destroy() + { + foreach (AdminToy t in Toys) + { + t.Destroy(); + } + _models.Remove(this); + + } + + #endregion + } +} diff --git a/KruacentExiled/KE.Utils/API/Models/ModelCreator.cs b/KruacentExiled/KE.Utils/API/Models/ModelCreator.cs new file mode 100644 index 00000000..85758ad9 --- /dev/null +++ b/KruacentExiled/KE.Utils/API/Models/ModelCreator.cs @@ -0,0 +1,175 @@ +using AdminToys; +using Exiled.API.Features; +using Exiled.API.Features.Items; +using Exiled.API.Features.Toys; +using Exiled.Events.EventArgs.Player; +using KE.Utils.API.Interfaces; +using KE.Utils.API.Models.Arrows; +using MEC; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Runtime.InteropServices; +using System.Text; +using System.Threading.Tasks; +using UnityEngine; + +namespace KE.Utils.API.Models +{ + public class ModelCreator : IUsingEvents + { + + + public const ItemType item = ItemType.GunCOM18; + + public Model SelectedModel + { + get + { + return ModelHandler.SelectedModel; + } + } + public MovementMode MovementMode + { + get + { + return MovementHandler.Mode; + } + set + { + MovementHandler.Mode = value; + } + } + internal MovementHandler MovementHandler { get; private set; } + internal ModelSelection ModelHandler { get; private set; } + + private bool mode = false; + private const float MAX_DISTANCE = 50; + + public static event Action IsAiming; + public static event Action StoppedAiming; + + + + public ModelCreator() + { + + } + + public void SubscribeEvents() + { + + ModelHandler = new(); + MovementHandler = new(); + + ModelLoader.LoadAll(); + MovementHandler.SubscribeEvents(); + Exiled.Events.Handlers.Player.DryfiringWeapon += OnDryfiringWeapon; + Exiled.Events.Handlers.Player.TogglingWeaponFlashlight += OnTogglingWeaponFlashlight; + Exiled.Events.Handlers.Server.RoundStarted += Test; + Exiled.Events.Handlers.Player.AimingDownSight += OnAimingDownSight; + + } + public void UnsubscribeEvents() + { + Exiled.Events.Handlers.Player.DryfiringWeapon -= OnDryfiringWeapon; + Exiled.Events.Handlers.Player.TogglingWeaponFlashlight -= OnTogglingWeaponFlashlight; + Exiled.Events.Handlers.Player.AimingDownSight -= OnAimingDownSight; + Exiled.Events.Handlers.Server.RoundStarted -= Test; + MovementHandler.UnsubscribeEvents(); + + ModelHandler = null; + MovementHandler = null; + } + + private void Test() + { + foreach (var p in Player.List) + { + p.Role.Set(PlayerRoles.RoleTypeId.ChaosConscript); + Timing.CallDelayed(.1f, () => + { + var a = p.AddItem(item); + var b = a as Firearm; + b.MagazineAmmo = 2; + + Primitive.Create(p.Position + Vector3.back, null, null, true, Color.red); + Primitive.Create(p.Position + Vector3.forward, null, null, true, Color.green); + }); + } + } + + + + + private void OnAimingDownSight(AimingDownSightEventArgs ev) + { + if (ev.AdsIn) + { + IsAiming?.Invoke(ev.Player); + } + else + { + StoppedAiming?.Invoke(); + } + } + + private void OnDryfiringWeapon(DryfiringWeaponEventArgs ev) + { + if (ev.Firearm.Type != item) return; + Log.Info("new mode = " + mode); + + if (!mode) + { + + mode = !mode; + } + + + + } + + private void OnTogglingWeaponFlashlight(TogglingWeaponFlashlightEventArgs ev) + { + if (ev.Firearm.Type != item) return; + + + + Primitive p = GetFacingPrimitive(ev.Player); + if (!Arrow.IsPrimitiveArrow(p)) + { + ModelHandler.ChangedSelectedPrim(p); + } + + } + + internal static Primitive GetFacingPrimitive(Player player) + { + Transform cam = player.CameraTransform; + + Vector3 origin = cam.position + cam.forward * 0.5f; + Ray r = new Ray(origin, cam.forward); + if (Physics.Raycast(r, out RaycastHit hit, MAX_DISTANCE)) + { + Log.Info($"hit ({hit.collider.name})"); + PrimitiveObjectToy pot = hit.collider.GetComponentInParent() ?? hit.collider.GetComponentInChildren(); + if (pot != null) + { + return Primitive.Get(pot); + + + } + } + return null; + } + + + + } + public enum MovementMode + { + Move, + Scale, + Rotate + } +} diff --git a/KruacentExiled/KE.Utils/API/Models/ModelLoader.cs b/KruacentExiled/KE.Utils/API/Models/ModelLoader.cs new file mode 100644 index 00000000..d4c60464 --- /dev/null +++ b/KruacentExiled/KE.Utils/API/Models/ModelLoader.cs @@ -0,0 +1,152 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.IO; +using Exiled.API.Features; +using Exiled.API.Features.Toys; +using UnityEngine; +using Light = Exiled.API.Features.Toys.Light; +using Exiled.API.Enums; +using KE.Utils.API.Models.Blueprints; +namespace KE.Utils.API.Models +{ + public static class ModelLoader + { + public static string Path => Paths.Configs + @"\"; + private static readonly char SEPARATOR = '_'; + public static string Extension => ".modelscpsl"; + + + public static IEnumerable LoadAll() + { + List m = new(); + + string[] raw = Directory.GetFiles(Path, "*" + Extension); + + foreach (string d in raw) + { + Log.Info("loading="+d); + ModelBlueprint mbp = Load(string.Empty, d); + if(mbp != null) + { + Log.Info($"loaded {mbp.Name} ({mbp.Toys.Count})"); + m.Add(mbp); + } + + } + + return m; + } + + public static ModelBlueprint Load(string filename) + { + return Load(Path, filename); + } + + public static ModelBlueprint Load(string path,string filename) + { + string[] raw; + try + { + raw = File.ReadAllText(path + filename).Split('\n'); + } + catch(Exception e) + { + Log.Error(e); + return null; + } + + + string[] infoline = raw[0].Split(SEPARATOR); + string name = infoline[0]; + List toys = new(); + + + for (int i = 1; i < raw.Length; i++) + { + string[] line = raw[i].Split(SEPARATOR); + AdminToy toy = null; + AdminToyType type; + if (!Enum.TryParse(line[0], out type)) continue; + + Vector3 ATPos = Parser.Vector3(line[1]); + Vector3 ATRotation = Parser.Vector3(line[2]); + Vector3 ATScale = Parser.Vector3(line[3]); + if(type == AdminToyType.PrimitiveObject) + { + Color color; + ColorUtility.TryParseHtmlString(line[4], out color); + PrimitiveType ptype; + Enum.TryParse(line[5], out ptype); + + + var p = Primitive.Create(ptype, ATPos, ATRotation, ATScale, true, color); + p.Collidable = false; + toy = p; + + } + if(type == AdminToyType.LightSource) + { + Color color; + ColorUtility.TryParseHtmlString(line[4], out color); + + float intensity = float.Parse(line[5]); + var l = Light.Create(ATPos, ATRotation, ATScale, true, color); + l.Intensity = intensity; + toy = l; + } + + if (toy == null) continue; + toys.Add(toy); + + } + + + + + return ModelBlueprint.Create(name, toys); + } + + + // Name\n + // Primitive.Position.RotationEuler.Scale.Color.PrimitiveType\n + // Light.Position.RotationEuler.Scale.Color.Intensity\n + // and repeat + public static bool Save(this ModelBlueprint m) + { + + List result = new(); + + result.Add(m.Name+SEPARATOR); + + foreach(AdminToyBlueprint t in m.Toys) + { + result.Add(t.Loadable(SEPARATOR)); + } + + try + { + File.WriteAllLines(Path + m.Name+ Extension, result); + return true; + } + catch(Exception e) + { + Log.Error(e); + return false; + } + + } + + public static bool Save(this Model model) + { + if (!model.LoadedFromBlueprint) + model.CreateBlueprint(); + + + return Save(model.Blueprint); + } + + + } +} diff --git a/KruacentExiled/KE.Utils/API/Models/Models.cs b/KruacentExiled/KE.Utils/API/Models/Models.cs new file mode 100644 index 00000000..27fe3cf4 --- /dev/null +++ b/KruacentExiled/KE.Utils/API/Models/Models.cs @@ -0,0 +1,47 @@ +using KE.Utils.API.Interfaces; +using PlayerRoles.FirstPersonControl.Thirdperson; + +namespace KE.Utils.API.Models +{ + public class Models : IUsingEvents + { + public ModelCreator ModelCreator + { + get; + private set; + } + private static Models _instance; + + + public static Models Instance + { + get + { + if (_instance == null) + _instance = new(); + return _instance; + } + } + + public void DestroyInstance() + { + _instance = null; + } + + private Models() + { + ModelCreator = new(); + } + + + public void SubscribeEvents() + { + ModelCreator.SubscribeEvents(); + } + + public void UnsubscribeEvents() + { + ModelCreator.UnsubscribeEvents(); + } + } +} diff --git a/KruacentExiled/KE.Utils/API/Models/MovementHandler.cs b/KruacentExiled/KE.Utils/API/Models/MovementHandler.cs new file mode 100644 index 00000000..07e3ee18 --- /dev/null +++ b/KruacentExiled/KE.Utils/API/Models/MovementHandler.cs @@ -0,0 +1,208 @@ +using Exiled.API.Features; +using Exiled.API.Features.Toys; +using Exiled.Events.EventArgs.Player; +using KE.Utils.API.Interfaces; +using KE.Utils.API.Models.Arrows; +using MEC; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using UnityEngine; + +namespace KE.Utils.API.Models +{ + internal class MovementHandler : IUsingEvents + { + + private MovementMode _mode = MovementMode.Move; + + public MovementMode Mode + { + get + { + return _mode; + } + set + { + OnChangingMode?.Invoke(value); + _mode = value; + } + } + public static event Action OnChangingMode; + + + + //xyz + private Arrow[] _arrows = new Arrow[3]; + private bool _primflag = false; + public readonly static float REFRESH_RATE = Timing.WaitForOneFrame; + + private CoroutineHandle _handle; + private bool _aiming = false; + private void TryCreatePrimitives() + { + if (!_primflag) + { + _arrows[0] = new XArrow(); + _arrows[1] = new YArrow(); + _arrows[2] = new ZArrow(); + _primflag = true; + } + } + + + + + public void SubscribeEvents() + { + ModelCreator.IsAiming += IsAiming; + ModelCreator.StoppedAiming += StoppedAiming; + ModelSelection.OnChangedSelection += OnChangedSelection; + ModelSelection.OnUnSelect += OnUnSelect; + } + + public void UnsubscribeEvents() + { + Timing.KillCoroutines(_handle); + + ModelSelection.OnChangedSelection -= OnChangedSelection; + ModelSelection.OnUnSelect -= OnUnSelect; + } + private void OnUnSelect() + { + foreach (Arrow a in Arrow.List) + { + a.Move(Vector3.zero); + } + } + private void OnChangedSelection(Primitive p) + { + Log.Info("ChangedSelection"); + TryCreatePrimitives(); + foreach (Arrow a in Arrow.List) + { + a.Move(p.Position); + } + + } + + + private void IsAiming(Player p) + { + Log.Info("start aim"); + var prim = ModelCreator.GetFacingPrimitive(p); + if (!Arrow.IsPrimitiveArrow(prim)) return; + + _aiming = true; + _handle = Timing.RunCoroutine(Moving(p,prim)); + } + + private void StoppedAiming() + { + Log.Info("stopped aim"); + _aiming = false; + } + + + + private IEnumerator Moving(Player player,Primitive p) + { + Primitive selected = Models.Instance.ModelCreator.ModelHandler.SelectedPrimitive; + Vector3 pos = selected.Position; + Vector3 targetPos = pos; + Vector3 scale = selected.Scale; + Vector3 tScale = scale; + + + + Vector3 oldEuler = player.CameraTransform.rotation.eulerAngles; + Arrow a = Arrow.GetArrow(p); + List otherArrows = Arrow.List.Where(o => o != a).ToList(); + + Vector3 direction = a.Offset.normalized; + float sensitivity = 0.1f; + float smoothSpeed = 5; + + while (_aiming) + { + Vector3 currentEuler = player.CameraTransform.rotation.eulerAngles; + + float deltaYaw = Mathf.DeltaAngle(oldEuler.y, currentEuler.y); + float deltaPitch = Mathf.DeltaAngle(oldEuler.x, currentEuler.x); + + float movementAmount = 0f; + + if (Mathf.Abs(direction.y) > 0.5f) + { + movementAmount = -deltaPitch * sensitivity; + } + else + { + + Vector3 camRight = player.CameraTransform.right; + + float sign = Mathf.Sign(Vector3.Dot(camRight, direction)); + + movementAmount = deltaYaw * sensitivity * sign; + } + + + + + if(Mode == MovementMode.Move) + { + targetPos += direction.normalized * movementAmount; + pos = Vector3.Lerp(pos, targetPos, Time.deltaTime * smoothSpeed); + p.Position = pos; + selected.Position = pos - a.Offset; + foreach (Arrow arrow in otherArrows) + { + arrow.Move(pos - a.Offset); + } + } + + + + if(Mode == MovementMode.Scale) + { + Vector3 previousParallel = direction.normalized * Vector3.Dot(selected.Scale, direction.normalized); + Vector3 dir = direction.normalized; + + float currentLengthInDir = Vector3.Dot(scale, dir); + + float newLengthInDir = Mathf.Clamp(currentLengthInDir + movementAmount, 0.1f, 10f); + + + Vector3 parallel = dir * newLengthInDir; + Vector3 perpendicular = scale - (dir * currentLengthInDir); + + selected.Scale = parallel + perpendicular; + scale = selected.Scale; + + Vector3 deltaParallel = parallel - previousParallel; + a.Primitive.Position += deltaParallel / 2; + previousParallel = parallel; + } + + + + if(Mode == MovementMode.Rotate) + { + Log.Info("no clue how to do that"); + } + + + + + + oldEuler = currentEuler; + yield return REFRESH_RATE; + } + } + + + + } +} diff --git a/KruacentExiled/KE.Utils/API/Models/SelectedModel.cs b/KruacentExiled/KE.Utils/API/Models/SelectedModel.cs new file mode 100644 index 00000000..7e502f46 --- /dev/null +++ b/KruacentExiled/KE.Utils/API/Models/SelectedModel.cs @@ -0,0 +1,52 @@ +using Exiled.API.Features; +using Exiled.API.Features.Toys; +using MEC; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using UnityEngine; + +namespace KE.Utils.API.Models +{ + internal class ModelSelection + { + + + + public Model SelectedModel { get; internal set; } + public Primitive SelectedPrimitive; + + public static event Action OnChangedSelection; + public static event Action OnUnSelect; + + public void ChangedSelectedPrim(Primitive newPrim) + { + if (newPrim == null) return; + + + + Log.Info(SelectedPrimitive == null); + Log.Info(newPrim.GameObject.GetInstanceID() != SelectedPrimitive?.GameObject.GetInstanceID()); + + if (SelectedPrimitive == null || newPrim.GameObject.GetInstanceID() != SelectedPrimitive?.GameObject.GetInstanceID()) + { + Log.Info("selecting"); + OnChangedSelection?.Invoke(newPrim); + SelectedPrimitive = newPrim; + } + else + { + Log.Info("unselecting"); + SelectedPrimitive = null; + OnUnSelect?.Invoke(); + } + + } + + + + + } +} diff --git a/KruacentExiled/KE.Utils/API/Models/ToysSettings/PrimitiveSetting.cs b/KruacentExiled/KE.Utils/API/Models/ToysSettings/PrimitiveSetting.cs new file mode 100644 index 00000000..b3ffe31d --- /dev/null +++ b/KruacentExiled/KE.Utils/API/Models/ToysSettings/PrimitiveSetting.cs @@ -0,0 +1,31 @@ +using AdminToys; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using UnityEngine; + +namespace KE.Utils.API.Models.ToysSettings +{ + public class PrimitiveSetting : ToySetting + { + + public PrimitiveType PrimitiveType { get; } + + + public PrimitiveFlags Flags { get; } + + + public Color Color { get; } + + public Vector3 Position { get; } + + + public Vector3 Rotation { get; } + + + public Vector3 Scale { get; } + + } +} diff --git a/KruacentExiled/KE.Utils/API/Models/ToysSettings/ToySetting.cs b/KruacentExiled/KE.Utils/API/Models/ToysSettings/ToySetting.cs new file mode 100644 index 00000000..8fdc4477 --- /dev/null +++ b/KruacentExiled/KE.Utils/API/Models/ToysSettings/ToySetting.cs @@ -0,0 +1,20 @@ +using Exiled.API.Features.Toys; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace KE.Utils.API.Models.ToysSettings +{ + public abstract class ToySetting + { + + + + public virtual void Create(AdminToy a) + { + + } + } +} diff --git a/KruacentExiled/KE.Utils/API/OtherUtils.cs b/KruacentExiled/KE.Utils/API/OtherUtils.cs new file mode 100644 index 00000000..ef43b888 --- /dev/null +++ b/KruacentExiled/KE.Utils/API/OtherUtils.cs @@ -0,0 +1,18 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using UnityEngine; + +namespace KE.Utils.API +{ + public static class OtherUtils + { + + public static bool IsInCircle(Vector3 pos,Vector3 centerCircle,float radius) + { + return (pos-centerCircle).sqrMagnitude <= Math.Pow(radius, 2); + } + } +} diff --git a/KruacentExiled/KE.Utils/API/Parser.cs b/KruacentExiled/KE.Utils/API/Parser.cs new file mode 100644 index 00000000..a924337f --- /dev/null +++ b/KruacentExiled/KE.Utils/API/Parser.cs @@ -0,0 +1,36 @@ +using Exiled.API.Features; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using UnityEngine; + +namespace KE.Utils.API +{ + public static class Parser + { + public static Vector3 Vector3(string s) + { + string[] temp = s.Substring(1, s.Length - 3).Split(','); + + if(!float.TryParse(temp[0],out float x)) + { + return UnityEngine.Vector3.zero; + } + + if (!float.TryParse(temp[1], out float y)) + { + return UnityEngine.Vector3.zero; + } + if (!float.TryParse(temp[1], out float z)) + { + return UnityEngine.Vector3.zero; + } + + + + return new Vector3(x, y, z); + } + } +} diff --git a/KruacentExiled/KE.Utils/API/ReflectionHelper.cs b/KruacentExiled/KE.Utils/API/ReflectionHelper.cs new file mode 100644 index 00000000..d95fa32a --- /dev/null +++ b/KruacentExiled/KE.Utils/API/ReflectionHelper.cs @@ -0,0 +1,47 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Reflection; +using System.Text; +using System.Threading.Tasks; + +namespace KE.Utils.API +{ + public static class ReflectionHelper + { + public static IEnumerable GetObjects(Assembly assembly = null) + { + List result = new(); + if (assembly == null) + { + assembly = Assembly.GetCallingAssembly(); + } + foreach (Type t in assembly.GetTypes()) + { + try + { + if (typeof(T).IsAssignableFrom(t) && !t.IsAbstract) + { + T ffcc = (T)Activator.CreateInstance(t); + result.Add(ffcc); + } + } + catch (Exception) + { + + } + } + return result; + } + + public static IEnumerable GetObjects(IEnumerable assemblies) + { + List result = new(); + foreach (Assembly assembly in assemblies) + { + result.AddRange(GetObjects(assembly)); + } + return result; + } + } +} diff --git a/KruacentExiled/KE.Utils/API/Sounds/SoundPlayer.cs b/KruacentExiled/KE.Utils/API/Sounds/SoundPlayer.cs new file mode 100644 index 00000000..08090bbd --- /dev/null +++ b/KruacentExiled/KE.Utils/API/Sounds/SoundPlayer.cs @@ -0,0 +1,116 @@ +using Exiled.API.Features; +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using UnityEngine; + +namespace KE.Utils.API.Sounds +{ + public class SoundPlayer + { + private static SoundPlayer _instance; + + public static SoundPlayer Instance + { + get + { + if (_instance == null) + { + _instance = new(); + } + return _instance; + } + } + + private SoundPlayer() { } + + private bool _loaded = false; + public bool Loaded => _loaded; + + public static readonly HashSet clips = new(); + + public static string SoundLocation => Paths.Configs + "/Sounds"; + public static void Load() => Instance.TryLoad(); + public void TryLoad() + { + if (Loaded) + { + return; + } + + if (!Directory.Exists(SoundLocation)) + { + Log.Warn("Directory not found. creating..."); + Directory.CreateDirectory(SoundLocation); + } + + string[] rawfile = Directory.GetFiles(SoundLocation, "*.ogg"); + + foreach (string file in rawfile) + { + string noExFile = Path.GetFileNameWithoutExtension(file); + Log.Info($"loading {file} as {noExFile}"); + clips.Add(noExFile); + AudioClipStorage.LoadClip(file); + } + _loaded = true; + } + + + /// + /// Play a clip at a static point + /// + /// + /// + /// + /// + public AudioClipPlayback Play(string clipName, Vector3 pos, float volume = 50f, float maxDistance = 20f, bool isSpatial = true) + { + if (!Loaded) throw new Exception("clips not loaded use SoundPlayer.Load()"); + Log.Debug($"playing {clipName} at {pos}"); + + var audioPlayer = AudioPlayer.CreateOrGet($"{clipName} ({pos})", onIntialCreation: (p) => + { + GameObject a = new GameObject(); + a.transform.position = pos; + p.transform.parent = a.transform; + Speaker speaker = p.AddSpeaker("main", isSpatial: isSpatial, maxDistance: maxDistance, minDistance: 1f); + speaker.transform.parent = a.transform; + speaker.transform.localPosition = Vector3.zero; + }); + + audioPlayer.AddClip(clipName, volume: volume); + audioPlayer.DestroyWhenAllClipsPlayed = true; + return audioPlayer.AddClip(clipName, volume: volume); + + + } + + /// + /// Play a clip at a + /// + /// + /// + /// + /// + public void Play(string clipName, GameObject objectEmittingSound, float volume = 50f, float maxDistance = 20f, bool isSpatial = true) + { + if (!Loaded) throw new Exception("clips not loaded use SoundPlayer.Instance.Load()"); + Log.Debug($"playing {clipName} at {objectEmittingSound}"); + + var audioPlayer = AudioPlayer.CreateOrGet($"{clipName} ({objectEmittingSound})", onIntialCreation: (p) => + { + + p.transform.parent = objectEmittingSound.transform; + Speaker speaker = p.AddSpeaker("main", isSpatial: isSpatial, maxDistance: maxDistance, minDistance: 1f); + speaker.transform.parent = objectEmittingSound.transform; + speaker.transform.localPosition = Vector3.zero; + }); + audioPlayer.AddClip(clipName, volume: volume); + audioPlayer.DestroyWhenAllClipsPlayed = true; + } + } +} diff --git a/KruacentExiled/KE.Utils/Extensions/AdminToyExtension.cs b/KruacentExiled/KE.Utils/Extensions/AdminToyExtension.cs new file mode 100644 index 00000000..37c3706d --- /dev/null +++ b/KruacentExiled/KE.Utils/Extensions/AdminToyExtension.cs @@ -0,0 +1,25 @@ +using Exiled.API.Features.Toys; +using KE.Utils.Quality; +using KE.Utils.Quality.Enums; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace KE.Utils.Extensions +{ + public static class AdminToyExtension + { + + public static void SetAsPickupAdminToy(this AdminToy toy, bool autoSync = true) + { + QualityHandler.Instance.QualityToysHandler.SetAsPickup(toy); + } + + public static void SetQuality(this AdminToy toy, ModelQuality modelQuality,bool autoSync = true) + { + QualityHandler.Instance.QualityToysHandler.SetQuality(toy, modelQuality); + } + } +} diff --git a/KruacentExiled/KE.Utils/Extensions/NpcExtension.cs b/KruacentExiled/KE.Utils/Extensions/NpcExtension.cs new file mode 100644 index 00000000..6af07bc5 --- /dev/null +++ b/KruacentExiled/KE.Utils/Extensions/NpcExtension.cs @@ -0,0 +1,23 @@ +using CentralAuth; +using Exiled.API.Features; +using Mirror; +using PlayerRoles; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace KE.Utils.Extensions +{ + public static class NpcExtension + { + + + public static void Hide(this Npc npc) + { + npc.ReferenceHub.authManager.NetworkSyncedUserId = "ID_Dedicated"; + npc.ReferenceHub.authManager.syncMode = (SyncMode)ClientInstanceMode.DedicatedServer; + } + } +} diff --git a/KruacentExiled/KE.Utils/Extensions/PlayerExtension.cs b/KruacentExiled/KE.Utils/Extensions/PlayerExtension.cs new file mode 100644 index 00000000..b01f98d2 --- /dev/null +++ b/KruacentExiled/KE.Utils/Extensions/PlayerExtension.cs @@ -0,0 +1,52 @@ +using CustomPlayerEffects; +using Exiled.API.Enums; +using Exiled.API.Features; +using Mirror; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using UnityEngine; + +namespace KE.Utils.Extensions +{ + public static class PlayerExtension + { + public static void SetFakeInvis(this Player p, IEnumerable viewers) + { + Vector3 pos = p.Position; + + try + { + p.ReferenceHub.transform.localPosition = Vector3.zero; + foreach (Player viewer in viewers) + { + Server.SendSpawnMessage.Invoke(null, new object[2] { viewer.NetworkIdentity, viewer.Connection }); + } + + p.ReferenceHub.transform.localPosition = pos; + } + catch (Exception arg) + { + Log.Error(string.Format("{0}: {1}", "SetFakeInvis", arg)); + } + } + + + + + public static void AddLevelEffect(this Player p,EffectType type, int intensity) + { + + + if (!p.TryGetEffect(type, out var effect)) + p.ChangeEffectIntensity(type, (byte)(effect.Intensity + intensity)); + else + p.EnableEffect(type, (byte)intensity); + } + + + + } +} diff --git a/KruacentExiled/KE.Utils/Extensions/RoomExtension.cs b/KruacentExiled/KE.Utils/Extensions/RoomExtension.cs new file mode 100644 index 00000000..35fee2e8 --- /dev/null +++ b/KruacentExiled/KE.Utils/Extensions/RoomExtension.cs @@ -0,0 +1,12 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace KE.Utils.Extensions +{ + internal class RoomExtension + { + } +} diff --git a/KruacentExiled/KE.Utils/Extensions/RoomExtensions.cs b/KruacentExiled/KE.Utils/Extensions/RoomExtensions.cs new file mode 100644 index 00000000..61fd0291 --- /dev/null +++ b/KruacentExiled/KE.Utils/Extensions/RoomExtensions.cs @@ -0,0 +1,55 @@ +using Exiled.API.Features; +using Exiled.API.Enums; +using Discord; +using System.Linq; +using Exiled.API.Extensions; + +namespace KE.Utils.Extensions +{ + public static class RoomExtensions + { + + + public static Room RandomSafeRoom(this ZoneType zone) + { + return Room.List.Where(r => r.IsSafe() && r.Zone == zone).GetRandomValue(); + } + + + /// + /// Check if a is Safe (Decontamination,Warhead) + /// + /// Note: Does NOT check if the is safe to teleport in (ex : TestRoom) + /// + /// + /// return true if the is safe for a ; false otherwise + public static bool IsSafe(this Room room) + { + return room.Zone.IsSafe(); + } + + + /// + /// Check if a is Safe (Decontamination,Warhead) + /// + /// return true if the zone is safe for a ; false otherwise + public static bool IsSafe(this ZoneType zone) + { + bool result = true; + if (zone == ZoneType.LightContainment) + result = Map.DecontaminationState < DecontaminationState.Countdown; + switch (zone) + { + case ZoneType.LightContainment: + case ZoneType.HeavyContainment: + case ZoneType.Entrance: + result = !Warhead.IsDetonated; + break; + } + return result; + } + + + + } +} diff --git a/KruacentExiled/KE.Utils/KE.Utils.csproj b/KruacentExiled/KE.Utils/KE.Utils.csproj new file mode 100644 index 00000000..705cd29f --- /dev/null +++ b/KruacentExiled/KE.Utils/KE.Utils.csproj @@ -0,0 +1,32 @@ + + + + 13.0 + net48 + + + + + + + + + + + + + + + + + + + + if not "$(EXILED_DEV_REFERENCES)"=="" copy /y "$(OutputPath)$(AssemblyName).dll" "$(EXILED_DEV_REFERENCES)\Plugins\" + + + if [[ ! -z "$EXILED_DEV_REFERENCES" ]]; then cp "$(OutputPath)$(AssemblyName).dll" "$EXILED_DEV_REFERENCES/Plugins/"; fi + + + + diff --git a/KruacentExiled/KE.Utils/Quality/Enums/ModelQuality.cs b/KruacentExiled/KE.Utils/Quality/Enums/ModelQuality.cs new file mode 100644 index 00000000..d9d8d295 --- /dev/null +++ b/KruacentExiled/KE.Utils/Quality/Enums/ModelQuality.cs @@ -0,0 +1,16 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace KE.Utils.Quality.Enums +{ + public enum ModelQuality + { + None = -1, + Low, + Medium, + High, + } +} diff --git a/KruacentExiled/KE.Utils/Quality/Handlers/QualityToysHandler.cs b/KruacentExiled/KE.Utils/Quality/Handlers/QualityToysHandler.cs new file mode 100644 index 00000000..b2485795 --- /dev/null +++ b/KruacentExiled/KE.Utils/Quality/Handlers/QualityToysHandler.cs @@ -0,0 +1,179 @@ +using AdminToys; +using Exiled.API.Enums; +using Exiled.API.Extensions; +using Exiled.API.Features; +using Exiled.API.Features.Toys; +using KE.Utils.Quality.Enums; +using KE.Utils.Quality.Settings; +using MEC; +using System; +using System.Collections.Generic; +using System.Linq; +using UnityEngine; +using Light = Exiled.API.Features.Toys.Light; +using QualitySettings = KE.Utils.Quality.Settings.QualitySettings; + +namespace KE.Utils.Quality.Handlers +{ + public class QualityToysHandler + { + private HashSet _pickupToys = new(); + private Dictionary _qualityToys = new(); + public readonly Vector3 Gulag = new Vector3(15000, 15000, 15000); + public const float Delay = Timing.WaitForOneFrame; + public bool IsPickupToy(AdminToy primitive) + { + return _pickupToys.Contains(primitive); + } + + public bool IsQualityToy(AdminToy primitive) + { + return _qualityToys.ContainsKey(primitive); + } + + + public void SetAsPickup(AdminToy toy, bool autoSync = true) + { + if (!_pickupToys.Add(toy)) + { + Log.Warn($"AdminToy {toy} is already a pickupToy"); + return; + } + if (autoSync) + Sync(toy); + } + + public void SetQuality(AdminToy toy, ModelQuality quality, bool autoSync = true) + { + if (toy == null) return; + if (!_qualityToys.ContainsKey(toy)) + _qualityToys.Add(toy, quality); + else + _qualityToys[toy] = quality; + + if (autoSync) + Sync(toy); + } + + + + private void SendToFakePosition(AdminToy adminToy, Player player,Vector3 position) + { + //idk why but without delay it show all of the quality at once + Timing.CallDelayed(Delay, () => + { + if (adminToy is Light l) + { + player.SendFakeSyncVar(l.Base.netIdentity, typeof(LightSourceToy), nameof(LightSourceToy.NetworkPosition), position); + return; + } + if (adminToy is Primitive p) + { + player.SendFakeSyncVar(p.Base.netIdentity, typeof(PrimitiveObjectToy), nameof(PrimitiveObjectToy.NetworkPosition), position); + return; + } + }); + + } + + /// + /// Sync every Players + /// + public void Sync() + { + foreach (Player p in Player.List) + { + Sync(p); + } + } + + /// + /// Sync a specified Player + /// + /// + public void Sync(Player p) + { + + + + var quality = QualitySettings.Get(p); + var pickup = QualitySettings.PickmodelActivated(p); + + HashSet pickupToRemove = []; + HashSet qualityToRemove = []; + + //hide pickup toys + + foreach (AdminToy pk in _pickupToys) + { + try + { + if (pickup) + { + SendToFakePosition(pk, p, pk.Position); + } + else + { + SendToFakePosition(pk, p, Gulag); + } + } + catch (NullReferenceException) + { + //Log.Warn("removing pickup"); + pickupToRemove.Add(pk); + } + + } + + _pickupToys.RemoveWhere(p => pickupToRemove.Contains(p)); + + + foreach (var at in _qualityToys) + { + try + { + if ((at.Value == quality || at.Value == ModelQuality.None) && (pickup || !_pickupToys.Contains(at.Key))) + { + SendToFakePosition(at.Key, p, at.Key.Position); + } + else + { + SendToFakePosition(at.Key, p, Gulag); + } + } + catch (NullReferenceException) + { + //Log.Warn("removing quality" + _qualityToys.Count); + qualityToRemove.Add(at.Key); + } + + + } + foreach(var at in qualityToRemove) + { + + _qualityToys.Remove(at); + } + + } + + /// + /// Sync a specified AdminToy + /// + /// + public void Sync(AdminToy adminToy) + { + //temporary fix + Sync(); + + if (IsPickupToy(adminToy)) + { + + } + if (IsQualityToy(adminToy)) + { + + } + } + } +} diff --git a/KruacentExiled/KE.Utils/Quality/Models/Base/BaseModel.cs b/KruacentExiled/KE.Utils/Quality/Models/Base/BaseModel.cs new file mode 100644 index 00000000..c9f6723c --- /dev/null +++ b/KruacentExiled/KE.Utils/Quality/Models/Base/BaseModel.cs @@ -0,0 +1,41 @@ +using Exiled.API.Enums; +using Exiled.API.Extensions; +using Exiled.API.Features.Toys; +using Exiled.API.Interfaces; +using KE.Utils.Quality.Structs; +using PlayerStatsSystem; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using UnityEngine; +using Light = Exiled.API.Features.Toys.Light; + +namespace KE.Utils.Quality.Models.Base +{ + + /// + /// The blocks to build a model with + /// + public abstract class BaseModel : ICloneable + { + + protected AdminToy _toy; + public AdminToy AdminToy { get { return _toy; } } + private Vector3 _position; + public Vector3 LocalPosition { get { return _position; } } + private Quaternion _rotation; + public Quaternion LocalRotation { get { return _rotation; } } + + + public BaseModel(Vector3 localPositon, Quaternion localRotation) + { + _position = localPositon; + _rotation = localRotation; + } + + public abstract object Clone(); + } + +} diff --git a/KruacentExiled/KE.Utils/Quality/Models/Base/LightModel.cs b/KruacentExiled/KE.Utils/Quality/Models/Base/LightModel.cs new file mode 100644 index 00000000..ce808da1 --- /dev/null +++ b/KruacentExiled/KE.Utils/Quality/Models/Base/LightModel.cs @@ -0,0 +1,26 @@ +using Exiled.API.Features.Toys; +using UnityEngine; +using Light = Exiled.API.Features.Toys.Light; + +namespace KE.Utils.Quality.Models.Base +{ + public class LightModel : BaseModel + { + + /// + /// Create a new Light for modeling + /// + public LightModel(Vector3? scale, Color? color, Vector3 localPositon, Quaternion localRotation) : base(localPositon, localRotation) + { + Light light = Light.Create(null, null, scale, false, color); + _toy = light; + } + + + public override object Clone() + { + Light light = _toy as Light; + return new LightModel(light.Scale, light.Color, LocalPosition, LocalRotation); + } + } +} diff --git a/KruacentExiled/KE.Utils/Quality/Models/Base/PrimitiveModel.cs b/KruacentExiled/KE.Utils/Quality/Models/Base/PrimitiveModel.cs new file mode 100644 index 00000000..22e07225 --- /dev/null +++ b/KruacentExiled/KE.Utils/Quality/Models/Base/PrimitiveModel.cs @@ -0,0 +1,26 @@ +using Exiled.API.Features.Toys; +using UnityEngine; +using Color = UnityEngine.Color; + +namespace KE.Utils.Quality.Models.Base +{ + public class PrimitiveModel : BaseModel + { + /// + /// Create a new Primitive for modeling + /// + public PrimitiveModel(PrimitiveType type, Vector3? scale, Color? color,Vector3 localPosition,Quaternion localRotation) : base(localPosition, localRotation) + { + + Primitive prim = Primitive.Create(type, null, null, scale, false, color); + prim.Collidable = false; + _toy = prim; + } + + public override object Clone() + { + Primitive prim = _toy as Primitive; + return new PrimitiveModel(prim.Type, prim.Scale, prim.Color, LocalPosition, LocalRotation); + } + } +} diff --git a/KruacentExiled/KE.Utils/Quality/Models/Examples/MineModel.cs b/KruacentExiled/KE.Utils/Quality/Models/Examples/MineModel.cs new file mode 100644 index 00000000..00d60fec --- /dev/null +++ b/KruacentExiled/KE.Utils/Quality/Models/Examples/MineModel.cs @@ -0,0 +1,118 @@ +using KE.Utils.Quality.Enums; +using KE.Utils.Quality.Models.Base; +using System.Collections.Generic; +using UnityEngine; +using Light = Exiled.API.Features.Toys.Light; + +namespace KE.Utils.Quality.Models.Examples +{ + public abstract class MineModel : QualityModel + { + protected Light _light; + private bool _lightOn = false; + + + + + public void ToggleLight() + { + if (_light == null) throw new System.Exception("no light"); + if (_lightOn) + _light.UnSpawn(); + else + _light.Spawn(); + _lightOn = !_lightOn; + } + + } + + public class MineModelLow : MineModel + { + public override bool IsPickup => false; + public override ModelQuality Quality => ModelQuality.Low; + + protected override IEnumerable GetBaseModels() + { + Quaternion baseRotation = new(); + //spawn + offset + Vector3 offset = new Vector3(0, .05f); + Vector3 sizeDisk = new Vector3(.7f, 0.1f, .7f); + + Vector3 sizeGlobe = new Vector3(.1f, .1f, .1f); + Vector3 posLight = new Vector3(0, sizeDisk.y+sizeGlobe.y); + + + var baseMine = new PrimitiveModel(PrimitiveType.Cylinder, sizeDisk, Color.black, offset, baseRotation); + + var lightGlobe = new PrimitiveModel(PrimitiveType.Sphere, sizeGlobe , new Color(1, 0, 0, .33f), posLight, baseRotation); + + var lightMine = new LightModel(null, Color.red, posLight, baseRotation); + + _light = lightMine.AdminToy as Light; + _light.Intensity = .55f; + + return [baseMine, lightGlobe, lightMine]; + } + + + } + + public class MineModelMedium : MineModel + { + public override bool IsPickup => false; + public override ModelQuality Quality => ModelQuality.Medium; + + protected override IEnumerable GetBaseModels() + { + Quaternion baseRotation = new(); + //spawn + offset + Vector3 offset = new Vector3(0, .05f); + Vector3 sizeDisk = new Vector3(.7f, 0.1f, .7f); + + Vector3 sizeGlobe = new Vector3(.1f, .1f, .1f); + Vector3 posLight = new Vector3(0, sizeDisk.y + sizeGlobe.y); + + + var baseMine = new PrimitiveModel(PrimitiveType.Cylinder, sizeDisk, Color.black, offset, baseRotation); + + var lightGlobe = new PrimitiveModel(PrimitiveType.Sphere, sizeGlobe, new Color(1, 0, 0, .33f), posLight, baseRotation); + + var lightMine = new LightModel(null, Color.green, posLight, baseRotation); + + _light = lightMine.AdminToy as Light; + _light.Intensity = .55f; + + return [baseMine, lightGlobe, lightMine]; + } + } + + public class MineModelPickup : MineModel + { + public override bool IsPickup => true; + public override ModelQuality Quality => ModelQuality.None; + + + protected override IEnumerable GetBaseModels() + { + Quaternion baseRotation = new(); + //spawn + offset + Vector3 offset = new Vector3(0, .05f); + Vector3 sizeDisk = new Vector3(.7f, 0.1f, .7f); + + Vector3 sizeGlobe = new Vector3(.1f, .1f, .1f); + Vector3 posLight = new Vector3(0, sizeDisk.y + sizeGlobe.y); + + + var baseMine = new PrimitiveModel(PrimitiveType.Cylinder, sizeDisk, Color.black, offset, baseRotation); + + var lightGlobe = new PrimitiveModel(PrimitiveType.Sphere, sizeGlobe, new Color(1, 0, 0, .33f), posLight, baseRotation); + + var lightMine = new LightModel(null, Color.magenta, posLight, baseRotation); + + _light = lightMine.AdminToy as Light; + _light.Intensity = .55f; + + return [baseMine, lightGlobe, lightMine]; + } + } +} diff --git a/KruacentExiled/KE.Utils/Quality/Models/Model.cs b/KruacentExiled/KE.Utils/Quality/Models/Model.cs new file mode 100644 index 00000000..2e26756e --- /dev/null +++ b/KruacentExiled/KE.Utils/Quality/Models/Model.cs @@ -0,0 +1,104 @@ +using Exiled.API.Features; +using Exiled.API.Features.Toys; +using KE.Utils.Quality.Models.Base; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using UnityEngine; + +namespace KE.Utils.Quality.Models +{ + public class Model : IEquatable + { + + + private Vector3 _position; + public Vector3 Position + { + get { return _position; } + set + { + _position = value; + } + } + private Quaternion _rotation; + public Quaternion Rotation + { + get { return _rotation; } + set + { + _rotation = value; + } + } + private ModelPrefab _prefab; + public ModelPrefab Prefab + { + get { return _prefab; } + } + + + + private HashSet _models; + + internal Model(ModelPrefab prefab, Vector3 position, Quaternion rotation,IEnumerable toys,bool spawn) + { + _prefab = prefab; + Position = position; + Rotation = rotation; + _models = new HashSet(toys); + QualityHandler.Instance.QualityToysHandler.Sync(); + + foreach (BaseModel based in toys) + { + AdminToy toy = based.AdminToy; + + if (toy is Primitive p) + p.Collidable = false; + toy.AdminToyBase.transform.position = based.LocalPosition + Position; + toy.AdminToyBase.transform.rotation = based.LocalRotation * Rotation; + } + if(spawn) + { + Spawn(); + } + } + + + public void Destroy() + { + foreach (BaseModel primitive in _models) + { + primitive.AdminToy.Destroy(); + } + } + public void UnSpawn() + { + foreach (BaseModel primitive in _models) + { + primitive.AdminToy.UnSpawn(); + } + } + public void Spawn() + { + QualityHandler.Instance.QualityToysHandler.Sync(); + foreach (BaseModel primitive in _models) + { + primitive.AdminToy.Spawn(); + } + + } + + + public bool Equals(Model x) + { + if (x == null) return false; + return x._prefab == _prefab && x.Position == Position && x.Rotation == Rotation; + } + public int GetHashCode(Model obj) + { + return obj.GetHashCode(); + } + } +} diff --git a/KruacentExiled/KE.Utils/Quality/Models/ModelPrefab.cs b/KruacentExiled/KE.Utils/Quality/Models/ModelPrefab.cs new file mode 100644 index 00000000..bbc39da4 --- /dev/null +++ b/KruacentExiled/KE.Utils/Quality/Models/ModelPrefab.cs @@ -0,0 +1,42 @@ +using Exiled.API.Features; +using Exiled.API.Features.Core; +using Exiled.API.Features.Pickups; +using Exiled.API.Features.Toys; +using Exiled.API.Interfaces; +using KE.Utils.Extensions; +using KE.Utils.Quality.Models.Base; +using KE.Utils.Quality.Structs; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using UnityEngine; +using Light = Exiled.API.Features.Toys.Light; + +namespace KE.Utils.Quality.Models +{ + public abstract class ModelPrefab + { + + protected abstract IEnumerable GetBaseModels(); + + public virtual Model Create(Vector3 position,Quaternion rotation, bool spawn = true) + { + + HashSet clonetoys = new(); + HashSet toys = GetBaseModels().ToHashSet(); + foreach (BaseModel model in toys) + { + BaseModel clone = (BaseModel)model.Clone(); + clonetoys.Add(clone); + } + return new Model(this, position, rotation, clonetoys,spawn); + + } + + + + + } +} diff --git a/KruacentExiled/KE.Utils/Quality/Models/QualityModel.cs b/KruacentExiled/KE.Utils/Quality/Models/QualityModel.cs new file mode 100644 index 00000000..b5cc682f --- /dev/null +++ b/KruacentExiled/KE.Utils/Quality/Models/QualityModel.cs @@ -0,0 +1,40 @@ +using Exiled.API.Features; +using Exiled.API.Features.Toys; +using KE.Utils.Extensions; +using KE.Utils.Quality.Enums; +using KE.Utils.Quality.Models.Base; +using System.Collections.Generic; +using System.Linq; +using UnityEngine; + +namespace KE.Utils.Quality.Models +{ + public abstract class QualityModel : ModelPrefab + { + public abstract ModelQuality Quality { get; } + public abstract bool IsPickup { get; } + + + + + public override sealed Model Create(Vector3 position, Quaternion rotation,bool spawn = true) + { + + HashSet clonetoys = new(); + HashSet toys = GetBaseModels().ToHashSet(); + foreach (BaseModel model in toys) + { + BaseModel clone = (BaseModel)model.Clone(); + + if (IsPickup) + clone.AdminToy.SetAsPickupAdminToy(false); + + clone.AdminToy.SetQuality(Quality,false); + clonetoys.Add(clone); + } + QualityHandler.Sync(); + return new Model(this,position, rotation, clonetoys, spawn); + } + + } +} diff --git a/KruacentExiled/KE.Utils/Quality/QualityHandler.cs b/KruacentExiled/KE.Utils/Quality/QualityHandler.cs new file mode 100644 index 00000000..235d79c9 --- /dev/null +++ b/KruacentExiled/KE.Utils/Quality/QualityHandler.cs @@ -0,0 +1,61 @@ +using Exiled.API.Features; +using Exiled.API.Features.Core.UserSettings; +using KE.Utils.Quality.Handlers; +using KE.Utils.Quality.Settings; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace KE.Utils.Quality +{ + [Obsolete("scrapped", false)] + internal class QualityHandler + { + public QualitySettings QualitySettings { get; private set; } + public QualityToysHandler QualityToysHandler { get; private set; } + + private static QualityHandler _instance; + public static QualityHandler Instance + { + get + { + if(_instance == null ) + _instance = new QualityHandler(); + return _instance; + } + } + private QualityHandler() + { + QualitySettings = new QualitySettings(Changed); + QualityToysHandler = new QualityToysHandler(); + } + + ~QualityHandler() + { + QualityToysHandler = null; + QualitySettings = null; + } + + public void Changed(Player p, SettingBase _) + { + QualityToysHandler.Sync(p); + } + + public void Register() + { + QualitySettings.Register(); + } + + public void Unregister() + { + QualitySettings.Unregister(); + } + + public static void Sync() + { + Instance.QualityToysHandler.Sync(); + } + } +} diff --git a/KruacentExiled/KE.Utils/Quality/QualityToysHandler.cs b/KruacentExiled/KE.Utils/Quality/QualityToysHandler.cs new file mode 100644 index 00000000..27320233 --- /dev/null +++ b/KruacentExiled/KE.Utils/Quality/QualityToysHandler.cs @@ -0,0 +1,155 @@ +using AdminToys; +using Exiled.API.Enums; +using Exiled.API.Extensions; +using Exiled.API.Features; +using Exiled.API.Features.Toys; +using KE.Utils.Quality.Enums; +using KE.Utils.Quality.Settings; +using System.Collections.Generic; +using System.Linq; +using UnityEngine; +using Light = Exiled.API.Features.Toys.Light; +using QualitySettings = KE.Utils.Quality.Settings.QualitySettings; + +namespace KE.Utils.Quality +{ + public class QualityToysHandler + { + private HashSet _pickupToys = new(); + private Dictionary _qualityToys = new(); + public readonly Vector3 Gulag = new Vector3(15000,15000,15000); + + public bool IsPickupToy(AdminToy primitive) + { + return _pickupToys.Contains(primitive); + } + + public bool IsQualityToy(AdminToy primitive) + { + return _qualityToys.ContainsKey(primitive); + } + + + public void SetAsPickup(AdminToy toy) + { + if (!_pickupToys.Add(toy)) + { + Log.Warn($"AdminToy {toy} is already a pickupToy"); + return; + } + } + + public void SetQuality(AdminToy toy,ModelQuality quality) + { + if (toy == null) return; + if (!_qualityToys.ContainsKey(toy)) + _qualityToys.Add(toy,quality); + else + _qualityToys[toy] = quality; + } + + + + private void SendToShadowRealm(AdminToy adminToy, Player player) + { + if(adminToy is Light l) + { + player.SendFakeSyncVar(l.Base.netIdentity, typeof(LightSourceToy), nameof(LightSourceToy.NetworkPosition), Gulag); + return; + } + if(adminToy is Primitive p) + { + player.SendFakeSyncVar(p.Base.netIdentity, typeof(PrimitiveObjectToy), nameof(PrimitiveObjectToy.NetworkPosition), Gulag); + return; + } + } + + private void SetTruePosition(AdminToy adminToy, Player player) + { + if (adminToy is Light l) + { + player.SendFakeSyncVar(l.Base.netIdentity, typeof(LightSourceToy), nameof(LightSourceToy.NetworkPosition), l.Position); + return; + } + if (adminToy is Primitive p) + { + player.SendFakeSyncVar(p.Base.netIdentity, typeof(PrimitiveObjectToy), nameof(PrimitiveObjectToy.NetworkPosition), p.Position); + return; + } + } + + /// + /// Sync every Players + /// + public void Sync() + { + foreach(Player p in Player.List) + { + Sync(p); + } + } + + /// + /// Sync a specified Player + /// + /// + public void Sync(Player p) + { + var quality = QualitySettings.Get(p); + var pickup = QualitySettings.PickmodelActivated(p); + + if (!pickup) + { + //hide pickup toys + foreach (AdminToy pk in _pickupToys) + { + SendToShadowRealm(pk, p); + } + } + else + { + //show pickup toys + foreach (AdminToy pk in _pickupToys) + { + SetTruePosition(pk, p); + } + } + + + + + foreach(var at in _qualityToys) + { + if(at.Value == quality) + { + if (pickup || !_pickupToys.Contains(at.Key)) + { + SetTruePosition(at.Key, p); + } + } + else + { + SendToShadowRealm(at.Key, p); + } + + } + + } + + /// + /// Sync a specified AdminToy + /// + /// + public void Sync(AdminToy adminToy) + { + if (IsPickupToy(adminToy)) + { + + } + if (IsQualityToy(adminToy)) + { + + } + } + } +} diff --git a/KruacentExiled/KE.Utils/Quality/Settings/QualitySettings.cs b/KruacentExiled/KE.Utils/Quality/Settings/QualitySettings.cs new file mode 100644 index 00000000..ca8d49be --- /dev/null +++ b/KruacentExiled/KE.Utils/Quality/Settings/QualitySettings.cs @@ -0,0 +1,62 @@ +using Exiled.API.Features; +using Exiled.API.Features.Core.UserSettings; +using KE.Utils.Quality.Enums; +using System; + +namespace KE.Utils.Quality.Settings +{ + public class QualitySettings + { + + private static int _idQuality = 0; + private static int _idModels = 1; + private static int _idSlider = 2; + private SettingBase[] _settings; + public QualitySettings(Action onChanged) + { + HeaderSetting header = new("Quality Settings"); + _settings = + [ + header, + new DropdownSetting(_idQuality,"ModelQuality",["Low","Medium", "High"],onChanged:onChanged), + new TwoButtonsSetting(_idModels,"Pickup models","Disabled","Enabled", onChanged:onChanged) + ]; + } + + public void Register() + { + SettingBase.Register(_settings); + SettingBase.SendToAll(); + } + + public void Unregister() + { + SettingBase.Unregister(settings:_settings); + } + + + + + public static ModelQuality Get(Player p) + { + if (!SettingBase.TryGetSetting(p, _idQuality, out var setting)) return ModelQuality.None; + + return setting.SelectedOption switch + { + "Low" => ModelQuality.Low, + "Medium" => ModelQuality.Medium, + "High" => ModelQuality.High, + _ => ModelQuality.None, + }; + } + + + public static bool PickmodelActivated(Player p) + { + if (!SettingBase.TryGetSetting(p, _idModels, out var setting)) return false; + return setting.IsSecond; + } + + + } +} diff --git a/KruacentExiled/KE.Utils/Quality/Structs/LocalWorldSpace.cs b/KruacentExiled/KE.Utils/Quality/Structs/LocalWorldSpace.cs new file mode 100644 index 00000000..d9c6205b --- /dev/null +++ b/KruacentExiled/KE.Utils/Quality/Structs/LocalWorldSpace.cs @@ -0,0 +1,23 @@ +using Exiled.API.Interfaces; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using UnityEngine; + +namespace KE.Utils.Quality.Structs +{ + public readonly struct LocalWorldSpace : IWorldSpace + { + + public Vector3 Position { get; } + public Quaternion Rotation { get; } + + public LocalWorldSpace(Vector3 position, Quaternion rotation) + { + Position = position; + Rotation = rotation; + } + } +} diff --git a/KruacentExiled/KE.Utils/Quality/Tests/Test.cs b/KruacentExiled/KE.Utils/Quality/Tests/Test.cs new file mode 100644 index 00000000..6ebd3f66 --- /dev/null +++ b/KruacentExiled/KE.Utils/Quality/Tests/Test.cs @@ -0,0 +1,108 @@ +using Exiled.API.Extensions; +using Exiled.API.Features; +using Exiled.API.Features.Toys; +using KE.Utils.Quality.Models; +using KE.Utils.Quality.Models.Examples; +using MEC; +using PlayerRoles; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using UnityEngine; + +namespace KE.Utils.Quality.Tests +{ + public class Test + { + private QualityHandler QualityHandler; + + + private Test(QualityHandler q) + { + QualityHandler = q; + try + { + TestMine(); + } + catch (Exception ex) + { + Log.Error("Exception for TestMine :\n"+ex); + } + + } + internal void TestQuality() + { + Vector3 pos = RoleTypeId.Scp049.GetRandomSpawnLocation().Position; + Primitive c = Primitive.Create(pos); + c.Color = Color.red; + Primitive c2 = Primitive.Create(pos + Vector3.one); + c2.Color = Color.green; + + + QualityHandler.QualityToysHandler.SetQuality(c, Enums.ModelQuality.Low); + QualityHandler.QualityToysHandler.SetQuality(c2, Enums.ModelQuality.Medium); + } + + internal void StressTest(int count) + { + Timing.RunCoroutine(Stress(count)); + } + + + private IEnumerator Stress(int count) + { + Vector3 pos = RoleTypeId.Scp049.GetRandomSpawnLocation().Position; + Vector3 scale = new Vector3(.1f, .1f, .1f); + float maxSpread = 5; + for (int i = 0; i < count; i++) + { + Primitive c = Primitive.Create(pos + new Vector3(UnityEngine.Random.Range(0f, maxSpread), UnityEngine.Random.Range(0f, maxSpread), UnityEngine.Random.Range(0f, maxSpread)), scale: scale); + QualityHandler.QualityToysHandler.SetQuality(c, Enums.ModelQuality.Medium); + } + QualityHandler.QualityToysHandler.Sync(); + yield return 0; + } + + public void TestMine() + { + Log.Info("TestMine"); + Vector3 pos = RoleTypeId.Scp049.GetRandomSpawnLocation().Position; + MineModelLow mml = new(); + + + Model m = mml.Create(pos, new Quaternion()); + m.Spawn(); + + + MineModelMedium mmm = new(); + + m = mmm.Create(pos + Vector3.up, new Quaternion()); + m.Spawn(); + + + MineModelPickup mmp = new(); + m = mmp.Create(pos + Vector3.right, new Quaternion()); + m.Spawn(); + + QualityHandler.Sync(); + + + + + + + + + foreach (var item in Player.List) + { + item.Teleport(pos); + } + + + + + } + } +} diff --git a/KruacentExiled/KruacentExiled.sln b/KruacentExiled/KruacentExiled.sln index 135e1e35..e813d7c5 100644 --- a/KruacentExiled/KruacentExiled.sln +++ b/KruacentExiled/KruacentExiled.sln @@ -3,7 +3,7 @@ Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio Version 17 VisualStudioVersion = 17.12.35506.116 MinimumVisualStudioVersion = 10.0.40219.1 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "KE.Items", "KE.Items\KE.Items.csproj", "{2FE04C4D-7FA1-4EC5-A8AF-618EDE0C037C}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "KE.Utils", "KE.Utils\KE.Utils.csproj", "{DFEF41B3-5BD3-428A-A7BA-7A490E65C71F}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "KE.Misc", "KE.Misc\KE.Misc.csproj", "{CD822DB2-756E-4887-93AB-2D2F16BF542C}" EndProject @@ -13,16 +13,18 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "KE.GlobalEventFramework", " EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "KE.GlobalEventFramework.Examples", "KE.GlobalEventFramework.Examples\KE.GlobalEventFramework.Examples.csproj", "{07B92E87-F48F-4F9F-BA0E-1BCB2AF52F53}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "KE.Items", "KE.Items\KE.Items.csproj", "{87D91720-B7B5-4FB7-AB18-FB6E70AC0D68}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU Release|Any CPU = Release|Any CPU EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution - {2FE04C4D-7FA1-4EC5-A8AF-618EDE0C037C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {2FE04C4D-7FA1-4EC5-A8AF-618EDE0C037C}.Debug|Any CPU.Build.0 = Debug|Any CPU - {2FE04C4D-7FA1-4EC5-A8AF-618EDE0C037C}.Release|Any CPU.ActiveCfg = Release|Any CPU - {2FE04C4D-7FA1-4EC5-A8AF-618EDE0C037C}.Release|Any CPU.Build.0 = Release|Any CPU + {DFEF41B3-5BD3-428A-A7BA-7A490E65C71F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {DFEF41B3-5BD3-428A-A7BA-7A490E65C71F}.Debug|Any CPU.Build.0 = Debug|Any CPU + {DFEF41B3-5BD3-428A-A7BA-7A490E65C71F}.Release|Any CPU.ActiveCfg = Release|Any CPU + {DFEF41B3-5BD3-428A-A7BA-7A490E65C71F}.Release|Any CPU.Build.0 = Release|Any CPU {CD822DB2-756E-4887-93AB-2D2F16BF542C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {CD822DB2-756E-4887-93AB-2D2F16BF542C}.Debug|Any CPU.Build.0 = Debug|Any CPU {CD822DB2-756E-4887-93AB-2D2F16BF542C}.Release|Any CPU.ActiveCfg = Release|Any CPU @@ -39,6 +41,10 @@ Global {07B92E87-F48F-4F9F-BA0E-1BCB2AF52F53}.Debug|Any CPU.Build.0 = Debug|Any CPU {07B92E87-F48F-4F9F-BA0E-1BCB2AF52F53}.Release|Any CPU.ActiveCfg = Release|Any CPU {07B92E87-F48F-4F9F-BA0E-1BCB2AF52F53}.Release|Any CPU.Build.0 = Release|Any CPU + {87D91720-B7B5-4FB7-AB18-FB6E70AC0D68}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {87D91720-B7B5-4FB7-AB18-FB6E70AC0D68}.Debug|Any CPU.Build.0 = Debug|Any CPU + {87D91720-B7B5-4FB7-AB18-FB6E70AC0D68}.Release|Any CPU.ActiveCfg = Release|Any CPU + {87D91720-B7B5-4FB7-AB18-FB6E70AC0D68}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/README.md b/README.md index 8b8a26f5..95b795d1 100644 --- a/README.md +++ b/README.md @@ -1,15 +1,45 @@ -# KruacentExiled ---- +

+ GitHub Profile Photo +

-This repo was made for our small (6 players) private SCP:SL server using the Exiled Framework. +

Kruaçent-Exiled

+
-## Global Event Framework +

Kruaçent-Exiled is a plugin using the Exiled Framework for SCP: Secret Laboratory servers. The plugin was initially created for our small (6-player) private SCP:SL servers

-the Global Event Framework (GEF) is made to add Global Events which are tweaks in the gameplay which is revealed at the start of each round. +
+
+

-## Blackout 'N Door -This plugin was made to avoid camping on surface and avoid the sole SCP being stuck. +

project-image

-## Armes (Weapons) -Created new custom weapon will probably renamed it to item when we get item +

shieldsshields

+ +

🧐 Features

+ +Here're some of the project's features: + +* **Global Event Framework** : The Global Event Framework is designed to introduce Global Events which are gameplay modifications revealed at the beginning of each round. You can easily create your own custom Global Events with dozens of examples provided. +* **BlackoutNDoor** : The BlackoutNDoor introduces new door and light systems. The lights randomly turn off/on and the doors can randomly open and close. +* **Custom Items** : The Customs Items add differents new guns and stuff in the game. You can easily create your own Custom Items with dozens of examples provided. +* **Miscellaneous** : The Miscellaneous plugin changes the game settings such as new inputs and outputs for human in 914 explosive D-Class cells the elevators that can move on its own and new announcements for specific players deaths. + +

🛠️ Installation Steps:

+ +

1. Download the DLL you want to use from the latest release.

+ +

2. Go to Exiled/Plugins and place the DLL there.

+ +

3. Restart your SCP:SL server.

+ +

4. The plugin will now be in your server.

+ + +

🛡️ License:

+ +This project is licensed under the Apache License + +
+
+
From d0211f59d0d565667e3a7232cf8639e3062799ce Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Thu, 18 Sep 2025 18:36:59 +0200 Subject: [PATCH 343/853] fixed some stuff after the merge --- .../KE.Items/Features/KECustomKeycard.cs | 33 ------- .../KE.Items/Features/KEDroppableItem.cs | 48 --------- KruacentExiled/KE.Items/Items/Defibrilator.cs | 2 - KruacentExiled/KE.Items/Items/DivinePills.cs | 13 --- KruacentExiled/KE.Items/Items/Mine.cs | 16 +-- .../KE.Items/Items/SainteGrenada.cs | 2 +- KruacentExiled/KE.Items/Items/Scp7045.cs | 5 +- .../KE.Items/Lights/LightsHandler.cs | 37 ------- KruacentExiled/KE.Items/MainPlugin.cs | 62 +----------- .../KE.Items/PickupModels/PickupQuality.cs | 2 + .../KE.Items/Settings/SettingsHandler.cs | 98 ------------------- .../KE.Items/Upgrade/UpgradeHandler.cs | 82 ---------------- .../KE.Items/Upgrade/UpgradeProperties.cs | 35 ------- 13 files changed, 11 insertions(+), 424 deletions(-) delete mode 100644 KruacentExiled/KE.Items/Features/KECustomKeycard.cs delete mode 100644 KruacentExiled/KE.Items/Features/KEDroppableItem.cs delete mode 100644 KruacentExiled/KE.Items/Lights/LightsHandler.cs delete mode 100644 KruacentExiled/KE.Items/Settings/SettingsHandler.cs delete mode 100644 KruacentExiled/KE.Items/Upgrade/UpgradeHandler.cs delete mode 100644 KruacentExiled/KE.Items/Upgrade/UpgradeProperties.cs diff --git a/KruacentExiled/KE.Items/Features/KECustomKeycard.cs b/KruacentExiled/KE.Items/Features/KECustomKeycard.cs deleted file mode 100644 index 87380725..00000000 --- a/KruacentExiled/KE.Items/Features/KECustomKeycard.cs +++ /dev/null @@ -1,33 +0,0 @@ -using Exiled.API.Features; -using Exiled.CustomItems.API.Features; -using MHints = HintServiceMeow.Core.Models.Hints.Hint; -using KE.Items.Interface; -using System.Text; -using KE.Utils.API.Displays.DisplayMeow; -using MEC; -using HintServiceMeow.Core.Extension; -using HintServiceMeow.Core.Utilities; -using System.Reflection; -using Exiled.Events.EventArgs.Player; -using Exiled.API.Features.Items; -using Exiled.API.Extensions; - -namespace KE.Items.Features -{ - public abstract class KECustomKeycard : CustomKeycard - { - - protected override void ShowPickedUpMessage(Player player) - { - KECustomItem.Message(this, player, true); - } - - protected override void ShowSelectedMessage(Player player) - { - KECustomItem.Message(this, player); - } - - - - } -} diff --git a/KruacentExiled/KE.Items/Features/KEDroppableItem.cs b/KruacentExiled/KE.Items/Features/KEDroppableItem.cs deleted file mode 100644 index 7710f92b..00000000 --- a/KruacentExiled/KE.Items/Features/KEDroppableItem.cs +++ /dev/null @@ -1,48 +0,0 @@ -using Exiled.Events.EventArgs.Player; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace KE.Items.Features -{ - public abstract class KEDroppableItem : KECustomKeycard - { - - protected override void SubscribeEvents() - { - Exiled.Events.Handlers.Player.DroppingItem += this.DroppingItem; - base.SubscribeEvents(); - } - - - protected override void UnsubscribeEvents() - { - Exiled.Events.Handlers.Player.DroppingItem -= this.DroppingItem; - base.UnsubscribeEvents(); - } - - - private void DroppingItem(DroppingItemEventArgs ev) - { - if (!Check(ev.Item)) return; - if (ev.IsThrown) - { - return; - } - - ev.IsAllowed = false; - DroppingEffect(ev); - } - - - /// - /// no need to check if thrown - /// but still need to remove the item afterward - /// - /// - protected abstract void DroppingEffect(DroppingItemEventArgs ev); - - } -} diff --git a/KruacentExiled/KE.Items/Items/Defibrilator.cs b/KruacentExiled/KE.Items/Items/Defibrilator.cs index c60c89f9..50c83a5d 100644 --- a/KruacentExiled/KE.Items/Items/Defibrilator.cs +++ b/KruacentExiled/KE.Items/Items/Defibrilator.cs @@ -30,8 +30,6 @@ public class Defibrilator : KECustomItem, ILumosItem DynamicSpawnPoints = new List { new DynamicSpawnPoint() { Chance = 50, Location = SpawnLocationType.Inside079Secondary }, - new DynamicSpawnPoint() { Chance = 20, Location = SpawnLocationType.InsideHidLower }, - new DynamicSpawnPoint() { Chance = 20, Location = SpawnLocationType.InsideHidUpper }, }, LockerSpawnPoints = new List diff --git a/KruacentExiled/KE.Items/Items/DivinePills.cs b/KruacentExiled/KE.Items/Items/DivinePills.cs index 181d1a65..cc314e71 100644 --- a/KruacentExiled/KE.Items/Items/DivinePills.cs +++ b/KruacentExiled/KE.Items/Items/DivinePills.cs @@ -3,24 +3,11 @@ using Exiled.API.Features.Attributes; using Exiled.API.Features.Spawn; using Exiled.CustomItems.API.Features; -using MEC; using Exiled.Events.EventArgs.Player; using PlayerHandle = Exiled.Events.Handlers.Player; -using Exiled.API.Features; -using Exiled.API.Extensions; -using UnityEngine; -using CustomPlayerEffects; -using System.Linq; -using PlayerRoles; using KE.Items.Interface; -using Exiled.CustomItems.API.EventArgs; -using Exiled.Events.EventArgs.Scp914; -using Exiled.API.Features.Items; -using System.Data; -using Exiled.API.Features.Pickups; using KE.Items.ItemEffects; using Scp914; -using System.Collections.ObjectModel; using KE.Items.Features; using KE.Items.Core.Upgrade; diff --git a/KruacentExiled/KE.Items/Items/Mine.cs b/KruacentExiled/KE.Items/Items/Mine.cs index a8b239d3..7e6d5be1 100644 --- a/KruacentExiled/KE.Items/Items/Mine.cs +++ b/KruacentExiled/KE.Items/Items/Mine.cs @@ -1,22 +1,14 @@ -using Exiled.CustomItems.API.Features; -using System; -using System.Collections.Generic; -using UnityEngine; +using UnityEngine; using Exiled.Events.EventArgs.Player; using KE.Items.ItemEffects; -using KE.Utils.Quality.Models; -using KE.Utils.Quality.Models.Examples; -using MEC; using KE.Items.Features; -using Exiled.API.Features.Toys; -using KE.Utils.API.Models.Blueprints; -using UnityEngine.Experimental.GlobalIllumination; -using Exiled.API.Interfaces; using KE.Items.Items.PickupModels; +using KE.Items.Interface; +using Exiled.API.Features.Spawn; namespace KE.Items.Items { - [CustomItem(ItemType.KeycardJanitor)] + [Exiled.API.Features.Attributes.CustomItem(ItemType.KeycardJanitor)] public class Mine : KECustomItem, ILumosItem, ISwichableEffect, ICustomPickupModel { public override uint Id { get; set; } = 1053; diff --git a/KruacentExiled/KE.Items/Items/SainteGrenada.cs b/KruacentExiled/KE.Items/Items/SainteGrenada.cs index 7a92a4df..ca3df482 100644 --- a/KruacentExiled/KE.Items/Items/SainteGrenada.cs +++ b/KruacentExiled/KE.Items/Items/SainteGrenada.cs @@ -24,7 +24,7 @@ public class SainteGrenada : KECustomGrenade, ILumosItem public override float Weight { get; set; } = 1.5f; public override float FuseTime { get; set; } = 6f; public override bool ExplodeOnCollision { get; set; } = false; - public float DamageModifier { get; set; } = 3f; + public override float DamageModifier { get; set; } = 3f; public Color Color { get; set; } = Color.red; diff --git a/KruacentExiled/KE.Items/Items/Scp7045.cs b/KruacentExiled/KE.Items/Items/Scp7045.cs index 20cfb877..99b057ec 100644 --- a/KruacentExiled/KE.Items/Items/Scp7045.cs +++ b/KruacentExiled/KE.Items/Items/Scp7045.cs @@ -27,10 +27,10 @@ namespace KE.Items.Items { //[CustomItem(ItemType.SCP1576)] - [Obsolete("Scrapped - Can't make a good sound quality without external file")] + /*[Obsolete("Scrapped - Can't make a good sound quality without external file")] public class Scp7045 : KECustomItem { - + /* private static readonly OpusDecoder _decoder = new(); private static readonly OpusEncoder _encoder = new(OpusApplicationType.Voip); private static readonly Dictionary _speakers = new(); @@ -226,4 +226,5 @@ private Room FindNearbyRoom(Player p, int depth) return rooms.Count > 0 ? rooms.GetRandomValue() : Room.Random(); } } + */ } \ No newline at end of file diff --git a/KruacentExiled/KE.Items/Lights/LightsHandler.cs b/KruacentExiled/KE.Items/Lights/LightsHandler.cs deleted file mode 100644 index 1b1ad042..00000000 --- a/KruacentExiled/KE.Items/Lights/LightsHandler.cs +++ /dev/null @@ -1,37 +0,0 @@ -using Exiled.CustomItems.API.Features; -using InventorySystem.Items.Pickups; -using KE.Items.Interface; -using KE.Utils.API.Interfaces; -using LabApi.Features.Wrappers; - -namespace KE.Items.Lights -{ - internal class LightsHandler : IUsingEvents - { - public float Intensity { get; set; } = .5f; - public void SubscribeEvents() - { - ItemPickupBase.OnPickupAdded += AddPickup; - } - - public void UnsubscribeEvents() - { - ItemPickupBase.OnPickupAdded -= AddPickup; - } - - - private void AddPickup(ItemPickupBase pickup) - { - if (CustomItem.TryGet(Exiled.API.Features.Pickups.Pickup.Get(pickup), out CustomItem item) && item is ILumosItem li) - { - - var l = LightSourceToy.Create(pickup.transform, false); - l.Color = li.Color; - l.Intensity = Intensity; - - l.Spawn(); - } - - } - } -} diff --git a/KruacentExiled/KE.Items/MainPlugin.cs b/KruacentExiled/KE.Items/MainPlugin.cs index ab5150e4..5eeb06e8 100644 --- a/KruacentExiled/KE.Items/MainPlugin.cs +++ b/KruacentExiled/KE.Items/MainPlugin.cs @@ -76,66 +76,6 @@ public override void OnDisabled() Instance = null; } - public void Pick(PickingUpItemEventArgs ev) - { - Pickup pickup = ev.Pickup; - { - Light val = pl[pickup]; - if (val != null) - { - val.UnSpawn(); - val.Destroy(); - } - pl.Remove(pickup); - } - } - public void Drop(DroppedItemEventArgs ev) - { - Pickup pickup = ev.Pickup; - if (CustomItem.TryGet(pickup, out CustomItem item) && item is ILumosItem ci) - { - pl.Add(pickup, null); - } - - - - foreach (var x in pl.ToList()) - { - if(CustomItem.TryGet(x.Key, out CustomItem cui) && cui is ILumosItem ci) - { - Light light = Light.Create(x.Key.Position, null, null, true, ci.Color); - light.Intensity = 0.5f; - Log.Debug("preif"); - if (x.Value != null) - { - Log.Debug("pre val"); - Light val = x.Value; - Log.Debug($"destroy light {val.Position}"); - val.UnSpawn(); - Log.Debug("pre destroy"); - val.Destroy(); - } - else - Log.Debug("first cretate"); - Log.Debug("reasigne"); - pl[x.Key] = light; - Log.Debug("post reasigne"); - //Log.Debug(x.Key.Position+";"+x.Value.Position); - } - else - { - Light val = x.Value; - val.UnSpawn(); - val.Destroy(); - pl.Remove(x.Key); - } - } - Log.Debug("waiting"); - yield return Timing.WaitForSeconds(0.1f); - } - Log.Debug("end while"); - - } - + } } \ No newline at end of file diff --git a/KruacentExiled/KE.Items/PickupModels/PickupQuality.cs b/KruacentExiled/KE.Items/PickupModels/PickupQuality.cs index e64d8b0b..7d5b709b 100644 --- a/KruacentExiled/KE.Items/PickupModels/PickupQuality.cs +++ b/KruacentExiled/KE.Items/PickupModels/PickupQuality.cs @@ -18,6 +18,7 @@ namespace KE.Items.PickupModels [Obsolete("scrapped",true)] internal class PickupQuality { + /* public const float RefreshRate = .1f; private readonly Dictionary pl = new (); public void SubscribeEvents() @@ -129,5 +130,6 @@ public static bool Check(Pickup pickup) { return CustomItem.TryGet(Exiled.API.Features.Pickups.Pickup.Get(pickup), out CustomItem item) && item is ICustomPickupModel; } + */ } } diff --git a/KruacentExiled/KE.Items/Settings/SettingsHandler.cs b/KruacentExiled/KE.Items/Settings/SettingsHandler.cs deleted file mode 100644 index 289cb028..00000000 --- a/KruacentExiled/KE.Items/Settings/SettingsHandler.cs +++ /dev/null @@ -1,98 +0,0 @@ -using Exiled.API.Features; -using Exiled.API.Features.Core.UserSettings; -using KE.Utils.API.Interfaces; -using KE.Utils.Quality.Enums; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Runtime; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; -using System.Runtime.Remoting.Messaging; -using System.Text; -using System.Threading.Tasks; - -namespace KE.Items.Settings -{ - internal class SettingsHandler : IUsingEvents - { - - private SettingBase[] _settings; - private const int _idDesc = 0; - private const int _idPrefix = 1; - private const int _idTimeCustomItem = 2; - private const int _idTimeCustomItemEffect = 3; - - - - private void CreateSettings() - { - - _settings = - [ - new HeaderSetting ("Custom Items Settings"), - new TwoButtonsSetting(_idDesc,"Descriptions","Disabled","Enabled",true,"hide/show the description of the item and its upgrade chances ", onChanged:OnChanged), - new TwoButtonsSetting(_idPrefix,"Pickup/Select prefixes","Disabled","Enabled",false,"show/hide the whole sentence for the picking or selecting of the item, if hidden it will show a (P) if pickup or a (I) if in inventory before the name of the item ", onChanged:OnChanged), - new SliderSetting(_idTimeCustomItem,"Time shown",0,30,10), - new SliderSetting(_idTimeCustomItemEffect,"Time effect shown",0,30,10), - - ]; - SettingBase.Register(_settings); - - } - - - public void SubscribeEvents() - { - CreateSettings(); - SettingBase.SendToAll(); - } - - public void UnsubscribeEvents() - { - SettingBase.Unregister(); - } - - - private void OnChanged(Player p, SettingBase settings) - { - - } - - - - internal float GetTime(Player p) - { - if (!SettingBase.TryGetSetting(p, _idTimeCustomItem, out var setting)) return 10; - return setting.SliderValue; - } - - internal float GetTimeEffect(Player p) - { - if (!SettingBase.TryGetSetting(p, _idTimeCustomItemEffect, out var setting)) return 10; - return setting.SliderValue; - } - - /// - /// - /// - /// - /// true if the player wants description ; false otherwise - internal bool GetDescriptionsSettings(Player p) - { - if (!SettingBase.TryGetSetting(p, _idDesc, out var setting)) return true; - return setting.IsSecond; - } - - /// - /// - /// - /// - /// true if the player wants prefixes ; false otherwise - internal bool GetPrefixes(Player p) - { - if (!SettingBase.TryGetSetting(p, _idPrefix, out var setting)) return false; - return setting.IsSecond; - } - } -} diff --git a/KruacentExiled/KE.Items/Upgrade/UpgradeHandler.cs b/KruacentExiled/KE.Items/Upgrade/UpgradeHandler.cs deleted file mode 100644 index 011a8404..00000000 --- a/KruacentExiled/KE.Items/Upgrade/UpgradeHandler.cs +++ /dev/null @@ -1,82 +0,0 @@ -using Exiled.API.Features; -using Exiled.API.Features.Items; -using Exiled.CustomItems.API.Features; -using Exiled.Events.EventArgs.Scp914; -using KE.Items.Interface; -using KE.Utils.API.Interfaces; -using Scp914; - -namespace KE.Items.Upgrade -{ - internal class UpgradeHandler : IUsingEvents - { - - public void SubscribeEvents() - { - Exiled.Events.Handlers.Scp914.UpgradingInventoryItem += UpgradeItem; - Exiled.Events.Handlers.Scp914.UpgradingPickup += UpgradePickUp; - } - - public void UnsubscribeEvents() - { - Exiled.Events.Handlers.Scp914.UpgradingInventoryItem -= UpgradeItem; - Exiled.Events.Handlers.Scp914.UpgradingPickup -= UpgradePickUp; - } - - - private void UpgradeItem(UpgradingInventoryItemEventArgs ev) - { - if (!CustomItem.TryGet(ev.Item, out CustomItem ci)) return; - if (!(ci is IUpgradableCustomItem upgradable)) return; - Log.Debug("upgrading item"); - if (UpgradeCheck(upgradable, ev.KnobSetting)) - { - Log.Debug("success"); - var newItemid = upgradable.Upgrade[ev.KnobSetting].UpgradedItem; - - CustomItem newItem = CustomItem.Get(newItemid); - - ev.Player.RemoveItem(ev.Item); - newItem?.Give(ev.Player); - if (newItem == null) Log.Warn("warning id of custom item not found"); - - } - ev.IsAllowed = false; - } - - private void UpgradePickUp(UpgradingPickupEventArgs ev) - { - - if (!CustomItem.TryGet(ev.Pickup, out CustomItem ci)) return; - if (!(ci is IUpgradableCustomItem upgradable)) return; - Log.Debug("upgrading pickup"); - - if (UpgradeCheck(upgradable, ev.KnobSetting)) - { - Log.Debug("success"); - var newItemid = upgradable.Upgrade[ev.KnobSetting].UpgradedItem; - - CustomItem newItem = CustomItem.Get(newItemid); - - ev.Pickup.Destroy(); - newItem.Spawn(ev.OutputPosition); - if (newItem == null) Log.Warn("warning id of custom item not found"); - } - - ev.IsAllowed = false; - } - - private bool UpgradeCheck(IUpgradableCustomItem upgradable,Scp914KnobSetting knob) - { - if (!upgradable.Upgrade.TryGetValue(knob, out UpgradeProperties item)) return false; - if (MainPlugin.Instance.Config.Debug) - { - return true; - } - float random = UnityEngine.Random.Range(0f, 100f); - if (random < item.Chance) return true; - return false; - } - - } -} diff --git a/KruacentExiled/KE.Items/Upgrade/UpgradeProperties.cs b/KruacentExiled/KE.Items/Upgrade/UpgradeProperties.cs deleted file mode 100644 index 5a44efbf..00000000 --- a/KruacentExiled/KE.Items/Upgrade/UpgradeProperties.cs +++ /dev/null @@ -1,35 +0,0 @@ -using Exiled.CustomItems.API.Features; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Runtime.ExceptionServices; -using System.Text; -using System.Threading.Tasks; -using YamlDotNet.Core.Tokens; - -namespace KE.Items.Upgrade -{ - public class UpgradeProperties - { - private float _chance; - public float Chance - { - get { return _chance; } - } - - private uint _newItem; - public uint UpgradedItem - { - get { return _newItem; } - } - - public UpgradeProperties(float chance, uint newItem) - { - _newItem = newItem; - if (chance > 100) _chance = 100; - else if(chance < 0) _chance = 0; - else _chance = chance; - } - - } -} From 8e2dd26a4331ab20d0a404e48ebb8706c260925e Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Thu, 18 Sep 2025 18:39:38 +0200 Subject: [PATCH 344/853] updated to 9.9.1 --- KruacentExiled/KE.CustomRoles/KE.CustomRoles.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/KruacentExiled/KE.CustomRoles/KE.CustomRoles.csproj b/KruacentExiled/KE.CustomRoles/KE.CustomRoles.csproj index 2871bd44..a96f8fbc 100644 --- a/KruacentExiled/KE.CustomRoles/KE.CustomRoles.csproj +++ b/KruacentExiled/KE.CustomRoles/KE.CustomRoles.csproj @@ -5,7 +5,7 @@ - + From 27d9679e2f66d26e8a8113adec4710417ecad786 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Thu, 18 Sep 2025 18:51:19 +0200 Subject: [PATCH 345/853] updated + auto tesla --- .../KE.Misc/Features/AutoElevator.cs | 17 ------- KruacentExiled/KE.Misc/Features/AutoTesla.cs | 49 +++++++++++++++++++ .../KE.Misc/Handlers/ServerHandler.cs | 2 + KruacentExiled/KE.Misc/KE.Misc.csproj | 2 +- KruacentExiled/KE.Misc/MainPlugin.cs | 5 +- 5 files changed, 56 insertions(+), 19 deletions(-) create mode 100644 KruacentExiled/KE.Misc/Features/AutoTesla.cs diff --git a/KruacentExiled/KE.Misc/Features/AutoElevator.cs b/KruacentExiled/KE.Misc/Features/AutoElevator.cs index 9c9944ad..5eecaeac 100644 --- a/KruacentExiled/KE.Misc/Features/AutoElevator.cs +++ b/KruacentExiled/KE.Misc/Features/AutoElevator.cs @@ -38,23 +38,6 @@ private IEnumerator StartElevator() SendElevator(l); } } - /* - [2025-07-28 22:12:45.541 +02:00] [STDOUT] InvalidOperationException: Collection was modified; enumeration operation may not execute. - [2025-07-28 22:12:45.541 +02:00] [STDOUT] at System.Collections.Generic.Dictionary`2+ValueCollection+Enumerator[TKey,TValue].MoveNext () [0x00013] in <069d7b80a3914a08b6825aa362b07f5e>:0 - [2025-07-28 22:12:45.541 +02:00] [STDOUT] at KE.Misc.Features.AutoElevator+d__0.MoveNext () [0x00098] in :0 - [2025-07-28 22:12:45.541 +02:00] [STDOUT] at MEC.Timing.Update () [0x0043c] in <907db9b8bd144382918df78d2897b4b7>:0 - [2025-07-28 22:12:45.541 +02:00] [STDOUT] UnityEngine.DebugLogHandler:Internal_LogException_Injected(Exception, IntPtr) - [2025-07-28 22:12:45.541 +02:00] [STDOUT] UnityEngine.DebugLogHandler:Internal_LogException(Exception, Object) - [2025-07-28 22:12:45.541 +02:00] [STDOUT] UnityEngine.DebugLogHandler:LogException(Exception, Object) - [2025-07-28 22:12:45.541 +02:00] [STDOUT] UnityEngine.Logger:LogException(Exception, Object) - [2025-07-28 22:12:45.541 +02:00] [STDOUT] UnityEngine.Debug:LogException(Exception) - [2025-07-28 22:12:45.541 +02:00] [STDOUT] MEC.Timing:Update() - [2025-07-28 22:12:49.976 +02:00] [STDOUT] ArgumentNullException: Value cannot be null. - [2025-07-28 22:12:49.976 +02:00] [STDOUT] Parameter name: key - [2025-07-28 22:12:49.976 +02:00] [STDOUT] at System.Collections.Concurrent.ConcurrentDictionary`2[TKey,TValue].ThrowKeyNullException () [0x00000] in <069d7b80a3914a08b6825aa362b07f5e>:0 - [2025-07-28 22:12:49.976 +02:00] [STDOUT] at System.Collections.Concurrent.ConcurrentDictionary`2[TKey,TValue].TryRemove (TKey key, TValue& value) [0x00008] in <069d7b80a3914a08b6825aa362b07f5e>:0 - [2025-07-28 22:12:49.976 +02:00] [STDOUT] at RemoteAdmin.QueryProcessor.OnDestroy () [0x00018] in :0 - */ } diff --git a/KruacentExiled/KE.Misc/Features/AutoTesla.cs b/KruacentExiled/KE.Misc/Features/AutoTesla.cs new file mode 100644 index 00000000..598dca32 --- /dev/null +++ b/KruacentExiled/KE.Misc/Features/AutoTesla.cs @@ -0,0 +1,49 @@ +using Exiled.API.Features; +using LabApi.Features.Wrappers; +using MEC; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Round = Exiled.API.Features.Round; + +namespace KE.Misc.Features +{ + /// + /// The elevator will random activate in the round + /// + internal class AutoTesla + { + private CoroutineHandle handle; + + public void StopLoop() + { + Timing.KillCoroutines(handle); + } + public void StartLoop() + { + handle = Timing.RunCoroutine(StartElevator()); + } + /// + /// Start the auto elevator loop + /// + private IEnumerator StartElevator() + { + while (!Round.IsEnded) + { + foreach (Tesla tesla in Tesla.List) + { + yield return Timing.WaitForSeconds(UnityEngine.Random.Range(120f,200f)); + tesla.Trigger(); + if(UnityEngine.Random.Range(0f,100f) <= 70f) + { + yield return Timing.WaitForSeconds(tesla.Base.windupTime); + tesla.Trigger(); + } + + } + } + } + } +} diff --git a/KruacentExiled/KE.Misc/Handlers/ServerHandler.cs b/KruacentExiled/KE.Misc/Handlers/ServerHandler.cs index 32966b50..607de317 100644 --- a/KruacentExiled/KE.Misc/Handlers/ServerHandler.cs +++ b/KruacentExiled/KE.Misc/Handlers/ServerHandler.cs @@ -22,6 +22,8 @@ public void OnRoundStarted() if (MainPlugin.Instance.Config.AutoElevator) MainPlugin.Instance.AutoElevator.StartLoop(); + + MainPlugin.Instance.AutoTesla.StartLoop(); MainPlugin.Instance.SCPBuff.StartBuff(); diff --git a/KruacentExiled/KE.Misc/KE.Misc.csproj b/KruacentExiled/KE.Misc/KE.Misc.csproj index d5fb8ae1..c376a3ba 100644 --- a/KruacentExiled/KE.Misc/KE.Misc.csproj +++ b/KruacentExiled/KE.Misc/KE.Misc.csproj @@ -6,7 +6,7 @@ - + diff --git a/KruacentExiled/KE.Misc/MainPlugin.cs b/KruacentExiled/KE.Misc/MainPlugin.cs index 8e66c3c0..38c3d73a 100644 --- a/KruacentExiled/KE.Misc/MainPlugin.cs +++ b/KruacentExiled/KE.Misc/MainPlugin.cs @@ -34,6 +34,7 @@ public class MainPlugin : Plugin internal Spawn Spawn { get; private set; } internal FriendlyFire FriendlyFire { get; private set; } internal AutoNukeAnnoucement AutoNukeAnnoucement { get; private set; } + internal AutoTesla AutoTesla { get; private set; } public override void OnEnabled() @@ -48,6 +49,7 @@ public override void OnEnabled() SCPBuff = new SCPBuff(); FriendlyFire = new(); AutoNukeAnnoucement = new(); + AutoTesla = new(); Candy = new Candy(); Respawn.SetTokens(SpawnableFaction.NtfWave, 2); Respawn.SetTokens(SpawnableFaction.ChaosWave, 2); @@ -69,17 +71,18 @@ public override void OnDisabled() ServerHandle.RoundStarted -= ServerHandler.OnRoundStarted; Exiled.Events.Handlers.Player.Dying -= ScpNoeDeathMessage; Exiled.Events.Handlers.Server.RoundStarted -= AutoNukeAnnoucement.OnRoundStarted; + AutoTesla.StopLoop(); MiscFeature.UnsubscribeAllEvents(); CustomRole.UnregisterRoles([typeof(Scp035)]); - _914 = null; Candy = null; ClassDDoor = null; ServerHandler = null; SCPBuff = null; + AutoTesla = null; Spawn = null; AutoElevator = null; AutoNukeAnnoucement = null; From d3f5657b731f4f18f3180deb5384adc93b13164e Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Thu, 25 Sep 2025 14:53:15 +0200 Subject: [PATCH 346/853] finished custom model --- .../KE.Items/Features/KECustomGrenade.cs | 9 +- .../KE.Items/Features/KECustomItem.cs | 10 ++- .../PickupModels => Features}/PickupModel.cs | 86 +++++++++++++++---- .../KE.Items/Interface/ICustomPickupModel.cs | 2 +- KruacentExiled/KE.Items/Items/ImpactFlash.cs | 1 - KruacentExiled/KE.Items/Items/Mine.cs | 2 +- KruacentExiled/KE.Items/Items/Molotov.cs | 5 +- .../Items/PickupModels/MolotovPModel.cs | 7 +- .../Items/PickupModels/PressePureePModel.cs | 12 +-- .../Items/PickupModels/Scp3136PModel.cs | 2 +- KruacentExiled/KE.Items/Items/PressePuree.cs | 2 +- KruacentExiled/KE.Items/MainPlugin.cs | 36 ++++++-- 12 files changed, 130 insertions(+), 44 deletions(-) rename KruacentExiled/KE.Items/{Items/PickupModels => Features}/PickupModel.cs (55%) diff --git a/KruacentExiled/KE.Items/Features/KECustomGrenade.cs b/KruacentExiled/KE.Items/Features/KECustomGrenade.cs index 4c1c834d..35c4d732 100644 --- a/KruacentExiled/KE.Items/Features/KECustomGrenade.cs +++ b/KruacentExiled/KE.Items/Features/KECustomGrenade.cs @@ -13,20 +13,25 @@ public abstract class KECustomGrenade : CustomGrenade protected override void SubscribeEvents() { - Exiled.Events.Handlers.Player.Hurting += InternalOnHurting; base.SubscribeEvents(); } protected override void UnsubscribeEvents() { - Exiled.Events.Handlers.Player.Hurting -= InternalOnHurting; base.UnsubscribeEvents(); } + protected void InternalOnHurting(HurtingEventArgs ev) { + //can't get the custom grenade + /*if(ev.DamageHandler.Type == Exiled.API.Enums.DamageType.Explosion) + { + ev.Amount *= DamageModifier; + }*/ + } protected override void ShowPickedUpMessage(Player player) diff --git a/KruacentExiled/KE.Items/Features/KECustomItem.cs b/KruacentExiled/KE.Items/Features/KECustomItem.cs index 8df19a4a..fcc0a4bb 100644 --- a/KruacentExiled/KE.Items/Features/KECustomItem.cs +++ b/KruacentExiled/KE.Items/Features/KECustomItem.cs @@ -30,8 +30,6 @@ protected override void ShowSelectedMessage(Player player) internal static void Message(CustomItem c, Player player, bool pickedUp = false) { - - StringBuilder builder = new(); if (MainPlugin.Instance.SettingsHandler.GetPrefixes(player)) @@ -63,15 +61,21 @@ internal static void Message(CustomItem c, Player player, bool pickedUp = false) builder.AppendLine(c.Description); if (c is IUpgradableCustomItem ci) { + builder.Append(""); foreach (var a in ci.Upgrade) { - builder.AppendLine($"{c.Name}"); + builder.Append(a.Key); + builder.Append(" ("); + builder.Append(a.Value.Chance); + builder.Append("%) -> ???"); } + builder.AppendLine(""); } } + float delay = MainPlugin.Instance.SettingsHandler.GetTime(player); DisplayHandler.Instance.AddHint(MainPlugin.HintPlacement, player, builder.ToString(), delay); diff --git a/KruacentExiled/KE.Items/Items/PickupModels/PickupModel.cs b/KruacentExiled/KE.Items/Features/PickupModel.cs similarity index 55% rename from KruacentExiled/KE.Items/Items/PickupModels/PickupModel.cs rename to KruacentExiled/KE.Items/Features/PickupModel.cs index 29baf44d..5d915697 100644 --- a/KruacentExiled/KE.Items/Items/PickupModels/PickupModel.cs +++ b/KruacentExiled/KE.Items/Features/PickupModel.cs @@ -4,10 +4,12 @@ using Exiled.CustomItems.API.Features; using InventorySystem.Items.Pickups; using KE.Utils.API.Models.Blueprints; +using InteractableToy = LabApi.Features.Wrappers.InteractableToy; using System.Collections.Generic; using UnityEngine; +using LabPlayer = LabApi.Features.Wrappers.Player; -namespace KE.Items.Items.PickupModels +namespace KE.Items.Features { public abstract class PickupModel { @@ -17,19 +19,22 @@ public abstract class PickupModel private HashSet modelBlueprint = null; private Dictionary> models; + private Dictionary> pickableItem; public PickupModel(CustomItem customItem) { KECI = customItem; models = new(); + pickableItem = new(); allModels.Add(this); } protected abstract HashSet CreateModel(); - protected virtual Vector3 PickupSize { get; set; } = Vector3.one; + protected virtual bool HidePickup { get; } = false; + public void SubscribeEvents() { @@ -51,6 +56,14 @@ public void UnsubscribeEvents() toy.Destroy(); } } + + foreach (HashSet toys in pickableItem.Values) + { + foreach (InteractableToy toy in toys) + { + toy.Destroy(); + } + } } public bool Check(Pickup pickup) @@ -65,9 +78,9 @@ public bool Check(Pickup pickup) public static bool AnyCheck(Pickup pickup) { - foreach(PickupModel model in allModels) + foreach (PickupModel model in allModels) { - + if (model.Check(pickup)) { return true; @@ -81,18 +94,19 @@ private void OnPickupAdded(ItemPickupBase obj) Pickup pickup = Pickup.Get(obj); if (!Check(pickup)) return; - if(modelBlueprint is null) + if (modelBlueprint is null) { modelBlueprint = CreateModel(); } - if(PickupSize != Vector3.one) + if (HidePickup) { - Log.Debug("set size to "+PickupSize); - pickup.Scale = PickupSize; + pickup.Scale = new Vector3(.01f, .01f, .01f); } + + Vector3 scale = pickup.Scale; - + pickableItem.Add(obj, new()); models.Add(obj, new()); @@ -103,27 +117,50 @@ private void OnPickupAdded(ItemPickupBase obj) if (prim is Primitive p) p.Collidable = false; - Vector3 offset = prim.Position; prim.Transform.parent = obj.transform; - prim.Transform.localPosition = offset; + prim.Transform.localScale = new(blueprint.Scale.x/ scale.x, blueprint.Scale.y / scale.y, blueprint.Scale.z / scale.z); + prim.Transform.localPosition = prim.Position + Vector3.Scale(blueprint.Position,scale); prim.Transform.rotation *= pickup.Rotation; prim.MovementSmoothing = 60; prim.AdminToyBase.syncInterval = 0f; - /* - Log.Debug($"prim trans = ({prim?.Transform.parent?.gameObject.name})"); - Log.Debug($"prim localpos = ({prim?.Transform.localPosition})"); - Log.Debug("+ offset =" + offset); - Log.Debug($"prim globalpos = ({prim?.Position})"); - */ - prim.Spawn(); + Log.Debug("posP=" + prim.Transform.position); + + var interact = InteractableToy.Create(prim.Transform, false); + + interact.Transform.parent = obj.transform; + interact.Transform.localPosition = Vector3.zero; + interact.Transform.localRotation = Quaternion.identity; + interact.Scale = new(blueprint.Scale.x / scale.x, blueprint.Scale.y / scale.y, blueprint.Scale.z / scale.z); + interact.InteractionDuration = 0.245f + 0.175f * obj.Info.WeightKg; + interact.Shape = AdminToys.InvisibleInteractableToy.ColliderShape.Box; + + + + + Log.Debug("scale intec : " + interact.Scale); + Log.Debug("scale prim : " + prim.Transform.localScale); + + Log.Debug("posI=" + interact.Transform.position); + + //interact.OnSearched += (player) => GiveCI(obj, player); + pickableItem[obj].Add(interact); + interact.Spawn(); models[obj].Add(prim); + prim.Spawn(); + + } + } - + private void GiveCI(ItemPickupBase pickup, LabPlayer player) + { + Log.Debug("give"); + KECI.Give(player,true); + pickup.DestroySelf(); } private void OnPickupDestroyed(ItemPickupBase obj) @@ -138,6 +175,17 @@ private void OnPickupDestroyed(ItemPickupBase obj) toy.Destroy(); } } + + if (pickableItem.TryGetValue(obj, out HashSet interact)) + { + foreach (InteractableToy toy in interact) + { + + //toy.OnSearchAborted -= (player) => GiveCI(obj, player); + toy.Destroy(); + } + } + } } } diff --git a/KruacentExiled/KE.Items/Interface/ICustomPickupModel.cs b/KruacentExiled/KE.Items/Interface/ICustomPickupModel.cs index eb9bad0a..dbf7cc76 100644 --- a/KruacentExiled/KE.Items/Interface/ICustomPickupModel.cs +++ b/KruacentExiled/KE.Items/Interface/ICustomPickupModel.cs @@ -1,5 +1,5 @@ using Exiled.API.Features.Toys; -using KE.Items.Items.PickupModels; +using KE.Items.Features; using KE.Utils.API.Models.Blueprints; using KE.Utils.Quality.Models; using System; diff --git a/KruacentExiled/KE.Items/Items/ImpactFlash.cs b/KruacentExiled/KE.Items/Items/ImpactFlash.cs index e3c93343..5fcc4b6f 100644 --- a/KruacentExiled/KE.Items/Items/ImpactFlash.cs +++ b/KruacentExiled/KE.Items/Items/ImpactFlash.cs @@ -16,7 +16,6 @@ public class ImpactFlash : KECustomGrenade public override float Weight { get; set; } = 0.65f; public override float FuseTime { get; set; } = 3f; public override bool ExplodeOnCollision { get; set; } = true; - public float DamageModifier { get; set; } = 1f; public override SpawnProperties SpawnProperties { get; set; } = new SpawnProperties() { Limit = 5, diff --git a/KruacentExiled/KE.Items/Items/Mine.cs b/KruacentExiled/KE.Items/Items/Mine.cs index 7e6d5be1..58cc4260 100644 --- a/KruacentExiled/KE.Items/Items/Mine.cs +++ b/KruacentExiled/KE.Items/Items/Mine.cs @@ -9,7 +9,7 @@ namespace KE.Items.Items { [Exiled.API.Features.Attributes.CustomItem(ItemType.KeycardJanitor)] - public class Mine : KECustomItem, ILumosItem, ISwichableEffect, ICustomPickupModel + public class Mine : KECustomItem, ISwichableEffect, ICustomPickupModel { public override uint Id { get; set; } = 1053; public override string Name { get; set; } = "Mine"; diff --git a/KruacentExiled/KE.Items/Items/Molotov.cs b/KruacentExiled/KE.Items/Items/Molotov.cs index 610cd653..cf42cb64 100644 --- a/KruacentExiled/KE.Items/Items/Molotov.cs +++ b/KruacentExiled/KE.Items/Items/Molotov.cs @@ -8,11 +8,12 @@ using KE.Items.Interface; using KE.Items.ItemEffects; using KE.Items.Items.PickupModels; +using UnityEngine; namespace KE.Items.Items { [CustomItem(ItemType.GrenadeFlash)] - public class Molotov : KECustomGrenade, ILumosItem, ISwichableEffect, ICustomPickupModel + public class Molotov : KECustomGrenade, ISwichableEffect, ICustomPickupModel { //bouteille public override uint Id { get; set; } = 1049; @@ -21,7 +22,7 @@ public class Molotov : KECustomGrenade, ILumosItem, ISwichableEffect, ICustomPic public override float Weight { get; set; } = 0.65f; public override float FuseTime { get; set; } = 5f; public override bool ExplodeOnCollision { get; set; } = true; - public UnityEngine.Color Color { get; set; } = UnityEngine.Color.yellow; + public Color Color { get; set; } = Color.yellow; public CustomItemEffect Effect { get; set; } public PickupModel PickupModel { get; } public override SpawnProperties SpawnProperties { get; set; } = new SpawnProperties() diff --git a/KruacentExiled/KE.Items/Items/PickupModels/MolotovPModel.cs b/KruacentExiled/KE.Items/Items/PickupModels/MolotovPModel.cs index d179a879..e20cc332 100644 --- a/KruacentExiled/KE.Items/Items/PickupModels/MolotovPModel.cs +++ b/KruacentExiled/KE.Items/Items/PickupModels/MolotovPModel.cs @@ -17,13 +17,14 @@ public class MolotovPModel : PickupModel public MolotovPModel(CustomItem customItem) : base(customItem) { } - private Color bottleColor = Color.red; + protected override bool HidePickup => true; + private Color32 bottleColor = new Color32(110, 58, 13,230); protected override HashSet CreateModel() { HashSet model = new() { - AdminToyBlueprint.Create(Primitive.Create(PrimitiveType.Cylinder, Vector3.zero, null, new Vector3(.1f, 0.1f, .1f),false,bottleColor)), - AdminToyBlueprint.Create(Primitive.Create(PrimitiveType.Cylinder, new Vector3(0, 0.1f), null, new Vector3(.05f, .04f, .05f),false,bottleColor)), + AdminToyBlueprint.Create(Primitive.Create(PrimitiveType.Cylinder, Vector3.zero, null, new Vector3(.1f, 0.1f, .1f),false,bottleColor)), //big + AdminToyBlueprint.Create(Primitive.Create(PrimitiveType.Cylinder, new Vector3(0, 10f), null, new Vector3(.05f, .035f, .05f),false,bottleColor)), }; return model; diff --git a/KruacentExiled/KE.Items/Items/PickupModels/PressePureePModel.cs b/KruacentExiled/KE.Items/Items/PickupModels/PressePureePModel.cs index 59c3c6b1..fab90b85 100644 --- a/KruacentExiled/KE.Items/Items/PickupModels/PressePureePModel.cs +++ b/KruacentExiled/KE.Items/Items/PickupModels/PressePureePModel.cs @@ -17,18 +17,20 @@ public class PressePureePModel : PickupModel public PressePureePModel(CustomItem customItem) : base(customItem) { } - protected override Vector3 PickupSize { get; set; } = new Vector3(.5f, 1.5f, .5f); + protected override bool HidePickup => true; - - private static Vector3 manche = new Vector3(.05f, .06f, .1f); + private static Vector3 manche = new Vector3(.05f, .1f, .05f); private static Vector3 explosifCharge = new Vector3(.1f, .04f, .1f); + public static readonly Color32 colorManche = new Color32(84, 43, 11, 255); + public static readonly Color32 colorExplosif = new Color32(31, 31, 31, 255); + protected override HashSet CreateModel() { HashSet model = new() { - AdminToyBlueprint.Create(Primitive.Create(PrimitiveType.Cylinder, Vector3.zero, null, manche,false,Color.red)), - AdminToyBlueprint.Create(Primitive.Create(PrimitiveType.Cylinder, new Vector3(0, .1f), null, explosifCharge,false,Color.black)), + AdminToyBlueprint.Create(Primitive.Create(PrimitiveType.Cylinder, Vector3.zero, null, manche,false,colorManche)), + AdminToyBlueprint.Create(Primitive.Create(PrimitiveType.Cylinder, new Vector3(0, 6f), null, explosifCharge,false,colorExplosif)), }; return model; diff --git a/KruacentExiled/KE.Items/Items/PickupModels/Scp3136PModel.cs b/KruacentExiled/KE.Items/Items/PickupModels/Scp3136PModel.cs index 35ee15ed..40ddac04 100644 --- a/KruacentExiled/KE.Items/Items/PickupModels/Scp3136PModel.cs +++ b/KruacentExiled/KE.Items/Items/PickupModels/Scp3136PModel.cs @@ -17,7 +17,7 @@ public class Scp3136PModel : PickupModel public Scp3136PModel(CustomItem customItem) : base(customItem) { } - protected override Vector3 PickupSize { get; set; } = new Vector3(1f, .1f, 1f); + protected override bool HidePickup => true; private static Vector3 paper = new Vector3(.5f, .1f, .5f); diff --git a/KruacentExiled/KE.Items/Items/PressePuree.cs b/KruacentExiled/KE.Items/Items/PressePuree.cs index e2394321..37b372f5 100644 --- a/KruacentExiled/KE.Items/Items/PressePuree.cs +++ b/KruacentExiled/KE.Items/Items/PressePuree.cs @@ -21,7 +21,7 @@ public class PressePuree : KECustomGrenade, IUpgradableCustomItem, ICustomPickup //presse puree public override uint Id { get; set; } = 1046; public override string Name { get; set; } = "Presse Purée"; - public override string Description { get; set; } = "The grenade explode at impact but does less damage\n 5% to upgrade in 914 on very fine"; + public override string Description { get; set; } = "The grenade explode at impact but does less damage"; public override float Weight { get; set; } = 0.65f; public override float FuseTime { get; set; } = 1.5f; public override bool ExplodeOnCollision { get; set; } = true; diff --git a/KruacentExiled/KE.Items/MainPlugin.cs b/KruacentExiled/KE.Items/MainPlugin.cs index 5eeb06e8..354ebe34 100644 --- a/KruacentExiled/KE.Items/MainPlugin.cs +++ b/KruacentExiled/KE.Items/MainPlugin.cs @@ -1,18 +1,15 @@  using Exiled.API.Enums; -using Exiled.API.Extensions; using Exiled.API.Features; using Exiled.API.Features.Toys; using Exiled.CustomItems.API.Features; using KE.Items.Core.Lights; using KE.Items.Core.Settings; using KE.Items.Core.Upgrade; -using KE.Items.Items.PickupModels; using KE.Utils.API.Displays.DisplayMeow; -using KE.Utils.API.Sounds; -using KE.Utils.Quality.Tests; using System; -using Light = Exiled.API.Features.Toys.Light; +using System.Linq; +using InteractableToy = LabApi.Features.Wrappers.InteractableToy; namespace KE.Items { @@ -47,6 +44,7 @@ public override void OnEnabled() SettingsHandler = new(); Utils.API.Sounds.SoundPlayer.Load(); + //Exiled.Events.Handlers.Server.RoundStarted += Test; @@ -76,6 +74,34 @@ public override void OnDisabled() Instance = null; } + + + + + + private void Test() + { + Player player = Player.List.First(); + + + + var prim = Primitive.Create(player.Position,spawn:false); + prim.Collidable = false; + prim.Spawn(); + var itoy = InteractableToy.Create(prim.Transform, true); + itoy.InteractionDuration = 3f; + + + itoy.OnSearchAborted += GiveDestroy; + + } + + private void GiveDestroy(LabApi.Features.Wrappers.Player player) + { + + CustomItem.Get(1046)?.Give(player); + + } } } \ No newline at end of file From 233319da2a24cb59877ddb258503185b561e3bf3 Mon Sep 17 00:00:00 2001 From: Omer <27omerf@gmail.com> Date: Thu, 25 Sep 2025 16:09:53 +0200 Subject: [PATCH 347/853] add Inverted and Paper2 CustomRole --- .../KE.CustomRoles/CR/Human/Inverted.cs | 18 +++++++++++++-- .../KE.CustomRoles/CR/Human/Paper2.cs | 23 +++++++++++++++++++ 2 files changed, 39 insertions(+), 2 deletions(-) create mode 100644 KruacentExiled/KE.CustomRoles/CR/Human/Paper2.cs diff --git a/KruacentExiled/KE.CustomRoles/CR/Human/Inverted.cs b/KruacentExiled/KE.CustomRoles/CR/Human/Inverted.cs index 73dda0e5..54592544 100644 --- a/KruacentExiled/KE.CustomRoles/CR/Human/Inverted.cs +++ b/KruacentExiled/KE.CustomRoles/CR/Human/Inverted.cs @@ -1,9 +1,11 @@ using Exiled.API.Features.Attributes; using Exiled.CustomRoles.API.Features; using KE.CustomRoles.API.Features; +using MEC; using PlayerRoles; -using System.Collections.Generic; +using Exiled.API.Features; using UnityEngine; +using Exiled.API.Enums; namespace KE.CustomRoles.CR.Human { @@ -18,6 +20,18 @@ public class Inverted : GlobalCustomRole public override bool KeepRoleOnChangingRole { get; set; } = true; public override float SpawnChance { get; set; } = 100; - public override Vector3 Scale { get; set; } = new Vector3(1, -1, 1); + public override Vector3 Scale { get; set; } = new Vector3(1, 1, 1); + + protected override void RoleAdded(Player player) + { + player.Scale = new Vector3(1f, -1f, 1f); + player.EnableEffect(EffectType.Slowness, 200, 99999); + } + + protected override void RoleRemoved(Player player) + { + player.Scale = new Vector3(1f, 1f, 1f); + player.DisableEffect(EffectType.Slowness); + } } } \ No newline at end of file diff --git a/KruacentExiled/KE.CustomRoles/CR/Human/Paper2.cs b/KruacentExiled/KE.CustomRoles/CR/Human/Paper2.cs new file mode 100644 index 00000000..c531f4f2 --- /dev/null +++ b/KruacentExiled/KE.CustomRoles/CR/Human/Paper2.cs @@ -0,0 +1,23 @@ +using Exiled.API.Features.Attributes; +using Exiled.CustomRoles.API.Features; +using KE.CustomRoles.API.Features; +using PlayerRoles; +using System.Collections.Generic; +using UnityEngine; + +namespace KE.CustomRoles.CR.Human +{ + [CustomRole(RoleTypeId.None)] + public class Paper2 : GlobalCustomRole + { + public override SideEnum Side { get; set; } = SideEnum.Human; + public override string Description { get; set; } = "Tu t'es fait roulé dessus !"; + public override uint Id { get; set; } = 1067; + public override string PublicName { get; set; } = "Paper"; + public override bool KeepRoleOnDeath { get; set; } = true; + public override bool KeepRoleOnChangingRole { get; set; } = true; + + public override float SpawnChance { get; set; } = 100; + public override Vector3 Scale { get; set; } = new Vector3(0.2f, 1, 1); + } +} \ No newline at end of file From b24442fd1ee71ecf16697455da15b90471c102d0 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Thu, 25 Sep 2025 20:17:24 +0200 Subject: [PATCH 348/853] changed from pickup to interactabletoy --- .../KE.Map/Heavy/GamblingZone/GamblingRoom.cs | 47 ++++++++++++++----- 1 file changed, 35 insertions(+), 12 deletions(-) diff --git a/KruacentExiled/KE.Map/Heavy/GamblingZone/GamblingRoom.cs b/KruacentExiled/KE.Map/Heavy/GamblingZone/GamblingRoom.cs index 852d3cc3..6bba051d 100644 --- a/KruacentExiled/KE.Map/Heavy/GamblingZone/GamblingRoom.cs +++ b/KruacentExiled/KE.Map/Heavy/GamblingZone/GamblingRoom.cs @@ -4,6 +4,7 @@ using Exiled.API.Features.Toys; using Exiled.Events.EventArgs.Server; using KE.Map.Utils; +using InteractableToy = LabApi.Features.Wrappers.InteractableToy; using System.Collections.Generic; using UnityEngine; @@ -17,8 +18,27 @@ public class GamblingRoom private HashSet _model; - public float PickupTime { get; } = 30; - private InteractiblePickup _pickup; + public const float BasePickupTime = 10; + public float PickupTime + { + get + { + return _interact?.InteractionDuration ?? BasePickupTime; + } + set + { + if(value < 1) + { + _interact.InteractionDuration = 1; + } + else + { + _interact.InteractionDuration = value; + } + + } + } + private InteractableToy _interact; private Vector3 _position; private LootTable _lootTable; @@ -48,11 +68,13 @@ private void Init(Vector3 position, LootTable lootTable, Vector3? offset = null) _position = position + (offset ?? new Vector3()); _list.Add(this); - _pickup = new InteractiblePickup(ItemType.Medkit, _position, new Vector3(4, 4, 4), PickupTime, new()); - - _pickup.AddAction(OnPickup); + _interact = InteractableToy.Create(_position, networkSpawn: false); + _interact.InteractionDuration = BasePickupTime; + + _interact.OnSearchAborted += OnPickup; CreateModel(_position); + _interact.Spawn(); _lootTable = lootTable; } @@ -89,20 +111,21 @@ public void Destroy() { p.Destroy(); } - _pickup.Destroy(); + _interact.OnSearchAborted -= OnPickup; _list.Remove(this); } - public void OnPickup(Player player) + public void OnPickup(LabApi.Features.Wrappers.Player player) { - if (player == null) return; - if (player.CurrentItem == null) return; + Player player2 = Player.Get(player); + if (player2 == null) return; + if (player2.CurrentItem == null) return; Item item = _lootTable.GetRandomItem(); - player.CurrentItem.Destroy(); - player.AddItem(item); + player2.CurrentItem.Destroy(); + player2.AddItem(item); - player.DropItem(item, false); + player2.DropItem(item, false); } public static void DestroyAll() { From c02d91919f9fb6f60d08d0ee23c6ba4d13a20eb4 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Thu, 25 Sep 2025 20:21:24 +0200 Subject: [PATCH 349/853] removed tall --- KruacentExiled/KE.CustomRoles/CR/SCP/Tall.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/KruacentExiled/KE.CustomRoles/CR/SCP/Tall.cs b/KruacentExiled/KE.CustomRoles/CR/SCP/Tall.cs index fdd67a4c..9bcee936 100644 --- a/KruacentExiled/KE.CustomRoles/CR/SCP/Tall.cs +++ b/KruacentExiled/KE.CustomRoles/CR/SCP/Tall.cs @@ -7,7 +7,7 @@ namespace KE.CustomRoles.CR.SCP { - [CustomRole(RoleTypeId.None)] + /*[CustomRole(RoleTypeId.None)] public class Tall : GlobalCustomRole { public override string Description { get; set; } = "u tall"; @@ -31,5 +31,5 @@ protected override void RoleRemoved(Player player) { player.SetFakeScale(BaseScale, Player.List.Where(p => p != player)); } - } + }*/ } From 55db176e85e3a0008ae790944687c1e66bc3e443 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Fri, 26 Sep 2025 16:07:06 +0200 Subject: [PATCH 350/853] updated the spawn location --- KruacentExiled/KE.CustomRoles/CR/Scientist/ZoneManager.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/KruacentExiled/KE.CustomRoles/CR/Scientist/ZoneManager.cs b/KruacentExiled/KE.CustomRoles/CR/Scientist/ZoneManager.cs index 52350617..b14f6789 100644 --- a/KruacentExiled/KE.CustomRoles/CR/Scientist/ZoneManager.cs +++ b/KruacentExiled/KE.CustomRoles/CR/Scientist/ZoneManager.cs @@ -34,7 +34,7 @@ internal class ZoneManager : KECustomRole { new DynamicSpawnPoint() { - Location = SpawnLocationType.InsideHidUpper, + Location = SpawnLocationType.InsideHidLab, Chance = 100, } } From a01e26e0e343fd79ec8fe6cdf2f720fc6bd847e5 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Fri, 26 Sep 2025 16:07:13 +0200 Subject: [PATCH 351/853] added custom scps --- .../KE.CustomRoles/API/Features/CustomSCP.cs | 56 +++++++++++++++++++ .../API/Features/KEAbilities.cs | 1 - .../API/Features/KECustomRole.cs | 13 +---- .../API/Interfaces/ISCPPreferences.cs | 2 +- .../Abilities/SelectPosition.cs | 7 --- .../KE.CustomRoles/CR/SCP/SCP457.cs | 5 +- KruacentExiled/KE.CustomRoles/Config.cs | 1 + .../KE.CustomRoles/Settings/SettingHandler.cs | 13 +---- 8 files changed, 63 insertions(+), 35 deletions(-) create mode 100644 KruacentExiled/KE.CustomRoles/API/Features/CustomSCP.cs diff --git a/KruacentExiled/KE.CustomRoles/API/Features/CustomSCP.cs b/KruacentExiled/KE.CustomRoles/API/Features/CustomSCP.cs new file mode 100644 index 00000000..2a45d731 --- /dev/null +++ b/KruacentExiled/KE.CustomRoles/API/Features/CustomSCP.cs @@ -0,0 +1,56 @@ +using Exiled.API.Features; +using Exiled.API.Features.Core.UserSettings; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace KE.CustomRoles.API.Features +{ + public abstract class CustomSCP : KECustomRole + { + public const int MinValue = -5; + public const int MaxValue = 5; + public const int DefaultValue = 0; + + public static int ScpPreferenceHeaderId => MainPlugin.Instance.Config.ScpPreferenceHeaderId; + private static HeaderSetting header; + private static bool headerflag = false; + private SliderSetting sliderSetting; + public abstract bool IsSupport { get; } + public int SettingId => (int)Id; + + public static IEnumerable All => Registered.Where(c => c is CustomSCP).Cast(); + public override void Init() + { + if (!headerflag) + { + header = new HeaderSetting(ScpPreferenceHeaderId, "SCP Spawn Preferences"); + headerflag = true; + } + + + sliderSetting = new SliderSetting(SettingId, PublicName, MinValue, MaxValue, DefaultValue, true, header: header); + SettingBase.Register([sliderSetting]); + + + base.Init(); + } + + + public override void Destroy() + { + SettingBase.Unregister(); + base.Destroy(); + } + + + public int GetPreferences(Player player) + { + if (!SettingBase.TryGetSetting(player, sliderSetting.Id, out var setting)) return -6; + return (int) setting.SliderValue; + } + + } +} diff --git a/KruacentExiled/KE.CustomRoles/API/Features/KEAbilities.cs b/KruacentExiled/KE.CustomRoles/API/Features/KEAbilities.cs index 14878895..ae0ce961 100644 --- a/KruacentExiled/KE.CustomRoles/API/Features/KEAbilities.cs +++ b/KruacentExiled/KE.CustomRoles/API/Features/KEAbilities.cs @@ -103,7 +103,6 @@ public void Init() else { Log.Error($"setting of {this} have the same id as {old.Label}"); - } StartLoop(); IdToAbility.Add(Id, this); diff --git a/KruacentExiled/KE.CustomRoles/API/Features/KECustomRole.cs b/KruacentExiled/KE.CustomRoles/API/Features/KECustomRole.cs index 57d7c225..11c76aa3 100644 --- a/KruacentExiled/KE.CustomRoles/API/Features/KECustomRole.cs +++ b/KruacentExiled/KE.CustomRoles/API/Features/KECustomRole.cs @@ -1,23 +1,14 @@ -using Discord; -using Exiled.API.Enums; +using Exiled.API.Enums; using Exiled.API.Extensions; using Exiled.API.Features; -using Exiled.API.Features.Pools; using Exiled.CustomRoles.API; using Exiled.CustomRoles.API.Features; -using Exiled.Events.Commands.PluginManager; -using Exiled.Events.EventArgs.Player; using InventorySystem.Configs; using KE.Utils.API.Displays.DisplayMeow; using MEC; using PlayerRoles; -using PlayerRoles.FirstPersonControl.Thirdperson; -using System; using System.Collections.Generic; -using System.Drawing; using System.Linq; -using System.Security.Cryptography; -using System.Text; using UnityEngine; namespace KE.CustomRoles.API.Features @@ -52,7 +43,7 @@ protected override void ShowMessage(Player player) //string msg = MainPlugin.Translations.GettingNewRole; //msg = msg.Replace("%Name%", PublicName).Replace("%Desc%",Description); - string msg = $"{Name}"; + string msg = $"{PublicName}"; if (MainPlugin.SettingHandler.GetDescriptionsSettings(player)) { diff --git a/KruacentExiled/KE.CustomRoles/API/Interfaces/ISCPPreferences.cs b/KruacentExiled/KE.CustomRoles/API/Interfaces/ISCPPreferences.cs index 3db7c6b4..a3d74e4e 100644 --- a/KruacentExiled/KE.CustomRoles/API/Interfaces/ISCPPreferences.cs +++ b/KruacentExiled/KE.CustomRoles/API/Interfaces/ISCPPreferences.cs @@ -13,6 +13,6 @@ namespace KE.CustomRoles.API.Interfaces public interface ISCPPreferences { - public abstract bool IsSupport { get; } + } } diff --git a/KruacentExiled/KE.CustomRoles/Abilities/SelectPosition.cs b/KruacentExiled/KE.CustomRoles/Abilities/SelectPosition.cs index 88224f1d..667ac4bb 100644 --- a/KruacentExiled/KE.CustomRoles/Abilities/SelectPosition.cs +++ b/KruacentExiled/KE.CustomRoles/Abilities/SelectPosition.cs @@ -1,13 +1,6 @@ using Exiled.API.Features; -using Exiled.API.Features.Attributes; -using Exiled.CustomRoles.API.Features; using KE.CustomRoles.API.Features; -using KE.CustomRoles.API.Interfaces; -using System; using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; using UnityEngine; namespace KE.CustomRoles.Abilities diff --git a/KruacentExiled/KE.CustomRoles/CR/SCP/SCP457.cs b/KruacentExiled/KE.CustomRoles/CR/SCP/SCP457.cs index 95d8a886..b37d0f90 100644 --- a/KruacentExiled/KE.CustomRoles/CR/SCP/SCP457.cs +++ b/KruacentExiled/KE.CustomRoles/CR/SCP/SCP457.cs @@ -6,7 +6,6 @@ using Exiled.API.Interfaces; using Exiled.Events.EventArgs.Scp106; using KE.CustomRoles.API.Features; -using KE.CustomRoles.API.Interfaces; using KE.Utils.API; using MEC; using PlayerRoles; @@ -19,7 +18,7 @@ namespace KE.CustomRoles.CR.SCP { [CustomRole(RoleTypeId.Scp106)] - public class SCP457 : KECustomRole, ISCPPreferences + public class SCP457 : CustomSCP { @@ -30,7 +29,7 @@ public class SCP457 : KECustomRole, ISCPPreferences public override RoleTypeId Role { get; set; } = RoleTypeId.Scp106; public override bool KeepRoleOnDeath { get; set; } = false; public override bool KeepRoleOnChangingRole { get; set; } = false; - public bool IsSupport { get; } = false; + public override bool IsSupport { get; } = false; public override float SpawnChance { get; set; } = 100; diff --git a/KruacentExiled/KE.CustomRoles/Config.cs b/KruacentExiled/KE.CustomRoles/Config.cs index 480b748b..49e36023 100644 --- a/KruacentExiled/KE.CustomRoles/Config.cs +++ b/KruacentExiled/KE.CustomRoles/Config.cs @@ -13,5 +13,6 @@ public class Config : IConfig public bool Debug { get; set; } = true; public int HeaderId { get; set; } = 1000; + public int ScpPreferenceHeaderId { get; set; } = 10000; } } diff --git a/KruacentExiled/KE.CustomRoles/Settings/SettingHandler.cs b/KruacentExiled/KE.CustomRoles/Settings/SettingHandler.cs index a198191a..1088088b 100644 --- a/KruacentExiled/KE.CustomRoles/Settings/SettingHandler.cs +++ b/KruacentExiled/KE.CustomRoles/Settings/SettingHandler.cs @@ -1,23 +1,11 @@ using Exiled.API.Features; using Exiled.API.Features.Core.UserSettings; -using Exiled.API.Features.Pools; -using Exiled.CustomRoles.API; -using Exiled.CustomRoles.API.Features; -using Exiled.CustomRoles.API.Features.Enums; using Exiled.Events.EventArgs.Player; using KE.CustomRoles.API.Features; -using KE.CustomRoles.API.Interfaces; using KE.Utils.API.Interfaces; using System; using System.Collections.Generic; -using System.Linq; -using System.Reflection; -using System.Text; -using System.Threading.Tasks; -using System.Xml.Linq; -using UnityEngine; using UserSettings.ServerSpecific; -using UserSettings.UserInterfaceSettings; namespace KE.CustomRoles.Settings { @@ -212,6 +200,7 @@ internal bool GetMode(Player p) return setting.IsFirst; } + internal string GetArrow(Player p) { if (!SettingBase.TryGetSetting(p, _idArrow, out var setting)) return baseArrow; From 8e3fed530144c094048981be2b6aca3fb7e5c109 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Sat, 27 Sep 2025 09:33:00 +0200 Subject: [PATCH 352/853] merged custom role + removed useless project --- .../API/Features/RoundEffects/Blackout.cs | 39 -- .../API/Features/RoundEffects/DoorStuck.cs | 46 -- .../API/Features/RoundEffects/RoundEffect.cs | 196 ------- KruacentExiled/KE.BlackoutNDoor/Config.cs | 25 - .../RoundEffect/PostRoundEffectEventArgs.cs | 26 - .../RoundEffect/PreRoundEffectEventArgs.cs | 28 - .../Events/Handlers/RoundEffect.cs | 40 -- .../Events/Interface/IZoneEvent.cs | 16 - .../Handlers/ServerHandler.cs | 16 - .../KE.BlackoutNDoor/KE.BlackoutNDoor.csproj | 30 - KruacentExiled/KE.BlackoutNDoor/MainPlugin.cs | 48 -- .../Translation/Translation.cs | 15 - .../KE.CustomRoles/API/Features/CustomSCP.cs | 56 ++ .../API/Features/GlobalCustomRole.cs | 180 ++++++ .../API/Features/KEAbilities.cs | 550 ++++++++++++++++++ .../API/Features/KECustomRole.cs | 249 ++++++++ .../API/Interfaces/ISCPPreferences.cs | 18 + .../KE.CustomRoles/Abilities/Airstrike.cs | 75 +++ .../KE.CustomRoles/Abilities/Convert.cs | 52 ++ .../KE.CustomRoles/Abilities/Explode.cs | 33 ++ .../Abilities/SelectPosition.cs | 46 ++ .../KE.CustomRoles/Abilities/Thief.cs | 52 ++ .../KE.CustomRoles/Abilities/Trade.cs | 51 ++ .../CR/ChaosInsurgency/LeRusse.cs | 39 ++ .../CR/ChaosInsurgency/Negotiator.cs | 67 +++ .../KE.CustomRoles/CR/ClassD/DBoyInShape.cs | 92 +++ .../KE.CustomRoles/CR/ClassD/Enfant.cs | 30 + .../KE.CustomRoles/CR/ClassD/Mime.cs | 41 ++ .../KE.CustomRoles/CR/Guard/ChiefGuard.cs | 38 ++ .../KE.CustomRoles/CR/Guard/Guard914.cs | 50 ++ .../KE.CustomRoles/CR/Human/Alzheimer.cs | 74 +++ .../KE.CustomRoles/CR/Human/Asthmatique.cs | 57 ++ KruacentExiled/KE.CustomRoles/CR/Human/Big.cs | 23 + .../KE.CustomRoles/CR/Human/Cleptoman.cs | 28 + .../KE.CustomRoles/CR/Human/Curiosophile.cs | 148 +++++ .../KE.CustomRoles/CR/Human/Diabetique.cs | 32 + .../KE.CustomRoles/CR/Human/Hitman.cs | 231 ++++++++ .../KE.CustomRoles/CR/Human/Inverted.cs | 37 ++ .../KE.CustomRoles/CR/Human/Maladroit.cs | 78 +++ .../KE.CustomRoles/CR/Human/Paper.cs | 23 + .../KE.CustomRoles/CR/Human/Paper2.cs | 23 + KruacentExiled/KE.CustomRoles/CR/MTF/Pilot.cs | 50 ++ KruacentExiled/KE.CustomRoles/CR/MTF/Tank.cs | 81 +++ .../KE.CustomRoles/CR/MTF/Terroriste.cs | 44 ++ KruacentExiled/KE.CustomRoles/CR/SCP/Paper.cs | 21 + .../KE.CustomRoles/CR/SCP/SCP457.cs | 250 ++++++++ KruacentExiled/KE.CustomRoles/CR/SCP/Small.cs | 22 + KruacentExiled/KE.CustomRoles/CR/SCP/Tall.cs | 35 ++ KruacentExiled/KE.CustomRoles/CR/SCP/Ultra.cs | 73 +++ .../KE.CustomRoles/CR/SCP/ZombieDoorman.cs | 40 ++ .../CR/Scientist/GambleAddict.cs | 36 ++ .../CR/Scientist/ZoneManager.cs | 119 ++++ KruacentExiled/KE.CustomRoles/Config.cs | 18 + .../KE.CustomRoles/KE.CustomRoles.csproj | 34 ++ KruacentExiled/KE.CustomRoles/MainPlugin.cs | 87 +++ .../Patches/ActiveAbilityPatches.cs | 39 ++ .../KE.CustomRoles/Patches/FpcMotorPatches.cs | 41 ++ .../KE.CustomRoles/Settings/SettingHandler.cs | 230 ++++++++ KruacentExiled/KE.CustomRoles/Translations.cs | 41 ++ .../Config.cs | 15 - .../GE/Blitz.cs | 51 -- .../GE/Impostor.cs | 70 --- .../GE/KIWIS.cs | 57 -- .../GE/OpenBar.cs | 56 -- .../KE.GlobalEventFramework.Examples/GE/R.cs | 26 - .../GE/RandomSpawn.cs | 47 -- .../GE/Shuffle.cs | 107 ---- .../GE/Speed.cs | 72 --- .../GE/SystemMalfunction.cs | 116 ---- .../KE.GlobalEventFramework.Examples.csproj | 22 - .../MainPlugin.cs | 26 - .../KE.GlobalEventFramework/Config.cs | 21 - .../GEFE/API/Features/GlobalEvent.cs | 98 ---- .../GEFE/API/Features/Loader.cs | 47 -- .../GEFE/API/Interfaces/IGlobalEvent.cs | 44 -- .../GEFE/API/Utils/Coroutine.cs | 19 - .../GEFE/Commands/List.cs | 37 -- .../GEFE/Commands/ParentCommandGEFE.cs | 36 -- .../Exception/GlobalEventNullException.cs | 16 - .../GEFE/Handlers/ServerHandler.cs | 46 -- .../KE.GlobalEventFramework.csproj | 17 - .../KE.GlobalEventFramework/MainPlugin.cs | 157 ----- KruacentExiled/KE.Items/Config.cs | 15 - .../KE.Items/Items/AdrenalineDrogue.cs | 214 ------- KruacentExiled/KE.Items/Items/Defibrilator.cs | 128 ---- KruacentExiled/KE.Items/Items/Mine.cs | 17 - KruacentExiled/KE.Items/Items/TPGrenada.cs | 127 ---- KruacentExiled/KE.Items/KE.Items.csproj | 21 - KruacentExiled/KE.Items/MainPlugin.cs | 28 - KruacentExiled/KruacentExiled.sln | 32 +- 90 files changed, 3744 insertions(+), 2300 deletions(-) delete mode 100644 KruacentExiled/KE.BlackoutNDoor/API/Features/RoundEffects/Blackout.cs delete mode 100644 KruacentExiled/KE.BlackoutNDoor/API/Features/RoundEffects/DoorStuck.cs delete mode 100644 KruacentExiled/KE.BlackoutNDoor/API/Features/RoundEffects/RoundEffect.cs delete mode 100644 KruacentExiled/KE.BlackoutNDoor/Config.cs delete mode 100644 KruacentExiled/KE.BlackoutNDoor/Events/EventArgs/RoundEffect/PostRoundEffectEventArgs.cs delete mode 100644 KruacentExiled/KE.BlackoutNDoor/Events/EventArgs/RoundEffect/PreRoundEffectEventArgs.cs delete mode 100644 KruacentExiled/KE.BlackoutNDoor/Events/Handlers/RoundEffect.cs delete mode 100644 KruacentExiled/KE.BlackoutNDoor/Events/Interface/IZoneEvent.cs delete mode 100644 KruacentExiled/KE.BlackoutNDoor/Handlers/ServerHandler.cs delete mode 100644 KruacentExiled/KE.BlackoutNDoor/KE.BlackoutNDoor.csproj delete mode 100644 KruacentExiled/KE.BlackoutNDoor/MainPlugin.cs delete mode 100644 KruacentExiled/KE.BlackoutNDoor/Translation/Translation.cs create mode 100644 KruacentExiled/KE.CustomRoles/API/Features/CustomSCP.cs create mode 100644 KruacentExiled/KE.CustomRoles/API/Features/GlobalCustomRole.cs create mode 100644 KruacentExiled/KE.CustomRoles/API/Features/KEAbilities.cs create mode 100644 KruacentExiled/KE.CustomRoles/API/Features/KECustomRole.cs create mode 100644 KruacentExiled/KE.CustomRoles/API/Interfaces/ISCPPreferences.cs create mode 100644 KruacentExiled/KE.CustomRoles/Abilities/Airstrike.cs create mode 100644 KruacentExiled/KE.CustomRoles/Abilities/Convert.cs create mode 100644 KruacentExiled/KE.CustomRoles/Abilities/Explode.cs create mode 100644 KruacentExiled/KE.CustomRoles/Abilities/SelectPosition.cs create mode 100644 KruacentExiled/KE.CustomRoles/Abilities/Thief.cs create mode 100644 KruacentExiled/KE.CustomRoles/Abilities/Trade.cs create mode 100644 KruacentExiled/KE.CustomRoles/CR/ChaosInsurgency/LeRusse.cs create mode 100644 KruacentExiled/KE.CustomRoles/CR/ChaosInsurgency/Negotiator.cs create mode 100644 KruacentExiled/KE.CustomRoles/CR/ClassD/DBoyInShape.cs create mode 100644 KruacentExiled/KE.CustomRoles/CR/ClassD/Enfant.cs create mode 100644 KruacentExiled/KE.CustomRoles/CR/ClassD/Mime.cs create mode 100644 KruacentExiled/KE.CustomRoles/CR/Guard/ChiefGuard.cs create mode 100644 KruacentExiled/KE.CustomRoles/CR/Guard/Guard914.cs create mode 100644 KruacentExiled/KE.CustomRoles/CR/Human/Alzheimer.cs create mode 100644 KruacentExiled/KE.CustomRoles/CR/Human/Asthmatique.cs create mode 100644 KruacentExiled/KE.CustomRoles/CR/Human/Big.cs create mode 100644 KruacentExiled/KE.CustomRoles/CR/Human/Cleptoman.cs create mode 100644 KruacentExiled/KE.CustomRoles/CR/Human/Curiosophile.cs create mode 100644 KruacentExiled/KE.CustomRoles/CR/Human/Diabetique.cs create mode 100644 KruacentExiled/KE.CustomRoles/CR/Human/Hitman.cs create mode 100644 KruacentExiled/KE.CustomRoles/CR/Human/Inverted.cs create mode 100644 KruacentExiled/KE.CustomRoles/CR/Human/Maladroit.cs create mode 100644 KruacentExiled/KE.CustomRoles/CR/Human/Paper.cs create mode 100644 KruacentExiled/KE.CustomRoles/CR/Human/Paper2.cs create mode 100644 KruacentExiled/KE.CustomRoles/CR/MTF/Pilot.cs create mode 100644 KruacentExiled/KE.CustomRoles/CR/MTF/Tank.cs create mode 100644 KruacentExiled/KE.CustomRoles/CR/MTF/Terroriste.cs create mode 100644 KruacentExiled/KE.CustomRoles/CR/SCP/Paper.cs create mode 100644 KruacentExiled/KE.CustomRoles/CR/SCP/SCP457.cs create mode 100644 KruacentExiled/KE.CustomRoles/CR/SCP/Small.cs create mode 100644 KruacentExiled/KE.CustomRoles/CR/SCP/Tall.cs create mode 100644 KruacentExiled/KE.CustomRoles/CR/SCP/Ultra.cs create mode 100644 KruacentExiled/KE.CustomRoles/CR/SCP/ZombieDoorman.cs create mode 100644 KruacentExiled/KE.CustomRoles/CR/Scientist/GambleAddict.cs create mode 100644 KruacentExiled/KE.CustomRoles/CR/Scientist/ZoneManager.cs create mode 100644 KruacentExiled/KE.CustomRoles/Config.cs create mode 100644 KruacentExiled/KE.CustomRoles/KE.CustomRoles.csproj create mode 100644 KruacentExiled/KE.CustomRoles/MainPlugin.cs create mode 100644 KruacentExiled/KE.CustomRoles/Patches/ActiveAbilityPatches.cs create mode 100644 KruacentExiled/KE.CustomRoles/Patches/FpcMotorPatches.cs create mode 100644 KruacentExiled/KE.CustomRoles/Settings/SettingHandler.cs create mode 100644 KruacentExiled/KE.CustomRoles/Translations.cs delete mode 100644 KruacentExiled/KE.GlobalEventFramework.Examples/Config.cs delete mode 100644 KruacentExiled/KE.GlobalEventFramework.Examples/GE/Blitz.cs delete mode 100644 KruacentExiled/KE.GlobalEventFramework.Examples/GE/Impostor.cs delete mode 100644 KruacentExiled/KE.GlobalEventFramework.Examples/GE/KIWIS.cs delete mode 100644 KruacentExiled/KE.GlobalEventFramework.Examples/GE/OpenBar.cs delete mode 100644 KruacentExiled/KE.GlobalEventFramework.Examples/GE/R.cs delete mode 100644 KruacentExiled/KE.GlobalEventFramework.Examples/GE/RandomSpawn.cs delete mode 100644 KruacentExiled/KE.GlobalEventFramework.Examples/GE/Shuffle.cs delete mode 100644 KruacentExiled/KE.GlobalEventFramework.Examples/GE/Speed.cs delete mode 100644 KruacentExiled/KE.GlobalEventFramework.Examples/GE/SystemMalfunction.cs delete mode 100644 KruacentExiled/KE.GlobalEventFramework.Examples/KE.GlobalEventFramework.Examples.csproj delete mode 100644 KruacentExiled/KE.GlobalEventFramework.Examples/MainPlugin.cs delete mode 100644 KruacentExiled/KE.GlobalEventFramework/Config.cs delete mode 100644 KruacentExiled/KE.GlobalEventFramework/GEFE/API/Features/GlobalEvent.cs delete mode 100644 KruacentExiled/KE.GlobalEventFramework/GEFE/API/Features/Loader.cs delete mode 100644 KruacentExiled/KE.GlobalEventFramework/GEFE/API/Interfaces/IGlobalEvent.cs delete mode 100644 KruacentExiled/KE.GlobalEventFramework/GEFE/API/Utils/Coroutine.cs delete mode 100644 KruacentExiled/KE.GlobalEventFramework/GEFE/Commands/List.cs delete mode 100644 KruacentExiled/KE.GlobalEventFramework/GEFE/Commands/ParentCommandGEFE.cs delete mode 100644 KruacentExiled/KE.GlobalEventFramework/GEFE/Exception/GlobalEventNullException.cs delete mode 100644 KruacentExiled/KE.GlobalEventFramework/GEFE/Handlers/ServerHandler.cs delete mode 100644 KruacentExiled/KE.GlobalEventFramework/KE.GlobalEventFramework.csproj delete mode 100644 KruacentExiled/KE.GlobalEventFramework/MainPlugin.cs delete mode 100644 KruacentExiled/KE.Items/Config.cs delete mode 100644 KruacentExiled/KE.Items/Items/AdrenalineDrogue.cs delete mode 100644 KruacentExiled/KE.Items/Items/Defibrilator.cs delete mode 100644 KruacentExiled/KE.Items/Items/Mine.cs delete mode 100644 KruacentExiled/KE.Items/Items/TPGrenada.cs delete mode 100644 KruacentExiled/KE.Items/KE.Items.csproj delete mode 100644 KruacentExiled/KE.Items/MainPlugin.cs diff --git a/KruacentExiled/KE.BlackoutNDoor/API/Features/RoundEffects/Blackout.cs b/KruacentExiled/KE.BlackoutNDoor/API/Features/RoundEffects/Blackout.cs deleted file mode 100644 index cdc1f19b..00000000 --- a/KruacentExiled/KE.BlackoutNDoor/API/Features/RoundEffects/Blackout.cs +++ /dev/null @@ -1,39 +0,0 @@ -using Exiled.API.Enums; -using Exiled.API.Features; -using System.Collections.Generic; - -namespace KE.BlackoutNDoor.API.Features.RoundEffects -{ - public class Blackout : RoundEffect - { - - public Blackout() - { - base.EventTranslation = "Failure Of All Lights"; - base.Chances = new Dictionary() - { - { ZoneType.LightContainment, 33 }, - { ZoneType.HeavyContainment, 33 }, - { ZoneType.Entrance, 34 }, - }; - } - - - public override void Effect(ZoneType zone) - { - Map.TurnOffAllLights(999, zone); - } - - public override void StopEffect(ZoneType zone) - { - Map.TurnOffAllLights(0f, zone); - } - - - - - } - - - -} diff --git a/KruacentExiled/KE.BlackoutNDoor/API/Features/RoundEffects/DoorStuck.cs b/KruacentExiled/KE.BlackoutNDoor/API/Features/RoundEffects/DoorStuck.cs deleted file mode 100644 index bed148bf..00000000 --- a/KruacentExiled/KE.BlackoutNDoor/API/Features/RoundEffects/DoorStuck.cs +++ /dev/null @@ -1,46 +0,0 @@ -using Exiled.API.Enums; -using Exiled.API.Features; -using Exiled.API.Features.Doors; -using MEC; -using System.Collections.Generic; -using System.Linq; - -namespace KE.BlackoutNDoor.API.Features.RoundEffects -{ - public class DoorStuck : RoundEffect - { - public DoorStuck() - { - base.EventTranslation = "Door system malfunction "; - base.Chances = new Dictionary() - { - { ZoneType.LightContainment, 20 }, - { ZoneType.HeavyContainment, 10 }, - { ZoneType.Entrance, 70 }, - }; - } - - - public override void Effect(ZoneType zone) - { - bool openAfter = UnityEngine.Random.value < .5f; - if (zone == ZoneType.LightContainment && Map.DecontaminationState >= DecontaminationState.Countdown) return; - foreach(Door door in Door.List.Where(d => !d.IsElevator && d.Zone == zone)) - { - if (!door.AllowsScp106 && Generator.List.Where(g => g.IsEngaged).ToList().Count != 3) continue; - door.IsOpen = false; - door.ChangeLock(DoorLockType.Lockdown2176); - Timing.CallDelayed(MainPlugin.Instance.Config.DurationMalfunction / 2, () => door.IsOpen = true); - Timing.CallDelayed(MainPlugin.Instance.Config.DurationMalfunction, () => door.Unlock()); - door.IsOpen = openAfter; - } - - } - - public override void StopEffect(ZoneType zone) - { - - } - - } -} diff --git a/KruacentExiled/KE.BlackoutNDoor/API/Features/RoundEffects/RoundEffect.cs b/KruacentExiled/KE.BlackoutNDoor/API/Features/RoundEffects/RoundEffect.cs deleted file mode 100644 index 394e2e47..00000000 --- a/KruacentExiled/KE.BlackoutNDoor/API/Features/RoundEffects/RoundEffect.cs +++ /dev/null @@ -1,196 +0,0 @@ -using Exiled.API.Enums; -using Exiled.API.Extensions; -using Exiled.API.Features; -using KE.BlackoutNDoor.Events.EventArgs.RoundEffect; -using KE.Utils.API.Interfaces; -using MEC; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using UnityEngine; - -namespace KE.BlackoutNDoor.API.Features.RoundEffects -{ - public abstract class RoundEffect - { - /// - /// How Cassie will announce the message - /// - public string EventTranslation { get; protected set; } - public IReadOnlyDictionary Chances { get; protected set; } - public abstract void Effect(ZoneType zone); - public abstract void StopEffect(ZoneType zone); - - - internal ZoneType SelectZone() - { - int totalWeight = 0; - foreach (var weight in Chances.Values) - { - totalWeight += weight; - } - - if (totalWeight == 0) - { - Log.Error("Total probability must be greater than zero."); - return ZoneType.Unspecified; - } - - int randValue = UnityEngine.Random.Range(0, totalWeight); - int cumulativeSum = 0; - - foreach (var entry in Chances) - { - cumulativeSum += entry.Value; - if (randValue < cumulativeSum) - return entry.Key; - } - - Log.Error("Zone selection failed"); - return ZoneType.Unspecified; - } - - - public static readonly Controller Controller = new(); - public static HashSet AllEffect { get; set; } - - - - - - public static void SubscribeEvents() - { - Controller.SubscribeEvents(); - } - - public static void UnsubscribeEvents() - { - Controller.UnsubscribeEvents(); - } - - - - - } - public class Controller : IUsingEvents - { - - private HashSet RoundEffects = []; - private static CoroutineHandle Handle; - - public Controller() - { - RoundEffect.AllEffect = new() - { - new Blackout(), - new DoorStuck() - }; - } - - - public void SubscribeEvents() - { - Exiled.Events.Handlers.Server.RoundStarted += OnRoundStarted; - Exiled.Events.Handlers.Server.WaitingForPlayers += OnWaitingForPlayers; - } - - public void UnsubscribeEvents() - { - Exiled.Events.Handlers.Server.RoundStarted -= OnRoundStarted; - Exiled.Events.Handlers.Server.WaitingForPlayers -= OnWaitingForPlayers; - } - - private void OnRoundStarted() - { - Log.Debug($"handle = {Handle}"); - Timing.KillCoroutines(Handle); - Handle = Timing.RunCoroutine(Update()); - } - - private void OnWaitingForPlayers() - { - Timing.KillCoroutines(Handle); - } - - - - public IEnumerator Update() - { - int wait = UnityEngine.Random.Range(MainPlugin.Instance.Config.MinInterval, MainPlugin.Instance.Config.MaxInterval); - if (MainPlugin.Instance.Config.Debug) wait = 20; - - - while (Round.InProgress) - { - if (Warhead.IsInProgress) continue; - - RoundEffect roundEffect = SelectRoundEffect(); - var zone = roundEffect.SelectZone(); - Log.Debug("zone=" + zone); - Log.Debug($"waiting : {wait}"); - yield return Timing.WaitForSeconds(wait); - PreRoundEffectEventArgs args = new(zone, roundEffect); - Events.Handlers.RoundEffect.OnPreRoundEffect(args); - if (args.IsAllowed) - { - var timeyapping = CassieVoiceLine(zone, roundEffect); - yield return Timing.WaitForSeconds(5 + timeyapping); - roundEffect.Effect(zone); - yield return Timing.WaitForSeconds(MainPlugin.Instance.Config.DurationMalfunction); - roundEffect.StopEffect(zone); - Events.Handlers.RoundEffect.OnPostRoundEffect(new(zone, roundEffect)); - } - - } - - - } - - private RoundEffect SelectRoundEffect() - { - return RoundEffects.GetRandomValue(); - } - - private float CassieVoiceLine(ZoneType zone, RoundEffect round) - { - string nameEvent = round.EventTranslation; - string msg = $"Warning {nameEvent} in {GetZoneName(zone)} in 5 seconds"; - string colorzone = GetZoneColor(zone).ToHex(); - string msgTranslated = $"Warning {nameEvent} In {GetZoneName(zone)} in 5 seconds"; - - Cassie.MessageTranslated(msg, msgTranslated, true, false, true); - return Cassie.CalculateDuration(msg); - - } - - private Color GetZoneColor(ZoneType zone) - { - return zone switch - { - ZoneType.LightContainment => new Color(0.1058f, 0.7333f, 0.6078f), - ZoneType.HeavyContainment => new Color(0.2627f, 0.0980f, 0.0980f), - ZoneType.Entrance => new Color(1, 1, 0), - _ => new Color(1, 0, 0) - }; - } - - - private string GetZoneName(ZoneType zone) - { - return zone switch - { - ZoneType.LightContainment => "Light Containment Zone", - ZoneType.HeavyContainment => "Heavy Containment Zone", - ZoneType.Entrance => "Entrance Zone", - ZoneType.Surface => "Surface", - ZoneType.Unspecified => "All of the facility", - _ => "somewhere" - }; - } - - - - } -} diff --git a/KruacentExiled/KE.BlackoutNDoor/Config.cs b/KruacentExiled/KE.BlackoutNDoor/Config.cs deleted file mode 100644 index bd86be91..00000000 --- a/KruacentExiled/KE.BlackoutNDoor/Config.cs +++ /dev/null @@ -1,25 +0,0 @@ -using Exiled.API.Interfaces; -using System; -using System.Collections.Generic; -using System.ComponentModel; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace KE.BlackoutNDoor -{ - public class Config : IConfig - { - public bool IsEnabled { get; set; } = true; - public bool Debug { get; set; } = false; - - [Description("the minimum interval between 2 malfunctions")] - public int MinInterval { get; set; } = 300; - [Description("the maximum interval between 2 malfunctions")] - public int MaxInterval { get; set; } = 600; - [Description("chance of having a Blackout at the start of the game")] - public double InitialChanceBO { get; set; } = 0.5; - [Description("the duration of a malfunction")] - public int DurationMalfunction { get; set; } = 30; - } -} diff --git a/KruacentExiled/KE.BlackoutNDoor/Events/EventArgs/RoundEffect/PostRoundEffectEventArgs.cs b/KruacentExiled/KE.BlackoutNDoor/Events/EventArgs/RoundEffect/PostRoundEffectEventArgs.cs deleted file mode 100644 index ba4e5cd4..00000000 --- a/KruacentExiled/KE.BlackoutNDoor/Events/EventArgs/RoundEffect/PostRoundEffectEventArgs.cs +++ /dev/null @@ -1,26 +0,0 @@ -using Exiled.API.Enums; -using Exiled.Events.EventArgs.Interfaces; -using KE.BlackoutNDoor.API.Features.RoundEffects; -using KE.BlackoutNDoor.Events.Interface; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using RoundE = KE.BlackoutNDoor.API.Features.RoundEffects.RoundEffect; - -namespace KE.BlackoutNDoor.Events.EventArgs.RoundEffect -{ - public class PostRoundEffectEventArgs : IExiledEvent, IZoneEvent - { - public ZoneType Zone { get; } - public RoundE RoundEffect { get; set; } - - - public PostRoundEffectEventArgs(ZoneType zone, RoundE roundEffect) - { - Zone = zone; - RoundEffect = roundEffect; - } - } -} diff --git a/KruacentExiled/KE.BlackoutNDoor/Events/EventArgs/RoundEffect/PreRoundEffectEventArgs.cs b/KruacentExiled/KE.BlackoutNDoor/Events/EventArgs/RoundEffect/PreRoundEffectEventArgs.cs deleted file mode 100644 index 967627a6..00000000 --- a/KruacentExiled/KE.BlackoutNDoor/Events/EventArgs/RoundEffect/PreRoundEffectEventArgs.cs +++ /dev/null @@ -1,28 +0,0 @@ -using Exiled.API.Enums; -using Exiled.Events.EventArgs.Interfaces; -using KE.BlackoutNDoor.API.Features.RoundEffects; -using KE.BlackoutNDoor.Events.Interface; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using RoundE = KE.BlackoutNDoor.API.Features.RoundEffects.RoundEffect; - -namespace KE.BlackoutNDoor.Events.EventArgs.RoundEffect -{ - public class PreRoundEffectEventArgs : IExiledEvent, IDeniableEvent, IZoneEvent - { - public bool IsAllowed { get; set; } - public ZoneType Zone { get; } - public RoundE RoundEffect { get; set; } - - - public PreRoundEffectEventArgs(ZoneType zone, RoundE roundEffect, bool isAllowed = true) - { - Zone = zone; - RoundEffect = roundEffect; - IsAllowed = isAllowed; - } - } -} diff --git a/KruacentExiled/KE.BlackoutNDoor/Events/Handlers/RoundEffect.cs b/KruacentExiled/KE.BlackoutNDoor/Events/Handlers/RoundEffect.cs deleted file mode 100644 index a3e75d61..00000000 --- a/KruacentExiled/KE.BlackoutNDoor/Events/Handlers/RoundEffect.cs +++ /dev/null @@ -1,40 +0,0 @@ -using Exiled.Events.Features; -using KE.BlackoutNDoor.Events.EventArgs.RoundEffect; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace KE.BlackoutNDoor.Events.Handlers -{ - public static class RoundEffect - { - /// - /// Invoked before a occurr - /// - public static Event PreRoundEffect = new(); - /// - /// Invoked after a occurr - /// - public static Event PostRoundEffect = new(); - - - /// - /// Called before a occurr - /// - /// - public static void OnPreRoundEffect(PreRoundEffectEventArgs ev) - { - PreRoundEffect.InvokeSafely(ev); - } - /// - /// Called after a occurr - /// - /// - public static void OnPostRoundEffect(PostRoundEffectEventArgs ev) - { - PostRoundEffect.InvokeSafely(ev); - } - } -} diff --git a/KruacentExiled/KE.BlackoutNDoor/Events/Interface/IZoneEvent.cs b/KruacentExiled/KE.BlackoutNDoor/Events/Interface/IZoneEvent.cs deleted file mode 100644 index 44809ea1..00000000 --- a/KruacentExiled/KE.BlackoutNDoor/Events/Interface/IZoneEvent.cs +++ /dev/null @@ -1,16 +0,0 @@ -using Exiled.API.Enums; -using Exiled.Events.EventArgs.Interfaces; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace KE.BlackoutNDoor.Events.Interface -{ - internal interface IZoneEvent : IExiledEvent - { - - public ZoneType Zone { get; } - } -} diff --git a/KruacentExiled/KE.BlackoutNDoor/Handlers/ServerHandler.cs b/KruacentExiled/KE.BlackoutNDoor/Handlers/ServerHandler.cs deleted file mode 100644 index 867ba740..00000000 --- a/KruacentExiled/KE.BlackoutNDoor/Handlers/ServerHandler.cs +++ /dev/null @@ -1,16 +0,0 @@ -using KE.BlackoutNDoor.API.Features; -using Exiled.API.Features; -using MEC; -using System.Collections.Generic; -using System; - -namespace KE.BlackoutNDoor.Handlers -{ - public class ServerHandler - { - [Obsolete()] - public int Cooldown { get; set; } - - - } -} diff --git a/KruacentExiled/KE.BlackoutNDoor/KE.BlackoutNDoor.csproj b/KruacentExiled/KE.BlackoutNDoor/KE.BlackoutNDoor.csproj deleted file mode 100644 index 4d4b6e71..00000000 --- a/KruacentExiled/KE.BlackoutNDoor/KE.BlackoutNDoor.csproj +++ /dev/null @@ -1,30 +0,0 @@ - - - - 13.0 - net48 - true - - - - - - - - - - - - - - - - - - if not "$(EXILED_DEV_REFERENCES)"=="" copy /y "$(OutputPath)$(AssemblyName).dll" "$(EXILED_DEV_REFERENCES)\Plugins\" - - - if [[ ! -z "$EXILED_DEV_REFERENCES" ]]; then cp "$(OutputPath)$(AssemblyName).dll" "$EXILED_DEV_REFERENCES/Plugins/"; fi - - - diff --git a/KruacentExiled/KE.BlackoutNDoor/MainPlugin.cs b/KruacentExiled/KE.BlackoutNDoor/MainPlugin.cs deleted file mode 100644 index 437a4c13..00000000 --- a/KruacentExiled/KE.BlackoutNDoor/MainPlugin.cs +++ /dev/null @@ -1,48 +0,0 @@ -using KE.BlackoutNDoor.API.Features; -using KE.BlackoutNDoor.Handlers; -using Exiled.API.Features; -using System; -using System.ComponentModel; -using Server = Exiled.Events.Handlers.Server; -using KE.BlackoutNDoor.API.Features.RoundEffects; - -namespace KE.BlackoutNDoor -{ - public class MainPlugin : Plugin - { - public override string Author => "Patrique"; - public override Version Version => new Version(1,0,0); - public override string Name => "KE.BlackoutDoor"; - internal static MainPlugin Instance; - - [Obsolete()] - public ServerHandler ServerHandler { get; } = null; - - public override void OnEnabled() - { - Instance = this; - this.RegisterEvent(); - } - public override void OnDisabled() - { - - Instance = null; - this.UnregisterEvent(); - } - - private void RegisterEvent() - { - RoundEffect.SubscribeEvents(); - - } - private void UnregisterEvent() - { - RoundEffect.UnsubscribeEvents(); - } - - - - - - } -} diff --git a/KruacentExiled/KE.BlackoutNDoor/Translation/Translation.cs b/KruacentExiled/KE.BlackoutNDoor/Translation/Translation.cs deleted file mode 100644 index 3976823b..00000000 --- a/KruacentExiled/KE.BlackoutNDoor/Translation/Translation.cs +++ /dev/null @@ -1,15 +0,0 @@ -using Exiled.API.Interfaces; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace KE.BlackoutNDoor.Translation -{ - public class Translation : ITranslation - { - - - } -} diff --git a/KruacentExiled/KE.CustomRoles/API/Features/CustomSCP.cs b/KruacentExiled/KE.CustomRoles/API/Features/CustomSCP.cs new file mode 100644 index 00000000..2a45d731 --- /dev/null +++ b/KruacentExiled/KE.CustomRoles/API/Features/CustomSCP.cs @@ -0,0 +1,56 @@ +using Exiled.API.Features; +using Exiled.API.Features.Core.UserSettings; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace KE.CustomRoles.API.Features +{ + public abstract class CustomSCP : KECustomRole + { + public const int MinValue = -5; + public const int MaxValue = 5; + public const int DefaultValue = 0; + + public static int ScpPreferenceHeaderId => MainPlugin.Instance.Config.ScpPreferenceHeaderId; + private static HeaderSetting header; + private static bool headerflag = false; + private SliderSetting sliderSetting; + public abstract bool IsSupport { get; } + public int SettingId => (int)Id; + + public static IEnumerable All => Registered.Where(c => c is CustomSCP).Cast(); + public override void Init() + { + if (!headerflag) + { + header = new HeaderSetting(ScpPreferenceHeaderId, "SCP Spawn Preferences"); + headerflag = true; + } + + + sliderSetting = new SliderSetting(SettingId, PublicName, MinValue, MaxValue, DefaultValue, true, header: header); + SettingBase.Register([sliderSetting]); + + + base.Init(); + } + + + public override void Destroy() + { + SettingBase.Unregister(); + base.Destroy(); + } + + + public int GetPreferences(Player player) + { + if (!SettingBase.TryGetSetting(player, sliderSetting.Id, out var setting)) return -6; + return (int) setting.SliderValue; + } + + } +} diff --git a/KruacentExiled/KE.CustomRoles/API/Features/GlobalCustomRole.cs b/KruacentExiled/KE.CustomRoles/API/Features/GlobalCustomRole.cs new file mode 100644 index 00000000..3d6e733a --- /dev/null +++ b/KruacentExiled/KE.CustomRoles/API/Features/GlobalCustomRole.cs @@ -0,0 +1,180 @@ +using Exiled.API.Enums; +using Exiled.API.Extensions; +using Exiled.API.Features; +using Exiled.API.Features.Attributes; +using Exiled.API.Features.Pools; +using Exiled.CustomRoles.API.Features; +using Exiled.Events.EventArgs.Player; +using InventorySystem.Configs; +using KE.Utils.API.Displays.DisplayMeow; +using LiteNetLib4Mirror.Open.Nat; +using MEC; +using PlayerRoles; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using UnityEngine; + +namespace KE.CustomRoles.API.Features +{ + + public abstract class GlobalCustomRole : KECustomRole + { + public sealed override RoleTypeId Role { get; set; } = RoleTypeId.None; + public abstract SideEnum Side { get; set; } + public override bool KeepInventoryOnSpawn { get; set; } = true; + public override bool RemovalKillsPlayer => false; + + public override void AddRole(Player player) + { + SideEnum side = SideClass.Get(player.Role.Side); + + if (side != Side) + { + Log.Error($"tried to give a global custom role to a player in the wrong side ({side} instead of {Side})"); + return; + } + Log.Debug($"{Name}: Adding role to {player.Nickname}."); + TrackedPlayers.Add(player); + + + + Timing.CallDelayed( + 0.25f, + () => + { + if (!KeepInventoryOnSpawn) + { + Log.Debug($"{Name}: Clearing {player.Nickname}'s inventory."); + player.ClearInventory(); + } + + foreach (string itemName in Inventory) + { + Log.Debug($"{Name}: Adding {itemName} to inventory."); + TryAddItem(player, itemName); + } + + if (Ammo.Count > 0) + { + Log.Debug($"{Name}: Adding Ammo to {player.Nickname} inventory."); + foreach (AmmoType type in EnumUtils.Values) + { + if (type != AmmoType.None) + player.SetAmmo(type, Ammo.ContainsKey(type) ? Ammo[type] == ushort.MaxValue ? InventoryLimits.GetAmmoLimit(type.GetItemType(), player.ReferenceHub) : Ammo[type] : (ushort)0); + } + } + }); + + Log.Debug($"{Name}: Setting health values."); + player.MaxHealth *= MaxHealthMultiplicator; + player.Health = player.MaxHealth; + player.Scale = Scale; + + Vector3 position = GetSpawnPosition(); + if (position != Vector3.zero) + { + player.Position = position; + } + + Log.Debug($"{Name}: Setting player info"); + + player.CustomInfo = $"{player.CustomName}\n{CustomInfo}"; + player.InfoArea &= ~(PlayerInfoArea.Role | PlayerInfoArea.Nickname); + + if (Abilities != null) + { + foreach (int abilityId in Abilities) + { + KEAbilities.TryAddToPlayer(abilityId, player); + } + } + + + ShowMessage(player); + RoleAdded(player); + player.UniqueRole = Name; + } + public override void RemoveRole(Player player) + { + + + if (!TrackedPlayers.Contains(player)) + { + return; + } + + Log.Debug(Name + ": Removing role from " + player.Nickname + $"({player.Id})"); + TrackedPlayers.Remove(player); + player.CustomInfo = string.Empty; + player.InfoArea |= PlayerInfoArea.Nickname | PlayerInfoArea.Role; + player.Scale = Vector3.one; + if (CustomAbilities != null) + { + foreach (CustomAbility customAbility in CustomAbilities) + { + customAbility.RemoveAbility(player); + } + } + + RoleRemoved(player); + player.UniqueRole = string.Empty; + player.TryRemoveCustomeRoleFriendlyFire(Name); + if (RemovalKillsPlayer) + { + //player.Role.Set(RoleTypeId.Spectator); + } + Log.Debug(Name + ": finish Removing role from " + player.Nickname + $"({player.Id})"); + + } + + + + + public sealed override int MaxHealth { get; set; } + public virtual float MaxHealthMultiplicator { get; set; } = 1; + + protected override void ShowMessage(Player player) + { + string show; + if (player.IsScp) + { + show = $"{Name} {player.Role.Name}\n {Description}"; + } + else + { + show = $"{Name}\n {Description}"; + } + + + //todo settings + float delay = 20; + + DisplayHandler.Instance.AddHint(MainPlugin.CRHint, player, show, delay); + } + } + + public enum SideEnum + { + Human, + SCP, + None, + } + + public static class SideClass + { + public static SideEnum Get(Side side) + { + return side switch + { + Side.Scp => SideEnum.SCP, + Side.Tutorial or Side.Mtf or Side.ChaosInsurgency => SideEnum.Human, + Side.None => SideEnum.None, + _ => SideEnum.None, + }; + } + } + +} diff --git a/KruacentExiled/KE.CustomRoles/API/Features/KEAbilities.cs b/KruacentExiled/KE.CustomRoles/API/Features/KEAbilities.cs new file mode 100644 index 00000000..ae0ce961 --- /dev/null +++ b/KruacentExiled/KE.CustomRoles/API/Features/KEAbilities.cs @@ -0,0 +1,550 @@ +using Exiled.API.Features; +using Exiled.API.Features.Core.UserSettings; +using Exiled.CustomRoles.API.Features; +using Exiled.Events.EventArgs.Player; +using KE.CustomRoles.Settings; +using KE.Utils.API; +using KE.Utils.API.Displays.DisplayMeow; +using MEC; +using PlayerRoles.Subroutines; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Reflection; +using UserSettings.ServerSpecific; +using UserSettings.UserInterfaceSettings; +using static PlayerList; + +namespace KE.CustomRoles.API.Features +{ + /// + /// Our version of the + /// + public abstract class KEAbilities + { + #region static stuff + private static HashSet registered = new(); + public static HashSet Registered => registered; + #endregion + + #region abstract stuff + public abstract string Name { get; } + public abstract string Description { get; } + /// + /// Used for the settings option + /// + public abstract int Id { get; } + /// + /// in seconds + /// + public abstract float Cooldown { get; } + #endregion + + public HashSet GetRoles + { + get + { + HashSet result = new(); + foreach (KECustomRole cr in KECustomRole.KnownKECR) + { + foreach(int abilityId in cr.Abilities) + { + KEAbilities ability = Get(abilityId); + if (ability == this) + { + result.Add(cr); + } + } + } + return result; + } + } + private Dictionary LastUsed = new(); + private static Dictionary TypeToAbility { get; } = new(); + private static Dictionary IdToAbility { get; } = new(); + private static HeaderSetting header; + private static bool flagHeader = false; + private SettingBase setting; + public HashSet Players { get; } = new HashSet(); + public HashSet Selected { get; } = new(); + + + + public static Dictionary> PlayersAbility { get;} = new(); + + protected KEAbilities() + { + + } + public void Init() + { + if (IdToAbility.ContainsKey(Id)) + { + Log.Warn($"{Name} ({Id}) have the same id as {IdToAbility[Id].Name}. Skipping..."); + return; + } + + + + SettingBase old = SettingBase.List.Where(s => s.Id == Id).FirstOrDefault(); + + if(old == null) + { + if (!flagHeader) + { + header = new(MainPlugin.Configs.HeaderId, "Abilities"); + SettingBase.Register([header]); + flagHeader = true; + } + Log.Debug("creating keybind"); + setting = new KeybindSetting(Id, Name, UnityEngine.KeyCode.None,hintDescription:Description); + SettingBase.Register([setting]); + } + else + { + Log.Error($"setting of {this} have the same id as {old.Label}"); + } + StartLoop(); + IdToAbility.Add(Id, this); + TypeToAbility.Add(GetType(), this); + InternalSubscribeEvent(); + } + + public void Destroy() + { + Func p = null; + SettingBase.Unregister(p, [setting]); + InternalUnsubcribeEvent(); + } + + private void InternalSubscribeEvent() + { + + ServerSpecificSettingsSync.ServerOnSettingValueReceived += SafeOnSettingValueReceived; + Exiled.Events.Handlers.Player.Verified += OnVerified; + SubscribeEvents(); + } + + private void InternalUnsubcribeEvent() + { + ServerSpecificSettingsSync.ServerOnSettingValueReceived -= SafeOnSettingValueReceived; + Exiled.Events.Handlers.Player.Verified -= OnVerified; + UnsubscribeEvents(); + } + + private void SafeOnSettingValueReceived(ReferenceHub hub, ServerSpecificSettingBase settingBase) + { + //not catching the exception will desync & kick the player + try + { + OnSettingValueReceived(Player.Get(hub), settingBase); + } + catch (Exception e) + { + Log.Error(e); + } + } + + private void OnSettingValueReceived(Player player, ServerSpecificSettingBase settingBase) + { + if (!CheckPressed(settingBase)) return; + if (!Check(player)) return; + + if (!SettingHandler.Instance.GetMode(player)) return; + + + if(CanUse(player,out string _)) + { + UseAbility(player); + } + } + + + + private void OnVerified(VerifiedEventArgs ev) + { + ServerSpecificSettingsSync.SendToPlayer(ev.Player.ReferenceHub); + } + + protected virtual void SubscribeEvents() + { + + } + + protected virtual void UnsubscribeEvents() + { + + } + + protected virtual void AbilityUsed(Player player) + { + + } + + protected virtual void AbilityAdded(Player player) + { + + } + protected virtual void AbilityRemoved(Player player) + { + + } + + + public void SelectAbility(Player player) + { + if (Selected.Add(player)) + { + Log.Debug($"player {player.Nickname} selected ability {this}"); + foreach (KEAbilities abilities in Registered.Where(a => a != this)) + { + abilities.UnselectAbility(player); + } + } + } + + public void UnselectAbility(Player player) + { + Log.Debug($"player {player.Nickname} unselected ability {this}"); + Selected.Remove(player); + } + + public void RemoveAbility(Player player) + { + + if (Players.Contains(player)) + { + Log.Debug($"player {player.Nickname} lost {this}"); + PlayersAbility[player].Remove(this); + Players.Remove(player); + AbilityRemoved(player); + } + } + public void AddAbility(Player player) + { + + bool result = Players.Add(player); + Log.Debug($"player {player.Nickname} got {this} ({result})"); + if (result) + { + if(!PlayersAbility.TryGetValue(player,out var _)) + { + PlayersAbility.Add(player, new()); + } + PlayersAbility[player].Add(this); + + AbilityAdded(player); + } + + } + public void UseAbility(Player player) + { + LastUsed[player] = DateTime.Now; + + + AbilityUsed(player); + } + + public bool Check(Player player) + { + if(player is not null) + { + return Players.Contains(player); + } + return false; + } + + public bool CanUse(Player player, out string result) + { + if (player == null) + { + result = "player null"; + return false; + } + if (!Players.Contains(player)) + { + result = "cannot use this"; + return false; + } + + if (!LastUsed.ContainsKey(player)) + { + result = "never used"; + return true; + } + + DateTime dateTime = LastUsed[player] + TimeSpan.FromSeconds(Cooldown); + if (DateTime.Now > dateTime) + { + result = "ok"; + return true; + } + result = "in cooldown"; + return false; + } + + public bool CheckPressed(ServerSpecificSettingBase settingBase) + { + return CheckPressed(settingBase, setting.Id); + } + + public static void UseSelected(Player player) + { + if(TryGetSelected(player,out var ability)) + { + if (ability.CanUse(player, out string _)) + { + ability.UseAbility(player); + } + } + } + + public static bool TryAddToPlayer(Type typeAbility,Player player) + { + if (!TypeToAbility.TryGetValue(typeAbility, out var ability)) return false; + + + ability.AddAbility(player); + return true; + + + } + public static bool TryAddToPlayer(int abilityId,Player player) + { + if (!IdToAbility.TryGetValue(abilityId, out var ability)) return false; + + + ability.AddAbility(player); + return true; + + + } + + public static void RemoveAllSelect(Player player) + { + if (!PlayersAbility.ContainsKey(player)) return; + + foreach(KEAbilities ability in PlayersAbility[player]) + { + ability.Selected.Remove(player); + } + + UpdateGUI(player); + } + + public static void SelectFirstAbility(Player player) + { + if(PlayersAbility.TryGetValue(player,out var list)) + { + list[0].SelectAbility(player); + + UpdateGUI(player); + } + + } + + public static void TryRemoveFromPlayer(Player player) + { + foreach(KEAbilities abilities in Registered) + { + if (abilities.Players.Contains(player)) + { + abilities.RemoveAbility(player); + } + } + } + + + public static bool CheckPressed(ServerSpecificSettingBase settingBase, int id) + { + return settingBase is SSKeybindSetting keybindSetting && keybindSetting.SettingId == id && keybindSetting.SyncIsPressed; + } + + #region register + private bool TryRegister() + { + + + if (!Registered.Contains(this)) + { + Registered.Add(this); + Init(); + Log.Debug("registered " + Name); + return true; + } + + + + return false; + } + + + public static IEnumerable Register(Assembly assembly =null) + { + IEnumerable abilities = ReflectionHelper.GetObjects(assembly); + List result = abilities.ToList(); + + foreach(KEAbilities ability in abilities) + { + + if (!ability.TryRegister()) + { + Log.Warn("couldn't register KEability " + ability); + result.Remove(ability); + } + + } + registered = result.ToHashSet(); + return result; + + } + + + private bool TryUnregister() + { + Destroy(); + if (Registered.Remove(this)) + { + Log.Debug("unregistered " + this); + return true; + } + Log.Warn(this + " was not registered"); + return false; + } + + public static IEnumerable Unregister() + { + List list = new(); + foreach (KEAbilities item in Registered) + { + item.TryUnregister(); + list.Add(item); + } + + return list; + } + #endregion + + #region getters + + public static KEAbilities Get(int id) + { + foreach(KEAbilities kEAbilities in Registered) + { + if (id == kEAbilities.Id) + { + return kEAbilities; + } + } + + return null; + } + + public static bool TryGet(int id, out KEAbilities ability) + { + ability = Get(id); + return ability != null; + } + + public static KEAbilities GetSelected(Player player) + { + foreach(KEAbilities ability in Registered) + { + if (ability.Selected.Contains(player)) + { + return ability; + } + } + return null; + } + + public static bool TryGetSelected(Player player, out KEAbilities ability) + { + ability = GetSelected(player); + return ability != null; + } + + + #endregion + + #region gui + + + private static readonly float UpdateTime = 1; + private static bool flag = false; + private static void StartLoop() + { + if (!flag) + { + Timing.RunCoroutine(Loop()); + flag = true; + } + } + private static IEnumerator Loop() + { + while (true) + { + UpdateAllGUI(); + yield return Timing.WaitForSeconds(UpdateTime); + } + } + public static void UpdateAllGUI() + { + foreach(Player player in PlayersAbility.Keys) + { + UpdateGUI(player); + } + } + public static void UpdateGUI(Player player) + { + string msg = ""; + + List allAbilities = PlayersAbility[player]; + + for (int i = 0; i < allAbilities.Count; i++) + { + + + KEAbilities ability = allAbilities[i]; + + msg += $"{ability.Name} "; + if (ability.CanUse(player,out var output)) + { + msg += "[READY]"; + } + else + { + DateTime dateTime = ability.LastUsed[player] + TimeSpan.FromSeconds(ability.Cooldown); + msg += $"[{Math.Round((dateTime - DateTime.Now).TotalSeconds, 0)}s]"; + } + + + + //Log.Debug($"ability {ability.Name} contain {ability.Selected.Count} "); + + if (ability.Selected.Contains(player)) + { + //todo replace with the settings + msg += SettingHandler.baseArrow; + } + + + + msg += "\n"; + } + + //Log.Debug(msg); + + DisplayHandler.Instance.AddHint(MainPlugin.Abilities, player, msg, 1f); + } + + + #endregion + + public override string ToString() + { + return Name; + } + + } +} diff --git a/KruacentExiled/KE.CustomRoles/API/Features/KECustomRole.cs b/KruacentExiled/KE.CustomRoles/API/Features/KECustomRole.cs new file mode 100644 index 00000000..11c76aa3 --- /dev/null +++ b/KruacentExiled/KE.CustomRoles/API/Features/KECustomRole.cs @@ -0,0 +1,249 @@ +using Exiled.API.Enums; +using Exiled.API.Extensions; +using Exiled.API.Features; +using Exiled.CustomRoles.API; +using Exiled.CustomRoles.API.Features; +using InventorySystem.Configs; +using KE.Utils.API.Displays.DisplayMeow; +using MEC; +using PlayerRoles; +using System.Collections.Generic; +using System.Linq; +using UnityEngine; + +namespace KE.CustomRoles.API.Features +{ + public abstract class KECustomRole : CustomRole + { + + public override string Name + { + get + { + return GetType().Name; + } + set + { + + } + } + + + public static IEnumerable KnownKECR => Registered.Where(c => c is KECustomRole).Cast(); + + public sealed override string CustomInfo { get; set; } + public abstract string PublicName { get; set; } + + public virtual HashSet Abilities { get; } + + public sealed override bool IgnoreSpawnSystem { get; set; } = true; + protected override void ShowMessage(Player player) + { + + //string msg = MainPlugin.Translations.GettingNewRole; + //msg = msg.Replace("%Name%", PublicName).Replace("%Desc%",Description); + + string msg = $"{PublicName}"; + + if (MainPlugin.SettingHandler.GetDescriptionsSettings(player)) + { + msg += $"\n {Description}"; + } + + + float delay = MainPlugin.SettingHandler.GetTime(player); + + DisplayHandler.Instance.AddHint(MainPlugin.CRHint, player, msg, delay); + } + + + + protected void ShowEffectHint(Player player, string text) + { + float delay = MainPlugin.SettingHandler.GetTime(player); ; + DisplayHandler.Instance.AddHint(MainPlugin.CREffect, player, text, delay); + } + + public override void AddRole(Player player) + { + Player player2 = player; + Log.Debug(Name + ": Adding role to " + player2.Nickname + "."); + + if (Role != RoleTypeId.None) + { + + if (KeepPositionOnSpawn) + { + if (KeepInventoryOnSpawn) + { + player2.Role.Set(Role, SpawnReason.ForceClass, RoleSpawnFlags.None); + } + else + { + player2.Role.Set(Role, SpawnReason.ForceClass, RoleSpawnFlags.AssignInventory); + } + } + else if (KeepInventoryOnSpawn && player2.IsAlive) + { + player2.Role.Set(Role, SpawnReason.ForceClass, RoleSpawnFlags.None); + } + else + { + player2.Role.Set(Role, SpawnReason.ForceClass, RoleSpawnFlags.AssignInventory); + } + } + TrackedPlayers.Add(player2); + + Timing.CallDelayed(0.25f, delegate + { + if (!KeepInventoryOnSpawn) + { + player2.ClearInventory(); + } + + foreach (string item in Inventory) + { + TryAddItem(player2, item); + } + + if (Ammo.Count > 0) + { + AmmoType[] values = EnumUtils.Values; + foreach (AmmoType ammoType in values) + { + if (ammoType != 0) + { + player2.SetAmmo(ammoType, (ushort)(Ammo.ContainsKey(ammoType) ? Ammo[ammoType] == ushort.MaxValue ? InventoryLimits.GetAmmoLimit(ammoType.GetItemType(), player2.ReferenceHub) : Ammo[ammoType] : 0)); + } + } + } + }); + player2.Health = MaxHealth; + player2.MaxHealth = MaxHealth; + player2.Scale = Scale; + Vector3 spawnPosition = GetSpawnPosition(); + if (spawnPosition != Vector3.zero) + { + player2.Position = spawnPosition; + } + + player2.CustomInfo = player2.CustomName + "\n" + PublicName; + player2.InfoArea &= ~(PlayerInfoArea.Nickname | PlayerInfoArea.Role); + if (CustomAbilities != null) + { + foreach (CustomAbility customAbility in CustomAbilities) + { + customAbility.AddAbility(player2); + } + } + + + if(Abilities != null) + { + foreach(int abilityId in Abilities) + { + KEAbilities.TryAddToPlayer(abilityId, player2); + } + KEAbilities.SelectFirstAbility(player2); + } + + + ShowMessage(player2); + RoleAdded(player2); + player2.UniqueRole = Name; + player2.TryAddCustomRoleFriendlyFire(Name, CustomRoleFFMultiplier); + } + + public override void RemoveRole(Player player) + { + if (Abilities != null) + { + KEAbilities.TryRemoveFromPlayer(player); + } + base.RemoveRole(player); + } + + + /// + /// The chance of having this role NOT the chance to have a role + /// + public override abstract float SpawnChance { get; set; } + + + + + #region Spawn + + /// + /// The chance to get a at the start or a respawn + /// + public static int Chance + { + get + { + return chance; + } + set + { + chance = Mathf.Clamp(value, 0, 100); + } + } + + private static int chance = 40; + + private static CustomRole AssignRole(Dictionary roleChances) + { + float totalWeight = roleChances.Values.Sum(); + float randomValue = UnityEngine.Random.Range(0f, totalWeight); + + foreach (var role in roleChances) + { + randomValue -= role.Value; + if (randomValue <= 0) + return role.Key; + } + + return roleChances.Keys.First(); + } + + public static Dictionary GetAvailableCustomRole(Player player) + { + return Registered.Where(c => c.Role == player.Role || c is GlobalCustomRole cgr && cgr.Side == SideClass.Get(player.Role.Side)).ToDictionary(c => c, c => c.SpawnChance); + } + + public static void GiveRandomRole(Player player) + { + if (player == null) + return; + if (UnityEngine.Random.Range(0, 101) > Chance) + { + Log.Debug("no luck"); + return; + } + + if(player.GetCustomRoles().Count != 0) + { + Log.Debug("already got a cr"); + return; + } + + + CustomRole cr = AssignRole(GetAvailableCustomRole(player)); + Log.Debug($"{player.Id} : {cr.Name}"); + + //error assigning cr to a player with a gcr + cr?.AddRole(player); + } + + public static void GiveRole(IEnumerable players) + { + foreach (Player p in players) + { + GiveRandomRole(p); + } + } + #endregion + + + } +} diff --git a/KruacentExiled/KE.CustomRoles/API/Interfaces/ISCPPreferences.cs b/KruacentExiled/KE.CustomRoles/API/Interfaces/ISCPPreferences.cs new file mode 100644 index 00000000..a3d74e4e --- /dev/null +++ b/KruacentExiled/KE.CustomRoles/API/Interfaces/ISCPPreferences.cs @@ -0,0 +1,18 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace KE.CustomRoles.API.Interfaces +{ + + /// + /// SCP custom role implementing this interface will allow them to have a preference slider like the vanilla scps + /// + public interface ISCPPreferences + { + + + } +} diff --git a/KruacentExiled/KE.CustomRoles/Abilities/Airstrike.cs b/KruacentExiled/KE.CustomRoles/Abilities/Airstrike.cs new file mode 100644 index 00000000..1af25274 --- /dev/null +++ b/KruacentExiled/KE.CustomRoles/Abilities/Airstrike.cs @@ -0,0 +1,75 @@ +using Exiled.API.Features; +using Exiled.API.Features.Attributes; +using Exiled.API.Features.Items; +using Exiled.API.Features.Pickups.Projectiles; +using Exiled.API.Features.Toys; +using Exiled.CustomRoles.API.Features; +using KE.CustomRoles.API.Features; +using MapGeneration; +using MEC; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using UnityEngine; +using Light = Exiled.API.Features.Toys.Light; + +namespace KE.CustomRoles.Abilities +{ + public class Airstrike : KEAbilities + { + public override string Name { get; } = "Airstrike"; + + public override string Description { get; } = "Don't overuse it or your co-op will not be happy"; + + public override int Id => 2001; + public override float Cooldown { get; } = 60f; + + public float height = 5; + + + + protected override void AbilityUsed(Player player) + { + if(!SelectPosition.TryGetTarget(player, out Vector3 target)) + { + //show hint + Log.Info("no target selected"); + return; + } + if(target.GetZone() != FacilityZone.Surface) + { + Log.Info("set target surface"); + return; + } + + Physics.Linecast(target, target + height * Vector3.up, out RaycastHit hit); + if (hit.collider != null) + { + Log.Info($"hit something [{hit.collider}]"); + return; + } + + var l = Light.Create(target,null,null,true,Color.red); + + ExplosiveGrenade grenade = (ExplosiveGrenade)Item.Create(ItemType.GrenadeHE,player); + grenade.ScpDamageMultiplier = 1; + grenade.FuseTime = 10; + Timing.CallDelayed(5, () => + { + Projectile gre = grenade.SpawnActive(target + (height - .5f) * Vector3.up); + + //explode on collision + gre.GameObject.AddComponent().Init(player.GameObject, gre.Base); + l.Destroy(); + }); + + + + + } + + + } +} diff --git a/KruacentExiled/KE.CustomRoles/Abilities/Convert.cs b/KruacentExiled/KE.CustomRoles/Abilities/Convert.cs new file mode 100644 index 00000000..790ecac9 --- /dev/null +++ b/KruacentExiled/KE.CustomRoles/Abilities/Convert.cs @@ -0,0 +1,52 @@ +using Exiled.API.Features; +using Exiled.API.Features.Attributes; +using Exiled.CustomRoles.API.Features; +using KE.CustomRoles.API.Features; +using PlayerRoles; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using UnityEngine; + +namespace KE.CustomRoles.Abilities +{ + public class Convert : KEAbilities + { + public override string Name { get; } = "Convert"; + + public override string Description { get; } = ""; + + public override int Id => 2004; + + public override float Cooldown { get; } = 10*60f; + + public float MaxDistance { get; set; } = 5f; + + protected override void AbilityUsed(Player player) + { + Physics.Linecast(player.Position, player.Position + player.Rotation.eulerAngles * MaxDistance,out RaycastHit hit); + + Player playerHit = Player.Get(hit.collider); + + if (playerHit == null) return; + + if (playerHit.Role.Side == player.Role.Side) return; + + if (playerHit.IsScp && playerHit.Role != RoleTypeId.Scp0492) return; + + + if (playerHit.IsScp) + { + playerHit.Role.Set(player.Role, RoleSpawnFlags.AssignInventory); + } + else + { + playerHit.Role.Set(player.Role, RoleSpawnFlags.None); + } + + } + + } +} diff --git a/KruacentExiled/KE.CustomRoles/Abilities/Explode.cs b/KruacentExiled/KE.CustomRoles/Abilities/Explode.cs new file mode 100644 index 00000000..031cda80 --- /dev/null +++ b/KruacentExiled/KE.CustomRoles/Abilities/Explode.cs @@ -0,0 +1,33 @@ +using Exiled.API.Features; +using Exiled.API.Features.Attributes; +using Exiled.API.Features.Items; +using Exiled.CustomRoles.API.Features; +using KE.CustomRoles.API.Features; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using UnityEngine; + +namespace KE.CustomRoles.Abilities +{ + public class Explode : KEAbilities + { + public override string Name { get; } = "Explode"; + + public override string Description { get; } = "Tu as une ceinture d'explosif autour de toi, fait attention n'appuie pas sur le bouton"; + + public override int Id => 2007; + + public override float Cooldown { get; } = 4*60f; + + protected override void AbilityUsed(Player player) + { + ExplosiveGrenade grenade = ((ExplosiveGrenade)Item.Create(ItemType.GrenadeHE)); + grenade.FuseTime = 0.2f; + grenade.SpawnActive(player.Position); + Log.Debug("Grenade spawned"); + } + } +} diff --git a/KruacentExiled/KE.CustomRoles/Abilities/SelectPosition.cs b/KruacentExiled/KE.CustomRoles/Abilities/SelectPosition.cs new file mode 100644 index 00000000..667ac4bb --- /dev/null +++ b/KruacentExiled/KE.CustomRoles/Abilities/SelectPosition.cs @@ -0,0 +1,46 @@ +using Exiled.API.Features; +using KE.CustomRoles.API.Features; +using System.Collections.Generic; +using UnityEngine; + +namespace KE.CustomRoles.Abilities +{ + public class SelectPosition : KEAbilities + { + public override string Name { get; } = "SetPosition"; + + public override string Description { get; } = "Select the current position for another ability"; + + public override int Id => 2000; + public override float Cooldown { get; } = 5f; + + private static Dictionary SelectedTarget = new(); + + protected override void AbilityUsed(Player player) + { + + + + if (SelectedTarget.ContainsKey(player)) + { + SelectedTarget[player] = player.Position; + } + else + { + SelectedTarget.Add(player, player.Position); + } + + Log.Info("set position at " +player.Position); + + + } + + public static bool TryGetTarget(Player p, out Vector3 target) + { + return SelectedTarget.TryGetValue(p, out target); + + } + + + } +} diff --git a/KruacentExiled/KE.CustomRoles/Abilities/Thief.cs b/KruacentExiled/KE.CustomRoles/Abilities/Thief.cs new file mode 100644 index 00000000..d2325f34 --- /dev/null +++ b/KruacentExiled/KE.CustomRoles/Abilities/Thief.cs @@ -0,0 +1,52 @@ +using Exiled.API.Extensions; +using Exiled.API.Features; +using Exiled.API.Features.Items; +using KE.CustomRoles.API.Features; +using KE.Utils.API.Displays.DisplayMeow; +using System.Collections.Generic; +using System.Linq; + +namespace KE.CustomRoles.Abilities +{ + public class Thief : KEAbilities + { + public override string Name { get; } = "Thief"; + + public override string Description { get; } = "Avec 1548 heures de jeu sur Thief Simulator fallait s'y attendre un peu."; + + public override int Id => 2006; + + public override float Cooldown { get; } = 120f; + + protected override void AbilityUsed(Player player) + { + List playerList = Player.List.Where(p => !p.IsScp).ToList(); + playerList.Remove(player); + + Log.Debug("Player list :"); + playerList.ForEach(p => Log.Info(p.Nickname)); + + Player thiefed = playerList.GetRandomValue(); + + Log.Debug($"Thiefed player : {thiefed.Nickname}"); + + Item inv = thiefed.Items.ToList().GetRandomValue(); + + Log.Debug($"Thiefed item : {inv}"); + + if (inv == null) + { + Log.Info("No item to thiefed, null, returning."); + HintPlacement hint = new(0, 750, HintServiceMeow.Core.Enum.HintAlignment.Center); + float delay = MainPlugin.SettingHandler.GetTime(player); + DisplayHandler.Instance.AddHint(hint, player, "I think this is a skill issue ! Congrats !", delay); + } + + var thiefBool = thiefed.RemoveItem(inv); + Log.Debug($"Item deleted {thiefBool}."); + + inv.Give(player); + Log.Debug($"Item given to {player.Nickname}."); + } + } +} diff --git a/KruacentExiled/KE.CustomRoles/Abilities/Trade.cs b/KruacentExiled/KE.CustomRoles/Abilities/Trade.cs new file mode 100644 index 00000000..4465ea06 --- /dev/null +++ b/KruacentExiled/KE.CustomRoles/Abilities/Trade.cs @@ -0,0 +1,51 @@ +using Exiled.API.Features; +using Exiled.API.Features.Attributes; +using Exiled.CustomRoles.API.Features; +using KE.CustomRoles.API.Features; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using UnityEngine; + +namespace KE.CustomRoles.Abilities +{ + public class Trade : KEAbilities + { + public override string Name { get; } = "Trade"; + + public override string Description { get; } = "T'es lien avec le casino t'as permis d'avoir un peu plus de pièce en échange d'un item ou de pire"; + + public override int Id => 2002; + + public override float Cooldown { get; } = 1f; + + public static float MaxHealthPercent = .1f; + + protected override void AbilityUsed(Player player) + { + if (player.CurrentItem != null) + { + player.RemoveItem(player.CurrentItem); + } + else + { + float newMaxHealth = player.MaxHealth - player.MaxHealth * MaxHealthPercent; + if (newMaxHealth > 0) + { + player.MaxHealth = newMaxHealth; + player.Health = Mathf.Min(player.Health, player.MaxHealth); + } + else + { + player.Kill("The casino always win"); + return; + } + } + + player.AddItem(ItemType.Coin); + } + + } +} diff --git a/KruacentExiled/KE.CustomRoles/CR/ChaosInsurgency/LeRusse.cs b/KruacentExiled/KE.CustomRoles/CR/ChaosInsurgency/LeRusse.cs new file mode 100644 index 00000000..5d406b07 --- /dev/null +++ b/KruacentExiled/KE.CustomRoles/CR/ChaosInsurgency/LeRusse.cs @@ -0,0 +1,39 @@ +using Exiled.API.Enums; +using Exiled.API.Features.Attributes; +using KE.CustomRoles.API.Features; +using PlayerRoles; +using System.Collections.Generic; +using UnityEngine; + +namespace KE.CustomRoles.CR.ChaosInsurgency +{ + [CustomRole(RoleTypeId.ChaosConscript)] + internal class Russe : KECustomRole + { + public override string Description { get; set; } = "Tu es un maitre de jeu \ntu dois faire la roulette russe avec les autres joueurs"; + public override uint Id { get; set; } = 1050; + public override string PublicName { get; set; } = "Le Russe"; + public override int MaxHealth { get; set; } = 100; + public override RoleTypeId Role { get; set; } = RoleTypeId.ChaosConscript; + public override bool KeepRoleOnDeath { get; set; } = false; + public override bool KeepRoleOnChangingRole { get; set; } = false; + + public override float SpawnChance { get; set; } = 100; + public override Vector3 Scale { get; set; } = new Vector3(1.1f, 1f, 1.1f); + + public override List Inventory { get; set; } = new List() + { + $"{ItemType.GunRevolver}", + $"{ItemType.Radio}", + $"{ItemType.Adrenaline}", + $"{ItemType.KeycardChaosInsurgency}", + $"{ItemType.GrenadeHE}", + $"{ItemType.GrenadeHE}", + }; + + public override Dictionary Ammo { get; set; } = new Dictionary() + { + { AmmoType.Ammo44Cal, 18} + }; + } +} diff --git a/KruacentExiled/KE.CustomRoles/CR/ChaosInsurgency/Negotiator.cs b/KruacentExiled/KE.CustomRoles/CR/ChaosInsurgency/Negotiator.cs new file mode 100644 index 00000000..83e9512a --- /dev/null +++ b/KruacentExiled/KE.CustomRoles/CR/ChaosInsurgency/Negotiator.cs @@ -0,0 +1,67 @@ +using Exiled.API.Enums; +using Exiled.API.Features; +using Exiled.API.Features.Attributes; +using Exiled.CustomRoles.API.Features; +using Exiled.Events.EventArgs.Player; +using KE.CustomRoles.API.Features; +using MEC; +using PlayerRoles; +using System.Collections.Generic; +using UnityEngine; + +namespace KE.CustomRoles.CR.ChaosInsurgency +{ + [CustomRole(RoleTypeId.ChaosConscript)] + internal class Negotiator : KECustomRole + { + public override string Description { get; set; } = "Who knew zombie could be so great listeners"; + public override uint Id { get; set; } = 1071; + public override string PublicName { get; set; } = "Negotiator"; + public override int MaxHealth { get; set; } = 100; + public override RoleTypeId Role { get; set; } = RoleTypeId.ChaosConscript; + public override bool KeepRoleOnDeath { get; set; } = false; + public override bool KeepRoleOnChangingRole { get; set; } = false; + + public override float SpawnChance { get; set; } = 100; + + public override HashSet Abilities { get; } = new() + { + 2004 + }; + + protected override void RoleAdded(Player player) + { + Timing.CallDelayed(.1f, delegate + { + player.AddItem(ItemType.Radio); + }); + } + + protected override void SubscribeEvents() + { + Exiled.Events.Handlers.Player.Hurting += OnHurting; + base.SubscribeEvents(); + } + + protected override void UnsubscribeEvents() + { + Exiled.Events.Handlers.Player.Hurting -= OnHurting; + base.UnsubscribeEvents(); + } + + + private void OnHurting(HurtingEventArgs ev) + { + if (!Check(ev.Player)) return; + if (!ev.IsAllowed) return; + + if(ev.Attacker.Role.Side == ev.Player.Role.Side) + { + ev.IsAllowed = false; + } + + } + + + } +} diff --git a/KruacentExiled/KE.CustomRoles/CR/ClassD/DBoyInShape.cs b/KruacentExiled/KE.CustomRoles/CR/ClassD/DBoyInShape.cs new file mode 100644 index 00000000..7b34aa77 --- /dev/null +++ b/KruacentExiled/KE.CustomRoles/CR/ClassD/DBoyInShape.cs @@ -0,0 +1,92 @@ +using CustomPlayerEffects; +using Exiled.API.Enums; +using Exiled.API.Extensions; +using Exiled.API.Features; +using Exiled.API.Features.Attributes; +using Exiled.CustomRoles.API.Features; +using Exiled.Events.EventArgs.Map; +using Exiled.Events.EventArgs.Player; +using KE.CustomRoles.API.Features; +using MEC; +using PlayerRoles; +using System; +using System.Collections.Generic; +using System.Linq; +using UnityEngine; +using Utils.NonAllocLINQ; + +namespace KE.CustomRoles.CR.ClassD +{ + [CustomRole(RoleTypeId.ClassD)] + internal class DBoyInShape : KECustomRole + { + public override string Description { get; set; } = "Dammmmnnnnnnn les gates"; + public override uint Id { get; set; } = 1058; + public override string PublicName { get; set; } = "DBoyInShape"; + public override RoleTypeId Role { get; set; } = RoleTypeId.ClassD; + public override bool KeepRoleOnDeath { get; set; } = false; + public override bool KeepRoleOnChangingRole { get; set; } = true; + public override float SpawnChance { get; set; } = 100; + public override int MaxHealth { get; set; } = 100; + + private const byte _speedReduction = 15; + + protected override void RoleAdded(Player player) + { + player.EnableEffect(EffectType.Slowness, 5, _speedReduction); + } + + protected override void RoleRemoved(Player player) + { + player.DisableEffect(EffectType.Slowness); + } + + protected override void SubscribeEvents() + { + Exiled.Events.Handlers.Player.InteractingDoor += InteractingDoor; + } + + protected override void UnsubscribeEvents() + { + Exiled.Events.Handlers.Player.InteractingDoor -= InteractingDoor; + } + + public void InteractingDoor(InteractingDoorEventArgs ev) + { + if (ev.IsAllowed) return; + if (!Check(ev.Player)) return; + + int successRate; + int damage; + + if (ev.Door.Type.IsGate()) + { + successRate = 20; + damage = 20; + } + else if (ev.Door.Type.IsCheckpoint()) + { + successRate = 30; + damage = 10; + } + else + { + successRate = 40; + damage = 5; + } + + int proba = UnityEngine.Random.Range(0, 101); + + if (proba <= successRate) + { + ev.IsAllowed = true; + Log.Info($"{ev.Player.Nickname} a réussi à ouvrir une {ev.Door.Type} !"); + } + else + { + Log.Info($"{ev.Player.Nickname} a échoué à ouvrir une {ev.Door.Type} et a perdu {damage} HP !"); + ev.Player.Hurt(damage, DamageType.SeveredHands); + } + } + } +} \ No newline at end of file diff --git a/KruacentExiled/KE.CustomRoles/CR/ClassD/Enfant.cs b/KruacentExiled/KE.CustomRoles/CR/ClassD/Enfant.cs new file mode 100644 index 00000000..0823311b --- /dev/null +++ b/KruacentExiled/KE.CustomRoles/CR/ClassD/Enfant.cs @@ -0,0 +1,30 @@ +using Exiled.API.Features.Attributes; +using InventorySystem.Items.Usables.Scp330; +using KE.CustomRoles.API.Features; +using PlayerRoles; +using System.Collections.Generic; +using UnityEngine; + +namespace KE.CustomRoles.CR.ClassD +{ + [CustomRole(RoleTypeId.ClassD)] + internal class Enfant : KECustomRole + { + public override string Description { get; set; } = "Tu es un Enfant \ndo not the kid \ntu commences avec un bonbon arc-en-ciel \n t'es un peu plus petit que la normal"; + public override uint Id { get; set; } = 1041; + public override string PublicName { get; set; } = "Enfant"; + public override int MaxHealth { get; set; } = 100; + public override RoleTypeId Role { get; set; } = RoleTypeId.ClassD; + public override bool KeepRoleOnDeath { get; set; } = true; + public override bool KeepRoleOnChangingRole { get; set; } = true; + + public override float SpawnChance { get; set; } = 100; + public override Vector3 Scale { get; set; } = new Vector3(1, 0.75f, 1); + + public override List Inventory { get; set; } = new List() + { + $"{CandyKindID.Rainbow}" + }; + } + +} diff --git a/KruacentExiled/KE.CustomRoles/CR/ClassD/Mime.cs b/KruacentExiled/KE.CustomRoles/CR/ClassD/Mime.cs new file mode 100644 index 00000000..807554b7 --- /dev/null +++ b/KruacentExiled/KE.CustomRoles/CR/ClassD/Mime.cs @@ -0,0 +1,41 @@ +using Exiled.API.Enums; +using Exiled.API.Features; +using Exiled.API.Features.Attributes; +using Exiled.Events.EventArgs.Player; +using InventorySystem.Items.Usables.Scp330; +using KE.CustomRoles.API.Features; +using PlayerRoles; +using PlayerRoles.Spectating; +using System.Collections.Generic; +using UnityEngine; + +namespace KE.CustomRoles.CR.ClassD +{ + [CustomRole(RoleTypeId.ClassD)] + internal class Mime : KECustomRole + { + public override string Description { get; set; } = "Tu es un Mime \nTu ne peux pas parler\nmais tu fais très peu de bruit quand tu marches\net t'es tout plat"; + public override uint Id { get; set; } = 1053; + public override string PublicName { get; set; } = "Mime"; + public override int MaxHealth { get; set; } = 100; + public override RoleTypeId Role { get; set; } = RoleTypeId.ClassD; + public override bool KeepRoleOnDeath { get; set; } = false; + public override bool KeepRoleOnChangingRole { get; set; } = true; + public override float SpawnChance { get; set; } = 0; + public override Vector3 Scale { get; set; } = new Vector3(0.1f, 1, 1); + + protected override void RoleAdded(Player player) + { + player.EnableEffect(EffectType.SilentWalk, -1, true); //doesn't work with 939 i think + player.Mute(); + } + + protected override void RoleRemoved(Player player) + { + player.UnMute(); + player.DisableEffect(EffectType.SilentWalk); + } + + + } +} diff --git a/KruacentExiled/KE.CustomRoles/CR/Guard/ChiefGuard.cs b/KruacentExiled/KE.CustomRoles/CR/Guard/ChiefGuard.cs new file mode 100644 index 00000000..b607af37 --- /dev/null +++ b/KruacentExiled/KE.CustomRoles/CR/Guard/ChiefGuard.cs @@ -0,0 +1,38 @@ +using Exiled.API.Enums; +using Exiled.API.Features.Attributes; +using KE.CustomRoles.API.Features; +using PlayerRoles; +using System.Collections.Generic; + +namespace KE.CustomRoles.CR.Guard +{ + [CustomRole(RoleTypeId.FacilityGuard)] + internal class ChiefGuard : KECustomRole + { + public override string Description { get; set; } = "Tu es un Chef des gardes du site \nT'as une carte de private \net un crossvec"; + public override uint Id { get; set; } = 1046; + public override string PublicName { get; set; } = "Chef des Gardes"; + public override int MaxHealth { get; set; } = 100; + public override RoleTypeId Role { get; set; } = RoleTypeId.FacilityGuard; + public override bool KeepRoleOnDeath { get; set; } = false; + public override bool KeepRoleOnChangingRole { get; set; } = false; + + public override float SpawnChance { get; set; } = 100; + + public override List Inventory { get; set; } = new List() + { + $"{ItemType.Radio}", + $"{ItemType.ArmorLight}", + $"{ItemType.GunCrossvec}", + $"{ItemType.Medkit}", + $"{ItemType.Flashlight}", + $"{ItemType.KeycardMTFPrivate}" + }; + + public override Dictionary Ammo { get; set; } = new Dictionary() + { + { AmmoType.Nato556, 120} + }; + + } +} diff --git a/KruacentExiled/KE.CustomRoles/CR/Guard/Guard914.cs b/KruacentExiled/KE.CustomRoles/CR/Guard/Guard914.cs new file mode 100644 index 00000000..e5a5a95f --- /dev/null +++ b/KruacentExiled/KE.CustomRoles/CR/Guard/Guard914.cs @@ -0,0 +1,50 @@ +using Exiled.API.Enums; +using Exiled.API.Features.Attributes; +using Exiled.API.Features.Spawn; +using KE.CustomRoles.API.Features; +using PlayerRoles; +using System.Collections.Generic; + +namespace KE.CustomRoles.CR.Guard +{ + [CustomRole(RoleTypeId.FacilityGuard)] + internal class Guard914 : KECustomRole + { + public override string Description { get; set; } = "Tu es Le garde de SCP-914 \nTu commences à 914 \nmais on a volé ta carte \net ntm aussi"; + public override uint Id { get; set; } = 1045; + public override string PublicName { get; set; } = "Garde de 914"; + public override int MaxHealth { get; set; } = 100; + public override RoleTypeId Role { get; set; } = RoleTypeId.FacilityGuard; + public override bool KeepRoleOnDeath { get; set; } = false; + public override bool KeepRoleOnChangingRole { get; set; } = false; + + public override SpawnProperties SpawnProperties { get; set; } = new SpawnProperties() + { + DynamicSpawnPoints = new List() + { + new DynamicSpawnPoint() + { + Location = Exiled.API.Enums.SpawnLocationType.Inside914, + Chance = 100, + } + } + }; + + public override float SpawnChance { get; set; } = 100; + + public override List Inventory { get; set; } = new List() + { + $"{ItemType.Radio}", + $"{ItemType.ArmorLight}", + $"{ItemType.GunFSP9}", + $"{ItemType.Medkit}", + $"{ItemType.Flashlight}" + }; + + public override Dictionary Ammo { get; set; } = new Dictionary() + { + { AmmoType.Nato556, 60} + }; + + } +} diff --git a/KruacentExiled/KE.CustomRoles/CR/Human/Alzheimer.cs b/KruacentExiled/KE.CustomRoles/CR/Human/Alzheimer.cs new file mode 100644 index 00000000..55e5c88b --- /dev/null +++ b/KruacentExiled/KE.CustomRoles/CR/Human/Alzheimer.cs @@ -0,0 +1,74 @@ +using Exiled.API.Enums; +using Exiled.API.Features; +using Exiled.API.Features.Attributes; +using Exiled.CustomRoles.API.Features; +using Exiled.Events.EventArgs.Player; +using KE.CustomRoles.API.Features; +using MEC; +using PlayerRoles; +using System.Collections.Generic; +using UnityEngine; +using Utils.NonAllocLINQ; + +namespace KE.CustomRoles.CR.Human +{ + [CustomRole(RoleTypeId.None)] + internal class Alzheimer : GlobalCustomRole + { + private static Dictionary _coroutines = new(); + public override SideEnum Side { get; set; } = SideEnum.Human; + public override string Description { get; set; } = "Tu es Vieux"; + public override uint Id { get; set; } = 1056; + public override string PublicName { get; set; } = "Vieux"; + public override bool KeepRoleOnDeath { get; set; } = false; + public override bool KeepRoleOnChangingRole { get; set; } = true; + public override float SpawnChance { get; set; } = 100; + protected override void RoleAdded(Player player) + { + _coroutines.Add(player, Timing.RunCoroutine(Teleport(player))); + } + + protected override void RoleRemoved(Player player) + { + if (!_coroutines.ContainsKey(player)) return; + + + + Timing.KillCoroutines(_coroutines[player]); + _coroutines.Remove(player); + } + protected override void SubscribeEvents() + { + Exiled.Events.Handlers.Player.UsedItem += OnUsedItem; + base.SubscribeEvents(); + } + protected override void UnsubscribeEvents() + { + Exiled.Events.Handlers.Player.UsedItem -= OnUsedItem; + base.UnsubscribeEvents(); + } + + private void OnUsedItem(UsedItemEventArgs ev) + { + if (!Check(ev.Player)) return; + if (ev.Item.Type == ItemType.SCP500) + { + RemoveRole(ev.Player); + } + } + + + private IEnumerator Teleport(Player p) + { + while (true) + { + yield return Timing.WaitForSeconds(UnityEngine.Random.Range(300f, 600f)); + p.EnableEffect(EffectType.Flashed,1,5); + p.EnableEffect(EffectType.Invisible,1,6); + p.Teleport(Room.Random(p.Zone)); + } + } + + + } +} diff --git a/KruacentExiled/KE.CustomRoles/CR/Human/Asthmatique.cs b/KruacentExiled/KE.CustomRoles/CR/Human/Asthmatique.cs new file mode 100644 index 00000000..a2cc6966 --- /dev/null +++ b/KruacentExiled/KE.CustomRoles/CR/Human/Asthmatique.cs @@ -0,0 +1,57 @@ +using Exiled.API.Enums; +using Exiled.API.Features; +using Exiled.API.Features.Attributes; +using Exiled.CustomRoles.API.Features; +using Exiled.Events.EventArgs.Player; +using KE.CustomRoles.API.Features; +using PlayerRoles; +using UnityEngine; +using Utils.NonAllocLINQ; + +namespace KE.CustomRoles.CR.Human +{ + [CustomRole(RoleTypeId.None)] + internal class Asthmatique : GlobalCustomRole + { + public override SideEnum Side { get; set; } = SideEnum.Human; + public override string Description { get; set; } = "Tu es asthmatique\nT'as stamina est réduit de moitié\nMais tu vises mieux"; + public override uint Id { get; set; } = 1042; + public override string PublicName { get; set; } = "Asthmatique"; + public override bool KeepRoleOnDeath { get; set; } = false; + public override bool KeepRoleOnChangingRole { get; set; } = true; + public override float SpawnChance { get; set; } = 100; + + + protected override void SubscribeEvents() + { + Exiled.Events.Handlers.Player.UsedItem += OnUsedItem; + base.SubscribeEvents(); + } + protected override void UnsubscribeEvents() + { + Exiled.Events.Handlers.Player.UsedItem -= OnUsedItem; + base.UnsubscribeEvents(); + } + + private void OnUsedItem(UsedItemEventArgs ev) + { + if (!Check(ev.Player)) return; + if(ev.Item.Type == ItemType.SCP500) + { + RemoveRole(ev.Player); + } + } + + protected override void RoleAdded(Player player) + { + player.EnableEffect(EffectType.Scp1853, -1, true); + player.EnableEffect(EffectType.Exhausted, -1, true); + } + + protected override void RoleRemoved(Player player) + { + player.DisableEffect(EffectType.Scp1853); + player.DisableEffect(EffectType.Exhausted); + } + } +} diff --git a/KruacentExiled/KE.CustomRoles/CR/Human/Big.cs b/KruacentExiled/KE.CustomRoles/CR/Human/Big.cs new file mode 100644 index 00000000..9de4c432 --- /dev/null +++ b/KruacentExiled/KE.CustomRoles/CR/Human/Big.cs @@ -0,0 +1,23 @@ +using Exiled.API.Features.Attributes; +using Exiled.CustomRoles.API.Features; +using KE.CustomRoles.API.Features; +using PlayerRoles; +using System.Collections.Generic; +using UnityEngine; + +namespace KE.CustomRoles.CR.Human +{ + [CustomRole(RoleTypeId.None)] + public class Big : GlobalCustomRole + { + public override SideEnum Side { get; set; } = SideEnum.Human; + public override string Description { get; set; } = "Faut arrêter le McDo au bout d'un moment !"; + public override uint Id { get; set; } = 1068; + public override string PublicName { get; set; } = "Big"; + public override bool KeepRoleOnDeath { get; set; } = true; + public override bool KeepRoleOnChangingRole { get; set; } = true; + + public override float SpawnChance { get; set; } = 100; + public override Vector3 Scale { get; set; } = new Vector3(1, 1, 1.4f); + } +} \ No newline at end of file diff --git a/KruacentExiled/KE.CustomRoles/CR/Human/Cleptoman.cs b/KruacentExiled/KE.CustomRoles/CR/Human/Cleptoman.cs new file mode 100644 index 00000000..89a1d900 --- /dev/null +++ b/KruacentExiled/KE.CustomRoles/CR/Human/Cleptoman.cs @@ -0,0 +1,28 @@ +using Exiled.API.Features.Attributes; +using Exiled.CustomRoles.API.Features; +using KE.CustomRoles.API.Features; +using PlayerRoles; +using System.Collections.Generic; +using UnityEngine; + +namespace KE.CustomRoles.CR.Human +{ + [CustomRole(RoleTypeId.None)] + public class Cleptoman : GlobalCustomRole + { + public override SideEnum Side { get; set; } = SideEnum.Human; + public override string Description { get; set; } = "Tu es un Cccleptoman \nTu peux voler les items des autres joueurs"; + public override uint Id { get; set; } = 1453; + public override string PublicName { get; set; } = "Cleptoman"; + public override bool KeepRoleOnDeath { get; set; } = false; + public override bool KeepRoleOnChangingRole { get; set; } = true; + + public override float SpawnChance { get; set; } = 100; + public override Vector3 Scale { get; set; } = new Vector3(1.01f, 0.99f, 1); + + public override HashSet Abilities { get; } = new() + { + 2006 + }; + } +} \ No newline at end of file diff --git a/KruacentExiled/KE.CustomRoles/CR/Human/Curiosophile.cs b/KruacentExiled/KE.CustomRoles/CR/Human/Curiosophile.cs new file mode 100644 index 00000000..9c488670 --- /dev/null +++ b/KruacentExiled/KE.CustomRoles/CR/Human/Curiosophile.cs @@ -0,0 +1,148 @@ +/* +using Exiled.API.Enums; +using Exiled.API.Extensions; +using Exiled.API.Features; +using Exiled.API.Features.Attributes; +using Exiled.CustomRoles.API.Features; +using Exiled.Events.EventArgs.Map; +using Exiled.Events.EventArgs.Player; +using KE.CustomRoles.API; +using MEC; +using PlayerRoles; +using System; +using System.Collections.Generic; +using System.Linq; +using UnityEngine; +using Utils.NonAllocLINQ; + +namespace KE.CustomRoles.CR.Human +{ + [CustomRole(RoleTypeId.None)] + internal class Curiosophile : GlobalCustomRole + { + public override SideEnum Side { get; set; } = SideEnum.Human; + public override string Name { get; set; } = "Curiosophile"; + public override string Description { get; set; } = "Tu veux récuperer tous ce que tu vois !"; + public override uint Id { get; set; } = 1059; + public override string CustomInfo { get; set; } = "Curiosophile"; + public override bool KeepRoleOnDeath { get; set; } = false; + public override bool KeepRoleOnChangingRole { get; set; } = true; + public override float SpawnChance { get; set; } = 100; + + private readonly List LowQualityItem = + [ + ItemType.GunA7, + ItemType.GunCOM15, + ItemType.Flashlight, + ItemType.Coin, + ItemType.KeycardJanitor, + ItemType.KeycardGuard, + ]; + + private readonly List HighQualityItem = + [ + ItemType.MicroHID, + ItemType.Jailbird, + ItemType.GunFRMG0, + ItemType.ArmorHeavy, + ItemType.ParticleDisruptor, + ItemType.Adrenaline, + ItemType.SCP1344, + ItemType.SCP500, + ItemType.AntiSCP207, + ItemType.KeycardMTFCaptain, + ItemType.KeycardO5, + ItemType.KeycardFacilityManager, + ]; + + private readonly List BuffEffect = + [ + EffectType.Vitality, + EffectType.RainbowTaste, + EffectType.BodyshotReduction, + EffectType.AntiScp207 + ]; + + private readonly List NerfEffect = + [ + EffectType.Deafened, + EffectType.AmnesiaVision, + EffectType.InsufficientLighting, + EffectType.Stained, + EffectType.Blurred + ]; + + private Dictionary activeEffect = new Dictionary(); + + protected override void SubscribeEvents() + { + Exiled.Events.Handlers.Player.ItemAdded += PickupItem; + Exiled.Events.Handlers.Player.ItemRemoved += ThrowItem; + } + + protected override void UnsubscribeEvents() + { + Exiled.Events.Handlers.Player.ItemAdded -= PickupItem; + Exiled.Events.Handlers.Player.ItemRemoved -= ThrowItem; + } + + public void PickupItem(ItemAddedEventArgs ev) + { + if (!Check(ev.Player)) return; + + CheckupInventory(ev.Player); + } + + public void ThrowItem(ItemRemovedEventArgs ev) + { + if (!Check(ev.Player)) return; + + CheckupInventory(ev.Player); + } + + private void CheckupInventory(Player p) + { + IEnumerable playerItems = p.Items.Select(item => item.Type); + + int buffedItemCount = playerItems.Intersect(LowQualityItem).Count(); + int nerfedItemCount = playerItems.Intersect(HighQualityItem).Count(); + + + + ApplyRandomBuffEffects(buffedItemCount, p); + ApplyRandomNerfEffects(nerfedItemCount, p); + } + + private void ApplyRandomBuffEffects(int buffedItemCount, Player p) + { + if (buffedItemCount > 0) + { + Log.Info("Buff Effect Applied"); + int effectsToApply = Mathf.Min(buffedItemCount, BuffEffect.Count); + + for (int i = 0; i < effectsToApply; i++) + { + var randomBuff = BuffEffect[UnityEngine.Random.Range(0, BuffEffect.Count)]; + p.EnableEffect(randomBuff, -1); + } + } + } + + private void ApplyRandomNerfEffects(int nerfedItemCount, Player p) + { + if (nerfedItemCount > 0) + { + Log.Info("Nerf Effect Applied"); + + int effectsToApply = Mathf.Min(nerfedItemCount, NerfEffect.Count); + + for (int i = 0; i < effectsToApply; i++) + { + var randomNerf = NerfEffect[UnityEngine.Random.Range(0, NerfEffect.Count)]; + p.EnableEffect(randomNerf, -1); + } + } + } + } +} +*/ \ No newline at end of file diff --git a/KruacentExiled/KE.CustomRoles/CR/Human/Diabetique.cs b/KruacentExiled/KE.CustomRoles/CR/Human/Diabetique.cs new file mode 100644 index 00000000..8e05fe66 --- /dev/null +++ b/KruacentExiled/KE.CustomRoles/CR/Human/Diabetique.cs @@ -0,0 +1,32 @@ +using CustomPlayerEffects; +using Exiled.API.Enums; +using Exiled.API.Features; +using Exiled.API.Features.Attributes; +using Exiled.CustomRoles.API.Features; +using KE.CustomRoles.API.Features; +using PlayerRoles; +using UnityEngine; +using Utils.NonAllocLINQ; + +namespace KE.CustomRoles.CR.Human +{ + [CustomRole(RoleTypeId.None)] + internal class Diabetique : GlobalCustomRole + { + public override SideEnum Side { get; set; } = SideEnum.Human; + public override string Description { get; set; } = "Tu es diabetique\nT'as mangé le crambleu au pomme de mael"; + public override uint Id { get; set; } = 1054; + public override string PublicName { get; set; } = "Diabetique"; + public override bool KeepRoleOnDeath { get; set; } = false; + public override bool KeepRoleOnChangingRole { get; set; } = false; + public override float SpawnChance { get; set; } = 100; + protected override void RoleAdded(Player player) + { + player.EnableEffect(EffectType.Scp207, -1, true); + } + protected override void RoleRemoved(Player player) + { + player.DisableEffect(EffectType.Scp207); + } + } +} diff --git a/KruacentExiled/KE.CustomRoles/CR/Human/Hitman.cs b/KruacentExiled/KE.CustomRoles/CR/Human/Hitman.cs new file mode 100644 index 00000000..8a99f513 --- /dev/null +++ b/KruacentExiled/KE.CustomRoles/CR/Human/Hitman.cs @@ -0,0 +1,231 @@ +using Exiled.API.Enums; +using Exiled.API.Extensions; +using Exiled.API.Features; +using Exiled.API.Features.Attributes; +using Exiled.CustomRoles.API.Features; +using Exiled.Events.EventArgs.Player; +using KE.CustomRoles.API.Features; +using MEC; +using PlayerRoles; +using System.Collections.Generic; +using System.Linq; + +namespace KE.CustomRoles.CR.Human +{ + [CustomRole(RoleTypeId.None)] + internal class Hitman : GlobalCustomRole + { + private static CoroutineHandle _coroutines; + public override SideEnum Side { get; set; } = SideEnum.Human; + public override string Name { get; set; } = "Hitman"; + public override string Description { get; set; } = "Tu es Hitman"; + public override uint Id { get; set; } = 1059; + public override string PublicName { get; set; } = string.Empty; + public override bool KeepRoleOnDeath { get; set; } = false; + public override bool KeepRoleOnChangingRole { get; set; } = true; + public override float SpawnChance { get; set; } = 0; + + private Player TargetPlayer; + private Player TheHitman; + + private void NerfHitman() + { + Log.Info($"Hitman Nerf Applied to {this.TheHitman.Nickname}"); + this.TheHitman.MaxHealth = 70; + this.TheHitman.Health -= 30; + + this.TheHitman.EnableEffect(EffectType.Slowness, -1,true); + } + + private void BuffHitman() + { + Log.Info($"Hitman Buff Applied to {this.TheHitman.Nickname}"); + this.TheHitman.MaxHealth = 130; + this.TheHitman.Health += 30; + + this.TheHitman.EnableEffect(EffectType.MovementBoost, -1, true); + } + + protected override void RoleAdded(Player player) + { + Log.Info("Role full name : " + player.Role.Name); + this.CustomInfo = player.Role.Name; + + this.TheHitman = player; + // Target cannot be NPC, SCP or the Hitman + this.TargetPlayer = Player.List.Where(x => x.IsHuman && x != player && !x.IsNPC).GetRandomValue(); + + if(TargetPlayer == null) + { + Log.Warn("no other human player"); + return; + } + + + + Log.Debug($"Target showing to Hitman, target is : {TargetPlayer.Nickname}"); + ShowEffectHint(player, $"The Target is {TargetPlayer.Nickname}"); + + if (this.TheHitman.Role.Side == this.TargetPlayer.Role.Side && !Server.FriendlyFire) + { + bool success = this.TheHitman.TryAddCustomRoleFriendlyFire(this.TargetPlayer.Role.Type.ToString(), this.TargetPlayer.Role.Type, 1); + Log.Info("Custom FF : " + success); + } + + _coroutines = Timing.RunCoroutine(CheckRooms()); + } + + protected override void RoleRemoved(Player player) + { + Timing.KillCoroutines(_coroutines); + } + + protected override void SubscribeEvents() + { + Exiled.Events.Handlers.Player.Escaped += TargetEscaped; + Exiled.Events.Handlers.Player.Died += TargetDie; + } + + protected override void UnsubscribeEvents() + { + Exiled.Events.Handlers.Player.Escaped -= TargetEscaped; + Exiled.Events.Handlers.Player.Died -= TargetDie; + } + + public void TargetEscaped(EscapedEventArgs ev) + { + if (ev.Player != this.TargetPlayer) return; + + + Log.Info($"Target {this.TargetPlayer.Nickname} escaped"); + ShowEffectHint(TheHitman, $"The target ({this.TargetPlayer.Nickname}) has escaped, you lost the contract"); + + + NerfHitman(); + + this.TargetPlayer = null; + } + + public void TargetDie(DiedEventArgs ev) + { + if (ev.Player != this.TargetPlayer) return; + + Log.Info($"{ev.Attacker} has killed {ev.Player}"); + + // Hitman killed the target + if (ev.Player == this.TargetPlayer && ev.Attacker == this.TheHitman) + { + ShowEffectHint(TheHitman, $"You killed the target ({this.TargetPlayer.Nickname}), you achieved the contract"); + BuffHitman(); + + this.TargetPlayer = null; + } + else + { + ShowEffectHint(TheHitman, $"The target ({this.TargetPlayer.Nickname}) is dead, you lost the contract"); + NerfHitman(); + + this.TargetPlayer = null; + } + + if (this.TheHitman.Role.Side == this.TargetPlayer.Role.Side && !Server.FriendlyFire) + { + this.TheHitman.TryRemoveCustomeRoleFriendlyFire(this.TargetPlayer.Role.Type.ToString()); + } + } + + + + + const float CHECK_INTERVAL = 15f; + + private IEnumerator CheckRooms() + { + List<(int distance, string message, bool hasLogged)> proximityAlerts = new List<(int, string, bool)> + { + (0, "Sweat drips down your forehead...", false), + (3, "Your heart beats out of your chest...", false), + (5, "Your lungs tighten up...", false), + (999, "You feel dizzy...", false) + }; + + while (true) + { + if (this.TargetPlayer == null) + { + Log.Info("Target player is null. Stopping CheckRooms coroutine."); + yield break; + } + + yield return Timing.WaitForSeconds(CHECK_INTERVAL); + + for (int i = 0; i < proximityAlerts.Count; i++) + { + var (distance, message, hasLogged) = proximityAlerts[i]; + + if (distance == 0 && this.TheHitman.CurrentRoom == this.TargetPlayer.CurrentRoom) + { + if (!hasLogged) + { + Log.Info(this.TargetPlayer + " " + message); + + ShowEffectHint(TargetPlayer, message); + ResetLogs(ref proximityAlerts); + proximityAlerts[i] = (distance, message, true); + } + break; + } + else if (distance == 999 && this.TheHitman.Zone == this.TargetPlayer.Zone) + { + if (!hasLogged) + { + ShowEffectHint(TargetPlayer, message); + Log.Info(this.TargetPlayer + " " + message); + ResetLogs(ref proximityAlerts); + proximityAlerts[i] = (distance, message, true); + } + break; + } + else if (AreRoomsWithinDepth(this.TheHitman, this.TargetPlayer, distance)) + { + if (!hasLogged) + { + ShowEffectHint(TargetPlayer, message); + Log.Info(this.TargetPlayer + " " + message); + ResetLogs(ref proximityAlerts); + proximityAlerts[i] = (distance, message, true); + } + break; + } + } + } + } + + private bool AreRoomsWithinDepth(Player p1, Player p2, int depth) + { + HashSet nearbyRooms = GetNearbyRooms(p1, depth); + return nearbyRooms.Contains(p2.CurrentRoom); + } + + private HashSet GetNearbyRooms(Player p, int depth) + { + HashSet rooms = new HashSet(p.CurrentRoom.NearestRooms); + for (int i = 0; i < depth; i++) + { + HashSet newRooms = new HashSet(rooms.SelectMany(r => r.NearestRooms)); + rooms.UnionWith(newRooms); + } + return rooms; + } + + // Reinitialise tous logs sauf celui qui vient d'être actiév + private void ResetLogs(ref List<(int distance, string message, bool hasLogged)> proximityAlerts) + { + for (int i = 0; i < proximityAlerts.Count; i++) + { + var (distance, message, _) = proximityAlerts[i]; + proximityAlerts[i] = (distance, message, false); + } + } + } +} diff --git a/KruacentExiled/KE.CustomRoles/CR/Human/Inverted.cs b/KruacentExiled/KE.CustomRoles/CR/Human/Inverted.cs new file mode 100644 index 00000000..54592544 --- /dev/null +++ b/KruacentExiled/KE.CustomRoles/CR/Human/Inverted.cs @@ -0,0 +1,37 @@ +using Exiled.API.Features.Attributes; +using Exiled.CustomRoles.API.Features; +using KE.CustomRoles.API.Features; +using MEC; +using PlayerRoles; +using Exiled.API.Features; +using UnityEngine; +using Exiled.API.Enums; + +namespace KE.CustomRoles.CR.Human +{ + [CustomRole(RoleTypeId.None)] + public class Inverted : GlobalCustomRole + { + public override SideEnum Side { get; set; } = SideEnum.Human; + public override string Description { get; set; } = "Tu as un talent assez exceptionnel !"; + public override uint Id { get; set; } = 1066; + public override string PublicName { get; set; } = "Inverted"; + public override bool KeepRoleOnDeath { get; set; } = true; + public override bool KeepRoleOnChangingRole { get; set; } = true; + + public override float SpawnChance { get; set; } = 100; + public override Vector3 Scale { get; set; } = new Vector3(1, 1, 1); + + protected override void RoleAdded(Player player) + { + player.Scale = new Vector3(1f, -1f, 1f); + player.EnableEffect(EffectType.Slowness, 200, 99999); + } + + protected override void RoleRemoved(Player player) + { + player.Scale = new Vector3(1f, 1f, 1f); + player.DisableEffect(EffectType.Slowness); + } + } +} \ No newline at end of file diff --git a/KruacentExiled/KE.CustomRoles/CR/Human/Maladroit.cs b/KruacentExiled/KE.CustomRoles/CR/Human/Maladroit.cs new file mode 100644 index 00000000..81ea4a7f --- /dev/null +++ b/KruacentExiled/KE.CustomRoles/CR/Human/Maladroit.cs @@ -0,0 +1,78 @@ +using Exiled.API.Enums; +using Exiled.API.Extensions; +using Exiled.API.Features; +using Exiled.API.Features.Attributes; +using Exiled.CustomRoles.API.Features; +using KE.CustomRoles.API.Features; +using MEC; +using PlayerRoles; +using System; +using System.Collections.Generic; +using System.Drawing.Design; +using System.Linq; +using UnityEngine; +using Utils.NonAllocLINQ; + +namespace KE.CustomRoles.CR.Human +{ + [CustomRole(RoleTypeId.None)] + internal class Maladroit : GlobalCustomRole + { + private static Dictionary _coroutines = new(); + + public override SideEnum Side { get; set; } = SideEnum.Human; + public override string Description { get; set; } = "Tu es maladroit\nFait attention à tes items !"; + public override uint Id { get; set; } = 1057; + public override string PublicName { get; set; } = "Maladroit"; + public override bool KeepRoleOnDeath { get; set; } = false; + public override bool KeepRoleOnChangingRole { get; set; } = true; + public override float SpawnChance { get; set; } = 100; + + protected override void RoleAdded(Player player) + { + _coroutines.Add(player, Timing.RunCoroutine(ThrowingItem(player))); + } + + protected override void RoleRemoved(Player player) + { + if (!_coroutines.ContainsKey(player)) return; + Timing.KillCoroutines(_coroutines[player]); + _coroutines.Remove(player); + } + + private IEnumerator ThrowingItem(Player p) + { + Dictionary ActionDictionnary = new() + { + { 50, () => p.DropHeldItem() }, + { 80, () => { /* Nothing */ } }, + { 95, () => DropItemFromInventory(p, 1) }, + { 100, () => DropItemFromInventory(p, 2) }, + }; + + + while (true) + { + yield return Timing.WaitForSeconds(UnityEngine.Random.Range(120f, 200f)); + int proba = UnityEngine.Random.Range(0, 101); + + foreach (var seuil in ActionDictionnary.Keys.OrderBy(p => p)) + { + if(proba < seuil) + { + ActionDictionnary[seuil](); + break; + } + } + } + } + + private void DropItemFromInventory(Player p, int number) + { + for(int i = 0; i <= number; i++) + { + p.DropItem(p.Items.GetRandomValue()); + } + } + } +} \ No newline at end of file diff --git a/KruacentExiled/KE.CustomRoles/CR/Human/Paper.cs b/KruacentExiled/KE.CustomRoles/CR/Human/Paper.cs new file mode 100644 index 00000000..8c866c72 --- /dev/null +++ b/KruacentExiled/KE.CustomRoles/CR/Human/Paper.cs @@ -0,0 +1,23 @@ +using Exiled.API.Features.Attributes; +using Exiled.CustomRoles.API.Features; +using KE.CustomRoles.API.Features; +using PlayerRoles; +using System.Collections.Generic; +using UnityEngine; + +namespace KE.CustomRoles.CR.Human +{ + [CustomRole(RoleTypeId.None)] + public class Paper : GlobalCustomRole + { + public override SideEnum Side { get; set; } = SideEnum.Human; + public override string Description { get; set; } = "Tu t'es fait roulé dessus !"; + public override uint Id { get; set; } = 1067; + public override string PublicName { get; set; } = "Paper"; + public override bool KeepRoleOnDeath { get; set; } = true; + public override bool KeepRoleOnChangingRole { get; set; } = true; + + public override float SpawnChance { get; set; } = 100; + public override Vector3 Scale { get; set; } = new Vector3(0.2f, 1, 1); + } +} \ No newline at end of file diff --git a/KruacentExiled/KE.CustomRoles/CR/Human/Paper2.cs b/KruacentExiled/KE.CustomRoles/CR/Human/Paper2.cs new file mode 100644 index 00000000..c531f4f2 --- /dev/null +++ b/KruacentExiled/KE.CustomRoles/CR/Human/Paper2.cs @@ -0,0 +1,23 @@ +using Exiled.API.Features.Attributes; +using Exiled.CustomRoles.API.Features; +using KE.CustomRoles.API.Features; +using PlayerRoles; +using System.Collections.Generic; +using UnityEngine; + +namespace KE.CustomRoles.CR.Human +{ + [CustomRole(RoleTypeId.None)] + public class Paper2 : GlobalCustomRole + { + public override SideEnum Side { get; set; } = SideEnum.Human; + public override string Description { get; set; } = "Tu t'es fait roulé dessus !"; + public override uint Id { get; set; } = 1067; + public override string PublicName { get; set; } = "Paper"; + public override bool KeepRoleOnDeath { get; set; } = true; + public override bool KeepRoleOnChangingRole { get; set; } = true; + + public override float SpawnChance { get; set; } = 100; + public override Vector3 Scale { get; set; } = new Vector3(0.2f, 1, 1); + } +} \ No newline at end of file diff --git a/KruacentExiled/KE.CustomRoles/CR/MTF/Pilot.cs b/KruacentExiled/KE.CustomRoles/CR/MTF/Pilot.cs new file mode 100644 index 00000000..ce3ad505 --- /dev/null +++ b/KruacentExiled/KE.CustomRoles/CR/MTF/Pilot.cs @@ -0,0 +1,50 @@ +using Exiled.API.Enums; +using Exiled.API.Features.Attributes; +using Exiled.CustomRoles.API.Features; +using KE.CustomRoles.Abilities; +using KE.CustomRoles.API.Features; +using PlayerRoles; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace KE.CustomRoles.CR.MTF +{ + [CustomRole(RoleTypeId.NtfPrivate)] + public class Pilot : KECustomRole + { + public override string Description { get; set; } = "So I haveth a Laser Pointere"; + public override uint Id { get; set; } = 1088; + public override string PublicName { get; set; } = "Pilot"; + public override int MaxHealth { get; set; } = 75; + public override RoleTypeId Role { get; set; } = RoleTypeId.NtfPrivate; + public override bool KeepRoleOnDeath { get; set; } = false; + public override bool KeepRoleOnChangingRole { get; set; } = false; + + public override float SpawnChance { get; set; } = 100; + + public override List Inventory { get; set; } = new List() + { + $"{ItemType.GunCrossvec}", + $"{ItemType.KeycardMTFOperative}", + $"{ItemType.Radio}", + $"{ItemType.ArmorCombat}", + $"{ItemType.Medkit}" + }; + + public override Dictionary Ammo { get; set; } = new Dictionary() + { + { AmmoType.Nato9, 100} + }; + + public override HashSet Abilities { get; } = new() + { + 2000, + 2001 + }; + + + } +} diff --git a/KruacentExiled/KE.CustomRoles/CR/MTF/Tank.cs b/KruacentExiled/KE.CustomRoles/CR/MTF/Tank.cs new file mode 100644 index 00000000..d2866003 --- /dev/null +++ b/KruacentExiled/KE.CustomRoles/CR/MTF/Tank.cs @@ -0,0 +1,81 @@ +using Exiled.API.Enums; +using Exiled.API.Features.Attributes; +using Player = Exiled.Events.Handlers.Player; +using Exiled.Events.EventArgs.Player; +using MEC; +using PlayerRoles; +using System.Collections.Generic; +using UnityEngine; +using System; +using KE.CustomRoles.API.Features; + +namespace KE.CustomRoles.CR.MTF +{ + [CustomRole(RoleTypeId.NtfCaptain)] + internal class Tank : KECustomRole + { + public override string Description { get; set; } = "Tu es un TANK tu es débuff mais ta force de tir est démultiplié (fait attention à tes balles)"; + public override uint Id { get; set; } = 1051; + public override string PublicName { get; set; } = "Tank"; + public override int MaxHealth { get; set; } = 200; + public override RoleTypeId Role { get; set; } = RoleTypeId.NtfCaptain; + public override bool KeepRoleOnDeath { get; set; } = false; + public override bool KeepRoleOnChangingRole { get; set; } = false; + + public override float SpawnChance { get; set; } = 100; + public override Vector3 Scale { get; set; } = new Vector3(1.15f, 1f, 1.15f); + + public override List Inventory { get; set; } = new List() + { + $"{ItemType.GunLogicer}", + $"{ItemType.GunFRMG0}", + $"{ItemType.Radio}", + $"{ItemType.GrenadeHE}", + $"{ItemType.Adrenaline}", + $"{ItemType.KeycardMTFCaptain}", + $"{ItemType.Painkillers}", + $"{ItemType.ArmorHeavy}" + }; + + public override Dictionary Ammo { get; set; } = new Dictionary() + { + { AmmoType.Nato762, 200}, + { AmmoType.Nato556, 200} + }; + + protected override void SubscribeEvents() + { + Player.Shooting += Shooting; + base.SubscribeEvents(); + } + + /// + protected override void UnsubscribeEvents() + { + Player.Shooting -= Shooting; + base.UnsubscribeEvents(); + } + + private void Shooting(ShootingEventArgs ev) + { + Timing.CallDelayed(0.5f, () => + { + Timing.RunCoroutine(EffectAttribution(ev.Player)); + }); + } + + private IEnumerator EffectAttribution(Exiled.API.Features.Player player) + { + int nbMunition = player.GetAmmo(AmmoType.Nato762) / 100; + byte nbMunitionByte = (byte)nbMunition; + + if (UnityEngine.Random.Range(0, 1) > 0.5f) + { + player.DisableEffect(EffectType.Slowness); + player.EnableEffect(EffectType.Slowness, nbMunitionByte, 99999, false); + } + + yield return 0; + } + } +} diff --git a/KruacentExiled/KE.CustomRoles/CR/MTF/Terroriste.cs b/KruacentExiled/KE.CustomRoles/CR/MTF/Terroriste.cs new file mode 100644 index 00000000..d89aed2e --- /dev/null +++ b/KruacentExiled/KE.CustomRoles/CR/MTF/Terroriste.cs @@ -0,0 +1,44 @@ +using Exiled.API.Enums; +using Exiled.API.Features.Attributes; +using KE.CustomRoles.API.Features; +using PlayerRoles; +using System.Collections.Generic; +using UnityEngine; + +namespace KE.CustomRoles.CR.MTF +{ + [CustomRole(RoleTypeId.NtfSergeant)] + internal class Terroriste : KECustomRole + { + public override string Description { get; set; } = "Tu es un Terroriste \nne fait pas exploser la facilité \ntu commences avec des grenades"; + public override uint Id { get; set; } = 1052; + public override string PublicName { get; set; } = "Terroriste"; + public override int MaxHealth { get; set; } = 100; + public override RoleTypeId Role { get; set; } = RoleTypeId.NtfSergeant; + public override bool KeepRoleOnDeath { get; set; } = false; + public override bool KeepRoleOnChangingRole { get; set; } = false; + + public override float SpawnChance { get; set; } = 100; + public override List Inventory { get; set; } = new List() + { + $"{ItemType.GrenadeHE}", + $"{ItemType.GrenadeHE}", + $"{ItemType.GrenadeHE}", + $"{ItemType.GrenadeHE}", + $"{ItemType.GunE11SR}", + $"{ItemType.Adrenaline}", + $"{ItemType.KeycardMTFOperative}", + $"{ItemType.Radio}" + }; + + public override Dictionary Ammo { get; set; } = new Dictionary() + { + { AmmoType.Nato556, 100} + }; + + public override HashSet Abilities { get; } = new() + { + 2007 + }; + } +} diff --git a/KruacentExiled/KE.CustomRoles/CR/SCP/Paper.cs b/KruacentExiled/KE.CustomRoles/CR/SCP/Paper.cs new file mode 100644 index 00000000..2e42feee --- /dev/null +++ b/KruacentExiled/KE.CustomRoles/CR/SCP/Paper.cs @@ -0,0 +1,21 @@ +using Exiled.API.Features.Attributes; +using KE.CustomRoles.API.Features; +using PlayerRoles; +using UnityEngine; + +namespace KE.CustomRoles.CR.SCP +{ + [CustomRole(RoleTypeId.None)] + public class Paper : GlobalCustomRole + { + public override string Description { get; set; } = "uh oh. paper jam"; + public override uint Id { get; set; } = 1047; + public override SideEnum Side { get; set; } = SideEnum.SCP; + public override string PublicName { get; set; } = "Paper"; + public override bool KeepRoleOnDeath { get; set; } = false; + public override bool KeepRoleOnChangingRole { get; set; } = false; + + public override float SpawnChance { get; set; } = 100; + public override Vector3 Scale { get; set; } = new Vector3(0.1f, 1, 1); + } +} diff --git a/KruacentExiled/KE.CustomRoles/CR/SCP/SCP457.cs b/KruacentExiled/KE.CustomRoles/CR/SCP/SCP457.cs new file mode 100644 index 00000000..b37d0f90 --- /dev/null +++ b/KruacentExiled/KE.CustomRoles/CR/SCP/SCP457.cs @@ -0,0 +1,250 @@ +using Exiled.API.Features; +using Exiled.API.Features.Attributes; +using Exiled.API.Features.Doors; +using Exiled.API.Features.Roles; +using Exiled.API.Features.Toys; +using Exiled.API.Interfaces; +using Exiled.Events.EventArgs.Scp106; +using KE.CustomRoles.API.Features; +using KE.Utils.API; +using MEC; +using PlayerRoles; +using PlayerStatsSystem; +using System.Collections.Generic; +using System.Linq; +using UnityEngine; +using Light = Exiled.API.Features.Toys.Light; + +namespace KE.CustomRoles.CR.SCP +{ + [CustomRole(RoleTypeId.Scp106)] + public class SCP457 : CustomSCP + { + + + public override string Description { get; set; } = "You passive damage around you, and can lauch fireballs by pressing the stalk button"; + public override uint Id { get; set; } = 1084; + public override string PublicName { get; set; } = "SCP-457"; + public override int MaxHealth { get; set; } = 3900; + public override RoleTypeId Role { get; set; } = RoleTypeId.Scp106; + public override bool KeepRoleOnDeath { get; set; } = false; + public override bool KeepRoleOnChangingRole { get; set; } = false; + public override bool IsSupport { get; } = false; + + public override float SpawnChance { get; set; } = 100; + + private Dictionary _inside = new(); + private Dictionary> _handles = new(); + private Dictionary _activeBalls = new(); + + public static float DamageRefreshRate = 5f; + public static readonly Color FlameColor = new(2, 1.08f, 0); + private static readonly Color ballColor = new(2, 1.08f, 0, .25f); + public static readonly float VigorCost = .1f; + + private static readonly string _deathMessage = "Burned to death"; + public static CustomReasonDamageHandler BallDamage = new(_deathMessage, 25, string.Empty); + public const int MAX_BALLS = 2; + + protected override void RoleAdded(Player player) + { + Log.Debug("adding role 457"); + _inside.Add(player, null); + _handles.Add(player, new()); + _activeBalls.Add(player, 0); + + _handles[player].Add(Timing.RunCoroutine(InsideLight(player))); + _handles[player].Add(Timing.RunCoroutine(PassiveDamage(player))); + + } + + private IEnumerator InsideLight(Player player) + { + Light light = Light.Create(); + _inside[player] = light; + light.Position = player.Position; + light.Color = FlameColor; + light.Spawn(); + while (true) + { + light.Position = player.Position; + PassiveDamage(player); + yield return Timing.WaitForOneFrame; + } + } + + + + private IEnumerator PassiveDamage(Player scp) + { + while (true) + { + foreach (Player allP in Player.List.Where(p => p != scp && !p.IsScp)) + { + + + if (OtherUtils.IsInCircle(allP.Position, scp.Position, 5)) + { + + Physics.Linecast(allP.Position, scp.Position, out var hitinfo); + float damage = -(hitinfo.distance / 3) + 10; + Log.Debug($"damâge={damage} dist = {hitinfo.distance}"); + allP.EnableEffect(Exiled.API.Enums.EffectType.Burned, DamageRefreshRate, true); + allP.Hurt(damage, _deathMessage); + + + } + } + yield return Timing.WaitForSeconds(DamageRefreshRate); + } + + } + + protected override void RoleRemoved(Player player) + { + Log.Debug("remove role 457"); + + + if (_inside.TryGetValue(player, out var l)) + { + l.Destroy(); + _inside.Remove(player); + } + + if (_activeBalls.TryGetValue(player, out var b)) + { + _activeBalls.Remove(player); + } + + + + + + if (_handles.TryGetValue(player, out var handle)) + { + foreach (var c in handle) + { + Timing.KillCoroutines(c); + } + _handles.Remove(player); + } + + } + + private void Attack(Player player, Scp106Role role) + { + + if (role.Vigor > VigorCost && _activeBalls[player] < MAX_BALLS) + { + _activeBalls[player]++; + Timing.RunCoroutine(LaunchingAttack(player)); + role.Vigor -= VigorCost; + } + + } + + private IEnumerator LaunchingAttack(Player player) + { + Vector3 initpos = player.Position; + Quaternion direction = player.ReferenceHub.PlayerCameraReference.rotation; + + + Log.Debug(direction.eulerAngles); + bool attackTouchedSomething = false; + + Light light = Light.Create(initpos, direction.eulerAngles,null,false); + light.Color = ballColor; + light.Intensity = 1f; + Primitive primitive = Primitive.Create(initpos, direction.eulerAngles, null, false); + primitive.Collidable = false; + primitive.Color = ballColor; + primitive.Spawn(); + light.Spawn(); + Vector3 nextPos; + + int fallback = 100; + while (!attackTouchedSomething && fallback > 0) + { + nextPos = primitive.Position + primitive.Rotation * new Vector3(0, 0, 1f); + RaycastHit hit; + + if (Physics.Linecast(primitive.Position, nextPos, out hit)) + { + //spawn mtf looking at central gate + if (hit.collider.gameObject.name != "VolumeOverrideTunnel") + { + attackTouchedSomething = true; + } + + Player playerhit = Player.Get(hit.collider); + if (playerhit != null && playerhit.Role.Side != Exiled.API.Enums.Side.Scp) + { + playerhit.Hurt(BallDamage); + player.ShowHitMarker(); + + } + + Door doorhit = Door.Get(hit.collider.gameObject); + if (doorhit != null && doorhit is IDamageableDoor damageable && !damageable.IsDestroyed) + { + damageable.Break(); + player.ShowHitMarker(); + } + } + + + + + Log.Debug($"current pos = {primitive.Position} next pos = {nextPos}"); + yield return Timing.WaitForSeconds(.1f); + primitive.Position = nextPos; + light.Position = nextPos; + fallback--; + } + _activeBalls[player]--; + primitive.Destroy(); + light.Destroy(); + } + + + private void OnStalking(StalkingEventArgs ev) + { + if (!Check(ev.Player)) return; + ev.IsAllowed = false; + + Attack(ev.Player, ev.Scp106); + } + + private void OnTP(TeleportingEventArgs ev) + { + if (!Check(ev.Player)) return; + ev.IsAllowed = false; + + } + + private void OnAttacking(AttackingEventArgs ev) + { + if (!Check(ev.Player)) return; + ev.IsAllowed = false; + + } + + protected override void SubscribeEvents() + { + Exiled.Events.Handlers.Scp106.Stalking += OnStalking; + Exiled.Events.Handlers.Scp106.Teleporting += OnTP; + Exiled.Events.Handlers.Scp106.Attacking += OnAttacking; + base.SubscribeEvents(); + + } + + protected override void UnsubscribeEvents() + { + Exiled.Events.Handlers.Scp106.Stalking -= OnStalking; + Exiled.Events.Handlers.Scp106.Teleporting -= OnTP; + Exiled.Events.Handlers.Scp106.Attacking -= OnAttacking; + base.UnsubscribeEvents(); + } + + } +} diff --git a/KruacentExiled/KE.CustomRoles/CR/SCP/Small.cs b/KruacentExiled/KE.CustomRoles/CR/SCP/Small.cs new file mode 100644 index 00000000..019eb568 --- /dev/null +++ b/KruacentExiled/KE.CustomRoles/CR/SCP/Small.cs @@ -0,0 +1,22 @@ +using Exiled.API.Features.Attributes; +using Exiled.CustomRoles.API.Features; +using KE.CustomRoles.API.Features; +using PlayerRoles; +using UnityEngine; + +namespace KE.CustomRoles.CR.SCP +{ + [CustomRole(RoleTypeId.None)] + public class Small : GlobalCustomRole + { + public override string Description { get; set; } = "u smoll"; + public override uint Id { get; set; } = 1047; + public override SideEnum Side { get; set; } = SideEnum.SCP; + public override string PublicName { get; set; } = "Small"; + public override bool KeepRoleOnDeath { get; set; } = false; + public override bool KeepRoleOnChangingRole { get; set; } = false; + + public override float SpawnChance { get; set; } = 100; + public override Vector3 Scale { get; set; } = new Vector3(1, .75f, 1); + } +} diff --git a/KruacentExiled/KE.CustomRoles/CR/SCP/Tall.cs b/KruacentExiled/KE.CustomRoles/CR/SCP/Tall.cs new file mode 100644 index 00000000..9bcee936 --- /dev/null +++ b/KruacentExiled/KE.CustomRoles/CR/SCP/Tall.cs @@ -0,0 +1,35 @@ +using Exiled.API.Features; +using Exiled.API.Features.Attributes; +using KE.CustomRoles.API.Features; +using PlayerRoles; +using System.Linq; +using UnityEngine; + +namespace KE.CustomRoles.CR.SCP +{ + /*[CustomRole(RoleTypeId.None)] + public class Tall : GlobalCustomRole + { + public override string Description { get; set; } = "u tall"; + public override uint Id { get; set; } = 1049; + public override string PublicName { get; set; } = "Tall"; + public override bool KeepRoleOnDeath { get; set; } = false; + public override bool KeepRoleOnChangingRole { get; set; } = false; + public override float MaxHealthMultiplicator { get; set; } = 1.1f; + public override float SpawnChance { get; set; } = 100; + public override SideEnum Side { get; set; } = SideEnum.SCP; + public new Vector3 Scale { get; set; } = new(1, 1.3f, 1); + public Vector3 BaseScale => Vector3.one; + protected override void RoleAdded(Player player) + { + player.SetFakeScale(Scale, Player.List.Where(p => p != player)); + + + } + + protected override void RoleRemoved(Player player) + { + player.SetFakeScale(BaseScale, Player.List.Where(p => p != player)); + } + }*/ +} diff --git a/KruacentExiled/KE.CustomRoles/CR/SCP/Ultra.cs b/KruacentExiled/KE.CustomRoles/CR/SCP/Ultra.cs new file mode 100644 index 00000000..8be0a51e --- /dev/null +++ b/KruacentExiled/KE.CustomRoles/CR/SCP/Ultra.cs @@ -0,0 +1,73 @@ +using Exiled.API.Enums; +using Exiled.API.Features; +using Exiled.API.Features.Attributes; +using KE.CustomRoles.API.Features; +using MEC; +using PlayerRoles; +using System; +using System.Collections.Generic; +using System.Linq; + +namespace KE.CustomRoles.CR.SCP +{ + [CustomRole(RoleTypeId.None)] + public class Ultra : GlobalCustomRole + { + private static Dictionary _handles = new(); + public override SideEnum Side { get; set; } = SideEnum.SCP; + public override string Description { get; set; } = "You can sense where people are located"; + public override uint Id { get; set; } = 1079; + public override string PublicName { get; set; } = "Ultra"; + public override bool KeepRoleOnDeath { get; set; } = false; + public override bool KeepRoleOnChangingRole { get; set; } = false; + public override float MaxHealthMultiplicator { get; set; } = 1f; + public override float SpawnChance { get; set; } = 100; + public const float RefreshRate = 20; + public const int SizeText = 20; + protected override void RoleAdded(Player player) + { + _handles.Add(player, Timing.RunCoroutine(DisplayInfos(player))); + } + + protected override void RoleRemoved(Player player) + { + Timing.KillCoroutines(_handles[player]); + _handles.Remove(player); + } + + + + private IEnumerator DisplayInfos(Player player) + { + + while (true) + { + Log.Debug("Ultra : showing"); + ShowEffectHint(player, PlayerInZone()); + yield return Timing.WaitForSeconds(RefreshRate); + } + } + + + private string PlayerInZone() + { + string result = $""; + int nbPlayer; + foreach (ZoneType zone in Enum.GetValues(typeof(ZoneType))) + { + nbPlayer = GetPlayerInZone(zone); + if (nbPlayer > 0 || MainPlugin.Instance.Config.Debug) + { + result += zone.ToString() + " : " + nbPlayer + "\n"; + } + } + result += ""; + return result; + } + + private int GetPlayerInZone(ZoneType zone) + { + return Player.List.Count(p => !p.IsScp && p.Zone == zone); + } + } +} diff --git a/KruacentExiled/KE.CustomRoles/CR/SCP/ZombieDoorman.cs b/KruacentExiled/KE.CustomRoles/CR/SCP/ZombieDoorman.cs new file mode 100644 index 00000000..f02f6d92 --- /dev/null +++ b/KruacentExiled/KE.CustomRoles/CR/SCP/ZombieDoorman.cs @@ -0,0 +1,40 @@ +using Exiled.API.Features; +using Exiled.API.Features.Attributes; +using Exiled.CustomRoles.API.Features; +using KE.CustomRoles.Abilities; +using PlayerRoles; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace KE.CustomRoles.CR.SCP +{ + [CustomRole(RoleTypeId.Scp0492)] + internal class ZombieDoorman : CustomRole + { + public override string Name { get; set; } = "SCP-049-2-Door"; + public override string Description { get; set; } = "U can open lock door with ur ability clapclapclap"; + public override uint Id { get; set; } = 1053; + public override string CustomInfo { get; set; } = "SCP-049-2-Door"; + public override int MaxHealth { get; set; } = 400; + public override RoleTypeId Role { get; set; } = RoleTypeId.Scp0492; + public override bool KeepRoleOnDeath { get; set; } = false; + public override bool KeepRoleOnChangingRole { get; set; } = false; + public override bool IgnoreSpawnSystem { get; set; } = true; + + public override float SpawnChance { get; set; } = 100; + + + protected override void RoleAdded(Player player) + { + Log.Debug("adding 0493dror"); + } + + protected override void RoleRemoved(Player player) + { + Log.Debug("removing 0493dror"); + } + } +} diff --git a/KruacentExiled/KE.CustomRoles/CR/Scientist/GambleAddict.cs b/KruacentExiled/KE.CustomRoles/CR/Scientist/GambleAddict.cs new file mode 100644 index 00000000..65503a3f --- /dev/null +++ b/KruacentExiled/KE.CustomRoles/CR/Scientist/GambleAddict.cs @@ -0,0 +1,36 @@ +using Exiled.API.Features.Attributes; +using Exiled.CustomRoles.API.Features; +using KE.CustomRoles.Abilities; +using KE.CustomRoles.API.Features; +using PlayerRoles; +using System; +using System.Collections.Generic; +using UnityEngine; + +namespace KE.CustomRoles.CR.Scientist +{ + [CustomRole(RoleTypeId.Scientist)] + public class GambleAddict : KECustomRole + { + public override string Description { get; set; } = "Tu es un Gamble Addict \nT'as trade ton kit et ta carte contre 2 pièces \nfais en bon usage"; + public override uint Id { get; set; } = 1043; + public override string PublicName { get; set; } = "Gamble Addict"; + public override int MaxHealth { get; set; } = 100; + public override RoleTypeId Role { get; set; } = RoleTypeId.Scientist; + public override bool KeepRoleOnDeath { get; set; } = false; + public override bool KeepRoleOnChangingRole { get; set; } = false; + + public override float SpawnChance { get; set; } = 100; + + public override List Inventory { get; set; } = new List() + { + $"{ItemType.Coin}", + $"{ItemType.Coin}", + }; + + public override HashSet Abilities { get; } = new() + { + 2002 + }; + } +} diff --git a/KruacentExiled/KE.CustomRoles/CR/Scientist/ZoneManager.cs b/KruacentExiled/KE.CustomRoles/CR/Scientist/ZoneManager.cs new file mode 100644 index 00000000..b14f6789 --- /dev/null +++ b/KruacentExiled/KE.CustomRoles/CR/Scientist/ZoneManager.cs @@ -0,0 +1,119 @@ +using Exiled.API.Enums; +using Exiled.API.Features; +using Exiled.API.Features.Attributes; +using Exiled.API.Features.Doors; +using Exiled.API.Features.Items; +using Exiled.API.Features.Spawn; +using Exiled.Events.EventArgs.Player; +using InventorySystem.Items.Keycards; +using KE.CustomRoles.API.Features; +using PlayerRoles; +using System.Collections.Generic; +using System.Linq; +using UnityEngine; + +namespace KE.CustomRoles.CR.Scientist +{ + [CustomRole(RoleTypeId.Scientist)] + internal class ZoneManager : KECustomRole + { + public override string Description { get; set; } = "Incroyable tu peux avoir une promotion alors fais ton boulot et ouvre tous ces checkpoint et tu pourras sortir d'ici"; + public override uint Id { get; set; } = 1044; + public override string PublicName { get; set; } = "Zone Manager"; + public override int MaxHealth { get; set; } = 100; + public override RoleTypeId Role { get; set; } = RoleTypeId.Scientist; + public override bool KeepRoleOnDeath { get; set; } = false; + public override bool KeepRoleOnChangingRole { get; set; } = false; + + + public override float SpawnChance { get; set; } = 100; + + public override SpawnProperties SpawnProperties { get; set; } = new SpawnProperties() + { + DynamicSpawnPoints = new List() + { + new DynamicSpawnPoint() + { + Location = SpawnLocationType.InsideHidLab, + Chance = 100, + } + } + }; + + public override List Inventory { get; set; } = new List() + { + $"{ItemType.Medkit}", + $"{ItemType.Adrenaline}", + $"{ItemType.KeycardZoneManager}" + }; + public static readonly List DoorToOpen = new() + { + DoorType.CheckpointLczA, + DoorType.CheckpointLczB, + DoorType.CheckpointEzHczA, + DoorType.CheckpointEzHczB + }; + + + private static Dictionary> objectives = new(); + private static Dictionary flag = new(); + + protected override void SubscribeEvents() + { + + Exiled.Events.Handlers.Player.InteractingDoor += OnInteractingDoor; + base.SubscribeEvents(); + } + + protected override void UnsubscribeEvents() + { + Exiled.Events.Handlers.Player.InteractingDoor -= OnInteractingDoor; + base.UnsubscribeEvents(); + } + + protected override void RoleAdded(Player player) + { + objectives.Add(player, new(DoorToOpen)); + flag.Add(player, false); + } + protected override void RoleRemoved(Player player) + { + objectives.Remove(player); + flag.Remove(player); + } + + + private void OnInteractingDoor(InteractingDoorEventArgs ev) + { + Player player = ev.Player; + if (!Check(player)) return; + objectives[player].Remove(ev.Door.Type); + + if (CheckDoors(player)) + { + bool equipped = player.CurrentItem.Type == ItemType.KeycardFacilityManager; + Item zoneKeycard = player.Items.Where(p => p.Type == ItemType.KeycardFacilityManager).ElementAtOrDefault(0); + if (zoneKeycard != null) + { + zoneKeycard.Destroy(); + } + + player.AddItem(ItemType.Radio); + flag[player] = true; + Item engineerKeycard = player.AddItem(ItemType.KeycardFacilityManager); + if (equipped) + { + player.CurrentItem = engineerKeycard; + } + } + + } + + private bool CheckDoors(Player p) + { + if (flag[p]) return false; + return objectives[p].Count == 0; + } + + } +} diff --git a/KruacentExiled/KE.CustomRoles/Config.cs b/KruacentExiled/KE.CustomRoles/Config.cs new file mode 100644 index 00000000..49e36023 --- /dev/null +++ b/KruacentExiled/KE.CustomRoles/Config.cs @@ -0,0 +1,18 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Exiled.API.Interfaces; + +namespace KE.CustomRoles +{ + public class Config : IConfig + { + public bool IsEnabled { get; set; } = true; + public bool Debug { get; set; } = true; + + public int HeaderId { get; set; } = 1000; + public int ScpPreferenceHeaderId { get; set; } = 10000; + } +} diff --git a/KruacentExiled/KE.CustomRoles/KE.CustomRoles.csproj b/KruacentExiled/KE.CustomRoles/KE.CustomRoles.csproj new file mode 100644 index 00000000..a96f8fbc --- /dev/null +++ b/KruacentExiled/KE.CustomRoles/KE.CustomRoles.csproj @@ -0,0 +1,34 @@ + + + 13.0 + net48 + + + + + + + + + + + + + + + + + + + + + + + + if not "$(EXILED_DEV_REFERENCES)"=="" copy /y "$(OutputPath)$(AssemblyName).dll" "$(EXILED_DEV_REFERENCES)\Plugins\" + + + if [[ ! -z "$EXILED_DEV_REFERENCES" ]]; then cp "$(OutputPath)$(AssemblyName).dll" "$EXILED_DEV_REFERENCES/Plugins/"; fi + + + diff --git a/KruacentExiled/KE.CustomRoles/MainPlugin.cs b/KruacentExiled/KE.CustomRoles/MainPlugin.cs new file mode 100644 index 00000000..2487ef26 --- /dev/null +++ b/KruacentExiled/KE.CustomRoles/MainPlugin.cs @@ -0,0 +1,87 @@ +using Exiled.API.Features; +using Exiled.API.Features.Core.UserSettings; +using Exiled.API.Interfaces; +using Exiled.CustomRoles.API.Features; +using Exiled.Events.EventArgs.Server; +using HarmonyLib; +using KE.CustomRoles.API.Features; +using KE.CustomRoles.Settings; +using KE.Utils.API.Displays.DisplayMeow; +using MEC; +using Microsoft.Win32; +using System; +using System.Linq; + + +namespace KE.CustomRoles +{ + public class MainPlugin : Plugin + { + public override string Name => "KE.CustomRoles"; + public override string Prefix => "KE.CR"; + public override string Author => "Patrique & OmerGS"; + public override Version Version => new(1, 1, 0); + public static MainPlugin Instance; + public static Config Configs => Instance?.Config; + public static readonly HintPlacement CRHint = new(0, 750); + public static readonly HintPlacement CREffect = new(700, 300); + public static readonly HintPlacement Abilities = new(0, 950,HintServiceMeow.Core.Enum.HintAlignment.Left); + public static Translations Translations => Instance?.Translation; + private SettingHandler _settingHandler; + internal static SettingHandler SettingHandler => Instance?._settingHandler; + + private Harmony Harmony; + + public override void OnEnabled() + { + + Instance = this; + _settingHandler = new(); + + Harmony = new(Name); + Harmony.PatchAll(); + SettingHandler.SubscribeEvents(); + KEAbilities.Register(Assembly); + CustomRole.RegisterRoles(false,null,true,Assembly); + SubscribeEvents(); + + } + + public override void OnDisabled() + { + + CustomRole.UnregisterRoles(); + SettingHandler.UnsubscribeEvents(); + Harmony.UnpatchAll(); + + CustomAbility.UnregisterAbilities(); + KEAbilities.Unregister(); + UnsubscribeEvents(); + _settingHandler = null; + Instance = null; + } + + public void SubscribeEvents() + { + Exiled.Events.Handlers.Server.RoundStarted += CustomRoleImplement; + Exiled.Events.Handlers.Server.RespawnedTeam += CustomRoleRespawning; + } + public void UnsubscribeEvents() + { + Exiled.Events.Handlers.Server.RoundStarted -= CustomRoleImplement; + Exiled.Events.Handlers.Server.RespawnedTeam -= CustomRoleRespawning; + + } + + public void CustomRoleImplement() + { + KECustomRole.GiveRole(Player.List); + + } + + public void CustomRoleRespawning(RespawnedTeamEventArgs ev) + { + KECustomRole.GiveRole(ev.Players); + } + } +} diff --git a/KruacentExiled/KE.CustomRoles/Patches/ActiveAbilityPatches.cs b/KruacentExiled/KE.CustomRoles/Patches/ActiveAbilityPatches.cs new file mode 100644 index 00000000..7a717da6 --- /dev/null +++ b/KruacentExiled/KE.CustomRoles/Patches/ActiveAbilityPatches.cs @@ -0,0 +1,39 @@ +using Exiled.API.Features; +using Exiled.CustomRoles.API.Features; +using HarmonyLib; +using KE.Utils.API.Displays.DisplayMeow; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace KE.CustomRoles.Patches +{ + public static class ActiveAbilityPatches + { + [HarmonyPatch(typeof(ActiveAbility),nameof(ActiveAbility.UseAbility))] + public static class UseAbilityPatch + { + public static void Prefix(ActiveAbility __instance, Player player) + { + string msg = "Using "+__instance.Name; + + DisplayHandler.Instance.AddHint(MainPlugin.Abilities, player, msg, 5); + } + } + [HarmonyPatch(typeof(ActiveAbility), nameof(ActiveAbility.SelectAbility))] + public static class SelectAbilityPatch + { + public static void Prefix(ActiveAbility __instance, Player player) + { + string msg = __instance.Name + "\n" + __instance.Description; + + DisplayHandler.Instance.AddHint(MainPlugin.Abilities, player, msg, 5); + } + } + + + + } +} diff --git a/KruacentExiled/KE.CustomRoles/Patches/FpcMotorPatches.cs b/KruacentExiled/KE.CustomRoles/Patches/FpcMotorPatches.cs new file mode 100644 index 00000000..59e4c427 --- /dev/null +++ b/KruacentExiled/KE.CustomRoles/Patches/FpcMotorPatches.cs @@ -0,0 +1,41 @@ +using HarmonyLib; +using PlayerRoles.FirstPersonControl; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using UnityEngine; + +namespace KE.CustomRoles.Patches +{ + public static class FpcMotorPatches + { + //me when slowness 200 + + //[HarmonyPatch(typeof(FpcMotor),nameof(FpcMotor.DesiredMove),MethodType.Getter)] + public static class DesiredMovePatch + { + [HarmonyPostfix] + public static void Postfix(FpcMotor __instance,ref Vector3 __result) + { + __result = new(__result.x * -1, __result.y, __result.z * -1); + } + + + } + + //[HarmonyPatch(typeof(FpcMotor), nameof(FpcMotor.GetFrameMove), MethodType.Normal)] + public static class GetFrameMovePatch + { + [HarmonyPostfix] + public static void Postfix(FpcMotor __instance, ref Vector3 __result) + { + __result = new(__result.x * -1, __result.y, __result.z * -1); + } + + + } + + } +} diff --git a/KruacentExiled/KE.CustomRoles/Settings/SettingHandler.cs b/KruacentExiled/KE.CustomRoles/Settings/SettingHandler.cs new file mode 100644 index 00000000..1088088b --- /dev/null +++ b/KruacentExiled/KE.CustomRoles/Settings/SettingHandler.cs @@ -0,0 +1,230 @@ +using Exiled.API.Features; +using Exiled.API.Features.Core.UserSettings; +using Exiled.Events.EventArgs.Player; +using KE.CustomRoles.API.Features; +using KE.Utils.API.Interfaces; +using System; +using System.Collections.Generic; +using UserSettings.ServerSpecific; + +namespace KE.CustomRoles.Settings +{ + internal class SettingHandler : IUsingEvents + { + private int _idHeader = 148; + private int _idTimeCustomRole = 144; + private int _idDesc = 143; + private int _idMode = 145; + private int _idDown = 149; + private int _idUp = 150; + private int _idSelect = 151; + private int _idArrow = 152; + + + + public static event Action DownPressed = delegate { }; + public static event Action UpPressed = delegate { }; + + public static SettingHandler Instance { get; private set; } + private List settings; + public const string baseArrow = "<--"; + public SettingHandler() + { + Instance = this; + settings = new List() + { + new HeaderSetting (_idHeader,"Custom Roles Settings"), + new TwoButtonsSetting(_idDesc,"Descriptions","Disabled","Enabled",true,"hide/show the description the Custom Role "), + new SliderSetting(_idTimeCustomRole,"Time shown",0,30,20), + new TwoButtonsSetting(_idMode,"Mode","Keybinds","Select wheel",true,onChanged:OnChanged), + new KeybindSetting(_idUp, "Select up", UnityEngine.KeyCode.None,hintDescription:"only work in Select Wheel mode"), + new KeybindSetting(_idDown, "Select down", UnityEngine.KeyCode.None,hintDescription:"only work in Select Wheel mode"), + new KeybindSetting(_idSelect, "Use selected ability", UnityEngine.KeyCode.None,hintDescription:"only work in Select Wheel mode"), + //this crashes the player idk why + //new UserTextInputSetting(_idArrow, "Personalize the arrow next to the selected ability",hintDescription:"only work in Select Wheel mode",placeHolder:baseArrow,onChanged:OnChangedArrow), + }; + } + + public void OnChanged(Player player, SettingBase setting) + { + + try + { + if (GetMode(player)) + { + KEAbilities.RemoveAllSelect(player); + } + else + { + KEAbilities.SelectFirstAbility(player); + } + } + catch(Exception e) + { + Log.Error(e); + } + + + } + + public void OnChangedArrow(Player player, SettingBase setting) + { + KEAbilities.UpdateGUI(player); + } + + public void SubscribeEvents() + { + SettingBase.Register(settings); + ServerSpecificSettingsSync.ServerOnSettingValueReceived += SafeOnSettingValueReceived; + Exiled.Events.Handlers.Player.Verified += OnVerified; + DownPressed += Down; + UpPressed += Up; + + } + + public void UnsubscribeEvents() + { + Exiled.Events.Handlers.Player.Verified -= OnVerified; + ServerSpecificSettingsSync.ServerOnSettingValueReceived -= SafeOnSettingValueReceived; + DownPressed -= Down; + UpPressed -= Up; + SettingBase.Unregister(predicate:null, settings); + } + + + private void SafeOnSettingValueReceived(ReferenceHub hub, ServerSpecificSettingBase settingBase) + { + //not catching the exception will desync & kick the player + try + { + OnSettingValueReceived(Player.Get(hub), settingBase); + } + catch (Exception e) + { + Log.Error(e); + } + } + + private void OnSettingValueReceived(Player player, ServerSpecificSettingBase settingBase) + { + if (KEAbilities.CheckPressed(settingBase, _idDown)) + { + DownPressed?.Invoke(player); + } + + if (KEAbilities.CheckPressed(settingBase, _idUp)) + { + UpPressed?.Invoke(player); + } + + if (KEAbilities.CheckPressed(settingBase, _idSelect)) + { + KEAbilities.UseSelected(player); + } + + } + + private Dictionary playerPos = new(); + + private void Up(Player player) + { + if(KEAbilities.PlayersAbility.TryGetValue(player,out var list)) + { + if (list.Count == 0) + { + return; + } + if (!playerPos.ContainsKey(player)) + { + playerPos.Add(player, 0); + } + + int index = mod((playerPos[player] - 1),list.Count); + Log.Debug("up "+ index); + KEAbilities ability = list[index]; + playerPos[player] += -1; + + + ability?.SelectAbility(player); + KEAbilities.UpdateGUI(player); + } + } + + private int mod(int x, int m) + { + return (x % m + m) % m; + } + + private void Down(Player player) + { + if (KEAbilities.PlayersAbility.TryGetValue(player, out var list)) + { + if(list.Count == 0) + { + return; + } + + if (!playerPos.ContainsKey(player)) + { + playerPos.Add(player, 0); + } + + + int index = mod((playerPos[player] + 1), list.Count); + Log.Debug("down " + index); + KEAbilities ability = list[index]; + playerPos[player] += 1; + ability?.SelectAbility(player); + KEAbilities.UpdateGUI(player); + } + } + + + + + + private void OnVerified(VerifiedEventArgs ev) + { + ServerSpecificSettingsSync.SendToPlayer(ev.Player.ReferenceHub); + } + + /// + /// + /// + /// + /// true if keybinds mode is activated ; false otherwise + internal bool GetMode(Player p) + { + if (!SettingBase.TryGetSetting(p, _idMode, out var setting)) return setting.IsSecondDefault; + + return setting.IsFirst; + } + + + internal string GetArrow(Player p) + { + if (!SettingBase.TryGetSetting(p, _idArrow, out var setting)) return baseArrow; + + return setting.Text; + + } + internal float GetTime(Player p) + { + if (!SettingBase.TryGetSetting(p, _idTimeCustomRole, out var setting)) return 20; + return setting.SliderValue; + } + + + /// + /// + /// + /// + /// true if the player wants description ; false otherwise + internal bool GetDescriptionsSettings(Player p) + { + if (!SettingBase.TryGetSetting(p, _idDesc, out var setting)) return true; + return setting.IsSecond; + } + + } +} diff --git a/KruacentExiled/KE.CustomRoles/Translations.cs b/KruacentExiled/KE.CustomRoles/Translations.cs new file mode 100644 index 00000000..bb08f730 --- /dev/null +++ b/KruacentExiled/KE.CustomRoles/Translations.cs @@ -0,0 +1,41 @@ +using Exiled.API.Interfaces; +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace KE.CustomRoles +{ + public class Translations : ITranslation + { + public string GettingNewRole { get; set; } = "%Name%\n %Desc%"; + + + [Description("Russe (1050)")] + public string RusseDesc { get; set; } = "Tu es unmaitre de jeu \nyou should play russian roulette with the others"; + public string RussePublicName { get; set; } = "Russian"; + + + [Description("DBoyInShape (1058)")] + public string InShapeDesc { get; set; } = "Dammmmnnnnnnn les gates"; // aucune idée comment traduire ça + public string InShapePublicName { get; set; } = "DBoyInShape"; + + + [Description("Enfant (1041)")] + public string EnfantDesc { get; set; } = "You are a Kid \ndo not the kid \nyou start with a rainbow candy (in theory) \n you're a bit smaller"; + public string EnfantPublicName { get; set; } = "kid"; + + + [Description("Mime (1053)")] + public string MimePublicName { get; set; } = "Mime"; + + + [Description("ChiefGuard (1046)")] + public string ChiefGuardPublicName { get; set; } = "Chief Guard"; + public string ChiefGuardDesc { get; set; } = "Tu es un Chef des gardes du site \nT'as une carte de private \net un crossvec"; + + + } +} diff --git a/KruacentExiled/KE.GlobalEventFramework.Examples/Config.cs b/KruacentExiled/KE.GlobalEventFramework.Examples/Config.cs deleted file mode 100644 index 0927af4b..00000000 --- a/KruacentExiled/KE.GlobalEventFramework.Examples/Config.cs +++ /dev/null @@ -1,15 +0,0 @@ -using Exiled.API.Interfaces; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace KE.GlobalEventFramework.Examples -{ - internal class Config : IConfig - { - public bool IsEnabled { get; set; } = true; - public bool Debug { get; set; } = false; - } -} diff --git a/KruacentExiled/KE.GlobalEventFramework.Examples/GE/Blitz.cs b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/Blitz.cs deleted file mode 100644 index cfc0eddf..00000000 --- a/KruacentExiled/KE.GlobalEventFramework.Examples/GE/Blitz.cs +++ /dev/null @@ -1,51 +0,0 @@ -using Exiled.API.Features; -using Exiled.API.Features.Items; -using KE.GlobalEventFramework.GEFE.API.Features; -using MEC; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace KE.GlobalEventFramework.Examples.GE -{ - /// - /// Spawn fused grenades in random rooms in the map - /// - public class Blitz : GlobalEvent - { - /// - public override int Id { get; set; } = 1; - /// - public override string Name { get; set; } = "Blitz"; - /// - public override string Description { get; set; } = "éteignez les lumières la luftwaffe arrive"; - /// - public override int Weight { get; set; } = 1; - /// - /// The cooldown between 2 spawn of grenades - /// - public int Cooldown { get; set; } = 120; - /// - /// The number of grenades in each spawn - /// - public int NbGrenadeSpawned { get; set; } = 5; - /// - public override IEnumerator Start() - { - while (!Round.IsEnded) - { - Log.Debug("waiting"); - yield return Timing.WaitForSeconds(Cooldown); - for (int i = 0; i < NbGrenadeSpawned; i++) - { - ((ExplosiveGrenade)Item.Create(ItemType.GrenadeHE)).SpawnActive(Room.Random().Position); - } - - - } - } - - } -} diff --git a/KruacentExiled/KE.GlobalEventFramework.Examples/GE/Impostor.cs b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/Impostor.cs deleted file mode 100644 index 89ee6f6a..00000000 --- a/KruacentExiled/KE.GlobalEventFramework.Examples/GE/Impostor.cs +++ /dev/null @@ -1,70 +0,0 @@ -using Player = Exiled.API.Features.Player; -using System.Collections.Generic; -using KE.GlobalEventFramework.GEFE.API.Features; -using MEC; -using System.Linq; -using Exiled.API.Extensions; -using Exiled.API.Features; - -namespace KE.GlobalEventFramework.Examples.GE -{ - public class Impostor : GlobalEvent - { - public override int Id { get; set; } = 30; - public override string Name { get; set; } = "Impostor"; - public override string Description { get; set; } = "Ne vous fiez pas aux apparences !"; - public override int Weight { get; set; } = 1; - - public override IEnumerator Start() - { - while (!Round.IsEnded) - { - int randomNumber = UnityEngine.Random.Range(180, 300); - yield return Timing.WaitForSeconds(randomNumber); - ChangingPlayer(); - } - } - - private void ChangingPlayer() - { - // Liste des joueurs vivants - List playerInServer = Player.List.Where(p => !p.IsNPC && p.IsAlive).ToList(); - - if (playerInServer.Count < 2) - { - Log.Warn("Pas assez de joueurs vivants pour effectuer un échange !"); - return; - } - - // Debug : afficher la liste initiale des joueurs avec leurs rôles - Log.Debug("===== Liste des joueurs avant permutation ====="); - - playerInServer.ForEach(p => Log.Debug($"{p.Nickname} ({p.Role})")); - - // Mélanger la liste des joueurs - playerInServer.ShuffleList(); - - // Copier les données actuelles des joueurs - var originalNicknames = playerInServer.Select(p => p.Nickname).ToList(); - var originalRoles = playerInServer.Select(p => p.Role).ToList(); - - // Permutation circulaire des rôles et pseudonymes - for (int i = 0; i < playerInServer.Count; i++) - { - int nextIndex = (i + 1) % playerInServer.Count; - playerInServer[i].ChangeAppearance(originalRoles[nextIndex]); - playerInServer[i].DisplayNickname = originalNicknames[nextIndex]; - } - - // Debug : afficher les correspondances après permutation - Log.Debug("===== Correspondances après permutation ====="); - for (int i = 0; i < playerInServer.Count; i++) - { - int nextIndex = (i + 1) % playerInServer.Count; - Log.Debug($"{originalNicknames[i]} ({originalRoles[i]}) -> {originalNicknames[nextIndex]} ({originalRoles[nextIndex]})"); - } - } - - - } -} \ No newline at end of file diff --git a/KruacentExiled/KE.GlobalEventFramework.Examples/GE/KIWIS.cs b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/KIWIS.cs deleted file mode 100644 index 22ef5274..00000000 --- a/KruacentExiled/KE.GlobalEventFramework.Examples/GE/KIWIS.cs +++ /dev/null @@ -1,57 +0,0 @@ -using Exiled.API.Features; -using MEC; -using PlayerRoles; -using Utils.NonAllocLINQ; -using System.Collections.Generic; -using System.Linq; -using KE.GlobalEventFramework.GEFE.API.Features; - - -namespace KE.GlobalEventFramework.Examples.GE -{ - /// - /// The scp start with 2/3 of it's life and end with 4/3 of it's vanilla life - /// - public class KIWIS : GlobalEvent - { - /// - public override int Id { get; set; } = 32; - /// - public override string Name { get; set; } = "KIWIS"; - /// - public override string Description { get; set; } = "Kill It While It's Small"; - /// - public override int Weight { get; set; } = 1; - /// - public override IEnumerator Start() - { - var listScp = Player.List.ToList().Where(p => p.IsScp && p.Role.Type != RoleTypeId.Scp0492).ToList().ToDictionary(p => p, p => p.MaxHealth/3); - - //set the health of all starting scps to 2/3 of their vanilla max health - listScp.ForEach(k => - { - k.Key.MaxHealth = k.Value * 2; - k.Key.Health = k.Key.MaxHealth; - }); - - yield return Timing.WaitUntilTrue(() => Round.ElapsedTime.TotalMinutes >= 15); - - listScp = listScp.Where(p => p.Key.IsScp && p.Key.Role.Type != RoleTypeId.Scp0492).ToList().ToDictionary(p => p.Key, p => p.Value); - listScp.ForEach(k => { - k.Key.MaxHealth += k.Value; - k.Key.Heal(k.Value); - }); - - yield return Timing.WaitUntilTrue(() => Round.ElapsedTime.TotalMinutes >= 30); - listScp = listScp.Where(p => p.Key.IsScp && p.Key.Role.Type != RoleTypeId.Scp0492).ToList().ToDictionary(p => p.Key, p => p.Value); - listScp.ForEach(k => { - k.Key.MaxHealth += k.Value; - k.Key.Heal(k.Value); - }); - - yield return 0; - - } - - } -} diff --git a/KruacentExiled/KE.GlobalEventFramework.Examples/GE/OpenBar.cs b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/OpenBar.cs deleted file mode 100644 index 1a558685..00000000 --- a/KruacentExiled/KE.GlobalEventFramework.Examples/GE/OpenBar.cs +++ /dev/null @@ -1,56 +0,0 @@ -using Exiled.API.Features.Doors; -using KE.GlobalEventFramework.GEFE.API.Features; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using Exiled.API.Enums; -using Exiled.API.Features; -using Exiled.Events.EventArgs.Map; - -namespace KE.GlobalEventFramework.Examples.GE -{ - public class OpenBar : GlobalEvent - { - public override int Id { get; set; } = 38; - public override string Name { get; set; } = "OpenBar"; - public override string Description { get; set; } = "j'espère que vous avez pas prévu de kampé"; - public override int Weight { get; set; } = 1; - public override IEnumerator Start() - { - var doors = Door.List.Where(d => new[] { DoorType.GateA, DoorType.GateB, DoorType.HczArmory, DoorType.HIDChamber,DoorType.Intercom,DoorType.Scp049Armory,DoorType.Scp096,DoorType.Scp106Primary,DoorType.Scp106Secondary,DoorType.Scp330,DoorType.Scp330Chamber,DoorType.Scp914Gate }.Contains(d.Type)).ToList(); - UnlockAndOpen(doors); - - yield return 0; - } - - private void UnlockAndOpen(List doors) - { - doors.ForEach(d => - { - d.IsOpen = true; - d.ChangeLock(DoorLockType.Isolation); - }); - } - - public override void SubscribeEvent() - { - Exiled.Events.Handlers.Map.GeneratorActivating += GenActivate; - } - - public override void UnsubscribeEvent() - { - Exiled.Events.Handlers.Map.GeneratorActivating -= GenActivate; - } - - public void GenActivate(GeneratorActivatingEventArgs ev) - { - if (Generator.List.Where(g => g.IsEngaged).Count() == 3) - { - UnlockAndOpen(Door.List.Where(d => new[] { DoorType.Scp079First, DoorType.Scp079Second }.Contains(d.Type)).ToList()); - } - } - - } -} diff --git a/KruacentExiled/KE.GlobalEventFramework.Examples/GE/R.cs b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/R.cs deleted file mode 100644 index ec4ab613..00000000 --- a/KruacentExiled/KE.GlobalEventFramework.Examples/GE/R.cs +++ /dev/null @@ -1,26 +0,0 @@ -using KE.GlobalEventFramework.GEFE.API.Features; -using System.Collections.Generic; - -namespace KE.GlobalEventFramework.Examples.GE -{ - /// - /// Literally does nothing - /// - public class R : GlobalEvent - { - /// - public override int Id { get; set; } = 32; - /// - public override string Name { get; set; } = "nothing"; - /// - public override string Description { get; set; } = "y'a r"; - /// - public override int Weight { get; set; } = 3; - /// - public override IEnumerator Start() - { - yield return 0; - } - - } -} diff --git a/KruacentExiled/KE.GlobalEventFramework.Examples/GE/RandomSpawn.cs b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/RandomSpawn.cs deleted file mode 100644 index fe31b79b..00000000 --- a/KruacentExiled/KE.GlobalEventFramework.Examples/GE/RandomSpawn.cs +++ /dev/null @@ -1,47 +0,0 @@ -using Exiled.API.Features; -using KE.GlobalEventFramework.GEFE.API.Features; -using PlayerRoles; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace KE.GlobalEventFramework.Examples.GE -{ - /// - /// All spawn are random at the start of the game (NTF & Chaos not included) - /// Note: all role spawn with each other except SCPs - /// - public class RandomSpawn : GlobalEvent - { - /// - public override int Id { get; set; } = 32; - /// - public override string Name { get; set; } = "RandomSpawn"; - /// - public override string Description { get; set; } = "Les spawns sont random"; - /// - public override int Weight { get; set; } = 1; - /// - public override IEnumerator Start() - { - Room room = Room.Random(); - foreach (RoleTypeId r in Enum.GetValues(typeof(RoleTypeId))) - { - foreach (Player p in Player.List) - { - - if (p.Role == r) - { - p.Teleport(room); - } - - } - room = Room.Random(); - } - yield return 0; - } - - } -} diff --git a/KruacentExiled/KE.GlobalEventFramework.Examples/GE/Shuffle.cs b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/Shuffle.cs deleted file mode 100644 index 12e6d505..00000000 --- a/KruacentExiled/KE.GlobalEventFramework.Examples/GE/Shuffle.cs +++ /dev/null @@ -1,107 +0,0 @@ -using Exiled.API.Features; -using MEC; -using KE.GlobalEventFramework.GEFE.API.Features; -using PlayerHandler = Exiled.Events.Handlers.Player; -using Exiled.Events.EventArgs.Player; -using UnityEngine; -using System.Collections.Generic; -using System.Linq; - - -namespace KE.GlobalEventFramework.Examples.GE -{ - /// - /// Every some amount of time all player take the position of another - /// - public class Shuffle : GlobalEvent - { - /// - public override int Id { get; set; } = 31; - /// - public override string Name { get; set; } = "Shuffle"; - /// - public override string Description { get; set; } = "et ça fait roomba café dans le scp"; - /// - public override int Weight { get; set; } = 0; - private List players; - private List pos; - /// - public override IEnumerator Start() - { - this.players = Player.List.ToList().Where(p => !p.IsNPC).ToList(); - this.players.ShuffleList(); - pos = new List(players.Count); - for (int i = 0; i < players.Count; i++) - { - pos.Add(Vector3.zero); - } - Log.Debug($"before while"); - while (!Round.IsEnded) - { - - Log.Debug($"waiting for {GetType().Name}"); - yield return Timing.WaitForSeconds(UnityEngine.Random.Range(300, 900)); - for (int i = 0; i < this.players.Count; i++) - { - Log.Debug($"old position of player {this.players[i]} : {this.players[i].Position}"); - var player = this.players[i]; - pos[i] = player.Position; - Log.Debug("------"); - } - - ShiftLeft(this.players); - Log.Debug("shifted players"); - for (int i = 0; i < this.players.Count; i++) - { - Log.Debug("before tp"); - this.players[i].Teleport(pos[i]); - Log.Debug($"new position of player {this.players[i]} : {this.players[i].Position}"); - } - Log.Debug($"tp player"); - for (int i = 0; i < players.Count; i++) - { - pos.Add(Vector3.zero); - } - Log.Debug($"cleared"); - } - } - /// - public override void SubscribeEvent() - { - PlayerHandler.Joined += OnJoined; - } - /// - public override void UnsubscribeEvent() - { - PlayerHandler.Joined -= OnJoined; - } - - private void OnJoined(JoinedEventArgs ev) - { - if (!ev.Player.IsNPC) - { - this.players.Add(ev.Player); - this.pos.Add(ev.Player.Position); - } - } - /// - /// Shift a List to the left - /// - /// the type of the List - /// the List to shift - private void ShiftLeft(List lst) - { - if (lst.Count > 0) - { - T firstElement = lst[0]; - for (int i = 1; i < lst.Count; i++) - { - lst[i - 1] = lst[i]; - } - lst[lst.Count - 1] = firstElement; - } - } - - - } -} diff --git a/KruacentExiled/KE.GlobalEventFramework.Examples/GE/Speed.cs b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/Speed.cs deleted file mode 100644 index a9152fb6..00000000 --- a/KruacentExiled/KE.GlobalEventFramework.Examples/GE/Speed.cs +++ /dev/null @@ -1,72 +0,0 @@ -using CustomPlayerEffects; -using Exiled.API.Enums; -using Exiled.API.Features; -using Exiled.Events.EventArgs.Player; -using Exiled.Events.EventArgs.Scp173; -using KE.GlobalEventFramework.GEFE.API.Features; -using MEC; -using System; -using System.Collections.Generic; -using System.ComponentModel; -using System.Linq; -using Utils.NonAllocLINQ; -using PlayerHandler = Exiled.Events.Handlers.Player; - -namespace KE.GlobalEventFramework.Examples.GE -{ - /// - /// Everyone has a movement boost effect (stackable) - /// Maybe inspired by Dr Bright's Mayhem - /// - public class Speed : GlobalEvent - { - /// - public override int Id { get; set; } = 30; - /// - public override string Name { get; set; } = "Speed"; - /// - public override string Description { get; set; } = "Gas! gas! gas!"; - /// - public override int Weight { get; set; } = 1; - /// - /// intensity of the movement boost effect - /// - public byte MovementBoost { get; set; } = 100; - /// - public override IEnumerator Start() - { - yield return Timing.WaitForSeconds(1); - Player.List.ToList().ForEach(p => p.EnableEffect(MovementBoost,999999999, true)); - - } - /// - public override void SubscribeEvent() - { - PlayerHandler.ChangingRole += ReactivateEffectSpawn; - Exiled.Events.Handlers.Scp173.Blinking += SpeedyNut; - } - /// - public override void UnsubscribeEvent() - { - PlayerHandler.ChangingRole -= ReactivateEffectSpawn; - Exiled.Events.Handlers.Scp173.Blinking -= SpeedyNut; - Player.List.ToList().ForEach(p => p.DisableEffect()); - } - /// - /// Decrease the blink cooldown of SCP-173 - /// - private void SpeedyNut(BlinkingEventArgs ev) - { - ev.BlinkCooldown = ev.BlinkCooldown/2; - } - - /// - /// Reactivate the effect at each role changement - /// - private void ReactivateEffectSpawn(ChangingRoleEventArgs ev) - { - Timing.CallDelayed(1f, () => ev.Player.EnableEffect(MovementBoost, 999999999, true)); - - } - } -} diff --git a/KruacentExiled/KE.GlobalEventFramework.Examples/GE/SystemMalfunction.cs b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/SystemMalfunction.cs deleted file mode 100644 index 7788b58a..00000000 --- a/KruacentExiled/KE.GlobalEventFramework.Examples/GE/SystemMalfunction.cs +++ /dev/null @@ -1,116 +0,0 @@ -using Exiled.API.Features; -using Exiled.API.Features.Doors; -using KE.GlobalEventFramework.GEFE.API.Features; -using KE.GlobalEventFramework.GEFE.API.Utils; -using MEC; -using System.Collections.Generic; -using System.Linq; -using Interactables.Interobjects.DoorUtils; -using Exiled.API.Enums; -using Exiled.API.Extensions; - -namespace KE.GlobalEventFramework.Examples.GE -{ - /// - /// The original - /// - /// The nuke can go off random from 15 to 30 min in the round (can be disable like a normal nuke) - /// If BlackoutNDoor is enabled in the server, increase the frequence of blackouts and door lockdowns - /// Can lock Elevator and Gate for an amount of time - /// Checkpoints can open randomly - /// - /// - public class SystemMalfunction : GlobalEvent - { - /// - public override int Id { get; set; } = 1; - /// - public override string Name { get; set; } = "System Malfunction"; - /// - public override string Description { get; set; } = "On dirait que les systèmes informatiques sont défaillants"; - /// - public override int Weight { get; set; } = 1; - /// - /// Set the cooldown for the BlackoutNDoor - /// - public int NewCooldown { get; set; } = 180; - /// - public override IEnumerator Start() - { - MoreBlackOutNDoors(); - Coroutine.LaunchCoroutine(EarlyNuke()); - - CoroutineHandle handle; - while(Round.InProgress){ - //todo change so it happen more frequently - Timing.WaitForSeconds((float)Round.ElapsedTime.TotalSeconds); - List> l = new []{CheckpointMalfunction(),GateLockdown(),ElevatorLockdown()}.ToList(); - handle = Coroutine.LaunchCoroutine(l[UnityEngine.Random.Range(0,3)]); - yield return Timing.WaitUntilDone(handle); - - } - - - } - public override void UnsubscribeEvent() - { - var otherPlugin = Exiled.Loader.Loader.Plugins.FirstOrDefault(plugin => plugin.Name == "KE.BlackoutDoor"); - if (otherPlugin != null) - { - - if (otherPlugin is BlackoutNDoor.MainPlugin blackout) - { - blackout.ServerHandler.Cooldown = -1; - } - - } - } - - private IEnumerator EarlyNuke() - { - int timeNuke = UnityEngine.Random.Range(15, 30); - Log.Debug($"the nuke will detonate in {timeNuke}min"); - yield return Timing.WaitUntilTrue(() => timeNuke == Round.ElapsedTime.TotalMinutes); - Warhead.Start(); - Log.Debug($"kaboom"); - } - - private void MoreBlackOutNDoors() - { - var otherPlugin = Exiled.Loader.Loader.Plugins.FirstOrDefault(plugin => plugin.Name == "KE.BlackoutDoor"); - if (otherPlugin != null) - { - - if (otherPlugin is BlackoutNDoor.MainPlugin blackout) - { - Log.Info("Found BlackOutNDoors"); - blackout.ServerHandler.Cooldown = NewCooldown; - } - - } - } - - private IEnumerator CheckpointMalfunction(){ - yield return Timing.WaitForSeconds(UnityEngine.Random.Range(20,60)); - var checkpoints = Door.List.Where(d => d.IsCheckpoint).ToList().RandomItem().IsOpen =true; - - } - - private IEnumerator GateLockdown(){ - var gates = Door.List.Where(d => d.Type == DoorType.GateA ||d.Type == DoorType.GateB); - var gate = gates.GetRandomValue(); - gate.IsOpen = false; - var timelock = UnityEngine.Random.Range(10,30); - gate.Lock(timelock,DoorLockType.Isolation); - yield return Timing.WaitForSeconds(timelock); - } - - private IEnumerator ElevatorLockdown(){ - var lift = Lift.Random; - lift.ChangeLock(DoorLockReason.Isolation); - yield return Timing.WaitForSeconds(UnityEngine.Random.Range(10,20)); - lift.ChangeLock(DoorLockReason.None); - } - - } -} \ No newline at end of file diff --git a/KruacentExiled/KE.GlobalEventFramework.Examples/KE.GlobalEventFramework.Examples.csproj b/KruacentExiled/KE.GlobalEventFramework.Examples/KE.GlobalEventFramework.Examples.csproj deleted file mode 100644 index 7f6cf4e9..00000000 --- a/KruacentExiled/KE.GlobalEventFramework.Examples/KE.GlobalEventFramework.Examples.csproj +++ /dev/null @@ -1,22 +0,0 @@ - - - - net48 - - - - - - - - - - - - - - - - - - diff --git a/KruacentExiled/KE.GlobalEventFramework.Examples/MainPlugin.cs b/KruacentExiled/KE.GlobalEventFramework.Examples/MainPlugin.cs deleted file mode 100644 index 4ddeef62..00000000 --- a/KruacentExiled/KE.GlobalEventFramework.Examples/MainPlugin.cs +++ /dev/null @@ -1,26 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using Exiled.API.Features; - -namespace KE.GlobalEventFramework.Examples -{ - internal class MainPlugin : Plugin - { - public override string Author => "Patrique & OmerGS"; - - public override Version Version => new Version(1, 0, 0); - public override string Name => "KE.GEF.Examples"; - public override void OnEnabled() - { - - } - - public override void OnDisabled() - { - - } - } -} diff --git a/KruacentExiled/KE.GlobalEventFramework/Config.cs b/KruacentExiled/KE.GlobalEventFramework/Config.cs deleted file mode 100644 index 69f7116a..00000000 --- a/KruacentExiled/KE.GlobalEventFramework/Config.cs +++ /dev/null @@ -1,21 +0,0 @@ -using Exiled.API.Interfaces; -using Exiled.Events.Commands.PluginManager; -using System; -using System.Collections.Generic; -using System.ComponentModel; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace KE.GlobalEventFramework -{ - internal class Config : IConfig - { - - public bool IsEnabled { get; set; } = true; - public bool Debug { get; set; } = true; - [Description("Show the log when the plugin is registering global event (require Debug to be true)")] - public bool ShowRegisteringLog { get; set; } = false; - - } -} diff --git a/KruacentExiled/KE.GlobalEventFramework/GEFE/API/Features/GlobalEvent.cs b/KruacentExiled/KE.GlobalEventFramework/GEFE/API/Features/GlobalEvent.cs deleted file mode 100644 index 4b525a5e..00000000 --- a/KruacentExiled/KE.GlobalEventFramework/GEFE/API/Features/GlobalEvent.cs +++ /dev/null @@ -1,98 +0,0 @@ -using Exiled.API.Features; -using System.Collections.Generic; -using System.Linq; -using MEC; -using KE.GlobalEventFramework.GEFE.API.Interfaces; -using Exiled.CustomItems.API.Features; -using System.Reflection; -using Exiled.API.Features.Attributes; -using Exiled.API.Interfaces; -using System.Collections; -using System; -using Exiled.API.Extensions; -using Exiled.API.Features.Pools; - -namespace KE.GlobalEventFramework.GEFE.API.Features -{ - public class GlobalEvent : IGlobalEvent - { - /// - /// A list of Active GlobalEvents - /// - public static List ActiveGlobalEvents => ActiveGE.ToList(); - internal static List ActiveGE { get; set; } = new List(); - internal static List coroutineHandles = new List(); - internal static Dictionary GlobalEvents { get; set; } = new Dictionary(); - /// - /// A list of all registered GlobalEvents - /// - public static List GlobalEventsList => GlobalEvents.Values.ToList(); - /// - public virtual int Id { get; set; } = -1; - /// - public virtual string Name { get; set; } = "GE NOT SET"; - /// - public virtual string Description { get; set; } = "DESC NOT SET"; - /// - public virtual int Weight { get; set; } = 1; - - public static void Register(IGlobalEvent globalEvent) - { - Log.Send($"REGISTERING {globalEvent.Name}", Discord.LogLevel.Info, ConsoleColor.Blue); - if (GlobalEvents.ContainsKey(globalEvent.Id)) - { - Log.Warn($"id already used for {GlobalEvents.TryGetValue(globalEvent.Id, out IGlobalEvent geAlready)}"); - Log.Warn("Trying to attribute a new id..."); - int key = 0; - while (GlobalEvents.ContainsKey(key)) - { - key++; - } - globalEvent.Id = key; - Log.Warn($"new id of {globalEvent.Name} : {globalEvent.Id}"); - } - GlobalEvents.Add(globalEvent.Id, globalEvent); - Log.Info($"{globalEvent.Name} is registered"); - } - public static void Register(List globalEvents) - { - globalEvents.ForEach(globalEvent => Register(globalEvent)); - } - /// - public virtual IEnumerator Start() - { - Log.Error($"{GetType().Name} Start is NOT overrided"); - yield return Timing.WaitForSeconds(30f); - } - /// - public virtual void SubscribeEvent() - { - Log.Warn($"{GetType().Name} : SubscribeEvent is NOT overrided"); - } - /// - public virtual void UnsubscribeEvent() - { - Log.Warn($"{GetType().Name} : UnsubscribeEvent is NOT overrided"); - } - /// - /// Create new List/Dictionary for the Global Event storage - /// - internal void Clean() - { - GlobalEvents = new Dictionary(); - ActiveGE = new List(); - } - - /// - /// Stop all Coroutine from GE - /// - internal static void StopCoroutines() - { - coroutineHandles.ForEach(coroutineHandle => - { - Timing.KillCoroutines(coroutineHandle); - }); - - } - } -} diff --git a/KruacentExiled/KE.GlobalEventFramework/GEFE/API/Features/Loader.cs b/KruacentExiled/KE.GlobalEventFramework/GEFE/API/Features/Loader.cs deleted file mode 100644 index 60747cd3..00000000 --- a/KruacentExiled/KE.GlobalEventFramework/GEFE/API/Features/Loader.cs +++ /dev/null @@ -1,47 +0,0 @@ -using Exiled.API.Features; -using Exiled.API.Interfaces; -using KE.GlobalEventFramework.GEFE.API.Interfaces; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace KE.GlobalEventFramework.GEFE.API.Features -{ - internal class Loader - { - internal List> ActivePlugins => new List>(); - internal static Loader Instance { get; private set; } = new Loader(); - - private Loader() { } - internal void Load() - { - foreach (IPlugin plugin in Exiled.Loader.Loader.Plugins.Where(pl => pl.Name != MainPlugin.Instance.Name)) - { - Log.Debug($"checking {plugin.Name}"); - foreach (Type type in plugin.Assembly.GetTypes()) - { - try - { - Log.Debug($" checking {type.Name}"); - if (type.IsSubclassOf(typeof(IGlobalEvent)) || type.IsSubclassOf(typeof(GlobalEvent))) - { - Log.Debug("good"); - ActivePlugins.Add(plugin); - - Log.Debug("creating instance"); - IGlobalEvent ge = Activator.CreateInstance(type) as IGlobalEvent; - Log.Debug("registering"); - GlobalEvent.Register(ge); - Log.Debug("end register"); - } - }catch(System.Exception e) - { - Log.Error($"Error registering in plugin {plugin.Name} : {e.Message}"); - } - } - } - } - } -} diff --git a/KruacentExiled/KE.GlobalEventFramework/GEFE/API/Interfaces/IGlobalEvent.cs b/KruacentExiled/KE.GlobalEventFramework/GEFE/API/Interfaces/IGlobalEvent.cs deleted file mode 100644 index 15dfce21..00000000 --- a/KruacentExiled/KE.GlobalEventFramework/GEFE/API/Interfaces/IGlobalEvent.cs +++ /dev/null @@ -1,44 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using MEC; - -namespace KE.GlobalEventFramework.GEFE.API.Interfaces -{ - public interface IGlobalEvent - { - /// - /// the UNIQUE id of the Global Event - /// - int Id { get; set; } - /// - /// Name used in the logs on the RA - /// - string Name { get; set; } - - /// - /// The description that will be shown to the player when the round start - /// - string Description { get; set; } - - /// - /// The chance this GE will be choosed at the start of a round - /// - int Weight { get; set; } - - /// - /// Is launched at the start of a round - /// - IEnumerator Start(); - /// - /// The method used to subcribe to event like with normal plugins - /// - void SubscribeEvent(); - /// - /// The method used to unsubcribe to event like with normal plugins - /// - void UnsubscribeEvent(); - } -} diff --git a/KruacentExiled/KE.GlobalEventFramework/GEFE/API/Utils/Coroutine.cs b/KruacentExiled/KE.GlobalEventFramework/GEFE/API/Utils/Coroutine.cs deleted file mode 100644 index 2cec07d0..00000000 --- a/KruacentExiled/KE.GlobalEventFramework/GEFE/API/Utils/Coroutine.cs +++ /dev/null @@ -1,19 +0,0 @@ -using MEC; -using System.Collections.Generic; - -namespace KE.GlobalEventFramework.GEFE.API.Utils -{ - public static class Coroutine - { - public static readonly List _coroutine = new List(); - - //CoroutineHandle coroutine - public static CoroutineHandle LaunchCoroutine(IEnumerator coroutine) - { - CoroutineHandle a = Timing.RunCoroutine(coroutine); - - _coroutine.Add(a); - return a; - } - } -} diff --git a/KruacentExiled/KE.GlobalEventFramework/GEFE/Commands/List.cs b/KruacentExiled/KE.GlobalEventFramework/GEFE/Commands/List.cs deleted file mode 100644 index 11764b19..00000000 --- a/KruacentExiled/KE.GlobalEventFramework/GEFE/Commands/List.cs +++ /dev/null @@ -1,37 +0,0 @@ -namespace KE.GlobalEventFramework.GEFE.Commands -{ - using Exiled.API.Features; - using Exiled.API.Features.Pickups; - using System; - using CommandSystem; - using System.Runtime.InteropServices.WindowsRuntime; - using GEFE.API.Interfaces; - using GEFE.API.Features; - - public class List : ICommand - { - public string Command { get; } = "list"; - public string[] Aliases { get; } = new string[] { "l", "ls" }; - public string Description { get; } = "get the list of all Global Events"; - - public bool Execute(ArraySegment arguments, ICommandSender sender, out string response) - { - string result = "List of all global event ([o] if it's active in the round ; [ ] otherwise) : "; - foreach (IGlobalEvent ge in GlobalEvent.GlobalEvents.Values) - { - - if (GlobalEvent.ActiveGlobalEvents.Contains(ge)) - { - result += "[o]"; - } - else - { - result += "[ ]"; - } - result += $" {ge.Id} : {ge.Name} : {ge.Description}\n"; - } - response = result; - return true; - } - } -} diff --git a/KruacentExiled/KE.GlobalEventFramework/GEFE/Commands/ParentCommandGEFE.cs b/KruacentExiled/KE.GlobalEventFramework/GEFE/Commands/ParentCommandGEFE.cs deleted file mode 100644 index 1b8f3830..00000000 --- a/KruacentExiled/KE.GlobalEventFramework/GEFE/Commands/ParentCommandGEFE.cs +++ /dev/null @@ -1,36 +0,0 @@ - -namespace KE.GlobalEventFramework.GEFE.Commands -{ - using CommandSystem; - using System; - - [CommandHandler(typeof(RemoteAdminCommandHandler))] - public class ParentCommandGEFE : ParentCommand - { - public ParentCommandGEFE() - { - LoadGeneratedCommands(); - } - public override string Command { get; } = "globalevent"; - public override string Description { get; } = "the parent command to check the Global Events"; - public override string[] Aliases { get; } = { "ge" }; - - public override void LoadGeneratedCommands() - { - RegisterCommand(new List()); - } - - protected override bool ExecuteParent(ArraySegment arguments, ICommandSender sender, out string response) - { - if(arguments.Count == 0){ - response = "subcommand available : list"; - return true; - } - response = ""; - return true; - } - - - } - -} \ No newline at end of file diff --git a/KruacentExiled/KE.GlobalEventFramework/GEFE/Exception/GlobalEventNullException.cs b/KruacentExiled/KE.GlobalEventFramework/GEFE/Exception/GlobalEventNullException.cs deleted file mode 100644 index 1034cd03..00000000 --- a/KruacentExiled/KE.GlobalEventFramework/GEFE/Exception/GlobalEventNullException.cs +++ /dev/null @@ -1,16 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -namespace KE.GlobalEventFramework.GEFE.Exception -{ - public class GlobalEventNullException : ArgumentException - { - public GlobalEventNullException(string message) : base(message) - { - - } - - } -} diff --git a/KruacentExiled/KE.GlobalEventFramework/GEFE/Handlers/ServerHandler.cs b/KruacentExiled/KE.GlobalEventFramework/GEFE/Handlers/ServerHandler.cs deleted file mode 100644 index 38e3b9cc..00000000 --- a/KruacentExiled/KE.GlobalEventFramework/GEFE/Handlers/ServerHandler.cs +++ /dev/null @@ -1,46 +0,0 @@ -using Exiled.API.Features; -using Exiled.Events.EventArgs.Server; -using System.Collections.Generic; -using KE.GlobalEventFramework.GEFE.API.Interfaces; -using KE.GlobalEventFramework.GEFE.API.Features; - -namespace KE.GlobalEventFramework.GEFE.Handlers -{ - internal class ServerHandler - { - MainPlugin _plugin; - List _activeGE; - public ServerHandler(MainPlugin mainPlugin) - { - this._plugin = mainPlugin; - } - public void OnRoundStarted() - { - Log.Debug("starting round"); - - _activeGE = _plugin.ChooseGE(UnityEngine.Random.value < .1f ? 2 : 1); - Log.Debug("sub event"); - _activeGE.ForEach(e => e.SubscribeEvent()); - Log.Debug("show to player"); - _plugin.Show(); - Log.Debug("end starting round"); - } - - public void OnWaitingForPlayers() - { - GlobalEvent.StopCoroutines(); - } - - public void OnEndingRound(RoundEndedEventArgs _) - { - Log.Debug("ending round"); - _activeGE.ForEach(e => e.UnsubscribeEvent()); - } - public void OnRestartingRound() - { - Log.Debug("restarting"); - _activeGE.ForEach(e => e.UnsubscribeEvent()); - } - - } -} diff --git a/KruacentExiled/KE.GlobalEventFramework/KE.GlobalEventFramework.csproj b/KruacentExiled/KE.GlobalEventFramework/KE.GlobalEventFramework.csproj deleted file mode 100644 index 8031db85..00000000 --- a/KruacentExiled/KE.GlobalEventFramework/KE.GlobalEventFramework.csproj +++ /dev/null @@ -1,17 +0,0 @@ - - - - net48 - - - - - - - - - - - - - diff --git a/KruacentExiled/KE.GlobalEventFramework/MainPlugin.cs b/KruacentExiled/KE.GlobalEventFramework/MainPlugin.cs deleted file mode 100644 index b4dbcc8e..00000000 --- a/KruacentExiled/KE.GlobalEventFramework/MainPlugin.cs +++ /dev/null @@ -1,157 +0,0 @@ -using Exiled.API.Features; -using System; -using System.Collections.Generic; -using System.Linq; -using MEC; -using Exiled.API.Enums; -using Player = Exiled.API.Features.Player; -using KE.GlobalEventFramework.GEFE.API.Features; -using KE.GlobalEventFramework.GEFE.API.Interfaces; -using ServerHandler = Exiled.Events.Handlers.Server; -namespace KE.GlobalEventFramework -{ - internal class MainPlugin : Plugin - { - public override string Author => "Patrique"; - public override string Name => "KE.GEFramework"; - public override Version Version => new Version(1, 0, 0); - public override PluginPriority Priority => PluginPriority.Highest; - - internal GEFE.Handlers.ServerHandler _server; - - internal static MainPlugin Instance {get;private set;} - - public override void OnEnabled() - { - - Instance = this; - Loader.Instance.Load(); - - - - RegisterEvents(); - - base.OnEnabled(); - } - - public override void OnDisabled() - { - UnregisterEvents(); - Timing.KillCoroutines(); - base.OnDisabled(); - Instance = null; - } - - private void RegisterEvents() - { - _server = new GEFE.Handlers.ServerHandler(this); - - - ServerHandler.WaitingForPlayers += _server.OnWaitingForPlayers; - ServerHandler.RoundStarted += _server.OnRoundStarted; - ServerHandler.RoundEnded += _server.OnEndingRound; - ServerHandler.RestartingRound += _server.OnRestartingRound; - - } - - private void UnregisterEvents() - { - ServerHandler.WaitingForPlayers -= _server.OnWaitingForPlayers; - ServerHandler.RoundStarted -= _server.OnRoundStarted; - ServerHandler.RoundEnded -= _server.OnEndingRound; - ServerHandler.RestartingRound -= _server.OnRestartingRound; - - _server = null; - } - - public void Show() - { - var random = UnityEngine.Random.value; - - foreach (Player player in Player.List) - { - Exiled.API.Features.Broadcast b = new Exiled.API.Features.Broadcast - { - Content = ShowText(random > .5f), - Duration = 10 - }; - player.Broadcast(b); - } - } - - private String ShowText(bool redacted = false) - { - String result = "Global Events: "; - for (int i = 0; i < GlobalEvent.ActiveGE.Count(); i++) - { - - - if (redacted) - { - result += GlobalEvent.ActiveGE[i].Description; - } - else - { - result += "[REDACTED]"; - } - - if (GlobalEvent.ActiveGE.Count() > 1 && i < GlobalEvent.ActiveGE.Count()-1) - { - result += ","; - } - } - - - return result; - } - - public List ChooseGE(int numberOfGlobalEvent = 1) - { - List activeGE = ChooseRandomGE(numberOfGlobalEvent); - Log.Debug($"activeGE size : {activeGE.Count}"); - Log.Info($"Global Event(s) ({numberOfGlobalEvent}): "); - - foreach (IGlobalEvent ge in activeGE) - { - Log.Info(ge.Name); - var a = Timing.RunCoroutine(ge.Start()); - GlobalEvent.coroutineHandles.Add(a); //crash when using other ge from other assembly - } - return activeGE; - } - - private List ChooseRandomGE(int nbGE = 1) - { - List result = new List(); - - List weightedPool = new List(); - foreach (IGlobalEvent ge in GlobalEvent.GlobalEventsList) - { - for (int i = 0; i < ge.Weight; i++) - { - weightedPool.Add(ge); - Log.Debug($"getochoose : {ge.Name} "); - } - } - - nbGE = Math.Min(nbGE, GlobalEvent.GlobalEventsList.Count); - - for (int i = 0; i < nbGE; i++) - { - int randomIndex = UnityEngine.Random.Range(0, weightedPool.Count); - IGlobalEvent selectedGE = weightedPool[randomIndex]; - - result.Add(selectedGE); - - weightedPool.RemoveAll(e => e == selectedGE); - } - - // Step 3: Update the active global events - GlobalEvent.ActiveGE = result.ToList(); - - return result; - } - - - } -} diff --git a/KruacentExiled/KE.Items/Config.cs b/KruacentExiled/KE.Items/Config.cs deleted file mode 100644 index daaf9357..00000000 --- a/KruacentExiled/KE.Items/Config.cs +++ /dev/null @@ -1,15 +0,0 @@ -using Exiled.API.Interfaces; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace KE.Items -{ - public class Config : IConfig - { - public bool IsEnabled { get; set; } = true; - public bool Debug { get; set; } = false; - } -} diff --git a/KruacentExiled/KE.Items/Items/AdrenalineDrogue.cs b/KruacentExiled/KE.Items/Items/AdrenalineDrogue.cs deleted file mode 100644 index 6c148b3c..00000000 --- a/KruacentExiled/KE.Items/Items/AdrenalineDrogue.cs +++ /dev/null @@ -1,214 +0,0 @@ -using System.Collections.Generic; -using Exiled.API.Enums; -using Exiled.API.Features.Attributes; -using Exiled.API.Features.Spawn; -using Exiled.CustomItems.API.Features; -using MEC; -using Exiled.Events.EventArgs.Player; -using Player = Exiled.Events.Handlers.Player; -using Exiled.API.Features; -using Exiled.API.Extensions; -using UnityEngine; -using CustomPlayerEffects; - -/// -[CustomItem(ItemType.Adrenaline)] -public class AdrenalineDrogue : CustomItem -{ - /// - public override uint Id { get; set; } = 19; - - /// - public override string Name { get; set; } = "DA-020"; - - /// - public override string Description { get; set; } = "La bonne drogue là, si vous le prenez vous êtes ienb pendant 20 secondes puis vous vous sentez pas bien !"; - - /// - public override float Weight { get; set; } = 0.65f; - - public List joueursSCP = new List(); - - /// - public override SpawnProperties SpawnProperties { get; set; } = new SpawnProperties() - { - Limit = 1, - DynamicSpawnPoints = new List - { - new DynamicSpawnPoint() - { - Chance = 100, - Location = SpawnLocationType.Inside079Secondary, - }, - new DynamicSpawnPoint() - { - Chance = 2, - Location = SpawnLocationType.Inside173Gate, - }, - }, - }; - - /// - protected override void SubscribeEvents() - { - Player.UsedItem += OnUsingItem; - base.SubscribeEvents(); - } - - /// - protected override void UnsubscribeEvents() - { - Player.UsedItem -= OnUsingItem; - base.UnsubscribeEvents(); - } - - private void OnUsingItem(UsedItemEventArgs ev) - { - if (TryGet(ev.Item, out var result)) - { - if (result.Id == 19) - { - Timing.CallDelayed(0.5f, () => - { - Timing.RunCoroutine(EffectAttribution(ev.Player)); - }); - } - - } - } - - private IEnumerator EffectAttribution(Exiled.API.Features.Player joueur) - { - /* EFFET DE LA DROGUE */ - joueur.ShowHint("Vous êtes actuellement sous effet de la cocaïne liquide !"); - joueur.EnableEffect(40, true); - joueur.EnableEffect(30, true); - joueur.EnableEffect(30, true); - joueur.EnableEffect(30, true); - joueur.Health = 169; - - yield return Timing.WaitForSeconds(30); - - joueur.ShowHint("Mince vous êtes perdu chez le papi Rian !"); - joueur.Health = 9420; - - joueur.IsGodModeEnabled = true; - joueur.EnableEffect(EffectType.Flashed, 2, 2); - joueur.Teleport(RoomType.Pocket); - yield return Timing.WaitForSeconds(6); - - - joueur.EnableEffect(EffectType.Flashed, 2, 2); - joueur.Teleport(Room.Random()); - joueur.Handcuff(); - yield return Timing.WaitForSeconds(15); - - joueur.Health = 1; - - joueur.EnableEffect(EffectType.SeveredHands, 4); - yield return Timing.WaitForSeconds(4); - joueur.DisableAllEffects(); - - - foreach (Exiled.API.Features.Player unJoueur in Exiled.API.Features.Player.List) - { - if (unJoueur.IsScp) - { - joueursSCP.Add(unJoueur); - } - } - - joueur.EnableEffect(EffectType.Flashed, 2, 2); - if (joueursSCP.Count > 0) - { - joueur.Teleport(joueursSCP[UnityEngine.Random.Range(0, joueursSCP.Count)]); - } - else - { - joueur.Teleport(Room.Random()); - } - - yield return Timing.WaitForSeconds(10); - - joueur.Teleport(Room.Random()); - - joueur.RemoveHandcuffs(); - joueur.IsGodModeEnabled = false; - joueur.MaxHealth = 65; - joueur.Heal(joueur.MaxHealth); - joueur.DisplayNickname = "Sou Hiyori"; - - joueur.DisableAllEffects(); - joueur.EnableEffect(10); - joueur.EnableEffect(35); - - - yield return Timing.WaitForSeconds(UnityEngine.Random.Range(180, 300)); - - if (joueur.IsAlive) - { - int randomNumber = UnityEngine.Random.Range(1, 6); - switch (randomNumber) - { - case 1: - Log.Debug(joueur.Nickname + " a changé d'apparence !"); - joueur.PlayShieldBreakSound(); - - joueur.ChangeAppearance(joueursSCP[0].Role); - joueur.DisplayNickname = joueursSCP[0].Nickname; - - Exiled.API.Features.Server.FriendlyFire = true; - - joueur.Mute(); - yield return Timing.WaitForSeconds(15); - joueur.UnMute(); - break; - case 2: - Log.Debug("Muet"); - joueur.ShowHint("Vous avez perdu votre langue ! (esperons que celle-ci repousse)"); - joueur.Mute(); - yield return Timing.WaitForSeconds(UnityEngine.Random.Range(30, 100)); - joueur.ShowHint("Je crois que c'est bon, ça a repoussé !"); - joueur.UnMute(); - break; - case 3: - joueur.ShowHint("Vous êtes devenu du caoutchouc !"); - Exiled.API.Features.TeslaGate.IgnoredPlayers.Add(joueur); - joueur.SetScale(new Vector3(1.5f, 0.5f, 1.7f), Exiled.API.Features.Player.List); - break; - case 4: - Log.Debug("Let's go party"); - foreach (var player in Exiled.API.Features.Player.List) - { - player.ShowHint(joueur.Nickname + " à commencer une fête d'anniversaire !"); - } - - float duration2 = 30f; - float interval2 = 0.7f; - - float elapsedTime2 = 0f; - - while (elapsedTime2 < duration2) - { - float r = UnityEngine.Random.Range(0f, 1f); - float g = UnityEngine.Random.Range(0f, 1f); - float b = UnityEngine.Random.Range(0f, 1f); - - Exiled.API.Features.Map.ChangeLightsColor(new UnityEngine.Color(r, g, b)); - - yield return Timing.WaitForSeconds(interval2); - - elapsedTime2 += interval2; - } - - Exiled.API.Features.Map.ResetLightsColor(); - break; - case 5: - Log.Debug("Paper"); - joueur.ShowHint("Bienvenue dans le monde des papiers. Évite les ciseaux !"); - joueur.SetScale(new Vector3(1f, 0.5f, 1f), Exiled.API.Features.Player.List); - break; - } - } - } -} \ No newline at end of file diff --git a/KruacentExiled/KE.Items/Items/Defibrilator.cs b/KruacentExiled/KE.Items/Items/Defibrilator.cs deleted file mode 100644 index e5eb798e..00000000 --- a/KruacentExiled/KE.Items/Items/Defibrilator.cs +++ /dev/null @@ -1,128 +0,0 @@ -using System.Collections.Concurrent; -using System.Collections.Generic; -using Exiled.API.Enums; -using Exiled.API.Features.Attributes; -using Exiled.API.Features.Spawn; -using Exiled.CustomItems.API.Features; -using MEC; -using Exiled.Events.EventArgs.Player; -using Exiled.API.Features; -using UnityEngine; -using System.Linq; -[CustomItem(ItemType.SCP1853)] - -public class Defibrilator : CustomItem -{ - public override uint Id { get; set; } = 20; - public override string Name { get; set; } = "DF-001"; - public override string Description { get; set; } = "Le défibrilateur, il permet de réanimer une personne qui à une perte de conscience, on va réanimer la personne la plus proche du joueur qui l'utilise (le lieu de mort et non où se trouve le corps)"; - public override float Weight { get; set; } = 0.65f; - - private ConcurrentDictionary positionMort = new ConcurrentDictionary(); - - public override SpawnProperties SpawnProperties { get; set; } = new SpawnProperties() - { - Limit = 2, - DynamicSpawnPoints = new List - { - new DynamicSpawnPoint() { Chance = 100, Location = SpawnLocationType.Inside079Secondary }, - new DynamicSpawnPoint() { Chance = 10, Location = SpawnLocationType.InsideHidRight }, - new DynamicSpawnPoint() { Chance = 10, Location = SpawnLocationType.InsideHidLeft }, - }, - }; - - protected override void SubscribeEvents() - { - Exiled.Events.Handlers.Player.UsedItem += OnUsingItem; - Exiled.Events.Handlers.Player.Dying += OnDeathEvent; - Exiled.Events.Handlers.Player.Spawned += OnSpawningEvent; - base.SubscribeEvents(); - } - - protected override void UnsubscribeEvents() - { - Exiled.Events.Handlers.Player.UsedItem -= OnUsingItem; - Exiled.Events.Handlers.Player.Dying -= OnDeathEvent; - Exiled.Events.Handlers.Player.Spawned -= OnSpawningEvent; - base.UnsubscribeEvents(); - } - - private void OnDeathEvent(DyingEventArgs ev) - { - Log.Debug(positionMort.Count()); - Log.Debug(ev.Player.Nickname); - positionMort.TryAdd(ev.Player, ev.Player.Position); - Log.Debug(positionMort.Count()); - Log.Debug("Role : " + ev.Player.Role); - } - - private void OnSpawningEvent(SpawnedEventArgs ev) - { - if (ev.Player.IsAlive) - { - Log.Debug("Enlèvement du joueur"); - positionMort.TryRemove(ev.Player, out _); - } - } - - private void OnUsingItem(UsedItemEventArgs ev) - { - if (TryGet(ev.Item, out var result) && result.Id == 20) - { - Timing.CallDelayed(0.5f, () => - { - ev.Player.DisableEffect(EffectType.Scp1853); - Timing.RunCoroutine(EffectAttribution(ev.Player)); - }); - } - } - - private IEnumerator EffectAttribution(Player joueur) - { - Log.Debug("Utilisation item"); - Log.Debug("Nombre de mort : " + positionMort.Count()); - - if (positionMort.Count == 0) - { - joueur.Broadcast(5, "Il n'y a pas de morts actuellement.", Broadcast.BroadcastFlags.Normal, true); - Exiled.CustomItems.API.Features.CustomItem.TryGive(joueur, 20); - } - else - { - var playerPosition = joueur.Position; - - Exiled.API.Features.Player closestDeadPlayer = null; - float shortestDistance = float.MaxValue; - - foreach (var dead in positionMort) - { - float distance = Vector3.Distance(playerPosition, dead.Value); - - - if (distance < shortestDistance) - { - shortestDistance = distance; - closestDeadPlayer = dead.Key; - } - } - - if (closestDeadPlayer != null) - { - Log.Debug($"Le joueur mort le plus proche est à une distance de {shortestDistance:F2} unités. C'est : " + closestDeadPlayer.Nickname); - - closestDeadPlayer.IsGodModeEnabled = true; - closestDeadPlayer.Role.Set(joueur.Role); - closestDeadPlayer.Health = 10; - - closestDeadPlayer.Teleport(joueur.Position); - - closestDeadPlayer.Broadcast(5, joueur.Nickname + " t'as réanimé !", Broadcast.BroadcastFlags.Normal, true); - joueur.Broadcast(5, "Tu as réanimé " + closestDeadPlayer.Nickname + " !", Broadcast.BroadcastFlags.Normal, true); - - yield return Timing.WaitForSeconds(1); - - closestDeadPlayer.IsGodModeEnabled = false; - } - } - } -} \ No newline at end of file diff --git a/KruacentExiled/KE.Items/Items/Mine.cs b/KruacentExiled/KE.Items/Items/Mine.cs deleted file mode 100644 index 5ba232c1..00000000 --- a/KruacentExiled/KE.Items/Items/Mine.cs +++ /dev/null @@ -1,17 +0,0 @@ -using Exiled.CustomItems.API.Features; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace KE.Items.Items -{ - - //une mine - /*public class Mine : CustomGrenade - { - - } - */ -} diff --git a/KruacentExiled/KE.Items/Items/TPGrenada.cs b/KruacentExiled/KE.Items/Items/TPGrenada.cs deleted file mode 100644 index 6dc28bad..00000000 --- a/KruacentExiled/KE.Items/Items/TPGrenada.cs +++ /dev/null @@ -1,127 +0,0 @@ - -using System; -using System.Collections.Generic; -using System.ComponentModel; -using Exiled.API.Enums; -using Exiled.API.Features; -using Exiled.API.Features.Attributes; -using Exiled.API.Features.Pools; -using Exiled.API.Features.Spawn; -using Exiled.CustomItems.API.Features; -using Exiled.Events.EventArgs.Map; -using PlayerRoles; -using UnityEngine; - -namespace KE.Items.Items -{ - //grenade qui tp - public class TPGrenada : CustomGrenade - { - private List effectedPlayers = new List(); - public override uint Id { get; set; } = 20; - public override string Name { get; set; } = "Teleportation Grenade"; - public override string Description { get; set; } = "This grenade does 0 damage but teleport nearby players in a random place (does work in other dimension ;3 )"; - public override float Weight { get; set; } = 0.65f; - public override float FuseTime { get; set; } = 1.5f; - public override bool ExplodeOnCollision { get; set; } = true; - public float DamageModifier { get; set; } = 0.05f; - public override SpawnProperties SpawnProperties { get; set; } = new SpawnProperties() - { - Limit = 5, - DynamicSpawnPoints = new List - { - new DynamicSpawnPoint() - { - Chance = 50, - Location = SpawnLocationType.InsideHczArmory, - }, - new DynamicSpawnPoint() - { - Chance =2, - Location = SpawnLocationType.Inside914, - }, - new DynamicSpawnPoint() - { - Chance=50, - Location = SpawnLocationType.Inside049Armory, - }, - new DynamicSpawnPoint() - { - Chance=50, - Location = SpawnLocationType.InsideLczArmory, - } - }, - - }; - - [Description("What roles will not be able to be affected by Implosion Grenades. Keeping SCP-173 on this list is highly recommended.")] - public HashSet BlacklistedRoles { get; set; } = new HashSet() { RoleTypeId.Scp173, RoleTypeId.Scp106,RoleTypeId.Scp049, RoleTypeId.Scp096,RoleTypeId.Scp3114,RoleTypeId.Scp0492,RoleTypeId.Scp939 }; - - protected override void OnExploding(ExplodingGrenadeEventArgs ev) - { - ev.IsAllowed = false; - List copiedList = new List(); - foreach (Player player in ev.TargetsToAffect) - { - copiedList.Add(player); - } - - ev.TargetsToAffect.Clear(); - - effectedPlayers = ListPool.Pool.Get(); - foreach (Player player in copiedList) - { - if (BlacklistedRoles.Contains(player.Role)) - continue; - try - { - - bool line = Physics.Linecast(ev.Projectile.Transform.position, player.Position); - if (line) - { - effectedPlayers.Add(player); - player.Teleport(RandomRoom()); - } - } - catch (Exception exception) - { - Log.Error($"{nameof(OnExploding)} error: {exception}"); - } - } - } - - - - private Room RandomRoom() - { - Room room = Room.Random(); - if (Warhead.IsDetonated) - { - return Room.Random(ZoneType.Surface); - } - - if(Map.IsLczDecontaminated) - { - float random = UnityEngine.Random.value; - Log.Debug($"random={random}"); - if (random <= 0.33f) - { - return Room.Random(ZoneType.HeavyContainment); - } - if(random > 0.33f && random <= 0.66f) - { - return Room.Random(ZoneType.Entrance); - } - return Room.Random(ZoneType.Surface); - } - Log.Debug($"roomZone={room.Zone}"); - return room; - } - } - - //bonbon quand tu manges ça donne une armes random - /*public class RandomWeaponCandy : CustomItem - { - - }*/ -} diff --git a/KruacentExiled/KE.Items/KE.Items.csproj b/KruacentExiled/KE.Items/KE.Items.csproj deleted file mode 100644 index fee0f33f..00000000 --- a/KruacentExiled/KE.Items/KE.Items.csproj +++ /dev/null @@ -1,21 +0,0 @@ - - - - net48 - - - - - - - - - - - - - - - - - diff --git a/KruacentExiled/KE.Items/MainPlugin.cs b/KruacentExiled/KE.Items/MainPlugin.cs deleted file mode 100644 index 15a559cc..00000000 --- a/KruacentExiled/KE.Items/MainPlugin.cs +++ /dev/null @@ -1,28 +0,0 @@ - -using Exiled.API.Features; -using Exiled.CustomItems.API.Features; -using System; - -namespace KE.Items -{ - public class MainPlugin : Plugin - { - public override string Author => "Patrique & OmerGS"; - public override string Name => "KEItems"; - public override Version Version => new Version(1, 0, 0); - public override void OnEnabled() - { - - CustomItem.RegisterItems(); - - base.OnEnabled(); - } - - public override void OnDisabled() - { - CustomItem.UnregisterItems(); - - base.OnDisabled(); - } - } -} \ No newline at end of file diff --git a/KruacentExiled/KruacentExiled.sln b/KruacentExiled/KruacentExiled.sln index eefdbb2a..13caf3f8 100644 --- a/KruacentExiled/KruacentExiled.sln +++ b/KruacentExiled/KruacentExiled.sln @@ -5,13 +5,9 @@ VisualStudioVersion = 17.12.35506.116 MinimumVisualStudioVersion = 10.0.40219.1 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "KE.Utils", "KE.Utils\KE.Utils.csproj", "{DFEF41B3-5BD3-428A-A7BA-7A490E65C71F}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "KE.Misc", "KE.Misc\KE.Misc.csproj", "{CD822DB2-756E-4887-93AB-2D2F16BF542C}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "KE.CustomRoles", "KE.CustomRoles\KE.CustomRoles.csproj", "{33CC074C-06DD-4545-91F2-F668F3C4779D}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "KE.BlackoutNDoor", "KE.BlackoutNDoor\KE.BlackoutNDoor.csproj", "{C9867742-72DB-4ECA-81BF-104A27A04DB7}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "KE.GlobalEventFramework", "KE.GlobalEventFramework\KE.GlobalEventFramework.csproj", "{73D6C740-96DE-4965-898F-DDD5BCBF7366}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "KE.GlobalEventFramework.Examples", "KE.GlobalEventFramework.Examples\KE.GlobalEventFramework.Examples.csproj", "{07B92E87-F48F-4F9F-BA0E-1BCB2AF52F53}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "KE.Misc", "KE.Misc\KE.Misc.csproj", "{378DD640-986B-4DA9-8C65-8D318E99E98C}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -23,22 +19,14 @@ Global {DFEF41B3-5BD3-428A-A7BA-7A490E65C71F}.Debug|Any CPU.Build.0 = Debug|Any CPU {DFEF41B3-5BD3-428A-A7BA-7A490E65C71F}.Release|Any CPU.ActiveCfg = Release|Any CPU {DFEF41B3-5BD3-428A-A7BA-7A490E65C71F}.Release|Any CPU.Build.0 = Release|Any CPU - {CD822DB2-756E-4887-93AB-2D2F16BF542C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {CD822DB2-756E-4887-93AB-2D2F16BF542C}.Debug|Any CPU.Build.0 = Debug|Any CPU - {CD822DB2-756E-4887-93AB-2D2F16BF542C}.Release|Any CPU.ActiveCfg = Release|Any CPU - {CD822DB2-756E-4887-93AB-2D2F16BF542C}.Release|Any CPU.Build.0 = Release|Any CPU - {C9867742-72DB-4ECA-81BF-104A27A04DB7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {C9867742-72DB-4ECA-81BF-104A27A04DB7}.Debug|Any CPU.Build.0 = Debug|Any CPU - {C9867742-72DB-4ECA-81BF-104A27A04DB7}.Release|Any CPU.ActiveCfg = Release|Any CPU - {C9867742-72DB-4ECA-81BF-104A27A04DB7}.Release|Any CPU.Build.0 = Release|Any CPU - {73D6C740-96DE-4965-898F-DDD5BCBF7366}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {73D6C740-96DE-4965-898F-DDD5BCBF7366}.Debug|Any CPU.Build.0 = Debug|Any CPU - {73D6C740-96DE-4965-898F-DDD5BCBF7366}.Release|Any CPU.ActiveCfg = Release|Any CPU - {73D6C740-96DE-4965-898F-DDD5BCBF7366}.Release|Any CPU.Build.0 = Release|Any CPU - {07B92E87-F48F-4F9F-BA0E-1BCB2AF52F53}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {07B92E87-F48F-4F9F-BA0E-1BCB2AF52F53}.Debug|Any CPU.Build.0 = Debug|Any CPU - {07B92E87-F48F-4F9F-BA0E-1BCB2AF52F53}.Release|Any CPU.ActiveCfg = Release|Any CPU - {07B92E87-F48F-4F9F-BA0E-1BCB2AF52F53}.Release|Any CPU.Build.0 = Release|Any CPU + {33CC074C-06DD-4545-91F2-F668F3C4779D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {33CC074C-06DD-4545-91F2-F668F3C4779D}.Debug|Any CPU.Build.0 = Debug|Any CPU + {33CC074C-06DD-4545-91F2-F668F3C4779D}.Release|Any CPU.ActiveCfg = Release|Any CPU + {33CC074C-06DD-4545-91F2-F668F3C4779D}.Release|Any CPU.Build.0 = Release|Any CPU + {378DD640-986B-4DA9-8C65-8D318E99E98C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {378DD640-986B-4DA9-8C65-8D318E99E98C}.Debug|Any CPU.Build.0 = Debug|Any CPU + {378DD640-986B-4DA9-8C65-8D318E99E98C}.Release|Any CPU.ActiveCfg = Release|Any CPU + {378DD640-986B-4DA9-8C65-8D318E99E98C}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE From 39934bbed92d81de222ad8d307450ab30c2e64ad Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Sat, 27 Sep 2025 10:42:19 +0200 Subject: [PATCH 353/853] added spawn preference for custom scps --- KruacentExiled/KE.Misc/Features/Spawn.cs | 75 ++++++++++++++++++++---- KruacentExiled/KE.Misc/KE.Misc.csproj | 1 + 2 files changed, 64 insertions(+), 12 deletions(-) diff --git a/KruacentExiled/KE.Misc/Features/Spawn.cs b/KruacentExiled/KE.Misc/Features/Spawn.cs index 90977ebd..f7b76d21 100644 --- a/KruacentExiled/KE.Misc/Features/Spawn.cs +++ b/KruacentExiled/KE.Misc/Features/Spawn.cs @@ -1,8 +1,10 @@ using Exiled.API.Enums; using Exiled.API.Extensions; using Exiled.API.Features; +using Exiled.CustomItems.API.Features; using Exiled.CustomRoles.API.Features; using Exiled.Events.EventArgs.Server; +using KE.CustomRoles.API.Features; using KE.Misc.Features.CR; using KE.Utils.API.Interfaces; using MEC; @@ -15,11 +17,28 @@ namespace KE.Misc.Features { internal class Spawn : MiscFeature { + private RoleTypeId[] baseRole = + [ + RoleTypeId.Scp173, + RoleTypeId.Scp106, + RoleTypeId.Scp049, + RoleTypeId.Scp079, + RoleTypeId.Scp096, + RoleTypeId.Scp939, + ]; + + private Dictionary SelectableCustomSCPs => CustomSCP.All.Where(cs => cs.Id >= baseRole.Length).ToDictionary(cs => (int)cs.Id, cs => cs); + private bool _set035 = true; + + public void OnRoundStarted() { if (!MainPlugin.Instance.Config.ScpPreferences) return; + + + foreach (Player player in Player.List.Where(p => p.IsScp && !p.IsNPC)) { SetScpPreferences(player); @@ -34,13 +53,19 @@ private void SetScpPreferences(Player player) Log.Warn("no config, no custom preferences this round"); return; } - Dictionary chancescp = (Dictionary) GetPreferences(player); + Dictionary chancescp = GetPreferences(player); + if(chancescp == null) + { + Log.Error("no setting found"); + } - RoleTypeId roleScp = ChooseRandomRole(chancescp); + + int roleScp = ChooseRandomRole(chancescp); Log.Debug($"Scp ({player.Nickname}) is {roleScp} previous : {player.Role.Type}"); - player.Role.Set(roleScp); + SetRoleWithId(player, roleScp); + /* if (config.Scp035Enabled && roleScp == RoleTypeId.Scp079) { Player pl = Player.List.GetRandomValue(p => p.Role == RoleTypeId.ClassD || p.Role == RoleTypeId.Scientist); @@ -65,29 +90,43 @@ private void SetScpPreferences(Player player) pl.Role.Set(otherScp); Timing.CallDelayed(1f, () => { - pl.MaxHealth /= 2; + pl.MaxHealth /= 4; pl.Health = pl.MaxHealth; }); } - } + }*/ } - private IDictionary GetPreferences(Player player) + private Dictionary GetPreferences(Player player) { - if (player.ScpPreferences.Preferences == null) return new Dictionary(); - return player.ScpPreferences.Preferences.ToDictionary(p => p.Key, p => p.Value + 5); + if (player.ScpPreferences.Preferences == null) return null; + Dictionary idChance = new(); + + for (int i = 0; i < baseRole.Length; i++) + { + idChance.Add(i, player.ScpPreferences.Preferences[baseRole[i]]+5); + } + + foreach(CustomSCP customSCP in SelectableCustomSCPs.Values) + { + idChance.Add((int)customSCP.Id, customSCP.GetPreferences(player)+5); + } + + + + return idChance; } - private RoleTypeId ChooseRandomRole(IDictionary chancescp) + private int ChooseRandomRole(IDictionary chancescp) { if (chancescp == null) throw new ArgumentException("Dictionary null"); - List weightedPool = new List(); - foreach (RoleTypeId ge in chancescp.Keys) + List weightedPool = new(); + foreach (int ge in chancescp.Keys) { for (int i = 0; i < chancescp[ge]; i++) { @@ -95,13 +134,25 @@ private RoleTypeId ChooseRandomRole(IDictionary chancescp) weightedPool.Add(ge); } } - Log.Debug("end"); int randomIndex = UnityEngine.Random.Range(0, weightedPool.Count); return weightedPool[randomIndex]; } + private void SetRoleWithId(Player player, int id) + { + + if(id < baseRole.Length) + { + player.Role.Set(baseRole[id],SpawnReason.RoundStart); + } + else + { + SelectableCustomSCPs[id].AddRole(player); + } + } + public override void SubscribeEvents() diff --git a/KruacentExiled/KE.Misc/KE.Misc.csproj b/KruacentExiled/KE.Misc/KE.Misc.csproj index c376a3ba..3c0ec403 100644 --- a/KruacentExiled/KE.Misc/KE.Misc.csproj +++ b/KruacentExiled/KE.Misc/KE.Misc.csproj @@ -11,6 +11,7 @@ + From e603ca418215ead475513edc8ed228abb4f2c9b5 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Sat, 27 Sep 2025 11:52:40 +0200 Subject: [PATCH 354/853] can create blueprint without an admintoy --- .../API/Models/Blueprints/AdminToyBlueprint.cs | 16 +++++++++------- .../API/Models/Blueprints/LightBlueprint.cs | 13 ++++++++++++- .../API/Models/Blueprints/PrimitiveBlueprint.cs | 10 +++++++++- 3 files changed, 30 insertions(+), 9 deletions(-) diff --git a/KruacentExiled/KE.Utils/API/Models/Blueprints/AdminToyBlueprint.cs b/KruacentExiled/KE.Utils/API/Models/Blueprints/AdminToyBlueprint.cs index ccfcff3d..51f425c4 100644 --- a/KruacentExiled/KE.Utils/API/Models/Blueprints/AdminToyBlueprint.cs +++ b/KruacentExiled/KE.Utils/API/Models/Blueprints/AdminToyBlueprint.cs @@ -1,12 +1,9 @@ -using Exiled.API.Enums; +using Discord; +using Exiled.API.Enums; using Exiled.API.Features.Toys; -using Exiled.API.Interfaces; using KE.Utils.API.Interfaces; using System; -using System.Collections.Generic; -using System.Linq; using System.Text; -using System.Threading.Tasks; using UnityEngine; using Light = Exiled.API.Features.Toys.Light; @@ -21,6 +18,12 @@ public abstract class AdminToyBlueprint : ILoadable public Vector3 Scale { get; protected set; } + public AdminToyBlueprint(Vector3 position, Quaternion rotation, Vector3? center = null) + { + Position = position - center ?? position; + Rotation = rotation.eulerAngles; + } + public static AdminToyBlueprint Create(AdminToy adminToy, Vector3? center = null) { AdminToyBlueprint result; @@ -40,8 +43,7 @@ public static AdminToyBlueprint Create(AdminToy adminToy, Vector3? center = null throw new NotImplementedException("only primitive and light"); } - result.Position = adminToy.Position - center ?? adminToy.Position; - result.Rotation = adminToy.Rotation.eulerAngles; + return result; } diff --git a/KruacentExiled/KE.Utils/API/Models/Blueprints/LightBlueprint.cs b/KruacentExiled/KE.Utils/API/Models/Blueprints/LightBlueprint.cs index 1dc91294..456711ee 100644 --- a/KruacentExiled/KE.Utils/API/Models/Blueprints/LightBlueprint.cs +++ b/KruacentExiled/KE.Utils/API/Models/Blueprints/LightBlueprint.cs @@ -1,5 +1,6 @@ using Exiled.API.Enums; using Exiled.API.Features.Toys; +using System; using UnityEngine; using Light = Exiled.API.Features.Toys.Light; @@ -10,7 +11,17 @@ public class LightBlueprint : AdminToyBlueprint public Color Color { get; } public float Intensity { get; } - public LightBlueprint(Light l) + + public LightBlueprint(Vector3 position, Quaternion rotation, Color color, Vector3 scale,float intensity, Vector3? center = null) : base(position, rotation, center) + { + + AdminToyType = AdminToyType.LightSource; + Scale = scale; + Color = color; + Intensity = intensity; + } + + public LightBlueprint(Light l) : base(l.Position,l.Rotation) { AdminToyType = AdminToyType.PrimitiveObject; Scale = l.Scale; diff --git a/KruacentExiled/KE.Utils/API/Models/Blueprints/PrimitiveBlueprint.cs b/KruacentExiled/KE.Utils/API/Models/Blueprints/PrimitiveBlueprint.cs index 2e59f30a..e7af1e0b 100644 --- a/KruacentExiled/KE.Utils/API/Models/Blueprints/PrimitiveBlueprint.cs +++ b/KruacentExiled/KE.Utils/API/Models/Blueprints/PrimitiveBlueprint.cs @@ -10,10 +10,18 @@ public class PrimitiveBlueprint : AdminToyBlueprint public PrimitiveType Type { get; } - public PrimitiveBlueprint(Primitive p) + public PrimitiveBlueprint(PrimitiveType type, Vector3 position,Quaternion rotation,Color color,Vector3 scale,Vector3? center = null) : base(position,rotation, center) { AdminToyType = AdminToyType.PrimitiveObject; + Scale = scale; + Color = color; + Type = type; + } + public PrimitiveBlueprint(Primitive p) : base(p.Position,p.Rotation) + { + AdminToyType = AdminToyType.PrimitiveObject; + Scale = p.Scale; Color = p.Color; Type = p.Type; From 3321e0aec4e2baca3a8d9976fc77ca65da6feaa7 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Sat, 27 Sep 2025 11:55:08 +0200 Subject: [PATCH 355/853] updated to 9.9.2 --- KruacentExiled/KE.Utils/KE.Utils.csproj | 2 +- KruacentExiled/KE.Utils/Quality/Settings/QualitySettings.cs | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/KruacentExiled/KE.Utils/KE.Utils.csproj b/KruacentExiled/KE.Utils/KE.Utils.csproj index f3aa4e9a..c7a4eac9 100644 --- a/KruacentExiled/KE.Utils/KE.Utils.csproj +++ b/KruacentExiled/KE.Utils/KE.Utils.csproj @@ -6,7 +6,7 @@ - + diff --git a/KruacentExiled/KE.Utils/Quality/Settings/QualitySettings.cs b/KruacentExiled/KE.Utils/Quality/Settings/QualitySettings.cs index ca8d49be..7771958f 100644 --- a/KruacentExiled/KE.Utils/Quality/Settings/QualitySettings.cs +++ b/KruacentExiled/KE.Utils/Quality/Settings/QualitySettings.cs @@ -14,10 +14,10 @@ public class QualitySettings private SettingBase[] _settings; public QualitySettings(Action onChanged) { - HeaderSetting header = new("Quality Settings"); + //HeaderSetting header = new("Quality Settings"); _settings = [ - header, + //header, new DropdownSetting(_idQuality,"ModelQuality",["Low","Medium", "High"],onChanged:onChanged), new TwoButtonsSetting(_idModels,"Pickup models","Disabled","Enabled", onChanged:onChanged) ]; From 85e08ea2fea98f53092b03c0d9c153dc6ad9a755 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Sat, 27 Sep 2025 17:38:51 +0200 Subject: [PATCH 356/853] removed the collision with lights --- .../KE.Items/Features/PickupModel.cs | 35 ++++++++++++------- 1 file changed, 22 insertions(+), 13 deletions(-) diff --git a/KruacentExiled/KE.Items/Features/PickupModel.cs b/KruacentExiled/KE.Items/Features/PickupModel.cs index 5d915697..c76a74a6 100644 --- a/KruacentExiled/KE.Items/Features/PickupModel.cs +++ b/KruacentExiled/KE.Items/Features/PickupModel.cs @@ -115,8 +115,7 @@ private void OnPickupAdded(ItemPickupBase obj) //Log.Debug($"adding {obj.name} at ({obj.Position})"); AdminToy prim = blueprint.Spawn(Vector3.zero); - if (prim is Primitive p) - p.Collidable = false; + prim.Transform.parent = obj.transform; @@ -127,27 +126,37 @@ private void OnPickupAdded(ItemPickupBase obj) prim.AdminToyBase.syncInterval = 0f; Log.Debug("posP=" + prim.Transform.position); + if (prim is Primitive p) + { + p.Collidable = false; + var interact = InteractableToy.Create(prim.Transform, false); - var interact = InteractableToy.Create(prim.Transform, false); + interact.Transform.parent = obj.transform; + interact.Transform.localPosition = Vector3.zero; + interact.Transform.localRotation = Quaternion.identity; + interact.Scale = new(blueprint.Scale.x / scale.x, blueprint.Scale.y / scale.y, blueprint.Scale.z / scale.z); + interact.InteractionDuration = 0.245f + 0.175f * obj.Info.WeightKg; + interact.Shape = AdminToys.InvisibleInteractableToy.ColliderShape.Box; - interact.Transform.parent = obj.transform; - interact.Transform.localPosition = Vector3.zero; - interact.Transform.localRotation = Quaternion.identity; - interact.Scale = new(blueprint.Scale.x / scale.x, blueprint.Scale.y / scale.y, blueprint.Scale.z / scale.z); - interact.InteractionDuration = 0.245f + 0.175f * obj.Info.WeightKg; - interact.Shape = AdminToys.InvisibleInteractableToy.ColliderShape.Box; + + Log.Debug("scale intec : " + interact.Scale); + Log.Debug("posI=" + interact.Transform.position); + pickableItem[obj].Add(interact); + interact.Spawn(); + } + + - Log.Debug("scale intec : " + interact.Scale); + Log.Debug("scale prim : " + prim.Transform.localScale); - Log.Debug("posI=" + interact.Transform.position); + //interact.OnSearched += (player) => GiveCI(obj, player); - pickableItem[obj].Add(interact); - interact.Spawn(); + models[obj].Add(prim); prim.Spawn(); From ef17d2fff5f071b3e2af98ba1c2e127031d43ae3 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Sat, 27 Sep 2025 17:39:06 +0200 Subject: [PATCH 357/853] added tp grenada's pickup model --- KruacentExiled/KE.Items/Items/Defibrilator.cs | 4 -- .../Items/PickupModels/TPGrenadaPModel.cs | 49 +++++++++++++++++++ KruacentExiled/KE.Items/Items/TPGrenada.cs | 18 ++++++- 3 files changed, 65 insertions(+), 6 deletions(-) create mode 100644 KruacentExiled/KE.Items/Items/PickupModels/TPGrenadaPModel.cs diff --git a/KruacentExiled/KE.Items/Items/Defibrilator.cs b/KruacentExiled/KE.Items/Items/Defibrilator.cs index 50c83a5d..fbca71f1 100644 --- a/KruacentExiled/KE.Items/Items/Defibrilator.cs +++ b/KruacentExiled/KE.Items/Items/Defibrilator.cs @@ -56,11 +56,7 @@ protected override void UnsubscribeEvents() private void OnDeathEvent(DyingEventArgs ev) { - Log.Debug(positionMort.Count()); - Log.Debug(ev.Player.Nickname); positionMort.TryAdd(ev.Player, ev.Player.Position); - Log.Debug(positionMort.Count()); - Log.Debug("Role : " + ev.Player.Role); } private void OnSpawningEvent(SpawnedEventArgs ev) diff --git a/KruacentExiled/KE.Items/Items/PickupModels/TPGrenadaPModel.cs b/KruacentExiled/KE.Items/Items/PickupModels/TPGrenadaPModel.cs new file mode 100644 index 00000000..27b27189 --- /dev/null +++ b/KruacentExiled/KE.Items/Items/PickupModels/TPGrenadaPModel.cs @@ -0,0 +1,49 @@ +using Exiled.API.Features.Toys; +using Exiled.CustomItems.API.Features; +using KE.Items.Features; +using KE.Utils.API.Models.Blueprints; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using UnityEngine; + +namespace KE.Items.Items.PickupModels +{ + public class TPGrenadaPModel : PickupModel + { + + public TPGrenadaPModel(CustomItem customItem) : base(customItem) { } + + protected override bool HidePickup => true; + + + private static Vector3 pillar = new Vector3(.025f, .125f, .025f); + private static Vector3 support = new Vector3(.15f,.05f,.15f); + private static Vector3 glass = new Vector3(.15f, .20f, .15f); + + private static Color32 centralColor = new Color32(60, 255, 255, 255); + private static Color32 colorSupport = new Color32(80, 80, 80, 255); + private static Color32 glassColor = new Color32(74, 232, 255, 50); + + protected override HashSet CreateModel() + { + HashSet model = new() + { + new PrimitiveBlueprint(PrimitiveType.Cube, Vector3.down*12.5f, Quaternion.identity, colorSupport,support), + new PrimitiveBlueprint(PrimitiveType.Cube, Vector3.up*12.5f, Quaternion.identity, colorSupport,support), + new PrimitiveBlueprint(PrimitiveType.Cube, Vector3.zero, Quaternion.identity, glassColor,glass), + new PrimitiveBlueprint(PrimitiveType.Cylinder, Vector3.up + Vector3.back*6 + Vector3.right*6, Quaternion.identity,colorSupport, pillar), + new PrimitiveBlueprint(PrimitiveType.Cylinder, Vector3.up + Vector3.forward*6 + Vector3.right*6, Quaternion.identity,colorSupport, pillar), + new PrimitiveBlueprint(PrimitiveType.Cylinder, Vector3.up + Vector3.back*6 + Vector3.left*6, Quaternion.identity,colorSupport, pillar), + new PrimitiveBlueprint(PrimitiveType.Cylinder, Vector3.up + Vector3.forward*6 + Vector3.left*6, Quaternion.identity,colorSupport, pillar), + new PrimitiveBlueprint(PrimitiveType.Cylinder, Vector3.up, Quaternion.identity,centralColor, pillar), + new LightBlueprint(Vector3.zero, Quaternion.identity, centralColor,Vector3.one,.1f), + + }; + return model; + + } + } +} diff --git a/KruacentExiled/KE.Items/Items/TPGrenada.cs b/KruacentExiled/KE.Items/Items/TPGrenada.cs index 6803d2a6..b51afa0c 100644 --- a/KruacentExiled/KE.Items/Items/TPGrenada.cs +++ b/KruacentExiled/KE.Items/Items/TPGrenada.cs @@ -12,13 +12,14 @@ using KE.Items.Features; using KE.Items.Interface; using KE.Items.ItemEffects; +using KE.Items.Items.PickupModels; using PlayerRoles; using UnityEngine; namespace KE.Items.Items { [CustomItem(ItemType.GrenadeHE)] - public class TPGrenada : KECustomGrenade, ILumosItem, ISwichableEffect + public class TPGrenada : KECustomGrenade, ISwichableEffect, ICustomPickupModel { public override uint Id { get; set; } = 1045; @@ -58,18 +59,31 @@ public class TPGrenada : KECustomGrenade, ILumosItem, ISwichableEffect }; + public PickupModel PickupModel { get; } + public TPGrenada() { Effect = new TPGrenadaEffect(); + PickupModel = new TPGrenadaPModel(this); } protected override void OnExploding(ExplodingGrenadeEventArgs ev) { - Effect.Effect(ev); ev.TargetsToAffect.Clear(); } + protected override void SubscribeEvents() + { + PickupModel.SubscribeEvents(); + base.SubscribeEvents(); + } + + protected override void UnsubscribeEvents() + { + PickupModel.UnsubscribeEvents(); + base.UnsubscribeEvents(); + } } From 93d5ef92175337fda6723391ef55e66c7b1ff339 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Sun, 28 Sep 2025 13:05:08 +0200 Subject: [PATCH 358/853] moved stuff in API + added replace pickup --- .../{ => API}/Core/Lights/LightsHandler.cs | 7 +- .../Core/Settings/SettingsHandler.cs | 2 +- .../{ => API}/Core/Upgrade/UpgradeHandler.cs | 4 +- .../Core/Upgrade/UpgradeProperties.cs | 2 +- .../{ => API}/Extensions/PlayerExtensions.cs | 6 +- .../{ => API}/Features/KECustomGrenade.cs | 6 +- .../{ => API}/Features/KECustomItem.cs | 46 +++++- .../{ => API}/Features/PickupModel.cs | 24 ++-- .../KE.Items/API/Features/ReplaceItem.cs | 20 +++ .../{ => API}/Interface/CustomItemEffect.cs | 2 +- .../{ => API}/Interface/ICustomPickupModel.cs | 4 +- .../{ => API}/Interface/ILumosItem.cs | 2 +- .../{ => API}/Interface/ISwichableEffect.cs | 2 +- .../Interface/IUpgradableCustomItem.cs | 6 +- .../KE.Items/{ => API}/Interface/IUse.cs | 2 +- .../KE.Items/Items/AdrenalineDrogue.cs | 6 +- KruacentExiled/KE.Items/Items/Defibrilator.cs | 6 +- .../KE.Items/Items/DeployableWall.cs | 8 +- KruacentExiled/KE.Items/Items/DivinePills.cs | 8 +- KruacentExiled/KE.Items/Items/HealZone.cs | 10 +- KruacentExiled/KE.Items/Items/ImpactFlash.cs | 2 +- .../ItemEffects/DeployableWallEffect.cs | 13 +- .../ItemEffects/DivinePillsEffect.cs | 10 +- .../{ => Items}/ItemEffects/HealZoneEffect.cs | 11 +- .../{ => Items}/ItemEffects/MineEffect.cs | 18 +-- .../{ => Items}/ItemEffects/MolotovEffect.cs | 15 +- .../{ => Items}/ItemEffects/Scp1650Effect.cs | 6 +- .../ItemEffects/TPGrenadaEffect.cs | 10 +- KruacentExiled/KE.Items/Items/Mine.cs | 6 +- KruacentExiled/KE.Items/Items/Molotov.cs | 6 +- .../KE.Items/Items/PickupModels/MinePModel.cs | 2 +- .../Items/PickupModels/MolotovPModel.cs | 2 +- .../Items/PickupModels/PressePureePModel.cs | 2 +- .../Items/PickupModels/Scp3136PModel.cs | 2 +- .../Items/PickupModels/TPGrenadaPModel.cs | 2 +- KruacentExiled/KE.Items/Items/PressePuree.cs | 6 +- .../KE.Items/Items/SainteGrenada.cs | 4 +- KruacentExiled/KE.Items/Items/Scp1650.cs | 15 +- KruacentExiled/KE.Items/Items/Scp3136.cs | 2 +- KruacentExiled/KE.Items/Items/Scp514.cs | 2 +- KruacentExiled/KE.Items/Items/Scp7045.cs | 28 +--- KruacentExiled/KE.Items/Items/TPGrenada.cs | 15 +- .../KE.Items/Items/TrueDivinePills.cs | 12 +- KruacentExiled/KE.Items/MainPlugin.cs | 6 +- .../KE.Items/PickupModels/PickupQuality.cs | 135 ------------------ 45 files changed, 191 insertions(+), 314 deletions(-) rename KruacentExiled/KE.Items/{ => API}/Core/Lights/LightsHandler.cs (86%) rename KruacentExiled/KE.Items/{ => API}/Core/Settings/SettingsHandler.cs (98%) rename KruacentExiled/KE.Items/{ => API}/Core/Upgrade/UpgradeHandler.cs (97%) rename KruacentExiled/KE.Items/{ => API}/Core/Upgrade/UpgradeProperties.cs (95%) rename KruacentExiled/KE.Items/{ => API}/Extensions/PlayerExtensions.cs (83%) rename KruacentExiled/KE.Items/{ => API}/Features/KECustomGrenade.cs (95%) rename KruacentExiled/KE.Items/{ => API}/Features/KECustomItem.cs (65%) rename KruacentExiled/KE.Items/{ => API}/Features/PickupModel.cs (94%) create mode 100644 KruacentExiled/KE.Items/API/Features/ReplaceItem.cs rename KruacentExiled/KE.Items/{ => API}/Interface/CustomItemEffect.cs (94%) rename KruacentExiled/KE.Items/{ => API}/Interface/ICustomPickupModel.cs (83%) rename KruacentExiled/KE.Items/{ => API}/Interface/ILumosItem.cs (86%) rename KruacentExiled/KE.Items/{ => API}/Interface/ISwichableEffect.cs (86%) rename KruacentExiled/KE.Items/{ => API}/Interface/IUpgradableCustomItem.cs (55%) rename KruacentExiled/KE.Items/{ => API}/Interface/IUse.cs (86%) rename KruacentExiled/KE.Items/{ => Items}/ItemEffects/DeployableWallEffect.cs (88%) rename KruacentExiled/KE.Items/{ => Items}/ItemEffects/DivinePillsEffect.cs (89%) rename KruacentExiled/KE.Items/{ => Items}/ItemEffects/HealZoneEffect.cs (91%) rename KruacentExiled/KE.Items/{ => Items}/ItemEffects/MineEffect.cs (92%) rename KruacentExiled/KE.Items/{ => Items}/ItemEffects/MolotovEffect.cs (91%) rename KruacentExiled/KE.Items/{ => Items}/ItemEffects/Scp1650Effect.cs (97%) rename KruacentExiled/KE.Items/{ => Items}/ItemEffects/TPGrenadaEffect.cs (91%) delete mode 100644 KruacentExiled/KE.Items/PickupModels/PickupQuality.cs diff --git a/KruacentExiled/KE.Items/Core/Lights/LightsHandler.cs b/KruacentExiled/KE.Items/API/Core/Lights/LightsHandler.cs similarity index 86% rename from KruacentExiled/KE.Items/Core/Lights/LightsHandler.cs rename to KruacentExiled/KE.Items/API/Core/Lights/LightsHandler.cs index f6f9a30c..a42790a4 100644 --- a/KruacentExiled/KE.Items/Core/Lights/LightsHandler.cs +++ b/KruacentExiled/KE.Items/API/Core/Lights/LightsHandler.cs @@ -1,10 +1,11 @@ -using Exiled.CustomItems.API.Features; +using Exiled.API.Features; +using Exiled.CustomItems.API.Features; using InventorySystem.Items.Pickups; -using KE.Items.Interface; +using KE.Items.API.Interface; using KE.Utils.API.Interfaces; using LabApi.Features.Wrappers; -namespace KE.Items.Core.Lights +namespace KE.Items.API.Core.Lights { internal class LightsHandler : IUsingEvents { diff --git a/KruacentExiled/KE.Items/Core/Settings/SettingsHandler.cs b/KruacentExiled/KE.Items/API/Core/Settings/SettingsHandler.cs similarity index 98% rename from KruacentExiled/KE.Items/Core/Settings/SettingsHandler.cs rename to KruacentExiled/KE.Items/API/Core/Settings/SettingsHandler.cs index 61bfaa1d..802d7fd0 100644 --- a/KruacentExiled/KE.Items/Core/Settings/SettingsHandler.cs +++ b/KruacentExiled/KE.Items/API/Core/Settings/SettingsHandler.cs @@ -13,7 +13,7 @@ using System.Threading.Tasks; using UserSettings.ServerSpecific; -namespace KE.Items.Core.Settings +namespace KE.Items.API.Core.Settings { internal class SettingsHandler : IUsingEvents { diff --git a/KruacentExiled/KE.Items/Core/Upgrade/UpgradeHandler.cs b/KruacentExiled/KE.Items/API/Core/Upgrade/UpgradeHandler.cs similarity index 97% rename from KruacentExiled/KE.Items/Core/Upgrade/UpgradeHandler.cs rename to KruacentExiled/KE.Items/API/Core/Upgrade/UpgradeHandler.cs index 54776eaf..dd2a081c 100644 --- a/KruacentExiled/KE.Items/Core/Upgrade/UpgradeHandler.cs +++ b/KruacentExiled/KE.Items/API/Core/Upgrade/UpgradeHandler.cs @@ -2,11 +2,11 @@ using Exiled.API.Features.Items; using Exiled.CustomItems.API.Features; using Exiled.Events.EventArgs.Scp914; -using KE.Items.Interface; +using KE.Items.API.Interface; using KE.Utils.API.Interfaces; using Scp914; -namespace KE.Items.Core.Upgrade +namespace KE.Items.API.Core.Upgrade { internal class UpgradeHandler : IUsingEvents { diff --git a/KruacentExiled/KE.Items/Core/Upgrade/UpgradeProperties.cs b/KruacentExiled/KE.Items/API/Core/Upgrade/UpgradeProperties.cs similarity index 95% rename from KruacentExiled/KE.Items/Core/Upgrade/UpgradeProperties.cs rename to KruacentExiled/KE.Items/API/Core/Upgrade/UpgradeProperties.cs index 75278fa9..de46277e 100644 --- a/KruacentExiled/KE.Items/Core/Upgrade/UpgradeProperties.cs +++ b/KruacentExiled/KE.Items/API/Core/Upgrade/UpgradeProperties.cs @@ -7,7 +7,7 @@ using System.Threading.Tasks; using YamlDotNet.Core.Tokens; -namespace KE.Items.Core.Upgrade +namespace KE.Items.API.Core.Upgrade { public class UpgradeProperties { diff --git a/KruacentExiled/KE.Items/Extensions/PlayerExtensions.cs b/KruacentExiled/KE.Items/API/Extensions/PlayerExtensions.cs similarity index 83% rename from KruacentExiled/KE.Items/Extensions/PlayerExtensions.cs rename to KruacentExiled/KE.Items/API/Extensions/PlayerExtensions.cs index 9f10f9e4..696cf969 100644 --- a/KruacentExiled/KE.Items/Extensions/PlayerExtensions.cs +++ b/KruacentExiled/KE.Items/API/Extensions/PlayerExtensions.cs @@ -1,12 +1,12 @@ using Exiled.API.Features; -using KE.Items.Features; +using KE.Items.API.Features; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; -namespace KE.Items.Extensions +namespace KE.Items.API.Extensions { public static class PlayerExtensions { @@ -15,5 +15,5 @@ public static void ItemEffectHint(this Player player, string text) { KECustomItem.ItemEffectHint(player, text); } - } + } } diff --git a/KruacentExiled/KE.Items/Features/KECustomGrenade.cs b/KruacentExiled/KE.Items/API/Features/KECustomGrenade.cs similarity index 95% rename from KruacentExiled/KE.Items/Features/KECustomGrenade.cs rename to KruacentExiled/KE.Items/API/Features/KECustomGrenade.cs index 35c4d732..48b9552e 100644 --- a/KruacentExiled/KE.Items/Features/KECustomGrenade.cs +++ b/KruacentExiled/KE.Items/API/Features/KECustomGrenade.cs @@ -3,7 +3,7 @@ using Exiled.Events.EventArgs.Map; using Exiled.Events.EventArgs.Player; -namespace KE.Items.Features +namespace KE.Items.API.Features { public abstract class KECustomGrenade : CustomGrenade { @@ -25,13 +25,13 @@ protected override void UnsubscribeEvents() protected void InternalOnHurting(HurtingEventArgs ev) { - + //can't get the custom grenade /*if(ev.DamageHandler.Type == Exiled.API.Enums.DamageType.Explosion) { ev.Amount *= DamageModifier; }*/ - + } protected override void ShowPickedUpMessage(Player player) diff --git a/KruacentExiled/KE.Items/Features/KECustomItem.cs b/KruacentExiled/KE.Items/API/Features/KECustomItem.cs similarity index 65% rename from KruacentExiled/KE.Items/Features/KECustomItem.cs rename to KruacentExiled/KE.Items/API/Features/KECustomItem.cs index fcc0a4bb..0eca1292 100644 --- a/KruacentExiled/KE.Items/Features/KECustomItem.cs +++ b/KruacentExiled/KE.Items/API/Features/KECustomItem.cs @@ -1,19 +1,25 @@ using Exiled.API.Features; using Exiled.CustomItems.API.Features; using MHints = HintServiceMeow.Core.Models.Hints.Hint; -using KE.Items.Interface; using System.Text; using KE.Utils.API.Displays.DisplayMeow; using MEC; using HintServiceMeow.Core.Extension; using HintServiceMeow.Core.Utilities; using System.Reflection; - -namespace KE.Items.Features +using KE.Items.API.Interface; +using System.Collections.Generic; +using System.Linq; +using Exiled.API.Features.Pickups; +using UnityEngine; +using Exiled.API.Features.Spawn; + +namespace KE.Items.API.Features { public abstract class KECustomItem : CustomItem { + public virtual IEnumerable RoomsToReplaceItems { get; protected set; } = null; protected override void ShowPickedUpMessage(Player player) { Log.Debug("pickup"); @@ -27,6 +33,40 @@ protected override void ShowSelectedMessage(Player player) } + public override void SpawnAll() + { + if(RoomsToReplaceItems != null) + { + foreach(ReplaceItem replaceItem in RoomsToReplaceItems) + { + foreach(Room room in Room.List.Where(r => r.Type == replaceItem.Room)) + { + uint limit = 0; + foreach(Pickup pickup in room.Pickups.Where(p => p.Type == replaceItem.ItemToReplace)) + { + if (limit <= replaceItem.LimitPerRoom && Exiled.Loader.Loader.Random.NextDouble() * 100.0 >= (double)replaceItem.Chance) + { + ReplacePickup(pickup); + limit++; + } + } + } + } + } + + + base.SpawnAll(); + } + + + public void ReplacePickup(Pickup pickup) + { + Vector3 position = pickup.Position; + pickup.Destroy(); + Spawn(position); + } + + internal static void Message(CustomItem c, Player player, bool pickedUp = false) { diff --git a/KruacentExiled/KE.Items/Features/PickupModel.cs b/KruacentExiled/KE.Items/API/Features/PickupModel.cs similarity index 94% rename from KruacentExiled/KE.Items/Features/PickupModel.cs rename to KruacentExiled/KE.Items/API/Features/PickupModel.cs index c76a74a6..a9314529 100644 --- a/KruacentExiled/KE.Items/Features/PickupModel.cs +++ b/KruacentExiled/KE.Items/API/Features/PickupModel.cs @@ -9,7 +9,7 @@ using UnityEngine; using LabPlayer = LabApi.Features.Wrappers.Player; -namespace KE.Items.Features +namespace KE.Items.API.Features { public abstract class PickupModel { @@ -103,7 +103,7 @@ private void OnPickupAdded(ItemPickupBase obj) { pickup.Scale = new Vector3(.01f, .01f, .01f); } - + Vector3 scale = pickup.Scale; pickableItem.Add(obj, new()); @@ -119,8 +119,8 @@ private void OnPickupAdded(ItemPickupBase obj) prim.Transform.parent = obj.transform; - prim.Transform.localScale = new(blueprint.Scale.x/ scale.x, blueprint.Scale.y / scale.y, blueprint.Scale.z / scale.z); - prim.Transform.localPosition = prim.Position + Vector3.Scale(blueprint.Position,scale); + prim.Transform.localScale = new(blueprint.Scale.x / scale.x, blueprint.Scale.y / scale.y, blueprint.Scale.z / scale.z); + prim.Transform.localPosition = prim.Position + Vector3.Scale(blueprint.Position, scale); prim.Transform.rotation *= pickup.Rotation; prim.MovementSmoothing = 60; prim.AdminToyBase.syncInterval = 0f; @@ -144,31 +144,31 @@ private void OnPickupAdded(ItemPickupBase obj) pickableItem[obj].Add(interact); interact.Spawn(); } - - - + + + Log.Debug("scale prim : " + prim.Transform.localScale); - + //interact.OnSearched += (player) => GiveCI(obj, player); - + models[obj].Add(prim); prim.Spawn(); - - + + } } private void GiveCI(ItemPickupBase pickup, LabPlayer player) { Log.Debug("give"); - KECI.Give(player,true); + KECI.Give(player, true); pickup.DestroySelf(); } diff --git a/KruacentExiled/KE.Items/API/Features/ReplaceItem.cs b/KruacentExiled/KE.Items/API/Features/ReplaceItem.cs new file mode 100644 index 00000000..3595952c --- /dev/null +++ b/KruacentExiled/KE.Items/API/Features/ReplaceItem.cs @@ -0,0 +1,20 @@ +using Exiled.API.Enums; +using Exiled.API.Features.Spawn; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using UnityEngine; + +namespace KE.Items.API.Features +{ + public class ReplaceItem + { + public float Chance { get; set; } + public RoomType Room { get; set; } + public uint LimitPerRoom { get; set; } + + public ItemType ItemToReplace { get; set; } + } +} diff --git a/KruacentExiled/KE.Items/Interface/CustomItemEffect.cs b/KruacentExiled/KE.Items/API/Interface/CustomItemEffect.cs similarity index 94% rename from KruacentExiled/KE.Items/Interface/CustomItemEffect.cs rename to KruacentExiled/KE.Items/API/Interface/CustomItemEffect.cs index f8e22c94..496e5f10 100644 --- a/KruacentExiled/KE.Items/Interface/CustomItemEffect.cs +++ b/KruacentExiled/KE.Items/API/Interface/CustomItemEffect.cs @@ -9,7 +9,7 @@ using System.Text; using System.Threading.Tasks; -namespace KE.Items.Interface +namespace KE.Items.API.Interface { public abstract class CustomItemEffect { diff --git a/KruacentExiled/KE.Items/Interface/ICustomPickupModel.cs b/KruacentExiled/KE.Items/API/Interface/ICustomPickupModel.cs similarity index 83% rename from KruacentExiled/KE.Items/Interface/ICustomPickupModel.cs rename to KruacentExiled/KE.Items/API/Interface/ICustomPickupModel.cs index dbf7cc76..1208892b 100644 --- a/KruacentExiled/KE.Items/Interface/ICustomPickupModel.cs +++ b/KruacentExiled/KE.Items/API/Interface/ICustomPickupModel.cs @@ -1,5 +1,5 @@ using Exiled.API.Features.Toys; -using KE.Items.Features; +using KE.Items.API.Features; using KE.Utils.API.Models.Blueprints; using KE.Utils.Quality.Models; using System; @@ -8,7 +8,7 @@ using System.Text; using System.Threading.Tasks; -namespace KE.Items.Interface +namespace KE.Items.API.Interface { public interface ICustomPickupModel { diff --git a/KruacentExiled/KE.Items/Interface/ILumosItem.cs b/KruacentExiled/KE.Items/API/Interface/ILumosItem.cs similarity index 86% rename from KruacentExiled/KE.Items/Interface/ILumosItem.cs rename to KruacentExiled/KE.Items/API/Interface/ILumosItem.cs index d2116101..3b540fc8 100644 --- a/KruacentExiled/KE.Items/Interface/ILumosItem.cs +++ b/KruacentExiled/KE.Items/API/Interface/ILumosItem.cs @@ -4,7 +4,7 @@ using System.Text; using System.Threading.Tasks; -namespace KE.Items.Interface +namespace KE.Items.API.Interface { internal interface ILumosItem { diff --git a/KruacentExiled/KE.Items/Interface/ISwichableEffect.cs b/KruacentExiled/KE.Items/API/Interface/ISwichableEffect.cs similarity index 86% rename from KruacentExiled/KE.Items/Interface/ISwichableEffect.cs rename to KruacentExiled/KE.Items/API/Interface/ISwichableEffect.cs index f2717159..214c3ee8 100644 --- a/KruacentExiled/KE.Items/Interface/ISwichableEffect.cs +++ b/KruacentExiled/KE.Items/API/Interface/ISwichableEffect.cs @@ -4,7 +4,7 @@ using System.Text; using System.Threading.Tasks; -namespace KE.Items.Interface +namespace KE.Items.API.Interface { public interface ISwichableEffect { diff --git a/KruacentExiled/KE.Items/Interface/IUpgradableCustomItem.cs b/KruacentExiled/KE.Items/API/Interface/IUpgradableCustomItem.cs similarity index 55% rename from KruacentExiled/KE.Items/Interface/IUpgradableCustomItem.cs rename to KruacentExiled/KE.Items/API/Interface/IUpgradableCustomItem.cs index 634a9397..4aa040b0 100644 --- a/KruacentExiled/KE.Items/Interface/IUpgradableCustomItem.cs +++ b/KruacentExiled/KE.Items/API/Interface/IUpgradableCustomItem.cs @@ -1,4 +1,4 @@ -using KE.Items.Core.Upgrade; +using KE.Items.API.Core.Upgrade; using Scp914; using System; using System.Collections.Generic; @@ -6,10 +6,10 @@ using System.Text; using System.Threading.Tasks; -namespace KE.Items.Interface +namespace KE.Items.API.Interface { public interface IUpgradableCustomItem { - IReadOnlyDictionary Upgrade { get; } + IReadOnlyDictionary Upgrade { get; } } } diff --git a/KruacentExiled/KE.Items/Interface/IUse.cs b/KruacentExiled/KE.Items/API/Interface/IUse.cs similarity index 86% rename from KruacentExiled/KE.Items/Interface/IUse.cs rename to KruacentExiled/KE.Items/API/Interface/IUse.cs index 51ea4f27..585e447b 100644 --- a/KruacentExiled/KE.Items/Interface/IUse.cs +++ b/KruacentExiled/KE.Items/API/Interface/IUse.cs @@ -4,7 +4,7 @@ using System.Text; using System.Threading.Tasks; -namespace KE.Items.Interface +namespace KE.Items.API.Interface { public interface IUse { diff --git a/KruacentExiled/KE.Items/Items/AdrenalineDrogue.cs b/KruacentExiled/KE.Items/Items/AdrenalineDrogue.cs index 233119f5..260db009 100644 --- a/KruacentExiled/KE.Items/Items/AdrenalineDrogue.cs +++ b/KruacentExiled/KE.Items/Items/AdrenalineDrogue.cs @@ -10,10 +10,10 @@ using Exiled.API.Extensions; using UnityEngine; using CustomPlayerEffects; -using KE.Items.Interface; using System.Linq; -using KE.Items.Extensions; -using KE.Items.Features; +using KE.Items.API.Extensions; +using KE.Items.API.Interface; +using KE.Items.API.Features; /// [CustomItem(ItemType.Adrenaline)] diff --git a/KruacentExiled/KE.Items/Items/Defibrilator.cs b/KruacentExiled/KE.Items/Items/Defibrilator.cs index fbca71f1..a7e5b33e 100644 --- a/KruacentExiled/KE.Items/Items/Defibrilator.cs +++ b/KruacentExiled/KE.Items/Items/Defibrilator.cs @@ -9,9 +9,9 @@ using Exiled.API.Features; using UnityEngine; using System.Linq; -using KE.Items.Interface; -using KE.Items.Extensions; -using KE.Items.Features; +using KE.Items.API.Extensions; +using KE.Items.API.Interface; +using KE.Items.API.Features; [CustomItem(ItemType.SCP1853)] public class Defibrilator : KECustomItem, ILumosItem diff --git a/KruacentExiled/KE.Items/Items/DeployableWall.cs b/KruacentExiled/KE.Items/Items/DeployableWall.cs index 79b3f724..8507a963 100644 --- a/KruacentExiled/KE.Items/Items/DeployableWall.cs +++ b/KruacentExiled/KE.Items/Items/DeployableWall.cs @@ -2,14 +2,12 @@ using Exiled.API.Features.Attributes; using Exiled.API.Features.Spawn; using Exiled.CustomItems.API.Features; -using KE.Items.Interface; using System.Collections.Generic; using UnityEngine; using Exiled.Events.EventArgs.Player; -using Exiled.API.Features.Toys; -using MEC; -using KE.Items.ItemEffects; -using KE.Items.Features; +using KE.Items.API.Interface; +using KE.Items.Items.ItemEffects; +using KE.Items.API.Features; namespace KE.Items.Items { diff --git a/KruacentExiled/KE.Items/Items/DivinePills.cs b/KruacentExiled/KE.Items/Items/DivinePills.cs index cc314e71..2bfe2dda 100644 --- a/KruacentExiled/KE.Items/Items/DivinePills.cs +++ b/KruacentExiled/KE.Items/Items/DivinePills.cs @@ -5,11 +5,11 @@ using Exiled.CustomItems.API.Features; using Exiled.Events.EventArgs.Player; using PlayerHandle = Exiled.Events.Handlers.Player; -using KE.Items.Interface; -using KE.Items.ItemEffects; using Scp914; -using KE.Items.Features; -using KE.Items.Core.Upgrade; +using KE.Items.API.Core.Upgrade; +using KE.Items.API.Interface; +using KE.Items.Items.ItemEffects; +using KE.Items.API.Features; /// [CustomItem(ItemType.Painkillers)] diff --git a/KruacentExiled/KE.Items/Items/HealZone.cs b/KruacentExiled/KE.Items/Items/HealZone.cs index 64a40dfd..17915fce 100644 --- a/KruacentExiled/KE.Items/Items/HealZone.cs +++ b/KruacentExiled/KE.Items/Items/HealZone.cs @@ -2,15 +2,11 @@ using Exiled.API.Enums; using Exiled.API.Features.Attributes; using Exiled.API.Features.Spawn; -using Exiled.API.Features.Toys; using Exiled.CustomItems.API.Features; using Exiled.Events.EventArgs.Map; -using KE.Items.Interface; -using Player = Exiled.API.Features.Player; -using MEC; -using UnityEngine; -using KE.Items.ItemEffects; -using KE.Items.Features; +using KE.Items.API.Interface; +using KE.Items.Items.ItemEffects; +using KE.Items.API.Features; namespace KE.Items.Items { diff --git a/KruacentExiled/KE.Items/Items/ImpactFlash.cs b/KruacentExiled/KE.Items/Items/ImpactFlash.cs index 5fcc4b6f..fa88e150 100644 --- a/KruacentExiled/KE.Items/Items/ImpactFlash.cs +++ b/KruacentExiled/KE.Items/Items/ImpactFlash.cs @@ -3,7 +3,7 @@ using Exiled.API.Features.Attributes; using Exiled.API.Features.Spawn; using Exiled.CustomItems.API.Features; -using KE.Items.Features; +using KE.Items.API.Features; namespace KE.Items.Items { diff --git a/KruacentExiled/KE.Items/ItemEffects/DeployableWallEffect.cs b/KruacentExiled/KE.Items/Items/ItemEffects/DeployableWallEffect.cs similarity index 88% rename from KruacentExiled/KE.Items/ItemEffects/DeployableWallEffect.cs rename to KruacentExiled/KE.Items/Items/ItemEffects/DeployableWallEffect.cs index e3ceaa84..16ca28fb 100644 --- a/KruacentExiled/KE.Items/ItemEffects/DeployableWallEffect.cs +++ b/KruacentExiled/KE.Items/Items/ItemEffects/DeployableWallEffect.cs @@ -1,19 +1,19 @@ using Exiled.API.Features.Toys; using Exiled.Events.EventArgs.Map; using Exiled.Events.EventArgs.Player; -using KE.Items.Interface; +using KE.Items.API.Interface; using KE.Utils.API.Sounds; using MEC; using UnityEngine; -namespace KE.Items.ItemEffects +namespace KE.Items.Items.ItemEffects { public class DeployableWallEffect : CustomItemEffect { public override void Effect(UsedItemEventArgs ev) { - SpawnWall(ev.Player.Position,ev.Player.Rotation); + SpawnWall(ev.Player.Position, ev.Player.Rotation); } public override void Effect(DroppingItemEventArgs ev) { @@ -33,13 +33,14 @@ private void SpawnWall(Vector3 pos, Quaternion rotation) Vector3 rotat = new Vector3(0, rotation.eulerAngles.y, 0); - - + + Primitive wall = Primitive.Create(PrimitiveType.Cube, spawnPos, rotat, new Vector3(4, 4, 0.2f), true); Utils.API.Sounds.SoundPlayer.Instance.Play("lego", wall.GameObject, 10f, 40); wall.Collidable = true; wall.Visible = true; - Timing.CallDelayed(10, () => { + Timing.CallDelayed(10, () => + { wall.UnSpawn(); wall.Destroy(); }); diff --git a/KruacentExiled/KE.Items/ItemEffects/DivinePillsEffect.cs b/KruacentExiled/KE.Items/Items/ItemEffects/DivinePillsEffect.cs similarity index 89% rename from KruacentExiled/KE.Items/ItemEffects/DivinePillsEffect.cs rename to KruacentExiled/KE.Items/Items/ItemEffects/DivinePillsEffect.cs index 0e53802f..a999f230 100644 --- a/KruacentExiled/KE.Items/ItemEffects/DivinePillsEffect.cs +++ b/KruacentExiled/KE.Items/Items/ItemEffects/DivinePillsEffect.cs @@ -5,13 +5,13 @@ using Exiled.Events.EventArgs.Interfaces; using Exiled.Events.EventArgs.Map; using Exiled.Events.EventArgs.Player; -using KE.Items.Extensions; -using KE.Items.Interface; +using KE.Items.API.Extensions; +using KE.Items.API.Interface; using PlayerRoles; using System.Linq; using Random = UnityEngine.Random; -namespace KE.Items.ItemEffects +namespace KE.Items.Items.ItemEffects { public class DivinePillsEffect : CustomItemEffect { @@ -21,7 +21,7 @@ public override void Effect(UsedItemEventArgs ev) } public override void Effect(DroppingItemEventArgs ev) { - EffectItem(ev.Player,ev); + EffectItem(ev.Player, ev); } public override void Effect(ExplodingGrenadeEventArgs ev) @@ -34,7 +34,7 @@ public override void Effect(ExplodingGrenadeEventArgs ev) - private void EffectItem(Player player,IDeniableEvent ev = null) + private void EffectItem(Player player, IDeniableEvent ev = null) { if (Player.List.Count(x => x.Role == RoleTypeId.Spectator) == 0) { diff --git a/KruacentExiled/KE.Items/ItemEffects/HealZoneEffect.cs b/KruacentExiled/KE.Items/Items/ItemEffects/HealZoneEffect.cs similarity index 91% rename from KruacentExiled/KE.Items/ItemEffects/HealZoneEffect.cs rename to KruacentExiled/KE.Items/Items/ItemEffects/HealZoneEffect.cs index a3a6769d..dc0c3030 100644 --- a/KruacentExiled/KE.Items/ItemEffects/HealZoneEffect.cs +++ b/KruacentExiled/KE.Items/Items/ItemEffects/HealZoneEffect.cs @@ -2,7 +2,7 @@ using Exiled.API.Features.Toys; using Exiled.Events.EventArgs.Map; using Exiled.Events.EventArgs.Player; -using KE.Items.Interface; +using KE.Items.API.Interface; using MEC; using System; using System.Collections.Generic; @@ -11,7 +11,7 @@ using System.Threading.Tasks; using UnityEngine; -namespace KE.Items.ItemEffects +namespace KE.Items.Items.ItemEffects { public class HealZoneEffect : CustomItemEffect { @@ -44,7 +44,8 @@ private void SetZone(Player player, Vector3 position) var coroutineHandler = Timing.RunCoroutine(HealZoneHeal(wall.Position, cylinderSize, playerThrowingGrenade)); - Timing.CallDelayed(20, () => { + Timing.CallDelayed(20, () => + { wall.UnSpawn(); Timing.KillCoroutines(coroutineHandler); wall.Destroy(); @@ -55,7 +56,7 @@ private IEnumerator HealZoneHeal(Vector3 wallPosition, float cylinderSize { while (true) { - foreach (Player player in Exiled.API.Features.Player.List) + foreach (Player player in Player.List) { // Check if a player is in the zone. if (IsPlayerInZone(player, wallPosition, cylinderSize)) @@ -76,7 +77,7 @@ private bool IsPlayerInZone(Player player, Vector3 zonePosition, float radius) { float distance = Vector3.Distance(new Vector3(player.Position.x, 0, player.Position.z), new Vector3(zonePosition.x, 0, zonePosition.z)); - return distance <= (radius / 2); + return distance <= radius / 2; } } } diff --git a/KruacentExiled/KE.Items/ItemEffects/MineEffect.cs b/KruacentExiled/KE.Items/Items/ItemEffects/MineEffect.cs similarity index 92% rename from KruacentExiled/KE.Items/ItemEffects/MineEffect.cs rename to KruacentExiled/KE.Items/Items/ItemEffects/MineEffect.cs index 2d31ee87..3695efd3 100644 --- a/KruacentExiled/KE.Items/ItemEffects/MineEffect.cs +++ b/KruacentExiled/KE.Items/Items/ItemEffects/MineEffect.cs @@ -5,8 +5,8 @@ using Exiled.API.Interfaces; using Exiled.Events.EventArgs.Map; using Exiled.Events.EventArgs.Player; -using KE.Items.Extensions; -using KE.Items.Interface; +using KE.Items.API.Extensions; +using KE.Items.API.Interface; using KE.Items.Items.Models; using KE.Utils.API.Interfaces; using MEC; @@ -17,7 +17,7 @@ using System.Threading.Tasks; using UnityEngine; -namespace KE.Items.ItemEffects +namespace KE.Items.Items.ItemEffects { public class MineEffect : CustomItemEffect, IUsingEvents { @@ -35,7 +35,7 @@ public override void Effect(DroppingItemEventArgs ev) public override void Effect(ExplodingGrenadeEventArgs ev) { - PlaceMine(ev.Player,ev.Position); + PlaceMine(ev.Player, ev.Position); } public void SubscribeEvents() @@ -49,7 +49,7 @@ public void UnsubscribeEvents() private void OnExplodingGrenade(ExplodingGrenadeEventArgs ev) { - + } /// @@ -65,13 +65,13 @@ private void PlaceMine(Player p) /// /// /// - private void PlaceMine(Player p,Vector3 pos) + private void PlaceMine(Player p, Vector3 pos) { SpawnMine(p, pos); } - private void SpawnMine(Player p,Vector3 pos) + private void SpawnMine(Player p, Vector3 pos) { MineModel m = new MineModel(); @@ -123,7 +123,7 @@ private IEnumerator ActiveMine(MineModel mine, float cylinderSize) foreach (IWorldSpace p in Pickup.List) { - if (IsPositionInZone(p.Position,mine.Position, cylinderSize, 3)) + if (IsPositionInZone(p.Position, mine.Position, cylinderSize, 3)) { Grenade.SpawnActive(mine.Position); DestroyMine(mine); @@ -173,7 +173,7 @@ private bool IsPositionInZone(Vector3 position, Vector3 zonePosition, float radi float verticalDifference = Mathf.Abs(position.y - zonePosition.y); // Check if the player is in the 3d zone. - return horizontalDistance <= (radius / 2) && verticalDifference <= (height / 2); + return horizontalDistance <= radius / 2 && verticalDifference <= height / 2; } } diff --git a/KruacentExiled/KE.Items/ItemEffects/MolotovEffect.cs b/KruacentExiled/KE.Items/Items/ItemEffects/MolotovEffect.cs similarity index 91% rename from KruacentExiled/KE.Items/ItemEffects/MolotovEffect.cs rename to KruacentExiled/KE.Items/Items/ItemEffects/MolotovEffect.cs index 6af6398e..8802f9a8 100644 --- a/KruacentExiled/KE.Items/ItemEffects/MolotovEffect.cs +++ b/KruacentExiled/KE.Items/Items/ItemEffects/MolotovEffect.cs @@ -1,7 +1,6 @@ using Exiled.API.Features; using Exiled.API.Features.Toys; using Exiled.Events.EventArgs.Map; -using KE.Items.Interface; using MEC; using PlayerRoles; using Exiled.API.Enums; @@ -9,8 +8,9 @@ using UnityEngine; using Exiled.Events.EventArgs.Player; using Light = Exiled.API.Features.Toys.Light; +using KE.Items.API.Interface; -namespace KE.Items.ItemEffects +namespace KE.Items.Items.ItemEffects { public class MolotovEffect : CustomItemEffect { @@ -34,7 +34,7 @@ public override void Effect(ExplodingGrenadeEventArgs ev) } - private void SetZone(Player player,Vector3 position) + private void SetZone(Player player, Vector3 position) { float cylinderSize = CylinderSize; @@ -43,7 +43,7 @@ private void SetZone(Player player,Vector3 position) Vector3 molotovPosition = position; Primitive wall = Primitive.Create(PrimitiveType.Cylinder, molotovPosition, null, new Vector3(cylinderSize, 0.01f, cylinderSize), true); var l = Light.Create(position, null, null, false); - l.Color = new Color(255,128,0); + l.Color = new Color(255, 128, 0); l.Intensity = .05f; l.Spawn(); wall.Collidable = false; @@ -53,7 +53,8 @@ private void SetZone(Player player,Vector3 position) var coroutineHandler = Timing.RunCoroutine(DamageInMolotovZone(wall.Position, cylinderSize, playerThrowingGrenade)); - Timing.CallDelayed(Duration, () => { + Timing.CallDelayed(Duration, () => + { Timing.KillCoroutines(coroutineHandler); wall.Destroy(); l.Destroy(); @@ -73,7 +74,7 @@ private IEnumerator DamageInMolotovZone(Vector3 wallPosition, float cylin { if (IsPlayerInZone(player, wallPosition, cylinderSize)) { - if (Exiled.API.Features.Server.FriendlyFire || playerThrowingGrenade.Role.Team != player.Role.Team || playerThrowingGrenade == player) + if (Server.FriendlyFire || playerThrowingGrenade.Role.Team != player.Role.Team || playerThrowingGrenade == player) { if (player.IsHuman || player.Role == RoleTypeId.Scp0492) { @@ -120,7 +121,7 @@ private bool IsPlayerInZone(Player player, Vector3 zonePosition, float radius) { float distance = Vector3.Distance(new Vector3(player.Position.x, 0, player.Position.z), new Vector3(zonePosition.x, 0, zonePosition.z)); - return distance <= (radius / 2); + return distance <= radius / 2; } } } diff --git a/KruacentExiled/KE.Items/ItemEffects/Scp1650Effect.cs b/KruacentExiled/KE.Items/Items/ItemEffects/Scp1650Effect.cs similarity index 97% rename from KruacentExiled/KE.Items/ItemEffects/Scp1650Effect.cs rename to KruacentExiled/KE.Items/Items/ItemEffects/Scp1650Effect.cs index 4d726503..590f83f6 100644 --- a/KruacentExiled/KE.Items/ItemEffects/Scp1650Effect.cs +++ b/KruacentExiled/KE.Items/Items/ItemEffects/Scp1650Effect.cs @@ -1,7 +1,7 @@ using Exiled.API.Features; using Exiled.Events.EventArgs.Map; using Exiled.Events.EventArgs.Player; -using KE.Items.Interface; +using KE.Items.API.Interface; using MEC; using System; using System.Collections.Generic; @@ -11,7 +11,7 @@ using UnityEngine; using static KE.Items.Items.Scp1650; -namespace KE.Items.ItemEffects +namespace KE.Items.Items.ItemEffects { public class Scp1650Effect : CustomItemEffect { @@ -43,7 +43,7 @@ public override void Effect(ExplodingGrenadeEventArgs ev) private void OnUsedItem(Player player) { - + CardinalPoints rotation = Rotation(player.Rotation); Log.Debug(rotation); diff --git a/KruacentExiled/KE.Items/ItemEffects/TPGrenadaEffect.cs b/KruacentExiled/KE.Items/Items/ItemEffects/TPGrenadaEffect.cs similarity index 91% rename from KruacentExiled/KE.Items/ItemEffects/TPGrenadaEffect.cs rename to KruacentExiled/KE.Items/Items/ItemEffects/TPGrenadaEffect.cs index 24f439ef..6d1443d7 100644 --- a/KruacentExiled/KE.Items/ItemEffects/TPGrenadaEffect.cs +++ b/KruacentExiled/KE.Items/Items/ItemEffects/TPGrenadaEffect.cs @@ -5,7 +5,7 @@ using Exiled.API.Features.Pools; using Exiled.Events.EventArgs.Map; using Exiled.Events.EventArgs.Player; -using KE.Items.Interface; +using KE.Items.API.Interface; using PlayerRoles; using System; using System.Collections.Generic; @@ -15,7 +15,7 @@ using System.Threading.Tasks; using UnityEngine; -namespace KE.Items.ItemEffects +namespace KE.Items.Items.ItemEffects { public class TPGrenadaEffect : CustomItemEffect { @@ -41,7 +41,7 @@ public override void Effect(DroppingItemEventArgs ev) public override void Effect(ExplodingGrenadeEventArgs ev) { - OnExploding(ev.TargetsToAffect,ev.Projectile); + OnExploding(ev.TargetsToAffect, ev.Projectile); } @@ -79,7 +79,7 @@ private void OnExploding(HashSet targets, EffectGrenadeProjectile projec private Room RandomRoom() { - Room room = Room.List.GetRandomValue((Room r) => !BlacklistedRooms.Contains(r.Type)); + Room room = Room.List.GetRandomValue((r) => !BlacklistedRooms.Contains(r.Type)); if (Warhead.IsDetonated) { return RandomRoom(ZoneType.Surface); @@ -107,7 +107,7 @@ private Room RandomRoom() private Room RandomRoom(ZoneType zone) { - return Room.List.GetRandomValue((Room r) => !BlacklistedRooms.Contains(r.Type) && r.Zone == zone); + return Room.List.GetRandomValue((r) => !BlacklistedRooms.Contains(r.Type) && r.Zone == zone); } } } diff --git a/KruacentExiled/KE.Items/Items/Mine.cs b/KruacentExiled/KE.Items/Items/Mine.cs index 58cc4260..b06eec97 100644 --- a/KruacentExiled/KE.Items/Items/Mine.cs +++ b/KruacentExiled/KE.Items/Items/Mine.cs @@ -1,10 +1,10 @@ using UnityEngine; using Exiled.Events.EventArgs.Player; -using KE.Items.ItemEffects; -using KE.Items.Features; using KE.Items.Items.PickupModels; -using KE.Items.Interface; using Exiled.API.Features.Spawn; +using KE.Items.API.Interface; +using KE.Items.Items.ItemEffects; +using KE.Items.API.Features; namespace KE.Items.Items { diff --git a/KruacentExiled/KE.Items/Items/Molotov.cs b/KruacentExiled/KE.Items/Items/Molotov.cs index cf42cb64..4cd8168f 100644 --- a/KruacentExiled/KE.Items/Items/Molotov.cs +++ b/KruacentExiled/KE.Items/Items/Molotov.cs @@ -4,9 +4,9 @@ using Exiled.API.Features.Spawn; using Exiled.CustomItems.API.Features; using Exiled.Events.EventArgs.Map; -using KE.Items.Features; -using KE.Items.Interface; -using KE.Items.ItemEffects; +using KE.Items.API.Features; +using KE.Items.API.Interface; +using KE.Items.Items.ItemEffects; using KE.Items.Items.PickupModels; using UnityEngine; diff --git a/KruacentExiled/KE.Items/Items/PickupModels/MinePModel.cs b/KruacentExiled/KE.Items/Items/PickupModels/MinePModel.cs index 36ed2992..dadbd4c2 100644 --- a/KruacentExiled/KE.Items/Items/PickupModels/MinePModel.cs +++ b/KruacentExiled/KE.Items/Items/PickupModels/MinePModel.cs @@ -1,6 +1,6 @@ using Exiled.API.Features; using Exiled.API.Features.Toys; -using KE.Items.Features; +using KE.Items.API.Features; using KE.Utils.API.Models.Blueprints; using System; using System.Collections.Generic; diff --git a/KruacentExiled/KE.Items/Items/PickupModels/MolotovPModel.cs b/KruacentExiled/KE.Items/Items/PickupModels/MolotovPModel.cs index e20cc332..d18a995c 100644 --- a/KruacentExiled/KE.Items/Items/PickupModels/MolotovPModel.cs +++ b/KruacentExiled/KE.Items/Items/PickupModels/MolotovPModel.cs @@ -1,7 +1,7 @@ using Exiled.API.Features; using Exiled.API.Features.Toys; using Exiled.CustomItems.API.Features; -using KE.Items.Features; +using KE.Items.API.Features; using KE.Utils.API.Models.Blueprints; using System; using System.Collections.Generic; diff --git a/KruacentExiled/KE.Items/Items/PickupModels/PressePureePModel.cs b/KruacentExiled/KE.Items/Items/PickupModels/PressePureePModel.cs index fab90b85..f7797d9f 100644 --- a/KruacentExiled/KE.Items/Items/PickupModels/PressePureePModel.cs +++ b/KruacentExiled/KE.Items/Items/PickupModels/PressePureePModel.cs @@ -1,7 +1,7 @@ using Exiled.API.Features; using Exiled.API.Features.Toys; using Exiled.CustomItems.API.Features; -using KE.Items.Features; +using KE.Items.API.Features; using KE.Utils.API.Models.Blueprints; using System; using System.Collections.Generic; diff --git a/KruacentExiled/KE.Items/Items/PickupModels/Scp3136PModel.cs b/KruacentExiled/KE.Items/Items/PickupModels/Scp3136PModel.cs index 40ddac04..fa2a5bec 100644 --- a/KruacentExiled/KE.Items/Items/PickupModels/Scp3136PModel.cs +++ b/KruacentExiled/KE.Items/Items/PickupModels/Scp3136PModel.cs @@ -1,7 +1,7 @@ using Exiled.API.Features; using Exiled.API.Features.Toys; using Exiled.CustomItems.API.Features; -using KE.Items.Features; +using KE.Items.API.Features; using KE.Utils.API.Models.Blueprints; using System; using System.Collections.Generic; diff --git a/KruacentExiled/KE.Items/Items/PickupModels/TPGrenadaPModel.cs b/KruacentExiled/KE.Items/Items/PickupModels/TPGrenadaPModel.cs index 27b27189..5cf2f702 100644 --- a/KruacentExiled/KE.Items/Items/PickupModels/TPGrenadaPModel.cs +++ b/KruacentExiled/KE.Items/Items/PickupModels/TPGrenadaPModel.cs @@ -1,6 +1,6 @@ using Exiled.API.Features.Toys; using Exiled.CustomItems.API.Features; -using KE.Items.Features; +using KE.Items.API.Features; using KE.Utils.API.Models.Blueprints; using System; using System.Collections.Generic; diff --git a/KruacentExiled/KE.Items/Items/PressePuree.cs b/KruacentExiled/KE.Items/Items/PressePuree.cs index 37b372f5..300b3a7a 100644 --- a/KruacentExiled/KE.Items/Items/PressePuree.cs +++ b/KruacentExiled/KE.Items/Items/PressePuree.cs @@ -7,9 +7,9 @@ using Exiled.API.Features.Spawn; using Exiled.CustomItems.API.Features; using Exiled.Events.EventArgs.Scp914; -using KE.Items.Core.Upgrade; -using KE.Items.Features; -using KE.Items.Interface; +using KE.Items.API.Core.Upgrade; +using KE.Items.API.Features; +using KE.Items.API.Interface; using KE.Items.Items.PickupModels; using Scp914; diff --git a/KruacentExiled/KE.Items/Items/SainteGrenada.cs b/KruacentExiled/KE.Items/Items/SainteGrenada.cs index ca3df482..79079fad 100644 --- a/KruacentExiled/KE.Items/Items/SainteGrenada.cs +++ b/KruacentExiled/KE.Items/Items/SainteGrenada.cs @@ -9,8 +9,8 @@ using Exiled.CustomItems.API.Features; using Exiled.Events.EventArgs.Map; using Exiled.Events.EventArgs.Player; -using KE.Items.Features; -using KE.Items.Interface; +using KE.Items.API.Features; +using KE.Items.API.Interface; using UnityEngine; namespace KE.Items.Items diff --git a/KruacentExiled/KE.Items/Items/Scp1650.cs b/KruacentExiled/KE.Items/Items/Scp1650.cs index 2db0bd2f..7dc127bc 100644 --- a/KruacentExiled/KE.Items/Items/Scp1650.cs +++ b/KruacentExiled/KE.Items/Items/Scp1650.cs @@ -1,18 +1,11 @@ -using Exiled.API.Features; -using Exiled.API.Features.Attributes; +using Exiled.API.Features.Attributes; using Exiled.API.Features.Spawn; using Exiled.CustomItems.API.Features; using Exiled.Events.EventArgs.Player; -using KE.Items.Features; -using KE.Items.Interface; -using KE.Items.ItemEffects; -using MEC; -using System; +using KE.Items.API.Features; +using KE.Items.API.Interface; +using KE.Items.Items.ItemEffects; using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using UnityEngine; using PlayerHandle = Exiled.Events.Handlers.Player; diff --git a/KruacentExiled/KE.Items/Items/Scp3136.cs b/KruacentExiled/KE.Items/Items/Scp3136.cs index 32a84ab7..e0ae3240 100644 --- a/KruacentExiled/KE.Items/Items/Scp3136.cs +++ b/KruacentExiled/KE.Items/Items/Scp3136.cs @@ -6,7 +6,7 @@ using Exiled.CustomItems.API.Features; using Exiled.Events.EventArgs.Player; using Exiled.Events.EventArgs.Server; -using KE.Items.Features; +using KE.Items.API.Features; using MEC; using PlayerRoles; using System; diff --git a/KruacentExiled/KE.Items/Items/Scp514.cs b/KruacentExiled/KE.Items/Items/Scp514.cs index f7bdf2a6..15af312d 100644 --- a/KruacentExiled/KE.Items/Items/Scp514.cs +++ b/KruacentExiled/KE.Items/Items/Scp514.cs @@ -7,7 +7,7 @@ using Exiled.Events.EventArgs.Scp173; using Exiled.Events.EventArgs.Scp939; using Exiled.Events.Handlers; -using KE.Items.Features; +using KE.Items.API.Features; using KE.Items.Items.Models; using MEC; using System.Collections.Generic; diff --git a/KruacentExiled/KE.Items/Items/Scp7045.cs b/KruacentExiled/KE.Items/Items/Scp7045.cs index 99b057ec..06fe6809 100644 --- a/KruacentExiled/KE.Items/Items/Scp7045.cs +++ b/KruacentExiled/KE.Items/Items/Scp7045.cs @@ -1,30 +1,4 @@ -using Exiled.API.Enums; -using Exiled.API.Extensions; -using Exiled.API.Features; -using Exiled.API.Features.Attributes; -using Exiled.API.Features.Items; -using Exiled.API.Features.Spawn; -using Exiled.API.Features.Toys; -using Exiled.CustomItems.API.Features; -using Exiled.Events.EventArgs.Player; -using Exiled.Events.EventArgs.Server; -using KE.Items.Features; -using MEC; -using PlayerRoles; -using System; -using System.Collections.Generic; -using System.Data; -using System.Diagnostics.Tracing; -using System.Drawing.Imaging; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using UnityEngine; -using VoiceChat.Codec; -using VoiceChat.Codec.Enums; -using VoiceChat.Networking; - -namespace KE.Items.Items +namespace KE.Items.Items { //[CustomItem(ItemType.SCP1576)] /*[Obsolete("Scrapped - Can't make a good sound quality without external file")] diff --git a/KruacentExiled/KE.Items/Items/TPGrenada.cs b/KruacentExiled/KE.Items/Items/TPGrenada.cs index b51afa0c..dd72cca1 100644 --- a/KruacentExiled/KE.Items/Items/TPGrenada.cs +++ b/KruacentExiled/KE.Items/Items/TPGrenada.cs @@ -1,20 +1,13 @@ - -using System; -using System.Collections.Generic; -using System.ComponentModel; +using System.Collections.Generic; using Exiled.API.Enums; -using Exiled.API.Features; using Exiled.API.Features.Attributes; -using Exiled.API.Features.Pools; using Exiled.API.Features.Spawn; using Exiled.CustomItems.API.Features; using Exiled.Events.EventArgs.Map; -using KE.Items.Features; -using KE.Items.Interface; -using KE.Items.ItemEffects; +using KE.Items.API.Features; +using KE.Items.API.Interface; +using KE.Items.Items.ItemEffects; using KE.Items.Items.PickupModels; -using PlayerRoles; -using UnityEngine; namespace KE.Items.Items { diff --git a/KruacentExiled/KE.Items/Items/TrueDivinePills.cs b/KruacentExiled/KE.Items/Items/TrueDivinePills.cs index dc0f5df4..75a547b9 100644 --- a/KruacentExiled/KE.Items/Items/TrueDivinePills.cs +++ b/KruacentExiled/KE.Items/Items/TrueDivinePills.cs @@ -1,21 +1,15 @@ -using System.Collections.Generic; -using Exiled.API.Enums; +using Exiled.API.Enums; using Exiled.API.Features.Attributes; using Exiled.API.Features.Spawn; using Exiled.CustomItems.API.Features; -using MEC; using Exiled.Events.EventArgs.Player; using PlayerHandle = Exiled.Events.Handlers.Player; using Exiled.API.Features; -using Exiled.API.Extensions; using UnityEngine; -using CustomPlayerEffects; using System.Linq; using PlayerRoles; -using KE.Items.Interface; -using Exiled.CustomItems.API.EventArgs; -using Exiled.Events.EventArgs.Scp914; -using KE.Items.Features; +using KE.Items.API.Interface; +using KE.Items.API.Features; /// [CustomItem(ItemType.SCP500)] diff --git a/KruacentExiled/KE.Items/MainPlugin.cs b/KruacentExiled/KE.Items/MainPlugin.cs index 354ebe34..16a73216 100644 --- a/KruacentExiled/KE.Items/MainPlugin.cs +++ b/KruacentExiled/KE.Items/MainPlugin.cs @@ -3,9 +3,9 @@ using Exiled.API.Features; using Exiled.API.Features.Toys; using Exiled.CustomItems.API.Features; -using KE.Items.Core.Lights; -using KE.Items.Core.Settings; -using KE.Items.Core.Upgrade; +using KE.Items.API.Core.Lights; +using KE.Items.API.Core.Settings; +using KE.Items.API.Core.Upgrade; using KE.Utils.API.Displays.DisplayMeow; using System; using System.Linq; diff --git a/KruacentExiled/KE.Items/PickupModels/PickupQuality.cs b/KruacentExiled/KE.Items/PickupModels/PickupQuality.cs deleted file mode 100644 index 7d5b709b..00000000 --- a/KruacentExiled/KE.Items/PickupModels/PickupQuality.cs +++ /dev/null @@ -1,135 +0,0 @@ -using Exiled.API.Features; -using Exiled.API.Features.Pickups; -using Exiled.CustomItems.API.Features; -using InventorySystem.Items.Pickups; -using KE.Items.Interface; -using KE.Utils.Quality.Models; -using MEC; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using Pickup = InventorySystem.Items.Pickups.ItemPickupBase; - - -namespace KE.Items.PickupModels -{ - [Obsolete("scrapped",true)] - internal class PickupQuality - { - /* - public const float RefreshRate = .1f; - private readonly Dictionary pl = new (); - public void SubscribeEvents() - { - ItemPickupBase.OnPickupAdded += AddPickup; - ItemPickupBase.OnPickupDestroyed += DestroyPickup; - Exiled.Events.Handlers.Server.RoundStarted += OnRoundStarted; - } - - public void UnsubscribeEvents() - { - ItemPickupBase.OnPickupAdded -= AddPickup; - ItemPickupBase.OnPickupDestroyed -= DestroyPickup; - Exiled.Events.Handlers.Server.RoundStarted -= OnRoundStarted; - } - - private void OnRoundStarted() - { - Timing.RunCoroutine(ModelLoop()); - - } - - - private void AddPickup(ItemPickupBase pickup) - { - - if (CustomItem.TryGet(Exiled.API.Features.Pickups.Pickup.Get(pickup), out CustomItem cui) && cui is ICustomPickupModel ci) - { - pl.Add(pickup, null); - } - } - private void DestroyPickup(ItemPickupBase pickup) - { - - if (pickup == null) return; - - if (pl.ContainsKey(pickup)) - { - Model val = pl[pickup]; - val?.Destroy(); - pl.Remove(pickup); - } - } - - - - private IEnumerator ModelLoop() - { - while (true) - { - try - { - foreach (var x in pl.ToList()) - { - Pickup pickup = x.Key; - Model oldModel = x.Value; - if (pickup == null) - { - pl.Remove(x.Key); - continue; - } - if (CustomItem.TryGet(Exiled.API.Features.Pickups.Pickup.Get(pickup), out CustomItem cui) && cui is ICustomPickupModel ci) - { - if (ci.PickupModel == null) - { - continue; - } - ModelPrefab modelpre = ci.PickupModel; - - - - if (oldModel != null) - { - - if (oldModel.Prefab == ci.PickupModel && oldModel.Position == pickup.Position && oldModel.Rotation == pickup.Rotation) - { - continue; - } - oldModel.Destroy(); - - } - Model model = modelpre.Create(pickup.Position, pickup.Rotation); - - - pl[x.Key] = model; - } - else - { - Model val = x.Value; - val?.Destroy(); - pl.Remove(x.Key); - } - } - } - catch (Exception e) - { - Log.Error(e); - } - yield return Timing.WaitForSeconds(RefreshRate); - - } - - } - - - - - public static bool Check(Pickup pickup) - { - return CustomItem.TryGet(Exiled.API.Features.Pickups.Pickup.Get(pickup), out CustomItem item) && item is ICustomPickupModel; - } - */ - } -} From e45fcdbf4ddf581010ba116af8c2ba8153b77b81 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Sun, 28 Sep 2025 13:10:32 +0200 Subject: [PATCH 359/853] scps can't gamble --- KruacentExiled/KE.Map/Heavy/GamblingZone/GamblingRoom.cs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/KruacentExiled/KE.Map/Heavy/GamblingZone/GamblingRoom.cs b/KruacentExiled/KE.Map/Heavy/GamblingZone/GamblingRoom.cs index 6bba051d..dc79d0ea 100644 --- a/KruacentExiled/KE.Map/Heavy/GamblingZone/GamblingRoom.cs +++ b/KruacentExiled/KE.Map/Heavy/GamblingZone/GamblingRoom.cs @@ -72,6 +72,7 @@ private void Init(Vector3 position, LootTable lootTable, Vector3? offset = null) _interact = InteractableToy.Create(_position, networkSpawn: false); _interact.InteractionDuration = BasePickupTime; + _interact.OnSearchAborted += OnPickup; CreateModel(_position); _interact.Spawn(); @@ -120,6 +121,8 @@ public void OnPickup(LabApi.Features.Wrappers.Player player) { Player player2 = Player.Get(player); if (player2 == null) return; + if (!player2.IsScp) return; + if (player2.CurrentItem == null) return; Item item = _lootTable.GetRandomItem(); player2.CurrentItem.Destroy(); From b339378a4d2be55428f4c8a509d0c43588b945cd Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Sun, 28 Sep 2025 13:14:03 +0200 Subject: [PATCH 360/853] cleanup --- KruacentExiled/KE.Map/Doors/DoorButton.cs | 66 --------- KruacentExiled/KE.Map/Doors/KEDoor.cs | 133 ------------------ .../KE.Map/Doors/KEDoorTypes/KEDoorType.cs | 18 --- .../KE.Map/Doors/KEDoorTypes/NormalKEDoor.cs | 25 ---- .../Heavy/GamblingZone/DroppableItem.cs | 9 -- .../KE.Map/Heavy/GamblingZone/GamblingRoom.cs | 1 - KruacentExiled/KE.Map/MainPlugin.cs | 25 +--- .../KE.Map/Utils/InteractiblePickup.cs | 132 ----------------- 8 files changed, 3 insertions(+), 406 deletions(-) delete mode 100644 KruacentExiled/KE.Map/Doors/DoorButton.cs delete mode 100644 KruacentExiled/KE.Map/Doors/KEDoor.cs delete mode 100644 KruacentExiled/KE.Map/Doors/KEDoorTypes/KEDoorType.cs delete mode 100644 KruacentExiled/KE.Map/Doors/KEDoorTypes/NormalKEDoor.cs delete mode 100644 KruacentExiled/KE.Map/Utils/InteractiblePickup.cs diff --git a/KruacentExiled/KE.Map/Doors/DoorButton.cs b/KruacentExiled/KE.Map/Doors/DoorButton.cs deleted file mode 100644 index 772d3f16..00000000 --- a/KruacentExiled/KE.Map/Doors/DoorButton.cs +++ /dev/null @@ -1,66 +0,0 @@ -using Exiled.API.Features.Pickups; -using Exiled.API.Features.Toys; -using Exiled.API.Interfaces; -using Exiled.Events.EventArgs.Player; -using KE.Map.Utils; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using UnityEngine; - -namespace KE.Map.Doors -{ - internal class DoorButton : IWorldSpace - { - public Vector3 Position { get; } - public Quaternion Rotation { get; } - - public bool IsOpen - { - get - { - return isOpen; - } - set - { - isOpen = value; - UpdateColor(); - } - } - private bool isOpen; - - internal InteractiblePickup _ipickup { get; } - private Primitive _primitive; - - internal DoorButton(Vector3 position,Quaternion rotation) - { - Position = position; - Rotation = rotation; - _ipickup = new(ItemType.Medkit, Position, Vector3.one,0, Rotation, false); - - _primitive = Primitive.Create(PrimitiveType.Cube, Position, null, _ipickup.GetPickupTrueSize() + new Vector3(.1f, .1f, .1f)); - _primitive.Collidable = false; - - } - public void Destroy() - { - _primitive.Destroy(); - _ipickup.Destroy(); - } - - private void UpdateColor() - { - if (isOpen) - { - _primitive.Color = Color.red; - } - else - { - _primitive.Color = Color.green; - } - } - - } -} diff --git a/KruacentExiled/KE.Map/Doors/KEDoor.cs b/KruacentExiled/KE.Map/Doors/KEDoor.cs deleted file mode 100644 index 343d1f26..00000000 --- a/KruacentExiled/KE.Map/Doors/KEDoor.cs +++ /dev/null @@ -1,133 +0,0 @@ -using Exiled.API.Extensions; -using Exiled.API.Features; -using Exiled.API.Features.Doors; -using Exiled.API.Features.Items; -using Exiled.API.Features.Pickups; -using Exiled.API.Features.Toys; -using Exiled.API.Interfaces; -using Exiled.Events; -using Exiled.Events.EventArgs.Player; -using Interactables.Interobjects.DoorUtils; -using InventorySystem.Items.Pickups; -using KE.Map.Doors.KEDoorTypes; -using KE.Map.Utils; -using MEC; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Runtime.CompilerServices; -using System.Text; -using System.Threading.Tasks; -using UnityEngine; - -namespace KE.Map.Doors -{ - public class KEDoor : IWorldSpace, IDoorPermissionRequester - { - - internal static readonly HashSet _list = new(); - - public static HashSet List => new(_list); - - - public string RequesterLogSignature - { - get - { - return ""; - } - } - public DoorPermissionsPolicy PermissionsPolicy { get; } = new(DoorPermissionFlags.ContainmentLevelTwo, true); - - public Vector3 Position { get; } - public Quaternion Rotation { get; } - //0 -> closed ; 1 -> open - private float _exactState =0f; - private DoorButton _button; - //interacting door - private InteractiblePickup _pickup; - private CoroutineHandle _handle; - private KEDoorType _doorType; - public KEDoor OtherDoor - { - get { return _otherDoor; } - } - - private KEDoor _otherDoor; - public bool IsOpen - { - get { return _exactState == 1f; } - set - { - _exactState = value ? 1f : 0f; - } - } - - private KEDoor(Vector3 position, Quaternion rotation) - { - _list.Add(this); - Position = position; - Rotation = rotation; - _button = new(position+position* rotation.eulerAngles.y, rotation); - } - - public static KEDoor Create(KEDoorType doorType, Vector3 position,Quaternion rotation) - { - KEDoor door = new(position,rotation); - - door._doorType = doorType ?? new NormalKEDoor(); - door._doorType.Spawn(position,rotation); - - door._pickup = new(ItemType.Medkit,position,Vector3.one,0,null,false); - door._pickup.AddAction(door.UsingDoor); - - door._button._ipickup.AddAction(door.UsingDoor); - door._button.IsOpen = door.IsOpen; - - door._handle = Timing.RunCoroutine(door.Detect()); - return door; - } - - - public void Destroy() - { - Timing.KillCoroutines(_handle); - _button.Destroy(); - _pickup.Destroy(); - - } - - - - public void UsingDoor(Player player) - { - Log.Debug("using door"); - bool flag = PermissionsPolicy.CheckPermissions(player.ReferenceHub, this, out PermissionUsed callback); - - if(flag) - ChangeDoorState(); - } - - public IEnumerator Detect() - { - - - yield return Timing.WaitForOneFrame; - } - - - public void ChangeDoorState() - { - - IsOpen = !IsOpen; - _button.IsOpen = IsOpen; - } - - public void LinkOtherDoor(KEDoor otherDoor) - { - otherDoor._otherDoor = this; - _otherDoor = otherDoor; - } - - } -} diff --git a/KruacentExiled/KE.Map/Doors/KEDoorTypes/KEDoorType.cs b/KruacentExiled/KE.Map/Doors/KEDoorTypes/KEDoorType.cs deleted file mode 100644 index c8e9f7d6..00000000 --- a/KruacentExiled/KE.Map/Doors/KEDoorTypes/KEDoorType.cs +++ /dev/null @@ -1,18 +0,0 @@ -using Exiled.API.Features.Toys; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using UnityEngine; - -namespace KE.Map.Doors.KEDoorTypes -{ - public abstract class KEDoorType - { - - - public abstract IEnumerable Spawn(Vector3 position, Quaternion rotation); - - } -} diff --git a/KruacentExiled/KE.Map/Doors/KEDoorTypes/NormalKEDoor.cs b/KruacentExiled/KE.Map/Doors/KEDoorTypes/NormalKEDoor.cs deleted file mode 100644 index 7dc43724..00000000 --- a/KruacentExiled/KE.Map/Doors/KEDoorTypes/NormalKEDoor.cs +++ /dev/null @@ -1,25 +0,0 @@ -using Exiled.API.Features.Toys; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using UnityEngine; - -namespace KE.Map.Doors.KEDoorTypes -{ - public class NormalKEDoor : KEDoorType - { - public override IEnumerable Spawn(Vector3 position, Quaternion rotation) - { - - - - return new HashSet() - { - Primitive.Create(PrimitiveType.Cube,position,rotation.eulerAngles), - }; - - } - } -} diff --git a/KruacentExiled/KE.Map/Heavy/GamblingZone/DroppableItem.cs b/KruacentExiled/KE.Map/Heavy/GamblingZone/DroppableItem.cs index 81cadec7..dc8ee552 100644 --- a/KruacentExiled/KE.Map/Heavy/GamblingZone/DroppableItem.cs +++ b/KruacentExiled/KE.Map/Heavy/GamblingZone/DroppableItem.cs @@ -1,15 +1,6 @@ using Items = Exiled.API.Features.Items.Item; using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using Exiled.CustomItems.API.Features; using UnityEngine; -using Exiled.API.Features; -using Exiled.API.Features.Pickups; -using Exiled.API.Features.Toys; -using KE.Map.Utils; namespace KE.Map.Heavy.GamblingZone { diff --git a/KruacentExiled/KE.Map/Heavy/GamblingZone/GamblingRoom.cs b/KruacentExiled/KE.Map/Heavy/GamblingZone/GamblingRoom.cs index dc79d0ea..00884b36 100644 --- a/KruacentExiled/KE.Map/Heavy/GamblingZone/GamblingRoom.cs +++ b/KruacentExiled/KE.Map/Heavy/GamblingZone/GamblingRoom.cs @@ -3,7 +3,6 @@ using Exiled.API.Features.Items; using Exiled.API.Features.Toys; using Exiled.Events.EventArgs.Server; -using KE.Map.Utils; using InteractableToy = LabApi.Features.Wrappers.InteractableToy; using System.Collections.Generic; using UnityEngine; diff --git a/KruacentExiled/KE.Map/MainPlugin.cs b/KruacentExiled/KE.Map/MainPlugin.cs index 824479af..a8c29e24 100644 --- a/KruacentExiled/KE.Map/MainPlugin.cs +++ b/KruacentExiled/KE.Map/MainPlugin.cs @@ -3,16 +3,11 @@ using Exiled.API.Features; using Exiled.API.Features.Doors; using Exiled.API.Interfaces; -using Exiled.Events.EventArgs.Player; using Exiled.Events.EventArgs.Server; -using KE.Map.Doors; using KE.Map.EasterEggs; using KE.Map.Heavy.GamblingZone; -using KE.Map.Surface.BlinkingBlocks; -using KE.Map.Surface.SupplyDrops; using KE.Map.Surface.Turrets; using KE.Utils.API.Models; -using MEC; using PlayerRoles; using System.Collections.Generic; using System.Linq; @@ -22,23 +17,16 @@ namespace KE.Map { public class MainPlugin : Plugin { + public override string Name => "KE.Map"; + public override string Prefix => "KE.M"; public static MainPlugin Instance { get; private set; } public Models models => Models.Instance; public static Config Configs => Instance?.Config; - private Capybaras Capybaras; public override void OnEnabled() { - - //Capybaras = new(); - - - //Capybaras.SubscribeEvents(); KE.Utils.API.Sounds.SoundPlayer.Instance.TryLoad(); Exiled.Events.Handlers.Map.Generated += OnGenerated; GamblingRoom.SubscribeEvents(); - //SupplyDrop.SubscribeEvents(); - //Turret.SubscribeEvents(); - //models?.SubscribeEvents(); Instance = this; } @@ -58,12 +46,6 @@ public override void OnDisabled() Exiled.Events.Handlers.Map.Generated -= OnGenerated; Exiled.Events.Handlers.Server.RoundEnded -= OnRoundEnded; GamblingRoom.UnsubscribeEvents(); - //SupplyDrop.UnsubscribeEvents(); - //Capybaras.UnsubscribeEvents(); - //Turret.UnsubscribeEvents(); - //models.UnsubscribeEvents(); - //models.DestroyInstance(); - Capybaras = null; Instance = null; } @@ -135,8 +117,7 @@ private void OnGenerated() } - public override string Name => "KE.Map"; - public override string Prefix => "KE.M"; + private void OnRoundEnded(RoundEndedEventArgs ev) { diff --git a/KruacentExiled/KE.Map/Utils/InteractiblePickup.cs b/KruacentExiled/KE.Map/Utils/InteractiblePickup.cs deleted file mode 100644 index 0f72d028..00000000 --- a/KruacentExiled/KE.Map/Utils/InteractiblePickup.cs +++ /dev/null @@ -1,132 +0,0 @@ -using Exiled.API.Features; -using Exiled.API.Features.Pickups; -using Exiled.API.Interfaces; -using Exiled.Events.EventArgs.Player; -using InventorySystem.Items.Pickups; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using UnityEngine; - -namespace KE.Map.Utils -{ - public class InteractiblePickup - { - private HashSet> _actions = new(); - private ushort _pickupSerial; - private Pickup _pickup; - private InteractiblePickup(Pickup pickup) - { - _pickupSerial = pickup.Serial; - _pickup = pickup; - SubscribeEvent(); - } - - private InteractiblePickup(Pickup pickup, Vector3 sizePickup) - { - _pickup = pickup; - _pickupSerial = pickup.Serial; - PickupSyncInfo info = pickup.Base.NetworkInfo; - pickup.Scale = sizePickup; - pickup.Base.NetworkInfo = info; - pickup.Base.GetComponent().isKinematic = true; - SubscribeEvent(); - } - - - public InteractiblePickup(ItemType itemType, Vector3 position, Vector3 scalePickup,float? pickupTime, Quaternion? rotation, bool useGravity = false) - { - var pickup = Pickup.CreateAndSpawn(itemType, position, rotation); - _pickup = pickup; - - _pickup.Weight = pickupTime ?? 0; - pickup.Rigidbody.useGravity = useGravity; - pickup.Rigidbody.detectCollisions = false; - - Renderer renderer = pickup.GameObject.GetComponentInChildren(); - renderer.forceRenderingOff = true; - - _pickupSerial = pickup.Serial; - PickupSyncInfo info = pickup.Base.NetworkInfo; - pickup.Scale = scalePickup; - pickup.Base.NetworkInfo = info; - pickup.Base.GetComponent().isKinematic = true; - - SubscribeEvent(); - } - - public void Destroy() - { - UnsubscribeEvent(); - _actions = null; - _pickup.Destroy(); - } - - - - ~InteractiblePickup() - { - UnsubscribeEvent(); - } - - private void UnsubscribeEvent() - { - Exiled.Events.Handlers.Player.PickingUpItem -= OnPickingUpItem; - } - - private void SubscribeEvent() - { - Exiled.Events.Handlers.Player.PickingUpItem += OnPickingUpItem; - } - - public bool AddAction(Action a) - { - return _actions.Add(a); - } - - public void OnPickingUpItem(PickingUpItemEventArgs ev) - { - if (ev.Pickup.Serial != _pickupSerial) return; - ev.IsAllowed = false; - - foreach (var action in _actions) - { - action?.Invoke(ev.Player); - } - } - - public static Vector3 GetPickupTrueSize(Pickup pickup) - { - return GetTrueSize(pickup.GameObject); - } - public Vector3 GetPickupTrueSize() - { - return GetTrueSize(_pickup.GameObject); - } - - public static Vector3 GetTrueSize(GameObject gameObject) - { - if (gameObject == null) - return Vector3.zero; - - Renderer renderer = gameObject.GetComponentInChildren(); - if (renderer != null) - return renderer.bounds.size; - - Collider collider = gameObject.GetComponentInChildren(); - if (collider != null) - return collider.bounds.size; - - return Vector3.zero; - } - - - - - - } - - -} From 63ac322d0adfc19191d2810fc4f8b2dcc4659221 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Sun, 28 Sep 2025 15:21:28 +0200 Subject: [PATCH 361/853] added color to custom roles + removed useless attribute --- .../API/Features/GlobalCustomRole.cs | 2 + .../API/Features/KEAbilities.cs | 37 +++--- .../API/Features/KECustomRole.cs | 36 +++++- .../KE.CustomRoles/API/Interfaces/IColor.cs | 15 +++ .../KE.CustomRoles/Abilities/ForceOpen.cs | 105 ++++++++++++++++++ .../CR/ChaosInsurgency/LeRusse.cs | 3 +- .../CR/ChaosInsurgency/Negotiator.cs | 3 +- .../KE.CustomRoles/CR/ClassD/DBoyInShape.cs | 61 ++-------- .../KE.CustomRoles/CR/ClassD/Enfant.cs | 3 +- .../KE.CustomRoles/CR/ClassD/Mime.cs | 3 +- .../KE.CustomRoles/CR/Guard/ChiefGuard.cs | 3 +- .../KE.CustomRoles/CR/Guard/Guard914.cs | 3 +- .../KE.CustomRoles/CR/Human/Alzheimer.cs | 1 - .../KE.CustomRoles/CR/Human/Asthmatique.cs | 3 +- KruacentExiled/KE.CustomRoles/CR/Human/Big.cs | 1 - .../KE.CustomRoles/CR/Human/Cleptoman.cs | 1 - .../KE.CustomRoles/CR/Human/Curiosophile.cs | 1 - .../KE.CustomRoles/CR/Human/Diabetique.cs | 3 +- .../KE.CustomRoles/CR/Human/Hitman.cs | 3 +- .../KE.CustomRoles/CR/Human/Inverted.cs | 1 - .../KE.CustomRoles/CR/Human/Maladroit.cs | 3 +- .../KE.CustomRoles/CR/Human/Paper.cs | 4 +- .../KE.CustomRoles/CR/Human/Paper2.cs | 4 +- KruacentExiled/KE.CustomRoles/CR/MTF/Pilot.cs | 1 - KruacentExiled/KE.CustomRoles/CR/MTF/Tank.cs | 10 +- .../KE.CustomRoles/CR/MTF/Terroriste.cs | 3 +- KruacentExiled/KE.CustomRoles/CR/SCP/Paper.cs | 1 - .../KE.CustomRoles/CR/SCP/SCP457.cs | 4 +- KruacentExiled/KE.CustomRoles/CR/SCP/Small.cs | 1 - KruacentExiled/KE.CustomRoles/CR/SCP/Tall.cs | 2 +- KruacentExiled/KE.CustomRoles/CR/SCP/Ultra.cs | 3 +- .../KE.CustomRoles/CR/SCP/ZombieDoorman.cs | 40 ------- .../CR/Scientist/GambleAddict.cs | 1 - .../CR/Scientist/ZoneManager.cs | 3 +- KruacentExiled/KE.CustomRoles/MainPlugin.cs | 9 +- .../KE.CustomRoles/Settings/SettingHandler.cs | 7 +- 36 files changed, 217 insertions(+), 167 deletions(-) create mode 100644 KruacentExiled/KE.CustomRoles/API/Interfaces/IColor.cs create mode 100644 KruacentExiled/KE.CustomRoles/Abilities/ForceOpen.cs delete mode 100644 KruacentExiled/KE.CustomRoles/CR/SCP/ZombieDoorman.cs diff --git a/KruacentExiled/KE.CustomRoles/API/Features/GlobalCustomRole.cs b/KruacentExiled/KE.CustomRoles/API/Features/GlobalCustomRole.cs index 3d6e733a..20b5e9e4 100644 --- a/KruacentExiled/KE.CustomRoles/API/Features/GlobalCustomRole.cs +++ b/KruacentExiled/KE.CustomRoles/API/Features/GlobalCustomRole.cs @@ -27,6 +27,8 @@ public abstract class GlobalCustomRole : KECustomRole public override bool KeepInventoryOnSpawn { get; set; } = true; public override bool RemovalKillsPlayer => false; + + public override void AddRole(Player player) { SideEnum side = SideClass.Get(player.Role.Side); diff --git a/KruacentExiled/KE.CustomRoles/API/Features/KEAbilities.cs b/KruacentExiled/KE.CustomRoles/API/Features/KEAbilities.cs index ae0ce961..e28961af 100644 --- a/KruacentExiled/KE.CustomRoles/API/Features/KEAbilities.cs +++ b/KruacentExiled/KE.CustomRoles/API/Features/KEAbilities.cs @@ -1,5 +1,6 @@ using Exiled.API.Features; using Exiled.API.Features.Core.UserSettings; +using Exiled.API.Features.Pools; using Exiled.CustomRoles.API.Features; using Exiled.Events.EventArgs.Player; using KE.CustomRoles.Settings; @@ -11,6 +12,7 @@ using System.Collections.Generic; using System.Linq; using System.Reflection; +using System.Text; using UserSettings.ServerSpecific; using UserSettings.UserInterfaceSettings; using static PlayerList; @@ -196,7 +198,7 @@ public void SelectAbility(Player player) if (Selected.Add(player)) { Log.Debug($"player {player.Nickname} selected ability {this}"); - foreach (KEAbilities abilities in Registered.Where(a => a != this)) + foreach (KEAbilities abilities in Registered.Where(a => a != this && a.Players.Contains(player))) { abilities.UnselectAbility(player); } @@ -497,7 +499,8 @@ public static void UpdateAllGUI() } public static void UpdateGUI(Player player) { - string msg = ""; + StringBuilder builder = StringBuilderPool.Pool.Get(); + List allAbilities = PlayersAbility[player]; @@ -507,34 +510,38 @@ public static void UpdateGUI(Player player) KEAbilities ability = allAbilities[i]; - msg += $"{ability.Name} "; + builder.Append(ability.Name); + builder.Append(" "); + if (ability.CanUse(player,out var output)) { - msg += "[READY]"; + builder.Append("[READY]"); } else { DateTime dateTime = ability.LastUsed[player] + TimeSpan.FromSeconds(ability.Cooldown); - msg += $"[{Math.Round((dateTime - DateTime.Now).TotalSeconds, 0)}s]"; + builder.Append("["); + builder.Append(Math.Round((dateTime - DateTime.Now).TotalSeconds, 0)); + builder.Append("s]"); } - - - //Log.Debug($"ability {ability.Name} contain {ability.Selected.Count} "); if (ability.Selected.Contains(player)) { - //todo replace with the settings - msg += SettingHandler.baseArrow; - } - + string arrow = SettingHandler.Instance.GetArrow(player); + if (string.IsNullOrEmpty(arrow)) + { + arrow = SettingHandler.baseArrow; + } - msg += "\n"; + builder.Append(arrow); + } + builder.AppendLine(); } - //Log.Debug(msg); - + string msg = builder.ToString(); + StringBuilderPool.Pool.Return(builder); DisplayHandler.Instance.AddHint(MainPlugin.Abilities, player, msg, 1f); } diff --git a/KruacentExiled/KE.CustomRoles/API/Features/KECustomRole.cs b/KruacentExiled/KE.CustomRoles/API/Features/KECustomRole.cs index 11c76aa3..39967199 100644 --- a/KruacentExiled/KE.CustomRoles/API/Features/KECustomRole.cs +++ b/KruacentExiled/KE.CustomRoles/API/Features/KECustomRole.cs @@ -1,14 +1,17 @@ using Exiled.API.Enums; using Exiled.API.Extensions; using Exiled.API.Features; +using Exiled.API.Features.Pools; using Exiled.CustomRoles.API; using Exiled.CustomRoles.API.Features; using InventorySystem.Configs; +using KE.CustomRoles.API.Interfaces; using KE.Utils.API.Displays.DisplayMeow; using MEC; using PlayerRoles; using System.Collections.Generic; using System.Linq; +using System.Text; using UnityEngine; namespace KE.CustomRoles.API.Features @@ -39,21 +42,40 @@ public override string Name public sealed override bool IgnoreSpawnSystem { get; set; } = true; protected override void ShowMessage(Player player) { - //string msg = MainPlugin.Translations.GettingNewRole; //msg = msg.Replace("%Name%", PublicName).Replace("%Desc%",Description); + StringBuilder sb =StringBuilderPool.Pool.Get(); + sb.Append(""); + IColor color = this as IColor; + if (color != null) + { + sb.Append(""); + } + + sb.Append(PublicName); + + if (color != null) + { + sb.Append(""); + } - string msg = $"{PublicName}"; + + + + sb.AppendLine(""); if (MainPlugin.SettingHandler.GetDescriptionsSettings(player)) { - msg += $"\n {Description}"; + sb.AppendLine(Description); } float delay = MainPlugin.SettingHandler.GetTime(player); - DisplayHandler.Instance.AddHint(MainPlugin.CRHint, player, msg, delay); + DisplayHandler.Instance.AddHint(MainPlugin.CRHint, player, sb.ToString(), delay); + StringBuilderPool.Pool.Return(sb); } @@ -64,6 +86,7 @@ protected void ShowEffectHint(Player player, string text) DisplayHandler.Instance.AddHint(MainPlugin.CREffect, player, text, delay); } + public override void AddRole(Player player) { Player player2 = player; @@ -137,6 +160,7 @@ public override void AddRole(Player player) } } + KEAbilities.TryRemoveFromPlayer(player); if(Abilities != null) { @@ -215,7 +239,7 @@ public static void GiveRandomRole(Player player) { if (player == null) return; - if (UnityEngine.Random.Range(0, 101) > Chance) + if (Random.Range(0, 101) > Chance) { Log.Debug("no luck"); return; @@ -234,7 +258,7 @@ public static void GiveRandomRole(Player player) //error assigning cr to a player with a gcr cr?.AddRole(player); } - + public static void GiveRole(IEnumerable players) { foreach (Player p in players) diff --git a/KruacentExiled/KE.CustomRoles/API/Interfaces/IColor.cs b/KruacentExiled/KE.CustomRoles/API/Interfaces/IColor.cs new file mode 100644 index 00000000..ab1912f0 --- /dev/null +++ b/KruacentExiled/KE.CustomRoles/API/Interfaces/IColor.cs @@ -0,0 +1,15 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using UnityEngine; + +namespace KE.CustomRoles.API.Interfaces +{ + public interface IColor + { + + Color32 Color { get; } + } +} diff --git a/KruacentExiled/KE.CustomRoles/Abilities/ForceOpen.cs b/KruacentExiled/KE.CustomRoles/Abilities/ForceOpen.cs new file mode 100644 index 00000000..10224972 --- /dev/null +++ b/KruacentExiled/KE.CustomRoles/Abilities/ForceOpen.cs @@ -0,0 +1,105 @@ +using Exiled.API.Enums; +using Exiled.API.Extensions; +using Exiled.API.Features; +using Exiled.API.Features.Attributes; +using Exiled.CustomRoles.API.Features; +using Exiled.Events.EventArgs.Player; +using KE.CustomRoles.API.Features; +using PlayerRoles; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using UnityEngine; + +namespace KE.CustomRoles.Abilities +{ + public class ForceOpen : KEAbilities + { + public override string Name { get; } = "Force open"; + + public override string Description { get; } = "Force open a door"; + + public override int Id => 2008; + + public override float Cooldown { get; } = 30; + private Dictionary abilityActivated = new(); + public static readonly TimeSpan MaxTime = new (0, 0, 30); + + protected override void AbilityUsed(Player player) + { + if (abilityActivated.ContainsKey(player)) + { + abilityActivated[player] = DateTime.Now; + } + else + { + abilityActivated.Add(player, DateTime.Now); + } + + + + } + + private void InteractingDoor(InteractingDoorEventArgs ev) + { + Player player = ev.Player; + if (!abilityActivated.ContainsKey(player)) return; + if (DateTime.Now > abilityActivated[player] + MaxTime) return; + if (ev.IsAllowed) return; + if (ev.Door.DoorLockType > DoorLockType.Lockdown079) return; + + + int successRate; + int damage; + + if (ev.Door.Type.IsGate()) + { + successRate = 20; + damage = 20; + } + else if (ev.Door.Type.IsCheckpoint()) + { + successRate = 30; + damage = 10; + } + else + { + successRate = 40; + damage = 5; + } + + int proba = UnityEngine.Random.Range(0, 101); + + if (proba <= successRate) + { + ev.IsAllowed = true; + } + else + { + MainPlugin.ShowEffectHint(player, $"T'as échoué d'ouvrir la porte et t'as perdu {damage} HP !"); + player.Hurt(damage, "Door too stronk"); + } + + + + + + } + + + protected override void SubscribeEvents() + { + Exiled.Events.Handlers.Player.InteractingDoor += InteractingDoor; + base.SubscribeEvents(); + } + + protected override void UnsubscribeEvents() + { + Exiled.Events.Handlers.Player.InteractingDoor -= InteractingDoor; + base.UnsubscribeEvents(); + } + + } +} diff --git a/KruacentExiled/KE.CustomRoles/CR/ChaosInsurgency/LeRusse.cs b/KruacentExiled/KE.CustomRoles/CR/ChaosInsurgency/LeRusse.cs index 5d406b07..ee2c71e3 100644 --- a/KruacentExiled/KE.CustomRoles/CR/ChaosInsurgency/LeRusse.cs +++ b/KruacentExiled/KE.CustomRoles/CR/ChaosInsurgency/LeRusse.cs @@ -7,8 +7,7 @@ namespace KE.CustomRoles.CR.ChaosInsurgency { - [CustomRole(RoleTypeId.ChaosConscript)] - internal class Russe : KECustomRole + public class Russe : KECustomRole { public override string Description { get; set; } = "Tu es un maitre de jeu \ntu dois faire la roulette russe avec les autres joueurs"; public override uint Id { get; set; } = 1050; diff --git a/KruacentExiled/KE.CustomRoles/CR/ChaosInsurgency/Negotiator.cs b/KruacentExiled/KE.CustomRoles/CR/ChaosInsurgency/Negotiator.cs index 83e9512a..366b22fb 100644 --- a/KruacentExiled/KE.CustomRoles/CR/ChaosInsurgency/Negotiator.cs +++ b/KruacentExiled/KE.CustomRoles/CR/ChaosInsurgency/Negotiator.cs @@ -11,8 +11,7 @@ namespace KE.CustomRoles.CR.ChaosInsurgency { - [CustomRole(RoleTypeId.ChaosConscript)] - internal class Negotiator : KECustomRole + public class Negotiator : KECustomRole { public override string Description { get; set; } = "Who knew zombie could be so great listeners"; public override uint Id { get; set; } = 1071; diff --git a/KruacentExiled/KE.CustomRoles/CR/ClassD/DBoyInShape.cs b/KruacentExiled/KE.CustomRoles/CR/ClassD/DBoyInShape.cs index 7b34aa77..eb097e5f 100644 --- a/KruacentExiled/KE.CustomRoles/CR/ClassD/DBoyInShape.cs +++ b/KruacentExiled/KE.CustomRoles/CR/ClassD/DBoyInShape.cs @@ -13,12 +13,12 @@ using System.Collections.Generic; using System.Linq; using UnityEngine; +using UnityEngine.Experimental.GlobalIllumination; using Utils.NonAllocLINQ; namespace KE.CustomRoles.CR.ClassD { - [CustomRole(RoleTypeId.ClassD)] - internal class DBoyInShape : KECustomRole + public class DBoyInShape : KECustomRole { public override string Description { get; set; } = "Dammmmnnnnnnn les gates"; public override uint Id { get; set; } = 1058; @@ -29,64 +29,21 @@ internal class DBoyInShape : KECustomRole public override float SpawnChance { get; set; } = 100; public override int MaxHealth { get; set; } = 100; - private const byte _speedReduction = 15; + public const byte SpeedReduction = 15; + + public override HashSet Abilities => new() + { + 2008 + }; protected override void RoleAdded(Player player) { - player.EnableEffect(EffectType.Slowness, 5, _speedReduction); + player.EnableEffect(EffectType.Slowness, 5, SpeedReduction); } protected override void RoleRemoved(Player player) { player.DisableEffect(EffectType.Slowness); } - - protected override void SubscribeEvents() - { - Exiled.Events.Handlers.Player.InteractingDoor += InteractingDoor; - } - - protected override void UnsubscribeEvents() - { - Exiled.Events.Handlers.Player.InteractingDoor -= InteractingDoor; - } - - public void InteractingDoor(InteractingDoorEventArgs ev) - { - if (ev.IsAllowed) return; - if (!Check(ev.Player)) return; - - int successRate; - int damage; - - if (ev.Door.Type.IsGate()) - { - successRate = 20; - damage = 20; - } - else if (ev.Door.Type.IsCheckpoint()) - { - successRate = 30; - damage = 10; - } - else - { - successRate = 40; - damage = 5; - } - - int proba = UnityEngine.Random.Range(0, 101); - - if (proba <= successRate) - { - ev.IsAllowed = true; - Log.Info($"{ev.Player.Nickname} a réussi à ouvrir une {ev.Door.Type} !"); - } - else - { - Log.Info($"{ev.Player.Nickname} a échoué à ouvrir une {ev.Door.Type} et a perdu {damage} HP !"); - ev.Player.Hurt(damage, DamageType.SeveredHands); - } - } } } \ No newline at end of file diff --git a/KruacentExiled/KE.CustomRoles/CR/ClassD/Enfant.cs b/KruacentExiled/KE.CustomRoles/CR/ClassD/Enfant.cs index 0823311b..0d9567b7 100644 --- a/KruacentExiled/KE.CustomRoles/CR/ClassD/Enfant.cs +++ b/KruacentExiled/KE.CustomRoles/CR/ClassD/Enfant.cs @@ -7,8 +7,7 @@ namespace KE.CustomRoles.CR.ClassD { - [CustomRole(RoleTypeId.ClassD)] - internal class Enfant : KECustomRole + public class Enfant : KECustomRole { public override string Description { get; set; } = "Tu es un Enfant \ndo not the kid \ntu commences avec un bonbon arc-en-ciel \n t'es un peu plus petit que la normal"; public override uint Id { get; set; } = 1041; diff --git a/KruacentExiled/KE.CustomRoles/CR/ClassD/Mime.cs b/KruacentExiled/KE.CustomRoles/CR/ClassD/Mime.cs index 807554b7..c953f979 100644 --- a/KruacentExiled/KE.CustomRoles/CR/ClassD/Mime.cs +++ b/KruacentExiled/KE.CustomRoles/CR/ClassD/Mime.cs @@ -11,8 +11,7 @@ namespace KE.CustomRoles.CR.ClassD { - [CustomRole(RoleTypeId.ClassD)] - internal class Mime : KECustomRole + public class Mime : KECustomRole { public override string Description { get; set; } = "Tu es un Mime \nTu ne peux pas parler\nmais tu fais très peu de bruit quand tu marches\net t'es tout plat"; public override uint Id { get; set; } = 1053; diff --git a/KruacentExiled/KE.CustomRoles/CR/Guard/ChiefGuard.cs b/KruacentExiled/KE.CustomRoles/CR/Guard/ChiefGuard.cs index b607af37..fd7c64c3 100644 --- a/KruacentExiled/KE.CustomRoles/CR/Guard/ChiefGuard.cs +++ b/KruacentExiled/KE.CustomRoles/CR/Guard/ChiefGuard.cs @@ -6,8 +6,7 @@ namespace KE.CustomRoles.CR.Guard { - [CustomRole(RoleTypeId.FacilityGuard)] - internal class ChiefGuard : KECustomRole + public class ChiefGuard : KECustomRole { public override string Description { get; set; } = "Tu es un Chef des gardes du site \nT'as une carte de private \net un crossvec"; public override uint Id { get; set; } = 1046; diff --git a/KruacentExiled/KE.CustomRoles/CR/Guard/Guard914.cs b/KruacentExiled/KE.CustomRoles/CR/Guard/Guard914.cs index e5a5a95f..ccb7c027 100644 --- a/KruacentExiled/KE.CustomRoles/CR/Guard/Guard914.cs +++ b/KruacentExiled/KE.CustomRoles/CR/Guard/Guard914.cs @@ -7,8 +7,7 @@ namespace KE.CustomRoles.CR.Guard { - [CustomRole(RoleTypeId.FacilityGuard)] - internal class Guard914 : KECustomRole + public class Guard914 : KECustomRole { public override string Description { get; set; } = "Tu es Le garde de SCP-914 \nTu commences à 914 \nmais on a volé ta carte \net ntm aussi"; public override uint Id { get; set; } = 1045; diff --git a/KruacentExiled/KE.CustomRoles/CR/Human/Alzheimer.cs b/KruacentExiled/KE.CustomRoles/CR/Human/Alzheimer.cs index 55e5c88b..c0677310 100644 --- a/KruacentExiled/KE.CustomRoles/CR/Human/Alzheimer.cs +++ b/KruacentExiled/KE.CustomRoles/CR/Human/Alzheimer.cs @@ -12,7 +12,6 @@ namespace KE.CustomRoles.CR.Human { - [CustomRole(RoleTypeId.None)] internal class Alzheimer : GlobalCustomRole { private static Dictionary _coroutines = new(); diff --git a/KruacentExiled/KE.CustomRoles/CR/Human/Asthmatique.cs b/KruacentExiled/KE.CustomRoles/CR/Human/Asthmatique.cs index a2cc6966..fea96932 100644 --- a/KruacentExiled/KE.CustomRoles/CR/Human/Asthmatique.cs +++ b/KruacentExiled/KE.CustomRoles/CR/Human/Asthmatique.cs @@ -10,8 +10,7 @@ namespace KE.CustomRoles.CR.Human { - [CustomRole(RoleTypeId.None)] - internal class Asthmatique : GlobalCustomRole + public class Asthmatique : GlobalCustomRole { public override SideEnum Side { get; set; } = SideEnum.Human; public override string Description { get; set; } = "Tu es asthmatique\nT'as stamina est réduit de moitié\nMais tu vises mieux"; diff --git a/KruacentExiled/KE.CustomRoles/CR/Human/Big.cs b/KruacentExiled/KE.CustomRoles/CR/Human/Big.cs index 9de4c432..ba343ea1 100644 --- a/KruacentExiled/KE.CustomRoles/CR/Human/Big.cs +++ b/KruacentExiled/KE.CustomRoles/CR/Human/Big.cs @@ -7,7 +7,6 @@ namespace KE.CustomRoles.CR.Human { - [CustomRole(RoleTypeId.None)] public class Big : GlobalCustomRole { public override SideEnum Side { get; set; } = SideEnum.Human; diff --git a/KruacentExiled/KE.CustomRoles/CR/Human/Cleptoman.cs b/KruacentExiled/KE.CustomRoles/CR/Human/Cleptoman.cs index 89a1d900..9a6d284f 100644 --- a/KruacentExiled/KE.CustomRoles/CR/Human/Cleptoman.cs +++ b/KruacentExiled/KE.CustomRoles/CR/Human/Cleptoman.cs @@ -7,7 +7,6 @@ namespace KE.CustomRoles.CR.Human { - [CustomRole(RoleTypeId.None)] public class Cleptoman : GlobalCustomRole { public override SideEnum Side { get; set; } = SideEnum.Human; diff --git a/KruacentExiled/KE.CustomRoles/CR/Human/Curiosophile.cs b/KruacentExiled/KE.CustomRoles/CR/Human/Curiosophile.cs index 9c488670..16ad6ec4 100644 --- a/KruacentExiled/KE.CustomRoles/CR/Human/Curiosophile.cs +++ b/KruacentExiled/KE.CustomRoles/CR/Human/Curiosophile.cs @@ -17,7 +17,6 @@ namespace KE.CustomRoles.CR.Human { - [CustomRole(RoleTypeId.None)] internal class Curiosophile : GlobalCustomRole { public override SideEnum Side { get; set; } = SideEnum.Human; diff --git a/KruacentExiled/KE.CustomRoles/CR/Human/Diabetique.cs b/KruacentExiled/KE.CustomRoles/CR/Human/Diabetique.cs index 8e05fe66..d06ea038 100644 --- a/KruacentExiled/KE.CustomRoles/CR/Human/Diabetique.cs +++ b/KruacentExiled/KE.CustomRoles/CR/Human/Diabetique.cs @@ -10,8 +10,7 @@ namespace KE.CustomRoles.CR.Human { - [CustomRole(RoleTypeId.None)] - internal class Diabetique : GlobalCustomRole + public class Diabetique : GlobalCustomRole { public override SideEnum Side { get; set; } = SideEnum.Human; public override string Description { get; set; } = "Tu es diabetique\nT'as mangé le crambleu au pomme de mael"; diff --git a/KruacentExiled/KE.CustomRoles/CR/Human/Hitman.cs b/KruacentExiled/KE.CustomRoles/CR/Human/Hitman.cs index 8a99f513..27b973a2 100644 --- a/KruacentExiled/KE.CustomRoles/CR/Human/Hitman.cs +++ b/KruacentExiled/KE.CustomRoles/CR/Human/Hitman.cs @@ -12,8 +12,7 @@ namespace KE.CustomRoles.CR.Human { - [CustomRole(RoleTypeId.None)] - internal class Hitman : GlobalCustomRole + public class Hitman : GlobalCustomRole { private static CoroutineHandle _coroutines; public override SideEnum Side { get; set; } = SideEnum.Human; diff --git a/KruacentExiled/KE.CustomRoles/CR/Human/Inverted.cs b/KruacentExiled/KE.CustomRoles/CR/Human/Inverted.cs index 54592544..e5c217da 100644 --- a/KruacentExiled/KE.CustomRoles/CR/Human/Inverted.cs +++ b/KruacentExiled/KE.CustomRoles/CR/Human/Inverted.cs @@ -9,7 +9,6 @@ namespace KE.CustomRoles.CR.Human { - [CustomRole(RoleTypeId.None)] public class Inverted : GlobalCustomRole { public override SideEnum Side { get; set; } = SideEnum.Human; diff --git a/KruacentExiled/KE.CustomRoles/CR/Human/Maladroit.cs b/KruacentExiled/KE.CustomRoles/CR/Human/Maladroit.cs index 81ea4a7f..5bb88b17 100644 --- a/KruacentExiled/KE.CustomRoles/CR/Human/Maladroit.cs +++ b/KruacentExiled/KE.CustomRoles/CR/Human/Maladroit.cs @@ -15,8 +15,7 @@ namespace KE.CustomRoles.CR.Human { - [CustomRole(RoleTypeId.None)] - internal class Maladroit : GlobalCustomRole + public class Maladroit : GlobalCustomRole { private static Dictionary _coroutines = new(); diff --git a/KruacentExiled/KE.CustomRoles/CR/Human/Paper.cs b/KruacentExiled/KE.CustomRoles/CR/Human/Paper.cs index 8c866c72..2ec82b2d 100644 --- a/KruacentExiled/KE.CustomRoles/CR/Human/Paper.cs +++ b/KruacentExiled/KE.CustomRoles/CR/Human/Paper.cs @@ -7,7 +7,7 @@ namespace KE.CustomRoles.CR.Human { - [CustomRole(RoleTypeId.None)] + /* public class Paper : GlobalCustomRole { public override SideEnum Side { get; set; } = SideEnum.Human; @@ -19,5 +19,5 @@ public class Paper : GlobalCustomRole public override float SpawnChance { get; set; } = 100; public override Vector3 Scale { get; set; } = new Vector3(0.2f, 1, 1); - } + }*/ } \ No newline at end of file diff --git a/KruacentExiled/KE.CustomRoles/CR/Human/Paper2.cs b/KruacentExiled/KE.CustomRoles/CR/Human/Paper2.cs index c531f4f2..695bbca5 100644 --- a/KruacentExiled/KE.CustomRoles/CR/Human/Paper2.cs +++ b/KruacentExiled/KE.CustomRoles/CR/Human/Paper2.cs @@ -7,7 +7,7 @@ namespace KE.CustomRoles.CR.Human { - [CustomRole(RoleTypeId.None)] + /* public class Paper2 : GlobalCustomRole { public override SideEnum Side { get; set; } = SideEnum.Human; @@ -19,5 +19,5 @@ public class Paper2 : GlobalCustomRole public override float SpawnChance { get; set; } = 100; public override Vector3 Scale { get; set; } = new Vector3(0.2f, 1, 1); - } + }*/ } \ No newline at end of file diff --git a/KruacentExiled/KE.CustomRoles/CR/MTF/Pilot.cs b/KruacentExiled/KE.CustomRoles/CR/MTF/Pilot.cs index ce3ad505..b405fcaf 100644 --- a/KruacentExiled/KE.CustomRoles/CR/MTF/Pilot.cs +++ b/KruacentExiled/KE.CustomRoles/CR/MTF/Pilot.cs @@ -12,7 +12,6 @@ namespace KE.CustomRoles.CR.MTF { - [CustomRole(RoleTypeId.NtfPrivate)] public class Pilot : KECustomRole { public override string Description { get; set; } = "So I haveth a Laser Pointere"; diff --git a/KruacentExiled/KE.CustomRoles/CR/MTF/Tank.cs b/KruacentExiled/KE.CustomRoles/CR/MTF/Tank.cs index d2866003..b6e25b73 100644 --- a/KruacentExiled/KE.CustomRoles/CR/MTF/Tank.cs +++ b/KruacentExiled/KE.CustomRoles/CR/MTF/Tank.cs @@ -8,20 +8,20 @@ using UnityEngine; using System; using KE.CustomRoles.API.Features; +using KE.CustomRoles.API.Interfaces; namespace KE.CustomRoles.CR.MTF { - [CustomRole(RoleTypeId.NtfCaptain)] - internal class Tank : KECustomRole + public class Tank : KECustomRole, IColor { - public override string Description { get; set; } = "Tu es un TANK tu es débuff mais ta force de tir est démultiplié (fait attention à tes balles)"; + public override string Description { get; set; } = "Tu es débuff mais ta force de tir est démultiplié (fait attention à tes balles)"; public override uint Id { get; set; } = 1051; public override string PublicName { get; set; } = "Tank"; public override int MaxHealth { get; set; } = 200; public override RoleTypeId Role { get; set; } = RoleTypeId.NtfCaptain; public override bool KeepRoleOnDeath { get; set; } = false; public override bool KeepRoleOnChangingRole { get; set; } = false; - + public Color32 Color => new (255, 192, 203,0); public override float SpawnChance { get; set; } = 100; public override Vector3 Scale { get; set; } = new Vector3(1.15f, 1f, 1.15f); @@ -43,6 +43,8 @@ internal class Tank : KECustomRole { AmmoType.Nato556, 200} }; + + protected override void SubscribeEvents() { Player.Shooting += Shooting; diff --git a/KruacentExiled/KE.CustomRoles/CR/MTF/Terroriste.cs b/KruacentExiled/KE.CustomRoles/CR/MTF/Terroriste.cs index d89aed2e..aa1e0a66 100644 --- a/KruacentExiled/KE.CustomRoles/CR/MTF/Terroriste.cs +++ b/KruacentExiled/KE.CustomRoles/CR/MTF/Terroriste.cs @@ -7,8 +7,7 @@ namespace KE.CustomRoles.CR.MTF { - [CustomRole(RoleTypeId.NtfSergeant)] - internal class Terroriste : KECustomRole + public class Terroriste : KECustomRole { public override string Description { get; set; } = "Tu es un Terroriste \nne fait pas exploser la facilité \ntu commences avec des grenades"; public override uint Id { get; set; } = 1052; diff --git a/KruacentExiled/KE.CustomRoles/CR/SCP/Paper.cs b/KruacentExiled/KE.CustomRoles/CR/SCP/Paper.cs index 2e42feee..25c45258 100644 --- a/KruacentExiled/KE.CustomRoles/CR/SCP/Paper.cs +++ b/KruacentExiled/KE.CustomRoles/CR/SCP/Paper.cs @@ -5,7 +5,6 @@ namespace KE.CustomRoles.CR.SCP { - [CustomRole(RoleTypeId.None)] public class Paper : GlobalCustomRole { public override string Description { get; set; } = "uh oh. paper jam"; diff --git a/KruacentExiled/KE.CustomRoles/CR/SCP/SCP457.cs b/KruacentExiled/KE.CustomRoles/CR/SCP/SCP457.cs index b37d0f90..fe21e6c9 100644 --- a/KruacentExiled/KE.CustomRoles/CR/SCP/SCP457.cs +++ b/KruacentExiled/KE.CustomRoles/CR/SCP/SCP457.cs @@ -17,12 +17,10 @@ namespace KE.CustomRoles.CR.SCP { - [CustomRole(RoleTypeId.Scp106)] public class SCP457 : CustomSCP { - - public override string Description { get; set; } = "You passive damage around you, and can lauch fireballs by pressing the stalk button"; + public override string Description { get; set; } = "You do passive damage around you, and can lauch fireballs by pressing the stalk button"; public override uint Id { get; set; } = 1084; public override string PublicName { get; set; } = "SCP-457"; public override int MaxHealth { get; set; } = 3900; diff --git a/KruacentExiled/KE.CustomRoles/CR/SCP/Small.cs b/KruacentExiled/KE.CustomRoles/CR/SCP/Small.cs index 019eb568..85f4de9d 100644 --- a/KruacentExiled/KE.CustomRoles/CR/SCP/Small.cs +++ b/KruacentExiled/KE.CustomRoles/CR/SCP/Small.cs @@ -6,7 +6,6 @@ namespace KE.CustomRoles.CR.SCP { - [CustomRole(RoleTypeId.None)] public class Small : GlobalCustomRole { public override string Description { get; set; } = "u smoll"; diff --git a/KruacentExiled/KE.CustomRoles/CR/SCP/Tall.cs b/KruacentExiled/KE.CustomRoles/CR/SCP/Tall.cs index 9bcee936..5b2a7df7 100644 --- a/KruacentExiled/KE.CustomRoles/CR/SCP/Tall.cs +++ b/KruacentExiled/KE.CustomRoles/CR/SCP/Tall.cs @@ -7,7 +7,7 @@ namespace KE.CustomRoles.CR.SCP { - /*[CustomRole(RoleTypeId.None)] + /* public class Tall : GlobalCustomRole { public override string Description { get; set; } = "u tall"; diff --git a/KruacentExiled/KE.CustomRoles/CR/SCP/Ultra.cs b/KruacentExiled/KE.CustomRoles/CR/SCP/Ultra.cs index 8be0a51e..6cc4caec 100644 --- a/KruacentExiled/KE.CustomRoles/CR/SCP/Ultra.cs +++ b/KruacentExiled/KE.CustomRoles/CR/SCP/Ultra.cs @@ -10,7 +10,6 @@ namespace KE.CustomRoles.CR.SCP { - [CustomRole(RoleTypeId.None)] public class Ultra : GlobalCustomRole { private static Dictionary _handles = new(); @@ -21,7 +20,7 @@ public class Ultra : GlobalCustomRole public override bool KeepRoleOnDeath { get; set; } = false; public override bool KeepRoleOnChangingRole { get; set; } = false; public override float MaxHealthMultiplicator { get; set; } = 1f; - public override float SpawnChance { get; set; } = 100; + public override float SpawnChance { get; set; } = 0; public const float RefreshRate = 20; public const int SizeText = 20; protected override void RoleAdded(Player player) diff --git a/KruacentExiled/KE.CustomRoles/CR/SCP/ZombieDoorman.cs b/KruacentExiled/KE.CustomRoles/CR/SCP/ZombieDoorman.cs deleted file mode 100644 index f02f6d92..00000000 --- a/KruacentExiled/KE.CustomRoles/CR/SCP/ZombieDoorman.cs +++ /dev/null @@ -1,40 +0,0 @@ -using Exiled.API.Features; -using Exiled.API.Features.Attributes; -using Exiled.CustomRoles.API.Features; -using KE.CustomRoles.Abilities; -using PlayerRoles; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace KE.CustomRoles.CR.SCP -{ - [CustomRole(RoleTypeId.Scp0492)] - internal class ZombieDoorman : CustomRole - { - public override string Name { get; set; } = "SCP-049-2-Door"; - public override string Description { get; set; } = "U can open lock door with ur ability clapclapclap"; - public override uint Id { get; set; } = 1053; - public override string CustomInfo { get; set; } = "SCP-049-2-Door"; - public override int MaxHealth { get; set; } = 400; - public override RoleTypeId Role { get; set; } = RoleTypeId.Scp0492; - public override bool KeepRoleOnDeath { get; set; } = false; - public override bool KeepRoleOnChangingRole { get; set; } = false; - public override bool IgnoreSpawnSystem { get; set; } = true; - - public override float SpawnChance { get; set; } = 100; - - - protected override void RoleAdded(Player player) - { - Log.Debug("adding 0493dror"); - } - - protected override void RoleRemoved(Player player) - { - Log.Debug("removing 0493dror"); - } - } -} diff --git a/KruacentExiled/KE.CustomRoles/CR/Scientist/GambleAddict.cs b/KruacentExiled/KE.CustomRoles/CR/Scientist/GambleAddict.cs index 65503a3f..76814231 100644 --- a/KruacentExiled/KE.CustomRoles/CR/Scientist/GambleAddict.cs +++ b/KruacentExiled/KE.CustomRoles/CR/Scientist/GambleAddict.cs @@ -9,7 +9,6 @@ namespace KE.CustomRoles.CR.Scientist { - [CustomRole(RoleTypeId.Scientist)] public class GambleAddict : KECustomRole { public override string Description { get; set; } = "Tu es un Gamble Addict \nT'as trade ton kit et ta carte contre 2 pièces \nfais en bon usage"; diff --git a/KruacentExiled/KE.CustomRoles/CR/Scientist/ZoneManager.cs b/KruacentExiled/KE.CustomRoles/CR/Scientist/ZoneManager.cs index b14f6789..c263e258 100644 --- a/KruacentExiled/KE.CustomRoles/CR/Scientist/ZoneManager.cs +++ b/KruacentExiled/KE.CustomRoles/CR/Scientist/ZoneManager.cs @@ -14,8 +14,7 @@ namespace KE.CustomRoles.CR.Scientist { - [CustomRole(RoleTypeId.Scientist)] - internal class ZoneManager : KECustomRole + public class ZoneManager : KECustomRole { public override string Description { get; set; } = "Incroyable tu peux avoir une promotion alors fais ton boulot et ouvre tous ces checkpoint et tu pourras sortir d'ici"; public override uint Id { get; set; } = 1044; diff --git a/KruacentExiled/KE.CustomRoles/MainPlugin.cs b/KruacentExiled/KE.CustomRoles/MainPlugin.cs index 2487ef26..ca2206e3 100644 --- a/KruacentExiled/KE.CustomRoles/MainPlugin.cs +++ b/KruacentExiled/KE.CustomRoles/MainPlugin.cs @@ -42,7 +42,7 @@ public override void OnEnabled() Harmony.PatchAll(); SettingHandler.SubscribeEvents(); KEAbilities.Register(Assembly); - CustomRole.RegisterRoles(false,null,true,Assembly); + CustomRole.RegisterRoles(false); SubscribeEvents(); } @@ -54,7 +54,6 @@ public override void OnDisabled() SettingHandler.UnsubscribeEvents(); Harmony.UnpatchAll(); - CustomAbility.UnregisterAbilities(); KEAbilities.Unregister(); UnsubscribeEvents(); _settingHandler = null; @@ -83,5 +82,11 @@ public void CustomRoleRespawning(RespawnedTeamEventArgs ev) { KECustomRole.GiveRole(ev.Players); } + + public static void ShowEffectHint(Player player, string text) + { + float delay = SettingHandler.GetTime(player); ; + DisplayHandler.Instance.AddHint(MainPlugin.CREffect, player, text, delay); + } } } diff --git a/KruacentExiled/KE.CustomRoles/Settings/SettingHandler.cs b/KruacentExiled/KE.CustomRoles/Settings/SettingHandler.cs index 1088088b..3a667c05 100644 --- a/KruacentExiled/KE.CustomRoles/Settings/SettingHandler.cs +++ b/KruacentExiled/KE.CustomRoles/Settings/SettingHandler.cs @@ -5,6 +5,7 @@ using KE.Utils.API.Interfaces; using System; using System.Collections.Generic; +using TMPro; using UserSettings.ServerSpecific; namespace KE.CustomRoles.Settings @@ -41,7 +42,7 @@ public SettingHandler() new KeybindSetting(_idDown, "Select down", UnityEngine.KeyCode.None,hintDescription:"only work in Select Wheel mode"), new KeybindSetting(_idSelect, "Use selected ability", UnityEngine.KeyCode.None,hintDescription:"only work in Select Wheel mode"), //this crashes the player idk why - //new UserTextInputSetting(_idArrow, "Personalize the arrow next to the selected ability",hintDescription:"only work in Select Wheel mode",placeHolder:baseArrow,onChanged:OnChangedArrow), + SettingBase.Create(new SSPlaintextSetting(_idArrow, "Personalize the arrow next to the selected ability", baseArrow, 64, TMP_InputField.ContentType.Standard, "only work in Select Wheel mode", 0)) }; } @@ -67,10 +68,6 @@ public void OnChanged(Player player, SettingBase setting) } - public void OnChangedArrow(Player player, SettingBase setting) - { - KEAbilities.UpdateGUI(player); - } public void SubscribeEvents() { From af6b0559b86542124520053b1efcbf1ec6d53b42 Mon Sep 17 00:00:00 2001 From: Omer <27omerf@gmail.com> Date: Sun, 28 Sep 2025 16:02:04 +0200 Subject: [PATCH 362/853] 2 new abilities and 5 new cr --- .../KE.CustomRoles/Abilities/SimulateDeath.cs | 45 ++++++ .../KE.CustomRoles/Abilities/Teleport.cs | 60 +++++++ .../KE.CustomRoles/CR/ClassD/Mime.cs | 5 +- .../KE.CustomRoles/CR/Guard/Introvert.cs | 37 +++++ .../KE.CustomRoles/CR/Human/Alzheimer.cs | 2 - KruacentExiled/KE.CustomRoles/CR/Human/Big.cs | 23 --- .../KE.CustomRoles/CR/Human/Crazy.cs | 146 ++++++++++++++++++ .../KE.CustomRoles/CR/Human/Enderman.cs | 25 +++ .../KE.CustomRoles/CR/Human/Paper.cs | 23 --- .../KE.CustomRoles/CR/SCP/ZombieDoorman.cs | 40 ----- 10 files changed, 317 insertions(+), 89 deletions(-) create mode 100644 KruacentExiled/KE.CustomRoles/Abilities/SimulateDeath.cs create mode 100644 KruacentExiled/KE.CustomRoles/Abilities/Teleport.cs create mode 100644 KruacentExiled/KE.CustomRoles/CR/Guard/Introvert.cs delete mode 100644 KruacentExiled/KE.CustomRoles/CR/Human/Big.cs create mode 100644 KruacentExiled/KE.CustomRoles/CR/Human/Crazy.cs create mode 100644 KruacentExiled/KE.CustomRoles/CR/Human/Enderman.cs delete mode 100644 KruacentExiled/KE.CustomRoles/CR/Human/Paper.cs delete mode 100644 KruacentExiled/KE.CustomRoles/CR/SCP/ZombieDoorman.cs diff --git a/KruacentExiled/KE.CustomRoles/Abilities/SimulateDeath.cs b/KruacentExiled/KE.CustomRoles/Abilities/SimulateDeath.cs new file mode 100644 index 00000000..183b5efb --- /dev/null +++ b/KruacentExiled/KE.CustomRoles/Abilities/SimulateDeath.cs @@ -0,0 +1,45 @@ +using Exiled.API.Features; +using KE.CustomRoles.API.Features; +using Exiled.API.Enums; +using PlayerRoles.FirstPersonControl.Thirdperson.Subcontrollers; +using System.Collections.Generic; +using UnityEngine; +using Exiled.API.Extensions; +using MEC; +using PlayerStatsSystem; + +namespace KE.CustomRoles.Abilities +{ + public class SimulateDeath : KEAbilities + { + public override string Name { get; } = "Simulate Death"; + + public override string Description { get; } = "T'es talent de mime te permettent de simuler la mort."; + + public override int Id => 2009; + public int Duration = 10; + + public override float Cooldown { get; } = 60f; + + protected override void AbilityUsed(Player player) + { + Dictionary deathTranslation = DeathTranslations.TranslationsById; + + Vector3 pScale = player.Scale; + Vector3 pPos = player.Position; + Ragdoll ragdoll = Ragdoll.CreateAndSpawn(player.Role, player.DisplayNickname, deathTranslation.GetRandomValue().ToString(), player.Position, player.ReferenceHub.PlayerCameraReference.rotation, player); + + player.EnableEffect(EffectType.Invisible, this.Duration); + player.EnableEffect(EffectType.Ensnared, this.Duration); + player.EnableEffect(EffectType.AmnesiaItems, this.Duration); + player.Scale = new Vector3(0.1f, 0.1f, 0.1f); + + Timing.CallDelayed(this.Duration, () => + { + ragdoll.Destroy(); + player.Scale = pScale; + player.Position = pPos; + }); + } + } +} diff --git a/KruacentExiled/KE.CustomRoles/Abilities/Teleport.cs b/KruacentExiled/KE.CustomRoles/Abilities/Teleport.cs new file mode 100644 index 00000000..70b5e947 --- /dev/null +++ b/KruacentExiled/KE.CustomRoles/Abilities/Teleport.cs @@ -0,0 +1,60 @@ +using Exiled.API.Extensions; +using Exiled.API.Features; +using KE.CustomRoles.API.Features; +using MapGeneration; +using System.Linq; +using UnityEngine; + +namespace KE.CustomRoles.Abilities +{ + public class Teleport : KEAbilities + { + public override string Name { get; } = "Teleportation"; + + public override string Description { get; } = ""; + + public override int Id => 2008; + + public override float Cooldown { get; } = 120f; + + protected override void AbilityUsed(Player player) + { + if(!SelectPosition.TryGetTarget(player, out Vector3 target)) + { + //show hint + Log.Info("no target selected"); + return; + } + + if (target.GetZone() == FacilityZone.LightContainment && Map.IsLczDecontaminated) + { + Log.Info("target in LCZ while LCZ is decontaminated."); + return; + } + + if (player.Health > 20) + { + player.Health -= 20; + } + else + { + player.Kill("You are dead."); + } + + if(UnityEngine.Random.Range(1, 101) < 5) + { + if (Player.List.Count() > 1) + { + player.Teleport(Player.List.Where(p => p != player).ToList().GetRandomValue()); + return; + } else + { + Log.Info("no other player to teleport to"); + return; + } + } + + player.Position = target; + } + } +} \ No newline at end of file diff --git a/KruacentExiled/KE.CustomRoles/CR/ClassD/Mime.cs b/KruacentExiled/KE.CustomRoles/CR/ClassD/Mime.cs index 807554b7..c8d6de73 100644 --- a/KruacentExiled/KE.CustomRoles/CR/ClassD/Mime.cs +++ b/KruacentExiled/KE.CustomRoles/CR/ClassD/Mime.cs @@ -36,6 +36,9 @@ protected override void RoleRemoved(Player player) player.DisableEffect(EffectType.SilentWalk); } - + public override HashSet Abilities { get; } = new() + { + 2009 + }; } } diff --git a/KruacentExiled/KE.CustomRoles/CR/Guard/Introvert.cs b/KruacentExiled/KE.CustomRoles/CR/Guard/Introvert.cs new file mode 100644 index 00000000..a4fd36bc --- /dev/null +++ b/KruacentExiled/KE.CustomRoles/CR/Guard/Introvert.cs @@ -0,0 +1,37 @@ +using Exiled.API.Enums; +using Exiled.API.Features.Attributes; +using Exiled.API.Features.Spawn; +using KE.CustomRoles.API.Features; +using PlayerRoles; +using System.Collections.Generic; + +namespace KE.CustomRoles.CR.Guard +{ + [CustomRole(RoleTypeId.FacilityGuard)] + internal class Introvert : KECustomRole + { + public override string Description { get; set; } = "Tu n'aimes pas trop les humains"; + public override uint Id { get; set; } = 1069; + public override string PublicName { get; set; } = "Introvert"; + public override int MaxHealth { get; set; } = 100; + public override RoleTypeId Role { get; set; } = RoleTypeId.FacilityGuard; + public override bool KeepRoleOnDeath { get; set; } = false; + public override bool KeepRoleOnChangingRole { get; set; } = false; + + public override float SpawnChance { get; set; } = 100; + + public override List Inventory { get; set; } = new List() + { + $"{ItemType.Radio}", + $"{ItemType.ArmorLight}", + $"{ItemType.GunFSP9}", + $"{ItemType.Medkit}", + $"{ItemType.Flashlight}" + }; + + public override Dictionary Ammo { get; set; } = new Dictionary() + { + { AmmoType.Nato556, 60} + }; + } +} diff --git a/KruacentExiled/KE.CustomRoles/CR/Human/Alzheimer.cs b/KruacentExiled/KE.CustomRoles/CR/Human/Alzheimer.cs index 55e5c88b..d3dc92c9 100644 --- a/KruacentExiled/KE.CustomRoles/CR/Human/Alzheimer.cs +++ b/KruacentExiled/KE.CustomRoles/CR/Human/Alzheimer.cs @@ -7,8 +7,6 @@ using MEC; using PlayerRoles; using System.Collections.Generic; -using UnityEngine; -using Utils.NonAllocLINQ; namespace KE.CustomRoles.CR.Human { diff --git a/KruacentExiled/KE.CustomRoles/CR/Human/Big.cs b/KruacentExiled/KE.CustomRoles/CR/Human/Big.cs deleted file mode 100644 index 9de4c432..00000000 --- a/KruacentExiled/KE.CustomRoles/CR/Human/Big.cs +++ /dev/null @@ -1,23 +0,0 @@ -using Exiled.API.Features.Attributes; -using Exiled.CustomRoles.API.Features; -using KE.CustomRoles.API.Features; -using PlayerRoles; -using System.Collections.Generic; -using UnityEngine; - -namespace KE.CustomRoles.CR.Human -{ - [CustomRole(RoleTypeId.None)] - public class Big : GlobalCustomRole - { - public override SideEnum Side { get; set; } = SideEnum.Human; - public override string Description { get; set; } = "Faut arrêter le McDo au bout d'un moment !"; - public override uint Id { get; set; } = 1068; - public override string PublicName { get; set; } = "Big"; - public override bool KeepRoleOnDeath { get; set; } = true; - public override bool KeepRoleOnChangingRole { get; set; } = true; - - public override float SpawnChance { get; set; } = 100; - public override Vector3 Scale { get; set; } = new Vector3(1, 1, 1.4f); - } -} \ No newline at end of file diff --git a/KruacentExiled/KE.CustomRoles/CR/Human/Crazy.cs b/KruacentExiled/KE.CustomRoles/CR/Human/Crazy.cs new file mode 100644 index 00000000..7402f71b --- /dev/null +++ b/KruacentExiled/KE.CustomRoles/CR/Human/Crazy.cs @@ -0,0 +1,146 @@ +using Exiled.API.Enums; +using Exiled.API.Extensions; +using Exiled.API.Features; +using Exiled.API.Features.Attributes; +using Exiled.CustomRoles.API.Features; +using KE.CustomRoles.API.Features; +using KE.Utils.Extensions; +using MEC; +using NetworkManagerUtils.Dummies; +using PlayerRoles; +using PlayerStatsSystem; +using System; +using System.Collections.Generic; +using System.Linq; +using UnityEngine; + +namespace KE.CustomRoles.CR.Human +{ + /// + /// Behaviour of the crazy custom role, with the name and the weight (the higher the weight, the more it will happen) + /// + public enum CrazyBehaviour + { + Jump, + Shoot, + Vision, + Crazying + } + + [CustomRole(RoleTypeId.None)] + internal class Crazy : GlobalCustomRole + { + private static CoroutineHandle _coroutines; + private static CoroutineHandle _crazyingCoroutine; + public override SideEnum Side { get; set; } = SideEnum.Human; + public override string Description { get; set; } = "Je pense que le traitement que t'as eu à la fondation t'as pas aidé"; + public override uint Id { get; set; } = 1068; + public override string PublicName { get; set; } = "Fou de la facilité"; + public override bool KeepRoleOnDeath { get; set; } = true; + public override bool KeepRoleOnChangingRole { get; set; } = true; + public override float SpawnChance { get; set; } = 100; + + private readonly Dictionary WeightDictionnary = new() + { + { CrazyBehaviour.Jump, 3 }, + { CrazyBehaviour.Shoot, 3 }, + { CrazyBehaviour.Vision, 2 }, + { CrazyBehaviour.Crazying, 1 } + }; + private List WeightedList; + private readonly float EFFECT_INTERVAL = UnityEngine.Random.Range(180, 300); + + protected override void RoleAdded(Player player) + { + PreparationEffect(); + _coroutines = Timing.RunCoroutine(ApplyEffect(player)); + } + + protected override void RoleRemoved(Player player) + { + Timing.KillCoroutines(_coroutines); + } + + private void PreparationEffect() + { + this.WeightedList = new List(); + + foreach (var cb in WeightDictionnary) + { + this.WeightedList.AddRange(Enumerable.Repeat(cb.Key, cb.Value)); + } + } + + private IEnumerator ApplyEffect(Player player) + { + while (true) + { + yield return Timing.WaitForSeconds(this.EFFECT_INTERVAL); + CrazyBehaviour behaviour = this.WeightedList.GetRandomValue(); + + switch (behaviour) + { + case CrazyBehaviour.Jump: + player.IsJumping = true; + break; + case CrazyBehaviour.Shoot: + Player.List.ToList().Where(p => p != player).ToList().ForEach(p => p.PlayGunSound(player.Position, FirearmType.FRMG0)); + player.PlayShieldBreakSound(); + break; + case CrazyBehaviour.Vision: + Vision(player); + break; + case CrazyBehaviour.Crazying: + _crazyingCoroutine = Timing.RunCoroutine(Crazying(player)); + break; + default: + break; + } + } + } + + private void Vision(Player player) + { + List scpRole = new List { RoleTypeId.Scp3114, RoleTypeId.Scp173, RoleTypeId.Scp096, RoleTypeId.Scp106, RoleTypeId.Scp049, RoleTypeId.Scp939 }; + + DummyUtils.SpawnDummy(Player.List.ToList().Where(p => p.IsScp).First().ToString()); // Setting name of the dummy + Player bot = Player.List.ToList().Where(p => p.IsNPC).First(); // Getting the bot + bot.Role.Set(RoleTypeId.Tutorial); + bot.ChangeAppearance(scpRole.GetRandomValue()); + bot.Health = 5000; + + bot.Position = player.Position + (-player.CameraTransform.forward) * 2; + player.PlayGunSound(bot.Position, FirearmType.ParticleDisruptor); + Timing.CallDelayed(2f, () => bot.Kick("")); + } + + private IEnumerator Crazying(Player player) + { + float duration = 15f; + float timer = 0f; + + while (timer < duration) + { + float randomYaw = UnityEngine.Random.Range(-180f, 180f); + float randomPitch = UnityEngine.Random.Range(-30f, 30f); + + Quaternion crazyRot = Quaternion.Euler(randomPitch, randomYaw, 0f); + player.ReferenceHub.transform.localRotation = crazyRot; + + for (int i = 0; i < 5; i++) + { + float shakeYaw = UnityEngine.Random.Range(-5f, 5f); + float shakePitch = UnityEngine.Random.Range(-5f, 5f); + + Quaternion shakeRot = Quaternion.Euler(shakePitch, shakeYaw, 0f); + player.ReferenceHub.transform.localRotation *= shakeRot; + + yield return Timing.WaitForSeconds(0.05f); + timer += 0.05f; + } + } + + Timing.KillCoroutines(_crazyingCoroutine); + } + } +} \ No newline at end of file diff --git a/KruacentExiled/KE.CustomRoles/CR/Human/Enderman.cs b/KruacentExiled/KE.CustomRoles/CR/Human/Enderman.cs new file mode 100644 index 00000000..d5ec3d32 --- /dev/null +++ b/KruacentExiled/KE.CustomRoles/CR/Human/Enderman.cs @@ -0,0 +1,25 @@ +using Exiled.API.Features.Attributes; +using Exiled.CustomRoles.API.Features; +using KE.CustomRoles.API.Features; +using PlayerRoles; +using System.Collections.Generic; + +namespace KE.CustomRoles.CR.Human +{ + [CustomRole(RoleTypeId.None)] + internal class Enderman : GlobalCustomRole + { + public override SideEnum Side { get; set; } = SideEnum.Human; + public override string Description { get; set; } = "Tu es un enderman ! Fait attention tu n'aime pas l'eau !"; + public override uint Id { get; set; } = 1065; + public override string PublicName { get; set; } = "Enderman"; + public override bool KeepRoleOnDeath { get; set; } = false; + public override bool KeepRoleOnChangingRole { get; set; } = true; + public override float SpawnChance { get; set; } = 100; + public override HashSet Abilities { get; } = new() + { + 2008, + 2000 + }; + } +} \ No newline at end of file diff --git a/KruacentExiled/KE.CustomRoles/CR/Human/Paper.cs b/KruacentExiled/KE.CustomRoles/CR/Human/Paper.cs deleted file mode 100644 index 8c866c72..00000000 --- a/KruacentExiled/KE.CustomRoles/CR/Human/Paper.cs +++ /dev/null @@ -1,23 +0,0 @@ -using Exiled.API.Features.Attributes; -using Exiled.CustomRoles.API.Features; -using KE.CustomRoles.API.Features; -using PlayerRoles; -using System.Collections.Generic; -using UnityEngine; - -namespace KE.CustomRoles.CR.Human -{ - [CustomRole(RoleTypeId.None)] - public class Paper : GlobalCustomRole - { - public override SideEnum Side { get; set; } = SideEnum.Human; - public override string Description { get; set; } = "Tu t'es fait roulé dessus !"; - public override uint Id { get; set; } = 1067; - public override string PublicName { get; set; } = "Paper"; - public override bool KeepRoleOnDeath { get; set; } = true; - public override bool KeepRoleOnChangingRole { get; set; } = true; - - public override float SpawnChance { get; set; } = 100; - public override Vector3 Scale { get; set; } = new Vector3(0.2f, 1, 1); - } -} \ No newline at end of file diff --git a/KruacentExiled/KE.CustomRoles/CR/SCP/ZombieDoorman.cs b/KruacentExiled/KE.CustomRoles/CR/SCP/ZombieDoorman.cs deleted file mode 100644 index f02f6d92..00000000 --- a/KruacentExiled/KE.CustomRoles/CR/SCP/ZombieDoorman.cs +++ /dev/null @@ -1,40 +0,0 @@ -using Exiled.API.Features; -using Exiled.API.Features.Attributes; -using Exiled.CustomRoles.API.Features; -using KE.CustomRoles.Abilities; -using PlayerRoles; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace KE.CustomRoles.CR.SCP -{ - [CustomRole(RoleTypeId.Scp0492)] - internal class ZombieDoorman : CustomRole - { - public override string Name { get; set; } = "SCP-049-2-Door"; - public override string Description { get; set; } = "U can open lock door with ur ability clapclapclap"; - public override uint Id { get; set; } = 1053; - public override string CustomInfo { get; set; } = "SCP-049-2-Door"; - public override int MaxHealth { get; set; } = 400; - public override RoleTypeId Role { get; set; } = RoleTypeId.Scp0492; - public override bool KeepRoleOnDeath { get; set; } = false; - public override bool KeepRoleOnChangingRole { get; set; } = false; - public override bool IgnoreSpawnSystem { get; set; } = true; - - public override float SpawnChance { get; set; } = 100; - - - protected override void RoleAdded(Player player) - { - Log.Debug("adding 0493dror"); - } - - protected override void RoleRemoved(Player player) - { - Log.Debug("removing 0493dror"); - } - } -} From d62ddbccb8da779718ea22ab46de5758690d8714 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Sun, 28 Sep 2025 17:58:48 +0200 Subject: [PATCH 363/853] fixed? the mine --- .../KE.Items/Items/ItemEffects/MineEffect.cs | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/KruacentExiled/KE.Items/Items/ItemEffects/MineEffect.cs b/KruacentExiled/KE.Items/Items/ItemEffects/MineEffect.cs index 3695efd3..c2008db8 100644 --- a/KruacentExiled/KE.Items/Items/ItemEffects/MineEffect.cs +++ b/KruacentExiled/KE.Items/Items/ItemEffects/MineEffect.cs @@ -120,12 +120,12 @@ private IEnumerator ActiveMine(MineModel mine, float cylinderSize) bool isActivated = true; while (isActivated) { - - foreach (IWorldSpace p in Pickup.List) + //Log.Debug("activated"); + foreach (Pickup p in Pickup.List) { - if (IsPositionInZone(p.Position, mine.Position, cylinderSize, 3)) + if (isActivated && IsPositionInZone(p.Position, mine.Position, cylinderSize, 3)) { - Grenade.SpawnActive(mine.Position); + Grenade.SpawnActive(mine.Position+Vector3.up); DestroyMine(mine); isActivated = false; break; @@ -137,7 +137,7 @@ private IEnumerator ActiveMine(MineModel mine, float cylinderSize) if (isActivated && IsPlayerInZone(player, mine.Position, cylinderSize, 3)) { - Grenade.SpawnActive(mine.Position); + Grenade.SpawnActive(mine.Position + Vector3.up); DestroyMine(mine); isActivated = false; break; @@ -146,6 +146,7 @@ private IEnumerator ActiveMine(MineModel mine, float cylinderSize) yield return Timing.WaitForSeconds(RefreshRate); } + DestroyMine(mine); } private void DestroyMine(MineModel mine) From 3429f4bdd52914900ed2b291374a3ca756c80bc3 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Tue, 30 Sep 2025 15:43:16 +0200 Subject: [PATCH 364/853] redid the blackoutn door again --- .../KE.Map/Heavy/GamblingZone/GamblingRoom.cs | 3 +- KruacentExiled/KE.Map/MainPlugin.cs | 12 +- .../KE.Map/Others/BlackoutNDoor/Blackout.cs | 35 +++ .../KE.Map/Others/BlackoutNDoor/Both.cs | 30 +++ .../KE.Map/Others/BlackoutNDoor/DoorStuck.cs | 46 ++++ .../EventArgs/ChoseMapEventEventArgs.cs | 22 ++ .../Events/EventArgs/ChoseZoneEventArgs.cs | 23 ++ .../Events/EventArgs/PostEventEventArgs.cs | 22 ++ .../Events/EventArgs/PreEventEventArgs.cs | 23 ++ .../Events/Handlers/BlackoutNDoor.cs | 40 ++++ .../Others/BlackoutNDoor/Handlers/Handler.cs | 221 ++++++++++++++++++ .../Others/BlackoutNDoor/Handlers/MapEvent.cs | 23 ++ .../Others/BlackoutNDoor/Handlers/Pattern.cs | 78 +++++++ .../BlackoutNDoor/Interfaces/IMapEvent.cs | 15 ++ .../KE.Map/Others/EasterEggs/Capybaras.cs | 2 +- .../KE.Map/Others/EasterEggs/SpinnyBaras.cs | 8 +- KruacentExiled/KE.Map/Translations.cs | 33 +++ KruacentExiled/KruacentExiled.sln | 6 - 18 files changed, 628 insertions(+), 14 deletions(-) create mode 100644 KruacentExiled/KE.Map/Others/BlackoutNDoor/Blackout.cs create mode 100644 KruacentExiled/KE.Map/Others/BlackoutNDoor/Both.cs create mode 100644 KruacentExiled/KE.Map/Others/BlackoutNDoor/DoorStuck.cs create mode 100644 KruacentExiled/KE.Map/Others/BlackoutNDoor/Events/EventArgs/ChoseMapEventEventArgs.cs create mode 100644 KruacentExiled/KE.Map/Others/BlackoutNDoor/Events/EventArgs/ChoseZoneEventArgs.cs create mode 100644 KruacentExiled/KE.Map/Others/BlackoutNDoor/Events/EventArgs/PostEventEventArgs.cs create mode 100644 KruacentExiled/KE.Map/Others/BlackoutNDoor/Events/EventArgs/PreEventEventArgs.cs create mode 100644 KruacentExiled/KE.Map/Others/BlackoutNDoor/Events/Handlers/BlackoutNDoor.cs create mode 100644 KruacentExiled/KE.Map/Others/BlackoutNDoor/Handlers/Handler.cs create mode 100644 KruacentExiled/KE.Map/Others/BlackoutNDoor/Handlers/MapEvent.cs create mode 100644 KruacentExiled/KE.Map/Others/BlackoutNDoor/Handlers/Pattern.cs create mode 100644 KruacentExiled/KE.Map/Others/BlackoutNDoor/Interfaces/IMapEvent.cs create mode 100644 KruacentExiled/KE.Map/Translations.cs diff --git a/KruacentExiled/KE.Map/Heavy/GamblingZone/GamblingRoom.cs b/KruacentExiled/KE.Map/Heavy/GamblingZone/GamblingRoom.cs index 00884b36..85393bd7 100644 --- a/KruacentExiled/KE.Map/Heavy/GamblingZone/GamblingRoom.cs +++ b/KruacentExiled/KE.Map/Heavy/GamblingZone/GamblingRoom.cs @@ -6,6 +6,7 @@ using InteractableToy = LabApi.Features.Wrappers.InteractableToy; using System.Collections.Generic; using UnityEngine; +using System.Linq; namespace KE.Map.Heavy.GamblingZone { @@ -131,7 +132,7 @@ public void OnPickup(LabApi.Features.Wrappers.Player player) } public static void DestroyAll() { - foreach (GamblingRoom gamblingRoom in List) + foreach (GamblingRoom gamblingRoom in List.ToList()) { gamblingRoom.Destroy(); } diff --git a/KruacentExiled/KE.Map/MainPlugin.cs b/KruacentExiled/KE.Map/MainPlugin.cs index a8c29e24..26b0c3e8 100644 --- a/KruacentExiled/KE.Map/MainPlugin.cs +++ b/KruacentExiled/KE.Map/MainPlugin.cs @@ -4,26 +4,32 @@ using Exiled.API.Features.Doors; using Exiled.API.Interfaces; using Exiled.Events.EventArgs.Server; -using KE.Map.EasterEggs; using KE.Map.Heavy.GamblingZone; +using KE.Map.Others.BlackoutNDoor.Handlers; using KE.Map.Surface.Turrets; using KE.Utils.API.Models; using PlayerRoles; using System.Collections.Generic; using System.Linq; +using System.Runtime.InteropServices; using UnityEngine; namespace KE.Map { - public class MainPlugin : Plugin + public class MainPlugin : Plugin { public override string Name => "KE.Map"; public override string Prefix => "KE.M"; public static MainPlugin Instance { get; private set; } public Models models => Models.Instance; + private Handler handler; + public static Translations Translations => Instance?.Translation; public static Config Configs => Instance?.Config; public override void OnEnabled() { + handler = new(); + + handler.SubscribeEvents(); KE.Utils.API.Sounds.SoundPlayer.Instance.TryLoad(); Exiled.Events.Handlers.Map.Generated += OnGenerated; GamblingRoom.SubscribeEvents(); @@ -43,9 +49,11 @@ private void OnRoundStarted() public override void OnDisabled() { + handler.UnsubscribeEvents(); Exiled.Events.Handlers.Map.Generated -= OnGenerated; Exiled.Events.Handlers.Server.RoundEnded -= OnRoundEnded; GamblingRoom.UnsubscribeEvents(); + handler = null; Instance = null; } diff --git a/KruacentExiled/KE.Map/Others/BlackoutNDoor/Blackout.cs b/KruacentExiled/KE.Map/Others/BlackoutNDoor/Blackout.cs new file mode 100644 index 00000000..27b06124 --- /dev/null +++ b/KruacentExiled/KE.Map/Others/BlackoutNDoor/Blackout.cs @@ -0,0 +1,35 @@ +using Exiled.API.Enums; +using Exiled.API.Features; +using Exiled.API.Features.Doors; +using KE.Map.Others.BlackoutNDoor.Handlers; +using System; +using System.Collections.Generic; +using System.Linq; + +namespace KE.Map.Others.BlackoutNDoor +{ + public class Blackout : MapEvent + { + public override string Cassie => MainPlugin.Translations.Blackout; + + public override string CassieTranslated => MainPlugin.Translations.BlackoutTranslation; + + public override void Start(ZoneType zone) + { + foreach(Room room in Room.List.Where(r => r.Zone == zone)) + { + room.TurnOffLights(); + } + } + + public override void Stop(ZoneType zone) + { + foreach (Room room in Room.List.Where(r => r.Zone == zone)) + { + room.AreLightsOff = false; + } + } + + + } +} diff --git a/KruacentExiled/KE.Map/Others/BlackoutNDoor/Both.cs b/KruacentExiled/KE.Map/Others/BlackoutNDoor/Both.cs new file mode 100644 index 00000000..34270f0b --- /dev/null +++ b/KruacentExiled/KE.Map/Others/BlackoutNDoor/Both.cs @@ -0,0 +1,30 @@ +using Exiled.API.Enums; +using KE.Map.Others.BlackoutNDoor.Handlers; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace KE.Map.Others.BlackoutNDoor +{ + public class Both : MapEvent + { + private DoorStuck doorstuck = new(); + private Blackout blackout = new(); + public override string Cassie => MainPlugin.Translations.Both; + + public override string CassieTranslated => MainPlugin.Translations.BothTranslation; + public override void Start(ZoneType zone) + { + doorstuck.Start(zone); + blackout.Start(zone); + } + + public override void Stop(ZoneType zone) + { + doorstuck.Stop(zone); + blackout.Stop(zone); + } + } +} diff --git a/KruacentExiled/KE.Map/Others/BlackoutNDoor/DoorStuck.cs b/KruacentExiled/KE.Map/Others/BlackoutNDoor/DoorStuck.cs new file mode 100644 index 00000000..180dfea2 --- /dev/null +++ b/KruacentExiled/KE.Map/Others/BlackoutNDoor/DoorStuck.cs @@ -0,0 +1,46 @@ +using Exiled.API.Enums; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using KE.Map.Others.BlackoutNDoor.Handlers; +using Exiled.API.Features.Doors; + +namespace KE.Map.Others.BlackoutNDoor +{ + public class DoorStuck : MapEvent + { + + private static HashSet doors = new(); + + public override string Cassie => MainPlugin.Translations.Doorstuck; + + public override string CassieTranslated => MainPlugin.Translations.DoorstuckTranslation; + + public override void Start(ZoneType zone) + { + bool open = UnityEngine.Random.value > .5f; + foreach (Door door in Door.List.Where(d => d.Zone == zone && !d.IsElevator && d.Type != DoorType.Scp079First && d.Type != DoorType.Scp079Second)) + { + + if (door.DoorLockType == DoorLockType.None) + { + doors.Add(door); + door.ChangeLock(DoorLockType.NoPower); + door.IsOpen = open; + } + } + } + + public override void Stop(ZoneType zone) + { + bool open = UnityEngine.Random.value > .5f; + foreach (Door door in doors) + { + door.IsOpen = open; + door.ChangeLock(DoorLockType.None); + } + } + } +} diff --git a/KruacentExiled/KE.Map/Others/BlackoutNDoor/Events/EventArgs/ChoseMapEventEventArgs.cs b/KruacentExiled/KE.Map/Others/BlackoutNDoor/Events/EventArgs/ChoseMapEventEventArgs.cs new file mode 100644 index 00000000..446b6073 --- /dev/null +++ b/KruacentExiled/KE.Map/Others/BlackoutNDoor/Events/EventArgs/ChoseMapEventEventArgs.cs @@ -0,0 +1,22 @@ +using Exiled.Events.EventArgs.Interfaces; +using KE.Map.Others.BlackoutNDoor.Handlers; +using KE.Map.Others.BlackoutNDoor.Interfaces; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace KE.Map.Others.BlackoutNDoor.Events.EventArgs +{ + public class ChoseMapEventEventArgs : IExiledEvent, IMapEvent + { + public MapEvent MapEvent { get; set; } + + public ChoseMapEventEventArgs(MapEvent mapEvent) + { + MapEvent = mapEvent; + } + + } +} diff --git a/KruacentExiled/KE.Map/Others/BlackoutNDoor/Events/EventArgs/ChoseZoneEventArgs.cs b/KruacentExiled/KE.Map/Others/BlackoutNDoor/Events/EventArgs/ChoseZoneEventArgs.cs new file mode 100644 index 00000000..288eb31d --- /dev/null +++ b/KruacentExiled/KE.Map/Others/BlackoutNDoor/Events/EventArgs/ChoseZoneEventArgs.cs @@ -0,0 +1,23 @@ +using Exiled.API.Enums; +using Exiled.Events.EventArgs.Interfaces; +using KE.Map.Others.BlackoutNDoor.Handlers; +using KE.Map.Others.BlackoutNDoor.Interfaces; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace KE.Map.Others.BlackoutNDoor.Events.EventArgs +{ + public class ChoseZoneEventArgs : IExiledEvent + { + public ZoneType Zone { get; set; } + + public ChoseZoneEventArgs(ZoneType zone) + { + Zone = zone; + } + + } +} diff --git a/KruacentExiled/KE.Map/Others/BlackoutNDoor/Events/EventArgs/PostEventEventArgs.cs b/KruacentExiled/KE.Map/Others/BlackoutNDoor/Events/EventArgs/PostEventEventArgs.cs new file mode 100644 index 00000000..6e13cacd --- /dev/null +++ b/KruacentExiled/KE.Map/Others/BlackoutNDoor/Events/EventArgs/PostEventEventArgs.cs @@ -0,0 +1,22 @@ +using Exiled.Events.EventArgs.Interfaces; +using KE.Map.Others.BlackoutNDoor.Handlers; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace KE.Map.Others.BlackoutNDoor.Events.EventArgs +{ + public class PostEventEventArgs : IExiledEvent + { + public MapEvent MapEvent { get; set; } + + public PostEventEventArgs(MapEvent mapEvent) + { + MapEvent = mapEvent; + } + + + } +} diff --git a/KruacentExiled/KE.Map/Others/BlackoutNDoor/Events/EventArgs/PreEventEventArgs.cs b/KruacentExiled/KE.Map/Others/BlackoutNDoor/Events/EventArgs/PreEventEventArgs.cs new file mode 100644 index 00000000..92034f47 --- /dev/null +++ b/KruacentExiled/KE.Map/Others/BlackoutNDoor/Events/EventArgs/PreEventEventArgs.cs @@ -0,0 +1,23 @@ +using Exiled.Events.EventArgs.Interfaces; +using KE.Map.Others.BlackoutNDoor.Handlers; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace KE.Map.Others.BlackoutNDoor.Events.EventArgs +{ + public class PreEventEventArgs: IExiledEvent,IDeniableEvent + { + public bool IsAllowed { get; set; } + public MapEvent MapEvent { get; set; } + + public PreEventEventArgs(MapEvent mapEvent, bool isAllowed) + { + MapEvent = mapEvent; + IsAllowed = isAllowed; + } + + } +} diff --git a/KruacentExiled/KE.Map/Others/BlackoutNDoor/Events/Handlers/BlackoutNDoor.cs b/KruacentExiled/KE.Map/Others/BlackoutNDoor/Events/Handlers/BlackoutNDoor.cs new file mode 100644 index 00000000..da3d22fa --- /dev/null +++ b/KruacentExiled/KE.Map/Others/BlackoutNDoor/Events/Handlers/BlackoutNDoor.cs @@ -0,0 +1,40 @@ +using Exiled.Events.Features; +using KE.Map.Others.BlackoutNDoor.Events.EventArgs; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace KE.Map.Others.BlackoutNDoor.Events.Handlers +{ + public static class BlackoutNDoor + { + + + public static Event PreEvent { get; set; } = new Event(); + public static Event PostEvent { get; set; } = new Event(); + + public static Event ChoseMapEvent { get; set; } = new(); + public static Event ChoseZoneEvent { get; set; } = new(); + public static void OnPreEvent(PreEventEventArgs ev) + { + PreEvent.InvokeSafely(ev); + } + public static void OnPostEvent(PostEventEventArgs ev) + { + PostEvent.InvokeSafely(ev); + } + + public static void OnChoseMapEvent(ChoseMapEventEventArgs ev) + { + ChoseMapEvent.InvokeSafely(ev); + } + + public static void OnChoseZoneEvent(ChoseZoneEventArgs ev) + { + ChoseZoneEvent.InvokeSafely(ev); + } + + } +} diff --git a/KruacentExiled/KE.Map/Others/BlackoutNDoor/Handlers/Handler.cs b/KruacentExiled/KE.Map/Others/BlackoutNDoor/Handlers/Handler.cs new file mode 100644 index 00000000..aab3eab5 --- /dev/null +++ b/KruacentExiled/KE.Map/Others/BlackoutNDoor/Handlers/Handler.cs @@ -0,0 +1,221 @@ +using Exiled.API.Enums; +using Exiled.API.Extensions; +using Exiled.API.Features; +using KE.Map.Others.BlackoutNDoor.Events.EventArgs; +using KE.Utils.API.Interfaces; +using KE.Utils.Extensions; +using MEC; +using PlayerRoles; +using System; +using System.Collections.Generic; +using System.Linq; + +using EventHandle = KE.Map.Others.BlackoutNDoor.Events.Handlers.BlackoutNDoor; + +namespace KE.Map.Others.BlackoutNDoor.Handlers +{ + public class Handler : IUsingEvents + { + public static float MinInterval = 60 * 3; + public static float MaxInterval = 60 * 6; + + public Pattern ChosenPattern = null; + + private float time = 0; + public float TimeBeforeNextEvent => time; + + public static readonly HashSet Zones = new() + { + ZoneType.LightContainment,ZoneType.HeavyContainment,ZoneType.Entrance + }; + + private ZoneType currentScpZone = ZoneType.Unspecified; + private int weight = defaultWeight; + private const int defaultWeight = 330; + + public void SubscribeEvents() + { + Exiled.Events.Handlers.Server.RoundStarted += OnRoundStarted; + } + + public void UnsubscribeEvents() + { + Exiled.Events.Handlers.Server.RoundStarted -= OnRoundStarted; + } + + private void OnRoundStarted() + { + ChosenPattern = Pattern.AllPatterns.GetRandomValue(); + ChosenPattern = new Pattern + ([ + new Blackout(),new DoorStuck() + ]); + //time = GetRandomTime(); + time = 30; + Timing.RunCoroutine(Timer()); + } + + private IEnumerator Timer() + { + int timeRefresh = 10; + while (Round.InProgress) + { + yield return Timing.WaitForSeconds(timeRefresh); + Player scp = Player.List.Where(p => p.IsScp && p.Role != RoleTypeId.Scp0492).FirstOrDefault(); + + if(scp == null) + { + scp = Player.List.Where(p => p.IsScp).FirstOrDefault(); + } + + + if (scp != null) + { + if(scp.Zone == currentScpZone) + { + weight += timeRefresh; + } + else + { + weight = defaultWeight; + } + currentScpZone = scp.Zone; + } + else + { + currentScpZone = ZoneType.Unspecified; + } + + Log.Debug("weight=" + weight + " at " + currentScpZone); + + + time-= timeRefresh; + Log.Debug(time +"s"); + if (time <= 0) + { + LaunchEvent(); + time = GetRandomTime(); + } + + + } + } + private float GetRandomTime() + { + return UnityEngine.Random.Range(MinInterval, MaxInterval); + } + + + private void LaunchEvent() + { + + + MapEvent mapEvent = ChosenPattern.GetNext(); + + ChoseMapEventEventArgs choseMapEv = new ChoseMapEventEventArgs(mapEvent); + EventHandle.OnChoseMapEvent(choseMapEv); + mapEvent = choseMapEv.MapEvent; + + + ZoneType zone = GetZone(); + ChoseZoneEventArgs choseZoneEv = new(zone); + EventHandle.OnChoseZoneEvent(choseZoneEv); + + if (Zones.Contains(choseZoneEv.Zone)) + { + zone = choseZoneEv.Zone; + } + + + + Log.Info(mapEvent.GetType().Name + " at " + zone); + + + + PreEventEventArgs preEv = new PreEventEventArgs(mapEvent, true); + EventHandle.OnPreEvent(preEv); + + + if (preEv.IsAllowed) + { + + string message = mapEvent.Cassie + " " + ZoneTypeToCassie(zone) + " " + MainPlugin.Translations.End; + string translate = mapEvent.CassieTranslated + " " + ZoneTypeToCassieTranslated(zone) + " " + MainPlugin.Translations.End; + float yap = Cassie.CalculateDuration(message); + Cassie.MessageTranslated(message, translate,false,false,true); + + + Timing.CallDelayed(5 + yap, delegate + { + Log.Debug("starting"); + mapEvent.Start(zone); + + + Timing.CallDelayed(10, delegate + { + Log.Debug("stopping"); + mapEvent.Stop(zone); + PostEventEventArgs postEv = new PostEventEventArgs(mapEvent); + EventHandle.OnPostEvent(postEv); + }); + }); + } + } + + private string ZoneTypeToCassie(ZoneType zone) + { + return zone switch + { + ZoneType.LightContainment => MainPlugin.Translations.LightContainment, + ZoneType.HeavyContainment => MainPlugin.Translations.HeavyContainment, + ZoneType.Entrance => MainPlugin.Translations.EntranceZone, + _ => string.Empty + }; + } + + private string ZoneTypeToCassieTranslated(ZoneType zone) + { + return zone switch + { + ZoneType.LightContainment => MainPlugin.Translations.LightContainmentTranslation, + ZoneType.HeavyContainment => MainPlugin.Translations.HeavyContainmentTranslation, + ZoneType.Entrance => MainPlugin.Translations.EntranceZoneTranslation, + _ => string.Empty + }; + } + + + private ZoneType GetZone() + { + return RandomZoneByWeight(); + } + + private ZoneType RandomZoneByWeight() + { + List result = new(); + + List weightedPool = new(); + foreach (ZoneType zone in Zones.Where(z => z.IsSafe())) + { + if(zone != currentScpZone) + { + for (int i = 0; i < defaultWeight; i++) + { + weightedPool.Add(zone); + } + } + else + { + for (int i = 0; i < weight; i++) + { + weightedPool.Add(zone); + } + } + + + + } + return weightedPool.GetRandomValue(); + } + } +} diff --git a/KruacentExiled/KE.Map/Others/BlackoutNDoor/Handlers/MapEvent.cs b/KruacentExiled/KE.Map/Others/BlackoutNDoor/Handlers/MapEvent.cs new file mode 100644 index 00000000..ea5fd530 --- /dev/null +++ b/KruacentExiled/KE.Map/Others/BlackoutNDoor/Handlers/MapEvent.cs @@ -0,0 +1,23 @@ +using Exiled.API.Enums; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace KE.Map.Others.BlackoutNDoor.Handlers +{ + public abstract class MapEvent + { + + public abstract string Cassie { get; } + public abstract string CassieTranslated { get; } + + + public abstract void Start(ZoneType zone); + + + public abstract void Stop(ZoneType zone); + + } +} diff --git a/KruacentExiled/KE.Map/Others/BlackoutNDoor/Handlers/Pattern.cs b/KruacentExiled/KE.Map/Others/BlackoutNDoor/Handlers/Pattern.cs new file mode 100644 index 00000000..fd2628f5 --- /dev/null +++ b/KruacentExiled/KE.Map/Others/BlackoutNDoor/Handlers/Pattern.cs @@ -0,0 +1,78 @@ +using Exiled.API.Features; +using Mirror; +using PlayerRoles.PlayableScps.Scp3114; +using System; +using System.Collections.Generic; +using System.IO.IsolatedStorage; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace KE.Map.Others.BlackoutNDoor.Handlers +{ + public class Pattern : IEquatable + { + public static readonly HashSet AllPatterns = new() + { + new Pattern + ([ + new Blackout(),new DoorStuck() + ]) + , + new Pattern + ([ + new Blackout(),new Blackout(),new DoorStuck(),new DoorStuck() + ]) + , + new Pattern + ([ + new DoorStuck(),new Blackout(),new Both(),new Blackout(),new DoorStuck() + ]) + + }; + + + private int current = -1; + private readonly List _pattern; + + public Pattern(List pattern) + { + _pattern = new(); + for (int i = 0; i < pattern.Count; i++) + { + _pattern.Add(pattern[i]); + } + } + + + public MapEvent GetNext() + { + current = (current + 1) % _pattern.Count; + return _pattern[current]; + } + + + + public bool Equals(Pattern other) + { + if (other._pattern.Count != _pattern.Count) return false; + + for (int i = 0; i < _pattern.Count; i++) + { + if (_pattern[i] != other._pattern[i]) + { + return false; + } + } + return true; + + } + + + + + + + + } +} diff --git a/KruacentExiled/KE.Map/Others/BlackoutNDoor/Interfaces/IMapEvent.cs b/KruacentExiled/KE.Map/Others/BlackoutNDoor/Interfaces/IMapEvent.cs new file mode 100644 index 00000000..d7d953f3 --- /dev/null +++ b/KruacentExiled/KE.Map/Others/BlackoutNDoor/Interfaces/IMapEvent.cs @@ -0,0 +1,15 @@ +using KE.Map.Others.BlackoutNDoor.Handlers; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace KE.Map.Others.BlackoutNDoor.Interfaces +{ + public interface IMapEvent + { + + MapEvent MapEvent { get; } + } +} diff --git a/KruacentExiled/KE.Map/Others/EasterEggs/Capybaras.cs b/KruacentExiled/KE.Map/Others/EasterEggs/Capybaras.cs index 80eff86c..0c78f146 100644 --- a/KruacentExiled/KE.Map/Others/EasterEggs/Capybaras.cs +++ b/KruacentExiled/KE.Map/Others/EasterEggs/Capybaras.cs @@ -13,7 +13,7 @@ using UnityEngine; using Light = Exiled.API.Features.Toys.Light; -namespace KE.Map.EasterEggs +namespace KE.Map.Others.EasterEggs { internal class Capybaras : IUsingEvents { diff --git a/KruacentExiled/KE.Map/Others/EasterEggs/SpinnyBaras.cs b/KruacentExiled/KE.Map/Others/EasterEggs/SpinnyBaras.cs index c233ab4d..a10f6a2c 100644 --- a/KruacentExiled/KE.Map/Others/EasterEggs/SpinnyBaras.cs +++ b/KruacentExiled/KE.Map/Others/EasterEggs/SpinnyBaras.cs @@ -10,7 +10,7 @@ using UnityEngine; using Player = Exiled.API.Features.Player; -namespace KE.Map.EasterEggs +namespace KE.Map.Others.EasterEggs { internal class SpinnyBaras { @@ -33,12 +33,12 @@ private IEnumerator Spin() while (true) { _capybara.Transform.Rotate(Vector3.up, 1); - yield return Timing.WaitForSeconds(1/speed); + yield return Timing.WaitForSeconds(1 / speed); } - + } - + public void Kill() { Timing.KillCoroutines(_handle); diff --git a/KruacentExiled/KE.Map/Translations.cs b/KruacentExiled/KE.Map/Translations.cs new file mode 100644 index 00000000..e94fff0a --- /dev/null +++ b/KruacentExiled/KE.Map/Translations.cs @@ -0,0 +1,33 @@ +using Exiled.API.Interfaces; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace KE.Map +{ + public class Translations : ITranslation + { + + public string Blackout { get; set; } = "Warning Failure Of All Lights In"; + public string BlackoutTranslation { get; set; } = "Warning Failure Of All Lights In"; + public string Doorstuck { get; set; } = "Warning Failure Of All Doors In"; + public string DoorstuckTranslation { get; set; } = "Warning Failure Of All Doors In"; + public string Both { get; set; } = "Warning Failure Of All Systems In"; + public string BothTranslation { get; set; } = "Warning Failure Of All Systems In"; + + + public string LightContainment { get; set; } = "Light Containment Zone"; + public string LightContainmentTranslation { get; set; } = "Light Containment Zone"; + public string HeavyContainment { get; set; } = "Heavy Containment Zone"; + public string HeavyContainmentTranslation { get; set; } = "Heavy Containment Zone"; + public string EntranceZone { get; set; } = "Entrance Zone"; + public string EntranceZoneTranslation { get; set; } = "Entrance Zone"; + + public string End { get; set; } = "In 5 seconds"; + + + + } +} diff --git a/KruacentExiled/KruacentExiled.sln b/KruacentExiled/KruacentExiled.sln index a2b7c5d9..3bdb6d23 100644 --- a/KruacentExiled/KruacentExiled.sln +++ b/KruacentExiled/KruacentExiled.sln @@ -7,8 +7,6 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "KE.Items", "KE.Items\KE.Ite EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "KE.Misc", "KE.Misc\KE.Misc.csproj", "{CD822DB2-756E-4887-93AB-2D2F16BF542C}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "KE.BlackoutNDoor", "KE.BlackoutNDoor\KE.BlackoutNDoor.csproj", "{C9867742-72DB-4ECA-81BF-104A27A04DB7}" -EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "KE.GlobalEventFramework", "KE.GlobalEventFramework\KE.GlobalEventFramework.csproj", "{73D6C740-96DE-4965-898F-DDD5BCBF7366}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "KE.GlobalEventFramework.Examples", "KE.GlobalEventFramework.Examples\KE.GlobalEventFramework.Examples.csproj", "{07B92E87-F48F-4F9F-BA0E-1BCB2AF52F53}" @@ -33,10 +31,6 @@ Global {CD822DB2-756E-4887-93AB-2D2F16BF542C}.Debug|Any CPU.Build.0 = Debug|Any CPU {CD822DB2-756E-4887-93AB-2D2F16BF542C}.Release|Any CPU.ActiveCfg = Release|Any CPU {CD822DB2-756E-4887-93AB-2D2F16BF542C}.Release|Any CPU.Build.0 = Release|Any CPU - {C9867742-72DB-4ECA-81BF-104A27A04DB7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {C9867742-72DB-4ECA-81BF-104A27A04DB7}.Debug|Any CPU.Build.0 = Debug|Any CPU - {C9867742-72DB-4ECA-81BF-104A27A04DB7}.Release|Any CPU.ActiveCfg = Release|Any CPU - {C9867742-72DB-4ECA-81BF-104A27A04DB7}.Release|Any CPU.Build.0 = Release|Any CPU {73D6C740-96DE-4965-898F-DDD5BCBF7366}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {73D6C740-96DE-4965-898F-DDD5BCBF7366}.Debug|Any CPU.Build.0 = Debug|Any CPU {73D6C740-96DE-4965-898F-DDD5BCBF7366}.Release|Any CPU.ActiveCfg = Release|Any CPU From 40409c06767d41230becb54378a06c1a18c39411 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Tue, 30 Sep 2025 16:02:40 +0200 Subject: [PATCH 365/853] all door go boom --- KruacentExiled/KE.Misc/Features/ClassDDoor.cs | 44 ++++++++++++++----- .../KE.Misc/Features/SurfaceLight.cs | 2 +- .../KE.Misc/Handlers/ServerHandler.cs | 3 -- KruacentExiled/KE.Misc/MainPlugin.cs | 4 +- 4 files changed, 38 insertions(+), 15 deletions(-) diff --git a/KruacentExiled/KE.Misc/Features/ClassDDoor.cs b/KruacentExiled/KE.Misc/Features/ClassDDoor.cs index 71eba01a..1dcd61a3 100644 --- a/KruacentExiled/KE.Misc/Features/ClassDDoor.cs +++ b/KruacentExiled/KE.Misc/Features/ClassDDoor.cs @@ -2,6 +2,7 @@ using Exiled.API.Features; using Exiled.API.Features.Doors; using Exiled.API.Interfaces; +using KE.Utils.API.Interfaces; using System; using System.Collections.Generic; using System.Linq; @@ -13,24 +14,47 @@ namespace KE.Misc.Features /// /// Everything about classD door /// - internal class ClassDDoor + public class ClassDDoor : IUsingEvents { - /// - /// Class d door randomly explode at the start of the round - /// - internal void ClassDDoorGoesBoom() + public void SubscribeEvents() { - if (UnityEngine.Random.Range(0, 101) < MainPlugin.Instance.Config.ChanceClassDDoorGoesBoom) + Exiled.Events.Handlers.Server.RoundStarted += OnRoundStarted; + } + + public void UnsubscribeEvents() + { + Exiled.Events.Handlers.Server.RoundStarted -= OnRoundStarted; + + } + + + private void OnRoundStarted() + { + if(UnityEngine.Random.Range(0, 101) < MainPlugin.Instance.Config.ChanceClassDDoorGoesBoom || MainPlugin.Instance.Config.Debug) + { + HumanDoorsGoesBoom(); + } + + } + + + private void HumanDoorsGoesBoom() + { + foreach(Player player in Player.List.Where(p => p.IsHuman)) { - Log.Debug("ClassD's door exploded"); - foreach (Door door in Door.List.Where(d => d.Type == DoorType.PrisonDoor)) + if(player.CurrentRoom != null) { - if (door is IDamageableDoor dBoyDoor && !dBoyDoor.IsDestroyed) + foreach(Door door in player.CurrentRoom.Doors.Where(d => d is IDamageableDoor && !d.IsCheckpoint)) { - dBoyDoor.Break(); + IDamageableDoor damageable = door as IDamageableDoor; + damageable.Break(); } } } } + + + + } } diff --git a/KruacentExiled/KE.Misc/Features/SurfaceLight.cs b/KruacentExiled/KE.Misc/Features/SurfaceLight.cs index 3742f01f..49c2b620 100644 --- a/KruacentExiled/KE.Misc/Features/SurfaceLight.cs +++ b/KruacentExiled/KE.Misc/Features/SurfaceLight.cs @@ -37,7 +37,7 @@ public override void UnsubscribeEvents() private void OnRoundStarted() { - if(Random.value < .75f) + if(Random.value < .25f) ChangeSurfaceLight(); } diff --git a/KruacentExiled/KE.Misc/Handlers/ServerHandler.cs b/KruacentExiled/KE.Misc/Handlers/ServerHandler.cs index 607de317..33a09f82 100644 --- a/KruacentExiled/KE.Misc/Handlers/ServerHandler.cs +++ b/KruacentExiled/KE.Misc/Handlers/ServerHandler.cs @@ -17,9 +17,6 @@ internal class ServerHandler NPC079 a; public void OnRoundStarted() { - if (MainPlugin.Instance.Config.ChanceClassDDoorGoesBoom >= 0 && MainPlugin.Instance.Config.ChanceClassDDoorGoesBoom <= 100) - MainPlugin.Instance.ClassDDoor.ClassDDoorGoesBoom(); - if (MainPlugin.Instance.Config.AutoElevator) MainPlugin.Instance.AutoElevator.StartLoop(); diff --git a/KruacentExiled/KE.Misc/MainPlugin.cs b/KruacentExiled/KE.Misc/MainPlugin.cs index 38c3d73a..7e84edb3 100644 --- a/KruacentExiled/KE.Misc/MainPlugin.cs +++ b/KruacentExiled/KE.Misc/MainPlugin.cs @@ -54,8 +54,9 @@ public override void OnEnabled() Respawn.SetTokens(SpawnableFaction.NtfWave, 2); Respawn.SetTokens(SpawnableFaction.ChaosWave, 2); + ClassDDoor.SubscribeEvents(); + - MiscFeature.SubscribeAllEvents(); Exiled.Events.Handlers.Server.RoundStarted += AutoNukeAnnoucement.OnRoundStarted; Exiled.Events.Handlers.Player.ChangingRole += SCPBuff.BecomingSCP; @@ -73,6 +74,7 @@ public override void OnDisabled() Exiled.Events.Handlers.Server.RoundStarted -= AutoNukeAnnoucement.OnRoundStarted; AutoTesla.StopLoop(); MiscFeature.UnsubscribeAllEvents(); + ClassDDoor.UnsubscribeEvents(); CustomRole.UnregisterRoles([typeof(Scp035)]); From b5ce477e7a81201903bc6710dd9d33416f96c158 Mon Sep 17 00:00:00 2001 From: Omer <27omerf@gmail.com> Date: Tue, 30 Sep 2025 19:26:54 +0200 Subject: [PATCH 366/853] added the ability to gamble with coin --- KruacentExiled/KE.Misc/Config.cs | 4 + .../Effect/NegativeEffect/AutoDoor.cs | 26 ++++++ .../Effect/NegativeEffect/DetonatedFlash.cs | 19 ++++ .../Effect/NegativeEffect/EatingStar.cs | 49 ++++++++++ .../Effect/NegativeEffect/FakeNuke.cs | 22 +++++ .../Effect/NegativeEffect/FakeSCPDeath.cs | 52 +++++++++++ .../Effect/NegativeEffect/FlipPlayerRole.cs | 51 ++++++++++ .../Effect/NegativeEffect/Handcuff.cs | 17 ++++ .../Effect/NegativeEffect/InventoryReset.cs | 17 ++++ .../Effect/NegativeEffect/Kick.cs | 16 ++++ .../Effect/NegativeEffect/LiveHEGrenade.cs | 21 +++++ .../Effect/NegativeEffect/MakeOneHp.cs | 22 +++++ .../Effect/NegativeEffect/PrimedVase.cs | 19 ++++ .../Effect/NegativeEffect/RandomBadEffect.cs | 22 +++++ .../Effect/NegativeEffect/RandomTeleport.cs | 22 +++++ .../NegativeEffect/RandomizeInventory.cs | 31 +++++++ .../Effect/NegativeEffect/RedCandy.cs | 20 ++++ .../Effect/NegativeEffect/ReduceHP.cs | 21 +++++ .../Effect/NegativeEffect/Reversed.cs | 38 ++++++++ .../Effect/NegativeEffect/Shit.cs | 17 ++++ .../Effect/NegativeEffect/SwapInventory.cs | 59 ++++++++++++ .../Effect/NegativeEffect/SwapPosition.cs | 31 +++++++ .../NegativeEffect/SwapWithSpectator.cs | 50 ++++++++++ .../NegativeEffect/TeleportToDBoyCell.cs | 24 +++++ .../Effect/NegativeEffect/TeleportToEnemy.cs | 40 ++++++++ .../Effect/NegativeEffect/TransformZombie.cs | 16 ++++ .../Effect/NegativeEffect/TurnOffLight.cs | 18 ++++ .../Effect/NegativeEffect/Vaporize.cs | 23 +++++ .../Effect/NegativeEffect/WarheadCoin.cs | 19 ++++ .../Effect/NegativeEffect/YouLoveTesla.cs | 24 +++++ .../Effect/PositiveEffect/EmptyMicro.cs | 20 ++++ .../Effect/PositiveEffect/Erased.cs | 17 ++++ .../Effect/PositiveEffect/ForceRespawn.cs | 17 ++++ .../Effect/PositiveEffect/GiveKeycard.cs | 31 +++++++ .../Effect/PositiveEffect/Gnomed.cs | 17 ++++ .../Effect/PositiveEffect/HealPlayer.cs | 20 ++++ .../PositiveEffect/IncreasePlayerHealth.cs | 23 +++++ .../Effect/PositiveEffect/KaboomCandy.cs | 19 ++++ .../Effect/PositiveEffect/Lightbulb.cs | 18 ++++ .../Effect/PositiveEffect/NiceHat.cs | 18 ++++ .../Effect/PositiveEffect/OneAmmoLogicer.cs | 19 ++++ .../Effect/PositiveEffect/RandomGoodEffect.cs | 22 +++++ .../Effect/PositiveEffect/RandomItem.cs | 21 +++++ .../Effect/PositiveEffect/Revolver.cs | 21 +++++ .../Effect/PositiveEffect/SpawnHeal.cs | 19 ++++ .../Effect/PositiveEffect/TeleportToEscape.cs | 18 ++++ .../Features/GamblingCoin/EventHandlers.cs | 79 ++++++++++++++++ .../GamblingCoin/GamblingCoinManager.cs | 93 +++++++++++++++++++ .../GamblingCoin/Interfaces/ICoinEffect.cs | 37 ++++++++ .../Interfaces/IDurationEffect.cs | 22 +++++ .../Features/GamblingCoin/PlayerUtils.cs | 15 +++ .../Features/GamblingCoin/Types/EffectType.cs | 14 +++ KruacentExiled/KE.Misc/MainPlugin.cs | 8 ++ 53 files changed, 1398 insertions(+) create mode 100644 KruacentExiled/KE.Misc/Features/GamblingCoin/Effect/NegativeEffect/AutoDoor.cs create mode 100644 KruacentExiled/KE.Misc/Features/GamblingCoin/Effect/NegativeEffect/DetonatedFlash.cs create mode 100644 KruacentExiled/KE.Misc/Features/GamblingCoin/Effect/NegativeEffect/EatingStar.cs create mode 100644 KruacentExiled/KE.Misc/Features/GamblingCoin/Effect/NegativeEffect/FakeNuke.cs create mode 100644 KruacentExiled/KE.Misc/Features/GamblingCoin/Effect/NegativeEffect/FakeSCPDeath.cs create mode 100644 KruacentExiled/KE.Misc/Features/GamblingCoin/Effect/NegativeEffect/FlipPlayerRole.cs create mode 100644 KruacentExiled/KE.Misc/Features/GamblingCoin/Effect/NegativeEffect/Handcuff.cs create mode 100644 KruacentExiled/KE.Misc/Features/GamblingCoin/Effect/NegativeEffect/InventoryReset.cs create mode 100644 KruacentExiled/KE.Misc/Features/GamblingCoin/Effect/NegativeEffect/Kick.cs create mode 100644 KruacentExiled/KE.Misc/Features/GamblingCoin/Effect/NegativeEffect/LiveHEGrenade.cs create mode 100644 KruacentExiled/KE.Misc/Features/GamblingCoin/Effect/NegativeEffect/MakeOneHp.cs create mode 100644 KruacentExiled/KE.Misc/Features/GamblingCoin/Effect/NegativeEffect/PrimedVase.cs create mode 100644 KruacentExiled/KE.Misc/Features/GamblingCoin/Effect/NegativeEffect/RandomBadEffect.cs create mode 100644 KruacentExiled/KE.Misc/Features/GamblingCoin/Effect/NegativeEffect/RandomTeleport.cs create mode 100644 KruacentExiled/KE.Misc/Features/GamblingCoin/Effect/NegativeEffect/RandomizeInventory.cs create mode 100644 KruacentExiled/KE.Misc/Features/GamblingCoin/Effect/NegativeEffect/RedCandy.cs create mode 100644 KruacentExiled/KE.Misc/Features/GamblingCoin/Effect/NegativeEffect/ReduceHP.cs create mode 100644 KruacentExiled/KE.Misc/Features/GamblingCoin/Effect/NegativeEffect/Reversed.cs create mode 100644 KruacentExiled/KE.Misc/Features/GamblingCoin/Effect/NegativeEffect/Shit.cs create mode 100644 KruacentExiled/KE.Misc/Features/GamblingCoin/Effect/NegativeEffect/SwapInventory.cs create mode 100644 KruacentExiled/KE.Misc/Features/GamblingCoin/Effect/NegativeEffect/SwapPosition.cs create mode 100644 KruacentExiled/KE.Misc/Features/GamblingCoin/Effect/NegativeEffect/SwapWithSpectator.cs create mode 100644 KruacentExiled/KE.Misc/Features/GamblingCoin/Effect/NegativeEffect/TeleportToDBoyCell.cs create mode 100644 KruacentExiled/KE.Misc/Features/GamblingCoin/Effect/NegativeEffect/TeleportToEnemy.cs create mode 100644 KruacentExiled/KE.Misc/Features/GamblingCoin/Effect/NegativeEffect/TransformZombie.cs create mode 100644 KruacentExiled/KE.Misc/Features/GamblingCoin/Effect/NegativeEffect/TurnOffLight.cs create mode 100644 KruacentExiled/KE.Misc/Features/GamblingCoin/Effect/NegativeEffect/Vaporize.cs create mode 100644 KruacentExiled/KE.Misc/Features/GamblingCoin/Effect/NegativeEffect/WarheadCoin.cs create mode 100644 KruacentExiled/KE.Misc/Features/GamblingCoin/Effect/NegativeEffect/YouLoveTesla.cs create mode 100644 KruacentExiled/KE.Misc/Features/GamblingCoin/Effect/PositiveEffect/EmptyMicro.cs create mode 100644 KruacentExiled/KE.Misc/Features/GamblingCoin/Effect/PositiveEffect/Erased.cs create mode 100644 KruacentExiled/KE.Misc/Features/GamblingCoin/Effect/PositiveEffect/ForceRespawn.cs create mode 100644 KruacentExiled/KE.Misc/Features/GamblingCoin/Effect/PositiveEffect/GiveKeycard.cs create mode 100644 KruacentExiled/KE.Misc/Features/GamblingCoin/Effect/PositiveEffect/Gnomed.cs create mode 100644 KruacentExiled/KE.Misc/Features/GamblingCoin/Effect/PositiveEffect/HealPlayer.cs create mode 100644 KruacentExiled/KE.Misc/Features/GamblingCoin/Effect/PositiveEffect/IncreasePlayerHealth.cs create mode 100644 KruacentExiled/KE.Misc/Features/GamblingCoin/Effect/PositiveEffect/KaboomCandy.cs create mode 100644 KruacentExiled/KE.Misc/Features/GamblingCoin/Effect/PositiveEffect/Lightbulb.cs create mode 100644 KruacentExiled/KE.Misc/Features/GamblingCoin/Effect/PositiveEffect/NiceHat.cs create mode 100644 KruacentExiled/KE.Misc/Features/GamblingCoin/Effect/PositiveEffect/OneAmmoLogicer.cs create mode 100644 KruacentExiled/KE.Misc/Features/GamblingCoin/Effect/PositiveEffect/RandomGoodEffect.cs create mode 100644 KruacentExiled/KE.Misc/Features/GamblingCoin/Effect/PositiveEffect/RandomItem.cs create mode 100644 KruacentExiled/KE.Misc/Features/GamblingCoin/Effect/PositiveEffect/Revolver.cs create mode 100644 KruacentExiled/KE.Misc/Features/GamblingCoin/Effect/PositiveEffect/SpawnHeal.cs create mode 100644 KruacentExiled/KE.Misc/Features/GamblingCoin/Effect/PositiveEffect/TeleportToEscape.cs create mode 100644 KruacentExiled/KE.Misc/Features/GamblingCoin/EventHandlers.cs create mode 100644 KruacentExiled/KE.Misc/Features/GamblingCoin/GamblingCoinManager.cs create mode 100644 KruacentExiled/KE.Misc/Features/GamblingCoin/Interfaces/ICoinEffect.cs create mode 100644 KruacentExiled/KE.Misc/Features/GamblingCoin/Interfaces/IDurationEffect.cs create mode 100644 KruacentExiled/KE.Misc/Features/GamblingCoin/PlayerUtils.cs create mode 100644 KruacentExiled/KE.Misc/Features/GamblingCoin/Types/EffectType.cs diff --git a/KruacentExiled/KE.Misc/Config.cs b/KruacentExiled/KE.Misc/Config.cs index cce72a68..da67c512 100644 --- a/KruacentExiled/KE.Misc/Config.cs +++ b/KruacentExiled/KE.Misc/Config.cs @@ -23,5 +23,9 @@ public class Config : IConfig public bool ScpPreferences { get; set; } = true; public bool Scp035Enabled { get; set; } = true; + public bool GamblingCoin { get; set; } = true; + public int GamblingCoinMinUse { get; set; } = 1; + public int GamblingCoinMaxUse { get; set; } = 2; + public int GamblingCoinCooldow { get; set; } = 3; } } diff --git a/KruacentExiled/KE.Misc/Features/GamblingCoin/Effect/NegativeEffect/AutoDoor.cs b/KruacentExiled/KE.Misc/Features/GamblingCoin/Effect/NegativeEffect/AutoDoor.cs new file mode 100644 index 00000000..e93ba258 --- /dev/null +++ b/KruacentExiled/KE.Misc/Features/GamblingCoin/Effect/NegativeEffect/AutoDoor.cs @@ -0,0 +1,26 @@ +using Exiled.API.Features; +using Exiled.API.Features.Doors; +using KE.Misc.Features.GamblingCoin; +using KE.Misc.Features.GamblingCoin.Interfaces; +using MapGeneration; +using System; +using System.Linq; +using EffectType = KE.Misc.Features.GamblingCoin.Types.EffectType; + +internal class AutoDoor : ICoinEffect +{ + public string Name { get; set; } = "AutoDoor"; + public string Message { get; set; } = "You are very talented in messing up the game !"; + public int Weight { get; set; } = 5; + public EffectType Type { get; set; } = EffectType.Negative; + + public void Execute(Player player) + { + Array values = Enum.GetValues(typeof(FacilityZone)); + FacilityZone randomZone = (FacilityZone)values.GetValue(UnityEngine.Random.Range(0, values.Length)); + + Door.List.Where(d => d.Position.GetZone() == randomZone).ToList().ForEach(d => d.IsOpen = true); + + PlayerUtils.SendBroadcast(player, "Clap clap clap ! You opened door in " + randomZone); + } +} \ No newline at end of file diff --git a/KruacentExiled/KE.Misc/Features/GamblingCoin/Effect/NegativeEffect/DetonatedFlash.cs b/KruacentExiled/KE.Misc/Features/GamblingCoin/Effect/NegativeEffect/DetonatedFlash.cs new file mode 100644 index 00000000..9bf6ef10 --- /dev/null +++ b/KruacentExiled/KE.Misc/Features/GamblingCoin/Effect/NegativeEffect/DetonatedFlash.cs @@ -0,0 +1,19 @@ +using Exiled.API.Features; +using Exiled.API.Features.Items; +using KE.Misc.Features.GamblingCoin.Interfaces; +using EffectType = KE.Misc.Features.GamblingCoin.Types.EffectType; + +internal class DetonatedFlash : ICoinEffect +{ + public string Name { get; set; } = "DetonatedFlash"; + public string Message { get; set; } = "a gift for your eyes"; + public int Weight { get; set; } = 50; + public EffectType Type { get; set; } = EffectType.Negative; + + public void Execute(Player player) + { + FlashGrenade flash = (FlashGrenade)Item.Create(ItemType.GrenadeFlash, player); + flash.FuseTime = 1f; + flash.SpawnActive(player.Position); + } +} \ No newline at end of file diff --git a/KruacentExiled/KE.Misc/Features/GamblingCoin/Effect/NegativeEffect/EatingStar.cs b/KruacentExiled/KE.Misc/Features/GamblingCoin/Effect/NegativeEffect/EatingStar.cs new file mode 100644 index 00000000..ced10cbe --- /dev/null +++ b/KruacentExiled/KE.Misc/Features/GamblingCoin/Effect/NegativeEffect/EatingStar.cs @@ -0,0 +1,49 @@ +using Exiled.API.Features; +using Exiled.API.Features.Toys; +using KE.Misc.Features.GamblingCoin.Interfaces; +using KE.Misc.Features.GamblingCoin.Types; +using MEC; +using System.Collections.Generic; +using UnityEngine; + +public class EatingStar : IDurationEffect +{ + public string Name { get; set; } = "EatingStar"; + public string Message { get; set; } = "Eating the disco ball wasn't good idea"; + public int Weight { get; set; } = 2; + public EffectType Type { get; set; } = EffectType.Negative; + public static Exiled.API.Features.Toys.Light Light { get; set; } + public float Duration { get; set; } = -1; + private static CoroutineHandle _coroutines; + + public void Execute(Player player) + { + Light = Exiled.API.Features.Toys.Light.Create(player.Position, null, null, true, UnityEngine.Color.blue); + Light.Transform.parent = player.Transform; + + _coroutines = Timing.RunCoroutine(ColorTransformer()); + } + + public IEnumerator ColorTransformer() + { + while (true) + { + Light.Color = ColorPicker(); + Timing.WaitForSeconds(0.5f); + } + } + + public static UnityEngine.Color ColorPicker() + { + byte r = (byte)UnityEngine.Random.Range(0, 256); + byte g = (byte)UnityEngine.Random.Range(0, 256); + byte b = (byte)UnityEngine.Random.Range(0, 256); + + return new UnityEngine.Color32(r, g, b, 0); + } + + public void ExecuteAfterDuration(Player player) + { + Timing.KillCoroutines(_coroutines); + } +} \ No newline at end of file diff --git a/KruacentExiled/KE.Misc/Features/GamblingCoin/Effect/NegativeEffect/FakeNuke.cs b/KruacentExiled/KE.Misc/Features/GamblingCoin/Effect/NegativeEffect/FakeNuke.cs new file mode 100644 index 00000000..90e6dddd --- /dev/null +++ b/KruacentExiled/KE.Misc/Features/GamblingCoin/Effect/NegativeEffect/FakeNuke.cs @@ -0,0 +1,22 @@ +using Exiled.API.Features; +using KE.Misc.Features.GamblingCoin.Interfaces; +using KE.Misc.Features.GamblingCoin.Types; + +internal class FakeNuke : IDurationEffect +{ + public string Name { get; set; } = "FakeNuke"; + public string Message { get; set; } = "Alright everyone will hate you"; + public int Weight { get; set; } = 5; + public EffectType Type { get; set; } = EffectType.Negative; + public float Duration { get; set; } = 15; + + public void Execute(Player player) + { + if(!Warhead.IsDetonated) Warhead.Start(); + } + + public void ExecuteAfterDuration(Player player) + { + if (!Warhead.IsDetonated) Warhead.Stop(); + } +} \ No newline at end of file diff --git a/KruacentExiled/KE.Misc/Features/GamblingCoin/Effect/NegativeEffect/FakeSCPDeath.cs b/KruacentExiled/KE.Misc/Features/GamblingCoin/Effect/NegativeEffect/FakeSCPDeath.cs new file mode 100644 index 00000000..60dab4a9 --- /dev/null +++ b/KruacentExiled/KE.Misc/Features/GamblingCoin/Effect/NegativeEffect/FakeSCPDeath.cs @@ -0,0 +1,52 @@ +using Exiled.API.Extensions; +using Exiled.API.Features; +using KE.Misc.Features.GamblingCoin.Interfaces; +using KE.Misc.Features.GamblingCoin.Types; +using PlayerRoles; +using Respawning.NamingRules; +using System.Collections.Generic; +using System.Linq; + +internal class FakeSCPDeath : ICoinEffect +{ + public string Name { get; set; } = "FakeSCPDeath"; + public string Message { get; set; } = "DID YOU JUST KILLED AN SCP !?!?"; + public int Weight { get; set; } = 40; + public EffectType Type { get; set; } = EffectType.Negative; + + private static readonly Dictionary _scpNames = new() + { + { "1 7 3", "SCP-173"}, + { "9 3 9", "SCP-939"}, + { "0 9 6", "SCP-096"}, + { "0 7 9", "SCP-079"}, + { "0 4 9", "SCP-049"}, + { "1 0 6", "SCP-106"} + }; + + private static readonly Dictionary scpTermination = new() + { + { 0, "SUCCESSFULLY TERMINATED BY AUTOMATIC SECURITY SYSTEM" }, + { 1, "SUCCESSFULLY TERMINATED BY ALPHA WARHEAD" }, + { 2, "LOST IN DECONTAMINATION SEQUENCE" }, + { 3, "CONTAINEDSUCCESSFULLY" }, + { 4, "SUCCESSFULLY TERMINATED . TERMINATION CAUSE UNSPECIFIED" } + }; + + public void Execute(Player player) + { + var scpName = _scpNames.ToList().RandomItem(); + var scpDeath = scpTermination.GetRandomValue(); + string deathMessage = scpDeath.Value; + Team deathTeam = Player.List.Where(p => !p.IsScp).GetRandomValue().Role.Team; + string unitTeam = NineTailedFoxNamingRule.PossibleCodes.GetRandomValue() + "-" + UnityEngine.Random.Range(NineTailedFoxNamingRule.MinUnitNumber, NineTailedFoxNamingRule.MaxUnitNumber); ; + + if (scpDeath.Key == 3) + { + deathMessage += " " + Cassie.ConvertTeam(deathTeam, unitTeam); + } + + Cassie.MessageTranslated($"scp {scpName.Key} successfully terminated by automatic security system", + $"{scpName.Value} ${deathMessage}."); + } +} \ No newline at end of file diff --git a/KruacentExiled/KE.Misc/Features/GamblingCoin/Effect/NegativeEffect/FlipPlayerRole.cs b/KruacentExiled/KE.Misc/Features/GamblingCoin/Effect/NegativeEffect/FlipPlayerRole.cs new file mode 100644 index 00000000..6b275abe --- /dev/null +++ b/KruacentExiled/KE.Misc/Features/GamblingCoin/Effect/NegativeEffect/FlipPlayerRole.cs @@ -0,0 +1,51 @@ +using Exiled.API.Features; +using KE.Misc.Features.GamblingCoin.Interfaces; +using KE.Misc.Features.GamblingCoin.Types; +using PlayerRoles; +using System.Collections.Generic; + +internal class FlipPlayerRole : ICoinEffect +{ + public string Name { get; set; } = "FlipPlayerRole"; + public string Message { get; set; } = "That's what I call an UNO reverse card !"; + public int Weight { get; set; } = 10; + public EffectType Type { get; set; } = EffectType.Negative; + + public void Execute(Player player) + { + player.DropItems(); + switch (player.Role.Type) + { + case RoleTypeId.Scientist: + player.Role.Set(RoleTypeId.ClassD, RoleSpawnFlags.AssignInventory); + break; + case RoleTypeId.ClassD: + player.Role.Set(RoleTypeId.Scientist, RoleSpawnFlags.AssignInventory); + break; + case RoleTypeId.ChaosConscript: + case RoleTypeId.ChaosRifleman: + player.Role.Set(RoleTypeId.NtfSergeant, RoleSpawnFlags.AssignInventory); + break; + case RoleTypeId.ChaosMarauder: + case RoleTypeId.ChaosRepressor: + player.Role.Set(RoleTypeId.NtfCaptain, RoleSpawnFlags.AssignInventory); + break; + case RoleTypeId.FacilityGuard: + player.Role.Set(RoleTypeId.ChaosRifleman, RoleSpawnFlags.AssignInventory); + break; + case RoleTypeId.NtfPrivate: + case RoleTypeId.NtfSergeant: + case RoleTypeId.NtfSpecialist: + player.Role.Set(RoleTypeId.ChaosRifleman, RoleSpawnFlags.AssignInventory); + break; + case RoleTypeId.NtfCaptain: + List roles = new List + { + RoleTypeId.ChaosMarauder, + RoleTypeId.ChaosRepressor + }; + player.Role.Set(roles.RandomItem(), RoleSpawnFlags.AssignInventory); + break; + } + } +} \ No newline at end of file diff --git a/KruacentExiled/KE.Misc/Features/GamblingCoin/Effect/NegativeEffect/Handcuff.cs b/KruacentExiled/KE.Misc/Features/GamblingCoin/Effect/NegativeEffect/Handcuff.cs new file mode 100644 index 00000000..b3da7a64 --- /dev/null +++ b/KruacentExiled/KE.Misc/Features/GamblingCoin/Effect/NegativeEffect/Handcuff.cs @@ -0,0 +1,17 @@ +using Exiled.API.Features; +using KE.Misc.Features.GamblingCoin.Interfaces; +using EffectType = KE.Misc.Features.GamblingCoin.Types.EffectType; + +public class Handcuff : ICoinEffect +{ + public string Name { get; set; } = "Handcuff"; + public string Message { get; set; } = "You were arrested for uhh commiting war crimes... or something"; + public int Weight { get; set; } = 10; + public EffectType Type { get; set; } = EffectType.Negative; + + public void Execute(Player player) + { + player.Handcuff(); + player.DropItems(); + } +} \ No newline at end of file diff --git a/KruacentExiled/KE.Misc/Features/GamblingCoin/Effect/NegativeEffect/InventoryReset.cs b/KruacentExiled/KE.Misc/Features/GamblingCoin/Effect/NegativeEffect/InventoryReset.cs new file mode 100644 index 00000000..b5e8dafd --- /dev/null +++ b/KruacentExiled/KE.Misc/Features/GamblingCoin/Effect/NegativeEffect/InventoryReset.cs @@ -0,0 +1,17 @@ +using Exiled.API.Features; +using KE.Misc.Features.GamblingCoin.Interfaces; +using KE.Misc.Features.GamblingCoin.Types; + +internal class InventoryReset : ICoinEffect +{ + public string Name { get; set; } = "InventoryReset"; + public string Message { get; set; } = "have you ever got item in your inventory ?"; + public int Weight { get; set; } = 20; + public EffectType Type { get; set; } = EffectType.Negative; + + public void Execute(Player player) + { + player.DropHeldItem(); + player.ClearInventory(); + } +} \ No newline at end of file diff --git a/KruacentExiled/KE.Misc/Features/GamblingCoin/Effect/NegativeEffect/Kick.cs b/KruacentExiled/KE.Misc/Features/GamblingCoin/Effect/NegativeEffect/Kick.cs new file mode 100644 index 00000000..f410dcdc --- /dev/null +++ b/KruacentExiled/KE.Misc/Features/GamblingCoin/Effect/NegativeEffect/Kick.cs @@ -0,0 +1,16 @@ +using Exiled.API.Features; +using KE.Misc.Features.GamblingCoin.Interfaces; +using KE.Misc.Features.GamblingCoin.Types; + +internal class Kick : ICoinEffect +{ + public string Name { get; set; } = "Kick"; + public string Message { get; set; } = "Bye !"; + public int Weight { get; set; } = 5; + public EffectType Type { get; set; } = EffectType.Negative; + + public void Execute(Player player) + { + player.Kick("You gamble too much !"); + } +} \ No newline at end of file diff --git a/KruacentExiled/KE.Misc/Features/GamblingCoin/Effect/NegativeEffect/LiveHEGrenade.cs b/KruacentExiled/KE.Misc/Features/GamblingCoin/Effect/NegativeEffect/LiveHEGrenade.cs new file mode 100644 index 00000000..0bd0d0ab --- /dev/null +++ b/KruacentExiled/KE.Misc/Features/GamblingCoin/Effect/NegativeEffect/LiveHEGrenade.cs @@ -0,0 +1,21 @@ +using Exiled.API.Features; +using Exiled.API.Features.Items; +using KE.Misc.Features.GamblingCoin.Interfaces; +using UnityEngine; +using EffectType = KE.Misc.Features.GamblingCoin.Types.EffectType; + +internal class LiveHEGrenade : ICoinEffect +{ + public string Name { get; set; } = "LiveHEGrenade"; + public string Message { get; set; } = "Watch your head !"; + public int Weight { get; set; } = 30; + public EffectType Type { get; set; } = EffectType.Negative; + public static float FuseTime = 3.25f; + + public void Execute(Player player) + { + ExplosiveGrenade grenade = (ExplosiveGrenade)Item.Create(ItemType.GrenadeHE); + grenade.FuseTime = FuseTime; + grenade.SpawnActive(player.Position + Vector3.up, player); + } +} \ No newline at end of file diff --git a/KruacentExiled/KE.Misc/Features/GamblingCoin/Effect/NegativeEffect/MakeOneHp.cs b/KruacentExiled/KE.Misc/Features/GamblingCoin/Effect/NegativeEffect/MakeOneHp.cs new file mode 100644 index 00000000..53917903 --- /dev/null +++ b/KruacentExiled/KE.Misc/Features/GamblingCoin/Effect/NegativeEffect/MakeOneHp.cs @@ -0,0 +1,22 @@ +using Exiled.API.Features; +using KE.Misc.Features.GamblingCoin.Interfaces; +using KE.Misc.Features.GamblingCoin.Types; + +internal class MakeOneHP : ICoinEffect +{ + public string Name { get; set; } = "MakeOneHP"; + public string Message { get; set; } = ""; + public int Weight { get; set; } = 15; + public EffectType Type { get; set; } = EffectType.Negative; + + public void Execute(Player player) + { + if (player.Health > 1) + { + player.Health = 1; + } else + { + player.Hurt(99999, "No luck"); + } + } +} \ No newline at end of file diff --git a/KruacentExiled/KE.Misc/Features/GamblingCoin/Effect/NegativeEffect/PrimedVase.cs b/KruacentExiled/KE.Misc/Features/GamblingCoin/Effect/NegativeEffect/PrimedVase.cs new file mode 100644 index 00000000..77c18358 --- /dev/null +++ b/KruacentExiled/KE.Misc/Features/GamblingCoin/Effect/NegativeEffect/PrimedVase.cs @@ -0,0 +1,19 @@ +using Exiled.API.Features; +using Exiled.API.Features.Items; +using KE.Misc.Features.GamblingCoin.Interfaces; +using KE.Misc.Features.GamblingCoin.Types; + +internal class PrimedVase : ICoinEffect +{ + public string Name { get; set; } = "PrimedVase"; + public string Message { get; set; } = "You're grandma come to visit you"; + public int Weight { get; set; } = 20; + public EffectType Type { get; set; } = EffectType.Negative; + + public void Execute(Player player) + { + Scp244 vase = (Scp244)Item.Create(ItemType.SCP244a); + vase.Primed = true; + vase.CreatePickup(player.Position); + } +} \ No newline at end of file diff --git a/KruacentExiled/KE.Misc/Features/GamblingCoin/Effect/NegativeEffect/RandomBadEffect.cs b/KruacentExiled/KE.Misc/Features/GamblingCoin/Effect/NegativeEffect/RandomBadEffect.cs new file mode 100644 index 00000000..0abeef7a --- /dev/null +++ b/KruacentExiled/KE.Misc/Features/GamblingCoin/Effect/NegativeEffect/RandomBadEffect.cs @@ -0,0 +1,22 @@ +using Exiled.API.Enums; +using Exiled.API.Extensions; +using Exiled.API.Features; +using KE.Misc.Features.GamblingCoin.Interfaces; +using System.Collections.Generic; +using System.Linq; + +internal class RandomBadEffect : ICoinEffect +{ + public string Name { get; set; } = "RandomBadEffect"; + public string Message { get; set; } = "You got a random effect !"; + public int Weight { get; set; } = 20; + public KE.Misc.Features.GamblingCoin.Types.EffectType Type { get; set; } = KE.Misc.Features.GamblingCoin.Types.EffectType.Positive; + + public void Execute(Player player) + { + List effect = new List(); + effect.Where(e => e.GetCategories() == EffectCategory.Negative); + + player.EnableEffect(effect.GetRandomValue(), 9999999); + } +} \ No newline at end of file diff --git a/KruacentExiled/KE.Misc/Features/GamblingCoin/Effect/NegativeEffect/RandomTeleport.cs b/KruacentExiled/KE.Misc/Features/GamblingCoin/Effect/NegativeEffect/RandomTeleport.cs new file mode 100644 index 00000000..e0d82a86 --- /dev/null +++ b/KruacentExiled/KE.Misc/Features/GamblingCoin/Effect/NegativeEffect/RandomTeleport.cs @@ -0,0 +1,22 @@ +using Exiled.API.Enums; +using Exiled.API.Features; +using KE.Misc.Features.GamblingCoin.Interfaces; +using System; +using EffectType = KE.Misc.Features.GamblingCoin.Types.EffectType; + +public class RandomTeleport : ICoinEffect +{ + public string Name { get; set; } = "RandomTeleport"; + public string Message { get; set; } = "You were randomly teleported"; + public int Weight { get; set; } = 15; + public EffectType Type { get; set; } = EffectType.Negative; + + public void Execute(Player player) + { + Array values = Enum.GetValues(typeof(RoomType)); + RoomType randomRoom = (RoomType)values.GetValue(UnityEngine.Random.Range(0, values.Length)); + + + player.Teleport(randomRoom); + } +} \ No newline at end of file diff --git a/KruacentExiled/KE.Misc/Features/GamblingCoin/Effect/NegativeEffect/RandomizeInventory.cs b/KruacentExiled/KE.Misc/Features/GamblingCoin/Effect/NegativeEffect/RandomizeInventory.cs new file mode 100644 index 00000000..447e6999 --- /dev/null +++ b/KruacentExiled/KE.Misc/Features/GamblingCoin/Effect/NegativeEffect/RandomizeInventory.cs @@ -0,0 +1,31 @@ +using Exiled.API.Features; +using KE.Misc.Features.GamblingCoin.Interfaces; +using KE.Misc.Features.GamblingCoin.Types; +using System; + +internal class RandomizeInventory : ICoinEffect +{ + public string Name { get; set; } = "RandomizeInventory"; + public string Message { get; set; } = "You shouldn't gamble !"; + public int Weight { get; set; } = 5; + public EffectType Type { get; set; } = EffectType.Negative; + + public void Execute(Player player) + { + player.ClearInventory(); + int numberOfItem = UnityEngine.Random.Range(0, 9); + + for (int i = 0; i < numberOfItem; i++) + { + player.AddItem(GiveRandomItem()); + } + } + + public static ItemType GiveRandomItem() + { + Array values = Enum.GetValues(typeof(ItemType)); + ItemType randomItem = (ItemType)values.GetValue(UnityEngine.Random.Range(0, values.Length)); + + return randomItem; + } +} \ No newline at end of file diff --git a/KruacentExiled/KE.Misc/Features/GamblingCoin/Effect/NegativeEffect/RedCandy.cs b/KruacentExiled/KE.Misc/Features/GamblingCoin/Effect/NegativeEffect/RedCandy.cs new file mode 100644 index 00000000..b24bae7a --- /dev/null +++ b/KruacentExiled/KE.Misc/Features/GamblingCoin/Effect/NegativeEffect/RedCandy.cs @@ -0,0 +1,20 @@ +using Exiled.API.Features; +using Exiled.API.Features.Items; +using KE.Misc.Features.GamblingCoin.Interfaces; +using EffectType = KE.Misc.Features.GamblingCoin.Types.EffectType; + +public class RedCandy : ICoinEffect +{ + public string Name { get; set; } = "RedCandy"; + public string Message { get; set; } = "You got a pink candy ! Wait is that pink no ?"; + public int Weight { get; set; } = 20; + public EffectType Type { get; set; } = EffectType.Negative; + + public void Execute(Player player) + { + Scp330 candy = (Scp330)Item.Create(ItemType.SCP330); + candy.AddCandy(InventorySystem.Items.Usables.Scp330.CandyKindID.Red); + candy.CreatePickup(player.Position); + return; + } +} \ No newline at end of file diff --git a/KruacentExiled/KE.Misc/Features/GamblingCoin/Effect/NegativeEffect/ReduceHP.cs b/KruacentExiled/KE.Misc/Features/GamblingCoin/Effect/NegativeEffect/ReduceHP.cs new file mode 100644 index 00000000..dbecb256 --- /dev/null +++ b/KruacentExiled/KE.Misc/Features/GamblingCoin/Effect/NegativeEffect/ReduceHP.cs @@ -0,0 +1,21 @@ +using Exiled.API.Features; +using KE.Misc.Features.GamblingCoin.Interfaces; +using KE.Misc.Features.GamblingCoin.Types; + +internal class ReduceHP : ICoinEffect +{ + public string Name { get; set; } = "ReduceHP"; + public string Message { get; set; } = "The coin fall on your head !"; + public int Weight { get; set; } = 20; + public EffectType Type { get; set; } = EffectType.Negative; + + /// + /// Damage dealed to the player + /// + public static float Damage = 30; + + public void Execute(Player player) + { + player.Hurt(Damage, "Coin fall too hard"); + } +} \ No newline at end of file diff --git a/KruacentExiled/KE.Misc/Features/GamblingCoin/Effect/NegativeEffect/Reversed.cs b/KruacentExiled/KE.Misc/Features/GamblingCoin/Effect/NegativeEffect/Reversed.cs new file mode 100644 index 00000000..c9ae9e3f --- /dev/null +++ b/KruacentExiled/KE.Misc/Features/GamblingCoin/Effect/NegativeEffect/Reversed.cs @@ -0,0 +1,38 @@ +using CustomPlayerEffects; +using Exiled.API.Features; +using KE.Misc.Features.GamblingCoin.Interfaces; +using EffectType = KE.Misc.Features.GamblingCoin.Types.EffectType; + +internal class Reversed : IDurationEffect +{ + public string Name { get; set; } = "Reversed"; + public string Message { get; set; } = "Oops ! I connected your keyboard in the wrong way, sorryyyy"; + public float Duration { get; set; } = 60; + public int Weight { get; set; } = 5; + public EffectType Type { get; set; } = EffectType.Negative; + + public void Execute(Player player) + { + StatusEffectBase effect = player.GetEffect(Exiled.API.Enums.EffectType.Slowness); + if (effect.Intensity >= 200) + { + effect.Intensity = 0; + } else + { + player.EnableEffect(Exiled.API.Enums.EffectType.Slowness, 200); + } + } + + public void ExecuteAfterDuration(Player player) + { + StatusEffectBase effect = player.GetEffect(Exiled.API.Enums.EffectType.Slowness); + if (effect.Intensity >= 200) + { + effect.Intensity = 0; + } + else + { + player.EnableEffect(Exiled.API.Enums.EffectType.Slowness, 200); + } + } +} \ No newline at end of file diff --git a/KruacentExiled/KE.Misc/Features/GamblingCoin/Effect/NegativeEffect/Shit.cs b/KruacentExiled/KE.Misc/Features/GamblingCoin/Effect/NegativeEffect/Shit.cs new file mode 100644 index 00000000..fa82e1f5 --- /dev/null +++ b/KruacentExiled/KE.Misc/Features/GamblingCoin/Effect/NegativeEffect/Shit.cs @@ -0,0 +1,17 @@ +using Exiled.API.Features; +using Exiled.API.Features.Items; +using KE.Misc.Features.GamblingCoin.Interfaces; +using KE.Misc.Features.GamblingCoin.Types; + +internal class Shit : ICoinEffect +{ + public string Name { get; set; } = "Shit"; + public string Message { get; set; } = "The tacos of the otherday was not passed very good"; + public int Weight { get; set; } = 40; + public EffectType Type { get; set; } = EffectType.Negative; + + public void Execute(Player player) + { + player.PlaceTantrum(); + } +} \ No newline at end of file diff --git a/KruacentExiled/KE.Misc/Features/GamblingCoin/Effect/NegativeEffect/SwapInventory.cs b/KruacentExiled/KE.Misc/Features/GamblingCoin/Effect/NegativeEffect/SwapInventory.cs new file mode 100644 index 00000000..bc4d47cc --- /dev/null +++ b/KruacentExiled/KE.Misc/Features/GamblingCoin/Effect/NegativeEffect/SwapInventory.cs @@ -0,0 +1,59 @@ +using Exiled.API.Enums; +using Exiled.API.Extensions; +using Exiled.API.Features; +using KE.Misc.Features.GamblingCoin; +using KE.Misc.Features.GamblingCoin.Interfaces; +using System.Collections.Generic; +using System.Linq; +using EffectType = KE.Misc.Features.GamblingCoin.Types.EffectType; + +public class SwapInventory : ICoinEffect +{ + public string Name { get; set; } = "SwapInventory"; + public string Message { get; set; } = "I think you don't deserve this stuff, i take it away"; + public int Weight { get; set; } = 20; + public EffectType Type { get; set; } = EffectType.Negative; + + public void Execute(Player player) + { + List playerList = Player.List.Where(x => x != player && !x.IsScp).ToList(); + + if (playerList.Count(x => x.IsAlive) <= 1) + { + player.Hurt(50); + return; + } + + var target = playerList.Where(x => x != player).ToList().RandomItem(); + + List items1 = player.Items.Select(item => item.Type).ToList(); + List items2 = target.Items.Select(item => item.Type).ToList(); + + Dictionary ammo1 = new(); + Dictionary ammo2 = new(); + for (int i = 0; i < player.Ammo.Count; i++) + { + ammo1.Add(player.Ammo.ElementAt(i).Key.GetAmmoType(), player.Ammo.ElementAt(i).Value); + player.SetAmmo(ammo1.ElementAt(i).Key, 0); + } + for (int i = 0; i < target.Ammo.Count; i++) + { + ammo2.Add(target.Ammo.ElementAt(i).Key.GetAmmoType(), target.Ammo.ElementAt(i).Value); + target.SetAmmo(ammo2.ElementAt(i).Key, 0); + } + + target.ResetInventory(items1); + player.ResetInventory(items2); + + foreach (var ammo in ammo2) + { + player.SetAmmo(ammo.Key, ammo.Value); + } + foreach (var ammo in ammo1) + { + target.SetAmmo(ammo.Key, ammo.Value); + } + + PlayerUtils.SendBroadcast(target, this.Message); + } +} \ No newline at end of file diff --git a/KruacentExiled/KE.Misc/Features/GamblingCoin/Effect/NegativeEffect/SwapPosition.cs b/KruacentExiled/KE.Misc/Features/GamblingCoin/Effect/NegativeEffect/SwapPosition.cs new file mode 100644 index 00000000..985205d3 --- /dev/null +++ b/KruacentExiled/KE.Misc/Features/GamblingCoin/Effect/NegativeEffect/SwapPosition.cs @@ -0,0 +1,31 @@ +using Exiled.API.Features; +using KE.Misc.Features.GamblingCoin; +using KE.Misc.Features.GamblingCoin.Interfaces; +using KE.Misc.Features.GamblingCoin.Types; +using System.Linq; + +internal class SwapPosition : ICoinEffect +{ + public string Name { get; set; } = "InventoryReset"; + public string Message { get; set; } = "Congratulations ! You just unlocked the premium teleport Uber service... but with no refunds."; + public int Weight { get; set; } = 20; + public EffectType Type { get; set; } = EffectType.Negative; + + public void Execute(Player player) + { + var playerList = Player.List.Where(x => x.IsAlive).ToList(); + playerList.Remove(player); + + if (playerList.IsEmpty()) + { + return; + } + + var targetPlayer = playerList.RandomItem(); + var pos = targetPlayer.Position; + + targetPlayer.Teleport(player.Position); + PlayerUtils.SendBroadcast(targetPlayer, this.Message); + player.Teleport(pos); + } +} \ No newline at end of file diff --git a/KruacentExiled/KE.Misc/Features/GamblingCoin/Effect/NegativeEffect/SwapWithSpectator.cs b/KruacentExiled/KE.Misc/Features/GamblingCoin/Effect/NegativeEffect/SwapWithSpectator.cs new file mode 100644 index 00000000..a4aae25c --- /dev/null +++ b/KruacentExiled/KE.Misc/Features/GamblingCoin/Effect/NegativeEffect/SwapWithSpectator.cs @@ -0,0 +1,50 @@ +using Exiled.API.Extensions; +using Exiled.API.Features; +using KE.Misc.Features.GamblingCoin; +using KE.Misc.Features.GamblingCoin.Interfaces; +using KE.Misc.Features.GamblingCoin.Types; +using PlayerRoles; +using System.Collections.Generic; +using System.Linq; + +public class SwapWithSpectator : ICoinEffect +{ + public string Name { get; set; } = "SwapWithSpectator"; + public string Message { get; set; } = "You just made someone's round better !"; + public int Weight { get; set; } = 10; + public EffectType Type { get; set; } = EffectType.Negative; + + public void Execute(Player player) + { + var spectList = Player.List.Where(x => x.Role.Type == RoleTypeId.Spectator).ToList(); + + if (spectList.IsEmpty()) + { + PlayerUtils.SendBroadcast(player, "you got lucky !"); + return; + } + + var spect = spectList.RandomItem(); + + spect.Role.Set(player.Role.Type, RoleSpawnFlags.None); + spect.Teleport(player); + spect.Health = player.Health; + + List playerItems = player.Items.Select(item => item.Type).ToList(); + + foreach (var item in playerItems) + { + spect.AddItem(item); + } + + + for (int i = 0; i < player.Ammo.Count; i++) + { + spect.AddAmmo(player.Ammo.ElementAt(i).Key.GetAmmoType(), player.Ammo.ElementAt(i).Value); + player.SetAmmo(player.Ammo.ElementAt(i).Key.GetAmmoType(), 0); + } + + player.ClearInventory(); + player.Role.Set(RoleTypeId.Spectator); + } +} \ No newline at end of file diff --git a/KruacentExiled/KE.Misc/Features/GamblingCoin/Effect/NegativeEffect/TeleportToDBoyCell.cs b/KruacentExiled/KE.Misc/Features/GamblingCoin/Effect/NegativeEffect/TeleportToDBoyCell.cs new file mode 100644 index 00000000..f26a2533 --- /dev/null +++ b/KruacentExiled/KE.Misc/Features/GamblingCoin/Effect/NegativeEffect/TeleportToDBoyCell.cs @@ -0,0 +1,24 @@ +using Exiled.API.Enums; +using Exiled.API.Features; +using Exiled.API.Features.Doors; +using KE.Misc.Features.GamblingCoin.Interfaces; +using EffectType = KE.Misc.Features.GamblingCoin.Types.EffectType; + +internal class TeleportToDBoyCell : ICoinEffect +{ + public string Name { get; set; } = "TeleportToDBoyCell"; + public string Message { get; set; } = "You got teleported to Class D cells !"; + public int Weight { get; set; } = 5; + public EffectType Type { get; set; } = EffectType.Negative; + + public void Execute(Player player) + { + player.DropHeldItem(); + player.Teleport(Door.Get(DoorType.PrisonDoor)); + + if (Warhead.IsDetonated) + { + player.Kill(DamageType.Decontamination, "You were teleported into a radioactive zone."); + } + } +} \ No newline at end of file diff --git a/KruacentExiled/KE.Misc/Features/GamblingCoin/Effect/NegativeEffect/TeleportToEnemy.cs b/KruacentExiled/KE.Misc/Features/GamblingCoin/Effect/NegativeEffect/TeleportToEnemy.cs new file mode 100644 index 00000000..0058712f --- /dev/null +++ b/KruacentExiled/KE.Misc/Features/GamblingCoin/Effect/NegativeEffect/TeleportToEnemy.cs @@ -0,0 +1,40 @@ +using Exiled.API.Features; +using KE.Misc.Features.GamblingCoin.Interfaces; +using PlayerRoles; +using System.Linq; +using EffectType = KE.Misc.Features.GamblingCoin.Types.EffectType; + +internal class TeleportToEnemy : ICoinEffect +{ + public string Name { get; set; } = "TeleportToEnemy"; + public string Message { get; set; } = "You were teleported to an enemy !!"; + public int Weight { get; set; } = 30; + public EffectType Type { get; set; } = EffectType.Negative; + public static float FuseTime = 3.25f; + + public void Execute(Player player) + { + var scps = Player.List.Where(p => p.IsScp && p.Role != RoleTypeId.Scp079 && p != player).ToList(); + + Player target = null; + + if (scps.Count > 0) + { + target = scps[UnityEngine.Random.Range(0, scps.Count)]; + } + else + { + var enemies = Player.List + .Where(p => p != player && p.Role.Team != player.Role.Team) + .ToList(); + + if (enemies.Count > 0) + target = enemies[UnityEngine.Random.Range(0, enemies.Count)]; + } + + if (target != null) + { + player.Position = target.Position; + } + } +} \ No newline at end of file diff --git a/KruacentExiled/KE.Misc/Features/GamblingCoin/Effect/NegativeEffect/TransformZombie.cs b/KruacentExiled/KE.Misc/Features/GamblingCoin/Effect/NegativeEffect/TransformZombie.cs new file mode 100644 index 00000000..64a8f06a --- /dev/null +++ b/KruacentExiled/KE.Misc/Features/GamblingCoin/Effect/NegativeEffect/TransformZombie.cs @@ -0,0 +1,16 @@ +using Exiled.API.Features; +using KE.Misc.Features.GamblingCoin.Interfaces; +using KE.Misc.Features.GamblingCoin.Types; + +internal class TransformZombie : ICoinEffect +{ + public string Name { get; set; } = "TransformZombie"; + public string Message { get; set; } = "You wanna eat your friends now."; + public int Weight { get; set; } = 30; + public EffectType Type { get; set; } = EffectType.Negative; + + public void Execute(Player player) + { + player.Role.Set(PlayerRoles.RoleTypeId.Scp0492); + } +} \ No newline at end of file diff --git a/KruacentExiled/KE.Misc/Features/GamblingCoin/Effect/NegativeEffect/TurnOffLight.cs b/KruacentExiled/KE.Misc/Features/GamblingCoin/Effect/NegativeEffect/TurnOffLight.cs new file mode 100644 index 00000000..0c82778a --- /dev/null +++ b/KruacentExiled/KE.Misc/Features/GamblingCoin/Effect/NegativeEffect/TurnOffLight.cs @@ -0,0 +1,18 @@ +using Exiled.API.Features; +using KE.Misc.Features.GamblingCoin.Interfaces; +using EffectType = KE.Misc.Features.GamblingCoin.Types.EffectType; + +internal class TurnOffLight : ICoinEffect +{ + public string Name { get; set; } = "TurnOffLight"; + public string Message { get; set; } = "you can't follow the light"; + public int Weight { get; set; } = 10; + public EffectType Type { get; set; } = EffectType.Negative; + + public static int BlackoutTime = 10; + + public void Execute(Player player) + { + Map.TurnOffAllLights(BlackoutTime); + } +} \ No newline at end of file diff --git a/KruacentExiled/KE.Misc/Features/GamblingCoin/Effect/NegativeEffect/Vaporize.cs b/KruacentExiled/KE.Misc/Features/GamblingCoin/Effect/NegativeEffect/Vaporize.cs new file mode 100644 index 00000000..6cfc148a --- /dev/null +++ b/KruacentExiled/KE.Misc/Features/GamblingCoin/Effect/NegativeEffect/Vaporize.cs @@ -0,0 +1,23 @@ +using Exiled.API.Features; +using Exiled.API.Features.Items; +using KE.Misc.Features.GamblingCoin.Interfaces; +using KE.Misc.Features.GamblingCoin.Types; +using MEC; + +internal class Vaporize : ICoinEffect +{ + public string Name { get; set; } = "Vaporize"; + public string Message { get; set; } = "I think eating mosses in your cells is not good for you"; + public int Weight { get; set; } = 1; + public EffectType Type { get; set; } = EffectType.Negative; + + public static int MaxSeconds = 600; + + public void Execute(Player player) + { + Timing.CallDelayed(UnityEngine.Random.Range(30, MaxSeconds), () => + { + player.Vaporize(); + }); + } +} \ No newline at end of file diff --git a/KruacentExiled/KE.Misc/Features/GamblingCoin/Effect/NegativeEffect/WarheadCoin.cs b/KruacentExiled/KE.Misc/Features/GamblingCoin/Effect/NegativeEffect/WarheadCoin.cs new file mode 100644 index 00000000..60e68aa4 --- /dev/null +++ b/KruacentExiled/KE.Misc/Features/GamblingCoin/Effect/NegativeEffect/WarheadCoin.cs @@ -0,0 +1,19 @@ +using Exiled.API.Features; +using KE.Misc.Features.GamblingCoin.Interfaces; +using EffectType = KE.Misc.Features.GamblingCoin.Types.EffectType; + +internal class WarheadCoin : ICoinEffect +{ + public string Name { get; set; } = "Warhead"; + public string Message { get; set; } = "YOU TOUCHED THE RED BUTTON !?!"; + public int Weight { get; set; } = 10; + public EffectType Type { get; set; } = EffectType.Negative; + + public void Execute(Player player) + { + if (Warhead.IsDetonated || !Warhead.IsInProgress) + Warhead.Start(); + else + Warhead.Stop(); + } +} \ No newline at end of file diff --git a/KruacentExiled/KE.Misc/Features/GamblingCoin/Effect/NegativeEffect/YouLoveTesla.cs b/KruacentExiled/KE.Misc/Features/GamblingCoin/Effect/NegativeEffect/YouLoveTesla.cs new file mode 100644 index 00000000..20aa9e98 --- /dev/null +++ b/KruacentExiled/KE.Misc/Features/GamblingCoin/Effect/NegativeEffect/YouLoveTesla.cs @@ -0,0 +1,24 @@ +using Exiled.API.Features; +using KE.Misc.Features.GamblingCoin.Interfaces; +using KE.Misc.Features.GamblingCoin.Types; +using System.Linq; + +internal class YouLoveTesla : ICoinEffect +{ + public string Name { get; set; } = "YouLoveTesla"; + public string Message { get; set; } = "You love Tesla much more than Elon Musk"; + public int Weight { get; set; } = 15; + public EffectType Type { get; set; } = EffectType.Negative; + + public void Execute(Player player) + { + player.DropHeldItem(); + + player.Teleport(Exiled.API.Features.TeslaGate.List.ToList().RandomItem()); + + if (Warhead.IsDetonated) + { + player.Kill(Exiled.API.Enums.DamageType.Decontamination); + } + } +} \ No newline at end of file diff --git a/KruacentExiled/KE.Misc/Features/GamblingCoin/Effect/PositiveEffect/EmptyMicro.cs b/KruacentExiled/KE.Misc/Features/GamblingCoin/Effect/PositiveEffect/EmptyMicro.cs new file mode 100644 index 00000000..8047eabf --- /dev/null +++ b/KruacentExiled/KE.Misc/Features/GamblingCoin/Effect/PositiveEffect/EmptyMicro.cs @@ -0,0 +1,20 @@ +using Exiled.API.Features; +using Exiled.API.Features.Pickups; +using KE.Misc.Features.GamblingCoin.Interfaces; +using KE.Misc.Features.GamblingCoin.Types; + +internal class EmptyMicro : ICoinEffect +{ + public string Name { get; set; } = "EmptyMicro"; + public string Message { get; set; } = "DID YOU JUST GET A MICRO HID !?"; + public int Weight { get; set; } = 5; + public EffectType Type { get; set; } = EffectType.Positive; + + public void Execute(Player player) + { + MicroHIDPickup item = (MicroHIDPickup)Pickup.Create(ItemType.MicroHID); + item.Position = player.Position; + item.Spawn(); + item.Energy = 2; + } +} \ No newline at end of file diff --git a/KruacentExiled/KE.Misc/Features/GamblingCoin/Effect/PositiveEffect/Erased.cs b/KruacentExiled/KE.Misc/Features/GamblingCoin/Effect/PositiveEffect/Erased.cs new file mode 100644 index 00000000..259e135b --- /dev/null +++ b/KruacentExiled/KE.Misc/Features/GamblingCoin/Effect/PositiveEffect/Erased.cs @@ -0,0 +1,17 @@ +using Exiled.API.Features; +using KE.Misc.Features.GamblingCoin.Interfaces; +using KE.Misc.Features.GamblingCoin.Types; +using UnityEngine; + +internal class Erased : ICoinEffect +{ + public string Name { get; set; } = "Erased"; + public string Message { get; set; } = "Il y a un camion qui t'as roulé dessus."; + public int Weight { get; set; } = 20; + public EffectType Type { get; set; } = EffectType.Positive; + + public void Execute(Player player) + { + player.Scale = new Vector3(1.13f, 0.2f, 1.13f); + } +} \ No newline at end of file diff --git a/KruacentExiled/KE.Misc/Features/GamblingCoin/Effect/PositiveEffect/ForceRespawn.cs b/KruacentExiled/KE.Misc/Features/GamblingCoin/Effect/PositiveEffect/ForceRespawn.cs new file mode 100644 index 00000000..75e74084 --- /dev/null +++ b/KruacentExiled/KE.Misc/Features/GamblingCoin/Effect/PositiveEffect/ForceRespawn.cs @@ -0,0 +1,17 @@ +using Exiled.API.Features; +using KE.Misc.Features.GamblingCoin.Interfaces; +using KE.Misc.Features.GamblingCoin.Types; +using Respawning; + +internal class ForceRespawn : ICoinEffect +{ + public string Name { get; set; } = "ForceRespawn"; + public string Message { get; set; } = "Someone respawned... probably."; + public int Weight { get; set; } = 15; + public EffectType Type { get; set; } = EffectType.Positive; + + public void Execute(Player player) + { + Respawn.ForceWave(WaveManager.Waves.RandomItem()); + } +} \ No newline at end of file diff --git a/KruacentExiled/KE.Misc/Features/GamblingCoin/Effect/PositiveEffect/GiveKeycard.cs b/KruacentExiled/KE.Misc/Features/GamblingCoin/Effect/PositiveEffect/GiveKeycard.cs new file mode 100644 index 00000000..56613ced --- /dev/null +++ b/KruacentExiled/KE.Misc/Features/GamblingCoin/Effect/PositiveEffect/GiveKeycard.cs @@ -0,0 +1,31 @@ +using Exiled.API.Features; +using Exiled.API.Features.Pickups; +using KE.Misc.Features.GamblingCoin.Interfaces; +using KE.Misc.Features.GamblingCoin.Types; +using UnityEngine; + +internal class GiveKeycard : ICoinEffect +{ + public string Name { get; set; } = "GiveKeycard"; + public string Message { get; set; } = "You got a keycard !"; + public int Weight { get; set; } = 20; + public EffectType Type { get; set; } = EffectType.Positive; + + /// + /// Chance in % to get a FacilityManager Card instead of containement engineer one. + /// + public static float FacilityManagerCard = 15; + + public void Execute(Player player) + { + int random = UnityEngine.Random.Range(1, 101); + ItemType keycard = ItemType.KeycardContainmentEngineer; + + if(random <= FacilityManagerCard) + { + keycard = ItemType.KeycardFacilityManager; + } + + Pickup.CreateAndSpawn(keycard, player.Position, new Quaternion()); + } +} \ No newline at end of file diff --git a/KruacentExiled/KE.Misc/Features/GamblingCoin/Effect/PositiveEffect/Gnomed.cs b/KruacentExiled/KE.Misc/Features/GamblingCoin/Effect/PositiveEffect/Gnomed.cs new file mode 100644 index 00000000..3ae11980 --- /dev/null +++ b/KruacentExiled/KE.Misc/Features/GamblingCoin/Effect/PositiveEffect/Gnomed.cs @@ -0,0 +1,17 @@ +using Exiled.API.Features; +using KE.Misc.Features.GamblingCoin.Interfaces; +using KE.Misc.Features.GamblingCoin.Types; +using UnityEngine; + +internal class Gnomed : ICoinEffect +{ + public string Name { get; set; } = "Gnomed"; + public string Message { get; set; } = "You got gnomed."; + public int Weight { get; set; } = 20; + public EffectType Type { get; set; } = EffectType.Positive; + + public void Execute(Player player) + { + player.Scale = new Vector3(1.13f, 0.5f, 1.13f); + } +} \ No newline at end of file diff --git a/KruacentExiled/KE.Misc/Features/GamblingCoin/Effect/PositiveEffect/HealPlayer.cs b/KruacentExiled/KE.Misc/Features/GamblingCoin/Effect/PositiveEffect/HealPlayer.cs new file mode 100644 index 00000000..86526dfc --- /dev/null +++ b/KruacentExiled/KE.Misc/Features/GamblingCoin/Effect/PositiveEffect/HealPlayer.cs @@ -0,0 +1,20 @@ +using Exiled.API.Features; +using Exiled.API.Features.Pickups; +using KE.Misc.Features.GamblingCoin.Interfaces; +using KE.Misc.Features.GamblingCoin.Types; +using UnityEngine; + +internal class HealPlayer : ICoinEffect +{ + public string Name { get; set; } = "HealPlayer"; + public string Message { get; set; } = "You got magically healed !"; + public int Weight { get; set; } = 10; + public EffectType Type { get; set; } = EffectType.Positive; + + public static int Heal = 25; + + public void Execute(Player player) + { + player.Heal(Heal, true); + } +} \ No newline at end of file diff --git a/KruacentExiled/KE.Misc/Features/GamblingCoin/Effect/PositiveEffect/IncreasePlayerHealth.cs b/KruacentExiled/KE.Misc/Features/GamblingCoin/Effect/PositiveEffect/IncreasePlayerHealth.cs new file mode 100644 index 00000000..4937b640 --- /dev/null +++ b/KruacentExiled/KE.Misc/Features/GamblingCoin/Effect/PositiveEffect/IncreasePlayerHealth.cs @@ -0,0 +1,23 @@ +using Exiled.API.Features; +using Exiled.API.Features.Pickups; +using KE.Misc.Features.GamblingCoin.Interfaces; +using KE.Misc.Features.GamblingCoin.Types; +using UnityEngine; + +internal class IncreasePlayerHealth : ICoinEffect +{ + public string Name { get; set; } = "IncreasePlayerHeal"; + public string Message { get; set; } = "You're life expectancy is extended !"; + public int Weight { get; set; } = 10; + public EffectType Type { get; set; } = EffectType.Positive; + + /// + /// % of heal applied to the player. + /// + public int Heal = 30; + + public void Execute(Player player) + { + player.Heal(((player.Health*Heal)/100), true); + } +} \ No newline at end of file diff --git a/KruacentExiled/KE.Misc/Features/GamblingCoin/Effect/PositiveEffect/KaboomCandy.cs b/KruacentExiled/KE.Misc/Features/GamblingCoin/Effect/PositiveEffect/KaboomCandy.cs new file mode 100644 index 00000000..0ba17e31 --- /dev/null +++ b/KruacentExiled/KE.Misc/Features/GamblingCoin/Effect/PositiveEffect/KaboomCandy.cs @@ -0,0 +1,19 @@ +using Exiled.API.Features; +using Exiled.API.Features.Items; +using KE.Misc.Features.GamblingCoin.Interfaces; +using KE.Misc.Features.GamblingCoin.Types; + +internal class KaboomCandy : ICoinEffect +{ + public string Name { get; set; } = "KaboomCandy"; + public string Message { get; set; } = "Pink candy kaboooom !!"; + public int Weight { get; set; } = 10; + public EffectType Type { get; set; } = EffectType.Positive; + + public void Execute(Player player) + { + Scp330 candy = (Scp330)Item.Create(ItemType.SCP330); + candy.AddCandy(InventorySystem.Items.Usables.Scp330.CandyKindID.Pink); + candy.CreatePickup(player.Position); + } +} \ No newline at end of file diff --git a/KruacentExiled/KE.Misc/Features/GamblingCoin/Effect/PositiveEffect/Lightbulb.cs b/KruacentExiled/KE.Misc/Features/GamblingCoin/Effect/PositiveEffect/Lightbulb.cs new file mode 100644 index 00000000..92126a18 --- /dev/null +++ b/KruacentExiled/KE.Misc/Features/GamblingCoin/Effect/PositiveEffect/Lightbulb.cs @@ -0,0 +1,18 @@ +using Exiled.API.Features; +using Exiled.API.Features.Pickups; +using KE.Misc.Features.GamblingCoin.Interfaces; +using KE.Misc.Features.GamblingCoin.Types; +using UnityEngine; + +internal class Lightbulb : ICoinEffect +{ + public string Name { get; set; } = "Lightbulb"; + public string Message { get; set; } = "Follow the light !!"; + public int Weight { get; set; } = 15; + public EffectType Type { get; set; } = EffectType.Positive; + + public void Execute(Player player) + { + Pickup.CreateAndSpawn(ItemType.SCP2176, player.Position, new Quaternion()); + } +} \ No newline at end of file diff --git a/KruacentExiled/KE.Misc/Features/GamblingCoin/Effect/PositiveEffect/NiceHat.cs b/KruacentExiled/KE.Misc/Features/GamblingCoin/Effect/PositiveEffect/NiceHat.cs new file mode 100644 index 00000000..9ccdd2a9 --- /dev/null +++ b/KruacentExiled/KE.Misc/Features/GamblingCoin/Effect/PositiveEffect/NiceHat.cs @@ -0,0 +1,18 @@ +using Exiled.API.Features; +using Exiled.API.Features.Pickups; +using KE.Misc.Features.GamblingCoin.Interfaces; +using KE.Misc.Features.GamblingCoin.Types; +using UnityEngine; + +internal class NiceHat : ICoinEffect +{ + public string Name { get; set; } = "NiceHat"; + public string Message { get; set; } = "You've got a nice hat !"; + public int Weight { get; set; } = 10; + public EffectType Type { get; set; } = EffectType.Positive; + + public void Execute(Player player) + { + Pickup.CreateAndSpawn(ItemType.SCP268, player.Position, new Quaternion()); + } +} \ No newline at end of file diff --git a/KruacentExiled/KE.Misc/Features/GamblingCoin/Effect/PositiveEffect/OneAmmoLogicer.cs b/KruacentExiled/KE.Misc/Features/GamblingCoin/Effect/PositiveEffect/OneAmmoLogicer.cs new file mode 100644 index 00000000..8e2cace9 --- /dev/null +++ b/KruacentExiled/KE.Misc/Features/GamblingCoin/Effect/PositiveEffect/OneAmmoLogicer.cs @@ -0,0 +1,19 @@ +using Exiled.API.Features; +using Exiled.API.Features.Items; +using KE.Misc.Features.GamblingCoin.Interfaces; +using KE.Misc.Features.GamblingCoin.Types; + +internal class OneAmmoLogicer : ICoinEffect +{ + public string Name { get; set; } = "OneAmmoLogicer"; + public string Message { get; set; } = "Is that come from you ?!?"; + public int Weight { get; set; } = 1; + public EffectType Type { get; set; } = EffectType.Positive; + + public void Execute(Player player) + { + Firearm gun = (Firearm)Item.Create(ItemType.GunLogicer); + gun.BarrelAmmo = 1; + gun.CreatePickup(player.Position); + } +} \ No newline at end of file diff --git a/KruacentExiled/KE.Misc/Features/GamblingCoin/Effect/PositiveEffect/RandomGoodEffect.cs b/KruacentExiled/KE.Misc/Features/GamblingCoin/Effect/PositiveEffect/RandomGoodEffect.cs new file mode 100644 index 00000000..7f05347b --- /dev/null +++ b/KruacentExiled/KE.Misc/Features/GamblingCoin/Effect/PositiveEffect/RandomGoodEffect.cs @@ -0,0 +1,22 @@ +using Exiled.API.Enums; +using Exiled.API.Extensions; +using Exiled.API.Features; +using KE.Misc.Features.GamblingCoin.Interfaces; +using System.Collections.Generic; +using System.Linq; + +internal class RandomGoodEffect : ICoinEffect +{ + public string Name { get; set; } = "RandomGoodEffect"; + public string Message { get; set; } = "You're wish is accepted !"; + public int Weight { get; set; } = 10; + public KE.Misc.Features.GamblingCoin.Types.EffectType Type { get; set; } = KE.Misc.Features.GamblingCoin.Types.EffectType.Positive; + + public void Execute(Player player) + { + List effect = new List(); + effect.Where(e => e.GetCategories() == EffectCategory.Positive); + + player.EnableEffect(effect.GetRandomValue(), 9999999); + } +} \ No newline at end of file diff --git a/KruacentExiled/KE.Misc/Features/GamblingCoin/Effect/PositiveEffect/RandomItem.cs b/KruacentExiled/KE.Misc/Features/GamblingCoin/Effect/PositiveEffect/RandomItem.cs new file mode 100644 index 00000000..9b41a383 --- /dev/null +++ b/KruacentExiled/KE.Misc/Features/GamblingCoin/Effect/PositiveEffect/RandomItem.cs @@ -0,0 +1,21 @@ +using Exiled.API.Features; +using Exiled.API.Features.Items; +using KE.Misc.Features.GamblingCoin.Interfaces; +using KE.Misc.Features.GamblingCoin.Types; +using System; + +internal class RandomItem : ICoinEffect +{ + public string Name { get; set; } = "RandomItem"; + public string Message { get; set; } = "You got a random item !"; + public int Weight { get; set; } = 35; + public EffectType Type { get; set; } = EffectType.Positive; + + public void Execute(Player player) + { + Array values = Enum.GetValues(typeof(ItemType)); + ItemType randomItem = (ItemType)values.GetValue(UnityEngine.Random.Range(0, values.Length)); + + Item.Create(randomItem).CreatePickup(player.Position); + } +} \ No newline at end of file diff --git a/KruacentExiled/KE.Misc/Features/GamblingCoin/Effect/PositiveEffect/Revolver.cs b/KruacentExiled/KE.Misc/Features/GamblingCoin/Effect/PositiveEffect/Revolver.cs new file mode 100644 index 00000000..f413b0b3 --- /dev/null +++ b/KruacentExiled/KE.Misc/Features/GamblingCoin/Effect/PositiveEffect/Revolver.cs @@ -0,0 +1,21 @@ +using Exiled.API.Features; +using Exiled.API.Features.Items; +using InventorySystem.Items.Firearms.Attachments; +using KE.Misc.Features.GamblingCoin.Interfaces; +using KE.Misc.Features.GamblingCoin.Types; + +internal class Revolver : ICoinEffect +{ + public string Name { get; set; } = "Revolver"; + public string Message { get; set; } = "It's a gift from the sky !!"; + public int Weight { get; set; } = 5; + public EffectType Type { get; set; } = EffectType.Positive; + + public void Execute(Player player) + { + Firearm revo = (Firearm)Item.Create(ItemType.GunRevolver); + revo.AddAttachment(new[] + {AttachmentName.CylinderMag7, AttachmentName.ShortBarrel, AttachmentName.ScopeSight}); + revo.CreatePickup(player.Position); + } +} \ No newline at end of file diff --git a/KruacentExiled/KE.Misc/Features/GamblingCoin/Effect/PositiveEffect/SpawnHeal.cs b/KruacentExiled/KE.Misc/Features/GamblingCoin/Effect/PositiveEffect/SpawnHeal.cs new file mode 100644 index 00000000..edc70727 --- /dev/null +++ b/KruacentExiled/KE.Misc/Features/GamblingCoin/Effect/PositiveEffect/SpawnHeal.cs @@ -0,0 +1,19 @@ +using Exiled.API.Features; +using Exiled.API.Features.Pickups; +using KE.Misc.Features.GamblingCoin.Interfaces; +using KE.Misc.Features.GamblingCoin.Types; +using UnityEngine; + +internal class SpawnHeal : ICoinEffect +{ + public string Name { get; set; } = "SpawnHeal"; + public string Message { get; set; } = "Yipee, you got heal !"; + public int Weight { get; set; } = 35; + public EffectType Type { get; set; } = EffectType.Positive; + + public void Execute(Player player) + { + Pickup.CreateAndSpawn(ItemType.Medkit, player.Position, new Quaternion()); + Pickup.CreateAndSpawn(ItemType.Painkillers, player.Position, new Quaternion()); + } +} \ No newline at end of file diff --git a/KruacentExiled/KE.Misc/Features/GamblingCoin/Effect/PositiveEffect/TeleportToEscape.cs b/KruacentExiled/KE.Misc/Features/GamblingCoin/Effect/PositiveEffect/TeleportToEscape.cs new file mode 100644 index 00000000..d15bf6e6 --- /dev/null +++ b/KruacentExiled/KE.Misc/Features/GamblingCoin/Effect/PositiveEffect/TeleportToEscape.cs @@ -0,0 +1,18 @@ +using Exiled.API.Enums; +using Exiled.API.Features; +using Exiled.API.Features.Doors; +using KE.Misc.Features.GamblingCoin.Interfaces; +using EffectType = KE.Misc.Features.GamblingCoin.Types.EffectType; + +internal class TeleportToEscape : ICoinEffect +{ + public string Name { get; set; } = "TeleportToEscape"; + public string Message { get; set; } = "You got lucky"; + public int Weight { get; set; } = 5; + public EffectType Type { get; set; } = EffectType.Positive; + + public void Execute(Player player) + { + player.Teleport(Door.Get(DoorType.EscapeSecondary)); + } +} \ No newline at end of file diff --git a/KruacentExiled/KE.Misc/Features/GamblingCoin/EventHandlers.cs b/KruacentExiled/KE.Misc/Features/GamblingCoin/EventHandlers.cs new file mode 100644 index 00000000..490d7a9a --- /dev/null +++ b/KruacentExiled/KE.Misc/Features/GamblingCoin/EventHandlers.cs @@ -0,0 +1,79 @@ +using System; +using System.Collections.Generic; +using Exiled.API.Features; +using Exiled.Events.EventArgs.Player; +using KE.Misc.Features.GamblingCoin.Interfaces; +using KE.Misc.Features.GamblingCoin.Types; +using MEC; + +namespace KE.Misc.Features.GamblingCoin +{ + public class EventHandlers + { + private static Config Config => MainPlugin.Instance.Config; + + private readonly System.Random _rd = new(); + private readonly Dictionary _cooldowns = new(); + public static Dictionary CoinUses = new(); + + public void OnCoinFlip(FlippingCoinEventArgs ev) + { + if (_cooldowns.TryGetValue(ev.Player.UserId, out var lastFlip) && + (DateTime.UtcNow - lastFlip).TotalSeconds < Config.GamblingCoinCooldow) + { + ev.IsAllowed = false; + PlayerUtils.SendBroadcast(ev.Player, "You must wait before flipping again"); + return; + } + + _cooldowns[ev.Player.UserId] = DateTime.UtcNow; + + if (!CoinUses.ContainsKey(ev.Player.CurrentItem.Serial)) + { + CoinUses[ev.Player.CurrentItem.Serial] = + _rd.Next(Config.GamblingCoinMinUse, Config.GamblingCoinMaxUse); + + Log.Debug($"Registered new coin: {CoinUses[ev.Player.CurrentItem.Serial]} uses left."); + } + + CoinUses[ev.Player.CurrentItem.Serial]--; + + bool shouldBreak = CoinUses[ev.Player.CurrentItem.Serial] <= 0; + + var type = ev.IsTails ? EffectType.Negative : EffectType.Positive; + + var effect = GamblingCoinManager.GetRandomEffect(type); + + if (effect == null) + { + Log.Warn($"No {type} effect found in GamblingCoinManager!"); + ev.Player.Broadcast(5, "This coin is empty."); + return; + } + + Log.Debug("Effect chosen : " + effect.Name); + + effect.Execute(ev.Player); + + if (effect is IDurationEffect durationEffect && durationEffect.Duration > 0) + { + Timing.CallDelayed(durationEffect.Duration, () => + { + durationEffect.ExecuteAfterDuration(ev.Player); + }); + } + + if (!string.IsNullOrEmpty(effect.Message)) + { + PlayerUtils.SendBroadcast(ev.Player, effect.Message); + } + + if (shouldBreak) + { + CoinUses.Remove(ev.Player.CurrentItem.Serial); + ev.Player.RemoveHeldItem(); + ev.Player.Broadcast(5, "no more coin"); + } + } + } +} \ No newline at end of file diff --git a/KruacentExiled/KE.Misc/Features/GamblingCoin/GamblingCoinManager.cs b/KruacentExiled/KE.Misc/Features/GamblingCoin/GamblingCoinManager.cs new file mode 100644 index 00000000..08fa4bc4 --- /dev/null +++ b/KruacentExiled/KE.Misc/Features/GamblingCoin/GamblingCoinManager.cs @@ -0,0 +1,93 @@ +using Exiled.API.Extensions; +using Exiled.API.Features; +using KE.Misc.Features.GamblingCoin.Interfaces; +using KE.Misc.Features.GamblingCoin.Types; +using KE.Utils.API; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Reflection; + +namespace KE.Misc.Features.GamblingCoin +{ + public static class GamblingCoinManager + { + private static readonly Dictionary _idLookup = new(); + private static readonly Dictionary _nameLookup = new(); + private static readonly HashSet _activeEffects = new(); + + public static List EffectList { get; private set; } = new(); + + public static IEnumerable RegisterAll() + { + List assemblies = new(); + foreach (var plugin in Exiled.Loader.Loader.Plugins) + assemblies.Add(plugin.Assembly); + + IEnumerable effects = ReflectionHelper.GetObjects(assemblies) + .Where(e => e != null); + + foreach (var effect in effects) + { + try + { + Register(effect); + } + catch (Exception ex) + { + Log.Error($"[GamblingCoin] Failed to register {effect.Name} : {ex}"); + } + } + + BuildWeightedList(); + + return effects; + } + + public static void Register(ICoinEffect effect) + { + if (_nameLookup.ContainsKey(effect.Name)) + throw new Exception($"Effect with Name {effect.Name} is already registered."); + + _nameLookup.Add(effect.Name, effect); + + if (effect.Weight > 0) + _activeEffects.Add(effect); + + Log.Debug($"[GamblingCoin] Registered: {effect.Name}"); + + } + + private static void BuildWeightedList() + { + EffectList.Clear(); + foreach (var effect in _activeEffects) + { + for (int i = 0; i < effect.Weight; i++) + EffectList.Add(effect); + } + } + + public static void DestroyAll() + { + _idLookup.Clear(); + _nameLookup.Clear(); + _activeEffects.Clear(); + EffectList.Clear(); + } + + public static ICoinEffect GetRandomEffect() + { + if (EffectList.Count == 0) return null; + + return (EffectList.GetRandomValue()); + } + + public static ICoinEffect GetRandomEffect(EffectType type) + { + if(EffectList.Count == 0) return null; + + return(EffectList.Where(e => e.Type == type).GetRandomValue()); + } + } +} \ No newline at end of file diff --git a/KruacentExiled/KE.Misc/Features/GamblingCoin/Interfaces/ICoinEffect.cs b/KruacentExiled/KE.Misc/Features/GamblingCoin/Interfaces/ICoinEffect.cs new file mode 100644 index 00000000..4fa0ba10 --- /dev/null +++ b/KruacentExiled/KE.Misc/Features/GamblingCoin/Interfaces/ICoinEffect.cs @@ -0,0 +1,37 @@ +using Exiled.API.Features; +using KE.Misc.Features.GamblingCoin.Types; + +namespace KE.Misc.Features.GamblingCoin.Interfaces +{ + /// + /// Represents an effect that can be applied via gambling coin. + /// + public interface ICoinEffect + { + /// + /// Name of the Coin Effect (must be unique). + /// + string Name { get; set; } + + /// + /// Message displayed to the player that used the coin. + /// + string Message { get; set; } + + /// + /// Weight for random selection. Higher weight = higher chance to be chosen. + /// + int Weight { get; set; } + + /// + /// Type of the effect (positive, negative, neutral). + /// + EffectType Type { get; set; } + + /// + /// Executes the effect on the given player. + /// + /// Player to apply the effect to. + void Execute(Player player); + } +} \ No newline at end of file diff --git a/KruacentExiled/KE.Misc/Features/GamblingCoin/Interfaces/IDurationEffect.cs b/KruacentExiled/KE.Misc/Features/GamblingCoin/Interfaces/IDurationEffect.cs new file mode 100644 index 00000000..f1caf467 --- /dev/null +++ b/KruacentExiled/KE.Misc/Features/GamblingCoin/Interfaces/IDurationEffect.cs @@ -0,0 +1,22 @@ +using Exiled.API.Features; +using KE.Misc.Features.GamblingCoin.Types; + +namespace KE.Misc.Features.GamblingCoin.Interfaces +{ + /// + /// Represents an effect that can be applied via gambling coin. + /// + public interface IDurationEffect : ICoinEffect + { + /// + /// Duration of the effect in seconds (-1 for infinite, 0 if not used). + /// + float Duration { get; set; } + + /// + /// Executes the effets on the given player after the duration time. + /// + /// + void ExecuteAfterDuration(Player player); + } +} \ No newline at end of file diff --git a/KruacentExiled/KE.Misc/Features/GamblingCoin/PlayerUtils.cs b/KruacentExiled/KE.Misc/Features/GamblingCoin/PlayerUtils.cs new file mode 100644 index 00000000..e1d0cc87 --- /dev/null +++ b/KruacentExiled/KE.Misc/Features/GamblingCoin/PlayerUtils.cs @@ -0,0 +1,15 @@ +using System; +using System.Linq; +using Exiled.API.Features; + +namespace KE.Misc.Features.GamblingCoin +{ + internal class PlayerUtils + { + public static void SendBroadcast(Player p, string message) + { + // todo better with SSS + p.Broadcast(5, message); + } + } +} diff --git a/KruacentExiled/KE.Misc/Features/GamblingCoin/Types/EffectType.cs b/KruacentExiled/KE.Misc/Features/GamblingCoin/Types/EffectType.cs new file mode 100644 index 00000000..832aafe0 --- /dev/null +++ b/KruacentExiled/KE.Misc/Features/GamblingCoin/Types/EffectType.cs @@ -0,0 +1,14 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace KE.Misc.Features.GamblingCoin.Types +{ + public enum EffectType + { + Positive, + Negative, + } +} diff --git a/KruacentExiled/KE.Misc/MainPlugin.cs b/KruacentExiled/KE.Misc/MainPlugin.cs index 38c3d73a..9ca54974 100644 --- a/KruacentExiled/KE.Misc/MainPlugin.cs +++ b/KruacentExiled/KE.Misc/MainPlugin.cs @@ -13,6 +13,7 @@ using Exiled.CustomRoles.API.Features; using KE.Misc.Features.CR; using LightContainmentZoneDecontamination; +using KE.Misc.Features.GamblingCoin; namespace KE.Misc { @@ -35,6 +36,7 @@ public class MainPlugin : Plugin internal FriendlyFire FriendlyFire { get; private set; } internal AutoNukeAnnoucement AutoNukeAnnoucement { get; private set; } internal AutoTesla AutoTesla { get; private set; } + internal EventHandlers _gamblingCoinHandler { get; private set; } public override void OnEnabled() @@ -51,12 +53,15 @@ public override void OnEnabled() AutoNukeAnnoucement = new(); AutoTesla = new(); Candy = new Candy(); + GamblingCoinManager.RegisterAll(); + _gamblingCoinHandler = new EventHandlers(); Respawn.SetTokens(SpawnableFaction.NtfWave, 2); Respawn.SetTokens(SpawnableFaction.ChaosWave, 2); MiscFeature.SubscribeAllEvents(); + Exiled.Events.Handlers.Player.FlippingCoin += _gamblingCoinHandler.OnCoinFlip; Exiled.Events.Handlers.Server.RoundStarted += AutoNukeAnnoucement.OnRoundStarted; Exiled.Events.Handlers.Player.ChangingRole += SCPBuff.BecomingSCP; ServerHandle.RoundStarted += ServerHandler.OnRoundStarted; @@ -71,6 +76,7 @@ public override void OnDisabled() ServerHandle.RoundStarted -= ServerHandler.OnRoundStarted; Exiled.Events.Handlers.Player.Dying -= ScpNoeDeathMessage; Exiled.Events.Handlers.Server.RoundStarted -= AutoNukeAnnoucement.OnRoundStarted; + Exiled.Events.Handlers.Player.FlippingCoin -= _gamblingCoinHandler.OnCoinFlip; AutoTesla.StopLoop(); MiscFeature.UnsubscribeAllEvents(); @@ -88,6 +94,8 @@ public override void OnDisabled() AutoNukeAnnoucement = null; FriendlyFire = null; SurfaceLight = null; + GamblingCoinManager.DestroyAll(); + _gamblingCoinHandler = null; Instance = null; } From 278fd91f1d3e94d76525a98cdd88c473eedab8b1 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Tue, 30 Sep 2025 19:39:41 +0200 Subject: [PATCH 367/853] reduce the char limit on the arrow --- KruacentExiled/KE.CustomRoles/Settings/SettingHandler.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/KruacentExiled/KE.CustomRoles/Settings/SettingHandler.cs b/KruacentExiled/KE.CustomRoles/Settings/SettingHandler.cs index 3a667c05..e4db8d2c 100644 --- a/KruacentExiled/KE.CustomRoles/Settings/SettingHandler.cs +++ b/KruacentExiled/KE.CustomRoles/Settings/SettingHandler.cs @@ -42,7 +42,7 @@ public SettingHandler() new KeybindSetting(_idDown, "Select down", UnityEngine.KeyCode.None,hintDescription:"only work in Select Wheel mode"), new KeybindSetting(_idSelect, "Use selected ability", UnityEngine.KeyCode.None,hintDescription:"only work in Select Wheel mode"), //this crashes the player idk why - SettingBase.Create(new SSPlaintextSetting(_idArrow, "Personalize the arrow next to the selected ability", baseArrow, 64, TMP_InputField.ContentType.Standard, "only work in Select Wheel mode", 0)) + SettingBase.Create(new SSPlaintextSetting(_idArrow, "Personalize the arrow next to the selected ability", baseArrow, 16, TMP_InputField.ContentType.Standard, "only work in Select Wheel mode", 0)) }; } From 93f4ff766512d785e74d94c9892d925ede847afc Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Tue, 30 Sep 2025 19:59:30 +0200 Subject: [PATCH 368/853] fixed omer's stuff --- .../Effect/NegativeEffect/EatingStar.cs | 2 +- .../Effect/NegativeEffect/RedCandy.cs | 1 - .../Effect/NegativeEffect/TeleportToEnemy.cs | 1 - .../Effect/NegativeEffect/WarheadCoin.cs | 2 +- .../Effect/PositiveEffect/Erased.cs | 17 ----------------- .../Features/GamblingCoin/PlayerUtils.cs | 1 + 6 files changed, 3 insertions(+), 21 deletions(-) delete mode 100644 KruacentExiled/KE.Misc/Features/GamblingCoin/Effect/PositiveEffect/Erased.cs diff --git a/KruacentExiled/KE.Misc/Features/GamblingCoin/Effect/NegativeEffect/EatingStar.cs b/KruacentExiled/KE.Misc/Features/GamblingCoin/Effect/NegativeEffect/EatingStar.cs index ced10cbe..4ad1dc74 100644 --- a/KruacentExiled/KE.Misc/Features/GamblingCoin/Effect/NegativeEffect/EatingStar.cs +++ b/KruacentExiled/KE.Misc/Features/GamblingCoin/Effect/NegativeEffect/EatingStar.cs @@ -29,7 +29,7 @@ public IEnumerator ColorTransformer() while (true) { Light.Color = ColorPicker(); - Timing.WaitForSeconds(0.5f); + yield return Timing.WaitForSeconds(0.5f); } } diff --git a/KruacentExiled/KE.Misc/Features/GamblingCoin/Effect/NegativeEffect/RedCandy.cs b/KruacentExiled/KE.Misc/Features/GamblingCoin/Effect/NegativeEffect/RedCandy.cs index b24bae7a..3017d26a 100644 --- a/KruacentExiled/KE.Misc/Features/GamblingCoin/Effect/NegativeEffect/RedCandy.cs +++ b/KruacentExiled/KE.Misc/Features/GamblingCoin/Effect/NegativeEffect/RedCandy.cs @@ -15,6 +15,5 @@ public void Execute(Player player) Scp330 candy = (Scp330)Item.Create(ItemType.SCP330); candy.AddCandy(InventorySystem.Items.Usables.Scp330.CandyKindID.Red); candy.CreatePickup(player.Position); - return; } } \ No newline at end of file diff --git a/KruacentExiled/KE.Misc/Features/GamblingCoin/Effect/NegativeEffect/TeleportToEnemy.cs b/KruacentExiled/KE.Misc/Features/GamblingCoin/Effect/NegativeEffect/TeleportToEnemy.cs index 0058712f..7b366736 100644 --- a/KruacentExiled/KE.Misc/Features/GamblingCoin/Effect/NegativeEffect/TeleportToEnemy.cs +++ b/KruacentExiled/KE.Misc/Features/GamblingCoin/Effect/NegativeEffect/TeleportToEnemy.cs @@ -10,7 +10,6 @@ internal class TeleportToEnemy : ICoinEffect public string Message { get; set; } = "You were teleported to an enemy !!"; public int Weight { get; set; } = 30; public EffectType Type { get; set; } = EffectType.Negative; - public static float FuseTime = 3.25f; public void Execute(Player player) { diff --git a/KruacentExiled/KE.Misc/Features/GamblingCoin/Effect/NegativeEffect/WarheadCoin.cs b/KruacentExiled/KE.Misc/Features/GamblingCoin/Effect/NegativeEffect/WarheadCoin.cs index 60e68aa4..ade9f088 100644 --- a/KruacentExiled/KE.Misc/Features/GamblingCoin/Effect/NegativeEffect/WarheadCoin.cs +++ b/KruacentExiled/KE.Misc/Features/GamblingCoin/Effect/NegativeEffect/WarheadCoin.cs @@ -11,7 +11,7 @@ internal class WarheadCoin : ICoinEffect public void Execute(Player player) { - if (Warhead.IsDetonated || !Warhead.IsInProgress) + if (!Warhead.IsDetonated || !Warhead.IsInProgress) Warhead.Start(); else Warhead.Stop(); diff --git a/KruacentExiled/KE.Misc/Features/GamblingCoin/Effect/PositiveEffect/Erased.cs b/KruacentExiled/KE.Misc/Features/GamblingCoin/Effect/PositiveEffect/Erased.cs deleted file mode 100644 index 259e135b..00000000 --- a/KruacentExiled/KE.Misc/Features/GamblingCoin/Effect/PositiveEffect/Erased.cs +++ /dev/null @@ -1,17 +0,0 @@ -using Exiled.API.Features; -using KE.Misc.Features.GamblingCoin.Interfaces; -using KE.Misc.Features.GamblingCoin.Types; -using UnityEngine; - -internal class Erased : ICoinEffect -{ - public string Name { get; set; } = "Erased"; - public string Message { get; set; } = "Il y a un camion qui t'as roulé dessus."; - public int Weight { get; set; } = 20; - public EffectType Type { get; set; } = EffectType.Positive; - - public void Execute(Player player) - { - player.Scale = new Vector3(1.13f, 0.2f, 1.13f); - } -} \ No newline at end of file diff --git a/KruacentExiled/KE.Misc/Features/GamblingCoin/PlayerUtils.cs b/KruacentExiled/KE.Misc/Features/GamblingCoin/PlayerUtils.cs index e1d0cc87..20bbc400 100644 --- a/KruacentExiled/KE.Misc/Features/GamblingCoin/PlayerUtils.cs +++ b/KruacentExiled/KE.Misc/Features/GamblingCoin/PlayerUtils.cs @@ -1,6 +1,7 @@ using System; using System.Linq; using Exiled.API.Features; +using KE.Utils.API.Displays.DisplayMeow; namespace KE.Misc.Features.GamblingCoin { From 5c0ba6f394d4a2b66e932d5ee93686432693c6e0 Mon Sep 17 00:00:00 2001 From: Omer <27omerf@gmail.com> Date: Wed, 1 Oct 2025 15:46:18 +0200 Subject: [PATCH 369/853] fix the effect --- .../Effect/NegativeEffect/RandomBadEffect.cs | 14 +++++++++++--- .../Effect/PositiveEffect/RandomGoodEffect.cs | 14 +++++++++++--- 2 files changed, 22 insertions(+), 6 deletions(-) diff --git a/KruacentExiled/KE.Misc/Features/GamblingCoin/Effect/NegativeEffect/RandomBadEffect.cs b/KruacentExiled/KE.Misc/Features/GamblingCoin/Effect/NegativeEffect/RandomBadEffect.cs index 0abeef7a..a78c18a4 100644 --- a/KruacentExiled/KE.Misc/Features/GamblingCoin/Effect/NegativeEffect/RandomBadEffect.cs +++ b/KruacentExiled/KE.Misc/Features/GamblingCoin/Effect/NegativeEffect/RandomBadEffect.cs @@ -2,6 +2,7 @@ using Exiled.API.Extensions; using Exiled.API.Features; using KE.Misc.Features.GamblingCoin.Interfaces; +using System; using System.Collections.Generic; using System.Linq; @@ -14,9 +15,16 @@ internal class RandomBadEffect : ICoinEffect public void Execute(Player player) { - List effect = new List(); - effect.Where(e => e.GetCategories() == EffectCategory.Negative); + var positiveEffects = Enum.GetValues(typeof(EffectType)) + .Cast() + .Where(e => e.GetCategories().HasFlag(EffectCategory.Negative)) + .ToList(); - player.EnableEffect(effect.GetRandomValue(), 9999999); + if (positiveEffects.Count == 0) + return; + + var randomEffect = positiveEffects[UnityEngine.Random.Range(0, positiveEffects.Count)]; + + player.EnableEffect(randomEffect, 45); } } \ No newline at end of file diff --git a/KruacentExiled/KE.Misc/Features/GamblingCoin/Effect/PositiveEffect/RandomGoodEffect.cs b/KruacentExiled/KE.Misc/Features/GamblingCoin/Effect/PositiveEffect/RandomGoodEffect.cs index 7f05347b..94f380bb 100644 --- a/KruacentExiled/KE.Misc/Features/GamblingCoin/Effect/PositiveEffect/RandomGoodEffect.cs +++ b/KruacentExiled/KE.Misc/Features/GamblingCoin/Effect/PositiveEffect/RandomGoodEffect.cs @@ -2,6 +2,7 @@ using Exiled.API.Extensions; using Exiled.API.Features; using KE.Misc.Features.GamblingCoin.Interfaces; +using System; using System.Collections.Generic; using System.Linq; @@ -14,9 +15,16 @@ internal class RandomGoodEffect : ICoinEffect public void Execute(Player player) { - List effect = new List(); - effect.Where(e => e.GetCategories() == EffectCategory.Positive); + var positiveEffects = Enum.GetValues(typeof(EffectType)) + .Cast() + .Where(e => e.GetCategories().HasFlag(EffectCategory.Positive)) + .ToList(); - player.EnableEffect(effect.GetRandomValue(), 9999999); + if (positiveEffects.Count == 0) + return; + + var randomEffect = positiveEffects[UnityEngine.Random.Range(0, positiveEffects.Count)]; + + player.EnableEffect(randomEffect, 45); } } \ No newline at end of file From 294255ddbf1547a10974348b89186923bf9f790d Mon Sep 17 00:00:00 2001 From: Omer <27omerf@gmail.com> Date: Wed, 1 Oct 2025 15:47:13 +0200 Subject: [PATCH 370/853] added -1 duration in eventhandler, fix redcandy --- .../Effect/{NegativeEffect => PositiveEffect}/RedCandy.cs | 2 +- .../KE.Misc/Features/GamblingCoin/EventHandlers.cs | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) rename KruacentExiled/KE.Misc/Features/GamblingCoin/Effect/{NegativeEffect => PositiveEffect}/RedCandy.cs (90%) diff --git a/KruacentExiled/KE.Misc/Features/GamblingCoin/Effect/NegativeEffect/RedCandy.cs b/KruacentExiled/KE.Misc/Features/GamblingCoin/Effect/PositiveEffect/RedCandy.cs similarity index 90% rename from KruacentExiled/KE.Misc/Features/GamblingCoin/Effect/NegativeEffect/RedCandy.cs rename to KruacentExiled/KE.Misc/Features/GamblingCoin/Effect/PositiveEffect/RedCandy.cs index 3017d26a..7c7eda3e 100644 --- a/KruacentExiled/KE.Misc/Features/GamblingCoin/Effect/NegativeEffect/RedCandy.cs +++ b/KruacentExiled/KE.Misc/Features/GamblingCoin/Effect/PositiveEffect/RedCandy.cs @@ -8,7 +8,7 @@ public class RedCandy : ICoinEffect public string Name { get; set; } = "RedCandy"; public string Message { get; set; } = "You got a pink candy ! Wait is that pink no ?"; public int Weight { get; set; } = 20; - public EffectType Type { get; set; } = EffectType.Negative; + public EffectType Type { get; set; } = EffectType.Positive; public void Execute(Player player) { diff --git a/KruacentExiled/KE.Misc/Features/GamblingCoin/EventHandlers.cs b/KruacentExiled/KE.Misc/Features/GamblingCoin/EventHandlers.cs index 490d7a9a..4fb31bfb 100644 --- a/KruacentExiled/KE.Misc/Features/GamblingCoin/EventHandlers.cs +++ b/KruacentExiled/KE.Misc/Features/GamblingCoin/EventHandlers.cs @@ -57,7 +57,10 @@ public void OnCoinFlip(FlippingCoinEventArgs ev) if (effect is IDurationEffect durationEffect && durationEffect.Duration > 0) { - Timing.CallDelayed(durationEffect.Duration, () => + float duration = durationEffect.Duration; + if (durationEffect.Duration == -1) duration = 99999; + + Timing.CallDelayed(duration, () => { durationEffect.ExecuteAfterDuration(ev.Player); }); From bb6a9b4acf44e2c818883ebd8d65bb648f6a8585 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Wed, 1 Oct 2025 16:27:11 +0200 Subject: [PATCH 371/853] started p model for 3136 --- .../KE.Items/API/Features/PickupModel.cs | 10 ++++++++- .../Items/PickupModels/Scp3136PModel.cs | 5 +++-- KruacentExiled/KE.Items/Items/Scp3136.cs | 21 ++++++++++++++++--- 3 files changed, 30 insertions(+), 6 deletions(-) diff --git a/KruacentExiled/KE.Items/API/Features/PickupModel.cs b/KruacentExiled/KE.Items/API/Features/PickupModel.cs index a9314529..d3ee3507 100644 --- a/KruacentExiled/KE.Items/API/Features/PickupModel.cs +++ b/KruacentExiled/KE.Items/API/Features/PickupModel.cs @@ -24,6 +24,7 @@ public abstract class PickupModel public PickupModel(CustomItem customItem) { + Log.Debug("created Pmodel " + customItem.Name); KECI = customItem; models = new(); pickableItem = new(); @@ -80,7 +81,6 @@ public static bool AnyCheck(Pickup pickup) { foreach (PickupModel model in allModels) { - if (model.Check(pickup)) { return true; @@ -93,7 +93,15 @@ private void OnPickupAdded(ItemPickupBase obj) { Pickup pickup = Pickup.Get(obj); + if(pickup.Type == ItemType.SCP1576) + { + Log.Debug("pickup =" + pickup.Type); + Log.Debug("ci =" + KECI.Name); + } + + if (!Check(pickup)) return; + if (modelBlueprint is null) { modelBlueprint = CreateModel(); diff --git a/KruacentExiled/KE.Items/Items/PickupModels/Scp3136PModel.cs b/KruacentExiled/KE.Items/Items/PickupModels/Scp3136PModel.cs index fa2a5bec..e62a37dc 100644 --- a/KruacentExiled/KE.Items/Items/PickupModels/Scp3136PModel.cs +++ b/KruacentExiled/KE.Items/Items/PickupModels/Scp3136PModel.cs @@ -27,8 +27,9 @@ protected override HashSet CreateModel() { HashSet model = new() { - AdminToyBlueprint.Create(Primitive.Create(PrimitiveType.Cube, Vector3.zero, null, paper,false,Color.white)), - AdminToyBlueprint.Create(Primitive.Create(PrimitiveType.Cylinder, new Vector3(paper.x, paper.y+pen.x*2,-paper.z), Vector3.left, pen,false,Color.red)), + + new PrimitiveBlueprint(PrimitiveType.Cube,Vector3.zero,Quaternion.identity,Color.white,paper), + new PrimitiveBlueprint(PrimitiveType.Cylinder,new Vector3(paper.x, paper.y+pen.x*2,-paper.z),Quaternion.Euler(Vector3.left),Color.red,pen), }; return model; diff --git a/KruacentExiled/KE.Items/Items/Scp3136.cs b/KruacentExiled/KE.Items/Items/Scp3136.cs index e0ae3240..62a50c79 100644 --- a/KruacentExiled/KE.Items/Items/Scp3136.cs +++ b/KruacentExiled/KE.Items/Items/Scp3136.cs @@ -7,6 +7,8 @@ using Exiled.Events.EventArgs.Player; using Exiled.Events.EventArgs.Server; using KE.Items.API.Features; +using KE.Items.API.Interface; +using KE.Items.Items.PickupModels; using MEC; using PlayerRoles; using System; @@ -19,7 +21,7 @@ namespace KE.Items.Items { [CustomItem(ItemType.SCP1576)] - public class Scp3136 : KECustomItem + public class Scp3136 : KECustomItem, ICustomPickupModel { public override uint Id { get; set; } = 1057; public override string Name { get; set; } = "SCP-3136"; @@ -46,14 +48,23 @@ public class Scp3136 : KECustomItem } }; + public PickupModel PickupModel { get; } + + public Scp3136() + { + //PickupModel = new Scp3136PModel(this); + } + protected override void SubscribeEvents() { Exiled.Events.Handlers.Player.UsedItem += OnDrawing; Exiled.Events.Handlers.Server.RespawnedTeam += OnRespawnedTeam; + PickupModel?.SubscribeEvents(); base.SubscribeEvents(); } protected override void UnsubscribeEvents() { + PickupModel?.UnsubscribeEvents(); Exiled.Events.Handlers.Player.UsedItem -= OnDrawing; Exiled.Events.Handlers.Server.RespawnedTeam -= OnRespawnedTeam; base.UnsubscribeEvents(); @@ -62,6 +73,7 @@ protected override void UnsubscribeEvents() private void OnDrawing(UsedItemEventArgs ev) { if (!Check(ev.Item)) return; + Scp1576 item = ((Scp1576)ev.Item); switch (ev.Player.Role.Side) { case Side.Mtf: @@ -72,8 +84,11 @@ private void OnDrawing(UsedItemEventArgs ev) _respawnPositions[Faction.FoundationEnemy] = ev.Player.Position; break; } - Timing.CallDelayed(1, () => ((Scp1576)ev.Item).StopTransmitting()); - + item.StopTransmitting(); + item.RemainingCooldown = 5*60; + + + } private void OnRespawnedTeam(RespawnedTeamEventArgs ev) From 673e79b6828db6a5c7d1bd2f98cea19db4eff4a0 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Wed, 1 Oct 2025 16:37:49 +0200 Subject: [PATCH 372/853] added more patterns --- .../Others/BlackoutNDoor/Handlers/Pattern.cs | 28 ++++++++++++++----- 1 file changed, 21 insertions(+), 7 deletions(-) diff --git a/KruacentExiled/KE.Map/Others/BlackoutNDoor/Handlers/Pattern.cs b/KruacentExiled/KE.Map/Others/BlackoutNDoor/Handlers/Pattern.cs index fd2628f5..f91cfbf1 100644 --- a/KruacentExiled/KE.Map/Others/BlackoutNDoor/Handlers/Pattern.cs +++ b/KruacentExiled/KE.Map/Others/BlackoutNDoor/Handlers/Pattern.cs @@ -26,9 +26,28 @@ public class Pattern : IEquatable , new Pattern ([ - new DoorStuck(),new Blackout(),new Both(),new Blackout(),new DoorStuck() + new DoorStuck(),new Blackout(),new Both(),new Blackout(),new DoorStuck(),new Both() + ]) + , + new Pattern + ([ + new DoorStuck(),new Blackout(),new Both() + ]) + , + new Pattern + ([ + new DoorStuck(),new Both() + ]) + , + new Pattern + ([ + new Blackout(),new Both() + ]) + , + new Pattern + ([ + new Blackout(),new Both() ]) - }; @@ -69,10 +88,5 @@ public bool Equals(Pattern other) } - - - - - } } From 6770b1e68629ba0fe55d0c8c9ea7d1922014242f Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Wed, 1 Oct 2025 16:38:18 +0200 Subject: [PATCH 373/853] added debug mode --- .../Others/BlackoutNDoor/Handlers/Handler.cs | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/KruacentExiled/KE.Map/Others/BlackoutNDoor/Handlers/Handler.cs b/KruacentExiled/KE.Map/Others/BlackoutNDoor/Handlers/Handler.cs index aab3eab5..7bc69c2f 100644 --- a/KruacentExiled/KE.Map/Others/BlackoutNDoor/Handlers/Handler.cs +++ b/KruacentExiled/KE.Map/Others/BlackoutNDoor/Handlers/Handler.cs @@ -46,12 +46,18 @@ public void UnsubscribeEvents() private void OnRoundStarted() { ChosenPattern = Pattern.AllPatterns.GetRandomValue(); - ChosenPattern = new Pattern - ([ - new Blackout(),new DoorStuck() - ]); - //time = GetRandomTime(); - time = 30; + time = GetRandomTime(); + + if (MainPlugin.Instance.Config.Debug) + { + time = 30; + ChosenPattern = new Pattern + ([ + new Blackout(),new DoorStuck() + ]); + } + + Timing.RunCoroutine(Timer()); } From 0f6ccb38d9ca9d8f4413e6517768fe3e504331b9 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Thu, 2 Oct 2025 19:18:48 +0200 Subject: [PATCH 374/853] disabled coin --- KruacentExiled/KE.Misc/MainPlugin.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/KruacentExiled/KE.Misc/MainPlugin.cs b/KruacentExiled/KE.Misc/MainPlugin.cs index 013b3819..ed03f7a3 100644 --- a/KruacentExiled/KE.Misc/MainPlugin.cs +++ b/KruacentExiled/KE.Misc/MainPlugin.cs @@ -62,7 +62,7 @@ public override void OnEnabled() MiscFeature.SubscribeAllEvents(); - Exiled.Events.Handlers.Player.FlippingCoin += _gamblingCoinHandler.OnCoinFlip; + //Exiled.Events.Handlers.Player.FlippingCoin += _gamblingCoinHandler.OnCoinFlip; Exiled.Events.Handlers.Server.RoundStarted += AutoNukeAnnoucement.OnRoundStarted; Exiled.Events.Handlers.Player.ChangingRole += SCPBuff.BecomingSCP; ServerHandle.RoundStarted += ServerHandler.OnRoundStarted; @@ -77,7 +77,7 @@ public override void OnDisabled() ServerHandle.RoundStarted -= ServerHandler.OnRoundStarted; Exiled.Events.Handlers.Player.Dying -= ScpNoeDeathMessage; Exiled.Events.Handlers.Server.RoundStarted -= AutoNukeAnnoucement.OnRoundStarted; - Exiled.Events.Handlers.Player.FlippingCoin -= _gamblingCoinHandler.OnCoinFlip; + //Exiled.Events.Handlers.Player.FlippingCoin -= _gamblingCoinHandler.OnCoinFlip; AutoTesla.StopLoop(); MiscFeature.UnsubscribeAllEvents(); ClassDDoor.UnsubscribeEvents(); From 71a505db17e4525aa08e7e7a95d868477de7ee86 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Thu, 2 Oct 2025 20:06:38 +0200 Subject: [PATCH 375/853] added a way to disable the coins --- KruacentExiled/KE.Misc/MainPlugin.cs | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/KruacentExiled/KE.Misc/MainPlugin.cs b/KruacentExiled/KE.Misc/MainPlugin.cs index ed03f7a3..9f57cfd0 100644 --- a/KruacentExiled/KE.Misc/MainPlugin.cs +++ b/KruacentExiled/KE.Misc/MainPlugin.cs @@ -53,8 +53,6 @@ public override void OnEnabled() AutoNukeAnnoucement = new(); AutoTesla = new(); Candy = new Candy(); - GamblingCoinManager.RegisterAll(); - _gamblingCoinHandler = new EventHandlers(); Respawn.SetTokens(SpawnableFaction.NtfWave, 2); Respawn.SetTokens(SpawnableFaction.ChaosWave, 2); @@ -62,7 +60,14 @@ public override void OnEnabled() MiscFeature.SubscribeAllEvents(); - //Exiled.Events.Handlers.Player.FlippingCoin += _gamblingCoinHandler.OnCoinFlip; + + if (Config.GamblingCoin) + { + GamblingCoinManager.RegisterAll(); + _gamblingCoinHandler = new EventHandlers(); + Exiled.Events.Handlers.Player.FlippingCoin += _gamblingCoinHandler.OnCoinFlip; + } + Exiled.Events.Handlers.Server.RoundStarted += AutoNukeAnnoucement.OnRoundStarted; Exiled.Events.Handlers.Player.ChangingRole += SCPBuff.BecomingSCP; ServerHandle.RoundStarted += ServerHandler.OnRoundStarted; @@ -77,7 +82,11 @@ public override void OnDisabled() ServerHandle.RoundStarted -= ServerHandler.OnRoundStarted; Exiled.Events.Handlers.Player.Dying -= ScpNoeDeathMessage; Exiled.Events.Handlers.Server.RoundStarted -= AutoNukeAnnoucement.OnRoundStarted; - //Exiled.Events.Handlers.Player.FlippingCoin -= _gamblingCoinHandler.OnCoinFlip; + + if (Config.GamblingCoin) + { + Exiled.Events.Handlers.Player.FlippingCoin -= _gamblingCoinHandler.OnCoinFlip; + } AutoTesla.StopLoop(); MiscFeature.UnsubscribeAllEvents(); ClassDDoor.UnsubscribeEvents(); From 7c874c17e5a1fb423b551d68380ddd8347a922d9 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Fri, 3 Oct 2025 15:10:52 +0200 Subject: [PATCH 376/853] oops --- KruacentExiled/KE.Map/Heavy/GamblingZone/GamblingRoom.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/KruacentExiled/KE.Map/Heavy/GamblingZone/GamblingRoom.cs b/KruacentExiled/KE.Map/Heavy/GamblingZone/GamblingRoom.cs index 85393bd7..d36d3b36 100644 --- a/KruacentExiled/KE.Map/Heavy/GamblingZone/GamblingRoom.cs +++ b/KruacentExiled/KE.Map/Heavy/GamblingZone/GamblingRoom.cs @@ -121,7 +121,7 @@ public void OnPickup(LabApi.Features.Wrappers.Player player) { Player player2 = Player.Get(player); if (player2 == null) return; - if (!player2.IsScp) return; + if (player2.IsScp) return; if (player2.CurrentItem == null) return; Item item = _lootTable.GetRandomItem(); From f62fdee1e37485ec56d94771ad9cfd5ccc2707cf Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Fri, 3 Oct 2025 15:21:52 +0200 Subject: [PATCH 377/853] added duration + disabled after the nuke --- .../KE.Map/Others/BlackoutNDoor/Blackout.cs | 2 +- .../KE.Map/Others/BlackoutNDoor/Both.cs | 1 + .../KE.Map/Others/BlackoutNDoor/DoorStuck.cs | 2 +- .../Others/BlackoutNDoor/Handlers/Handler.cs | 9 +++++---- .../Others/BlackoutNDoor/Handlers/MapEvent.cs | 2 +- .../Others/BlackoutNDoor/Handlers/Pattern.cs | 19 ++----------------- 6 files changed, 11 insertions(+), 24 deletions(-) diff --git a/KruacentExiled/KE.Map/Others/BlackoutNDoor/Blackout.cs b/KruacentExiled/KE.Map/Others/BlackoutNDoor/Blackout.cs index 27b06124..ff985780 100644 --- a/KruacentExiled/KE.Map/Others/BlackoutNDoor/Blackout.cs +++ b/KruacentExiled/KE.Map/Others/BlackoutNDoor/Blackout.cs @@ -13,7 +13,7 @@ public class Blackout : MapEvent public override string Cassie => MainPlugin.Translations.Blackout; public override string CassieTranslated => MainPlugin.Translations.BlackoutTranslation; - + public override float Duration => 30; public override void Start(ZoneType zone) { foreach(Room room in Room.List.Where(r => r.Zone == zone)) diff --git a/KruacentExiled/KE.Map/Others/BlackoutNDoor/Both.cs b/KruacentExiled/KE.Map/Others/BlackoutNDoor/Both.cs index 34270f0b..22ee0452 100644 --- a/KruacentExiled/KE.Map/Others/BlackoutNDoor/Both.cs +++ b/KruacentExiled/KE.Map/Others/BlackoutNDoor/Both.cs @@ -13,6 +13,7 @@ public class Both : MapEvent private DoorStuck doorstuck = new(); private Blackout blackout = new(); public override string Cassie => MainPlugin.Translations.Both; + public override float Duration => 20; public override string CassieTranslated => MainPlugin.Translations.BothTranslation; public override void Start(ZoneType zone) diff --git a/KruacentExiled/KE.Map/Others/BlackoutNDoor/DoorStuck.cs b/KruacentExiled/KE.Map/Others/BlackoutNDoor/DoorStuck.cs index 180dfea2..8f53cf36 100644 --- a/KruacentExiled/KE.Map/Others/BlackoutNDoor/DoorStuck.cs +++ b/KruacentExiled/KE.Map/Others/BlackoutNDoor/DoorStuck.cs @@ -17,7 +17,7 @@ public class DoorStuck : MapEvent public override string Cassie => MainPlugin.Translations.Doorstuck; public override string CassieTranslated => MainPlugin.Translations.DoorstuckTranslation; - + public override float Duration => 15; public override void Start(ZoneType zone) { bool open = UnityEngine.Random.value > .5f; diff --git a/KruacentExiled/KE.Map/Others/BlackoutNDoor/Handlers/Handler.cs b/KruacentExiled/KE.Map/Others/BlackoutNDoor/Handlers/Handler.cs index 7bc69c2f..dc97a302 100644 --- a/KruacentExiled/KE.Map/Others/BlackoutNDoor/Handlers/Handler.cs +++ b/KruacentExiled/KE.Map/Others/BlackoutNDoor/Handlers/Handler.cs @@ -9,7 +9,7 @@ using System; using System.Collections.Generic; using System.Linq; - +using UnityEngine; using EventHandle = KE.Map.Others.BlackoutNDoor.Events.Handlers.BlackoutNDoor; namespace KE.Map.Others.BlackoutNDoor.Handlers @@ -67,6 +67,7 @@ private IEnumerator Timer() while (Round.InProgress) { yield return Timing.WaitForSeconds(timeRefresh); + if (Warhead.IsInProgress) continue; Player scp = Player.List.Where(p => p.IsScp && p.Role != RoleTypeId.Scp0492).FirstOrDefault(); if(scp == null) @@ -142,7 +143,7 @@ private void LaunchEvent() EventHandle.OnPreEvent(preEv); - if (preEv.IsAllowed) + if (preEv.IsAllowed && Zones.Contains(zone)) { string message = mapEvent.Cassie + " " + ZoneTypeToCassie(zone) + " " + MainPlugin.Translations.End; @@ -155,9 +156,9 @@ private void LaunchEvent() { Log.Debug("starting"); mapEvent.Start(zone); + float time = Mathf.Clamp(mapEvent.Duration,1, TimeBeforeNextEvent); - - Timing.CallDelayed(10, delegate + Timing.CallDelayed(time, delegate { Log.Debug("stopping"); mapEvent.Stop(zone); diff --git a/KruacentExiled/KE.Map/Others/BlackoutNDoor/Handlers/MapEvent.cs b/KruacentExiled/KE.Map/Others/BlackoutNDoor/Handlers/MapEvent.cs index ea5fd530..ed59a4b9 100644 --- a/KruacentExiled/KE.Map/Others/BlackoutNDoor/Handlers/MapEvent.cs +++ b/KruacentExiled/KE.Map/Others/BlackoutNDoor/Handlers/MapEvent.cs @@ -12,7 +12,7 @@ public abstract class MapEvent public abstract string Cassie { get; } public abstract string CassieTranslated { get; } - + public virtual float Duration { get; } = 10f; public abstract void Start(ZoneType zone); diff --git a/KruacentExiled/KE.Map/Others/BlackoutNDoor/Handlers/Pattern.cs b/KruacentExiled/KE.Map/Others/BlackoutNDoor/Handlers/Pattern.cs index f91cfbf1..f690b7d6 100644 --- a/KruacentExiled/KE.Map/Others/BlackoutNDoor/Handlers/Pattern.cs +++ b/KruacentExiled/KE.Map/Others/BlackoutNDoor/Handlers/Pattern.cs @@ -10,7 +10,7 @@ namespace KE.Map.Others.BlackoutNDoor.Handlers { - public class Pattern : IEquatable + public class Pattern { public static readonly HashSet AllPatterns = new() { @@ -46,7 +46,7 @@ public class Pattern : IEquatable , new Pattern ([ - new Blackout(),new Both() + new Both() ]) }; @@ -72,21 +72,6 @@ public MapEvent GetNext() - public bool Equals(Pattern other) - { - if (other._pattern.Count != _pattern.Count) return false; - - for (int i = 0; i < _pattern.Count; i++) - { - if (_pattern[i] != other._pattern[i]) - { - return false; - } - } - return true; - - } - } } From b5e04383f51a423758e3131e19dd7a1febf0b2f6 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Fri, 3 Oct 2025 15:49:36 +0200 Subject: [PATCH 378/853] changed fireball to a ability --- .../KE.CustomRoles/Abilities/Fireball.cs | 123 ++++++++++++++++++ .../KE.CustomRoles/CR/SCP/SCP457.cs | 110 ++-------------- 2 files changed, 133 insertions(+), 100 deletions(-) create mode 100644 KruacentExiled/KE.CustomRoles/Abilities/Fireball.cs diff --git a/KruacentExiled/KE.CustomRoles/Abilities/Fireball.cs b/KruacentExiled/KE.CustomRoles/Abilities/Fireball.cs new file mode 100644 index 00000000..ea5e9818 --- /dev/null +++ b/KruacentExiled/KE.CustomRoles/Abilities/Fireball.cs @@ -0,0 +1,123 @@ +using Exiled.API.Features; +using Exiled.API.Features.Doors; +using Exiled.API.Features.Roles; +using Exiled.API.Features.Toys; +using Exiled.API.Interfaces; +using KE.CustomRoles.API.Features; +using MEC; +using PlayerStatsSystem; +using System.Collections.Generic; +using UnityEngine; +using Light = Exiled.API.Features.Toys.Light; + +namespace KE.CustomRoles.Abilities +{ + public class Fireball : KEAbilities + { + public override string Name { get; } = "Fireball"; + + public override string Description { get; } = "I cast Fireball"; + + public override int Id => 2010; + + public override float Cooldown { get; } = 2f; + + + public const float VIGOR_COST = .1f; + public static readonly CustomReasonDamageHandler BallDamage = new("Burned to death", 25, string.Empty); + public const int MAX_BALLS = 3; + private static readonly Color ballColor = new(2, 1.08f, 0, .75f); + private Dictionary _activeBalls = new(); + + protected override void AbilityUsed(Player player) + { + if (!_activeBalls.ContainsKey(player)) + { + _activeBalls.Add(player, 0); + } + + + if (_activeBalls[player] >= MAX_BALLS) return; + + + + if (player.Role is Scp106Role role106) + { + if (role106.Vigor <= VIGOR_COST) return; + role106.Vigor -= VIGOR_COST; + } + + _activeBalls[player]++; + Timing.RunCoroutine(LaunchingAttack(player)); + + } + private IEnumerator LaunchingAttack(Player player) + { + Vector3 initpos = player.Position; + Quaternion direction = player.ReferenceHub.PlayerCameraReference.rotation; + + + Log.Debug(direction.eulerAngles); + bool attackTouchedSomething = false; + + Light light = Light.Create(initpos, direction.eulerAngles, null, false); + light.Color = ballColor; + light.Intensity = 1f; + Primitive primitive = Primitive.Create(initpos, direction.eulerAngles, null, false); + primitive.Collidable = false; + primitive.Color = ballColor; + primitive.Spawn(); + light.Spawn(); + Vector3 nextPos; + + int fallback = 100; + while (!attackTouchedSomething && fallback > 0) + { + nextPos = primitive.Position + primitive.Rotation * new Vector3(0, 0, 1f); + RaycastHit hit; + + if (Physics.Linecast(primitive.Position, nextPos, out hit)) + { + //spawn mtf looking at central gate + if (hit.collider.gameObject.name != "VolumeOverrideTunnel") + { + attackTouchedSomething = true; + } + + Player playerhit = Player.Get(hit.collider); + if (playerhit != null && playerhit.Role.Side != player.Role.Side) + { + playerhit.Hurt(BallDamage); + player.ShowHitMarker(); + + } + + Door doorhit = Door.Get(hit.collider.gameObject); + if (doorhit != null && doorhit is IDamageableDoor damageable && !damageable.IsDestroyed) + { + damageable.Break(); + player.ShowHitMarker(); + } + } + + + + + Log.Debug($"current pos = {primitive.Position} next pos = {nextPos}"); + yield return Timing.WaitForSeconds(.1f); + primitive.Position = nextPos; + light.Position = nextPos; + fallback--; + } + _activeBalls[player]--; + primitive.Destroy(); + light.Destroy(); + } + + + + + + } + +} diff --git a/KruacentExiled/KE.CustomRoles/CR/SCP/SCP457.cs b/KruacentExiled/KE.CustomRoles/CR/SCP/SCP457.cs index fe21e6c9..763ced09 100644 --- a/KruacentExiled/KE.CustomRoles/CR/SCP/SCP457.cs +++ b/KruacentExiled/KE.CustomRoles/CR/SCP/SCP457.cs @@ -5,6 +5,7 @@ using Exiled.API.Features.Toys; using Exiled.API.Interfaces; using Exiled.Events.EventArgs.Scp106; +using KE.CustomRoles.Abilities; using KE.CustomRoles.API.Features; using KE.Utils.API; using MEC; @@ -23,7 +24,7 @@ public class SCP457 : CustomSCP public override string Description { get; set; } = "You do passive damage around you, and can lauch fireballs by pressing the stalk button"; public override uint Id { get; set; } = 1084; public override string PublicName { get; set; } = "SCP-457"; - public override int MaxHealth { get; set; } = 3900; + public override int MaxHealth { get; set; } = 4500; public override RoleTypeId Role { get; set; } = RoleTypeId.Scp106; public override bool KeepRoleOnDeath { get; set; } = false; public override bool KeepRoleOnChangingRole { get; set; } = false; @@ -33,23 +34,21 @@ public class SCP457 : CustomSCP private Dictionary _inside = new(); private Dictionary> _handles = new(); - private Dictionary _activeBalls = new(); + public static float DamageRefreshRate = 5f; public static readonly Color FlameColor = new(2, 1.08f, 0); - private static readonly Color ballColor = new(2, 1.08f, 0, .25f); - public static readonly float VigorCost = .1f; - private static readonly string _deathMessage = "Burned to death"; - public static CustomReasonDamageHandler BallDamage = new(_deathMessage, 25, string.Empty); - public const int MAX_BALLS = 2; + + + + protected override void RoleAdded(Player player) { Log.Debug("adding role 457"); _inside.Add(player, null); _handles.Add(player, new()); - _activeBalls.Add(player, 0); _handles[player].Add(Timing.RunCoroutine(InsideLight(player))); _handles[player].Add(Timing.RunCoroutine(PassiveDamage(player))); @@ -59,6 +58,7 @@ protected override void RoleAdded(Player player) private IEnumerator InsideLight(Player player) { Light light = Light.Create(); + light.Intensity = .5f; _inside[player] = light; light.Position = player.Position; light.Color = FlameColor; @@ -77,7 +77,7 @@ private IEnumerator PassiveDamage(Player scp) { while (true) { - foreach (Player allP in Player.List.Where(p => p != scp && !p.IsScp)) + foreach (Player allP in Player.List.Where(p => p != scp && p.Role.Side != scp.Role.Side)) { @@ -88,7 +88,7 @@ private IEnumerator PassiveDamage(Player scp) float damage = -(hitinfo.distance / 3) + 10; Log.Debug($"damâge={damage} dist = {hitinfo.distance}"); allP.EnableEffect(Exiled.API.Enums.EffectType.Burned, DamageRefreshRate, true); - allP.Hurt(damage, _deathMessage); + allP.Hurt(damage, Fireball.BallDamage._deathReason); } @@ -109,11 +109,6 @@ protected override void RoleRemoved(Player player) _inside.Remove(player); } - if (_activeBalls.TryGetValue(player, out var b)) - { - _activeBalls.Remove(player); - } - @@ -129,88 +124,11 @@ protected override void RoleRemoved(Player player) } - private void Attack(Player player, Scp106Role role) - { - - if (role.Vigor > VigorCost && _activeBalls[player] < MAX_BALLS) - { - _activeBalls[player]++; - Timing.RunCoroutine(LaunchingAttack(player)); - role.Vigor -= VigorCost; - } - - } - - private IEnumerator LaunchingAttack(Player player) - { - Vector3 initpos = player.Position; - Quaternion direction = player.ReferenceHub.PlayerCameraReference.rotation; - - - Log.Debug(direction.eulerAngles); - bool attackTouchedSomething = false; - - Light light = Light.Create(initpos, direction.eulerAngles,null,false); - light.Color = ballColor; - light.Intensity = 1f; - Primitive primitive = Primitive.Create(initpos, direction.eulerAngles, null, false); - primitive.Collidable = false; - primitive.Color = ballColor; - primitive.Spawn(); - light.Spawn(); - Vector3 nextPos; - - int fallback = 100; - while (!attackTouchedSomething && fallback > 0) - { - nextPos = primitive.Position + primitive.Rotation * new Vector3(0, 0, 1f); - RaycastHit hit; - - if (Physics.Linecast(primitive.Position, nextPos, out hit)) - { - //spawn mtf looking at central gate - if (hit.collider.gameObject.name != "VolumeOverrideTunnel") - { - attackTouchedSomething = true; - } - - Player playerhit = Player.Get(hit.collider); - if (playerhit != null && playerhit.Role.Side != Exiled.API.Enums.Side.Scp) - { - playerhit.Hurt(BallDamage); - player.ShowHitMarker(); - - } - - Door doorhit = Door.Get(hit.collider.gameObject); - if (doorhit != null && doorhit is IDamageableDoor damageable && !damageable.IsDestroyed) - { - damageable.Break(); - player.ShowHitMarker(); - } - } - - - - - Log.Debug($"current pos = {primitive.Position} next pos = {nextPos}"); - yield return Timing.WaitForSeconds(.1f); - primitive.Position = nextPos; - light.Position = nextPos; - fallback--; - } - _activeBalls[player]--; - primitive.Destroy(); - light.Destroy(); - } - private void OnStalking(StalkingEventArgs ev) { if (!Check(ev.Player)) return; ev.IsAllowed = false; - - Attack(ev.Player, ev.Scp106); } private void OnTP(TeleportingEventArgs ev) @@ -220,18 +138,11 @@ private void OnTP(TeleportingEventArgs ev) } - private void OnAttacking(AttackingEventArgs ev) - { - if (!Check(ev.Player)) return; - ev.IsAllowed = false; - - } protected override void SubscribeEvents() { Exiled.Events.Handlers.Scp106.Stalking += OnStalking; Exiled.Events.Handlers.Scp106.Teleporting += OnTP; - Exiled.Events.Handlers.Scp106.Attacking += OnAttacking; base.SubscribeEvents(); } @@ -240,7 +151,6 @@ protected override void UnsubscribeEvents() { Exiled.Events.Handlers.Scp106.Stalking -= OnStalking; Exiled.Events.Handlers.Scp106.Teleporting -= OnTP; - Exiled.Events.Handlers.Scp106.Attacking -= OnAttacking; base.UnsubscribeEvents(); } From 107adad416590ed96e6b10776c21aac3802c4fa2 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Sun, 5 Oct 2025 20:11:07 +0200 Subject: [PATCH 379/853] added more room in ez --- KruacentExiled/KE.Map/Entrance/EzArmory.cs | 32 ++++ KruacentExiled/KE.Map/Entrance/Locked.cs | 44 +++++ KruacentExiled/KE.Map/Entrance/MoreRoom.cs | 79 +++++++++ KruacentExiled/KE.Map/KE.Map.csproj | 1 + KruacentExiled/KE.Map/MainPlugin.cs | 35 ++-- .../KE.Map/Utils/StructureSpawner.cs | 155 ++++++++++++++++++ 6 files changed, 333 insertions(+), 13 deletions(-) create mode 100644 KruacentExiled/KE.Map/Entrance/EzArmory.cs create mode 100644 KruacentExiled/KE.Map/Entrance/Locked.cs create mode 100644 KruacentExiled/KE.Map/Entrance/MoreRoom.cs create mode 100644 KruacentExiled/KE.Map/Utils/StructureSpawner.cs diff --git a/KruacentExiled/KE.Map/Entrance/EzArmory.cs b/KruacentExiled/KE.Map/Entrance/EzArmory.cs new file mode 100644 index 00000000..e34bd776 --- /dev/null +++ b/KruacentExiled/KE.Map/Entrance/EzArmory.cs @@ -0,0 +1,32 @@ +using Exiled.API.Enums; +using Exiled.API.Features; +using Interactables.Interobjects.DoorUtils; +using KE.Map.Utils; +using LabApi.Events.Arguments.ServerEvents; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using UnityEngine; + +namespace KE.Map.Entrance +{ + public class EzArmory : MoreRoom + { + public override RoomType RoomType => RoomType.EzVent; + + public override int Limit => 1; + + + public override void Create(Vector3 position, Quaternion rotation) + { + StructureSpawner.SpawnDoor(ProjectMER.Features.Enums.DoorType.Ez, position,rotation,new Vector3(2f,1,1f)); + } + + public override void Destroy() + { + + } + } +} diff --git a/KruacentExiled/KE.Map/Entrance/Locked.cs b/KruacentExiled/KE.Map/Entrance/Locked.cs new file mode 100644 index 00000000..d8cd4037 --- /dev/null +++ b/KruacentExiled/KE.Map/Entrance/Locked.cs @@ -0,0 +1,44 @@ +using Exiled.API.Enums; +using Exiled.API.Features; +using Interactables.Interobjects.DoorUtils; +using KE.Map.Utils; +using LabApi.Events.Arguments.ServerEvents; +using LabApi.Features.Wrappers; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using UnityEngine; + +namespace KE.Map.Entrance +{ + public class Locked : MoreRoom + { + public override RoomType RoomType => RoomType.EzVent; + + public override int Limit => 1; + + private PrimitiveObjectToy primitive; + + public override void Create(Vector3 position, Quaternion rotation) + { + Log.Debug("create"); + DoorVariant door1 = StructureSpawner.SpawnDoor(ProjectMER.Features.Enums.DoorType.Gate, position, rotation, new Vector3(.6f, 1.1f, .6f)); + Door door = Door.Get(door1); + + door.Lock(DoorLockReason.AdminCommand, true); + primitive = PrimitiveObjectToy.Create(door.Transform,false); + primitive.Transform.localPosition = Vector3.up * 2; + primitive.Type = PrimitiveType.Cube; + primitive.Flags = AdminToys.PrimitiveFlags.Collidable; + primitive.Scale = new (6,5,1); + primitive.Spawn(); + } + + public override void Destroy() + { + primitive.Destroy(); + } + } +} diff --git a/KruacentExiled/KE.Map/Entrance/MoreRoom.cs b/KruacentExiled/KE.Map/Entrance/MoreRoom.cs new file mode 100644 index 00000000..a7d7ac5c --- /dev/null +++ b/KruacentExiled/KE.Map/Entrance/MoreRoom.cs @@ -0,0 +1,79 @@ +using Exiled.API.Enums; +using Exiled.API.Features; +using LabApi.Events.Arguments.ServerEvents; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using UnityEngine; + +namespace KE.Map.Entrance +{ + public abstract class MoreRoom + { + private static HashSet all = new(); + public MoreRoom() + { + all.Add(this); + } + public abstract RoomType RoomType { get; } + + public abstract void Create(Vector3 position, Quaternion rotation); + public abstract void Destroy(); + + public abstract int Limit { get; } + private int curr = 0; + private static HashSet usedRooms = new(); + + public static void CreateAll() + { + //new EzArmory(); + new Locked(); + } + public static void SubscribeEvents() + { + Exiled.Events.Handlers.Map.Generated += OnMapGenerated; + //LabApi.Events.Handlers.ServerEvents.MapGenerated += OnMapGenerated; + } + + public static void UnsubscribeEvents() + { + Exiled.Events.Handlers.Map.Generated -= OnMapGenerated; + //LabApi.Events.Handlers.ServerEvents.MapGenerated -= OnMapGenerated; + DestroyAll(); + } + public static void DestroyAll() + { + foreach(MoreRoom room in all) + { + room.Destroy(); + } + } + //MapGeneratedEventArgs _ + public static void OnMapGenerated() + { + foreach (MoreRoom room in all) + { + foreach (Room r in Room.List.Where(r => r.Type == room.RoomType && !usedRooms.Contains(r))) + { + if(room.curr < room.Limit) + { + Log.Debug("spawn"); + room.Create(r.Position, r.Rotation); + room.curr++; + usedRooms.Add(r); + } + } + } + } + + + + + + + + + } +} diff --git a/KruacentExiled/KE.Map/KE.Map.csproj b/KruacentExiled/KE.Map/KE.Map.csproj index 1ac6dd60..cc735c6b 100644 --- a/KruacentExiled/KE.Map/KE.Map.csproj +++ b/KruacentExiled/KE.Map/KE.Map.csproj @@ -15,6 +15,7 @@ + diff --git a/KruacentExiled/KE.Map/MainPlugin.cs b/KruacentExiled/KE.Map/MainPlugin.cs index 26b0c3e8..009264ab 100644 --- a/KruacentExiled/KE.Map/MainPlugin.cs +++ b/KruacentExiled/KE.Map/MainPlugin.cs @@ -1,18 +1,23 @@  using Exiled.API.Extensions; using Exiled.API.Features; -using Exiled.API.Features.Doors; using Exiled.API.Interfaces; using Exiled.Events.EventArgs.Server; +using KE.Map.Entrance; using KE.Map.Heavy.GamblingZone; using KE.Map.Others.BlackoutNDoor.Handlers; -using KE.Map.Surface.Turrets; +using KE.Map.Utils; using KE.Utils.API.Models; +using LabApi.Events.Arguments.ServerEvents; +using LabApi.Features.Wrappers; using PlayerRoles; +using ProjectMER.Features.Serializable.Lockers; using System.Collections.Generic; using System.Linq; -using System.Runtime.InteropServices; using UnityEngine; +using Door = Exiled.API.Features.Doors.Door; +using Player = Exiled.API.Features.Player; +using Room = Exiled.API.Features.Room; namespace KE.Map { @@ -29,30 +34,32 @@ public override void OnEnabled() { handler = new(); - handler.SubscribeEvents(); + //handler.SubscribeEvents(); KE.Utils.API.Sounds.SoundPlayer.Instance.TryLoad(); Exiled.Events.Handlers.Map.Generated += OnGenerated; + Exiled.Events.Handlers.Server.RoundStarted += OnRoundStarted; GamblingRoom.SubscribeEvents(); - + //MoreRoom.CreateAll(); + //MoreRoom.SubscribeEvents(); Instance = this; } private void OnRoundStarted() { + //StructureSpawner.SpawnPedestal(ItemType.KeycardJanitor,Player.List.First().Position,Quaternion.identity,Vector3.one); - foreach(Player p in Player.List.Where(p => !p.IsNPC)) - { + Player.List.First().Teleport(Room.List.Where(r => r.Type == Exiled.API.Enums.RoomType.EzVent).First()); - Turret.Create(p, RoleTypeId.ChaosConscript.GetRandomSpawnLocation().Position); - } } + public override void OnDisabled() { - handler.UnsubscribeEvents(); + //handler.UnsubscribeEvents(); Exiled.Events.Handlers.Map.Generated -= OnGenerated; - Exiled.Events.Handlers.Server.RoundEnded -= OnRoundEnded; + Exiled.Events.Handlers.Server.RoundStarted -= OnRoundStarted; GamblingRoom.UnsubscribeEvents(); + //MoreRoom.UnsubscribeEvents(); handler = null; Instance = null; } @@ -100,6 +107,8 @@ private void OnGenerated() var g = new GamblingRoom(RoleTypeId.Scp173.GetRandomSpawnLocation().Position + Vector3.down, new(normal)); + + //var g = new GamblingRoom(lcz173, new(normal), -lcz173.Transform.forward * 5f); /* @@ -127,13 +136,13 @@ private void OnGenerated() - private void OnRoundEnded(RoundEndedEventArgs ev) + /* private void OnRoundEnded(RoundEndedEventArgs ev) { foreach (var g in OldGamblingRoom.List) g.UnsubscribeEvents(); - } + }*/ } diff --git a/KruacentExiled/KE.Map/Utils/StructureSpawner.cs b/KruacentExiled/KE.Map/Utils/StructureSpawner.cs new file mode 100644 index 00000000..fb720f9d --- /dev/null +++ b/KruacentExiled/KE.Map/Utils/StructureSpawner.cs @@ -0,0 +1,155 @@ + +using Exiled.API.Features; +using Interactables; +using Interactables.Interobjects.DoorUtils; +using InventorySystem.Items.Firearms.Attachments; +using LabApi.Features.Wrappers; +using MapGeneration; +using MapGeneration.Distributors; +using MEC; +using Mirror; +using ProjectMER.Commands.Modifying.Position; +using ProjectMER.Commands.Modifying.Rotation; +using ProjectMER.Commands.Modifying.Scale; +using ProjectMER.Features; +using ProjectMER.Features.Enums; +using ProjectMER.Features.Serializable.Lockers; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Reflection; +using System.Text; +using System.Threading.Tasks; +using UnityEngine; +using static PlayerList; +using static PlayerRoles.FirstPersonControl.Thirdperson.Subcontrollers.FeetStabilizerSubcontroller; + +namespace KE.Map.Utils +{ + public static class StructureSpawner + { + public static Dictionary> AdditionalDoors { get; } = new(); + + + + public static DoorVariant GetDoorPrefab(DoorType doortype) + { + return doortype switch + { + DoorType.Lcz => PrefabManager.DoorLcz, + DoorType.Hcz => PrefabManager.DoorHcz, + DoorType.Ez => PrefabManager.DoorEz, + DoorType.Bulkdoor => PrefabManager.DoorHeavyBulk, + DoorType.Gate => PrefabManager.DoorGate, + _ => throw new InvalidOperationException(), + }; + } + + public static MapGeneration.Distributors.Locker LockerPrefab(LockerType lockertype) + { + return lockertype switch + { + LockerType.PedestalScp500 => PrefabManager.PedestalScp500, + LockerType.LargeGun => PrefabManager.LockerLargeGun, + LockerType.RifleRack => PrefabManager.LockerRifleRack, + LockerType.Misc => PrefabManager.LockerMisc, + LockerType.Medkit => PrefabManager.LockerRegularMedkit, + LockerType.Adrenaline => PrefabManager.LockerAdrenalineMedkit, + LockerType.PedestalScp018 => PrefabManager.PedestalScp018, + LockerType.PedestalScp207 => PrefabManager.PedstalScp207, + LockerType.PedestalScp244 => PrefabManager.PedestalScp244, + LockerType.PedestalScp268 => PrefabManager.PedestalScp268, + LockerType.PedestalScp1853 => PrefabManager.PedstalScp1853, + LockerType.PedestalScp2176 => PrefabManager.PedestalScp2176, + LockerType.PedestalScpScp1576 => PrefabManager.PedestalScp1576, + LockerType.PedestalAntiScp207 => PrefabManager.PedestalAntiScp207, + LockerType.PedestalScp1344 => PrefabManager.PedestalScp1344, + LockerType.ExperimentalWeapon => PrefabManager.LockerExperimentalWeapon, + _ => throw new InvalidOperationException(), + }; + } + + + public static DoorVariant SpawnDoor(DoorType doortype,Vector3 position,Quaternion rotation, Vector3 scale) + { + Vector3 absolutePosition = position; + Quaternion absoluteRotation = rotation; + DoorVariant doorVariant = UnityEngine.Object.Instantiate(GetDoorPrefab(doortype)); + if (doorVariant.TryGetComponent(out var component)) + { + UnityEngine.Object.Destroy(component); + } + + doorVariant.transform.SetPositionAndRotation(absolutePosition, absoluteRotation); + doorVariant.transform.localScale = scale; + doorVariant.NetworkTargetState = false; + doorVariant.ServerChangeLock(DoorLockReason.SpecialDoorFeature, false); + doorVariant.RequiredPermissions = new DoorPermissionsPolicy(DoorPermissionFlags.None, false); + + NetworkServer.UnSpawn(doorVariant.gameObject); + NetworkServer.Spawn(doorVariant.gameObject); + FacilityZone zone = doorVariant.transform.position.GetZone(); + + if (!AdditionalDoors.ContainsKey(zone)) + { + AdditionalDoors.Add(zone, new()); + } + AdditionalDoors[zone].Add(doorVariant); + + + + return doorVariant; + } + + public static MapGeneration.Distributors.Locker SpawnPedestal(ItemType item, Vector3 position, Quaternion rotation,Vector3? scale) + { + MapGeneration.Distributors.Locker locker = UnityEngine.Object.Instantiate(LockerPrefab(LockerType.PedestalScp500)); + Vector3 absolutePosition = position; + Quaternion absoluteRotation = rotation; + locker.transform.localScale = scale ?? Vector3.one; + locker.transform.SetPositionAndRotation(absolutePosition, absoluteRotation); + if (locker.TryGetComponent(out var component)) + { + component.Network_position = locker.transform.position; + component.Network_rotationY = (sbyte)Mathf.RoundToInt(locker.transform.rotation.eulerAngles.y / 5.625f); + } + + LabApi.Features.Wrappers.Locker labApiLocker = LabApi.Features.Wrappers.Locker.Get(locker); + + labApiLocker.ClearLockerLoot(); + + + labApiLocker.ClearAllChambers(); + NetworkServer.UnSpawn(locker.gameObject); + NetworkServer.Spawn(locker.gameObject); + + + + foreach (MapGeneration.Distributors.LockerChamber chamber in locker.Chambers) + { + chamber.SpawnItem(item, 1); + } + + return locker; + } + + public static WorkstationController SpawnWorkshop(Vector3 position, Quaternion rotation,Vector3 scale) + { + WorkstationController workstationController = UnityEngine.Object.Instantiate(PrefabManager.Workstation); + Vector3 absolutePosition = position; + Quaternion absoluteRotation = rotation; + workstationController.transform.SetPositionAndRotation(absolutePosition, absoluteRotation); + workstationController.transform.localScale = scale; + workstationController.NetworkStatus = (byte)0u; + if (workstationController.TryGetComponent(out var component)) + { + component.Network_position = workstationController.transform.position; + component.Network_rotationY = (sbyte)Mathf.RoundToInt(workstationController.transform.rotation.eulerAngles.y / 5.625f); + } + + NetworkServer.UnSpawn(workstationController.gameObject); + NetworkServer.Spawn(workstationController.gameObject); + return workstationController; + } + } +} From 334fd300a85bc2145659088995e10e6cbba76d63 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Sun, 5 Oct 2025 20:15:48 +0200 Subject: [PATCH 380/853] corrected swap position --- .../Features/GamblingCoin/Effect/NegativeEffect/SwapPosition.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/KruacentExiled/KE.Misc/Features/GamblingCoin/Effect/NegativeEffect/SwapPosition.cs b/KruacentExiled/KE.Misc/Features/GamblingCoin/Effect/NegativeEffect/SwapPosition.cs index 985205d3..2ac47923 100644 --- a/KruacentExiled/KE.Misc/Features/GamblingCoin/Effect/NegativeEffect/SwapPosition.cs +++ b/KruacentExiled/KE.Misc/Features/GamblingCoin/Effect/NegativeEffect/SwapPosition.cs @@ -6,7 +6,7 @@ internal class SwapPosition : ICoinEffect { - public string Name { get; set; } = "InventoryReset"; + public string Name { get; set; } = "SwapPosition"; public string Message { get; set; } = "Congratulations ! You just unlocked the premium teleport Uber service... but with no refunds."; public int Weight { get; set; } = 20; public EffectType Type { get; set; } = EffectType.Negative; From 4fe59e2b19561a05fdd5b649416477661f7ee134 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Sun, 5 Oct 2025 20:18:34 +0200 Subject: [PATCH 381/853] removed the other paper : too similar to the scp one --- .../KE.CustomRoles/CR/Human/Paper2.cs | 23 ------------------- 1 file changed, 23 deletions(-) delete mode 100644 KruacentExiled/KE.CustomRoles/CR/Human/Paper2.cs diff --git a/KruacentExiled/KE.CustomRoles/CR/Human/Paper2.cs b/KruacentExiled/KE.CustomRoles/CR/Human/Paper2.cs deleted file mode 100644 index e53e0e37..00000000 --- a/KruacentExiled/KE.CustomRoles/CR/Human/Paper2.cs +++ /dev/null @@ -1,23 +0,0 @@ -using Exiled.API.Features.Attributes; -using Exiled.CustomRoles.API.Features; -using KE.CustomRoles.API.Features; -using PlayerRoles; -using System.Collections.Generic; -using UnityEngine; - -namespace KE.CustomRoles.CR.Human -{ - - public class Paper2 : GlobalCustomRole - { - public override SideEnum Side { get; set; } = SideEnum.Human; - public override string Description { get; set; } = "Tu t'es fait roulé dessus !"; - public override uint Id { get; set; } = 1067; - public override string PublicName { get; set; } = "Paper"; - public override bool KeepRoleOnDeath { get; set; } = true; - public override bool KeepRoleOnChangingRole { get; set; } = true; - - public override float SpawnChance { get; set; } = 100; - public override Vector3 Scale { get; set; } = new Vector3(0.2f, 1, 1); - } -} \ No newline at end of file From 16d9edc0ce555531fd052e5c1ebe22cf370cad99 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Sun, 5 Oct 2025 20:50:00 +0200 Subject: [PATCH 382/853] added public name to ability + show desc --- .../API/Features/KEAbilities.cs | 20 +++++-- .../KE.CustomRoles/Abilities/Airstrike.cs | 1 + .../KE.CustomRoles/Abilities/Convert.cs | 3 +- .../KE.CustomRoles/Abilities/Explode.cs | 1 + .../KE.CustomRoles/Abilities/Fireball.cs | 1 + .../KE.CustomRoles/Abilities/ForceOpen.cs | 3 +- .../KE.CustomRoles/Abilities/OpenDoor.cs | 57 ------------------- .../Abilities/SelectPosition.cs | 1 + .../KE.CustomRoles/Abilities/SimulateDeath.cs | 3 +- .../KE.CustomRoles/Abilities/Teleport.cs | 1 + .../KE.CustomRoles/Abilities/Thief.cs | 1 + .../KE.CustomRoles/Abilities/Trade.cs | 1 + KruacentExiled/KE.CustomRoles/MainPlugin.cs | 1 + .../KE.CustomRoles/Settings/SettingHandler.cs | 8 ++- 14 files changed, 37 insertions(+), 65 deletions(-) delete mode 100644 KruacentExiled/KE.CustomRoles/Abilities/OpenDoor.cs diff --git a/KruacentExiled/KE.CustomRoles/API/Features/KEAbilities.cs b/KruacentExiled/KE.CustomRoles/API/Features/KEAbilities.cs index e28961af..162ba002 100644 --- a/KruacentExiled/KE.CustomRoles/API/Features/KEAbilities.cs +++ b/KruacentExiled/KE.CustomRoles/API/Features/KEAbilities.cs @@ -31,6 +31,7 @@ public abstract class KEAbilities #region abstract stuff public abstract string Name { get; } + public abstract string PublicName { get; } public abstract string Description { get; } /// /// Used for the settings option @@ -192,6 +193,15 @@ protected virtual void AbilityRemoved(Player player) } + public void ShowAbility(Player player) + { + float time = MainPlugin.SettingHandler.GetAbilityTime(player); + + string msg = $"{PublicName}\n{Description}"; + + + DisplayHandler.Instance.AddHint(MainPlugin.AbilitiesDesc, player, msg, time); + } public void SelectAbility(Player player) { @@ -202,6 +212,8 @@ public void SelectAbility(Player player) { abilities.UnselectAbility(player); } + + ShowAbility(player); } } @@ -472,7 +484,7 @@ public static bool TryGetSelected(Player player, out KEAbilities ability) #region gui - private static readonly float UpdateTime = 1; + public const float UpdateTime = 1; private static bool flag = false; private static void StartLoop() { @@ -510,7 +522,7 @@ public static void UpdateGUI(Player player) KEAbilities ability = allAbilities[i]; - builder.Append(ability.Name); + builder.Append(ability.PublicName); builder.Append(" "); if (ability.CanUse(player,out var output)) @@ -542,7 +554,7 @@ public static void UpdateGUI(Player player) string msg = builder.ToString(); StringBuilderPool.Pool.Return(builder); - DisplayHandler.Instance.AddHint(MainPlugin.Abilities, player, msg, 1f); + DisplayHandler.Instance.AddHint(MainPlugin.Abilities, player, msg, UpdateTime); } @@ -550,7 +562,7 @@ public static void UpdateGUI(Player player) public override string ToString() { - return Name; + return "("+Id + ") " +Name; } } diff --git a/KruacentExiled/KE.CustomRoles/Abilities/Airstrike.cs b/KruacentExiled/KE.CustomRoles/Abilities/Airstrike.cs index 1af25274..f0cb23fa 100644 --- a/KruacentExiled/KE.CustomRoles/Abilities/Airstrike.cs +++ b/KruacentExiled/KE.CustomRoles/Abilities/Airstrike.cs @@ -20,6 +20,7 @@ namespace KE.CustomRoles.Abilities public class Airstrike : KEAbilities { public override string Name { get; } = "Airstrike"; + public override string PublicName { get; } = "Airstrike"; public override string Description { get; } = "Don't overuse it or your co-op will not be happy"; diff --git a/KruacentExiled/KE.CustomRoles/Abilities/Convert.cs b/KruacentExiled/KE.CustomRoles/Abilities/Convert.cs index 790ecac9..1cae54c7 100644 --- a/KruacentExiled/KE.CustomRoles/Abilities/Convert.cs +++ b/KruacentExiled/KE.CustomRoles/Abilities/Convert.cs @@ -15,8 +15,9 @@ namespace KE.CustomRoles.Abilities public class Convert : KEAbilities { public override string Name { get; } = "Convert"; + public override string PublicName { get; } = "Convert"; - public override string Description { get; } = ""; + public override string Description { get; } = "Convert a zombie into your team"; public override int Id => 2004; diff --git a/KruacentExiled/KE.CustomRoles/Abilities/Explode.cs b/KruacentExiled/KE.CustomRoles/Abilities/Explode.cs index 031cda80..03995989 100644 --- a/KruacentExiled/KE.CustomRoles/Abilities/Explode.cs +++ b/KruacentExiled/KE.CustomRoles/Abilities/Explode.cs @@ -15,6 +15,7 @@ namespace KE.CustomRoles.Abilities public class Explode : KEAbilities { public override string Name { get; } = "Explode"; + public override string PublicName { get; } = "Explode"; public override string Description { get; } = "Tu as une ceinture d'explosif autour de toi, fait attention n'appuie pas sur le bouton"; diff --git a/KruacentExiled/KE.CustomRoles/Abilities/Fireball.cs b/KruacentExiled/KE.CustomRoles/Abilities/Fireball.cs index ea5e9818..37eb77b9 100644 --- a/KruacentExiled/KE.CustomRoles/Abilities/Fireball.cs +++ b/KruacentExiled/KE.CustomRoles/Abilities/Fireball.cs @@ -15,6 +15,7 @@ namespace KE.CustomRoles.Abilities public class Fireball : KEAbilities { public override string Name { get; } = "Fireball"; + public override string PublicName { get; } = "Fireball"; public override string Description { get; } = "I cast Fireball"; diff --git a/KruacentExiled/KE.CustomRoles/Abilities/ForceOpen.cs b/KruacentExiled/KE.CustomRoles/Abilities/ForceOpen.cs index b91a7588..26fadc50 100644 --- a/KruacentExiled/KE.CustomRoles/Abilities/ForceOpen.cs +++ b/KruacentExiled/KE.CustomRoles/Abilities/ForceOpen.cs @@ -17,7 +17,8 @@ namespace KE.CustomRoles.Abilities { public class ForceOpen : KEAbilities { - public override string Name { get; } = "Force open"; + public override string Name { get; } = "ForceOpen"; + public override string PublicName { get; } = "Force open"; public override string Description { get; } = "Force open a door"; diff --git a/KruacentExiled/KE.CustomRoles/Abilities/OpenDoor.cs b/KruacentExiled/KE.CustomRoles/Abilities/OpenDoor.cs deleted file mode 100644 index 4ff85a55..00000000 --- a/KruacentExiled/KE.CustomRoles/Abilities/OpenDoor.cs +++ /dev/null @@ -1,57 +0,0 @@ -using Exiled.API.Features; -using Exiled.API.Features.Attributes; -using Exiled.CustomRoles.API.Features; -using Exiled.Events.EventArgs.Player; -using MEC; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace KE.CustomRoles.Abilities -{ - [CustomAbility] - internal class OpenDoor : ActiveAbility - { - public override string Name { get; set; } = "OpenDoor"; - - public override string Description { get; set; } = "Open a lock door at the cost of your health"; - - public override float Duration { get; set; } = 0f; - - public override float Cooldown { get; set; } = 45f; - private List _players = new List(); - - protected override void AbilityUsed(Player player) - { - player.ShowHint("interact with a door to open it",5f); - _players.Add(player); - Exiled.Events.Handlers.Player.InteractingDoor += OnInteractingDoor; - } - - protected override void UnsubscribeEvents() - { - Exiled.Events.Handlers.Player.InteractingDoor -= OnInteractingDoor; - base.UnsubscribeEvents(); - } - - private void OnInteractingDoor(InteractingDoorEventArgs ev) - { - if (!_players.Contains(ev.Player)) return; - if (ev.Door.IsOpen) return; - if (!ev.Door.IsKeycardDoor) return; - if(ev.Door.IsCheckpoint) return; - if(ev.Door.IsLocked) return; - - ev.IsAllowed = false; - ev.Player.ShowHint("The door will open in 5 seconds",5f); - ev.Player.Hurt(ev.Player.MaxHealth / 10,Exiled.API.Enums.DamageType.Strangled); - _players.Remove(ev.Player); - Timing.CallDelayed(5f, () => - { - ev.Door.IsOpen = true; - }); - } - } -} diff --git a/KruacentExiled/KE.CustomRoles/Abilities/SelectPosition.cs b/KruacentExiled/KE.CustomRoles/Abilities/SelectPosition.cs index 667ac4bb..539ea454 100644 --- a/KruacentExiled/KE.CustomRoles/Abilities/SelectPosition.cs +++ b/KruacentExiled/KE.CustomRoles/Abilities/SelectPosition.cs @@ -8,6 +8,7 @@ namespace KE.CustomRoles.Abilities public class SelectPosition : KEAbilities { public override string Name { get; } = "SetPosition"; + public override string PublicName { get; } = "Set Position"; public override string Description { get; } = "Select the current position for another ability"; diff --git a/KruacentExiled/KE.CustomRoles/Abilities/SimulateDeath.cs b/KruacentExiled/KE.CustomRoles/Abilities/SimulateDeath.cs index 7de73e51..1cf946ae 100644 --- a/KruacentExiled/KE.CustomRoles/Abilities/SimulateDeath.cs +++ b/KruacentExiled/KE.CustomRoles/Abilities/SimulateDeath.cs @@ -12,7 +12,8 @@ namespace KE.CustomRoles.Abilities { public class SimulateDeath : KEAbilities { - public override string Name { get; } = "Simulate Death"; + public override string Name { get; } = "SimulateDeath"; + public override string PublicName { get; } = "Simulate Death"; public override string Description { get; } = "T'es talent de mime te permettent de simuler la mort."; diff --git a/KruacentExiled/KE.CustomRoles/Abilities/Teleport.cs b/KruacentExiled/KE.CustomRoles/Abilities/Teleport.cs index a061e759..fa3e457e 100644 --- a/KruacentExiled/KE.CustomRoles/Abilities/Teleport.cs +++ b/KruacentExiled/KE.CustomRoles/Abilities/Teleport.cs @@ -10,6 +10,7 @@ namespace KE.CustomRoles.Abilities public class Teleport : KEAbilities { public override string Name { get; } = "Teleportation"; + public override string PublicName { get; } = "Teleportation"; public override string Description { get; } = ""; diff --git a/KruacentExiled/KE.CustomRoles/Abilities/Thief.cs b/KruacentExiled/KE.CustomRoles/Abilities/Thief.cs index 0cf7928b..55859666 100644 --- a/KruacentExiled/KE.CustomRoles/Abilities/Thief.cs +++ b/KruacentExiled/KE.CustomRoles/Abilities/Thief.cs @@ -11,6 +11,7 @@ namespace KE.CustomRoles.Abilities public class Thief : KEAbilities { public override string Name { get; } = "Thief"; + public override string PublicName { get; } = "Thief"; public override string Description { get; } = "Avec 1548 heures de jeu sur Thief Simulator fallait s'y attendre un peu."; diff --git a/KruacentExiled/KE.CustomRoles/Abilities/Trade.cs b/KruacentExiled/KE.CustomRoles/Abilities/Trade.cs index 4465ea06..b9cd3df7 100644 --- a/KruacentExiled/KE.CustomRoles/Abilities/Trade.cs +++ b/KruacentExiled/KE.CustomRoles/Abilities/Trade.cs @@ -14,6 +14,7 @@ namespace KE.CustomRoles.Abilities public class Trade : KEAbilities { public override string Name { get; } = "Trade"; + public override string PublicName { get; } = "Trade"; public override string Description { get; } = "T'es lien avec le casino t'as permis d'avoir un peu plus de pièce en échange d'un item ou de pire"; diff --git a/KruacentExiled/KE.CustomRoles/MainPlugin.cs b/KruacentExiled/KE.CustomRoles/MainPlugin.cs index ca2206e3..5ce1aa13 100644 --- a/KruacentExiled/KE.CustomRoles/MainPlugin.cs +++ b/KruacentExiled/KE.CustomRoles/MainPlugin.cs @@ -25,6 +25,7 @@ public class MainPlugin : Plugin public static Config Configs => Instance?.Config; public static readonly HintPlacement CRHint = new(0, 750); public static readonly HintPlacement CREffect = new(700, 300); + public static readonly HintPlacement AbilitiesDesc = new(0, 900); public static readonly HintPlacement Abilities = new(0, 950,HintServiceMeow.Core.Enum.HintAlignment.Left); public static Translations Translations => Instance?.Translation; private SettingHandler _settingHandler; diff --git a/KruacentExiled/KE.CustomRoles/Settings/SettingHandler.cs b/KruacentExiled/KE.CustomRoles/Settings/SettingHandler.cs index e4db8d2c..5d8d80e4 100644 --- a/KruacentExiled/KE.CustomRoles/Settings/SettingHandler.cs +++ b/KruacentExiled/KE.CustomRoles/Settings/SettingHandler.cs @@ -20,6 +20,7 @@ internal class SettingHandler : IUsingEvents private int _idUp = 150; private int _idSelect = 151; private int _idArrow = 152; + private int _idTimeAbilityDesc = 153; @@ -37,6 +38,7 @@ public SettingHandler() new HeaderSetting (_idHeader,"Custom Roles Settings"), new TwoButtonsSetting(_idDesc,"Descriptions","Disabled","Enabled",true,"hide/show the description the Custom Role "), new SliderSetting(_idTimeCustomRole,"Time shown",0,30,20), + new SliderSetting(_idTimeAbilityDesc,"Ability Description time shown",0,30,20), new TwoButtonsSetting(_idMode,"Mode","Keybinds","Select wheel",true,onChanged:OnChanged), new KeybindSetting(_idUp, "Select up", UnityEngine.KeyCode.None,hintDescription:"only work in Select Wheel mode"), new KeybindSetting(_idDown, "Select down", UnityEngine.KeyCode.None,hintDescription:"only work in Select Wheel mode"), @@ -210,7 +212,11 @@ internal float GetTime(Player p) if (!SettingBase.TryGetSetting(p, _idTimeCustomRole, out var setting)) return 20; return setting.SliderValue; } - + internal float GetAbilityTime(Player p) + { + if (!SettingBase.TryGetSetting(p, _idTimeAbilityDesc, out var setting)) return 20; + return setting.SliderValue; + } /// /// From 385cbd6c818426fd0ce9ab8fdd74bfd74c9b88f4 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Wed, 8 Oct 2025 04:39:24 +0200 Subject: [PATCH 383/853] smoke grenade --- KruacentExiled/KE.Items/Items/Smoke.cs | 73 ++++++++++++++++++++++++++ 1 file changed, 73 insertions(+) create mode 100644 KruacentExiled/KE.Items/Items/Smoke.cs diff --git a/KruacentExiled/KE.Items/Items/Smoke.cs b/KruacentExiled/KE.Items/Items/Smoke.cs new file mode 100644 index 00000000..74989c65 --- /dev/null +++ b/KruacentExiled/KE.Items/Items/Smoke.cs @@ -0,0 +1,73 @@ +using Exiled.API.Features.Attributes; +using Exiled.API.Features.Items; +using Exiled.API.Features.Pickups; +using Exiled.API.Features.Spawn; +using Exiled.Events.EventArgs.Map; +using Exiled.Events.EventArgs.Player; +using KE.Items.API.Features; +using MEC; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using UnityEngine; + +namespace KE.Items.Items +{ + [CustomItem(ItemType.GrenadeFlash)] + public class Smoke : KECustomGrenade + { + public override uint Id { get; set; } = 2000; + public override string Name { get; set; } = "Smoke Grenade"; + public override string Description { get; set; } = "smoke"; + public override bool ExplodeOnCollision { get; set; } = false; + public override float FuseTime { get; set; } = 5; + public override float Weight { get; set; } = 0.65f; + public override SpawnProperties SpawnProperties { get; set; } = new(); + + public const float Duration = 20; + private HashSet pickups = new(); + + protected override void OnExploding(ExplodingGrenadeEventArgs ev) + { + if (!Check(ev.Projectile)) return; + Vector3 position = ev.Position; + Scp244 scp = (Scp244) Scp244.Create(ItemType.SCP244a); + scp.Primed = true; + scp.MaxDiameter = float.Epsilon; + + Pickup p = scp.CreatePickup(position, null, false); + + p.Scale = Vector3.one / 10; + p.Spawn(); + pickups.Add(p); + + Timing.CallDelayed(Duration, delegate + { + pickups.Remove(p); + p.Destroy(); + }); + } + + protected override void SubscribeEvents() + { + Exiled.Events.Handlers.Player.PickingUpItem += OnPickingUpItem; + base.SubscribeEvents(); + } + + protected override void UnsubscribeEvents() + { + Exiled.Events.Handlers.Player.PickingUpItem -= OnPickingUpItem; + base.UnsubscribeEvents(); + } + + private void OnPickingUpItem(PickingUpItemEventArgs ev) + { + if (!pickups.Contains(ev.Pickup)) return; + + ev.IsAllowed = false; + + } + } +} From 495be0eaca2abcc54922bc7fa6659d793354cfd6 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Tue, 14 Oct 2025 15:27:57 +0200 Subject: [PATCH 384/853] added commands to manually trigger mapevents --- KruacentExiled/KE.Map/MainPlugin.cs | 9 ++- .../BlackoutNDoor/Commands/BlackoutCommand.cs | 49 +++++++++++++++++ .../BlackoutNDoor/Commands/BothCommand.cs | 49 +++++++++++++++++ .../Commands/DoorstuckCommand.cs | 49 +++++++++++++++++ .../BlackoutNDoor/Commands/MainCommand.cs | 30 ++++++++++ .../KE.Map/Others/BlackoutNDoor/DoorStuck.cs | 2 + .../Others/BlackoutNDoor/Handlers/Handler.cs | 13 +---- .../Others/BlackoutNDoor/Handlers/MapEvent.cs | 34 +++++++++++- KruacentExiled/KE.Map/Utils/KECommand.cs | 32 +++++++++++ .../KE.Map/Utils/KEParentCommand.cs | 55 +++++++++++++++++++ 10 files changed, 309 insertions(+), 13 deletions(-) create mode 100644 KruacentExiled/KE.Map/Others/BlackoutNDoor/Commands/BlackoutCommand.cs create mode 100644 KruacentExiled/KE.Map/Others/BlackoutNDoor/Commands/BothCommand.cs create mode 100644 KruacentExiled/KE.Map/Others/BlackoutNDoor/Commands/DoorstuckCommand.cs create mode 100644 KruacentExiled/KE.Map/Others/BlackoutNDoor/Commands/MainCommand.cs create mode 100644 KruacentExiled/KE.Map/Utils/KECommand.cs create mode 100644 KruacentExiled/KE.Map/Utils/KEParentCommand.cs diff --git a/KruacentExiled/KE.Map/MainPlugin.cs b/KruacentExiled/KE.Map/MainPlugin.cs index 009264ab..47e24bde 100644 --- a/KruacentExiled/KE.Map/MainPlugin.cs +++ b/KruacentExiled/KE.Map/MainPlugin.cs @@ -3,6 +3,7 @@ using Exiled.API.Features; using Exiled.API.Interfaces; using Exiled.Events.EventArgs.Server; +using Interactables.Interobjects.DoorUtils; using KE.Map.Entrance; using KE.Map.Heavy.GamblingZone; using KE.Map.Others.BlackoutNDoor.Handlers; @@ -46,10 +47,14 @@ public override void OnEnabled() private void OnRoundStarted() { - //StructureSpawner.SpawnPedestal(ItemType.KeycardJanitor,Player.List.First().Position,Quaternion.identity,Vector3.one); + //Player player = Player.List.First(); + //StructureSpawner.SpawnPedestal(ItemType.KeycardJanitor,player.Position,Quaternion.identity,Vector3.one); - Player.List.First().Teleport(Room.List.Where(r => r.Type == Exiled.API.Enums.RoomType.EzVent).First()); + //player.Teleport(Room.List.Where(r => r.Type == Exiled.API.Enums.RoomType.EzVent).First()); + + + } diff --git a/KruacentExiled/KE.Map/Others/BlackoutNDoor/Commands/BlackoutCommand.cs b/KruacentExiled/KE.Map/Others/BlackoutNDoor/Commands/BlackoutCommand.cs new file mode 100644 index 00000000..7775632d --- /dev/null +++ b/KruacentExiled/KE.Map/Others/BlackoutNDoor/Commands/BlackoutCommand.cs @@ -0,0 +1,49 @@ +using CommandSystem; +using Exiled.API.Enums; +using Exiled.API.Extensions; +using Exiled.API.Features; +using Exiled.API.Features.Pools; +using KE.Map.Utils; +using MapGeneration; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace KE.Map.Others.BlackoutNDoor.Commands +{ + + internal class BlackoutCommand : KECommand + { + public override string Command => "blackout"; + + public override string[] Aliases => ["b"]; + + public override string Description => "force a blackout"; + + public override string[] Usage => ["FacilityZone"]; + + public override bool ExecuteCommand(ArraySegment arguments, ICommandSender sender, out string response) + { + response = string.Empty; + if (arguments.Count == 0) + { + return false; + } + string arg1 = arguments.At(0); + if(!Enum.TryParse(arg1, true, out FacilityZone zone)) + { + response = "Could not parse the zone"; + return false; + } + + + Blackout blackout = new(); + blackout.StartEvent(zone.GetZone(),-1); + response = "blackout forced at " + zone.ToString(); + + return true; + } + } +} diff --git a/KruacentExiled/KE.Map/Others/BlackoutNDoor/Commands/BothCommand.cs b/KruacentExiled/KE.Map/Others/BlackoutNDoor/Commands/BothCommand.cs new file mode 100644 index 00000000..081e9b68 --- /dev/null +++ b/KruacentExiled/KE.Map/Others/BlackoutNDoor/Commands/BothCommand.cs @@ -0,0 +1,49 @@ +using CommandSystem; +using Exiled.API.Enums; +using Exiled.API.Extensions; +using Exiled.API.Features; +using Exiled.API.Features.Pools; +using KE.Map.Utils; +using MapGeneration; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace KE.Map.Others.BlackoutNDoor.Commands +{ + + internal class BothCommand : KECommand + { + public override string Command => "both"; + + public override string[] Aliases => []; + + public override string Description => "force a doorstuck and a blackout"; + + public override string[] Usage => ["FacilityZone"]; + + public override bool ExecuteCommand(ArraySegment arguments, ICommandSender sender, out string response) + { + response = string.Empty; + if (arguments.Count == 0) + { + return false; + } + string arg1 = arguments.At(0); + if(!Enum.TryParse(arg1, true, out FacilityZone zone)) + { + response = "Could not parse the zone"; + return false; + } + + + Both both = new(); + both.StartEvent(zone.GetZone(),-1); + response = "both forced at " + zone.ToString(); + + return true; + } + } +} diff --git a/KruacentExiled/KE.Map/Others/BlackoutNDoor/Commands/DoorstuckCommand.cs b/KruacentExiled/KE.Map/Others/BlackoutNDoor/Commands/DoorstuckCommand.cs new file mode 100644 index 00000000..e8ecc1d4 --- /dev/null +++ b/KruacentExiled/KE.Map/Others/BlackoutNDoor/Commands/DoorstuckCommand.cs @@ -0,0 +1,49 @@ +using CommandSystem; +using Exiled.API.Enums; +using Exiled.API.Extensions; +using Exiled.API.Features; +using Exiled.API.Features.Pools; +using KE.Map.Utils; +using MapGeneration; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace KE.Map.Others.BlackoutNDoor.Commands +{ + + internal class DoorstuckCommand : KECommand + { + public override string Command => "doorstuck"; + + public override string[] Aliases => ["d"]; + + public override string Description => "force a doorstuck"; + + public override string[] Usage => ["FacilityZone"]; + + public override bool ExecuteCommand(ArraySegment arguments, ICommandSender sender, out string response) + { + response = string.Empty; + if (arguments.Count == 0) + { + return false; + } + string arg1 = arguments.At(0); + if(!Enum.TryParse(arg1, true, out FacilityZone zone)) + { + response = "Could not parse the zone"; + return false; + } + + + DoorStuck doorstuck = new(); + doorstuck.StartEvent(zone.GetZone(),-1); + response = "doorstuck forced at " + zone.ToString(); + + return true; + } + } +} diff --git a/KruacentExiled/KE.Map/Others/BlackoutNDoor/Commands/MainCommand.cs b/KruacentExiled/KE.Map/Others/BlackoutNDoor/Commands/MainCommand.cs new file mode 100644 index 00000000..2d011e36 --- /dev/null +++ b/KruacentExiled/KE.Map/Others/BlackoutNDoor/Commands/MainCommand.cs @@ -0,0 +1,30 @@ +using CommandSystem; +using Exiled.API.Features.Pools; +using KE.Map.Utils; +using RelativePositioning; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace KE.Map.Others.BlackoutNDoor.Commands +{ + [CommandHandler(typeof(RemoteAdminCommandHandler))] + public class MainCommand : KEParentCommand + { + public override string Command => "mapevent"; + + public override string[] Aliases => ["me"]; + + public override string Description => "mapevents"; + + public override void LoadGeneratedCommands() + { + RegisterCommand(new BlackoutCommand()); + RegisterCommand(new DoorstuckCommand()); + RegisterCommand(new BothCommand()); + } + + } +} diff --git a/KruacentExiled/KE.Map/Others/BlackoutNDoor/DoorStuck.cs b/KruacentExiled/KE.Map/Others/BlackoutNDoor/DoorStuck.cs index 8f53cf36..e824a4c3 100644 --- a/KruacentExiled/KE.Map/Others/BlackoutNDoor/DoorStuck.cs +++ b/KruacentExiled/KE.Map/Others/BlackoutNDoor/DoorStuck.cs @@ -6,9 +6,11 @@ using System.Threading.Tasks; using KE.Map.Others.BlackoutNDoor.Handlers; using Exiled.API.Features.Doors; +using CommandSystem; namespace KE.Map.Others.BlackoutNDoor { + public class DoorStuck : MapEvent { diff --git a/KruacentExiled/KE.Map/Others/BlackoutNDoor/Handlers/Handler.cs b/KruacentExiled/KE.Map/Others/BlackoutNDoor/Handlers/Handler.cs index dc97a302..fe8930b4 100644 --- a/KruacentExiled/KE.Map/Others/BlackoutNDoor/Handlers/Handler.cs +++ b/KruacentExiled/KE.Map/Others/BlackoutNDoor/Handlers/Handler.cs @@ -154,21 +154,14 @@ private void LaunchEvent() Timing.CallDelayed(5 + yap, delegate { - Log.Debug("starting"); - mapEvent.Start(zone); - float time = Mathf.Clamp(mapEvent.Duration,1, TimeBeforeNextEvent); + + mapEvent.StartEvent(zone,TimeBeforeNextEvent); - Timing.CallDelayed(time, delegate - { - Log.Debug("stopping"); - mapEvent.Stop(zone); - PostEventEventArgs postEv = new PostEventEventArgs(mapEvent); - EventHandle.OnPostEvent(postEv); - }); }); } } + private string ZoneTypeToCassie(ZoneType zone) { return zone switch diff --git a/KruacentExiled/KE.Map/Others/BlackoutNDoor/Handlers/MapEvent.cs b/KruacentExiled/KE.Map/Others/BlackoutNDoor/Handlers/MapEvent.cs index ed59a4b9..66f14937 100644 --- a/KruacentExiled/KE.Map/Others/BlackoutNDoor/Handlers/MapEvent.cs +++ b/KruacentExiled/KE.Map/Others/BlackoutNDoor/Handlers/MapEvent.cs @@ -1,9 +1,14 @@ using Exiled.API.Enums; +using Exiled.API.Features; +using KE.Map.Others.BlackoutNDoor.Events.EventArgs; +using KE.Map.Others.BlackoutNDoor.Interfaces; +using MEC; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; +using UnityEngine; namespace KE.Map.Others.BlackoutNDoor.Handlers { @@ -13,10 +18,37 @@ public abstract class MapEvent public abstract string Cassie { get; } public abstract string CassieTranslated { get; } public virtual float Duration { get; } = 10f; + public void StartEvent(ZoneType zone,float maxTime) + { + Log.Debug("start to " + zone); + float time = Duration; + if (maxTime > 1) + { + time = Mathf.Clamp(Duration, 1, maxTime); + } + + Start(zone); + Timing.CallDelayed(time, delegate + { + Log.Debug("stopping"); + Stop(zone); + PostEventEventArgs postEv = new PostEventEventArgs(this); + Events.Handlers.BlackoutNDoor.OnPostEvent(postEv); + }); - public abstract void Start(ZoneType zone); + } + + /// + /// Start a without stopping it + /// + /// + public abstract void Start(ZoneType zone); + /// + /// Stop a + /// + /// public abstract void Stop(ZoneType zone); } diff --git a/KruacentExiled/KE.Map/Utils/KECommand.cs b/KruacentExiled/KE.Map/Utils/KECommand.cs new file mode 100644 index 00000000..83a96208 --- /dev/null +++ b/KruacentExiled/KE.Map/Utils/KECommand.cs @@ -0,0 +1,32 @@ +using CommandSystem; +using Exiled.API.Features.Pools; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace KE.Map.Utils +{ + public abstract class KECommand : ICommand, IUsageProvider + { + public abstract string Command { get; } + + public abstract string[] Aliases { get; } + + public abstract string Description { get; } + public abstract string[] Usage { get; } + + public bool Execute(ArraySegment arguments, ICommandSender sender, out string response) + { + bool exe = ExecuteCommand(arguments, sender, out response); + if (!exe) + { + response += $"\nUsage : {Command} " +this.DisplayCommandUsage(); + } + return exe; + } + + public abstract bool ExecuteCommand(ArraySegment arguments, ICommandSender sender, out string response); + } +} diff --git a/KruacentExiled/KE.Map/Utils/KEParentCommand.cs b/KruacentExiled/KE.Map/Utils/KEParentCommand.cs new file mode 100644 index 00000000..93ba2ff4 --- /dev/null +++ b/KruacentExiled/KE.Map/Utils/KEParentCommand.cs @@ -0,0 +1,55 @@ +using CommandSystem; +using Exiled.API.Features.Pools; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace KE.Map.Utils +{ + public abstract class KEParentCommand : ParentCommand + { + + public KEParentCommand() + { + LoadGeneratedCommands(); + } + + protected override bool ExecuteParent(ArraySegment arguments, ICommandSender sender, out string response) + { + StringBuilder builder = StringBuilderPool.Pool.Get(); + + builder.Append("Usage : "); + builder.AppendLine(); + foreach (ICommand command in Commands.Values) + { + builder.Append(command.Command); + string[] aliases = command.Aliases; + if(aliases.Length > 0) + { + builder.Append(" ("); + for (int i = 0; i < aliases.Length; i++) + { + builder.Append(aliases[i]); + if (i < aliases.Length - 1) + { + builder.Append(", "); + } + } + builder.Append(")"); + } + builder.Append(" - "); + + + builder.AppendLine(command.Description); + } + + + + response = builder.ToString(); + StringBuilderPool.Pool.Return(builder); + return false; + } + } +} From 8667ef335755fb239a9e60c01a072ff1a024759c Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Tue, 14 Oct 2025 17:31:35 +0200 Subject: [PATCH 385/853] new guard 914 + buff 457 --- .../API/Features/KECustomRole.cs | 12 +- .../KE.CustomRoles/CR/Guard/ChiefGuard.cs | 2 +- .../KE.CustomRoles/CR/Guard/Guard914.cs | 122 +++++++++++++++++- .../KE.CustomRoles/CR/SCP/SCP457.cs | 7 +- 4 files changed, 132 insertions(+), 11 deletions(-) diff --git a/KruacentExiled/KE.CustomRoles/API/Features/KECustomRole.cs b/KruacentExiled/KE.CustomRoles/API/Features/KECustomRole.cs index 39967199..02c71d30 100644 --- a/KruacentExiled/KE.CustomRoles/API/Features/KECustomRole.cs +++ b/KruacentExiled/KE.CustomRoles/API/Features/KECustomRole.cs @@ -1,7 +1,9 @@ using Exiled.API.Enums; using Exiled.API.Extensions; using Exiled.API.Features; +using Exiled.API.Features.Items; using Exiled.API.Features.Pools; +using Exiled.CustomItems.API.Features; using Exiled.CustomRoles.API; using Exiled.CustomRoles.API.Features; using InventorySystem.Configs; @@ -124,9 +126,15 @@ public override void AddRole(Player player) player2.ClearInventory(); } - foreach (string item in Inventory) + for (int i = 0; i < Inventory.Count;i++) { - TryAddItem(player2, item); + string item = Inventory[i]; + Log.Debug(Name + ": Adding " + item + " to inventory."); + if (TryAddItem(player2, item) && CustomItem.TryGet(item, out CustomItem customItem) && customItem is CustomWeapon customWeapon && player2.CurrentItem is Firearm firearm && !customWeapon.Attachments.IsEmpty()) + { + firearm.AddAttachment(customWeapon.Attachments); + Log.Debug(Name + ": Applied attachments to " + item + "."); + } } if (Ammo.Count > 0) diff --git a/KruacentExiled/KE.CustomRoles/CR/Guard/ChiefGuard.cs b/KruacentExiled/KE.CustomRoles/CR/Guard/ChiefGuard.cs index 961a513b..1465b26b 100644 --- a/KruacentExiled/KE.CustomRoles/CR/Guard/ChiefGuard.cs +++ b/KruacentExiled/KE.CustomRoles/CR/Guard/ChiefGuard.cs @@ -10,7 +10,7 @@ namespace KE.CustomRoles.CR.Guard { public class ChiefGuard : KECustomRole, IColor { - public override string Description { get; set; } = "Tu es un Chef des gardes du site \nT'as une carte de private \net un crossvec"; + public override string Description { get; set; } = "T'as une carte de private \net un crossvec"; public override uint Id { get; set; } = 1046; public override string PublicName { get; set; } = "Chef des Gardes"; public override int MaxHealth { get; set; } = 100; diff --git a/KruacentExiled/KE.CustomRoles/CR/Guard/Guard914.cs b/KruacentExiled/KE.CustomRoles/CR/Guard/Guard914.cs index c93f4334..934afd36 100644 --- a/KruacentExiled/KE.CustomRoles/CR/Guard/Guard914.cs +++ b/KruacentExiled/KE.CustomRoles/CR/Guard/Guard914.cs @@ -1,9 +1,18 @@ using Exiled.API.Enums; -using Exiled.API.Features.Attributes; +using Exiled.API.Features; using Exiled.API.Features.Spawn; using KE.CustomRoles.API.Features; +using LabApi.Events.Arguments.Scp914Events; +using LabApi.Features.Wrappers; using PlayerRoles; using System.Collections.Generic; +using Player = Exiled.API.Features.Player; +using LabPlayer = LabApi.Features.Wrappers.Player; +using Interactables.Interobjects.DoorUtils; +using UnityEngine; +using InventorySystem; +using MEC; +using InventorySystem.Items; namespace KE.CustomRoles.CR.Guard { @@ -33,17 +42,118 @@ public class Guard914 : KECustomRole public override List Inventory { get; set; } = new List() { - $"{ItemType.Radio}", $"{ItemType.ArmorLight}", - $"{ItemType.GunFSP9}", + $"{ItemType.Radio}", + $"{ItemType.GrenadeFlash}", $"{ItemType.Medkit}", - $"{ItemType.Flashlight}" + $"{ItemType.GunFSP9}", }; - public override Dictionary Ammo { get; set; } = new Dictionary() { - { AmmoType.Nato556, 60} + { AmmoType.Nato9, 60} }; + + protected override void RoleAdded(Player player) + { + Timing.CallDelayed(.25f, delegate + { + CreateFakeGuardCard(player); + }); + base.RoleAdded(player); + } + + protected override void SubscribeEvents() + { + LabApi.Events.Handlers.Scp914Events.ProcessedPlayer += OnProcessedPlayer; + base.SubscribeEvents(); + } + + + protected override void UnsubscribeEvents() + { + LabApi.Events.Handlers.Scp914Events.ProcessedPlayer -= OnProcessedPlayer; + base.UnsubscribeEvents(); + } + + public static KeycardItem CreateFakeGuardCard(LabPlayer player) + { + Log.Debug("guard"); + KeycardItem item = KeycardItem.CreateCustomKeycardMetal( + player, "Guard Keycard?", "Ofc. " + player.Nickname, "SECURITY GAURD", new KeycardLevels(0, 0, 1), + new Color32(0, 0, 0, 255), new Color32(0, 0, 0, 255), new Color32(255, 255, 255, 255), + 1, ""); + + storedSerials.Add(item.Serial); + + return item; + } + + public static KeycardItem CreateFakeOperativeCard(LabPlayer player) + { + Log.Debug("operative"); + KeycardItem item = KeycardItem.CreateCustomKeycardTaskForce( + player, "MTF operative Keycard?", "Pvt. " + player.Nickname, new KeycardLevels(0, 0, 2), + new Color32(60, 100, 150, 255), new Color32(157, 136, 43, 255), + "", 1); + storedSerials.Add(item.Serial); + + return item; + + } + public static KeycardItem CreateFakeCaptainCard(LabPlayer player) + { + Log.Debug("captain"); + KeycardItem item = KeycardItem.CreateCustomKeycardTaskForce( + player, "MTF captain Keycard?", "Cpt. " + player.Nickname, new KeycardLevels(0, 0, 3), + new Color32(35, 50, 150, 255), new Color32(157, 136, 43, 255), + "", 2); + storedSerials.Add(item.Serial); + + return item; + } + + + + private static HashSet storedSerials = new(); + private void OnProcessedPlayer(Scp914ProcessedPlayerEventArgs ev) + { + if (ev.KnobSetting != Scp914.Scp914KnobSetting.Fine) return; + LabPlayer player = ev.Player; + Item item = player.CurrentItem; + if (item is null) return; + + if (storedSerials.Contains(item.Serial)) + { + ItemBase itemBase = null; + bool equipped = player.CurrentItem is not null && player.CurrentItem.Serial == item.Serial; + player.RemoveItem(item); + storedSerials.Remove(item.Serial); + KeycardItem keycard = item as KeycardItem; + + switch (keycard.Levels.Admin) + { + case 1: + itemBase = CreateFakeOperativeCard(player).Base; + break; + case 2: + itemBase = CreateFakeCaptainCard(player).Base; + break; + case 3: + default: + itemBase = player.Inventory.ServerAddItem(ItemType.KeycardJanitor, ItemAddReason.Scp914Upgrade); + break; + } + if(equipped) + { + player.Inventory.ServerSelectItem(itemBase.ItemSerial); + } + + + } + + } + + } } diff --git a/KruacentExiled/KE.CustomRoles/CR/SCP/SCP457.cs b/KruacentExiled/KE.CustomRoles/CR/SCP/SCP457.cs index 763ced09..3773fef0 100644 --- a/KruacentExiled/KE.CustomRoles/CR/SCP/SCP457.cs +++ b/KruacentExiled/KE.CustomRoles/CR/SCP/SCP457.cs @@ -24,7 +24,7 @@ public class SCP457 : CustomSCP public override string Description { get; set; } = "You do passive damage around you, and can lauch fireballs by pressing the stalk button"; public override uint Id { get; set; } = 1084; public override string PublicName { get; set; } = "SCP-457"; - public override int MaxHealth { get; set; } = 4500; + public override int MaxHealth { get; set; } = 5000; public override RoleTypeId Role { get; set; } = RoleTypeId.Scp106; public override bool KeepRoleOnDeath { get; set; } = false; public override bool KeepRoleOnChangingRole { get; set; } = false; @@ -41,7 +41,10 @@ public class SCP457 : CustomSCP - + public override HashSet Abilities => + [ + 2010 + ]; protected override void RoleAdded(Player player) From e164ffdd783a57d741094d5594cd2c9cb8ccddf9 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Wed, 15 Oct 2025 18:20:18 +0200 Subject: [PATCH 386/853] changed some coins effect --- KruacentExiled/KE.Misc/Config.cs | 2 +- .../Effect/NegativeEffect/AutoDoor.cs | 11 ++++-- .../Effect/NegativeEffect/FakeNuke.cs | 2 +- .../Effect/NegativeEffect/RandomTeleport.cs | 6 +--- .../Effect/NegativeEffect/ReduceHP.cs | 2 +- .../Effect/NegativeEffect/TransformZombie.cs | 2 +- .../Effect/NegativeEffect/TurnOffLight.cs | 2 +- .../Effect/NegativeEffect/WarheadCoin.cs | 4 +-- .../Effect/PositiveEffect/GiveKeycard.cs | 2 +- .../PositiveEffect/IncreasePlayerHealth.cs | 1 + .../Effect/PositiveEffect/NiceHat.cs | 2 +- .../Effect/PositiveEffect/OneAmmoLogicer.cs | 2 +- .../Effect/PositiveEffect/RandomGoodEffect.cs | 2 +- .../Effect/PositiveEffect/RandomKeycard.cs | 34 +++++++++++++++++++ .../Effect/PositiveEffect/SpawnHeal.cs | 2 +- .../Effect/PositiveEffect/TeleportToEscape.cs | 2 +- .../Features/GamblingCoin/EventHandlers.cs | 13 +++---- .../GamblingCoin/GamblingCoinManager.cs | 2 -- 18 files changed, 63 insertions(+), 30 deletions(-) create mode 100644 KruacentExiled/KE.Misc/Features/GamblingCoin/Effect/PositiveEffect/RandomKeycard.cs diff --git a/KruacentExiled/KE.Misc/Config.cs b/KruacentExiled/KE.Misc/Config.cs index da67c512..b25be2ac 100644 --- a/KruacentExiled/KE.Misc/Config.cs +++ b/KruacentExiled/KE.Misc/Config.cs @@ -26,6 +26,6 @@ public class Config : IConfig public bool GamblingCoin { get; set; } = true; public int GamblingCoinMinUse { get; set; } = 1; public int GamblingCoinMaxUse { get; set; } = 2; - public int GamblingCoinCooldow { get; set; } = 3; + public int GamblingCoinCooldown { get; set; } = 3; } } diff --git a/KruacentExiled/KE.Misc/Features/GamblingCoin/Effect/NegativeEffect/AutoDoor.cs b/KruacentExiled/KE.Misc/Features/GamblingCoin/Effect/NegativeEffect/AutoDoor.cs index e93ba258..98f2a26d 100644 --- a/KruacentExiled/KE.Misc/Features/GamblingCoin/Effect/NegativeEffect/AutoDoor.cs +++ b/KruacentExiled/KE.Misc/Features/GamblingCoin/Effect/NegativeEffect/AutoDoor.cs @@ -1,4 +1,5 @@ -using Exiled.API.Features; +using Exiled.API.Enums; +using Exiled.API.Features; using Exiled.API.Features.Doors; using KE.Misc.Features.GamblingCoin; using KE.Misc.Features.GamblingCoin.Interfaces; @@ -19,8 +20,12 @@ public void Execute(Player player) Array values = Enum.GetValues(typeof(FacilityZone)); FacilityZone randomZone = (FacilityZone)values.GetValue(UnityEngine.Random.Range(0, values.Length)); - Door.List.Where(d => d.Position.GetZone() == randomZone).ToList().ForEach(d => d.IsOpen = true); + - PlayerUtils.SendBroadcast(player, "Clap clap clap ! You opened door in " + randomZone); + foreach(Door door in Door.List.Where(d => d.Position.GetZone() == randomZone && d.DoorLockType == DoorLockType.None)) + { + door.IsOpen = true; + } + } } \ No newline at end of file diff --git a/KruacentExiled/KE.Misc/Features/GamblingCoin/Effect/NegativeEffect/FakeNuke.cs b/KruacentExiled/KE.Misc/Features/GamblingCoin/Effect/NegativeEffect/FakeNuke.cs index 90e6dddd..1dca731f 100644 --- a/KruacentExiled/KE.Misc/Features/GamblingCoin/Effect/NegativeEffect/FakeNuke.cs +++ b/KruacentExiled/KE.Misc/Features/GamblingCoin/Effect/NegativeEffect/FakeNuke.cs @@ -5,7 +5,7 @@ internal class FakeNuke : IDurationEffect { public string Name { get; set; } = "FakeNuke"; - public string Message { get; set; } = "Alright everyone will hate you"; + public string Message { get; set; } = string.Empty; public int Weight { get; set; } = 5; public EffectType Type { get; set; } = EffectType.Negative; public float Duration { get; set; } = 15; diff --git a/KruacentExiled/KE.Misc/Features/GamblingCoin/Effect/NegativeEffect/RandomTeleport.cs b/KruacentExiled/KE.Misc/Features/GamblingCoin/Effect/NegativeEffect/RandomTeleport.cs index e0d82a86..679c7c66 100644 --- a/KruacentExiled/KE.Misc/Features/GamblingCoin/Effect/NegativeEffect/RandomTeleport.cs +++ b/KruacentExiled/KE.Misc/Features/GamblingCoin/Effect/NegativeEffect/RandomTeleport.cs @@ -13,10 +13,6 @@ public class RandomTeleport : ICoinEffect public void Execute(Player player) { - Array values = Enum.GetValues(typeof(RoomType)); - RoomType randomRoom = (RoomType)values.GetValue(UnityEngine.Random.Range(0, values.Length)); - - - player.Teleport(randomRoom); + player.Teleport(Room.Random()); } } \ No newline at end of file diff --git a/KruacentExiled/KE.Misc/Features/GamblingCoin/Effect/NegativeEffect/ReduceHP.cs b/KruacentExiled/KE.Misc/Features/GamblingCoin/Effect/NegativeEffect/ReduceHP.cs index dbecb256..13d5b140 100644 --- a/KruacentExiled/KE.Misc/Features/GamblingCoin/Effect/NegativeEffect/ReduceHP.cs +++ b/KruacentExiled/KE.Misc/Features/GamblingCoin/Effect/NegativeEffect/ReduceHP.cs @@ -10,7 +10,7 @@ internal class ReduceHP : ICoinEffect public EffectType Type { get; set; } = EffectType.Negative; /// - /// Damage dealed to the player + /// Damage dealt to the player /// public static float Damage = 30; diff --git a/KruacentExiled/KE.Misc/Features/GamblingCoin/Effect/NegativeEffect/TransformZombie.cs b/KruacentExiled/KE.Misc/Features/GamblingCoin/Effect/NegativeEffect/TransformZombie.cs index 64a8f06a..05c26b53 100644 --- a/KruacentExiled/KE.Misc/Features/GamblingCoin/Effect/NegativeEffect/TransformZombie.cs +++ b/KruacentExiled/KE.Misc/Features/GamblingCoin/Effect/NegativeEffect/TransformZombie.cs @@ -5,7 +5,7 @@ internal class TransformZombie : ICoinEffect { public string Name { get; set; } = "TransformZombie"; - public string Message { get; set; } = "You wanna eat your friends now."; + public string Message { get; set; } = string.Empty; public int Weight { get; set; } = 30; public EffectType Type { get; set; } = EffectType.Negative; diff --git a/KruacentExiled/KE.Misc/Features/GamblingCoin/Effect/NegativeEffect/TurnOffLight.cs b/KruacentExiled/KE.Misc/Features/GamblingCoin/Effect/NegativeEffect/TurnOffLight.cs index 0c82778a..6093e483 100644 --- a/KruacentExiled/KE.Misc/Features/GamblingCoin/Effect/NegativeEffect/TurnOffLight.cs +++ b/KruacentExiled/KE.Misc/Features/GamblingCoin/Effect/NegativeEffect/TurnOffLight.cs @@ -5,7 +5,7 @@ internal class TurnOffLight : ICoinEffect { public string Name { get; set; } = "TurnOffLight"; - public string Message { get; set; } = "you can't follow the light"; + public string Message { get; set; } = string.Empty; public int Weight { get; set; } = 10; public EffectType Type { get; set; } = EffectType.Negative; diff --git a/KruacentExiled/KE.Misc/Features/GamblingCoin/Effect/NegativeEffect/WarheadCoin.cs b/KruacentExiled/KE.Misc/Features/GamblingCoin/Effect/NegativeEffect/WarheadCoin.cs index ade9f088..e742dd2b 100644 --- a/KruacentExiled/KE.Misc/Features/GamblingCoin/Effect/NegativeEffect/WarheadCoin.cs +++ b/KruacentExiled/KE.Misc/Features/GamblingCoin/Effect/NegativeEffect/WarheadCoin.cs @@ -5,7 +5,7 @@ internal class WarheadCoin : ICoinEffect { public string Name { get; set; } = "Warhead"; - public string Message { get; set; } = "YOU TOUCHED THE RED BUTTON !?!"; + public string Message { get; set; } = string.Empty; public int Weight { get; set; } = 10; public EffectType Type { get; set; } = EffectType.Negative; @@ -13,7 +13,5 @@ public void Execute(Player player) { if (!Warhead.IsDetonated || !Warhead.IsInProgress) Warhead.Start(); - else - Warhead.Stop(); } } \ No newline at end of file diff --git a/KruacentExiled/KE.Misc/Features/GamblingCoin/Effect/PositiveEffect/GiveKeycard.cs b/KruacentExiled/KE.Misc/Features/GamblingCoin/Effect/PositiveEffect/GiveKeycard.cs index 56613ced..72eaee8b 100644 --- a/KruacentExiled/KE.Misc/Features/GamblingCoin/Effect/PositiveEffect/GiveKeycard.cs +++ b/KruacentExiled/KE.Misc/Features/GamblingCoin/Effect/PositiveEffect/GiveKeycard.cs @@ -18,7 +18,7 @@ internal class GiveKeycard : ICoinEffect public void Execute(Player player) { - int random = UnityEngine.Random.Range(1, 101); + float random = UnityEngine.Random.Range(1f, 100f); ItemType keycard = ItemType.KeycardContainmentEngineer; if(random <= FacilityManagerCard) diff --git a/KruacentExiled/KE.Misc/Features/GamblingCoin/Effect/PositiveEffect/IncreasePlayerHealth.cs b/KruacentExiled/KE.Misc/Features/GamblingCoin/Effect/PositiveEffect/IncreasePlayerHealth.cs index 4937b640..a2306668 100644 --- a/KruacentExiled/KE.Misc/Features/GamblingCoin/Effect/PositiveEffect/IncreasePlayerHealth.cs +++ b/KruacentExiled/KE.Misc/Features/GamblingCoin/Effect/PositiveEffect/IncreasePlayerHealth.cs @@ -7,6 +7,7 @@ internal class IncreasePlayerHealth : ICoinEffect { public string Name { get; set; } = "IncreasePlayerHeal"; + //human i remember you're life expectancy public string Message { get; set; } = "You're life expectancy is extended !"; public int Weight { get; set; } = 10; public EffectType Type { get; set; } = EffectType.Positive; diff --git a/KruacentExiled/KE.Misc/Features/GamblingCoin/Effect/PositiveEffect/NiceHat.cs b/KruacentExiled/KE.Misc/Features/GamblingCoin/Effect/PositiveEffect/NiceHat.cs index 9ccdd2a9..6be26bea 100644 --- a/KruacentExiled/KE.Misc/Features/GamblingCoin/Effect/PositiveEffect/NiceHat.cs +++ b/KruacentExiled/KE.Misc/Features/GamblingCoin/Effect/PositiveEffect/NiceHat.cs @@ -13,6 +13,6 @@ internal class NiceHat : ICoinEffect public void Execute(Player player) { - Pickup.CreateAndSpawn(ItemType.SCP268, player.Position, new Quaternion()); + Pickup.CreateAndSpawn(ItemType.SCP268, player.Position, Quaternion.identitys); } } \ No newline at end of file diff --git a/KruacentExiled/KE.Misc/Features/GamblingCoin/Effect/PositiveEffect/OneAmmoLogicer.cs b/KruacentExiled/KE.Misc/Features/GamblingCoin/Effect/PositiveEffect/OneAmmoLogicer.cs index 8e2cace9..daaa91ba 100644 --- a/KruacentExiled/KE.Misc/Features/GamblingCoin/Effect/PositiveEffect/OneAmmoLogicer.cs +++ b/KruacentExiled/KE.Misc/Features/GamblingCoin/Effect/PositiveEffect/OneAmmoLogicer.cs @@ -6,7 +6,7 @@ internal class OneAmmoLogicer : ICoinEffect { public string Name { get; set; } = "OneAmmoLogicer"; - public string Message { get; set; } = "Is that come from you ?!?"; + public string Message { get; set; } = "Were you hiding that in your... "; public int Weight { get; set; } = 1; public EffectType Type { get; set; } = EffectType.Positive; diff --git a/KruacentExiled/KE.Misc/Features/GamblingCoin/Effect/PositiveEffect/RandomGoodEffect.cs b/KruacentExiled/KE.Misc/Features/GamblingCoin/Effect/PositiveEffect/RandomGoodEffect.cs index 94f380bb..bb9064f8 100644 --- a/KruacentExiled/KE.Misc/Features/GamblingCoin/Effect/PositiveEffect/RandomGoodEffect.cs +++ b/KruacentExiled/KE.Misc/Features/GamblingCoin/Effect/PositiveEffect/RandomGoodEffect.cs @@ -9,7 +9,7 @@ internal class RandomGoodEffect : ICoinEffect { public string Name { get; set; } = "RandomGoodEffect"; - public string Message { get; set; } = "You're wish is accepted !"; + public string Message { get; set; } = "You got a random effect !"; public int Weight { get; set; } = 10; public KE.Misc.Features.GamblingCoin.Types.EffectType Type { get; set; } = KE.Misc.Features.GamblingCoin.Types.EffectType.Positive; diff --git a/KruacentExiled/KE.Misc/Features/GamblingCoin/Effect/PositiveEffect/RandomKeycard.cs b/KruacentExiled/KE.Misc/Features/GamblingCoin/Effect/PositiveEffect/RandomKeycard.cs new file mode 100644 index 00000000..969509ef --- /dev/null +++ b/KruacentExiled/KE.Misc/Features/GamblingCoin/Effect/PositiveEffect/RandomKeycard.cs @@ -0,0 +1,34 @@ +using Exiled.API.Features; +using Exiled.API.Features.Items; +using Exiled.API.Features.Pickups; +using KE.Misc.Features.GamblingCoin.Interfaces; +using KE.Misc.Features.GamblingCoin.Types; +using UnityEngine; + +internal class GiveRandomKeycard : ICoinEffect +{ + public string Name { get; set; } = "GiveRandomKeycard"; + public string Message { get; set; } = "You got a keycard !"; + public int Weight { get; set; } = 20; + public EffectType Type { get; set; } = EffectType.Positive; + + public void Execute(Player player) + { + LabApi.Features.Wrappers.KeycardItem keycard = LabApi.Features.Wrappers.KeycardItem.CreateCustomKeycardManagement(player, "Keycard", "Keycard", + new Interactables.Interobjects.DoorUtils.KeycardLevels(Random.Range(0, 4), Random.Range(0, 4), Random.Range(0, 4)), RandomColor(), RandomColor(), RandomColor()); + + + player.DropItem(Item.Get(keycard.Base)); + } + + private Color32 RandomColor() + { + return new Color32 + ( + (byte)Random.Range(0, 256), + (byte)Random.Range(0, 256), + (byte)Random.Range(0, 256), + (byte)Random.Range(0, 256) + ); + } +} \ No newline at end of file diff --git a/KruacentExiled/KE.Misc/Features/GamblingCoin/Effect/PositiveEffect/SpawnHeal.cs b/KruacentExiled/KE.Misc/Features/GamblingCoin/Effect/PositiveEffect/SpawnHeal.cs index edc70727..4b2107e0 100644 --- a/KruacentExiled/KE.Misc/Features/GamblingCoin/Effect/PositiveEffect/SpawnHeal.cs +++ b/KruacentExiled/KE.Misc/Features/GamblingCoin/Effect/PositiveEffect/SpawnHeal.cs @@ -7,7 +7,7 @@ internal class SpawnHeal : ICoinEffect { public string Name { get; set; } = "SpawnHeal"; - public string Message { get; set; } = "Yipee, you got heal !"; + public string Message { get; set; } = string.Empty; public int Weight { get; set; } = 35; public EffectType Type { get; set; } = EffectType.Positive; diff --git a/KruacentExiled/KE.Misc/Features/GamblingCoin/Effect/PositiveEffect/TeleportToEscape.cs b/KruacentExiled/KE.Misc/Features/GamblingCoin/Effect/PositiveEffect/TeleportToEscape.cs index d15bf6e6..b306adb3 100644 --- a/KruacentExiled/KE.Misc/Features/GamblingCoin/Effect/PositiveEffect/TeleportToEscape.cs +++ b/KruacentExiled/KE.Misc/Features/GamblingCoin/Effect/PositiveEffect/TeleportToEscape.cs @@ -7,7 +7,7 @@ internal class TeleportToEscape : ICoinEffect { public string Name { get; set; } = "TeleportToEscape"; - public string Message { get; set; } = "You got lucky"; + public string Message { get; set; } = string.Empty; public int Weight { get; set; } = 5; public EffectType Type { get; set; } = EffectType.Positive; diff --git a/KruacentExiled/KE.Misc/Features/GamblingCoin/EventHandlers.cs b/KruacentExiled/KE.Misc/Features/GamblingCoin/EventHandlers.cs index 4fb31bfb..b344417e 100644 --- a/KruacentExiled/KE.Misc/Features/GamblingCoin/EventHandlers.cs +++ b/KruacentExiled/KE.Misc/Features/GamblingCoin/EventHandlers.cs @@ -1,6 +1,7 @@ using System; using System.Collections.Generic; using Exiled.API.Features; +using Exiled.CustomItems.API.Features; using Exiled.Events.EventArgs.Player; using KE.Misc.Features.GamblingCoin.Interfaces; using KE.Misc.Features.GamblingCoin.Types; @@ -12,14 +13,15 @@ public class EventHandlers { private static Config Config => MainPlugin.Instance.Config; - private readonly System.Random _rd = new(); private readonly Dictionary _cooldowns = new(); public static Dictionary CoinUses = new(); public void OnCoinFlip(FlippingCoinEventArgs ev) { + if (CustomItem.TryGet(ev.Item, out _)) return; + if (_cooldowns.TryGetValue(ev.Player.UserId, out var lastFlip) && - (DateTime.UtcNow - lastFlip).TotalSeconds < Config.GamblingCoinCooldow) + (DateTime.UtcNow - lastFlip).TotalSeconds < Config.GamblingCoinCooldown) { ev.IsAllowed = false; PlayerUtils.SendBroadcast(ev.Player, "You must wait before flipping again"); @@ -30,8 +32,7 @@ public void OnCoinFlip(FlippingCoinEventArgs ev) if (!CoinUses.ContainsKey(ev.Player.CurrentItem.Serial)) { - CoinUses[ev.Player.CurrentItem.Serial] = - _rd.Next(Config.GamblingCoinMinUse, Config.GamblingCoinMaxUse); + CoinUses[ev.Player.CurrentItem.Serial] = UnityEngine.Random.Range(Config.GamblingCoinMinUse, Config.GamblingCoinMaxUse); Log.Debug($"Registered new coin: {CoinUses[ev.Player.CurrentItem.Serial]} uses left."); } @@ -40,9 +41,9 @@ public void OnCoinFlip(FlippingCoinEventArgs ev) bool shouldBreak = CoinUses[ev.Player.CurrentItem.Serial] <= 0; - var type = ev.IsTails ? EffectType.Negative : EffectType.Positive; + EffectType type = ev.IsTails ? EffectType.Negative : EffectType.Positive; - var effect = GamblingCoinManager.GetRandomEffect(type); + ICoinEffect effect = GamblingCoinManager.GetRandomEffect(type); if (effect == null) { diff --git a/KruacentExiled/KE.Misc/Features/GamblingCoin/GamblingCoinManager.cs b/KruacentExiled/KE.Misc/Features/GamblingCoin/GamblingCoinManager.cs index 08fa4bc4..119c9684 100644 --- a/KruacentExiled/KE.Misc/Features/GamblingCoin/GamblingCoinManager.cs +++ b/KruacentExiled/KE.Misc/Features/GamblingCoin/GamblingCoinManager.cs @@ -12,7 +12,6 @@ namespace KE.Misc.Features.GamblingCoin { public static class GamblingCoinManager { - private static readonly Dictionary _idLookup = new(); private static readonly Dictionary _nameLookup = new(); private static readonly HashSet _activeEffects = new(); @@ -70,7 +69,6 @@ private static void BuildWeightedList() public static void DestroyAll() { - _idLookup.Clear(); _nameLookup.Clear(); _activeEffects.Clear(); EffectList.Clear(); From ef7d17a86e5d3cfb5b16f33eeefe73a08e4e97fc Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Wed, 15 Oct 2025 18:20:28 +0200 Subject: [PATCH 387/853] added omni card --- .../Features/914Upgrades/OmniCardUpgrade.cs | 45 +++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 KruacentExiled/KE.Misc/Features/914Upgrades/OmniCardUpgrade.cs diff --git a/KruacentExiled/KE.Misc/Features/914Upgrades/OmniCardUpgrade.cs b/KruacentExiled/KE.Misc/Features/914Upgrades/OmniCardUpgrade.cs new file mode 100644 index 00000000..f7f70f4c --- /dev/null +++ b/KruacentExiled/KE.Misc/Features/914Upgrades/OmniCardUpgrade.cs @@ -0,0 +1,45 @@ +using Exiled.API.Features; +using Exiled.API.Features.Items; +using Exiled.Events.EventArgs.Scp914; +using LabApi.Features.Wrappers; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using UnityEngine; +using LabPlayer = LabApi.Features.Wrappers.Player; +using DetailBase = InventorySystem.Items.Keycards.DetailBase; +using Interactables.Interobjects.DoorUtils; +using InventorySystem.Items.Keycards; +using System.Xml.Linq; +using KeycardItem = LabApi.Features.Wrappers.KeycardItem; +using InventorySystem; + + +namespace KE.Misc.Features._914Upgrades +{ + public class OmniCardUpgrade : Base914PlayerUpgrade + { + protected override float Chance => 5; + + public static readonly Color32 CardColor = new(45, 44, 249,255); + protected override void OnUpgradingPlayer(UpgradingPlayerEventArgs ev) + { + LabPlayer player = ev.Player; + if (player.CurrentItem is null) return; + if (player.CurrentItem is not KeycardItem keycard) return; + + player.RemoveItem(keycard); + + player.CurrentItem = CreateOmniCard(player); + } + + public static KeycardItem CreateOmniCard(LabPlayer player) + { + return KeycardItem.CreateCustomKeycardSite02(player, "Omni-Card", string.Empty, "Omni-Card", + new KeycardLevels(3, 3, 3), + CardColor, CardColor, Color.white, 1); + } + + } +} From 550d952e48a24279caaf635ea6ac4beb49d5c584 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Wed, 15 Oct 2025 18:20:43 +0200 Subject: [PATCH 388/853] Changed autonuke to get the actual time --- .../KE.Misc/Features/AutoNukeAnnoucement.cs | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/KruacentExiled/KE.Misc/Features/AutoNukeAnnoucement.cs b/KruacentExiled/KE.Misc/Features/AutoNukeAnnoucement.cs index 3bde8936..ce44b53a 100644 --- a/KruacentExiled/KE.Misc/Features/AutoNukeAnnoucement.cs +++ b/KruacentExiled/KE.Misc/Features/AutoNukeAnnoucement.cs @@ -28,14 +28,21 @@ public void OnRoundStarted() private IEnumerator Timer() { Stopwatch watch = Stopwatch.StartNew(); + bool flag = false; - - while (watch.Elapsed.TotalMinutes < 25) + while (watch.Elapsed.TotalMinutes < AlphaWarheadController.Singleton._autoDetonateTime) { yield return Timing.WaitForSeconds(60); + if(Warhead.IsDetonated || Warhead.IsInProgress) + { + flag = true; + break; + } + } + if (!flag) + { + SayAnnouncement(); } - - SayAnnouncement(); } From 6ad396292487a480d49e2b6250b24ee2e7401373 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Wed, 15 Oct 2025 18:21:00 +0200 Subject: [PATCH 389/853] scps can spawn in lcz --- KruacentExiled/KE.Misc/Features/SpawnLcz.cs | 129 ++++++++++++++++++++ KruacentExiled/KE.Misc/MainPlugin.cs | 4 +- 2 files changed, 132 insertions(+), 1 deletion(-) create mode 100644 KruacentExiled/KE.Misc/Features/SpawnLcz.cs diff --git a/KruacentExiled/KE.Misc/Features/SpawnLcz.cs b/KruacentExiled/KE.Misc/Features/SpawnLcz.cs new file mode 100644 index 00000000..9110491e --- /dev/null +++ b/KruacentExiled/KE.Misc/Features/SpawnLcz.cs @@ -0,0 +1,129 @@ +using Exiled.API.Enums; +using Exiled.API.Extensions; +using Exiled.API.Features; +using Exiled.API.Features.Doors; +using Exiled.API.Features.Items; +using LabDoor = LabApi.Features.Wrappers.Door; +using MEC; +using PlayerRoles; +using System.Collections.Generic; +using System.Linq; +using UnityEngine; +using System.Security; + +namespace KE.Misc.Features +{ + internal class SpawnLcz : MiscFeature + { + public float Time { get; } = 198; + + public static readonly Dictionary RoomTypes = new() + { + { RoleTypeId.Scp939,RoomType.Lcz330 }, + { RoleTypeId.Scp096,RoomType.LczGlassBox }, + { RoleTypeId.Scp173,RoomType.LczGlassBox }, + }; + private float chance = .33f; + public float Chance + { + get + { + return chance; + } + set + { + chance = Mathf.Clamp01(value); + } + } + + private HashSet serials = new(); + private HashSet locked = new(); + + public override void SubscribeEvents() + { + //Chance = 1; + LabApi.Events.Handlers.ServerEvents.RoundStarted += OnRoundStarted; + LabApi.Events.Handlers.PlayerEvents.DroppingItem += OnDroppingItem; + base.SubscribeEvents(); + } + + + + public override void UnsubscribeEvents() + { + LabApi.Events.Handlers.ServerEvents.RoundStarted -= OnRoundStarted; + LabApi.Events.Handlers.PlayerEvents.DroppingItem -= OnDroppingItem; + base.UnsubscribeEvents(); + } + private void OnRoundStarted() + { + LockDoors(); + Timing.CallDelayed(.5f, delegate + { + foreach (Player player in Player.List.Where(p => RoomTypes.ContainsKey(p.Role))) + { + if (UnityEngine.Random.value < Chance) + { + player.Teleport(Room.Get(RoomTypes[player.Role])); + GiveEntertainment(player); + } + } + }); + + + + Timing.CallDelayed(Time, delegate + { + foreach(Door door in locked) + { + LabDoor d = LabDoor.Get(door.Base); + d.Lock(Interactables.Interobjects.DoorUtils.DoorLockReason.SpecialDoorFeature, false); + } + foreach(ushort serial in serials) + { + Item item =Item.Get(serial); + item?.Destroy(); + } + }); + } + private void OnDroppingItem(LabApi.Events.Arguments.PlayerEvents.PlayerDroppingItemEventArgs ev) + { + if (!serials.Contains(ev.Item.Serial)) return; + ev.IsAllowed = false; + } + + public void LockDoors() + { + foreach (RoomType room in RoomTypes.Values) + { + Room r = Room.Get(room); + foreach (Door door in r.Doors) + { + LockDoor(door); + locked.Add(door); + } + } + } + + + + public void GiveEntertainment(Player player) + { + Keycard key = Item.Create(ItemType.KeycardChaosInsurgency); + key.Give(player); + serials.Add(key.Serial); + player.CurrentItem = key; + } + + private void LockDoor(Door door) + { + LabDoor d = LabDoor.Get(door.Base); + d.Lock(Interactables.Interobjects.DoorUtils.DoorLockReason.SpecialDoorFeature, true); + } + + + + + + } +} diff --git a/KruacentExiled/KE.Misc/MainPlugin.cs b/KruacentExiled/KE.Misc/MainPlugin.cs index 9f57cfd0..7986b369 100644 --- a/KruacentExiled/KE.Misc/MainPlugin.cs +++ b/KruacentExiled/KE.Misc/MainPlugin.cs @@ -37,7 +37,7 @@ public class MainPlugin : Plugin internal AutoNukeAnnoucement AutoNukeAnnoucement { get; private set; } internal AutoTesla AutoTesla { get; private set; } internal EventHandlers _gamblingCoinHandler { get; private set; } - + internal SpawnLcz SpawnLcz { get; private set; } public override void OnEnabled() { @@ -53,6 +53,7 @@ public override void OnEnabled() AutoNukeAnnoucement = new(); AutoTesla = new(); Candy = new Candy(); + SpawnLcz = new(); Respawn.SetTokens(SpawnableFaction.NtfWave, 2); Respawn.SetTokens(SpawnableFaction.ChaosWave, 2); @@ -96,6 +97,7 @@ public override void OnDisabled() _914 = null; Candy = null; + SpawnLcz = null; ClassDDoor = null; ServerHandler = null; SCPBuff = null; From 64549313568050f8ab4c0fcfc7aa11bf2a71cf2e Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Wed, 15 Oct 2025 20:32:38 +0200 Subject: [PATCH 390/853] inverted now rarer and healable --- .../KE.CustomRoles/CR/Human/Inverted.cs | 34 +++++++++++++++---- 1 file changed, 28 insertions(+), 6 deletions(-) diff --git a/KruacentExiled/KE.CustomRoles/CR/Human/Inverted.cs b/KruacentExiled/KE.CustomRoles/CR/Human/Inverted.cs index e5c217da..0ded8f5c 100644 --- a/KruacentExiled/KE.CustomRoles/CR/Human/Inverted.cs +++ b/KruacentExiled/KE.CustomRoles/CR/Human/Inverted.cs @@ -1,11 +1,12 @@ -using Exiled.API.Features.Attributes; +using Exiled.API.Enums; +using Exiled.API.Features; +using Exiled.API.Features.Attributes; using Exiled.CustomRoles.API.Features; +using Exiled.Events.EventArgs.Player; using KE.CustomRoles.API.Features; using MEC; using PlayerRoles; -using Exiled.API.Features; using UnityEngine; -using Exiled.API.Enums; namespace KE.CustomRoles.CR.Human { @@ -15,10 +16,10 @@ public class Inverted : GlobalCustomRole public override string Description { get; set; } = "Tu as un talent assez exceptionnel !"; public override uint Id { get; set; } = 1066; public override string PublicName { get; set; } = "Inverted"; - public override bool KeepRoleOnDeath { get; set; } = true; - public override bool KeepRoleOnChangingRole { get; set; } = true; + public override bool KeepRoleOnDeath { get; set; } = false; + public override bool KeepRoleOnChangingRole { get; set; } = false; - public override float SpawnChance { get; set; } = 100; + public override float SpawnChance { get; set; } = 20; public override Vector3 Scale { get; set; } = new Vector3(1, 1, 1); protected override void RoleAdded(Player player) @@ -32,5 +33,26 @@ protected override void RoleRemoved(Player player) player.Scale = new Vector3(1f, 1f, 1f); player.DisableEffect(EffectType.Slowness); } + + + protected override void SubscribeEvents() + { + Exiled.Events.Handlers.Player.UsedItem += OnUsedItem; + base.SubscribeEvents(); + } + protected override void UnsubscribeEvents() + { + Exiled.Events.Handlers.Player.UsedItem -= OnUsedItem; + base.UnsubscribeEvents(); + } + + private void OnUsedItem(UsedItemEventArgs ev) + { + if (!Check(ev.Player)) return; + if (ev.Item.Type == ItemType.SCP500) + { + RemoveRole(ev.Player); + } + } } } \ No newline at end of file From baa54e2dd31dbc9484637c202a1e7f01ed64acfa Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Wed, 15 Oct 2025 20:39:43 +0200 Subject: [PATCH 391/853] added weight/seconds --- KruacentExiled/KE.Map/Others/BlackoutNDoor/Handlers/Handler.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/KruacentExiled/KE.Map/Others/BlackoutNDoor/Handlers/Handler.cs b/KruacentExiled/KE.Map/Others/BlackoutNDoor/Handlers/Handler.cs index fe8930b4..8faf752d 100644 --- a/KruacentExiled/KE.Map/Others/BlackoutNDoor/Handlers/Handler.cs +++ b/KruacentExiled/KE.Map/Others/BlackoutNDoor/Handlers/Handler.cs @@ -30,6 +30,7 @@ public class Handler : IUsingEvents }; private ZoneType currentScpZone = ZoneType.Unspecified; + private int weightPerSeconds = 2; private int weight = defaultWeight; private const int defaultWeight = 330; @@ -80,7 +81,7 @@ private IEnumerator Timer() { if(scp.Zone == currentScpZone) { - weight += timeRefresh; + weight += timeRefresh* weightPerSeconds; } else { From 119b9b463ee1fb20824f07d321c7a93012d467a8 Mon Sep 17 00:00:00 2001 From: OmerGS <27omerf@gmail.com> Date: Wed, 15 Oct 2025 22:19:40 +0200 Subject: [PATCH 392/853] inverted -> scp202 player will be rotated around z axis, add desc in teleport, add desc in enderman. --- .../KE.CustomRoles/Abilities/Teleport.cs | 3 +- .../KE.CustomRoles/CR/Human/Enderman.cs | 3 +- .../KE.CustomRoles/CR/Human/Inverted.cs | 36 ------------ .../KE.CustomRoles/CR/Human/scp202.cs | 56 +++++++++++++++++++ 4 files changed, 59 insertions(+), 39 deletions(-) delete mode 100644 KruacentExiled/KE.CustomRoles/CR/Human/Inverted.cs create mode 100644 KruacentExiled/KE.CustomRoles/CR/Human/scp202.cs diff --git a/KruacentExiled/KE.CustomRoles/Abilities/Teleport.cs b/KruacentExiled/KE.CustomRoles/Abilities/Teleport.cs index a061e759..36d9bcce 100644 --- a/KruacentExiled/KE.CustomRoles/Abilities/Teleport.cs +++ b/KruacentExiled/KE.CustomRoles/Abilities/Teleport.cs @@ -11,7 +11,7 @@ public class Teleport : KEAbilities { public override string Name { get; } = "Teleportation"; - public override string Description { get; } = ""; + public override string Description { get; } = $"Tu perds {Damage} HP/téléportation"; public override int Id => 2008; @@ -32,7 +32,6 @@ protected override void AbilityUsed(Player player) return; } - player.Hurt(Damage, "You are dead."); if(UnityEngine.Random.Range(1, 101) < 5) diff --git a/KruacentExiled/KE.CustomRoles/CR/Human/Enderman.cs b/KruacentExiled/KE.CustomRoles/CR/Human/Enderman.cs index 6ae469f8..66f5ebee 100644 --- a/KruacentExiled/KE.CustomRoles/CR/Human/Enderman.cs +++ b/KruacentExiled/KE.CustomRoles/CR/Human/Enderman.cs @@ -1,5 +1,6 @@ using Exiled.API.Features.Attributes; using Exiled.CustomRoles.API.Features; +using KE.CustomRoles.Abilities; using KE.CustomRoles.API.Features; using KE.CustomRoles.API.Interfaces; using PlayerRoles; @@ -12,7 +13,7 @@ namespace KE.CustomRoles.CR.Human internal class Enderman : GlobalCustomRole, IColor { public override SideEnum Side { get; set; } = SideEnum.Human; - public override string Description { get; set; } = "Fais attention tu n'aimes pas l'eau !"; + public override string Description { get; set; } = $"Tu peux te téléporter ! T tro for enféte"; public override uint Id { get; set; } = 1065; public override string PublicName { get; set; } = "Enderman"; public override bool KeepRoleOnDeath { get; set; } = false; diff --git a/KruacentExiled/KE.CustomRoles/CR/Human/Inverted.cs b/KruacentExiled/KE.CustomRoles/CR/Human/Inverted.cs deleted file mode 100644 index e5c217da..00000000 --- a/KruacentExiled/KE.CustomRoles/CR/Human/Inverted.cs +++ /dev/null @@ -1,36 +0,0 @@ -using Exiled.API.Features.Attributes; -using Exiled.CustomRoles.API.Features; -using KE.CustomRoles.API.Features; -using MEC; -using PlayerRoles; -using Exiled.API.Features; -using UnityEngine; -using Exiled.API.Enums; - -namespace KE.CustomRoles.CR.Human -{ - public class Inverted : GlobalCustomRole - { - public override SideEnum Side { get; set; } = SideEnum.Human; - public override string Description { get; set; } = "Tu as un talent assez exceptionnel !"; - public override uint Id { get; set; } = 1066; - public override string PublicName { get; set; } = "Inverted"; - public override bool KeepRoleOnDeath { get; set; } = true; - public override bool KeepRoleOnChangingRole { get; set; } = true; - - public override float SpawnChance { get; set; } = 100; - public override Vector3 Scale { get; set; } = new Vector3(1, 1, 1); - - protected override void RoleAdded(Player player) - { - player.Scale = new Vector3(1f, -1f, 1f); - player.EnableEffect(EffectType.Slowness, 200, 99999); - } - - protected override void RoleRemoved(Player player) - { - player.Scale = new Vector3(1f, 1f, 1f); - player.DisableEffect(EffectType.Slowness); - } - } -} \ No newline at end of file diff --git a/KruacentExiled/KE.CustomRoles/CR/Human/scp202.cs b/KruacentExiled/KE.CustomRoles/CR/Human/scp202.cs new file mode 100644 index 00000000..2f8ff4b2 --- /dev/null +++ b/KruacentExiled/KE.CustomRoles/CR/Human/scp202.cs @@ -0,0 +1,56 @@ +using KE.CustomRoles.API.Features; +using Exiled.API.Features; +using UnityEngine; +using Exiled.API.Enums; +using Exiled.API.Extensions; +using Mirror; +using System.Linq; +using Exiled.Events.EventArgs.Player; +using KE.CustomRoles.API.Interfaces; + +namespace KE.CustomRoles.CR.Human +{ + public class Inverted : GlobalCustomRole, IColor + { + public override SideEnum Side { get; set; } = SideEnum.Human; + public override string Description { get; set; } = "? emsizan-itna'd te emsinummoc itna'd eiv enu sèrpa\n7691 lirva 91 el trom te engoloc à 6781 reivnaj 5 el én\n,etarcoméd neitérhc itrap ud eitrap tnasiaf 5691 à 9491 ed reilecnahC\n?elaidnom erreug ednoces al sèrpa dnamella reilecnahc re1 el darnoK erid xuev uT ?drannoC"; + public override uint Id { get; set; } = 1066; + public override string PublicName { get; set; } = "SCP-202"; + public override bool KeepRoleOnDeath { get; set; } = false; + public override bool KeepRoleOnChangingRole { get; set; } = true; + + public override float SpawnChance { get; set; } = 100; + public override Vector3 Scale { get; set; } = new Vector3(1, 1, 1); + public Color32 Color => new Color32(191, 255, 183, 0); + + protected override void SubscribeEvents() + { + Exiled.Events.Handlers.Player.UsedItem += OnUsedItem; + base.SubscribeEvents(); + } + protected override void UnsubscribeEvents() + { + Exiled.Events.Handlers.Player.UsedItem -= OnUsedItem; + base.UnsubscribeEvents(); + } + + private void OnUsedItem(UsedItemEventArgs ev) + { + if (!Check(ev.Player)) return; + if (ev.Item.Type == ItemType.SCP500) + { + RemoveRole(ev.Player); + } + } + protected override void RoleAdded(Player player) + { + player.Scale = new Vector3(1f, 1f, -1f); + } + + protected override void RoleRemoved(Player player) + { + player.Scale = new Vector3(1f, 1f, 1f); + + } + } +} \ No newline at end of file From f43a03460ea9dc3780860f56ae8590812af80394 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Mon, 20 Oct 2025 19:19:19 +0200 Subject: [PATCH 393/853] starting complexes --- .../API/Features/Complexes/ComplexBase.cs | 145 ++++++++++++++++++ .../API/Features/Complexes/ComplexGatling.cs | 21 +++ KruacentExiled/KE.Items/MainPlugin.cs | 34 ++-- 3 files changed, 176 insertions(+), 24 deletions(-) create mode 100644 KruacentExiled/KE.Items/API/Features/Complexes/ComplexBase.cs create mode 100644 KruacentExiled/KE.Items/API/Features/Complexes/ComplexGatling.cs diff --git a/KruacentExiled/KE.Items/API/Features/Complexes/ComplexBase.cs b/KruacentExiled/KE.Items/API/Features/Complexes/ComplexBase.cs new file mode 100644 index 00000000..35a38dab --- /dev/null +++ b/KruacentExiled/KE.Items/API/Features/Complexes/ComplexBase.cs @@ -0,0 +1,145 @@ +using Exiled.API.Features; +using Exiled.API.Features.Toys; +using Exiled.API.Interfaces; +using Mirror; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using UnityEngine; +using InteractableToy = LabApi.Features.Wrappers.InteractableToy; + +namespace KE.Items.API.Features.Complexes +{ + public abstract class ComplexBase : IWorldSpace + { + private GameObject gameObject; + public Vector3 Position + { + get + { + return gameObject.transform.localPosition; + } + } + + public Quaternion Rotation + { + get + { + return gameObject.transform.localRotation; + } + } + + private InteractableToy interactableToy; + private Primitive debugprim; + + private Player player; + + + public ComplexBase() + { + gameObject = new GameObject(); + CreateInteractable(gameObject); + + } + + private void CreateInteractable(GameObject gameObject) + { + interactableToy = InteractableToy.Create(networkSpawn: false); + interactableToy.Transform.parent = gameObject.transform; + interactableToy.Transform.localPosition = Vector3.zero; + interactableToy.Scale = Vector3.one; + interactableToy.Shape = AdminToys.InvisibleInteractableToy.ColliderShape.Box; + interactableToy.InteractionDuration = 1f; + interactableToy.OnSearched += OnSearched; + + CreateDebugPrim(interactableToy.GameObject); + } + private void CreateDebugPrim(GameObject gameObject) + { + debugprim = Primitive.Create(Vector3.zero, null, interactableToy.Scale, false); + debugprim.GameObject.transform.parent = interactableToy.Transform; + debugprim.Scale = gameObject.transform.localScale; + debugprim.Transform.localPosition = Vector3.zero; + debugprim.Collidable = false; + debugprim.Visible = true; + } + + private void OnSearched(LabApi.Features.Wrappers.Player ev) + { + Player player = Player.Get(ev); + + if (!AddPlayer(player)) + { + RemovePlayer(); + } + + } + + public bool AddPlayer(Player player) + { + if (this.player is not null) return false; + + this.player = player; + return true; + } + public bool RemovePlayer() + { + if (player is null) return false; + player = null; + return true; + } + + public void Spawn(Vector3 position,Quaternion rotation) + { + gameObject.transform.localPosition = position; + gameObject.transform.localRotation = rotation; + + + SpawnInteractable(); + LabApi.Events.Handlers.PlayerEvents.ShootingWeapon += OnShootingWeapon; + } + + private void OnShootingWeapon(LabApi.Events.Arguments.PlayerEvents.PlayerShootingWeaponEventArgs ev) + { + Player player = Player.Get(ev.Player); + if (player != this.player) return; + OnShoot(player); + + + } + + public void Unspawn() + { + UnspawnInteractable(); + } + + public void Destroy() + { + interactableToy.OnSearched -= OnSearched; + interactableToy.Destroy(); + debugprim.Destroy(); + } + + private void SpawnInteractable() + { + Log.Debug("spawn"+ interactableToy.Transform.position); + Log.Debug("spawn"+ debugprim.Position); + interactableToy.Spawn(); + debugprim.Spawn(); + } + private void UnspawnInteractable() + { + NetworkServer.UnSpawn(interactableToy.GameObject); + debugprim.UnSpawn(); + } + + + + + protected abstract void OnShoot(Player player); + + + } +} diff --git a/KruacentExiled/KE.Items/API/Features/Complexes/ComplexGatling.cs b/KruacentExiled/KE.Items/API/Features/Complexes/ComplexGatling.cs new file mode 100644 index 00000000..62660f7a --- /dev/null +++ b/KruacentExiled/KE.Items/API/Features/Complexes/ComplexGatling.cs @@ -0,0 +1,21 @@ +using Exiled.API.Features; +using Exiled.API.Interfaces; +using InteractableToy = LabApi.Features.Wrappers.InteractableToy; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using UnityEngine; +using Mirror; + +namespace KE.Items.API.Features.Complexes +{ + public class ComplexGatling : ComplexBase + { + protected override void OnShoot(Player player) + { + player.ShowHitMarker(Hitmarker.MaxSize); + } + } +} diff --git a/KruacentExiled/KE.Items/MainPlugin.cs b/KruacentExiled/KE.Items/MainPlugin.cs index 16a73216..e415103c 100644 --- a/KruacentExiled/KE.Items/MainPlugin.cs +++ b/KruacentExiled/KE.Items/MainPlugin.cs @@ -6,9 +6,11 @@ using KE.Items.API.Core.Lights; using KE.Items.API.Core.Settings; using KE.Items.API.Core.Upgrade; +using KE.Items.API.Features.Complexes; using KE.Utils.API.Displays.DisplayMeow; using System; using System.Linq; +using UnityEngine; using InteractableToy = LabApi.Features.Wrappers.InteractableToy; namespace KE.Items @@ -46,7 +48,7 @@ public override void OnEnabled() Utils.API.Sounds.SoundPlayer.Load(); - //Exiled.Events.Handlers.Server.RoundStarted += Test; + Exiled.Events.Handlers.Server.RoundStarted += Test; CustomItem.RegisterItems(); @@ -66,6 +68,8 @@ public override void OnDisabled() //QualityHandler?.Unregister(); SettingsHandler.UnsubscribeEvents(); + Exiled.Events.Handlers.Server.RoundStarted -= Test; + //QualityHandler = null; //PickupQuality = null; SettingsHandler = null; @@ -74,34 +78,16 @@ public override void OnDisabled() Instance = null; } - - - - - - private void Test() + public void Test() { - Player player = Player.List.First(); - + ComplexBase complex = new ComplexGatling(); + Player player = Player.List.First(); + Log.Debug(player.Position); + complex.Spawn(player.Position,Quaternion.identity); - var prim = Primitive.Create(player.Position,spawn:false); - prim.Collidable = false; - prim.Spawn(); - var itoy = InteractableToy.Create(prim.Transform, true); - itoy.InteractionDuration = 3f; - - - itoy.OnSearchAborted += GiveDestroy; - - } - - private void GiveDestroy(LabApi.Features.Wrappers.Player player) - { - CustomItem.Get(1046)?.Give(player); } - } } \ No newline at end of file From ce252bd42865600d822584900e60771fefceb922 Mon Sep 17 00:00:00 2001 From: OmerGS <27omerf@gmail.com> Date: Mon, 20 Oct 2025 21:03:48 +0200 Subject: [PATCH 394/853] change some stuff --- KruacentExiled/KE.CustomRoles/Abilities/SimulateDeath.cs | 2 +- KruacentExiled/KE.CustomRoles/CR/ClassD/Mime.cs | 5 ++--- KruacentExiled/KE.CustomRoles/CR/Guard/Introvert.cs | 2 +- KruacentExiled/KE.CustomRoles/CR/Scientist/ZoneManager.cs | 2 +- 4 files changed, 5 insertions(+), 6 deletions(-) diff --git a/KruacentExiled/KE.CustomRoles/Abilities/SimulateDeath.cs b/KruacentExiled/KE.CustomRoles/Abilities/SimulateDeath.cs index 1cf946ae..eef753e4 100644 --- a/KruacentExiled/KE.CustomRoles/Abilities/SimulateDeath.cs +++ b/KruacentExiled/KE.CustomRoles/Abilities/SimulateDeath.cs @@ -17,7 +17,7 @@ public class SimulateDeath : KEAbilities public override string Description { get; } = "T'es talent de mime te permettent de simuler la mort."; - public override int Id => 2009; + public override int Id => 2011; public int Duration = 10; public override float Cooldown { get; } = 60f; diff --git a/KruacentExiled/KE.CustomRoles/CR/ClassD/Mime.cs b/KruacentExiled/KE.CustomRoles/CR/ClassD/Mime.cs index f6fb5591..1f14651a 100644 --- a/KruacentExiled/KE.CustomRoles/CR/ClassD/Mime.cs +++ b/KruacentExiled/KE.CustomRoles/CR/ClassD/Mime.cs @@ -21,7 +21,7 @@ public class Mime : KECustomRole, IColor public override RoleTypeId Role { get; set; } = RoleTypeId.ClassD; public override bool KeepRoleOnDeath { get; set; } = false; public override bool KeepRoleOnChangingRole { get; set; } = true; - public override float SpawnChance { get; set; } = 0; + public override float SpawnChance { get; set; } = 100; public override Vector3 Scale { get; set; } = new Vector3(0.1f, 1, 1); public Color32 Color => new(255, 74, 74, 0); @@ -39,8 +39,7 @@ protected override void RoleRemoved(Player player) public override HashSet Abilities { get; } = new() { - 2009 + 2011 }; - } } diff --git a/KruacentExiled/KE.CustomRoles/CR/Guard/Introvert.cs b/KruacentExiled/KE.CustomRoles/CR/Guard/Introvert.cs index a4fd36bc..34dcc13e 100644 --- a/KruacentExiled/KE.CustomRoles/CR/Guard/Introvert.cs +++ b/KruacentExiled/KE.CustomRoles/CR/Guard/Introvert.cs @@ -22,10 +22,10 @@ internal class Introvert : KECustomRole public override List Inventory { get; set; } = new List() { - $"{ItemType.Radio}", $"{ItemType.ArmorLight}", $"{ItemType.GunFSP9}", $"{ItemType.Medkit}", + $"{ItemType.Flashlight}", $"{ItemType.Flashlight}" }; diff --git a/KruacentExiled/KE.CustomRoles/CR/Scientist/ZoneManager.cs b/KruacentExiled/KE.CustomRoles/CR/Scientist/ZoneManager.cs index b971d69d..1e1074dc 100644 --- a/KruacentExiled/KE.CustomRoles/CR/Scientist/ZoneManager.cs +++ b/KruacentExiled/KE.CustomRoles/CR/Scientist/ZoneManager.cs @@ -34,7 +34,7 @@ public class ZoneManager : KECustomRole { new DynamicSpawnPoint() { - Location = SpawnLocationType.InsideHidLab, + Location = SpawnLocationType.Inside127Lab, Chance = 100, } } From 44b5f897b5099ef5d956927ab329e010d9e52c7c Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Sun, 26 Oct 2025 17:50:33 +0100 Subject: [PATCH 395/853] continued layout --- .../KE.Map/CustomZones/AltasReader.cs | 249 ++++++++++++++++++ .../KE.Map/CustomZones/CustomFacilityZone.cs | 14 + .../KE.Map/CustomZones/CustomRoom.cs | 56 ++++ .../CustomZones/CustomRooms/MCZ/EndRoom.cs | 37 +++ .../CustomZones/CustomRooms/MCZ/SCorridor.cs | 39 +++ .../CustomZones/CustomRooms/MCZ/TCorridor.cs | 42 +++ .../KE.Map/CustomZones/CustomZone.cs | 28 ++ KruacentExiled/KE.Map/CustomZones/Layout.cs | 25 ++ .../CustomZones/MediumContainmentZone.cs | 66 +++++ .../KE.Map/CustomZones/SpawnedCustomRoom.cs | 61 +++++ KruacentExiled/KE.Map/KE.Map.csproj | 2 +- KruacentExiled/KE.Map/MainPlugin.cs | 75 +++++- .../KE.Map/Utils/StructureSpawner.cs | 45 ++-- 13 files changed, 717 insertions(+), 22 deletions(-) create mode 100644 KruacentExiled/KE.Map/CustomZones/AltasReader.cs create mode 100644 KruacentExiled/KE.Map/CustomZones/CustomFacilityZone.cs create mode 100644 KruacentExiled/KE.Map/CustomZones/CustomRoom.cs create mode 100644 KruacentExiled/KE.Map/CustomZones/CustomRooms/MCZ/EndRoom.cs create mode 100644 KruacentExiled/KE.Map/CustomZones/CustomRooms/MCZ/SCorridor.cs create mode 100644 KruacentExiled/KE.Map/CustomZones/CustomRooms/MCZ/TCorridor.cs create mode 100644 KruacentExiled/KE.Map/CustomZones/CustomZone.cs create mode 100644 KruacentExiled/KE.Map/CustomZones/Layout.cs create mode 100644 KruacentExiled/KE.Map/CustomZones/MediumContainmentZone.cs create mode 100644 KruacentExiled/KE.Map/CustomZones/SpawnedCustomRoom.cs diff --git a/KruacentExiled/KE.Map/CustomZones/AltasReader.cs b/KruacentExiled/KE.Map/CustomZones/AltasReader.cs new file mode 100644 index 00000000..e0238916 --- /dev/null +++ b/KruacentExiled/KE.Map/CustomZones/AltasReader.cs @@ -0,0 +1,249 @@ +using Exiled.API.Features; +using Exiled.API.Features.Pools; +using MapGeneration; +using System; +using System.Collections.Generic; +using System.Data.SqlTypes; +using System.Drawing; +using System.IO; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using UnityEngine; +using Color = System.Drawing.Color; + +namespace KE.Map.CustomZones +{ + public static class AltasReader + { + + + public static readonly Dictionary ColortoRoom = new() + { + { new Color32(0,255,0,255), RoomShape.Endroom }, + { new Color32(255,0,0,255), RoomShape.TShape }, + { new Color32(0,0,255,255), RoomShape.Curve }, + { new Color32(255,255,0,255), RoomShape.Straight }, + { new Color32(255,0,255,255), RoomShape.XShape } + }; + + public static string Path => Paths.Configs + "/Atlases/"; + + public class RoomShapeRotation + { + + public RoomShape RoomShape { get; } + public Vector3 Rotation { get; } + + + public RoomShapeRotation(RoomShape roomShape, Vector3 rotation) + { + RoomShape = roomShape; + Rotation = rotation; + } + + + } + + + public static void Read() + { + if (!Directory.Exists(Path)) + { + Log.Warn("no atlases directory. creating"); + Directory.CreateDirectory(Path); + return ; + } + + HashSet layouts = new(); + + IEnumerable files = Directory.GetFiles(Path, "*.png"); + + Dictionary coordtoroom = new(); + + foreach (string file in files) + { + + string noExFile = System.IO.Path.GetFileName(file); + Log.Debug($"loading {file} as {noExFile}"); + using Bitmap bmp = new Bitmap(file); + int width = bmp.Width; + int height = bmp.Height; + + if(width % 3 != 0 || height % 3 != 0) + { + throw new FileLoadException("wrong size : must be a multiple of 3"); + } + + for (int y = 1; y < height; y += 3) + { + for (int x = 1; x < width; x+= 3) + { + + Color pixel = bmp.GetPixel(x, y); + if (pixel.A == 0) continue; + Color pixelup = bmp.GetPixel(x, y+1); + Color pixeldown = bmp.GetPixel(x, y-1); + Color pixelleft = bmp.GetPixel(x-1, y); + Color pixelright = bmp.GetPixel(x+1, y); + + Dictionary colors = new() + { + { new(0,1),pixelup }, + { new(0,-1),pixeldown }, + { new(-1,0),pixelleft }, + { new(1,0),pixelright } + }; + + + + List empty = ListPool.Pool.Get(); + foreach(Vector2Int pos in colors.Keys) + { + if(colors[pos].A == 0) + { + empty.Add(pos); + } + } + int numEmpty = empty.Count; + + RoomShape shape = RoomShape.Undefined; + Vector3 rotation = Vector3.zero; + + if (numEmpty == 0) + { + shape = RoomShape.XShape; + rotation = Vector3.zero; + } + + if(numEmpty == 1) + { + shape = RoomShape.TShape; + Vector2Int coordempty = empty[0]; + rotation = new(0, coordempty.x * 90,0); + + if (coordempty.x == 0 && coordempty.y == 1) + { + rotation = Vector3.zero; + } + if (coordempty.x == 0 && coordempty.y == -1) + { + rotation = new Vector3(0, 180, 0); + } + } + + + if(numEmpty == 2) + { + if (Mathf.Abs(empty[0].x) == Mathf.Abs(empty[1].x) + || Mathf.Abs(empty[0].y) == Mathf.Abs(empty[1].y)) + { + shape = RoomShape.Straight; + if(empty[0].x == 0) + { + rotation = Vector3.zero; + } + else + { + rotation = new Vector3(0, 90, 0); + } + } + else + { + shape = RoomShape.Curve; + + Dictionary coordToRotation = new() + { + {new (1,1),Vector3.zero }, + {new (-1,1), new Vector3(0,90,0) }, + {new (-1,-1), new Vector3(0,180,0) }, + {new (1,-1), new Vector3(0,-90,0) } + }; + + + foreach(var kvp in coordToRotation) + { + if (!empty.Contains(new Vector2Int(0, kvp.Key.y)) && + !empty.Contains(new Vector2Int(kvp.Key.x, 0))) + { + rotation = kvp.Value; + } + } + + } + } + + + if(numEmpty == 3) + { + Vector2Int coordnotempty = Vector2Int.zero; + shape = RoomShape.Endroom; + foreach (Vector2Int pos in colors.Keys) + { + if (!empty.Contains(pos)) + { + coordnotempty = pos; + } + } + + + if (coordnotempty.x == 0 && coordnotempty.y == 1) + { + rotation = Vector3.zero; + } + if (coordnotempty.x == 0 && coordnotempty.y == -1) + { + rotation = new Vector3(0, 180, 0); + } + if (coordnotempty.x == 1 && coordnotempty.y == 0) + { + rotation = new Vector3(0, 90, 0); + } + if (coordnotempty.x == -1 && coordnotempty.y == 0) + { + rotation = new Vector3(0, -90, 0); + } + + + + } + + + + + /*Color32 color = new Color32(pixel.R, pixel.G, pixel.B, pixel.A); + + + if (!ColortoRoom.ContainsKey(color)) + { + throw new ArgumentException($"[{noExFile}] Unrecognized color at {coord}"); + } + shape = ColortoRoom[color]; + */ + + + Vector2Int coord = new Vector2Int(x, y); + + if(shape == RoomShape.Undefined) + { + Log.Warn($"found undefined at {coord} room skipping"); + continue; + } + Log.Debug($"adding {shape} at {coord} ({rotation})"); + coordtoroom.Add(coord, new (shape,rotation)); + + } + } + + Layout layout = new(coordtoroom); + coordtoroom.Clear(); + } + } + + + + + + + } +} diff --git a/KruacentExiled/KE.Map/CustomZones/CustomFacilityZone.cs b/KruacentExiled/KE.Map/CustomZones/CustomFacilityZone.cs new file mode 100644 index 00000000..3c1c7644 --- /dev/null +++ b/KruacentExiled/KE.Map/CustomZones/CustomFacilityZone.cs @@ -0,0 +1,14 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace KE.Map.CustomZones +{ + public enum CustomFacilityZone + { + None, + MediumContainment + } +} diff --git a/KruacentExiled/KE.Map/CustomZones/CustomRoom.cs b/KruacentExiled/KE.Map/CustomZones/CustomRoom.cs new file mode 100644 index 00000000..85f6a04f --- /dev/null +++ b/KruacentExiled/KE.Map/CustomZones/CustomRoom.cs @@ -0,0 +1,56 @@ +using Exiled.API.Features; +using Exiled.API.Features.Toys; +using MapGeneration; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Net; +using System.Text; +using System.Threading.Tasks; +using UnityEngine; + +namespace KE.Map.CustomZones +{ + public abstract class CustomRoom + { + private static readonly HashSet registered = new(); + public static IReadOnlyCollection RegisteredRoom => registered; + + public abstract RoomShape Shape { get; } + + public abstract CustomFacilityZone FacilityZone { get; } + + public Vector3 Size => RoomIdentifier.GridScale; + public HashSet SpawnedRoom { get; } = new(); + + public CustomRoom() + { + registered.Add(this); + } + + protected abstract IEnumerable SpawnRoom(Vector3 position,Vector3 rotation); + + public SpawnedCustomRoom Spawn(Vector2Int coord,Vector3 rotation,Vector3 spawnzone) + { + Vector3 position = new(coord.x * Size.x+ spawnzone.x, spawnzone.y, coord.y * Size.z + spawnzone.z); + + Log.Debug("spawn room at " + position); + IEnumerable prims = SpawnRoom(position,rotation); + + foreach(AdminToy admin in prims) + { + Log.Debug("spawning prim at "+ admin.Position); + } + + + SpawnedCustomRoom room = new(this, Shape, position,rotation, coord, prims); + room.Spawn(); + SpawnedRoom.Add(room); + return room; + + } + + + + } +} diff --git a/KruacentExiled/KE.Map/CustomZones/CustomRooms/MCZ/EndRoom.cs b/KruacentExiled/KE.Map/CustomZones/CustomRooms/MCZ/EndRoom.cs new file mode 100644 index 00000000..296ca8b5 --- /dev/null +++ b/KruacentExiled/KE.Map/CustomZones/CustomRooms/MCZ/EndRoom.cs @@ -0,0 +1,37 @@ +using Exiled.API.Features.Toys; +using MapGeneration; +using System.Collections.Generic; +using UnityEngine; +using Light = Exiled.API.Features.Toys.Light; + +namespace KE.Map.CustomZones.CustomRooms.MCZ +{ + public class EndRoom : CustomRoom + { + public override RoomShape Shape => RoomShape.Endroom; + + public override CustomFacilityZone FacilityZone => CustomFacilityZone.MediumContainment; + + protected override IEnumerable SpawnRoom(Vector3 position,Vector3 rotation) + { + Quaternion rot = Quaternion.Euler(rotation); + + + Light light = Light.Create(position + Vector3.up * 2, null, null, false, Color.white); + light.LightType = LightType.Spot; + light.Rotation = Quaternion.LookRotation(Vector3.down); + light.Range = 50f; + light.SpotAngle = 120; + light.Intensity = 8; + + + + + return new HashSet() + { + Primitive.Create(PrimitiveType.Cube,position, rotation, new Vector3(15f,1,6f), false), + light, + }; + } + } +} diff --git a/KruacentExiled/KE.Map/CustomZones/CustomRooms/MCZ/SCorridor.cs b/KruacentExiled/KE.Map/CustomZones/CustomRooms/MCZ/SCorridor.cs new file mode 100644 index 00000000..ab2a1832 --- /dev/null +++ b/KruacentExiled/KE.Map/CustomZones/CustomRooms/MCZ/SCorridor.cs @@ -0,0 +1,39 @@ +using Exiled.API.Features.Toys; +using MapGeneration; +using System.Collections.Generic; +using UnityEngine; +using Light = Exiled.API.Features.Toys.Light; + +namespace KE.Map.CustomZones.CustomRooms.MCZ +{ + public class SCorridor : CustomRoom + { + public override RoomShape Shape => RoomShape.Straight; + + public override CustomFacilityZone FacilityZone => CustomFacilityZone.MediumContainment; + + protected override IEnumerable SpawnRoom(Vector3 position, Vector3 rotation) + { + { + Quaternion rot = Quaternion.Euler(rotation); + + + Light light = Light.Create(position + Vector3.up * 2, null, null, false, Color.white); + light.LightType = LightType.Spot; + light.Rotation = Quaternion.LookRotation(Vector3.down); + light.Range = 50f; + light.SpotAngle = 120; + light.Intensity = 8; + + + + + return new HashSet() + { + Primitive.Create(PrimitiveType.Cube,position, rotation, new Vector3(15f,1,6f), false), + light, + }; + } + } + } +} diff --git a/KruacentExiled/KE.Map/CustomZones/CustomRooms/MCZ/TCorridor.cs b/KruacentExiled/KE.Map/CustomZones/CustomRooms/MCZ/TCorridor.cs new file mode 100644 index 00000000..fbe3e392 --- /dev/null +++ b/KruacentExiled/KE.Map/CustomZones/CustomRooms/MCZ/TCorridor.cs @@ -0,0 +1,42 @@ +using Exiled.API.Features.Toys; +using MapGeneration; +using System.Collections.Generic; +using UnityEngine; +using Light = Exiled.API.Features.Toys.Light; + +namespace KE.Map.CustomZones.CustomRooms.MCZ +{ + public class TCorridor : CustomRoom + { + public override RoomShape Shape => RoomShape.TShape; + + public override CustomFacilityZone FacilityZone => CustomFacilityZone.MediumContainment; + + protected override IEnumerable SpawnRoom(Vector3 position, Vector3 rotation) + { + Quaternion rot = Quaternion.Euler(rotation); + + + Light light = Light.Create(position + Vector3.up * 10, null, null, false, Color.white); + light.LightType = LightType.Spot; + light.Rotation = Quaternion.LookRotation(Vector3.down); + light.Range = 50f; + light.SpotAngle = 120; + light.Intensity = 8; + + + + Quaternion otherBranch = rot * Quaternion.Euler(0, -90f, 0); + + float lengthbranch = (15f / 2f) - (6f / 2f); + + + return new HashSet() + { + Primitive.Create(PrimitiveType.Cube,position, rot.eulerAngles, new Vector3(15f,1,6f), false), + Primitive.Create(PrimitiveType.Cube,position + rot*Vector3.forward*lengthbranch, otherBranch.eulerAngles , new Vector3(lengthbranch,1,6f), false,Color.blue), + light, + }; + } + } +} diff --git a/KruacentExiled/KE.Map/CustomZones/CustomZone.cs b/KruacentExiled/KE.Map/CustomZones/CustomZone.cs new file mode 100644 index 00000000..5fb7bb77 --- /dev/null +++ b/KruacentExiled/KE.Map/CustomZones/CustomZone.cs @@ -0,0 +1,28 @@ +using Exiled.API.Extensions; +using LabApi.Features.Wrappers; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using UnityEngine; + +namespace KE.Map.CustomZones +{ + public abstract class CustomZone + { + public abstract CustomFacilityZone FacilityZone { get; } + public Layout Layout { get; private set; } + public abstract Vector3 Spawnzone { get; } + public abstract void Generate(System.Random rng); + + protected Layout SetRandomLayout() + { + Layout layout =Layout.Layouts.GetRandomValue(); + Layout = layout; + return layout; + + } + + } +} diff --git a/KruacentExiled/KE.Map/CustomZones/Layout.cs b/KruacentExiled/KE.Map/CustomZones/Layout.cs new file mode 100644 index 00000000..4d17b888 --- /dev/null +++ b/KruacentExiled/KE.Map/CustomZones/Layout.cs @@ -0,0 +1,25 @@ +using MapGeneration; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using UnityEngine; +using static KE.Map.CustomZones.AltasReader; + +namespace KE.Map.CustomZones +{ + public struct Layout + { + public static HashSet Layouts = new(); + public readonly Dictionary coordtoroom = new(); + public Layout(Dictionary coordtoroom) + { + this.coordtoroom = new Dictionary(coordtoroom); + Layouts.Add(this); + } + + + } + +} diff --git a/KruacentExiled/KE.Map/CustomZones/MediumContainmentZone.cs b/KruacentExiled/KE.Map/CustomZones/MediumContainmentZone.cs new file mode 100644 index 00000000..df6528c4 --- /dev/null +++ b/KruacentExiled/KE.Map/CustomZones/MediumContainmentZone.cs @@ -0,0 +1,66 @@ +using Exiled.API.Extensions; +using Exiled.API.Features; +using Interactables.Interobjects.DoorButtons; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using UnityEngine; +using Random = System.Random; + +namespace KE.Map.CustomZones +{ + public class MediumContainmentZone : CustomZone + { + public override CustomFacilityZone FacilityZone => CustomFacilityZone.MediumContainment; + + public override Vector3 Spawnzone { get; } + + private GameObject gameObject; + public MediumContainmentZone() + { + Spawnzone = Room.List.Where(r => r.Type == Exiled.API.Enums.RoomType.HczEzCheckpointB).First().Position + new Vector3(0,0,-200); + gameObject = new GameObject("MCZ"); + + } + + + public override void Generate(Random rng) + { + SetRandomLayout(); + + if(CustomRoom.RegisteredRoom.Count == 0) + { + throw new ArgumentNullException("no round found"); + } + + IEnumerable rooms = CustomRoom.RegisteredRoom.Where(r => r.FacilityZone == FacilityZone); + + foreach(var kvp in Layout.coordtoroom) + { + CustomRoom room = rooms.GetRandomValue(c => c.Shape == kvp.Value.RoomShape); + + if(room is null) + { + throw new Exception($"couldn't find a room for {FacilityZone} with shape {kvp.Value}"); + } + + Vector3 rotation = kvp.Value.Rotation; + + Vector2Int coord = kvp.Key/3; + + + room.Spawn(coord, rotation, Spawnzone); + } + + + + + + } + + + + } +} diff --git a/KruacentExiled/KE.Map/CustomZones/SpawnedCustomRoom.cs b/KruacentExiled/KE.Map/CustomZones/SpawnedCustomRoom.cs new file mode 100644 index 00000000..a0685f51 --- /dev/null +++ b/KruacentExiled/KE.Map/CustomZones/SpawnedCustomRoom.cs @@ -0,0 +1,61 @@ +using Exiled.API.Features.Toys; +using MapGeneration; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using UnityEngine; + +namespace KE.Map.CustomZones +{ + public class SpawnedCustomRoom + { + public SpawnedCustomRoom(CustomRoom baseRoom, RoomShape shape, Vector3 position, Vector3 rotation, Vector2Int coord, HashSet primitives) + { + BaseRoom = baseRoom; + Shape = shape; + Position = position; + Coord = coord; + Primitives = [.. primitives]; + GameObject = new GameObject(); + } + + + public GameObject GameObject { get; } + public CustomRoom BaseRoom { get; } + public RoomShape Shape { get; } + + public Vector3 Position { get; } + public Vector3 Rotation { get; } + + public Vector2Int Coord { get; } + + public HashSet Primitives { get; } + + public void Spawn() + { + foreach(AdminToy adminToy in Primitives) + { + adminToy.Spawn(); + } + } + + public void Unspawn() + { + foreach (AdminToy adminToy in Primitives) + { + adminToy.UnSpawn(); + } + } + + public void Destroy() + { + foreach (AdminToy adminToy in Primitives.ToList()) + { + adminToy.Destroy(); + } + } + + } +} diff --git a/KruacentExiled/KE.Map/KE.Map.csproj b/KruacentExiled/KE.Map/KE.Map.csproj index cc735c6b..375783dc 100644 --- a/KruacentExiled/KE.Map/KE.Map.csproj +++ b/KruacentExiled/KE.Map/KE.Map.csproj @@ -6,7 +6,7 @@ - + diff --git a/KruacentExiled/KE.Map/MainPlugin.cs b/KruacentExiled/KE.Map/MainPlugin.cs index 47e24bde..59b5a978 100644 --- a/KruacentExiled/KE.Map/MainPlugin.cs +++ b/KruacentExiled/KE.Map/MainPlugin.cs @@ -1,9 +1,15 @@  using Exiled.API.Extensions; using Exiled.API.Features; +using Exiled.API.Features.Doors; +using Exiled.API.Features.Toys; using Exiled.API.Interfaces; +using Exiled.Events.EventArgs.Player; using Exiled.Events.EventArgs.Server; +using Exiled.Events.Handlers; using Interactables.Interobjects.DoorUtils; +using KE.Map.CustomZones; +using KE.Map.CustomZones.CustomRooms.MCZ; using KE.Map.Entrance; using KE.Map.Heavy.GamblingZone; using KE.Map.Others.BlackoutNDoor.Handlers; @@ -11,8 +17,12 @@ using KE.Utils.API.Models; using LabApi.Events.Arguments.ServerEvents; using LabApi.Features.Wrappers; +using MapGeneration; +using Mirror; using PlayerRoles; +using PlayerRoles.PlayableScps.Scp106; using ProjectMER.Features.Serializable.Lockers; +using System; using System.Collections.Generic; using System.Linq; using UnityEngine; @@ -39,42 +49,97 @@ public override void OnEnabled() KE.Utils.API.Sounds.SoundPlayer.Instance.TryLoad(); Exiled.Events.Handlers.Map.Generated += OnGenerated; Exiled.Events.Handlers.Server.RoundStarted += OnRoundStarted; + LabApi.Events.Handlers.ServerEvents.MapGenerating += OnGenerating; + Exiled.Events.Handlers.Player.InteractingDoor += OpenDoor; + GamblingRoom.SubscribeEvents(); //MoreRoom.CreateAll(); //MoreRoom.SubscribeEvents(); + + + + + + Instance = this; + base.OnEnabled(); } private void OnRoundStarted() { - //Player player = Player.List.First(); + Player player = Player.List.First(); //StructureSpawner.SpawnPedestal(ItemType.KeycardJanitor,player.Position,Quaternion.identity,Vector3.one); //player.Teleport(Room.List.Where(r => r.Type == Exiled.API.Enums.RoomType.EzVent).First()); - + player.Teleport(teleport); } + public override void OnDisabled() { //handler.UnsubscribeEvents(); Exiled.Events.Handlers.Map.Generated -= OnGenerated; Exiled.Events.Handlers.Server.RoundStarted -= OnRoundStarted; + LabApi.Events.Handlers.ServerEvents.MapGenerating -= OnGenerating; + Exiled.Events.Handlers.Player.InteractingDoor -= OpenDoor; + GamblingRoom.UnsubscribeEvents(); //MoreRoom.UnsubscribeEvents(); handler = null; Instance = null; } + private int seed; + private Vector3 teleport; + private void OnGenerating(MapGeneratingEventArgs ev) + { + seed = ev.Seed; + + } + + private void CustomZone() + { + Log.Debug("read"); + try + { + + AltasReader.Read(); + } + catch (Exception e) + { + Log.Error(e); + } + + + CustomZone zone = new MediumContainmentZone(); + //teleport = zone.Spawnzone; + new SCorridor(); + new EndRoom(); + new TCorridor(); + + zone.Generate(new System.Random(seed)); + + teleport = CustomRoom.RegisteredRoom.First().SpawnedRoom.First(s => s.Shape == RoomShape.Straight).Position + Vector3.up*5; + Log.Debug("teleport " + teleport); + } + private void OpenDoor(InteractingDoorEventArgs ev) + { + if(ev.Door.Zone == Exiled.API.Enums.ZoneType.HeavyContainment) + { + ev.Player.Teleport(teleport); + } + } private void OnGenerated() { - Door lcz173 = Door.Get(Exiled.API.Enums.DoorType.Scp173Gate); + CustomZone(); + /*Door lcz173 = Door.Get(Exiled.API.Enums.DoorType.Scp173Gate); HashSet normal = new() { new(ItemType.KeycardO5,1,2), @@ -111,10 +176,10 @@ private void OnGenerated() var g = new GamblingRoom(RoleTypeId.Scp173.GetRandomSpawnLocation().Position + Vector3.down, new(normal)); - + */ - + //var g = new GamblingRoom(lcz173, new(normal), -lcz173.Transform.forward * 5f); /* diff --git a/KruacentExiled/KE.Map/Utils/StructureSpawner.cs b/KruacentExiled/KE.Map/Utils/StructureSpawner.cs index fb720f9d..44138e6a 100644 --- a/KruacentExiled/KE.Map/Utils/StructureSpawner.cs +++ b/KruacentExiled/KE.Map/Utils/StructureSpawner.cs @@ -1,28 +1,13 @@ - -using Exiled.API.Features; -using Interactables; -using Interactables.Interobjects.DoorUtils; +using Interactables.Interobjects.DoorUtils; using InventorySystem.Items.Firearms.Attachments; -using LabApi.Features.Wrappers; using MapGeneration; using MapGeneration.Distributors; -using MEC; using Mirror; -using ProjectMER.Commands.Modifying.Position; -using ProjectMER.Commands.Modifying.Rotation; -using ProjectMER.Commands.Modifying.Scale; using ProjectMER.Features; using ProjectMER.Features.Enums; -using ProjectMER.Features.Serializable.Lockers; using System; using System.Collections.Generic; -using System.Linq; -using System.Reflection; -using System.Text; -using System.Threading.Tasks; using UnityEngine; -using static PlayerList; -using static PlayerRoles.FirstPersonControl.Thirdperson.Subcontrollers.FeetStabilizerSubcontroller; namespace KE.Map.Utils { @@ -151,5 +136,33 @@ public static WorkstationController SpawnWorkshop(Vector3 position, Quaternion r NetworkServer.Spawn(workstationController.gameObject); return workstationController; } + + + + + + + + [Obsolete("one day it'll work",true)] + public static BreakableWindow CreateWindow(Vector3 position, Quaternion rotation) + { + BreakableWindow br = null; + foreach (GameObject gameObject in NetworkClient.prefabs.Values) + { + if (gameObject.TryGetComponent(out var window)) + { + br = UnityEngine.Object.Instantiate(window); + } + } + + br.transform.SetPositionAndRotation(position, rotation); + br.transform.localScale = Vector3.one; + br.NetworkIsBroken = false; + + NetworkServer.UnSpawn(br.gameObject); + NetworkServer.Spawn(br.gameObject); + return br; + } + } } From 205cbdca21763ab650f8111d8bd3622e3d068c79 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Sat, 1 Nov 2025 20:17:36 +0100 Subject: [PATCH 396/853] removed the ids and the keybinds for ability --- .../KE.CustomRoles/API/Features/CustomSCP.cs | 6 +- .../API/Features/GlobalCustomRole.cs | 103 ++---- .../API/Features/KEAbilities.cs | 149 ++------- .../API/Features/KECustomRole.cs | 307 ++++++++++++++---- .../KE.CustomRoles/Abilities/Airstrike.cs | 15 +- .../KE.CustomRoles/Abilities/Convert.cs | 6 +- .../KE.CustomRoles/Abilities/Explode.cs | 2 - .../KE.CustomRoles/Abilities/Fireball.cs | 2 - .../KE.CustomRoles/Abilities/ForceOpen.cs | 4 +- .../{SelectPosition.cs => SetPosition.cs} | 4 +- .../KE.CustomRoles/Abilities/SimulateDeath.cs | 1 - .../{Teleport.cs => Teleportation.cs} | 25 +- .../KE.CustomRoles/Abilities/Thief.cs | 6 +- .../KE.CustomRoles/Abilities/Trade.cs | 1 - .../CR/ChaosInsurgency/LeRusse.cs | 7 +- .../CR/ChaosInsurgency/Negotiator.cs | 10 +- .../KE.CustomRoles/CR/ClassD/DBoyInShape.cs | 6 +- .../KE.CustomRoles/CR/ClassD/Enfant.cs | 19 +- .../KE.CustomRoles/CR/ClassD/Mime.cs | 6 +- .../KE.CustomRoles/CR/Guard/ChiefGuard.cs | 2 +- .../KE.CustomRoles/CR/Guard/Guard914.cs | 2 +- .../KE.CustomRoles/CR/Guard/Introvert.cs | 3 +- .../KE.CustomRoles/CR/Human/Alzheimer.cs | 2 +- .../KE.CustomRoles/CR/Human/Asthmatique.cs | 1 - .../KE.CustomRoles/CR/Human/Cleptoman.cs | 5 +- .../KE.CustomRoles/CR/Human/Crazy.cs | 1 - .../KE.CustomRoles/CR/Human/Diabetique.cs | 1 - .../KE.CustomRoles/CR/Human/Enderman.cs | 7 +- .../KE.CustomRoles/CR/Human/Hitman.cs | 4 +- .../KE.CustomRoles/CR/Human/Maladroit.cs | 3 +- .../KE.CustomRoles/CR/Human/scp202.cs | 3 +- KruacentExiled/KE.CustomRoles/CR/MTF/Pilot.cs | 7 +- KruacentExiled/KE.CustomRoles/CR/MTF/Tank.cs | 3 +- .../KE.CustomRoles/CR/MTF/Terroriste.cs | 5 +- KruacentExiled/KE.CustomRoles/CR/SCP/Paper.cs | 1 - .../KE.CustomRoles/CR/SCP/SCP457.cs | 5 +- KruacentExiled/KE.CustomRoles/CR/SCP/Small.cs | 1 - KruacentExiled/KE.CustomRoles/CR/SCP/Tall.cs | 35 -- KruacentExiled/KE.CustomRoles/CR/SCP/Ultra.cs | 7 +- .../CR/Scientist/GambleAddict.cs | 5 +- .../CR/Scientist/ZoneManager.cs | 15 +- .../KE.CustomRoles/Commands/Give.cs | 98 ++++++ .../Commands/KEParentCommand.cs | 37 +++ .../Commands/Lists/Abilities.cs | 43 +++ .../KE.CustomRoles/Commands/Lists/List.cs | 40 +++ .../Commands/Lists/Registered.cs | 48 +++ KruacentExiled/KE.CustomRoles/MainPlugin.cs | 9 +- .../KE.CustomRoles/Settings/SettingHandler.cs | 61 ++-- 48 files changed, 672 insertions(+), 461 deletions(-) rename KruacentExiled/KE.CustomRoles/Abilities/{SelectPosition.cs => SetPosition.cs} (92%) rename KruacentExiled/KE.CustomRoles/Abilities/{Teleport.cs => Teleportation.cs} (71%) delete mode 100644 KruacentExiled/KE.CustomRoles/CR/SCP/Tall.cs create mode 100644 KruacentExiled/KE.CustomRoles/Commands/Give.cs create mode 100644 KruacentExiled/KE.CustomRoles/Commands/KEParentCommand.cs create mode 100644 KruacentExiled/KE.CustomRoles/Commands/Lists/Abilities.cs create mode 100644 KruacentExiled/KE.CustomRoles/Commands/Lists/List.cs create mode 100644 KruacentExiled/KE.CustomRoles/Commands/Lists/Registered.cs diff --git a/KruacentExiled/KE.CustomRoles/API/Features/CustomSCP.cs b/KruacentExiled/KE.CustomRoles/API/Features/CustomSCP.cs index 2a45d731..43b7d3e3 100644 --- a/KruacentExiled/KE.CustomRoles/API/Features/CustomSCP.cs +++ b/KruacentExiled/KE.CustomRoles/API/Features/CustomSCP.cs @@ -15,8 +15,7 @@ public abstract class CustomSCP : KECustomRole public const int DefaultValue = 0; public static int ScpPreferenceHeaderId => MainPlugin.Instance.Config.ScpPreferenceHeaderId; - private static HeaderSetting header; - private static bool headerflag = false; + private static HeaderSetting header = null; private SliderSetting sliderSetting; public abstract bool IsSupport { get; } public int SettingId => (int)Id; @@ -24,10 +23,9 @@ public abstract class CustomSCP : KECustomRole public static IEnumerable All => Registered.Where(c => c is CustomSCP).Cast(); public override void Init() { - if (!headerflag) + if (header is null) { header = new HeaderSetting(ScpPreferenceHeaderId, "SCP Spawn Preferences"); - headerflag = true; } diff --git a/KruacentExiled/KE.CustomRoles/API/Features/GlobalCustomRole.cs b/KruacentExiled/KE.CustomRoles/API/Features/GlobalCustomRole.cs index 64cdf9df..f94c4e6b 100644 --- a/KruacentExiled/KE.CustomRoles/API/Features/GlobalCustomRole.cs +++ b/KruacentExiled/KE.CustomRoles/API/Features/GlobalCustomRole.cs @@ -28,7 +28,13 @@ public abstract class GlobalCustomRole : KECustomRole public override bool KeepInventoryOnSpawn { get; set; } = true; public override bool RemovalKillsPlayer => false; - + public override string Name + { + get + { + return Side.ToString().ToUpper() + "_" + InternalName.RemoveSpaces(); + } + } public override void AddRole(Player player) { @@ -39,93 +45,15 @@ public override void AddRole(Player player) Log.Error($"tried to give a global custom role to a player in the wrong side ({side} instead of {Side})"); return; } - Log.Debug($"{Name}: Adding role to {player.Nickname}."); - TrackedPlayers.Add(player); - - - - Timing.CallDelayed( - 0.25f, - () => - { - if (!KeepInventoryOnSpawn) - { - Log.Debug($"{Name}: Clearing {player.Nickname}'s inventory."); - player.ClearInventory(); - } - - foreach (string itemName in Inventory) - { - Log.Debug($"{Name}: Adding {itemName} to inventory."); - TryAddItem(player, itemName); - } - - if (Ammo.Count > 0) - { - Log.Debug($"{Name}: Adding Ammo to {player.Nickname} inventory."); - foreach (AmmoType type in EnumUtils.Values) - { - if (type != AmmoType.None) - player.SetAmmo(type, Ammo.ContainsKey(type) ? Ammo[type] == ushort.MaxValue ? InventoryLimits.GetAmmoLimit(type.GetItemType(), player.ReferenceHub) : Ammo[type] : (ushort)0); - } - } - }); - - Log.Debug($"{Name}: Setting health values."); - player.MaxHealth *= MaxHealthMultiplicator; - player.Health = player.MaxHealth; - player.Scale = Scale; - - Vector3 position = GetSpawnPosition(); - if (position != Vector3.zero) - { - player.Position = position; - } - - Log.Debug($"{Name}: Setting player info"); - - player.CustomInfo = $"{player.CustomName}\n{CustomInfo}"; - player.InfoArea &= ~(PlayerInfoArea.Role | PlayerInfoArea.Nickname); - - KEAbilities.TryRemoveFromPlayer(player); - if (Abilities != null) - { - foreach (int abilityId in Abilities) - { - KEAbilities.TryAddToPlayer(abilityId, player); - } - } - ShowMessage(player); - RoleAdded(player); - player.UniqueRole = Name; + base.AddRole(player); } - public override void RemoveRole(Player player) - { - - - if (!TrackedPlayers.Contains(player)) - { - return; - } - - Log.Debug(Name + ": Removing role from " + player.Nickname + $"({player.Id})"); - TrackedPlayers.Remove(player); - player.CustomInfo = string.Empty; - player.InfoArea |= PlayerInfoArea.Nickname | PlayerInfoArea.Role; - player.Scale = Vector3.one; - KEAbilities.TryRemoveFromPlayer(player); - - RoleRemoved(player); - player.UniqueRole = string.Empty; - player.TryRemoveCustomeRoleFriendlyFire(Name); - if (RemovalKillsPlayer) - { - //player.Role.Set(RoleTypeId.Spectator); - } - Log.Debug(Name + ": finish Removing role from " + player.Nickname + $"({player.Id})"); + protected override void AttributeHealth(Player player) + { + player.MaxHealth *= MaxHealthMultiplicator; + player.Health = player.MaxHealth; } @@ -173,6 +101,13 @@ protected override void ShowMessage(Player player) DisplayHandler.Instance.AddHint(MainPlugin.CRHint, player, sb.ToString(), delay); StringBuilderPool.Pool.Return(sb); } + + + + public override bool IsAvailable(Player player) + { + return SideClass.Get(player.Role.Side) == Side; + } } public enum SideEnum diff --git a/KruacentExiled/KE.CustomRoles/API/Features/KEAbilities.cs b/KruacentExiled/KE.CustomRoles/API/Features/KEAbilities.cs index 162ba002..ee5bcd72 100644 --- a/KruacentExiled/KE.CustomRoles/API/Features/KEAbilities.cs +++ b/KruacentExiled/KE.CustomRoles/API/Features/KEAbilities.cs @@ -1,21 +1,14 @@ using Exiled.API.Features; -using Exiled.API.Features.Core.UserSettings; using Exiled.API.Features.Pools; -using Exiled.CustomRoles.API.Features; -using Exiled.Events.EventArgs.Player; using KE.CustomRoles.Settings; using KE.Utils.API; using KE.Utils.API.Displays.DisplayMeow; using MEC; -using PlayerRoles.Subroutines; using System; using System.Collections.Generic; using System.Linq; using System.Reflection; using System.Text; -using UserSettings.ServerSpecific; -using UserSettings.UserInterfaceSettings; -using static PlayerList; namespace KE.CustomRoles.API.Features { @@ -33,41 +26,16 @@ public abstract class KEAbilities public abstract string Name { get; } public abstract string PublicName { get; } public abstract string Description { get; } - /// - /// Used for the settings option - /// - public abstract int Id { get; } + /// /// in seconds /// public abstract float Cooldown { get; } #endregion - public HashSet GetRoles - { - get - { - HashSet result = new(); - foreach (KECustomRole cr in KECustomRole.KnownKECR) - { - foreach(int abilityId in cr.Abilities) - { - KEAbilities ability = Get(abilityId); - if (ability == this) - { - result.Add(cr); - } - } - } - return result; - } - } private Dictionary LastUsed = new(); private static Dictionary TypeToAbility { get; } = new(); - private static Dictionary IdToAbility { get; } = new(); - private static HeaderSetting header; - private static bool flagHeader = false; - private SettingBase setting; + private static Dictionary NameToAbility { get; } = new(); public HashSet Players { get; } = new HashSet(); public HashSet Selected { get; } = new(); @@ -81,93 +49,38 @@ protected KEAbilities() } public void Init() { - if (IdToAbility.ContainsKey(Id)) + if (NameToAbility.ContainsKey(Name)) { - Log.Warn($"{Name} ({Id}) have the same id as {IdToAbility[Id].Name}. Skipping..."); + KEAbilities other = NameToAbility[Name]; + Log.Warn($"{GetType().FullName} have the same name as {other.GetType().FullName}. Skipping..."); return; } - - - SettingBase old = SettingBase.List.Where(s => s.Id == Id).FirstOrDefault(); - - if(old == null) - { - if (!flagHeader) - { - header = new(MainPlugin.Configs.HeaderId, "Abilities"); - SettingBase.Register([header]); - flagHeader = true; - } - Log.Debug("creating keybind"); - setting = new KeybindSetting(Id, Name, UnityEngine.KeyCode.None,hintDescription:Description); - SettingBase.Register([setting]); - } - else - { - Log.Error($"setting of {this} have the same id as {old.Label}"); - } StartLoop(); - IdToAbility.Add(Id, this); TypeToAbility.Add(GetType(), this); + NameToAbility.Add(Name, this); InternalSubscribeEvent(); } public void Destroy() { - Func p = null; - SettingBase.Unregister(p, [setting]); InternalUnsubcribeEvent(); } private void InternalSubscribeEvent() { - ServerSpecificSettingsSync.ServerOnSettingValueReceived += SafeOnSettingValueReceived; - Exiled.Events.Handlers.Player.Verified += OnVerified; SubscribeEvents(); } private void InternalUnsubcribeEvent() { - ServerSpecificSettingsSync.ServerOnSettingValueReceived -= SafeOnSettingValueReceived; - Exiled.Events.Handlers.Player.Verified -= OnVerified; UnsubscribeEvents(); } - private void SafeOnSettingValueReceived(ReferenceHub hub, ServerSpecificSettingBase settingBase) - { - //not catching the exception will desync & kick the player - try - { - OnSettingValueReceived(Player.Get(hub), settingBase); - } - catch (Exception e) - { - Log.Error(e); - } - } - - private void OnSettingValueReceived(Player player, ServerSpecificSettingBase settingBase) - { - if (!CheckPressed(settingBase)) return; - if (!Check(player)) return; - - if (!SettingHandler.Instance.GetMode(player)) return; - - - if(CanUse(player,out string _)) - { - UseAbility(player); - } - } - private void OnVerified(VerifiedEventArgs ev) - { - ServerSpecificSettingsSync.SendToPlayer(ev.Player.ReferenceHub); - } protected virtual void SubscribeEvents() { @@ -197,10 +110,17 @@ public void ShowAbility(Player player) { float time = MainPlugin.SettingHandler.GetAbilityTime(player); - string msg = $"{PublicName}\n{Description}"; + StringBuilder sb = StringBuilderPool.Pool.Get(); + sb.Append(""); + sb.Append(PublicName); + sb.Append(""); + sb.AppendLine(); + sb.Append(Description); - DisplayHandler.Instance.AddHint(MainPlugin.AbilitiesDesc, player, msg, time); + + DisplayHandler.Instance.AddHint(MainPlugin.AbilitiesDesc, player, sb.ToString(), time); + StringBuilderPool.Pool.Return(sb); } public void SelectAbility(Player player) @@ -297,10 +217,7 @@ public bool CanUse(Player player, out string result) return false; } - public bool CheckPressed(ServerSpecificSettingBase settingBase) - { - return CheckPressed(settingBase, setting.Id); - } + public static void UseSelected(Player player) { @@ -320,18 +237,14 @@ public static bool TryAddToPlayer(Type typeAbility,Player player) ability.AddAbility(player); return true; - - - } - public static bool TryAddToPlayer(int abilityId,Player player) + } + public static bool TryAddToPlayer(string name, Player player) { - if (!IdToAbility.TryGetValue(abilityId, out var ability)) return false; - + if (!TryGet(name,out var ability)) return false; + ability.AddAbility(player); return true; - - } public static void RemoveAllSelect(Player player) @@ -369,10 +282,7 @@ public static void TryRemoveFromPlayer(Player player) } - public static bool CheckPressed(ServerSpecificSettingBase settingBase, int id) - { - return settingBase is SSKeybindSetting keybindSetting && keybindSetting.SettingId == id && keybindSetting.SyncIsPressed; - } + #region register private bool TryRegister() @@ -441,11 +351,11 @@ public static IEnumerable Unregister() #region getters - public static KEAbilities Get(int id) + public static KEAbilities Get(string name) { foreach(KEAbilities kEAbilities in Registered) { - if (id == kEAbilities.Id) + if (name == kEAbilities.Name) { return kEAbilities; } @@ -454,9 +364,9 @@ public static KEAbilities Get(int id) return null; } - public static bool TryGet(int id, out KEAbilities ability) + public static bool TryGet(string name, out KEAbilities ability) { - ability = Get(id); + ability = Get(name); return ability != null; } @@ -479,12 +389,15 @@ public static bool TryGetSelected(Player player, out KEAbilities ability) } + + #endregion #region gui public const float UpdateTime = 1; + public const string ReadyText = "[READY]"; private static bool flag = false; private static void StartLoop() { @@ -527,7 +440,7 @@ public static void UpdateGUI(Player player) if (ability.CanUse(player,out var output)) { - builder.Append("[READY]"); + builder.Append(ReadyText); } else { @@ -541,12 +454,10 @@ public static void UpdateGUI(Player player) if (ability.Selected.Contains(player)) { string arrow = SettingHandler.Instance.GetArrow(player); - if (string.IsNullOrEmpty(arrow)) { arrow = SettingHandler.baseArrow; } - builder.Append(arrow); } builder.AppendLine(); @@ -562,7 +473,7 @@ public static void UpdateGUI(Player player) public override string ToString() { - return "("+Id + ") " +Name; + return Name; } } diff --git a/KruacentExiled/KE.CustomRoles/API/Features/KECustomRole.cs b/KruacentExiled/KE.CustomRoles/API/Features/KECustomRole.cs index 02c71d30..e02fc192 100644 --- a/KruacentExiled/KE.CustomRoles/API/Features/KECustomRole.cs +++ b/KruacentExiled/KE.CustomRoles/API/Features/KECustomRole.cs @@ -4,6 +4,7 @@ using Exiled.API.Features.Items; using Exiled.API.Features.Pools; using Exiled.CustomItems.API.Features; +using Exiled.CustomRoles; using Exiled.CustomRoles.API; using Exiled.CustomRoles.API.Features; using InventorySystem.Configs; @@ -11,8 +12,11 @@ using KE.Utils.API.Displays.DisplayMeow; using MEC; using PlayerRoles; +using System; using System.Collections.Generic; using System.Linq; +using System.Net.Sockets; +using System.Reflection; using System.Text; using UnityEngine; @@ -20,28 +24,38 @@ namespace KE.CustomRoles.API.Features { public abstract class KECustomRole : CustomRole { - + public const float TimeAttributingInventory = .25f; + public sealed override uint Id { get; set; } = 0; public override string Name { get { - return GetType().Name; + return Role.ToString().ToUpper() + "_" + InternalName.RemoveSpaces(); } set { - + } } + public virtual string InternalName => GetType().Name; - public static IEnumerable KnownKECR => Registered.Where(c => c is KECustomRole).Cast(); + public static new HashSet Registered { get; } = new(); public sealed override string CustomInfo { get; set; } + /// + /// Get or set the public name shown to other players + /// public abstract string PublicName { get; set; } - public virtual HashSet Abilities { get; } + + /// + /// + /// + public virtual HashSet Abilities { get; } public sealed override bool IgnoreSpawnSystem { get; set; } = true; + public sealed override List CustomAbilities { get; set; } = null; protected override void ShowMessage(Player player) { //string msg = MainPlugin.Translations.GettingNewRole; @@ -62,10 +76,6 @@ protected override void ShowMessage(Player player) { sb.Append(""); } - - - - sb.AppendLine(""); if (MainPlugin.SettingHandler.GetDescriptionsSettings(player)) @@ -80,15 +90,37 @@ protected override void ShowMessage(Player player) StringBuilderPool.Pool.Return(sb); } - + + private static Dictionary typeLookupTable = new(); + private static Dictionary stringLookupTable = new(); + + public override void Init() + { + typeLookupTable.Add(GetType(), this); + stringLookupTable.Add(Name, this); + SubscribeEvents(); + } + + public override void Destroy() + { + typeLookupTable.Remove(GetType()); + stringLookupTable.Remove(Name); + UnsubscribeEvents(); + } + + protected void ShowEffectHint(Player player, string text) { float delay = MainPlugin.SettingHandler.GetTime(player); ; DisplayHandler.Instance.AddHint(MainPlugin.CREffect, player, text, delay); } + protected void ShowEffectHint(Player player, string text, float delay) + { + DisplayHandler.Instance.AddHint(MainPlugin.CREffect, player, text, delay); + } - + #region addrole public override void AddRole(Player player) { Player player2 = player; @@ -110,100 +142,182 @@ public override void AddRole(Player player) } else if (KeepInventoryOnSpawn && player2.IsAlive) { - player2.Role.Set(Role, SpawnReason.ForceClass, RoleSpawnFlags.None); + player2.Role.Set(Role, SpawnReason.ForceClass, RoleSpawnFlags.UseSpawnpoint); } else { player2.Role.Set(Role, SpawnReason.ForceClass, RoleSpawnFlags.AssignInventory); } } - TrackedPlayers.Add(player2); + - Timing.CallDelayed(0.25f, delegate + + TrackedPlayers.Add(player2); + + Timing.CallDelayed(TimeAttributingInventory, delegate { if (!KeepInventoryOnSpawn) { player2.ClearInventory(); } + GiveInventory(player2); + GiveAmmo(player2); + }); + + + AttributeHealth(player2); + AttributeScale(player2); + + SetCustomInfo(player2); + + SetAbilities(player2); + - for (int i = 0; i < Inventory.Count;i++) + ShowMessage(player2); + RoleAdded(player2); + player2.UniqueRole = Name; + player2.TryAddCustomRoleFriendlyFire(Name, CustomRoleFFMultiplier); + } + + + protected virtual void GiveInventory(Player player) + { + + for (int i = 0; i < Inventory.Count; i++) + { + string item = Inventory[i]; + Log.Debug(Name + ": Adding " + item + " to inventory."); + if (TryAddItem(player, item) && CustomItem.TryGet(item, out CustomItem customItem) && customItem is CustomWeapon customWeapon && player.CurrentItem is Firearm firearm && !customWeapon.Attachments.IsEmpty()) { - string item = Inventory[i]; - Log.Debug(Name + ": Adding " + item + " to inventory."); - if (TryAddItem(player2, item) && CustomItem.TryGet(item, out CustomItem customItem) && customItem is CustomWeapon customWeapon && player2.CurrentItem is Firearm firearm && !customWeapon.Attachments.IsEmpty()) - { - firearm.AddAttachment(customWeapon.Attachments); - Log.Debug(Name + ": Applied attachments to " + item + "."); - } + firearm.AddAttachment(customWeapon.Attachments); + Log.Debug(Name + ": Applied attachments to " + item + "."); } + } + } - if (Ammo.Count > 0) + protected virtual void GiveAmmo(Player player) + { + if (Ammo.Count > 0) + { + AmmoType[] values = EnumUtils.Values; + foreach (AmmoType ammoType in values) { - AmmoType[] values = EnumUtils.Values; - foreach (AmmoType ammoType in values) + if (ammoType != 0) { - if (ammoType != 0) - { - player2.SetAmmo(ammoType, (ushort)(Ammo.ContainsKey(ammoType) ? Ammo[ammoType] == ushort.MaxValue ? InventoryLimits.GetAmmoLimit(ammoType.GetItemType(), player2.ReferenceHub) : Ammo[ammoType] : 0)); - } + player.SetAmmo(ammoType, (ushort)(Ammo.ContainsKey(ammoType) ? Ammo[ammoType] == ushort.MaxValue ? InventoryLimits.GetAmmoLimit(ammoType.GetItemType(), player.ReferenceHub) : Ammo[ammoType] : 0)); } } - }); - player2.Health = MaxHealth; - player2.MaxHealth = MaxHealth; - player2.Scale = Scale; + } + } + + protected virtual void AttributeHealth(Player player) + { + player.Health = MaxHealth; + player.MaxHealth = MaxHealth; + } + + protected virtual void AttributeScale(Player player) + { + player.Scale = Scale; + } + + protected virtual void SetSpawn(Player player) + { Vector3 spawnPosition = GetSpawnPosition(); if (spawnPosition != Vector3.zero) { - player2.Position = spawnPosition; + player.Position = spawnPosition; } + } - player2.CustomInfo = player2.CustomName + "\n" + PublicName; - player2.InfoArea &= ~(PlayerInfoArea.Nickname | PlayerInfoArea.Role); - if (CustomAbilities != null) - { - foreach (CustomAbility customAbility in CustomAbilities) - { - customAbility.AddAbility(player2); - } - } + protected virtual void SetCustomInfo(Player player) + { + player.CustomInfo = player.CustomName + "\n" + PublicName; + player.InfoArea &= ~(PlayerInfoArea.Nickname | PlayerInfoArea.Role); + } + protected virtual void SetAbilities(Player player) + { KEAbilities.TryRemoveFromPlayer(player); - if(Abilities != null) + if (Abilities != null) { - foreach(int abilityId in Abilities) + foreach (string name in Abilities) { - KEAbilities.TryAddToPlayer(abilityId, player2); + if(!KEAbilities.TryAddToPlayer(name, player)) + { + Log.Error("couldn't find ability :" + name); + } + } - KEAbilities.SelectFirstAbility(player2); + KEAbilities.SelectFirstAbility(player); } + } - ShowMessage(player2); - RoleAdded(player2); - player2.UniqueRole = Name; - player2.TryAddCustomRoleFriendlyFire(Name, CustomRoleFFMultiplier); - } +#endregion + public override void RemoveRole(Player player) { + base.RemoveRole(player); if (Abilities != null) { KEAbilities.TryRemoveFromPlayer(player); } - base.RemoveRole(player); + } + + + public virtual bool IsAvailable(Player player) + { + return player.Role == Role; } /// - /// The chance of having this role NOT the chance to have a role + /// The chance of having this role, NOT the chance to have a role /// - public override abstract float SpawnChance { get; set; } + public new virtual float SpawnChance { get; set; } = 100; + + public static new KECustomRole Get(string fullinternalname) + { + return stringLookupTable[fullinternalname]; + } + public static bool TryGet(string fullinternalname,out KECustomRole customrole) + { + customrole = Get(fullinternalname); + return customrole != null; + } + + public static KECustomRole Get(RoleTypeId roleid,string name) + { + return Get(roleid.ToString().ToUpper() + "_" + name); + } + public static bool Get(RoleTypeId roleid, string name, out KECustomRole customrole) + { + customrole = Get(roleid, name); + return customrole != null; + } + + + public static bool HasCustomRole(Player player) + { + if (player is null) return false; + foreach(KECustomRole customRole in Registered) + { + if (customRole.Check(player)) + { + return true; + } + } + return false; + + } + #region Spawn /// @@ -223,7 +337,7 @@ public static int Chance private static int chance = 40; - private static CustomRole AssignRole(Dictionary roleChances) + private static KECustomRole AssignRole(Dictionary roleChances) { float totalWeight = roleChances.Values.Sum(); float randomValue = UnityEngine.Random.Range(0f, totalWeight); @@ -238,36 +352,35 @@ private static CustomRole AssignRole(Dictionary roleChances) return roleChances.Keys.First(); } - public static Dictionary GetAvailableCustomRole(Player player) + public static Dictionary GetAvailableCustomRole(Player player) { - return Registered.Where(c => c.Role == player.Role || c is GlobalCustomRole cgr && cgr.Side == SideClass.Get(player.Role.Side)).ToDictionary(c => c, c => c.SpawnChance); + return Registered.Where(cr => cr.IsAvailable(player)).ToDictionary(c => c, c => c.SpawnChance); } public static void GiveRandomRole(Player player) { if (player == null) return; - if (Random.Range(0, 101) > Chance) + if (UnityEngine.Random.Range(0f, 100f) > Chance) { Log.Debug("no luck"); return; } - if(player.GetCustomRoles().Count != 0) + if(HasCustomRole(player)) { Log.Debug("already got a cr"); return; } - CustomRole cr = AssignRole(GetAvailableCustomRole(player)); + KECustomRole cr = AssignRole(GetAvailableCustomRole(player)); Log.Debug($"{player.Id} : {cr.Name}"); - //error assigning cr to a player with a gcr cr?.AddRole(player); } - public static void GiveRole(IEnumerable players) + public static void GiveRandomRole(IEnumerable players) { foreach (Player p in players) { @@ -277,5 +390,73 @@ public static void GiveRole(IEnumerable players) #endregion + + + + #region Register + + public bool TryRegister() + { + + if (!Registered.Contains(this)) + { + if (Registered.Any((KECustomRole r) => r.Name == Name)) + { + Log.Warn($"{Name} has tried to register with the same Name as another role: {Name}. It will not be registered!"); + return false; + } + + Registered.Add(this); + Init(); + return true; + } + + + return false; + } + public bool TryUnregister() + { + Destroy(); + if (!Registered.Remove(this)) + { + Log.Warn($"Cannot unregister {Name} [{Role}], it hasn't been registered yet."); + return false; + } + + return true; + } + + public static IEnumerable Register() + { + List list = new (); + Type[] types = Assembly.GetCallingAssembly().GetTypes(); + foreach (Type type in types) + { + if (!type.IsAbstract && type.IsSubclassOf(typeof(KECustomRole))) + { + KECustomRole customRole = (KECustomRole)Activator.CreateInstance(type); + if (customRole.TryRegister()) + { + list.Add(customRole); + } + } + } + return list; + } + + + public static IEnumerable Unregister() + { + List list = new (); + foreach (KECustomRole item in Registered) + { + item.TryUnregister(); + list.Add(item); + } + + return list; + } + + #endregion } } diff --git a/KruacentExiled/KE.CustomRoles/Abilities/Airstrike.cs b/KruacentExiled/KE.CustomRoles/Abilities/Airstrike.cs index f0cb23fa..4c81e658 100644 --- a/KruacentExiled/KE.CustomRoles/Abilities/Airstrike.cs +++ b/KruacentExiled/KE.CustomRoles/Abilities/Airstrike.cs @@ -22,9 +22,7 @@ public class Airstrike : KEAbilities public override string Name { get; } = "Airstrike"; public override string PublicName { get; } = "Airstrike"; - public override string Description { get; } = "Don't overuse it or your co-op will not be happy"; - - public override int Id => 2001; + public override string Description { get; } = "Don't overuse it or your co-op will not be happy (only works on Surface Zone)"; public override float Cooldown { get; } = 60f; public float height = 5; @@ -33,15 +31,14 @@ public class Airstrike : KEAbilities protected override void AbilityUsed(Player player) { - if(!SelectPosition.TryGetTarget(player, out Vector3 target)) + if(!SetPosition.TryGetTarget(player, out Vector3 target)) { - //show hint - Log.Info("no target selected"); + MainPlugin.ShowEffectHint(player, "no target selected"); return; } if(target.GetZone() != FacilityZone.Surface) { - Log.Info("set target surface"); + MainPlugin.ShowEffectHint(player, "only works on Surface Zone"); return; } @@ -60,15 +57,11 @@ protected override void AbilityUsed(Player player) Timing.CallDelayed(5, () => { Projectile gre = grenade.SpawnActive(target + (height - .5f) * Vector3.up); - //explode on collision gre.GameObject.AddComponent().Init(player.GameObject, gre.Base); l.Destroy(); }); - - - } diff --git a/KruacentExiled/KE.CustomRoles/Abilities/Convert.cs b/KruacentExiled/KE.CustomRoles/Abilities/Convert.cs index 1cae54c7..30035382 100644 --- a/KruacentExiled/KE.CustomRoles/Abilities/Convert.cs +++ b/KruacentExiled/KE.CustomRoles/Abilities/Convert.cs @@ -17,9 +17,7 @@ public class Convert : KEAbilities public override string Name { get; } = "Convert"; public override string PublicName { get; } = "Convert"; - public override string Description { get; } = "Convert a zombie into your team"; - - public override int Id => 2004; + public override string Description { get; } = "Convert a zombie to your team"; public override float Cooldown { get; } = 10*60f; @@ -27,7 +25,7 @@ public class Convert : KEAbilities protected override void AbilityUsed(Player player) { - Physics.Linecast(player.Position, player.Position + player.Rotation.eulerAngles * MaxDistance,out RaycastHit hit); + if (!Physics.Linecast(player.Position, player.Position + player.Rotation.eulerAngles * MaxDistance, out RaycastHit hit)) return; Player playerHit = Player.Get(hit.collider); diff --git a/KruacentExiled/KE.CustomRoles/Abilities/Explode.cs b/KruacentExiled/KE.CustomRoles/Abilities/Explode.cs index 03995989..4530272c 100644 --- a/KruacentExiled/KE.CustomRoles/Abilities/Explode.cs +++ b/KruacentExiled/KE.CustomRoles/Abilities/Explode.cs @@ -19,8 +19,6 @@ public class Explode : KEAbilities public override string Description { get; } = "Tu as une ceinture d'explosif autour de toi, fait attention n'appuie pas sur le bouton"; - public override int Id => 2007; - public override float Cooldown { get; } = 4*60f; protected override void AbilityUsed(Player player) diff --git a/KruacentExiled/KE.CustomRoles/Abilities/Fireball.cs b/KruacentExiled/KE.CustomRoles/Abilities/Fireball.cs index 37eb77b9..43f64c77 100644 --- a/KruacentExiled/KE.CustomRoles/Abilities/Fireball.cs +++ b/KruacentExiled/KE.CustomRoles/Abilities/Fireball.cs @@ -19,8 +19,6 @@ public class Fireball : KEAbilities public override string Description { get; } = "I cast Fireball"; - public override int Id => 2010; - public override float Cooldown { get; } = 2f; diff --git a/KruacentExiled/KE.CustomRoles/Abilities/ForceOpen.cs b/KruacentExiled/KE.CustomRoles/Abilities/ForceOpen.cs index 26fadc50..75c5bc2a 100644 --- a/KruacentExiled/KE.CustomRoles/Abilities/ForceOpen.cs +++ b/KruacentExiled/KE.CustomRoles/Abilities/ForceOpen.cs @@ -22,8 +22,6 @@ public class ForceOpen : KEAbilities public override string Description { get; } = "Force open a door"; - public override int Id => 2009; - public override float Cooldown { get; } = 30; private Dictionary abilityActivated = new(); public static readonly TimeSpan MaxTime = new (0, 0, 30); @@ -49,7 +47,7 @@ private void InteractingDoor(InteractingDoorEventArgs ev) if (!abilityActivated.ContainsKey(player)) return; if (DateTime.Now > abilityActivated[player] + MaxTime) return; if (ev.IsAllowed) return; - if (ev.Door.DoorLockType > DoorLockType.Lockdown079) return; + if (ev.Door.DoorLockType >= DoorLockType.Lockdown079) return; int successRate; diff --git a/KruacentExiled/KE.CustomRoles/Abilities/SelectPosition.cs b/KruacentExiled/KE.CustomRoles/Abilities/SetPosition.cs similarity index 92% rename from KruacentExiled/KE.CustomRoles/Abilities/SelectPosition.cs rename to KruacentExiled/KE.CustomRoles/Abilities/SetPosition.cs index 539ea454..1cdea444 100644 --- a/KruacentExiled/KE.CustomRoles/Abilities/SelectPosition.cs +++ b/KruacentExiled/KE.CustomRoles/Abilities/SetPosition.cs @@ -5,14 +5,12 @@ namespace KE.CustomRoles.Abilities { - public class SelectPosition : KEAbilities + public class SetPosition : KEAbilities { public override string Name { get; } = "SetPosition"; public override string PublicName { get; } = "Set Position"; public override string Description { get; } = "Select the current position for another ability"; - - public override int Id => 2000; public override float Cooldown { get; } = 5f; private static Dictionary SelectedTarget = new(); diff --git a/KruacentExiled/KE.CustomRoles/Abilities/SimulateDeath.cs b/KruacentExiled/KE.CustomRoles/Abilities/SimulateDeath.cs index eef753e4..1008a01b 100644 --- a/KruacentExiled/KE.CustomRoles/Abilities/SimulateDeath.cs +++ b/KruacentExiled/KE.CustomRoles/Abilities/SimulateDeath.cs @@ -17,7 +17,6 @@ public class SimulateDeath : KEAbilities public override string Description { get; } = "T'es talent de mime te permettent de simuler la mort."; - public override int Id => 2011; public int Duration = 10; public override float Cooldown { get; } = 60f; diff --git a/KruacentExiled/KE.CustomRoles/Abilities/Teleport.cs b/KruacentExiled/KE.CustomRoles/Abilities/Teleportation.cs similarity index 71% rename from KruacentExiled/KE.CustomRoles/Abilities/Teleport.cs rename to KruacentExiled/KE.CustomRoles/Abilities/Teleportation.cs index 7685e318..c080cc20 100644 --- a/KruacentExiled/KE.CustomRoles/Abilities/Teleport.cs +++ b/KruacentExiled/KE.CustomRoles/Abilities/Teleportation.cs @@ -7,29 +7,38 @@ namespace KE.CustomRoles.Abilities { - public class Teleport : KEAbilities + public class Teleportation : KEAbilities { public override string Name { get; } = "Teleportation"; public override string PublicName { get; } = "Teleportation"; - public override string Description { get; } = $"Tu perds {Damage} HP/téléportation"; + public override string Description { get; } = $"Tu perds {Damage} HP/téléportation, ne peux pas être utilisé dans les ascenseurs"; - public override int Id => 2008; public override float Cooldown { get; } = 120f; public static float Damage { get; set; } = 60; protected override void AbilityUsed(Player player) { - if(!SelectPosition.TryGetTarget(player, out Vector3 target)) + if(!SetPosition.TryGetTarget(player, out Vector3 target)) { MainPlugin.ShowEffectHint(player, "no target selected"); + return; } + + + if(Lift.Get(target) is not null) + { + MainPlugin.ShowEffectHint(player, "can't teleport in elevator"); + return; + } + + if (target.GetZone() == FacilityZone.LightContainment && Map.IsLczDecontaminated) { - Log.Info("target in LCZ while LCZ is decontaminated."); + MainPlugin.ShowEffectHint(player, "target in LCZ while LCZ is decontaminated."); return; } @@ -40,12 +49,6 @@ protected override void AbilityUsed(Player player) if (Player.List.Count() > 1) { player.Teleport(Player.List.Where(p => p != player).GetRandomValue()); - return; - } - else - { - Log.Warn("no other player to teleport to"); - return; } } else diff --git a/KruacentExiled/KE.CustomRoles/Abilities/Thief.cs b/KruacentExiled/KE.CustomRoles/Abilities/Thief.cs index 55859666..a0b9f3ba 100644 --- a/KruacentExiled/KE.CustomRoles/Abilities/Thief.cs +++ b/KruacentExiled/KE.CustomRoles/Abilities/Thief.cs @@ -15,7 +15,6 @@ public class Thief : KEAbilities public override string Description { get; } = "Avec 1548 heures de jeu sur Thief Simulator fallait s'y attendre un peu."; - public override int Id => 2006; public override float Cooldown { get; } = 120f; @@ -28,6 +27,11 @@ protected override void AbilityUsed(Player player) playerList.ForEach(p => Log.Info(p.Nickname)); Player thiefed = playerList.GetRandomValue(); + if(thiefed is null) + { + Log.Warn("no other player"); + return; + } Log.Debug($"Thiefed player : {thiefed.Nickname}"); diff --git a/KruacentExiled/KE.CustomRoles/Abilities/Trade.cs b/KruacentExiled/KE.CustomRoles/Abilities/Trade.cs index b9cd3df7..bc7ead80 100644 --- a/KruacentExiled/KE.CustomRoles/Abilities/Trade.cs +++ b/KruacentExiled/KE.CustomRoles/Abilities/Trade.cs @@ -18,7 +18,6 @@ public class Trade : KEAbilities public override string Description { get; } = "T'es lien avec le casino t'as permis d'avoir un peu plus de pièce en échange d'un item ou de pire"; - public override int Id => 2002; public override float Cooldown { get; } = 1f; diff --git a/KruacentExiled/KE.CustomRoles/CR/ChaosInsurgency/LeRusse.cs b/KruacentExiled/KE.CustomRoles/CR/ChaosInsurgency/LeRusse.cs index 495882f4..7a90313a 100644 --- a/KruacentExiled/KE.CustomRoles/CR/ChaosInsurgency/LeRusse.cs +++ b/KruacentExiled/KE.CustomRoles/CR/ChaosInsurgency/LeRusse.cs @@ -1,19 +1,20 @@ using Exiled.API.Enums; using Exiled.API.Features.Attributes; using KE.CustomRoles.API.Features; +using KE.CustomRoles.API.Interfaces; using PlayerRoles; using System.Collections.Generic; using UnityEngine; namespace KE.CustomRoles.CR.ChaosInsurgency { - public class Russe : KECustomRole + public class Russe : KECustomRole, IColor { public override string Description { get; set; } = "Tu dois faire la roulette russe avec les autres joueurs"; - public override uint Id { get; set; } = 1050; + public override string InternalName => "Russe"; public override string PublicName { get; set; } = "Le Russe"; public override int MaxHealth { get; set; } = 100; - public override RoleTypeId Role { get; set; } = RoleTypeId.ChaosConscript; + public override RoleTypeId Role { get; set; } = RoleTypeId.ChaosRifleman; public override bool KeepRoleOnDeath { get; set; } = false; public override bool KeepRoleOnChangingRole { get; set; } = false; public Color32 Color => new(255, 0, 0, 0); diff --git a/KruacentExiled/KE.CustomRoles/CR/ChaosInsurgency/Negotiator.cs b/KruacentExiled/KE.CustomRoles/CR/ChaosInsurgency/Negotiator.cs index 366b22fb..eeea4db2 100644 --- a/KruacentExiled/KE.CustomRoles/CR/ChaosInsurgency/Negotiator.cs +++ b/KruacentExiled/KE.CustomRoles/CR/ChaosInsurgency/Negotiator.cs @@ -14,20 +14,22 @@ namespace KE.CustomRoles.CR.ChaosInsurgency public class Negotiator : KECustomRole { public override string Description { get; set; } = "Who knew zombie could be so great listeners"; - public override uint Id { get; set; } = 1071; + public override string InternalName => PublicName; public override string PublicName { get; set; } = "Negotiator"; public override int MaxHealth { get; set; } = 100; - public override RoleTypeId Role { get; set; } = RoleTypeId.ChaosConscript; + public override RoleTypeId Role { get; set; } = RoleTypeId.ChaosRifleman; public override bool KeepRoleOnDeath { get; set; } = false; public override bool KeepRoleOnChangingRole { get; set; } = false; public override float SpawnChance { get; set; } = 100; - public override HashSet Abilities { get; } = new() + public override HashSet Abilities { get; } = new() { - 2004 + "Convert" }; + + protected override void RoleAdded(Player player) { Timing.CallDelayed(.1f, delegate diff --git a/KruacentExiled/KE.CustomRoles/CR/ClassD/DBoyInShape.cs b/KruacentExiled/KE.CustomRoles/CR/ClassD/DBoyInShape.cs index 33e08fc3..996c43ee 100644 --- a/KruacentExiled/KE.CustomRoles/CR/ClassD/DBoyInShape.cs +++ b/KruacentExiled/KE.CustomRoles/CR/ClassD/DBoyInShape.cs @@ -21,8 +21,8 @@ namespace KE.CustomRoles.CR.ClassD public class DBoyInShape : KECustomRole { public override string Description { get; set; } = "Dammmmnnnnnnn les gates"; - public override uint Id { get; set; } = 1058; public override string PublicName { get; set; } = "DBoyInShape"; + public override string InternalName => "DBoyInShape"; public override RoleTypeId Role { get; set; } = RoleTypeId.ClassD; public override bool KeepRoleOnDeath { get; set; } = false; public override bool KeepRoleOnChangingRole { get; set; } = true; @@ -31,9 +31,9 @@ public class DBoyInShape : KECustomRole public const byte SpeedReduction = 15; - public override HashSet Abilities => new() + public override HashSet Abilities => new() { - 2009 + "ForceOpen" }; protected override void RoleAdded(Player player) diff --git a/KruacentExiled/KE.CustomRoles/CR/ClassD/Enfant.cs b/KruacentExiled/KE.CustomRoles/CR/ClassD/Enfant.cs index 8901d514..67496668 100644 --- a/KruacentExiled/KE.CustomRoles/CR/ClassD/Enfant.cs +++ b/KruacentExiled/KE.CustomRoles/CR/ClassD/Enfant.cs @@ -1,4 +1,7 @@ -using Exiled.API.Features.Attributes; +using CommandSystem.Commands.RemoteAdmin; +using Exiled.API.Features; +using Exiled.API.Features.Attributes; +using InventorySystem; using InventorySystem.Items.Usables.Scp330; using KE.CustomRoles.API.Features; using KE.CustomRoles.API.Interfaces; @@ -10,8 +13,7 @@ namespace KE.CustomRoles.CR.ClassD { public class Enfant : KECustomRole, IColor { - public override string Description { get; set; } = "do not the kid \ntu commences avec un bonbon arc-en-ciel \n t'es un peu plus petit que la normal"; - public override uint Id { get; set; } = 1041; + public override string Description { get; set; } = "do not the kid \ntu commences avec un bonbon arc-en-ciel (pour de vrai cette fois) \n t'es un peu plus petit que la normal"; public override string PublicName { get; set; } = "Enfant"; public override int MaxHealth { get; set; } = 100; public override RoleTypeId Role { get; set; } = RoleTypeId.ClassD; @@ -22,11 +24,14 @@ public class Enfant : KECustomRole, IColor public override float SpawnChance { get; set; } = 100; public override Vector3 Scale { get; set; } = new Vector3(1, 0.75f, 1); - public override List Inventory { get; set; } = new List() - { - $"{CandyKindID.Rainbow}" - }; + protected override void GiveInventory(Player player) + { + player.ReferenceHub.GrantCandy(CandyKindID.Rainbow, InventorySystem.Items.ItemAddReason.StartingItem); + base.GiveInventory(player); + } + + public override string InternalName => PublicName; } } diff --git a/KruacentExiled/KE.CustomRoles/CR/ClassD/Mime.cs b/KruacentExiled/KE.CustomRoles/CR/ClassD/Mime.cs index 1f14651a..bb603a2b 100644 --- a/KruacentExiled/KE.CustomRoles/CR/ClassD/Mime.cs +++ b/KruacentExiled/KE.CustomRoles/CR/ClassD/Mime.cs @@ -15,8 +15,8 @@ namespace KE.CustomRoles.CR.ClassD public class Mime : KECustomRole, IColor { public override string Description { get; set; } = "Tu ne peux pas parler\nmais tu fais très peu de bruit quand tu marches\net t'es tout plat"; - public override uint Id { get; set; } = 1053; public override string PublicName { get; set; } = "Mime"; + public override string InternalName => PublicName; public override int MaxHealth { get; set; } = 100; public override RoleTypeId Role { get; set; } = RoleTypeId.ClassD; public override bool KeepRoleOnDeath { get; set; } = false; @@ -37,9 +37,9 @@ protected override void RoleRemoved(Player player) player.DisableEffect(EffectType.SilentWalk); } - public override HashSet Abilities { get; } = new() + public override HashSet Abilities { get; } = new() { - 2011 + "SimulateDeath" }; } } diff --git a/KruacentExiled/KE.CustomRoles/CR/Guard/ChiefGuard.cs b/KruacentExiled/KE.CustomRoles/CR/Guard/ChiefGuard.cs index 1465b26b..6626db70 100644 --- a/KruacentExiled/KE.CustomRoles/CR/Guard/ChiefGuard.cs +++ b/KruacentExiled/KE.CustomRoles/CR/Guard/ChiefGuard.cs @@ -11,8 +11,8 @@ namespace KE.CustomRoles.CR.Guard public class ChiefGuard : KECustomRole, IColor { public override string Description { get; set; } = "T'as une carte de private \net un crossvec"; - public override uint Id { get; set; } = 1046; public override string PublicName { get; set; } = "Chef des Gardes"; + public override string InternalName => "ChiefGuard"; public override int MaxHealth { get; set; } = 100; public override RoleTypeId Role { get; set; } = RoleTypeId.FacilityGuard; public override bool KeepRoleOnDeath { get; set; } = false; diff --git a/KruacentExiled/KE.CustomRoles/CR/Guard/Guard914.cs b/KruacentExiled/KE.CustomRoles/CR/Guard/Guard914.cs index 934afd36..8ff1a00d 100644 --- a/KruacentExiled/KE.CustomRoles/CR/Guard/Guard914.cs +++ b/KruacentExiled/KE.CustomRoles/CR/Guard/Guard914.cs @@ -19,8 +19,8 @@ namespace KE.CustomRoles.CR.Guard public class Guard914 : KECustomRole { public override string Description { get; set; } = "Tu es Le garde de SCP-914 \nTu commences à 914 \nmais on a volé ta carte \net ntm aussi"; - public override uint Id { get; set; } = 1045; public override string PublicName { get; set; } = "Garde de 914"; + public override string InternalName => "Guard914"; public override int MaxHealth { get; set; } = 100; public override RoleTypeId Role { get; set; } = RoleTypeId.FacilityGuard; public override bool KeepRoleOnDeath { get; set; } = false; diff --git a/KruacentExiled/KE.CustomRoles/CR/Guard/Introvert.cs b/KruacentExiled/KE.CustomRoles/CR/Guard/Introvert.cs index 34dcc13e..d4cab203 100644 --- a/KruacentExiled/KE.CustomRoles/CR/Guard/Introvert.cs +++ b/KruacentExiled/KE.CustomRoles/CR/Guard/Introvert.cs @@ -7,12 +7,11 @@ namespace KE.CustomRoles.CR.Guard { - [CustomRole(RoleTypeId.FacilityGuard)] internal class Introvert : KECustomRole { public override string Description { get; set; } = "Tu n'aimes pas trop les humains"; - public override uint Id { get; set; } = 1069; public override string PublicName { get; set; } = "Introvert"; + public override string InternalName => PublicName; public override int MaxHealth { get; set; } = 100; public override RoleTypeId Role { get; set; } = RoleTypeId.FacilityGuard; public override bool KeepRoleOnDeath { get; set; } = false; diff --git a/KruacentExiled/KE.CustomRoles/CR/Human/Alzheimer.cs b/KruacentExiled/KE.CustomRoles/CR/Human/Alzheimer.cs index 3f903d20..ca756756 100644 --- a/KruacentExiled/KE.CustomRoles/CR/Human/Alzheimer.cs +++ b/KruacentExiled/KE.CustomRoles/CR/Human/Alzheimer.cs @@ -17,8 +17,8 @@ public class Alzheimer : GlobalCustomRole, IColor private static Dictionary _coroutines = new(); public override SideEnum Side { get; set; } = SideEnum.Human; public override string Description { get; set; } = "POV Mishima"; - public override uint Id { get; set; } = 1056; public override string PublicName { get; set; } = "Vieux"; + public override string InternalName => GetType().Name; public override bool KeepRoleOnDeath { get; set; } = false; public override bool KeepRoleOnChangingRole { get; set; } = true; public override float SpawnChance { get; set; } = 100; diff --git a/KruacentExiled/KE.CustomRoles/CR/Human/Asthmatique.cs b/KruacentExiled/KE.CustomRoles/CR/Human/Asthmatique.cs index 28c135c3..5c33385b 100644 --- a/KruacentExiled/KE.CustomRoles/CR/Human/Asthmatique.cs +++ b/KruacentExiled/KE.CustomRoles/CR/Human/Asthmatique.cs @@ -15,7 +15,6 @@ public class Asthmatique : GlobalCustomRole, IColor { public override SideEnum Side { get; set; } = SideEnum.Human; public override string Description { get; set; } = "T'as stamina est réduit de moitié\nMais tu vises mieux"; - public override uint Id { get; set; } = 1042; public override string PublicName { get; set; } = "Asthmatique"; public override bool KeepRoleOnDeath { get; set; } = false; public override bool KeepRoleOnChangingRole { get; set; } = true; diff --git a/KruacentExiled/KE.CustomRoles/CR/Human/Cleptoman.cs b/KruacentExiled/KE.CustomRoles/CR/Human/Cleptoman.cs index ee0d1693..998b74f6 100644 --- a/KruacentExiled/KE.CustomRoles/CR/Human/Cleptoman.cs +++ b/KruacentExiled/KE.CustomRoles/CR/Human/Cleptoman.cs @@ -12,7 +12,6 @@ public class Cleptoman : GlobalCustomRole, IColor { public override SideEnum Side { get; set; } = SideEnum.Human; public override string Description { get; set; } = "Tu peux voler les items des autres joueurs"; - public override uint Id { get; set; } = 1453; public override string PublicName { get; set; } = "cccCleptoman"; public override bool KeepRoleOnDeath { get; set; } = false; public override bool KeepRoleOnChangingRole { get; set; } = true; @@ -21,9 +20,9 @@ public class Cleptoman : GlobalCustomRole, IColor public override float SpawnChance { get; set; } = 100; public override Vector3 Scale { get; set; } = new Vector3(1.01f, 0.99f, 1); - public override HashSet Abilities { get; } = new() + public override HashSet Abilities { get; } = new() { - 2006 + "Thief" }; } } \ No newline at end of file diff --git a/KruacentExiled/KE.CustomRoles/CR/Human/Crazy.cs b/KruacentExiled/KE.CustomRoles/CR/Human/Crazy.cs index 7402f71b..a1f225ab 100644 --- a/KruacentExiled/KE.CustomRoles/CR/Human/Crazy.cs +++ b/KruacentExiled/KE.CustomRoles/CR/Human/Crazy.cs @@ -34,7 +34,6 @@ internal class Crazy : GlobalCustomRole private static CoroutineHandle _crazyingCoroutine; public override SideEnum Side { get; set; } = SideEnum.Human; public override string Description { get; set; } = "Je pense que le traitement que t'as eu à la fondation t'as pas aidé"; - public override uint Id { get; set; } = 1068; public override string PublicName { get; set; } = "Fou de la facilité"; public override bool KeepRoleOnDeath { get; set; } = true; public override bool KeepRoleOnChangingRole { get; set; } = true; diff --git a/KruacentExiled/KE.CustomRoles/CR/Human/Diabetique.cs b/KruacentExiled/KE.CustomRoles/CR/Human/Diabetique.cs index 14ca99e7..97834cc5 100644 --- a/KruacentExiled/KE.CustomRoles/CR/Human/Diabetique.cs +++ b/KruacentExiled/KE.CustomRoles/CR/Human/Diabetique.cs @@ -15,7 +15,6 @@ public class Diabetique : GlobalCustomRole, IColor { public override SideEnum Side { get; set; } = SideEnum.Human; public override string Description { get; set; } = "T'as mangé le crambleu au pomme de mael"; - public override uint Id { get; set; } = 1054; public override string PublicName { get; set; } = "Diabetique"; public override bool KeepRoleOnDeath { get; set; } = false; public override bool KeepRoleOnChangingRole { get; set; } = false; diff --git a/KruacentExiled/KE.CustomRoles/CR/Human/Enderman.cs b/KruacentExiled/KE.CustomRoles/CR/Human/Enderman.cs index 66f5ebee..181fa64a 100644 --- a/KruacentExiled/KE.CustomRoles/CR/Human/Enderman.cs +++ b/KruacentExiled/KE.CustomRoles/CR/Human/Enderman.cs @@ -14,15 +14,14 @@ internal class Enderman : GlobalCustomRole, IColor { public override SideEnum Side { get; set; } = SideEnum.Human; public override string Description { get; set; } = $"Tu peux te téléporter ! T tro for enféte"; - public override uint Id { get; set; } = 1065; public override string PublicName { get; set; } = "Enderman"; public override bool KeepRoleOnDeath { get; set; } = false; public override bool KeepRoleOnChangingRole { get; set; } = true; public override float SpawnChance { get; set; } = 100; - public override HashSet Abilities { get; } = new() + public override HashSet Abilities { get; } = new() { - 2008, - 2000 + "Teleportation", + "SetPosition" }; public Color32 Color => new Color32(142, 37, 190, 0); diff --git a/KruacentExiled/KE.CustomRoles/CR/Human/Hitman.cs b/KruacentExiled/KE.CustomRoles/CR/Human/Hitman.cs index 56ba9098..47a3c73e 100644 --- a/KruacentExiled/KE.CustomRoles/CR/Human/Hitman.cs +++ b/KruacentExiled/KE.CustomRoles/CR/Human/Hitman.cs @@ -18,13 +18,11 @@ public class Hitman : GlobalCustomRole, IColor { private static CoroutineHandle _coroutines; public override SideEnum Side { get; set; } = SideEnum.Human; - public override string Name { get; set; } = "Hitman"; public override string Description { get; set; } = "pov sou hiyori de Your Turn To Die -Death Game By Majority-"; - public override uint Id { get; set; } = 1059; public override string PublicName { get; set; } = string.Empty; public override bool KeepRoleOnDeath { get; set; } = false; public override bool KeepRoleOnChangingRole { get; set; } = true; - public override float SpawnChance { get; set; } = 0; + public override float SpawnChance { get; set; } = 10; public Color32 Color => new Color32(54, 54, 54,0); diff --git a/KruacentExiled/KE.CustomRoles/CR/Human/Maladroit.cs b/KruacentExiled/KE.CustomRoles/CR/Human/Maladroit.cs index 2c279f4d..da9d1c1e 100644 --- a/KruacentExiled/KE.CustomRoles/CR/Human/Maladroit.cs +++ b/KruacentExiled/KE.CustomRoles/CR/Human/Maladroit.cs @@ -21,8 +21,7 @@ public class Maladroit : GlobalCustomRole, IColor private static Dictionary _coroutines = new(); public override SideEnum Side { get; set; } = SideEnum.Human; - public override string Description { get; set; } = "Tu es maladroit\nFait attention à tes items !"; - public override uint Id { get; set; } = 1057; + public override string Description { get; set; } = "Fait attention à tes items !"; public override string PublicName { get; set; } = "Maladroit"; public override bool KeepRoleOnDeath { get; set; } = false; public override bool KeepRoleOnChangingRole { get; set; } = true; diff --git a/KruacentExiled/KE.CustomRoles/CR/Human/scp202.cs b/KruacentExiled/KE.CustomRoles/CR/Human/scp202.cs index 2f8ff4b2..94b13f6e 100644 --- a/KruacentExiled/KE.CustomRoles/CR/Human/scp202.cs +++ b/KruacentExiled/KE.CustomRoles/CR/Human/scp202.cs @@ -10,11 +10,10 @@ namespace KE.CustomRoles.CR.Human { - public class Inverted : GlobalCustomRole, IColor + public class Scp202 : GlobalCustomRole, IColor { public override SideEnum Side { get; set; } = SideEnum.Human; public override string Description { get; set; } = "? emsizan-itna'd te emsinummoc itna'd eiv enu sèrpa\n7691 lirva 91 el trom te engoloc à 6781 reivnaj 5 el én\n,etarcoméd neitérhc itrap ud eitrap tnasiaf 5691 à 9491 ed reilecnahC\n?elaidnom erreug ednoces al sèrpa dnamella reilecnahc re1 el darnoK erid xuev uT ?drannoC"; - public override uint Id { get; set; } = 1066; public override string PublicName { get; set; } = "SCP-202"; public override bool KeepRoleOnDeath { get; set; } = false; public override bool KeepRoleOnChangingRole { get; set; } = true; diff --git a/KruacentExiled/KE.CustomRoles/CR/MTF/Pilot.cs b/KruacentExiled/KE.CustomRoles/CR/MTF/Pilot.cs index b405fcaf..712a0a2e 100644 --- a/KruacentExiled/KE.CustomRoles/CR/MTF/Pilot.cs +++ b/KruacentExiled/KE.CustomRoles/CR/MTF/Pilot.cs @@ -15,7 +15,6 @@ namespace KE.CustomRoles.CR.MTF public class Pilot : KECustomRole { public override string Description { get; set; } = "So I haveth a Laser Pointere"; - public override uint Id { get; set; } = 1088; public override string PublicName { get; set; } = "Pilot"; public override int MaxHealth { get; set; } = 75; public override RoleTypeId Role { get; set; } = RoleTypeId.NtfPrivate; @@ -38,10 +37,10 @@ public class Pilot : KECustomRole { AmmoType.Nato9, 100} }; - public override HashSet Abilities { get; } = new() + public override HashSet Abilities { get; } = new() { - 2000, - 2001 + "SelectPosition", + "AirStrike" }; diff --git a/KruacentExiled/KE.CustomRoles/CR/MTF/Tank.cs b/KruacentExiled/KE.CustomRoles/CR/MTF/Tank.cs index b6e25b73..7b642d1e 100644 --- a/KruacentExiled/KE.CustomRoles/CR/MTF/Tank.cs +++ b/KruacentExiled/KE.CustomRoles/CR/MTF/Tank.cs @@ -14,8 +14,7 @@ namespace KE.CustomRoles.CR.MTF { public class Tank : KECustomRole, IColor { - public override string Description { get; set; } = "Tu es débuff mais ta force de tir est démultiplié (fait attention à tes balles)"; - public override uint Id { get; set; } = 1051; + public override string Description { get; set; } = "Tu es débuff mais ta force de tir est démultiplié (fais attention à tes balles)"; public override string PublicName { get; set; } = "Tank"; public override int MaxHealth { get; set; } = 200; public override RoleTypeId Role { get; set; } = RoleTypeId.NtfCaptain; diff --git a/KruacentExiled/KE.CustomRoles/CR/MTF/Terroriste.cs b/KruacentExiled/KE.CustomRoles/CR/MTF/Terroriste.cs index 3b2c5311..52c0cc04 100644 --- a/KruacentExiled/KE.CustomRoles/CR/MTF/Terroriste.cs +++ b/KruacentExiled/KE.CustomRoles/CR/MTF/Terroriste.cs @@ -11,7 +11,6 @@ namespace KE.CustomRoles.CR.MTF public class Terroriste : KECustomRole, IColor { public override string Description { get; set; } = "Ne fait pas exploser la facilité \ntu commences avec des grenades"; - public override uint Id { get; set; } = 1052; public override string PublicName { get; set; } = "Terroriste"; public override int MaxHealth { get; set; } = 100; public override RoleTypeId Role { get; set; } = RoleTypeId.NtfSergeant; @@ -37,9 +36,9 @@ public class Terroriste : KECustomRole, IColor { AmmoType.Nato556, 100} }; - public override HashSet Abilities { get; } = new() + public override HashSet Abilities { get; } = new() { - 2007 + "Explode" }; } } diff --git a/KruacentExiled/KE.CustomRoles/CR/SCP/Paper.cs b/KruacentExiled/KE.CustomRoles/CR/SCP/Paper.cs index 25c45258..e0fa9843 100644 --- a/KruacentExiled/KE.CustomRoles/CR/SCP/Paper.cs +++ b/KruacentExiled/KE.CustomRoles/CR/SCP/Paper.cs @@ -8,7 +8,6 @@ namespace KE.CustomRoles.CR.SCP public class Paper : GlobalCustomRole { public override string Description { get; set; } = "uh oh. paper jam"; - public override uint Id { get; set; } = 1047; public override SideEnum Side { get; set; } = SideEnum.SCP; public override string PublicName { get; set; } = "Paper"; public override bool KeepRoleOnDeath { get; set; } = false; diff --git a/KruacentExiled/KE.CustomRoles/CR/SCP/SCP457.cs b/KruacentExiled/KE.CustomRoles/CR/SCP/SCP457.cs index 3773fef0..ca900955 100644 --- a/KruacentExiled/KE.CustomRoles/CR/SCP/SCP457.cs +++ b/KruacentExiled/KE.CustomRoles/CR/SCP/SCP457.cs @@ -22,7 +22,6 @@ public class SCP457 : CustomSCP { public override string Description { get; set; } = "You do passive damage around you, and can lauch fireballs by pressing the stalk button"; - public override uint Id { get; set; } = 1084; public override string PublicName { get; set; } = "SCP-457"; public override int MaxHealth { get; set; } = 5000; public override RoleTypeId Role { get; set; } = RoleTypeId.Scp106; @@ -41,9 +40,9 @@ public class SCP457 : CustomSCP - public override HashSet Abilities => + public override HashSet Abilities => [ - 2010 + "FireBall" ]; diff --git a/KruacentExiled/KE.CustomRoles/CR/SCP/Small.cs b/KruacentExiled/KE.CustomRoles/CR/SCP/Small.cs index 85f4de9d..8585c3dc 100644 --- a/KruacentExiled/KE.CustomRoles/CR/SCP/Small.cs +++ b/KruacentExiled/KE.CustomRoles/CR/SCP/Small.cs @@ -9,7 +9,6 @@ namespace KE.CustomRoles.CR.SCP public class Small : GlobalCustomRole { public override string Description { get; set; } = "u smoll"; - public override uint Id { get; set; } = 1047; public override SideEnum Side { get; set; } = SideEnum.SCP; public override string PublicName { get; set; } = "Small"; public override bool KeepRoleOnDeath { get; set; } = false; diff --git a/KruacentExiled/KE.CustomRoles/CR/SCP/Tall.cs b/KruacentExiled/KE.CustomRoles/CR/SCP/Tall.cs deleted file mode 100644 index 5b2a7df7..00000000 --- a/KruacentExiled/KE.CustomRoles/CR/SCP/Tall.cs +++ /dev/null @@ -1,35 +0,0 @@ -using Exiled.API.Features; -using Exiled.API.Features.Attributes; -using KE.CustomRoles.API.Features; -using PlayerRoles; -using System.Linq; -using UnityEngine; - -namespace KE.CustomRoles.CR.SCP -{ - /* - public class Tall : GlobalCustomRole - { - public override string Description { get; set; } = "u tall"; - public override uint Id { get; set; } = 1049; - public override string PublicName { get; set; } = "Tall"; - public override bool KeepRoleOnDeath { get; set; } = false; - public override bool KeepRoleOnChangingRole { get; set; } = false; - public override float MaxHealthMultiplicator { get; set; } = 1.1f; - public override float SpawnChance { get; set; } = 100; - public override SideEnum Side { get; set; } = SideEnum.SCP; - public new Vector3 Scale { get; set; } = new(1, 1.3f, 1); - public Vector3 BaseScale => Vector3.one; - protected override void RoleAdded(Player player) - { - player.SetFakeScale(Scale, Player.List.Where(p => p != player)); - - - } - - protected override void RoleRemoved(Player player) - { - player.SetFakeScale(BaseScale, Player.List.Where(p => p != player)); - } - }*/ -} diff --git a/KruacentExiled/KE.CustomRoles/CR/SCP/Ultra.cs b/KruacentExiled/KE.CustomRoles/CR/SCP/Ultra.cs index 6cc4caec..a59389de 100644 --- a/KruacentExiled/KE.CustomRoles/CR/SCP/Ultra.cs +++ b/KruacentExiled/KE.CustomRoles/CR/SCP/Ultra.cs @@ -15,12 +15,11 @@ public class Ultra : GlobalCustomRole private static Dictionary _handles = new(); public override SideEnum Side { get; set; } = SideEnum.SCP; public override string Description { get; set; } = "You can sense where people are located"; - public override uint Id { get; set; } = 1079; public override string PublicName { get; set; } = "Ultra"; public override bool KeepRoleOnDeath { get; set; } = false; public override bool KeepRoleOnChangingRole { get; set; } = false; public override float MaxHealthMultiplicator { get; set; } = 1f; - public override float SpawnChance { get; set; } = 0; + public override float SpawnChance { get; set; } = 100; public const float RefreshRate = 20; public const int SizeText = 20; protected override void RoleAdded(Player player) @@ -39,10 +38,10 @@ protected override void RoleRemoved(Player player) private IEnumerator DisplayInfos(Player player) { - while (true) + while (player.IsAlive) { Log.Debug("Ultra : showing"); - ShowEffectHint(player, PlayerInZone()); + ShowEffectHint(player, PlayerInZone(),RefreshRate); yield return Timing.WaitForSeconds(RefreshRate); } } diff --git a/KruacentExiled/KE.CustomRoles/CR/Scientist/GambleAddict.cs b/KruacentExiled/KE.CustomRoles/CR/Scientist/GambleAddict.cs index 178148cd..5cd9777e 100644 --- a/KruacentExiled/KE.CustomRoles/CR/Scientist/GambleAddict.cs +++ b/KruacentExiled/KE.CustomRoles/CR/Scientist/GambleAddict.cs @@ -13,7 +13,6 @@ namespace KE.CustomRoles.CR.Scientist public class GambleAddict : KECustomRole, IColor { public override string Description { get; set; } = "T'as trade ton kit et ta carte contre 2 pièces \nfais en bon usage"; - public override uint Id { get; set; } = 1043; public override string PublicName { get; set; } = "Gamble Addict"; public override int MaxHealth { get; set; } = 100; public override RoleTypeId Role { get; set; } = RoleTypeId.Scientist; @@ -28,9 +27,9 @@ public class GambleAddict : KECustomRole, IColor $"{ItemType.Coin}", }; - public override HashSet Abilities { get; } = new() + public override HashSet Abilities { get; } = new() { - 2002 + "Trade" }; public Color32 Color => new(0, 105, 59,0); diff --git a/KruacentExiled/KE.CustomRoles/CR/Scientist/ZoneManager.cs b/KruacentExiled/KE.CustomRoles/CR/Scientist/ZoneManager.cs index 1e1074dc..e6c63dfe 100644 --- a/KruacentExiled/KE.CustomRoles/CR/Scientist/ZoneManager.cs +++ b/KruacentExiled/KE.CustomRoles/CR/Scientist/ZoneManager.cs @@ -17,7 +17,6 @@ namespace KE.CustomRoles.CR.Scientist public class ZoneManager : KECustomRole { public override string Description { get; set; } = "Incroyable tu peux avoir une promotion alors fais ton boulot et ouvre tous ces checkpoints et tu pourras sortir d'ici"; - public override uint Id { get; set; } = 1044; public override string PublicName { get; set; } = "Zone Manager"; public override int MaxHealth { get; set; } = 100; public override RoleTypeId Role { get; set; } = RoleTypeId.Scientist; @@ -42,16 +41,16 @@ public class ZoneManager : KECustomRole public override List Inventory { get; set; } = new List() { - $"{ItemType.Medkit}", - $"{ItemType.Adrenaline}", - $"{ItemType.KeycardZoneManager}" + $"{ItemType.Medkit}", + $"{ItemType.Adrenaline}", + $"{ItemType.KeycardZoneManager}" }; public static readonly List DoorToOpen = new() { - DoorType.CheckpointLczA, - DoorType.CheckpointLczB, - DoorType.CheckpointEzHczA, - DoorType.CheckpointEzHczB + DoorType.CheckpointLczA, + DoorType.CheckpointLczB, + DoorType.CheckpointEzHczA, + DoorType.CheckpointEzHczB }; diff --git a/KruacentExiled/KE.CustomRoles/Commands/Give.cs b/KruacentExiled/KE.CustomRoles/Commands/Give.cs new file mode 100644 index 00000000..90120413 --- /dev/null +++ b/KruacentExiled/KE.CustomRoles/Commands/Give.cs @@ -0,0 +1,98 @@ +using CommandSystem; +using Exiled.API.Features; +using Exiled.API.Features.Pools; +using Exiled.CustomRoles.API.Features; +using Exiled.Permissions.Extensions; +using KE.CustomRoles.API.Features; +using RemoteAdmin; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace KE.CustomRoles.Commands +{ + internal class Give : ICommand + { + public string Command => "give"; + + public string[] Aliases => ["g"]; + + public string Description => ""; + + public bool Execute(ArraySegment arguments, ICommandSender sender, out string response) + { + try + { + if (!sender.CheckPermission("customroles.give")) + { + response = "Permission Denied, required: customroles.give"; + return false; + } + + if (arguments.Count == 0) + { + response = "give [Nickname/PlayerID/UserID/all/*]"; + return false; + } + + if (!KECustomRole.TryGet(arguments.At(0), out KECustomRole customRole) || customRole is null) + { + response = "Custom role " + arguments.At(0) + " not found!"; + return false; + } + KECustomRole kecr = customRole; + + if (arguments.Count == 1) + { + if (sender is PlayerCommandSender sender2) + { + Player player = Player.Get(sender2); + kecr.AddRole(player); + response = kecr.Name + " given to " + player.Nickname + "."; + return true; + } + + response = "Failed to provide a valid player."; + return false; + } + + string text = string.Join(" ", arguments.Skip(1)); + if (text == "*" || text == "all") + { + List list = ListPool.Pool.Get(Player.List); + foreach (Player item in list) + { + kecr.AddRole(item); + } + + response = "Custom role " + kecr.Name + " given to all players."; + ListPool.Pool.Return(list); + return true; + } + + IEnumerable processedData = Player.GetProcessedData(arguments, 1); + if (processedData.IsEmpty()) + { + response = "Cannot find player! Try using the player ID!"; + return false; + } + + foreach (Player item2 in processedData) + { + customRole.AddRole(item2); + } + + response = $"Customrole {customRole.Name} given to {processedData.Count()} players!"; + return true; + } + catch (Exception message) + { + Log.Error(message); + response = "Error"; + return false; + } + } + } +} diff --git a/KruacentExiled/KE.CustomRoles/Commands/KEParentCommand.cs b/KruacentExiled/KE.CustomRoles/Commands/KEParentCommand.cs new file mode 100644 index 00000000..aacaa58f --- /dev/null +++ b/KruacentExiled/KE.CustomRoles/Commands/KEParentCommand.cs @@ -0,0 +1,37 @@ +using CommandSystem; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace KE.CustomRoles.Commands +{ + [CommandHandler(typeof(RemoteAdminCommandHandler))] + [CommandHandler(typeof(GameConsoleCommandHandler))] + public class KEParentCommand : ParentCommand + { + + public KEParentCommand() + { + LoadGeneratedCommands(); + } + public override string Command => "kecustomrole"; + + public override string[] Aliases => ["kecr"]; + + public override string Description => string.Empty; + + public override void LoadGeneratedCommands() + { + RegisterCommand(new Lists.List()); + RegisterCommand(new Give()); + } + + protected override bool ExecuteParent(ArraySegment arguments, ICommandSender sender, out string response) + { + response = "Usage : list"; + return true; + } + } +} diff --git a/KruacentExiled/KE.CustomRoles/Commands/Lists/Abilities.cs b/KruacentExiled/KE.CustomRoles/Commands/Lists/Abilities.cs new file mode 100644 index 00000000..01c35e06 --- /dev/null +++ b/KruacentExiled/KE.CustomRoles/Commands/Lists/Abilities.cs @@ -0,0 +1,43 @@ +using CommandSystem; +using Exiled.API.Features.Pools; +using KE.CustomRoles.API.Features; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace KE.CustomRoles.Commands.Lists +{ + public class Abilities : ICommand + { + public string Command => "Ability"; + + public string[] Aliases => ["a"]; + + public string Description => throw new NotImplementedException(); + + public bool Execute(ArraySegment arguments, ICommandSender sender, out string response) + { + if(KEAbilities.Registered.Count == 0) + { + response = "no ability found"; + return false; + } + + StringBuilder sb = StringBuilderPool.Pool.Get(); + foreach(KEAbilities ability in KEAbilities.Registered.OrderBy(a => a.Name)) + { + sb.Append('[') + .Append(ability.Name) + .Append(" (") + .Append(ability.Description) + .Append(')') + .AppendLine("]"); + } + + response = StringBuilderPool.Pool.ToStringReturn(sb); + return true; + } + } +} diff --git a/KruacentExiled/KE.CustomRoles/Commands/Lists/List.cs b/KruacentExiled/KE.CustomRoles/Commands/Lists/List.cs new file mode 100644 index 00000000..ba6ad2e1 --- /dev/null +++ b/KruacentExiled/KE.CustomRoles/Commands/Lists/List.cs @@ -0,0 +1,40 @@ +using CommandSystem; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace KE.CustomRoles.Commands.Lists +{ + public class List : ParentCommand + { + public List() + { + LoadGeneratedCommands(); + } + public override string Command => "list"; + + public override string[] Aliases => ["l"]; + + public override string Description => ""; + + public override void LoadGeneratedCommands() + { + RegisterCommand(Registered.Instance); + RegisterCommand(new Abilities()); + } + + protected override bool ExecuteParent(ArraySegment arguments, ICommandSender sender, out string response) + { + if (arguments.IsEmpty() && TryGetCommand(Registered.Instance.Command, out var command)) + { + command.Execute(arguments, sender, out response); + response = response + "\nTo view all abilities registered use command: " + string.Join(" ", arguments.Array) + " abilities"; + return true; + } + response = "Usage : registered, abilities"; + return false; + } + } +} diff --git a/KruacentExiled/KE.CustomRoles/Commands/Lists/Registered.cs b/KruacentExiled/KE.CustomRoles/Commands/Lists/Registered.cs new file mode 100644 index 00000000..3a10297e --- /dev/null +++ b/KruacentExiled/KE.CustomRoles/Commands/Lists/Registered.cs @@ -0,0 +1,48 @@ +using CommandSystem; +using Exiled.API.Features.Pools; +using KE.CustomRoles.API.Features; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace KE.CustomRoles.Commands.Lists +{ + public class Registered : ICommand + { + public static Registered Instance = new(); + public string Command => "registered"; + + public string[] Aliases => ["r"]; + + public string Description => ""; + + private Registered() { } + + public bool Execute(ArraySegment arguments, ICommandSender sender, out string response) + { + if (KECustomRole.Registered.Count == 0) + { + response = "no role found"; + return false; + } + + StringBuilder sb = StringBuilderPool.Pool.Get(); + string[] name; + foreach (KECustomRole cr in KECustomRole.Registered.OrderBy(a => a.Name)) + { + name = cr.Name.Split('_'); + sb.Append('[') + .Append('(') + .Append(name[0]) + .Append(") ") + .Append(name[1]) + .AppendLine("]"); + } + + response = StringBuilderPool.Pool.ToStringReturn(sb); + return true; + } + } +} diff --git a/KruacentExiled/KE.CustomRoles/MainPlugin.cs b/KruacentExiled/KE.CustomRoles/MainPlugin.cs index 5ce1aa13..7590df23 100644 --- a/KruacentExiled/KE.CustomRoles/MainPlugin.cs +++ b/KruacentExiled/KE.CustomRoles/MainPlugin.cs @@ -43,15 +43,14 @@ public override void OnEnabled() Harmony.PatchAll(); SettingHandler.SubscribeEvents(); KEAbilities.Register(Assembly); - CustomRole.RegisterRoles(false); + KECustomRole.Register(); SubscribeEvents(); - } public override void OnDisabled() { - CustomRole.UnregisterRoles(); + KECustomRole.Unregister(); SettingHandler.UnsubscribeEvents(); Harmony.UnpatchAll(); @@ -75,13 +74,13 @@ public void UnsubscribeEvents() public void CustomRoleImplement() { - KECustomRole.GiveRole(Player.List); + KECustomRole.GiveRandomRole(Player.List); } public void CustomRoleRespawning(RespawnedTeamEventArgs ev) { - KECustomRole.GiveRole(ev.Players); + KECustomRole.GiveRandomRole(ev.Players); } public static void ShowEffectHint(Player player, string text) diff --git a/KruacentExiled/KE.CustomRoles/Settings/SettingHandler.cs b/KruacentExiled/KE.CustomRoles/Settings/SettingHandler.cs index 5d8d80e4..9de2662d 100644 --- a/KruacentExiled/KE.CustomRoles/Settings/SettingHandler.cs +++ b/KruacentExiled/KE.CustomRoles/Settings/SettingHandler.cs @@ -12,15 +12,15 @@ namespace KE.CustomRoles.Settings { internal class SettingHandler : IUsingEvents { - private int _idHeader = 148; - private int _idTimeCustomRole = 144; - private int _idDesc = 143; - private int _idMode = 145; - private int _idDown = 149; - private int _idUp = 150; - private int _idSelect = 151; - private int _idArrow = 152; - private int _idTimeAbilityDesc = 153; + private readonly int _idHeader = 148; + private readonly int _idTimeCustomRole = 144; + private readonly int _idDesc = 143; + private readonly int _idMode = 145; + private readonly int _idDown = 149; + private readonly int _idUp = 150; + private readonly int _idSelect = 151; + private readonly int _idArrow = 152; + private readonly int _idTimeAbilityDesc = 153; @@ -39,37 +39,13 @@ public SettingHandler() new TwoButtonsSetting(_idDesc,"Descriptions","Disabled","Enabled",true,"hide/show the description the Custom Role "), new SliderSetting(_idTimeCustomRole,"Time shown",0,30,20), new SliderSetting(_idTimeAbilityDesc,"Ability Description time shown",0,30,20), - new TwoButtonsSetting(_idMode,"Mode","Keybinds","Select wheel",true,onChanged:OnChanged), - new KeybindSetting(_idUp, "Select up", UnityEngine.KeyCode.None,hintDescription:"only work in Select Wheel mode"), - new KeybindSetting(_idDown, "Select down", UnityEngine.KeyCode.None,hintDescription:"only work in Select Wheel mode"), - new KeybindSetting(_idSelect, "Use selected ability", UnityEngine.KeyCode.None,hintDescription:"only work in Select Wheel mode"), - //this crashes the player idk why - SettingBase.Create(new SSPlaintextSetting(_idArrow, "Personalize the arrow next to the selected ability", baseArrow, 16, TMP_InputField.ContentType.Standard, "only work in Select Wheel mode", 0)) + new KeybindSetting(_idUp, "Select up", UnityEngine.KeyCode.None), + new KeybindSetting(_idDown, "Select down", UnityEngine.KeyCode.None), + new KeybindSetting(_idSelect, "Use selected ability", UnityEngine.KeyCode.None), + SettingBase.Create(new SSPlaintextSetting(_idArrow, "Personalize the arrow next to the selected ability", baseArrow, 16, TMP_InputField.ContentType.Standard, string.Empty, 0)) }; } - public void OnChanged(Player player, SettingBase setting) - { - - try - { - if (GetMode(player)) - { - KEAbilities.RemoveAllSelect(player); - } - else - { - KEAbilities.SelectFirstAbility(player); - } - } - catch(Exception e) - { - Log.Error(e); - } - - - } - public void SubscribeEvents() { @@ -106,17 +82,17 @@ private void SafeOnSettingValueReceived(ReferenceHub hub, ServerSpecificSettingB private void OnSettingValueReceived(Player player, ServerSpecificSettingBase settingBase) { - if (KEAbilities.CheckPressed(settingBase, _idDown)) + if (CheckPressed(settingBase, _idDown)) { DownPressed?.Invoke(player); } - if (KEAbilities.CheckPressed(settingBase, _idUp)) + if (CheckPressed(settingBase, _idUp)) { UpPressed?.Invoke(player); } - if (KEAbilities.CheckPressed(settingBase, _idSelect)) + if (CheckPressed(settingBase, _idSelect)) { KEAbilities.UseSelected(player); } @@ -178,9 +154,12 @@ private void Down(Player player) } } + public static bool CheckPressed(ServerSpecificSettingBase settingBase, int id) + { + return settingBase is SSKeybindSetting keybindSetting && keybindSetting.SettingId == id && keybindSetting.SyncIsPressed; + } - private void OnVerified(VerifiedEventArgs ev) { From aaf0dc573fa710b3f06ccc997fa7bca51b421d2c Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Sun, 2 Nov 2025 17:59:51 +0100 Subject: [PATCH 397/853] updated exiled + reduced damage by pressepuree --- .../API/Core/Settings/SettingsHandler.cs | 12 +++- .../API/Core/Upgrade/UpgradeHandler.cs | 4 +- .../API/Core/Upgrade/UpgradeProperties.cs | 5 +- .../KE.Items/API/Events/ExplodeEvent.cs | 25 +++++++ .../Events/OnExplodeDestructibleEventsArgs.cs | 25 +++++++ KruacentExiled/KE.Items/Items/PressePuree.cs | 26 +++++++- KruacentExiled/KE.Items/KE.Items.csproj | 3 +- KruacentExiled/KE.Items/MainPlugin.cs | 8 +++ .../Patches/ExplosionGrenadePatches.cs | 66 +++++++++++++++++++ 9 files changed, 164 insertions(+), 10 deletions(-) create mode 100644 KruacentExiled/KE.Items/API/Events/ExplodeEvent.cs create mode 100644 KruacentExiled/KE.Items/API/Events/OnExplodeDestructibleEventsArgs.cs create mode 100644 KruacentExiled/KE.Items/Patches/ExplosionGrenadePatches.cs diff --git a/KruacentExiled/KE.Items/API/Core/Settings/SettingsHandler.cs b/KruacentExiled/KE.Items/API/Core/Settings/SettingsHandler.cs index 802d7fd0..7cb69b0e 100644 --- a/KruacentExiled/KE.Items/API/Core/Settings/SettingsHandler.cs +++ b/KruacentExiled/KE.Items/API/Core/Settings/SettingsHandler.cs @@ -82,8 +82,16 @@ internal float GetTimeEffect(Player p) /// true if the player wants description ; false otherwise internal bool GetDescriptionsSettings(Player p) { - if (!SettingBase.TryGetSetting(p, _idDesc, out var setting)) return true; - return setting.IsSecond; + try + { + if (!SettingBase.TryGetSetting(p, _idDesc, out var setting)) return true; + return setting.IsSecond; + } + catch(InvalidCastException e) + { + Log.Error(e); + } + return true; } /// diff --git a/KruacentExiled/KE.Items/API/Core/Upgrade/UpgradeHandler.cs b/KruacentExiled/KE.Items/API/Core/Upgrade/UpgradeHandler.cs index dd2a081c..d7ed060b 100644 --- a/KruacentExiled/KE.Items/API/Core/Upgrade/UpgradeHandler.cs +++ b/KruacentExiled/KE.Items/API/Core/Upgrade/UpgradeHandler.cs @@ -71,11 +71,11 @@ private bool UpgradeCheck(IUpgradableCustomItem upgradable, Scp914KnobSetting kn if (!upgradable.Upgrade.TryGetValue(knob, out UpgradeProperties item)) return false; if (MainPlugin.Instance.Config.Debug) { + Log.Warn("debug activated!"); return true; } float random = UnityEngine.Random.Range(0f, 100f); - if (random < item.Chance) return true; - return false; + return random < item.Chance; } } diff --git a/KruacentExiled/KE.Items/API/Core/Upgrade/UpgradeProperties.cs b/KruacentExiled/KE.Items/API/Core/Upgrade/UpgradeProperties.cs index de46277e..1b386592 100644 --- a/KruacentExiled/KE.Items/API/Core/Upgrade/UpgradeProperties.cs +++ b/KruacentExiled/KE.Items/API/Core/Upgrade/UpgradeProperties.cs @@ -5,6 +5,7 @@ using System.Runtime.ExceptionServices; using System.Text; using System.Threading.Tasks; +using UnityEngine; using YamlDotNet.Core.Tokens; namespace KE.Items.API.Core.Upgrade @@ -26,9 +27,7 @@ public uint UpgradedItem public UpgradeProperties(float chance, uint newItem) { _newItem = newItem; - if (chance > 100) _chance = 100; - else if (chance < 0) _chance = 0; - else _chance = chance; + _chance = Mathf.Clamp(chance, 0,100); } } diff --git a/KruacentExiled/KE.Items/API/Events/ExplodeEvent.cs b/KruacentExiled/KE.Items/API/Events/ExplodeEvent.cs new file mode 100644 index 00000000..75628c61 --- /dev/null +++ b/KruacentExiled/KE.Items/API/Events/ExplodeEvent.cs @@ -0,0 +1,25 @@ +using InventorySystem.Items.ThrowableProjectiles; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace KE.Items.API.Events +{ + public static class ExplodeEvent + { + + public static event Action ExplodeDestructible = delegate { }; + + + public static void OnExplodeDestructible(OnExplodeDestructibleEventsArgs ev) + { + ExplodeDestructible?.Invoke(ev); + } + + + + + } +} diff --git a/KruacentExiled/KE.Items/API/Events/OnExplodeDestructibleEventsArgs.cs b/KruacentExiled/KE.Items/API/Events/OnExplodeDestructibleEventsArgs.cs new file mode 100644 index 00000000..d87c3b6e --- /dev/null +++ b/KruacentExiled/KE.Items/API/Events/OnExplodeDestructibleEventsArgs.cs @@ -0,0 +1,25 @@ +using InventorySystem.Items.ThrowableProjectiles; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace KE.Items.API.Events +{ + public class OnExplodeDestructibleEventsArgs + { + + public IDestructible Destructible { get; set; } + public float Damage { get; set; } + public ExplosionGrenade ExplosionGrenade { get;} + public OnExplodeDestructibleEventsArgs(IDestructible destructible,float damage, ExplosionGrenade explosionGrenade) + { + Destructible = destructible; + Damage = damage; + ExplosionGrenade = explosionGrenade; + } + + + } +} diff --git a/KruacentExiled/KE.Items/Items/PressePuree.cs b/KruacentExiled/KE.Items/Items/PressePuree.cs index 300b3a7a..e81d9fed 100644 --- a/KruacentExiled/KE.Items/Items/PressePuree.cs +++ b/KruacentExiled/KE.Items/Items/PressePuree.cs @@ -1,17 +1,19 @@  -using System; -using System.Collections.Generic; using Exiled.API.Enums; using Exiled.API.Features; using Exiled.API.Features.Attributes; +using Exiled.API.Features.Pickups.Projectiles; using Exiled.API.Features.Spawn; using Exiled.CustomItems.API.Features; using Exiled.Events.EventArgs.Scp914; using KE.Items.API.Core.Upgrade; +using KE.Items.API.Events; using KE.Items.API.Features; using KE.Items.API.Interface; using KE.Items.Items.PickupModels; using Scp914; +using System; +using System.Collections.Generic; namespace KE.Items.Items { @@ -63,15 +65,35 @@ public PressePuree() protected override void SubscribeEvents() { PickupModel.SubscribeEvents(); + ExplodeEvent.ExplodeDestructible += OnExplodeDestructible; base.SubscribeEvents(); } protected override void UnsubscribeEvents() { PickupModel.UnsubscribeEvents(); + ExplodeEvent.ExplodeDestructible -= OnExplodeDestructible; base.UnsubscribeEvents(); } + private void OnExplodeDestructible(OnExplodeDestructibleEventsArgs ev) + { + Log.Info(ev.Damage); + Player player = Player.Get(ev.Destructible.NetworkId); + if (!Check(Projectile.Get(ev.ExplosionGrenade))) return; + if (ev.Damage < 0f) return; + ev.Damage /= 2; + + + + if(player is not null && player.IsScp) + { + ev.Damage /= 3; + } + + + } + public IReadOnlyDictionary Upgrade { get; private set; } = new Dictionary() { //very fine -> true divine pills 10% diff --git a/KruacentExiled/KE.Items/KE.Items.csproj b/KruacentExiled/KE.Items/KE.Items.csproj index 93ca0e6c..aa8701a1 100644 --- a/KruacentExiled/KE.Items/KE.Items.csproj +++ b/KruacentExiled/KE.Items/KE.Items.csproj @@ -6,7 +6,8 @@ - + + diff --git a/KruacentExiled/KE.Items/MainPlugin.cs b/KruacentExiled/KE.Items/MainPlugin.cs index e415103c..5d667186 100644 --- a/KruacentExiled/KE.Items/MainPlugin.cs +++ b/KruacentExiled/KE.Items/MainPlugin.cs @@ -3,9 +3,12 @@ using Exiled.API.Features; using Exiled.API.Features.Toys; using Exiled.CustomItems.API.Features; +using HarmonyLib; +using InventorySystem.Items.ThrowableProjectiles; using KE.Items.API.Core.Lights; using KE.Items.API.Core.Settings; using KE.Items.API.Core.Upgrade; +using KE.Items.API.Events; using KE.Items.API.Features.Complexes; using KE.Utils.API.Displays.DisplayMeow; using System; @@ -34,10 +37,13 @@ public class MainPlugin : Plugin public override PluginPriority Priority => PluginPriority.Low; public override Version Version => new (1, 0, 0); + internal Harmony harmony; public override void OnEnabled() { Instance = this; + harmony = new(Name); + harmony.PatchAll(Assembly); //QualityHandler = QualityHandler.Instance; //QualityHandler.Register(); UpgradeHandler = new UpgradeHandler(); @@ -45,6 +51,7 @@ public override void OnEnabled() //PickupQuality = new PickupQuality(); SettingsHandler = new(); + Utils.API.Sounds.SoundPlayer.Load(); @@ -72,6 +79,7 @@ public override void OnDisabled() //QualityHandler = null; //PickupQuality = null; + harmony.UnpatchAll(harmony.Id); SettingsHandler = null; LightsHandler = null; UpgradeHandler = null; diff --git a/KruacentExiled/KE.Items/Patches/ExplosionGrenadePatches.cs b/KruacentExiled/KE.Items/Patches/ExplosionGrenadePatches.cs new file mode 100644 index 00000000..de7c7507 --- /dev/null +++ b/KruacentExiled/KE.Items/Patches/ExplosionGrenadePatches.cs @@ -0,0 +1,66 @@ +using Exiled.API.Features; +using Exiled.API.Features.Pools; +using Exiled.Events.EventArgs.Map; +using Footprinting; +using HarmonyLib; +using InventorySystem.Items.ThrowableProjectiles; +using KE.Items.API.Events; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Reflection; +using System.Reflection.Emit; +using System.Runtime.InteropServices; +using System.Text; +using System.Threading.Tasks; +using UnityEngine; +using static HarmonyLib.AccessTools; + +namespace KE.Items.Patches +{ + public static class ExplosionGrenadePatches + { + + [HarmonyPatch(typeof(ExplosionGrenade),nameof(ExplosionGrenade.ExplodeDestructible))] + public static class ExplodeDestructiblePatch + { + public static IEnumerable Transpiler(IEnumerable instructions) + { + var codes = new List(instructions); + + var argsCtor = AccessTools.Constructor(typeof(OnExplodeDestructibleEventsArgs), + new[] { typeof(IDestructible), typeof(float), typeof(ExplosionGrenade) }); + var eventInvoker = AccessTools.Method(typeof(ExplodeEvent), nameof(ExplodeEvent.OnExplodeDestructible)); + var damageGetter = AccessTools.PropertyGetter(typeof(OnExplodeDestructibleEventsArgs), nameof(OnExplodeDestructibleEventsArgs.Damage)); + + for (int i = 0; i < codes.Count - 2; i++) + { + // Look for Vector3::op_Addition followed by any stloc.* instruction + if (codes[i].Calls(AccessTools.Method(typeof(Vector3), "op_Addition")) && + codes[i + 1].opcode.Name.StartsWith("stloc")) + { + var injectionIndex = i + 2; + + codes.InsertRange(injectionIndex, new[] + { + // Create and fire event + new CodeInstruction(OpCodes.Ldarg_0), // dest + new CodeInstruction(OpCodes.Ldloc_2), // num + new CodeInstruction(OpCodes.Ldarg_3), // setts + new CodeInstruction(OpCodes.Newobj, argsCtor), + new CodeInstruction(OpCodes.Dup), + new CodeInstruction(OpCodes.Call, eventInvoker), + new CodeInstruction(OpCodes.Callvirt, damageGetter), + new CodeInstruction(OpCodes.Stloc_2), + }); + + UnityEngine.Debug.Log("[ExplosionPatch] Injected OnPreExplodeDestructible successfully"); + break; + } + } + + return codes; + } + } + } +} From f73abcc2eb4438d1d22f90d258abf5fe29a11bcf Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Sun, 2 Nov 2025 18:06:52 +0100 Subject: [PATCH 398/853] added config --- KruacentExiled/KE.Map/MainPlugin.cs | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/KruacentExiled/KE.Map/MainPlugin.cs b/KruacentExiled/KE.Map/MainPlugin.cs index 59b5a978..1269358d 100644 --- a/KruacentExiled/KE.Map/MainPlugin.cs +++ b/KruacentExiled/KE.Map/MainPlugin.cs @@ -67,13 +67,17 @@ public override void OnEnabled() private void OnRoundStarted() { - Player player = Player.List.First(); - //StructureSpawner.SpawnPedestal(ItemType.KeycardJanitor,player.Position,Quaternion.identity,Vector3.one); + if (Config.Debug) + { + Player player = Player.List.First(); + //StructureSpawner.SpawnPedestal(ItemType.KeycardJanitor,player.Position,Quaternion.identity,Vector3.one); - //player.Teleport(Room.List.Where(r => r.Type == Exiled.API.Enums.RoomType.EzVent).First()); + //player.Teleport(Room.List.Where(r => r.Type == Exiled.API.Enums.RoomType.EzVent).First()); - player.Teleport(teleport); + player.Teleport(teleport); + } + } @@ -138,8 +142,11 @@ private void OpenDoor(InteractingDoorEventArgs ev) private void OnGenerated() { - CustomZone(); - /*Door lcz173 = Door.Get(Exiled.API.Enums.DoorType.Scp173Gate); + if (Config.Debug) + { + CustomZone(); + } + Door lcz173 = Door.Get(Exiled.API.Enums.DoorType.Scp173Gate); HashSet normal = new() { new(ItemType.KeycardO5,1,2), @@ -176,7 +183,7 @@ private void OnGenerated() var g = new GamblingRoom(RoleTypeId.Scp173.GetRandomSpawnLocation().Position + Vector3.down, new(normal)); - */ + From 538d21c5a249c72b387305f36ec21b0343f961ea Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Sun, 2 Nov 2025 18:15:56 +0100 Subject: [PATCH 399/853] configs --- KruacentExiled/KE.Map/MainPlugin.cs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/KruacentExiled/KE.Map/MainPlugin.cs b/KruacentExiled/KE.Map/MainPlugin.cs index 1269358d..67e063d8 100644 --- a/KruacentExiled/KE.Map/MainPlugin.cs +++ b/KruacentExiled/KE.Map/MainPlugin.cs @@ -133,7 +133,7 @@ private void CustomZone() private void OpenDoor(InteractingDoorEventArgs ev) { - if(ev.Door.Zone == Exiled.API.Enums.ZoneType.HeavyContainment) + if(Config.Debug && ev.Door.Zone == Exiled.API.Enums.ZoneType.HeavyContainment) { ev.Player.Teleport(teleport); } @@ -183,11 +183,10 @@ private void OnGenerated() var g = new GamblingRoom(RoleTypeId.Scp173.GetRandomSpawnLocation().Position + Vector3.down, new(normal)); - - - //var g = new GamblingRoom(lcz173, new(normal), -lcz173.Transform.forward * 5f); + + /* if (Config.Debug) From 239ea776aa2cc84a8658430c997c051674023cef Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Sun, 2 Nov 2025 18:23:38 +0100 Subject: [PATCH 400/853] correted typo --- .../Features/GamblingCoin/Effect/PositiveEffect/NiceHat.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/KruacentExiled/KE.Misc/Features/GamblingCoin/Effect/PositiveEffect/NiceHat.cs b/KruacentExiled/KE.Misc/Features/GamblingCoin/Effect/PositiveEffect/NiceHat.cs index 6be26bea..35ae58b7 100644 --- a/KruacentExiled/KE.Misc/Features/GamblingCoin/Effect/PositiveEffect/NiceHat.cs +++ b/KruacentExiled/KE.Misc/Features/GamblingCoin/Effect/PositiveEffect/NiceHat.cs @@ -13,6 +13,6 @@ internal class NiceHat : ICoinEffect public void Execute(Player player) { - Pickup.CreateAndSpawn(ItemType.SCP268, player.Position, Quaternion.identitys); + Pickup.CreateAndSpawn(ItemType.SCP268, player.Position, Quaternion.identity); } } \ No newline at end of file From 09730bdb0363b3aac3b59bc481759bdc201ce1b8 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Sun, 2 Nov 2025 18:39:17 +0100 Subject: [PATCH 401/853] upadted exileid agaoj --- KruacentExiled/KE.CustomRoles/KE.CustomRoles.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/KruacentExiled/KE.CustomRoles/KE.CustomRoles.csproj b/KruacentExiled/KE.CustomRoles/KE.CustomRoles.csproj index a96f8fbc..4d986391 100644 --- a/KruacentExiled/KE.CustomRoles/KE.CustomRoles.csproj +++ b/KruacentExiled/KE.CustomRoles/KE.CustomRoles.csproj @@ -5,7 +5,7 @@ - + From f7b2beba922ea0052af0b3d39b9ed5236960e356 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Sun, 2 Nov 2025 18:40:10 +0100 Subject: [PATCH 402/853] updated exiled agian --- KruacentExiled/KE.Items/KE.Items.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/KruacentExiled/KE.Items/KE.Items.csproj b/KruacentExiled/KE.Items/KE.Items.csproj index aa8701a1..e9925a5c 100644 --- a/KruacentExiled/KE.Items/KE.Items.csproj +++ b/KruacentExiled/KE.Items/KE.Items.csproj @@ -6,7 +6,7 @@ - + From 80e73df6aaca5077c5535ef21c67acabfcb0a1a1 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Sun, 2 Nov 2025 19:14:41 +0100 Subject: [PATCH 403/853] update --- KruacentExiled/KE.Misc/KE.Misc.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/KruacentExiled/KE.Misc/KE.Misc.csproj b/KruacentExiled/KE.Misc/KE.Misc.csproj index 3c0ec403..b16800e1 100644 --- a/KruacentExiled/KE.Misc/KE.Misc.csproj +++ b/KruacentExiled/KE.Misc/KE.Misc.csproj @@ -6,7 +6,7 @@ - + From 284e83d3d5d41fdb120518621cc890288a042db4 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Sun, 2 Nov 2025 19:25:59 +0100 Subject: [PATCH 404/853] to hashset --- KruacentExiled/KE.Map/CustomZones/CustomRoom.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/KruacentExiled/KE.Map/CustomZones/CustomRoom.cs b/KruacentExiled/KE.Map/CustomZones/CustomRoom.cs index 85f6a04f..27d778a9 100644 --- a/KruacentExiled/KE.Map/CustomZones/CustomRoom.cs +++ b/KruacentExiled/KE.Map/CustomZones/CustomRoom.cs @@ -43,7 +43,7 @@ public SpawnedCustomRoom Spawn(Vector2Int coord,Vector3 rotation,Vector3 spawnzo } - SpawnedCustomRoom room = new(this, Shape, position,rotation, coord, prims); + SpawnedCustomRoom room = new(this, Shape, position,rotation, coord, prims.ToHashSet()); room.Spawn(); SpawnedRoom.Add(room); return room; From e937dc8f26d9bde022254c9d9c716b17ef1d9535 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Sun, 2 Nov 2025 21:40:52 +0100 Subject: [PATCH 405/853] no spawn --- KruacentExiled/KE.Misc/MainPlugin.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/KruacentExiled/KE.Misc/MainPlugin.cs b/KruacentExiled/KE.Misc/MainPlugin.cs index 7986b369..e3668c86 100644 --- a/KruacentExiled/KE.Misc/MainPlugin.cs +++ b/KruacentExiled/KE.Misc/MainPlugin.cs @@ -53,7 +53,7 @@ public override void OnEnabled() AutoNukeAnnoucement = new(); AutoTesla = new(); Candy = new Candy(); - SpawnLcz = new(); + //SpawnLcz = new(); Respawn.SetTokens(SpawnableFaction.NtfWave, 2); Respawn.SetTokens(SpawnableFaction.ChaosWave, 2); @@ -97,7 +97,7 @@ public override void OnDisabled() _914 = null; Candy = null; - SpawnLcz = null; + //SpawnLcz = null; ClassDDoor = null; ServerHandler = null; SCPBuff = null; From a6d87c906be5ff11cd6c9c92588811a6f420de75 Mon Sep 17 00:00:00 2001 From: OmerGS <27omerf@gmail.com> Date: Mon, 3 Nov 2025 14:44:53 +0100 Subject: [PATCH 406/853] fix #124 --- .../ItemEffects/SmokeGrenadeEffect.cs | 57 +++++++++++++++ KruacentExiled/KE.Items/Items/SmokeGrenade.cs | 69 +++++++++++++++++++ 2 files changed, 126 insertions(+) create mode 100644 KruacentExiled/KE.Items/ItemEffects/SmokeGrenadeEffect.cs create mode 100644 KruacentExiled/KE.Items/Items/SmokeGrenade.cs diff --git a/KruacentExiled/KE.Items/ItemEffects/SmokeGrenadeEffect.cs b/KruacentExiled/KE.Items/ItemEffects/SmokeGrenadeEffect.cs new file mode 100644 index 00000000..6ca8c033 --- /dev/null +++ b/KruacentExiled/KE.Items/ItemEffects/SmokeGrenadeEffect.cs @@ -0,0 +1,57 @@ +using Exiled.API.Features.Items; +using Exiled.API.Features.Pickups; +using Exiled.Events.EventArgs.Map; +using Exiled.Events.EventArgs.Player; +using KE.Items.Extensions; +using KE.Items.Interface; +using MEC; +using System.ComponentModel; +using UnityEngine; + +namespace KE.Items.ItemEffects +{ + public class SmokeGrenadeEffect : CustomItemEffect + { + public bool RemoveSmoke { get; set; } = true; + [Description("If RemoveSmoke is true, how long does it take before the smoke will be removed")] + public float FogTime { get; set; } = 15; + + public override void Effect(UsedItemEventArgs ev) + { + + } + public override void Effect(DroppingItemEventArgs ev) + { + ev.Player.ItemEffectHint("No grandson don't leave me !"); + } + + public override void Effect(ExplodingGrenadeEventArgs ev) + { + OnExploding(ev); + } + + public void OnExploding(ExplodingGrenadeEventArgs ev) + { + ev.IsAllowed = false; + Vector3 savedGrenadePosition = ev.Position; + Scp244 scp244 = (Scp244)Item.Create(ItemType.SCP244a); + Pickup pickup = null; + scp244.Scale = new Vector3(0.01f, 0.01f, 0.01f); + scp244.Primed = true; + scp244.MaxDiameter = 0.0f; + pickup = scp244.CreatePickup(savedGrenadePosition); + if (RemoveSmoke) + { + Timing.CallDelayed(FogTime, () => + { + pickup.Position += Vector3.down * 10; + + Timing.CallDelayed(10, () => + { + pickup.Destroy(); + }); + }); + } + } + } +} \ No newline at end of file diff --git a/KruacentExiled/KE.Items/Items/SmokeGrenade.cs b/KruacentExiled/KE.Items/Items/SmokeGrenade.cs new file mode 100644 index 00000000..7e936eb7 --- /dev/null +++ b/KruacentExiled/KE.Items/Items/SmokeGrenade.cs @@ -0,0 +1,69 @@ +using System.Collections.Generic; +using Exiled.API.Enums; +using Exiled.API.Features.Attributes; +using Exiled.API.Features.Spawn; +using Exiled.CustomItems.API.Features; +using Exiled.Events.EventArgs.Map; +using KE.Items.Features; +using KE.Items.Interface; +using KE.Items.ItemEffects; + +namespace KE.Items.Items +{ + [CustomItem(ItemType.Flashlight)] + public class SmokeGrenade : KECustomGrenade, ISwichableEffect + { + public override uint Id { get; set; } = 1071; + public override string Name { get; set; } = "Smoke Grenade"; + public override string Description { get; set; } = "We finally put your grandma inside this thing ! Don't throw it or she will get out !"; + public override float Weight { get; set; } = 0.65f; + public override float FuseTime { get; set; } = 3f; + public override bool ExplodeOnCollision { get; set; } = false; + public UnityEngine.Color Color { get; set; } = UnityEngine.Color.black; + public CustomItemEffect Effect { get; set; } + public override SpawnProperties SpawnProperties { get; set; } = new SpawnProperties() + { + Limit = 3, + DynamicSpawnPoints = new List + { + new DynamicSpawnPoint() + { + Chance = 50, + Location = SpawnLocationType.Inside939Cryo, + }, + new DynamicSpawnPoint() + { + Chance = 5, + Location = SpawnLocationType.Inside914, + }, + new DynamicSpawnPoint() + { + Chance= 50, + Location = SpawnLocationType.InsideGateA, + } + }, + + }; + + public SmokeGrenade() + { + Effect = new SmokeGrenadeEffect(); + } + + protected override void OnExploding(ExplodingGrenadeEventArgs ev) + { + Effect.Effect(ev); + ev.TargetsToAffect.Clear(); + } + + protected override void SubscribeEvents() + { + base.SubscribeEvents(); + } + + protected override void UnsubscribeEvents() + { + base.UnsubscribeEvents(); + } + } +} \ No newline at end of file From 0581848b333a7e3a4ce8b3975f21954819b023b6 Mon Sep 17 00:00:00 2001 From: OmerGS <27omerf@gmail.com> Date: Mon, 3 Nov 2025 14:46:01 +0100 Subject: [PATCH 407/853] fix #126 --- .../ItemEffects/ProximityGrenadeEffect.cs | 87 +++++++++++++++++++ .../KE.Items/Items/ProximityGrenade.cs | 64 ++++++++++++++ 2 files changed, 151 insertions(+) create mode 100644 KruacentExiled/KE.Items/ItemEffects/ProximityGrenadeEffect.cs create mode 100644 KruacentExiled/KE.Items/Items/ProximityGrenade.cs diff --git a/KruacentExiled/KE.Items/ItemEffects/ProximityGrenadeEffect.cs b/KruacentExiled/KE.Items/ItemEffects/ProximityGrenadeEffect.cs new file mode 100644 index 00000000..8aca70cd --- /dev/null +++ b/KruacentExiled/KE.Items/ItemEffects/ProximityGrenadeEffect.cs @@ -0,0 +1,87 @@ +using AdminToys; +using Exiled.API.Enums; +using Exiled.API.Features.Toys; +using Exiled.Events.EventArgs.Map; +using Exiled.Events.EventArgs.Player; +using KE.Items.Extensions; +using KE.Items.Interface; +using MEC; +using System.Collections.Generic; +using UnityEngine; +using Exiled.API.Features; + +namespace KE.Items.ItemEffects +{ + public class ProximityGrenadeEffect : CustomItemEffect + { + public float Duration { get; set; } = 10; + public float Range { get; set; } = 50; + + public override void Effect(UsedItemEventArgs ev) + { + + } + public override void Effect(DroppingItemEventArgs ev) + { + + } + + public override void Effect(ExplodingGrenadeEventArgs ev) + { + OnExploding(ev); + } + + public void OnExploding(ExplodingGrenadeEventArgs ev) + { + ev.IsAllowed = false; + foreach (Player player in Player.List) + { + if (Vector3.Distance(ev.Position, player.Position) <= Range) + { + var color = GetTeamColor(player); + var lineColor = new Color(color.red, color.green, color.blue); + var direction = player.Position - ev.Position; + var distance = direction.magnitude; + var scale = new Vector3(0.1f, distance * 0.5f, 0.1f); + var laserPos = ev.Position + direction * 0.5f; + var rotation = Quaternion.LookRotation(direction) * Quaternion.Euler(90, 0, 0); + var laser = Primitive.Create(PrimitiveType.Cylinder, PrimitiveFlags.Visible, laserPos, rotation.eulerAngles, + scale, true, lineColor); + Timing.CallDelayed(this.Duration, laser.Destroy); + } + } + } + public (float red, float green, float blue) GetTeamColor(Player player) + { + float red; + float green; + float blue; + + switch (player.Role.Side) + { + case Side.Mtf: + red = 0; + green = 0.39f; + blue = 1; + break; + case Side.ChaosInsurgency: + red = 0; + green = 0.51f; + blue = 0; + break; + case Side.Scp: + red = 0.59f; + green = 0; + blue = 0; + break; + default: + red = 1; + green = 0.41f; + blue = 0.71f; + break; + } + + return (red, green, blue); + } + } +} \ No newline at end of file diff --git a/KruacentExiled/KE.Items/Items/ProximityGrenade.cs b/KruacentExiled/KE.Items/Items/ProximityGrenade.cs new file mode 100644 index 00000000..40e0b960 --- /dev/null +++ b/KruacentExiled/KE.Items/Items/ProximityGrenade.cs @@ -0,0 +1,64 @@ +using System.Collections.Generic; +using Exiled.API.Enums; +using Exiled.API.Features.Attributes; +using Exiled.API.Features.Spawn; +using Exiled.CustomItems.API.Features; +using Exiled.Events.EventArgs.Map; +using KE.Items.Features; +using KE.Items.Interface; +using KE.Items.ItemEffects; + +namespace KE.Items.Items +{ + [CustomItem(ItemType.Flashlight)] + public class ProximityGrenade : KECustomGrenade, ISwichableEffect + { + public override uint Id { get; set; } = 1073; + public override string Name { get; set; } = "Proximity Grenade"; + public override string Description { get; set; } = "It will show line to all players"; + public override float Weight { get; set; } = 0.65f; + public override float FuseTime { get; set; } = 10f; + public override bool ExplodeOnCollision { get; set; } = false; + public UnityEngine.Color Color { get; set; } = UnityEngine.Color.red; + public CustomItemEffect Effect { get; set; } + public override SpawnProperties SpawnProperties { get; set; } = new SpawnProperties() + { + Limit = 2, + DynamicSpawnPoints = new List + { + new DynamicSpawnPoint() + { + Chance = 50, + Location = SpawnLocationType.Inside049Armory, + }, + new DynamicSpawnPoint() + { + Chance = 50, + Location = SpawnLocationType.Inside127Lab, + } + }, + + }; + + public ProximityGrenade() + { + Effect = new ProximityGrenadeEffect(); + } + + protected override void OnExploding(ExplodingGrenadeEventArgs ev) + { + Effect.Effect(ev); + ev.TargetsToAffect.Clear(); + } + + protected override void SubscribeEvents() + { + base.SubscribeEvents(); + } + + protected override void UnsubscribeEvents() + { + base.UnsubscribeEvents(); + } + } +} \ No newline at end of file From be577c3d52226544d361c6021306cd3d31ca34c2 Mon Sep 17 00:00:00 2001 From: OmerGS <27omerf@gmail.com> Date: Mon, 3 Nov 2025 14:47:29 +0100 Subject: [PATCH 408/853] fix #127 --- .../ItemEffects/LowGravityGrenadeEffect.cs | 54 +++++++++++++++ .../KE.Items/Items/LowGravityGrenade.cs | 69 +++++++++++++++++++ 2 files changed, 123 insertions(+) create mode 100644 KruacentExiled/KE.Items/ItemEffects/LowGravityGrenadeEffect.cs create mode 100644 KruacentExiled/KE.Items/Items/LowGravityGrenade.cs diff --git a/KruacentExiled/KE.Items/ItemEffects/LowGravityGrenadeEffect.cs b/KruacentExiled/KE.Items/ItemEffects/LowGravityGrenadeEffect.cs new file mode 100644 index 00000000..31d5c7b7 --- /dev/null +++ b/KruacentExiled/KE.Items/ItemEffects/LowGravityGrenadeEffect.cs @@ -0,0 +1,54 @@ +using Exiled.API.Features; +using Exiled.Events.EventArgs.Map; +using Exiled.Events.EventArgs.Player; +using KE.Items.Extensions; +using KE.Items.Interface; +using MEC; +using System.Collections.Generic; +using UnityEngine; +using PlayerLab = LabApi.Features.Wrappers.Player; + +namespace KE.Items.ItemEffects +{ + public class LowGravityGrenadeEffect : CustomItemEffect + { + private Dictionary _effectedPlayers = new(); + public Vector3 LowGravity { get; set; } = new(0, -12.60f, 0); + public float Duration { get; set; } = 15f; + public float Range { get; set; } = 10f; + + public override void Effect(UsedItemEventArgs ev) + { + + } + public override void Effect(DroppingItemEventArgs ev) + { + ev.Player.ItemEffectHint("No grandson don't leave me !"); + } + + public override void Effect(ExplodingGrenadeEventArgs ev) + { + OnExploding(ev); + } + + public void OnExploding(ExplodingGrenadeEventArgs ev) + { + ev.IsAllowed = false; + + foreach (Player player in Player.List) + { + if (Vector3.Distance(ev.Position, player.Position) <= this.Range) + { + Vector3 previousGravity = PlayerLab.Get(player.NetworkIdentity)!.Gravity; + _effectedPlayers[player] = previousGravity; + PlayerLab.Get(player.NetworkIdentity)!.Gravity = LowGravity; + Timing.CallDelayed(this.Duration, () => + { + PlayerLab.Get(ev.Player.NetworkIdentity)!.Gravity = _effectedPlayers[ev.Player]; + _effectedPlayers.Remove(ev.Player); + }); + } + } + } + } +} \ No newline at end of file diff --git a/KruacentExiled/KE.Items/Items/LowGravityGrenade.cs b/KruacentExiled/KE.Items/Items/LowGravityGrenade.cs new file mode 100644 index 00000000..22a84436 --- /dev/null +++ b/KruacentExiled/KE.Items/Items/LowGravityGrenade.cs @@ -0,0 +1,69 @@ +using System.Collections.Generic; +using Exiled.API.Enums; +using Exiled.API.Features.Attributes; +using Exiled.API.Features.Spawn; +using Exiled.CustomItems.API.Features; +using Exiled.Events.EventArgs.Map; +using KE.Items.Features; +using KE.Items.Interface; +using KE.Items.ItemEffects; + +namespace KE.Items.Items +{ + [CustomItem(ItemType.GrenadeHE)] + public class LowGravityGrenade : KECustomGrenade, ISwichableEffect + { + public override uint Id { get; set; } = 1072; + public override string Name { get; set; } = "Low Gravity Grenade"; + public override string Description { get; set; } = "You always wanna be on the moon, if the answer is yes this grenade will grant your wishes !"; + public override float Weight { get; set; } = 0.65f; + public override float FuseTime { get; set; } = 3f; + public override bool ExplodeOnCollision { get; set; } = false; + public UnityEngine.Color Color { get; set; } = UnityEngine.Color.gray; + public CustomItemEffect Effect { get; set; } + public override SpawnProperties SpawnProperties { get; set; } = new SpawnProperties() + { + Limit = 3, + DynamicSpawnPoints = new List + { + new DynamicSpawnPoint() + { + Chance = 50, + Location = SpawnLocationType.Inside096, + }, + new DynamicSpawnPoint() + { + Chance = 5, + Location = SpawnLocationType.Inside914, + }, + new DynamicSpawnPoint() + { + Chance= 50, + Location = SpawnLocationType.Inside127Lab, + } + }, + + }; + + public LowGravityGrenade() + { + Effect = new LowGravityGrenadeEffect(); + } + + protected override void OnExploding(ExplodingGrenadeEventArgs ev) + { + Effect.Effect(ev); + ev.TargetsToAffect.Clear(); + } + + protected override void SubscribeEvents() + { + base.SubscribeEvents(); + } + + protected override void UnsubscribeEvents() + { + base.UnsubscribeEvents(); + } + } +} \ No newline at end of file From 307344abac461e5bf0f0e9c24f575f51bb2cf31e Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Mon, 10 Nov 2025 16:27:19 +0100 Subject: [PATCH 409/853] started hiding last player --- KruacentExiled/KE.Misc/Features/SCPBuff.cs | 37 +++++++++++++++++++--- 1 file changed, 32 insertions(+), 5 deletions(-) diff --git a/KruacentExiled/KE.Misc/Features/SCPBuff.cs b/KruacentExiled/KE.Misc/Features/SCPBuff.cs index cc379c25..788e04d3 100644 --- a/KruacentExiled/KE.Misc/Features/SCPBuff.cs +++ b/KruacentExiled/KE.Misc/Features/SCPBuff.cs @@ -2,6 +2,8 @@ using Exiled.API.Features; using Exiled.Events.EventArgs.Player; using Exiled.Permissions.Commands.Permissions; +using KE.Utils.API.Interfaces; +using KE.Utils.Extensions; using MEC; using PlayerRoles; using System.Collections.Generic; @@ -10,12 +12,22 @@ namespace KE.Misc.Features { - internal class SCPBuff + internal class SCPBuff : IUsingEvents { internal const float RefreshRate = 1f; - internal float IncreaseSCPHealth { get; } = 1.5f; + internal float IncreaseSCPHealth { get; } = 1.25f; internal SCPBuff() { } + public void SubscribeEvents() + { + Exiled.Events.Handlers.Player.Died += OnDied; + } + + public void UnsubscribeEvents() + { + Exiled.Events.Handlers.Player.Died -= OnDied; + } + internal void StartBuff() { @@ -23,12 +35,25 @@ internal void StartBuff() } + private Npc npc = null; + private void OnDied(DiedEventArgs ev) + { + if (Player.Enumerable.Count(p => !p.IsScp && p.IsAlive) > 1) return; + + if(npc is null) + { + SpawnFakePlayer(); + } + } - internal void BuffXp() + private void SpawnFakePlayer() { - + npc = Npc.Spawn("hide", RoleTypeId.ClassD, true, Vector3.zero); + npc.Hide(); + } + internal void BecomingSCP(ChangingRoleEventArgs ev) { @@ -102,7 +127,7 @@ private bool IsPlayerInZone(Player player, Vector3 zonePosition, float radius, f /// true if it's not over the max HumeShield of the player; false otherwise private bool AddHumeShield(Player p, float hum) { - float max = p.HumeShieldStat.MaxValue; + float max = p.MaxHumeShield; if (max < hum + p.HumeShield) { p.HumeShield = max; @@ -111,5 +136,7 @@ private bool AddHumeShield(Player p, float hum) p.HumeShield += hum; return true; } + + } } From 852ee34fbbce140054457ccc080641c48101387d Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Mon, 10 Nov 2025 18:42:06 +0100 Subject: [PATCH 410/853] can't cahnge the map :( --- KruacentExiled/KE.Map/KE.Map.csproj | 3 +- KruacentExiled/KE.Map/MainPlugin.cs | 10 +- .../KE.Map/Patches/MapGenerationPatches.cs | 131 ++++++++++++++++++ 3 files changed, 140 insertions(+), 4 deletions(-) create mode 100644 KruacentExiled/KE.Map/Patches/MapGenerationPatches.cs diff --git a/KruacentExiled/KE.Map/KE.Map.csproj b/KruacentExiled/KE.Map/KE.Map.csproj index 375783dc..3b90d156 100644 --- a/KruacentExiled/KE.Map/KE.Map.csproj +++ b/KruacentExiled/KE.Map/KE.Map.csproj @@ -6,7 +6,8 @@ - + + diff --git a/KruacentExiled/KE.Map/MainPlugin.cs b/KruacentExiled/KE.Map/MainPlugin.cs index 67e063d8..8a177c94 100644 --- a/KruacentExiled/KE.Map/MainPlugin.cs +++ b/KruacentExiled/KE.Map/MainPlugin.cs @@ -7,6 +7,7 @@ using Exiled.Events.EventArgs.Player; using Exiled.Events.EventArgs.Server; using Exiled.Events.Handlers; +using HarmonyLib; using Interactables.Interobjects.DoorUtils; using KE.Map.CustomZones; using KE.Map.CustomZones.CustomRooms.MCZ; @@ -41,9 +42,11 @@ public class MainPlugin : Plugin private Handler handler; public static Translations Translations => Instance?.Translation; public static Config Configs => Instance?.Config; + private Harmony harmony; public override void OnEnabled() { handler = new(); + harmony = new(Prefix); //handler.SubscribeEvents(); KE.Utils.API.Sounds.SoundPlayer.Instance.TryLoad(); @@ -55,7 +58,7 @@ public override void OnEnabled() GamblingRoom.SubscribeEvents(); //MoreRoom.CreateAll(); //MoreRoom.SubscribeEvents(); - + harmony.PatchAll(Assembly); @@ -75,7 +78,7 @@ private void OnRoundStarted() //player.Teleport(Room.List.Where(r => r.Type == Exiled.API.Enums.RoomType.EzVent).First()); - player.Teleport(teleport); + //player.Teleport(teleport); } @@ -90,7 +93,7 @@ public override void OnDisabled() Exiled.Events.Handlers.Server.RoundStarted -= OnRoundStarted; LabApi.Events.Handlers.ServerEvents.MapGenerating -= OnGenerating; Exiled.Events.Handlers.Player.InteractingDoor -= OpenDoor; - + harmony.UnpatchAll(harmony.Id); GamblingRoom.UnsubscribeEvents(); //MoreRoom.UnsubscribeEvents(); handler = null; @@ -142,6 +145,7 @@ private void OpenDoor(InteractingDoorEventArgs ev) private void OnGenerated() { + if (Config.Debug) { CustomZone(); diff --git a/KruacentExiled/KE.Map/Patches/MapGenerationPatches.cs b/KruacentExiled/KE.Map/Patches/MapGenerationPatches.cs new file mode 100644 index 00000000..088e098a --- /dev/null +++ b/KruacentExiled/KE.Map/Patches/MapGenerationPatches.cs @@ -0,0 +1,131 @@ +using Exiled.API.Features; +using HarmonyLib; +using MapGeneration; +using System; +using System.Collections.Generic; +using System.Drawing; +using System.Drawing.Imaging; +using System.IO; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Xml.Linq; +using UnityEngine; +using UnityEngine.Experimental.Rendering; +using Color = System.Drawing.Color; +namespace KE.Map.Patches +{ + /*public static class MapGenerationPatches + { + + [HarmonyPatch(typeof(MapAtlasInterpreter),nameof(MapAtlasInterpreter.Interpret))] + public static class InterpretPatch + { + static int counter = 0; + public static void Prefix(UnityEngine.Texture2D atlas, System.Random rng, MapAtlasInterpreter __instance) + { + //PrintAtlas(atlas); + } + + + public static void PrintAtlas(UnityEngine.Texture2D atlas) + { + + var _bytes = EncodeToPNG(atlas); + + var dirPath = Paths.Configs + "/Images/"; + + if (!Directory.Exists(dirPath)) + { + + Directory.CreateDirectory(dirPath); + + } + var name = "test" + counter; + counter++; + + File.WriteAllBytes(dirPath + name + ".png", _bytes); + } + + private static byte[] EncodeToPNG(Texture2D texture) + { + // Get raw pixel colors from the texture + Color32[] pixels = texture.GetPixels32(); + + using (Bitmap bmp = new Bitmap(texture.width, texture.height, PixelFormat.Format32bppArgb)) + { + for (int y = 0; y < texture.height; y++) + { + for (int x = 0; x < texture.width; x++) + { + Color32 c = pixels[y * texture.width + x]; + bmp.SetPixel(x, texture.height - y - 1, Color.FromArgb(c.a, c.r, c.g, c.b)); + } + } + + using (MemoryStream ms = new MemoryStream()) + { + bmp.Save(ms, ImageFormat.Png); + return ms.ToArray(); + } + } + } + + } + + [HarmonyPatch(typeof(AtlasZoneGenerator), nameof(AtlasZoneGenerator.Generate))] + public static class GeneratePatch + { + static bool flag = false; + static int counter = 0; + public static void Prefix(System.Random rng, AtlasZoneGenerator __instance) + { + + if (!flag && __instance is LightContainmentZoneGenerator lcz) + { + List a = __instance.Atlases.ToList(); + Texture2D tex = DecodePNGFromFile(Paths.Configs + "/atlais.png"); + a.Clear(); + a.Add(tex); + __instance.Atlases = a.ToArray(); + + flag = true; + } + Log.Debug(counter); + counter++; + + foreach (Texture2D atlas in __instance.Atlases) + { + InterpretPatch.PrintAtlas(atlas); + } + } + + + public static Texture2D DecodePNGFromFile(string path) + { + + using (var bmp = new Bitmap(path)) + { + Texture2D tex = new Texture2D(bmp.Width, bmp.Height, TextureFormat.RGBA32, false); + + for (int y = 0; y < bmp.Height; y++) + { + for (int x = 0; x < bmp.Width; x++) + { + var c = bmp.GetPixel(x, bmp.Height - 1 - y); + tex.SetPixel(x, y, new Color32(c.R, c.G, c.B, c.A)); + } + } + + tex.Apply(); + return tex; + } + + } + + + } + + + }*/ +} From 01ef4d7cdc1dd2344e466f24054d1f17afe35be0 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Thu, 13 Nov 2025 18:38:34 +0100 Subject: [PATCH 411/853] got the actual autonuke timer --- KruacentExiled/KE.Misc/Features/AutoNukeAnnoucement.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/KruacentExiled/KE.Misc/Features/AutoNukeAnnoucement.cs b/KruacentExiled/KE.Misc/Features/AutoNukeAnnoucement.cs index ce44b53a..985e4d4e 100644 --- a/KruacentExiled/KE.Misc/Features/AutoNukeAnnoucement.cs +++ b/KruacentExiled/KE.Misc/Features/AutoNukeAnnoucement.cs @@ -1,4 +1,5 @@ using Exiled.API.Features; +using GameCore; using MEC; using System; using System.Collections.Generic; @@ -13,12 +14,13 @@ internal class AutoNukeAnnoucement { - + private float autodetonatetime; private bool flagSaid = false; private CoroutineHandle handle; public void OnRoundStarted() { + autodetonatetime = ConfigFile.ServerConfig.GetFloat("auto_warhead_start_minutes") * 60f; if (!handle.IsRunning) { handle = Timing.RunCoroutine(Timer()); @@ -30,7 +32,7 @@ private IEnumerator Timer() Stopwatch watch = Stopwatch.StartNew(); bool flag = false; - while (watch.Elapsed.TotalMinutes < AlphaWarheadController.Singleton._autoDetonateTime) + while (watch.Elapsed.TotalMinutes < autodetonatetime) { yield return Timing.WaitForSeconds(60); if(Warhead.IsDetonated || Warhead.IsInProgress) @@ -52,8 +54,6 @@ private IEnumerator Timer() public void SayAnnouncement() { if (flagSaid) return; - - Cassie.MessageTranslated("Warning automatic warhead will detonate in 5 minutes", "Warning automatic warhead will detonate in 5 minutes"); flagSaid = true; From 3329e7080c79d688cf59470d5a1c34d7031458cb Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Thu, 13 Nov 2025 18:38:43 +0100 Subject: [PATCH 412/853] removed infinite random effect --- .../Effect/NegativeEffect/RandomBadEffect.cs | 12 ++++++++---- .../Effect/PositiveEffect/RandomGoodEffect.cs | 5 ++++- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/KruacentExiled/KE.Misc/Features/GamblingCoin/Effect/NegativeEffect/RandomBadEffect.cs b/KruacentExiled/KE.Misc/Features/GamblingCoin/Effect/NegativeEffect/RandomBadEffect.cs index a78c18a4..72185238 100644 --- a/KruacentExiled/KE.Misc/Features/GamblingCoin/Effect/NegativeEffect/RandomBadEffect.cs +++ b/KruacentExiled/KE.Misc/Features/GamblingCoin/Effect/NegativeEffect/RandomBadEffect.cs @@ -15,16 +15,20 @@ internal class RandomBadEffect : ICoinEffect public void Execute(Player player) { - var positiveEffects = Enum.GetValues(typeof(EffectType)) + var negativeEffects = Enum.GetValues(typeof(EffectType)) .Cast() .Where(e => e.GetCategories().HasFlag(EffectCategory.Negative)) .ToList(); - if (positiveEffects.Count == 0) + if (negativeEffects.Count == 0) + { + Log.Warn("no negative effect found"); return; + } + - var randomEffect = positiveEffects[UnityEngine.Random.Range(0, positiveEffects.Count)]; + var randomEffect = negativeEffects[UnityEngine.Random.Range(0, negativeEffects.Count)]; - player.EnableEffect(randomEffect, 45); + player.EnableEffect(randomEffect, 5, true); } } \ No newline at end of file diff --git a/KruacentExiled/KE.Misc/Features/GamblingCoin/Effect/PositiveEffect/RandomGoodEffect.cs b/KruacentExiled/KE.Misc/Features/GamblingCoin/Effect/PositiveEffect/RandomGoodEffect.cs index bb9064f8..d51565cf 100644 --- a/KruacentExiled/KE.Misc/Features/GamblingCoin/Effect/PositiveEffect/RandomGoodEffect.cs +++ b/KruacentExiled/KE.Misc/Features/GamblingCoin/Effect/PositiveEffect/RandomGoodEffect.cs @@ -21,10 +21,13 @@ public void Execute(Player player) .ToList(); if (positiveEffects.Count == 0) + { + Log.Warn("no negative effect found"); return; + } var randomEffect = positiveEffects[UnityEngine.Random.Range(0, positiveEffects.Count)]; - player.EnableEffect(randomEffect, 45); + player.EnableEffect(randomEffect, 5,true); } } \ No newline at end of file From 14ada106413659b8c1c2c7f651f8e58d6e31b7ee Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Thu, 13 Nov 2025 18:43:03 +0100 Subject: [PATCH 413/853] disabled surface light --- KruacentExiled/KE.Misc/MainPlugin.cs | 58 ++-------------------------- 1 file changed, 3 insertions(+), 55 deletions(-) diff --git a/KruacentExiled/KE.Misc/MainPlugin.cs b/KruacentExiled/KE.Misc/MainPlugin.cs index e3668c86..b2debf91 100644 --- a/KruacentExiled/KE.Misc/MainPlugin.cs +++ b/KruacentExiled/KE.Misc/MainPlugin.cs @@ -45,7 +45,7 @@ public override void OnEnabled() _914 = new _914(); AutoElevator = new AutoElevator(); ClassDDoor = new ClassDDoor(); - SurfaceLight = new SurfaceLight(); + //SurfaceLight = new SurfaceLight(); messes with the nuke light ServerHandler = new ServerHandler(); Spawn = new Spawn(); SCPBuff = new SCPBuff(); @@ -106,63 +106,11 @@ public override void OnDisabled() AutoElevator = null; AutoNukeAnnoucement = null; FriendlyFire = null; - SurfaceLight = null; + //SurfaceLight = null; GamblingCoinManager.DestroyAll(); _gamblingCoinHandler = null; Instance = null; - } - - - - /// - /// Lock SCP-173 in its cell for an amount of time determine by the number of player - /// Formula : timeLock = 135-nbPlayer*15 - /// - internal IEnumerator PeanutLockdown() - { - - Log.Debug("peanut lockdown"); - Door peanutDoor = Door.List.First(x => x.Type == DoorType.Scp173NewGate); // broken 049 gate is considered as 173 new gate for some reason - peanutDoor.IsOpen = false; - peanutDoor.ChangeLock(DoorLockType.Isolation); - CoroutineHandle a; - if (Instance.Config.Debug) - a = Timing.RunCoroutine(Timer(120, "u r free :3")); - else - a = Timing.RunCoroutine(Timer(135 - Player.List.Count * 15, "u r free :3")); - - yield return Timing.WaitUntilDone(a); - peanutDoor.IsOpen = true; - peanutDoor.Unlock(); - Log.Debug("peanut free"); - } - private IEnumerator Timer(int secondsWaiting, string msg = "done") - { - List playerToShow = [.. Player.List]; - while (secondsWaiting >= 0) - { - playerToShow.RemoveAll(p => p.CurrentRoom.Type != RoomType.Hcz049); - playerToShow.AddRange(Player.List.Where(p => p.CurrentRoom.Type == RoomType.Hcz049)); - - //RueIHint hint = new(HPosition.Center, VPosition.CustomRole, $"{secondsWaiting} seconds left for SCP-173's spawn"); - playerToShow.ForEach(p => - { - //DisplayPlayer.Get(p).Hint(new Position(HPosition.Center, 600), hub => $"{secondsWaiting} seconds left for SCP-173's spawn"); - //DisplayCore c = DisplayCore.Get(p.ReferenceHub); - //c.SetElemTemp($""+hint.RawContent+"", (int)hint.Position.VPosition, TimeSpan.FromSeconds(hint.Duration), new RueI.Displays.Scheduling.TimedElemRef()); - //DisplayPlayer.Get(p).Hint(new Position(HPosition.Center,600), $"{secondsWaiting} seconds left for SCP-173's spawn",1); - }); - yield return Timing.WaitForSeconds(1); - secondsWaiting--; - } - //playerToShow.ForEach(p => DisplayPlayer.Get(p).Hint(new Position(HPosition.Center,VPosition.CustomRole),msg)); - } - - - - - - + } /// /// Special death message when Delecons dies as a SCP From 9fc7c7497a8bed6dc98ddb75ebea2585445a576c Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Thu, 13 Nov 2025 19:50:02 +0100 Subject: [PATCH 414/853] hiding the last player --- .../KE.Misc/Features/LoadingMiscFeature.cs | 2 +- KruacentExiled/KE.Misc/Features/SCPBuff.cs | 57 ++++++++++++++----- KruacentExiled/KE.Misc/MainPlugin.cs | 4 +- 3 files changed, 45 insertions(+), 18 deletions(-) diff --git a/KruacentExiled/KE.Misc/Features/LoadingMiscFeature.cs b/KruacentExiled/KE.Misc/Features/LoadingMiscFeature.cs index 21fa6a3d..9f1d875a 100644 --- a/KruacentExiled/KE.Misc/Features/LoadingMiscFeature.cs +++ b/KruacentExiled/KE.Misc/Features/LoadingMiscFeature.cs @@ -35,7 +35,7 @@ public override void UnsubscribeEvents() { Log.Debug("Unsubscribing " + loaded.GetType().Name); if (loaded is IUsingEvents iue) - iue.SubscribeEvents(); + iue.UnsubscribeEvents(); } } } diff --git a/KruacentExiled/KE.Misc/Features/SCPBuff.cs b/KruacentExiled/KE.Misc/Features/SCPBuff.cs index 788e04d3..b8c2b591 100644 --- a/KruacentExiled/KE.Misc/Features/SCPBuff.cs +++ b/KruacentExiled/KE.Misc/Features/SCPBuff.cs @@ -1,5 +1,6 @@ using Exiled.API.Extensions; using Exiled.API.Features; +using Exiled.Events; using Exiled.Events.EventArgs.Player; using Exiled.Permissions.Commands.Permissions; using KE.Utils.API.Interfaces; @@ -12,20 +13,22 @@ namespace KE.Misc.Features { - internal class SCPBuff : IUsingEvents + public class SCPBuff : IUsingEvents { - internal const float RefreshRate = 1f; - internal float IncreaseSCPHealth { get; } = 1.25f; + public const float RefreshRate = 1f; + public float IncreaseSCPHealth { get; } = 1.25f; internal SCPBuff() { } public void SubscribeEvents() { - Exiled.Events.Handlers.Player.Died += OnDied; + Exiled.Events.Handlers.Player.ChangingRole += OnChangingRole; + Exiled.Events.Handlers.Player.ChangingRole += BecomingSCP; } public void UnsubscribeEvents() { - Exiled.Events.Handlers.Player.Died -= OnDied; + Exiled.Events.Handlers.Player.ChangingRole -= OnChangingRole; + Exiled.Events.Handlers.Player.ChangingRole -= BecomingSCP; } @@ -36,25 +39,49 @@ internal void StartBuff() } private Npc npc = null; - private void OnDied(DiedEventArgs ev) + private string npcName = "Bonjour je suis la pour pas que le SCP wall-hack"; + private void OnChangingRole(ChangingRoleEventArgs ev) { - if (Player.Enumerable.Count(p => !p.IsScp && p.IsAlive) > 1) return; + if (IsHidingNpc(ev.Player)) return; - if(npc is null) + Timing.CallDelayed(1f, delegate { - SpawnFakePlayer(); - } + int nbplayer = Player.Enumerable.Count(p => !p.IsScp && p.IsAlive && (!IsHidingNpc(p))); + Log.Debug("there's " + nbplayer); + if (nbplayer != 1) + { + Log.Debug("destroying npc"); + if(npc?.GameObject is not null) + { + npc?.Destroy(); + } + + } + + + if(nbplayer == 1) + { + if (npc is not null) + { + npc.Destroy(); + } + Log.Debug("spawning npc"); + npc = Npc.Spawn(npcName, RoleTypeId.ClassD, true, new Vector3(36, 314, -33)); + npc.IsSpectatable = false; + } + }); + + + } - private void SpawnFakePlayer() + private bool IsHidingNpc(Player player) { - npc = Npc.Spawn("hide", RoleTypeId.ClassD, true, Vector3.zero); - npc.Hide(); - + return player is Npc hide && hide.Nickname == npcName; } - internal void BecomingSCP(ChangingRoleEventArgs ev) + private void BecomingSCP(ChangingRoleEventArgs ev) { if (!ev.NewRole.IsScp() || ev.NewRole == RoleTypeId.Scp0492) return; diff --git a/KruacentExiled/KE.Misc/MainPlugin.cs b/KruacentExiled/KE.Misc/MainPlugin.cs index b2debf91..c0a58ee0 100644 --- a/KruacentExiled/KE.Misc/MainPlugin.cs +++ b/KruacentExiled/KE.Misc/MainPlugin.cs @@ -69,8 +69,8 @@ public override void OnEnabled() Exiled.Events.Handlers.Player.FlippingCoin += _gamblingCoinHandler.OnCoinFlip; } + SCPBuff.SubscribeEvents(); Exiled.Events.Handlers.Server.RoundStarted += AutoNukeAnnoucement.OnRoundStarted; - Exiled.Events.Handlers.Player.ChangingRole += SCPBuff.BecomingSCP; ServerHandle.RoundStarted += ServerHandler.OnRoundStarted; Exiled.Events.Handlers.Player.Dying += ScpNoeDeathMessage; CustomRole.RegisterRoles(false, null, true, this.Assembly); @@ -83,7 +83,7 @@ public override void OnDisabled() ServerHandle.RoundStarted -= ServerHandler.OnRoundStarted; Exiled.Events.Handlers.Player.Dying -= ScpNoeDeathMessage; Exiled.Events.Handlers.Server.RoundStarted -= AutoNukeAnnoucement.OnRoundStarted; - + SCPBuff.UnsubscribeEvents(); if (Config.GamblingCoin) { Exiled.Events.Handlers.Player.FlippingCoin -= _gamblingCoinHandler.OnCoinFlip; From de3fc3fc7db492e333c50bba5218307babc4488a Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Thu, 13 Nov 2025 19:50:18 +0100 Subject: [PATCH 415/853] corrected autonukeannoucer --- KruacentExiled/KE.Misc/Features/AutoNukeAnnoucement.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/KruacentExiled/KE.Misc/Features/AutoNukeAnnoucement.cs b/KruacentExiled/KE.Misc/Features/AutoNukeAnnoucement.cs index 985e4d4e..fc13f157 100644 --- a/KruacentExiled/KE.Misc/Features/AutoNukeAnnoucement.cs +++ b/KruacentExiled/KE.Misc/Features/AutoNukeAnnoucement.cs @@ -14,13 +14,13 @@ internal class AutoNukeAnnoucement { - private float autodetonatetime; + private float autodetonatetime = 20*60f; private bool flagSaid = false; private CoroutineHandle handle; public void OnRoundStarted() { - autodetonatetime = ConfigFile.ServerConfig.GetFloat("auto_warhead_start_minutes") * 60f; + //autodetonatetime = ConfigFile.ServerConfig.GetFloat("auto_warhead_start_minutes") * 60f; if (!handle.IsRunning) { handle = Timing.RunCoroutine(Timer()); From 7fa255be7f6dcf78aa5769cb7b90aa625812fefb Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Thu, 13 Nov 2025 19:54:13 +0100 Subject: [PATCH 416/853] double tesla --- KruacentExiled/KE.Misc/Features/AutoTesla.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/KruacentExiled/KE.Misc/Features/AutoTesla.cs b/KruacentExiled/KE.Misc/Features/AutoTesla.cs index 598dca32..be584a54 100644 --- a/KruacentExiled/KE.Misc/Features/AutoTesla.cs +++ b/KruacentExiled/KE.Misc/Features/AutoTesla.cs @@ -38,7 +38,7 @@ private IEnumerator StartElevator() tesla.Trigger(); if(UnityEngine.Random.Range(0f,100f) <= 70f) { - yield return Timing.WaitForSeconds(tesla.Base.windupTime); + yield return Timing.WaitForSeconds(tesla.Base.windupTime+2f); tesla.Trigger(); } From 23c539974d1f138bdf87b03b6d5116349b0a486a Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Sat, 15 Nov 2025 07:53:41 +0100 Subject: [PATCH 417/853] added refundable abilties + added recyclable id for customscps --- .../KE.CustomRoles/API/Features/CustomSCP.cs | 13 ++- .../API/Features/KEAbilities.cs | 17 +++- .../API/Features/KECustomRole.cs | 49 +++++++++++- .../API/Features/RecyclableSettingId.cs | 79 +++++++++++++++++++ .../API/Interfaces/IHealable.cs | 14 ++++ .../KE.CustomRoles/Abilities/Airstrike.cs | 9 ++- .../KE.CustomRoles/Abilities/Convert.cs | 13 +-- .../KE.CustomRoles/Abilities/Explode.cs | 3 +- .../KE.CustomRoles/Abilities/Fireball.cs | 67 +++++++++++----- .../KE.CustomRoles/Abilities/ForceOpen.cs | 3 +- .../KE.CustomRoles/Abilities/SetPosition.cs | 4 +- .../KE.CustomRoles/Abilities/SimulateDeath.cs | 3 +- .../KE.CustomRoles/Abilities/Teleportation.cs | 12 +-- .../KE.CustomRoles/Abilities/Thief.cs | 18 ++--- .../KE.CustomRoles/Abilities/Trade.cs | 5 +- .../KE.CustomRoles/CR/Human/Alzheimer.cs | 27 ++----- .../KE.CustomRoles/CR/Human/Crazy.cs | 8 +- .../KE.CustomRoles/CR/SCP/SCP457.cs | 7 +- KruacentExiled/KE.CustomRoles/Config.cs | 6 +- 19 files changed, 264 insertions(+), 93 deletions(-) create mode 100644 KruacentExiled/KE.CustomRoles/API/Features/RecyclableSettingId.cs create mode 100644 KruacentExiled/KE.CustomRoles/API/Interfaces/IHealable.cs diff --git a/KruacentExiled/KE.CustomRoles/API/Features/CustomSCP.cs b/KruacentExiled/KE.CustomRoles/API/Features/CustomSCP.cs index 43b7d3e3..5ece0b74 100644 --- a/KruacentExiled/KE.CustomRoles/API/Features/CustomSCP.cs +++ b/KruacentExiled/KE.CustomRoles/API/Features/CustomSCP.cs @@ -3,6 +3,7 @@ using System; using System.Collections.Generic; using System.Linq; +using System.Runtime.Remoting.Messaging; using System.Text; using System.Threading.Tasks; @@ -14,21 +15,24 @@ public abstract class CustomSCP : KECustomRole public const int MaxValue = 5; public const int DefaultValue = 0; - public static int ScpPreferenceHeaderId => MainPlugin.Instance.Config.ScpPreferenceHeaderId; + public static int ScpPreferenceHeaderId => HeaderId.Value; + private static RecyclableSettingId HeaderId; private static HeaderSetting header = null; private SliderSetting sliderSetting; public abstract bool IsSupport { get; } - public int SettingId => (int)Id; + + private new RecyclableSettingId Id; + public int SettingId => Id.Value; public static IEnumerable All => Registered.Where(c => c is CustomSCP).Cast(); public override void Init() { if (header is null) { + HeaderId = new RecyclableSettingId(); header = new HeaderSetting(ScpPreferenceHeaderId, "SCP Spawn Preferences"); } - - + Id = new RecyclableSettingId(); sliderSetting = new SliderSetting(SettingId, PublicName, MinValue, MaxValue, DefaultValue, true, header: header); SettingBase.Register([sliderSetting]); @@ -40,6 +44,7 @@ public override void Init() public override void Destroy() { SettingBase.Unregister(); + Id.Destroy(); base.Destroy(); } diff --git a/KruacentExiled/KE.CustomRoles/API/Features/KEAbilities.cs b/KruacentExiled/KE.CustomRoles/API/Features/KEAbilities.cs index ee5bcd72..b98e6630 100644 --- a/KruacentExiled/KE.CustomRoles/API/Features/KEAbilities.cs +++ b/KruacentExiled/KE.CustomRoles/API/Features/KEAbilities.cs @@ -92,9 +92,14 @@ protected virtual void UnsubscribeEvents() } - protected virtual void AbilityUsed(Player player) + /// + /// + /// + /// + /// return true if the ability was used; returns false if the ability was not used and need to be refunded + protected virtual bool AbilityUsed(Player player) { - + return true; } protected virtual void AbilityAdded(Player player) @@ -106,6 +111,7 @@ protected virtual void AbilityRemoved(Player player) } + public void ShowAbility(Player player) { float time = MainPlugin.SettingHandler.GetAbilityTime(player); @@ -173,10 +179,13 @@ public void AddAbility(Player player) } public void UseAbility(Player player) { - LastUsed[player] = DateTime.Now; + + if (AbilityUsed(player)) + { + LastUsed[player] = DateTime.Now; + } - AbilityUsed(player); } public bool Check(Player player) diff --git a/KruacentExiled/KE.CustomRoles/API/Features/KECustomRole.cs b/KruacentExiled/KE.CustomRoles/API/Features/KECustomRole.cs index e02fc192..00800d50 100644 --- a/KruacentExiled/KE.CustomRoles/API/Features/KECustomRole.cs +++ b/KruacentExiled/KE.CustomRoles/API/Features/KECustomRole.cs @@ -7,6 +7,7 @@ using Exiled.CustomRoles; using Exiled.CustomRoles.API; using Exiled.CustomRoles.API.Features; +using Exiled.Events.EventArgs.Player; using InventorySystem.Configs; using KE.CustomRoles.API.Interfaces; using KE.Utils.API.Displays.DisplayMeow; @@ -98,6 +99,7 @@ public override void Init() { typeLookupTable.Add(GetType(), this); stringLookupTable.Add(Name, this); + InternalSubscribeEvents(); SubscribeEvents(); } @@ -105,9 +107,45 @@ public override void Destroy() { typeLookupTable.Remove(GetType()); stringLookupTable.Remove(Name); + InternalUnsubscribeEvents(); UnsubscribeEvents(); } + protected virtual void InternalSubscribeEvents() + { + if(this is IHealable) + { + Exiled.Events.Handlers.Player.UsedItem += OnUsedItem; + } + + } + + + protected virtual void InternalUnsubscribeEvents() + { + if (this is IHealable) + { + Exiled.Events.Handlers.Player.UsedItem += OnUsedItem; + } + } + + + private void OnUsedItem(UsedItemEventArgs ev) + { + if (!Check(ev.Player)) return; + IHealable healable = this as IHealable; + if(healable.HealItem is null || healable.HealItem.Count == 0) + { + Log.Warn("no healable item found for" + this.Name); + return; + } + + + if (healable.HealItem.Contains(ev.Item.Type)) + { + RemoveRole(ev.Player); + } + } protected void ShowEffectHint(Player player, string text) @@ -172,6 +210,9 @@ public override void AddRole(Player player) SetAbilities(player2); + SetSpawn(player2); + + ShowMessage(player2); RoleAdded(player2); @@ -323,7 +364,7 @@ public static bool HasCustomRole(Player player) /// /// The chance to get a at the start or a respawn /// - public static int Chance + public static float Chance { get { @@ -331,11 +372,11 @@ public static int Chance } set { - chance = Mathf.Clamp(value, 0, 100); + chance = Mathf.Clamp(value, 0f, 100f); } } - private static int chance = 40; + private static float chance = 100; private static KECustomRole AssignRole(Dictionary roleChances) { @@ -375,7 +416,7 @@ public static void GiveRandomRole(Player player) KECustomRole cr = AssignRole(GetAvailableCustomRole(player)); - Log.Debug($"{player.Id} : {cr.Name}"); + Log.Debug($"{player.Id} : {cr?.Name}"); cr?.AddRole(player); } diff --git a/KruacentExiled/KE.CustomRoles/API/Features/RecyclableSettingId.cs b/KruacentExiled/KE.CustomRoles/API/Features/RecyclableSettingId.cs new file mode 100644 index 00000000..6b69e86e --- /dev/null +++ b/KruacentExiled/KE.CustomRoles/API/Features/RecyclableSettingId.cs @@ -0,0 +1,79 @@ +using Exiled.API.Features; +using Exiled.API.Features.Core.UserSettings; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace KE.CustomRoles.API.Features +{ + public struct RecyclableSettingId : IEquatable + { + public const int MinThreshold = 16; + public readonly int Value; + + private static Queue FreeIds = new Queue(); + private static int _autoIncrement; + + private static int Min => MainPlugin.Instance.Config.CustomScpSliderRangeMin; + private static int Max => MainPlugin.Instance.Config.CustomScpSliderRangeMax; + + public RecyclableSettingId(SettingBase setting) + { + Value = setting.Id; + } + + public RecyclableSettingId() + { + int num = MinThreshold; + int value; + if (FreeIds.Count >= num) + { + value = FreeIds.Dequeue(); + } + else + { + value = _autoIncrement++ + Min; + if(value > Max) + { + throw new ArgumentOutOfRangeException("ID out of range, please increase the CustomScpSliderRangeMax in the plugins settings"); + } + } + Log.Debug("creating id =" + value); + Value = value; + + } + + + + public void Destroy() + { + if(Value != 0) + { + FreeIds.Enqueue(Value); + } + } + + + + public bool Equals(RecyclableSettingId other) + { + return other.Value == this.Value; + } + public override bool Equals(object obj) + { + if (obj is RecyclableSettingId other) + { + return Equals(other); + } + return false; + } + + public override int GetHashCode() + { + return Value; + } + + } +} diff --git a/KruacentExiled/KE.CustomRoles/API/Interfaces/IHealable.cs b/KruacentExiled/KE.CustomRoles/API/Interfaces/IHealable.cs new file mode 100644 index 00000000..d7c207e9 --- /dev/null +++ b/KruacentExiled/KE.CustomRoles/API/Interfaces/IHealable.cs @@ -0,0 +1,14 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace KE.CustomRoles.API.Interfaces +{ + public interface IHealable + { + + public abstract HashSet HealItem { get; } + } +} diff --git a/KruacentExiled/KE.CustomRoles/Abilities/Airstrike.cs b/KruacentExiled/KE.CustomRoles/Abilities/Airstrike.cs index 4c81e658..a66f254a 100644 --- a/KruacentExiled/KE.CustomRoles/Abilities/Airstrike.cs +++ b/KruacentExiled/KE.CustomRoles/Abilities/Airstrike.cs @@ -29,24 +29,24 @@ public class Airstrike : KEAbilities - protected override void AbilityUsed(Player player) + protected override bool AbilityUsed(Player player) { if(!SetPosition.TryGetTarget(player, out Vector3 target)) { MainPlugin.ShowEffectHint(player, "no target selected"); - return; + return false; } if(target.GetZone() != FacilityZone.Surface) { MainPlugin.ShowEffectHint(player, "only works on Surface Zone"); - return; + return false; } Physics.Linecast(target, target + height * Vector3.up, out RaycastHit hit); if (hit.collider != null) { Log.Info($"hit something [{hit.collider}]"); - return; + return false; } var l = Light.Create(target,null,null,true,Color.red); @@ -62,6 +62,7 @@ protected override void AbilityUsed(Player player) l.Destroy(); }); + return base.AbilityUsed(player); } diff --git a/KruacentExiled/KE.CustomRoles/Abilities/Convert.cs b/KruacentExiled/KE.CustomRoles/Abilities/Convert.cs index 30035382..efe34a5f 100644 --- a/KruacentExiled/KE.CustomRoles/Abilities/Convert.cs +++ b/KruacentExiled/KE.CustomRoles/Abilities/Convert.cs @@ -23,17 +23,18 @@ public class Convert : KEAbilities public float MaxDistance { get; set; } = 5f; - protected override void AbilityUsed(Player player) + + protected override bool AbilityUsed(Player player) { - if (!Physics.Linecast(player.Position, player.Position + player.Rotation.eulerAngles * MaxDistance, out RaycastHit hit)) return; + if (!Physics.Linecast(player.Position, player.Position + player.Rotation.eulerAngles * MaxDistance, out RaycastHit hit)) return false; Player playerHit = Player.Get(hit.collider); - if (playerHit == null) return; + if (playerHit == null) return false; - if (playerHit.Role.Side == player.Role.Side) return; + if (playerHit.Role.Side == player.Role.Side) return false; - if (playerHit.IsScp && playerHit.Role != RoleTypeId.Scp0492) return; + if (playerHit.IsScp && playerHit.Role != RoleTypeId.Scp0492) return false; if (playerHit.IsScp) @@ -45,6 +46,8 @@ protected override void AbilityUsed(Player player) playerHit.Role.Set(player.Role, RoleSpawnFlags.None); } + + return base.AbilityUsed(player); } } diff --git a/KruacentExiled/KE.CustomRoles/Abilities/Explode.cs b/KruacentExiled/KE.CustomRoles/Abilities/Explode.cs index 4530272c..00d3b615 100644 --- a/KruacentExiled/KE.CustomRoles/Abilities/Explode.cs +++ b/KruacentExiled/KE.CustomRoles/Abilities/Explode.cs @@ -21,12 +21,13 @@ public class Explode : KEAbilities public override float Cooldown { get; } = 4*60f; - protected override void AbilityUsed(Player player) + protected override bool AbilityUsed(Player player) { ExplosiveGrenade grenade = ((ExplosiveGrenade)Item.Create(ItemType.GrenadeHE)); grenade.FuseTime = 0.2f; grenade.SpawnActive(player.Position); Log.Debug("Grenade spawned"); + return base.AbilityUsed(player); } } } diff --git a/KruacentExiled/KE.CustomRoles/Abilities/Fireball.cs b/KruacentExiled/KE.CustomRoles/Abilities/Fireball.cs index 43f64c77..aa3290c7 100644 --- a/KruacentExiled/KE.CustomRoles/Abilities/Fireball.cs +++ b/KruacentExiled/KE.CustomRoles/Abilities/Fireball.cs @@ -3,6 +3,7 @@ using Exiled.API.Features.Roles; using Exiled.API.Features.Toys; using Exiled.API.Interfaces; +using Exiled.Events.Patches.Events.Player; using KE.CustomRoles.API.Features; using MEC; using PlayerStatsSystem; @@ -28,7 +29,7 @@ public class Fireball : KEAbilities private static readonly Color ballColor = new(2, 1.08f, 0, .75f); private Dictionary _activeBalls = new(); - protected override void AbilityUsed(Player player) + protected override bool AbilityUsed(Player player) { if (!_activeBalls.ContainsKey(player)) { @@ -36,20 +37,32 @@ protected override void AbilityUsed(Player player) } - if (_activeBalls[player] >= MAX_BALLS) return; + if (_activeBalls[player] >= MAX_BALLS) return true; if (player.Role is Scp106Role role106) { - if (role106.Vigor <= VIGOR_COST) return; + if (role106.Vigor <= VIGOR_COST) return true; role106.Vigor -= VIGOR_COST; } _activeBalls[player]++; Timing.RunCoroutine(LaunchingAttack(player)); + return base.AbilityUsed(player); } + + protected override void AbilityRemoved(Player player) + { + + + + base.AbilityRemoved(player); + } + + private float smooth = .001f; + private IEnumerator LaunchingAttack(Player player) { Vector3 initpos = player.Position; @@ -70,40 +83,34 @@ private IEnumerator LaunchingAttack(Player player) Vector3 nextPos; int fallback = 100; + Log.Debug("fallback=" + fallback); while (!attackTouchedSomething && fallback > 0) { - nextPos = primitive.Position + primitive.Rotation * new Vector3(0, 0, 1f); + nextPos = primitive.Position + primitive.Rotation * new Vector3(0, 0, smooth); RaycastHit hit; if (Physics.Linecast(primitive.Position, nextPos, out hit)) { - //spawn mtf looking at central gate - if (hit.collider.gameObject.name != "VolumeOverrideTunnel") - { - attackTouchedSomething = true; - } + ProcessHit(player,hit.collider); - Player playerhit = Player.Get(hit.collider); - if (playerhit != null && playerhit.Role.Side != player.Role.Side) - { - playerhit.Hurt(BallDamage); - player.ShowHitMarker(); + } + else + { - } + Collider[] colliders = Physics.OverlapSphere(primitive.Position, 1); - Door doorhit = Door.Get(hit.collider.gameObject); - if (doorhit != null && doorhit is IDamageableDoor damageable && !damageable.IsDestroyed) + foreach(Collider collider in colliders) { - damageable.Break(); - player.ShowHitMarker(); + ProcessHit(player, collider); } + } Log.Debug($"current pos = {primitive.Position} next pos = {nextPos}"); - yield return Timing.WaitForSeconds(.1f); + yield return Timing.WaitForSeconds(1f/smooth); primitive.Position = nextPos; light.Position = nextPos; fallback--; @@ -114,6 +121,26 @@ private IEnumerator LaunchingAttack(Player player) } + private void ProcessHit(Player attacker,Collider collider) + { + + Player playerhit = Player.Get(collider); + if (playerhit != null && playerhit.Role.Side != attacker.Role.Side) + { + playerhit.Hurt(BallDamage); + attacker.ShowHitMarker(); + + } + + Door doorhit = Door.Get(collider.gameObject); + if (doorhit != null && doorhit is IDamageableDoor damageable && !damageable.IsDestroyed) + { + damageable.Break(); + attacker.ShowHitMarker(); + } + } + + diff --git a/KruacentExiled/KE.CustomRoles/Abilities/ForceOpen.cs b/KruacentExiled/KE.CustomRoles/Abilities/ForceOpen.cs index 75c5bc2a..a8aa3b78 100644 --- a/KruacentExiled/KE.CustomRoles/Abilities/ForceOpen.cs +++ b/KruacentExiled/KE.CustomRoles/Abilities/ForceOpen.cs @@ -26,7 +26,7 @@ public class ForceOpen : KEAbilities private Dictionary abilityActivated = new(); public static readonly TimeSpan MaxTime = new (0, 0, 30); - protected override void AbilityUsed(Player player) + protected override bool AbilityUsed(Player player) { if (abilityActivated.ContainsKey(player)) { @@ -37,6 +37,7 @@ protected override void AbilityUsed(Player player) abilityActivated.Add(player, DateTime.Now); } + return base.AbilityUsed(player); } diff --git a/KruacentExiled/KE.CustomRoles/Abilities/SetPosition.cs b/KruacentExiled/KE.CustomRoles/Abilities/SetPosition.cs index 1cdea444..6317cc36 100644 --- a/KruacentExiled/KE.CustomRoles/Abilities/SetPosition.cs +++ b/KruacentExiled/KE.CustomRoles/Abilities/SetPosition.cs @@ -15,7 +15,7 @@ public class SetPosition : KEAbilities private static Dictionary SelectedTarget = new(); - protected override void AbilityUsed(Player player) + protected override bool AbilityUsed(Player player) { @@ -30,7 +30,7 @@ protected override void AbilityUsed(Player player) } Log.Info("set position at " +player.Position); - + return base.AbilityUsed(player); } diff --git a/KruacentExiled/KE.CustomRoles/Abilities/SimulateDeath.cs b/KruacentExiled/KE.CustomRoles/Abilities/SimulateDeath.cs index 1008a01b..cf7380ff 100644 --- a/KruacentExiled/KE.CustomRoles/Abilities/SimulateDeath.cs +++ b/KruacentExiled/KE.CustomRoles/Abilities/SimulateDeath.cs @@ -21,7 +21,7 @@ public class SimulateDeath : KEAbilities public override float Cooldown { get; } = 60f; - protected override void AbilityUsed(Player player) + protected override bool AbilityUsed(Player player) { Dictionary deathTranslation = DeathTranslations.TranslationsById; @@ -40,6 +40,7 @@ protected override void AbilityUsed(Player player) player.Scale = pScale; player.Position = pPos; }); + return base.AbilityUsed(player); } } } diff --git a/KruacentExiled/KE.CustomRoles/Abilities/Teleportation.cs b/KruacentExiled/KE.CustomRoles/Abilities/Teleportation.cs index c080cc20..66961662 100644 --- a/KruacentExiled/KE.CustomRoles/Abilities/Teleportation.cs +++ b/KruacentExiled/KE.CustomRoles/Abilities/Teleportation.cs @@ -18,13 +18,13 @@ public class Teleportation : KEAbilities public override float Cooldown { get; } = 120f; public static float Damage { get; set; } = 60; - protected override void AbilityUsed(Player player) + protected override bool AbilityUsed(Player player) { if(!SetPosition.TryGetTarget(player, out Vector3 target)) { MainPlugin.ShowEffectHint(player, "no target selected"); - return; + return false; } @@ -32,14 +32,14 @@ protected override void AbilityUsed(Player player) if(Lift.Get(target) is not null) { MainPlugin.ShowEffectHint(player, "can't teleport in elevator"); - return; + return false; } if (target.GetZone() == FacilityZone.LightContainment && Map.IsLczDecontaminated) { MainPlugin.ShowEffectHint(player, "target in LCZ while LCZ is decontaminated."); - return; + return false; } player.Hurt(Damage, "You are dead."); @@ -55,8 +55,8 @@ protected override void AbilityUsed(Player player) { player.Position = target; } - - + return base.AbilityUsed(player); + } } } \ No newline at end of file diff --git a/KruacentExiled/KE.CustomRoles/Abilities/Thief.cs b/KruacentExiled/KE.CustomRoles/Abilities/Thief.cs index a0b9f3ba..aa454d4d 100644 --- a/KruacentExiled/KE.CustomRoles/Abilities/Thief.cs +++ b/KruacentExiled/KE.CustomRoles/Abilities/Thief.cs @@ -18,19 +18,19 @@ public class Thief : KEAbilities public override float Cooldown { get; } = 120f; - protected override void AbilityUsed(Player player) + protected override bool AbilityUsed(Player player) { - List playerList = Player.List.Where(p => !p.IsScp && p.CurrentRoom == player.CurrentRoom).ToList(); + List playerList = Player.Enumerable.Where(p => !p.IsScp && p.CurrentRoom == player.CurrentRoom).ToList(); playerList.Remove(player); Log.Debug("Player list :"); - playerList.ForEach(p => Log.Info(p.Nickname)); + playerList.ForEach(p => Log.Debug(p.Nickname)); Player thiefed = playerList.GetRandomValue(); if(thiefed is null) { - Log.Warn("no other player"); - return; + MainPlugin.ShowEffectHint(player, "no player to steal from"); + return false; } Log.Debug($"Thiefed player : {thiefed.Nickname}"); @@ -41,10 +41,9 @@ protected override void AbilityUsed(Player player) if (inv == null) { - Log.Info("No item to thiefed, null, returning."); - HintPlacement hint = new(0, 750, HintServiceMeow.Core.Enum.HintAlignment.Center); - float delay = MainPlugin.SettingHandler.GetTime(player); - DisplayHandler.Instance.AddHint(hint, player, "I think this is a skill issue ! Congrats !", delay); + Log.Debug("No item to thiefed, null, returning."); + MainPlugin.ShowEffectHint(player, "I think this is a skill issue ! Congrats !"); + return true; } var thiefBool = thiefed.RemoveItem(inv); @@ -52,6 +51,7 @@ protected override void AbilityUsed(Player player) inv.Give(player); Log.Debug($"Item given to {player.Nickname}."); + return base.AbilityUsed(player); } } } diff --git a/KruacentExiled/KE.CustomRoles/Abilities/Trade.cs b/KruacentExiled/KE.CustomRoles/Abilities/Trade.cs index bc7ead80..386c17d1 100644 --- a/KruacentExiled/KE.CustomRoles/Abilities/Trade.cs +++ b/KruacentExiled/KE.CustomRoles/Abilities/Trade.cs @@ -23,7 +23,7 @@ public class Trade : KEAbilities public static float MaxHealthPercent = .1f; - protected override void AbilityUsed(Player player) + protected override bool AbilityUsed(Player player) { if (player.CurrentItem != null) { @@ -40,11 +40,12 @@ protected override void AbilityUsed(Player player) else { player.Kill("The casino always win"); - return; + return base.AbilityUsed(player); } } player.AddItem(ItemType.Coin); + return base.AbilityUsed(player); } } diff --git a/KruacentExiled/KE.CustomRoles/CR/Human/Alzheimer.cs b/KruacentExiled/KE.CustomRoles/CR/Human/Alzheimer.cs index ca756756..fb6d2135 100644 --- a/KruacentExiled/KE.CustomRoles/CR/Human/Alzheimer.cs +++ b/KruacentExiled/KE.CustomRoles/CR/Human/Alzheimer.cs @@ -1,6 +1,7 @@ using Exiled.API.Enums; using Exiled.API.Features; using Exiled.API.Features.Attributes; +using Exiled.API.Features.Items; using Exiled.CustomRoles.API.Features; using Exiled.Events.EventArgs.Player; using KE.CustomRoles.API.Features; @@ -12,7 +13,7 @@ namespace KE.CustomRoles.CR.Human { - public class Alzheimer : GlobalCustomRole, IColor + public class Alzheimer : GlobalCustomRole, IColor, IHealable { private static Dictionary _coroutines = new(); public override SideEnum Side { get; set; } = SideEnum.Human; @@ -25,6 +26,8 @@ public class Alzheimer : GlobalCustomRole, IColor public Color32 Color => new Color32(112,112,112,0); + public HashSet HealItem => [ItemType.SCP500]; + protected override void RoleAdded(Player player) { _coroutines.Add(player, Timing.RunCoroutine(Teleport(player))); @@ -42,30 +45,10 @@ protected override void RoleRemoved(Player player) Timing.KillCoroutines(_coroutines[player]); _coroutines.Remove(player); } - protected override void SubscribeEvents() - { - Exiled.Events.Handlers.Player.UsedItem += OnUsedItem; - base.SubscribeEvents(); - } - protected override void UnsubscribeEvents() - { - Exiled.Events.Handlers.Player.UsedItem -= OnUsedItem; - base.UnsubscribeEvents(); - } - - private void OnUsedItem(UsedItemEventArgs ev) - { - if (!Check(ev.Player)) return; - if (ev.Item.Type == ItemType.SCP500) - { - RemoveRole(ev.Player); - } - } - private IEnumerator Teleport(Player p) { - while (true) + while (p.IsAlive) { yield return Timing.WaitForSeconds(UnityEngine.Random.Range(300f, 600f)); p.EnableEffect(EffectType.Flashed,1,5); diff --git a/KruacentExiled/KE.CustomRoles/CR/Human/Crazy.cs b/KruacentExiled/KE.CustomRoles/CR/Human/Crazy.cs index a1f225ab..a1cac493 100644 --- a/KruacentExiled/KE.CustomRoles/CR/Human/Crazy.cs +++ b/KruacentExiled/KE.CustomRoles/CR/Human/Crazy.cs @@ -35,7 +35,7 @@ internal class Crazy : GlobalCustomRole public override SideEnum Side { get; set; } = SideEnum.Human; public override string Description { get; set; } = "Je pense que le traitement que t'as eu à la fondation t'as pas aidé"; public override string PublicName { get; set; } = "Fou de la facilité"; - public override bool KeepRoleOnDeath { get; set; } = true; + public override bool KeepRoleOnDeath { get; set; } = false; public override bool KeepRoleOnChangingRole { get; set; } = true; public override float SpawnChance { get; set; } = 100; @@ -72,7 +72,7 @@ private void PreparationEffect() private IEnumerator ApplyEffect(Player player) { - while (true) + while (player.IsAlive) { yield return Timing.WaitForSeconds(this.EFFECT_INTERVAL); CrazyBehaviour behaviour = this.WeightedList.GetRandomValue(); @@ -87,7 +87,7 @@ private IEnumerator ApplyEffect(Player player) player.PlayShieldBreakSound(); break; case CrazyBehaviour.Vision: - Vision(player); + //Vision(player); break; case CrazyBehaviour.Crazying: _crazyingCoroutine = Timing.RunCoroutine(Crazying(player)); @@ -102,7 +102,7 @@ private void Vision(Player player) { List scpRole = new List { RoleTypeId.Scp3114, RoleTypeId.Scp173, RoleTypeId.Scp096, RoleTypeId.Scp106, RoleTypeId.Scp049, RoleTypeId.Scp939 }; - DummyUtils.SpawnDummy(Player.List.ToList().Where(p => p.IsScp).First().ToString()); // Setting name of the dummy + DummyUtils.SpawnDummy(Player.List.ToList().Where(p => p.IsScp).First().DisplayNickname); // Setting name of the dummy Player bot = Player.List.ToList().Where(p => p.IsNPC).First(); // Getting the bot bot.Role.Set(RoleTypeId.Tutorial); bot.ChangeAppearance(scpRole.GetRandomValue()); diff --git a/KruacentExiled/KE.CustomRoles/CR/SCP/SCP457.cs b/KruacentExiled/KE.CustomRoles/CR/SCP/SCP457.cs index ca900955..11ac4820 100644 --- a/KruacentExiled/KE.CustomRoles/CR/SCP/SCP457.cs +++ b/KruacentExiled/KE.CustomRoles/CR/SCP/SCP457.cs @@ -21,7 +21,7 @@ namespace KE.CustomRoles.CR.SCP public class SCP457 : CustomSCP { - public override string Description { get; set; } = "You do passive damage around you, and can lauch fireballs by pressing the stalk button"; + public override string Description { get; set; } = "You do passive damage around you, and can lauch fireballs"; public override string PublicName { get; set; } = "SCP-457"; public override int MaxHealth { get; set; } = 5000; public override RoleTypeId Role { get; set; } = RoleTypeId.Scp106; @@ -42,7 +42,7 @@ public class SCP457 : CustomSCP public override HashSet Abilities => [ - "FireBall" + "Fireball" ]; @@ -77,7 +77,7 @@ private IEnumerator InsideLight(Player player) private IEnumerator PassiveDamage(Player scp) { - while (true) + while (scp.IsAlive) { foreach (Player allP in Player.List.Where(p => p != scp && p.Role.Side != scp.Role.Side)) { @@ -91,6 +91,7 @@ private IEnumerator PassiveDamage(Player scp) Log.Debug($"damâge={damage} dist = {hitinfo.distance}"); allP.EnableEffect(Exiled.API.Enums.EffectType.Burned, DamageRefreshRate, true); allP.Hurt(damage, Fireball.BallDamage._deathReason); + scp.CustomHumeShieldStat.AddAmount(damage); } diff --git a/KruacentExiled/KE.CustomRoles/Config.cs b/KruacentExiled/KE.CustomRoles/Config.cs index 49e36023..75facbad 100644 --- a/KruacentExiled/KE.CustomRoles/Config.cs +++ b/KruacentExiled/KE.CustomRoles/Config.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.ComponentModel; using System.Linq; using System.Text; using System.Threading.Tasks; @@ -13,6 +14,9 @@ public class Config : IConfig public bool Debug { get; set; } = true; public int HeaderId { get; set; } = 1000; - public int ScpPreferenceHeaderId { get; set; } = 10000; + + [Description("the minimum id the custom scp preference will use (Note: the header will always be the first)")] + public int CustomScpSliderRangeMin { get; set; } = 10000; + public int CustomScpSliderRangeMax { get; set; } = 10500; } } From c658c32ba2d956a0e35180eb8ba2ce83b6cfdb7e Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Sun, 16 Nov 2025 06:28:43 +0100 Subject: [PATCH 418/853] hide the last player with a patch --- KruacentExiled/KE.Misc/Features/SCPBuff.cs | 39 ------------------- KruacentExiled/KE.Misc/KE.Misc.csproj | 1 + KruacentExiled/KE.Misc/MainPlugin.cs | 11 ++++-- .../Patches/LastHumanTrackerPatches.cs | 24 ++++++++++++ 4 files changed, 33 insertions(+), 42 deletions(-) create mode 100644 KruacentExiled/KE.Misc/Patches/LastHumanTrackerPatches.cs diff --git a/KruacentExiled/KE.Misc/Features/SCPBuff.cs b/KruacentExiled/KE.Misc/Features/SCPBuff.cs index b8c2b591..049f438c 100644 --- a/KruacentExiled/KE.Misc/Features/SCPBuff.cs +++ b/KruacentExiled/KE.Misc/Features/SCPBuff.cs @@ -21,13 +21,11 @@ internal SCPBuff() { } public void SubscribeEvents() { - Exiled.Events.Handlers.Player.ChangingRole += OnChangingRole; Exiled.Events.Handlers.Player.ChangingRole += BecomingSCP; } public void UnsubscribeEvents() { - Exiled.Events.Handlers.Player.ChangingRole -= OnChangingRole; Exiled.Events.Handlers.Player.ChangingRole -= BecomingSCP; } @@ -36,43 +34,6 @@ internal void StartBuff() { Timing.RunCoroutine(PeanutShield()); - } - - private Npc npc = null; - private string npcName = "Bonjour je suis la pour pas que le SCP wall-hack"; - private void OnChangingRole(ChangingRoleEventArgs ev) - { - if (IsHidingNpc(ev.Player)) return; - - Timing.CallDelayed(1f, delegate - { - int nbplayer = Player.Enumerable.Count(p => !p.IsScp && p.IsAlive && (!IsHidingNpc(p))); - Log.Debug("there's " + nbplayer); - if (nbplayer != 1) - { - Log.Debug("destroying npc"); - if(npc?.GameObject is not null) - { - npc?.Destroy(); - } - - } - - - if(nbplayer == 1) - { - if (npc is not null) - { - npc.Destroy(); - } - Log.Debug("spawning npc"); - npc = Npc.Spawn(npcName, RoleTypeId.ClassD, true, new Vector3(36, 314, -33)); - npc.IsSpectatable = false; - } - }); - - - } private bool IsHidingNpc(Player player) diff --git a/KruacentExiled/KE.Misc/KE.Misc.csproj b/KruacentExiled/KE.Misc/KE.Misc.csproj index b16800e1..1c04322b 100644 --- a/KruacentExiled/KE.Misc/KE.Misc.csproj +++ b/KruacentExiled/KE.Misc/KE.Misc.csproj @@ -17,6 +17,7 @@ + diff --git a/KruacentExiled/KE.Misc/MainPlugin.cs b/KruacentExiled/KE.Misc/MainPlugin.cs index c0a58ee0..91958369 100644 --- a/KruacentExiled/KE.Misc/MainPlugin.cs +++ b/KruacentExiled/KE.Misc/MainPlugin.cs @@ -14,6 +14,7 @@ using KE.Misc.Features.CR; using LightContainmentZoneDecontamination; using KE.Misc.Features.GamblingCoin; +using HarmonyLib; namespace KE.Misc { @@ -38,10 +39,13 @@ public class MainPlugin : Plugin internal AutoTesla AutoTesla { get; private set; } internal EventHandlers _gamblingCoinHandler { get; private set; } internal SpawnLcz SpawnLcz { get; private set; } + private Harmony harmony; public override void OnEnabled() { Instance = this; + harmony = new(Prefix); + _914 = new _914(); AutoElevator = new AutoElevator(); ClassDDoor = new ClassDDoor(); @@ -57,9 +61,9 @@ public override void OnEnabled() Respawn.SetTokens(SpawnableFaction.NtfWave, 2); Respawn.SetTokens(SpawnableFaction.ChaosWave, 2); - ClassDDoor.SubscribeEvents(); - + harmony.PatchAll(Assembly); + ClassDDoor.SubscribeEvents(); MiscFeature.SubscribeAllEvents(); if (Config.GamblingCoin) @@ -91,7 +95,7 @@ public override void OnDisabled() AutoTesla.StopLoop(); MiscFeature.UnsubscribeAllEvents(); ClassDDoor.UnsubscribeEvents(); - + harmony.UnpatchAll(harmony.Id); CustomRole.UnregisterRoles([typeof(Scp035)]); @@ -109,6 +113,7 @@ public override void OnDisabled() //SurfaceLight = null; GamblingCoinManager.DestroyAll(); _gamblingCoinHandler = null; + harmony = null; Instance = null; } diff --git a/KruacentExiled/KE.Misc/Patches/LastHumanTrackerPatches.cs b/KruacentExiled/KE.Misc/Patches/LastHumanTrackerPatches.cs new file mode 100644 index 00000000..fdd1a163 --- /dev/null +++ b/KruacentExiled/KE.Misc/Patches/LastHumanTrackerPatches.cs @@ -0,0 +1,24 @@ +using HarmonyLib; +using PlayerRoles.PlayableScps.HumanTracker; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace KE.Misc.Patches +{ + public static class LastHumanTrackerPatches + { + [HarmonyPatch(typeof(LastHumanTracker), nameof(LastHumanTracker.LateUpdate))] + public static class LateUpdatePatch + { + + public static bool Prefix() + { + return false; + } + + } + } +} From 8396bff9d99e1dfa83894c399c9bb9974f58f930 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Tue, 18 Nov 2025 18:59:58 +0100 Subject: [PATCH 419/853] finished the rework of scp 457 --- .../API/Features/CustomStatBase.cs | 73 +++++++++++++++++ .../API/Features/KEAbilities.cs | 27 +++++++ .../API/Features/KECustomRole.cs | 13 +++ .../Abilities/FireAbilities/BlindingFlash.cs | 33 ++++++++ .../Abilities/FireAbilities/FireAbility.cs | 61 ++++++++++++++ .../Abilities/FireAbilities/FireStat.cs | 79 +++++++++++++++++++ .../Abilities/{ => FireAbilities}/Fireball.cs | 77 +++++++++--------- .../KE.CustomRoles/CR/SCP/SCP457.cs | 41 ++++++---- .../KE.CustomRoles/Commands/Redocustomrole.cs | 65 +++++++++++++++ KruacentExiled/KE.CustomRoles/MainPlugin.cs | 3 +- 10 files changed, 418 insertions(+), 54 deletions(-) create mode 100644 KruacentExiled/KE.CustomRoles/API/Features/CustomStatBase.cs create mode 100644 KruacentExiled/KE.CustomRoles/Abilities/FireAbilities/BlindingFlash.cs create mode 100644 KruacentExiled/KE.CustomRoles/Abilities/FireAbilities/FireAbility.cs create mode 100644 KruacentExiled/KE.CustomRoles/Abilities/FireAbilities/FireStat.cs rename KruacentExiled/KE.CustomRoles/Abilities/{ => FireAbilities}/Fireball.cs (70%) create mode 100644 KruacentExiled/KE.CustomRoles/Commands/Redocustomrole.cs diff --git a/KruacentExiled/KE.CustomRoles/API/Features/CustomStatBase.cs b/KruacentExiled/KE.CustomRoles/API/Features/CustomStatBase.cs new file mode 100644 index 00000000..cab2856e --- /dev/null +++ b/KruacentExiled/KE.CustomRoles/API/Features/CustomStatBase.cs @@ -0,0 +1,73 @@ +using Exiled.API.Features; +using KE.Utils.API.Displays.DisplayMeow; +using MEC; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using UnityEngine; + +namespace KE.CustomRoles.API.Features +{ + public abstract class CustomStatBase : MonoBehaviour + { + public abstract float CurValue { get; set; } + + public abstract float MinValue { get; } + + public abstract float MaxValue { get; set; } + public abstract string Name { get; } + + public float NormalizedValue + { + get + { + if (MinValue != MaxValue) + { + return (CurValue - MinValue) / (MaxValue - MinValue); + } + + return 0f; + } + } + + public ReferenceHub Hub { get; set; } + + public virtual void AddAmount(float amount) + { + CurValue = Mathf.Clamp(CurValue + amount, MinValue, MaxValue); + } + + public void AddAmount(float amount, float percentageCap) + { + float max = MaxValue * Mathf.Clamp01(percentageCap); + float value = CurValue + amount; + AddAmount(value); + } + + + public virtual void FixedUpdate() + { + string text = Name + "\n" + Math.Floor(CurValue) + "/" + MaxValue; + DisplayHandler.Instance.AddHint(MainPlugin.RightHPbars, Player.Get(Hub), text, Timing.WaitForOneFrame); + } + + public virtual void ClassChanged() + { + } + + public virtual void Destroy() + { + Destroy(gameObject.GetComponent()); + + } + + public virtual void Init() + { + Hub = ReferenceHub.GetHub(gameObject); + } + + + } +} diff --git a/KruacentExiled/KE.CustomRoles/API/Features/KEAbilities.cs b/KruacentExiled/KE.CustomRoles/API/Features/KEAbilities.cs index b98e6630..04da413b 100644 --- a/KruacentExiled/KE.CustomRoles/API/Features/KEAbilities.cs +++ b/KruacentExiled/KE.CustomRoles/API/Features/KEAbilities.cs @@ -1,5 +1,6 @@ using Exiled.API.Features; using Exiled.API.Features.Pools; +using KE.CustomRoles.Abilities.FireAbilities; using KE.CustomRoles.Settings; using KE.Utils.API; using KE.Utils.API.Displays.DisplayMeow; @@ -9,6 +10,7 @@ using System.Linq; using System.Reflection; using System.Text; +using UnityEngine; namespace KE.CustomRoles.API.Features { @@ -447,6 +449,17 @@ public static void UpdateGUI(Player player) builder.Append(ability.PublicName); builder.Append(" "); + + if(ability is FireAbility fire) + { + builder.Append("("); + builder.Append(fire.Cost); + builder.Append(")"); + builder.Append(" "); + } + + + if (ability.CanUse(player,out var output)) { builder.Append(ReadyText); @@ -478,6 +491,20 @@ public static void UpdateGUI(Player player) } + public static void ShowEffectHint(Player player, string text) + { + float delay = MainPlugin.SettingHandler.GetTime(player); + DisplayHandler.Instance.AddHint(MainPlugin.CREffect, player, text, delay); + } + + + public static void ShowAbilityHint(Player player, string text) + { + float delay = MainPlugin.SettingHandler.GetTime(player); + DisplayHandler.Instance.AddHint(MainPlugin.AbilitiesDesc, player, text, delay); + } + + #endregion public override string ToString() diff --git a/KruacentExiled/KE.CustomRoles/API/Features/KECustomRole.cs b/KruacentExiled/KE.CustomRoles/API/Features/KECustomRole.cs index 00800d50..2f257350 100644 --- a/KruacentExiled/KE.CustomRoles/API/Features/KECustomRole.cs +++ b/KruacentExiled/KE.CustomRoles/API/Features/KECustomRole.cs @@ -359,6 +359,19 @@ public static bool HasCustomRole(Player player) } + public static IEnumerable Get(Player player) + { + List cr = new(); + foreach(KECustomRole ke in Registered) + { + if (ke.Check(player)) + { + cr.Add(ke); + } + } + return cr; + } + #region Spawn /// diff --git a/KruacentExiled/KE.CustomRoles/Abilities/FireAbilities/BlindingFlash.cs b/KruacentExiled/KE.CustomRoles/Abilities/FireAbilities/BlindingFlash.cs new file mode 100644 index 00000000..15fb8f99 --- /dev/null +++ b/KruacentExiled/KE.CustomRoles/Abilities/FireAbilities/BlindingFlash.cs @@ -0,0 +1,33 @@ +using Exiled.API.Features; +using Exiled.API.Features.Items; +using Exiled.API.Features.Pickups.Projectiles; + +namespace KE.CustomRoles.Abilities.FireAbilities +{ + public class BlindingFlash : FireAbility + { + public override string Name { get; } = "BlindingFlash"; + public override string PublicName { get; } = "Blinding Flash"; + + public override string Description { get; } = "Spawns an active flashbang at your feet"; + + public override float Cooldown { get; } = 30f; + + public override int Cost => 50; + + + + protected override bool LaunchedAbility(Player player) + { + FlashGrenade flashbangProjectile = Item.Create(ItemType.GrenadeFlash); + + flashbangProjectile.FuseTime = .1f; + flashbangProjectile.SpawnActive(player.Position, player); + return true; + } + + + + } + +} diff --git a/KruacentExiled/KE.CustomRoles/Abilities/FireAbilities/FireAbility.cs b/KruacentExiled/KE.CustomRoles/Abilities/FireAbilities/FireAbility.cs new file mode 100644 index 00000000..d6d3d2c4 --- /dev/null +++ b/KruacentExiled/KE.CustomRoles/Abilities/FireAbilities/FireAbility.cs @@ -0,0 +1,61 @@ +using Exiled.API.Features; +using KE.CustomRoles.API.Features; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace KE.CustomRoles.Abilities.FireAbilities +{ + public abstract class FireAbility : KEAbilities + { + public abstract int Cost { get; } + public bool Exclusive => false; + protected sealed override bool AbilityUsed(Player player) + { + bool result = CanLaunchAbility(player); + if (result) + { + result= LaunchedAbility(player); + } + + + + + return result; + } + + protected virtual bool LaunchedAbility(Player player) + { + return true; + } + + public bool CanLaunchAbility(Player player) + { + if (!player.GameObject.TryGetComponent(out var stat) && Exclusive) + { + Log.Warn($"Exclusive ability ({Name}) used by a player ({player}) without the proper stat"); + return false; + } + + if (stat is not null) + { + Log.Debug(stat.CurValue); + if (stat.CurValue < Cost) + { + ShowAbilityHint(player, "not enough " + stat.Name); + + return false; + } + stat.AddAmount(-Cost); + } + + return true; + + } + + + + } +} diff --git a/KruacentExiled/KE.CustomRoles/Abilities/FireAbilities/FireStat.cs b/KruacentExiled/KE.CustomRoles/Abilities/FireAbilities/FireStat.cs new file mode 100644 index 00000000..188dd680 --- /dev/null +++ b/KruacentExiled/KE.CustomRoles/Abilities/FireAbilities/FireStat.cs @@ -0,0 +1,79 @@ +using Exiled.API.Features; +using KE.CustomRoles.API.Features; +using MEC; +using PlayerStatsSystem; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Security.Cryptography; +using System.Text; +using System.Threading.Tasks; +using UnityEngine; + +namespace KE.CustomRoles.Abilities.FireAbilities +{ + public class FireStat : CustomStatBase + { + + public float BaseCapacity => MaxValue; + + public override float CurValue { get; set; } + + public override float MinValue => 0; + + private float maxvalue = 100; + public override float MaxValue + { + get + { + return maxvalue; + } + set + { + maxvalue = value; + } + } + + public override string Name => "Fire"; + + public float FireRegen { get; set; } = 3; + + + private float stoptime = 120; + private float currentstoptime = 0; + + + public override void AddAmount(float amount) + { + currentstoptime = stoptime; + base.AddAmount(amount); + } + + public override void FixedUpdate() + { + + if (currentstoptime <= 0) + { + + float num = FireRegen * Time.deltaTime; + if (num > 0f) + { + if (CurValue < MaxValue) + { + CurValue = Mathf.MoveTowards(CurValue, MaxValue, num); + } + } + else if (CurValue > 0f) + { + CurValue += num; + } + } + else + { + currentstoptime--; + } + base.FixedUpdate(); + } + + } +} diff --git a/KruacentExiled/KE.CustomRoles/Abilities/Fireball.cs b/KruacentExiled/KE.CustomRoles/Abilities/FireAbilities/Fireball.cs similarity index 70% rename from KruacentExiled/KE.CustomRoles/Abilities/Fireball.cs rename to KruacentExiled/KE.CustomRoles/Abilities/FireAbilities/Fireball.cs index aa3290c7..8bd35e79 100644 --- a/KruacentExiled/KE.CustomRoles/Abilities/Fireball.cs +++ b/KruacentExiled/KE.CustomRoles/Abilities/FireAbilities/Fireball.cs @@ -1,8 +1,10 @@ -using Exiled.API.Features; +using Discord; +using Exiled.API.Features; using Exiled.API.Features.Doors; using Exiled.API.Features.Roles; using Exiled.API.Features.Toys; using Exiled.API.Interfaces; +using Exiled.Events.EventArgs.Player; using Exiled.Events.Patches.Events.Player; using KE.CustomRoles.API.Features; using MEC; @@ -11,25 +13,25 @@ using UnityEngine; using Light = Exiled.API.Features.Toys.Light; -namespace KE.CustomRoles.Abilities +namespace KE.CustomRoles.Abilities.FireAbilities { - public class Fireball : KEAbilities + public class Fireball : FireAbility { public override string Name { get; } = "Fireball"; public override string PublicName { get; } = "Fireball"; + public override int Cost => 10; public override string Description { get; } = "I cast Fireball"; public override float Cooldown { get; } = 2f; - public const float VIGOR_COST = .1f; public static readonly CustomReasonDamageHandler BallDamage = new("Burned to death", 25, string.Empty); - public const int MAX_BALLS = 3; + public const int MAX_BALLS = 5; private static readonly Color ballColor = new(2, 1.08f, 0, .75f); private Dictionary _activeBalls = new(); - protected override bool AbilityUsed(Player player) + protected override bool LaunchedAbility(Player player) { if (!_activeBalls.ContainsKey(player)) { @@ -37,31 +39,21 @@ protected override bool AbilityUsed(Player player) } - if (_activeBalls[player] >= MAX_BALLS) return true; - - - - if (player.Role is Scp106Role role106) + if (_activeBalls[player] >= MAX_BALLS) { - if (role106.Vigor <= VIGOR_COST) return true; - role106.Vigor -= VIGOR_COST; + ShowEffectHint(player, "too much balls"); + return true; } + _activeBalls[player]++; Timing.RunCoroutine(LaunchingAttack(player)); - return base.AbilityUsed(player); + return true; } - protected override void AbilityRemoved(Player player) - { - - - base.AbilityRemoved(player); - } - - private float smooth = .001f; + private float smooth = .01f; private IEnumerator LaunchingAttack(Player player) { @@ -82,35 +74,42 @@ private IEnumerator LaunchingAttack(Player player) light.Spawn(); Vector3 nextPos; - int fallback = 100; + int fallback = Mathf.CeilToInt(100/ smooth); Log.Debug("fallback=" + fallback); while (!attackTouchedSomething && fallback > 0) { - nextPos = primitive.Position + primitive.Rotation * new Vector3(0, 0, smooth); - RaycastHit hit; + nextPos = primitive.Position + primitive.Rotation * new Vector3(0, 0, 10*smooth); - if (Physics.Linecast(primitive.Position, nextPos, out hit)) + + if (Physics.Linecast(primitive.Position, nextPos, out RaycastHit hit)) { - ProcessHit(player,hit.collider); + //spawn mtf looking at central gate + if (hit.collider.gameObject.name != "VolumeOverrideTunnel") + { + attackTouchedSomething = true; + } } - else - { - Collider[] colliders = Physics.OverlapSphere(primitive.Position, 1); + Collider[] colliders = Physics.OverlapSphere(primitive.Position, .5f); - foreach(Collider collider in colliders) - { - ProcessHit(player, collider); - } + + + foreach(Collider collider in colliders) + { + + attackTouchedSomething = attackTouchedSomething || ProcessHit(player, collider); } + + + Log.Debug($"current pos = {primitive.Position} next pos = {nextPos}"); - yield return Timing.WaitForSeconds(1f/smooth); + yield return Timing.WaitForSeconds(smooth); primitive.Position = nextPos; light.Position = nextPos; fallback--; @@ -121,14 +120,15 @@ private IEnumerator LaunchingAttack(Player player) } - private void ProcessHit(Player attacker,Collider collider) + private bool ProcessHit(Player attacker,Collider collider) { - + bool result = false; Player playerhit = Player.Get(collider); if (playerhit != null && playerhit.Role.Side != attacker.Role.Side) { playerhit.Hurt(BallDamage); attacker.ShowHitMarker(); + result = true; } @@ -137,7 +137,10 @@ private void ProcessHit(Player attacker,Collider collider) { damageable.Break(); attacker.ShowHitMarker(); + result = true; } + + return result; } diff --git a/KruacentExiled/KE.CustomRoles/CR/SCP/SCP457.cs b/KruacentExiled/KE.CustomRoles/CR/SCP/SCP457.cs index 11ac4820..9136601f 100644 --- a/KruacentExiled/KE.CustomRoles/CR/SCP/SCP457.cs +++ b/KruacentExiled/KE.CustomRoles/CR/SCP/SCP457.cs @@ -4,8 +4,9 @@ using Exiled.API.Features.Roles; using Exiled.API.Features.Toys; using Exiled.API.Interfaces; +using Exiled.Events.Commands.Reload; using Exiled.Events.EventArgs.Scp106; -using KE.CustomRoles.Abilities; +using KE.CustomRoles.Abilities.FireAbilities; using KE.CustomRoles.API.Features; using KE.Utils.API; using MEC; @@ -21,7 +22,7 @@ namespace KE.CustomRoles.CR.SCP public class SCP457 : CustomSCP { - public override string Description { get; set; } = "You do passive damage around you, and can lauch fireballs"; + public override string Description { get; set; } = "You do passive damage around you\nsi vous pouvez pas traversé les portes .rcr dans la console client"; public override string PublicName { get; set; } = "SCP-457"; public override int MaxHealth { get; set; } = 5000; public override RoleTypeId Role { get; set; } = RoleTypeId.Scp106; @@ -38,11 +39,13 @@ public class SCP457 : CustomSCP public static float DamageRefreshRate = 5f; public static readonly Color FlameColor = new(2, 1.08f, 0); + public Collider[] SphereNonAlloc = new Collider[8]; public override HashSet Abilities => [ - "Fireball" + "Fireball", + "BlindingFlash" ]; @@ -52,6 +55,9 @@ protected override void RoleAdded(Player player) _inside.Add(player, null); _handles.Add(player, new()); + FireStat firestat = player.ReferenceHub.gameObject.AddComponent(); + firestat.Init(); + _handles[player].Add(Timing.RunCoroutine(InsideLight(player))); _handles[player].Add(Timing.RunCoroutine(PassiveDamage(player))); @@ -79,21 +85,22 @@ private IEnumerator PassiveDamage(Player scp) { while (scp.IsAlive) { - foreach (Player allP in Player.List.Where(p => p != scp && p.Role.Side != scp.Role.Side)) - { - if (OtherUtils.IsInCircle(allP.Position, scp.Position, 5)) + if(Physics.OverlapSphereNonAlloc(scp.Position,5, SphereNonAlloc) > 0) + { + for (int i = 0; i < SphereNonAlloc.Length; i++) { - - Physics.Linecast(allP.Position, scp.Position, out var hitinfo); - float damage = -(hitinfo.distance / 3) + 10; - Log.Debug($"damâge={damage} dist = {hitinfo.distance}"); - allP.EnableEffect(Exiled.API.Enums.EffectType.Burned, DamageRefreshRate, true); - allP.Hurt(damage, Fireball.BallDamage._deathReason); - scp.CustomHumeShieldStat.AddAmount(damage); - - + Player player = Player.Get(SphereNonAlloc[i]); + if (player is null) continue; + if(Physics.Linecast(player.Position, scp.Position, out var hitinfo)) + { + float damage = -(hitinfo.distance / 3) + 10; + player.EnableEffect(Exiled.API.Enums.EffectType.Burned, DamageRefreshRate, true); + player.Hurt(damage, Fireball.BallDamage._deathReason); + scp.CustomHumeShieldStat.AddAmount(damage); + } + } } yield return Timing.WaitForSeconds(DamageRefreshRate); @@ -124,7 +131,9 @@ protected override void RoleRemoved(Player player) } _handles.Remove(player); } - + FireStat firestat = player.ReferenceHub.gameObject.GetComponent(); + firestat.Destroy(); + } diff --git a/KruacentExiled/KE.CustomRoles/Commands/Redocustomrole.cs b/KruacentExiled/KE.CustomRoles/Commands/Redocustomrole.cs new file mode 100644 index 00000000..7fda08b1 --- /dev/null +++ b/KruacentExiled/KE.CustomRoles/Commands/Redocustomrole.cs @@ -0,0 +1,65 @@ +using CommandSystem; +using Exiled.API.Features; +using Exiled.CustomRoles; +using KE.CustomRoles.API.Features; +using MEC; +using PlayerRoles; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace KE.CustomRoles.Commands +{ + + [CommandHandler(typeof(ClientCommandHandler))] + public class Redocustomrole : ICommand + { + public string Command => "rcr"; + + public string[] Aliases => []; + + public string Description => "redo the custom role"; + + public bool Execute(ArraySegment arguments, ICommandSender sender, out string response) + { + Player player = Player.Get(sender); + + response = "no"; + if (player is not null) + { + KECustomRole ke = null; + RoleTypeId role = player.Role; + List list = KECustomRole.Get(player).ToList(); + if (list is null) + { + response = "no cr"; + return false; + } + + ke = list[0]; + + + if(role == RoleTypeId.ClassD) + { + player.Role.Set(RoleTypeId.Scientist, RoleSpawnFlags.None); + } + else + { + player.Role.Set(RoleTypeId.ClassD, RoleSpawnFlags.None); + } + ke.RemoveRole(player); + Timing.CallDelayed(.1f, delegate + { + ke.AddRole(player); + }); + + } + + + response = "ok"; + return true; + } + } +} diff --git a/KruacentExiled/KE.CustomRoles/MainPlugin.cs b/KruacentExiled/KE.CustomRoles/MainPlugin.cs index 7590df23..e57e3a65 100644 --- a/KruacentExiled/KE.CustomRoles/MainPlugin.cs +++ b/KruacentExiled/KE.CustomRoles/MainPlugin.cs @@ -26,7 +26,8 @@ public class MainPlugin : Plugin public static readonly HintPlacement CRHint = new(0, 750); public static readonly HintPlacement CREffect = new(700, 300); public static readonly HintPlacement AbilitiesDesc = new(0, 900); - public static readonly HintPlacement Abilities = new(0, 950,HintServiceMeow.Core.Enum.HintAlignment.Left); + public static readonly HintPlacement Abilities = new(0, 850,HintServiceMeow.Core.Enum.HintAlignment.Left); + public static readonly HintPlacement RightHPbars = new(55, 1000,HintServiceMeow.Core.Enum.HintAlignment.Left); public static Translations Translations => Instance?.Translation; private SettingHandler _settingHandler; internal static SettingHandler SettingHandler => Instance?._settingHandler; From abe10be47a9e8073cff43de828275785780cf6ea Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Tue, 18 Nov 2025 19:04:36 +0100 Subject: [PATCH 420/853] removed other useless project --- .../KE.CustomRoles/KE.CustomRoles.csproj | 4 ---- KruacentExiled/KE.Misc/Features/914.cs | 18 +----------------- .../Features/914Upgrades/Base914Upgrade.cs | 7 +------ .../Features/914Upgrades/PlayerTeleport914.cs | 6 ------ KruacentExiled/KE.Misc/Features/SCPBuff.cs | 5 ----- KruacentExiled/KE.Misc/KE.Misc.csproj | 7 ++----- KruacentExiled/KruacentExiled.sln | 12 ------------ 7 files changed, 4 insertions(+), 55 deletions(-) diff --git a/KruacentExiled/KE.CustomRoles/KE.CustomRoles.csproj b/KruacentExiled/KE.CustomRoles/KE.CustomRoles.csproj index a96f8fbc..20d05e3f 100644 --- a/KruacentExiled/KE.CustomRoles/KE.CustomRoles.csproj +++ b/KruacentExiled/KE.CustomRoles/KE.CustomRoles.csproj @@ -8,10 +8,6 @@ - - - - diff --git a/KruacentExiled/KE.Misc/Features/914.cs b/KruacentExiled/KE.Misc/Features/914.cs index 04e40edd..11acf469 100644 --- a/KruacentExiled/KE.Misc/Features/914.cs +++ b/KruacentExiled/KE.Misc/Features/914.cs @@ -1,20 +1,4 @@ -using Exiled.API.Enums; -using Exiled.Events.EventArgs.Scp914; -using PlayerRoles; -using Scp914; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using Exiled.API.Features; -using Exiled.API.Extensions; -using UnityEngine; -using YamlDotNet.Core.Tokens; -using Exiled.CustomRoles.API.Features; -using KE.Misc.Features; -using KE.Utils.API; -using KE.Misc.Features._914Upgrades; +using KE.Misc.Features._914Upgrades; namespace KE.Misc.Features { diff --git a/KruacentExiled/KE.Misc/Features/914Upgrades/Base914Upgrade.cs b/KruacentExiled/KE.Misc/Features/914Upgrades/Base914Upgrade.cs index 15cbcefd..825e2ad0 100644 --- a/KruacentExiled/KE.Misc/Features/914Upgrades/Base914Upgrade.cs +++ b/KruacentExiled/KE.Misc/Features/914Upgrades/Base914Upgrade.cs @@ -1,14 +1,9 @@ using Exiled.API.Features; -using Exiled.CustomItems.API.Features; using Exiled.Events.EventArgs.Scp914; using KE.Utils.API.Interfaces; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; using UnityEngine; + namespace KE.Misc.Features._914Upgrades { public abstract class Base914Upgrade : IUsingEvents diff --git a/KruacentExiled/KE.Misc/Features/914Upgrades/PlayerTeleport914.cs b/KruacentExiled/KE.Misc/Features/914Upgrades/PlayerTeleport914.cs index 22b10737..7e9a7137 100644 --- a/KruacentExiled/KE.Misc/Features/914Upgrades/PlayerTeleport914.cs +++ b/KruacentExiled/KE.Misc/Features/914Upgrades/PlayerTeleport914.cs @@ -3,14 +3,8 @@ using Exiled.Events.EventArgs.Scp914; using KE.Utils.Extensions; using MEC; -using PlayerRoles; using Scp914; using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using UnityEngine; namespace KE.Misc.Features._914Upgrades { diff --git a/KruacentExiled/KE.Misc/Features/SCPBuff.cs b/KruacentExiled/KE.Misc/Features/SCPBuff.cs index 049f438c..885f836c 100644 --- a/KruacentExiled/KE.Misc/Features/SCPBuff.cs +++ b/KruacentExiled/KE.Misc/Features/SCPBuff.cs @@ -36,11 +36,6 @@ internal void StartBuff() } - private bool IsHidingNpc(Player player) - { - return player is Npc hide && hide.Nickname == npcName; - } - private void BecomingSCP(ChangingRoleEventArgs ev) { diff --git a/KruacentExiled/KE.Misc/KE.Misc.csproj b/KruacentExiled/KE.Misc/KE.Misc.csproj index 1c04322b..5e052dc5 100644 --- a/KruacentExiled/KE.Misc/KE.Misc.csproj +++ b/KruacentExiled/KE.Misc/KE.Misc.csproj @@ -10,11 +10,6 @@ - - - - - @@ -23,6 +18,8 @@ + + diff --git a/KruacentExiled/KruacentExiled.sln b/KruacentExiled/KruacentExiled.sln index 13caf3f8..b6923062 100644 --- a/KruacentExiled/KruacentExiled.sln +++ b/KruacentExiled/KruacentExiled.sln @@ -3,10 +3,6 @@ Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio Version 17 VisualStudioVersion = 17.12.35506.116 MinimumVisualStudioVersion = 10.0.40219.1 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "KE.Utils", "KE.Utils\KE.Utils.csproj", "{DFEF41B3-5BD3-428A-A7BA-7A490E65C71F}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "KE.CustomRoles", "KE.CustomRoles\KE.CustomRoles.csproj", "{33CC074C-06DD-4545-91F2-F668F3C4779D}" -EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "KE.Misc", "KE.Misc\KE.Misc.csproj", "{378DD640-986B-4DA9-8C65-8D318E99E98C}" EndProject Global @@ -15,14 +11,6 @@ Global Release|Any CPU = Release|Any CPU EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution - {DFEF41B3-5BD3-428A-A7BA-7A490E65C71F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {DFEF41B3-5BD3-428A-A7BA-7A490E65C71F}.Debug|Any CPU.Build.0 = Debug|Any CPU - {DFEF41B3-5BD3-428A-A7BA-7A490E65C71F}.Release|Any CPU.ActiveCfg = Release|Any CPU - {DFEF41B3-5BD3-428A-A7BA-7A490E65C71F}.Release|Any CPU.Build.0 = Release|Any CPU - {33CC074C-06DD-4545-91F2-F668F3C4779D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {33CC074C-06DD-4545-91F2-F668F3C4779D}.Debug|Any CPU.Build.0 = Debug|Any CPU - {33CC074C-06DD-4545-91F2-F668F3C4779D}.Release|Any CPU.ActiveCfg = Release|Any CPU - {33CC074C-06DD-4545-91F2-F668F3C4779D}.Release|Any CPU.Build.0 = Release|Any CPU {378DD640-986B-4DA9-8C65-8D318E99E98C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {378DD640-986B-4DA9-8C65-8D318E99E98C}.Debug|Any CPU.Build.0 = Debug|Any CPU {378DD640-986B-4DA9-8C65-8D318E99E98C}.Release|Any CPU.ActiveCfg = Release|Any CPU From 7016a77f8e5bdb12935d4435c5ba338086b4e75a Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Tue, 18 Nov 2025 19:18:42 +0100 Subject: [PATCH 421/853] changed spawn preferences to use name instead of id --- KruacentExiled/KE.Misc/Features/Spawn.cs | 62 +++++++++++++----------- 1 file changed, 35 insertions(+), 27 deletions(-) diff --git a/KruacentExiled/KE.Misc/Features/Spawn.cs b/KruacentExiled/KE.Misc/Features/Spawn.cs index f7b76d21..7ce87a04 100644 --- a/KruacentExiled/KE.Misc/Features/Spawn.cs +++ b/KruacentExiled/KE.Misc/Features/Spawn.cs @@ -17,17 +17,18 @@ namespace KE.Misc.Features { internal class Spawn : MiscFeature { - private RoleTypeId[] baseRole = - [ - RoleTypeId.Scp173, - RoleTypeId.Scp106, - RoleTypeId.Scp049, - RoleTypeId.Scp079, - RoleTypeId.Scp096, - RoleTypeId.Scp939, - ]; - - private Dictionary SelectableCustomSCPs => CustomSCP.All.Where(cs => cs.Id >= baseRole.Length).ToDictionary(cs => (int)cs.Id, cs => cs); + + private Dictionary baseRole = new () + { + { "173", RoleTypeId.Scp173 }, + { "106", RoleTypeId.Scp106 }, + { "049", RoleTypeId.Scp049 }, + { "079", RoleTypeId.Scp079 }, + { "096", RoleTypeId.Scp096 }, + { "939", RoleTypeId.Scp939 }, + }; + + private Dictionary SelectableCustomSCPs => CustomSCP.All.ToDictionary(cs =>cs.Name, cs => cs); private bool _set035 = true; @@ -53,7 +54,7 @@ private void SetScpPreferences(Player player) Log.Warn("no config, no custom preferences this round"); return; } - Dictionary chancescp = GetPreferences(player); + Dictionary chancescp = GetPreferences(player); if(chancescp == null) { @@ -61,7 +62,7 @@ private void SetScpPreferences(Player player) } - int roleScp = ChooseRandomRole(chancescp); + string roleScp = ChooseRandomRole(chancescp); Log.Debug($"Scp ({player.Nickname}) is {roleScp} previous : {player.Role.Type}"); SetRoleWithId(player, roleScp); @@ -99,34 +100,34 @@ private void SetScpPreferences(Player player) } - private Dictionary GetPreferences(Player player) + private Dictionary GetPreferences(Player player) { if (player.ScpPreferences.Preferences == null) return null; - Dictionary idChance = new(); + Dictionary idChance = new(); - for (int i = 0; i < baseRole.Length; i++) + + foreach(var kvp in baseRole) { - idChance.Add(i, player.ScpPreferences.Preferences[baseRole[i]]+5); + idChance.Add(kvp.Key, player.ScpPreferences.Preferences[kvp.Value] + 5); } - foreach(CustomSCP customSCP in SelectableCustomSCPs.Values) + foreach (CustomSCP customSCP in SelectableCustomSCPs.Values) { - idChance.Add((int)customSCP.Id, customSCP.GetPreferences(player)+5); + idChance.Add(customSCP.Name, customSCP.GetPreferences(player) + 5); } - return idChance; } - private int ChooseRandomRole(IDictionary chancescp) + private string ChooseRandomRole(IDictionary chancescp) { if (chancescp == null) throw new ArgumentException("Dictionary null"); - List weightedPool = new(); - foreach (int ge in chancescp.Keys) + List weightedPool = new(); + foreach (string ge in chancescp.Keys) { for (int i = 0; i < chancescp[ge]; i++) { @@ -140,17 +141,24 @@ private int ChooseRandomRole(IDictionary chancescp) return weightedPool[randomIndex]; } - private void SetRoleWithId(Player player, int id) + private void SetRoleWithId(Player player, string name) { - if(id < baseRole.Length) + if (baseRole.ContainsKey(name)) { - player.Role.Set(baseRole[id],SpawnReason.RoundStart); + player.Role.Set(baseRole[name], SpawnReason.RoundStart); } else { - SelectableCustomSCPs[id].AddRole(player); + if (SelectableCustomSCPs.ContainsKey(name)) + { + SelectableCustomSCPs[name].AddRole(player); + } + } + + Log.Error("scp not found"); + } From cca04247485a81cd57c752047df0d2b8b1ba20ed Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Tue, 18 Nov 2025 19:19:14 +0100 Subject: [PATCH 422/853] remopved somaekl --- KruacentExiled/KE.Items/Items/Smoke.cs | 73 -------------------------- 1 file changed, 73 deletions(-) delete mode 100644 KruacentExiled/KE.Items/Items/Smoke.cs diff --git a/KruacentExiled/KE.Items/Items/Smoke.cs b/KruacentExiled/KE.Items/Items/Smoke.cs deleted file mode 100644 index 74989c65..00000000 --- a/KruacentExiled/KE.Items/Items/Smoke.cs +++ /dev/null @@ -1,73 +0,0 @@ -using Exiled.API.Features.Attributes; -using Exiled.API.Features.Items; -using Exiled.API.Features.Pickups; -using Exiled.API.Features.Spawn; -using Exiled.Events.EventArgs.Map; -using Exiled.Events.EventArgs.Player; -using KE.Items.API.Features; -using MEC; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using UnityEngine; - -namespace KE.Items.Items -{ - [CustomItem(ItemType.GrenadeFlash)] - public class Smoke : KECustomGrenade - { - public override uint Id { get; set; } = 2000; - public override string Name { get; set; } = "Smoke Grenade"; - public override string Description { get; set; } = "smoke"; - public override bool ExplodeOnCollision { get; set; } = false; - public override float FuseTime { get; set; } = 5; - public override float Weight { get; set; } = 0.65f; - public override SpawnProperties SpawnProperties { get; set; } = new(); - - public const float Duration = 20; - private HashSet pickups = new(); - - protected override void OnExploding(ExplodingGrenadeEventArgs ev) - { - if (!Check(ev.Projectile)) return; - Vector3 position = ev.Position; - Scp244 scp = (Scp244) Scp244.Create(ItemType.SCP244a); - scp.Primed = true; - scp.MaxDiameter = float.Epsilon; - - Pickup p = scp.CreatePickup(position, null, false); - - p.Scale = Vector3.one / 10; - p.Spawn(); - pickups.Add(p); - - Timing.CallDelayed(Duration, delegate - { - pickups.Remove(p); - p.Destroy(); - }); - } - - protected override void SubscribeEvents() - { - Exiled.Events.Handlers.Player.PickingUpItem += OnPickingUpItem; - base.SubscribeEvents(); - } - - protected override void UnsubscribeEvents() - { - Exiled.Events.Handlers.Player.PickingUpItem -= OnPickingUpItem; - base.UnsubscribeEvents(); - } - - private void OnPickingUpItem(PickingUpItemEventArgs ev) - { - if (!pickups.Contains(ev.Pickup)) return; - - ev.IsAllowed = false; - - } - } -} From 67d7ffc4efce7e586e9499fce2834e710ff707e5 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Tue, 18 Nov 2025 19:22:41 +0100 Subject: [PATCH 423/853] changed pressepuree fuse time --- KruacentExiled/KE.Items/Items/PressePuree.cs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/KruacentExiled/KE.Items/Items/PressePuree.cs b/KruacentExiled/KE.Items/Items/PressePuree.cs index e81d9fed..869c274a 100644 --- a/KruacentExiled/KE.Items/Items/PressePuree.cs +++ b/KruacentExiled/KE.Items/Items/PressePuree.cs @@ -25,7 +25,7 @@ public class PressePuree : KECustomGrenade, IUpgradableCustomItem, ICustomPickup public override string Name { get; set; } = "Presse Purée"; public override string Description { get; set; } = "The grenade explode at impact but does less damage"; public override float Weight { get; set; } = 0.65f; - public override float FuseTime { get; set; } = 1.5f; + public override float FuseTime { get; set; } = 5f; public override bool ExplodeOnCollision { get; set; } = true; public PickupModel PickupModel { get; } public override SpawnProperties SpawnProperties { get; set; } = new SpawnProperties() @@ -96,7 +96,6 @@ private void OnExplodeDestructible(OnExplodeDestructibleEventsArgs ev) public IReadOnlyDictionary Upgrade { get; private set; } = new Dictionary() { - //very fine -> true divine pills 10% { Scp914KnobSetting.VeryFine,new UpgradeProperties(5, 1055)} }; } From ca554a305908ac93c06bd8f6a70644ca4ead5370 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Tue, 18 Nov 2025 19:27:08 +0100 Subject: [PATCH 424/853] removed KEutils --- KruacentExiled/KE.Map/KE.Map.csproj | 5 ++--- KruacentExiled/KruacentExiled.sln | 16 +++++----------- 2 files changed, 7 insertions(+), 14 deletions(-) diff --git a/KruacentExiled/KE.Map/KE.Map.csproj b/KruacentExiled/KE.Map/KE.Map.csproj index 3b90d156..8be3c4d1 100644 --- a/KruacentExiled/KE.Map/KE.Map.csproj +++ b/KruacentExiled/KE.Map/KE.Map.csproj @@ -10,9 +10,7 @@ - - - + @@ -23,6 +21,7 @@ + diff --git a/KruacentExiled/KruacentExiled.sln b/KruacentExiled/KruacentExiled.sln index 3bdb6d23..e1d7ffb2 100644 --- a/KruacentExiled/KruacentExiled.sln +++ b/KruacentExiled/KruacentExiled.sln @@ -9,11 +9,9 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "KE.Misc", "KE.Misc\KE.Misc. EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "KE.GlobalEventFramework", "KE.GlobalEventFramework\KE.GlobalEventFramework.csproj", "{73D6C740-96DE-4965-898F-DDD5BCBF7366}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "KE.GlobalEventFramework.Examples", "KE.GlobalEventFramework.Examples\KE.GlobalEventFramework.Examples.csproj", "{07B92E87-F48F-4F9F-BA0E-1BCB2AF52F53}" -EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "KE.CustomRoles", "KE.CustomRoles\KE.CustomRoles.csproj", "{4AA4C3E0-E62F-49CE-AD80-0B5C6249EB48}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "KE.Utils", "KE.Utils\KE.Utils.csproj", "{DFEF41B3-5BD3-428A-A7BA-7A490E65C71F}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "KE.GlobalEventFramework.Examples", "KE.GlobalEventFramework.Examples\KE.GlobalEventFramework.Examples.csproj", "{07B92E87-F48F-4F9F-BA0E-1BCB2AF52F53}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "KE.Map", "KE.Map\KE.Map.csproj", "{2BD019AC-1B86-4E00-B418-BE4C06CD8410}" EndProject @@ -35,18 +33,14 @@ Global {73D6C740-96DE-4965-898F-DDD5BCBF7366}.Debug|Any CPU.Build.0 = Debug|Any CPU {73D6C740-96DE-4965-898F-DDD5BCBF7366}.Release|Any CPU.ActiveCfg = Release|Any CPU {73D6C740-96DE-4965-898F-DDD5BCBF7366}.Release|Any CPU.Build.0 = Release|Any CPU - {07B92E87-F48F-4F9F-BA0E-1BCB2AF52F53}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {07B92E87-F48F-4F9F-BA0E-1BCB2AF52F53}.Debug|Any CPU.Build.0 = Debug|Any CPU - {07B92E87-F48F-4F9F-BA0E-1BCB2AF52F53}.Release|Any CPU.ActiveCfg = Release|Any CPU - {07B92E87-F48F-4F9F-BA0E-1BCB2AF52F53}.Release|Any CPU.Build.0 = Release|Any CPU {4AA4C3E0-E62F-49CE-AD80-0B5C6249EB48}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {4AA4C3E0-E62F-49CE-AD80-0B5C6249EB48}.Debug|Any CPU.Build.0 = Debug|Any CPU {4AA4C3E0-E62F-49CE-AD80-0B5C6249EB48}.Release|Any CPU.ActiveCfg = Release|Any CPU {4AA4C3E0-E62F-49CE-AD80-0B5C6249EB48}.Release|Any CPU.Build.0 = Release|Any CPU - {DFEF41B3-5BD3-428A-A7BA-7A490E65C71F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {DFEF41B3-5BD3-428A-A7BA-7A490E65C71F}.Debug|Any CPU.Build.0 = Debug|Any CPU - {DFEF41B3-5BD3-428A-A7BA-7A490E65C71F}.Release|Any CPU.ActiveCfg = Release|Any CPU - {DFEF41B3-5BD3-428A-A7BA-7A490E65C71F}.Release|Any CPU.Build.0 = Release|Any CPU + {07B92E87-F48F-4F9F-BA0E-1BCB2AF52F53}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {07B92E87-F48F-4F9F-BA0E-1BCB2AF52F53}.Debug|Any CPU.Build.0 = Debug|Any CPU + {07B92E87-F48F-4F9F-BA0E-1BCB2AF52F53}.Release|Any CPU.ActiveCfg = Release|Any CPU + {07B92E87-F48F-4F9F-BA0E-1BCB2AF52F53}.Release|Any CPU.Build.0 = Release|Any CPU {2BD019AC-1B86-4E00-B418-BE4C06CD8410}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {2BD019AC-1B86-4E00-B418-BE4C06CD8410}.Debug|Any CPU.Build.0 = Debug|Any CPU {2BD019AC-1B86-4E00-B418-BE4C06CD8410}.Release|Any CPU.ActiveCfg = Release|Any CPU From 967573ac84ad0f2e2ebde3d30ee200b6fdf06d62 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Tue, 18 Nov 2025 21:32:55 +0100 Subject: [PATCH 425/853] fixed 457 being able to attack --- KruacentExiled/KE.CustomRoles/CR/SCP/SCP457.cs | 14 +++++++++++++- .../KE.CustomRoles/KE.CustomRoles.csproj | 4 +--- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/KruacentExiled/KE.CustomRoles/CR/SCP/SCP457.cs b/KruacentExiled/KE.CustomRoles/CR/SCP/SCP457.cs index 9136601f..2db8b826 100644 --- a/KruacentExiled/KE.CustomRoles/CR/SCP/SCP457.cs +++ b/KruacentExiled/KE.CustomRoles/CR/SCP/SCP457.cs @@ -155,6 +155,7 @@ protected override void SubscribeEvents() { Exiled.Events.Handlers.Scp106.Stalking += OnStalking; Exiled.Events.Handlers.Scp106.Teleporting += OnTP; + Exiled.Events.Handlers.Scp106.Attacking += OnAttacking; base.SubscribeEvents(); } @@ -163,8 +164,19 @@ protected override void UnsubscribeEvents() { Exiled.Events.Handlers.Scp106.Stalking -= OnStalking; Exiled.Events.Handlers.Scp106.Teleporting -= OnTP; + Exiled.Events.Handlers.Scp106.Attacking -= OnAttacking; base.UnsubscribeEvents(); } - } + + private void OnAttacking(AttackingEventArgs ev) + { + if (!Check(ev.Player)) return; + + ev.IsAllowed = false; + } + + + + } } diff --git a/KruacentExiled/KE.CustomRoles/KE.CustomRoles.csproj b/KruacentExiled/KE.CustomRoles/KE.CustomRoles.csproj index 4d986391..eb2d644b 100644 --- a/KruacentExiled/KE.CustomRoles/KE.CustomRoles.csproj +++ b/KruacentExiled/KE.CustomRoles/KE.CustomRoles.csproj @@ -8,9 +8,6 @@ - - - @@ -21,6 +18,7 @@ + From 608d38f802560d0ce16e77e9a2bb709cfdd3f043 Mon Sep 17 00:00:00 2001 From: OmerGS <27omerf@gmail.com> Date: Wed, 19 Nov 2025 11:24:29 +0100 Subject: [PATCH 426/853] item fix --- .../ItemEffects/LowGravityGrenadeEffect.cs | 19 ++++--- .../ItemEffects/ProximityGrenadeEffect.cs | 54 ++++++++++++++----- .../ItemEffects/SmokeGrenadeEffect.cs | 2 +- .../KE.Items/Items/LowGravityGrenade.cs | 27 ++++++---- .../KE.Items/Items/ProximityGrenade.cs | 22 ++++---- KruacentExiled/KE.Items/Items/SmokeGrenade.cs | 25 ++++----- KruacentExiled/KE.Items/KE.Items.csproj | 2 +- 7 files changed, 88 insertions(+), 63 deletions(-) diff --git a/KruacentExiled/KE.Items/ItemEffects/LowGravityGrenadeEffect.cs b/KruacentExiled/KE.Items/ItemEffects/LowGravityGrenadeEffect.cs index 31d5c7b7..06e3a588 100644 --- a/KruacentExiled/KE.Items/ItemEffects/LowGravityGrenadeEffect.cs +++ b/KruacentExiled/KE.Items/ItemEffects/LowGravityGrenadeEffect.cs @@ -13,39 +13,38 @@ namespace KE.Items.ItemEffects public class LowGravityGrenadeEffect : CustomItemEffect { private Dictionary _effectedPlayers = new(); - public Vector3 LowGravity { get; set; } = new(0, -12.60f, 0); + public Vector3 LowGravity { get; set; } = new(0, -12.6f, 0); public float Duration { get; set; } = 15f; public float Range { get; set; } = 10f; public override void Effect(UsedItemEventArgs ev) { - + OnExploding(ev.Player, ev.Player.Position); } public override void Effect(DroppingItemEventArgs ev) { - ev.Player.ItemEffectHint("No grandson don't leave me !"); + OnExploding(ev.Player, ev.Player.Position); } public override void Effect(ExplodingGrenadeEventArgs ev) { - OnExploding(ev); + ev.IsAllowed = false; + OnExploding(ev.Player, ev.Position); } - public void OnExploding(ExplodingGrenadeEventArgs ev) + public void OnExploding(Player thrownPlayer, Vector3 position) { - ev.IsAllowed = false; - foreach (Player player in Player.List) { - if (Vector3.Distance(ev.Position, player.Position) <= this.Range) + if (Vector3.Distance(position, player.Position) <= this.Range) { Vector3 previousGravity = PlayerLab.Get(player.NetworkIdentity)!.Gravity; _effectedPlayers[player] = previousGravity; PlayerLab.Get(player.NetworkIdentity)!.Gravity = LowGravity; Timing.CallDelayed(this.Duration, () => { - PlayerLab.Get(ev.Player.NetworkIdentity)!.Gravity = _effectedPlayers[ev.Player]; - _effectedPlayers.Remove(ev.Player); + PlayerLab.Get(thrownPlayer.NetworkIdentity)!.Gravity = _effectedPlayers[thrownPlayer]; + _effectedPlayers.Remove(thrownPlayer); }); } } diff --git a/KruacentExiled/KE.Items/ItemEffects/ProximityGrenadeEffect.cs b/KruacentExiled/KE.Items/ItemEffects/ProximityGrenadeEffect.cs index 8aca70cd..62e5a9c7 100644 --- a/KruacentExiled/KE.Items/ItemEffects/ProximityGrenadeEffect.cs +++ b/KruacentExiled/KE.Items/ItemEffects/ProximityGrenadeEffect.cs @@ -14,43 +14,73 @@ namespace KE.Items.ItemEffects { public class ProximityGrenadeEffect : CustomItemEffect { - public float Duration { get; set; } = 10; - public float Range { get; set; } = 50; + public float Duration { get; set; } = 20; + public float RoomRadius { get; set; } = 3; public override void Effect(UsedItemEventArgs ev) { - + OnExploding(ev.Player.CurrentRoom, ev.Player.Position); } public override void Effect(DroppingItemEventArgs ev) { - + OnExploding(ev.Player.CurrentRoom, ev.Player.Position); } public override void Effect(ExplodingGrenadeEventArgs ev) { - OnExploding(ev); + ev.IsAllowed = false; + OnExploding(ev.Projectile.Room, ev.Position); } - public void OnExploding(ExplodingGrenadeEventArgs ev) + public void OnExploding(Room originRoom, Vector3 position) { - ev.IsAllowed = false; + HashSet roomsInRange = new HashSet(); + + roomsInRange.Add(originRoom); + + List currentLayer = new List(); + currentLayer.Add(originRoom); + + for (int i = 0; i < this.RoomRadius; i++) + { + List nextLayer = new List(); + + foreach (Room r in currentLayer) + { + foreach (Room neighbor in r.NearestRooms) + { + if (roomsInRange.Add(neighbor)) + { + nextLayer.Add(neighbor); + } + } + } + currentLayer = nextLayer; + } + foreach (Player player in Player.List) { - if (Vector3.Distance(ev.Position, player.Position) <= Range) + if (roomsInRange.Contains(player.CurrentRoom)) { var color = GetTeamColor(player); + var lineColor = new Color(color.red, color.green, color.blue); - var direction = player.Position - ev.Position; + + var direction = player.Position - position; var distance = direction.magnitude; + var scale = new Vector3(0.1f, distance * 0.5f, 0.1f); - var laserPos = ev.Position + direction * 0.5f; + var laserPos = position + direction * 0.5f; + var rotation = Quaternion.LookRotation(direction) * Quaternion.Euler(90, 0, 0); - var laser = Primitive.Create(PrimitiveType.Cylinder, PrimitiveFlags.Visible, laserPos, rotation.eulerAngles, - scale, true, lineColor); + + var laser = Primitive.Create(PrimitiveType.Cylinder, PrimitiveFlags.Visible, laserPos, rotation.eulerAngles, scale, true, lineColor); + Timing.CallDelayed(this.Duration, laser.Destroy); } } } + public (float red, float green, float blue) GetTeamColor(Player player) { float red; diff --git a/KruacentExiled/KE.Items/ItemEffects/SmokeGrenadeEffect.cs b/KruacentExiled/KE.Items/ItemEffects/SmokeGrenadeEffect.cs index 6ca8c033..e1150d1a 100644 --- a/KruacentExiled/KE.Items/ItemEffects/SmokeGrenadeEffect.cs +++ b/KruacentExiled/KE.Items/ItemEffects/SmokeGrenadeEffect.cs @@ -14,7 +14,7 @@ public class SmokeGrenadeEffect : CustomItemEffect { public bool RemoveSmoke { get; set; } = true; [Description("If RemoveSmoke is true, how long does it take before the smoke will be removed")] - public float FogTime { get; set; } = 15; + public float FogTime { get; set; } = 30; public override void Effect(UsedItemEventArgs ev) { diff --git a/KruacentExiled/KE.Items/Items/LowGravityGrenade.cs b/KruacentExiled/KE.Items/Items/LowGravityGrenade.cs index 22a84436..8d7969c1 100644 --- a/KruacentExiled/KE.Items/Items/LowGravityGrenade.cs +++ b/KruacentExiled/KE.Items/Items/LowGravityGrenade.cs @@ -23,24 +23,29 @@ public class LowGravityGrenade : KECustomGrenade, ISwichableEffect public CustomItemEffect Effect { get; set; } public override SpawnProperties SpawnProperties { get; set; } = new SpawnProperties() { - Limit = 3, - DynamicSpawnPoints = new List + Limit = 2, + RoomSpawnPoints = new List { - new DynamicSpawnPoint() + new RoomSpawnPoint() { - Chance = 50, - Location = SpawnLocationType.Inside096, + Room = RoomType.Hcz127, + Chance = 25 }, - new DynamicSpawnPoint() + + new RoomSpawnPoint() { - Chance = 5, - Location = SpawnLocationType.Inside914, + Room = RoomType.Hcz939, + Chance = 25 }, + }, + + DynamicSpawnPoints = new List + { new DynamicSpawnPoint() { - Chance= 50, - Location = SpawnLocationType.Inside127Lab, - } + Chance = 25, + Location = SpawnLocationType.InsideHidLab, + }, }, }; diff --git a/KruacentExiled/KE.Items/Items/ProximityGrenade.cs b/KruacentExiled/KE.Items/Items/ProximityGrenade.cs index 40e0b960..5bb892da 100644 --- a/KruacentExiled/KE.Items/Items/ProximityGrenade.cs +++ b/KruacentExiled/KE.Items/Items/ProximityGrenade.cs @@ -10,31 +10,27 @@ namespace KE.Items.Items { - [CustomItem(ItemType.Flashlight)] + [CustomItem(ItemType.GrenadeFlash)] public class ProximityGrenade : KECustomGrenade, ISwichableEffect { public override uint Id { get; set; } = 1073; public override string Name { get; set; } = "Proximity Grenade"; - public override string Description { get; set; } = "It will show line to all players"; + public override string Description { get; set; } = "It will show line to all players arround 3 rooms"; public override float Weight { get; set; } = 0.65f; - public override float FuseTime { get; set; } = 10f; + public override float FuseTime { get; set; } = 3f; public override bool ExplodeOnCollision { get; set; } = false; public UnityEngine.Color Color { get; set; } = UnityEngine.Color.red; public CustomItemEffect Effect { get; set; } public override SpawnProperties SpawnProperties { get; set; } = new SpawnProperties() { - Limit = 2, - DynamicSpawnPoints = new List + Limit = 1, + RoomSpawnPoints = new List { - new DynamicSpawnPoint() + new RoomSpawnPoint() { - Chance = 50, - Location = SpawnLocationType.Inside049Armory, - }, - new DynamicSpawnPoint() - { - Chance = 50, - Location = SpawnLocationType.Inside127Lab, + Room = RoomType.HczElevatorA, + Offset = new UnityEngine.Vector3(1f, 0f, 1f), + Chance = 50 } }, diff --git a/KruacentExiled/KE.Items/Items/SmokeGrenade.cs b/KruacentExiled/KE.Items/Items/SmokeGrenade.cs index 7e936eb7..ef29a705 100644 --- a/KruacentExiled/KE.Items/Items/SmokeGrenade.cs +++ b/KruacentExiled/KE.Items/Items/SmokeGrenade.cs @@ -10,7 +10,7 @@ namespace KE.Items.Items { - [CustomItem(ItemType.Flashlight)] + [CustomItem(ItemType.GrenadeFlash)] public class SmokeGrenade : KECustomGrenade, ISwichableEffect { public override uint Id { get; set; } = 1071; @@ -23,26 +23,21 @@ public class SmokeGrenade : KECustomGrenade, ISwichableEffect public CustomItemEffect Effect { get; set; } public override SpawnProperties SpawnProperties { get; set; } = new SpawnProperties() { - Limit = 3, - DynamicSpawnPoints = new List + Limit = 2, + RoomSpawnPoints = new List { - new DynamicSpawnPoint() + new RoomSpawnPoint() { - Chance = 50, - Location = SpawnLocationType.Inside939Cryo, + Room = RoomType.HczStraightPipeRoom, + Chance = 35 }, - new DynamicSpawnPoint() - { - Chance = 5, - Location = SpawnLocationType.Inside914, - }, - new DynamicSpawnPoint() + + new RoomSpawnPoint() { - Chance= 50, - Location = SpawnLocationType.InsideGateA, + Room = RoomType.Surface, + Chance = 35 } }, - }; public SmokeGrenade() diff --git a/KruacentExiled/KE.Items/KE.Items.csproj b/KruacentExiled/KE.Items/KE.Items.csproj index 93ca0e6c..c6883907 100644 --- a/KruacentExiled/KE.Items/KE.Items.csproj +++ b/KruacentExiled/KE.Items/KE.Items.csproj @@ -6,7 +6,7 @@ - + From 2dc00e26a12cad75330ca9ca71b30d50844e5d31 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Wed, 19 Nov 2025 11:31:01 +0100 Subject: [PATCH 427/853] fixed thief and scp457 --- .../Abilities/FireAbilities/Fireball.cs | 59 +++++++++++-------- .../KE.CustomRoles/Abilities/Thief.cs | 23 +++----- .../KE.CustomRoles/CR/Human/Maladroit.cs | 2 +- 3 files changed, 46 insertions(+), 38 deletions(-) diff --git a/KruacentExiled/KE.CustomRoles/Abilities/FireAbilities/Fireball.cs b/KruacentExiled/KE.CustomRoles/Abilities/FireAbilities/Fireball.cs index 8bd35e79..28ddcad6 100644 --- a/KruacentExiled/KE.CustomRoles/Abilities/FireAbilities/Fireball.cs +++ b/KruacentExiled/KE.CustomRoles/Abilities/FireAbilities/Fireball.cs @@ -9,6 +9,7 @@ using KE.CustomRoles.API.Features; using MEC; using PlayerStatsSystem; +using System; using System.Collections.Generic; using UnityEngine; using Light = Exiled.API.Features.Toys.Light; @@ -23,7 +24,7 @@ public class Fireball : FireAbility public override string Description { get; } = "I cast Fireball"; - public override float Cooldown { get; } = 2f; + public override float Cooldown { get; } = 0f; public static readonly CustomReasonDamageHandler BallDamage = new("Burned to death", 25, string.Empty); @@ -76,31 +77,33 @@ private IEnumerator LaunchingAttack(Player player) int fallback = Mathf.CeilToInt(100/ smooth); Log.Debug("fallback=" + fallback); - while (!attackTouchedSomething && fallback > 0) + try { - nextPos = primitive.Position + primitive.Rotation * new Vector3(0, 0, 10*smooth); + while (!attackTouchedSomething && fallback > 0) + { + nextPos = primitive.Position + primitive.Rotation * new Vector3(0, 0, 10 * smooth); - if (Physics.Linecast(primitive.Position, nextPos, out RaycastHit hit)) - { - //spawn mtf looking at central gate - if (hit.collider.gameObject.name != "VolumeOverrideTunnel") + if (Physics.Linecast(primitive.Position, nextPos, out RaycastHit hit)) { - attackTouchedSomething = true; + //spawn mtf looking at central gate + if (hit.collider.gameObject.name != "VolumeOverrideTunnel") + { + attackTouchedSomething = true; + } + } - } + Collider[] colliders = Physics.OverlapSphere(primitive.Position, .5f); - Collider[] colliders = Physics.OverlapSphere(primitive.Position, .5f); + foreach (Collider collider in colliders) + { - foreach(Collider collider in colliders) - { - - attackTouchedSomething = attackTouchedSomething || ProcessHit(player, collider); + attackTouchedSomething = attackTouchedSomething || ProcessHit(player, collider); - } + } @@ -108,15 +111,25 @@ private IEnumerator LaunchingAttack(Player player) - Log.Debug($"current pos = {primitive.Position} next pos = {nextPos}"); - yield return Timing.WaitForSeconds(smooth); - primitive.Position = nextPos; - light.Position = nextPos; - fallback--; + Log.Debug($"current pos = {primitive.Position} next pos = {nextPos}"); + yield return Timing.WaitForSeconds(smooth); + primitive.Position = nextPos; + light.Position = nextPos; + fallback--; + } + } + catch(Exception e) + { + Log.Error(e); + } + finally + { + _activeBalls[player]--; + primitive.Destroy(); + light.Destroy(); } - _activeBalls[player]--; - primitive.Destroy(); - light.Destroy(); + + } diff --git a/KruacentExiled/KE.CustomRoles/Abilities/Thief.cs b/KruacentExiled/KE.CustomRoles/Abilities/Thief.cs index aa454d4d..25f59c44 100644 --- a/KruacentExiled/KE.CustomRoles/Abilities/Thief.cs +++ b/KruacentExiled/KE.CustomRoles/Abilities/Thief.cs @@ -20,13 +20,8 @@ public class Thief : KEAbilities protected override bool AbilityUsed(Player player) { - List playerList = Player.Enumerable.Where(p => !p.IsScp && p.CurrentRoom == player.CurrentRoom).ToList(); - playerList.Remove(player); - Log.Debug("Player list :"); - playerList.ForEach(p => Log.Debug(p.Nickname)); - - Player thiefed = playerList.GetRandomValue(); + Player thiefed = Player.Enumerable.GetRandomValue(p => !p.IsScp && p.CurrentRoom == player.CurrentRoom && p != player); if(thiefed is null) { MainPlugin.ShowEffectHint(player, "no player to steal from"); @@ -35,22 +30,22 @@ protected override bool AbilityUsed(Player player) Log.Debug($"Thiefed player : {thiefed.Nickname}"); - Item inv = thiefed.Items.GetRandomValue(); + Item item = thiefed.Items.GetRandomValue(); - Log.Debug($"Thiefed item : {inv}"); - if (inv == null) + if (item == null) { - Log.Debug("No item to thiefed, null, returning."); MainPlugin.ShowEffectHint(player, "I think this is a skill issue ! Congrats !"); return true; } - var thiefBool = thiefed.RemoveItem(inv); - Log.Debug($"Item deleted {thiefBool}."); - inv.Give(player); - Log.Debug($"Item given to {player.Nickname}."); + + Item newitem = item.Clone(); + newitem.Give(player); + thiefed.RemoveItem(newitem); + + return base.AbilityUsed(player); } } diff --git a/KruacentExiled/KE.CustomRoles/CR/Human/Maladroit.cs b/KruacentExiled/KE.CustomRoles/CR/Human/Maladroit.cs index da9d1c1e..e850639b 100644 --- a/KruacentExiled/KE.CustomRoles/CR/Human/Maladroit.cs +++ b/KruacentExiled/KE.CustomRoles/CR/Human/Maladroit.cs @@ -52,7 +52,7 @@ private IEnumerator ThrowingItem(Player p) }; - while (true) + while (p.IsAlive) { yield return Timing.WaitForSeconds(UnityEngine.Random.Range(120f, 200f)); int proba = UnityEngine.Random.Range(0, 101); From d8001a60e71599cf80aa8ada6b51f91503ed0a86 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Sat, 22 Nov 2025 07:32:12 +0100 Subject: [PATCH 428/853] change guard keycard --- .../Abilities/FireAbilities/Fireball.cs | 54 ++++++++----------- .../KE.CustomRoles/CR/Guard/Guard914.cs | 14 +++-- 2 files changed, 32 insertions(+), 36 deletions(-) diff --git a/KruacentExiled/KE.CustomRoles/Abilities/FireAbilities/Fireball.cs b/KruacentExiled/KE.CustomRoles/Abilities/FireAbilities/Fireball.cs index 28ddcad6..0d320bd7 100644 --- a/KruacentExiled/KE.CustomRoles/Abilities/FireAbilities/Fireball.cs +++ b/KruacentExiled/KE.CustomRoles/Abilities/FireAbilities/Fireball.cs @@ -77,57 +77,47 @@ private IEnumerator LaunchingAttack(Player player) int fallback = Mathf.CeilToInt(100/ smooth); Log.Debug("fallback=" + fallback); - try + while (!attackTouchedSomething && fallback > 0) { - while (!attackTouchedSomething && fallback > 0) - { - nextPos = primitive.Position + primitive.Rotation * new Vector3(0, 0, 10 * smooth); + nextPos = primitive.Position + primitive.Rotation * new Vector3(0, 0, 10 * smooth); - if (Physics.Linecast(primitive.Position, nextPos, out RaycastHit hit)) + if (Physics.Linecast(primitive.Position, nextPos, out RaycastHit hit)) + { + //spawn mtf looking at central gate + if (hit.collider.gameObject.name != "VolumeOverrideTunnel") { - //spawn mtf looking at central gate - if (hit.collider.gameObject.name != "VolumeOverrideTunnel") - { - attackTouchedSomething = true; - } - + attackTouchedSomething = true; } - Collider[] colliders = Physics.OverlapSphere(primitive.Position, .5f); + } + Collider[] colliders = Physics.OverlapSphere(primitive.Position, .5f); - foreach (Collider collider in colliders) - { - attackTouchedSomething = attackTouchedSomething || ProcessHit(player, collider); + foreach (Collider collider in colliders) + { - } + attackTouchedSomething = attackTouchedSomething || ProcessHit(player, collider); + } - Log.Debug($"current pos = {primitive.Position} next pos = {nextPos}"); - yield return Timing.WaitForSeconds(smooth); - primitive.Position = nextPos; - light.Position = nextPos; - fallback--; - } - } - catch(Exception e) - { - Log.Error(e); - } - finally - { - _activeBalls[player]--; - primitive.Destroy(); - light.Destroy(); + + Log.Debug($"current pos = {primitive.Position} next pos = {nextPos}"); + yield return Timing.WaitForSeconds(smooth); + primitive.Position = nextPos; + light.Position = nextPos; + fallback--; } + _activeBalls[player]--; + primitive.Destroy(); + light.Destroy(); } diff --git a/KruacentExiled/KE.CustomRoles/CR/Guard/Guard914.cs b/KruacentExiled/KE.CustomRoles/CR/Guard/Guard914.cs index 8ff1a00d..3bc9af7b 100644 --- a/KruacentExiled/KE.CustomRoles/CR/Guard/Guard914.cs +++ b/KruacentExiled/KE.CustomRoles/CR/Guard/Guard914.cs @@ -7,12 +7,14 @@ using PlayerRoles; using System.Collections.Generic; using Player = Exiled.API.Features.Player; +using Item = Exiled.API.Features.Items.Item; using LabPlayer = LabApi.Features.Wrappers.Player; using Interactables.Interobjects.DoorUtils; using UnityEngine; using InventorySystem; using MEC; using InventorySystem.Items; +using Exiled.API.Features.Items.Keycards; namespace KE.CustomRoles.CR.Guard { @@ -119,8 +121,8 @@ public static KeycardItem CreateFakeCaptainCard(LabPlayer player) private void OnProcessedPlayer(Scp914ProcessedPlayerEventArgs ev) { if (ev.KnobSetting != Scp914.Scp914KnobSetting.Fine) return; - LabPlayer player = ev.Player; - Item item = player.CurrentItem; + Player player = ev.Player; + Item item = Item.Get(player.CurrentItem.Serial); if (item is null) return; if (storedSerials.Contains(item.Serial)) @@ -129,9 +131,13 @@ private void OnProcessedPlayer(Scp914ProcessedPlayerEventArgs ev) bool equipped = player.CurrentItem is not null && player.CurrentItem.Serial == item.Serial; player.RemoveItem(item); storedSerials.Remove(item.Serial); - KeycardItem keycard = item as KeycardItem; + CustomKeycardItem keycard = item as CustomKeycardItem; - switch (keycard.Levels.Admin) + + + + + switch (keycard.KeycardLevels.Admin) { case 1: itemBase = CreateFakeOperativeCard(player).Base; From 4de426096b6491290f035479a023c203c01f0174 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Sun, 23 Nov 2025 13:17:28 +0100 Subject: [PATCH 429/853] removed useless global event --- .../KE.GlobalEventFramework.Examples.csproj | 3 +-- KruacentExiled/KE.Items/KE.Items.csproj | 5 +---- KruacentExiled/KruacentExiled.sln | 21 +++---------------- 3 files changed, 5 insertions(+), 24 deletions(-) diff --git a/KruacentExiled/KE.GlobalEventFramework.Examples/KE.GlobalEventFramework.Examples.csproj b/KruacentExiled/KE.GlobalEventFramework.Examples/KE.GlobalEventFramework.Examples.csproj index 8fcf2265..ff773f68 100644 --- a/KruacentExiled/KE.GlobalEventFramework.Examples/KE.GlobalEventFramework.Examples.csproj +++ b/KruacentExiled/KE.GlobalEventFramework.Examples/KE.GlobalEventFramework.Examples.csproj @@ -6,11 +6,10 @@ - + - diff --git a/KruacentExiled/KE.Items/KE.Items.csproj b/KruacentExiled/KE.Items/KE.Items.csproj index e9925a5c..b92b3f60 100644 --- a/KruacentExiled/KE.Items/KE.Items.csproj +++ b/KruacentExiled/KE.Items/KE.Items.csproj @@ -10,10 +10,6 @@ - - - - @@ -23,6 +19,7 @@ + diff --git a/KruacentExiled/KruacentExiled.sln b/KruacentExiled/KruacentExiled.sln index e813d7c5..ee3d8b71 100644 --- a/KruacentExiled/KruacentExiled.sln +++ b/KruacentExiled/KruacentExiled.sln @@ -3,16 +3,10 @@ Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio Version 17 VisualStudioVersion = 17.12.35506.116 MinimumVisualStudioVersion = 10.0.40219.1 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "KE.Utils", "KE.Utils\KE.Utils.csproj", "{DFEF41B3-5BD3-428A-A7BA-7A490E65C71F}" -EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "KE.Misc", "KE.Misc\KE.Misc.csproj", "{CD822DB2-756E-4887-93AB-2D2F16BF542C}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "KE.BlackoutNDoor", "KE.BlackoutNDoor\KE.BlackoutNDoor.csproj", "{C9867742-72DB-4ECA-81BF-104A27A04DB7}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "KE.GlobalEventFramework", "KE.GlobalEventFramework\KE.GlobalEventFramework.csproj", "{73D6C740-96DE-4965-898F-DDD5BCBF7366}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "KE.GlobalEventFramework.Examples", "KE.GlobalEventFramework.Examples\KE.GlobalEventFramework.Examples.csproj", "{07B92E87-F48F-4F9F-BA0E-1BCB2AF52F53}" -EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "KE.Items", "KE.Items\KE.Items.csproj", "{87D91720-B7B5-4FB7-AB18-FB6E70AC0D68}" EndProject Global @@ -21,10 +15,6 @@ Global Release|Any CPU = Release|Any CPU EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution - {DFEF41B3-5BD3-428A-A7BA-7A490E65C71F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {DFEF41B3-5BD3-428A-A7BA-7A490E65C71F}.Debug|Any CPU.Build.0 = Debug|Any CPU - {DFEF41B3-5BD3-428A-A7BA-7A490E65C71F}.Release|Any CPU.ActiveCfg = Release|Any CPU - {DFEF41B3-5BD3-428A-A7BA-7A490E65C71F}.Release|Any CPU.Build.0 = Release|Any CPU {CD822DB2-756E-4887-93AB-2D2F16BF542C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {CD822DB2-756E-4887-93AB-2D2F16BF542C}.Debug|Any CPU.Build.0 = Debug|Any CPU {CD822DB2-756E-4887-93AB-2D2F16BF542C}.Release|Any CPU.ActiveCfg = Release|Any CPU @@ -33,14 +23,6 @@ Global {C9867742-72DB-4ECA-81BF-104A27A04DB7}.Debug|Any CPU.Build.0 = Debug|Any CPU {C9867742-72DB-4ECA-81BF-104A27A04DB7}.Release|Any CPU.ActiveCfg = Release|Any CPU {C9867742-72DB-4ECA-81BF-104A27A04DB7}.Release|Any CPU.Build.0 = Release|Any CPU - {73D6C740-96DE-4965-898F-DDD5BCBF7366}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {73D6C740-96DE-4965-898F-DDD5BCBF7366}.Debug|Any CPU.Build.0 = Debug|Any CPU - {73D6C740-96DE-4965-898F-DDD5BCBF7366}.Release|Any CPU.ActiveCfg = Release|Any CPU - {73D6C740-96DE-4965-898F-DDD5BCBF7366}.Release|Any CPU.Build.0 = Release|Any CPU - {07B92E87-F48F-4F9F-BA0E-1BCB2AF52F53}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {07B92E87-F48F-4F9F-BA0E-1BCB2AF52F53}.Debug|Any CPU.Build.0 = Debug|Any CPU - {07B92E87-F48F-4F9F-BA0E-1BCB2AF52F53}.Release|Any CPU.ActiveCfg = Release|Any CPU - {07B92E87-F48F-4F9F-BA0E-1BCB2AF52F53}.Release|Any CPU.Build.0 = Release|Any CPU {87D91720-B7B5-4FB7-AB18-FB6E70AC0D68}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {87D91720-B7B5-4FB7-AB18-FB6E70AC0D68}.Debug|Any CPU.Build.0 = Debug|Any CPU {87D91720-B7B5-4FB7-AB18-FB6E70AC0D68}.Release|Any CPU.ActiveCfg = Release|Any CPU @@ -49,4 +31,7 @@ Global GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {8FF2C1A6-0925-431F-BD27-B3353EBB6946} + EndGlobalSection EndGlobal From ac9ffdb52008286f6bd3a53c6974794ca7f98e1d Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Sun, 23 Nov 2025 20:40:59 +0100 Subject: [PATCH 430/853] removed useless commands --- KruacentExiled/KE.Map/Command.cs | 47 -------------------------------- 1 file changed, 47 deletions(-) delete mode 100644 KruacentExiled/KE.Map/Command.cs diff --git a/KruacentExiled/KE.Map/Command.cs b/KruacentExiled/KE.Map/Command.cs deleted file mode 100644 index ced4ef83..00000000 --- a/KruacentExiled/KE.Map/Command.cs +++ /dev/null @@ -1,47 +0,0 @@ -using CommandSystem; -using KE.Utils.API.Models.Commands; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace KE.Map -{ - [CommandHandler(typeof(RemoteAdminCommandHandler))] - internal class ModelParent : ParentCommand - { - public ModelParent() - { - if (MainPlugin.Configs?.Debug ?? false) - { - LoadGeneratedCommands(); - } - - } - - public override string Command => "model"; - public override string Description => ""; - public override string[] Aliases { get; } = {"m"}; - - public override void LoadGeneratedCommands() - { - foreach (ICommand command in KE.Utils.API.Models.Commands.AllCommands.Get()) - { - RegisterCommand(command); - } - } - - - - protected override bool ExecuteParent(ArraySegment arguments, ICommandSender sender, out string response) - { - response = "\n"; - foreach (ICommand command in Commands.Values) - { - response += command.Command + $" ({command.Aliases[0]}) -" + command.Description + "\n"; - } - return true; - } - } -} From 6d7fef26d6230a4ac1f8c1258691772ae1217057 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Sun, 23 Nov 2025 20:53:30 +0100 Subject: [PATCH 431/853] changed surface light are now rarer --- .../KE.Misc/Features/SurfaceLight.cs | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/KruacentExiled/KE.Misc/Features/SurfaceLight.cs b/KruacentExiled/KE.Misc/Features/SurfaceLight.cs index 49c2b620..fc45fc05 100644 --- a/KruacentExiled/KE.Misc/Features/SurfaceLight.cs +++ b/KruacentExiled/KE.Misc/Features/SurfaceLight.cs @@ -13,15 +13,25 @@ namespace KE.Misc.Features internal class SurfaceLight : MiscFeature { - private HashSet _colors = new() + public static readonly HashSet _colors = new() { Color.cyan, Color.red, Color.green, - Color.white, Color.blue }; + private float _chance = 5; + + public float Chance + { + get { return _chance; } + set + { + _chance = Mathf.Clamp(value, 0f, 100f); + } + } + public override void SubscribeEvents() { @@ -37,7 +47,7 @@ public override void UnsubscribeEvents() private void OnRoundStarted() { - if(Random.value < .25f) + if(Random.Range(0f,100f) < Chance) ChangeSurfaceLight(); } @@ -50,8 +60,6 @@ private void ChangeSurfaceLight() { room.Color = randomColor; } - - Log.Debug($"Changed Surface light color to {randomColor}."); } } } From 96968cd944fc2d926582c3fac54d591ea04b6a6a Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Sun, 23 Nov 2025 20:53:45 +0100 Subject: [PATCH 432/853] 106 insta kill when only 1 player left --- KruacentExiled/KE.Misc/Features/SCPBuff.cs | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/KruacentExiled/KE.Misc/Features/SCPBuff.cs b/KruacentExiled/KE.Misc/Features/SCPBuff.cs index 885f836c..41e66a6b 100644 --- a/KruacentExiled/KE.Misc/Features/SCPBuff.cs +++ b/KruacentExiled/KE.Misc/Features/SCPBuff.cs @@ -2,6 +2,7 @@ using Exiled.API.Features; using Exiled.Events; using Exiled.Events.EventArgs.Player; +using Exiled.Events.EventArgs.Scp106; using Exiled.Permissions.Commands.Permissions; using KE.Utils.API.Interfaces; using KE.Utils.Extensions; @@ -22,14 +23,24 @@ internal SCPBuff() { } public void SubscribeEvents() { Exiled.Events.Handlers.Player.ChangingRole += BecomingSCP; + Exiled.Events.Handlers.Scp106.Attacking += OnAttacking; } public void UnsubscribeEvents() { Exiled.Events.Handlers.Player.ChangingRole -= BecomingSCP; + Exiled.Events.Handlers.Scp106.Attacking -= OnAttacking; } + private void OnAttacking(AttackingEventArgs ev) + { + if(ev.IsAllowed && Player.Enumerable.Count(p => !p.IsScp && p.IsAlive) == 1) + { + ev.Target.Vaporize(); + } + } + internal void StartBuff() { Timing.RunCoroutine(PeanutShield()); @@ -88,7 +99,7 @@ private int CheckPlayerAround(Player p, float radius, bool countFriendly = false private bool IsPlayerInZone(Player player, Vector3 zonePosition, float radius, float height) { - // Calculate the horizontal distance (x, z) + float horizontalDistance = Vector3.Distance( new Vector3(player.Position.x, 0, player.Position.z), new Vector3(zonePosition.x, 0, zonePosition.z) From 54f139bc4d8e9768ffa486c98d31b4721009513f Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Sun, 23 Nov 2025 20:53:58 +0100 Subject: [PATCH 433/853] reduce omni spawn to 1% --- KruacentExiled/KE.Misc/Features/914Upgrades/OmniCardUpgrade.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/KruacentExiled/KE.Misc/Features/914Upgrades/OmniCardUpgrade.cs b/KruacentExiled/KE.Misc/Features/914Upgrades/OmniCardUpgrade.cs index f7f70f4c..a72e1d88 100644 --- a/KruacentExiled/KE.Misc/Features/914Upgrades/OmniCardUpgrade.cs +++ b/KruacentExiled/KE.Misc/Features/914Upgrades/OmniCardUpgrade.cs @@ -20,7 +20,7 @@ namespace KE.Misc.Features._914Upgrades { public class OmniCardUpgrade : Base914PlayerUpgrade { - protected override float Chance => 5; + protected override float Chance => 1; public static readonly Color32 CardColor = new(45, 44, 249,255); protected override void OnUpgradingPlayer(UpgradingPlayerEventArgs ev) From abb79b6a01fa7d40819bb96b2aa144ce0be6fbc6 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Sun, 23 Nov 2025 21:29:57 +0100 Subject: [PATCH 434/853] update settings --- KruacentExiled/KE.CustomRoles/MainPlugin.cs | 3 +++ .../KE.CustomRoles/Settings/SettingHandler.cs | 22 +++++++++++++++---- 2 files changed, 21 insertions(+), 4 deletions(-) diff --git a/KruacentExiled/KE.CustomRoles/MainPlugin.cs b/KruacentExiled/KE.CustomRoles/MainPlugin.cs index e57e3a65..079eac99 100644 --- a/KruacentExiled/KE.CustomRoles/MainPlugin.cs +++ b/KruacentExiled/KE.CustomRoles/MainPlugin.cs @@ -39,6 +39,8 @@ public override void OnEnabled() Instance = this; _settingHandler = new(); + Utils.API.Settings.SettingHandler.Instance.SubscribeEvents(); + Harmony = new(Name); Harmony.PatchAll(); @@ -57,6 +59,7 @@ public override void OnDisabled() KEAbilities.Unregister(); UnsubscribeEvents(); + Utils.API.Settings.SettingHandler.Instance.UnsubscribeEvents(); _settingHandler = null; Instance = null; } diff --git a/KruacentExiled/KE.CustomRoles/Settings/SettingHandler.cs b/KruacentExiled/KE.CustomRoles/Settings/SettingHandler.cs index 9de2662d..687c87d6 100644 --- a/KruacentExiled/KE.CustomRoles/Settings/SettingHandler.cs +++ b/KruacentExiled/KE.CustomRoles/Settings/SettingHandler.cs @@ -3,10 +3,12 @@ using Exiled.Events.EventArgs.Player; using KE.CustomRoles.API.Features; using KE.Utils.API.Interfaces; +using KE.Utils.API.Settings; using System; using System.Collections.Generic; using TMPro; using UserSettings.ServerSpecific; +using static UnityEngine.Rendering.RayTracingAccelerationStructure; namespace KE.CustomRoles.Settings { @@ -29,27 +31,40 @@ internal class SettingHandler : IUsingEvents public static SettingHandler Instance { get; private set; } private List settings; + private SettingsPage page; public const string baseArrow = "<--"; public SettingHandler() { Instance = this; settings = new List() { - new HeaderSetting (_idHeader,"Custom Roles Settings"), new TwoButtonsSetting(_idDesc,"Descriptions","Disabled","Enabled",true,"hide/show the description the Custom Role "), new SliderSetting(_idTimeCustomRole,"Time shown",0,30,20), new SliderSetting(_idTimeAbilityDesc,"Ability Description time shown",0,30,20), new KeybindSetting(_idUp, "Select up", UnityEngine.KeyCode.None), new KeybindSetting(_idDown, "Select down", UnityEngine.KeyCode.None), new KeybindSetting(_idSelect, "Use selected ability", UnityEngine.KeyCode.None), - SettingBase.Create(new SSPlaintextSetting(_idArrow, "Personalize the arrow next to the selected ability", baseArrow, 16, TMP_InputField.ContentType.Standard, string.Empty, 0)) }; + + List baseSettings = new(); + + + + foreach(SettingBase setting in settings) + { + baseSettings.Add(setting.Base); + } + baseSettings.Add(new SSPlaintextSetting(_idArrow, "Personalize the arrow next to the selected ability", baseArrow, 16, TMP_InputField.ContentType.Standard, string.Empty, 0)) + + + page = new("Custom roles", baseSettings); + } public void SubscribeEvents() { - SettingBase.Register(settings); + Utils.API.Settings.SettingHandler.Instance.AddPages(page); ServerSpecificSettingsSync.ServerOnSettingValueReceived += SafeOnSettingValueReceived; Exiled.Events.Handlers.Player.Verified += OnVerified; DownPressed += Down; @@ -63,7 +78,6 @@ public void UnsubscribeEvents() ServerSpecificSettingsSync.ServerOnSettingValueReceived -= SafeOnSettingValueReceived; DownPressed -= Down; UpPressed -= Up; - SettingBase.Unregister(predicate:null, settings); } From 44760b87f01cca4a18c9201c90a21d6caeee62cb Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Sun, 23 Nov 2025 21:43:37 +0100 Subject: [PATCH 435/853] rechanged pilot abilities --- KruacentExiled/KE.CustomRoles/CR/MTF/Pilot.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/KruacentExiled/KE.CustomRoles/CR/MTF/Pilot.cs b/KruacentExiled/KE.CustomRoles/CR/MTF/Pilot.cs index 712a0a2e..9a8da435 100644 --- a/KruacentExiled/KE.CustomRoles/CR/MTF/Pilot.cs +++ b/KruacentExiled/KE.CustomRoles/CR/MTF/Pilot.cs @@ -39,8 +39,8 @@ public class Pilot : KECustomRole public override HashSet Abilities { get; } = new() { - "SelectPosition", - "AirStrike" + "SetPosition", + "Airstrike" }; From d30fb65f7a5a05133c42150be76c23842ec9527b Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Sun, 23 Nov 2025 21:44:36 +0100 Subject: [PATCH 436/853] updated settings --- .../KE.CustomRoles/API/Features/CustomSCP.cs | 25 +++++++++++-------- .../KE.CustomRoles/Settings/SettingHandler.cs | 4 +-- 2 files changed, 16 insertions(+), 13 deletions(-) diff --git a/KruacentExiled/KE.CustomRoles/API/Features/CustomSCP.cs b/KruacentExiled/KE.CustomRoles/API/Features/CustomSCP.cs index 5ece0b74..c358aed1 100644 --- a/KruacentExiled/KE.CustomRoles/API/Features/CustomSCP.cs +++ b/KruacentExiled/KE.CustomRoles/API/Features/CustomSCP.cs @@ -1,11 +1,15 @@ using Exiled.API.Features; using Exiled.API.Features.Core.UserSettings; +using KE.CustomRoles.Settings; +using KE.Utils.API.Settings; using System; using System.Collections.Generic; using System.Linq; using System.Runtime.Remoting.Messaging; using System.Text; using System.Threading.Tasks; +using UserSettings.ServerSpecific; +using static UnityEngine.Rendering.RayTracingAccelerationStructure; namespace KE.CustomRoles.API.Features { @@ -15,35 +19,34 @@ public abstract class CustomSCP : KECustomRole public const int MaxValue = 5; public const int DefaultValue = 0; - public static int ScpPreferenceHeaderId => HeaderId.Value; - private static RecyclableSettingId HeaderId; - private static HeaderSetting header = null; private SliderSetting sliderSetting; public abstract bool IsSupport { get; } private new RecyclableSettingId Id; public int SettingId => Id.Value; - + private static SettingsPage page; + private static List settings; public static IEnumerable All => Registered.Where(c => c is CustomSCP).Cast(); public override void Init() { - if (header is null) + + + if (page is null) { - HeaderId = new RecyclableSettingId(); - header = new HeaderSetting(ScpPreferenceHeaderId, "SCP Spawn Preferences"); + settings = new(); + page = new SettingsPage("Custom SCPs Preferences", settings); } Id = new RecyclableSettingId(); - sliderSetting = new SliderSetting(SettingId, PublicName, MinValue, MaxValue, DefaultValue, true, header: header); - SettingBase.Register([sliderSetting]); - + settings.Add(new SSSliderSetting(SettingId, PublicName, MinValue, MaxValue, DefaultValue, true)); + + Utils.API.Settings.SettingHandler.Instance.AddPages(page); base.Init(); } public override void Destroy() { - SettingBase.Unregister(); Id.Destroy(); base.Destroy(); } diff --git a/KruacentExiled/KE.CustomRoles/Settings/SettingHandler.cs b/KruacentExiled/KE.CustomRoles/Settings/SettingHandler.cs index 687c87d6..7c8ff804 100644 --- a/KruacentExiled/KE.CustomRoles/Settings/SettingHandler.cs +++ b/KruacentExiled/KE.CustomRoles/Settings/SettingHandler.cs @@ -31,7 +31,7 @@ internal class SettingHandler : IUsingEvents public static SettingHandler Instance { get; private set; } private List settings; - private SettingsPage page; + public readonly SettingsPage page; public const string baseArrow = "<--"; public SettingHandler() { @@ -54,7 +54,7 @@ public SettingHandler() { baseSettings.Add(setting.Base); } - baseSettings.Add(new SSPlaintextSetting(_idArrow, "Personalize the arrow next to the selected ability", baseArrow, 16, TMP_InputField.ContentType.Standard, string.Empty, 0)) + baseSettings.Add(new SSPlaintextSetting(_idArrow, "Personalize the arrow next to the selected ability", baseArrow, 16, TMP_InputField.ContentType.Standard, string.Empty, 0)); page = new("Custom roles", baseSettings); From 5ff95990ac77b563faa08c67eb81f01d9f358330 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Sun, 23 Nov 2025 21:55:26 +0100 Subject: [PATCH 437/853] updated utils --- .../API/Core/Settings/SettingsHandler.cs | 31 ++++++++++--------- .../KE.Items/API/Features/PickupModel.cs | 3 +- .../API/Interface/ICustomPickupModel.cs | 3 +- KruacentExiled/KE.Items/Items/Mine.cs | 11 +++---- KruacentExiled/KE.Items/Items/Molotov.cs | 11 +++---- .../KE.Items/Items/PickupModels/MinePModel.cs | 3 +- .../Items/PickupModels/MolotovPModel.cs | 3 +- .../Items/PickupModels/PressePureePModel.cs | 3 +- .../Items/PickupModels/Scp3136PModel.cs | 3 +- .../Items/PickupModels/TPGrenadaPModel.cs | 3 +- KruacentExiled/KE.Items/Items/PressePuree.cs | 11 +++---- KruacentExiled/KE.Items/Items/Scp3136.cs | 15 +++------ KruacentExiled/KE.Items/Items/TPGrenada.cs | 11 +++---- 13 files changed, 55 insertions(+), 56 deletions(-) diff --git a/KruacentExiled/KE.Items/API/Core/Settings/SettingsHandler.cs b/KruacentExiled/KE.Items/API/Core/Settings/SettingsHandler.cs index 7cb69b0e..092a7817 100644 --- a/KruacentExiled/KE.Items/API/Core/Settings/SettingsHandler.cs +++ b/KruacentExiled/KE.Items/API/Core/Settings/SettingsHandler.cs @@ -1,6 +1,7 @@ using Exiled.API.Features; using Exiled.API.Features.Core.UserSettings; using KE.Utils.API.Interfaces; +using KE.Utils.API.Settings; using KE.Utils.Quality.Enums; using System; using System.Collections.Generic; @@ -25,38 +26,40 @@ internal class SettingsHandler : IUsingEvents private const int _idTimeCustomItem = 2; private const int _idTimeCustomItemEffect = 3; + public readonly SettingsPage page; - private void CreateSettings() + public SettingsHandler() { - _settings = [ - new HeaderSetting (_idHeader,"Custom Items Settings"), - new TwoButtonsSetting(_idDesc,"Descriptions","Disabled","Enabled",true,"hide/show the description of the item and its upgrade chances ", onChanged:OnChanged), - new TwoButtonsSetting(_idPrefix,"Pickup/Select prefixes","Disabled","Enabled",false,"show/hide the whole sentence for the picking or selecting of the item, if hidden it will show a (P) if pickup or a (I) if in inventory before the name of the item ", onChanged:OnChanged), + new TwoButtonsSetting(_idDesc,"Descriptions","Disabled","Enabled",true,"hide/show the description of the item and its upgrade chances "), + new TwoButtonsSetting(_idPrefix,"Pickup/Select prefixes","Disabled","Enabled",false,"show/hide the whole sentence for the picking or selecting of the item, if hidden it will show a (P) if pickup or a (I) if in inventory before the name of the item "), new SliderSetting(_idTimeCustomItem,"Time shown",0,30,10), new SliderSetting(_idTimeCustomItemEffect,"Time effect shown",0,30,10), ]; - SettingBase.Register(_settings); + + List settings = new(); + + + foreach (SettingBase setting in _settings) + { + settings.Add(setting.Base); + } + + page = new("Custom Items", settings); } + public void SubscribeEvents() { - CreateSettings(); - SettingBase.SendToAll(); + Utils.API.Settings.SettingHandler.Instance.AddPages(page); } public void UnsubscribeEvents() - { - SettingBase.Unregister(); - } - - - private void OnChanged(Player p, SettingBase settings) { } diff --git a/KruacentExiled/KE.Items/API/Features/PickupModel.cs b/KruacentExiled/KE.Items/API/Features/PickupModel.cs index d3ee3507..695fef2b 100644 --- a/KruacentExiled/KE.Items/API/Features/PickupModel.cs +++ b/KruacentExiled/KE.Items/API/Features/PickupModel.cs @@ -1,4 +1,4 @@ -using Exiled.API.Features; +/*using Exiled.API.Features; using Exiled.API.Features.Pickups; using Exiled.API.Features.Toys; using Exiled.CustomItems.API.Features; @@ -206,3 +206,4 @@ private void OnPickupDestroyed(ItemPickupBase obj) } } } +*/ \ No newline at end of file diff --git a/KruacentExiled/KE.Items/API/Interface/ICustomPickupModel.cs b/KruacentExiled/KE.Items/API/Interface/ICustomPickupModel.cs index 1208892b..49809493 100644 --- a/KruacentExiled/KE.Items/API/Interface/ICustomPickupModel.cs +++ b/KruacentExiled/KE.Items/API/Interface/ICustomPickupModel.cs @@ -1,4 +1,4 @@ -using Exiled.API.Features.Toys; +/*using Exiled.API.Features.Toys; using KE.Items.API.Features; using KE.Utils.API.Models.Blueprints; using KE.Utils.Quality.Models; @@ -15,3 +15,4 @@ public interface ICustomPickupModel public PickupModel PickupModel { get; } } } +*/ \ No newline at end of file diff --git a/KruacentExiled/KE.Items/Items/Mine.cs b/KruacentExiled/KE.Items/Items/Mine.cs index b06eec97..40828370 100644 --- a/KruacentExiled/KE.Items/Items/Mine.cs +++ b/KruacentExiled/KE.Items/Items/Mine.cs @@ -1,6 +1,5 @@ using UnityEngine; using Exiled.Events.EventArgs.Player; -using KE.Items.Items.PickupModels; using Exiled.API.Features.Spawn; using KE.Items.API.Interface; using KE.Items.Items.ItemEffects; @@ -9,14 +8,14 @@ namespace KE.Items.Items { [Exiled.API.Features.Attributes.CustomItem(ItemType.KeycardJanitor)] - public class Mine : KECustomItem, ISwichableEffect, ICustomPickupModel + public class Mine : KECustomItem, ISwichableEffect/*, ICustomPickupModel*/ { public override uint Id { get; set; } = 1053; public override string Name { get; set; } = "Mine"; public override string Description { get; set; } = "Drop to deploy the mine, little advice : don't step on it"; public override float Weight { get; set; } = 0.65f; public Color Color { get; set; } = Color.yellow; - public PickupModel PickupModel { get; set; } + //public PickupModel PickupModel { get; set; } public CustomItemEffect Effect { get; set; } @@ -66,18 +65,18 @@ public class Mine : KECustomItem, ISwichableEffect, ICustomPickupModel public Mine() { Effect = new MineEffect(); - PickupModel = new MinePModel(this); + //PickupModel = new MinePModel(this); } protected override void SubscribeEvents() { - PickupModel.SubscribeEvents(); + //PickupModel.SubscribeEvents(); base.SubscribeEvents(); } protected override void UnsubscribeEvents() { - PickupModel.UnsubscribeEvents(); + //PickupModel.UnsubscribeEvents(); base.UnsubscribeEvents(); } diff --git a/KruacentExiled/KE.Items/Items/Molotov.cs b/KruacentExiled/KE.Items/Items/Molotov.cs index 4cd8168f..228f9349 100644 --- a/KruacentExiled/KE.Items/Items/Molotov.cs +++ b/KruacentExiled/KE.Items/Items/Molotov.cs @@ -7,13 +7,12 @@ using KE.Items.API.Features; using KE.Items.API.Interface; using KE.Items.Items.ItemEffects; -using KE.Items.Items.PickupModels; using UnityEngine; namespace KE.Items.Items { [CustomItem(ItemType.GrenadeFlash)] - public class Molotov : KECustomGrenade, ISwichableEffect, ICustomPickupModel + public class Molotov : KECustomGrenade, ISwichableEffect/*, ICustomPickupModel*/ { //bouteille public override uint Id { get; set; } = 1049; @@ -24,7 +23,7 @@ public class Molotov : KECustomGrenade, ISwichableEffect, ICustomPickupModel public override bool ExplodeOnCollision { get; set; } = true; public Color Color { get; set; } = Color.yellow; public CustomItemEffect Effect { get; set; } - public PickupModel PickupModel { get; } + //public PickupModel PickupModel { get; } public override SpawnProperties SpawnProperties { get; set; } = new SpawnProperties() { Limit = 2, @@ -72,18 +71,18 @@ public class Molotov : KECustomGrenade, ISwichableEffect, ICustomPickupModel public Molotov() { Effect = new MolotovEffect(); - PickupModel = new MolotovPModel(this); + //PickupModel = new MolotovPModel(this); } protected override void SubscribeEvents() { - PickupModel.SubscribeEvents(); + //PickupModel.SubscribeEvents(); base.SubscribeEvents(); } protected override void UnsubscribeEvents() { - PickupModel.UnsubscribeEvents(); + //PickupModel.UnsubscribeEvents(); base.UnsubscribeEvents(); } diff --git a/KruacentExiled/KE.Items/Items/PickupModels/MinePModel.cs b/KruacentExiled/KE.Items/Items/PickupModels/MinePModel.cs index dadbd4c2..964a136a 100644 --- a/KruacentExiled/KE.Items/Items/PickupModels/MinePModel.cs +++ b/KruacentExiled/KE.Items/Items/PickupModels/MinePModel.cs @@ -1,4 +1,4 @@ -using Exiled.API.Features; +/*using Exiled.API.Features; using Exiled.API.Features.Toys; using KE.Items.API.Features; using KE.Utils.API.Models.Blueprints; @@ -28,3 +28,4 @@ protected override HashSet CreateModel() } } } +*/ \ No newline at end of file diff --git a/KruacentExiled/KE.Items/Items/PickupModels/MolotovPModel.cs b/KruacentExiled/KE.Items/Items/PickupModels/MolotovPModel.cs index d18a995c..22c92384 100644 --- a/KruacentExiled/KE.Items/Items/PickupModels/MolotovPModel.cs +++ b/KruacentExiled/KE.Items/Items/PickupModels/MolotovPModel.cs @@ -1,4 +1,4 @@ -using Exiled.API.Features; +/*using Exiled.API.Features; using Exiled.API.Features.Toys; using Exiled.CustomItems.API.Features; using KE.Items.API.Features; @@ -31,3 +31,4 @@ protected override HashSet CreateModel() } } } +*/ \ No newline at end of file diff --git a/KruacentExiled/KE.Items/Items/PickupModels/PressePureePModel.cs b/KruacentExiled/KE.Items/Items/PickupModels/PressePureePModel.cs index f7797d9f..deb65c6c 100644 --- a/KruacentExiled/KE.Items/Items/PickupModels/PressePureePModel.cs +++ b/KruacentExiled/KE.Items/Items/PickupModels/PressePureePModel.cs @@ -1,4 +1,4 @@ -using Exiled.API.Features; +/*using Exiled.API.Features; using Exiled.API.Features.Toys; using Exiled.CustomItems.API.Features; using KE.Items.API.Features; @@ -37,3 +37,4 @@ protected override HashSet CreateModel() } } } +*/ \ No newline at end of file diff --git a/KruacentExiled/KE.Items/Items/PickupModels/Scp3136PModel.cs b/KruacentExiled/KE.Items/Items/PickupModels/Scp3136PModel.cs index e62a37dc..e6c87981 100644 --- a/KruacentExiled/KE.Items/Items/PickupModels/Scp3136PModel.cs +++ b/KruacentExiled/KE.Items/Items/PickupModels/Scp3136PModel.cs @@ -1,4 +1,4 @@ -using Exiled.API.Features; +/*using Exiled.API.Features; using Exiled.API.Features.Toys; using Exiled.CustomItems.API.Features; using KE.Items.API.Features; @@ -36,3 +36,4 @@ protected override HashSet CreateModel() } } } +*/ \ No newline at end of file diff --git a/KruacentExiled/KE.Items/Items/PickupModels/TPGrenadaPModel.cs b/KruacentExiled/KE.Items/Items/PickupModels/TPGrenadaPModel.cs index 5cf2f702..d459cc67 100644 --- a/KruacentExiled/KE.Items/Items/PickupModels/TPGrenadaPModel.cs +++ b/KruacentExiled/KE.Items/Items/PickupModels/TPGrenadaPModel.cs @@ -1,4 +1,4 @@ -using Exiled.API.Features.Toys; +/*using Exiled.API.Features.Toys; using Exiled.CustomItems.API.Features; using KE.Items.API.Features; using KE.Utils.API.Models.Blueprints; @@ -47,3 +47,4 @@ protected override HashSet CreateModel() } } } +*/ \ No newline at end of file diff --git a/KruacentExiled/KE.Items/Items/PressePuree.cs b/KruacentExiled/KE.Items/Items/PressePuree.cs index 869c274a..80983dbb 100644 --- a/KruacentExiled/KE.Items/Items/PressePuree.cs +++ b/KruacentExiled/KE.Items/Items/PressePuree.cs @@ -10,7 +10,6 @@ using KE.Items.API.Events; using KE.Items.API.Features; using KE.Items.API.Interface; -using KE.Items.Items.PickupModels; using Scp914; using System; using System.Collections.Generic; @@ -18,7 +17,7 @@ namespace KE.Items.Items { [CustomItem(ItemType.GrenadeHE)] - public class PressePuree : KECustomGrenade, IUpgradableCustomItem, ICustomPickupModel + public class PressePuree : KECustomGrenade, IUpgradableCustomItem/*, ICustomPickupModel*/ { //presse puree public override uint Id { get; set; } = 1046; @@ -27,7 +26,7 @@ public class PressePuree : KECustomGrenade, IUpgradableCustomItem, ICustomPickup public override float Weight { get; set; } = 0.65f; public override float FuseTime { get; set; } = 5f; public override bool ExplodeOnCollision { get; set; } = true; - public PickupModel PickupModel { get; } + //public PickupModel PickupModel { get; } public override SpawnProperties SpawnProperties { get; set; } = new SpawnProperties() { Limit = 5, @@ -58,20 +57,20 @@ public class PressePuree : KECustomGrenade, IUpgradableCustomItem, ICustomPickup public PressePuree() { - PickupModel = new PressePureePModel(this); + //PickupModel = new PressePureePModel(this); } protected override void SubscribeEvents() { - PickupModel.SubscribeEvents(); + //PickupModel.SubscribeEvents(); ExplodeEvent.ExplodeDestructible += OnExplodeDestructible; base.SubscribeEvents(); } protected override void UnsubscribeEvents() { - PickupModel.UnsubscribeEvents(); + //PickupModel.UnsubscribeEvents(); ExplodeEvent.ExplodeDestructible -= OnExplodeDestructible; base.UnsubscribeEvents(); } diff --git a/KruacentExiled/KE.Items/Items/Scp3136.cs b/KruacentExiled/KE.Items/Items/Scp3136.cs index 62a50c79..a8387d38 100644 --- a/KruacentExiled/KE.Items/Items/Scp3136.cs +++ b/KruacentExiled/KE.Items/Items/Scp3136.cs @@ -7,21 +7,14 @@ using Exiled.Events.EventArgs.Player; using Exiled.Events.EventArgs.Server; using KE.Items.API.Features; -using KE.Items.API.Interface; -using KE.Items.Items.PickupModels; -using MEC; using PlayerRoles; -using System; using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; using UnityEngine; namespace KE.Items.Items { [CustomItem(ItemType.SCP1576)] - public class Scp3136 : KECustomItem, ICustomPickupModel + public class Scp3136 : KECustomItem/*, ICustomPickupModel*/ { public override uint Id { get; set; } = 1057; public override string Name { get; set; } = "SCP-3136"; @@ -48,7 +41,7 @@ public class Scp3136 : KECustomItem, ICustomPickupModel } }; - public PickupModel PickupModel { get; } + //public PickupModel PickupModel { get; } public Scp3136() { @@ -59,12 +52,12 @@ protected override void SubscribeEvents() { Exiled.Events.Handlers.Player.UsedItem += OnDrawing; Exiled.Events.Handlers.Server.RespawnedTeam += OnRespawnedTeam; - PickupModel?.SubscribeEvents(); + //PickupModel?.SubscribeEvents(); base.SubscribeEvents(); } protected override void UnsubscribeEvents() { - PickupModel?.UnsubscribeEvents(); + //PickupModel?.UnsubscribeEvents(); Exiled.Events.Handlers.Player.UsedItem -= OnDrawing; Exiled.Events.Handlers.Server.RespawnedTeam -= OnRespawnedTeam; base.UnsubscribeEvents(); diff --git a/KruacentExiled/KE.Items/Items/TPGrenada.cs b/KruacentExiled/KE.Items/Items/TPGrenada.cs index dd72cca1..58d0476e 100644 --- a/KruacentExiled/KE.Items/Items/TPGrenada.cs +++ b/KruacentExiled/KE.Items/Items/TPGrenada.cs @@ -7,12 +7,11 @@ using KE.Items.API.Features; using KE.Items.API.Interface; using KE.Items.Items.ItemEffects; -using KE.Items.Items.PickupModels; namespace KE.Items.Items { [CustomItem(ItemType.GrenadeHE)] - public class TPGrenada : KECustomGrenade, ISwichableEffect, ICustomPickupModel + public class TPGrenada : KECustomGrenade, ISwichableEffect/*, ICustomPickupModel*/ { public override uint Id { get; set; } = 1045; @@ -52,12 +51,12 @@ public class TPGrenada : KECustomGrenade, ISwichableEffect, ICustomPickupModel }; - public PickupModel PickupModel { get; } + //public PickupModel PickupModel { get; } public TPGrenada() { Effect = new TPGrenadaEffect(); - PickupModel = new TPGrenadaPModel(this); + //PickupModel = new TPGrenadaPModel(this); } protected override void OnExploding(ExplodingGrenadeEventArgs ev) @@ -68,13 +67,13 @@ protected override void OnExploding(ExplodingGrenadeEventArgs ev) protected override void SubscribeEvents() { - PickupModel.SubscribeEvents(); + //PickupModel.SubscribeEvents(); base.SubscribeEvents(); } protected override void UnsubscribeEvents() { - PickupModel.UnsubscribeEvents(); + //PickupModel.UnsubscribeEvents(); base.UnsubscribeEvents(); } From dd8860d2616070fa3abdb3c48b2d3a9168162105 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Sun, 23 Nov 2025 21:56:33 +0100 Subject: [PATCH 438/853] removed model --- KruacentExiled/KE.Map/MainPlugin.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/KruacentExiled/KE.Map/MainPlugin.cs b/KruacentExiled/KE.Map/MainPlugin.cs index 8a177c94..a15b7dab 100644 --- a/KruacentExiled/KE.Map/MainPlugin.cs +++ b/KruacentExiled/KE.Map/MainPlugin.cs @@ -38,7 +38,6 @@ public class MainPlugin : Plugin public override string Name => "KE.Map"; public override string Prefix => "KE.M"; public static MainPlugin Instance { get; private set; } - public Models models => Models.Instance; private Handler handler; public static Translations Translations => Instance?.Translation; public static Config Configs => Instance?.Config; From a15624ba1595f611acdca95cc85d5995dffd6a80 Mon Sep 17 00:00:00 2001 From: OmerGS <27omerf@gmail.com> Date: Mon, 24 Nov 2025 10:32:46 +0100 Subject: [PATCH 439/853] change items effect, to correspond with all of the 3 methods. --- .../ItemEffects/LowGravityGrenadeEffect.cs | 17 +++++++---------- .../ItemEffects/ProximityGrenadeEffect.cs | 17 +++++++---------- .../KE.Items/ItemEffects/SmokeGrenadeEffect.cs | 11 +++++------ KruacentExiled/KE.Items/KE.Items.csproj | 2 +- 4 files changed, 20 insertions(+), 27 deletions(-) diff --git a/KruacentExiled/KE.Items/ItemEffects/LowGravityGrenadeEffect.cs b/KruacentExiled/KE.Items/ItemEffects/LowGravityGrenadeEffect.cs index 31d5c7b7..f517b503 100644 --- a/KruacentExiled/KE.Items/ItemEffects/LowGravityGrenadeEffect.cs +++ b/KruacentExiled/KE.Items/ItemEffects/LowGravityGrenadeEffect.cs @@ -1,7 +1,6 @@ using Exiled.API.Features; using Exiled.Events.EventArgs.Map; using Exiled.Events.EventArgs.Player; -using KE.Items.Extensions; using KE.Items.Interface; using MEC; using System.Collections.Generic; @@ -19,33 +18,31 @@ public class LowGravityGrenadeEffect : CustomItemEffect public override void Effect(UsedItemEventArgs ev) { - + OnExploding(ev.Player, ev.Player.Position); } public override void Effect(DroppingItemEventArgs ev) { - ev.Player.ItemEffectHint("No grandson don't leave me !"); + OnExploding(ev.Player, ev.Player.Position); } public override void Effect(ExplodingGrenadeEventArgs ev) { - OnExploding(ev); + OnExploding(ev.Player, ev.Position); } - public void OnExploding(ExplodingGrenadeEventArgs ev) + public void OnExploding(Player thrownPlayer, Vector3 position) { - ev.IsAllowed = false; - foreach (Player player in Player.List) { - if (Vector3.Distance(ev.Position, player.Position) <= this.Range) + if (Vector3.Distance(position, player.Position) <= this.Range) { Vector3 previousGravity = PlayerLab.Get(player.NetworkIdentity)!.Gravity; _effectedPlayers[player] = previousGravity; PlayerLab.Get(player.NetworkIdentity)!.Gravity = LowGravity; Timing.CallDelayed(this.Duration, () => { - PlayerLab.Get(ev.Player.NetworkIdentity)!.Gravity = _effectedPlayers[ev.Player]; - _effectedPlayers.Remove(ev.Player); + PlayerLab.Get(thrownPlayer.NetworkIdentity)!.Gravity = _effectedPlayers[player]; + _effectedPlayers.Remove(thrownPlayer); }); } } diff --git a/KruacentExiled/KE.Items/ItemEffects/ProximityGrenadeEffect.cs b/KruacentExiled/KE.Items/ItemEffects/ProximityGrenadeEffect.cs index 8aca70cd..473a915a 100644 --- a/KruacentExiled/KE.Items/ItemEffects/ProximityGrenadeEffect.cs +++ b/KruacentExiled/KE.Items/ItemEffects/ProximityGrenadeEffect.cs @@ -3,10 +3,8 @@ using Exiled.API.Features.Toys; using Exiled.Events.EventArgs.Map; using Exiled.Events.EventArgs.Player; -using KE.Items.Extensions; using KE.Items.Interface; using MEC; -using System.Collections.Generic; using UnityEngine; using Exiled.API.Features; @@ -19,31 +17,30 @@ public class ProximityGrenadeEffect : CustomItemEffect public override void Effect(UsedItemEventArgs ev) { - + OnExploding(ev.Player.Position); } public override void Effect(DroppingItemEventArgs ev) { - + OnExploding(ev.Player.Position); } public override void Effect(ExplodingGrenadeEventArgs ev) { - OnExploding(ev); + OnExploding(ev.Position); } - public void OnExploding(ExplodingGrenadeEventArgs ev) + public void OnExploding(Vector3 position) { - ev.IsAllowed = false; foreach (Player player in Player.List) { - if (Vector3.Distance(ev.Position, player.Position) <= Range) + if (Vector3.Distance(position, player.Position) <= Range) { var color = GetTeamColor(player); var lineColor = new Color(color.red, color.green, color.blue); - var direction = player.Position - ev.Position; + var direction = player.Position - position; var distance = direction.magnitude; var scale = new Vector3(0.1f, distance * 0.5f, 0.1f); - var laserPos = ev.Position + direction * 0.5f; + var laserPos = position + direction * 0.5f; var rotation = Quaternion.LookRotation(direction) * Quaternion.Euler(90, 0, 0); var laser = Primitive.Create(PrimitiveType.Cylinder, PrimitiveFlags.Visible, laserPos, rotation.eulerAngles, scale, true, lineColor); diff --git a/KruacentExiled/KE.Items/ItemEffects/SmokeGrenadeEffect.cs b/KruacentExiled/KE.Items/ItemEffects/SmokeGrenadeEffect.cs index 6ca8c033..458296fb 100644 --- a/KruacentExiled/KE.Items/ItemEffects/SmokeGrenadeEffect.cs +++ b/KruacentExiled/KE.Items/ItemEffects/SmokeGrenadeEffect.cs @@ -18,22 +18,21 @@ public class SmokeGrenadeEffect : CustomItemEffect public override void Effect(UsedItemEventArgs ev) { - + OnExploding(ev.Player.Position); } public override void Effect(DroppingItemEventArgs ev) { - ev.Player.ItemEffectHint("No grandson don't leave me !"); + OnExploding(ev.Player.Position); } public override void Effect(ExplodingGrenadeEventArgs ev) { - OnExploding(ev); + OnExploding(ev.Position); } - public void OnExploding(ExplodingGrenadeEventArgs ev) + public void OnExploding(Vector3 position) { - ev.IsAllowed = false; - Vector3 savedGrenadePosition = ev.Position; + Vector3 savedGrenadePosition = position; Scp244 scp244 = (Scp244)Item.Create(ItemType.SCP244a); Pickup pickup = null; scp244.Scale = new Vector3(0.01f, 0.01f, 0.01f); diff --git a/KruacentExiled/KE.Items/KE.Items.csproj b/KruacentExiled/KE.Items/KE.Items.csproj index 93ca0e6c..8000aace 100644 --- a/KruacentExiled/KE.Items/KE.Items.csproj +++ b/KruacentExiled/KE.Items/KE.Items.csproj @@ -6,7 +6,7 @@ - + From 7616a6a18b406711c1c76940756054c3e5669ec6 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Mon, 24 Nov 2025 15:30:21 +0100 Subject: [PATCH 440/853] vote start + noe death remake --- KruacentExiled/KE.Misc/Config.cs | 2 + KruacentExiled/KE.Misc/Features/VoteStart.cs | 60 ++++++++++++++++++++ KruacentExiled/KE.Misc/ForceVoteNumber.cs | 51 +++++++++++++++++ KruacentExiled/KE.Misc/MainPlugin.cs | 35 ++++++------ 4 files changed, 131 insertions(+), 17 deletions(-) create mode 100644 KruacentExiled/KE.Misc/Features/VoteStart.cs create mode 100644 KruacentExiled/KE.Misc/ForceVoteNumber.cs diff --git a/KruacentExiled/KE.Misc/Config.cs b/KruacentExiled/KE.Misc/Config.cs index b25be2ac..e30b3f87 100644 --- a/KruacentExiled/KE.Misc/Config.cs +++ b/KruacentExiled/KE.Misc/Config.cs @@ -27,5 +27,7 @@ public class Config : IConfig public int GamblingCoinMinUse { get; set; } = 1; public int GamblingCoinMaxUse { get; set; } = 2; public int GamblingCoinCooldown { get; set; } = 3; + + public int MinPlayerVote { get; set; } = 6; } } diff --git a/KruacentExiled/KE.Misc/Features/VoteStart.cs b/KruacentExiled/KE.Misc/Features/VoteStart.cs new file mode 100644 index 00000000..267513b9 --- /dev/null +++ b/KruacentExiled/KE.Misc/Features/VoteStart.cs @@ -0,0 +1,60 @@ +using Exiled.API.Features; +using Exiled.Events.EventArgs.Player; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace KE.Misc.Features +{ + internal class VoteStart : MiscFeature + { + + public int minvote = 9999; + + + public HashSet Voted = new(); + private bool voteCasted = false; + + public override void SubscribeEvents() + { + Exiled.Events.Handlers.Server.WaitingForPlayers += OnWaitingForPlayers; + Exiled.Events.Handlers.Player.VoiceChatting += OnVoiceChatting; + minvote = MainPlugin.Instance.Config.MinPlayerVote; + + base.SubscribeEvents(); + } + + + public override void UnsubscribeEvents() + { + Exiled.Events.Handlers.Server.WaitingForPlayers -= OnWaitingForPlayers; + Exiled.Events.Handlers.Player.VoiceChatting -= OnVoiceChatting; + base.UnsubscribeEvents(); + } + + + + private void OnVoiceChatting(VoiceChattingEventArgs ev) + { + if (!Round.IsLobby) return; + if (voteCasted) return; + + if (Voted.Add(ev.Player)) + { + if(Voted.Count >= minvote) + { + Round.IsLobbyLocked = false; + voteCasted = true; + } + } + } + private void OnWaitingForPlayers() + { + Round.IsLobbyLocked = true; + } + + + } +} diff --git a/KruacentExiled/KE.Misc/ForceVoteNumber.cs b/KruacentExiled/KE.Misc/ForceVoteNumber.cs new file mode 100644 index 00000000..fa43f5ff --- /dev/null +++ b/KruacentExiled/KE.Misc/ForceVoteNumber.cs @@ -0,0 +1,51 @@ +using CommandSystem; +using Exiled.API.Features; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace KE.Misc +{ + [CommandHandler(typeof(RemoteAdminCommandHandler))] + public class ForceVoteNumber : ICommand + { + public string Command => "nbvote"; + + public string[] Aliases => ["nbv"]; + + public string Description => "force a number of people needed to vote for this round only"; + + public bool Execute(ArraySegment arguments, ICommandSender sender, out string response) + { + if(!Round.IsLobby) + { + response = "works only in lobby"; + return false; + } + + if(arguments.Count < 1) + { + response = "current min number : "+ MainPlugin.Instance.vote.minvote; + return true; + } + + if(!int.TryParse(arguments.At(0),out int result)) + { + response = "couldn't parse the number"; + return false; + } + + + + + + MainPlugin.Instance.vote.minvote = result; + + + response = "vote set at " + MainPlugin.Instance.vote.minvote + "players"; + return true; + } + } +} diff --git a/KruacentExiled/KE.Misc/MainPlugin.cs b/KruacentExiled/KE.Misc/MainPlugin.cs index 91958369..e23f1c42 100644 --- a/KruacentExiled/KE.Misc/MainPlugin.cs +++ b/KruacentExiled/KE.Misc/MainPlugin.cs @@ -15,6 +15,8 @@ using LightContainmentZoneDecontamination; using KE.Misc.Features.GamblingCoin; using HarmonyLib; +using Exiled.Events.EventArgs.Cassie; +using LabApi.Events.Arguments.ServerEvents; namespace KE.Misc { @@ -41,6 +43,8 @@ public class MainPlugin : Plugin internal SpawnLcz SpawnLcz { get; private set; } private Harmony harmony; + internal VoteStart vote { get; private set; } + public override void OnEnabled() { Instance = this; @@ -57,6 +61,7 @@ public override void OnEnabled() AutoNukeAnnoucement = new(); AutoTesla = new(); Candy = new Candy(); + vote = new(); //SpawnLcz = new(); Respawn.SetTokens(SpawnableFaction.NtfWave, 2); Respawn.SetTokens(SpawnableFaction.ChaosWave, 2); @@ -76,7 +81,7 @@ public override void OnEnabled() SCPBuff.SubscribeEvents(); Exiled.Events.Handlers.Server.RoundStarted += AutoNukeAnnoucement.OnRoundStarted; ServerHandle.RoundStarted += ServerHandler.OnRoundStarted; - Exiled.Events.Handlers.Player.Dying += ScpNoeDeathMessage; + LabApi.Events.Handlers.ServerEvents.CassieQueuingScpTermination += NoeDeath; CustomRole.RegisterRoles(false, null, true, this.Assembly); } @@ -85,7 +90,7 @@ public override void OnEnabled() public override void OnDisabled() { ServerHandle.RoundStarted -= ServerHandler.OnRoundStarted; - Exiled.Events.Handlers.Player.Dying -= ScpNoeDeathMessage; + LabApi.Events.Handlers.ServerEvents.CassieQueuingScpTermination -= NoeDeath; Exiled.Events.Handlers.Server.RoundStarted -= AutoNukeAnnoucement.OnRoundStarted; SCPBuff.UnsubscribeEvents(); if (Config.GamblingCoin) @@ -108,6 +113,7 @@ public override void OnDisabled() AutoTesla = null; Spawn = null; AutoElevator = null; + vote = null; AutoNukeAnnoucement = null; FriendlyFire = null; //SurfaceLight = null; @@ -117,22 +123,17 @@ public override void OnDisabled() Instance = null; } - /// - /// Special death message when Delecons dies as a SCP - /// - /// - internal void ScpNoeDeathMessage(DyingEventArgs ev) + + private void NoeDeath(CassieQueuingScpTerminationEventArgs ev) { - - Player player = ev.Player; - - if (!player.UserId.Equals("76561199066936074@steam")) - return; - if (!player.IsScp) - return; - if (player.Role.Type == RoleTypeId.Scp0492) - return; - Cassie.MessageTranslated("SCP 69 420 has been contained successfully", "SCP-69420-NOE has been contained successfully"); + Player player = Player.Get(ev.Player); + if(!player.UserId.Equals("76561199066936074@steam") + || !player.IsScp + || player.Role != RoleTypeId.Scp0492) + { + ev.IsAllowed = false; + Cassie.MessageTranslated("SCP 69 420 has been contained successfully", "SCP-69420-NOE has been contained successfully"); + } } From ba19cfe348136eb6ee2c7420ee2395f65a50de42 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Mon, 24 Nov 2025 15:46:04 +0100 Subject: [PATCH 441/853] shallow copy elevator & tesla --- KruacentExiled/KE.Misc/Features/AutoElevator.cs | 2 +- KruacentExiled/KE.Misc/Features/AutoTesla.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/KruacentExiled/KE.Misc/Features/AutoElevator.cs b/KruacentExiled/KE.Misc/Features/AutoElevator.cs index 5eecaeac..62c15ee1 100644 --- a/KruacentExiled/KE.Misc/Features/AutoElevator.cs +++ b/KruacentExiled/KE.Misc/Features/AutoElevator.cs @@ -32,7 +32,7 @@ private IEnumerator StartElevator() //Log.Debug("elevator"); while (!Round.IsEnded) { - foreach (Lift l in Lift.List) + foreach (Lift l in Lift.List.ToList()) { yield return Timing.WaitForSeconds(UnityEngine.Random.Range(30, 45)); SendElevator(l); diff --git a/KruacentExiled/KE.Misc/Features/AutoTesla.cs b/KruacentExiled/KE.Misc/Features/AutoTesla.cs index be584a54..95fad9db 100644 --- a/KruacentExiled/KE.Misc/Features/AutoTesla.cs +++ b/KruacentExiled/KE.Misc/Features/AutoTesla.cs @@ -32,7 +32,7 @@ private IEnumerator StartElevator() { while (!Round.IsEnded) { - foreach (Tesla tesla in Tesla.List) + foreach (Tesla tesla in Tesla.List.ToList()) { yield return Timing.WaitForSeconds(UnityEngine.Random.Range(120f,200f)); tesla.Trigger(); From adf3aaf3971935a7d9b3cdbe27ed611238f7feb8 Mon Sep 17 00:00:00 2001 From: OmerGS <27omerf@gmail.com> Date: Tue, 25 Nov 2025 17:45:43 +0100 Subject: [PATCH 442/853] fix some roles : - Pilot - SCP202 --- .../KE.CustomRoles/Abilities/Airstrike.cs | 2 +- .../KE.CustomRoles/Abilities/Teleportation.cs | 13 ++++++++----- KruacentExiled/KE.CustomRoles/CR/MTF/Pilot.cs | 4 +--- .../CR/{Human => Scientist}/scp202.cs | 12 +++++------- 4 files changed, 15 insertions(+), 16 deletions(-) rename KruacentExiled/KE.CustomRoles/CR/{Human => Scientist}/scp202.cs (88%) diff --git a/KruacentExiled/KE.CustomRoles/Abilities/Airstrike.cs b/KruacentExiled/KE.CustomRoles/Abilities/Airstrike.cs index 4c81e658..f41da6ed 100644 --- a/KruacentExiled/KE.CustomRoles/Abilities/Airstrike.cs +++ b/KruacentExiled/KE.CustomRoles/Abilities/Airstrike.cs @@ -19,7 +19,7 @@ namespace KE.CustomRoles.Abilities { public class Airstrike : KEAbilities { - public override string Name { get; } = "Airstrike"; + public override string Name { get; } = "AirStrike"; public override string PublicName { get; } = "Airstrike"; public override string Description { get; } = "Don't overuse it or your co-op will not be happy (only works on Surface Zone)"; diff --git a/KruacentExiled/KE.CustomRoles/Abilities/Teleportation.cs b/KruacentExiled/KE.CustomRoles/Abilities/Teleportation.cs index c080cc20..5202a3bf 100644 --- a/KruacentExiled/KE.CustomRoles/Abilities/Teleportation.cs +++ b/KruacentExiled/KE.CustomRoles/Abilities/Teleportation.cs @@ -15,7 +15,7 @@ public class Teleportation : KEAbilities public override string Description { get; } = $"Tu perds {Damage} HP/téléportation, ne peux pas être utilisé dans les ascenseurs"; - public override float Cooldown { get; } = 120f; + public override float Cooldown { get; } = 130f; public static float Damage { get; set; } = 60; protected override void AbilityUsed(Player player) @@ -23,7 +23,6 @@ protected override void AbilityUsed(Player player) if(!SetPosition.TryGetTarget(player, out Vector3 target)) { MainPlugin.ShowEffectHint(player, "no target selected"); - return; } @@ -42,7 +41,13 @@ protected override void AbilityUsed(Player player) return; } - player.Hurt(Damage, "You are dead."); + if (target.GetZone() != player.Zone.GetZone()) + { + MainPlugin.ShowEffectHint(player, "target is not in the same zone as you."); + return; + } + + player.Hurt(Damage, "You have drained your health."); if(UnityEngine.Random.Range(1, 101) < 5) { @@ -55,8 +60,6 @@ protected override void AbilityUsed(Player player) { player.Position = target; } - - } } } \ No newline at end of file diff --git a/KruacentExiled/KE.CustomRoles/CR/MTF/Pilot.cs b/KruacentExiled/KE.CustomRoles/CR/MTF/Pilot.cs index 712a0a2e..ee90d164 100644 --- a/KruacentExiled/KE.CustomRoles/CR/MTF/Pilot.cs +++ b/KruacentExiled/KE.CustomRoles/CR/MTF/Pilot.cs @@ -39,10 +39,8 @@ public class Pilot : KECustomRole public override HashSet Abilities { get; } = new() { - "SelectPosition", + "SetPosition", "AirStrike" }; - - } } diff --git a/KruacentExiled/KE.CustomRoles/CR/Human/scp202.cs b/KruacentExiled/KE.CustomRoles/CR/Scientist/scp202.cs similarity index 88% rename from KruacentExiled/KE.CustomRoles/CR/Human/scp202.cs rename to KruacentExiled/KE.CustomRoles/CR/Scientist/scp202.cs index 94b13f6e..61084b60 100644 --- a/KruacentExiled/KE.CustomRoles/CR/Human/scp202.cs +++ b/KruacentExiled/KE.CustomRoles/CR/Scientist/scp202.cs @@ -1,20 +1,18 @@ using KE.CustomRoles.API.Features; using Exiled.API.Features; using UnityEngine; -using Exiled.API.Enums; -using Exiled.API.Extensions; -using Mirror; -using System.Linq; using Exiled.Events.EventArgs.Player; using KE.CustomRoles.API.Interfaces; +using PlayerRoles; -namespace KE.CustomRoles.CR.Human +namespace KE.CustomRoles.CR.Scientist { - public class Scp202 : GlobalCustomRole, IColor + public class Scp202 : KECustomRole, IColor { - public override SideEnum Side { get; set; } = SideEnum.Human; public override string Description { get; set; } = "? emsizan-itna'd te emsinummoc itna'd eiv enu sèrpa\n7691 lirva 91 el trom te engoloc à 6781 reivnaj 5 el én\n,etarcoméd neitérhc itrap ud eitrap tnasiaf 5691 à 9491 ed reilecnahC\n?elaidnom erreug ednoces al sèrpa dnamella reilecnahc re1 el darnoK erid xuev uT ?drannoC"; public override string PublicName { get; set; } = "SCP-202"; + public override int MaxHealth { get; set; } = 100; + public override RoleTypeId Role { get; set; } = RoleTypeId.Scientist; public override bool KeepRoleOnDeath { get; set; } = false; public override bool KeepRoleOnChangingRole { get; set; } = true; From 036a093d96406bd01bb402953a8125b6ab88f553 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Wed, 26 Nov 2025 20:32:37 +0100 Subject: [PATCH 443/853] scp457 + other stuff --- .../API/Features/CustomStatBase.cs | 73 ------------ .../API/Features/KEAbilities.cs | 41 ++----- .../API/Features/KECustomRole.cs | 29 +++++ .../KE.CustomRoles/Abilities/Convert.cs | 6 + .../Abilities/FireAbilities/BlindingFlash.cs | 2 +- .../Abilities/FireAbilities/FireAbility.cs | 61 ---------- .../FireAbilities/FireAbilityBase.cs | 68 +++++++++++ .../Abilities/FireAbilities/FireStat.cs | 68 +++++------ .../Abilities/FireAbilities/Fireball.cs | 2 +- .../CR/ChaosInsurgency/Negotiator.cs | 6 + .../KE.CustomRoles/CR/Human/Asthmatique.cs | 24 +--- .../KE.CustomRoles/CR/Human/Diabetique.cs | 5 +- .../KE.CustomRoles/CR/SCP/SCP457.cs | 7 +- KruacentExiled/KE.CustomRoles/MainPlugin.cs | 5 + .../KE.CustomRoles/Settings/SettingHandler.cs | 109 +++++++++++++++++- 15 files changed, 274 insertions(+), 232 deletions(-) delete mode 100644 KruacentExiled/KE.CustomRoles/API/Features/CustomStatBase.cs delete mode 100644 KruacentExiled/KE.CustomRoles/Abilities/FireAbilities/FireAbility.cs create mode 100644 KruacentExiled/KE.CustomRoles/Abilities/FireAbilities/FireAbilityBase.cs diff --git a/KruacentExiled/KE.CustomRoles/API/Features/CustomStatBase.cs b/KruacentExiled/KE.CustomRoles/API/Features/CustomStatBase.cs deleted file mode 100644 index cab2856e..00000000 --- a/KruacentExiled/KE.CustomRoles/API/Features/CustomStatBase.cs +++ /dev/null @@ -1,73 +0,0 @@ -using Exiled.API.Features; -using KE.Utils.API.Displays.DisplayMeow; -using MEC; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using UnityEngine; - -namespace KE.CustomRoles.API.Features -{ - public abstract class CustomStatBase : MonoBehaviour - { - public abstract float CurValue { get; set; } - - public abstract float MinValue { get; } - - public abstract float MaxValue { get; set; } - public abstract string Name { get; } - - public float NormalizedValue - { - get - { - if (MinValue != MaxValue) - { - return (CurValue - MinValue) / (MaxValue - MinValue); - } - - return 0f; - } - } - - public ReferenceHub Hub { get; set; } - - public virtual void AddAmount(float amount) - { - CurValue = Mathf.Clamp(CurValue + amount, MinValue, MaxValue); - } - - public void AddAmount(float amount, float percentageCap) - { - float max = MaxValue * Mathf.Clamp01(percentageCap); - float value = CurValue + amount; - AddAmount(value); - } - - - public virtual void FixedUpdate() - { - string text = Name + "\n" + Math.Floor(CurValue) + "/" + MaxValue; - DisplayHandler.Instance.AddHint(MainPlugin.RightHPbars, Player.Get(Hub), text, Timing.WaitForOneFrame); - } - - public virtual void ClassChanged() - { - } - - public virtual void Destroy() - { - Destroy(gameObject.GetComponent()); - - } - - public virtual void Init() - { - Hub = ReferenceHub.GetHub(gameObject); - } - - - } -} diff --git a/KruacentExiled/KE.CustomRoles/API/Features/KEAbilities.cs b/KruacentExiled/KE.CustomRoles/API/Features/KEAbilities.cs index 04da413b..4ded9a09 100644 --- a/KruacentExiled/KE.CustomRoles/API/Features/KEAbilities.cs +++ b/KruacentExiled/KE.CustomRoles/API/Features/KEAbilities.cs @@ -4,7 +4,9 @@ using KE.CustomRoles.Settings; using KE.Utils.API; using KE.Utils.API.Displays.DisplayMeow; +using KE.Utils.API.Displays.DisplayMeow.Placements; using MEC; +using PlayerRoles.FirstPersonControl.Thirdperson; using System; using System.Collections.Generic; using System.Linq; @@ -58,7 +60,6 @@ public void Init() return; } - StartLoop(); TypeToAbility.Add(GetType(), this); NameToAbility.Add(Name, this); InternalSubscribeEvent(); @@ -175,6 +176,9 @@ public void AddAbility(Player player) } PlayersAbility[player].Add(this); + DisplayHandler.Instance.CreateAuto(player, arg => UpdateGUI(player), AbilityPosition.HintPlacement); + + AbilityAdded(player); } @@ -267,7 +271,6 @@ public static void RemoveAllSelect(Player player) ability.Selected.Remove(player); } - UpdateGUI(player); } public static void SelectFirstAbility(Player player) @@ -276,7 +279,6 @@ public static void SelectFirstAbility(Player player) { list[0].SelectAbility(player); - UpdateGUI(player); } } @@ -407,33 +409,9 @@ public static bool TryGetSelected(Player player, out KEAbilities ability) #region gui - public const float UpdateTime = 1; public const string ReadyText = "[READY]"; - private static bool flag = false; - private static void StartLoop() - { - if (!flag) - { - Timing.RunCoroutine(Loop()); - flag = true; - } - } - private static IEnumerator Loop() - { - while (true) - { - UpdateAllGUI(); - yield return Timing.WaitForSeconds(UpdateTime); - } - } - public static void UpdateAllGUI() - { - foreach(Player player in PlayersAbility.Keys) - { - UpdateGUI(player); - } - } - public static void UpdateGUI(Player player) + private static AbilitiesPosition AbilityPosition = new(); + public static string UpdateGUI(Player player) { StringBuilder builder = StringBuilderPool.Pool.Get(); @@ -450,7 +428,7 @@ public static void UpdateGUI(Player player) builder.Append(" "); - if(ability is FireAbility fire) + if(ability is FireAbilityBase fire) { builder.Append("("); builder.Append(fire.Cost); @@ -487,7 +465,8 @@ public static void UpdateGUI(Player player) string msg = builder.ToString(); StringBuilderPool.Pool.Return(builder); - DisplayHandler.Instance.AddHint(MainPlugin.Abilities, player, msg, UpdateTime); + return msg; + //DisplayHandler.Instance.AddHint(MainPlugin.Abilities, player, msg, UpdateTime); } diff --git a/KruacentExiled/KE.CustomRoles/API/Features/KECustomRole.cs b/KruacentExiled/KE.CustomRoles/API/Features/KECustomRole.cs index 2f257350..01901e19 100644 --- a/KruacentExiled/KE.CustomRoles/API/Features/KECustomRole.cs +++ b/KruacentExiled/KE.CustomRoles/API/Features/KECustomRole.cs @@ -11,6 +11,7 @@ using InventorySystem.Configs; using KE.CustomRoles.API.Interfaces; using KE.Utils.API.Displays.DisplayMeow; +using KE.Utils.API.Displays.DisplayMeow.Placements; using MEC; using PlayerRoles; using System; @@ -215,11 +216,39 @@ public override void AddRole(Player player) ShowMessage(player2); + ContinuousShow(player2); RoleAdded(player2); player2.UniqueRole = Name; player2.TryAddCustomRoleFriendlyFire(Name, CustomRoleFFMultiplier); } + private void ContinuousShow(Player player) + { + DisplayHandler.Instance.CreateAuto(player, arg => CurrentRole(player), CurrentCustomRolePosition.HintPlacement); + } + + + private static HintPosition CurrentCustomRolePosition = new CurrentCustomRolePosition(); + + public static string CurrentRole(Player player) + { + StringBuilder sb = StringBuilderPool.Pool.Get(); + if (HasCustomRole(player)) + { + sb.AppendLine("Current Role : "); + sb.AppendLine(); + sb.Append(""); + sb.Append(Get(player).FirstOrDefault()?.PublicName); + sb.Append(""); + } + + + + return StringBuilderPool.Pool.ToStringReturn(sb); + } + protected virtual void GiveInventory(Player player) { diff --git a/KruacentExiled/KE.CustomRoles/Abilities/Convert.cs b/KruacentExiled/KE.CustomRoles/Abilities/Convert.cs index efe34a5f..9a3406b3 100644 --- a/KruacentExiled/KE.CustomRoles/Abilities/Convert.cs +++ b/KruacentExiled/KE.CustomRoles/Abilities/Convert.cs @@ -1,7 +1,9 @@ using Exiled.API.Features; using Exiled.API.Features.Attributes; +using Exiled.API.Features.Toys; using Exiled.CustomRoles.API.Features; using KE.CustomRoles.API.Features; +using MEC; using PlayerRoles; using System; using System.Collections.Generic; @@ -26,8 +28,12 @@ public class Convert : KEAbilities protected override bool AbilityUsed(Player player) { + if (!Physics.Linecast(player.Position, player.Position + player.Rotation.eulerAngles * MaxDistance, out RaycastHit hit)) return false; + + + Player playerHit = Player.Get(hit.collider); if (playerHit == null) return false; diff --git a/KruacentExiled/KE.CustomRoles/Abilities/FireAbilities/BlindingFlash.cs b/KruacentExiled/KE.CustomRoles/Abilities/FireAbilities/BlindingFlash.cs index 15fb8f99..2be63570 100644 --- a/KruacentExiled/KE.CustomRoles/Abilities/FireAbilities/BlindingFlash.cs +++ b/KruacentExiled/KE.CustomRoles/Abilities/FireAbilities/BlindingFlash.cs @@ -4,7 +4,7 @@ namespace KE.CustomRoles.Abilities.FireAbilities { - public class BlindingFlash : FireAbility + public class BlindingFlash : FireAbilityBase { public override string Name { get; } = "BlindingFlash"; public override string PublicName { get; } = "Blinding Flash"; diff --git a/KruacentExiled/KE.CustomRoles/Abilities/FireAbilities/FireAbility.cs b/KruacentExiled/KE.CustomRoles/Abilities/FireAbilities/FireAbility.cs deleted file mode 100644 index d6d3d2c4..00000000 --- a/KruacentExiled/KE.CustomRoles/Abilities/FireAbilities/FireAbility.cs +++ /dev/null @@ -1,61 +0,0 @@ -using Exiled.API.Features; -using KE.CustomRoles.API.Features; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace KE.CustomRoles.Abilities.FireAbilities -{ - public abstract class FireAbility : KEAbilities - { - public abstract int Cost { get; } - public bool Exclusive => false; - protected sealed override bool AbilityUsed(Player player) - { - bool result = CanLaunchAbility(player); - if (result) - { - result= LaunchedAbility(player); - } - - - - - return result; - } - - protected virtual bool LaunchedAbility(Player player) - { - return true; - } - - public bool CanLaunchAbility(Player player) - { - if (!player.GameObject.TryGetComponent(out var stat) && Exclusive) - { - Log.Warn($"Exclusive ability ({Name}) used by a player ({player}) without the proper stat"); - return false; - } - - if (stat is not null) - { - Log.Debug(stat.CurValue); - if (stat.CurValue < Cost) - { - ShowAbilityHint(player, "not enough " + stat.Name); - - return false; - } - stat.AddAmount(-Cost); - } - - return true; - - } - - - - } -} diff --git a/KruacentExiled/KE.CustomRoles/Abilities/FireAbilities/FireAbilityBase.cs b/KruacentExiled/KE.CustomRoles/Abilities/FireAbilities/FireAbilityBase.cs new file mode 100644 index 00000000..5df1c68a --- /dev/null +++ b/KruacentExiled/KE.CustomRoles/Abilities/FireAbilities/FireAbilityBase.cs @@ -0,0 +1,68 @@ +using Exiled.API.Extensions; +using Exiled.API.Features; +using KE.CustomRoles.API.Features; +using KE.Utils.API.CustomStats; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace KE.CustomRoles.Abilities.FireAbilities +{ + public abstract class FireAbilityBase : KEAbilities + { + public abstract int Cost { get; } + protected sealed override bool AbilityUsed(Player player) + { + bool result = CanLaunchAbility(player); + Log.Debug("using fire"); + if (result) + { + result = LaunchedAbility(player); + } + + + + + return result; + } + + protected virtual bool LaunchedAbility(Player player) + { + return true; + } + + public bool CanLaunchAbility(Player player) + { + + if(player.GameObject.TryGetComponent(out var stat)) + { + if (stat.TryGetModule(out var firestat)) + { + Log.Debug($"cur = {firestat.CurValue} / {Cost}"); + if (firestat.CurValue > Cost) + { + Log.Debug("enough"); + firestat.AddAmount(-Cost); + return true; + } + else + { + Log.Debug("not enough"); + return false; + } + } + + } + + + Log.Debug("no fire stat"); + return true; + + } + + + + } +} diff --git a/KruacentExiled/KE.CustomRoles/Abilities/FireAbilities/FireStat.cs b/KruacentExiled/KE.CustomRoles/Abilities/FireAbilities/FireStat.cs index 188dd680..c283872f 100644 --- a/KruacentExiled/KE.CustomRoles/Abilities/FireAbilities/FireStat.cs +++ b/KruacentExiled/KE.CustomRoles/Abilities/FireAbilities/FireStat.cs @@ -1,18 +1,12 @@ using Exiled.API.Features; using KE.CustomRoles.API.Features; -using MEC; -using PlayerStatsSystem; -using System; -using System.Collections.Generic; +using KE.Utils.API.CustomStats; using System.Linq; -using System.Security.Cryptography; -using System.Text; -using System.Threading.Tasks; using UnityEngine; namespace KE.CustomRoles.Abilities.FireAbilities { - public class FireStat : CustomStatBase + public class FireStat : CustomStatBar, ICustomRoleStat { public float BaseCapacity => MaxValue; @@ -21,7 +15,7 @@ public class FireStat : CustomStatBase public override float MinValue => 0; - private float maxvalue = 100; + private float maxvalue = 10; public override float MaxValue { get @@ -34,45 +28,51 @@ public override float MaxValue } } - public override string Name => "Fire"; + public float FireRegen { get; set; } = .3f; - public float FireRegen { get; set; } = 3; + public override Color Color => Color.red; + public string CustomRole => "SCP106_SCP457"; - private float stoptime = 120; - private float currentstoptime = 0; - - - public override void AddAmount(float amount) + public override void ClassChanged() { - currentstoptime = stoptime; - base.AddAmount(amount); + maxvalue = 10f; + CurValue = 0f; } - public override void FixedUpdate() + public override void Init(ReferenceHub ply) + { + base.Init(ply); + StatBarPosition = new Utils.API.Displays.DisplayMeow.Placements.SCP106StatBarPosition(); + } + public override string GetRaw() { + Player player =Player.Get(Hub); + + if(!KECustomRole.Get(player).Any(role => KECustomRole.Get(CustomRole) == role)) + { + return string.Empty; + } - if (currentstoptime <= 0) + + return base.GetRaw(); + } + + public override void Update() + { + float num = FireRegen * Time.deltaTime; + if (num > 0f) { - - float num = FireRegen * Time.deltaTime; - if (num > 0f) - { - if (CurValue < MaxValue) - { - CurValue = Mathf.MoveTowards(CurValue, MaxValue, num); - } - } - else if (CurValue > 0f) + if (CurValue < MaxValue) { - CurValue += num; + CurValue = Mathf.MoveTowards(CurValue, MaxValue, num); } } - else + else if (CurValue > 0f) { - currentstoptime--; + CurValue += num; } - base.FixedUpdate(); + base.Update(); } } diff --git a/KruacentExiled/KE.CustomRoles/Abilities/FireAbilities/Fireball.cs b/KruacentExiled/KE.CustomRoles/Abilities/FireAbilities/Fireball.cs index 0d320bd7..800bd711 100644 --- a/KruacentExiled/KE.CustomRoles/Abilities/FireAbilities/Fireball.cs +++ b/KruacentExiled/KE.CustomRoles/Abilities/FireAbilities/Fireball.cs @@ -16,7 +16,7 @@ namespace KE.CustomRoles.Abilities.FireAbilities { - public class Fireball : FireAbility + public class Fireball : FireAbilityBase { public override string Name { get; } = "Fireball"; public override string PublicName { get; } = "Fireball"; diff --git a/KruacentExiled/KE.CustomRoles/CR/ChaosInsurgency/Negotiator.cs b/KruacentExiled/KE.CustomRoles/CR/ChaosInsurgency/Negotiator.cs index eeea4db2..721ec6fd 100644 --- a/KruacentExiled/KE.CustomRoles/CR/ChaosInsurgency/Negotiator.cs +++ b/KruacentExiled/KE.CustomRoles/CR/ChaosInsurgency/Negotiator.cs @@ -34,6 +34,11 @@ protected override void RoleAdded(Player player) { Timing.CallDelayed(.1f, delegate { + player.AddItem(ItemType.KeycardChaosInsurgency); + player.AddItem(ItemType.GunAK); + player.AddItem(ItemType.Medkit); + player.AddItem(ItemType.Painkillers); + player.AddItem(ItemType.ArmorCombat); player.AddItem(ItemType.Radio); }); } @@ -55,6 +60,7 @@ private void OnHurting(HurtingEventArgs ev) { if (!Check(ev.Player)) return; if (!ev.IsAllowed) return; + if (ev.Attacker is null) return; if(ev.Attacker.Role.Side == ev.Player.Role.Side) { diff --git a/KruacentExiled/KE.CustomRoles/CR/Human/Asthmatique.cs b/KruacentExiled/KE.CustomRoles/CR/Human/Asthmatique.cs index 5c33385b..30832b6e 100644 --- a/KruacentExiled/KE.CustomRoles/CR/Human/Asthmatique.cs +++ b/KruacentExiled/KE.CustomRoles/CR/Human/Asthmatique.cs @@ -6,12 +6,13 @@ using KE.CustomRoles.API.Features; using KE.CustomRoles.API.Interfaces; using PlayerRoles; +using System.Collections.Generic; using UnityEngine; using Utils.NonAllocLINQ; namespace KE.CustomRoles.CR.Human { - public class Asthmatique : GlobalCustomRole, IColor + public class Asthmatique : GlobalCustomRole, IColor, IHealable { public override SideEnum Side { get; set; } = SideEnum.Human; public override string Description { get; set; } = "T'as stamina est réduit de moitié\nMais tu vises mieux"; @@ -20,26 +21,7 @@ public class Asthmatique : GlobalCustomRole, IColor public override bool KeepRoleOnChangingRole { get; set; } = true; public override float SpawnChance { get; set; } = 100; public Color32 Color => new Color32(191, 255, 0, 0); - - protected override void SubscribeEvents() - { - Exiled.Events.Handlers.Player.UsedItem += OnUsedItem; - base.SubscribeEvents(); - } - protected override void UnsubscribeEvents() - { - Exiled.Events.Handlers.Player.UsedItem -= OnUsedItem; - base.UnsubscribeEvents(); - } - - private void OnUsedItem(UsedItemEventArgs ev) - { - if (!Check(ev.Player)) return; - if(ev.Item.Type == ItemType.SCP500) - { - RemoveRole(ev.Player); - } - } + public HashSet HealItem => [ItemType.SCP500]; protected override void RoleAdded(Player player) { diff --git a/KruacentExiled/KE.CustomRoles/CR/Human/Diabetique.cs b/KruacentExiled/KE.CustomRoles/CR/Human/Diabetique.cs index 97834cc5..d88f6b63 100644 --- a/KruacentExiled/KE.CustomRoles/CR/Human/Diabetique.cs +++ b/KruacentExiled/KE.CustomRoles/CR/Human/Diabetique.cs @@ -6,12 +6,13 @@ using KE.CustomRoles.API.Features; using KE.CustomRoles.API.Interfaces; using PlayerRoles; +using System.Collections.Generic; using UnityEngine; using Utils.NonAllocLINQ; namespace KE.CustomRoles.CR.Human { - public class Diabetique : GlobalCustomRole, IColor + public class Diabetique : GlobalCustomRole, IColor, IHealable { public override SideEnum Side { get; set; } = SideEnum.Human; public override string Description { get; set; } = "T'as mangé le crambleu au pomme de mael"; @@ -19,7 +20,7 @@ public class Diabetique : GlobalCustomRole, IColor public override bool KeepRoleOnDeath { get; set; } = false; public override bool KeepRoleOnChangingRole { get; set; } = false; public override float SpawnChance { get; set; } = 100; - + public HashSet HealItem => [ItemType.SCP500]; public Color32 Color => new(255, 255, 0,0); protected override void RoleAdded(Player player) diff --git a/KruacentExiled/KE.CustomRoles/CR/SCP/SCP457.cs b/KruacentExiled/KE.CustomRoles/CR/SCP/SCP457.cs index 2db8b826..6b7e8f23 100644 --- a/KruacentExiled/KE.CustomRoles/CR/SCP/SCP457.cs +++ b/KruacentExiled/KE.CustomRoles/CR/SCP/SCP457.cs @@ -55,9 +55,6 @@ protected override void RoleAdded(Player player) _inside.Add(player, null); _handles.Add(player, new()); - FireStat firestat = player.ReferenceHub.gameObject.AddComponent(); - firestat.Init(); - _handles[player].Add(Timing.RunCoroutine(InsideLight(player))); _handles[player].Add(Timing.RunCoroutine(PassiveDamage(player))); @@ -97,7 +94,7 @@ private IEnumerator PassiveDamage(Player scp) { float damage = -(hitinfo.distance / 3) + 10; player.EnableEffect(Exiled.API.Enums.EffectType.Burned, DamageRefreshRate, true); - player.Hurt(damage, Fireball.BallDamage._deathReason); + player.Hurt(damage, Fireball.BallDamage.RagdollInspectText); scp.CustomHumeShieldStat.AddAmount(damage); } @@ -131,8 +128,6 @@ protected override void RoleRemoved(Player player) } _handles.Remove(player); } - FireStat firestat = player.ReferenceHub.gameObject.GetComponent(); - firestat.Destroy(); } diff --git a/KruacentExiled/KE.CustomRoles/MainPlugin.cs b/KruacentExiled/KE.CustomRoles/MainPlugin.cs index 079eac99..a8b51528 100644 --- a/KruacentExiled/KE.CustomRoles/MainPlugin.cs +++ b/KruacentExiled/KE.CustomRoles/MainPlugin.cs @@ -4,8 +4,10 @@ using Exiled.CustomRoles.API.Features; using Exiled.Events.EventArgs.Server; using HarmonyLib; +using KE.CustomRoles.Abilities.FireAbilities; using KE.CustomRoles.API.Features; using KE.CustomRoles.Settings; +using KE.Utils.API.CustomStats; using KE.Utils.API.Displays.DisplayMeow; using MEC; using Microsoft.Win32; @@ -41,6 +43,8 @@ public override void OnEnabled() _settingHandler = new(); Utils.API.Settings.SettingHandler.Instance.SubscribeEvents(); + CustomPlayerStat.AddModule(); + CustomStatsEvents.SubscribeEvents(); Harmony = new(Name); Harmony.PatchAll(); @@ -59,6 +63,7 @@ public override void OnDisabled() KEAbilities.Unregister(); UnsubscribeEvents(); + CustomStatsEvents.UnsubscribeEvents(); Utils.API.Settings.SettingHandler.Instance.UnsubscribeEvents(); _settingHandler = null; Instance = null; diff --git a/KruacentExiled/KE.CustomRoles/Settings/SettingHandler.cs b/KruacentExiled/KE.CustomRoles/Settings/SettingHandler.cs index 7c8ff804..46be71ab 100644 --- a/KruacentExiled/KE.CustomRoles/Settings/SettingHandler.cs +++ b/KruacentExiled/KE.CustomRoles/Settings/SettingHandler.cs @@ -1,14 +1,21 @@ -using Exiled.API.Features; +using Exiled.API.Extensions; +using Exiled.API.Features; using Exiled.API.Features.Core.UserSettings; using Exiled.Events.EventArgs.Player; +using HintServiceMeow.Core.Enum; +using HintServiceMeow.Core.Extension; +using HintServiceMeow.Core.Models.Hints; +using HintServiceMeow.Core.Utilities; using KE.CustomRoles.API.Features; using KE.Utils.API.Interfaces; using KE.Utils.API.Settings; using System; using System.Collections.Generic; +using System.Configuration; using TMPro; using UserSettings.ServerSpecific; using static UnityEngine.Rendering.RayTracingAccelerationStructure; +using Hint = HintServiceMeow.Core.Models.Hints.Hint; namespace KE.CustomRoles.Settings { @@ -23,6 +30,12 @@ internal class SettingHandler : IUsingEvents private readonly int _idSelect = 151; private readonly int _idArrow = 152; private readonly int _idTimeAbilityDesc = 153; + private int _idTestHintslidery = 154; + private int _idTestHintsliderx = 155; + private int _idTestHintslidertime = 156; + private int _idTestHintalign = 157; + private int _idTestHintspawn = 158; + private int _idTestHinttext = 159; @@ -56,12 +69,104 @@ public SettingHandler() } baseSettings.Add(new SSPlaintextSetting(_idArrow, "Personalize the arrow next to the selected ability", baseArrow, 16, TMP_InputField.ContentType.Standard, string.Empty, 0)); + string[] options = ["left", "center", "right"]; + + /* + baseSettings.AddRange + ( + [ + new SSSliderSetting(_idTestHintsliderx,"x",-2000,2000), + new SSSliderSetting(_idTestHintslidery,"y",0,2000), + new SSSliderSetting(_idTestHintslidertime,"time",0,10), + new SSDropdownSetting(_idTestHintalign,"alignment",options), + new SSButton(_idTestHintspawn,"spawn","spawn"), + new SSPlaintextSetting(_idTestHinttext,"text") + ] + ); + */ + + page = new("Custom roles", baseSettings); } + float xvalue = 0; + float yvalue = 0; + float timevalue = 5; + HintAlignment HintAlignment = HintAlignment.Center; + string text = "TEST"; + + public void CreateHint(Player player, ServerSpecificSettingBase setting) + { + if (SettingBase.TryGetSetting(player, _idTestHintslidery, out var slidery)) + { + yvalue = slidery.SliderValue; + } + + if (SettingBase.TryGetSetting(player, _idTestHintsliderx, out var sliderx)) + { + xvalue = sliderx.SliderValue; + } + + if (SettingBase.TryGetSetting(player, _idTestHintslidertime, out var slidertime)) + { + timevalue = slidertime.SliderValue; + } + + if (SettingBase.TryGetSetting(player, _idTestHinttext, out var textsetting)) + { + text = textsetting.Text; + } + + if (SettingBase.TryGetSetting(player, _idTestHintalign, out var dropdown)) + { + + int selected = dropdown.SelectedIndex; + if (selected == 0) + { + HintAlignment = HintAlignment.Left; + } + if (selected == 1) + { + HintAlignment = HintAlignment.Center; + } + if (selected == 2) + { + HintAlignment = HintAlignment.Right; + } + } + + if (SettingBase.TryGetSetting(player, _idTestHintspawn, out var button)) + { + if(setting == button.Base) + { + PlayerDisplay display = PlayerDisplay.Get(player); + Log.Debug($"creating hint at {xvalue},{yvalue} for {timevalue}"); + var hint = new Hint() + { + XCoordinate = xvalue, + YCoordinate = yvalue, + Alignment = HintAlignment, + Text = text + }; + display.ClearHint(); + display.AddHint(hint); + hint.HideAfter(timevalue); + + } + + + + } + + + } + + + + public void SubscribeEvents() { Utils.API.Settings.SettingHandler.Instance.AddPages(page); @@ -110,7 +215,7 @@ private void OnSettingValueReceived(Player player, ServerSpecificSettingBase set { KEAbilities.UseSelected(player); } - + //CreateHint(player, settingBase); } private Dictionary playerPos = new(); From 35781f4d610d7292100187bc58d3cc9e0515480d Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Wed, 26 Nov 2025 20:42:00 +0100 Subject: [PATCH 444/853] safe tp alzheimer --- KruacentExiled/KE.CustomRoles/Abilities/Teleportation.cs | 2 +- KruacentExiled/KE.CustomRoles/CR/Human/Alzheimer.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/KruacentExiled/KE.CustomRoles/Abilities/Teleportation.cs b/KruacentExiled/KE.CustomRoles/Abilities/Teleportation.cs index 908b5506..323405d9 100644 --- a/KruacentExiled/KE.CustomRoles/Abilities/Teleportation.cs +++ b/KruacentExiled/KE.CustomRoles/Abilities/Teleportation.cs @@ -45,7 +45,7 @@ protected override bool AbilityUsed(Player player) if (target.GetZone() != player.Zone.GetZone()) { MainPlugin.ShowEffectHint(player, "target is not in the same zone as you."); - return; + return false; } player.Hurt(Damage, "You have drained your health."); diff --git a/KruacentExiled/KE.CustomRoles/CR/Human/Alzheimer.cs b/KruacentExiled/KE.CustomRoles/CR/Human/Alzheimer.cs index fb6d2135..ef6e3691 100644 --- a/KruacentExiled/KE.CustomRoles/CR/Human/Alzheimer.cs +++ b/KruacentExiled/KE.CustomRoles/CR/Human/Alzheimer.cs @@ -53,7 +53,7 @@ private IEnumerator Teleport(Player p) yield return Timing.WaitForSeconds(UnityEngine.Random.Range(300f, 600f)); p.EnableEffect(EffectType.Flashed,1,5); p.EnableEffect(EffectType.Invisible,1,6); - p.Teleport(Room.Random(p.Zone)); + p.Teleport(Utils.Extensions.RoomExtensions.RandomSafeRoom(p.Zone)); } } From 282c9cbb8a8d4a9883a8ec941965b4491157801b Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Wed, 26 Nov 2025 21:53:33 +0100 Subject: [PATCH 445/853] reduce cost --- .../KE.CustomRoles/Abilities/FireAbilities/BlindingFlash.cs | 2 +- .../KE.CustomRoles/Abilities/FireAbilities/Fireball.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/KruacentExiled/KE.CustomRoles/Abilities/FireAbilities/BlindingFlash.cs b/KruacentExiled/KE.CustomRoles/Abilities/FireAbilities/BlindingFlash.cs index 2be63570..91f4edd6 100644 --- a/KruacentExiled/KE.CustomRoles/Abilities/FireAbilities/BlindingFlash.cs +++ b/KruacentExiled/KE.CustomRoles/Abilities/FireAbilities/BlindingFlash.cs @@ -13,7 +13,7 @@ public class BlindingFlash : FireAbilityBase public override float Cooldown { get; } = 30f; - public override int Cost => 50; + public override int Cost => 5; diff --git a/KruacentExiled/KE.CustomRoles/Abilities/FireAbilities/Fireball.cs b/KruacentExiled/KE.CustomRoles/Abilities/FireAbilities/Fireball.cs index 800bd711..b1564b49 100644 --- a/KruacentExiled/KE.CustomRoles/Abilities/FireAbilities/Fireball.cs +++ b/KruacentExiled/KE.CustomRoles/Abilities/FireAbilities/Fireball.cs @@ -20,7 +20,7 @@ public class Fireball : FireAbilityBase { public override string Name { get; } = "Fireball"; public override string PublicName { get; } = "Fireball"; - public override int Cost => 10; + public override int Cost => 1; public override string Description { get; } = "I cast Fireball"; From a44389e68bf82705d5b184a096a36cdf8895aca7 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Thu, 27 Nov 2025 15:16:43 +0100 Subject: [PATCH 446/853] fixed voting --- KruacentExiled/KE.Misc/Features/VoteStart.cs | 11 +++++----- KruacentExiled/KE.Misc/ForceVoteNumber.cs | 2 +- KruacentExiled/KE.Misc/MainPlugin.cs | 21 +++++++++++++++----- 3 files changed, 22 insertions(+), 12 deletions(-) diff --git a/KruacentExiled/KE.Misc/Features/VoteStart.cs b/KruacentExiled/KE.Misc/Features/VoteStart.cs index 267513b9..dbfe8491 100644 --- a/KruacentExiled/KE.Misc/Features/VoteStart.cs +++ b/KruacentExiled/KE.Misc/Features/VoteStart.cs @@ -21,6 +21,7 @@ public override void SubscribeEvents() { Exiled.Events.Handlers.Server.WaitingForPlayers += OnWaitingForPlayers; Exiled.Events.Handlers.Player.VoiceChatting += OnVoiceChatting; + minvote = MainPlugin.Instance.Config.MinPlayerVote; base.SubscribeEvents(); @@ -41,13 +42,11 @@ private void OnVoiceChatting(VoiceChattingEventArgs ev) if (!Round.IsLobby) return; if (voteCasted) return; - if (Voted.Add(ev.Player)) + Voted.Add(ev.Player); + if (Voted.Count >= minvote) { - if(Voted.Count >= minvote) - { - Round.IsLobbyLocked = false; - voteCasted = true; - } + Round.IsLobbyLocked = false; + voteCasted = true; } } private void OnWaitingForPlayers() diff --git a/KruacentExiled/KE.Misc/ForceVoteNumber.cs b/KruacentExiled/KE.Misc/ForceVoteNumber.cs index fa43f5ff..70692561 100644 --- a/KruacentExiled/KE.Misc/ForceVoteNumber.cs +++ b/KruacentExiled/KE.Misc/ForceVoteNumber.cs @@ -44,7 +44,7 @@ public bool Execute(ArraySegment arguments, ICommandSender sender, out s MainPlugin.Instance.vote.minvote = result; - response = "vote set at " + MainPlugin.Instance.vote.minvote + "players"; + response = "vote set at " + MainPlugin.Instance.vote.minvote + " players"; return true; } } diff --git a/KruacentExiled/KE.Misc/MainPlugin.cs b/KruacentExiled/KE.Misc/MainPlugin.cs index e23f1c42..e8bd26ea 100644 --- a/KruacentExiled/KE.Misc/MainPlugin.cs +++ b/KruacentExiled/KE.Misc/MainPlugin.cs @@ -127,13 +127,24 @@ public override void OnDisabled() private void NoeDeath(CassieQueuingScpTerminationEventArgs ev) { Player player = Player.Get(ev.Player); - if(!player.UserId.Equals("76561199066936074@steam") - || !player.IsScp - || player.Role != RoleTypeId.Scp0492) + if (!player.UserId.Equals("76561199066936074@steam")) { - ev.IsAllowed = false; - Cassie.MessageTranslated("SCP 69 420 has been contained successfully", "SCP-69420-NOE has been contained successfully"); + return; } + + + if (!player.IsScp) + { + return; + } + + if(player.Role == RoleTypeId.Scp0492) + { + return; + } + + ev.IsAllowed = false; + Cassie.MessageTranslated("SCP 69 420 has been contained successfully", "SCP-69420-NOE has been contained successfully"); } From b6c95c0a4d317dddfe3afa63ba031751c5a199c9 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Sun, 30 Nov 2025 16:58:30 +0100 Subject: [PATCH 447/853] finish fr this time 457 + rollback settings page + added a limit to the number of the same cr in a round --- .../KE.CustomRoles/API/Features/CustomSCP.cs | 15 +++-- .../API/Features/GlobalCustomRole.cs | 1 + .../API/Features/KEAbilities.cs | 11 ++-- .../API/Features/KECustomRole.cs | 27 +++++++-- .../KE.CustomRoles/Abilities/Convert.cs | 27 ++++++--- .../Abilities/FireAbilities/BlindingFlash.cs | 2 +- .../Abilities/FireAbilities/FireStat.cs | 31 ++++++---- .../Abilities/FireAbilities/Fireball.cs | 2 +- .../CR/ChaosInsurgency/Negotiator.cs | 23 ++++---- .../KE.CustomRoles/CR/ClassD/Enfant.cs | 2 +- .../KE.CustomRoles/CR/Guard/Introvert.cs | 7 ++- .../KE.CustomRoles/CR/Human/Alzheimer.cs | 2 +- .../KE.CustomRoles/CR/Human/Asthmatique.cs | 2 +- .../KE.CustomRoles/CR/Human/Crazy.cs | 2 +- .../KE.CustomRoles/CR/Human/Maladroit.cs | 2 +- .../KE.CustomRoles/CR/SCP/SCP457.cs | 4 ++ KruacentExiled/KE.CustomRoles/MainPlugin.cs | 2 +- .../KE.CustomRoles/Settings/SettingHandler.cs | 58 +++++++++++++------ 18 files changed, 139 insertions(+), 81 deletions(-) diff --git a/KruacentExiled/KE.CustomRoles/API/Features/CustomSCP.cs b/KruacentExiled/KE.CustomRoles/API/Features/CustomSCP.cs index c358aed1..c85a80a2 100644 --- a/KruacentExiled/KE.CustomRoles/API/Features/CustomSCP.cs +++ b/KruacentExiled/KE.CustomRoles/API/Features/CustomSCP.cs @@ -24,29 +24,28 @@ public abstract class CustomSCP : KECustomRole private new RecyclableSettingId Id; public int SettingId => Id.Value; - private static SettingsPage page; - private static List settings; + private static HeaderSetting header = null; + private static int HeaderId => MainPlugin.Instance.Config.HeaderId; public static IEnumerable All => Registered.Where(c => c is CustomSCP).Cast(); public override void Init() { - if (page is null) + if (header is null) { - settings = new(); - page = new SettingsPage("Custom SCPs Preferences", settings); + header = new(HeaderId, "SCP Spawn Preferences",string.Empty,true); } Id = new RecyclableSettingId(); - settings.Add(new SSSliderSetting(SettingId, PublicName, MinValue, MaxValue, DefaultValue, true)); - - Utils.API.Settings.SettingHandler.Instance.AddPages(page); + sliderSetting= new SliderSetting(SettingId, PublicName, MinValue, MaxValue, DefaultValue, true, header:header); + SettingBase.Register([sliderSetting]); base.Init(); } public override void Destroy() { + SettingBase.Unregister(); Id.Destroy(); base.Destroy(); } diff --git a/KruacentExiled/KE.CustomRoles/API/Features/GlobalCustomRole.cs b/KruacentExiled/KE.CustomRoles/API/Features/GlobalCustomRole.cs index f94c4e6b..fbd15336 100644 --- a/KruacentExiled/KE.CustomRoles/API/Features/GlobalCustomRole.cs +++ b/KruacentExiled/KE.CustomRoles/API/Features/GlobalCustomRole.cs @@ -106,6 +106,7 @@ protected override void ShowMessage(Player player) public override bool IsAvailable(Player player) { + if (CurrentNumberOfSpawn >= Limit) return false; return SideClass.Get(player.Role.Side) == Side; } } diff --git a/KruacentExiled/KE.CustomRoles/API/Features/KEAbilities.cs b/KruacentExiled/KE.CustomRoles/API/Features/KEAbilities.cs index 4ded9a09..deb891fe 100644 --- a/KruacentExiled/KE.CustomRoles/API/Features/KEAbilities.cs +++ b/KruacentExiled/KE.CustomRoles/API/Features/KEAbilities.cs @@ -132,7 +132,7 @@ public void ShowAbility(Player player) StringBuilderPool.Pool.Return(sb); } - public void SelectAbility(Player player) + public void SelectAbility(Player player, bool hide = false) { if (Selected.Add(player)) { @@ -141,8 +141,11 @@ public void SelectAbility(Player player) { abilities.UnselectAbility(player); } - - ShowAbility(player); + if (!hide) + { + ShowAbility(player); + } + } } @@ -273,7 +276,7 @@ public static void RemoveAllSelect(Player player) } - public static void SelectFirstAbility(Player player) + public static void SelectFirstAbility(Player player,bool hide = false) { if(PlayersAbility.TryGetValue(player,out var list)) { diff --git a/KruacentExiled/KE.CustomRoles/API/Features/KECustomRole.cs b/KruacentExiled/KE.CustomRoles/API/Features/KECustomRole.cs index 01901e19..3b01fe79 100644 --- a/KruacentExiled/KE.CustomRoles/API/Features/KECustomRole.cs +++ b/KruacentExiled/KE.CustomRoles/API/Features/KECustomRole.cs @@ -50,6 +50,14 @@ public override string Name /// public abstract string PublicName { get; set; } + /// + /// the max number of people who can have this role in a round + /// + public virtual int Limit { get; set; } = 1; + /// + /// the number of people who had this role in a round + /// + public virtual int CurrentNumberOfSpawn { get; set; } = 1; /// /// @@ -126,7 +134,7 @@ protected virtual void InternalUnsubscribeEvents() { if (this is IHealable) { - Exiled.Events.Handlers.Player.UsedItem += OnUsedItem; + Exiled.Events.Handlers.Player.UsedItem -= OnUsedItem; } } @@ -137,7 +145,7 @@ private void OnUsedItem(UsedItemEventArgs ev) IHealable healable = this as IHealable; if(healable.HealItem is null || healable.HealItem.Count == 0) { - Log.Warn("no healable item found for" + this.Name); + Log.Warn("no healable item found for" + Name); return; } @@ -164,7 +172,15 @@ public override void AddRole(Player player) { Player player2 = player; Log.Debug(Name + ": Adding role to " + player2.Nickname + "."); - + CurrentNumberOfSpawn++; + + IEnumerable oldroles = Get(player2); + + foreach (KECustomRole role in oldroles) + { + role.RemoveRole(player2); + } + if (Role != RoleTypeId.None) { @@ -320,7 +336,7 @@ protected virtual void SetAbilities(Player player) } } - KEAbilities.SelectFirstAbility(player); + KEAbilities.SelectFirstAbility(player,true); } } @@ -340,6 +356,7 @@ public override void RemoveRole(Player player) public virtual bool IsAvailable(Player player) { + if (CurrentNumberOfSpawn >= Limit) return false; return player.Role == Role; } @@ -432,7 +449,7 @@ private static KECustomRole AssignRole(Dictionary roleChanc return role.Key; } - return roleChances.Keys.First(); + return null; } public static Dictionary GetAvailableCustomRole(Player player) diff --git a/KruacentExiled/KE.CustomRoles/Abilities/Convert.cs b/KruacentExiled/KE.CustomRoles/Abilities/Convert.cs index 9a3406b3..1e584d94 100644 --- a/KruacentExiled/KE.CustomRoles/Abilities/Convert.cs +++ b/KruacentExiled/KE.CustomRoles/Abilities/Convert.cs @@ -23,24 +23,33 @@ public class Convert : KEAbilities public override float Cooldown { get; } = 10*60f; - public float MaxDistance { get; set; } = 5f; + public float MaxDistance { get; set; } = 15f; protected override bool AbilityUsed(Player player) { - - if (!Physics.Linecast(player.Position, player.Position + player.Rotation.eulerAngles * MaxDistance, out RaycastHit hit)) return false; - - + if (!Physics.Raycast(player.Position, player.Rotation.eulerAngles, out RaycastHit hit)) return false; Player playerHit = Player.Get(hit.collider); - if (playerHit == null) return false; + if (playerHit == null) + { + MainPlugin.ShowEffectHint(player, "But nobody's here"); + return false; + } - if (playerHit.Role.Side == player.Role.Side) return false; + if (playerHit.Role.Side == player.Role.Side) + { + MainPlugin.ShowEffectHint(player, "I know you don't like them but they're in your team"); + return false; + } - if (playerHit.IsScp && playerHit.Role != RoleTypeId.Scp0492) return false; + if (playerHit.IsScp && playerHit.Role != RoleTypeId.Scp0492) + { + MainPlugin.ShowEffectHint(player, "That ain't a zombie"); + return false; + } if (playerHit.IsScp) @@ -52,7 +61,7 @@ protected override bool AbilityUsed(Player player) playerHit.Role.Set(player.Role, RoleSpawnFlags.None); } - + MainPlugin.ShowEffectHint(player, "New friend acquired!"); return base.AbilityUsed(player); } diff --git a/KruacentExiled/KE.CustomRoles/Abilities/FireAbilities/BlindingFlash.cs b/KruacentExiled/KE.CustomRoles/Abilities/FireAbilities/BlindingFlash.cs index 91f4edd6..2be63570 100644 --- a/KruacentExiled/KE.CustomRoles/Abilities/FireAbilities/BlindingFlash.cs +++ b/KruacentExiled/KE.CustomRoles/Abilities/FireAbilities/BlindingFlash.cs @@ -13,7 +13,7 @@ public class BlindingFlash : FireAbilityBase public override float Cooldown { get; } = 30f; - public override int Cost => 5; + public override int Cost => 50; diff --git a/KruacentExiled/KE.CustomRoles/Abilities/FireAbilities/FireStat.cs b/KruacentExiled/KE.CustomRoles/Abilities/FireAbilities/FireStat.cs index c283872f..36265571 100644 --- a/KruacentExiled/KE.CustomRoles/Abilities/FireAbilities/FireStat.cs +++ b/KruacentExiled/KE.CustomRoles/Abilities/FireAbilities/FireStat.cs @@ -10,12 +10,11 @@ public class FireStat : CustomStatBar, ICustomRoleStat { public float BaseCapacity => MaxValue; - public override float CurValue { get; set; } public override float MinValue => 0; - private float maxvalue = 10; + private float maxvalue = 100; public override float MaxValue { get @@ -28,15 +27,23 @@ public override float MaxValue } } - public float FireRegen { get; set; } = .3f; + public float FireRegen { get; set; } = 3f; - public override Color Color => Color.red; + public override Color ColorBar => new Color32(252, 186, 3,byte.MaxValue); + public override Color ColorText => new Color32(255, 255, 255, byte.MaxValue); public string CustomRole => "SCP106_SCP457"; + public override int Width => 80; + + public override char Segment => '|'; + + + + public override void ClassChanged() { - maxvalue = 10f; + maxvalue = 100f; CurValue = 0f; } @@ -44,18 +51,18 @@ public override void Init(ReferenceHub ply) { base.Init(ply); StatBarPosition = new Utils.API.Displays.DisplayMeow.Placements.SCP106StatBarPosition(); + } - public override string GetRaw() + + public override bool Check() { - Player player =Player.Get(Hub); - - if(!KECustomRole.Get(player).Any(role => KECustomRole.Get(CustomRole) == role)) + Player player = Player.Get(Hub); + if (!KECustomRole.Get(player).Any(role => KECustomRole.Get(CustomRole) == role)) { - return string.Empty; + return false; } - - return base.GetRaw(); + return base.Check(); } public override void Update() diff --git a/KruacentExiled/KE.CustomRoles/Abilities/FireAbilities/Fireball.cs b/KruacentExiled/KE.CustomRoles/Abilities/FireAbilities/Fireball.cs index b1564b49..800bd711 100644 --- a/KruacentExiled/KE.CustomRoles/Abilities/FireAbilities/Fireball.cs +++ b/KruacentExiled/KE.CustomRoles/Abilities/FireAbilities/Fireball.cs @@ -20,7 +20,7 @@ public class Fireball : FireAbilityBase { public override string Name { get; } = "Fireball"; public override string PublicName { get; } = "Fireball"; - public override int Cost => 1; + public override int Cost => 10; public override string Description { get; } = "I cast Fireball"; diff --git a/KruacentExiled/KE.CustomRoles/CR/ChaosInsurgency/Negotiator.cs b/KruacentExiled/KE.CustomRoles/CR/ChaosInsurgency/Negotiator.cs index 721ec6fd..b7c9a3f8 100644 --- a/KruacentExiled/KE.CustomRoles/CR/ChaosInsurgency/Negotiator.cs +++ b/KruacentExiled/KE.CustomRoles/CR/ChaosInsurgency/Negotiator.cs @@ -13,7 +13,7 @@ namespace KE.CustomRoles.CR.ChaosInsurgency { public class Negotiator : KECustomRole { - public override string Description { get; set; } = "Who knew zombie could be so great listeners"; + public override string Description { get; set; } = "You're immune to friendly fire and you can convert zombie into your team, isn't that nice?"; public override string InternalName => PublicName; public override string PublicName { get; set; } = "Negotiator"; public override int MaxHealth { get; set; } = 100; @@ -28,21 +28,18 @@ public class Negotiator : KECustomRole "Convert" }; - - protected override void RoleAdded(Player player) + public override List Inventory { get; set; } = new() { - Timing.CallDelayed(.1f, delegate - { - player.AddItem(ItemType.KeycardChaosInsurgency); - player.AddItem(ItemType.GunAK); - player.AddItem(ItemType.Medkit); - player.AddItem(ItemType.Painkillers); - player.AddItem(ItemType.ArmorCombat); - player.AddItem(ItemType.Radio); - }); - } + "KeycardChaosInsurgency", + "GunAK", + "Medkit", + "Painkillers", + "ArmorCombat", + "Radio" + }; + protected override void SubscribeEvents() { Exiled.Events.Handlers.Player.Hurting += OnHurting; diff --git a/KruacentExiled/KE.CustomRoles/CR/ClassD/Enfant.cs b/KruacentExiled/KE.CustomRoles/CR/ClassD/Enfant.cs index 67496668..2377a077 100644 --- a/KruacentExiled/KE.CustomRoles/CR/ClassD/Enfant.cs +++ b/KruacentExiled/KE.CustomRoles/CR/ClassD/Enfant.cs @@ -17,7 +17,7 @@ public class Enfant : KECustomRole, IColor public override string PublicName { get; set; } = "Enfant"; public override int MaxHealth { get; set; } = 100; public override RoleTypeId Role { get; set; } = RoleTypeId.ClassD; - public override bool KeepRoleOnDeath { get; set; } = true; + public override bool KeepRoleOnDeath { get; set; } = false; public override bool KeepRoleOnChangingRole { get; set; } = true; public Color32 Color => new(255, 192, 203, 0); diff --git a/KruacentExiled/KE.CustomRoles/CR/Guard/Introvert.cs b/KruacentExiled/KE.CustomRoles/CR/Guard/Introvert.cs index d4cab203..18ee3cf2 100644 --- a/KruacentExiled/KE.CustomRoles/CR/Guard/Introvert.cs +++ b/KruacentExiled/KE.CustomRoles/CR/Guard/Introvert.cs @@ -21,11 +21,12 @@ internal class Introvert : KECustomRole public override List Inventory { get; set; } = new List() { - $"{ItemType.ArmorLight}", + $"{ItemType.KeycardGuard}", $"{ItemType.GunFSP9}", $"{ItemType.Medkit}", - $"{ItemType.Flashlight}", - $"{ItemType.Flashlight}" + $"{ItemType.GrenadeFlash}", + $"{ItemType.GrenadeFlash}", + $"{ItemType.ArmorLight}", }; public override Dictionary Ammo { get; set; } = new Dictionary() diff --git a/KruacentExiled/KE.CustomRoles/CR/Human/Alzheimer.cs b/KruacentExiled/KE.CustomRoles/CR/Human/Alzheimer.cs index ef6e3691..41bdc1a8 100644 --- a/KruacentExiled/KE.CustomRoles/CR/Human/Alzheimer.cs +++ b/KruacentExiled/KE.CustomRoles/CR/Human/Alzheimer.cs @@ -21,7 +21,7 @@ public class Alzheimer : GlobalCustomRole, IColor, IHealable public override string PublicName { get; set; } = "Vieux"; public override string InternalName => GetType().Name; public override bool KeepRoleOnDeath { get; set; } = false; - public override bool KeepRoleOnChangingRole { get; set; } = true; + public override bool KeepRoleOnChangingRole { get; set; } = false; public override float SpawnChance { get; set; } = 100; public Color32 Color => new Color32(112,112,112,0); diff --git a/KruacentExiled/KE.CustomRoles/CR/Human/Asthmatique.cs b/KruacentExiled/KE.CustomRoles/CR/Human/Asthmatique.cs index 30832b6e..4f0bb2ac 100644 --- a/KruacentExiled/KE.CustomRoles/CR/Human/Asthmatique.cs +++ b/KruacentExiled/KE.CustomRoles/CR/Human/Asthmatique.cs @@ -18,7 +18,7 @@ public class Asthmatique : GlobalCustomRole, IColor, IHealable public override string Description { get; set; } = "T'as stamina est réduit de moitié\nMais tu vises mieux"; public override string PublicName { get; set; } = "Asthmatique"; public override bool KeepRoleOnDeath { get; set; } = false; - public override bool KeepRoleOnChangingRole { get; set; } = true; + public override bool KeepRoleOnChangingRole { get; set; } = false; public override float SpawnChance { get; set; } = 100; public Color32 Color => new Color32(191, 255, 0, 0); public HashSet HealItem => [ItemType.SCP500]; diff --git a/KruacentExiled/KE.CustomRoles/CR/Human/Crazy.cs b/KruacentExiled/KE.CustomRoles/CR/Human/Crazy.cs index a1cac493..1a55fe3e 100644 --- a/KruacentExiled/KE.CustomRoles/CR/Human/Crazy.cs +++ b/KruacentExiled/KE.CustomRoles/CR/Human/Crazy.cs @@ -36,7 +36,7 @@ internal class Crazy : GlobalCustomRole public override string Description { get; set; } = "Je pense que le traitement que t'as eu à la fondation t'as pas aidé"; public override string PublicName { get; set; } = "Fou de la facilité"; public override bool KeepRoleOnDeath { get; set; } = false; - public override bool KeepRoleOnChangingRole { get; set; } = true; + public override bool KeepRoleOnChangingRole { get; set; } = false; public override float SpawnChance { get; set; } = 100; private readonly Dictionary WeightDictionnary = new() diff --git a/KruacentExiled/KE.CustomRoles/CR/Human/Maladroit.cs b/KruacentExiled/KE.CustomRoles/CR/Human/Maladroit.cs index e850639b..17310bdb 100644 --- a/KruacentExiled/KE.CustomRoles/CR/Human/Maladroit.cs +++ b/KruacentExiled/KE.CustomRoles/CR/Human/Maladroit.cs @@ -24,7 +24,7 @@ public class Maladroit : GlobalCustomRole, IColor public override string Description { get; set; } = "Fait attention à tes items !"; public override string PublicName { get; set; } = "Maladroit"; public override bool KeepRoleOnDeath { get; set; } = false; - public override bool KeepRoleOnChangingRole { get; set; } = true; + public override bool KeepRoleOnChangingRole { get; set; } = false; public override float SpawnChance { get; set; } = 100; public Color32 Color => new(211, 110, 112, 0); diff --git a/KruacentExiled/KE.CustomRoles/CR/SCP/SCP457.cs b/KruacentExiled/KE.CustomRoles/CR/SCP/SCP457.cs index 6b7e8f23..77feffdf 100644 --- a/KruacentExiled/KE.CustomRoles/CR/SCP/SCP457.cs +++ b/KruacentExiled/KE.CustomRoles/CR/SCP/SCP457.cs @@ -58,6 +58,10 @@ protected override void RoleAdded(Player player) _handles[player].Add(Timing.RunCoroutine(InsideLight(player))); _handles[player].Add(Timing.RunCoroutine(PassiveDamage(player))); + if(player.Role is Scp106Role role) + { + role.Vigor = role.VigorComponent.MaxValue; + } } private IEnumerator InsideLight(Player player) diff --git a/KruacentExiled/KE.CustomRoles/MainPlugin.cs b/KruacentExiled/KE.CustomRoles/MainPlugin.cs index a8b51528..88c58840 100644 --- a/KruacentExiled/KE.CustomRoles/MainPlugin.cs +++ b/KruacentExiled/KE.CustomRoles/MainPlugin.cs @@ -41,7 +41,7 @@ public override void OnEnabled() Instance = this; _settingHandler = new(); - Utils.API.Settings.SettingHandler.Instance.SubscribeEvents(); + //Utils.API.Settings.SettingHandler.Instance.SubscribeEvents(); CustomPlayerStat.AddModule(); CustomStatsEvents.SubscribeEvents(); diff --git a/KruacentExiled/KE.CustomRoles/Settings/SettingHandler.cs b/KruacentExiled/KE.CustomRoles/Settings/SettingHandler.cs index 46be71ab..cbbeaea1 100644 --- a/KruacentExiled/KE.CustomRoles/Settings/SettingHandler.cs +++ b/KruacentExiled/KE.CustomRoles/Settings/SettingHandler.cs @@ -9,6 +9,7 @@ using KE.CustomRoles.API.Features; using KE.Utils.API.Interfaces; using KE.Utils.API.Settings; +using LabApi.Events.Arguments.PlayerEvents; using System; using System.Collections.Generic; using System.Configuration; @@ -45,6 +46,7 @@ internal class SettingHandler : IUsingEvents public static SettingHandler Instance { get; private set; } private List settings; public readonly SettingsPage page; + public readonly SettingsPage hintpage = null; public const string baseArrow = "<--"; public SettingHandler() { @@ -61,9 +63,9 @@ public SettingHandler() List baseSettings = new(); - - foreach(SettingBase setting in settings) + + foreach (SettingBase setting in settings) { baseSettings.Add(setting.Base); } @@ -71,23 +73,32 @@ public SettingHandler() string[] options = ["left", "center", "right"]; - /* - baseSettings.AddRange - ( - [ + + if (MainPlugin.Instance.Config.Debug) + { + List hintscreator = new() + { new SSSliderSetting(_idTestHintsliderx,"x",-2000,2000), new SSSliderSetting(_idTestHintslidery,"y",0,2000), new SSSliderSetting(_idTestHintslidertime,"time",0,10), new SSDropdownSetting(_idTestHintalign,"alignment",options), new SSButton(_idTestHintspawn,"spawn","spawn"), new SSPlaintextSetting(_idTestHinttext,"text") - ] - ); - */ + }; + + //hintpage = new("hint creator", hintscreator); + } + + + + + //page = new("Custom roles", baseSettings); + + ServerSpecificSettingsSync.DefinedSettings = new List(baseSettings).ToArray(); + ServerSpecificSettingsSync.SendToAll(); - page = new("Custom roles", baseSettings); } @@ -169,9 +180,14 @@ public void CreateHint(Player player, ServerSpecificSettingBase setting) public void SubscribeEvents() { - Utils.API.Settings.SettingHandler.Instance.AddPages(page); + //Utils.API.Settings.SettingHandler.Instance.AddPages(page); + if(hintpage is not null) + { + Utils.API.Settings.SettingHandler.Instance.AddPages(hintpage); + } + ServerSpecificSettingsSync.ServerOnSettingValueReceived += SafeOnSettingValueReceived; - Exiled.Events.Handlers.Player.Verified += OnVerified; + LabApi.Events.Handlers.PlayerEvents.Joined += AddPlayer; DownPressed += Down; UpPressed += Up; @@ -179,12 +195,17 @@ public void SubscribeEvents() public void UnsubscribeEvents() { - Exiled.Events.Handlers.Player.Verified -= OnVerified; ServerSpecificSettingsSync.ServerOnSettingValueReceived -= SafeOnSettingValueReceived; + LabApi.Events.Handlers.PlayerEvents.Joined -= AddPlayer; DownPressed -= Down; UpPressed -= Up; } + + private void AddPlayer(PlayerJoinedEventArgs ev) + { + ServerSpecificSettingsSync.SendToPlayer(ev.Player.ReferenceHub); + } private void SafeOnSettingValueReceived(ReferenceHub hub, ServerSpecificSettingBase settingBase) { @@ -215,7 +236,11 @@ private void OnSettingValueReceived(Player player, ServerSpecificSettingBase set { KEAbilities.UseSelected(player); } - //CreateHint(player, settingBase); + if(hintpage is not null) + { + CreateHint(player, settingBase); + } + } private Dictionary playerPos = new(); @@ -280,11 +305,6 @@ public static bool CheckPressed(ServerSpecificSettingBase settingBase, int id) - private void OnVerified(VerifiedEventArgs ev) - { - ServerSpecificSettingsSync.SendToPlayer(ev.Player.ReferenceHub); - } - /// /// /// From 04fd3353daa5d02a2c88cbda9a179938d62d2680 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Sun, 30 Nov 2025 18:06:26 +0100 Subject: [PATCH 448/853] fixed convert + changed the hint in ultra --- .../API/Features/KECustomRole.cs | 2 +- .../KE.CustomRoles/Abilities/Convert.cs | 2 +- KruacentExiled/KE.CustomRoles/CR/SCP/Ultra.cs | 34 ++++++-------- .../Core/Positions/UltraPosition.cs | 20 +++++++++ .../KE.CustomRoles/Settings/SettingHandler.cs | 44 +++++++------------ 5 files changed, 51 insertions(+), 51 deletions(-) create mode 100644 KruacentExiled/KE.CustomRoles/Core/Positions/UltraPosition.cs diff --git a/KruacentExiled/KE.CustomRoles/API/Features/KECustomRole.cs b/KruacentExiled/KE.CustomRoles/API/Features/KECustomRole.cs index 3b01fe79..7201a4f7 100644 --- a/KruacentExiled/KE.CustomRoles/API/Features/KECustomRole.cs +++ b/KruacentExiled/KE.CustomRoles/API/Features/KECustomRole.cs @@ -57,7 +57,7 @@ public override string Name /// /// the number of people who had this role in a round /// - public virtual int CurrentNumberOfSpawn { get; set; } = 1; + public int CurrentNumberOfSpawn { get; set; } = 0; /// /// diff --git a/KruacentExiled/KE.CustomRoles/Abilities/Convert.cs b/KruacentExiled/KE.CustomRoles/Abilities/Convert.cs index 1e584d94..0f7d4049 100644 --- a/KruacentExiled/KE.CustomRoles/Abilities/Convert.cs +++ b/KruacentExiled/KE.CustomRoles/Abilities/Convert.cs @@ -28,7 +28,7 @@ public class Convert : KEAbilities protected override bool AbilityUsed(Player player) { - if (!Physics.Raycast(player.Position, player.Rotation.eulerAngles, out RaycastHit hit)) return false; + if (!Physics.Raycast(player.Position+ player.CameraTransform.rotation *Vector3.forward, player.Rotation.eulerAngles, out RaycastHit hit)) return false; Player playerHit = Player.Get(hit.collider); diff --git a/KruacentExiled/KE.CustomRoles/CR/SCP/Ultra.cs b/KruacentExiled/KE.CustomRoles/CR/SCP/Ultra.cs index a59389de..36bbeb82 100644 --- a/KruacentExiled/KE.CustomRoles/CR/SCP/Ultra.cs +++ b/KruacentExiled/KE.CustomRoles/CR/SCP/Ultra.cs @@ -1,7 +1,11 @@ using Exiled.API.Enums; using Exiled.API.Features; using Exiled.API.Features.Attributes; +using HintServiceMeow.Core.Models.Arguments; using KE.CustomRoles.API.Features; +using KE.CustomRoles.Core.Positions; +using KE.Utils.API.Displays.DisplayMeow; +using KE.Utils.API.Displays.DisplayMeow.Placements; using MEC; using PlayerRoles; using System; @@ -22,33 +26,23 @@ public class Ultra : GlobalCustomRole public override float SpawnChance { get; set; } = 100; public const float RefreshRate = 20; public const int SizeText = 20; - protected override void RoleAdded(Player player) - { - _handles.Add(player, Timing.RunCoroutine(DisplayInfos(player))); - } - protected override void RoleRemoved(Player player) + public static readonly HintPosition UltraPosition = new UltraPosition(); + protected override void RoleAdded(Player player) { - Timing.KillCoroutines(_handles[player]); - _handles.Remove(player); + Timing.CallDelayed(1f, () => + { + DisplayHandler.Instance.CreateAuto(player, (AutoContentUpdateArg arg) => PlayerInZone(arg), UltraPosition.HintPlacement); + }); } - - - - private IEnumerator DisplayInfos(Player player) + private string PlayerInZone(AutoContentUpdateArg arg) { - while (player.IsAlive) + if (!TrackedPlayers.Contains(Player.Get(arg.PlayerDisplay.ReferenceHub))) { - Log.Debug("Ultra : showing"); - ShowEffectHint(player, PlayerInZone(),RefreshRate); - yield return Timing.WaitForSeconds(RefreshRate); + return string.Empty; } - } - - - private string PlayerInZone() - { + string result = $""; int nbPlayer; foreach (ZoneType zone in Enum.GetValues(typeof(ZoneType))) diff --git a/KruacentExiled/KE.CustomRoles/Core/Positions/UltraPosition.cs b/KruacentExiled/KE.CustomRoles/Core/Positions/UltraPosition.cs new file mode 100644 index 00000000..cd9dfd01 --- /dev/null +++ b/KruacentExiled/KE.CustomRoles/Core/Positions/UltraPosition.cs @@ -0,0 +1,20 @@ +using HintServiceMeow.Core.Enum; +using KE.Utils.API.Displays.DisplayMeow.Placements; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace KE.CustomRoles.Core.Positions +{ + public class UltraPosition : HintPosition + { + public override float Xposition => 740; + + public override float Yposition => 280; + public override string Name => "Ultra"; + + public override HintAlignment HintAlignment => HintAlignment.Right; + } +} diff --git a/KruacentExiled/KE.CustomRoles/Settings/SettingHandler.cs b/KruacentExiled/KE.CustomRoles/Settings/SettingHandler.cs index cbbeaea1..622d7e3b 100644 --- a/KruacentExiled/KE.CustomRoles/Settings/SettingHandler.cs +++ b/KruacentExiled/KE.CustomRoles/Settings/SettingHandler.cs @@ -59,50 +59,40 @@ public SettingHandler() new KeybindSetting(_idUp, "Select up", UnityEngine.KeyCode.None), new KeybindSetting(_idDown, "Select down", UnityEngine.KeyCode.None), new KeybindSetting(_idSelect, "Use selected ability", UnityEngine.KeyCode.None), + SettingBase.Create(new SSPlaintextSetting(_idArrow, "Personalize the arrow next to the selected ability", baseArrow, 16, TMP_InputField.ContentType.Standard, string.Empty, 0)) }; - List baseSettings = new(); - - foreach (SettingBase setting in settings) - { - baseSettings.Add(setting.Base); - } - baseSettings.Add(new SSPlaintextSetting(_idArrow, "Personalize the arrow next to the selected ability", baseArrow, 16, TMP_InputField.ContentType.Standard, string.Empty, 0)); - string[] options = ["left", "center", "right"]; - if (MainPlugin.Instance.Config.Debug) { - List hintscreator = new() + List hintscreator = new() { - new SSSliderSetting(_idTestHintsliderx,"x",-2000,2000), - new SSSliderSetting(_idTestHintslidery,"y",0,2000), - new SSSliderSetting(_idTestHintslidertime,"time",0,10), - new SSDropdownSetting(_idTestHintalign,"alignment",options), - new SSButton(_idTestHintspawn,"spawn","spawn"), - new SSPlaintextSetting(_idTestHinttext,"text") + new SliderSetting(_idTestHintsliderx,"x",-2000,2000,0), + new SliderSetting(_idTestHintslidery,"y",0,2000,0), + new SliderSetting(_idTestHintslidertime,"time",0,10,5), + new DropdownSetting(_idTestHintalign,"alignment",options), + new ButtonSetting(_idTestHintspawn,"spawn","spawn"), + SettingBase.Create(new SSPlaintextSetting(_idTestHinttext,"text")), }; - //hintpage = new("hint creator", hintscreator); - } - + settings.AddRange(hintscreator); + created = true; + } - //page = new("Custom roles", baseSettings); - ServerSpecificSettingsSync.DefinedSettings = new List(baseSettings).ToArray(); - ServerSpecificSettingsSync.SendToAll(); + SettingBase.Register(settings); } - + private bool created = false; float xvalue = 0; float yvalue = 0; float timevalue = 5; @@ -180,11 +170,6 @@ public void CreateHint(Player player, ServerSpecificSettingBase setting) public void SubscribeEvents() { - //Utils.API.Settings.SettingHandler.Instance.AddPages(page); - if(hintpage is not null) - { - Utils.API.Settings.SettingHandler.Instance.AddPages(hintpage); - } ServerSpecificSettingsSync.ServerOnSettingValueReceived += SafeOnSettingValueReceived; LabApi.Events.Handlers.PlayerEvents.Joined += AddPlayer; @@ -236,11 +221,12 @@ private void OnSettingValueReceived(Player player, ServerSpecificSettingBase set { KEAbilities.UseSelected(player); } - if(hintpage is not null) + if (created) { CreateHint(player, settingBase); } + } private Dictionary playerPos = new(); From 1450a6eb375632661ac4b3e2a0c8cf6a9dff08a4 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Sun, 30 Nov 2025 18:10:37 +0100 Subject: [PATCH 449/853] rollback settings --- .../KE.Items/API/Core/Settings/SettingsHandler.cs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/KruacentExiled/KE.Items/API/Core/Settings/SettingsHandler.cs b/KruacentExiled/KE.Items/API/Core/Settings/SettingsHandler.cs index 092a7817..aad2db59 100644 --- a/KruacentExiled/KE.Items/API/Core/Settings/SettingsHandler.cs +++ b/KruacentExiled/KE.Items/API/Core/Settings/SettingsHandler.cs @@ -33,6 +33,7 @@ public SettingsHandler() { _settings = [ + new HeaderSetting(_idHeader,"Custom Items",padding:true), new TwoButtonsSetting(_idDesc,"Descriptions","Disabled","Enabled",true,"hide/show the description of the item and its upgrade chances "), new TwoButtonsSetting(_idPrefix,"Pickup/Select prefixes","Disabled","Enabled",false,"show/hide the whole sentence for the picking or selecting of the item, if hidden it will show a (P) if pickup or a (I) if in inventory before the name of the item "), new SliderSetting(_idTimeCustomItem,"Time shown",0,30,10), @@ -48,7 +49,9 @@ public SettingsHandler() settings.Add(setting.Base); } - page = new("Custom Items", settings); + //page = new("Custom Items", settings); + + SettingBase.Register(settings: _settings); } @@ -56,7 +59,7 @@ public SettingsHandler() public void SubscribeEvents() { - Utils.API.Settings.SettingHandler.Instance.AddPages(page); + //Utils.API.Settings.SettingHandler.Instance.AddPages(page); } public void UnsubscribeEvents() From be49a426608006121ed1a31a8ce90b22f24affd2 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Sun, 30 Nov 2025 18:12:46 +0100 Subject: [PATCH 450/853] added the header --- KruacentExiled/KE.CustomRoles/Settings/SettingHandler.cs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/KruacentExiled/KE.CustomRoles/Settings/SettingHandler.cs b/KruacentExiled/KE.CustomRoles/Settings/SettingHandler.cs index 622d7e3b..8dabe66b 100644 --- a/KruacentExiled/KE.CustomRoles/Settings/SettingHandler.cs +++ b/KruacentExiled/KE.CustomRoles/Settings/SettingHandler.cs @@ -23,6 +23,7 @@ namespace KE.CustomRoles.Settings internal class SettingHandler : IUsingEvents { private readonly int _idHeader = 148; + private readonly int _idTimeCustomRole = 144; private readonly int _idDesc = 143; private readonly int _idMode = 145; @@ -37,6 +38,7 @@ internal class SettingHandler : IUsingEvents private int _idTestHintalign = 157; private int _idTestHintspawn = 158; private int _idTestHinttext = 159; + private readonly int _idHeaderTestHint = 160; @@ -53,6 +55,8 @@ public SettingHandler() Instance = this; settings = new List() { + new HeaderSetting(_idHeader,"Custom Roles",padding:true), + new TwoButtonsSetting(_idDesc,"Descriptions","Disabled","Enabled",true,"hide/show the description the Custom Role "), new SliderSetting(_idTimeCustomRole,"Time shown",0,30,20), new SliderSetting(_idTimeAbilityDesc,"Ability Description time shown",0,30,20), @@ -70,6 +74,7 @@ public SettingHandler() { List hintscreator = new() { + new HeaderSetting(_idHeaderTestHint,"Hint creator",padding:true), new SliderSetting(_idTestHintsliderx,"x",-2000,2000,0), new SliderSetting(_idTestHintslidery,"y",0,2000,0), new SliderSetting(_idTestHintslidertime,"time",0,10,5), From c0918d4da9c29be47a4247a856e6cb9475d2a740 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Sun, 30 Nov 2025 18:57:52 +0100 Subject: [PATCH 451/853] showing the vote on the lobby --- KruacentExiled/KE.Misc/Features/VoteStart.cs | 59 -------- .../Features/VoteStart/VotePosition.cs | 20 +++ .../KE.Misc/Features/VoteStart/VoteStart.cs | 131 ++++++++++++++++++ KruacentExiled/KE.Misc/KE.Misc.csproj | 3 +- KruacentExiled/KE.Misc/MainPlugin.cs | 1 + 5 files changed, 154 insertions(+), 60 deletions(-) delete mode 100644 KruacentExiled/KE.Misc/Features/VoteStart.cs create mode 100644 KruacentExiled/KE.Misc/Features/VoteStart/VotePosition.cs create mode 100644 KruacentExiled/KE.Misc/Features/VoteStart/VoteStart.cs diff --git a/KruacentExiled/KE.Misc/Features/VoteStart.cs b/KruacentExiled/KE.Misc/Features/VoteStart.cs deleted file mode 100644 index dbfe8491..00000000 --- a/KruacentExiled/KE.Misc/Features/VoteStart.cs +++ /dev/null @@ -1,59 +0,0 @@ -using Exiled.API.Features; -using Exiled.Events.EventArgs.Player; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace KE.Misc.Features -{ - internal class VoteStart : MiscFeature - { - - public int minvote = 9999; - - - public HashSet Voted = new(); - private bool voteCasted = false; - - public override void SubscribeEvents() - { - Exiled.Events.Handlers.Server.WaitingForPlayers += OnWaitingForPlayers; - Exiled.Events.Handlers.Player.VoiceChatting += OnVoiceChatting; - - minvote = MainPlugin.Instance.Config.MinPlayerVote; - - base.SubscribeEvents(); - } - - - public override void UnsubscribeEvents() - { - Exiled.Events.Handlers.Server.WaitingForPlayers -= OnWaitingForPlayers; - Exiled.Events.Handlers.Player.VoiceChatting -= OnVoiceChatting; - base.UnsubscribeEvents(); - } - - - - private void OnVoiceChatting(VoiceChattingEventArgs ev) - { - if (!Round.IsLobby) return; - if (voteCasted) return; - - Voted.Add(ev.Player); - if (Voted.Count >= minvote) - { - Round.IsLobbyLocked = false; - voteCasted = true; - } - } - private void OnWaitingForPlayers() - { - Round.IsLobbyLocked = true; - } - - - } -} diff --git a/KruacentExiled/KE.Misc/Features/VoteStart/VotePosition.cs b/KruacentExiled/KE.Misc/Features/VoteStart/VotePosition.cs new file mode 100644 index 00000000..b1dfd221 --- /dev/null +++ b/KruacentExiled/KE.Misc/Features/VoteStart/VotePosition.cs @@ -0,0 +1,20 @@ +using HintServiceMeow.Core.Enum; +using KE.Utils.API.Displays.DisplayMeow.Placements; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace KE.Misc.Features.VoteStart +{ + public class VotePosition : HintPosition + { + public override float Xposition => 0; + + public override float Yposition => 900; + public override string Name => "VoteStart"; + + public override HintAlignment HintAlignment => HintAlignment.Center; + } +} diff --git a/KruacentExiled/KE.Misc/Features/VoteStart/VoteStart.cs b/KruacentExiled/KE.Misc/Features/VoteStart/VoteStart.cs new file mode 100644 index 00000000..e5ca874d --- /dev/null +++ b/KruacentExiled/KE.Misc/Features/VoteStart/VoteStart.cs @@ -0,0 +1,131 @@ +using Exiled.API.Features; +using Exiled.API.Features.Pools; +using Exiled.Events.EventArgs.Player; +using HintServiceMeow.Core.Models.Hints; +using HintServiceMeow.Core.Utilities; +using KE.Utils.API.Displays.DisplayMeow; +using KE.Utils.API.Displays.DisplayMeow.Placements; +using MEC; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace KE.Misc.Features.VoteStart +{ + internal class VoteStart : MiscFeature + { + + public int minvote = 9999; + public static HintPosition HintPosition = new VotePosition(); + + public HashSet Voted = new(); + private bool voteCasted = false; + private StringBuilder sb = null; + public override void SubscribeEvents() + { + sb = StringBuilderPool.Pool.Get(); + Exiled.Events.Handlers.Server.WaitingForPlayers += OnWaitingForPlayers; + Exiled.Events.Handlers.Player.VoiceChatting += OnVoiceChatting; + Exiled.Events.Handlers.Player.Joined += OnJoined; + Exiled.Events.Handlers.Server.RoundStarted += OnRoundStarted; + + minvote = MainPlugin.Instance.Config.MinPlayerVote; + + base.SubscribeEvents(); + } + + + public override void UnsubscribeEvents() + { + Exiled.Events.Handlers.Server.WaitingForPlayers -= OnWaitingForPlayers; + Exiled.Events.Handlers.Player.VoiceChatting -= OnVoiceChatting; + Exiled.Events.Handlers.Player.Joined -= OnJoined; + Exiled.Events.Handlers.Server.RoundStarted -= OnRoundStarted; + + if(sb is not null) + { + StringBuilderPool.Pool.Return(sb); + sb = null; + } + + base.UnsubscribeEvents(); + } + + + + private void OnVoiceChatting(VoiceChattingEventArgs ev) + { + if (!Round.IsLobby) return; + if (voteCasted) return; + + Voted.Add(ev.Player); + if (Voted.Count >= minvote) + { + Round.IsLobbyLocked = false; + voteCasted = true; + } + } + private void OnWaitingForPlayers() + { + Round.IsLobbyLocked = true; + } + + private void OnJoined(JoinedEventArgs ev) + { + Player player = ev.Player; + + Timing.CallDelayed(.5f, () => + { + if (player is not null && Round.IsLobby) + { + PlayerDisplay dis = PlayerDisplay.Get(player); + DisplayHandler.Instance.CreateAuto(player, (args) => GetPlayers(), HintPosition.HintPlacement); + } + }); + + } + + private string GetPlayers() + { + if (!Round.IsLobby) return string.Empty; + sb.Clear(); + + sb.Append("Players who voted ("); + + sb.Append(Voted.Count); + sb.Append("/"); + sb.Append(minvote); + + sb.AppendLine(") : "); + foreach(Player player in Voted) + { + sb.Append(player.Nickname); + sb.Append(" "); + } + + return sb.ToString(); + + } + private void OnRoundStarted() + { + foreach(Player player in Player.List) + { + AbstractHint hint = DisplayHandler.Instance.GetHint(player, HintPosition.HintPlacement); + if (hint is not null) + { + hint.Hide = true; + } + } + + if (sb is not null) + { + StringBuilderPool.Pool.Return(sb); + sb = null; + } + } + + + } +} diff --git a/KruacentExiled/KE.Misc/KE.Misc.csproj b/KruacentExiled/KE.Misc/KE.Misc.csproj index 5e052dc5..32174097 100644 --- a/KruacentExiled/KE.Misc/KE.Misc.csproj +++ b/KruacentExiled/KE.Misc/KE.Misc.csproj @@ -6,7 +6,7 @@ - + @@ -16,6 +16,7 @@ + diff --git a/KruacentExiled/KE.Misc/MainPlugin.cs b/KruacentExiled/KE.Misc/MainPlugin.cs index e8bd26ea..28e29672 100644 --- a/KruacentExiled/KE.Misc/MainPlugin.cs +++ b/KruacentExiled/KE.Misc/MainPlugin.cs @@ -17,6 +17,7 @@ using HarmonyLib; using Exiled.Events.EventArgs.Cassie; using LabApi.Events.Arguments.ServerEvents; +using KE.Misc.Features.VoteStart; namespace KE.Misc { From 1ce95fd6c4caf724cfcbfd6f532e0e8bec0a6604 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Sun, 30 Nov 2025 20:38:40 +0100 Subject: [PATCH 452/853] fixed vote start inter-round --- KruacentExiled/KE.Misc/Features/CR/Scp035.cs | 96 ------------------- .../KE.Misc/Features/VoteStart/VoteStart.cs | 30 +++--- 2 files changed, 14 insertions(+), 112 deletions(-) delete mode 100644 KruacentExiled/KE.Misc/Features/CR/Scp035.cs diff --git a/KruacentExiled/KE.Misc/Features/CR/Scp035.cs b/KruacentExiled/KE.Misc/Features/CR/Scp035.cs deleted file mode 100644 index 31220db8..00000000 --- a/KruacentExiled/KE.Misc/Features/CR/Scp035.cs +++ /dev/null @@ -1,96 +0,0 @@ -using Exiled.API.Features; -using Exiled.API.Features.Attributes; -using Exiled.API.Features.Spawn; -using Exiled.CustomRoles.API.Features; -using Exiled.Events.EventArgs.Interfaces; -using Exiled.Events.EventArgs.Player; -using PlayerRoles; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace KE.Misc.Features.CR -{ - [CustomRole(RoleTypeId.Tutorial)] - public class Scp035 : CustomRole - { - internal static HashSet _trackedPlayers = new (); - public override uint Id { get; set; } = 10; - public override string Description { get; set; } = "t'es un humain dans la team des scp en gros "; - public override RoleTypeId Role { get; set; } = RoleTypeId.Tutorial; - public override int MaxHealth { get; set; } = 600; - public override string Name { get; set; } = "SCP-035"; - public override string CustomInfo { get; set; } = "SCP-035"; - public override bool IgnoreSpawnSystem { get; set; } = true; - public override SpawnProperties SpawnProperties { get; set; } = new() - { - DynamicSpawnPoints = new() - { - new() - { - Location = Exiled.API.Enums.SpawnLocationType.Inside096 - } - } - }; - protected override void RoleAdded(Player player) - { - _trackedPlayers.Add(player); - } - - protected override void RoleRemoved(Player player) - { - _trackedPlayers.Remove(player); - } - - protected override void SubscribeEvents() - { - Exiled.Events.Handlers.Player.EnteringPocketDimension += OnEnteringPocketDimension; - Exiled.Events.Handlers.Player.Hurting += OnHurting; - Exiled.Events.Handlers.Player.Shot += OnShot; - Exiled.Events.Handlers.Player.ActivatingGenerator += OnActivatingGenerator; - Exiled.Events.Handlers.Player.VoiceChatting += OnVoiceChatting; - } - - protected override void UnsubscribeEvents() - { - Exiled.Events.Handlers.Player.EnteringPocketDimension -= OnEnteringPocketDimension; - Exiled.Events.Handlers.Player.Hurting -= OnHurting; - Exiled.Events.Handlers.Player.Shot -= OnShot; - Exiled.Events.Handlers.Player.VoiceChatting -= OnVoiceChatting; - Exiled.Events.Handlers.Player.ActivatingGenerator -= OnActivatingGenerator; - } - - private void OnVoiceChatting(VoiceChattingEventArgs ev) - { - if (!Check(ev.Player)) return; - ev.VoiceModule.CurrentChannel = VoiceChat.VoiceChatChannel.ScpChat; - } - - private void OnEnteringPocketDimension(EnteringPocketDimensionEventArgs ev) - { - if (Check(ev.Player)) - ev.IsAllowed = false; - } - - private void OnHurting(HurtingEventArgs ev) - { - if (ev.Attacker is null) return; - if ((Check(ev.Player) || Check(ev.Attacker)) && (ev.Player.IsScp || ev.Attacker.IsScp)) - ev.IsAllowed = false; - } - - private void OnShot(ShotEventArgs ev) - { - if (ev.Target != null && ev.Target.IsScp && Check(ev.Player)) - ev.CanHurt = false; - } - - private void OnActivatingGenerator(ActivatingGeneratorEventArgs ev) - { - if (Check(ev.Player)) - ev.IsAllowed = false; - } - } -} diff --git a/KruacentExiled/KE.Misc/Features/VoteStart/VoteStart.cs b/KruacentExiled/KE.Misc/Features/VoteStart/VoteStart.cs index e5ca874d..c96161c6 100644 --- a/KruacentExiled/KE.Misc/Features/VoteStart/VoteStart.cs +++ b/KruacentExiled/KE.Misc/Features/VoteStart/VoteStart.cs @@ -22,16 +22,14 @@ internal class VoteStart : MiscFeature public HashSet Voted = new(); private bool voteCasted = false; - private StringBuilder sb = null; public override void SubscribeEvents() { - sb = StringBuilderPool.Pool.Get(); Exiled.Events.Handlers.Server.WaitingForPlayers += OnWaitingForPlayers; Exiled.Events.Handlers.Player.VoiceChatting += OnVoiceChatting; Exiled.Events.Handlers.Player.Joined += OnJoined; Exiled.Events.Handlers.Server.RoundStarted += OnRoundStarted; - minvote = MainPlugin.Instance.Config.MinPlayerVote; + Init(); base.SubscribeEvents(); } @@ -44,12 +42,6 @@ public override void UnsubscribeEvents() Exiled.Events.Handlers.Player.Joined -= OnJoined; Exiled.Events.Handlers.Server.RoundStarted -= OnRoundStarted; - if(sb is not null) - { - StringBuilderPool.Pool.Return(sb); - sb = null; - } - base.UnsubscribeEvents(); } @@ -63,20 +55,29 @@ private void OnVoiceChatting(VoiceChattingEventArgs ev) Voted.Add(ev.Player); if (Voted.Count >= minvote) { + Log.Info("starting the round"); Round.IsLobbyLocked = false; voteCasted = true; } } private void OnWaitingForPlayers() { + Init(); Round.IsLobbyLocked = true; } + private void Init() + { + Voted.Clear(); + voteCasted = false; + minvote = MainPlugin.Instance.Config.MinPlayerVote; + } + private void OnJoined(JoinedEventArgs ev) { Player player = ev.Player; - Timing.CallDelayed(.5f, () => + Timing.CallDelayed(1f, () => { if (player is not null && Round.IsLobby) { @@ -90,6 +91,8 @@ private void OnJoined(JoinedEventArgs ev) private string GetPlayers() { if (!Round.IsLobby) return string.Empty; + + StringBuilder sb = StringBuilderPool.Pool.Get(); sb.Clear(); sb.Append("Players who voted ("); @@ -105,7 +108,7 @@ private string GetPlayers() sb.Append(" "); } - return sb.ToString(); + return StringBuilderPool.Pool.ToStringReturn(sb); } private void OnRoundStarted() @@ -119,11 +122,6 @@ private void OnRoundStarted() } } - if (sb is not null) - { - StringBuilderPool.Pool.Return(sb); - sb = null; - } } From e77731fbc769208aeaf1287f383316641a3fbdcb Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Sun, 30 Nov 2025 20:40:47 +0100 Subject: [PATCH 453/853] removed 035 --- KruacentExiled/KE.Misc/Features/Spawn.cs | 16 +++++----------- KruacentExiled/KE.Misc/MainPlugin.cs | 10 ---------- 2 files changed, 5 insertions(+), 21 deletions(-) diff --git a/KruacentExiled/KE.Misc/Features/Spawn.cs b/KruacentExiled/KE.Misc/Features/Spawn.cs index 7ce87a04..0c6bf9ac 100644 --- a/KruacentExiled/KE.Misc/Features/Spawn.cs +++ b/KruacentExiled/KE.Misc/Features/Spawn.cs @@ -1,13 +1,7 @@ using Exiled.API.Enums; -using Exiled.API.Extensions; using Exiled.API.Features; -using Exiled.CustomItems.API.Features; -using Exiled.CustomRoles.API.Features; using Exiled.Events.EventArgs.Server; using KE.CustomRoles.API.Features; -using KE.Misc.Features.CR; -using KE.Utils.API.Interfaces; -using MEC; using PlayerRoles; using System; using System.Collections.Generic; @@ -177,12 +171,12 @@ public override void UnsubscribeEvents() public void EndingRound(EndingRoundEventArgs ev) { - if (Scp035._trackedPlayers.Count <= 0) return; + //if (Scp035._trackedPlayers.Count <= 0) return; - if (ev.ClassList.mtf_and_guards != 0 || ev.ClassList.scientists != 0) ev.IsAllowed = false; - else if (ev.ClassList.class_ds != 0 || ev.ClassList.chaos_insurgents != 0) ev.IsAllowed = false; - else if (ev.ClassList.scps_except_zombies + ev.ClassList.zombies > 0) ev.IsAllowed = true; - else ev.IsAllowed = true; + //if (ev.ClassList.mtf_and_guards != 0 || ev.ClassList.scientists != 0) ev.IsAllowed = false; + //else if (ev.ClassList.class_ds != 0 || ev.ClassList.chaos_insurgents != 0) ev.IsAllowed = false; + //else if (ev.ClassList.scps_except_zombies + ev.ClassList.zombies > 0) ev.IsAllowed = true; + //else ev.IsAllowed = true; } } diff --git a/KruacentExiled/KE.Misc/MainPlugin.cs b/KruacentExiled/KE.Misc/MainPlugin.cs index 28e29672..e9aaada3 100644 --- a/KruacentExiled/KE.Misc/MainPlugin.cs +++ b/KruacentExiled/KE.Misc/MainPlugin.cs @@ -1,21 +1,13 @@ using Exiled.API.Enums; using Exiled.API.Features; -using System.Collections.Generic; using ServerHandle = Exiled.Events.Handlers.Server; -using MEC; -using Exiled.API.Features.Doors; -using System.Linq; using PlayerRoles; -using Exiled.Events.EventArgs.Player; using System; using KE.Misc.Features; using KE.Misc.Handlers; using Exiled.CustomRoles.API.Features; -using KE.Misc.Features.CR; -using LightContainmentZoneDecontamination; using KE.Misc.Features.GamblingCoin; using HarmonyLib; -using Exiled.Events.EventArgs.Cassie; using LabApi.Events.Arguments.ServerEvents; using KE.Misc.Features.VoteStart; @@ -83,7 +75,6 @@ public override void OnEnabled() Exiled.Events.Handlers.Server.RoundStarted += AutoNukeAnnoucement.OnRoundStarted; ServerHandle.RoundStarted += ServerHandler.OnRoundStarted; LabApi.Events.Handlers.ServerEvents.CassieQueuingScpTermination += NoeDeath; - CustomRole.RegisterRoles(false, null, true, this.Assembly); } @@ -103,7 +94,6 @@ public override void OnDisabled() ClassDDoor.UnsubscribeEvents(); harmony.UnpatchAll(harmony.Id); - CustomRole.UnregisterRoles([typeof(Scp035)]); _914 = null; Candy = null; From e7bc1bd7f9d5ad33a16ceb3a39578c1175a95b08 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Sun, 30 Nov 2025 21:07:26 +0100 Subject: [PATCH 454/853] useless error --- KruacentExiled/KE.Misc/Features/Spawn.cs | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/KruacentExiled/KE.Misc/Features/Spawn.cs b/KruacentExiled/KE.Misc/Features/Spawn.cs index 0c6bf9ac..1f4a4b2f 100644 --- a/KruacentExiled/KE.Misc/Features/Spawn.cs +++ b/KruacentExiled/KE.Misc/Features/Spawn.cs @@ -2,6 +2,7 @@ using Exiled.API.Features; using Exiled.Events.EventArgs.Server; using KE.CustomRoles.API.Features; +using MEC; using PlayerRoles; using System; using System.Collections.Generic; @@ -58,8 +59,11 @@ private void SetScpPreferences(Player player) string roleScp = ChooseRandomRole(chancescp); Log.Debug($"Scp ({player.Nickname}) is {roleScp} previous : {player.Role.Type}"); - - SetRoleWithId(player, roleScp); + Timing.CallDelayed(1f, delegate + { + SetRoleWithId(player, roleScp); + }); + /* if (config.Scp035Enabled && roleScp == RoleTypeId.Scp079) { @@ -140,18 +144,20 @@ private void SetRoleWithId(Player player, string name) if (baseRole.ContainsKey(name)) { - player.Role.Set(baseRole[name], SpawnReason.RoundStart); + player.Role.Set(baseRole[name]); + Log.Info("vanilla scp"); } else { if (SelectableCustomSCPs.ContainsKey(name)) { SelectableCustomSCPs[name].AddRole(player); + Log.Info("custom scp"); + return; } } - Log.Error("scp not found"); } From 67e62749e5846fe9c70a8fc9915ec0fd0605fe17 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Sun, 30 Nov 2025 21:08:16 +0100 Subject: [PATCH 455/853] removed auto spawn custom scp --- KruacentExiled/KE.CustomRoles/API/Features/CustomSCP.cs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/KruacentExiled/KE.CustomRoles/API/Features/CustomSCP.cs b/KruacentExiled/KE.CustomRoles/API/Features/CustomSCP.cs index c85a80a2..d3f4a5b9 100644 --- a/KruacentExiled/KE.CustomRoles/API/Features/CustomSCP.cs +++ b/KruacentExiled/KE.CustomRoles/API/Features/CustomSCP.cs @@ -57,5 +57,10 @@ public int GetPreferences(Player player) return (int) setting.SliderValue; } + public override bool IsAvailable(Player player) + { + return false; + } + } } From efa2daaca6ca0b2ba73c4671c274a94405f69901 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Wed, 3 Dec 2025 00:27:36 +0100 Subject: [PATCH 456/853] removed 106 customrole (temp fix) --- KruacentExiled/KE.CustomRoles/API/Features/GlobalCustomRole.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/KruacentExiled/KE.CustomRoles/API/Features/GlobalCustomRole.cs b/KruacentExiled/KE.CustomRoles/API/Features/GlobalCustomRole.cs index fbd15336..38439e50 100644 --- a/KruacentExiled/KE.CustomRoles/API/Features/GlobalCustomRole.cs +++ b/KruacentExiled/KE.CustomRoles/API/Features/GlobalCustomRole.cs @@ -106,6 +106,7 @@ protected override void ShowMessage(Player player) public override bool IsAvailable(Player player) { + if (player.Role == RoleTypeId.Scp106) return false; if (CurrentNumberOfSpawn >= Limit) return false; return SideClass.Get(player.Role.Side) == Side; } From 7da3f09e0916f04ebdd2bb7edfa14845f56e2eab Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Wed, 3 Dec 2025 00:49:26 +0100 Subject: [PATCH 457/853] changed useless stuff --- .../KE.Map/Heavy/GamblingZone/GamblingRoom.cs | 9 ----- .../KE.Map/Heavy/GamblingZone/LootTable.cs | 6 ++-- KruacentExiled/KE.Map/MainPlugin.cs | 35 ++++++------------- 3 files changed, 13 insertions(+), 37 deletions(-) diff --git a/KruacentExiled/KE.Map/Heavy/GamblingZone/GamblingRoom.cs b/KruacentExiled/KE.Map/Heavy/GamblingZone/GamblingRoom.cs index d36d3b36..3443de53 100644 --- a/KruacentExiled/KE.Map/Heavy/GamblingZone/GamblingRoom.cs +++ b/KruacentExiled/KE.Map/Heavy/GamblingZone/GamblingRoom.cs @@ -42,16 +42,7 @@ public float PickupTime private Vector3 _position; private LootTable _lootTable; - internal GamblingRoom(Room room, LootTable lootTable, Vector3? offset = null) - { - Init(room.Position, lootTable, offset); - } - - internal GamblingRoom(Door door, LootTable lootTable, Vector3? offset = null) - { - Init(door.Position, lootTable, offset); - } internal GamblingRoom(Vector3 position, LootTable lootTable, Vector3? offset = null) { diff --git a/KruacentExiled/KE.Map/Heavy/GamblingZone/LootTable.cs b/KruacentExiled/KE.Map/Heavy/GamblingZone/LootTable.cs index eda7ae2d..bf30b215 100644 --- a/KruacentExiled/KE.Map/Heavy/GamblingZone/LootTable.cs +++ b/KruacentExiled/KE.Map/Heavy/GamblingZone/LootTable.cs @@ -79,10 +79,8 @@ public override string ToString() foreach (DroppableItem item in Items) { builder.AppendLine(item.ToString()); - } - string result = builder.ToString(); - StringBuilderPool.Pool.Return(builder); - return result; + } + return StringBuilderPool.Pool.ToStringReturn(builder); } } } diff --git a/KruacentExiled/KE.Map/MainPlugin.cs b/KruacentExiled/KE.Map/MainPlugin.cs index a15b7dab..09afc31f 100644 --- a/KruacentExiled/KE.Map/MainPlugin.cs +++ b/KruacentExiled/KE.Map/MainPlugin.cs @@ -1,35 +1,22 @@  using Exiled.API.Extensions; using Exiled.API.Features; -using Exiled.API.Features.Doors; -using Exiled.API.Features.Toys; using Exiled.API.Interfaces; using Exiled.Events.EventArgs.Player; -using Exiled.Events.EventArgs.Server; -using Exiled.Events.Handlers; using HarmonyLib; -using Interactables.Interobjects.DoorUtils; using KE.Map.CustomZones; using KE.Map.CustomZones.CustomRooms.MCZ; -using KE.Map.Entrance; using KE.Map.Heavy.GamblingZone; using KE.Map.Others.BlackoutNDoor.Handlers; -using KE.Map.Utils; -using KE.Utils.API.Models; using LabApi.Events.Arguments.ServerEvents; -using LabApi.Features.Wrappers; using MapGeneration; -using Mirror; using PlayerRoles; -using PlayerRoles.PlayableScps.Scp106; -using ProjectMER.Features.Serializable.Lockers; using System; using System.Collections.Generic; using System.Linq; using UnityEngine; using Door = Exiled.API.Features.Doors.Door; using Player = Exiled.API.Features.Player; -using Room = Exiled.API.Features.Room; namespace KE.Map { @@ -153,16 +140,18 @@ private void OnGenerated() HashSet normal = new() { new(ItemType.KeycardO5,1,2), - new(ItemType.SCP500,1), - new(ItemType.KeycardMTFCaptain,1), + new(ItemType.Jailbird,1,1), + new(ItemType.ParticleDisruptor,1,1), new(ItemType.SCP268,1,1), - new(ItemType.GunCOM15,1), - new(ItemType.SCP207,1), - new(ItemType.Adrenaline,1), - new(ItemType.GunCOM18,1), - new(ItemType.KeycardFacilityManager,1), - new(ItemType.Medkit,1), - new(ItemType.KeycardMTFOperative,1), + ItemType.SCP500, + ItemType.KeycardMTFCaptain, + ItemType.GunCOM15, + ItemType.SCP207, + ItemType.Adrenaline, + ItemType.GunCOM18, + ItemType.KeycardFacilityManager, + ItemType.Medkit, + ItemType.KeycardMTFOperative, ItemType.KeycardGuard, ItemType.Radio, ItemType.Ammo9x19, @@ -174,10 +163,8 @@ private void OnGenerated() ItemType.KeycardScientist, ItemType.KeycardJanitor, ItemType.Coin, - new(ItemType.Jailbird,1,1), ItemType.Flashlight, ItemType.AntiSCP207, - new(ItemType.ParticleDisruptor,1,1), ItemType.GunCom45, ItemType.GunShotgun, ItemType.GunRevolver, From 780b5eb1c460bca39a0e3465556ccf5f66d84d94 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Wed, 3 Dec 2025 18:47:33 +0100 Subject: [PATCH 458/853] 035 --- .../KE.CustomRoles/API/Features/CustomSCP.cs | 8 +- .../KE.CustomRoles/CR/SCP/SCP035.cs | 130 ++++++++++++++++++ .../KE.CustomRoles/CR/SCP/SCP457.cs | 5 +- 3 files changed, 136 insertions(+), 7 deletions(-) create mode 100644 KruacentExiled/KE.CustomRoles/CR/SCP/SCP035.cs diff --git a/KruacentExiled/KE.CustomRoles/API/Features/CustomSCP.cs b/KruacentExiled/KE.CustomRoles/API/Features/CustomSCP.cs index d3f4a5b9..429c5d58 100644 --- a/KruacentExiled/KE.CustomRoles/API/Features/CustomSCP.cs +++ b/KruacentExiled/KE.CustomRoles/API/Features/CustomSCP.cs @@ -22,8 +22,7 @@ public abstract class CustomSCP : KECustomRole private SliderSetting sliderSetting; public abstract bool IsSupport { get; } - private new RecyclableSettingId Id; - public int SettingId => Id.Value; + protected abstract int SettingId { get; } private static HeaderSetting header = null; private static int HeaderId => MainPlugin.Instance.Config.HeaderId; public static IEnumerable All => Registered.Where(c => c is CustomSCP).Cast(); @@ -34,10 +33,10 @@ public override void Init() if (header is null) { header = new(HeaderId, "SCP Spawn Preferences",string.Empty,true); + SettingBase.Register([header]); } - Id = new RecyclableSettingId(); - sliderSetting= new SliderSetting(SettingId, PublicName, MinValue, MaxValue, DefaultValue, true, header:header); + sliderSetting= new SliderSetting(SettingId, PublicName, MinValue, MaxValue, DefaultValue, true); SettingBase.Register([sliderSetting]); base.Init(); } @@ -46,7 +45,6 @@ public override void Init() public override void Destroy() { SettingBase.Unregister(); - Id.Destroy(); base.Destroy(); } diff --git a/KruacentExiled/KE.CustomRoles/CR/SCP/SCP035.cs b/KruacentExiled/KE.CustomRoles/CR/SCP/SCP035.cs new file mode 100644 index 00000000..b472fd6d --- /dev/null +++ b/KruacentExiled/KE.CustomRoles/CR/SCP/SCP035.cs @@ -0,0 +1,130 @@ +using Exiled.API.Enums; +using Exiled.API.Features; +using Exiled.Events.EventArgs.Player; +using Exiled.Events.EventArgs.Scp1509; +using Exiled.Events.EventArgs.Server; +using KE.CustomRoles.API.Features; +using PlayerRoles; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using UnityEngine; + +namespace KE.CustomRoles.CR.SCP +{ + public class SCP035 : CustomSCP + { + public override bool IsSupport => false; + + public override string PublicName { get; set; } = "SCP-035"; + public override int MaxHealth { get; set; } = 800; + public override string Description { get; set; } = "KILL EVERYONE"; + protected override int SettingId => 10002; + + public override RoleTypeId Role { get; set; } = RoleTypeId.Tutorial; + + // 035 can't pickup these items + public HashSet BlacklistedPickup = new() + { + ItemType.Jailbird, + ItemType.ParticleDisruptor, + ItemType.MicroHID, + }; + // 035 can't be damaged by these + public HashSet BlacklistedDamage = new() + { + DamageType.Jailbird, + DamageType.ParticleDisruptor, + DamageType.MicroHid + }; + + protected override void SubscribeEvents() + { + Exiled.Events.Handlers.Player.Hurting += OnHurting; + Exiled.Events.Handlers.Player.SearchingPickup += OnSearchingPickup; + Exiled.Events.Handlers.Server.EndingRound += OnEndingRound; + Exiled.Events.Handlers.Scp1509.Resurrecting += OnResurrecting; + + base.SubscribeEvents(); + } + + protected override void UnsubscribeEvents() + { + Exiled.Events.Handlers.Player.Hurting -= OnHurting; + Exiled.Events.Handlers.Player.SearchingPickup -= OnSearchingPickup; + Exiled.Events.Handlers.Server.EndingRound -= OnEndingRound; + Exiled.Events.Handlers.Scp1509.Resurrecting += OnResurrecting; + base.UnsubscribeEvents(); + } + + protected override void RoleAdded(Player player) + { + + player.VoiceChannel = VoiceChat.VoiceChatChannel.ScpChat; + base.RoleAdded(player); + } + + private void OnSearchingPickup(SearchingPickupEventArgs ev) + { + if (BlacklistedPickup.Contains(ev.Pickup.Type)) + { + ShowEffectHint(ev.Player, "This item can't be picked up"); + ev.IsAllowed = false; + return; + } + } + + private void OnHurting(HurtingEventArgs ev) + { + if (Check(ev.Player)) + { + if (BlacklistedDamage.Contains(ev.DamageHandler.Type)) + { + if (ev.IsAllowed) + { + ev.DamageHandler.Damage /= 2; + } + + return; + } + + if (ev.Attacker is not null && ev.Attacker.Role.Side == Side.Scp) + { + ev.IsAllowed = false; + return; + } + } + + if (Check(ev.Attacker)) + { + if (ev.Player.Role.Side == Side.Scp) + { + ev.IsAllowed = Server.FriendlyFire || ev.Attacker.IsFriendlyFireEnabled; + return; + } + } + + + + } + + private void OnResurrecting(ResurrectingEventArgs ev) + { + if (!Check(ev.Player)) return; + + ev.NewRole = RoleTypeId.Scp0492; + } + + public void OnEndingRound(EndingRoundEventArgs ev) + { + if (TrackedPlayers.Count <= 0) return; + + if (ev.ClassList.mtf_and_guards != 0 || ev.ClassList.scientists != 0) ev.IsAllowed = false; + else if (ev.ClassList.class_ds != 0 || ev.ClassList.chaos_insurgents != 0) ev.IsAllowed = false; + else if (ev.ClassList.scps_except_zombies + ev.ClassList.zombies > 0) ev.IsAllowed = true; + else ev.IsAllowed = true; + } + } +} diff --git a/KruacentExiled/KE.CustomRoles/CR/SCP/SCP457.cs b/KruacentExiled/KE.CustomRoles/CR/SCP/SCP457.cs index 77feffdf..40181c0b 100644 --- a/KruacentExiled/KE.CustomRoles/CR/SCP/SCP457.cs +++ b/KruacentExiled/KE.CustomRoles/CR/SCP/SCP457.cs @@ -1,4 +1,4 @@ -using Exiled.API.Features; +/*using Exiled.API.Features; using Exiled.API.Features.Attributes; using Exiled.API.Features.Doors; using Exiled.API.Features.Roles; @@ -48,6 +48,7 @@ public class SCP457 : CustomSCP "BlindingFlash" ]; + protected override int SettingId => 10001; protected override void RoleAdded(Player player) { @@ -178,4 +179,4 @@ private void OnAttacking(AttackingEventArgs ev) } -} +}*/ From 97478a2dd96e4aa5799880caea6ffba05cf083f5 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Thu, 11 Dec 2025 12:11:08 +0100 Subject: [PATCH 459/853] changed desc --- KruacentExiled/KE.CustomRoles/CR/SCP/SCP035.cs | 8 ++++++-- KruacentExiled/KE.CustomRoles/CR/SCP/SCP457.cs | 9 +++++++-- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/KruacentExiled/KE.CustomRoles/CR/SCP/SCP035.cs b/KruacentExiled/KE.CustomRoles/CR/SCP/SCP035.cs index b472fd6d..1b784092 100644 --- a/KruacentExiled/KE.CustomRoles/CR/SCP/SCP035.cs +++ b/KruacentExiled/KE.CustomRoles/CR/SCP/SCP035.cs @@ -1,4 +1,5 @@ using Exiled.API.Enums; +using Exiled.API.Extensions; using Exiled.API.Features; using Exiled.Events.EventArgs.Player; using Exiled.Events.EventArgs.Scp1509; @@ -20,7 +21,7 @@ public class SCP035 : CustomSCP public override string PublicName { get; set; } = "SCP-035"; public override int MaxHealth { get; set; } = 800; - public override string Description { get; set; } = "KILL EVERYONE"; + public override string Description { get; set; } = "You can't pickup the Micro-HID and anything made with it, but you take 2 time less damage by these weapon"; protected override int SettingId => 10002; public override RoleTypeId Role { get; set; } = RoleTypeId.Tutorial; @@ -55,7 +56,7 @@ protected override void UnsubscribeEvents() Exiled.Events.Handlers.Player.Hurting -= OnHurting; Exiled.Events.Handlers.Player.SearchingPickup -= OnSearchingPickup; Exiled.Events.Handlers.Server.EndingRound -= OnEndingRound; - Exiled.Events.Handlers.Scp1509.Resurrecting += OnResurrecting; + Exiled.Events.Handlers.Scp1509.Resurrecting -= OnResurrecting; base.UnsubscribeEvents(); } @@ -63,11 +64,14 @@ protected override void RoleAdded(Player player) { player.VoiceChannel = VoiceChat.VoiceChatChannel.ScpChat; + player.Position = RoleTypeId.Scp049.GetRandomSpawnLocation().Position; base.RoleAdded(player); } private void OnSearchingPickup(SearchingPickupEventArgs ev) { + if (!Check(ev.Player)) return; + if (BlacklistedPickup.Contains(ev.Pickup.Type)) { ShowEffectHint(ev.Player, "This item can't be picked up"); diff --git a/KruacentExiled/KE.CustomRoles/CR/SCP/SCP457.cs b/KruacentExiled/KE.CustomRoles/CR/SCP/SCP457.cs index 40181c0b..38993cdf 100644 --- a/KruacentExiled/KE.CustomRoles/CR/SCP/SCP457.cs +++ b/KruacentExiled/KE.CustomRoles/CR/SCP/SCP457.cs @@ -1,4 +1,4 @@ -/*using Exiled.API.Features; +using Exiled.API.Features; using Exiled.API.Features.Attributes; using Exiled.API.Features.Doors; using Exiled.API.Features.Roles; @@ -136,6 +136,11 @@ protected override void RoleRemoved(Player player) } + public override bool IsAvailable(Player player) + { + return false; + } + private void OnStalking(StalkingEventArgs ev) { @@ -179,4 +184,4 @@ private void OnAttacking(AttackingEventArgs ev) } -}*/ +} From 5f874716f6777a4bb50babcdc84e3c40ef161b3b Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Mon, 15 Dec 2025 19:10:43 +0100 Subject: [PATCH 460/853] reput the blackoutanddoor --- KruacentExiled/KE.Map/MainPlugin.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/KruacentExiled/KE.Map/MainPlugin.cs b/KruacentExiled/KE.Map/MainPlugin.cs index 09afc31f..b453f811 100644 --- a/KruacentExiled/KE.Map/MainPlugin.cs +++ b/KruacentExiled/KE.Map/MainPlugin.cs @@ -34,7 +34,7 @@ public override void OnEnabled() handler = new(); harmony = new(Prefix); - //handler.SubscribeEvents(); + handler.SubscribeEvents(); KE.Utils.API.Sounds.SoundPlayer.Instance.TryLoad(); Exiled.Events.Handlers.Map.Generated += OnGenerated; Exiled.Events.Handlers.Server.RoundStarted += OnRoundStarted; @@ -74,7 +74,7 @@ private void OnRoundStarted() public override void OnDisabled() { - //handler.UnsubscribeEvents(); + handler?.UnsubscribeEvents(); Exiled.Events.Handlers.Map.Generated -= OnGenerated; Exiled.Events.Handlers.Server.RoundStarted -= OnRoundStarted; LabApi.Events.Handlers.ServerEvents.MapGenerating -= OnGenerating; From bee6e9b40abfcfdaccc59073e3ffbd2878b7054c Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Mon, 15 Dec 2025 21:19:09 +0100 Subject: [PATCH 461/853] update again --- .../Features/LastHuman/LastHumanPosition.cs | 20 +++++++++++++++++++ KruacentExiled/KE.Misc/Features/SCPBuff.cs | 15 ++++++++++++++ .../KE.Misc/Features/VoteStart/VoteStart.cs | 13 +++++++++++- KruacentExiled/KE.Misc/KE.Misc.csproj | 2 +- 4 files changed, 48 insertions(+), 2 deletions(-) create mode 100644 KruacentExiled/KE.Misc/Features/LastHuman/LastHumanPosition.cs diff --git a/KruacentExiled/KE.Misc/Features/LastHuman/LastHumanPosition.cs b/KruacentExiled/KE.Misc/Features/LastHuman/LastHumanPosition.cs new file mode 100644 index 00000000..658d9289 --- /dev/null +++ b/KruacentExiled/KE.Misc/Features/LastHuman/LastHumanPosition.cs @@ -0,0 +1,20 @@ +using HintServiceMeow.Core.Enum; +using KE.Utils.API.Displays.DisplayMeow.Placements; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace KE.Misc.Features.LastHuman +{ + public class LastHumanPosition : HintPosition + { + public override float Xposition => 0; + + public override float Yposition => 400; + public override string Name => "LastHuman"; + + public override HintAlignment HintAlignment => HintAlignment.Center; + } +} diff --git a/KruacentExiled/KE.Misc/Features/SCPBuff.cs b/KruacentExiled/KE.Misc/Features/SCPBuff.cs index 41e66a6b..240fffb2 100644 --- a/KruacentExiled/KE.Misc/Features/SCPBuff.cs +++ b/KruacentExiled/KE.Misc/Features/SCPBuff.cs @@ -24,12 +24,27 @@ public void SubscribeEvents() { Exiled.Events.Handlers.Player.ChangingRole += BecomingSCP; Exiled.Events.Handlers.Scp106.Attacking += OnAttacking; + Exiled.Events.Handlers.Player.Died += OnDied; } public void UnsubscribeEvents() { Exiled.Events.Handlers.Player.ChangingRole -= BecomingSCP; Exiled.Events.Handlers.Scp106.Attacking -= OnAttacking; + Exiled.Events.Handlers.Player.Died -= OnDied; + } + + private void OnDied(DiedEventArgs ev) + { + IEnumerable players = Player.Enumerable.Where(p => p.IsHuman); + if (players.Count() > 1) + { + return; + } + + + + } diff --git a/KruacentExiled/KE.Misc/Features/VoteStart/VoteStart.cs b/KruacentExiled/KE.Misc/Features/VoteStart/VoteStart.cs index c96161c6..0525c02d 100644 --- a/KruacentExiled/KE.Misc/Features/VoteStart/VoteStart.cs +++ b/KruacentExiled/KE.Misc/Features/VoteStart/VoteStart.cs @@ -77,9 +77,20 @@ private void OnJoined(JoinedEventArgs ev) { Player player = ev.Player; + if(ev.Player is null) + { + return; + } + + + if (!ev.Player.IsConnected) + { + return; + } + Timing.CallDelayed(1f, () => { - if (player is not null && Round.IsLobby) + if (Round.IsLobby) { PlayerDisplay dis = PlayerDisplay.Get(player); DisplayHandler.Instance.CreateAuto(player, (args) => GetPlayers(), HintPosition.HintPlacement); diff --git a/KruacentExiled/KE.Misc/KE.Misc.csproj b/KruacentExiled/KE.Misc/KE.Misc.csproj index 32174097..51e2986d 100644 --- a/KruacentExiled/KE.Misc/KE.Misc.csproj +++ b/KruacentExiled/KE.Misc/KE.Misc.csproj @@ -6,7 +6,7 @@ - + From 47e7c083657a2639b9c0b737f30491183c7ace00 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Mon, 15 Dec 2025 21:24:59 +0100 Subject: [PATCH 462/853] removed test --- KruacentExiled/KE.Items/MainPlugin.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/KruacentExiled/KE.Items/MainPlugin.cs b/KruacentExiled/KE.Items/MainPlugin.cs index 5d667186..1a43b9b2 100644 --- a/KruacentExiled/KE.Items/MainPlugin.cs +++ b/KruacentExiled/KE.Items/MainPlugin.cs @@ -55,7 +55,7 @@ public override void OnEnabled() Utils.API.Sounds.SoundPlayer.Load(); - Exiled.Events.Handlers.Server.RoundStarted += Test; + //Exiled.Events.Handlers.Server.RoundStarted += Test; CustomItem.RegisterItems(); @@ -75,7 +75,7 @@ public override void OnDisabled() //QualityHandler?.Unregister(); SettingsHandler.UnsubscribeEvents(); - Exiled.Events.Handlers.Server.RoundStarted -= Test; + //Exiled.Events.Handlers.Server.RoundStarted -= Test; //QualityHandler = null; //PickupQuality = null; From 9f6b55aa1161ed2c9981674e3d33826865e73c84 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Mon, 15 Dec 2025 21:29:23 +0100 Subject: [PATCH 463/853] update broke tihns --- KruacentExiled/KE.Misc/Features/AutoNukeAnnoucement.cs | 4 ++-- .../GamblingCoin/Effect/NegativeEffect/FakeSCPDeath.cs | 4 ++-- KruacentExiled/KE.Misc/MainPlugin.cs | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/KruacentExiled/KE.Misc/Features/AutoNukeAnnoucement.cs b/KruacentExiled/KE.Misc/Features/AutoNukeAnnoucement.cs index fc13f157..f1d89679 100644 --- a/KruacentExiled/KE.Misc/Features/AutoNukeAnnoucement.cs +++ b/KruacentExiled/KE.Misc/Features/AutoNukeAnnoucement.cs @@ -54,8 +54,8 @@ private IEnumerator Timer() public void SayAnnouncement() { if (flagSaid) return; - Cassie.MessageTranslated("Warning automatic warhead will detonate in 5 minutes", - "Warning automatic warhead will detonate in 5 minutes"); + //Cassie.MessageTranslated("Warning automatic warhead will detonate in 5 minutes", + //"Warning automatic warhead will detonate in 5 minutes"); flagSaid = true; } diff --git a/KruacentExiled/KE.Misc/Features/GamblingCoin/Effect/NegativeEffect/FakeSCPDeath.cs b/KruacentExiled/KE.Misc/Features/GamblingCoin/Effect/NegativeEffect/FakeSCPDeath.cs index 60dab4a9..0c4fd45d 100644 --- a/KruacentExiled/KE.Misc/Features/GamblingCoin/Effect/NegativeEffect/FakeSCPDeath.cs +++ b/KruacentExiled/KE.Misc/Features/GamblingCoin/Effect/NegativeEffect/FakeSCPDeath.cs @@ -7,7 +7,7 @@ using System.Collections.Generic; using System.Linq; -internal class FakeSCPDeath : ICoinEffect +/*internal class FakeSCPDeath : ICoinEffect { public string Name { get; set; } = "FakeSCPDeath"; public string Message { get; set; } = "DID YOU JUST KILLED AN SCP !?!?"; @@ -49,4 +49,4 @@ public void Execute(Player player) Cassie.MessageTranslated($"scp {scpName.Key} successfully terminated by automatic security system", $"{scpName.Value} ${deathMessage}."); } -} \ No newline at end of file +}*/ \ No newline at end of file diff --git a/KruacentExiled/KE.Misc/MainPlugin.cs b/KruacentExiled/KE.Misc/MainPlugin.cs index e9aaada3..545550a7 100644 --- a/KruacentExiled/KE.Misc/MainPlugin.cs +++ b/KruacentExiled/KE.Misc/MainPlugin.cs @@ -135,7 +135,7 @@ private void NoeDeath(CassieQueuingScpTerminationEventArgs ev) } ev.IsAllowed = false; - Cassie.MessageTranslated("SCP 69 420 has been contained successfully", "SCP-69420-NOE has been contained successfully"); + Exiled.API.Features.Cassie.MessageTranslated("SCP 69 420 has been contained successfully", "SCP-69420-NOE has been contained successfully"); } From 3d603fc2e367adbffc72a4c785116e776283696e Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Mon, 15 Dec 2025 21:30:54 +0100 Subject: [PATCH 464/853] update berone tihns --- KruacentExiled/KE.Map/KE.Map.csproj | 2 +- .../KE.Map/Others/BlackoutNDoor/Handlers/Handler.cs | 4 ++-- KruacentExiled/KE.Map/Surface/SupplyDrops/SupplyDrop.cs | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/KruacentExiled/KE.Map/KE.Map.csproj b/KruacentExiled/KE.Map/KE.Map.csproj index 8be3c4d1..2264918b 100644 --- a/KruacentExiled/KE.Map/KE.Map.csproj +++ b/KruacentExiled/KE.Map/KE.Map.csproj @@ -6,7 +6,7 @@ - + diff --git a/KruacentExiled/KE.Map/Others/BlackoutNDoor/Handlers/Handler.cs b/KruacentExiled/KE.Map/Others/BlackoutNDoor/Handlers/Handler.cs index 8faf752d..a0738b63 100644 --- a/KruacentExiled/KE.Map/Others/BlackoutNDoor/Handlers/Handler.cs +++ b/KruacentExiled/KE.Map/Others/BlackoutNDoor/Handlers/Handler.cs @@ -149,8 +149,8 @@ private void LaunchEvent() string message = mapEvent.Cassie + " " + ZoneTypeToCassie(zone) + " " + MainPlugin.Translations.End; string translate = mapEvent.CassieTranslated + " " + ZoneTypeToCassieTranslated(zone) + " " + MainPlugin.Translations.End; - float yap = Cassie.CalculateDuration(message); - Cassie.MessageTranslated(message, translate,false,false,true); + float yap = Exiled.API.Features.Cassie.CalculateDuration(message, false, 0); + Exiled.API.Features.Cassie.MessageTranslated(message, translate,false,false,true); Timing.CallDelayed(5 + yap, delegate diff --git a/KruacentExiled/KE.Map/Surface/SupplyDrops/SupplyDrop.cs b/KruacentExiled/KE.Map/Surface/SupplyDrops/SupplyDrop.cs index 6313f1b4..d8cc29a7 100644 --- a/KruacentExiled/KE.Map/Surface/SupplyDrops/SupplyDrop.cs +++ b/KruacentExiled/KE.Map/Surface/SupplyDrops/SupplyDrop.cs @@ -256,7 +256,7 @@ private void BuffScps() if (_scpSteal >= ScpStealLimit) { - Cassie.MessageTranslated(CassieTooMuchStealing,CassieTooMuchStealingSub); + //Cassie.MessageTranslated(CassieTooMuchStealing,CassieTooMuchStealingSub); Warhead.Start(true, true); _spawnTime.Stop(); Timing.KillCoroutines(_handle); From c793d14fa28272089a6c04acf7818d8e3ef4c8f4 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Mon, 15 Dec 2025 21:35:37 +0100 Subject: [PATCH 465/853] merged maladroit & cleptoman --- .../KE.CustomRoles/CR/Human/Cleptoman.cs | 28 ------------------- .../KE.CustomRoles/CR/Human/Maladroit.cs | 8 ++++-- 2 files changed, 6 insertions(+), 30 deletions(-) delete mode 100644 KruacentExiled/KE.CustomRoles/CR/Human/Cleptoman.cs diff --git a/KruacentExiled/KE.CustomRoles/CR/Human/Cleptoman.cs b/KruacentExiled/KE.CustomRoles/CR/Human/Cleptoman.cs deleted file mode 100644 index 998b74f6..00000000 --- a/KruacentExiled/KE.CustomRoles/CR/Human/Cleptoman.cs +++ /dev/null @@ -1,28 +0,0 @@ -using Exiled.API.Features.Attributes; -using Exiled.CustomRoles.API.Features; -using KE.CustomRoles.API.Features; -using KE.CustomRoles.API.Interfaces; -using PlayerRoles; -using System.Collections.Generic; -using UnityEngine; - -namespace KE.CustomRoles.CR.Human -{ - public class Cleptoman : GlobalCustomRole, IColor - { - public override SideEnum Side { get; set; } = SideEnum.Human; - public override string Description { get; set; } = "Tu peux voler les items des autres joueurs"; - public override string PublicName { get; set; } = "cccCleptoman"; - public override bool KeepRoleOnDeath { get; set; } = false; - public override bool KeepRoleOnChangingRole { get; set; } = true; - public Color32 Color => new Color32(194, 0, 0, 0); - - public override float SpawnChance { get; set; } = 100; - public override Vector3 Scale { get; set; } = new Vector3(1.01f, 0.99f, 1); - - public override HashSet Abilities { get; } = new() - { - "Thief" - }; - } -} \ No newline at end of file diff --git a/KruacentExiled/KE.CustomRoles/CR/Human/Maladroit.cs b/KruacentExiled/KE.CustomRoles/CR/Human/Maladroit.cs index 17310bdb..7b327116 100644 --- a/KruacentExiled/KE.CustomRoles/CR/Human/Maladroit.cs +++ b/KruacentExiled/KE.CustomRoles/CR/Human/Maladroit.cs @@ -21,14 +21,18 @@ public class Maladroit : GlobalCustomRole, IColor private static Dictionary _coroutines = new(); public override SideEnum Side { get; set; } = SideEnum.Human; - public override string Description { get; set; } = "Fait attention à tes items !"; - public override string PublicName { get; set; } = "Maladroit"; + public override string Description { get; set; } = "Fait attention à \"tes\" items !"; + public override string PublicName { get; set; } = "Maladroit Vole"; public override bool KeepRoleOnDeath { get; set; } = false; public override bool KeepRoleOnChangingRole { get; set; } = false; public override float SpawnChance { get; set; } = 100; public Color32 Color => new(211, 110, 112, 0); + public override HashSet Abilities { get; } = new() + { + "Thief" + }; protected override void RoleAdded(Player player) { _coroutines.Add(player, Timing.RunCoroutine(ThrowingItem(player))); From 7524b6b653cb4ba15a4590a4fb4b645873c7a8b1 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Tue, 16 Dec 2025 15:52:46 +0100 Subject: [PATCH 466/853] fixed the vote --- KruacentExiled/KE.Misc/Features/VoteStart/VoteStart.cs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/KruacentExiled/KE.Misc/Features/VoteStart/VoteStart.cs b/KruacentExiled/KE.Misc/Features/VoteStart/VoteStart.cs index 0525c02d..92a845de 100644 --- a/KruacentExiled/KE.Misc/Features/VoteStart/VoteStart.cs +++ b/KruacentExiled/KE.Misc/Features/VoteStart/VoteStart.cs @@ -51,6 +51,15 @@ private void OnVoiceChatting(VoiceChattingEventArgs ev) { if (!Round.IsLobby) return; if (voteCasted) return; + if (ev.Player is null) + { + return; + } + + if (string.IsNullOrEmpty(ev.Player.AuthenticationToken)) + { + return; + } Voted.Add(ev.Player); if (Voted.Count >= minvote) From f3d5620f4dbc4713d192c7bc3d15a0ccef25b3a0 Mon Sep 17 00:00:00 2001 From: OmerGS <27omerf@gmail.com> Date: Wed, 17 Dec 2025 15:34:19 +0100 Subject: [PATCH 467/853] refactor SwapProtocol and add ItemRain GE - SwapProtocol : To remove bug and better role swapping (magazine ammo, health, max health...) - ItemRain : 5 Item will be fall out of the sky every 120 seconds --- .../GE/ItemRain.cs | 42 ++++ .../GE/SwapProtocol.cs | 181 +++++++++++++----- .../KE.GlobalEventFramework.Examples.csproj | 2 +- .../MiddleEvents/Speed.cs | 1 - 4 files changed, 172 insertions(+), 54 deletions(-) create mode 100644 KruacentExiled/KE.GlobalEventFramework.Examples/GE/ItemRain.cs diff --git a/KruacentExiled/KE.GlobalEventFramework.Examples/GE/ItemRain.cs b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/ItemRain.cs new file mode 100644 index 00000000..f455b0d0 --- /dev/null +++ b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/ItemRain.cs @@ -0,0 +1,42 @@ +using Exiled.API.Features; +using Exiled.API.Features.Items; +using KE.GlobalEventFramework.GEFE.API.Features; +using KE.GlobalEventFramework.GEFE.API.Interfaces; +using MEC; +using System; +using System.Collections.Generic; + +namespace KE.GlobalEventFramework.Examples.GE +{ + /// + /// Randomly item will fall from the sky + /// + public class ItemRain : GlobalEvent, IStart + { + /// + public override uint Id { get; set; } = 1090; + /// + public override string Name { get; set; } = "ItemRain"; + /// + public override string Description { get; set; } = "Il pleut des items !!"; + /// + public override int WeightedChance => 1; + + public int Cooldown = 120; + public int NbItemSpawned = 5; + public IEnumerator Start() + { + while (!Round.IsEnded) + { + Log.Debug("waiting"); + Array values = Enum.GetValues(typeof(ItemType)); + yield return Timing.WaitForSeconds(Cooldown); + + for (int i = 0; i < NbItemSpawned; i++) + { + Item.Create((ItemType)values.GetValue(UnityEngine.Random.Range(0, values.Length))).CreatePickup(Room.Random().Position); + } + } + } + } +} \ No newline at end of file diff --git a/KruacentExiled/KE.GlobalEventFramework.Examples/GE/SwapProtocol.cs b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/SwapProtocol.cs index e62afa8c..d7467473 100644 --- a/KruacentExiled/KE.GlobalEventFramework.Examples/GE/SwapProtocol.cs +++ b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/SwapProtocol.cs @@ -1,13 +1,17 @@ -using Player = Exiled.API.Features.Player; -using System.Collections.Generic; +using CustomPlayerEffects; +using Exiled.API.Enums; +using Exiled.API.Extensions; +using Exiled.API.Features; +using Exiled.API.Features.Items; +using InventorySystem.Items.Usables; using KE.GlobalEventFramework.GEFE.API.Features; using KE.GlobalEventFramework.GEFE.API.Interfaces; using MEC; +using PlayerRoles; +using System.Collections.Generic; using System.Linq; -using Exiled.API.Extensions; -using Exiled.API.Features; -using Exiled.API.Enums; -using static UnityEngine.GraphicsBuffer; +using UnityEngine; +using Player = Exiled.API.Features.Player; namespace KE.GlobalEventFramework.Examples.GE { @@ -18,82 +22,155 @@ public class SwapProtocol : GlobalEvent, IStart public override string Description { get; set; } = "EEEEEEEET c'est parti la roulette tourne"; public override int WeightedChance { get; set; } = 1; + /// + /// Cooldown between each change in seconds + /// + public int Cooldown = 60; + public IEnumerator Start() { while (!Round.IsEnded) { - // every 5 min - yield return Timing.WaitForSeconds(60*5); - ChangingPlayer(); + yield return Timing.WaitForSeconds(Cooldown); + SwapAllPlayers(); } } - private void ChangingPlayer() + private void SwapAllPlayers() { - // Liste des joueurs vivants - List playerInServer = Player.List.Where(p => !p.IsNPC).ToList(); + List players = Player.List.ToList(); + Log.Debug($"[swapprotocol] player count : {players.Count}"); - if (playerInServer.Count < 2) + if (players.Count < 2) { - Log.Debug("Pas assez de joueurs vivants pour effectuer un échange !"); + Log.Debug("[swapprotocol] not enough player"); return; } - Log.Debug("===== Liste des joueurs avant permutation ====="); - playerInServer.ForEach(p => Log.Debug($"{p.Nickname} ({p.Role})")); + players.ShuffleList(); - // Mélanger la liste des joueurs - playerInServer.ShuffleList(); + List playersData = players.Select(p => new PlayerData(p)).ToList(); - // Copier les données actuelles des joueurs - var playersRoles = playerInServer.Select(p => p.Role).ToList(); - - // Permutation circulaire des rôles et pseudonymes - for (int i = 0; i < playerInServer.Count; i++) + for (int i = 0; i < players.Count; i++) { - int nextIndex = (i + 1) % playerInServer.Count; + int sourceIndex = (i + 1) % players.Count; - var player = playerInServer[i]; - var target = playerInServer[nextIndex]; + Player target = players[i]; + PlayerData dataToApply = playersData[sourceIndex]; - // Récupération des objets - List items1 = player.Items.Select(item => item.Type).ToList(); - List items2 = target.Items.Select(item => item.Type).ToList(); + Log.Debug($"[swappotocol] swap {target.Nickname} from {sourceIndex}"); - // Sauvegarde et suppression des munitions - Dictionary ammo1 = new Dictionary(); - Dictionary ammo2 = new Dictionary(); + ExecuteSwap(target, dataToApply); + } + } - for (int j = 0; j < player.Ammo.Count; j++) - { - ammo1.Add(player.Ammo.ElementAt(j).Key.GetAmmoType(), player.Ammo.ElementAt(j).Value); - player.SetAmmo(ammo1.ElementAt(j).Key, 0); - } - for (int j = 0; j < target.Ammo.Count; j++) + /// + /// Move a player's data to another player + /// + /// + /// + private void ExecuteSwap(Player target, PlayerData data) + { + data.ApplyTo(target); + } + + private sealed class PlayerData + { + public string Nickname { get; } + public RoleTypeId Role { get; } + public float MaxHealth { get; } + public float Health { get; } + public Vector3 PlayerScale { get; } + public bool IsCuffed { get; } + public List SavedItems { get; } + public Dictionary Ammo { get; } + public List SavedEffects { get; } + + public PlayerData(Player player) + { + Nickname = player.Nickname; + Role = player.Role.Type; + MaxHealth = player.MaxHealth; + Health = player.Health; + PlayerScale = player.Scale; + IsCuffed = player.IsCuffed; + + SavedItems = new List(); + foreach (Item item in player.Items) { - ammo2.Add(target.Ammo.ElementAt(j).Key.GetAmmoType(), target.Ammo.ElementAt(j).Value); - target.SetAmmo(ammo2.ElementAt(j).Key, 0); + SavedItems.Add(new ItemState(item)); } - // Changement de rôle - player.Role.Set(playersRoles[nextIndex], PlayerRoles.RoleSpawnFlags.AssignInventory); + Ammo = player.Ammo.ToDictionary(k => k.Key.GetAmmoType(), v => v.Value); + SavedEffects = player.ActiveEffects.Select(e => new EffectState(e)).ToList(); + } - // Attribution des inventaires - target.ResetInventory(items1); - player.ResetInventory(items2); + public void ApplyTo(Player target) + { + target.ClearInventory(); - // Attribution des munitions - foreach (var ammo in ammo2) - { - player.SetAmmo(ammo.Key, ammo.Value); - } - foreach (var ammo in ammo1) + target.Role.Set(Role, RoleSpawnFlags.None); + + // Add Safe TP here !! + if (target.PreviousRole == RoleTypeId.Spectator) target.Position = Room.Random(ZoneType.HeavyContainment).Position + Vector3.up; + + target.MaxHealth = MaxHealth; + target.Health = Health; + target.Scale = PlayerScale; + if (IsCuffed && !target.IsCuffed) target.Handcuff(); else target.RemoveHandcuffs(); + + foreach (ItemState state in SavedItems) { - target.SetAmmo(ammo.Key, ammo.Value); + Item newItem = target.AddItem(state.Type); + state.ApplyState(newItem); } + + foreach (var ammo in Ammo) target.SetAmmo(ammo.Key, ammo.Value); + + target.DisableAllEffects(); + foreach (EffectState state in SavedEffects) target.EnableEffect(state.Type, state.Intensity, state.Duration); + } + } + + private readonly struct ItemState + { + public ItemType Type { get; } + public int AmmoInMag { get; } + public float MicroEnergy { get; } + public int JailbirdCharges { get; } + + public ItemState(Item item) + { + Type = item.Type; + AmmoInMag = 0; + MicroEnergy = 0; + JailbirdCharges = 0; + + if (item is Firearm gun) AmmoInMag = gun.MagazineAmmo; + else if (item is MicroHid micro) MicroEnergy = micro.Energy; + else if (item is Jailbird jail) JailbirdCharges = jail.TotalCharges; + } + + public void ApplyState(Item item) + { + if (item is Firearm gun) gun.MagazineAmmo = AmmoInMag; + else if (item is MicroHid micro) micro.Energy = MicroEnergy; + else if (item is Jailbird jail) jail.TotalCharges = JailbirdCharges; } } + private readonly struct EffectState + { + public EffectType Type { get; } + public byte Intensity { get; } + public float Duration { get; } + public EffectState(StatusEffectBase effect) + { + Type = effect.GetEffectType(); + Intensity = effect.Intensity; + Duration = effect.Duration; + } + } } } \ No newline at end of file diff --git a/KruacentExiled/KE.GlobalEventFramework.Examples/KE.GlobalEventFramework.Examples.csproj b/KruacentExiled/KE.GlobalEventFramework.Examples/KE.GlobalEventFramework.Examples.csproj index 7ac6c52a..0aa7fff3 100644 --- a/KruacentExiled/KE.GlobalEventFramework.Examples/KE.GlobalEventFramework.Examples.csproj +++ b/KruacentExiled/KE.GlobalEventFramework.Examples/KE.GlobalEventFramework.Examples.csproj @@ -6,7 +6,7 @@ - + diff --git a/KruacentExiled/KE.GlobalEventFramework.Examples/MiddleEvents/Speed.cs b/KruacentExiled/KE.GlobalEventFramework.Examples/MiddleEvents/Speed.cs index ce8c8317..5b4e5c36 100644 --- a/KruacentExiled/KE.GlobalEventFramework.Examples/MiddleEvents/Speed.cs +++ b/KruacentExiled/KE.GlobalEventFramework.Examples/MiddleEvents/Speed.cs @@ -24,7 +24,6 @@ public class SpeedM : MiddleEvent, IStart, IReversible public override string Description { get; set; } = "Gas! gas! gas!"; /// public override int WeightedChance { get; set; } = 0; - public override uint[] IncompatibleEvents => /// /// intensity of the movement boost effect /// From 1d753a590b8fbb9931e322ba3278392191e29fc4 Mon Sep 17 00:00:00 2001 From: Omer <27omerf@gmail.Com> Date: Wed, 17 Dec 2025 16:47:06 +0100 Subject: [PATCH 468/853] test silent walk for Mime Role --- KruacentExiled/KE.CustomRoles/CR/ClassD/Mime.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/KruacentExiled/KE.CustomRoles/CR/ClassD/Mime.cs b/KruacentExiled/KE.CustomRoles/CR/ClassD/Mime.cs index bb603a2b..2e06d227 100644 --- a/KruacentExiled/KE.CustomRoles/CR/ClassD/Mime.cs +++ b/KruacentExiled/KE.CustomRoles/CR/ClassD/Mime.cs @@ -27,7 +27,7 @@ public class Mime : KECustomRole, IColor protected override void RoleAdded(Player player) { - player.EnableEffect(EffectType.SilentWalk, -1, true); //doesn't work with 939 i think + player.EnableEffect(EffectType.SilentWalk, -1, true); // doesn't work with SCP-939 (tested) player.IsMuted = true; } From 83dd132eead576cffb0800dac0806b350a22a35f Mon Sep 17 00:00:00 2001 From: OmerGS <27omerf@gmail.com> Date: Thu, 18 Dec 2025 10:00:01 +0100 Subject: [PATCH 469/853] add new negative event and corrected event --- .../Effect/NegativeEffect/EveryoneChange.cs | 36 +++++++++++++ .../Effect/NegativeEffect/FlipPlayerRole.cs | 53 +++++++------------ .../Effect/NegativeEffect/Reversed.cs | 2 +- 3 files changed, 55 insertions(+), 36 deletions(-) create mode 100644 KruacentExiled/KE.Misc/Features/GamblingCoin/Effect/NegativeEffect/EveryoneChange.cs diff --git a/KruacentExiled/KE.Misc/Features/GamblingCoin/Effect/NegativeEffect/EveryoneChange.cs b/KruacentExiled/KE.Misc/Features/GamblingCoin/Effect/NegativeEffect/EveryoneChange.cs new file mode 100644 index 00000000..b6a1b5b0 --- /dev/null +++ b/KruacentExiled/KE.Misc/Features/GamblingCoin/Effect/NegativeEffect/EveryoneChange.cs @@ -0,0 +1,36 @@ +using Exiled.API.Features; +using KE.Misc.Features.GamblingCoin.Interfaces; +using KE.Misc.Features.GamblingCoin.Types; +using PlayerRoles; +using System.Collections.Generic; +using System.Linq; + +internal class EveryoneChange : ICoinEffect +{ + public string Name { get; set; } = "EveryoneChange"; + public string Message { get; set; } = "You converted everyone in the opposite team !"; + public int Weight { get; set; } = 10; + public EffectType Type { get; set; } = EffectType.Negative; + + private readonly Dictionary RoleInversions = new Dictionary + { + { RoleTypeId.ClassD, RoleTypeId.Scientist }, + { RoleTypeId.Scientist, RoleTypeId.ClassD }, + { RoleTypeId.ChaosConscript, RoleTypeId.NtfPrivate }, + { RoleTypeId.ChaosRifleman, RoleTypeId.NtfSergeant }, + { RoleTypeId.ChaosRepressor, RoleTypeId.NtfCaptain }, + { RoleTypeId.ChaosMarauder, RoleTypeId.NtfCaptain }, + { RoleTypeId.NtfPrivate, RoleTypeId.ChaosRifleman }, + { RoleTypeId.NtfSergeant, RoleTypeId.ChaosRifleman }, + { RoleTypeId.NtfCaptain, RoleTypeId.ChaosRepressor }, + { RoleTypeId.NtfSpecialist, RoleTypeId.ChaosMarauder } + }; + + public void Execute(Player caster) + { + foreach (Player target in Player.List.Where(p => p.IsAlive && RoleInversions.ContainsKey(p.Role.Type))) + { + target.Role.Set(RoleInversions[target.Role.Type], RoleSpawnFlags.AssignInventory); + } + } +} \ No newline at end of file diff --git a/KruacentExiled/KE.Misc/Features/GamblingCoin/Effect/NegativeEffect/FlipPlayerRole.cs b/KruacentExiled/KE.Misc/Features/GamblingCoin/Effect/NegativeEffect/FlipPlayerRole.cs index 6b275abe..ba68dbf0 100644 --- a/KruacentExiled/KE.Misc/Features/GamblingCoin/Effect/NegativeEffect/FlipPlayerRole.cs +++ b/KruacentExiled/KE.Misc/Features/GamblingCoin/Effect/NegativeEffect/FlipPlayerRole.cs @@ -3,49 +3,32 @@ using KE.Misc.Features.GamblingCoin.Types; using PlayerRoles; using System.Collections.Generic; - +using static UnityEngine.GraphicsBuffer; internal class FlipPlayerRole : ICoinEffect { public string Name { get; set; } = "FlipPlayerRole"; - public string Message { get; set; } = "That's what I call an UNO reverse card !"; + public string Message { get; set; } = "That's what I call an UNO reverse card!"; public int Weight { get; set; } = 10; public EffectType Type { get; set; } = EffectType.Negative; + private static readonly Dictionary RoleInversions = new Dictionary + { + { RoleTypeId.Scientist, RoleTypeId.ClassD }, + { RoleTypeId.ClassD, RoleTypeId.Scientist }, + { RoleTypeId.ChaosConscript, RoleTypeId.NtfSergeant }, + { RoleTypeId.ChaosRifleman, RoleTypeId.NtfSergeant }, + { RoleTypeId.ChaosMarauder, RoleTypeId.NtfCaptain }, + { RoleTypeId.ChaosRepressor, RoleTypeId.NtfCaptain }, + { RoleTypeId.FacilityGuard, RoleTypeId.ChaosRifleman }, + { RoleTypeId.NtfPrivate, RoleTypeId.ChaosRifleman }, + { RoleTypeId.NtfSergeant, RoleTypeId.ChaosRifleman }, + { RoleTypeId.NtfSpecialist, RoleTypeId.ChaosRifleman }, + { RoleTypeId.NtfCaptain, RoleTypeId.ChaosRepressor }, + }; + public void Execute(Player player) { player.DropItems(); - switch (player.Role.Type) - { - case RoleTypeId.Scientist: - player.Role.Set(RoleTypeId.ClassD, RoleSpawnFlags.AssignInventory); - break; - case RoleTypeId.ClassD: - player.Role.Set(RoleTypeId.Scientist, RoleSpawnFlags.AssignInventory); - break; - case RoleTypeId.ChaosConscript: - case RoleTypeId.ChaosRifleman: - player.Role.Set(RoleTypeId.NtfSergeant, RoleSpawnFlags.AssignInventory); - break; - case RoleTypeId.ChaosMarauder: - case RoleTypeId.ChaosRepressor: - player.Role.Set(RoleTypeId.NtfCaptain, RoleSpawnFlags.AssignInventory); - break; - case RoleTypeId.FacilityGuard: - player.Role.Set(RoleTypeId.ChaosRifleman, RoleSpawnFlags.AssignInventory); - break; - case RoleTypeId.NtfPrivate: - case RoleTypeId.NtfSergeant: - case RoleTypeId.NtfSpecialist: - player.Role.Set(RoleTypeId.ChaosRifleman, RoleSpawnFlags.AssignInventory); - break; - case RoleTypeId.NtfCaptain: - List roles = new List - { - RoleTypeId.ChaosMarauder, - RoleTypeId.ChaosRepressor - }; - player.Role.Set(roles.RandomItem(), RoleSpawnFlags.AssignInventory); - break; - } + player.Role.Set(RoleInversions[player.Role.Type], RoleSpawnFlags.None); } } \ No newline at end of file diff --git a/KruacentExiled/KE.Misc/Features/GamblingCoin/Effect/NegativeEffect/Reversed.cs b/KruacentExiled/KE.Misc/Features/GamblingCoin/Effect/NegativeEffect/Reversed.cs index c9ae9e3f..b7bc73e8 100644 --- a/KruacentExiled/KE.Misc/Features/GamblingCoin/Effect/NegativeEffect/Reversed.cs +++ b/KruacentExiled/KE.Misc/Features/GamblingCoin/Effect/NegativeEffect/Reversed.cs @@ -7,7 +7,7 @@ internal class Reversed : IDurationEffect { public string Name { get; set; } = "Reversed"; public string Message { get; set; } = "Oops ! I connected your keyboard in the wrong way, sorryyyy"; - public float Duration { get; set; } = 60; + public float Duration { get; set; } = 30; public int Weight { get; set; } = 5; public EffectType Type { get; set; } = EffectType.Negative; From f812811e0e39234be7e1ec1a9f0c3b756adecb15 Mon Sep 17 00:00:00 2001 From: OmerGS <27omerf@gmail.com> Date: Thu, 18 Dec 2025 17:19:11 +0100 Subject: [PATCH 470/853] rework DA-020 to create RedBull Energy, rework Defibrilator --- .../ItemEffects/RedbullEnergyEffect.cs | 122 ++++++++ .../KE.Items/Items/AdrenalineDrogue.cs | 262 ------------------ KruacentExiled/KE.Items/Items/Defibrilator.cs | 185 ++++++++----- .../KE.Items/Items/RedbullEnergy.cs | 71 +++++ 4 files changed, 309 insertions(+), 331 deletions(-) create mode 100644 KruacentExiled/KE.Items/ItemEffects/RedbullEnergyEffect.cs delete mode 100644 KruacentExiled/KE.Items/Items/AdrenalineDrogue.cs create mode 100644 KruacentExiled/KE.Items/Items/RedbullEnergy.cs diff --git a/KruacentExiled/KE.Items/ItemEffects/RedbullEnergyEffect.cs b/KruacentExiled/KE.Items/ItemEffects/RedbullEnergyEffect.cs new file mode 100644 index 00000000..8cff2e38 --- /dev/null +++ b/KruacentExiled/KE.Items/ItemEffects/RedbullEnergyEffect.cs @@ -0,0 +1,122 @@ +using Exiled.API.Enums; +using Exiled.API.Features; +using Exiled.API.Features.Doors; +using Exiled.API.Features.Items; +using Exiled.Events.EventArgs.Map; +using Exiled.Events.EventArgs.Player; +using KE.Items.Features; +using KE.Items.Interface; +using MEC; +using System.Collections.Generic; +using UnityEngine; + +namespace KE.Items.ItemEffects +{ + public class RedBullEnergyEffect : CustomItemEffect + { + private const string ActiveKey = "KE.Items.Redbull.Active"; + private const string DoorExplodeKey = "KE.Items.Redbull.Immune"; + private const float ScanRadiusSqr = 6.40f; + private const float BoostDuration = 20f; + private const float CrashDuration = 30f; + + private readonly Dictionary _activeRoutines = new Dictionary(); + + public override void Effect(UsedItemEventArgs ev) => TriggerEffect(ev.Player); + + public override void Effect(DroppingItemEventArgs ev) => TriggerEffect(ev.Player); + + public override void Effect(ExplodingGrenadeEventArgs ev) => TriggerEffect(ev.Player); + + private void TriggerEffect(Player player) + { + if (player.SessionVariables.ContainsKey(ActiveKey)) + { + KECustomItem.ItemEffectHint(player, "Ton cœur ne supporterait pas une autre canette !"); + return; + } + + if (_activeRoutines.TryGetValue(player.Id, out CoroutineHandle oldHandle)) + Timing.KillCoroutines(oldHandle); + + _activeRoutines[player.Id] = Timing.RunCoroutine(RunRedBullSequence(player)); + } + + private IEnumerator RunRedBullSequence(Player p) + { + p.SessionVariables[ActiveKey] = true; + + p.EnableEffect(EffectType.Scp207, 5, BoostDuration); + p.EnableEffect(EffectType.DamageReduction, 40, BoostDuration); + + float elapsed = 0f; + while (elapsed < BoostDuration) + { + if (p == null || !p.IsAlive) yield break; + + p.Stamina = 1f; + if (p.Health < p.MaxHealth) p.Health += 0.5f; + + Vector3 pPos = p.Position; + foreach (Door door in Door.List) + { + if (!door.IsGate && door is BreakableDoor breakable && !breakable.IsDestroyed) + { + if ((breakable.Position - pPos).sqrMagnitude < ScanRadiusSqr) + { + p.SessionVariables[DoorExplodeKey] = true; + + ExplosiveGrenade grenade = (ExplosiveGrenade)Item.Create(ItemType.GrenadeHE); + grenade.FuseTime = 0.1f; + breakable.IsOpen = true; + grenade.SpawnActive(breakable.Position, p); + + Timing.CallDelayed(0.2f, () => { + if (p != null) p.SessionVariables.Remove(DoorExplodeKey); + }); + } + } + } + + elapsed += 0.2f; + yield return Timing.WaitForSeconds(0.2f); + } + + if (p == null || !p.IsAlive) yield break; + + KECustomItem.ItemEffectHint(p, "Ton coeur va exploser !"); + + p.DisableEffect(EffectType.Scp207); + p.Stamina = 0.25f; + + p.EnableEffect(EffectType.Deafened, CrashDuration); + p.EnableEffect(EffectType.Slowness, CrashDuration); + p.EnableEffect(EffectType.Concussed, CrashDuration); + p.EnableEffect(EffectType.Exhausted, CrashDuration); + + yield return Timing.WaitForSeconds(CrashDuration); + + Cleanup(p); + } + + public void OnHurting(HurtingEventArgs ev) + { + if (ev.DamageHandler.Type == DamageType.Explosion && ev.Player.SessionVariables.ContainsKey(DoorExplodeKey)) + ev.Amount = 0; + } + + public void Cleanup(Player p) + { + if (p == null) return; + + if (_activeRoutines.TryGetValue(p.Id, out CoroutineHandle handle)) + { + Timing.KillCoroutines(handle); + _activeRoutines.Remove(p.Id); + } + + if (p.SessionVariables.ContainsKey(ActiveKey)) p.SessionVariables.Remove(ActiveKey); + if (p.SessionVariables.ContainsKey(DoorExplodeKey)) p.SessionVariables.Remove(DoorExplodeKey); + } + } +} \ No newline at end of file diff --git a/KruacentExiled/KE.Items/Items/AdrenalineDrogue.cs b/KruacentExiled/KE.Items/Items/AdrenalineDrogue.cs deleted file mode 100644 index 233119f5..00000000 --- a/KruacentExiled/KE.Items/Items/AdrenalineDrogue.cs +++ /dev/null @@ -1,262 +0,0 @@ -using System.Collections.Generic; -using Exiled.API.Enums; -using Exiled.API.Features.Attributes; -using Exiled.API.Features.Spawn; -using Exiled.CustomItems.API.Features; -using MEC; -using Exiled.Events.EventArgs.Player; -using Player = Exiled.Events.Handlers.Player; -using Exiled.API.Features; -using Exiled.API.Extensions; -using UnityEngine; -using CustomPlayerEffects; -using KE.Items.Interface; -using System.Linq; -using KE.Items.Extensions; -using KE.Items.Features; - -/// -[CustomItem(ItemType.Adrenaline)] -public class AdrenalineDrogue : KECustomItem, ILumosItem -{ - //seringue - /// - public override uint Id { get; set; } = 1042; - - /// - public override string Name { get; set; } = "DA-020"; - - /// - public override string Description { get; set; } = "you need to test it !"; - - /// - public override float Weight { get; set; } = 0.65f; - public UnityEngine.Color Color { get; set; } = UnityEngine.Color.yellow; - - - public List joueursSCP = new List(); - - /// - public override SpawnProperties SpawnProperties { get; set; } = new SpawnProperties() - { - Limit = 1, - DynamicSpawnPoints = new List - { - new DynamicSpawnPoint() - { - Chance = 100, - Location = SpawnLocationType.Inside079Secondary, - }, - new DynamicSpawnPoint() - { - Chance = 2, - Location = SpawnLocationType.Inside173Gate, - }, - }, - - LockerSpawnPoints = new List - { - new LockerSpawnPoint() - { - Chance = 20, - UseChamber = true, - Type = LockerType.Misc, - Zone = ZoneType.Entrance, - }, - new LockerSpawnPoint() - { - Chance = 25, - UseChamber = true, - Type = LockerType.Medkit, - Zone = ZoneType.HeavyContainment, - }, - }, - }; - - /// - protected override void SubscribeEvents() - { - Player.UsedItem += OnUsingItem; - base.SubscribeEvents(); - } - - /// - protected override void UnsubscribeEvents() - { - Player.UsedItem -= OnUsingItem; - base.UnsubscribeEvents(); - } - - private void OnUsingItem(UsedItemEventArgs ev) - { - if (TryGet(ev.Item, out var result)) - { - if (result.Id == Id) - { - Timing.CallDelayed(0.5f, () => - { - Timing.RunCoroutine(EffectAttribution(ev.Player)); - }); - } - - } - } - - private IEnumerator EffectAttribution(Exiled.API.Features.Player joueur) - { - bool gasgas = false; - - /* EFFET DE LA DROGUE */ - joueur.ItemEffectHint("Vous êtes actuellement sous effet de la cocaïne liquide !"); - - var movementBoostEffect = joueur.ActiveEffects.FirstOrDefault(e => e is MovementBoost) as MovementBoost; - - if (movementBoostEffect != null) - { - float currentIntensity = movementBoostEffect.Intensity; - joueur.EnableEffect(currentIntensity+50, true); - gasgas = true; - } - else - { - joueur.EnableEffect(50, true); - } - - - joueur.EnableEffect(30, true); - joueur.EnableEffect(40, true); - joueur.EnableEffect(30, true); - joueur.Health = 169; - - yield return Timing.WaitForSeconds(30); - - joueur.ItemEffectHint("Mince vous êtes perdu chez le papi Rian !"); - joueur.Health = 9420; - - joueur.IsGodModeEnabled = true; - joueur.EnableEffect(EffectType.Flashed, 2, 2); - joueur.Teleport(RoomType.Pocket); - yield return Timing.WaitForSeconds(6); - - - joueur.EnableEffect(EffectType.Flashed, 2, 2); - joueur.Teleport(Room.Random()); - joueur.Handcuff(); - yield return Timing.WaitForSeconds(15); - - joueur.Health = 1; - - joueur.EnableEffect(EffectType.SeveredHands, 4); - yield return Timing.WaitForSeconds(4); - joueur.DisableAllEffects(); - - - foreach (Exiled.API.Features.Player unJoueur in Exiled.API.Features.Player.List) - { - if (unJoueur.IsScp) - { - joueursSCP.Add(unJoueur); - } - } - - joueur.EnableEffect(EffectType.Flashed, 2, 2); - if (joueursSCP.Count > 0) - { - joueur.Teleport(joueursSCP[UnityEngine.Random.Range(0, joueursSCP.Count)]); - } - else - { - joueur.Teleport(Room.Random()); - } - - yield return Timing.WaitForSeconds(10); - - joueur.Teleport(Room.Random()); - - joueur.RemoveHandcuffs(); - joueur.IsGodModeEnabled = false; - joueur.MaxHealth = 65; - joueur.Heal(joueur.MaxHealth); - joueur.DisplayNickname = "Sou Hiyori"; - - joueur.DisableAllEffects(); - joueur.EnableEffect(10); - if (gasgas) - { - joueur.EnableEffect(130, true); - } else - { - joueur.EnableEffect(30, true); - } - - - yield return Timing.WaitForSeconds(UnityEngine.Random.Range(60, 120)); - - if (joueur.IsAlive) - { - int randomNumber = UnityEngine.Random.Range(1, 6); - switch (randomNumber) - { - case 1: - Log.Debug(joueur.Nickname + " changed his skin !"); - joueur.PlayShieldBreakSound(); - - joueur.ChangeAppearance(joueursSCP[0].Role); - joueur.DisplayNickname = joueursSCP[0].Nickname; - - Exiled.API.Features.Server.FriendlyFire = true; - - joueur.Mute(); - yield return Timing.WaitForSeconds(15); - joueur.UnMute(); - break; - case 2: - Log.Debug("Muet"); - joueur.ItemEffectHint("You lost your ability to talk, (git good)"); - joueur.Mute(); - yield return Timing.WaitForSeconds(UnityEngine.Random.Range(30, 100)); - joueur.ShowHint("I think you found your ability"); - joueur.UnMute(); - break; - case 3: - joueur.ItemEffectHint("You are caoutchouc man"); - Exiled.API.Features.TeslaGate.IgnoredPlayers.Add(joueur); - joueur.SetScale(new Vector3(1.5f, 0.5f, 1.7f), Exiled.API.Features.Player.List); - break; - case 4: - Log.Debug("Let's go party"); - foreach (var player in Exiled.API.Features.Player.List) - { - player.ShowHint("It's " + joueur.Nickname + " birthday !"); - } - - float duration2 = 30f; - float interval2 = 0.7f; - - float elapsedTime2 = 0f; - - while (elapsedTime2 < duration2) - { - float r = UnityEngine.Random.Range(0f, 1f); - float g = UnityEngine.Random.Range(0f, 1f); - float b = UnityEngine.Random.Range(0f, 1f); - - Exiled.API.Features.Map.ChangeLightsColor(new UnityEngine.Color(r, g, b)); - - yield return Timing.WaitForSeconds(interval2); - - elapsedTime2 += interval2; - } - - Exiled.API.Features.Map.ResetLightsColor(); - break; - case 5: - Log.Debug("Paper"); - joueur.ItemEffectHint("You are a paper ! Yippee !"); - joueur.SetScale(new Vector3(1f, 0.5f, 1f), Exiled.API.Features.Player.List); - break; - } - } - - } -} \ No newline at end of file diff --git a/KruacentExiled/KE.Items/Items/Defibrilator.cs b/KruacentExiled/KE.Items/Items/Defibrilator.cs index fbca71f1..3e17a7bc 100644 --- a/KruacentExiled/KE.Items/Items/Defibrilator.cs +++ b/KruacentExiled/KE.Items/Items/Defibrilator.cs @@ -1,136 +1,183 @@ -using System.Collections.Concurrent; -using System.Collections.Generic; using Exiled.API.Enums; +using Exiled.API.Extensions; +using Exiled.API.Features; using Exiled.API.Features.Attributes; using Exiled.API.Features.Spawn; using Exiled.CustomItems.API.Features; -using MEC; using Exiled.Events.EventArgs.Player; -using Exiled.API.Features; -using UnityEngine; -using System.Linq; -using KE.Items.Interface; -using KE.Items.Extensions; using KE.Items.Features; +using KE.Items.Interface; +using MEC; +using PlayerRoles; +using PlayerRoles.Ragdolls; +using System.Collections.Generic; +using UnityEngine; [CustomItem(ItemType.SCP1853)] -public class Defibrilator : KECustomItem, ILumosItem +public class Defibrillator : KECustomItem, ILumosItem { public override uint Id { get; set; } = 1041; - public override string Name { get; set; } = "Defibrilator"; - public override string Description { get; set; } = "The defibrillator is used to revive a person who has lost consciousness. It will revive the person closest to the player who uses it (the location of death, not where the body is)."; - public override float Weight { get; set; } = 0.65f; + public override string Name { get; set; } = "Defibrillator"; + public override string Description { get; set; } = "Visez un cadavre de près pour tenter une réanimation."; + public override float Weight { get; set; } = 1.0f; public UnityEngine.Color Color { get; set; } = UnityEngine.Color.magenta; - private ConcurrentDictionary positionMort = new ConcurrentDictionary(); - public override SpawnProperties SpawnProperties { get; set; } = new SpawnProperties() { Limit = 4, DynamicSpawnPoints = new List { new DynamicSpawnPoint() { Chance = 50, Location = SpawnLocationType.Inside079Secondary }, + new DynamicSpawnPoint() { Chance = 10, Location = SpawnLocationType.Inside096 }, + new DynamicSpawnPoint() { Chance = 10, Location = SpawnLocationType.Inside330 }, + new DynamicSpawnPoint() { Chance = 10, Location = SpawnLocationType.Inside939Cryo }, }, - LockerSpawnPoints = new List { new LockerSpawnPoint(){ Chance= 50, Type = LockerType.Medkit, }, + new LockerSpawnPoint(){ Chance= 20, Type = LockerType.Misc, }, } }; + private struct DeathData + { + public float Time; + public RoleTypeId Role; + } + + private readonly Dictionary _deathRecords = new Dictionary(); + private const float MaxReviveTime = 60f; + private const float RaycastDistance = 2.5f; + protected override void SubscribeEvents() { Exiled.Events.Handlers.Player.UsingItem += OnUsingItem; - Exiled.Events.Handlers.Player.Dying += OnDeathEvent; - Exiled.Events.Handlers.Player.Spawned += OnSpawningEvent; + Exiled.Events.Handlers.Player.Dying += OnDying; base.SubscribeEvents(); } protected override void UnsubscribeEvents() { Exiled.Events.Handlers.Player.UsingItem -= OnUsingItem; - Exiled.Events.Handlers.Player.Dying -= OnDeathEvent; - Exiled.Events.Handlers.Player.Spawned -= OnSpawningEvent; + Exiled.Events.Handlers.Player.Dying -= OnDying; base.UnsubscribeEvents(); } - private void OnDeathEvent(DyingEventArgs ev) + private void OnDying(DyingEventArgs ev) { - positionMort.TryAdd(ev.Player, ev.Player.Position); - } + if (ev.Player == null) return; - private void OnSpawningEvent(SpawnedEventArgs ev) - { - if (ev.Player.IsAlive) + _deathRecords[ev.Player] = new DeathData { - - positionMort.TryRemove(ev.Player, out _); - } + Time = Time.time, + Role = ev.Player.Role.Type + }; } private void OnUsingItem(UsingItemEventArgs ev) { - if (!Check(ev.Player.CurrentItem)) - { - return; - } + if (!Check(ev.Item)) return; + ev.IsAllowed = false; + + Log.Debug($"[Defib] Tentative par {ev.Player.Nickname}"); - Timing.CallDelayed(1f, () => + if (Physics.Raycast(ev.Player.CameraTransform.position, ev.Player.CameraTransform.forward, out RaycastHit hit, RaycastDistance)) { - ev.IsAllowed = false; - ev.Player.RemoveItem(ev.Item); + Log.Debug($"[Defib] Raycast a touché : {hit.collider.name}"); + + Collider[] colliders = Physics.OverlapSphere(hit.point, 2.5f); + BasicRagdoll foundRagdoll = null; + + foreach (Collider col in colliders) + { + foundRagdoll = col.GetComponentInParent(); + if (foundRagdoll != null) break; + } + + if (foundRagdoll != null) + { + Player target = Player.Get(foundRagdoll.NetworkInfo.OwnerHub); + Log.Debug($"[Defib] Cadavre trouvé ! Owner: {(target != null ? target.Nickname : "Inconnu")}"); - Timing.RunCoroutine(EffectAttribution(ev.Player)); - }); + if (target != null && target.Role.Type == RoleTypeId.Spectator && _deathRecords.TryGetValue(target, out DeathData data)) + { + if (Time.time - data.Time <= MaxReviveTime) + { + Log.Debug("[Defib] RÉANIMATION LANCÉE."); + ev.Player.RemoveItem(ev.Item); + Timing.RunCoroutine(ReviveSequence(ev.Player, target, foundRagdoll, data.Role)); + return; + } + KECustomItem.ItemEffectHint(ev.Player, "Mort trop ancienne."); + return; + } + } + } + + KECustomItem.ItemEffectHint(ev.Player, "Rapprochez-vous ou visez un cadavre."); } - private IEnumerator EffectAttribution(Player joueur) + private IEnumerator ReviveSequence(Player medic, Player patient, BasicRagdoll ragdoll, RoleTypeId previousRole) { - joueur.DisableEffect(EffectType.Scp1853); - Log.Debug("Utilisation item"); - Log.Debug("Nombre de mort : " + positionMort.Count()); + Vector3 lightPos = ragdoll.CenterPoint.position + Vector3.up * 0.75f; + var shockLight = LabApi.Features.Wrappers.LightSourceToy.Create(lightPos); + shockLight.Color = UnityEngine.Color.cyan; + shockLight.Intensity = 50f; + shockLight.Range = 7f; + shockLight.Spawn(); + + KECustomItem.ItemEffectHint(medic, "Réanimation en cours..."); - if (positionMort.Count == 0) + float elapsed = 0f; + while (elapsed < 1.0f) { - joueur.ItemEffectHint("There is no death"); - Exiled.CustomItems.API.Features.CustomItem.TryGive(joueur, 1041); + if (Vector3.Distance(medic.Position, ragdoll.transform.position) > RaycastDistance + 1f) + { + KECustomItem.ItemEffectHint(medic, "Réanimation échouée !"); + shockLight.Destroy(); + CustomItem.TryGive(medic, Id); + yield break; + } + + shockLight.Intensity = (elapsed % 0.2f > 0.1f) ? 100f : 20f; + + elapsed += 0.1f; + yield return Timing.WaitForSeconds(0.1f); } - else - { - var playerPosition = joueur.Position; - Exiled.API.Features.Player closestDeadPlayer = null; - float shortestDistance = float.MaxValue; + shockLight.Intensity = 200f; - foreach (var dead in positionMort) - { - float distance = Vector3.Distance(playerPosition, dead.Value); + yield return Timing.WaitForSeconds(0.2f); + shockLight.Destroy(); + patient.Role.Set(previousRole, SpawnReason.Revived, RoleSpawnFlags.All); - if (distance < shortestDistance) - { - shortestDistance = distance; - closestDeadPlayer = dead.Key; - } - } + yield return Timing.WaitForSeconds(0.4f); - if (closestDeadPlayer != null) - { - Log.Debug($"Le joueur mort le plus proche est à une distance de {shortestDistance:F2} unités. C'est : " + closestDeadPlayer.Nickname); + if (patient == null) yield break; - closestDeadPlayer.IsGodModeEnabled = true; - closestDeadPlayer.Role.Set(joueur.Role); - closestDeadPlayer.Health = 40; + if (patient.IsAlive) + { + patient.Position = ragdoll.transform.position + Vector3.up * 0.5f; - closestDeadPlayer.Teleport(joueur.Position); + patient.Health = 20f; + patient.EnableEffect(EffectType.Flashed, 2f); + patient.EnableEffect(EffectType.Concussed, 20f); + patient.EnableEffect(EffectType.Deafened, 20f); - closestDeadPlayer.ItemEffectHint(joueur.Nickname + " revived you!"); - joueur.ItemEffectHint("You revived " + closestDeadPlayer.Nickname + "!"); + KECustomItem.ItemEffectHint(patient, $"Réanimé par {medic.Nickname}\nvous avez des traumatisme crânien"); + KECustomItem.ItemEffectHint(medic, $"Réanimation réussie sur {patient.Nickname} !"); - yield return Timing.WaitForSeconds(1); + _deathRecords.Remove(patient); - closestDeadPlayer.IsGodModeEnabled = false; + if (ragdoll != null) + { + Object.Destroy(ragdoll.gameObject); } } + else + { + Log.Error($"[Defib] ÉCHEC : Le joueur {patient.Nickname} n'a pas spawn."); + } } } \ No newline at end of file diff --git a/KruacentExiled/KE.Items/Items/RedbullEnergy.cs b/KruacentExiled/KE.Items/Items/RedbullEnergy.cs new file mode 100644 index 00000000..9b6c5ac7 --- /dev/null +++ b/KruacentExiled/KE.Items/Items/RedbullEnergy.cs @@ -0,0 +1,71 @@ +using System.Collections.Generic; +using Exiled.API.Enums; +using Exiled.API.Features.Attributes; +using Exiled.API.Features.Spawn; +using Exiled.CustomItems.API.Features; +using Exiled.Events.EventArgs.Player; +using KE.Items.Features; +using KE.Items.Interface; +using KE.Items.ItemEffects; + +namespace KE.Items.Items +{ + [CustomItem(ItemType.SCP207)] + public class RedbullEnergy : KECustomItem, ISwichableEffect + { + public override uint Id { get; set; } = 1042; + public override string Name { get; set; } = "RedBull Energy"; + public override string Description { get; set; } = "RedBull donne des ailes ! Attention à la chute !!!"; + public override float Weight { get; set; } = 0.65f; + public UnityEngine.Color Color { get; set; } = UnityEngine.Color.blue; + public CustomItemEffect Effect { get; set; } + + public override SpawnProperties SpawnProperties { get; set; } = new SpawnProperties() + { + Limit = 2, + RoomSpawnPoints = new List + { + new RoomSpawnPoint() { Room = RoomType.EzStraight, Chance = 25 }, + new RoomSpawnPoint() { Room = RoomType.LczCrossing, Chance = 25 }, + }, + LockerSpawnPoints = new List + { + new LockerSpawnPoint { Chance = 20, UseChamber = true, Type = LockerType.Medkit, Zone = ZoneType.Entrance }, + new LockerSpawnPoint { Chance = 30, UseChamber = true, Type = LockerType.Misc, Zone = ZoneType.LightContainment} + } + }; + + public RedbullEnergy() + { + Effect = new RedBullEnergyEffect(); + } + + protected override void SubscribeEvents() + { + Exiled.Events.Handlers.Player.UsedItem += OnUsedItem; + Exiled.Events.Handlers.Player.Hurting += OnHurting; + Exiled.Events.Handlers.Player.Dying += OnDying; + Exiled.Events.Handlers.Player.Left += OnLeft; + base.SubscribeEvents(); + } + + protected override void UnsubscribeEvents() + { + Exiled.Events.Handlers.Player.UsedItem -= OnUsedItem; + Exiled.Events.Handlers.Player.Hurting -= OnHurting; + Exiled.Events.Handlers.Player.Dying -= OnDying; + Exiled.Events.Handlers.Player.Left -= OnLeft; + base.UnsubscribeEvents(); + } + + private void OnUsedItem(UsedItemEventArgs ev) + { + if (!Check(ev.Item)) return; + Effect.Effect(ev); + } + + private void OnHurting(HurtingEventArgs ev) => (Effect as RedBullEnergyEffect)?.OnHurting(ev); + private void OnDying(DyingEventArgs ev) => (Effect as RedBullEnergyEffect)?.Cleanup(ev.Player); + private void OnLeft(LeftEventArgs ev) => (Effect as RedBullEnergyEffect)?.Cleanup(ev.Player); + } +} \ No newline at end of file From bb549f4741748af3ac6c1d5e36f76070ce822b13 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Thu, 18 Dec 2025 20:19:56 +0100 Subject: [PATCH 471/853] added custom position in rooms --- .../KE.Items/API/Features/KECustomGrenade.cs | 48 ++++++ .../KE.Items/API/Features/KECustomItem.cs | 68 +++++--- .../KE.Items/API/Features/ReplaceItem.cs | 20 --- .../SpawnPoints/PoseRoomSpawnPoint.cs | 158 ++++++++++++++++++ KruacentExiled/KE.Items/CommandPos.cs | 46 +++++ KruacentExiled/KE.Items/CommandPosRoom.cs | 49 ++++++ KruacentExiled/KE.Items/Items/Defibrilator.cs | 11 +- .../ItemEffects/LowGravityGrenadeEffect.cs | 40 +++-- .../Items/ItemEffects/RedbullEnergyEffect.cs | 6 +- .../Items/ItemEffects/TPGrenadaEffect.cs | 32 ++-- .../KE.Items/Items/LowGravityGrenade.cs | 1 + KruacentExiled/KE.Items/Items/Molotov.cs | 2 +- .../KE.Items/Items/RedbullEnergy.cs | 6 +- KruacentExiled/KE.Items/MainPlugin.cs | 32 +++- 14 files changed, 424 insertions(+), 95 deletions(-) delete mode 100644 KruacentExiled/KE.Items/API/Features/ReplaceItem.cs create mode 100644 KruacentExiled/KE.Items/API/Features/SpawnPoints/PoseRoomSpawnPoint.cs create mode 100644 KruacentExiled/KE.Items/CommandPos.cs create mode 100644 KruacentExiled/KE.Items/CommandPosRoom.cs diff --git a/KruacentExiled/KE.Items/API/Features/KECustomGrenade.cs b/KruacentExiled/KE.Items/API/Features/KECustomGrenade.cs index 48b9552e..a034c580 100644 --- a/KruacentExiled/KE.Items/API/Features/KECustomGrenade.cs +++ b/KruacentExiled/KE.Items/API/Features/KECustomGrenade.cs @@ -1,7 +1,13 @@ using Exiled.API.Features; +using Exiled.API.Features.Pickups; +using Exiled.API.Features.Spawn; using Exiled.CustomItems.API.Features; using Exiled.Events.EventArgs.Map; using Exiled.Events.EventArgs.Player; +using KE.Items.API.Features.SpawnPoints; +using System.Collections.Generic; +using System.Linq; +using static KE.Items.API.Features.SpawnPoints.PoseRoomSpawnPointHandler; namespace KE.Items.API.Features { @@ -21,6 +27,48 @@ protected override void UnsubscribeEvents() base.UnsubscribeEvents(); } + public override uint Spawn(IEnumerable spawnPoints, uint limit) + { + Log.Debug($"spawning {this.Name}"); + HashSet spawns = spawnPoints.ToHashSet(); + uint num = 0; + foreach (SpawnPoint spawnpoint in spawnPoints.Where(sp => sp is RoomSpawnPoint)) + { + Pickup pickup; + if (Exiled.Loader.Loader.Random.NextDouble() * 100.0 >= (double)spawnpoint.Chance || (limit != 0 && num >= limit)) + { + continue; + } + spawns.Remove(spawnpoint); + RoomSpawnPoint room = spawnpoint as RoomSpawnPoint; + ItemSpawn spawn = PoseRoomSpawnPointHandler.UseRandomPose(room.Room); + + Log.Debug($"spawning {this.Name} in {room.Room}"); + Log.Debug(room.Room + " : " + PoseRoomSpawnPointHandler.usablePose.Count(p => p.roomType == room.Room)); + + if (spawn is not null) + { + Log.Debug($"spawning custom pos"); + pickup = Spawn(spawn.Position); + } + else + { + Log.Error($"can't spawn in custom"); + pickup = Spawn(spawnpoint.Position); + } + + + + if (pickup is not null) + { + num++; + } + + + } + + return base.Spawn(spawns, limit - num); + } protected void InternalOnHurting(HurtingEventArgs ev) diff --git a/KruacentExiled/KE.Items/API/Features/KECustomItem.cs b/KruacentExiled/KE.Items/API/Features/KECustomItem.cs index 0eca1292..847f5ddc 100644 --- a/KruacentExiled/KE.Items/API/Features/KECustomItem.cs +++ b/KruacentExiled/KE.Items/API/Features/KECustomItem.cs @@ -1,25 +1,21 @@ using Exiled.API.Features; +using Exiled.API.Features.Spawn; using Exiled.CustomItems.API.Features; -using MHints = HintServiceMeow.Core.Models.Hints.Hint; -using System.Text; -using KE.Utils.API.Displays.DisplayMeow; -using MEC; -using HintServiceMeow.Core.Extension; -using HintServiceMeow.Core.Utilities; -using System.Reflection; +using KE.Items.API.Features.SpawnPoints; using KE.Items.API.Interface; +using KE.Utils.API.Displays.DisplayMeow; using System.Collections.Generic; using System.Linq; -using Exiled.API.Features.Pickups; +using System.Text; using UnityEngine; -using Exiled.API.Features.Spawn; +using static KE.Items.API.Features.SpawnPoints.PoseRoomSpawnPointHandler; +using Pickup = Exiled.API.Features.Pickups.Pickup; namespace KE.Items.API.Features { public abstract class KECustomItem : CustomItem { - public virtual IEnumerable RoomsToReplaceItems { get; protected set; } = null; protected override void ShowPickedUpMessage(Player player) { Log.Debug("pickup"); @@ -33,32 +29,50 @@ protected override void ShowSelectedMessage(Player player) } - public override void SpawnAll() + public override uint Spawn(IEnumerable spawnPoints, uint limit) { - if(RoomsToReplaceItems != null) + Log.Debug($"spawning {this.Name}"); + HashSet spawns = spawnPoints.ToHashSet(); + uint num = 0; + foreach (SpawnPoint spawnpoint in spawnPoints.Where(sp => sp is RoomSpawnPoint)) { - foreach(ReplaceItem replaceItem in RoomsToReplaceItems) + Pickup pickup; + if (Exiled.Loader.Loader.Random.NextDouble() * 100.0 >= (double)spawnpoint.Chance || (limit != 0 && num >= limit)) { - foreach(Room room in Room.List.Where(r => r.Type == replaceItem.Room)) - { - uint limit = 0; - foreach(Pickup pickup in room.Pickups.Where(p => p.Type == replaceItem.ItemToReplace)) - { - if (limit <= replaceItem.LimitPerRoom && Exiled.Loader.Loader.Random.NextDouble() * 100.0 >= (double)replaceItem.Chance) - { - ReplacePickup(pickup); - limit++; - } - } - } + continue; } - } + spawns.Remove(spawnpoint); + RoomSpawnPoint room = spawnpoint as RoomSpawnPoint; + ItemSpawn spawn = PoseRoomSpawnPointHandler.UseRandomPose(room.Room); + Log.Debug(room.Room+ " : "+PoseRoomSpawnPointHandler.usablePose.Count(p => p.roomType == room.Room)); + Log.Debug($"spawning {this.Name} in {room.Room}" ); + + if (spawn is not null) + { + Log.Debug($"spawning custom pos"); + pickup = Spawn(spawn.Position); + } + else + { + Log.Error($"can't spawn in custom"); + pickup = Spawn(spawnpoint.Position); + } + - base.SpawnAll(); + if (pickup is not null) + { + num++; + } + + + } + + return base.Spawn(spawns, limit-num); } + public void ReplacePickup(Pickup pickup) { Vector3 position = pickup.Position; diff --git a/KruacentExiled/KE.Items/API/Features/ReplaceItem.cs b/KruacentExiled/KE.Items/API/Features/ReplaceItem.cs deleted file mode 100644 index 3595952c..00000000 --- a/KruacentExiled/KE.Items/API/Features/ReplaceItem.cs +++ /dev/null @@ -1,20 +0,0 @@ -using Exiled.API.Enums; -using Exiled.API.Features.Spawn; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using UnityEngine; - -namespace KE.Items.API.Features -{ - public class ReplaceItem - { - public float Chance { get; set; } - public RoomType Room { get; set; } - public uint LimitPerRoom { get; set; } - - public ItemType ItemToReplace { get; set; } - } -} diff --git a/KruacentExiled/KE.Items/API/Features/SpawnPoints/PoseRoomSpawnPoint.cs b/KruacentExiled/KE.Items/API/Features/SpawnPoints/PoseRoomSpawnPoint.cs new file mode 100644 index 00000000..cc96013f --- /dev/null +++ b/KruacentExiled/KE.Items/API/Features/SpawnPoints/PoseRoomSpawnPoint.cs @@ -0,0 +1,158 @@ +using Exiled.API.Enums; +using Exiled.API.Extensions; +using Exiled.API.Features; +using Exiled.API.Features.Toys; +using MEC; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using UnityEngine; + +namespace KE.Items.API.Features.SpawnPoints +{ + public static class PoseRoomSpawnPointHandler + { + public class ItemSpawn : IEquatable + { + public readonly RoomType roomType; + + //item position in the room at 0° + public readonly Vector3 localposition; + //item rotation + public readonly Quaternion localrotation; + + + private Room room; + + public ItemSpawn(RoomType roomType,Vector3 position,Quaternion rotation) + { + this.roomType = roomType; + this.localposition = position; + this.localrotation = rotation; + } + + private Room Room + { + get + { + if(room is null) + { + room = Room.List.FirstOrDefault(r => r.Type == roomType); + if (room is null) throw new Exception($"room ({roomType}) not found"); + } + return room; + } + } + + public Vector3 Position + { + get + { + return Room.Position + room.Rotation * localposition; + } + } + + public Quaternion Rotation + { + get + { + return Room.Rotation * localrotation; + } + } + + public bool Equals(ItemSpawn other) + { + return other.roomType == roomType && other.localposition == localposition && other.localrotation == localrotation; + } + } + + public static readonly HashSet AllPoses = new(); + private static HashSet UsablePoses = new(); + public static IReadOnlyCollection usablePose => UsablePoses; + + public static ItemSpawn UseRandomPose(RoomType roomType) + { + + if (UsablePoses.Count(r => r.roomType == roomType) <= 0) + { + return null; + } + Log.Debug("count before =" + UsablePoses.Count(r => r.roomType == roomType)); + ItemSpawn result = UsablePoses.GetRandomValue(r => r.roomType == roomType); + UsablePoses.Remove(result); + Log.Debug("count after =" + UsablePoses.Count(r => r.roomType == roomType)); + return result; + + } + + public static Vector3 ConvertLocal(Pose pose, Quaternion newRot) + { + + Vector3 originalLocal = pose.position; + Quaternion originalRot = pose.rotation; + Vector3 worldPos = originalRot * originalLocal; + + return Quaternion.Inverse(newRot) * worldPos; + } + /// + /// + /// + /// + /// add the poses should be from a zero rotation room + public static void AddRoomPoses(HashSet poses) + { + + + + foreach(ItemSpawn item in poses) + { + AllPoses.Add(item); + UsablePoses.Add(item); + } + + } + + public static void ShowPoses(RoomType roomType) + { + List primitives = new(); + Room room = Room.Get(roomType); + foreach (ItemSpawn pose in AllPoses.Where(p => p.roomType == roomType)) + { + + + Log.Info(pose.localposition); + Log.Info(pose.Position); + Color color = Color.red; + + if (UsablePoses.Contains(pose)) + { + color = Color.green; + } + + + Primitive prim = Primitive.Create(pose.Position, null, Vector3.one * .1f, false, color); + + prim.Spawn(); + primitives.Add(prim); + + + } + + + Timing.CallDelayed(5, delegate + { + foreach(Primitive primive in primitives) + { + primive.Destroy(); + } + }); + } + + + } + + + +} diff --git a/KruacentExiled/KE.Items/CommandPos.cs b/KruacentExiled/KE.Items/CommandPos.cs new file mode 100644 index 00000000..4e2d47fd --- /dev/null +++ b/KruacentExiled/KE.Items/CommandPos.cs @@ -0,0 +1,46 @@ +using CommandSystem; +using Exiled.API.Features; +using Exiled.API.Features.Toys; +using MEC; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using UnityEngine; + +namespace KE.Items +{ + + [CommandHandler(typeof(RemoteAdminCommandHandler))] + internal class CommandPos : ICommand + { + public string Command => "curpos"; + + public string[] Aliases => []; + + public string Description => "position"; + + public bool Execute(ArraySegment arguments, ICommandSender sender, out string response) + { + var p = Player.Get(sender); + response = string.Empty; + + if(p is not null) + { + Primitive prim = Primitive.Create(p.Position, null, Vector3.one * .1f, true); + + Timing.CallDelayed(3f,prim.Destroy); + + response = p.CurrentRoom.Type + + "\n" + p.CurrentRoom.LocalPosition(p.Position) + + "\n" + p.CurrentRoom.Rotation.eulerAngles + + "\n" + p.Position.ToString() + + "\n" + p.CurrentRoom.LocalPosition(p.Position); + return true; + } + response = "no"; + return false; + } + } +} diff --git a/KruacentExiled/KE.Items/CommandPosRoom.cs b/KruacentExiled/KE.Items/CommandPosRoom.cs new file mode 100644 index 00000000..0a0d1f91 --- /dev/null +++ b/KruacentExiled/KE.Items/CommandPosRoom.cs @@ -0,0 +1,49 @@ +using CommandSystem; +using Exiled.API.Enums; +using Exiled.API.Features; +using Exiled.API.Features.Toys; +using KE.Items.API.Features.SpawnPoints; +using MEC; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using UnityEngine; + +namespace KE.Items.Patches +{ + + [CommandHandler(typeof(RemoteAdminCommandHandler))] + internal class CommandPos : ICommand + { + public string Command => "posroom"; + + public string[] Aliases => []; + + public string Description => "position"; + + public bool Execute(ArraySegment arguments, ICommandSender sender, out string response) + { + var p = Player.Get(sender); + response = string.Empty; + + if(p is not null) + { + Room room = p.CurrentRoom; + + if(room is null) + { + response = "no room"; + return false; + } + + PoseRoomSpawnPointHandler.ShowPoses(room.Type); + response= "ok"; + return true; + } + response = "no"; + return false; + } + } +} diff --git a/KruacentExiled/KE.Items/Items/Defibrilator.cs b/KruacentExiled/KE.Items/Items/Defibrilator.cs index 628bcca9..8e736b17 100644 --- a/KruacentExiled/KE.Items/Items/Defibrilator.cs +++ b/KruacentExiled/KE.Items/Items/Defibrilator.cs @@ -1,16 +1,17 @@ using Exiled.API.Enums; -using Exiled.API.Extensions; using Exiled.API.Features; using Exiled.API.Features.Attributes; using Exiled.API.Features.Spawn; using Exiled.CustomItems.API.Features; using Exiled.Events.EventArgs.Player; -using Exiled.API.Features; using UnityEngine; using System.Linq; -using KE.Items.Interface; -using KE.Items.Extensions; -using KE.Items.Features; +using KE.Items.API.Interface; +using KE.Items.API.Features; +using System.Collections.Generic; +using PlayerRoles.Ragdolls; +using PlayerRoles; +using MEC; [CustomItem(ItemType.SCP1853)] public class Defibrillator : KECustomItem, ILumosItem diff --git a/KruacentExiled/KE.Items/Items/ItemEffects/LowGravityGrenadeEffect.cs b/KruacentExiled/KE.Items/Items/ItemEffects/LowGravityGrenadeEffect.cs index 3890ec7a..2f83ac0c 100644 --- a/KruacentExiled/KE.Items/Items/ItemEffects/LowGravityGrenadeEffect.cs +++ b/KruacentExiled/KE.Items/Items/ItemEffects/LowGravityGrenadeEffect.cs @@ -7,46 +7,52 @@ using UnityEngine; using PlayerLab = LabApi.Features.Wrappers.Player; -namespace KE.Items.ItemEffects +namespace KE.Items.Items.ItemEffects { public class LowGravityGrenadeEffect : CustomItemEffect { - private Dictionary _effectedPlayers = new(); + private Dictionary _effectedPlayers = new(); public Vector3 LowGravity { get; set; } = new(0, -12.6f, 0); public float Duration { get; set; } = 15f; public float Range { get; set; } = 10f; public override void Effect(UsedItemEventArgs ev) { - OnExploding(ev.Player, ev.Player.Position); + OnExploding(ev.Player); } public override void Effect(DroppingItemEventArgs ev) { - OnExploding(ev.Player, ev.Player.Position); + OnExploding(ev.Player); } public override void Effect(ExplodingGrenadeEventArgs ev) { ev.IsAllowed = false; - OnExploding(ev.Player, ev.Position); + + foreach(Player player in ev.TargetsToAffect) + { + OnExploding(ev.Player); + } + + } - public void OnExploding(Player thrownPlayer, Vector3 position) + public void OnExploding(PlayerLab player) { - foreach (Player player in Player.List) + if (player is null) return; + + Vector3 previousGravity = player.Gravity; + _effectedPlayers[player] = previousGravity; + player.Gravity = LowGravity; + Timing.CallDelayed(Duration, () => { - if (Vector3.Distance(position, player.Position) <= this.Range) + if (player is not null) { - Vector3 previousGravity = PlayerLab.Get(player.NetworkIdentity)!.Gravity; - _effectedPlayers[player] = previousGravity; - PlayerLab.Get(player.NetworkIdentity)!.Gravity = LowGravity; - Timing.CallDelayed(this.Duration, () => - { - PlayerLab.Get(thrownPlayer.NetworkIdentity)!.Gravity = _effectedPlayers[thrownPlayer]; - _effectedPlayers.Remove(thrownPlayer); - }); + player.Gravity = _effectedPlayers[player]; + _effectedPlayers.Remove(player); } - } + + }); } } } \ No newline at end of file diff --git a/KruacentExiled/KE.Items/Items/ItemEffects/RedbullEnergyEffect.cs b/KruacentExiled/KE.Items/Items/ItemEffects/RedbullEnergyEffect.cs index 8cff2e38..212a0fd8 100644 --- a/KruacentExiled/KE.Items/Items/ItemEffects/RedbullEnergyEffect.cs +++ b/KruacentExiled/KE.Items/Items/ItemEffects/RedbullEnergyEffect.cs @@ -4,13 +4,13 @@ using Exiled.API.Features.Items; using Exiled.Events.EventArgs.Map; using Exiled.Events.EventArgs.Player; -using KE.Items.Features; -using KE.Items.Interface; +using KE.Items.API.Features; +using KE.Items.API.Interface; using MEC; using System.Collections.Generic; using UnityEngine; -namespace KE.Items.ItemEffects +namespace KE.Items.Items.ItemEffects { public class RedBullEnergyEffect : CustomItemEffect { diff --git a/KruacentExiled/KE.Items/Items/ItemEffects/TPGrenadaEffect.cs b/KruacentExiled/KE.Items/Items/ItemEffects/TPGrenadaEffect.cs index 6d1443d7..0185acaa 100644 --- a/KruacentExiled/KE.Items/Items/ItemEffects/TPGrenadaEffect.cs +++ b/KruacentExiled/KE.Items/Items/ItemEffects/TPGrenadaEffect.cs @@ -6,13 +6,10 @@ using Exiled.Events.EventArgs.Map; using Exiled.Events.EventArgs.Player; using KE.Items.API.Interface; +using KE.Utils.Extensions; using PlayerRoles; using System; using System.Collections.Generic; -using System.ComponentModel; -using System.Linq; -using System.Text; -using System.Threading.Tasks; using UnityEngine; namespace KE.Items.Items.ItemEffects @@ -20,7 +17,6 @@ namespace KE.Items.Items.ItemEffects public class TPGrenadaEffect : CustomItemEffect { private List effectedPlayers = new List(); - [Description("What roles will not be able to be affected by Implosion Grenades. Keeping SCP-173 on this list is highly recommended.")] public HashSet BlacklistedRoles { get; set; } = new HashSet() { RoleTypeId.Scp173, RoleTypeId.Scp106, RoleTypeId.Scp049, RoleTypeId.Scp096, RoleTypeId.Scp3114, RoleTypeId.Scp0492, RoleTypeId.Scp939 }; public HashSet BlacklistedRooms { get; } = new() @@ -65,7 +61,7 @@ private void OnExploding(HashSet targets, EffectGrenadeProjectile projec if (line) { effectedPlayers.Add(player); - player.Teleport(RandomRoom()); + player.Teleport(RandomRoom().GetValidPosition()); } } catch (Exception exception) @@ -79,10 +75,10 @@ private void OnExploding(HashSet targets, EffectGrenadeProjectile projec private Room RandomRoom() { - Room room = Room.List.GetRandomValue((r) => !BlacklistedRooms.Contains(r.Type)); + Room room = Room.List.GetRandomValue((r) => !BlacklistedRooms.Contains(r.Type) && r.IsSafe()); if (Warhead.IsDetonated) { - return RandomRoom(ZoneType.Surface); + return ZoneType.Surface.RandomSafeRoom(); } if (Map.IsLczDecontaminated) @@ -91,23 +87,23 @@ private Room RandomRoom() Log.Debug($"random={random}"); if (random <= 0.33f) { - return RandomRoom(ZoneType.HeavyContainment); + room = ZoneType.HeavyContainment.RandomSafeRoom(); } - if (random > 0.33f && random <= 0.66f) + else if (random > 0.33f && random <= 0.66f) { - return RandomRoom(ZoneType.Entrance); + + + room = ZoneType.Entrance.RandomSafeRoom(); + } + else + { + room = ZoneType.Surface.RandomSafeRoom(); } - return RandomRoom(ZoneType.Surface); + } Log.Debug($"roomZone={room.Zone}"); return room; } - - - private Room RandomRoom(ZoneType zone) - { - return Room.List.GetRandomValue((r) => !BlacklistedRooms.Contains(r.Type) && r.Zone == zone); - } } } diff --git a/KruacentExiled/KE.Items/Items/LowGravityGrenade.cs b/KruacentExiled/KE.Items/Items/LowGravityGrenade.cs index 56675bc9..3f485bb2 100644 --- a/KruacentExiled/KE.Items/Items/LowGravityGrenade.cs +++ b/KruacentExiled/KE.Items/Items/LowGravityGrenade.cs @@ -7,6 +7,7 @@ using KE.Items.API.Features; using KE.Items.API.Interface; using KE.Items.ItemEffects; +using KE.Items.Items.ItemEffects; namespace KE.Items.Items { diff --git a/KruacentExiled/KE.Items/Items/Molotov.cs b/KruacentExiled/KE.Items/Items/Molotov.cs index 228f9349..51bff295 100644 --- a/KruacentExiled/KE.Items/Items/Molotov.cs +++ b/KruacentExiled/KE.Items/Items/Molotov.cs @@ -61,7 +61,7 @@ public class Molotov : KECustomGrenade, ISwichableEffect/*, ICustomPickupModel*/ }, new RoomSpawnPoint() { - Chance = 50, + Chance = 100, Room = RoomType.HczNuke, }, }, diff --git a/KruacentExiled/KE.Items/Items/RedbullEnergy.cs b/KruacentExiled/KE.Items/Items/RedbullEnergy.cs index 9b6c5ac7..601c9b12 100644 --- a/KruacentExiled/KE.Items/Items/RedbullEnergy.cs +++ b/KruacentExiled/KE.Items/Items/RedbullEnergy.cs @@ -4,9 +4,9 @@ using Exiled.API.Features.Spawn; using Exiled.CustomItems.API.Features; using Exiled.Events.EventArgs.Player; -using KE.Items.Features; -using KE.Items.Interface; -using KE.Items.ItemEffects; +using KE.Items.API.Features; +using KE.Items.API.Interface; +using KE.Items.Items.ItemEffects; namespace KE.Items.Items { diff --git a/KruacentExiled/KE.Items/MainPlugin.cs b/KruacentExiled/KE.Items/MainPlugin.cs index 1a43b9b2..058a0b1c 100644 --- a/KruacentExiled/KE.Items/MainPlugin.cs +++ b/KruacentExiled/KE.Items/MainPlugin.cs @@ -10,6 +10,7 @@ using KE.Items.API.Core.Upgrade; using KE.Items.API.Events; using KE.Items.API.Features.Complexes; +using KE.Items.API.Features.SpawnPoints; using KE.Utils.API.Displays.DisplayMeow; using System; using System.Linq; @@ -53,7 +54,29 @@ public override void OnEnabled() Utils.API.Sounds.SoundPlayer.Load(); - + PoseRoomSpawnPointHandler.AddRoomPoses(new() + { + new(RoomType.Lcz914,new Vector3(0,0.70f,-7.14f),Quaternion.identity), + new(RoomType.LczGlassBox,new Vector3(7.39f,0.75f,-5.89f),Quaternion.identity), + new(RoomType.LczGlassBox,new Vector3(8.71f,1.2f,-5.89f),Quaternion.identity), + new(RoomType.Lcz173,new Vector3(7.39f,0.75f,-5.89f),Quaternion.identity), + new(RoomType.EzUpstairsPcs,new Vector3(-2.09f,0.75f,-7f),Quaternion.identity), + new(RoomType.EzUpstairsPcs,new Vector3(-4,1.1f,-0.36f),Quaternion.identity), + new(RoomType.EzGateB,new Vector3(-0.68f,1.33f,4f),Quaternion.identity), + new(RoomType.EzChef,new Vector3(2.36f,.2f,-0.16f),Quaternion.identity), + new(RoomType.HczStraightPipeRoom,new Vector3(6.1f,1.05f,-4.8f),Quaternion.identity), + new(RoomType.HczStraightPipeRoom,new Vector3(-4f,0.23f,-4.52f),Quaternion.identity), + new(RoomType.HczServerRoom,new Vector3(1.79f,0.78f,-0.6f),Quaternion.identity), + new(RoomType.HczNuke,new Vector3(12.11f,-75.11f,2.6f),Quaternion.identity), + new(RoomType.HczNuke,new Vector3(11.06f,-74.85f,-2.5f),Quaternion.identity), + new(RoomType.Surface,new Vector3(27.45f,-8.07f,24.96f),Quaternion.identity), + new(RoomType.Surface,new Vector3(27.45f,-8.07f,-23.62f),Quaternion.identity), + new(RoomType.Surface,new Vector3(27.45f,-8.07f,-23.62f),Quaternion.identity), + new(RoomType.HczHid,new Vector3(-3.41f,5.68f,-2.3f),Quaternion.identity), + new(RoomType.HczHid,new Vector3(-6.44f,5.7f,-2.5f),Quaternion.identity), + new(RoomType.Hcz127,new Vector3(4.77f, 1.12f, 1.83f),Quaternion.identity), + new(RoomType.Hcz939,new Vector3(.6f, 1.3f, -2.8f),Quaternion.identity), + }); //Exiled.Events.Handlers.Server.RoundStarted += Test; @@ -63,6 +86,7 @@ public override void OnEnabled() SettingsHandler.SubscribeEvents(); UpgradeHandler.SubscribeEvents(); LightsHandler.SubscribeEvents(); + Exiled.Events.Handlers.Map.Generated += OnGenerated; base.OnEnabled(); } @@ -74,6 +98,7 @@ public override void OnDisabled() //PickupQuality?.UnsubscribeEvents(); //QualityHandler?.Unregister(); SettingsHandler.UnsubscribeEvents(); + Exiled.Events.Handlers.Map.Generated -= OnGenerated; //Exiled.Events.Handlers.Server.RoundStarted -= Test; @@ -86,6 +111,11 @@ public override void OnDisabled() Instance = null; } + private void OnGenerated() + { + + } + public void Test() { ComplexBase complex = new ComplexGatling(); From dc81c789000d3f21dbc23e1c3f5d3686dd930495 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Thu, 18 Dec 2025 20:43:01 +0100 Subject: [PATCH 472/853] reblaanec soems stuff --- .../CR/ChaosInsurgency/LeRusse.cs | 19 ++++++----- .../KE.CustomRoles/CR/ClassD/DBoyInShape.cs | 2 +- .../KE.CustomRoles/CR/ClassD/Mime.cs | 2 +- .../KE.CustomRoles/CR/Human/Diabetique.cs | 17 ++++++++++ .../KE.CustomRoles/CR/Human/Maladroit.cs | 32 +++++-------------- KruacentExiled/KE.CustomRoles/CR/MTF/Pilot.cs | 2 +- .../KE.CustomRoles/CR/SCP/SCP035.cs | 12 ++++++- .../KE.CustomRoles/CR/Scientist/scp202.cs | 8 +++-- 8 files changed, 55 insertions(+), 39 deletions(-) diff --git a/KruacentExiled/KE.CustomRoles/CR/ChaosInsurgency/LeRusse.cs b/KruacentExiled/KE.CustomRoles/CR/ChaosInsurgency/LeRusse.cs index 7a90313a..8034e164 100644 --- a/KruacentExiled/KE.CustomRoles/CR/ChaosInsurgency/LeRusse.cs +++ b/KruacentExiled/KE.CustomRoles/CR/ChaosInsurgency/LeRusse.cs @@ -23,18 +23,21 @@ public class Russe : KECustomRole, IColor public override Vector3 Scale { get; set; } = new Vector3(1.1f, 1f, 1.1f); public override List Inventory { get; set; } = new List() - { - $"{ItemType.GunRevolver}", - $"{ItemType.Radio}", - $"{ItemType.Adrenaline}", - $"{ItemType.KeycardChaosInsurgency}", - $"{ItemType.GrenadeHE}", - $"{ItemType.GrenadeHE}", + { + $"{ItemType.GunA7}", + $"{ItemType.ArmorCombat}", + $"{ItemType.GunRevolver}", + $"{ItemType.Radio}", + $"{ItemType.Adrenaline}", + $"{ItemType.KeycardChaosInsurgency}", + $"{ItemType.GrenadeHE}", + $"{ItemType.GrenadeHE}", }; public override Dictionary Ammo { get; set; } = new Dictionary() { - { AmmoType.Ammo44Cal, 18} + { AmmoType.Ammo44Cal, 18}, + { AmmoType.Nato762, 120} }; } } diff --git a/KruacentExiled/KE.CustomRoles/CR/ClassD/DBoyInShape.cs b/KruacentExiled/KE.CustomRoles/CR/ClassD/DBoyInShape.cs index 996c43ee..a8fb99d2 100644 --- a/KruacentExiled/KE.CustomRoles/CR/ClassD/DBoyInShape.cs +++ b/KruacentExiled/KE.CustomRoles/CR/ClassD/DBoyInShape.cs @@ -38,7 +38,7 @@ public class DBoyInShape : KECustomRole protected override void RoleAdded(Player player) { - player.EnableEffect(EffectType.Slowness, SpeedReduction,999999 ); + player.EnableEffect(EffectType.Slowness, SpeedReduction,-1 ); } protected override void RoleRemoved(Player player) diff --git a/KruacentExiled/KE.CustomRoles/CR/ClassD/Mime.cs b/KruacentExiled/KE.CustomRoles/CR/ClassD/Mime.cs index 2e06d227..b98b2695 100644 --- a/KruacentExiled/KE.CustomRoles/CR/ClassD/Mime.cs +++ b/KruacentExiled/KE.CustomRoles/CR/ClassD/Mime.cs @@ -27,7 +27,7 @@ public class Mime : KECustomRole, IColor protected override void RoleAdded(Player player) { - player.EnableEffect(EffectType.SilentWalk, -1, true); // doesn't work with SCP-939 (tested) + player.EnableEffect(EffectType.SilentWalk, -1, true); player.IsMuted = true; } diff --git a/KruacentExiled/KE.CustomRoles/CR/Human/Diabetique.cs b/KruacentExiled/KE.CustomRoles/CR/Human/Diabetique.cs index d88f6b63..8b243adf 100644 --- a/KruacentExiled/KE.CustomRoles/CR/Human/Diabetique.cs +++ b/KruacentExiled/KE.CustomRoles/CR/Human/Diabetique.cs @@ -2,9 +2,11 @@ using Exiled.API.Enums; using Exiled.API.Features; using Exiled.API.Features.Attributes; +using Exiled.API.Features.Pickups; using Exiled.CustomRoles.API.Features; using KE.CustomRoles.API.Features; using KE.CustomRoles.API.Interfaces; +using MEC; using PlayerRoles; using System.Collections.Generic; using UnityEngine; @@ -25,6 +27,21 @@ public class Diabetique : GlobalCustomRole, IColor, IHealable protected override void RoleAdded(Player player) { + + Timing.CallDelayed(KECustomRole.TimeAttributingInventory, () => + { + if (player.IsInventoryFull) + { + Pickup.CreateAndSpawn(ItemType.Medkit, player.Position); + } + else + { + player.AddItem(ItemType.Medkit); + } + + }); + + player.EnableEffect(EffectType.Scp207, -1, true); } protected override void RoleRemoved(Player player) diff --git a/KruacentExiled/KE.CustomRoles/CR/Human/Maladroit.cs b/KruacentExiled/KE.CustomRoles/CR/Human/Maladroit.cs index 7b327116..8161101b 100644 --- a/KruacentExiled/KE.CustomRoles/CR/Human/Maladroit.cs +++ b/KruacentExiled/KE.CustomRoles/CR/Human/Maladroit.cs @@ -22,7 +22,7 @@ public class Maladroit : GlobalCustomRole, IColor public override SideEnum Side { get; set; } = SideEnum.Human; public override string Description { get; set; } = "Fait attention à \"tes\" items !"; - public override string PublicName { get; set; } = "Maladroit Vole"; + public override string PublicName { get; set; } = "Maladroit Voleur"; public override bool KeepRoleOnDeath { get; set; } = false; public override bool KeepRoleOnChangingRole { get; set; } = false; public override float SpawnChance { get; set; } = 100; @@ -47,36 +47,20 @@ protected override void RoleRemoved(Player player) private IEnumerator ThrowingItem(Player p) { - Dictionary ActionDictionnary = new() - { - { 50, () => p.DropHeldItem() }, - { 80, () => { /* Nothing */ } }, - { 95, () => DropItemFromInventory(p, 1) }, - { 100, () => DropItemFromInventory(p, 2) }, - }; + while (p.IsAlive) { - yield return Timing.WaitForSeconds(UnityEngine.Random.Range(120f, 200f)); - int proba = UnityEngine.Random.Range(0, 101); - - foreach (var seuil in ActionDictionnary.Keys.OrderBy(p => p)) + yield return Timing.WaitForSeconds(UnityEngine.Random.Range(90f, 120f)); + + if(UnityEngine.Random.Range(0f, 100f) > .5f) { - if(proba < seuil) - { - ActionDictionnary[seuil](); - break; - } + p.DropHeldItem(); } - } - } + - private void DropItemFromInventory(Player p, int number) - { - for(int i = 0; i <= number; i++) - { - p.DropItem(p.Items.GetRandomValue()); + } } } diff --git a/KruacentExiled/KE.CustomRoles/CR/MTF/Pilot.cs b/KruacentExiled/KE.CustomRoles/CR/MTF/Pilot.cs index ee90d164..17a48199 100644 --- a/KruacentExiled/KE.CustomRoles/CR/MTF/Pilot.cs +++ b/KruacentExiled/KE.CustomRoles/CR/MTF/Pilot.cs @@ -16,7 +16,7 @@ public class Pilot : KECustomRole { public override string Description { get; set; } = "So I haveth a Laser Pointere"; public override string PublicName { get; set; } = "Pilot"; - public override int MaxHealth { get; set; } = 75; + public override int MaxHealth { get; set; } = 90; public override RoleTypeId Role { get; set; } = RoleTypeId.NtfPrivate; public override bool KeepRoleOnDeath { get; set; } = false; public override bool KeepRoleOnChangingRole { get; set; } = false; diff --git a/KruacentExiled/KE.CustomRoles/CR/SCP/SCP035.cs b/KruacentExiled/KE.CustomRoles/CR/SCP/SCP035.cs index 1b784092..ff86f8fa 100644 --- a/KruacentExiled/KE.CustomRoles/CR/SCP/SCP035.cs +++ b/KruacentExiled/KE.CustomRoles/CR/SCP/SCP035.cs @@ -1,6 +1,7 @@ using Exiled.API.Enums; using Exiled.API.Extensions; using Exiled.API.Features; +using Exiled.API.Features.Toys; using Exiled.Events.EventArgs.Player; using Exiled.Events.EventArgs.Scp1509; using Exiled.Events.EventArgs.Server; @@ -20,7 +21,7 @@ public class SCP035 : CustomSCP public override bool IsSupport => false; public override string PublicName { get; set; } = "SCP-035"; - public override int MaxHealth { get; set; } = 800; + public override int MaxHealth { get; set; } = 1300; public override string Description { get; set; } = "You can't pickup the Micro-HID and anything made with it, but you take 2 time less damage by these weapon"; protected override int SettingId => 10002; @@ -72,11 +73,20 @@ private void OnSearchingPickup(SearchingPickupEventArgs ev) { if (!Check(ev.Player)) return; + if (ev.Pickup.Type.IsScp()) + { + ShowEffectHint(ev.Player, "A strange force called 'game balance' stops you for picking up this item"); + ev.IsAllowed = false; + return; + } + + if (BlacklistedPickup.Contains(ev.Pickup.Type)) { ShowEffectHint(ev.Player, "This item can't be picked up"); ev.IsAllowed = false; return; + } } diff --git a/KruacentExiled/KE.CustomRoles/CR/Scientist/scp202.cs b/KruacentExiled/KE.CustomRoles/CR/Scientist/scp202.cs index 61084b60..aee31692 100644 --- a/KruacentExiled/KE.CustomRoles/CR/Scientist/scp202.cs +++ b/KruacentExiled/KE.CustomRoles/CR/Scientist/scp202.cs @@ -4,6 +4,7 @@ using Exiled.Events.EventArgs.Player; using KE.CustomRoles.API.Interfaces; using PlayerRoles; +using Exiled.API.Extensions; namespace KE.CustomRoles.CR.Scientist { @@ -17,9 +18,10 @@ public class Scp202 : KECustomRole, IColor public override bool KeepRoleOnChangingRole { get; set; } = true; public override float SpawnChance { get; set; } = 100; - public override Vector3 Scale { get; set; } = new Vector3(1, 1, 1); public Color32 Color => new Color32(191, 255, 183, 0); + public static readonly Vector3 scale = new(); + protected override void SubscribeEvents() { Exiled.Events.Handlers.Player.UsedItem += OnUsedItem; @@ -41,12 +43,12 @@ private void OnUsedItem(UsedItemEventArgs ev) } protected override void RoleAdded(Player player) { - player.Scale = new Vector3(1f, 1f, -1f); + player.SetFakeScale(scale, Player.Enumerable); } protected override void RoleRemoved(Player player) { - player.Scale = new Vector3(1f, 1f, 1f); + player.SetFakeScale(player.Scale, Player.Enumerable); } } From 62940c580f2538be85606ef956c225710d2e598a Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Thu, 18 Dec 2025 20:58:48 +0100 Subject: [PATCH 473/853] rebalanced scp035 --- .../KE.CustomRoles/CR/SCP/SCP035.cs | 50 +++++++++++++++++-- 1 file changed, 47 insertions(+), 3 deletions(-) diff --git a/KruacentExiled/KE.CustomRoles/CR/SCP/SCP035.cs b/KruacentExiled/KE.CustomRoles/CR/SCP/SCP035.cs index ff86f8fa..b3647cb8 100644 --- a/KruacentExiled/KE.CustomRoles/CR/SCP/SCP035.cs +++ b/KruacentExiled/KE.CustomRoles/CR/SCP/SCP035.cs @@ -2,6 +2,7 @@ using Exiled.API.Extensions; using Exiled.API.Features; using Exiled.API.Features.Toys; +using Exiled.CustomItems.API.Features; using Exiled.Events.EventArgs.Player; using Exiled.Events.EventArgs.Scp1509; using Exiled.Events.EventArgs.Server; @@ -33,7 +34,17 @@ public class SCP035 : CustomSCP ItemType.Jailbird, ItemType.ParticleDisruptor, ItemType.MicroHID, + ItemType.Painkillers, + ItemType.Medkit, + ItemType.SCP500, }; + public HashSet BlacklistedUsing = new() + { + ItemType.Painkillers, + ItemType.Medkit, + ItemType.SCP500, + }; + // 035 can't be damaged by these public HashSet BlacklistedDamage = new() { @@ -48,6 +59,7 @@ protected override void SubscribeEvents() Exiled.Events.Handlers.Player.SearchingPickup += OnSearchingPickup; Exiled.Events.Handlers.Server.EndingRound += OnEndingRound; Exiled.Events.Handlers.Scp1509.Resurrecting += OnResurrecting; + Exiled.Events.Handlers.Player.UsingItem += OnUsingItem; base.SubscribeEvents(); } @@ -58,6 +70,7 @@ protected override void UnsubscribeEvents() Exiled.Events.Handlers.Player.SearchingPickup -= OnSearchingPickup; Exiled.Events.Handlers.Server.EndingRound -= OnEndingRound; Exiled.Events.Handlers.Scp1509.Resurrecting -= OnResurrecting; + Exiled.Events.Handlers.Player.UsingItem -= OnUsingItem; base.UnsubscribeEvents(); } @@ -69,13 +82,44 @@ protected override void RoleAdded(Player player) base.RoleAdded(player); } + + public static readonly string CantPickup = "A strange force called 'game balance' prevents from picking up this item"; + public static readonly string CantUse = "A strange force called 'game balance' prevents from using this item"; + + private void OnUsingItem(UsingItemEventArgs ev) + { + if (BlacklistedUsing.Contains(ev.Item.Type)) + { + ShowEffectHint(ev.Player, CantUse); + ev.IsAllowed = false; + return; + } + } + private void OnSearchingPickup(SearchingPickupEventArgs ev) { if (!Check(ev.Player)) return; - if (ev.Pickup.Type.IsScp()) + CustomItem item = null; + + CustomItem.TryGet(ev.Pickup, out item); + + + if(item is not null) + { + if(item.Id == 1050 || item.Id == 1047) + { + ShowEffectHint(ev.Player, CantPickup); + ev.IsAllowed = false; + return; + } + } + + + + if (ev.Pickup.Type.IsScp() && item is not null) { - ShowEffectHint(ev.Player, "A strange force called 'game balance' stops you for picking up this item"); + ShowEffectHint(ev.Player, CantPickup); ev.IsAllowed = false; return; } @@ -83,7 +127,7 @@ private void OnSearchingPickup(SearchingPickupEventArgs ev) if (BlacklistedPickup.Contains(ev.Pickup.Type)) { - ShowEffectHint(ev.Player, "This item can't be picked up"); + ShowEffectHint(ev.Player, CantPickup); ev.IsAllowed = false; return; From 25b6cf8491cd9f34a1b2d02449f0a7beeedbb0f9 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Thu, 18 Dec 2025 21:06:30 +0100 Subject: [PATCH 474/853] added labnaopi --- KruacentExiled/KE.Misc/KE.Misc.csproj | 1 + 1 file changed, 1 insertion(+) diff --git a/KruacentExiled/KE.Misc/KE.Misc.csproj b/KruacentExiled/KE.Misc/KE.Misc.csproj index 51e2986d..f0ce4717 100644 --- a/KruacentExiled/KE.Misc/KE.Misc.csproj +++ b/KruacentExiled/KE.Misc/KE.Misc.csproj @@ -19,6 +19,7 @@ + From 13462158a83c1333d3b93d8311216da58f53373f Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Tue, 23 Dec 2025 12:39:53 +0100 Subject: [PATCH 475/853] skill issue --- KruacentExiled/KE.CustomRoles/CR/SCP/SCP035.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/KruacentExiled/KE.CustomRoles/CR/SCP/SCP035.cs b/KruacentExiled/KE.CustomRoles/CR/SCP/SCP035.cs index b3647cb8..8b96f95d 100644 --- a/KruacentExiled/KE.CustomRoles/CR/SCP/SCP035.cs +++ b/KruacentExiled/KE.CustomRoles/CR/SCP/SCP035.cs @@ -88,6 +88,8 @@ protected override void RoleAdded(Player player) private void OnUsingItem(UsingItemEventArgs ev) { + if (!Check(ev.Player)) return; + if (BlacklistedUsing.Contains(ev.Item.Type)) { ShowEffectHint(ev.Player, CantUse); From c577b0234f90c78e0abc8190c54ea30ebdec4e49 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Tue, 23 Dec 2025 15:35:11 +0100 Subject: [PATCH 476/853] =?UTF-8?q?skill=20issue=C2=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- KruacentExiled/KE.CustomRoles/Abilities/Thief.cs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/KruacentExiled/KE.CustomRoles/Abilities/Thief.cs b/KruacentExiled/KE.CustomRoles/Abilities/Thief.cs index 25f59c44..832ee6ae 100644 --- a/KruacentExiled/KE.CustomRoles/Abilities/Thief.cs +++ b/KruacentExiled/KE.CustomRoles/Abilities/Thief.cs @@ -43,8 +43,7 @@ protected override bool AbilityUsed(Player player) Item newitem = item.Clone(); newitem.Give(player); - thiefed.RemoveItem(newitem); - + thiefed.RemoveItem(item); return base.AbilityUsed(player); } From db05b976c3071a1ad22a4161a1d72398e3b63c72 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Sun, 11 Jan 2026 16:03:52 +0100 Subject: [PATCH 477/853] blacklisted 127 for 035 --- .../KE.CustomRoles/API/Features/CustomSCP.cs | 8 ------ .../KE.CustomRoles/CR/SCP/SCP035.cs | 28 +++++++++++++------ .../KE.CustomRoles/CR/SCP/SCP457.cs | 2 +- 3 files changed, 20 insertions(+), 18 deletions(-) diff --git a/KruacentExiled/KE.CustomRoles/API/Features/CustomSCP.cs b/KruacentExiled/KE.CustomRoles/API/Features/CustomSCP.cs index 429c5d58..4f5e1e36 100644 --- a/KruacentExiled/KE.CustomRoles/API/Features/CustomSCP.cs +++ b/KruacentExiled/KE.CustomRoles/API/Features/CustomSCP.cs @@ -1,15 +1,7 @@ using Exiled.API.Features; using Exiled.API.Features.Core.UserSettings; -using KE.CustomRoles.Settings; -using KE.Utils.API.Settings; -using System; using System.Collections.Generic; using System.Linq; -using System.Runtime.Remoting.Messaging; -using System.Text; -using System.Threading.Tasks; -using UserSettings.ServerSpecific; -using static UnityEngine.Rendering.RayTracingAccelerationStructure; namespace KE.CustomRoles.API.Features { diff --git a/KruacentExiled/KE.CustomRoles/CR/SCP/SCP035.cs b/KruacentExiled/KE.CustomRoles/CR/SCP/SCP035.cs index 8b96f95d..5541f9c0 100644 --- a/KruacentExiled/KE.CustomRoles/CR/SCP/SCP035.cs +++ b/KruacentExiled/KE.CustomRoles/CR/SCP/SCP035.cs @@ -83,8 +83,8 @@ protected override void RoleAdded(Player player) } - public static readonly string CantPickup = "A strange force called 'game balance' prevents from picking up this item"; - public static readonly string CantUse = "A strange force called 'game balance' prevents from using this item"; + public static readonly string CantPickup = "A strange force called \'game balance\' prevents you from picking up this item"; + public static readonly string CantUse = "A strange force called \'game balance\' prevents you from using this item"; private void OnUsingItem(UsingItemEventArgs ev) { @@ -115,16 +115,27 @@ private void OnSearchingPickup(SearchingPickupEventArgs ev) ev.IsAllowed = false; return; } + + if (ev.Pickup.Type.IsScp()) + { + ShowEffectHint(ev.Player, CantPickup); + ev.IsAllowed = false; + return; + } + + if (ev.Pickup.Type == ItemType.GunSCP127) + { + ShowEffectHint(ev.Player, CantPickup); + ev.IsAllowed = false; + return; + } } - if (ev.Pickup.Type.IsScp() && item is not null) - { - ShowEffectHint(ev.Player, CantPickup); - ev.IsAllowed = false; - return; - } + + + if (BlacklistedPickup.Contains(ev.Pickup.Type)) @@ -173,7 +184,6 @@ private void OnHurting(HurtingEventArgs ev) private void OnResurrecting(ResurrectingEventArgs ev) { if (!Check(ev.Player)) return; - ev.NewRole = RoleTypeId.Scp0492; } diff --git a/KruacentExiled/KE.CustomRoles/CR/SCP/SCP457.cs b/KruacentExiled/KE.CustomRoles/CR/SCP/SCP457.cs index 38993cdf..6f250e0e 100644 --- a/KruacentExiled/KE.CustomRoles/CR/SCP/SCP457.cs +++ b/KruacentExiled/KE.CustomRoles/CR/SCP/SCP457.cs @@ -39,7 +39,7 @@ public class SCP457 : CustomSCP public static float DamageRefreshRate = 5f; public static readonly Color FlameColor = new(2, 1.08f, 0); - public Collider[] SphereNonAlloc = new Collider[8]; + public Collider[] SphereNonAlloc = new Collider[32]; public override HashSet Abilities => From bf0181f07b3d02f2dc889b0a39d55269cc27904c Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Sun, 11 Jan 2026 16:36:07 +0100 Subject: [PATCH 478/853] evnet after scp spawn + no crash (hopefully) --- .../KE.Misc/Features/MiscFeature.cs | 2 +- KruacentExiled/KE.Misc/Features/Spawn.cs | 62 +++++-------------- 2 files changed, 17 insertions(+), 47 deletions(-) diff --git a/KruacentExiled/KE.Misc/Features/MiscFeature.cs b/KruacentExiled/KE.Misc/Features/MiscFeature.cs index caa3c2ad..53442ec2 100644 --- a/KruacentExiled/KE.Misc/Features/MiscFeature.cs +++ b/KruacentExiled/KE.Misc/Features/MiscFeature.cs @@ -8,7 +8,7 @@ namespace KE.Misc.Features { - internal abstract class MiscFeature : IUsingEvents + public abstract class MiscFeature : IUsingEvents { private static HashSet _list = new(); diff --git a/KruacentExiled/KE.Misc/Features/Spawn.cs b/KruacentExiled/KE.Misc/Features/Spawn.cs index 1f4a4b2f..cc511823 100644 --- a/KruacentExiled/KE.Misc/Features/Spawn.cs +++ b/KruacentExiled/KE.Misc/Features/Spawn.cs @@ -10,7 +10,7 @@ namespace KE.Misc.Features { - internal class Spawn : MiscFeature + public class Spawn : MiscFeature { private Dictionary baseRole = new () @@ -18,17 +18,15 @@ internal class Spawn : MiscFeature { "173", RoleTypeId.Scp173 }, { "106", RoleTypeId.Scp106 }, { "049", RoleTypeId.Scp049 }, - { "079", RoleTypeId.Scp079 }, - { "096", RoleTypeId.Scp096 }, { "939", RoleTypeId.Scp939 }, }; private Dictionary SelectableCustomSCPs => CustomSCP.All.ToDictionary(cs =>cs.Name, cs => cs); - private bool _set035 = true; + public static event Action OnAssignedSCP = delegate { }; - public void OnRoundStarted() + private void OnRoundStarted() { if (!MainPlugin.Instance.Config.ScpPreferences) return; @@ -64,37 +62,6 @@ private void SetScpPreferences(Player player) SetRoleWithId(player, roleScp); }); - /* - if (config.Scp035Enabled && roleScp == RoleTypeId.Scp079) - { - Player pl = Player.List.GetRandomValue(p => p.Role == RoleTypeId.ClassD || p.Role == RoleTypeId.Scientist); - RoleTypeId otherScp = ChooseRandomRole(GetPreferences(pl)); - - if (otherScp == RoleTypeId.Scp079) - { - _set035 = !_set035; - if (_set035) - { - CustomRole scp = CustomRole.Registered.FirstOrDefault(c => c.Id == 10); - scp.AddRole(pl); - pl.Teleport(SpawnLocationType.Inside096); - } - else - { - pl.Role.Set(otherScp); - } - } - else - { - pl.Role.Set(otherScp); - Timing.CallDelayed(1f, () => - { - pl.MaxHealth /= 4; - pl.Health = pl.MaxHealth; - }); - } - - }*/ } @@ -145,19 +112,22 @@ private void SetRoleWithId(Player player, string name) if (baseRole.ContainsKey(name)) { player.Role.Set(baseRole[name]); + OnAssignedSCP?.Invoke(player); Log.Info("vanilla scp"); + return; } - else + + if (SelectableCustomSCPs.ContainsKey(name)) { - if (SelectableCustomSCPs.ContainsKey(name)) - { - SelectableCustomSCPs[name].AddRole(player); - Log.Info("custom scp"); - return; - } - + SelectableCustomSCPs[name].AddRole(player); + OnAssignedSCP?.Invoke(player); + Log.Info("custom scp"); + return; } + throw new Exception($"SCP ({name}) not found"); + + } @@ -166,13 +136,13 @@ private void SetRoleWithId(Player player, string name) public override void SubscribeEvents() { Exiled.Events.Handlers.Server.EndingRound += EndingRound; - Exiled.Events.Handlers.Server.RoundStarted += OnRoundStarted; + Exiled.Events.Handlers.Server.AllPlayersSpawned += OnRoundStarted; } public override void UnsubscribeEvents() { Exiled.Events.Handlers.Server.EndingRound -= EndingRound; - Exiled.Events.Handlers.Server.RoundStarted -= OnRoundStarted; + Exiled.Events.Handlers.Server.AllPlayersSpawned -= OnRoundStarted; } public void EndingRound(EndingRoundEventArgs ev) From 1da63cfcf4ae052eae62fab640d5dba3cbdecc9e Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Sun, 11 Jan 2026 18:34:15 +0100 Subject: [PATCH 479/853] removed other project + started redmist --- .../KE.CustomRoles/API/Features/CustomSCP.cs | 7 ++ .../KE.CustomRoles/Abilities/RedMist/EGO.cs | 65 +++++++++++++++++++ .../Abilities/RedMist/ToggleEGO.cs | 42 ++++++++++++ .../KE.CustomRoles/CR/MTF/RedMist.cs | 46 +++++++++++++ .../KE.CustomRoles/KE.CustomRoles.csproj | 2 +- KruacentExiled/KruacentExiled.sln | 45 +------------ 6 files changed, 164 insertions(+), 43 deletions(-) create mode 100644 KruacentExiled/KE.CustomRoles/Abilities/RedMist/EGO.cs create mode 100644 KruacentExiled/KE.CustomRoles/Abilities/RedMist/ToggleEGO.cs create mode 100644 KruacentExiled/KE.CustomRoles/CR/MTF/RedMist.cs diff --git a/KruacentExiled/KE.CustomRoles/API/Features/CustomSCP.cs b/KruacentExiled/KE.CustomRoles/API/Features/CustomSCP.cs index 4f5e1e36..46cb0ade 100644 --- a/KruacentExiled/KE.CustomRoles/API/Features/CustomSCP.cs +++ b/KruacentExiled/KE.CustomRoles/API/Features/CustomSCP.cs @@ -1,5 +1,6 @@ using Exiled.API.Features; using Exiled.API.Features.Core.UserSettings; +using KE.Utils.API.Features.SCPs; using System.Collections.Generic; using System.Linq; @@ -40,6 +41,12 @@ public override void Destroy() base.Destroy(); } + public override void AddRole(Player player) + { + SCPTeam.Instance.AddPrimary(player); + base.AddRole(player); + } + public int GetPreferences(Player player) { diff --git a/KruacentExiled/KE.CustomRoles/Abilities/RedMist/EGO.cs b/KruacentExiled/KE.CustomRoles/Abilities/RedMist/EGO.cs new file mode 100644 index 00000000..feafb085 --- /dev/null +++ b/KruacentExiled/KE.CustomRoles/Abilities/RedMist/EGO.cs @@ -0,0 +1,65 @@ +using Exiled.API.Features; +using Exiled.API.Features.DamageHandlers; +using PlayerRoles; +using PlayerStatsSystem; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using UnityEngine; + +namespace KE.CustomRoles.Abilities.RedMist +{ + public class EGO : MonoBehaviour + { + + + private bool active = false; + + + + + private ReferenceHub Hub; + + private float Damage = 1; + + + public void Init() + { + active = false; + Hub = ReferenceHub.GetHub(base.transform.root.gameObject); + } + + + public void Update() + { + if (Hub is null || !Hub.IsAlive()) + { + Log.Info(Hub?.nicknameSync.DisplayName +" is dead"); + Destroy(gameObject); + } + + if (active) + { + Hub.playerStats.DealDamage(new CustomDamageHandler(Player.Get(Hub), null, Damage)); + } + + } + + + public void SetActive(bool active) + { + this.active = active; + } + public bool IsActive() + { + return active; + } + + public void ToggleActive() + { + active = !active; + } + } +} diff --git a/KruacentExiled/KE.CustomRoles/Abilities/RedMist/ToggleEGO.cs b/KruacentExiled/KE.CustomRoles/Abilities/RedMist/ToggleEGO.cs new file mode 100644 index 00000000..da8e18fe --- /dev/null +++ b/KruacentExiled/KE.CustomRoles/Abilities/RedMist/ToggleEGO.cs @@ -0,0 +1,42 @@ +using Exiled.API.Features; +using KE.CustomRoles.API.Features; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace KE.CustomRoles.Abilities.RedMist +{ + public class ToggleEGO : KEAbilities + { + public override string Name { get; } = "ToggleEGO"; + public override string PublicName { get; } = "Toggle E.G.O."; + + public override string Description { get; } = "Manifest your E.G.O, gain powerful buff but rapid health drain.\nCan be deactivated anytime"; + + public override float Cooldown { get; } = 0f; + + + + protected override bool AbilityUsed(Player player) + { + + + + + if(!player.GameObject.TryGetComponent(out var ego)) + { + player.GameObject.AddComponent(); + } + + ego.ToggleActive(); + + + + return base.AbilityUsed(player); + } + + + } +} diff --git a/KruacentExiled/KE.CustomRoles/CR/MTF/RedMist.cs b/KruacentExiled/KE.CustomRoles/CR/MTF/RedMist.cs new file mode 100644 index 00000000..04adeb62 --- /dev/null +++ b/KruacentExiled/KE.CustomRoles/CR/MTF/RedMist.cs @@ -0,0 +1,46 @@ +using Exiled.API.Enums; +using Exiled.API.Features; +using Exiled.Events.EventArgs.Player; +using KE.CustomRoles.API.Features; +using KE.CustomRoles.API.Interfaces; +using MEC; +using PlayerRoles; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using UnityEngine; + +namespace KE.CustomRoles.CR.MTF +{ + public class RedMist : KECustomRole, IColor + { + public override string Description { get; set; } = "Tu es débuff mais ta force de tir est démultiplié (fais attention à tes balles)"; + public override string PublicName { get; set; } = "RedMist"; + public override int MaxHealth { get; set; } = 175; + public override RoleTypeId Role { get; set; } = RoleTypeId.NtfSergeant; + public override bool KeepRoleOnDeath { get; set; } = false; + public override bool KeepRoleOnChangingRole { get; set; } = false; + public Color32 Color => new(255, 192, 203, 0); + public override float SpawnChance { get; set; } = 100; + + protected override void GiveInventory(Player player) + { + + } + + protected override void SubscribeEvents() + { + + base.SubscribeEvents(); + } + + protected override void UnsubscribeEvents() + { + + base.UnsubscribeEvents(); + } + + } +} diff --git a/KruacentExiled/KE.CustomRoles/KE.CustomRoles.csproj b/KruacentExiled/KE.CustomRoles/KE.CustomRoles.csproj index eb2d644b..633fdab1 100644 --- a/KruacentExiled/KE.CustomRoles/KE.CustomRoles.csproj +++ b/KruacentExiled/KE.CustomRoles/KE.CustomRoles.csproj @@ -5,7 +5,7 @@ - + diff --git a/KruacentExiled/KruacentExiled.sln b/KruacentExiled/KruacentExiled.sln index 4b59cc7f..3e0e62b9 100644 --- a/KruacentExiled/KruacentExiled.sln +++ b/KruacentExiled/KruacentExiled.sln @@ -3,62 +3,23 @@ Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio Version 17 VisualStudioVersion = 17.12.35506.116 MinimumVisualStudioVersion = 10.0.40219.1 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "KE.Utils", "KE.Utils\KE.Utils.csproj", "{DFEF41B3-5BD3-428A-A7BA-7A490E65C71F}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "KE.BlackoutNDoor", "KE.BlackoutNDoor\KE.BlackoutNDoor.csproj", "{0281E12C-52C9-4728-A432-769CB191A4DC}" -EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "KE.CustomRoles", "KE.CustomRoles\KE.CustomRoles.csproj", "{33CC074C-06DD-4545-91F2-F668F3C4779D}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "KE.GlobalEventFramework", "KE.GlobalEventFramework\KE.GlobalEventFramework.csproj", "{ED6702F7-B1E4-4522-B491-ED08B0525762}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "KE.GlobalEventFramework.Examples", "KE.GlobalEventFramework.Examples\KE.GlobalEventFramework.Examples.csproj", "{8A74D9F3-FB15-4BDC-84C9-2C26F9F410F8}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "KE.Items", "KE.Items\KE.Items.csproj", "{29C5DC23-05F9-4862-A79A-6051D5DBB575}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "KE.Misc", "KE.Misc\KE.Misc.csproj", "{378DD640-986B-4DA9-8C65-8D318E99E98C}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "KE.Map", "KE.Map\KE.Map.csproj", "{39BB7CAB-6FF9-4C60-8A82-A31ABC980CC1}" -EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU Release|Any CPU = Release|Any CPU EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution - {DFEF41B3-5BD3-428A-A7BA-7A490E65C71F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {DFEF41B3-5BD3-428A-A7BA-7A490E65C71F}.Debug|Any CPU.Build.0 = Debug|Any CPU - {DFEF41B3-5BD3-428A-A7BA-7A490E65C71F}.Release|Any CPU.ActiveCfg = Release|Any CPU - {DFEF41B3-5BD3-428A-A7BA-7A490E65C71F}.Release|Any CPU.Build.0 = Release|Any CPU - {0281E12C-52C9-4728-A432-769CB191A4DC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {0281E12C-52C9-4728-A432-769CB191A4DC}.Debug|Any CPU.Build.0 = Debug|Any CPU - {0281E12C-52C9-4728-A432-769CB191A4DC}.Release|Any CPU.ActiveCfg = Release|Any CPU - {0281E12C-52C9-4728-A432-769CB191A4DC}.Release|Any CPU.Build.0 = Release|Any CPU {33CC074C-06DD-4545-91F2-F668F3C4779D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {33CC074C-06DD-4545-91F2-F668F3C4779D}.Debug|Any CPU.Build.0 = Debug|Any CPU {33CC074C-06DD-4545-91F2-F668F3C4779D}.Release|Any CPU.ActiveCfg = Release|Any CPU {33CC074C-06DD-4545-91F2-F668F3C4779D}.Release|Any CPU.Build.0 = Release|Any CPU - {ED6702F7-B1E4-4522-B491-ED08B0525762}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {ED6702F7-B1E4-4522-B491-ED08B0525762}.Debug|Any CPU.Build.0 = Debug|Any CPU - {ED6702F7-B1E4-4522-B491-ED08B0525762}.Release|Any CPU.ActiveCfg = Release|Any CPU - {ED6702F7-B1E4-4522-B491-ED08B0525762}.Release|Any CPU.Build.0 = Release|Any CPU - {8A74D9F3-FB15-4BDC-84C9-2C26F9F410F8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {8A74D9F3-FB15-4BDC-84C9-2C26F9F410F8}.Debug|Any CPU.Build.0 = Debug|Any CPU - {8A74D9F3-FB15-4BDC-84C9-2C26F9F410F8}.Release|Any CPU.ActiveCfg = Release|Any CPU - {8A74D9F3-FB15-4BDC-84C9-2C26F9F410F8}.Release|Any CPU.Build.0 = Release|Any CPU - {29C5DC23-05F9-4862-A79A-6051D5DBB575}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {29C5DC23-05F9-4862-A79A-6051D5DBB575}.Debug|Any CPU.Build.0 = Debug|Any CPU - {29C5DC23-05F9-4862-A79A-6051D5DBB575}.Release|Any CPU.ActiveCfg = Release|Any CPU - {29C5DC23-05F9-4862-A79A-6051D5DBB575}.Release|Any CPU.Build.0 = Release|Any CPU - {378DD640-986B-4DA9-8C65-8D318E99E98C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {378DD640-986B-4DA9-8C65-8D318E99E98C}.Debug|Any CPU.Build.0 = Debug|Any CPU - {378DD640-986B-4DA9-8C65-8D318E99E98C}.Release|Any CPU.ActiveCfg = Release|Any CPU - {378DD640-986B-4DA9-8C65-8D318E99E98C}.Release|Any CPU.Build.0 = Release|Any CPU - {39BB7CAB-6FF9-4C60-8A82-A31ABC980CC1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {39BB7CAB-6FF9-4C60-8A82-A31ABC980CC1}.Debug|Any CPU.Build.0 = Debug|Any CPU - {39BB7CAB-6FF9-4C60-8A82-A31ABC980CC1}.Release|Any CPU.ActiveCfg = Release|Any CPU - {39BB7CAB-6FF9-4C60-8A82-A31ABC980CC1}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {BC01CE4A-86E8-4D2B-9046-908421EBBCD2} + EndGlobalSection EndGlobal From 5992a26fed230c395d810b1d69bd426d8b82bc5f Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Sun, 11 Jan 2026 21:44:30 +0100 Subject: [PATCH 480/853] shield belt --- .../KE.Items/API/Features/KECustomItem.cs | 12 +- KruacentExiled/KE.Items/Items/ShieldBelt.cs | 287 ++++++++++++++++++ KruacentExiled/KE.Items/KE.Items.csproj | 3 +- KruacentExiled/KruacentExiled.sln | 12 - 4 files changed, 298 insertions(+), 16 deletions(-) create mode 100644 KruacentExiled/KE.Items/Items/ShieldBelt.cs diff --git a/KruacentExiled/KE.Items/API/Features/KECustomItem.cs b/KruacentExiled/KE.Items/API/Features/KECustomItem.cs index 847f5ddc..c4c147c0 100644 --- a/KruacentExiled/KE.Items/API/Features/KECustomItem.cs +++ b/KruacentExiled/KE.Items/API/Features/KECustomItem.cs @@ -1,4 +1,5 @@ using Exiled.API.Features; +using Exiled.API.Features.Pools; using Exiled.API.Features.Spawn; using Exiled.CustomItems.API.Features; using KE.Items.API.Features.SpawnPoints; @@ -84,7 +85,7 @@ public void ReplacePickup(Pickup pickup) internal static void Message(CustomItem c, Player player, bool pickedUp = false) { - StringBuilder builder = new(); + StringBuilder builder = StringBuilderPool.Pool.Get(); if (MainPlugin.Instance.SettingsHandler.GetPrefixes(player)) { @@ -110,7 +111,11 @@ internal static void Message(CustomItem c, Player player, bool pickedUp = false) } builder.AppendLine($"{c.Name}"); - if (MainPlugin.Instance.SettingsHandler.GetDescriptionsSettings(player)) + + bool desc = MainPlugin.Instance.SettingsHandler.GetDescriptionsSettings(player); + + Log.Debug(desc); + if (desc) { builder.AppendLine(c.Description); if (c is IUpgradableCustomItem ci) @@ -131,7 +136,8 @@ internal static void Message(CustomItem c, Player player, bool pickedUp = false) float delay = MainPlugin.Instance.SettingsHandler.GetTime(player); - DisplayHandler.Instance.AddHint(MainPlugin.HintPlacement, player, builder.ToString(), delay); + + DisplayHandler.Instance.AddHint(MainPlugin.HintPlacement, player, StringBuilderPool.Pool.ToStringReturn(builder), delay); } diff --git a/KruacentExiled/KE.Items/Items/ShieldBelt.cs b/KruacentExiled/KE.Items/Items/ShieldBelt.cs new file mode 100644 index 00000000..e47b82f9 --- /dev/null +++ b/KruacentExiled/KE.Items/Items/ShieldBelt.cs @@ -0,0 +1,287 @@ +using Exiled.API.Features; +using Exiled.API.Features.Attributes; +using Exiled.API.Features.DamageHandlers; +using Exiled.API.Features.Items; +using Exiled.API.Features.Pickups.Projectiles; +using Exiled.API.Features.Spawn; +using Exiled.API.Features.Toys; +using Exiled.Events.EventArgs.Map; +using Exiled.Events.EventArgs.Player; +using KE.Items.API.Features; +using MapGeneration; +using MEC; +using System.Collections.Generic; +using System.Linq; +using UnityEngine; + +namespace KE.Items.Items +{ + [CustomItem(ItemType.KeycardJanitor)] + public class ShieldBelt : KECustomItem + { + + public class ShieldBeltStat + { + public static readonly float MaxCharge = 110; + public static readonly float RechargeRatePerS = 13; + public static readonly float TimeBroken = 50; + public static readonly float Base = 20; + + private float currentCharge; + private float timeRemaining; + private bool recharging = false; + + private int i = 0; + public void RechargeTick() + { + if (i % 50 == 0) + { + Log.Debug("cur=" + currentCharge); + Log.Debug("time=" + timeRemaining); + } + i++; + + if (timeRemaining <= 0 && recharging) + { + Log.Debug("recharged"); + currentCharge = 20; + recharging = false; + } + + if(currentCharge <= 0) + { + Break(); + } + + + + + + + + if (!recharging) + { + if (currentCharge != MaxCharge) + { + + float tempcharge = currentCharge + RechargeRatePerS * Time.deltaTime; + currentCharge = Mathf.Clamp(tempcharge, 0, MaxCharge); + } + + } + else + { + timeRemaining -= Time.deltaTime; + if(timeRemaining < 0) + { + timeRemaining = 0; + } + } + + + } + + + /// + /// + /// + /// + /// remaining damage + public float Damage(float damage) + { + + + currentCharge = Mathf.Clamp(currentCharge-damage, 0, MaxCharge); + Log.Debug("cur=" + currentCharge); + Log.Debug("time=" + timeRemaining); + if (currentCharge == 0) + { + return damage; + } + + return 0; + + } + + + public void Break() + { + + if (!recharging) + { + Log.Debug("breakign"); + timeRemaining = TimeBroken; + currentCharge = 0; + recharging = true; + } + + } + + + public bool IsActive + { + get + { + return currentCharge > 0; + } + } + public bool IsRecharging + { + get + { + return recharging; + } + } + public ShieldBeltStat() + { + currentCharge = Base; + timeRemaining = 0; + } + } + + public override uint Id { get; set; } = 5982; + public override string Name { get; set; } = "Shield belt"; + public override string Description { get; set; } = "A projectile-repulsion device.\nIt will attempt to stop incoming projectiles or shrapnel, but does nothing against melee attacks or heat.\nIt prevents the wearer from firing out.\n(works in the inventory) "; + public override float Weight { get; set; } = 0.65f; + public override SpawnProperties SpawnProperties { get; set; } = null; + + + + private Dictionary stats = new(); + private Dictionary primitives = new(); + private CoroutineHandle handle; + + protected override void SubscribeEvents() + { + Exiled.Events.Handlers.Player.DroppedItem += OnDroppedItem; + Exiled.Events.Handlers.Player.Hurting += OnHurting; + Exiled.Events.Handlers.Player.Dying += OnDying; + Exiled.Events.Handlers.Player.Shooting += OnShooting; + InventorySystem.Items.ThrowableProjectiles.Scp2176Projectile.OnServerShattered += OnServerShattered; + handle = Timing.RunCoroutine(Tick()); + base.SubscribeEvents(); + } + + protected override void UnsubscribeEvents() + { + Exiled.Events.Handlers.Player.DroppedItem -= OnDroppedItem; + Exiled.Events.Handlers.Player.Hurting -= OnHurting; + Exiled.Events.Handlers.Player.Dying -= OnDying; + Exiled.Events.Handlers.Player.Shooting -= OnShooting; + InventorySystem.Items.ThrowableProjectiles.Scp2176Projectile.OnServerShattered -= OnServerShattered; + Timing.KillCoroutines(handle); + base.UnsubscribeEvents(); + } + + public override bool Check(Player player) + { + + if (player is null) return false; + + return player.Items.Any(Check); + } + + protected override void OnAcquired(Player player, Item item, bool displayMessage) + { + if (!Check(item)) return; + stats.Add(player, new()); + primitives.Add(player, CreatePrimitive(player)); + Log.Info("player got shilde"); + base.OnAcquired(player, item, displayMessage); + } + + private void OnDroppedItem(DroppedItemEventArgs ev) + { + if (!Check(ev.Pickup)) return; + stats.Remove(ev.Player); + RemovePrim(ev.Player); + Log.Info("player lost shilde"); + + } + private void OnShooting(ShootingEventArgs ev) + { + if (!Check(ev.Player)) return; + + + ev.IsAllowed = false; + } + private void OnServerShattered(InventorySystem.Items.ThrowableProjectiles.Scp2176Projectile projectile,RoomIdentifier roomid) + { + Room room = Room.Get(roomid); + + foreach(Player player in room.Players.Where(Check)) + { + stats[player].Break(); + } + + + } + + private void OnDying(DyingEventArgs ev) + { + if (ev.ItemsToDrop.Any(Check)) + { + stats.Remove(ev.Player); + RemovePrim(ev.Player); + } + } + + private void OnHurting(HurtingEventArgs ev) + { + if (!Check(ev.Player)) + return; + if (ev.IsInstantKill) + return; + if (ev.DamageHandler.CustomBase is not FirearmDamageHandler) + return; + + + ShieldBeltStat stat = stats[ev.Player]; + if (!stat.IsActive) return; + + + + ev.Amount = stat.Damage(ev.Amount); + + + + } + + private void RemovePrim(Player player) + { + primitives[player].Destroy(); + primitives.Remove(player); + } + + private Primitive CreatePrimitive(Player player) + { + Primitive prim = Primitive.Create(null, null, null, false); + + prim.Collidable = false; + prim.Visible = true; + prim.Transform.parent = player.CameraTransform; + prim.Transform.localPosition = Vector3.forward; + prim.Spawn(); + return prim; + } + + private IEnumerator Tick() + { + while (true) + { + + foreach(Player p in stats.Keys) + { + stats[p].RechargeTick(); + } + + + yield return Timing.WaitForOneFrame; + } + } + + + + + } +} diff --git a/KruacentExiled/KE.Items/KE.Items.csproj b/KruacentExiled/KE.Items/KE.Items.csproj index b92b3f60..3ad2edf5 100644 --- a/KruacentExiled/KE.Items/KE.Items.csproj +++ b/KruacentExiled/KE.Items/KE.Items.csproj @@ -6,7 +6,7 @@ - + @@ -20,6 +20,7 @@ + diff --git a/KruacentExiled/KruacentExiled.sln b/KruacentExiled/KruacentExiled.sln index ee3d8b71..40d59c48 100644 --- a/KruacentExiled/KruacentExiled.sln +++ b/KruacentExiled/KruacentExiled.sln @@ -3,10 +3,6 @@ Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio Version 17 VisualStudioVersion = 17.12.35506.116 MinimumVisualStudioVersion = 10.0.40219.1 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "KE.Misc", "KE.Misc\KE.Misc.csproj", "{CD822DB2-756E-4887-93AB-2D2F16BF542C}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "KE.BlackoutNDoor", "KE.BlackoutNDoor\KE.BlackoutNDoor.csproj", "{C9867742-72DB-4ECA-81BF-104A27A04DB7}" -EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "KE.Items", "KE.Items\KE.Items.csproj", "{87D91720-B7B5-4FB7-AB18-FB6E70AC0D68}" EndProject Global @@ -15,14 +11,6 @@ Global Release|Any CPU = Release|Any CPU EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution - {CD822DB2-756E-4887-93AB-2D2F16BF542C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {CD822DB2-756E-4887-93AB-2D2F16BF542C}.Debug|Any CPU.Build.0 = Debug|Any CPU - {CD822DB2-756E-4887-93AB-2D2F16BF542C}.Release|Any CPU.ActiveCfg = Release|Any CPU - {CD822DB2-756E-4887-93AB-2D2F16BF542C}.Release|Any CPU.Build.0 = Release|Any CPU - {C9867742-72DB-4ECA-81BF-104A27A04DB7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {C9867742-72DB-4ECA-81BF-104A27A04DB7}.Debug|Any CPU.Build.0 = Debug|Any CPU - {C9867742-72DB-4ECA-81BF-104A27A04DB7}.Release|Any CPU.ActiveCfg = Release|Any CPU - {C9867742-72DB-4ECA-81BF-104A27A04DB7}.Release|Any CPU.Build.0 = Release|Any CPU {87D91720-B7B5-4FB7-AB18-FB6E70AC0D68}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {87D91720-B7B5-4FB7-AB18-FB6E70AC0D68}.Debug|Any CPU.Build.0 = Debug|Any CPU {87D91720-B7B5-4FB7-AB18-FB6E70AC0D68}.Release|Any CPU.ActiveCfg = Release|Any CPU From 9cb13dc7b9658c0dbd7198fa108963d57cc01a8a Mon Sep 17 00:00:00 2001 From: OmerGS <27omerf@gmail.com> Date: Mon, 12 Jan 2026 10:51:48 +0100 Subject: [PATCH 481/853] refactor the molotov, to emit more light and be more useful --- .../Items/ItemEffects/MolotovEffect.cs | 198 +++++++++++------- KruacentExiled/KE.Items/Items/Molotov.cs | 66 +++--- 2 files changed, 149 insertions(+), 115 deletions(-) diff --git a/KruacentExiled/KE.Items/Items/ItemEffects/MolotovEffect.cs b/KruacentExiled/KE.Items/Items/ItemEffects/MolotovEffect.cs index 8802f9a8..66f0c5c2 100644 --- a/KruacentExiled/KE.Items/Items/ItemEffects/MolotovEffect.cs +++ b/KruacentExiled/KE.Items/Items/ItemEffects/MolotovEffect.cs @@ -1,127 +1,171 @@ -using Exiled.API.Features; +using Exiled.API.Enums; +using Exiled.API.Extensions; +using Exiled.API.Features; +using Exiled.API.Features.Items; +using Exiled.API.Features.Pickups; using Exiled.API.Features.Toys; using Exiled.Events.EventArgs.Map; +using Exiled.Events.EventArgs.Player; +using KE.Items.API.Features; +using KE.Items.API.Interface; using MEC; using PlayerRoles; -using Exiled.API.Enums; using System.Collections.Generic; using UnityEngine; -using Exiled.Events.EventArgs.Player; using Light = Exiled.API.Features.Toys.Light; -using KE.Items.API.Interface; namespace KE.Items.Items.ItemEffects { public class MolotovEffect : CustomItemEffect { - public const float RefreshRate = 0.5f; - public const float Duration = 20f; - public float CylinderSize { get; set; } = 5; + public float Duration { get; set; } = 20f; + public float Radius { get; set; } = 5f; + public float TickRate { get; set; } = 0.5f; + private static HashSet ActiveMolotovSerialNumbers = new HashSet(); + private static List ActiveFireZones = new List(); - public override void Effect(UsedItemEventArgs ev) + public override void Effect(UsedItemEventArgs ev) => SpawnMolotov(ev.Player, ev.Player.Position); + public override void Effect(DroppingItemEventArgs ev) => SpawnMolotov(ev.Player, ev.Player.Position); + public override void Effect(ExplodingGrenadeEventArgs ev) => SpawnMolotov(ev.Player, ev.Position); + + public void OnReceivingEffect(ReceivingEffectEventArgs ev) { - SetZone(ev.Player, ev.Player.Position); + if (ev.Effect.GetEffectType() == EffectType.Hypothermia) + { + foreach (Vector3 zoneCenter in ActiveFireZones) + { + if (Vector3.Distance(ev.Player.Position, zoneCenter) <= Radius + 1f) + { + ev.IsAllowed = false; + return; + } + } + } } - public override void Effect(DroppingItemEventArgs ev) + + public void OnPickingUp(PickingUpItemEventArgs ev) { - SetZone(ev.Player, ev.Player.Position); + if (ev.Pickup != null && ActiveMolotovSerialNumbers.Contains(ev.Pickup.Serial)) + { + ev.IsAllowed = false; + KECustomItem.ItemEffectHint(ev.Player, "C'est brûlant ! Touche pas à ça !"); + ev.Player.Hurt(10f, DamageType.Tesla); + } } - public override void Effect(ExplodingGrenadeEventArgs ev) + private void SpawnMolotov(Player owner, Vector3 centerPos) { - SetZone(ev.Player, ev.Position); - } + Scp244 jarItem = (Scp244)Item.Create(ItemType.SCP244a); + jarItem.Scale = new Vector3(0.2f, 0.2f, 0.2f); + jarItem.Primed = true; + jarItem.MaxDiameter = 0.2f; + Pickup jarPickup = jarItem.CreatePickup(centerPos); + if (jarPickup.GameObject.TryGetComponent(out Rigidbody rb)) rb.isKinematic = true; - private void SetZone(Player player, Vector3 position) - { - float cylinderSize = CylinderSize; + ActiveMolotovSerialNumbers.Add(jarPickup.Serial); + ActiveFireZones.Add(centerPos); + Vector3 groundPos = centerPos - Vector3.up * 0.15f; + Primitive dangerZone = Primitive.Create(PrimitiveType.Cylinder, groundPos, Vector3.zero, new Vector3(Radius, 0.1f, Radius), true); + dangerZone.Collidable = false; + dangerZone.Color = new Color(1f, 0f, 0f, 0.5f); - Player playerThrowingGrenade = player; - Vector3 molotovPosition = position; - Primitive wall = Primitive.Create(PrimitiveType.Cylinder, molotovPosition, null, new Vector3(cylinderSize, 0.01f, cylinderSize), true); - var l = Light.Create(position, null, null, false); - l.Color = new Color(255, 128, 0); - l.Intensity = .05f; - l.Spawn(); - wall.Collidable = false; - wall.Visible = true; + List fireLights = new List(); + Color fireColor = new Color(255, 128, 0); - wall.Color = new Color(255, 128, 0); + fireLights.Add(CreateLight(centerPos + Vector3.up * 0.5f, fireColor, Radius * 2f, 4f)); - var coroutineHandler = Timing.RunCoroutine(DamageInMolotovZone(wall.Position, cylinderSize, playerThrowingGrenade)); + float spread = Radius * 0.5f; + fireLights.Add(CreateLight(centerPos + new Vector3(-spread, 0.5f, 0), fireColor, Radius, 0.5f)); + fireLights.Add(CreateLight(centerPos + new Vector3(0, 0.5f, spread), fireColor, Radius, 0.5f)); - Timing.CallDelayed(Duration, () => - { - Timing.KillCoroutines(coroutineHandler); - wall.Destroy(); - l.Destroy(); - }); + Timing.RunCoroutine(Fire(jarPickup, dangerZone, fireLights, owner, centerPos)); } + private Light CreateLight(Vector3 pos, Color col, float range, float intensity) + { + Light l = Light.Create(pos); + l.Color = col; + l.Range = range; + l.Intensity = intensity; + l.Spawn(); + return l; + } - - private IEnumerator DamageInMolotovZone(Vector3 wallPosition, float cylinderSize, Player playerThrowingGrenade) + private IEnumerator Fire(Pickup jar, Primitive zone, List lights, Player owner, Vector3 center) { - // Dictionary that stores the time each player has spent inside the zone (in seconds). - Dictionary playerTimeInZone = new Dictionary(); + float elapsed = 0f; - while (true) + while (elapsed < Duration) { - foreach (Player player in Player.List) + foreach (var l in lights) { - if (IsPlayerInZone(player, wallPosition, cylinderSize)) - { - if (Server.FriendlyFire || playerThrowingGrenade.Role.Team != player.Role.Team || playerThrowingGrenade == player) - { - if (player.IsHuman || player.Role == RoleTypeId.Scp0492) - { - if (playerTimeInZone.ContainsKey(player)) - { - // increase time each frame. - playerTimeInZone[player] += Time.deltaTime; - } - else - { - // Init the time in dictionnary of the player. - playerTimeInZone[player] = Time.deltaTime; - } + if (l != null) l.Intensity = Random.Range(3f, 6f); + } - // time of player spend inside of molotov zone. - float timeInZone = playerTimeInZone[player]; + if (zone != null) + { + float pulse = 0.1f + Mathf.PingPong(Time.time, 0.05f); + zone.Scale = new Vector3(Radius, pulse, Radius); + } - // Beginning it willbe 5dm/s, after it will be linearly higher the damage until 20dm/s. - float damage = Mathf.Lerp(2.5f, 10f, timeInZone / 20f); + foreach (Player target in Player.List) + { + if (!target.IsAlive) continue; - // double damage if it's zombie cuz it has more hp. - if (player.Role == RoleTypeId.Scp0492) - { - damage *= 2.5f; - } + if (Vector3.Distance(new Vector3(center.x, 0, center.z), new Vector3(target.Position.x, 0, target.Position.z)) <= Radius / 2 + && Mathf.Abs(center.y - target.Position.y) < 2.5f) + { + if (owner != null && !Server.FriendlyFire && target.Role.Team == owner.Role.Team && target != owner) + continue; - player.Hurt(damage, DamageType.Bleeding); - } - else if (player.IsScp) + target.EnableEffect(EffectType.Burned, 1f); + + if (target.IsHuman) + { + if (target.ArtificialHealth > 0) target.ArtificialHealth -= 10f; + else target.Hurt(6f, DamageType.Firearm); + } + else if (target.IsScp) + { + float dmg = 20f; + + if (target.Role == RoleTypeId.Scp0492) { - player.Hurt(player.Health / 150, DamageType.Bleeding); + target.Hurt(dmg * 2.5f, DamageType.Firearm); } + else + { + target.Health -= dmg; + if (target.Health <= 0) + { + target.Kill(DamageType.Firearm); + } + } } } } - yield return Timing.WaitForSeconds(RefreshRate); + yield return Timing.WaitForSeconds(TickRate); + elapsed += TickRate; } - } + if (zone != null) zone.Destroy(); - private bool IsPlayerInZone(Player player, Vector3 zonePosition, float radius) - { - float distance = Vector3.Distance(new Vector3(player.Position.x, 0, player.Position.z), - new Vector3(zonePosition.x, 0, zonePosition.z)); - return distance <= radius / 2; + foreach (var l in lights) + { + if (l != null) l.Destroy(); + } + + if (jar != null) + { + ActiveMolotovSerialNumbers.Remove(jar.Serial); + ActiveFireZones.Remove(center); + jar.Destroy(); + } } } -} +} \ No newline at end of file diff --git a/KruacentExiled/KE.Items/Items/Molotov.cs b/KruacentExiled/KE.Items/Items/Molotov.cs index 51bff295..d0427ded 100644 --- a/KruacentExiled/KE.Items/Items/Molotov.cs +++ b/KruacentExiled/KE.Items/Items/Molotov.cs @@ -1,12 +1,13 @@ -using System.Collections.Generic; -using Exiled.API.Enums; +using Exiled.API.Enums; using Exiled.API.Features.Attributes; using Exiled.API.Features.Spawn; using Exiled.CustomItems.API.Features; using Exiled.Events.EventArgs.Map; +using Exiled.Events.EventArgs.Player; using KE.Items.API.Features; using KE.Items.API.Interface; using KE.Items.Items.ItemEffects; +using System.Collections.Generic; using UnityEngine; namespace KE.Items.Items @@ -14,7 +15,6 @@ namespace KE.Items.Items [CustomItem(ItemType.GrenadeFlash)] public class Molotov : KECustomGrenade, ISwichableEffect/*, ICustomPickupModel*/ { - //bouteille public override uint Id { get; set; } = 1049; public override string Name { get; set; } = "Cocktail Molotov"; public override string Description { get; set; } = "ARSON"; @@ -28,46 +28,20 @@ public class Molotov : KECustomGrenade, ISwichableEffect/*, ICustomPickupModel*/ { Limit = 2, LockerSpawnPoints = new List - { - new LockerSpawnPoint() - { - Chance = 75, - UseChamber = true, - Type = LockerType.Misc, - Zone = ZoneType.Entrance, - }, - new LockerSpawnPoint() - { - Chance = 50, - UseChamber = true, - Type = LockerType.Misc, - Zone = ZoneType.LightContainment, - }, - new LockerSpawnPoint() - { - Chance = 50, - UseChamber = true, - Type = LockerType.Misc, - Zone = ZoneType.HeavyContainment, - }, + { + new LockerSpawnPoint() { Chance = 75, UseChamber = true, Type = LockerType.Misc, Zone = ZoneType.Entrance, }, + new LockerSpawnPoint() { Chance = 50, UseChamber = true, Type = LockerType.Misc, Zone = ZoneType.LightContainment, }, + new LockerSpawnPoint() { Chance = 50, UseChamber = true, Type = LockerType.Misc, Zone = ZoneType.HeavyContainment, }, }, RoomSpawnPoints = new List { - new RoomSpawnPoint() - { - Chance = 75, - Room = RoomType.LczGlassBox, - }, - new RoomSpawnPoint() - { - Chance = 100, - Room = RoomType.HczNuke, - }, + new RoomSpawnPoint() { Chance = 75, Room = RoomType.LczGlassBox, }, + new RoomSpawnPoint() { Chance = 100, Room = RoomType.HczArmory, }, + new RoomSpawnPoint() { Chance = 100, Room = RoomType.Hcz049, }, }, }; - public Molotov() { Effect = new MolotovEffect(); @@ -77,23 +51,39 @@ public Molotov() protected override void SubscribeEvents() { //PickupModel.SubscribeEvents(); + Exiled.Events.Handlers.Player.ReceivingEffect += ReceivedEffect; + Exiled.Events.Handlers.Player.PickingUpItem += PickingItem; base.SubscribeEvents(); } protected override void UnsubscribeEvents() { //PickupModel.UnsubscribeEvents(); + Exiled.Events.Handlers.Player.ReceivingEffect -= ReceivedEffect; + Exiled.Events.Handlers.Player.PickingUpItem -= PickingItem; base.UnsubscribeEvents(); } + private void ReceivedEffect(ReceivingEffectEventArgs ev) + { + if (Effect is MolotovEffect molotovEffect) + { + molotovEffect.OnReceivingEffect(ev); + } + } + private void PickingItem(PickingUpItemEventArgs ev) + { + if (Effect is MolotovEffect molotovEffect) + { + molotovEffect.OnPickingUp(ev); + } + } protected override void OnExploding(ExplodingGrenadeEventArgs ev) { - Effect.Effect(ev); ev.TargetsToAffect.Clear(); } - } } \ No newline at end of file From dfd430bed0ed309226218c0481bc836a44c77275 Mon Sep 17 00:00:00 2001 From: OmerGS <27omerf@gmail.com> Date: Mon, 12 Jan 2026 14:08:27 +0100 Subject: [PATCH 482/853] new item MScan, item that alert a player when somebdy pass aside of the item pickup. --- KruacentExiled/KE.Items/Items/MScan.cs | 209 +++++++++++++++++++++++++ 1 file changed, 209 insertions(+) create mode 100644 KruacentExiled/KE.Items/Items/MScan.cs diff --git a/KruacentExiled/KE.Items/Items/MScan.cs b/KruacentExiled/KE.Items/Items/MScan.cs new file mode 100644 index 00000000..68aecb8b --- /dev/null +++ b/KruacentExiled/KE.Items/Items/MScan.cs @@ -0,0 +1,209 @@ +using Exiled.API.Enums; +using Exiled.API.Features; +using Exiled.API.Features.Attributes; +using Exiled.API.Features.Pickups; +using Exiled.API.Features.Spawn; +using Exiled.CustomItems.API.Features; +using Exiled.Events.EventArgs.Player; +using KE.Items.API.Features; +using MEC; +using System.Collections.Generic; +using UnityEngine; + +namespace KE.Items.Items +{ + [CustomItem(ItemType.Flashlight)] + public class MScan : KECustomItem + { + public override uint Id { get; set; } = 2090; + public override string Name { get; set; } = "M-Scan"; + public override string Description { get; set; } = "Détecte les mouvements des personnes passant devant"; + public override float Weight { get; set; } = 1.5f; + public Color Color { get; set; } = Color.cyan; + public override SpawnProperties SpawnProperties { get; set; } = new SpawnProperties() + { + Limit = 2, + RoomSpawnPoints = new List + { + new RoomSpawnPoint() + { + Chance = 25, + Room = RoomType.LczGlassBox, + }, + new RoomSpawnPoint() + { + Chance = 25, + Room = RoomType.HczIncineratorWayside, + }, + new RoomSpawnPoint() + { + Chance = 25, + Room = RoomType.LczCafe, + }, + }, + }; + + private Dictionary ActiveSensors = new Dictionary(); + private Dictionary Cooldowns = new Dictionary(); + + private Dictionary BatteryLife = new Dictionary(); + + private CoroutineHandle SensorRoutine; + + protected override void SubscribeEvents() + { + Exiled.Events.Handlers.Player.DroppingItem += OnDropping; + Exiled.Events.Handlers.Player.PickingUpItem += OnPickingUp; + Exiled.Events.Handlers.Player.Shot += OnShot; + + Exiled.Events.Handlers.Scp049.Attacking += (ev) => CheckDestruction(ev.Player.Position, 2f); + Exiled.Events.Handlers.Scp096.Enraging += (ev) => CheckDestruction(ev.Player.Position, 2f); + Exiled.Events.Handlers.Scp939.Clawed += (ev) => CheckDestruction(ev.Player.Position, 2f); + Exiled.Events.Handlers.Scp106.Teleporting += (ev) => CheckDestruction(ev.Player.Position, 2f); + + SensorRoutine = Timing.RunCoroutine(MotionDetector()); + base.SubscribeEvents(); + } + + protected override void UnsubscribeEvents() + { + Exiled.Events.Handlers.Player.DroppingItem -= OnDropping; + Exiled.Events.Handlers.Player.PickingUpItem -= OnPickingUp; + Exiled.Events.Handlers.Player.Shot -= OnShot; + + Timing.KillCoroutines(SensorRoutine); + ActiveSensors.Clear(); + base.UnsubscribeEvents(); + } + + private void OnDropping(DroppingItemEventArgs ev) + { + if (!Check(ev.Item)) return; + + Timing.CallDelayed(0.5f, () => + { + foreach (Pickup p in Pickup.List) + { + if (p.Serial == ev.Item.Serial) + { + if (!ActiveSensors.ContainsKey(p)) + { + ActiveSensors.Add(p, ev.Player); + BatteryLife[p] = Time.time + 300f; + + ev.Player.ShowHint("SCANNER DÉPLOYÉ\nBatterie: 5 minutes", 3f); + } + break; + } + } + }); + } + + private void OnPickingUp(PickingUpItemEventArgs ev) + { + if (!Check(ev.Pickup)) return; + + if (ActiveSensors.ContainsKey(ev.Pickup)) + { + ActiveSensors.Remove(ev.Pickup); + BatteryLife.Remove(ev.Pickup); + ev.Player.ShowHint("Scanner récupéré.", 2f); + } + } + + private void OnShot(ShotEventArgs ev) => CheckDestruction(ev.Position, 0.5f); + + private void CheckDestruction(Vector3 hitPos, float radius) + { + List toDestroy = new List(); + + foreach (var kvp in ActiveSensors) + { + Pickup sensor = kvp.Key; + Player owner = kvp.Value; + if (sensor == null) continue; + + if (Vector3.Distance(hitPos, sensor.Position) <= radius) + { + toDestroy.Add(sensor); + if (owner != null) KECustomItem.ItemEffectHint(owner, "SCANNER DÉTRUIT"); + } + } + + foreach (var p in toDestroy) + { + ActiveSensors.Remove(p); + BatteryLife.Remove(p); + p.Destroy(); + } + } + + private IEnumerator MotionDetector() + { + while (true) + { + List invalid = new List(); + float currentTime = Time.time; + + foreach (var key in ActiveSensors.Keys) + { + if (key == null || key.GameObject == null) invalid.Add(key); + else if (BatteryLife.ContainsKey(key) && currentTime > BatteryLife[key]) + { + if (ActiveSensors[key] != null) + KECustomItem.ItemEffectHint(ActiveSensors[key], "Scanner: Batterie épuisée."); + invalid.Add(key); + } + } + + foreach (var i in invalid) + { + ActiveSensors.Remove(i); + BatteryLife.Remove(i); + if (i != null) i.Destroy(); + } + + foreach (var kvp in ActiveSensors) + { + Pickup sensor = kvp.Key; + Player owner = kvp.Value; + + if (Cooldowns.ContainsKey(sensor) && currentTime < Cooldowns[sensor]) continue; + + bool detected = false; + + foreach (Player target in Player.List) + { + if (target == owner) continue; + if (!target.IsAlive || target.IsNoclipPermitted) continue; + if (owner != null && target.Role.Side == owner.Role.Side) continue; + + if (Vector3.Distance(sensor.Position, target.Position) < 3.5f) + { + detected = true; + + if (owner != null) + { + string color = "orange"; + if (target.Role.Side == Side.Scp) color = "red"; + else if (target.Role.Side == Side.Mtf) color = "blue"; + else if (target.Role.Side == Side.ChaosInsurgency) color = "green"; + + KECustomItem.ItemEffectHint(owner, $"M-SCAN: {target.Role.Name} ({target.Nickname})"); + } + + break; + } + } + + if (detected) + { + Cooldowns[sensor] = currentTime + 3.0f; + } + } + + yield return Timing.WaitForSeconds(0.5f); + } + } + } +} \ No newline at end of file From e9bae7172753ea1a564878b33890ea7e40aebfc6 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Mon, 12 Jan 2026 15:14:50 +0100 Subject: [PATCH 483/853] finished the shield belt --- KruacentExiled/KE.Items/Items/ShieldBelt.cs | 72 ++++++++++++++------- 1 file changed, 47 insertions(+), 25 deletions(-) diff --git a/KruacentExiled/KE.Items/Items/ShieldBelt.cs b/KruacentExiled/KE.Items/Items/ShieldBelt.cs index e47b82f9..36c754fd 100644 --- a/KruacentExiled/KE.Items/Items/ShieldBelt.cs +++ b/KruacentExiled/KE.Items/Items/ShieldBelt.cs @@ -10,6 +10,7 @@ using KE.Items.API.Features; using MapGeneration; using MEC; +using PlayerRoles.FirstPersonControl; using System.Collections.Generic; using System.Linq; using UnityEngine; @@ -26,11 +27,15 @@ public class ShieldBeltStat public static readonly float RechargeRatePerS = 13; public static readonly float TimeBroken = 50; public static readonly float Base = 20; + public static readonly Vector3 MaxSize = Vector3.one * 2; private float currentCharge; private float timeRemaining; private bool recharging = false; + private Player player; + private Primitive primitive; + private int i = 0; public void RechargeTick() { @@ -52,15 +57,23 @@ public void RechargeTick() { Break(); } - - + if(primitive is not null) + { + float percent = currentCharge / MaxCharge; + primitive.Scale = percent * MaxSize; + } if (!recharging) { + if (!primitive.Visible) + { + primitive.Visible = true; + } + if (currentCharge != MaxCharge) { @@ -76,6 +89,10 @@ public void RechargeTick() { timeRemaining = 0; } + if (primitive.Visible) + { + primitive.Visible = false; + } } @@ -113,6 +130,7 @@ public void Break() timeRemaining = TimeBroken; currentCharge = 0; recharging = true; + player.PlayShieldBreakSound(); } } @@ -132,11 +150,32 @@ public bool IsRecharging return recharging; } } - public ShieldBeltStat() + private Primitive CreatePrimitive(Player player) { + Primitive prim = Primitive.Create(null, null, null, false); + + prim.Collidable = false; + prim.Visible = true; + prim.Transform.parent = player.ReferenceHub.transform; + prim.Transform.localPosition = Vector3.zero; + prim.Scale = MaxSize; + prim.Color = new Color32(50, 50, 50, 100); + prim.Spawn(); + return prim; + } + public ShieldBeltStat(Player player) + { + this.player = player; + primitive = CreatePrimitive(player); currentCharge = Base; timeRemaining = 0; } + + public void Destroy() + { + primitive.Destroy(); + primitive = null; + } } public override uint Id { get; set; } = 5982; @@ -148,7 +187,6 @@ public ShieldBeltStat() private Dictionary stats = new(); - private Dictionary primitives = new(); private CoroutineHandle handle; protected override void SubscribeEvents() @@ -184,17 +222,17 @@ public override bool Check(Player player) protected override void OnAcquired(Player player, Item item, bool displayMessage) { if (!Check(item)) return; - stats.Add(player, new()); - primitives.Add(player, CreatePrimitive(player)); - Log.Info("player got shilde"); + stats.Add(player, new(player)); + Log.Debug("player got shield"); base.OnAcquired(player, item, displayMessage); } private void OnDroppedItem(DroppedItemEventArgs ev) { if (!Check(ev.Pickup)) return; + + stats[ev.Player].Destroy(); stats.Remove(ev.Player); - RemovePrim(ev.Player); Log.Info("player lost shilde"); } @@ -221,8 +259,8 @@ private void OnDying(DyingEventArgs ev) { if (ev.ItemsToDrop.Any(Check)) { + stats[ev.Player].Destroy(); stats.Remove(ev.Player); - RemovePrim(ev.Player); } } @@ -247,23 +285,7 @@ private void OnHurting(HurtingEventArgs ev) } - private void RemovePrim(Player player) - { - primitives[player].Destroy(); - primitives.Remove(player); - } - private Primitive CreatePrimitive(Player player) - { - Primitive prim = Primitive.Create(null, null, null, false); - - prim.Collidable = false; - prim.Visible = true; - prim.Transform.parent = player.CameraTransform; - prim.Transform.localPosition = Vector3.forward; - prim.Spawn(); - return prim; - } private IEnumerator Tick() { From 94a53543967f101c985b79c377f23ceba8120d81 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Mon, 12 Jan 2026 15:16:21 +0100 Subject: [PATCH 484/853] add new keyword --- KruacentExiled/KE.Items/Items/MScan.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/KruacentExiled/KE.Items/Items/MScan.cs b/KruacentExiled/KE.Items/Items/MScan.cs index 68aecb8b..c7299d3d 100644 --- a/KruacentExiled/KE.Items/Items/MScan.cs +++ b/KruacentExiled/KE.Items/Items/MScan.cs @@ -76,7 +76,7 @@ protected override void UnsubscribeEvents() base.UnsubscribeEvents(); } - private void OnDropping(DroppingItemEventArgs ev) + private new void OnDropping(DroppingItemEventArgs ev) { if (!Check(ev.Item)) return; @@ -99,7 +99,7 @@ private void OnDropping(DroppingItemEventArgs ev) }); } - private void OnPickingUp(PickingUpItemEventArgs ev) + private new void OnPickingUp(PickingUpItemEventArgs ev) { if (!Check(ev.Pickup)) return; From 1068ca4e83155165bdba3284e350f067afedfe0b Mon Sep 17 00:00:00 2001 From: OmerGS <27omerf@gmail.com> Date: Mon, 12 Jan 2026 15:23:10 +0100 Subject: [PATCH 485/853] added new voice to LeRusse role --- .../CR/ChaosInsurgency/LeRusse.cs | 119 +++++++++++++++++- 1 file changed, 117 insertions(+), 2 deletions(-) diff --git a/KruacentExiled/KE.CustomRoles/CR/ChaosInsurgency/LeRusse.cs b/KruacentExiled/KE.CustomRoles/CR/ChaosInsurgency/LeRusse.cs index 7a90313a..f16f12b7 100644 --- a/KruacentExiled/KE.CustomRoles/CR/ChaosInsurgency/LeRusse.cs +++ b/KruacentExiled/KE.CustomRoles/CR/ChaosInsurgency/LeRusse.cs @@ -1,10 +1,19 @@ using Exiled.API.Enums; +using Exiled.API.Features; using Exiled.API.Features.Attributes; +using Exiled.Events.EventArgs.Player; using KE.CustomRoles.API.Features; using KE.CustomRoles.API.Interfaces; +using MEC; +using Mirror; using PlayerRoles; +using System; using System.Collections.Generic; using UnityEngine; +using VoiceChat; +using VoiceChat.Codec; +using VoiceChat.Codec.Enums; +using VoiceChat.Networking; namespace KE.CustomRoles.CR.ChaosInsurgency { @@ -23,7 +32,7 @@ public class Russe : KECustomRole, IColor public override Vector3 Scale { get; set; } = new Vector3(1.1f, 1f, 1.1f); public override List Inventory { get; set; } = new List() - { + { $"{ItemType.GunRevolver}", $"{ItemType.Radio}", $"{ItemType.Adrenaline}", @@ -34,7 +43,113 @@ public class Russe : KECustomRole, IColor public override Dictionary Ammo { get; set; } = new Dictionary() { - { AmmoType.Ammo44Cal, 18} + { AmmoType.Ammo44Cal, 21} }; + + private OpusDecoder _decoder = new OpusDecoder(); + private OpusEncoder _encoder = new OpusEncoder(OpusApplicationType.Voip); + + private bool DebugMode = false; + private float _filterMem = 0f; + + private Dictionary ActiveDummies = new Dictionary(); + + protected override void RoleAdded(Player player) + { + Exiled.Events.Handlers.Player.VoiceChatting += OnVoiceChatting; + if (DebugMode) CreateDummy(player); + } + + protected override void RoleRemoved(Player player) + { + Exiled.Events.Handlers.Player.VoiceChatting -= OnVoiceChatting; + + if (DebugMode) RemoveDummy(player); + } + + private void OnVoiceChatting(VoiceChattingEventArgs ev) + { + if (!Check(ev.Player)) return; + ev.IsAllowed = false; + + if (!ActiveDummies.ContainsKey(ev.Player)) return; + + float[] pcmBuffer = new float[1920]; + int decodedLen = _decoder.Decode(ev.VoiceMessage.Data, ev.VoiceMessage.DataLength, pcmBuffer); + ProcessRusseEffect(pcmBuffer, decodedLen); + + byte[] encodedBytes = new byte[4000]; + int encodedLen = _encoder.Encode(pcmBuffer, encodedBytes); + + byte[] finalPacket = new byte[encodedLen]; + Array.Copy(encodedBytes, finalPacket, encodedLen); + + Npc dummy = ActiveDummies[ev.Player]; + dummy.Position = ev.Player.Position; + + var msg = new VoiceMessage(dummy.ReferenceHub, VoiceChatChannel.Proximity, finalPacket, encodedLen, false); + + foreach (Player hub in Player.List) + { + if (!DebugMode && hub == ev.Player) continue; + + if (Vector3.Distance(hub.Position, ev.Player.Position) < 20f) + { + hub.Connection.Send(msg); + } + } + } + private void ProcessRusseEffect(float[] buffer, int length) + { + float gateThreshold = 0.02f; + + float muffle = 0.10f; + + for (int i = 0; i < length; i++) + { + float input = buffer[i]; + + if (Mathf.Abs(input) < gateThreshold) + { + _filterMem *= 0.9f; + buffer[i] = _filterMem; + continue; + } + + _filterMem += (input - _filterMem) * muffle; + + float output = _filterMem * 6.0f; + + if (output > 1.0f) output = 1.0f; + else if (output < -1.0f) output = -1.0f; + + buffer[i] = output; + } + } + + private void CreateDummy(Player p) + { + if (ActiveDummies.ContainsKey(p)) return; + Npc npc = Npc.Spawn($"Russe-{p.Nickname}", RoleTypeId.Tutorial, false, p.Position); + npc.Scale = Vector3.zero; + + Timing.CallDelayed(0.5f, () => + { + if (npc != null && npc.GameObject != null) + { + try { npc.IsGodModeEnabled = true; } catch { } + } + }); + ActiveDummies[p] = npc; + } + + private void RemoveDummy(Player p) + { + if (ActiveDummies.ContainsKey(p)) + { + if (ActiveDummies[p] != null) NetworkServer.Destroy(ActiveDummies[p].GameObject); + ActiveDummies.Remove(p); + } + } } } From 507fcef1697d663a91663485073b09ccf17ffd6e Mon Sep 17 00:00:00 2001 From: OmerGS <27omerf@gmail.com> Date: Mon, 12 Jan 2026 15:58:57 +0100 Subject: [PATCH 486/853] add new Global Event, when a player talk to loud the player explode --- .../GE/Librarby.cs | 66 +++++++++++++++++++ 1 file changed, 66 insertions(+) create mode 100644 KruacentExiled/KE.GlobalEventFramework.Examples/GE/Librarby.cs diff --git a/KruacentExiled/KE.GlobalEventFramework.Examples/GE/Librarby.cs b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/Librarby.cs new file mode 100644 index 00000000..e65c1323 --- /dev/null +++ b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/Librarby.cs @@ -0,0 +1,66 @@ +using Exiled.API.Enums; +using Exiled.API.Features; +using Exiled.API.Features.Items; +using Exiled.Events.EventArgs.Player; +using KE.GlobalEventFramework.GEFE.API.Features; +using KE.GlobalEventFramework.GEFE.API.Interfaces; +using MEC; +using System; +using System.Collections.Generic; +using UnityEngine; +using VoiceChat.Codec; + +namespace KE.GlobalEventFramework.Examples.GE +{ + /// + /// You cannot talk to loud + /// + public class Librarby : GlobalEvent, IEvent + { + /// + public override uint Id { get; set; } = 1091; + /// + public override string Name { get; set; } = "Librarby"; + /// + public override string Description { get; set; } = "Ne parlez pas trop fort sinon vous subirez les conséquences !"; + /// + public override int WeightedChance => 150; + private float MaxVolume = 0.5f; + + private OpusDecoder _decoder = new OpusDecoder(); + private float[] _pcmBuffer = new float[1920]; + + public void SubscribeEvent() + { + Exiled.Events.Handlers.Player.VoiceChatting += PlayerYapping; + } + + public void UnsubscribeEvent() + { + Exiled.Events.Handlers.Player.VoiceChatting -= PlayerYapping; + } + + private void PlayerYapping(VoiceChattingEventArgs ev) + { + if (ev.Player.Role.Side == Side.Scp) return; + + int decodedLength = _decoder.Decode(ev.VoiceMessage.Data, ev.VoiceMessage.DataLength, _pcmBuffer); + float maxVolume = 0f; + + for (int i = 0; i < decodedLength; i++) + { + float absValue = Mathf.Abs(_pcmBuffer[i]); + + if (absValue > maxVolume) + { + maxVolume = absValue; + } + } + + if (maxVolume > MaxVolume) + { + ev.Player.Explode(); + } + } + } +} \ No newline at end of file From 41d9ea9fca16101873ccedcc9553ea1e9ad123a6 Mon Sep 17 00:00:00 2001 From: OmerGS <27omerf@gmail.com> Date: Mon, 12 Jan 2026 16:03:36 +0100 Subject: [PATCH 487/853] edit weighted chance bcause it's too much --- KruacentExiled/KE.GlobalEventFramework.Examples/GE/Librarby.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/KruacentExiled/KE.GlobalEventFramework.Examples/GE/Librarby.cs b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/Librarby.cs index e65c1323..3cf065d5 100644 --- a/KruacentExiled/KE.GlobalEventFramework.Examples/GE/Librarby.cs +++ b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/Librarby.cs @@ -24,7 +24,7 @@ public class Librarby : GlobalEvent, IEvent /// public override string Description { get; set; } = "Ne parlez pas trop fort sinon vous subirez les conséquences !"; /// - public override int WeightedChance => 150; + public override int WeightedChance => 1; private float MaxVolume = 0.5f; private OpusDecoder _decoder = new OpusDecoder(); From f87438c3089804e02f0bb3dfe8c5c257e548c3bf Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Mon, 12 Jan 2026 16:08:47 +0100 Subject: [PATCH 488/853] shield belt with component --- KruacentExiled/KE.Items/Items/ShieldBelt.cs | 309 ------------------ .../KE.Items/Items/ShieldBelt/ShieldBelt.cs | 139 ++++++++ .../Items/ShieldBelt/ShieldBeltStat.cs | 173 ++++++++++ 3 files changed, 312 insertions(+), 309 deletions(-) delete mode 100644 KruacentExiled/KE.Items/Items/ShieldBelt.cs create mode 100644 KruacentExiled/KE.Items/Items/ShieldBelt/ShieldBelt.cs create mode 100644 KruacentExiled/KE.Items/Items/ShieldBelt/ShieldBeltStat.cs diff --git a/KruacentExiled/KE.Items/Items/ShieldBelt.cs b/KruacentExiled/KE.Items/Items/ShieldBelt.cs deleted file mode 100644 index 36c754fd..00000000 --- a/KruacentExiled/KE.Items/Items/ShieldBelt.cs +++ /dev/null @@ -1,309 +0,0 @@ -using Exiled.API.Features; -using Exiled.API.Features.Attributes; -using Exiled.API.Features.DamageHandlers; -using Exiled.API.Features.Items; -using Exiled.API.Features.Pickups.Projectiles; -using Exiled.API.Features.Spawn; -using Exiled.API.Features.Toys; -using Exiled.Events.EventArgs.Map; -using Exiled.Events.EventArgs.Player; -using KE.Items.API.Features; -using MapGeneration; -using MEC; -using PlayerRoles.FirstPersonControl; -using System.Collections.Generic; -using System.Linq; -using UnityEngine; - -namespace KE.Items.Items -{ - [CustomItem(ItemType.KeycardJanitor)] - public class ShieldBelt : KECustomItem - { - - public class ShieldBeltStat - { - public static readonly float MaxCharge = 110; - public static readonly float RechargeRatePerS = 13; - public static readonly float TimeBroken = 50; - public static readonly float Base = 20; - public static readonly Vector3 MaxSize = Vector3.one * 2; - - private float currentCharge; - private float timeRemaining; - private bool recharging = false; - - private Player player; - private Primitive primitive; - - private int i = 0; - public void RechargeTick() - { - if (i % 50 == 0) - { - Log.Debug("cur=" + currentCharge); - Log.Debug("time=" + timeRemaining); - } - i++; - - if (timeRemaining <= 0 && recharging) - { - Log.Debug("recharged"); - currentCharge = 20; - recharging = false; - } - - if(currentCharge <= 0) - { - Break(); - } - - if(primitive is not null) - { - float percent = currentCharge / MaxCharge; - - primitive.Scale = percent * MaxSize; - - } - - - if (!recharging) - { - if (!primitive.Visible) - { - primitive.Visible = true; - } - - if (currentCharge != MaxCharge) - { - - float tempcharge = currentCharge + RechargeRatePerS * Time.deltaTime; - currentCharge = Mathf.Clamp(tempcharge, 0, MaxCharge); - } - - } - else - { - timeRemaining -= Time.deltaTime; - if(timeRemaining < 0) - { - timeRemaining = 0; - } - if (primitive.Visible) - { - primitive.Visible = false; - } - } - - - } - - - /// - /// - /// - /// - /// remaining damage - public float Damage(float damage) - { - - - currentCharge = Mathf.Clamp(currentCharge-damage, 0, MaxCharge); - Log.Debug("cur=" + currentCharge); - Log.Debug("time=" + timeRemaining); - if (currentCharge == 0) - { - return damage; - } - - return 0; - - } - - - public void Break() - { - - if (!recharging) - { - Log.Debug("breakign"); - timeRemaining = TimeBroken; - currentCharge = 0; - recharging = true; - player.PlayShieldBreakSound(); - } - - } - - - public bool IsActive - { - get - { - return currentCharge > 0; - } - } - public bool IsRecharging - { - get - { - return recharging; - } - } - private Primitive CreatePrimitive(Player player) - { - Primitive prim = Primitive.Create(null, null, null, false); - - prim.Collidable = false; - prim.Visible = true; - prim.Transform.parent = player.ReferenceHub.transform; - prim.Transform.localPosition = Vector3.zero; - prim.Scale = MaxSize; - prim.Color = new Color32(50, 50, 50, 100); - prim.Spawn(); - return prim; - } - public ShieldBeltStat(Player player) - { - this.player = player; - primitive = CreatePrimitive(player); - currentCharge = Base; - timeRemaining = 0; - } - - public void Destroy() - { - primitive.Destroy(); - primitive = null; - } - } - - public override uint Id { get; set; } = 5982; - public override string Name { get; set; } = "Shield belt"; - public override string Description { get; set; } = "A projectile-repulsion device.\nIt will attempt to stop incoming projectiles or shrapnel, but does nothing against melee attacks or heat.\nIt prevents the wearer from firing out.\n(works in the inventory) "; - public override float Weight { get; set; } = 0.65f; - public override SpawnProperties SpawnProperties { get; set; } = null; - - - - private Dictionary stats = new(); - private CoroutineHandle handle; - - protected override void SubscribeEvents() - { - Exiled.Events.Handlers.Player.DroppedItem += OnDroppedItem; - Exiled.Events.Handlers.Player.Hurting += OnHurting; - Exiled.Events.Handlers.Player.Dying += OnDying; - Exiled.Events.Handlers.Player.Shooting += OnShooting; - InventorySystem.Items.ThrowableProjectiles.Scp2176Projectile.OnServerShattered += OnServerShattered; - handle = Timing.RunCoroutine(Tick()); - base.SubscribeEvents(); - } - - protected override void UnsubscribeEvents() - { - Exiled.Events.Handlers.Player.DroppedItem -= OnDroppedItem; - Exiled.Events.Handlers.Player.Hurting -= OnHurting; - Exiled.Events.Handlers.Player.Dying -= OnDying; - Exiled.Events.Handlers.Player.Shooting -= OnShooting; - InventorySystem.Items.ThrowableProjectiles.Scp2176Projectile.OnServerShattered -= OnServerShattered; - Timing.KillCoroutines(handle); - base.UnsubscribeEvents(); - } - - public override bool Check(Player player) - { - - if (player is null) return false; - - return player.Items.Any(Check); - } - - protected override void OnAcquired(Player player, Item item, bool displayMessage) - { - if (!Check(item)) return; - stats.Add(player, new(player)); - Log.Debug("player got shield"); - base.OnAcquired(player, item, displayMessage); - } - - private void OnDroppedItem(DroppedItemEventArgs ev) - { - if (!Check(ev.Pickup)) return; - - stats[ev.Player].Destroy(); - stats.Remove(ev.Player); - Log.Info("player lost shilde"); - - } - private void OnShooting(ShootingEventArgs ev) - { - if (!Check(ev.Player)) return; - - - ev.IsAllowed = false; - } - private void OnServerShattered(InventorySystem.Items.ThrowableProjectiles.Scp2176Projectile projectile,RoomIdentifier roomid) - { - Room room = Room.Get(roomid); - - foreach(Player player in room.Players.Where(Check)) - { - stats[player].Break(); - } - - - } - - private void OnDying(DyingEventArgs ev) - { - if (ev.ItemsToDrop.Any(Check)) - { - stats[ev.Player].Destroy(); - stats.Remove(ev.Player); - } - } - - private void OnHurting(HurtingEventArgs ev) - { - if (!Check(ev.Player)) - return; - if (ev.IsInstantKill) - return; - if (ev.DamageHandler.CustomBase is not FirearmDamageHandler) - return; - - - ShieldBeltStat stat = stats[ev.Player]; - if (!stat.IsActive) return; - - - - ev.Amount = stat.Damage(ev.Amount); - - - - } - - - - private IEnumerator Tick() - { - while (true) - { - - foreach(Player p in stats.Keys) - { - stats[p].RechargeTick(); - } - - - yield return Timing.WaitForOneFrame; - } - } - - - - - } -} diff --git a/KruacentExiled/KE.Items/Items/ShieldBelt/ShieldBelt.cs b/KruacentExiled/KE.Items/Items/ShieldBelt/ShieldBelt.cs new file mode 100644 index 00000000..d23295dd --- /dev/null +++ b/KruacentExiled/KE.Items/Items/ShieldBelt/ShieldBelt.cs @@ -0,0 +1,139 @@ +using Exiled.API.Features; +using Exiled.API.Features.Attributes; +using Exiled.API.Features.DamageHandlers; +using Exiled.API.Features.Items; +using Exiled.API.Features.Pickups.Projectiles; +using Exiled.API.Features.Spawn; +using Exiled.API.Features.Toys; +using Exiled.Events.EventArgs.Map; +using Exiled.Events.EventArgs.Player; +using KE.Items.API.Features; +using MapGeneration; +using MEC; +using PlayerRoles.FirstPersonControl; +using System.Collections.Generic; +using System.Linq; +using UnityEngine; + +namespace KE.Items.Items.ShieldBelt +{ + [CustomItem(ItemType.KeycardJanitor)] + public class ShieldBelt : KECustomItem + { + + + + public override uint Id { get; set; } = 5982; + public override string Name { get; set; } = "Shield belt"; + public override string Description { get; set; } = "A projectile-repulsion device.\nIt will attempt to stop incoming projectiles or shrapnel, but does nothing against melee attacks or heat.\nIt prevents the wearer from firing out.\n(works in the inventory) "; + public override float Weight { get; set; } = 0.65f; + public override SpawnProperties SpawnProperties { get; set; } = null; + + + + private CoroutineHandle handle; + + protected override void SubscribeEvents() + { + Exiled.Events.Handlers.Player.DroppedItem += OnDroppedItem; + Exiled.Events.Handlers.Player.Hurting += OnHurting; + Exiled.Events.Handlers.Player.Dying += OnDying; + Exiled.Events.Handlers.Player.Shooting += OnShooting; + InventorySystem.Items.ThrowableProjectiles.Scp2176Projectile.OnServerShattered += OnServerShattered; + base.SubscribeEvents(); + } + + protected override void UnsubscribeEvents() + { + Exiled.Events.Handlers.Player.DroppedItem -= OnDroppedItem; + Exiled.Events.Handlers.Player.Hurting -= OnHurting; + Exiled.Events.Handlers.Player.Dying -= OnDying; + Exiled.Events.Handlers.Player.Shooting -= OnShooting; + InventorySystem.Items.ThrowableProjectiles.Scp2176Projectile.OnServerShattered -= OnServerShattered; + base.UnsubscribeEvents(); + } + + public override bool Check(Player player) + { + + if (player is null) return false; + + return player.Items.Any(Check); + } + + protected override void OnAcquired(Player player, Item item, bool displayMessage) + { + if (!Check(item)) return; + player.GameObject.AddComponent(); + Log.Debug("player got shield"); + base.OnAcquired(player, item, displayMessage); + } + + private void OnDroppedItem(DroppedItemEventArgs ev) + { + if (!Check(ev.Pickup)) return; + + if(ev.Player.GameObject.TryGetComponent(out var comp)) + { + comp.Destroy(); + } + Log.Info("player lost shilde"); + + } + private void OnShooting(ShootingEventArgs ev) + { + if (!Check(ev.Player)) return; + + + ev.IsAllowed = false; + } + private void OnServerShattered(InventorySystem.Items.ThrowableProjectiles.Scp2176Projectile projectile,RoomIdentifier roomid) + { + Room room = Room.Get(roomid); + + foreach(Player player in room.Players.Where(Check)) + { + if (player.GameObject.TryGetComponent(out var comp)) + { + comp.Break(); + } + } + + + } + + private void OnDying(DyingEventArgs ev) + { + if (ev.ItemsToDrop.Any(Check)) + { + if (ev.Player.GameObject.TryGetComponent(out var comp)) + { + comp.Destroy(); + } + } + } + + private void OnHurting(HurtingEventArgs ev) + { + if (!Check(ev.Player)) + return; + if (ev.IsInstantKill) + return; + if (ev.DamageHandler.CustomBase is not FirearmDamageHandler) + return; + if (!ev.Player.GameObject.TryGetComponent(out var stat)) + { + return; + } + if (!stat.IsActive) return; + ev.Amount = stat.Damage(ev.Amount); + + + + } + + + + + } +} diff --git a/KruacentExiled/KE.Items/Items/ShieldBelt/ShieldBeltStat.cs b/KruacentExiled/KE.Items/Items/ShieldBelt/ShieldBeltStat.cs new file mode 100644 index 00000000..a6bf6656 --- /dev/null +++ b/KruacentExiled/KE.Items/Items/ShieldBelt/ShieldBeltStat.cs @@ -0,0 +1,173 @@ +using Exiled.API.Features; +using Exiled.API.Features.Toys; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using UnityEngine; + +namespace KE.Items.Items.ShieldBelt +{ + public class ShieldBeltStat : MonoBehaviour + { + public static readonly float MaxCharge = 110; + public static readonly float RechargeRatePerS = 13; + public static readonly float TimeBroken = 50; + public static readonly float Base = 20; + public static readonly Vector3 MaxSize = Vector3.one * 2; + + private float currentCharge; + private float timeRemaining; + private bool recharging = false; + + private Player player; + private Primitive primitive; + public void RechargeTick() + { + + + if (timeRemaining <= 0 && recharging) + { + Log.Debug("recharged"); + currentCharge = 20; + recharging = false; + } + + if (currentCharge <= 0) + { + Break(); + } + + if (primitive is not null) + { + float percent = currentCharge / MaxCharge; + + primitive.Scale = percent * MaxSize; + + } + + + if (!recharging) + { + if (!primitive.Visible) + { + primitive.Visible = true; + } + + if (currentCharge != MaxCharge) + { + + float tempcharge = currentCharge + RechargeRatePerS * Time.deltaTime; + currentCharge = Mathf.Clamp(tempcharge, 0, MaxCharge); + } + + } + else + { + timeRemaining -= Time.deltaTime; + if (timeRemaining < 0) + { + timeRemaining = 0; + } + if (primitive.Visible) + { + primitive.Visible = false; + } + } + + + } + + + /// + /// + /// + /// + /// remaining damage + public float Damage(float damage) + { + + + currentCharge = Mathf.Clamp(currentCharge - damage, 0, MaxCharge); + Log.Debug("cur=" + currentCharge); + Log.Debug("time=" + timeRemaining); + + if (IsActive) + { + return 0; + } + else + { + return damage; + } + + } + + + public void Break() + { + + if (!recharging) + { + Log.Debug("breakign"); + timeRemaining = TimeBroken; + currentCharge = 0; + recharging = true; + player.PlayShieldBreakSound(); + } + + } + + + public bool IsActive + { + get + { + return currentCharge > 0; + } + } + public bool IsRecharging + { + get + { + return recharging; + } + } + private Primitive CreatePrimitive(Player player) + { + Primitive prim = Primitive.Create(null, null, null, false); + + prim.Collidable = false; + prim.Visible = true; + prim.Transform.parent = player.ReferenceHub.transform; + prim.Transform.localPosition = Vector3.zero; + prim.Scale = MaxSize; + prim.Color = new Color32(50, 50, 50, 50); + prim.Spawn(); + return prim; + } + + public void Awake() + { + player = Player.Get(transform.root.gameObject); + Log.Debug(player.Nickname); + primitive = CreatePrimitive(player); + currentCharge = Base; + timeRemaining = 0; + } + + public void Destroy() + { + Log.Debug($"destroying {this}"); + primitive.Destroy(); + primitive = null; + Destroy(this); + } + + public void Update() + { + RechargeTick(); + } + } +} From 15484c86fd1589ceea87e4710fd835fb35c635bc Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Mon, 12 Jan 2026 16:16:33 +0100 Subject: [PATCH 489/853] added event --- KruacentExiled/KE.Misc/Features/Spawn.cs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/KruacentExiled/KE.Misc/Features/Spawn.cs b/KruacentExiled/KE.Misc/Features/Spawn.cs index cc511823..93a9b605 100644 --- a/KruacentExiled/KE.Misc/Features/Spawn.cs +++ b/KruacentExiled/KE.Misc/Features/Spawn.cs @@ -25,6 +25,7 @@ public class Spawn : MiscFeature public static event Action OnAssignedSCP = delegate { }; + public static event Action OnAssigned = delegate { }; private void OnRoundStarted() { @@ -37,6 +38,8 @@ private void OnRoundStarted() { SetScpPreferences(player); } + + OnAssigned?.Invoke(); } private void SetScpPreferences(Player player) From f16300d76e783080883a6a3b985109b90737cc4e Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Mon, 12 Jan 2026 16:57:48 +0100 Subject: [PATCH 490/853] change evnet --- KruacentExiled/KE.Misc/Features/Spawn.cs | 25 ++++++++++++------------ 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/KruacentExiled/KE.Misc/Features/Spawn.cs b/KruacentExiled/KE.Misc/Features/Spawn.cs index 93a9b605..3d6a3e96 100644 --- a/KruacentExiled/KE.Misc/Features/Spawn.cs +++ b/KruacentExiled/KE.Misc/Features/Spawn.cs @@ -24,46 +24,47 @@ public class Spawn : MiscFeature private Dictionary SelectableCustomSCPs => CustomSCP.All.ToDictionary(cs =>cs.Name, cs => cs); - public static event Action OnAssignedSCP = delegate { }; - public static event Action OnAssigned = delegate { }; + public static event Action> OnAssigned = delegate { }; private void OnRoundStarted() { if (!MainPlugin.Instance.Config.ScpPreferences) return; - + List players = new(); foreach (Player player in Player.List.Where(p => p.IsScp && !p.IsNPC)) { - SetScpPreferences(player); + if (SetScpPreferences(player)) + { + players.Add(player); + } } - OnAssigned?.Invoke(); + OnAssigned?.Invoke(players.ToList()); } - private void SetScpPreferences(Player player) + private bool SetScpPreferences(Player player) { Config config = MainPlugin.Instance.Config; if (config == null) { Log.Warn("no config, no custom preferences this round"); - return; + return false; } Dictionary chancescp = GetPreferences(player); if(chancescp == null) { Log.Error("no setting found"); + return false; } string roleScp = ChooseRandomRole(chancescp); Log.Debug($"Scp ({player.Nickname}) is {roleScp} previous : {player.Role.Type}"); - Timing.CallDelayed(1f, delegate - { - SetRoleWithId(player, roleScp); - }); + SetRoleWithId(player, roleScp); + return true; } @@ -115,7 +116,6 @@ private void SetRoleWithId(Player player, string name) if (baseRole.ContainsKey(name)) { player.Role.Set(baseRole[name]); - OnAssignedSCP?.Invoke(player); Log.Info("vanilla scp"); return; } @@ -123,7 +123,6 @@ private void SetRoleWithId(Player player, string name) if (SelectableCustomSCPs.ContainsKey(name)) { SelectableCustomSCPs[name].AddRole(player); - OnAssignedSCP?.Invoke(player); Log.Info("custom scp"); return; } From 04d72cb7280b88e6231a003f19a149cf6f4820ae Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Mon, 12 Jan 2026 17:01:02 +0100 Subject: [PATCH 491/853] changed event here too --- KruacentExiled/KE.CustomRoles/KE.CustomRoles.csproj | 1 + KruacentExiled/KE.CustomRoles/MainPlugin.cs | 8 +++++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/KruacentExiled/KE.CustomRoles/KE.CustomRoles.csproj b/KruacentExiled/KE.CustomRoles/KE.CustomRoles.csproj index 633fdab1..a98e3e0f 100644 --- a/KruacentExiled/KE.CustomRoles/KE.CustomRoles.csproj +++ b/KruacentExiled/KE.CustomRoles/KE.CustomRoles.csproj @@ -19,6 +19,7 @@ + diff --git a/KruacentExiled/KE.CustomRoles/MainPlugin.cs b/KruacentExiled/KE.CustomRoles/MainPlugin.cs index 88c58840..341a214b 100644 --- a/KruacentExiled/KE.CustomRoles/MainPlugin.cs +++ b/KruacentExiled/KE.CustomRoles/MainPlugin.cs @@ -12,7 +12,9 @@ using MEC; using Microsoft.Win32; using System; +using System.Collections.Generic; using System.Linq; +using System.Runtime.InteropServices.ComTypes; namespace KE.CustomRoles @@ -71,17 +73,17 @@ public override void OnDisabled() public void SubscribeEvents() { - Exiled.Events.Handlers.Server.RoundStarted += CustomRoleImplement; + Misc.Features.Spawn.OnAssigned += CustomRoleImplement; Exiled.Events.Handlers.Server.RespawnedTeam += CustomRoleRespawning; } public void UnsubscribeEvents() { - Exiled.Events.Handlers.Server.RoundStarted -= CustomRoleImplement; + Misc.Features.Spawn.OnAssigned -= CustomRoleImplement; Exiled.Events.Handlers.Server.RespawnedTeam -= CustomRoleRespawning; } - public void CustomRoleImplement() + public void CustomRoleImplement(IEnumerable players) { KECustomRole.GiveRandomRole(Player.List); From c226e0ba19e27815bd9e4c64b115204338d07a87 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Mon, 12 Jan 2026 17:08:33 +0100 Subject: [PATCH 492/853] changed event again --- .../KE.Misc/Features/{ => Spawn}/Spawn.cs | 31 ++++++------------ .../Features/Spawn/SpawnedEventArgs.cs | 32 +++++++++++++++++++ KruacentExiled/KE.Misc/MainPlugin.cs | 1 + 3 files changed, 43 insertions(+), 21 deletions(-) rename KruacentExiled/KE.Misc/Features/{ => Spawn}/Spawn.cs (79%) create mode 100644 KruacentExiled/KE.Misc/Features/Spawn/SpawnedEventArgs.cs diff --git a/KruacentExiled/KE.Misc/Features/Spawn.cs b/KruacentExiled/KE.Misc/Features/Spawn/Spawn.cs similarity index 79% rename from KruacentExiled/KE.Misc/Features/Spawn.cs rename to KruacentExiled/KE.Misc/Features/Spawn/Spawn.cs index 3d6a3e96..8752869e 100644 --- a/KruacentExiled/KE.Misc/Features/Spawn.cs +++ b/KruacentExiled/KE.Misc/Features/Spawn/Spawn.cs @@ -8,7 +8,7 @@ using System.Collections.Generic; using System.Linq; -namespace KE.Misc.Features +namespace KE.Misc.Features.Spawn { public class Spawn : MiscFeature { @@ -24,24 +24,22 @@ public class Spawn : MiscFeature private Dictionary SelectableCustomSCPs => CustomSCP.All.ToDictionary(cs =>cs.Name, cs => cs); - public static event Action> OnAssigned = delegate { }; + public static event Action OnAssigned = delegate { }; + + private SpawnedEventArgs eventarg; private void OnRoundStarted() { if (!MainPlugin.Instance.Config.ScpPreferences) return; - List players = new(); - + eventarg = new(); foreach (Player player in Player.List.Where(p => p.IsScp && !p.IsNPC)) { - if (SetScpPreferences(player)) - { - players.Add(player); - } + SetScpPreferences(player); } - OnAssigned?.Invoke(players.ToList()); + OnAssigned?.Invoke(eventarg); } private bool SetScpPreferences(Player player) @@ -116,6 +114,8 @@ private void SetRoleWithId(Player player, string name) if (baseRole.ContainsKey(name)) { player.Role.Set(baseRole[name]); + eventarg.VanillaRoles.Add(player); + Log.Info("vanilla scp"); return; } @@ -123,6 +123,7 @@ private void SetRoleWithId(Player player, string name) if (SelectableCustomSCPs.ContainsKey(name)) { SelectableCustomSCPs[name].AddRole(player); + eventarg.CustomRoles.Add(player); Log.Info("custom scp"); return; } @@ -137,25 +138,13 @@ private void SetRoleWithId(Player player, string name) public override void SubscribeEvents() { - Exiled.Events.Handlers.Server.EndingRound += EndingRound; Exiled.Events.Handlers.Server.AllPlayersSpawned += OnRoundStarted; } public override void UnsubscribeEvents() { - Exiled.Events.Handlers.Server.EndingRound -= EndingRound; Exiled.Events.Handlers.Server.AllPlayersSpawned -= OnRoundStarted; } - - public void EndingRound(EndingRoundEventArgs ev) - { - //if (Scp035._trackedPlayers.Count <= 0) return; - - //if (ev.ClassList.mtf_and_guards != 0 || ev.ClassList.scientists != 0) ev.IsAllowed = false; - //else if (ev.ClassList.class_ds != 0 || ev.ClassList.chaos_insurgents != 0) ev.IsAllowed = false; - //else if (ev.ClassList.scps_except_zombies + ev.ClassList.zombies > 0) ev.IsAllowed = true; - //else ev.IsAllowed = true; - } } diff --git a/KruacentExiled/KE.Misc/Features/Spawn/SpawnedEventArgs.cs b/KruacentExiled/KE.Misc/Features/Spawn/SpawnedEventArgs.cs new file mode 100644 index 00000000..1c581734 --- /dev/null +++ b/KruacentExiled/KE.Misc/Features/Spawn/SpawnedEventArgs.cs @@ -0,0 +1,32 @@ +using Exiled.API.Features; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using YamlDotNet.Serialization.ObjectGraphVisitors; + +namespace KE.Misc.Features.Spawn +{ + public class SpawnedEventArgs + { + + + public List VanillaRoles { get; } + public List CustomRoles { get; } + + + + public SpawnedEventArgs(List vanilla,List custom) + { + VanillaRoles = vanilla; + CustomRoles = custom; + } + + public SpawnedEventArgs() + { + VanillaRoles = new(); + CustomRoles = new(); + } + } +} diff --git a/KruacentExiled/KE.Misc/MainPlugin.cs b/KruacentExiled/KE.Misc/MainPlugin.cs index 545550a7..ef2764b1 100644 --- a/KruacentExiled/KE.Misc/MainPlugin.cs +++ b/KruacentExiled/KE.Misc/MainPlugin.cs @@ -10,6 +10,7 @@ using HarmonyLib; using LabApi.Events.Arguments.ServerEvents; using KE.Misc.Features.VoteStart; +using KE.Misc.Features.Spawn; namespace KE.Misc { From 5c48cd9bf6648d4ab997f0f2e93353209343d514 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Mon, 12 Jan 2026 17:15:17 +0100 Subject: [PATCH 493/853] corrected spawn with the wrong cr + removed 457 --- KruacentExiled/KE.CustomRoles/CR/SCP/SCP457.cs | 2 +- KruacentExiled/KE.CustomRoles/MainPlugin.cs | 9 +++++---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/KruacentExiled/KE.CustomRoles/CR/SCP/SCP457.cs b/KruacentExiled/KE.CustomRoles/CR/SCP/SCP457.cs index 6f250e0e..5b679b24 100644 --- a/KruacentExiled/KE.CustomRoles/CR/SCP/SCP457.cs +++ b/KruacentExiled/KE.CustomRoles/CR/SCP/SCP457.cs @@ -30,7 +30,7 @@ public class SCP457 : CustomSCP public override bool KeepRoleOnChangingRole { get; set; } = false; public override bool IsSupport { get; } = false; - public override float SpawnChance { get; set; } = 100; + public override float SpawnChance { get; set; } = 0; private Dictionary _inside = new(); private Dictionary> _handles = new(); diff --git a/KruacentExiled/KE.CustomRoles/MainPlugin.cs b/KruacentExiled/KE.CustomRoles/MainPlugin.cs index 341a214b..d0d086c7 100644 --- a/KruacentExiled/KE.CustomRoles/MainPlugin.cs +++ b/KruacentExiled/KE.CustomRoles/MainPlugin.cs @@ -7,6 +7,7 @@ using KE.CustomRoles.Abilities.FireAbilities; using KE.CustomRoles.API.Features; using KE.CustomRoles.Settings; +using KE.Misc.Features.Spawn; using KE.Utils.API.CustomStats; using KE.Utils.API.Displays.DisplayMeow; using MEC; @@ -73,19 +74,19 @@ public override void OnDisabled() public void SubscribeEvents() { - Misc.Features.Spawn.OnAssigned += CustomRoleImplement; + Misc.Features.Spawn.Spawn.OnAssigned += CustomRoleImplement; Exiled.Events.Handlers.Server.RespawnedTeam += CustomRoleRespawning; } public void UnsubscribeEvents() { - Misc.Features.Spawn.OnAssigned -= CustomRoleImplement; + Misc.Features.Spawn.Spawn.OnAssigned -= CustomRoleImplement; Exiled.Events.Handlers.Server.RespawnedTeam -= CustomRoleRespawning; } - public void CustomRoleImplement(IEnumerable players) + public void CustomRoleImplement(SpawnedEventArgs ev) { - KECustomRole.GiveRandomRole(Player.List); + KECustomRole.GiveRandomRole(Player.List.Except(ev.CustomRoles)); } From 77e280ebcbc74f59fee8bfb7d62ef6960f222731 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Mon, 12 Jan 2026 17:21:23 +0100 Subject: [PATCH 494/853] moved customscp + fix some stuff --- KruacentExiled/KE.CustomRoles/API/Features/CustomSCP.cs | 6 +++++- .../KE.CustomRoles/API/Features/KECustomRole.cs | 5 ++++- .../KE.CustomRoles/CR/{SCP => CustomSCPs}/SCP035.cs | 8 +------- .../KE.CustomRoles/CR/{SCP => CustomSCPs}/SCP457.cs | 2 +- KruacentExiled/KE.CustomRoles/CR/Scientist/scp202.cs | 4 ++-- 5 files changed, 13 insertions(+), 12 deletions(-) rename KruacentExiled/KE.CustomRoles/CR/{SCP => CustomSCPs}/SCP035.cs (97%) rename KruacentExiled/KE.CustomRoles/CR/{SCP => CustomSCPs}/SCP457.cs (99%) diff --git a/KruacentExiled/KE.CustomRoles/API/Features/CustomSCP.cs b/KruacentExiled/KE.CustomRoles/API/Features/CustomSCP.cs index 46cb0ade..0ddd3563 100644 --- a/KruacentExiled/KE.CustomRoles/API/Features/CustomSCP.cs +++ b/KruacentExiled/KE.CustomRoles/API/Features/CustomSCP.cs @@ -21,7 +21,11 @@ public abstract class CustomSCP : KECustomRole public static IEnumerable All => Registered.Where(c => c is CustomSCP).Cast(); public override void Init() { - + if (SpawnChance <= 0) + { + base.Init(); + return; + } if (header is null) { diff --git a/KruacentExiled/KE.CustomRoles/API/Features/KECustomRole.cs b/KruacentExiled/KE.CustomRoles/API/Features/KECustomRole.cs index 7201a4f7..5db31f0e 100644 --- a/KruacentExiled/KE.CustomRoles/API/Features/KECustomRole.cs +++ b/KruacentExiled/KE.CustomRoles/API/Features/KECustomRole.cs @@ -318,7 +318,10 @@ protected virtual void SetSpawn(Player player) protected virtual void SetCustomInfo(Player player) { - player.CustomInfo = player.CustomName + "\n" + PublicName; + if (!string.IsNullOrEmpty(PublicName)) + { + player.CustomInfo = player.CustomName + "\n" + PublicName; + } player.InfoArea &= ~(PlayerInfoArea.Nickname | PlayerInfoArea.Role); } diff --git a/KruacentExiled/KE.CustomRoles/CR/SCP/SCP035.cs b/KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP035.cs similarity index 97% rename from KruacentExiled/KE.CustomRoles/CR/SCP/SCP035.cs rename to KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP035.cs index 5541f9c0..e70745ea 100644 --- a/KruacentExiled/KE.CustomRoles/CR/SCP/SCP035.cs +++ b/KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP035.cs @@ -1,21 +1,15 @@ using Exiled.API.Enums; using Exiled.API.Extensions; using Exiled.API.Features; -using Exiled.API.Features.Toys; using Exiled.CustomItems.API.Features; using Exiled.Events.EventArgs.Player; using Exiled.Events.EventArgs.Scp1509; using Exiled.Events.EventArgs.Server; using KE.CustomRoles.API.Features; using PlayerRoles; -using System; using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using UnityEngine; -namespace KE.CustomRoles.CR.SCP +namespace KE.CustomRoles.CR.CustomSCPs { public class SCP035 : CustomSCP { diff --git a/KruacentExiled/KE.CustomRoles/CR/SCP/SCP457.cs b/KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP457.cs similarity index 99% rename from KruacentExiled/KE.CustomRoles/CR/SCP/SCP457.cs rename to KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP457.cs index 5b679b24..ddc67903 100644 --- a/KruacentExiled/KE.CustomRoles/CR/SCP/SCP457.cs +++ b/KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP457.cs @@ -17,7 +17,7 @@ using UnityEngine; using Light = Exiled.API.Features.Toys.Light; -namespace KE.CustomRoles.CR.SCP +namespace KE.CustomRoles.CR.CustomSCPs { public class SCP457 : CustomSCP { diff --git a/KruacentExiled/KE.CustomRoles/CR/Scientist/scp202.cs b/KruacentExiled/KE.CustomRoles/CR/Scientist/scp202.cs index aee31692..16458163 100644 --- a/KruacentExiled/KE.CustomRoles/CR/Scientist/scp202.cs +++ b/KruacentExiled/KE.CustomRoles/CR/Scientist/scp202.cs @@ -10,8 +10,8 @@ namespace KE.CustomRoles.CR.Scientist { public class Scp202 : KECustomRole, IColor { - public override string Description { get; set; } = "? emsizan-itna'd te emsinummoc itna'd eiv enu sèrpa\n7691 lirva 91 el trom te engoloc à 6781 reivnaj 5 el én\n,etarcoméd neitérhc itrap ud eitrap tnasiaf 5691 à 9491 ed reilecnahC\n?elaidnom erreug ednoces al sèrpa dnamella reilecnahc re1 el darnoK erid xuev uT ?drannoC"; public override string PublicName { get; set; } = "SCP-202"; + public override string Description { get; set; } = "? emsizan-itna'd te emsinummoc itna'd eiv enu sèrpa\n7691 lirva 91 el trom te engoloc à 6781 reivnaj 5 el én\n,etarcoméd neitérhc itrap ud eitrap tnasiaf 5691 à 9491 ed reilecnahC\n?elaidnom erreug ednoces al sèrpa dnamella reilecnahc re1 el darnoK erid xuev uT ?drannoC"; public override int MaxHealth { get; set; } = 100; public override RoleTypeId Role { get; set; } = RoleTypeId.Scientist; public override bool KeepRoleOnDeath { get; set; } = false; @@ -20,7 +20,7 @@ public class Scp202 : KECustomRole, IColor public override float SpawnChance { get; set; } = 100; public Color32 Color => new Color32(191, 255, 183, 0); - public static readonly Vector3 scale = new(); + public static readonly Vector3 scale = new(-1,1,1); protected override void SubscribeEvents() { From 31a0c3181f700a16472dda493405932d9601728b Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Mon, 12 Jan 2026 18:31:57 +0100 Subject: [PATCH 495/853] trnaslation doesn't work idk why --- .../API/Features/KECustomRole.cs | 21 +++++++++- .../KE.CustomRoles/CRTranslationFile.cs | 17 ++++++++ KruacentExiled/KE.CustomRoles/MainPlugin.cs | 21 +++++++++- KruacentExiled/KE.CustomRoles/Translations.cs | 41 ------------------- 4 files changed, 56 insertions(+), 44 deletions(-) create mode 100644 KruacentExiled/KE.CustomRoles/CRTranslationFile.cs delete mode 100644 KruacentExiled/KE.CustomRoles/Translations.cs diff --git a/KruacentExiled/KE.CustomRoles/API/Features/KECustomRole.cs b/KruacentExiled/KE.CustomRoles/API/Features/KECustomRole.cs index 5db31f0e..8962874e 100644 --- a/KruacentExiled/KE.CustomRoles/API/Features/KECustomRole.cs +++ b/KruacentExiled/KE.CustomRoles/API/Features/KECustomRole.cs @@ -1,4 +1,5 @@ -using Exiled.API.Enums; +using CustomPlayerEffects; +using Exiled.API.Enums; using Exiled.API.Extensions; using Exiled.API.Features; using Exiled.API.Features.Items; @@ -12,6 +13,7 @@ using KE.CustomRoles.API.Interfaces; using KE.Utils.API.Displays.DisplayMeow; using KE.Utils.API.Displays.DisplayMeow.Placements; +using KE.Utils.API.Translations; using MEC; using PlayerRoles; using System; @@ -21,6 +23,7 @@ using System.Reflection; using System.Text; using UnityEngine; +using YamlDotNet.Core.Tokens; namespace KE.CustomRoles.API.Features { @@ -104,12 +107,28 @@ protected override void ShowMessage(Player player) private static Dictionary typeLookupTable = new(); private static Dictionary stringLookupTable = new(); + private static TranslationFile translation => MainPlugin.Instance.translation; + + + protected virtual List CreateKeys() + { + return new List() + { + new(Name+"_PublicName",PublicName), + new(Name+"_Description",Description), + }; + } + + public static List keys = new(); public override void Init() { typeLookupTable.Add(GetType(), this); stringLookupTable.Add(Name, this); InternalSubscribeEvents(); SubscribeEvents(); + Log.Debug("adding keys to "+Name); + keys.AddRange(CreateKeys()); + } public override void Destroy() diff --git a/KruacentExiled/KE.CustomRoles/CRTranslationFile.cs b/KruacentExiled/KE.CustomRoles/CRTranslationFile.cs new file mode 100644 index 00000000..3e393880 --- /dev/null +++ b/KruacentExiled/KE.CustomRoles/CRTranslationFile.cs @@ -0,0 +1,17 @@ +using KE.Utils.API.Translations; +using System.Collections.Generic; + +namespace KE.CustomRoles +{ + internal class CRTranslationFile : TranslationFile + { + public override string Lang => "en"; + + public override string Key => "KE.CR"; + + public override List Values => + [ + + ]; + } +} diff --git a/KruacentExiled/KE.CustomRoles/MainPlugin.cs b/KruacentExiled/KE.CustomRoles/MainPlugin.cs index d0d086c7..4b5030d8 100644 --- a/KruacentExiled/KE.CustomRoles/MainPlugin.cs +++ b/KruacentExiled/KE.CustomRoles/MainPlugin.cs @@ -10,6 +10,7 @@ using KE.Misc.Features.Spawn; using KE.Utils.API.CustomStats; using KE.Utils.API.Displays.DisplayMeow; +using KE.Utils.API.Translations; using MEC; using Microsoft.Win32; using System; @@ -20,7 +21,7 @@ namespace KE.CustomRoles { - public class MainPlugin : Plugin + public class MainPlugin : Plugin, Utils.API.Translations.ITranslation { public override string Name => "KE.CustomRoles"; public override string Prefix => "KE.CR"; @@ -33,16 +34,18 @@ public class MainPlugin : Plugin public static readonly HintPlacement AbilitiesDesc = new(0, 900); public static readonly HintPlacement Abilities = new(0, 850,HintServiceMeow.Core.Enum.HintAlignment.Left); public static readonly HintPlacement RightHPbars = new(55, 1000,HintServiceMeow.Core.Enum.HintAlignment.Left); - public static Translations Translations => Instance?.Translation; private SettingHandler _settingHandler; internal static SettingHandler SettingHandler => Instance?._settingHandler; + internal TranslationFile translation; + public TranslationFile Translation => translation; private Harmony Harmony; public override void OnEnabled() { Instance = this; + translation = new CRTranslationFile(); _settingHandler = new(); //Utils.API.Settings.SettingHandler.Instance.SubscribeEvents(); @@ -55,6 +58,7 @@ public override void OnEnabled() KEAbilities.Register(Assembly); KECustomRole.Register(); SubscribeEvents(); + base.OnEnabled(); } public override void OnDisabled() @@ -70,6 +74,7 @@ public override void OnDisabled() Utils.API.Settings.SettingHandler.Instance.UnsubscribeEvents(); _settingHandler = null; Instance = null; + base.OnDisabled(); } public void SubscribeEvents() @@ -86,10 +91,22 @@ public void UnsubscribeEvents() public void CustomRoleImplement(SpawnedEventArgs ev) { + ShowTranslation(); KECustomRole.GiveRandomRole(Player.List.Except(ev.CustomRoles)); } + + public void ShowTranslation() + { + ///???????????? + translation.Values.AddRange(KECustomRole.keys); + Log.Debug("nb trnalsaikey"+ KECustomRole.keys.Count); + Log.Debug("nb trnalsai"+ translation.Values.Count); + + Log.Debug(translation.ToString()); + } + public void CustomRoleRespawning(RespawnedTeamEventArgs ev) { KECustomRole.GiveRandomRole(ev.Players); diff --git a/KruacentExiled/KE.CustomRoles/Translations.cs b/KruacentExiled/KE.CustomRoles/Translations.cs deleted file mode 100644 index bb08f730..00000000 --- a/KruacentExiled/KE.CustomRoles/Translations.cs +++ /dev/null @@ -1,41 +0,0 @@ -using Exiled.API.Interfaces; -using System; -using System.Collections.Generic; -using System.ComponentModel; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace KE.CustomRoles -{ - public class Translations : ITranslation - { - public string GettingNewRole { get; set; } = "%Name%\n %Desc%"; - - - [Description("Russe (1050)")] - public string RusseDesc { get; set; } = "Tu es unmaitre de jeu \nyou should play russian roulette with the others"; - public string RussePublicName { get; set; } = "Russian"; - - - [Description("DBoyInShape (1058)")] - public string InShapeDesc { get; set; } = "Dammmmnnnnnnn les gates"; // aucune idée comment traduire ça - public string InShapePublicName { get; set; } = "DBoyInShape"; - - - [Description("Enfant (1041)")] - public string EnfantDesc { get; set; } = "You are a Kid \ndo not the kid \nyou start with a rainbow candy (in theory) \n you're a bit smaller"; - public string EnfantPublicName { get; set; } = "kid"; - - - [Description("Mime (1053)")] - public string MimePublicName { get; set; } = "Mime"; - - - [Description("ChiefGuard (1046)")] - public string ChiefGuardPublicName { get; set; } = "Chief Guard"; - public string ChiefGuardDesc { get; set; } = "Tu es un Chef des gardes du site \nT'as une carte de private \net un crossvec"; - - - } -} From e09fc6bbfd2fae8c0dba60237edfde47d84b880c Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Mon, 12 Jan 2026 19:26:06 +0100 Subject: [PATCH 496/853] last human message --- .../Features/LastHuman/LastHumanHandler.cs | 104 ++++++++++++++++++ .../Features/LastHuman/LastHumanPosition.cs | 2 +- KruacentExiled/KE.Misc/Features/SCPBuff.cs | 24 +--- KruacentExiled/KE.Misc/MainPlugin.cs | 7 +- 4 files changed, 112 insertions(+), 25 deletions(-) create mode 100644 KruacentExiled/KE.Misc/Features/LastHuman/LastHumanHandler.cs diff --git a/KruacentExiled/KE.Misc/Features/LastHuman/LastHumanHandler.cs b/KruacentExiled/KE.Misc/Features/LastHuman/LastHumanHandler.cs new file mode 100644 index 00000000..bf48dc48 --- /dev/null +++ b/KruacentExiled/KE.Misc/Features/LastHuman/LastHumanHandler.cs @@ -0,0 +1,104 @@ +using Exiled.API.Features; +using Exiled.Events.EventArgs.Player; +using Exiled.Events.EventArgs.Scp106; +using HintServiceMeow.Core.Models.Hints; +using HintServiceMeow.Core.Utilities; +using KE.Utils.API.Displays.DisplayMeow; +using KE.Utils.API.Displays.DisplayMeow.Placements; +using KE.Utils.API.Features.SCPs; +using KE.Utils.API.Interfaces; +using LabApi.Events.Arguments.PlayerEvents; +using PlayerRoles; +using PlayerRoles.FirstPersonControl.Thirdperson; +using System.Linq; + +namespace KE.Misc.Features.LastHuman +{ + public class LastHumanHandler : IUsingEvents + { + + public static readonly string TextLast1 = "You feel like everyone is counting on you"; + public static readonly string TextLast2 = "You feel suddenly very lonely"; + + public static HintPosition position = new LastHumanPosition(); + + public void SubscribeEvents() + { + LabApi.Events.Handlers.PlayerEvents.ChangedRole += OnChangedRole; + Exiled.Events.Handlers.Scp106.Attacking += OnAttacking; + } + + public void UnsubscribeEvents() + { + LabApi.Events.Handlers.PlayerEvents.ChangedRole -= OnChangedRole; + Exiled.Events.Handlers.Scp106.Attacking -= OnAttacking; + } + + + + private void OnAttacking(AttackingEventArgs ev) + { + if (ev.IsAllowed && TryGetLastTarget(out _)) + { + ev.Target.Kill(Exiled.API.Enums.DamageType.Scp106); + } + } + private void OnChangedRole(PlayerChangedRoleEventArgs ev) + { + + if (Round.ElapsedTime.TotalSeconds < 10) + return; + + if(TryGetLastTarget(out Player player)) + { + AbstractHint hint = DisplayHandler.Instance.GetHint(player, position.HintPlacement); + + if (hint is null || hint.Hide) + { + string msg = TextLast1; + if (UnityEngine.Random.Range(1,3) % 2 == 0) + { + msg = TextLast2; + } + + + DisplayHandler.Instance.AddHint(position.HintPlacement, player, msg, 10); + + Log.Debug("show message to "+player.Nickname); + } + + } + } + + + private static bool TryGetLastTarget(out Player lastTarget) + { + lastTarget = null; + int num = 0; + int num2 = 0; + foreach (ReferenceHub allHub in ReferenceHub.AllHubs) + { + Log.Debug(allHub.nicknameSync.DisplayName); + if (allHub.IsHuman()) + { + num++; + lastTarget = Player.Get(allHub); + } + else if (allHub.IsSCP()) + { + num2++; + } + } + + + + if (num == 1) + { + return num2 > 0; + } + return false; + } + + + } +} diff --git a/KruacentExiled/KE.Misc/Features/LastHuman/LastHumanPosition.cs b/KruacentExiled/KE.Misc/Features/LastHuman/LastHumanPosition.cs index 658d9289..c7a0f462 100644 --- a/KruacentExiled/KE.Misc/Features/LastHuman/LastHumanPosition.cs +++ b/KruacentExiled/KE.Misc/Features/LastHuman/LastHumanPosition.cs @@ -12,7 +12,7 @@ public class LastHumanPosition : HintPosition { public override float Xposition => 0; - public override float Yposition => 400; + public override float Yposition => 120; public override string Name => "LastHuman"; public override HintAlignment HintAlignment => HintAlignment.Center; diff --git a/KruacentExiled/KE.Misc/Features/SCPBuff.cs b/KruacentExiled/KE.Misc/Features/SCPBuff.cs index 240fffb2..7e2c4e4b 100644 --- a/KruacentExiled/KE.Misc/Features/SCPBuff.cs +++ b/KruacentExiled/KE.Misc/Features/SCPBuff.cs @@ -23,39 +23,17 @@ internal SCPBuff() { } public void SubscribeEvents() { Exiled.Events.Handlers.Player.ChangingRole += BecomingSCP; - Exiled.Events.Handlers.Scp106.Attacking += OnAttacking; - Exiled.Events.Handlers.Player.Died += OnDied; } public void UnsubscribeEvents() { Exiled.Events.Handlers.Player.ChangingRole -= BecomingSCP; - Exiled.Events.Handlers.Scp106.Attacking -= OnAttacking; - Exiled.Events.Handlers.Player.Died -= OnDied; + } - private void OnDied(DiedEventArgs ev) - { - IEnumerable players = Player.Enumerable.Where(p => p.IsHuman); - if (players.Count() > 1) - { - return; - } - - } - - - private void OnAttacking(AttackingEventArgs ev) - { - if(ev.IsAllowed && Player.Enumerable.Count(p => !p.IsScp && p.IsAlive) == 1) - { - ev.Target.Vaporize(); - } - } - internal void StartBuff() { Timing.RunCoroutine(PeanutShield()); diff --git a/KruacentExiled/KE.Misc/MainPlugin.cs b/KruacentExiled/KE.Misc/MainPlugin.cs index ef2764b1..c4ba1945 100644 --- a/KruacentExiled/KE.Misc/MainPlugin.cs +++ b/KruacentExiled/KE.Misc/MainPlugin.cs @@ -11,6 +11,7 @@ using LabApi.Events.Arguments.ServerEvents; using KE.Misc.Features.VoteStart; using KE.Misc.Features.Spawn; +using KE.Misc.Features.LastHuman; namespace KE.Misc { @@ -35,6 +36,7 @@ public class MainPlugin : Plugin internal AutoTesla AutoTesla { get; private set; } internal EventHandlers _gamblingCoinHandler { get; private set; } internal SpawnLcz SpawnLcz { get; private set; } + internal LastHumanHandler LastHuman { get; private set; } private Harmony harmony; internal VoteStart vote { get; private set; } @@ -54,6 +56,7 @@ public override void OnEnabled() FriendlyFire = new(); AutoNukeAnnoucement = new(); AutoTesla = new(); + LastHuman = new(); Candy = new Candy(); vote = new(); //SpawnLcz = new(); @@ -71,7 +74,7 @@ public override void OnEnabled() _gamblingCoinHandler = new EventHandlers(); Exiled.Events.Handlers.Player.FlippingCoin += _gamblingCoinHandler.OnCoinFlip; } - + LastHuman.SubscribeEvents(); SCPBuff.SubscribeEvents(); Exiled.Events.Handlers.Server.RoundStarted += AutoNukeAnnoucement.OnRoundStarted; ServerHandle.RoundStarted += ServerHandler.OnRoundStarted; @@ -85,6 +88,7 @@ public override void OnDisabled() ServerHandle.RoundStarted -= ServerHandler.OnRoundStarted; LabApi.Events.Handlers.ServerEvents.CassieQueuingScpTermination -= NoeDeath; Exiled.Events.Handlers.Server.RoundStarted -= AutoNukeAnnoucement.OnRoundStarted; + LastHuman.UnsubscribeEvents(); SCPBuff.UnsubscribeEvents(); if (Config.GamblingCoin) { @@ -111,6 +115,7 @@ public override void OnDisabled() //SurfaceLight = null; GamblingCoinManager.DestroyAll(); _gamblingCoinHandler = null; + LastHuman = null; harmony = null; Instance = null; } From 9564742767410bb4a1fafe6998f34457b5926241 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Mon, 12 Jan 2026 19:36:40 +0100 Subject: [PATCH 497/853] cassie 035 --- .../KE.CustomRoles/CR/CustomSCPs/SCP035.cs | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP035.cs b/KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP035.cs index e70745ea..5ce9792d 100644 --- a/KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP035.cs +++ b/KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP035.cs @@ -1,4 +1,5 @@ -using Exiled.API.Enums; +using Cassie; +using Exiled.API.Enums; using Exiled.API.Extensions; using Exiled.API.Features; using Exiled.CustomItems.API.Features; @@ -50,6 +51,7 @@ public class SCP035 : CustomSCP protected override void SubscribeEvents() { Exiled.Events.Handlers.Player.Hurting += OnHurting; + Exiled.Events.Handlers.Player.Dying += OnDying; Exiled.Events.Handlers.Player.SearchingPickup += OnSearchingPickup; Exiled.Events.Handlers.Server.EndingRound += OnEndingRound; Exiled.Events.Handlers.Scp1509.Resurrecting += OnResurrecting; @@ -61,6 +63,7 @@ protected override void SubscribeEvents() protected override void UnsubscribeEvents() { Exiled.Events.Handlers.Player.Hurting -= OnHurting; + Exiled.Events.Handlers.Player.Dying -= OnDying; Exiled.Events.Handlers.Player.SearchingPickup -= OnSearchingPickup; Exiled.Events.Handlers.Server.EndingRound -= OnEndingRound; Exiled.Events.Handlers.Scp1509.Resurrecting -= OnResurrecting; @@ -68,6 +71,14 @@ protected override void UnsubscribeEvents() base.UnsubscribeEvents(); } + private void OnDying(DyingEventArgs ev) + { + if (!Check(ev.Player)) return; + Log.Debug("cassie message"); + + Exiled.API.Features.Cassie.CustomScpTermination("0 35", ev.DamageHandler); + } + protected override void RoleAdded(Player player) { @@ -77,8 +88,8 @@ protected override void RoleAdded(Player player) } - public static readonly string CantPickup = "A strange force called \'game balance\' prevents you from picking up this item"; - public static readonly string CantUse = "A strange force called \'game balance\' prevents you from using this item"; + public static readonly string CantPickup = "A strange force called \'game balance\' \nprevents you from picking up this item"; + public static readonly string CantUse = "A strange force called \'game balance\' \nprevents you from using this item"; private void OnUsingItem(UsingItemEventArgs ev) { From 6494e7a76a5ea2a485f4c6013b037b224727e56d Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Mon, 12 Jan 2026 19:43:47 +0100 Subject: [PATCH 498/853] casise 035 --- KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP035.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP035.cs b/KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP035.cs index 5ce9792d..2613bb42 100644 --- a/KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP035.cs +++ b/KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP035.cs @@ -76,7 +76,8 @@ private void OnDying(DyingEventArgs ev) if (!Check(ev.Player)) return; Log.Debug("cassie message"); - Exiled.API.Features.Cassie.CustomScpTermination("0 35", ev.DamageHandler); + Exiled.API.Features.Cassie.CustomScpTermination("SCP 0 3 5", ev.DamageHandler); + } protected override void RoleAdded(Player player) From 2d3a4c2c98b8af82077a7ffbfccaaed75718d909 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Mon, 12 Jan 2026 20:22:20 +0100 Subject: [PATCH 499/853] added player count to 035 --- .../CR/CustomSCPs/RemainingPlayerPosition.cs | 19 +++++++++++++++ .../KE.CustomRoles/CR/CustomSCPs/SCP035.cs | 24 +++++++++++++++++-- .../KE.CustomRoles/Settings/SettingHandler.cs | 11 ++++++++- 3 files changed, 51 insertions(+), 3 deletions(-) create mode 100644 KruacentExiled/KE.CustomRoles/CR/CustomSCPs/RemainingPlayerPosition.cs diff --git a/KruacentExiled/KE.CustomRoles/CR/CustomSCPs/RemainingPlayerPosition.cs b/KruacentExiled/KE.CustomRoles/CR/CustomSCPs/RemainingPlayerPosition.cs new file mode 100644 index 00000000..5c20c9f4 --- /dev/null +++ b/KruacentExiled/KE.CustomRoles/CR/CustomSCPs/RemainingPlayerPosition.cs @@ -0,0 +1,19 @@ +using HintServiceMeow.Core.Enum; +using KE.Utils.API.Displays.DisplayMeow.Placements; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace KE.CustomRoles.CR.CustomSCPs +{ + public class RemainingPlayerPosition : HintPosition + { + public override float Xposition => 1820; + + public override float Yposition => 60; + + public override HintAlignment HintAlignment => HintAlignment.Center; + } +} diff --git a/KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP035.cs b/KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP035.cs index 2613bb42..9e23a42c 100644 --- a/KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP035.cs +++ b/KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP035.cs @@ -2,13 +2,20 @@ using Exiled.API.Enums; using Exiled.API.Extensions; using Exiled.API.Features; +using Exiled.API.Features.Pools; using Exiled.CustomItems.API.Features; using Exiled.Events.EventArgs.Player; using Exiled.Events.EventArgs.Scp1509; using Exiled.Events.EventArgs.Server; +using HintServiceMeow.Core.Models.Arguments; +using HintServiceMeow.Core.Utilities; using KE.CustomRoles.API.Features; +using KE.Utils.API.Displays.DisplayMeow; +using KE.Utils.API.Displays.DisplayMeow.Placements; using PlayerRoles; +using System; using System.Collections.Generic; +using System.Text; namespace KE.CustomRoles.CR.CustomSCPs { @@ -17,7 +24,7 @@ public class SCP035 : CustomSCP public override bool IsSupport => false; public override string PublicName { get; set; } = "SCP-035"; - public override int MaxHealth { get; set; } = 1300; + public override int MaxHealth { get; set; } = 1200; public override string Description { get; set; } = "You can't pickup the Micro-HID and anything made with it, but you take 2 time less damage by these weapon"; protected override int SettingId => 10002; @@ -70,7 +77,7 @@ protected override void UnsubscribeEvents() Exiled.Events.Handlers.Player.UsingItem -= OnUsingItem; base.UnsubscribeEvents(); } - + private static HintPosition position = new RemainingPlayerPosition(); private void OnDying(DyingEventArgs ev) { if (!Check(ev.Player)) return; @@ -82,6 +89,8 @@ private void OnDying(DyingEventArgs ev) protected override void RoleAdded(Player player) { + PlayerDisplay dis = PlayerDisplay.Get(player); + DisplayHandler.Instance.CreateAuto(player, (args) => GetPlayers(args), position.HintPlacement); player.VoiceChannel = VoiceChat.VoiceChatChannel.ScpChat; player.Position = RoleTypeId.Scp049.GetRandomSpawnLocation().Position; @@ -89,6 +98,17 @@ protected override void RoleAdded(Player player) } + private string GetPlayers(AutoContentUpdateArg arg) + { + + if (!Check(Player.Get(arg.PlayerDisplay.ReferenceHub))) + return string.Empty; + return "" +RoundSummary.singleton.TargetCount.ToString() + ""; + + } + + + public static readonly string CantPickup = "A strange force called \'game balance\' \nprevents you from picking up this item"; public static readonly string CantUse = "A strange force called \'game balance\' \nprevents you from using this item"; diff --git a/KruacentExiled/KE.CustomRoles/Settings/SettingHandler.cs b/KruacentExiled/KE.CustomRoles/Settings/SettingHandler.cs index 8dabe66b..3759fed8 100644 --- a/KruacentExiled/KE.CustomRoles/Settings/SettingHandler.cs +++ b/KruacentExiled/KE.CustomRoles/Settings/SettingHandler.cs @@ -38,6 +38,7 @@ internal class SettingHandler : IUsingEvents private int _idTestHintalign = 157; private int _idTestHintspawn = 158; private int _idTestHinttext = 159; + private int _idTestHintslidersize = 180; private readonly int _idHeaderTestHint = 160; @@ -78,6 +79,7 @@ public SettingHandler() new SliderSetting(_idTestHintsliderx,"x",-2000,2000,0), new SliderSetting(_idTestHintslidery,"y",0,2000,0), new SliderSetting(_idTestHintslidertime,"time",0,10,5), + new SliderSetting(_idTestHintslidersize,"size",0,100,5), new DropdownSetting(_idTestHintalign,"alignment",options), new ButtonSetting(_idTestHintspawn,"spawn","spawn"), SettingBase.Create(new SSPlaintextSetting(_idTestHinttext,"text")), @@ -103,6 +105,7 @@ public SettingHandler() float timevalue = 5; HintAlignment HintAlignment = HintAlignment.Center; string text = "TEST"; + float size = 10; public void CreateHint(Player player, ServerSpecificSettingBase setting) { @@ -125,6 +128,10 @@ public void CreateHint(Player player, ServerSpecificSettingBase setting) { text = textsetting.Text; } + if (SettingBase.TryGetSetting(player, _idTestHintslidersize, out var slidersize)) + { + size = slidersize.SliderValue; + } if (SettingBase.TryGetSetting(player, _idTestHintalign, out var dropdown)) { @@ -150,12 +157,14 @@ public void CreateHint(Player player, ServerSpecificSettingBase setting) { PlayerDisplay display = PlayerDisplay.Get(player); Log.Debug($"creating hint at {xvalue},{yvalue} for {timevalue}"); + string fulltext = "" + text + ""; + var hint = new Hint() { XCoordinate = xvalue, YCoordinate = yvalue, Alignment = HintAlignment, - Text = text + Text = fulltext }; display.ClearHint(); display.AddHint(hint); From 257eb417e23dac7e3b85c4399d5a2c5e30ed5674 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Mon, 12 Jan 2026 20:55:49 +0100 Subject: [PATCH 500/853] gmableing --- KruacentExiled/KE.Map/Heavy/GamblingZone/GamblingRoom.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/KruacentExiled/KE.Map/Heavy/GamblingZone/GamblingRoom.cs b/KruacentExiled/KE.Map/Heavy/GamblingZone/GamblingRoom.cs index 3443de53..d259c77f 100644 --- a/KruacentExiled/KE.Map/Heavy/GamblingZone/GamblingRoom.cs +++ b/KruacentExiled/KE.Map/Heavy/GamblingZone/GamblingRoom.cs @@ -64,7 +64,7 @@ private void Init(Vector3 position, LootTable lootTable, Vector3? offset = null) _interact.InteractionDuration = BasePickupTime; - _interact.OnSearchAborted += OnPickup; + _interact.OnSearched += OnPickup; CreateModel(_position); _interact.Spawn(); _lootTable = lootTable; From 3b8d176dce3b743d3e2783000e109766bb3818f6 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Mon, 12 Jan 2026 20:56:37 +0100 Subject: [PATCH 501/853] begone --- KruacentExiled/KE.CustomRoles/CR/MTF/RedMist.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/KruacentExiled/KE.CustomRoles/CR/MTF/RedMist.cs b/KruacentExiled/KE.CustomRoles/CR/MTF/RedMist.cs index 04adeb62..e61d73b2 100644 --- a/KruacentExiled/KE.CustomRoles/CR/MTF/RedMist.cs +++ b/KruacentExiled/KE.CustomRoles/CR/MTF/RedMist.cs @@ -1,4 +1,4 @@ -using Exiled.API.Enums; +/*using Exiled.API.Enums; using Exiled.API.Features; using Exiled.Events.EventArgs.Player; using KE.CustomRoles.API.Features; @@ -44,3 +44,4 @@ protected override void UnsubscribeEvents() } } +*/ \ No newline at end of file From 7ec997e8a2b705dd804c874b2a5468ce6462365d Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Tue, 13 Jan 2026 16:31:38 +0100 Subject: [PATCH 502/853] reenabled the old gambling because interactable toy doesn't work anymore --- KruacentExiled/KE.Map/Heavy/BulkDoor049.cs | 37 +++++++++++++++++++ .../Heavy/GamblingZone/AbstractGambling.cs | 14 +++++++ .../KE.Map/Heavy/GamblingZone/GamblingRoom.cs | 25 +++++++++---- .../Heavy/GamblingZone/OldGamblingRoom.cs | 13 ++----- KruacentExiled/KE.Map/KE.Map.csproj | 3 +- KruacentExiled/KE.Map/MainPlugin.cs | 24 ++++++------ .../Others/BlackoutNDoor/Handlers/Handler.cs | 5 ++- 7 files changed, 91 insertions(+), 30 deletions(-) create mode 100644 KruacentExiled/KE.Map/Heavy/BulkDoor049.cs create mode 100644 KruacentExiled/KE.Map/Heavy/GamblingZone/AbstractGambling.cs diff --git a/KruacentExiled/KE.Map/Heavy/BulkDoor049.cs b/KruacentExiled/KE.Map/Heavy/BulkDoor049.cs new file mode 100644 index 00000000..ab356b05 --- /dev/null +++ b/KruacentExiled/KE.Map/Heavy/BulkDoor049.cs @@ -0,0 +1,37 @@ +using Exiled.API.Features; +using KE.Utils.API; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using UnityEngine; + +namespace KE.Map.Heavy +{ + public static class BulkDoor049 + { + + public static void Create() + { + + + Room room = Room.List.Where(r => r.Type == Exiled.API.Enums.RoomType.Hcz049).First(); + + + Vector3 pos = new(-19.7f ,89f, 9f); + Quaternion rot = Quaternion.identity; + + Vector3 worldpos = room.Position + room.Rotation*pos; + + + + StructureSpawner.SpawnDoor(ProjectMER.Features.Enums.DoorType.HeavyBulkDoor, worldpos, room.Rotation * rot , Vector3.one); + + Log.Debug("spawn 049 bulk door at "+ worldpos); + } + + + + } +} diff --git a/KruacentExiled/KE.Map/Heavy/GamblingZone/AbstractGambling.cs b/KruacentExiled/KE.Map/Heavy/GamblingZone/AbstractGambling.cs new file mode 100644 index 00000000..845d4b43 --- /dev/null +++ b/KruacentExiled/KE.Map/Heavy/GamblingZone/AbstractGambling.cs @@ -0,0 +1,14 @@ +using UnityEngine; + +namespace KE.Map.Heavy.GamblingZone +{ + public abstract class AbstractGambling + { + + + + public abstract void Destroy(); + + + } +} diff --git a/KruacentExiled/KE.Map/Heavy/GamblingZone/GamblingRoom.cs b/KruacentExiled/KE.Map/Heavy/GamblingZone/GamblingRoom.cs index d259c77f..788c6359 100644 --- a/KruacentExiled/KE.Map/Heavy/GamblingZone/GamblingRoom.cs +++ b/KruacentExiled/KE.Map/Heavy/GamblingZone/GamblingRoom.cs @@ -7,10 +7,11 @@ using System.Collections.Generic; using UnityEngine; using System.Linq; +using LabApi.Events.Arguments.PlayerEvents; namespace KE.Map.Heavy.GamblingZone { - public class GamblingRoom + public class GamblingRoom : AbstractGambling { private static readonly HashSet _list = new HashSet(); public static IReadOnlyCollection List => _list; @@ -51,7 +52,7 @@ internal GamblingRoom(Vector3 position, LootTable lootTable, Vector3? offset = n - private void Init(Vector3 position, LootTable lootTable, Vector3? offset = null) + protected void Init(Vector3 position, LootTable lootTable, Vector3? offset = null) { @@ -62,13 +63,19 @@ private void Init(Vector3 position, LootTable lootTable, Vector3? offset = null) _interact = InteractableToy.Create(_position, networkSpawn: false); _interact.InteractionDuration = BasePickupTime; + + LabApi.Events.Handlers.PlayerEvents.SearchedToy += OnPickup; - - _interact.OnSearched += OnPickup; CreateModel(_position); _interact.Spawn(); _lootTable = lootTable; + + _interact.OnInteracted += p => Log.Info($"{p.Nickname} interatcted"); // Runs if interactionduration is set to 0 + _interact.OnSearching += p => Log.Info($"{p.Nickname} OnSearching"); // runs when the player presses E & interactionduration != 0 + _interact.OnSearched += p => Log.Info($"{p.Nickname} OnSearched"); // Runs after searching is completed. + _interact.OnSearchAborted += p => Log.Info($"{p.Nickname} OnSearchAborted"); // Runs after + } @@ -97,19 +104,23 @@ private void CreateModel(Vector3 positionWithOffset) - public void Destroy() + public override void Destroy() { foreach (Primitive p in _model) { p.Destroy(); } - _interact.OnSearchAborted -= OnPickup; + LabApi.Events.Handlers.PlayerEvents.SearchedToy += OnPickup; + _interact.Destroy(); _list.Remove(this); } - public void OnPickup(LabApi.Features.Wrappers.Player player) + public void OnPickup(PlayerSearchedToyEventArgs ev) { + Player player = ev.Player; + if (ev.Interactable != _interact) return; + Player player2 = Player.Get(player); if (player2 == null) return; if (player2.IsScp) return; diff --git a/KruacentExiled/KE.Map/Heavy/GamblingZone/OldGamblingRoom.cs b/KruacentExiled/KE.Map/Heavy/GamblingZone/OldGamblingRoom.cs index 6a772541..3219da5a 100644 --- a/KruacentExiled/KE.Map/Heavy/GamblingZone/OldGamblingRoom.cs +++ b/KruacentExiled/KE.Map/Heavy/GamblingZone/OldGamblingRoom.cs @@ -13,7 +13,7 @@ namespace KE.Map.Heavy.GamblingZone { - public class OldGamblingRoom + public class OldGamblingRoom : AbstractGambling { private static readonly HashSet _list = new HashSet(); public static HashSet List => new(_list); @@ -49,6 +49,7 @@ private void Init(Vector3 position, Vector3 scale, LootTable lootTable, Vector3? _scale = scale; _list.Add(this); _lootTable = lootTable; + Exiled.Events.Handlers.Player.DroppedItem += OnDropped; if (MainPlugin.Instance.Config.Debug) { var p = Primitive.Create(PrimitiveType.Cube, _position, null, _scale); @@ -68,16 +69,11 @@ public bool IsInGamblingRoom(Player p) playerPosition.z <= _position.z + halfSize.z; } - public void SubscribeEvents() - { - Exiled.Events.Handlers.Player.DroppedItem += OnDropped; - } - public void UnsubscribeEvents() + public override void Destroy() { Exiled.Events.Handlers.Player.DroppedItem -= OnDropped; } - public void OnDropped(DroppedItemEventArgs ev) { Player player = ev.Player; @@ -90,8 +86,7 @@ public void OnDropped(DroppedItemEventArgs ev) } ev.Pickup.Destroy(); Item item = _lootTable.GetRandomItem(); - player.AddItem(item); - player.DropItem(item); + item.CreatePickup(player.Position); } } diff --git a/KruacentExiled/KE.Map/KE.Map.csproj b/KruacentExiled/KE.Map/KE.Map.csproj index 2264918b..3464baea 100644 --- a/KruacentExiled/KE.Map/KE.Map.csproj +++ b/KruacentExiled/KE.Map/KE.Map.csproj @@ -6,8 +6,9 @@ - + + diff --git a/KruacentExiled/KE.Map/MainPlugin.cs b/KruacentExiled/KE.Map/MainPlugin.cs index b453f811..1609206e 100644 --- a/KruacentExiled/KE.Map/MainPlugin.cs +++ b/KruacentExiled/KE.Map/MainPlugin.cs @@ -6,10 +6,12 @@ using HarmonyLib; using KE.Map.CustomZones; using KE.Map.CustomZones.CustomRooms.MCZ; +using KE.Map.Heavy; using KE.Map.Heavy.GamblingZone; using KE.Map.Others.BlackoutNDoor.Handlers; using LabApi.Events.Arguments.ServerEvents; using MapGeneration; +using MEC; using PlayerRoles; using System; using System.Collections.Generic; @@ -39,7 +41,6 @@ public override void OnEnabled() Exiled.Events.Handlers.Map.Generated += OnGenerated; Exiled.Events.Handlers.Server.RoundStarted += OnRoundStarted; LabApi.Events.Handlers.ServerEvents.MapGenerating += OnGenerating; - Exiled.Events.Handlers.Player.InteractingDoor += OpenDoor; GamblingRoom.SubscribeEvents(); //MoreRoom.CreateAll(); @@ -65,6 +66,11 @@ private void OnRoundStarted() //player.Teleport(teleport); + + Timing.CallDelayed(2, () => + { + //player.Teleport(teleport); + }); } @@ -78,7 +84,6 @@ public override void OnDisabled() Exiled.Events.Handlers.Map.Generated -= OnGenerated; Exiled.Events.Handlers.Server.RoundStarted -= OnRoundStarted; LabApi.Events.Handlers.ServerEvents.MapGenerating -= OnGenerating; - Exiled.Events.Handlers.Player.InteractingDoor -= OpenDoor; harmony.UnpatchAll(harmony.Id); GamblingRoom.UnsubscribeEvents(); //MoreRoom.UnsubscribeEvents(); @@ -120,21 +125,13 @@ private void CustomZone() Log.Debug("teleport " + teleport); } - private void OpenDoor(InteractingDoorEventArgs ev) - { - if(Config.Debug && ev.Door.Zone == Exiled.API.Enums.ZoneType.HeavyContainment) - { - ev.Player.Teleport(teleport); - } - } - private void OnGenerated() { if (Config.Debug) { - CustomZone(); + //CustomZone(); } Door lcz173 = Door.Get(Exiled.API.Enums.DoorType.Scp173Gate); HashSet normal = new() @@ -172,9 +169,11 @@ private void OnGenerated() }; - var g = new GamblingRoom(RoleTypeId.Scp173.GetRandomSpawnLocation().Position + Vector3.down, new(normal)); + //var g = new GamblingRoom(RoleTypeId.Scp173.GetRandomSpawnLocation().Position + Vector3.down, new(normal)); + var g = new OldGamblingRoom(RoleTypeId.Scp173.GetRandomSpawnLocation().Position + Vector3.down, Vector3.one*10, new LootTable(normal)); + BulkDoor049.Create(); /* @@ -220,6 +219,7 @@ public class Config : IConfig public bool SupplyDropEnabled { get; set; } = false; public bool TurretEnabled { get; set; } = false; public bool EasterEggEnabled { get; set; } = true; + public bool BlackoutNDoorEnabled { get; set; } = true; } diff --git a/KruacentExiled/KE.Map/Others/BlackoutNDoor/Handlers/Handler.cs b/KruacentExiled/KE.Map/Others/BlackoutNDoor/Handlers/Handler.cs index a0738b63..f328d530 100644 --- a/KruacentExiled/KE.Map/Others/BlackoutNDoor/Handlers/Handler.cs +++ b/KruacentExiled/KE.Map/Others/BlackoutNDoor/Handlers/Handler.cs @@ -46,6 +46,9 @@ public void UnsubscribeEvents() private void OnRoundStarted() { + + if (!MainPlugin.Configs.BlackoutNDoorEnabled) return; + ChosenPattern = Pattern.AllPatterns.GetRandomValue(); time = GetRandomTime(); @@ -149,7 +152,7 @@ private void LaunchEvent() string message = mapEvent.Cassie + " " + ZoneTypeToCassie(zone) + " " + MainPlugin.Translations.End; string translate = mapEvent.CassieTranslated + " " + ZoneTypeToCassieTranslated(zone) + " " + MainPlugin.Translations.End; - float yap = Exiled.API.Features.Cassie.CalculateDuration(message, false, 0); + float yap = Exiled.API.Features.Cassie.CalculateDuration(message); Exiled.API.Features.Cassie.MessageTranslated(message, translate,false,false,true); From 38c9104447b83479f53571f1be380528cb26500e Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Tue, 13 Jan 2026 16:56:58 +0100 Subject: [PATCH 503/853] moved cr --- .../KE.Map/Heavy/GamblingZone/GamblingRoom.cs | 1 + KruacentExiled/KE.Map/MainPlugin.cs | 50 ++------------ .../{ => Others}/CustomZones/AltasReader.cs | 0 .../Others/CustomZones/CREventHandler.cs | 65 +++++++++++++++++++ .../CustomZones/CustomFacilityZone.cs | 0 .../{ => Others}/CustomZones/CustomRoom.cs | 0 .../CustomZones/CustomRooms/MCZ/EndRoom.cs | 0 .../CustomZones/CustomRooms/MCZ/SCorridor.cs | 0 .../CustomZones/CustomRooms/MCZ/TCorridor.cs | 0 .../{ => Others}/CustomZones/CustomZone.cs | 0 .../KE.Map/{ => Others}/CustomZones/Layout.cs | 0 .../CustomZones/MediumContainmentZone.cs | 0 .../CustomZones/SpawnedCustomRoom.cs | 0 13 files changed, 71 insertions(+), 45 deletions(-) rename KruacentExiled/KE.Map/{ => Others}/CustomZones/AltasReader.cs (100%) create mode 100644 KruacentExiled/KE.Map/Others/CustomZones/CREventHandler.cs rename KruacentExiled/KE.Map/{ => Others}/CustomZones/CustomFacilityZone.cs (100%) rename KruacentExiled/KE.Map/{ => Others}/CustomZones/CustomRoom.cs (100%) rename KruacentExiled/KE.Map/{ => Others}/CustomZones/CustomRooms/MCZ/EndRoom.cs (100%) rename KruacentExiled/KE.Map/{ => Others}/CustomZones/CustomRooms/MCZ/SCorridor.cs (100%) rename KruacentExiled/KE.Map/{ => Others}/CustomZones/CustomRooms/MCZ/TCorridor.cs (100%) rename KruacentExiled/KE.Map/{ => Others}/CustomZones/CustomZone.cs (100%) rename KruacentExiled/KE.Map/{ => Others}/CustomZones/Layout.cs (100%) rename KruacentExiled/KE.Map/{ => Others}/CustomZones/MediumContainmentZone.cs (100%) rename KruacentExiled/KE.Map/{ => Others}/CustomZones/SpawnedCustomRoom.cs (100%) diff --git a/KruacentExiled/KE.Map/Heavy/GamblingZone/GamblingRoom.cs b/KruacentExiled/KE.Map/Heavy/GamblingZone/GamblingRoom.cs index 788c6359..fcfd1fdc 100644 --- a/KruacentExiled/KE.Map/Heavy/GamblingZone/GamblingRoom.cs +++ b/KruacentExiled/KE.Map/Heavy/GamblingZone/GamblingRoom.cs @@ -148,6 +148,7 @@ public static void SubscribeEvents() public static void UnsubscribeEvents() { Exiled.Events.Handlers.Server.RoundEnded -= OnRoundEnded; + DestroyAll(); } diff --git a/KruacentExiled/KE.Map/MainPlugin.cs b/KruacentExiled/KE.Map/MainPlugin.cs index 1609206e..f3f4349b 100644 --- a/KruacentExiled/KE.Map/MainPlugin.cs +++ b/KruacentExiled/KE.Map/MainPlugin.cs @@ -9,6 +9,7 @@ using KE.Map.Heavy; using KE.Map.Heavy.GamblingZone; using KE.Map.Others.BlackoutNDoor.Handlers; +using KE.Utils.API.GifAnimator; using LabApi.Events.Arguments.ServerEvents; using MapGeneration; using MEC; @@ -40,7 +41,6 @@ public override void OnEnabled() KE.Utils.API.Sounds.SoundPlayer.Instance.TryLoad(); Exiled.Events.Handlers.Map.Generated += OnGenerated; Exiled.Events.Handlers.Server.RoundStarted += OnRoundStarted; - LabApi.Events.Handlers.ServerEvents.MapGenerating += OnGenerating; GamblingRoom.SubscribeEvents(); //MoreRoom.CreateAll(); @@ -83,7 +83,7 @@ public override void OnDisabled() handler?.UnsubscribeEvents(); Exiled.Events.Handlers.Map.Generated -= OnGenerated; Exiled.Events.Handlers.Server.RoundStarted -= OnRoundStarted; - LabApi.Events.Handlers.ServerEvents.MapGenerating -= OnGenerating; + harmony.UnpatchAll(harmony.Id); GamblingRoom.UnsubscribeEvents(); //MoreRoom.UnsubscribeEvents(); @@ -91,48 +91,18 @@ public override void OnDisabled() Instance = null; } - private int seed; - private Vector3 teleport; - private void OnGenerating(MapGeneratingEventArgs ev) - { - seed = ev.Seed; - - } - private void CustomZone() + private void TestImage() { - Log.Debug("read"); - try - { - - AltasReader.Read(); - } - catch (Exception e) - { - Log.Error(e); - } - - - CustomZone zone = new MediumContainmentZone(); - //teleport = zone.Spawnzone; - new SCorridor(); - new EndRoom(); - new TCorridor(); - zone.Generate(new System.Random(seed)); - - teleport = CustomRoom.RegisteredRoom.First().SpawnedRoom.First(s => s.Shape == RoomShape.Straight).Position + Vector3.up*5; - Log.Debug("teleport " + teleport); + new TextImage(); } + private void OnGenerated() { - if (Config.Debug) - { - //CustomZone(); - } Door lcz173 = Door.Get(Exiled.API.Enums.DoorType.Scp173Gate); HashSet normal = new() { @@ -199,16 +169,6 @@ private void OnGenerated() } - - - /* private void OnRoundEnded(RoundEndedEventArgs ev) - { - - - foreach (var g in OldGamblingRoom.List) - g.UnsubscribeEvents(); - }*/ - } diff --git a/KruacentExiled/KE.Map/CustomZones/AltasReader.cs b/KruacentExiled/KE.Map/Others/CustomZones/AltasReader.cs similarity index 100% rename from KruacentExiled/KE.Map/CustomZones/AltasReader.cs rename to KruacentExiled/KE.Map/Others/CustomZones/AltasReader.cs diff --git a/KruacentExiled/KE.Map/Others/CustomZones/CREventHandler.cs b/KruacentExiled/KE.Map/Others/CustomZones/CREventHandler.cs new file mode 100644 index 00000000..e4dba051 --- /dev/null +++ b/KruacentExiled/KE.Map/Others/CustomZones/CREventHandler.cs @@ -0,0 +1,65 @@ +using Exiled.API.Features; +using KE.Map.CustomZones; +using KE.Map.CustomZones.CustomRooms.MCZ; +using KE.Utils.API.Interfaces; +using LabApi.Events.Arguments.ServerEvents; +using MapGeneration; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using UnityEngine; + +namespace KE.Map.Others.CustomZones +{ + internal class CREventHandler : IUsingEvents + { + public void SubscribeEvents() + { + Exiled.Events.Handlers.Map.Generated += OnGenerated; + LabApi.Events.Handlers.ServerEvents.MapGenerating += OnGenerating; + } + + public void UnsubscribeEvents() + { + Exiled.Events.Handlers.Map.Generated -= OnGenerated; + LabApi.Events.Handlers.ServerEvents.MapGenerating -= OnGenerating; + } + + private int seed; + private Vector3 teleport; + private void OnGenerating(MapGeneratingEventArgs ev) + { + seed = ev.Seed; + + } + private void OnGenerated() + { + Log.Debug("read"); + try + { + + AltasReader.Read(); + } + catch (Exception e) + { + Log.Error(e); + } + + + CustomZone zone = new MediumContainmentZone(); + //teleport = zone.Spawnzone; + new SCorridor(); + new EndRoom(); + new TCorridor(); + + zone.Generate(new System.Random(seed)); + + teleport = CustomRoom.RegisteredRoom.First().SpawnedRoom.First(s => s.Shape == RoomShape.Straight).Position + Vector3.up * 5; + Log.Debug("teleport " + teleport); + } + + + } +} diff --git a/KruacentExiled/KE.Map/CustomZones/CustomFacilityZone.cs b/KruacentExiled/KE.Map/Others/CustomZones/CustomFacilityZone.cs similarity index 100% rename from KruacentExiled/KE.Map/CustomZones/CustomFacilityZone.cs rename to KruacentExiled/KE.Map/Others/CustomZones/CustomFacilityZone.cs diff --git a/KruacentExiled/KE.Map/CustomZones/CustomRoom.cs b/KruacentExiled/KE.Map/Others/CustomZones/CustomRoom.cs similarity index 100% rename from KruacentExiled/KE.Map/CustomZones/CustomRoom.cs rename to KruacentExiled/KE.Map/Others/CustomZones/CustomRoom.cs diff --git a/KruacentExiled/KE.Map/CustomZones/CustomRooms/MCZ/EndRoom.cs b/KruacentExiled/KE.Map/Others/CustomZones/CustomRooms/MCZ/EndRoom.cs similarity index 100% rename from KruacentExiled/KE.Map/CustomZones/CustomRooms/MCZ/EndRoom.cs rename to KruacentExiled/KE.Map/Others/CustomZones/CustomRooms/MCZ/EndRoom.cs diff --git a/KruacentExiled/KE.Map/CustomZones/CustomRooms/MCZ/SCorridor.cs b/KruacentExiled/KE.Map/Others/CustomZones/CustomRooms/MCZ/SCorridor.cs similarity index 100% rename from KruacentExiled/KE.Map/CustomZones/CustomRooms/MCZ/SCorridor.cs rename to KruacentExiled/KE.Map/Others/CustomZones/CustomRooms/MCZ/SCorridor.cs diff --git a/KruacentExiled/KE.Map/CustomZones/CustomRooms/MCZ/TCorridor.cs b/KruacentExiled/KE.Map/Others/CustomZones/CustomRooms/MCZ/TCorridor.cs similarity index 100% rename from KruacentExiled/KE.Map/CustomZones/CustomRooms/MCZ/TCorridor.cs rename to KruacentExiled/KE.Map/Others/CustomZones/CustomRooms/MCZ/TCorridor.cs diff --git a/KruacentExiled/KE.Map/CustomZones/CustomZone.cs b/KruacentExiled/KE.Map/Others/CustomZones/CustomZone.cs similarity index 100% rename from KruacentExiled/KE.Map/CustomZones/CustomZone.cs rename to KruacentExiled/KE.Map/Others/CustomZones/CustomZone.cs diff --git a/KruacentExiled/KE.Map/CustomZones/Layout.cs b/KruacentExiled/KE.Map/Others/CustomZones/Layout.cs similarity index 100% rename from KruacentExiled/KE.Map/CustomZones/Layout.cs rename to KruacentExiled/KE.Map/Others/CustomZones/Layout.cs diff --git a/KruacentExiled/KE.Map/CustomZones/MediumContainmentZone.cs b/KruacentExiled/KE.Map/Others/CustomZones/MediumContainmentZone.cs similarity index 100% rename from KruacentExiled/KE.Map/CustomZones/MediumContainmentZone.cs rename to KruacentExiled/KE.Map/Others/CustomZones/MediumContainmentZone.cs diff --git a/KruacentExiled/KE.Map/CustomZones/SpawnedCustomRoom.cs b/KruacentExiled/KE.Map/Others/CustomZones/SpawnedCustomRoom.cs similarity index 100% rename from KruacentExiled/KE.Map/CustomZones/SpawnedCustomRoom.cs rename to KruacentExiled/KE.Map/Others/CustomZones/SpawnedCustomRoom.cs From 7183bcab6a59ac18012fe52465962afb3f49f6e0 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Tue, 13 Jan 2026 17:00:28 +0100 Subject: [PATCH 504/853] =?UTF-8?q?update=20+=20=E0=B6=9E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- KruacentExiled/KE.Misc/KE.Misc.csproj | 2 +- KruacentExiled/KE.Misc/MainPlugin.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/KruacentExiled/KE.Misc/KE.Misc.csproj b/KruacentExiled/KE.Misc/KE.Misc.csproj index f0ce4717..43be06b0 100644 --- a/KruacentExiled/KE.Misc/KE.Misc.csproj +++ b/KruacentExiled/KE.Misc/KE.Misc.csproj @@ -6,7 +6,7 @@ - + diff --git a/KruacentExiled/KE.Misc/MainPlugin.cs b/KruacentExiled/KE.Misc/MainPlugin.cs index c4ba1945..c2145d25 100644 --- a/KruacentExiled/KE.Misc/MainPlugin.cs +++ b/KruacentExiled/KE.Misc/MainPlugin.cs @@ -141,7 +141,7 @@ private void NoeDeath(CassieQueuingScpTerminationEventArgs ev) } ev.IsAllowed = false; - Exiled.API.Features.Cassie.MessageTranslated("SCP 69 420 has been contained successfully", "SCP-69420-NOE has been contained successfully"); + Exiled.API.Features.Cassie.MessageTranslated("SCP 69 420 has been contained successfully", "SCP-69420-NOE has been contained suscessfully"); } From 7394d92242b79db6eddf52361fb222cfa754ad33 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Tue, 13 Jan 2026 17:02:15 +0100 Subject: [PATCH 505/853] removed old sound, use utils --- KruacentExiled/KE.Items/Sound.cs | 71 -------------------------------- 1 file changed, 71 deletions(-) delete mode 100644 KruacentExiled/KE.Items/Sound.cs diff --git a/KruacentExiled/KE.Items/Sound.cs b/KruacentExiled/KE.Items/Sound.cs deleted file mode 100644 index a15035b5..00000000 --- a/KruacentExiled/KE.Items/Sound.cs +++ /dev/null @@ -1,71 +0,0 @@ - - -using Exiled.API.Features; -using System.Collections.Generic; -using UnityEngine; - -namespace KE.Items -{ - internal class Sound - { - private AudioPlayer audioPlayer; - private Dictionary _soundName = new Dictionary(); - - public Sound() - { - _soundName.Add("lego.ogg", "build"); - _soundName.Add("worms.ogg", "worms"); - } - - ~Sound() - { - audioPlayer.RemoveAllClips(); - } - - public void LoadClips() - { - foreach (var s in _soundName) - { - Log.Info($"Loading clip ({s.Value}) at {MainPlugin.Instance.Config.SoundLocation}\\{s.Key} "); - AudioClipStorage.LoadClip($"{MainPlugin.Instance.Config.SoundLocation}\\{s.Key}", s.Value); - } - } - - - - internal void PlayClip(string clipName, UnityEngine.Vector3 pos, float volume =1f, float maxDistance = 20f) - { - Log.Debug($"playing {clipName} at {pos}"); - audioPlayer = AudioPlayer.CreateOrGet($"{clipName} ({pos})", onIntialCreation: (p) => - { - GameObject a = new GameObject(); - a.transform.position = pos; - p.transform.parent = a.transform; - Speaker speaker = p.AddSpeaker("Main", isSpatial: true, maxDistance: maxDistance, minDistance: 5f); - speaker.transform.parent = a.transform; - speaker.transform.localPosition = Vector3.zero; - }); - - audioPlayer.AddClip(clipName, volume:volume); - } - - - internal void PlayClip(string clipName, GameObject objectEmittingSound, float volume = 1f,float maxDistance = 20f) - { - Log.Debug($"playing {clipName} at {objectEmittingSound}"); - audioPlayer = AudioPlayer.CreateOrGet($"{clipName} ({objectEmittingSound})", onIntialCreation: (p) => - { - - p.transform.parent = objectEmittingSound.transform; - Speaker speaker = p.AddSpeaker("Main", isSpatial: true, maxDistance: maxDistance, minDistance: 5f); - speaker.transform.parent = objectEmittingSound.transform; - speaker.transform.localPosition = Vector3.zero; - }); - - audioPlayer.AddClip(clipName, volume: volume); - } - - - - } -} From ff9f4c39a95bb4ce072a9484210aa756da4df360 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Tue, 13 Jan 2026 17:02:43 +0100 Subject: [PATCH 506/853] removed other projecit --- KruacentExiled/KruacentExiled.sln | 30 ------------------------------ 1 file changed, 30 deletions(-) diff --git a/KruacentExiled/KruacentExiled.sln b/KruacentExiled/KruacentExiled.sln index e1d7ffb2..91caad2a 100644 --- a/KruacentExiled/KruacentExiled.sln +++ b/KruacentExiled/KruacentExiled.sln @@ -3,16 +3,6 @@ Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio Version 17 VisualStudioVersion = 17.12.35506.116 MinimumVisualStudioVersion = 10.0.40219.1 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "KE.Items", "KE.Items\KE.Items.csproj", "{2FE04C4D-7FA1-4EC5-A8AF-618EDE0C037C}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "KE.Misc", "KE.Misc\KE.Misc.csproj", "{CD822DB2-756E-4887-93AB-2D2F16BF542C}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "KE.GlobalEventFramework", "KE.GlobalEventFramework\KE.GlobalEventFramework.csproj", "{73D6C740-96DE-4965-898F-DDD5BCBF7366}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "KE.CustomRoles", "KE.CustomRoles\KE.CustomRoles.csproj", "{4AA4C3E0-E62F-49CE-AD80-0B5C6249EB48}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "KE.GlobalEventFramework.Examples", "KE.GlobalEventFramework.Examples\KE.GlobalEventFramework.Examples.csproj", "{07B92E87-F48F-4F9F-BA0E-1BCB2AF52F53}" -EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "KE.Map", "KE.Map\KE.Map.csproj", "{2BD019AC-1B86-4E00-B418-BE4C06CD8410}" EndProject Global @@ -21,26 +11,6 @@ Global Release|Any CPU = Release|Any CPU EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution - {2FE04C4D-7FA1-4EC5-A8AF-618EDE0C037C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {2FE04C4D-7FA1-4EC5-A8AF-618EDE0C037C}.Debug|Any CPU.Build.0 = Debug|Any CPU - {2FE04C4D-7FA1-4EC5-A8AF-618EDE0C037C}.Release|Any CPU.ActiveCfg = Release|Any CPU - {2FE04C4D-7FA1-4EC5-A8AF-618EDE0C037C}.Release|Any CPU.Build.0 = Release|Any CPU - {CD822DB2-756E-4887-93AB-2D2F16BF542C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {CD822DB2-756E-4887-93AB-2D2F16BF542C}.Debug|Any CPU.Build.0 = Debug|Any CPU - {CD822DB2-756E-4887-93AB-2D2F16BF542C}.Release|Any CPU.ActiveCfg = Release|Any CPU - {CD822DB2-756E-4887-93AB-2D2F16BF542C}.Release|Any CPU.Build.0 = Release|Any CPU - {73D6C740-96DE-4965-898F-DDD5BCBF7366}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {73D6C740-96DE-4965-898F-DDD5BCBF7366}.Debug|Any CPU.Build.0 = Debug|Any CPU - {73D6C740-96DE-4965-898F-DDD5BCBF7366}.Release|Any CPU.ActiveCfg = Release|Any CPU - {73D6C740-96DE-4965-898F-DDD5BCBF7366}.Release|Any CPU.Build.0 = Release|Any CPU - {4AA4C3E0-E62F-49CE-AD80-0B5C6249EB48}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {4AA4C3E0-E62F-49CE-AD80-0B5C6249EB48}.Debug|Any CPU.Build.0 = Debug|Any CPU - {4AA4C3E0-E62F-49CE-AD80-0B5C6249EB48}.Release|Any CPU.ActiveCfg = Release|Any CPU - {4AA4C3E0-E62F-49CE-AD80-0B5C6249EB48}.Release|Any CPU.Build.0 = Release|Any CPU - {07B92E87-F48F-4F9F-BA0E-1BCB2AF52F53}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {07B92E87-F48F-4F9F-BA0E-1BCB2AF52F53}.Debug|Any CPU.Build.0 = Debug|Any CPU - {07B92E87-F48F-4F9F-BA0E-1BCB2AF52F53}.Release|Any CPU.ActiveCfg = Release|Any CPU - {07B92E87-F48F-4F9F-BA0E-1BCB2AF52F53}.Release|Any CPU.Build.0 = Release|Any CPU {2BD019AC-1B86-4E00-B418-BE4C06CD8410}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {2BD019AC-1B86-4E00-B418-BE4C06CD8410}.Debug|Any CPU.Build.0 = Debug|Any CPU {2BD019AC-1B86-4E00-B418-BE4C06CD8410}.Release|Any CPU.ActiveCfg = Release|Any CPU From 8c5b5d4b4293fa3feee99e2db2cba4890543b0ba Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Tue, 13 Jan 2026 18:21:28 +0100 Subject: [PATCH 507/853] spawn image yippee --- KruacentExiled/KE.Map/MainPlugin.cs | 8 +--- KruacentExiled/KE.Map/SpawnImage.cs | 70 +++++++++++++++++++++++++++++ 2 files changed, 71 insertions(+), 7 deletions(-) create mode 100644 KruacentExiled/KE.Map/SpawnImage.cs diff --git a/KruacentExiled/KE.Map/MainPlugin.cs b/KruacentExiled/KE.Map/MainPlugin.cs index f3f4349b..348f8dca 100644 --- a/KruacentExiled/KE.Map/MainPlugin.cs +++ b/KruacentExiled/KE.Map/MainPlugin.cs @@ -16,6 +16,7 @@ using PlayerRoles; using System; using System.Collections.Generic; +using System.Drawing; using System.Linq; using UnityEngine; using Door = Exiled.API.Features.Doors.Door; @@ -92,13 +93,6 @@ public override void OnDisabled() } - private void TestImage() - { - - new TextImage(); - } - - private void OnGenerated() { diff --git a/KruacentExiled/KE.Map/SpawnImage.cs b/KruacentExiled/KE.Map/SpawnImage.cs new file mode 100644 index 00000000..058a8a08 --- /dev/null +++ b/KruacentExiled/KE.Map/SpawnImage.cs @@ -0,0 +1,70 @@ +using CommandSystem; +using Exiled.API.Features; +using HintServiceMeow.Core.Enum; +using KE.Map.Utils; +using KE.Utils.API.Displays.DisplayMeow; +using KE.Utils.API.Displays.DisplayMeow.Placements; +using KE.Utils.API.GifAnimator; +using LabApi.Features.Wrappers; +using System; +using System.Collections.Generic; +using System.Drawing; +using UnityEngine; +using Player = Exiled.API.Features.Player; + +namespace KE.Map +{ + [CommandHandler(typeof(RemoteAdminCommandHandler))] + public class SpawnImage : KECommand + { + public override string Command => "spawnimage"; + + public override string[] Aliases => []; + + public override string Description => "image"; + + public override string[] Usage => [""]; + + public override bool ExecuteCommand(ArraySegment arguments, ICommandSender sender, out string response) + { + if(!Player.TryGet(sender, out Player player)) + { + response = "player not foudn"; + return false; + } + + + + Image img = Image.FromFile(Paths.Configs + "/ome.png"); + TextImage textimg = new TextImage(img,20); + Log.Debug(textimg.RawString.Length); + + TextToy toy = textimg.Spawn(player.Position,player.Rotation); + + Log.Debug(toy.TextFormat.Length); + + toy.DisplaySize = new Vector2(5000, 5000); + + DisplayHandler.Instance.AddHint(position.HintPlacement, player, textimg.RawString, 30); + + + + + toy.Spawn(); + response = "ok"; + return true; + } + + private TestHintPosition position = new(); + } + + + public class TestHintPosition : HintPosition + { + public override float Xposition => 0; + + public override float Yposition => 500; + + public override HintAlignment HintAlignment => HintAlignment.Center; + } +} From aecf405101dc29a538169c11c280e445c6fe7db4 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Tue, 13 Jan 2026 19:04:21 +0100 Subject: [PATCH 508/853] icon satrt --- .../KE.CustomRoles/API/Interfaces/ICustomIcon.cs | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 KruacentExiled/KE.CustomRoles/API/Interfaces/ICustomIcon.cs diff --git a/KruacentExiled/KE.CustomRoles/API/Interfaces/ICustomIcon.cs b/KruacentExiled/KE.CustomRoles/API/Interfaces/ICustomIcon.cs new file mode 100644 index 00000000..8469528b --- /dev/null +++ b/KruacentExiled/KE.CustomRoles/API/Interfaces/ICustomIcon.cs @@ -0,0 +1,16 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace KE.CustomRoles.API.Interfaces +{ + public interface ICustomIcon + { + + + + + } +} From 903b61ee03219248c375335c8a0790ca3dafb50e Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Tue, 13 Jan 2026 19:17:05 +0100 Subject: [PATCH 509/853] double check killing nuke --- .../KE.Misc/Features/AutoNukeAnnoucement.cs | 59 ++++++++----------- KruacentExiled/KE.Misc/MainPlugin.cs | 8 +-- 2 files changed, 27 insertions(+), 40 deletions(-) diff --git a/KruacentExiled/KE.Misc/Features/AutoNukeAnnoucement.cs b/KruacentExiled/KE.Misc/Features/AutoNukeAnnoucement.cs index f1d89679..c9b94b72 100644 --- a/KruacentExiled/KE.Misc/Features/AutoNukeAnnoucement.cs +++ b/KruacentExiled/KE.Misc/Features/AutoNukeAnnoucement.cs @@ -1,5 +1,6 @@ using Exiled.API.Features; using GameCore; +using KE.Utils.API.Interfaces; using MEC; using System; using System.Collections.Generic; @@ -10,54 +11,40 @@ namespace KE.Misc.Features { - internal class AutoNukeAnnoucement + public class NukeKill : IUsingEvents { - - - private float autodetonatetime = 20*60f; - private bool flagSaid = false; - private CoroutineHandle handle; - - public void OnRoundStarted() + public void SubscribeEvents() { - //autodetonatetime = ConfigFile.ServerConfig.GetFloat("auto_warhead_start_minutes") * 60f; - if (!handle.IsRunning) - { - handle = Timing.RunCoroutine(Timer()); - } + Exiled.Events.Handlers.Warhead.Detonated += OnDetonated; } - private IEnumerator Timer() + public void UnsubscribeEvents() { - Stopwatch watch = Stopwatch.StartNew(); - bool flag = false; + Exiled.Events.Handlers.Warhead.Detonated -= OnDetonated; + + } - while (watch.Elapsed.TotalMinutes < autodetonatetime) + private void OnDetonated() + { + Timing.CallDelayed(5, () => { - yield return Timing.WaitForSeconds(60); - if(Warhead.IsDetonated || Warhead.IsInProgress) + foreach(Player player in Player.Enumerable) { - flag = true; - break; - } - } - if (!flag) - { - SayAnnouncement(); - } - - } + if(player.Zone != Exiled.API.Enums.ZoneType.Surface) + { + player.Kill(Exiled.API.Enums.DamageType.Warhead); + } + if (player.Lift is not null) + { + player.Kill(Exiled.API.Enums.DamageType.Warhead); + } + } + }); + } - public void SayAnnouncement() - { - if (flagSaid) return; - //Cassie.MessageTranslated("Warning automatic warhead will detonate in 5 minutes", - //"Warning automatic warhead will detonate in 5 minutes"); - flagSaid = true; - } } diff --git a/KruacentExiled/KE.Misc/MainPlugin.cs b/KruacentExiled/KE.Misc/MainPlugin.cs index c2145d25..d3589461 100644 --- a/KruacentExiled/KE.Misc/MainPlugin.cs +++ b/KruacentExiled/KE.Misc/MainPlugin.cs @@ -32,7 +32,7 @@ public class MainPlugin : Plugin internal SCPBuff SCPBuff { get; private set; } internal Spawn Spawn { get; private set; } internal FriendlyFire FriendlyFire { get; private set; } - internal AutoNukeAnnoucement AutoNukeAnnoucement { get; private set; } + internal NukeKill AutoNukeAnnoucement { get; private set; } internal AutoTesla AutoTesla { get; private set; } internal EventHandlers _gamblingCoinHandler { get; private set; } internal SpawnLcz SpawnLcz { get; private set; } @@ -67,7 +67,7 @@ public override void OnEnabled() harmony.PatchAll(Assembly); ClassDDoor.SubscribeEvents(); MiscFeature.SubscribeAllEvents(); - + AutoNukeAnnoucement.SubscribeEvents(); if (Config.GamblingCoin) { GamblingCoinManager.RegisterAll(); @@ -76,7 +76,7 @@ public override void OnEnabled() } LastHuman.SubscribeEvents(); SCPBuff.SubscribeEvents(); - Exiled.Events.Handlers.Server.RoundStarted += AutoNukeAnnoucement.OnRoundStarted; + ServerHandle.RoundStarted += ServerHandler.OnRoundStarted; LabApi.Events.Handlers.ServerEvents.CassieQueuingScpTermination += NoeDeath; @@ -87,7 +87,7 @@ public override void OnDisabled() { ServerHandle.RoundStarted -= ServerHandler.OnRoundStarted; LabApi.Events.Handlers.ServerEvents.CassieQueuingScpTermination -= NoeDeath; - Exiled.Events.Handlers.Server.RoundStarted -= AutoNukeAnnoucement.OnRoundStarted; + AutoNukeAnnoucement.UnsubscribeEvents(); LastHuman.UnsubscribeEvents(); SCPBuff.UnsubscribeEvents(); if (Config.GamblingCoin) From 63748286d42cfe3dbcbabebe026906169169bb6b Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Tue, 13 Jan 2026 19:20:00 +0100 Subject: [PATCH 510/853] add night vision to 035 --- KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP035.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP035.cs b/KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP035.cs index 9e23a42c..fd41d294 100644 --- a/KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP035.cs +++ b/KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP035.cs @@ -1,4 +1,5 @@ using Cassie; +using CustomPlayerEffects; using Exiled.API.Enums; using Exiled.API.Extensions; using Exiled.API.Features; @@ -94,6 +95,7 @@ protected override void RoleAdded(Player player) player.VoiceChannel = VoiceChat.VoiceChatChannel.ScpChat; player.Position = RoleTypeId.Scp049.GetRandomSpawnLocation().Position; + player.EnableEffect(100, 0, false); base.RoleAdded(player); } From 16d6d0f21c26b01907e4299a222cfd7d89bc2c95 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Tue, 13 Jan 2026 19:53:25 +0100 Subject: [PATCH 511/853] change namespace keutils --- KruacentExiled/KE.Map/Entrance/EzArmory.cs | 2 +- KruacentExiled/KE.Map/Entrance/Locked.cs | 2 +- .../BlackoutNDoor/Commands/BlackoutCommand.cs | 2 +- .../BlackoutNDoor/Commands/BothCommand.cs | 9 +- .../Commands/DoorstuckCommand.cs | 2 +- .../BlackoutNDoor/Commands/MainCommand.cs | 2 +- KruacentExiled/KE.Map/SpawnImage.cs | 2 +- KruacentExiled/KE.Map/Utils/KECommand.cs | 32 ---- .../KE.Map/Utils/KEParentCommand.cs | 55 ------ .../KE.Map/Utils/StructureSpawner.cs | 168 ------------------ 10 files changed, 7 insertions(+), 269 deletions(-) delete mode 100644 KruacentExiled/KE.Map/Utils/KECommand.cs delete mode 100644 KruacentExiled/KE.Map/Utils/KEParentCommand.cs delete mode 100644 KruacentExiled/KE.Map/Utils/StructureSpawner.cs diff --git a/KruacentExiled/KE.Map/Entrance/EzArmory.cs b/KruacentExiled/KE.Map/Entrance/EzArmory.cs index e34bd776..26a3b388 100644 --- a/KruacentExiled/KE.Map/Entrance/EzArmory.cs +++ b/KruacentExiled/KE.Map/Entrance/EzArmory.cs @@ -1,7 +1,7 @@ using Exiled.API.Enums; using Exiled.API.Features; using Interactables.Interobjects.DoorUtils; -using KE.Map.Utils; +using KE.Utils.API.Map; using LabApi.Events.Arguments.ServerEvents; using System; using System.Collections.Generic; diff --git a/KruacentExiled/KE.Map/Entrance/Locked.cs b/KruacentExiled/KE.Map/Entrance/Locked.cs index d8cd4037..f7b91232 100644 --- a/KruacentExiled/KE.Map/Entrance/Locked.cs +++ b/KruacentExiled/KE.Map/Entrance/Locked.cs @@ -1,7 +1,7 @@ using Exiled.API.Enums; using Exiled.API.Features; using Interactables.Interobjects.DoorUtils; -using KE.Map.Utils; +using KE.Utils.API.Map; using LabApi.Events.Arguments.ServerEvents; using LabApi.Features.Wrappers; using System; diff --git a/KruacentExiled/KE.Map/Others/BlackoutNDoor/Commands/BlackoutCommand.cs b/KruacentExiled/KE.Map/Others/BlackoutNDoor/Commands/BlackoutCommand.cs index 7775632d..85cfd9d8 100644 --- a/KruacentExiled/KE.Map/Others/BlackoutNDoor/Commands/BlackoutCommand.cs +++ b/KruacentExiled/KE.Map/Others/BlackoutNDoor/Commands/BlackoutCommand.cs @@ -3,7 +3,7 @@ using Exiled.API.Extensions; using Exiled.API.Features; using Exiled.API.Features.Pools; -using KE.Map.Utils; +using KE.Utils.API.Commands; using MapGeneration; using System; using System.Collections.Generic; diff --git a/KruacentExiled/KE.Map/Others/BlackoutNDoor/Commands/BothCommand.cs b/KruacentExiled/KE.Map/Others/BlackoutNDoor/Commands/BothCommand.cs index 081e9b68..f5150f84 100644 --- a/KruacentExiled/KE.Map/Others/BlackoutNDoor/Commands/BothCommand.cs +++ b/KruacentExiled/KE.Map/Others/BlackoutNDoor/Commands/BothCommand.cs @@ -1,15 +1,8 @@ using CommandSystem; -using Exiled.API.Enums; using Exiled.API.Extensions; -using Exiled.API.Features; -using Exiled.API.Features.Pools; -using KE.Map.Utils; +using KE.Utils.API.Commands; using MapGeneration; using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; namespace KE.Map.Others.BlackoutNDoor.Commands { diff --git a/KruacentExiled/KE.Map/Others/BlackoutNDoor/Commands/DoorstuckCommand.cs b/KruacentExiled/KE.Map/Others/BlackoutNDoor/Commands/DoorstuckCommand.cs index e8ecc1d4..e7995171 100644 --- a/KruacentExiled/KE.Map/Others/BlackoutNDoor/Commands/DoorstuckCommand.cs +++ b/KruacentExiled/KE.Map/Others/BlackoutNDoor/Commands/DoorstuckCommand.cs @@ -3,7 +3,7 @@ using Exiled.API.Extensions; using Exiled.API.Features; using Exiled.API.Features.Pools; -using KE.Map.Utils; +using KE.Utils.API.Commands; using MapGeneration; using System; using System.Collections.Generic; diff --git a/KruacentExiled/KE.Map/Others/BlackoutNDoor/Commands/MainCommand.cs b/KruacentExiled/KE.Map/Others/BlackoutNDoor/Commands/MainCommand.cs index 2d011e36..182cb317 100644 --- a/KruacentExiled/KE.Map/Others/BlackoutNDoor/Commands/MainCommand.cs +++ b/KruacentExiled/KE.Map/Others/BlackoutNDoor/Commands/MainCommand.cs @@ -1,6 +1,6 @@ using CommandSystem; using Exiled.API.Features.Pools; -using KE.Map.Utils; +using KE.Utils.API.Commands; using RelativePositioning; using System; using System.Collections.Generic; diff --git a/KruacentExiled/KE.Map/SpawnImage.cs b/KruacentExiled/KE.Map/SpawnImage.cs index 058a8a08..2fd7f491 100644 --- a/KruacentExiled/KE.Map/SpawnImage.cs +++ b/KruacentExiled/KE.Map/SpawnImage.cs @@ -1,7 +1,7 @@ using CommandSystem; using Exiled.API.Features; using HintServiceMeow.Core.Enum; -using KE.Map.Utils; +using KE.Utils.API.Commands; using KE.Utils.API.Displays.DisplayMeow; using KE.Utils.API.Displays.DisplayMeow.Placements; using KE.Utils.API.GifAnimator; diff --git a/KruacentExiled/KE.Map/Utils/KECommand.cs b/KruacentExiled/KE.Map/Utils/KECommand.cs deleted file mode 100644 index 83a96208..00000000 --- a/KruacentExiled/KE.Map/Utils/KECommand.cs +++ /dev/null @@ -1,32 +0,0 @@ -using CommandSystem; -using Exiled.API.Features.Pools; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace KE.Map.Utils -{ - public abstract class KECommand : ICommand, IUsageProvider - { - public abstract string Command { get; } - - public abstract string[] Aliases { get; } - - public abstract string Description { get; } - public abstract string[] Usage { get; } - - public bool Execute(ArraySegment arguments, ICommandSender sender, out string response) - { - bool exe = ExecuteCommand(arguments, sender, out response); - if (!exe) - { - response += $"\nUsage : {Command} " +this.DisplayCommandUsage(); - } - return exe; - } - - public abstract bool ExecuteCommand(ArraySegment arguments, ICommandSender sender, out string response); - } -} diff --git a/KruacentExiled/KE.Map/Utils/KEParentCommand.cs b/KruacentExiled/KE.Map/Utils/KEParentCommand.cs deleted file mode 100644 index 93ba2ff4..00000000 --- a/KruacentExiled/KE.Map/Utils/KEParentCommand.cs +++ /dev/null @@ -1,55 +0,0 @@ -using CommandSystem; -using Exiled.API.Features.Pools; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace KE.Map.Utils -{ - public abstract class KEParentCommand : ParentCommand - { - - public KEParentCommand() - { - LoadGeneratedCommands(); - } - - protected override bool ExecuteParent(ArraySegment arguments, ICommandSender sender, out string response) - { - StringBuilder builder = StringBuilderPool.Pool.Get(); - - builder.Append("Usage : "); - builder.AppendLine(); - foreach (ICommand command in Commands.Values) - { - builder.Append(command.Command); - string[] aliases = command.Aliases; - if(aliases.Length > 0) - { - builder.Append(" ("); - for (int i = 0; i < aliases.Length; i++) - { - builder.Append(aliases[i]); - if (i < aliases.Length - 1) - { - builder.Append(", "); - } - } - builder.Append(")"); - } - builder.Append(" - "); - - - builder.AppendLine(command.Description); - } - - - - response = builder.ToString(); - StringBuilderPool.Pool.Return(builder); - return false; - } - } -} diff --git a/KruacentExiled/KE.Map/Utils/StructureSpawner.cs b/KruacentExiled/KE.Map/Utils/StructureSpawner.cs deleted file mode 100644 index 44138e6a..00000000 --- a/KruacentExiled/KE.Map/Utils/StructureSpawner.cs +++ /dev/null @@ -1,168 +0,0 @@ -using Interactables.Interobjects.DoorUtils; -using InventorySystem.Items.Firearms.Attachments; -using MapGeneration; -using MapGeneration.Distributors; -using Mirror; -using ProjectMER.Features; -using ProjectMER.Features.Enums; -using System; -using System.Collections.Generic; -using UnityEngine; - -namespace KE.Map.Utils -{ - public static class StructureSpawner - { - public static Dictionary> AdditionalDoors { get; } = new(); - - - - public static DoorVariant GetDoorPrefab(DoorType doortype) - { - return doortype switch - { - DoorType.Lcz => PrefabManager.DoorLcz, - DoorType.Hcz => PrefabManager.DoorHcz, - DoorType.Ez => PrefabManager.DoorEz, - DoorType.Bulkdoor => PrefabManager.DoorHeavyBulk, - DoorType.Gate => PrefabManager.DoorGate, - _ => throw new InvalidOperationException(), - }; - } - - public static MapGeneration.Distributors.Locker LockerPrefab(LockerType lockertype) - { - return lockertype switch - { - LockerType.PedestalScp500 => PrefabManager.PedestalScp500, - LockerType.LargeGun => PrefabManager.LockerLargeGun, - LockerType.RifleRack => PrefabManager.LockerRifleRack, - LockerType.Misc => PrefabManager.LockerMisc, - LockerType.Medkit => PrefabManager.LockerRegularMedkit, - LockerType.Adrenaline => PrefabManager.LockerAdrenalineMedkit, - LockerType.PedestalScp018 => PrefabManager.PedestalScp018, - LockerType.PedestalScp207 => PrefabManager.PedstalScp207, - LockerType.PedestalScp244 => PrefabManager.PedestalScp244, - LockerType.PedestalScp268 => PrefabManager.PedestalScp268, - LockerType.PedestalScp1853 => PrefabManager.PedstalScp1853, - LockerType.PedestalScp2176 => PrefabManager.PedestalScp2176, - LockerType.PedestalScpScp1576 => PrefabManager.PedestalScp1576, - LockerType.PedestalAntiScp207 => PrefabManager.PedestalAntiScp207, - LockerType.PedestalScp1344 => PrefabManager.PedestalScp1344, - LockerType.ExperimentalWeapon => PrefabManager.LockerExperimentalWeapon, - _ => throw new InvalidOperationException(), - }; - } - - - public static DoorVariant SpawnDoor(DoorType doortype,Vector3 position,Quaternion rotation, Vector3 scale) - { - Vector3 absolutePosition = position; - Quaternion absoluteRotation = rotation; - DoorVariant doorVariant = UnityEngine.Object.Instantiate(GetDoorPrefab(doortype)); - if (doorVariant.TryGetComponent(out var component)) - { - UnityEngine.Object.Destroy(component); - } - - doorVariant.transform.SetPositionAndRotation(absolutePosition, absoluteRotation); - doorVariant.transform.localScale = scale; - doorVariant.NetworkTargetState = false; - doorVariant.ServerChangeLock(DoorLockReason.SpecialDoorFeature, false); - doorVariant.RequiredPermissions = new DoorPermissionsPolicy(DoorPermissionFlags.None, false); - - NetworkServer.UnSpawn(doorVariant.gameObject); - NetworkServer.Spawn(doorVariant.gameObject); - FacilityZone zone = doorVariant.transform.position.GetZone(); - - if (!AdditionalDoors.ContainsKey(zone)) - { - AdditionalDoors.Add(zone, new()); - } - AdditionalDoors[zone].Add(doorVariant); - - - - return doorVariant; - } - - public static MapGeneration.Distributors.Locker SpawnPedestal(ItemType item, Vector3 position, Quaternion rotation,Vector3? scale) - { - MapGeneration.Distributors.Locker locker = UnityEngine.Object.Instantiate(LockerPrefab(LockerType.PedestalScp500)); - Vector3 absolutePosition = position; - Quaternion absoluteRotation = rotation; - locker.transform.localScale = scale ?? Vector3.one; - locker.transform.SetPositionAndRotation(absolutePosition, absoluteRotation); - if (locker.TryGetComponent(out var component)) - { - component.Network_position = locker.transform.position; - component.Network_rotationY = (sbyte)Mathf.RoundToInt(locker.transform.rotation.eulerAngles.y / 5.625f); - } - - LabApi.Features.Wrappers.Locker labApiLocker = LabApi.Features.Wrappers.Locker.Get(locker); - - labApiLocker.ClearLockerLoot(); - - - labApiLocker.ClearAllChambers(); - NetworkServer.UnSpawn(locker.gameObject); - NetworkServer.Spawn(locker.gameObject); - - - - foreach (MapGeneration.Distributors.LockerChamber chamber in locker.Chambers) - { - chamber.SpawnItem(item, 1); - } - - return locker; - } - - public static WorkstationController SpawnWorkshop(Vector3 position, Quaternion rotation,Vector3 scale) - { - WorkstationController workstationController = UnityEngine.Object.Instantiate(PrefabManager.Workstation); - Vector3 absolutePosition = position; - Quaternion absoluteRotation = rotation; - workstationController.transform.SetPositionAndRotation(absolutePosition, absoluteRotation); - workstationController.transform.localScale = scale; - workstationController.NetworkStatus = (byte)0u; - if (workstationController.TryGetComponent(out var component)) - { - component.Network_position = workstationController.transform.position; - component.Network_rotationY = (sbyte)Mathf.RoundToInt(workstationController.transform.rotation.eulerAngles.y / 5.625f); - } - - NetworkServer.UnSpawn(workstationController.gameObject); - NetworkServer.Spawn(workstationController.gameObject); - return workstationController; - } - - - - - - - - [Obsolete("one day it'll work",true)] - public static BreakableWindow CreateWindow(Vector3 position, Quaternion rotation) - { - BreakableWindow br = null; - foreach (GameObject gameObject in NetworkClient.prefabs.Values) - { - if (gameObject.TryGetComponent(out var window)) - { - br = UnityEngine.Object.Instantiate(window); - } - } - - br.transform.SetPositionAndRotation(position, rotation); - br.transform.localScale = Vector3.one; - br.NetworkIsBroken = false; - - NetworkServer.UnSpawn(br.gameObject); - NetworkServer.Spawn(br.gameObject); - return br; - } - - } -} From 70e5b19294e0cbede6a6883f5c91738927872750 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Tue, 13 Jan 2026 20:20:39 +0100 Subject: [PATCH 512/853] added additional door --- KruacentExiled/KE.Map/Heavy/BulkDoor049.cs | 23 ++++++++++--- .../KE.Map/Others/BlackoutNDoor/DoorStuck.cs | 33 ++++++++++++++----- 2 files changed, 44 insertions(+), 12 deletions(-) diff --git a/KruacentExiled/KE.Map/Heavy/BulkDoor049.cs b/KruacentExiled/KE.Map/Heavy/BulkDoor049.cs index ab356b05..6855a600 100644 --- a/KruacentExiled/KE.Map/Heavy/BulkDoor049.cs +++ b/KruacentExiled/KE.Map/Heavy/BulkDoor049.cs @@ -1,5 +1,8 @@ -using Exiled.API.Features; -using KE.Utils.API; +using Exiled.API.Enums; +using Exiled.API.Features; +using Exiled.API.Features.Doors; +using Interactables.Interobjects.DoorUtils; +using KE.Utils.API.Map; using System; using System.Collections.Generic; using System.Linq; @@ -16,7 +19,7 @@ public static void Create() { - Room room = Room.List.Where(r => r.Type == Exiled.API.Enums.RoomType.Hcz049).First(); + Room room = Room.List.Where(r => r.Type == RoomType.Hcz049).First(); Vector3 pos = new(-19.7f ,89f, 9f); @@ -26,7 +29,19 @@ public static void Create() - StructureSpawner.SpawnDoor(ProjectMER.Features.Enums.DoorType.HeavyBulkDoor, worldpos, room.Rotation * rot , Vector3.one); + DoorVariant door = StructureSpawner.SpawnDoor(ProjectMER.Features.Enums.DoorType.HeavyBulkDoor, worldpos, room.Rotation * rot , Vector3.one,ZoneType.HeavyContainment); + + + Door doorExiled = Door.Get(door); + foreach(var k in StructureSpawner.AdditionalDoors) + { + Log.Debug(k.Key); + foreach(DoorVariant doorv in k.Value) + { + Log.Debug(doorv); + } + } + Log.Debug("spawn 049 bulk door at "+ worldpos); } diff --git a/KruacentExiled/KE.Map/Others/BlackoutNDoor/DoorStuck.cs b/KruacentExiled/KE.Map/Others/BlackoutNDoor/DoorStuck.cs index e824a4c3..2c365b11 100644 --- a/KruacentExiled/KE.Map/Others/BlackoutNDoor/DoorStuck.cs +++ b/KruacentExiled/KE.Map/Others/BlackoutNDoor/DoorStuck.cs @@ -1,12 +1,10 @@ using Exiled.API.Enums; -using System; +using Exiled.API.Features.Doors; +using Interactables.Interobjects.DoorUtils; +using KE.Map.Others.BlackoutNDoor.Handlers; +using KE.Utils.API.Map; using System.Collections.Generic; using System.Linq; -using System.Text; -using System.Threading.Tasks; -using KE.Map.Others.BlackoutNDoor.Handlers; -using Exiled.API.Features.Doors; -using CommandSystem; namespace KE.Map.Others.BlackoutNDoor { @@ -29,12 +27,31 @@ public override void Start(ZoneType zone) if (door.DoorLockType == DoorLockType.None) { doors.Add(door); - door.ChangeLock(DoorLockType.NoPower); - door.IsOpen = open; + LockDoor(door, open); + } + } + + if(StructureSpawner.AdditionalDoors.TryGetValue(zone,out var addDoors)) + { + foreach(DoorVariant doorVariant in addDoors) + { + Door door2 = Door.Get(doorVariant); + if (door2.DoorLockType == DoorLockType.None) + { + doors.Add(door2); + LockDoor(door2, open); + } + } } } + private void LockDoor(Door door, bool open) + { + door.ChangeLock(DoorLockType.NoPower); + door.IsOpen = open; + } + public override void Stop(ZoneType zone) { bool open = UnityEngine.Random.value > .5f; From 3d48b2c68fcea888b5e67fc2dbad0ddfcc15e0f6 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Wed, 14 Jan 2026 10:56:44 +0100 Subject: [PATCH 513/853] better gui + ability cost --- .../API/Features/KEAbilities.cs | 29 +++++++------ .../API/Features/KEAbilityCost.cs | 43 +++++++++++++++++++ .../API/Interfaces/ICustomIcon.cs | 2 +- .../FireAbilities/FireAbilityBase.cs | 25 +---------- 4 files changed, 61 insertions(+), 38 deletions(-) create mode 100644 KruacentExiled/KE.CustomRoles/API/Features/KEAbilityCost.cs diff --git a/KruacentExiled/KE.CustomRoles/API/Features/KEAbilities.cs b/KruacentExiled/KE.CustomRoles/API/Features/KEAbilities.cs index deb891fe..d0055eac 100644 --- a/KruacentExiled/KE.CustomRoles/API/Features/KEAbilities.cs +++ b/KruacentExiled/KE.CustomRoles/API/Features/KEAbilities.cs @@ -1,6 +1,7 @@ using Exiled.API.Features; using Exiled.API.Features.Pools; using KE.CustomRoles.Abilities.FireAbilities; +using KE.CustomRoles.API.Interfaces; using KE.CustomRoles.Settings; using KE.Utils.API; using KE.Utils.API.Displays.DisplayMeow; @@ -413,7 +414,16 @@ public static bool TryGetSelected(Player player, out KEAbilities ability) public const string ReadyText = "[READY]"; - private static AbilitiesPosition AbilityPosition = new(); + public static readonly AbilitiesPosition AbilityPosition = new(); + + + protected virtual void Gui(StringBuilder sb) + { + sb.Append(PublicName); + sb.Append(" "); + } + + public static string UpdateGUI(Player player) { StringBuilder builder = StringBuilderPool.Pool.Get(); @@ -427,18 +437,7 @@ public static string UpdateGUI(Player player) KEAbilities ability = allAbilities[i]; - builder.Append(ability.PublicName); - builder.Append(" "); - - - if(ability is FireAbilityBase fire) - { - builder.Append("("); - builder.Append(fire.Cost); - builder.Append(")"); - builder.Append(" "); - } - + ability.Gui(builder); if (ability.CanUse(player,out var output)) @@ -453,6 +452,9 @@ public static string UpdateGUI(Player player) builder.Append("s]"); } + + + if (ability.Selected.Contains(player)) { @@ -469,7 +471,6 @@ public static string UpdateGUI(Player player) string msg = builder.ToString(); StringBuilderPool.Pool.Return(builder); return msg; - //DisplayHandler.Instance.AddHint(MainPlugin.Abilities, player, msg, UpdateTime); } diff --git a/KruacentExiled/KE.CustomRoles/API/Features/KEAbilityCost.cs b/KruacentExiled/KE.CustomRoles/API/Features/KEAbilityCost.cs new file mode 100644 index 00000000..0f69ff86 --- /dev/null +++ b/KruacentExiled/KE.CustomRoles/API/Features/KEAbilityCost.cs @@ -0,0 +1,43 @@ +using Exiled.API.Features; +using KE.CustomRoles.Abilities.FireAbilities; +using KE.Utils.API.CustomStats; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace KE.CustomRoles.API.Features +{ + public abstract class KEAbilityCost : KEAbilities + { + + public abstract int Cost { get; } + protected sealed override bool AbilityUsed(Player player) + { + bool result = CanLaunchAbility(player); + if (result) + { + result = LaunchedAbility(player); + } + return result; + } + + protected virtual bool LaunchedAbility(Player player) + { + return true; + } + + public abstract bool CanLaunchAbility(Player player); + + + protected override void Gui(StringBuilder sb) + { + base.Gui(sb); + sb.Append("("); + sb.Append(Cost); + sb.Append(")"); + sb.Append(" "); + } + } +} diff --git a/KruacentExiled/KE.CustomRoles/API/Interfaces/ICustomIcon.cs b/KruacentExiled/KE.CustomRoles/API/Interfaces/ICustomIcon.cs index 8469528b..dcd36549 100644 --- a/KruacentExiled/KE.CustomRoles/API/Interfaces/ICustomIcon.cs +++ b/KruacentExiled/KE.CustomRoles/API/Interfaces/ICustomIcon.cs @@ -9,7 +9,7 @@ namespace KE.CustomRoles.API.Interfaces public interface ICustomIcon { - + public abstract string IconName { get; } } diff --git a/KruacentExiled/KE.CustomRoles/Abilities/FireAbilities/FireAbilityBase.cs b/KruacentExiled/KE.CustomRoles/Abilities/FireAbilities/FireAbilityBase.cs index 5df1c68a..12076f71 100644 --- a/KruacentExiled/KE.CustomRoles/Abilities/FireAbilities/FireAbilityBase.cs +++ b/KruacentExiled/KE.CustomRoles/Abilities/FireAbilities/FireAbilityBase.cs @@ -10,30 +10,9 @@ namespace KE.CustomRoles.Abilities.FireAbilities { - public abstract class FireAbilityBase : KEAbilities + public abstract class FireAbilityBase : KEAbilityCost { - public abstract int Cost { get; } - protected sealed override bool AbilityUsed(Player player) - { - bool result = CanLaunchAbility(player); - Log.Debug("using fire"); - if (result) - { - result = LaunchedAbility(player); - } - - - - - return result; - } - - protected virtual bool LaunchedAbility(Player player) - { - return true; - } - - public bool CanLaunchAbility(Player player) + public override bool CanLaunchAbility(Player player) { if(player.GameObject.TryGetComponent(out var stat)) From 970ac5d1cb923c0d50c0fe5135ef7e384a704d23 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Wed, 14 Jan 2026 11:00:00 +0100 Subject: [PATCH 514/853] image stuff --- KruacentExiled/KE.Map/SpawnImage.cs | 7 ------- 1 file changed, 7 deletions(-) diff --git a/KruacentExiled/KE.Map/SpawnImage.cs b/KruacentExiled/KE.Map/SpawnImage.cs index 2fd7f491..54e41d70 100644 --- a/KruacentExiled/KE.Map/SpawnImage.cs +++ b/KruacentExiled/KE.Map/SpawnImage.cs @@ -39,18 +39,11 @@ public override bool ExecuteCommand(ArraySegment arguments, ICommandSend TextImage textimg = new TextImage(img,20); Log.Debug(textimg.RawString.Length); - TextToy toy = textimg.Spawn(player.Position,player.Rotation); - Log.Debug(toy.TextFormat.Length); - - toy.DisplaySize = new Vector2(5000, 5000); DisplayHandler.Instance.AddHint(position.HintPlacement, player, textimg.RawString, 30); - - - toy.Spawn(); response = "ok"; return true; } From 80528ff8800c4251617772d8e854949fb1d1a8b3 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Wed, 14 Jan 2026 11:02:07 +0100 Subject: [PATCH 515/853] removed otherp proejcte agian --- .../API/Features/Controller.cs | 192 ---------------- KruacentExiled/KE.BlackoutNDoor/Config.cs | 29 --- .../Handlers/ServerHandler.cs | 71 ------ .../KE.BlackoutNDoor/KE.BlackoutNDoor.csproj | 17 -- KruacentExiled/KE.BlackoutNDoor/MainPlugin.cs | 51 ----- KruacentExiled/KE.CustomRoles/MainPlugin.cs | 15 +- .../Config.cs | 15 -- .../GE/Blitz.cs | 51 ----- .../GE/Impostor.cs | 70 ------ .../GE/KIWIS.cs | 57 ----- .../GE/OpenBar.cs | 57 ----- .../KE.GlobalEventFramework.Examples/GE/R.cs | 26 --- .../GE/RandomSpawn.cs | 47 ---- .../GE/Shuffle.cs | 107 --------- .../GE/Speed.cs | 72 ------ .../GE/SystemMalfunction.cs | 118 ---------- .../KE.GlobalEventFramework.Examples.csproj | 17 -- .../MainPlugin.cs | 26 --- .../KE.GlobalEventFramework/Config.cs | 21 -- .../GEFE/API/Features/GlobalEvent.cs | 206 ----------------- .../GEFE/API/Features/Loader.cs | 42 ---- .../GEFE/API/Interfaces/IGlobalEvent.cs | 49 ---- .../GEFE/API/Utils/Coroutine.cs | 19 -- .../GEFE/Commands/ForceGE.cs | 65 ------ .../GEFE/Commands/ForceNbGE.cs | 61 ----- .../GEFE/Commands/ListGE.cs | 37 --- .../GEFE/Commands/ParentCommandGEFE.cs | 38 ---- .../Exception/GlobalEventNullException.cs | 16 -- .../GEFE/Handlers/ServerHandler.cs | 70 ------ .../KE.GlobalEventFramework.csproj | 17 -- .../KE.GlobalEventFramework/MainPlugin.cs | 72 ------ KruacentExiled/KE.Items/Config.cs | 15 -- .../KE.Items/Interface/ILumosItem.cs | 14 -- .../KE.Items/Items/AdrenalineDrogue.cs | 214 ------------------ KruacentExiled/KE.Items/Items/Defibrilator.cs | 128 ----------- .../KE.Items/Items/DeployableWall.cs | 97 -------- KruacentExiled/KE.Items/Items/DivinePills.cs | 110 --------- KruacentExiled/KE.Items/Items/PressePuree.cs | 50 ---- KruacentExiled/KE.Items/Items/TPGrenada.cs | 124 ---------- KruacentExiled/KE.Items/KE.Items.csproj | 21 -- KruacentExiled/KE.Items/MainPlugin.cs | 127 ----------- KruacentExiled/KE.Map/Doors/DoorButton.cs | 66 ------ KruacentExiled/KE.Map/Doors/KEDoor.cs | 133 ----------- .../KE.Map/Doors/KEDoorTypes/KEDoorType.cs | 18 -- .../KE.Map/Doors/KEDoorTypes/NormalKEDoor.cs | 25 -- KruacentExiled/KE.Map/EasterEggs/Capybaras.cs | 45 ---- .../KE.Map/EasterEggs/SpinnyBaras.cs | 48 ---- .../KE.Map/GamblingZone/DroppableItem.cs | 79 ------- .../KE.Map/GamblingZone/GamblingRoom.cs | 98 -------- .../KE.Map/GamblingZone/LootTable.cs | 62 ----- .../KE.Map/GamblingZone/OldGamblingRoom.cs | 97 -------- KruacentExiled/KE.Map/KE.Map.csproj | 32 --- KruacentExiled/KE.Map/MainPlugin.cs | 138 ----------- .../KE.Map/Quality/SendFakePrimitives.cs | 84 ------- .../KE.Map/Utils/InteractiblePickup.cs | 140 ------------ KruacentExiled/KE.Misc/914.cs | 182 --------------- KruacentExiled/KE.Misc/AutoElevator.cs | 37 --- KruacentExiled/KE.Misc/Candy.cs | 22 -- KruacentExiled/KE.Misc/ClassDDoor.cs | 41 ---- KruacentExiled/KE.Misc/Config.cs | 24 -- KruacentExiled/KE.Misc/KE.Misc.csproj | 20 -- KruacentExiled/KE.Misc/MainPlugin.cs | 141 ------------ KruacentExiled/KE.Misc/README.md | 14 -- KruacentExiled/KE.Misc/ServerHandler.cs | 29 --- KruacentExiled/KE.Misc/SurfaceLight.cs | 39 ---- .../Displays/DisplayMeow/DisplayHandler.cs | 67 ------ .../API/Displays/DisplayMeow/HintPlacement.cs | 31 --- .../KE.Utils/API/GifAnimator/RenderGif.cs | 128 ----------- .../KE.Utils/API/Interfaces/IEvents.cs | 17 -- .../KE.Utils/API/Interfaces/ILoadable.cs | 13 -- .../KE.Utils/API/Models/Arrows/Arrow.cs | 58 ----- .../KE.Utils/API/Models/Arrows/MoveArrow.cs | 12 - .../KE.Utils/API/Models/Arrows/RotateArrow.cs | 12 - .../KE.Utils/API/Models/Arrows/ScaleArrow.cs | 12 - .../KE.Utils/API/Models/Arrows/XArrow.cs | 16 -- .../KE.Utils/API/Models/Arrows/YArrow.cs | 16 -- .../KE.Utils/API/Models/Arrows/ZArrow.cs | 16 -- .../Models/Blueprints/AdminToyBlueprint.cs | 69 ------ .../API/Models/Blueprints/LightBlueprint.cs | 37 --- .../API/Models/Blueprints/ModelBlueprint.cs | 110 --------- .../Models/Blueprints/PrimitiveBlueprint.cs | 39 ---- .../API/Models/Commands/AllCommands.cs | 33 --- .../API/Models/Commands/ChangeColor.cs | 72 ------ .../API/Models/Commands/ChangePrimType.cs | 53 ----- .../API/Models/Commands/CreateModel.cs | 44 ---- .../API/Models/Commands/CreatePrim.cs | 47 ---- .../KE.Utils/API/Models/Commands/ListModel.cs | 42 ---- .../KE.Utils/API/Models/Commands/LoadModel.cs | 65 ------ .../API/Models/Commands/ModeMovePrim.cs | 64 ------ .../KE.Utils/API/Models/Commands/SaveModel.cs | 47 ---- .../API/Models/Commands/SelectModel.cs | 56 ----- .../API/Models/Commands/ShowCenter.cs | 51 ----- KruacentExiled/KE.Utils/API/Models/Model.cs | 202 ----------------- .../KE.Utils/API/Models/ModelCreator.cs | 175 -------------- .../KE.Utils/API/Models/ModelLoader.cs | 152 ------------- KruacentExiled/KE.Utils/API/Models/Models.cs | 47 ---- .../KE.Utils/API/Models/MovementHandler.cs | 208 ----------------- .../KE.Utils/API/Models/SelectedModel.cs | 52 ----- .../Models/ToysSettings/PrimitiveSetting.cs | 31 --- .../API/Models/ToysSettings/ToySetting.cs | 20 -- KruacentExiled/KE.Utils/API/OtherUtils.cs | 18 -- KruacentExiled/KE.Utils/API/Parser.cs | 36 --- .../KE.Utils/API/ReflectionHelper.cs | 47 ---- .../KE.Utils/API/Sounds/SoundPlayer.cs | 115 ---------- .../KE.Utils/Extensions/AdminToyExtension.cs | 25 -- .../KE.Utils/Extensions/NpcExtension.cs | 23 -- .../KE.Utils/Extensions/PlayerExtension.cs | 52 ----- .../KE.Utils/Extensions/RoomExtension.cs | 12 - .../KE.Utils/Extensions/RoomExtensions.cs | 55 ----- KruacentExiled/KE.Utils/KE.Utils.csproj | 31 --- .../KE.Utils/Quality/Enums/ModelQuality.cs | 16 -- .../Quality/Handlers/QualityToysHandler.cs | 179 --------------- .../KE.Utils/Quality/Models/Base/BaseModel.cs | 41 ---- .../Quality/Models/Base/LightModel.cs | 26 --- .../Quality/Models/Base/PrimitiveModel.cs | 26 --- .../Quality/Models/Examples/MineModel.cs | 118 ---------- .../KE.Utils/Quality/Models/Model.cs | 104 --------- .../KE.Utils/Quality/Models/ModelPrefab.cs | 42 ---- .../KE.Utils/Quality/Models/QualityModel.cs | 40 ---- .../KE.Utils/Quality/QualityHandler.cs | 61 ----- .../KE.Utils/Quality/QualityToysHandler.cs | 155 ------------- .../Quality/Settings/QualitySettings.cs | 62 ----- .../Quality/Structs/LocalWorldSpace.cs | 23 -- KruacentExiled/KE.Utils/Quality/Tests/Test.cs | 108 --------- 124 files changed, 14 insertions(+), 7780 deletions(-) delete mode 100644 KruacentExiled/KE.BlackoutNDoor/API/Features/Controller.cs delete mode 100644 KruacentExiled/KE.BlackoutNDoor/Config.cs delete mode 100644 KruacentExiled/KE.BlackoutNDoor/Handlers/ServerHandler.cs delete mode 100644 KruacentExiled/KE.BlackoutNDoor/KE.BlackoutNDoor.csproj delete mode 100644 KruacentExiled/KE.BlackoutNDoor/MainPlugin.cs delete mode 100644 KruacentExiled/KE.GlobalEventFramework.Examples/Config.cs delete mode 100644 KruacentExiled/KE.GlobalEventFramework.Examples/GE/Blitz.cs delete mode 100644 KruacentExiled/KE.GlobalEventFramework.Examples/GE/Impostor.cs delete mode 100644 KruacentExiled/KE.GlobalEventFramework.Examples/GE/KIWIS.cs delete mode 100644 KruacentExiled/KE.GlobalEventFramework.Examples/GE/OpenBar.cs delete mode 100644 KruacentExiled/KE.GlobalEventFramework.Examples/GE/R.cs delete mode 100644 KruacentExiled/KE.GlobalEventFramework.Examples/GE/RandomSpawn.cs delete mode 100644 KruacentExiled/KE.GlobalEventFramework.Examples/GE/Shuffle.cs delete mode 100644 KruacentExiled/KE.GlobalEventFramework.Examples/GE/Speed.cs delete mode 100644 KruacentExiled/KE.GlobalEventFramework.Examples/GE/SystemMalfunction.cs delete mode 100644 KruacentExiled/KE.GlobalEventFramework.Examples/KE.GlobalEventFramework.Examples.csproj delete mode 100644 KruacentExiled/KE.GlobalEventFramework.Examples/MainPlugin.cs delete mode 100644 KruacentExiled/KE.GlobalEventFramework/Config.cs delete mode 100644 KruacentExiled/KE.GlobalEventFramework/GEFE/API/Features/GlobalEvent.cs delete mode 100644 KruacentExiled/KE.GlobalEventFramework/GEFE/API/Features/Loader.cs delete mode 100644 KruacentExiled/KE.GlobalEventFramework/GEFE/API/Interfaces/IGlobalEvent.cs delete mode 100644 KruacentExiled/KE.GlobalEventFramework/GEFE/API/Utils/Coroutine.cs delete mode 100644 KruacentExiled/KE.GlobalEventFramework/GEFE/Commands/ForceGE.cs delete mode 100644 KruacentExiled/KE.GlobalEventFramework/GEFE/Commands/ForceNbGE.cs delete mode 100644 KruacentExiled/KE.GlobalEventFramework/GEFE/Commands/ListGE.cs delete mode 100644 KruacentExiled/KE.GlobalEventFramework/GEFE/Commands/ParentCommandGEFE.cs delete mode 100644 KruacentExiled/KE.GlobalEventFramework/GEFE/Exception/GlobalEventNullException.cs delete mode 100644 KruacentExiled/KE.GlobalEventFramework/GEFE/Handlers/ServerHandler.cs delete mode 100644 KruacentExiled/KE.GlobalEventFramework/KE.GlobalEventFramework.csproj delete mode 100644 KruacentExiled/KE.GlobalEventFramework/MainPlugin.cs delete mode 100644 KruacentExiled/KE.Items/Config.cs delete mode 100644 KruacentExiled/KE.Items/Interface/ILumosItem.cs delete mode 100644 KruacentExiled/KE.Items/Items/AdrenalineDrogue.cs delete mode 100644 KruacentExiled/KE.Items/Items/Defibrilator.cs delete mode 100644 KruacentExiled/KE.Items/Items/DeployableWall.cs delete mode 100644 KruacentExiled/KE.Items/Items/DivinePills.cs delete mode 100644 KruacentExiled/KE.Items/Items/PressePuree.cs delete mode 100644 KruacentExiled/KE.Items/Items/TPGrenada.cs delete mode 100644 KruacentExiled/KE.Items/KE.Items.csproj delete mode 100644 KruacentExiled/KE.Items/MainPlugin.cs delete mode 100644 KruacentExiled/KE.Map/Doors/DoorButton.cs delete mode 100644 KruacentExiled/KE.Map/Doors/KEDoor.cs delete mode 100644 KruacentExiled/KE.Map/Doors/KEDoorTypes/KEDoorType.cs delete mode 100644 KruacentExiled/KE.Map/Doors/KEDoorTypes/NormalKEDoor.cs delete mode 100644 KruacentExiled/KE.Map/EasterEggs/Capybaras.cs delete mode 100644 KruacentExiled/KE.Map/EasterEggs/SpinnyBaras.cs delete mode 100644 KruacentExiled/KE.Map/GamblingZone/DroppableItem.cs delete mode 100644 KruacentExiled/KE.Map/GamblingZone/GamblingRoom.cs delete mode 100644 KruacentExiled/KE.Map/GamblingZone/LootTable.cs delete mode 100644 KruacentExiled/KE.Map/GamblingZone/OldGamblingRoom.cs delete mode 100644 KruacentExiled/KE.Map/KE.Map.csproj delete mode 100644 KruacentExiled/KE.Map/MainPlugin.cs delete mode 100644 KruacentExiled/KE.Map/Quality/SendFakePrimitives.cs delete mode 100644 KruacentExiled/KE.Map/Utils/InteractiblePickup.cs delete mode 100644 KruacentExiled/KE.Misc/914.cs delete mode 100644 KruacentExiled/KE.Misc/AutoElevator.cs delete mode 100644 KruacentExiled/KE.Misc/Candy.cs delete mode 100644 KruacentExiled/KE.Misc/ClassDDoor.cs delete mode 100644 KruacentExiled/KE.Misc/Config.cs delete mode 100644 KruacentExiled/KE.Misc/KE.Misc.csproj delete mode 100644 KruacentExiled/KE.Misc/MainPlugin.cs delete mode 100644 KruacentExiled/KE.Misc/README.md delete mode 100644 KruacentExiled/KE.Misc/ServerHandler.cs delete mode 100644 KruacentExiled/KE.Misc/SurfaceLight.cs delete mode 100644 KruacentExiled/KE.Utils/API/Displays/DisplayMeow/DisplayHandler.cs delete mode 100644 KruacentExiled/KE.Utils/API/Displays/DisplayMeow/HintPlacement.cs delete mode 100644 KruacentExiled/KE.Utils/API/GifAnimator/RenderGif.cs delete mode 100644 KruacentExiled/KE.Utils/API/Interfaces/IEvents.cs delete mode 100644 KruacentExiled/KE.Utils/API/Interfaces/ILoadable.cs delete mode 100644 KruacentExiled/KE.Utils/API/Models/Arrows/Arrow.cs delete mode 100644 KruacentExiled/KE.Utils/API/Models/Arrows/MoveArrow.cs delete mode 100644 KruacentExiled/KE.Utils/API/Models/Arrows/RotateArrow.cs delete mode 100644 KruacentExiled/KE.Utils/API/Models/Arrows/ScaleArrow.cs delete mode 100644 KruacentExiled/KE.Utils/API/Models/Arrows/XArrow.cs delete mode 100644 KruacentExiled/KE.Utils/API/Models/Arrows/YArrow.cs delete mode 100644 KruacentExiled/KE.Utils/API/Models/Arrows/ZArrow.cs delete mode 100644 KruacentExiled/KE.Utils/API/Models/Blueprints/AdminToyBlueprint.cs delete mode 100644 KruacentExiled/KE.Utils/API/Models/Blueprints/LightBlueprint.cs delete mode 100644 KruacentExiled/KE.Utils/API/Models/Blueprints/ModelBlueprint.cs delete mode 100644 KruacentExiled/KE.Utils/API/Models/Blueprints/PrimitiveBlueprint.cs delete mode 100644 KruacentExiled/KE.Utils/API/Models/Commands/AllCommands.cs delete mode 100644 KruacentExiled/KE.Utils/API/Models/Commands/ChangeColor.cs delete mode 100644 KruacentExiled/KE.Utils/API/Models/Commands/ChangePrimType.cs delete mode 100644 KruacentExiled/KE.Utils/API/Models/Commands/CreateModel.cs delete mode 100644 KruacentExiled/KE.Utils/API/Models/Commands/CreatePrim.cs delete mode 100644 KruacentExiled/KE.Utils/API/Models/Commands/ListModel.cs delete mode 100644 KruacentExiled/KE.Utils/API/Models/Commands/LoadModel.cs delete mode 100644 KruacentExiled/KE.Utils/API/Models/Commands/ModeMovePrim.cs delete mode 100644 KruacentExiled/KE.Utils/API/Models/Commands/SaveModel.cs delete mode 100644 KruacentExiled/KE.Utils/API/Models/Commands/SelectModel.cs delete mode 100644 KruacentExiled/KE.Utils/API/Models/Commands/ShowCenter.cs delete mode 100644 KruacentExiled/KE.Utils/API/Models/Model.cs delete mode 100644 KruacentExiled/KE.Utils/API/Models/ModelCreator.cs delete mode 100644 KruacentExiled/KE.Utils/API/Models/ModelLoader.cs delete mode 100644 KruacentExiled/KE.Utils/API/Models/Models.cs delete mode 100644 KruacentExiled/KE.Utils/API/Models/MovementHandler.cs delete mode 100644 KruacentExiled/KE.Utils/API/Models/SelectedModel.cs delete mode 100644 KruacentExiled/KE.Utils/API/Models/ToysSettings/PrimitiveSetting.cs delete mode 100644 KruacentExiled/KE.Utils/API/Models/ToysSettings/ToySetting.cs delete mode 100644 KruacentExiled/KE.Utils/API/OtherUtils.cs delete mode 100644 KruacentExiled/KE.Utils/API/Parser.cs delete mode 100644 KruacentExiled/KE.Utils/API/ReflectionHelper.cs delete mode 100644 KruacentExiled/KE.Utils/API/Sounds/SoundPlayer.cs delete mode 100644 KruacentExiled/KE.Utils/Extensions/AdminToyExtension.cs delete mode 100644 KruacentExiled/KE.Utils/Extensions/NpcExtension.cs delete mode 100644 KruacentExiled/KE.Utils/Extensions/PlayerExtension.cs delete mode 100644 KruacentExiled/KE.Utils/Extensions/RoomExtension.cs delete mode 100644 KruacentExiled/KE.Utils/Extensions/RoomExtensions.cs delete mode 100644 KruacentExiled/KE.Utils/KE.Utils.csproj delete mode 100644 KruacentExiled/KE.Utils/Quality/Enums/ModelQuality.cs delete mode 100644 KruacentExiled/KE.Utils/Quality/Handlers/QualityToysHandler.cs delete mode 100644 KruacentExiled/KE.Utils/Quality/Models/Base/BaseModel.cs delete mode 100644 KruacentExiled/KE.Utils/Quality/Models/Base/LightModel.cs delete mode 100644 KruacentExiled/KE.Utils/Quality/Models/Base/PrimitiveModel.cs delete mode 100644 KruacentExiled/KE.Utils/Quality/Models/Examples/MineModel.cs delete mode 100644 KruacentExiled/KE.Utils/Quality/Models/Model.cs delete mode 100644 KruacentExiled/KE.Utils/Quality/Models/ModelPrefab.cs delete mode 100644 KruacentExiled/KE.Utils/Quality/Models/QualityModel.cs delete mode 100644 KruacentExiled/KE.Utils/Quality/QualityHandler.cs delete mode 100644 KruacentExiled/KE.Utils/Quality/QualityToysHandler.cs delete mode 100644 KruacentExiled/KE.Utils/Quality/Settings/QualitySettings.cs delete mode 100644 KruacentExiled/KE.Utils/Quality/Structs/LocalWorldSpace.cs delete mode 100644 KruacentExiled/KE.Utils/Quality/Tests/Test.cs diff --git a/KruacentExiled/KE.BlackoutNDoor/API/Features/Controller.cs b/KruacentExiled/KE.BlackoutNDoor/API/Features/Controller.cs deleted file mode 100644 index 387d1a6a..00000000 --- a/KruacentExiled/KE.BlackoutNDoor/API/Features/Controller.cs +++ /dev/null @@ -1,192 +0,0 @@ -using Exiled.API.Enums; -using Exiled.API.Features; -using Exiled.API.Features.Doors; -using MEC; -using System; -using System.Collections.Generic; -using System.Linq; - -namespace KE.BlackoutNDoor.API.Features -{ - public class Controller - { - private DoorType[] BlacklistedDoor = { DoorType.ElevatorGateA, DoorType.ElevatorGateB, DoorType.ElevatorLczA, DoorType.ElevatorLczB, DoorType.ElevatorNuke, DoorType.ElevatorScp049, DoorType.UnknownElevator }; - - /// - /// Select a random zone and close and lock all door of the zone - /// - internal IEnumerator RandomDoorStuck() - { - yield return Timing.WaitUntilTrue(() => Round.IsStarted); - var zone = SelectZone(); - Log.Debug($"DoorStuck in {zone}"); - yield return Timing.WaitUntilFalse(() => Cassie.IsSpeaking); - CassieVoiceLine(zone, false); - yield return Timing.WaitUntilFalse(() => Cassie.IsSpeaking); - yield return Timing.WaitForSeconds(MainPlugin.Instance.Config.DurationMalfunction); - // if the zone is light and there is only 30s left then skip - if (!(zone == ZoneType.LightContainment && Map.DecontaminationState == DecontaminationState.Countdown && Warhead.IsInProgress)) - { - List doorList = Door.List - .Where(d => !BlacklistedDoor.Contains(d.Type)) - .ToList(); - var ge = Generator.List.Where(g => g.IsEngaged); - if(ge.ToList().Count != 3) - { - doorList = Door.List - .Where(d => !BlacklistedDoor.Union(new[] { DoorType.Scp079First, DoorType.Scp079Second }).Contains(d.Type)) - .ToList(); - } - foreach (Door door in doorList) - { - - if (door.Zone == zone) - { - door.IsOpen = false; - door.ChangeLock(DoorLockType.Lockdown2176); - Timing.CallDelayed(MainPlugin.Instance.Config.DurationMalfunction / 2, () => door.IsOpen = true); - Timing.CallDelayed(MainPlugin.Instance.Config.DurationMalfunction, () => door.Unlock()); - if (UnityEngine.Random.value < .5f) - { - door.IsOpen = false; - } - } - } - } - } - - /// - /// Select a random zone and blackout it - /// - public IEnumerator RandomBlackout() - { - yield return Timing.WaitUntilTrue(() => Round.IsStarted); - - var zone = SelectZone(); - yield return Timing.WaitUntilFalse(() => Cassie.IsSpeaking); - CassieVoiceLine(zone, true); - yield return Timing.WaitUntilFalse(() => Cassie.IsSpeaking); - yield return Timing.WaitForSeconds(MainPlugin.Instance.Config.DurationMalfunction); - Log.Debug($"BlackOut in {zone}"); - - - Map.TurnOffAllLights(MainPlugin.Instance.Config.DurationMalfunction, zone); - } - - - private void CassieVoiceLine(ZoneType zone,bool isBlackout) - { - if (isBlackout) - { - switch (zone) - { - case ZoneType.LightContainment: - Cassie.MessageTranslated("Warning Failure Of All Lights In Light Containment Zone in 5 seconds", - "Warning Failure Of All Lights In Light Containment Zone in 5 seconds", false, false); - break; - case ZoneType.HeavyContainment: - Cassie.MessageTranslated("Warning Failure Of All Lights In Heavy Containment Zone in 5 seconds", - "Warning Failure Of All Lights In Heavy Containment Zone in 5 seconds", false, false); - break; - case ZoneType.Entrance: - Cassie.MessageTranslated("Warning Failure Of All Lights In Entrance Zone in 5 seconds", - "Warning Failure Of All Lights In Entrance Zone in 5 seconds", false, false); - break ; - case ZoneType.Surface: - Cassie.MessageTranslated("Warning Failure Of All Lights In Surface in 5 seconds", - "Warning Failure Of All Lights In Surface in 5 seconds", false, false); - break ; - case ZoneType.Unspecified: - Cassie.MessageTranslated("Warning Failure Of All Lights In All Of The Facility in 5 seconds", - "Warning Failure Of All Lights In All Of The Facility in 5 seconds", false, false); - break; - } - } - else - { - switch (zone) - { - case ZoneType.LightContainment: - Cassie.MessageTranslated("Door system malfunction in Light Containment Zone in 5 seconds", - "Door system malfunction in Light containment zone in 5 seconds", false,false); - break; - case ZoneType.HeavyContainment: - Cassie.MessageTranslated("Door system malfunction in Heavy Containment Zone in 5 seconds", - "Door system malfunction in Heavy zone in 5 seconds", false, false); - break; - case ZoneType.Entrance: - Cassie.MessageTranslated("Door system malfunction in Entrance zone in 5 seconds", - "Door system malfunction in Entrance zone in 5 seconds", false, false); - break; - case ZoneType.Surface: - Cassie.MessageTranslated("Door system malfunction in Surface Zone in 5 seconds", - "Door system malfunction in Surface zone in 5 seconds", false, false); - break; - case ZoneType.Unspecified: - Cassie.MessageTranslated("Door system malfunction in All of the facility in 5 seconds", - "Door system malfunction in All of the facility in 5 seconds", false, false); - break; - } - } - } - - /// - /// Select a random zone - /// If the nuke is detonated return only SurfaceZone - /// - /// a zone - private ZoneType SelectZone() - { - ZoneType z = ZoneType.Unspecified; - float random = UnityEngine.Random.value; - if (Warhead.IsDetonated) - { - z= ZoneType.Surface; - } - if (!Map.IsLczDecontaminated) - { - z= GetZoneType(GetProbabilityIndex(MainPlugin.Instance.Config.ChancePreConta, random)); - } - else - { - z= GetZoneType(GetProbabilityIndex(MainPlugin.Instance.Config.ChancePostConta, random)); - } - Log.Debug($"zone={z}"); - return z; - } - - private int GetProbabilityIndex(float[] probabilities, float randomValue) - { - float cumulative = 0f; - - for (int i = 0; i < probabilities.Length; i++) - { - cumulative += probabilities[i]; - if (randomValue <= cumulative) - { - return i; - } - } - - throw new ArgumentException("Random value is outside the range of probabilities."); - } - - private ZoneType GetZoneType(int index) - { - switch (index) - { - case 0: - return ZoneType.LightContainment; - case 1: - return ZoneType.HeavyContainment; - case 2: - return ZoneType.Entrance; - case 3: - return ZoneType.Surface; - default: - case 4: - return ZoneType.Unspecified; - } - } - } -} diff --git a/KruacentExiled/KE.BlackoutNDoor/Config.cs b/KruacentExiled/KE.BlackoutNDoor/Config.cs deleted file mode 100644 index 0deae7a6..00000000 --- a/KruacentExiled/KE.BlackoutNDoor/Config.cs +++ /dev/null @@ -1,29 +0,0 @@ -using Exiled.API.Interfaces; -using System; -using System.Collections.Generic; -using System.ComponentModel; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace KE.BlackoutNDoor -{ - public class Config : IConfig - { - public bool IsEnabled { get; set; } = true; - public bool Debug { get; set; } = false; - - [Description("the minimum interval between 2 malfunctions")] - public int MinInterval { get; set; } = 300; - [Description("the maximum interval between 2 malfunctions")] - public int MaxInterval { get; set; } = 600; - [Description("chance of having a Blackout at the start of the game")] - public double InitialChanceBO { get; set; } = 0.5; - [Description("the duration of a malfunction")] - public int DurationMalfunction { get; set; } = 30; - [Description("chance before decontamination")] - public float[] ChancePreConta = { .2f, .3f, .3f, .15f, .05f }; - [Description("chance after decontamination")] - public float[] ChancePostConta = { 0, .4f, .4f, .15f, .05f }; - } -} diff --git a/KruacentExiled/KE.BlackoutNDoor/Handlers/ServerHandler.cs b/KruacentExiled/KE.BlackoutNDoor/Handlers/ServerHandler.cs deleted file mode 100644 index 5ecdd79b..00000000 --- a/KruacentExiled/KE.BlackoutNDoor/Handlers/ServerHandler.cs +++ /dev/null @@ -1,71 +0,0 @@ -using KE.BlackoutNDoor.API.Features; -using Exiled.API.Features; -using Exiled.Events.EventArgs.Server; -using MEC; -using PluginAPI.Events; -using System.Collections.Generic; - -namespace KE.BlackoutNDoor.Handlers -{ - public class ServerHandler - { - public int Cooldown { get; set; } = -1 ; - internal double ChanceBO { get; set; } = MainPlugin.Instance.Config.InitialChanceBO; - private readonly Controller Controller; - private static CoroutineHandle Handle; - internal ServerHandler(Controller con) - { - Controller = con; - } - internal void OnRoundStarted() - { - Log.Debug($"handle = {Handle}"); - Timing.KillCoroutines(Handle); - Handle = Timing.RunCoroutine(Update()); - - } - - - private IEnumerator Update() - { - yield return Timing.WaitUntilTrue(() => Round.InProgress); - Log.Debug("startUpdate"); - int wait; - if (Cooldown == -1) - wait = UnityEngine.Random.Range(MainPlugin.Instance.Config.MinInterval, MainPlugin.Instance.Config.MaxInterval); - else - wait = Cooldown; - Log.Debug($"waiting for {wait}"); - yield return Timing.WaitForSeconds(wait); - while (Round.InProgress) - { - var a = UnityEngine.Random.value; - Log.Debug("random =" + a); - if (Round.InProgress) - { - if (a <= ChanceBO) - { - Log.Debug("BlackOut"); - - CoroutineHandle coroutine = Timing.RunCoroutine(Controller.RandomBlackout()); - yield return Timing.WaitUntilDone(coroutine); - } - else - { - Log.Debug("DoorStuck"); - CoroutineHandle coroutine = Timing.RunCoroutine(Controller.RandomDoorStuck()); - yield return Timing.WaitUntilDone(coroutine); - } - } - wait = UnityEngine.Random.Range(MainPlugin.Instance.Config.MinInterval, MainPlugin.Instance.Config.MaxInterval); - Log.Debug($"waiting : {wait}"); - yield return Timing.WaitForSeconds(wait); - yield return Timing.WaitUntilFalse(() => Warhead.IsInProgress); - - ChanceBO = -(1 / 60) * Round.ElapsedTime.TotalMinutes + 0.5; - Log.Debug($"new ChanceBO = {ChanceBO}"); - } - } - - } -} diff --git a/KruacentExiled/KE.BlackoutNDoor/KE.BlackoutNDoor.csproj b/KruacentExiled/KE.BlackoutNDoor/KE.BlackoutNDoor.csproj deleted file mode 100644 index 83006a05..00000000 --- a/KruacentExiled/KE.BlackoutNDoor/KE.BlackoutNDoor.csproj +++ /dev/null @@ -1,17 +0,0 @@ - - - - net48 - - - - - - - - - - - - - diff --git a/KruacentExiled/KE.BlackoutNDoor/MainPlugin.cs b/KruacentExiled/KE.BlackoutNDoor/MainPlugin.cs deleted file mode 100644 index 19085cd5..00000000 --- a/KruacentExiled/KE.BlackoutNDoor/MainPlugin.cs +++ /dev/null @@ -1,51 +0,0 @@ -using KE.BlackoutNDoor.API.Features; -using KE.BlackoutNDoor.Handlers; -using Exiled.API.Features; -using System; -using System.ComponentModel; -using Server = Exiled.Events.Handlers.Server; - -namespace KE.BlackoutNDoor -{ - public class MainPlugin : Plugin - { - public override string Author => "Patrique"; - public override Version Version => new Version(1,0,0); - public override string Name => "KE.BlackoutDoor"; - internal static MainPlugin Instance; - private Controller Controller; - public ServerHandler ServerHandler { get; private set; } - - public override void OnEnabled() - { - Instance = this; - Controller = new Controller(); - this.RegisterEvent(); - } - public override void OnDisabled() - { - - Instance = null; - Controller = null; - this.UnregisterEvent(); - } - - private void RegisterEvent() - { - ServerHandler = new ServerHandler(Controller); - Server.RoundStarted += ServerHandler.OnRoundStarted; - - } - private void UnregisterEvent() - { - Server.RoundStarted -= ServerHandler.OnRoundStarted; - - ServerHandler = null; - } - - - - - - } -} diff --git a/KruacentExiled/KE.CustomRoles/MainPlugin.cs b/KruacentExiled/KE.CustomRoles/MainPlugin.cs index 4b5030d8..e0cb7dbc 100644 --- a/KruacentExiled/KE.CustomRoles/MainPlugin.cs +++ b/KruacentExiled/KE.CustomRoles/MainPlugin.cs @@ -10,6 +10,7 @@ using KE.Misc.Features.Spawn; using KE.Utils.API.CustomStats; using KE.Utils.API.Displays.DisplayMeow; +using KE.Utils.API.GifAnimator; using KE.Utils.API.Translations; using MEC; using Microsoft.Win32; @@ -39,7 +40,9 @@ public class MainPlugin : Plugin, Utils.API.Translations.ITranslation internal TranslationFile translation; public TranslationFile Translation => translation; - private Harmony Harmony; + private Harmony Harmony; + + public override void OnEnabled() { @@ -52,6 +55,16 @@ public override void OnEnabled() CustomPlayerStat.AddModule(); CustomStatsEvents.SubscribeEvents(); + + Image img = Image.FromFile(Paths.Configs + "/ome.png"); + TextImage textimg = new TextImage(img, 20); + Log.Debug(textimg.RawString.Length); + + + + DisplayHandler.Instance.AddHint(position.HintPlacement, player, textimg.RawString, 30); + + Harmony = new(Name); Harmony.PatchAll(); SettingHandler.SubscribeEvents(); diff --git a/KruacentExiled/KE.GlobalEventFramework.Examples/Config.cs b/KruacentExiled/KE.GlobalEventFramework.Examples/Config.cs deleted file mode 100644 index 0927af4b..00000000 --- a/KruacentExiled/KE.GlobalEventFramework.Examples/Config.cs +++ /dev/null @@ -1,15 +0,0 @@ -using Exiled.API.Interfaces; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace KE.GlobalEventFramework.Examples -{ - internal class Config : IConfig - { - public bool IsEnabled { get; set; } = true; - public bool Debug { get; set; } = false; - } -} diff --git a/KruacentExiled/KE.GlobalEventFramework.Examples/GE/Blitz.cs b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/Blitz.cs deleted file mode 100644 index 170be1ff..00000000 --- a/KruacentExiled/KE.GlobalEventFramework.Examples/GE/Blitz.cs +++ /dev/null @@ -1,51 +0,0 @@ -using Exiled.API.Features; -using Exiled.API.Features.Items; -using KE.GlobalEventFramework.GEFE.API.Features; -using MEC; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace KE.GlobalEventFramework.Examples.GE -{ - /// - /// Spawn fused grenades in random rooms in the map - /// - public class Blitz : GlobalEvent - { - /// - public override uint Id { get; set; } = 1046; - /// - public override string Name { get; set; } = "Blitz"; - /// - public override string Description { get; set; } = "éteignez les lumières la luftwaffe arrive"; - /// - public override int Weight { get; set; } = 1; - /// - /// The cooldown between 2 spawn of grenades - /// - public int Cooldown { get; set; } = 120; - /// - /// The number of grenades in each spawn - /// - public int NbGrenadeSpawned { get; set; } = 5; - /// - public override IEnumerator Start() - { - while (!Round.IsEnded) - { - Log.Debug("waiting"); - yield return Timing.WaitForSeconds(Cooldown); - for (int i = 0; i < NbGrenadeSpawned; i++) - { - ((ExplosiveGrenade)Item.Create(ItemType.GrenadeHE)).SpawnActive(Room.Random().Position); - } - - - } - } - - } -} diff --git a/KruacentExiled/KE.GlobalEventFramework.Examples/GE/Impostor.cs b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/Impostor.cs deleted file mode 100644 index ef664b90..00000000 --- a/KruacentExiled/KE.GlobalEventFramework.Examples/GE/Impostor.cs +++ /dev/null @@ -1,70 +0,0 @@ -using Player = Exiled.API.Features.Player; -using System.Collections.Generic; -using KE.GlobalEventFramework.GEFE.API.Features; -using MEC; -using System.Linq; -using Exiled.API.Extensions; -using Exiled.API.Features; - -namespace KE.GlobalEventFramework.Examples.GE -{ - public class Impostor : GlobalEvent - { - public override uint Id { get; set; } = 1044; - public override string Name { get; set; } = "Impostor"; - public override string Description { get; set; } = "Ne vous fiez pas aux apparences !"; - public override int Weight { get; set; } = 1; - - public override IEnumerator Start() - { - while (!Round.IsEnded) - { - int randomNumber = UnityEngine.Random.Range(180, 300); - yield return Timing.WaitForSeconds(randomNumber); - ChangingPlayer(); - } - } - - private void ChangingPlayer() - { - // Liste des joueurs vivants - List playerInServer = Player.List.Where(p => !p.IsNPC && p.IsAlive).ToList(); - - if (playerInServer.Count < 2) - { - Log.Warn("Pas assez de joueurs vivants pour effectuer un échange !"); - return; - } - - // Debug : afficher la liste initiale des joueurs avec leurs rôles - Log.Debug("===== Liste des joueurs avant permutation ====="); - - playerInServer.ForEach(p => Log.Debug($"{p.Nickname} ({p.Role})")); - - // Mélanger la liste des joueurs - playerInServer.ShuffleList(); - - // Copier les données actuelles des joueurs - var originalNicknames = playerInServer.Select(p => p.Nickname).ToList(); - var originalRoles = playerInServer.Select(p => p.Role).ToList(); - - // Permutation circulaire des rôles et pseudonymes - for (int i = 0; i < playerInServer.Count; i++) - { - int nextIndex = (i + 1) % playerInServer.Count; - playerInServer[i].ChangeAppearance(originalRoles[nextIndex]); - playerInServer[i].DisplayNickname = originalNicknames[nextIndex]; - } - - // Debug : afficher les correspondances après permutation - Log.Debug("===== Correspondances après permutation ====="); - for (int i = 0; i < playerInServer.Count; i++) - { - int nextIndex = (i + 1) % playerInServer.Count; - Log.Debug($"{originalNicknames[i]} ({originalRoles[i]}) -> {originalNicknames[nextIndex]} ({originalRoles[nextIndex]})"); - } - } - - - } -} \ No newline at end of file diff --git a/KruacentExiled/KE.GlobalEventFramework.Examples/GE/KIWIS.cs b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/KIWIS.cs deleted file mode 100644 index 812dbdd6..00000000 --- a/KruacentExiled/KE.GlobalEventFramework.Examples/GE/KIWIS.cs +++ /dev/null @@ -1,57 +0,0 @@ -using Exiled.API.Features; -using MEC; -using PlayerRoles; -using Utils.NonAllocLINQ; -using System.Collections.Generic; -using System.Linq; -using KE.GlobalEventFramework.GEFE.API.Features; - - -namespace KE.GlobalEventFramework.Examples.GE -{ - /// - /// The scp start with 2/3 of it's life and end with 4/3 of it's vanilla life - /// - public class KIWIS : GlobalEvent - { - /// - public override uint Id { get; set; } = 1047; - /// - public override string Name { get; set; } = "KIWIS"; - /// - public override string Description { get; set; } = "Kill It While It's Small"; - /// - public override int Weight { get; set; } = 1; - /// - public override IEnumerator Start() - { - var listScp = Player.List.ToList().Where(p => p.IsScp && p.Role.Type != RoleTypeId.Scp0492).ToList().ToDictionary(p => p, p => p.MaxHealth/3); - - //set the health of all starting scps to 2/3 of their vanilla max health - listScp.ForEach(k => - { - k.Key.MaxHealth = k.Value * 2; - k.Key.Health = k.Key.MaxHealth; - }); - - yield return Timing.WaitUntilTrue(() => Round.ElapsedTime.TotalMinutes >= 15); - - listScp = listScp.Where(p => p.Key.IsScp && p.Key.Role.Type != RoleTypeId.Scp0492).ToList().ToDictionary(p => p.Key, p => p.Value); - listScp.ForEach(k => { - k.Key.MaxHealth += k.Value; - k.Key.Heal(k.Value); - }); - - yield return Timing.WaitUntilTrue(() => Round.ElapsedTime.TotalMinutes >= 30); - listScp = listScp.Where(p => p.Key.IsScp && p.Key.Role.Type != RoleTypeId.Scp0492).ToList().ToDictionary(p => p.Key, p => p.Value); - listScp.ForEach(k => { - k.Key.MaxHealth += k.Value; - k.Key.Heal(k.Value); - }); - - yield return 0; - - } - - } -} diff --git a/KruacentExiled/KE.GlobalEventFramework.Examples/GE/OpenBar.cs b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/OpenBar.cs deleted file mode 100644 index cfaf4698..00000000 --- a/KruacentExiled/KE.GlobalEventFramework.Examples/GE/OpenBar.cs +++ /dev/null @@ -1,57 +0,0 @@ -using Exiled.API.Features.Doors; -using KE.GlobalEventFramework.GEFE.API.Features; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using Exiled.API.Enums; -using Exiled.API.Features; -using Exiled.Events.EventArgs.Map; - -namespace KE.GlobalEventFramework.Examples.GE -{ - public class OpenBar : GlobalEvent - { - public override uint Id { get; set; } = 1048; - public override string Name { get; set; } = "OpenBar"; - public override string Description { get; set; } = "j'espère que vous avez pas prévu de kampé"; - public override int Weight { get; set; } = 1; - public override uint[] IncompatibleGE { get; set; } = { 1 }; - public override IEnumerator Start() - { - var doors = Door.List.Where(d => new[] { DoorType.GateA, DoorType.GateB, DoorType.HczArmory, DoorType.HIDChamber,DoorType.Intercom,DoorType.Scp049Armory,DoorType.Scp096,DoorType.Scp106Primary,DoorType.Scp106Secondary,DoorType.Scp330,DoorType.Scp330Chamber,DoorType.Scp914Gate }.Contains(d.Type)).ToList(); - UnlockAndOpen(doors); - - yield return 0; - } - - private void UnlockAndOpen(List doors) - { - doors.ForEach(d => - { - d.IsOpen = true; - d.ChangeLock(DoorLockType.Isolation); - }); - } - - public override void SubscribeEvent() - { - Exiled.Events.Handlers.Map.GeneratorActivating += GenActivate; - } - - public override void UnsubscribeEvent() - { - Exiled.Events.Handlers.Map.GeneratorActivating -= GenActivate; - } - - public void GenActivate(GeneratorActivatingEventArgs ev) - { - if (Generator.List.Where(g => g.IsEngaged).Count() == 3) - { - UnlockAndOpen(Door.List.Where(d => new[] { DoorType.Scp079First, DoorType.Scp079Second }.Contains(d.Type)).ToList()); - } - } - - } -} diff --git a/KruacentExiled/KE.GlobalEventFramework.Examples/GE/R.cs b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/R.cs deleted file mode 100644 index ac0ae9bf..00000000 --- a/KruacentExiled/KE.GlobalEventFramework.Examples/GE/R.cs +++ /dev/null @@ -1,26 +0,0 @@ -using KE.GlobalEventFramework.GEFE.API.Features; -using System.Collections.Generic; - -namespace KE.GlobalEventFramework.Examples.GE -{ - /// - /// Literally does nothing - /// - public class R : GlobalEvent - { - /// - public override uint Id { get; set; } = 0; - /// - public override string Name { get; set; } = "nothing"; - /// - public override string Description { get; set; } = "y'a r"; - /// - public override int Weight { get; set; } = 3; - /// - public override IEnumerator Start() - { - yield return 0; - } - - } -} diff --git a/KruacentExiled/KE.GlobalEventFramework.Examples/GE/RandomSpawn.cs b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/RandomSpawn.cs deleted file mode 100644 index bb0882fb..00000000 --- a/KruacentExiled/KE.GlobalEventFramework.Examples/GE/RandomSpawn.cs +++ /dev/null @@ -1,47 +0,0 @@ -using Exiled.API.Features; -using KE.GlobalEventFramework.GEFE.API.Features; -using PlayerRoles; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace KE.GlobalEventFramework.Examples.GE -{ - /// - /// All spawn are random at the start of the game (NTF & Chaos not included) - /// Note: all role spawn with each other except SCPs - /// - public class RandomSpawn : GlobalEvent - { - /// - public override uint Id { get; set; } = 1043; - /// - public override string Name { get; set; } = "RandomSpawn"; - /// - public override string Description { get; set; } = "Les spawns sont random"; - /// - public override int Weight { get; set; } = 1; - /// - public override IEnumerator Start() - { - Room room = Room.Random(); - foreach (RoleTypeId r in Enum.GetValues(typeof(RoleTypeId))) - { - foreach (Player p in Player.List) - { - - if (p.Role == r) - { - p.Teleport(room); - } - - } - room = Room.Random(); - } - yield return 0; - } - - } -} diff --git a/KruacentExiled/KE.GlobalEventFramework.Examples/GE/Shuffle.cs b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/Shuffle.cs deleted file mode 100644 index 936c62c7..00000000 --- a/KruacentExiled/KE.GlobalEventFramework.Examples/GE/Shuffle.cs +++ /dev/null @@ -1,107 +0,0 @@ -using Exiled.API.Features; -using MEC; -using KE.GlobalEventFramework.GEFE.API.Features; -using PlayerHandler = Exiled.Events.Handlers.Player; -using Exiled.Events.EventArgs.Player; -using UnityEngine; -using System.Collections.Generic; -using System.Linq; - - -namespace KE.GlobalEventFramework.Examples.GE -{ - /// - /// Every some amount of time all player take the position of another - /// - public class Shuffle : GlobalEvent - { - /// - public override uint Id { get; set; } = 1045; - /// - public override string Name { get; set; } = "Shuffle"; - /// - public override string Description { get; set; } = "et ça fait roomba café dans le scp"; - /// - public override int Weight { get; set; } = 0; - private List players; - private List pos; - /// - public override IEnumerator Start() - { - this.players = Player.List.ToList().Where(p => !p.IsNPC).ToList(); - this.players.ShuffleList(); - pos = new List(players.Count); - for (int i = 0; i < players.Count; i++) - { - pos.Add(Vector3.zero); - } - Log.Debug($"before while"); - while (!Round.IsEnded) - { - - Log.Debug($"waiting for {GetType().Name}"); - yield return Timing.WaitForSeconds(UnityEngine.Random.Range(300, 900)); - for (int i = 0; i < this.players.Count; i++) - { - Log.Debug($"old position of player {this.players[i]} : {this.players[i].Position}"); - var player = this.players[i]; - pos[i] = player.Position; - Log.Debug("------"); - } - - ShiftLeft(this.players); - Log.Debug("shifted players"); - for (int i = 0; i < this.players.Count; i++) - { - Log.Debug("before tp"); - this.players[i].Teleport(pos[i]); - Log.Debug($"new position of player {this.players[i]} : {this.players[i].Position}"); - } - Log.Debug($"tp player"); - for (int i = 0; i < players.Count; i++) - { - pos.Add(Vector3.zero); - } - Log.Debug($"cleared"); - } - } - /// - public override void SubscribeEvent() - { - PlayerHandler.Joined += OnJoined; - } - /// - public override void UnsubscribeEvent() - { - PlayerHandler.Joined -= OnJoined; - } - - private void OnJoined(JoinedEventArgs ev) - { - if (!ev.Player.IsNPC) - { - this.players.Add(ev.Player); - this.pos.Add(ev.Player.Position); - } - } - /// - /// Shift a List to the left - /// - /// the type of the List - /// the List to shift - private void ShiftLeft(List lst) - { - if (lst.Count > 0) - { - T firstElement = lst[0]; - for (int i = 1; i < lst.Count; i++) - { - lst[i - 1] = lst[i]; - } - lst[lst.Count - 1] = firstElement; - } - } - - - } -} diff --git a/KruacentExiled/KE.GlobalEventFramework.Examples/GE/Speed.cs b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/Speed.cs deleted file mode 100644 index bf8c0f17..00000000 --- a/KruacentExiled/KE.GlobalEventFramework.Examples/GE/Speed.cs +++ /dev/null @@ -1,72 +0,0 @@ -using CustomPlayerEffects; -using Exiled.API.Enums; -using Exiled.API.Features; -using Exiled.Events.EventArgs.Player; -using Exiled.Events.EventArgs.Scp173; -using KE.GlobalEventFramework.GEFE.API.Features; -using MEC; -using System; -using System.Collections.Generic; -using System.ComponentModel; -using System.Linq; -using Utils.NonAllocLINQ; -using PlayerHandler = Exiled.Events.Handlers.Player; - -namespace KE.GlobalEventFramework.Examples.GE -{ - /// - /// Everyone has a movement boost effect (stackable) - /// Maybe inspired by Dr Bright's Mayhem - /// - public class Speed : GlobalEvent - { - /// - public override uint Id { get; set; } = 1042; - /// - public override string Name { get; set; } = "Speed"; - /// - public override string Description { get; set; } = "Gas! gas! gas!"; - /// - public override int Weight { get; set; } = 1; - /// - /// intensity of the movement boost effect - /// - public byte MovementBoost { get; set; } = 100; - /// - public override IEnumerator Start() - { - yield return Timing.WaitForSeconds(1); - Player.List.ToList().ForEach(p => p.EnableEffect(MovementBoost,999999999, true)); - - } - /// - public override void SubscribeEvent() - { - PlayerHandler.ChangingRole += ReactivateEffectSpawn; - Exiled.Events.Handlers.Scp173.Blinking += SpeedyNut; - } - /// - public override void UnsubscribeEvent() - { - PlayerHandler.ChangingRole -= ReactivateEffectSpawn; - Exiled.Events.Handlers.Scp173.Blinking -= SpeedyNut; - Player.List.ToList().ForEach(p => p.DisableEffect()); - } - /// - /// Decrease the blink cooldown of SCP-173 - /// - private void SpeedyNut(BlinkingEventArgs ev) - { - ev.BlinkCooldown = ev.BlinkCooldown/2; - } - - /// - /// Reactivate the effect at each role changement - /// - private void ReactivateEffectSpawn(ChangingRoleEventArgs ev) - { - Timing.CallDelayed(1f, () => ev.Player.EnableEffect(MovementBoost, 999999999, true)); - - } - } -} diff --git a/KruacentExiled/KE.GlobalEventFramework.Examples/GE/SystemMalfunction.cs b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/SystemMalfunction.cs deleted file mode 100644 index 9278b850..00000000 --- a/KruacentExiled/KE.GlobalEventFramework.Examples/GE/SystemMalfunction.cs +++ /dev/null @@ -1,118 +0,0 @@ -using Exiled.API.Features; -using Exiled.API.Features.Doors; -using KE.GlobalEventFramework.GEFE.API.Features; -using KE.GlobalEventFramework.GEFE.API.Utils; -using MEC; -using System.Collections.Generic; -using System.Linq; -using Interactables.Interobjects.DoorUtils; -using Exiled.API.Enums; -using Exiled.API.Extensions; - -namespace KE.GlobalEventFramework.Examples.GE -{ - /// - /// The original - /// - /// The nuke can go off random from 15 to 30 min in the round (can be disable like a normal nuke) - /// If BlackoutNDoor is enabled in the server, increase the frequence of blackouts and door lockdowns - /// Can lock Elevator and Gate for an amount of time - /// Checkpoints can open randomly - /// - /// - public class SystemMalfunction : GlobalEvent - { - /// - public override uint Id { get; set; } = 1041; - /// - public override string Name { get; set; } = "System Malfunction"; - /// - public override string Description { get; set; } = "On dirait que les systèmes informatiques sont défaillants"; - /// - public override int Weight { get; set; } = 1; - /// - /// Set the cooldown for the BlackoutNDoor - /// - public int NewCooldown { get; set; } = 180; - - public override uint[] IncompatibleGE { get; set; } = { 38 }; - /// - public override IEnumerator Start() - { - MoreBlackOutNDoors(); - Coroutine.LaunchCoroutine(EarlyNuke()); - - CoroutineHandle handle; - while(Round.InProgress){ - //todo change so it happen more frequently - Timing.WaitForSeconds((float)Round.ElapsedTime.TotalSeconds); - List> l = new []{CheckpointMalfunction(),GateLockdown(),ElevatorLockdown()}.ToList(); - handle = Coroutine.LaunchCoroutine(l[UnityEngine.Random.Range(0,3)]); - yield return Timing.WaitUntilDone(handle); - - } - - - } - public override void UnsubscribeEvent() - { - var otherPlugin = Exiled.Loader.Loader.Plugins.FirstOrDefault(plugin => plugin.Name == "KE.BlackoutDoor"); - if (otherPlugin != null) - { - - if (otherPlugin is BlackoutNDoor.MainPlugin blackout) - { - blackout.ServerHandler.Cooldown = -1; - } - - } - } - - private IEnumerator EarlyNuke() - { - int timeNuke = UnityEngine.Random.Range(15, 30); - Log.Debug($"the nuke will detonate in {timeNuke}min"); - yield return Timing.WaitUntilTrue(() => timeNuke == Round.ElapsedTime.TotalMinutes); - Warhead.Start(); - Log.Debug($"kaboom"); - } - - private void MoreBlackOutNDoors() - { - var otherPlugin = Exiled.Loader.Loader.Plugins.FirstOrDefault(plugin => plugin.Name == "KE.BlackoutDoor"); - if (otherPlugin != null) - { - - if (otherPlugin is BlackoutNDoor.MainPlugin blackout) - { - Log.Info("Found BlackOutNDoors"); - blackout.ServerHandler.Cooldown = NewCooldown; - } - - } - } - - private IEnumerator CheckpointMalfunction(){ - yield return Timing.WaitForSeconds(UnityEngine.Random.Range(20,60)); - var checkpoints = Door.List.Where(d => d.IsCheckpoint).ToList().RandomItem().IsOpen =true; - - } - - private IEnumerator GateLockdown(){ - var gates = Door.List.Where(d => d.Type == DoorType.GateA ||d.Type == DoorType.GateB); - var gate = gates.GetRandomValue(); - gate.IsOpen = false; - var timelock = UnityEngine.Random.Range(10,30); - gate.Lock(timelock,DoorLockType.Isolation); - yield return Timing.WaitForSeconds(timelock); - } - - private IEnumerator ElevatorLockdown(){ - var lift = Lift.Random; - lift.ChangeLock(DoorLockReason.Isolation); - yield return Timing.WaitForSeconds(UnityEngine.Random.Range(10,20)); - lift.ChangeLock(DoorLockReason.None); - } - - } -} \ No newline at end of file diff --git a/KruacentExiled/KE.GlobalEventFramework.Examples/KE.GlobalEventFramework.Examples.csproj b/KruacentExiled/KE.GlobalEventFramework.Examples/KE.GlobalEventFramework.Examples.csproj deleted file mode 100644 index 4fe9a10f..00000000 --- a/KruacentExiled/KE.GlobalEventFramework.Examples/KE.GlobalEventFramework.Examples.csproj +++ /dev/null @@ -1,17 +0,0 @@ - - - - net48 - - - - - - - - - - - - - diff --git a/KruacentExiled/KE.GlobalEventFramework.Examples/MainPlugin.cs b/KruacentExiled/KE.GlobalEventFramework.Examples/MainPlugin.cs deleted file mode 100644 index 4ddeef62..00000000 --- a/KruacentExiled/KE.GlobalEventFramework.Examples/MainPlugin.cs +++ /dev/null @@ -1,26 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using Exiled.API.Features; - -namespace KE.GlobalEventFramework.Examples -{ - internal class MainPlugin : Plugin - { - public override string Author => "Patrique & OmerGS"; - - public override Version Version => new Version(1, 0, 0); - public override string Name => "KE.GEF.Examples"; - public override void OnEnabled() - { - - } - - public override void OnDisabled() - { - - } - } -} diff --git a/KruacentExiled/KE.GlobalEventFramework/Config.cs b/KruacentExiled/KE.GlobalEventFramework/Config.cs deleted file mode 100644 index 69f7116a..00000000 --- a/KruacentExiled/KE.GlobalEventFramework/Config.cs +++ /dev/null @@ -1,21 +0,0 @@ -using Exiled.API.Interfaces; -using Exiled.Events.Commands.PluginManager; -using System; -using System.Collections.Generic; -using System.ComponentModel; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace KE.GlobalEventFramework -{ - internal class Config : IConfig - { - - public bool IsEnabled { get; set; } = true; - public bool Debug { get; set; } = true; - [Description("Show the log when the plugin is registering global event (require Debug to be true)")] - public bool ShowRegisteringLog { get; set; } = false; - - } -} diff --git a/KruacentExiled/KE.GlobalEventFramework/GEFE/API/Features/GlobalEvent.cs b/KruacentExiled/KE.GlobalEventFramework/GEFE/API/Features/GlobalEvent.cs deleted file mode 100644 index 22e2cf4c..00000000 --- a/KruacentExiled/KE.GlobalEventFramework/GEFE/API/Features/GlobalEvent.cs +++ /dev/null @@ -1,206 +0,0 @@ -using Exiled.API.Features; -using System.Collections.Generic; -using System.Linq; -using MEC; -using KE.GlobalEventFramework.GEFE.API.Interfaces; -using System; - -namespace KE.GlobalEventFramework.GEFE.API.Features -{ - public abstract class GlobalEvent : IGlobalEvent - { - /// - /// A list of Active GlobalEvents - /// - public static List ActiveGlobalEvents => ActiveGE.ToList(); - internal static List ActiveGE { get; set; } = new List(); - internal static List coroutineHandles = new List(); - internal static Dictionary GlobalEvents { get; private set; } = new Dictionary(); - /// - /// A list of all registered GlobalEvents - /// - public static List GlobalEventsList => GlobalEvents.Values.ToList(); - /// - public abstract uint Id { get; set; } - /// - public abstract string Name { get; set; } - /// - public abstract string Description { get; set; } - /// - public abstract int Weight { get; set; } - /// - public virtual uint[] IncompatibleGE { get; set; } = new uint[0]; - - - - /// - public virtual IEnumerator Start() - { - if (MainPlugin.Instance.Config.Debug) Log.Error($"{GetType().Name} Start is NOT overrided"); - yield return 0; - } - /// - public virtual void SubscribeEvent() - { - if (MainPlugin.Instance.Config.Debug) Log.Warn($"{GetType().Name} : SubscribeEvent is NOT overrided"); - } - /// - public virtual void UnsubscribeEvent() - { - if (MainPlugin.Instance.Config.Debug) Log.Warn($"{GetType().Name} : UnsubscribeEvent is NOT overrided"); - } - public static void Register(IGlobalEvent globalEvent) - { - Log.Send($"REGISTERING {globalEvent.Name}", Discord.LogLevel.Info, ConsoleColor.Blue); - if (GlobalEvents.ContainsKey(globalEvent.Id)) - { - Log.Error($"{globalEvent.Name}'s id is already registered by {Get(globalEvent.Id)}"); - return; - } - GlobalEvents.Add(globalEvent.Id, globalEvent); - Log.Info($"{globalEvent.Name} is registered"); - } - - public static void Register(List globalEvents) - { - globalEvents.ForEach(globalEvent => Register(globalEvent)); - } - - /// - /// Stop all Coroutine from GE - /// - internal static void StopCoroutines() - { - coroutineHandles.ForEach(coroutineHandle => - { - Timing.KillCoroutines(coroutineHandle); - }); - } - - public static bool TryGet(uint id, out IGlobalEvent globalEvent) - { - globalEvent = Get(id); - return globalEvent != null; - } - - public static bool TryGet(string name, out IGlobalEvent globalEvent) - { - if (string.IsNullOrEmpty(name)) - { - throw new System.Exception("name can't be null or empty"); - } - globalEvent = uint.TryParse(name, out uint id) ? Get(id) : Get(name); - - return globalEvent != null; - } - - public static IGlobalEvent Get(string name) - { - return GlobalEvents.Values.FirstOrDefault(ge => ge.Name == name); - } - - public static IGlobalEvent Get(uint id) - { - return GlobalEvents.TryGetValue(id, out IGlobalEvent globalEvent) ? globalEvent : null; - } - - private static void Show() - { - var random = UnityEngine.Random.value; - - foreach (Player player in Player.List) - { - Exiled.API.Features.Broadcast b = new Exiled.API.Features.Broadcast - { - Content = ShowText(random > .5f), - Duration = 10 - }; - player.Broadcast(b); - } - } - - private static String ShowText(bool redacted = false) - { - String result = "Global Events: "; - Log.Info($"Global Event(s) ({ActiveGE.Count()}): "); - for (int i = 0; i < ActiveGE.Count(); i++) - { - Log.Info(ActiveGE[i].Name); - if (redacted) - { - result += ActiveGE[i].Description; - } - else - { - result += "[REDACTED]"; - } - - if (ActiveGE.Count() > 1 && i < ActiveGE.Count() - 1) - { - result += ", "; - } - } - - - return result; - } - - public static List ChooseGE(int numberOfGlobalEvent = 1) - { - List activeGE = ChooseRandomGE(numberOfGlobalEvent); - Log.Debug($"activeGE size : {activeGE.Count}"); - - return activeGE; - } - - internal static void ActivateAll() - { - ActivateAll(ActiveGE); - } - - private static void ActivateAll(List globalEvent) - { - if(globalEvent.Count != globalEvent.Distinct().Count()) throw new ArgumentException("You can't have the same GE twice in the same round"); - ActiveGE = globalEvent; - globalEvent.ForEach(e => e.SubscribeEvent()); - - foreach (IGlobalEvent ge in ActiveGE) - { - - CoroutineHandle a = Timing.RunCoroutine(ge.Start()); - coroutineHandles.Add(a); - } - Show(); - } - - private static List ChooseRandomGE(int nbGE = 1) - { - List result = new List(); - - List weightedPool = new List(); - foreach (IGlobalEvent ge in GlobalEvent.GlobalEventsList) - { - for (int i = 0; i < ge.Weight; i++) - { - weightedPool.Add(ge); - Log.Debug($"getochoose : {ge.Name} "); - } - } - - nbGE = Math.Min(nbGE, GlobalEvent.GlobalEventsList.Count); - - for (int i = 0; i < nbGE; i++) - { - int randomIndex = UnityEngine.Random.Range(0, weightedPool.Count); - IGlobalEvent selectedGE = weightedPool[randomIndex]; - - result.Add(selectedGE); - - weightedPool.RemoveAll(e => e == selectedGE); - weightedPool.RemoveAll(e => selectedGE.IncompatibleGE.Contains(e.Id)); - } - - return result; - } - } -} diff --git a/KruacentExiled/KE.GlobalEventFramework/GEFE/API/Features/Loader.cs b/KruacentExiled/KE.GlobalEventFramework/GEFE/API/Features/Loader.cs deleted file mode 100644 index 191b21c5..00000000 --- a/KruacentExiled/KE.GlobalEventFramework/GEFE/API/Features/Loader.cs +++ /dev/null @@ -1,42 +0,0 @@ -using Exiled.API.Features; -using Exiled.API.Interfaces; -using KE.GlobalEventFramework.GEFE.API.Interfaces; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace KE.GlobalEventFramework.GEFE.API.Features -{ - internal class Loader - { - internal List> ActivePlugins => new List>(); - internal static Loader Instance { get; private set; } = new Loader(); - - private Loader() { } - internal void Load() - { - foreach (IPlugin plugin in Exiled.Loader.Loader.Plugins.Where(pl => pl.Name != MainPlugin.Instance.Name)) - { - if(MainPlugin.Instance.Config.ShowRegisteringLog) Log.Debug($"checking {plugin.Name}"); - foreach (Type type in plugin.Assembly.GetTypes()) - { - try - { - if (MainPlugin.Instance.Config.ShowRegisteringLog) Log.Debug($" checking {type.Name}"); - if (type.IsSubclassOf(typeof(IGlobalEvent)) || type.IsSubclassOf(typeof(GlobalEvent))) - { - ActivePlugins.Add(plugin); - IGlobalEvent ge = Activator.CreateInstance(type) as IGlobalEvent; - GlobalEvent.Register(ge); - } - }catch(System.Exception e) - { - Log.Error($"Error registering in plugin {plugin.Name} : {e.Message}"); - } - } - } - } - } -} diff --git a/KruacentExiled/KE.GlobalEventFramework/GEFE/API/Interfaces/IGlobalEvent.cs b/KruacentExiled/KE.GlobalEventFramework/GEFE/API/Interfaces/IGlobalEvent.cs deleted file mode 100644 index 63e623b3..00000000 --- a/KruacentExiled/KE.GlobalEventFramework/GEFE/API/Interfaces/IGlobalEvent.cs +++ /dev/null @@ -1,49 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using MEC; - -namespace KE.GlobalEventFramework.GEFE.API.Interfaces -{ - public interface IGlobalEvent - { - /// - /// the UNIQUE id of the Global Event - /// - uint Id { get; set; } - /// - /// Name used in the logs on the RA - /// - string Name { get; set; } - - /// - /// The description that will be shown to the player when the round start - /// - string Description { get; set; } - - /// - /// The chance this GE will be choosed at the start of a round - /// - int Weight { get; set; } - /// - /// The ids of incompatible Globals Events - /// Note: You can't have the same GE twice in the same round - /// - uint[] IncompatibleGE { get; set; } - - /// - /// Is launched at the start of a round - /// - IEnumerator Start(); - /// - /// The method used to subcribe to event like with normal plugins - /// - void SubscribeEvent(); - /// - /// The method used to unsubcribe to event like with normal plugins - /// - void UnsubscribeEvent(); - } -} diff --git a/KruacentExiled/KE.GlobalEventFramework/GEFE/API/Utils/Coroutine.cs b/KruacentExiled/KE.GlobalEventFramework/GEFE/API/Utils/Coroutine.cs deleted file mode 100644 index 2cec07d0..00000000 --- a/KruacentExiled/KE.GlobalEventFramework/GEFE/API/Utils/Coroutine.cs +++ /dev/null @@ -1,19 +0,0 @@ -using MEC; -using System.Collections.Generic; - -namespace KE.GlobalEventFramework.GEFE.API.Utils -{ - public static class Coroutine - { - public static readonly List _coroutine = new List(); - - //CoroutineHandle coroutine - public static CoroutineHandle LaunchCoroutine(IEnumerator coroutine) - { - CoroutineHandle a = Timing.RunCoroutine(coroutine); - - _coroutine.Add(a); - return a; - } - } -} diff --git a/KruacentExiled/KE.GlobalEventFramework/GEFE/Commands/ForceGE.cs b/KruacentExiled/KE.GlobalEventFramework/GEFE/Commands/ForceGE.cs deleted file mode 100644 index 80c701eb..00000000 --- a/KruacentExiled/KE.GlobalEventFramework/GEFE/Commands/ForceGE.cs +++ /dev/null @@ -1,65 +0,0 @@ -namespace KE.GlobalEventFramework.GEFE.Commands -{ - using Exiled.API.Features; - using Exiled.API.Features.Pickups; - using System; - using CommandSystem; - using System.Runtime.InteropServices.WindowsRuntime; - using GEFE.API.Interfaces; - using GEFE.API.Features; - using System.Collections.Generic; - using System.Linq; - - public class ForceGE : ICommand - { - public string Command { get; } = "force"; - public string[] Aliases { get; } = new string[] { "f" }; - public string Description { get; } = "force a or multiple global event"; - internal static List ForcedGE = new List(); - - public bool Execute(ArraySegment arguments, ICommandSender sender, out string response) - { - if (!Round.IsLobby) - { - response = "You can only force a global event in the lobby"; - ForcedGE = new List(); - return false; - } - - if (!GlobalEvent.TryGet(arguments.At(0), out IGlobalEvent ge1) || ge1 == null) - { - response = $"Global event ({arguments.At(0)}) not found "; - ForcedGE = new IGlobalEvent[] { ge1 }.ToList(); - return false; - } - - - - if (arguments.Count == 1) - { - response = $"Forcing {ge1.Name}"; - ForcedGE = new IGlobalEvent[] { ge1 }.ToList(); - return true; - } - - if (!GlobalEvent.TryGet(arguments.At(1), out IGlobalEvent ge2) || ge2 == null) - { - response = $"Global event ({arguments.At(1)}) not found "; - ForcedGE = new List(); - return false; - } - - if (arguments.Count == 2) - { - response = $"Forcing {ge1.Name} & {ge2.Name}"; - ForcedGE = new IGlobalEvent[] { ge1, ge2 }.ToList(); - return true; - } - - ForcedGE = new List(); - response = ""; - return false; - - } - } -} diff --git a/KruacentExiled/KE.GlobalEventFramework/GEFE/Commands/ForceNbGE.cs b/KruacentExiled/KE.GlobalEventFramework/GEFE/Commands/ForceNbGE.cs deleted file mode 100644 index e5e5fe94..00000000 --- a/KruacentExiled/KE.GlobalEventFramework/GEFE/Commands/ForceNbGE.cs +++ /dev/null @@ -1,61 +0,0 @@ -namespace KE.GlobalEventFramework.GEFE.Commands -{ - using Exiled.API.Features; - using Exiled.API.Features.Pickups; - using System; - using CommandSystem; - using System.Runtime.InteropServices.WindowsRuntime; - using GEFE.API.Interfaces; - using GEFE.API.Features; - using System.Collections.Generic; - using System.Linq; - - public class ForceNbGE : ICommand - { - public string Command { get; } = "forceNb"; - public string[] Aliases { get; } = new string[] { "nb","n" }; - public string Description { get; } = "force a specified number global event"; - internal static int NbGE = -1; - - public bool Execute(ArraySegment arguments, ICommandSender sender, out string response) - { - if (!Round.IsLobby) - { - response = "You can only force a global event in the lobby"; - NbGE = -1; - return false; - } - - - - if (arguments.Count == 1) - { - if (int.TryParse(arguments.At(0), out int nbge) && nbge > -1) - { - if(nbge <= 0) - { - response = "You can't force 0 global event"; - NbGE = -1; - return false; - } - if(nbge > GlobalEvent.GlobalEventsList.Count) - { - response = $"You can't force {nbge} global event, there are only {GlobalEvent.GlobalEventsList.Count} global events"; - NbGE = -1; - return false; - } - - - response = $"Forcing {nbge} global event"; - NbGE = nbge; - return true; - } - } - - NbGE = -1; - response = "Too much argument"; - return false; - - } - } -} diff --git a/KruacentExiled/KE.GlobalEventFramework/GEFE/Commands/ListGE.cs b/KruacentExiled/KE.GlobalEventFramework/GEFE/Commands/ListGE.cs deleted file mode 100644 index 0119db18..00000000 --- a/KruacentExiled/KE.GlobalEventFramework/GEFE/Commands/ListGE.cs +++ /dev/null @@ -1,37 +0,0 @@ -namespace KE.GlobalEventFramework.GEFE.Commands -{ - using Exiled.API.Features; - using Exiled.API.Features.Pickups; - using System; - using CommandSystem; - using System.Runtime.InteropServices.WindowsRuntime; - using GEFE.API.Interfaces; - using GEFE.API.Features; - - public class ListGE : ICommand - { - public string Command { get; } = "list"; - public string[] Aliases { get; } = new string[] { "l", "ls" }; - public string Description { get; } = "get the list of all Global Events"; - - public bool Execute(ArraySegment arguments, ICommandSender sender, out string response) - { - string result = "List of all global event ([o] if it's active in the round ; [ ] otherwise) : \n"; - foreach (IGlobalEvent ge in GlobalEvent.GlobalEvents.Values) - { - - if (GlobalEvent.ActiveGlobalEvents.Contains(ge)) - { - result += "[o]"; - } - else - { - result += "[ ]"; - } - result += $" {ge.Id} : {ge.Name} : {ge.Description}\n"; - } - response = result; - return true; - } - } -} diff --git a/KruacentExiled/KE.GlobalEventFramework/GEFE/Commands/ParentCommandGEFE.cs b/KruacentExiled/KE.GlobalEventFramework/GEFE/Commands/ParentCommandGEFE.cs deleted file mode 100644 index 1134260a..00000000 --- a/KruacentExiled/KE.GlobalEventFramework/GEFE/Commands/ParentCommandGEFE.cs +++ /dev/null @@ -1,38 +0,0 @@ - -namespace KE.GlobalEventFramework.GEFE.Commands -{ - using CommandSystem; - using System; - - [CommandHandler(typeof(RemoteAdminCommandHandler))] - public class ParentCommandGEFE : ParentCommand - { - public ParentCommandGEFE() - { - LoadGeneratedCommands(); - } - public override string Command { get; } = "globalevent"; - public override string Description { get; } = "the parent command to check the Global Events"; - public override string[] Aliases { get; } = { "ge" }; - - public override void LoadGeneratedCommands() - { - RegisterCommand(new ListGE()); - RegisterCommand(new ForceGE()); - RegisterCommand(new ForceNbGE()); - } - - protected override bool ExecuteParent(ArraySegment arguments, ICommandSender sender, out string response) - { - if(arguments.Count == 0){ - response = "subcommand available : list, force, nb"; - return true; - } - response = ""; - return true; - } - - - } - -} \ No newline at end of file diff --git a/KruacentExiled/KE.GlobalEventFramework/GEFE/Exception/GlobalEventNullException.cs b/KruacentExiled/KE.GlobalEventFramework/GEFE/Exception/GlobalEventNullException.cs deleted file mode 100644 index 1034cd03..00000000 --- a/KruacentExiled/KE.GlobalEventFramework/GEFE/Exception/GlobalEventNullException.cs +++ /dev/null @@ -1,16 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -namespace KE.GlobalEventFramework.GEFE.Exception -{ - public class GlobalEventNullException : ArgumentException - { - public GlobalEventNullException(string message) : base(message) - { - - } - - } -} diff --git a/KruacentExiled/KE.GlobalEventFramework/GEFE/Handlers/ServerHandler.cs b/KruacentExiled/KE.GlobalEventFramework/GEFE/Handlers/ServerHandler.cs deleted file mode 100644 index 67504ee2..00000000 --- a/KruacentExiled/KE.GlobalEventFramework/GEFE/Handlers/ServerHandler.cs +++ /dev/null @@ -1,70 +0,0 @@ -using Exiled.API.Features; -using Exiled.Events.EventArgs.Server; -using System.Collections.Generic; -using KE.GlobalEventFramework.GEFE.API.Interfaces; -using KE.GlobalEventFramework.GEFE.API.Features; -using KE.GlobalEventFramework.GEFE.Commands; - -namespace KE.GlobalEventFramework.GEFE.Handlers -{ - internal class ServerHandler - { - public void OnRoundStarted() - { - Log.Debug("starting round"); - HandleCommands(); - - - - } - - private void HandleCommands() - { - //force ge - if (ForceGE.ForcedGE.Count > 0) - { - Log.Debug("forcing ge"); - GlobalEvent.ActiveGE = ForceGE.ForcedGE; - ForceGE.ForcedGE = new List(); - } - else - { - int nbGE; - - //choose nb of ge - if (ForceNbGE.NbGE > -1) - { - nbGE = ForceNbGE.NbGE; - Log.Debug($"forcing nb ge = {nbGE}"); - ForceNbGE.NbGE = -1; - } - //normal case - else - { - Log.Debug($"no commands"); - nbGE = UnityEngine.Random.value < .1f ? 2 : 1; - } - GlobalEvent.ActiveGE = GlobalEvent.ChooseGE(nbGE); - } - - GlobalEvent.ActivateAll(); - } - - public void OnWaitingForPlayers() - { - GlobalEvent.StopCoroutines(); - } - - public void OnEndingRound(RoundEndedEventArgs _) - { - Log.Debug("ending round"); - GlobalEvent.ActiveGE.ForEach(e => e.UnsubscribeEvent()); - } - public void OnRestartingRound() - { - Log.Debug("restarting"); - GlobalEvent.ActiveGE.ForEach(e => e.UnsubscribeEvent()); - } - - } -} diff --git a/KruacentExiled/KE.GlobalEventFramework/KE.GlobalEventFramework.csproj b/KruacentExiled/KE.GlobalEventFramework/KE.GlobalEventFramework.csproj deleted file mode 100644 index 8031db85..00000000 --- a/KruacentExiled/KE.GlobalEventFramework/KE.GlobalEventFramework.csproj +++ /dev/null @@ -1,17 +0,0 @@ - - - - net48 - - - - - - - - - - - - - diff --git a/KruacentExiled/KE.GlobalEventFramework/MainPlugin.cs b/KruacentExiled/KE.GlobalEventFramework/MainPlugin.cs deleted file mode 100644 index 2e0f96f4..00000000 --- a/KruacentExiled/KE.GlobalEventFramework/MainPlugin.cs +++ /dev/null @@ -1,72 +0,0 @@ -using Exiled.API.Features; -using System; -using System.Collections.Generic; -using System.Linq; -using MEC; -using Exiled.API.Enums; -using Player = Exiled.API.Features.Player; -using KE.GlobalEventFramework.GEFE.API.Features; -using KE.GlobalEventFramework.GEFE.API.Interfaces; -using ServerHandler = Exiled.Events.Handlers.Server; -using Discord; -namespace KE.GlobalEventFramework -{ - internal class MainPlugin : Plugin - { - public override string Author => "Patrique"; - public override string Name => "KE.GEFramework"; - public override Version Version => new Version(1, 0, 0); - public override PluginPriority Priority => PluginPriority.Highest; - - internal GEFE.Handlers.ServerHandler _server; - - internal static MainPlugin Instance {get;private set;} - - public override void OnEnabled() - { - - Instance = this; - Loader.Instance.Load(); - - - - RegisterEvents(); - - base.OnEnabled(); - } - - public override void OnDisabled() - { - UnregisterEvents(); - Timing.KillCoroutines(); - base.OnDisabled(); - Instance = null; - } - - private void RegisterEvents() - { - _server = new GEFE.Handlers.ServerHandler(); - - - ServerHandler.WaitingForPlayers += _server.OnWaitingForPlayers; - ServerHandler.RoundStarted += _server.OnRoundStarted; - ServerHandler.RoundEnded += _server.OnEndingRound; - ServerHandler.RestartingRound += _server.OnRestartingRound; - - } - - private void UnregisterEvents() - { - ServerHandler.WaitingForPlayers -= _server.OnWaitingForPlayers; - ServerHandler.RoundStarted -= _server.OnRoundStarted; - ServerHandler.RoundEnded -= _server.OnEndingRound; - ServerHandler.RestartingRound -= _server.OnRestartingRound; - - _server = null; - } - - - - - } -} diff --git a/KruacentExiled/KE.Items/Config.cs b/KruacentExiled/KE.Items/Config.cs deleted file mode 100644 index daaf9357..00000000 --- a/KruacentExiled/KE.Items/Config.cs +++ /dev/null @@ -1,15 +0,0 @@ -using Exiled.API.Interfaces; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace KE.Items -{ - public class Config : IConfig - { - public bool IsEnabled { get; set; } = true; - public bool Debug { get; set; } = false; - } -} diff --git a/KruacentExiled/KE.Items/Interface/ILumosItem.cs b/KruacentExiled/KE.Items/Interface/ILumosItem.cs deleted file mode 100644 index d2116101..00000000 --- a/KruacentExiled/KE.Items/Interface/ILumosItem.cs +++ /dev/null @@ -1,14 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace KE.Items.Interface -{ - internal interface ILumosItem - { - - UnityEngine.Color Color { get; set; } - } -} diff --git a/KruacentExiled/KE.Items/Items/AdrenalineDrogue.cs b/KruacentExiled/KE.Items/Items/AdrenalineDrogue.cs deleted file mode 100644 index f463761d..00000000 --- a/KruacentExiled/KE.Items/Items/AdrenalineDrogue.cs +++ /dev/null @@ -1,214 +0,0 @@ -using System.Collections.Generic; -using Exiled.API.Enums; -using Exiled.API.Features.Attributes; -using Exiled.API.Features.Spawn; -using Exiled.CustomItems.API.Features; -using MEC; -using Exiled.Events.EventArgs.Player; -using Player = Exiled.Events.Handlers.Player; -using Exiled.API.Features; -using Exiled.API.Extensions; -using UnityEngine; -using CustomPlayerEffects; - -/// -[CustomItem(ItemType.Adrenaline)] -public class AdrenalineDrogue : CustomItem -{ - /// - public override uint Id { get; set; } = 1402; - - /// - public override string Name { get; set; } = "DA-020"; - - /// - public override string Description { get; set; } = "La bonne drogue là, si vous le prenez vous êtes ienb pendant 20 secondes puis vous vous sentez pas bien !"; - - /// - public override float Weight { get; set; } = 0.65f; - - public List joueursSCP = new List(); - - /// - public override SpawnProperties SpawnProperties { get; set; } = new SpawnProperties() - { - Limit = 1, - DynamicSpawnPoints = new List - { - new DynamicSpawnPoint() - { - Chance = 100, - Location = SpawnLocationType.Inside079Secondary, - }, - new DynamicSpawnPoint() - { - Chance = 2, - Location = SpawnLocationType.Inside173Gate, - }, - }, - }; - - /// - protected override void SubscribeEvents() - { - Player.UsedItem += OnUsingItem; - base.SubscribeEvents(); - } - - /// - protected override void UnsubscribeEvents() - { - Player.UsedItem -= OnUsingItem; - base.UnsubscribeEvents(); - } - - private void OnUsingItem(UsedItemEventArgs ev) - { - if (TryGet(ev.Item, out var result)) - { - if (result.Id == 19) - { - Timing.CallDelayed(0.5f, () => - { - Timing.RunCoroutine(EffectAttribution(ev.Player)); - }); - } - - } - } - - private IEnumerator EffectAttribution(Exiled.API.Features.Player joueur) - { - /* EFFET DE LA DROGUE */ - joueur.ShowHint("Vous êtes actuellement sous effet de la cocaïne liquide !"); - joueur.EnableEffect(40, true); - joueur.EnableEffect(30, true); - joueur.EnableEffect(30, true); - joueur.EnableEffect(30, true); - joueur.Health = 169; - - yield return Timing.WaitForSeconds(30); - - joueur.ShowHint("Mince vous êtes perdu chez le papi Rian !"); - joueur.Health = 9420; - - joueur.IsGodModeEnabled = true; - joueur.EnableEffect(EffectType.Flashed, 2, 2); - joueur.Teleport(RoomType.Pocket); - yield return Timing.WaitForSeconds(6); - - - joueur.EnableEffect(EffectType.Flashed, 2, 2); - joueur.Teleport(Room.Random()); - joueur.Handcuff(); - yield return Timing.WaitForSeconds(15); - - joueur.Health = 1; - - joueur.EnableEffect(EffectType.SeveredHands, 4); - yield return Timing.WaitForSeconds(4); - joueur.DisableAllEffects(); - - - foreach (Exiled.API.Features.Player unJoueur in Exiled.API.Features.Player.List) - { - if (unJoueur.IsScp) - { - joueursSCP.Add(unJoueur); - } - } - - joueur.EnableEffect(EffectType.Flashed, 2, 2); - if (joueursSCP.Count > 0) - { - joueur.Teleport(joueursSCP[UnityEngine.Random.Range(0, joueursSCP.Count)]); - } - else - { - joueur.Teleport(Room.Random()); - } - - yield return Timing.WaitForSeconds(10); - - joueur.Teleport(Room.Random()); - - joueur.RemoveHandcuffs(); - joueur.IsGodModeEnabled = false; - joueur.MaxHealth = 65; - joueur.Heal(joueur.MaxHealth); - joueur.DisplayNickname = "Sou Hiyori"; - - joueur.DisableAllEffects(); - joueur.EnableEffect(10); - joueur.EnableEffect(35); - - - yield return Timing.WaitForSeconds(UnityEngine.Random.Range(180, 300)); - - if (joueur.IsAlive) - { - int randomNumber = UnityEngine.Random.Range(1, 6); - switch (randomNumber) - { - case 1: - Log.Debug(joueur.Nickname + " a changé d'apparence !"); - joueur.PlayShieldBreakSound(); - - joueur.ChangeAppearance(joueursSCP[0].Role); - joueur.DisplayNickname = joueursSCP[0].Nickname; - - Exiled.API.Features.Server.FriendlyFire = true; - - joueur.Mute(); - yield return Timing.WaitForSeconds(15); - joueur.UnMute(); - break; - case 2: - Log.Debug("Muet"); - joueur.ShowHint("Vous avez perdu votre langue ! (esperons que celle-ci repousse)"); - joueur.Mute(); - yield return Timing.WaitForSeconds(UnityEngine.Random.Range(30, 100)); - joueur.ShowHint("Je crois que c'est bon, ça a repoussé !"); - joueur.UnMute(); - break; - case 3: - joueur.ShowHint("Vous êtes devenu du caoutchouc !"); - Exiled.API.Features.TeslaGate.IgnoredPlayers.Add(joueur); - joueur.SetScale(new Vector3(1.5f, 0.5f, 1.7f), Exiled.API.Features.Player.List); - break; - case 4: - Log.Debug("Let's go party"); - foreach (var player in Exiled.API.Features.Player.List) - { - player.ShowHint(joueur.Nickname + " à commencer une fête d'anniversaire !"); - } - - float duration2 = 30f; - float interval2 = 0.7f; - - float elapsedTime2 = 0f; - - while (elapsedTime2 < duration2) - { - float r = UnityEngine.Random.Range(0f, 1f); - float g = UnityEngine.Random.Range(0f, 1f); - float b = UnityEngine.Random.Range(0f, 1f); - - Exiled.API.Features.Map.ChangeLightsColor(new UnityEngine.Color(r, g, b)); - - yield return Timing.WaitForSeconds(interval2); - - elapsedTime2 += interval2; - } - - Exiled.API.Features.Map.ResetLightsColor(); - break; - case 5: - Log.Debug("Paper"); - joueur.ShowHint("Bienvenue dans le monde des papiers. Évite les ciseaux !"); - joueur.SetScale(new Vector3(1f, 0.5f, 1f), Exiled.API.Features.Player.List); - break; - } - } - } -} \ No newline at end of file diff --git a/KruacentExiled/KE.Items/Items/Defibrilator.cs b/KruacentExiled/KE.Items/Items/Defibrilator.cs deleted file mode 100644 index a4c1f6a5..00000000 --- a/KruacentExiled/KE.Items/Items/Defibrilator.cs +++ /dev/null @@ -1,128 +0,0 @@ -using System.Collections.Concurrent; -using System.Collections.Generic; -using Exiled.API.Enums; -using Exiled.API.Features.Attributes; -using Exiled.API.Features.Spawn; -using Exiled.CustomItems.API.Features; -using MEC; -using Exiled.Events.EventArgs.Player; -using Exiled.API.Features; -using UnityEngine; -using System.Linq; - -[CustomItem(ItemType.SCP1853)] -public class Defibrilator : CustomItem -{ - public override uint Id { get; set; } = 1401; - public override string Name { get; set; } = "DF-001"; - public override string Description { get; set; } = "Le défibrilateur, il permet de réanimer une personne qui à une perte de conscience, on va réanimer la personne la plus proche du joueur qui l'utilise (le lieu de mort et non où se trouve le corps)"; - public override float Weight { get; set; } = 0.65f; - - private ConcurrentDictionary positionMort = new ConcurrentDictionary(); - - public override SpawnProperties SpawnProperties { get; set; } = new SpawnProperties() - { - Limit = 2, - DynamicSpawnPoints = new List - { - new DynamicSpawnPoint() { Chance = 100, Location = SpawnLocationType.Inside079Secondary }, - new DynamicSpawnPoint() { Chance = 10, Location = SpawnLocationType.InsideHidRight }, - new DynamicSpawnPoint() { Chance = 10, Location = SpawnLocationType.InsideHidLeft }, - }, - }; - - protected override void SubscribeEvents() - { - Exiled.Events.Handlers.Player.UsedItem += OnUsingItem; - Exiled.Events.Handlers.Player.Dying += OnDeathEvent; - Exiled.Events.Handlers.Player.Spawned += OnSpawningEvent; - base.SubscribeEvents(); - } - - protected override void UnsubscribeEvents() - { - Exiled.Events.Handlers.Player.UsedItem -= OnUsingItem; - Exiled.Events.Handlers.Player.Dying -= OnDeathEvent; - Exiled.Events.Handlers.Player.Spawned -= OnSpawningEvent; - base.UnsubscribeEvents(); - } - - private void OnDeathEvent(DyingEventArgs ev) - { - Log.Debug(positionMort.Count()); - Log.Debug(ev.Player.Nickname); - positionMort.TryAdd(ev.Player, ev.Player.Position); - Log.Debug(positionMort.Count()); - Log.Debug("Role : " + ev.Player.Role); - } - - private void OnSpawningEvent(SpawnedEventArgs ev) - { - if (ev.Player.IsAlive) - { - Log.Debug("Enlèvement du joueur"); - positionMort.TryRemove(ev.Player, out _); - } - } - - private void OnUsingItem(UsedItemEventArgs ev) - { - if (TryGet(ev.Item, out var result) && result.Id == 20) - { - Timing.CallDelayed(0.5f, () => - { - ev.Player.DisableEffect(EffectType.Scp1853); - Timing.RunCoroutine(EffectAttribution(ev.Player)); - }); - } - } - - private IEnumerator EffectAttribution(Player joueur) - { - Log.Debug("Utilisation item"); - Log.Debug("Nombre de mort : " + positionMort.Count()); - - if (positionMort.Count == 0) - { - joueur.Broadcast(5, "Il n'y a pas de morts actuellement.", Broadcast.BroadcastFlags.Normal, true); - Exiled.CustomItems.API.Features.CustomItem.TryGive(joueur, 20); - } - else - { - var playerPosition = joueur.Position; - - Exiled.API.Features.Player closestDeadPlayer = null; - float shortestDistance = float.MaxValue; - - foreach (var dead in positionMort) - { - float distance = Vector3.Distance(playerPosition, dead.Value); - - - if (distance < shortestDistance) - { - shortestDistance = distance; - closestDeadPlayer = dead.Key; - } - } - - if (closestDeadPlayer != null) - { - Log.Debug($"Le joueur mort le plus proche est à une distance de {shortestDistance:F2} unités. C'est : " + closestDeadPlayer.Nickname); - - closestDeadPlayer.IsGodModeEnabled = true; - closestDeadPlayer.Role.Set(joueur.Role); - closestDeadPlayer.Health = 10; - - closestDeadPlayer.Teleport(joueur.Position); - - closestDeadPlayer.Broadcast(5, joueur.Nickname + " t'as réanimé !", Broadcast.BroadcastFlags.Normal, true); - joueur.Broadcast(5, "Tu as réanimé " + closestDeadPlayer.Nickname + " !", Broadcast.BroadcastFlags.Normal, true); - - yield return Timing.WaitForSeconds(1); - - closestDeadPlayer.IsGodModeEnabled = false; - } - } - } -} \ No newline at end of file diff --git a/KruacentExiled/KE.Items/Items/DeployableWall.cs b/KruacentExiled/KE.Items/Items/DeployableWall.cs deleted file mode 100644 index b3218832..00000000 --- a/KruacentExiled/KE.Items/Items/DeployableWall.cs +++ /dev/null @@ -1,97 +0,0 @@ -using Exiled.API.Enums; -using Exiled.API.Features.Attributes; -using Exiled.API.Features.Spawn; -using Exiled.CustomItems.API.Features; -using KE.Items.Interface; -using System.Collections.Generic; -using UnityEngine; -using Exiled.Events.EventArgs.Player; -using Exiled.API.Features.Toys; -using MEC; - -namespace KE.Items.Items -{ - [CustomItem(ItemType.KeycardJanitor)] - public class DeployableWall : CustomItem, ILumosItem - { - - public override uint Id { get; set; } = 1408; - public override string Name { get; set; } = "Deployable Wall"; - public override string Description { get; set; } = "Drop to deploy a wall, and throw to just throw the card"; - public override float Weight { get; set; } = 0.65f; - public UnityEngine.Color Color { get; set; } = UnityEngine.Color.green; - public override SpawnProperties SpawnProperties { get; set; } = new SpawnProperties() - { - Limit = 2, - DynamicSpawnPoints = new List - { - new DynamicSpawnPoint() - { - Chance=25, - Location = SpawnLocationType.Inside049Armory, - }, - new DynamicSpawnPoint() - { - Chance=25, - Location = SpawnLocationType.InsideLczArmory, - } - }, - LockerSpawnPoints = new List - { - new LockerSpawnPoint() - { - Chance=50, - Type = LockerType.RifleRack, - }, - } - - }; - - - - - protected override void OnDropping(DroppingItemEventArgs ev) - { - if(!Check(ev.Item)) - return; - if (ev.IsThrown) - { - ev.IsAllowed = true; - return; - } - ev.IsAllowed = false; - ev.Player.ShowHint("You have dropped a deployable wall"); - ev.Player.RemoveItem(ev.Item); - SpawnWall(ev.Player.Position,ev.Player.Rotation); - - } - - private void SpawnWall(Vector3 pos, Quaternion rotation) - { - float distance = 2; - Vector3 forward = rotation * Vector3.forward; - Vector3 spawnPos = pos + forward * distance; - Vector3 rotat = new Vector3(0, rotation.eulerAngles.y, 0); - - Primitive wall = Primitive.Create(PrimitiveType.Cube, spawnPos, rotat, new Vector3(4, 4, 0.2f),true); - wall.Collidable = true; - wall.Visible = true; - Timing.CallDelayed(10, () => { - wall.UnSpawn(); - wall.Destroy(); - }); - Timing.CallDelayed(5, () => - { - wall.Color= Color.yellow; - }); - Timing.CallDelayed(8, () => - { - wall.Color = Color.red; - }); - - - } - - } - -} diff --git a/KruacentExiled/KE.Items/Items/DivinePills.cs b/KruacentExiled/KE.Items/Items/DivinePills.cs deleted file mode 100644 index 5c06ef75..00000000 --- a/KruacentExiled/KE.Items/Items/DivinePills.cs +++ /dev/null @@ -1,110 +0,0 @@ -using System.Collections.Generic; -using Exiled.API.Enums; -using Exiled.API.Features.Attributes; -using Exiled.API.Features.Spawn; -using Exiled.CustomItems.API.Features; -using MEC; -using Exiled.Events.EventArgs.Player; -using PlayerHandle = Exiled.Events.Handlers.Player; -using Exiled.API.Features; -using Exiled.API.Extensions; -using UnityEngine; -using CustomPlayerEffects; -using System.Linq; -using PlayerRoles; -using KE.Items.Interface; - -/// -[CustomItem(ItemType.Painkillers)] -public class DivinePills : CustomItem, ILumosItem -{ - /// - public override uint Id { get; set; } = 1407; - - /// - public override string Name { get; set; } = "Divine Pills"; - - /// - public override string Description { get; set; } = "25% chance you die\n 75% you respawn someone"; - - /// - public override float Weight { get; set; } = 0.65f; - public UnityEngine.Color Color { get; set; } = UnityEngine.Color.yellow; - - /// - public override SpawnProperties SpawnProperties { get; set; } = new SpawnProperties() - { - LockerSpawnPoints = new List - { - new LockerSpawnPoint() - { - Chance = 75, - UseChamber = true, - Type = LockerType.Misc, - Zone = ZoneType.Entrance, - }, - new LockerSpawnPoint() - { - Chance = 25, - UseChamber = true, - Type = LockerType.Medkit, - Zone = ZoneType.LightContainment, - }, - }, - RoomSpawnPoints = new List - { - new RoomSpawnPoint() - { - Chance = 100, - Room = RoomType.LczGlassBox, - }, - }, - - }; - - /// - protected override void SubscribeEvents() - { - PlayerHandle.UsedItem += OnUsingItem; - base.SubscribeEvents(); - } - - /// - protected override void UnsubscribeEvents() - { - PlayerHandle.UsedItem -= OnUsingItem; - base.UnsubscribeEvents(); - } - - private void OnUsingItem(UsedItemEventArgs ev) - { - if (!Check(ev.Item)) - { - return; - } - if (TryGet(ev.Item, out var result) && result.Id == Id) - { - Player player = ev.Player; - var random = Random.Range(0, 100); - - if(Player.List.Where(x => x.Role == RoleTypeId.Spectator).Count() == 0) - { - player.ShowHint("No spectators to respawn"); - return; - } - - if (random <= 25) - { - player.Kill("unlucky bro"); - return; - } - Player respawning = Player.List.Where(x => x.Role == RoleTypeId.Spectator).GetRandomValue(); - respawning.Role.Set(player.Role); - if (random > 75) - { - respawning.Position = player.Position; - } - } - } - -} \ No newline at end of file diff --git a/KruacentExiled/KE.Items/Items/PressePuree.cs b/KruacentExiled/KE.Items/Items/PressePuree.cs deleted file mode 100644 index 5a8016d2..00000000 --- a/KruacentExiled/KE.Items/Items/PressePuree.cs +++ /dev/null @@ -1,50 +0,0 @@ - -using System.Collections.Generic; -using Exiled.API.Enums; -using Exiled.API.Features; -using Exiled.API.Features.Attributes; -using Exiled.API.Features.Spawn; -using Exiled.CustomItems.API.Features; - -namespace KE.Items.Items -{ - [CustomItem(ItemType.GrenadeHE)] - public class PressePuree : CustomGrenade - { - public override uint Id { get; set; } = 1406; - public override string Name { get; set; } = "Presse Purée"; - public override string Description { get; set; } = "The grenade explode at impact but does less damage"; - public override float Weight { get; set; } = 0.65f; - public override float FuseTime { get; set; } = 1.5f; - public override bool ExplodeOnCollision { get; set; } = true; - public float DamageModifier { get; set; } = 0.4f; - public override SpawnProperties SpawnProperties { get; set; } = new SpawnProperties() - { - Limit = 5, - DynamicSpawnPoints = new List - { - new DynamicSpawnPoint() - { - Chance = 50, - Location = SpawnLocationType.InsideHczArmory, - }, - new DynamicSpawnPoint() - { - Chance =2, - Location = SpawnLocationType.Inside914, - }, - new DynamicSpawnPoint() - { - Chance=50, - Location = SpawnLocationType.Inside049Armory, - }, - new DynamicSpawnPoint() - { - Chance=50, - Location = SpawnLocationType.InsideLczArmory, - } - }, - - }; - } -} diff --git a/KruacentExiled/KE.Items/Items/TPGrenada.cs b/KruacentExiled/KE.Items/Items/TPGrenada.cs deleted file mode 100644 index 881914db..00000000 --- a/KruacentExiled/KE.Items/Items/TPGrenada.cs +++ /dev/null @@ -1,124 +0,0 @@ - -using System; -using System.Collections.Generic; -using System.ComponentModel; -using Exiled.API.Enums; -using Exiled.API.Features; -using Exiled.API.Features.Attributes; -using Exiled.API.Features.Pools; -using Exiled.API.Features.Spawn; -using Exiled.CustomItems.API.Features; -using Exiled.Events.EventArgs.Map; -using KE.Items.Interface; -using PlayerRoles; -using UnityEngine; - -namespace KE.Items.Items -{ - [CustomItem(ItemType.GrenadeHE)] - public class TPGrenada : CustomGrenade, ILumosItem - { - private List effectedPlayers = new List(); - public override uint Id { get; set; } = 1405; - public override string Name { get; set; } = "Teleportation Grenade"; - public override string Description { get; set; } = "This grenade does 0 damage but teleport nearby players in a random place (does work in other dimension ;3 )"; - public override float Weight { get; set; } = 0.65f; - public override float FuseTime { get; set; } = 1.5f; - public override bool ExplodeOnCollision { get; set; } = true; - public float DamageModifier { get; set; } = 0.05f; - public UnityEngine.Color Color { get; set; } = UnityEngine.Color.cyan; - public override SpawnProperties SpawnProperties { get; set; } = new SpawnProperties() - { - Limit = 5, - DynamicSpawnPoints = new List - { - new DynamicSpawnPoint() - { - Chance = 50, - Location = SpawnLocationType.InsideHczArmory, - }, - new DynamicSpawnPoint() - { - Chance =2, - Location = SpawnLocationType.Inside914, - }, - new DynamicSpawnPoint() - { - Chance=50, - Location = SpawnLocationType.Inside049Armory, - }, - new DynamicSpawnPoint() - { - Chance=50, - Location = SpawnLocationType.InsideLczArmory, - } - }, - - }; - - [Description("What roles will not be able to be affected by Implosion Grenades. Keeping SCP-173 on this list is highly recommended.")] - public HashSet BlacklistedRoles { get; set; } = new HashSet() { RoleTypeId.Scp173, RoleTypeId.Scp106,RoleTypeId.Scp049, RoleTypeId.Scp096,RoleTypeId.Scp3114,RoleTypeId.Scp0492,RoleTypeId.Scp939 }; - - protected override void OnExploding(ExplodingGrenadeEventArgs ev) - { - ev.IsAllowed = false; - List copiedList = new List(); - foreach (Player player in ev.TargetsToAffect) - { - copiedList.Add(player); - } - - ev.TargetsToAffect.Clear(); - - effectedPlayers = ListPool.Pool.Get(); - foreach (Player player in copiedList) - { - if (BlacklistedRoles.Contains(player.Role)) - continue; - try - { - - bool line = Physics.Linecast(ev.Projectile.Transform.position, player.Position); - if (line) - { - effectedPlayers.Add(player); - player.Teleport(RandomRoom()); - } - } - catch (Exception exception) - { - Log.Error($"{nameof(OnExploding)} error: {exception}"); - } - } - } - - - - private Room RandomRoom() - { - Room room = Room.Random(); - if (Warhead.IsDetonated) - { - return Room.Random(ZoneType.Surface); - } - - if(Map.IsLczDecontaminated) - { - float random = UnityEngine.Random.value; - Log.Debug($"random={random}"); - if (random <= 0.33f) - { - return Room.Random(ZoneType.HeavyContainment); - } - if(random > 0.33f && random <= 0.66f) - { - return Room.Random(ZoneType.Entrance); - } - return Room.Random(ZoneType.Surface); - } - Log.Debug($"roomZone={room.Zone}"); - return room; - } - } - -} diff --git a/KruacentExiled/KE.Items/KE.Items.csproj b/KruacentExiled/KE.Items/KE.Items.csproj deleted file mode 100644 index fee0f33f..00000000 --- a/KruacentExiled/KE.Items/KE.Items.csproj +++ /dev/null @@ -1,21 +0,0 @@ - - - - net48 - - - - - - - - - - - - - - - - - diff --git a/KruacentExiled/KE.Items/MainPlugin.cs b/KruacentExiled/KE.Items/MainPlugin.cs deleted file mode 100644 index 05ddbc93..00000000 --- a/KruacentExiled/KE.Items/MainPlugin.cs +++ /dev/null @@ -1,127 +0,0 @@ - -using Exiled.API.Features; -using Exiled.API.Features.Pickups; -using Exiled.API.Features.Toys; -using Exiled.CustomItems.API.Features; -using Exiled.Events.EventArgs.Player; -using KE.Items.Interface; -using MEC; -using System; -using System.Collections.Generic; -using System.Linq; - -namespace KE.Items -{ - public class MainPlugin : Plugin - { - public override string Author => "Patrique & OmerGS"; - public override string Name => "KEItems"; - internal static MainPlugin Instance { get; private set; } - public override Version Version => new Version(1, 0, 0); - private Dictionary pl = new Dictionary(); - public override void OnEnabled() - { - Instance = this; - CustomItem.RegisterItems(); - Exiled.Events.Handlers.Player.DroppedItem += Drop; - Exiled.Events.Handlers.Player.PickingUpItem += Pick; - Exiled.Events.Handlers.Server.RoundStarted += OnRoundStarted; - - base.OnEnabled(); - } - - public override void OnDisabled() - { - CustomItem.UnregisterItems(); - Exiled.Events.Handlers.Player.DroppedItem -= Drop; - Exiled.Events.Handlers.Player.PickingUpItem -= Pick; - Exiled.Events.Handlers.Server.RoundStarted -= OnRoundStarted; - - base.OnDisabled(); - Instance = null; - } - - public void Pick(PickingUpItemEventArgs ev) - { - Pickup pickup = ev.Pickup; - if (pl.ContainsKey(pickup)) - { - Light val = pl[pickup]; - if (val != null) - { - val.UnSpawn(); - val.Destroy(); - } - pl.Remove(pickup); - } - } - public void Drop(DroppedItemEventArgs ev) - { - Pickup pickup = ev.Pickup; - if (CustomItem.TryGet(pickup, out CustomItem item) && item is ILumosItem ci) - { - pl.Add(pickup, null); - } - - } - public void OnRoundStarted() - { - Timing.RunCoroutine(LightP()); - } - - internal IEnumerator LightP() - { - - foreach (var p in Pickup.List) - { - if (p != null) - { - if (CustomItem.TryGet(p, out CustomItem ci) && ci is ILumosItem) - pl.Add(p, null); - } - - } - while (Round.InProgress) - { - Log.Debug("boop"); - - foreach (var x in pl.ToList()) - { - if(CustomItem.TryGet(x.Key, out CustomItem cui) && cui is ILumosItem ci) - { - Light light = Light.Create(x.Key.Position, null, null, true, ci.Color); - light.Intensity = 0.5f; - Log.Debug("preif"); - if (x.Value != null) - { - Log.Debug("pre val"); - Light val = x.Value; - Log.Debug($"destroy light {val.Position}"); - val.UnSpawn(); - Log.Debug("pre destroy"); - val.Destroy(); - } - else - Log.Debug("first cretate"); - Log.Debug("reasigne"); - pl[x.Key] = light; - Log.Debug("post reasigne"); - //Log.Debug(x.Key.Position+";"+x.Value.Position); - } - else - { - Light val = x.Value; - val.UnSpawn(); - val.Destroy(); - pl.Remove(x.Key); - } - } - Log.Debug("waiting"); - yield return Timing.WaitForSeconds(0.1f); - } - Log.Debug("end while"); - - } - - } -} \ No newline at end of file diff --git a/KruacentExiled/KE.Map/Doors/DoorButton.cs b/KruacentExiled/KE.Map/Doors/DoorButton.cs deleted file mode 100644 index 772d3f16..00000000 --- a/KruacentExiled/KE.Map/Doors/DoorButton.cs +++ /dev/null @@ -1,66 +0,0 @@ -using Exiled.API.Features.Pickups; -using Exiled.API.Features.Toys; -using Exiled.API.Interfaces; -using Exiled.Events.EventArgs.Player; -using KE.Map.Utils; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using UnityEngine; - -namespace KE.Map.Doors -{ - internal class DoorButton : IWorldSpace - { - public Vector3 Position { get; } - public Quaternion Rotation { get; } - - public bool IsOpen - { - get - { - return isOpen; - } - set - { - isOpen = value; - UpdateColor(); - } - } - private bool isOpen; - - internal InteractiblePickup _ipickup { get; } - private Primitive _primitive; - - internal DoorButton(Vector3 position,Quaternion rotation) - { - Position = position; - Rotation = rotation; - _ipickup = new(ItemType.Medkit, Position, Vector3.one,0, Rotation, false); - - _primitive = Primitive.Create(PrimitiveType.Cube, Position, null, _ipickup.GetPickupTrueSize() + new Vector3(.1f, .1f, .1f)); - _primitive.Collidable = false; - - } - public void Destroy() - { - _primitive.Destroy(); - _ipickup.Destroy(); - } - - private void UpdateColor() - { - if (isOpen) - { - _primitive.Color = Color.red; - } - else - { - _primitive.Color = Color.green; - } - } - - } -} diff --git a/KruacentExiled/KE.Map/Doors/KEDoor.cs b/KruacentExiled/KE.Map/Doors/KEDoor.cs deleted file mode 100644 index 343d1f26..00000000 --- a/KruacentExiled/KE.Map/Doors/KEDoor.cs +++ /dev/null @@ -1,133 +0,0 @@ -using Exiled.API.Extensions; -using Exiled.API.Features; -using Exiled.API.Features.Doors; -using Exiled.API.Features.Items; -using Exiled.API.Features.Pickups; -using Exiled.API.Features.Toys; -using Exiled.API.Interfaces; -using Exiled.Events; -using Exiled.Events.EventArgs.Player; -using Interactables.Interobjects.DoorUtils; -using InventorySystem.Items.Pickups; -using KE.Map.Doors.KEDoorTypes; -using KE.Map.Utils; -using MEC; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Runtime.CompilerServices; -using System.Text; -using System.Threading.Tasks; -using UnityEngine; - -namespace KE.Map.Doors -{ - public class KEDoor : IWorldSpace, IDoorPermissionRequester - { - - internal static readonly HashSet _list = new(); - - public static HashSet List => new(_list); - - - public string RequesterLogSignature - { - get - { - return ""; - } - } - public DoorPermissionsPolicy PermissionsPolicy { get; } = new(DoorPermissionFlags.ContainmentLevelTwo, true); - - public Vector3 Position { get; } - public Quaternion Rotation { get; } - //0 -> closed ; 1 -> open - private float _exactState =0f; - private DoorButton _button; - //interacting door - private InteractiblePickup _pickup; - private CoroutineHandle _handle; - private KEDoorType _doorType; - public KEDoor OtherDoor - { - get { return _otherDoor; } - } - - private KEDoor _otherDoor; - public bool IsOpen - { - get { return _exactState == 1f; } - set - { - _exactState = value ? 1f : 0f; - } - } - - private KEDoor(Vector3 position, Quaternion rotation) - { - _list.Add(this); - Position = position; - Rotation = rotation; - _button = new(position+position* rotation.eulerAngles.y, rotation); - } - - public static KEDoor Create(KEDoorType doorType, Vector3 position,Quaternion rotation) - { - KEDoor door = new(position,rotation); - - door._doorType = doorType ?? new NormalKEDoor(); - door._doorType.Spawn(position,rotation); - - door._pickup = new(ItemType.Medkit,position,Vector3.one,0,null,false); - door._pickup.AddAction(door.UsingDoor); - - door._button._ipickup.AddAction(door.UsingDoor); - door._button.IsOpen = door.IsOpen; - - door._handle = Timing.RunCoroutine(door.Detect()); - return door; - } - - - public void Destroy() - { - Timing.KillCoroutines(_handle); - _button.Destroy(); - _pickup.Destroy(); - - } - - - - public void UsingDoor(Player player) - { - Log.Debug("using door"); - bool flag = PermissionsPolicy.CheckPermissions(player.ReferenceHub, this, out PermissionUsed callback); - - if(flag) - ChangeDoorState(); - } - - public IEnumerator Detect() - { - - - yield return Timing.WaitForOneFrame; - } - - - public void ChangeDoorState() - { - - IsOpen = !IsOpen; - _button.IsOpen = IsOpen; - } - - public void LinkOtherDoor(KEDoor otherDoor) - { - otherDoor._otherDoor = this; - _otherDoor = otherDoor; - } - - } -} diff --git a/KruacentExiled/KE.Map/Doors/KEDoorTypes/KEDoorType.cs b/KruacentExiled/KE.Map/Doors/KEDoorTypes/KEDoorType.cs deleted file mode 100644 index c8e9f7d6..00000000 --- a/KruacentExiled/KE.Map/Doors/KEDoorTypes/KEDoorType.cs +++ /dev/null @@ -1,18 +0,0 @@ -using Exiled.API.Features.Toys; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using UnityEngine; - -namespace KE.Map.Doors.KEDoorTypes -{ - public abstract class KEDoorType - { - - - public abstract IEnumerable Spawn(Vector3 position, Quaternion rotation); - - } -} diff --git a/KruacentExiled/KE.Map/Doors/KEDoorTypes/NormalKEDoor.cs b/KruacentExiled/KE.Map/Doors/KEDoorTypes/NormalKEDoor.cs deleted file mode 100644 index 7dc43724..00000000 --- a/KruacentExiled/KE.Map/Doors/KEDoorTypes/NormalKEDoor.cs +++ /dev/null @@ -1,25 +0,0 @@ -using Exiled.API.Features.Toys; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using UnityEngine; - -namespace KE.Map.Doors.KEDoorTypes -{ - public class NormalKEDoor : KEDoorType - { - public override IEnumerable Spawn(Vector3 position, Quaternion rotation) - { - - - - return new HashSet() - { - Primitive.Create(PrimitiveType.Cube,position,rotation.eulerAngles), - }; - - } - } -} diff --git a/KruacentExiled/KE.Map/EasterEggs/Capybaras.cs b/KruacentExiled/KE.Map/EasterEggs/Capybaras.cs deleted file mode 100644 index 3b7ab3b9..00000000 --- a/KruacentExiled/KE.Map/EasterEggs/Capybaras.cs +++ /dev/null @@ -1,45 +0,0 @@ -using AdminToys; -using Exiled.API.Extensions; -using Exiled.API.Features.Toys; -using Exiled.API.Interfaces; -using KE.Utils.API.Interfaces; -using LabApi.Features.Wrappers; -using PlayerRoles; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using UnityEngine; -using Light = Exiled.API.Features.Toys.Light; - -namespace KE.Map.EasterEggs -{ - internal class Capybaras : IUsingEvents - { - private HashSet _spinnyBaras = new(); - public readonly Vector3 _capy1 = new Vector3(129, 293, 18); - - public void SubscribeEvents() - { - Exiled.Events.Handlers.Map.Generated += OnGenerated; - - } - - public void UnsubscribeEvents() - { - Exiled.Events.Handlers.Map.Generated -= OnGenerated; - } - - - private void OnGenerated() - { - //e - _spinnyBaras.Add(new SpinnyBaras(_capy1)); - - - var l = LabApi.Features.Wrappers.TextToy.Create(_capy1); - l.TextFormat = "Celui qui trouve tous les easters eggs gagne 5€ Paypal"; - } - } -} diff --git a/KruacentExiled/KE.Map/EasterEggs/SpinnyBaras.cs b/KruacentExiled/KE.Map/EasterEggs/SpinnyBaras.cs deleted file mode 100644 index c233ab4d..00000000 --- a/KruacentExiled/KE.Map/EasterEggs/SpinnyBaras.cs +++ /dev/null @@ -1,48 +0,0 @@ -using Exiled.API.Features; -using Exiled.API.Features.Toys; -using LabApi.Features.Wrappers; -using MEC; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using UnityEngine; -using Player = Exiled.API.Features.Player; - -namespace KE.Map.EasterEggs -{ - internal class SpinnyBaras - { - private CapybaraToy _capybara; - private CoroutineHandle _handle; - - private float speed = 100; - public SpinnyBaras(Vector3 position) - { - _capybara = CapybaraToy.Create(position); - _handle = Timing.RunCoroutine(Spin()); - } - - ~SpinnyBaras() - { - Timing.KillCoroutines(_handle); - } - private IEnumerator Spin() - { - while (true) - { - _capybara.Transform.Rotate(Vector3.up, 1); - yield return Timing.WaitForSeconds(1/speed); - } - - } - - - public void Kill() - { - Timing.KillCoroutines(_handle); - } - - } -} diff --git a/KruacentExiled/KE.Map/GamblingZone/DroppableItem.cs b/KruacentExiled/KE.Map/GamblingZone/DroppableItem.cs deleted file mode 100644 index 56dbc332..00000000 --- a/KruacentExiled/KE.Map/GamblingZone/DroppableItem.cs +++ /dev/null @@ -1,79 +0,0 @@ -using Items = Exiled.API.Features.Items.Item; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using Exiled.CustomItems.API.Features; -using UnityEngine; -using Exiled.API.Features; -using Exiled.API.Features.Pickups; -using Exiled.API.Features.Toys; -using KE.Map.Utils; - -namespace KE.Map.GamblingZone -{ - public class DroppableItem : IEquatable - { - private ItemType _item; - internal ItemType Item { get { return _item; } } - private int _chance; - internal int Chance - { - get { return _chance; } - set - { - if (_chance > 100) _chance = 100; - else if (_chance < 0) _chance = 0; - else _chance = value; - } - } - - private int _itemCap; - internal int ItemCap - { - get { return _itemCap; } - set { _itemCap = value; } - } - - private int _currentCap = 0; - internal int CurrentCap - { - get { return _currentCap; } - set { _currentCap = value; } - } - - - - - internal DroppableItem(ItemType item, int chance, int itemCap = -1) - { - - _item = item; - Chance = chance; - ItemCap = itemCap; - } - public static implicit operator DroppableItem(ItemType d) => new(d,1,-1); - public bool Equals(DroppableItem other) - { - return other.Item == Item && other.Chance == Chance && other.ItemCap == this.ItemCap && this.CurrentCap == other.CurrentCap; - } - - internal Items GetItem() - { - if (HasReachCap()) throw new Exception("Cap reached"); - CurrentCap++; - return Items.Create(Item); - } - - internal bool HasReachCap() - { - return CurrentCap >= ItemCap && ItemCap != -1; - } - - public override string ToString() - { - return Item.ToString(); - } - } -} diff --git a/KruacentExiled/KE.Map/GamblingZone/GamblingRoom.cs b/KruacentExiled/KE.Map/GamblingZone/GamblingRoom.cs deleted file mode 100644 index 1bfd87e7..00000000 --- a/KruacentExiled/KE.Map/GamblingZone/GamblingRoom.cs +++ /dev/null @@ -1,98 +0,0 @@ -using Exiled.API.Features; -using Exiled.API.Features.Doors; -using Exiled.API.Features.Items; -using Exiled.API.Features.Toys; -using KE.Map.Utils; -using System.Collections.Generic; -using UnityEngine; - -namespace KE.Map.GamblingZone -{ - public class GamblingRoom - { - private static readonly HashSet _list = new HashSet(); - public static HashSet List => new(_list); - - - - private HashSet _model; - private float _pickupTime = 30; - private InteractiblePickup _pickup; - private Vector3 _position; - private Vector3 _scale; - private LootTable _lootTable; - - internal GamblingRoom(Room room, LootTable lootTable, Vector3? offset = null) - { - Init(room.Position, lootTable, offset); - } - - - internal GamblingRoom(Door door, LootTable lootTable, Vector3? offset = null) - { - Init(door.Position, lootTable,offset); - } - - internal GamblingRoom(Vector3 position, LootTable lootTable, Vector3? offset = null) - { - Init(position, lootTable, offset); - } - - - - private void Init(Vector3 position,LootTable lootTable,Vector3? offset = null) - { - - - - _position = position + (offset ?? new Vector3()); - _list.Add(this); - - _pickup = new InteractiblePickup(ItemType.Medkit, _position+ Vector3.up, new Vector3(1,0,1)*3, _pickupTime, new()); - - _pickup.AddAction(OnPickup); - - //CreateModel(_position); - _lootTable = lootTable; - } - - - private void CreateModel(Vector3 positionWithOffset) - { - _model = new() - { - Primitive.Create(PrimitiveType.Sphere,positionWithOffset,null,null,true,Color.red), - Primitive.Create(PrimitiveType.Cube,positionWithOffset,null,new(2,.5f,2),true) - }; - foreach(Primitive p in _model) - { - p.Collidable = true; - } - } - - - public void SubscribeEvents() - { - - } - public void UnsubscribeEvents() - { - foreach (Primitive p in _model) - { - p.Destroy(); - } - _pickup.Destroy(); - } - - - public void OnPickup(Player player) - { - if (player.CurrentItem == null) return; - if (player == null) return; - Item item = _lootTable.GetRandomItem(); - player.CurrentItem.Destroy(); - player.AddItem(item); - player.DropItem(item,false); - } - } -} diff --git a/KruacentExiled/KE.Map/GamblingZone/LootTable.cs b/KruacentExiled/KE.Map/GamblingZone/LootTable.cs deleted file mode 100644 index eb72ae01..00000000 --- a/KruacentExiled/KE.Map/GamblingZone/LootTable.cs +++ /dev/null @@ -1,62 +0,0 @@ -using Exiled.API.Features; -using Exiled.API.Features.Items; -using Exiled.API.Features.Pickups; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using UnityEngine; - -namespace KE.Map.GamblingZone -{ - internal class LootTable - { - private HashSet _items = new HashSet() - { - new(ItemType.Jailbird,5,1), - new(ItemType.ParticleDisruptor,5,1), - new(ItemType.Radio,15), - }; - - public LootTable() - { - } - public LootTable(IEnumerable items) - { - _items = items.ToHashSet(); - } - - private DroppableItem ChooseRandomItem() - { - int totalWeight = 0; - foreach (DroppableItem drop in _items) - { - if (!drop.HasReachCap()) - totalWeight += drop.Chance; - } - - if (totalWeight == 0) - throw new ArgumentException("Total probability must be greater than zero."); - - int randValue = UnityEngine.Random.Range(0, totalWeight); - int cumulativeSum = 0; - - foreach (DroppableItem drop in _items) - { - if (!drop.HasReachCap()) - cumulativeSum += drop.Chance; - if (randValue < cumulativeSum) - return drop; - } - return null; - - } - public Item GetRandomItem() - { - DroppableItem item = ChooseRandomItem(); - Log.Debug("random item =" + item); - return item.GetItem(); - } - } -} diff --git a/KruacentExiled/KE.Map/GamblingZone/OldGamblingRoom.cs b/KruacentExiled/KE.Map/GamblingZone/OldGamblingRoom.cs deleted file mode 100644 index eda1d2b2..00000000 --- a/KruacentExiled/KE.Map/GamblingZone/OldGamblingRoom.cs +++ /dev/null @@ -1,97 +0,0 @@ -using Exiled.API.Extensions; -using Exiled.API.Features; -using Exiled.API.Features.Doors; -using Exiled.API.Features.Items; -using Exiled.API.Features.Pickups; -using Exiled.API.Features.Spawn; -using Exiled.API.Features.Toys; -using Exiled.Events.EventArgs.Player; -using PlayerRoles; -using System.Collections.Generic; -using System.Linq; -using UnityEngine; - -namespace KE.Map.GamblingZone -{ - public class OldGamblingRoom - { - private static readonly HashSet _list = new HashSet(); - public static HashSet List => new(_list); - - - private Vector3 _position; - private Vector3 _scale; - private LootTable _lootTable; - - internal OldGamblingRoom(Room room,Vector3 scale, LootTable lootTable, Vector3? offset = null) - { - Init(room.Position, scale, lootTable, offset); - } - - - internal OldGamblingRoom(Door door, Vector3 scale, LootTable lootTable, Vector3? offset = null) - { - Init(door.Position, scale, lootTable,offset); - } - - internal OldGamblingRoom(Vector3 position, Vector3 scale, LootTable lootTable, Vector3? offset = null) - { - Init(position, scale, lootTable, offset); - } - - - - private void Init(Vector3 position, Vector3 scale,LootTable lootTable,Vector3? offset = null) - { - Log.Debug("position w/out offset "+position); - _position = position + (offset ?? new Vector3()); - Log.Debug("position w/ offset "+_position); - _scale = scale; - _list.Add(this); - _lootTable = lootTable; - if (MainPlugin.Instance.Config.Debug) - { - var p = Primitive.Create(PrimitiveType.Cube, _position, null, _scale); - p.Collidable = false; - } - } - - public bool IsInGamblingRoom(Player p) - { - Vector3 playerPosition = p.Position; - Vector3 halfSize = _scale / 2; - return playerPosition.x >= _position.x - halfSize.x && - playerPosition.x <= _position.x + halfSize.x && - playerPosition.y >= _position.y - halfSize.y && - playerPosition.y <= _position.y + halfSize.y && - playerPosition.z >= _position.z - halfSize.z && - playerPosition.z <= _position.z + halfSize.z; - } - - public void SubscribeEvents() - { - Exiled.Events.Handlers.Player.DroppedItem += OnDropped; - } - public void UnsubscribeEvents() - { - Exiled.Events.Handlers.Player.DroppedItem -= OnDropped; - } - - - public void OnDropped(DroppedItemEventArgs ev) - { - Player player = ev.Player; - if (player == null) return; - if (ev.Pickup == null) return; - if (!IsInGamblingRoom(player)) - { - Log.Debug($"player ({player.CustomName}) not in room ({player.Position})"); - return; - } - ev.Pickup.Destroy(); - Item item = _lootTable.GetRandomItem(); - player.AddItem(item); - player.DropItem(item); - } - } -} diff --git a/KruacentExiled/KE.Map/KE.Map.csproj b/KruacentExiled/KE.Map/KE.Map.csproj deleted file mode 100644 index 1756fc73..00000000 --- a/KruacentExiled/KE.Map/KE.Map.csproj +++ /dev/null @@ -1,32 +0,0 @@ - - - - 13.0 - net48 - - - - - - - - - - - - - - - - - - - - - if not "$(EXILED_DEV_REFERENCES)"=="" copy /y "$(OutputPath)$(AssemblyName).dll" "$(EXILED_DEV_REFERENCES)\Plugins\" - - - if [[ ! -z "$EXILED_DEV_REFERENCES" ]]; then cp "$(OutputPath)$(AssemblyName).dll" "$EXILED_DEV_REFERENCES/Plugins/"; fi - - - diff --git a/KruacentExiled/KE.Map/MainPlugin.cs b/KruacentExiled/KE.Map/MainPlugin.cs deleted file mode 100644 index 76598ecc..00000000 --- a/KruacentExiled/KE.Map/MainPlugin.cs +++ /dev/null @@ -1,138 +0,0 @@ - -using Exiled.API.Extensions; -using Exiled.API.Features; -using Exiled.API.Features.Doors; -using Exiled.API.Features.Roles; -using Exiled.API.Interfaces; -using Exiled.Events.EventArgs.Player; -using Exiled.Events.EventArgs.Server; -using Interactables.Interobjects.DoorUtils; -using KE.Map.Doors; -using KE.Map.EasterEggs; -using KE.Map.GamblingZone; -using KE.Map.Utils; -using KE.Utils.API.Models; -using PlayerRoles; -using System.Collections.Generic; -using UnityEngine; - -namespace KE.Map -{ - public class MainPlugin : Plugin - { - public static MainPlugin Instance { get; private set; } - //public Models models => Models.Instance; - private Capybaras Capybaras; - public override void OnEnabled() - { - - Capybaras = new(); - - - Capybaras.SubscribeEvents(); - Exiled.Events.Handlers.Map.Generated += OnGenerated; - Exiled.Events.Handlers.Server.RoundEnded += OnRoundEnded; - //Exiled.Events.Handlers.Server.RoundStarted += SendFakePrimitives.Join; - //if(Config.Debug) - //models?.SubscribeEvents(); - - Instance = this; - } - - public override void OnDisabled() - { - Exiled.Events.Handlers.Map.Generated -= OnGenerated; - Exiled.Events.Handlers.Server.RoundEnded -= OnRoundEnded; - //Exiled.Events.Handlers.Server.RoundStarted -= SendFakePrimitives.Join; - Capybaras.UnsubscribeEvents(); - /*if (Config.Debug) - { - models.UnsubscribeEvents(); - models.DestroyInstance(); - } - - models.DestroyInstance();*/ - Capybaras = null; - Instance = null; - } - - - - - private void OnGenerated() - { - - Door lcz173 = Door.Get(Exiled.API.Enums.DoorType.Scp173Gate); - HashSet normal = new() - { - new(ItemType.KeycardO5,1,2), - new(ItemType.SCP500,1), - new(ItemType.KeycardMTFCaptain,1), - new(ItemType.SCP268,1,1), - new(ItemType.GunCOM15,1), - new(ItemType.SCP207,1), - new(ItemType.Adrenaline,1), - new(ItemType.GunCOM18,1), - new(ItemType.KeycardFacilityManager,1), - new(ItemType.Medkit,1), - new(ItemType.KeycardMTFOperative,1), - ItemType.KeycardGuard, - ItemType.Radio, - ItemType.Ammo9x19, - ItemType.Ammo44cal, - ItemType.Ammo12gauge, - ItemType.Ammo556x45, - ItemType.Ammo762x39, - ItemType.GrenadeFlash, - ItemType.KeycardScientist, - ItemType.KeycardJanitor, - ItemType.Coin, - new(ItemType.Jailbird,1,1), - ItemType.Flashlight, - ItemType.AntiSCP207, - new(ItemType.ParticleDisruptor,1,1), - ItemType.GunCom45, - ItemType.GunShotgun, - ItemType.GunRevolver, - ItemType.GunA7, - }; - - - var g = new GamblingRoom(RoleTypeId.Scp173.GetRandomSpawnLocation().Position + Vector3.down*2, new(normal)); - - //var g = new GamblingRoom(lcz173, new(normal), -lcz173.Transform.forward * 5f); - - g.SubscribeEvents(); - - - if (Config.Debug) - { - var door = KEDoor.Create(null, RoleTypeId.Scp049.GetRandomSpawnLocation().Position, new()); - - var d2 = KEDoor.Create(null, RoleTypeId.Scp049.GetRandomSpawnLocation().Position + Vector3.forward * 2, new()); - - door.LinkOtherDoor(d2); - } - - - - - } - - private void OnRoundEnded(RoundEndedEventArgs ev) - { - foreach (var g in GamblingRoom.List) - g.UnsubscribeEvents(); - - foreach (var g in OldGamblingRoom.List) - g.UnsubscribeEvents(); - } - } - - - public class Config : IConfig - { - public bool IsEnabled { get; set; } = true; - public bool Debug { get; set; } = true; - } -} diff --git a/KruacentExiled/KE.Map/Quality/SendFakePrimitives.cs b/KruacentExiled/KE.Map/Quality/SendFakePrimitives.cs deleted file mode 100644 index f98aabd2..00000000 --- a/KruacentExiled/KE.Map/Quality/SendFakePrimitives.cs +++ /dev/null @@ -1,84 +0,0 @@ -using AdminToys; -using Exiled.API.Extensions; -using Exiled.API.Features; -using Exiled.API.Features.Pickups; -using Exiled.API.Features.Toys; -using Exiled.Events.EventArgs.Player; -using InventorySystem.Items.Pickups; -using Mirror; -using PlayerRoles; -using System; -using System.Collections.Generic; -using UnityEngine; - -namespace KE.Map.Utils -{ - internal class SendFakePrimitives - { - public static void Fake() - { - Vector3 pos = RoleTypeId.Scp049.GetRandomSpawnLocation().Position; - Primitive.Create(pos, null, null, true, Color.white); - HashSet list = new HashSet(); - for (int i = 0; i < 1000; i++) - { - - - Primitive p = Primitive.Create(pos+new Vector3(.1f*i,0,0), null, new Vector3(.5f, 1.5f, .5f), true, Color.yellow); - p.Collidable = false; - list.Add(p); - PrimitiveObjectToy primitive = p.Base; - - foreach (Player pl in Player.List) - { - - if (pl.Id % 2 == 0) - { - Log.Debug($"for player ={pl.Nickname}"); - pl.SendFakeSyncVar(p.Base.netIdentity, typeof(PrimitiveObjectToy), nameof(PrimitiveObjectToy.NetworkPosition), new Vector3(15000,15000,15000)); - } - else - { - Log.Debug($"back player ={pl.Nickname}"); - pl.SendFakeSyncVar(p.Base.netIdentity, typeof(PrimitiveObjectToy), nameof(PrimitiveObjectToy.NetworkPosition), pos + Vector3.forward); - } - - - //pl.SendFakeSyncVar(p.Base.netIdentity, typeof(PrimitiveObjectToy), nameof(PrimitiveObjectToy.NetworkPosition), pos + Vector3.forward); - } - } - - } - - - - public static void Join() - { - //Fake(); - Vector3 pos = RoleTypeId.Scp049.GetRandomSpawnLocation().Position; - - var pick = Pickup.CreateAndSpawn(ItemType.Medkit, pos); - - //pick.Base.GetComponent().isKinematic = true; - - Collider collider = pick.GameObject.GetComponentInChildren(); - - - - - - //Pickup pickupFinal = Pickup.CreateAndSpawn(ItemType.KeycardGuard, p.Position); - - //if (!pickupFinal.IsLocked) - //{ - // PickupSyncInfo info = pickupFinal.Base.NetworkInfo; - // pickupFinal.Scale = new Vector3(10, 150, 10); - // pickupFinal.Base.NetworkInfo = info; - // pickupFinal.Base.GetComponent().isKinematic = true; - //} - - } - - - } -} diff --git a/KruacentExiled/KE.Map/Utils/InteractiblePickup.cs b/KruacentExiled/KE.Map/Utils/InteractiblePickup.cs deleted file mode 100644 index bf4625e5..00000000 --- a/KruacentExiled/KE.Map/Utils/InteractiblePickup.cs +++ /dev/null @@ -1,140 +0,0 @@ -using Exiled.API.Features; -using Exiled.API.Features.Pickups; -using Exiled.API.Interfaces; -using Exiled.Events.EventArgs.Player; -using InventorySystem.Items.Pickups; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using UnityEngine; - -namespace KE.Map.Utils -{ - public class InteractiblePickup - { - private HashSet> _actions = new(); - private ushort _pickupSerial; - private Pickup _pickup; - private InteractiblePickup(Pickup pickup) - { - _pickupSerial = pickup.Serial; - _pickup = pickup; - SubscribeEvent(); - } - - private InteractiblePickup(Pickup pickup, Vector3 sizePickup) - { - _pickup = pickup; - _pickupSerial = pickup.Serial; - PickupSyncInfo info = pickup.Base.NetworkInfo; - pickup.Scale = sizePickup; - pickup.Base.NetworkInfo = info; - pickup.Base.GetComponent().isKinematic = true; - SubscribeEvent(); - } - - - public InteractiblePickup(ItemType itemType, Vector3 position, Vector3 scalePickup,float? pickupTime, Quaternion? rotation, bool useGravity = false) - { - var pickup = Pickup.CreateAndSpawn(itemType, position, rotation); - _pickup = pickup; - - _pickup.Weight = pickupTime ?? 0; - pickup.Rigidbody.useGravity = useGravity; - pickup.Rigidbody.detectCollisions = false; - - Renderer renderer = pickup.GameObject.GetComponentInChildren(); - renderer.forceRenderingOff = true; - - _pickupSerial = pickup.Serial; - PickupSyncInfo info = pickup.Base.NetworkInfo; - pickup.Scale = scalePickup; - pickup.Base.NetworkInfo = info; - pickup.Base.GetComponent().isKinematic = true; - - SubscribeEvent(); - } - - public void Destroy() - { - UnsubscribEvent(); - _actions = null; - _pickup.Destroy(); - } - - - - ~InteractiblePickup() - { - UnsubscribEvent(); - } - - private void UnsubscribEvent() - { - Exiled.Events.Handlers.Player.PickingUpItem -= OnPickingUpItem; - } - - private void SubscribeEvent() - { - Exiled.Events.Handlers.Player.PickingUpItem += OnPickingUpItem; - } - - public bool AddAction(Action a) - { - return _actions.Add(a); - } - - public void OnPickingUpItem(PickingUpItemEventArgs ev) - { - if (ev.Pickup.Serial != _pickupSerial) return; - ev.IsAllowed = false; - - foreach (var action in _actions) - { - action?.Invoke(ev.Player); - } - } - - public static Vector3 GetPickupTrueSize(Pickup pickup) - { - if (pickup?.GameObject == null) - return Vector3.zero; - - Renderer renderer = pickup.GameObject.GetComponentInChildren(); - Collider collider = pickup.GameObject.GetComponentInChildren(); - - - if (renderer != null) - return renderer.bounds.size; - - if (collider != null) - return collider.bounds.size; - - return Vector3.zero; - } - - public Vector3 GetPickupTrueSize() - { - if (_pickup.GameObject == null) - return Vector3.zero; - - Renderer renderer = _pickup.GameObject.GetComponentInChildren(); - Collider collider = _pickup.GameObject.GetComponentInChildren(); - - if (renderer != null) - return renderer.bounds.size; - - if (collider != null) - return collider.bounds.size; - - return Vector3.zero; - } - - - - } - - -} diff --git a/KruacentExiled/KE.Misc/914.cs b/KruacentExiled/KE.Misc/914.cs deleted file mode 100644 index b70b8dba..00000000 --- a/KruacentExiled/KE.Misc/914.cs +++ /dev/null @@ -1,182 +0,0 @@ -using Exiled.API.Enums; -using Exiled.Events.EventArgs.Scp914; -using PlayerRoles; -using Scp914; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using Exiled.API.Features; -using Exiled.API.Extensions; -using UnityEngine; -using YamlDotNet.Core.Tokens; - -namespace KE.Misc -{ - /// - /// Everything 914 related - /// - internal class _914 - { - - internal Dictionary roleScp = new Dictionary() - { - { -1, RoleTypeId.Scp049 }, - { -2, RoleTypeId.Scp939 }, - { -3, RoleTypeId.Scp096 }, - - { 3, RoleTypeId.Scp106 }, - { 2, RoleTypeId.Scp173 }, - { 1, RoleTypeId.Scp3114}, - - }; - internal void OnUpgradingPlayer(UpgradingPlayerEventArgs ev) - { - Log.Debug("upgrading player"); - Teleport(ev.Player, ev.KnobSetting); - - ChangingRole(ev.Player, ev.KnobSetting); - } - - - /// - /// Teleport the player in a random place specified by the knob - /// Coarse -> 1/4 chance to tp in Lcz -> 1/10 switch place with the scp - /// Fine -> 1/100 chance to tp in Entrance or Hcz - /// - /// the player being teleported - /// the knob setting of 914 - private void Teleport(Player p, Scp914KnobSetting knob) - { - if (knob == Scp914KnobSetting.Fine && UnityEngine.Random.value < .01f) - { - if (UnityEngine.Random.value < .5f) - p.Teleport(Room.Random(ZoneType.Entrance)); - else - p.Teleport(Room.Random(ZoneType.HeavyContainment)); - } - - if (knob == Scp914KnobSetting.Coarse && UnityEngine.Random.value < .25f) - { - if (UnityEngine.Random.value < .10f && Player.List.Any(player => player.IsScp)) - { - Player playerScp = Player.List.ToList().Where(pl => pl.IsScp).GetRandomValue(); - var pos = p.Position; - p.Teleport(playerScp.Position); - playerScp.Teleport(pos); - - } - else - p.Teleport(Room.Random(ZoneType.LightContainment)); - } - } - /// - /// Changing the role of a player - /// - /// the player to change the role - /// the knob setting of knob - private void ChangingRole(Player p, Scp914KnobSetting knob) - { - if (p.IsScp) - { - HandleScpChangingRole(p, knob); - } - else if (p.IsHuman) - { - HandleHumanChangingRole(p, knob); - } - } - /// - /// Handle the change of role if the player is human - /// - /// the human player - /// the knob setting of 914 - private void HandleHumanChangingRole(Player p, Scp914KnobSetting knob) - { - if (p.IsHuman) - { - switch (p.Role.Type) - { - case RoleTypeId.Scientist: - if (UnityEngine.Random.value < .5f && knob == Scp914KnobSetting.OneToOne) - p.Role.Set(RoleTypeId.ClassD); - break; - case RoleTypeId.ClassD: - if (UnityEngine.Random.value < .5f && knob == Scp914KnobSetting.OneToOne) - p.Role.Set(RoleTypeId.Scientist); - break; - case RoleTypeId.FacilityGuard: - if (knob == Scp914KnobSetting.Rough) - p.Role.Set(RoleTypeId.FacilityGuard); - break; - } - } - } - - /// - /// Handle the change of role if the player is a scp - /// - /// the scp player (not a zombie) - /// the knob setting of 914 - private void HandleScpChangingRole(Player p, Scp914KnobSetting knob) - { - - if (p.IsScp && p.Role.Type != RoleTypeId.Scp0492) - { - var invertRoleScp = roleScp.ToDictionary(k => k.Value, v => v.Key); - if (UnityEngine.Random.value < .5f) - { - // get the id of the scp - if (invertRoleScp.TryGetValue(p.Role.Type, out int key)) - { - switch (knob) - { - //going up in the graph - case Scp914KnobSetting.Rough: - TrySetRole(p, key - 1); - break; - //going horizontaly in the graph - case Scp914KnobSetting.OneToOne: - switch (Math.Abs(key)) - { - case 3: - TrySetRole(p,key/(-3)); - break; - case 2: - TrySetRole(p,key* (-1)); - break; - case 1: - TrySetRole(p, key * (-3)); - break; - - } - - break; - //going down in the graph - case Scp914KnobSetting.VeryFine: - TrySetRole(p, key + 1); - break; - } - } - - } - else - { - Log.Debug("no luck"); - } - } - } - - - - private void TrySetRole(Player p ,int key) - { - RoleTypeId newRole; - if (roleScp.TryGetValue(key, out newRole)) - { - p.Role.Set(newRole); - } - } - } -} diff --git a/KruacentExiled/KE.Misc/AutoElevator.cs b/KruacentExiled/KE.Misc/AutoElevator.cs deleted file mode 100644 index 631c9b9a..00000000 --- a/KruacentExiled/KE.Misc/AutoElevator.cs +++ /dev/null @@ -1,37 +0,0 @@ -using Exiled.API.Features; -using MEC; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace KE.Misc -{ - /// - /// The elevator will random activate in the round - /// - internal class AutoElevator - { - /// - /// Start the auto elevator loop - /// - internal IEnumerator StartElevator() - { - Log.Debug("elevator"); - while (!Round.IsEnded) - { - foreach (Lift l in Lift.List) - { - yield return Timing.WaitForSeconds(UnityEngine.Random.Range(30, 45)); - SendElevator(l); - } - } - } - private void SendElevator(Lift e) - { - Log.Debug($"{e.Name}"); - e.TryStart(0, true); - } - } -} diff --git a/KruacentExiled/KE.Misc/Candy.cs b/KruacentExiled/KE.Misc/Candy.cs deleted file mode 100644 index 61b1fb7d..00000000 --- a/KruacentExiled/KE.Misc/Candy.cs +++ /dev/null @@ -1,22 +0,0 @@ -using Exiled.Events.EventArgs.Scp330; -using Exiled.Events.Patches.Events.Scp330; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using InventorySystem.Items.Usables.Scp330; - -namespace KE.Misc -{ - internal class Candy - { - public void InteractingScp330(InteractingScp330EventArgs ev) - { - if(UnityEngine.Random.Range(0, 100) < MainPlugin.Instance.Config.ChancePinkCandy) - { - ev.Candy = CandyKindID.Pink; - } - } - } -} diff --git a/KruacentExiled/KE.Misc/ClassDDoor.cs b/KruacentExiled/KE.Misc/ClassDDoor.cs deleted file mode 100644 index 11d0a629..00000000 --- a/KruacentExiled/KE.Misc/ClassDDoor.cs +++ /dev/null @@ -1,41 +0,0 @@ -using Exiled.API.Enums; -using Exiled.API.Features; -using Exiled.API.Features.Doors; -using Exiled.API.Interfaces; -using KE.Misc; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace KE.Misc -{ - /// - /// Everything about classD door - /// - internal class ClassDDoor - { - /// - /// Class d door randomly explode at the start of the round - /// - internal void ClassDDoorGoesBoom() - { - if (UnityEngine.Random.Range(0, 101) < MainPlugin.Instance.Config.ChanceClassDDoorGoesBoom) - { - Log.Debug("ClassD's door exploded"); - foreach (Door door in Door.List) - { - if (door.Type == DoorType.PrisonDoor) - { - if (door is IDamageableDoor dBoyDoor && !dBoyDoor.IsDestroyed) - { - dBoyDoor.Break(); - - } - } - } - } - } - } -} diff --git a/KruacentExiled/KE.Misc/Config.cs b/KruacentExiled/KE.Misc/Config.cs deleted file mode 100644 index 8138bbee..00000000 --- a/KruacentExiled/KE.Misc/Config.cs +++ /dev/null @@ -1,24 +0,0 @@ -using Exiled.API.Interfaces; -using System.ComponentModel; - -namespace KE.Misc -{ - public class Config : IConfig - { - public bool IsEnabled { get; set; } = true; - public bool Debug { get; set; } = true; - [Description("Chance that the friendly fire is enabled at the start of the round (set 0 to disable)")] - public int ChanceFF { get; set; } = 50; - [Description("Enable or disable the auto-nuke annoucement")] - public int ChanceClassDDoorGoesBoom { get; set; } = 2; - [Description("Chance to d-boy doors goes boom")] - public bool AutoNukeAnnoucement { get; set; } = true; - [Description("Enable or disable the lockdown of SCP-173")] - public bool PeanutLockDown { get; set; } = true; - [Description("Enable or disable the auto elevator")] - public bool AutoElevator { get; set; } = true; - [Description("Chance to get a pink candy (0-100)")] - public int ChancePinkCandy { get; set; } = 10; - public bool SurfaceLight { get; set; } = true; - } -} diff --git a/KruacentExiled/KE.Misc/KE.Misc.csproj b/KruacentExiled/KE.Misc/KE.Misc.csproj deleted file mode 100644 index 452d5c70..00000000 --- a/KruacentExiled/KE.Misc/KE.Misc.csproj +++ /dev/null @@ -1,20 +0,0 @@ - - - - net48 - - - - - - - - - - - - - - - - diff --git a/KruacentExiled/KE.Misc/MainPlugin.cs b/KruacentExiled/KE.Misc/MainPlugin.cs deleted file mode 100644 index 968a1b67..00000000 --- a/KruacentExiled/KE.Misc/MainPlugin.cs +++ /dev/null @@ -1,141 +0,0 @@ -using Exiled.API.Enums; -using Exiled.API.Features; -using System.Collections.Generic; -using ServerHandle = Exiled.Events.Handlers.Server; -using Nine14Handle = Exiled.Events.Handlers.Scp914; -using MEC; -using Exiled.API.Features.Doors; -using System.Linq; -using PlayerRoles; -using Exiled.Events.EventArgs.Player; -using System; - -namespace KE.Misc -{ - - public class MainPlugin : Plugin - { - public override string Author => "Patrique"; - public override string Name => "KEMisc"; - public override Version Version => new Version(1, 0, 0); - internal static MainPlugin Instance { get; private set; } - private ServerHandler ServerHandler; - internal _914 _914 { get; private set; } - internal AutoElevator AutoElevator { get; private set; } - internal ClassDDoor ClassDDoor { get; private set; } - internal Candy Candy { get; private set; } - internal SurfaceLight SurfaceLight { get; private set; } - - public override void OnEnabled() - { - Instance = this; - _914 = new _914(); - AutoElevator = new AutoElevator(); - ClassDDoor = new ClassDDoor(); - SurfaceLight = new SurfaceLight(); - ServerHandler = new ServerHandler(); - if (Instance.Config.ChancePinkCandy >= 0 && Instance.Config.ChancePinkCandy <= 100) - { - Candy = new Candy(); - Exiled.Events.Handlers.Scp330.InteractingScp330 += Candy.InteractingScp330; - } - else - { - Log.Error("ChancePinkCandy must be between 0 and 100"); - } - - - ServerHandle.RoundStarted += ServerHandler.OnRoundStarted; - Nine14Handle.UpgradingPlayer += _914.OnUpgradingPlayer; - Exiled.Events.Handlers.Player.Dying += ScpNoeDeathMessage; - - - } - - public override void OnDisabled() - { - ServerHandle.RoundStarted -= ServerHandler.OnRoundStarted; - Nine14Handle.UpgradingPlayer -= _914.OnUpgradingPlayer; - Exiled.Events.Handlers.Player.Dying -= ScpNoeDeathMessage; - if (Instance.Config.ChancePinkCandy >= 0 && Instance.Config.ChancePinkCandy <= 100) - { - Exiled.Events.Handlers.Scp330.InteractingScp330 -= Candy.InteractingScp330; - Candy = null; - } - - - - _914 = null; - ClassDDoor = null; - ServerHandler = null; - AutoElevator = null; - Instance = null; - SurfaceLight = null; - } - - - /// - /// Set the Friendly Fire to true or false at random - /// - internal void RandomFF() - { - Server.FriendlyFire = UnityEngine.Random.Range(0, 101) < Instance.Config.ChanceFF; - Log.Info($"Friendly Fire : {Server.FriendlyFire}"); - } - - /// - /// C.A.S.S.I.E. announce 5 min before the autonuke - /// - internal IEnumerator NukeAnnouncement() - { - Log.Debug("autonuke announcement : on"); - yield return Timing.WaitUntilTrue(() => 25 <= Round.ElapsedTime.TotalMinutes); - Cassie.MessageTranslated("Warning automatic warhead will detonate in 5 minutes", - "Warning automatic warhead will detonate in 5 minutes"); - } - - /// - /// Lock SCP-173 in its cell for an amount of time determine by the number of player - /// Formula : timeLock = 135-nbPlayer*15 - /// - internal IEnumerator PeanutLockdown() - { - if(!Player.List.Any(p => p.Role.Type == RoleTypeId.Scp173)) - { - yield return 0; - } - Log.Debug("peanut lockdown"); - Door peanutDoor = Door.List.ToList().Where(x => x.Type == DoorType.Scp173NewGate).ToList()[0]; - peanutDoor.IsOpen = false; - peanutDoor.ChangeLock(DoorLockType.Lockdown2176); - yield return Timing.WaitForSeconds(135-Player.List.Count*15); - peanutDoor.IsOpen = true; - peanutDoor.Unlock(); - Log.Debug("peanut free"); - } - - /// - /// Special death message when Delecons dies as a SCP - /// - /// - internal void ScpNoeDeathMessage(DyingEventArgs ev) - { - - Player player = ev.Player; - Log.Debug($"someone died = {player.UserId}"); - - if (!player.UserId.Equals("76561199066936074@steam")) - return; - if (!player.IsScp) - return; - if (player.Role.Type == RoleTypeId.Scp0492) - return; - Cassie.MessageTranslated("SCP 69 420 has been contained successfully", "SCP-69420-NOE has been contained successfully"); - } - - - - - - } -} diff --git a/KruacentExiled/KE.Misc/README.md b/KruacentExiled/KE.Misc/README.md deleted file mode 100644 index 79b9d8a2..00000000 --- a/KruacentExiled/KE.Misc/README.md +++ /dev/null @@ -1,14 +0,0 @@ -# Misc Plugin -This plugin add all of the other feature. - -## Random FriendlyFire -Each round, there is a chance (50% by default) to have the Friendly Fire enabled. - -## Auto-nuke Annoucement -C.A.S.S.I.E. make an announcement when the auto-nuke - -## Peanut Lockdown -Peanut is locked down in its containment for a limited amount of time because - -## Auto Elevator -Elevator automaticly goes up and down \ No newline at end of file diff --git a/KruacentExiled/KE.Misc/ServerHandler.cs b/KruacentExiled/KE.Misc/ServerHandler.cs deleted file mode 100644 index 2274d004..00000000 --- a/KruacentExiled/KE.Misc/ServerHandler.cs +++ /dev/null @@ -1,29 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using Exiled.API.Features; -using MEC; - -namespace KE.Misc -{ - internal class ServerHandler - { - public void OnRoundStarted() - { - if(MainPlugin.Instance.Config.ChanceFF >= 0 && MainPlugin.Instance.Config.ChanceFF <= 100) - MainPlugin.Instance.RandomFF(); - if (MainPlugin.Instance.Config.ChanceClassDDoorGoesBoom >= 0 && MainPlugin.Instance.Config.ChanceClassDDoorGoesBoom <= 100) - MainPlugin.Instance.ClassDDoor.ClassDDoorGoesBoom(); - if(MainPlugin.Instance.Config.AutoNukeAnnoucement) - Timing.RunCoroutine(MainPlugin.Instance.NukeAnnouncement()); - if(MainPlugin.Instance.Config.PeanutLockDown && Player.List.Where(p => p.Role.Type == PlayerRoles.RoleTypeId.Scp173).Count() > 0) - Timing.RunCoroutine(MainPlugin.Instance.PeanutLockdown()); - if(MainPlugin.Instance.Config.AutoElevator) - Timing.RunCoroutine(MainPlugin.Instance.AutoElevator.StartElevator()); - if (MainPlugin.Instance.Config.SurfaceLight) - MainPlugin.Instance.SurfaceLight.ChangeSurfaceLight(); - } - } -} diff --git a/KruacentExiled/KE.Misc/SurfaceLight.cs b/KruacentExiled/KE.Misc/SurfaceLight.cs deleted file mode 100644 index fae0b003..00000000 --- a/KruacentExiled/KE.Misc/SurfaceLight.cs +++ /dev/null @@ -1,39 +0,0 @@ -using Exiled.API.Enums; -using Exiled.API.Features; -using UnityEngine; -using System.Collections.Generic; -using System.Linq; - -namespace KE.Misc -{ - /// - /// Everything about Surface Light - /// - internal class SurfaceLight - { - /// - /// Change Surface Light Color - /// - internal void ChangeSurfaceLight() - { - List colors = new [] - { - Color.cyan, - Color.red, - Color.green, - Color.white, - Color.blue - }.ToList(); - - // Select a random color - Color randomColor = colors[UnityEngine.Random.Range(0, colors.Count)]; - - foreach (var room in Room.List.Where(r => r.Type == RoomType.Surface)) - { - room.Color = randomColor; - } - - Log.Info($"Changed Surface light color to {randomColor}."); - } - } -} diff --git a/KruacentExiled/KE.Utils/API/Displays/DisplayMeow/DisplayHandler.cs b/KruacentExiled/KE.Utils/API/Displays/DisplayMeow/DisplayHandler.cs deleted file mode 100644 index 4ee13535..00000000 --- a/KruacentExiled/KE.Utils/API/Displays/DisplayMeow/DisplayHandler.cs +++ /dev/null @@ -1,67 +0,0 @@ -using Exiled.API.Features; -using HintServiceMeow.Core.Extension; -using HintServiceMeow.Core.Models.Hints; -using HintServiceMeow.Core.Utilities; -using MEC; - - -//damn why the same name -using MHint = HintServiceMeow.Core.Models.Hints.Hint; - -namespace KE.Utils.API.Displays.DisplayMeow -{ - public class DisplayHandler - { - public static DisplayHandler Instance { get; } = new(); - - private DisplayHandler() { } - - - - - - - public MHint AddHint(HintPlacement hintPlacement, Player player, string text, float delay) - { - var dis = PlayerDisplay.Get(player); - string id = $"{player.Id}_{hintPlacement.XCoordinate}_{hintPlacement.YCoordinate}"; - MHint hint; - - if (!dis.TryGetHint(id, out var aHint)) - { - hint = new() - { - Text = text, - XCoordinate = hintPlacement.XCoordinate, - YCoordinate = hintPlacement.YCoordinate, - Alignment = hintPlacement.HintAlignment, - Id = id - - }; - dis.AddHint(hint); - - } - else - { - - hint = (MHint)aHint; - hint.Hide = false; - hint.Text = text; - } - - - hint.HideAfter(delay); - return hint; - } - - - - - - - - - - - } -} diff --git a/KruacentExiled/KE.Utils/API/Displays/DisplayMeow/HintPlacement.cs b/KruacentExiled/KE.Utils/API/Displays/DisplayMeow/HintPlacement.cs deleted file mode 100644 index 936cdbe9..00000000 --- a/KruacentExiled/KE.Utils/API/Displays/DisplayMeow/HintPlacement.cs +++ /dev/null @@ -1,31 +0,0 @@ -using HintServiceMeow.Core.Enum; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace KE.Utils.API.Displays.DisplayMeow -{ - public readonly struct HintPlacement : IEquatable - { - public float YCoordinate { get; } - public float XCoordinate { get; } - public HintAlignment HintAlignment { get; } = HintAlignment.Center; - - - public bool Equals(HintPlacement obj) - { - return YCoordinate == obj.YCoordinate && XCoordinate == obj.XCoordinate; - } - - - public HintPlacement(float xCoordinate, float yCoordinate, HintAlignment alignment = HintAlignment.Center) - { - YCoordinate = yCoordinate; - XCoordinate = xCoordinate; - HintAlignment = alignment; - } - - } -} diff --git a/KruacentExiled/KE.Utils/API/GifAnimator/RenderGif.cs b/KruacentExiled/KE.Utils/API/GifAnimator/RenderGif.cs deleted file mode 100644 index f4276d33..00000000 --- a/KruacentExiled/KE.Utils/API/GifAnimator/RenderGif.cs +++ /dev/null @@ -1,128 +0,0 @@ -using System.Collections.Generic; -using System.Drawing; -using System.Drawing.Imaging; -using System.IO; -using Exiled.API.Features; -using Exiled.API.Features.Toys; -using MEC; -using UnityEngine; -using UnityEngine.Rendering; -using Color = UnityEngine.Color; -namespace KE.Utils.API.GifAnimator -{ - internal class RenderGif - { - - public static void Spawn() - { - - } - - - - private static IEnumerator RenderImageCoroutine(object target, string filePath, float maxWidth, float maxHeight, float distance, float duration, int targetWidth, int targetHeight) - { - if (!File.Exists(filePath)) - { - Log.Debug($"No image was found under: {filePath}"); - yield break; - } - - byte[] imageData = File.ReadAllBytes(filePath); - - - - - - - Texture2D original = new Texture2D(2, 2); - - - try - { - original.LoadRawTextureData(imageData); - } - catch(UnityException) - { - Log.Debug("Image couldnt be loaded."); - yield break; - } - - Texture2D scaled = new Texture2D(targetWidth, targetHeight, TextureFormat.RGBA32, false); - - for (int x = 0; x < targetWidth; x++) - { - for (int y = 0; y < targetHeight; y++) - { - float u = x / (float)targetWidth; - float v = y / (float)targetHeight; - Color color = original.GetPixelBilinear(u, v); - scaled.SetPixel(x, y, color); - } - } - scaled.Apply(); - - float pixelScaleX = maxWidth / targetWidth; - float pixelScaleY = maxHeight / targetHeight; - float scale = Mathf.Min(pixelScaleX, pixelScaleY); - - Vector3 forwardOrigin; - Quaternion rotation = Quaternion.identity; - - if (target is Exiled.API.Features.Player player) - { - forwardOrigin = player.CameraTransform.position + player.CameraTransform.forward * distance; - - Vector3 directionToPlayer = forwardOrigin - player.CameraTransform.position; - directionToPlayer.y = 0; - rotation = Quaternion.LookRotation(directionToPlayer); - } - else if (target is Vector3 position) - { - forwardOrigin = position + Vector3.forward * distance; - Vector3 directionToPosition = forwardOrigin - position; - directionToPosition.y = 0; - rotation = Quaternion.LookRotation(directionToPosition); - } - else if (target is Room room) - { - forwardOrigin = room.Position + Vector3.up * 2f; - Vector3 directionToRoom = forwardOrigin - room.Position; - directionToRoom.y = 0; - rotation = Quaternion.LookRotation(directionToRoom); - } - else - { - Log.Debug("Invalid object type. Valid types: Player, Vector3, Room"); - yield break; - } - - Vector3 offset = new Vector3((targetWidth * scale) / 2f, (targetHeight * scale) / 2f, 0); - - for (int x = 0; x < targetWidth; x++) - { - for (int y = 0; y < targetHeight; y++) - { - Color pixelColor = scaled.GetPixel(x, y); - if (pixelColor.a < 0.1f) - continue; - - Vector3 localOffset = new Vector3(x * scale, y * scale, 0) - offset; - Vector3 worldPos = forwardOrigin + rotation * localOffset; - - Primitive quad = Primitive.Create(PrimitiveType.Quad); - quad.Position = worldPos; - quad.Scale = new Vector3(scale, scale, scale * 0.01f); - quad.Color = pixelColor; - - Quaternion fixedRotation = Quaternion.Euler(0f, rotation.eulerAngles.y, 0f); - quad.Rotation = fixedRotation; - quad.Flags = AdminToys.PrimitiveFlags.Visible; - } - - yield return Timing.WaitForOneFrame; - } - } - - } -} diff --git a/KruacentExiled/KE.Utils/API/Interfaces/IEvents.cs b/KruacentExiled/KE.Utils/API/Interfaces/IEvents.cs deleted file mode 100644 index e573b062..00000000 --- a/KruacentExiled/KE.Utils/API/Interfaces/IEvents.cs +++ /dev/null @@ -1,17 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace KE.Utils.API.Interfaces -{ - public interface IUsingEvents - { - - - public void SubscribeEvents(); - - public void UnsubscribeEvents(); - } -} diff --git a/KruacentExiled/KE.Utils/API/Interfaces/ILoadable.cs b/KruacentExiled/KE.Utils/API/Interfaces/ILoadable.cs deleted file mode 100644 index c9e00399..00000000 --- a/KruacentExiled/KE.Utils/API/Interfaces/ILoadable.cs +++ /dev/null @@ -1,13 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace KE.Utils.API.Interfaces -{ - public interface ILoadable - { - public string Loadable(char separator); - } -} diff --git a/KruacentExiled/KE.Utils/API/Models/Arrows/Arrow.cs b/KruacentExiled/KE.Utils/API/Models/Arrows/Arrow.cs deleted file mode 100644 index 990999c7..00000000 --- a/KruacentExiled/KE.Utils/API/Models/Arrows/Arrow.cs +++ /dev/null @@ -1,58 +0,0 @@ -using Exiled.API.Features.Toys; -using InventorySystem.Items.Keycards; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Net.Sockets; -using System.Text; -using System.Threading.Tasks; -using UnityEngine; - -namespace KE.Utils.API.Models.Arrows -{ - internal abstract class Arrow - { - internal static HashSet List = new(); - internal abstract Vector3 Offset { get; } - internal abstract Vector3 Rotation { get; } - internal abstract Color Color { get; } - - protected readonly Vector3 scale = new Vector3(1f, .1f, .1f); - - private Primitive _primitive; - - internal Primitive Primitive - { - get { return _primitive; } - } - internal Arrow() - { - List.Add(this); - _primitive = Primitive.Create(PrimitiveType.Cube, null, Rotation, scale); - _primitive.Color = Color; - } - - internal void Move(Vector3 newPos) - { - _primitive.Position = newPos + Offset; - } - - internal static bool IsPrimitiveArrow(Primitive p) - { - Arrow a =GetArrow(p); - return a != null; - } - - internal static Arrow GetArrow(Primitive p) - { - - foreach(Arrow a in List) - { - if (p == a.Primitive) - return a; - } - return null; - - } - } -} diff --git a/KruacentExiled/KE.Utils/API/Models/Arrows/MoveArrow.cs b/KruacentExiled/KE.Utils/API/Models/Arrows/MoveArrow.cs deleted file mode 100644 index f3216e7f..00000000 --- a/KruacentExiled/KE.Utils/API/Models/Arrows/MoveArrow.cs +++ /dev/null @@ -1,12 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace KE.Utils.API.Models.Arrows -{ - internal class MoveArrow - { - } -} diff --git a/KruacentExiled/KE.Utils/API/Models/Arrows/RotateArrow.cs b/KruacentExiled/KE.Utils/API/Models/Arrows/RotateArrow.cs deleted file mode 100644 index 518fb4b5..00000000 --- a/KruacentExiled/KE.Utils/API/Models/Arrows/RotateArrow.cs +++ /dev/null @@ -1,12 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace KE.Utils.API.Models.Arrows -{ - internal class RotateArrow - { - } -} diff --git a/KruacentExiled/KE.Utils/API/Models/Arrows/ScaleArrow.cs b/KruacentExiled/KE.Utils/API/Models/Arrows/ScaleArrow.cs deleted file mode 100644 index 99bf7d55..00000000 --- a/KruacentExiled/KE.Utils/API/Models/Arrows/ScaleArrow.cs +++ /dev/null @@ -1,12 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace KE.Utils.API.Models.Arrows -{ - internal class ScaleArrow - { - } -} diff --git a/KruacentExiled/KE.Utils/API/Models/Arrows/XArrow.cs b/KruacentExiled/KE.Utils/API/Models/Arrows/XArrow.cs deleted file mode 100644 index 073802c3..00000000 --- a/KruacentExiled/KE.Utils/API/Models/Arrows/XArrow.cs +++ /dev/null @@ -1,16 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using UnityEngine; - -namespace KE.Utils.API.Models.Arrows -{ - internal class XArrow : Arrow - { - internal override Vector3 Offset => new Vector3(scale.x / 2,0); - internal override Vector3 Rotation => new Vector3(0, 0f, 0f); - internal override Color Color => Color.red; - } -} diff --git a/KruacentExiled/KE.Utils/API/Models/Arrows/YArrow.cs b/KruacentExiled/KE.Utils/API/Models/Arrows/YArrow.cs deleted file mode 100644 index e437766e..00000000 --- a/KruacentExiled/KE.Utils/API/Models/Arrows/YArrow.cs +++ /dev/null @@ -1,16 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using UnityEngine; - -namespace KE.Utils.API.Models.Arrows -{ - internal class YArrow : Arrow - { - internal override Vector3 Offset => new Vector3(0, scale.x / 2); - internal override Vector3 Rotation => new Vector3(0, 0f, 90f); - internal override Color Color => Color.green; - } -} diff --git a/KruacentExiled/KE.Utils/API/Models/Arrows/ZArrow.cs b/KruacentExiled/KE.Utils/API/Models/Arrows/ZArrow.cs deleted file mode 100644 index 30c27866..00000000 --- a/KruacentExiled/KE.Utils/API/Models/Arrows/ZArrow.cs +++ /dev/null @@ -1,16 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using UnityEngine; - -namespace KE.Utils.API.Models.Arrows -{ - internal class ZArrow : Arrow - { - internal override Vector3 Offset => new Vector3(0,0, scale.x / 2); - internal override Vector3 Rotation => new Vector3(0, 90f, 0); - internal override Color Color => Color.blue; - } -} diff --git a/KruacentExiled/KE.Utils/API/Models/Blueprints/AdminToyBlueprint.cs b/KruacentExiled/KE.Utils/API/Models/Blueprints/AdminToyBlueprint.cs deleted file mode 100644 index ccfcff3d..00000000 --- a/KruacentExiled/KE.Utils/API/Models/Blueprints/AdminToyBlueprint.cs +++ /dev/null @@ -1,69 +0,0 @@ -using Exiled.API.Enums; -using Exiled.API.Features.Toys; -using Exiled.API.Interfaces; -using KE.Utils.API.Interfaces; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using UnityEngine; -using Light = Exiled.API.Features.Toys.Light; - -namespace KE.Utils.API.Models.Blueprints -{ - public abstract class AdminToyBlueprint : ILoadable - { - public AdminToyType AdminToyType { get; protected set; } - //local position - public Vector3 Position { get; protected set; } - public Vector3 Rotation { get; protected set; } - public Vector3 Scale { get; protected set; } - - - public static AdminToyBlueprint Create(AdminToy adminToy, Vector3? center = null) - { - AdminToyBlueprint result; - - - if (adminToy.ToyType == AdminToyType.PrimitiveObject) - { - result = new PrimitiveBlueprint(adminToy as Primitive); - - } - else if(adminToy.ToyType == AdminToyType.LightSource) - { - result = new LightBlueprint(adminToy as Light); - } - else - { - throw new NotImplementedException("only primitive and light"); - } - - result.Position = adminToy.Position - center ?? adminToy.Position; - result.Rotation = adminToy.Rotation.eulerAngles; - - return result; - } - - - public string Loadable(char separator) - { - StringBuilder b = new(); - b.Append(AdminToyType.ToString()); - b.Append(separator); - b.Append(Position); - b.Append(separator); - b.Append(Rotation); - b.Append(separator); - b.Append(Scale); - b.Append(separator); - b.Append(Load(separator)); - - - return b.ToString(); - } - public abstract AdminToy Spawn(Vector3 center); - protected abstract string Load(char separator); - } -} diff --git a/KruacentExiled/KE.Utils/API/Models/Blueprints/LightBlueprint.cs b/KruacentExiled/KE.Utils/API/Models/Blueprints/LightBlueprint.cs deleted file mode 100644 index 1dc91294..00000000 --- a/KruacentExiled/KE.Utils/API/Models/Blueprints/LightBlueprint.cs +++ /dev/null @@ -1,37 +0,0 @@ -using Exiled.API.Enums; -using Exiled.API.Features.Toys; -using UnityEngine; -using Light = Exiled.API.Features.Toys.Light; - -namespace KE.Utils.API.Models.Blueprints -{ - public class LightBlueprint : AdminToyBlueprint - { - public Color Color { get; } - public float Intensity { get; } - - public LightBlueprint(Light l) - { - AdminToyType = AdminToyType.PrimitiveObject; - Scale = l.Scale; - Color = l.Color; - Intensity = l.Intensity; - } - - - public override AdminToy Spawn(Vector3 center) - { - var l = Light.Create(Position+center, Rotation, Scale, false); - l.Color = Color; - l.Intensity = Intensity; - - - return l; - } - - protected override string Load(char separator) - { - return "#" + ColorUtility.ToHtmlStringRGBA(Color) + separator + Intensity; - } - } -} diff --git a/KruacentExiled/KE.Utils/API/Models/Blueprints/ModelBlueprint.cs b/KruacentExiled/KE.Utils/API/Models/Blueprints/ModelBlueprint.cs deleted file mode 100644 index 0f3a047c..00000000 --- a/KruacentExiled/KE.Utils/API/Models/Blueprints/ModelBlueprint.cs +++ /dev/null @@ -1,110 +0,0 @@ -using Exiled.API.Features; -using Exiled.API.Features.Core; -using Exiled.API.Features.Doors; -using Exiled.API.Features.Toys; -using Exiled.API.Structs; -using KE.Utils.API.Models.ToysSettings; -using KE.Utils.Quality.Models; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Runtime.InteropServices; -using UnityEngine; -using Light = Exiled.API.Features.Toys.Light; - -namespace KE.Utils.API.Models.Blueprints -{ - public class ModelBlueprint - { - private static List _bps = new(); - public static List Blueprints => _bps.ToList(); - private HashSet _toys = new(); - public IReadOnlyCollection Toys => [.. _toys]; - private string _name; - public string Name - { - get { return _name; } - } - - private ModelBlueprint() { } - - - - /// - /// - /// - /// - /// - public static ModelBlueprint Create(Model model) - { - var oldMbp = Get(model.Name); - _bps.Remove(oldMbp); - - - ModelBlueprint mbp = new(); - mbp._name = model.Name; - _bps.Add(mbp); - - foreach(AdminToy toy in model.Toys) - { - mbp._toys.Add(AdminToyBlueprint.Create(toy,model.Center)); - } - - return mbp; - } - - - public static ModelBlueprint Create(string name,IEnumerable toys = null) - { - ModelBlueprint mbp = new(); - _bps.Add(mbp); - - if (string.IsNullOrEmpty(name)) - { - throw new ArgumentException("name null or empty"); - } - - if(toys != null) - { - foreach(AdminToy at in toys) - { - mbp._toys.Add(AdminToyBlueprint.Create(at)); - } - } - - - - mbp._name = name; - - return mbp; - } - - public void Spawn(Vector3 position) - { - Model m = Model.Create(this, position,false); - - - } - - - #region getters - public static ModelBlueprint Get(string name) - { - foreach (ModelBlueprint m in Blueprints) - { - if (m.Name == name) - { - return m; - } - } - return null; - } - - public static bool TryGet(string name, out ModelBlueprint model) - { - model = Get(name); - return model != null; - } - #endregion - } -} diff --git a/KruacentExiled/KE.Utils/API/Models/Blueprints/PrimitiveBlueprint.cs b/KruacentExiled/KE.Utils/API/Models/Blueprints/PrimitiveBlueprint.cs deleted file mode 100644 index 2e59f30a..00000000 --- a/KruacentExiled/KE.Utils/API/Models/Blueprints/PrimitiveBlueprint.cs +++ /dev/null @@ -1,39 +0,0 @@ -using Exiled.API.Enums; -using Exiled.API.Features.Toys; -using UnityEngine; - -namespace KE.Utils.API.Models.Blueprints -{ - public class PrimitiveBlueprint : AdminToyBlueprint - { - public Color Color { get; } - public PrimitiveType Type { get; } - - - public PrimitiveBlueprint(Primitive p) - { - AdminToyType = AdminToyType.PrimitiveObject; - - Scale = p.Scale; - Color = p.Color; - Type = p.Type; - } - - - - public override AdminToy Spawn(Vector3 center) - { - var p = Primitive.Create(Type,Position+center, Rotation, Scale, false); - p.Collidable = false; - p.Color = Color; - - - return p; - } - - protected override string Load(char separator) - { - return "#" + ColorUtility.ToHtmlStringRGBA(Color) + separator+Type; - } - } -} diff --git a/KruacentExiled/KE.Utils/API/Models/Commands/AllCommands.cs b/KruacentExiled/KE.Utils/API/Models/Commands/AllCommands.cs deleted file mode 100644 index 8ba12e68..00000000 --- a/KruacentExiled/KE.Utils/API/Models/Commands/AllCommands.cs +++ /dev/null @@ -1,33 +0,0 @@ -using CommandSystem; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Reflection; -using System.Text; -using System.Threading.Tasks; - -namespace KE.Utils.API.Models.Commands -{ - public static class AllCommands - { - - public static IEnumerable Get(Assembly assembly = null) - { - return new List() - { - new ChangeColor(), - new ChangePrimType(), - new CreateModel(), - new CreatePrim(), - new ListModel(), - new LoadModel(), - new ModeMovePrim(), - new SelectModel(), - new ShowCenter(), - new SaveModel() - - }; - - } - } -} diff --git a/KruacentExiled/KE.Utils/API/Models/Commands/ChangeColor.cs b/KruacentExiled/KE.Utils/API/Models/Commands/ChangeColor.cs deleted file mode 100644 index 3b78d218..00000000 --- a/KruacentExiled/KE.Utils/API/Models/Commands/ChangeColor.cs +++ /dev/null @@ -1,72 +0,0 @@ -using CommandSystem; -using Exiled.API.Features; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using KE.Utils.API.Models; -using UnityEngine; -using Exiled.API.Features.Toys; - -namespace KE.Utils.API.Models.Commands -{ - public class ChangeColor : ICommand - { - - public string Command { get; } = "changecolor"; - - public string[] Aliases { get; } = { "cc" }; - - public string Description { get; } = "change color rgba (0-255)"; - - public bool Execute(ArraySegment arguments, ICommandSender sender, out string response) - { - Player p = Player.Get(sender); - if (p == null) - { - response = "This player can't do this command"; - return false; - } - - if (arguments.Count < 3) - { - response = "not enough arguments"; - return false; - } - if(!byte.TryParse(arguments.At(0),out byte r) || - !byte.TryParse(arguments.At(1), out byte g) || - !byte.TryParse(arguments.At(2), out byte b)) - { - response = "number between 0 & 255"; - return false; - } - - Color32 c; - - if(arguments.Count > 3 && byte.TryParse(arguments.At(3),out byte a)) - { - c = new Color32(r, g, b, a); - } - else - { - c = new Color32(r, g, b,255); - } - - Primitive prim = Models.Instance.ModelCreator.ModelHandler.SelectedPrimitive; - - if(prim == null) - { - response = "no primitive selected"; - return false; - } - - prim.Color = c; - - - response = $"new color set to " + c.ToString(); - return true; - } - - } -} diff --git a/KruacentExiled/KE.Utils/API/Models/Commands/ChangePrimType.cs b/KruacentExiled/KE.Utils/API/Models/Commands/ChangePrimType.cs deleted file mode 100644 index 434427df..00000000 --- a/KruacentExiled/KE.Utils/API/Models/Commands/ChangePrimType.cs +++ /dev/null @@ -1,53 +0,0 @@ -using CommandSystem; -using Exiled.API.Features; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using KE.Utils.API.Models; -using UnityEngine; - -namespace KE.Utils.API.Models.Commands -{ - public class ChangePrimType : ICommand - { - - public string Command { get; } = "changeprimtype"; - - public string[] Aliases { get; } = { "cpt" }; - - public string Description { get; } = "select the mode : scale,move,rotate"; - - public bool Execute(ArraySegment arguments, ICommandSender sender, out string response) - { - Player p = Player.Get(sender); - if (p == null) - { - response = "This player can't do this command"; - return false; - } - - if (arguments.Count < 1) - { - response = "not enough arguments"; - return false; - } - string type = arguments.At(0); - - - if(!Enum.TryParse(type, out PrimitiveType prim)) - { - response = "wrong argument"; - return false; - } - - - Models.Instance.ModelCreator.ModelHandler.SelectedPrimitive.Type = prim; - - response = $"Mode set to " + prim ; - return true; - } - - } -} diff --git a/KruacentExiled/KE.Utils/API/Models/Commands/CreateModel.cs b/KruacentExiled/KE.Utils/API/Models/Commands/CreateModel.cs deleted file mode 100644 index d549cb50..00000000 --- a/KruacentExiled/KE.Utils/API/Models/Commands/CreateModel.cs +++ /dev/null @@ -1,44 +0,0 @@ -using CommandSystem; -using Exiled.API.Features; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace KE.Utils.API.Models.Commands -{ - public class CreateModel : ICommand - { - - public string Command { get; } = "create"; - - public string[] Aliases { get; } = { "c" }; - - public string Description { get; } = "create a new model at your position"; - - public bool Execute(ArraySegment arguments, ICommandSender sender, out string response) - { - - Player p = Player.Get(sender); - if (p == null) - { - response = "This player can't do this command"; - return false; - } - - if (arguments.Count < 1) - { - response = "not enough arguments"; - return false; - } - string name = arguments.At(0); - - Model m = Model.Create(p.Position, name); - Models.Instance.ModelCreator.ModelHandler.SelectedModel = m; - response = $"Created & selected model ({m.Name}) at {m.Center}"; - return true; - } - - } -} diff --git a/KruacentExiled/KE.Utils/API/Models/Commands/CreatePrim.cs b/KruacentExiled/KE.Utils/API/Models/Commands/CreatePrim.cs deleted file mode 100644 index edcd6306..00000000 --- a/KruacentExiled/KE.Utils/API/Models/Commands/CreatePrim.cs +++ /dev/null @@ -1,47 +0,0 @@ -using CommandSystem; -using Exiled.API.Features; -using Exiled.API.Features.Toys; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace KE.Utils.API.Models.Commands -{ - public class CreatePrim : ICommand - { - - public string Command { get; } = "createprimitive"; - - public string[] Aliases { get; } = { "cp" }; //no not like that - - public string Description { get; } = "create a new primitive at your position"; - - public bool Execute(ArraySegment arguments, ICommandSender sender, out string response) - { - - Player p = Player.Get(sender); - if (p == null) - { - response = "This player can't do this command"; - return false; - } - - - Model m = Models.Instance.ModelCreator.SelectedModel; - - if (m == null) - { - response = "no model selected"; - return false; - } - m.Add(p.Position); - - - response = "created!"; - return true; - } - - } -} diff --git a/KruacentExiled/KE.Utils/API/Models/Commands/ListModel.cs b/KruacentExiled/KE.Utils/API/Models/Commands/ListModel.cs deleted file mode 100644 index 79f42597..00000000 --- a/KruacentExiled/KE.Utils/API/Models/Commands/ListModel.cs +++ /dev/null @@ -1,42 +0,0 @@ -using CommandSystem; -using Exiled.API.Features; -using KE.Utils.API.Models.Blueprints; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace KE.Utils.API.Models.Commands -{ - public class ListModel : ICommand - { - - public string Command { get; } = "list"; - - public string[] Aliases { get; } = { "l" }; - - public string Description { get; } = "create a new model at your position"; - - public bool Execute(ArraySegment arguments, ICommandSender sender, out string response) - { - StringBuilder b = new(); - b.AppendLine($"Models ({Model.Models.Count}) :"); - foreach (Model m in Model.Models) - { - b.AppendLine($"{m.Name} pos: {m.Center} spawned? :{m.Spawned}"); - } - - b.AppendLine($"Blueprints ({ModelBlueprint.Blueprints.Count}) :"); - foreach (ModelBlueprint m in ModelBlueprint.Blueprints) - { - b.AppendLine($"{m.Name}"); - } - - - response = b.ToString(); - return true; - } - - } -} diff --git a/KruacentExiled/KE.Utils/API/Models/Commands/LoadModel.cs b/KruacentExiled/KE.Utils/API/Models/Commands/LoadModel.cs deleted file mode 100644 index 7be25565..00000000 --- a/KruacentExiled/KE.Utils/API/Models/Commands/LoadModel.cs +++ /dev/null @@ -1,65 +0,0 @@ -using CommandSystem; -using Exiled.API.Features; -using KE.Utils.API.Models.Blueprints; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using System.Xml.Linq; - -namespace KE.Utils.API.Models.Commands -{ - public class LoadModel : ICommand - { - - public string Command { get; } = "load"; - - public string[] Aliases { get; } = { "lo" }; - - public string Description { get; } = "load a model from a blueprint"; - - public bool Execute(ArraySegment arguments, ICommandSender sender, out string response) - { - - Player p = Player.Get(sender); - if (p == null) - { - response = "This player can't do this command"; - return false; - } - - if (arguments.Count < 1) - { - response = "not enough arguments"; - return false; - } - - string name = arguments.At(0); - - if (string.IsNullOrEmpty(name)) - { - response = "name null or empty"; - return false; - } - - foreach(ModelBlueprint bp in ModelBlueprint.Blueprints) - { - - Log.Info($"{bp.Name} == {name} : {bp.Name == name}"); - } - - - if(!ModelBlueprint.TryGet(name,out var mbp)) - { - response = "blueprint not found"; - return false; - } - - mbp.Spawn(p.Position); - response = $"Created model ({mbp.Name}) at {p.Position}"; - return true; - } - - } -} diff --git a/KruacentExiled/KE.Utils/API/Models/Commands/ModeMovePrim.cs b/KruacentExiled/KE.Utils/API/Models/Commands/ModeMovePrim.cs deleted file mode 100644 index 2b9ea091..00000000 --- a/KruacentExiled/KE.Utils/API/Models/Commands/ModeMovePrim.cs +++ /dev/null @@ -1,64 +0,0 @@ -using CommandSystem; -using Exiled.API.Features; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using KE.Utils.API.Models; - -namespace KE.Utils.API.Models.Commands -{ - public class ModeMovePrim : ICommand - { - - public string Command { get; } = "mode"; - - public string[] Aliases { get; } = { "m" }; - - public string Description { get; } = "select the mode : scale,move,rotate"; - - public bool Execute(ArraySegment arguments, ICommandSender sender, out string response) - { - Player p = Player.Get(sender); - if (p == null) - { - response = "This player can't do this command"; - return false; - } - - if (arguments.Count < 1) - { - response = "not enough arguments"; - return false; - } - string mode = arguments.At(0); - - switch(mode) - { - case "m": - case "move": - Models.Instance.ModelCreator.MovementMode = MovementMode.Move; - break; - case "s": - case "scale": - Models.Instance.ModelCreator.MovementMode = MovementMode.Scale; - break; - case "r": - case "rotate": - Models.Instance.ModelCreator.MovementMode = MovementMode.Rotate; - break; - default: - response = "wrong argument"; - return false; - - - } - - - response = $"Mode set to " + Models.Instance.ModelCreator.MovementMode.ToString(); - return true; - } - - } -} diff --git a/KruacentExiled/KE.Utils/API/Models/Commands/SaveModel.cs b/KruacentExiled/KE.Utils/API/Models/Commands/SaveModel.cs deleted file mode 100644 index d40048e5..00000000 --- a/KruacentExiled/KE.Utils/API/Models/Commands/SaveModel.cs +++ /dev/null @@ -1,47 +0,0 @@ -using CommandSystem; -using Exiled.API.Features; -using KE.Utils.API.Models.Blueprints; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using System.Xml.Linq; - -namespace KE.Utils.API.Models.Commands -{ - public class SaveModel : ICommand - { - - public string Command { get; } = "save"; - - public string[] Aliases { get; } = { "sa" }; - - public string Description { get; } = "save a model to file"; - - public bool Execute(ArraySegment arguments, ICommandSender sender, out string response) - { - - Player p = Player.Get(sender); - if (p == null) - { - response = "This player can't do this command"; - return false; - } - - - Model model = Models.Instance.ModelCreator.SelectedModel; - if (model == null) - { - response = "no model selected"; - return false; - } - - model.Save(); - - response = $"Saved ({model.Name})"; - return true; - } - - } -} diff --git a/KruacentExiled/KE.Utils/API/Models/Commands/SelectModel.cs b/KruacentExiled/KE.Utils/API/Models/Commands/SelectModel.cs deleted file mode 100644 index 266ce4d4..00000000 --- a/KruacentExiled/KE.Utils/API/Models/Commands/SelectModel.cs +++ /dev/null @@ -1,56 +0,0 @@ -using CommandSystem; -using Exiled.API.Features; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace KE.Utils.API.Models.Commands -{ - public class SelectModel : ICommand - { - - public string Command { get; } = "select"; - - public string[] Aliases { get; } = { "s" }; - - public string Description { get; } = "select an existing model"; - - public bool Execute(ArraySegment arguments, ICommandSender sender, out string response) - { - - Player p = Player.Get(sender); - if (p == null) - { - response = "This player can't do this command"; - return false; - } - if (arguments.Count < 1) - { - response = "not enough arguments"; - return false; - } - string name = arguments.At(0); - - if (string.IsNullOrEmpty(name)) - { - response = "name null or empty"; - return false; - } - - - - - if (!Model.TryGet(name, out Model m)) - { - response = "model not found"; - return false; - } - response = $"model ({m.Name}) selected {m.Center}"; - Models.Instance.ModelCreator.ModelHandler.SelectedModel = m; - return true; - } - - } -} diff --git a/KruacentExiled/KE.Utils/API/Models/Commands/ShowCenter.cs b/KruacentExiled/KE.Utils/API/Models/Commands/ShowCenter.cs deleted file mode 100644 index 7b6cc05e..00000000 --- a/KruacentExiled/KE.Utils/API/Models/Commands/ShowCenter.cs +++ /dev/null @@ -1,51 +0,0 @@ -using CommandSystem; -using Exiled.API.Features; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace KE.Utils.API.Models.Commands -{ - public class ShowCenter : ICommand - { - - public string Command { get; } = "show"; - - public string[] Aliases { get; } = { "sh" }; - - public string Description { get; } = "toggle the center of the model"; - - public bool Execute(ArraySegment arguments, ICommandSender sender, out string response) - { - - Player p = Player.Get(sender); - if (p == null) - { - response = "This player can't do this command"; - return false; - } - - Model m = Models.Instance.ModelCreator.ModelHandler.SelectedModel; - - if(m == null) - { - response = "no model selected"; - return false; - } - - if(!bool.TryParse(arguments.At(0),out bool result)) - { - response = "write true or false"; - return false; - } - - m.SetCenterPrimitive(result); - - response = "done"; - - return true; - } - } -} diff --git a/KruacentExiled/KE.Utils/API/Models/Model.cs b/KruacentExiled/KE.Utils/API/Models/Model.cs deleted file mode 100644 index 6e84fbc9..00000000 --- a/KruacentExiled/KE.Utils/API/Models/Model.cs +++ /dev/null @@ -1,202 +0,0 @@ -using Exiled.API.Features; -using Exiled.API.Features.Toys; -using KE.Utils.API.Models.Blueprints; -using System; -using System.Collections.Generic; -using System.Linq; -using UnityEngine; - -namespace KE.Utils.API.Models -{ - public class Model - { - private static List _models = new(); - public static List Models => _models.ToList(); - - private HashSet _toys = new(); - public IReadOnlyCollection Toys => [.. _toys]; - private string _name; - public string Name - { - get { return _name; } - } - - private Vector3 _center; - public Vector3 Center - { - get { return _center; } - } - private bool _spawned = true; - public bool Spawned - { - get { return _spawned; } - } - - private ModelBlueprint _blueprint; - - public ModelBlueprint Blueprint - { - get { return _blueprint; } - } - - public bool LoadedFromBlueprint - { - get - { - return Blueprint != null; - } - } - - - - - - internal Primitive centerPrim; - - public void SetCenterPrimitive(bool show) - { - if (show) - { - centerPrim.Spawn(); - } - else - { - centerPrim.UnSpawn(); - } - } - - - - public Primitive Add(Vector3 pos) - { - var p = Primitive.Create(pos, null, null, true); - - AddToy(p); - return p; - } - - - protected virtual void AddToy(AdminToy toy,bool editMode = true) - { - if(toy is Primitive p && editMode) - { - p.Collidable = true; - } - - - _toys.Add(toy); - } - - private Model(Vector3 center) - { - _models.Add(this); - _center = center; - } - - public static Model Create(Vector3 position, string name) - { - - Model m = new(position); - if (string.IsNullOrEmpty(name)) - { - throw new ArgumentException("name null or empty"); - } - m._name = name; - - Log.Debug("created model id=" + m.Name); - m.centerPrim = Primitive.Create(position, null, Vector3.one / 5, true, new(1, 0, 0, .25f)); - m.centerPrim.Collidable = false; - - return m; - } - - - public static Model Create(ModelBlueprint blueprint,Vector3 position,bool editMode = false) - { - Model m = new(position); - m._name = blueprint.Name; - - foreach (AdminToyBlueprint toy in blueprint.Toys) - { - Log.Info("create toy "+toy.AdminToyType); - AdminToy trueToy = toy.Spawn(m.Center); - - - m.AddToy(trueToy, editMode); - - } - - return m; - - } - - /// - /// Create a based of this

- /// Note : will overwrite the old blueprint - ///
- public void CreateBlueprint() - { - ModelBlueprint bp = ModelBlueprint.Create(this); - - _blueprint = bp; - - } - - - #region getter - public static Model Get(string name) - { - foreach (Model m in _models) - { - if (m.Name == name) - { - return m; - } - } - return null; - } - - public static bool TryGet(string name, out Model model) - { - model = Get(name); - return model != null; - } - - - public override string ToString() - { - return $"{Name} center = {Center}"; - } - #endregion - - #region spawn - public void Spawn() - { - foreach (AdminToy t in Toys) - { - t.Spawn(); - } - _spawned = true; - } - public void UnSpawn() - { - foreach (AdminToy t in Toys) - { - t.UnSpawn(); - } - _spawned = false; - } - - public void Destroy() - { - foreach (AdminToy t in Toys) - { - t.Destroy(); - } - _models.Remove(this); - - } - - #endregion - } -} diff --git a/KruacentExiled/KE.Utils/API/Models/ModelCreator.cs b/KruacentExiled/KE.Utils/API/Models/ModelCreator.cs deleted file mode 100644 index 85758ad9..00000000 --- a/KruacentExiled/KE.Utils/API/Models/ModelCreator.cs +++ /dev/null @@ -1,175 +0,0 @@ -using AdminToys; -using Exiled.API.Features; -using Exiled.API.Features.Items; -using Exiled.API.Features.Toys; -using Exiled.Events.EventArgs.Player; -using KE.Utils.API.Interfaces; -using KE.Utils.API.Models.Arrows; -using MEC; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Runtime.InteropServices; -using System.Text; -using System.Threading.Tasks; -using UnityEngine; - -namespace KE.Utils.API.Models -{ - public class ModelCreator : IUsingEvents - { - - - public const ItemType item = ItemType.GunCOM18; - - public Model SelectedModel - { - get - { - return ModelHandler.SelectedModel; - } - } - public MovementMode MovementMode - { - get - { - return MovementHandler.Mode; - } - set - { - MovementHandler.Mode = value; - } - } - internal MovementHandler MovementHandler { get; private set; } - internal ModelSelection ModelHandler { get; private set; } - - private bool mode = false; - private const float MAX_DISTANCE = 50; - - public static event Action IsAiming; - public static event Action StoppedAiming; - - - - public ModelCreator() - { - - } - - public void SubscribeEvents() - { - - ModelHandler = new(); - MovementHandler = new(); - - ModelLoader.LoadAll(); - MovementHandler.SubscribeEvents(); - Exiled.Events.Handlers.Player.DryfiringWeapon += OnDryfiringWeapon; - Exiled.Events.Handlers.Player.TogglingWeaponFlashlight += OnTogglingWeaponFlashlight; - Exiled.Events.Handlers.Server.RoundStarted += Test; - Exiled.Events.Handlers.Player.AimingDownSight += OnAimingDownSight; - - } - public void UnsubscribeEvents() - { - Exiled.Events.Handlers.Player.DryfiringWeapon -= OnDryfiringWeapon; - Exiled.Events.Handlers.Player.TogglingWeaponFlashlight -= OnTogglingWeaponFlashlight; - Exiled.Events.Handlers.Player.AimingDownSight -= OnAimingDownSight; - Exiled.Events.Handlers.Server.RoundStarted -= Test; - MovementHandler.UnsubscribeEvents(); - - ModelHandler = null; - MovementHandler = null; - } - - private void Test() - { - foreach (var p in Player.List) - { - p.Role.Set(PlayerRoles.RoleTypeId.ChaosConscript); - Timing.CallDelayed(.1f, () => - { - var a = p.AddItem(item); - var b = a as Firearm; - b.MagazineAmmo = 2; - - Primitive.Create(p.Position + Vector3.back, null, null, true, Color.red); - Primitive.Create(p.Position + Vector3.forward, null, null, true, Color.green); - }); - } - } - - - - - private void OnAimingDownSight(AimingDownSightEventArgs ev) - { - if (ev.AdsIn) - { - IsAiming?.Invoke(ev.Player); - } - else - { - StoppedAiming?.Invoke(); - } - } - - private void OnDryfiringWeapon(DryfiringWeaponEventArgs ev) - { - if (ev.Firearm.Type != item) return; - Log.Info("new mode = " + mode); - - if (!mode) - { - - mode = !mode; - } - - - - } - - private void OnTogglingWeaponFlashlight(TogglingWeaponFlashlightEventArgs ev) - { - if (ev.Firearm.Type != item) return; - - - - Primitive p = GetFacingPrimitive(ev.Player); - if (!Arrow.IsPrimitiveArrow(p)) - { - ModelHandler.ChangedSelectedPrim(p); - } - - } - - internal static Primitive GetFacingPrimitive(Player player) - { - Transform cam = player.CameraTransform; - - Vector3 origin = cam.position + cam.forward * 0.5f; - Ray r = new Ray(origin, cam.forward); - if (Physics.Raycast(r, out RaycastHit hit, MAX_DISTANCE)) - { - Log.Info($"hit ({hit.collider.name})"); - PrimitiveObjectToy pot = hit.collider.GetComponentInParent() ?? hit.collider.GetComponentInChildren(); - if (pot != null) - { - return Primitive.Get(pot); - - - } - } - return null; - } - - - - } - public enum MovementMode - { - Move, - Scale, - Rotate - } -} diff --git a/KruacentExiled/KE.Utils/API/Models/ModelLoader.cs b/KruacentExiled/KE.Utils/API/Models/ModelLoader.cs deleted file mode 100644 index d4c60464..00000000 --- a/KruacentExiled/KE.Utils/API/Models/ModelLoader.cs +++ /dev/null @@ -1,152 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.IO; -using Exiled.API.Features; -using Exiled.API.Features.Toys; -using UnityEngine; -using Light = Exiled.API.Features.Toys.Light; -using Exiled.API.Enums; -using KE.Utils.API.Models.Blueprints; -namespace KE.Utils.API.Models -{ - public static class ModelLoader - { - public static string Path => Paths.Configs + @"\"; - private static readonly char SEPARATOR = '_'; - public static string Extension => ".modelscpsl"; - - - public static IEnumerable LoadAll() - { - List m = new(); - - string[] raw = Directory.GetFiles(Path, "*" + Extension); - - foreach (string d in raw) - { - Log.Info("loading="+d); - ModelBlueprint mbp = Load(string.Empty, d); - if(mbp != null) - { - Log.Info($"loaded {mbp.Name} ({mbp.Toys.Count})"); - m.Add(mbp); - } - - } - - return m; - } - - public static ModelBlueprint Load(string filename) - { - return Load(Path, filename); - } - - public static ModelBlueprint Load(string path,string filename) - { - string[] raw; - try - { - raw = File.ReadAllText(path + filename).Split('\n'); - } - catch(Exception e) - { - Log.Error(e); - return null; - } - - - string[] infoline = raw[0].Split(SEPARATOR); - string name = infoline[0]; - List toys = new(); - - - for (int i = 1; i < raw.Length; i++) - { - string[] line = raw[i].Split(SEPARATOR); - AdminToy toy = null; - AdminToyType type; - if (!Enum.TryParse(line[0], out type)) continue; - - Vector3 ATPos = Parser.Vector3(line[1]); - Vector3 ATRotation = Parser.Vector3(line[2]); - Vector3 ATScale = Parser.Vector3(line[3]); - if(type == AdminToyType.PrimitiveObject) - { - Color color; - ColorUtility.TryParseHtmlString(line[4], out color); - PrimitiveType ptype; - Enum.TryParse(line[5], out ptype); - - - var p = Primitive.Create(ptype, ATPos, ATRotation, ATScale, true, color); - p.Collidable = false; - toy = p; - - } - if(type == AdminToyType.LightSource) - { - Color color; - ColorUtility.TryParseHtmlString(line[4], out color); - - float intensity = float.Parse(line[5]); - var l = Light.Create(ATPos, ATRotation, ATScale, true, color); - l.Intensity = intensity; - toy = l; - } - - if (toy == null) continue; - toys.Add(toy); - - } - - - - - return ModelBlueprint.Create(name, toys); - } - - - // Name\n - // Primitive.Position.RotationEuler.Scale.Color.PrimitiveType\n - // Light.Position.RotationEuler.Scale.Color.Intensity\n - // and repeat - public static bool Save(this ModelBlueprint m) - { - - List result = new(); - - result.Add(m.Name+SEPARATOR); - - foreach(AdminToyBlueprint t in m.Toys) - { - result.Add(t.Loadable(SEPARATOR)); - } - - try - { - File.WriteAllLines(Path + m.Name+ Extension, result); - return true; - } - catch(Exception e) - { - Log.Error(e); - return false; - } - - } - - public static bool Save(this Model model) - { - if (!model.LoadedFromBlueprint) - model.CreateBlueprint(); - - - return Save(model.Blueprint); - } - - - } -} diff --git a/KruacentExiled/KE.Utils/API/Models/Models.cs b/KruacentExiled/KE.Utils/API/Models/Models.cs deleted file mode 100644 index 27fe3cf4..00000000 --- a/KruacentExiled/KE.Utils/API/Models/Models.cs +++ /dev/null @@ -1,47 +0,0 @@ -using KE.Utils.API.Interfaces; -using PlayerRoles.FirstPersonControl.Thirdperson; - -namespace KE.Utils.API.Models -{ - public class Models : IUsingEvents - { - public ModelCreator ModelCreator - { - get; - private set; - } - private static Models _instance; - - - public static Models Instance - { - get - { - if (_instance == null) - _instance = new(); - return _instance; - } - } - - public void DestroyInstance() - { - _instance = null; - } - - private Models() - { - ModelCreator = new(); - } - - - public void SubscribeEvents() - { - ModelCreator.SubscribeEvents(); - } - - public void UnsubscribeEvents() - { - ModelCreator.UnsubscribeEvents(); - } - } -} diff --git a/KruacentExiled/KE.Utils/API/Models/MovementHandler.cs b/KruacentExiled/KE.Utils/API/Models/MovementHandler.cs deleted file mode 100644 index 07e3ee18..00000000 --- a/KruacentExiled/KE.Utils/API/Models/MovementHandler.cs +++ /dev/null @@ -1,208 +0,0 @@ -using Exiled.API.Features; -using Exiled.API.Features.Toys; -using Exiled.Events.EventArgs.Player; -using KE.Utils.API.Interfaces; -using KE.Utils.API.Models.Arrows; -using MEC; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using UnityEngine; - -namespace KE.Utils.API.Models -{ - internal class MovementHandler : IUsingEvents - { - - private MovementMode _mode = MovementMode.Move; - - public MovementMode Mode - { - get - { - return _mode; - } - set - { - OnChangingMode?.Invoke(value); - _mode = value; - } - } - public static event Action OnChangingMode; - - - - //xyz - private Arrow[] _arrows = new Arrow[3]; - private bool _primflag = false; - public readonly static float REFRESH_RATE = Timing.WaitForOneFrame; - - private CoroutineHandle _handle; - private bool _aiming = false; - private void TryCreatePrimitives() - { - if (!_primflag) - { - _arrows[0] = new XArrow(); - _arrows[1] = new YArrow(); - _arrows[2] = new ZArrow(); - _primflag = true; - } - } - - - - - public void SubscribeEvents() - { - ModelCreator.IsAiming += IsAiming; - ModelCreator.StoppedAiming += StoppedAiming; - ModelSelection.OnChangedSelection += OnChangedSelection; - ModelSelection.OnUnSelect += OnUnSelect; - } - - public void UnsubscribeEvents() - { - Timing.KillCoroutines(_handle); - - ModelSelection.OnChangedSelection -= OnChangedSelection; - ModelSelection.OnUnSelect -= OnUnSelect; - } - private void OnUnSelect() - { - foreach (Arrow a in Arrow.List) - { - a.Move(Vector3.zero); - } - } - private void OnChangedSelection(Primitive p) - { - Log.Info("ChangedSelection"); - TryCreatePrimitives(); - foreach (Arrow a in Arrow.List) - { - a.Move(p.Position); - } - - } - - - private void IsAiming(Player p) - { - Log.Info("start aim"); - var prim = ModelCreator.GetFacingPrimitive(p); - if (!Arrow.IsPrimitiveArrow(prim)) return; - - _aiming = true; - _handle = Timing.RunCoroutine(Moving(p,prim)); - } - - private void StoppedAiming() - { - Log.Info("stopped aim"); - _aiming = false; - } - - - - private IEnumerator Moving(Player player,Primitive p) - { - Primitive selected = Models.Instance.ModelCreator.ModelHandler.SelectedPrimitive; - Vector3 pos = selected.Position; - Vector3 targetPos = pos; - Vector3 scale = selected.Scale; - Vector3 tScale = scale; - - - - Vector3 oldEuler = player.CameraTransform.rotation.eulerAngles; - Arrow a = Arrow.GetArrow(p); - List otherArrows = Arrow.List.Where(o => o != a).ToList(); - - Vector3 direction = a.Offset.normalized; - float sensitivity = 0.1f; - float smoothSpeed = 5; - - while (_aiming) - { - Vector3 currentEuler = player.CameraTransform.rotation.eulerAngles; - - float deltaYaw = Mathf.DeltaAngle(oldEuler.y, currentEuler.y); - float deltaPitch = Mathf.DeltaAngle(oldEuler.x, currentEuler.x); - - float movementAmount = 0f; - - if (Mathf.Abs(direction.y) > 0.5f) - { - movementAmount = -deltaPitch * sensitivity; - } - else - { - - Vector3 camRight = player.CameraTransform.right; - - float sign = Mathf.Sign(Vector3.Dot(camRight, direction)); - - movementAmount = deltaYaw * sensitivity * sign; - } - - - - - if(Mode == MovementMode.Move) - { - targetPos += direction.normalized * movementAmount; - pos = Vector3.Lerp(pos, targetPos, Time.deltaTime * smoothSpeed); - p.Position = pos; - selected.Position = pos - a.Offset; - foreach (Arrow arrow in otherArrows) - { - arrow.Move(pos - a.Offset); - } - } - - - - if(Mode == MovementMode.Scale) - { - Vector3 previousParallel = direction.normalized * Vector3.Dot(selected.Scale, direction.normalized); - Vector3 dir = direction.normalized; - - float currentLengthInDir = Vector3.Dot(scale, dir); - - float newLengthInDir = Mathf.Clamp(currentLengthInDir + movementAmount, 0.1f, 10f); - - - Vector3 parallel = dir * newLengthInDir; - Vector3 perpendicular = scale - (dir * currentLengthInDir); - - selected.Scale = parallel + perpendicular; - scale = selected.Scale; - - Vector3 deltaParallel = parallel - previousParallel; - a.Primitive.Position += deltaParallel / 2; - previousParallel = parallel; - } - - - - if(Mode == MovementMode.Rotate) - { - Log.Info("no clue how to do that"); - } - - - - - - oldEuler = currentEuler; - yield return REFRESH_RATE; - } - } - - - - } -} diff --git a/KruacentExiled/KE.Utils/API/Models/SelectedModel.cs b/KruacentExiled/KE.Utils/API/Models/SelectedModel.cs deleted file mode 100644 index 7e502f46..00000000 --- a/KruacentExiled/KE.Utils/API/Models/SelectedModel.cs +++ /dev/null @@ -1,52 +0,0 @@ -using Exiled.API.Features; -using Exiled.API.Features.Toys; -using MEC; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using UnityEngine; - -namespace KE.Utils.API.Models -{ - internal class ModelSelection - { - - - - public Model SelectedModel { get; internal set; } - public Primitive SelectedPrimitive; - - public static event Action OnChangedSelection; - public static event Action OnUnSelect; - - public void ChangedSelectedPrim(Primitive newPrim) - { - if (newPrim == null) return; - - - - Log.Info(SelectedPrimitive == null); - Log.Info(newPrim.GameObject.GetInstanceID() != SelectedPrimitive?.GameObject.GetInstanceID()); - - if (SelectedPrimitive == null || newPrim.GameObject.GetInstanceID() != SelectedPrimitive?.GameObject.GetInstanceID()) - { - Log.Info("selecting"); - OnChangedSelection?.Invoke(newPrim); - SelectedPrimitive = newPrim; - } - else - { - Log.Info("unselecting"); - SelectedPrimitive = null; - OnUnSelect?.Invoke(); - } - - } - - - - - } -} diff --git a/KruacentExiled/KE.Utils/API/Models/ToysSettings/PrimitiveSetting.cs b/KruacentExiled/KE.Utils/API/Models/ToysSettings/PrimitiveSetting.cs deleted file mode 100644 index b3ffe31d..00000000 --- a/KruacentExiled/KE.Utils/API/Models/ToysSettings/PrimitiveSetting.cs +++ /dev/null @@ -1,31 +0,0 @@ -using AdminToys; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using UnityEngine; - -namespace KE.Utils.API.Models.ToysSettings -{ - public class PrimitiveSetting : ToySetting - { - - public PrimitiveType PrimitiveType { get; } - - - public PrimitiveFlags Flags { get; } - - - public Color Color { get; } - - public Vector3 Position { get; } - - - public Vector3 Rotation { get; } - - - public Vector3 Scale { get; } - - } -} diff --git a/KruacentExiled/KE.Utils/API/Models/ToysSettings/ToySetting.cs b/KruacentExiled/KE.Utils/API/Models/ToysSettings/ToySetting.cs deleted file mode 100644 index 8fdc4477..00000000 --- a/KruacentExiled/KE.Utils/API/Models/ToysSettings/ToySetting.cs +++ /dev/null @@ -1,20 +0,0 @@ -using Exiled.API.Features.Toys; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace KE.Utils.API.Models.ToysSettings -{ - public abstract class ToySetting - { - - - - public virtual void Create(AdminToy a) - { - - } - } -} diff --git a/KruacentExiled/KE.Utils/API/OtherUtils.cs b/KruacentExiled/KE.Utils/API/OtherUtils.cs deleted file mode 100644 index ef43b888..00000000 --- a/KruacentExiled/KE.Utils/API/OtherUtils.cs +++ /dev/null @@ -1,18 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using UnityEngine; - -namespace KE.Utils.API -{ - public static class OtherUtils - { - - public static bool IsInCircle(Vector3 pos,Vector3 centerCircle,float radius) - { - return (pos-centerCircle).sqrMagnitude <= Math.Pow(radius, 2); - } - } -} diff --git a/KruacentExiled/KE.Utils/API/Parser.cs b/KruacentExiled/KE.Utils/API/Parser.cs deleted file mode 100644 index a924337f..00000000 --- a/KruacentExiled/KE.Utils/API/Parser.cs +++ /dev/null @@ -1,36 +0,0 @@ -using Exiled.API.Features; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using UnityEngine; - -namespace KE.Utils.API -{ - public static class Parser - { - public static Vector3 Vector3(string s) - { - string[] temp = s.Substring(1, s.Length - 3).Split(','); - - if(!float.TryParse(temp[0],out float x)) - { - return UnityEngine.Vector3.zero; - } - - if (!float.TryParse(temp[1], out float y)) - { - return UnityEngine.Vector3.zero; - } - if (!float.TryParse(temp[1], out float z)) - { - return UnityEngine.Vector3.zero; - } - - - - return new Vector3(x, y, z); - } - } -} diff --git a/KruacentExiled/KE.Utils/API/ReflectionHelper.cs b/KruacentExiled/KE.Utils/API/ReflectionHelper.cs deleted file mode 100644 index d95fa32a..00000000 --- a/KruacentExiled/KE.Utils/API/ReflectionHelper.cs +++ /dev/null @@ -1,47 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Reflection; -using System.Text; -using System.Threading.Tasks; - -namespace KE.Utils.API -{ - public static class ReflectionHelper - { - public static IEnumerable GetObjects(Assembly assembly = null) - { - List result = new(); - if (assembly == null) - { - assembly = Assembly.GetCallingAssembly(); - } - foreach (Type t in assembly.GetTypes()) - { - try - { - if (typeof(T).IsAssignableFrom(t) && !t.IsAbstract) - { - T ffcc = (T)Activator.CreateInstance(t); - result.Add(ffcc); - } - } - catch (Exception) - { - - } - } - return result; - } - - public static IEnumerable GetObjects(IEnumerable assemblies) - { - List result = new(); - foreach (Assembly assembly in assemblies) - { - result.AddRange(GetObjects(assembly)); - } - return result; - } - } -} diff --git a/KruacentExiled/KE.Utils/API/Sounds/SoundPlayer.cs b/KruacentExiled/KE.Utils/API/Sounds/SoundPlayer.cs deleted file mode 100644 index 91b4218b..00000000 --- a/KruacentExiled/KE.Utils/API/Sounds/SoundPlayer.cs +++ /dev/null @@ -1,115 +0,0 @@ -using Exiled.API.Features; -using System; -using System.Collections.Generic; -using System.IO; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using UnityEngine; - -namespace KE.Utils.API.Sounds -{ - public class SoundPlayer - { - private static SoundPlayer _instance; - - public static SoundPlayer Instance - { - get - { - if (_instance == null) - { - _instance = new(); - } - return _instance; - } - } - - private SoundPlayer() { } - - private bool _loaded = false; - public bool Loaded => _loaded; - - public static readonly HashSet clips = new(); - - public static string SoundLocation => Paths.Configs + "/Sounds"; - public static void Load() => Instance.TryLoad(); - public void TryLoad() - { - if (Loaded) - { - return; - } - - if (!Directory.Exists(SoundLocation)) - { - Log.Warn("Directory not found. creating..."); - Directory.CreateDirectory(SoundLocation); - } - - string[] rawfile = Directory.GetFiles(SoundLocation, "*.ogg"); - - foreach (string file in rawfile) - { - string noExFile = Path.GetFileNameWithoutExtension(file); - Log.Info($"loading {file} as {noExFile}"); - clips.Add(noExFile); - AudioClipStorage.LoadClip(file); - } - _loaded = true; - } - - - /// - /// Play a clip at a static point - /// - /// - /// - /// - /// - public AudioClipPlayback Play(string clipName, Vector3 pos, float volume = 50f, float maxDistance = 20f, bool isSpatial = true) - { - if (!Loaded) throw new Exception("clips not loaded use SoundPlayer.Load()"); - Log.Debug($"playing {clipName} at {pos}"); - - var audioPlayer = AudioPlayer.CreateOrGet($"{clipName} ({pos})", onIntialCreation: (p) => - { - GameObject a = new GameObject(); - a.transform.position = pos; - p.transform.parent = a.transform; - Speaker speaker = p.AddSpeaker("main", isSpatial: isSpatial, maxDistance: maxDistance, minDistance: 1f); - speaker.transform.parent = a.transform; - speaker.transform.localPosition = Vector3.zero; - }); - - audioPlayer.DestroyWhenAllClipsPlayed = true; - return audioPlayer.AddClip(clipName, volume: volume); - - - } - - /// - /// Play a clip at a - /// - /// - /// - /// - /// - public void Play(string clipName, GameObject objectEmittingSound, float volume = 50f, float maxDistance = 20f, bool isSpatial = true) - { - if (!Loaded) throw new Exception("clips not loaded use SoundPlayer.Instance.Load()"); - Log.Debug($"playing {clipName} at {objectEmittingSound}"); - - var audioPlayer = AudioPlayer.CreateOrGet($"{clipName} ({objectEmittingSound})", onIntialCreation: (p) => - { - - p.transform.parent = objectEmittingSound.transform; - Speaker speaker = p.AddSpeaker("main", isSpatial: isSpatial, maxDistance: maxDistance, minDistance: 1f); - speaker.transform.parent = objectEmittingSound.transform; - speaker.transform.localPosition = Vector3.zero; - }); - audioPlayer.AddClip(clipName, volume: volume); - audioPlayer.DestroyWhenAllClipsPlayed = true; - } - } -} diff --git a/KruacentExiled/KE.Utils/Extensions/AdminToyExtension.cs b/KruacentExiled/KE.Utils/Extensions/AdminToyExtension.cs deleted file mode 100644 index 37c3706d..00000000 --- a/KruacentExiled/KE.Utils/Extensions/AdminToyExtension.cs +++ /dev/null @@ -1,25 +0,0 @@ -using Exiled.API.Features.Toys; -using KE.Utils.Quality; -using KE.Utils.Quality.Enums; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace KE.Utils.Extensions -{ - public static class AdminToyExtension - { - - public static void SetAsPickupAdminToy(this AdminToy toy, bool autoSync = true) - { - QualityHandler.Instance.QualityToysHandler.SetAsPickup(toy); - } - - public static void SetQuality(this AdminToy toy, ModelQuality modelQuality,bool autoSync = true) - { - QualityHandler.Instance.QualityToysHandler.SetQuality(toy, modelQuality); - } - } -} diff --git a/KruacentExiled/KE.Utils/Extensions/NpcExtension.cs b/KruacentExiled/KE.Utils/Extensions/NpcExtension.cs deleted file mode 100644 index 6af07bc5..00000000 --- a/KruacentExiled/KE.Utils/Extensions/NpcExtension.cs +++ /dev/null @@ -1,23 +0,0 @@ -using CentralAuth; -using Exiled.API.Features; -using Mirror; -using PlayerRoles; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace KE.Utils.Extensions -{ - public static class NpcExtension - { - - - public static void Hide(this Npc npc) - { - npc.ReferenceHub.authManager.NetworkSyncedUserId = "ID_Dedicated"; - npc.ReferenceHub.authManager.syncMode = (SyncMode)ClientInstanceMode.DedicatedServer; - } - } -} diff --git a/KruacentExiled/KE.Utils/Extensions/PlayerExtension.cs b/KruacentExiled/KE.Utils/Extensions/PlayerExtension.cs deleted file mode 100644 index b01f98d2..00000000 --- a/KruacentExiled/KE.Utils/Extensions/PlayerExtension.cs +++ /dev/null @@ -1,52 +0,0 @@ -using CustomPlayerEffects; -using Exiled.API.Enums; -using Exiled.API.Features; -using Mirror; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using UnityEngine; - -namespace KE.Utils.Extensions -{ - public static class PlayerExtension - { - public static void SetFakeInvis(this Player p, IEnumerable viewers) - { - Vector3 pos = p.Position; - - try - { - p.ReferenceHub.transform.localPosition = Vector3.zero; - foreach (Player viewer in viewers) - { - Server.SendSpawnMessage.Invoke(null, new object[2] { viewer.NetworkIdentity, viewer.Connection }); - } - - p.ReferenceHub.transform.localPosition = pos; - } - catch (Exception arg) - { - Log.Error(string.Format("{0}: {1}", "SetFakeInvis", arg)); - } - } - - - - - public static void AddLevelEffect(this Player p,EffectType type, int intensity) - { - - - if (!p.TryGetEffect(type, out var effect)) - p.ChangeEffectIntensity(type, (byte)(effect.Intensity + intensity)); - else - p.EnableEffect(type, (byte)intensity); - } - - - - } -} diff --git a/KruacentExiled/KE.Utils/Extensions/RoomExtension.cs b/KruacentExiled/KE.Utils/Extensions/RoomExtension.cs deleted file mode 100644 index 35fee2e8..00000000 --- a/KruacentExiled/KE.Utils/Extensions/RoomExtension.cs +++ /dev/null @@ -1,12 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace KE.Utils.Extensions -{ - internal class RoomExtension - { - } -} diff --git a/KruacentExiled/KE.Utils/Extensions/RoomExtensions.cs b/KruacentExiled/KE.Utils/Extensions/RoomExtensions.cs deleted file mode 100644 index 61fd0291..00000000 --- a/KruacentExiled/KE.Utils/Extensions/RoomExtensions.cs +++ /dev/null @@ -1,55 +0,0 @@ -using Exiled.API.Features; -using Exiled.API.Enums; -using Discord; -using System.Linq; -using Exiled.API.Extensions; - -namespace KE.Utils.Extensions -{ - public static class RoomExtensions - { - - - public static Room RandomSafeRoom(this ZoneType zone) - { - return Room.List.Where(r => r.IsSafe() && r.Zone == zone).GetRandomValue(); - } - - - /// - /// Check if a is Safe (Decontamination,Warhead) - /// - /// Note: Does NOT check if the is safe to teleport in (ex : TestRoom) - /// - /// - /// return true if the is safe for a ; false otherwise - public static bool IsSafe(this Room room) - { - return room.Zone.IsSafe(); - } - - - /// - /// Check if a is Safe (Decontamination,Warhead) - /// - /// return true if the zone is safe for a ; false otherwise - public static bool IsSafe(this ZoneType zone) - { - bool result = true; - if (zone == ZoneType.LightContainment) - result = Map.DecontaminationState < DecontaminationState.Countdown; - switch (zone) - { - case ZoneType.LightContainment: - case ZoneType.HeavyContainment: - case ZoneType.Entrance: - result = !Warhead.IsDetonated; - break; - } - return result; - } - - - - } -} diff --git a/KruacentExiled/KE.Utils/KE.Utils.csproj b/KruacentExiled/KE.Utils/KE.Utils.csproj deleted file mode 100644 index f3aa4e9a..00000000 --- a/KruacentExiled/KE.Utils/KE.Utils.csproj +++ /dev/null @@ -1,31 +0,0 @@ - - - - 13.0 - net48 - - - - - - - - - - - - - - - - - - - if not "$(EXILED_DEV_REFERENCES)"=="" copy /y "$(OutputPath)$(AssemblyName).dll" "$(EXILED_DEV_REFERENCES)\Plugins\" - - - if [[ ! -z "$EXILED_DEV_REFERENCES" ]]; then cp "$(OutputPath)$(AssemblyName).dll" "$EXILED_DEV_REFERENCES/Plugins/"; fi - - - - diff --git a/KruacentExiled/KE.Utils/Quality/Enums/ModelQuality.cs b/KruacentExiled/KE.Utils/Quality/Enums/ModelQuality.cs deleted file mode 100644 index d9d8d295..00000000 --- a/KruacentExiled/KE.Utils/Quality/Enums/ModelQuality.cs +++ /dev/null @@ -1,16 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace KE.Utils.Quality.Enums -{ - public enum ModelQuality - { - None = -1, - Low, - Medium, - High, - } -} diff --git a/KruacentExiled/KE.Utils/Quality/Handlers/QualityToysHandler.cs b/KruacentExiled/KE.Utils/Quality/Handlers/QualityToysHandler.cs deleted file mode 100644 index b2485795..00000000 --- a/KruacentExiled/KE.Utils/Quality/Handlers/QualityToysHandler.cs +++ /dev/null @@ -1,179 +0,0 @@ -using AdminToys; -using Exiled.API.Enums; -using Exiled.API.Extensions; -using Exiled.API.Features; -using Exiled.API.Features.Toys; -using KE.Utils.Quality.Enums; -using KE.Utils.Quality.Settings; -using MEC; -using System; -using System.Collections.Generic; -using System.Linq; -using UnityEngine; -using Light = Exiled.API.Features.Toys.Light; -using QualitySettings = KE.Utils.Quality.Settings.QualitySettings; - -namespace KE.Utils.Quality.Handlers -{ - public class QualityToysHandler - { - private HashSet _pickupToys = new(); - private Dictionary _qualityToys = new(); - public readonly Vector3 Gulag = new Vector3(15000, 15000, 15000); - public const float Delay = Timing.WaitForOneFrame; - public bool IsPickupToy(AdminToy primitive) - { - return _pickupToys.Contains(primitive); - } - - public bool IsQualityToy(AdminToy primitive) - { - return _qualityToys.ContainsKey(primitive); - } - - - public void SetAsPickup(AdminToy toy, bool autoSync = true) - { - if (!_pickupToys.Add(toy)) - { - Log.Warn($"AdminToy {toy} is already a pickupToy"); - return; - } - if (autoSync) - Sync(toy); - } - - public void SetQuality(AdminToy toy, ModelQuality quality, bool autoSync = true) - { - if (toy == null) return; - if (!_qualityToys.ContainsKey(toy)) - _qualityToys.Add(toy, quality); - else - _qualityToys[toy] = quality; - - if (autoSync) - Sync(toy); - } - - - - private void SendToFakePosition(AdminToy adminToy, Player player,Vector3 position) - { - //idk why but without delay it show all of the quality at once - Timing.CallDelayed(Delay, () => - { - if (adminToy is Light l) - { - player.SendFakeSyncVar(l.Base.netIdentity, typeof(LightSourceToy), nameof(LightSourceToy.NetworkPosition), position); - return; - } - if (adminToy is Primitive p) - { - player.SendFakeSyncVar(p.Base.netIdentity, typeof(PrimitiveObjectToy), nameof(PrimitiveObjectToy.NetworkPosition), position); - return; - } - }); - - } - - /// - /// Sync every Players - /// - public void Sync() - { - foreach (Player p in Player.List) - { - Sync(p); - } - } - - /// - /// Sync a specified Player - /// - /// - public void Sync(Player p) - { - - - - var quality = QualitySettings.Get(p); - var pickup = QualitySettings.PickmodelActivated(p); - - HashSet pickupToRemove = []; - HashSet qualityToRemove = []; - - //hide pickup toys - - foreach (AdminToy pk in _pickupToys) - { - try - { - if (pickup) - { - SendToFakePosition(pk, p, pk.Position); - } - else - { - SendToFakePosition(pk, p, Gulag); - } - } - catch (NullReferenceException) - { - //Log.Warn("removing pickup"); - pickupToRemove.Add(pk); - } - - } - - _pickupToys.RemoveWhere(p => pickupToRemove.Contains(p)); - - - foreach (var at in _qualityToys) - { - try - { - if ((at.Value == quality || at.Value == ModelQuality.None) && (pickup || !_pickupToys.Contains(at.Key))) - { - SendToFakePosition(at.Key, p, at.Key.Position); - } - else - { - SendToFakePosition(at.Key, p, Gulag); - } - } - catch (NullReferenceException) - { - //Log.Warn("removing quality" + _qualityToys.Count); - qualityToRemove.Add(at.Key); - } - - - } - foreach(var at in qualityToRemove) - { - - _qualityToys.Remove(at); - } - - } - - /// - /// Sync a specified AdminToy - /// - /// - public void Sync(AdminToy adminToy) - { - //temporary fix - Sync(); - - if (IsPickupToy(adminToy)) - { - - } - if (IsQualityToy(adminToy)) - { - - } - } - } -} diff --git a/KruacentExiled/KE.Utils/Quality/Models/Base/BaseModel.cs b/KruacentExiled/KE.Utils/Quality/Models/Base/BaseModel.cs deleted file mode 100644 index c9f6723c..00000000 --- a/KruacentExiled/KE.Utils/Quality/Models/Base/BaseModel.cs +++ /dev/null @@ -1,41 +0,0 @@ -using Exiled.API.Enums; -using Exiled.API.Extensions; -using Exiled.API.Features.Toys; -using Exiled.API.Interfaces; -using KE.Utils.Quality.Structs; -using PlayerStatsSystem; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using UnityEngine; -using Light = Exiled.API.Features.Toys.Light; - -namespace KE.Utils.Quality.Models.Base -{ - - /// - /// The blocks to build a model with - /// - public abstract class BaseModel : ICloneable - { - - protected AdminToy _toy; - public AdminToy AdminToy { get { return _toy; } } - private Vector3 _position; - public Vector3 LocalPosition { get { return _position; } } - private Quaternion _rotation; - public Quaternion LocalRotation { get { return _rotation; } } - - - public BaseModel(Vector3 localPositon, Quaternion localRotation) - { - _position = localPositon; - _rotation = localRotation; - } - - public abstract object Clone(); - } - -} diff --git a/KruacentExiled/KE.Utils/Quality/Models/Base/LightModel.cs b/KruacentExiled/KE.Utils/Quality/Models/Base/LightModel.cs deleted file mode 100644 index ce808da1..00000000 --- a/KruacentExiled/KE.Utils/Quality/Models/Base/LightModel.cs +++ /dev/null @@ -1,26 +0,0 @@ -using Exiled.API.Features.Toys; -using UnityEngine; -using Light = Exiled.API.Features.Toys.Light; - -namespace KE.Utils.Quality.Models.Base -{ - public class LightModel : BaseModel - { - - /// - /// Create a new Light for modeling - /// - public LightModel(Vector3? scale, Color? color, Vector3 localPositon, Quaternion localRotation) : base(localPositon, localRotation) - { - Light light = Light.Create(null, null, scale, false, color); - _toy = light; - } - - - public override object Clone() - { - Light light = _toy as Light; - return new LightModel(light.Scale, light.Color, LocalPosition, LocalRotation); - } - } -} diff --git a/KruacentExiled/KE.Utils/Quality/Models/Base/PrimitiveModel.cs b/KruacentExiled/KE.Utils/Quality/Models/Base/PrimitiveModel.cs deleted file mode 100644 index 22e07225..00000000 --- a/KruacentExiled/KE.Utils/Quality/Models/Base/PrimitiveModel.cs +++ /dev/null @@ -1,26 +0,0 @@ -using Exiled.API.Features.Toys; -using UnityEngine; -using Color = UnityEngine.Color; - -namespace KE.Utils.Quality.Models.Base -{ - public class PrimitiveModel : BaseModel - { - /// - /// Create a new Primitive for modeling - /// - public PrimitiveModel(PrimitiveType type, Vector3? scale, Color? color,Vector3 localPosition,Quaternion localRotation) : base(localPosition, localRotation) - { - - Primitive prim = Primitive.Create(type, null, null, scale, false, color); - prim.Collidable = false; - _toy = prim; - } - - public override object Clone() - { - Primitive prim = _toy as Primitive; - return new PrimitiveModel(prim.Type, prim.Scale, prim.Color, LocalPosition, LocalRotation); - } - } -} diff --git a/KruacentExiled/KE.Utils/Quality/Models/Examples/MineModel.cs b/KruacentExiled/KE.Utils/Quality/Models/Examples/MineModel.cs deleted file mode 100644 index 00d60fec..00000000 --- a/KruacentExiled/KE.Utils/Quality/Models/Examples/MineModel.cs +++ /dev/null @@ -1,118 +0,0 @@ -using KE.Utils.Quality.Enums; -using KE.Utils.Quality.Models.Base; -using System.Collections.Generic; -using UnityEngine; -using Light = Exiled.API.Features.Toys.Light; - -namespace KE.Utils.Quality.Models.Examples -{ - public abstract class MineModel : QualityModel - { - protected Light _light; - private bool _lightOn = false; - - - - - public void ToggleLight() - { - if (_light == null) throw new System.Exception("no light"); - if (_lightOn) - _light.UnSpawn(); - else - _light.Spawn(); - _lightOn = !_lightOn; - } - - } - - public class MineModelLow : MineModel - { - public override bool IsPickup => false; - public override ModelQuality Quality => ModelQuality.Low; - - protected override IEnumerable GetBaseModels() - { - Quaternion baseRotation = new(); - //spawn + offset - Vector3 offset = new Vector3(0, .05f); - Vector3 sizeDisk = new Vector3(.7f, 0.1f, .7f); - - Vector3 sizeGlobe = new Vector3(.1f, .1f, .1f); - Vector3 posLight = new Vector3(0, sizeDisk.y+sizeGlobe.y); - - - var baseMine = new PrimitiveModel(PrimitiveType.Cylinder, sizeDisk, Color.black, offset, baseRotation); - - var lightGlobe = new PrimitiveModel(PrimitiveType.Sphere, sizeGlobe , new Color(1, 0, 0, .33f), posLight, baseRotation); - - var lightMine = new LightModel(null, Color.red, posLight, baseRotation); - - _light = lightMine.AdminToy as Light; - _light.Intensity = .55f; - - return [baseMine, lightGlobe, lightMine]; - } - - - } - - public class MineModelMedium : MineModel - { - public override bool IsPickup => false; - public override ModelQuality Quality => ModelQuality.Medium; - - protected override IEnumerable GetBaseModels() - { - Quaternion baseRotation = new(); - //spawn + offset - Vector3 offset = new Vector3(0, .05f); - Vector3 sizeDisk = new Vector3(.7f, 0.1f, .7f); - - Vector3 sizeGlobe = new Vector3(.1f, .1f, .1f); - Vector3 posLight = new Vector3(0, sizeDisk.y + sizeGlobe.y); - - - var baseMine = new PrimitiveModel(PrimitiveType.Cylinder, sizeDisk, Color.black, offset, baseRotation); - - var lightGlobe = new PrimitiveModel(PrimitiveType.Sphere, sizeGlobe, new Color(1, 0, 0, .33f), posLight, baseRotation); - - var lightMine = new LightModel(null, Color.green, posLight, baseRotation); - - _light = lightMine.AdminToy as Light; - _light.Intensity = .55f; - - return [baseMine, lightGlobe, lightMine]; - } - } - - public class MineModelPickup : MineModel - { - public override bool IsPickup => true; - public override ModelQuality Quality => ModelQuality.None; - - - protected override IEnumerable GetBaseModels() - { - Quaternion baseRotation = new(); - //spawn + offset - Vector3 offset = new Vector3(0, .05f); - Vector3 sizeDisk = new Vector3(.7f, 0.1f, .7f); - - Vector3 sizeGlobe = new Vector3(.1f, .1f, .1f); - Vector3 posLight = new Vector3(0, sizeDisk.y + sizeGlobe.y); - - - var baseMine = new PrimitiveModel(PrimitiveType.Cylinder, sizeDisk, Color.black, offset, baseRotation); - - var lightGlobe = new PrimitiveModel(PrimitiveType.Sphere, sizeGlobe, new Color(1, 0, 0, .33f), posLight, baseRotation); - - var lightMine = new LightModel(null, Color.magenta, posLight, baseRotation); - - _light = lightMine.AdminToy as Light; - _light.Intensity = .55f; - - return [baseMine, lightGlobe, lightMine]; - } - } -} diff --git a/KruacentExiled/KE.Utils/Quality/Models/Model.cs b/KruacentExiled/KE.Utils/Quality/Models/Model.cs deleted file mode 100644 index 2e26756e..00000000 --- a/KruacentExiled/KE.Utils/Quality/Models/Model.cs +++ /dev/null @@ -1,104 +0,0 @@ -using Exiled.API.Features; -using Exiled.API.Features.Toys; -using KE.Utils.Quality.Models.Base; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using UnityEngine; - -namespace KE.Utils.Quality.Models -{ - public class Model : IEquatable - { - - - private Vector3 _position; - public Vector3 Position - { - get { return _position; } - set - { - _position = value; - } - } - private Quaternion _rotation; - public Quaternion Rotation - { - get { return _rotation; } - set - { - _rotation = value; - } - } - private ModelPrefab _prefab; - public ModelPrefab Prefab - { - get { return _prefab; } - } - - - - private HashSet _models; - - internal Model(ModelPrefab prefab, Vector3 position, Quaternion rotation,IEnumerable toys,bool spawn) - { - _prefab = prefab; - Position = position; - Rotation = rotation; - _models = new HashSet(toys); - QualityHandler.Instance.QualityToysHandler.Sync(); - - foreach (BaseModel based in toys) - { - AdminToy toy = based.AdminToy; - - if (toy is Primitive p) - p.Collidable = false; - toy.AdminToyBase.transform.position = based.LocalPosition + Position; - toy.AdminToyBase.transform.rotation = based.LocalRotation * Rotation; - } - if(spawn) - { - Spawn(); - } - } - - - public void Destroy() - { - foreach (BaseModel primitive in _models) - { - primitive.AdminToy.Destroy(); - } - } - public void UnSpawn() - { - foreach (BaseModel primitive in _models) - { - primitive.AdminToy.UnSpawn(); - } - } - public void Spawn() - { - QualityHandler.Instance.QualityToysHandler.Sync(); - foreach (BaseModel primitive in _models) - { - primitive.AdminToy.Spawn(); - } - - } - - - public bool Equals(Model x) - { - if (x == null) return false; - return x._prefab == _prefab && x.Position == Position && x.Rotation == Rotation; - } - public int GetHashCode(Model obj) - { - return obj.GetHashCode(); - } - } -} diff --git a/KruacentExiled/KE.Utils/Quality/Models/ModelPrefab.cs b/KruacentExiled/KE.Utils/Quality/Models/ModelPrefab.cs deleted file mode 100644 index bbc39da4..00000000 --- a/KruacentExiled/KE.Utils/Quality/Models/ModelPrefab.cs +++ /dev/null @@ -1,42 +0,0 @@ -using Exiled.API.Features; -using Exiled.API.Features.Core; -using Exiled.API.Features.Pickups; -using Exiled.API.Features.Toys; -using Exiled.API.Interfaces; -using KE.Utils.Extensions; -using KE.Utils.Quality.Models.Base; -using KE.Utils.Quality.Structs; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using UnityEngine; -using Light = Exiled.API.Features.Toys.Light; - -namespace KE.Utils.Quality.Models -{ - public abstract class ModelPrefab - { - - protected abstract IEnumerable GetBaseModels(); - - public virtual Model Create(Vector3 position,Quaternion rotation, bool spawn = true) - { - - HashSet clonetoys = new(); - HashSet toys = GetBaseModels().ToHashSet(); - foreach (BaseModel model in toys) - { - BaseModel clone = (BaseModel)model.Clone(); - clonetoys.Add(clone); - } - return new Model(this, position, rotation, clonetoys,spawn); - - } - - - - - } -} diff --git a/KruacentExiled/KE.Utils/Quality/Models/QualityModel.cs b/KruacentExiled/KE.Utils/Quality/Models/QualityModel.cs deleted file mode 100644 index b5cc682f..00000000 --- a/KruacentExiled/KE.Utils/Quality/Models/QualityModel.cs +++ /dev/null @@ -1,40 +0,0 @@ -using Exiled.API.Features; -using Exiled.API.Features.Toys; -using KE.Utils.Extensions; -using KE.Utils.Quality.Enums; -using KE.Utils.Quality.Models.Base; -using System.Collections.Generic; -using System.Linq; -using UnityEngine; - -namespace KE.Utils.Quality.Models -{ - public abstract class QualityModel : ModelPrefab - { - public abstract ModelQuality Quality { get; } - public abstract bool IsPickup { get; } - - - - - public override sealed Model Create(Vector3 position, Quaternion rotation,bool spawn = true) - { - - HashSet clonetoys = new(); - HashSet toys = GetBaseModels().ToHashSet(); - foreach (BaseModel model in toys) - { - BaseModel clone = (BaseModel)model.Clone(); - - if (IsPickup) - clone.AdminToy.SetAsPickupAdminToy(false); - - clone.AdminToy.SetQuality(Quality,false); - clonetoys.Add(clone); - } - QualityHandler.Sync(); - return new Model(this,position, rotation, clonetoys, spawn); - } - - } -} diff --git a/KruacentExiled/KE.Utils/Quality/QualityHandler.cs b/KruacentExiled/KE.Utils/Quality/QualityHandler.cs deleted file mode 100644 index 235d79c9..00000000 --- a/KruacentExiled/KE.Utils/Quality/QualityHandler.cs +++ /dev/null @@ -1,61 +0,0 @@ -using Exiled.API.Features; -using Exiled.API.Features.Core.UserSettings; -using KE.Utils.Quality.Handlers; -using KE.Utils.Quality.Settings; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace KE.Utils.Quality -{ - [Obsolete("scrapped", false)] - internal class QualityHandler - { - public QualitySettings QualitySettings { get; private set; } - public QualityToysHandler QualityToysHandler { get; private set; } - - private static QualityHandler _instance; - public static QualityHandler Instance - { - get - { - if(_instance == null ) - _instance = new QualityHandler(); - return _instance; - } - } - private QualityHandler() - { - QualitySettings = new QualitySettings(Changed); - QualityToysHandler = new QualityToysHandler(); - } - - ~QualityHandler() - { - QualityToysHandler = null; - QualitySettings = null; - } - - public void Changed(Player p, SettingBase _) - { - QualityToysHandler.Sync(p); - } - - public void Register() - { - QualitySettings.Register(); - } - - public void Unregister() - { - QualitySettings.Unregister(); - } - - public static void Sync() - { - Instance.QualityToysHandler.Sync(); - } - } -} diff --git a/KruacentExiled/KE.Utils/Quality/QualityToysHandler.cs b/KruacentExiled/KE.Utils/Quality/QualityToysHandler.cs deleted file mode 100644 index 27320233..00000000 --- a/KruacentExiled/KE.Utils/Quality/QualityToysHandler.cs +++ /dev/null @@ -1,155 +0,0 @@ -using AdminToys; -using Exiled.API.Enums; -using Exiled.API.Extensions; -using Exiled.API.Features; -using Exiled.API.Features.Toys; -using KE.Utils.Quality.Enums; -using KE.Utils.Quality.Settings; -using System.Collections.Generic; -using System.Linq; -using UnityEngine; -using Light = Exiled.API.Features.Toys.Light; -using QualitySettings = KE.Utils.Quality.Settings.QualitySettings; - -namespace KE.Utils.Quality -{ - public class QualityToysHandler - { - private HashSet _pickupToys = new(); - private Dictionary _qualityToys = new(); - public readonly Vector3 Gulag = new Vector3(15000,15000,15000); - - public bool IsPickupToy(AdminToy primitive) - { - return _pickupToys.Contains(primitive); - } - - public bool IsQualityToy(AdminToy primitive) - { - return _qualityToys.ContainsKey(primitive); - } - - - public void SetAsPickup(AdminToy toy) - { - if (!_pickupToys.Add(toy)) - { - Log.Warn($"AdminToy {toy} is already a pickupToy"); - return; - } - } - - public void SetQuality(AdminToy toy,ModelQuality quality) - { - if (toy == null) return; - if (!_qualityToys.ContainsKey(toy)) - _qualityToys.Add(toy,quality); - else - _qualityToys[toy] = quality; - } - - - - private void SendToShadowRealm(AdminToy adminToy, Player player) - { - if(adminToy is Light l) - { - player.SendFakeSyncVar(l.Base.netIdentity, typeof(LightSourceToy), nameof(LightSourceToy.NetworkPosition), Gulag); - return; - } - if(adminToy is Primitive p) - { - player.SendFakeSyncVar(p.Base.netIdentity, typeof(PrimitiveObjectToy), nameof(PrimitiveObjectToy.NetworkPosition), Gulag); - return; - } - } - - private void SetTruePosition(AdminToy adminToy, Player player) - { - if (adminToy is Light l) - { - player.SendFakeSyncVar(l.Base.netIdentity, typeof(LightSourceToy), nameof(LightSourceToy.NetworkPosition), l.Position); - return; - } - if (adminToy is Primitive p) - { - player.SendFakeSyncVar(p.Base.netIdentity, typeof(PrimitiveObjectToy), nameof(PrimitiveObjectToy.NetworkPosition), p.Position); - return; - } - } - - /// - /// Sync every Players - /// - public void Sync() - { - foreach(Player p in Player.List) - { - Sync(p); - } - } - - /// - /// Sync a specified Player - /// - /// - public void Sync(Player p) - { - var quality = QualitySettings.Get(p); - var pickup = QualitySettings.PickmodelActivated(p); - - if (!pickup) - { - //hide pickup toys - foreach (AdminToy pk in _pickupToys) - { - SendToShadowRealm(pk, p); - } - } - else - { - //show pickup toys - foreach (AdminToy pk in _pickupToys) - { - SetTruePosition(pk, p); - } - } - - - - - foreach(var at in _qualityToys) - { - if(at.Value == quality) - { - if (pickup || !_pickupToys.Contains(at.Key)) - { - SetTruePosition(at.Key, p); - } - } - else - { - SendToShadowRealm(at.Key, p); - } - - } - - } - - /// - /// Sync a specified AdminToy - /// - /// - public void Sync(AdminToy adminToy) - { - if (IsPickupToy(adminToy)) - { - - } - if (IsQualityToy(adminToy)) - { - - } - } - } -} diff --git a/KruacentExiled/KE.Utils/Quality/Settings/QualitySettings.cs b/KruacentExiled/KE.Utils/Quality/Settings/QualitySettings.cs deleted file mode 100644 index ca8d49be..00000000 --- a/KruacentExiled/KE.Utils/Quality/Settings/QualitySettings.cs +++ /dev/null @@ -1,62 +0,0 @@ -using Exiled.API.Features; -using Exiled.API.Features.Core.UserSettings; -using KE.Utils.Quality.Enums; -using System; - -namespace KE.Utils.Quality.Settings -{ - public class QualitySettings - { - - private static int _idQuality = 0; - private static int _idModels = 1; - private static int _idSlider = 2; - private SettingBase[] _settings; - public QualitySettings(Action onChanged) - { - HeaderSetting header = new("Quality Settings"); - _settings = - [ - header, - new DropdownSetting(_idQuality,"ModelQuality",["Low","Medium", "High"],onChanged:onChanged), - new TwoButtonsSetting(_idModels,"Pickup models","Disabled","Enabled", onChanged:onChanged) - ]; - } - - public void Register() - { - SettingBase.Register(_settings); - SettingBase.SendToAll(); - } - - public void Unregister() - { - SettingBase.Unregister(settings:_settings); - } - - - - - public static ModelQuality Get(Player p) - { - if (!SettingBase.TryGetSetting(p, _idQuality, out var setting)) return ModelQuality.None; - - return setting.SelectedOption switch - { - "Low" => ModelQuality.Low, - "Medium" => ModelQuality.Medium, - "High" => ModelQuality.High, - _ => ModelQuality.None, - }; - } - - - public static bool PickmodelActivated(Player p) - { - if (!SettingBase.TryGetSetting(p, _idModels, out var setting)) return false; - return setting.IsSecond; - } - - - } -} diff --git a/KruacentExiled/KE.Utils/Quality/Structs/LocalWorldSpace.cs b/KruacentExiled/KE.Utils/Quality/Structs/LocalWorldSpace.cs deleted file mode 100644 index d9c6205b..00000000 --- a/KruacentExiled/KE.Utils/Quality/Structs/LocalWorldSpace.cs +++ /dev/null @@ -1,23 +0,0 @@ -using Exiled.API.Interfaces; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using UnityEngine; - -namespace KE.Utils.Quality.Structs -{ - public readonly struct LocalWorldSpace : IWorldSpace - { - - public Vector3 Position { get; } - public Quaternion Rotation { get; } - - public LocalWorldSpace(Vector3 position, Quaternion rotation) - { - Position = position; - Rotation = rotation; - } - } -} diff --git a/KruacentExiled/KE.Utils/Quality/Tests/Test.cs b/KruacentExiled/KE.Utils/Quality/Tests/Test.cs deleted file mode 100644 index 6ebd3f66..00000000 --- a/KruacentExiled/KE.Utils/Quality/Tests/Test.cs +++ /dev/null @@ -1,108 +0,0 @@ -using Exiled.API.Extensions; -using Exiled.API.Features; -using Exiled.API.Features.Toys; -using KE.Utils.Quality.Models; -using KE.Utils.Quality.Models.Examples; -using MEC; -using PlayerRoles; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using UnityEngine; - -namespace KE.Utils.Quality.Tests -{ - public class Test - { - private QualityHandler QualityHandler; - - - private Test(QualityHandler q) - { - QualityHandler = q; - try - { - TestMine(); - } - catch (Exception ex) - { - Log.Error("Exception for TestMine :\n"+ex); - } - - } - internal void TestQuality() - { - Vector3 pos = RoleTypeId.Scp049.GetRandomSpawnLocation().Position; - Primitive c = Primitive.Create(pos); - c.Color = Color.red; - Primitive c2 = Primitive.Create(pos + Vector3.one); - c2.Color = Color.green; - - - QualityHandler.QualityToysHandler.SetQuality(c, Enums.ModelQuality.Low); - QualityHandler.QualityToysHandler.SetQuality(c2, Enums.ModelQuality.Medium); - } - - internal void StressTest(int count) - { - Timing.RunCoroutine(Stress(count)); - } - - - private IEnumerator Stress(int count) - { - Vector3 pos = RoleTypeId.Scp049.GetRandomSpawnLocation().Position; - Vector3 scale = new Vector3(.1f, .1f, .1f); - float maxSpread = 5; - for (int i = 0; i < count; i++) - { - Primitive c = Primitive.Create(pos + new Vector3(UnityEngine.Random.Range(0f, maxSpread), UnityEngine.Random.Range(0f, maxSpread), UnityEngine.Random.Range(0f, maxSpread)), scale: scale); - QualityHandler.QualityToysHandler.SetQuality(c, Enums.ModelQuality.Medium); - } - QualityHandler.QualityToysHandler.Sync(); - yield return 0; - } - - public void TestMine() - { - Log.Info("TestMine"); - Vector3 pos = RoleTypeId.Scp049.GetRandomSpawnLocation().Position; - MineModelLow mml = new(); - - - Model m = mml.Create(pos, new Quaternion()); - m.Spawn(); - - - MineModelMedium mmm = new(); - - m = mmm.Create(pos + Vector3.up, new Quaternion()); - m.Spawn(); - - - MineModelPickup mmp = new(); - m = mmp.Create(pos + Vector3.right, new Quaternion()); - m.Spawn(); - - QualityHandler.Sync(); - - - - - - - - - foreach (var item in Player.List) - { - item.Teleport(pos); - } - - - - - } - } -} From 1545126fe08b6eb43e3312148ed73ed93c3c3b48 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Wed, 14 Jan 2026 12:58:27 +0100 Subject: [PATCH 516/853] not hint? + 914guard --- .../API/Features/KEAbilities.cs | 17 ++++- .../API/Features/KECustomRole.cs | 9 ++- .../API/Interfaces/ICustomIcon.cs | 5 +- .../KE.CustomRoles/Abilities/Thief.cs | 6 +- .../KE.CustomRoles/CR/Guard/Guard914.cs | 14 +++- .../KE.CustomRoles/CR/Human/Hitman.cs | 10 +++ .../KE.CustomRoles/Commands/ImageCommand.cs | 72 +++++++++++++++++++ .../KE.CustomRoles/Commands/Redocustomrole.cs | 65 ----------------- KruacentExiled/KE.CustomRoles/MainPlugin.cs | 35 ++++++--- 9 files changed, 150 insertions(+), 83 deletions(-) create mode 100644 KruacentExiled/KE.CustomRoles/Commands/ImageCommand.cs delete mode 100644 KruacentExiled/KE.CustomRoles/Commands/Redocustomrole.cs diff --git a/KruacentExiled/KE.CustomRoles/API/Features/KEAbilities.cs b/KruacentExiled/KE.CustomRoles/API/Features/KEAbilities.cs index d0055eac..9d6d0951 100644 --- a/KruacentExiled/KE.CustomRoles/API/Features/KEAbilities.cs +++ b/KruacentExiled/KE.CustomRoles/API/Features/KEAbilities.cs @@ -1,5 +1,7 @@ using Exiled.API.Features; using Exiled.API.Features.Pools; +using HintServiceMeow.Core.Extension; +using HintServiceMeow.Core.Models.Hints; using KE.CustomRoles.Abilities.FireAbilities; using KE.CustomRoles.API.Interfaces; using KE.CustomRoles.Settings; @@ -128,6 +130,8 @@ public void ShowAbility(Player player) sb.AppendLine(); sb.Append(Description); + + DisplayHandler.Instance.AddHint(MainPlugin.AbilitiesDesc, player, sb.ToString(), time); StringBuilderPool.Pool.Return(sb); @@ -180,8 +184,14 @@ public void AddAbility(Player player) } PlayersAbility[player].Add(this); - DisplayHandler.Instance.CreateAuto(player, arg => UpdateGUI(player), AbilityPosition.HintPlacement); + var hint = DisplayHandler.Instance.CreateAuto(player, arg => UpdateGUI(player), AbilityPosition.HintPlacement); + + + + IEnumerable hints =player.GetPlayerDisplay().GetHints(hint.Id); + Log.Debug("id="+ hint.Id); + Log.Debug("hgints="+hints.Count()); AbilityAdded(player); } @@ -421,6 +431,11 @@ protected virtual void Gui(StringBuilder sb) { sb.Append(PublicName); sb.Append(" "); + + if (this is ICustomIcon) + { + + } } diff --git a/KruacentExiled/KE.CustomRoles/API/Features/KECustomRole.cs b/KruacentExiled/KE.CustomRoles/API/Features/KECustomRole.cs index 8962874e..2be3b7ea 100644 --- a/KruacentExiled/KE.CustomRoles/API/Features/KECustomRole.cs +++ b/KruacentExiled/KE.CustomRoles/API/Features/KECustomRole.cs @@ -337,9 +337,10 @@ protected virtual void SetSpawn(Player player) protected virtual void SetCustomInfo(Player player) { + player.CustomInfo = player.CustomName; if (!string.IsNullOrEmpty(PublicName)) { - player.CustomInfo = player.CustomName + "\n" + PublicName; + player.CustomInfo += "\n" + PublicName; } player.InfoArea &= ~(PlayerInfoArea.Nickname | PlayerInfoArea.Role); } @@ -375,7 +376,11 @@ public override void RemoveRole(Player player) } } - + /// + /// + /// + /// + /// true if the player can have this CR ; false otherwise public virtual bool IsAvailable(Player player) { if (CurrentNumberOfSpawn >= Limit) return false; diff --git a/KruacentExiled/KE.CustomRoles/API/Interfaces/ICustomIcon.cs b/KruacentExiled/KE.CustomRoles/API/Interfaces/ICustomIcon.cs index dcd36549..189f0071 100644 --- a/KruacentExiled/KE.CustomRoles/API/Interfaces/ICustomIcon.cs +++ b/KruacentExiled/KE.CustomRoles/API/Interfaces/ICustomIcon.cs @@ -1,4 +1,5 @@ -using System; +using KE.Utils.API.GifAnimator; +using System; using System.Collections.Generic; using System.Linq; using System.Text; @@ -9,7 +10,7 @@ namespace KE.CustomRoles.API.Interfaces public interface ICustomIcon { - public abstract string IconName { get; } + public abstract TextImage IconName { get; } } diff --git a/KruacentExiled/KE.CustomRoles/Abilities/Thief.cs b/KruacentExiled/KE.CustomRoles/Abilities/Thief.cs index 832ee6ae..91737fa0 100644 --- a/KruacentExiled/KE.CustomRoles/Abilities/Thief.cs +++ b/KruacentExiled/KE.CustomRoles/Abilities/Thief.cs @@ -2,13 +2,15 @@ using Exiled.API.Features; using Exiled.API.Features.Items; using KE.CustomRoles.API.Features; +using KE.CustomRoles.API.Interfaces; using KE.Utils.API.Displays.DisplayMeow; +using KE.Utils.API.GifAnimator; using System.Collections.Generic; using System.Linq; namespace KE.CustomRoles.Abilities { - public class Thief : KEAbilities + public class Thief : KEAbilities, ICustomIcon { public override string Name { get; } = "Thief"; public override string PublicName { get; } = "Thief"; @@ -18,6 +20,8 @@ public class Thief : KEAbilities public override float Cooldown { get; } = 120f; + public TextImage IconName => MainPlugin.Instance.icons["Thief"]; + protected override bool AbilityUsed(Player player) { diff --git a/KruacentExiled/KE.CustomRoles/CR/Guard/Guard914.cs b/KruacentExiled/KE.CustomRoles/CR/Guard/Guard914.cs index 3bc9af7b..2cd13588 100644 --- a/KruacentExiled/KE.CustomRoles/CR/Guard/Guard914.cs +++ b/KruacentExiled/KE.CustomRoles/CR/Guard/Guard914.cs @@ -55,6 +55,11 @@ public class Guard914 : KECustomRole { AmmoType.Nato9, 60} }; + public override void Init() + { + base.Init(); + storedSerials = new(); + } protected override void RoleAdded(Player player) { @@ -117,7 +122,7 @@ public static KeycardItem CreateFakeCaptainCard(LabPlayer player) - private static HashSet storedSerials = new(); + private static HashSet storedSerials; private void OnProcessedPlayer(Scp914ProcessedPlayerEventArgs ev) { if (ev.KnobSetting != Scp914.Scp914KnobSetting.Fine) return; @@ -131,9 +136,12 @@ private void OnProcessedPlayer(Scp914ProcessedPlayerEventArgs ev) bool equipped = player.CurrentItem is not null && player.CurrentItem.Serial == item.Serial; player.RemoveItem(item); storedSerials.Remove(item.Serial); - CustomKeycardItem keycard = item as CustomKeycardItem; - + if (item is not CustomKeycardItem keycard) + { + Log.Error("not a custom keycard"); + return; + } diff --git a/KruacentExiled/KE.CustomRoles/CR/Human/Hitman.cs b/KruacentExiled/KE.CustomRoles/CR/Human/Hitman.cs index 47a3c73e..9e6441e2 100644 --- a/KruacentExiled/KE.CustomRoles/CR/Human/Hitman.cs +++ b/KruacentExiled/KE.CustomRoles/CR/Human/Hitman.cs @@ -47,6 +47,16 @@ private void BuffHitman() this.TheHitman.EnableEffect(EffectType.MovementBoost, -1, true); } + protected override void SetCustomInfo(Player player) + { + + } + + public override bool IsAvailable(Player player) + { + return Player.List.Count(p=> p != player && !p.IsScp) > 0; + } + protected override void RoleAdded(Player player) { Log.Info("Role full name : " + player.Role.Name); diff --git a/KruacentExiled/KE.CustomRoles/Commands/ImageCommand.cs b/KruacentExiled/KE.CustomRoles/Commands/ImageCommand.cs new file mode 100644 index 00000000..9ebd7fe6 --- /dev/null +++ b/KruacentExiled/KE.CustomRoles/Commands/ImageCommand.cs @@ -0,0 +1,72 @@ +using CommandSystem; +using Exiled.API.Features; +using KE.CustomRoles.API.Features; +using KE.Utils.API.Commands; +using KE.Utils.API.Displays.DisplayMeow; +using KE.Utils.API.GifAnimator; +using System; +using System.Collections.Generic; +using System.Drawing; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace KE.CustomRoles.Commands +{ + [CommandHandler(typeof(RemoteAdminCommandHandler))] + public class ImageCommand : ICommand + { + public string Command => "img"; + + public string[] Aliases => []; + + public string Description => "image"; + + public string[] Usage => []; + + public bool Execute(ArraySegment arguments, ICommandSender sender, out string response) + { + response = "ok"; + try + { + + string arg1 = arguments.At(0); + + Log.Debug(arg1); + if (string.IsNullOrEmpty(arg1)) + { + response = "arg null "+ arg1; + return false; + } + + + if (!float.TryParse(arg1, out float size)) + { + response = "float not found"; + return false; + } + + + try + { + TextImage imaeg = new TextImage(Image.FromFile(MainPlugin.ImageLocation + "/Explode.png"), size); + + DisplayHandler.Instance.AddHint(KEAbilities.AbilityPosition.HintPlacement, Player.Get(sender), imaeg.RawString, 30); + } + catch (Exception e2) + { + Log.Error(e2); + } + + } + catch (Exception e) + { + Log.Error(e); + } + + + + return true; + } + } +} diff --git a/KruacentExiled/KE.CustomRoles/Commands/Redocustomrole.cs b/KruacentExiled/KE.CustomRoles/Commands/Redocustomrole.cs deleted file mode 100644 index 7fda08b1..00000000 --- a/KruacentExiled/KE.CustomRoles/Commands/Redocustomrole.cs +++ /dev/null @@ -1,65 +0,0 @@ -using CommandSystem; -using Exiled.API.Features; -using Exiled.CustomRoles; -using KE.CustomRoles.API.Features; -using MEC; -using PlayerRoles; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace KE.CustomRoles.Commands -{ - - [CommandHandler(typeof(ClientCommandHandler))] - public class Redocustomrole : ICommand - { - public string Command => "rcr"; - - public string[] Aliases => []; - - public string Description => "redo the custom role"; - - public bool Execute(ArraySegment arguments, ICommandSender sender, out string response) - { - Player player = Player.Get(sender); - - response = "no"; - if (player is not null) - { - KECustomRole ke = null; - RoleTypeId role = player.Role; - List list = KECustomRole.Get(player).ToList(); - if (list is null) - { - response = "no cr"; - return false; - } - - ke = list[0]; - - - if(role == RoleTypeId.ClassD) - { - player.Role.Set(RoleTypeId.Scientist, RoleSpawnFlags.None); - } - else - { - player.Role.Set(RoleTypeId.ClassD, RoleSpawnFlags.None); - } - ke.RemoveRole(player); - Timing.CallDelayed(.1f, delegate - { - ke.AddRole(player); - }); - - } - - - response = "ok"; - return true; - } - } -} diff --git a/KruacentExiled/KE.CustomRoles/MainPlugin.cs b/KruacentExiled/KE.CustomRoles/MainPlugin.cs index e0cb7dbc..ec8e887f 100644 --- a/KruacentExiled/KE.CustomRoles/MainPlugin.cs +++ b/KruacentExiled/KE.CustomRoles/MainPlugin.cs @@ -16,6 +16,8 @@ using Microsoft.Win32; using System; using System.Collections.Generic; +using System.Drawing; +using System.IO; using System.Linq; using System.Runtime.InteropServices.ComTypes; @@ -42,8 +44,9 @@ public class MainPlugin : Plugin, Utils.API.Translations.ITranslation public TranslationFile Translation => translation; private Harmony Harmony; + internal Dictionary icons; - + public static readonly string ImageLocation = Paths.Configs + "/Img/"; public override void OnEnabled() { @@ -54,16 +57,12 @@ public override void OnEnabled() CustomPlayerStat.AddModule(); CustomStatsEvents.SubscribeEvents(); - - - Image img = Image.FromFile(Paths.Configs + "/ome.png"); - TextImage textimg = new TextImage(img, 20); - Log.Debug(textimg.RawString.Length); + icons = new(); - DisplayHandler.Instance.AddHint(position.HintPlacement, player, textimg.RawString, 30); - + + LoadImage(); Harmony = new(Name); Harmony.PatchAll(); @@ -104,11 +103,29 @@ public void UnsubscribeEvents() public void CustomRoleImplement(SpawnedEventArgs ev) { - ShowTranslation(); + KECustomRole.GiveRandomRole(Player.List.Except(ev.CustomRoles)); } + private void LoadImage() + { + if (!Directory.Exists(ImageLocation)) + { + Log.Warn("Directory not found. creating..."); + Directory.CreateDirectory(ImageLocation); + } + + string[] rawfile = Directory.GetFiles(ImageLocation, "*.png"); + + foreach (string file in rawfile) + { + string noExFile = Path.GetFileNameWithoutExtension(file); + Log.Info($"loading {file} as {noExFile}"); + icons.Add(noExFile,new TextImage(Image.FromFile(file),2)); + } + } + public void ShowTranslation() { From 969afd81f5eb9f876aafd211c839973a00bd8001 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Wed, 14 Jan 2026 13:18:39 +0100 Subject: [PATCH 517/853] update maybe fixed no cr? --- KruacentExiled/KE.CustomRoles/API/Features/CustomSCP.cs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/KruacentExiled/KE.CustomRoles/API/Features/CustomSCP.cs b/KruacentExiled/KE.CustomRoles/API/Features/CustomSCP.cs index 0ddd3563..09e06226 100644 --- a/KruacentExiled/KE.CustomRoles/API/Features/CustomSCP.cs +++ b/KruacentExiled/KE.CustomRoles/API/Features/CustomSCP.cs @@ -54,6 +54,13 @@ public override void AddRole(Player player) public int GetPreferences(Player player) { + if(sliderSetting is null) + { + Log.Error("slider setting is null in custom scp"); + return -6; + } + + if (!SettingBase.TryGetSetting(player, sliderSetting.Id, out var setting)) return -6; return (int) setting.SliderValue; } From f9882ec069530227e4ea84903a26e77585bb1cc1 Mon Sep 17 00:00:00 2001 From: OmerGS <27omerf@gmail.com> Date: Wed, 14 Jan 2026 21:46:21 +0100 Subject: [PATCH 518/853] corrected the scp life growth in each sequence --- .../GE/SwapProtocol.cs | 34 +++++++++++-------- 1 file changed, 20 insertions(+), 14 deletions(-) diff --git a/KruacentExiled/KE.GlobalEventFramework.Examples/GE/SwapProtocol.cs b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/SwapProtocol.cs index d7467473..984c4df7 100644 --- a/KruacentExiled/KE.GlobalEventFramework.Examples/GE/SwapProtocol.cs +++ b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/SwapProtocol.cs @@ -21,6 +21,7 @@ public class SwapProtocol : GlobalEvent, IStart public override string Name { get; set; } = "SwapProtocol"; public override string Description { get; set; } = "EEEEEEEET c'est parti la roulette tourne"; public override int WeightedChance { get; set; } = 1; + public const string IsSwappingKey = "KE.GlobalEvents.SwapProtocol.IsSwapping"; /// /// Cooldown between each change in seconds @@ -109,26 +110,31 @@ public void ApplyTo(Player target) { target.ClearInventory(); + target.SessionVariables[IsSwappingKey] = true; + target.Role.Set(Role, RoleSpawnFlags.None); - // Add Safe TP here !! - if (target.PreviousRole == RoleTypeId.Spectator) target.Position = Room.Random(ZoneType.HeavyContainment).Position + Vector3.up; + Timing.CallDelayed(.1f, () => + { + // Add Safe TP here !! + if (target.PreviousRole == RoleTypeId.Spectator) target.Position = Room.Random(ZoneType.HeavyContainment).Position + Vector3.up; - target.MaxHealth = MaxHealth; - target.Health = Health; - target.Scale = PlayerScale; - if (IsCuffed && !target.IsCuffed) target.Handcuff(); else target.RemoveHandcuffs(); + target.MaxHealth = MaxHealth; + target.Health = Health; + target.Scale = PlayerScale; + if (IsCuffed && !target.IsCuffed) target.Handcuff(); else target.RemoveHandcuffs(); - foreach (ItemState state in SavedItems) - { - Item newItem = target.AddItem(state.Type); - state.ApplyState(newItem); - } + foreach (ItemState state in SavedItems) + { + Item newItem = target.AddItem(state.Type); + state.ApplyState(newItem); + } - foreach (var ammo in Ammo) target.SetAmmo(ammo.Key, ammo.Value); + foreach (var ammo in Ammo) target.SetAmmo(ammo.Key, ammo.Value); - target.DisableAllEffects(); - foreach (EffectState state in SavedEffects) target.EnableEffect(state.Type, state.Intensity, state.Duration); + target.DisableAllEffects(); + foreach (EffectState state in SavedEffects) target.EnableEffect(state.Type, state.Intensity, state.Duration); + }); } } From b29f445bdfa86a04b6460d93796751b3e1545f4a Mon Sep 17 00:00:00 2001 From: OmerGS <27omerf@gmail.com> Date: Wed, 14 Jan 2026 21:49:32 +0100 Subject: [PATCH 519/853] add a check to not increase scp health during swapprotocol global event --- KruacentExiled/KE.Misc/Features/SCPBuff.cs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/KruacentExiled/KE.Misc/Features/SCPBuff.cs b/KruacentExiled/KE.Misc/Features/SCPBuff.cs index cc379c25..a0008146 100644 --- a/KruacentExiled/KE.Misc/Features/SCPBuff.cs +++ b/KruacentExiled/KE.Misc/Features/SCPBuff.cs @@ -31,7 +31,12 @@ internal void BuffXp() internal void BecomingSCP(ChangingRoleEventArgs ev) { - + if (ev.Player.SessionVariables.ContainsKey("KE.GlobalEvents.SwapProtocol.IsSwapping")) + { + ev.Player.SessionVariables.Remove("KE.GlobalEvents.SwapProtocol.IsSwapping"); + return; + } + if (!ev.NewRole.IsScp() || ev.NewRole == RoleTypeId.Scp0492) return; if(ev.Player.Role == RoleTypeId.None) return; Player p = ev.Player; From 3436fe07978d491c95d570412d95d6ffb309829b Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Wed, 14 Jan 2026 23:02:55 +0100 Subject: [PATCH 520/853] fixed PRSP not spawning after a round + added some new --- .../KE.Items/API/Features/KECustomGrenade.cs | 4 +- .../KE.Items/API/Features/KECustomItem.cs | 7 +- .../SpawnPoints/PoseRoomSpawnPoint.cs | 66 +++---------------- KruacentExiled/KE.Items/CommandPosRoom.cs | 45 +++++++++++-- KruacentExiled/KE.Items/MainPlugin.cs | 11 +++- 5 files changed, 67 insertions(+), 66 deletions(-) diff --git a/KruacentExiled/KE.Items/API/Features/KECustomGrenade.cs b/KruacentExiled/KE.Items/API/Features/KECustomGrenade.cs index a034c580..c82a979f 100644 --- a/KruacentExiled/KE.Items/API/Features/KECustomGrenade.cs +++ b/KruacentExiled/KE.Items/API/Features/KECustomGrenade.cs @@ -44,7 +44,7 @@ public override uint Spawn(IEnumerable spawnPoints, uint limit) ItemSpawn spawn = PoseRoomSpawnPointHandler.UseRandomPose(room.Room); Log.Debug($"spawning {this.Name} in {room.Room}"); - Log.Debug(room.Room + " : " + PoseRoomSpawnPointHandler.usablePose.Count(p => p.roomType == room.Room)); + Log.Debug(room.Room + " : " + PoseRoomSpawnPointHandler.UsablePoses.Count(p => p.roomType == room.Room)); if (spawn is not null) { @@ -53,7 +53,7 @@ public override uint Spawn(IEnumerable spawnPoints, uint limit) } else { - Log.Error($"can't spawn in custom"); + Log.Error($"can't spawn ({Name}) in custom ({room.Room})"); pickup = Spawn(spawnpoint.Position); } diff --git a/KruacentExiled/KE.Items/API/Features/KECustomItem.cs b/KruacentExiled/KE.Items/API/Features/KECustomItem.cs index c4c147c0..da7180cc 100644 --- a/KruacentExiled/KE.Items/API/Features/KECustomItem.cs +++ b/KruacentExiled/KE.Items/API/Features/KECustomItem.cs @@ -32,6 +32,9 @@ protected override void ShowSelectedMessage(Player player) public override uint Spawn(IEnumerable spawnPoints, uint limit) { + + + Log.Debug($"spawning {this.Name}"); HashSet spawns = spawnPoints.ToHashSet(); uint num = 0; @@ -45,7 +48,7 @@ public override uint Spawn(IEnumerable spawnPoints, uint limit) spawns.Remove(spawnpoint); RoomSpawnPoint room = spawnpoint as RoomSpawnPoint; ItemSpawn spawn = PoseRoomSpawnPointHandler.UseRandomPose(room.Room); - Log.Debug(room.Room+ " : "+PoseRoomSpawnPointHandler.usablePose.Count(p => p.roomType == room.Room)); + Log.Debug(room.Room+ " : "+PoseRoomSpawnPointHandler.UsablePoses.Count(p => p.roomType == room.Room)); Log.Debug($"spawning {this.Name} in {room.Room}" ); if (spawn is not null) @@ -55,7 +58,7 @@ public override uint Spawn(IEnumerable spawnPoints, uint limit) } else { - Log.Error($"can't spawn in custom"); + Log.Error($"can't spawn ({Name}) in custom ({room.Room})"); pickup = Spawn(spawnpoint.Position); } diff --git a/KruacentExiled/KE.Items/API/Features/SpawnPoints/PoseRoomSpawnPoint.cs b/KruacentExiled/KE.Items/API/Features/SpawnPoints/PoseRoomSpawnPoint.cs index cc96013f..091bf612 100644 --- a/KruacentExiled/KE.Items/API/Features/SpawnPoints/PoseRoomSpawnPoint.cs +++ b/KruacentExiled/KE.Items/API/Features/SpawnPoints/PoseRoomSpawnPoint.cs @@ -24,7 +24,6 @@ public class ItemSpawn : IEquatable public readonly Quaternion localrotation; - private Room room; public ItemSpawn(RoomType roomType,Vector3 position,Quaternion rotation) { @@ -37,12 +36,7 @@ private Room Room { get { - if(room is null) - { - room = Room.List.FirstOrDefault(r => r.Type == roomType); - if (room is null) throw new Exception($"room ({roomType}) not found"); - } - return room; + return Room.List.FirstOrDefault(r => r.Type == roomType); } } @@ -50,7 +44,7 @@ public Vector3 Position { get { - return Room.Position + room.Rotation * localposition; + return Room.Position + Room.Rotation * localposition; } } @@ -62,6 +56,7 @@ public Quaternion Rotation } } + public bool Equals(ItemSpawn other) { return other.roomType == roomType && other.localposition == localposition && other.localrotation == localrotation; @@ -69,8 +64,8 @@ public bool Equals(ItemSpawn other) } public static readonly HashSet AllPoses = new(); - private static HashSet UsablePoses = new(); - public static IReadOnlyCollection usablePose => UsablePoses; + private static HashSet usablePoses = new(); + public static IReadOnlyCollection UsablePoses => usablePoses; public static ItemSpawn UseRandomPose(RoomType roomType) { @@ -81,21 +76,12 @@ public static ItemSpawn UseRandomPose(RoomType roomType) } Log.Debug("count before =" + UsablePoses.Count(r => r.roomType == roomType)); ItemSpawn result = UsablePoses.GetRandomValue(r => r.roomType == roomType); - UsablePoses.Remove(result); + usablePoses.Remove(result); Log.Debug("count after =" + UsablePoses.Count(r => r.roomType == roomType)); return result; } - public static Vector3 ConvertLocal(Pose pose, Quaternion newRot) - { - - Vector3 originalLocal = pose.position; - Quaternion originalRot = pose.rotation; - Vector3 worldPos = originalRot * originalLocal; - - return Quaternion.Inverse(newRot) * worldPos; - } /// /// /// @@ -104,53 +90,21 @@ public static Vector3 ConvertLocal(Pose pose, Quaternion newRot) public static void AddRoomPoses(HashSet poses) { - - foreach(ItemSpawn item in poses) { AllPoses.Add(item); - UsablePoses.Add(item); + usablePoses.Add(item); } } - public static void ShowPoses(RoomType roomType) + public static void Reset() { - List primitives = new(); - Room room = Room.Get(roomType); - foreach (ItemSpawn pose in AllPoses.Where(p => p.roomType == roomType)) - { - - - Log.Info(pose.localposition); - Log.Info(pose.Position); - Color color = Color.red; - - if (UsablePoses.Contains(pose)) - { - color = Color.green; - } - - - Primitive prim = Primitive.Create(pose.Position, null, Vector3.one * .1f, false, color); - - prim.Spawn(); - primitives.Add(prim); - - - } - - - Timing.CallDelayed(5, delegate - { - foreach(Primitive primive in primitives) - { - primive.Destroy(); - } - }); + usablePoses = AllPoses.ToHashSet(); } + } diff --git a/KruacentExiled/KE.Items/CommandPosRoom.cs b/KruacentExiled/KE.Items/CommandPosRoom.cs index 0a0d1f91..cdd5055b 100644 --- a/KruacentExiled/KE.Items/CommandPosRoom.cs +++ b/KruacentExiled/KE.Items/CommandPosRoom.cs @@ -10,14 +10,15 @@ using System.Text; using System.Threading.Tasks; using UnityEngine; +using static KE.Items.API.Features.SpawnPoints.PoseRoomSpawnPointHandler; -namespace KE.Items.Patches +namespace KE.Items { [CommandHandler(typeof(RemoteAdminCommandHandler))] - internal class CommandPos : ICommand + internal class CommandPosRoom : ICommand { - public string Command => "posroom"; + public string Command => "roompos"; public string[] Aliases => []; @@ -38,12 +39,48 @@ public bool Execute(ArraySegment arguments, ICommandSender sender, out s return false; } - PoseRoomSpawnPointHandler.ShowPoses(room.Type); + ShowPoses(room.Type); response= "ok"; return true; } response = "no"; return false; } + + public static void ShowPoses(RoomType roomType) + { + List primitives = new(); + Room room = Room.Get(roomType); + foreach (ItemSpawn pose in AllPoses.Where(p => p.roomType == roomType)) + { + + + Log.Info(pose.localposition); + Log.Info(pose.Position); + Color color = Color.red; + + if (UsablePoses.Contains(pose)) + { + color = Color.green; + } + + + Primitive prim = Primitive.Create(pose.Position, null, Vector3.one * .1f, false, color); + prim.Collidable = false; + prim.Spawn(); + primitives.Add(prim); + + + } + + + Timing.CallDelayed(5, delegate + { + foreach (Primitive primive in primitives) + { + primive.Destroy(); + } + }); + } } } diff --git a/KruacentExiled/KE.Items/MainPlugin.cs b/KruacentExiled/KE.Items/MainPlugin.cs index 058a0b1c..9d6e2612 100644 --- a/KruacentExiled/KE.Items/MainPlugin.cs +++ b/KruacentExiled/KE.Items/MainPlugin.cs @@ -76,11 +76,18 @@ public override void OnEnabled() new(RoomType.HczHid,new Vector3(-6.44f,5.7f,-2.5f),Quaternion.identity), new(RoomType.Hcz127,new Vector3(4.77f, 1.12f, 1.83f),Quaternion.identity), new(RoomType.Hcz939,new Vector3(.6f, 1.3f, -2.8f),Quaternion.identity), + new(RoomType.LczCafe,new Vector3(-2.27f, 0.92f, 3.28f),Quaternion.identity), + new(RoomType.LczCafe,new Vector3(-2.38f, 0.87f, -1.49f),Quaternion.identity), + //new(RoomType.HczArmory,new Vector3(1.66f, 1.06f, -2.25f),Quaternion.identity), + //new(RoomType.HczArmory,new Vector3(1.33f, 1.06f, -1.66f),Quaternion.identity), + new(RoomType.Hcz049,new Vector3(-6.31f, 89.22f, -11.38f),Quaternion.identity), + new(RoomType.Hcz049,new Vector3(0.64f, 89.31f, 7.22f),Quaternion.identity), + new(RoomType.Hcz049,new Vector3(18.46f, 93.73f, 13.13f),Quaternion.identity), }); //Exiled.Events.Handlers.Server.RoundStarted += Test; - + CustomItem.RegisterItems(); //PickupQuality?.SubscribeEvents(); SettingsHandler.SubscribeEvents(); @@ -113,7 +120,7 @@ public override void OnDisabled() private void OnGenerated() { - + PoseRoomSpawnPointHandler.Reset(); } public void Test() From 06eec1ccd41fa5365ff51693d858a3fc6b573897 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Thu, 15 Jan 2026 12:29:26 +0100 Subject: [PATCH 521/853] update --- KruacentExiled/KE.CustomRoles/KE.CustomRoles.csproj | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/KruacentExiled/KE.CustomRoles/KE.CustomRoles.csproj b/KruacentExiled/KE.CustomRoles/KE.CustomRoles.csproj index a98e3e0f..a938d3b2 100644 --- a/KruacentExiled/KE.CustomRoles/KE.CustomRoles.csproj +++ b/KruacentExiled/KE.CustomRoles/KE.CustomRoles.csproj @@ -5,7 +5,8 @@ - + + From 7f46e862ac529a79a7158668ab01c5b3fe7ea816 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Thu, 15 Jan 2026 16:30:09 +0100 Subject: [PATCH 522/853] added icons to abilities + fixed sometime you couldn't use an ability --- .../API/Features/KEAbilities.cs | 157 +++++++++++++----- .../API/Features/KEAbilityCost.cs | 4 +- .../API/Features/KECustomRole.cs | 20 ++- .../API/HintPositions/AbilitiesPosition.cs | 47 ++++++ .../HintPositions/AddonAbilitiesPosition.cs | 45 +++++ .../CurrentCustomRolePosition.cs | 19 +++ .../KE.CustomRoles/Abilities/Airstrike.cs | 5 +- .../KE.CustomRoles/Abilities/Convert.cs | 5 +- .../KE.CustomRoles/Abilities/Explode.cs | 5 +- .../KE.CustomRoles/Abilities/ForceOpen.cs | 5 +- .../KE.CustomRoles/Abilities/SetPosition.cs | 5 +- .../KE.CustomRoles/Abilities/SimulateDeath.cs | 15 +- .../KE.CustomRoles/Abilities/Teleportation.cs | 5 +- .../KE.CustomRoles/Abilities/Trade.cs | 19 ++- .../KE.CustomRoles/CR/Human/Enderman.cs | 1 - .../KE.CustomRoles/Commands/ImageCommand.cs | 3 +- KruacentExiled/KE.CustomRoles/MainPlugin.cs | 2 +- .../KE.CustomRoles/Settings/SettingHandler.cs | 1 + 18 files changed, 292 insertions(+), 71 deletions(-) create mode 100644 KruacentExiled/KE.CustomRoles/API/HintPositions/AbilitiesPosition.cs create mode 100644 KruacentExiled/KE.CustomRoles/API/HintPositions/AddonAbilitiesPosition.cs create mode 100644 KruacentExiled/KE.CustomRoles/API/HintPositions/CurrentCustomRolePosition.cs diff --git a/KruacentExiled/KE.CustomRoles/API/Features/KEAbilities.cs b/KruacentExiled/KE.CustomRoles/API/Features/KEAbilities.cs index 9d6d0951..5ba6c9c9 100644 --- a/KruacentExiled/KE.CustomRoles/API/Features/KEAbilities.cs +++ b/KruacentExiled/KE.CustomRoles/API/Features/KEAbilities.cs @@ -1,8 +1,11 @@ using Exiled.API.Features; using Exiled.API.Features.Pools; +using HintServiceMeow.Core.Enum; using HintServiceMeow.Core.Extension; +using HintServiceMeow.Core.Models.Arguments; using HintServiceMeow.Core.Models.Hints; using KE.CustomRoles.Abilities.FireAbilities; +using KE.CustomRoles.API.HintPositions; using KE.CustomRoles.API.Interfaces; using KE.CustomRoles.Settings; using KE.Utils.API; @@ -50,6 +53,10 @@ public abstract class KEAbilities public static Dictionary> PlayersAbility { get;} = new(); + + + + protected KEAbilities() { @@ -183,15 +190,8 @@ public void AddAbility(Player player) PlayersAbility.Add(player, new()); } PlayersAbility[player].Add(this); + InitHints(player); - var hint = DisplayHandler.Instance.CreateAuto(player, arg => UpdateGUI(player), AbilityPosition.HintPlacement); - - - - IEnumerable hints =player.GetPlayerDisplay().GetHints(hint.Id); - - Log.Debug("id="+ hint.Id); - Log.Debug("hgints="+hints.Count()); AbilityAdded(player); } @@ -252,8 +252,10 @@ public static void UseSelected(Player player) { if(TryGetSelected(player,out var ability)) { + Log.Debug("got selected " + ability.Name); if (ability.CanUse(player, out string _)) { + Log.Debug("can use"); ability.UseAbility(player); } } @@ -299,6 +301,7 @@ public static void SelectFirstAbility(Player player,bool hide = false) public static void TryRemoveFromPlayer(Player player) { + RemoveAllSelect(player); foreach(KEAbilities abilities in Registered) { if (abilities.Players.Contains(player)) @@ -424,63 +427,139 @@ public static bool TryGetSelected(Player player, out KEAbilities ability) public const string ReadyText = "[READY]"; - public static readonly AbilitiesPosition AbilityPosition = new(); - protected virtual void Gui(StringBuilder sb) + protected virtual void Gui(StringBuilder sb,Player player) { sb.Append(PublicName); sb.Append(" "); - if (this is ICustomIcon) - { + if (CanUse(player, out var output)) + { + sb.Append(ReadyText); } - } - - - public static string UpdateGUI(Player player) - { - StringBuilder builder = StringBuilderPool.Pool.Get(); - - - List allAbilities = PlayersAbility[player]; - - for (int i = 0; i < allAbilities.Count; i++) + else { + DateTime dateTime = LastUsed[player] + TimeSpan.FromSeconds(Cooldown); + sb.Append("["); + sb.Append(Math.Round((dateTime - DateTime.Now).TotalSeconds, 0)); + sb.Append("s]"); + } - KEAbilities ability = allAbilities[i]; - ability.Gui(builder); - if (ability.CanUse(player,out var output)) + if (Selected.Contains(player)) + { + string arrow = SettingHandler.Instance.GetArrow(player); + if (string.IsNullOrEmpty(arrow)) { - builder.Append(ReadyText); + arrow = SettingHandler.baseArrow; } - else + sb.Append(arrow); + } + } + public static Dictionary> PlayersHints { get; } = new(); + public static Dictionary AddonHints { get; } = new(); + public const int InitialAbilitySlot = 5; + private void InitHints(Player player) + { + + + if (!PlayersHints.TryGetValue(player, out var _)) + { + PlayersHints.Add(player, new()); + for (int i = 0; i < InitialAbilitySlot; i++) { - DateTime dateTime = ability.LastUsed[player] + TimeSpan.FromSeconds(ability.Cooldown); - builder.Append("["); - builder.Append(Math.Round((dateTime - DateTime.Now).TotalSeconds, 0)); - builder.Append("s]"); + AbilitiesPosition position = AbilitiesPosition.GetIndex(i); + AbstractHint hint = DisplayHandler.Instance.CreateAuto(player, arg => UpdateHint(arg), position.HintPlacement); + PlayersHints[player].Add(hint); + AddonHints.Add(hint, DisplayHandler.Instance.CreateAuto(player, arg => UpdateAddon(arg,hint), AddonAbilitiesPosition.Get(position).HintPlacement,HintSyncSpeed.Slow)); } + } - - if (ability.Selected.Contains(player)) + } + + private static HashSet addonAbilitiesexception = new(); + + /// + /// + /// + /// + /// the other hint + /// + private static string UpdateAddon(AutoContentUpdateArg arg,AbstractHint hint) + { + Player player = Player.Get(arg.PlayerDisplay.ReferenceHub); + int index = PlayersHints[player].FindIndex(h => h == hint); + + if (PlayersAbility[player].TryGet(index, out KEAbilities ability)) + { + if (ability is ICustomIcon icon && !addonAbilitiesexception.Contains(ability)) { - string arrow = SettingHandler.Instance.GetArrow(player); - if (string.IsNullOrEmpty(arrow)) + string msg = " "; + try { - arrow = SettingHandler.baseArrow; + msg = icon.IconName.RawString; } - builder.Append(arrow); + catch(KeyNotFoundException) + { + addonAbilitiesexception.Add(ability); + Log.Error("Icon for ability "+ ability.Name+ " is missing"); + } + return msg; } - builder.AppendLine(); + } + return " "; + } + + + + private static string UpdateHint(AutoContentUpdateArg arg) + { + Player player = Player.Get(arg.PlayerDisplay.ReferenceHub); + int index = PlayersHints[player].FindIndex(h => h == arg.Hint); + + + + + + + + if (PlayersAbility[player].TryGet(index,out KEAbilities ability)) + { + + StringBuilder sb = StringBuilderPool.Pool.Get(); + ability.Gui(sb,player); + return StringBuilderPool.Pool.ToStringReturn(sb); + } + + + + return " "; + } + + + public static string UpdateGUI(Player player) + { + StringBuilder builder = StringBuilderPool.Pool.Get(); + + + List allAbilities = PlayersAbility[player]; + + for (int i = 0; i < allAbilities.Count; i++) + { + + + KEAbilities ability = allAbilities[i]; + ability.Gui(builder,player); + + } string msg = builder.ToString(); diff --git a/KruacentExiled/KE.CustomRoles/API/Features/KEAbilityCost.cs b/KruacentExiled/KE.CustomRoles/API/Features/KEAbilityCost.cs index 0f69ff86..1e6e1f81 100644 --- a/KruacentExiled/KE.CustomRoles/API/Features/KEAbilityCost.cs +++ b/KruacentExiled/KE.CustomRoles/API/Features/KEAbilityCost.cs @@ -31,9 +31,9 @@ protected virtual bool LaunchedAbility(Player player) public abstract bool CanLaunchAbility(Player player); - protected override void Gui(StringBuilder sb) + protected override void Gui(StringBuilder sb,Player player) { - base.Gui(sb); + base.Gui(sb,player); sb.Append("("); sb.Append(Cost); sb.Append(")"); diff --git a/KruacentExiled/KE.CustomRoles/API/Features/KECustomRole.cs b/KruacentExiled/KE.CustomRoles/API/Features/KECustomRole.cs index 2be3b7ea..18fb86b9 100644 --- a/KruacentExiled/KE.CustomRoles/API/Features/KECustomRole.cs +++ b/KruacentExiled/KE.CustomRoles/API/Features/KECustomRole.cs @@ -9,7 +9,9 @@ using Exiled.CustomRoles.API; using Exiled.CustomRoles.API.Features; using Exiled.Events.EventArgs.Player; +using HintServiceMeow.Core.Models.Hints; using InventorySystem.Configs; +using KE.CustomRoles.API.HintPositions; using KE.CustomRoles.API.Interfaces; using KE.Utils.API.Displays.DisplayMeow; using KE.Utils.API.Displays.DisplayMeow.Placements; @@ -191,6 +193,8 @@ public override void AddRole(Player player) { Player player2 = player; Log.Debug(Name + ": Adding role to " + player2.Nickname + "."); + Log.Debug(Name + ": old role type " + player2.Role.Type + "."); + Log.Debug(Name + ": new role type " + Role + "."); CurrentNumberOfSpawn++; IEnumerable oldroles = Get(player2); @@ -200,9 +204,12 @@ public override void AddRole(Player player) role.RemoveRole(player2); } + + + if (Role != RoleTypeId.None) { - + Log.Debug("new role exist"); if (KeepPositionOnSpawn) { if (KeepInventoryOnSpawn) @@ -250,8 +257,14 @@ public override void AddRole(Player player) + if (PlayerHints.Add(player)) + { + ContinuousShow(player2); + + } + ShowMessage(player2); - ContinuousShow(player2); + RoleAdded(player2); player2.UniqueRole = Name; player2.TryAddCustomRoleFriendlyFire(Name, CustomRoleFFMultiplier); @@ -259,9 +272,12 @@ public override void AddRole(Player player) private void ContinuousShow(Player player) { + Log.Debug("adding show hint to player " + player.Nickname); DisplayHandler.Instance.CreateAuto(player, arg => CurrentRole(player), CurrentCustomRolePosition.HintPlacement); } + private static HashSet PlayerHints = new(); + private static HintPosition CurrentCustomRolePosition = new CurrentCustomRolePosition(); diff --git a/KruacentExiled/KE.CustomRoles/API/HintPositions/AbilitiesPosition.cs b/KruacentExiled/KE.CustomRoles/API/HintPositions/AbilitiesPosition.cs new file mode 100644 index 00000000..1724e5c6 --- /dev/null +++ b/KruacentExiled/KE.CustomRoles/API/HintPositions/AbilitiesPosition.cs @@ -0,0 +1,47 @@ +using Exiled.API.Features; +using HintServiceMeow.Core.Enum; +using KE.CustomRoles.API.Features; +using KE.Utils.API.Displays.DisplayMeow.Placements; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace KE.CustomRoles.API.HintPositions +{ + public class AbilitiesPosition : HintPosition + { + + + public const float BaseYPosition = 800; + public const float Increments = -50; + private float yposition = BaseYPosition; + public override float Xposition => -300; + + public override float Yposition => yposition; + + private int index; + public int Index => index; + + private static List nonalloc = new(KEAbilities.InitialAbilitySlot); + + + public static AbilitiesPosition GetIndex(int index) + { + if (!nonalloc.TryGet(index, out AbilitiesPosition position)) + { + position = new AbilitiesPosition() + { + yposition = BaseYPosition + index * 50, + index = index + }; + } + Log.Debug($"get index {index} y pos=" + position.Yposition); + return position; + + } + + public override HintAlignment HintAlignment => HintAlignment.Left; + } +} diff --git a/KruacentExiled/KE.CustomRoles/API/HintPositions/AddonAbilitiesPosition.cs b/KruacentExiled/KE.CustomRoles/API/HintPositions/AddonAbilitiesPosition.cs new file mode 100644 index 00000000..ddf6a5f8 --- /dev/null +++ b/KruacentExiled/KE.CustomRoles/API/HintPositions/AddonAbilitiesPosition.cs @@ -0,0 +1,45 @@ +using Exiled.API.Features; +using HintServiceMeow.Core.Enum; +using KE.CustomRoles.API.Features; +using KE.Utils.API.Displays.DisplayMeow.Placements; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace KE.CustomRoles.API.HintPositions +{ + public class AddonAbilitiesPosition : HintPosition + { + + + private float yposition = AbilitiesPosition.BaseYPosition; + public override float Xposition => -350; + + public override float Yposition => yposition; + + + private static List nonalloc = new(KEAbilities.InitialAbilitySlot); + + + public static AddonAbilitiesPosition Get(AbilitiesPosition abilitiesPosition) + { + if (abilitiesPosition is null) throw new ArgumentNullException(); + int index = abilitiesPosition.Index; + + if (!nonalloc.TryGet(index, out AddonAbilitiesPosition position)) + { + position = new AddonAbilitiesPosition() + { + yposition = abilitiesPosition.Yposition+5 + }; + } + Log.Debug($"addon get {index} y pos=" + position.Yposition); + return position; + + } + + public override HintAlignment HintAlignment => HintAlignment.Left; + } +} diff --git a/KruacentExiled/KE.CustomRoles/API/HintPositions/CurrentCustomRolePosition.cs b/KruacentExiled/KE.CustomRoles/API/HintPositions/CurrentCustomRolePosition.cs new file mode 100644 index 00000000..ac8412de --- /dev/null +++ b/KruacentExiled/KE.CustomRoles/API/HintPositions/CurrentCustomRolePosition.cs @@ -0,0 +1,19 @@ +using HintServiceMeow.Core.Enum; +using KE.Utils.API.Displays.DisplayMeow.Placements; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace KE.CustomRoles.API.HintPositions +{ + public class CurrentCustomRolePosition : HintPosition + { + public override float Xposition => 600; + + public override float Yposition => 1030; + + public override HintAlignment HintAlignment => HintAlignment.Center; + } +} diff --git a/KruacentExiled/KE.CustomRoles/Abilities/Airstrike.cs b/KruacentExiled/KE.CustomRoles/Abilities/Airstrike.cs index ac609a86..8a03bcfa 100644 --- a/KruacentExiled/KE.CustomRoles/Abilities/Airstrike.cs +++ b/KruacentExiled/KE.CustomRoles/Abilities/Airstrike.cs @@ -5,6 +5,7 @@ using Exiled.API.Features.Toys; using Exiled.CustomRoles.API.Features; using KE.CustomRoles.API.Features; +using KE.CustomRoles.API.Interfaces; using MapGeneration; using MEC; using System; @@ -17,7 +18,7 @@ namespace KE.CustomRoles.Abilities { - public class Airstrike : KEAbilities + public class Airstrike : KEAbilities, ICustomIcon { public override string Name { get; } = "AirStrike"; public override string PublicName { get; } = "Airstrike"; @@ -26,8 +27,8 @@ public class Airstrike : KEAbilities public override float Cooldown { get; } = 60f; public float height = 5; + public Utils.API.GifAnimator.TextImage IconName => MainPlugin.Instance.icons["Airstrike"]; - protected override bool AbilityUsed(Player player) { diff --git a/KruacentExiled/KE.CustomRoles/Abilities/Convert.cs b/KruacentExiled/KE.CustomRoles/Abilities/Convert.cs index 0f7d4049..0cc13456 100644 --- a/KruacentExiled/KE.CustomRoles/Abilities/Convert.cs +++ b/KruacentExiled/KE.CustomRoles/Abilities/Convert.cs @@ -3,6 +3,7 @@ using Exiled.API.Features.Toys; using Exiled.CustomRoles.API.Features; using KE.CustomRoles.API.Features; +using KE.CustomRoles.API.Interfaces; using MEC; using PlayerRoles; using System; @@ -14,7 +15,7 @@ namespace KE.CustomRoles.Abilities { - public class Convert : KEAbilities + public class Convert : KEAbilities, ICustomIcon { public override string Name { get; } = "Convert"; public override string PublicName { get; } = "Convert"; @@ -25,7 +26,7 @@ public class Convert : KEAbilities public float MaxDistance { get; set; } = 15f; - + public Utils.API.GifAnimator.TextImage IconName => MainPlugin.Instance.icons["Convert"]; protected override bool AbilityUsed(Player player) { if (!Physics.Raycast(player.Position+ player.CameraTransform.rotation *Vector3.forward, player.Rotation.eulerAngles, out RaycastHit hit)) return false; diff --git a/KruacentExiled/KE.CustomRoles/Abilities/Explode.cs b/KruacentExiled/KE.CustomRoles/Abilities/Explode.cs index 00d3b615..ae308210 100644 --- a/KruacentExiled/KE.CustomRoles/Abilities/Explode.cs +++ b/KruacentExiled/KE.CustomRoles/Abilities/Explode.cs @@ -3,6 +3,7 @@ using Exiled.API.Features.Items; using Exiled.CustomRoles.API.Features; using KE.CustomRoles.API.Features; +using KE.CustomRoles.API.Interfaces; using System; using System.Collections.Generic; using System.Linq; @@ -12,7 +13,7 @@ namespace KE.CustomRoles.Abilities { - public class Explode : KEAbilities + public class Explode : KEAbilities, ICustomIcon { public override string Name { get; } = "Explode"; public override string PublicName { get; } = "Explode"; @@ -21,6 +22,8 @@ public class Explode : KEAbilities public override float Cooldown { get; } = 4*60f; + public Utils.API.GifAnimator.TextImage IconName => MainPlugin.Instance.icons["Explode"]; + protected override bool AbilityUsed(Player player) { ExplosiveGrenade grenade = ((ExplosiveGrenade)Item.Create(ItemType.GrenadeHE)); diff --git a/KruacentExiled/KE.CustomRoles/Abilities/ForceOpen.cs b/KruacentExiled/KE.CustomRoles/Abilities/ForceOpen.cs index a8aa3b78..ee3466d4 100644 --- a/KruacentExiled/KE.CustomRoles/Abilities/ForceOpen.cs +++ b/KruacentExiled/KE.CustomRoles/Abilities/ForceOpen.cs @@ -5,6 +5,7 @@ using Exiled.CustomRoles.API.Features; using Exiled.Events.EventArgs.Player; using KE.CustomRoles.API.Features; +using KE.CustomRoles.API.Interfaces; using PlayerRoles; using System; using System.Collections.Generic; @@ -15,13 +16,13 @@ namespace KE.CustomRoles.Abilities { - public class ForceOpen : KEAbilities + public class ForceOpen : KEAbilities, ICustomIcon { public override string Name { get; } = "ForceOpen"; public override string PublicName { get; } = "Force open"; public override string Description { get; } = "Force open a door"; - + public Utils.API.GifAnimator.TextImage IconName => MainPlugin.Instance.icons["ForceOpen"]; public override float Cooldown { get; } = 30; private Dictionary abilityActivated = new(); public static readonly TimeSpan MaxTime = new (0, 0, 30); diff --git a/KruacentExiled/KE.CustomRoles/Abilities/SetPosition.cs b/KruacentExiled/KE.CustomRoles/Abilities/SetPosition.cs index 6317cc36..a139eaef 100644 --- a/KruacentExiled/KE.CustomRoles/Abilities/SetPosition.cs +++ b/KruacentExiled/KE.CustomRoles/Abilities/SetPosition.cs @@ -1,11 +1,12 @@ using Exiled.API.Features; using KE.CustomRoles.API.Features; +using KE.CustomRoles.API.Interfaces; using System.Collections.Generic; using UnityEngine; namespace KE.CustomRoles.Abilities { - public class SetPosition : KEAbilities + public class SetPosition : KEAbilities, ICustomIcon { public override string Name { get; } = "SetPosition"; public override string PublicName { get; } = "Set Position"; @@ -15,6 +16,8 @@ public class SetPosition : KEAbilities private static Dictionary SelectedTarget = new(); + public Utils.API.GifAnimator.TextImage IconName => MainPlugin.Instance.icons[Name]; + protected override bool AbilityUsed(Player player) { diff --git a/KruacentExiled/KE.CustomRoles/Abilities/SimulateDeath.cs b/KruacentExiled/KE.CustomRoles/Abilities/SimulateDeath.cs index cf7380ff..d45e3682 100644 --- a/KruacentExiled/KE.CustomRoles/Abilities/SimulateDeath.cs +++ b/KruacentExiled/KE.CustomRoles/Abilities/SimulateDeath.cs @@ -1,16 +1,17 @@ -using Exiled.API.Features; +using Exiled.API.Enums; +using Exiled.API.Extensions; +using Exiled.API.Features; using KE.CustomRoles.API.Features; -using Exiled.API.Enums; +using KE.CustomRoles.API.Interfaces; +using MEC; using PlayerRoles.FirstPersonControl.Thirdperson.Subcontrollers; +using PlayerStatsSystem; using System.Collections.Generic; using UnityEngine; -using Exiled.API.Extensions; -using MEC; -using PlayerStatsSystem; namespace KE.CustomRoles.Abilities { - public class SimulateDeath : KEAbilities + public class SimulateDeath : KEAbilities, ICustomIcon { public override string Name { get; } = "SimulateDeath"; public override string PublicName { get; } = "Simulate Death"; @@ -18,7 +19,7 @@ public class SimulateDeath : KEAbilities public override string Description { get; } = "T'es talent de mime te permettent de simuler la mort."; public int Duration = 10; - + public Utils.API.GifAnimator.TextImage IconName => MainPlugin.Instance.icons[Name]; public override float Cooldown { get; } = 60f; protected override bool AbilityUsed(Player player) diff --git a/KruacentExiled/KE.CustomRoles/Abilities/Teleportation.cs b/KruacentExiled/KE.CustomRoles/Abilities/Teleportation.cs index 323405d9..729d56fd 100644 --- a/KruacentExiled/KE.CustomRoles/Abilities/Teleportation.cs +++ b/KruacentExiled/KE.CustomRoles/Abilities/Teleportation.cs @@ -1,20 +1,21 @@ using Exiled.API.Extensions; using Exiled.API.Features; using KE.CustomRoles.API.Features; +using KE.CustomRoles.API.Interfaces; using MapGeneration; using System.Linq; using UnityEngine; namespace KE.CustomRoles.Abilities { - public class Teleportation : KEAbilities + public class Teleportation : KEAbilities, ICustomIcon { public override string Name { get; } = "Teleportation"; public override string PublicName { get; } = "Teleportation"; public override string Description { get; } = $"Tu perds {Damage} HP/téléportation, ne peux pas être utilisé dans les ascenseurs"; - + public Utils.API.GifAnimator.TextImage IconName => MainPlugin.Instance.icons["Teleportation"]; public override float Cooldown { get; } = 130f; public static float Damage { get; set; } = 60; diff --git a/KruacentExiled/KE.CustomRoles/Abilities/Trade.cs b/KruacentExiled/KE.CustomRoles/Abilities/Trade.cs index 386c17d1..acffa489 100644 --- a/KruacentExiled/KE.CustomRoles/Abilities/Trade.cs +++ b/KruacentExiled/KE.CustomRoles/Abilities/Trade.cs @@ -2,6 +2,7 @@ using Exiled.API.Features.Attributes; using Exiled.CustomRoles.API.Features; using KE.CustomRoles.API.Features; +using KE.CustomRoles.API.Interfaces; using System; using System.Collections.Generic; using System.Linq; @@ -11,14 +12,14 @@ namespace KE.CustomRoles.Abilities { - public class Trade : KEAbilities + public class Trade : KEAbilities, ICustomIcon { public override string Name { get; } = "Trade"; public override string PublicName { get; } = "Trade"; - public override string Description { get; } = "T'es lien avec le casino t'as permis d'avoir un peu plus de pièce en échange d'un item ou de pire"; - + public override string Description { get; } = "T'es lien avec le casino t'as permis d'avoir un peu plus de pièce en échange d'un item"; + public Utils.API.GifAnimator.TextImage IconName => MainPlugin.Instance.icons[Name]; public override float Cooldown { get; } = 1f; public static float MaxHealthPercent = .1f; @@ -31,17 +32,19 @@ protected override bool AbilityUsed(Player player) } else { - float newMaxHealth = player.MaxHealth - player.MaxHealth * MaxHealthPercent; - if (newMaxHealth > 0) + MainPlugin.ShowEffectHint(player, "no items?"); + return false; + /* + float newHealth = player.MaxHealth - player.MaxHealth * MaxHealthPercent; + if (newHealth > 0) { - player.MaxHealth = newMaxHealth; - player.Health = Mathf.Min(player.Health, player.MaxHealth); + player.Health = Mathf.Min(player.Health, newHealth); } else { player.Kill("The casino always win"); return base.AbilityUsed(player); - } + }*/ } player.AddItem(ItemType.Coin); diff --git a/KruacentExiled/KE.CustomRoles/CR/Human/Enderman.cs b/KruacentExiled/KE.CustomRoles/CR/Human/Enderman.cs index 181fa64a..5e744ac8 100644 --- a/KruacentExiled/KE.CustomRoles/CR/Human/Enderman.cs +++ b/KruacentExiled/KE.CustomRoles/CR/Human/Enderman.cs @@ -9,7 +9,6 @@ namespace KE.CustomRoles.CR.Human { - [CustomRole(RoleTypeId.None)] internal class Enderman : GlobalCustomRole, IColor { public override SideEnum Side { get; set; } = SideEnum.Human; diff --git a/KruacentExiled/KE.CustomRoles/Commands/ImageCommand.cs b/KruacentExiled/KE.CustomRoles/Commands/ImageCommand.cs index 9ebd7fe6..d6c618f9 100644 --- a/KruacentExiled/KE.CustomRoles/Commands/ImageCommand.cs +++ b/KruacentExiled/KE.CustomRoles/Commands/ImageCommand.cs @@ -1,6 +1,7 @@ using CommandSystem; using Exiled.API.Features; using KE.CustomRoles.API.Features; +using KE.CustomRoles.API.HintPositions; using KE.Utils.API.Commands; using KE.Utils.API.Displays.DisplayMeow; using KE.Utils.API.GifAnimator; @@ -51,7 +52,7 @@ public bool Execute(ArraySegment arguments, ICommandSender sender, out s { TextImage imaeg = new TextImage(Image.FromFile(MainPlugin.ImageLocation + "/Explode.png"), size); - DisplayHandler.Instance.AddHint(KEAbilities.AbilityPosition.HintPlacement, Player.Get(sender), imaeg.RawString, 30); + DisplayHandler.Instance.AddHint(AbilitiesPosition.GetIndex(0).HintPlacement, Player.Get(sender), imaeg.RawString, 30); } catch (Exception e2) { diff --git a/KruacentExiled/KE.CustomRoles/MainPlugin.cs b/KruacentExiled/KE.CustomRoles/MainPlugin.cs index ec8e887f..0c61bacf 100644 --- a/KruacentExiled/KE.CustomRoles/MainPlugin.cs +++ b/KruacentExiled/KE.CustomRoles/MainPlugin.cs @@ -122,7 +122,7 @@ private void LoadImage() { string noExFile = Path.GetFileNameWithoutExtension(file); Log.Info($"loading {file} as {noExFile}"); - icons.Add(noExFile,new TextImage(Image.FromFile(file),2)); + icons.Add(noExFile,new TextImage(Image.FromFile(file),5)); } } diff --git a/KruacentExiled/KE.CustomRoles/Settings/SettingHandler.cs b/KruacentExiled/KE.CustomRoles/Settings/SettingHandler.cs index 3759fed8..560215dd 100644 --- a/KruacentExiled/KE.CustomRoles/Settings/SettingHandler.cs +++ b/KruacentExiled/KE.CustomRoles/Settings/SettingHandler.cs @@ -233,6 +233,7 @@ private void OnSettingValueReceived(Player player, ServerSpecificSettingBase set if (CheckPressed(settingBase, _idSelect)) { + Log.Debug("select"); KEAbilities.UseSelected(player); } if (created) From 67e530a753b22cf0f6cf656cef0cbc33a2a288eb Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Thu, 15 Jan 2026 16:45:07 +0100 Subject: [PATCH 523/853] added event to scpbuff --- .../Events/EventsArgs/BuffedSCPEventArgs .cs | 24 ++++++++++++++++ .../Events/EventsArgs/BuffingSCPEventArgs.cs | 26 +++++++++++++++++ KruacentExiled/KE.Misc/Features/SCPBuff.cs | 28 +++++++++++++++---- 3 files changed, 72 insertions(+), 6 deletions(-) create mode 100644 KruacentExiled/KE.Misc/Events/EventsArgs/BuffedSCPEventArgs .cs create mode 100644 KruacentExiled/KE.Misc/Events/EventsArgs/BuffingSCPEventArgs.cs diff --git a/KruacentExiled/KE.Misc/Events/EventsArgs/BuffedSCPEventArgs .cs b/KruacentExiled/KE.Misc/Events/EventsArgs/BuffedSCPEventArgs .cs new file mode 100644 index 00000000..7de27722 --- /dev/null +++ b/KruacentExiled/KE.Misc/Events/EventsArgs/BuffedSCPEventArgs .cs @@ -0,0 +1,24 @@ +using Exiled.API.Features; +using Exiled.Events.EventArgs.Interfaces; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace KE.Misc.Events.EventsArgs +{ + public class BuffedSCPEventArgs : IExiledEvent, IPlayerEvent + { + + public Player Player { get; } + + public float BuffAmount { get; set; } + + public BuffedSCPEventArgs(Player player,float buff) + { + Player = player; + BuffAmount = buff; + } + } +} diff --git a/KruacentExiled/KE.Misc/Events/EventsArgs/BuffingSCPEventArgs.cs b/KruacentExiled/KE.Misc/Events/EventsArgs/BuffingSCPEventArgs.cs new file mode 100644 index 00000000..1a836c31 --- /dev/null +++ b/KruacentExiled/KE.Misc/Events/EventsArgs/BuffingSCPEventArgs.cs @@ -0,0 +1,26 @@ +using Exiled.API.Features; +using Exiled.Events.EventArgs.Interfaces; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace KE.Misc.Events.EventsArgs +{ + public class BuffingSCPEventArgs : IExiledEvent, IDeniableEvent, IPlayerEvent + { + public bool IsAllowed { get; set; } + + public Player Player { get; } + + public float BuffAmount { get; set; } + + public BuffingSCPEventArgs(Player player,bool isAllowed,float buff) + { + Player = player; + IsAllowed = isAllowed; + BuffAmount = buff; + } + } +} diff --git a/KruacentExiled/KE.Misc/Features/SCPBuff.cs b/KruacentExiled/KE.Misc/Features/SCPBuff.cs index c5969b8e..8fd466ac 100644 --- a/KruacentExiled/KE.Misc/Features/SCPBuff.cs +++ b/KruacentExiled/KE.Misc/Features/SCPBuff.cs @@ -4,10 +4,12 @@ using Exiled.Events.EventArgs.Player; using Exiled.Events.EventArgs.Scp106; using Exiled.Permissions.Commands.Permissions; +using KE.Misc.Events.EventsArgs; using KE.Utils.API.Interfaces; using KE.Utils.Extensions; using MEC; using PlayerRoles; +using System; using System.Collections.Generic; using System.Linq; using UnityEngine; @@ -20,6 +22,9 @@ public class SCPBuff : IUsingEvents public float IncreaseSCPHealth { get; } = 1.25f; internal SCPBuff() { } + public static event Action OnBuffingSCP = delegate { }; + public static event Action OnBuffedSCP = delegate { }; + public void SubscribeEvents() { Exiled.Events.Handlers.Player.ChangingRole += BecomingSCP; @@ -43,20 +48,31 @@ internal void StartBuff() private void BecomingSCP(ChangingRoleEventArgs ev) { + Player player = ev.Player; if (ev.Player.SessionVariables.ContainsKey("KE.GlobalEvents.SwapProtocol.IsSwapping")) { ev.Player.SessionVariables.Remove("KE.GlobalEvents.SwapProtocol.IsSwapping"); return; } + if (!ev.NewRole.IsScp() || ev.NewRole == RoleTypeId.Scp0492) return; - if(ev.Player.Role == RoleTypeId.None) return; - Player p = ev.Player; - Timing.CallDelayed(2, () => + if(player.Role == RoleTypeId.None) return; + BuffingSCPEventArgs ev1 = new(player, true, IncreaseSCPHealth); + + OnBuffingSCP?.Invoke(ev1); + if (ev1.IsAllowed) { - p.MaxHealth *= IncreaseSCPHealth; - p.Health = p.MaxHealth; - }); + Timing.CallDelayed(2, () => + { + player.MaxHealth *= IncreaseSCPHealth; + player.Health = player.MaxHealth; + }); + BuffedSCPEventArgs ev2 = new(player, IncreaseSCPHealth); + OnBuffedSCP?.Invoke(ev2); + } + + } From abb0b7139853c3bf6964cf35e525ff9f638c94c8 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Thu, 15 Jan 2026 16:52:42 +0100 Subject: [PATCH 524/853] removed the session variable --- KruacentExiled/KE.Misc/Features/SCPBuff.cs | 7 ------- 1 file changed, 7 deletions(-) diff --git a/KruacentExiled/KE.Misc/Features/SCPBuff.cs b/KruacentExiled/KE.Misc/Features/SCPBuff.cs index 8fd466ac..97ee98a5 100644 --- a/KruacentExiled/KE.Misc/Features/SCPBuff.cs +++ b/KruacentExiled/KE.Misc/Features/SCPBuff.cs @@ -49,13 +49,6 @@ internal void StartBuff() private void BecomingSCP(ChangingRoleEventArgs ev) { Player player = ev.Player; - if (ev.Player.SessionVariables.ContainsKey("KE.GlobalEvents.SwapProtocol.IsSwapping")) - { - ev.Player.SessionVariables.Remove("KE.GlobalEvents.SwapProtocol.IsSwapping"); - return; - } - - if (!ev.NewRole.IsScp() || ev.NewRole == RoleTypeId.Scp0492) return; if(player.Role == RoleTypeId.None) return; BuffingSCPEventArgs ev1 = new(player, true, IncreaseSCPHealth); From 3d54d39eadf85fc2b68a25074f818c9a4f97f9d3 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Tue, 20 Jan 2026 14:51:06 +0100 Subject: [PATCH 525/853] doorstuck events --- .../KE.Map/Others/BlackoutNDoor/DoorStuck.cs | 31 ++++++++++++++++--- .../Events/EventArgs/DoorStuckEventArgs.cs | 26 ++++++++++++++++ .../Events/Handlers/DoorStuckHandler.cs | 26 ++++++++++++++++ .../Others/BlackoutNDoor/Events/IZoneType.cs | 15 +++++++++ 4 files changed, 93 insertions(+), 5 deletions(-) create mode 100644 KruacentExiled/KE.Map/Others/BlackoutNDoor/Events/EventArgs/DoorStuckEventArgs.cs create mode 100644 KruacentExiled/KE.Map/Others/BlackoutNDoor/Events/Handlers/DoorStuckHandler.cs create mode 100644 KruacentExiled/KE.Map/Others/BlackoutNDoor/Events/IZoneType.cs diff --git a/KruacentExiled/KE.Map/Others/BlackoutNDoor/DoorStuck.cs b/KruacentExiled/KE.Map/Others/BlackoutNDoor/DoorStuck.cs index 2c365b11..9a84f45e 100644 --- a/KruacentExiled/KE.Map/Others/BlackoutNDoor/DoorStuck.cs +++ b/KruacentExiled/KE.Map/Others/BlackoutNDoor/DoorStuck.cs @@ -1,8 +1,11 @@ using Exiled.API.Enums; using Exiled.API.Features.Doors; using Interactables.Interobjects.DoorUtils; +using KE.Map.Others.BlackoutNDoor.Events.EventArgs; +using KE.Map.Others.BlackoutNDoor.Events.Handlers; using KE.Map.Others.BlackoutNDoor.Handlers; using KE.Utils.API.Map; +using System; using System.Collections.Generic; using System.Linq; @@ -13,21 +16,21 @@ public class DoorStuck : MapEvent { private static HashSet doors = new(); - public override string Cassie => MainPlugin.Translations.Doorstuck; public override string CassieTranslated => MainPlugin.Translations.DoorstuckTranslation; public override float Duration => 15; + public override void Start(ZoneType zone) { bool open = UnityEngine.Random.value > .5f; + doors = new(); foreach (Door door in Door.List.Where(d => d.Zone == zone && !d.IsElevator && d.Type != DoorType.Scp079First && d.Type != DoorType.Scp079Second)) { - if (door.DoorLockType == DoorLockType.None) { doors.Add(door); - LockDoor(door, open); + } } @@ -39,11 +42,27 @@ public override void Start(ZoneType zone) if (door2.DoorLockType == DoorLockType.None) { doors.Add(door2); - LockDoor(door2, open); } - } } + + DoorStuckEventArgs ev = new(doors,zone,true); + DoorStuckHandler.OnDoorStucking(ev); + + if (ev.IsAllowed) + { + doors = ev.Doors; + foreach (Door door in doors) + { + LockDoor(door, open); + } + } + else + { + doors.Clear(); + } + + } private void LockDoor(Door door, bool open) @@ -60,6 +79,8 @@ public override void Stop(ZoneType zone) door.IsOpen = open; door.ChangeLock(DoorLockType.None); } + + } } } diff --git a/KruacentExiled/KE.Map/Others/BlackoutNDoor/Events/EventArgs/DoorStuckEventArgs.cs b/KruacentExiled/KE.Map/Others/BlackoutNDoor/Events/EventArgs/DoorStuckEventArgs.cs new file mode 100644 index 00000000..91e05581 --- /dev/null +++ b/KruacentExiled/KE.Map/Others/BlackoutNDoor/Events/EventArgs/DoorStuckEventArgs.cs @@ -0,0 +1,26 @@ +using Exiled.API.Enums; +using Exiled.API.Features.Doors; +using Exiled.Events.EventArgs.Interfaces; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace KE.Map.Others.BlackoutNDoor.Events.EventArgs +{ + public class DoorStuckEventArgs : IExiledEvent, IDeniableEvent, IZoneType + { + + public HashSet Doors { get; set; } + public bool IsAllowed { get; set; } + public ZoneType Zone { get; set; } + + public DoorStuckEventArgs(HashSet doors,ZoneType zone, bool isAllowed = true) + { + Doors = doors; + Zone = zone; + IsAllowed = isAllowed; + } + } +} diff --git a/KruacentExiled/KE.Map/Others/BlackoutNDoor/Events/Handlers/DoorStuckHandler.cs b/KruacentExiled/KE.Map/Others/BlackoutNDoor/Events/Handlers/DoorStuckHandler.cs new file mode 100644 index 00000000..145b0501 --- /dev/null +++ b/KruacentExiled/KE.Map/Others/BlackoutNDoor/Events/Handlers/DoorStuckHandler.cs @@ -0,0 +1,26 @@ +using Exiled.Events; +using Exiled.Events.Features; +using KE.Map.Others.BlackoutNDoor.Events.EventArgs; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace KE.Map.Others.BlackoutNDoor.Events.Handlers +{ + public static class DoorStuckHandler + { + + + + public static Event DoorStucking { get; set; } = new(); + + + + public static void OnDoorStucking(DoorStuckEventArgs ev) + { + DoorStucking?.InvokeSafely(ev); + } + } +} diff --git a/KruacentExiled/KE.Map/Others/BlackoutNDoor/Events/IZoneType.cs b/KruacentExiled/KE.Map/Others/BlackoutNDoor/Events/IZoneType.cs new file mode 100644 index 00000000..5f169b9f --- /dev/null +++ b/KruacentExiled/KE.Map/Others/BlackoutNDoor/Events/IZoneType.cs @@ -0,0 +1,15 @@ +using Exiled.API.Enums; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace KE.Map.Others.BlackoutNDoor.Events +{ + public interface IZoneType + { + + public ZoneType Zone { get; set; } + } +} From e17d0425d509d396b49b636aad680f4cf329dcae Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Tue, 20 Jan 2026 16:54:55 +0100 Subject: [PATCH 526/853] redisabled hitman --- .../API/Features/KECustomRole.cs | 2 + .../KE.CustomRoles/CR/Human/Hitman.cs | 2 +- KruacentExiled/KE.CustomRoles/CR/SCP/Paper.cs | 2 +- .../KE.CustomRoles/CR/SCP/SCP173/Frozen.cs | 109 ++++++++++++++++++ .../CR/SCP/{ => SCP939}/Ultra.cs | 15 +-- .../KE.CustomRoles/KE.CustomRoles.csproj | 2 +- 6 files changed, 122 insertions(+), 10 deletions(-) create mode 100644 KruacentExiled/KE.CustomRoles/CR/SCP/SCP173/Frozen.cs rename KruacentExiled/KE.CustomRoles/CR/SCP/{ => SCP939}/Ultra.cs (81%) diff --git a/KruacentExiled/KE.CustomRoles/API/Features/KECustomRole.cs b/KruacentExiled/KE.CustomRoles/API/Features/KECustomRole.cs index 18fb86b9..85fea179 100644 --- a/KruacentExiled/KE.CustomRoles/API/Features/KECustomRole.cs +++ b/KruacentExiled/KE.CustomRoles/API/Features/KECustomRole.cs @@ -64,6 +64,8 @@ public override string Name /// public int CurrentNumberOfSpawn { get; set; } = 0; + public abstract override RoleTypeId Role { get; } + /// /// /// diff --git a/KruacentExiled/KE.CustomRoles/CR/Human/Hitman.cs b/KruacentExiled/KE.CustomRoles/CR/Human/Hitman.cs index 9e6441e2..0ede8d65 100644 --- a/KruacentExiled/KE.CustomRoles/CR/Human/Hitman.cs +++ b/KruacentExiled/KE.CustomRoles/CR/Human/Hitman.cs @@ -22,7 +22,7 @@ public class Hitman : GlobalCustomRole, IColor public override string PublicName { get; set; } = string.Empty; public override bool KeepRoleOnDeath { get; set; } = false; public override bool KeepRoleOnChangingRole { get; set; } = true; - public override float SpawnChance { get; set; } = 10; + public override float SpawnChance { get; set; } = 0; public Color32 Color => new Color32(54, 54, 54,0); diff --git a/KruacentExiled/KE.CustomRoles/CR/SCP/Paper.cs b/KruacentExiled/KE.CustomRoles/CR/SCP/Paper.cs index e0fa9843..cf40f6a5 100644 --- a/KruacentExiled/KE.CustomRoles/CR/SCP/Paper.cs +++ b/KruacentExiled/KE.CustomRoles/CR/SCP/Paper.cs @@ -14,6 +14,6 @@ public class Paper : GlobalCustomRole public override bool KeepRoleOnChangingRole { get; set; } = false; public override float SpawnChance { get; set; } = 100; - public override Vector3 Scale { get; set; } = new Vector3(0.1f, 1, 1); + public override Vector3 Scale { get; set; } = new Vector3(0.3f, 1, 1); } } diff --git a/KruacentExiled/KE.CustomRoles/CR/SCP/SCP173/Frozen.cs b/KruacentExiled/KE.CustomRoles/CR/SCP/SCP173/Frozen.cs new file mode 100644 index 00000000..8f848f92 --- /dev/null +++ b/KruacentExiled/KE.CustomRoles/CR/SCP/SCP173/Frozen.cs @@ -0,0 +1,109 @@ +using CustomPlayerEffects; +using Exiled.API.Features; +using Exiled.API.Features.Items; +using InventorySystem.Items.Usables.Scp244.Hypothermia; +using KE.CustomRoles.API.Features; +using KE.CustomRoles.API.Interfaces; +using LabApi.Events.Arguments.PlayerEvents; +using LabApi.Events.Arguments.Scp173Events; +using LabApi.Features.Wrappers; +using MEC; +using PlayerRoles; +using PlayerStatsSystem; +using System.Linq; +using UnityEngine; +using Item = Exiled.API.Features.Items.Item; +using Player = LabApi.Features.Wrappers.Player; + +namespace KE.CustomRoles.CR.SCP.SCP173 +{ + public class Frozen : KECustomRole, IColor + { + public override string Description { get; set; } = "Instead of Tantrum you drop a SCP-244.\nKilling anyone with hypothermia gives Hume Shield"; + public override string PublicName { get; set; } = "Frozen SCP-173"; + public override bool KeepRoleOnDeath { get; set; } = false; + public override bool KeepRoleOnChangingRole { get; set; } = false; + public override float SpawnChance { get; set; } = 0; + public override int MaxHealth { get; set; } = 4500; + + public override RoleTypeId Role => RoleTypeId.Scp173; + + public Color32 Color => new Color32(120, 205, 255, 0); + + + /*protected override void SubscribeEvents() + { + + LabApi.Events.Handlers.Scp173Events.CreatedTantrum += OnCreatedTantrum; + LabApi.Events.Handlers.PlayerEvents.Death += OnDeath; + base.SubscribeEvents(); + } + + + + protected override void UnsubscribeEvents() + { + LabApi.Events.Handlers.Scp173Events.CreatedTantrum -= OnCreatedTantrum; + LabApi.Events.Handlers.PlayerEvents.Death -= OnDeath; + base.UnsubscribeEvents(); + } + + + private void OnDeath(PlayerDeathEventArgs ev) + { + Player player = ev.Player; + + Log.Info("daryh"); + + ScpDamageHandler scp = ev.DamageHandler as ScpDamageHandler; + Log.Info(scp != null); + Log.Info(player.TryGetEffect(out var ef)); + Log.Info(ef.IsEnabled); + + Log.Debug(Check(Player.Get(scp?.Attacker.Hub))); + + + + + + if (ev.DamageHandler is ScpDamageHandler scpDamageHandler && player.TryGetEffect(out var playerEffect) && playerEffect.IsEnabled) + { + Log.Info("damage"); + Player attacker = Player.Get(scpDamageHandler.Attacker.Hub); + + if (Check(attacker)) + { + Log.Info("checked"); + attacker.HumeShield = Mathf.Min(attacker.MaxHumeShield, attacker.HumeShield + 400f); + } + + } + } + + + private void OnCreatedTantrum(Scp173CreatedTantrumEventArgs ev) + { + + TantrumHazard tantrum = ev.Tantrum; + float time = tantrum.LiveDuration; + + + Vector3 position = tantrum.SyncedPosition + Vector3.up; + tantrum.Destroy(); + + Scp244 scp244 = (Scp244)Item.Create(ItemType.SCP244a); + scp244.Scale = new Vector3(.01f, .01f, .01f); + scp244.Primed = true; + scp244.MaxDiameter = 10f; + Exiled.API.Features.Pickups.Pickup pickup = scp244.CreatePickup(position); + Timing.CallDelayed(time, () => + { + pickup.Destroy(); + }); + + + } + + */ + } +} diff --git a/KruacentExiled/KE.CustomRoles/CR/SCP/Ultra.cs b/KruacentExiled/KE.CustomRoles/CR/SCP/SCP939/Ultra.cs similarity index 81% rename from KruacentExiled/KE.CustomRoles/CR/SCP/Ultra.cs rename to KruacentExiled/KE.CustomRoles/CR/SCP/SCP939/Ultra.cs index 36bbeb82..b5bf46ff 100644 --- a/KruacentExiled/KE.CustomRoles/CR/SCP/Ultra.cs +++ b/KruacentExiled/KE.CustomRoles/CR/SCP/SCP939/Ultra.cs @@ -12,18 +12,19 @@ using System.Collections.Generic; using System.Linq; -namespace KE.CustomRoles.CR.SCP +namespace KE.CustomRoles.CR.SCP.SCP939 { - public class Ultra : GlobalCustomRole + public class Ultra : KECustomRole { - private static Dictionary _handles = new(); - public override SideEnum Side { get; set; } = SideEnum.SCP; public override string Description { get; set; } = "You can sense where people are located"; - public override string PublicName { get; set; } = "Ultra"; + public override string PublicName { get; set; } = "Ultra SCP-939"; public override bool KeepRoleOnDeath { get; set; } = false; public override bool KeepRoleOnChangingRole { get; set; } = false; - public override float MaxHealthMultiplicator { get; set; } = 1f; public override float SpawnChance { get; set; } = 100; + public override int MaxHealth { get; set; } = 2700; + + public override RoleTypeId Role => RoleTypeId.Scp939; + public const float RefreshRate = 20; public const int SizeText = 20; @@ -32,7 +33,7 @@ protected override void RoleAdded(Player player) { Timing.CallDelayed(1f, () => { - DisplayHandler.Instance.CreateAuto(player, (AutoContentUpdateArg arg) => PlayerInZone(arg), UltraPosition.HintPlacement); + DisplayHandler.Instance.CreateAuto(player, (arg) => PlayerInZone(arg), UltraPosition.HintPlacement); }); } private string PlayerInZone(AutoContentUpdateArg arg) diff --git a/KruacentExiled/KE.CustomRoles/KE.CustomRoles.csproj b/KruacentExiled/KE.CustomRoles/KE.CustomRoles.csproj index a938d3b2..90aaba12 100644 --- a/KruacentExiled/KE.CustomRoles/KE.CustomRoles.csproj +++ b/KruacentExiled/KE.CustomRoles/KE.CustomRoles.csproj @@ -5,7 +5,7 @@ - + From 8373c4857817bb0d6480da5872cb6005b3f0cee1 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Tue, 20 Jan 2026 16:58:33 +0100 Subject: [PATCH 527/853] removed mute from mime --- KruacentExiled/KE.CustomRoles/CR/ClassD/Mime.cs | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/KruacentExiled/KE.CustomRoles/CR/ClassD/Mime.cs b/KruacentExiled/KE.CustomRoles/CR/ClassD/Mime.cs index b98b2695..41306de2 100644 --- a/KruacentExiled/KE.CustomRoles/CR/ClassD/Mime.cs +++ b/KruacentExiled/KE.CustomRoles/CR/ClassD/Mime.cs @@ -22,18 +22,16 @@ public class Mime : KECustomRole, IColor public override bool KeepRoleOnDeath { get; set; } = false; public override bool KeepRoleOnChangingRole { get; set; } = true; public override float SpawnChance { get; set; } = 100; - public override Vector3 Scale { get; set; } = new Vector3(0.1f, 1, 1); + public override Vector3 Scale { get; set; } = new Vector3(0.5f, 1, 1); public Color32 Color => new(255, 74, 74, 0); protected override void RoleAdded(Player player) { player.EnableEffect(EffectType.SilentWalk, -1, true); - player.IsMuted = true; } protected override void RoleRemoved(Player player) { - player.IsMuted = false; player.DisableEffect(EffectType.SilentWalk); } From 51ecd7641901b0e2bf09e5f70eceaedeea1d7cd4 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Tue, 20 Jan 2026 17:00:45 +0100 Subject: [PATCH 528/853] update --- KruacentExiled/KE.Misc/KE.Misc.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/KruacentExiled/KE.Misc/KE.Misc.csproj b/KruacentExiled/KE.Misc/KE.Misc.csproj index 43be06b0..5e1291ce 100644 --- a/KruacentExiled/KE.Misc/KE.Misc.csproj +++ b/KruacentExiled/KE.Misc/KE.Misc.csproj @@ -6,7 +6,7 @@ - + From cd956866888897803faa04db827b5c77b6011bc7 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Tue, 20 Jan 2026 17:04:49 +0100 Subject: [PATCH 529/853] update remove particle disruptor --- KruacentExiled/KE.Map/Heavy/GamblingZone/DroppableItem.cs | 1 + KruacentExiled/KE.Map/KE.Map.csproj | 6 +++--- KruacentExiled/KE.Map/MainPlugin.cs | 3 +-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/KruacentExiled/KE.Map/Heavy/GamblingZone/DroppableItem.cs b/KruacentExiled/KE.Map/Heavy/GamblingZone/DroppableItem.cs index dc8ee552..ad0f5363 100644 --- a/KruacentExiled/KE.Map/Heavy/GamblingZone/DroppableItem.cs +++ b/KruacentExiled/KE.Map/Heavy/GamblingZone/DroppableItem.cs @@ -1,6 +1,7 @@ using Items = Exiled.API.Features.Items.Item; using System; using UnityEngine; +using Exiled.API.Features.Items; namespace KE.Map.Heavy.GamblingZone { diff --git a/KruacentExiled/KE.Map/KE.Map.csproj b/KruacentExiled/KE.Map/KE.Map.csproj index 3464baea..973654e4 100644 --- a/KruacentExiled/KE.Map/KE.Map.csproj +++ b/KruacentExiled/KE.Map/KE.Map.csproj @@ -6,9 +6,9 @@ - - - + + + diff --git a/KruacentExiled/KE.Map/MainPlugin.cs b/KruacentExiled/KE.Map/MainPlugin.cs index 348f8dca..f328eac1 100644 --- a/KruacentExiled/KE.Map/MainPlugin.cs +++ b/KruacentExiled/KE.Map/MainPlugin.cs @@ -101,8 +101,7 @@ private void OnGenerated() HashSet normal = new() { new(ItemType.KeycardO5,1,2), - new(ItemType.Jailbird,1,1), - new(ItemType.ParticleDisruptor,1,1), + new(ItemType.Jailbird,1,2), new(ItemType.SCP268,1,1), ItemType.SCP500, ItemType.KeycardMTFCaptain, From 4d35f42e6245297aaecbd49a2a7e880ef8e92d30 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Wed, 21 Jan 2026 15:18:55 +0100 Subject: [PATCH 530/853] separated clear inv + give base inv to 202 --- .../API/Features/KECustomRole.cs | 24 +++++++++++++++---- .../KE.CustomRoles/CR/Human/Hitman.cs | 4 ++-- .../KE.CustomRoles/CR/Scientist/scp202.cs | 5 ++++ KruacentExiled/KE.CustomRoles/MainPlugin.cs | 6 +++++ 4 files changed, 33 insertions(+), 6 deletions(-) diff --git a/KruacentExiled/KE.CustomRoles/API/Features/KECustomRole.cs b/KruacentExiled/KE.CustomRoles/API/Features/KECustomRole.cs index 85fea179..940142af 100644 --- a/KruacentExiled/KE.CustomRoles/API/Features/KECustomRole.cs +++ b/KruacentExiled/KE.CustomRoles/API/Features/KECustomRole.cs @@ -64,6 +64,18 @@ public override string Name ///
public int CurrentNumberOfSpawn { get; set; } = 0; + public static void ResetNumberOfSpawn() + { + + foreach(KECustomRole cr in Registered) + { + cr.CurrentNumberOfSpawn = 0; + } + + } + + + public abstract override RoleTypeId Role { get; } /// @@ -239,10 +251,7 @@ public override void AddRole(Player player) Timing.CallDelayed(TimeAttributingInventory, delegate { - if (!KeepInventoryOnSpawn) - { - player2.ClearInventory(); - } + ClearInventory(player2); GiveInventory(player2); GiveAmmo(player2); }); @@ -302,6 +311,13 @@ public static string CurrentRole(Player player) return StringBuilderPool.Pool.ToStringReturn(sb); } + protected virtual void ClearInventory(Player player) + { + if (!KeepInventoryOnSpawn) + { + player.ClearInventory(); + } + } protected virtual void GiveInventory(Player player) { diff --git a/KruacentExiled/KE.CustomRoles/CR/Human/Hitman.cs b/KruacentExiled/KE.CustomRoles/CR/Human/Hitman.cs index 0ede8d65..fbdd26d2 100644 --- a/KruacentExiled/KE.CustomRoles/CR/Human/Hitman.cs +++ b/KruacentExiled/KE.CustomRoles/CR/Human/Hitman.cs @@ -14,7 +14,7 @@ namespace KE.CustomRoles.CR.Human { - public class Hitman : GlobalCustomRole, IColor + /* public class Hitman : GlobalCustomRole, IColor { private static CoroutineHandle _coroutines; public override SideEnum Side { get; set; } = SideEnum.Human; @@ -238,5 +238,5 @@ private void ResetLogs(ref List<(int distance, string message, bool hasLogged)> proximityAlerts[i] = (distance, message, false); } } - } + }*/ } diff --git a/KruacentExiled/KE.CustomRoles/CR/Scientist/scp202.cs b/KruacentExiled/KE.CustomRoles/CR/Scientist/scp202.cs index 16458163..489f30c8 100644 --- a/KruacentExiled/KE.CustomRoles/CR/Scientist/scp202.cs +++ b/KruacentExiled/KE.CustomRoles/CR/Scientist/scp202.cs @@ -33,6 +33,11 @@ protected override void UnsubscribeEvents() base.UnsubscribeEvents(); } + protected override void ClearInventory(Player player) + { + + } + private void OnUsedItem(UsedItemEventArgs ev) { if (!Check(ev.Player)) return; diff --git a/KruacentExiled/KE.CustomRoles/MainPlugin.cs b/KruacentExiled/KE.CustomRoles/MainPlugin.cs index 0c61bacf..4ae9fd72 100644 --- a/KruacentExiled/KE.CustomRoles/MainPlugin.cs +++ b/KruacentExiled/KE.CustomRoles/MainPlugin.cs @@ -93,12 +93,18 @@ public void SubscribeEvents() { Misc.Features.Spawn.Spawn.OnAssigned += CustomRoleImplement; Exiled.Events.Handlers.Server.RespawnedTeam += CustomRoleRespawning; + Exiled.Events.Handlers.Server.WaitingForPlayers += OnWaitingForPlayers; } public void UnsubscribeEvents() { Misc.Features.Spawn.Spawn.OnAssigned -= CustomRoleImplement; Exiled.Events.Handlers.Server.RespawnedTeam -= CustomRoleRespawning; + Exiled.Events.Handlers.Server.WaitingForPlayers -= OnWaitingForPlayers; + } + private void OnWaitingForPlayers() + { + KECustomRole.ResetNumberOfSpawn(); } public void CustomRoleImplement(SpawnedEventArgs ev) From e52f7d31e64f822daa21d8be2d4b0c24ee317fbe Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Wed, 21 Jan 2026 15:20:28 +0100 Subject: [PATCH 531/853] renamed 202 --- KruacentExiled/KE.CustomRoles/CR/Scientist/scp202.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/KruacentExiled/KE.CustomRoles/CR/Scientist/scp202.cs b/KruacentExiled/KE.CustomRoles/CR/Scientist/scp202.cs index 489f30c8..58579f80 100644 --- a/KruacentExiled/KE.CustomRoles/CR/Scientist/scp202.cs +++ b/KruacentExiled/KE.CustomRoles/CR/Scientist/scp202.cs @@ -8,7 +8,7 @@ namespace KE.CustomRoles.CR.Scientist { - public class Scp202 : KECustomRole, IColor + public class SCP202 : KECustomRole, IColor { public override string PublicName { get; set; } = "SCP-202"; public override string Description { get; set; } = "? emsizan-itna'd te emsinummoc itna'd eiv enu sèrpa\n7691 lirva 91 el trom te engoloc à 6781 reivnaj 5 el én\n,etarcoméd neitérhc itrap ud eitrap tnasiaf 5691 à 9491 ed reilecnahC\n?elaidnom erreug ednoces al sèrpa dnamella reilecnahc re1 el darnoK erid xuev uT ?drannoC"; From 274aa8987f7baac20b0f9c786aa119e15911661e Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Wed, 21 Jan 2026 21:11:54 +0100 Subject: [PATCH 532/853] pickup model --- .../KE.Items/API/Core/Models/PickupModel.cs | 104 ++++++++++++++++++ .../API/Interface/ICustomPickupModel.cs | 11 +- .../Items/ItemEffects/MolotovEffect.cs | 2 +- KruacentExiled/KE.Items/Items/Mine.cs | 23 ++-- KruacentExiled/KE.Items/Items/Molotov.cs | 2 + .../KE.Items/Items/PickupModels/MinePModel.cs | 25 +++-- .../Items/PickupModels/MolotovPModel.cs | 39 ++++--- .../Items/PickupModels/TPGrenadaPModel.cs | 68 ++++++------ .../Items/ShieldBelt/ShieldBeltStat.cs | 11 +- KruacentExiled/KE.Items/Items/TPGrenada.cs | 12 +- KruacentExiled/KE.Items/KE.Items.csproj | 4 +- KruacentExiled/KE.Items/MainPlugin.cs | 4 + KruacentExiled/KE.Items/SpawnModel.cs | 53 +++++++++ 13 files changed, 267 insertions(+), 91 deletions(-) create mode 100644 KruacentExiled/KE.Items/API/Core/Models/PickupModel.cs create mode 100644 KruacentExiled/KE.Items/SpawnModel.cs diff --git a/KruacentExiled/KE.Items/API/Core/Models/PickupModel.cs b/KruacentExiled/KE.Items/API/Core/Models/PickupModel.cs new file mode 100644 index 00000000..8a1bb70e --- /dev/null +++ b/KruacentExiled/KE.Items/API/Core/Models/PickupModel.cs @@ -0,0 +1,104 @@ +using Exiled.API.Features; +using Exiled.API.Features.Pickups; +using Exiled.API.Features.Toys; +using Exiled.CustomItems.API.Features; +using InventorySystem.Items.Pickups; +using KE.Items.API.Features; +using KE.Utils.API.Features.Models; +using KE.Utils.API.Interfaces; +using System.Collections.Generic; +using System.Linq; +using UnityEngine; +using UnityEngine.Windows.Speech; + +namespace KE.Items.API.Core.Models +{ + public abstract class PickupModel : ModelBase, IUsingEvents + { + + public CustomItem KECI { get; } + public abstract float Scale { get; } + + + public PickupModel(CustomItem customItem) + { + KECI = customItem; + } + + public void SubscribeEvents() + { + PickupToParent = new(); + ItemPickupBase.OnPickupAdded += OnPickupAdded; + ItemPickupBase.OnPickupDestroyed += OnPickupDestroyed; + } + + public void UnsubscribeEvents() + { + ItemPickupBase.OnPickupAdded -= OnPickupAdded; + ItemPickupBase.OnPickupDestroyed -= OnPickupDestroyed; + PickupToParent = null; + } + + private Dictionary PickupToParent; + + + private Primitive CreateParent(Pickup pickup) + { + + + Transform parent = pickup.Transform; + Primitive prim = Primitive.Create(null, null, null, false); + prim.Flags = AdminToys.PrimitiveFlags.None; + + prim.Transform.parent = parent; + + Vector3 parentScale = parent.localScale; + prim.Transform.localPosition = Vector3.zero; + prim.Transform.localRotation = Quaternion.identity; + prim.Transform.localScale = new Vector3(1f/ parentScale.x,1f/ parentScale.y,1f/parentScale.z); + prim.Transform.localScale *= Scale; + + prim.Spawn(); + PickupToParent.Add(pickup, prim); + + return prim; + } + + public void OnPickupAdded(ItemPickupBase pickupBase) + { + Pickup pickup = Pickup.Get(pickupBase); + if (!Check(pickup)) return; + + Transform parent = CreateParent(pickup).Transform; + Log.Info(parent); + CreateModel(parent); + + } + + public void OnPickupDestroyed(ItemPickupBase pickupBase) + { + Pickup pickup = Pickup.Get(pickupBase); + if (!Check(pickup)) return; + + if(PickupToParent.TryGetValue(pickup,out Primitive prim)) + { + + Log.Info("destroying parent of " + pickup); + Destroy(prim.Transform); + PickupToParent.Remove(pickup); + } + + } + + public bool Check(Pickup pickup) + { + if (pickup is null) return false; + if (!CustomItem.TryGet(pickup, out CustomItem ci)) return false; + if (ci != KECI) return false; + + return true; + + } + + } +} diff --git a/KruacentExiled/KE.Items/API/Interface/ICustomPickupModel.cs b/KruacentExiled/KE.Items/API/Interface/ICustomPickupModel.cs index 49809493..c1bb22df 100644 --- a/KruacentExiled/KE.Items/API/Interface/ICustomPickupModel.cs +++ b/KruacentExiled/KE.Items/API/Interface/ICustomPickupModel.cs @@ -1,12 +1,4 @@ -/*using Exiled.API.Features.Toys; -using KE.Items.API.Features; -using KE.Utils.API.Models.Blueprints; -using KE.Utils.Quality.Models; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; +using KE.Items.API.Core.Models; namespace KE.Items.API.Interface { @@ -15,4 +7,3 @@ public interface ICustomPickupModel public PickupModel PickupModel { get; } } } -*/ \ No newline at end of file diff --git a/KruacentExiled/KE.Items/Items/ItemEffects/MolotovEffect.cs b/KruacentExiled/KE.Items/Items/ItemEffects/MolotovEffect.cs index 66f0c5c2..d371ae16 100644 --- a/KruacentExiled/KE.Items/Items/ItemEffects/MolotovEffect.cs +++ b/KruacentExiled/KE.Items/Items/ItemEffects/MolotovEffect.cs @@ -75,7 +75,7 @@ private void SpawnMolotov(Player owner, Vector3 centerPos) List fireLights = new List(); Color fireColor = new Color(255, 128, 0); - fireLights.Add(CreateLight(centerPos + Vector3.up * 0.5f, fireColor, Radius * 2f, 4f)); + fireLights.Add(CreateLight(centerPos + Vector3.up * 0.5f, fireColor, Radius * 2f, 2f)); float spread = Radius * 0.5f; fireLights.Add(CreateLight(centerPos + new Vector3(-spread, 0.5f, 0), fireColor, Radius, 0.5f)); diff --git a/KruacentExiled/KE.Items/Items/Mine.cs b/KruacentExiled/KE.Items/Items/Mine.cs index 40828370..9a1972b7 100644 --- a/KruacentExiled/KE.Items/Items/Mine.cs +++ b/KruacentExiled/KE.Items/Items/Mine.cs @@ -4,25 +4,28 @@ using KE.Items.API.Interface; using KE.Items.Items.ItemEffects; using KE.Items.API.Features; +using System.Collections.Generic; +using Exiled.API.Enums; +using KE.Items.API.Core.Models; +using KE.Items.Items.PickupModels; namespace KE.Items.Items { [Exiled.API.Features.Attributes.CustomItem(ItemType.KeycardJanitor)] - public class Mine : KECustomItem, ISwichableEffect/*, ICustomPickupModel*/ + public class Mine : KECustomItem, ISwichableEffect, ICustomPickupModel { public override uint Id { get; set; } = 1053; public override string Name { get; set; } = "Mine"; public override string Description { get; set; } = "Drop to deploy the mine, little advice : don't step on it"; public override float Weight { get; set; } = 0.65f; public Color Color { get; set; } = Color.yellow; - //public PickupModel PickupModel { get; set; } public CustomItemEffect Effect { get; set; } - public override SpawnProperties SpawnProperties { get; set; } = null; - /*new SpawnProperties() + public override SpawnProperties SpawnProperties { get; set; }= + new SpawnProperties() { - Limit = 2, + Limit = 1, DynamicSpawnPoints = new List { new DynamicSpawnPoint() @@ -60,23 +63,25 @@ public class Mine : KECustomItem, ISwichableEffect/*, ICustomPickupModel*/ }, } - };*/ + }; + + public PickupModel PickupModel { get; } public Mine() { Effect = new MineEffect(); - //PickupModel = new MinePModel(this); + PickupModel = new MinePModel(this); } protected override void SubscribeEvents() { - //PickupModel.SubscribeEvents(); + PickupModel.SubscribeEvents(); base.SubscribeEvents(); } protected override void UnsubscribeEvents() { - //PickupModel.UnsubscribeEvents(); + PickupModel.UnsubscribeEvents(); base.UnsubscribeEvents(); } diff --git a/KruacentExiled/KE.Items/Items/Molotov.cs b/KruacentExiled/KE.Items/Items/Molotov.cs index d0427ded..c506fad3 100644 --- a/KruacentExiled/KE.Items/Items/Molotov.cs +++ b/KruacentExiled/KE.Items/Items/Molotov.cs @@ -4,9 +4,11 @@ using Exiled.CustomItems.API.Features; using Exiled.Events.EventArgs.Map; using Exiled.Events.EventArgs.Player; +using KE.Items.API.Core.Models; using KE.Items.API.Features; using KE.Items.API.Interface; using KE.Items.Items.ItemEffects; +using KE.Items.Items.PickupModels; using System.Collections.Generic; using UnityEngine; diff --git a/KruacentExiled/KE.Items/Items/PickupModels/MinePModel.cs b/KruacentExiled/KE.Items/Items/PickupModels/MinePModel.cs index 964a136a..d5e0b904 100644 --- a/KruacentExiled/KE.Items/Items/PickupModels/MinePModel.cs +++ b/KruacentExiled/KE.Items/Items/PickupModels/MinePModel.cs @@ -1,13 +1,14 @@ -/*using Exiled.API.Features; +using Exiled.API.Features; using Exiled.API.Features.Toys; +using KE.Items.API.Core.Models; using KE.Items.API.Features; -using KE.Utils.API.Models.Blueprints; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using UnityEngine; +using Light = Exiled.API.Features.Toys.Light; namespace KE.Items.Items.PickupModels { @@ -16,16 +17,18 @@ public class MinePModel : PickupModel public MinePModel(KECustomItem customItem) : base(customItem) { } - protected override HashSet CreateModel() + public override float Scale => 0.25f; + + + public static Color32 lightColor = new Color32(255, 0, 0, 0); + protected override void CreateModel(Transform parent) { - HashSet model = new HashSet() - { - AdminToyBlueprint.Create(Primitive.Create(PrimitiveType.Cylinder, Vector3.zero, null, new Vector3(.3f, 0.05f, .3f),false,Color.black)), - AdminToyBlueprint.Create(Primitive.Create(PrimitiveType.Sphere, new Vector3(0, 0.05f), null, new Vector3(.05f, .05f, .05f),false,Color.red)), - }; - return model; - + Primitive baseMine = CreatePrimitive(parent, PrimitiveType.Cylinder, Vector3.zero, Quaternion.identity, new Vector3(1, .05f, 1), new Color32(0, 0, 0, 255)); + Primitive baseLight = CreatePrimitive(parent, PrimitiveType.Sphere, Vector3.zero, Quaternion.identity, Vector3.one*0.2f, new Color32(255, 0, 0, 100)); + Light light = CreateLight(baseLight.Transform, Vector3.down/2f, Quaternion.identity, Vector3.one, lightColor, LightType.Point, .1f); + + + } } } -*/ \ No newline at end of file diff --git a/KruacentExiled/KE.Items/Items/PickupModels/MolotovPModel.cs b/KruacentExiled/KE.Items/Items/PickupModels/MolotovPModel.cs index 22c92384..ed188e88 100644 --- a/KruacentExiled/KE.Items/Items/PickupModels/MolotovPModel.cs +++ b/KruacentExiled/KE.Items/Items/PickupModels/MolotovPModel.cs @@ -1,13 +1,8 @@ -/*using Exiled.API.Features; -using Exiled.API.Features.Toys; +using Exiled.API.Features.Toys; using Exiled.CustomItems.API.Features; -using KE.Items.API.Features; -using KE.Utils.API.Models.Blueprints; +using KE.Items.API.Core.Models; using System; using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; using UnityEngine; namespace KE.Items.Items.PickupModels @@ -16,19 +11,27 @@ public class MolotovPModel : PickupModel { public MolotovPModel(CustomItem customItem) : base(customItem) { } + private static Color32 bottleColor = new Color32(110, 58, 13,230); + private static Color32 meche = new Color32(255, 255, 255,255); - protected override bool HidePickup => true; - private Color32 bottleColor = new Color32(110, 58, 13,230); - protected override HashSet CreateModel() + public override float Scale => .15f; + + protected override void CreateModel(Transform parent) { - HashSet model = new() - { - AdminToyBlueprint.Create(Primitive.Create(PrimitiveType.Cylinder, Vector3.zero, null, new Vector3(.1f, 0.1f, .1f),false,bottleColor)), //big - AdminToyBlueprint.Create(Primitive.Create(PrimitiveType.Cylinder, new Vector3(0, 10f), null, new Vector3(.05f, .035f, .05f),false,bottleColor)), - }; - return model; - + Primitive base1 = CreatePrimitive(parent, PrimitiveType.Cylinder, Vector3.zero, Quaternion.identity, Vector3.one, bottleColor); + Primitive base2 = CreatePrimitive(parent, PrimitiveType.Cylinder, Vector3.up *1.25f, Quaternion.identity, new(0.7f,0.28f,0.7f), bottleColor); + Primitive base3 = CreatePrimitive(parent, PrimitiveType.Cylinder, Vector3.up *1.67f, Quaternion.identity, new(0.5f,0.3f,0.5f), bottleColor); + + Primitive empty = CreatePrimitive(parent, PrimitiveType.Sphere, new(0,2.4f,0.22f),Quaternion.identity,Vector3.one, meche); + empty.Visible = false; + + Primitive meche1 = CreatePrimitive(empty.Transform, PrimitiveType.Cylinder, new Vector3(0, -.36f, -.16f), Quaternion.Euler(28.3f, 0, 0), new(0.3f, .2f, .3f), meche); + Primitive meche2 = CreatePrimitive(empty.Transform, PrimitiveType.Cylinder, new Vector3(0, -.125f, .1f), Quaternion.Euler(62.5f, 0, 0), new(0.2f, .2f, .2f), meche); + Primitive meche3 = CreatePrimitive(empty.Transform, PrimitiveType.Cylinder, new Vector3(0, 0, -.44f), Quaternion.Euler(79.5f, 0, 0), new(0.1f, .2f, .1f), meche); + + + + } } } -*/ \ No newline at end of file diff --git a/KruacentExiled/KE.Items/Items/PickupModels/TPGrenadaPModel.cs b/KruacentExiled/KE.Items/Items/PickupModels/TPGrenadaPModel.cs index d459cc67..a43744e8 100644 --- a/KruacentExiled/KE.Items/Items/PickupModels/TPGrenadaPModel.cs +++ b/KruacentExiled/KE.Items/Items/PickupModels/TPGrenadaPModel.cs @@ -1,50 +1,54 @@ -/*using Exiled.API.Features.Toys; +using Exiled.API.Features.Toys; using Exiled.CustomItems.API.Features; +using KE.Items.API.Core.Models; using KE.Items.API.Features; -using KE.Utils.API.Models.Blueprints; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; using UnityEngine; +using Light = Exiled.API.Features.Toys.Light; namespace KE.Items.Items.PickupModels { public class TPGrenadaPModel : PickupModel { - - public TPGrenadaPModel(CustomItem customItem) : base(customItem) { } - - protected override bool HidePickup => true; - - - private static Vector3 pillar = new Vector3(.025f, .125f, .025f); - private static Vector3 support = new Vector3(.15f,.05f,.15f); - private static Vector3 glass = new Vector3(.15f, .20f, .15f); + private static Vector3 pillar = new Vector3(.15f, 1f, 0.15f); + private static Vector3 support = new Vector3(1, .25f, 1); + private static Vector3 glass = new Vector3(1, 1.75f, 1); + private static float positionPillars = 2.6f; private static Color32 centralColor = new Color32(60, 255, 255, 255); private static Color32 colorSupport = new Color32(80, 80, 80, 255); private static Color32 glassColor = new Color32(74, 232, 255, 50); - protected override HashSet CreateModel() + public TPGrenadaPModel(CustomItem customItem) : base(customItem) + { + } + + public override float Scale => .25f; + + protected override void CreateModel(Transform parent) { - HashSet model = new() - { - new PrimitiveBlueprint(PrimitiveType.Cube, Vector3.down*12.5f, Quaternion.identity, colorSupport,support), - new PrimitiveBlueprint(PrimitiveType.Cube, Vector3.up*12.5f, Quaternion.identity, colorSupport,support), - new PrimitiveBlueprint(PrimitiveType.Cube, Vector3.zero, Quaternion.identity, glassColor,glass), - new PrimitiveBlueprint(PrimitiveType.Cylinder, Vector3.up + Vector3.back*6 + Vector3.right*6, Quaternion.identity,colorSupport, pillar), - new PrimitiveBlueprint(PrimitiveType.Cylinder, Vector3.up + Vector3.forward*6 + Vector3.right*6, Quaternion.identity,colorSupport, pillar), - new PrimitiveBlueprint(PrimitiveType.Cylinder, Vector3.up + Vector3.back*6 + Vector3.left*6, Quaternion.identity,colorSupport, pillar), - new PrimitiveBlueprint(PrimitiveType.Cylinder, Vector3.up + Vector3.forward*6 + Vector3.left*6, Quaternion.identity,colorSupport, pillar), - new PrimitiveBlueprint(PrimitiveType.Cylinder, Vector3.up, Quaternion.identity,centralColor, pillar), - new LightBlueprint(Vector3.zero, Quaternion.identity, centralColor,Vector3.one,.1f), - - }; - return model; + + Primitive glassPrim = CreatePrimitive(parent, PrimitiveType.Cube, Vector3.zero, Quaternion.identity, glass, glassColor); + //new PrimitiveBlueprint(PrimitiveType.Cube, Vector3.zero, Quaternion.identity, glassColor, glass), + + Primitive topSupport = CreatePrimitive(parent, PrimitiveType.Cube, Vector3.up, Quaternion.identity, support, colorSupport); + Primitive bottomSupport = CreatePrimitive(parent, PrimitiveType.Cube, Vector3.down, Quaternion.identity, support, colorSupport); + //new PrimitiveBlueprint(PrimitiveType.Cube, Vector3.up * 12.5f, Quaternion.identity, colorSupport, support), + //new PrimitiveBlueprint(PrimitiveType.Cube, Vector3.down * 12.5f, Quaternion.identity, colorSupport, support), + + Primitive centralPillar = CreatePrimitive(parent, PrimitiveType.Cylinder, Vector3.zero, Quaternion.identity, pillar, centralColor); + Primitive pillar1 = CreatePrimitive(centralPillar.Transform, PrimitiveType.Cylinder, positionPillars* new Vector3(1, 0, 1), Quaternion.identity, Vector3.one, colorSupport); + Primitive pillar2 = CreatePrimitive(centralPillar.Transform, PrimitiveType.Cylinder, positionPillars * new Vector3(-1, 0, 1), Quaternion.identity, Vector3.one, colorSupport); + Primitive pillar3 = CreatePrimitive(centralPillar.Transform, PrimitiveType.Cylinder, positionPillars * new Vector3(-1, 0, -1), Quaternion.identity, Vector3.one, colorSupport); + Primitive pillar4 = CreatePrimitive(centralPillar.Transform, PrimitiveType.Cylinder, positionPillars * new Vector3(1, 0, -1), Quaternion.identity, Vector3.one, colorSupport); + //new PrimitiveBlueprint(PrimitiveType.Cylinder, Vector3.up + Vector3.back * 6 + Vector3.right * 6, Quaternion.identity, colorSupport, pillar), + //new PrimitiveBlueprint(PrimitiveType.Cylinder, Vector3.up + Vector3.forward * 6 + Vector3.right * 6, Quaternion.identity, colorSupport, pillar), + //new PrimitiveBlueprint(PrimitiveType.Cylinder, Vector3.up + Vector3.back * 6 + Vector3.left * 6, Quaternion.identity, colorSupport, pillar), + //new PrimitiveBlueprint(PrimitiveType.Cylinder, Vector3.up + Vector3.forward * 6 + Vector3.left * 6, Quaternion.identity, colorSupport, pillar), + //new PrimitiveBlueprint(PrimitiveType.Cylinder, Vector3.up, Quaternion.identity, centralColor, pillar), + + Light light = CreateLight(parent, Vector3.zero, Quaternion.identity, Vector3.one, centralColor, LightType.Point, .1f); + //new LightBlueprint(Vector3.zero, Quaternion.identity, centralColor, Vector3.one,), } } } -*/ \ No newline at end of file diff --git a/KruacentExiled/KE.Items/Items/ShieldBelt/ShieldBeltStat.cs b/KruacentExiled/KE.Items/Items/ShieldBelt/ShieldBeltStat.cs index a6bf6656..765939a7 100644 --- a/KruacentExiled/KE.Items/Items/ShieldBelt/ShieldBeltStat.cs +++ b/KruacentExiled/KE.Items/Items/ShieldBelt/ShieldBeltStat.cs @@ -1,5 +1,6 @@ using Exiled.API.Features; using Exiled.API.Features.Toys; +using KE.Utils.API.Features.Models; using System; using System.Collections.Generic; using System.Linq; @@ -137,7 +138,6 @@ public bool IsRecharging private Primitive CreatePrimitive(Player player) { Primitive prim = Primitive.Create(null, null, null, false); - prim.Collidable = false; prim.Visible = true; prim.Transform.parent = player.ReferenceHub.transform; @@ -145,13 +145,18 @@ private Primitive CreatePrimitive(Player player) prim.Scale = MaxSize; prim.Color = new Color32(50, 50, 50, 50); prim.Spawn(); + + + model.Create(prim.Transform); + + return prim; } - + private ModelTest model; public void Awake() { + model = new(); player = Player.Get(transform.root.gameObject); - Log.Debug(player.Nickname); primitive = CreatePrimitive(player); currentCharge = Base; timeRemaining = 0; diff --git a/KruacentExiled/KE.Items/Items/TPGrenada.cs b/KruacentExiled/KE.Items/Items/TPGrenada.cs index 58d0476e..32cf92d2 100644 --- a/KruacentExiled/KE.Items/Items/TPGrenada.cs +++ b/KruacentExiled/KE.Items/Items/TPGrenada.cs @@ -4,14 +4,16 @@ using Exiled.API.Features.Spawn; using Exiled.CustomItems.API.Features; using Exiled.Events.EventArgs.Map; +using KE.Items.API.Core.Models; using KE.Items.API.Features; using KE.Items.API.Interface; using KE.Items.Items.ItemEffects; +using KE.Items.Items.PickupModels; namespace KE.Items.Items { [CustomItem(ItemType.GrenadeHE)] - public class TPGrenada : KECustomGrenade, ISwichableEffect/*, ICustomPickupModel*/ + public class TPGrenada : KECustomGrenade, ISwichableEffect, ICustomPickupModel { public override uint Id { get; set; } = 1045; @@ -51,12 +53,12 @@ public class TPGrenada : KECustomGrenade, ISwichableEffect/*, ICustomPickupModel }; - //public PickupModel PickupModel { get; } + public PickupModel PickupModel { get; } public TPGrenada() { Effect = new TPGrenadaEffect(); - //PickupModel = new TPGrenadaPModel(this); + PickupModel = new TPGrenadaPModel(this); } protected override void OnExploding(ExplodingGrenadeEventArgs ev) @@ -67,13 +69,13 @@ protected override void OnExploding(ExplodingGrenadeEventArgs ev) protected override void SubscribeEvents() { - //PickupModel.SubscribeEvents(); + PickupModel.SubscribeEvents(); base.SubscribeEvents(); } protected override void UnsubscribeEvents() { - //PickupModel.UnsubscribeEvents(); + PickupModel.UnsubscribeEvents(); base.UnsubscribeEvents(); } diff --git a/KruacentExiled/KE.Items/KE.Items.csproj b/KruacentExiled/KE.Items/KE.Items.csproj index 3ad2edf5..30aada85 100644 --- a/KruacentExiled/KE.Items/KE.Items.csproj +++ b/KruacentExiled/KE.Items/KE.Items.csproj @@ -6,8 +6,8 @@ - - + + diff --git a/KruacentExiled/KE.Items/MainPlugin.cs b/KruacentExiled/KE.Items/MainPlugin.cs index 9d6e2612..0ccf0e5f 100644 --- a/KruacentExiled/KE.Items/MainPlugin.cs +++ b/KruacentExiled/KE.Items/MainPlugin.cs @@ -1,4 +1,5 @@  +using AdminToys; using Exiled.API.Enums; using Exiled.API.Features; using Exiled.API.Features.Toys; @@ -15,6 +16,7 @@ using System; using System.Linq; using UnityEngine; +using static PlayerRoles.Spectating.SpectatableModuleBase; using InteractableToy = LabApi.Features.Wrappers.InteractableToy; namespace KE.Items @@ -134,5 +136,7 @@ public void Test() } + + } } \ No newline at end of file diff --git a/KruacentExiled/KE.Items/SpawnModel.cs b/KruacentExiled/KE.Items/SpawnModel.cs new file mode 100644 index 00000000..4e54c9e6 --- /dev/null +++ b/KruacentExiled/KE.Items/SpawnModel.cs @@ -0,0 +1,53 @@ +using CommandSystem; +using Exiled.API.Features; +using Exiled.API.Features.Toys; +using KE.Items.Items.PickupModels; +using KE.Utils.API.Features.Models; +using KE.Utils.Extensions; +using MEC; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using UnityEngine; + +namespace KE.Items +{ + + [CommandHandler(typeof(RemoteAdminCommandHandler))] + public class SpawnModel : ICommand + { + public string Command => "spawnmodel"; + + public string[] Aliases => []; + + public string Description => "spawnmodel"; + + public bool Execute(ArraySegment arguments, ICommandSender sender, out string response) + { + var p = Player.Get(sender); + response = string.Empty; + + if(p is not null) + { + Primitive prim = Primitive.Create(p.Position, null, Vector3.one, false); + prim.Collidable = false; + prim.Visible = false; + prim.Spawn(); + TPGrenadaPModel m = new(null); + + + Log.Info("position model=" + prim.Position); + + m.Create(prim.Transform); + + Timing.CallDelayed(float.Parse(arguments.At(0)),prim.Destroy); + + return true; + } + response = "no"; + return false; + } + } +} From 437f8e322b38c8fb8301d8363feeda6a104fce01 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Wed, 21 Jan 2026 21:12:51 +0100 Subject: [PATCH 533/853] update --- KruacentExiled/KE.CustomRoles/KE.CustomRoles.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/KruacentExiled/KE.CustomRoles/KE.CustomRoles.csproj b/KruacentExiled/KE.CustomRoles/KE.CustomRoles.csproj index 90aaba12..fd818d00 100644 --- a/KruacentExiled/KE.CustomRoles/KE.CustomRoles.csproj +++ b/KruacentExiled/KE.CustomRoles/KE.CustomRoles.csproj @@ -5,7 +5,7 @@ - + From 7efedf83629fa9dddf7c7609451a9c0e174f3bbc Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Wed, 21 Jan 2026 21:13:53 +0100 Subject: [PATCH 534/853] update --- KruacentExiled/KE.Map/KE.Map.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/KruacentExiled/KE.Map/KE.Map.csproj b/KruacentExiled/KE.Map/KE.Map.csproj index 973654e4..406c9655 100644 --- a/KruacentExiled/KE.Map/KE.Map.csproj +++ b/KruacentExiled/KE.Map/KE.Map.csproj @@ -6,7 +6,7 @@ - + From e867ca6241667cbb43527c9191a859535783afcd Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Wed, 21 Jan 2026 21:14:23 +0100 Subject: [PATCH 535/853] update --- KruacentExiled/KE.Misc/KE.Misc.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/KruacentExiled/KE.Misc/KE.Misc.csproj b/KruacentExiled/KE.Misc/KE.Misc.csproj index 5e1291ce..142acb82 100644 --- a/KruacentExiled/KE.Misc/KE.Misc.csproj +++ b/KruacentExiled/KE.Misc/KE.Misc.csproj @@ -6,7 +6,7 @@ - + From fcfaf5e90552220e1bbc986b57e7fc7bdc28f417 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Thu, 22 Jan 2026 18:06:41 +0100 Subject: [PATCH 536/853] models --- KruacentExiled/KE.Items/Items/Mine.cs | 16 ++++++++-------- .../KE.Items/Items/PickupModels/MinePModel.cs | 2 +- KruacentExiled/KE.Items/Items/TPGrenada.cs | 10 +++++----- 3 files changed, 14 insertions(+), 14 deletions(-) diff --git a/KruacentExiled/KE.Items/Items/Mine.cs b/KruacentExiled/KE.Items/Items/Mine.cs index 9a1972b7..aa433c48 100644 --- a/KruacentExiled/KE.Items/Items/Mine.cs +++ b/KruacentExiled/KE.Items/Items/Mine.cs @@ -12,7 +12,7 @@ namespace KE.Items.Items { [Exiled.API.Features.Attributes.CustomItem(ItemType.KeycardJanitor)] - public class Mine : KECustomItem, ISwichableEffect, ICustomPickupModel + public class Mine : KECustomItem, ISwichableEffect/*, ICustomPickupModel*/ { public override uint Id { get; set; } = 1053; public override string Name { get; set; } = "Mine"; @@ -22,8 +22,8 @@ public class Mine : KECustomItem, ISwichableEffect, ICustomPickupModel public CustomItemEffect Effect { get; set; } - public override SpawnProperties SpawnProperties { get; set; }= - new SpawnProperties() + public override SpawnProperties SpawnProperties { get; set; } = null; + /*new SpawnProperties() { Limit = 1, DynamicSpawnPoints = new List @@ -63,25 +63,25 @@ public class Mine : KECustomItem, ISwichableEffect, ICustomPickupModel }, } - }; + };*/ - public PickupModel PickupModel { get; } + //public PickupModel PickupModel { get; } public Mine() { Effect = new MineEffect(); - PickupModel = new MinePModel(this); + //PickupModel = new MinePModel(this); } protected override void SubscribeEvents() { - PickupModel.SubscribeEvents(); + //PickupModel.SubscribeEvents(); base.SubscribeEvents(); } protected override void UnsubscribeEvents() { - PickupModel.UnsubscribeEvents(); + //PickupModel.UnsubscribeEvents(); base.UnsubscribeEvents(); } diff --git a/KruacentExiled/KE.Items/Items/PickupModels/MinePModel.cs b/KruacentExiled/KE.Items/Items/PickupModels/MinePModel.cs index d5e0b904..82f1f26f 100644 --- a/KruacentExiled/KE.Items/Items/PickupModels/MinePModel.cs +++ b/KruacentExiled/KE.Items/Items/PickupModels/MinePModel.cs @@ -26,7 +26,7 @@ protected override void CreateModel(Transform parent) Primitive baseMine = CreatePrimitive(parent, PrimitiveType.Cylinder, Vector3.zero, Quaternion.identity, new Vector3(1, .05f, 1), new Color32(0, 0, 0, 255)); Primitive baseLight = CreatePrimitive(parent, PrimitiveType.Sphere, Vector3.zero, Quaternion.identity, Vector3.one*0.2f, new Color32(255, 0, 0, 100)); Light light = CreateLight(baseLight.Transform, Vector3.down/2f, Quaternion.identity, Vector3.one, lightColor, LightType.Point, .1f); - + } diff --git a/KruacentExiled/KE.Items/Items/TPGrenada.cs b/KruacentExiled/KE.Items/Items/TPGrenada.cs index 32cf92d2..e823cab9 100644 --- a/KruacentExiled/KE.Items/Items/TPGrenada.cs +++ b/KruacentExiled/KE.Items/Items/TPGrenada.cs @@ -13,7 +13,7 @@ namespace KE.Items.Items { [CustomItem(ItemType.GrenadeHE)] - public class TPGrenada : KECustomGrenade, ISwichableEffect, ICustomPickupModel + public class TPGrenada : KECustomGrenade, ISwichableEffect/*, ICustomPickupModel*/ { public override uint Id { get; set; } = 1045; @@ -53,12 +53,12 @@ public class TPGrenada : KECustomGrenade, ISwichableEffect, ICustomPickupModel }; - public PickupModel PickupModel { get; } + //public PickupModel PickupModel { get; } public TPGrenada() { Effect = new TPGrenadaEffect(); - PickupModel = new TPGrenadaPModel(this); + //PickupModel = new TPGrenadaPModel(this); } protected override void OnExploding(ExplodingGrenadeEventArgs ev) @@ -69,13 +69,13 @@ protected override void OnExploding(ExplodingGrenadeEventArgs ev) protected override void SubscribeEvents() { - PickupModel.SubscribeEvents(); + //PickupModel.SubscribeEvents(); base.SubscribeEvents(); } protected override void UnsubscribeEvents() { - PickupModel.UnsubscribeEvents(); + //PickupModel.UnsubscribeEvents(); base.UnsubscribeEvents(); } From 429c3206df5a4ca1f27c876eeba8c00a599ba6a9 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Thu, 22 Jan 2026 18:11:05 +0100 Subject: [PATCH 537/853] buff 035 --- KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP035.cs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP035.cs b/KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP035.cs index fd41d294..91791e44 100644 --- a/KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP035.cs +++ b/KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP035.cs @@ -13,6 +13,7 @@ using KE.CustomRoles.API.Features; using KE.Utils.API.Displays.DisplayMeow; using KE.Utils.API.Displays.DisplayMeow.Placements; +using MEC; using PlayerRoles; using System; using System.Collections.Generic; @@ -26,7 +27,7 @@ public class SCP035 : CustomSCP public override string PublicName { get; set; } = "SCP-035"; public override int MaxHealth { get; set; } = 1200; - public override string Description { get; set; } = "You can't pickup the Micro-HID and anything made with it, but you take 2 time less damage by these weapon"; + public override string Description { get; set; } = "You can't pickup the Micro-HID and anything made with it, but you take 4 time less damage by these weapon.\nKill every humans"; protected override int SettingId => 10002; public override RoleTypeId Role { get; set; } = RoleTypeId.Tutorial; @@ -183,7 +184,7 @@ private void OnHurting(HurtingEventArgs ev) { if (ev.IsAllowed) { - ev.DamageHandler.Damage /= 2; + ev.DamageHandler.Damage /= 4; } return; @@ -213,6 +214,7 @@ private void OnResurrecting(ResurrectingEventArgs ev) { if (!Check(ev.Player)) return; ev.NewRole = RoleTypeId.Scp0492; + Timing.CallDelayed(1, () => ev.Target.Health = 100); } public void OnEndingRound(EndingRoundEventArgs ev) From 539c195ca504bacdc1d8e8da47faaf803f7e4288 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Thu, 22 Jan 2026 18:35:10 +0100 Subject: [PATCH 538/853] vote start change the config --- KruacentExiled/KE.Misc/Features/VoteStart/VoteStart.cs | 6 ++---- KruacentExiled/KE.Misc/ForceVoteNumber.cs | 6 +++--- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/KruacentExiled/KE.Misc/Features/VoteStart/VoteStart.cs b/KruacentExiled/KE.Misc/Features/VoteStart/VoteStart.cs index 92a845de..aa0dd4ee 100644 --- a/KruacentExiled/KE.Misc/Features/VoteStart/VoteStart.cs +++ b/KruacentExiled/KE.Misc/Features/VoteStart/VoteStart.cs @@ -17,7 +17,6 @@ namespace KE.Misc.Features.VoteStart internal class VoteStart : MiscFeature { - public int minvote = 9999; public static HintPosition HintPosition = new VotePosition(); public HashSet Voted = new(); @@ -62,7 +61,7 @@ private void OnVoiceChatting(VoiceChattingEventArgs ev) } Voted.Add(ev.Player); - if (Voted.Count >= minvote) + if (Voted.Count >= MainPlugin.Instance.Config.MinPlayerVote) { Log.Info("starting the round"); Round.IsLobbyLocked = false; @@ -79,7 +78,6 @@ private void Init() { Voted.Clear(); voteCasted = false; - minvote = MainPlugin.Instance.Config.MinPlayerVote; } private void OnJoined(JoinedEventArgs ev) @@ -119,7 +117,7 @@ private string GetPlayers() sb.Append(Voted.Count); sb.Append("/"); - sb.Append(minvote); + sb.Append(MainPlugin.Instance.Config.MinPlayerVote); sb.AppendLine(") : "); foreach(Player player in Voted) diff --git a/KruacentExiled/KE.Misc/ForceVoteNumber.cs b/KruacentExiled/KE.Misc/ForceVoteNumber.cs index 70692561..5665075d 100644 --- a/KruacentExiled/KE.Misc/ForceVoteNumber.cs +++ b/KruacentExiled/KE.Misc/ForceVoteNumber.cs @@ -27,7 +27,7 @@ public bool Execute(ArraySegment arguments, ICommandSender sender, out s if(arguments.Count < 1) { - response = "current min number : "+ MainPlugin.Instance.vote.minvote; + response = "current min number : "+ MainPlugin.Instance.Config.MinPlayerVote; return true; } @@ -41,10 +41,10 @@ public bool Execute(ArraySegment arguments, ICommandSender sender, out s - MainPlugin.Instance.vote.minvote = result; + MainPlugin.Instance.Config.MinPlayerVote = result; - response = "vote set at " + MainPlugin.Instance.vote.minvote + " players"; + response = "vote set at " + MainPlugin.Instance.Config.MinPlayerVote + " players"; return true; } } From 366c9568e54418277d842cecc2cfe80f26fa1c81 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Thu, 22 Jan 2026 18:35:24 +0100 Subject: [PATCH 539/853] buff auto tesla + kill with the nuke --- KruacentExiled/KE.Misc/Features/AutoNukeAnnoucement.cs | 2 +- KruacentExiled/KE.Misc/Features/AutoTesla.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/KruacentExiled/KE.Misc/Features/AutoNukeAnnoucement.cs b/KruacentExiled/KE.Misc/Features/AutoNukeAnnoucement.cs index c9b94b72..71499898 100644 --- a/KruacentExiled/KE.Misc/Features/AutoNukeAnnoucement.cs +++ b/KruacentExiled/KE.Misc/Features/AutoNukeAnnoucement.cs @@ -26,7 +26,7 @@ public void UnsubscribeEvents() private void OnDetonated() { - Timing.CallDelayed(5, () => + Timing.CallDelayed(10, () => { foreach(Player player in Player.Enumerable) { diff --git a/KruacentExiled/KE.Misc/Features/AutoTesla.cs b/KruacentExiled/KE.Misc/Features/AutoTesla.cs index 95fad9db..994a6776 100644 --- a/KruacentExiled/KE.Misc/Features/AutoTesla.cs +++ b/KruacentExiled/KE.Misc/Features/AutoTesla.cs @@ -38,7 +38,7 @@ private IEnumerator StartElevator() tesla.Trigger(); if(UnityEngine.Random.Range(0f,100f) <= 70f) { - yield return Timing.WaitForSeconds(tesla.Base.windupTime+2f); + yield return Timing.WaitForSeconds(tesla.Base.windupTime+.1f); tesla.Trigger(); } From 186fd4b03114a9e5bd0e1aab64f45e14b4976a0b Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Fri, 23 Jan 2026 03:30:43 +0100 Subject: [PATCH 540/853] reduced damage of explode ability --- .../KE.CustomRoles/Abilities/Explode.cs | 31 ++++++++++++++++++- .../KE.CustomRoles/KE.CustomRoles.csproj | 1 + 2 files changed, 31 insertions(+), 1 deletion(-) diff --git a/KruacentExiled/KE.CustomRoles/Abilities/Explode.cs b/KruacentExiled/KE.CustomRoles/Abilities/Explode.cs index ae308210..c8c5a245 100644 --- a/KruacentExiled/KE.CustomRoles/Abilities/Explode.cs +++ b/KruacentExiled/KE.CustomRoles/Abilities/Explode.cs @@ -2,6 +2,7 @@ using Exiled.API.Features.Attributes; using Exiled.API.Features.Items; using Exiled.CustomRoles.API.Features; +using InventorySystem.Items.ThrowableProjectiles; using KE.CustomRoles.API.Features; using KE.CustomRoles.API.Interfaces; using System; @@ -24,13 +25,41 @@ public class Explode : KEAbilities, ICustomIcon public Utils.API.GifAnimator.TextImage IconName => MainPlugin.Instance.icons["Explode"]; + private HashSet Grenades = new(); + protected override void SubscribeEvents() + { + Grenades = new(); + Items.API.Events.ExplodeEvent.ExplodeDestructible += ExplodeEvent_ExplodeDestructible; + + base.SubscribeEvents(); + } + + protected override void UnsubscribeEvents() + { + + Items.API.Events.ExplodeEvent.ExplodeDestructible -= ExplodeEvent_ExplodeDestructible; + base.UnsubscribeEvents(); + } + protected override bool AbilityUsed(Player player) { - ExplosiveGrenade grenade = ((ExplosiveGrenade)Item.Create(ItemType.GrenadeHE)); + ExplosiveGrenade grenade = (ExplosiveGrenade)Item.Create(ItemType.GrenadeHE); + + grenade.FuseTime = 0.2f; grenade.SpawnActive(player.Position); + Grenades.Add(grenade.Projectile.Base); + Log.Debug("Grenade spawned"); return base.AbilityUsed(player); } + + private void ExplodeEvent_ExplodeDestructible(Items.API.Events.OnExplodeDestructibleEventsArgs obj) + { + if (!Grenades.Contains(obj.ExplosionGrenade)) return; + + obj.Damage = 100; + + } } } diff --git a/KruacentExiled/KE.CustomRoles/KE.CustomRoles.csproj b/KruacentExiled/KE.CustomRoles/KE.CustomRoles.csproj index fd818d00..ad7d5f34 100644 --- a/KruacentExiled/KE.CustomRoles/KE.CustomRoles.csproj +++ b/KruacentExiled/KE.CustomRoles/KE.CustomRoles.csproj @@ -20,6 +20,7 @@ + From 2aa41b68f6c5bcb376ef87750c84c63b1d16ea30 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Fri, 23 Jan 2026 03:31:09 +0100 Subject: [PATCH 541/853] increased success chance force open+ remove bug --- .../KE.CustomRoles/Abilities/ForceOpen.cs | 28 ++++++++++++++----- 1 file changed, 21 insertions(+), 7 deletions(-) diff --git a/KruacentExiled/KE.CustomRoles/Abilities/ForceOpen.cs b/KruacentExiled/KE.CustomRoles/Abilities/ForceOpen.cs index ee3466d4..ad4231cc 100644 --- a/KruacentExiled/KE.CustomRoles/Abilities/ForceOpen.cs +++ b/KruacentExiled/KE.CustomRoles/Abilities/ForceOpen.cs @@ -2,6 +2,7 @@ using Exiled.API.Extensions; using Exiled.API.Features; using Exiled.API.Features.Attributes; +using Exiled.API.Features.Doors; using Exiled.CustomRoles.API.Features; using Exiled.Events.EventArgs.Player; using KE.CustomRoles.API.Features; @@ -46,36 +47,49 @@ protected override bool AbilityUsed(Player player) private void InteractingDoor(InteractingDoorEventArgs ev) { Player player = ev.Player; + if (ev.IsAllowed) return; if (!abilityActivated.ContainsKey(player)) return; if (DateTime.Now > abilityActivated[player] + MaxTime) return; - if (ev.IsAllowed) return; + + if (ev.Door.IsOpen) return; if (ev.Door.DoorLockType >= DoorLockType.Lockdown079) return; int successRate; int damage; - if (ev.Door.Type.IsGate()) + if (ev.Door is Gate) { - successRate = 20; + successRate = 50; damage = 20; } else if (ev.Door.Type.IsCheckpoint()) { - successRate = 30; + successRate = 50; damage = 10; } else { - successRate = 40; + successRate = 75; damage = 5; } + int proba = UnityEngine.Random.Range(0, 101); if (proba <= successRate) { - ev.IsAllowed = true; + if(ev.Door is Gate gate) + { + gate.TryPry(player); + } + else + { + ev.IsAllowed = true; + } + + + } else { @@ -84,7 +98,7 @@ private void InteractingDoor(InteractingDoorEventArgs ev) } - + abilityActivated.Remove(player); } From e3e26de86897b4460f1ccf628d521de12d3cdddd Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Fri, 23 Jan 2026 03:31:52 +0100 Subject: [PATCH 542/853] removed custom role --- .../KE.CustomRoles/API/Features/CustomSCP.cs | 56 -- .../API/Features/GlobalCustomRole.cs | 180 ------ .../API/Features/KEAbilities.cs | 550 ------------------ .../API/Features/KECustomRole.cs | 249 -------- .../API/Interfaces/ISCPPreferences.cs | 18 - .../KE.CustomRoles/Abilities/Airstrike.cs | 75 --- .../KE.CustomRoles/Abilities/Convert.cs | 52 -- .../KE.CustomRoles/Abilities/Explode.cs | 33 -- .../Abilities/SelectPosition.cs | 46 -- .../KE.CustomRoles/Abilities/Thief.cs | 52 -- .../KE.CustomRoles/Abilities/Trade.cs | 51 -- .../CR/ChaosInsurgency/LeRusse.cs | 39 -- .../CR/ChaosInsurgency/Negotiator.cs | 67 --- .../KE.CustomRoles/CR/ClassD/DBoyInShape.cs | 92 --- .../KE.CustomRoles/CR/ClassD/Enfant.cs | 30 - .../KE.CustomRoles/CR/ClassD/Mime.cs | 41 -- .../KE.CustomRoles/CR/Guard/ChiefGuard.cs | 38 -- .../KE.CustomRoles/CR/Guard/Guard914.cs | 50 -- .../KE.CustomRoles/CR/Human/Alzheimer.cs | 74 --- .../KE.CustomRoles/CR/Human/Asthmatique.cs | 57 -- KruacentExiled/KE.CustomRoles/CR/Human/Big.cs | 23 - .../KE.CustomRoles/CR/Human/Cleptoman.cs | 28 - .../KE.CustomRoles/CR/Human/Curiosophile.cs | 148 ----- .../KE.CustomRoles/CR/Human/Diabetique.cs | 32 - .../KE.CustomRoles/CR/Human/Hitman.cs | 231 -------- .../KE.CustomRoles/CR/Human/Inverted.cs | 37 -- .../KE.CustomRoles/CR/Human/Maladroit.cs | 78 --- .../KE.CustomRoles/CR/Human/Paper.cs | 23 - .../KE.CustomRoles/CR/Human/Paper2.cs | 23 - KruacentExiled/KE.CustomRoles/CR/MTF/Pilot.cs | 50 -- KruacentExiled/KE.CustomRoles/CR/MTF/Tank.cs | 81 --- .../KE.CustomRoles/CR/MTF/Terroriste.cs | 44 -- KruacentExiled/KE.CustomRoles/CR/SCP/Paper.cs | 21 - .../KE.CustomRoles/CR/SCP/SCP457.cs | 250 -------- KruacentExiled/KE.CustomRoles/CR/SCP/Small.cs | 22 - KruacentExiled/KE.CustomRoles/CR/SCP/Tall.cs | 35 -- KruacentExiled/KE.CustomRoles/CR/SCP/Ultra.cs | 73 --- .../KE.CustomRoles/CR/SCP/ZombieDoorman.cs | 40 -- .../CR/Scientist/GambleAddict.cs | 36 -- .../CR/Scientist/ZoneManager.cs | 119 ---- KruacentExiled/KE.CustomRoles/Config.cs | 18 - .../KE.CustomRoles/KE.CustomRoles.csproj | 30 - KruacentExiled/KE.CustomRoles/MainPlugin.cs | 87 --- .../Patches/ActiveAbilityPatches.cs | 39 -- .../KE.CustomRoles/Patches/FpcMotorPatches.cs | 41 -- .../KE.CustomRoles/Settings/SettingHandler.cs | 230 -------- KruacentExiled/KE.CustomRoles/Translations.cs | 41 -- 47 files changed, 3730 deletions(-) delete mode 100644 KruacentExiled/KE.CustomRoles/API/Features/CustomSCP.cs delete mode 100644 KruacentExiled/KE.CustomRoles/API/Features/GlobalCustomRole.cs delete mode 100644 KruacentExiled/KE.CustomRoles/API/Features/KEAbilities.cs delete mode 100644 KruacentExiled/KE.CustomRoles/API/Features/KECustomRole.cs delete mode 100644 KruacentExiled/KE.CustomRoles/API/Interfaces/ISCPPreferences.cs delete mode 100644 KruacentExiled/KE.CustomRoles/Abilities/Airstrike.cs delete mode 100644 KruacentExiled/KE.CustomRoles/Abilities/Convert.cs delete mode 100644 KruacentExiled/KE.CustomRoles/Abilities/Explode.cs delete mode 100644 KruacentExiled/KE.CustomRoles/Abilities/SelectPosition.cs delete mode 100644 KruacentExiled/KE.CustomRoles/Abilities/Thief.cs delete mode 100644 KruacentExiled/KE.CustomRoles/Abilities/Trade.cs delete mode 100644 KruacentExiled/KE.CustomRoles/CR/ChaosInsurgency/LeRusse.cs delete mode 100644 KruacentExiled/KE.CustomRoles/CR/ChaosInsurgency/Negotiator.cs delete mode 100644 KruacentExiled/KE.CustomRoles/CR/ClassD/DBoyInShape.cs delete mode 100644 KruacentExiled/KE.CustomRoles/CR/ClassD/Enfant.cs delete mode 100644 KruacentExiled/KE.CustomRoles/CR/ClassD/Mime.cs delete mode 100644 KruacentExiled/KE.CustomRoles/CR/Guard/ChiefGuard.cs delete mode 100644 KruacentExiled/KE.CustomRoles/CR/Guard/Guard914.cs delete mode 100644 KruacentExiled/KE.CustomRoles/CR/Human/Alzheimer.cs delete mode 100644 KruacentExiled/KE.CustomRoles/CR/Human/Asthmatique.cs delete mode 100644 KruacentExiled/KE.CustomRoles/CR/Human/Big.cs delete mode 100644 KruacentExiled/KE.CustomRoles/CR/Human/Cleptoman.cs delete mode 100644 KruacentExiled/KE.CustomRoles/CR/Human/Curiosophile.cs delete mode 100644 KruacentExiled/KE.CustomRoles/CR/Human/Diabetique.cs delete mode 100644 KruacentExiled/KE.CustomRoles/CR/Human/Hitman.cs delete mode 100644 KruacentExiled/KE.CustomRoles/CR/Human/Inverted.cs delete mode 100644 KruacentExiled/KE.CustomRoles/CR/Human/Maladroit.cs delete mode 100644 KruacentExiled/KE.CustomRoles/CR/Human/Paper.cs delete mode 100644 KruacentExiled/KE.CustomRoles/CR/Human/Paper2.cs delete mode 100644 KruacentExiled/KE.CustomRoles/CR/MTF/Pilot.cs delete mode 100644 KruacentExiled/KE.CustomRoles/CR/MTF/Tank.cs delete mode 100644 KruacentExiled/KE.CustomRoles/CR/MTF/Terroriste.cs delete mode 100644 KruacentExiled/KE.CustomRoles/CR/SCP/Paper.cs delete mode 100644 KruacentExiled/KE.CustomRoles/CR/SCP/SCP457.cs delete mode 100644 KruacentExiled/KE.CustomRoles/CR/SCP/Small.cs delete mode 100644 KruacentExiled/KE.CustomRoles/CR/SCP/Tall.cs delete mode 100644 KruacentExiled/KE.CustomRoles/CR/SCP/Ultra.cs delete mode 100644 KruacentExiled/KE.CustomRoles/CR/SCP/ZombieDoorman.cs delete mode 100644 KruacentExiled/KE.CustomRoles/CR/Scientist/GambleAddict.cs delete mode 100644 KruacentExiled/KE.CustomRoles/CR/Scientist/ZoneManager.cs delete mode 100644 KruacentExiled/KE.CustomRoles/Config.cs delete mode 100644 KruacentExiled/KE.CustomRoles/KE.CustomRoles.csproj delete mode 100644 KruacentExiled/KE.CustomRoles/MainPlugin.cs delete mode 100644 KruacentExiled/KE.CustomRoles/Patches/ActiveAbilityPatches.cs delete mode 100644 KruacentExiled/KE.CustomRoles/Patches/FpcMotorPatches.cs delete mode 100644 KruacentExiled/KE.CustomRoles/Settings/SettingHandler.cs delete mode 100644 KruacentExiled/KE.CustomRoles/Translations.cs diff --git a/KruacentExiled/KE.CustomRoles/API/Features/CustomSCP.cs b/KruacentExiled/KE.CustomRoles/API/Features/CustomSCP.cs deleted file mode 100644 index 2a45d731..00000000 --- a/KruacentExiled/KE.CustomRoles/API/Features/CustomSCP.cs +++ /dev/null @@ -1,56 +0,0 @@ -using Exiled.API.Features; -using Exiled.API.Features.Core.UserSettings; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace KE.CustomRoles.API.Features -{ - public abstract class CustomSCP : KECustomRole - { - public const int MinValue = -5; - public const int MaxValue = 5; - public const int DefaultValue = 0; - - public static int ScpPreferenceHeaderId => MainPlugin.Instance.Config.ScpPreferenceHeaderId; - private static HeaderSetting header; - private static bool headerflag = false; - private SliderSetting sliderSetting; - public abstract bool IsSupport { get; } - public int SettingId => (int)Id; - - public static IEnumerable All => Registered.Where(c => c is CustomSCP).Cast(); - public override void Init() - { - if (!headerflag) - { - header = new HeaderSetting(ScpPreferenceHeaderId, "SCP Spawn Preferences"); - headerflag = true; - } - - - sliderSetting = new SliderSetting(SettingId, PublicName, MinValue, MaxValue, DefaultValue, true, header: header); - SettingBase.Register([sliderSetting]); - - - base.Init(); - } - - - public override void Destroy() - { - SettingBase.Unregister(); - base.Destroy(); - } - - - public int GetPreferences(Player player) - { - if (!SettingBase.TryGetSetting(player, sliderSetting.Id, out var setting)) return -6; - return (int) setting.SliderValue; - } - - } -} diff --git a/KruacentExiled/KE.CustomRoles/API/Features/GlobalCustomRole.cs b/KruacentExiled/KE.CustomRoles/API/Features/GlobalCustomRole.cs deleted file mode 100644 index 3d6e733a..00000000 --- a/KruacentExiled/KE.CustomRoles/API/Features/GlobalCustomRole.cs +++ /dev/null @@ -1,180 +0,0 @@ -using Exiled.API.Enums; -using Exiled.API.Extensions; -using Exiled.API.Features; -using Exiled.API.Features.Attributes; -using Exiled.API.Features.Pools; -using Exiled.CustomRoles.API.Features; -using Exiled.Events.EventArgs.Player; -using InventorySystem.Configs; -using KE.Utils.API.Displays.DisplayMeow; -using LiteNetLib4Mirror.Open.Nat; -using MEC; -using PlayerRoles; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using UnityEngine; - -namespace KE.CustomRoles.API.Features -{ - - public abstract class GlobalCustomRole : KECustomRole - { - public sealed override RoleTypeId Role { get; set; } = RoleTypeId.None; - public abstract SideEnum Side { get; set; } - public override bool KeepInventoryOnSpawn { get; set; } = true; - public override bool RemovalKillsPlayer => false; - - public override void AddRole(Player player) - { - SideEnum side = SideClass.Get(player.Role.Side); - - if (side != Side) - { - Log.Error($"tried to give a global custom role to a player in the wrong side ({side} instead of {Side})"); - return; - } - Log.Debug($"{Name}: Adding role to {player.Nickname}."); - TrackedPlayers.Add(player); - - - - Timing.CallDelayed( - 0.25f, - () => - { - if (!KeepInventoryOnSpawn) - { - Log.Debug($"{Name}: Clearing {player.Nickname}'s inventory."); - player.ClearInventory(); - } - - foreach (string itemName in Inventory) - { - Log.Debug($"{Name}: Adding {itemName} to inventory."); - TryAddItem(player, itemName); - } - - if (Ammo.Count > 0) - { - Log.Debug($"{Name}: Adding Ammo to {player.Nickname} inventory."); - foreach (AmmoType type in EnumUtils.Values) - { - if (type != AmmoType.None) - player.SetAmmo(type, Ammo.ContainsKey(type) ? Ammo[type] == ushort.MaxValue ? InventoryLimits.GetAmmoLimit(type.GetItemType(), player.ReferenceHub) : Ammo[type] : (ushort)0); - } - } - }); - - Log.Debug($"{Name}: Setting health values."); - player.MaxHealth *= MaxHealthMultiplicator; - player.Health = player.MaxHealth; - player.Scale = Scale; - - Vector3 position = GetSpawnPosition(); - if (position != Vector3.zero) - { - player.Position = position; - } - - Log.Debug($"{Name}: Setting player info"); - - player.CustomInfo = $"{player.CustomName}\n{CustomInfo}"; - player.InfoArea &= ~(PlayerInfoArea.Role | PlayerInfoArea.Nickname); - - if (Abilities != null) - { - foreach (int abilityId in Abilities) - { - KEAbilities.TryAddToPlayer(abilityId, player); - } - } - - - ShowMessage(player); - RoleAdded(player); - player.UniqueRole = Name; - } - public override void RemoveRole(Player player) - { - - - if (!TrackedPlayers.Contains(player)) - { - return; - } - - Log.Debug(Name + ": Removing role from " + player.Nickname + $"({player.Id})"); - TrackedPlayers.Remove(player); - player.CustomInfo = string.Empty; - player.InfoArea |= PlayerInfoArea.Nickname | PlayerInfoArea.Role; - player.Scale = Vector3.one; - if (CustomAbilities != null) - { - foreach (CustomAbility customAbility in CustomAbilities) - { - customAbility.RemoveAbility(player); - } - } - - RoleRemoved(player); - player.UniqueRole = string.Empty; - player.TryRemoveCustomeRoleFriendlyFire(Name); - if (RemovalKillsPlayer) - { - //player.Role.Set(RoleTypeId.Spectator); - } - Log.Debug(Name + ": finish Removing role from " + player.Nickname + $"({player.Id})"); - - } - - - - - public sealed override int MaxHealth { get; set; } - public virtual float MaxHealthMultiplicator { get; set; } = 1; - - protected override void ShowMessage(Player player) - { - string show; - if (player.IsScp) - { - show = $"{Name} {player.Role.Name}\n {Description}"; - } - else - { - show = $"{Name}\n {Description}"; - } - - - //todo settings - float delay = 20; - - DisplayHandler.Instance.AddHint(MainPlugin.CRHint, player, show, delay); - } - } - - public enum SideEnum - { - Human, - SCP, - None, - } - - public static class SideClass - { - public static SideEnum Get(Side side) - { - return side switch - { - Side.Scp => SideEnum.SCP, - Side.Tutorial or Side.Mtf or Side.ChaosInsurgency => SideEnum.Human, - Side.None => SideEnum.None, - _ => SideEnum.None, - }; - } - } - -} diff --git a/KruacentExiled/KE.CustomRoles/API/Features/KEAbilities.cs b/KruacentExiled/KE.CustomRoles/API/Features/KEAbilities.cs deleted file mode 100644 index ae0ce961..00000000 --- a/KruacentExiled/KE.CustomRoles/API/Features/KEAbilities.cs +++ /dev/null @@ -1,550 +0,0 @@ -using Exiled.API.Features; -using Exiled.API.Features.Core.UserSettings; -using Exiled.CustomRoles.API.Features; -using Exiled.Events.EventArgs.Player; -using KE.CustomRoles.Settings; -using KE.Utils.API; -using KE.Utils.API.Displays.DisplayMeow; -using MEC; -using PlayerRoles.Subroutines; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Reflection; -using UserSettings.ServerSpecific; -using UserSettings.UserInterfaceSettings; -using static PlayerList; - -namespace KE.CustomRoles.API.Features -{ - /// - /// Our version of the - /// - public abstract class KEAbilities - { - #region static stuff - private static HashSet registered = new(); - public static HashSet Registered => registered; - #endregion - - #region abstract stuff - public abstract string Name { get; } - public abstract string Description { get; } - /// - /// Used for the settings option - /// - public abstract int Id { get; } - /// - /// in seconds - /// - public abstract float Cooldown { get; } - #endregion - - public HashSet GetRoles - { - get - { - HashSet result = new(); - foreach (KECustomRole cr in KECustomRole.KnownKECR) - { - foreach(int abilityId in cr.Abilities) - { - KEAbilities ability = Get(abilityId); - if (ability == this) - { - result.Add(cr); - } - } - } - return result; - } - } - private Dictionary LastUsed = new(); - private static Dictionary TypeToAbility { get; } = new(); - private static Dictionary IdToAbility { get; } = new(); - private static HeaderSetting header; - private static bool flagHeader = false; - private SettingBase setting; - public HashSet Players { get; } = new HashSet(); - public HashSet Selected { get; } = new(); - - - - public static Dictionary> PlayersAbility { get;} = new(); - - protected KEAbilities() - { - - } - public void Init() - { - if (IdToAbility.ContainsKey(Id)) - { - Log.Warn($"{Name} ({Id}) have the same id as {IdToAbility[Id].Name}. Skipping..."); - return; - } - - - - SettingBase old = SettingBase.List.Where(s => s.Id == Id).FirstOrDefault(); - - if(old == null) - { - if (!flagHeader) - { - header = new(MainPlugin.Configs.HeaderId, "Abilities"); - SettingBase.Register([header]); - flagHeader = true; - } - Log.Debug("creating keybind"); - setting = new KeybindSetting(Id, Name, UnityEngine.KeyCode.None,hintDescription:Description); - SettingBase.Register([setting]); - } - else - { - Log.Error($"setting of {this} have the same id as {old.Label}"); - } - StartLoop(); - IdToAbility.Add(Id, this); - TypeToAbility.Add(GetType(), this); - InternalSubscribeEvent(); - } - - public void Destroy() - { - Func p = null; - SettingBase.Unregister(p, [setting]); - InternalUnsubcribeEvent(); - } - - private void InternalSubscribeEvent() - { - - ServerSpecificSettingsSync.ServerOnSettingValueReceived += SafeOnSettingValueReceived; - Exiled.Events.Handlers.Player.Verified += OnVerified; - SubscribeEvents(); - } - - private void InternalUnsubcribeEvent() - { - ServerSpecificSettingsSync.ServerOnSettingValueReceived -= SafeOnSettingValueReceived; - Exiled.Events.Handlers.Player.Verified -= OnVerified; - UnsubscribeEvents(); - } - - private void SafeOnSettingValueReceived(ReferenceHub hub, ServerSpecificSettingBase settingBase) - { - //not catching the exception will desync & kick the player - try - { - OnSettingValueReceived(Player.Get(hub), settingBase); - } - catch (Exception e) - { - Log.Error(e); - } - } - - private void OnSettingValueReceived(Player player, ServerSpecificSettingBase settingBase) - { - if (!CheckPressed(settingBase)) return; - if (!Check(player)) return; - - if (!SettingHandler.Instance.GetMode(player)) return; - - - if(CanUse(player,out string _)) - { - UseAbility(player); - } - } - - - - private void OnVerified(VerifiedEventArgs ev) - { - ServerSpecificSettingsSync.SendToPlayer(ev.Player.ReferenceHub); - } - - protected virtual void SubscribeEvents() - { - - } - - protected virtual void UnsubscribeEvents() - { - - } - - protected virtual void AbilityUsed(Player player) - { - - } - - protected virtual void AbilityAdded(Player player) - { - - } - protected virtual void AbilityRemoved(Player player) - { - - } - - - public void SelectAbility(Player player) - { - if (Selected.Add(player)) - { - Log.Debug($"player {player.Nickname} selected ability {this}"); - foreach (KEAbilities abilities in Registered.Where(a => a != this)) - { - abilities.UnselectAbility(player); - } - } - } - - public void UnselectAbility(Player player) - { - Log.Debug($"player {player.Nickname} unselected ability {this}"); - Selected.Remove(player); - } - - public void RemoveAbility(Player player) - { - - if (Players.Contains(player)) - { - Log.Debug($"player {player.Nickname} lost {this}"); - PlayersAbility[player].Remove(this); - Players.Remove(player); - AbilityRemoved(player); - } - } - public void AddAbility(Player player) - { - - bool result = Players.Add(player); - Log.Debug($"player {player.Nickname} got {this} ({result})"); - if (result) - { - if(!PlayersAbility.TryGetValue(player,out var _)) - { - PlayersAbility.Add(player, new()); - } - PlayersAbility[player].Add(this); - - AbilityAdded(player); - } - - } - public void UseAbility(Player player) - { - LastUsed[player] = DateTime.Now; - - - AbilityUsed(player); - } - - public bool Check(Player player) - { - if(player is not null) - { - return Players.Contains(player); - } - return false; - } - - public bool CanUse(Player player, out string result) - { - if (player == null) - { - result = "player null"; - return false; - } - if (!Players.Contains(player)) - { - result = "cannot use this"; - return false; - } - - if (!LastUsed.ContainsKey(player)) - { - result = "never used"; - return true; - } - - DateTime dateTime = LastUsed[player] + TimeSpan.FromSeconds(Cooldown); - if (DateTime.Now > dateTime) - { - result = "ok"; - return true; - } - result = "in cooldown"; - return false; - } - - public bool CheckPressed(ServerSpecificSettingBase settingBase) - { - return CheckPressed(settingBase, setting.Id); - } - - public static void UseSelected(Player player) - { - if(TryGetSelected(player,out var ability)) - { - if (ability.CanUse(player, out string _)) - { - ability.UseAbility(player); - } - } - } - - public static bool TryAddToPlayer(Type typeAbility,Player player) - { - if (!TypeToAbility.TryGetValue(typeAbility, out var ability)) return false; - - - ability.AddAbility(player); - return true; - - - } - public static bool TryAddToPlayer(int abilityId,Player player) - { - if (!IdToAbility.TryGetValue(abilityId, out var ability)) return false; - - - ability.AddAbility(player); - return true; - - - } - - public static void RemoveAllSelect(Player player) - { - if (!PlayersAbility.ContainsKey(player)) return; - - foreach(KEAbilities ability in PlayersAbility[player]) - { - ability.Selected.Remove(player); - } - - UpdateGUI(player); - } - - public static void SelectFirstAbility(Player player) - { - if(PlayersAbility.TryGetValue(player,out var list)) - { - list[0].SelectAbility(player); - - UpdateGUI(player); - } - - } - - public static void TryRemoveFromPlayer(Player player) - { - foreach(KEAbilities abilities in Registered) - { - if (abilities.Players.Contains(player)) - { - abilities.RemoveAbility(player); - } - } - } - - - public static bool CheckPressed(ServerSpecificSettingBase settingBase, int id) - { - return settingBase is SSKeybindSetting keybindSetting && keybindSetting.SettingId == id && keybindSetting.SyncIsPressed; - } - - #region register - private bool TryRegister() - { - - - if (!Registered.Contains(this)) - { - Registered.Add(this); - Init(); - Log.Debug("registered " + Name); - return true; - } - - - - return false; - } - - - public static IEnumerable Register(Assembly assembly =null) - { - IEnumerable abilities = ReflectionHelper.GetObjects(assembly); - List result = abilities.ToList(); - - foreach(KEAbilities ability in abilities) - { - - if (!ability.TryRegister()) - { - Log.Warn("couldn't register KEability " + ability); - result.Remove(ability); - } - - } - registered = result.ToHashSet(); - return result; - - } - - - private bool TryUnregister() - { - Destroy(); - if (Registered.Remove(this)) - { - Log.Debug("unregistered " + this); - return true; - } - Log.Warn(this + " was not registered"); - return false; - } - - public static IEnumerable Unregister() - { - List list = new(); - foreach (KEAbilities item in Registered) - { - item.TryUnregister(); - list.Add(item); - } - - return list; - } - #endregion - - #region getters - - public static KEAbilities Get(int id) - { - foreach(KEAbilities kEAbilities in Registered) - { - if (id == kEAbilities.Id) - { - return kEAbilities; - } - } - - return null; - } - - public static bool TryGet(int id, out KEAbilities ability) - { - ability = Get(id); - return ability != null; - } - - public static KEAbilities GetSelected(Player player) - { - foreach(KEAbilities ability in Registered) - { - if (ability.Selected.Contains(player)) - { - return ability; - } - } - return null; - } - - public static bool TryGetSelected(Player player, out KEAbilities ability) - { - ability = GetSelected(player); - return ability != null; - } - - - #endregion - - #region gui - - - private static readonly float UpdateTime = 1; - private static bool flag = false; - private static void StartLoop() - { - if (!flag) - { - Timing.RunCoroutine(Loop()); - flag = true; - } - } - private static IEnumerator Loop() - { - while (true) - { - UpdateAllGUI(); - yield return Timing.WaitForSeconds(UpdateTime); - } - } - public static void UpdateAllGUI() - { - foreach(Player player in PlayersAbility.Keys) - { - UpdateGUI(player); - } - } - public static void UpdateGUI(Player player) - { - string msg = ""; - - List allAbilities = PlayersAbility[player]; - - for (int i = 0; i < allAbilities.Count; i++) - { - - - KEAbilities ability = allAbilities[i]; - - msg += $"{ability.Name} "; - if (ability.CanUse(player,out var output)) - { - msg += "[READY]"; - } - else - { - DateTime dateTime = ability.LastUsed[player] + TimeSpan.FromSeconds(ability.Cooldown); - msg += $"[{Math.Round((dateTime - DateTime.Now).TotalSeconds, 0)}s]"; - } - - - - //Log.Debug($"ability {ability.Name} contain {ability.Selected.Count} "); - - if (ability.Selected.Contains(player)) - { - //todo replace with the settings - msg += SettingHandler.baseArrow; - } - - - - msg += "\n"; - } - - //Log.Debug(msg); - - DisplayHandler.Instance.AddHint(MainPlugin.Abilities, player, msg, 1f); - } - - - #endregion - - public override string ToString() - { - return Name; - } - - } -} diff --git a/KruacentExiled/KE.CustomRoles/API/Features/KECustomRole.cs b/KruacentExiled/KE.CustomRoles/API/Features/KECustomRole.cs deleted file mode 100644 index 11c76aa3..00000000 --- a/KruacentExiled/KE.CustomRoles/API/Features/KECustomRole.cs +++ /dev/null @@ -1,249 +0,0 @@ -using Exiled.API.Enums; -using Exiled.API.Extensions; -using Exiled.API.Features; -using Exiled.CustomRoles.API; -using Exiled.CustomRoles.API.Features; -using InventorySystem.Configs; -using KE.Utils.API.Displays.DisplayMeow; -using MEC; -using PlayerRoles; -using System.Collections.Generic; -using System.Linq; -using UnityEngine; - -namespace KE.CustomRoles.API.Features -{ - public abstract class KECustomRole : CustomRole - { - - public override string Name - { - get - { - return GetType().Name; - } - set - { - - } - } - - - public static IEnumerable KnownKECR => Registered.Where(c => c is KECustomRole).Cast(); - - public sealed override string CustomInfo { get; set; } - public abstract string PublicName { get; set; } - - public virtual HashSet Abilities { get; } - - public sealed override bool IgnoreSpawnSystem { get; set; } = true; - protected override void ShowMessage(Player player) - { - - //string msg = MainPlugin.Translations.GettingNewRole; - //msg = msg.Replace("%Name%", PublicName).Replace("%Desc%",Description); - - string msg = $"{PublicName}"; - - if (MainPlugin.SettingHandler.GetDescriptionsSettings(player)) - { - msg += $"\n {Description}"; - } - - - float delay = MainPlugin.SettingHandler.GetTime(player); - - DisplayHandler.Instance.AddHint(MainPlugin.CRHint, player, msg, delay); - } - - - - protected void ShowEffectHint(Player player, string text) - { - float delay = MainPlugin.SettingHandler.GetTime(player); ; - DisplayHandler.Instance.AddHint(MainPlugin.CREffect, player, text, delay); - } - - public override void AddRole(Player player) - { - Player player2 = player; - Log.Debug(Name + ": Adding role to " + player2.Nickname + "."); - - if (Role != RoleTypeId.None) - { - - if (KeepPositionOnSpawn) - { - if (KeepInventoryOnSpawn) - { - player2.Role.Set(Role, SpawnReason.ForceClass, RoleSpawnFlags.None); - } - else - { - player2.Role.Set(Role, SpawnReason.ForceClass, RoleSpawnFlags.AssignInventory); - } - } - else if (KeepInventoryOnSpawn && player2.IsAlive) - { - player2.Role.Set(Role, SpawnReason.ForceClass, RoleSpawnFlags.None); - } - else - { - player2.Role.Set(Role, SpawnReason.ForceClass, RoleSpawnFlags.AssignInventory); - } - } - TrackedPlayers.Add(player2); - - Timing.CallDelayed(0.25f, delegate - { - if (!KeepInventoryOnSpawn) - { - player2.ClearInventory(); - } - - foreach (string item in Inventory) - { - TryAddItem(player2, item); - } - - if (Ammo.Count > 0) - { - AmmoType[] values = EnumUtils.Values; - foreach (AmmoType ammoType in values) - { - if (ammoType != 0) - { - player2.SetAmmo(ammoType, (ushort)(Ammo.ContainsKey(ammoType) ? Ammo[ammoType] == ushort.MaxValue ? InventoryLimits.GetAmmoLimit(ammoType.GetItemType(), player2.ReferenceHub) : Ammo[ammoType] : 0)); - } - } - } - }); - player2.Health = MaxHealth; - player2.MaxHealth = MaxHealth; - player2.Scale = Scale; - Vector3 spawnPosition = GetSpawnPosition(); - if (spawnPosition != Vector3.zero) - { - player2.Position = spawnPosition; - } - - player2.CustomInfo = player2.CustomName + "\n" + PublicName; - player2.InfoArea &= ~(PlayerInfoArea.Nickname | PlayerInfoArea.Role); - if (CustomAbilities != null) - { - foreach (CustomAbility customAbility in CustomAbilities) - { - customAbility.AddAbility(player2); - } - } - - - if(Abilities != null) - { - foreach(int abilityId in Abilities) - { - KEAbilities.TryAddToPlayer(abilityId, player2); - } - KEAbilities.SelectFirstAbility(player2); - } - - - ShowMessage(player2); - RoleAdded(player2); - player2.UniqueRole = Name; - player2.TryAddCustomRoleFriendlyFire(Name, CustomRoleFFMultiplier); - } - - public override void RemoveRole(Player player) - { - if (Abilities != null) - { - KEAbilities.TryRemoveFromPlayer(player); - } - base.RemoveRole(player); - } - - - /// - /// The chance of having this role NOT the chance to have a role - /// - public override abstract float SpawnChance { get; set; } - - - - - #region Spawn - - /// - /// The chance to get a at the start or a respawn - /// - public static int Chance - { - get - { - return chance; - } - set - { - chance = Mathf.Clamp(value, 0, 100); - } - } - - private static int chance = 40; - - private static CustomRole AssignRole(Dictionary roleChances) - { - float totalWeight = roleChances.Values.Sum(); - float randomValue = UnityEngine.Random.Range(0f, totalWeight); - - foreach (var role in roleChances) - { - randomValue -= role.Value; - if (randomValue <= 0) - return role.Key; - } - - return roleChances.Keys.First(); - } - - public static Dictionary GetAvailableCustomRole(Player player) - { - return Registered.Where(c => c.Role == player.Role || c is GlobalCustomRole cgr && cgr.Side == SideClass.Get(player.Role.Side)).ToDictionary(c => c, c => c.SpawnChance); - } - - public static void GiveRandomRole(Player player) - { - if (player == null) - return; - if (UnityEngine.Random.Range(0, 101) > Chance) - { - Log.Debug("no luck"); - return; - } - - if(player.GetCustomRoles().Count != 0) - { - Log.Debug("already got a cr"); - return; - } - - - CustomRole cr = AssignRole(GetAvailableCustomRole(player)); - Log.Debug($"{player.Id} : {cr.Name}"); - - //error assigning cr to a player with a gcr - cr?.AddRole(player); - } - - public static void GiveRole(IEnumerable players) - { - foreach (Player p in players) - { - GiveRandomRole(p); - } - } - #endregion - - - } -} diff --git a/KruacentExiled/KE.CustomRoles/API/Interfaces/ISCPPreferences.cs b/KruacentExiled/KE.CustomRoles/API/Interfaces/ISCPPreferences.cs deleted file mode 100644 index a3d74e4e..00000000 --- a/KruacentExiled/KE.CustomRoles/API/Interfaces/ISCPPreferences.cs +++ /dev/null @@ -1,18 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace KE.CustomRoles.API.Interfaces -{ - - /// - /// SCP custom role implementing this interface will allow them to have a preference slider like the vanilla scps - /// - public interface ISCPPreferences - { - - - } -} diff --git a/KruacentExiled/KE.CustomRoles/Abilities/Airstrike.cs b/KruacentExiled/KE.CustomRoles/Abilities/Airstrike.cs deleted file mode 100644 index 1af25274..00000000 --- a/KruacentExiled/KE.CustomRoles/Abilities/Airstrike.cs +++ /dev/null @@ -1,75 +0,0 @@ -using Exiled.API.Features; -using Exiled.API.Features.Attributes; -using Exiled.API.Features.Items; -using Exiled.API.Features.Pickups.Projectiles; -using Exiled.API.Features.Toys; -using Exiled.CustomRoles.API.Features; -using KE.CustomRoles.API.Features; -using MapGeneration; -using MEC; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using UnityEngine; -using Light = Exiled.API.Features.Toys.Light; - -namespace KE.CustomRoles.Abilities -{ - public class Airstrike : KEAbilities - { - public override string Name { get; } = "Airstrike"; - - public override string Description { get; } = "Don't overuse it or your co-op will not be happy"; - - public override int Id => 2001; - public override float Cooldown { get; } = 60f; - - public float height = 5; - - - - protected override void AbilityUsed(Player player) - { - if(!SelectPosition.TryGetTarget(player, out Vector3 target)) - { - //show hint - Log.Info("no target selected"); - return; - } - if(target.GetZone() != FacilityZone.Surface) - { - Log.Info("set target surface"); - return; - } - - Physics.Linecast(target, target + height * Vector3.up, out RaycastHit hit); - if (hit.collider != null) - { - Log.Info($"hit something [{hit.collider}]"); - return; - } - - var l = Light.Create(target,null,null,true,Color.red); - - ExplosiveGrenade grenade = (ExplosiveGrenade)Item.Create(ItemType.GrenadeHE,player); - grenade.ScpDamageMultiplier = 1; - grenade.FuseTime = 10; - Timing.CallDelayed(5, () => - { - Projectile gre = grenade.SpawnActive(target + (height - .5f) * Vector3.up); - - //explode on collision - gre.GameObject.AddComponent().Init(player.GameObject, gre.Base); - l.Destroy(); - }); - - - - - } - - - } -} diff --git a/KruacentExiled/KE.CustomRoles/Abilities/Convert.cs b/KruacentExiled/KE.CustomRoles/Abilities/Convert.cs deleted file mode 100644 index 790ecac9..00000000 --- a/KruacentExiled/KE.CustomRoles/Abilities/Convert.cs +++ /dev/null @@ -1,52 +0,0 @@ -using Exiled.API.Features; -using Exiled.API.Features.Attributes; -using Exiled.CustomRoles.API.Features; -using KE.CustomRoles.API.Features; -using PlayerRoles; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using UnityEngine; - -namespace KE.CustomRoles.Abilities -{ - public class Convert : KEAbilities - { - public override string Name { get; } = "Convert"; - - public override string Description { get; } = ""; - - public override int Id => 2004; - - public override float Cooldown { get; } = 10*60f; - - public float MaxDistance { get; set; } = 5f; - - protected override void AbilityUsed(Player player) - { - Physics.Linecast(player.Position, player.Position + player.Rotation.eulerAngles * MaxDistance,out RaycastHit hit); - - Player playerHit = Player.Get(hit.collider); - - if (playerHit == null) return; - - if (playerHit.Role.Side == player.Role.Side) return; - - if (playerHit.IsScp && playerHit.Role != RoleTypeId.Scp0492) return; - - - if (playerHit.IsScp) - { - playerHit.Role.Set(player.Role, RoleSpawnFlags.AssignInventory); - } - else - { - playerHit.Role.Set(player.Role, RoleSpawnFlags.None); - } - - } - - } -} diff --git a/KruacentExiled/KE.CustomRoles/Abilities/Explode.cs b/KruacentExiled/KE.CustomRoles/Abilities/Explode.cs deleted file mode 100644 index 031cda80..00000000 --- a/KruacentExiled/KE.CustomRoles/Abilities/Explode.cs +++ /dev/null @@ -1,33 +0,0 @@ -using Exiled.API.Features; -using Exiled.API.Features.Attributes; -using Exiled.API.Features.Items; -using Exiled.CustomRoles.API.Features; -using KE.CustomRoles.API.Features; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using UnityEngine; - -namespace KE.CustomRoles.Abilities -{ - public class Explode : KEAbilities - { - public override string Name { get; } = "Explode"; - - public override string Description { get; } = "Tu as une ceinture d'explosif autour de toi, fait attention n'appuie pas sur le bouton"; - - public override int Id => 2007; - - public override float Cooldown { get; } = 4*60f; - - protected override void AbilityUsed(Player player) - { - ExplosiveGrenade grenade = ((ExplosiveGrenade)Item.Create(ItemType.GrenadeHE)); - grenade.FuseTime = 0.2f; - grenade.SpawnActive(player.Position); - Log.Debug("Grenade spawned"); - } - } -} diff --git a/KruacentExiled/KE.CustomRoles/Abilities/SelectPosition.cs b/KruacentExiled/KE.CustomRoles/Abilities/SelectPosition.cs deleted file mode 100644 index 667ac4bb..00000000 --- a/KruacentExiled/KE.CustomRoles/Abilities/SelectPosition.cs +++ /dev/null @@ -1,46 +0,0 @@ -using Exiled.API.Features; -using KE.CustomRoles.API.Features; -using System.Collections.Generic; -using UnityEngine; - -namespace KE.CustomRoles.Abilities -{ - public class SelectPosition : KEAbilities - { - public override string Name { get; } = "SetPosition"; - - public override string Description { get; } = "Select the current position for another ability"; - - public override int Id => 2000; - public override float Cooldown { get; } = 5f; - - private static Dictionary SelectedTarget = new(); - - protected override void AbilityUsed(Player player) - { - - - - if (SelectedTarget.ContainsKey(player)) - { - SelectedTarget[player] = player.Position; - } - else - { - SelectedTarget.Add(player, player.Position); - } - - Log.Info("set position at " +player.Position); - - - } - - public static bool TryGetTarget(Player p, out Vector3 target) - { - return SelectedTarget.TryGetValue(p, out target); - - } - - - } -} diff --git a/KruacentExiled/KE.CustomRoles/Abilities/Thief.cs b/KruacentExiled/KE.CustomRoles/Abilities/Thief.cs deleted file mode 100644 index d2325f34..00000000 --- a/KruacentExiled/KE.CustomRoles/Abilities/Thief.cs +++ /dev/null @@ -1,52 +0,0 @@ -using Exiled.API.Extensions; -using Exiled.API.Features; -using Exiled.API.Features.Items; -using KE.CustomRoles.API.Features; -using KE.Utils.API.Displays.DisplayMeow; -using System.Collections.Generic; -using System.Linq; - -namespace KE.CustomRoles.Abilities -{ - public class Thief : KEAbilities - { - public override string Name { get; } = "Thief"; - - public override string Description { get; } = "Avec 1548 heures de jeu sur Thief Simulator fallait s'y attendre un peu."; - - public override int Id => 2006; - - public override float Cooldown { get; } = 120f; - - protected override void AbilityUsed(Player player) - { - List playerList = Player.List.Where(p => !p.IsScp).ToList(); - playerList.Remove(player); - - Log.Debug("Player list :"); - playerList.ForEach(p => Log.Info(p.Nickname)); - - Player thiefed = playerList.GetRandomValue(); - - Log.Debug($"Thiefed player : {thiefed.Nickname}"); - - Item inv = thiefed.Items.ToList().GetRandomValue(); - - Log.Debug($"Thiefed item : {inv}"); - - if (inv == null) - { - Log.Info("No item to thiefed, null, returning."); - HintPlacement hint = new(0, 750, HintServiceMeow.Core.Enum.HintAlignment.Center); - float delay = MainPlugin.SettingHandler.GetTime(player); - DisplayHandler.Instance.AddHint(hint, player, "I think this is a skill issue ! Congrats !", delay); - } - - var thiefBool = thiefed.RemoveItem(inv); - Log.Debug($"Item deleted {thiefBool}."); - - inv.Give(player); - Log.Debug($"Item given to {player.Nickname}."); - } - } -} diff --git a/KruacentExiled/KE.CustomRoles/Abilities/Trade.cs b/KruacentExiled/KE.CustomRoles/Abilities/Trade.cs deleted file mode 100644 index 4465ea06..00000000 --- a/KruacentExiled/KE.CustomRoles/Abilities/Trade.cs +++ /dev/null @@ -1,51 +0,0 @@ -using Exiled.API.Features; -using Exiled.API.Features.Attributes; -using Exiled.CustomRoles.API.Features; -using KE.CustomRoles.API.Features; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using UnityEngine; - -namespace KE.CustomRoles.Abilities -{ - public class Trade : KEAbilities - { - public override string Name { get; } = "Trade"; - - public override string Description { get; } = "T'es lien avec le casino t'as permis d'avoir un peu plus de pièce en échange d'un item ou de pire"; - - public override int Id => 2002; - - public override float Cooldown { get; } = 1f; - - public static float MaxHealthPercent = .1f; - - protected override void AbilityUsed(Player player) - { - if (player.CurrentItem != null) - { - player.RemoveItem(player.CurrentItem); - } - else - { - float newMaxHealth = player.MaxHealth - player.MaxHealth * MaxHealthPercent; - if (newMaxHealth > 0) - { - player.MaxHealth = newMaxHealth; - player.Health = Mathf.Min(player.Health, player.MaxHealth); - } - else - { - player.Kill("The casino always win"); - return; - } - } - - player.AddItem(ItemType.Coin); - } - - } -} diff --git a/KruacentExiled/KE.CustomRoles/CR/ChaosInsurgency/LeRusse.cs b/KruacentExiled/KE.CustomRoles/CR/ChaosInsurgency/LeRusse.cs deleted file mode 100644 index 5d406b07..00000000 --- a/KruacentExiled/KE.CustomRoles/CR/ChaosInsurgency/LeRusse.cs +++ /dev/null @@ -1,39 +0,0 @@ -using Exiled.API.Enums; -using Exiled.API.Features.Attributes; -using KE.CustomRoles.API.Features; -using PlayerRoles; -using System.Collections.Generic; -using UnityEngine; - -namespace KE.CustomRoles.CR.ChaosInsurgency -{ - [CustomRole(RoleTypeId.ChaosConscript)] - internal class Russe : KECustomRole - { - public override string Description { get; set; } = "Tu es un maitre de jeu \ntu dois faire la roulette russe avec les autres joueurs"; - public override uint Id { get; set; } = 1050; - public override string PublicName { get; set; } = "Le Russe"; - public override int MaxHealth { get; set; } = 100; - public override RoleTypeId Role { get; set; } = RoleTypeId.ChaosConscript; - public override bool KeepRoleOnDeath { get; set; } = false; - public override bool KeepRoleOnChangingRole { get; set; } = false; - - public override float SpawnChance { get; set; } = 100; - public override Vector3 Scale { get; set; } = new Vector3(1.1f, 1f, 1.1f); - - public override List Inventory { get; set; } = new List() - { - $"{ItemType.GunRevolver}", - $"{ItemType.Radio}", - $"{ItemType.Adrenaline}", - $"{ItemType.KeycardChaosInsurgency}", - $"{ItemType.GrenadeHE}", - $"{ItemType.GrenadeHE}", - }; - - public override Dictionary Ammo { get; set; } = new Dictionary() - { - { AmmoType.Ammo44Cal, 18} - }; - } -} diff --git a/KruacentExiled/KE.CustomRoles/CR/ChaosInsurgency/Negotiator.cs b/KruacentExiled/KE.CustomRoles/CR/ChaosInsurgency/Negotiator.cs deleted file mode 100644 index 83e9512a..00000000 --- a/KruacentExiled/KE.CustomRoles/CR/ChaosInsurgency/Negotiator.cs +++ /dev/null @@ -1,67 +0,0 @@ -using Exiled.API.Enums; -using Exiled.API.Features; -using Exiled.API.Features.Attributes; -using Exiled.CustomRoles.API.Features; -using Exiled.Events.EventArgs.Player; -using KE.CustomRoles.API.Features; -using MEC; -using PlayerRoles; -using System.Collections.Generic; -using UnityEngine; - -namespace KE.CustomRoles.CR.ChaosInsurgency -{ - [CustomRole(RoleTypeId.ChaosConscript)] - internal class Negotiator : KECustomRole - { - public override string Description { get; set; } = "Who knew zombie could be so great listeners"; - public override uint Id { get; set; } = 1071; - public override string PublicName { get; set; } = "Negotiator"; - public override int MaxHealth { get; set; } = 100; - public override RoleTypeId Role { get; set; } = RoleTypeId.ChaosConscript; - public override bool KeepRoleOnDeath { get; set; } = false; - public override bool KeepRoleOnChangingRole { get; set; } = false; - - public override float SpawnChance { get; set; } = 100; - - public override HashSet Abilities { get; } = new() - { - 2004 - }; - - protected override void RoleAdded(Player player) - { - Timing.CallDelayed(.1f, delegate - { - player.AddItem(ItemType.Radio); - }); - } - - protected override void SubscribeEvents() - { - Exiled.Events.Handlers.Player.Hurting += OnHurting; - base.SubscribeEvents(); - } - - protected override void UnsubscribeEvents() - { - Exiled.Events.Handlers.Player.Hurting -= OnHurting; - base.UnsubscribeEvents(); - } - - - private void OnHurting(HurtingEventArgs ev) - { - if (!Check(ev.Player)) return; - if (!ev.IsAllowed) return; - - if(ev.Attacker.Role.Side == ev.Player.Role.Side) - { - ev.IsAllowed = false; - } - - } - - - } -} diff --git a/KruacentExiled/KE.CustomRoles/CR/ClassD/DBoyInShape.cs b/KruacentExiled/KE.CustomRoles/CR/ClassD/DBoyInShape.cs deleted file mode 100644 index 7b34aa77..00000000 --- a/KruacentExiled/KE.CustomRoles/CR/ClassD/DBoyInShape.cs +++ /dev/null @@ -1,92 +0,0 @@ -using CustomPlayerEffects; -using Exiled.API.Enums; -using Exiled.API.Extensions; -using Exiled.API.Features; -using Exiled.API.Features.Attributes; -using Exiled.CustomRoles.API.Features; -using Exiled.Events.EventArgs.Map; -using Exiled.Events.EventArgs.Player; -using KE.CustomRoles.API.Features; -using MEC; -using PlayerRoles; -using System; -using System.Collections.Generic; -using System.Linq; -using UnityEngine; -using Utils.NonAllocLINQ; - -namespace KE.CustomRoles.CR.ClassD -{ - [CustomRole(RoleTypeId.ClassD)] - internal class DBoyInShape : KECustomRole - { - public override string Description { get; set; } = "Dammmmnnnnnnn les gates"; - public override uint Id { get; set; } = 1058; - public override string PublicName { get; set; } = "DBoyInShape"; - public override RoleTypeId Role { get; set; } = RoleTypeId.ClassD; - public override bool KeepRoleOnDeath { get; set; } = false; - public override bool KeepRoleOnChangingRole { get; set; } = true; - public override float SpawnChance { get; set; } = 100; - public override int MaxHealth { get; set; } = 100; - - private const byte _speedReduction = 15; - - protected override void RoleAdded(Player player) - { - player.EnableEffect(EffectType.Slowness, 5, _speedReduction); - } - - protected override void RoleRemoved(Player player) - { - player.DisableEffect(EffectType.Slowness); - } - - protected override void SubscribeEvents() - { - Exiled.Events.Handlers.Player.InteractingDoor += InteractingDoor; - } - - protected override void UnsubscribeEvents() - { - Exiled.Events.Handlers.Player.InteractingDoor -= InteractingDoor; - } - - public void InteractingDoor(InteractingDoorEventArgs ev) - { - if (ev.IsAllowed) return; - if (!Check(ev.Player)) return; - - int successRate; - int damage; - - if (ev.Door.Type.IsGate()) - { - successRate = 20; - damage = 20; - } - else if (ev.Door.Type.IsCheckpoint()) - { - successRate = 30; - damage = 10; - } - else - { - successRate = 40; - damage = 5; - } - - int proba = UnityEngine.Random.Range(0, 101); - - if (proba <= successRate) - { - ev.IsAllowed = true; - Log.Info($"{ev.Player.Nickname} a réussi à ouvrir une {ev.Door.Type} !"); - } - else - { - Log.Info($"{ev.Player.Nickname} a échoué à ouvrir une {ev.Door.Type} et a perdu {damage} HP !"); - ev.Player.Hurt(damage, DamageType.SeveredHands); - } - } - } -} \ No newline at end of file diff --git a/KruacentExiled/KE.CustomRoles/CR/ClassD/Enfant.cs b/KruacentExiled/KE.CustomRoles/CR/ClassD/Enfant.cs deleted file mode 100644 index 0823311b..00000000 --- a/KruacentExiled/KE.CustomRoles/CR/ClassD/Enfant.cs +++ /dev/null @@ -1,30 +0,0 @@ -using Exiled.API.Features.Attributes; -using InventorySystem.Items.Usables.Scp330; -using KE.CustomRoles.API.Features; -using PlayerRoles; -using System.Collections.Generic; -using UnityEngine; - -namespace KE.CustomRoles.CR.ClassD -{ - [CustomRole(RoleTypeId.ClassD)] - internal class Enfant : KECustomRole - { - public override string Description { get; set; } = "Tu es un Enfant \ndo not the kid \ntu commences avec un bonbon arc-en-ciel \n t'es un peu plus petit que la normal"; - public override uint Id { get; set; } = 1041; - public override string PublicName { get; set; } = "Enfant"; - public override int MaxHealth { get; set; } = 100; - public override RoleTypeId Role { get; set; } = RoleTypeId.ClassD; - public override bool KeepRoleOnDeath { get; set; } = true; - public override bool KeepRoleOnChangingRole { get; set; } = true; - - public override float SpawnChance { get; set; } = 100; - public override Vector3 Scale { get; set; } = new Vector3(1, 0.75f, 1); - - public override List Inventory { get; set; } = new List() - { - $"{CandyKindID.Rainbow}" - }; - } - -} diff --git a/KruacentExiled/KE.CustomRoles/CR/ClassD/Mime.cs b/KruacentExiled/KE.CustomRoles/CR/ClassD/Mime.cs deleted file mode 100644 index 807554b7..00000000 --- a/KruacentExiled/KE.CustomRoles/CR/ClassD/Mime.cs +++ /dev/null @@ -1,41 +0,0 @@ -using Exiled.API.Enums; -using Exiled.API.Features; -using Exiled.API.Features.Attributes; -using Exiled.Events.EventArgs.Player; -using InventorySystem.Items.Usables.Scp330; -using KE.CustomRoles.API.Features; -using PlayerRoles; -using PlayerRoles.Spectating; -using System.Collections.Generic; -using UnityEngine; - -namespace KE.CustomRoles.CR.ClassD -{ - [CustomRole(RoleTypeId.ClassD)] - internal class Mime : KECustomRole - { - public override string Description { get; set; } = "Tu es un Mime \nTu ne peux pas parler\nmais tu fais très peu de bruit quand tu marches\net t'es tout plat"; - public override uint Id { get; set; } = 1053; - public override string PublicName { get; set; } = "Mime"; - public override int MaxHealth { get; set; } = 100; - public override RoleTypeId Role { get; set; } = RoleTypeId.ClassD; - public override bool KeepRoleOnDeath { get; set; } = false; - public override bool KeepRoleOnChangingRole { get; set; } = true; - public override float SpawnChance { get; set; } = 0; - public override Vector3 Scale { get; set; } = new Vector3(0.1f, 1, 1); - - protected override void RoleAdded(Player player) - { - player.EnableEffect(EffectType.SilentWalk, -1, true); //doesn't work with 939 i think - player.Mute(); - } - - protected override void RoleRemoved(Player player) - { - player.UnMute(); - player.DisableEffect(EffectType.SilentWalk); - } - - - } -} diff --git a/KruacentExiled/KE.CustomRoles/CR/Guard/ChiefGuard.cs b/KruacentExiled/KE.CustomRoles/CR/Guard/ChiefGuard.cs deleted file mode 100644 index b607af37..00000000 --- a/KruacentExiled/KE.CustomRoles/CR/Guard/ChiefGuard.cs +++ /dev/null @@ -1,38 +0,0 @@ -using Exiled.API.Enums; -using Exiled.API.Features.Attributes; -using KE.CustomRoles.API.Features; -using PlayerRoles; -using System.Collections.Generic; - -namespace KE.CustomRoles.CR.Guard -{ - [CustomRole(RoleTypeId.FacilityGuard)] - internal class ChiefGuard : KECustomRole - { - public override string Description { get; set; } = "Tu es un Chef des gardes du site \nT'as une carte de private \net un crossvec"; - public override uint Id { get; set; } = 1046; - public override string PublicName { get; set; } = "Chef des Gardes"; - public override int MaxHealth { get; set; } = 100; - public override RoleTypeId Role { get; set; } = RoleTypeId.FacilityGuard; - public override bool KeepRoleOnDeath { get; set; } = false; - public override bool KeepRoleOnChangingRole { get; set; } = false; - - public override float SpawnChance { get; set; } = 100; - - public override List Inventory { get; set; } = new List() - { - $"{ItemType.Radio}", - $"{ItemType.ArmorLight}", - $"{ItemType.GunCrossvec}", - $"{ItemType.Medkit}", - $"{ItemType.Flashlight}", - $"{ItemType.KeycardMTFPrivate}" - }; - - public override Dictionary Ammo { get; set; } = new Dictionary() - { - { AmmoType.Nato556, 120} - }; - - } -} diff --git a/KruacentExiled/KE.CustomRoles/CR/Guard/Guard914.cs b/KruacentExiled/KE.CustomRoles/CR/Guard/Guard914.cs deleted file mode 100644 index e5a5a95f..00000000 --- a/KruacentExiled/KE.CustomRoles/CR/Guard/Guard914.cs +++ /dev/null @@ -1,50 +0,0 @@ -using Exiled.API.Enums; -using Exiled.API.Features.Attributes; -using Exiled.API.Features.Spawn; -using KE.CustomRoles.API.Features; -using PlayerRoles; -using System.Collections.Generic; - -namespace KE.CustomRoles.CR.Guard -{ - [CustomRole(RoleTypeId.FacilityGuard)] - internal class Guard914 : KECustomRole - { - public override string Description { get; set; } = "Tu es Le garde de SCP-914 \nTu commences à 914 \nmais on a volé ta carte \net ntm aussi"; - public override uint Id { get; set; } = 1045; - public override string PublicName { get; set; } = "Garde de 914"; - public override int MaxHealth { get; set; } = 100; - public override RoleTypeId Role { get; set; } = RoleTypeId.FacilityGuard; - public override bool KeepRoleOnDeath { get; set; } = false; - public override bool KeepRoleOnChangingRole { get; set; } = false; - - public override SpawnProperties SpawnProperties { get; set; } = new SpawnProperties() - { - DynamicSpawnPoints = new List() - { - new DynamicSpawnPoint() - { - Location = Exiled.API.Enums.SpawnLocationType.Inside914, - Chance = 100, - } - } - }; - - public override float SpawnChance { get; set; } = 100; - - public override List Inventory { get; set; } = new List() - { - $"{ItemType.Radio}", - $"{ItemType.ArmorLight}", - $"{ItemType.GunFSP9}", - $"{ItemType.Medkit}", - $"{ItemType.Flashlight}" - }; - - public override Dictionary Ammo { get; set; } = new Dictionary() - { - { AmmoType.Nato556, 60} - }; - - } -} diff --git a/KruacentExiled/KE.CustomRoles/CR/Human/Alzheimer.cs b/KruacentExiled/KE.CustomRoles/CR/Human/Alzheimer.cs deleted file mode 100644 index 55e5c88b..00000000 --- a/KruacentExiled/KE.CustomRoles/CR/Human/Alzheimer.cs +++ /dev/null @@ -1,74 +0,0 @@ -using Exiled.API.Enums; -using Exiled.API.Features; -using Exiled.API.Features.Attributes; -using Exiled.CustomRoles.API.Features; -using Exiled.Events.EventArgs.Player; -using KE.CustomRoles.API.Features; -using MEC; -using PlayerRoles; -using System.Collections.Generic; -using UnityEngine; -using Utils.NonAllocLINQ; - -namespace KE.CustomRoles.CR.Human -{ - [CustomRole(RoleTypeId.None)] - internal class Alzheimer : GlobalCustomRole - { - private static Dictionary _coroutines = new(); - public override SideEnum Side { get; set; } = SideEnum.Human; - public override string Description { get; set; } = "Tu es Vieux"; - public override uint Id { get; set; } = 1056; - public override string PublicName { get; set; } = "Vieux"; - public override bool KeepRoleOnDeath { get; set; } = false; - public override bool KeepRoleOnChangingRole { get; set; } = true; - public override float SpawnChance { get; set; } = 100; - protected override void RoleAdded(Player player) - { - _coroutines.Add(player, Timing.RunCoroutine(Teleport(player))); - } - - protected override void RoleRemoved(Player player) - { - if (!_coroutines.ContainsKey(player)) return; - - - - Timing.KillCoroutines(_coroutines[player]); - _coroutines.Remove(player); - } - protected override void SubscribeEvents() - { - Exiled.Events.Handlers.Player.UsedItem += OnUsedItem; - base.SubscribeEvents(); - } - protected override void UnsubscribeEvents() - { - Exiled.Events.Handlers.Player.UsedItem -= OnUsedItem; - base.UnsubscribeEvents(); - } - - private void OnUsedItem(UsedItemEventArgs ev) - { - if (!Check(ev.Player)) return; - if (ev.Item.Type == ItemType.SCP500) - { - RemoveRole(ev.Player); - } - } - - - private IEnumerator Teleport(Player p) - { - while (true) - { - yield return Timing.WaitForSeconds(UnityEngine.Random.Range(300f, 600f)); - p.EnableEffect(EffectType.Flashed,1,5); - p.EnableEffect(EffectType.Invisible,1,6); - p.Teleport(Room.Random(p.Zone)); - } - } - - - } -} diff --git a/KruacentExiled/KE.CustomRoles/CR/Human/Asthmatique.cs b/KruacentExiled/KE.CustomRoles/CR/Human/Asthmatique.cs deleted file mode 100644 index a2cc6966..00000000 --- a/KruacentExiled/KE.CustomRoles/CR/Human/Asthmatique.cs +++ /dev/null @@ -1,57 +0,0 @@ -using Exiled.API.Enums; -using Exiled.API.Features; -using Exiled.API.Features.Attributes; -using Exiled.CustomRoles.API.Features; -using Exiled.Events.EventArgs.Player; -using KE.CustomRoles.API.Features; -using PlayerRoles; -using UnityEngine; -using Utils.NonAllocLINQ; - -namespace KE.CustomRoles.CR.Human -{ - [CustomRole(RoleTypeId.None)] - internal class Asthmatique : GlobalCustomRole - { - public override SideEnum Side { get; set; } = SideEnum.Human; - public override string Description { get; set; } = "Tu es asthmatique\nT'as stamina est réduit de moitié\nMais tu vises mieux"; - public override uint Id { get; set; } = 1042; - public override string PublicName { get; set; } = "Asthmatique"; - public override bool KeepRoleOnDeath { get; set; } = false; - public override bool KeepRoleOnChangingRole { get; set; } = true; - public override float SpawnChance { get; set; } = 100; - - - protected override void SubscribeEvents() - { - Exiled.Events.Handlers.Player.UsedItem += OnUsedItem; - base.SubscribeEvents(); - } - protected override void UnsubscribeEvents() - { - Exiled.Events.Handlers.Player.UsedItem -= OnUsedItem; - base.UnsubscribeEvents(); - } - - private void OnUsedItem(UsedItemEventArgs ev) - { - if (!Check(ev.Player)) return; - if(ev.Item.Type == ItemType.SCP500) - { - RemoveRole(ev.Player); - } - } - - protected override void RoleAdded(Player player) - { - player.EnableEffect(EffectType.Scp1853, -1, true); - player.EnableEffect(EffectType.Exhausted, -1, true); - } - - protected override void RoleRemoved(Player player) - { - player.DisableEffect(EffectType.Scp1853); - player.DisableEffect(EffectType.Exhausted); - } - } -} diff --git a/KruacentExiled/KE.CustomRoles/CR/Human/Big.cs b/KruacentExiled/KE.CustomRoles/CR/Human/Big.cs deleted file mode 100644 index 9de4c432..00000000 --- a/KruacentExiled/KE.CustomRoles/CR/Human/Big.cs +++ /dev/null @@ -1,23 +0,0 @@ -using Exiled.API.Features.Attributes; -using Exiled.CustomRoles.API.Features; -using KE.CustomRoles.API.Features; -using PlayerRoles; -using System.Collections.Generic; -using UnityEngine; - -namespace KE.CustomRoles.CR.Human -{ - [CustomRole(RoleTypeId.None)] - public class Big : GlobalCustomRole - { - public override SideEnum Side { get; set; } = SideEnum.Human; - public override string Description { get; set; } = "Faut arrêter le McDo au bout d'un moment !"; - public override uint Id { get; set; } = 1068; - public override string PublicName { get; set; } = "Big"; - public override bool KeepRoleOnDeath { get; set; } = true; - public override bool KeepRoleOnChangingRole { get; set; } = true; - - public override float SpawnChance { get; set; } = 100; - public override Vector3 Scale { get; set; } = new Vector3(1, 1, 1.4f); - } -} \ No newline at end of file diff --git a/KruacentExiled/KE.CustomRoles/CR/Human/Cleptoman.cs b/KruacentExiled/KE.CustomRoles/CR/Human/Cleptoman.cs deleted file mode 100644 index 89a1d900..00000000 --- a/KruacentExiled/KE.CustomRoles/CR/Human/Cleptoman.cs +++ /dev/null @@ -1,28 +0,0 @@ -using Exiled.API.Features.Attributes; -using Exiled.CustomRoles.API.Features; -using KE.CustomRoles.API.Features; -using PlayerRoles; -using System.Collections.Generic; -using UnityEngine; - -namespace KE.CustomRoles.CR.Human -{ - [CustomRole(RoleTypeId.None)] - public class Cleptoman : GlobalCustomRole - { - public override SideEnum Side { get; set; } = SideEnum.Human; - public override string Description { get; set; } = "Tu es un Cccleptoman \nTu peux voler les items des autres joueurs"; - public override uint Id { get; set; } = 1453; - public override string PublicName { get; set; } = "Cleptoman"; - public override bool KeepRoleOnDeath { get; set; } = false; - public override bool KeepRoleOnChangingRole { get; set; } = true; - - public override float SpawnChance { get; set; } = 100; - public override Vector3 Scale { get; set; } = new Vector3(1.01f, 0.99f, 1); - - public override HashSet Abilities { get; } = new() - { - 2006 - }; - } -} \ No newline at end of file diff --git a/KruacentExiled/KE.CustomRoles/CR/Human/Curiosophile.cs b/KruacentExiled/KE.CustomRoles/CR/Human/Curiosophile.cs deleted file mode 100644 index 9c488670..00000000 --- a/KruacentExiled/KE.CustomRoles/CR/Human/Curiosophile.cs +++ /dev/null @@ -1,148 +0,0 @@ -/* -using Exiled.API.Enums; -using Exiled.API.Extensions; -using Exiled.API.Features; -using Exiled.API.Features.Attributes; -using Exiled.CustomRoles.API.Features; -using Exiled.Events.EventArgs.Map; -using Exiled.Events.EventArgs.Player; -using KE.CustomRoles.API; -using MEC; -using PlayerRoles; -using System; -using System.Collections.Generic; -using System.Linq; -using UnityEngine; -using Utils.NonAllocLINQ; - -namespace KE.CustomRoles.CR.Human -{ - [CustomRole(RoleTypeId.None)] - internal class Curiosophile : GlobalCustomRole - { - public override SideEnum Side { get; set; } = SideEnum.Human; - public override string Name { get; set; } = "Curiosophile"; - public override string Description { get; set; } = "Tu veux récuperer tous ce que tu vois !"; - public override uint Id { get; set; } = 1059; - public override string CustomInfo { get; set; } = "Curiosophile"; - public override bool KeepRoleOnDeath { get; set; } = false; - public override bool KeepRoleOnChangingRole { get; set; } = true; - public override float SpawnChance { get; set; } = 100; - - private readonly List LowQualityItem = - [ - ItemType.GunA7, - ItemType.GunCOM15, - ItemType.Flashlight, - ItemType.Coin, - ItemType.KeycardJanitor, - ItemType.KeycardGuard, - ]; - - private readonly List HighQualityItem = - [ - ItemType.MicroHID, - ItemType.Jailbird, - ItemType.GunFRMG0, - ItemType.ArmorHeavy, - ItemType.ParticleDisruptor, - ItemType.Adrenaline, - ItemType.SCP1344, - ItemType.SCP500, - ItemType.AntiSCP207, - ItemType.KeycardMTFCaptain, - ItemType.KeycardO5, - ItemType.KeycardFacilityManager, - ]; - - private readonly List BuffEffect = - [ - EffectType.Vitality, - EffectType.RainbowTaste, - EffectType.BodyshotReduction, - EffectType.AntiScp207 - ]; - - private readonly List NerfEffect = - [ - EffectType.Deafened, - EffectType.AmnesiaVision, - EffectType.InsufficientLighting, - EffectType.Stained, - EffectType.Blurred - ]; - - private Dictionary activeEffect = new Dictionary(); - - protected override void SubscribeEvents() - { - Exiled.Events.Handlers.Player.ItemAdded += PickupItem; - Exiled.Events.Handlers.Player.ItemRemoved += ThrowItem; - } - - protected override void UnsubscribeEvents() - { - Exiled.Events.Handlers.Player.ItemAdded -= PickupItem; - Exiled.Events.Handlers.Player.ItemRemoved -= ThrowItem; - } - - public void PickupItem(ItemAddedEventArgs ev) - { - if (!Check(ev.Player)) return; - - CheckupInventory(ev.Player); - } - - public void ThrowItem(ItemRemovedEventArgs ev) - { - if (!Check(ev.Player)) return; - - CheckupInventory(ev.Player); - } - - private void CheckupInventory(Player p) - { - IEnumerable playerItems = p.Items.Select(item => item.Type); - - int buffedItemCount = playerItems.Intersect(LowQualityItem).Count(); - int nerfedItemCount = playerItems.Intersect(HighQualityItem).Count(); - - - - ApplyRandomBuffEffects(buffedItemCount, p); - ApplyRandomNerfEffects(nerfedItemCount, p); - } - - private void ApplyRandomBuffEffects(int buffedItemCount, Player p) - { - if (buffedItemCount > 0) - { - Log.Info("Buff Effect Applied"); - int effectsToApply = Mathf.Min(buffedItemCount, BuffEffect.Count); - - for (int i = 0; i < effectsToApply; i++) - { - var randomBuff = BuffEffect[UnityEngine.Random.Range(0, BuffEffect.Count)]; - p.EnableEffect(randomBuff, -1); - } - } - } - - private void ApplyRandomNerfEffects(int nerfedItemCount, Player p) - { - if (nerfedItemCount > 0) - { - Log.Info("Nerf Effect Applied"); - - int effectsToApply = Mathf.Min(nerfedItemCount, NerfEffect.Count); - - for (int i = 0; i < effectsToApply; i++) - { - var randomNerf = NerfEffect[UnityEngine.Random.Range(0, NerfEffect.Count)]; - p.EnableEffect(randomNerf, -1); - } - } - } - } -} -*/ \ No newline at end of file diff --git a/KruacentExiled/KE.CustomRoles/CR/Human/Diabetique.cs b/KruacentExiled/KE.CustomRoles/CR/Human/Diabetique.cs deleted file mode 100644 index 8e05fe66..00000000 --- a/KruacentExiled/KE.CustomRoles/CR/Human/Diabetique.cs +++ /dev/null @@ -1,32 +0,0 @@ -using CustomPlayerEffects; -using Exiled.API.Enums; -using Exiled.API.Features; -using Exiled.API.Features.Attributes; -using Exiled.CustomRoles.API.Features; -using KE.CustomRoles.API.Features; -using PlayerRoles; -using UnityEngine; -using Utils.NonAllocLINQ; - -namespace KE.CustomRoles.CR.Human -{ - [CustomRole(RoleTypeId.None)] - internal class Diabetique : GlobalCustomRole - { - public override SideEnum Side { get; set; } = SideEnum.Human; - public override string Description { get; set; } = "Tu es diabetique\nT'as mangé le crambleu au pomme de mael"; - public override uint Id { get; set; } = 1054; - public override string PublicName { get; set; } = "Diabetique"; - public override bool KeepRoleOnDeath { get; set; } = false; - public override bool KeepRoleOnChangingRole { get; set; } = false; - public override float SpawnChance { get; set; } = 100; - protected override void RoleAdded(Player player) - { - player.EnableEffect(EffectType.Scp207, -1, true); - } - protected override void RoleRemoved(Player player) - { - player.DisableEffect(EffectType.Scp207); - } - } -} diff --git a/KruacentExiled/KE.CustomRoles/CR/Human/Hitman.cs b/KruacentExiled/KE.CustomRoles/CR/Human/Hitman.cs deleted file mode 100644 index 8a99f513..00000000 --- a/KruacentExiled/KE.CustomRoles/CR/Human/Hitman.cs +++ /dev/null @@ -1,231 +0,0 @@ -using Exiled.API.Enums; -using Exiled.API.Extensions; -using Exiled.API.Features; -using Exiled.API.Features.Attributes; -using Exiled.CustomRoles.API.Features; -using Exiled.Events.EventArgs.Player; -using KE.CustomRoles.API.Features; -using MEC; -using PlayerRoles; -using System.Collections.Generic; -using System.Linq; - -namespace KE.CustomRoles.CR.Human -{ - [CustomRole(RoleTypeId.None)] - internal class Hitman : GlobalCustomRole - { - private static CoroutineHandle _coroutines; - public override SideEnum Side { get; set; } = SideEnum.Human; - public override string Name { get; set; } = "Hitman"; - public override string Description { get; set; } = "Tu es Hitman"; - public override uint Id { get; set; } = 1059; - public override string PublicName { get; set; } = string.Empty; - public override bool KeepRoleOnDeath { get; set; } = false; - public override bool KeepRoleOnChangingRole { get; set; } = true; - public override float SpawnChance { get; set; } = 0; - - private Player TargetPlayer; - private Player TheHitman; - - private void NerfHitman() - { - Log.Info($"Hitman Nerf Applied to {this.TheHitman.Nickname}"); - this.TheHitman.MaxHealth = 70; - this.TheHitman.Health -= 30; - - this.TheHitman.EnableEffect(EffectType.Slowness, -1,true); - } - - private void BuffHitman() - { - Log.Info($"Hitman Buff Applied to {this.TheHitman.Nickname}"); - this.TheHitman.MaxHealth = 130; - this.TheHitman.Health += 30; - - this.TheHitman.EnableEffect(EffectType.MovementBoost, -1, true); - } - - protected override void RoleAdded(Player player) - { - Log.Info("Role full name : " + player.Role.Name); - this.CustomInfo = player.Role.Name; - - this.TheHitman = player; - // Target cannot be NPC, SCP or the Hitman - this.TargetPlayer = Player.List.Where(x => x.IsHuman && x != player && !x.IsNPC).GetRandomValue(); - - if(TargetPlayer == null) - { - Log.Warn("no other human player"); - return; - } - - - - Log.Debug($"Target showing to Hitman, target is : {TargetPlayer.Nickname}"); - ShowEffectHint(player, $"The Target is {TargetPlayer.Nickname}"); - - if (this.TheHitman.Role.Side == this.TargetPlayer.Role.Side && !Server.FriendlyFire) - { - bool success = this.TheHitman.TryAddCustomRoleFriendlyFire(this.TargetPlayer.Role.Type.ToString(), this.TargetPlayer.Role.Type, 1); - Log.Info("Custom FF : " + success); - } - - _coroutines = Timing.RunCoroutine(CheckRooms()); - } - - protected override void RoleRemoved(Player player) - { - Timing.KillCoroutines(_coroutines); - } - - protected override void SubscribeEvents() - { - Exiled.Events.Handlers.Player.Escaped += TargetEscaped; - Exiled.Events.Handlers.Player.Died += TargetDie; - } - - protected override void UnsubscribeEvents() - { - Exiled.Events.Handlers.Player.Escaped -= TargetEscaped; - Exiled.Events.Handlers.Player.Died -= TargetDie; - } - - public void TargetEscaped(EscapedEventArgs ev) - { - if (ev.Player != this.TargetPlayer) return; - - - Log.Info($"Target {this.TargetPlayer.Nickname} escaped"); - ShowEffectHint(TheHitman, $"The target ({this.TargetPlayer.Nickname}) has escaped, you lost the contract"); - - - NerfHitman(); - - this.TargetPlayer = null; - } - - public void TargetDie(DiedEventArgs ev) - { - if (ev.Player != this.TargetPlayer) return; - - Log.Info($"{ev.Attacker} has killed {ev.Player}"); - - // Hitman killed the target - if (ev.Player == this.TargetPlayer && ev.Attacker == this.TheHitman) - { - ShowEffectHint(TheHitman, $"You killed the target ({this.TargetPlayer.Nickname}), you achieved the contract"); - BuffHitman(); - - this.TargetPlayer = null; - } - else - { - ShowEffectHint(TheHitman, $"The target ({this.TargetPlayer.Nickname}) is dead, you lost the contract"); - NerfHitman(); - - this.TargetPlayer = null; - } - - if (this.TheHitman.Role.Side == this.TargetPlayer.Role.Side && !Server.FriendlyFire) - { - this.TheHitman.TryRemoveCustomeRoleFriendlyFire(this.TargetPlayer.Role.Type.ToString()); - } - } - - - - - const float CHECK_INTERVAL = 15f; - - private IEnumerator CheckRooms() - { - List<(int distance, string message, bool hasLogged)> proximityAlerts = new List<(int, string, bool)> - { - (0, "Sweat drips down your forehead...", false), - (3, "Your heart beats out of your chest...", false), - (5, "Your lungs tighten up...", false), - (999, "You feel dizzy...", false) - }; - - while (true) - { - if (this.TargetPlayer == null) - { - Log.Info("Target player is null. Stopping CheckRooms coroutine."); - yield break; - } - - yield return Timing.WaitForSeconds(CHECK_INTERVAL); - - for (int i = 0; i < proximityAlerts.Count; i++) - { - var (distance, message, hasLogged) = proximityAlerts[i]; - - if (distance == 0 && this.TheHitman.CurrentRoom == this.TargetPlayer.CurrentRoom) - { - if (!hasLogged) - { - Log.Info(this.TargetPlayer + " " + message); - - ShowEffectHint(TargetPlayer, message); - ResetLogs(ref proximityAlerts); - proximityAlerts[i] = (distance, message, true); - } - break; - } - else if (distance == 999 && this.TheHitman.Zone == this.TargetPlayer.Zone) - { - if (!hasLogged) - { - ShowEffectHint(TargetPlayer, message); - Log.Info(this.TargetPlayer + " " + message); - ResetLogs(ref proximityAlerts); - proximityAlerts[i] = (distance, message, true); - } - break; - } - else if (AreRoomsWithinDepth(this.TheHitman, this.TargetPlayer, distance)) - { - if (!hasLogged) - { - ShowEffectHint(TargetPlayer, message); - Log.Info(this.TargetPlayer + " " + message); - ResetLogs(ref proximityAlerts); - proximityAlerts[i] = (distance, message, true); - } - break; - } - } - } - } - - private bool AreRoomsWithinDepth(Player p1, Player p2, int depth) - { - HashSet nearbyRooms = GetNearbyRooms(p1, depth); - return nearbyRooms.Contains(p2.CurrentRoom); - } - - private HashSet GetNearbyRooms(Player p, int depth) - { - HashSet rooms = new HashSet(p.CurrentRoom.NearestRooms); - for (int i = 0; i < depth; i++) - { - HashSet newRooms = new HashSet(rooms.SelectMany(r => r.NearestRooms)); - rooms.UnionWith(newRooms); - } - return rooms; - } - - // Reinitialise tous logs sauf celui qui vient d'être actiév - private void ResetLogs(ref List<(int distance, string message, bool hasLogged)> proximityAlerts) - { - for (int i = 0; i < proximityAlerts.Count; i++) - { - var (distance, message, _) = proximityAlerts[i]; - proximityAlerts[i] = (distance, message, false); - } - } - } -} diff --git a/KruacentExiled/KE.CustomRoles/CR/Human/Inverted.cs b/KruacentExiled/KE.CustomRoles/CR/Human/Inverted.cs deleted file mode 100644 index 54592544..00000000 --- a/KruacentExiled/KE.CustomRoles/CR/Human/Inverted.cs +++ /dev/null @@ -1,37 +0,0 @@ -using Exiled.API.Features.Attributes; -using Exiled.CustomRoles.API.Features; -using KE.CustomRoles.API.Features; -using MEC; -using PlayerRoles; -using Exiled.API.Features; -using UnityEngine; -using Exiled.API.Enums; - -namespace KE.CustomRoles.CR.Human -{ - [CustomRole(RoleTypeId.None)] - public class Inverted : GlobalCustomRole - { - public override SideEnum Side { get; set; } = SideEnum.Human; - public override string Description { get; set; } = "Tu as un talent assez exceptionnel !"; - public override uint Id { get; set; } = 1066; - public override string PublicName { get; set; } = "Inverted"; - public override bool KeepRoleOnDeath { get; set; } = true; - public override bool KeepRoleOnChangingRole { get; set; } = true; - - public override float SpawnChance { get; set; } = 100; - public override Vector3 Scale { get; set; } = new Vector3(1, 1, 1); - - protected override void RoleAdded(Player player) - { - player.Scale = new Vector3(1f, -1f, 1f); - player.EnableEffect(EffectType.Slowness, 200, 99999); - } - - protected override void RoleRemoved(Player player) - { - player.Scale = new Vector3(1f, 1f, 1f); - player.DisableEffect(EffectType.Slowness); - } - } -} \ No newline at end of file diff --git a/KruacentExiled/KE.CustomRoles/CR/Human/Maladroit.cs b/KruacentExiled/KE.CustomRoles/CR/Human/Maladroit.cs deleted file mode 100644 index 81ea4a7f..00000000 --- a/KruacentExiled/KE.CustomRoles/CR/Human/Maladroit.cs +++ /dev/null @@ -1,78 +0,0 @@ -using Exiled.API.Enums; -using Exiled.API.Extensions; -using Exiled.API.Features; -using Exiled.API.Features.Attributes; -using Exiled.CustomRoles.API.Features; -using KE.CustomRoles.API.Features; -using MEC; -using PlayerRoles; -using System; -using System.Collections.Generic; -using System.Drawing.Design; -using System.Linq; -using UnityEngine; -using Utils.NonAllocLINQ; - -namespace KE.CustomRoles.CR.Human -{ - [CustomRole(RoleTypeId.None)] - internal class Maladroit : GlobalCustomRole - { - private static Dictionary _coroutines = new(); - - public override SideEnum Side { get; set; } = SideEnum.Human; - public override string Description { get; set; } = "Tu es maladroit\nFait attention à tes items !"; - public override uint Id { get; set; } = 1057; - public override string PublicName { get; set; } = "Maladroit"; - public override bool KeepRoleOnDeath { get; set; } = false; - public override bool KeepRoleOnChangingRole { get; set; } = true; - public override float SpawnChance { get; set; } = 100; - - protected override void RoleAdded(Player player) - { - _coroutines.Add(player, Timing.RunCoroutine(ThrowingItem(player))); - } - - protected override void RoleRemoved(Player player) - { - if (!_coroutines.ContainsKey(player)) return; - Timing.KillCoroutines(_coroutines[player]); - _coroutines.Remove(player); - } - - private IEnumerator ThrowingItem(Player p) - { - Dictionary ActionDictionnary = new() - { - { 50, () => p.DropHeldItem() }, - { 80, () => { /* Nothing */ } }, - { 95, () => DropItemFromInventory(p, 1) }, - { 100, () => DropItemFromInventory(p, 2) }, - }; - - - while (true) - { - yield return Timing.WaitForSeconds(UnityEngine.Random.Range(120f, 200f)); - int proba = UnityEngine.Random.Range(0, 101); - - foreach (var seuil in ActionDictionnary.Keys.OrderBy(p => p)) - { - if(proba < seuil) - { - ActionDictionnary[seuil](); - break; - } - } - } - } - - private void DropItemFromInventory(Player p, int number) - { - for(int i = 0; i <= number; i++) - { - p.DropItem(p.Items.GetRandomValue()); - } - } - } -} \ No newline at end of file diff --git a/KruacentExiled/KE.CustomRoles/CR/Human/Paper.cs b/KruacentExiled/KE.CustomRoles/CR/Human/Paper.cs deleted file mode 100644 index 8c866c72..00000000 --- a/KruacentExiled/KE.CustomRoles/CR/Human/Paper.cs +++ /dev/null @@ -1,23 +0,0 @@ -using Exiled.API.Features.Attributes; -using Exiled.CustomRoles.API.Features; -using KE.CustomRoles.API.Features; -using PlayerRoles; -using System.Collections.Generic; -using UnityEngine; - -namespace KE.CustomRoles.CR.Human -{ - [CustomRole(RoleTypeId.None)] - public class Paper : GlobalCustomRole - { - public override SideEnum Side { get; set; } = SideEnum.Human; - public override string Description { get; set; } = "Tu t'es fait roulé dessus !"; - public override uint Id { get; set; } = 1067; - public override string PublicName { get; set; } = "Paper"; - public override bool KeepRoleOnDeath { get; set; } = true; - public override bool KeepRoleOnChangingRole { get; set; } = true; - - public override float SpawnChance { get; set; } = 100; - public override Vector3 Scale { get; set; } = new Vector3(0.2f, 1, 1); - } -} \ No newline at end of file diff --git a/KruacentExiled/KE.CustomRoles/CR/Human/Paper2.cs b/KruacentExiled/KE.CustomRoles/CR/Human/Paper2.cs deleted file mode 100644 index c531f4f2..00000000 --- a/KruacentExiled/KE.CustomRoles/CR/Human/Paper2.cs +++ /dev/null @@ -1,23 +0,0 @@ -using Exiled.API.Features.Attributes; -using Exiled.CustomRoles.API.Features; -using KE.CustomRoles.API.Features; -using PlayerRoles; -using System.Collections.Generic; -using UnityEngine; - -namespace KE.CustomRoles.CR.Human -{ - [CustomRole(RoleTypeId.None)] - public class Paper2 : GlobalCustomRole - { - public override SideEnum Side { get; set; } = SideEnum.Human; - public override string Description { get; set; } = "Tu t'es fait roulé dessus !"; - public override uint Id { get; set; } = 1067; - public override string PublicName { get; set; } = "Paper"; - public override bool KeepRoleOnDeath { get; set; } = true; - public override bool KeepRoleOnChangingRole { get; set; } = true; - - public override float SpawnChance { get; set; } = 100; - public override Vector3 Scale { get; set; } = new Vector3(0.2f, 1, 1); - } -} \ No newline at end of file diff --git a/KruacentExiled/KE.CustomRoles/CR/MTF/Pilot.cs b/KruacentExiled/KE.CustomRoles/CR/MTF/Pilot.cs deleted file mode 100644 index ce3ad505..00000000 --- a/KruacentExiled/KE.CustomRoles/CR/MTF/Pilot.cs +++ /dev/null @@ -1,50 +0,0 @@ -using Exiled.API.Enums; -using Exiled.API.Features.Attributes; -using Exiled.CustomRoles.API.Features; -using KE.CustomRoles.Abilities; -using KE.CustomRoles.API.Features; -using PlayerRoles; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace KE.CustomRoles.CR.MTF -{ - [CustomRole(RoleTypeId.NtfPrivate)] - public class Pilot : KECustomRole - { - public override string Description { get; set; } = "So I haveth a Laser Pointere"; - public override uint Id { get; set; } = 1088; - public override string PublicName { get; set; } = "Pilot"; - public override int MaxHealth { get; set; } = 75; - public override RoleTypeId Role { get; set; } = RoleTypeId.NtfPrivate; - public override bool KeepRoleOnDeath { get; set; } = false; - public override bool KeepRoleOnChangingRole { get; set; } = false; - - public override float SpawnChance { get; set; } = 100; - - public override List Inventory { get; set; } = new List() - { - $"{ItemType.GunCrossvec}", - $"{ItemType.KeycardMTFOperative}", - $"{ItemType.Radio}", - $"{ItemType.ArmorCombat}", - $"{ItemType.Medkit}" - }; - - public override Dictionary Ammo { get; set; } = new Dictionary() - { - { AmmoType.Nato9, 100} - }; - - public override HashSet Abilities { get; } = new() - { - 2000, - 2001 - }; - - - } -} diff --git a/KruacentExiled/KE.CustomRoles/CR/MTF/Tank.cs b/KruacentExiled/KE.CustomRoles/CR/MTF/Tank.cs deleted file mode 100644 index d2866003..00000000 --- a/KruacentExiled/KE.CustomRoles/CR/MTF/Tank.cs +++ /dev/null @@ -1,81 +0,0 @@ -using Exiled.API.Enums; -using Exiled.API.Features.Attributes; -using Player = Exiled.Events.Handlers.Player; -using Exiled.Events.EventArgs.Player; -using MEC; -using PlayerRoles; -using System.Collections.Generic; -using UnityEngine; -using System; -using KE.CustomRoles.API.Features; - -namespace KE.CustomRoles.CR.MTF -{ - [CustomRole(RoleTypeId.NtfCaptain)] - internal class Tank : KECustomRole - { - public override string Description { get; set; } = "Tu es un TANK tu es débuff mais ta force de tir est démultiplié (fait attention à tes balles)"; - public override uint Id { get; set; } = 1051; - public override string PublicName { get; set; } = "Tank"; - public override int MaxHealth { get; set; } = 200; - public override RoleTypeId Role { get; set; } = RoleTypeId.NtfCaptain; - public override bool KeepRoleOnDeath { get; set; } = false; - public override bool KeepRoleOnChangingRole { get; set; } = false; - - public override float SpawnChance { get; set; } = 100; - public override Vector3 Scale { get; set; } = new Vector3(1.15f, 1f, 1.15f); - - public override List Inventory { get; set; } = new List() - { - $"{ItemType.GunLogicer}", - $"{ItemType.GunFRMG0}", - $"{ItemType.Radio}", - $"{ItemType.GrenadeHE}", - $"{ItemType.Adrenaline}", - $"{ItemType.KeycardMTFCaptain}", - $"{ItemType.Painkillers}", - $"{ItemType.ArmorHeavy}" - }; - - public override Dictionary Ammo { get; set; } = new Dictionary() - { - { AmmoType.Nato762, 200}, - { AmmoType.Nato556, 200} - }; - - protected override void SubscribeEvents() - { - Player.Shooting += Shooting; - base.SubscribeEvents(); - } - - /// - protected override void UnsubscribeEvents() - { - Player.Shooting -= Shooting; - base.UnsubscribeEvents(); - } - - private void Shooting(ShootingEventArgs ev) - { - Timing.CallDelayed(0.5f, () => - { - Timing.RunCoroutine(EffectAttribution(ev.Player)); - }); - } - - private IEnumerator EffectAttribution(Exiled.API.Features.Player player) - { - int nbMunition = player.GetAmmo(AmmoType.Nato762) / 100; - byte nbMunitionByte = (byte)nbMunition; - - if (UnityEngine.Random.Range(0, 1) > 0.5f) - { - player.DisableEffect(EffectType.Slowness); - player.EnableEffect(EffectType.Slowness, nbMunitionByte, 99999, false); - } - - yield return 0; - } - } -} diff --git a/KruacentExiled/KE.CustomRoles/CR/MTF/Terroriste.cs b/KruacentExiled/KE.CustomRoles/CR/MTF/Terroriste.cs deleted file mode 100644 index d89aed2e..00000000 --- a/KruacentExiled/KE.CustomRoles/CR/MTF/Terroriste.cs +++ /dev/null @@ -1,44 +0,0 @@ -using Exiled.API.Enums; -using Exiled.API.Features.Attributes; -using KE.CustomRoles.API.Features; -using PlayerRoles; -using System.Collections.Generic; -using UnityEngine; - -namespace KE.CustomRoles.CR.MTF -{ - [CustomRole(RoleTypeId.NtfSergeant)] - internal class Terroriste : KECustomRole - { - public override string Description { get; set; } = "Tu es un Terroriste \nne fait pas exploser la facilité \ntu commences avec des grenades"; - public override uint Id { get; set; } = 1052; - public override string PublicName { get; set; } = "Terroriste"; - public override int MaxHealth { get; set; } = 100; - public override RoleTypeId Role { get; set; } = RoleTypeId.NtfSergeant; - public override bool KeepRoleOnDeath { get; set; } = false; - public override bool KeepRoleOnChangingRole { get; set; } = false; - - public override float SpawnChance { get; set; } = 100; - public override List Inventory { get; set; } = new List() - { - $"{ItemType.GrenadeHE}", - $"{ItemType.GrenadeHE}", - $"{ItemType.GrenadeHE}", - $"{ItemType.GrenadeHE}", - $"{ItemType.GunE11SR}", - $"{ItemType.Adrenaline}", - $"{ItemType.KeycardMTFOperative}", - $"{ItemType.Radio}" - }; - - public override Dictionary Ammo { get; set; } = new Dictionary() - { - { AmmoType.Nato556, 100} - }; - - public override HashSet Abilities { get; } = new() - { - 2007 - }; - } -} diff --git a/KruacentExiled/KE.CustomRoles/CR/SCP/Paper.cs b/KruacentExiled/KE.CustomRoles/CR/SCP/Paper.cs deleted file mode 100644 index 2e42feee..00000000 --- a/KruacentExiled/KE.CustomRoles/CR/SCP/Paper.cs +++ /dev/null @@ -1,21 +0,0 @@ -using Exiled.API.Features.Attributes; -using KE.CustomRoles.API.Features; -using PlayerRoles; -using UnityEngine; - -namespace KE.CustomRoles.CR.SCP -{ - [CustomRole(RoleTypeId.None)] - public class Paper : GlobalCustomRole - { - public override string Description { get; set; } = "uh oh. paper jam"; - public override uint Id { get; set; } = 1047; - public override SideEnum Side { get; set; } = SideEnum.SCP; - public override string PublicName { get; set; } = "Paper"; - public override bool KeepRoleOnDeath { get; set; } = false; - public override bool KeepRoleOnChangingRole { get; set; } = false; - - public override float SpawnChance { get; set; } = 100; - public override Vector3 Scale { get; set; } = new Vector3(0.1f, 1, 1); - } -} diff --git a/KruacentExiled/KE.CustomRoles/CR/SCP/SCP457.cs b/KruacentExiled/KE.CustomRoles/CR/SCP/SCP457.cs deleted file mode 100644 index b37d0f90..00000000 --- a/KruacentExiled/KE.CustomRoles/CR/SCP/SCP457.cs +++ /dev/null @@ -1,250 +0,0 @@ -using Exiled.API.Features; -using Exiled.API.Features.Attributes; -using Exiled.API.Features.Doors; -using Exiled.API.Features.Roles; -using Exiled.API.Features.Toys; -using Exiled.API.Interfaces; -using Exiled.Events.EventArgs.Scp106; -using KE.CustomRoles.API.Features; -using KE.Utils.API; -using MEC; -using PlayerRoles; -using PlayerStatsSystem; -using System.Collections.Generic; -using System.Linq; -using UnityEngine; -using Light = Exiled.API.Features.Toys.Light; - -namespace KE.CustomRoles.CR.SCP -{ - [CustomRole(RoleTypeId.Scp106)] - public class SCP457 : CustomSCP - { - - - public override string Description { get; set; } = "You passive damage around you, and can lauch fireballs by pressing the stalk button"; - public override uint Id { get; set; } = 1084; - public override string PublicName { get; set; } = "SCP-457"; - public override int MaxHealth { get; set; } = 3900; - public override RoleTypeId Role { get; set; } = RoleTypeId.Scp106; - public override bool KeepRoleOnDeath { get; set; } = false; - public override bool KeepRoleOnChangingRole { get; set; } = false; - public override bool IsSupport { get; } = false; - - public override float SpawnChance { get; set; } = 100; - - private Dictionary _inside = new(); - private Dictionary> _handles = new(); - private Dictionary _activeBalls = new(); - - public static float DamageRefreshRate = 5f; - public static readonly Color FlameColor = new(2, 1.08f, 0); - private static readonly Color ballColor = new(2, 1.08f, 0, .25f); - public static readonly float VigorCost = .1f; - - private static readonly string _deathMessage = "Burned to death"; - public static CustomReasonDamageHandler BallDamage = new(_deathMessage, 25, string.Empty); - public const int MAX_BALLS = 2; - - protected override void RoleAdded(Player player) - { - Log.Debug("adding role 457"); - _inside.Add(player, null); - _handles.Add(player, new()); - _activeBalls.Add(player, 0); - - _handles[player].Add(Timing.RunCoroutine(InsideLight(player))); - _handles[player].Add(Timing.RunCoroutine(PassiveDamage(player))); - - } - - private IEnumerator InsideLight(Player player) - { - Light light = Light.Create(); - _inside[player] = light; - light.Position = player.Position; - light.Color = FlameColor; - light.Spawn(); - while (true) - { - light.Position = player.Position; - PassiveDamage(player); - yield return Timing.WaitForOneFrame; - } - } - - - - private IEnumerator PassiveDamage(Player scp) - { - while (true) - { - foreach (Player allP in Player.List.Where(p => p != scp && !p.IsScp)) - { - - - if (OtherUtils.IsInCircle(allP.Position, scp.Position, 5)) - { - - Physics.Linecast(allP.Position, scp.Position, out var hitinfo); - float damage = -(hitinfo.distance / 3) + 10; - Log.Debug($"damâge={damage} dist = {hitinfo.distance}"); - allP.EnableEffect(Exiled.API.Enums.EffectType.Burned, DamageRefreshRate, true); - allP.Hurt(damage, _deathMessage); - - - } - } - yield return Timing.WaitForSeconds(DamageRefreshRate); - } - - } - - protected override void RoleRemoved(Player player) - { - Log.Debug("remove role 457"); - - - if (_inside.TryGetValue(player, out var l)) - { - l.Destroy(); - _inside.Remove(player); - } - - if (_activeBalls.TryGetValue(player, out var b)) - { - _activeBalls.Remove(player); - } - - - - - - if (_handles.TryGetValue(player, out var handle)) - { - foreach (var c in handle) - { - Timing.KillCoroutines(c); - } - _handles.Remove(player); - } - - } - - private void Attack(Player player, Scp106Role role) - { - - if (role.Vigor > VigorCost && _activeBalls[player] < MAX_BALLS) - { - _activeBalls[player]++; - Timing.RunCoroutine(LaunchingAttack(player)); - role.Vigor -= VigorCost; - } - - } - - private IEnumerator LaunchingAttack(Player player) - { - Vector3 initpos = player.Position; - Quaternion direction = player.ReferenceHub.PlayerCameraReference.rotation; - - - Log.Debug(direction.eulerAngles); - bool attackTouchedSomething = false; - - Light light = Light.Create(initpos, direction.eulerAngles,null,false); - light.Color = ballColor; - light.Intensity = 1f; - Primitive primitive = Primitive.Create(initpos, direction.eulerAngles, null, false); - primitive.Collidable = false; - primitive.Color = ballColor; - primitive.Spawn(); - light.Spawn(); - Vector3 nextPos; - - int fallback = 100; - while (!attackTouchedSomething && fallback > 0) - { - nextPos = primitive.Position + primitive.Rotation * new Vector3(0, 0, 1f); - RaycastHit hit; - - if (Physics.Linecast(primitive.Position, nextPos, out hit)) - { - //spawn mtf looking at central gate - if (hit.collider.gameObject.name != "VolumeOverrideTunnel") - { - attackTouchedSomething = true; - } - - Player playerhit = Player.Get(hit.collider); - if (playerhit != null && playerhit.Role.Side != Exiled.API.Enums.Side.Scp) - { - playerhit.Hurt(BallDamage); - player.ShowHitMarker(); - - } - - Door doorhit = Door.Get(hit.collider.gameObject); - if (doorhit != null && doorhit is IDamageableDoor damageable && !damageable.IsDestroyed) - { - damageable.Break(); - player.ShowHitMarker(); - } - } - - - - - Log.Debug($"current pos = {primitive.Position} next pos = {nextPos}"); - yield return Timing.WaitForSeconds(.1f); - primitive.Position = nextPos; - light.Position = nextPos; - fallback--; - } - _activeBalls[player]--; - primitive.Destroy(); - light.Destroy(); - } - - - private void OnStalking(StalkingEventArgs ev) - { - if (!Check(ev.Player)) return; - ev.IsAllowed = false; - - Attack(ev.Player, ev.Scp106); - } - - private void OnTP(TeleportingEventArgs ev) - { - if (!Check(ev.Player)) return; - ev.IsAllowed = false; - - } - - private void OnAttacking(AttackingEventArgs ev) - { - if (!Check(ev.Player)) return; - ev.IsAllowed = false; - - } - - protected override void SubscribeEvents() - { - Exiled.Events.Handlers.Scp106.Stalking += OnStalking; - Exiled.Events.Handlers.Scp106.Teleporting += OnTP; - Exiled.Events.Handlers.Scp106.Attacking += OnAttacking; - base.SubscribeEvents(); - - } - - protected override void UnsubscribeEvents() - { - Exiled.Events.Handlers.Scp106.Stalking -= OnStalking; - Exiled.Events.Handlers.Scp106.Teleporting -= OnTP; - Exiled.Events.Handlers.Scp106.Attacking -= OnAttacking; - base.UnsubscribeEvents(); - } - - } -} diff --git a/KruacentExiled/KE.CustomRoles/CR/SCP/Small.cs b/KruacentExiled/KE.CustomRoles/CR/SCP/Small.cs deleted file mode 100644 index 019eb568..00000000 --- a/KruacentExiled/KE.CustomRoles/CR/SCP/Small.cs +++ /dev/null @@ -1,22 +0,0 @@ -using Exiled.API.Features.Attributes; -using Exiled.CustomRoles.API.Features; -using KE.CustomRoles.API.Features; -using PlayerRoles; -using UnityEngine; - -namespace KE.CustomRoles.CR.SCP -{ - [CustomRole(RoleTypeId.None)] - public class Small : GlobalCustomRole - { - public override string Description { get; set; } = "u smoll"; - public override uint Id { get; set; } = 1047; - public override SideEnum Side { get; set; } = SideEnum.SCP; - public override string PublicName { get; set; } = "Small"; - public override bool KeepRoleOnDeath { get; set; } = false; - public override bool KeepRoleOnChangingRole { get; set; } = false; - - public override float SpawnChance { get; set; } = 100; - public override Vector3 Scale { get; set; } = new Vector3(1, .75f, 1); - } -} diff --git a/KruacentExiled/KE.CustomRoles/CR/SCP/Tall.cs b/KruacentExiled/KE.CustomRoles/CR/SCP/Tall.cs deleted file mode 100644 index 9bcee936..00000000 --- a/KruacentExiled/KE.CustomRoles/CR/SCP/Tall.cs +++ /dev/null @@ -1,35 +0,0 @@ -using Exiled.API.Features; -using Exiled.API.Features.Attributes; -using KE.CustomRoles.API.Features; -using PlayerRoles; -using System.Linq; -using UnityEngine; - -namespace KE.CustomRoles.CR.SCP -{ - /*[CustomRole(RoleTypeId.None)] - public class Tall : GlobalCustomRole - { - public override string Description { get; set; } = "u tall"; - public override uint Id { get; set; } = 1049; - public override string PublicName { get; set; } = "Tall"; - public override bool KeepRoleOnDeath { get; set; } = false; - public override bool KeepRoleOnChangingRole { get; set; } = false; - public override float MaxHealthMultiplicator { get; set; } = 1.1f; - public override float SpawnChance { get; set; } = 100; - public override SideEnum Side { get; set; } = SideEnum.SCP; - public new Vector3 Scale { get; set; } = new(1, 1.3f, 1); - public Vector3 BaseScale => Vector3.one; - protected override void RoleAdded(Player player) - { - player.SetFakeScale(Scale, Player.List.Where(p => p != player)); - - - } - - protected override void RoleRemoved(Player player) - { - player.SetFakeScale(BaseScale, Player.List.Where(p => p != player)); - } - }*/ -} diff --git a/KruacentExiled/KE.CustomRoles/CR/SCP/Ultra.cs b/KruacentExiled/KE.CustomRoles/CR/SCP/Ultra.cs deleted file mode 100644 index 8be0a51e..00000000 --- a/KruacentExiled/KE.CustomRoles/CR/SCP/Ultra.cs +++ /dev/null @@ -1,73 +0,0 @@ -using Exiled.API.Enums; -using Exiled.API.Features; -using Exiled.API.Features.Attributes; -using KE.CustomRoles.API.Features; -using MEC; -using PlayerRoles; -using System; -using System.Collections.Generic; -using System.Linq; - -namespace KE.CustomRoles.CR.SCP -{ - [CustomRole(RoleTypeId.None)] - public class Ultra : GlobalCustomRole - { - private static Dictionary _handles = new(); - public override SideEnum Side { get; set; } = SideEnum.SCP; - public override string Description { get; set; } = "You can sense where people are located"; - public override uint Id { get; set; } = 1079; - public override string PublicName { get; set; } = "Ultra"; - public override bool KeepRoleOnDeath { get; set; } = false; - public override bool KeepRoleOnChangingRole { get; set; } = false; - public override float MaxHealthMultiplicator { get; set; } = 1f; - public override float SpawnChance { get; set; } = 100; - public const float RefreshRate = 20; - public const int SizeText = 20; - protected override void RoleAdded(Player player) - { - _handles.Add(player, Timing.RunCoroutine(DisplayInfos(player))); - } - - protected override void RoleRemoved(Player player) - { - Timing.KillCoroutines(_handles[player]); - _handles.Remove(player); - } - - - - private IEnumerator DisplayInfos(Player player) - { - - while (true) - { - Log.Debug("Ultra : showing"); - ShowEffectHint(player, PlayerInZone()); - yield return Timing.WaitForSeconds(RefreshRate); - } - } - - - private string PlayerInZone() - { - string result = $""; - int nbPlayer; - foreach (ZoneType zone in Enum.GetValues(typeof(ZoneType))) - { - nbPlayer = GetPlayerInZone(zone); - if (nbPlayer > 0 || MainPlugin.Instance.Config.Debug) - { - result += zone.ToString() + " : " + nbPlayer + "\n"; - } - } - result += ""; - return result; - } - - private int GetPlayerInZone(ZoneType zone) - { - return Player.List.Count(p => !p.IsScp && p.Zone == zone); - } - } -} diff --git a/KruacentExiled/KE.CustomRoles/CR/SCP/ZombieDoorman.cs b/KruacentExiled/KE.CustomRoles/CR/SCP/ZombieDoorman.cs deleted file mode 100644 index f02f6d92..00000000 --- a/KruacentExiled/KE.CustomRoles/CR/SCP/ZombieDoorman.cs +++ /dev/null @@ -1,40 +0,0 @@ -using Exiled.API.Features; -using Exiled.API.Features.Attributes; -using Exiled.CustomRoles.API.Features; -using KE.CustomRoles.Abilities; -using PlayerRoles; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace KE.CustomRoles.CR.SCP -{ - [CustomRole(RoleTypeId.Scp0492)] - internal class ZombieDoorman : CustomRole - { - public override string Name { get; set; } = "SCP-049-2-Door"; - public override string Description { get; set; } = "U can open lock door with ur ability clapclapclap"; - public override uint Id { get; set; } = 1053; - public override string CustomInfo { get; set; } = "SCP-049-2-Door"; - public override int MaxHealth { get; set; } = 400; - public override RoleTypeId Role { get; set; } = RoleTypeId.Scp0492; - public override bool KeepRoleOnDeath { get; set; } = false; - public override bool KeepRoleOnChangingRole { get; set; } = false; - public override bool IgnoreSpawnSystem { get; set; } = true; - - public override float SpawnChance { get; set; } = 100; - - - protected override void RoleAdded(Player player) - { - Log.Debug("adding 0493dror"); - } - - protected override void RoleRemoved(Player player) - { - Log.Debug("removing 0493dror"); - } - } -} diff --git a/KruacentExiled/KE.CustomRoles/CR/Scientist/GambleAddict.cs b/KruacentExiled/KE.CustomRoles/CR/Scientist/GambleAddict.cs deleted file mode 100644 index 65503a3f..00000000 --- a/KruacentExiled/KE.CustomRoles/CR/Scientist/GambleAddict.cs +++ /dev/null @@ -1,36 +0,0 @@ -using Exiled.API.Features.Attributes; -using Exiled.CustomRoles.API.Features; -using KE.CustomRoles.Abilities; -using KE.CustomRoles.API.Features; -using PlayerRoles; -using System; -using System.Collections.Generic; -using UnityEngine; - -namespace KE.CustomRoles.CR.Scientist -{ - [CustomRole(RoleTypeId.Scientist)] - public class GambleAddict : KECustomRole - { - public override string Description { get; set; } = "Tu es un Gamble Addict \nT'as trade ton kit et ta carte contre 2 pièces \nfais en bon usage"; - public override uint Id { get; set; } = 1043; - public override string PublicName { get; set; } = "Gamble Addict"; - public override int MaxHealth { get; set; } = 100; - public override RoleTypeId Role { get; set; } = RoleTypeId.Scientist; - public override bool KeepRoleOnDeath { get; set; } = false; - public override bool KeepRoleOnChangingRole { get; set; } = false; - - public override float SpawnChance { get; set; } = 100; - - public override List Inventory { get; set; } = new List() - { - $"{ItemType.Coin}", - $"{ItemType.Coin}", - }; - - public override HashSet Abilities { get; } = new() - { - 2002 - }; - } -} diff --git a/KruacentExiled/KE.CustomRoles/CR/Scientist/ZoneManager.cs b/KruacentExiled/KE.CustomRoles/CR/Scientist/ZoneManager.cs deleted file mode 100644 index b14f6789..00000000 --- a/KruacentExiled/KE.CustomRoles/CR/Scientist/ZoneManager.cs +++ /dev/null @@ -1,119 +0,0 @@ -using Exiled.API.Enums; -using Exiled.API.Features; -using Exiled.API.Features.Attributes; -using Exiled.API.Features.Doors; -using Exiled.API.Features.Items; -using Exiled.API.Features.Spawn; -using Exiled.Events.EventArgs.Player; -using InventorySystem.Items.Keycards; -using KE.CustomRoles.API.Features; -using PlayerRoles; -using System.Collections.Generic; -using System.Linq; -using UnityEngine; - -namespace KE.CustomRoles.CR.Scientist -{ - [CustomRole(RoleTypeId.Scientist)] - internal class ZoneManager : KECustomRole - { - public override string Description { get; set; } = "Incroyable tu peux avoir une promotion alors fais ton boulot et ouvre tous ces checkpoint et tu pourras sortir d'ici"; - public override uint Id { get; set; } = 1044; - public override string PublicName { get; set; } = "Zone Manager"; - public override int MaxHealth { get; set; } = 100; - public override RoleTypeId Role { get; set; } = RoleTypeId.Scientist; - public override bool KeepRoleOnDeath { get; set; } = false; - public override bool KeepRoleOnChangingRole { get; set; } = false; - - - public override float SpawnChance { get; set; } = 100; - - public override SpawnProperties SpawnProperties { get; set; } = new SpawnProperties() - { - DynamicSpawnPoints = new List() - { - new DynamicSpawnPoint() - { - Location = SpawnLocationType.InsideHidLab, - Chance = 100, - } - } - }; - - public override List Inventory { get; set; } = new List() - { - $"{ItemType.Medkit}", - $"{ItemType.Adrenaline}", - $"{ItemType.KeycardZoneManager}" - }; - public static readonly List DoorToOpen = new() - { - DoorType.CheckpointLczA, - DoorType.CheckpointLczB, - DoorType.CheckpointEzHczA, - DoorType.CheckpointEzHczB - }; - - - private static Dictionary> objectives = new(); - private static Dictionary flag = new(); - - protected override void SubscribeEvents() - { - - Exiled.Events.Handlers.Player.InteractingDoor += OnInteractingDoor; - base.SubscribeEvents(); - } - - protected override void UnsubscribeEvents() - { - Exiled.Events.Handlers.Player.InteractingDoor -= OnInteractingDoor; - base.UnsubscribeEvents(); - } - - protected override void RoleAdded(Player player) - { - objectives.Add(player, new(DoorToOpen)); - flag.Add(player, false); - } - protected override void RoleRemoved(Player player) - { - objectives.Remove(player); - flag.Remove(player); - } - - - private void OnInteractingDoor(InteractingDoorEventArgs ev) - { - Player player = ev.Player; - if (!Check(player)) return; - objectives[player].Remove(ev.Door.Type); - - if (CheckDoors(player)) - { - bool equipped = player.CurrentItem.Type == ItemType.KeycardFacilityManager; - Item zoneKeycard = player.Items.Where(p => p.Type == ItemType.KeycardFacilityManager).ElementAtOrDefault(0); - if (zoneKeycard != null) - { - zoneKeycard.Destroy(); - } - - player.AddItem(ItemType.Radio); - flag[player] = true; - Item engineerKeycard = player.AddItem(ItemType.KeycardFacilityManager); - if (equipped) - { - player.CurrentItem = engineerKeycard; - } - } - - } - - private bool CheckDoors(Player p) - { - if (flag[p]) return false; - return objectives[p].Count == 0; - } - - } -} diff --git a/KruacentExiled/KE.CustomRoles/Config.cs b/KruacentExiled/KE.CustomRoles/Config.cs deleted file mode 100644 index 49e36023..00000000 --- a/KruacentExiled/KE.CustomRoles/Config.cs +++ /dev/null @@ -1,18 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using Exiled.API.Interfaces; - -namespace KE.CustomRoles -{ - public class Config : IConfig - { - public bool IsEnabled { get; set; } = true; - public bool Debug { get; set; } = true; - - public int HeaderId { get; set; } = 1000; - public int ScpPreferenceHeaderId { get; set; } = 10000; - } -} diff --git a/KruacentExiled/KE.CustomRoles/KE.CustomRoles.csproj b/KruacentExiled/KE.CustomRoles/KE.CustomRoles.csproj deleted file mode 100644 index 20d05e3f..00000000 --- a/KruacentExiled/KE.CustomRoles/KE.CustomRoles.csproj +++ /dev/null @@ -1,30 +0,0 @@ - - - 13.0 - net48 - - - - - - - - - - - - - - - - - - - - if not "$(EXILED_DEV_REFERENCES)"=="" copy /y "$(OutputPath)$(AssemblyName).dll" "$(EXILED_DEV_REFERENCES)\Plugins\" - - - if [[ ! -z "$EXILED_DEV_REFERENCES" ]]; then cp "$(OutputPath)$(AssemblyName).dll" "$EXILED_DEV_REFERENCES/Plugins/"; fi - - - diff --git a/KruacentExiled/KE.CustomRoles/MainPlugin.cs b/KruacentExiled/KE.CustomRoles/MainPlugin.cs deleted file mode 100644 index 2487ef26..00000000 --- a/KruacentExiled/KE.CustomRoles/MainPlugin.cs +++ /dev/null @@ -1,87 +0,0 @@ -using Exiled.API.Features; -using Exiled.API.Features.Core.UserSettings; -using Exiled.API.Interfaces; -using Exiled.CustomRoles.API.Features; -using Exiled.Events.EventArgs.Server; -using HarmonyLib; -using KE.CustomRoles.API.Features; -using KE.CustomRoles.Settings; -using KE.Utils.API.Displays.DisplayMeow; -using MEC; -using Microsoft.Win32; -using System; -using System.Linq; - - -namespace KE.CustomRoles -{ - public class MainPlugin : Plugin - { - public override string Name => "KE.CustomRoles"; - public override string Prefix => "KE.CR"; - public override string Author => "Patrique & OmerGS"; - public override Version Version => new(1, 1, 0); - public static MainPlugin Instance; - public static Config Configs => Instance?.Config; - public static readonly HintPlacement CRHint = new(0, 750); - public static readonly HintPlacement CREffect = new(700, 300); - public static readonly HintPlacement Abilities = new(0, 950,HintServiceMeow.Core.Enum.HintAlignment.Left); - public static Translations Translations => Instance?.Translation; - private SettingHandler _settingHandler; - internal static SettingHandler SettingHandler => Instance?._settingHandler; - - private Harmony Harmony; - - public override void OnEnabled() - { - - Instance = this; - _settingHandler = new(); - - Harmony = new(Name); - Harmony.PatchAll(); - SettingHandler.SubscribeEvents(); - KEAbilities.Register(Assembly); - CustomRole.RegisterRoles(false,null,true,Assembly); - SubscribeEvents(); - - } - - public override void OnDisabled() - { - - CustomRole.UnregisterRoles(); - SettingHandler.UnsubscribeEvents(); - Harmony.UnpatchAll(); - - CustomAbility.UnregisterAbilities(); - KEAbilities.Unregister(); - UnsubscribeEvents(); - _settingHandler = null; - Instance = null; - } - - public void SubscribeEvents() - { - Exiled.Events.Handlers.Server.RoundStarted += CustomRoleImplement; - Exiled.Events.Handlers.Server.RespawnedTeam += CustomRoleRespawning; - } - public void UnsubscribeEvents() - { - Exiled.Events.Handlers.Server.RoundStarted -= CustomRoleImplement; - Exiled.Events.Handlers.Server.RespawnedTeam -= CustomRoleRespawning; - - } - - public void CustomRoleImplement() - { - KECustomRole.GiveRole(Player.List); - - } - - public void CustomRoleRespawning(RespawnedTeamEventArgs ev) - { - KECustomRole.GiveRole(ev.Players); - } - } -} diff --git a/KruacentExiled/KE.CustomRoles/Patches/ActiveAbilityPatches.cs b/KruacentExiled/KE.CustomRoles/Patches/ActiveAbilityPatches.cs deleted file mode 100644 index 7a717da6..00000000 --- a/KruacentExiled/KE.CustomRoles/Patches/ActiveAbilityPatches.cs +++ /dev/null @@ -1,39 +0,0 @@ -using Exiled.API.Features; -using Exiled.CustomRoles.API.Features; -using HarmonyLib; -using KE.Utils.API.Displays.DisplayMeow; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace KE.CustomRoles.Patches -{ - public static class ActiveAbilityPatches - { - [HarmonyPatch(typeof(ActiveAbility),nameof(ActiveAbility.UseAbility))] - public static class UseAbilityPatch - { - public static void Prefix(ActiveAbility __instance, Player player) - { - string msg = "Using "+__instance.Name; - - DisplayHandler.Instance.AddHint(MainPlugin.Abilities, player, msg, 5); - } - } - [HarmonyPatch(typeof(ActiveAbility), nameof(ActiveAbility.SelectAbility))] - public static class SelectAbilityPatch - { - public static void Prefix(ActiveAbility __instance, Player player) - { - string msg = __instance.Name + "\n" + __instance.Description; - - DisplayHandler.Instance.AddHint(MainPlugin.Abilities, player, msg, 5); - } - } - - - - } -} diff --git a/KruacentExiled/KE.CustomRoles/Patches/FpcMotorPatches.cs b/KruacentExiled/KE.CustomRoles/Patches/FpcMotorPatches.cs deleted file mode 100644 index 59e4c427..00000000 --- a/KruacentExiled/KE.CustomRoles/Patches/FpcMotorPatches.cs +++ /dev/null @@ -1,41 +0,0 @@ -using HarmonyLib; -using PlayerRoles.FirstPersonControl; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using UnityEngine; - -namespace KE.CustomRoles.Patches -{ - public static class FpcMotorPatches - { - //me when slowness 200 - - //[HarmonyPatch(typeof(FpcMotor),nameof(FpcMotor.DesiredMove),MethodType.Getter)] - public static class DesiredMovePatch - { - [HarmonyPostfix] - public static void Postfix(FpcMotor __instance,ref Vector3 __result) - { - __result = new(__result.x * -1, __result.y, __result.z * -1); - } - - - } - - //[HarmonyPatch(typeof(FpcMotor), nameof(FpcMotor.GetFrameMove), MethodType.Normal)] - public static class GetFrameMovePatch - { - [HarmonyPostfix] - public static void Postfix(FpcMotor __instance, ref Vector3 __result) - { - __result = new(__result.x * -1, __result.y, __result.z * -1); - } - - - } - - } -} diff --git a/KruacentExiled/KE.CustomRoles/Settings/SettingHandler.cs b/KruacentExiled/KE.CustomRoles/Settings/SettingHandler.cs deleted file mode 100644 index 1088088b..00000000 --- a/KruacentExiled/KE.CustomRoles/Settings/SettingHandler.cs +++ /dev/null @@ -1,230 +0,0 @@ -using Exiled.API.Features; -using Exiled.API.Features.Core.UserSettings; -using Exiled.Events.EventArgs.Player; -using KE.CustomRoles.API.Features; -using KE.Utils.API.Interfaces; -using System; -using System.Collections.Generic; -using UserSettings.ServerSpecific; - -namespace KE.CustomRoles.Settings -{ - internal class SettingHandler : IUsingEvents - { - private int _idHeader = 148; - private int _idTimeCustomRole = 144; - private int _idDesc = 143; - private int _idMode = 145; - private int _idDown = 149; - private int _idUp = 150; - private int _idSelect = 151; - private int _idArrow = 152; - - - - public static event Action DownPressed = delegate { }; - public static event Action UpPressed = delegate { }; - - public static SettingHandler Instance { get; private set; } - private List settings; - public const string baseArrow = "<--"; - public SettingHandler() - { - Instance = this; - settings = new List() - { - new HeaderSetting (_idHeader,"Custom Roles Settings"), - new TwoButtonsSetting(_idDesc,"Descriptions","Disabled","Enabled",true,"hide/show the description the Custom Role "), - new SliderSetting(_idTimeCustomRole,"Time shown",0,30,20), - new TwoButtonsSetting(_idMode,"Mode","Keybinds","Select wheel",true,onChanged:OnChanged), - new KeybindSetting(_idUp, "Select up", UnityEngine.KeyCode.None,hintDescription:"only work in Select Wheel mode"), - new KeybindSetting(_idDown, "Select down", UnityEngine.KeyCode.None,hintDescription:"only work in Select Wheel mode"), - new KeybindSetting(_idSelect, "Use selected ability", UnityEngine.KeyCode.None,hintDescription:"only work in Select Wheel mode"), - //this crashes the player idk why - //new UserTextInputSetting(_idArrow, "Personalize the arrow next to the selected ability",hintDescription:"only work in Select Wheel mode",placeHolder:baseArrow,onChanged:OnChangedArrow), - }; - } - - public void OnChanged(Player player, SettingBase setting) - { - - try - { - if (GetMode(player)) - { - KEAbilities.RemoveAllSelect(player); - } - else - { - KEAbilities.SelectFirstAbility(player); - } - } - catch(Exception e) - { - Log.Error(e); - } - - - } - - public void OnChangedArrow(Player player, SettingBase setting) - { - KEAbilities.UpdateGUI(player); - } - - public void SubscribeEvents() - { - SettingBase.Register(settings); - ServerSpecificSettingsSync.ServerOnSettingValueReceived += SafeOnSettingValueReceived; - Exiled.Events.Handlers.Player.Verified += OnVerified; - DownPressed += Down; - UpPressed += Up; - - } - - public void UnsubscribeEvents() - { - Exiled.Events.Handlers.Player.Verified -= OnVerified; - ServerSpecificSettingsSync.ServerOnSettingValueReceived -= SafeOnSettingValueReceived; - DownPressed -= Down; - UpPressed -= Up; - SettingBase.Unregister(predicate:null, settings); - } - - - private void SafeOnSettingValueReceived(ReferenceHub hub, ServerSpecificSettingBase settingBase) - { - //not catching the exception will desync & kick the player - try - { - OnSettingValueReceived(Player.Get(hub), settingBase); - } - catch (Exception e) - { - Log.Error(e); - } - } - - private void OnSettingValueReceived(Player player, ServerSpecificSettingBase settingBase) - { - if (KEAbilities.CheckPressed(settingBase, _idDown)) - { - DownPressed?.Invoke(player); - } - - if (KEAbilities.CheckPressed(settingBase, _idUp)) - { - UpPressed?.Invoke(player); - } - - if (KEAbilities.CheckPressed(settingBase, _idSelect)) - { - KEAbilities.UseSelected(player); - } - - } - - private Dictionary playerPos = new(); - - private void Up(Player player) - { - if(KEAbilities.PlayersAbility.TryGetValue(player,out var list)) - { - if (list.Count == 0) - { - return; - } - if (!playerPos.ContainsKey(player)) - { - playerPos.Add(player, 0); - } - - int index = mod((playerPos[player] - 1),list.Count); - Log.Debug("up "+ index); - KEAbilities ability = list[index]; - playerPos[player] += -1; - - - ability?.SelectAbility(player); - KEAbilities.UpdateGUI(player); - } - } - - private int mod(int x, int m) - { - return (x % m + m) % m; - } - - private void Down(Player player) - { - if (KEAbilities.PlayersAbility.TryGetValue(player, out var list)) - { - if(list.Count == 0) - { - return; - } - - if (!playerPos.ContainsKey(player)) - { - playerPos.Add(player, 0); - } - - - int index = mod((playerPos[player] + 1), list.Count); - Log.Debug("down " + index); - KEAbilities ability = list[index]; - playerPos[player] += 1; - ability?.SelectAbility(player); - KEAbilities.UpdateGUI(player); - } - } - - - - - - private void OnVerified(VerifiedEventArgs ev) - { - ServerSpecificSettingsSync.SendToPlayer(ev.Player.ReferenceHub); - } - - /// - /// - /// - /// - /// true if keybinds mode is activated ; false otherwise - internal bool GetMode(Player p) - { - if (!SettingBase.TryGetSetting(p, _idMode, out var setting)) return setting.IsSecondDefault; - - return setting.IsFirst; - } - - - internal string GetArrow(Player p) - { - if (!SettingBase.TryGetSetting(p, _idArrow, out var setting)) return baseArrow; - - return setting.Text; - - } - internal float GetTime(Player p) - { - if (!SettingBase.TryGetSetting(p, _idTimeCustomRole, out var setting)) return 20; - return setting.SliderValue; - } - - - /// - /// - /// - /// - /// true if the player wants description ; false otherwise - internal bool GetDescriptionsSettings(Player p) - { - if (!SettingBase.TryGetSetting(p, _idDesc, out var setting)) return true; - return setting.IsSecond; - } - - } -} diff --git a/KruacentExiled/KE.CustomRoles/Translations.cs b/KruacentExiled/KE.CustomRoles/Translations.cs deleted file mode 100644 index bb08f730..00000000 --- a/KruacentExiled/KE.CustomRoles/Translations.cs +++ /dev/null @@ -1,41 +0,0 @@ -using Exiled.API.Interfaces; -using System; -using System.Collections.Generic; -using System.ComponentModel; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace KE.CustomRoles -{ - public class Translations : ITranslation - { - public string GettingNewRole { get; set; } = "%Name%\n %Desc%"; - - - [Description("Russe (1050)")] - public string RusseDesc { get; set; } = "Tu es unmaitre de jeu \nyou should play russian roulette with the others"; - public string RussePublicName { get; set; } = "Russian"; - - - [Description("DBoyInShape (1058)")] - public string InShapeDesc { get; set; } = "Dammmmnnnnnnn les gates"; // aucune idée comment traduire ça - public string InShapePublicName { get; set; } = "DBoyInShape"; - - - [Description("Enfant (1041)")] - public string EnfantDesc { get; set; } = "You are a Kid \ndo not the kid \nyou start with a rainbow candy (in theory) \n you're a bit smaller"; - public string EnfantPublicName { get; set; } = "kid"; - - - [Description("Mime (1053)")] - public string MimePublicName { get; set; } = "Mime"; - - - [Description("ChiefGuard (1046)")] - public string ChiefGuardPublicName { get; set; } = "Chief Guard"; - public string ChiefGuardDesc { get; set; } = "Tu es un Chef des gardes du site \nT'as une carte de private \net un crossvec"; - - - } -} From dfe29a0abbbb2575aa8beb48398b300b5d906a66 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Sun, 25 Jan 2026 12:57:26 +0100 Subject: [PATCH 543/853] removed the last target message when a scp dies --- .../KE.Misc/Features/LastHuman/LastHumanHandler.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/KruacentExiled/KE.Misc/Features/LastHuman/LastHumanHandler.cs b/KruacentExiled/KE.Misc/Features/LastHuman/LastHumanHandler.cs index bf48dc48..9bd1c78f 100644 --- a/KruacentExiled/KE.Misc/Features/LastHuman/LastHumanHandler.cs +++ b/KruacentExiled/KE.Misc/Features/LastHuman/LastHumanHandler.cs @@ -1,4 +1,5 @@ -using Exiled.API.Features; +using Exiled.API.Extensions; +using Exiled.API.Features; using Exiled.Events.EventArgs.Player; using Exiled.Events.EventArgs.Scp106; using HintServiceMeow.Core.Models.Hints; @@ -49,6 +50,9 @@ private void OnChangedRole(PlayerChangedRoleEventArgs ev) if (Round.ElapsedTime.TotalSeconds < 10) return; + if (ev.OldRole.IsScp()) return; + + if(TryGetLastTarget(out Player player)) { AbstractHint hint = DisplayHandler.Instance.GetHint(player, position.HintPlacement); From 5494909ba3a03df7c77bac7332cccf0fee7240d2 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Sun, 25 Jan 2026 13:02:36 +0100 Subject: [PATCH 544/853] removed autonpc079 --- .../Features/Auto079/Danger/DangerLevels.cs | 82 ------------ .../KE.Misc/Features/Auto079/Jobs/Job.cs | 34 ----- .../Features/Auto079/Jobs/JoeManager.cs | 119 ------------------ .../Features/Auto079/Jobs/LiberateScp.cs | 33 ----- .../KE.Misc/Features/Auto079/Jobs/ScanZone.cs | 119 ------------------ .../Features/Auto079/Jobs/StuckWithScp.cs | 37 ------ .../KE.Misc/Features/Auto079/NPC079.cs | 77 ------------ .../KE.Misc/Handlers/ServerHandler.cs | 9 -- 8 files changed, 510 deletions(-) delete mode 100644 KruacentExiled/KE.Misc/Features/Auto079/Danger/DangerLevels.cs delete mode 100644 KruacentExiled/KE.Misc/Features/Auto079/Jobs/Job.cs delete mode 100644 KruacentExiled/KE.Misc/Features/Auto079/Jobs/JoeManager.cs delete mode 100644 KruacentExiled/KE.Misc/Features/Auto079/Jobs/LiberateScp.cs delete mode 100644 KruacentExiled/KE.Misc/Features/Auto079/Jobs/ScanZone.cs delete mode 100644 KruacentExiled/KE.Misc/Features/Auto079/Jobs/StuckWithScp.cs delete mode 100644 KruacentExiled/KE.Misc/Features/Auto079/NPC079.cs diff --git a/KruacentExiled/KE.Misc/Features/Auto079/Danger/DangerLevels.cs b/KruacentExiled/KE.Misc/Features/Auto079/Danger/DangerLevels.cs deleted file mode 100644 index e2c78bf3..00000000 --- a/KruacentExiled/KE.Misc/Features/Auto079/Danger/DangerLevels.cs +++ /dev/null @@ -1,82 +0,0 @@ -using Exiled.API.Features.Items; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace KE.Misc.Features.Auto079.Danger -{ - public class DangerLevels - { - - public int Danger { get; } - - public IReadOnlyCollection Items { get; } - - - private DangerLevels(int danger, List items) - { - Danger = danger; - Items = items; - } - - - - public static DangerLevels GetDanger(List items) - { - int danger = 0; - - foreach(Item item in items) - { - danger += GetDangerItem(item); - } - - return new(danger, items); - - } - - public static int GetDangerItem(Item item) - { - int danger = 0; - - - if (item.IsFirearm) - { - danger += 2; - } - - if(item is MicroHid) - { - danger += 5; - } - - if(item is Jailbird) - { - danger += 3; - } - - - - switch (item.Type) - { - case ItemType.SCP207: - case ItemType.AntiSCP207: - danger += 2; - break; - case ItemType.ParticleDisruptor: - danger += 3; - break; - case ItemType.SCP018: - danger += 4; - break; - } - - - - return danger; - - - } - } -} diff --git a/KruacentExiled/KE.Misc/Features/Auto079/Jobs/Job.cs b/KruacentExiled/KE.Misc/Features/Auto079/Jobs/Job.cs deleted file mode 100644 index 0f547a63..00000000 --- a/KruacentExiled/KE.Misc/Features/Auto079/Jobs/Job.cs +++ /dev/null @@ -1,34 +0,0 @@ -using Exiled.API.Features; -using MEC; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace KE.Misc.Features.Auto079.Jobs -{ - public abstract class Job - { - /// - /// The base waiting time between 2 actions - /// - public const float WaitTime = .5f; - protected NPC079 npc; - - public CoroutineHandle Start(NPC079 npc) - { - Log.Debug("job name " + this.GetType().Name); - this.npc = npc; - return Timing.RunCoroutine(Started()); - - - } - - - - protected abstract IEnumerator Started(); - - - } -} diff --git a/KruacentExiled/KE.Misc/Features/Auto079/Jobs/JoeManager.cs b/KruacentExiled/KE.Misc/Features/Auto079/Jobs/JoeManager.cs deleted file mode 100644 index 75de438b..00000000 --- a/KruacentExiled/KE.Misc/Features/Auto079/Jobs/JoeManager.cs +++ /dev/null @@ -1,119 +0,0 @@ -using Exiled.API.Features; -using Exiled.API.Features.Items; -using MEC; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace KE.Misc.Features.Auto079.Jobs -{ - public class JobManager - { - - private readonly List Queue = new(); - private readonly List PriorityQueue = new(); - public NPC079 npc; - - private CoroutineHandle loopHandle; - - - - - public Job defaultJob = new ScanZone(); - - - public JobManager(NPC079 npc) - { - this.npc = npc; - } - - - public void StartLoop() - { - Timing.RunCoroutineSingleton(QueueLoop(), loopHandle, SingletonBehavior.AbortAndUnpause); - } - private IEnumerator QueueLoop() - { - Log.Debug("loop : "+ npc.Npc.IsAlive); - while (npc.Npc.IsAlive) - { - Log.Debug("in loop"); - - CoroutineHandle handle; - Job currentJob = null; - bool prioQueue = PriorityQueue.Count > 0; - - if(prioQueue) - { - handle = PriorityQueueLoop(out currentJob); - } - else - { - handle = NormalQueue(out currentJob); - - } - - - yield return Timing.WaitUntilDone(handle); - if (currentJob is not null) - { - if (prioQueue) - { - PriorityQueue.Remove(currentJob); - } - else - { - Queue.Remove(currentJob); - - } - } - - } - } - - - - private CoroutineHandle NormalQueue(out Job currentJob) - { - bool gotJob = Queue.Count > 0; - currentJob = null; - CoroutineHandle handle; - - if (gotJob) - { - currentJob = Queue[0]; - - - handle = currentJob.Start(npc); - } - else - { - handle = defaultJob.Start(npc); - } - return handle; - } - - - private CoroutineHandle PriorityQueueLoop(out Job currentJob) - { - currentJob = PriorityQueue[0]; - return currentJob.Start(npc); - - } - - public void AddToQueue(Job job) - { - Queue.Add(job); - } - - - public void AddToPriorityQueue(Job job) - { - PriorityQueue.Add(job); - } - - - } -} diff --git a/KruacentExiled/KE.Misc/Features/Auto079/Jobs/LiberateScp.cs b/KruacentExiled/KE.Misc/Features/Auto079/Jobs/LiberateScp.cs deleted file mode 100644 index 5756af57..00000000 --- a/KruacentExiled/KE.Misc/Features/Auto079/Jobs/LiberateScp.cs +++ /dev/null @@ -1,33 +0,0 @@ -using Exiled.API.Features; -using Exiled.API.Features.Doors; -using MEC; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace KE.Misc.Features.Auto079.Jobs -{ - public class LiberateScp : Job - { - - protected override IEnumerator Started() - { - - var lockedDoors = npc.Scp.CurrentRoom.Doors.Where(d => !d.IsOpen && d.RequiredPermissions != Interactables.Interobjects.DoorUtils.DoorPermissionFlags.ScpOverride).ToList(); - - foreach(Door d in lockedDoors) - { - - int cost = (int)Math.Ceiling((float)(npc.Role.DoorStateChanger.GetCostForDoor(Interactables.Interobjects.DoorUtils.DoorAction.Opened,d.Base)) / 2); - Log.Debug($"opening door {d.Name} ({cost})"); - - yield return Timing.WaitUntilTrue(() => cost < npc.Role.Energy); - d.IsOpen = true; - } - - - } - } -} diff --git a/KruacentExiled/KE.Misc/Features/Auto079/Jobs/ScanZone.cs b/KruacentExiled/KE.Misc/Features/Auto079/Jobs/ScanZone.cs deleted file mode 100644 index 3e571bf1..00000000 --- a/KruacentExiled/KE.Misc/Features/Auto079/Jobs/ScanZone.cs +++ /dev/null @@ -1,119 +0,0 @@ -using CustomPlayerEffects; -using Exiled.API.Enums; -using Exiled.API.Extensions; -using Exiled.API.Features; -using Exiled.API.Features.Items; -using MEC; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Security.Policy; -using Utils.NonAllocLINQ; -using Camera = Exiled.API.Features.Camera; - -namespace KE.Misc.Features.Auto079.Jobs -{ - public class ScanZone : Job - { - - private Dictionary> InventoryGuess => npc.InventoryGuess; - - - protected override IEnumerator Started() - { - - //List zones = ZoneOrder(); - List zones = new List() - { - ZoneType.HeavyContainment - }; - - - - foreach (ZoneType zone in zones) - { - - foreach (Camera camera in Camera.Get(c => c.Zone == zone)) - { - int cost = (int)Math.Ceiling((float)(npc.Role.GetSwitchCost(camera)/2)); - Log.Debug($"trying to switch to cam {camera.Name} ({cost})"); - - yield return Timing.WaitUntilTrue(() => cost < npc.Role.Energy); - npc.Role.Energy -= cost; - npc.Role.Camera = camera; - - - - - List scanned = ScanRoom(camera); - - Log.Debug($"{npc.Role.Energy} / {npc.Role.MaxEnergy}"); - yield return Timing.WaitForSeconds(WaitTime); - - foreach(Player p in scanned) - { - if (InventoryGuess.ContainsKey(p)) - { - InventoryGuess.Add(p, new()); - } - InventoryGuess[p].Add(p.CurrentItem); - - } - - - PingPlayer(scanned.FirstOrDefault()); - - - } - - } - - - } - - - - public void PingPlayer(Player playerToPing) - { - if (playerToPing is null) return; - Log.Debug($"ping {playerToPing.NetId} at {playerToPing.Position}"); - npc.TryPing(playerToPing.Position, PingType.Human); - } - - - - - public List ScanRoom(Camera camera) - { - List playerFound = new(); - //todo add blind spots - // eg 75% chance to be spotted when under a cam - if (!camera.Room.Players.IsEmpty()) - { - playerFound.AddRange(camera.Room.Players.Where(p => !p.IsScp)); - } - return playerFound; - } - - private List ZoneOrder() - { - List result = new(); - - - result.Add(npc.Scp.Zone); - - if (!Map.IsLczDecontaminated) - { - result.AddIfNotContains(ZoneType.LightContainment); - } - result.AddIfNotContains(ZoneType.HeavyContainment); - result.AddIfNotContains(ZoneType.Entrance); - result.AddIfNotContains(ZoneType.Surface); - - - return result; - - } - - } -} diff --git a/KruacentExiled/KE.Misc/Features/Auto079/Jobs/StuckWithScp.cs b/KruacentExiled/KE.Misc/Features/Auto079/Jobs/StuckWithScp.cs deleted file mode 100644 index 82a0c987..00000000 --- a/KruacentExiled/KE.Misc/Features/Auto079/Jobs/StuckWithScp.cs +++ /dev/null @@ -1,37 +0,0 @@ -using Exiled.API.Features; -using MEC; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace KE.Misc.Features.Auto079.Jobs -{ - /*public class StuckWithScp : Job - { - - protected override IEnumerator Started() - { - - Room current = npc.Scp.CurrentRoom; - - List humanInSameRoom = current.Players.Where(p => !p.IsScp).ToList(); - - if (npc.MoveCamToScp()) - { - - } - - - } - - - private void EvaluateDanger() - { - - } - - - }*/ -} diff --git a/KruacentExiled/KE.Misc/Features/Auto079/NPC079.cs b/KruacentExiled/KE.Misc/Features/Auto079/NPC079.cs deleted file mode 100644 index a4a5a530..00000000 --- a/KruacentExiled/KE.Misc/Features/Auto079/NPC079.cs +++ /dev/null @@ -1,77 +0,0 @@ -using Exiled.API.Enums; -using Exiled.API.Extensions; -using Exiled.API.Features; -using Exiled.API.Features.Items; -using Exiled.API.Features.Roles; -using KE.Misc.Features.Auto079.Jobs; -using MEC; -using PlayerRoles; -using System.Collections.Generic; -using System.Linq; -using UnityEngine; -using Camera = Exiled.API.Features.Camera; -using NPCFeature = Exiled.API.Features.Npc; -namespace KE.Misc.Features.Auto079 -{ - public class NPC079 - { - public Npc Npc; - //the player that 079 will try to follow - public Player targetPlayer; - - public Player Scp; - - private JobManager JobManager; - public Scp079Role Role => Npc.Role.As(); - - public Dictionary> InventoryGuess = new(); - public NPC079() - { - Npc = Npc.Spawn("SCP-079-AI", RoleTypeId.Scp079); - Scp = Player.List.Where(p => p.IsScp && p.Role != RoleTypeId.Scp0492).FirstOrDefault(); - if (Scp is null) return; - - JobManager = new(this); - Scp079Role role = Npc.Role.As(); - - - Timing.CallDelayed(NPCFeature.SpawnSetRoleDelay, JobManager.StartLoop); - - - } - - - public bool TryPing(Vector3 position, PingType pingType = PingType.Default) - { - if (!Role.PingAbility.IsReady) - { - return false; - } - - Role.Ping(position, pingType,true); - return true; - - } - - - public bool MoveCamToScp() - { - Camera camera = Scp.CurrentRoom.Cameras.GetRandomValue(); - - int cost = Role.GetSwitchCost(camera); - - - if(cost > Role.Energy) - { - return false; - } - - Role.Energy -= cost; - Role.Camera = camera; - return true; - } - - - - } -} diff --git a/KruacentExiled/KE.Misc/Handlers/ServerHandler.cs b/KruacentExiled/KE.Misc/Handlers/ServerHandler.cs index 33a09f82..c8982920 100644 --- a/KruacentExiled/KE.Misc/Handlers/ServerHandler.cs +++ b/KruacentExiled/KE.Misc/Handlers/ServerHandler.cs @@ -14,7 +14,6 @@ namespace KE.Misc.Handlers { internal class ServerHandler { - NPC079 a; public void OnRoundStarted() { if (MainPlugin.Instance.Config.AutoElevator) @@ -54,14 +53,6 @@ public void OnRoundStarted() text.Spawn(basePos + Vector3.back); - - - - - - new NPC079(); - - foreach(Player p in Player.List.Where(p => !p.IsNPC)) { p.Teleport(RoomType.Hcz939); From cbeadfcebd1ebdbddbe35a928aa764e294714b0e Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Sun, 25 Jan 2026 13:27:54 +0100 Subject: [PATCH 545/853] damage modifier in customgrenade --- .../KE.Items/API/Features/KECustomGrenade.cs | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/KruacentExiled/KE.Items/API/Features/KECustomGrenade.cs b/KruacentExiled/KE.Items/API/Features/KECustomGrenade.cs index c82a979f..de94f81e 100644 --- a/KruacentExiled/KE.Items/API/Features/KECustomGrenade.cs +++ b/KruacentExiled/KE.Items/API/Features/KECustomGrenade.cs @@ -1,9 +1,11 @@ using Exiled.API.Features; using Exiled.API.Features.Pickups; +using Exiled.API.Features.Pickups.Projectiles; using Exiled.API.Features.Spawn; using Exiled.CustomItems.API.Features; using Exiled.Events.EventArgs.Map; using Exiled.Events.EventArgs.Player; +using KE.Items.API.Events; using KE.Items.API.Features.SpawnPoints; using System.Collections.Generic; using System.Linq; @@ -18,12 +20,13 @@ public abstract class KECustomGrenade : CustomGrenade protected override void SubscribeEvents() { - + ExplodeEvent.ExplodeDestructible += OnExplodeDestructible; base.SubscribeEvents(); } protected override void UnsubscribeEvents() { + ExplodeEvent.ExplodeDestructible -= OnExplodeDestructible; base.UnsubscribeEvents(); } @@ -71,15 +74,13 @@ public override uint Spawn(IEnumerable spawnPoints, uint limit) } - protected void InternalOnHurting(HurtingEventArgs ev) + private void OnExplodeDestructible(OnExplodeDestructibleEventsArgs ev) { - //can't get the custom grenade - /*if(ev.DamageHandler.Type == Exiled.API.Enums.DamageType.Explosion) - { - ev.Amount *= DamageModifier; - }*/ - + Player player = Player.Get(ev.Destructible.NetworkId); + if (!Check(Pickup.Get(ev.ExplosionGrenade))) return; + if (ev.Damage < 0f) return; + ev.Damage *= DamageModifier; } protected override void ShowPickedUpMessage(Player player) From 9458e143dc7bca61b90b7e21a6d562e81493a78e Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Sun, 25 Jan 2026 13:28:04 +0100 Subject: [PATCH 546/853] created custom weapon + the friend maker --- .../KE.Items/API/Features/KECustomWeapon.cs | 85 +++++++++++++++++++ KruacentExiled/KE.Items/Items/FriendMaker.cs | 78 +++++++++++++++++ 2 files changed, 163 insertions(+) create mode 100644 KruacentExiled/KE.Items/API/Features/KECustomWeapon.cs create mode 100644 KruacentExiled/KE.Items/Items/FriendMaker.cs diff --git a/KruacentExiled/KE.Items/API/Features/KECustomWeapon.cs b/KruacentExiled/KE.Items/API/Features/KECustomWeapon.cs new file mode 100644 index 00000000..78d2b63e --- /dev/null +++ b/KruacentExiled/KE.Items/API/Features/KECustomWeapon.cs @@ -0,0 +1,85 @@ +using Exiled.API.Features; +using Exiled.API.Features.Pickups; +using Exiled.API.Features.Spawn; +using Exiled.CustomItems.API.Features; +using Exiled.Events.EventArgs.Player; +using KE.Items.API.Features.SpawnPoints; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using static KE.Items.API.Features.SpawnPoints.PoseRoomSpawnPointHandler; + +namespace KE.Items.API.Features +{ + public abstract class KECustomWeapon : CustomWeapon + { + + protected override void SubscribeEvents() + { + + base.SubscribeEvents(); + } + + protected override void UnsubscribeEvents() + { + base.UnsubscribeEvents(); + } + + public override uint Spawn(IEnumerable spawnPoints, uint limit) + { + Log.Debug($"spawning {this.Name}"); + HashSet spawns = spawnPoints.ToHashSet(); + uint num = 0; + foreach (SpawnPoint spawnpoint in spawnPoints.Where(sp => sp is RoomSpawnPoint)) + { + Pickup pickup; + if (Exiled.Loader.Loader.Random.NextDouble() * 100.0 >= (double)spawnpoint.Chance || (limit != 0 && num >= limit)) + { + continue; + } + spawns.Remove(spawnpoint); + RoomSpawnPoint room = spawnpoint as RoomSpawnPoint; + ItemSpawn spawn = PoseRoomSpawnPointHandler.UseRandomPose(room.Room); + + Log.Debug($"spawning {this.Name} in {room.Room}"); + Log.Debug(room.Room + " : " + PoseRoomSpawnPointHandler.UsablePoses.Count(p => p.roomType == room.Room)); + + if (spawn is not null) + { + Log.Debug($"spawning custom pos"); + pickup = Spawn(spawn.Position); + } + else + { + Log.Error($"can't spawn ({Name}) in custom ({room.Room})"); + pickup = Spawn(spawnpoint.Position); + } + + + + if (pickup is not null) + { + num++; + } + + + } + + return base.Spawn(spawns, limit - num); + } + + + protected override void ShowPickedUpMessage(Player player) + { + KECustomItem.Message(this, player, true); + } + + protected override void ShowSelectedMessage(Player player) + { + KECustomItem.Message(this, player); + } + + } +} diff --git a/KruacentExiled/KE.Items/Items/FriendMaker.cs b/KruacentExiled/KE.Items/Items/FriendMaker.cs new file mode 100644 index 00000000..7ab2824c --- /dev/null +++ b/KruacentExiled/KE.Items/Items/FriendMaker.cs @@ -0,0 +1,78 @@ +using Exiled.API.Features; +using Exiled.API.Features.Spawn; +using Exiled.Events.EventArgs.Player; +using HintServiceMeow.UI.Utilities; +using KE.Items.API.Features; +using PlayerRoles; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using UnityEngine; + +namespace KE.Items.Items +{ + public class FriendMaker : KECustomWeapon + { + public override uint Id { get; set; } = 8520; + public override string Name { get; set; } = "Friend Maker"; + public override string Description { get; set; } = "The number one (1) method to makes friends"; + public override float Weight { get; set; } = 1f; + public override SpawnProperties SpawnProperties { get; set; } = null; + + + + public override bool FriendlyFire { get; set; } = true; + + + protected override void OnHurting(HurtingEventArgs ev) + { + + if (!Check(ev.Attacker)) return; + ev.IsAllowed = false; + + Convert(ev.Player,ev.Attacker); + + + } + + + + private void Convert(Player player,Player attacker) + { + if (player == null) + { + KECustomItem.ItemEffectHint(player, "But nobody's here"); + return; + } + + if (attacker.Role.Side == player.Role.Side) + { + KECustomItem.ItemEffectHint(player, "I know you don't like them but they're in your team"); + return; + } + + + if (player.IsScp && player.Role != RoleTypeId.Scp0492) + { + KECustomItem.ItemEffectHint(player, "That ain't a zombie"); + return; + } + + if (player.IsScp) + { + player.Role.Set(player.Role, RoleSpawnFlags.AssignInventory); + } + else + { + player.Role.Set(player.Role, RoleSpawnFlags.None); + } + + KECustomItem.ItemEffectHint(player, "New friend acquired!"); + } + + + + } +} From 84cab862285991bfd46e550a8f25930e6c79f133 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Sun, 25 Jan 2026 13:37:23 +0100 Subject: [PATCH 547/853] forgor the itemtype --- KruacentExiled/KE.Items/Items/FriendMaker.cs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/KruacentExiled/KE.Items/Items/FriendMaker.cs b/KruacentExiled/KE.Items/Items/FriendMaker.cs index 7ab2824c..2bce76f2 100644 --- a/KruacentExiled/KE.Items/Items/FriendMaker.cs +++ b/KruacentExiled/KE.Items/Items/FriendMaker.cs @@ -1,4 +1,5 @@ using Exiled.API.Features; +using Exiled.API.Features.Attributes; using Exiled.API.Features.Spawn; using Exiled.Events.EventArgs.Player; using HintServiceMeow.UI.Utilities; @@ -13,6 +14,8 @@ namespace KE.Items.Items { + + [CustomItem(ItemType.GunCOM15)] public class FriendMaker : KECustomWeapon { public override uint Id { get; set; } = 8520; From e381b039f08c209be1bc2be241e3a9e68442ac4d Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Sun, 25 Jan 2026 13:40:50 +0100 Subject: [PATCH 548/853] gives the friend maker to negotiator --- .../KE.CustomRoles/CR/ChaosInsurgency/Negotiator.cs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/KruacentExiled/KE.CustomRoles/CR/ChaosInsurgency/Negotiator.cs b/KruacentExiled/KE.CustomRoles/CR/ChaosInsurgency/Negotiator.cs index b7c9a3f8..d04efb1f 100644 --- a/KruacentExiled/KE.CustomRoles/CR/ChaosInsurgency/Negotiator.cs +++ b/KruacentExiled/KE.CustomRoles/CR/ChaosInsurgency/Negotiator.cs @@ -4,6 +4,7 @@ using Exiled.CustomRoles.API.Features; using Exiled.Events.EventArgs.Player; using KE.CustomRoles.API.Features; +using KE.Items.API.Features; using MEC; using PlayerRoles; using System.Collections.Generic; @@ -25,7 +26,7 @@ public class Negotiator : KECustomRole public override HashSet Abilities { get; } = new() { - "Convert" + }; @@ -52,6 +53,14 @@ protected override void UnsubscribeEvents() base.UnsubscribeEvents(); } + protected override void GiveInventory(Player player) + { + base.GiveInventory(player); + + KECustomItem.TryGive(player, "Friend Maker", false); + + } + private void OnHurting(HurtingEventArgs ev) { From 3de916fc431e7ed484b2e8a2cbf23ad6980e8d8a Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Sun, 25 Jan 2026 13:44:15 +0100 Subject: [PATCH 549/853] typo --- KruacentExiled/KE.Items/Items/FriendMaker.cs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/KruacentExiled/KE.Items/Items/FriendMaker.cs b/KruacentExiled/KE.Items/Items/FriendMaker.cs index 2bce76f2..b9a5bc12 100644 --- a/KruacentExiled/KE.Items/Items/FriendMaker.cs +++ b/KruacentExiled/KE.Items/Items/FriendMaker.cs @@ -20,7 +20,7 @@ public class FriendMaker : KECustomWeapon { public override uint Id { get; set; } = 8520; public override string Name { get; set; } = "Friend Maker"; - public override string Description { get; set; } = "The number one (1) method to makes friends"; + public override string Description { get; set; } = "The number one (1) method to make friends"; public override float Weight { get; set; } = 1f; public override SpawnProperties SpawnProperties { get; set; } = null; @@ -46,33 +46,33 @@ private void Convert(Player player,Player attacker) { if (player == null) { - KECustomItem.ItemEffectHint(player, "But nobody's here"); + KECustomItem.ItemEffectHint(attacker, "But nobody's here"); return; } if (attacker.Role.Side == player.Role.Side) { - KECustomItem.ItemEffectHint(player, "I know you don't like them but they're in your team"); + KECustomItem.ItemEffectHint(attacker, "I know you don't like them but they're in your team"); return; } if (player.IsScp && player.Role != RoleTypeId.Scp0492) { - KECustomItem.ItemEffectHint(player, "That ain't a zombie"); + KECustomItem.ItemEffectHint(attacker, "That ain't a zombie"); return; } if (player.IsScp) { - player.Role.Set(player.Role, RoleSpawnFlags.AssignInventory); + player.Role.Set(attacker.Role, RoleSpawnFlags.AssignInventory); } else { - player.Role.Set(player.Role, RoleSpawnFlags.None); + player.Role.Set(attacker.Role, RoleSpawnFlags.None); } - KECustomItem.ItemEffectHint(player, "New friend acquired!"); + KECustomItem.ItemEffectHint(attacker, "New friend acquired!"); } From 9f608544857fada1f3dbba688727fa935be16653 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Sun, 25 Jan 2026 14:58:08 +0100 Subject: [PATCH 550/853] fixed 106 not going through doors --- KruacentExiled/KE.Misc/Features/Spawn/Spawn.cs | 6 +++++- KruacentExiled/KE.Misc/Handlers/ServerHandler.cs | 14 +------------- 2 files changed, 6 insertions(+), 14 deletions(-) diff --git a/KruacentExiled/KE.Misc/Features/Spawn/Spawn.cs b/KruacentExiled/KE.Misc/Features/Spawn/Spawn.cs index 8752869e..33df7c40 100644 --- a/KruacentExiled/KE.Misc/Features/Spawn/Spawn.cs +++ b/KruacentExiled/KE.Misc/Features/Spawn/Spawn.cs @@ -113,7 +113,11 @@ private void SetRoleWithId(Player player, string name) if (baseRole.ContainsKey(name)) { - player.Role.Set(baseRole[name]); + RoleTypeId chosenRole = baseRole[name]; + if (player.Role.Type != chosenRole) + { + player.Role.Set(baseRole[name]); + } eventarg.VanillaRoles.Add(player); Log.Info("vanilla scp"); diff --git a/KruacentExiled/KE.Misc/Handlers/ServerHandler.cs b/KruacentExiled/KE.Misc/Handlers/ServerHandler.cs index c8982920..4d10f12c 100644 --- a/KruacentExiled/KE.Misc/Handlers/ServerHandler.cs +++ b/KruacentExiled/KE.Misc/Handlers/ServerHandler.cs @@ -1,16 +1,4 @@ -using System.Drawing; -using System.Linq; -using Exiled.API.Enums; -using Exiled.API.Extensions; -using Exiled.API.Features; -using KE.Misc.Features.Auto079; -using KE.Misc.Utils; -using MEC; -using PlayerRoles; -using UnityEngine; -using TextToy = LabApi.Features.Wrappers.TextToy; - -namespace KE.Misc.Handlers +namespace KE.Misc.Handlers { internal class ServerHandler { From 727e49d666c8e6473797b2a33982c46312a297cb Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Sun, 25 Jan 2026 18:52:53 +0100 Subject: [PATCH 551/853] scp know last human location --- .../Features/LastHuman/LastHumanHandler.cs | 46 +++++++++++++++---- 1 file changed, 36 insertions(+), 10 deletions(-) diff --git a/KruacentExiled/KE.Misc/Features/LastHuman/LastHumanHandler.cs b/KruacentExiled/KE.Misc/Features/LastHuman/LastHumanHandler.cs index 9bd1c78f..fb379ee0 100644 --- a/KruacentExiled/KE.Misc/Features/LastHuman/LastHumanHandler.cs +++ b/KruacentExiled/KE.Misc/Features/LastHuman/LastHumanHandler.cs @@ -52,24 +52,50 @@ private void OnChangedRole(PlayerChangedRoleEventArgs ev) if (ev.OldRole.IsScp()) return; + if (ev.NewRole.RoleTypeId.IsScp()) return; - if(TryGetLastTarget(out Player player)) - { - AbstractHint hint = DisplayHandler.Instance.GetHint(player, position.HintPlacement); - if (hint is null || hint.Hide) + if(TryGetLastTarget(out Player lastTarget)) + { + foreach(Player player in Player.Enumerable) { - string msg = TextLast1; - if (UnityEngine.Random.Range(1,3) % 2 == 0) + AbstractHint hint = DisplayHandler.Instance.GetHint(lastTarget, position.HintPlacement); + + if (hint is null || hint.Hide) { - msg = TextLast2; - } + + string msg = string.Empty; + if (player == lastTarget) + { + msg = TextLast1; + if (UnityEngine.Random.Range(1, 3) % 2 == 0) + { + msg = TextLast2; + } + } + else if(!player.IsDead) + { + msg = "The last human is at " + player.Zone; + } + + - DisplayHandler.Instance.AddHint(position.HintPlacement, player, msg, 10); - Log.Debug("show message to "+player.Nickname); + if (!player.IsDead) + { + DisplayHandler.Instance.AddHint(position.HintPlacement, player, msg, 10); + } + + + Log.Debug("show message to " + lastTarget.Nickname); + } } + + + + + } } From c99755eb4e6097c23e7b799c6df964f59168cac8 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Mon, 26 Jan 2026 19:34:06 +0100 Subject: [PATCH 552/853] added cooldown to friendmaker --- KruacentExiled/KE.Items/Items/TPGrenada.cs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/KruacentExiled/KE.Items/Items/TPGrenada.cs b/KruacentExiled/KE.Items/Items/TPGrenada.cs index e823cab9..32cf92d2 100644 --- a/KruacentExiled/KE.Items/Items/TPGrenada.cs +++ b/KruacentExiled/KE.Items/Items/TPGrenada.cs @@ -13,7 +13,7 @@ namespace KE.Items.Items { [CustomItem(ItemType.GrenadeHE)] - public class TPGrenada : KECustomGrenade, ISwichableEffect/*, ICustomPickupModel*/ + public class TPGrenada : KECustomGrenade, ISwichableEffect, ICustomPickupModel { public override uint Id { get; set; } = 1045; @@ -53,12 +53,12 @@ public class TPGrenada : KECustomGrenade, ISwichableEffect/*, ICustomPickupModel }; - //public PickupModel PickupModel { get; } + public PickupModel PickupModel { get; } public TPGrenada() { Effect = new TPGrenadaEffect(); - //PickupModel = new TPGrenadaPModel(this); + PickupModel = new TPGrenadaPModel(this); } protected override void OnExploding(ExplodingGrenadeEventArgs ev) @@ -69,13 +69,13 @@ protected override void OnExploding(ExplodingGrenadeEventArgs ev) protected override void SubscribeEvents() { - //PickupModel.SubscribeEvents(); + PickupModel.SubscribeEvents(); base.SubscribeEvents(); } protected override void UnsubscribeEvents() { - //PickupModel.UnsubscribeEvents(); + PickupModel.UnsubscribeEvents(); base.UnsubscribeEvents(); } From e98dbda7d0a753eb259a3f269294eceae4264e27 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Mon, 26 Jan 2026 19:34:18 +0100 Subject: [PATCH 553/853] fixed laggy pickupmodel --- .../KE.Items/API/Core/Models/PickupModel.cs | 13 ++++ KruacentExiled/KE.Items/Items/FriendMaker.cs | 65 +++++++++++++++++-- .../Items/PickupModels/PressePureePModel.cs | 31 +++------ .../Items/PickupModels/TPGrenadaPModel.cs | 2 +- KruacentExiled/KE.Items/Items/PressePuree.cs | 12 ++-- 5 files changed, 92 insertions(+), 31 deletions(-) diff --git a/KruacentExiled/KE.Items/API/Core/Models/PickupModel.cs b/KruacentExiled/KE.Items/API/Core/Models/PickupModel.cs index 8a1bb70e..5bf7432c 100644 --- a/KruacentExiled/KE.Items/API/Core/Models/PickupModel.cs +++ b/KruacentExiled/KE.Items/API/Core/Models/PickupModel.cs @@ -6,6 +6,7 @@ using KE.Items.API.Features; using KE.Utils.API.Features.Models; using KE.Utils.API.Interfaces; +using MEC; using System.Collections.Generic; using System.Linq; using UnityEngine; @@ -28,6 +29,7 @@ public PickupModel(CustomItem customItem) public void SubscribeEvents() { PickupToParent = new(); + ItemPickupBase.OnPickupAdded += OnPickupAdded; ItemPickupBase.OnPickupDestroyed += OnPickupDestroyed; } @@ -41,6 +43,14 @@ public void UnsubscribeEvents() private Dictionary PickupToParent; + private static CoroutineHandle handle; + private static IEnumerator UpdatePosition() + { + while (true) + { + + } + } private Primitive CreateParent(Pickup pickup) { @@ -57,6 +67,7 @@ private Primitive CreateParent(Pickup pickup) prim.Transform.localRotation = Quaternion.identity; prim.Transform.localScale = new Vector3(1f/ parentScale.x,1f/ parentScale.y,1f/parentScale.z); prim.Transform.localScale *= Scale; + prim.MovementSmoothing = 0; prim.Spawn(); PickupToParent.Add(pickup, prim); @@ -69,6 +80,8 @@ public void OnPickupAdded(ItemPickupBase pickupBase) Pickup pickup = Pickup.Get(pickupBase); if (!Check(pickup)) return; + //handle = Timing.RunCoroutineSingleton(UpdatePosition(), handle, SingletonBehavior.Abort); + Transform parent = CreateParent(pickup).Transform; Log.Info(parent); CreateModel(parent); diff --git a/KruacentExiled/KE.Items/Items/FriendMaker.cs b/KruacentExiled/KE.Items/Items/FriendMaker.cs index b9a5bc12..1fd5f704 100644 --- a/KruacentExiled/KE.Items/Items/FriendMaker.cs +++ b/KruacentExiled/KE.Items/Items/FriendMaker.cs @@ -7,6 +7,7 @@ using PlayerRoles; using System; using System.Collections.Generic; +using System.Diagnostics.Tracing; using System.Linq; using System.Text; using System.Threading.Tasks; @@ -25,22 +26,78 @@ public class FriendMaker : KECustomWeapon public override SpawnProperties SpawnProperties { get; set; } = null; - + public override byte ClipSize { get; set; } = 1; + public override bool FriendlyFire { get; set; } = true; + private Dictionary cooldowns; - protected override void OnHurting(HurtingEventArgs ev) + private TimeSpan Cooldown = new(0,1,0); + + protected override void SubscribeEvents() + { + cooldowns = new(); + base.SubscribeEvents(); + } + protected override void UnsubscribeEvents() { + cooldowns = null; + base.UnsubscribeEvents(); + } + + + protected override void OnShooting(ShootingEventArgs ev) + { + Player player = ev.Player; + if (!Check(player)) return; + if (!ev.IsAllowed) return; + if (!CheckCooldown(player)) + { + DateTime dateTime = cooldowns[player] + Cooldown; + KECustomItem.ItemEffectHint(player, "You must wait " + Math.Round((dateTime - DateTime.Now).TotalSeconds) + " seconds before using it again"); + ev.IsAllowed = false; + } + + + } + - if (!Check(ev.Attacker)) return; + protected override void OnHurting(HurtingEventArgs ev) + { + Player attacker = ev.Attacker; + Player player = ev.Player; + if (!Check(attacker)) return; ev.IsAllowed = false; - Convert(ev.Player,ev.Attacker); + + if (!CheckCooldown(attacker)) + { + return; + } + + cooldowns[ev.Attacker] = DateTime.Now; + + Convert(ev.Player, ev.Attacker); } + private bool CheckCooldown(Player player) + { + if (cooldowns.TryGetValue(player, out DateTime time)) + { + if (DateTime.Now >= time + Cooldown) + { + return true; + } + return false; + } + cooldowns[player] = DateTime.Now; + return true; + + } + private void Convert(Player player,Player attacker) { diff --git a/KruacentExiled/KE.Items/Items/PickupModels/PressePureePModel.cs b/KruacentExiled/KE.Items/Items/PickupModels/PressePureePModel.cs index deb65c6c..e4ab96b1 100644 --- a/KruacentExiled/KE.Items/Items/PickupModels/PressePureePModel.cs +++ b/KruacentExiled/KE.Items/Items/PickupModels/PressePureePModel.cs @@ -1,13 +1,6 @@ -/*using Exiled.API.Features; -using Exiled.API.Features.Toys; +using Exiled.API.Features.Toys; using Exiled.CustomItems.API.Features; -using KE.Items.API.Features; -using KE.Utils.API.Models.Blueprints; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; +using KE.Items.API.Core.Models; using UnityEngine; namespace KE.Items.Items.PickupModels @@ -17,24 +10,20 @@ public class PressePureePModel : PickupModel public PressePureePModel(CustomItem customItem) : base(customItem) { } - protected override bool HidePickup => true; - private static Vector3 manche = new Vector3(.05f, .1f, .05f); - private static Vector3 explosifCharge = new Vector3(.1f, .04f, .1f); + private static Vector3 mancheScale = new Vector3(.5f, .885f, .5f); public static readonly Color32 colorManche = new Color32(84, 43, 11, 255); public static readonly Color32 colorExplosif = new Color32(31, 31, 31, 255); - protected override HashSet CreateModel() + public override float Scale => 0.15f; + + protected override void CreateModel(Transform parent) { - HashSet model = new() - { - AdminToyBlueprint.Create(Primitive.Create(PrimitiveType.Cylinder, Vector3.zero, null, manche,false,colorManche)), - AdminToyBlueprint.Create(Primitive.Create(PrimitiveType.Cylinder, new Vector3(0, 6f), null, explosifCharge,false,colorExplosif)), - }; - return model; - + Primitive manche = CreatePrimitive(parent,PrimitiveType.Cylinder,new(0,.006f,0),Quaternion.identity, mancheScale, colorManche); + Primitive manche2 = CreatePrimitive(parent,PrimitiveType.Cylinder,new(0,.9463f,0),Quaternion.identity, new(0.45f,0.05f,0.45f), colorExplosif); + Primitive explosif1 = CreatePrimitive(parent,PrimitiveType.Cylinder,new(0,1.2113f,0),Quaternion.identity, new(0.7f,0.2274f,0.7f), colorExplosif); + Primitive explosif2 = CreatePrimitive(parent,PrimitiveType.Cylinder,new(0,1,0),Quaternion.identity, new(0.8f,0.02f,0.8f), colorExplosif); } } } -*/ \ No newline at end of file diff --git a/KruacentExiled/KE.Items/Items/PickupModels/TPGrenadaPModel.cs b/KruacentExiled/KE.Items/Items/PickupModels/TPGrenadaPModel.cs index a43744e8..76266d6b 100644 --- a/KruacentExiled/KE.Items/Items/PickupModels/TPGrenadaPModel.cs +++ b/KruacentExiled/KE.Items/Items/PickupModels/TPGrenadaPModel.cs @@ -22,7 +22,7 @@ public TPGrenadaPModel(CustomItem customItem) : base(customItem) { } - public override float Scale => .25f; + public override float Scale => .15f; protected override void CreateModel(Transform parent) { diff --git a/KruacentExiled/KE.Items/Items/PressePuree.cs b/KruacentExiled/KE.Items/Items/PressePuree.cs index 80983dbb..79d98633 100644 --- a/KruacentExiled/KE.Items/Items/PressePuree.cs +++ b/KruacentExiled/KE.Items/Items/PressePuree.cs @@ -6,10 +6,12 @@ using Exiled.API.Features.Spawn; using Exiled.CustomItems.API.Features; using Exiled.Events.EventArgs.Scp914; +using KE.Items.API.Core.Models; using KE.Items.API.Core.Upgrade; using KE.Items.API.Events; using KE.Items.API.Features; using KE.Items.API.Interface; +using KE.Items.Items.PickupModels; using Scp914; using System; using System.Collections.Generic; @@ -17,7 +19,7 @@ namespace KE.Items.Items { [CustomItem(ItemType.GrenadeHE)] - public class PressePuree : KECustomGrenade, IUpgradableCustomItem/*, ICustomPickupModel*/ + public class PressePuree : KECustomGrenade, IUpgradableCustomItem, ICustomPickupModel { //presse puree public override uint Id { get; set; } = 1046; @@ -26,7 +28,7 @@ public class PressePuree : KECustomGrenade, IUpgradableCustomItem/*, ICustomPick public override float Weight { get; set; } = 0.65f; public override float FuseTime { get; set; } = 5f; public override bool ExplodeOnCollision { get; set; } = true; - //public PickupModel PickupModel { get; } + public PickupModel PickupModel { get; } public override SpawnProperties SpawnProperties { get; set; } = new SpawnProperties() { Limit = 5, @@ -57,20 +59,20 @@ public class PressePuree : KECustomGrenade, IUpgradableCustomItem/*, ICustomPick public PressePuree() { - //PickupModel = new PressePureePModel(this); + PickupModel = new PressePureePModel(this); } protected override void SubscribeEvents() { - //PickupModel.SubscribeEvents(); + PickupModel.SubscribeEvents(); ExplodeEvent.ExplodeDestructible += OnExplodeDestructible; base.SubscribeEvents(); } protected override void UnsubscribeEvents() { - //PickupModel.UnsubscribeEvents(); + PickupModel.UnsubscribeEvents(); ExplodeEvent.ExplodeDestructible -= OnExplodeDestructible; base.UnsubscribeEvents(); } From b892112058ccda666944f3eb0c58a01b2a31113b Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Mon, 26 Jan 2026 19:37:59 +0100 Subject: [PATCH 554/853] removed voice changing russe --- KruacentExiled/KE.CustomRoles/CR/ChaosInsurgency/LeRusse.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/KruacentExiled/KE.CustomRoles/CR/ChaosInsurgency/LeRusse.cs b/KruacentExiled/KE.CustomRoles/CR/ChaosInsurgency/LeRusse.cs index 86138f10..032adede 100644 --- a/KruacentExiled/KE.CustomRoles/CR/ChaosInsurgency/LeRusse.cs +++ b/KruacentExiled/KE.CustomRoles/CR/ChaosInsurgency/LeRusse.cs @@ -59,13 +59,13 @@ public class Russe : KECustomRole, IColor protected override void RoleAdded(Player player) { - Exiled.Events.Handlers.Player.VoiceChatting += OnVoiceChatting; + //Exiled.Events.Handlers.Player.VoiceChatting += OnVoiceChatting; if (DebugMode) CreateDummy(player); } protected override void RoleRemoved(Player player) { - Exiled.Events.Handlers.Player.VoiceChatting -= OnVoiceChatting; + //Exiled.Events.Handlers.Player.VoiceChatting -= OnVoiceChatting; if (DebugMode) RemoveDummy(player); } From 68d66fcd554728f495503e675d3663bdb82fbcf0 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Mon, 26 Jan 2026 19:39:05 +0100 Subject: [PATCH 555/853] added a check --- KruacentExiled/KE.Items/Items/FriendMaker.cs | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/KruacentExiled/KE.Items/Items/FriendMaker.cs b/KruacentExiled/KE.Items/Items/FriendMaker.cs index 1fd5f704..869fa029 100644 --- a/KruacentExiled/KE.Items/Items/FriendMaker.cs +++ b/KruacentExiled/KE.Items/Items/FriendMaker.cs @@ -75,9 +75,12 @@ protected override void OnHurting(HurtingEventArgs ev) return; } - cooldowns[ev.Attacker] = DateTime.Now; + - Convert(ev.Player, ev.Attacker); + if(Convert(ev.Player, ev.Attacker)) + { + cooldowns[ev.Attacker] = DateTime.Now; + } } @@ -99,25 +102,25 @@ private bool CheckCooldown(Player player) } - private void Convert(Player player,Player attacker) + private bool Convert(Player player,Player attacker) { if (player == null) { KECustomItem.ItemEffectHint(attacker, "But nobody's here"); - return; + return false; } if (attacker.Role.Side == player.Role.Side) { KECustomItem.ItemEffectHint(attacker, "I know you don't like them but they're in your team"); - return; + return false; } if (player.IsScp && player.Role != RoleTypeId.Scp0492) { KECustomItem.ItemEffectHint(attacker, "That ain't a zombie"); - return; + return false; } if (player.IsScp) @@ -130,6 +133,7 @@ private void Convert(Player player,Player attacker) } KECustomItem.ItemEffectHint(attacker, "New friend acquired!"); + return true; } From 98fd3d7d86b2c2f9324672cc11b5cb23d5654764 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Mon, 26 Jan 2026 19:58:34 +0100 Subject: [PATCH 556/853] airstrike everywhere --- KruacentExiled/KE.CustomRoles/Abilities/Airstrike.cs | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/KruacentExiled/KE.CustomRoles/Abilities/Airstrike.cs b/KruacentExiled/KE.CustomRoles/Abilities/Airstrike.cs index 8a03bcfa..d49e410b 100644 --- a/KruacentExiled/KE.CustomRoles/Abilities/Airstrike.cs +++ b/KruacentExiled/KE.CustomRoles/Abilities/Airstrike.cs @@ -23,10 +23,10 @@ public class Airstrike : KEAbilities, ICustomIcon public override string Name { get; } = "AirStrike"; public override string PublicName { get; } = "Airstrike"; - public override string Description { get; } = "Don't overuse it or your co-op will not be happy (only works on Surface Zone)"; + public override string Description { get; } = "Don't overuse it or your co-op will not be happy"; public override float Cooldown { get; } = 60f; - public float height = 5; + public float height = 1; public Utils.API.GifAnimator.TextImage IconName => MainPlugin.Instance.icons["Airstrike"]; @@ -37,11 +37,6 @@ protected override bool AbilityUsed(Player player) MainPlugin.ShowEffectHint(player, "no target selected"); return false; } - if(target.GetZone() != FacilityZone.Surface) - { - MainPlugin.ShowEffectHint(player, "only works on Surface Zone"); - return false; - } Physics.Linecast(target, target + height * Vector3.up, out RaycastHit hit); if (hit.collider != null) From 6e93b4359d19d6e8f7b4f0192f9a274bbfa96b29 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Tue, 27 Jan 2026 20:06:25 +0100 Subject: [PATCH 557/853] custom role is shown to the players spectating --- .../API/Features/KECustomRole.cs | 117 +++++++++++++----- KruacentExiled/KE.CustomRoles/MainPlugin.cs | 32 ++--- 2 files changed, 97 insertions(+), 52 deletions(-) diff --git a/KruacentExiled/KE.CustomRoles/API/Features/KECustomRole.cs b/KruacentExiled/KE.CustomRoles/API/Features/KECustomRole.cs index 940142af..3283ba81 100644 --- a/KruacentExiled/KE.CustomRoles/API/Features/KECustomRole.cs +++ b/KruacentExiled/KE.CustomRoles/API/Features/KECustomRole.cs @@ -9,6 +9,7 @@ using Exiled.CustomRoles.API; using Exiled.CustomRoles.API.Features; using Exiled.Events.EventArgs.Player; +using Exiled.Events.EventArgs.Server; using HintServiceMeow.Core.Models.Hints; using InventorySystem.Configs; using KE.CustomRoles.API.HintPositions; @@ -192,6 +193,90 @@ private void OnUsedItem(UsedItemEventArgs ev) } + + public static void SpawnStartRound(Misc.Features.Spawn.SpawnedEventArgs ev) + { + GiveRandomRole(Player.List.Except(ev.CustomRoles)); + } + + public static void RespawnCustomRole(RespawnedTeamEventArgs ev) + { + GiveRandomRole(ev.Players); + } + + public static void ShowCustomRole(JoinedEventArgs ev) + { + Timing.CallDelayed(1, delegate + { + Player player = ev.Player; + DisplayHandler.Instance.CreateAuto(player, arg => CurrentRole(player), CurrentCustomRolePosition.HintPlacement); + }); + + + } + + + + + public static string CurrentRole(Player player) + { + StringBuilder sb = StringBuilderPool.Pool.Get(); + + + if (HasCustomRole(player)) + { + sb.AppendLine("Current Role : "); + sb.AppendLine(); + sb.Append(""); + sb.Append(Get(player).FirstOrDefault()?.PublicName); + sb.Append(""); + } + else if (player.IsDead) + { + Player spectating = GetSpectatingPlayer(player); + KECustomRole customRole = null; + if (spectating != null) + { + customRole = Get(spectating).FirstOrDefault(); + } + + + if(customRole != null) + { + sb.AppendLine("Current Role : "); + sb.AppendLine(); + sb.Append(""); + sb.Append(customRole.PublicName); + sb.Append(""); + } + } + + + + return StringBuilderPool.Pool.ToStringReturn(sb); + } + + private static Player GetSpectatingPlayer(Player spectator) + { + + foreach(Player player in Player.Enumerable) + { + if (player.CurrentSpectatingPlayers.Contains(spectator)) + { + return player; + } + } + + return null; + + + } + + protected void ShowEffectHint(Player player, string text) { float delay = MainPlugin.SettingHandler.GetTime(player); ; @@ -267,13 +352,6 @@ public override void AddRole(Player player) SetSpawn(player2); - - if (PlayerHints.Add(player)) - { - ContinuousShow(player2); - - } - ShowMessage(player2); RoleAdded(player2); @@ -281,35 +359,14 @@ public override void AddRole(Player player) player2.TryAddCustomRoleFriendlyFire(Name, CustomRoleFFMultiplier); } - private void ContinuousShow(Player player) - { - Log.Debug("adding show hint to player " + player.Nickname); - DisplayHandler.Instance.CreateAuto(player, arg => CurrentRole(player), CurrentCustomRolePosition.HintPlacement); - } - private static HashSet PlayerHints = new(); + private static HashSet PlayerHints = new(); - private static HintPosition CurrentCustomRolePosition = new CurrentCustomRolePosition(); - - public static string CurrentRole(Player player) - { - StringBuilder sb = StringBuilderPool.Pool.Get(); - if (HasCustomRole(player)) - { - sb.AppendLine("Current Role : "); - sb.AppendLine(); - sb.Append(""); - sb.Append(Get(player).FirstOrDefault()?.PublicName); - sb.Append(""); - } + public static readonly HintPosition CurrentCustomRolePosition = new CurrentCustomRolePosition(); - return StringBuilderPool.Pool.ToStringReturn(sb); - } protected virtual void ClearInventory(Player player) { diff --git a/KruacentExiled/KE.CustomRoles/MainPlugin.cs b/KruacentExiled/KE.CustomRoles/MainPlugin.cs index 4ae9fd72..8c38355d 100644 --- a/KruacentExiled/KE.CustomRoles/MainPlugin.cs +++ b/KruacentExiled/KE.CustomRoles/MainPlugin.cs @@ -2,10 +2,12 @@ using Exiled.API.Features.Core.UserSettings; using Exiled.API.Interfaces; using Exiled.CustomRoles.API.Features; +using Exiled.Events.EventArgs.Player; using Exiled.Events.EventArgs.Server; using HarmonyLib; using KE.CustomRoles.Abilities.FireAbilities; using KE.CustomRoles.API.Features; +using KE.CustomRoles.API.HintPositions; using KE.CustomRoles.Settings; using KE.Misc.Features.Spawn; using KE.Utils.API.CustomStats; @@ -91,28 +93,19 @@ public override void OnDisabled() public void SubscribeEvents() { - Misc.Features.Spawn.Spawn.OnAssigned += CustomRoleImplement; - Exiled.Events.Handlers.Server.RespawnedTeam += CustomRoleRespawning; - Exiled.Events.Handlers.Server.WaitingForPlayers += OnWaitingForPlayers; + Misc.Features.Spawn.Spawn.OnAssigned += KECustomRole.SpawnStartRound; + Exiled.Events.Handlers.Server.RespawnedTeam += KECustomRole.RespawnCustomRole; + Exiled.Events.Handlers.Server.WaitingForPlayers += KECustomRole.ResetNumberOfSpawn; + Exiled.Events.Handlers.Player.Joined += KECustomRole.ShowCustomRole; } public void UnsubscribeEvents() { - Misc.Features.Spawn.Spawn.OnAssigned -= CustomRoleImplement; - Exiled.Events.Handlers.Server.RespawnedTeam -= CustomRoleRespawning; - Exiled.Events.Handlers.Server.WaitingForPlayers -= OnWaitingForPlayers; + Misc.Features.Spawn.Spawn.OnAssigned -= KECustomRole.SpawnStartRound; + Exiled.Events.Handlers.Server.RespawnedTeam -= KECustomRole.RespawnCustomRole; + Exiled.Events.Handlers.Server.WaitingForPlayers -= KECustomRole.ResetNumberOfSpawn; + Exiled.Events.Handlers.Player.Joined -= KECustomRole.ShowCustomRole; } - private void OnWaitingForPlayers() - { - KECustomRole.ResetNumberOfSpawn(); - } - - public void CustomRoleImplement(SpawnedEventArgs ev) - { - - KECustomRole.GiveRandomRole(Player.List.Except(ev.CustomRoles)); - - } private void LoadImage() { @@ -143,11 +136,6 @@ public void ShowTranslation() Log.Debug(translation.ToString()); } - public void CustomRoleRespawning(RespawnedTeamEventArgs ev) - { - KECustomRole.GiveRandomRole(ev.Players); - } - public static void ShowEffectHint(Player player, string text) { float delay = SettingHandler.GetTime(player); ; From 8d12b58c588062b23b2077d9f86b8c9596713d43 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Tue, 27 Jan 2026 20:43:43 +0100 Subject: [PATCH 558/853] holy grenade buff + started tempad --- KruacentExiled/KE.Items/Items/PressePuree.cs | 1 - .../KE.Items/Items/SainteGrenada.cs | 10 ++-- KruacentExiled/KE.Items/Items/Tempad.cs | 52 +++++++++++++++++++ 3 files changed, 55 insertions(+), 8 deletions(-) create mode 100644 KruacentExiled/KE.Items/Items/Tempad.cs diff --git a/KruacentExiled/KE.Items/Items/PressePuree.cs b/KruacentExiled/KE.Items/Items/PressePuree.cs index 79d98633..38dc412d 100644 --- a/KruacentExiled/KE.Items/Items/PressePuree.cs +++ b/KruacentExiled/KE.Items/Items/PressePuree.cs @@ -21,7 +21,6 @@ namespace KE.Items.Items [CustomItem(ItemType.GrenadeHE)] public class PressePuree : KECustomGrenade, IUpgradableCustomItem, ICustomPickupModel { - //presse puree public override uint Id { get; set; } = 1046; public override string Name { get; set; } = "Presse Purée"; public override string Description { get; set; } = "The grenade explode at impact but does less damage"; diff --git a/KruacentExiled/KE.Items/Items/SainteGrenada.cs b/KruacentExiled/KE.Items/Items/SainteGrenada.cs index 79079fad..4311bf62 100644 --- a/KruacentExiled/KE.Items/Items/SainteGrenada.cs +++ b/KruacentExiled/KE.Items/Items/SainteGrenada.cs @@ -22,17 +22,15 @@ public class SainteGrenada : KECustomGrenade, ILumosItem public override string Name { get; set; } = "Sainte Grenada"; public override string Description { get; set; } = "Worms reference !?"; public override float Weight { get; set; } = 1.5f; - public override float FuseTime { get; set; } = 6f; + public override float FuseTime { get; set; } = 5f; public override bool ExplodeOnCollision { get; set; } = false; public override float DamageModifier { get; set; } = 3f; public Color Color { get; set; } = Color.red; - // - public int NbGrenadeSpawned { get; set; } = 4; + public int NbGrenadeSpawned { get; set; } = 3; public float SpawnRadius { get; set; } = 5f; public float GrenadeSize { get; set; } = 4f; - // public override SpawnProperties SpawnProperties { get; set; } = new SpawnProperties() @@ -50,10 +48,8 @@ protected override void OnExploding(ExplodingGrenadeEventArgs ev) for (int i = 0; i < NbGrenadeSpawned; i++) { - float angle = UnityEngine.Random.Range(0f, 360f) * Mathf.Deg2Rad; - Vector3 offset = new Vector3(Mathf.Cos(angle), 0, Mathf.Sin(angle)) * SpawnRadius; - Vector3 spawnPosition = ev.Position + offset; + Vector3 spawnPosition = ev.Position; ExplosiveGrenade grenade = (ExplosiveGrenade)Item.Create(ItemType.GrenadeHE); grenade.SpawnActive(spawnPosition).FuseTime = 0f; diff --git a/KruacentExiled/KE.Items/Items/Tempad.cs b/KruacentExiled/KE.Items/Items/Tempad.cs new file mode 100644 index 00000000..1da1b62c --- /dev/null +++ b/KruacentExiled/KE.Items/Items/Tempad.cs @@ -0,0 +1,52 @@ +using Exiled.API.Features.Attributes; +using Exiled.API.Features.Spawn; +using Exiled.API.Features.Toys; +using Exiled.Events.EventArgs.Player; +using KE.Items.API.Features; +using KE.Utils.API.Features.Models; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using UnityEngine; + +namespace KE.Items.Items +{ + + //[CustomItem(ItemType.Flashlight)] + public class Tempad : KECustomItem + { + + public override uint Id { get; set; } = 1845; + public override string Name { get; set; } = "Tempad"; + public override string Description { get; set; } = "drop to set a point; toggle the flashlight to activate the portal"; + public override float Weight { get; set; } = 0.65f; + public override SpawnProperties SpawnProperties { get; set; } = null; + + + + + + protected override void OnDroppingItem(DroppingItemEventArgs ev) + { + Primitive prim = null; + + Collider c = prim.Base.gameObject.GetComponent(); + + + } + + + } + + + + public class TempadModel : ModelBase + { + protected override void CreateModel(Transform parent) + { + + } + } +} From 03980ccb144a506176b42a83afe30972bc92783e Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Tue, 27 Jan 2026 21:46:25 +0100 Subject: [PATCH 559/853] mdoel --- .../Items/PickupModels/HolyGrenadePModel.cs | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 KruacentExiled/KE.Items/Items/PickupModels/HolyGrenadePModel.cs diff --git a/KruacentExiled/KE.Items/Items/PickupModels/HolyGrenadePModel.cs b/KruacentExiled/KE.Items/Items/PickupModels/HolyGrenadePModel.cs new file mode 100644 index 00000000..f47720bc --- /dev/null +++ b/KruacentExiled/KE.Items/Items/PickupModels/HolyGrenadePModel.cs @@ -0,0 +1,20 @@ +using KE.Items.API.Core.Models; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using UnityEngine; + +namespace KE.Items.Items.PickupModels +{ + public class HolyGrenade : PickupModel + { + public override float Scale => 0.1f; + + protected override void CreateModel(Transform parent) + { + + } + } +} From 31aef855b9f86be94efa2cd43481ae74d2af50dc Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Wed, 28 Jan 2026 05:25:36 +0100 Subject: [PATCH 560/853] omg im so stupid --- .../KE.CustomRoles/CR/CustomSCPs/SCP035.cs | 26 +++++++++---------- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP035.cs b/KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP035.cs index 91791e44..3f1c1d95 100644 --- a/KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP035.cs +++ b/KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP035.cs @@ -144,24 +144,22 @@ private void OnSearchingPickup(SearchingPickupEventArgs ev) ev.IsAllowed = false; return; } - - if (ev.Pickup.Type.IsScp()) - { - ShowEffectHint(ev.Player, CantPickup); - ev.IsAllowed = false; - return; - } - - if (ev.Pickup.Type == ItemType.GunSCP127) - { - ShowEffectHint(ev.Player, CantPickup); - ev.IsAllowed = false; - return; - } } + if (ev.Pickup.Type.IsScp()) + { + ShowEffectHint(ev.Player, CantPickup); + ev.IsAllowed = false; + return; + } + if (ev.Pickup.Type == ItemType.GunSCP127) + { + ShowEffectHint(ev.Player, CantPickup); + ev.IsAllowed = false; + return; + } From 9bb6d55b3360c7f3d060233d0deb2b65a4664bc0 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Wed, 28 Jan 2026 19:08:13 +0100 Subject: [PATCH 561/853] holygrenade + molotov pickup model --- .../Items/ItemEffects/MolotovEffect.cs | 10 ++--- KruacentExiled/KE.Items/Items/Molotov.cs | 10 ++--- .../Items/PickupModels/HolyGrenadePModel.cs | 31 +++++++++++-- .../Items/PickupModels/MolotovPModel.cs | 18 +++----- .../Items/PickupModels/Scp3136PModel.cs | 45 +++++++++---------- .../KE.Items/Items/SainteGrenada.cs | 26 ++++++++++- 6 files changed, 91 insertions(+), 49 deletions(-) diff --git a/KruacentExiled/KE.Items/Items/ItemEffects/MolotovEffect.cs b/KruacentExiled/KE.Items/Items/ItemEffects/MolotovEffect.cs index d371ae16..3624a223 100644 --- a/KruacentExiled/KE.Items/Items/ItemEffects/MolotovEffect.cs +++ b/KruacentExiled/KE.Items/Items/ItemEffects/MolotovEffect.cs @@ -75,18 +75,18 @@ private void SpawnMolotov(Player owner, Vector3 centerPos) List fireLights = new List(); Color fireColor = new Color(255, 128, 0); - fireLights.Add(CreateLight(centerPos + Vector3.up * 0.5f, fireColor, Radius * 2f, 2f)); + fireLights.Add(CreateLight(centerPos + Vector3.up * 0.5f, fireColor, Radius * 2f, 0.2f)); float spread = Radius * 0.5f; - fireLights.Add(CreateLight(centerPos + new Vector3(-spread, 0.5f, 0), fireColor, Radius, 0.5f)); - fireLights.Add(CreateLight(centerPos + new Vector3(0, 0.5f, spread), fireColor, Radius, 0.5f)); + fireLights.Add(CreateLight(centerPos + new Vector3(-spread, 0.5f, 0), fireColor, Radius, 0.2f)); + fireLights.Add(CreateLight(centerPos + new Vector3(0, 0.5f, spread), fireColor, Radius, 0.2f)); Timing.RunCoroutine(Fire(jarPickup, dangerZone, fireLights, owner, centerPos)); } private Light CreateLight(Vector3 pos, Color col, float range, float intensity) { - Light l = Light.Create(pos); + Light l = Light.Create(pos,spawn:false); l.Color = col; l.Range = range; l.Intensity = intensity; @@ -102,7 +102,7 @@ private IEnumerator Fire(Pickup jar, Primitive zone, List lights, { foreach (var l in lights) { - if (l != null) l.Intensity = Random.Range(3f, 6f); + if (l != null) l.Intensity = Random.Range(0.1f, 0.3f); } if (zone != null) diff --git a/KruacentExiled/KE.Items/Items/Molotov.cs b/KruacentExiled/KE.Items/Items/Molotov.cs index c506fad3..4181cb3e 100644 --- a/KruacentExiled/KE.Items/Items/Molotov.cs +++ b/KruacentExiled/KE.Items/Items/Molotov.cs @@ -15,7 +15,7 @@ namespace KE.Items.Items { [CustomItem(ItemType.GrenadeFlash)] - public class Molotov : KECustomGrenade, ISwichableEffect/*, ICustomPickupModel*/ + public class Molotov : KECustomGrenade, ISwichableEffect, ICustomPickupModel { public override uint Id { get; set; } = 1049; public override string Name { get; set; } = "Cocktail Molotov"; @@ -25,7 +25,7 @@ public class Molotov : KECustomGrenade, ISwichableEffect/*, ICustomPickupModel*/ public override bool ExplodeOnCollision { get; set; } = true; public Color Color { get; set; } = Color.yellow; public CustomItemEffect Effect { get; set; } - //public PickupModel PickupModel { get; } + public PickupModel PickupModel { get; } public override SpawnProperties SpawnProperties { get; set; } = new SpawnProperties() { Limit = 2, @@ -47,12 +47,12 @@ public class Molotov : KECustomGrenade, ISwichableEffect/*, ICustomPickupModel*/ public Molotov() { Effect = new MolotovEffect(); - //PickupModel = new MolotovPModel(this); + PickupModel = new MolotovPModel(this); } protected override void SubscribeEvents() { - //PickupModel.SubscribeEvents(); + PickupModel.SubscribeEvents(); Exiled.Events.Handlers.Player.ReceivingEffect += ReceivedEffect; Exiled.Events.Handlers.Player.PickingUpItem += PickingItem; base.SubscribeEvents(); @@ -60,7 +60,7 @@ protected override void SubscribeEvents() protected override void UnsubscribeEvents() { - //PickupModel.UnsubscribeEvents(); + PickupModel.UnsubscribeEvents(); Exiled.Events.Handlers.Player.ReceivingEffect -= ReceivedEffect; Exiled.Events.Handlers.Player.PickingUpItem -= PickingItem; base.UnsubscribeEvents(); diff --git a/KruacentExiled/KE.Items/Items/PickupModels/HolyGrenadePModel.cs b/KruacentExiled/KE.Items/Items/PickupModels/HolyGrenadePModel.cs index f47720bc..844d886a 100644 --- a/KruacentExiled/KE.Items/Items/PickupModels/HolyGrenadePModel.cs +++ b/KruacentExiled/KE.Items/Items/PickupModels/HolyGrenadePModel.cs @@ -1,4 +1,6 @@ -using KE.Items.API.Core.Models; +using Exiled.API.Features.Toys; +using Exiled.CustomItems.API.Features; +using KE.Items.API.Core.Models; using System; using System.Collections.Generic; using System.Linq; @@ -8,13 +10,36 @@ namespace KE.Items.Items.PickupModels { - public class HolyGrenade : PickupModel + public class HolyGrenadePModel : PickupModel { - public override float Scale => 0.1f; + public HolyGrenadePModel(CustomItem customItem) : base(customItem) + { + } + + private static Color32 red = new(255, 0, 0, 255); + private static Color32 gold = new(255, 215, 0, 255); + private static Color32 white = new(255, 255, 255, 255); + + + public override float Scale => 0.2f; protected override void CreateModel(Transform parent) { + + Primitive sphere = CreatePrimitive(parent, PrimitiveType.Sphere, Vector3.zero, Quaternion.identity, Vector3.one, white); + + Primitive gem = CreatePrimitive(parent, PrimitiveType.Sphere, new(0,0.8f,0), Quaternion.identity, new(.15f,.1f,.1f), red); + + Primitive crossV = CreatePrimitive(parent, PrimitiveType.Cube, new(0, 0.74f, 0), Quaternion.identity, new(.1f, .5f, .1f), white); + Primitive crossH = CreatePrimitive(parent, PrimitiveType.Cube, new(0, 0.8f, 0), Quaternion.identity, new(.1f, .1f, .37f), white); + + Primitive ring1 = CreatePrimitive(parent, PrimitiveType.Cylinder, Vector3.zero, Quaternion.Euler(90,0,0), new(1.05f, .05f, 1.05f), gold); + Primitive ring2 = CreatePrimitive(parent, PrimitiveType.Cylinder, Vector3.zero, Quaternion.identity, new(1.05f, .05f, 1.05f), gold); + Primitive ring3 = CreatePrimitive(parent, PrimitiveType.Cylinder, Vector3.zero, Quaternion.Euler(90, 90, 0), new(1.05f, .05f, 1.05f), gold); + + Primitive littleBase = CreatePrimitive(parent, PrimitiveType.Cylinder, new(0, 0.5f, 0), Quaternion.identity, new(.3f, .05f, .3f), gold); + } } } diff --git a/KruacentExiled/KE.Items/Items/PickupModels/MolotovPModel.cs b/KruacentExiled/KE.Items/Items/PickupModels/MolotovPModel.cs index ed188e88..0bb4546e 100644 --- a/KruacentExiled/KE.Items/Items/PickupModels/MolotovPModel.cs +++ b/KruacentExiled/KE.Items/Items/PickupModels/MolotovPModel.cs @@ -11,23 +11,17 @@ public class MolotovPModel : PickupModel { public MolotovPModel(CustomItem customItem) : base(customItem) { } - private static Color32 bottleColor = new Color32(110, 58, 13,230); - private static Color32 meche = new Color32(255, 255, 255,255); + private static Color32 bottleColor = new Color32(148, 37, 1,233); public override float Scale => .15f; protected override void CreateModel(Transform parent) { - Primitive base1 = CreatePrimitive(parent, PrimitiveType.Cylinder, Vector3.zero, Quaternion.identity, Vector3.one, bottleColor); - Primitive base2 = CreatePrimitive(parent, PrimitiveType.Cylinder, Vector3.up *1.25f, Quaternion.identity, new(0.7f,0.28f,0.7f), bottleColor); - Primitive base3 = CreatePrimitive(parent, PrimitiveType.Cylinder, Vector3.up *1.67f, Quaternion.identity, new(0.5f,0.3f,0.5f), bottleColor); - - Primitive empty = CreatePrimitive(parent, PrimitiveType.Sphere, new(0,2.4f,0.22f),Quaternion.identity,Vector3.one, meche); - empty.Visible = false; - - Primitive meche1 = CreatePrimitive(empty.Transform, PrimitiveType.Cylinder, new Vector3(0, -.36f, -.16f), Quaternion.Euler(28.3f, 0, 0), new(0.3f, .2f, .3f), meche); - Primitive meche2 = CreatePrimitive(empty.Transform, PrimitiveType.Cylinder, new Vector3(0, -.125f, .1f), Quaternion.Euler(62.5f, 0, 0), new(0.2f, .2f, .2f), meche); - Primitive meche3 = CreatePrimitive(empty.Transform, PrimitiveType.Cylinder, new Vector3(0, 0, -.44f), Quaternion.Euler(79.5f, 0, 0), new(0.1f, .2f, .1f), meche); + Primitive base1 = CreatePrimitive(parent, PrimitiveType.Cylinder, Vector3.up*.7f, Quaternion.identity, new(0.6f, 0.09f, 0.6f), bottleColor); + Primitive base2 = CreatePrimitive(parent, PrimitiveType.Cylinder, Vector3.down *.08f, Quaternion.identity, new(0.8f,0.7f,0.8f), bottleColor); + Primitive base3 = CreatePrimitive(parent, PrimitiveType.Cylinder, Vector3.up *.9f, Quaternion.identity, new(0.4f,0.1f,0.4f), bottleColor); + Primitive base4 = CreatePrimitive(parent, PrimitiveType.Cylinder, Vector3.up *1.4f, Quaternion.identity, new(0.3f,0.4f,0.3f), bottleColor); + Primitive base5 = CreatePrimitive(parent, PrimitiveType.Cylinder, Vector3.down *.8f, Quaternion.identity, new(0.6f,0.06f,0.6f), bottleColor); diff --git a/KruacentExiled/KE.Items/Items/PickupModels/Scp3136PModel.cs b/KruacentExiled/KE.Items/Items/PickupModels/Scp3136PModel.cs index e6c87981..3869f2fc 100644 --- a/KruacentExiled/KE.Items/Items/PickupModels/Scp3136PModel.cs +++ b/KruacentExiled/KE.Items/Items/PickupModels/Scp3136PModel.cs @@ -1,13 +1,6 @@ -/*using Exiled.API.Features; -using Exiled.API.Features.Toys; +using Exiled.API.Features.Toys; using Exiled.CustomItems.API.Features; -using KE.Items.API.Features; -using KE.Utils.API.Models.Blueprints; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; +using KE.Items.API.Core.Models; using UnityEngine; namespace KE.Items.Items.PickupModels @@ -17,23 +10,29 @@ public class Scp3136PModel : PickupModel public Scp3136PModel(CustomItem customItem) : base(customItem) { } - protected override bool HidePickup => true; + public override float Scale => .5f; - private static Vector3 paper = new Vector3(.5f, .1f, .5f); - private static Vector3 pen = new Vector3(.2f,.5f,.2f); - - protected override HashSet CreateModel() + protected override void CreateModel(Transform parent) { - HashSet model = new() - { - - new PrimitiveBlueprint(PrimitiveType.Cube,Vector3.zero,Quaternion.identity,Color.white,paper), - new PrimitiveBlueprint(PrimitiveType.Cylinder,new Vector3(paper.x, paper.y+pen.x*2,-paper.z),Quaternion.Euler(Vector3.left),Color.red,pen), - }; - return model; - + + + + + + Primitive land = CreatePrimitive(parent, PrimitiveType.Cube, Vector3.up * -0.035f,Quaternion.identity,Vector3.one,new Color32()); + land.Flags = AdminToys.PrimitiveFlags.None; + + + + #region land + + + + + #endregion + + } } } -*/ \ No newline at end of file diff --git a/KruacentExiled/KE.Items/Items/SainteGrenada.cs b/KruacentExiled/KE.Items/Items/SainteGrenada.cs index 4311bf62..c9638222 100644 --- a/KruacentExiled/KE.Items/Items/SainteGrenada.cs +++ b/KruacentExiled/KE.Items/Items/SainteGrenada.cs @@ -9,14 +9,16 @@ using Exiled.CustomItems.API.Features; using Exiled.Events.EventArgs.Map; using Exiled.Events.EventArgs.Player; +using KE.Items.API.Core.Models; using KE.Items.API.Features; using KE.Items.API.Interface; +using KE.Items.Items.PickupModels; using UnityEngine; namespace KE.Items.Items { [CustomItem(ItemType.GrenadeHE)] - public class SainteGrenada : KECustomGrenade, ILumosItem + public class SainteGrenada : KECustomGrenade, ICustomPickupModel { public override uint Id { get; set; } = 1055; public override string Name { get; set; } = "Sainte Grenada"; @@ -38,6 +40,28 @@ public class SainteGrenada : KECustomGrenade, ILumosItem }; + public PickupModel PickupModel { get; } + + + public SainteGrenada() + { + PickupModel = new HolyGrenadePModel(this); + } + + + protected override void SubscribeEvents() + { + PickupModel.SubscribeEvents(); + base.SubscribeEvents(); + } + + protected override void UnsubscribeEvents() + { + PickupModel.UnsubscribeEvents(); + base.UnsubscribeEvents(); + } + + protected override void OnThrownProjectile(ThrownProjectileEventArgs ev) { Utils.API.Sounds.SoundPlayer.Instance.Play("worms", ev.Projectile.GameObject, 50, 75); From 10448fc691e4d2256b94bf7cb097814d2d104804 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Wed, 28 Jan 2026 19:10:53 +0100 Subject: [PATCH 562/853] crazy fix --- KruacentExiled/KE.CustomRoles/CR/Human/Crazy.cs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/KruacentExiled/KE.CustomRoles/CR/Human/Crazy.cs b/KruacentExiled/KE.CustomRoles/CR/Human/Crazy.cs index 1a55fe3e..8b2ea5b1 100644 --- a/KruacentExiled/KE.CustomRoles/CR/Human/Crazy.cs +++ b/KruacentExiled/KE.CustomRoles/CR/Human/Crazy.cs @@ -27,7 +27,6 @@ public enum CrazyBehaviour Crazying } - [CustomRole(RoleTypeId.None)] internal class Crazy : GlobalCustomRole { private static CoroutineHandle _coroutines; @@ -124,7 +123,7 @@ private IEnumerator Crazying(Player player) float randomPitch = UnityEngine.Random.Range(-30f, 30f); Quaternion crazyRot = Quaternion.Euler(randomPitch, randomYaw, 0f); - player.ReferenceHub.transform.localRotation = crazyRot; + player.Rotation = crazyRot; for (int i = 0; i < 5; i++) { @@ -132,7 +131,7 @@ private IEnumerator Crazying(Player player) float shakePitch = UnityEngine.Random.Range(-5f, 5f); Quaternion shakeRot = Quaternion.Euler(shakePitch, shakeYaw, 0f); - player.ReferenceHub.transform.localRotation *= shakeRot; + player.Rotation *= shakeRot; yield return Timing.WaitForSeconds(0.05f); timer += 0.05f; From 206db80efc3a0b6442c1a4a8cc0ce4cd2e5b9db9 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Wed, 28 Jan 2026 19:22:04 +0100 Subject: [PATCH 563/853] scp buff now change by the scp type --- KruacentExiled/KE.Misc/Features/SCPBuff.cs | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/KruacentExiled/KE.Misc/Features/SCPBuff.cs b/KruacentExiled/KE.Misc/Features/SCPBuff.cs index 97ee98a5..d6f9693c 100644 --- a/KruacentExiled/KE.Misc/Features/SCPBuff.cs +++ b/KruacentExiled/KE.Misc/Features/SCPBuff.cs @@ -20,6 +20,16 @@ public class SCPBuff : IUsingEvents { public const float RefreshRate = 1f; public float IncreaseSCPHealth { get; } = 1.25f; + + public Dictionary RoleBuff = new() + { + {RoleTypeId.Scp049, 0.8f }, + {RoleTypeId.Scp939, 1.2f }, + {RoleTypeId.Scp106, 1.1f }, + + }; + + internal SCPBuff() { } public static event Action OnBuffingSCP = delegate { }; @@ -51,17 +61,23 @@ private void BecomingSCP(ChangingRoleEventArgs ev) Player player = ev.Player; if (!ev.NewRole.IsScp() || ev.NewRole == RoleTypeId.Scp0492) return; if(player.Role == RoleTypeId.None) return; - BuffingSCPEventArgs ev1 = new(player, true, IncreaseSCPHealth); + float healthincrease = IncreaseSCPHealth; + if(RoleBuff.TryGetValue(ev.NewRole,out float val)) + { + healthincrease *= val; + } + BuffingSCPEventArgs ev1 = new(player, true, healthincrease); + OnBuffingSCP?.Invoke(ev1); if (ev1.IsAllowed) { Timing.CallDelayed(2, () => { - player.MaxHealth *= IncreaseSCPHealth; + player.MaxHealth *= healthincrease; player.Health = player.MaxHealth; }); - BuffedSCPEventArgs ev2 = new(player, IncreaseSCPHealth); + BuffedSCPEventArgs ev2 = new(player, healthincrease); OnBuffedSCP?.Invoke(ev2); } From 7b140f1dddec8a6af0ba81400ac6cb25ec9f6e97 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Wed, 28 Jan 2026 19:26:34 +0100 Subject: [PATCH 564/853] fix 035 --- .../KE.CustomRoles/CR/CustomSCPs/SCP035.cs | 26 ++++++++++++------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP035.cs b/KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP035.cs index 3f1c1d95..ffb83387 100644 --- a/KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP035.cs +++ b/KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP035.cs @@ -3,6 +3,7 @@ using Exiled.API.Enums; using Exiled.API.Extensions; using Exiled.API.Features; +using Exiled.API.Features.Pickups; using Exiled.API.Features.Pools; using Exiled.CustomItems.API.Features; using Exiled.Events.EventArgs.Player; @@ -48,6 +49,10 @@ public class SCP035 : CustomSCP ItemType.Medkit, ItemType.SCP500, }; + public HashSet WhitelistUsing = new() + { + ItemType.SCP1853, + }; // 035 can't be damaged by these public HashSet BlacklistedDamage = new() @@ -94,7 +99,6 @@ protected override void RoleAdded(Player player) PlayerDisplay dis = PlayerDisplay.Get(player); DisplayHandler.Instance.CreateAuto(player, (args) => GetPlayers(args), position.HintPlacement); - player.VoiceChannel = VoiceChat.VoiceChatChannel.ScpChat; player.Position = RoleTypeId.Scp049.GetRandomSpawnLocation().Position; player.EnableEffect(100, 0, false); base.RoleAdded(player); @@ -129,34 +133,38 @@ private void OnUsingItem(UsingItemEventArgs ev) private void OnSearchingPickup(SearchingPickupEventArgs ev) { + Player player = ev.Player; + Pickup pickup = ev.Pickup; if (!Check(ev.Player)) return; + + CustomItem item = null; - CustomItem.TryGet(ev.Pickup, out item); + CustomItem.TryGet(pickup, out item); if(item is not null) { if(item.Id == 1050 || item.Id == 1047) { - ShowEffectHint(ev.Player, CantPickup); + ShowEffectHint(player, CantPickup); ev.IsAllowed = false; return; } } - if (ev.Pickup.Type.IsScp()) + if (pickup.Type.IsScp() && !WhitelistUsing.Contains(pickup.Type)) { - ShowEffectHint(ev.Player, CantPickup); + ShowEffectHint(player, CantPickup); ev.IsAllowed = false; return; } - if (ev.Pickup.Type == ItemType.GunSCP127) + if (pickup.Type == ItemType.GunSCP127) { - ShowEffectHint(ev.Player, CantPickup); + ShowEffectHint(player, CantPickup); ev.IsAllowed = false; return; } @@ -165,9 +173,9 @@ private void OnSearchingPickup(SearchingPickupEventArgs ev) - if (BlacklistedPickup.Contains(ev.Pickup.Type)) + if (BlacklistedPickup.Contains(pickup.Type)) { - ShowEffectHint(ev.Player, CantPickup); + ShowEffectHint(player, CantPickup); ev.IsAllowed = false; return; From 017f04a01408754f6ef6876702476e1f0939d77a Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Wed, 28 Jan 2026 19:37:49 +0100 Subject: [PATCH 565/853] typo --- KruacentExiled/KE.Items/Items/ProximityGrenade.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/KruacentExiled/KE.Items/Items/ProximityGrenade.cs b/KruacentExiled/KE.Items/Items/ProximityGrenade.cs index 4683d319..a207265e 100644 --- a/KruacentExiled/KE.Items/Items/ProximityGrenade.cs +++ b/KruacentExiled/KE.Items/Items/ProximityGrenade.cs @@ -15,7 +15,7 @@ public class ProximityGrenade : KECustomGrenade, ISwichableEffect { public override uint Id { get; set; } = 1073; public override string Name { get; set; } = "Proximity Grenade"; - public override string Description { get; set; } = "It will show line to all players arround 3 rooms"; + public override string Description { get; set; } = "Show lines to all players around 3 rooms"; public override float Weight { get; set; } = 0.65f; public override float FuseTime { get; set; } = 3f; public override bool ExplodeOnCollision { get; set; } = false; From c178edff2c21f7e2078b670cf8119b276e57ca4e Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Wed, 28 Jan 2026 20:19:54 +0100 Subject: [PATCH 566/853] bulk door auto close --- KruacentExiled/KE.Map/Heavy/BulkDoor049.cs | 60 +++++++++++++++++----- 1 file changed, 46 insertions(+), 14 deletions(-) diff --git a/KruacentExiled/KE.Map/Heavy/BulkDoor049.cs b/KruacentExiled/KE.Map/Heavy/BulkDoor049.cs index 6855a600..ec70d992 100644 --- a/KruacentExiled/KE.Map/Heavy/BulkDoor049.cs +++ b/KruacentExiled/KE.Map/Heavy/BulkDoor049.cs @@ -1,20 +1,18 @@ using Exiled.API.Enums; using Exiled.API.Features; -using Exiled.API.Features.Doors; using Interactables.Interobjects.DoorUtils; using KE.Utils.API.Map; +using MEC; using System; using System.Collections.Generic; using System.Linq; -using System.Text; -using System.Threading.Tasks; using UnityEngine; namespace KE.Map.Heavy { public static class BulkDoor049 { - + private static DoorVariant door; public static void Create() { @@ -29,24 +27,58 @@ public static void Create() - DoorVariant door = StructureSpawner.SpawnDoor(ProjectMER.Features.Enums.DoorType.HeavyBulkDoor, worldpos, room.Rotation * rot , Vector3.one,ZoneType.HeavyContainment); + door = StructureSpawner.SpawnDoor(ProjectMER.Features.Enums.DoorType.HeavyBulkDoor, worldpos, room.Rotation * rot , Vector3.one,ZoneType.HeavyContainment); - Door doorExiled = Door.Get(door); - foreach(var k in StructureSpawner.AdditionalDoors) - { - Log.Debug(k.Key); - foreach(DoorVariant doorv in k.Value) - { - Log.Debug(doorv); - } - } + door.OnStateChanged += Door_OnStateChanged; + + DoorVariant.OnInstanceRemoved += DoorVariant_OnInstanceRemoved; + Log.Debug("spawn 049 bulk door at "+ worldpos); } + private static void DoorVariant_OnInstanceRemoved(DoorVariant obj) + { + door.OnStateChanged -= Door_OnStateChanged; + DoorVariant.OnInstanceRemoved -= DoorVariant_OnInstanceRemoved; + } + + public const float IdleDuration = 20f; + private static float duration = IdleDuration; + public const float RefreshRate = 1f; + private static void Door_OnStateChanged() + { + if (door.NetworkTargetState) + { + Timing.RunCoroutine(AutoClose()); + } + + } + + private static IEnumerator AutoClose() + { + duration = IdleDuration; + while (duration > 0) + { + if (!door.NetworkTargetState) + { + yield break; + } + duration -= RefreshRate; + Log.Info(duration); + if (duration <= 0) + { + Log.Info("auto close"); + door.NetworkTargetState = false; + duration = IdleDuration; + } + yield return Timing.WaitForSeconds(RefreshRate); + + } + } } } From 978e8690c19f335add2d0bc923fd09f8fe82dd4e Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Thu, 29 Jan 2026 04:39:43 +0100 Subject: [PATCH 567/853] loS + added debug line --- .../KE.CustomRoles/Abilities/Convert.cs | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/KruacentExiled/KE.CustomRoles/Abilities/Convert.cs b/KruacentExiled/KE.CustomRoles/Abilities/Convert.cs index 0cc13456..15755ea3 100644 --- a/KruacentExiled/KE.CustomRoles/Abilities/Convert.cs +++ b/KruacentExiled/KE.CustomRoles/Abilities/Convert.cs @@ -1,4 +1,5 @@ -using Exiled.API.Features; +using DrawableLine; +using Exiled.API.Features; using Exiled.API.Features.Attributes; using Exiled.API.Features.Toys; using Exiled.CustomRoles.API.Features; @@ -29,17 +30,28 @@ public class Convert : KEAbilities, ICustomIcon public Utils.API.GifAnimator.TextImage IconName => MainPlugin.Instance.icons["Convert"]; protected override bool AbilityUsed(Player player) { - if (!Physics.Raycast(player.Position+ player.CameraTransform.rotation *Vector3.forward, player.Rotation.eulerAngles, out RaycastHit hit)) return false; + Vector3 start = player.CameraTransform.position+ player.CameraTransform.forward*.2f; + Vector3 end = start + player.CameraTransform.forward * 5f; + + Vector3 basePosition = player.Position + player.CameraTransform.rotation * Vector3.forward; + DrawableLines.IsDebugModeEnabled = MainPlugin.Instance.Config.Debug; + DrawableLines.ServerGenerateLine(10f,null,start, end); + + + + + if (!Physics.Linecast(start, end, out RaycastHit hit)) return false; Player playerHit = Player.Get(hit.collider); - if (playerHit == null) + if (playerHit == null || playerHit == player) { MainPlugin.ShowEffectHint(player, "But nobody's here"); return false; } + if (playerHit.Role.Side == player.Role.Side) { MainPlugin.ShowEffectHint(player, "I know you don't like them but they're in your team"); From 604048423c2ea1933dfa98311ba1014eac064f3a Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Thu, 29 Jan 2026 17:39:15 +0100 Subject: [PATCH 568/853] remove smoothing to avoid lag --- KruacentExiled/KE.Items/Items/ShieldBelt/ShieldBeltStat.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/KruacentExiled/KE.Items/Items/ShieldBelt/ShieldBeltStat.cs b/KruacentExiled/KE.Items/Items/ShieldBelt/ShieldBeltStat.cs index 765939a7..832f3799 100644 --- a/KruacentExiled/KE.Items/Items/ShieldBelt/ShieldBeltStat.cs +++ b/KruacentExiled/KE.Items/Items/ShieldBelt/ShieldBeltStat.cs @@ -144,9 +144,10 @@ private Primitive CreatePrimitive(Player player) prim.Transform.localPosition = Vector3.zero; prim.Scale = MaxSize; prim.Color = new Color32(50, 50, 50, 50); + prim.MovementSmoothing = 0; prim.Spawn(); - + model.Create(prim.Transform); From 2f7208d332f51d78875234b8f5dc8f3a1c87c6f3 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Thu, 29 Jan 2026 18:26:17 +0100 Subject: [PATCH 569/853] reduce damage mine --- .../KE.Items/Items/ItemEffects/MineEffect.cs | 21 ++++++++++++------- KruacentExiled/KE.Items/Items/PressePuree.cs | 3 ++- 2 files changed, 16 insertions(+), 8 deletions(-) diff --git a/KruacentExiled/KE.Items/Items/ItemEffects/MineEffect.cs b/KruacentExiled/KE.Items/Items/ItemEffects/MineEffect.cs index c2008db8..0cc6cd66 100644 --- a/KruacentExiled/KE.Items/Items/ItemEffects/MineEffect.cs +++ b/KruacentExiled/KE.Items/Items/ItemEffects/MineEffect.cs @@ -5,6 +5,7 @@ using Exiled.API.Interfaces; using Exiled.Events.EventArgs.Map; using Exiled.Events.EventArgs.Player; +using KE.Items.API.Events; using KE.Items.API.Extensions; using KE.Items.API.Interface; using KE.Items.Items.Models; @@ -40,16 +41,21 @@ public override void Effect(ExplodingGrenadeEventArgs ev) public void SubscribeEvents() { - Exiled.Events.Handlers.Map.ExplodingGrenade += OnExplodingGrenade; + ExplodeEvent.ExplodeDestructible += OnExplodeDestructible; } - public void UnsubscribeEvents() - { + private void OnExplodeDestructible(OnExplodeDestructibleEventsArgs obj) + { + if (obj.ExplosionGrenade == Grenade.Projectile.Base) + { + obj.Damage = 100; + + } } - private void OnExplodingGrenade(ExplodingGrenadeEventArgs ev) + public void UnsubscribeEvents() { - + ExplodeEvent.ExplodeDestructible -= OnExplodeDestructible; } /// @@ -90,9 +96,10 @@ private ExplosiveGrenade Grenade if (_grenade == null) { _grenade = (ExplosiveGrenade)Item.Create(ItemType.GrenadeHE); - _grenade.MaxRadius = 3; - _grenade.ScpDamageMultiplier = 1f; + _grenade.MaxRadius = 1; + _grenade.ScpDamageMultiplier = .25f; _grenade.FuseTime = 0f; + } return _grenade; } diff --git a/KruacentExiled/KE.Items/Items/PressePuree.cs b/KruacentExiled/KE.Items/Items/PressePuree.cs index 38dc412d..e9ff924e 100644 --- a/KruacentExiled/KE.Items/Items/PressePuree.cs +++ b/KruacentExiled/KE.Items/Items/PressePuree.cs @@ -78,7 +78,7 @@ protected override void UnsubscribeEvents() private void OnExplodeDestructible(OnExplodeDestructibleEventsArgs ev) { - Log.Info(ev.Damage); + Log.Debug("old dmagea="+ev.Damage); Player player = Player.Get(ev.Destructible.NetworkId); if (!Check(Projectile.Get(ev.ExplosionGrenade))) return; if (ev.Damage < 0f) return; @@ -91,6 +91,7 @@ private void OnExplodeDestructible(OnExplodeDestructibleEventsArgs ev) ev.Damage /= 3; } + Log.Debug("new daamager="+ev.Damage); } From dc603e71d8a5af085d38dcc300ee0aa75d50cb3d Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Thu, 29 Jan 2026 18:26:30 +0100 Subject: [PATCH 570/853] corrected random divines pills --- .../KE.Items/Items/ItemEffects/DivinePillsEffect.cs | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/KruacentExiled/KE.Items/Items/ItemEffects/DivinePillsEffect.cs b/KruacentExiled/KE.Items/Items/ItemEffects/DivinePillsEffect.cs index a999f230..11956d1f 100644 --- a/KruacentExiled/KE.Items/Items/ItemEffects/DivinePillsEffect.cs +++ b/KruacentExiled/KE.Items/Items/ItemEffects/DivinePillsEffect.cs @@ -39,15 +39,12 @@ private void EffectItem(Player player, IDeniableEvent ev = null) if (Player.List.Count(x => x.Role == RoleTypeId.Spectator) == 0) { player.ItemEffectHint("No spectators to respawn"); - /* - could be used for a deniable event - if(ev != null) - ev.IsAllowed = false; - */ return; } var random = Random.Range(0, 100); - if (random <= 25) + + + if (random < 25) { player.Kill("unlucky bro"); return; From 8f0a95ce5611b620697a14705a1f9f3da6104b01 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Thu, 29 Jan 2026 18:26:40 +0100 Subject: [PATCH 571/853] reduced light molotov --- .../KE.Items/Items/ItemEffects/MolotovEffect.cs | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/KruacentExiled/KE.Items/Items/ItemEffects/MolotovEffect.cs b/KruacentExiled/KE.Items/Items/ItemEffects/MolotovEffect.cs index 3624a223..ab5e05f9 100644 --- a/KruacentExiled/KE.Items/Items/ItemEffects/MolotovEffect.cs +++ b/KruacentExiled/KE.Items/Items/ItemEffects/MolotovEffect.cs @@ -75,18 +75,14 @@ private void SpawnMolotov(Player owner, Vector3 centerPos) List fireLights = new List(); Color fireColor = new Color(255, 128, 0); - fireLights.Add(CreateLight(centerPos + Vector3.up * 0.5f, fireColor, Radius * 2f, 0.2f)); - - float spread = Radius * 0.5f; - fireLights.Add(CreateLight(centerPos + new Vector3(-spread, 0.5f, 0), fireColor, Radius, 0.2f)); - fireLights.Add(CreateLight(centerPos + new Vector3(0, 0.5f, spread), fireColor, Radius, 0.2f)); - + fireLights.Add(CreateLight(centerPos + Vector3.up * 0.5f, fireColor, Radius /2f, 0.2f)); Timing.RunCoroutine(Fire(jarPickup, dangerZone, fireLights, owner, centerPos)); } private Light CreateLight(Vector3 pos, Color col, float range, float intensity) { Light l = Light.Create(pos,spawn:false); + l.LightType = LightType.Point; l.Color = col; l.Range = range; l.Intensity = intensity; From 45be90a155473f0d679f77699225291bb26ed875 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Thu, 29 Jan 2026 18:28:39 +0100 Subject: [PATCH 572/853] fix random + tp --- .../KE.Items/Items/ItemEffects/DivinePillsEffect.cs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/KruacentExiled/KE.Items/Items/ItemEffects/DivinePillsEffect.cs b/KruacentExiled/KE.Items/Items/ItemEffects/DivinePillsEffect.cs index 11956d1f..6a75e5cb 100644 --- a/KruacentExiled/KE.Items/Items/ItemEffects/DivinePillsEffect.cs +++ b/KruacentExiled/KE.Items/Items/ItemEffects/DivinePillsEffect.cs @@ -7,6 +7,7 @@ using Exiled.Events.EventArgs.Player; using KE.Items.API.Extensions; using KE.Items.API.Interface; +using MEC; using PlayerRoles; using System.Linq; using Random = UnityEngine.Random; @@ -60,10 +61,11 @@ private void EffectItem(Player player, IDeniableEvent ev = null) break; } - if (random > 75) + if (random >= 75) { Log.Debug("tp"); - respawning.Teleport(player); + Timing.CallDelayed(1, () =>respawning.Teleport(player)); + } } } From af31e47588eed9c5e84b22ac5b7b9399646e03e8 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Thu, 29 Jan 2026 19:00:27 +0100 Subject: [PATCH 573/853] added events to gambling coins --- .../GambledEventArgs.cs | 39 +++++++++++++++++++ .../GamblingEventArgs.cs | 26 +++++++++++++ .../KE.Misc/Events/Handlers/GamblingCoins.cs | 34 ++++++++++++++++ .../Features/GamblingCoin/EventHandlers.cs | 25 +++++++++++- 4 files changed, 122 insertions(+), 2 deletions(-) create mode 100644 KruacentExiled/KE.Misc/Events/EventsArgs/GamblingCoinsEventArgs/GambledEventArgs.cs create mode 100644 KruacentExiled/KE.Misc/Events/EventsArgs/GamblingCoinsEventArgs/GamblingEventArgs.cs create mode 100644 KruacentExiled/KE.Misc/Events/Handlers/GamblingCoins.cs diff --git a/KruacentExiled/KE.Misc/Events/EventsArgs/GamblingCoinsEventArgs/GambledEventArgs.cs b/KruacentExiled/KE.Misc/Events/EventsArgs/GamblingCoinsEventArgs/GambledEventArgs.cs new file mode 100644 index 00000000..56715639 --- /dev/null +++ b/KruacentExiled/KE.Misc/Events/EventsArgs/GamblingCoinsEventArgs/GambledEventArgs.cs @@ -0,0 +1,39 @@ +using Exiled.API.Features; +using Exiled.API.Features.Items; +using Exiled.Events.EventArgs.Interfaces; +using KE.Misc.Features.GamblingCoin.Interfaces; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace KE.Misc.Events.EventsArgs.GamblingCoinsEventArgs +{ + public class GambledEventArgs : IExiledEvent, IPlayerEvent, IItemEvent + { + /// + /// can be null + /// + public Item Item { get; } + public Player Player { get; } + + public bool CoinBroke { get; } + + public ICoinEffect Effect { get; } + + /// + /// no effect if the coins is broken + /// + public int RemainingUses { get; set; } + + public GambledEventArgs(Player player, Item item,ICoinEffect effect,int remaining,bool coinBroke) + { + Player = player; + CoinBroke = coinBroke; + Item = item; + Effect = effect; + RemainingUses = remaining; + } + } +} diff --git a/KruacentExiled/KE.Misc/Events/EventsArgs/GamblingCoinsEventArgs/GamblingEventArgs.cs b/KruacentExiled/KE.Misc/Events/EventsArgs/GamblingCoinsEventArgs/GamblingEventArgs.cs new file mode 100644 index 00000000..9e1f7624 --- /dev/null +++ b/KruacentExiled/KE.Misc/Events/EventsArgs/GamblingCoinsEventArgs/GamblingEventArgs.cs @@ -0,0 +1,26 @@ +using Exiled.API.Features; +using Exiled.API.Features.Items; +using Exiled.Events.EventArgs.Interfaces; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace KE.Misc.Events.EventsArgs.GamblingCoinsEventArgs +{ + public class GamblingEventArgs : IExiledEvent, IPlayerEvent, IItemEvent, IDeniableEvent + { + + public Item Item { get; } + public Player Player { get; } + public bool IsAllowed { get; set; } + + public GamblingEventArgs(Player player, Item item,bool isAllowed = true) + { + Item = item; + Player = player; + IsAllowed = isAllowed; + } + } +} diff --git a/KruacentExiled/KE.Misc/Events/Handlers/GamblingCoins.cs b/KruacentExiled/KE.Misc/Events/Handlers/GamblingCoins.cs new file mode 100644 index 00000000..443532f8 --- /dev/null +++ b/KruacentExiled/KE.Misc/Events/Handlers/GamblingCoins.cs @@ -0,0 +1,34 @@ +using Exiled.Events.Features; +using KE.Misc.Events.EventsArgs.GamblingCoinsEventArgs; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace KE.Misc.Events.Handlers +{ + public static class GamblingCoins + { + + + + public static Event Gambling = new(); + public static Event Gambled = new(); + + + + + + public static void OnGambling(GamblingEventArgs ev) + { + Gambling?.InvokeSafely(ev); + } + + public static void OnGambled(GambledEventArgs ev) + { + Gambled?.InvokeSafely(ev); + } + + } +} diff --git a/KruacentExiled/KE.Misc/Features/GamblingCoin/EventHandlers.cs b/KruacentExiled/KE.Misc/Features/GamblingCoin/EventHandlers.cs index b344417e..f162f7c9 100644 --- a/KruacentExiled/KE.Misc/Features/GamblingCoin/EventHandlers.cs +++ b/KruacentExiled/KE.Misc/Features/GamblingCoin/EventHandlers.cs @@ -1,8 +1,10 @@ using System; using System.Collections.Generic; using Exiled.API.Features; +using Exiled.API.Features.Items; using Exiled.CustomItems.API.Features; using Exiled.Events.EventArgs.Player; +using KE.Misc.Events.EventsArgs.GamblingCoinsEventArgs; using KE.Misc.Features.GamblingCoin.Interfaces; using KE.Misc.Features.GamblingCoin.Types; using MEC; @@ -18,7 +20,17 @@ public class EventHandlers public void OnCoinFlip(FlippingCoinEventArgs ev) { - if (CustomItem.TryGet(ev.Item, out _)) return; + Player player = ev.Player; + Item item = ev.Item; + + if (CustomItem.TryGet(item, out _)) return; + + + GamblingEventArgs ev1 = new(ev.Player, item, true); + + Events.Handlers.GamblingCoins.OnGambling(ev1); + + if (!ev1.IsAllowed) return; if (_cooldowns.TryGetValue(ev.Player.UserId, out var lastFlip) && (DateTime.UtcNow - lastFlip).TotalSeconds < Config.GamblingCoinCooldown) @@ -30,6 +42,7 @@ public void OnCoinFlip(FlippingCoinEventArgs ev) _cooldowns[ev.Player.UserId] = DateTime.UtcNow; + if (!CoinUses.ContainsKey(ev.Player.CurrentItem.Serial)) { CoinUses[ev.Player.CurrentItem.Serial] = UnityEngine.Random.Range(Config.GamblingCoinMinUse, Config.GamblingCoinMaxUse); @@ -39,7 +52,9 @@ public void OnCoinFlip(FlippingCoinEventArgs ev) CoinUses[ev.Player.CurrentItem.Serial]--; - bool shouldBreak = CoinUses[ev.Player.CurrentItem.Serial] <= 0; + int remainingUses = CoinUses[ev.Player.CurrentItem.Serial]; + + bool shouldBreak = remainingUses <= 0; EffectType type = ev.IsTails ? EffectType.Negative : EffectType.Positive; @@ -77,7 +92,13 @@ public void OnCoinFlip(FlippingCoinEventArgs ev) CoinUses.Remove(ev.Player.CurrentItem.Serial); ev.Player.RemoveHeldItem(); ev.Player.Broadcast(5, "no more coin"); + item = null; } + GambledEventArgs ev2 = new(ev.Player, item, effect, remainingUses, shouldBreak); + + Events.Handlers.GamblingCoins.OnGambled(ev2); + + CoinUses[ev.Player.CurrentItem.Serial] = ev2.RemainingUses; } } } \ No newline at end of file From 6317405b1ec8fcc9602881dfb9059ceff01151ac Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Thu, 29 Jan 2026 19:14:56 +0100 Subject: [PATCH 574/853] increase weight scp --- .../KE.Map/Others/BlackoutNDoor/Handlers/Handler.cs | 2 +- .../KE.Map/Others/BlackoutNDoor/Handlers/Pattern.cs | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/KruacentExiled/KE.Map/Others/BlackoutNDoor/Handlers/Handler.cs b/KruacentExiled/KE.Map/Others/BlackoutNDoor/Handlers/Handler.cs index f328d530..da916b4c 100644 --- a/KruacentExiled/KE.Map/Others/BlackoutNDoor/Handlers/Handler.cs +++ b/KruacentExiled/KE.Map/Others/BlackoutNDoor/Handlers/Handler.cs @@ -30,7 +30,7 @@ public class Handler : IUsingEvents }; private ZoneType currentScpZone = ZoneType.Unspecified; - private int weightPerSeconds = 2; + private int weightPerSeconds = 5; private int weight = defaultWeight; private const int defaultWeight = 330; diff --git a/KruacentExiled/KE.Map/Others/BlackoutNDoor/Handlers/Pattern.cs b/KruacentExiled/KE.Map/Others/BlackoutNDoor/Handlers/Pattern.cs index f690b7d6..561dc239 100644 --- a/KruacentExiled/KE.Map/Others/BlackoutNDoor/Handlers/Pattern.cs +++ b/KruacentExiled/KE.Map/Others/BlackoutNDoor/Handlers/Pattern.cs @@ -70,6 +70,11 @@ public MapEvent GetNext() return _pattern[current]; } + public MapEvent SeeNext() + { + return _pattern[(current + 1) % _pattern.Count]; + } + From 1b74a5b46c61fc07a73fc0488fa788736a67b96f Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Thu, 29 Jan 2026 19:43:44 +0100 Subject: [PATCH 575/853] fixed crash if nobody is to spectate --- .../KE.CustomRoles/API/Features/KECustomRole.cs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/KruacentExiled/KE.CustomRoles/API/Features/KECustomRole.cs b/KruacentExiled/KE.CustomRoles/API/Features/KECustomRole.cs index 3283ba81..de34c85c 100644 --- a/KruacentExiled/KE.CustomRoles/API/Features/KECustomRole.cs +++ b/KruacentExiled/KE.CustomRoles/API/Features/KECustomRole.cs @@ -255,9 +255,15 @@ public static string CurrentRole(Player player) } } + string result = StringBuilderPool.Pool.ToStringReturn(sb); + + if (string.IsNullOrEmpty(result)) + { + result = " "; + } - return StringBuilderPool.Pool.ToStringReturn(sb); + return result; } private static Player GetSpectatingPlayer(Player spectator) From 1fcee710823ec37c496a14f93f190e6694348b86 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Thu, 29 Jan 2026 20:23:44 +0100 Subject: [PATCH 576/853] added config scp buff --- KruacentExiled/KE.Misc/Config.cs | 8 ++++++++ KruacentExiled/KE.Misc/Features/SCPBuff.cs | 7 ++++--- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/KruacentExiled/KE.Misc/Config.cs b/KruacentExiled/KE.Misc/Config.cs index e30b3f87..6b0b9f88 100644 --- a/KruacentExiled/KE.Misc/Config.cs +++ b/KruacentExiled/KE.Misc/Config.cs @@ -28,6 +28,14 @@ public class Config : IConfig public int GamblingCoinMaxUse { get; set; } = 2; public int GamblingCoinCooldown { get; set; } = 3; + + public float MultSCP049 { get; set; } = 0.8f; + public float MultSCP939 { get; set; } = 1.2f; + public float MultSCP106 { get; set; } = 1.1f; public int MinPlayerVote { get; set; } = 6; + + + + } } diff --git a/KruacentExiled/KE.Misc/Features/SCPBuff.cs b/KruacentExiled/KE.Misc/Features/SCPBuff.cs index d6f9693c..d6af7ebe 100644 --- a/KruacentExiled/KE.Misc/Features/SCPBuff.cs +++ b/KruacentExiled/KE.Misc/Features/SCPBuff.cs @@ -20,12 +20,13 @@ public class SCPBuff : IUsingEvents { public const float RefreshRate = 1f; public float IncreaseSCPHealth { get; } = 1.25f; + private static Config Config => MainPlugin.Instance.Config; public Dictionary RoleBuff = new() { - {RoleTypeId.Scp049, 0.8f }, - {RoleTypeId.Scp939, 1.2f }, - {RoleTypeId.Scp106, 1.1f }, + {RoleTypeId.Scp049, Config.MultSCP049 }, + {RoleTypeId.Scp939, Config.MultSCP939 }, + {RoleTypeId.Scp106, Config.MultSCP106 }, }; From 369b3cec4b5df3c15bf77ec9b5029f63116bfcb4 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Mon, 2 Feb 2026 07:45:05 +0100 Subject: [PATCH 577/853] custom glass & door woooooooo --- KruacentExiled/KE.Map/MainPlugin.cs | 39 ++++++++++++++++++++++------- 1 file changed, 30 insertions(+), 9 deletions(-) diff --git a/KruacentExiled/KE.Map/MainPlugin.cs b/KruacentExiled/KE.Map/MainPlugin.cs index f328eac1..870587a1 100644 --- a/KruacentExiled/KE.Map/MainPlugin.cs +++ b/KruacentExiled/KE.Map/MainPlugin.cs @@ -1,22 +1,17 @@  +using AdminToys; using Exiled.API.Extensions; using Exiled.API.Features; +using Exiled.API.Features.Toys; using Exiled.API.Interfaces; -using Exiled.Events.EventArgs.Player; using HarmonyLib; -using KE.Map.CustomZones; -using KE.Map.CustomZones.CustomRooms.MCZ; using KE.Map.Heavy; using KE.Map.Heavy.GamblingZone; using KE.Map.Others.BlackoutNDoor.Handlers; -using KE.Utils.API.GifAnimator; -using LabApi.Events.Arguments.ServerEvents; -using MapGeneration; using MEC; using PlayerRoles; -using System; +using PlayerRoles.PlayableScps.Scp106; using System.Collections.Generic; -using System.Drawing; using System.Linq; using UnityEngine; using Door = Exiled.API.Features.Doors.Door; @@ -72,9 +67,35 @@ private void OnRoundStarted() { //player.Teleport(teleport); }); + + Vector3 pos = RoleTypeId.Scp049.GetRandomSpawnLocation().Position; + + + Primitive prim = Primitive.Create(PrimitiveType.Cube, pos, spawn: false); + + prim.Base.gameObject.layer = 14; + prim.Spawn(); + + + + + Collider col = prim.Base.gameObject.GetComponent(); + + + //glass or door w/glass => fake to 106s & 173s & 049-2s & 049s & 096s & ghostly + //door w/out glass => fake to 106s & ghostly + + MirrorExtensions.SendFakeSyncVar(player, prim.Base.netIdentity,typeof(PrimitiveObjectToy), "NetworkPrimitiveFlags", PrimitiveFlags.Visible); + + + Log.Info(prim.Base.gameObject.layer); + Log.Info(LayerMask.LayerToName(14)); + + Log.Info(Scp106MovementModule.GetSlowdownFromCollider(col, out bool passable) + " passable?" + passable); + } - + } From 00978125f0828279e0a3cbb8ae2b7d3d19916a5e Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Tue, 3 Feb 2026 11:22:18 +0100 Subject: [PATCH 578/853] last human random text --- .../Features/LastHuman/LastHumanHandler.cs | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/KruacentExiled/KE.Misc/Features/LastHuman/LastHumanHandler.cs b/KruacentExiled/KE.Misc/Features/LastHuman/LastHumanHandler.cs index fb379ee0..1560f037 100644 --- a/KruacentExiled/KE.Misc/Features/LastHuman/LastHumanHandler.cs +++ b/KruacentExiled/KE.Misc/Features/LastHuman/LastHumanHandler.cs @@ -11,6 +11,7 @@ using LabApi.Events.Arguments.PlayerEvents; using PlayerRoles; using PlayerRoles.FirstPersonControl.Thirdperson; +using System.Collections.Generic; using System.Linq; namespace KE.Misc.Features.LastHuman @@ -18,8 +19,13 @@ namespace KE.Misc.Features.LastHuman public class LastHumanHandler : IUsingEvents { - public static readonly string TextLast1 = "You feel like everyone is counting on you"; - public static readonly string TextLast2 = "You feel suddenly very lonely"; + + private static readonly IReadOnlyCollection TextLast = new HashSet() + { + "You feel like everyone is counting on you", + "You feel suddenly very lonely" + }; + public static HintPosition position = new LastHumanPosition(); @@ -67,11 +73,7 @@ private void OnChangedRole(PlayerChangedRoleEventArgs ev) string msg = string.Empty; if (player == lastTarget) { - msg = TextLast1; - if (UnityEngine.Random.Range(1, 3) % 2 == 0) - { - msg = TextLast2; - } + msg = TextLast.GetRandomValue(); } else if(!player.IsDead) { From f48589c7559666f69dc3fe3fdf0ab296b7b1945b Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Wed, 4 Feb 2026 18:02:19 +0100 Subject: [PATCH 579/853] upfate --- .../KE.CustomRoles/Abilities/FireAbilities/FireStat.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/KruacentExiled/KE.CustomRoles/Abilities/FireAbilities/FireStat.cs b/KruacentExiled/KE.CustomRoles/Abilities/FireAbilities/FireStat.cs index 36265571..cca97c99 100644 --- a/KruacentExiled/KE.CustomRoles/Abilities/FireAbilities/FireStat.cs +++ b/KruacentExiled/KE.CustomRoles/Abilities/FireAbilities/FireStat.cs @@ -1,6 +1,7 @@ using Exiled.API.Features; using KE.CustomRoles.API.Features; using KE.Utils.API.CustomStats; +using KE.Utils.API.CustomStats.GUI; using System.Linq; using UnityEngine; From f76521013adb1a8f226285f93bbf008bf23f2465 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Wed, 4 Feb 2026 18:33:56 +0100 Subject: [PATCH 580/853] fix last player being the scp --- .../KE.Misc/Features/LastHuman/LastHumanHandler.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/KruacentExiled/KE.Misc/Features/LastHuman/LastHumanHandler.cs b/KruacentExiled/KE.Misc/Features/LastHuman/LastHumanHandler.cs index 1560f037..1c6d181b 100644 --- a/KruacentExiled/KE.Misc/Features/LastHuman/LastHumanHandler.cs +++ b/KruacentExiled/KE.Misc/Features/LastHuman/LastHumanHandler.cs @@ -61,9 +61,10 @@ private void OnChangedRole(PlayerChangedRoleEventArgs ev) if (ev.NewRole.RoleTypeId.IsScp()) return; - if(TryGetLastTarget(out Player lastTarget)) + if(TryGetLastTarget(out Player _)) { - foreach(Player player in Player.Enumerable) + Player lastTarget = Player.Enumerable.Where(p => p.IsAlive && !p.IsScp && !p.IsTutorial).FirstOrDefault(); + foreach (Player player in Player.Enumerable) { AbstractHint hint = DisplayHandler.Instance.GetHint(lastTarget, position.HintPlacement); From 3ee91344445c4a9b0102b0e887a52cb10bb07a02 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Thu, 5 Feb 2026 18:17:17 +0100 Subject: [PATCH 581/853] added cooldown --- .../KE.Misc/Features/LastHuman/LastHumanHandler.cs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/KruacentExiled/KE.Misc/Features/LastHuman/LastHumanHandler.cs b/KruacentExiled/KE.Misc/Features/LastHuman/LastHumanHandler.cs index 1c6d181b..f924d548 100644 --- a/KruacentExiled/KE.Misc/Features/LastHuman/LastHumanHandler.cs +++ b/KruacentExiled/KE.Misc/Features/LastHuman/LastHumanHandler.cs @@ -11,6 +11,7 @@ using LabApi.Events.Arguments.PlayerEvents; using PlayerRoles; using PlayerRoles.FirstPersonControl.Thirdperson; +using System; using System.Collections.Generic; using System.Linq; @@ -28,7 +29,9 @@ public class LastHumanHandler : IUsingEvents public static HintPosition position = new LastHumanPosition(); + private DateTime _nextPossibleHint; + public static readonly TimeSpan Cooldown = TimeSpan.FromSeconds(20); public void SubscribeEvents() { LabApi.Events.Handlers.PlayerEvents.ChangedRole += OnChangedRole; @@ -85,13 +88,15 @@ private void OnChangedRole(PlayerChangedRoleEventArgs ev) - if (!player.IsDead) + if (!player.IsDead && DateTime.Now > _nextPossibleHint) { DisplayHandler.Instance.AddHint(position.HintPlacement, player, msg, 10); + Log.Debug("show message to " + lastTarget.Nickname); + _nextPossibleHint = DateTime.Now.Add(Cooldown); } - Log.Debug("show message to " + lastTarget.Nickname); + } } From b57cff36f019cad312977d90eee7696532d3fa87 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Thu, 5 Feb 2026 18:17:28 +0100 Subject: [PATCH 582/853] redid config --- KruacentExiled/KE.Misc/Config.cs | 10 ++-------- KruacentExiled/KE.Misc/Features/SurfaceLight.cs | 5 +++++ 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/KruacentExiled/KE.Misc/Config.cs b/KruacentExiled/KE.Misc/Config.cs index 6b0b9f88..f679ae96 100644 --- a/KruacentExiled/KE.Misc/Config.cs +++ b/KruacentExiled/KE.Misc/Config.cs @@ -7,14 +7,8 @@ public class Config : IConfig { public bool IsEnabled { get; set; } = true; public bool Debug { get; set; } = true; - [Description("Chance that the friendly fire is enabled at the start of the round (set 0 to disable)")] - public int ChanceFF { get; set; } = 50; - [Description("Enable or disable the auto-nuke annoucement")] - public int ChanceClassDDoorGoesBoom { get; set; } = 2; [Description("Chance to d-boy doors goes boom")] - public bool AutoNukeAnnoucement { get; set; } = true; - [Description("Enable or disable the lockdown of SCP-173")] - public bool PeanutLockDown { get; set; } = true; + public int ChanceClassDDoorGoesBoom { get; set; } = 2; [Description("Enable or disable the auto elevator")] public bool AutoElevator { get; set; } = true; [Description("Chance to get a pink candy (0-100)")] @@ -28,7 +22,7 @@ public class Config : IConfig public int GamblingCoinMaxUse { get; set; } = 2; public int GamblingCoinCooldown { get; set; } = 3; - + [Description("health mutiplicator scps)")] public float MultSCP049 { get; set; } = 0.8f; public float MultSCP939 { get; set; } = 1.2f; public float MultSCP106 { get; set; } = 1.1f; diff --git a/KruacentExiled/KE.Misc/Features/SurfaceLight.cs b/KruacentExiled/KE.Misc/Features/SurfaceLight.cs index fc45fc05..3dac8f25 100644 --- a/KruacentExiled/KE.Misc/Features/SurfaceLight.cs +++ b/KruacentExiled/KE.Misc/Features/SurfaceLight.cs @@ -47,6 +47,11 @@ public override void UnsubscribeEvents() private void OnRoundStarted() { + if (!MainPlugin.Instance.Config.SurfaceLight) + { + return; + } + if(Random.Range(0f,100f) < Chance) ChangeSurfaceLight(); } From 33980c0f3cb17754f05c37d15fa4c45a44f7d66a Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Thu, 5 Feb 2026 18:17:56 +0100 Subject: [PATCH 583/853] can now retract vote --- .../VoteStart}/ForceVoteNumber.cs | 2 +- .../KE.Misc/Features/VoteStart/RetractVote.cs | 49 +++++++++++++++++++ .../Features/VoteStart/VotePosition.cs | 2 +- .../KE.Misc/Features/VoteStart/VoteStart.cs | 47 +++++++++++++++--- 4 files changed, 91 insertions(+), 9 deletions(-) rename KruacentExiled/KE.Misc/{ => Features/VoteStart}/ForceVoteNumber.cs (97%) create mode 100644 KruacentExiled/KE.Misc/Features/VoteStart/RetractVote.cs diff --git a/KruacentExiled/KE.Misc/ForceVoteNumber.cs b/KruacentExiled/KE.Misc/Features/VoteStart/ForceVoteNumber.cs similarity index 97% rename from KruacentExiled/KE.Misc/ForceVoteNumber.cs rename to KruacentExiled/KE.Misc/Features/VoteStart/ForceVoteNumber.cs index 5665075d..2729ba13 100644 --- a/KruacentExiled/KE.Misc/ForceVoteNumber.cs +++ b/KruacentExiled/KE.Misc/Features/VoteStart/ForceVoteNumber.cs @@ -6,7 +6,7 @@ using System.Text; using System.Threading.Tasks; -namespace KE.Misc +namespace KE.Misc.Features.VoteStart { [CommandHandler(typeof(RemoteAdminCommandHandler))] public class ForceVoteNumber : ICommand diff --git a/KruacentExiled/KE.Misc/Features/VoteStart/RetractVote.cs b/KruacentExiled/KE.Misc/Features/VoteStart/RetractVote.cs new file mode 100644 index 00000000..b2f9f4c8 --- /dev/null +++ b/KruacentExiled/KE.Misc/Features/VoteStart/RetractVote.cs @@ -0,0 +1,49 @@ +using CommandSystem; +using Exiled.API.Features; +using KE.Utils.API.Commands; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace KE.Misc.Features.VoteStart +{ + [CommandHandler(typeof(ClientCommandHandler))] + public class RestractVote : KECommand + { + public override string Command => "removevote"; + + public override string[] Aliases => ["rv","retractv","removev"]; + + public override string Description => "remove the set vote"; + + public override string[] Usage => [""]; + public override bool ExecuteCommand(ArraySegment arguments, ICommandSender sender, out string response) + { + if(!Round.IsLobby) + { + response = "works only in lobby"; + return false; + } + + + Player player = Player.Get(sender); + + VoteStart vote = MainPlugin.Instance.vote; + + if (!vote.DidVote(player)) + { + response = "you didn't vote"; + return false; + } + + + vote.CancelVote(player); + + + response = "vote set at " + MainPlugin.Instance.Config.MinPlayerVote + " players"; + return true; + } + } +} diff --git a/KruacentExiled/KE.Misc/Features/VoteStart/VotePosition.cs b/KruacentExiled/KE.Misc/Features/VoteStart/VotePosition.cs index b1dfd221..a5850b1e 100644 --- a/KruacentExiled/KE.Misc/Features/VoteStart/VotePosition.cs +++ b/KruacentExiled/KE.Misc/Features/VoteStart/VotePosition.cs @@ -12,7 +12,7 @@ public class VotePosition : HintPosition { public override float Xposition => 0; - public override float Yposition => 900; + public override float Yposition => 800; public override string Name => "VoteStart"; public override HintAlignment HintAlignment => HintAlignment.Center; diff --git a/KruacentExiled/KE.Misc/Features/VoteStart/VoteStart.cs b/KruacentExiled/KE.Misc/Features/VoteStart/VoteStart.cs index aa0dd4ee..e9de03aa 100644 --- a/KruacentExiled/KE.Misc/Features/VoteStart/VoteStart.cs +++ b/KruacentExiled/KE.Misc/Features/VoteStart/VoteStart.cs @@ -19,7 +19,7 @@ internal class VoteStart : MiscFeature public static HintPosition HintPosition = new VotePosition(); - public HashSet Voted = new(); + private HashSet Voted = new(); private bool voteCasted = false; public override void SubscribeEvents() { @@ -45,6 +45,25 @@ public override void UnsubscribeEvents() } + public bool DidVote(Player player) + { + return Voted.Contains(player); + } + + public void CancelVote(Player player) + { + if (!Voted.Contains(player)) + { + throw new ArgumentOutOfRangeException($"Player ({player}) didn't vote"); + } + + + Voted.Remove(player); + Round.IsLobbyLocked = true; + voteCasted = false; + } + + private void OnVoiceChatting(VoiceChattingEventArgs ev) { @@ -100,31 +119,45 @@ private void OnJoined(JoinedEventArgs ev) if (Round.IsLobby) { PlayerDisplay dis = PlayerDisplay.Get(player); - DisplayHandler.Instance.CreateAuto(player, (args) => GetPlayers(), HintPosition.HintPlacement); + DisplayHandler.Instance.CreateAuto(player, (args) => GetPlayers(player), HintPosition.HintPlacement); } }); } - private string GetPlayers() + private string GetPlayers(Player player) { if (!Round.IsLobby) return string.Empty; StringBuilder sb = StringBuilderPool.Pool.Get(); - sb.Clear(); - sb.Append("Players who voted ("); + sb.Append("Votes ("); sb.Append(Voted.Count); sb.Append("/"); sb.Append(MainPlugin.Instance.Config.MinPlayerVote); sb.AppendLine(") : "); - foreach(Player player in Voted) + foreach (Player other in Voted) { - sb.Append(player.Nickname); + bool flag1 = other == player; + if (flag1) + { + sb.Append(""); + } + sb.Append(other.Nickname); + if (flag1) + { + sb.Append(""); + } sb.Append(" "); } + if (Voted.Contains(player)) + { + sb.AppendLine(); + sb.Append(".rv dans la console client pour annuler le vote."); + } + return StringBuilderPool.Pool.ToStringReturn(sb); From 61fa0be7645bc128b2a6219062ab6bc4a486f6c2 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Thu, 5 Feb 2026 18:36:28 +0100 Subject: [PATCH 584/853] badge color --- KruacentExiled/KE.Misc/Features/VoteStart/VoteStart.cs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/KruacentExiled/KE.Misc/Features/VoteStart/VoteStart.cs b/KruacentExiled/KE.Misc/Features/VoteStart/VoteStart.cs index e9de03aa..32ffabc6 100644 --- a/KruacentExiled/KE.Misc/Features/VoteStart/VoteStart.cs +++ b/KruacentExiled/KE.Misc/Features/VoteStart/VoteStart.cs @@ -11,6 +11,7 @@ using System.Linq; using System.Text; using System.Threading.Tasks; +using UnityEngine; namespace KE.Misc.Features.VoteStart { @@ -141,6 +142,13 @@ private string GetPlayers(Player player) foreach (Player other in Voted) { bool flag1 = other == player; + + ColorUtility.TryParseHtmlString(player.Group.BadgeColor, out var colorBase); + string color = ColorUtility.ToHtmlStringRGBA(colorBase); + sb.Append(""); + if (flag1) { sb.Append(""); @@ -150,6 +158,7 @@ private string GetPlayers(Player player) { sb.Append(""); } + sb.Append(""); sb.Append(" "); } if (Voted.Contains(player)) From 7e8da1cbe0c36129a1463c0101b0cd43464f2802 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Thu, 5 Feb 2026 18:43:17 +0100 Subject: [PATCH 585/853] fix fakenuke disabling the deadman --- .../Features/GamblingCoin/Effect/NegativeEffect/FakeNuke.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/KruacentExiled/KE.Misc/Features/GamblingCoin/Effect/NegativeEffect/FakeNuke.cs b/KruacentExiled/KE.Misc/Features/GamblingCoin/Effect/NegativeEffect/FakeNuke.cs index 1dca731f..7357ebe4 100644 --- a/KruacentExiled/KE.Misc/Features/GamblingCoin/Effect/NegativeEffect/FakeNuke.cs +++ b/KruacentExiled/KE.Misc/Features/GamblingCoin/Effect/NegativeEffect/FakeNuke.cs @@ -17,6 +17,9 @@ public void Execute(Player player) public void ExecuteAfterDuration(Player player) { - if (!Warhead.IsDetonated) Warhead.Stop(); + if (Warhead.IsInProgress && Warhead.Controller.Info.ScenarioType != WarheadScenarioType.DeadmanSwitch) + { + Warhead.Stop(); + } } } \ No newline at end of file From a04f140ae04458754231cc4439d2d6f41b4976c9 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Thu, 5 Feb 2026 18:47:43 +0100 Subject: [PATCH 586/853] fixed eating star having only 1 light for all player & the lag --- .../Effect/NegativeEffect/EatingStar.cs | 20 ++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/KruacentExiled/KE.Misc/Features/GamblingCoin/Effect/NegativeEffect/EatingStar.cs b/KruacentExiled/KE.Misc/Features/GamblingCoin/Effect/NegativeEffect/EatingStar.cs index 4ad1dc74..648a2e22 100644 --- a/KruacentExiled/KE.Misc/Features/GamblingCoin/Effect/NegativeEffect/EatingStar.cs +++ b/KruacentExiled/KE.Misc/Features/GamblingCoin/Effect/NegativeEffect/EatingStar.cs @@ -5,6 +5,7 @@ using MEC; using System.Collections.Generic; using UnityEngine; +using Light = Exiled.API.Features.Toys.Light; public class EatingStar : IDurationEffect { @@ -12,14 +13,19 @@ public class EatingStar : IDurationEffect public string Message { get; set; } = "Eating the disco ball wasn't good idea"; public int Weight { get; set; } = 2; public EffectType Type { get; set; } = EffectType.Negative; - public static Exiled.API.Features.Toys.Light Light { get; set; } - public float Duration { get; set; } = -1; + + + private Dictionary _lights; + + public float Duration { get; set; } = 20; private static CoroutineHandle _coroutines; public void Execute(Player player) { - Light = Exiled.API.Features.Toys.Light.Create(player.Position, null, null, true, UnityEngine.Color.blue); - Light.Transform.parent = player.Transform; + _lights[player] = Light.Create(player.Position, null, null, true, UnityEngine.Color.blue); + Light light = _lights[player]; + light.Transform.parent = player.Transform; + light.MovementSmoothing = 0; _coroutines = Timing.RunCoroutine(ColorTransformer()); } @@ -28,7 +34,11 @@ public IEnumerator ColorTransformer() { while (true) { - Light.Color = ColorPicker(); + foreach(var kvp in _lights) + { + kvp.Value.Color = ColorPicker(); + } + yield return Timing.WaitForSeconds(0.5f); } } From e4344ffb031cce5e9098282660a587fe8c637081 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Thu, 5 Feb 2026 19:52:58 +0100 Subject: [PATCH 587/853] added sound to eatingstar --- KruacentExiled/KE.Misc/Features/ClassDDoor.cs | 2 +- .../Effect/NegativeEffect/EatingStar.cs | 35 ++++++--- .../Features/GamblingCoin/EventHandlers.cs | 36 +++------ .../Features/GamblingCoin/ForceEffect.cs | 73 +++++++++++++++++++ .../GamblingCoin/GamblingCoinManager.cs | 23 ++++++ KruacentExiled/KE.Misc/KE.Misc.csproj | 1 + 6 files changed, 134 insertions(+), 36 deletions(-) create mode 100644 KruacentExiled/KE.Misc/Features/GamblingCoin/ForceEffect.cs diff --git a/KruacentExiled/KE.Misc/Features/ClassDDoor.cs b/KruacentExiled/KE.Misc/Features/ClassDDoor.cs index 1dcd61a3..e8d1ef5b 100644 --- a/KruacentExiled/KE.Misc/Features/ClassDDoor.cs +++ b/KruacentExiled/KE.Misc/Features/ClassDDoor.cs @@ -30,7 +30,7 @@ public void UnsubscribeEvents() private void OnRoundStarted() { - if(UnityEngine.Random.Range(0, 101) < MainPlugin.Instance.Config.ChanceClassDDoorGoesBoom || MainPlugin.Instance.Config.Debug) + if(UnityEngine.Random.Range(0, 101) < MainPlugin.Instance.Config.ChanceClassDDoorGoesBoom) { HumanDoorsGoesBoom(); } diff --git a/KruacentExiled/KE.Misc/Features/GamblingCoin/Effect/NegativeEffect/EatingStar.cs b/KruacentExiled/KE.Misc/Features/GamblingCoin/Effect/NegativeEffect/EatingStar.cs index 648a2e22..37cbc506 100644 --- a/KruacentExiled/KE.Misc/Features/GamblingCoin/Effect/NegativeEffect/EatingStar.cs +++ b/KruacentExiled/KE.Misc/Features/GamblingCoin/Effect/NegativeEffect/EatingStar.cs @@ -15,45 +15,58 @@ public class EatingStar : IDurationEffect public EffectType Type { get; set; } = EffectType.Negative; - private Dictionary _lights; + private Dictionary _lights = new(); + private Dictionary _clips = new(); public float Duration { get; set; } = 20; private static CoroutineHandle _coroutines; public void Execute(Player player) { - _lights[player] = Light.Create(player.Position, null, null, true, UnityEngine.Color.blue); - Light light = _lights[player]; - light.Transform.parent = player.Transform; + Light light = Light.Create(player.Position, null, null, true, UnityEngine.Color.blue); + light.Transform.parent = player.GameObject.transform; light.MovementSmoothing = 0; + _lights[player] = light; + - _coroutines = Timing.RunCoroutine(ColorTransformer()); + var c = KE.Utils.API.Sounds.SoundPlayer.Instance.Play("starman", player.GameObject,volume:.5f); + + _clips[player] = c; + _coroutines = Timing.RunCoroutine(ColorTransformer(player)); } - public IEnumerator ColorTransformer() + public IEnumerator ColorTransformer(Player player) { while (true) { - foreach(var kvp in _lights) + if(_lights.TryGetValue(player,out var l)) { - kvp.Value.Color = ColorPicker(); + l.Color = ColorPicker(); + } + else + { + yield break; } - yield return Timing.WaitForSeconds(0.5f); } } - public static UnityEngine.Color ColorPicker() + public static Color32 ColorPicker() { byte r = (byte)UnityEngine.Random.Range(0, 256); byte g = (byte)UnityEngine.Random.Range(0, 256); byte b = (byte)UnityEngine.Random.Range(0, 256); - return new UnityEngine.Color32(r, g, b, 0); + return new Color32(r, g, b, 0); } public void ExecuteAfterDuration(Player player) { Timing.KillCoroutines(_coroutines); + Light light = _lights[player]; + light.Destroy(); + _clips[player].IsPaused = true; + _lights.Remove(player); + } } \ No newline at end of file diff --git a/KruacentExiled/KE.Misc/Features/GamblingCoin/EventHandlers.cs b/KruacentExiled/KE.Misc/Features/GamblingCoin/EventHandlers.cs index f162f7c9..322644d4 100644 --- a/KruacentExiled/KE.Misc/Features/GamblingCoin/EventHandlers.cs +++ b/KruacentExiled/KE.Misc/Features/GamblingCoin/EventHandlers.cs @@ -26,33 +26,33 @@ public void OnCoinFlip(FlippingCoinEventArgs ev) if (CustomItem.TryGet(item, out _)) return; - GamblingEventArgs ev1 = new(ev.Player, item, true); + GamblingEventArgs ev1 = new(player, item, true); Events.Handlers.GamblingCoins.OnGambling(ev1); if (!ev1.IsAllowed) return; - if (_cooldowns.TryGetValue(ev.Player.UserId, out var lastFlip) && + if (_cooldowns.TryGetValue(player.UserId, out var lastFlip) && (DateTime.UtcNow - lastFlip).TotalSeconds < Config.GamblingCoinCooldown) { ev.IsAllowed = false; - PlayerUtils.SendBroadcast(ev.Player, "You must wait before flipping again"); + PlayerUtils.SendBroadcast(player, "You must wait before flipping again"); return; } - _cooldowns[ev.Player.UserId] = DateTime.UtcNow; + _cooldowns[player.UserId] = DateTime.UtcNow; - if (!CoinUses.ContainsKey(ev.Player.CurrentItem.Serial)) + if (!CoinUses.ContainsKey(player.CurrentItem.Serial)) { - CoinUses[ev.Player.CurrentItem.Serial] = UnityEngine.Random.Range(Config.GamblingCoinMinUse, Config.GamblingCoinMaxUse); + CoinUses[player.CurrentItem.Serial] = UnityEngine.Random.Range(Config.GamblingCoinMinUse, Config.GamblingCoinMaxUse); - Log.Debug($"Registered new coin: {CoinUses[ev.Player.CurrentItem.Serial]} uses left."); + Log.Debug($"Registered new coin: {CoinUses[player.CurrentItem.Serial]} uses left."); } - CoinUses[ev.Player.CurrentItem.Serial]--; + CoinUses[player.CurrentItem.Serial]--; - int remainingUses = CoinUses[ev.Player.CurrentItem.Serial]; + int remainingUses = CoinUses[player.CurrentItem.Serial]; bool shouldBreak = remainingUses <= 0; @@ -63,28 +63,16 @@ public void OnCoinFlip(FlippingCoinEventArgs ev) if (effect == null) { Log.Warn($"No {type} effect found in GamblingCoinManager!"); - ev.Player.Broadcast(5, "This coin is empty."); + player.Broadcast(5, "This coin is empty."); return; } - Log.Debug("Effect chosen : " + effect.Name); - effect.Execute(ev.Player); - - if (effect is IDurationEffect durationEffect && durationEffect.Duration > 0) - { - float duration = durationEffect.Duration; - if (durationEffect.Duration == -1) duration = 99999; - - Timing.CallDelayed(duration, () => - { - durationEffect.ExecuteAfterDuration(ev.Player); - }); - } + effect.ExecuteEffect(player); if (!string.IsNullOrEmpty(effect.Message)) { - PlayerUtils.SendBroadcast(ev.Player, effect.Message); + PlayerUtils.SendBroadcast(player, effect.Message); } if (shouldBreak) diff --git a/KruacentExiled/KE.Misc/Features/GamblingCoin/ForceEffect.cs b/KruacentExiled/KE.Misc/Features/GamblingCoin/ForceEffect.cs new file mode 100644 index 00000000..209be2df --- /dev/null +++ b/KruacentExiled/KE.Misc/Features/GamblingCoin/ForceEffect.cs @@ -0,0 +1,73 @@ +using CommandSystem; +using Exiled.API.Features; +using KE.Misc.Features.GamblingCoin.Interfaces; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace KE.Misc.Features.GamblingCoin +{ + [CommandHandler(typeof(RemoteAdminCommandHandler))] + public class ForceCoinEffect : ICommand + { + public string Command => "forcecoineffect"; + + public string[] Aliases => ["fce"]; + + public string Description => "force a effect for a player"; + + public bool Execute(ArraySegment arguments, ICommandSender sender, out string response) + { + Player player = Player.Get(sender); + + if (player is null) + { + response = "player not found"; + return false; + } + + if (arguments.Count < 1) + { + response = "need effect"; + return false; + } + + ICoinEffect chose= null; + foreach (ICoinEffect effect in GamblingCoinManager.EffectList) + { + if (effect.Name == arguments.At(0)) + { + chose = effect; + break; + } + } + + + + + + + if (chose is null) + { + response = $"effect {arguments.At(0)} not found"; + return false; + } + + + try + { + chose.ExecuteEffect(player); + } + catch(Exception e) + { + Log.Error(e); + } + response = $"forced effect {chose.Name} on {player.Nickname}"; + return true; + + + } + } +} diff --git a/KruacentExiled/KE.Misc/Features/GamblingCoin/GamblingCoinManager.cs b/KruacentExiled/KE.Misc/Features/GamblingCoin/GamblingCoinManager.cs index 119c9684..1090fcbc 100644 --- a/KruacentExiled/KE.Misc/Features/GamblingCoin/GamblingCoinManager.cs +++ b/KruacentExiled/KE.Misc/Features/GamblingCoin/GamblingCoinManager.cs @@ -3,6 +3,7 @@ using KE.Misc.Features.GamblingCoin.Interfaces; using KE.Misc.Features.GamblingCoin.Types; using KE.Utils.API; +using MEC; using System; using System.Collections.Generic; using System.Linq; @@ -87,5 +88,27 @@ public static ICoinEffect GetRandomEffect(EffectType type) return(EffectList.Where(e => e.Type == type).GetRandomValue()); } + + + public static void ExecuteEffect(this ICoinEffect effect,Player player) + { + if (effect == null) + { + throw new ArgumentNullException(); + } + + effect.Execute(player); + + if (effect is IDurationEffect durationEffect && durationEffect.Duration > 0) + { + float duration = durationEffect.Duration; + Log.Debug("effect " + duration); + Timing.CallDelayed(duration, () => + { + Log.Debug("effect " + duration); + durationEffect.ExecuteAfterDuration(player); + }); + } + } } } \ No newline at end of file diff --git a/KruacentExiled/KE.Misc/KE.Misc.csproj b/KruacentExiled/KE.Misc/KE.Misc.csproj index 142acb82..c0796662 100644 --- a/KruacentExiled/KE.Misc/KE.Misc.csproj +++ b/KruacentExiled/KE.Misc/KE.Misc.csproj @@ -17,6 +17,7 @@ + From c93f635633c90f654eff110bcf4890465aa25c4f Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Thu, 5 Feb 2026 20:03:38 +0100 Subject: [PATCH 588/853] idk why i doesn't work --- KruacentExiled/KE.Items/Items/SainteGrenada.cs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/KruacentExiled/KE.Items/Items/SainteGrenada.cs b/KruacentExiled/KE.Items/Items/SainteGrenada.cs index c9638222..e8d7b890 100644 --- a/KruacentExiled/KE.Items/Items/SainteGrenada.cs +++ b/KruacentExiled/KE.Items/Items/SainteGrenada.cs @@ -64,7 +64,13 @@ protected override void UnsubscribeEvents() protected override void OnThrownProjectile(ThrownProjectileEventArgs ev) { - Utils.API.Sounds.SoundPlayer.Instance.Play("worms", ev.Projectile.GameObject, 50, 75); + GameObject o = new(); + + + o.transform.parent = ev.Projectile.GameObject.transform.parent; + o.transform.localPosition = Vector3.zero; + + Utils.API.Sounds.SoundPlayer.Instance.Play("worms",o , 1); } protected override void OnExploding(ExplodingGrenadeEventArgs ev) { From 4108346c9bbcdaa4ffa4721d400be30e1c8fe6c8 Mon Sep 17 00:00:00 2001 From: OmerGS <27omerf@gmail.com> Date: Thu, 5 Feb 2026 21:43:33 +0100 Subject: [PATCH 589/853] finally i push that --- .../CR/ChaosInsurgency/LeRusse.cs | 233 ++++++++++++------ 1 file changed, 154 insertions(+), 79 deletions(-) diff --git a/KruacentExiled/KE.CustomRoles/CR/ChaosInsurgency/LeRusse.cs b/KruacentExiled/KE.CustomRoles/CR/ChaosInsurgency/LeRusse.cs index f16f12b7..ac3cbad7 100644 --- a/KruacentExiled/KE.CustomRoles/CR/ChaosInsurgency/LeRusse.cs +++ b/KruacentExiled/KE.CustomRoles/CR/ChaosInsurgency/LeRusse.cs @@ -1,155 +1,230 @@ -using Exiled.API.Enums; +using AdminToys; +using Exiled.API.Enums; using Exiled.API.Features; -using Exiled.API.Features.Attributes; +using Exiled.API.Features.Items; +using Exiled.API.Features.Toys; +using Exiled.CustomItems.API.Features; using Exiled.Events.EventArgs.Player; using KE.CustomRoles.API.Features; -using KE.CustomRoles.API.Interfaces; using MEC; using Mirror; using PlayerRoles; -using System; using System.Collections.Generic; +using System.Linq; using UnityEngine; -using VoiceChat; using VoiceChat.Codec; -using VoiceChat.Codec.Enums; using VoiceChat.Networking; namespace KE.CustomRoles.CR.ChaosInsurgency { - public class Russe : KECustomRole, IColor + public class Russe : KECustomRole { - public override string Description { get; set; } = "Tu dois faire la roulette russe avec les autres joueurs"; - public override string InternalName => "Russe"; public override string PublicName { get; set; } = "Le Russe"; + public override string Description { get; set; } = "RUSH B or A, i dont rember sooo good luck"; + public override string InternalName => "Russe"; public override int MaxHealth { get; set; } = 100; public override RoleTypeId Role { get; set; } = RoleTypeId.ChaosRifleman; - public override bool KeepRoleOnDeath { get; set; } = false; - public override bool KeepRoleOnChangingRole { get; set; } = false; - public Color32 Color => new(255, 0, 0, 0); - public override float SpawnChance { get; set; } = 100; - public override Vector3 Scale { get; set; } = new Vector3(1.1f, 1f, 1.1f); + public bool CanHearItself { get; set; } = true; + public float DamageToLootbox { get; set; } = 500f; + + private readonly Dictionary _playerDamage = new(); + private readonly Dictionary _speakers = new(); + private readonly Dictionary _filterMems = new(); + + private readonly OpusDecoder _decoder = new(); + private readonly OpusEncoder _encoder = new(VoiceChat.Codec.Enums.OpusApplicationType.Voip); - public override List Inventory { get; set; } = new List() + private static object[] _lootPool = null; + + public override List Inventory { get; set; } = new() { - $"{ItemType.GunRevolver}", - $"{ItemType.Radio}", - $"{ItemType.Adrenaline}", - $"{ItemType.KeycardChaosInsurgency}", - $"{ItemType.GrenadeHE}", - $"{ItemType.GrenadeHE}", + $"{ItemType.GunRevolver}", $"{ItemType.GunAK}", $"{ItemType.ArmorHeavy}", + $"{ItemType.GrenadeHE}", $"{ItemType.GrenadeFlash}", $"{ItemType.Radio}" }; - public override Dictionary Ammo { get; set; } = new Dictionary() + public override Dictionary Ammo { get; set; } = new() { - { AmmoType.Ammo44Cal, 21} + { AmmoType.Ammo44Cal, 19 }, { AmmoType.Nato762, 60 } }; - private OpusDecoder _decoder = new OpusDecoder(); - private OpusEncoder _encoder = new OpusEncoder(OpusApplicationType.Voip); - - private bool DebugMode = false; - private float _filterMem = 0f; - - private Dictionary ActiveDummies = new Dictionary(); - protected override void RoleAdded(Player player) { Exiled.Events.Handlers.Player.VoiceChatting += OnVoiceChatting; - if (DebugMode) CreateDummy(player); + Exiled.Events.Handlers.Player.Hurting += OnDealingDamage; + + _playerDamage[player] = 0f; + _filterMems[player] = 0f; + SetupSpeaker(player); } protected override void RoleRemoved(Player player) { Exiled.Events.Handlers.Player.VoiceChatting -= OnVoiceChatting; + Exiled.Events.Handlers.Player.Hurting -= OnDealingDamage; - if (DebugMode) RemoveDummy(player); + DestroySpeaker(player); + _playerDamage.Remove(player); + _filterMems.Remove(player); } - private void OnVoiceChatting(VoiceChattingEventArgs ev) + private void OnDealingDamage(HurtingEventArgs ev) { - if (!Check(ev.Player)) return; - ev.IsAllowed = false; + if (ev.Attacker == null || !Check(ev.Attacker) || ev.Player == ev.Attacker) return; - if (!ActiveDummies.ContainsKey(ev.Player)) return; + if (!_playerDamage.ContainsKey(ev.Attacker)) _playerDamage[ev.Attacker] = 0f; + _playerDamage[ev.Attacker] += ev.Amount; - float[] pcmBuffer = new float[1920]; - int decodedLen = _decoder.Decode(ev.VoiceMessage.Data, ev.VoiceMessage.DataLength, pcmBuffer); - ProcessRusseEffect(pcmBuffer, decodedLen); + if (_playerDamage[ev.Attacker] >= DamageToLootbox) + { + _playerDamage[ev.Attacker] = 0f; + SpawnLootBox(ev.Player.Position, ev.Attacker); + } + } - byte[] encodedBytes = new byte[4000]; - int encodedLen = _encoder.Encode(pcmBuffer, encodedBytes); + private void SpawnLootBox(Vector3 pos, Player owner) + { + Primitive box = Primitive.Create(PrimitiveType.Cube, pos + Vector3.up * 0.5f, Vector3.zero, new Vector3(0.5f, 0.5f, 0.5f), true); + box.Color = Color.black; + Timing.RunCoroutine(LootBoxAnimation(box, owner)); + } + + private IEnumerator LootBoxAnimation(Primitive box, Player p) + { + Exiled.API.Features.Toys.Light boxLight = Exiled.API.Features.Toys.Light.Create(box.Position + Vector3.up * 0.5f, Vector3.zero, Vector3.one, true); + boxLight.Intensity = 40f; + boxLight.Range = 8f; - byte[] finalPacket = new byte[encodedLen]; - Array.Copy(encodedBytes, finalPacket, encodedLen); + Color[] csRarities = { Color.blue, Color.magenta, Color.red }; - Npc dummy = ActiveDummies[ev.Player]; - dummy.Position = ev.Player.Position; + try + { + for (int i = 0; i < 10; i++) + { + if (box == null) yield break; - var msg = new VoiceMessage(dummy.ReferenceHub, VoiceChatChannel.Proximity, finalPacket, encodedLen, false); + Color color = csRarities[Random.Range(0, csRarities.Length)]; + box.Color = color; + boxLight.Color = color; - foreach (Player hub in Player.List) + yield return Timing.WaitForSeconds(0.2f); + } + + object reward = GetRandomGambleReward(); + + if (reward is CustomItem custom) + { + custom.Spawn(box.Position); + } + else if (reward is ItemType baseItem) + { + Item.Create(baseItem).CreatePickup(box.Position); + } + } + finally { - if (!DebugMode && hub == ev.Player) continue; + if (box != null) box.Destroy(); + Timing.CallDelayed(0.5f, () => { if (boxLight != null) boxLight.Destroy(); }); + } + } + + private object GetRandomGambleReward() + { + if (_lootPool == null) + { + List tempPool = new List(); - if (Vector3.Distance(hub.Position, ev.Player.Position) < 20f) + foreach (ItemType item in System.Enum.GetValues(typeof(ItemType))) { - hub.Connection.Send(msg); + if (item == ItemType.None || item == ItemType.MicroHID || item == ItemType.Jailbird || + item == ItemType.ParticleDisruptor || item == ItemType.GunSCP127) continue; + + if (item.ToString().Contains("Ammo")) continue; + + tempPool.Add(item); } + + if (CustomItem.Registered != null) + { + foreach (var custom in CustomItem.Registered) + { + tempPool.Add(custom); + } + } + + _lootPool = tempPool.ToArray(); } + + return _lootPool[Random.Range(0, _lootPool.Length)]; } - private void ProcessRusseEffect(float[] buffer, int length) + private void OnVoiceChatting(VoiceChattingEventArgs ev) { - float gateThreshold = 0.02f; + if (!Check(ev.Player) || !_speakers.TryGetValue(ev.Player, out SpeakerToy speaker)) return; + ev.IsAllowed = false; + + float[] pcmBuffer = new float[1920]; + int length = _decoder.Decode(ev.VoiceMessage.Data, ev.VoiceMessage.DataLength, pcmBuffer); + + float gateThreshold = 0.02f; float muffle = 0.10f; + float mem = _filterMems[ev.Player]; for (int i = 0; i < length; i++) { - float input = buffer[i]; - + float input = pcmBuffer[i]; if (Mathf.Abs(input) < gateThreshold) { - _filterMem *= 0.9f; - buffer[i] = _filterMem; + mem *= 0.9f; + pcmBuffer[i] = mem; continue; } + mem += (input - mem) * muffle; + float output = Mathf.Clamp(mem * 6.0f, -1f, 1f); + pcmBuffer[i] = output; + } + _filterMems[ev.Player] = mem; - _filterMem += (input - _filterMem) * muffle; + byte[] encoded = new byte[4000]; + int encodedLen = _encoder.Encode(pcmBuffer, encoded); - float output = _filterMem * 6.0f; + BroadcastAudio(ev.Player, speaker.NetworkControllerId, encoded, encodedLen); + } - if (output > 1.0f) output = 1.0f; - else if (output < -1.0f) output = -1.0f; + private void BroadcastAudio(Player source, byte speakerId, byte[] data, int length) + { + var audioMsg = new AudioMessage(speakerId, data, (short)length); + Vector3 sourcePos = source.Position; - buffer[i] = output; + foreach (Player hub in Player.List) + { + if (hub == source && !CanHearItself) continue; + if (Vector3.Distance(hub.Position, sourcePos) <= 20f) + hub.Connection.Send(audioMsg); } } - private void CreateDummy(Player p) + private void SetupSpeaker(Player p) { - if (ActiveDummies.ContainsKey(p)) return; - Npc npc = Npc.Spawn($"Russe-{p.Nickname}", RoleTypeId.Tutorial, false, p.Position); - npc.Scale = Vector3.zero; + var prefab = NetworkClient.prefabs.Values.Select(x => x.GetComponent()).FirstOrDefault(s => s != null); + if (prefab == null) return; - Timing.CallDelayed(0.5f, () => - { - if (npc != null && npc.GameObject != null) - { - try { npc.IsGodModeEnabled = true; } catch { } - } - }); - ActiveDummies[p] = npc; + SpeakerToy speaker = Object.Instantiate(prefab, p.GameObject.transform); + speaker.transform.localPosition = Vector3.up * 1.5f; + speaker.transform.localScale = Vector3.zero; + + NetworkServer.Spawn(speaker.gameObject); + speaker.NetworkControllerId = (byte)p.Id; + _speakers[p] = speaker; } - private void RemoveDummy(Player p) + private void DestroySpeaker(Player p) { - if (ActiveDummies.ContainsKey(p)) + if (_speakers.TryGetValue(p, out SpeakerToy speaker)) { - if (ActiveDummies[p] != null) NetworkServer.Destroy(ActiveDummies[p].GameObject); - ActiveDummies.Remove(p); + if (speaker != null) NetworkServer.Destroy(speaker.gameObject); + _speakers.Remove(p); } } } -} +} \ No newline at end of file From 7a42af499ddec7aea45228f117e1bd252ad41cf5 Mon Sep 17 00:00:00 2001 From: OmerGS <27omerf@gmail.com> Date: Thu, 5 Feb 2026 21:50:10 +0100 Subject: [PATCH 590/853] oops, forget to remove that --- KruacentExiled/KE.CustomRoles/CR/ChaosInsurgency/LeRusse.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/KruacentExiled/KE.CustomRoles/CR/ChaosInsurgency/LeRusse.cs b/KruacentExiled/KE.CustomRoles/CR/ChaosInsurgency/LeRusse.cs index ac3cbad7..a3377790 100644 --- a/KruacentExiled/KE.CustomRoles/CR/ChaosInsurgency/LeRusse.cs +++ b/KruacentExiled/KE.CustomRoles/CR/ChaosInsurgency/LeRusse.cs @@ -25,7 +25,7 @@ public class Russe : KECustomRole public override int MaxHealth { get; set; } = 100; public override RoleTypeId Role { get; set; } = RoleTypeId.ChaosRifleman; - public bool CanHearItself { get; set; } = true; + public bool CanHearItself { get; set; } = false; public float DamageToLootbox { get; set; } = 500f; private readonly Dictionary _playerDamage = new(); From 0231f7f0cd2a6a3bc07e4689d6f79d2d44949959 Mon Sep 17 00:00:00 2001 From: OmerGS <27omerf@gmail.com> Date: Thu, 5 Feb 2026 21:52:39 +0100 Subject: [PATCH 591/853] change the volume level needed to explode, and deactivate explosion for the tutorial class --- .../KE.GlobalEventFramework.Examples/GE/Librarby.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/KruacentExiled/KE.GlobalEventFramework.Examples/GE/Librarby.cs b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/Librarby.cs index 3cf065d5..e7f0a87b 100644 --- a/KruacentExiled/KE.GlobalEventFramework.Examples/GE/Librarby.cs +++ b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/Librarby.cs @@ -5,6 +5,7 @@ using KE.GlobalEventFramework.GEFE.API.Features; using KE.GlobalEventFramework.GEFE.API.Interfaces; using MEC; +using PlayerRoles; using System; using System.Collections.Generic; using UnityEngine; @@ -25,7 +26,7 @@ public class Librarby : GlobalEvent, IEvent public override string Description { get; set; } = "Ne parlez pas trop fort sinon vous subirez les conséquences !"; /// public override int WeightedChance => 1; - private float MaxVolume = 0.5f; + private float MaxVolume = 0.7f; private OpusDecoder _decoder = new OpusDecoder(); private float[] _pcmBuffer = new float[1920]; @@ -42,7 +43,7 @@ public void UnsubscribeEvent() private void PlayerYapping(VoiceChattingEventArgs ev) { - if (ev.Player.Role.Side == Side.Scp) return; + if (ev.Player.Role.Side == Side.Scp || ev.Player.Role == RoleTypeId.Tutorial) return; int decodedLength = _decoder.Decode(ev.VoiceMessage.Data, ev.VoiceMessage.DataLength, _pcmBuffer); float maxVolume = 0f; From 4d5747978b1eb434be8f99e04de614fb49cd9197 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Fri, 6 Feb 2026 07:59:37 +0100 Subject: [PATCH 592/853] sound --- KruacentExiled/KE.Items/Items/SainteGrenada.cs | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/KruacentExiled/KE.Items/Items/SainteGrenada.cs b/KruacentExiled/KE.Items/Items/SainteGrenada.cs index e8d7b890..2b09d842 100644 --- a/KruacentExiled/KE.Items/Items/SainteGrenada.cs +++ b/KruacentExiled/KE.Items/Items/SainteGrenada.cs @@ -6,6 +6,7 @@ using Exiled.API.Features.Attributes; using Exiled.API.Features.Items; using Exiled.API.Features.Spawn; +using Exiled.API.Features.Toys; using Exiled.CustomItems.API.Features; using Exiled.Events.EventArgs.Map; using Exiled.Events.EventArgs.Player; @@ -13,6 +14,7 @@ using KE.Items.API.Features; using KE.Items.API.Interface; using KE.Items.Items.PickupModels; +using MEC; using UnityEngine; namespace KE.Items.Items @@ -24,7 +26,7 @@ public class SainteGrenada : KECustomGrenade, ICustomPickupModel public override string Name { get; set; } = "Sainte Grenada"; public override string Description { get; set; } = "Worms reference !?"; public override float Weight { get; set; } = 1.5f; - public override float FuseTime { get; set; } = 5f; + public override float FuseTime { get; set; } = 6f; public override bool ExplodeOnCollision { get; set; } = false; public override float DamageModifier { get; set; } = 3f; public Color Color { get; set; } = Color.red; @@ -64,13 +66,7 @@ protected override void UnsubscribeEvents() protected override void OnThrownProjectile(ThrownProjectileEventArgs ev) { - GameObject o = new(); - - - o.transform.parent = ev.Projectile.GameObject.transform.parent; - o.transform.localPosition = Vector3.zero; - - Utils.API.Sounds.SoundPlayer.Instance.Play("worms",o , 1); + Utils.API.Sounds.SoundPlayer.Instance.Play("worms", ev.Projectile.Position, 50,20f); } protected override void OnExploding(ExplodingGrenadeEventArgs ev) { From f28b60cb2dd228b0c208993e54a49c162648e9a3 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Fri, 6 Feb 2026 09:31:39 +0100 Subject: [PATCH 593/853] fix command + effect immunity --- .../API/Features/KECustomRole.cs | 37 ++++++++++++++---- .../API/Interfaces/IEffectImmunity.cs | 15 +++++++ .../KE.CustomRoles/CR/Human/Asthmatique.cs | 4 +- .../KE.CustomRoles/CR/Human/Diabetique.cs | 4 +- .../Commands/Lists/Registered.cs | 1 + .../Patches/ActiveAbilityPatches.cs | 39 ------------------- 6 files changed, 51 insertions(+), 49 deletions(-) create mode 100644 KruacentExiled/KE.CustomRoles/API/Interfaces/IEffectImmunity.cs delete mode 100644 KruacentExiled/KE.CustomRoles/Patches/ActiveAbilityPatches.cs diff --git a/KruacentExiled/KE.CustomRoles/API/Features/KECustomRole.cs b/KruacentExiled/KE.CustomRoles/API/Features/KECustomRole.cs index de34c85c..5ff3502c 100644 --- a/KruacentExiled/KE.CustomRoles/API/Features/KECustomRole.cs +++ b/KruacentExiled/KE.CustomRoles/API/Features/KECustomRole.cs @@ -162,6 +162,11 @@ protected virtual void InternalSubscribeEvents() { Exiled.Events.Handlers.Player.UsedItem += OnUsedItem; } + + if(this is IEffectImmunity) + { + Exiled.Events.Handlers.Player.ReceivingEffect += OnReceivingEffect; + } } @@ -172,6 +177,10 @@ protected virtual void InternalUnsubscribeEvents() { Exiled.Events.Handlers.Player.UsedItem -= OnUsedItem; } + if (this is IEffectImmunity) + { + Exiled.Events.Handlers.Player.ReceivingEffect -= OnReceivingEffect; + } } @@ -193,6 +202,25 @@ private void OnUsedItem(UsedItemEventArgs ev) } + private void OnReceivingEffect(ReceivingEffectEventArgs ev) + { + if (!Check(ev.Player)) return; + if (!ev.IsAllowed) return; + + IEffectImmunity effectImmunity = this as IEffectImmunity; + + if (effectImmunity.Effects is null || effectImmunity.Effects.Count == 0) + { + Log.Warn("no healable item found for" + Name); + return; + } + if (effectImmunity.Effects.Contains(ev.Effect.GetEffectType())) + { + ev.IsAllowed = false; + } + + } + public static void SpawnStartRound(Misc.Features.Spawn.SpawnedEventArgs ev) { @@ -301,16 +329,9 @@ public override void AddRole(Player player) Log.Debug(Name + ": old role type " + player2.Role.Type + "."); Log.Debug(Name + ": new role type " + Role + "."); CurrentNumberOfSpawn++; - - IEnumerable oldroles = Get(player2); - - foreach (KECustomRole role in oldroles) - { - role.RemoveRole(player2); - } + - if (Role != RoleTypeId.None) { diff --git a/KruacentExiled/KE.CustomRoles/API/Interfaces/IEffectImmunity.cs b/KruacentExiled/KE.CustomRoles/API/Interfaces/IEffectImmunity.cs new file mode 100644 index 00000000..53da99c6 --- /dev/null +++ b/KruacentExiled/KE.CustomRoles/API/Interfaces/IEffectImmunity.cs @@ -0,0 +1,15 @@ +using Exiled.API.Enums; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace KE.CustomRoles.API.Interfaces +{ + public interface IEffectImmunity + { + + public abstract HashSet Effects { get; } + } +} diff --git a/KruacentExiled/KE.CustomRoles/CR/Human/Asthmatique.cs b/KruacentExiled/KE.CustomRoles/CR/Human/Asthmatique.cs index 4f0bb2ac..bae73a79 100644 --- a/KruacentExiled/KE.CustomRoles/CR/Human/Asthmatique.cs +++ b/KruacentExiled/KE.CustomRoles/CR/Human/Asthmatique.cs @@ -12,7 +12,7 @@ namespace KE.CustomRoles.CR.Human { - public class Asthmatique : GlobalCustomRole, IColor, IHealable + public class Asthmatique : GlobalCustomRole, IColor, IHealable, IEffectImmunity { public override SideEnum Side { get; set; } = SideEnum.Human; public override string Description { get; set; } = "T'as stamina est réduit de moitié\nMais tu vises mieux"; @@ -23,6 +23,8 @@ public class Asthmatique : GlobalCustomRole, IColor, IHealable public Color32 Color => new Color32(191, 255, 0, 0); public HashSet HealItem => [ItemType.SCP500]; + public HashSet Effects => [EffectType.Poisoned]; + protected override void RoleAdded(Player player) { player.EnableEffect(EffectType.Scp1853, -1, true); diff --git a/KruacentExiled/KE.CustomRoles/CR/Human/Diabetique.cs b/KruacentExiled/KE.CustomRoles/CR/Human/Diabetique.cs index 8b243adf..868961e9 100644 --- a/KruacentExiled/KE.CustomRoles/CR/Human/Diabetique.cs +++ b/KruacentExiled/KE.CustomRoles/CR/Human/Diabetique.cs @@ -14,7 +14,7 @@ namespace KE.CustomRoles.CR.Human { - public class Diabetique : GlobalCustomRole, IColor, IHealable + public class Diabetique : GlobalCustomRole, IColor, IHealable, IEffectImmunity { public override SideEnum Side { get; set; } = SideEnum.Human; public override string Description { get; set; } = "T'as mangé le crambleu au pomme de mael"; @@ -25,6 +25,8 @@ public class Diabetique : GlobalCustomRole, IColor, IHealable public HashSet HealItem => [ItemType.SCP500]; public Color32 Color => new(255, 255, 0,0); + public HashSet Effects => [EffectType.Poisoned]; + protected override void RoleAdded(Player player) { diff --git a/KruacentExiled/KE.CustomRoles/Commands/Lists/Registered.cs b/KruacentExiled/KE.CustomRoles/Commands/Lists/Registered.cs index 3a10297e..cb9235e5 100644 --- a/KruacentExiled/KE.CustomRoles/Commands/Lists/Registered.cs +++ b/KruacentExiled/KE.CustomRoles/Commands/Lists/Registered.cs @@ -30,6 +30,7 @@ public bool Execute(ArraySegment arguments, ICommandSender sender, out s StringBuilder sb = StringBuilderPool.Pool.Get(); string[] name; + sb.AppendLine(); foreach (KECustomRole cr in KECustomRole.Registered.OrderBy(a => a.Name)) { name = cr.Name.Split('_'); diff --git a/KruacentExiled/KE.CustomRoles/Patches/ActiveAbilityPatches.cs b/KruacentExiled/KE.CustomRoles/Patches/ActiveAbilityPatches.cs deleted file mode 100644 index 7a717da6..00000000 --- a/KruacentExiled/KE.CustomRoles/Patches/ActiveAbilityPatches.cs +++ /dev/null @@ -1,39 +0,0 @@ -using Exiled.API.Features; -using Exiled.CustomRoles.API.Features; -using HarmonyLib; -using KE.Utils.API.Displays.DisplayMeow; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace KE.CustomRoles.Patches -{ - public static class ActiveAbilityPatches - { - [HarmonyPatch(typeof(ActiveAbility),nameof(ActiveAbility.UseAbility))] - public static class UseAbilityPatch - { - public static void Prefix(ActiveAbility __instance, Player player) - { - string msg = "Using "+__instance.Name; - - DisplayHandler.Instance.AddHint(MainPlugin.Abilities, player, msg, 5); - } - } - [HarmonyPatch(typeof(ActiveAbility), nameof(ActiveAbility.SelectAbility))] - public static class SelectAbilityPatch - { - public static void Prefix(ActiveAbility __instance, Player player) - { - string msg = __instance.Name + "\n" + __instance.Description; - - DisplayHandler.Instance.AddHint(MainPlugin.Abilities, player, msg, 5); - } - } - - - - } -} From 1c9aef8fec9336b6a34f957be2fb6a0e7f279cd6 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Fri, 6 Feb 2026 15:03:40 +0100 Subject: [PATCH 594/853] omg i'm so stupid --- .../KE.Misc/Features/LastHuman/LastHumanHandler.cs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/KruacentExiled/KE.Misc/Features/LastHuman/LastHumanHandler.cs b/KruacentExiled/KE.Misc/Features/LastHuman/LastHumanHandler.cs index f924d548..aca0786d 100644 --- a/KruacentExiled/KE.Misc/Features/LastHuman/LastHumanHandler.cs +++ b/KruacentExiled/KE.Misc/Features/LastHuman/LastHumanHandler.cs @@ -64,9 +64,8 @@ private void OnChangedRole(PlayerChangedRoleEventArgs ev) if (ev.NewRole.RoleTypeId.IsScp()) return; - if(TryGetLastTarget(out Player _)) + if(TryGetLastTarget(out Player lastTarget)) { - Player lastTarget = Player.Enumerable.Where(p => p.IsAlive && !p.IsScp && !p.IsTutorial).FirstOrDefault(); foreach (Player player in Player.Enumerable) { AbstractHint hint = DisplayHandler.Instance.GetHint(lastTarget, position.HintPlacement); @@ -81,7 +80,7 @@ private void OnChangedRole(PlayerChangedRoleEventArgs ev) } else if(!player.IsDead) { - msg = "The last human is at " + player.Zone; + msg = "The last human is at " + lastTarget.Zone; } From 92f75c5d0aaf3d9c46da2599e23676121b2b0a53 Mon Sep 17 00:00:00 2001 From: OmerGS <27omerf@gmail.com> Date: Fri, 6 Feb 2026 15:11:12 +0100 Subject: [PATCH 595/853] deleted this ge beacause it's not very fun --- .../GE/CassieGoCrazy.cs | 155 ------------------ 1 file changed, 155 deletions(-) delete mode 100644 KruacentExiled/KE.GlobalEventFramework.Examples/GE/CassieGoCrazy.cs diff --git a/KruacentExiled/KE.GlobalEventFramework.Examples/GE/CassieGoCrazy.cs b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/CassieGoCrazy.cs deleted file mode 100644 index 2228876c..00000000 --- a/KruacentExiled/KE.GlobalEventFramework.Examples/GE/CassieGoCrazy.cs +++ /dev/null @@ -1,155 +0,0 @@ -using Exiled.API.Features; -using Exiled.API.Features.Items; -using Exiled.Events.EventArgs.Player; -using KE.GlobalEventFramework.GEFE.API.Features; -using KE.GlobalEventFramework.GEFE.API.Features.Hints; -using KE.GlobalEventFramework.GEFE.API.Interfaces; -using KE.Utils.API.Displays.DisplayMeow; -using MEC; -using System.Collections.Generic; -using System.Linq; - -namespace KE.GlobalEventFramework.Examples.GE -{ - /// - /// Spawn fused grenades in random rooms in the map - /// - public class CassieGoCrazy : GlobalEvent, IStart - { - /// - public override uint Id { get; set; } = 1049; - /// - public override string Name { get; set; } = "Cassie Go Crazy"; - /// - public override string Description { get; set; } = "Crazy Cassie !"; - /// - public override int WeightedChance { get; set; } = 1; - - /// - /// The cooldown between 2 cassie event - /// - public int Cooldown { get; set; } = 380; - - /// - /// Percentage for rare event to occur - /// - public int RareEvent { get; set; } = 2; - - /// - /// Starts a coroutine to perform random actions during the game. - /// - /// A coroutine that runs until the game round ends. - /// - public IEnumerator Start() - { - while (!Round.IsEnded) - { - Log.Debug("waiting"); - yield return Timing.WaitForSeconds(Cooldown); - - int action = UnityEngine.Random.Range(1, 6); - - switch (action) - { - // Turns off the lights in the Heavy Containment zone. - case 1: - Map.TurnOffAllLights(20, Exiled.API.Enums.ZoneType.HeavyContainment); - break; - - // Starting the Warhead - case 2: - if (!Warhead.IsDetonated) - { - Warhead.Start(); - } - break; - - - // Change Map Color to Cyan - case 3: - Map.ChangeLightsColor(UnityEngine.Color.cyan); - break; - - // Sad Cassie scenario. - case 4: - Cassie.Message("I wanna just be useful", true, true, true); - Map.TurnOffAllLights(2, Exiled.API.Enums.ZoneType.HeavyContainment); - Map.TurnOffAllLights(2, Exiled.API.Enums.ZoneType.Entrance); - yield return Timing.WaitForSeconds(3); - Map.TurnOffAllLights(2, Exiled.API.Enums.ZoneType.HeavyContainment); - Map.TurnOffAllLights(2, Exiled.API.Enums.ZoneType.Entrance); - - if(!Warhead.IsDetonated) - Warhead.Start(); - - for (int i = 0; i < 10; i++) - { - ((ExplosiveGrenade)Item.Create(ItemType.GrenadeHE)).SpawnActive(Room.Random().Position); - } - - yield return Timing.WaitForSeconds(20); - Warhead.Stop(); - - - break; - - // Antagonistic Cassie scenario. - case 5: - List nonScpPlayers = Player.List.Where(player => !player.IsScp).ToList(); - - if (nonScpPlayers.Count > 0) - { - Player target = nonScpPlayers[UnityEngine.Random.Range(0, nonScpPlayers.Count)]; - - Cassie.Message("New target : " + target.Nickname, true, true, true); - - void OnPlayerDeath(DyingEventArgs ev) - { - if (ev.Player == target && ev.Attacker != null && ev.Attacker != target) - { - if (!ev.Attacker.IsScp) - { - GiveRandomRewardPlayer(ev.Attacker); - } - - Exiled.Events.Handlers.Player.Dying -= OnPlayerDeath; - } - } - - Exiled.Events.Handlers.Player.Dying += OnPlayerDeath; - } - break; - } - - /// - /// Gives a random reward to the player who killed the target. - /// - /// The player who will receive the reward. - /// - void GiveRandomRewardPlayer(Player player) - { - var items = new List - { - ItemType.ParticleDisruptor, - ItemType.Coin, - ItemType.KeycardO5, - ItemType.SCP268 - }; - - ItemType randomItem = items[UnityEngine.Random.Range(0, items.Count)]; - - player.AddItem(randomItem); - - if (UnityEngine.Random.Range(0, 100) < RareEvent) - { - player.MaxHealth = 125; - DisplayHints.AddHintEffect(player, "Another gift for you!", 5); - } - } - - - } - } - - } -} From b10c327883bb9529441210d81ce7a13cb3e4c406 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Fri, 6 Feb 2026 15:29:50 +0100 Subject: [PATCH 596/853] remove test model --- KruacentExiled/KE.Items/Items/ShieldBelt/ShieldBeltStat.cs | 3 --- 1 file changed, 3 deletions(-) diff --git a/KruacentExiled/KE.Items/Items/ShieldBelt/ShieldBeltStat.cs b/KruacentExiled/KE.Items/Items/ShieldBelt/ShieldBeltStat.cs index 832f3799..e3ffe3a0 100644 --- a/KruacentExiled/KE.Items/Items/ShieldBelt/ShieldBeltStat.cs +++ b/KruacentExiled/KE.Items/Items/ShieldBelt/ShieldBeltStat.cs @@ -148,15 +148,12 @@ private Primitive CreatePrimitive(Player player) prim.Spawn(); - model.Create(prim.Transform); return prim; } - private ModelTest model; public void Awake() { - model = new(); player = Player.Get(transform.root.gameObject); primitive = CreatePrimitive(player); currentCharge = Base; From 7c9d8d0689c3c708de5c967a09d69dd1c1d9553e Mon Sep 17 00:00:00 2001 From: OmerGS <27omerf@gmail.com> Date: Fri, 6 Feb 2026 15:53:49 +0100 Subject: [PATCH 597/853] corrected firestat --- .../KE.CustomRoles/Abilities/FireAbilities/FireStat.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/KruacentExiled/KE.CustomRoles/Abilities/FireAbilities/FireStat.cs b/KruacentExiled/KE.CustomRoles/Abilities/FireAbilities/FireStat.cs index 36265571..cca97c99 100644 --- a/KruacentExiled/KE.CustomRoles/Abilities/FireAbilities/FireStat.cs +++ b/KruacentExiled/KE.CustomRoles/Abilities/FireAbilities/FireStat.cs @@ -1,6 +1,7 @@ using Exiled.API.Features; using KE.CustomRoles.API.Features; using KE.Utils.API.CustomStats; +using KE.Utils.API.CustomStats.GUI; using System.Linq; using UnityEngine; From 4e2b78552c35f37a70ddd66893a7212c1b774755 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Fri, 6 Feb 2026 16:23:42 +0100 Subject: [PATCH 598/853] added better name --- KruacentExiled/KE.Misc/Features/LastHuman/LastHumanHandler.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/KruacentExiled/KE.Misc/Features/LastHuman/LastHumanHandler.cs b/KruacentExiled/KE.Misc/Features/LastHuman/LastHumanHandler.cs index aca0786d..42cad3d4 100644 --- a/KruacentExiled/KE.Misc/Features/LastHuman/LastHumanHandler.cs +++ b/KruacentExiled/KE.Misc/Features/LastHuman/LastHumanHandler.cs @@ -8,6 +8,7 @@ using KE.Utils.API.Displays.DisplayMeow.Placements; using KE.Utils.API.Features.SCPs; using KE.Utils.API.Interfaces; +using KE.Utils.Extensions; using LabApi.Events.Arguments.PlayerEvents; using PlayerRoles; using PlayerRoles.FirstPersonControl.Thirdperson; @@ -80,7 +81,7 @@ private void OnChangedRole(PlayerChangedRoleEventArgs ev) } else if(!player.IsDead) { - msg = "The last human is at " + lastTarget.Zone; + msg = "The last human is at " + lastTarget.Zone.GetName(); } From 7a80cbb38aac43282999bdbe97c3d39ff18e0d0a Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Sun, 8 Feb 2026 14:32:28 +0100 Subject: [PATCH 599/853] made events + moved core + scp team for custom scps --- .../{ => API}/Core/Positions/UltraPosition.cs | 2 +- .../KE.CustomRoles/API/Features/CustomSCP.cs | 6 ++-- .../API/Features/KECustomRole.cs | 24 +++++++++++-- .../KE.CustomRoles/CR/CustomSCPs/SCP035.cs | 3 +- .../KE.CustomRoles/CR/SCP/SCP939/Ultra.cs | 4 +-- .../EventArgs/ReceivedCustomRoleEventArgs.cs | 30 ++++++++++++++++ .../EventArgs/ReceivingCustomRoleEventArgs.cs | 34 +++++++++++++++++++ .../Events/Handlers/KECustomRole.cs | 27 +++++++++++++++ .../Events/Interfaces/IKECustomRole.cs | 15 ++++++++ KruacentExiled/KE.CustomRoles/MainPlugin.cs | 4 ++- 10 files changed, 137 insertions(+), 12 deletions(-) rename KruacentExiled/KE.CustomRoles/{ => API}/Core/Positions/UltraPosition.cs (91%) create mode 100644 KruacentExiled/KE.CustomRoles/Events/EventArgs/ReceivedCustomRoleEventArgs.cs create mode 100644 KruacentExiled/KE.CustomRoles/Events/EventArgs/ReceivingCustomRoleEventArgs.cs create mode 100644 KruacentExiled/KE.CustomRoles/Events/Handlers/KECustomRole.cs create mode 100644 KruacentExiled/KE.CustomRoles/Events/Interfaces/IKECustomRole.cs diff --git a/KruacentExiled/KE.CustomRoles/Core/Positions/UltraPosition.cs b/KruacentExiled/KE.CustomRoles/API/Core/Positions/UltraPosition.cs similarity index 91% rename from KruacentExiled/KE.CustomRoles/Core/Positions/UltraPosition.cs rename to KruacentExiled/KE.CustomRoles/API/Core/Positions/UltraPosition.cs index cd9dfd01..4574a1f7 100644 --- a/KruacentExiled/KE.CustomRoles/Core/Positions/UltraPosition.cs +++ b/KruacentExiled/KE.CustomRoles/API/Core/Positions/UltraPosition.cs @@ -6,7 +6,7 @@ using System.Text; using System.Threading.Tasks; -namespace KE.CustomRoles.Core.Positions +namespace KE.CustomRoles.API.Core.Positions { public class UltraPosition : HintPosition { diff --git a/KruacentExiled/KE.CustomRoles/API/Features/CustomSCP.cs b/KruacentExiled/KE.CustomRoles/API/Features/CustomSCP.cs index 09e06226..a3c2c61f 100644 --- a/KruacentExiled/KE.CustomRoles/API/Features/CustomSCP.cs +++ b/KruacentExiled/KE.CustomRoles/API/Features/CustomSCP.cs @@ -45,10 +45,10 @@ public override void Destroy() base.Destroy(); } - public override void AddRole(Player player) + protected override void RoleAdded(Player player) { - SCPTeam.Instance.AddPrimary(player); - base.AddRole(player); + SCPTeam.AddSCP(player.ReferenceHub); + base.RoleAdded(player); } diff --git a/KruacentExiled/KE.CustomRoles/API/Features/KECustomRole.cs b/KruacentExiled/KE.CustomRoles/API/Features/KECustomRole.cs index 5ff3502c..f4815162 100644 --- a/KruacentExiled/KE.CustomRoles/API/Features/KECustomRole.cs +++ b/KruacentExiled/KE.CustomRoles/API/Features/KECustomRole.cs @@ -14,6 +14,7 @@ using InventorySystem.Configs; using KE.CustomRoles.API.HintPositions; using KE.CustomRoles.API.Interfaces; +using KE.CustomRoles.Events.EventArgs; using KE.Utils.API.Displays.DisplayMeow; using KE.Utils.API.Displays.DisplayMeow.Placements; using KE.Utils.API.Translations; @@ -321,6 +322,9 @@ protected void ShowEffectHint(Player player, string text, float delay) DisplayHandler.Instance.AddHint(MainPlugin.CREffect, player, text, delay); } + + + #region addrole public override void AddRole(Player player) { @@ -328,6 +332,19 @@ public override void AddRole(Player player) Log.Debug(Name + ": Adding role to " + player2.Nickname + "."); Log.Debug(Name + ": old role type " + player2.Role.Type + "."); Log.Debug(Name + ": new role type " + Role + "."); + + + ReceivingCustomRoleEventArgs ev1 = new(player2,this); + + Events.Handlers.KECustomRole.OnReceivingCustomRole(ev1); + + if (!ev1.IsAllowed) + { + Log.Debug(Name + ": role cancelled by plugin"); + return; + } + + CurrentNumberOfSpawn++; @@ -384,11 +401,11 @@ public override void AddRole(Player player) RoleAdded(player2); player2.UniqueRole = Name; player2.TryAddCustomRoleFriendlyFire(Name, CustomRoleFFMultiplier); - } - + ReceivedCustomRoleEventArgs ev2 = new(player2, this); + Events.Handlers.KECustomRole.OnReceivedCustomRole(ev2); - private static HashSet PlayerHints = new(); + } public static readonly HintPosition CurrentCustomRolePosition = new CurrentCustomRolePosition(); @@ -624,6 +641,7 @@ public static void GiveRandomRole(Player player) cr?.AddRole(player); } + public static void GiveRandomRole(IEnumerable players) { diff --git a/KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP035.cs b/KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP035.cs index ffb83387..60e646c6 100644 --- a/KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP035.cs +++ b/KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP035.cs @@ -51,6 +51,7 @@ public class SCP035 : CustomSCP }; public HashSet WhitelistUsing = new() { + ItemType.SCP330, ItemType.SCP1853, }; @@ -97,7 +98,7 @@ private void OnDying(DyingEventArgs ev) protected override void RoleAdded(Player player) { PlayerDisplay dis = PlayerDisplay.Get(player); - DisplayHandler.Instance.CreateAuto(player, (args) => GetPlayers(args), position.HintPlacement); + DisplayHandler.Instance.CreateAuto(player, (args) => GetPlayers(args), position.HintPlacement,HintServiceMeow.Core.Enum.HintSyncSpeed.Normal); player.Position = RoleTypeId.Scp049.GetRandomSpawnLocation().Position; player.EnableEffect(100, 0, false); diff --git a/KruacentExiled/KE.CustomRoles/CR/SCP/SCP939/Ultra.cs b/KruacentExiled/KE.CustomRoles/CR/SCP/SCP939/Ultra.cs index b5bf46ff..469b1d41 100644 --- a/KruacentExiled/KE.CustomRoles/CR/SCP/SCP939/Ultra.cs +++ b/KruacentExiled/KE.CustomRoles/CR/SCP/SCP939/Ultra.cs @@ -1,15 +1,13 @@ using Exiled.API.Enums; using Exiled.API.Features; -using Exiled.API.Features.Attributes; using HintServiceMeow.Core.Models.Arguments; +using KE.CustomRoles.API.Core.Positions; using KE.CustomRoles.API.Features; -using KE.CustomRoles.Core.Positions; using KE.Utils.API.Displays.DisplayMeow; using KE.Utils.API.Displays.DisplayMeow.Placements; using MEC; using PlayerRoles; using System; -using System.Collections.Generic; using System.Linq; namespace KE.CustomRoles.CR.SCP.SCP939 diff --git a/KruacentExiled/KE.CustomRoles/Events/EventArgs/ReceivedCustomRoleEventArgs.cs b/KruacentExiled/KE.CustomRoles/Events/EventArgs/ReceivedCustomRoleEventArgs.cs new file mode 100644 index 00000000..abd081fd --- /dev/null +++ b/KruacentExiled/KE.CustomRoles/Events/EventArgs/ReceivedCustomRoleEventArgs.cs @@ -0,0 +1,30 @@ +using Exiled.API.Features; +using Exiled.Events.EventArgs.Interfaces; +using KE.CustomRoles.API.Features; +using KE.CustomRoles.Events.Interfaces; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace KE.CustomRoles.Events.EventArgs +{ + public class ReceivedCustomRoleEventArgs : IExiledEvent, IPlayerEvent, IKECustomRole + { + + public Player Player { get; } + + public KECustomRole KECustomRole { get; } + + public ReceivedCustomRoleEventArgs(Player player,KECustomRole kECustomRole) + { + Player = player; + KECustomRole = kECustomRole; + + } + + + + } +} diff --git a/KruacentExiled/KE.CustomRoles/Events/EventArgs/ReceivingCustomRoleEventArgs.cs b/KruacentExiled/KE.CustomRoles/Events/EventArgs/ReceivingCustomRoleEventArgs.cs new file mode 100644 index 00000000..6f7ee243 --- /dev/null +++ b/KruacentExiled/KE.CustomRoles/Events/EventArgs/ReceivingCustomRoleEventArgs.cs @@ -0,0 +1,34 @@ +using Exiled.API.Features; +using Exiled.Events.EventArgs.Interfaces; +using KE.CustomRoles.API.Features; +using KE.CustomRoles.Events.Interfaces; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace KE.CustomRoles.Events.EventArgs +{ + public class ReceivingCustomRoleEventArgs : IExiledEvent, IPlayerEvent, IDeniableEvent, IKECustomRole + { + + public Player Player { get; } + + + public bool IsAllowed { get; set; } + + public KECustomRole KECustomRole { get; } + + public ReceivingCustomRoleEventArgs(Player player, KECustomRole kECustomRole, bool isAllowed = true) + { + Player = player; + KECustomRole = kECustomRole; + IsAllowed = isAllowed; + + } + + + + } +} diff --git a/KruacentExiled/KE.CustomRoles/Events/Handlers/KECustomRole.cs b/KruacentExiled/KE.CustomRoles/Events/Handlers/KECustomRole.cs new file mode 100644 index 00000000..2c4fac24 --- /dev/null +++ b/KruacentExiled/KE.CustomRoles/Events/Handlers/KECustomRole.cs @@ -0,0 +1,27 @@ +using KE.CustomRoles.Events.EventArgs; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace KE.CustomRoles.Events.Handlers +{ + public static class KECustomRole + { + + public static event Action ReceivingCustomRole = delegate { }; + public static event Action ReceivedCustomRole = delegate { }; + + + public static void OnReceivingCustomRole(ReceivingCustomRoleEventArgs ev) + { + ReceivingCustomRole?.Invoke(ev); + } + public static void OnReceivedCustomRole(ReceivedCustomRoleEventArgs ev) + { + ReceivedCustomRole?.Invoke(ev); + } + + } +} diff --git a/KruacentExiled/KE.CustomRoles/Events/Interfaces/IKECustomRole.cs b/KruacentExiled/KE.CustomRoles/Events/Interfaces/IKECustomRole.cs new file mode 100644 index 00000000..dc108dbe --- /dev/null +++ b/KruacentExiled/KE.CustomRoles/Events/Interfaces/IKECustomRole.cs @@ -0,0 +1,15 @@ +using KE.CustomRoles.API.Features; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace KE.CustomRoles.Events.Interfaces +{ + public interface IKECustomRole + { + public KECustomRole KECustomRole { get; } + + } +} diff --git a/KruacentExiled/KE.CustomRoles/MainPlugin.cs b/KruacentExiled/KE.CustomRoles/MainPlugin.cs index 8c38355d..a778bf0e 100644 --- a/KruacentExiled/KE.CustomRoles/MainPlugin.cs +++ b/KruacentExiled/KE.CustomRoles/MainPlugin.cs @@ -12,6 +12,7 @@ using KE.Misc.Features.Spawn; using KE.Utils.API.CustomStats; using KE.Utils.API.Displays.DisplayMeow; +using KE.Utils.API.Features.SCPs; using KE.Utils.API.GifAnimator; using KE.Utils.API.Translations; using MEC; @@ -61,7 +62,7 @@ public override void OnEnabled() CustomStatsEvents.SubscribeEvents(); icons = new(); - + CustomTeamEvents.SubscribeEvents(); LoadImage(); @@ -84,6 +85,7 @@ public override void OnDisabled() KEAbilities.Unregister(); UnsubscribeEvents(); + CustomTeamEvents.UnsubscribeEvents(); CustomStatsEvents.UnsubscribeEvents(); Utils.API.Settings.SettingHandler.Instance.UnsubscribeEvents(); _settingHandler = null; From 4db13ecd5f23275fa4cc296db9fe21262bcc1959 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Sun, 8 Feb 2026 18:45:49 +0100 Subject: [PATCH 600/853] scp team for coin effect --- .../Effect/NegativeEffect/TeleportToEnemy.cs | 16 +++++++++++----- .../Effect/PositiveEffect/EmptyMicro.cs | 2 +- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/KruacentExiled/KE.Misc/Features/GamblingCoin/Effect/NegativeEffect/TeleportToEnemy.cs b/KruacentExiled/KE.Misc/Features/GamblingCoin/Effect/NegativeEffect/TeleportToEnemy.cs index 7b366736..a4750628 100644 --- a/KruacentExiled/KE.Misc/Features/GamblingCoin/Effect/NegativeEffect/TeleportToEnemy.cs +++ b/KruacentExiled/KE.Misc/Features/GamblingCoin/Effect/NegativeEffect/TeleportToEnemy.cs @@ -1,6 +1,9 @@ -using Exiled.API.Features; +using Exiled.API.Extensions; +using Exiled.API.Features; using KE.Misc.Features.GamblingCoin.Interfaces; +using KE.Utils.API.Features.SCPs; using PlayerRoles; +using System.Collections.Generic; using System.Linq; using EffectType = KE.Misc.Features.GamblingCoin.Types.EffectType; @@ -13,13 +16,16 @@ internal class TeleportToEnemy : ICoinEffect public void Execute(Player player) { - var scps = Player.List.Where(p => p.IsScp && p.Role != RoleTypeId.Scp079 && p != player).ToList(); + + + List scp = SCPTeam.SCPs.ToList(); + Player target = null; - if (scps.Count > 0) + if (scp.Count > 0) { - target = scps[UnityEngine.Random.Range(0, scps.Count)]; + target = Player.Get(scp.GetRandomValue()); } else { @@ -33,7 +39,7 @@ public void Execute(Player player) if (target != null) { - player.Position = target.Position; + player.Teleport(target.Position); } } } \ No newline at end of file diff --git a/KruacentExiled/KE.Misc/Features/GamblingCoin/Effect/PositiveEffect/EmptyMicro.cs b/KruacentExiled/KE.Misc/Features/GamblingCoin/Effect/PositiveEffect/EmptyMicro.cs index 8047eabf..08fcbfb4 100644 --- a/KruacentExiled/KE.Misc/Features/GamblingCoin/Effect/PositiveEffect/EmptyMicro.cs +++ b/KruacentExiled/KE.Misc/Features/GamblingCoin/Effect/PositiveEffect/EmptyMicro.cs @@ -14,7 +14,7 @@ public void Execute(Player player) { MicroHIDPickup item = (MicroHIDPickup)Pickup.Create(ItemType.MicroHID); item.Position = player.Position; - item.Spawn(); item.Energy = 2; + item.Spawn(); } } \ No newline at end of file From d51096602cb9e765121f86321589cd4745292e48 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Sun, 8 Feb 2026 18:55:14 +0100 Subject: [PATCH 601/853] change scpteam + facilityzone --- .../Others/BlackoutNDoor/Handlers/Handler.cs | 38 +++++++++++-------- 1 file changed, 23 insertions(+), 15 deletions(-) diff --git a/KruacentExiled/KE.Map/Others/BlackoutNDoor/Handlers/Handler.cs b/KruacentExiled/KE.Map/Others/BlackoutNDoor/Handlers/Handler.cs index da916b4c..b7658be4 100644 --- a/KruacentExiled/KE.Map/Others/BlackoutNDoor/Handlers/Handler.cs +++ b/KruacentExiled/KE.Map/Others/BlackoutNDoor/Handlers/Handler.cs @@ -2,8 +2,10 @@ using Exiled.API.Extensions; using Exiled.API.Features; using KE.Map.Others.BlackoutNDoor.Events.EventArgs; +using KE.Utils.API.Features.SCPs; using KE.Utils.API.Interfaces; using KE.Utils.Extensions; +using MapGeneration; using MEC; using PlayerRoles; using System; @@ -24,12 +26,12 @@ public class Handler : IUsingEvents private float time = 0; public float TimeBeforeNextEvent => time; - public static readonly HashSet Zones = new() + public static readonly HashSet Zones = new() { - ZoneType.LightContainment,ZoneType.HeavyContainment,ZoneType.Entrance + FacilityZone.LightContainment,FacilityZone.HeavyContainment,FacilityZone.Entrance }; - private ZoneType currentScpZone = ZoneType.Unspecified; + private FacilityZone currentScpZone = FacilityZone.None; private int weightPerSeconds = 5; private int weight = defaultWeight; private const int defaultWeight = 330; @@ -72,17 +74,21 @@ private IEnumerator Timer() { yield return Timing.WaitForSeconds(timeRefresh); if (Warhead.IsInProgress) continue; - Player scp = Player.List.Where(p => p.IsScp && p.Role != RoleTypeId.Scp0492).FirstOrDefault(); + + ReferenceHub scp = SCPTeam.SCPs.Where(p => p.GetRoleId() != RoleTypeId.Scp0492).FirstOrDefault(); + if(scp == null) { - scp = Player.List.Where(p => p.IsScp).FirstOrDefault(); + scp = SCPTeam.SCPs.FirstOrDefault(); } if (scp != null) { - if(scp.Zone == currentScpZone) + FacilityZone zone = scp.GetCurrentZone(); + + if (zone == currentScpZone) { weight += timeRefresh* weightPerSeconds; } @@ -90,11 +96,11 @@ private IEnumerator Timer() { weight = defaultWeight; } - currentScpZone = scp.Zone; + currentScpZone = zone; } else { - currentScpZone = ZoneType.Unspecified; + currentScpZone = FacilityZone.None; } Log.Debug("weight=" + weight + " at " + currentScpZone); @@ -132,7 +138,7 @@ private void LaunchEvent() ChoseZoneEventArgs choseZoneEv = new(zone); EventHandle.OnChoseZoneEvent(choseZoneEv); - if (Zones.Contains(choseZoneEv.Zone)) + if (Zones.Contains(choseZoneEv.Zone.GetZone())) { zone = choseZoneEv.Zone; } @@ -147,7 +153,7 @@ private void LaunchEvent() EventHandle.OnPreEvent(preEv); - if (preEv.IsAllowed && Zones.Contains(zone)) + if (preEv.IsAllowed && Zones.Contains(zone.GetZone())) { string message = mapEvent.Cassie + " " + ZoneTypeToCassie(zone) + " " + MainPlugin.Translations.End; @@ -196,23 +202,25 @@ private ZoneType GetZone() private ZoneType RandomZoneByWeight() { - List result = new(); - List weightedPool = new(); - foreach (ZoneType zone in Zones.Where(z => z.IsSafe())) + + + + + foreach (FacilityZone zone in Zones.Where(z => ZoneExtensions.IsSafe(z.GetZone()))) { if(zone != currentScpZone) { for (int i = 0; i < defaultWeight; i++) { - weightedPool.Add(zone); + weightedPool.Add(zone.GetZone()); } } else { for (int i = 0; i < weight; i++) { - weightedPool.Add(zone); + weightedPool.Add(zone.GetZone()); } } From cc2e1e88686facfd6d2d4f0caac531f9fca3df81 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Sun, 8 Feb 2026 20:10:23 +0100 Subject: [PATCH 602/853] fixed cr --- .../KE.CustomRoles/Abilities/Explode.cs | 2 +- .../CR/ChaosInsurgency/LeRusse.cs | 2 +- .../KE.CustomRoles/CR/Guard/Introvert.cs | 70 ++++++++++++++++++- KruacentExiled/KE.CustomRoles/CR/MTF/Tank.cs | 4 +- 4 files changed, 74 insertions(+), 4 deletions(-) diff --git a/KruacentExiled/KE.CustomRoles/Abilities/Explode.cs b/KruacentExiled/KE.CustomRoles/Abilities/Explode.cs index c8c5a245..292b5ac0 100644 --- a/KruacentExiled/KE.CustomRoles/Abilities/Explode.cs +++ b/KruacentExiled/KE.CustomRoles/Abilities/Explode.cs @@ -58,7 +58,7 @@ private void ExplodeEvent_ExplodeDestructible(Items.API.Events.OnExplodeDestruct { if (!Grenades.Contains(obj.ExplosionGrenade)) return; - obj.Damage = 100; + obj.Damage = 75; } } diff --git a/KruacentExiled/KE.CustomRoles/CR/ChaosInsurgency/LeRusse.cs b/KruacentExiled/KE.CustomRoles/CR/ChaosInsurgency/LeRusse.cs index a3377790..3a04829f 100644 --- a/KruacentExiled/KE.CustomRoles/CR/ChaosInsurgency/LeRusse.cs +++ b/KruacentExiled/KE.CustomRoles/CR/ChaosInsurgency/LeRusse.cs @@ -39,7 +39,7 @@ public class Russe : KECustomRole public override List Inventory { get; set; } = new() { - $"{ItemType.GunRevolver}", $"{ItemType.GunAK}", $"{ItemType.ArmorHeavy}", + $"{ItemType.GunRevolver}", $"{ItemType.GunA7}", $"{ItemType.ArmorHeavy}", $"{ItemType.GrenadeHE}", $"{ItemType.GrenadeFlash}", $"{ItemType.Radio}" }; diff --git a/KruacentExiled/KE.CustomRoles/CR/Guard/Introvert.cs b/KruacentExiled/KE.CustomRoles/CR/Guard/Introvert.cs index 18ee3cf2..9ee03d98 100644 --- a/KruacentExiled/KE.CustomRoles/CR/Guard/Introvert.cs +++ b/KruacentExiled/KE.CustomRoles/CR/Guard/Introvert.cs @@ -1,9 +1,14 @@ -using Exiled.API.Enums; +using CustomPlayerEffects; +using Exiled.API.Enums; +using Exiled.API.Features; using Exiled.API.Features.Attributes; using Exiled.API.Features.Spawn; using KE.CustomRoles.API.Features; +using MEC; using PlayerRoles; using System.Collections.Generic; +using System.IO; +using System.Linq; namespace KE.CustomRoles.CR.Guard { @@ -33,5 +38,68 @@ internal class Introvert : KECustomRole { { AmmoType.Nato556, 60} }; + + public override void Init() + { + _enabled = new(); + base.Init(); + } + + + protected override void RoleAdded(Player player) + { + _enabled[player] = false; + //Timing.RunCoroutine(BuffAlone(player)); + base.RoleAdded(player); + } + + + protected override void RoleRemoved(Player player) + { + SyncBuff(player, false); + _enabled.Remove(player); + base.RoleRemoved(player); + } + + + private const byte MovementBoostIntensity = 5; + + private Dictionary _enabled; + + + private IEnumerator BuffAlone(Player player) + { + + while (Check(player)) + { + yield return Timing.WaitForSeconds(1f); + SyncBuff(player, player.CurrentRoom.Players.Count(p => p != player) == 0); + } + } + + private void SyncBuff(Player player,bool alone) + { + MovementBoost boost = player.GetEffect(); + + if (alone && !_enabled[player]) + { + Log.Debug("add buff to "+player.Nickname); + + boost.Intensity += 5; + _enabled[player] = true; + } + + + if (!alone && _enabled[player]) + { + Log.Debug("remove buff to " + player.Nickname); + boost.Intensity -= 5; + _enabled[player] = false; + } + + + } + + } } diff --git a/KruacentExiled/KE.CustomRoles/CR/MTF/Tank.cs b/KruacentExiled/KE.CustomRoles/CR/MTF/Tank.cs index 7b642d1e..d1114735 100644 --- a/KruacentExiled/KE.CustomRoles/CR/MTF/Tank.cs +++ b/KruacentExiled/KE.CustomRoles/CR/MTF/Tank.cs @@ -17,7 +17,7 @@ public class Tank : KECustomRole, IColor public override string Description { get; set; } = "Tu es débuff mais ta force de tir est démultiplié (fais attention à tes balles)"; public override string PublicName { get; set; } = "Tank"; public override int MaxHealth { get; set; } = 200; - public override RoleTypeId Role { get; set; } = RoleTypeId.NtfCaptain; + public override RoleTypeId Role { get; set; } = RoleTypeId.NtfSergeant; public override bool KeepRoleOnDeath { get; set; } = false; public override bool KeepRoleOnChangingRole { get; set; } = false; public Color32 Color => new (255, 192, 203,0); @@ -59,6 +59,8 @@ protected override void UnsubscribeEvents() private void Shooting(ShootingEventArgs ev) { + if (!Check(ev.Player)) return; + Timing.CallDelayed(0.5f, () => { Timing.RunCoroutine(EffectAttribution(ev.Player)); From e6b9ded213abe923cd0231bc50935c1a97af2d04 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Sun, 8 Feb 2026 20:46:18 +0100 Subject: [PATCH 603/853] removed color --- KruacentExiled/KE.Misc/Features/VoteStart/VoteStart.cs | 6 ------ 1 file changed, 6 deletions(-) diff --git a/KruacentExiled/KE.Misc/Features/VoteStart/VoteStart.cs b/KruacentExiled/KE.Misc/Features/VoteStart/VoteStart.cs index 32ffabc6..e27474c9 100644 --- a/KruacentExiled/KE.Misc/Features/VoteStart/VoteStart.cs +++ b/KruacentExiled/KE.Misc/Features/VoteStart/VoteStart.cs @@ -143,11 +143,6 @@ private string GetPlayers(Player player) { bool flag1 = other == player; - ColorUtility.TryParseHtmlString(player.Group.BadgeColor, out var colorBase); - string color = ColorUtility.ToHtmlStringRGBA(colorBase); - sb.Append(""); if (flag1) { @@ -158,7 +153,6 @@ private string GetPlayers(Player player) { sb.Append(""); } - sb.Append(""); sb.Append(" "); } if (Voted.Contains(player)) From d0aeaf9a6ad8c9f7e2067bcf654142dfca79c844 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Mon, 9 Feb 2026 19:07:15 +0100 Subject: [PATCH 604/853] fix mer removing the nuke --- KruacentExiled/KE.Map/KE.Map.csproj | 1 + KruacentExiled/KE.Map/MainPlugin.cs | 16 ++++++++++++++-- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/KruacentExiled/KE.Map/KE.Map.csproj b/KruacentExiled/KE.Map/KE.Map.csproj index 406c9655..d48dad88 100644 --- a/KruacentExiled/KE.Map/KE.Map.csproj +++ b/KruacentExiled/KE.Map/KE.Map.csproj @@ -22,6 +22,7 @@ + diff --git a/KruacentExiled/KE.Map/MainPlugin.cs b/KruacentExiled/KE.Map/MainPlugin.cs index 870587a1..38d107a9 100644 --- a/KruacentExiled/KE.Map/MainPlugin.cs +++ b/KruacentExiled/KE.Map/MainPlugin.cs @@ -11,6 +11,7 @@ using MEC; using PlayerRoles; using PlayerRoles.PlayableScps.Scp106; +using ProjectMER.Features; using System.Collections.Generic; using System.Linq; using UnityEngine; @@ -32,11 +33,15 @@ public override void OnEnabled() { handler = new(); harmony = new(Prefix); + + + handler.SubscribeEvents(); KE.Utils.API.Sounds.SoundPlayer.Instance.TryLoad(); Exiled.Events.Handlers.Map.Generated += OnGenerated; Exiled.Events.Handlers.Server.RoundStarted += OnRoundStarted; + Exiled.Events.Handlers.Server.WaitingForPlayers += OnWaitingForPlayers; GamblingRoom.SubscribeEvents(); //MoreRoom.CreateAll(); @@ -51,6 +56,12 @@ public override void OnEnabled() base.OnEnabled(); } + private void OnWaitingForPlayers() + { + PrefabManager.RegisterPrefabs(); + BulkDoor049.Create(); + } + private void OnRoundStarted() { if (Config.Debug) @@ -105,7 +116,8 @@ public override void OnDisabled() handler?.UnsubscribeEvents(); Exiled.Events.Handlers.Map.Generated -= OnGenerated; Exiled.Events.Handlers.Server.RoundStarted -= OnRoundStarted; - + Exiled.Events.Handlers.Server.WaitingForPlayers -= OnWaitingForPlayers; + harmony.UnpatchAll(harmony.Id); GamblingRoom.UnsubscribeEvents(); //MoreRoom.UnsubscribeEvents(); @@ -157,7 +169,7 @@ private void OnGenerated() var g = new OldGamblingRoom(RoleTypeId.Scp173.GetRandomSpawnLocation().Position + Vector3.down, Vector3.one*10, new LootTable(normal)); - BulkDoor049.Create(); + /* From c7026900a4f5359d7ea6a1d2bba073910e33496d Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Mon, 9 Feb 2026 19:08:28 +0100 Subject: [PATCH 605/853] remove killing nuek --- .../KE.Misc/Features/AutoNukeAnnoucement.cs | 19 +------------------ 1 file changed, 1 insertion(+), 18 deletions(-) diff --git a/KruacentExiled/KE.Misc/Features/AutoNukeAnnoucement.cs b/KruacentExiled/KE.Misc/Features/AutoNukeAnnoucement.cs index 71499898..20d729cb 100644 --- a/KruacentExiled/KE.Misc/Features/AutoNukeAnnoucement.cs +++ b/KruacentExiled/KE.Misc/Features/AutoNukeAnnoucement.cs @@ -15,33 +15,16 @@ public class NukeKill : IUsingEvents { public void SubscribeEvents() { - Exiled.Events.Handlers.Warhead.Detonated += OnDetonated; } public void UnsubscribeEvents() { - Exiled.Events.Handlers.Warhead.Detonated -= OnDetonated; } private void OnDetonated() { - Timing.CallDelayed(10, () => - { - foreach(Player player in Player.Enumerable) - { - if(player.Zone != Exiled.API.Enums.ZoneType.Surface) - { - player.Kill(Exiled.API.Enums.DamageType.Warhead); - } - - if (player.Lift is not null) - { - player.Kill(Exiled.API.Enums.DamageType.Warhead); - } - - } - }); + } From b149820291ee544dc0bce34f9214a493f59b3232 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Mon, 9 Feb 2026 19:20:58 +0100 Subject: [PATCH 606/853] added 1509 to 035 --- KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP035.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP035.cs b/KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP035.cs index 60e646c6..4f8dc6f9 100644 --- a/KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP035.cs +++ b/KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP035.cs @@ -53,6 +53,7 @@ public class SCP035 : CustomSCP { ItemType.SCP330, ItemType.SCP1853, + ItemType.SCP1509, }; // 035 can't be damaged by these From 4e7d996fbbd6b041e5566de99aad91bf0e1fa754 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Mon, 9 Feb 2026 19:23:24 +0100 Subject: [PATCH 607/853] shieldbelt to 035 --- KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP035.cs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP035.cs b/KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP035.cs index 4f8dc6f9..37f2a880 100644 --- a/KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP035.cs +++ b/KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP035.cs @@ -12,6 +12,7 @@ using HintServiceMeow.Core.Models.Arguments; using HintServiceMeow.Core.Utilities; using KE.CustomRoles.API.Features; +using KE.Items.API.Features; using KE.Utils.API.Displays.DisplayMeow; using KE.Utils.API.Displays.DisplayMeow.Placements; using MEC; @@ -101,6 +102,13 @@ protected override void RoleAdded(Player player) PlayerDisplay dis = PlayerDisplay.Get(player); DisplayHandler.Instance.CreateAuto(player, (args) => GetPlayers(args), position.HintPlacement,HintServiceMeow.Core.Enum.HintSyncSpeed.Normal); + if(CurrentNumberOfSpawn < 2) + { + KECustomItem.TrySpawn(0, player.Position, out _); + } + + + player.Position = RoleTypeId.Scp049.GetRandomSpawnLocation().Position; player.EnableEffect(100, 0, false); base.RoleAdded(player); From ca2ee677712c1176ecf34f1c828634c20d03b32b Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Mon, 9 Feb 2026 19:23:58 +0100 Subject: [PATCH 608/853] shield beilt --- KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP035.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP035.cs b/KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP035.cs index 37f2a880..d245179e 100644 --- a/KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP035.cs +++ b/KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP035.cs @@ -104,7 +104,7 @@ protected override void RoleAdded(Player player) if(CurrentNumberOfSpawn < 2) { - KECustomItem.TrySpawn(0, player.Position, out _); + KECustomItem.TrySpawn(5982, player.Position, out _); } From 6d47588ed6d77898891b79ad3e566fc825f95702 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Mon, 9 Feb 2026 19:26:59 +0100 Subject: [PATCH 609/853] removed test glass --- KruacentExiled/KE.Map/MainPlugin.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/KruacentExiled/KE.Map/MainPlugin.cs b/KruacentExiled/KE.Map/MainPlugin.cs index 38d107a9..d9b91bf3 100644 --- a/KruacentExiled/KE.Map/MainPlugin.cs +++ b/KruacentExiled/KE.Map/MainPlugin.cs @@ -96,13 +96,13 @@ private void OnRoundStarted() //glass or door w/glass => fake to 106s & 173s & 049-2s & 049s & 096s & ghostly //door w/out glass => fake to 106s & ghostly - MirrorExtensions.SendFakeSyncVar(player, prim.Base.netIdentity,typeof(PrimitiveObjectToy), "NetworkPrimitiveFlags", PrimitiveFlags.Visible); + //MirrorExtensions.SendFakeSyncVar(player, prim.Base.netIdentity,typeof(PrimitiveObjectToy), "NetworkPrimitiveFlags", PrimitiveFlags.Visible); - Log.Info(prim.Base.gameObject.layer); - Log.Info(LayerMask.LayerToName(14)); + //Log.Info(prim.Base.gameObject.layer); + //Log.Info(LayerMask.LayerToName(14)); - Log.Info(Scp106MovementModule.GetSlowdownFromCollider(col, out bool passable) + " passable?" + passable); + //Log.Info(Scp106MovementModule.GetSlowdownFromCollider(col, out bool passable) + " passable?" + passable); } From 6262b1dee51aa559583a9268c027266ad290fb39 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Mon, 9 Feb 2026 19:29:16 +0100 Subject: [PATCH 610/853] ditot --- KruacentExiled/KE.Map/MainPlugin.cs | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/KruacentExiled/KE.Map/MainPlugin.cs b/KruacentExiled/KE.Map/MainPlugin.cs index d9b91bf3..01da476e 100644 --- a/KruacentExiled/KE.Map/MainPlugin.cs +++ b/KruacentExiled/KE.Map/MainPlugin.cs @@ -82,19 +82,16 @@ private void OnRoundStarted() Vector3 pos = RoleTypeId.Scp049.GetRandomSpawnLocation().Position; - Primitive prim = Primitive.Create(PrimitiveType.Cube, pos, spawn: false); - - prim.Base.gameObject.layer = 14; - prim.Spawn(); - - - - - Collider col = prim.Base.gameObject.GetComponent(); //glass or door w/glass => fake to 106s & 173s & 049-2s & 049s & 096s & ghostly //door w/out glass => fake to 106s & ghostly + + //Primitive prim = Primitive.Create(PrimitiveType.Cube, pos, spawn: false); + + //prim.Base.gameObject.layer = 14; + //prim.Spawn(); + //Collider col = prim.Base.gameObject.GetComponent(); //MirrorExtensions.SendFakeSyncVar(player, prim.Base.netIdentity,typeof(PrimitiveObjectToy), "NetworkPrimitiveFlags", PrimitiveFlags.Visible); From 15521aa624a050fedd07b59f4093264e0ab15e89 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Mon, 9 Feb 2026 19:30:49 +0100 Subject: [PATCH 611/853] 035 --- KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP035.cs | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP035.cs b/KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP035.cs index d245179e..9e813f11 100644 --- a/KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP035.cs +++ b/KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP035.cs @@ -102,16 +102,14 @@ protected override void RoleAdded(Player player) PlayerDisplay dis = PlayerDisplay.Get(player); DisplayHandler.Instance.CreateAuto(player, (args) => GetPlayers(args), position.HintPlacement,HintServiceMeow.Core.Enum.HintSyncSpeed.Normal); - if(CurrentNumberOfSpawn < 2) - { - KECustomItem.TrySpawn(5982, player.Position, out _); - } + player.Position = RoleTypeId.Scp049.GetRandomSpawnLocation().Position; player.EnableEffect(100, 0, false); base.RoleAdded(player); + KECustomItem.TrySpawn(5982, player.Position, out _); } From b718238f4dbd97f14da26dfb4d7606cf0f215389 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Mon, 9 Feb 2026 20:28:44 +0100 Subject: [PATCH 612/853] added shielt belt status bar --- .../KE.Items/Items/ShieldBelt/ShieldBelt.cs | 57 ++++++++++++++++--- .../Items/ShieldBelt/ShieldBeltPosition.cs | 21 +++++++ .../Items/ShieldBelt/ShieldBeltStat.cs | 10 ++-- 3 files changed, 75 insertions(+), 13 deletions(-) create mode 100644 KruacentExiled/KE.Items/Items/ShieldBelt/ShieldBeltPosition.cs diff --git a/KruacentExiled/KE.Items/Items/ShieldBelt/ShieldBelt.cs b/KruacentExiled/KE.Items/Items/ShieldBelt/ShieldBelt.cs index d23295dd..77d92327 100644 --- a/KruacentExiled/KE.Items/Items/ShieldBelt/ShieldBelt.cs +++ b/KruacentExiled/KE.Items/Items/ShieldBelt/ShieldBelt.cs @@ -3,35 +3,36 @@ using Exiled.API.Features.DamageHandlers; using Exiled.API.Features.Items; using Exiled.API.Features.Pickups.Projectiles; +using Exiled.API.Features.Pools; using Exiled.API.Features.Spawn; using Exiled.API.Features.Toys; using Exiled.Events.EventArgs.Map; using Exiled.Events.EventArgs.Player; +using HintServiceMeow.Core.Models.HintContent; +using HintServiceMeow.Core.Utilities; using KE.Items.API.Features; +using KE.Items.API.Interface; +using KE.Utils.API.Displays.DisplayMeow; +using KE.Utils.API.Displays.DisplayMeow.Placements; using MapGeneration; using MEC; using PlayerRoles.FirstPersonControl; using System.Collections.Generic; using System.Linq; +using System.Text; using UnityEngine; namespace KE.Items.Items.ShieldBelt { [CustomItem(ItemType.KeycardJanitor)] - public class ShieldBelt : KECustomItem + public class ShieldBelt : KECustomItem, ILumosItem { - - - public override uint Id { get; set; } = 5982; public override string Name { get; set; } = "Shield belt"; public override string Description { get; set; } = "A projectile-repulsion device.\nIt will attempt to stop incoming projectiles or shrapnel, but does nothing against melee attacks or heat.\nIt prevents the wearer from firing out.\n(works in the inventory) "; public override float Weight { get; set; } = 0.65f; public override SpawnProperties SpawnProperties { get; set; } = null; - - - - private CoroutineHandle handle; + public Color Color { get; set; } = new Color32(255, 255, 0, 0); protected override void SubscribeEvents() { @@ -60,15 +61,53 @@ public override bool Check(Player player) return player.Items.Any(Check); } - + private static HintPosition HintPosition = new ShieldBeltPosition(); protected override void OnAcquired(Player player, Item item, bool displayMessage) { if (!Check(item)) return; player.GameObject.AddComponent(); Log.Debug("player got shield"); + + + + Log.Debug("no hints"); + if(!DisplayHandler.Instance.HasHint(player, HintPosition.HintPlacement)) + { + DisplayHandler.Instance.CreateAuto(player, (arg) => GetContent(player), HintPosition.HintPlacement); + } base.OnAcquired(player, item, displayMessage); } + + private string GetContent(Player player) + { + if (player.GameObject.TryGetComponent(out var stat)) + { + StringBuilder sb = StringBuilderPool.Pool.Get(); + + if (stat.IsActive) + { + sb.Append(""); + } + else + { + sb.Append(""); + } + + + sb.Append("ShieldBelt Status : "); + sb.Append(stat.CurrentCharge); + sb.Append("/"); + sb.Append(ShieldBeltStat.MaxCharge); + sb.Append("HP"); + sb.Append(""); + return StringBuilderPool.Pool.ToStringReturn(sb); + } + + + return " "; + } + private void OnDroppedItem(DroppedItemEventArgs ev) { if (!Check(ev.Pickup)) return; diff --git a/KruacentExiled/KE.Items/Items/ShieldBelt/ShieldBeltPosition.cs b/KruacentExiled/KE.Items/Items/ShieldBelt/ShieldBeltPosition.cs new file mode 100644 index 00000000..fdf67450 --- /dev/null +++ b/KruacentExiled/KE.Items/Items/ShieldBelt/ShieldBeltPosition.cs @@ -0,0 +1,21 @@ +using HintServiceMeow.Core.Enum; +using KE.Utils.API.Displays.DisplayMeow.Placements; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace KE.Items.Items.ShieldBelt +{ + public class ShieldBeltPosition : HintPosition + { + public override float Xposition => 0; + + public override float Yposition => 1050; + + public override HintAlignment HintAlignment => HintAlignment.Center; + + public override string Name => "ShieldBelt"; + } +} diff --git a/KruacentExiled/KE.Items/Items/ShieldBelt/ShieldBeltStat.cs b/KruacentExiled/KE.Items/Items/ShieldBelt/ShieldBeltStat.cs index e3ffe3a0..8c4dfb62 100644 --- a/KruacentExiled/KE.Items/Items/ShieldBelt/ShieldBeltStat.cs +++ b/KruacentExiled/KE.Items/Items/ShieldBelt/ShieldBeltStat.cs @@ -12,12 +12,14 @@ namespace KE.Items.Items.ShieldBelt { public class ShieldBeltStat : MonoBehaviour { - public static readonly float MaxCharge = 110; - public static readonly float RechargeRatePerS = 13; - public static readonly float TimeBroken = 50; - public static readonly float Base = 20; + public const float MaxCharge = 110; + public const float RechargeRatePerS = 13; + public const float TimeBroken = 50; + public const float Base = 20; public static readonly Vector3 MaxSize = Vector3.one * 2; + public float CurrentCharge => currentCharge; + private float currentCharge; private float timeRemaining; private bool recharging = false; From 1d021a23bec6d688a4812a15d96143fac489f688 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Mon, 9 Feb 2026 20:46:50 +0100 Subject: [PATCH 613/853] good tesla windup time --- KruacentExiled/KE.Misc/Features/AutoTesla.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/KruacentExiled/KE.Misc/Features/AutoTesla.cs b/KruacentExiled/KE.Misc/Features/AutoTesla.cs index 994a6776..524c1115 100644 --- a/KruacentExiled/KE.Misc/Features/AutoTesla.cs +++ b/KruacentExiled/KE.Misc/Features/AutoTesla.cs @@ -32,18 +32,19 @@ private IEnumerator StartElevator() { while (!Round.IsEnded) { - foreach (Tesla tesla in Tesla.List.ToList()) + foreach (Tesla tesla in Tesla.List) { yield return Timing.WaitForSeconds(UnityEngine.Random.Range(120f,200f)); tesla.Trigger(); if(UnityEngine.Random.Range(0f,100f) <= 70f) { - yield return Timing.WaitForSeconds(tesla.Base.windupTime+.1f); + yield return Timing.WaitForSeconds(tesla.Base.windupTime+tesla.Base.cooldownTime+.1f); tesla.Trigger(); } } } } + } } From 3824a29baeef5fdc0fa1eab368e83edf10a79d08 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Mon, 9 Feb 2026 20:46:58 +0100 Subject: [PATCH 614/853] scp team --- KruacentExiled/KE.Misc/Features/LastHuman/LastHumanHandler.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/KruacentExiled/KE.Misc/Features/LastHuman/LastHumanHandler.cs b/KruacentExiled/KE.Misc/Features/LastHuman/LastHumanHandler.cs index 42cad3d4..9c25ea50 100644 --- a/KruacentExiled/KE.Misc/Features/LastHuman/LastHumanHandler.cs +++ b/KruacentExiled/KE.Misc/Features/LastHuman/LastHumanHandler.cs @@ -62,7 +62,7 @@ private void OnChangedRole(PlayerChangedRoleEventArgs ev) if (ev.OldRole.IsScp()) return; - if (ev.NewRole.RoleTypeId.IsScp()) return; + if (SCPTeam.IsSCP(ev.Player.ReferenceHub)) return; if(TryGetLastTarget(out Player lastTarget)) From 986c03406debe4ccd99fecfbcc92c9552030da15 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Tue, 10 Feb 2026 13:41:22 +0100 Subject: [PATCH 615/853] added more text --- .../Features/LastHuman/LastHumanHandler.cs | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/KruacentExiled/KE.Misc/Features/LastHuman/LastHumanHandler.cs b/KruacentExiled/KE.Misc/Features/LastHuman/LastHumanHandler.cs index 9c25ea50..e7a3f1d2 100644 --- a/KruacentExiled/KE.Misc/Features/LastHuman/LastHumanHandler.cs +++ b/KruacentExiled/KE.Misc/Features/LastHuman/LastHumanHandler.cs @@ -2,6 +2,7 @@ using Exiled.API.Features; using Exiled.Events.EventArgs.Player; using Exiled.Events.EventArgs.Scp106; +using Exiled.Events.Patches.Generic; using HintServiceMeow.Core.Models.Hints; using HintServiceMeow.Core.Utilities; using KE.Utils.API.Displays.DisplayMeow; @@ -22,12 +23,16 @@ public class LastHumanHandler : IUsingEvents { - private static readonly IReadOnlyCollection TextLast = new HashSet() + public static readonly IReadOnlyCollection TextLast = new HashSet() { "You feel like everyone is counting on you", - "You feel suddenly very lonely" + "You feel suddenly very lonely", + "On est que tous les deux vivants ?" }; + public static readonly string TextSCP = "The last human is at %Zone%"; + + public static HintPosition position = new LastHumanPosition(); private DateTime _nextPossibleHint; @@ -81,7 +86,7 @@ private void OnChangedRole(PlayerChangedRoleEventArgs ev) } else if(!player.IsDead) { - msg = "The last human is at " + lastTarget.Zone.GetName(); + msg = TextSCP.Replace("%Zone%", lastTarget.Zone.GetName()); } @@ -117,12 +122,12 @@ private static bool TryGetLastTarget(out Player lastTarget) foreach (ReferenceHub allHub in ReferenceHub.AllHubs) { Log.Debug(allHub.nicknameSync.DisplayName); - if (allHub.IsHuman()) + if (allHub.IsHuman() && !SCPTeam.IsSCP(allHub)) { num++; lastTarget = Player.Get(allHub); } - else if (allHub.IsSCP()) + else if (SCPTeam.IsSCP(allHub)) { num2++; } From ebc7a61844a192e50e0445bcf6618585aaf6cde9 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Wed, 11 Feb 2026 20:34:31 +0100 Subject: [PATCH 616/853] trnaslation --- KruacentExiled/KE.Misc/MainPlugin.cs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/KruacentExiled/KE.Misc/MainPlugin.cs b/KruacentExiled/KE.Misc/MainPlugin.cs index d3589461..08199f82 100644 --- a/KruacentExiled/KE.Misc/MainPlugin.cs +++ b/KruacentExiled/KE.Misc/MainPlugin.cs @@ -12,6 +12,7 @@ using KE.Misc.Features.VoteStart; using KE.Misc.Features.Spawn; using KE.Misc.Features.LastHuman; +using KE.Utils.API.Translations; namespace KE.Misc { @@ -63,6 +64,8 @@ public override void OnEnabled() Respawn.SetTokens(SpawnableFaction.NtfWave, 2); Respawn.SetTokens(SpawnableFaction.ChaosWave, 2); + TranslationManager.Instance.TryLoad(); + harmony.PatchAll(Assembly); ClassDDoor.SubscribeEvents(); From c8099fed4ef0974b0862001d7724db2190393ddb Mon Sep 17 00:00:00 2001 From: OmerGS <27omerf@gmail.com> Date: Wed, 11 Feb 2026 21:48:32 +0100 Subject: [PATCH 617/853] corrected inventory reset --- .../GamblingCoin/Effect/NegativeEffect/EveryoneChange.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/KruacentExiled/KE.Misc/Features/GamblingCoin/Effect/NegativeEffect/EveryoneChange.cs b/KruacentExiled/KE.Misc/Features/GamblingCoin/Effect/NegativeEffect/EveryoneChange.cs index b6a1b5b0..8880882a 100644 --- a/KruacentExiled/KE.Misc/Features/GamblingCoin/Effect/NegativeEffect/EveryoneChange.cs +++ b/KruacentExiled/KE.Misc/Features/GamblingCoin/Effect/NegativeEffect/EveryoneChange.cs @@ -30,7 +30,7 @@ public void Execute(Player caster) { foreach (Player target in Player.List.Where(p => p.IsAlive && RoleInversions.ContainsKey(p.Role.Type))) { - target.Role.Set(RoleInversions[target.Role.Type], RoleSpawnFlags.AssignInventory); + target.Role.Set(RoleInversions[target.Role.Type], RoleSpawnFlags.None); } } } \ No newline at end of file From 2700a77f8eccbe99593f71c95dd76a3144dde1a8 Mon Sep 17 00:00:00 2001 From: OmerGS <27omerf@gmail.com> Date: Wed, 11 Feb 2026 21:49:01 +0100 Subject: [PATCH 618/853] corrected micro spawning with 100% energy --- .../Features/GamblingCoin/Effect/PositiveEffect/EmptyMicro.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/KruacentExiled/KE.Misc/Features/GamblingCoin/Effect/PositiveEffect/EmptyMicro.cs b/KruacentExiled/KE.Misc/Features/GamblingCoin/Effect/PositiveEffect/EmptyMicro.cs index 8047eabf..08fcbfb4 100644 --- a/KruacentExiled/KE.Misc/Features/GamblingCoin/Effect/PositiveEffect/EmptyMicro.cs +++ b/KruacentExiled/KE.Misc/Features/GamblingCoin/Effect/PositiveEffect/EmptyMicro.cs @@ -14,7 +14,7 @@ public void Execute(Player player) { MicroHIDPickup item = (MicroHIDPickup)Pickup.Create(ItemType.MicroHID); item.Position = player.Position; - item.Spawn(); item.Energy = 2; + item.Spawn(); } } \ No newline at end of file From 70e009756ad8418947c9a8e8402929ec4e8b2e5d Mon Sep 17 00:00:00 2001 From: OmerGS <27omerf@gmail.com> Date: Wed, 11 Feb 2026 22:13:03 +0100 Subject: [PATCH 619/853] removed translation --- .../KE.CustomRoles/API/Features/CustomSCP.cs | 2 +- .../KE.CustomRoles/API/Features/KECustomRole.cs | 16 ---------------- .../KE.CustomRoles/CRTranslationFile.cs | 17 ----------------- KruacentExiled/KE.CustomRoles/MainPlugin.cs | 17 +---------------- 4 files changed, 2 insertions(+), 50 deletions(-) delete mode 100644 KruacentExiled/KE.CustomRoles/CRTranslationFile.cs diff --git a/KruacentExiled/KE.CustomRoles/API/Features/CustomSCP.cs b/KruacentExiled/KE.CustomRoles/API/Features/CustomSCP.cs index 09e06226..0d3cdbad 100644 --- a/KruacentExiled/KE.CustomRoles/API/Features/CustomSCP.cs +++ b/KruacentExiled/KE.CustomRoles/API/Features/CustomSCP.cs @@ -47,7 +47,7 @@ public override void Destroy() public override void AddRole(Player player) { - SCPTeam.Instance.AddPrimary(player); + SCPTeam.AddSCP(player.ReferenceHub); base.AddRole(player); } diff --git a/KruacentExiled/KE.CustomRoles/API/Features/KECustomRole.cs b/KruacentExiled/KE.CustomRoles/API/Features/KECustomRole.cs index 18fb86b9..786f216d 100644 --- a/KruacentExiled/KE.CustomRoles/API/Features/KECustomRole.cs +++ b/KruacentExiled/KE.CustomRoles/API/Features/KECustomRole.cs @@ -15,7 +15,6 @@ using KE.CustomRoles.API.Interfaces; using KE.Utils.API.Displays.DisplayMeow; using KE.Utils.API.Displays.DisplayMeow.Placements; -using KE.Utils.API.Translations; using MEC; using PlayerRoles; using System; @@ -109,19 +108,6 @@ protected override void ShowMessage(Player player) private static Dictionary typeLookupTable = new(); private static Dictionary stringLookupTable = new(); - private static TranslationFile translation => MainPlugin.Instance.translation; - - - protected virtual List CreateKeys() - { - return new List() - { - new(Name+"_PublicName",PublicName), - new(Name+"_Description",Description), - }; - } - - public static List keys = new(); public override void Init() { typeLookupTable.Add(GetType(), this); @@ -129,8 +115,6 @@ public override void Init() InternalSubscribeEvents(); SubscribeEvents(); Log.Debug("adding keys to "+Name); - keys.AddRange(CreateKeys()); - } public override void Destroy() diff --git a/KruacentExiled/KE.CustomRoles/CRTranslationFile.cs b/KruacentExiled/KE.CustomRoles/CRTranslationFile.cs deleted file mode 100644 index 3e393880..00000000 --- a/KruacentExiled/KE.CustomRoles/CRTranslationFile.cs +++ /dev/null @@ -1,17 +0,0 @@ -using KE.Utils.API.Translations; -using System.Collections.Generic; - -namespace KE.CustomRoles -{ - internal class CRTranslationFile : TranslationFile - { - public override string Lang => "en"; - - public override string Key => "KE.CR"; - - public override List Values => - [ - - ]; - } -} diff --git a/KruacentExiled/KE.CustomRoles/MainPlugin.cs b/KruacentExiled/KE.CustomRoles/MainPlugin.cs index 0c61bacf..59d99ab6 100644 --- a/KruacentExiled/KE.CustomRoles/MainPlugin.cs +++ b/KruacentExiled/KE.CustomRoles/MainPlugin.cs @@ -11,7 +11,6 @@ using KE.Utils.API.CustomStats; using KE.Utils.API.Displays.DisplayMeow; using KE.Utils.API.GifAnimator; -using KE.Utils.API.Translations; using MEC; using Microsoft.Win32; using System; @@ -24,7 +23,7 @@ namespace KE.CustomRoles { - public class MainPlugin : Plugin, Utils.API.Translations.ITranslation + public class MainPlugin : Plugin { public override string Name => "KE.CustomRoles"; public override string Prefix => "KE.CR"; @@ -40,8 +39,6 @@ public class MainPlugin : Plugin, Utils.API.Translations.ITranslation private SettingHandler _settingHandler; internal static SettingHandler SettingHandler => Instance?._settingHandler; - internal TranslationFile translation; - public TranslationFile Translation => translation; private Harmony Harmony; internal Dictionary icons; @@ -51,7 +48,6 @@ public override void OnEnabled() { Instance = this; - translation = new CRTranslationFile(); _settingHandler = new(); //Utils.API.Settings.SettingHandler.Instance.SubscribeEvents(); @@ -126,17 +122,6 @@ private void LoadImage() } } - - public void ShowTranslation() - { - ///???????????? - translation.Values.AddRange(KECustomRole.keys); - Log.Debug("nb trnalsaikey"+ KECustomRole.keys.Count); - Log.Debug("nb trnalsai"+ translation.Values.Count); - - Log.Debug(translation.ToString()); - } - public void CustomRoleRespawning(RespawnedTeamEventArgs ev) { KECustomRole.GiveRandomRole(ev.Players); From d51b0a4a011bfdbe096e39a350d07aa2cc279e55 Mon Sep 17 00:00:00 2001 From: OmerGS <27omerf@gmail.com> Date: Wed, 11 Feb 2026 22:16:45 +0100 Subject: [PATCH 620/853] add night vision coin effect --- .../Effect/PositiveEffect/NightVision.cs | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 KruacentExiled/KE.Misc/Features/GamblingCoin/Effect/PositiveEffect/NightVision.cs diff --git a/KruacentExiled/KE.Misc/Features/GamblingCoin/Effect/PositiveEffect/NightVision.cs b/KruacentExiled/KE.Misc/Features/GamblingCoin/Effect/PositiveEffect/NightVision.cs new file mode 100644 index 00000000..4606927c --- /dev/null +++ b/KruacentExiled/KE.Misc/Features/GamblingCoin/Effect/PositiveEffect/NightVision.cs @@ -0,0 +1,19 @@ +using Exiled.API.Features; +using KE.Utils.API.Features.SCPs; +using KE.Misc.Features.GamblingCoin.Interfaces; +using EffectType = KE.Misc.Features.GamblingCoin.Types.EffectType; + +internal class NightVision : ICoinEffect +{ + public string Name { get; set; } = "NightVision"; + public string Message { get; set; } = "Yippee, you can see in the dark"; + public int Weight { get; set; } = 5; + public EffectType Type { get; set; } = EffectType.Positive; + public float Duration { get; set; } = 30; + + public void Execute(Player player) + { + if (SCPTeam.IsSCP(player.ReferenceHub)) return; + player.EnableEffect(100, Duration, true); + } +} \ No newline at end of file From b2b59048db50cfde0af1d64647d28d7346e93c49 Mon Sep 17 00:00:00 2001 From: OmerGS <27omerf@gmail.com> Date: Wed, 11 Feb 2026 22:58:15 +0100 Subject: [PATCH 621/853] add a 100hp heal cap and now it heal 10hp/s --- .../Items/ItemEffects/HealZoneEffect.cs | 20 +++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/KruacentExiled/KE.Items/Items/ItemEffects/HealZoneEffect.cs b/KruacentExiled/KE.Items/Items/ItemEffects/HealZoneEffect.cs index dc0c3030..8545f0b1 100644 --- a/KruacentExiled/KE.Items/Items/ItemEffects/HealZoneEffect.cs +++ b/KruacentExiled/KE.Items/Items/ItemEffects/HealZoneEffect.cs @@ -4,11 +4,7 @@ using Exiled.Events.EventArgs.Player; using KE.Items.API.Interface; using MEC; -using System; using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; using UnityEngine; namespace KE.Items.Items.ItemEffects @@ -54,22 +50,34 @@ private void SetZone(Player player, Vector3 position) private IEnumerator HealZoneHeal(Vector3 wallPosition, float cylinderSize, Player playerThrowingGrenade) { + Dictionary playerHealedAmounts = new Dictionary(); + + foreach (Player player in Player.List) + { + playerHealedAmounts.Add(player, 0); + } + while (true) { foreach (Player player in Player.List) { + // Check if a player is in the zone. if (IsPlayerInZone(player, wallPosition, cylinderSize)) { if (playerThrowingGrenade.Role.Team == player.Role.Team) { - player.Heal(1); + if (playerHealedAmounts[player] <= 100) + { + player.Heal(1); + playerHealedAmounts[player] += 1; + } } } } // Waiting 0.5s before re-check. - yield return Timing.WaitForSeconds(0.5f); + yield return Timing.WaitForSeconds(0.1f); } } From 2e042d5c5eee9427580bc53cbfeebde79316e13c Mon Sep 17 00:00:00 2001 From: OmerGS <27omerf@gmail.com> Date: Wed, 11 Feb 2026 22:58:42 +0100 Subject: [PATCH 622/853] change gravity enough to escape from gate b --- .../ItemEffects/LowGravityGrenadeEffect.cs | 22 ++++++++++--------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/KruacentExiled/KE.Items/Items/ItemEffects/LowGravityGrenadeEffect.cs b/KruacentExiled/KE.Items/Items/ItemEffects/LowGravityGrenadeEffect.cs index 2f83ac0c..45891697 100644 --- a/KruacentExiled/KE.Items/Items/ItemEffects/LowGravityGrenadeEffect.cs +++ b/KruacentExiled/KE.Items/Items/ItemEffects/LowGravityGrenadeEffect.cs @@ -1,18 +1,18 @@ using Exiled.API.Features; +using Exiled.API.Features.Roles; using Exiled.Events.EventArgs.Map; using Exiled.Events.EventArgs.Player; using KE.Items.API.Interface; using MEC; +using PlayerRoles.FirstPersonControl; using System.Collections.Generic; using UnityEngine; -using PlayerLab = LabApi.Features.Wrappers.Player; namespace KE.Items.Items.ItemEffects { public class LowGravityGrenadeEffect : CustomItemEffect { - private Dictionary _effectedPlayers = new(); - public Vector3 LowGravity { get; set; } = new(0, -12.6f, 0); + private Dictionary _effectedPlayers = new(); public float Duration { get; set; } = 15f; public float Range { get; set; } = 10f; @@ -37,21 +37,23 @@ public override void Effect(ExplodingGrenadeEventArgs ev) } - public void OnExploding(PlayerLab player) + public void OnExploding(Player player) { if (player is null) return; - Vector3 previousGravity = player.Gravity; - _effectedPlayers[player] = previousGravity; - player.Gravity = LowGravity; + if (player.Role is FpcRole fpcRole) + { + _effectedPlayers[player] = fpcRole.Gravity; + fpcRole.Gravity = FpcGravityController.DefaultGravity * 0.15f; + } + Timing.CallDelayed(Duration, () => { - if (player is not null) + if (player.Role is FpcRole fpcRole) { - player.Gravity = _effectedPlayers[player]; + fpcRole.Gravity = _effectedPlayers[player]; _effectedPlayers.Remove(player); } - }); } } From dad935e320c4ea4ee0cd0b91eaef5b5e2094eda0 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Thu, 12 Feb 2026 17:43:00 +0100 Subject: [PATCH 623/853] merge --- KruacentExiled/KE.CustomRoles/MainPlugin.cs | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/KruacentExiled/KE.CustomRoles/MainPlugin.cs b/KruacentExiled/KE.CustomRoles/MainPlugin.cs index cb4700c8..2945d404 100644 --- a/KruacentExiled/KE.CustomRoles/MainPlugin.cs +++ b/KruacentExiled/KE.CustomRoles/MainPlugin.cs @@ -124,20 +124,6 @@ private void LoadImage() } - public void ShowTranslation() - { - ///???????????? - translation.Values.AddRange(KECustomRole.keys); - Log.Debug("nb trnalsaikey"+ KECustomRole.keys.Count); - Log.Debug("nb trnalsai"+ translation.Values.Count); - - Log.Debug(translation.ToString()); - } - - public void CustomRoleRespawning(RespawnedTeamEventArgs ev) - { - KECustomRole.GiveRandomRole(ev.Players); - } public static void ShowEffectHint(Player player, string text) { From e82cdd6937f0b11bbd5c437091999541568c67d4 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Fri, 13 Feb 2026 18:34:53 +0100 Subject: [PATCH 624/853] cleanup --- .../KE.Items/API/Core/Models/PickupModel.cs | 11 - .../KE.Items/API/Features/PickupModel.cs | 209 ------------------ KruacentExiled/KE.Items/Items/Tempad.cs | 52 ----- 3 files changed, 272 deletions(-) delete mode 100644 KruacentExiled/KE.Items/API/Features/PickupModel.cs delete mode 100644 KruacentExiled/KE.Items/Items/Tempad.cs diff --git a/KruacentExiled/KE.Items/API/Core/Models/PickupModel.cs b/KruacentExiled/KE.Items/API/Core/Models/PickupModel.cs index 5bf7432c..632c5283 100644 --- a/KruacentExiled/KE.Items/API/Core/Models/PickupModel.cs +++ b/KruacentExiled/KE.Items/API/Core/Models/PickupModel.cs @@ -43,15 +43,6 @@ public void UnsubscribeEvents() private Dictionary PickupToParent; - private static CoroutineHandle handle; - private static IEnumerator UpdatePosition() - { - while (true) - { - - } - } - private Primitive CreateParent(Pickup pickup) { @@ -80,8 +71,6 @@ public void OnPickupAdded(ItemPickupBase pickupBase) Pickup pickup = Pickup.Get(pickupBase); if (!Check(pickup)) return; - //handle = Timing.RunCoroutineSingleton(UpdatePosition(), handle, SingletonBehavior.Abort); - Transform parent = CreateParent(pickup).Transform; Log.Info(parent); CreateModel(parent); diff --git a/KruacentExiled/KE.Items/API/Features/PickupModel.cs b/KruacentExiled/KE.Items/API/Features/PickupModel.cs deleted file mode 100644 index 695fef2b..00000000 --- a/KruacentExiled/KE.Items/API/Features/PickupModel.cs +++ /dev/null @@ -1,209 +0,0 @@ -/*using Exiled.API.Features; -using Exiled.API.Features.Pickups; -using Exiled.API.Features.Toys; -using Exiled.CustomItems.API.Features; -using InventorySystem.Items.Pickups; -using KE.Utils.API.Models.Blueprints; -using InteractableToy = LabApi.Features.Wrappers.InteractableToy; -using System.Collections.Generic; -using UnityEngine; -using LabPlayer = LabApi.Features.Wrappers.Player; - -namespace KE.Items.API.Features -{ - public abstract class PickupModel - { - public CustomItem KECI { get; } - private static HashSet allModels = new(); - - - private HashSet modelBlueprint = null; - private Dictionary> models; - private Dictionary> pickableItem; - - - public PickupModel(CustomItem customItem) - { - Log.Debug("created Pmodel " + customItem.Name); - KECI = customItem; - models = new(); - pickableItem = new(); - allModels.Add(this); - } - - - protected abstract HashSet CreateModel(); - - protected virtual bool HidePickup { get; } = false; - - - public void SubscribeEvents() - { - ItemPickupBase.OnPickupAdded += OnPickupAdded; - ItemPickupBase.OnPickupDestroyed += OnPickupDestroyed; - } - - - - public void UnsubscribeEvents() - { - ItemPickupBase.OnPickupDestroyed -= OnPickupDestroyed; - ItemPickupBase.OnPickupAdded -= OnPickupAdded; - - foreach (HashSet toys in models.Values) - { - foreach (AdminToy toy in toys) - { - toy.Destroy(); - } - } - - foreach (HashSet toys in pickableItem.Values) - { - foreach (InteractableToy toy in toys) - { - toy.Destroy(); - } - } - } - - public bool Check(Pickup pickup) - { - if (pickup is null) return false; - if (!CustomItem.TryGet(pickup, out CustomItem ci)) return false; - if (ci != KECI) return false; - - return true; - - } - - public static bool AnyCheck(Pickup pickup) - { - foreach (PickupModel model in allModels) - { - if (model.Check(pickup)) - { - return true; - } - } - return false; - } - - private void OnPickupAdded(ItemPickupBase obj) - { - - Pickup pickup = Pickup.Get(obj); - if(pickup.Type == ItemType.SCP1576) - { - Log.Debug("pickup =" + pickup.Type); - Log.Debug("ci =" + KECI.Name); - } - - - if (!Check(pickup)) return; - - if (modelBlueprint is null) - { - modelBlueprint = CreateModel(); - } - - if (HidePickup) - { - pickup.Scale = new Vector3(.01f, .01f, .01f); - } - - Vector3 scale = pickup.Scale; - - pickableItem.Add(obj, new()); - - models.Add(obj, new()); - - foreach (AdminToyBlueprint blueprint in modelBlueprint) - { - //Log.Debug($"adding {obj.name} at ({obj.Position})"); - AdminToy prim = blueprint.Spawn(Vector3.zero); - - - - - prim.Transform.parent = obj.transform; - prim.Transform.localScale = new(blueprint.Scale.x / scale.x, blueprint.Scale.y / scale.y, blueprint.Scale.z / scale.z); - prim.Transform.localPosition = prim.Position + Vector3.Scale(blueprint.Position, scale); - prim.Transform.rotation *= pickup.Rotation; - prim.MovementSmoothing = 60; - prim.AdminToyBase.syncInterval = 0f; - - Log.Debug("posP=" + prim.Transform.position); - if (prim is Primitive p) - { - p.Collidable = false; - var interact = InteractableToy.Create(prim.Transform, false); - - interact.Transform.parent = obj.transform; - interact.Transform.localPosition = Vector3.zero; - interact.Transform.localRotation = Quaternion.identity; - interact.Scale = new(blueprint.Scale.x / scale.x, blueprint.Scale.y / scale.y, blueprint.Scale.z / scale.z); - interact.InteractionDuration = 0.245f + 0.175f * obj.Info.WeightKg; - interact.Shape = AdminToys.InvisibleInteractableToy.ColliderShape.Box; - - - Log.Debug("scale intec : " + interact.Scale); - Log.Debug("posI=" + interact.Transform.position); - pickableItem[obj].Add(interact); - interact.Spawn(); - } - - - - - - - - Log.Debug("scale prim : " + prim.Transform.localScale); - - - - //interact.OnSearched += (player) => GiveCI(obj, player); - - models[obj].Add(prim); - prim.Spawn(); - - - - } - } - - private void GiveCI(ItemPickupBase pickup, LabPlayer player) - { - Log.Debug("give"); - KECI.Give(player, true); - pickup.DestroySelf(); - } - - private void OnPickupDestroyed(ItemPickupBase obj) - { - if (!Check(Pickup.Get(obj))) return; - - Log.Debug("Destroyed " + obj.name); - if (models.TryGetValue(obj, out HashSet model)) - { - foreach (AdminToy toy in model) - { - toy.Destroy(); - } - } - - if (pickableItem.TryGetValue(obj, out HashSet interact)) - { - foreach (InteractableToy toy in interact) - { - - //toy.OnSearchAborted -= (player) => GiveCI(obj, player); - toy.Destroy(); - } - } - - } - } -} -*/ \ No newline at end of file diff --git a/KruacentExiled/KE.Items/Items/Tempad.cs b/KruacentExiled/KE.Items/Items/Tempad.cs deleted file mode 100644 index 1da1b62c..00000000 --- a/KruacentExiled/KE.Items/Items/Tempad.cs +++ /dev/null @@ -1,52 +0,0 @@ -using Exiled.API.Features.Attributes; -using Exiled.API.Features.Spawn; -using Exiled.API.Features.Toys; -using Exiled.Events.EventArgs.Player; -using KE.Items.API.Features; -using KE.Utils.API.Features.Models; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using UnityEngine; - -namespace KE.Items.Items -{ - - //[CustomItem(ItemType.Flashlight)] - public class Tempad : KECustomItem - { - - public override uint Id { get; set; } = 1845; - public override string Name { get; set; } = "Tempad"; - public override string Description { get; set; } = "drop to set a point; toggle the flashlight to activate the portal"; - public override float Weight { get; set; } = 0.65f; - public override SpawnProperties SpawnProperties { get; set; } = null; - - - - - - protected override void OnDroppingItem(DroppingItemEventArgs ev) - { - Primitive prim = null; - - Collider c = prim.Base.gameObject.GetComponent(); - - - } - - - } - - - - public class TempadModel : ModelBase - { - protected override void CreateModel(Transform parent) - { - - } - } -} From 2dc4f518876041c060a82c81010ef6b5d1e975fb Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Sat, 14 Feb 2026 14:43:46 +0100 Subject: [PATCH 625/853] update + kemultiplerole + pacifist --- .../API/Features/KECustomRoleMultipleRole.cs | 46 ++++++++ .../KE.CustomRoles/CR/Human/Pacifist.cs | 103 ++++++++++++++++++ .../Commands/{ => KECR}/Give.cs | 2 +- .../Commands/{ => KECR}/ImageCommand.cs | 2 +- .../Commands/{ => KECR}/KEParentCommand.cs | 2 +- .../Commands/{ => KECR}/Lists/Abilities.cs | 2 +- .../Commands/{ => KECR}/Lists/List.cs | 2 +- .../Commands/{ => KECR}/Lists/Registered.cs | 2 +- .../KE.CustomRoles/KE.CustomRoles.csproj | 2 +- KruacentExiled/KE.CustomRoles/MainPlugin.cs | 1 + 10 files changed, 157 insertions(+), 7 deletions(-) create mode 100644 KruacentExiled/KE.CustomRoles/API/Features/KECustomRoleMultipleRole.cs create mode 100644 KruacentExiled/KE.CustomRoles/CR/Human/Pacifist.cs rename KruacentExiled/KE.CustomRoles/Commands/{ => KECR}/Give.cs (98%) rename KruacentExiled/KE.CustomRoles/Commands/{ => KECR}/ImageCommand.cs (97%) rename KruacentExiled/KE.CustomRoles/Commands/{ => KECR}/KEParentCommand.cs (96%) rename KruacentExiled/KE.CustomRoles/Commands/{ => KECR}/Lists/Abilities.cs (96%) rename KruacentExiled/KE.CustomRoles/Commands/{ => KECR}/Lists/List.cs (96%) rename KruacentExiled/KE.CustomRoles/Commands/{ => KECR}/Lists/Registered.cs (96%) diff --git a/KruacentExiled/KE.CustomRoles/API/Features/KECustomRoleMultipleRole.cs b/KruacentExiled/KE.CustomRoles/API/Features/KECustomRoleMultipleRole.cs new file mode 100644 index 00000000..a33c8d42 --- /dev/null +++ b/KruacentExiled/KE.CustomRoles/API/Features/KECustomRoleMultipleRole.cs @@ -0,0 +1,46 @@ +using Exiled.API.Enums; +using Exiled.API.Extensions; +using Exiled.API.Features; +using PlayerRoles; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace KE.CustomRoles.API.Features +{ + public abstract class KECustomRoleMultipleRole : KECustomRole + { + + public override string Name + { + get + { + return "MULTIPLE_" + InternalName.RemoveSpaces(); + } + } + public override sealed RoleTypeId Role => RoleTypeId.None; + public override sealed int MaxHealth { get; set; }= -1; + + public abstract HashSet Roles { get; } + + + + + + protected override void AttributeHealth(Player player) + { + + } + + + + public override bool IsAvailable(Player player) + { + if (CurrentNumberOfSpawn >= Limit) return false; + return Roles.Contains(player.Role); + } + + } +} diff --git a/KruacentExiled/KE.CustomRoles/CR/Human/Pacifist.cs b/KruacentExiled/KE.CustomRoles/CR/Human/Pacifist.cs new file mode 100644 index 00000000..49aee149 --- /dev/null +++ b/KruacentExiled/KE.CustomRoles/CR/Human/Pacifist.cs @@ -0,0 +1,103 @@ +using Exiled.API.Features; +using Exiled.Events.EventArgs.Item; +using Exiled.Events.EventArgs.Player; +using KE.CustomRoles.API.Features; +using KE.CustomRoles.API.Interfaces; +using PlayerRoles; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using UnityEngine; + +namespace KE.CustomRoles.CR.Human +{ + public class Pacifist : KECustomRoleMultipleRole + { + public override string Description { get; set; } = "T'es idées empêche quelconque violence. S'enlève quand tu t'échappes et ramène plus de renfort"; + public override string PublicName { get; set; } = "Pacifiste"; + public override bool KeepRoleOnDeath { get; set; } = false; + public override bool KeepRoleOnChangingRole { get; set; } = false; + public override float SpawnChance { get; set; } = 100; + + public override HashSet Roles => [RoleTypeId.Scientist,RoleTypeId.ClassD]; + + + protected override void SubscribeEvents() + { + Exiled.Events.Handlers.Item.DisruptorFiring += OnDisruptorFiring; + Exiled.Events.Handlers.Item.Swinging += OnSwinging; + Exiled.Events.Handlers.Item.ChargingJailbird += OnChargingJailbird; + Exiled.Events.Handlers.Player.Shooting += OnShooting; + Exiled.Events.Handlers.Player.ThrowingRequest += OnThrowingRequest; + Exiled.Events.Handlers.Player.Escaped += OnEscaped; + base.SubscribeEvents(); + } + + protected override void UnsubscribeEvents() + { + + base.UnsubscribeEvents(); + } + private void OnThrowingRequest(ThrowingRequestEventArgs ev) + { + if (Check(ev.Player)) + { + ev.RequestType = Exiled.API.Enums.ThrowRequest.CancelThrow; + } + + } + + private void OnDisruptorFiring(DisruptorFiringEventArgs ev) + { + if (Check(ev.Attacker)) + { + ev.IsAllowed = false; + } + + } + private void OnSwinging(SwingingEventArgs ev) + { + if (Check(ev.Player)) + { + ev.IsAllowed = false; + } + } + private void OnChargingJailbird(ChargingJailbirdEventArgs ev) + { + if (Check(ev.Player)) + { + ev.IsAllowed = false; + } + } + + private void OnShooting(ShootingEventArgs ev) + { + if (Check(ev.Player)) + { + ev.IsAllowed = false; + } + } + + + private void OnEscaped(EscapedEventArgs ev) + { + Player escape = ev.Player; + if (Check(escape)) + { + RemoveRole(escape); + if(Player.Enumerable.Count(p => p.Role == RoleTypeId.Spectator) > 0) + { + Player respawned = Player.Enumerable.First(); + + respawned.Role.Set(escape.Role, Exiled.API.Enums.SpawnReason.Escaped, RoleSpawnFlags.All); + } + + } + } + + + + } +} diff --git a/KruacentExiled/KE.CustomRoles/Commands/Give.cs b/KruacentExiled/KE.CustomRoles/Commands/KECR/Give.cs similarity index 98% rename from KruacentExiled/KE.CustomRoles/Commands/Give.cs rename to KruacentExiled/KE.CustomRoles/Commands/KECR/Give.cs index 90120413..afa47c58 100644 --- a/KruacentExiled/KE.CustomRoles/Commands/Give.cs +++ b/KruacentExiled/KE.CustomRoles/Commands/KECR/Give.cs @@ -11,7 +11,7 @@ using System.Text; using System.Threading.Tasks; -namespace KE.CustomRoles.Commands +namespace KE.CustomRoles.Commands.KECR { internal class Give : ICommand { diff --git a/KruacentExiled/KE.CustomRoles/Commands/ImageCommand.cs b/KruacentExiled/KE.CustomRoles/Commands/KECR/ImageCommand.cs similarity index 97% rename from KruacentExiled/KE.CustomRoles/Commands/ImageCommand.cs rename to KruacentExiled/KE.CustomRoles/Commands/KECR/ImageCommand.cs index d6c618f9..6e846835 100644 --- a/KruacentExiled/KE.CustomRoles/Commands/ImageCommand.cs +++ b/KruacentExiled/KE.CustomRoles/Commands/KECR/ImageCommand.cs @@ -12,7 +12,7 @@ using System.Text; using System.Threading.Tasks; -namespace KE.CustomRoles.Commands +namespace KE.CustomRoles.Commands.KECR { [CommandHandler(typeof(RemoteAdminCommandHandler))] public class ImageCommand : ICommand diff --git a/KruacentExiled/KE.CustomRoles/Commands/KEParentCommand.cs b/KruacentExiled/KE.CustomRoles/Commands/KECR/KEParentCommand.cs similarity index 96% rename from KruacentExiled/KE.CustomRoles/Commands/KEParentCommand.cs rename to KruacentExiled/KE.CustomRoles/Commands/KECR/KEParentCommand.cs index aacaa58f..a986a1d1 100644 --- a/KruacentExiled/KE.CustomRoles/Commands/KEParentCommand.cs +++ b/KruacentExiled/KE.CustomRoles/Commands/KECR/KEParentCommand.cs @@ -5,7 +5,7 @@ using System.Text; using System.Threading.Tasks; -namespace KE.CustomRoles.Commands +namespace KE.CustomRoles.Commands.KECR { [CommandHandler(typeof(RemoteAdminCommandHandler))] [CommandHandler(typeof(GameConsoleCommandHandler))] diff --git a/KruacentExiled/KE.CustomRoles/Commands/Lists/Abilities.cs b/KruacentExiled/KE.CustomRoles/Commands/KECR/Lists/Abilities.cs similarity index 96% rename from KruacentExiled/KE.CustomRoles/Commands/Lists/Abilities.cs rename to KruacentExiled/KE.CustomRoles/Commands/KECR/Lists/Abilities.cs index 01c35e06..c66a2ffd 100644 --- a/KruacentExiled/KE.CustomRoles/Commands/Lists/Abilities.cs +++ b/KruacentExiled/KE.CustomRoles/Commands/KECR/Lists/Abilities.cs @@ -7,7 +7,7 @@ using System.Text; using System.Threading.Tasks; -namespace KE.CustomRoles.Commands.Lists +namespace KE.CustomRoles.Commands.KECR.Lists { public class Abilities : ICommand { diff --git a/KruacentExiled/KE.CustomRoles/Commands/Lists/List.cs b/KruacentExiled/KE.CustomRoles/Commands/KECR/Lists/List.cs similarity index 96% rename from KruacentExiled/KE.CustomRoles/Commands/Lists/List.cs rename to KruacentExiled/KE.CustomRoles/Commands/KECR/Lists/List.cs index ba6ad2e1..e43cb88f 100644 --- a/KruacentExiled/KE.CustomRoles/Commands/Lists/List.cs +++ b/KruacentExiled/KE.CustomRoles/Commands/KECR/Lists/List.cs @@ -5,7 +5,7 @@ using System.Text; using System.Threading.Tasks; -namespace KE.CustomRoles.Commands.Lists +namespace KE.CustomRoles.Commands.KECR.Lists { public class List : ParentCommand { diff --git a/KruacentExiled/KE.CustomRoles/Commands/Lists/Registered.cs b/KruacentExiled/KE.CustomRoles/Commands/KECR/Lists/Registered.cs similarity index 96% rename from KruacentExiled/KE.CustomRoles/Commands/Lists/Registered.cs rename to KruacentExiled/KE.CustomRoles/Commands/KECR/Lists/Registered.cs index cb9235e5..a193a5ef 100644 --- a/KruacentExiled/KE.CustomRoles/Commands/Lists/Registered.cs +++ b/KruacentExiled/KE.CustomRoles/Commands/KECR/Lists/Registered.cs @@ -7,7 +7,7 @@ using System.Text; using System.Threading.Tasks; -namespace KE.CustomRoles.Commands.Lists +namespace KE.CustomRoles.Commands.KECR.Lists { public class Registered : ICommand { diff --git a/KruacentExiled/KE.CustomRoles/KE.CustomRoles.csproj b/KruacentExiled/KE.CustomRoles/KE.CustomRoles.csproj index ad7d5f34..d2477105 100644 --- a/KruacentExiled/KE.CustomRoles/KE.CustomRoles.csproj +++ b/KruacentExiled/KE.CustomRoles/KE.CustomRoles.csproj @@ -5,7 +5,7 @@ - + diff --git a/KruacentExiled/KE.CustomRoles/MainPlugin.cs b/KruacentExiled/KE.CustomRoles/MainPlugin.cs index 2945d404..791aef97 100644 --- a/KruacentExiled/KE.CustomRoles/MainPlugin.cs +++ b/KruacentExiled/KE.CustomRoles/MainPlugin.cs @@ -2,6 +2,7 @@ using Exiled.API.Features.Core.UserSettings; using Exiled.API.Interfaces; using Exiled.CustomRoles.API.Features; +using Exiled.Events.EventArgs.Map; using Exiled.Events.EventArgs.Player; using Exiled.Events.EventArgs.Server; using HarmonyLib; From 92d79929f8a878eb606b40702359c2272721d49a Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Sat, 14 Feb 2026 15:19:25 +0100 Subject: [PATCH 626/853] frozen nut --- .../KE.CustomRoles/CR/SCP/SCP173/Frozen.cs | 48 +++++++++++-------- 1 file changed, 28 insertions(+), 20 deletions(-) diff --git a/KruacentExiled/KE.CustomRoles/CR/SCP/SCP173/Frozen.cs b/KruacentExiled/KE.CustomRoles/CR/SCP/SCP173/Frozen.cs index 8f848f92..08941ed8 100644 --- a/KruacentExiled/KE.CustomRoles/CR/SCP/SCP173/Frozen.cs +++ b/KruacentExiled/KE.CustomRoles/CR/SCP/SCP173/Frozen.cs @@ -1,6 +1,8 @@ using CustomPlayerEffects; using Exiled.API.Features; using Exiled.API.Features.Items; +using Exiled.API.Features.Pickups; +using InventorySystem.Items.Usables.Scp244; using InventorySystem.Items.Usables.Scp244.Hypothermia; using KE.CustomRoles.API.Features; using KE.CustomRoles.API.Interfaces; @@ -10,10 +12,12 @@ using MEC; using PlayerRoles; using PlayerStatsSystem; +using System.Collections.Generic; using System.Linq; using UnityEngine; using Item = Exiled.API.Features.Items.Item; using Player = LabApi.Features.Wrappers.Player; +using Scp244Pickup = Exiled.API.Features.Pickups.Scp244Pickup; namespace KE.CustomRoles.CR.SCP.SCP173 { @@ -31,7 +35,7 @@ public class Frozen : KECustomRole, IColor public Color32 Color => new Color32(120, 205, 255, 0); - /*protected override void SubscribeEvents() + protected override void SubscribeEvents() { LabApi.Events.Handlers.Scp173Events.CreatedTantrum += OnCreatedTantrum; @@ -53,33 +57,34 @@ private void OnDeath(PlayerDeathEventArgs ev) { Player player = ev.Player; - Log.Info("daryh"); - - ScpDamageHandler scp = ev.DamageHandler as ScpDamageHandler; - Log.Info(scp != null); - Log.Info(player.TryGetEffect(out var ef)); - Log.Info(ef.IsEnabled); - - Log.Debug(Check(Player.Get(scp?.Attacker.Hub))); - - - - if (ev.DamageHandler is ScpDamageHandler scpDamageHandler && player.TryGetEffect(out var playerEffect) && playerEffect.IsEnabled) + Log.Info("daryh"); + if (ev.DamageHandler is ScpDamageHandler scpDamageHandler) { Log.Info("damage"); Player attacker = Player.Get(scpDamageHandler.Attacker.Hub); if (Check(attacker)) { - Log.Info("checked"); - attacker.HumeShield = Mathf.Min(attacker.MaxHumeShield, attacker.HumeShield + 400f); + + Vector3 oldpos = ev.OldPosition; + + bool isInAPrimed = _primed.Any(pickup => pickup.FogPercentForPoint(oldpos) > 0); + + if (isInAPrimed) + { + Log.Info("checked"); + attacker.HumeShield = Mathf.Min(attacker.MaxHumeShield, attacker.HumeShield + 400f); + } + } } } + private HashSet _primed = new(); + private void OnCreatedTantrum(Scp173CreatedTantrumEventArgs ev) { @@ -92,18 +97,21 @@ private void OnCreatedTantrum(Scp173CreatedTantrumEventArgs ev) tantrum.Destroy(); Scp244 scp244 = (Scp244)Item.Create(ItemType.SCP244a); - scp244.Scale = new Vector3(.01f, .01f, .01f); scp244.Primed = true; - scp244.MaxDiameter = 10f; - Exiled.API.Features.Pickups.Pickup pickup = scp244.CreatePickup(position); + Scp244Pickup scp244Pickup = (Scp244Pickup)scp244.CreatePickup(position); + + + _primed.Add(scp244Pickup.Base); + Timing.CallDelayed(time, () => { - pickup.Destroy(); + scp244Pickup.Destroy(); + _primed.Remove(scp244Pickup.Base); }); } - */ + } } From f79c00a6ab49920b94e6a07a17ebf36d21020bcc Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Sat, 14 Feb 2026 15:21:45 +0100 Subject: [PATCH 627/853] reduce 035 health --- KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP035.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP035.cs b/KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP035.cs index 9e813f11..5906fd39 100644 --- a/KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP035.cs +++ b/KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP035.cs @@ -29,7 +29,7 @@ public class SCP035 : CustomSCP public override string PublicName { get; set; } = "SCP-035"; public override int MaxHealth { get; set; } = 1200; - public override string Description { get; set; } = "You can't pickup the Micro-HID and anything made with it, but you take 4 time less damage by these weapon.\nKill every humans"; + public override string Description { get; set; } = "You can't pickup the Micro-HID and anything made with it, but you take 3 time less damage by these weapon.\nKill every humans"; protected override int SettingId => 10002; public override RoleTypeId Role { get; set; } = RoleTypeId.Tutorial; @@ -198,7 +198,7 @@ private void OnHurting(HurtingEventArgs ev) { if (ev.IsAllowed) { - ev.DamageHandler.Damage /= 4; + ev.DamageHandler.Damage /= 3; } return; From ff79685e722ca3227cd3e307080fd2c66ca90058 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Sat, 14 Feb 2026 16:42:23 +0100 Subject: [PATCH 628/853] cleanup old unused csproj --- .../API/Features/Controller.cs | 192 ------------- KruacentExiled/KE.BlackoutNDoor/Config.cs | 29 -- .../Handlers/ServerHandler.cs | 69 ----- .../KE.BlackoutNDoor/KE.BlackoutNDoor.csproj | 17 -- KruacentExiled/KE.BlackoutNDoor/MainPlugin.cs | 51 ---- .../CassieGoCrazy/AntagonisticCassie.cs | 91 ++++++ .../API/Feature/CassieGoCrazy/ChangeColor.cs | 18 ++ .../API/Feature/CassieGoCrazy/ICGCEffect.cs | 15 + .../API/Feature/CassieGoCrazy/NoLight.cs | 18 ++ .../API/Feature/CassieGoCrazy/SadCassie.cs | 38 +++ .../Feature/CassieGoCrazy/WarheadEffect.cs | 21 ++ .../Feature/{ => MF}/MalfunctionDisplay.cs | 16 +- .../API/Feature/{ => MF}/MalfunctionEffect.cs | 2 +- .../API/Feature/{ => MF}/Malfunctions.cs | 20 +- .../API/MalfunctionEffects/AutoNuke.cs | 3 +- .../API/MalfunctionEffects/ForceDecon.cs | 8 +- .../API/MalfunctionEffects/Locks.cs | 2 +- .../GE/Blitz.cs | 11 +- .../GE/BrokenGenerator.cs | 66 ----- .../GE/CassieGoCrazy.cs | 97 +++++++ .../GE/ChangedItemEffect.cs | 139 ++++++++-- .../GE/Impostor.cs | 12 +- .../GE/ItemRain.cs | 2 +- .../GE/KIWIS.cs | 8 +- .../GE/Kaboom.cs | 31 ++- .../GE/Librarby.cs | 2 +- .../GE/OpenBar.cs | 83 ++++-- .../KE.GlobalEventFramework.Examples/GE/R.cs | 11 +- .../GE/RandomSpawn.cs | 10 +- .../GE/Rollback.cs | 75 +++++ .../GE/Shuffle.cs | 8 +- .../GE/Speed.cs | 95 ++++++- .../GE/SwapProtocol.cs | 75 +++-- .../GE/SystemMalfunction.cs | 27 +- .../KE.GlobalEventFramework.Examples.csproj | 12 +- .../MainPlugin.cs | 46 +++- .../MiddleEvents/Disco.cs} | 6 +- .../MiddleEvents/ShuffleInv.cs | 36 +++ .../MiddleEvents/ShufflePosition.cs | 46 ++++ .../MiddleEvents/ShuffleRole.cs | 36 +++ .../MiddleEvents/Speed.cs | 16 +- .../MiddleEvents/WallHack.cs | 12 +- .../KE.GlobalEventFramework/Config.cs | 4 +- .../GEFE/API/Enums/ImpactLevel.cs} | 8 +- .../API/Extensions/ImpactLevelExtension.cs | 28 ++ .../GEFE/API/Features/GlobalEvent.cs | 253 ++++++++++------- .../GEFE/API/Features/KEEvents.cs | 99 ++++++- .../GEFE/API/Features/MiddleEvent.cs | 76 ++--- .../GEFE/API/Interfaces/IChanceRedactable.cs | 19 ++ .../GEFE/API/Interfaces/IGlobalEvent.cs | 41 --- .../GEFE/API/Interfaces/INonRedactable.cs} | 6 +- .../GEFE/API/Utils/Coroutine.cs | 19 -- .../GEFE/Commands/ForceGE.cs | 30 +- .../GEFE/Commands/ForceMiddleEvent.cs | 2 +- .../GEFE/Commands/ForceNbGE.cs | 12 +- .../GEFE/Commands/List.cs | 95 +++++++ .../GEFE/Commands/ListGE.cs | 37 --- .../GEFE/Commands/ParentCommandGEFE.cs | 40 ++- .../Events/EventArgs/DisabledEventArgs.cs | 21 ++ .../GEFE/Events/EventArgs/EnabledEventArgs.cs | 21 ++ .../Events/EventArgs/EnablingEventArgs.cs | 23 ++ .../GEFE/Events/Handlers/KEEventsHandler.cs | 36 +++ .../KE.GlobalEventFramework.csproj | 7 +- .../KE.GlobalEventFramework/MainPlugin.cs | 13 +- KruacentExiled/KE.Items/Config.cs | 18 -- .../KE.Items/Interface/CustomItemEffect.cs | 23 -- .../KE.Items/Interface/ILumosItem.cs | 14 - .../KE.Items/Interface/ISwichableEffect.cs | 13 - .../Interface/IUpgradableCustomItem.cs | 15 - .../ItemEffects/DeployableWallEffect.cs | 54 ---- .../KE.Items/ItemEffects/DivinePillsEffect.cs | 72 ----- .../KE.Items/ItemEffects/HealZoneEffect.cs | 82 ------ .../KE.Items/ItemEffects/MineEffect.cs | 122 --------- .../KE.Items/ItemEffects/MolotovEffect.cs | 121 -------- .../KE.Items/ItemEffects/Scp1650Effect.cs | 103 ------- .../KE.Items/ItemEffects/TPGrenadaEffect.cs | 98 ------- .../KE.Items/Items/AdrenalineDrogue.cs | 259 ------------------ KruacentExiled/KE.Items/Items/Defibrilator.cs | 141 ---------- .../KE.Items/Items/DeployableWall.cs | 76 ----- KruacentExiled/KE.Items/Items/DivinePills.cs | 106 ------- KruacentExiled/KE.Items/Items/HealZone.cs | 82 ------ KruacentExiled/KE.Items/Items/ImpactFlash.cs | 48 ---- KruacentExiled/KE.Items/Items/Mine.cs | 96 ------- .../KE.Items/Items/Models/DeployWallModel.cs | 65 ----- .../KE.Items/Items/Models/MineModel.cs | 52 ---- KruacentExiled/KE.Items/Items/Models/Model.cs | 39 --- KruacentExiled/KE.Items/Items/Molotov.cs | 80 ------ KruacentExiled/KE.Items/Items/PressePuree.cs | 89 ------ .../KE.Items/Items/SainteGrenada.cs | 64 ----- KruacentExiled/KE.Items/Items/Scp1650.cs | 63 ----- KruacentExiled/KE.Items/Items/Scp3136.cs | 91 ------ KruacentExiled/KE.Items/Items/Scp7045.cs | 151 ---------- KruacentExiled/KE.Items/Items/TPGrenada.cs | 75 ----- .../KE.Items/Items/TrueDivinePills.cs | 114 -------- KruacentExiled/KE.Items/KE.Items.csproj | 34 --- KruacentExiled/KE.Items/KECustomGrenade.cs | 28 -- KruacentExiled/KE.Items/KECustomItem.cs | 53 ---- .../KE.Items/Lights/LightsHandler.cs | 114 -------- KruacentExiled/KE.Items/MainPlugin.cs | 60 ---- KruacentExiled/KE.Items/README.md | 21 -- KruacentExiled/KE.Items/Sound.cs | 71 ----- .../KE.Items/Upgrade/UpgradeHandler.cs | 81 ------ .../KE.Items/Upgrade/UpgradeProperties.cs | 35 --- KruacentExiled/KE.Misc/914.cs | 182 ------------ KruacentExiled/KE.Misc/AutoElevator.cs | 37 --- KruacentExiled/KE.Misc/ClassDDoor.cs | 41 --- KruacentExiled/KE.Misc/Config.cs | 21 -- KruacentExiled/KE.Misc/KE.Misc.csproj | 20 -- KruacentExiled/KE.Misc/MainPlugin.cs | 119 -------- KruacentExiled/KE.Misc/README.md | 14 - KruacentExiled/KE.Misc/ServerHandler.cs | 27 -- .../Displays/DisplayMeow/DisplayHandler.cs | 67 ----- .../API/Displays/DisplayMeow/HintPlacement.cs | 31 --- .../KE.Utils/API/Interfaces/IEvents.cs | 17 -- .../KE.Utils/API/ReflectionHelper.cs | 47 ---- .../KE.Utils/Extensions/AdminToyExtension.cs | 25 -- .../KE.Utils/Extensions/PlayerExtension.cs | 52 ---- KruacentExiled/KE.Utils/KE.Utils.csproj | 30 -- .../Quality/Handlers/QualityToysHandler.cs | 179 ------------ .../KE.Utils/Quality/Models/Base/BaseModel.cs | 41 --- .../Quality/Models/Base/LightModel.cs | 26 -- .../Quality/Models/Base/PrimitiveModel.cs | 26 -- .../Quality/Models/Examples/MineModel.cs | 118 -------- .../KE.Utils/Quality/Models/Model.cs | 104 ------- .../KE.Utils/Quality/Models/ModelPrefab.cs | 42 --- .../KE.Utils/Quality/Models/QualityModel.cs | 40 --- .../KE.Utils/Quality/QualityHandler.cs | 61 ----- .../KE.Utils/Quality/QualityToysHandler.cs | 155 ----------- .../Quality/Settings/QualitySettings.cs | 62 ----- .../Quality/Structs/LocalWorldSpace.cs | 23 -- KruacentExiled/KE.Utils/Quality/Tests/Test.cs | 108 -------- KruacentExiled/KruacentExiled.sln | 27 +- README.md | 48 +++- 133 files changed, 1636 insertions(+), 5539 deletions(-) delete mode 100644 KruacentExiled/KE.BlackoutNDoor/API/Features/Controller.cs delete mode 100644 KruacentExiled/KE.BlackoutNDoor/Config.cs delete mode 100644 KruacentExiled/KE.BlackoutNDoor/Handlers/ServerHandler.cs delete mode 100644 KruacentExiled/KE.BlackoutNDoor/KE.BlackoutNDoor.csproj delete mode 100644 KruacentExiled/KE.BlackoutNDoor/MainPlugin.cs create mode 100644 KruacentExiled/KE.GlobalEventFramework.Examples/API/Feature/CassieGoCrazy/AntagonisticCassie.cs create mode 100644 KruacentExiled/KE.GlobalEventFramework.Examples/API/Feature/CassieGoCrazy/ChangeColor.cs create mode 100644 KruacentExiled/KE.GlobalEventFramework.Examples/API/Feature/CassieGoCrazy/ICGCEffect.cs create mode 100644 KruacentExiled/KE.GlobalEventFramework.Examples/API/Feature/CassieGoCrazy/NoLight.cs create mode 100644 KruacentExiled/KE.GlobalEventFramework.Examples/API/Feature/CassieGoCrazy/SadCassie.cs create mode 100644 KruacentExiled/KE.GlobalEventFramework.Examples/API/Feature/CassieGoCrazy/WarheadEffect.cs rename KruacentExiled/KE.GlobalEventFramework.Examples/API/Feature/{ => MF}/MalfunctionDisplay.cs (90%) rename KruacentExiled/KE.GlobalEventFramework.Examples/API/Feature/{ => MF}/MalfunctionEffect.cs (88%) rename KruacentExiled/KE.GlobalEventFramework.Examples/API/Feature/{ => MF}/Malfunctions.cs (92%) delete mode 100644 KruacentExiled/KE.GlobalEventFramework.Examples/GE/BrokenGenerator.cs create mode 100644 KruacentExiled/KE.GlobalEventFramework.Examples/GE/CassieGoCrazy.cs create mode 100644 KruacentExiled/KE.GlobalEventFramework.Examples/GE/Rollback.cs rename KruacentExiled/{KE.Items/Interface/IUse.cs => KE.GlobalEventFramework.Examples/MiddleEvents/Disco.cs} (56%) create mode 100644 KruacentExiled/KE.GlobalEventFramework.Examples/MiddleEvents/ShuffleInv.cs create mode 100644 KruacentExiled/KE.GlobalEventFramework.Examples/MiddleEvents/ShufflePosition.cs create mode 100644 KruacentExiled/KE.GlobalEventFramework.Examples/MiddleEvents/ShuffleRole.cs rename KruacentExiled/{KE.Utils/Quality/Enums/ModelQuality.cs => KE.GlobalEventFramework/GEFE/API/Enums/ImpactLevel.cs} (58%) create mode 100644 KruacentExiled/KE.GlobalEventFramework/GEFE/API/Extensions/ImpactLevelExtension.cs create mode 100644 KruacentExiled/KE.GlobalEventFramework/GEFE/API/Interfaces/IChanceRedactable.cs delete mode 100644 KruacentExiled/KE.GlobalEventFramework/GEFE/API/Interfaces/IGlobalEvent.cs rename KruacentExiled/{KE.Utils/Extensions/RoomExtension.cs => KE.GlobalEventFramework/GEFE/API/Interfaces/INonRedactable.cs} (58%) delete mode 100644 KruacentExiled/KE.GlobalEventFramework/GEFE/API/Utils/Coroutine.cs create mode 100644 KruacentExiled/KE.GlobalEventFramework/GEFE/Commands/List.cs delete mode 100644 KruacentExiled/KE.GlobalEventFramework/GEFE/Commands/ListGE.cs create mode 100644 KruacentExiled/KE.GlobalEventFramework/GEFE/Events/EventArgs/DisabledEventArgs.cs create mode 100644 KruacentExiled/KE.GlobalEventFramework/GEFE/Events/EventArgs/EnabledEventArgs.cs create mode 100644 KruacentExiled/KE.GlobalEventFramework/GEFE/Events/EventArgs/EnablingEventArgs.cs create mode 100644 KruacentExiled/KE.GlobalEventFramework/GEFE/Events/Handlers/KEEventsHandler.cs delete mode 100644 KruacentExiled/KE.Items/Config.cs delete mode 100644 KruacentExiled/KE.Items/Interface/CustomItemEffect.cs delete mode 100644 KruacentExiled/KE.Items/Interface/ILumosItem.cs delete mode 100644 KruacentExiled/KE.Items/Interface/ISwichableEffect.cs delete mode 100644 KruacentExiled/KE.Items/Interface/IUpgradableCustomItem.cs delete mode 100644 KruacentExiled/KE.Items/ItemEffects/DeployableWallEffect.cs delete mode 100644 KruacentExiled/KE.Items/ItemEffects/DivinePillsEffect.cs delete mode 100644 KruacentExiled/KE.Items/ItemEffects/HealZoneEffect.cs delete mode 100644 KruacentExiled/KE.Items/ItemEffects/MineEffect.cs delete mode 100644 KruacentExiled/KE.Items/ItemEffects/MolotovEffect.cs delete mode 100644 KruacentExiled/KE.Items/ItemEffects/Scp1650Effect.cs delete mode 100644 KruacentExiled/KE.Items/ItemEffects/TPGrenadaEffect.cs delete mode 100644 KruacentExiled/KE.Items/Items/AdrenalineDrogue.cs delete mode 100644 KruacentExiled/KE.Items/Items/Defibrilator.cs delete mode 100644 KruacentExiled/KE.Items/Items/DeployableWall.cs delete mode 100644 KruacentExiled/KE.Items/Items/DivinePills.cs delete mode 100644 KruacentExiled/KE.Items/Items/HealZone.cs delete mode 100644 KruacentExiled/KE.Items/Items/ImpactFlash.cs delete mode 100644 KruacentExiled/KE.Items/Items/Mine.cs delete mode 100644 KruacentExiled/KE.Items/Items/Models/DeployWallModel.cs delete mode 100644 KruacentExiled/KE.Items/Items/Models/MineModel.cs delete mode 100644 KruacentExiled/KE.Items/Items/Models/Model.cs delete mode 100644 KruacentExiled/KE.Items/Items/Molotov.cs delete mode 100644 KruacentExiled/KE.Items/Items/PressePuree.cs delete mode 100644 KruacentExiled/KE.Items/Items/SainteGrenada.cs delete mode 100644 KruacentExiled/KE.Items/Items/Scp1650.cs delete mode 100644 KruacentExiled/KE.Items/Items/Scp3136.cs delete mode 100644 KruacentExiled/KE.Items/Items/Scp7045.cs delete mode 100644 KruacentExiled/KE.Items/Items/TPGrenada.cs delete mode 100644 KruacentExiled/KE.Items/Items/TrueDivinePills.cs delete mode 100644 KruacentExiled/KE.Items/KE.Items.csproj delete mode 100644 KruacentExiled/KE.Items/KECustomGrenade.cs delete mode 100644 KruacentExiled/KE.Items/KECustomItem.cs delete mode 100644 KruacentExiled/KE.Items/Lights/LightsHandler.cs delete mode 100644 KruacentExiled/KE.Items/MainPlugin.cs delete mode 100644 KruacentExiled/KE.Items/README.md delete mode 100644 KruacentExiled/KE.Items/Sound.cs delete mode 100644 KruacentExiled/KE.Items/Upgrade/UpgradeHandler.cs delete mode 100644 KruacentExiled/KE.Items/Upgrade/UpgradeProperties.cs delete mode 100644 KruacentExiled/KE.Misc/914.cs delete mode 100644 KruacentExiled/KE.Misc/AutoElevator.cs delete mode 100644 KruacentExiled/KE.Misc/ClassDDoor.cs delete mode 100644 KruacentExiled/KE.Misc/Config.cs delete mode 100644 KruacentExiled/KE.Misc/KE.Misc.csproj delete mode 100644 KruacentExiled/KE.Misc/MainPlugin.cs delete mode 100644 KruacentExiled/KE.Misc/README.md delete mode 100644 KruacentExiled/KE.Misc/ServerHandler.cs delete mode 100644 KruacentExiled/KE.Utils/API/Displays/DisplayMeow/DisplayHandler.cs delete mode 100644 KruacentExiled/KE.Utils/API/Displays/DisplayMeow/HintPlacement.cs delete mode 100644 KruacentExiled/KE.Utils/API/Interfaces/IEvents.cs delete mode 100644 KruacentExiled/KE.Utils/API/ReflectionHelper.cs delete mode 100644 KruacentExiled/KE.Utils/Extensions/AdminToyExtension.cs delete mode 100644 KruacentExiled/KE.Utils/Extensions/PlayerExtension.cs delete mode 100644 KruacentExiled/KE.Utils/KE.Utils.csproj delete mode 100644 KruacentExiled/KE.Utils/Quality/Handlers/QualityToysHandler.cs delete mode 100644 KruacentExiled/KE.Utils/Quality/Models/Base/BaseModel.cs delete mode 100644 KruacentExiled/KE.Utils/Quality/Models/Base/LightModel.cs delete mode 100644 KruacentExiled/KE.Utils/Quality/Models/Base/PrimitiveModel.cs delete mode 100644 KruacentExiled/KE.Utils/Quality/Models/Examples/MineModel.cs delete mode 100644 KruacentExiled/KE.Utils/Quality/Models/Model.cs delete mode 100644 KruacentExiled/KE.Utils/Quality/Models/ModelPrefab.cs delete mode 100644 KruacentExiled/KE.Utils/Quality/Models/QualityModel.cs delete mode 100644 KruacentExiled/KE.Utils/Quality/QualityHandler.cs delete mode 100644 KruacentExiled/KE.Utils/Quality/QualityToysHandler.cs delete mode 100644 KruacentExiled/KE.Utils/Quality/Settings/QualitySettings.cs delete mode 100644 KruacentExiled/KE.Utils/Quality/Structs/LocalWorldSpace.cs delete mode 100644 KruacentExiled/KE.Utils/Quality/Tests/Test.cs diff --git a/KruacentExiled/KE.BlackoutNDoor/API/Features/Controller.cs b/KruacentExiled/KE.BlackoutNDoor/API/Features/Controller.cs deleted file mode 100644 index 387d1a6a..00000000 --- a/KruacentExiled/KE.BlackoutNDoor/API/Features/Controller.cs +++ /dev/null @@ -1,192 +0,0 @@ -using Exiled.API.Enums; -using Exiled.API.Features; -using Exiled.API.Features.Doors; -using MEC; -using System; -using System.Collections.Generic; -using System.Linq; - -namespace KE.BlackoutNDoor.API.Features -{ - public class Controller - { - private DoorType[] BlacklistedDoor = { DoorType.ElevatorGateA, DoorType.ElevatorGateB, DoorType.ElevatorLczA, DoorType.ElevatorLczB, DoorType.ElevatorNuke, DoorType.ElevatorScp049, DoorType.UnknownElevator }; - - /// - /// Select a random zone and close and lock all door of the zone - /// - internal IEnumerator RandomDoorStuck() - { - yield return Timing.WaitUntilTrue(() => Round.IsStarted); - var zone = SelectZone(); - Log.Debug($"DoorStuck in {zone}"); - yield return Timing.WaitUntilFalse(() => Cassie.IsSpeaking); - CassieVoiceLine(zone, false); - yield return Timing.WaitUntilFalse(() => Cassie.IsSpeaking); - yield return Timing.WaitForSeconds(MainPlugin.Instance.Config.DurationMalfunction); - // if the zone is light and there is only 30s left then skip - if (!(zone == ZoneType.LightContainment && Map.DecontaminationState == DecontaminationState.Countdown && Warhead.IsInProgress)) - { - List doorList = Door.List - .Where(d => !BlacklistedDoor.Contains(d.Type)) - .ToList(); - var ge = Generator.List.Where(g => g.IsEngaged); - if(ge.ToList().Count != 3) - { - doorList = Door.List - .Where(d => !BlacklistedDoor.Union(new[] { DoorType.Scp079First, DoorType.Scp079Second }).Contains(d.Type)) - .ToList(); - } - foreach (Door door in doorList) - { - - if (door.Zone == zone) - { - door.IsOpen = false; - door.ChangeLock(DoorLockType.Lockdown2176); - Timing.CallDelayed(MainPlugin.Instance.Config.DurationMalfunction / 2, () => door.IsOpen = true); - Timing.CallDelayed(MainPlugin.Instance.Config.DurationMalfunction, () => door.Unlock()); - if (UnityEngine.Random.value < .5f) - { - door.IsOpen = false; - } - } - } - } - } - - /// - /// Select a random zone and blackout it - /// - public IEnumerator RandomBlackout() - { - yield return Timing.WaitUntilTrue(() => Round.IsStarted); - - var zone = SelectZone(); - yield return Timing.WaitUntilFalse(() => Cassie.IsSpeaking); - CassieVoiceLine(zone, true); - yield return Timing.WaitUntilFalse(() => Cassie.IsSpeaking); - yield return Timing.WaitForSeconds(MainPlugin.Instance.Config.DurationMalfunction); - Log.Debug($"BlackOut in {zone}"); - - - Map.TurnOffAllLights(MainPlugin.Instance.Config.DurationMalfunction, zone); - } - - - private void CassieVoiceLine(ZoneType zone,bool isBlackout) - { - if (isBlackout) - { - switch (zone) - { - case ZoneType.LightContainment: - Cassie.MessageTranslated("Warning Failure Of All Lights In Light Containment Zone in 5 seconds", - "Warning Failure Of All Lights In Light Containment Zone in 5 seconds", false, false); - break; - case ZoneType.HeavyContainment: - Cassie.MessageTranslated("Warning Failure Of All Lights In Heavy Containment Zone in 5 seconds", - "Warning Failure Of All Lights In Heavy Containment Zone in 5 seconds", false, false); - break; - case ZoneType.Entrance: - Cassie.MessageTranslated("Warning Failure Of All Lights In Entrance Zone in 5 seconds", - "Warning Failure Of All Lights In Entrance Zone in 5 seconds", false, false); - break ; - case ZoneType.Surface: - Cassie.MessageTranslated("Warning Failure Of All Lights In Surface in 5 seconds", - "Warning Failure Of All Lights In Surface in 5 seconds", false, false); - break ; - case ZoneType.Unspecified: - Cassie.MessageTranslated("Warning Failure Of All Lights In All Of The Facility in 5 seconds", - "Warning Failure Of All Lights In All Of The Facility in 5 seconds", false, false); - break; - } - } - else - { - switch (zone) - { - case ZoneType.LightContainment: - Cassie.MessageTranslated("Door system malfunction in Light Containment Zone in 5 seconds", - "Door system malfunction in Light containment zone in 5 seconds", false,false); - break; - case ZoneType.HeavyContainment: - Cassie.MessageTranslated("Door system malfunction in Heavy Containment Zone in 5 seconds", - "Door system malfunction in Heavy zone in 5 seconds", false, false); - break; - case ZoneType.Entrance: - Cassie.MessageTranslated("Door system malfunction in Entrance zone in 5 seconds", - "Door system malfunction in Entrance zone in 5 seconds", false, false); - break; - case ZoneType.Surface: - Cassie.MessageTranslated("Door system malfunction in Surface Zone in 5 seconds", - "Door system malfunction in Surface zone in 5 seconds", false, false); - break; - case ZoneType.Unspecified: - Cassie.MessageTranslated("Door system malfunction in All of the facility in 5 seconds", - "Door system malfunction in All of the facility in 5 seconds", false, false); - break; - } - } - } - - /// - /// Select a random zone - /// If the nuke is detonated return only SurfaceZone - /// - /// a zone - private ZoneType SelectZone() - { - ZoneType z = ZoneType.Unspecified; - float random = UnityEngine.Random.value; - if (Warhead.IsDetonated) - { - z= ZoneType.Surface; - } - if (!Map.IsLczDecontaminated) - { - z= GetZoneType(GetProbabilityIndex(MainPlugin.Instance.Config.ChancePreConta, random)); - } - else - { - z= GetZoneType(GetProbabilityIndex(MainPlugin.Instance.Config.ChancePostConta, random)); - } - Log.Debug($"zone={z}"); - return z; - } - - private int GetProbabilityIndex(float[] probabilities, float randomValue) - { - float cumulative = 0f; - - for (int i = 0; i < probabilities.Length; i++) - { - cumulative += probabilities[i]; - if (randomValue <= cumulative) - { - return i; - } - } - - throw new ArgumentException("Random value is outside the range of probabilities."); - } - - private ZoneType GetZoneType(int index) - { - switch (index) - { - case 0: - return ZoneType.LightContainment; - case 1: - return ZoneType.HeavyContainment; - case 2: - return ZoneType.Entrance; - case 3: - return ZoneType.Surface; - default: - case 4: - return ZoneType.Unspecified; - } - } - } -} diff --git a/KruacentExiled/KE.BlackoutNDoor/Config.cs b/KruacentExiled/KE.BlackoutNDoor/Config.cs deleted file mode 100644 index 0deae7a6..00000000 --- a/KruacentExiled/KE.BlackoutNDoor/Config.cs +++ /dev/null @@ -1,29 +0,0 @@ -using Exiled.API.Interfaces; -using System; -using System.Collections.Generic; -using System.ComponentModel; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace KE.BlackoutNDoor -{ - public class Config : IConfig - { - public bool IsEnabled { get; set; } = true; - public bool Debug { get; set; } = false; - - [Description("the minimum interval between 2 malfunctions")] - public int MinInterval { get; set; } = 300; - [Description("the maximum interval between 2 malfunctions")] - public int MaxInterval { get; set; } = 600; - [Description("chance of having a Blackout at the start of the game")] - public double InitialChanceBO { get; set; } = 0.5; - [Description("the duration of a malfunction")] - public int DurationMalfunction { get; set; } = 30; - [Description("chance before decontamination")] - public float[] ChancePreConta = { .2f, .3f, .3f, .15f, .05f }; - [Description("chance after decontamination")] - public float[] ChancePostConta = { 0, .4f, .4f, .15f, .05f }; - } -} diff --git a/KruacentExiled/KE.BlackoutNDoor/Handlers/ServerHandler.cs b/KruacentExiled/KE.BlackoutNDoor/Handlers/ServerHandler.cs deleted file mode 100644 index 2257b987..00000000 --- a/KruacentExiled/KE.BlackoutNDoor/Handlers/ServerHandler.cs +++ /dev/null @@ -1,69 +0,0 @@ -using KE.BlackoutNDoor.API.Features; -using Exiled.API.Features; -using MEC; -using System.Collections.Generic; - -namespace KE.BlackoutNDoor.Handlers -{ - public class ServerHandler - { - public int Cooldown { get; set; } = -1 ; - internal double ChanceBO { get; set; } = MainPlugin.Instance.Config.InitialChanceBO; - private readonly Controller Controller; - private static CoroutineHandle Handle; - internal ServerHandler(Controller con) - { - Controller = con; - } - internal void OnRoundStarted() - { - Log.Debug($"handle = {Handle}"); - Timing.KillCoroutines(Handle); - Handle = Timing.RunCoroutine(Update()); - - } - - - private IEnumerator Update() - { - yield return Timing.WaitUntilTrue(() => Round.InProgress); - Log.Debug("startUpdate"); - int wait; - if (Cooldown == -1) - wait = UnityEngine.Random.Range(MainPlugin.Instance.Config.MinInterval, MainPlugin.Instance.Config.MaxInterval); - else - wait = Cooldown; - Log.Debug($"waiting for {wait}"); - yield return Timing.WaitForSeconds(wait); - while (Round.InProgress) - { - var a = UnityEngine.Random.value; - Log.Debug("random =" + a); - if (Round.InProgress) - { - if (a <= ChanceBO) - { - Log.Debug("BlackOut"); - - CoroutineHandle coroutine = Timing.RunCoroutine(Controller.RandomBlackout()); - yield return Timing.WaitUntilDone(coroutine); - } - else - { - Log.Debug("DoorStuck"); - CoroutineHandle coroutine = Timing.RunCoroutine(Controller.RandomDoorStuck()); - yield return Timing.WaitUntilDone(coroutine); - } - } - wait = UnityEngine.Random.Range(MainPlugin.Instance.Config.MinInterval, MainPlugin.Instance.Config.MaxInterval); - Log.Debug($"waiting : {wait}"); - yield return Timing.WaitForSeconds(wait); - yield return Timing.WaitUntilFalse(() => Warhead.IsInProgress); - - ChanceBO = -(1 / 60) * Round.ElapsedTime.TotalMinutes + 0.5; - Log.Debug($"new ChanceBO = {ChanceBO}"); - } - } - - } -} diff --git a/KruacentExiled/KE.BlackoutNDoor/KE.BlackoutNDoor.csproj b/KruacentExiled/KE.BlackoutNDoor/KE.BlackoutNDoor.csproj deleted file mode 100644 index 9515ab33..00000000 --- a/KruacentExiled/KE.BlackoutNDoor/KE.BlackoutNDoor.csproj +++ /dev/null @@ -1,17 +0,0 @@ - - - - net48 - - - - - - - - - - - - - diff --git a/KruacentExiled/KE.BlackoutNDoor/MainPlugin.cs b/KruacentExiled/KE.BlackoutNDoor/MainPlugin.cs deleted file mode 100644 index 19085cd5..00000000 --- a/KruacentExiled/KE.BlackoutNDoor/MainPlugin.cs +++ /dev/null @@ -1,51 +0,0 @@ -using KE.BlackoutNDoor.API.Features; -using KE.BlackoutNDoor.Handlers; -using Exiled.API.Features; -using System; -using System.ComponentModel; -using Server = Exiled.Events.Handlers.Server; - -namespace KE.BlackoutNDoor -{ - public class MainPlugin : Plugin - { - public override string Author => "Patrique"; - public override Version Version => new Version(1,0,0); - public override string Name => "KE.BlackoutDoor"; - internal static MainPlugin Instance; - private Controller Controller; - public ServerHandler ServerHandler { get; private set; } - - public override void OnEnabled() - { - Instance = this; - Controller = new Controller(); - this.RegisterEvent(); - } - public override void OnDisabled() - { - - Instance = null; - Controller = null; - this.UnregisterEvent(); - } - - private void RegisterEvent() - { - ServerHandler = new ServerHandler(Controller); - Server.RoundStarted += ServerHandler.OnRoundStarted; - - } - private void UnregisterEvent() - { - Server.RoundStarted -= ServerHandler.OnRoundStarted; - - ServerHandler = null; - } - - - - - - } -} diff --git a/KruacentExiled/KE.GlobalEventFramework.Examples/API/Feature/CassieGoCrazy/AntagonisticCassie.cs b/KruacentExiled/KE.GlobalEventFramework.Examples/API/Feature/CassieGoCrazy/AntagonisticCassie.cs new file mode 100644 index 00000000..7b3c2735 --- /dev/null +++ b/KruacentExiled/KE.GlobalEventFramework.Examples/API/Feature/CassieGoCrazy/AntagonisticCassie.cs @@ -0,0 +1,91 @@ +using Exiled.API.Extensions; +using Exiled.API.Features; +using Exiled.Events.EventArgs.Player; +using KE.GlobalEventFramework.GEFE.API.Features.Hints; +using KE.GlobalEventFramework.GEFE.API.Interfaces; +using KE.Utils.API.Interfaces; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using static UnityEngine.GraphicsBuffer; + +namespace KE.GlobalEventFramework.Examples.API.Feature.CassieGoCrazy +{ + // Turns off the lights in the Heavy Containment zone. + public class AntagonisticCassie : ICGCEffect, IUsingEvents + { + private Player target; + /// + /// Percentage for rare event to occur + /// + public int RareEvent { get; set; } = 2; + private bool flag = false; + + public IReadOnlyCollection Reward { get; } = new HashSet() + { + ItemType.ParticleDisruptor, + ItemType.Coin, + ItemType.KeycardO5, + ItemType.SCP268 + }; + + + + public void Effect() + { + List nonScpPlayers = Player.List.Where(player => !player.IsScp).ToList(); + + /*if (nonScpPlayers.Count > 0) + { + target = nonScpPlayers[UnityEngine.Random.Range(0, nonScpPlayers.Count)]; + + Cassie.Message("New target : " + target.Nickname, true, true, true); + + flag = true; + + + }*/ + } + + private void OnPlayerDeath(DyingEventArgs ev) + { + if (!flag) return; + + + if (ev.Player == target && ev.Attacker != null && ev.Attacker != target) + { + if (!ev.Attacker.IsScp) + { + GiveRandomRewardPlayer(ev.Attacker); + } + flag = false; + } + } + + private void GiveRandomRewardPlayer(Player player) + { + + ItemType randomItem = Reward.GetRandomValue(); + + player.AddItem(randomItem); + + if (UnityEngine.Random.Range(0, 100) < RareEvent) + { + player.MaxHealth += 25; + DisplayHints.AddHintEffect(player, "Another gift for you!", 5); + } + } + + public void SubscribeEvents() + { + Exiled.Events.Handlers.Player.Dying += OnPlayerDeath; + } + + public void UnsubscribeEvents() + { + Exiled.Events.Handlers.Player.Dying -= OnPlayerDeath; + } + } +} diff --git a/KruacentExiled/KE.GlobalEventFramework.Examples/API/Feature/CassieGoCrazy/ChangeColor.cs b/KruacentExiled/KE.GlobalEventFramework.Examples/API/Feature/CassieGoCrazy/ChangeColor.cs new file mode 100644 index 00000000..4288c161 --- /dev/null +++ b/KruacentExiled/KE.GlobalEventFramework.Examples/API/Feature/CassieGoCrazy/ChangeColor.cs @@ -0,0 +1,18 @@ +using Exiled.API.Features; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace KE.GlobalEventFramework.Examples.API.Feature.CassieGoCrazy +{ + // Turns off the lights in the Heavy Containment zone. + public class ChangeColor : ICGCEffect + { + public void Effect() + { + Exiled.API.Features.Map.ChangeLightsColor(UnityEngine.Color.cyan); + } + } +} diff --git a/KruacentExiled/KE.GlobalEventFramework.Examples/API/Feature/CassieGoCrazy/ICGCEffect.cs b/KruacentExiled/KE.GlobalEventFramework.Examples/API/Feature/CassieGoCrazy/ICGCEffect.cs new file mode 100644 index 00000000..83331aab --- /dev/null +++ b/KruacentExiled/KE.GlobalEventFramework.Examples/API/Feature/CassieGoCrazy/ICGCEffect.cs @@ -0,0 +1,15 @@ +using Exiled.API.Features; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace KE.GlobalEventFramework.Examples.API.Feature.CassieGoCrazy +{ + public interface ICGCEffect + { + + public abstract void Effect(); + } +} diff --git a/KruacentExiled/KE.GlobalEventFramework.Examples/API/Feature/CassieGoCrazy/NoLight.cs b/KruacentExiled/KE.GlobalEventFramework.Examples/API/Feature/CassieGoCrazy/NoLight.cs new file mode 100644 index 00000000..02f0a72e --- /dev/null +++ b/KruacentExiled/KE.GlobalEventFramework.Examples/API/Feature/CassieGoCrazy/NoLight.cs @@ -0,0 +1,18 @@ +using Exiled.API.Features; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace KE.GlobalEventFramework.Examples.API.Feature.CassieGoCrazy +{ + // Turns off the lights in the Heavy Containment zone. + public class NoLight : ICGCEffect + { + public void Effect() + { + Exiled.API.Features.Map.TurnOffAllLights(20, Exiled.API.Enums.ZoneType.HeavyContainment); + } + } +} diff --git a/KruacentExiled/KE.GlobalEventFramework.Examples/API/Feature/CassieGoCrazy/SadCassie.cs b/KruacentExiled/KE.GlobalEventFramework.Examples/API/Feature/CassieGoCrazy/SadCassie.cs new file mode 100644 index 00000000..7e4d4686 --- /dev/null +++ b/KruacentExiled/KE.GlobalEventFramework.Examples/API/Feature/CassieGoCrazy/SadCassie.cs @@ -0,0 +1,38 @@ +using Exiled.API.Features; +using Exiled.API.Features.Items; +using MEC; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace KE.GlobalEventFramework.Examples.API.Feature.CassieGoCrazy +{ + // Sad Cassie scenario. + public class SadCassie : ICGCEffect + { + public void Effect() + { + + //Cassie.Message("I wanna just be useful", true, true, true); + Exiled.API.Features.Map.TurnOffAllLights(2, Exiled.API.Enums.ZoneType.HeavyContainment); + Exiled.API.Features.Map.TurnOffAllLights(2, Exiled.API.Enums.ZoneType.Entrance); + + + if (!Warhead.IsDetonated) + Warhead.Start(); + + for (int i = 0; i < 10; i++) + { + ((ExplosiveGrenade)Item.Create(ItemType.GrenadeHE)).SpawnActive(Room.Random().Position); + } + + Timing.CallDelayed(10, delegate + { + Warhead.Stop(); + }); + + } + } +} diff --git a/KruacentExiled/KE.GlobalEventFramework.Examples/API/Feature/CassieGoCrazy/WarheadEffect.cs b/KruacentExiled/KE.GlobalEventFramework.Examples/API/Feature/CassieGoCrazy/WarheadEffect.cs new file mode 100644 index 00000000..4b51aea5 --- /dev/null +++ b/KruacentExiled/KE.GlobalEventFramework.Examples/API/Feature/CassieGoCrazy/WarheadEffect.cs @@ -0,0 +1,21 @@ +using Exiled.API.Features; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace KE.GlobalEventFramework.Examples.API.Feature.CassieGoCrazy +{ + // Starting the Warhead + public class WarheadEffect : ICGCEffect + { + public void Effect() + { + if (!Warhead.IsDetonated) + { + Warhead.Start(); + } + } + } +} diff --git a/KruacentExiled/KE.GlobalEventFramework.Examples/API/Feature/MalfunctionDisplay.cs b/KruacentExiled/KE.GlobalEventFramework.Examples/API/Feature/MF/MalfunctionDisplay.cs similarity index 90% rename from KruacentExiled/KE.GlobalEventFramework.Examples/API/Feature/MalfunctionDisplay.cs rename to KruacentExiled/KE.GlobalEventFramework.Examples/API/Feature/MF/MalfunctionDisplay.cs index 0391dfe2..b5934cb1 100644 --- a/KruacentExiled/KE.GlobalEventFramework.Examples/API/Feature/MalfunctionDisplay.cs +++ b/KruacentExiled/KE.GlobalEventFramework.Examples/API/Feature/MF/MalfunctionDisplay.cs @@ -6,7 +6,7 @@ using System.Collections.Generic; using System.Linq; -namespace KE.GlobalEventFramework.Examples.API.Feature +namespace KE.GlobalEventFramework.Examples.API.Feature.mf { public class MalfunctionDisplay { @@ -60,12 +60,12 @@ private string GetCurrentMalfunction() sbyte malfunction = _malfunction.Malfunction; sbyte previous = _malfunction.PreviousMalfunction; if (malfunction > previous) - return $" {malfunction}\u2191 (+{malfunction-previous})"; - if(malfunction < previous) + return $" {malfunction}\u2191 (+{malfunction - previous})"; + if (malfunction < previous) return $" {malfunction}\u2193 ({malfunction - previous})"; - else + else return $" {malfunction}\u2192 ({malfunction - previous})"; - + } private string GetAllEffect() @@ -85,9 +85,9 @@ private string GetAllEffect() } private bool IsREActivated(MalfunctionEffect me) { - if(me is IReversibleEffect re) + if (me is IReversibleEffect re) { - if(_malfunction.Malfunction >= re.MalfunctionDeactivation) + if (_malfunction.Malfunction >= re.MalfunctionDeactivation) { return true; } @@ -95,6 +95,6 @@ private bool IsREActivated(MalfunctionEffect me) return false; } - + } } diff --git a/KruacentExiled/KE.GlobalEventFramework.Examples/API/Feature/MalfunctionEffect.cs b/KruacentExiled/KE.GlobalEventFramework.Examples/API/Feature/MF/MalfunctionEffect.cs similarity index 88% rename from KruacentExiled/KE.GlobalEventFramework.Examples/API/Feature/MalfunctionEffect.cs rename to KruacentExiled/KE.GlobalEventFramework.Examples/API/Feature/MF/MalfunctionEffect.cs index 93789040..6a793ef9 100644 --- a/KruacentExiled/KE.GlobalEventFramework.Examples/API/Feature/MalfunctionEffect.cs +++ b/KruacentExiled/KE.GlobalEventFramework.Examples/API/Feature/MF/MalfunctionEffect.cs @@ -4,7 +4,7 @@ using System.Text; using System.Threading.Tasks; -namespace KE.GlobalEventFramework.Examples.API.Feature +namespace KE.GlobalEventFramework.Examples.API.Feature.mf { public abstract class MalfunctionEffect { diff --git a/KruacentExiled/KE.GlobalEventFramework.Examples/API/Feature/Malfunctions.cs b/KruacentExiled/KE.GlobalEventFramework.Examples/API/Feature/MF/Malfunctions.cs similarity index 92% rename from KruacentExiled/KE.GlobalEventFramework.Examples/API/Feature/Malfunctions.cs rename to KruacentExiled/KE.GlobalEventFramework.Examples/API/Feature/MF/Malfunctions.cs index 942c4fff..1eae759a 100644 --- a/KruacentExiled/KE.GlobalEventFramework.Examples/API/Feature/Malfunctions.cs +++ b/KruacentExiled/KE.GlobalEventFramework.Examples/API/Feature/MF/Malfunctions.cs @@ -17,7 +17,7 @@ using System.Threading.Tasks; using Utils.NonAllocLINQ; -namespace KE.GlobalEventFramework.Examples.API.Feature +namespace KE.GlobalEventFramework.Examples.API.Feature.mf { public class Malfunctions { @@ -38,7 +38,7 @@ public sbyte Malfunction public MalfunctionLevel MalfunctionLevels { - get{return (MalfunctionLevel) Malfunction;} + get { return (MalfunctionLevel)Malfunction; } } private static HashSet _malfunctionEffects = new HashSet(); @@ -54,8 +54,8 @@ public static bool EffectAlreadyActivated(MalfunctionEffect effect) public sbyte PreviousMalfunction { get; private set; } public sbyte MalfunctionAdd { get; set; } = 1; public MalfunctionDisplay MalfunctionDisplay { get; private set; } - - + + internal Malfunctions(bool display = true) { try @@ -70,7 +70,7 @@ internal Malfunctions(bool display = true) Log.Error(ex + "\nRueI is probably missing : put it in dependency or disable the display"); MalfunctionDisplay = null; } - + LoadMalfunctionsEffect(); } @@ -93,7 +93,7 @@ private void LoadMalfunctionsEffect() _malfunctionEffects.Add(me); } } - catch (System.Exception e) + catch (Exception e) { Log.Error($"Error registering in plugin {plugin.Name} : {e.Message}"); } @@ -128,24 +128,24 @@ private void CheckMalfunctionEffect(sbyte malfunction) if (!_voiced[me]) { _voiced[me] = true; - Cassie.MessageTranslated(me.VoiceLine,me.VoiceLineTranslated,false,false); + //Cassie.MessageTranslated(me.VoiceLine, me.VoiceLineTranslated, false, false); } me.ActivateEffect(); } - if(me is IReversibleEffect re && malfunction < re.MalfunctionDeactivation) + if (me is IReversibleEffect re && malfunction < re.MalfunctionDeactivation) { if (!_voicedDeactivate[me]) { _voicedDeactivate[me] = true; - Cassie.MessageTranslated(re.VoiceLineDeactivate, re.VoiceLineDeactivateTranslated, false, false); + //Cassie.MessageTranslated(re.VoiceLineDeactivate, re.VoiceLineDeactivateTranslated, false, false); } re.DeactivateEffect(); } } } - + private sbyte AdditionnalMalfunction() diff --git a/KruacentExiled/KE.GlobalEventFramework.Examples/API/MalfunctionEffects/AutoNuke.cs b/KruacentExiled/KE.GlobalEventFramework.Examples/API/MalfunctionEffects/AutoNuke.cs index 49344ed7..f116532a 100644 --- a/KruacentExiled/KE.GlobalEventFramework.Examples/API/MalfunctionEffects/AutoNuke.cs +++ b/KruacentExiled/KE.GlobalEventFramework.Examples/API/MalfunctionEffects/AutoNuke.cs @@ -1,6 +1,5 @@ using Exiled.API.Features; -using KE.GlobalEventFramework.Examples.API.Feature; -using KE.GlobalEventFramework.Examples.API.Interfaces; +using KE.GlobalEventFramework.Examples.API.Feature.mf; using KE.GlobalEventFramework.Examples.GE; using MEC; using System; diff --git a/KruacentExiled/KE.GlobalEventFramework.Examples/API/MalfunctionEffects/ForceDecon.cs b/KruacentExiled/KE.GlobalEventFramework.Examples/API/MalfunctionEffects/ForceDecon.cs index 09addb75..1a33fdb4 100644 --- a/KruacentExiled/KE.GlobalEventFramework.Examples/API/MalfunctionEffects/ForceDecon.cs +++ b/KruacentExiled/KE.GlobalEventFramework.Examples/API/MalfunctionEffects/ForceDecon.cs @@ -3,7 +3,7 @@ using Exiled.API.Enums; using Exiled.API.Features; using Exiled.API.Features.Doors; -using KE.GlobalEventFramework.Examples.API.Feature; +using KE.GlobalEventFramework.Examples.API.Feature.mf; using MEC; using System.Linq; @@ -18,7 +18,7 @@ internal class ForceDecon : MalfunctionEffect public override void ActivateEffect() { - if (Map.IsLczDecontaminated || !Map.IsLczDecontaminated) return; + if (Exiled.API.Features.Map.IsLczDecontaminated || !Exiled.API.Features.Map.IsLczDecontaminated) return; Door.List.ToList().ForEach(d => { if (d.Zone == ZoneType.LightContainment) @@ -31,9 +31,9 @@ public override void ActivateEffect() } }); - Timing.CallDelayed(30 + Cassie.CalculateDuration(VoiceLine), () => + Timing.CallDelayed(30, () => { - Map.StartDecontamination(); + Exiled.API.Features.Map.StartDecontamination(); foreach (Door d in Door.List) { diff --git a/KruacentExiled/KE.GlobalEventFramework.Examples/API/MalfunctionEffects/Locks.cs b/KruacentExiled/KE.GlobalEventFramework.Examples/API/MalfunctionEffects/Locks.cs index ef71c7eb..50b31266 100644 --- a/KruacentExiled/KE.GlobalEventFramework.Examples/API/MalfunctionEffects/Locks.cs +++ b/KruacentExiled/KE.GlobalEventFramework.Examples/API/MalfunctionEffects/Locks.cs @@ -1,7 +1,7 @@ using Exiled.API.Enums; using Exiled.API.Features; using Exiled.API.Features.Doors; -using KE.GlobalEventFramework.Examples.API.Feature; +using KE.GlobalEventFramework.Examples.API.Feature.mf; using KE.GlobalEventFramework.Examples.API.Interfaces; using MEC; using System; diff --git a/KruacentExiled/KE.GlobalEventFramework.Examples/GE/Blitz.cs b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/Blitz.cs index 5d239393..a6600727 100644 --- a/KruacentExiled/KE.GlobalEventFramework.Examples/GE/Blitz.cs +++ b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/Blitz.cs @@ -1,5 +1,6 @@ using Exiled.API.Features; using Exiled.API.Features.Items; +using KE.GlobalEventFramework.GEFE.API.Enums; using KE.GlobalEventFramework.GEFE.API.Features; using KE.GlobalEventFramework.GEFE.API.Interfaces; using MEC; @@ -17,7 +18,11 @@ public class Blitz : GlobalEvent, IStart /// public override string Name { get; set; } = "Blitz"; /// - public override string Description { get; set; } = "éteignez les lumières la luftwaffe arrive"; + public override string Description { get; } = "La Luftwaffe arrive!"; + public override string[] AltDescription => + [ + "Attention aux bombardements!" + ]; /// public override int WeightedChance => 1; /// @@ -28,6 +33,10 @@ public class Blitz : GlobalEvent, IStart /// The number of grenades in each spawn /// public int NbGrenadeSpawned { get; set; } = 5; + + public override ImpactLevel ImpactLevel => ImpactLevel.Low; + + /// public IEnumerator Start() { diff --git a/KruacentExiled/KE.GlobalEventFramework.Examples/GE/BrokenGenerator.cs b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/BrokenGenerator.cs deleted file mode 100644 index 38df3c0e..00000000 --- a/KruacentExiled/KE.GlobalEventFramework.Examples/GE/BrokenGenerator.cs +++ /dev/null @@ -1,66 +0,0 @@ -using Player = Exiled.API.Features.Player; -using System.Collections.Generic; -using KE.GlobalEventFramework.GEFE.API.Features; -using KE.GlobalEventFramework.GEFE.API.Interfaces; -using MEC; -using Exiled.API.Features; -using Exiled.API.Enums; -using Exiled.API.Features.Doors; -using Exiled.Events.EventArgs.Map; -using System.Linq; -using System.Drawing.Imaging; - -namespace KE.GlobalEventFramework.Examples.GE -{ - public class BrokenGenerator : GlobalEvent, IStart, IEvent - { - public override uint Id { get; set; } = 1050; - public override string Name { get; set; } = "Broken Generator"; - public override string Description { get; set; } = "Repair the generator to be able to see!"; - public override int WeightedChance { get; set; } = 0; - - //add event to avoid blackouts - public List zones = new List - { - ZoneType.LightContainment, - ZoneType.HeavyContainment, - ZoneType.Entrance, - ZoneType.Surface, - ZoneType.Pocket - }; - - public IEnumerator Start() - { - zones.ForEach(zone => Map.TurnOffAllLights(99999999, zone)); - - foreach (Player player in Player.List) - { - if (player.IsHuman) - { - player.AddItem(ItemType.Flashlight); - } - } - - yield return 0; - } - - public void SubscribeEvent() - { - Exiled.Events.Handlers.Map.GeneratorActivating += GenActivate; - } - - public void UnsubscribeEvent() - { - Exiled.Events.Handlers.Map.GeneratorActivating -= GenActivate; - } - - public void GenActivate(GeneratorActivatingEventArgs ev) - { - if (Generator.List.Where(g => g.IsEngaged).Count() == 3) - { - Map.TurnOnAllLights(zones); - } - } - - } -} \ No newline at end of file diff --git a/KruacentExiled/KE.GlobalEventFramework.Examples/GE/CassieGoCrazy.cs b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/CassieGoCrazy.cs new file mode 100644 index 00000000..486b21a8 --- /dev/null +++ b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/CassieGoCrazy.cs @@ -0,0 +1,97 @@ +using Exiled.API.Extensions; +using Exiled.API.Features; +using Exiled.API.Features.Items; +using Exiled.Events.EventArgs.Player; +using KE.GlobalEventFramework.Examples.API.Feature.CassieGoCrazy; +using KE.GlobalEventFramework.GEFE.API.Enums; +using KE.GlobalEventFramework.GEFE.API.Features; +using KE.GlobalEventFramework.GEFE.API.Features.Hints; +using KE.GlobalEventFramework.GEFE.API.Interfaces; +using KE.Utils.API.Displays.DisplayMeow; +using KE.Utils.API.Interfaces; +using MEC; +using System.Collections.Generic; +using System.Linq; + +namespace KE.GlobalEventFramework.Examples.GE +{ + /// + /// Spawn fused grenades in random rooms in the map + /// + /*public class CassieGoCrazy : GlobalEvent, IStart + { + /// + public override uint Id { get; set; } = 1049; + /// + public override string Name { get; set; } = "Cassie Go Crazy"; + /// + public override string Description => "Crazy Cassie !"; + /// + public override int WeightedChance { get; set; } = 1; + + /// + /// The cooldown between 2 cassie event + /// + public int Cooldown { get; set; } = 380; + + + + public override ImpactLevel ImpactLevel => ImpactLevel.Low; + + private List Effects; + + protected override void SubscribeEvents() + { + Effects = new() + { + new AntagonisticCassie(), + new ChangeColor(), + new NoLight(), + new SadCassie(), + new WarheadEffect() + }; + + foreach (ICGCEffect effect in Effects) + { + if (effect is IUsingEvents @event) + { + @event.SubscribeEvents(); + } + } + + } + + + protected override void UnsubscribeEvents() + { + foreach (ICGCEffect effect in Effects) + { + if (effect is IUsingEvents @event) + { + @event.UnsubscribeEvents(); + } + } + } + + + + /// + /// Starts a coroutine to perform random actions during the game. + /// + /// A coroutine that runs until the game round ends. + /// + public IEnumerator Start() + { + while (!Round.IsEnded) + { + Log.Debug("waiting"); + yield return Timing.WaitForSeconds(Cooldown); + + Effects.GetRandomValue().Effect(); + + + } + } + + }*/ +} diff --git a/KruacentExiled/KE.GlobalEventFramework.Examples/GE/ChangedItemEffect.cs b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/ChangedItemEffect.cs index 5511cd3f..52c8af45 100644 --- a/KruacentExiled/KE.GlobalEventFramework.Examples/GE/ChangedItemEffect.cs +++ b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/ChangedItemEffect.cs @@ -1,8 +1,13 @@ using Exiled.API.Extensions; using Exiled.API.Features; using Exiled.API.Features.Items; +using Exiled.CustomItems.API.Features; using Exiled.Events.EventArgs.Player; +using Exiled.Events.EventArgs.Scp330; +using InventorySystem.Items.Usables.Scp330; +using KE.GlobalEventFramework.GEFE.API.Enums; using KE.GlobalEventFramework.GEFE.API.Features; +using KE.GlobalEventFramework.GEFE.API.Features.Hints; using KE.GlobalEventFramework.GEFE.API.Interfaces; using System; using System.Collections.Generic; @@ -17,68 +22,160 @@ public class ChangedItemEffect : GlobalEvent,IStart ,IEvent /// public override string Name { get; set; } = "SwitchItemEffect"; /// - public override string Description { get; set; } = "Les effets des items ont changé"; + public override string Description { get; } = "Les effets des items ont changé"; + public override string[] AltDescription => + [ + "Roulette russe" + ]; /// - public override int WeightedChance { get; set; } = 1; + public override int WeightedChance { get; set; } = 0; public Dictionary newEffects; - private List _usableList = new(); + public Dictionary newCandyEffects; - private int _switchNumber =0; - public int SwitchNumber { get { return _switchNumber; } } + + + public override ImpactLevel ImpactLevel => ImpactLevel.High; public IEnumerator Start() { - Log.Info("before foreach"); + + + + ChangeItemsEffect(); + ChangeCandyEffect(); + + yield return 0; + } + + private void ChangeItemsEffect() + { + + List usableList = new(); + foreach (var item in (ItemType[])Enum.GetValues(typeof(ItemType))) { - if (IsUsable(item)) + if (IsUsable(item) && item != ItemType.SCP330) { - Log.Info("adding : " + item); - _usableList.Add(item); + Log.Debug("adding : " + item); + usableList.Add(item); } - } - Log.Info("after foreach"); - _usableList = _usableList.Distinct().ToList(); - _switchNumber = UnityEngine.Random.Range(1,_usableList.Count); + } newEffects = new Dictionary(); - - for(int i =0;i < _usableList.Count; i++) + + int switchNumber = UnityEngine.Random.Range(1, usableList.Count); + + for (int i = 0; i < usableList.Count; i++) { - newEffects.Add(_usableList[i], _usableList[(i+SwitchNumber)%_usableList.Count]); + newEffects.Add(usableList[i], usableList[(i + switchNumber) % usableList.Count]); } - yield return 0; } + + private void ChangeCandyEffect() + { + List candys = new(); + foreach (var item in (CandyKindID[])Enum.GetValues(typeof(CandyKindID))) + { + if (item != CandyKindID.None) + { + Log.Debug("adding : " + item); + candys.Add(item); + } + } + + newCandyEffects = new(); + + int switchNumber = UnityEngine.Random.Range(1, candys.Count); + + for (int i = 0; i < candys.Count; i++) + { + + CandyKindID old = candys[i]; + CandyKindID newCandy = candys[(i + switchNumber) % candys.Count]; + + Log.Debug($"old = {old} ; new = {newCandy}"); + + newCandyEffects.Add(old, newCandy); + } + } + + + + + public void SubscribeEvent() { Exiled.Events.Handlers.Player.UsingItemCompleted += OnUsingItemCompleted; + Exiled.Events.Handlers.Scp330.EatingScp330 += OnEatingScp330; } public void UnsubscribeEvent() { Exiled.Events.Handlers.Player.UsingItemCompleted -= OnUsingItemCompleted; + Exiled.Events.Handlers.Scp330.EatingScp330 -= OnEatingScp330; } public static bool IsUsable(ItemType type) { - if (type.IsMedical() || type.IsThrowable() || type.IsScp()) return true; - return false; + try + { + if (type.IsMedical() || type.IsThrowable() || type.IsScp()) return true; + return false; + } + catch (Exception) + { + return false; + } + + } + + private void OnEatingScp330(EatingScp330EventArgs ev) + { + if (!newCandyEffects.TryGetValue(ev.Candy.Kind, out CandyKindID newCandy)) + { + Log.Debug("not found"); + return; + } + + + ev.IsAllowed = false; + + ev.Scp330.RemoveCandy(ev.Candy.Kind); + Log.Debug($"old candy = {ev.Candy.Kind}"); + Log.Debug($"new candy = {newCandy}"); + + + + Scp330.AvailableCandies[newCandy].ServerApplyEffects(ev.Player.ReferenceHub); } private void OnUsingItemCompleted(UsingItemCompletedEventArgs ev) { + if (CustomItem.TryGet(ev.Item, out var _)) return; + + if (!newEffects.ContainsKey(ev.Item.Type)) return; + + if(!newEffects.TryGetValue(ev.Usable.Type,out ItemType newUsable)) + { + Log.Debug("not found"); + return; + } + + + Log.Debug($"item used : {ev.Usable.Type}, item effect : {newUsable}"); ev.IsAllowed = false; - ItemType newUsable = newEffects[ev.Usable.Type]; - Log.Debug($"item used : {ev.Usable}, item effect : {newUsable}"); Usable use = Usable.Create(newUsable, ev.Player) as Usable; if (use is null) { Log.Error("Usable null stopping"); + return; } + + ev.Item.Destroy(); use.Use(ev.Player); } } diff --git a/KruacentExiled/KE.GlobalEventFramework.Examples/GE/Impostor.cs b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/Impostor.cs index cdeb5df0..565fc230 100644 --- a/KruacentExiled/KE.GlobalEventFramework.Examples/GE/Impostor.cs +++ b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/Impostor.cs @@ -1,11 +1,13 @@ using Player = Exiled.API.Features.Player; using System.Collections.Generic; -using KE.GlobalEventFramework.GEFE.API.Features; using KE.GlobalEventFramework.GEFE.API.Interfaces; using MEC; using System.Linq; using Exiled.API.Extensions; using Exiled.API.Features; +using KE.GlobalEventFramework.GEFE.API.Features; +using KE.GlobalEventFramework.GEFE.API.Features.Hints; +using KE.GlobalEventFramework.GEFE.API.Enums; namespace KE.GlobalEventFramework.Examples.GE { @@ -13,9 +15,15 @@ public class Impostor : GlobalEvent, IStart { public override uint Id { get; set; } = 1044; public override string Name { get; set; } = "Impostor"; - public override string Description { get; set; } = "Ne vous fiez pas aux apparences !"; + public override string Description { get; } = "Ne vous fiez pas aux apparences !"; + public override string[] AltDescription => + [ + "sussy" + ]; public override int WeightedChance { get; set; } = 1; + public override ImpactLevel ImpactLevel => ImpactLevel.High; + public IEnumerator Start() { while (!Round.IsEnded) diff --git a/KruacentExiled/KE.GlobalEventFramework.Examples/GE/ItemRain.cs b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/ItemRain.cs index f455b0d0..16a7304c 100644 --- a/KruacentExiled/KE.GlobalEventFramework.Examples/GE/ItemRain.cs +++ b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/ItemRain.cs @@ -18,7 +18,7 @@ public class ItemRain : GlobalEvent, IStart /// public override string Name { get; set; } = "ItemRain"; /// - public override string Description { get; set; } = "Il pleut des items !!"; + public override string Description { get; } = "Il pleut des items !!"; /// public override int WeightedChance => 1; diff --git a/KruacentExiled/KE.GlobalEventFramework.Examples/GE/KIWIS.cs b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/KIWIS.cs index 3e44738a..7d07249f 100644 --- a/KruacentExiled/KE.GlobalEventFramework.Examples/GE/KIWIS.cs +++ b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/KIWIS.cs @@ -4,9 +4,10 @@ using Utils.NonAllocLINQ; using System.Collections.Generic; using System.Linq; -using KE.GlobalEventFramework.GEFE.API.Features; using KE.GlobalEventFramework.GEFE.API.Interfaces; - +using KE.GlobalEventFramework.GEFE.API.Features; +using KE.GlobalEventFramework.GEFE.API.Features.Hints; +using KE.GlobalEventFramework.GEFE.API.Enums; namespace KE.GlobalEventFramework.Examples.GE { @@ -20,7 +21,8 @@ public class KIWIS : GlobalEvent,IStart /// public override string Name { get; set; } = "KIWIS"; /// - public override string Description { get; set; } = "Kill It While It's Small"; + public override string Description { get; } = "Kill It While It's Small"; + public override ImpactLevel ImpactLevel => ImpactLevel.Medium; /// public override int WeightedChance { get; set; } = 1; /// diff --git a/KruacentExiled/KE.GlobalEventFramework.Examples/GE/Kaboom.cs b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/Kaboom.cs index 2cf2f3e1..33588068 100644 --- a/KruacentExiled/KE.GlobalEventFramework.Examples/GE/Kaboom.cs +++ b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/Kaboom.cs @@ -2,8 +2,11 @@ using Exiled.API.Features.Items; using Exiled.API.Features; using Exiled.Events.EventArgs.Player; -using KE.GlobalEventFramework.GEFE.API.Features; using KE.GlobalEventFramework.GEFE.API.Interfaces; +using KE.GlobalEventFramework.GEFE.API.Features; +using KE.GlobalEventFramework.GEFE.API.Features.Hints; +using KE.GlobalEventFramework.GEFE.API.Enums; +using Exiled.API.Features.Doors; namespace KE.GlobalEventFramework.Examples.GE { public class Kaboom : GlobalEvent, IEvent @@ -13,10 +16,16 @@ public class Kaboom : GlobalEvent, IEvent /// public override string Name { get; set; } = "Kaboom"; /// - public override string Description { get; set; } = "Les portes sont piegés attention!"; + public override string Description { get; } = "Les portes sont piegés attention!"; + + public override string[] AltDescription => + [ + "La guerrilla est présente" + ]; /// public override int WeightedChance { get; set; } = 1; + public override ImpactLevel ImpactLevel => ImpactLevel.Medium; public const float BaseChanceElevator = .05f; private float _chanceElevator; @@ -76,16 +85,18 @@ public void UnsubscribeEvent() private void OnInteractingDoor(InteractingDoorEventArgs ev) { float random = UnityEngine.Random.value; - bool spawnGrenade = - (ev.Door.IsElevator && random < .05f) || - (ev.Door.IsGate && random < .5f) || - (ev.Door.IsDamageable && random <.1f); + Door door = ev.Door; - Log.Debug($"i love debugging random value : {random} ; Kaboom? {spawnGrenade}"); - if (spawnGrenade) + Log.Debug($"i love debugging random value : {random}"); + if ((door.IsElevator && random < .05f) || + (door.IsGate && random < .5f) || + (door.IsDamageable && random < .1f)) { - - ((ExplosiveGrenade)Item.Create(ItemType.GrenadeHE)).SpawnActive(ev.Door.Position); + ExplosiveGrenade grenade = ((ExplosiveGrenade)Item.Create(ItemType.GrenadeHE)); + grenade.ScpDamageMultiplier = 0.5f; + + + grenade.SpawnActive(ev.Player.Position); } } } diff --git a/KruacentExiled/KE.GlobalEventFramework.Examples/GE/Librarby.cs b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/Librarby.cs index e7f0a87b..cfc06b92 100644 --- a/KruacentExiled/KE.GlobalEventFramework.Examples/GE/Librarby.cs +++ b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/Librarby.cs @@ -23,7 +23,7 @@ public class Librarby : GlobalEvent, IEvent /// public override string Name { get; set; } = "Librarby"; /// - public override string Description { get; set; } = "Ne parlez pas trop fort sinon vous subirez les conséquences !"; + public override string Description { get; } = "Ne parlez pas trop fort sinon vous subirez les conséquences !"; /// public override int WeightedChance => 1; private float MaxVolume = 0.7f; diff --git a/KruacentExiled/KE.GlobalEventFramework.Examples/GE/OpenBar.cs b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/OpenBar.cs index fb7c1c38..30c9934e 100644 --- a/KruacentExiled/KE.GlobalEventFramework.Examples/GE/OpenBar.cs +++ b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/OpenBar.cs @@ -1,5 +1,4 @@ using Exiled.API.Features.Doors; -using KE.GlobalEventFramework.GEFE.API.Features; using System; using System.Collections.Generic; using System.Linq; @@ -9,51 +8,93 @@ using Exiled.API.Features; using Exiled.Events.EventArgs.Map; using KE.GlobalEventFramework.GEFE.API.Interfaces; - +using KE.GlobalEventFramework.GEFE.API.Features; +using KE.GlobalEventFramework.GEFE.API.Features.Hints; +using KE.Map.Others.BlackoutNDoor.Events.EventArgs; +using Exiled.API.Interfaces; namespace KE.GlobalEventFramework.Examples.GE { - public class OpenBar : GlobalEvent, IStart,IEvent + public class OpenBar : GlobalEvent, IStart, IEvent { public override uint Id { get; set; } = 1048; public override string Name { get; set; } = "OpenBar"; - public override string Description { get; set; } = "j'espère que vous avez pas prévu de kampé"; - public override int WeightedChance { get; set; } = 0; - //use event to avoid doorstuck + public override string Description { get; } = "j'espère que vous avez pas prévu de kampé"; + public override int WeightedChance { get; set; } = 1; public override uint[] IncompatibleEvents { get; set; } = { 1 }; + + public int NbAdditionalDoor = 3; + + public static readonly HashSet DoorsToUnlock = new() + { + DoorType.GateA, DoorType.GateB, + }; + + public static readonly HashSet DoorsToMaybeUnlock = new() + { + DoorType.HczArmory, DoorType.HIDChamber,DoorType.Intercom,DoorType.Scp049Armory,DoorType.Scp096,DoorType.Scp106Primary,DoorType.Scp106Secondary,DoorType.Scp330,DoorType.Scp914Gate + }; + + private IEnumerable doorsLocked; + public IEnumerator Start() { - var doors = Door.List.Where(d => new[] { DoorType.GateA, DoorType.GateB, DoorType.HczArmory, DoorType.HIDChamber,DoorType.Intercom,DoorType.Scp049Armory,DoorType.Scp096,DoorType.Scp106Primary,DoorType.Scp106Secondary,DoorType.Scp330,DoorType.Scp330Chamber,DoorType.Scp914Gate }.Contains(d.Type)).ToList(); - UnlockAndOpen(doors); + List door = DoorsToMaybeUnlock.ToList(); + List result = new(); + + for (int i = 0; i < NbAdditionalDoor; i++) + { + result.Add(door.PullRandomItem()); + } + result.AddRange(DoorsToUnlock); + + doorsLocked = Door.List.Where(d => result.Contains(d.Type)); + + UnlockAndOpen(doorsLocked); + yield return 0; } - private void UnlockAndOpen(List doors) + private void UnlockAndOpen(IEnumerable doors) { - doors.ForEach(d => + + foreach(Door door in doors) { - d.IsOpen = true; - d.ChangeLock(DoorLockType.Isolation); - }); + if(door is CheckpointDoor && door is IDamageableDoor damage) + { + damage.Break(Interactables.Interobjects.DoorUtils.DoorDamageType.ServerCommand); + } + else + { + UnlockAndOpen(door); + } + } + } + + + private void UnlockAndOpen(Door door) + { + door.IsOpen = true; + door.ChangeLock(DoorLockType.NoPower); } public void SubscribeEvent() { - Exiled.Events.Handlers.Map.GeneratorActivating += GenActivate; + Map.Others.BlackoutNDoor.Events.Handlers.DoorStuckHandler.DoorStucking += OnDoorStucking; } public void UnsubscribeEvent() { - Exiled.Events.Handlers.Map.GeneratorActivating -= GenActivate; + Map.Others.BlackoutNDoor.Events.Handlers.DoorStuckHandler.DoorStucking -= OnDoorStucking; } - public void GenActivate(GeneratorActivatingEventArgs ev) + + private void OnDoorStucking(DoorStuckEventArgs ev) { - if (Generator.List.Where(g => g.IsEngaged).Count() == 3) - { - UnlockAndOpen(Door.List.Where(d => new[] { DoorType.Scp079First, DoorType.Scp079Second }.Contains(d.Type)).ToList()); - } - } + int result = ev.Doors.RemoveWhere(door => doorsLocked.Contains(door)); + + Log.Info(result); + } } } diff --git a/KruacentExiled/KE.GlobalEventFramework.Examples/GE/R.cs b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/R.cs index f27da85f..53cbb66e 100644 --- a/KruacentExiled/KE.GlobalEventFramework.Examples/GE/R.cs +++ b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/R.cs @@ -1,6 +1,6 @@ -using KE.GlobalEventFramework.GEFE.API.Features; -using System.Collections.Generic; - +using KE.GlobalEventFramework.GEFE.API.Enums; +using KE.GlobalEventFramework.GEFE.API.Features; +using KE.GlobalEventFramework.GEFE.API.Features.Hints; namespace KE.GlobalEventFramework.Examples.GE { /// @@ -13,10 +13,11 @@ public class R : GlobalEvent /// public override string Name { get; set; } = "nothing"; /// - public override string Description { get; set; } = "y'a r"; + public override string Description { get; } = "y'a r"; /// public override int WeightedChance => 3; - /// + public override ImpactLevel ImpactLevel => ImpactLevel.VeryLow; + } } diff --git a/KruacentExiled/KE.GlobalEventFramework.Examples/GE/RandomSpawn.cs b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/RandomSpawn.cs index 4ee4860b..09874c79 100644 --- a/KruacentExiled/KE.GlobalEventFramework.Examples/GE/RandomSpawn.cs +++ b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/RandomSpawn.cs @@ -1,8 +1,11 @@ using Exiled.API.Enums; using Exiled.API.Extensions; using Exiled.API.Features; +using KE.GlobalEventFramework.GEFE.API.Enums; using KE.GlobalEventFramework.GEFE.API.Features; +using KE.GlobalEventFramework.GEFE.API.Features.Hints; using KE.GlobalEventFramework.GEFE.API.Interfaces; +using KE.Utils.Extensions; using PlayerRoles; using System; using System.Collections.Generic; @@ -23,10 +26,11 @@ public class RandomSpawn : GlobalEvent,IStart /// public override string Name { get; set; } = "RandomSpawn"; /// - public override string Description { get; set; } = "Les spawns sont random"; + public override string Description { get; } = "Les spawns sont random"; /// public override int WeightedChance { get; set; } = 1; - public IEnumerable BlacklistedRooms { get; } = new HashSet() { RoomType.EzShelter,RoomType.HczTestRoom,RoomType.EzCollapsedTunnel}; + public override ImpactLevel ImpactLevel => ImpactLevel.High; + public IEnumerable BlacklistedRooms { get; } = []; /// public IEnumerator Start() { @@ -39,7 +43,7 @@ public IEnumerator Start() if (p.Role == r) { - p.Teleport(room); + p.Teleport(room.GetValidPosition()); } } diff --git a/KruacentExiled/KE.GlobalEventFramework.Examples/GE/Rollback.cs b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/Rollback.cs new file mode 100644 index 00000000..7c376eae --- /dev/null +++ b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/Rollback.cs @@ -0,0 +1,75 @@ +using System.Collections.Generic; +using Exiled.API.Enums; +using Exiled.API.Features; +using Exiled.API.Interfaces; +using KE.GlobalEventFramework.GEFE.API.Enums; +using KE.GlobalEventFramework.GEFE.API.Features; +using KE.GlobalEventFramework.GEFE.API.Features.Hints; +using KE.GlobalEventFramework.GEFE.API.Interfaces; +using KE.Utils.Extensions; +using MapGeneration; +using MEC; +using PlayerRoles.FirstPersonControl; +using UnityEngine; + + +namespace KE.GlobalEventFramework.Examples.GE +{ + public class RollBack: GlobalEvent,IStart + { + /// + public override uint Id { get; set; } = 10800; + /// + public override string Name { get; set; } = "RollBack"; + /// + public override string Description { get; } = "Shit the server is lagging"; + public override string[] AltDescription => + [ + "Pov Omer" + ]; + /// + public override int WeightedChance { get; set; } = 1; + + public static readonly float RefreshRate = 30; + public static float Luck = 5; + public override ImpactLevel ImpactLevel => ImpactLevel.High; + + private Dictionary playerpos = new(); + + /// + public IEnumerator Start() + { + bool luck; + while (true) + { + yield return Timing.WaitForSeconds(RefreshRate); + luck = Luck > Random.Range(0f,100f); + foreach(Player p in Player.List) + { + + if (luck) + { + p.Teleport(playerpos[p].Item1); + p.Rotation = playerpos[p].Item2; + } + + if (p.IsAlive && Lift.Get(p.Position) is null && p.Zone.IsSafe()) + { + playerpos[p] = (p.Position, p.Rotation); + } + + + + + } + + } + + + } + + + + + } +} diff --git a/KruacentExiled/KE.GlobalEventFramework.Examples/GE/Shuffle.cs b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/Shuffle.cs index 4a46b4e4..d29075b0 100644 --- a/KruacentExiled/KE.GlobalEventFramework.Examples/GE/Shuffle.cs +++ b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/Shuffle.cs @@ -1,13 +1,14 @@ using Exiled.API.Features; using MEC; -using KE.GlobalEventFramework.GEFE.API.Features; using PlayerHandler = Exiled.Events.Handlers.Player; using Exiled.Events.EventArgs.Player; using UnityEngine; using System.Collections.Generic; using System.Linq; using KE.GlobalEventFramework.GEFE.API.Interfaces; - +using KE.GlobalEventFramework.GEFE.API.Features; +using KE.GlobalEventFramework.GEFE.API.Features.Hints; +using KE.GlobalEventFramework.GEFE.API.Enums; namespace KE.GlobalEventFramework.Examples.GE { @@ -21,9 +22,10 @@ public class Shuffle : GlobalEvent, IStart,IEvent /// public override string Name { get; set; } = "Shuffle"; /// - public override string Description { get; set; } = "et ça fait roomba café dans le scp"; + public override string Description { get; } = "et ça fait roomba café dans le scp"; /// public override int WeightedChance { get; set; } = 0; + public override ImpactLevel ImpactLevel => ImpactLevel.VeryHigh; private List players; private List pos; /// diff --git a/KruacentExiled/KE.GlobalEventFramework.Examples/GE/Speed.cs b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/Speed.cs index bb0ea6fc..dfc1bf05 100644 --- a/KruacentExiled/KE.GlobalEventFramework.Examples/GE/Speed.cs +++ b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/Speed.cs @@ -1,9 +1,14 @@ using CustomPlayerEffects; using Exiled.API.Enums; using Exiled.API.Features; +using Exiled.API.Features.Items; using Exiled.Events.EventArgs.Player; +using Exiled.Events.EventArgs.Scp096; using Exiled.Events.EventArgs.Scp173; +using Exiled.Events.EventArgs.Scp939; +using KE.GlobalEventFramework.GEFE.API.Enums; using KE.GlobalEventFramework.GEFE.API.Features; +using KE.GlobalEventFramework.GEFE.API.Features.Hints; using KE.GlobalEventFramework.GEFE.API.Interfaces; using MEC; using System; @@ -21,23 +26,34 @@ namespace KE.GlobalEventFramework.Examples.GE /// public class Speed : GlobalEvent,IStart,IEvent { + public override ImpactLevel ImpactLevel => ImpactLevel.VeryHigh; + /// public override uint Id { get; set; } = 1042; /// public override string Name { get; set; } = "Speed"; /// - public override string Description { get; set; } = "Gas! gas! gas!"; + public override string Description { get; } = "Gas! gas! gas!"; + + public override string[] AltDescription => new string[] + { + "Super instinct!", + "Mayhem mode activated", + }; /// public override int WeightedChance { get; set; } = 1; /// /// intensity of the movement boost effect /// - public byte MovementBoost { get; set; } = 100; + public static byte MovementBoost { get; set; } = 100; /// public IEnumerator Start() { yield return Timing.WaitForSeconds(1); - Player.List.ToList().ForEach(p => p.EnableEffect(MovementBoost,999999999, true)); + foreach (Player player in Player.Enumerable) + { + GiveEffect(player); + } } /// @@ -45,29 +61,92 @@ public void SubscribeEvent() { PlayerHandler.ChangingRole += ReactivateEffectSpawn; Exiled.Events.Handlers.Scp173.Blinking += SpeedyNut; + Exiled.Events.Handlers.Scp939.Lunging += OnLunging; + Exiled.Events.Handlers.Scp096.Charging += OnCharging; + Exiled.Events.Handlers.Scp939.Clawed += OnClawed; } /// public void UnsubscribeEvent() { PlayerHandler.ChangingRole -= ReactivateEffectSpawn; Exiled.Events.Handlers.Scp173.Blinking -= SpeedyNut; - Player.List.ToList().ForEach(p => p.DisableEffect()); + Exiled.Events.Handlers.Scp939.Lunging -= OnLunging; + Exiled.Events.Handlers.Scp096.Charging -= OnCharging; + Exiled.Events.Handlers.Scp939.Clawed -= OnClawed; + + foreach (Player player in Player.Enumerable) + { + player.DisableEffect(); + } } /// /// Decrease the blink cooldown of SCP-173 /// - private void SpeedyNut(BlinkingEventArgs ev) + public static void SpeedyNut(BlinkingEventArgs ev) { - ev.BlinkCooldown = ev.BlinkCooldown/4; + ev.BlinkCooldown = ev.BlinkCooldown/3; } /// /// Reactivate the effect at each role changement /// - private void ReactivateEffectSpawn(ChangingRoleEventArgs ev) + public static void ReactivateEffectSpawn(ChangingRoleEventArgs ev) + { + + GiveEffect(ev.Player); + } + + public static void GiveEffect(Player player) + { + Timing.CallDelayed(.1f, () => player.EnableEffect(MovementBoost, 999999999, true)); + } + + public static void OnClawed(ClawedEventArgs ev) + { + if(ev.Player.TryGetEffect(out _)) + { + ev.Player.DisableEffect(); + } + } + + + public static void OnLunging(LungingEventArgs ev) + { + Timing.CallDelayed(.70f, delegate + { + ExplosiveGrenade grenade = (ExplosiveGrenade)Item.Create(ItemType.GrenadeHE); + grenade.ScpDamageMultiplier = 0; + grenade.FuseTime = .1f; + grenade.SpawnActive(ev.Player.Position, ev.Player); + }); + + ev.Player.EnableEffect(10); + } + + + public static void OnCharging(ChargingEventArgs ev) { - Timing.CallDelayed(.1f, () => ev.Player.EnableEffect(MovementBoost, 999999999, true)); + if (!ev.IsAllowed) return; + + Timing.RunCoroutine(SpawnGrenade(ev.Player)); } + + + private static IEnumerator SpawnGrenade(Player player) + { + int i = 0; + int target = 5; + + while (i < target) + { + ExplosiveGrenade grenade = (ExplosiveGrenade)Item.Create(ItemType.GrenadeHE); + grenade.ScpDamageMultiplier = 0; + grenade.FuseTime = .1f; + grenade.SpawnActive(player.Position, player); + yield return Timing.WaitForSeconds(.25f); + i++; + } + } } } diff --git a/KruacentExiled/KE.GlobalEventFramework.Examples/GE/SwapProtocol.cs b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/SwapProtocol.cs index 984c4df7..f74d89f9 100644 --- a/KruacentExiled/KE.GlobalEventFramework.Examples/GE/SwapProtocol.cs +++ b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/SwapProtocol.cs @@ -6,6 +6,8 @@ using InventorySystem.Items.Usables; using KE.GlobalEventFramework.GEFE.API.Features; using KE.GlobalEventFramework.GEFE.API.Interfaces; +using KE.Misc.Events.EventsArgs; +using KE.Utils.Extensions; using MEC; using PlayerRoles; using System.Collections.Generic; @@ -15,13 +17,15 @@ namespace KE.GlobalEventFramework.Examples.GE { - public class SwapProtocol : GlobalEvent, IStart + public class SwapProtocol : GlobalEvent, IStart, IEvent { public override uint Id { get; set; } = 1051; public override string Name { get; set; } = "SwapProtocol"; - public override string Description { get; set; } = "EEEEEEEET c'est parti la roulette tourne"; - public override int WeightedChance { get; set; } = 1; - public const string IsSwappingKey = "KE.GlobalEvents.SwapProtocol.IsSwapping"; + public override string Description { get; } = "EEEEEEEET c'est parti la roulette tourne"; + public override int WeightedChance { get; set; } = 0; + + private int numberSwap = 0; + public int NumberOfSwap => numberSwap; /// /// Cooldown between each change in seconds @@ -33,6 +37,7 @@ public IEnumerator Start() while (!Round.IsEnded) { yield return Timing.WaitForSeconds(Cooldown); + numberSwap++; SwapAllPlayers(); } } @@ -63,6 +68,7 @@ private void SwapAllPlayers() ExecuteSwap(target, dataToApply); } + } /// @@ -75,6 +81,24 @@ private void ExecuteSwap(Player target, PlayerData data) data.ApplyTo(target); } + public void SubscribeEvent() + { + Misc.Features.SCPBuff.OnBuffingSCP += OnBuffingSCP; + } + + public void UnsubscribeEvent() + { + Misc.Features.SCPBuff.OnBuffingSCP -= OnBuffingSCP; + } + + private void OnBuffingSCP(BuffingSCPEventArgs ev) + { + if(NumberOfSwap > 0) + { + ev.IsAllowed = false; + } + } + private sealed class PlayerData { public string Nickname { get; } @@ -110,31 +134,38 @@ public void ApplyTo(Player target) { target.ClearInventory(); - target.SessionVariables[IsSwappingKey] = true; - target.Role.Set(Role, RoleSpawnFlags.None); - Timing.CallDelayed(.1f, () => + + if (target.PreviousRole == RoleTypeId.Spectator) { - // Add Safe TP here !! - if (target.PreviousRole == RoleTypeId.Spectator) target.Position = Room.Random(ZoneType.HeavyContainment).Position + Vector3.up; - - target.MaxHealth = MaxHealth; - target.Health = Health; - target.Scale = PlayerScale; - if (IsCuffed && !target.IsCuffed) target.Handcuff(); else target.RemoveHandcuffs(); - - foreach (ItemState state in SavedItems) + Vector3 randomRoom; + if (!Warhead.IsDetonated) + { + randomRoom = Room.Random(ZoneType.HeavyContainment).GetValidPosition(); + } + else { - Item newItem = target.AddItem(state.Type); - state.ApplyState(newItem); + randomRoom = Room.List.First(r => r.Type == RoomType.Surface).GetValidPosition(); } + target.Position = randomRoom; + } + + target.MaxHealth = MaxHealth; + target.Health = Health; + target.Scale = PlayerScale; + if (IsCuffed && !target.IsCuffed) target.Handcuff(); else target.RemoveHandcuffs(); + + foreach (ItemState state in SavedItems) + { + Item newItem = target.AddItem(state.Type); + state.ApplyState(newItem); + } - foreach (var ammo in Ammo) target.SetAmmo(ammo.Key, ammo.Value); + foreach (var ammo in Ammo) target.SetAmmo(ammo.Key, ammo.Value); - target.DisableAllEffects(); - foreach (EffectState state in SavedEffects) target.EnableEffect(state.Type, state.Intensity, state.Duration); - }); + target.DisableAllEffects(); + foreach (EffectState state in SavedEffects) target.EnableEffect(state.Type, state.Intensity, state.Duration); } } diff --git a/KruacentExiled/KE.GlobalEventFramework.Examples/GE/SystemMalfunction.cs b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/SystemMalfunction.cs index 4d740313..f8aa76d2 100644 --- a/KruacentExiled/KE.GlobalEventFramework.Examples/GE/SystemMalfunction.cs +++ b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/SystemMalfunction.cs @@ -1,7 +1,5 @@ using Exiled.API.Features; using Exiled.API.Features.Doors; -using KE.GlobalEventFramework.GEFE.API.Features; -using KE.GlobalEventFramework.GEFE.API.Utils; using MEC; using System.Collections.Generic; using System.Linq; @@ -9,15 +7,9 @@ using Exiled.API.Enums; using Exiled.API.Extensions; using KE.GlobalEventFramework.GEFE.API.Interfaces; -using System; -using Exiled.Events.EventArgs.Player; -using System.Security.Policy; -using PlayerRoles; -using Utils.NonAllocLINQ; -using KeycardPermissions = Exiled.API.Enums.KeycardPermissions; -using Exiled.Events.EventArgs.Scp049; -using KE.GlobalEventFramework.Examples.API.Feature; - +using KE.GlobalEventFramework.Examples.API.Feature.mf; +using KE.GlobalEventFramework.GEFE.API.Features; +using KE.GlobalEventFramework.GEFE.API.Enums; namespace KE.GlobalEventFramework.Examples.GE { /// @@ -31,12 +23,19 @@ namespace KE.GlobalEventFramework.Examples.GE /// public class SystemMalfunction : GlobalEvent, IStart, IEvent { + + + public override ImpactLevel ImpactLevel => ImpactLevel.VeryLow; /// public override uint Id { get; set; } = 1041; /// public override string Name { get; set; } = "System Malfunction"; /// - public override string Description { get; set; } = "On dirait que les systèmes informatiques sont défaillants"; + public override string Description { get; } = "System Malfunction"; + public override string[] AltDescription => new string[] + { + "La facilité marche pas trop là" + }; /// public override int WeightedChance { get; set; } = 1; /// @@ -56,14 +55,14 @@ public IEnumerator Start() //MoreBlackOutNDoors(); //Coroutine.LaunchCoroutine(EarlyNuke()); - Coroutine.LaunchCoroutine(Malfunction.Tick()); + Timing.RunCoroutine(Malfunction.Tick()); CoroutineHandle handle; while(Round.InProgress){ Log.Debug("system malfunction"); yield return Timing.WaitForSeconds(UnityEngine.Random.Range(200, 300)); List> l = new []{CheckpointMalfunction(),GateLockdown(),ElevatorLockdown()}.ToList(); - handle = Coroutine.LaunchCoroutine(l[UnityEngine.Random.Range(0,3)]); + handle = Timing.RunCoroutine(l[UnityEngine.Random.Range(0,3)]); yield return Timing.WaitUntilDone(handle); } yield return 0; diff --git a/KruacentExiled/KE.GlobalEventFramework.Examples/KE.GlobalEventFramework.Examples.csproj b/KruacentExiled/KE.GlobalEventFramework.Examples/KE.GlobalEventFramework.Examples.csproj index 0aa7fff3..5d27ec6d 100644 --- a/KruacentExiled/KE.GlobalEventFramework.Examples/KE.GlobalEventFramework.Examples.csproj +++ b/KruacentExiled/KE.GlobalEventFramework.Examples/KE.GlobalEventFramework.Examples.csproj @@ -6,19 +6,25 @@ - + - - + + + + + + + + diff --git a/KruacentExiled/KE.GlobalEventFramework.Examples/MainPlugin.cs b/KruacentExiled/KE.GlobalEventFramework.Examples/MainPlugin.cs index 38773e5b..8af34292 100644 --- a/KruacentExiled/KE.GlobalEventFramework.Examples/MainPlugin.cs +++ b/KruacentExiled/KE.GlobalEventFramework.Examples/MainPlugin.cs @@ -1,9 +1,13 @@ using System; using System.Collections.Generic; using System.Linq; -using System.Text; -using System.Threading.Tasks; +using System.Runtime.InteropServices; +using Exiled.API.Enums; using Exiled.API.Features; +using HarmonyLib; +using MEC; +using UnityEngine; + namespace KE.GlobalEventFramework.Examples { @@ -13,15 +17,53 @@ internal class MainPlugin : Plugin public override Version Version => new Version(1, 0, 0); public override string Name => "KE.GEF.Examples"; + public override string Prefix => "KE.GEFE"; public static MainPlugin Instance { get; private set; } + + private static Harmony Harmony; + public override PluginPriority Priority => PluginPriority.Lower; + + + + public override void OnEnabled() { Instance = this; + Utils.API.Sounds.SoundPlayer.Load(); + Exiled.Events.Handlers.Server.WaitingForPlayers += OnWaitingPlayer; + + + + + //Kannassie.LoadVoiceLine(); + Log.Debug("patching"); + Harmony = new(Name); + //Harmony.PatchAll(); + } + + private void OnWaitingPlayer() + { + + } + + + private IEnumerator Showpos() + { + while (true) + { + Log.Debug(Player.List.First()?.Position); + yield return Timing.WaitForSeconds(2); + } + } public override void OnDisabled() { + Exiled.Events.Handlers.Server.WaitingForPlayers -= OnWaitingPlayer; + Instance = null; + Harmony?.UnpatchAll(); + Harmony = null; } } } diff --git a/KruacentExiled/KE.Items/Interface/IUse.cs b/KruacentExiled/KE.GlobalEventFramework.Examples/MiddleEvents/Disco.cs similarity index 56% rename from KruacentExiled/KE.Items/Interface/IUse.cs rename to KruacentExiled/KE.GlobalEventFramework.Examples/MiddleEvents/Disco.cs index 51ea4f27..f0637afa 100644 --- a/KruacentExiled/KE.Items/Interface/IUse.cs +++ b/KruacentExiled/KE.GlobalEventFramework.Examples/MiddleEvents/Disco.cs @@ -4,11 +4,11 @@ using System.Text; using System.Threading.Tasks; -namespace KE.Items.Interface +namespace KE.GlobalEventFramework.Examples.MiddleEvents { - public interface IUse + internal class Disco { - string HowToUseItemDesc { get; set; } + //lumière random } } diff --git a/KruacentExiled/KE.GlobalEventFramework.Examples/MiddleEvents/ShuffleInv.cs b/KruacentExiled/KE.GlobalEventFramework.Examples/MiddleEvents/ShuffleInv.cs new file mode 100644 index 00000000..1c96ccf1 --- /dev/null +++ b/KruacentExiled/KE.GlobalEventFramework.Examples/MiddleEvents/ShuffleInv.cs @@ -0,0 +1,36 @@ +using Exiled.API.Features; +using KE.GlobalEventFramework.GEFE.API.Features; +using MEC; +using PlayerRoles; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace KE.GlobalEventFramework.Examples.MiddleEvents +{ + /*public class ShuffleInv : MiddleEvent + { + //shuffle d'inventaire une fois quand il est activé + /// + public override uint Id { get; set; } = 10045; + /// + public override string Name { get; set; } = "MShuffleI"; + /// + public override string Description { get; set; } = "Aller on change de stuff"; + /// + public override int WeightedChance { get; set; } = 0; + + public IEnumerator Start() + { + Player.List.ToList(); + + + + yield return Timing.WaitForOneFrame; + } + + + }*/ +} diff --git a/KruacentExiled/KE.GlobalEventFramework.Examples/MiddleEvents/ShufflePosition.cs b/KruacentExiled/KE.GlobalEventFramework.Examples/MiddleEvents/ShufflePosition.cs new file mode 100644 index 00000000..ed51919a --- /dev/null +++ b/KruacentExiled/KE.GlobalEventFramework.Examples/MiddleEvents/ShufflePosition.cs @@ -0,0 +1,46 @@ +using Exiled.API.Features; +using KE.GlobalEventFramework.GEFE.API.Features; +using MEC; +using PlayerRoles; +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using UnityEngine; + +namespace KE.GlobalEventFramework.Examples.MiddleEvents +{ + public class ShufflePosition : MiddleEvent + { + //shuffle de position une fois quand il est activé + /// + public override uint Id { get; set; } = 10045; + /// + public override string Name { get; set; } = "MShuffleP"; + /// + public override string Description { get; set; } = "Aller on change de place"; + /// + public override int WeightedChance { get; set; } = 1; + + public IEnumerator Start() + { + + List position = Player.Enumerable.Select(p => p.Position).ToList(); + + Vector3 tmp = position[0]; + for(int i = 0; i < position.Count-1; i++) + { + position[i] = position[i + 1]; + } + + position[position.Count - 1] = tmp; + + + yield return Timing.WaitForOneFrame; + } + + + } +} diff --git a/KruacentExiled/KE.GlobalEventFramework.Examples/MiddleEvents/ShuffleRole.cs b/KruacentExiled/KE.GlobalEventFramework.Examples/MiddleEvents/ShuffleRole.cs new file mode 100644 index 00000000..72e2710f --- /dev/null +++ b/KruacentExiled/KE.GlobalEventFramework.Examples/MiddleEvents/ShuffleRole.cs @@ -0,0 +1,36 @@ +using Exiled.API.Features; +using KE.GlobalEventFramework.GEFE.API.Features; +using MEC; +using PlayerRoles; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace KE.GlobalEventFramework.Examples.MiddleEvents +{ + /*public class ShuffleRole : MiddleEvent + { + //shuffle de role une fois quand il est activé + /// + public override uint Id { get; set; } = 10045; + /// + public override string Name { get; set; } = "MShuffle"; + /// + public override string Description { get; set; } = "Aller on change de role"; + /// + public override int WeightedChance { get; set; } = 0; + + public IEnumerator Start() + { + Player.List.ToList(); + + + + yield return Timing.WaitForOneFrame; + } + + + }*/ +} diff --git a/KruacentExiled/KE.GlobalEventFramework.Examples/MiddleEvents/Speed.cs b/KruacentExiled/KE.GlobalEventFramework.Examples/MiddleEvents/Speed.cs index 5b4e5c36..a627282e 100644 --- a/KruacentExiled/KE.GlobalEventFramework.Examples/MiddleEvents/Speed.cs +++ b/KruacentExiled/KE.GlobalEventFramework.Examples/MiddleEvents/Speed.cs @@ -14,7 +14,7 @@ namespace KE.GlobalEventFramework.Examples.MiddleEvents { - public class SpeedM : MiddleEvent, IStart, IReversible + public class SpeedM : MiddleEvent, IStart, IEvent { /// public override uint Id { get; set; } = 10042; @@ -23,7 +23,8 @@ public class SpeedM : MiddleEvent, IStart, IReversible /// public override string Description { get; set; } = "Gas! gas! gas!"; /// - public override int WeightedChance { get; set; } = 0; + public override int WeightedChance { get; set; } = 1; + public override uint[] IncompatibleEvents => [1042]; /// /// intensity of the movement boost effect /// @@ -37,17 +38,22 @@ public IEnumerator Start() } /// - protected override void SubscribeEvent() + public void SubscribeEvent() { Exiled.Events.Handlers.Player.ChangingRole += ReactivateEffectSpawn; Exiled.Events.Handlers.Scp173.Blinking += SpeedyNut; } /// - protected override void UnsubscribeEvent() + public void UnsubscribeEvent() { Exiled.Events.Handlers.Player.ChangingRole -= ReactivateEffectSpawn; Exiled.Events.Handlers.Scp173.Blinking -= SpeedyNut; - + } + + protected override void Disable(KEEvents ev) + { + OnDisable(); + base.Disable(ev); } public void OnDisable() diff --git a/KruacentExiled/KE.GlobalEventFramework.Examples/MiddleEvents/WallHack.cs b/KruacentExiled/KE.GlobalEventFramework.Examples/MiddleEvents/WallHack.cs index e3192cfb..e218aa70 100644 --- a/KruacentExiled/KE.GlobalEventFramework.Examples/MiddleEvents/WallHack.cs +++ b/KruacentExiled/KE.GlobalEventFramework.Examples/MiddleEvents/WallHack.cs @@ -13,7 +13,7 @@ namespace KE.GlobalEventFramework.Examples.MiddleEvents { - public class WallHackM : MiddleEvent, IStart, IReversible + public class WallHackM : MiddleEvent, IStart, IEvent { /// public override uint Id { get; set; } = 10052; @@ -32,17 +32,23 @@ public IEnumerator Start() } /// - protected override void SubscribeEvent() + public void SubscribeEvent() { + Log.Debug("subscribe events wh"); Exiled.Events.Handlers.Player.ChangingRole += ReactivateEffectSpawn; } /// - protected override void UnsubscribeEvent() + public void UnsubscribeEvent() { Exiled.Events.Handlers.Player.ChangingRole -= ReactivateEffectSpawn; } + protected override void Disable(KEEvents ev) + { + OnDisable(); + } + public void OnDisable() { Player.List.ToList().ForEach(p => p.DisableEffect()); diff --git a/KruacentExiled/KE.GlobalEventFramework/Config.cs b/KruacentExiled/KE.GlobalEventFramework/Config.cs index 698a7952..2ebe7260 100644 --- a/KruacentExiled/KE.GlobalEventFramework/Config.cs +++ b/KruacentExiled/KE.GlobalEventFramework/Config.cs @@ -13,11 +13,13 @@ internal class Config : IConfig { public bool IsEnabled { get; set; } = true; - public bool Debug { get; set; } = true; + public bool Debug { get; set; } = false; [Description("Show the log when the plugin is registering global event (require Debug to be true)")] public bool ShowRegisteringLog { get; set; } = false; [Description("The chance a global event is not shown and show [REDACTED] instead (0~100)")] public int ChanceRedacted { get; set; } = 10; + [Description("Activate or not the multiple descriptions")] + public bool ActivateAltDescription { get; set; } = true; } } diff --git a/KruacentExiled/KE.Utils/Quality/Enums/ModelQuality.cs b/KruacentExiled/KE.GlobalEventFramework/GEFE/API/Enums/ImpactLevel.cs similarity index 58% rename from KruacentExiled/KE.Utils/Quality/Enums/ModelQuality.cs rename to KruacentExiled/KE.GlobalEventFramework/GEFE/API/Enums/ImpactLevel.cs index d9d8d295..bfc4f652 100644 --- a/KruacentExiled/KE.Utils/Quality/Enums/ModelQuality.cs +++ b/KruacentExiled/KE.GlobalEventFramework/GEFE/API/Enums/ImpactLevel.cs @@ -4,13 +4,15 @@ using System.Text; using System.Threading.Tasks; -namespace KE.Utils.Quality.Enums +namespace KE.GlobalEventFramework.GEFE.API.Enums { - public enum ModelQuality + public enum ImpactLevel { - None = -1, + VeryLow, Low, Medium, High, + VeryHigh, + Insane } } diff --git a/KruacentExiled/KE.GlobalEventFramework/GEFE/API/Extensions/ImpactLevelExtension.cs b/KruacentExiled/KE.GlobalEventFramework/GEFE/API/Extensions/ImpactLevelExtension.cs new file mode 100644 index 00000000..1013d6c5 --- /dev/null +++ b/KruacentExiled/KE.GlobalEventFramework/GEFE/API/Extensions/ImpactLevelExtension.cs @@ -0,0 +1,28 @@ +using KE.GlobalEventFramework.GEFE.API.Enums; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace KE.GlobalEventFramework.GEFE.API.Extensions +{ + public static class ImpactLevelExtension + { + + public static string Shorten(this ImpactLevel impact) + { + return impact switch + { + ImpactLevel.VeryLow => "VL", + ImpactLevel.Low => "L", + ImpactLevel.Medium => "M", + ImpactLevel.High => "H", + ImpactLevel.VeryHigh => "VH", + ImpactLevel.Insane => "I", + _ => "" + }; + } + + } +} diff --git a/KruacentExiled/KE.GlobalEventFramework/GEFE/API/Features/GlobalEvent.cs b/KruacentExiled/KE.GlobalEventFramework/GEFE/API/Features/GlobalEvent.cs index d65e7151..d34be3af 100644 --- a/KruacentExiled/KE.GlobalEventFramework/GEFE/API/Features/GlobalEvent.cs +++ b/KruacentExiled/KE.GlobalEventFramework/GEFE/API/Features/GlobalEvent.cs @@ -1,13 +1,18 @@ -using Exiled.API.Features; -using System.Collections.Generic; -using System.Linq; -using MEC; +using CommandSystem.Commands.RemoteAdmin.Broadcasts; +using Exiled.API.Extensions; +using Exiled.API.Features; +using Exiled.API.Features.Pools; +using Exiled.Events.EventArgs.Server; +using HintServiceMeow.Core.Models.Hints; +using KE.GlobalEventFramework.GEFE.API.Enums; +using KE.GlobalEventFramework.GEFE.API.Extensions; using KE.GlobalEventFramework.GEFE.API.Interfaces; -using System; using KE.Utils.API.Displays.DisplayMeow; -using Exiled.Events.EventArgs.Server; using KE.Utils.API.Interfaces; +using System.Collections.Generic; +using System.Linq; using System.Text; +using UnityEngine; namespace KE.GlobalEventFramework.GEFE.API.Features { @@ -22,11 +27,8 @@ public void SubscribeEvents() { if (_eventsub) return; - Log.Debug("registering GlobalEvent"); Exiled.Events.Handlers.Server.RoundStarted += OnRoundStarted; - Exiled.Events.Handlers.Server.WaitingForPlayers += OnWaitingForPlayers; Exiled.Events.Handlers.Server.RoundEnded += OnEndingRound; - Exiled.Events.Handlers.Server.RestartingRound += OnRestartingRound; _eventsub = true; } @@ -36,38 +38,53 @@ public void UnsubscribeEvents() if (!_eventsub) return; Exiled.Events.Handlers.Server.RoundStarted -= OnRoundStarted; - Exiled.Events.Handlers.Server.WaitingForPlayers -= OnWaitingForPlayers; Exiled.Events.Handlers.Server.RoundEnded -= OnEndingRound; - Exiled.Events.Handlers.Server.RestartingRound -= OnRestartingRound; _eventsub = false; } - private void OnWaitingForPlayers() - { - StopCoroutines(); - } + private void OnEndingRound(RoundEndedEventArgs _) { - Log.Debug("ending round"); - DeactivateAll(); - } - private void OnRestartingRound() - { - Log.Debug("restarting"); - DeactivateAll(); + Log.Warn("ending round"); + DisableEvents(_activeGE); } private void OnRoundStarted() { - SetActiveGlobalEvent(); + if(ForcedGE.Count == 0) + { + Activate(); + } + else + { + _activeGE = ForcedGE.ToHashSet(); + ForcedGE.Clear(); + EnableEvents(_activeGE); + + Show(); + } } } + + private static Config Config => MainPlugin.Instance.Config; private static GlobalEventHandler _handler = new(); private static HashSet _activeGE = new(); - public static float ChanceRedacted = 25; + + public static IReadOnlyDictionary ImpactToColor = new Dictionary() + { + { ImpactLevel.VeryLow, "#d8d8ff" }, + { ImpactLevel.Low, "#d8e8f0" }, + { ImpactLevel.Medium, "#d8fcde" }, + { ImpactLevel.High, "#fbfbd8" }, + { ImpactLevel.VeryHigh, "#f0e8d8" }, + { ImpactLevel.Insane, "#ffd8d8" }, + }; + + + public static HashSet ForcedGE { get; } = new(); /// @@ -75,150 +92,190 @@ private void OnRoundStarted() /// public static IEnumerable GlobalEventsList => List.Where(ev => ev is GlobalEvent).Cast(); /// - public abstract string Description { get; set; } - + public abstract string Description { get; } + public virtual string[] AltDescription { get; } = null; + public virtual ImpactLevel ImpactLevel { get; } = ImpactLevel.Medium; public bool IsActive { - get - { - return _activeGE.Contains(this); + get + { + return _activeGE.Contains(this); } } + public static int NumberOfGE { get; set; } = -1; + + protected override void SubscribeEvents() { _handler.SubscribeEvents(); + base.SubscribeEvents(); } protected override void UnsubscribeEvents() { _handler.UnsubscribeEvents(); + + base.UnsubscribeEvents(); } - private static void DeactivateAll() + protected override void Disable(KEEvents ev) { - foreach (GlobalEvent ge in _activeGE) - { - if (ge is IEvent geEvent) - { - geEvent.UnsubscribeEvent(); - } - _activeEvents.Remove(ge); - } - _activeGE.Clear(); + _activeGE.Remove(ev as GlobalEvent); + base.Disable(ev); } - - - - private static void SetActiveGlobalEvent() - { - int nbGE = UnityEngine.Random.value < .1f ? 2 : 1; - _activeGE = GetRandomEvent(nbGE).ToHashSet(); - ActivateAll(_activeGE); - } - - - private static void ActivateAll(IEnumerable globalEvent) + private static void Activate() { - if (globalEvent.Count() != globalEvent.Distinct().Count()) throw new ArgumentException("You can't have the same GE twice in the same round"); - - foreach (GlobalEvent ge in _activeGE) + if(NumberOfGE == -1) { - if (ge is IEvent geEvent) - { - Log.Debug($"{ge.Name} implements IEvent, subscribing events"); - geEvent.SubscribeEvent(); - } - - if (ge is IStart geStart) - { - Log.Debug($"{ge.Name} implements IStart, starting"); - CoroutineHandle a = Timing.RunCoroutine(geStart.Start()); - ge.coroutineHandles.Add(a); - } - _activeEvents.Add(ge); + NumberOfGE = Random.value < .1f ? 2 : 1; } - - Show(); - } - /// - /// Stop all Coroutine from GE - /// - private static void StopCoroutines() - { - foreach(GlobalEvent ge in GlobalEventsList) - { - foreach(CoroutineHandle handle in ge.coroutineHandles) - { - Timing.KillCoroutines(handle); - } - } + _activeGE = GetRandomEvent(NumberOfGE).ToHashSet(); + + EnableEvents(_activeGE); + Show(); } - - private static void Show() { - var random = UnityEngine.Random.Range(0f,100f); - Log.Debug("random="+random); + + ShowConsole(); + + + string text = ShowText(); + foreach (Player player in Player.List) { - DisplayHandler.Instance.AddHint(MainPlugin.GEAnnouncement, player, ShowText(random < ChanceRedacted), 10).FontSize = 30; + AbstractHint hint = DisplayHandler.Instance.AddHint(MainPlugin.GEAnnouncement, player, text, 10); + + hint.FontSize = 30; + } } private static void ShowConsole() { Log.Info($"Global Event(s) ({_activeGE.Count()}): "); - - foreach(GlobalEvent ge in _activeGE) + foreach (GlobalEvent ge in _activeGE) { Log.Info(ge.Name); } } - private static string ShowText(bool redacted = false) + private List AllDesc { - StringBuilder builder = new(); + get + { + List allDesc = + [ + Description, + .. AltDescription + ]; + return allDesc; + } + } + + + /// + /// + /// + /// 0 mean the default desc + /// + /// + private static string ShowText() + { + StringBuilder builder = StringBuilderPool.Pool.Get(); builder.Append("Global Events: "); - List ge = _activeGE.ToList(); + List ge; + ge = _activeGE.ToList(); + + + + + for (int i = 0; i < ge.Count(); i++) { - if (redacted) + GlobalEvent globalEvent = ge[i]; + + + + + builder.Append(""); + + builder.Append("["); + builder.Append(globalEvent.ImpactLevel.Shorten()); + builder.Append("]"); + + + + if (globalEvent.IsRedacted()) { builder.Append("[REDACTED]"); } else { - - builder.Append(ge[i].Description); + if (!Config.ActivateAltDescription || globalEvent.AltDescription == null) + { + builder.Append(globalEvent.Description); + } + else + { + builder.Append(globalEvent.AllDesc.GetRandomValue()); + } } + builder.AppendLine(""); if (ge.Count() > 1 && i < ge.Count() - 1) { builder.Append(", "); } + + + } + + return StringBuilderPool.Pool.ToStringReturn(builder); + } + + + private bool IsRedacted() + { + if(this is INonRedactable redactable) + { + return false; } + float chanceRedacted; - return builder.ToString(); - } + if(this is IChanceRedactable force) + { + chanceRedacted = force.ChanceRedacted; + } + else + { + chanceRedacted = Config.ChanceRedacted; + } + chanceRedacted = Mathf.Clamp(chanceRedacted, 0, 100); - } + return UnityEngine.Random.Range(0f, 100f) < chanceRedacted; + } + + } } diff --git a/KruacentExiled/KE.GlobalEventFramework/GEFE/API/Features/KEEvents.cs b/KruacentExiled/KE.GlobalEventFramework/GEFE/API/Features/KEEvents.cs index b0f7e2b1..19f63d69 100644 --- a/KruacentExiled/KE.GlobalEventFramework/GEFE/API/Features/KEEvents.cs +++ b/KruacentExiled/KE.GlobalEventFramework/GEFE/API/Features/KEEvents.cs @@ -1,7 +1,11 @@ using Exiled.API.Features; using Exiled.API.Interfaces; using Exiled.CustomItems.API.Features; +using Exiled.Events.EventArgs.Server; +using Exiled.Events.Features; using KE.GlobalEventFramework.GEFE.API.Interfaces; +using KE.GlobalEventFramework.GEFE.Events.EventArgs; +using KE.GlobalEventFramework.GEFE.Events.Handlers; using KE.GlobalEventFramework.GEFE.Exceptions; using KE.Utils.API; using KE.Utils.API.Interfaces; @@ -23,8 +27,8 @@ public abstract class KEEvents public abstract string Name { get; set; } public virtual int WeightedChance { get; set; } = 1; public virtual uint[] IncompatibleEvents { get; set; } = new uint[0]; - protected HashSet coroutineHandles { get; } = new(); - protected static HashSet _activeEvents = new(); + protected HashSet CoroutineHandles { get; } = new(); + protected static readonly HashSet s_activeEvents = new(); #endregion @@ -34,6 +38,12 @@ public abstract class KEEvents public static HashSet List => [.._idLookup.Values]; #endregion + #region Events + + //public static Event Enabling = new(); + //public static Event Enabled = new(); + //public static Event Disabled = new(); + #endregion #region Register @@ -42,7 +52,11 @@ public static IEnumerable RegisterAll() List assemblies = new(); foreach(var plugin in Exiled.Loader.Loader.Plugins) { - assemblies.Add(plugin.Assembly); + if (!assemblies.Contains(plugin.Assembly) && plugin.Config.IsEnabled) + { + assemblies.Add(plugin.Assembly); + } + } @@ -52,8 +66,6 @@ public static IEnumerable RegisterAll() try { ev.Register(); - - } catch (FailedRegisterException e) { @@ -67,10 +79,9 @@ public static IEnumerable RegisterAll() } public virtual void Register() { - if (_idLookup.ContainsKey(Id)) { - throw new FailedRegisterException("already registered"); + throw new FailedRegisterException($"id already used by {Get(Id).Name} "); } LogRegister(); Init(); @@ -88,12 +99,17 @@ public virtual void Destroy() { _idLookup.Remove(Id); _nameLookup.Remove(Name); + foreach(CoroutineHandle handle in CoroutineHandles) + { + Timing.KillCoroutines(handle); + } UnsubscribeEvents(); } public static void DestroyAll() { + foreach (KEEvents ev in List) { ev.Destroy(); @@ -119,7 +135,6 @@ public static void OnDisabled() protected virtual void SubscribeEvents() { - } @@ -130,6 +145,56 @@ protected virtual void UnsubscribeEvents() + protected static void EnableEvents(IEnumerable events) + { + foreach (KEEvents ev in events) + { + Log.Info("enabling " + ev.Name); + EnablingEventArgs args = new(ev, true); + KEEventsHandler.OnEnabling(args); + + if (!args.IsAllowed) continue; + + if (ev is IEvent @event) + { + @event.SubscribeEvent(); + } + + + if (ev is IStart start) + ev.CoroutineHandles.Add(Timing.RunCoroutine(start.Start())); + + s_activeEvents.Add(ev); + + KEEventsHandler.OnEnabled(new(ev)); + } + } + + + protected static void DisableEvents(IEnumerable events) + { + foreach (KEEvents ev in events.ToList()) + { + Log.Info("disabling " + ev.Name); + if (ev is IEvent @event) + { + @event.UnsubscribeEvent(); + } + foreach (CoroutineHandle handle in ev.CoroutineHandles) + { + Timing.KillCoroutines(handle); + } + ev.Disable(ev); + KEEventsHandler.OnDisabled(new(ev)); + } + } + + protected virtual void Disable(KEEvents ev) + { + + } + + protected static IEnumerable GetRandomEvent(int numberEvent = 1) where T : KEEvents { List result = new(); @@ -179,7 +244,7 @@ public static bool TryGet(string name, out KEEvents globalEvent) { if (string.IsNullOrEmpty(name)) { - throw new System.Exception("name can't be null or empty"); + throw new ArgumentException("name can't be null or empty"); } globalEvent = uint.TryParse(name, out uint id) ? Get(id) : Get(name); @@ -188,7 +253,7 @@ public static bool TryGet(string name, out KEEvents globalEvent) public static KEEvents Get(string name) { - return List.FirstOrDefault(ge => ge.Name == name); + return _nameLookup[name]; } public static KEEvents Get(uint id) @@ -196,9 +261,21 @@ public static KEEvents Get(uint id) return _idLookup.TryGetValue(id, out KEEvents globalEvent) ? globalEvent : null; } + + public static T Get(uint id) where T : KEEvents + { + return _idLookup.TryGetValue(id, out KEEvents globalEvent) && globalEvent is T ? globalEvent as T : null; + } + + public static bool TryGet(uint id, out T events) where T : KEEvents + { + events = Get(id); + return events != null; + } + public bool IsCompatible() { - foreach(KEEvents ev in _activeEvents) + foreach(KEEvents ev in s_activeEvents) { foreach(int i in ev.IncompatibleEvents) { diff --git a/KruacentExiled/KE.GlobalEventFramework/GEFE/API/Features/MiddleEvent.cs b/KruacentExiled/KE.GlobalEventFramework/GEFE/API/Features/MiddleEvent.cs index f19d2bd2..71aed8d6 100644 --- a/KruacentExiled/KE.GlobalEventFramework/GEFE/API/Features/MiddleEvent.cs +++ b/KruacentExiled/KE.GlobalEventFramework/GEFE/API/Features/MiddleEvent.cs @@ -27,7 +27,6 @@ private class MiddleEventHandler public void SubscribeEvents() { if (_eventsub) return; - Log.Debug("registering middle event"); Exiled.Events.Handlers.Server.RoundStarted += OnRoundStarted; Exiled.Events.Handlers.Server.RoundEnded += OnEndingRound; Exiled.Events.Handlers.Server.RestartingRound += OnRestartingRound; @@ -50,21 +49,22 @@ public void UnsubscribeEvents() private void OnEndingRound(RoundEndedEventArgs _) { Log.Debug("ending round"); - Deactivate(); + DisableEvents(_activeEv); } private void OnRestartingRound() { Log.Debug("restarting"); - Deactivate(); + DisableEvents(_activeEv); } private void OnRoundStarted() { - Timing.RunCoroutine(Timer()); + TimeToActivate = new(0,UnityEngine.Random.Range(MinTimeToActivate.Minutes,MaxTimeToActivate.Minutes),0); + _handle = Timing.RunCoroutine(Timer()); } private IEnumerator Timer() { - if (UnityEngine.Random.Range(0f, 100f) < 37) + if (UnityEngine.Random.Range(0f, 100f) < Chance) { while (Round.InProgress) { @@ -81,38 +81,45 @@ private IEnumerator Timer() public abstract string Description { get; set; } public static float Chance = 37; - public static TimeSpan TimeToActivate = new(0, 15, 0); + public static TimeSpan MinTimeToActivate = new(0, 10, 0); + public static TimeSpan MaxTimeToActivate = new(0, 16, 0); + private static TimeSpan TimeToActivate; private static HashSet _activeEv = new(); private static MiddleEventHandler _handler = new(); + public static IReadOnlyCollection ActiveMiddleEvent => _activeEv; + public bool IsActive + { + get + { + return _activeEv.Contains(this); + } + } + + + /// + /// A list of all registered + /// + public static IEnumerable MiddleEventsList => List.Where(ev => ev is MiddleEvent).Cast(); protected sealed override void SubscribeEvents() { _handler.SubscribeEvents(); + base.SubscribeEvents(); } protected sealed override void UnsubscribeEvents() { _handler.UnsubscribeEvents(); - Deactivate(); - } - - protected virtual void SubscribeEvent() - { - - } - - protected virtual void UnsubscribeEvent() - { - + DisableEvents(_activeEv); + base.UnsubscribeEvents(); } - /// /// Get a random and activate it /// @@ -121,41 +128,16 @@ public static bool Activate() if (_activeEv.Count > 0) return false; _activeEv = GetRandomEvent().ToHashSet(); - foreach(MiddleEvent ev in _activeEv) - { - if (ev is IStart start) - ev.coroutineHandles.Add(Timing.RunCoroutine(start.Start())); - ev.SubscribeEvent(); - _activeEvents.Add(ev); - } + EnableEvents(_activeEv); Show(); return true; } - public static void Deactivate(MiddleEvent m) + protected override void Disable(KEEvents ev) { - if (!_activeEv.Contains(m)) throw new ArgumentException("middleevent cannot be deactivate : not activated"); - m.UnsubscribeEvent(); - if (m is IReversible r) - r.OnDisable(); - _activeEv.Remove(m); - _activeEvents.Remove(m); - } - - public static void Deactivate() - { - foreach (MiddleEvent ev in _activeEv) - { - ev.UnsubscribeEvent(); - foreach(CoroutineHandle handle in ev.coroutineHandles) - { - Timing.KillCoroutines(handle); - if (ev is IReversible revert) - revert.OnDisable(); - } - } - _activeEv.Clear(); + _activeEv.Remove(ev as MiddleEvent); + base.Disable(ev); } #region Show diff --git a/KruacentExiled/KE.GlobalEventFramework/GEFE/API/Interfaces/IChanceRedactable.cs b/KruacentExiled/KE.GlobalEventFramework/GEFE/API/Interfaces/IChanceRedactable.cs new file mode 100644 index 00000000..f9ddcf90 --- /dev/null +++ b/KruacentExiled/KE.GlobalEventFramework/GEFE/API/Interfaces/IChanceRedactable.cs @@ -0,0 +1,19 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace KE.GlobalEventFramework.GEFE.API.Interfaces +{ + public interface IChanceRedactable + { + + /// + /// 0-100 + /// + public abstract float ChanceRedacted { get; } + + + } +} diff --git a/KruacentExiled/KE.GlobalEventFramework/GEFE/API/Interfaces/IGlobalEvent.cs b/KruacentExiled/KE.GlobalEventFramework/GEFE/API/Interfaces/IGlobalEvent.cs deleted file mode 100644 index ca2868d1..00000000 --- a/KruacentExiled/KE.GlobalEventFramework/GEFE/API/Interfaces/IGlobalEvent.cs +++ /dev/null @@ -1,41 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using MEC; - -namespace KE.GlobalEventFramework.GEFE.API.Interfaces -{ - - [Obsolete("Use GlobalEvent instead",true)] - public interface IGlobalEvent - { - /// - /// the UNIQUE id of the Global Event - /// - uint Id { get; set; } - /// - /// Name used in the logs on the RA - /// - string Name { get; set; } - - /// - /// The description that will be shown to the player when the round start - /// - string Description { get; set; } - - /// - /// The chance this GE will be choosed at the start of a round - /// - int Weight { get; set; } - /// - /// The ids of incompatible Globals Events - /// Note: You can't have the same GE twice in the same round - /// - uint[] IncompatibleGE { get; set; } - - - - } -} diff --git a/KruacentExiled/KE.Utils/Extensions/RoomExtension.cs b/KruacentExiled/KE.GlobalEventFramework/GEFE/API/Interfaces/INonRedactable.cs similarity index 58% rename from KruacentExiled/KE.Utils/Extensions/RoomExtension.cs rename to KruacentExiled/KE.GlobalEventFramework/GEFE/API/Interfaces/INonRedactable.cs index 35fee2e8..16c66fa1 100644 --- a/KruacentExiled/KE.Utils/Extensions/RoomExtension.cs +++ b/KruacentExiled/KE.GlobalEventFramework/GEFE/API/Interfaces/INonRedactable.cs @@ -4,9 +4,11 @@ using System.Text; using System.Threading.Tasks; -namespace KE.Utils.Extensions +namespace KE.GlobalEventFramework.GEFE.API.Interfaces { - internal class RoomExtension + public interface INonRedactable { + + } } diff --git a/KruacentExiled/KE.GlobalEventFramework/GEFE/API/Utils/Coroutine.cs b/KruacentExiled/KE.GlobalEventFramework/GEFE/API/Utils/Coroutine.cs deleted file mode 100644 index 2cec07d0..00000000 --- a/KruacentExiled/KE.GlobalEventFramework/GEFE/API/Utils/Coroutine.cs +++ /dev/null @@ -1,19 +0,0 @@ -using MEC; -using System.Collections.Generic; - -namespace KE.GlobalEventFramework.GEFE.API.Utils -{ - public static class Coroutine - { - public static readonly List _coroutine = new List(); - - //CoroutineHandle coroutine - public static CoroutineHandle LaunchCoroutine(IEnumerator coroutine) - { - CoroutineHandle a = Timing.RunCoroutine(coroutine); - - _coroutine.Add(a); - return a; - } - } -} diff --git a/KruacentExiled/KE.GlobalEventFramework/GEFE/Commands/ForceGE.cs b/KruacentExiled/KE.GlobalEventFramework/GEFE/Commands/ForceGE.cs index e4babcee..10a47673 100644 --- a/KruacentExiled/KE.GlobalEventFramework/GEFE/Commands/ForceGE.cs +++ b/KruacentExiled/KE.GlobalEventFramework/GEFE/Commands/ForceGE.cs @@ -15,10 +15,38 @@ public class ForceGE : ICommand public string Command { get; } = "force"; public string[] Aliases { get; } = new string[] { "f" }; public string Description { get; } = "force a or multiple global event"; - internal static List ForcedGE = new(); + internal static List ForcedGE { get; } = new(); public bool Execute(ArraySegment arguments, ICommandSender sender, out string response) { + + + + if (!Round.IsLobby) + { + response = "You can only force a global event in the lobby"; + return false; + } + + if (!uint.TryParse(arguments.At(0),out uint arg1)) + { + response = "argument 1 invalid"; + return false; + } + + + if (!KEEvents.TryGet(arg1, out GlobalEvent ge1) || ge1 == null) + { + response = $"Global event ({arguments.At(0)}) not found "; + return false; + } + + if (arguments.Count == 1) + { + response = $"Forcing {ge1.Name}"; + return GlobalEvent.ForcedGE.Add(ge1); + } + response = "WIP"; return false; diff --git a/KruacentExiled/KE.GlobalEventFramework/GEFE/Commands/ForceMiddleEvent.cs b/KruacentExiled/KE.GlobalEventFramework/GEFE/Commands/ForceMiddleEvent.cs index b33b3905..80783e8e 100644 --- a/KruacentExiled/KE.GlobalEventFramework/GEFE/Commands/ForceMiddleEvent.cs +++ b/KruacentExiled/KE.GlobalEventFramework/GEFE/Commands/ForceMiddleEvent.cs @@ -12,7 +12,7 @@ public class ForceMiddleEvent : ICommand { public string Command { get; } = "forcemiddle"; public string[] Aliases { get; } = new string[] { "fm" }; - public string Description { get; } = "force middle event"; + public string Description { get; } = "force a random middle event"; public bool Execute(ArraySegment arguments, ICommandSender sender, out string response) { diff --git a/KruacentExiled/KE.GlobalEventFramework/GEFE/Commands/ForceNbGE.cs b/KruacentExiled/KE.GlobalEventFramework/GEFE/Commands/ForceNbGE.cs index db51ee0d..e9e027f5 100644 --- a/KruacentExiled/KE.GlobalEventFramework/GEFE/Commands/ForceNbGE.cs +++ b/KruacentExiled/KE.GlobalEventFramework/GEFE/Commands/ForceNbGE.cs @@ -9,20 +9,19 @@ using GEFE.API.Features; using System.Collections.Generic; using System.Linq; + using KE.GlobalEventFramework.GEFE.API.Features.Hints; public class ForceNbGE : ICommand { public string Command { get; } = "forceNb"; public string[] Aliases { get; } = new string[] { "nb","n" }; - public string Description { get; } = "force a specified number global event"; - internal static int NbGE = -1; + public string Description { get; } = "force a number global event"; public bool Execute(ArraySegment arguments, ICommandSender sender, out string response) { if (!Round.IsLobby) { response = "You can only force a global event in the lobby"; - NbGE = -1; return false; } @@ -35,25 +34,22 @@ public bool Execute(ArraySegment arguments, ICommandSender sender, out s if(nbge <= 0) { response = "You can't force 0 global event"; - NbGE = -1; return false; } if(nbge > GlobalEvent.GlobalEventsList.Count()) { response = $"You can't force {nbge} global event, there are only {GlobalEvent.GlobalEventsList.Count()} global events"; - NbGE = -1; return false; } response = $"Forcing {nbge} global event"; - NbGE = nbge; + GlobalEvent.NumberOfGE = nbge; return true; } } - NbGE = -1; - response = "Too much argument"; + response = "Too many arguments"; return false; } diff --git a/KruacentExiled/KE.GlobalEventFramework/GEFE/Commands/List.cs b/KruacentExiled/KE.GlobalEventFramework/GEFE/Commands/List.cs new file mode 100644 index 00000000..1db15b09 --- /dev/null +++ b/KruacentExiled/KE.GlobalEventFramework/GEFE/Commands/List.cs @@ -0,0 +1,95 @@ +namespace KE.GlobalEventFramework.GEFE.Commands +{ + using Exiled.API.Features; + using Exiled.API.Features.Pickups; + using System; + using CommandSystem; + using System.Runtime.InteropServices.WindowsRuntime; + using GEFE.API.Interfaces; + using GEFE.API.Features; + using KE.GlobalEventFramework.GEFE.API.Features.Hints; + using UnityEngine; + using System.Text; + using Exiled.API.Features.Pools; + using System.Linq; + using System.Collections.Generic; + using Exiled.Events; + + public class List : ICommand + { + public string Command { get; } = "list"; + public string[] Aliases { get; } = new string[] { "l", "ls" }; + public string Description { get; } = "get the list of all Global Events"; + + + public static string Activated => "[o]"; + public static string NotActivated => "[ ]"; + + public bool Execute(ArraySegment arguments, ICommandSender sender, out string response) + { + + StringBuilder builder = StringBuilderPool.Pool.Get(); + builder.AppendLine(); + + + + + List glist = GlobalEvent.GlobalEventsList.ToList(); + + builder.Append("Global Events ("); + builder.Append(glist.Count); + builder.Append(")"); + + + foreach(GlobalEvent ge in glist) + { + builder.AppendLine(); + if (ge.IsActive) + { + builder.Append(Activated); + } + else + { + builder.Append(NotActivated); + } + Show(builder, ge); + } + builder.AppendLine(); + List mlist = MiddleEvent.MiddleEventsList.ToList(); + builder.Append("Middle Event ("); + builder.Append(mlist.Count); + builder.Append(")"); + + foreach (MiddleEvent me in mlist) + { + builder.AppendLine(); + if (me.IsActive) + { + builder.Append(Activated); + } + else + { + builder.Append(NotActivated); + } + Show(builder, me); + } + + response = builder.ToString(); + StringBuilderPool.Pool.Return(builder); + return true; + } + + + + private void Show(StringBuilder builder, KEEvents events) + { + + builder.Append(" ("); + builder.Append(events.Id); + builder.Append(") "); + builder.Append(events.Name); + builder.Append(" - "); + builder.Append(events.WeightedChance); + } + } +} diff --git a/KruacentExiled/KE.GlobalEventFramework/GEFE/Commands/ListGE.cs b/KruacentExiled/KE.GlobalEventFramework/GEFE/Commands/ListGE.cs deleted file mode 100644 index 111a19cb..00000000 --- a/KruacentExiled/KE.GlobalEventFramework/GEFE/Commands/ListGE.cs +++ /dev/null @@ -1,37 +0,0 @@ -namespace KE.GlobalEventFramework.GEFE.Commands -{ - using Exiled.API.Features; - using Exiled.API.Features.Pickups; - using System; - using CommandSystem; - using System.Runtime.InteropServices.WindowsRuntime; - using GEFE.API.Interfaces; - using GEFE.API.Features; - - public class ListGE : ICommand - { - public string Command { get; } = "list"; - public string[] Aliases { get; } = new string[] { "l", "ls" }; - public string Description { get; } = "get the list of all Global Events"; - - public bool Execute(ArraySegment arguments, ICommandSender sender, out string response) - { - string result = "List of all global event ([o] if it's active in the round ; [ ] otherwise) : \n"; - foreach (GlobalEvent ge in GlobalEvent.GlobalEventsList) - { - - if (ge.IsActive) - { - result += "[o]"; - } - else - { - result += "[ ]"; - } - result += $" {ge.Id} : {ge.Name} : {ge.Description}\n"; - } - response = result; - return true; - } - } -} diff --git a/KruacentExiled/KE.GlobalEventFramework/GEFE/Commands/ParentCommandGEFE.cs b/KruacentExiled/KE.GlobalEventFramework/GEFE/Commands/ParentCommandGEFE.cs index 6d762ab4..03046509 100644 --- a/KruacentExiled/KE.GlobalEventFramework/GEFE/Commands/ParentCommandGEFE.cs +++ b/KruacentExiled/KE.GlobalEventFramework/GEFE/Commands/ParentCommandGEFE.cs @@ -2,7 +2,9 @@ namespace KE.GlobalEventFramework.GEFE.Commands { using CommandSystem; + using Exiled.API.Features.Pools; using System; + using System.Text; [CommandHandler(typeof(RemoteAdminCommandHandler))] public class ParentCommandGEFE : ParentCommand @@ -17,7 +19,7 @@ public ParentCommandGEFE() public override void LoadGeneratedCommands() { - RegisterCommand(new ListGE()); + RegisterCommand(new List()); RegisterCommand(new ForceGE()); RegisterCommand(new ForceNbGE()); RegisterCommand(new ForceMiddleEvent()); @@ -25,12 +27,40 @@ public override void LoadGeneratedCommands() protected override bool ExecuteParent(ArraySegment arguments, ICommandSender sender, out string response) { - if(arguments.Count == 0){ - response = "subcommand available : list, force, nb"; + + + if (arguments.Count > 0) + { + response = ""; return true; } - response = ""; - return true; + + StringBuilder builder = StringBuilderPool.Pool.Get(); + builder.AppendLine(); + foreach (ICommand command in AllCommands) + { + builder.Append(command.Command); + + builder.Append("("); + string[] alias = command.Aliases; + for (int i = 0; i < alias.Length; i++) + { + builder.Append(alias[i]); + if (alias.Length > 1 && i < alias.Length - 1) + { + builder.Append(", "); + } + } + builder.Append(") - "); + + builder.Append(command.Description); + builder.AppendLine(); + } + + + response = builder.ToString(); + StringBuilderPool.Pool.Return(builder); + return false; } diff --git a/KruacentExiled/KE.GlobalEventFramework/GEFE/Events/EventArgs/DisabledEventArgs.cs b/KruacentExiled/KE.GlobalEventFramework/GEFE/Events/EventArgs/DisabledEventArgs.cs new file mode 100644 index 00000000..b1acacc7 --- /dev/null +++ b/KruacentExiled/KE.GlobalEventFramework/GEFE/Events/EventArgs/DisabledEventArgs.cs @@ -0,0 +1,21 @@ +using Exiled.Events.EventArgs.Interfaces; +using KE.GlobalEventFramework.GEFE.API.Features; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace KE.GlobalEventFramework.GEFE.Events.EventArgs +{ + public class DisabledEventArgs : IExiledEvent + { + + public KEEvents Event { get; } + + public DisabledEventArgs(KEEvents ev) + { + Event = ev; + } + } +} diff --git a/KruacentExiled/KE.GlobalEventFramework/GEFE/Events/EventArgs/EnabledEventArgs.cs b/KruacentExiled/KE.GlobalEventFramework/GEFE/Events/EventArgs/EnabledEventArgs.cs new file mode 100644 index 00000000..b831f2ba --- /dev/null +++ b/KruacentExiled/KE.GlobalEventFramework/GEFE/Events/EventArgs/EnabledEventArgs.cs @@ -0,0 +1,21 @@ +using Exiled.Events.EventArgs.Interfaces; +using KE.GlobalEventFramework.GEFE.API.Features; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace KE.GlobalEventFramework.GEFE.Events.EventArgs +{ + public class EnabledEventArgs : IExiledEvent + { + + public KEEvents Event { get; } + + public EnabledEventArgs(KEEvents ev) + { + Event = ev; + } + } +} diff --git a/KruacentExiled/KE.GlobalEventFramework/GEFE/Events/EventArgs/EnablingEventArgs.cs b/KruacentExiled/KE.GlobalEventFramework/GEFE/Events/EventArgs/EnablingEventArgs.cs new file mode 100644 index 00000000..17cdbec3 --- /dev/null +++ b/KruacentExiled/KE.GlobalEventFramework/GEFE/Events/EventArgs/EnablingEventArgs.cs @@ -0,0 +1,23 @@ +using Exiled.Events.EventArgs.Interfaces; +using KE.GlobalEventFramework.GEFE.API.Features; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace KE.GlobalEventFramework.GEFE.Events.EventArgs +{ + public class EnablingEventArgs : IExiledEvent, IDeniableEvent + { + public bool IsAllowed { get; set; } + + public KEEvents Event { get; } + + public EnablingEventArgs(KEEvents ev,bool isallowed) + { + Event = ev; + IsAllowed = isallowed; + } + } +} diff --git a/KruacentExiled/KE.GlobalEventFramework/GEFE/Events/Handlers/KEEventsHandler.cs b/KruacentExiled/KE.GlobalEventFramework/GEFE/Events/Handlers/KEEventsHandler.cs new file mode 100644 index 00000000..7da48ae1 --- /dev/null +++ b/KruacentExiled/KE.GlobalEventFramework/GEFE/Events/Handlers/KEEventsHandler.cs @@ -0,0 +1,36 @@ +using KE.GlobalEventFramework.GEFE.Events.EventArgs; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace KE.GlobalEventFramework.GEFE.Events.Handlers +{ + public static class KEEventsHandler + { + + + + public static event Action Disabled = delegate { }; + public static event Action Enabled = delegate { }; + public static event Action Enabling = delegate { }; + + + public static void OnDisabled(DisabledEventArgs ev) + { + Disabled?.Invoke(ev); + } + public static void OnEnabled(EnabledEventArgs ev) + { + Enabled?.Invoke(ev); + } + public static void OnEnabling(EnablingEventArgs ev) + { + Enabling?.Invoke(ev); + } + + + + } +} diff --git a/KruacentExiled/KE.GlobalEventFramework/KE.GlobalEventFramework.csproj b/KruacentExiled/KE.GlobalEventFramework/KE.GlobalEventFramework.csproj index 83629701..242e7fbe 100644 --- a/KruacentExiled/KE.GlobalEventFramework/KE.GlobalEventFramework.csproj +++ b/KruacentExiled/KE.GlobalEventFramework/KE.GlobalEventFramework.csproj @@ -6,11 +6,7 @@ - - - - - + @@ -18,6 +14,7 @@ + diff --git a/KruacentExiled/KE.GlobalEventFramework/MainPlugin.cs b/KruacentExiled/KE.GlobalEventFramework/MainPlugin.cs index 8bebff72..e0bbf325 100644 --- a/KruacentExiled/KE.GlobalEventFramework/MainPlugin.cs +++ b/KruacentExiled/KE.GlobalEventFramework/MainPlugin.cs @@ -1,14 +1,7 @@ using Exiled.API.Features; using System; -using System.Collections.Generic; -using System.Linq; -using MEC; using Exiled.API.Enums; -using Player = Exiled.API.Features.Player; using KE.GlobalEventFramework.GEFE.API.Features; -using KE.GlobalEventFramework.GEFE.API.Interfaces; -using ServerHandler = Exiled.Events.Handlers.Server; -using Discord; using KE.Utils.API.Displays.DisplayMeow; namespace KE.GlobalEventFramework { @@ -16,6 +9,7 @@ internal class MainPlugin : Plugin { public override string Author => "Patrique"; public override string Name => "KE.GEFramework"; + public override string Prefix => "KE.GEF"; public override Version Version => new Version(2, 0, 0); public override PluginPriority Priority => PluginPriority.Highest; @@ -24,14 +18,17 @@ internal class MainPlugin : Plugin public static readonly HintPlacement GEAnnouncement = new(0, 50, HintServiceMeow.Core.Enum.HintAlignment.Center); public static readonly HintPlacement GEEffect = new(360, 300, HintServiceMeow.Core.Enum.HintAlignment.Right); + internal static MainPlugin Instance {get;private set;} + public override void OnEnabled() { Instance = this; - KEEvents.OnEnabled(); + + KEEvents.OnEnabled(); base.OnEnabled(); } diff --git a/KruacentExiled/KE.Items/Config.cs b/KruacentExiled/KE.Items/Config.cs deleted file mode 100644 index 81678c85..00000000 --- a/KruacentExiled/KE.Items/Config.cs +++ /dev/null @@ -1,18 +0,0 @@ -using Exiled.API.Interfaces; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace KE.Items -{ - public class Config : IConfig - { - public bool IsEnabled { get; set; } = true; - public bool Debug { get; set; } = true; - public float RefreshRate { get; set; } = .01f; - public string SoundLocation { get; set; } = "C:\\Users\\Patrique\\AppData\\Roaming\\EXILED\\Plugins\\audio"; - public int Position { get; set; } = 300; - } -} diff --git a/KruacentExiled/KE.Items/Interface/CustomItemEffect.cs b/KruacentExiled/KE.Items/Interface/CustomItemEffect.cs deleted file mode 100644 index f8e22c94..00000000 --- a/KruacentExiled/KE.Items/Interface/CustomItemEffect.cs +++ /dev/null @@ -1,23 +0,0 @@ -using Exiled.API.Features; -using Exiled.CustomItems.API.Features; -using Exiled.Events.EventArgs.Map; -using Exiled.Events.EventArgs.Player; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Net.Sockets; -using System.Text; -using System.Threading.Tasks; - -namespace KE.Items.Interface -{ - public abstract class CustomItemEffect - { - public abstract void Effect(UsedItemEventArgs ev); - - public abstract void Effect(ExplodingGrenadeEventArgs ev); - - public abstract void Effect(DroppingItemEventArgs ev); - - } -} diff --git a/KruacentExiled/KE.Items/Interface/ILumosItem.cs b/KruacentExiled/KE.Items/Interface/ILumosItem.cs deleted file mode 100644 index d2116101..00000000 --- a/KruacentExiled/KE.Items/Interface/ILumosItem.cs +++ /dev/null @@ -1,14 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace KE.Items.Interface -{ - internal interface ILumosItem - { - - UnityEngine.Color Color { get; set; } - } -} diff --git a/KruacentExiled/KE.Items/Interface/ISwichableEffect.cs b/KruacentExiled/KE.Items/Interface/ISwichableEffect.cs deleted file mode 100644 index f2717159..00000000 --- a/KruacentExiled/KE.Items/Interface/ISwichableEffect.cs +++ /dev/null @@ -1,13 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace KE.Items.Interface -{ - public interface ISwichableEffect - { - CustomItemEffect Effect { get; set; } - } -} diff --git a/KruacentExiled/KE.Items/Interface/IUpgradableCustomItem.cs b/KruacentExiled/KE.Items/Interface/IUpgradableCustomItem.cs deleted file mode 100644 index d2eec835..00000000 --- a/KruacentExiled/KE.Items/Interface/IUpgradableCustomItem.cs +++ /dev/null @@ -1,15 +0,0 @@ -using KE.Items.Upgrade; -using Scp914; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace KE.Items.Interface -{ - public interface IUpgradableCustomItem - { - IReadOnlyDictionary Upgrade { get; } - } -} diff --git a/KruacentExiled/KE.Items/ItemEffects/DeployableWallEffect.cs b/KruacentExiled/KE.Items/ItemEffects/DeployableWallEffect.cs deleted file mode 100644 index f85deaa6..00000000 --- a/KruacentExiled/KE.Items/ItemEffects/DeployableWallEffect.cs +++ /dev/null @@ -1,54 +0,0 @@ -using Exiled.API.Features.Toys; -using Exiled.Events.EventArgs.Map; -using Exiled.Events.EventArgs.Player; -using KE.Items.Interface; -using MEC; -using UnityEngine; - - -namespace KE.Items.ItemEffects -{ - public class DeployableWallEffect : CustomItemEffect - { - public override void Effect(UsedItemEventArgs ev) - { - SpawnWall(ev.Player.Position,ev.Player.Rotation); - } - public override void Effect(DroppingItemEventArgs ev) - { - SpawnWall(ev.Player.Position, ev.Player.Rotation); - } - - public override void Effect(ExplodingGrenadeEventArgs ev) - { - SpawnWall(ev.Position, ev.Projectile.Rotation); - } - - private void SpawnWall(Vector3 pos, Quaternion rotation) - { - float distance = 2; - Vector3 forward = rotation * Vector3.forward; - Vector3 spawnPos = pos + forward * distance; - Vector3 rotat = new Vector3(0, rotation.eulerAngles.y, 0); - - MainPlugin.Instance.Sound.PlayClip("build", spawnPos); - Primitive wall = Primitive.Create(PrimitiveType.Cube, spawnPos, rotat, new Vector3(4, 4, 0.2f), true); - wall.Collidable = true; - wall.Visible = true; - Timing.CallDelayed(10, () => { - wall.UnSpawn(); - wall.Destroy(); - }); - Timing.CallDelayed(5, () => - { - wall.Color = Color.yellow; - }); - Timing.CallDelayed(8, () => - { - wall.Color = Color.red; - }); - - - } - } -} diff --git a/KruacentExiled/KE.Items/ItemEffects/DivinePillsEffect.cs b/KruacentExiled/KE.Items/ItemEffects/DivinePillsEffect.cs deleted file mode 100644 index 42997842..00000000 --- a/KruacentExiled/KE.Items/ItemEffects/DivinePillsEffect.cs +++ /dev/null @@ -1,72 +0,0 @@ -using Exiled.API.Enums; -using Exiled.API.Extensions; -using Exiled.API.Features; -using Exiled.CustomItems.API.Features; -using Exiled.Events.EventArgs.Interfaces; -using Exiled.Events.EventArgs.Map; -using Exiled.Events.EventArgs.Player; -using KE.Items.Interface; -using PlayerRoles; -using System.Linq; -using Random = UnityEngine.Random; - -namespace KE.Items.ItemEffects -{ - public class DivinePillsEffect : CustomItemEffect - { - public override void Effect(UsedItemEventArgs ev) - { - EffectItem(ev.Player); - } - public override void Effect(DroppingItemEventArgs ev) - { - EffectItem(ev.Player,ev); - } - - public override void Effect(ExplodingGrenadeEventArgs ev) - { - foreach (Player p in ev.TargetsToAffect) - { - EffectItem(p); - } - } - - - - private void EffectItem(Player player,IDeniableEvent ev = null) - { - if (Player.List.Count(x => x.Role == RoleTypeId.Spectator) == 0) - { - player.ShowHint("No spectators to respawn"); - /* - could be used for a deniable event - if(ev != null) - ev.IsAllowed = false; - */ - return; - } - var random = Random.Range(0, 100); - if (random <= 25) - { - player.Kill("unlucky bro"); - return; - } - Player respawning = Player.List.GetRandomValue(x => x.Role == RoleTypeId.Spectator); - switch (player.Role.Side) - { - case Side.ChaosInsurgency: - respawning.Role.Set(RoleTypeId.ChaosRifleman); - break; - case Side.Mtf: - respawning.Role.Set(RoleTypeId.NtfPrivate); - break; - } - - if (random > 75) - { - Log.Debug("tp"); - respawning.Teleport(player); - } - } - } -} diff --git a/KruacentExiled/KE.Items/ItemEffects/HealZoneEffect.cs b/KruacentExiled/KE.Items/ItemEffects/HealZoneEffect.cs deleted file mode 100644 index a3a6769d..00000000 --- a/KruacentExiled/KE.Items/ItemEffects/HealZoneEffect.cs +++ /dev/null @@ -1,82 +0,0 @@ -using Exiled.API.Features; -using Exiled.API.Features.Toys; -using Exiled.Events.EventArgs.Map; -using Exiled.Events.EventArgs.Player; -using KE.Items.Interface; -using MEC; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using UnityEngine; - -namespace KE.Items.ItemEffects -{ - public class HealZoneEffect : CustomItemEffect - { - - public override void Effect(UsedItemEventArgs ev) - { - SetZone(ev.Player, ev.Player.Position); - } - public override void Effect(DroppingItemEventArgs ev) - { - SetZone(ev.Player, ev.Player.Position); - } - - public override void Effect(ExplodingGrenadeEventArgs ev) - { - SetZone(ev.Player, ev.Position); - } - - private void SetZone(Player player, Vector3 position) - { - float cylinderSize = 5; - - Player playerThrowingGrenade = player; - Vector3 healZonePosition = position; - Primitive wall = Primitive.Create(PrimitiveType.Cylinder, healZonePosition, null, new Vector3(cylinderSize, 0.01f, cylinderSize), true); - wall.Collidable = false; - wall.Visible = true; - - wall.Color = Color.green; - - var coroutineHandler = Timing.RunCoroutine(HealZoneHeal(wall.Position, cylinderSize, playerThrowingGrenade)); - - Timing.CallDelayed(20, () => { - wall.UnSpawn(); - Timing.KillCoroutines(coroutineHandler); - wall.Destroy(); - }); - } - - private IEnumerator HealZoneHeal(Vector3 wallPosition, float cylinderSize, Player playerThrowingGrenade) - { - while (true) - { - foreach (Player player in Exiled.API.Features.Player.List) - { - // Check if a player is in the zone. - if (IsPlayerInZone(player, wallPosition, cylinderSize)) - { - if (playerThrowingGrenade.Role.Team == player.Role.Team) - { - player.Heal(1); - } - } - } - - // Waiting 0.5s before re-check. - yield return Timing.WaitForSeconds(0.5f); - } - } - - private bool IsPlayerInZone(Player player, Vector3 zonePosition, float radius) - { - float distance = Vector3.Distance(new Vector3(player.Position.x, 0, player.Position.z), - new Vector3(zonePosition.x, 0, zonePosition.z)); - return distance <= (radius / 2); - } - } -} diff --git a/KruacentExiled/KE.Items/ItemEffects/MineEffect.cs b/KruacentExiled/KE.Items/ItemEffects/MineEffect.cs deleted file mode 100644 index e783a242..00000000 --- a/KruacentExiled/KE.Items/ItemEffects/MineEffect.cs +++ /dev/null @@ -1,122 +0,0 @@ -using Exiled.API.Features; -using Exiled.API.Features.Items; -using Exiled.Events.EventArgs.Map; -using Exiled.Events.EventArgs.Player; -using KE.Items.Interface; -using KE.Items.Items.Models; -using MEC; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using UnityEngine; - -namespace KE.Items.ItemEffects -{ - public class MineEffect : CustomItemEffect - { - private const float RefreshRate = .01f; - private const int MineActivationTime = 10; - private const float MineRadius = 0.7f; - public override void Effect(UsedItemEventArgs ev) - { - PlaceMine(ev.Player); - } - public override void Effect(DroppingItemEventArgs ev) - { - PlaceMine(ev.Player); - } - - public override void Effect(ExplodingGrenadeEventArgs ev) - { - PlaceMine(ev.Player,ev.Position); - } - - - /// - /// Place the mine at the feet of the player - /// - /// - private void PlaceMine(Player p) - { - SpawnMine(p, p.Position - new Vector3(0, p.Scale.y)); - } - /// - /// Place the mine at the specified position - /// - /// - /// - private void PlaceMine(Player p,Vector3 pos) - { - - SpawnMine(p, pos); - } - - private void SpawnMine(Player p,Vector3 pos) - { - - MineModel m = new MineModel(); - - //put the mine on the floor - m.Create(pos, new Quaternion()); - - Timing.RunCoroutine(WaitAndActivateMine(p, m)); - } - - - private IEnumerator WaitAndActivateMine(Player player, MineModel mine) - { - int countdown = MineActivationTime; - while (countdown > 0) - { - player.ShowHint($"The mine will be active in {countdown} seconds !", 1f); - yield return Timing.WaitForSeconds(1f); - countdown--; - } - - // Message final lorsque la mine s'active - player.ShowHint("Mine activated !"); - Timing.RunCoroutine(ActiveMine(mine, MineRadius)); - } - - private IEnumerator ActiveMine(MineModel mine, float cylinderSize) - { - Timing.RunCoroutine(mine.Activate()); - bool endWhile = true; - while (endWhile) - { - foreach (Player player in Player.List) - { - if (IsPlayerInZone(player, mine.Position, cylinderSize, 3)) - { - ((ExplosiveGrenade)Item.Create(ItemType.GrenadeHE)).SpawnActive(mine.Position).FuseTime = 0f; - - // Delete the mine - mine.UnSpawn(); - endWhile = false; - break; - } - } - - yield return Timing.WaitForSeconds(RefreshRate); - } - } - - private bool IsPlayerInZone(Player player, Vector3 zonePosition, float radius, float height) - { - // Calculate the horizontal distance (x, z) - float horizontalDistance = Vector3.Distance( - new Vector3(player.Position.x, 0, player.Position.z), - new Vector3(zonePosition.x, 0, zonePosition.z) - ); - - // Calculate the vertical difference (y) - float verticalDifference = Mathf.Abs(player.Position.y - zonePosition.y); - - // Check if the player is in the 3d zone. - return horizontalDistance <= (radius / 2) && verticalDifference <= (height / 2); - } - - } -} diff --git a/KruacentExiled/KE.Items/ItemEffects/MolotovEffect.cs b/KruacentExiled/KE.Items/ItemEffects/MolotovEffect.cs deleted file mode 100644 index 76d90954..00000000 --- a/KruacentExiled/KE.Items/ItemEffects/MolotovEffect.cs +++ /dev/null @@ -1,121 +0,0 @@ -using Exiled.API.Features; -using Exiled.API.Features.Toys; -using Exiled.Events.EventArgs.Map; -using KE.Items.Interface; -using MEC; -using PlayerRoles; -using Exiled.API.Enums; -using System.Collections.Generic; -using UnityEngine; -using Exiled.Events.EventArgs.Player; - -namespace KE.Items.ItemEffects -{ - public class MolotovEffect : CustomItemEffect - { - public const float RefreshRate = 0.5f; - public const float Duration = 20f; - public float CylinderSize { get; set; } = 5; - - - public override void Effect(UsedItemEventArgs ev) - { - SetZone(ev.Player, ev.Player.Position); - } - public override void Effect(DroppingItemEventArgs ev) - { - SetZone(ev.Player, ev.Player.Position); - } - - public override void Effect(ExplodingGrenadeEventArgs ev) - { - SetZone(ev.Player, ev.Position); - } - - - private void SetZone(Player player,Vector3 position) - { - float cylinderSize = CylinderSize; - - - Player playerThrowingGrenade = player; - Vector3 molotovPosition = position; - Primitive wall = Primitive.Create(PrimitiveType.Cylinder, molotovPosition, null, new Vector3(cylinderSize, 0.01f, cylinderSize), true); - wall.Collidable = false; - wall.Visible = true; - - wall.Color = Color.red; - - var coroutineHandler = Timing.RunCoroutine(DamageInMolotovZone(wall.Position, cylinderSize, playerThrowingGrenade)); - - Timing.CallDelayed(Duration, () => { - wall.UnSpawn(); - Timing.KillCoroutines(coroutineHandler); - wall.Destroy(); - }); - } - - - - private IEnumerator DamageInMolotovZone(Vector3 wallPosition, float cylinderSize, Player playerThrowingGrenade) - { - // Dictionary that stores the time each player has spent inside the zone (in seconds). - Dictionary playerTimeInZone = new Dictionary(); - - while (true) - { - foreach (Player player in Player.List) - { - if (IsPlayerInZone(player, wallPosition, cylinderSize)) - { - if (Exiled.API.Features.Server.FriendlyFire || playerThrowingGrenade.Role.Team != player.Role.Team || playerThrowingGrenade == player) - { - if (player.IsHuman || player.Role == RoleTypeId.Scp0492) - { - if (playerTimeInZone.ContainsKey(player)) - { - // increase time each frame. - playerTimeInZone[player] += Time.deltaTime; - } - else - { - // Init the time in dictionnary of the player. - playerTimeInZone[player] = Time.deltaTime; - } - - // time of player spend inside of molotov zone. - float timeInZone = playerTimeInZone[player]; - - // Beginning it willbe 5dm/s, after it will be linearly higher the damage until 20dm/s. - float damage = Mathf.Lerp(2.5f, 10f, timeInZone / 20f); - - // double damage if it's zombie cuz it has more hp. - if (player.Role == RoleTypeId.Scp0492) - { - damage *= 2.5f; - } - - player.Hurt(damage, DamageType.Bleeding); - } - else if (player.IsScp) - { - player.Hurt(player.Health / 150, DamageType.Bleeding); - } - - } - } - } - - yield return Timing.WaitForSeconds(RefreshRate); - } - } - - - private bool IsPlayerInZone(Player player, Vector3 zonePosition, float radius) - { - float distance = Vector3.Distance(new Vector3(player.Position.x, 0, player.Position.z), - new Vector3(zonePosition.x, 0, zonePosition.z)); - return distance <= (radius / 2); - } - } -} diff --git a/KruacentExiled/KE.Items/ItemEffects/Scp1650Effect.cs b/KruacentExiled/KE.Items/ItemEffects/Scp1650Effect.cs deleted file mode 100644 index 4d726503..00000000 --- a/KruacentExiled/KE.Items/ItemEffects/Scp1650Effect.cs +++ /dev/null @@ -1,103 +0,0 @@ -using Exiled.API.Features; -using Exiled.Events.EventArgs.Map; -using Exiled.Events.EventArgs.Player; -using KE.Items.Interface; -using MEC; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using UnityEngine; -using static KE.Items.Items.Scp1650; - -namespace KE.Items.ItemEffects -{ - public class Scp1650Effect : CustomItemEffect - { - public enum CardinalPoints - { - South, - West, - North, - East, - } - - public override void Effect(UsedItemEventArgs ev) - { - OnUsedItem(ev.Player); - } - public override void Effect(DroppingItemEventArgs ev) - { - OnUsedItem(ev.Player); - } - - public override void Effect(ExplodingGrenadeEventArgs ev) - { - foreach (Player player in ev.TargetsToAffect) - { - OnUsedItem(player); - } - } - - - private void OnUsedItem(Player player) - { - - CardinalPoints rotation = Rotation(player.Rotation); - - Log.Debug(rotation); - switch (rotation) - { - - case CardinalPoints.South: - Timing.RunCoroutine(Regeneration(player, 10)); - break; - case CardinalPoints.West: - player.EnableEffect(Exiled.API.Enums.EffectType.BodyshotReduction, 25, 60); - break; - case CardinalPoints.North: - player.EnableEffect(Exiled.API.Enums.EffectType.Invigorated, 1, 30); - break; - case CardinalPoints.East: - player.EnableEffect(Exiled.API.Enums.EffectType.CardiacArrest, 1, 10); - break; - - } - - - } - - private IEnumerator Regeneration(Player p, float duration) - { - float timeWaited = duration; - - while (timeWaited > 0) - { - timeWaited -= .1f; - p.Heal(1); - yield return Timing.WaitForSeconds(.1f); - } - - - } - - private CardinalPoints Rotation(Quaternion rotation) - { - - Vector3 forward1 = rotation * Vector3.forward; - float x = forward1.x; - float z = forward1.z; - - if (z > .75f) - return CardinalPoints.South; - if (x > .75f) - return CardinalPoints.West; - if (z <= -.75f) - return CardinalPoints.North; - if (x <= -.75f) - return CardinalPoints.East; - return CardinalPoints.East; - } - } -} diff --git a/KruacentExiled/KE.Items/ItemEffects/TPGrenadaEffect.cs b/KruacentExiled/KE.Items/ItemEffects/TPGrenadaEffect.cs deleted file mode 100644 index 165f8ca2..00000000 --- a/KruacentExiled/KE.Items/ItemEffects/TPGrenadaEffect.cs +++ /dev/null @@ -1,98 +0,0 @@ -using Exiled.API.Enums; -using Exiled.API.Features; -using Exiled.API.Features.Pickups.Projectiles; -using Exiled.API.Features.Pools; -using Exiled.Events.EventArgs.Map; -using Exiled.Events.EventArgs.Player; -using KE.Items.Interface; -using PlayerRoles; -using System; -using System.Collections.Generic; -using System.ComponentModel; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using UnityEngine; - -namespace KE.Items.ItemEffects -{ - public class TPGrenadaEffect : CustomItemEffect - { - private List effectedPlayers = new List(); - [Description("What roles will not be able to be affected by Implosion Grenades. Keeping SCP-173 on this list is highly recommended.")] - public HashSet BlacklistedRoles { get; set; } = new HashSet() { RoleTypeId.Scp173, RoleTypeId.Scp106, RoleTypeId.Scp049, RoleTypeId.Scp096, RoleTypeId.Scp3114, RoleTypeId.Scp0492, RoleTypeId.Scp939 }; - - public override void Effect(UsedItemEventArgs ev) - { - OnExploding(new HashSet() { ev.Player }); - } - public override void Effect(DroppingItemEventArgs ev) - { - OnExploding(new HashSet() { ev.Player }); - } - - public override void Effect(ExplodingGrenadeEventArgs ev) - { - OnExploding(ev.TargetsToAffect,ev.Projectile); - } - - - - private void OnExploding(HashSet targets, EffectGrenadeProjectile projectile = null) - { - - effectedPlayers = ListPool.Pool.Get(); - foreach (Player player in targets) - { - if (BlacklistedRoles.Contains(player.Role)) - continue; - try - { - bool line; - if (projectile == null) - line = Physics.Linecast(projectile.Transform.position, player.Position); - else - line = true; - - if (line) - { - effectedPlayers.Add(player); - player.Teleport(RandomRoom()); - } - } - catch (Exception exception) - { - Log.Error($"{nameof(OnExploding)} error: {exception}"); - } - } - } - - - - private Room RandomRoom() - { - Room room = Room.Random(); - if (Warhead.IsDetonated) - { - return Room.Random(ZoneType.Surface); - } - - if (Map.IsLczDecontaminated) - { - float random = UnityEngine.Random.value; - Log.Debug($"random={random}"); - if (random <= 0.33f) - { - return Room.Random(ZoneType.HeavyContainment); - } - if (random > 0.33f && random <= 0.66f) - { - return Room.Random(ZoneType.Entrance); - } - return Room.Random(ZoneType.Surface); - } - Log.Debug($"roomZone={room.Zone}"); - return room; - } - } -} diff --git a/KruacentExiled/KE.Items/Items/AdrenalineDrogue.cs b/KruacentExiled/KE.Items/Items/AdrenalineDrogue.cs deleted file mode 100644 index d99fccc3..00000000 --- a/KruacentExiled/KE.Items/Items/AdrenalineDrogue.cs +++ /dev/null @@ -1,259 +0,0 @@ -using System.Collections.Generic; -using Exiled.API.Enums; -using Exiled.API.Features.Attributes; -using Exiled.API.Features.Spawn; -using Exiled.CustomItems.API.Features; -using MEC; -using Exiled.Events.EventArgs.Player; -using Player = Exiled.Events.Handlers.Player; -using Exiled.API.Features; -using Exiled.API.Extensions; -using UnityEngine; -using CustomPlayerEffects; -using KE.Items.Interface; -using System.Linq; -using KE.Items; - -/// -[CustomItem(ItemType.Adrenaline)] -public class AdrenalineDrogue : KECustomItem, ILumosItem -{ - /// - public override uint Id { get; set; } = 1042; - - /// - public override string Name { get; set; } = "DA-020"; - - /// - public override string Description { get; set; } = "you need to test it !"; - - /// - public override float Weight { get; set; } = 0.65f; - public UnityEngine.Color Color { get; set; } = UnityEngine.Color.yellow; - - - public List joueursSCP = new List(); - - /// - public override SpawnProperties SpawnProperties { get; set; } = new SpawnProperties() - { - Limit = 1, - DynamicSpawnPoints = new List - { - new DynamicSpawnPoint() - { - Chance = 100, - Location = SpawnLocationType.Inside079Secondary, - }, - new DynamicSpawnPoint() - { - Chance = 2, - Location = SpawnLocationType.Inside173Gate, - }, - }, - - LockerSpawnPoints = new List - { - new LockerSpawnPoint() - { - Chance = 20, - UseChamber = true, - Type = LockerType.Misc, - Zone = ZoneType.Entrance, - }, - new LockerSpawnPoint() - { - Chance = 25, - UseChamber = true, - Type = LockerType.Medkit, - Zone = ZoneType.HeavyContainment, - }, - }, - }; - - /// - protected override void SubscribeEvents() - { - Player.UsedItem += OnUsingItem; - base.SubscribeEvents(); - } - - /// - protected override void UnsubscribeEvents() - { - Player.UsedItem -= OnUsingItem; - base.UnsubscribeEvents(); - } - - private void OnUsingItem(UsedItemEventArgs ev) - { - if (TryGet(ev.Item, out var result)) - { - if (result.Id == Id) - { - Timing.CallDelayed(0.5f, () => - { - Timing.RunCoroutine(EffectAttribution(ev.Player)); - }); - } - - } - } - - private IEnumerator EffectAttribution(Exiled.API.Features.Player joueur) - { - bool gasgas = false; - - /* EFFET DE LA DROGUE */ - joueur.ShowHint("Vous êtes actuellement sous effet de la cocaïne liquide !"); - - var movementBoostEffect = joueur.ActiveEffects.FirstOrDefault(e => e is MovementBoost) as MovementBoost; - - if (movementBoostEffect != null) - { - float currentIntensity = movementBoostEffect.Intensity; - joueur.EnableEffect(currentIntensity+50, true); - gasgas = true; - } - else - { - joueur.EnableEffect(50, true); - } - - - joueur.EnableEffect(30, true); - joueur.EnableEffect(40, true); - joueur.EnableEffect(30, true); - joueur.Health = 169; - - yield return Timing.WaitForSeconds(30); - - joueur.ShowHint("Mince vous êtes perdu chez le papi Rian !"); - joueur.Health = 9420; - - joueur.IsGodModeEnabled = true; - joueur.EnableEffect(EffectType.Flashed, 2, 2); - joueur.Teleport(RoomType.Pocket); - yield return Timing.WaitForSeconds(6); - - - joueur.EnableEffect(EffectType.Flashed, 2, 2); - joueur.Teleport(Room.Random()); - joueur.Handcuff(); - yield return Timing.WaitForSeconds(15); - - joueur.Health = 1; - - joueur.EnableEffect(EffectType.SeveredHands, 4); - yield return Timing.WaitForSeconds(4); - joueur.DisableAllEffects(); - - - foreach (Exiled.API.Features.Player unJoueur in Exiled.API.Features.Player.List) - { - if (unJoueur.IsScp) - { - joueursSCP.Add(unJoueur); - } - } - - joueur.EnableEffect(EffectType.Flashed, 2, 2); - if (joueursSCP.Count > 0) - { - joueur.Teleport(joueursSCP[UnityEngine.Random.Range(0, joueursSCP.Count)]); - } - else - { - joueur.Teleport(Room.Random()); - } - - yield return Timing.WaitForSeconds(10); - - joueur.Teleport(Room.Random()); - - joueur.RemoveHandcuffs(); - joueur.IsGodModeEnabled = false; - joueur.MaxHealth = 65; - joueur.Heal(joueur.MaxHealth); - joueur.DisplayNickname = "Sou Hiyori"; - - joueur.DisableAllEffects(); - joueur.EnableEffect(10); - if (gasgas) - { - joueur.EnableEffect(130, true); - } else - { - joueur.EnableEffect(30, true); - } - - - yield return Timing.WaitForSeconds(UnityEngine.Random.Range(60, 120)); - - if (joueur.IsAlive) - { - int randomNumber = UnityEngine.Random.Range(1, 6); - switch (randomNumber) - { - case 1: - Log.Debug(joueur.Nickname + " changed his skin !"); - joueur.PlayShieldBreakSound(); - - joueur.ChangeAppearance(joueursSCP[0].Role); - joueur.DisplayNickname = joueursSCP[0].Nickname; - - Exiled.API.Features.Server.FriendlyFire = true; - - joueur.Mute(); - yield return Timing.WaitForSeconds(15); - joueur.UnMute(); - break; - case 2: - Log.Debug("Muet"); - joueur.ShowHint("You lost your ability to talk, (git good)"); - joueur.Mute(); - yield return Timing.WaitForSeconds(UnityEngine.Random.Range(30, 100)); - joueur.ShowHint("I think you found your ability"); - joueur.UnMute(); - break; - case 3: - joueur.ShowHint("You are caoutchouc man"); - Exiled.API.Features.TeslaGate.IgnoredPlayers.Add(joueur); - joueur.SetScale(new Vector3(1.5f, 0.5f, 1.7f), Exiled.API.Features.Player.List); - break; - case 4: - Log.Debug("Let's go party"); - foreach (var player in Exiled.API.Features.Player.List) - { - player.ShowHint("It's " + joueur.Nickname + " birthday !"); - } - - float duration2 = 30f; - float interval2 = 0.7f; - - float elapsedTime2 = 0f; - - while (elapsedTime2 < duration2) - { - float r = UnityEngine.Random.Range(0f, 1f); - float g = UnityEngine.Random.Range(0f, 1f); - float b = UnityEngine.Random.Range(0f, 1f); - - Exiled.API.Features.Map.ChangeLightsColor(new UnityEngine.Color(r, g, b)); - - yield return Timing.WaitForSeconds(interval2); - - elapsedTime2 += interval2; - } - - Exiled.API.Features.Map.ResetLightsColor(); - break; - case 5: - Log.Debug("Paper"); - joueur.ShowHint("You are a paper ! Yippee !"); - joueur.SetScale(new Vector3(1f, 0.5f, 1f), Exiled.API.Features.Player.List); - break; - } - } - } -} \ No newline at end of file diff --git a/KruacentExiled/KE.Items/Items/Defibrilator.cs b/KruacentExiled/KE.Items/Items/Defibrilator.cs deleted file mode 100644 index 0b7d4a76..00000000 --- a/KruacentExiled/KE.Items/Items/Defibrilator.cs +++ /dev/null @@ -1,141 +0,0 @@ -using System.Collections.Concurrent; -using System.Collections.Generic; -using Exiled.API.Enums; -using Exiled.API.Features.Attributes; -using Exiled.API.Features.Spawn; -using Exiled.CustomItems.API.Features; -using MEC; -using Exiled.Events.EventArgs.Player; -using Exiled.API.Features; -using UnityEngine; -using System.Linq; -using KE.Items.Interface; -using KE.Items; - -[CustomItem(ItemType.SCP1853)] -public class Defibrilator : KECustomItem, ILumosItem -{ - public override uint Id { get; set; } = 1041; - public override string Name { get; set; } = "Defibrilator"; - public override string Description { get; set; } = "The defibrillator is used to revive a person who has lost consciousness. It will revive the person closest to the player who uses it (the location of death, not where the body is)."; - public override float Weight { get; set; } = 0.65f; - public UnityEngine.Color Color { get; set; } = UnityEngine.Color.magenta; - - private ConcurrentDictionary positionMort = new ConcurrentDictionary(); - - public override SpawnProperties SpawnProperties { get; set; } = new SpawnProperties() - { - Limit = 4, - DynamicSpawnPoints = new List - { - new DynamicSpawnPoint() { Chance = 50, Location = SpawnLocationType.Inside079Secondary }, - new DynamicSpawnPoint() { Chance = 20, Location = SpawnLocationType.InsideHidLower }, - new DynamicSpawnPoint() { Chance = 20, Location = SpawnLocationType.InsideHidUpper }, - }, - - LockerSpawnPoints = new List - { - new LockerSpawnPoint(){ Chance= 50, Type = LockerType.Medkit, }, - } - }; - - protected override void SubscribeEvents() - { - Exiled.Events.Handlers.Player.UsingItem += OnUsingItem; - Exiled.Events.Handlers.Player.Dying += OnDeathEvent; - Exiled.Events.Handlers.Player.Spawned += OnSpawningEvent; - base.SubscribeEvents(); - } - - protected override void UnsubscribeEvents() - { - Exiled.Events.Handlers.Player.UsingItem -= OnUsingItem; - Exiled.Events.Handlers.Player.Dying -= OnDeathEvent; - Exiled.Events.Handlers.Player.Spawned -= OnSpawningEvent; - base.UnsubscribeEvents(); - } - - private void OnDeathEvent(DyingEventArgs ev) - { - Log.Debug(positionMort.Count()); - Log.Debug(ev.Player.Nickname); - positionMort.TryAdd(ev.Player, ev.Player.Position); - Log.Debug(positionMort.Count()); - Log.Debug("Role : " + ev.Player.Role); - } - - private void OnSpawningEvent(SpawnedEventArgs ev) - { - if (ev.Player.IsAlive) - { - - positionMort.TryRemove(ev.Player, out _); - } - } - - private void OnUsingItem(UsingItemEventArgs ev) - { - if (!Check(ev.Player.CurrentItem)) - { - return; - } - - Timing.CallDelayed(1f, () => - { - ev.IsAllowed = false; - ev.Player.RemoveItem(ev.Item); - - Timing.RunCoroutine(EffectAttribution(ev.Player)); - }); - } - - private IEnumerator EffectAttribution(Player joueur) - { - joueur.DisableEffect(EffectType.Scp1853); - Log.Debug("Utilisation item"); - Log.Debug("Nombre de mort : " + positionMort.Count()); - - if (positionMort.Count == 0) - { - joueur.Broadcast(5, "There is no death", Broadcast.BroadcastFlags.Normal, true); - Exiled.CustomItems.API.Features.CustomItem.TryGive(joueur, 1041); - } - else - { - var playerPosition = joueur.Position; - - Exiled.API.Features.Player closestDeadPlayer = null; - float shortestDistance = float.MaxValue; - - foreach (var dead in positionMort) - { - float distance = Vector3.Distance(playerPosition, dead.Value); - - - if (distance < shortestDistance) - { - shortestDistance = distance; - closestDeadPlayer = dead.Key; - } - } - - if (closestDeadPlayer != null) - { - Log.Debug($"Le joueur mort le plus proche est à une distance de {shortestDistance:F2} unités. C'est : " + closestDeadPlayer.Nickname); - - closestDeadPlayer.IsGodModeEnabled = true; - closestDeadPlayer.Role.Set(joueur.Role); - closestDeadPlayer.Health = 40; - - closestDeadPlayer.Teleport(joueur.Position); - - closestDeadPlayer.Broadcast(5, joueur.Nickname + " revived you!", Broadcast.BroadcastFlags.Normal, true); - joueur.Broadcast(5, "You revived " + closestDeadPlayer.Nickname + "!", Broadcast.BroadcastFlags.Normal, true); - - yield return Timing.WaitForSeconds(1); - - closestDeadPlayer.IsGodModeEnabled = false; - } - } - } -} \ No newline at end of file diff --git a/KruacentExiled/KE.Items/Items/DeployableWall.cs b/KruacentExiled/KE.Items/Items/DeployableWall.cs deleted file mode 100644 index 34fa98d6..00000000 --- a/KruacentExiled/KE.Items/Items/DeployableWall.cs +++ /dev/null @@ -1,76 +0,0 @@ -using Exiled.API.Enums; -using Exiled.API.Features.Attributes; -using Exiled.API.Features.Spawn; -using Exiled.CustomItems.API.Features; -using KE.Items.Interface; -using System.Collections.Generic; -using UnityEngine; -using Exiled.Events.EventArgs.Player; -using Exiled.API.Features.Toys; -using MEC; -using KE.Items.ItemEffects; - -namespace KE.Items.Items -{ - [CustomItem(ItemType.KeycardJanitor)] - public class DeployableWall : KECustomItem, ILumosItem, ISwichableEffect - { - - public override uint Id { get; set; } = 1048; - public override string Name { get; set; } = "Deployable Wall"; - public override string Description { get; set; } = "Drop to deploy a wall, and throw to just throw the card"; - public override float Weight { get; set; } = 0.65f; - public Color Color { get; set; } = Color.green; - - public CustomItemEffect Effect { get; set; } - public override SpawnProperties SpawnProperties { get; set; } = new SpawnProperties() - { - Limit = 2, - DynamicSpawnPoints = new List - { - new DynamicSpawnPoint() - { - Chance=25, - Location = SpawnLocationType.Inside049Armory, - }, - new DynamicSpawnPoint() - { - Chance=25, - Location = SpawnLocationType.InsideLczArmory, - } - }, - LockerSpawnPoints = new List - { - new LockerSpawnPoint() - { - Chance=50, - Type = LockerType.RifleRack, - }, - } - - }; - - public DeployableWall() - { - Effect = new DeployableWallEffect(); - } - - protected override void OnDroppingItem(DroppingItemEventArgs ev) - { - if (ev.IsThrown) - { - ev.IsAllowed = true; - return; - } - - ev.IsAllowed = false; - ev.Player.RemoveItem(ev.Item); - Effect.Effect(ev); - - } - - - - } - -} diff --git a/KruacentExiled/KE.Items/Items/DivinePills.cs b/KruacentExiled/KE.Items/Items/DivinePills.cs deleted file mode 100644 index 6aa402e6..00000000 --- a/KruacentExiled/KE.Items/Items/DivinePills.cs +++ /dev/null @@ -1,106 +0,0 @@ -using System.Collections.Generic; -using Exiled.API.Enums; -using Exiled.API.Features.Attributes; -using Exiled.API.Features.Spawn; -using Exiled.CustomItems.API.Features; -using MEC; -using Exiled.Events.EventArgs.Player; -using PlayerHandle = Exiled.Events.Handlers.Player; -using Exiled.API.Features; -using Exiled.API.Extensions; -using UnityEngine; -using CustomPlayerEffects; -using System.Linq; -using PlayerRoles; -using KE.Items.Interface; -using Exiled.CustomItems.API.EventArgs; -using Exiled.Events.EventArgs.Scp914; -using Exiled.API.Features.Items; -using System.Data; -using Exiled.API.Features.Pickups; -using KE.Items.ItemEffects; -using KE.Items.Upgrade; -using Scp914; -using System.Collections.ObjectModel; -using KE.Items; - -/// -[CustomItem(ItemType.Painkillers)] -public class DivinePills : KECustomItem, ILumosItem, ISwichableEffect, IUpgradableCustomItem -{ - /// - public override uint Id { get; set; } = 1047; - - /// - public override string Name { get; set; } = "Divine Pills"; - - /// - public override string Description { get; set; } = "25% chance you die\n 75% you respawn someone\n"; - - /// - public override float Weight { get; set; } = 0.65f; - public UnityEngine.Color Color { get; set; } = UnityEngine.Color.yellow; - public IReadOnlyDictionary Upgrade { get; private set; } = new Dictionary() - { - //very fine -> true divine pills 10% - { Scp914KnobSetting.VeryFine,new UpgradeProperties(10, 1050)} - }; - - /// - public override SpawnProperties SpawnProperties { get; set; } = new SpawnProperties() - { - LockerSpawnPoints = new List - { - new LockerSpawnPoint() - { - Chance = 75, - UseChamber = true, - Type = LockerType.Misc, - Zone = ZoneType.Entrance, - }, - new LockerSpawnPoint() - { - Chance = 25, - UseChamber = true, - Type = LockerType.Medkit, - Zone = ZoneType.LightContainment, - }, - }, - RoomSpawnPoints = new List - { - new RoomSpawnPoint() - { - Chance = 100, - Room = RoomType.LczGlassBox, - }, - }, - - }; - - public CustomItemEffect Effect { get;set; } - public DivinePills() - { - Effect = new DivinePillsEffect(); - } - - /// - protected override void SubscribeEvents() - { - PlayerHandle.UsedItem += OnUsedItem; - base.SubscribeEvents(); - } - - /// - protected override void UnsubscribeEvents() - { - PlayerHandle.UsedItem -= OnUsedItem; - base.UnsubscribeEvents(); - } - - private void OnUsedItem(UsedItemEventArgs ev) - { - if (!Check(ev.Item)) return; - Effect.Effect(ev); - } - -} \ No newline at end of file diff --git a/KruacentExiled/KE.Items/Items/HealZone.cs b/KruacentExiled/KE.Items/Items/HealZone.cs deleted file mode 100644 index 2c5d0774..00000000 --- a/KruacentExiled/KE.Items/Items/HealZone.cs +++ /dev/null @@ -1,82 +0,0 @@ -using System.Collections.Generic; -using Exiled.API.Enums; -using Exiled.API.Features.Attributes; -using Exiled.API.Features.Spawn; -using Exiled.API.Features.Toys; -using Exiled.CustomItems.API.Features; -using Exiled.Events.EventArgs.Map; -using KE.Items.Interface; -using Player = Exiled.API.Features.Player; -using MEC; -using UnityEngine; -using KE.Items.ItemEffects; - -namespace KE.Items.Items -{ - [CustomItem(ItemType.GrenadeFlash)] - public class HealZone : KECustomGrenade, ILumosItem, ISwichableEffect - { - public override uint Id { get; set; } = 1051; - public override string Name { get; set; } = "Heal Zone"; - public override string Description { get; set; } = "Allow to heal you and your ally"; - public override float Weight { get; set; } = 0.65f; - public override float FuseTime { get; set; } = 5f; - public override bool ExplodeOnCollision { get; set; } = true; - public UnityEngine.Color Color { get; set; } = UnityEngine.Color.green; - public CustomItemEffect Effect { get; set; } - public override SpawnProperties SpawnProperties { get; set; } = new SpawnProperties() - { - Limit = 3, - LockerSpawnPoints = new List - { - new LockerSpawnPoint() - { - Chance = 75, - UseChamber = true, - Type = LockerType.Medkit, - Zone = ZoneType.Entrance, - }, - new LockerSpawnPoint() - { - Chance = 50, - UseChamber = true, - Type = LockerType.Medkit, - Zone = ZoneType.LightContainment, - }, - new LockerSpawnPoint() - { - Chance = 100, - UseChamber = true, - Type = LockerType.Medkit, - Zone = ZoneType.HeavyContainment, - }, - }, - - RoomSpawnPoints = new List - { - new RoomSpawnPoint() - { - Chance = 75, - Room = RoomType.HczHid, - }, - new RoomSpawnPoint() - { - Chance = 50, - Room = RoomType.HczNuke, - }, - }, - }; - - public HealZone() - { - Effect = new HealZoneEffect(); - } - - protected override void OnExploding(ExplodingGrenadeEventArgs ev) - { - - Effect.Effect(ev); - ev.TargetsToAffect.Clear(); - } - } -} \ No newline at end of file diff --git a/KruacentExiled/KE.Items/Items/ImpactFlash.cs b/KruacentExiled/KE.Items/Items/ImpactFlash.cs deleted file mode 100644 index 6f2c2f1a..00000000 --- a/KruacentExiled/KE.Items/Items/ImpactFlash.cs +++ /dev/null @@ -1,48 +0,0 @@ -using System.Collections.Generic; -using Exiled.API.Enums; -using Exiled.API.Features.Attributes; -using Exiled.API.Features.Spawn; -using Exiled.CustomItems.API.Features; - -namespace KE.Items.Items -{ - [CustomItem(ItemType.GrenadeFlash)] - public class ImpactFlash : KECustomGrenade - { - public override uint Id { get; set; } = 1052; - public override string Name { get; set; } = "Impact Flash"; - public override string Description { get; set; } = "The grenade explode at impact"; - public override float Weight { get; set; } = 0.65f; - public override float FuseTime { get; set; } = 3f; - public override bool ExplodeOnCollision { get; set; } = true; - public float DamageModifier { get; set; } = 1f; - public override SpawnProperties SpawnProperties { get; set; } = new SpawnProperties() - { - Limit = 5, - DynamicSpawnPoints = new List - { - new DynamicSpawnPoint() - { - Chance = 50, - Location = SpawnLocationType.InsideHczArmory, - }, - new DynamicSpawnPoint() - { - Chance = 2, - Location = SpawnLocationType.Inside914, - }, - new DynamicSpawnPoint() - { - Chance= 50, - Location = SpawnLocationType.Inside049Armory, - }, - new DynamicSpawnPoint() - { - Chance= 50, - Location = SpawnLocationType.InsideLczArmory, - } - }, - - }; - } -} diff --git a/KruacentExiled/KE.Items/Items/Mine.cs b/KruacentExiled/KE.Items/Items/Mine.cs deleted file mode 100644 index 345b28f2..00000000 --- a/KruacentExiled/KE.Items/Items/Mine.cs +++ /dev/null @@ -1,96 +0,0 @@ -using Exiled.API.Enums; -using Exiled.API.Features.Attributes; -using Exiled.API.Features.Spawn; -using Exiled.CustomItems.API.Features; -using KE.Items.Interface; -using System.Collections.Generic; -using UnityEngine; -using Exiled.Events.EventArgs.Player; -using Exiled.API.Features.Toys; -using Player = Exiled.API.Features.Player; -using MEC; -using Exiled.API.Features.Items; -using Model = KE.Items.Items.Models.Model; -using KE.Items.ItemEffects; - -namespace KE.Items.Items -{ - [CustomItem(ItemType.KeycardJanitor)] - public class Mine : KECustomItem, ILumosItem, ISwichableEffect - { - public override uint Id { get; set; } = 1053; - public override string Name { get; set; } = "Mine"; - public override string Description { get; set; } = "Drop to deploy the mine, little advice : don't step on it"; - public override float Weight { get; set; } = 0.65f; - public Color Color { get; set; } = Color.yellow; - - public CustomItemEffect Effect { get; set; } - - - public override SpawnProperties SpawnProperties { get; set; } = new SpawnProperties() - { - Limit = 2, - DynamicSpawnPoints = new List - { - new DynamicSpawnPoint() - { - Chance= 25, - Location = SpawnLocationType.Inside049Armory, - }, - new DynamicSpawnPoint() - { - Chance= 25, - Location = SpawnLocationType.InsideEscapeSecondary, - }, - new DynamicSpawnPoint() - { - Chance= 25, - Location = SpawnLocationType.InsideGateA, - }, - new DynamicSpawnPoint() - { - Chance= 25, - Location = SpawnLocationType.InsideGateB, - } - }, - LockerSpawnPoints = new List - { - new LockerSpawnPoint() - { - Chance= 20, - Type = LockerType.Misc, - }, - new LockerSpawnPoint() - { - Chance= 20, - Type = LockerType.RifleRack, - }, - } - - }; - - public Mine() - { - Effect = new MineEffect(); - } - - protected override void OnDroppingItem(DroppingItemEventArgs ev) - { - - - if (ev.IsThrown) - { - ev.IsAllowed = true; - return; - } - - ev.IsAllowed = false; - ev.Player.RemoveItem(ev.Item); - Effect.Effect(ev); - - } - - - - } -} diff --git a/KruacentExiled/KE.Items/Items/Models/DeployWallModel.cs b/KruacentExiled/KE.Items/Items/Models/DeployWallModel.cs deleted file mode 100644 index 9bba4ece..00000000 --- a/KruacentExiled/KE.Items/Items/Models/DeployWallModel.cs +++ /dev/null @@ -1,65 +0,0 @@ - - -using Exiled.API.Features; -using Exiled.API.Features.Toys; -using Exiled.Events.Commands.Reload; -using MEC; -using System.Collections.Generic; -using System.Linq; -using UnityEngine; -using Light = Exiled.API.Features.Toys.Light; - -namespace KE.Items.Items.Models -{ - internal class DeployWallModel : Model - { - const float distance = 2; - internal override void Create(Vector3 spawnPos, Quaternion rotation) - { - - Vector3 forward = rotation * Vector3.forward; - Vector3 spawnPosi = spawnPos + forward * distance; - Vector3 rotat = new Vector3(0, rotation.eulerAngles.y, 0); - - - - } - - internal void Change() - { - Timing.CallDelayed(10, () => - { - UnSpawn(); - }); - Timing.CallDelayed(5, () => - { - Toys.ForEach(t => - { - if (t is Primitive p) p.Color = Color.yellow; - }); - }); - Timing.CallDelayed(8, () => - { - Toys.ForEach(t => - { - if (t is Primitive p) p.Color = Color.red; - }); - }); - } - - private void SpawnWall(Vector3 pos, Quaternion rotation) - { - Vector3 forward = rotation * Vector3.forward; - Vector3 spawnPos = pos + forward * distance; - Vector3 rotat = new Vector3(0, rotation.eulerAngles.y, 0); - - MainPlugin.Instance.Sound.PlayClip("build", spawnPos); - Primitive wall = Primitive.Create(PrimitiveType.Cube, spawnPos, rotat, new Vector3(4, 4, 0.2f), true); - wall.Collidable = true; - wall.Visible = true; - - - - } - } -} diff --git a/KruacentExiled/KE.Items/Items/Models/MineModel.cs b/KruacentExiled/KE.Items/Items/Models/MineModel.cs deleted file mode 100644 index 3b9c6b7f..00000000 --- a/KruacentExiled/KE.Items/Items/Models/MineModel.cs +++ /dev/null @@ -1,52 +0,0 @@ - - -using Exiled.API.Features; -using Exiled.API.Features.Toys; -using MEC; -using System.Collections.Generic; -using UnityEngine; -using Light = Exiled.API.Features.Toys.Light; - -namespace KE.Items.Items.Models -{ - internal class MineModel : Model - { - private Light _light; - internal override void Create(Vector3 spawnPos, Quaternion _) - { - //spawn + offset - Position = spawnPos + new Vector3(0, .05f); - Vector3 sizeDisk = new Vector3(.7f, 0.1f, .7f); - Vector3 posLight = Position + new Vector3(0, sizeDisk.y); - - var baseMine = Primitive.Create(PrimitiveType.Cylinder, Position, null, sizeDisk, true); - baseMine.Color = Color.black; - var lightGlobe = Primitive.Create(PrimitiveType.Sphere, posLight, null, new Vector3(.1f, .1f, .1f)); - var lightMine = Light.Create(posLight + new Vector3(0, 0.1f), null, null, true, Color.red); - lightMine.UnSpawn(); - lightMine.Intensity = .55f; - - baseMine.Collidable = false; - lightGlobe.Color = new Color(1, 0, 0, .33f); - lightGlobe.Collidable = false; - - Toys.Add(lightGlobe); - Toys.Add(baseMine); - Toys.Add(lightMine); - _light = lightMine; - } - - internal IEnumerator Activate() - { - if (_light == null) throw new System.Exception("no light"); - while (Round.InProgress) - { - _light.Spawn(); - yield return Timing.WaitForSeconds(3); - _light.UnSpawn(); - yield return Timing.WaitForSeconds(5); - } - - } - } -} diff --git a/KruacentExiled/KE.Items/Items/Models/Model.cs b/KruacentExiled/KE.Items/Items/Models/Model.cs deleted file mode 100644 index 1ccf6673..00000000 --- a/KruacentExiled/KE.Items/Items/Models/Model.cs +++ /dev/null @@ -1,39 +0,0 @@ -using Exiled.API.Features.Toys; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using UnityEngine; - -namespace KE.Items.Items.Models -{ - internal abstract class Model - { - internal Vector3 Position { get; set; } - protected List Toys { get; set; } = new List { }; - internal abstract void Create(Vector3 spawnPos, Quaternion rotation); - - internal void Destroy() - { - foreach (AdminToy primitive in Toys) - { - primitive.Destroy(); - } - } - internal void UnSpawn() - { - foreach (AdminToy primitive in Toys) - { - primitive.UnSpawn(); - } - } - internal void Spawn() - { - foreach (AdminToy primitive in Toys) - { - primitive.Spawn(); - } - } - } -} diff --git a/KruacentExiled/KE.Items/Items/Molotov.cs b/KruacentExiled/KE.Items/Items/Molotov.cs deleted file mode 100644 index 5d4e2433..00000000 --- a/KruacentExiled/KE.Items/Items/Molotov.cs +++ /dev/null @@ -1,80 +0,0 @@ -using System.Collections.Generic; -using Exiled.API.Enums; -using Exiled.API.Features.Attributes; -using Exiled.API.Features.Spawn; -using Exiled.CustomItems.API.Features; -using Exiled.Events.EventArgs.Map; -using KE.Items.Interface; -using KE.Items.ItemEffects; - -namespace KE.Items.Items -{ - [CustomItem(ItemType.GrenadeFlash)] - public class Molotov : KECustomGrenade, ILumosItem, ISwichableEffect - { - public override uint Id { get; set; } = 1049; - public override string Name { get; set; } = "Cocktail Molotov"; - public override string Description { get; set; } = "ARSON"; - public override float Weight { get; set; } = 0.65f; - public override float FuseTime { get; set; } = 5f; - public override bool ExplodeOnCollision { get; set; } = true; - public UnityEngine.Color Color { get; set; } = UnityEngine.Color.yellow; - public CustomItemEffect Effect { get; set; } - public override SpawnProperties SpawnProperties { get; set; } = new SpawnProperties() - { - Limit = 2, - LockerSpawnPoints = new List - { - new LockerSpawnPoint() - { - Chance = 75, - UseChamber = true, - Type = LockerType.Misc, - Zone = ZoneType.Entrance, - }, - new LockerSpawnPoint() - { - Chance = 50, - UseChamber = true, - Type = LockerType.Misc, - Zone = ZoneType.LightContainment, - }, - new LockerSpawnPoint() - { - Chance = 50, - UseChamber = true, - Type = LockerType.Misc, - Zone = ZoneType.HeavyContainment, - }, - }, - - RoomSpawnPoints = new List - { - new RoomSpawnPoint() - { - Chance = 75, - Room = RoomType.LczGlassBox, - }, - new RoomSpawnPoint() - { - Chance = 50, - Room = RoomType.HczNuke, - }, - }, - }; - - - public Molotov() - { - Effect = new MolotovEffect(); - } - - protected override void OnExploding(ExplodingGrenadeEventArgs ev) - { - - Effect.Effect(ev); - ev.TargetsToAffect.Clear(); - } - - } -} \ No newline at end of file diff --git a/KruacentExiled/KE.Items/Items/PressePuree.cs b/KruacentExiled/KE.Items/Items/PressePuree.cs deleted file mode 100644 index 181fc612..00000000 --- a/KruacentExiled/KE.Items/Items/PressePuree.cs +++ /dev/null @@ -1,89 +0,0 @@ - -using System; -using System.Collections.Generic; -using Exiled.API.Enums; -using Exiled.API.Features; -using Exiled.API.Features.Attributes; -using Exiled.API.Features.Spawn; -using Exiled.CustomItems.API.Features; -using Exiled.Events.EventArgs.Scp914; - -namespace KE.Items.Items -{ - [CustomItem(ItemType.GrenadeHE)] - public class PressePuree : KECustomGrenade - { - public override uint Id { get; set; } = 1046; - public override string Name { get; set; } = "Presse Purée"; - public override string Description { get; set; } = "The grenade explode at impact but does less damage\n 5% to upgrade in 914 on very fine"; - public override float Weight { get; set; } = 0.65f; - public override float FuseTime { get; set; } = 1.5f; - public override bool ExplodeOnCollision { get; set; } = true; - public float DamageModifier { get; set; } = 0.4f; - public override SpawnProperties SpawnProperties { get; set; } = new SpawnProperties() - { - Limit = 5, - DynamicSpawnPoints = new List - { - new DynamicSpawnPoint() - { - Chance = 50, - Location = SpawnLocationType.InsideHczArmory, - }, - new DynamicSpawnPoint() - { - Chance = 5, - Location = SpawnLocationType.Inside914, - }, - new DynamicSpawnPoint() - { - Chance= 50, - Location = SpawnLocationType.Inside049Armory, - }, - new DynamicSpawnPoint() - { - Chance= 50, - Location = SpawnLocationType.InsideLczArmory, - } - }, - }; - - - protected override void SubscribeEvents() - { - Exiled.Events.Handlers.Scp914.UpgradingInventoryItem += OnUpgrading; - base.SubscribeEvents(); - } - - /// - protected override void UnsubscribeEvents() - { - Exiled.Events.Handlers.Scp914.UpgradingInventoryItem -= OnUpgrading; - base.UnsubscribeEvents(); - } - - private void OnUpgrading(UpgradingInventoryItemEventArgs ev) - { - if (!Check(ev.Item)) - return; - if (ev.KnobSetting != Scp914.Scp914KnobSetting.VeryFine) - return; - - var rng = UnityEngine.Random.Range(0, 101); - Log.Debug($"inventory {Name} : {rng}"); - if (rng < 5) - { - //success - ev.Player.RemoveItem(ev.Item); - TryGive(ev.Player, "Sainte Grenada"); - ev.IsAllowed = true; - } - else - { - ev.Player.ShowHint("no luck"); - ev.IsAllowed = false; - } - - } - } -} diff --git a/KruacentExiled/KE.Items/Items/SainteGrenada.cs b/KruacentExiled/KE.Items/Items/SainteGrenada.cs deleted file mode 100644 index 35cce201..00000000 --- a/KruacentExiled/KE.Items/Items/SainteGrenada.cs +++ /dev/null @@ -1,64 +0,0 @@ - -using System; -using System.Collections.Generic; -using Exiled.API.Enums; -using Exiled.API.Features; -using Exiled.API.Features.Attributes; -using Exiled.API.Features.Items; -using Exiled.API.Features.Spawn; -using Exiled.CustomItems.API.Features; -using Exiled.Events.EventArgs.Map; -using Exiled.Events.EventArgs.Player; -using KE.Items.Interface; -using UnityEngine; - -namespace KE.Items.Items -{ - [CustomItem(ItemType.GrenadeHE)] - public class SainteGrenada : KECustomGrenade, ILumosItem - { - public override uint Id { get; set; } = 1055; - public override string Name { get; set; } = "Sainte Grenada"; - public override string Description { get; set; } = "Worms reference !?"; - public override float Weight { get; set; } = 1.5f; - public override float FuseTime { get; set; } = 6f; - public override bool ExplodeOnCollision { get; set; } = false; - public float DamageModifier { get; set; } = 3f; - public Color Color { get; set; } = Color.red; - - - // - public int NbGrenadeSpawned { get; set; } = 4; - public float SpawnRadius { get; set; } = 5f; - public float GrenadeSize { get; set; } = 4f; - // - - - public override SpawnProperties SpawnProperties { get; set; } = new SpawnProperties() - { - - }; - - protected override void OnThrownProjectile(ThrownProjectileEventArgs ev) - { - MainPlugin.Instance.Sound.PlayClip("worms", ev.Projectile.GameObject,4,75); - } - protected override void OnExploding(ExplodingGrenadeEventArgs ev) - { - ev.Projectile.Scale = new Vector3(GrenadeSize, GrenadeSize, GrenadeSize); - - for (int i = 0; i < NbGrenadeSpawned; i++) - { - float angle = UnityEngine.Random.Range(0f, 360f) * Mathf.Deg2Rad; - Vector3 offset = new Vector3(Mathf.Cos(angle), 0, Mathf.Sin(angle)) * SpawnRadius; - - Vector3 spawnPosition = ev.Position + offset; - - ExplosiveGrenade grenade = (ExplosiveGrenade)Item.Create(ItemType.GrenadeHE); - grenade.SpawnActive(spawnPosition).FuseTime = 0f; - } - - - } - } -} diff --git a/KruacentExiled/KE.Items/Items/Scp1650.cs b/KruacentExiled/KE.Items/Items/Scp1650.cs deleted file mode 100644 index 97d3cbdf..00000000 --- a/KruacentExiled/KE.Items/Items/Scp1650.cs +++ /dev/null @@ -1,63 +0,0 @@ -using Exiled.API.Features; -using Exiled.API.Features.Attributes; -using Exiled.API.Features.Spawn; -using Exiled.CustomItems.API.Features; -using Exiled.Events.EventArgs.Player; -using KE.Items.Interface; -using KE.Items.ItemEffects; -using MEC; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using UnityEngine; -using PlayerHandle = Exiled.Events.Handlers.Player; - - -namespace KE.Items.Items -{ - [CustomItem(ItemType.Painkillers)] - public class Scp1650 : KECustomItem, ISwichableEffect - { - - public override uint Id { get; set; } = 1056; - public override string Name { get; set; } = "SCP-1650"; - public override string Description { get; set; } = "ויאמר ה' ל— סח השמן על בשרך ולך בינות ה— כששם אלוהים על שפתיך, וזעם ה' וחרון אפו ו— דם המכבים יטהר בית מקדשו אחריך, לנצח נצחים"; - public override float Weight { get; set; } = 0.65f; - public CustomItemEffect Effect { get; set; } - - public override SpawnProperties SpawnProperties { get; set; } = new SpawnProperties() - { - Limit = 1, - LockerSpawnPoints = new List() - { - new LockerSpawnPoint() - { - Type = Exiled.API.Enums.LockerType.Scp207Pedestal, - UseChamber = true, - } - } - }; - - public Scp1650() - { - Effect = new Scp1650Effect(); - } - - protected override void SubscribeEvents() - { - PlayerHandle.UsedItem += OnUsedItem; - } - protected override void UnsubscribeEvents() - { - PlayerHandle.UsedItem -= OnUsedItem; - } - - private void OnUsedItem(UsedItemEventArgs ev) - { - if (!Check(ev.Item)) return; - Effect.Effect(ev); - } - } -} diff --git a/KruacentExiled/KE.Items/Items/Scp3136.cs b/KruacentExiled/KE.Items/Items/Scp3136.cs deleted file mode 100644 index dbd91799..00000000 --- a/KruacentExiled/KE.Items/Items/Scp3136.cs +++ /dev/null @@ -1,91 +0,0 @@ -using Exiled.API.Enums; -using Exiled.API.Features; -using Exiled.API.Features.Attributes; -using Exiled.API.Features.Items; -using Exiled.API.Features.Spawn; -using Exiled.CustomItems.API.Features; -using Exiled.Events.EventArgs.Player; -using Exiled.Events.EventArgs.Server; -using MEC; -using PlayerRoles; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using UnityEngine; - -namespace KE.Items.Items -{ - [CustomItem(ItemType.SCP1576)] - public class Scp3136 : KECustomItem - { - public override uint Id { get; set; } = 1057; - public override string Name { get; set; } = "SCP-3136"; - public override string Description { get; set; } = "A map of the facility, you could draw your friends next to you"; - public override float Weight { get; set; } = 0.65f; - - private Dictionary _respawnPositions = new Dictionary - { - { Faction.FoundationStaff , Vector3.zero}, - { Faction.FoundationEnemy , Vector3.zero} - }; - - public override SpawnProperties SpawnProperties { get; set; } = new SpawnProperties() - { - Limit = 1, - LockerSpawnPoints = new List() - { - new LockerSpawnPoint() - { - Type = Exiled.API.Enums.LockerType.Scp1576Pedestal, - UseChamber = true, - Chance = .5f - } - } - }; - - protected override void SubscribeEvents() - { - Exiled.Events.Handlers.Player.UsedItem += OnDrawing; - Exiled.Events.Handlers.Server.RespawnedTeam += OnRespawnedTeam; - } - protected override void UnsubscribeEvents() - { - Exiled.Events.Handlers.Player.UsedItem -= OnDrawing; - Exiled.Events.Handlers.Server.RespawnedTeam -= OnRespawnedTeam; - } - - private void OnDrawing(UsedItemEventArgs ev) - { - if (!Check(ev.Item)) return; - switch (ev.Player.Role.Side) - { - case Side.Mtf: - _respawnPositions[Faction.FoundationStaff] = ev.Player.Position; - break; - case Side.ChaosInsurgency: - case Side.Tutorial: - _respawnPositions[Faction.FoundationEnemy] = ev.Player.Position; - break; - } - Timing.CallDelayed(1, () => ((Scp1576)ev.Item).StopTransmitting()); - - } - - private void OnRespawnedTeam(RespawnedTeamEventArgs ev) - { - Vector3 spawnPos = _respawnPositions[ev.Wave.TargetFaction]; - if (spawnPos == Vector3.zero) return; - - foreach (Player player in ev.Players) - { - player.Teleport(spawnPos); - _respawnPositions[ev.Wave.TargetFaction] = Vector3.zero; - } - } - - - - } -} diff --git a/KruacentExiled/KE.Items/Items/Scp7045.cs b/KruacentExiled/KE.Items/Items/Scp7045.cs deleted file mode 100644 index ce7b5eb2..00000000 --- a/KruacentExiled/KE.Items/Items/Scp7045.cs +++ /dev/null @@ -1,151 +0,0 @@ -using Exiled.API.Enums; -using Exiled.API.Features; -using Exiled.API.Features.Attributes; -using Exiled.API.Features.Items; -using Exiled.API.Features.Spawn; -using Exiled.API.Features.Toys; -using Exiled.CustomItems.API.Features; -using Exiled.Events.EventArgs.Player; -using Exiled.Events.EventArgs.Server; -using MEC; -using PlayerRoles; -using System; -using System.Collections.Generic; -using System.Diagnostics.Tracing; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using UnityEngine; -using VoiceChat.Codec; -using VoiceChat.Codec.Enums; -using VoiceChat.Networking; - -namespace KE.Items.Items -{ - [CustomItem(ItemType.SCP1576)] - public class Scp7045 : KECustomItem - { - - private static readonly OpusDecoder _decoder = new(); - private static readonly OpusEncoder _encoder = new(OpusApplicationType.Voip); - private static readonly Dictionary _speakers = new (); - public override uint Id { get; set; } = 1800; - public override string Name { get; set; } = "SCP-7045"; - public override string Description { get; set; } = "A weird looking radio"; - public override float Weight { get; set; } = 0.65f; - - private bool _recordingMode= true; - private bool _someoneUsingItem = false; - private AudioMessage _message; - public override SpawnProperties SpawnProperties { get; set; } = new SpawnProperties() - { - Limit = 1, - LockerSpawnPoints = new List() - { - new LockerSpawnPoint() - { - Type = LockerType.Scp1576Pedestal, - UseChamber = true, - Chance = .5f - } - } - }; - - protected override void SubscribeEvents() - { - Exiled.Events.Handlers.Player.UsedItem += OnUsedItem; - Exiled.Events.Handlers.Player.VoiceChatting += OnVoiceChatting; - - - } - protected override void UnsubscribeEvents() - { - Exiled.Events.Handlers.Player.UsedItem -= OnUsedItem; - Exiled.Events.Handlers.Player.VoiceChatting -= OnVoiceChatting; - } - - private void OnUsedItem(UsedItemEventArgs ev) - { - - if (!Check(ev.Item)) return; - Scp1576 item = (Scp1576)ev.Item; - Timing.CallDelayed(.5f, () => item.StopTransmitting()); - - } - - public const int sampleSize = 480; - - private List _recordingBuffer = new(); - private bool _isRecording = false; - private float _lastVoiceTime = 0f; // Timestamp of last voice packet - private void OnVoiceChatting(VoiceChattingEventArgs ev) - { - if (!Check(ev.Player.CurrentItem)) return; - Speaker speaker; - byte speakerid = (byte)ev.Player.Id; - if (!_speakers.TryGetValue(ev.Player, out speaker)) - { - _speakers[ev.Player] = Speaker.Create(speakerid, ev.Player.Position); - } - speaker = _speakers[ev.Player]; - - VoiceMessage message = ev.VoiceMessage; - if (!_isRecording) - { - _recordingBuffer.Clear(); - _isRecording = true; - Timing.RunCoroutine(CheckIfRecordingFinished(speaker)); // Start the "stop talking" check - } - - // Decode voice data and append to the shared buffer - float[] decodedBuffer = new float[sampleSize]; - _decoder.Decode(message.Data, message.DataLength, decodedBuffer); - _recordingBuffer.AddRange(decodedBuffer); - - // Update the last time voice data was received - _lastVoiceTime = Time.time; - } - - private IEnumerator CheckIfRecordingFinished(Speaker speaker) - { - while (_isRecording) - { - // Wait a short time before checking again - yield return Timing.WaitForSeconds(0.2f); - - // If no voice data has been received for 0.5s, stop recording - if (Time.time - _lastVoiceTime >= 0.5f) - { - _isRecording = false; - - float[] finalRecording = _recordingBuffer.ToArray(); - Log.Info($"Final recorded voice message length: {finalRecording.Length} samples."); - - Timing.RunCoroutine(PlayVoice(finalRecording, speaker.Base.NetworkControllerId)); - } - } - } - - - private IEnumerator PlayVoice(float[] data,byte speakerid) - { - for (int i = 0; i < data.Length; i += sampleSize) - { - byte[] encodedData = new byte[512]; - float[] decodedBuffer = data.Skip(i).Take(sampleSize).ToArray(); - int dataLen = _encoder.Encode(decodedBuffer, encodedData); - _message = new AudioMessage(speakerid, encodedData, dataLen); - foreach(Player player in Player.List) - player.ReferenceHub.connectionToClient.Send(_message); - yield return Timing.WaitForOneFrame; - - } - - } - - - - - - } -} diff --git a/KruacentExiled/KE.Items/Items/TPGrenada.cs b/KruacentExiled/KE.Items/Items/TPGrenada.cs deleted file mode 100644 index 0e4c45da..00000000 --- a/KruacentExiled/KE.Items/Items/TPGrenada.cs +++ /dev/null @@ -1,75 +0,0 @@ - -using System; -using System.Collections.Generic; -using System.ComponentModel; -using Exiled.API.Enums; -using Exiled.API.Features; -using Exiled.API.Features.Attributes; -using Exiled.API.Features.Pools; -using Exiled.API.Features.Spawn; -using Exiled.CustomItems.API.Features; -using Exiled.Events.EventArgs.Map; -using KE.Items.Interface; -using KE.Items.ItemEffects; -using PlayerRoles; -using UnityEngine; - -namespace KE.Items.Items -{ - [CustomItem(ItemType.GrenadeHE)] - public class TPGrenada : KECustomGrenade, ILumosItem, ISwichableEffect - { - - public override uint Id { get; set; } = 1045; - public override string Name { get; set; } = "Teleportation Grenade"; - public override string Description { get; set; } = "This grenade does 0 damage but teleport nearby players in a random place (does work in other dimension ;3 )"; - public override float Weight { get; set; } = 0.65f; - public override float FuseTime { get; set; } = 3f; - public override bool ExplodeOnCollision { get; set; } = false; - public UnityEngine.Color Color { get; set; } = UnityEngine.Color.cyan; - public CustomItemEffect Effect { get; set; } - public override SpawnProperties SpawnProperties { get; set; } = new SpawnProperties() - { - Limit = 3, - DynamicSpawnPoints = new List - { - new DynamicSpawnPoint() - { - Chance = 50, - Location = SpawnLocationType.InsideHczArmory, - }, - new DynamicSpawnPoint() - { - Chance =2, - Location = SpawnLocationType.Inside914, - }, - new DynamicSpawnPoint() - { - Chance=50, - Location = SpawnLocationType.Inside049Armory, - }, - new DynamicSpawnPoint() - { - Chance=50, - Location = SpawnLocationType.InsideLczArmory, - } - }, - - }; - - public TPGrenada() - { - Effect = new TPGrenadaEffect(); - } - - protected override void OnExploding(ExplodingGrenadeEventArgs ev) - { - - Effect.Effect(ev); - ev.TargetsToAffect.Clear(); - } - - - } - -} diff --git a/KruacentExiled/KE.Items/Items/TrueDivinePills.cs b/KruacentExiled/KE.Items/Items/TrueDivinePills.cs deleted file mode 100644 index b65d5f22..00000000 --- a/KruacentExiled/KE.Items/Items/TrueDivinePills.cs +++ /dev/null @@ -1,114 +0,0 @@ -using System.Collections.Generic; -using Exiled.API.Enums; -using Exiled.API.Features.Attributes; -using Exiled.API.Features.Spawn; -using Exiled.CustomItems.API.Features; -using MEC; -using Exiled.Events.EventArgs.Player; -using PlayerHandle = Exiled.Events.Handlers.Player; -using Exiled.API.Features; -using Exiled.API.Extensions; -using UnityEngine; -using CustomPlayerEffects; -using System.Linq; -using PlayerRoles; -using KE.Items.Interface; -using Exiled.CustomItems.API.EventArgs; -using Exiled.Events.EventArgs.Scp914; -using KE.Items; - -/// -[CustomItem(ItemType.SCP500)] -public class TrueDivinePills : KECustomItem, ILumosItem -{ - /// - public override uint Id { get; set; } = 1050; - - /// - public override string Name { get; set; } = "True Divine Pills"; - - /// - public override string Description { get; set; } = "Guaranteed to respawn everybody"; - - /// - public override float Weight { get; set; } = 0.65f; - public Color Color { get; set; } = Color.yellow; - private bool tp = false; - - /// - public override SpawnProperties SpawnProperties { get; set; } = new SpawnProperties() - { - - }; - - /// - protected override void SubscribeEvents() - { - PlayerHandle.UsingItem += OnUsingItem; - base.SubscribeEvents(); - } - - /// - protected override void UnsubscribeEvents() - { - PlayerHandle.UsingItem -= OnUsingItem; - base.UnsubscribeEvents(); - } - - protected override void OnDroppingItem(DroppingItemEventArgs ev) - { - if (!Check(ev.Item)) - return; - if (ev.IsThrown) - { - ev.IsAllowed = true; - return; - } - - tp = !tp; - if (tp) - ev.Player.ShowHint("Players will spawn to you"); - else - ev.Player.ShowHint("Players won't spawn to you"); - ev.IsAllowed = false; - - - - } - - private void OnUsingItem(UsingItemEventArgs ev) - { - if (!Check(ev.Item)) - return; - Player player = ev.Player; - Log.Debug(Player.List.Count); - Log.Debug(Player.List.Where(x => x.Role == RoleTypeId.Spectator).Count()); - - if (Player.List.Where(x => x.Role == RoleTypeId.Spectator).Count() == 0) - { - player.ShowHint("No one to respawn"); - ev.IsAllowed = false; - return; - } - - - Player.List.Where(x => x.Role == RoleTypeId.Spectator).ToList().ForEach(x => - { - switch (player.Role.Side) - { - case Side.ChaosInsurgency: - x.Role.Set(RoleTypeId.ChaosRifleman); - break; - case Side.Mtf: - x.Role.Set(RoleTypeId.NtfPrivate); - break; - } - if (tp) - { - x.Teleport(player); - } - }); - - } - -} \ No newline at end of file diff --git a/KruacentExiled/KE.Items/KE.Items.csproj b/KruacentExiled/KE.Items/KE.Items.csproj deleted file mode 100644 index 45de12c2..00000000 --- a/KruacentExiled/KE.Items/KE.Items.csproj +++ /dev/null @@ -1,34 +0,0 @@ - - - - 13.0 - net48 - - - - - - - - - - - - - - - - - - - - - - - if not "$(EXILED_DEV_REFERENCES)"=="" copy /y "$(OutputPath)$(AssemblyName).dll" "$(EXILED_DEV_REFERENCES)\Plugins\" - - - if [[ ! -z "$EXILED_DEV_REFERENCES" ]]; then cp "$(OutputPath)$(AssemblyName).dll" "$EXILED_DEV_REFERENCES/Plugins/"; fi - - - diff --git a/KruacentExiled/KE.Items/KECustomGrenade.cs b/KruacentExiled/KE.Items/KECustomGrenade.cs deleted file mode 100644 index b91a3f07..00000000 --- a/KruacentExiled/KE.Items/KECustomGrenade.cs +++ /dev/null @@ -1,28 +0,0 @@ -using Exiled.API.Features; -using Exiled.API.Features.Items; -using Exiled.CustomItems; -using Exiled.CustomItems.API.Features; -using KE.Items.Interface; -using KE.Utils.Display; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace KE.Items -{ - public abstract class KECustomGrenade : CustomGrenade - { - - protected override void ShowPickedUpMessage(Player player) - { - KECustomItem.Message(this,player); - } - - protected override void ShowSelectedMessage(Player player) - { - KECustomItem.Message(this, player); - } - } -} diff --git a/KruacentExiled/KE.Items/KECustomItem.cs b/KruacentExiled/KE.Items/KECustomItem.cs deleted file mode 100644 index 94de735e..00000000 --- a/KruacentExiled/KE.Items/KECustomItem.cs +++ /dev/null @@ -1,53 +0,0 @@ -using Exiled.API.Features; -using Exiled.API.Features.Items; -using Exiled.CustomItems; -using Exiled.CustomItems.API.Features; -using KE.Items.Interface; -using KE.Utils.Display; -using KE.Utils.Display.Enums; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using System.Xml.Linq; - -namespace KE.Items -{ - public abstract class KECustomItem : CustomItem - { - - protected override void ShowPickedUpMessage(Player player) - { - Message(this, player); - } - - protected override void ShowSelectedMessage(Player player) - { - Message(this, player); - } - - - internal static void Message(CustomItem c,Player player) - { - if (CustomItems.Instance.Config.PickedUpHint.Show) - { - - - string show = $"{c.Name}\n{c.Description}\n"; - if (c is IUpgradableCustomItem ci) - { - foreach (var a in ci.Upgrade) - { - show += $"{a.Value.Chance}% chance of upgrading on {a.Key}\n"; - } - } - - RueIHint hint = new(HPosition.Right, VPosition.CustomItem, show, CustomItems.Instance.Config.PickedUpHint.Duration); - DisplayPlayer.Get(player).Hint(hint); - //player.ShowHint(show, (int)CustomItems.Instance.Config.PickedUpHint.Duration); - - } - } - } -} diff --git a/KruacentExiled/KE.Items/Lights/LightsHandler.cs b/KruacentExiled/KE.Items/Lights/LightsHandler.cs deleted file mode 100644 index 3634aa56..00000000 --- a/KruacentExiled/KE.Items/Lights/LightsHandler.cs +++ /dev/null @@ -1,114 +0,0 @@ -using Exiled.API.Features; -using Exiled.API.Features.Pickups; -using Exiled.API.Features.Toys; -using Exiled.CustomItems.API.Features; -using Exiled.Events.EventArgs.Map; -using Exiled.Events.EventArgs.Player; -using InventorySystem.Items.Pickups; -using KE.Items.Interface; -using MEC; -using System; -using System.Collections.Generic; -using System.Linq; -using Pickup = InventorySystem.Items.Pickups.ItemPickupBase; - -namespace KE.Items.Lights -{ - internal class LightsHandler - { - public float Intensity { get; set; } = .5f; - private readonly Dictionary pl = new Dictionary(); - public void SubscribeEvents() - { - ItemPickupBase.OnPickupAdded += AddPickup; - ItemPickupBase.OnPickupDestroyed += DestroyPickup; - Exiled.Events.Handlers.Server.RoundStarted += OnRoundStarted; - } - - public void UnsubscribeEvents() - { - ItemPickupBase.OnPickupAdded -= AddPickup; - ItemPickupBase.OnPickupDestroyed -= DestroyPickup; - Exiled.Events.Handlers.Server.RoundStarted -= OnRoundStarted; - } - - private void OnRoundStarted() - { - Timing.RunCoroutine(LightP()); - } - - - private void AddPickup(ItemPickupBase pickup) - { - if (Check(pickup)) - { - pl.Add(pickup, null); - } - } - private void DestroyPickup(ItemPickupBase pickup) - { - - if (pickup == null) return; - - if (pl.ContainsKey(pickup)) - { - Light val = pl[pickup]; - val?.Destroy(); - pl.Remove(pickup); - } - } - - - - private IEnumerator LightP() - { - while (true) - { - try - { - - - foreach (var x in pl.ToList()) - { - if (x.Key == null) - { - pl.Remove(x.Key); - continue; - } - if (CustomItem.TryGet(Exiled.API.Features.Pickups.Pickup.Get(x.Key), out CustomItem cui) && cui is ILumosItem ci) - { - if (x.Key == null) continue; - Light light = Light.Create(x.Key.Position, null, null, true, ci.Color); - light.Intensity = Intensity; - if (x.Value != null) - { - Light val = x.Value; - val?.Destroy(); - } - pl[x.Key] = light; - } - else - { - Light val = x.Value; - val?.Destroy(); - pl.Remove(x.Key); - } - } - } - catch (Exception) - { - - } - yield return Timing.WaitForSeconds(MainPlugin.Instance.Config.RefreshRate); - } - - } - - public static bool Check(Pickup pickup) - { - return CustomItem.TryGet(Exiled.API.Features.Pickups.Pickup.Get(pickup), out CustomItem item) && item is ILumosItem; - } - - - } -} diff --git a/KruacentExiled/KE.Items/MainPlugin.cs b/KruacentExiled/KE.Items/MainPlugin.cs deleted file mode 100644 index 7cdf4877..00000000 --- a/KruacentExiled/KE.Items/MainPlugin.cs +++ /dev/null @@ -1,60 +0,0 @@ - -using Exiled.API.Features; -using Exiled.API.Features.Pickups; -using Exiled.API.Features.Toys; -using Exiled.CustomItems.API.Features; -using Exiled.Events.EventArgs.Player; -using KE.Items.Interface; -using KE.Items.Lights; -using KE.Items.Upgrade; -using MEC; -using System; -using System.Collections.Generic; -using System.Linq; - -namespace KE.Items -{ - public class MainPlugin : Plugin - { - public override string Author => "Patrique & OmerGS"; - public override string Name => "KEItems"; - internal Sound Sound { get; private set; } - internal UpgradeHandler UpgradeHandler { get; private set; } - internal LightsHandler LightsHandler { get; private set; } - internal static MainPlugin Instance { get; private set; } - - public override Version Version => new Version(1, 0, 0); - - public override void OnEnabled() - { - Instance = this; - Sound = new Sound(); - UpgradeHandler = new UpgradeHandler(); - LightsHandler = new LightsHandler(); - - Sound.LoadClips(); - - CustomItem.RegisterItems(); - UpgradeHandler.SubscribeEvents(); - LightsHandler.SubscribeEvents(); - - - base.OnEnabled(); - } - - public override void OnDisabled() - { - CustomItem.UnregisterItems(); - UpgradeHandler.UnsubscribeEvents(); - LightsHandler.UnsubscribeEvents(); - - - base.OnDisabled(); - LightsHandler = null; - Sound = null; - UpgradeHandler = null; - Instance = null; - } - - } -} \ No newline at end of file diff --git a/KruacentExiled/KE.Items/README.md b/KruacentExiled/KE.Items/README.md deleted file mode 100644 index 65cad6cb..00000000 --- a/KruacentExiled/KE.Items/README.md +++ /dev/null @@ -1,21 +0,0 @@ -# Custom Items - -| ID | Item Name | Description | -|--------|-----------------------|--------------------| -| 1041 | Defibrillator | Used to revive a player. | -| 1042 | Adrenaline Drogue | Temporarily boosts a player's abilities. | -| 1043 | No Item | No item associated. | -| 1044 | No Item | No item associated. | -| 1045 | TP Granada | Teleporting grenade. | -| 1046 | PressePurée | Grenade explode at impact | -| 1047 | Divine Pill | Respawn a random spectator. | -| 1048 | Deployable Wall | Creates a temporary wall. | -| 1049 | Molotov | Create a damage zone | -| 1050 | True Divine Pills | Respawn every spectator. | -| 1051 | Heal Zone | Area that heals allies. | -| 1052 | Impact Flash | Flash exploding at impact. | -| 1053 | Mine | Explosive mine. | - -## Description - -Each row in the table lists a custom item with its ID and a brief description. The ID is used to identify each item, and the description explains briefly what the item does. diff --git a/KruacentExiled/KE.Items/Sound.cs b/KruacentExiled/KE.Items/Sound.cs deleted file mode 100644 index a15035b5..00000000 --- a/KruacentExiled/KE.Items/Sound.cs +++ /dev/null @@ -1,71 +0,0 @@ - - -using Exiled.API.Features; -using System.Collections.Generic; -using UnityEngine; - -namespace KE.Items -{ - internal class Sound - { - private AudioPlayer audioPlayer; - private Dictionary _soundName = new Dictionary(); - - public Sound() - { - _soundName.Add("lego.ogg", "build"); - _soundName.Add("worms.ogg", "worms"); - } - - ~Sound() - { - audioPlayer.RemoveAllClips(); - } - - public void LoadClips() - { - foreach (var s in _soundName) - { - Log.Info($"Loading clip ({s.Value}) at {MainPlugin.Instance.Config.SoundLocation}\\{s.Key} "); - AudioClipStorage.LoadClip($"{MainPlugin.Instance.Config.SoundLocation}\\{s.Key}", s.Value); - } - } - - - - internal void PlayClip(string clipName, UnityEngine.Vector3 pos, float volume =1f, float maxDistance = 20f) - { - Log.Debug($"playing {clipName} at {pos}"); - audioPlayer = AudioPlayer.CreateOrGet($"{clipName} ({pos})", onIntialCreation: (p) => - { - GameObject a = new GameObject(); - a.transform.position = pos; - p.transform.parent = a.transform; - Speaker speaker = p.AddSpeaker("Main", isSpatial: true, maxDistance: maxDistance, minDistance: 5f); - speaker.transform.parent = a.transform; - speaker.transform.localPosition = Vector3.zero; - }); - - audioPlayer.AddClip(clipName, volume:volume); - } - - - internal void PlayClip(string clipName, GameObject objectEmittingSound, float volume = 1f,float maxDistance = 20f) - { - Log.Debug($"playing {clipName} at {objectEmittingSound}"); - audioPlayer = AudioPlayer.CreateOrGet($"{clipName} ({objectEmittingSound})", onIntialCreation: (p) => - { - - p.transform.parent = objectEmittingSound.transform; - Speaker speaker = p.AddSpeaker("Main", isSpatial: true, maxDistance: maxDistance, minDistance: 5f); - speaker.transform.parent = objectEmittingSound.transform; - speaker.transform.localPosition = Vector3.zero; - }); - - audioPlayer.AddClip(clipName, volume: volume); - } - - - - } -} diff --git a/KruacentExiled/KE.Items/Upgrade/UpgradeHandler.cs b/KruacentExiled/KE.Items/Upgrade/UpgradeHandler.cs deleted file mode 100644 index 8d5634dc..00000000 --- a/KruacentExiled/KE.Items/Upgrade/UpgradeHandler.cs +++ /dev/null @@ -1,81 +0,0 @@ -using Exiled.API.Features; -using Exiled.API.Features.Items; -using Exiled.CustomItems.API.Features; -using Exiled.Events.EventArgs.Scp914; -using KE.Items.Interface; -using Scp914; - -namespace KE.Items.Upgrade -{ - internal class UpgradeHandler - { - - public void SubscribeEvents() - { - Exiled.Events.Handlers.Scp914.UpgradingInventoryItem += UpgradeItem; - Exiled.Events.Handlers.Scp914.UpgradingPickup += UpgradePickUp; - } - - public void UnsubscribeEvents() - { - Exiled.Events.Handlers.Scp914.UpgradingInventoryItem -= UpgradeItem; - Exiled.Events.Handlers.Scp914.UpgradingPickup -= UpgradePickUp; - } - - - private void UpgradeItem(UpgradingInventoryItemEventArgs ev) - { - if (!CustomItem.TryGet(ev.Item, out CustomItem ci)) return; - if (!(ci is IUpgradableCustomItem upgradable)) return; - Log.Debug("upgrading item"); - if (UpgradeCheck(upgradable, ev.KnobSetting)) - { - Log.Debug("success"); - var newItemid = upgradable.Upgrade[ev.KnobSetting].UpgradedItem; - - CustomItem newItem = CustomItem.Get(newItemid); - - ev.Player.RemoveItem(ev.Item); - newItem?.Give(ev.Player); - if (newItem == null) Log.Warn("warning id of custom item not found"); - - } - ev.IsAllowed = false; - } - - private void UpgradePickUp(UpgradingPickupEventArgs ev) - { - - if (!CustomItem.TryGet(ev.Pickup, out CustomItem ci)) return; - if (!(ci is IUpgradableCustomItem upgradable)) return; - Log.Debug("upgrading pickup"); - - if (UpgradeCheck(upgradable, ev.KnobSetting)) - { - Log.Debug("success"); - var newItemid = upgradable.Upgrade[ev.KnobSetting].UpgradedItem; - - CustomItem newItem = CustomItem.Get(newItemid); - - ev.Pickup.Destroy(); - newItem.Spawn(ev.OutputPosition); - if (newItem == null) Log.Warn("warning id of custom item not found"); - } - - ev.IsAllowed = false; - } - - private bool UpgradeCheck(IUpgradableCustomItem upgradable,Scp914KnobSetting knob) - { - if (!upgradable.Upgrade.TryGetValue(knob, out UpgradeProperties item)) return false; - if (MainPlugin.Instance.Config.Debug) - { - return true; - } - float random = UnityEngine.Random.Range(0f, 100f); - if (random < item.Chance) return true; - return false; - } - - } -} diff --git a/KruacentExiled/KE.Items/Upgrade/UpgradeProperties.cs b/KruacentExiled/KE.Items/Upgrade/UpgradeProperties.cs deleted file mode 100644 index 5a44efbf..00000000 --- a/KruacentExiled/KE.Items/Upgrade/UpgradeProperties.cs +++ /dev/null @@ -1,35 +0,0 @@ -using Exiled.CustomItems.API.Features; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Runtime.ExceptionServices; -using System.Text; -using System.Threading.Tasks; -using YamlDotNet.Core.Tokens; - -namespace KE.Items.Upgrade -{ - public class UpgradeProperties - { - private float _chance; - public float Chance - { - get { return _chance; } - } - - private uint _newItem; - public uint UpgradedItem - { - get { return _newItem; } - } - - public UpgradeProperties(float chance, uint newItem) - { - _newItem = newItem; - if (chance > 100) _chance = 100; - else if(chance < 0) _chance = 0; - else _chance = chance; - } - - } -} diff --git a/KruacentExiled/KE.Misc/914.cs b/KruacentExiled/KE.Misc/914.cs deleted file mode 100644 index b70b8dba..00000000 --- a/KruacentExiled/KE.Misc/914.cs +++ /dev/null @@ -1,182 +0,0 @@ -using Exiled.API.Enums; -using Exiled.Events.EventArgs.Scp914; -using PlayerRoles; -using Scp914; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using Exiled.API.Features; -using Exiled.API.Extensions; -using UnityEngine; -using YamlDotNet.Core.Tokens; - -namespace KE.Misc -{ - /// - /// Everything 914 related - /// - internal class _914 - { - - internal Dictionary roleScp = new Dictionary() - { - { -1, RoleTypeId.Scp049 }, - { -2, RoleTypeId.Scp939 }, - { -3, RoleTypeId.Scp096 }, - - { 3, RoleTypeId.Scp106 }, - { 2, RoleTypeId.Scp173 }, - { 1, RoleTypeId.Scp3114}, - - }; - internal void OnUpgradingPlayer(UpgradingPlayerEventArgs ev) - { - Log.Debug("upgrading player"); - Teleport(ev.Player, ev.KnobSetting); - - ChangingRole(ev.Player, ev.KnobSetting); - } - - - /// - /// Teleport the player in a random place specified by the knob - /// Coarse -> 1/4 chance to tp in Lcz -> 1/10 switch place with the scp - /// Fine -> 1/100 chance to tp in Entrance or Hcz - /// - /// the player being teleported - /// the knob setting of 914 - private void Teleport(Player p, Scp914KnobSetting knob) - { - if (knob == Scp914KnobSetting.Fine && UnityEngine.Random.value < .01f) - { - if (UnityEngine.Random.value < .5f) - p.Teleport(Room.Random(ZoneType.Entrance)); - else - p.Teleport(Room.Random(ZoneType.HeavyContainment)); - } - - if (knob == Scp914KnobSetting.Coarse && UnityEngine.Random.value < .25f) - { - if (UnityEngine.Random.value < .10f && Player.List.Any(player => player.IsScp)) - { - Player playerScp = Player.List.ToList().Where(pl => pl.IsScp).GetRandomValue(); - var pos = p.Position; - p.Teleport(playerScp.Position); - playerScp.Teleport(pos); - - } - else - p.Teleport(Room.Random(ZoneType.LightContainment)); - } - } - /// - /// Changing the role of a player - /// - /// the player to change the role - /// the knob setting of knob - private void ChangingRole(Player p, Scp914KnobSetting knob) - { - if (p.IsScp) - { - HandleScpChangingRole(p, knob); - } - else if (p.IsHuman) - { - HandleHumanChangingRole(p, knob); - } - } - /// - /// Handle the change of role if the player is human - /// - /// the human player - /// the knob setting of 914 - private void HandleHumanChangingRole(Player p, Scp914KnobSetting knob) - { - if (p.IsHuman) - { - switch (p.Role.Type) - { - case RoleTypeId.Scientist: - if (UnityEngine.Random.value < .5f && knob == Scp914KnobSetting.OneToOne) - p.Role.Set(RoleTypeId.ClassD); - break; - case RoleTypeId.ClassD: - if (UnityEngine.Random.value < .5f && knob == Scp914KnobSetting.OneToOne) - p.Role.Set(RoleTypeId.Scientist); - break; - case RoleTypeId.FacilityGuard: - if (knob == Scp914KnobSetting.Rough) - p.Role.Set(RoleTypeId.FacilityGuard); - break; - } - } - } - - /// - /// Handle the change of role if the player is a scp - /// - /// the scp player (not a zombie) - /// the knob setting of 914 - private void HandleScpChangingRole(Player p, Scp914KnobSetting knob) - { - - if (p.IsScp && p.Role.Type != RoleTypeId.Scp0492) - { - var invertRoleScp = roleScp.ToDictionary(k => k.Value, v => v.Key); - if (UnityEngine.Random.value < .5f) - { - // get the id of the scp - if (invertRoleScp.TryGetValue(p.Role.Type, out int key)) - { - switch (knob) - { - //going up in the graph - case Scp914KnobSetting.Rough: - TrySetRole(p, key - 1); - break; - //going horizontaly in the graph - case Scp914KnobSetting.OneToOne: - switch (Math.Abs(key)) - { - case 3: - TrySetRole(p,key/(-3)); - break; - case 2: - TrySetRole(p,key* (-1)); - break; - case 1: - TrySetRole(p, key * (-3)); - break; - - } - - break; - //going down in the graph - case Scp914KnobSetting.VeryFine: - TrySetRole(p, key + 1); - break; - } - } - - } - else - { - Log.Debug("no luck"); - } - } - } - - - - private void TrySetRole(Player p ,int key) - { - RoleTypeId newRole; - if (roleScp.TryGetValue(key, out newRole)) - { - p.Role.Set(newRole); - } - } - } -} diff --git a/KruacentExiled/KE.Misc/AutoElevator.cs b/KruacentExiled/KE.Misc/AutoElevator.cs deleted file mode 100644 index 631c9b9a..00000000 --- a/KruacentExiled/KE.Misc/AutoElevator.cs +++ /dev/null @@ -1,37 +0,0 @@ -using Exiled.API.Features; -using MEC; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace KE.Misc -{ - /// - /// The elevator will random activate in the round - /// - internal class AutoElevator - { - /// - /// Start the auto elevator loop - /// - internal IEnumerator StartElevator() - { - Log.Debug("elevator"); - while (!Round.IsEnded) - { - foreach (Lift l in Lift.List) - { - yield return Timing.WaitForSeconds(UnityEngine.Random.Range(30, 45)); - SendElevator(l); - } - } - } - private void SendElevator(Lift e) - { - Log.Debug($"{e.Name}"); - e.TryStart(0, true); - } - } -} diff --git a/KruacentExiled/KE.Misc/ClassDDoor.cs b/KruacentExiled/KE.Misc/ClassDDoor.cs deleted file mode 100644 index 11d0a629..00000000 --- a/KruacentExiled/KE.Misc/ClassDDoor.cs +++ /dev/null @@ -1,41 +0,0 @@ -using Exiled.API.Enums; -using Exiled.API.Features; -using Exiled.API.Features.Doors; -using Exiled.API.Interfaces; -using KE.Misc; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace KE.Misc -{ - /// - /// Everything about classD door - /// - internal class ClassDDoor - { - /// - /// Class d door randomly explode at the start of the round - /// - internal void ClassDDoorGoesBoom() - { - if (UnityEngine.Random.Range(0, 101) < MainPlugin.Instance.Config.ChanceClassDDoorGoesBoom) - { - Log.Debug("ClassD's door exploded"); - foreach (Door door in Door.List) - { - if (door.Type == DoorType.PrisonDoor) - { - if (door is IDamageableDoor dBoyDoor && !dBoyDoor.IsDestroyed) - { - dBoyDoor.Break(); - - } - } - } - } - } - } -} diff --git a/KruacentExiled/KE.Misc/Config.cs b/KruacentExiled/KE.Misc/Config.cs deleted file mode 100644 index d133b746..00000000 --- a/KruacentExiled/KE.Misc/Config.cs +++ /dev/null @@ -1,21 +0,0 @@ -using Exiled.API.Interfaces; -using System.ComponentModel; - -namespace KE.Misc -{ - public class Config : IConfig - { - public bool IsEnabled { get; set; } = true; - public bool Debug { get; set; } = true; - [Description("Chance that the friendly fire is enabled at the start of the round (set 0 to disable)")] - public int ChanceFF { get; set; } = 50; - [Description("Enable or disable the auto-nuke annoucement")] - public int ChanceClassDDoorGoesBoom { get; set; } = 2; - [Description("Chance to d-boy doors goes boom")] - public bool AutoNukeAnnoucement { get; set; } = true; - [Description("Enable or disable the lockdown of SCP-173")] - public bool PeanutLockDown { get; set; } = true; - [Description("Enable or disable the auto elevator")] - public bool AutoElevator { get; set; } = true; - } -} diff --git a/KruacentExiled/KE.Misc/KE.Misc.csproj b/KruacentExiled/KE.Misc/KE.Misc.csproj deleted file mode 100644 index 03cbed42..00000000 --- a/KruacentExiled/KE.Misc/KE.Misc.csproj +++ /dev/null @@ -1,20 +0,0 @@ - - - - net48 - - - - - - - - - - - - - - - - diff --git a/KruacentExiled/KE.Misc/MainPlugin.cs b/KruacentExiled/KE.Misc/MainPlugin.cs deleted file mode 100644 index 0c247056..00000000 --- a/KruacentExiled/KE.Misc/MainPlugin.cs +++ /dev/null @@ -1,119 +0,0 @@ -using Exiled.API.Enums; -using Exiled.API.Features; -using System.Collections.Generic; -using ServerHandle = Exiled.Events.Handlers.Server; -using Nine14Handle = Exiled.Events.Handlers.Scp914; -using MEC; -using Exiled.API.Features.Doors; -using System.Linq; -using PlayerRoles; -using Exiled.Events.EventArgs.Player; -using System; - -namespace KE.Misc -{ - - public class MainPlugin : Plugin - { - public override string Author => "Patrique"; - public override string Name => "KEMisc"; - public override Version Version => new Version(1, 0, 0); - internal static MainPlugin Instance { get; private set; } - private ServerHandler ServerHandler; - internal _914 _914 { get; private set; } - internal AutoElevator AutoElevator { get; private set; } - internal ClassDDoor ClassDDoor { get; private set; } - - public override void OnEnabled() - { - Instance = this; - _914 = new _914(); - AutoElevator = new AutoElevator(); - ClassDDoor = new ClassDDoor(); - ServerHandler = new ServerHandler(); - - ServerHandle.RoundStarted += ServerHandler.OnRoundStarted; - Nine14Handle.UpgradingPlayer += _914.OnUpgradingPlayer; - Exiled.Events.Handlers.Player.Dying += ScpNoeDeathMessage; - - } - - public override void OnDisabled() - { - ServerHandle.RoundStarted -= ServerHandler.OnRoundStarted; - Nine14Handle.UpgradingPlayer -= _914.OnUpgradingPlayer; - Exiled.Events.Handlers.Player.Dying -= ScpNoeDeathMessage; - - _914 = null; - ClassDDoor = null; - ServerHandler = null; - AutoElevator = null; - Instance = null; - } - - - /// - /// Set the Friendly Fire to true or false at random - /// - internal void RandomFF() - { - Server.FriendlyFire = UnityEngine.Random.Range(0, 101) < Instance.Config.ChanceFF; - Log.Info($"Friendly Fire : {Server.FriendlyFire}"); - } - - /// - /// C.A.S.S.I.E. announce 5 min before the autonuke - /// - internal IEnumerator NukeAnnouncement() - { - Log.Debug("autonuke announcement : on"); - yield return Timing.WaitUntilTrue(() => 25 <= Round.ElapsedTime.TotalMinutes); - Cassie.MessageTranslated("Warning automatic warhead will detonate in 5 minutes", - "Warning automatic warhead will detonate in 5 minutes"); - } - - /// - /// Lock SCP-173 in its cell for an amount of time determine by the number of player - /// Formula : timeLock = 135-nbPlayer*15 - /// - internal IEnumerator PeanutLockdown() - { - if(!Player.List.Any(p => p.Role.Type == RoleTypeId.Scp173)) - { - yield return 0; - } - Log.Debug("peanut lockdown"); - Door peanutDoor = Door.List.ToList().Where(x => x.Type == DoorType.Scp173NewGate).ToList()[0]; - peanutDoor.IsOpen = false; - peanutDoor.ChangeLock(DoorLockType.Lockdown2176); - yield return Timing.WaitForSeconds(135-Player.List.Count*15); - peanutDoor.IsOpen = true; - peanutDoor.Unlock(); - Log.Debug("peanut free"); - } - - /// - /// Special death message when Delecons dies as a SCP - /// - /// - internal void ScpNoeDeathMessage(DyingEventArgs ev) - { - - Player player = ev.Player; - Log.Debug($"someone died = {player.UserId}"); - - if (!player.UserId.Equals("76561199066936074@steam")) - return; - if (!player.IsScp) - return; - if (player.Role.Type == RoleTypeId.Scp0492) - return; - Cassie.MessageTranslated("SCP 69 420 has been contained successfully", "SCP-69420-NOE has been contained successfully"); - } - - - - - - } -} diff --git a/KruacentExiled/KE.Misc/README.md b/KruacentExiled/KE.Misc/README.md deleted file mode 100644 index 79b9d8a2..00000000 --- a/KruacentExiled/KE.Misc/README.md +++ /dev/null @@ -1,14 +0,0 @@ -# Misc Plugin -This plugin add all of the other feature. - -## Random FriendlyFire -Each round, there is a chance (50% by default) to have the Friendly Fire enabled. - -## Auto-nuke Annoucement -C.A.S.S.I.E. make an announcement when the auto-nuke - -## Peanut Lockdown -Peanut is locked down in its containment for a limited amount of time because - -## Auto Elevator -Elevator automaticly goes up and down \ No newline at end of file diff --git a/KruacentExiled/KE.Misc/ServerHandler.cs b/KruacentExiled/KE.Misc/ServerHandler.cs deleted file mode 100644 index a8d01142..00000000 --- a/KruacentExiled/KE.Misc/ServerHandler.cs +++ /dev/null @@ -1,27 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using Exiled.API.Features; -using MEC; - -namespace KE.Misc -{ - internal class ServerHandler - { - public void OnRoundStarted() - { - if(MainPlugin.Instance.Config.ChanceFF >= 0 && MainPlugin.Instance.Config.ChanceFF <= 100) - MainPlugin.Instance.RandomFF(); - if (MainPlugin.Instance.Config.ChanceClassDDoorGoesBoom >= 0 && MainPlugin.Instance.Config.ChanceClassDDoorGoesBoom <= 100) - MainPlugin.Instance.ClassDDoor.ClassDDoorGoesBoom(); - if(MainPlugin.Instance.Config.AutoNukeAnnoucement) - Timing.RunCoroutine(MainPlugin.Instance.NukeAnnouncement()); - if(MainPlugin.Instance.Config.PeanutLockDown && Player.List.Where(p => p.Role.Type == PlayerRoles.RoleTypeId.Scp173).Count() > 0) - Timing.RunCoroutine(MainPlugin.Instance.PeanutLockdown()); - if(MainPlugin.Instance.Config.AutoElevator) - Timing.RunCoroutine(MainPlugin.Instance.AutoElevator.StartElevator()); - } - } -} diff --git a/KruacentExiled/KE.Utils/API/Displays/DisplayMeow/DisplayHandler.cs b/KruacentExiled/KE.Utils/API/Displays/DisplayMeow/DisplayHandler.cs deleted file mode 100644 index 4ee13535..00000000 --- a/KruacentExiled/KE.Utils/API/Displays/DisplayMeow/DisplayHandler.cs +++ /dev/null @@ -1,67 +0,0 @@ -using Exiled.API.Features; -using HintServiceMeow.Core.Extension; -using HintServiceMeow.Core.Models.Hints; -using HintServiceMeow.Core.Utilities; -using MEC; - - -//damn why the same name -using MHint = HintServiceMeow.Core.Models.Hints.Hint; - -namespace KE.Utils.API.Displays.DisplayMeow -{ - public class DisplayHandler - { - public static DisplayHandler Instance { get; } = new(); - - private DisplayHandler() { } - - - - - - - public MHint AddHint(HintPlacement hintPlacement, Player player, string text, float delay) - { - var dis = PlayerDisplay.Get(player); - string id = $"{player.Id}_{hintPlacement.XCoordinate}_{hintPlacement.YCoordinate}"; - MHint hint; - - if (!dis.TryGetHint(id, out var aHint)) - { - hint = new() - { - Text = text, - XCoordinate = hintPlacement.XCoordinate, - YCoordinate = hintPlacement.YCoordinate, - Alignment = hintPlacement.HintAlignment, - Id = id - - }; - dis.AddHint(hint); - - } - else - { - - hint = (MHint)aHint; - hint.Hide = false; - hint.Text = text; - } - - - hint.HideAfter(delay); - return hint; - } - - - - - - - - - - - } -} diff --git a/KruacentExiled/KE.Utils/API/Displays/DisplayMeow/HintPlacement.cs b/KruacentExiled/KE.Utils/API/Displays/DisplayMeow/HintPlacement.cs deleted file mode 100644 index 936cdbe9..00000000 --- a/KruacentExiled/KE.Utils/API/Displays/DisplayMeow/HintPlacement.cs +++ /dev/null @@ -1,31 +0,0 @@ -using HintServiceMeow.Core.Enum; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace KE.Utils.API.Displays.DisplayMeow -{ - public readonly struct HintPlacement : IEquatable - { - public float YCoordinate { get; } - public float XCoordinate { get; } - public HintAlignment HintAlignment { get; } = HintAlignment.Center; - - - public bool Equals(HintPlacement obj) - { - return YCoordinate == obj.YCoordinate && XCoordinate == obj.XCoordinate; - } - - - public HintPlacement(float xCoordinate, float yCoordinate, HintAlignment alignment = HintAlignment.Center) - { - YCoordinate = yCoordinate; - XCoordinate = xCoordinate; - HintAlignment = alignment; - } - - } -} diff --git a/KruacentExiled/KE.Utils/API/Interfaces/IEvents.cs b/KruacentExiled/KE.Utils/API/Interfaces/IEvents.cs deleted file mode 100644 index e573b062..00000000 --- a/KruacentExiled/KE.Utils/API/Interfaces/IEvents.cs +++ /dev/null @@ -1,17 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace KE.Utils.API.Interfaces -{ - public interface IUsingEvents - { - - - public void SubscribeEvents(); - - public void UnsubscribeEvents(); - } -} diff --git a/KruacentExiled/KE.Utils/API/ReflectionHelper.cs b/KruacentExiled/KE.Utils/API/ReflectionHelper.cs deleted file mode 100644 index 2f00fbb1..00000000 --- a/KruacentExiled/KE.Utils/API/ReflectionHelper.cs +++ /dev/null @@ -1,47 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Reflection; -using System.Text; -using System.Threading.Tasks; - -namespace KE.Utils.API -{ - public static class ReflectionHelper - { - public static IEnumerable GetObjects(Assembly assembly = null) - { - List result = new(); - if (assembly == null) - { - assembly = Assembly.GetCallingAssembly(); - } - foreach (Type t in assembly.GetTypes()) - { - try - { - if (typeof(T).IsAssignableFrom(t) && !t.IsAbstract) - { - T ffcc = (T)Activator.CreateInstance(t); - result.Add(ffcc); - } - } - catch (Exception) - { - - } - } - return result; - } - - public static IEnumerable GetObjects(IEnumerable assemblies) - { - List result = new(); - foreach(Assembly assembly in assemblies) - { - result.AddRange(GetObjects(assembly)); - } - return result; - } - } -} diff --git a/KruacentExiled/KE.Utils/Extensions/AdminToyExtension.cs b/KruacentExiled/KE.Utils/Extensions/AdminToyExtension.cs deleted file mode 100644 index 37c3706d..00000000 --- a/KruacentExiled/KE.Utils/Extensions/AdminToyExtension.cs +++ /dev/null @@ -1,25 +0,0 @@ -using Exiled.API.Features.Toys; -using KE.Utils.Quality; -using KE.Utils.Quality.Enums; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace KE.Utils.Extensions -{ - public static class AdminToyExtension - { - - public static void SetAsPickupAdminToy(this AdminToy toy, bool autoSync = true) - { - QualityHandler.Instance.QualityToysHandler.SetAsPickup(toy); - } - - public static void SetQuality(this AdminToy toy, ModelQuality modelQuality,bool autoSync = true) - { - QualityHandler.Instance.QualityToysHandler.SetQuality(toy, modelQuality); - } - } -} diff --git a/KruacentExiled/KE.Utils/Extensions/PlayerExtension.cs b/KruacentExiled/KE.Utils/Extensions/PlayerExtension.cs deleted file mode 100644 index b01f98d2..00000000 --- a/KruacentExiled/KE.Utils/Extensions/PlayerExtension.cs +++ /dev/null @@ -1,52 +0,0 @@ -using CustomPlayerEffects; -using Exiled.API.Enums; -using Exiled.API.Features; -using Mirror; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using UnityEngine; - -namespace KE.Utils.Extensions -{ - public static class PlayerExtension - { - public static void SetFakeInvis(this Player p, IEnumerable viewers) - { - Vector3 pos = p.Position; - - try - { - p.ReferenceHub.transform.localPosition = Vector3.zero; - foreach (Player viewer in viewers) - { - Server.SendSpawnMessage.Invoke(null, new object[2] { viewer.NetworkIdentity, viewer.Connection }); - } - - p.ReferenceHub.transform.localPosition = pos; - } - catch (Exception arg) - { - Log.Error(string.Format("{0}: {1}", "SetFakeInvis", arg)); - } - } - - - - - public static void AddLevelEffect(this Player p,EffectType type, int intensity) - { - - - if (!p.TryGetEffect(type, out var effect)) - p.ChangeEffectIntensity(type, (byte)(effect.Intensity + intensity)); - else - p.EnableEffect(type, (byte)intensity); - } - - - - } -} diff --git a/KruacentExiled/KE.Utils/KE.Utils.csproj b/KruacentExiled/KE.Utils/KE.Utils.csproj deleted file mode 100644 index 1587c6e8..00000000 --- a/KruacentExiled/KE.Utils/KE.Utils.csproj +++ /dev/null @@ -1,30 +0,0 @@ - - - - 13.0 - net48 - - - - - - - - - - - - - - - - - - if not "$(EXILED_DEV_REFERENCES)"=="" copy /y "$(OutputPath)$(AssemblyName).dll" "$(EXILED_DEV_REFERENCES)\Plugins\" - - - if [[ ! -z "$EXILED_DEV_REFERENCES" ]]; then cp "$(OutputPath)$(AssemblyName).dll" "$EXILED_DEV_REFERENCES/Plugins/"; fi - - - - diff --git a/KruacentExiled/KE.Utils/Quality/Handlers/QualityToysHandler.cs b/KruacentExiled/KE.Utils/Quality/Handlers/QualityToysHandler.cs deleted file mode 100644 index b2485795..00000000 --- a/KruacentExiled/KE.Utils/Quality/Handlers/QualityToysHandler.cs +++ /dev/null @@ -1,179 +0,0 @@ -using AdminToys; -using Exiled.API.Enums; -using Exiled.API.Extensions; -using Exiled.API.Features; -using Exiled.API.Features.Toys; -using KE.Utils.Quality.Enums; -using KE.Utils.Quality.Settings; -using MEC; -using System; -using System.Collections.Generic; -using System.Linq; -using UnityEngine; -using Light = Exiled.API.Features.Toys.Light; -using QualitySettings = KE.Utils.Quality.Settings.QualitySettings; - -namespace KE.Utils.Quality.Handlers -{ - public class QualityToysHandler - { - private HashSet _pickupToys = new(); - private Dictionary _qualityToys = new(); - public readonly Vector3 Gulag = new Vector3(15000, 15000, 15000); - public const float Delay = Timing.WaitForOneFrame; - public bool IsPickupToy(AdminToy primitive) - { - return _pickupToys.Contains(primitive); - } - - public bool IsQualityToy(AdminToy primitive) - { - return _qualityToys.ContainsKey(primitive); - } - - - public void SetAsPickup(AdminToy toy, bool autoSync = true) - { - if (!_pickupToys.Add(toy)) - { - Log.Warn($"AdminToy {toy} is already a pickupToy"); - return; - } - if (autoSync) - Sync(toy); - } - - public void SetQuality(AdminToy toy, ModelQuality quality, bool autoSync = true) - { - if (toy == null) return; - if (!_qualityToys.ContainsKey(toy)) - _qualityToys.Add(toy, quality); - else - _qualityToys[toy] = quality; - - if (autoSync) - Sync(toy); - } - - - - private void SendToFakePosition(AdminToy adminToy, Player player,Vector3 position) - { - //idk why but without delay it show all of the quality at once - Timing.CallDelayed(Delay, () => - { - if (adminToy is Light l) - { - player.SendFakeSyncVar(l.Base.netIdentity, typeof(LightSourceToy), nameof(LightSourceToy.NetworkPosition), position); - return; - } - if (adminToy is Primitive p) - { - player.SendFakeSyncVar(p.Base.netIdentity, typeof(PrimitiveObjectToy), nameof(PrimitiveObjectToy.NetworkPosition), position); - return; - } - }); - - } - - /// - /// Sync every Players - /// - public void Sync() - { - foreach (Player p in Player.List) - { - Sync(p); - } - } - - /// - /// Sync a specified Player - /// - /// - public void Sync(Player p) - { - - - - var quality = QualitySettings.Get(p); - var pickup = QualitySettings.PickmodelActivated(p); - - HashSet pickupToRemove = []; - HashSet qualityToRemove = []; - - //hide pickup toys - - foreach (AdminToy pk in _pickupToys) - { - try - { - if (pickup) - { - SendToFakePosition(pk, p, pk.Position); - } - else - { - SendToFakePosition(pk, p, Gulag); - } - } - catch (NullReferenceException) - { - //Log.Warn("removing pickup"); - pickupToRemove.Add(pk); - } - - } - - _pickupToys.RemoveWhere(p => pickupToRemove.Contains(p)); - - - foreach (var at in _qualityToys) - { - try - { - if ((at.Value == quality || at.Value == ModelQuality.None) && (pickup || !_pickupToys.Contains(at.Key))) - { - SendToFakePosition(at.Key, p, at.Key.Position); - } - else - { - SendToFakePosition(at.Key, p, Gulag); - } - } - catch (NullReferenceException) - { - //Log.Warn("removing quality" + _qualityToys.Count); - qualityToRemove.Add(at.Key); - } - - - } - foreach(var at in qualityToRemove) - { - - _qualityToys.Remove(at); - } - - } - - /// - /// Sync a specified AdminToy - /// - /// - public void Sync(AdminToy adminToy) - { - //temporary fix - Sync(); - - if (IsPickupToy(adminToy)) - { - - } - if (IsQualityToy(adminToy)) - { - - } - } - } -} diff --git a/KruacentExiled/KE.Utils/Quality/Models/Base/BaseModel.cs b/KruacentExiled/KE.Utils/Quality/Models/Base/BaseModel.cs deleted file mode 100644 index c9f6723c..00000000 --- a/KruacentExiled/KE.Utils/Quality/Models/Base/BaseModel.cs +++ /dev/null @@ -1,41 +0,0 @@ -using Exiled.API.Enums; -using Exiled.API.Extensions; -using Exiled.API.Features.Toys; -using Exiled.API.Interfaces; -using KE.Utils.Quality.Structs; -using PlayerStatsSystem; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using UnityEngine; -using Light = Exiled.API.Features.Toys.Light; - -namespace KE.Utils.Quality.Models.Base -{ - - /// - /// The blocks to build a model with - /// - public abstract class BaseModel : ICloneable - { - - protected AdminToy _toy; - public AdminToy AdminToy { get { return _toy; } } - private Vector3 _position; - public Vector3 LocalPosition { get { return _position; } } - private Quaternion _rotation; - public Quaternion LocalRotation { get { return _rotation; } } - - - public BaseModel(Vector3 localPositon, Quaternion localRotation) - { - _position = localPositon; - _rotation = localRotation; - } - - public abstract object Clone(); - } - -} diff --git a/KruacentExiled/KE.Utils/Quality/Models/Base/LightModel.cs b/KruacentExiled/KE.Utils/Quality/Models/Base/LightModel.cs deleted file mode 100644 index ce808da1..00000000 --- a/KruacentExiled/KE.Utils/Quality/Models/Base/LightModel.cs +++ /dev/null @@ -1,26 +0,0 @@ -using Exiled.API.Features.Toys; -using UnityEngine; -using Light = Exiled.API.Features.Toys.Light; - -namespace KE.Utils.Quality.Models.Base -{ - public class LightModel : BaseModel - { - - /// - /// Create a new Light for modeling - /// - public LightModel(Vector3? scale, Color? color, Vector3 localPositon, Quaternion localRotation) : base(localPositon, localRotation) - { - Light light = Light.Create(null, null, scale, false, color); - _toy = light; - } - - - public override object Clone() - { - Light light = _toy as Light; - return new LightModel(light.Scale, light.Color, LocalPosition, LocalRotation); - } - } -} diff --git a/KruacentExiled/KE.Utils/Quality/Models/Base/PrimitiveModel.cs b/KruacentExiled/KE.Utils/Quality/Models/Base/PrimitiveModel.cs deleted file mode 100644 index 22e07225..00000000 --- a/KruacentExiled/KE.Utils/Quality/Models/Base/PrimitiveModel.cs +++ /dev/null @@ -1,26 +0,0 @@ -using Exiled.API.Features.Toys; -using UnityEngine; -using Color = UnityEngine.Color; - -namespace KE.Utils.Quality.Models.Base -{ - public class PrimitiveModel : BaseModel - { - /// - /// Create a new Primitive for modeling - /// - public PrimitiveModel(PrimitiveType type, Vector3? scale, Color? color,Vector3 localPosition,Quaternion localRotation) : base(localPosition, localRotation) - { - - Primitive prim = Primitive.Create(type, null, null, scale, false, color); - prim.Collidable = false; - _toy = prim; - } - - public override object Clone() - { - Primitive prim = _toy as Primitive; - return new PrimitiveModel(prim.Type, prim.Scale, prim.Color, LocalPosition, LocalRotation); - } - } -} diff --git a/KruacentExiled/KE.Utils/Quality/Models/Examples/MineModel.cs b/KruacentExiled/KE.Utils/Quality/Models/Examples/MineModel.cs deleted file mode 100644 index 00d60fec..00000000 --- a/KruacentExiled/KE.Utils/Quality/Models/Examples/MineModel.cs +++ /dev/null @@ -1,118 +0,0 @@ -using KE.Utils.Quality.Enums; -using KE.Utils.Quality.Models.Base; -using System.Collections.Generic; -using UnityEngine; -using Light = Exiled.API.Features.Toys.Light; - -namespace KE.Utils.Quality.Models.Examples -{ - public abstract class MineModel : QualityModel - { - protected Light _light; - private bool _lightOn = false; - - - - - public void ToggleLight() - { - if (_light == null) throw new System.Exception("no light"); - if (_lightOn) - _light.UnSpawn(); - else - _light.Spawn(); - _lightOn = !_lightOn; - } - - } - - public class MineModelLow : MineModel - { - public override bool IsPickup => false; - public override ModelQuality Quality => ModelQuality.Low; - - protected override IEnumerable GetBaseModels() - { - Quaternion baseRotation = new(); - //spawn + offset - Vector3 offset = new Vector3(0, .05f); - Vector3 sizeDisk = new Vector3(.7f, 0.1f, .7f); - - Vector3 sizeGlobe = new Vector3(.1f, .1f, .1f); - Vector3 posLight = new Vector3(0, sizeDisk.y+sizeGlobe.y); - - - var baseMine = new PrimitiveModel(PrimitiveType.Cylinder, sizeDisk, Color.black, offset, baseRotation); - - var lightGlobe = new PrimitiveModel(PrimitiveType.Sphere, sizeGlobe , new Color(1, 0, 0, .33f), posLight, baseRotation); - - var lightMine = new LightModel(null, Color.red, posLight, baseRotation); - - _light = lightMine.AdminToy as Light; - _light.Intensity = .55f; - - return [baseMine, lightGlobe, lightMine]; - } - - - } - - public class MineModelMedium : MineModel - { - public override bool IsPickup => false; - public override ModelQuality Quality => ModelQuality.Medium; - - protected override IEnumerable GetBaseModels() - { - Quaternion baseRotation = new(); - //spawn + offset - Vector3 offset = new Vector3(0, .05f); - Vector3 sizeDisk = new Vector3(.7f, 0.1f, .7f); - - Vector3 sizeGlobe = new Vector3(.1f, .1f, .1f); - Vector3 posLight = new Vector3(0, sizeDisk.y + sizeGlobe.y); - - - var baseMine = new PrimitiveModel(PrimitiveType.Cylinder, sizeDisk, Color.black, offset, baseRotation); - - var lightGlobe = new PrimitiveModel(PrimitiveType.Sphere, sizeGlobe, new Color(1, 0, 0, .33f), posLight, baseRotation); - - var lightMine = new LightModel(null, Color.green, posLight, baseRotation); - - _light = lightMine.AdminToy as Light; - _light.Intensity = .55f; - - return [baseMine, lightGlobe, lightMine]; - } - } - - public class MineModelPickup : MineModel - { - public override bool IsPickup => true; - public override ModelQuality Quality => ModelQuality.None; - - - protected override IEnumerable GetBaseModels() - { - Quaternion baseRotation = new(); - //spawn + offset - Vector3 offset = new Vector3(0, .05f); - Vector3 sizeDisk = new Vector3(.7f, 0.1f, .7f); - - Vector3 sizeGlobe = new Vector3(.1f, .1f, .1f); - Vector3 posLight = new Vector3(0, sizeDisk.y + sizeGlobe.y); - - - var baseMine = new PrimitiveModel(PrimitiveType.Cylinder, sizeDisk, Color.black, offset, baseRotation); - - var lightGlobe = new PrimitiveModel(PrimitiveType.Sphere, sizeGlobe, new Color(1, 0, 0, .33f), posLight, baseRotation); - - var lightMine = new LightModel(null, Color.magenta, posLight, baseRotation); - - _light = lightMine.AdminToy as Light; - _light.Intensity = .55f; - - return [baseMine, lightGlobe, lightMine]; - } - } -} diff --git a/KruacentExiled/KE.Utils/Quality/Models/Model.cs b/KruacentExiled/KE.Utils/Quality/Models/Model.cs deleted file mode 100644 index 2e26756e..00000000 --- a/KruacentExiled/KE.Utils/Quality/Models/Model.cs +++ /dev/null @@ -1,104 +0,0 @@ -using Exiled.API.Features; -using Exiled.API.Features.Toys; -using KE.Utils.Quality.Models.Base; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using UnityEngine; - -namespace KE.Utils.Quality.Models -{ - public class Model : IEquatable - { - - - private Vector3 _position; - public Vector3 Position - { - get { return _position; } - set - { - _position = value; - } - } - private Quaternion _rotation; - public Quaternion Rotation - { - get { return _rotation; } - set - { - _rotation = value; - } - } - private ModelPrefab _prefab; - public ModelPrefab Prefab - { - get { return _prefab; } - } - - - - private HashSet _models; - - internal Model(ModelPrefab prefab, Vector3 position, Quaternion rotation,IEnumerable toys,bool spawn) - { - _prefab = prefab; - Position = position; - Rotation = rotation; - _models = new HashSet(toys); - QualityHandler.Instance.QualityToysHandler.Sync(); - - foreach (BaseModel based in toys) - { - AdminToy toy = based.AdminToy; - - if (toy is Primitive p) - p.Collidable = false; - toy.AdminToyBase.transform.position = based.LocalPosition + Position; - toy.AdminToyBase.transform.rotation = based.LocalRotation * Rotation; - } - if(spawn) - { - Spawn(); - } - } - - - public void Destroy() - { - foreach (BaseModel primitive in _models) - { - primitive.AdminToy.Destroy(); - } - } - public void UnSpawn() - { - foreach (BaseModel primitive in _models) - { - primitive.AdminToy.UnSpawn(); - } - } - public void Spawn() - { - QualityHandler.Instance.QualityToysHandler.Sync(); - foreach (BaseModel primitive in _models) - { - primitive.AdminToy.Spawn(); - } - - } - - - public bool Equals(Model x) - { - if (x == null) return false; - return x._prefab == _prefab && x.Position == Position && x.Rotation == Rotation; - } - public int GetHashCode(Model obj) - { - return obj.GetHashCode(); - } - } -} diff --git a/KruacentExiled/KE.Utils/Quality/Models/ModelPrefab.cs b/KruacentExiled/KE.Utils/Quality/Models/ModelPrefab.cs deleted file mode 100644 index bbc39da4..00000000 --- a/KruacentExiled/KE.Utils/Quality/Models/ModelPrefab.cs +++ /dev/null @@ -1,42 +0,0 @@ -using Exiled.API.Features; -using Exiled.API.Features.Core; -using Exiled.API.Features.Pickups; -using Exiled.API.Features.Toys; -using Exiled.API.Interfaces; -using KE.Utils.Extensions; -using KE.Utils.Quality.Models.Base; -using KE.Utils.Quality.Structs; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using UnityEngine; -using Light = Exiled.API.Features.Toys.Light; - -namespace KE.Utils.Quality.Models -{ - public abstract class ModelPrefab - { - - protected abstract IEnumerable GetBaseModels(); - - public virtual Model Create(Vector3 position,Quaternion rotation, bool spawn = true) - { - - HashSet clonetoys = new(); - HashSet toys = GetBaseModels().ToHashSet(); - foreach (BaseModel model in toys) - { - BaseModel clone = (BaseModel)model.Clone(); - clonetoys.Add(clone); - } - return new Model(this, position, rotation, clonetoys,spawn); - - } - - - - - } -} diff --git a/KruacentExiled/KE.Utils/Quality/Models/QualityModel.cs b/KruacentExiled/KE.Utils/Quality/Models/QualityModel.cs deleted file mode 100644 index b5cc682f..00000000 --- a/KruacentExiled/KE.Utils/Quality/Models/QualityModel.cs +++ /dev/null @@ -1,40 +0,0 @@ -using Exiled.API.Features; -using Exiled.API.Features.Toys; -using KE.Utils.Extensions; -using KE.Utils.Quality.Enums; -using KE.Utils.Quality.Models.Base; -using System.Collections.Generic; -using System.Linq; -using UnityEngine; - -namespace KE.Utils.Quality.Models -{ - public abstract class QualityModel : ModelPrefab - { - public abstract ModelQuality Quality { get; } - public abstract bool IsPickup { get; } - - - - - public override sealed Model Create(Vector3 position, Quaternion rotation,bool spawn = true) - { - - HashSet clonetoys = new(); - HashSet toys = GetBaseModels().ToHashSet(); - foreach (BaseModel model in toys) - { - BaseModel clone = (BaseModel)model.Clone(); - - if (IsPickup) - clone.AdminToy.SetAsPickupAdminToy(false); - - clone.AdminToy.SetQuality(Quality,false); - clonetoys.Add(clone); - } - QualityHandler.Sync(); - return new Model(this,position, rotation, clonetoys, spawn); - } - - } -} diff --git a/KruacentExiled/KE.Utils/Quality/QualityHandler.cs b/KruacentExiled/KE.Utils/Quality/QualityHandler.cs deleted file mode 100644 index 235d79c9..00000000 --- a/KruacentExiled/KE.Utils/Quality/QualityHandler.cs +++ /dev/null @@ -1,61 +0,0 @@ -using Exiled.API.Features; -using Exiled.API.Features.Core.UserSettings; -using KE.Utils.Quality.Handlers; -using KE.Utils.Quality.Settings; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace KE.Utils.Quality -{ - [Obsolete("scrapped", false)] - internal class QualityHandler - { - public QualitySettings QualitySettings { get; private set; } - public QualityToysHandler QualityToysHandler { get; private set; } - - private static QualityHandler _instance; - public static QualityHandler Instance - { - get - { - if(_instance == null ) - _instance = new QualityHandler(); - return _instance; - } - } - private QualityHandler() - { - QualitySettings = new QualitySettings(Changed); - QualityToysHandler = new QualityToysHandler(); - } - - ~QualityHandler() - { - QualityToysHandler = null; - QualitySettings = null; - } - - public void Changed(Player p, SettingBase _) - { - QualityToysHandler.Sync(p); - } - - public void Register() - { - QualitySettings.Register(); - } - - public void Unregister() - { - QualitySettings.Unregister(); - } - - public static void Sync() - { - Instance.QualityToysHandler.Sync(); - } - } -} diff --git a/KruacentExiled/KE.Utils/Quality/QualityToysHandler.cs b/KruacentExiled/KE.Utils/Quality/QualityToysHandler.cs deleted file mode 100644 index 27320233..00000000 --- a/KruacentExiled/KE.Utils/Quality/QualityToysHandler.cs +++ /dev/null @@ -1,155 +0,0 @@ -using AdminToys; -using Exiled.API.Enums; -using Exiled.API.Extensions; -using Exiled.API.Features; -using Exiled.API.Features.Toys; -using KE.Utils.Quality.Enums; -using KE.Utils.Quality.Settings; -using System.Collections.Generic; -using System.Linq; -using UnityEngine; -using Light = Exiled.API.Features.Toys.Light; -using QualitySettings = KE.Utils.Quality.Settings.QualitySettings; - -namespace KE.Utils.Quality -{ - public class QualityToysHandler - { - private HashSet _pickupToys = new(); - private Dictionary _qualityToys = new(); - public readonly Vector3 Gulag = new Vector3(15000,15000,15000); - - public bool IsPickupToy(AdminToy primitive) - { - return _pickupToys.Contains(primitive); - } - - public bool IsQualityToy(AdminToy primitive) - { - return _qualityToys.ContainsKey(primitive); - } - - - public void SetAsPickup(AdminToy toy) - { - if (!_pickupToys.Add(toy)) - { - Log.Warn($"AdminToy {toy} is already a pickupToy"); - return; - } - } - - public void SetQuality(AdminToy toy,ModelQuality quality) - { - if (toy == null) return; - if (!_qualityToys.ContainsKey(toy)) - _qualityToys.Add(toy,quality); - else - _qualityToys[toy] = quality; - } - - - - private void SendToShadowRealm(AdminToy adminToy, Player player) - { - if(adminToy is Light l) - { - player.SendFakeSyncVar(l.Base.netIdentity, typeof(LightSourceToy), nameof(LightSourceToy.NetworkPosition), Gulag); - return; - } - if(adminToy is Primitive p) - { - player.SendFakeSyncVar(p.Base.netIdentity, typeof(PrimitiveObjectToy), nameof(PrimitiveObjectToy.NetworkPosition), Gulag); - return; - } - } - - private void SetTruePosition(AdminToy adminToy, Player player) - { - if (adminToy is Light l) - { - player.SendFakeSyncVar(l.Base.netIdentity, typeof(LightSourceToy), nameof(LightSourceToy.NetworkPosition), l.Position); - return; - } - if (adminToy is Primitive p) - { - player.SendFakeSyncVar(p.Base.netIdentity, typeof(PrimitiveObjectToy), nameof(PrimitiveObjectToy.NetworkPosition), p.Position); - return; - } - } - - /// - /// Sync every Players - /// - public void Sync() - { - foreach(Player p in Player.List) - { - Sync(p); - } - } - - /// - /// Sync a specified Player - /// - /// - public void Sync(Player p) - { - var quality = QualitySettings.Get(p); - var pickup = QualitySettings.PickmodelActivated(p); - - if (!pickup) - { - //hide pickup toys - foreach (AdminToy pk in _pickupToys) - { - SendToShadowRealm(pk, p); - } - } - else - { - //show pickup toys - foreach (AdminToy pk in _pickupToys) - { - SetTruePosition(pk, p); - } - } - - - - - foreach(var at in _qualityToys) - { - if(at.Value == quality) - { - if (pickup || !_pickupToys.Contains(at.Key)) - { - SetTruePosition(at.Key, p); - } - } - else - { - SendToShadowRealm(at.Key, p); - } - - } - - } - - /// - /// Sync a specified AdminToy - /// - /// - public void Sync(AdminToy adminToy) - { - if (IsPickupToy(adminToy)) - { - - } - if (IsQualityToy(adminToy)) - { - - } - } - } -} diff --git a/KruacentExiled/KE.Utils/Quality/Settings/QualitySettings.cs b/KruacentExiled/KE.Utils/Quality/Settings/QualitySettings.cs deleted file mode 100644 index ca8d49be..00000000 --- a/KruacentExiled/KE.Utils/Quality/Settings/QualitySettings.cs +++ /dev/null @@ -1,62 +0,0 @@ -using Exiled.API.Features; -using Exiled.API.Features.Core.UserSettings; -using KE.Utils.Quality.Enums; -using System; - -namespace KE.Utils.Quality.Settings -{ - public class QualitySettings - { - - private static int _idQuality = 0; - private static int _idModels = 1; - private static int _idSlider = 2; - private SettingBase[] _settings; - public QualitySettings(Action onChanged) - { - HeaderSetting header = new("Quality Settings"); - _settings = - [ - header, - new DropdownSetting(_idQuality,"ModelQuality",["Low","Medium", "High"],onChanged:onChanged), - new TwoButtonsSetting(_idModels,"Pickup models","Disabled","Enabled", onChanged:onChanged) - ]; - } - - public void Register() - { - SettingBase.Register(_settings); - SettingBase.SendToAll(); - } - - public void Unregister() - { - SettingBase.Unregister(settings:_settings); - } - - - - - public static ModelQuality Get(Player p) - { - if (!SettingBase.TryGetSetting(p, _idQuality, out var setting)) return ModelQuality.None; - - return setting.SelectedOption switch - { - "Low" => ModelQuality.Low, - "Medium" => ModelQuality.Medium, - "High" => ModelQuality.High, - _ => ModelQuality.None, - }; - } - - - public static bool PickmodelActivated(Player p) - { - if (!SettingBase.TryGetSetting(p, _idModels, out var setting)) return false; - return setting.IsSecond; - } - - - } -} diff --git a/KruacentExiled/KE.Utils/Quality/Structs/LocalWorldSpace.cs b/KruacentExiled/KE.Utils/Quality/Structs/LocalWorldSpace.cs deleted file mode 100644 index d9c6205b..00000000 --- a/KruacentExiled/KE.Utils/Quality/Structs/LocalWorldSpace.cs +++ /dev/null @@ -1,23 +0,0 @@ -using Exiled.API.Interfaces; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using UnityEngine; - -namespace KE.Utils.Quality.Structs -{ - public readonly struct LocalWorldSpace : IWorldSpace - { - - public Vector3 Position { get; } - public Quaternion Rotation { get; } - - public LocalWorldSpace(Vector3 position, Quaternion rotation) - { - Position = position; - Rotation = rotation; - } - } -} diff --git a/KruacentExiled/KE.Utils/Quality/Tests/Test.cs b/KruacentExiled/KE.Utils/Quality/Tests/Test.cs deleted file mode 100644 index 6ebd3f66..00000000 --- a/KruacentExiled/KE.Utils/Quality/Tests/Test.cs +++ /dev/null @@ -1,108 +0,0 @@ -using Exiled.API.Extensions; -using Exiled.API.Features; -using Exiled.API.Features.Toys; -using KE.Utils.Quality.Models; -using KE.Utils.Quality.Models.Examples; -using MEC; -using PlayerRoles; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using UnityEngine; - -namespace KE.Utils.Quality.Tests -{ - public class Test - { - private QualityHandler QualityHandler; - - - private Test(QualityHandler q) - { - QualityHandler = q; - try - { - TestMine(); - } - catch (Exception ex) - { - Log.Error("Exception for TestMine :\n"+ex); - } - - } - internal void TestQuality() - { - Vector3 pos = RoleTypeId.Scp049.GetRandomSpawnLocation().Position; - Primitive c = Primitive.Create(pos); - c.Color = Color.red; - Primitive c2 = Primitive.Create(pos + Vector3.one); - c2.Color = Color.green; - - - QualityHandler.QualityToysHandler.SetQuality(c, Enums.ModelQuality.Low); - QualityHandler.QualityToysHandler.SetQuality(c2, Enums.ModelQuality.Medium); - } - - internal void StressTest(int count) - { - Timing.RunCoroutine(Stress(count)); - } - - - private IEnumerator Stress(int count) - { - Vector3 pos = RoleTypeId.Scp049.GetRandomSpawnLocation().Position; - Vector3 scale = new Vector3(.1f, .1f, .1f); - float maxSpread = 5; - for (int i = 0; i < count; i++) - { - Primitive c = Primitive.Create(pos + new Vector3(UnityEngine.Random.Range(0f, maxSpread), UnityEngine.Random.Range(0f, maxSpread), UnityEngine.Random.Range(0f, maxSpread)), scale: scale); - QualityHandler.QualityToysHandler.SetQuality(c, Enums.ModelQuality.Medium); - } - QualityHandler.QualityToysHandler.Sync(); - yield return 0; - } - - public void TestMine() - { - Log.Info("TestMine"); - Vector3 pos = RoleTypeId.Scp049.GetRandomSpawnLocation().Position; - MineModelLow mml = new(); - - - Model m = mml.Create(pos, new Quaternion()); - m.Spawn(); - - - MineModelMedium mmm = new(); - - m = mmm.Create(pos + Vector3.up, new Quaternion()); - m.Spawn(); - - - MineModelPickup mmp = new(); - m = mmp.Create(pos + Vector3.right, new Quaternion()); - m.Spawn(); - - QualityHandler.Sync(); - - - - - - - - - foreach (var item in Player.List) - { - item.Teleport(pos); - } - - - - - } - } -} diff --git a/KruacentExiled/KruacentExiled.sln b/KruacentExiled/KruacentExiled.sln index ff68a593..ee17431d 100644 --- a/KruacentExiled/KruacentExiled.sln +++ b/KruacentExiled/KruacentExiled.sln @@ -3,36 +3,16 @@ Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio Version 17 VisualStudioVersion = 17.12.35506.116 MinimumVisualStudioVersion = 10.0.40219.1 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "KE.Items", "KE.Items\KE.Items.csproj", "{2FE04C4D-7FA1-4EC5-A8AF-618EDE0C037C}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "KE.Misc", "KE.Misc\KE.Misc.csproj", "{CD822DB2-756E-4887-93AB-2D2F16BF542C}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "KE.BlackoutNDoor", "KE.BlackoutNDoor\KE.BlackoutNDoor.csproj", "{C9867742-72DB-4ECA-81BF-104A27A04DB7}" -EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "KE.GlobalEventFramework", "KE.GlobalEventFramework\KE.GlobalEventFramework.csproj", "{73D6C740-96DE-4965-898F-DDD5BCBF7366}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "KE.GlobalEventFramework.Examples", "KE.GlobalEventFramework.Examples\KE.GlobalEventFramework.Examples.csproj", "{07B92E87-F48F-4F9F-BA0E-1BCB2AF52F53}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "KE.Utils", "KE.Utils\KE.Utils.csproj", "{D6B3068A-9DD1-4469-9BFE-5771168DFCBD}" -EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU Release|Any CPU = Release|Any CPU EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution - {2FE04C4D-7FA1-4EC5-A8AF-618EDE0C037C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {2FE04C4D-7FA1-4EC5-A8AF-618EDE0C037C}.Debug|Any CPU.Build.0 = Debug|Any CPU - {2FE04C4D-7FA1-4EC5-A8AF-618EDE0C037C}.Release|Any CPU.ActiveCfg = Release|Any CPU - {2FE04C4D-7FA1-4EC5-A8AF-618EDE0C037C}.Release|Any CPU.Build.0 = Release|Any CPU - {CD822DB2-756E-4887-93AB-2D2F16BF542C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {CD822DB2-756E-4887-93AB-2D2F16BF542C}.Debug|Any CPU.Build.0 = Debug|Any CPU - {CD822DB2-756E-4887-93AB-2D2F16BF542C}.Release|Any CPU.ActiveCfg = Release|Any CPU - {CD822DB2-756E-4887-93AB-2D2F16BF542C}.Release|Any CPU.Build.0 = Release|Any CPU - {C9867742-72DB-4ECA-81BF-104A27A04DB7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {C9867742-72DB-4ECA-81BF-104A27A04DB7}.Debug|Any CPU.Build.0 = Debug|Any CPU - {C9867742-72DB-4ECA-81BF-104A27A04DB7}.Release|Any CPU.ActiveCfg = Release|Any CPU - {C9867742-72DB-4ECA-81BF-104A27A04DB7}.Release|Any CPU.Build.0 = Release|Any CPU {73D6C740-96DE-4965-898F-DDD5BCBF7366}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {73D6C740-96DE-4965-898F-DDD5BCBF7366}.Debug|Any CPU.Build.0 = Debug|Any CPU {73D6C740-96DE-4965-898F-DDD5BCBF7366}.Release|Any CPU.ActiveCfg = Release|Any CPU @@ -41,12 +21,11 @@ Global {07B92E87-F48F-4F9F-BA0E-1BCB2AF52F53}.Debug|Any CPU.Build.0 = Debug|Any CPU {07B92E87-F48F-4F9F-BA0E-1BCB2AF52F53}.Release|Any CPU.ActiveCfg = Release|Any CPU {07B92E87-F48F-4F9F-BA0E-1BCB2AF52F53}.Release|Any CPU.Build.0 = Release|Any CPU - {D6B3068A-9DD1-4469-9BFE-5771168DFCBD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {D6B3068A-9DD1-4469-9BFE-5771168DFCBD}.Debug|Any CPU.Build.0 = Debug|Any CPU - {D6B3068A-9DD1-4469-9BFE-5771168DFCBD}.Release|Any CPU.ActiveCfg = Release|Any CPU - {D6B3068A-9DD1-4469-9BFE-5771168DFCBD}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {BA7136A3-3FCA-43C1-825B-9D126AC1D87E} + EndGlobalSection EndGlobal diff --git a/README.md b/README.md index 8b8a26f5..95b795d1 100644 --- a/README.md +++ b/README.md @@ -1,15 +1,45 @@ -# KruacentExiled ---- +

+ GitHub Profile Photo +

-This repo was made for our small (6 players) private SCP:SL server using the Exiled Framework. +

Kruaçent-Exiled

+
-## Global Event Framework +

Kruaçent-Exiled is a plugin using the Exiled Framework for SCP: Secret Laboratory servers. The plugin was initially created for our small (6-player) private SCP:SL servers

-the Global Event Framework (GEF) is made to add Global Events which are tweaks in the gameplay which is revealed at the start of each round. +
+
+

-## Blackout 'N Door -This plugin was made to avoid camping on surface and avoid the sole SCP being stuck. +

project-image

-## Armes (Weapons) -Created new custom weapon will probably renamed it to item when we get item +

shieldsshields

+ +

🧐 Features

+ +Here're some of the project's features: + +* **Global Event Framework** : The Global Event Framework is designed to introduce Global Events which are gameplay modifications revealed at the beginning of each round. You can easily create your own custom Global Events with dozens of examples provided. +* **BlackoutNDoor** : The BlackoutNDoor introduces new door and light systems. The lights randomly turn off/on and the doors can randomly open and close. +* **Custom Items** : The Customs Items add differents new guns and stuff in the game. You can easily create your own Custom Items with dozens of examples provided. +* **Miscellaneous** : The Miscellaneous plugin changes the game settings such as new inputs and outputs for human in 914 explosive D-Class cells the elevators that can move on its own and new announcements for specific players deaths. + +

🛠️ Installation Steps:

+ +

1. Download the DLL you want to use from the latest release.

+ +

2. Go to Exiled/Plugins and place the DLL there.

+ +

3. Restart your SCP:SL server.

+ +

4. The plugin will now be in your server.

+ + +

🛡️ License:

+ +This project is licensed under the Apache License + +
+
+
From 606349bd6c4f0be6c8a6acc853718ca28683fd47 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Sat, 14 Feb 2026 16:49:12 +0100 Subject: [PATCH 629/853] updatez --- KruacentExiled/KE.Misc/KE.Misc.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/KruacentExiled/KE.Misc/KE.Misc.csproj b/KruacentExiled/KE.Misc/KE.Misc.csproj index c0796662..49449a48 100644 --- a/KruacentExiled/KE.Misc/KE.Misc.csproj +++ b/KruacentExiled/KE.Misc/KE.Misc.csproj @@ -6,7 +6,7 @@
- + From ecd7ded462734a27e27e7666b80ba8e08747c2dd Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Sat, 14 Feb 2026 19:50:20 +0100 Subject: [PATCH 630/853] trnasltain --- .../Features/LastHuman/LastHumanHandler.cs | 18 ++++++----- .../LastHuman/LastHumanTranslations.cs | 31 +++++++++++++++++++ KruacentExiled/KE.Misc/MainPlugin.cs | 23 +++++++++----- 3 files changed, 57 insertions(+), 15 deletions(-) create mode 100644 KruacentExiled/KE.Misc/Features/LastHuman/LastHumanTranslations.cs diff --git a/KruacentExiled/KE.Misc/Features/LastHuman/LastHumanHandler.cs b/KruacentExiled/KE.Misc/Features/LastHuman/LastHumanHandler.cs index e7a3f1d2..502fcc8f 100644 --- a/KruacentExiled/KE.Misc/Features/LastHuman/LastHumanHandler.cs +++ b/KruacentExiled/KE.Misc/Features/LastHuman/LastHumanHandler.cs @@ -9,6 +9,7 @@ using KE.Utils.API.Displays.DisplayMeow.Placements; using KE.Utils.API.Features.SCPs; using KE.Utils.API.Interfaces; +using KE.Utils.API.Translations; using KE.Utils.Extensions; using LabApi.Events.Arguments.PlayerEvents; using PlayerRoles; @@ -23,14 +24,16 @@ public class LastHumanHandler : IUsingEvents { + + + public static readonly IReadOnlyCollection TextLast = new HashSet() { - "You feel like everyone is counting on you", - "You feel suddenly very lonely", - "On est que tous les deux vivants ?" + "texthuman1", + "texthuman2", }; - public static readonly string TextSCP = "The last human is at %Zone%"; + public static readonly string TextSCP = "textscp"; @@ -82,16 +85,15 @@ private void OnChangedRole(PlayerChangedRoleEventArgs ev) string msg = string.Empty; if (player == lastTarget) { - msg = TextLast.GetRandomValue(); + msg = MainPlugin.GetTranslation(player,TextLast.GetRandomValue()); } else if(!player.IsDead) { - msg = TextSCP.Replace("%Zone%", lastTarget.Zone.GetName()); + msg = MainPlugin.GetTranslation(player, TextSCP.Replace("%Zone%", lastTarget.Zone.GetName())); } - - + if (!player.IsDead && DateTime.Now > _nextPossibleHint) { diff --git a/KruacentExiled/KE.Misc/Features/LastHuman/LastHumanTranslations.cs b/KruacentExiled/KE.Misc/Features/LastHuman/LastHumanTranslations.cs new file mode 100644 index 00000000..0863f3e7 --- /dev/null +++ b/KruacentExiled/KE.Misc/Features/LastHuman/LastHumanTranslations.cs @@ -0,0 +1,31 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace KE.Misc.Features.LastHuman +{ + public static class LastHumanTranslations + { + + + public static Dictionary> LangToKeyToTranslation = new Dictionary>() + { + ["en"] = new Dictionary() + { + ["texthuman1"] = "You feel like everyone is counting on you", + ["texthuman2"] = "You feel suddenly very lonely", + ["textscp"] = "The last human is at %Zone%", + }, + ["fr"] = new Dictionary() + { + ["texthuman1"] = "Tu a la sensation que tout le monde compte sur toi", + ["texthuman2"] = "Tu te sens soudainement très seul", + ["textscp"] = "Le dernier humain est à %Zone%", + }, + }; + + + } +} diff --git a/KruacentExiled/KE.Misc/MainPlugin.cs b/KruacentExiled/KE.Misc/MainPlugin.cs index 08199f82..25f758f2 100644 --- a/KruacentExiled/KE.Misc/MainPlugin.cs +++ b/KruacentExiled/KE.Misc/MainPlugin.cs @@ -12,12 +12,13 @@ using KE.Misc.Features.VoteStart; using KE.Misc.Features.Spawn; using KE.Misc.Features.LastHuman; +using KE.Utils.API.Settings.GlobalSettings; using KE.Utils.API.Translations; namespace KE.Misc { - public class MainPlugin : Plugin + public class MainPlugin : Plugin, ILocalizable { public override string Author => "Patrique"; public override string Name => "KE.Misc"; @@ -42,6 +43,8 @@ public class MainPlugin : Plugin internal VoteStart vote { get; private set; } + public string LocalizationId => Prefix; + public override void OnEnabled() { Instance = this; @@ -63,9 +66,9 @@ public override void OnEnabled() //SpawnLcz = new(); Respawn.SetTokens(SpawnableFaction.NtfWave, 2); Respawn.SetTokens(SpawnableFaction.ChaosWave, 2); - - TranslationManager.Instance.TryLoad(); - + GlobalSettingsHandler.Instance.TryLoad(); + GlobalSettingsHandler.Instance.SubscribeEvents(); + RegisterTranslations(); harmony.PatchAll(Assembly); ClassDDoor.SubscribeEvents(); @@ -101,7 +104,7 @@ public override void OnDisabled() MiscFeature.UnsubscribeAllEvents(); ClassDDoor.UnsubscribeEvents(); harmony.UnpatchAll(harmony.Id); - + GlobalSettingsHandler.Instance.UnsubscribeEvents(); _914 = null; Candy = null; @@ -147,9 +150,15 @@ private void NoeDeath(CassieQueuingScpTerminationEventArgs ev) Exiled.API.Features.Cassie.MessageTranslated("SCP 69 420 has been contained successfully", "SCP-69420-NOE has been contained suscessfully"); } - + public void RegisterTranslations() + { + TranslationHub.Add(LocalizationId, LastHumanTranslations.LangToKeyToTranslation); + } - + public static string GetTranslation(Player player,string key) + { + return TranslationHub.Get(player, Instance.LocalizationId, key); + } } } From 937bc2ed37a1177cbf8d101c935fe698681624c8 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Sat, 14 Feb 2026 20:58:39 +0100 Subject: [PATCH 631/853] followin gtextoy test --- KruacentExiled/KE.Map/MainPlugin.cs | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/KruacentExiled/KE.Map/MainPlugin.cs b/KruacentExiled/KE.Map/MainPlugin.cs index 01da476e..62e295ca 100644 --- a/KruacentExiled/KE.Map/MainPlugin.cs +++ b/KruacentExiled/KE.Map/MainPlugin.cs @@ -8,6 +8,7 @@ using KE.Map.Heavy; using KE.Map.Heavy.GamblingZone; using KE.Map.Others.BlackoutNDoor.Handlers; +using KE.Utils.API.KETextToy; using MEC; using PlayerRoles; using PlayerRoles.PlayableScps.Scp106; @@ -86,7 +87,7 @@ private void OnRoundStarted() //glass or door w/glass => fake to 106s & 173s & 049-2s & 049s & 096s & ghostly //door w/out glass => fake to 106s & ghostly - + //Primitive prim = Primitive.Create(PrimitiveType.Cube, pos, spawn: false); //prim.Base.gameObject.layer = 14; @@ -101,6 +102,17 @@ private void OnRoundStarted() //Log.Info(Scp106MovementModule.GetSlowdownFromCollider(col, out bool passable) + " passable?" + passable); + FollowingTextToy f1 = new([player], player.Position, Quaternion.identity, Vector3.one); + f1.Toy.TextFormat = "F1 sur un bateau"; + + FollowingTextToy f2 = new([], player.Position, Quaternion.identity, Vector3.one); + f2.Toy.TextFormat = "F2 tombe à l'eau"; + + + + + + } From 40f8440479c1240c133c31813a25116da3e72c5f Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Thu, 19 Feb 2026 11:37:23 +0100 Subject: [PATCH 632/853] scp049c --- .../KE.CustomRoles/API/Features/CustomSCP.cs | 2 +- .../CustomSCPs/SCP049C/SCP049CLevelSystem.cs | 167 ++++++++++++++++++ .../CR/CustomSCPs/SCP049C/SCP049CRole.cs | 94 ++++++++++ .../UnlockableAbilities/UnlockableAbility.cs | 22 +++ .../Settings/DebugSettings/DebugSetting.cs | 44 +++++ .../FollowingTextToyDebugSetting.cs | 110 ++++++++++++ .../DebugSettings/HintCreatorDebugSetting.cs | 137 ++++++++++++++ .../KE.CustomRoles/Settings/SettingHandler.cs | 142 +++------------ 8 files changed, 597 insertions(+), 121 deletions(-) create mode 100644 KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP049C/SCP049CLevelSystem.cs create mode 100644 KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP049C/SCP049CRole.cs create mode 100644 KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP049C/UnlockableAbilities/UnlockableAbility.cs create mode 100644 KruacentExiled/KE.CustomRoles/Settings/DebugSettings/DebugSetting.cs create mode 100644 KruacentExiled/KE.CustomRoles/Settings/DebugSettings/FollowingTextToyDebugSetting.cs create mode 100644 KruacentExiled/KE.CustomRoles/Settings/DebugSettings/HintCreatorDebugSetting.cs diff --git a/KruacentExiled/KE.CustomRoles/API/Features/CustomSCP.cs b/KruacentExiled/KE.CustomRoles/API/Features/CustomSCP.cs index a8580752..a3c2c61f 100644 --- a/KruacentExiled/KE.CustomRoles/API/Features/CustomSCP.cs +++ b/KruacentExiled/KE.CustomRoles/API/Features/CustomSCP.cs @@ -48,7 +48,7 @@ public override void Destroy() protected override void RoleAdded(Player player) { SCPTeam.AddSCP(player.ReferenceHub); - base.AddRole(player); + base.RoleAdded(player); } diff --git a/KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP049C/SCP049CLevelSystem.cs b/KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP049C/SCP049CLevelSystem.cs new file mode 100644 index 00000000..2a47acfc --- /dev/null +++ b/KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP049C/SCP049CLevelSystem.cs @@ -0,0 +1,167 @@ +using Exiled.API.Enums; +using Exiled.API.Features; +using Exiled.Events.EventArgs.Scp049; +using Exiled.Events.Patches.Events.Scp0492; +using JetBrains.Annotations; +using KE.CustomRoles.CR.CustomSCPs.SCP049C.UnlockAbleAbilities; +using KE.Utils.API; +using NorthwoodLib.Pools; +using PlayerRoles.FirstPersonControl; +using PlayerRoles.Ragdolls; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using UnityEngine; + +namespace KE.CustomRoles.CR.CustomSCPs.SCP049C +{ + public class SCP049CLevelSystem : MonoBehaviour + { + private int level; + public int Level + { + get + { + return level; + } + set + { + level = value; + } + } + + private const int killperlevel = 2; + + private int currentkill = 0; + + private ReferenceHub _hub; + + private List CurrentAbilities; + + private static HashSet abilities; + + private static IReadOnlyCollection Abilities + { + get + { + if(abilities == null) + { + abilities = ReflectionHelper.GetObjects().ToHashSet(); + } + return abilities; + } + } + + public void Awake() + { + _hub = ReferenceHub.GetHub(base.gameObject); + CurrentAbilities = new(); + } + public void OnDestroy() + { + foreach(UnlockableAbility ability in CurrentAbilities) + { + ability.Remove(_hub); + } + } + + + + public void AddKill() + { + Log.Debug("add kill"); + currentkill++; + + if(currentkill >= killperlevel) + { + currentkill = 0; + AddLevel(); + } + + } + + public void AddLevel() + { + List ability = ListPool.Shared.Rent(); + + Level++; + + foreach(UnlockableAbility possibleAbility in Abilities) + { + if(possibleAbility.Tier == Level) + { + ability.Add(possibleAbility); + } + } + + + + + //todo choose ability + UnlockableAbility choosen = ability.RandomItem(); + + ListPool.Shared.Return(ability); + + choosen.Grant(_hub); + + } + + + private Collider[] NonAlloc = new Collider[8]; + private Ragdoll ragdoll = null; + + private float cooldown = 0f; + private float objective = 10f; + + internal void Update() + { + if (ragdoll != null) + { + UpdateTime(); + } + else + { + GetNearRagdoll(); + } + + } + + + private void UpdateTime() + { + cooldown += Time.deltaTime; + if (cooldown > objective) + { + ragdoll.Destroy(); + AddKill(); + ragdoll = null; + cooldown = 0; + } + + } + + + private void GetNearRagdoll() + { + int num = Physics.OverlapSphereNonAlloc(_hub.GetPosition(), 5, NonAlloc, (int)LayerMasks.Ragdoll); + + for (int i = 0; i < num; i++) + { + if (NonAlloc[i].TryGetComponent(out var r)) + { + Ragdoll ragdoll = Ragdoll.Get(r); + + if (ragdoll.IsExpired) + { + this.ragdoll = ragdoll; + } + + + } + } + } + + } +} diff --git a/KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP049C/SCP049CRole.cs b/KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP049C/SCP049CRole.cs new file mode 100644 index 00000000..e355f061 --- /dev/null +++ b/KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP049C/SCP049CRole.cs @@ -0,0 +1,94 @@ +using Exiled.API.Features; +using Exiled.API.Features.Roles; +using Exiled.Events.EventArgs.Scp049; +using KE.CustomRoles.API.Features; +using LabApi.Events.Arguments.Scp049Events; +using MapGeneration.Rooms; +using PlayerRoles; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using UnityEngine; + +namespace KE.CustomRoles.CR.CustomSCPs.SCP049C +{ + public class SCP049CRole : CustomSCP + { + public override bool IsSupport => false; + + public override string PublicName { get; set; } = "SCP049-C"; + + public override RoleTypeId Role => RoleTypeId.Scp049; + + public override int MaxHealth { get; set; } = 2500; + public override string Description { get; set; } + public override float SpawnChance { get; set; } = 0; + protected override int SettingId => 10003; + + + + protected override void RoleAdded(Player player) + { + player.ReferenceHub.gameObject.AddComponent(); + + base.RoleAdded(player); + } + + protected override void RoleRemoved(Player player) + { + + if(player.ReferenceHub.gameObject.TryGetComponent(out var lvl)) + { + UnityEngine.Object.Destroy(lvl); + } + + base.RoleRemoved(player); + } + + protected override void SubscribeEvents() + { + Exiled.Events.Handlers.Scp049.FinishingRecall += OnFinishingRecall; + LabApi.Events.Handlers.Scp049Events.UsingDoctorsCall += OnUsingDoctorsCall; + LabApi.Events.Handlers.Scp049Events.UsedDoctorsCall += OnUsedDoctorsCall; + base.SubscribeEvents(); + } + protected override void UnsubscribeEvents() + { + Exiled.Events.Handlers.Scp049.FinishingRecall -= OnFinishingRecall; + LabApi.Events.Handlers.Scp049Events.UsingDoctorsCall -= OnUsingDoctorsCall; + LabApi.Events.Handlers.Scp049Events.UsedDoctorsCall -= OnUsedDoctorsCall; + base.UnsubscribeEvents(); + } + private void OnFinishingRecall(FinishingRecallEventArgs ev) + { + if (!Check(ev.Player)) return; + if (!ev.Player.ReferenceHub.gameObject.TryGetComponent(out var lvl)) return; + ev.IsAllowed = false; + ev.Ragdoll.Destroy(); + + lvl.AddKill(); + } + + private void OnUsingDoctorsCall(Scp049UsingDoctorsCallEventArgs ev) + { + if (!Check(ev.Player)) return; + + ev.Player.HumeShieldRegenRate = 15*2; + ev.Player.HumeShieldRegenCooldown = 10/2; + + } + + private void OnUsedDoctorsCall(Scp049UsedDoctorsCallEventArgs ev) + { + if (!Check(ev.Player)) return; + + ev.Player.HumeShieldRegenRate = 15; + ev.Player.HumeShieldRegenCooldown = 10; + + + } + + } +} diff --git a/KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP049C/UnlockableAbilities/UnlockableAbility.cs b/KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP049C/UnlockableAbilities/UnlockableAbility.cs new file mode 100644 index 00000000..e7b19cf8 --- /dev/null +++ b/KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP049C/UnlockableAbilities/UnlockableAbility.cs @@ -0,0 +1,22 @@ +using KE.CustomRoles.API.Features; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace KE.CustomRoles.CR.CustomSCPs.SCP049C.UnlockAbleAbilities +{ + public abstract class UnlockableAbility + { + + public abstract byte Tier { get; } + + + public abstract void Grant(ReferenceHub hub); + + + public abstract void Remove(ReferenceHub hub); + + } +} diff --git a/KruacentExiled/KE.CustomRoles/Settings/DebugSettings/DebugSetting.cs b/KruacentExiled/KE.CustomRoles/Settings/DebugSettings/DebugSetting.cs new file mode 100644 index 00000000..efae8a42 --- /dev/null +++ b/KruacentExiled/KE.CustomRoles/Settings/DebugSettings/DebugSetting.cs @@ -0,0 +1,44 @@ +using Exiled.API.Features; +using Exiled.API.Features.Core.UserSettings; +using KE.CustomRoles.API.Features; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using UserSettings.ServerSpecific; + +namespace KE.CustomRoles.Settings.DebugSettings +{ + public abstract class DebugSetting + { + + internal static List settings = new(); + + public HeaderSetting Header; + + public DebugSetting() + { + settings.Add(this); + } + + public IReadOnlyCollection Settings { get; private set; } + + + public void Create() + { + Settings = CreateSettings(); + Header = Settings.First(s => s is HeaderSetting) as HeaderSetting; + } + + protected abstract List CreateSettings(); + + public virtual void OnSettingValueReceived(Player player, ServerSpecificSettingBase settingBase) + { + + } + + + + } +} diff --git a/KruacentExiled/KE.CustomRoles/Settings/DebugSettings/FollowingTextToyDebugSetting.cs b/KruacentExiled/KE.CustomRoles/Settings/DebugSettings/FollowingTextToyDebugSetting.cs new file mode 100644 index 00000000..eddb4c5b --- /dev/null +++ b/KruacentExiled/KE.CustomRoles/Settings/DebugSettings/FollowingTextToyDebugSetting.cs @@ -0,0 +1,110 @@ +using Exiled.API.Features; +using Exiled.API.Features.Core.UserSettings; +using HintServiceMeow.Core.Enum; +using HintServiceMeow.Core.Utilities; +using KE.Utils.API.KETextToy; +using System.Collections.Generic; +using UnityEngine; +using UserSettings.ServerSpecific; +using YamlDotNet.Core.Tokens; + +namespace KE.CustomRoles.Settings.DebugSettings +{ + internal class FollowingTextToyDebugSetting : DebugSetting + { + + private int _idTestHintspawn = 190; + private int _idTestHinttext = 191; + private int _idTestHintslidersize = 192; + private int _idTestHintsliderx = 193; + private int _idTestHintslidery = 194; + private int _idTestHintsliderz = 195; + private int _idHeaderTestHint = 196; + private int _idTestHintdestroy = 197; + protected override List CreateSettings() + { + created = true; + return + [ + new HeaderSetting(_idHeaderTestHint,"Follow Text Creator",padding:true), + new SliderSetting(_idTestHintsliderx,"x",0,360,0), + new SliderSetting(_idTestHintslidery,"y",0,360,0), + new SliderSetting(_idTestHintsliderz,"z",0,360,0), + new SliderSetting(_idTestHintslidersize,"size",0,100,5), + SettingBase.Create(new SSPlaintextSetting(_idTestHinttext,"text")), + new ButtonSetting(_idTestHintspawn,"spawn","spawn"), + new ButtonSetting(_idTestHintdestroy,"destroyall","destroyall"), + ]; + } + private bool created = false; + string text = "TEST"; + float size = 10; + + private float x = 0; + private float y = 0; + private float z = 0; + + public override void OnSettingValueReceived(Player player, ServerSpecificSettingBase settingBase) + { + + if (created) + { + CreateTextToy(player, settingBase); + } + } + + private List texttoy = new(); + private void CreateTextToy(Player player, ServerSpecificSettingBase setting) + { + if (SettingBase.TryGetSetting(player, _idTestHinttext, out var textsetting)) + { + text = textsetting.Text; + } + + if (SettingBase.TryGetSetting(player, _idTestHintslidersize, out var slidersize)) + { + size = slidersize.SliderValue; + } + + + if (SettingBase.TryGetSetting(player, _idTestHintsliderx, out var sliderx)) + { + x = sliderx.SliderValue; + } + if (SettingBase.TryGetSetting(player, _idTestHintslidery, out var slidery)) + { + y = slidery.SliderValue; + } + if (SettingBase.TryGetSetting(player, _idTestHintsliderz, out var sliderz)) + { + z = sliderz.SliderValue; + } + + if (SettingBase.TryGetSetting(player, _idTestHintspawn, out var button)) + { + if (setting == button.Base) + { + string fulltext = "" + text + ""; + + Quaternion rotation = Quaternion.Euler(x, y, z); + + FollowingTextToy followtext = new FollowingTextToy(Player.List, player.Position, rotation, Vector3.one * size); + followtext.Toy.TextFormat = fulltext; + texttoy.Add(followtext); + } + } + + if (SettingBase.TryGetSetting(player, _idTestHintdestroy, out var buttondestroy)) + { + if (setting == buttondestroy.Base) + { + foreach(var following in texttoy) + { + following.Destroy(); + } + } + } + + } + } +} diff --git a/KruacentExiled/KE.CustomRoles/Settings/DebugSettings/HintCreatorDebugSetting.cs b/KruacentExiled/KE.CustomRoles/Settings/DebugSettings/HintCreatorDebugSetting.cs new file mode 100644 index 00000000..86b32120 --- /dev/null +++ b/KruacentExiled/KE.CustomRoles/Settings/DebugSettings/HintCreatorDebugSetting.cs @@ -0,0 +1,137 @@ +using Exiled.API.Features; +using Exiled.API.Features.Core.UserSettings; +using HintServiceMeow.Core.Enum; +using HintServiceMeow.Core.Extension; +using HintServiceMeow.Core.Utilities; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using UserSettings.ServerSpecific; + +using Hint = HintServiceMeow.Core.Models.Hints.Hint; + +namespace KE.CustomRoles.Settings.DebugSettings +{ + internal class HintCreatorDebugSetting : DebugSetting + { + private int _idTestHintslidery = 154; + private int _idTestHintsliderx = 155; + private int _idTestHintslidertime = 156; + private int _idTestHintalign = 157; + private int _idTestHintspawn = 158; + private int _idTestHinttext = 159; + private int _idTestHintslidersize = 180; + private int _idHeaderTestHint = 160; + protected override List CreateSettings() + { + string[] options = ["left", "center", "right"]; + created = true; + return new List() + { + new HeaderSetting(_idHeaderTestHint,"Hint creator",padding:true), + new SliderSetting(_idTestHintsliderx,"x",-2000,2000,0), + new SliderSetting(_idTestHintslidery,"y",0,2000,0), + new SliderSetting(_idTestHintslidertime,"time",0,10,5), + new SliderSetting(_idTestHintslidersize,"size",0,100,5), + new DropdownSetting(_idTestHintalign,"alignment",options), + new ButtonSetting(_idTestHintspawn,"spawn","spawn"), + SettingBase.Create(new SSPlaintextSetting(_idTestHinttext,"text")), + }; + + } + + public override void OnSettingValueReceived(Player player, ServerSpecificSettingBase settingBase) + { + if (created) + { + CreateHint(player, settingBase); + } + } + + + private bool created = false; + float xvalue = 0; + float yvalue = 0; + float timevalue = 5; + HintAlignment HintAlignment = HintAlignment.Center; + string text = "TEST"; + float size = 10; + + public void CreateHint(Player player, ServerSpecificSettingBase setting) + { + if (SettingBase.TryGetSetting(player, _idTestHintslidery, out var slidery)) + { + yvalue = slidery.SliderValue; + } + + if (SettingBase.TryGetSetting(player, _idTestHintsliderx, out var sliderx)) + { + xvalue = sliderx.SliderValue; + } + + if (SettingBase.TryGetSetting(player, _idTestHintslidertime, out var slidertime)) + { + timevalue = slidertime.SliderValue; + } + + if (SettingBase.TryGetSetting(player, _idTestHinttext, out var textsetting)) + { + text = textsetting.Text; + } + if (SettingBase.TryGetSetting(player, _idTestHintslidersize, out var slidersize)) + { + size = slidersize.SliderValue; + } + + if (SettingBase.TryGetSetting(player, _idTestHintalign, out var dropdown)) + { + + int selected = dropdown.SelectedIndex; + if (selected == 0) + { + HintAlignment = HintAlignment.Left; + } + if (selected == 1) + { + HintAlignment = HintAlignment.Center; + } + if (selected == 2) + { + HintAlignment = HintAlignment.Right; + } + } + + if (SettingBase.TryGetSetting(player, _idTestHintspawn, out var button)) + { + if (setting == button.Base) + { + PlayerDisplay display = PlayerDisplay.Get(player); + Log.Debug($"creating hint at {xvalue},{yvalue} for {timevalue}"); + string fulltext = "" + text + ""; + + var hint = new Hint() + { + XCoordinate = xvalue, + YCoordinate = yvalue, + Alignment = HintAlignment, + Text = fulltext + }; + display.ClearHint(); + display.AddHint(hint); + hint.HideAfter(timevalue); + + } + + + + } + + + } + + + + } +} diff --git a/KruacentExiled/KE.CustomRoles/Settings/SettingHandler.cs b/KruacentExiled/KE.CustomRoles/Settings/SettingHandler.cs index 560215dd..72e589fa 100644 --- a/KruacentExiled/KE.CustomRoles/Settings/SettingHandler.cs +++ b/KruacentExiled/KE.CustomRoles/Settings/SettingHandler.cs @@ -1,22 +1,16 @@ -using Exiled.API.Extensions; -using Exiled.API.Features; +using Exiled.API.Features; using Exiled.API.Features.Core.UserSettings; -using Exiled.Events.EventArgs.Player; -using HintServiceMeow.Core.Enum; -using HintServiceMeow.Core.Extension; -using HintServiceMeow.Core.Models.Hints; -using HintServiceMeow.Core.Utilities; using KE.CustomRoles.API.Features; +using KE.CustomRoles.Settings.DebugSettings; +using KE.Utils.API; using KE.Utils.API.Interfaces; using KE.Utils.API.Settings; using LabApi.Events.Arguments.PlayerEvents; using System; using System.Collections.Generic; -using System.Configuration; +using System.Linq; using TMPro; using UserSettings.ServerSpecific; -using static UnityEngine.Rendering.RayTracingAccelerationStructure; -using Hint = HintServiceMeow.Core.Models.Hints.Hint; namespace KE.CustomRoles.Settings { @@ -32,14 +26,7 @@ internal class SettingHandler : IUsingEvents private readonly int _idSelect = 151; private readonly int _idArrow = 152; private readonly int _idTimeAbilityDesc = 153; - private int _idTestHintslidery = 154; - private int _idTestHintsliderx = 155; - private int _idTestHintslidertime = 156; - private int _idTestHintalign = 157; - private int _idTestHintspawn = 158; - private int _idTestHinttext = 159; - private int _idTestHintslidersize = 180; - private readonly int _idHeaderTestHint = 160; + @@ -66,29 +53,25 @@ public SettingHandler() new KeybindSetting(_idSelect, "Use selected ability", UnityEngine.KeyCode.None), SettingBase.Create(new SSPlaintextSetting(_idArrow, "Personalize the arrow next to the selected ability", baseArrow, 16, TMP_InputField.ContentType.Standard, string.Empty, 0)) }; + - - string[] options = ["left", "center", "right"]; + if (MainPlugin.Instance.Config.Debug) { - List hintscreator = new() - { - new HeaderSetting(_idHeaderTestHint,"Hint creator",padding:true), - new SliderSetting(_idTestHintsliderx,"x",-2000,2000,0), - new SliderSetting(_idTestHintslidery,"y",0,2000,0), - new SliderSetting(_idTestHintslidertime,"time",0,10,5), - new SliderSetting(_idTestHintslidersize,"size",0,100,5), - new DropdownSetting(_idTestHintalign,"alignment",options), - new ButtonSetting(_idTestHintspawn,"spawn","spawn"), - SettingBase.Create(new SSPlaintextSetting(_idTestHinttext,"text")), - }; - + ReflectionHelper.GetObjects().ToList(); - settings.AddRange(hintscreator); - created = true; + List debugsettings = new(); + foreach (DebugSetting debug in DebugSetting.settings) + { + debug.Create(); + debugsettings.AddRange(debug.Settings); + } + + settings.AddRange(debugsettings); + } @@ -99,88 +82,6 @@ public SettingHandler() } - private bool created = false; - float xvalue = 0; - float yvalue = 0; - float timevalue = 5; - HintAlignment HintAlignment = HintAlignment.Center; - string text = "TEST"; - float size = 10; - - public void CreateHint(Player player, ServerSpecificSettingBase setting) - { - if (SettingBase.TryGetSetting(player, _idTestHintslidery, out var slidery)) - { - yvalue = slidery.SliderValue; - } - - if (SettingBase.TryGetSetting(player, _idTestHintsliderx, out var sliderx)) - { - xvalue = sliderx.SliderValue; - } - - if (SettingBase.TryGetSetting(player, _idTestHintslidertime, out var slidertime)) - { - timevalue = slidertime.SliderValue; - } - - if (SettingBase.TryGetSetting(player, _idTestHinttext, out var textsetting)) - { - text = textsetting.Text; - } - if (SettingBase.TryGetSetting(player, _idTestHintslidersize, out var slidersize)) - { - size = slidersize.SliderValue; - } - - if (SettingBase.TryGetSetting(player, _idTestHintalign, out var dropdown)) - { - - int selected = dropdown.SelectedIndex; - if (selected == 0) - { - HintAlignment = HintAlignment.Left; - } - if (selected == 1) - { - HintAlignment = HintAlignment.Center; - } - if (selected == 2) - { - HintAlignment = HintAlignment.Right; - } - } - - if (SettingBase.TryGetSetting(player, _idTestHintspawn, out var button)) - { - if(setting == button.Base) - { - PlayerDisplay display = PlayerDisplay.Get(player); - Log.Debug($"creating hint at {xvalue},{yvalue} for {timevalue}"); - string fulltext = "" + text + ""; - - var hint = new Hint() - { - XCoordinate = xvalue, - YCoordinate = yvalue, - Alignment = HintAlignment, - Text = fulltext - }; - display.ClearHint(); - display.AddHint(hint); - hint.HideAfter(timevalue); - - } - - - - } - - - } - - - public void SubscribeEvents() { @@ -236,12 +137,13 @@ private void OnSettingValueReceived(Player player, ServerSpecificSettingBase set Log.Debug("select"); KEAbilities.UseSelected(player); } - if (created) + foreach (DebugSetting debug in DebugSetting.settings) { - CreateHint(player, settingBase); + debug.OnSettingValueReceived(player, settingBase); + } - - + + } private Dictionary playerPos = new(); From e08e566f3e819314a5cef51625039ff8bd768923 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Thu, 19 Feb 2026 12:11:44 +0100 Subject: [PATCH 633/853] set an arrow to the positon of setp osition + reduce cooldown airstrike + rename maladroit voleur --- .../KE.CustomRoles/Abilities/Airstrike.cs | 2 +- .../KE.CustomRoles/Abilities/SetPosition.cs | 31 +++++++++++++------ .../{Maladroit.cs => MaladroitVoleur.cs} | 31 ++++++++----------- 3 files changed, 36 insertions(+), 28 deletions(-) rename KruacentExiled/KE.CustomRoles/CR/Human/{Maladroit.cs => MaladroitVoleur.cs} (66%) diff --git a/KruacentExiled/KE.CustomRoles/Abilities/Airstrike.cs b/KruacentExiled/KE.CustomRoles/Abilities/Airstrike.cs index d49e410b..1ba15b37 100644 --- a/KruacentExiled/KE.CustomRoles/Abilities/Airstrike.cs +++ b/KruacentExiled/KE.CustomRoles/Abilities/Airstrike.cs @@ -50,7 +50,7 @@ protected override bool AbilityUsed(Player player) ExplosiveGrenade grenade = (ExplosiveGrenade)Item.Create(ItemType.GrenadeHE,player); grenade.ScpDamageMultiplier = 1; grenade.FuseTime = 10; - Timing.CallDelayed(5, () => + Timing.CallDelayed(1.5f, () => { Projectile gre = grenade.SpawnActive(target + (height - .5f) * Vector3.up); //explode on collision diff --git a/KruacentExiled/KE.CustomRoles/Abilities/SetPosition.cs b/KruacentExiled/KE.CustomRoles/Abilities/SetPosition.cs index a139eaef..c32a4f50 100644 --- a/KruacentExiled/KE.CustomRoles/Abilities/SetPosition.cs +++ b/KruacentExiled/KE.CustomRoles/Abilities/SetPosition.cs @@ -1,6 +1,7 @@ using Exiled.API.Features; using KE.CustomRoles.API.Features; using KE.CustomRoles.API.Interfaces; +using KE.Utils.API.KETextToy; using System.Collections.Generic; using UnityEngine; @@ -15,24 +16,37 @@ public class SetPosition : KEAbilities, ICustomIcon public override float Cooldown { get; } = 5f; private static Dictionary SelectedTarget = new(); + private static Dictionary SelectedTextToys = new(); public Utils.API.GifAnimator.TextImage IconName => MainPlugin.Instance.icons[Name]; protected override bool AbilityUsed(Player player) { - + Vector3 position = player.Position; - if (SelectedTarget.ContainsKey(player)) - { - SelectedTarget[player] = player.Position; - } - else + + SelectedTarget[player] = position; + + + if (SelectedTextToys.ContainsKey(player)) { - SelectedTarget.Add(player, player.Position); + SelectedTextToys[player].Destroy(); } - Log.Info("set position at " +player.Position); + + + SelectedTextToys[player] = new FollowingTextToy([player], position, Quaternion.identity, Vector3.one); + + FollowingTextToy followingTextToy = SelectedTextToys[player]; + + + + followingTextToy.OnlyMoveY = true; + followingTextToy.Toy.TextFormat = "↓"; + + + Log.Debug("set position at " + position); return base.AbilityUsed(player); } @@ -40,7 +54,6 @@ protected override bool AbilityUsed(Player player) public static bool TryGetTarget(Player p, out Vector3 target) { return SelectedTarget.TryGetValue(p, out target); - } diff --git a/KruacentExiled/KE.CustomRoles/CR/Human/Maladroit.cs b/KruacentExiled/KE.CustomRoles/CR/Human/MaladroitVoleur.cs similarity index 66% rename from KruacentExiled/KE.CustomRoles/CR/Human/Maladroit.cs rename to KruacentExiled/KE.CustomRoles/CR/Human/MaladroitVoleur.cs index 8161101b..4ca16590 100644 --- a/KruacentExiled/KE.CustomRoles/CR/Human/Maladroit.cs +++ b/KruacentExiled/KE.CustomRoles/CR/Human/MaladroitVoleur.cs @@ -16,9 +16,8 @@ namespace KE.CustomRoles.CR.Human { - public class Maladroit : GlobalCustomRole, IColor + public class MaladroitVoleur : GlobalCustomRole, IColor { - private static Dictionary _coroutines = new(); public override SideEnum Side { get; set; } = SideEnum.Human; public override string Description { get; set; } = "Fait attention à \"tes\" items !"; @@ -33,34 +32,30 @@ public class Maladroit : GlobalCustomRole, IColor { "Thief" }; - protected override void RoleAdded(Player player) - { - _coroutines.Add(player, Timing.RunCoroutine(ThrowingItem(player))); - } - protected override void RoleRemoved(Player player) + private CoroutineHandle coroutine; + protected override void RoleAdded(Player player) { - if (!_coroutines.ContainsKey(player)) return; - Timing.KillCoroutines(_coroutines[player]); - _coroutines.Remove(player); + Timing.RunCoroutineSingleton(ThrowingItem(), coroutine, SingletonBehavior.Abort); } - private IEnumerator ThrowingItem(Player p) - { - + private IEnumerator ThrowingItem() + { - while (p.IsAlive) + while (true) { yield return Timing.WaitForSeconds(UnityEngine.Random.Range(90f, 120f)); - if(UnityEngine.Random.Range(0f, 100f) > .5f) + foreach(Player player in TrackedPlayers) { - p.DropHeldItem(); + if (UnityEngine.Random.Range(0f, 100f) > .5f) + { + player.DropHeldItem(); + } } - - + } } } From d5a8596f9597fe0ed63cdb6e77e7b749176daa35 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Thu, 19 Feb 2026 12:31:59 +0100 Subject: [PATCH 634/853] fixed translation --- .../KE.Misc/Features/LastHuman/LastHumanHandler.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/KruacentExiled/KE.Misc/Features/LastHuman/LastHumanHandler.cs b/KruacentExiled/KE.Misc/Features/LastHuman/LastHumanHandler.cs index 502fcc8f..692e4766 100644 --- a/KruacentExiled/KE.Misc/Features/LastHuman/LastHumanHandler.cs +++ b/KruacentExiled/KE.Misc/Features/LastHuman/LastHumanHandler.cs @@ -82,6 +82,8 @@ private void OnChangedRole(PlayerChangedRoleEventArgs ev) if (hint is null || hint.Hide) { + string translatedZone = lastTarget.Zone.GetTranslatedName(TranslationHub.GetLang(player)); + string msg = string.Empty; if (player == lastTarget) { @@ -89,7 +91,8 @@ private void OnChangedRole(PlayerChangedRoleEventArgs ev) } else if(!player.IsDead) { - msg = MainPlugin.GetTranslation(player, TextSCP.Replace("%Zone%", lastTarget.Zone.GetName())); + + msg = MainPlugin.GetTranslation(player, TextSCP).Replace("%Zone%", translatedZone); } From 28afe24fc02d99f9ea85dc310677e2724c3340f2 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Thu, 19 Feb 2026 14:08:02 +0100 Subject: [PATCH 635/853] translation for abilities --- .../API/Features/KEAbilities.cs | 86 +++++++++++++++---- .../KE.CustomRoles/Abilities/Airstrike.cs | 24 ++++-- .../KE.CustomRoles/Abilities/Convert.cs | 26 +++++- .../KE.CustomRoles/Abilities/Explode.cs | 21 ++++- .../Abilities/FireAbilities/BlindingFlash.cs | 20 ++++- .../Abilities/FireAbilities/Fireball.cs | 19 +++- .../KE.CustomRoles/Abilities/ForceOpen.cs | 28 ++++-- .../KE.CustomRoles/Abilities/RedMist/EGO.cs | 2 +- .../Abilities/RedMist/ToggleEGO.cs | 24 ++++-- .../KE.CustomRoles/Abilities/SetPosition.cs | 20 ++++- .../KE.CustomRoles/Abilities/SimulateDeath.cs | 18 +++- .../KE.CustomRoles/Abilities/Teleportation.cs | 46 +++++++--- .../KE.CustomRoles/Abilities/Thief.cs | 20 ++++- .../KE.CustomRoles/Abilities/Trade.cs | 27 ++++-- .../Commands/KECR/Lists/Abilities.cs | 5 +- 15 files changed, 308 insertions(+), 78 deletions(-) diff --git a/KruacentExiled/KE.CustomRoles/API/Features/KEAbilities.cs b/KruacentExiled/KE.CustomRoles/API/Features/KEAbilities.cs index 5ba6c9c9..a9c0efc7 100644 --- a/KruacentExiled/KE.CustomRoles/API/Features/KEAbilities.cs +++ b/KruacentExiled/KE.CustomRoles/API/Features/KEAbilities.cs @@ -11,6 +11,7 @@ using KE.Utils.API; using KE.Utils.API.Displays.DisplayMeow; using KE.Utils.API.Displays.DisplayMeow.Placements; +using KE.Utils.API.Translations; using MEC; using PlayerRoles.FirstPersonControl.Thirdperson; using System; @@ -34,8 +35,9 @@ public abstract class KEAbilities #region abstract stuff public abstract string Name { get; } - public abstract string PublicName { get; } - public abstract string Description { get; } + + public string TranslationKeyName => Name+"_"+ AbilityNameKey; + public string TranslationKeyDesc => Name+"_"+ AbilityDescriptionKey; /// /// in seconds @@ -47,20 +49,37 @@ public abstract class KEAbilities private static Dictionary TypeToAbility { get; } = new(); private static Dictionary NameToAbility { get; } = new(); public HashSet Players { get; } = new HashSet(); - public HashSet Selected { get; } = new(); + public IReadOnlyCollection Selected => selected; + private HashSet selected = new(); public static Dictionary> PlayersAbility { get;} = new(); - - + + protected const string AbilityNameKey = "Name"; + protected const string AbilityDescriptionKey = "Desc"; + + public const string AbilityTranslationId = "Ability"; protected KEAbilities() { } + + + private bool activated = false; + private void OneTimeInit() + { + if (activated) return; + TranslationHub.Add(AbilityTranslationId, "en", "AbilityReady", "READY"); + TranslationHub.Add(AbilityTranslationId, "fr", "AbilityReady", "PRÊT"); + + + activated = true; + } + public void Init() { if (NameToAbility.ContainsKey(Name)) @@ -70,11 +89,42 @@ public void Init() return; } + TypeToAbility.Add(GetType(), this); NameToAbility.Add(Name, this); + + OneTimeInit(); InternalSubscribeEvent(); + + var translate = SetTranslation(); + + + TranslationHub.Add(AbilityTranslationId, translate); + } + + + protected abstract Dictionary> SetTranslation(); + + public static string GetTranslation(Player player, string key) + { + return TranslationHub.Get(player, AbilityTranslationId, key); } + + public static void ShowEffectHint(Player player,string translationKey) + { + + string text = GetTranslation(player, translationKey); + + float delay = MainPlugin.SettingHandler.GetTime(player); + DisplayHandler.Instance.AddHint(MainPlugin.CREffect, player, text, delay); + } + + public static void ShowEffectHint(Player player, string text, float delay) + { + delay = MainPlugin.SettingHandler.GetTime(player); + DisplayHandler.Instance.AddHint(MainPlugin.CREffect, player, text, delay); + } public void Destroy() { InternalUnsubcribeEvent(); @@ -132,10 +182,10 @@ public void ShowAbility(Player player) StringBuilder sb = StringBuilderPool.Pool.Get(); sb.Append(""); - sb.Append(PublicName); + sb.Append(GetTranslation(player, TranslationKeyName)); sb.Append(""); sb.AppendLine(); - sb.Append(Description); + sb.Append(GetTranslation(player, TranslationKeyDesc)); @@ -146,7 +196,7 @@ public void ShowAbility(Player player) public void SelectAbility(Player player, bool hide = false) { - if (Selected.Add(player)) + if (selected.Add(player)) { Log.Debug($"player {player.Nickname} selected ability {this}"); foreach (KEAbilities abilities in Registered.Where(a => a != this && a.Players.Contains(player))) @@ -164,7 +214,7 @@ public void SelectAbility(Player player, bool hide = false) public void UnselectAbility(Player player) { Log.Debug($"player {player.Nickname} unselected ability {this}"); - Selected.Remove(player); + selected.Remove(player); } public void RemoveAbility(Player player) @@ -284,7 +334,7 @@ public static void RemoveAllSelect(Player player) foreach(KEAbilities ability in PlayersAbility[player]) { - ability.Selected.Remove(player); + ability.selected.Remove(player); } } @@ -426,18 +476,22 @@ public static bool TryGetSelected(Player player, out KEAbilities ability) #region gui - public const string ReadyText = "[READY]"; protected virtual void Gui(StringBuilder sb,Player player) { - sb.Append(PublicName); + sb.Append(GetTranslation(player,TranslationKeyName)); sb.Append(" "); if (CanUse(player, out var output)) { - sb.Append(ReadyText); + + + + sb.Append("["); + sb.Append(GetTranslation(player, "AbilityReady")); + sb.Append("]"); } else { @@ -568,11 +622,7 @@ public static string UpdateGUI(Player player) } - public static void ShowEffectHint(Player player, string text) - { - float delay = MainPlugin.SettingHandler.GetTime(player); - DisplayHandler.Instance.AddHint(MainPlugin.CREffect, player, text, delay); - } + public static void ShowAbilityHint(Player player, string text) diff --git a/KruacentExiled/KE.CustomRoles/Abilities/Airstrike.cs b/KruacentExiled/KE.CustomRoles/Abilities/Airstrike.cs index 1ba15b37..b5e9cc2a 100644 --- a/KruacentExiled/KE.CustomRoles/Abilities/Airstrike.cs +++ b/KruacentExiled/KE.CustomRoles/Abilities/Airstrike.cs @@ -21,9 +21,23 @@ namespace KE.CustomRoles.Abilities public class Airstrike : KEAbilities, ICustomIcon { public override string Name { get; } = "AirStrike"; - public override string PublicName { get; } = "Airstrike"; - public override string Description { get; } = "Don't overuse it or your co-op will not be happy"; + protected override Dictionary> SetTranslation() + { + return new() + { + ["en"] = new() + { + [TranslationKeyName] = "Airstrike", + [TranslationKeyDesc] = "Don't overuse it or your co-op will not be happy", + }, + ["fr"] = new() + { + [TranslationKeyName] = "Bombardement", + [TranslationKeyDesc] = "Ne l'utilise pas trop sinon ton coop sera pas content", + } + }; + } public override float Cooldown { get; } = 60f; public float height = 1; @@ -32,16 +46,16 @@ public class Airstrike : KEAbilities, ICustomIcon protected override bool AbilityUsed(Player player) { - if(!SetPosition.TryGetTarget(player, out Vector3 target)) + if (!SetPosition.TryGetTarget(player, out Vector3 target)) { - MainPlugin.ShowEffectHint(player, "no target selected"); + ShowEffectHint(player, "TeleportationNoTarget"); return false; } Physics.Linecast(target, target + height * Vector3.up, out RaycastHit hit); if (hit.collider != null) { - Log.Info($"hit something [{hit.collider}]"); + Log.Debug($"hit something [{hit.collider}]"); return false; } diff --git a/KruacentExiled/KE.CustomRoles/Abilities/Convert.cs b/KruacentExiled/KE.CustomRoles/Abilities/Convert.cs index 15755ea3..70779cc4 100644 --- a/KruacentExiled/KE.CustomRoles/Abilities/Convert.cs +++ b/KruacentExiled/KE.CustomRoles/Abilities/Convert.cs @@ -19,9 +19,31 @@ namespace KE.CustomRoles.Abilities public class Convert : KEAbilities, ICustomIcon { public override string Name { get; } = "Convert"; - public override string PublicName { get; } = "Convert"; - public override string Description { get; } = "Convert a zombie to your team"; + protected override Dictionary> SetTranslation() + { + return new() + { + ["en"] = new() + { + [TranslationKeyName] = "Convert", + [TranslationKeyDesc] = "Convert a zombie to your team", + ["ConvertNobody"] = "But nobody's here", + ["ConvertSameTeam"] = "I know you don't like them, but they're in your team", + ["ConvertNonZombie"] = "That ain't a zombie", + ["ConvertSuccess"] = "New friend acquired!", + }, + ["fr"] = new() + { + [TranslationKeyName] = "Convert", + [TranslationKeyDesc] = "Converti un zombie à la bonne foi", + ["ConvertNobody"] = "Mais personne n'est venu", + ["ConvertSameTeam"] = "Je sais que tu l'aimes pas mais il est bien avec toi", + ["ConvertNonZombie"] = "C'est pas un zombie ça", + ["ConvertSuccess"] = "Ami obtenu!", + } + }; + } public override float Cooldown { get; } = 10*60f; diff --git a/KruacentExiled/KE.CustomRoles/Abilities/Explode.cs b/KruacentExiled/KE.CustomRoles/Abilities/Explode.cs index 292b5ac0..8d2431c6 100644 --- a/KruacentExiled/KE.CustomRoles/Abilities/Explode.cs +++ b/KruacentExiled/KE.CustomRoles/Abilities/Explode.cs @@ -17,9 +17,24 @@ namespace KE.CustomRoles.Abilities public class Explode : KEAbilities, ICustomIcon { public override string Name { get; } = "Explode"; - public override string PublicName { get; } = "Explode"; - public override string Description { get; } = "Tu as une ceinture d'explosif autour de toi, fait attention n'appuie pas sur le bouton"; + protected override Dictionary> SetTranslation() + { + return new() + { + ["en"] = new() + { + [TranslationKeyName] = "Explode", + [TranslationKeyDesc] = "You got an explosive belt", + }, + ["fr"] = new() + { + [TranslationKeyName] = "Explosion", + [TranslationKeyDesc] = "Tu as une ceinture d'explosif autour de toi", + } + }; + } + public override float Cooldown { get; } = 4*60f; @@ -60,6 +75,8 @@ private void ExplodeEvent_ExplodeDestructible(Items.API.Events.OnExplodeDestruct obj.Damage = 75; + Log.Debug("explode with "+ obj.Damage); + } } } diff --git a/KruacentExiled/KE.CustomRoles/Abilities/FireAbilities/BlindingFlash.cs b/KruacentExiled/KE.CustomRoles/Abilities/FireAbilities/BlindingFlash.cs index 2be63570..c95c7218 100644 --- a/KruacentExiled/KE.CustomRoles/Abilities/FireAbilities/BlindingFlash.cs +++ b/KruacentExiled/KE.CustomRoles/Abilities/FireAbilities/BlindingFlash.cs @@ -1,16 +1,30 @@ using Exiled.API.Features; using Exiled.API.Features.Items; using Exiled.API.Features.Pickups.Projectiles; +using System.Collections.Generic; namespace KE.CustomRoles.Abilities.FireAbilities { public class BlindingFlash : FireAbilityBase { public override string Name { get; } = "BlindingFlash"; - public override string PublicName { get; } = "Blinding Flash"; - - public override string Description { get; } = "Spawns an active flashbang at your feet"; + protected override Dictionary> SetTranslation() + { + return new() + { + ["en"] = new() + { + [TranslationKeyName] = "Blinding Flash", + [TranslationKeyDesc] = "Spawns an active flashbang at your feet", + }, + ["fr"] = new() + { + [TranslationKeyName] = "Le soleil", + [TranslationKeyDesc] = "IS THAT A MOTHERFUCKER RED FLOOD REFERENCE??????????????", + } + }; + } public override float Cooldown { get; } = 30f; public override int Cost => 50; diff --git a/KruacentExiled/KE.CustomRoles/Abilities/FireAbilities/Fireball.cs b/KruacentExiled/KE.CustomRoles/Abilities/FireAbilities/Fireball.cs index 800bd711..ee5393a1 100644 --- a/KruacentExiled/KE.CustomRoles/Abilities/FireAbilities/Fireball.cs +++ b/KruacentExiled/KE.CustomRoles/Abilities/FireAbilities/Fireball.cs @@ -19,11 +19,24 @@ namespace KE.CustomRoles.Abilities.FireAbilities public class Fireball : FireAbilityBase { public override string Name { get; } = "Fireball"; - public override string PublicName { get; } = "Fireball"; + protected override Dictionary> SetTranslation() + { + return new() + { + ["en"] = new() + { + [TranslationKeyName] = "Fireball", + [TranslationKeyDesc] = "I cast Fireball", + }, + ["fr"] = new() + { + [TranslationKeyName] = "Boule de feur", + [TranslationKeyDesc] = "Attends j'ai fait une faute là non?", + } + }; + } public override int Cost => 10; - public override string Description { get; } = "I cast Fireball"; - public override float Cooldown { get; } = 0f; diff --git a/KruacentExiled/KE.CustomRoles/Abilities/ForceOpen.cs b/KruacentExiled/KE.CustomRoles/Abilities/ForceOpen.cs index ad4231cc..6effe144 100644 --- a/KruacentExiled/KE.CustomRoles/Abilities/ForceOpen.cs +++ b/KruacentExiled/KE.CustomRoles/Abilities/ForceOpen.cs @@ -20,9 +20,24 @@ namespace KE.CustomRoles.Abilities public class ForceOpen : KEAbilities, ICustomIcon { public override string Name { get; } = "ForceOpen"; - public override string PublicName { get; } = "Force open"; - - public override string Description { get; } = "Force open a door"; + protected override Dictionary> SetTranslation() + { + return new() + { + ["en"] = new() + { + [TranslationKeyName] = "Force open", + [TranslationKeyDesc] = "Force open a door", + ["ForceOpenFail"] = "You failed opening the door and lost %HP% HP!", + }, + ["fr"] = new() + { + [TranslationKeyName] = "Forcer une porte", + [TranslationKeyDesc] = "Force une porte (grosse description)", + ["ForceOpenFail"] = "Tu as raté d'ouvrir la porte et a perdu %HP% HP!", + } + }; + } public Utils.API.GifAnimator.TextImage IconName => MainPlugin.Instance.icons["ForceOpen"]; public override float Cooldown { get; } = 30; private Dictionary abilityActivated = new(); @@ -87,13 +102,12 @@ private void InteractingDoor(InteractingDoorEventArgs ev) { ev.IsAllowed = true; } - - - } else { - MainPlugin.ShowEffectHint(player, $"T'as échoué d'ouvrir la porte et t'as perdu {damage} HP !"); + + string text = GetTranslation(player, "ForceOpenFail").Replace("%HP%",damage.ToString()); + ShowEffectHint(player, text,0f); player.Hurt(damage, "Door too stronk"); } diff --git a/KruacentExiled/KE.CustomRoles/Abilities/RedMist/EGO.cs b/KruacentExiled/KE.CustomRoles/Abilities/RedMist/EGO.cs index feafb085..757f8c17 100644 --- a/KruacentExiled/KE.CustomRoles/Abilities/RedMist/EGO.cs +++ b/KruacentExiled/KE.CustomRoles/Abilities/RedMist/EGO.cs @@ -36,7 +36,7 @@ public void Update() { if (Hub is null || !Hub.IsAlive()) { - Log.Info(Hub?.nicknameSync.DisplayName +" is dead"); + Log.Debug(Hub?.nicknameSync.DisplayName +" is dead"); Destroy(gameObject); } diff --git a/KruacentExiled/KE.CustomRoles/Abilities/RedMist/ToggleEGO.cs b/KruacentExiled/KE.CustomRoles/Abilities/RedMist/ToggleEGO.cs index da8e18fe..3d0994a5 100644 --- a/KruacentExiled/KE.CustomRoles/Abilities/RedMist/ToggleEGO.cs +++ b/KruacentExiled/KE.CustomRoles/Abilities/RedMist/ToggleEGO.cs @@ -11,20 +11,28 @@ namespace KE.CustomRoles.Abilities.RedMist public class ToggleEGO : KEAbilities { public override string Name { get; } = "ToggleEGO"; - public override string PublicName { get; } = "Toggle E.G.O."; - - public override string Description { get; } = "Manifest your E.G.O, gain powerful buff but rapid health drain.\nCan be deactivated anytime"; - + protected override Dictionary> SetTranslation() + { + return new() + { + ["en"] = new() + { + [TranslationKeyName] = "Toggle E.G.O.", + [TranslationKeyDesc] = "Manifest your E.G.O, gain powerful buff but rapid health drain.\nCan be deactivated anytime", + }, + ["fr"] = new() + { + [TranslationKeyName] = "todo", + [TranslationKeyDesc] = "todo", + } + }; + } public override float Cooldown { get; } = 0f; protected override bool AbilityUsed(Player player) { - - - - if(!player.GameObject.TryGetComponent(out var ego)) { player.GameObject.AddComponent(); diff --git a/KruacentExiled/KE.CustomRoles/Abilities/SetPosition.cs b/KruacentExiled/KE.CustomRoles/Abilities/SetPosition.cs index c32a4f50..574b6096 100644 --- a/KruacentExiled/KE.CustomRoles/Abilities/SetPosition.cs +++ b/KruacentExiled/KE.CustomRoles/Abilities/SetPosition.cs @@ -10,9 +10,23 @@ namespace KE.CustomRoles.Abilities public class SetPosition : KEAbilities, ICustomIcon { public override string Name { get; } = "SetPosition"; - public override string PublicName { get; } = "Set Position"; - - public override string Description { get; } = "Select the current position for another ability"; + protected override Dictionary> SetTranslation() + { + return new() + { + ["en"] = new() + { + [TranslationKeyName] = "Set Position", + [TranslationKeyDesc] = "Select the current position for another ability", + }, + ["fr"] = new() + { + [TranslationKeyName] = "Selection de position", + [TranslationKeyDesc] = "Selectionne la position pour une autre abilité", + } + }; + } + public override float Cooldown { get; } = 5f; private static Dictionary SelectedTarget = new(); diff --git a/KruacentExiled/KE.CustomRoles/Abilities/SimulateDeath.cs b/KruacentExiled/KE.CustomRoles/Abilities/SimulateDeath.cs index d45e3682..67360949 100644 --- a/KruacentExiled/KE.CustomRoles/Abilities/SimulateDeath.cs +++ b/KruacentExiled/KE.CustomRoles/Abilities/SimulateDeath.cs @@ -14,9 +14,23 @@ namespace KE.CustomRoles.Abilities public class SimulateDeath : KEAbilities, ICustomIcon { public override string Name { get; } = "SimulateDeath"; - public override string PublicName { get; } = "Simulate Death"; - public override string Description { get; } = "T'es talent de mime te permettent de simuler la mort."; + protected override Dictionary> SetTranslation() + { + return new() + { + ["en"] = new() + { + [TranslationKeyName] = "Play dead", + [TranslationKeyDesc] = "Simulate your own death", + }, + ["fr"] = new() + { + [TranslationKeyName] = "Faire le mort", + [TranslationKeyDesc] = "T'es talent de mime te permettent de simuler la mort", + } + }; + } public int Duration = 10; public Utils.API.GifAnimator.TextImage IconName => MainPlugin.Instance.icons[Name]; diff --git a/KruacentExiled/KE.CustomRoles/Abilities/Teleportation.cs b/KruacentExiled/KE.CustomRoles/Abilities/Teleportation.cs index 729d56fd..a76c3916 100644 --- a/KruacentExiled/KE.CustomRoles/Abilities/Teleportation.cs +++ b/KruacentExiled/KE.CustomRoles/Abilities/Teleportation.cs @@ -3,6 +3,7 @@ using KE.CustomRoles.API.Features; using KE.CustomRoles.API.Interfaces; using MapGeneration; +using System.Collections.Generic; using System.Linq; using UnityEngine; @@ -11,11 +12,33 @@ namespace KE.CustomRoles.Abilities public class Teleportation : KEAbilities, ICustomIcon { public override string Name { get; } = "Teleportation"; - public override string PublicName { get; } = "Teleportation"; - public override string Description { get; } = $"Tu perds {Damage} HP/téléportation, ne peux pas être utilisé dans les ascenseurs"; + protected override Dictionary> SetTranslation() + { + return new() + { + ["en"] = new() + { + [TranslationKeyName] = "Teleportation", + [TranslationKeyDesc] = $"You lose {Damage} HP per teleportation, can't be used in lifts", + ["TeleportationNoTarget"] = "No target selected", + ["TeleportationLift"] = "can't teleport in lifts", + ["TeleportationLcz"] = "The target is inaccessible", + ["TeleportationDifferentZone"] = "The target is inaccessible", + }, + ["fr"] = new() + { + [TranslationKeyName] = "Téléportation", + [TranslationKeyDesc] = $"Tu perds {Damage} HP/téléportation, ne peux pas être utilisé dans les ascenseurs", + ["TeleportationNoTarget"] = "Pas de position mise", + ["TeleportationLift"] = "Impossible de se téléporter dans un ascenseur", + ["TeleportationLcz"] = "Position inaccessible", + ["TeleportationDifferentZone"] = "Position inaccessible", + } + }; + } - public Utils.API.GifAnimator.TextImage IconName => MainPlugin.Instance.icons["Teleportation"]; + public Utils.API.GifAnimator.TextImage IconName => MainPlugin.Instance.icons[Name]; public override float Cooldown { get; } = 130f; public static float Damage { get; set; } = 60; @@ -23,8 +46,7 @@ protected override bool AbilityUsed(Player player) { if(!SetPosition.TryGetTarget(player, out Vector3 target)) { - MainPlugin.ShowEffectHint(player, "no target selected"); - + ShowEffectHint(player, "TeleportationNoTarget"); return false; } @@ -32,30 +54,30 @@ protected override bool AbilityUsed(Player player) if(Lift.Get(target) is not null) { - MainPlugin.ShowEffectHint(player, "can't teleport in elevator"); + ShowEffectHint(player, "TeleportationLift"); return false; } if (target.GetZone() == FacilityZone.LightContainment && Map.IsLczDecontaminated) { - MainPlugin.ShowEffectHint(player, "target in LCZ while LCZ is decontaminated."); + ShowEffectHint(player, "TeleportationLcz"); return false; } if (target.GetZone() != player.Zone.GetZone()) { - MainPlugin.ShowEffectHint(player, "target is not in the same zone as you."); + ShowEffectHint(player, "TeleportationDifferentZone"); return false; } - player.Hurt(Damage, "You have drained your health."); + player.Hurt(Damage, Exiled.API.Enums.DamageType.Asphyxiation); - if(UnityEngine.Random.Range(1, 101) < 5) + if(UnityEngine.Random.Range(1f, 100f) < 5) { - if (Player.List.Count() > 1) + if (Player.Enumerable.Count() > 1) { - player.Teleport(Player.List.Where(p => p != player).GetRandomValue()); + player.Teleport(Player.Enumerable.GetRandomValue(p => p != player)); } } else diff --git a/KruacentExiled/KE.CustomRoles/Abilities/Thief.cs b/KruacentExiled/KE.CustomRoles/Abilities/Thief.cs index 91737fa0..555fed82 100644 --- a/KruacentExiled/KE.CustomRoles/Abilities/Thief.cs +++ b/KruacentExiled/KE.CustomRoles/Abilities/Thief.cs @@ -13,14 +13,28 @@ namespace KE.CustomRoles.Abilities public class Thief : KEAbilities, ICustomIcon { public override string Name { get; } = "Thief"; - public override string PublicName { get; } = "Thief"; - public override string Description { get; } = "Avec 1548 heures de jeu sur Thief Simulator fallait s'y attendre un peu."; + protected override Dictionary> SetTranslation() + { + return new() + { + ["en"] = new() + { + [TranslationKeyName] = "Thief", + [TranslationKeyDesc] = "Steal a random item from a player in the same room", + }, + ["fr"] = new() + { + [TranslationKeyName] = "Voler", + [TranslationKeyDesc] = "Vole un object aléatoire à un joueur dans la même pièce", + } + }; + } public override float Cooldown { get; } = 120f; - public TextImage IconName => MainPlugin.Instance.icons["Thief"]; + public TextImage IconName => MainPlugin.Instance.icons[Name]; protected override bool AbilityUsed(Player player) { diff --git a/KruacentExiled/KE.CustomRoles/Abilities/Trade.cs b/KruacentExiled/KE.CustomRoles/Abilities/Trade.cs index acffa489..ae769773 100644 --- a/KruacentExiled/KE.CustomRoles/Abilities/Trade.cs +++ b/KruacentExiled/KE.CustomRoles/Abilities/Trade.cs @@ -15,15 +15,30 @@ namespace KE.CustomRoles.Abilities public class Trade : KEAbilities, ICustomIcon { public override string Name { get; } = "Trade"; - public override string PublicName { get; } = "Trade"; - - public override string Description { get; } = "T'es lien avec le casino t'as permis d'avoir un peu plus de pièce en échange d'un item"; - public Utils.API.GifAnimator.TextImage IconName => MainPlugin.Instance.icons[Name]; public override float Cooldown { get; } = 1f; public static float MaxHealthPercent = .1f; + protected override Dictionary> SetTranslation() + { + return new() + { + ["en"] = new() + { + [TranslationKeyName] = "Trade", + [TranslationKeyDesc] = "Your link with casinos permit your to gain more coins in exchange of items", + ["TradeNoItem"] = "No item?", + }, + ["fr"] = new() + { + [TranslationKeyName] = "Trade", + [TranslationKeyDesc] = "T'es lien avec le casino t'as permis d'avoir un peu plus de pièce en échange d'un objet", + ["TradeNoItem"] = "Pas d'objet", + } + }; + } + protected override bool AbilityUsed(Player player) { if (player.CurrentItem != null) @@ -32,7 +47,9 @@ protected override bool AbilityUsed(Player player) } else { - MainPlugin.ShowEffectHint(player, "no items?"); + + + ShowEffectHint(player, "no items?"); return false; /* float newHealth = player.MaxHealth - player.MaxHealth * MaxHealthPercent; diff --git a/KruacentExiled/KE.CustomRoles/Commands/KECR/Lists/Abilities.cs b/KruacentExiled/KE.CustomRoles/Commands/KECR/Lists/Abilities.cs index c66a2ffd..d70001cd 100644 --- a/KruacentExiled/KE.CustomRoles/Commands/KECR/Lists/Abilities.cs +++ b/KruacentExiled/KE.CustomRoles/Commands/KECR/Lists/Abilities.cs @@ -1,4 +1,5 @@ using CommandSystem; +using Exiled.API.Features; using Exiled.API.Features.Pools; using KE.CustomRoles.API.Features; using System; @@ -24,15 +25,11 @@ public bool Execute(ArraySegment arguments, ICommandSender sender, out s response = "no ability found"; return false; } - StringBuilder sb = StringBuilderPool.Pool.Get(); foreach(KEAbilities ability in KEAbilities.Registered.OrderBy(a => a.Name)) { sb.Append('[') .Append(ability.Name) - .Append(" (") - .Append(ability.Description) - .Append(')') .AppendLine("]"); } From e5273ee3bc6359ecd1f5e882678def62f8051499 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Thu, 19 Feb 2026 14:14:27 +0100 Subject: [PATCH 636/853] fixed a crash when destroying a coin --- .../Features/GamblingCoin/EventHandlers.cs | 24 ++++++++++--------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/KruacentExiled/KE.Misc/Features/GamblingCoin/EventHandlers.cs b/KruacentExiled/KE.Misc/Features/GamblingCoin/EventHandlers.cs index 322644d4..23671962 100644 --- a/KruacentExiled/KE.Misc/Features/GamblingCoin/EventHandlers.cs +++ b/KruacentExiled/KE.Misc/Features/GamblingCoin/EventHandlers.cs @@ -41,20 +41,19 @@ public void OnCoinFlip(FlippingCoinEventArgs ev) } _cooldowns[player.UserId] = DateTime.UtcNow; + ushort itemSerial = player.CurrentItem.Serial; - if (!CoinUses.ContainsKey(player.CurrentItem.Serial)) + if (!CoinUses.ContainsKey(itemSerial)) { - CoinUses[player.CurrentItem.Serial] = UnityEngine.Random.Range(Config.GamblingCoinMinUse, Config.GamblingCoinMaxUse); + CoinUses[itemSerial] = UnityEngine.Random.Range(Config.GamblingCoinMinUse, Config.GamblingCoinMaxUse); - Log.Debug($"Registered new coin: {CoinUses[player.CurrentItem.Serial]} uses left."); + Log.Debug($"Registered new coin: {CoinUses[itemSerial]} uses left."); } - CoinUses[player.CurrentItem.Serial]--; + CoinUses[itemSerial]--; - int remainingUses = CoinUses[player.CurrentItem.Serial]; - bool shouldBreak = remainingUses <= 0; EffectType type = ev.IsTails ? EffectType.Negative : EffectType.Positive; @@ -75,18 +74,21 @@ public void OnCoinFlip(FlippingCoinEventArgs ev) PlayerUtils.SendBroadcast(player, effect.Message); } + int remainingUses = CoinUses[itemSerial]; + bool shouldBreak = remainingUses <= 0; if (shouldBreak) { - CoinUses.Remove(ev.Player.CurrentItem.Serial); - ev.Player.RemoveHeldItem(); - ev.Player.Broadcast(5, "no more coin"); + CoinUses.Remove(itemSerial); + player.RemoveHeldItem(); + player.Broadcast(5, "no more coin"); item = null; } - GambledEventArgs ev2 = new(ev.Player, item, effect, remainingUses, shouldBreak); + GambledEventArgs ev2 = new(player, item, effect, remainingUses, shouldBreak); Events.Handlers.GamblingCoins.OnGambled(ev2); - CoinUses[ev.Player.CurrentItem.Serial] = ev2.RemainingUses; + CoinUses[itemSerial] = ev2.RemainingUses; } + } } \ No newline at end of file From 72701d06cb129eb1871b7538e03816f15ae30ec5 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Sun, 22 Feb 2026 07:37:29 +0100 Subject: [PATCH 637/853] translation --- .../KE.CustomRoles/API/Features/CustomSCP.cs | 2 +- .../API/Features/GlobalCustomRole.cs | 4 +- .../API/Features/KECustomRole.cs | 83 +++++++++++++--- .../API/Interfaces/IEffectImmunity.cs | 2 +- .../CR/ChaosInsurgency/LeRusse.cs | 21 +++- .../CR/ChaosInsurgency/Negotiator.cs | 24 +++-- .../KE.CustomRoles/CR/ClassD/DBoyInShape.cs | 20 +++- .../KE.CustomRoles/CR/ClassD/Enfant.cs | 22 ++++- .../KE.CustomRoles/CR/ClassD/Mime.cs | 20 +++- .../KE.CustomRoles/CR/CustomSCPs/SCP035.cs | 40 ++++++-- .../CR/CustomSCPs/SCP049C/SCP049CRole.cs | 19 +++- .../KE.CustomRoles/CR/CustomSCPs/SCP457.cs | 19 +++- .../KE.CustomRoles/CR/Guard/ChiefGuard.cs | 19 +++- .../KE.CustomRoles/CR/Guard/Guard914.cs | 20 +++- .../KE.CustomRoles/CR/Guard/Introvert.cs | 19 +++- .../KE.CustomRoles/CR/Human/Alzheimer.cs | 56 ++++++----- .../KE.CustomRoles/CR/Human/Asthmatique.cs | 20 +++- .../KE.CustomRoles/CR/Human/Crazy.cs | 21 +++- .../KE.CustomRoles/CR/Human/Diabetique.cs | 20 +++- .../KE.CustomRoles/CR/Human/Enderman.cs | 18 +++- .../CR/Human/MaladroitVoleur.cs | 18 +++- .../KE.CustomRoles/CR/Human/Pacifist.cs | 18 +++- KruacentExiled/KE.CustomRoles/CR/MTF/Pilot.cs | 18 +++- KruacentExiled/KE.CustomRoles/CR/MTF/Tank.cs | 32 +++++-- .../CR/MTF/{ => Terroriste}/Terroriste.cs | 44 +++++++-- .../CR/MTF/Terroriste/TerroristeLight.cs | 95 +++++++++++++++++++ KruacentExiled/KE.CustomRoles/CR/SCP/Paper.cs | 19 +++- .../KE.CustomRoles/CR/SCP/SCP173/Frozen.cs | 18 +++- .../KE.CustomRoles/CR/SCP/SCP939/Ultra.cs | 19 +++- KruacentExiled/KE.CustomRoles/CR/SCP/Small.cs | 19 +++- .../CR/Scientist/GambleAddict.cs | 18 +++- .../CR/Scientist/ZoneManager.cs | 18 +++- .../KE.CustomRoles/CR/Scientist/scp202.cs | 25 ++++- .../KE.CustomRoles/Settings/SettingHandler.cs | 21 +++- 34 files changed, 714 insertions(+), 137 deletions(-) rename KruacentExiled/KE.CustomRoles/CR/MTF/{ => Terroriste}/Terroriste.cs (51%) create mode 100644 KruacentExiled/KE.CustomRoles/CR/MTF/Terroriste/TerroristeLight.cs diff --git a/KruacentExiled/KE.CustomRoles/API/Features/CustomSCP.cs b/KruacentExiled/KE.CustomRoles/API/Features/CustomSCP.cs index a3c2c61f..9b437b0d 100644 --- a/KruacentExiled/KE.CustomRoles/API/Features/CustomSCP.cs +++ b/KruacentExiled/KE.CustomRoles/API/Features/CustomSCP.cs @@ -33,7 +33,7 @@ public override void Init() SettingBase.Register([header]); } - sliderSetting= new SliderSetting(SettingId, PublicName, MinValue, MaxValue, DefaultValue, true); + sliderSetting= new SliderSetting(SettingId, GetTranslation("en", TranslationKeyName), MinValue, MaxValue, DefaultValue, true); SettingBase.Register([sliderSetting]); base.Init(); } diff --git a/KruacentExiled/KE.CustomRoles/API/Features/GlobalCustomRole.cs b/KruacentExiled/KE.CustomRoles/API/Features/GlobalCustomRole.cs index 38439e50..fce1b616 100644 --- a/KruacentExiled/KE.CustomRoles/API/Features/GlobalCustomRole.cs +++ b/KruacentExiled/KE.CustomRoles/API/Features/GlobalCustomRole.cs @@ -75,7 +75,7 @@ protected override void ShowMessage(Player player) } - sb.Append(PublicName); + sb.Append(GetTranslation(player,TranslationKeyName)); if (color != null) { @@ -92,7 +92,7 @@ protected override void ShowMessage(Player player) if (MainPlugin.SettingHandler.GetDescriptionsSettings(player)) { - sb.AppendLine(Description); + sb.AppendLine(GetTranslation(player, TranslationKeyDesc)); } diff --git a/KruacentExiled/KE.CustomRoles/API/Features/KECustomRole.cs b/KruacentExiled/KE.CustomRoles/API/Features/KECustomRole.cs index 1e1fc1c2..3670c96b 100644 --- a/KruacentExiled/KE.CustomRoles/API/Features/KECustomRole.cs +++ b/KruacentExiled/KE.CustomRoles/API/Features/KECustomRole.cs @@ -17,6 +17,7 @@ using KE.CustomRoles.Events.EventArgs; using KE.Utils.API.Displays.DisplayMeow; using KE.Utils.API.Displays.DisplayMeow.Placements; +using KE.Utils.API.Translations; using MEC; using PlayerRoles; using System; @@ -48,13 +49,11 @@ public override string Name public virtual string InternalName => GetType().Name; + public sealed override string Description { get; set; } = string.Empty; + public static new HashSet Registered { get; } = new(); public sealed override string CustomInfo { get; set; } - /// - /// Get or set the public name shown to other players - /// - public abstract string PublicName { get; set; } /// /// the max number of people who can have this role in a round @@ -76,6 +75,9 @@ public static void ResetNumberOfSpawn() } + protected abstract Dictionary> SetTranslation(); + + public abstract override RoleTypeId Role { get; } @@ -100,7 +102,7 @@ protected override void ShowMessage(Player player) sb.Append(">"); } - sb.Append(PublicName); + sb.Append(GetTranslation(player,TranslationKeyName)); if (color != null) { @@ -110,7 +112,7 @@ protected override void ShowMessage(Player player) if (MainPlugin.SettingHandler.GetDescriptionsSettings(player)) { - sb.AppendLine(Description); + sb.AppendLine(GetTranslation(player, TranslationKeyDesc)); } @@ -120,19 +122,56 @@ protected override void ShowMessage(Player player) StringBuilderPool.Pool.Return(sb); } + public void Show(Player player) + { + ShowMessage(player); + } + private static Dictionary typeLookupTable = new(); private static Dictionary stringLookupTable = new(); + protected const string CustomRoleNameKey = "Name"; + protected const string CustomRoleDescriptionKey = "Desc"; + public string TranslationKeyName => Name + "_" + CustomRoleNameKey; + public string TranslationKeyDesc => Name + "_" + CustomRoleDescriptionKey; + + public const string CustomRoleTranslationId = "CustomRole"; public override void Init() { typeLookupTable.Add(GetType(), this); stringLookupTable.Add(Name, this); + OneTimeInit(); InternalSubscribeEvents(); SubscribeEvents(); + + var translate = SetTranslation(); + + + TranslationHub.Add(CustomRoleTranslationId, translate); + Log.Debug("adding keys to "+Name); } + private bool activated = false; + private void OneTimeInit() + { + if (activated) return; + TranslationHub.Add(CustomRoleTranslationId, "en", "CustomRoleGUI", "Current Role"); + TranslationHub.Add(CustomRoleTranslationId, "fr", "CustomRoleGUI", "Role"); + + + activated = true; + } + public static string GetTranslation(Player player, string key) + { + return TranslationHub.Get(player, CustomRoleTranslationId, key); + } + public static string GetTranslation(string lang, string key) + { + return TranslationHub.Get(lang, CustomRoleTranslationId, key); + } + public override void Destroy() { typeLookupTable.Remove(GetType()); @@ -194,12 +233,12 @@ private void OnReceivingEffect(ReceivingEffectEventArgs ev) IEffectImmunity effectImmunity = this as IEffectImmunity; - if (effectImmunity.Effects is null || effectImmunity.Effects.Count == 0) + if (effectImmunity.ImmuneEffects is null || effectImmunity.ImmuneEffects.Count == 0) { Log.Warn("no healable item found for" + Name); return; } - if (effectImmunity.Effects.Contains(ev.Effect.GetEffectType())) + if (effectImmunity.ImmuneEffects.Contains(ev.Effect.GetEffectType())) { ev.IsAllowed = false; } @@ -235,15 +274,17 @@ public static string CurrentRole(Player player) { StringBuilder sb = StringBuilderPool.Pool.Get(); - if (HasCustomRole(player)) { - sb.AppendLine("Current Role : "); + KECustomRole kECustomRole = Get(player).First(); + + sb.Append(GetTranslation(player, "CustomRoleGUI")); + sb.AppendLine(" : "); sb.AppendLine(); sb.Append(""); - sb.Append(Get(player).FirstOrDefault()?.PublicName); + sb.Append(GetTranslation(player,kECustomRole.TranslationKeyName)); sb.Append(""); } else if (player.IsDead) @@ -258,12 +299,13 @@ public static string CurrentRole(Player player) if(customRole != null) { - sb.AppendLine("Current Role : "); + sb.Append(GetTranslation(player, "CustomRoleGUI")); + sb.AppendLine(" : "); sb.AppendLine(); sb.Append(""); - sb.Append(customRole.PublicName); + sb.Append(GetTranslation(player,customRole.TranslationKeyName)); sb.Append(""); } } @@ -309,6 +351,7 @@ protected void ShowEffectHint(Player player, string text, float delay) + #region addrole public override void AddRole(Player player) { @@ -328,7 +371,13 @@ public override void AddRole(Player player) return; } + foreach(KECustomRole cr in Get(player)) + { + cr.RemoveRole(player); + } + + CurrentNumberOfSpawn++; @@ -456,10 +505,14 @@ protected virtual void SetSpawn(Player player) protected virtual void SetCustomInfo(Player player) { + //MirrorExtensions.SetPlayerInfoForTargetOnly() + + string name = GetTranslation("en", TranslationKeyName); + player.CustomInfo = player.CustomName; - if (!string.IsNullOrEmpty(PublicName)) + if (!string.IsNullOrEmpty(name)) { - player.CustomInfo += "\n" + PublicName; + player.CustomInfo += "\n" + name; } player.InfoArea &= ~(PlayerInfoArea.Nickname | PlayerInfoArea.Role); } diff --git a/KruacentExiled/KE.CustomRoles/API/Interfaces/IEffectImmunity.cs b/KruacentExiled/KE.CustomRoles/API/Interfaces/IEffectImmunity.cs index 53da99c6..58786df8 100644 --- a/KruacentExiled/KE.CustomRoles/API/Interfaces/IEffectImmunity.cs +++ b/KruacentExiled/KE.CustomRoles/API/Interfaces/IEffectImmunity.cs @@ -10,6 +10,6 @@ namespace KE.CustomRoles.API.Interfaces public interface IEffectImmunity { - public abstract HashSet Effects { get; } + public abstract HashSet ImmuneEffects { get; } } } diff --git a/KruacentExiled/KE.CustomRoles/CR/ChaosInsurgency/LeRusse.cs b/KruacentExiled/KE.CustomRoles/CR/ChaosInsurgency/LeRusse.cs index 3a04829f..8d37b8ea 100644 --- a/KruacentExiled/KE.CustomRoles/CR/ChaosInsurgency/LeRusse.cs +++ b/KruacentExiled/KE.CustomRoles/CR/ChaosInsurgency/LeRusse.cs @@ -19,9 +19,23 @@ namespace KE.CustomRoles.CR.ChaosInsurgency { public class Russe : KECustomRole { - public override string PublicName { get; set; } = "Le Russe"; - public override string Description { get; set; } = "RUSH B or A, i dont rember sooo good luck"; - public override string InternalName => "Russe"; + protected override Dictionary> SetTranslation() + { + return new() + { + ["en"] = new() + { + [TranslationKeyName] = "Russian", + [TranslationKeyDesc] = "RUSH B or A, i dont rember sooo good luck", + }, + ["fr"] = new() + { + [TranslationKeyName] = "Russe", + [TranslationKeyDesc] = "RUSH B or A, i dont rember sooo good luck", + } + }; + } + public override int MaxHealth { get; set; } = 100; public override RoleTypeId Role { get; set; } = RoleTypeId.ChaosRifleman; @@ -226,5 +240,6 @@ private void DestroySpeaker(Player p) _speakers.Remove(p); } } + } } \ No newline at end of file diff --git a/KruacentExiled/KE.CustomRoles/CR/ChaosInsurgency/Negotiator.cs b/KruacentExiled/KE.CustomRoles/CR/ChaosInsurgency/Negotiator.cs index d04efb1f..ffab2655 100644 --- a/KruacentExiled/KE.CustomRoles/CR/ChaosInsurgency/Negotiator.cs +++ b/KruacentExiled/KE.CustomRoles/CR/ChaosInsurgency/Negotiator.cs @@ -14,9 +14,22 @@ namespace KE.CustomRoles.CR.ChaosInsurgency { public class Negotiator : KECustomRole { - public override string Description { get; set; } = "You're immune to friendly fire and you can convert zombie into your team, isn't that nice?"; - public override string InternalName => PublicName; - public override string PublicName { get; set; } = "Negotiator"; + protected override Dictionary> SetTranslation() + { + return new() + { + ["en"] = new() + { + [TranslationKeyName] = "Negotiator", + [TranslationKeyDesc] = "You're immune to friendly fire and you can convert zombie into your team, isn't that nice?", + }, + ["fr"] = new() + { + [TranslationKeyName] = "Negociateur", + [TranslationKeyDesc] = "RUSH B or A, i dont rember sooo good luck", + } + }; + } public override int MaxHealth { get; set; } = 100; public override RoleTypeId Role { get; set; } = RoleTypeId.ChaosRifleman; public override bool KeepRoleOnDeath { get; set; } = false; @@ -24,11 +37,6 @@ public class Negotiator : KECustomRole public override float SpawnChance { get; set; } = 100; - public override HashSet Abilities { get; } = new() - { - - }; - public override List Inventory { get; set; } = new() { diff --git a/KruacentExiled/KE.CustomRoles/CR/ClassD/DBoyInShape.cs b/KruacentExiled/KE.CustomRoles/CR/ClassD/DBoyInShape.cs index a8fb99d2..5224dfd6 100644 --- a/KruacentExiled/KE.CustomRoles/CR/ClassD/DBoyInShape.cs +++ b/KruacentExiled/KE.CustomRoles/CR/ClassD/DBoyInShape.cs @@ -20,9 +20,23 @@ namespace KE.CustomRoles.CR.ClassD { public class DBoyInShape : KECustomRole { - public override string Description { get; set; } = "Dammmmnnnnnnn les gates"; - public override string PublicName { get; set; } = "DBoyInShape"; - public override string InternalName => "DBoyInShape"; + protected override Dictionary> SetTranslation() + { + return new() + { + ["en"] = new() + { + [TranslationKeyName] = "DBoyInShape", + [TranslationKeyDesc] = "You're strong enough to open any door", + }, + ["fr"] = new() + { + [TranslationKeyName] = "DBoyInShape", + [TranslationKeyDesc] = "Dammmmnnnnnnn les gates", + } + }; + } + public override RoleTypeId Role { get; set; } = RoleTypeId.ClassD; public override bool KeepRoleOnDeath { get; set; } = false; public override bool KeepRoleOnChangingRole { get; set; } = true; diff --git a/KruacentExiled/KE.CustomRoles/CR/ClassD/Enfant.cs b/KruacentExiled/KE.CustomRoles/CR/ClassD/Enfant.cs index 2377a077..ba0c5ba1 100644 --- a/KruacentExiled/KE.CustomRoles/CR/ClassD/Enfant.cs +++ b/KruacentExiled/KE.CustomRoles/CR/ClassD/Enfant.cs @@ -13,8 +13,24 @@ namespace KE.CustomRoles.CR.ClassD { public class Enfant : KECustomRole, IColor { - public override string Description { get; set; } = "do not the kid \ntu commences avec un bonbon arc-en-ciel (pour de vrai cette fois) \n t'es un peu plus petit que la normal"; - public override string PublicName { get; set; } = "Enfant"; + protected override Dictionary> SetTranslation() + { + return new() + { + ["en"] = new() + { + [TranslationKeyName] = "Kid", + [TranslationKeyDesc] = "do not the kid \nyou start with a rainbow candy (for real this time) \nyou're a bit smaller", + }, + ["fr"] = new() + { + [TranslationKeyName] = "Enfant", + [TranslationKeyDesc] = "do not the kid \ntu commences avec un bonbon arc-en-ciel (pour de vrai cette fois) \n t'es un peu plus petit que la normal", + } + }; + } + + public override int MaxHealth { get; set; } = 100; public override RoleTypeId Role { get; set; } = RoleTypeId.ClassD; public override bool KeepRoleOnDeath { get; set; } = false; @@ -30,8 +46,6 @@ protected override void GiveInventory(Player player) player.ReferenceHub.GrantCandy(CandyKindID.Rainbow, InventorySystem.Items.ItemAddReason.StartingItem); base.GiveInventory(player); } - - public override string InternalName => PublicName; } } diff --git a/KruacentExiled/KE.CustomRoles/CR/ClassD/Mime.cs b/KruacentExiled/KE.CustomRoles/CR/ClassD/Mime.cs index 41306de2..8c295cbb 100644 --- a/KruacentExiled/KE.CustomRoles/CR/ClassD/Mime.cs +++ b/KruacentExiled/KE.CustomRoles/CR/ClassD/Mime.cs @@ -14,9 +14,23 @@ namespace KE.CustomRoles.CR.ClassD { public class Mime : KECustomRole, IColor { - public override string Description { get; set; } = "Tu ne peux pas parler\nmais tu fais très peu de bruit quand tu marches\net t'es tout plat"; - public override string PublicName { get; set; } = "Mime"; - public override string InternalName => PublicName; + protected override Dictionary> SetTranslation() + { + return new() + { + ["en"] = new() + { + [TranslationKeyName] = "Mime", + [TranslationKeyDesc] = "you make almost no sound while walking \nand you're flat", + }, + ["fr"] = new() + { + [TranslationKeyName] = "Mime", + [TranslationKeyDesc] = "tu fais très peu de bruit quand tu marches\net t'es tout plat", + } + }; + } + public override int MaxHealth { get; set; } = 100; public override RoleTypeId Role { get; set; } = RoleTypeId.ClassD; public override bool KeepRoleOnDeath { get; set; } = false; diff --git a/KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP035.cs b/KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP035.cs index 5906fd39..07953e49 100644 --- a/KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP035.cs +++ b/KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP035.cs @@ -26,10 +26,28 @@ namespace KE.CustomRoles.CR.CustomSCPs public class SCP035 : CustomSCP { public override bool IsSupport => false; + protected override Dictionary> SetTranslation() + { + return new() + { + ["en"] = new() + { + [TranslationKeyName] = "SCP-035", + [TranslationKeyDesc] = "Kill every humans!\nYou can't pick up the Micro-HID and anything made with it, but you take 3 time less damage by these weapon.", + ["SCP035CantPickup"] = "A strange force called 'game balance' \nprevents you from picking up this item.", + ["SCP035CantUse"] = "A strange force called 'game balance' \nprevents you from using this item.", + }, + ["fr"] = new() + { + [TranslationKeyName] = "SCP-035", + [TranslationKeyDesc] = "Tue tous les humains!\nTu peux pas prendre d'arme spécial mais tu prends 3 fois moins de dégât de ces armes", + ["SCP035CantPickup"] = "Une force étrange qui s'appelle 'équilibre' \nt'empêches de prendre cet objet.", + ["SCP035CantUse"] = "Une force étrange qui s'appelle 'équilibre' \nt'empêches d'utiliser cet objet.", + } + }; + } - public override string PublicName { get; set; } = "SCP-035"; public override int MaxHealth { get; set; } = 1200; - public override string Description { get; set; } = "You can't pickup the Micro-HID and anything made with it, but you take 3 time less damage by these weapon.\nKill every humans"; protected override int SettingId => 10002; public override RoleTypeId Role { get; set; } = RoleTypeId.Tutorial; @@ -124,16 +142,18 @@ private string GetPlayers(AutoContentUpdateArg arg) - public static readonly string CantPickup = "A strange force called \'game balance\' \nprevents you from picking up this item"; - public static readonly string CantUse = "A strange force called \'game balance\' \nprevents you from using this item"; + private void OnUsingItem(UsingItemEventArgs ev) { - if (!Check(ev.Player)) return; + Player player = ev.Player; + if (!Check(player)) return; if (BlacklistedUsing.Contains(ev.Item.Type)) { - ShowEffectHint(ev.Player, CantUse); + + + ShowEffectHint(player, GetTranslation(player, "SCP035CantUse")); ev.IsAllowed = false; return; } @@ -156,7 +176,7 @@ private void OnSearchingPickup(SearchingPickupEventArgs ev) { if(item.Id == 1050 || item.Id == 1047) { - ShowEffectHint(player, CantPickup); + ShowEffectHint(player, GetTranslation(player, "SCP035CantPickup")); ev.IsAllowed = false; return; } @@ -165,14 +185,14 @@ private void OnSearchingPickup(SearchingPickupEventArgs ev) if (pickup.Type.IsScp() && !WhitelistUsing.Contains(pickup.Type)) { - ShowEffectHint(player, CantPickup); + ShowEffectHint(player, GetTranslation(player, "SCP035CantPickup")); ev.IsAllowed = false; return; } if (pickup.Type == ItemType.GunSCP127) { - ShowEffectHint(player, CantPickup); + ShowEffectHint(player, GetTranslation(player, "SCP035CantPickup")); ev.IsAllowed = false; return; } @@ -183,7 +203,7 @@ private void OnSearchingPickup(SearchingPickupEventArgs ev) if (BlacklistedPickup.Contains(pickup.Type)) { - ShowEffectHint(player, CantPickup); + ShowEffectHint(player, GetTranslation(player, "SCP035CantPickup")); ev.IsAllowed = false; return; diff --git a/KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP049C/SCP049CRole.cs b/KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP049C/SCP049CRole.cs index e355f061..355c7a7a 100644 --- a/KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP049C/SCP049CRole.cs +++ b/KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP049C/SCP049CRole.cs @@ -17,13 +17,26 @@ namespace KE.CustomRoles.CR.CustomSCPs.SCP049C public class SCP049CRole : CustomSCP { public override bool IsSupport => false; - - public override string PublicName { get; set; } = "SCP049-C"; + protected override Dictionary> SetTranslation() + { + return new() + { + ["en"] = new() + { + [TranslationKeyName] = "SCP049-C", + [TranslationKeyDesc] = "WIP", + }, + ["fr"] = new() + { + [TranslationKeyName] = "SCP049-C", + [TranslationKeyDesc] = "WIP", + } + }; + } public override RoleTypeId Role => RoleTypeId.Scp049; public override int MaxHealth { get; set; } = 2500; - public override string Description { get; set; } public override float SpawnChance { get; set; } = 0; protected override int SettingId => 10003; diff --git a/KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP457.cs b/KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP457.cs index ddc67903..cc05b094 100644 --- a/KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP457.cs +++ b/KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP457.cs @@ -21,9 +21,22 @@ namespace KE.CustomRoles.CR.CustomSCPs { public class SCP457 : CustomSCP { - - public override string Description { get; set; } = "You do passive damage around you\nsi vous pouvez pas traversé les portes .rcr dans la console client"; - public override string PublicName { get; set; } = "SCP-457"; + protected override Dictionary> SetTranslation() + { + return new() + { + ["en"] = new() + { + [TranslationKeyName] = "SCP-457", + [TranslationKeyDesc] = "You do passive damage around you", + }, + ["fr"] = new() + { + [TranslationKeyName] = "SCP-457", + [TranslationKeyDesc] = "j'ai dit pas trop cuite", + } + }; + } public override int MaxHealth { get; set; } = 5000; public override RoleTypeId Role { get; set; } = RoleTypeId.Scp106; public override bool KeepRoleOnDeath { get; set; } = false; diff --git a/KruacentExiled/KE.CustomRoles/CR/Guard/ChiefGuard.cs b/KruacentExiled/KE.CustomRoles/CR/Guard/ChiefGuard.cs index 6626db70..18ecbbdf 100644 --- a/KruacentExiled/KE.CustomRoles/CR/Guard/ChiefGuard.cs +++ b/KruacentExiled/KE.CustomRoles/CR/Guard/ChiefGuard.cs @@ -10,9 +10,22 @@ namespace KE.CustomRoles.CR.Guard { public class ChiefGuard : KECustomRole, IColor { - public override string Description { get; set; } = "T'as une carte de private \net un crossvec"; - public override string PublicName { get; set; } = "Chef des Gardes"; - public override string InternalName => "ChiefGuard"; + protected override Dictionary> SetTranslation() + { + return new() + { + ["en"] = new() + { + [TranslationKeyName] = "Chief Guard", + [TranslationKeyDesc] = "you got a private card and a crossvec", + }, + ["fr"] = new() + { + [TranslationKeyName] = "Chef des gardes", + [TranslationKeyDesc] = "T'as une carte de private \net un crossvec", + } + }; + } public override int MaxHealth { get; set; } = 100; public override RoleTypeId Role { get; set; } = RoleTypeId.FacilityGuard; public override bool KeepRoleOnDeath { get; set; } = false; diff --git a/KruacentExiled/KE.CustomRoles/CR/Guard/Guard914.cs b/KruacentExiled/KE.CustomRoles/CR/Guard/Guard914.cs index 2cd13588..22fa2398 100644 --- a/KruacentExiled/KE.CustomRoles/CR/Guard/Guard914.cs +++ b/KruacentExiled/KE.CustomRoles/CR/Guard/Guard914.cs @@ -20,9 +20,23 @@ namespace KE.CustomRoles.CR.Guard { public class Guard914 : KECustomRole { - public override string Description { get; set; } = "Tu es Le garde de SCP-914 \nTu commences à 914 \nmais on a volé ta carte \net ntm aussi"; - public override string PublicName { get; set; } = "Garde de 914"; - public override string InternalName => "Guard914"; + + protected override Dictionary> SetTranslation() + { + return new() + { + ["en"] = new() + { + [TranslationKeyName] = "Guard of SCP-914", + [TranslationKeyDesc] = "You are The guard of SCP-914 \nYou start at SCP-914 \nbut someone tampered with your card\nand also fuck you", + }, + ["fr"] = new() + { + [TranslationKeyName] = "Garde de SCP-914", + [TranslationKeyDesc] = "Tu es Le garde de SCP-914 \nTu commences à 914 \nmais on a traffiqué ta carte \net ntm aussi", + } + }; + } public override int MaxHealth { get; set; } = 100; public override RoleTypeId Role { get; set; } = RoleTypeId.FacilityGuard; public override bool KeepRoleOnDeath { get; set; } = false; diff --git a/KruacentExiled/KE.CustomRoles/CR/Guard/Introvert.cs b/KruacentExiled/KE.CustomRoles/CR/Guard/Introvert.cs index 9ee03d98..4f4bef9f 100644 --- a/KruacentExiled/KE.CustomRoles/CR/Guard/Introvert.cs +++ b/KruacentExiled/KE.CustomRoles/CR/Guard/Introvert.cs @@ -14,9 +14,22 @@ namespace KE.CustomRoles.CR.Guard { internal class Introvert : KECustomRole { - public override string Description { get; set; } = "Tu n'aimes pas trop les humains"; - public override string PublicName { get; set; } = "Introvert"; - public override string InternalName => PublicName; + protected override Dictionary> SetTranslation() + { + return new() + { + ["en"] = new() + { + [TranslationKeyName] = "Introvert", + [TranslationKeyDesc] = "your better by yourself", + }, + ["fr"] = new() + { + [TranslationKeyName] = "Introverti", + [TranslationKeyDesc] = "Tu n'aimes pas trop les humains", + } + }; + } public override int MaxHealth { get; set; } = 100; public override RoleTypeId Role { get; set; } = RoleTypeId.FacilityGuard; public override bool KeepRoleOnDeath { get; set; } = false; diff --git a/KruacentExiled/KE.CustomRoles/CR/Human/Alzheimer.cs b/KruacentExiled/KE.CustomRoles/CR/Human/Alzheimer.cs index 41bdc1a8..667b34bd 100644 --- a/KruacentExiled/KE.CustomRoles/CR/Human/Alzheimer.cs +++ b/KruacentExiled/KE.CustomRoles/CR/Human/Alzheimer.cs @@ -6,6 +6,8 @@ using Exiled.Events.EventArgs.Player; using KE.CustomRoles.API.Features; using KE.CustomRoles.API.Interfaces; +using KE.Utils.API.Translations.Events; +using KE.Utils.Extensions; using MEC; using PlayerRoles; using System.Collections.Generic; @@ -15,11 +17,23 @@ namespace KE.CustomRoles.CR.Human { public class Alzheimer : GlobalCustomRole, IColor, IHealable { - private static Dictionary _coroutines = new(); public override SideEnum Side { get; set; } = SideEnum.Human; - public override string Description { get; set; } = "POV Mishima"; - public override string PublicName { get; set; } = "Vieux"; - public override string InternalName => GetType().Name; + protected override Dictionary> SetTranslation() + { + return new() + { + ["en"] = new() + { + [TranslationKeyName] = "Old man", + [TranslationKeyDesc] = "I'm old", + }, + ["fr"] = new() + { + [TranslationKeyName] = "Vieux", + [TranslationKeyDesc] = "Je suis vieux", + } + }; + } public override bool KeepRoleOnDeath { get; set; } = false; public override bool KeepRoleOnChangingRole { get; set; } = false; public override float SpawnChance { get; set; } = 100; @@ -28,35 +42,31 @@ public class Alzheimer : GlobalCustomRole, IColor, IHealable public HashSet HealItem => [ItemType.SCP500]; + private static CoroutineHandle coroutine; protected override void RoleAdded(Player player) { - _coroutines.Add(player, Timing.RunCoroutine(Teleport(player))); + Timing.RunCoroutineSingleton(Teleport(), coroutine, SingletonBehavior.Abort); } - - - - - protected override void RoleRemoved(Player player) + private IEnumerator Teleport() { - if (!_coroutines.ContainsKey(player)) return; - + while (true) + { + yield return Timing.WaitForSeconds(UnityEngine.Random.Range(300f, 600f)); - Timing.KillCoroutines(_coroutines[player]); - _coroutines.Remove(player); - } + foreach(Player player in TrackedPlayers) + { + player.EnableEffect(EffectType.Flashed, 1, 5); + player.EnableEffect(EffectType.Invisible, 1, 6); + player.Teleport(player.Zone.RandomSafeRoom()); + } - private IEnumerator Teleport(Player p) - { - while (p.IsAlive) - { - yield return Timing.WaitForSeconds(UnityEngine.Random.Range(300f, 600f)); - p.EnableEffect(EffectType.Flashed,1,5); - p.EnableEffect(EffectType.Invisible,1,6); - p.Teleport(Utils.Extensions.RoomExtensions.RandomSafeRoom(p.Zone)); } } + + + } } diff --git a/KruacentExiled/KE.CustomRoles/CR/Human/Asthmatique.cs b/KruacentExiled/KE.CustomRoles/CR/Human/Asthmatique.cs index bae73a79..c04c1800 100644 --- a/KruacentExiled/KE.CustomRoles/CR/Human/Asthmatique.cs +++ b/KruacentExiled/KE.CustomRoles/CR/Human/Asthmatique.cs @@ -15,15 +15,29 @@ namespace KE.CustomRoles.CR.Human public class Asthmatique : GlobalCustomRole, IColor, IHealable, IEffectImmunity { public override SideEnum Side { get; set; } = SideEnum.Human; - public override string Description { get; set; } = "T'as stamina est réduit de moitié\nMais tu vises mieux"; - public override string PublicName { get; set; } = "Asthmatique"; + protected override Dictionary> SetTranslation() + { + return new() + { + ["en"] = new() + { + [TranslationKeyName] = "Asthmatic", + [TranslationKeyDesc] = "Stamina halfed\nbut better accuracy", + }, + ["fr"] = new() + { + [TranslationKeyName] = "Asthmatique", + [TranslationKeyDesc] = "T'as stamina est réduit de moitié\nMais tu vises mieux", + } + }; + } public override bool KeepRoleOnDeath { get; set; } = false; public override bool KeepRoleOnChangingRole { get; set; } = false; public override float SpawnChance { get; set; } = 100; public Color32 Color => new Color32(191, 255, 0, 0); public HashSet HealItem => [ItemType.SCP500]; - public HashSet Effects => [EffectType.Poisoned]; + public HashSet ImmuneEffects => [EffectType.Poisoned]; protected override void RoleAdded(Player player) { diff --git a/KruacentExiled/KE.CustomRoles/CR/Human/Crazy.cs b/KruacentExiled/KE.CustomRoles/CR/Human/Crazy.cs index 8b2ea5b1..a6fb6387 100644 --- a/KruacentExiled/KE.CustomRoles/CR/Human/Crazy.cs +++ b/KruacentExiled/KE.CustomRoles/CR/Human/Crazy.cs @@ -32,8 +32,23 @@ internal class Crazy : GlobalCustomRole private static CoroutineHandle _coroutines; private static CoroutineHandle _crazyingCoroutine; public override SideEnum Side { get; set; } = SideEnum.Human; - public override string Description { get; set; } = "Je pense que le traitement que t'as eu à la fondation t'as pas aidé"; - public override string PublicName { get; set; } = "Fou de la facilité"; + protected override Dictionary> SetTranslation() + { + return new() + { + ["en"] = new() + { + [TranslationKeyName] = "Crazy", + [TranslationKeyDesc] = "Crazy? I Was Crazy Once. They Locked Me In A Room. A Rubber Room. A Rubber Room With Rats. And Rats Make Me Crazy", + }, + ["fr"] = new() + { + [TranslationKeyName] = "Fou de la facilité", + [TranslationKeyDesc] = "Je pense que le traitement que t'as eu à la fondation t'as pas aidé", + } + }; + } + public override bool KeepRoleOnDeath { get; set; } = false; public override bool KeepRoleOnChangingRole { get; set; } = false; public override float SpawnChance { get; set; } = 100; @@ -71,7 +86,7 @@ private void PreparationEffect() private IEnumerator ApplyEffect(Player player) { - while (player.IsAlive) + while (Check(player)) { yield return Timing.WaitForSeconds(this.EFFECT_INTERVAL); CrazyBehaviour behaviour = this.WeightedList.GetRandomValue(); diff --git a/KruacentExiled/KE.CustomRoles/CR/Human/Diabetique.cs b/KruacentExiled/KE.CustomRoles/CR/Human/Diabetique.cs index 868961e9..f790d746 100644 --- a/KruacentExiled/KE.CustomRoles/CR/Human/Diabetique.cs +++ b/KruacentExiled/KE.CustomRoles/CR/Human/Diabetique.cs @@ -17,15 +17,29 @@ namespace KE.CustomRoles.CR.Human public class Diabetique : GlobalCustomRole, IColor, IHealable, IEffectImmunity { public override SideEnum Side { get; set; } = SideEnum.Human; - public override string Description { get; set; } = "T'as mangé le crambleu au pomme de mael"; - public override string PublicName { get; set; } = "Diabetique"; + protected override Dictionary> SetTranslation() + { + return new() + { + ["en"] = new() + { + [TranslationKeyName] = "Diabetic", + [TranslationKeyDesc] = "Fucking type 1. 1", + }, + ["fr"] = new() + { + [TranslationKeyName] = "Diabetique", + [TranslationKeyDesc] = "T'as mangé le crambleu au pomme de mael", + } + }; + } public override bool KeepRoleOnDeath { get; set; } = false; public override bool KeepRoleOnChangingRole { get; set; } = false; public override float SpawnChance { get; set; } = 100; public HashSet HealItem => [ItemType.SCP500]; public Color32 Color => new(255, 255, 0,0); - public HashSet Effects => [EffectType.Poisoned]; + public HashSet ImmuneEffects => [EffectType.Poisoned]; protected override void RoleAdded(Player player) { diff --git a/KruacentExiled/KE.CustomRoles/CR/Human/Enderman.cs b/KruacentExiled/KE.CustomRoles/CR/Human/Enderman.cs index 5e744ac8..a46c353a 100644 --- a/KruacentExiled/KE.CustomRoles/CR/Human/Enderman.cs +++ b/KruacentExiled/KE.CustomRoles/CR/Human/Enderman.cs @@ -12,8 +12,22 @@ namespace KE.CustomRoles.CR.Human internal class Enderman : GlobalCustomRole, IColor { public override SideEnum Side { get; set; } = SideEnum.Human; - public override string Description { get; set; } = $"Tu peux te téléporter ! T tro for enféte"; - public override string PublicName { get; set; } = "Enderman"; + protected override Dictionary> SetTranslation() + { + return new() + { + ["en"] = new() + { + [TranslationKeyName] = "Enderman", + [TranslationKeyDesc] = "Great job you're now overpowered", + }, + ["fr"] = new() + { + [TranslationKeyName] = "Enderman", + [TranslationKeyDesc] = "Tu peux te téléporter ! T tro for enféte", + } + }; + } public override bool KeepRoleOnDeath { get; set; } = false; public override bool KeepRoleOnChangingRole { get; set; } = true; public override float SpawnChance { get; set; } = 100; diff --git a/KruacentExiled/KE.CustomRoles/CR/Human/MaladroitVoleur.cs b/KruacentExiled/KE.CustomRoles/CR/Human/MaladroitVoleur.cs index 4ca16590..ca115928 100644 --- a/KruacentExiled/KE.CustomRoles/CR/Human/MaladroitVoleur.cs +++ b/KruacentExiled/KE.CustomRoles/CR/Human/MaladroitVoleur.cs @@ -20,8 +20,22 @@ public class MaladroitVoleur : GlobalCustomRole, IColor { public override SideEnum Side { get; set; } = SideEnum.Human; - public override string Description { get; set; } = "Fait attention à \"tes\" items !"; - public override string PublicName { get; set; } = "Maladroit Voleur"; + protected override Dictionary> SetTranslation() + { + return new() + { + ["en"] = new() + { + [TranslationKeyName] = "Butter Finger Thief", + [TranslationKeyDesc] = "Be careful of \"your\" items!", + }, + ["fr"] = new() + { + [TranslationKeyName] = "Maladroit Voleur", + [TranslationKeyDesc] = "Fais attention à \"tes\" objets !", + } + }; + } public override bool KeepRoleOnDeath { get; set; } = false; public override bool KeepRoleOnChangingRole { get; set; } = false; public override float SpawnChance { get; set; } = 100; diff --git a/KruacentExiled/KE.CustomRoles/CR/Human/Pacifist.cs b/KruacentExiled/KE.CustomRoles/CR/Human/Pacifist.cs index 49aee149..de3ff5aa 100644 --- a/KruacentExiled/KE.CustomRoles/CR/Human/Pacifist.cs +++ b/KruacentExiled/KE.CustomRoles/CR/Human/Pacifist.cs @@ -15,8 +15,22 @@ namespace KE.CustomRoles.CR.Human { public class Pacifist : KECustomRoleMultipleRole { - public override string Description { get; set; } = "T'es idées empêche quelconque violence. S'enlève quand tu t'échappes et ramène plus de renfort"; - public override string PublicName { get; set; } = "Pacifiste"; + protected override Dictionary> SetTranslation() + { + return new() + { + ["en"] = new() + { + [TranslationKeyName] = "Pacifist", + [TranslationKeyDesc] = "You're incapable of violence.\nRemove when escaping and bring more people", + }, + ["fr"] = new() + { + [TranslationKeyName] = "Pacifiste", + [TranslationKeyDesc] = "T'es idées empêche quelconque violence.\nS'enlève quand tu t'échappes et ramène plus de renfort", + } + }; + } public override bool KeepRoleOnDeath { get; set; } = false; public override bool KeepRoleOnChangingRole { get; set; } = false; public override float SpawnChance { get; set; } = 100; diff --git a/KruacentExiled/KE.CustomRoles/CR/MTF/Pilot.cs b/KruacentExiled/KE.CustomRoles/CR/MTF/Pilot.cs index 17a48199..0683cca9 100644 --- a/KruacentExiled/KE.CustomRoles/CR/MTF/Pilot.cs +++ b/KruacentExiled/KE.CustomRoles/CR/MTF/Pilot.cs @@ -14,14 +14,28 @@ namespace KE.CustomRoles.CR.MTF { public class Pilot : KECustomRole { - public override string Description { get; set; } = "So I haveth a Laser Pointere"; - public override string PublicName { get; set; } = "Pilot"; public override int MaxHealth { get; set; } = 90; public override RoleTypeId Role { get; set; } = RoleTypeId.NtfPrivate; public override bool KeepRoleOnDeath { get; set; } = false; public override bool KeepRoleOnChangingRole { get; set; } = false; public override float SpawnChance { get; set; } = 100; + protected override Dictionary> SetTranslation() + { + return new() + { + ["en"] = new() + { + [TranslationKeyName] = "Pilot", + [TranslationKeyDesc] = "So I haveth a Laser Pointere", + }, + ["fr"] = new() + { + [TranslationKeyName] = "Pilote", + [TranslationKeyDesc] = "Je suis pilote!", + } + }; + } public override List Inventory { get; set; } = new List() { diff --git a/KruacentExiled/KE.CustomRoles/CR/MTF/Tank.cs b/KruacentExiled/KE.CustomRoles/CR/MTF/Tank.cs index d1114735..b2dbf2a3 100644 --- a/KruacentExiled/KE.CustomRoles/CR/MTF/Tank.cs +++ b/KruacentExiled/KE.CustomRoles/CR/MTF/Tank.cs @@ -1,6 +1,5 @@ using Exiled.API.Enums; using Exiled.API.Features.Attributes; -using Player = Exiled.Events.Handlers.Player; using Exiled.Events.EventArgs.Player; using MEC; using PlayerRoles; @@ -9,13 +8,29 @@ using System; using KE.CustomRoles.API.Features; using KE.CustomRoles.API.Interfaces; +using Exiled.API.Features; namespace KE.CustomRoles.CR.MTF { public class Tank : KECustomRole, IColor { - public override string Description { get; set; } = "Tu es débuff mais ta force de tir est démultiplié (fais attention à tes balles)"; - public override string PublicName { get; set; } = "Tank"; + protected override Dictionary> SetTranslation() + { + return new() + { + ["en"] = new() + { + [TranslationKeyName] = "Tank", + [TranslationKeyDesc] = "The more bullet you got, the slower you are", + }, + ["fr"] = new() + { + [TranslationKeyName] = "Tank", + [TranslationKeyDesc] = "Tu es ralenti selon ton nombre de balle", + } + }; + } + public override int MaxHealth { get; set; } = 200; public override RoleTypeId Role { get; set; } = RoleTypeId.NtfSergeant; public override bool KeepRoleOnDeath { get; set; } = false; @@ -46,14 +61,14 @@ public class Tank : KECustomRole, IColor protected override void SubscribeEvents() { - Player.Shooting += Shooting; + Exiled.Events.Handlers.Player.Shooting += Shooting; base.SubscribeEvents(); } /// protected override void UnsubscribeEvents() { - Player.Shooting -= Shooting; + Exiled.Events.Handlers.Player.Shooting -= Shooting; base.UnsubscribeEvents(); } @@ -63,14 +78,14 @@ private void Shooting(ShootingEventArgs ev) Timing.CallDelayed(0.5f, () => { - Timing.RunCoroutine(EffectAttribution(ev.Player)); + EffectAttribution(ev.Player); }); } - private IEnumerator EffectAttribution(Exiled.API.Features.Player player) + private void EffectAttribution(Player player) { int nbMunition = player.GetAmmo(AmmoType.Nato762) / 100; - byte nbMunitionByte = (byte)nbMunition; + byte nbMunitionByte = (byte)Mathf.Clamp(nbMunition,byte.MinValue,byte.MaxValue); if (UnityEngine.Random.Range(0, 1) > 0.5f) { @@ -78,7 +93,6 @@ private IEnumerator EffectAttribution(Exiled.API.Features.Player player) player.EnableEffect(EffectType.Slowness, nbMunitionByte, 99999, false); } - yield return 0; } } } diff --git a/KruacentExiled/KE.CustomRoles/CR/MTF/Terroriste.cs b/KruacentExiled/KE.CustomRoles/CR/MTF/Terroriste/Terroriste.cs similarity index 51% rename from KruacentExiled/KE.CustomRoles/CR/MTF/Terroriste.cs rename to KruacentExiled/KE.CustomRoles/CR/MTF/Terroriste/Terroriste.cs index 52c0cc04..1c648d7d 100644 --- a/KruacentExiled/KE.CustomRoles/CR/MTF/Terroriste.cs +++ b/KruacentExiled/KE.CustomRoles/CR/MTF/Terroriste/Terroriste.cs @@ -1,4 +1,5 @@ using Exiled.API.Enums; +using Exiled.API.Features; using Exiled.API.Features.Attributes; using KE.CustomRoles.API.Features; using KE.CustomRoles.API.Interfaces; @@ -6,12 +7,26 @@ using System.Collections.Generic; using UnityEngine; -namespace KE.CustomRoles.CR.MTF +namespace KE.CustomRoles.CR.MTF.Terroriste { public class Terroriste : KECustomRole, IColor { - public override string Description { get; set; } = "Ne fait pas exploser la facilité \ntu commences avec des grenades"; - public override string PublicName { get; set; } = "Terroriste"; + protected override Dictionary> SetTranslation() + { + return new() + { + ["en"] = new() + { + [TranslationKeyName] = "Terrorist", + [TranslationKeyDesc] = "Kaboom!", + }, + ["fr"] = new() + { + [TranslationKeyName] = "Terroriste", + [TranslationKeyDesc] = "Ne fait pas exploser la facilité \ntu commences avec des grenades", + } + }; + } public override int MaxHealth { get; set; } = 100; public override RoleTypeId Role { get; set; } = RoleTypeId.NtfSergeant; public override bool KeepRoleOnDeath { get; set; } = false; @@ -23,8 +38,7 @@ public class Terroriste : KECustomRole, IColor { $"{ItemType.GrenadeHE}", $"{ItemType.GrenadeHE}", - $"{ItemType.GrenadeHE}", - $"{ItemType.GrenadeHE}", + $"{ItemType.ArmorCombat}", $"{ItemType.GunE11SR}", $"{ItemType.Adrenaline}", $"{ItemType.KeycardMTFOperative}", @@ -33,12 +47,30 @@ public class Terroriste : KECustomRole, IColor public override Dictionary Ammo { get; set; } = new Dictionary() { - { AmmoType.Nato556, 100} + { AmmoType.Nato556, 100} }; public override HashSet Abilities { get; } = new() { "Explode" }; + + + protected override void RoleAdded(Player player) + { + player.GameObject.AddComponent(); + + + base.RoleAdded(player); + } + + protected override void RoleRemoved(Player player) + { + if(player.GameObject.TryGetComponent(out var comp)) + { + Object.Destroy(comp); + } + base.RoleRemoved(player); + } } } diff --git a/KruacentExiled/KE.CustomRoles/CR/MTF/Terroriste/TerroristeLight.cs b/KruacentExiled/KE.CustomRoles/CR/MTF/Terroriste/TerroristeLight.cs new file mode 100644 index 00000000..9cb179db --- /dev/null +++ b/KruacentExiled/KE.CustomRoles/CR/MTF/Terroriste/TerroristeLight.cs @@ -0,0 +1,95 @@ +using Exiled.API.Extensions; +using Exiled.API.Features; +using Exiled.API.Features.Toys; +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using UnityEngine; +using Light = Exiled.API.Features.Toys.Light; + +namespace KE.CustomRoles.CR.MTF.Terroriste +{ + internal class TerroristeLight : MonoBehaviour + { + private ReferenceHub _hub; + private Light light; + private Primitive prim; + + private void Start() + { + _hub = ReferenceHub.GetHub(base.gameObject); + CreateLight(); + } + + private void CreateLight() + { + light = Light.Create(null, null, null, false); + light.Transform.parent = _hub.transform; + light.Transform.localPosition = Vector3.down /3f + Vector3.back/4f; + + + light.Color = Color.red; + light.LightType = LightType.Spot; + light.Intensity = intensity; + light.Transform.localRotation = Quaternion.LookRotation(-_hub.transform.forward); + light.SpotAngle = 111; + light.MovementSmoothing = 0; + light.Spawn(); + + //prim = Primitive.Create(null, null, null, false); + //prim.Transform.parent = _hub.transform; + //prim.Transform.localPosition = Vector3.down / 3f + Vector3.back / 5f; + //prim.Transform.localScale = new(.5f, 1, .5f); + //prim.Type = PrimitiveType.Cube; + //prim.MovementSmoothing = 0; + //prim.Spawn(); + } + + + private void OnDestroy() + { + light.Destroy(); + prim?.Destroy(); + } + + + + private int timer = 0; + private const int objective = 100; + + + private float intensity = 2; + + public void Update() + { + + if(timer >= objective) + { + ToggleLight(); + timer = 0; + } + timer++; + } + + + public void ToggleLight() + { + if(light.Intensity == 0) + { + light.Intensity = intensity; + } + else + { + light.Intensity = 0; + } + + + } + + + + } +} diff --git a/KruacentExiled/KE.CustomRoles/CR/SCP/Paper.cs b/KruacentExiled/KE.CustomRoles/CR/SCP/Paper.cs index cf40f6a5..1feda841 100644 --- a/KruacentExiled/KE.CustomRoles/CR/SCP/Paper.cs +++ b/KruacentExiled/KE.CustomRoles/CR/SCP/Paper.cs @@ -1,15 +1,30 @@ using Exiled.API.Features.Attributes; using KE.CustomRoles.API.Features; using PlayerRoles; +using System.Collections.Generic; using UnityEngine; namespace KE.CustomRoles.CR.SCP { public class Paper : GlobalCustomRole { - public override string Description { get; set; } = "uh oh. paper jam"; + protected override Dictionary> SetTranslation() + { + return new() + { + ["en"] = new() + { + [TranslationKeyName] = "Paper", + [TranslationKeyDesc] = "uh oh. paper jam", + }, + ["fr"] = new() + { + [TranslationKeyName] = "Paper", + [TranslationKeyDesc] = "uh oh. paper jam", + } + }; + } public override SideEnum Side { get; set; } = SideEnum.SCP; - public override string PublicName { get; set; } = "Paper"; public override bool KeepRoleOnDeath { get; set; } = false; public override bool KeepRoleOnChangingRole { get; set; } = false; diff --git a/KruacentExiled/KE.CustomRoles/CR/SCP/SCP173/Frozen.cs b/KruacentExiled/KE.CustomRoles/CR/SCP/SCP173/Frozen.cs index 08941ed8..7ea78d0b 100644 --- a/KruacentExiled/KE.CustomRoles/CR/SCP/SCP173/Frozen.cs +++ b/KruacentExiled/KE.CustomRoles/CR/SCP/SCP173/Frozen.cs @@ -23,8 +23,22 @@ namespace KE.CustomRoles.CR.SCP.SCP173 { public class Frozen : KECustomRole, IColor { - public override string Description { get; set; } = "Instead of Tantrum you drop a SCP-244.\nKilling anyone with hypothermia gives Hume Shield"; - public override string PublicName { get; set; } = "Frozen SCP-173"; + protected override Dictionary> SetTranslation() + { + return new() + { + ["en"] = new() + { + [TranslationKeyName] = "Frozen SCP-173", + [TranslationKeyDesc] = "Instead of Tantrum you drop a SCP-244.\nKilling anyone with hypothermia gives Hume Shield", + }, + ["fr"] = new() + { + [TranslationKeyName] = "SCP-173 Glacé", + [TranslationKeyDesc] = "Instead of Tantrum you drop a SCP-244.\nTué quelqu'un qui est en hypothermie donne du shield (dans le jeu hein)", + } + }; + } public override bool KeepRoleOnDeath { get; set; } = false; public override bool KeepRoleOnChangingRole { get; set; } = false; public override float SpawnChance { get; set; } = 0; diff --git a/KruacentExiled/KE.CustomRoles/CR/SCP/SCP939/Ultra.cs b/KruacentExiled/KE.CustomRoles/CR/SCP/SCP939/Ultra.cs index 469b1d41..f04984e6 100644 --- a/KruacentExiled/KE.CustomRoles/CR/SCP/SCP939/Ultra.cs +++ b/KruacentExiled/KE.CustomRoles/CR/SCP/SCP939/Ultra.cs @@ -8,14 +8,29 @@ using MEC; using PlayerRoles; using System; +using System.Collections.Generic; using System.Linq; namespace KE.CustomRoles.CR.SCP.SCP939 { public class Ultra : KECustomRole { - public override string Description { get; set; } = "You can sense where people are located"; - public override string PublicName { get; set; } = "Ultra SCP-939"; + protected override Dictionary> SetTranslation() + { + return new() + { + ["en"] = new() + { + [TranslationKeyName] = "Ultra SCP-939", + [TranslationKeyDesc] = "You can sense where people are located", + }, + ["fr"] = new() + { + [TranslationKeyName] = "Ultra SCP-939", + [TranslationKeyDesc] = "Tu sais où est tout le monde", + } + }; + } public override bool KeepRoleOnDeath { get; set; } = false; public override bool KeepRoleOnChangingRole { get; set; } = false; public override float SpawnChance { get; set; } = 100; diff --git a/KruacentExiled/KE.CustomRoles/CR/SCP/Small.cs b/KruacentExiled/KE.CustomRoles/CR/SCP/Small.cs index 8585c3dc..f467c0df 100644 --- a/KruacentExiled/KE.CustomRoles/CR/SCP/Small.cs +++ b/KruacentExiled/KE.CustomRoles/CR/SCP/Small.cs @@ -2,15 +2,30 @@ using Exiled.CustomRoles.API.Features; using KE.CustomRoles.API.Features; using PlayerRoles; +using System.Collections.Generic; using UnityEngine; namespace KE.CustomRoles.CR.SCP { public class Small : GlobalCustomRole { - public override string Description { get; set; } = "u smoll"; public override SideEnum Side { get; set; } = SideEnum.SCP; - public override string PublicName { get; set; } = "Small"; + protected override Dictionary> SetTranslation() + { + return new() + { + ["en"] = new() + { + [TranslationKeyName] = "Small", + [TranslationKeyDesc] = "u smoll", + }, + ["fr"] = new() + { + [TranslationKeyName] = "Petit", + [TranslationKeyDesc] = "t poti", + } + }; + } public override bool KeepRoleOnDeath { get; set; } = false; public override bool KeepRoleOnChangingRole { get; set; } = false; diff --git a/KruacentExiled/KE.CustomRoles/CR/Scientist/GambleAddict.cs b/KruacentExiled/KE.CustomRoles/CR/Scientist/GambleAddict.cs index 5cd9777e..f9f69b36 100644 --- a/KruacentExiled/KE.CustomRoles/CR/Scientist/GambleAddict.cs +++ b/KruacentExiled/KE.CustomRoles/CR/Scientist/GambleAddict.cs @@ -12,8 +12,22 @@ namespace KE.CustomRoles.CR.Scientist { public class GambleAddict : KECustomRole, IColor { - public override string Description { get; set; } = "T'as trade ton kit et ta carte contre 2 pièces \nfais en bon usage"; - public override string PublicName { get; set; } = "Gamble Addict"; + protected override Dictionary> SetTranslation() + { + return new() + { + ["en"] = new() + { + [TranslationKeyName] = "Gamble Addict", + [TranslationKeyDesc] = "you got 2 coins\ngood luck", + }, + ["fr"] = new() + { + [TranslationKeyName] = "Accro du casino", + [TranslationKeyDesc] = "T'as trade ton kit et ta carte contre 2 pièces \nfais en bon usage", + } + }; + } public override int MaxHealth { get; set; } = 100; public override RoleTypeId Role { get; set; } = RoleTypeId.Scientist; public override bool KeepRoleOnDeath { get; set; } = false; diff --git a/KruacentExiled/KE.CustomRoles/CR/Scientist/ZoneManager.cs b/KruacentExiled/KE.CustomRoles/CR/Scientist/ZoneManager.cs index e6c63dfe..e5ad74bd 100644 --- a/KruacentExiled/KE.CustomRoles/CR/Scientist/ZoneManager.cs +++ b/KruacentExiled/KE.CustomRoles/CR/Scientist/ZoneManager.cs @@ -16,8 +16,22 @@ namespace KE.CustomRoles.CR.Scientist { public class ZoneManager : KECustomRole { - public override string Description { get; set; } = "Incroyable tu peux avoir une promotion alors fais ton boulot et ouvre tous ces checkpoints et tu pourras sortir d'ici"; - public override string PublicName { get; set; } = "Zone Manager"; + protected override Dictionary> SetTranslation() + { + return new() + { + ["en"] = new() + { + [TranslationKeyName] = "Zone Manager", + [TranslationKeyDesc] = "Open all of the checkpoint to get a better card!", + }, + ["fr"] = new() + { + [TranslationKeyName] = "Zone Manager", + [TranslationKeyDesc] = "Incroyable tu peux avoir une promotion alors fais ton boulot et ouvre tous ces checkpoints et tu pourras sortir d'ici!", + } + }; + } public override int MaxHealth { get; set; } = 100; public override RoleTypeId Role { get; set; } = RoleTypeId.Scientist; public override bool KeepRoleOnDeath { get; set; } = false; diff --git a/KruacentExiled/KE.CustomRoles/CR/Scientist/scp202.cs b/KruacentExiled/KE.CustomRoles/CR/Scientist/scp202.cs index 58579f80..9e3eb440 100644 --- a/KruacentExiled/KE.CustomRoles/CR/Scientist/scp202.cs +++ b/KruacentExiled/KE.CustomRoles/CR/Scientist/scp202.cs @@ -4,15 +4,34 @@ using Exiled.Events.EventArgs.Player; using KE.CustomRoles.API.Interfaces; using PlayerRoles; +using System.Collections.Generic; + using Exiled.API.Extensions; namespace KE.CustomRoles.CR.Scientist { public class SCP202 : KECustomRole, IColor { - public override string PublicName { get; set; } = "SCP-202"; - public override string Description { get; set; } = "? emsizan-itna'd te emsinummoc itna'd eiv enu sèrpa\n7691 lirva 91 el trom te engoloc à 6781 reivnaj 5 el én\n,etarcoméd neitérhc itrap ud eitrap tnasiaf 5691 à 9491 ed reilecnahC\n?elaidnom erreug ednoces al sèrpa dnamella reilecnahc re1 el darnoK erid xuev uT ?drannoC"; + public override int MaxHealth { get; set; } = 100; + + protected override Dictionary> SetTranslation() + { + return new() + { + ["en"] = new() + { + [TranslationKeyName] = "SCP-202", + [TranslationKeyDesc] = "? emsizan-itna'd te emsinummoc itna'd eiv enu sèrpa\n7691 lirva 91 el trom te engoloc à 6781 reivnaj 5 el én\n,etarcoméd neitérhc itrap ud eitrap tnasiaf 5691 à 9491 ed reilecnahC\n?elaidnom erreug ednoces al sèrpa dnamella reilecnahc re1 el darnoK erid xuev uT ?drannoC", + }, + ["fr"] = new() + { + [TranslationKeyName] = "SCP-202", + [TranslationKeyDesc] = "? emsizan-itna'd te emsinummoc itna'd eiv enu sèrpa\n7691 lirva 91 el trom te engoloc à 6781 reivnaj 5 el én\n,etarcoméd neitérhc itrap ud eitrap tnasiaf 5691 à 9491 ed reilecnahC\n?elaidnom erreug ednoces al sèrpa dnamella reilecnahc re1 el darnoK erid xuev uT ?drannoC", + } + }; + } + public override RoleTypeId Role { get; set; } = RoleTypeId.Scientist; public override bool KeepRoleOnDeath { get; set; } = false; public override bool KeepRoleOnChangingRole { get; set; } = true; @@ -35,7 +54,7 @@ protected override void UnsubscribeEvents() protected override void ClearInventory(Player player) { - + //empty to keep the inventory } private void OnUsedItem(UsedItemEventArgs ev) diff --git a/KruacentExiled/KE.CustomRoles/Settings/SettingHandler.cs b/KruacentExiled/KE.CustomRoles/Settings/SettingHandler.cs index 72e589fa..759d6a83 100644 --- a/KruacentExiled/KE.CustomRoles/Settings/SettingHandler.cs +++ b/KruacentExiled/KE.CustomRoles/Settings/SettingHandler.cs @@ -26,6 +26,7 @@ internal class SettingHandler : IUsingEvents private readonly int _idSelect = 151; private readonly int _idArrow = 152; private readonly int _idTimeAbilityDesc = 153; + private readonly int _idReshowCustomRole = 154; @@ -51,7 +52,8 @@ public SettingHandler() new KeybindSetting(_idUp, "Select up", UnityEngine.KeyCode.None), new KeybindSetting(_idDown, "Select down", UnityEngine.KeyCode.None), new KeybindSetting(_idSelect, "Use selected ability", UnityEngine.KeyCode.None), - SettingBase.Create(new SSPlaintextSetting(_idArrow, "Personalize the arrow next to the selected ability", baseArrow, 16, TMP_InputField.ContentType.Standard, string.Empty, 0)) + SettingBase.Create(new SSPlaintextSetting(_idArrow, "Personalize the arrow next to the selected ability", baseArrow, 16, TMP_InputField.ContentType.Standard, string.Empty, 0)), + new ButtonSetting(_idReshowCustomRole, "Reshow Custom role description","click") }; @@ -137,6 +139,20 @@ private void OnSettingValueReceived(Player player, ServerSpecificSettingBase set Log.Debug("select"); KEAbilities.UseSelected(player); } + + if (settingBase is SSButton buttonSetting) + { + KECustomRole cr = KECustomRole.Get(player).FirstOrDefault(); + + if(cr != null) + { + cr.Show(player); + } + + + } + + foreach (DebugSetting debug in DebugSetting.settings) { debug.OnSettingValueReceived(player, settingBase); @@ -203,7 +219,8 @@ private void Down(Player player) public static bool CheckPressed(ServerSpecificSettingBase settingBase, int id) { - return settingBase is SSKeybindSetting keybindSetting && keybindSetting.SettingId == id && keybindSetting.SyncIsPressed; + return settingBase.SettingId == id && + (settingBase is SSKeybindSetting keybindSetting && keybindSetting.SyncIsPressed); } From e71e63372f7ca3acb485c662f781a48b36aa18fb Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Sun, 22 Feb 2026 08:43:03 +0100 Subject: [PATCH 638/853] patch note --- KruacentExiled/KE.Misc/Config.cs | 3 + .../KE.Misc/Features/PatchNotes/PatchNote.cs | 92 +++++++++++++++++++ .../Features/PatchNotes/PatchNoteChanger.cs | 62 +++++++++++++ .../Features/PatchNotes/PatchNotesPosition.cs | 20 ++++ .../KE.Misc/Features/VoteStart/VoteStart.cs | 7 +- KruacentExiled/KE.Misc/MainPlugin.cs | 6 +- 6 files changed, 183 insertions(+), 7 deletions(-) create mode 100644 KruacentExiled/KE.Misc/Features/PatchNotes/PatchNote.cs create mode 100644 KruacentExiled/KE.Misc/Features/PatchNotes/PatchNoteChanger.cs create mode 100644 KruacentExiled/KE.Misc/Features/PatchNotes/PatchNotesPosition.cs diff --git a/KruacentExiled/KE.Misc/Config.cs b/KruacentExiled/KE.Misc/Config.cs index f679ae96..379d4bbb 100644 --- a/KruacentExiled/KE.Misc/Config.cs +++ b/KruacentExiled/KE.Misc/Config.cs @@ -29,6 +29,9 @@ public class Config : IConfig public int MinPlayerVote { get; set; } = 6; + public string PatchNote { get; set; } = "Patch note:"; + + } diff --git a/KruacentExiled/KE.Misc/Features/PatchNotes/PatchNote.cs b/KruacentExiled/KE.Misc/Features/PatchNotes/PatchNote.cs new file mode 100644 index 00000000..71a3cb86 --- /dev/null +++ b/KruacentExiled/KE.Misc/Features/PatchNotes/PatchNote.cs @@ -0,0 +1,92 @@ +using Exiled.API.Features; +using Exiled.Events.EventArgs.Player; +using KE.Utils.API.Displays.DisplayMeow; +using KE.Utils.API.Displays.DisplayMeow.Placements; +using KE.Utils.API.Interfaces; +using MEC; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace KE.Misc.Features.PatchNotes +{ + internal class PatchNote : MiscFeature + { + public static HintPosition HintPosition = new PatchNotesPosition(); + public override void SubscribeEvents() + { + Exiled.Events.Handlers.Player.Joined += OnJoined; + Exiled.Events.Handlers.Server.RoundStarted += OnRoundStarted; + } + + public override void UnsubscribeEvents() + { + Exiled.Events.Handlers.Player.Joined -= OnJoined; + Exiled.Events.Handlers.Server.RoundStarted -= OnRoundStarted; + } + + + private void OnJoined(JoinedEventArgs ev) + { + Player player = ev.Player; + + if (ev.Player is null) + { + return; + } + + + if (!ev.Player.IsConnected) + { + return; + } + + Timing.CallDelayed(1f, () => + { + if (Round.IsLobby) + { + var hint = DisplayHandler.Instance.CreateAuto(player, (args) => GetPatchNotes(), HintPosition.HintPlacement); + hint.FontSize = 25; + } + }); + + } + + + private void OnRoundStarted() + { + foreach (Player player in Player.List) + { + DisplayHandler.Instance.RemoveHint(player, HintPosition.HintPlacement); + } + + } + + + public const string PatchNoteStart = "Patch Notes :\n"; + + private static string cachedPatchNote = PatchNoteNotFound; + private const string PatchNoteNotFound = " "; + + + private string GetPatchNotes() + { + if(cachedPatchNote == PatchNoteNotFound) + { + cachedPatchNote = PatchNoteStart + MainPlugin.Instance.Config.PatchNote; + } + + return cachedPatchNote; + + } + + + public static void Reload() + { + cachedPatchNote = PatchNoteNotFound; + } + + } +} diff --git a/KruacentExiled/KE.Misc/Features/PatchNotes/PatchNoteChanger.cs b/KruacentExiled/KE.Misc/Features/PatchNotes/PatchNoteChanger.cs new file mode 100644 index 00000000..65add532 --- /dev/null +++ b/KruacentExiled/KE.Misc/Features/PatchNotes/PatchNoteChanger.cs @@ -0,0 +1,62 @@ +using CommandSystem; +using Exiled.API.Features; +using NorthwoodLib.Pools; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace KE.Misc.Features.PatchNotes +{ + [CommandHandler(typeof(RemoteAdminCommandHandler))] + public class PatchNoteChanger : ICommand + { + public string Command => "patchnotechanger"; + + public string[] Aliases => ["pnc"]; + + public string Description => "change patch note"; + + public bool Execute(ArraySegment arguments, ICommandSender sender, out string response) + { + if(!Round.IsLobby) + { + response = "works only in lobby"; + return false; + } + + if(arguments.Count < 1) + { + response = "current patchnote number : "+ MainPlugin.Instance.Config.PatchNote; + return true; + } + + + + + StringBuilder sb = StringBuilderPool.Shared.Rent(arguments.Count); + + for(int i = 0; i < arguments.Count; i++) + { + sb.Append(arguments.At(i)); + sb.Append(" "); + } + + + string result = sb.ToString(); + + + StringBuilderPool.Shared.Return(sb); + + + MainPlugin.Instance.Config.PatchNote = result; + + PatchNote.Reload(); + + + response = "changed"; + return true; + } + } +} diff --git a/KruacentExiled/KE.Misc/Features/PatchNotes/PatchNotesPosition.cs b/KruacentExiled/KE.Misc/Features/PatchNotes/PatchNotesPosition.cs new file mode 100644 index 00000000..65d56eed --- /dev/null +++ b/KruacentExiled/KE.Misc/Features/PatchNotes/PatchNotesPosition.cs @@ -0,0 +1,20 @@ +using HintServiceMeow.Core.Enum; +using KE.Utils.API.Displays.DisplayMeow.Placements; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace KE.Misc.Features.PatchNotes +{ + public class PatchNotesPosition : HintPosition + { + public override float Xposition => -240; + + public override float Yposition => 300; + public override string Name => "PatchNotes"; + + public override HintAlignment HintAlignment => HintAlignment.Left; + } +} diff --git a/KruacentExiled/KE.Misc/Features/VoteStart/VoteStart.cs b/KruacentExiled/KE.Misc/Features/VoteStart/VoteStart.cs index e27474c9..9f0a692d 100644 --- a/KruacentExiled/KE.Misc/Features/VoteStart/VoteStart.cs +++ b/KruacentExiled/KE.Misc/Features/VoteStart/VoteStart.cs @@ -119,7 +119,6 @@ private void OnJoined(JoinedEventArgs ev) { if (Round.IsLobby) { - PlayerDisplay dis = PlayerDisplay.Get(player); DisplayHandler.Instance.CreateAuto(player, (args) => GetPlayers(player), HintPosition.HintPlacement); } }); @@ -169,11 +168,7 @@ private void OnRoundStarted() { foreach(Player player in Player.List) { - AbstractHint hint = DisplayHandler.Instance.GetHint(player, HintPosition.HintPlacement); - if (hint is not null) - { - hint.Hide = true; - } + DisplayHandler.Instance.RemoveHint(player, HintPosition.HintPlacement); } } diff --git a/KruacentExiled/KE.Misc/MainPlugin.cs b/KruacentExiled/KE.Misc/MainPlugin.cs index 25f758f2..271a2cd6 100644 --- a/KruacentExiled/KE.Misc/MainPlugin.cs +++ b/KruacentExiled/KE.Misc/MainPlugin.cs @@ -14,13 +14,14 @@ using KE.Misc.Features.LastHuman; using KE.Utils.API.Settings.GlobalSettings; using KE.Utils.API.Translations; +using KE.Misc.Features.PatchNotes; namespace KE.Misc { public class MainPlugin : Plugin, ILocalizable { - public override string Author => "Patrique"; + public override string Author => "Patrique & OmerGS"; public override string Name => "KE.Misc"; public override string Prefix => "KE.Misc"; public override Version Version => new Version(1, 1, 0); @@ -39,6 +40,7 @@ public class MainPlugin : Plugin, ILocalizable internal EventHandlers _gamblingCoinHandler { get; private set; } internal SpawnLcz SpawnLcz { get; private set; } internal LastHumanHandler LastHuman { get; private set; } + internal PatchNote PatchNote { get; private set; } private Harmony harmony; internal VoteStart vote { get; private set; } @@ -63,6 +65,7 @@ public override void OnEnabled() LastHuman = new(); Candy = new Candy(); vote = new(); + PatchNote = new(); //SpawnLcz = new(); Respawn.SetTokens(SpawnableFaction.NtfWave, 2); Respawn.SetTokens(SpawnableFaction.ChaosWave, 2); @@ -117,6 +120,7 @@ public override void OnDisabled() AutoElevator = null; vote = null; AutoNukeAnnoucement = null; + PatchNote = null; FriendlyFire = null; //SurfaceLight = null; GamblingCoinManager.DestroyAll(); From cd22491731db7590090e3cd31bdbaaa4b1540b53 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Sun, 22 Feb 2026 09:01:52 +0100 Subject: [PATCH 639/853] added + one to each scp preferecnces --- .../KE.Misc/Features/Spawn/Spawn.cs | 28 +++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) diff --git a/KruacentExiled/KE.Misc/Features/Spawn/Spawn.cs b/KruacentExiled/KE.Misc/Features/Spawn/Spawn.cs index 33df7c40..61dddcb1 100644 --- a/KruacentExiled/KE.Misc/Features/Spawn/Spawn.cs +++ b/KruacentExiled/KE.Misc/Features/Spawn/Spawn.cs @@ -5,6 +5,7 @@ using MEC; using PlayerRoles; using System; +using System.CodeDom; using System.Collections.Generic; using System.Linq; @@ -21,6 +22,9 @@ public class Spawn : MiscFeature { "939", RoleTypeId.Scp939 }, }; + + public const int baseValue = 1; + private Dictionary SelectableCustomSCPs => CustomSCP.All.ToDictionary(cs =>cs.Name, cs => cs); @@ -75,12 +79,32 @@ private Dictionary GetPreferences(Player player) foreach(var kvp in baseRole) { - idChance.Add(kvp.Key, player.ScpPreferences.Preferences[kvp.Value] + 5); + idChance.Add(kvp.Key, player.ScpPreferences.Preferences[kvp.Value] + 5 + baseValue); } foreach (CustomSCP customSCP in SelectableCustomSCPs.Values) { - idChance.Add(customSCP.Name, customSCP.GetPreferences(player) + 5); + if(customSCP.SpawnChance > 0) + { + idChance.Add(customSCP.Name, customSCP.GetPreferences(player) + 5 + baseValue); + } + } + + int nbNotZero = 0; + string scpNotZero = string.Empty; + + foreach(var kvp in idChance) + { + if(kvp.Value != 0 + baseValue) + { + nbNotZero++; + scpNotZero = kvp.Key; + } + } + + if(nbNotZero == 1) + { + idChance[scpNotZero] = 0; } From b593e725f79b2d6dc872b488899da9149df50fb5 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Sun, 22 Feb 2026 09:21:08 +0100 Subject: [PATCH 640/853] new gambling back + dont drop item if in category limit --- .../KE.Map/Heavy/GamblingZone/GamblingRoom.cs | 45 +++++++++++++++---- KruacentExiled/KE.Map/MainPlugin.cs | 12 ++--- 2 files changed, 42 insertions(+), 15 deletions(-) diff --git a/KruacentExiled/KE.Map/Heavy/GamblingZone/GamblingRoom.cs b/KruacentExiled/KE.Map/Heavy/GamblingZone/GamblingRoom.cs index fcfd1fdc..5d474460 100644 --- a/KruacentExiled/KE.Map/Heavy/GamblingZone/GamblingRoom.cs +++ b/KruacentExiled/KE.Map/Heavy/GamblingZone/GamblingRoom.cs @@ -19,7 +19,7 @@ public class GamblingRoom : AbstractGambling private HashSet _model; - public const float BasePickupTime = 10; + public const float BasePickupTime = 5; public float PickupTime { get @@ -71,10 +71,15 @@ protected void Init(Vector3 position, LootTable lootTable, Vector3? offset = nul _lootTable = lootTable; - _interact.OnInteracted += p => Log.Info($"{p.Nickname} interatcted"); // Runs if interactionduration is set to 0 - _interact.OnSearching += p => Log.Info($"{p.Nickname} OnSearching"); // runs when the player presses E & interactionduration != 0 - _interact.OnSearched += p => Log.Info($"{p.Nickname} OnSearched"); // Runs after searching is completed. - _interact.OnSearchAborted += p => Log.Info($"{p.Nickname} OnSearchAborted"); // Runs after + if (MainPlugin.Configs.Debug) + { + + _interact.OnInteracted += p => Log.Info($"{p.Nickname} interatcted"); // Runs if interactionduration is set to 0 + _interact.OnSearching += p => Log.Info($"{p.Nickname} OnSearching"); // runs when the player presses E & interactionduration != 0 + _interact.OnSearched += p => Log.Info($"{p.Nickname} OnSearched"); // Runs after searching is completed. + _interact.OnSearchAborted += p => Log.Info($"{p.Nickname} OnSearchAborted"); // Runs after + } + } @@ -118,20 +123,42 @@ public override void Destroy() public void OnPickup(PlayerSearchedToyEventArgs ev) { - Player player = ev.Player; + Player player2 = ev.Player; if (ev.Interactable != _interact) return; - - Player player2 = Player.Get(player); if (player2 == null) return; if (player2.IsScp) return; if (player2.CurrentItem == null) return; Item item = _lootTable.GetRandomItem(); player2.CurrentItem.Destroy(); + player2.AddItem(item); + if (!CanPickupOther(player2, item.Category)) + { + player2.DropItem(item, false); + } + + + - player2.DropItem(item, false); + } + + private static bool CanPickupOther(Player player,ItemCategory category) + { + sbyte nbitem = 0; + foreach(Item item in player.Items) + { + if(item.Category == category) + { + nbitem++; + } + } + + return nbitem <= player.GetCategoryLimit(category); + + } + public static void DestroyAll() { foreach (GamblingRoom gamblingRoom in List.ToList()) diff --git a/KruacentExiled/KE.Map/MainPlugin.cs b/KruacentExiled/KE.Map/MainPlugin.cs index 62e295ca..ccc04352 100644 --- a/KruacentExiled/KE.Map/MainPlugin.cs +++ b/KruacentExiled/KE.Map/MainPlugin.cs @@ -102,11 +102,11 @@ private void OnRoundStarted() //Log.Info(Scp106MovementModule.GetSlowdownFromCollider(col, out bool passable) + " passable?" + passable); - FollowingTextToy f1 = new([player], player.Position, Quaternion.identity, Vector3.one); - f1.Toy.TextFormat = "F1 sur un bateau"; + //FollowingTextToy f1 = new([player], player.Position, Quaternion.identity, Vector3.one); + //f1.Toy.TextFormat = "F1 sur un bateau"; - FollowingTextToy f2 = new([], player.Position, Quaternion.identity, Vector3.one); - f2.Toy.TextFormat = "F2 tombe à l'eau"; + //FollowingTextToy f2 = new([], player.Position, Quaternion.identity, Vector3.one); + //f2.Toy.TextFormat = "F2 tombe à l'eau"; @@ -174,9 +174,9 @@ private void OnGenerated() }; - //var g = new GamblingRoom(RoleTypeId.Scp173.GetRandomSpawnLocation().Position + Vector3.down, new(normal)); + var g = new GamblingRoom(RoleTypeId.Scp173.GetRandomSpawnLocation().Position + Vector3.down, new(normal)); - var g = new OldGamblingRoom(RoleTypeId.Scp173.GetRandomSpawnLocation().Position + Vector3.down, Vector3.one*10, new LootTable(normal)); + //var g = new OldGamblingRoom(RoleTypeId.Scp173.GetRandomSpawnLocation().Position + Vector3.down, Vector3.one*10, new LootTable(normal)); From 0c7b764e1909dab2161ed69de3af8a5948760f05 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Sun, 22 Feb 2026 10:33:21 +0100 Subject: [PATCH 641/853] custom keycard --- .../KE.Items/API/Core/Models/PickupModel.cs | 1 - .../KE.Items/API/Features/KECustomKeycard.cs | 79 +++++++++++++++++++ KruacentExiled/KE.Items/Items/HealZone.cs | 9 ++- KruacentExiled/KE.Items/Items/Molotov.cs | 9 ++- .../Items/PickupModels/HolyGrenadePModel.cs | 16 ++-- .../KE.Items/Items/PickupModels/MinePModel.cs | 6 +- .../Items/PickupModels/MolotovPModel.cs | 14 ++-- .../Items/PickupModels/PressePureePModel.cs | 8 +- .../Items/PickupModels/Scp3136PModel.cs | 2 +- .../Items/PickupModels/TPGrenadaPModel.cs | 16 ++-- .../KE.Items/Items/ShieldBelt/ShieldBelt.cs | 7 +- .../Items/ShieldBelt/ShieldBeltStat.cs | 14 ++-- 12 files changed, 134 insertions(+), 47 deletions(-) create mode 100644 KruacentExiled/KE.Items/API/Features/KECustomKeycard.cs diff --git a/KruacentExiled/KE.Items/API/Core/Models/PickupModel.cs b/KruacentExiled/KE.Items/API/Core/Models/PickupModel.cs index 632c5283..45c64c73 100644 --- a/KruacentExiled/KE.Items/API/Core/Models/PickupModel.cs +++ b/KruacentExiled/KE.Items/API/Core/Models/PickupModel.cs @@ -72,7 +72,6 @@ public void OnPickupAdded(ItemPickupBase pickupBase) if (!Check(pickup)) return; Transform parent = CreateParent(pickup).Transform; - Log.Info(parent); CreateModel(parent); } diff --git a/KruacentExiled/KE.Items/API/Features/KECustomKeycard.cs b/KruacentExiled/KE.Items/API/Features/KECustomKeycard.cs new file mode 100644 index 00000000..41e43aed --- /dev/null +++ b/KruacentExiled/KE.Items/API/Features/KECustomKeycard.cs @@ -0,0 +1,79 @@ +using Exiled.API.Enums; +using Exiled.API.Features; +using Exiled.API.Features.Doors; +using Exiled.API.Features.Pickups; +using Exiled.API.Features.Spawn; +using Exiled.CustomItems.API.Features; +using KE.Items.API.Features.SpawnPoints; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using static KE.Items.API.Features.SpawnPoints.PoseRoomSpawnPointHandler; + +namespace KE.Items.API.Features +{ + public abstract class KECustomKeycard : CustomKeycard + { + + public override KeycardPermissions Permissions { get; set; } = KeycardPermissions.None; + + + public override uint Spawn(IEnumerable spawnPoints, uint limit) + { + Log.Debug($"spawning {this.Name}"); + HashSet spawns = spawnPoints.ToHashSet(); + uint num = 0; + foreach (SpawnPoint spawnpoint in spawnPoints.Where(sp => sp is RoomSpawnPoint)) + { + Pickup pickup; + if (Exiled.Loader.Loader.Random.NextDouble() * 100.0 >= (double)spawnpoint.Chance || (limit != 0 && num >= limit)) + { + continue; + } + spawns.Remove(spawnpoint); + RoomSpawnPoint room = spawnpoint as RoomSpawnPoint; + ItemSpawn spawn = PoseRoomSpawnPointHandler.UseRandomPose(room.Room); + + Log.Debug($"spawning {this.Name} in {room.Room}"); + Log.Debug(room.Room + " : " + PoseRoomSpawnPointHandler.UsablePoses.Count(p => p.roomType == room.Room)); + + if (spawn is not null) + { + Log.Debug($"spawning custom pos"); + pickup = Spawn(spawn.Position); + } + else + { + Log.Error($"can't spawn ({Name}) in custom ({room.Room})"); + pickup = Spawn(spawnpoint.Position); + } + + + + if (pickup is not null) + { + num++; + } + + + } + + return base.Spawn(spawns, limit - num); + } + + + + protected override void ShowPickedUpMessage(Player player) + { + KECustomItem.Message(this, player, true); + } + + protected override void ShowSelectedMessage(Player player) + { + KECustomItem.Message(this, player); + } + + } +} diff --git a/KruacentExiled/KE.Items/Items/HealZone.cs b/KruacentExiled/KE.Items/Items/HealZone.cs index 17915fce..4bdae044 100644 --- a/KruacentExiled/KE.Items/Items/HealZone.cs +++ b/KruacentExiled/KE.Items/Items/HealZone.cs @@ -7,11 +7,13 @@ using KE.Items.API.Interface; using KE.Items.Items.ItemEffects; using KE.Items.API.Features; +using Scp914; +using KE.Items.API.Core.Upgrade; namespace KE.Items.Items { [CustomItem(ItemType.GrenadeFlash)] - public class HealZone : KECustomGrenade, ILumosItem, ISwichableEffect + public class HealZone : KECustomGrenade, ILumosItem, ISwichableEffect, IUpgradableCustomItem { public override uint Id { get; set; } = 1051; public override string Name { get; set; } = "Heal Zone"; @@ -64,6 +66,11 @@ public class HealZone : KECustomGrenade, ILumosItem, ISwichableEffect }, }; + public IReadOnlyDictionary Upgrade => new Dictionary() + { + [Scp914KnobSetting.OneToOne] = new UpgradeProperties(100, 1049) + }; + public HealZone() { Effect = new HealZoneEffect(); diff --git a/KruacentExiled/KE.Items/Items/Molotov.cs b/KruacentExiled/KE.Items/Items/Molotov.cs index 4181cb3e..ff0f5045 100644 --- a/KruacentExiled/KE.Items/Items/Molotov.cs +++ b/KruacentExiled/KE.Items/Items/Molotov.cs @@ -5,17 +5,19 @@ using Exiled.Events.EventArgs.Map; using Exiled.Events.EventArgs.Player; using KE.Items.API.Core.Models; +using KE.Items.API.Core.Upgrade; using KE.Items.API.Features; using KE.Items.API.Interface; using KE.Items.Items.ItemEffects; using KE.Items.Items.PickupModels; +using Scp914; using System.Collections.Generic; using UnityEngine; namespace KE.Items.Items { [CustomItem(ItemType.GrenadeFlash)] - public class Molotov : KECustomGrenade, ISwichableEffect, ICustomPickupModel + public class Molotov : KECustomGrenade, ISwichableEffect, ICustomPickupModel, IUpgradableCustomItem { public override uint Id { get; set; } = 1049; public override string Name { get; set; } = "Cocktail Molotov"; @@ -26,6 +28,11 @@ public class Molotov : KECustomGrenade, ISwichableEffect, ICustomPickupModel public Color Color { get; set; } = Color.yellow; public CustomItemEffect Effect { get; set; } public PickupModel PickupModel { get; } + + public IReadOnlyDictionary Upgrade => new Dictionary() + { + [Scp914KnobSetting.OneToOne] = new UpgradeProperties(100, 1051) + }; public override SpawnProperties SpawnProperties { get; set; } = new SpawnProperties() { Limit = 2, diff --git a/KruacentExiled/KE.Items/Items/PickupModels/HolyGrenadePModel.cs b/KruacentExiled/KE.Items/Items/PickupModels/HolyGrenadePModel.cs index 844d886a..f5f8777d 100644 --- a/KruacentExiled/KE.Items/Items/PickupModels/HolyGrenadePModel.cs +++ b/KruacentExiled/KE.Items/Items/PickupModels/HolyGrenadePModel.cs @@ -27,18 +27,18 @@ protected override void CreateModel(Transform parent) { - Primitive sphere = CreatePrimitive(parent, PrimitiveType.Sphere, Vector3.zero, Quaternion.identity, Vector3.one, white); + var sphere = CreatePrimitive(parent, PrimitiveType.Sphere, Vector3.zero, Quaternion.identity, Vector3.one, white); - Primitive gem = CreatePrimitive(parent, PrimitiveType.Sphere, new(0,0.8f,0), Quaternion.identity, new(.15f,.1f,.1f), red); + var gem = CreatePrimitive(parent, PrimitiveType.Sphere, new(0,0.8f,0), Quaternion.identity, new(.15f,.1f,.1f), red); - Primitive crossV = CreatePrimitive(parent, PrimitiveType.Cube, new(0, 0.74f, 0), Quaternion.identity, new(.1f, .5f, .1f), white); - Primitive crossH = CreatePrimitive(parent, PrimitiveType.Cube, new(0, 0.8f, 0), Quaternion.identity, new(.1f, .1f, .37f), white); + var crossV = CreatePrimitive(parent, PrimitiveType.Cube, new(0, 0.74f, 0), Quaternion.identity, new(.1f, .5f, .1f), white); + var crossH = CreatePrimitive(parent, PrimitiveType.Cube, new(0, 0.8f, 0), Quaternion.identity, new(.1f, .1f, .37f), white); - Primitive ring1 = CreatePrimitive(parent, PrimitiveType.Cylinder, Vector3.zero, Quaternion.Euler(90,0,0), new(1.05f, .05f, 1.05f), gold); - Primitive ring2 = CreatePrimitive(parent, PrimitiveType.Cylinder, Vector3.zero, Quaternion.identity, new(1.05f, .05f, 1.05f), gold); - Primitive ring3 = CreatePrimitive(parent, PrimitiveType.Cylinder, Vector3.zero, Quaternion.Euler(90, 90, 0), new(1.05f, .05f, 1.05f), gold); + var ring1 = CreatePrimitive(parent, PrimitiveType.Cylinder, Vector3.zero, Quaternion.Euler(90,0,0), new(1.05f, .05f, 1.05f), gold); + var ring2 = CreatePrimitive(parent, PrimitiveType.Cylinder, Vector3.zero, Quaternion.identity, new(1.05f, .05f, 1.05f), gold); + var ring3 = CreatePrimitive(parent, PrimitiveType.Cylinder, Vector3.zero, Quaternion.Euler(90, 90, 0), new(1.05f, .05f, 1.05f), gold); - Primitive littleBase = CreatePrimitive(parent, PrimitiveType.Cylinder, new(0, 0.5f, 0), Quaternion.identity, new(.3f, .05f, .3f), gold); + var littleBase = CreatePrimitive(parent, PrimitiveType.Cylinder, new(0, 0.5f, 0), Quaternion.identity, new(.3f, .05f, .3f), gold); } } diff --git a/KruacentExiled/KE.Items/Items/PickupModels/MinePModel.cs b/KruacentExiled/KE.Items/Items/PickupModels/MinePModel.cs index 82f1f26f..62d3cd90 100644 --- a/KruacentExiled/KE.Items/Items/PickupModels/MinePModel.cs +++ b/KruacentExiled/KE.Items/Items/PickupModels/MinePModel.cs @@ -23,9 +23,9 @@ public MinePModel(KECustomItem customItem) : base(customItem) { } public static Color32 lightColor = new Color32(255, 0, 0, 0); protected override void CreateModel(Transform parent) { - Primitive baseMine = CreatePrimitive(parent, PrimitiveType.Cylinder, Vector3.zero, Quaternion.identity, new Vector3(1, .05f, 1), new Color32(0, 0, 0, 255)); - Primitive baseLight = CreatePrimitive(parent, PrimitiveType.Sphere, Vector3.zero, Quaternion.identity, Vector3.one*0.2f, new Color32(255, 0, 0, 100)); - Light light = CreateLight(baseLight.Transform, Vector3.down/2f, Quaternion.identity, Vector3.one, lightColor, LightType.Point, .1f); + var baseMine = CreatePrimitive(parent, PrimitiveType.Cylinder, Vector3.zero, Quaternion.identity, new Vector3(1, .05f, 1), new Color32(0, 0, 0, 255)); + var baseLight = CreatePrimitive(parent, PrimitiveType.Sphere, Vector3.zero, Quaternion.identity, Vector3.one*0.2f, new Color32(255, 0, 0, 100)); + Light light = CreateLight(baseLight.transform, Vector3.down/2f, Quaternion.identity, Vector3.one, lightColor, LightType.Point, .1f); diff --git a/KruacentExiled/KE.Items/Items/PickupModels/MolotovPModel.cs b/KruacentExiled/KE.Items/Items/PickupModels/MolotovPModel.cs index 0bb4546e..ef309cee 100644 --- a/KruacentExiled/KE.Items/Items/PickupModels/MolotovPModel.cs +++ b/KruacentExiled/KE.Items/Items/PickupModels/MolotovPModel.cs @@ -17,15 +17,11 @@ public MolotovPModel(CustomItem customItem) : base(customItem) { } protected override void CreateModel(Transform parent) { - Primitive base1 = CreatePrimitive(parent, PrimitiveType.Cylinder, Vector3.up*.7f, Quaternion.identity, new(0.6f, 0.09f, 0.6f), bottleColor); - Primitive base2 = CreatePrimitive(parent, PrimitiveType.Cylinder, Vector3.down *.08f, Quaternion.identity, new(0.8f,0.7f,0.8f), bottleColor); - Primitive base3 = CreatePrimitive(parent, PrimitiveType.Cylinder, Vector3.up *.9f, Quaternion.identity, new(0.4f,0.1f,0.4f), bottleColor); - Primitive base4 = CreatePrimitive(parent, PrimitiveType.Cylinder, Vector3.up *1.4f, Quaternion.identity, new(0.3f,0.4f,0.3f), bottleColor); - Primitive base5 = CreatePrimitive(parent, PrimitiveType.Cylinder, Vector3.down *.8f, Quaternion.identity, new(0.6f,0.06f,0.6f), bottleColor); - - - - + var base1 = CreatePrimitive(parent, PrimitiveType.Cylinder, Vector3.up*.7f, Quaternion.identity, new(0.6f, 0.09f, 0.6f), bottleColor); + var base2 = CreatePrimitive(parent, PrimitiveType.Cylinder, Vector3.down *.08f, Quaternion.identity, new(0.8f,0.7f,0.8f), bottleColor); + var base3 = CreatePrimitive(parent, PrimitiveType.Cylinder, Vector3.up *.9f, Quaternion.identity, new(0.4f,0.1f,0.4f), bottleColor); + var base4 = CreatePrimitive(parent, PrimitiveType.Cylinder, Vector3.up *1.4f, Quaternion.identity, new(0.3f,0.4f,0.3f), bottleColor); + var base5 = CreatePrimitive(parent, PrimitiveType.Cylinder, Vector3.down *.8f, Quaternion.identity, new(0.6f,0.06f,0.6f), bottleColor); } } } diff --git a/KruacentExiled/KE.Items/Items/PickupModels/PressePureePModel.cs b/KruacentExiled/KE.Items/Items/PickupModels/PressePureePModel.cs index e4ab96b1..8c825e60 100644 --- a/KruacentExiled/KE.Items/Items/PickupModels/PressePureePModel.cs +++ b/KruacentExiled/KE.Items/Items/PickupModels/PressePureePModel.cs @@ -20,10 +20,10 @@ public PressePureePModel(CustomItem customItem) : base(customItem) { } protected override void CreateModel(Transform parent) { - Primitive manche = CreatePrimitive(parent,PrimitiveType.Cylinder,new(0,.006f,0),Quaternion.identity, mancheScale, colorManche); - Primitive manche2 = CreatePrimitive(parent,PrimitiveType.Cylinder,new(0,.9463f,0),Quaternion.identity, new(0.45f,0.05f,0.45f), colorExplosif); - Primitive explosif1 = CreatePrimitive(parent,PrimitiveType.Cylinder,new(0,1.2113f,0),Quaternion.identity, new(0.7f,0.2274f,0.7f), colorExplosif); - Primitive explosif2 = CreatePrimitive(parent,PrimitiveType.Cylinder,new(0,1,0),Quaternion.identity, new(0.8f,0.02f,0.8f), colorExplosif); + var manche = CreatePrimitive(parent,PrimitiveType.Cylinder,new(0,.006f,0),Quaternion.identity, mancheScale, colorManche); + var manche2 = CreatePrimitive(parent,PrimitiveType.Cylinder,new(0,.9463f,0),Quaternion.identity, new(0.45f,0.05f,0.45f), colorExplosif); + var explosif1 = CreatePrimitive(parent,PrimitiveType.Cylinder,new(0,1.2113f,0),Quaternion.identity, new(0.7f,0.2274f,0.7f), colorExplosif); + var explosif2 = CreatePrimitive(parent,PrimitiveType.Cylinder,new(0,1,0),Quaternion.identity, new(0.8f,0.02f,0.8f), colorExplosif); } } } diff --git a/KruacentExiled/KE.Items/Items/PickupModels/Scp3136PModel.cs b/KruacentExiled/KE.Items/Items/PickupModels/Scp3136PModel.cs index 3869f2fc..836aa583 100644 --- a/KruacentExiled/KE.Items/Items/PickupModels/Scp3136PModel.cs +++ b/KruacentExiled/KE.Items/Items/PickupModels/Scp3136PModel.cs @@ -20,7 +20,7 @@ protected override void CreateModel(Transform parent) - Primitive land = CreatePrimitive(parent, PrimitiveType.Cube, Vector3.up * -0.035f,Quaternion.identity,Vector3.one,new Color32()); + Primitive land = Primitive.Get(CreatePrimitive(parent, PrimitiveType.Cube, Vector3.up * -0.035f,Quaternion.identity,Vector3.one,new Color32())); land.Flags = AdminToys.PrimitiveFlags.None; diff --git a/KruacentExiled/KE.Items/Items/PickupModels/TPGrenadaPModel.cs b/KruacentExiled/KE.Items/Items/PickupModels/TPGrenadaPModel.cs index 76266d6b..274742ec 100644 --- a/KruacentExiled/KE.Items/Items/PickupModels/TPGrenadaPModel.cs +++ b/KruacentExiled/KE.Items/Items/PickupModels/TPGrenadaPModel.cs @@ -27,19 +27,19 @@ public TPGrenadaPModel(CustomItem customItem) : base(customItem) protected override void CreateModel(Transform parent) { - Primitive glassPrim = CreatePrimitive(parent, PrimitiveType.Cube, Vector3.zero, Quaternion.identity, glass, glassColor); + var glassPrim = CreatePrimitive(parent, PrimitiveType.Cube, Vector3.zero, Quaternion.identity, glass, glassColor); //new PrimitiveBlueprint(PrimitiveType.Cube, Vector3.zero, Quaternion.identity, glassColor, glass), - Primitive topSupport = CreatePrimitive(parent, PrimitiveType.Cube, Vector3.up, Quaternion.identity, support, colorSupport); - Primitive bottomSupport = CreatePrimitive(parent, PrimitiveType.Cube, Vector3.down, Quaternion.identity, support, colorSupport); + var topSupport = CreatePrimitive(parent, PrimitiveType.Cube, Vector3.up, Quaternion.identity, support, colorSupport); + var bottomSupport = CreatePrimitive(parent, PrimitiveType.Cube, Vector3.down, Quaternion.identity, support, colorSupport); //new PrimitiveBlueprint(PrimitiveType.Cube, Vector3.up * 12.5f, Quaternion.identity, colorSupport, support), //new PrimitiveBlueprint(PrimitiveType.Cube, Vector3.down * 12.5f, Quaternion.identity, colorSupport, support), - Primitive centralPillar = CreatePrimitive(parent, PrimitiveType.Cylinder, Vector3.zero, Quaternion.identity, pillar, centralColor); - Primitive pillar1 = CreatePrimitive(centralPillar.Transform, PrimitiveType.Cylinder, positionPillars* new Vector3(1, 0, 1), Quaternion.identity, Vector3.one, colorSupport); - Primitive pillar2 = CreatePrimitive(centralPillar.Transform, PrimitiveType.Cylinder, positionPillars * new Vector3(-1, 0, 1), Quaternion.identity, Vector3.one, colorSupport); - Primitive pillar3 = CreatePrimitive(centralPillar.Transform, PrimitiveType.Cylinder, positionPillars * new Vector3(-1, 0, -1), Quaternion.identity, Vector3.one, colorSupport); - Primitive pillar4 = CreatePrimitive(centralPillar.Transform, PrimitiveType.Cylinder, positionPillars * new Vector3(1, 0, -1), Quaternion.identity, Vector3.one, colorSupport); + var centralPillar = CreatePrimitive(parent, PrimitiveType.Cylinder, Vector3.zero, Quaternion.identity, pillar, centralColor); + var pillar1 = CreatePrimitive(centralPillar.transform, PrimitiveType.Cylinder, positionPillars* new Vector3(1, 0, 1), Quaternion.identity, Vector3.one, colorSupport); + var pillar2 = CreatePrimitive(centralPillar.transform, PrimitiveType.Cylinder, positionPillars * new Vector3(-1, 0, 1), Quaternion.identity, Vector3.one, colorSupport); + var pillar3 = CreatePrimitive(centralPillar.transform, PrimitiveType.Cylinder, positionPillars * new Vector3(-1, 0, -1), Quaternion.identity, Vector3.one, colorSupport); + var pillar4 = CreatePrimitive(centralPillar.transform, PrimitiveType.Cylinder, positionPillars * new Vector3(1, 0, -1), Quaternion.identity, Vector3.one, colorSupport); //new PrimitiveBlueprint(PrimitiveType.Cylinder, Vector3.up + Vector3.back * 6 + Vector3.right * 6, Quaternion.identity, colorSupport, pillar), //new PrimitiveBlueprint(PrimitiveType.Cylinder, Vector3.up + Vector3.forward * 6 + Vector3.right * 6, Quaternion.identity, colorSupport, pillar), //new PrimitiveBlueprint(PrimitiveType.Cylinder, Vector3.up + Vector3.back * 6 + Vector3.left * 6, Quaternion.identity, colorSupport, pillar), diff --git a/KruacentExiled/KE.Items/Items/ShieldBelt/ShieldBelt.cs b/KruacentExiled/KE.Items/Items/ShieldBelt/ShieldBelt.cs index 77d92327..1d73c2db 100644 --- a/KruacentExiled/KE.Items/Items/ShieldBelt/ShieldBelt.cs +++ b/KruacentExiled/KE.Items/Items/ShieldBelt/ShieldBelt.cs @@ -24,15 +24,14 @@ namespace KE.Items.Items.ShieldBelt { - [CustomItem(ItemType.KeycardJanitor)] - public class ShieldBelt : KECustomItem, ILumosItem + [CustomItem(ItemType.KeycardCustomSite02)] + public class ShieldBelt : KECustomKeycard { public override uint Id { get; set; } = 5982; public override string Name { get; set; } = "Shield belt"; public override string Description { get; set; } = "A projectile-repulsion device.\nIt will attempt to stop incoming projectiles or shrapnel, but does nothing against melee attacks or heat.\nIt prevents the wearer from firing out.\n(works in the inventory) "; public override float Weight { get; set; } = 0.65f; public override SpawnProperties SpawnProperties { get; set; } = null; - public Color Color { get; set; } = new Color32(255, 255, 0, 0); protected override void SubscribeEvents() { @@ -65,7 +64,7 @@ public override bool Check(Player player) protected override void OnAcquired(Player player, Item item, bool displayMessage) { if (!Check(item)) return; - player.GameObject.AddComponent(); + var comp = player.GameObject.AddComponent(); Log.Debug("player got shield"); diff --git a/KruacentExiled/KE.Items/Items/ShieldBelt/ShieldBeltStat.cs b/KruacentExiled/KE.Items/Items/ShieldBelt/ShieldBeltStat.cs index 8c4dfb62..46491ed4 100644 --- a/KruacentExiled/KE.Items/Items/ShieldBelt/ShieldBeltStat.cs +++ b/KruacentExiled/KE.Items/Items/ShieldBelt/ShieldBeltStat.cs @@ -12,11 +12,12 @@ namespace KE.Items.Items.ShieldBelt { public class ShieldBeltStat : MonoBehaviour { - public const float MaxCharge = 110; + public const float MaxCharge = 220; public const float RechargeRatePerS = 13; public const float TimeBroken = 50; public const float Base = 20; - public static readonly Vector3 MaxSize = Vector3.one * 2; + public static readonly float MaxSize = 2; + public static readonly float MinSize = 1.5f; public float CurrentCharge => currentCharge; @@ -29,7 +30,6 @@ public class ShieldBeltStat : MonoBehaviour public void RechargeTick() { - if (timeRemaining <= 0 && recharging) { Log.Debug("recharged"); @@ -44,9 +44,8 @@ public void RechargeTick() if (primitive is not null) { - float percent = currentCharge / MaxCharge; - - primitive.Scale = percent * MaxSize; + float percent = Mathf.Clamp01(currentCharge / MaxCharge); + primitive.Scale = Mathf.Lerp(MinSize, MaxSize, percent)*Vector3.one; } @@ -144,7 +143,7 @@ private Primitive CreatePrimitive(Player player) prim.Visible = true; prim.Transform.parent = player.ReferenceHub.transform; prim.Transform.localPosition = Vector3.zero; - prim.Scale = MaxSize; + prim.Scale = MaxSize*Vector3.one; prim.Color = new Color32(50, 50, 50, 50); prim.MovementSmoothing = 0; prim.Spawn(); @@ -162,6 +161,7 @@ public void Awake() timeRemaining = 0; } + public void Destroy() { Log.Debug($"destroying {this}"); From d87e8e82b607092b593941e439f9f92363aff057 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Sun, 22 Feb 2026 11:38:10 +0100 Subject: [PATCH 642/853] fix no translation setting custom scp --- KruacentExiled/KE.CustomRoles/API/Features/CustomSCP.cs | 4 ++-- KruacentExiled/KE.CustomRoles/CR/SCP/SCP173/Frozen.cs | 3 --- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/KruacentExiled/KE.CustomRoles/API/Features/CustomSCP.cs b/KruacentExiled/KE.CustomRoles/API/Features/CustomSCP.cs index 9b437b0d..54ccd82f 100644 --- a/KruacentExiled/KE.CustomRoles/API/Features/CustomSCP.cs +++ b/KruacentExiled/KE.CustomRoles/API/Features/CustomSCP.cs @@ -26,7 +26,7 @@ public override void Init() base.Init(); return; } - + base.Init(); if (header is null) { header = new(HeaderId, "SCP Spawn Preferences",string.Empty,true); @@ -35,7 +35,7 @@ public override void Init() sliderSetting= new SliderSetting(SettingId, GetTranslation("en", TranslationKeyName), MinValue, MaxValue, DefaultValue, true); SettingBase.Register([sliderSetting]); - base.Init(); + } diff --git a/KruacentExiled/KE.CustomRoles/CR/SCP/SCP173/Frozen.cs b/KruacentExiled/KE.CustomRoles/CR/SCP/SCP173/Frozen.cs index 7ea78d0b..3af8cfde 100644 --- a/KruacentExiled/KE.CustomRoles/CR/SCP/SCP173/Frozen.cs +++ b/KruacentExiled/KE.CustomRoles/CR/SCP/SCP173/Frozen.cs @@ -73,10 +73,8 @@ private void OnDeath(PlayerDeathEventArgs ev) - Log.Info("daryh"); if (ev.DamageHandler is ScpDamageHandler scpDamageHandler) { - Log.Info("damage"); Player attacker = Player.Get(scpDamageHandler.Attacker.Hub); if (Check(attacker)) @@ -88,7 +86,6 @@ private void OnDeath(PlayerDeathEventArgs ev) if (isInAPrimed) { - Log.Info("checked"); attacker.HumeShield = Mathf.Min(attacker.MaxHumeShield, attacker.HumeShield + 400f); } From 4d5de26a43c50e46e09078d14a65cc28894b82b0 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Sun, 22 Feb 2026 16:03:00 +0100 Subject: [PATCH 643/853] elevator at gate a + update --- KruacentExiled/KE.Map/KE.Map.csproj | 2 +- KruacentExiled/KE.Map/MainPlugin.cs | 2 + .../ElevatorGateA/CustomElevatorGateA.cs | 178 ++++++++++ .../ElevatorGateA/CustomKillerCollision.cs | 52 +++ .../Surface/ElevatorGateA/ElevatorModel.cs | 319 ++++++++++++++++++ .../KE.Map/Surface/ElevatorGateA/Panel.cs | 83 +++++ 6 files changed, 635 insertions(+), 1 deletion(-) create mode 100644 KruacentExiled/KE.Map/Surface/ElevatorGateA/CustomElevatorGateA.cs create mode 100644 KruacentExiled/KE.Map/Surface/ElevatorGateA/CustomKillerCollision.cs create mode 100644 KruacentExiled/KE.Map/Surface/ElevatorGateA/ElevatorModel.cs create mode 100644 KruacentExiled/KE.Map/Surface/ElevatorGateA/Panel.cs diff --git a/KruacentExiled/KE.Map/KE.Map.csproj b/KruacentExiled/KE.Map/KE.Map.csproj index d48dad88..5777c855 100644 --- a/KruacentExiled/KE.Map/KE.Map.csproj +++ b/KruacentExiled/KE.Map/KE.Map.csproj @@ -6,7 +6,7 @@ - + diff --git a/KruacentExiled/KE.Map/MainPlugin.cs b/KruacentExiled/KE.Map/MainPlugin.cs index ccc04352..57a1eb7c 100644 --- a/KruacentExiled/KE.Map/MainPlugin.cs +++ b/KruacentExiled/KE.Map/MainPlugin.cs @@ -8,6 +8,7 @@ using KE.Map.Heavy; using KE.Map.Heavy.GamblingZone; using KE.Map.Others.BlackoutNDoor.Handlers; +using KE.Map.Surface.ElevatorGateA; using KE.Utils.API.KETextToy; using MEC; using PlayerRoles; @@ -61,6 +62,7 @@ private void OnWaitingForPlayers() { PrefabManager.RegisterPrefabs(); BulkDoor049.Create(); + CustomElevatorGateA.Create(); } private void OnRoundStarted() diff --git a/KruacentExiled/KE.Map/Surface/ElevatorGateA/CustomElevatorGateA.cs b/KruacentExiled/KE.Map/Surface/ElevatorGateA/CustomElevatorGateA.cs new file mode 100644 index 00000000..124510cc --- /dev/null +++ b/KruacentExiled/KE.Map/Surface/ElevatorGateA/CustomElevatorGateA.cs @@ -0,0 +1,178 @@ +using Exiled.API.Features.Objectives; +using Exiled.API.Features.Toys; +using Exiled.Events.EventArgs.Player; +using InventorySystem.Items.Firearms.Modules.Scp127; +using MEC; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using UnityEngine; + +namespace KE.Map.Surface.ElevatorGateA +{ + public static class CustomElevatorGateA + { + + private static ElevatorModel model; + private static Primitive prim; + + + private static Primitive step; + private static Primitive help; + + private static Panel toppanel; + private static Primitive primtop; + private static Panel bottompanel; + private static Primitive primbottom; + + private const float Scale = 0.8f; + public static void Create() + { + Destroy(); + model = new(); + + toppanel = new(); + bottompanel = new(); + + CreatePrimitives(); + + CreateModels(); + baseheight = prim.Position.y; + + objective = increase; + step = Primitive.Create(PrimitiveType.Cube, new(18.4f, 300.35f, -49.27f),null,new Vector3(2,.5f,1f)); + + + model.SendingElevator += SendingElevator; + bottompanel.SendingElevator += SendingElevator; + toppanel.SendingElevator += SendingElevator; + } + + private static void CreateModels() + { + model.Create(prim.Transform); + toppanel.Create(primtop.Transform); + bottompanel.Create(primbottom.Transform); + + + model.button.NetworkMaterialColor = Color.blue; + bottompanel.button.NetworkMaterialColor = Color.blue; + toppanel.button.NetworkMaterialColor = Color.blue; + } + + private static void CreatePrimitives() + { + Vector3 pos = new(18.24f, 290.65f, -46.07f); + Vector3 helppos = new(18.24f, 255.65f, -46.07f); + Vector3 postop = new(19.92f, 299.97f, -48.95f); + Vector3 posbot = new(15.62f, 290.65f, -45.19f); + prim = Primitive.Create(pos, null, Vector3.one * Scale); + prim.Flags = AdminToys.PrimitiveFlags.None; + + primtop = Primitive.Create(postop, null, Vector3.one * Scale); + primtop.Flags = AdminToys.PrimitiveFlags.None; + + primbottom = Primitive.Create(posbot, null, Vector3.one * Scale); + primbottom.Flags = AdminToys.PrimitiveFlags.None; + + + help = Primitive.Create(PrimitiveType.Cube,helppos,null,new Vector3(50,50,50),false); + help.Flags = AdminToys.PrimitiveFlags.Visible; + help.Spawn(); + help.GameObject.AddComponent(); + } + + private static void SendingElevator() + { + Send(); + } + + public static void Destroy() + { + if(prim != null) + { + model.SendingElevator -= SendingElevator; + bottompanel.SendingElevator -= SendingElevator; + toppanel.SendingElevator -= SendingElevator; + model.Destroy(prim.Transform); + toppanel.Destroy(primtop.Transform); + bottompanel.Destroy(primbottom.Transform); + step.Destroy(); + help.Destroy(); + prim = null; + primbottom = null; + primtop = null; + step = null; + help = null; + } + + } + + private static bool isMoving = false; + + public static void Send() + { + if (isMoving) return; + if (prim == null) return; + + Timing.RunCoroutine(Sending()); + + } + + + private static float baseheight; + private static float increase = 301f; + private static float objective; + private static float duration = 5f; + private static IEnumerator Sending() + { + + isMoving = true; + model.button.NetworkMaterialColor = Color.yellow; + bottompanel.button.NetworkMaterialColor = Color.yellow; + toppanel.button.NetworkMaterialColor = Color.yellow; + + float startY = prim.Position.y; + float elapsed = 0f; + + while (elapsed < duration) + { + elapsed += Time.deltaTime; + + float t = elapsed / duration; + t = t * t * (3f - 2f * t); + + float newY = Mathf.Lerp(startY, objective, t); + + prim.Position = new Vector3( + prim.Position.x, + newY, + prim.Position.z + ); + yield return Timing.WaitForOneFrame; + } + + // Snap exactly to target (avoids tiny float mismatch) + prim.Position = new Vector3( + prim.Position.x, + objective, + prim.Position.z + ); + + // Swap target + objective = Mathf.Approximately(objective, baseheight) + ? increase + : baseheight; + + model.button.NetworkMaterialColor = Color.blue; + bottompanel.button.NetworkMaterialColor = Color.blue; + toppanel.button.NetworkMaterialColor = Color.blue; + isMoving = false; + } + + + + } +} diff --git a/KruacentExiled/KE.Map/Surface/ElevatorGateA/CustomKillerCollision.cs b/KruacentExiled/KE.Map/Surface/ElevatorGateA/CustomKillerCollision.cs new file mode 100644 index 00000000..113bd126 --- /dev/null +++ b/KruacentExiled/KE.Map/Surface/ElevatorGateA/CustomKillerCollision.cs @@ -0,0 +1,52 @@ +using CustomPlayerEffects; +using Exiled.API.Features; +using ProjectMER.Commands.Modifying.Scale; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using UnityEngine; +using UnityEngine.PlayerLoop; + +namespace KE.Map.Surface.ElevatorGateA +{ + public class CustomKillerCollision : MonoBehaviour + { + + private void Update() + { + foreach(Player player in Player.List) + { + + if (PitDeath.ValidatePlayer(player.ReferenceHub)) + { + if (InBound(player)) + { + PitDeath pit = player.GetEffect(); + if (!pit.IsEnabled) + { + pit.IsEnabled = true; + } + + } + } + } + + } + + private bool InBound(Player player) + { + Vector3 position = transform.position; + Vector3 playerPosition = player.Position; + Vector3 halfSize = transform.lossyScale / 2; + return playerPosition.x >= position.x - halfSize.x && + playerPosition.x <= position.x + halfSize.x && + playerPosition.y >= position.y - halfSize.y && + playerPosition.y <= position.y + halfSize.y && + playerPosition.z >= position.z - halfSize.z && + playerPosition.z <= position.z + halfSize.z; + } + + } +} diff --git a/KruacentExiled/KE.Map/Surface/ElevatorGateA/ElevatorModel.cs b/KruacentExiled/KE.Map/Surface/ElevatorGateA/ElevatorModel.cs new file mode 100644 index 00000000..e3babc7d --- /dev/null +++ b/KruacentExiled/KE.Map/Surface/ElevatorGateA/ElevatorModel.cs @@ -0,0 +1,319 @@ +using AdminToys; +using Exiled.API.Features.Toys; +using KE.Utils.API.Features.Models; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using UnityEngine; +using UserSettings.ServerSpecific; + +namespace KE.Map.Surface.ElevatorGateA +{ + public class ElevatorModel : ModelBase + { + public InteractableToy I_button { get; private set; } + public PrimitiveObjectToy button { get; private set; } + protected override void CreateModel(Transform parent) + { + // This code was auto-generated + + var ElevatorCabin = CreatePrimitive( + parent, + PrimitiveType.Sphere, + new Vector3(0f, 0f, 0f), + new Quaternion(0f, 0f, 0f, 1f), + new Vector3(1f, 1f, 1f), + new Color32(0, 0, 0, 0) + ); + ElevatorCabin.PrimitiveFlags = AdminToys.PrimitiveFlags.None; + + var top = CreatePrimitive( + ElevatorCabin.transform, + PrimitiveType.Sphere, + new Vector3(0f, 5f, 0f), + new Quaternion(0f, 0f, 0f, 1f), + new Vector3(1f, 1f, 1f), + new Color32(0, 0, 0, 0) + ); + top.PrimitiveFlags = AdminToys.PrimitiveFlags.None; + + var right = CreatePrimitive( + top.transform, + PrimitiveType.Cube, + new Vector3(1.666667f, 0f, 0f), + new Quaternion(0f, 0f, 0f, 1f), + new Vector3(1.666667f, 0.2f, 5f), + new Color32(255, 255, 255, 255) + ); + + var left = CreatePrimitive( + top.transform, + PrimitiveType.Cube, + new Vector3(-1.666667f, 0f, 0f), + new Quaternion(0f, 0f, 0f, 1f), + new Vector3(1.666667f, 0.2f, 5f), + new Color32(255, 255, 255, 255) + ); + + var up = CreatePrimitive( + top.transform, + PrimitiveType.Cube, + new Vector3(0f, 0f, 1.666667f), + new Quaternion(0f, 0f, 0f, 1f), + new Vector3(1.666667f, 0.2f, 1.666667f), + new Color32(255, 255, 255, 255) + ); + + var down = CreatePrimitive( + top.transform, + PrimitiveType.Cube, + new Vector3(0f, 0f, -1.666667f), + new Quaternion(0f, 0f, 0f, 1f), + new Vector3(1.666667f, 0.2f, 1.666667f), + new Color32(255, 255, 255, 255) + ); + + var panel = CreatePrimitive( + ElevatorCabin.transform, + PrimitiveType.Sphere, + new Vector3(0f, 0f, 0f), + new Quaternion(0f, 0f, 0f, 1f), + new Vector3(1f, 1f, 1f), + new Color32(0, 0, 0, 0) + ); + panel.PrimitiveFlags = AdminToys.PrimitiveFlags.None; + + var poteau = CreatePrimitive( + panel.transform, + PrimitiveType.Cube, + new Vector3(0f, 0.757f, 1.667f), + new Quaternion(0f, 0f, 0f, 1f), + new Vector3(0.15f, 1.3f, 0.15f), + new Color32(255, 255, 255, 255) + ); + + var panneau = CreatePrimitive( + panel.transform, + PrimitiveType.Cube, + new Vector3(0f, 1.397f, 1.667f), + new Quaternion(0.3775984f, 0f, 0f, 0.9259695f), + new Vector3(1f, 1f, 0.15f), + new Color32(255, 255, 255, 255) + ); + + button = CreatePrimitive( + panel.transform, + PrimitiveType.Cube, + new Vector3(0f, 1.419f, 1.644f), + new Quaternion(0.3775984f, 0f, 0f, 0.9259695f), + new Vector3(0.8f, 0.8f, 0.15f), + new Color32(255, 255, 255, 255) + ); + + I_button = CreateInteractable( + panel.transform, + new Vector3(0f, 1.434f, 1.629f), + new Quaternion(0.3775984f, 0f, 0f, 0.9259695f), + new Vector3(0.8f, 0.8f, 0.15f), + InvisibleInteractableToy.ColliderShape.Box + ); + + var bottom = CreatePrimitive( + ElevatorCabin.transform, + PrimitiveType.Sphere, + new Vector3(0f, 0f, 0f), + new Quaternion(0f, 0f, 0f, 1f), + new Vector3(1f, 1f, 1f), + new Color32(0, 0, 0, 0) + ); + bottom.PrimitiveFlags = AdminToys.PrimitiveFlags.None; + + var floor = CreatePrimitive( + bottom.transform, + PrimitiveType.Cube, + new Vector3(0f, 0f, 0f), + new Quaternion(0f, 0f, 0f, 1f), + new Vector3(5f, 0.2f, 5f), + new Color32(255, 255, 255, 255) + ); + + var fence = CreatePrimitive( + bottom.transform, + PrimitiveType.Sphere, + new Vector3(0f, 0f, 0f), + new Quaternion(0f, 0f, 0f, 1f), + new Vector3(1f, 1f, 1f), + new Color32(0, 0, 0, 0) + ); + fence.PrimitiveFlags = AdminToys.PrimitiveFlags.None; + + var pillar1 = CreatePrimitive( + fence.transform, + PrimitiveType.Cube, + new Vector3(-2.3f, 2.5f, -2.3f), + new Quaternion(0f, 0f, 0f, 1f), + new Vector3(0.1f, 4.9f, 0.1f), + new Color32(255, 255, 255, 255) + ); + + var pillar2 = CreatePrimitive( + fence.transform, + PrimitiveType.Cube, + new Vector3(-2.3f, 0.79f, -0.9f), + new Quaternion(0f, 0f, 0f, 1f), + new Vector3(0.1f, 1.4798f, 0.1f), + new Color32(255, 255, 255, 255) + ); + + var pillar3 = CreatePrimitive( + fence.transform, + PrimitiveType.Cube, + new Vector3(-2.3f, 0.79f, 0.9f), + new Quaternion(0f, 0f, 0f, 1f), + new Vector3(0.1f, 1.4798f, 0.1f), + new Color32(255, 255, 255, 255) + ); + + var pillar4 = CreatePrimitive( + fence.transform, + PrimitiveType.Cube, + new Vector3(-2.3f, 2.5f, 2.3f), + new Quaternion(0f, 0f, 0f, 1f), + new Vector3(0.1f, 4.9f, 0.1f), + new Color32(255, 255, 255, 255) + ); + + var pillar5 = CreatePrimitive( + fence.transform, + PrimitiveType.Cube, + new Vector3(2.3f, 2.5f, -2.3f), + new Quaternion(0f, 0f, 0f, 1f), + new Vector3(0.1f, 4.9f, 0.1f), + new Color32(255, 255, 255, 255) + ); + + var pillar6 = CreatePrimitive( + fence.transform, + PrimitiveType.Cube, + new Vector3(2.3f, 0.79f, 0f), + new Quaternion(0f, 0f, 0f, 1f), + new Vector3(0.1f, 1.4798f, 0.1f), + new Color32(255, 255, 255, 255) + ); + + var pillar8 = CreatePrimitive( + fence.transform, + PrimitiveType.Cube, + new Vector3(2.3f, 2.5f, 2.3f), + new Quaternion(0f, 0f, 0f, 1f), + new Vector3(0.1f, 4.9f, 0.1f), + new Color32(255, 255, 255, 255) + ); + + var pillar9 = CreatePrimitive( + fence.transform, + PrimitiveType.Cube, + new Vector3(0f, 0.79f, 2.3f), + new Quaternion(0f, 0f, 0f, 1f), + new Vector3(0.1f, 1.4798f, 0.1f), + new Color32(255, 255, 255, 255) + ); + + var pillar10 = CreatePrimitive( + fence.transform, + PrimitiveType.Cube, + new Vector3(-0.9f, 0.79f, -2.3f), + new Quaternion(0f, 0f, 0f, 1f), + new Vector3(0.1f, 1.4798f, 0.1f), + new Color32(255, 255, 255, 255) + ); + + var pillar11 = CreatePrimitive( + fence.transform, + PrimitiveType.Cube, + new Vector3(0.9f, 0.79f, -2.3f), + new Quaternion(0f, 0f, 0f, 1f), + new Vector3(0.1f, 1.4798f, 0.1f), + new Color32(255, 255, 255, 255) + ); + + var fenceback = CreatePrimitive( + fence.transform, + PrimitiveType.Cube, + new Vector3(0f, 1.439f, 2.3f), + new Quaternion(0f, 0f, 0f, 1f), + new Vector3(5f, 0.2f, 0.2f), + new Color32(255, 255, 255, 255) + ); + + var fenceright = CreatePrimitive( + fence.transform, + PrimitiveType.Cube, + new Vector3(2.3f, 1.439f, 0f), + new Quaternion(0f, 0f, 0f, 1f), + new Vector3(0.2f, 0.2f, 5f), + new Color32(255, 255, 255, 255) + ); + + var fenceleft1 = CreatePrimitive( + fence.transform, + PrimitiveType.Cube, + new Vector3(-2.3f, 1.439f, 1.6f), + new Quaternion(0f, 0f, 0f, 1f), + new Vector3(0.2f, 0.2f, 1.7f), + new Color32(255, 255, 255, 255) + ); + + var fenceleft2 = CreatePrimitive( + fence.transform, + PrimitiveType.Cube, + new Vector3(-2.3f, 1.439f, -1.6f), + new Quaternion(0f, 0f, 0f, 1f), + new Vector3(0.2f, 0.2f, 1.7f), + new Color32(255, 255, 255, 255) + ); + + var fencefront1 = CreatePrimitive( + fence.transform, + PrimitiveType.Cube, + new Vector3(1.6f, 1.439f, -2.35f), + new Quaternion(0f, 0f, 0f, 1f), + new Vector3(1.7f, 0.2f, 0.2f), + new Color32(255, 255, 255, 255) + ); + + var fencefront2 = CreatePrimitive( + fence.transform, + PrimitiveType.Cube, + new Vector3(-1.6f, 1.439f, -2.3f), + new Quaternion(0f, 0f, 0f, 1f), + new Vector3(1.7f, 0.2f, 0.2f), + new Color32(255, 255, 255, 255) + ); + + var waypoint = CreateWaypoint( + ElevatorCabin.transform, + new Vector3(0f, 3.96f, 0f), + new Quaternion(0f, 0f, 0f, 1f), + new Vector3(4.9f, 7.870179f, 4.9f) + ); + I_button.Base.OnInteracted += Base_OnInteracted; + } + + public override void Destroy(Transform parent) + { + I_button.Base.OnInteracted -= Base_OnInteracted; + base.Destroy(parent); + } + + + public event Action SendingElevator = delegate { }; + + private void Base_OnInteracted(ReferenceHub obj) + { + SendingElevator?.Invoke(); + } + } +} diff --git a/KruacentExiled/KE.Map/Surface/ElevatorGateA/Panel.cs b/KruacentExiled/KE.Map/Surface/ElevatorGateA/Panel.cs new file mode 100644 index 00000000..f1e5b90f --- /dev/null +++ b/KruacentExiled/KE.Map/Surface/ElevatorGateA/Panel.cs @@ -0,0 +1,83 @@ +using AdminToys; +using Exiled.API.Features.Toys; +using KE.Utils.API.Features.Models; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using UnityEngine; +using UserSettings.ServerSpecific; + +namespace KE.Map.Surface.ElevatorGateA +{ + public class Panel : ModelBase + { + public InteractableToy I_button { get; private set; } + public PrimitiveObjectToy button { get; private set; } + protected override void CreateModel(Transform parent) + { + // This code was auto-generated + var panel = CreatePrimitive( + parent, + PrimitiveType.Sphere, + new Vector3(0f, 0f, 0f), + new Quaternion(0f, 0f, 0f, 1f), + new Vector3(1f, 1f, 1f), + new Color32(0, 0, 0, 0) + ); + panel.PrimitiveFlags = AdminToys.PrimitiveFlags.None; + + var poteau = CreatePrimitive( + panel.transform, + PrimitiveType.Cube, + new Vector3(0f, 0.757f, 0f), + new Quaternion(0f, 0f, 0f, 1f), + new Vector3(0.15f, 1.3f, 0.15f), + new Color32(255, 255, 255, 255) + ); + + var panneau = CreatePrimitive( + panel.transform, + PrimitiveType.Cube, + new Vector3(0f, 1.397f, 0f), + new Quaternion(0.3775984f, 0f, 0f, 0.9259695f), + new Vector3(1f, 1f, 0.15f), + new Color32(255, 255, 255, 255) + ); + + button = CreatePrimitive( + panel.transform, + PrimitiveType.Cube, + new Vector3(0f, 1.419f, 0f), + new Quaternion(0.3775984f, 0f, 0f, 0.9259695f), + new Vector3(0.8f, 0.8f, 0.15f), + new Color32(255, 255, 255, 255) + ); + + I_button = CreateInteractable( + panel.transform, + new Vector3(0f, 1.46f, -0.042f), + new Quaternion(0.3775984f, 0f, 0f, 0.9259695f), + new Vector3(0.8f, 0.8f, 0.15f), + InvisibleInteractableToy.ColliderShape.Box + ); + I_button.Base.OnInteracted += Base_OnInteracted; + } + + public override void Destroy(Transform parent) + { + I_button.Base.OnInteracted -= Base_OnInteracted; + base.Destroy(parent); + } + + + + public event Action SendingElevator = delegate { }; + + private void Base_OnInteracted(ReferenceHub obj) + { + SendingElevator?.Invoke(); + } + } +} From d9518cbbd99764e0f6ba33fe2c69da85ae50b95e Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Sun, 22 Feb 2026 16:34:58 +0100 Subject: [PATCH 644/853] settings --- .../KE.CustomRoles/API/Features/CustomSCP.cs | 8 +++-- KruacentExiled/KE.CustomRoles/MainPlugin.cs | 1 - .../KE.CustomRoles/Settings/SettingHandler.cs | 30 +++++++++---------- 3 files changed, 21 insertions(+), 18 deletions(-) diff --git a/KruacentExiled/KE.CustomRoles/API/Features/CustomSCP.cs b/KruacentExiled/KE.CustomRoles/API/Features/CustomSCP.cs index 54ccd82f..5ab3c6e1 100644 --- a/KruacentExiled/KE.CustomRoles/API/Features/CustomSCP.cs +++ b/KruacentExiled/KE.CustomRoles/API/Features/CustomSCP.cs @@ -1,6 +1,7 @@ using Exiled.API.Features; using Exiled.API.Features.Core.UserSettings; using KE.Utils.API.Features.SCPs; +using KE.Utils.API.Settings; using System.Collections.Generic; using System.Linq; @@ -27,14 +28,17 @@ public override void Init() return; } base.Init(); + var list = new List(); + if (header is null) { header = new(HeaderId, "SCP Spawn Preferences",string.Empty,true); - SettingBase.Register([header]); + list.Add(header); } sliderSetting= new SliderSetting(SettingId, GetTranslation("en", TranslationKeyName), MinValue, MaxValue, DefaultValue, true); - SettingBase.Register([sliderSetting]); + list.Add(sliderSetting); + SettingBase.Register(list); } diff --git a/KruacentExiled/KE.CustomRoles/MainPlugin.cs b/KruacentExiled/KE.CustomRoles/MainPlugin.cs index 791aef97..e33516b6 100644 --- a/KruacentExiled/KE.CustomRoles/MainPlugin.cs +++ b/KruacentExiled/KE.CustomRoles/MainPlugin.cs @@ -84,7 +84,6 @@ public override void OnDisabled() UnsubscribeEvents(); CustomTeamEvents.UnsubscribeEvents(); CustomStatsEvents.UnsubscribeEvents(); - Utils.API.Settings.SettingHandler.Instance.UnsubscribeEvents(); _settingHandler = null; Instance = null; base.OnDisabled(); diff --git a/KruacentExiled/KE.CustomRoles/Settings/SettingHandler.cs b/KruacentExiled/KE.CustomRoles/Settings/SettingHandler.cs index 759d6a83..496ddc1e 100644 --- a/KruacentExiled/KE.CustomRoles/Settings/SettingHandler.cs +++ b/KruacentExiled/KE.CustomRoles/Settings/SettingHandler.cs @@ -36,24 +36,27 @@ internal class SettingHandler : IUsingEvents public static SettingHandler Instance { get; private set; } private List settings; - public readonly SettingsPage page; - public readonly SettingsPage hintpage = null; + //public readonly SettingsPage page; + //public readonly SettingsPage hintpage = null; public const string baseArrow = "<--"; public SettingHandler() { Instance = this; + HeaderSetting header = new HeaderSetting(_idHeader, "Custom Roles", padding: true); + SettingBase arrow = SettingBase.Create(new SSPlaintextSetting(_idArrow, "Personalize the arrow next to the selected ability", baseArrow, 16, TMP_InputField.ContentType.Standard, string.Empty, 0)); + arrow.Header = header; settings = new List() { - new HeaderSetting(_idHeader,"Custom Roles",padding:true), - - new TwoButtonsSetting(_idDesc,"Descriptions","Disabled","Enabled",true,"hide/show the description the Custom Role "), - new SliderSetting(_idTimeCustomRole,"Time shown",0,30,20), - new SliderSetting(_idTimeAbilityDesc,"Ability Description time shown",0,30,20), - new KeybindSetting(_idUp, "Select up", UnityEngine.KeyCode.None), - new KeybindSetting(_idDown, "Select down", UnityEngine.KeyCode.None), - new KeybindSetting(_idSelect, "Use selected ability", UnityEngine.KeyCode.None), - SettingBase.Create(new SSPlaintextSetting(_idArrow, "Personalize the arrow next to the selected ability", baseArrow, 16, TMP_InputField.ContentType.Standard, string.Empty, 0)), - new ButtonSetting(_idReshowCustomRole, "Reshow Custom role description","click") + header, + + new TwoButtonsSetting(_idDesc,"Descriptions","Disabled","Enabled",true,"hide/show the description the Custom Role ",header:header), + new SliderSetting(_idTimeCustomRole,"Time shown",0,30,20,header:header), + new SliderSetting(_idTimeAbilityDesc,"Ability Description time shown",0,30,20,header:header), + new KeybindSetting(_idUp, "Select up", UnityEngine.KeyCode.None,header:header), + new KeybindSetting(_idDown, "Select down", UnityEngine.KeyCode.None,header:header), + new KeybindSetting(_idSelect, "Use selected ability", UnityEngine.KeyCode.None,header:header), + arrow, + new ButtonSetting(_idReshowCustomRole, "Reshow Custom role description","click",header:header) }; @@ -76,9 +79,6 @@ public SettingHandler() } - - - SettingBase.Register(settings); From b618b9abf3dc5253a6c84e4f85c2a92bf324c383 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Sun, 22 Feb 2026 16:55:49 +0100 Subject: [PATCH 645/853] sun --- .../API/Core/Settings/SettingsHandler.cs | 2 +- .../KE.Items/Items/LeSoleil/LeSoleil.cs | 73 +++++++++++++++++++ .../KE.Items/Items/LeSoleil/SoleilComp.cs | 66 +++++++++++++++++ 3 files changed, 140 insertions(+), 1 deletion(-) create mode 100644 KruacentExiled/KE.Items/Items/LeSoleil/LeSoleil.cs create mode 100644 KruacentExiled/KE.Items/Items/LeSoleil/SoleilComp.cs diff --git a/KruacentExiled/KE.Items/API/Core/Settings/SettingsHandler.cs b/KruacentExiled/KE.Items/API/Core/Settings/SettingsHandler.cs index aad2db59..1d2a1ad2 100644 --- a/KruacentExiled/KE.Items/API/Core/Settings/SettingsHandler.cs +++ b/KruacentExiled/KE.Items/API/Core/Settings/SettingsHandler.cs @@ -26,7 +26,7 @@ internal class SettingsHandler : IUsingEvents private const int _idTimeCustomItem = 2; private const int _idTimeCustomItemEffect = 3; - public readonly SettingsPage page; + //public readonly SettingsPage page; public SettingsHandler() diff --git a/KruacentExiled/KE.Items/Items/LeSoleil/LeSoleil.cs b/KruacentExiled/KE.Items/Items/LeSoleil/LeSoleil.cs new file mode 100644 index 00000000..b0f91aff --- /dev/null +++ b/KruacentExiled/KE.Items/Items/LeSoleil/LeSoleil.cs @@ -0,0 +1,73 @@ +using AdminToys; +using Exiled.API.Enums; +using Exiled.API.Features.Attributes; +using Exiled.API.Features.Spawn; +using Exiled.API.Features.Toys; +using Exiled.Events.EventArgs.Map; +using Exiled.Events.EventArgs.Player; +using KE.Items.API.Core.Models; +using KE.Items.API.Core.Upgrade; +using KE.Items.API.Features; +using KE.Items.API.Interface; +using KE.Items.Items.ItemEffects; +using KE.Items.Items.PickupModels; +using Scp914; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using UnityEngine; + +namespace KE.Items.Items.LeSoleil +{ + [CustomItem(ItemType.GrenadeFlash)] + public class LeSoleil : KECustomGrenade, IUpgradableCustomItem + { + public override uint Id { get; set; } = 9999; + public override string Name { get; set; } = "Le Soleil"; + public override string Description { get; set; } = "How can you even carry that?"; + public override float Weight { get; set; } = 0.65f; + public override float FuseTime { get; set; } = 5f; + public override bool ExplodeOnCollision { get; set; } = true; + + public IReadOnlyDictionary Upgrade => new Dictionary() + { + //[Scp914KnobSetting.OneToOne] = new UpgradeProperties(100, 1051) + }; + public override SpawnProperties SpawnProperties { get; set; } = new SpawnProperties() + { + + }; + protected override void SubscribeEvents() + { + + base.SubscribeEvents(); + } + + protected override void UnsubscribeEvents() + { + + base.UnsubscribeEvents(); + } + + + + protected override void OnExploding(ExplodingGrenadeEventArgs ev) + { + CastTheSun(ev.Position); + } + + private void CastTheSun(Vector3 position) + { + Primitive prim = Primitive.Create(position, null, null, false); + prim.Flags = AdminToys.PrimitiveFlags.None; + + SoleilComp comp =prim.GameObject.AddComponent(); + + comp.Init(prim); + } + + + } +} diff --git a/KruacentExiled/KE.Items/Items/LeSoleil/SoleilComp.cs b/KruacentExiled/KE.Items/Items/LeSoleil/SoleilComp.cs new file mode 100644 index 00000000..f1397d41 --- /dev/null +++ b/KruacentExiled/KE.Items/Items/LeSoleil/SoleilComp.cs @@ -0,0 +1,66 @@ +using Exiled.API.Features.Toys; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using UnityEngine; +using Utf8Json.Formatters; +using Light = Exiled.API.Features.Toys.Light; + +namespace KE.Items.Items.LeSoleil +{ + public class SoleilComp : MonoBehaviour + { + + public float TimeActive { get; set; } + + + private Primitive @base = null; + + private Primitive Sun; + private Light Light; + public void Init(Primitive prim) + { + @base = prim; + TimeActive = 30; + Light = Light.Create(@base.Position, null, null, false); + Light.LightType = LightType.Point; + Light.Color = Color.yellow; + Light.Intensity = 50; + Light.Range = 300; + + Sun = Primitive.Create(@base.Position, null, Vector3.one * 3, false); + Sun.Color = Color.yellow; + Sun.Collidable = false; + + Sun.Spawn(); + Light.Spawn(); + } + + + + + + private void Update() + { + if (@base == null) return; + TimeActive -= Time.deltaTime; + + if(TimeActive <= 0) + { + Destroy(); + } + + } + + + public void Destroy() + { + Destroy(this); + @base.Destroy(); + @base = null; + } + + } +} From c83ca582c979cad8a4342d808fe6952d676aa4cf Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Mon, 23 Feb 2026 08:33:27 +0100 Subject: [PATCH 646/853] soley --- .../KE.Items/Items/LeSoleil/LeSoleil.cs | 19 ++---- .../KE.Items/Items/LeSoleil/SoleilComp.cs | 64 +++++++++++++++---- KruacentExiled/KE.Items/Items/PressePuree.cs | 4 +- 3 files changed, 56 insertions(+), 31 deletions(-) diff --git a/KruacentExiled/KE.Items/Items/LeSoleil/LeSoleil.cs b/KruacentExiled/KE.Items/Items/LeSoleil/LeSoleil.cs index b0f91aff..5c993a0f 100644 --- a/KruacentExiled/KE.Items/Items/LeSoleil/LeSoleil.cs +++ b/KruacentExiled/KE.Items/Items/LeSoleil/LeSoleil.cs @@ -26,7 +26,7 @@ public class LeSoleil : KECustomGrenade, IUpgradableCustomItem { public override uint Id { get; set; } = 9999; public override string Name { get; set; } = "Le Soleil"; - public override string Description { get; set; } = "How can you even carry that?"; + public override string Description { get; set; } = "Probably not the best idea to use it"; public override float Weight { get; set; } = 0.65f; public override float FuseTime { get; set; } = 5f; public override bool ExplodeOnCollision { get; set; } = true; @@ -39,27 +39,16 @@ public class LeSoleil : KECustomGrenade, IUpgradableCustomItem { }; - protected override void SubscribeEvents() - { - - base.SubscribeEvents(); - } - - protected override void UnsubscribeEvents() - { - - base.UnsubscribeEvents(); - } - protected override void OnExploding(ExplodingGrenadeEventArgs ev) { - CastTheSun(ev.Position); + CastTheSun(); } - private void CastTheSun(Vector3 position) + private void CastTheSun() { + Vector3 position = new(58.72f, 300, 20f); Primitive prim = Primitive.Create(position, null, null, false); prim.Flags = AdminToys.PrimitiveFlags.None; diff --git a/KruacentExiled/KE.Items/Items/LeSoleil/SoleilComp.cs b/KruacentExiled/KE.Items/Items/LeSoleil/SoleilComp.cs index f1397d41..90e856f4 100644 --- a/KruacentExiled/KE.Items/Items/LeSoleil/SoleilComp.cs +++ b/KruacentExiled/KE.Items/Items/LeSoleil/SoleilComp.cs @@ -1,4 +1,6 @@ -using Exiled.API.Features.Toys; +using Exiled.API.Features; +using Exiled.API.Features.Toys; +using KE.Utils.API.Features; using System; using System.Collections.Generic; using System.Linq; @@ -19,35 +21,50 @@ public class SoleilComp : MonoBehaviour private Primitive @base = null; private Primitive Sun; - private Light Light; + private Light[] Lights; public void Init(Primitive prim) { @base = prim; - TimeActive = 30; - Light = Light.Create(@base.Position, null, null, false); - Light.LightType = LightType.Point; - Light.Color = Color.yellow; - Light.Intensity = 50; - Light.Range = 300; + @base.Spawn(); + TimeActive = 300; + Lights = new Light[3]; + time = 0; + Sun = Primitive.Create(@base.Position, null, Vector3.one * 3, false); Sun.Color = Color.yellow; Sun.Collidable = false; + Light l = Light.Create(@base.Position, null, null, false); + l.LightType = LightType.Directional; + l.Color = Color.yellow; + l.Intensity = 10; + l.Rotation = Quaternion.Euler(135, 0, 0); + l.ShadowType = LightShadows.None; + Lights[0] = l; + l.Spawn(); + + KELog.Debug("soucisse"); + Sun.Spawn(); - Light.Spawn(); } - + private float time; private void Update() { if (@base == null) return; - TimeActive -= Time.deltaTime; + time += Time.deltaTime; + + float intensity = time / 2; - if(TimeActive <= 0) + Lights[0].Intensity = Mathf.Min(50, intensity); + + Sun.Scale = Mathf.Min(50, intensity)* Vector3.one; + + if (time >= TimeActive) { Destroy(); } @@ -55,11 +72,30 @@ private void Update() } + private void OnDestroy() + { + try + { + Lights[0].Destroy(); + Lights = null; + Sun.Destroy(); + Sun = null; + @base.Destroy(); + @base = null; + } + catch(Exception e) + { + Log.Error(e); + } + + Log.Debug("on desroy"); + } + public void Destroy() { + Log.Debug("desroy"); Destroy(this); - @base.Destroy(); - @base = null; + } } diff --git a/KruacentExiled/KE.Items/Items/PressePuree.cs b/KruacentExiled/KE.Items/Items/PressePuree.cs index e9ff924e..2659f622 100644 --- a/KruacentExiled/KE.Items/Items/PressePuree.cs +++ b/KruacentExiled/KE.Items/Items/PressePuree.cs @@ -82,13 +82,13 @@ private void OnExplodeDestructible(OnExplodeDestructibleEventsArgs ev) Player player = Player.Get(ev.Destructible.NetworkId); if (!Check(Projectile.Get(ev.ExplosionGrenade))) return; if (ev.Damage < 0f) return; - ev.Damage /= 2; + ev.Damage /= 2f; if(player is not null && player.IsScp) { - ev.Damage /= 3; + ev.Damage /= 3f; } Log.Debug("new daamager="+ev.Damage); From 89f2bf0605eaac7784389180fd15921564df7e2e Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Mon, 23 Feb 2026 08:36:45 +0100 Subject: [PATCH 647/853] kelog --- KruacentExiled/KE.CustomRoles/Abilities/Explode.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/KruacentExiled/KE.CustomRoles/Abilities/Explode.cs b/KruacentExiled/KE.CustomRoles/Abilities/Explode.cs index 8d2431c6..5eed75bd 100644 --- a/KruacentExiled/KE.CustomRoles/Abilities/Explode.cs +++ b/KruacentExiled/KE.CustomRoles/Abilities/Explode.cs @@ -5,6 +5,7 @@ using InventorySystem.Items.ThrowableProjectiles; using KE.CustomRoles.API.Features; using KE.CustomRoles.API.Interfaces; +using KE.Utils.API.Features; using System; using System.Collections.Generic; using System.Linq; @@ -65,7 +66,7 @@ protected override bool AbilityUsed(Player player) grenade.SpawnActive(player.Position); Grenades.Add(grenade.Projectile.Base); - Log.Debug("Grenade spawned"); + KELog.Debug("Grenade spawned"); return base.AbilityUsed(player); } @@ -75,7 +76,7 @@ private void ExplodeEvent_ExplodeDestructible(Items.API.Events.OnExplodeDestruct obj.Damage = 75; - Log.Debug("explode with "+ obj.Damage); + KELog.Debug("explode with "+ obj.Damage); } } From b984651d42806d451f5603731f7cd9bdc478ecf6 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Mon, 23 Feb 2026 08:43:38 +0100 Subject: [PATCH 648/853] log --- .../KE.Items/API/Features/KECustomGrenade.cs | 2 ++ KruacentExiled/KE.Items/Items/PressePuree.cs | 11 ++++++----- KruacentExiled/KE.Items/KE.Items.csproj | 2 +- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/KruacentExiled/KE.Items/API/Features/KECustomGrenade.cs b/KruacentExiled/KE.Items/API/Features/KECustomGrenade.cs index de94f81e..b5319c27 100644 --- a/KruacentExiled/KE.Items/API/Features/KECustomGrenade.cs +++ b/KruacentExiled/KE.Items/API/Features/KECustomGrenade.cs @@ -7,6 +7,7 @@ using Exiled.Events.EventArgs.Player; using KE.Items.API.Events; using KE.Items.API.Features.SpawnPoints; +using KE.Utils.API.Features; using System.Collections.Generic; using System.Linq; using static KE.Items.API.Features.SpawnPoints.PoseRoomSpawnPointHandler; @@ -78,6 +79,7 @@ private void OnExplodeDestructible(OnExplodeDestructibleEventsArgs ev) { Player player = Player.Get(ev.Destructible.NetworkId); + KELog.Debug("damage =" + ev.Damage); if (!Check(Pickup.Get(ev.ExplosionGrenade))) return; if (ev.Damage < 0f) return; ev.Damage *= DamageModifier; diff --git a/KruacentExiled/KE.Items/Items/PressePuree.cs b/KruacentExiled/KE.Items/Items/PressePuree.cs index 2659f622..9e69bbc6 100644 --- a/KruacentExiled/KE.Items/Items/PressePuree.cs +++ b/KruacentExiled/KE.Items/Items/PressePuree.cs @@ -12,6 +12,7 @@ using KE.Items.API.Features; using KE.Items.API.Interface; using KE.Items.Items.PickupModels; +using KE.Utils.API.Features; using Scp914; using System; using System.Collections.Generic; @@ -78,20 +79,20 @@ protected override void UnsubscribeEvents() private void OnExplodeDestructible(OnExplodeDestructibleEventsArgs ev) { - Log.Debug("old dmagea="+ev.Damage); + KELog.Debug("old dmagea="+ev.Damage); Player player = Player.Get(ev.Destructible.NetworkId); if (!Check(Projectile.Get(ev.ExplosionGrenade))) return; - if (ev.Damage < 0f) return; - ev.Damage /= 2f; + if (ev.Damage < 0f) return; + ev.Damage /= 2f; - if(player is not null && player.IsScp) + if (player is not null && player.IsScp) { ev.Damage /= 3f; } - Log.Debug("new daamager="+ev.Damage); + KELog.Debug("new daamager="+ev.Damage); } diff --git a/KruacentExiled/KE.Items/KE.Items.csproj b/KruacentExiled/KE.Items/KE.Items.csproj index 30aada85..f22e6e05 100644 --- a/KruacentExiled/KE.Items/KE.Items.csproj +++ b/KruacentExiled/KE.Items/KE.Items.csproj @@ -6,7 +6,7 @@ - + From ba16a44dd29c36f3978fec8cef0d24ca46cf970b Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Mon, 23 Feb 2026 11:15:10 +0100 Subject: [PATCH 649/853] explode doesn't reduce damage idk why --- KruacentExiled/KE.CustomRoles/Abilities/Explode.cs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/KruacentExiled/KE.CustomRoles/Abilities/Explode.cs b/KruacentExiled/KE.CustomRoles/Abilities/Explode.cs index 5eed75bd..1fe8f891 100644 --- a/KruacentExiled/KE.CustomRoles/Abilities/Explode.cs +++ b/KruacentExiled/KE.CustomRoles/Abilities/Explode.cs @@ -72,10 +72,14 @@ protected override bool AbilityUsed(Player player) private void ExplodeEvent_ExplodeDestructible(Items.API.Events.OnExplodeDestructibleEventsArgs obj) { + + if (!Grenades.Contains(obj.ExplosionGrenade)) return; obj.Damage = 75; + Grenades.Remove(obj.ExplosionGrenade); + KELog.Debug("explode with "+ obj.Damage); } From a00f426e9a3902b3d828327bd757414c08db6c40 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Mon, 23 Feb 2026 11:15:58 +0100 Subject: [PATCH 650/853] =?UTF-8?q?presse=20pur=C3=A9e=20doesn't=20damage?= =?UTF-8?q?=20idk=20why?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- KruacentExiled/KE.Items/Items/PressePuree.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/KruacentExiled/KE.Items/Items/PressePuree.cs b/KruacentExiled/KE.Items/Items/PressePuree.cs index 9e69bbc6..59f923d5 100644 --- a/KruacentExiled/KE.Items/Items/PressePuree.cs +++ b/KruacentExiled/KE.Items/Items/PressePuree.cs @@ -24,7 +24,7 @@ public class PressePuree : KECustomGrenade, IUpgradableCustomItem, ICustomPickup { public override uint Id { get; set; } = 1046; public override string Name { get; set; } = "Presse Purée"; - public override string Description { get; set; } = "The grenade explode at impact but does less damage"; + public override string Description { get; set; } = "THIS ITEM DOESNT CURRENTLY DO DAMAGE !!!!!!\nThe grenade explode at impact but does less damage"; public override float Weight { get; set; } = 0.65f; public override float FuseTime { get; set; } = 5f; public override bool ExplodeOnCollision { get; set; } = true; From 92a4c8142e8514639056db9c2163b0261422e1c0 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Mon, 23 Feb 2026 11:44:17 +0100 Subject: [PATCH 651/853] elevaor --- .../ElevatorGateA/CustomElevatorGateA.cs | 2 - .../Surface/ElevatorGateA/ElevatorModel.cs | 180 ++++++++++++------ 2 files changed, 119 insertions(+), 63 deletions(-) diff --git a/KruacentExiled/KE.Map/Surface/ElevatorGateA/CustomElevatorGateA.cs b/KruacentExiled/KE.Map/Surface/ElevatorGateA/CustomElevatorGateA.cs index 124510cc..2c826eeb 100644 --- a/KruacentExiled/KE.Map/Surface/ElevatorGateA/CustomElevatorGateA.cs +++ b/KruacentExiled/KE.Map/Surface/ElevatorGateA/CustomElevatorGateA.cs @@ -154,14 +154,12 @@ private static IEnumerator Sending() yield return Timing.WaitForOneFrame; } - // Snap exactly to target (avoids tiny float mismatch) prim.Position = new Vector3( prim.Position.x, objective, prim.Position.z ); - // Swap target objective = Mathf.Approximately(objective, baseheight) ? increase : baseheight; diff --git a/KruacentExiled/KE.Map/Surface/ElevatorGateA/ElevatorModel.cs b/KruacentExiled/KE.Map/Surface/ElevatorGateA/ElevatorModel.cs index e3babc7d..46fb55e8 100644 --- a/KruacentExiled/KE.Map/Surface/ElevatorGateA/ElevatorModel.cs +++ b/KruacentExiled/KE.Map/Surface/ElevatorGateA/ElevatorModel.cs @@ -29,6 +29,57 @@ protected override void CreateModel(Transform parent) ); ElevatorCabin.PrimitiveFlags = AdminToys.PrimitiveFlags.None; + var panel = CreatePrimitive( + ElevatorCabin.transform, + PrimitiveType.Sphere, + new Vector3(0f, 0f, 1.663f), + new Quaternion(0f, 0f, 0f, 1f), + new Vector3(1f, 1f, 1f), + new Color32(0, 0, 0, 0) + ); + panel.PrimitiveFlags = AdminToys.PrimitiveFlags.None; + + var poteau = CreatePrimitive( + panel.transform, + PrimitiveType.Cube, + new Vector3(0f, 0.757f, 0f), + new Quaternion(0f, 0f, 0f, 1f), + new Vector3(0.15f, 1.3f, 0.15f), + new Color32(255, 255, 255, 255), + 60 + + ); + + var panneau = CreatePrimitive( + panel.transform, + PrimitiveType.Cube, + new Vector3(0f, 1.397f, 0f), + new Quaternion(0.3775984f, 0f, 0f, 0.9259695f), + new Vector3(1f, 1f, 0.15f), + new Color32(255, 255, 255, 255), + 60 + + ); + + button = CreatePrimitive( + panel.transform, + PrimitiveType.Cube, + new Vector3(0f, 1.419f, 0f), + new Quaternion(0.3775984f, 0f, 0f, 0.9259695f), + new Vector3(0.8f, 0.8f, 0.15f), + new Color32(255, 255, 255, 255), + 60 + + ); + + I_button = CreateInteractable( + panel.transform, + new Vector3(0f, 1.46f, -0.042f), + new Quaternion(0.3775984f, 0f, 0f, 0.9259695f), + new Vector3(0.8f, 0.8f, 0.15f), + InvisibleInteractableToy.ColliderShape.Box + ); + var top = CreatePrimitive( ElevatorCabin.transform, PrimitiveType.Sphere, @@ -45,7 +96,9 @@ protected override void CreateModel(Transform parent) new Vector3(1.666667f, 0f, 0f), new Quaternion(0f, 0f, 0f, 1f), new Vector3(1.666667f, 0.2f, 5f), - new Color32(255, 255, 255, 255) + new Color32(255, 255, 255, 255), + 60 + ); var left = CreatePrimitive( @@ -54,7 +107,9 @@ protected override void CreateModel(Transform parent) new Vector3(-1.666667f, 0f, 0f), new Quaternion(0f, 0f, 0f, 1f), new Vector3(1.666667f, 0.2f, 5f), - new Color32(255, 255, 255, 255) + new Color32(255, 255, 255, 255), + 60 + ); var up = CreatePrimitive( @@ -63,7 +118,9 @@ protected override void CreateModel(Transform parent) new Vector3(0f, 0f, 1.666667f), new Quaternion(0f, 0f, 0f, 1f), new Vector3(1.666667f, 0.2f, 1.666667f), - new Color32(255, 255, 255, 255) + new Color32(255, 255, 255, 255), + 60 + ); var down = CreatePrimitive( @@ -72,53 +129,20 @@ protected override void CreateModel(Transform parent) new Vector3(0f, 0f, -1.666667f), new Quaternion(0f, 0f, 0f, 1f), new Vector3(1.666667f, 0.2f, 1.666667f), - new Color32(255, 255, 255, 255) + new Color32(255, 255, 255, 255), + 60 + ); - var panel = CreatePrimitive( - ElevatorCabin.transform, + var Spot_Light = CreatePrimitive( + top.transform, PrimitiveType.Sphere, - new Vector3(0f, 0f, 0f), - new Quaternion(0f, 0f, 0f, 1f), + new Vector3(0f, -0.18f, 1.57f), + new Quaternion(0.7071068f, 0f, 0f, 0.7071068f), new Vector3(1f, 1f, 1f), new Color32(0, 0, 0, 0) ); - panel.PrimitiveFlags = AdminToys.PrimitiveFlags.None; - - var poteau = CreatePrimitive( - panel.transform, - PrimitiveType.Cube, - new Vector3(0f, 0.757f, 1.667f), - new Quaternion(0f, 0f, 0f, 1f), - new Vector3(0.15f, 1.3f, 0.15f), - new Color32(255, 255, 255, 255) - ); - - var panneau = CreatePrimitive( - panel.transform, - PrimitiveType.Cube, - new Vector3(0f, 1.397f, 1.667f), - new Quaternion(0.3775984f, 0f, 0f, 0.9259695f), - new Vector3(1f, 1f, 0.15f), - new Color32(255, 255, 255, 255) - ); - - button = CreatePrimitive( - panel.transform, - PrimitiveType.Cube, - new Vector3(0f, 1.419f, 1.644f), - new Quaternion(0.3775984f, 0f, 0f, 0.9259695f), - new Vector3(0.8f, 0.8f, 0.15f), - new Color32(255, 255, 255, 255) - ); - - I_button = CreateInteractable( - panel.transform, - new Vector3(0f, 1.434f, 1.629f), - new Quaternion(0.3775984f, 0f, 0f, 0.9259695f), - new Vector3(0.8f, 0.8f, 0.15f), - InvisibleInteractableToy.ColliderShape.Box - ); + Spot_Light.PrimitiveFlags = AdminToys.PrimitiveFlags.None; var bottom = CreatePrimitive( ElevatorCabin.transform, @@ -136,7 +160,9 @@ protected override void CreateModel(Transform parent) new Vector3(0f, 0f, 0f), new Quaternion(0f, 0f, 0f, 1f), new Vector3(5f, 0.2f, 5f), - new Color32(255, 255, 255, 255) + new Color32(255, 255, 255, 255), + 60 + ); var fence = CreatePrimitive( @@ -155,7 +181,9 @@ protected override void CreateModel(Transform parent) new Vector3(-2.3f, 2.5f, -2.3f), new Quaternion(0f, 0f, 0f, 1f), new Vector3(0.1f, 4.9f, 0.1f), - new Color32(255, 255, 255, 255) + new Color32(255, 255, 255, 255), + 60 + ); var pillar2 = CreatePrimitive( @@ -164,7 +192,9 @@ protected override void CreateModel(Transform parent) new Vector3(-2.3f, 0.79f, -0.9f), new Quaternion(0f, 0f, 0f, 1f), new Vector3(0.1f, 1.4798f, 0.1f), - new Color32(255, 255, 255, 255) + new Color32(255, 255, 255, 255), + 60 + ); var pillar3 = CreatePrimitive( @@ -173,7 +203,9 @@ protected override void CreateModel(Transform parent) new Vector3(-2.3f, 0.79f, 0.9f), new Quaternion(0f, 0f, 0f, 1f), new Vector3(0.1f, 1.4798f, 0.1f), - new Color32(255, 255, 255, 255) + new Color32(255, 255, 255, 255), + 60 + ); var pillar4 = CreatePrimitive( @@ -182,7 +214,9 @@ protected override void CreateModel(Transform parent) new Vector3(-2.3f, 2.5f, 2.3f), new Quaternion(0f, 0f, 0f, 1f), new Vector3(0.1f, 4.9f, 0.1f), - new Color32(255, 255, 255, 255) + new Color32(255, 255, 255, 255), + 60 + ); var pillar5 = CreatePrimitive( @@ -191,7 +225,9 @@ protected override void CreateModel(Transform parent) new Vector3(2.3f, 2.5f, -2.3f), new Quaternion(0f, 0f, 0f, 1f), new Vector3(0.1f, 4.9f, 0.1f), - new Color32(255, 255, 255, 255) + new Color32(255, 255, 255, 255), + 60 + ); var pillar6 = CreatePrimitive( @@ -200,7 +236,9 @@ protected override void CreateModel(Transform parent) new Vector3(2.3f, 0.79f, 0f), new Quaternion(0f, 0f, 0f, 1f), new Vector3(0.1f, 1.4798f, 0.1f), - new Color32(255, 255, 255, 255) + new Color32(255, 255, 255, 255), + 60 + ); var pillar8 = CreatePrimitive( @@ -209,7 +247,9 @@ protected override void CreateModel(Transform parent) new Vector3(2.3f, 2.5f, 2.3f), new Quaternion(0f, 0f, 0f, 1f), new Vector3(0.1f, 4.9f, 0.1f), - new Color32(255, 255, 255, 255) + new Color32(255, 255, 255, 255), + 60 + ); var pillar9 = CreatePrimitive( @@ -218,7 +258,9 @@ protected override void CreateModel(Transform parent) new Vector3(0f, 0.79f, 2.3f), new Quaternion(0f, 0f, 0f, 1f), new Vector3(0.1f, 1.4798f, 0.1f), - new Color32(255, 255, 255, 255) + new Color32(255, 255, 255, 255), + 60 + ); var pillar10 = CreatePrimitive( @@ -227,7 +269,9 @@ protected override void CreateModel(Transform parent) new Vector3(-0.9f, 0.79f, -2.3f), new Quaternion(0f, 0f, 0f, 1f), new Vector3(0.1f, 1.4798f, 0.1f), - new Color32(255, 255, 255, 255) + new Color32(255, 255, 255, 255), + 60 + ); var pillar11 = CreatePrimitive( @@ -236,7 +280,9 @@ protected override void CreateModel(Transform parent) new Vector3(0.9f, 0.79f, -2.3f), new Quaternion(0f, 0f, 0f, 1f), new Vector3(0.1f, 1.4798f, 0.1f), - new Color32(255, 255, 255, 255) + new Color32(255, 255, 255, 255), + 60 + ); var fenceback = CreatePrimitive( @@ -245,7 +291,9 @@ protected override void CreateModel(Transform parent) new Vector3(0f, 1.439f, 2.3f), new Quaternion(0f, 0f, 0f, 1f), new Vector3(5f, 0.2f, 0.2f), - new Color32(255, 255, 255, 255) + new Color32(255, 255, 255, 255), + 60 + ); var fenceright = CreatePrimitive( @@ -254,7 +302,9 @@ protected override void CreateModel(Transform parent) new Vector3(2.3f, 1.439f, 0f), new Quaternion(0f, 0f, 0f, 1f), new Vector3(0.2f, 0.2f, 5f), - new Color32(255, 255, 255, 255) + new Color32(255, 255, 255, 255), + 60 + ); var fenceleft1 = CreatePrimitive( @@ -263,7 +313,9 @@ protected override void CreateModel(Transform parent) new Vector3(-2.3f, 1.439f, 1.6f), new Quaternion(0f, 0f, 0f, 1f), new Vector3(0.2f, 0.2f, 1.7f), - new Color32(255, 255, 255, 255) + new Color32(255, 255, 255, 255), + 60 + ); var fenceleft2 = CreatePrimitive( @@ -272,7 +324,9 @@ protected override void CreateModel(Transform parent) new Vector3(-2.3f, 1.439f, -1.6f), new Quaternion(0f, 0f, 0f, 1f), new Vector3(0.2f, 0.2f, 1.7f), - new Color32(255, 255, 255, 255) + new Color32(255, 255, 255, 255), + 60 + ); var fencefront1 = CreatePrimitive( @@ -281,7 +335,9 @@ protected override void CreateModel(Transform parent) new Vector3(1.6f, 1.439f, -2.35f), new Quaternion(0f, 0f, 0f, 1f), new Vector3(1.7f, 0.2f, 0.2f), - new Color32(255, 255, 255, 255) + new Color32(255, 255, 255, 255), + 60 + ); var fencefront2 = CreatePrimitive( @@ -290,7 +346,9 @@ protected override void CreateModel(Transform parent) new Vector3(-1.6f, 1.439f, -2.3f), new Quaternion(0f, 0f, 0f, 1f), new Vector3(1.7f, 0.2f, 0.2f), - new Color32(255, 255, 255, 255) + new Color32(255, 255, 255, 255), + 60 + ); var waypoint = CreateWaypoint( From 684f9d04e51cebc3ca9a8432fca1aa3261f62f0f Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Mon, 23 Feb 2026 12:32:38 +0100 Subject: [PATCH 652/853] post nuke --- .../Features/PostNuke/PostNukeHandler.cs | 92 +++++++++++++++++++ KruacentExiled/KE.Misc/MainPlugin.cs | 6 ++ 2 files changed, 98 insertions(+) create mode 100644 KruacentExiled/KE.Misc/Features/PostNuke/PostNukeHandler.cs diff --git a/KruacentExiled/KE.Misc/Features/PostNuke/PostNukeHandler.cs b/KruacentExiled/KE.Misc/Features/PostNuke/PostNukeHandler.cs new file mode 100644 index 00000000..976cad6a --- /dev/null +++ b/KruacentExiled/KE.Misc/Features/PostNuke/PostNukeHandler.cs @@ -0,0 +1,92 @@ +using Exiled.API.Features; +using Exiled.API.Features.Core.Generic; +using Exiled.Events.EventArgs.Warhead; +using KE.Utils.API.Features; +using KE.Utils.API.Features.SCPs; +using LabApi.Events.Arguments.WarheadEvents; +using MEC; +using PlayerRoles; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace KE.Misc.Features.PostNuke +{ + internal class PostNukeHandler : MiscFeature + { + + private Faction trigger = Faction.Unclassified; + + public override void SubscribeEvents() + { + LabApi.Events.Handlers.WarheadEvents.Detonated += OnDetonated; + LabApi.Events.Handlers.WarheadEvents.Starting += OnStarting; + + base.SubscribeEvents(); + } + + public override void UnsubscribeEvents() + { + LabApi.Events.Handlers.WarheadEvents.Detonated -= OnDetonated; + LabApi.Events.Handlers.WarheadEvents.Starting -= OnStarting; + base.UnsubscribeEvents(); + } + + private void OnStarting(WarheadStartingEventArgs ev) + { + if (SCPTeam.IsSCP(ev.Player.ReferenceHub)) + { + trigger = Faction.SCP; + } + else + { + trigger = ev.Player.Role.GetFaction(); + } + + + } + + private void OnDetonated(WarheadDetonatedEventArgs ev) + { + Player player = ev.Player; + + AlphaWarheadSyncInfo info = AlphaWarheadController.Singleton.Info; + + if (info.ScenarioType == WarheadScenarioType.DeadmanSwitch) return; + + if (player is null || player.IsHost) + { + if(UnityEngine.Random.Range(0,2) == 0) + { + trigger = Faction.FoundationStaff; + } + else + { + trigger = Faction.FoundationEnemy; + } + } + + KELog.Debug(trigger); + + if (trigger == Faction.Unclassified + || trigger == Faction.FoundationStaff + || trigger == Faction.Flamingos) return; + + + Timing.CallDelayed(1, () => + { + Respawn.GrantTokens(trigger, 1); + Respawn.AdvanceTimer(trigger, 150); + }); + + + } + + + + + + } +} diff --git a/KruacentExiled/KE.Misc/MainPlugin.cs b/KruacentExiled/KE.Misc/MainPlugin.cs index 271a2cd6..d092c910 100644 --- a/KruacentExiled/KE.Misc/MainPlugin.cs +++ b/KruacentExiled/KE.Misc/MainPlugin.cs @@ -15,6 +15,7 @@ using KE.Utils.API.Settings.GlobalSettings; using KE.Utils.API.Translations; using KE.Misc.Features.PatchNotes; +using KE.Misc.Features.PostNuke; namespace KE.Misc { @@ -44,6 +45,7 @@ public class MainPlugin : Plugin, ILocalizable private Harmony harmony; internal VoteStart vote { get; private set; } + internal PostNukeHandler postnuke { get; private set; } public string LocalizationId => Prefix; @@ -66,6 +68,9 @@ public override void OnEnabled() Candy = new Candy(); vote = new(); PatchNote = new(); + postnuke = new(); + + //SpawnLcz = new(); Respawn.SetTokens(SpawnableFaction.NtfWave, 2); Respawn.SetTokens(SpawnableFaction.ChaosWave, 2); @@ -125,6 +130,7 @@ public override void OnDisabled() //SurfaceLight = null; GamblingCoinManager.DestroyAll(); _gamblingCoinHandler = null; + postnuke = null; LastHuman = null; harmony = null; Instance = null; From 4e4e914a16b68fdf2cbb6e7900400e9562e04f9c Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Mon, 23 Feb 2026 12:34:40 +0100 Subject: [PATCH 653/853] use kelog everywhere --- .../KE.Misc/Features/914Upgrades/Base914Upgrade.cs | 3 ++- .../KE.Misc/Features/914Upgrades/PlayerTeleport914.cs | 7 ++++--- .../914Upgrades/RoleChanging/Base914PlayerRoleChange.cs | 3 ++- KruacentExiled/KE.Misc/Features/AutoElevator.cs | 4 ++-- .../KE.Misc/Features/GamblingCoin/EventHandlers.cs | 3 ++- .../KE.Misc/Features/GamblingCoin/GamblingCoinManager.cs | 7 ++++--- .../KE.Misc/Features/LastHuman/LastHumanHandler.cs | 5 +++-- KruacentExiled/KE.Misc/Features/LoadingMiscFeature.cs | 5 +++-- KruacentExiled/KE.Misc/Features/MiscFeature.cs | 3 ++- KruacentExiled/KE.Misc/Features/Spawn/Spawn.cs | 5 +++-- 10 files changed, 27 insertions(+), 18 deletions(-) diff --git a/KruacentExiled/KE.Misc/Features/914Upgrades/Base914Upgrade.cs b/KruacentExiled/KE.Misc/Features/914Upgrades/Base914Upgrade.cs index 825e2ad0..387ee024 100644 --- a/KruacentExiled/KE.Misc/Features/914Upgrades/Base914Upgrade.cs +++ b/KruacentExiled/KE.Misc/Features/914Upgrades/Base914Upgrade.cs @@ -1,5 +1,6 @@ using Exiled.API.Features; using Exiled.Events.EventArgs.Scp914; +using KE.Utils.API.Features; using KE.Utils.API.Interfaces; using UnityEngine; @@ -51,7 +52,7 @@ protected bool LuckCheck(float chance) float wanted = Mathf.Clamp(chance, 0f, 100f); float random = UnityEngine.Random.Range(0f, 100f); - Log.Debug($"{random} < {wanted} : {random < wanted} "); + KELog.Debug($"{random} < {wanted} : {random < wanted} "); return random < wanted ; } diff --git a/KruacentExiled/KE.Misc/Features/914Upgrades/PlayerTeleport914.cs b/KruacentExiled/KE.Misc/Features/914Upgrades/PlayerTeleport914.cs index 7e9a7137..b52a0dcb 100644 --- a/KruacentExiled/KE.Misc/Features/914Upgrades/PlayerTeleport914.cs +++ b/KruacentExiled/KE.Misc/Features/914Upgrades/PlayerTeleport914.cs @@ -1,6 +1,7 @@ using Exiled.API.Enums; using Exiled.API.Features; using Exiled.Events.EventArgs.Scp914; +using KE.Utils.API.Features; using KE.Utils.Extensions; using MEC; using Scp914; @@ -14,7 +15,7 @@ public class PlayerTeleport914 : Base914PlayerUpgrade protected override float Chance => 100; protected override void OnUpgradingPlayer(UpgradingPlayerEventArgs ev) { - Log.Debug("Upgrade"); + KELog.Debug("Upgrade"); Player player = ev.Player; Room room = null; if (ev.KnobSetting == Scp914KnobSetting.Fine && LuckCheck(1)) @@ -45,9 +46,9 @@ protected override void OnUpgradingPlayer(UpgradingPlayerEventArgs ev) if (room != null) { //idk why but need a delay - Timing.CallDelayed(1f, delegate + Timing.CallDelayed(.1f, delegate { - Log.Debug($"teleporting {player.Nickname} to {room.Name}"); + KELog.Debug($"teleporting {player.Nickname} to {room.Name}"); player.Teleport(room); }); diff --git a/KruacentExiled/KE.Misc/Features/914Upgrades/RoleChanging/Base914PlayerRoleChange.cs b/KruacentExiled/KE.Misc/Features/914Upgrades/RoleChanging/Base914PlayerRoleChange.cs index ee3c8d9f..fb91a000 100644 --- a/KruacentExiled/KE.Misc/Features/914Upgrades/RoleChanging/Base914PlayerRoleChange.cs +++ b/KruacentExiled/KE.Misc/Features/914Upgrades/RoleChanging/Base914PlayerRoleChange.cs @@ -1,5 +1,6 @@ using Exiled.API.Features; using Exiled.Events.EventArgs.Scp914; +using KE.Utils.API.Features; using KE.Utils.API.Interfaces; using MEC; using PlayerRoles; @@ -29,7 +30,7 @@ protected sealed override void OnUpgradingPlayer(UpgradingPlayerEventArgs ev) if (!LuckCheck(newRole.chance)) return; if (_upgradingPlayer.Contains(player)) return; - Log.Debug($"upgrading {player.Role.Type}->{newRole.role}"); + KELog.Debug($"upgrading {player.Role.Type}->{newRole.role}"); SetRole(player, newRole.role); diff --git a/KruacentExiled/KE.Misc/Features/AutoElevator.cs b/KruacentExiled/KE.Misc/Features/AutoElevator.cs index 62c15ee1..10199271 100644 --- a/KruacentExiled/KE.Misc/Features/AutoElevator.cs +++ b/KruacentExiled/KE.Misc/Features/AutoElevator.cs @@ -29,7 +29,7 @@ public void StartLoop() /// private IEnumerator StartElevator() { - //Log.Debug("elevator"); + //KELog.Debug("elevator"); while (!Round.IsEnded) { foreach (Lift l in Lift.List.ToList()) @@ -43,7 +43,7 @@ private IEnumerator StartElevator() private void SendElevator(Lift e) { - //Log.Debug($"{e.Name}"); + //KELog.Debug($"{e.Name}"); e.TryStart(0, true); } } diff --git a/KruacentExiled/KE.Misc/Features/GamblingCoin/EventHandlers.cs b/KruacentExiled/KE.Misc/Features/GamblingCoin/EventHandlers.cs index 23671962..646b532f 100644 --- a/KruacentExiled/KE.Misc/Features/GamblingCoin/EventHandlers.cs +++ b/KruacentExiled/KE.Misc/Features/GamblingCoin/EventHandlers.cs @@ -7,6 +7,7 @@ using KE.Misc.Events.EventsArgs.GamblingCoinsEventArgs; using KE.Misc.Features.GamblingCoin.Interfaces; using KE.Misc.Features.GamblingCoin.Types; +using KE.Utils.API.Features; using MEC; namespace KE.Misc.Features.GamblingCoin @@ -48,7 +49,7 @@ public void OnCoinFlip(FlippingCoinEventArgs ev) { CoinUses[itemSerial] = UnityEngine.Random.Range(Config.GamblingCoinMinUse, Config.GamblingCoinMaxUse); - Log.Debug($"Registered new coin: {CoinUses[itemSerial]} uses left."); + KELog.Debug($"Registered new coin: {CoinUses[itemSerial]} uses left."); } CoinUses[itemSerial]--; diff --git a/KruacentExiled/KE.Misc/Features/GamblingCoin/GamblingCoinManager.cs b/KruacentExiled/KE.Misc/Features/GamblingCoin/GamblingCoinManager.cs index 1090fcbc..67fc7c17 100644 --- a/KruacentExiled/KE.Misc/Features/GamblingCoin/GamblingCoinManager.cs +++ b/KruacentExiled/KE.Misc/Features/GamblingCoin/GamblingCoinManager.cs @@ -3,6 +3,7 @@ using KE.Misc.Features.GamblingCoin.Interfaces; using KE.Misc.Features.GamblingCoin.Types; using KE.Utils.API; +using KE.Utils.API.Features; using MEC; using System; using System.Collections.Generic; @@ -54,7 +55,7 @@ public static void Register(ICoinEffect effect) if (effect.Weight > 0) _activeEffects.Add(effect); - Log.Debug($"[GamblingCoin] Registered: {effect.Name}"); + KELog.Register($"[GamblingCoin] {effect.Name}"); } @@ -102,10 +103,10 @@ public static void ExecuteEffect(this ICoinEffect effect,Player player) if (effect is IDurationEffect durationEffect && durationEffect.Duration > 0) { float duration = durationEffect.Duration; - Log.Debug("effect " + duration); + KELog.Debug("effect " + duration); Timing.CallDelayed(duration, () => { - Log.Debug("effect " + duration); + KELog.Debug("effect " + duration); durationEffect.ExecuteAfterDuration(player); }); } diff --git a/KruacentExiled/KE.Misc/Features/LastHuman/LastHumanHandler.cs b/KruacentExiled/KE.Misc/Features/LastHuman/LastHumanHandler.cs index 692e4766..65a0d74f 100644 --- a/KruacentExiled/KE.Misc/Features/LastHuman/LastHumanHandler.cs +++ b/KruacentExiled/KE.Misc/Features/LastHuman/LastHumanHandler.cs @@ -7,6 +7,7 @@ using HintServiceMeow.Core.Utilities; using KE.Utils.API.Displays.DisplayMeow; using KE.Utils.API.Displays.DisplayMeow.Placements; +using KE.Utils.API.Features; using KE.Utils.API.Features.SCPs; using KE.Utils.API.Interfaces; using KE.Utils.API.Translations; @@ -101,7 +102,7 @@ private void OnChangedRole(PlayerChangedRoleEventArgs ev) if (!player.IsDead && DateTime.Now > _nextPossibleHint) { DisplayHandler.Instance.AddHint(position.HintPlacement, player, msg, 10); - Log.Debug("show message to " + lastTarget.Nickname); + KELog.Debug("show message to " + lastTarget.Nickname); _nextPossibleHint = DateTime.Now.Add(Cooldown); } @@ -126,7 +127,7 @@ private static bool TryGetLastTarget(out Player lastTarget) int num2 = 0; foreach (ReferenceHub allHub in ReferenceHub.AllHubs) { - Log.Debug(allHub.nicknameSync.DisplayName); + KELog.Debug(allHub.nicknameSync.DisplayName); if (allHub.IsHuman() && !SCPTeam.IsSCP(allHub)) { num++; diff --git a/KruacentExiled/KE.Misc/Features/LoadingMiscFeature.cs b/KruacentExiled/KE.Misc/Features/LoadingMiscFeature.cs index 9f1d875a..4cb77915 100644 --- a/KruacentExiled/KE.Misc/Features/LoadingMiscFeature.cs +++ b/KruacentExiled/KE.Misc/Features/LoadingMiscFeature.cs @@ -3,6 +3,7 @@ using Exiled.Events.EventArgs.Warhead; using KE.Misc.Features.FriendlyFireConditions; using KE.Utils.API; +using KE.Utils.API.Features; using KE.Utils.API.Interfaces; using System; using System.Collections.Generic; @@ -23,7 +24,7 @@ public override void SubscribeEvents() { foreach(T loaded in _allLoadedFeatures) { - Log.Debug("subscribing "+ loaded.GetType().Name); + KELog.Debug("subscribing "+ loaded.GetType().Name); if(loaded is IUsingEvents iue) iue.SubscribeEvents(); } @@ -33,7 +34,7 @@ public override void UnsubscribeEvents() { foreach (T loaded in _allLoadedFeatures) { - Log.Debug("Unsubscribing " + loaded.GetType().Name); + KELog.Debug("Unsubscribing " + loaded.GetType().Name); if (loaded is IUsingEvents iue) iue.UnsubscribeEvents(); } diff --git a/KruacentExiled/KE.Misc/Features/MiscFeature.cs b/KruacentExiled/KE.Misc/Features/MiscFeature.cs index 53442ec2..bc2e7653 100644 --- a/KruacentExiled/KE.Misc/Features/MiscFeature.cs +++ b/KruacentExiled/KE.Misc/Features/MiscFeature.cs @@ -1,4 +1,5 @@ using Exiled.API.Features; +using KE.Utils.API.Features; using KE.Utils.API.Interfaces; using System; using System.Collections.Generic; @@ -22,7 +23,7 @@ internal static void SubscribeAllEvents() { foreach (MiscFeature f in _list) { - Log.Debug($"subscribing events in {f.GetType()}"); + KELog.Debug($"subscribing events in {f.GetType()}"); f.SubscribeEvents(); } diff --git a/KruacentExiled/KE.Misc/Features/Spawn/Spawn.cs b/KruacentExiled/KE.Misc/Features/Spawn/Spawn.cs index 61dddcb1..020ba764 100644 --- a/KruacentExiled/KE.Misc/Features/Spawn/Spawn.cs +++ b/KruacentExiled/KE.Misc/Features/Spawn/Spawn.cs @@ -2,6 +2,7 @@ using Exiled.API.Features; using Exiled.Events.EventArgs.Server; using KE.CustomRoles.API.Features; +using KE.Utils.API.Features; using MEC; using PlayerRoles; using System; @@ -64,7 +65,7 @@ private bool SetScpPreferences(Player player) string roleScp = ChooseRandomRole(chancescp); - Log.Debug($"Scp ({player.Nickname}) is {roleScp} previous : {player.Role.Type}"); + KELog.Debug($"Scp ({player.Nickname}) is {roleScp} previous : {player.Role.Type}"); SetRoleWithId(player, roleScp); return true; @@ -122,7 +123,7 @@ private string ChooseRandomRole(IDictionary chancescp) { for (int i = 0; i < chancescp[ge]; i++) { - Log.Debug(ge); + KELog.Debug(ge); weightedPool.Add(ge); } } From 49b085eab431bfd3f45f984c473d350369bc8e7a Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Mon, 23 Feb 2026 19:16:23 +0100 Subject: [PATCH 654/853] 049c unlockables --- .../Abilities/FireAbilities/FireStat.cs | 1 + .../CR/CustomSCPs/SCP049C/RagdollArrowComp.cs | 71 +++++++++++++++++++ .../SCP049C/SCP049CLevelPosition.cs | 20 ++++++ .../CustomSCPs/SCP049C/SCP049CLevelSystem.cs | 56 +++++++++++---- .../CR/CustomSCPs/SCP049C/SCP049CRole.cs | 42 +++++++---- .../GogglesNoWarningUnlockable.cs | 27 +++++++ .../UnlockableAbilities/JumpUnlockable.cs | 34 +++++++++ .../MoreShieldUnlockable.cs | 31 ++++++++ .../UnlockableAbilities/SpeedUnlockable.cs | 36 ++++++++++ .../UnlockableAbilities/StunUnlockable.cs | 28 ++++++++ .../UnlockableAbilities/UnlockableAbility.cs | 5 +- .../WallAbilityUnlockable.cs | 23 ++++++ 12 files changed, 347 insertions(+), 27 deletions(-) create mode 100644 KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP049C/RagdollArrowComp.cs create mode 100644 KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP049C/SCP049CLevelPosition.cs create mode 100644 KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP049C/UnlockableAbilities/GogglesNoWarningUnlockable.cs create mode 100644 KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP049C/UnlockableAbilities/JumpUnlockable.cs create mode 100644 KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP049C/UnlockableAbilities/MoreShieldUnlockable.cs create mode 100644 KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP049C/UnlockableAbilities/SpeedUnlockable.cs create mode 100644 KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP049C/UnlockableAbilities/StunUnlockable.cs create mode 100644 KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP049C/UnlockableAbilities/WallAbilityUnlockable.cs diff --git a/KruacentExiled/KE.CustomRoles/Abilities/FireAbilities/FireStat.cs b/KruacentExiled/KE.CustomRoles/Abilities/FireAbilities/FireStat.cs index cca97c99..be0781ed 100644 --- a/KruacentExiled/KE.CustomRoles/Abilities/FireAbilities/FireStat.cs +++ b/KruacentExiled/KE.CustomRoles/Abilities/FireAbilities/FireStat.cs @@ -57,6 +57,7 @@ public override void Init(ReferenceHub ply) public override bool Check() { + return false; Player player = Player.Get(Hub); if (!KECustomRole.Get(player).Any(role => KECustomRole.Get(CustomRole) == role)) { diff --git a/KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP049C/RagdollArrowComp.cs b/KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP049C/RagdollArrowComp.cs new file mode 100644 index 00000000..194d082b --- /dev/null +++ b/KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP049C/RagdollArrowComp.cs @@ -0,0 +1,71 @@ +using Exiled.API.Features; +using KE.Utils.API.Features; +using KE.Utils.API.KETextToy; +using NorthwoodLib.Pools; +using PlayerRoles.Ragdolls; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using UnityEngine; + +namespace KE.CustomRoles.CR.CustomSCPs.SCP049C +{ + public class RagdollArrowComp : MonoBehaviour + { + + private FollowingTextToy arrow = null; + + private Ragdoll ragdoll; + + public const string arrowText = "↓"; + + public void Init(Ragdoll ragdoll) + { + this.ragdoll = ragdoll; + + } + + + private void Update() + { + if (ragdoll.IsExpired && arrow == null) + { + CreateArrow(); + } + } + + private void OnDestroy() + { + arrow.Destroy(); + } + + public void SetColor(Color color) + { + StringBuilder sb = StringBuilderPool.Shared.Rent(); + + sb.Append(""); + sb.Append(arrowText); + sb.Append(""); + + + arrow.Toy.TextFormat = sb.ToString(); + + StringBuilderPool.Shared.Return(sb); + + } + + private void CreateArrow() + { + KELog.Debug("arrow"); + arrow = new FollowingTextToy(SCP049CRole.instance.TrackedPlayers, ragdoll.Position+Vector3.up, Quaternion.identity, Vector3.one*2); + + arrow.OnlyMoveY = true; + SetColor(Color.white); + arrow.Toy.Spawn(); + } + } +} diff --git a/KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP049C/SCP049CLevelPosition.cs b/KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP049C/SCP049CLevelPosition.cs new file mode 100644 index 00000000..c8e47a85 --- /dev/null +++ b/KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP049C/SCP049CLevelPosition.cs @@ -0,0 +1,20 @@ +using HintServiceMeow.Core.Enum; +using KE.Utils.API.Displays.DisplayMeow.Placements; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace KE.CustomRoles.CR.CustomSCPs.SCP049C +{ + public class SCP049CLevelPosition : HintPosition + { + public override float Xposition => 1060; + + public override float Yposition => 1030; + + public override HintAlignment HintAlignment => HintAlignment.Center; + public override string Name => "SCP049CLevel"; + } +} diff --git a/KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP049C/SCP049CLevelSystem.cs b/KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP049C/SCP049CLevelSystem.cs index 2a47acfc..f419c2dc 100644 --- a/KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP049C/SCP049CLevelSystem.cs +++ b/KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP049C/SCP049CLevelSystem.cs @@ -3,8 +3,9 @@ using Exiled.Events.EventArgs.Scp049; using Exiled.Events.Patches.Events.Scp0492; using JetBrains.Annotations; -using KE.CustomRoles.CR.CustomSCPs.SCP049C.UnlockAbleAbilities; +using KE.CustomRoles.CR.CustomSCPs.SCP049C.UnlockableAbilities; using KE.Utils.API; +using KE.Utils.API.Features; using NorthwoodLib.Pools; using PlayerRoles.FirstPersonControl; using PlayerRoles.Ragdolls; @@ -38,7 +39,7 @@ public int Level private ReferenceHub _hub; - private List CurrentAbilities; + public List CurrentAbilities { get; private set; } private static HashSet abilities; @@ -61,17 +62,14 @@ public void Awake() } public void OnDestroy() { - foreach(UnlockableAbility ability in CurrentAbilities) - { - ability.Remove(_hub); - } + } public void AddKill() { - Log.Debug("add kill"); + KELog.Debug("add kill"); currentkill++; if(currentkill >= killperlevel) @@ -82,6 +80,15 @@ public void AddKill() } + + public void DisableAll() + { + foreach (UnlockableAbility ability in CurrentAbilities) + { + ability.Remove(_hub); + } + } + public void AddLevel() { List ability = ListPool.Shared.Rent(); @@ -102,10 +109,14 @@ public void AddLevel() //todo choose ability UnlockableAbility choosen = ability.RandomItem(); + KELog.Debug(choosen.GetType().Name); + + ListPool.Shared.Return(ability); choosen.Grant(_hub); - + CurrentAbilities.Add(choosen); + KELog.Debug(CurrentAbilities.Count); } @@ -128,37 +139,58 @@ internal void Update() } + public const float MaxDistance = 2; private void UpdateTime() { + if (Vector3.Distance(ragdoll.Position,_hub.transform.position) > MaxDistance) + { + Reset(); + } + + cooldown += Time.deltaTime; + RagdollArrowComp comp = ragdoll.GameObject.GetComponent(); + + comp.SetColor(Color.red); + + if (cooldown > objective) { ragdoll.Destroy(); AddKill(); - ragdoll = null; - cooldown = 0; + Reset(); + + } } + private void Reset() + { + ragdoll.GameObject.GetComponent().SetColor(Color.white); + ragdoll = null; + cooldown = 0; + } + + private void GetNearRagdoll() { - int num = Physics.OverlapSphereNonAlloc(_hub.GetPosition(), 5, NonAlloc, (int)LayerMasks.Ragdoll); + int num = Physics.OverlapSphereNonAlloc(_hub.GetPosition(), MaxDistance, NonAlloc, (int)LayerMasks.Ragdoll); for (int i = 0; i < num; i++) { if (NonAlloc[i].TryGetComponent(out var r)) { Ragdoll ragdoll = Ragdoll.Get(r); + if (ragdoll.IsExpired) { this.ragdoll = ragdoll; } - } } } diff --git a/KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP049C/SCP049CRole.cs b/KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP049C/SCP049CRole.cs index 355c7a7a..e9aabfc5 100644 --- a/KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP049C/SCP049CRole.cs +++ b/KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP049C/SCP049CRole.cs @@ -1,10 +1,13 @@ using Exiled.API.Features; using Exiled.API.Features.Roles; +using Exiled.Events.EventArgs.Player; using Exiled.Events.EventArgs.Scp049; using KE.CustomRoles.API.Features; +using KE.Utils.API.Features; using LabApi.Events.Arguments.Scp049Events; using MapGeneration.Rooms; using PlayerRoles; +using PlayerStatsSystem; using System; using System.Collections.Generic; using System.Linq; @@ -36,10 +39,18 @@ protected override Dictionary> SetTranslation public override RoleTypeId Role => RoleTypeId.Scp049; + public override string InternalName => "C"; public override int MaxHealth { get; set; } = 2500; public override float SpawnChance { get; set; } = 0; protected override int SettingId => 10003; + internal static SCP049CRole instance = null; + + public override void Init() + { + instance = this; + base.Init(); + } protected override void RoleAdded(Player player) @@ -63,15 +74,15 @@ protected override void RoleRemoved(Player player) protected override void SubscribeEvents() { Exiled.Events.Handlers.Scp049.FinishingRecall += OnFinishingRecall; - LabApi.Events.Handlers.Scp049Events.UsingDoctorsCall += OnUsingDoctorsCall; LabApi.Events.Handlers.Scp049Events.UsedDoctorsCall += OnUsedDoctorsCall; + Exiled.Events.Handlers.Player.SpawnedRagdoll += OnSpawnedRagdoll; base.SubscribeEvents(); } protected override void UnsubscribeEvents() { Exiled.Events.Handlers.Scp049.FinishingRecall -= OnFinishingRecall; - LabApi.Events.Handlers.Scp049Events.UsingDoctorsCall -= OnUsingDoctorsCall; LabApi.Events.Handlers.Scp049Events.UsedDoctorsCall -= OnUsedDoctorsCall; + Exiled.Events.Handlers.Player.SpawnedRagdoll -= OnSpawnedRagdoll; base.UnsubscribeEvents(); } private void OnFinishingRecall(FinishingRecallEventArgs ev) @@ -81,27 +92,32 @@ private void OnFinishingRecall(FinishingRecallEventArgs ev) ev.IsAllowed = false; ev.Ragdoll.Destroy(); - lvl.AddKill(); - } - - private void OnUsingDoctorsCall(Scp049UsingDoctorsCallEventArgs ev) - { - if (!Check(ev.Player)) return; - ev.Player.HumeShieldRegenRate = 15*2; - ev.Player.HumeShieldRegenCooldown = 10/2; + if (true) + { + lvl.AddLevel(); + } + else + { + lvl.AddKill(); + } + } private void OnUsedDoctorsCall(Scp049UsedDoctorsCallEventArgs ev) { if (!Check(ev.Player)) return; + ev.Player.GetStatModule().AddAmount(300f); - ev.Player.HumeShieldRegenRate = 15; - ev.Player.HumeShieldRegenCooldown = 10; + } + private void OnSpawnedRagdoll(SpawnedRagdollEventArgs ev) + { + RagdollArrowComp comp = ev.Ragdoll.GameObject.AddComponent(); + comp.Init(ev.Ragdoll); + } - } } } diff --git a/KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP049C/UnlockableAbilities/GogglesNoWarningUnlockable.cs b/KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP049C/UnlockableAbilities/GogglesNoWarningUnlockable.cs new file mode 100644 index 00000000..b08769c3 --- /dev/null +++ b/KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP049C/UnlockableAbilities/GogglesNoWarningUnlockable.cs @@ -0,0 +1,27 @@ +using CustomPlayerEffects; +using Exiled.API.Features; +using InventorySystem.Items.Usables.Scp1344; +using System; +using LabPlayer = LabApi.Features.Wrappers.Player; +namespace KE.CustomRoles.CR.CustomSCPs.SCP049C.UnlockableAbilities +{ + internal class GogglesNoWarningUnlockable : UnlockableAbility + { + public override byte Tier => 99; //3 + + public override void Grant(ReferenceHub hub) + { + LabPlayer lab = LabPlayer.Get(hub); + + lab.EnableEffect(); + + } + + public override void Remove(ReferenceHub hub) + { + LabPlayer lab = LabPlayer.Get(hub); + + lab.DisableEffect(); + } + } +} diff --git a/KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP049C/UnlockableAbilities/JumpUnlockable.cs b/KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP049C/UnlockableAbilities/JumpUnlockable.cs new file mode 100644 index 00000000..745c8ed4 --- /dev/null +++ b/KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP049C/UnlockableAbilities/JumpUnlockable.cs @@ -0,0 +1,34 @@ +using Exiled.API.Features; +using Exiled.API.Features.Roles; +using PlayerRoles.FirstPersonControl; +using System; +using LabPlayer = LabApi.Features.Wrappers.Player; +namespace KE.CustomRoles.CR.CustomSCPs.SCP049C.UnlockableAbilities +{ + internal class JumpUnlockable : UnlockableAbility + { + public override byte Tier => 5; //1 + + public override void Grant(ReferenceHub hub) + { + Player lab = Player.Get(hub); + + + if(lab.Role is FpcRole role) + { + role.Gravity = UnityEngine.Vector3.up * (-3); + } + } + + public override void Remove(ReferenceHub hub) + { + Player lab = Player.Get(hub); + + + if (lab.Role is FpcRole role) + { + role.Gravity = FpcGravityController.DefaultGravity; + } + } + } +} diff --git a/KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP049C/UnlockableAbilities/MoreShieldUnlockable.cs b/KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP049C/UnlockableAbilities/MoreShieldUnlockable.cs new file mode 100644 index 00000000..42eb710b --- /dev/null +++ b/KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP049C/UnlockableAbilities/MoreShieldUnlockable.cs @@ -0,0 +1,31 @@ +using Exiled.API.Features; +using PlayerRoles.PlayableScps.HumeShield; +using System; +using UnityEngine; +using LabPlayer = LabApi.Features.Wrappers.Player; +namespace KE.CustomRoles.CR.CustomSCPs.SCP049C.UnlockableAbilities +{ + internal class MoreShieldUnlockable : UnlockableAbility + { + public override byte Tier => 1; + + public override void Grant(ReferenceHub hub) + { + LabPlayer lab = LabPlayer.Get(hub); + + lab.MaxHumeShield = 700; + } + + public override void Remove(ReferenceHub hub) + { + LabPlayer lab = LabPlayer.Get(hub); + IHumeShieldProvider.GetForHub(hub, out _, out var hsMax, out _, out _); + + lab.MaxHumeShield = hsMax; + + lab.HumeShield = Mathf.Min(lab.HumeShield, lab.MaxHumeShield); + + + } + } +} diff --git a/KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP049C/UnlockableAbilities/SpeedUnlockable.cs b/KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP049C/UnlockableAbilities/SpeedUnlockable.cs new file mode 100644 index 00000000..40806cda --- /dev/null +++ b/KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP049C/UnlockableAbilities/SpeedUnlockable.cs @@ -0,0 +1,36 @@ +using CustomPlayerEffects; +using Exiled.API.Features; +using InventorySystem.Items.Usables.Scp1344; +using KE.Utils.API.Features; +using System; +using LabPlayer = LabApi.Features.Wrappers.Player; +namespace KE.CustomRoles.CR.CustomSCPs.SCP049C.UnlockableAbilities +{ + internal class SpeedUnlockable : UnlockableAbility + { + public override byte Tier => 3; + + public override void Grant(ReferenceHub hub) + { + LabPlayer lab = LabPlayer.Get(hub); + + MovementBoost move = lab.GetEffect(); + + lab.EnableEffect((byte)(move.Intensity + 50), 0, false); + hub.GetComponent().DisableAll(); + + + } + + public override void Remove(ReferenceHub hub) + { + LabPlayer lab = LabPlayer.Get(hub); + MovementBoost move = lab.GetEffect(); + + lab.EnableEffect((byte)(move.Intensity - 50), 0, false); + + + + } + } +} diff --git a/KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP049C/UnlockableAbilities/StunUnlockable.cs b/KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP049C/UnlockableAbilities/StunUnlockable.cs new file mode 100644 index 00000000..1486b9e8 --- /dev/null +++ b/KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP049C/UnlockableAbilities/StunUnlockable.cs @@ -0,0 +1,28 @@ +using CustomPlayerEffects; +using Exiled.API.Features; +using InventorySystem.Items.Usables.Scp1344; +using KE.Utils.API.Features; +using System; +using LabPlayer = LabApi.Features.Wrappers.Player; +namespace KE.CustomRoles.CR.CustomSCPs.SCP049C.UnlockableAbilities +{ + internal class StunUnlockable : UnlockableAbility + { + public override byte Tier => 2; + + public override void Grant(ReferenceHub hub) + { + LabPlayer lab = LabPlayer.Get(hub); + + + + } + + public override void Remove(ReferenceHub hub) + { + LabPlayer lab = LabPlayer.Get(hub); + + KELog.Debug("remove"); + } + } +} diff --git a/KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP049C/UnlockableAbilities/UnlockableAbility.cs b/KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP049C/UnlockableAbilities/UnlockableAbility.cs index e7b19cf8..bb39a8ad 100644 --- a/KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP049C/UnlockableAbilities/UnlockableAbility.cs +++ b/KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP049C/UnlockableAbilities/UnlockableAbility.cs @@ -1,11 +1,12 @@ -using KE.CustomRoles.API.Features; +using Exiled.API.Features; +using KE.CustomRoles.API.Features; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; -namespace KE.CustomRoles.CR.CustomSCPs.SCP049C.UnlockAbleAbilities +namespace KE.CustomRoles.CR.CustomSCPs.SCP049C.UnlockableAbilities { public abstract class UnlockableAbility { diff --git a/KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP049C/UnlockableAbilities/WallAbilityUnlockable.cs b/KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP049C/UnlockableAbilities/WallAbilityUnlockable.cs new file mode 100644 index 00000000..335fd839 --- /dev/null +++ b/KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP049C/UnlockableAbilities/WallAbilityUnlockable.cs @@ -0,0 +1,23 @@ +using Exiled.API.Features; +using Exiled.API.Features.Roles; +using KE.Utils.API.Features; +using PlayerRoles.FirstPersonControl; +using System; +using LabPlayer = LabApi.Features.Wrappers.Player; +namespace KE.CustomRoles.CR.CustomSCPs.SCP049C.UnlockableAbilities +{ + internal class WallAbilityUnlockable : UnlockableAbility + { + public override byte Tier => 2; + + public override void Grant(ReferenceHub hub) + { + + } + + public override void Remove(ReferenceHub hub) + { + KELog.Debug("remove"); + } + } +} From 118f2bc6748048a05948a50c8c545876418443a2 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Tue, 24 Feb 2026 15:20:27 +0100 Subject: [PATCH 655/853] scp049 --- .../KE.CustomRoles/Abilities/SCP049C/Small.cs | 52 ++++++ .../Abilities/SCP049C/ToggleHighJump.cs | 49 ++++++ .../{ => Positions}/SCP049CLevelPosition.cs | 2 +- .../Positions/SCP049CUnlockablePosition.cs | 41 +++++ .../CR/CustomSCPs/SCP049C/SCP049CGUI.cs | 144 ++++++++++++++++ .../CustomSCPs/SCP049C/SCP049CLevelSystem.cs | 160 +++++++++++++++--- .../CR/CustomSCPs/SCP049C/SCP049CRole.cs | 54 +++++- .../UnlockableAbilities/JumpUnlockable.cs | 34 ---- .../UnlockableAbilities/StunUnlockable.cs | 28 --- .../Tier1/HigherJumpComp.cs | 65 +++++++ .../Tier1/JumpUnlockable.cs | 44 +++++ .../{ => Tier1}/MoreShieldUnlockable.cs | 13 +- .../Tier2/SmallUnlockable.cs | 26 +++ .../{ => Tier2}/WallAbilityUnlockable.cs | 14 +- .../{ => Tier3}/GogglesNoWarningUnlockable.cs | 15 +- .../{ => Tier3}/SpeedUnlockable.cs | 17 +- .../SCP049C/UnlockableAbilities/Unlockable.cs | 25 +++ .../UnlockableAbilities/UnlockableAbility.cs | 21 ++- .../KE.CustomRoles/Settings/SettingHandler.cs | 22 ++- 19 files changed, 708 insertions(+), 118 deletions(-) create mode 100644 KruacentExiled/KE.CustomRoles/Abilities/SCP049C/Small.cs create mode 100644 KruacentExiled/KE.CustomRoles/Abilities/SCP049C/ToggleHighJump.cs rename KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP049C/{ => Positions}/SCP049CLevelPosition.cs (89%) create mode 100644 KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP049C/Positions/SCP049CUnlockablePosition.cs create mode 100644 KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP049C/SCP049CGUI.cs delete mode 100644 KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP049C/UnlockableAbilities/JumpUnlockable.cs delete mode 100644 KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP049C/UnlockableAbilities/StunUnlockable.cs create mode 100644 KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP049C/UnlockableAbilities/Tier1/HigherJumpComp.cs create mode 100644 KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP049C/UnlockableAbilities/Tier1/JumpUnlockable.cs rename KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP049C/UnlockableAbilities/{ => Tier1}/MoreShieldUnlockable.cs (70%) create mode 100644 KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP049C/UnlockableAbilities/Tier2/SmallUnlockable.cs rename KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP049C/UnlockableAbilities/{ => Tier2}/WallAbilityUnlockable.cs (56%) rename KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP049C/UnlockableAbilities/{ => Tier3}/GogglesNoWarningUnlockable.cs (61%) rename KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP049C/UnlockableAbilities/{ => Tier3}/SpeedUnlockable.cs (71%) create mode 100644 KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP049C/UnlockableAbilities/Unlockable.cs diff --git a/KruacentExiled/KE.CustomRoles/Abilities/SCP049C/Small.cs b/KruacentExiled/KE.CustomRoles/Abilities/SCP049C/Small.cs new file mode 100644 index 00000000..107e326e --- /dev/null +++ b/KruacentExiled/KE.CustomRoles/Abilities/SCP049C/Small.cs @@ -0,0 +1,52 @@ +using Exiled.API.Features; +using KE.CustomRoles.API.Features; +using KE.CustomRoles.API.Interfaces; +using MEC; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using UnityEngine; + +namespace KE.CustomRoles.Abilities.SCP049C +{ + public class Small : KEAbilities + { + public override string Name { get; } = "Small"; + + + protected override Dictionary> SetTranslation() + { + return new() + { + ["en"] = new() + { + [TranslationKeyName] = "Small", + [TranslationKeyDesc] = "Get small for 30 seconds", + }, + ["fr"] = new() + { + [TranslationKeyName] = "Potit", + [TranslationKeyDesc] = "Devient plus petit pendant 30 secondes", + } + }; + } + + public override float Cooldown { get; } = 120f; + + protected override bool AbilityUsed(Player player) + { + + Vector3 oldScale = player.Scale; + player.Scale = new Vector3(oldScale.x, 0.8f, oldScale.z); + + Timing.CallDelayed(30, () => + { + player.Scale = oldScale; + }); + + return base.AbilityUsed(player); + } + } +} diff --git a/KruacentExiled/KE.CustomRoles/Abilities/SCP049C/ToggleHighJump.cs b/KruacentExiled/KE.CustomRoles/Abilities/SCP049C/ToggleHighJump.cs new file mode 100644 index 00000000..9e11d292 --- /dev/null +++ b/KruacentExiled/KE.CustomRoles/Abilities/SCP049C/ToggleHighJump.cs @@ -0,0 +1,49 @@ +using Exiled.API.Features; +using KE.CustomRoles.API.Features; +using KE.CustomRoles.CR.CustomSCPs.SCP049C.UnlockableAbilities.Tier1; +using MEC; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace KE.CustomRoles.Abilities.SCP049C +{ + public class ToggleHighJump : KEAbilities + { + public override string Name { get; } = "ToggleHighJump"; + + + protected override Dictionary> SetTranslation() + { + return new() + { + ["en"] = new() + { + [TranslationKeyName] = "Toggle Big Jump", + [TranslationKeyDesc] = "WIP", + }, + ["fr"] = new() + { + [TranslationKeyName] = "Active/désactive grand saut", + [TranslationKeyDesc] = "WIP", + } + }; + } + + public override float Cooldown { get; } = 2f; + + protected override bool AbilityUsed(Player player) + { + if (!player.GameObject.TryGetComponent(out var comp)) + { + player.GameObject.AddComponent(); + return true; + } + comp.IsActive = !comp.IsActive; + + return base.AbilityUsed(player); + } + } +} diff --git a/KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP049C/SCP049CLevelPosition.cs b/KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP049C/Positions/SCP049CLevelPosition.cs similarity index 89% rename from KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP049C/SCP049CLevelPosition.cs rename to KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP049C/Positions/SCP049CLevelPosition.cs index c8e47a85..0b880bfc 100644 --- a/KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP049C/SCP049CLevelPosition.cs +++ b/KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP049C/Positions/SCP049CLevelPosition.cs @@ -6,7 +6,7 @@ using System.Text; using System.Threading.Tasks; -namespace KE.CustomRoles.CR.CustomSCPs.SCP049C +namespace KE.CustomRoles.CR.CustomSCPs.SCP049C.Positions { public class SCP049CLevelPosition : HintPosition { diff --git a/KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP049C/Positions/SCP049CUnlockablePosition.cs b/KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP049C/Positions/SCP049CUnlockablePosition.cs new file mode 100644 index 00000000..a6a5bce6 --- /dev/null +++ b/KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP049C/Positions/SCP049CUnlockablePosition.cs @@ -0,0 +1,41 @@ +using HintServiceMeow.Core.Enum; +using KE.Utils.API.Displays.DisplayMeow.Placements; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace KE.CustomRoles.CR.CustomSCPs.SCP049C.Positions +{ + internal class SCP049CUnlockableTitlePosition : HintPosition + { + public override float Xposition => 0; + + public override float Yposition => 360; + + public override HintAlignment HintAlignment => HintAlignment.Center; + public override string Name => "SCP049CUnlockableTitle"; + } + + + internal class SCP049CUnlockableLeftPosition : HintPosition + { + public override float Xposition => -400; + + public override float Yposition => 450; + + public override HintAlignment HintAlignment => HintAlignment.Center; + public override string Name => "SCP049CUnlockableLeft"; + } + + internal class SCP049CUnlockableRightPosition : HintPosition + { + public override float Xposition => 400; + + public override float Yposition => 450; + + public override HintAlignment HintAlignment => HintAlignment.Center; + public override string Name => "SCP049CUnlockableRight"; + } +} diff --git a/KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP049C/SCP049CGUI.cs b/KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP049C/SCP049CGUI.cs new file mode 100644 index 00000000..c7214421 --- /dev/null +++ b/KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP049C/SCP049CGUI.cs @@ -0,0 +1,144 @@ +using Exiled.API.Features; +using HintServiceMeow.Core.Enum; +using HintServiceMeow.Core.Models.HintContent; +using KE.CustomRoles.CR.CustomSCPs.SCP049C.Positions; +using KE.CustomRoles.CR.CustomSCPs.SCP049C.UnlockableAbilities; +using KE.Utils.API.Displays.DisplayMeow; +using KE.Utils.API.Displays.DisplayMeow.Placements; +using NorthwoodLib.Pools; +using PlayerRoles.FirstPersonControl.Thirdperson; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace KE.CustomRoles.CR.CustomSCPs.SCP049C +{ + public class SCP049CGUI : IDisposable + { + + private SCP049CLevelSystem _lvl; + + private Player player => Player.Get(_lvl.Hub); + public static readonly HintPosition HintTitlePosition = new SCP049CUnlockableTitlePosition(); + public static readonly HintPosition HintLeftPosition = new SCP049CUnlockableLeftPosition(); + public static readonly HintPosition HintRightPosition = new SCP049CUnlockableRightPosition(); + + + private int timeRemaining => _lvl.TimeRemaining; + public SCP049CGUI(SCP049CLevelSystem lvl) + { + _lvl = lvl; + } + + public Unlockable[] UnlockableOnScreen { get; private set; } + public void CreateHints(List ability) + { + UnlockableOnScreen = ability.ToArray(); + CreateAutoIfNotExist(player, HintTitlePosition, (arg) => Title(player),HintSyncSpeed.Normal); + CreateAutoIfNotExist(player, HintLeftPosition, (arg) => GetContent(player, HintLeftPosition.HintPlacement), HintSyncSpeed.Fastest); + CreateAutoIfNotExist(player, HintRightPosition, (arg) => GetContent(player, HintRightPosition.HintPlacement), HintSyncSpeed.Fastest); + } + + private void CreateAutoIfNotExist(Player player,HintPosition hintPosition, AutoContent.TextUpdateHandler update, HintSyncSpeed hintSyncSpeed) + { + if (!DisplayHandler.Instance.HasHint(player, hintPosition.HintPlacement)) + { + DisplayHandler.Instance.CreateAuto(player, update, hintPosition.HintPlacement, hintSyncSpeed); + } + } + + public void DestroyHints() + { + DisplayHandler.Instance.RemoveHint(player, HintTitlePosition.HintPlacement); + DisplayHandler.Instance.RemoveHint(player, HintLeftPosition.HintPlacement); + DisplayHandler.Instance.RemoveHint(player, HintRightPosition.HintPlacement); + UnlockableOnScreen = null; + } + + + private const string TitleMessage = "Choose an ability! (%seconds%s)"; + + + private string Title(Player player) + { + return TitleMessage.Replace("%seconds%", timeRemaining.ToString()); + } + + + public const int FontSize = 15; + + private string GetContent(Player player,HintPlacement hintPlacement) + { + StringBuilder sb = StringBuilderPool.Shared.Rent(); + string msg; + try + { + + int abilityShowingIndex; + + if (hintPlacement.XCoordinate < 0) + { + abilityShowingIndex = 0; + } + else + { + abilityShowingIndex = 1; + } + + + + + Unlockable unlockable= UnlockableOnScreen[abilityShowingIndex]; + + bool flag = _lvl.Selected == abilityShowingIndex; + + if (flag) + { + sb.AppendLine(""); + } + + + sb.AppendLine(unlockable.GetName(player.ReferenceHub)); + if (flag) + { + sb.AppendLine(""); + } + + sb.Append(""); + sb.Append(unlockable.GetDescription(player.ReferenceHub)); + sb.Append(""); + } + catch(Exception e) + { + Log.Error(e); + } + finally + { + msg = sb.ToString(); + + StringBuilderPool.Shared.Return(sb); + if (string.IsNullOrEmpty(msg)) + { + msg = " "; + } + } + return msg; + + } + + + + + public void Dispose() + { + if (player != null) + { + DestroyHints(); + } + } + } +} diff --git a/KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP049C/SCP049CLevelSystem.cs b/KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP049C/SCP049CLevelSystem.cs index f419c2dc..065078af 100644 --- a/KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP049C/SCP049CLevelSystem.cs +++ b/KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP049C/SCP049CLevelSystem.cs @@ -1,19 +1,19 @@ using Exiled.API.Enums; using Exiled.API.Features; -using Exiled.Events.EventArgs.Scp049; -using Exiled.Events.Patches.Events.Scp0492; -using JetBrains.Annotations; +using KE.CustomRoles.CR.CustomSCPs.SCP049C.Positions; using KE.CustomRoles.CR.CustomSCPs.SCP049C.UnlockableAbilities; +using KE.CustomRoles.Settings; using KE.Utils.API; +using KE.Utils.API.Displays.DisplayMeow; +using KE.Utils.API.Displays.DisplayMeow.Placements; using KE.Utils.API.Features; +using MEC; using NorthwoodLib.Pools; using PlayerRoles.FirstPersonControl; using PlayerRoles.Ragdolls; using System; using System.Collections.Generic; using System.Linq; -using System.Text; -using System.Threading.Tasks; using UnityEngine; namespace KE.CustomRoles.CR.CustomSCPs.SCP049C @@ -33,36 +33,89 @@ public int Level } } - private const int killperlevel = 2; + public const int MaxLevel = 3; + private int currentkill = 0; + private int objective = 0; + + + public int CurrentKill => currentkill; + public int KillObjective => objective; + + public bool MaxLevelReached + { + get + { + return Level < MaxLevel; + } + } private ReferenceHub _hub; - public List CurrentAbilities { get; private set; } + public ReferenceHub Hub => _hub; + private SCP049CGUI gui; + public SCP049CGUI GUI => gui; + + public List CurrentAbilities { get; private set; } - private static HashSet abilities; + private static HashSet abilities; - private static IReadOnlyCollection Abilities + private static IReadOnlyCollection Abilities { get { if(abilities == null) { - abilities = ReflectionHelper.GetObjects().ToHashSet(); + abilities = ReflectionHelper.GetObjects().ToHashSet(); } return abilities; } } + public void Awake() { _hub = ReferenceHub.GetHub(base.gameObject); CurrentAbilities = new(); + currentkill = 0; + currentTime = 0; + Level = 0; + objective = GetNbKillPerTier(0); + + gui = new(this); + + SettingHandler.RightPressed += SettingHandler_RightPressed; + SettingHandler.LeftPressed += SettingHandler_LeftPressed; + + } - public void OnDestroy() + + private int selected = 0; + public int Selected => selected; + private const int maxPerScreen = 2; + private void SettingHandler_LeftPressed(Player obj) { + if (obj.ReferenceHub != _hub) return; + if (!CurrentlyChoosing) return; + + selected = Mathf.Abs((selected - 1) % maxPerScreen); + } + + private void SettingHandler_RightPressed(Player obj) + { + if (obj.ReferenceHub != _hub) return; + if (!CurrentlyChoosing) return; + + selected = (selected + 1) % maxPerScreen; + } + + public void OnDestroy() + { + GUI.Dispose(); + gui = null; + DisableAll(); } @@ -72,18 +125,29 @@ public void AddKill() KELog.Debug("add kill"); currentkill++; - if(currentkill >= killperlevel) + if(!MaxLevelReached &¤tkill >= KillObjective) { currentkill = 0; + AddLevel(); } } + public static int GetNbKillPerTier(int tier) + { + int x = tier + 1; + + double result = ((-1) * Math.Pow(x, 2)) + (6*x)-1; + + return (int)Math.Ceiling(result); + + } + public void DisableAll() { - foreach (UnlockableAbility ability in CurrentAbilities) + foreach (Unlockable ability in CurrentAbilities) { ability.Remove(_hub); } @@ -91,11 +155,11 @@ public void DisableAll() public void AddLevel() { - List ability = ListPool.Shared.Rent(); + List ability = ListPool.Shared.Rent(); Level++; - - foreach(UnlockableAbility possibleAbility in Abilities) + objective = GetNbKillPerTier(Level); + foreach (Unlockable possibleAbility in Abilities) { if(possibleAbility.Tier == Level) { @@ -103,20 +167,66 @@ public void AddLevel() } } + Log.Debug("nbaiblit"+ability.Count); + Timing.RunCoroutine(GiveNewUnlockable(ability)); + + + } + - //todo choose ability - UnlockableAbility choosen = ability.RandomItem(); - KELog.Debug(choosen.GetType().Name); - ListPool.Shared.Return(ability); - choosen.Grant(_hub); - CurrentAbilities.Add(choosen); - KELog.Debug(CurrentAbilities.Count); + + + + private int currentTime = 0; + private const int maxTime = 17; + public int TimeRemaining => maxTime-currentTime; + + private bool currentlyChoosing = false; + public bool CurrentlyChoosing => currentlyChoosing; + private IEnumerator GiveNewUnlockable(List ability) + { + + Unlockable choosen = null; + + + GUI.CreateHints(ability); + currentTime = 0; + selected = 0; + currentlyChoosing = true; + while (currentTime < maxTime) + { + yield return Timing.WaitForSeconds(1); + currentTime++; + } + + try + { + currentlyChoosing = false; + + choosen = GUI.UnlockableOnScreen[selected]; + GUI.DestroyHints(); + + if (choosen != null) + { + choosen.Grant(_hub); + CurrentAbilities.Add(choosen); + KELog.Debug(CurrentAbilities.Count); + } + } + catch(Exception e) + { + Log.Error(e); + } + finally + { + ListPool.Shared.Return(ability); + } } @@ -124,7 +234,7 @@ public void AddLevel() private Ragdoll ragdoll = null; private float cooldown = 0f; - private float objective = 10f; + private float timeOnCorpse = 10f; internal void Update() { @@ -155,7 +265,7 @@ private void UpdateTime() comp.SetColor(Color.red); - if (cooldown > objective) + if (cooldown > timeOnCorpse) { ragdoll.Destroy(); AddKill(); diff --git a/KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP049C/SCP049CRole.cs b/KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP049C/SCP049CRole.cs index e9aabfc5..857619be 100644 --- a/KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP049C/SCP049CRole.cs +++ b/KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP049C/SCP049CRole.cs @@ -1,19 +1,15 @@ using Exiled.API.Features; -using Exiled.API.Features.Roles; using Exiled.Events.EventArgs.Player; using Exiled.Events.EventArgs.Scp049; using KE.CustomRoles.API.Features; -using KE.Utils.API.Features; +using KE.CustomRoles.CR.CustomSCPs.SCP049C.Positions; +using KE.Utils.API.Displays.DisplayMeow; using LabApi.Events.Arguments.Scp049Events; -using MapGeneration.Rooms; +using NorthwoodLib.Pools; using PlayerRoles; using PlayerStatsSystem; -using System; using System.Collections.Generic; -using System.Linq; using System.Text; -using System.Threading.Tasks; -using UnityEngine; namespace KE.CustomRoles.CR.CustomSCPs.SCP049C { @@ -51,23 +47,65 @@ public override void Init() instance = this; base.Init(); } - + + public static readonly SCP049CLevelPosition HintPosition = new(); protected override void RoleAdded(Player player) { player.ReferenceHub.gameObject.AddComponent(); + if (!DisplayHandler.Instance.HasHint(player, HintPosition.HintPlacement)) + { + DisplayHandler.Instance.CreateAuto(player, (arg) => GetContent(player), HintPosition.HintPlacement); + } + + base.RoleAdded(player); } + + + public string GetContent(Player player) + { + if(!player.GameObject.TryGetComponent(out var comp)) + { + return " "; + } + + StringBuilder sb = StringBuilderPool.Shared.Rent(); + bool flag = comp.MaxLevelReached; + + if (flag) + { + sb.Append("Tier : "); + sb.AppendLine(comp.Level.ToString()); + } + else + { + sb.AppendLine("Max Tier"); + } + + sb.Append("Kill : "); + sb.Append(comp.CurrentKill); + if (flag) + { + sb.Append("/"); + sb.Append(comp.KillObjective); + } + return StringBuilderPool.Shared.ToStringReturn(sb); + } + protected override void RoleRemoved(Player player) { + DisplayHandler.Instance.RemoveHint(player, HintPosition.HintPlacement); + if(player.ReferenceHub.gameObject.TryGetComponent(out var lvl)) { UnityEngine.Object.Destroy(lvl); } + base.RoleRemoved(player); } diff --git a/KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP049C/UnlockableAbilities/JumpUnlockable.cs b/KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP049C/UnlockableAbilities/JumpUnlockable.cs deleted file mode 100644 index 745c8ed4..00000000 --- a/KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP049C/UnlockableAbilities/JumpUnlockable.cs +++ /dev/null @@ -1,34 +0,0 @@ -using Exiled.API.Features; -using Exiled.API.Features.Roles; -using PlayerRoles.FirstPersonControl; -using System; -using LabPlayer = LabApi.Features.Wrappers.Player; -namespace KE.CustomRoles.CR.CustomSCPs.SCP049C.UnlockableAbilities -{ - internal class JumpUnlockable : UnlockableAbility - { - public override byte Tier => 5; //1 - - public override void Grant(ReferenceHub hub) - { - Player lab = Player.Get(hub); - - - if(lab.Role is FpcRole role) - { - role.Gravity = UnityEngine.Vector3.up * (-3); - } - } - - public override void Remove(ReferenceHub hub) - { - Player lab = Player.Get(hub); - - - if (lab.Role is FpcRole role) - { - role.Gravity = FpcGravityController.DefaultGravity; - } - } - } -} diff --git a/KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP049C/UnlockableAbilities/StunUnlockable.cs b/KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP049C/UnlockableAbilities/StunUnlockable.cs deleted file mode 100644 index 1486b9e8..00000000 --- a/KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP049C/UnlockableAbilities/StunUnlockable.cs +++ /dev/null @@ -1,28 +0,0 @@ -using CustomPlayerEffects; -using Exiled.API.Features; -using InventorySystem.Items.Usables.Scp1344; -using KE.Utils.API.Features; -using System; -using LabPlayer = LabApi.Features.Wrappers.Player; -namespace KE.CustomRoles.CR.CustomSCPs.SCP049C.UnlockableAbilities -{ - internal class StunUnlockable : UnlockableAbility - { - public override byte Tier => 2; - - public override void Grant(ReferenceHub hub) - { - LabPlayer lab = LabPlayer.Get(hub); - - - - } - - public override void Remove(ReferenceHub hub) - { - LabPlayer lab = LabPlayer.Get(hub); - - KELog.Debug("remove"); - } - } -} diff --git a/KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP049C/UnlockableAbilities/Tier1/HigherJumpComp.cs b/KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP049C/UnlockableAbilities/Tier1/HigherJumpComp.cs new file mode 100644 index 00000000..8cbcf928 --- /dev/null +++ b/KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP049C/UnlockableAbilities/Tier1/HigherJumpComp.cs @@ -0,0 +1,65 @@ +using Exiled.API.Features; +using Exiled.API.Features.Roles; +using Mirror; +using PlayerRoles.FirstPersonControl; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using UnityEngine; +using Utf8Json.Internal.DoubleConversion; + +namespace KE.CustomRoles.CR.CustomSCPs.SCP049C.UnlockableAbilities.Tier1 +{ + internal class HigherJumpComp : MonoBehaviour + { + + private Player _player; + private static readonly Vector3 _jumpgravity = UnityEngine.Vector3.up * -3; + + private void Awake() + { + _player = Player.Get(base.gameObject); + IsActive = false; + } + + public bool IsActive { get; set; } + + private void Update() + { + + if(_player.Role is FpcRole fpc) + { + + if (IsActive) + { + + Vector3 vector = (fpc.Velocity.y < 0f) ? FpcGravityController.DefaultGravity : _jumpgravity; + if (fpc.Gravity != vector) + { + fpc.Gravity = vector; + } + } + else + { + fpc.Gravity = FpcGravityController.DefaultGravity; + } + } + + } + + private void OnDestroy() + { + if(_player.Role is FpcRole fpc) + { + fpc.Gravity = FpcGravityController.DefaultGravity; + } + } + + public void Destroy() + { + Destroy(this); + } + } +} diff --git a/KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP049C/UnlockableAbilities/Tier1/JumpUnlockable.cs b/KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP049C/UnlockableAbilities/Tier1/JumpUnlockable.cs new file mode 100644 index 00000000..d8b15f06 --- /dev/null +++ b/KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP049C/UnlockableAbilities/Tier1/JumpUnlockable.cs @@ -0,0 +1,44 @@ +using Exiled.API.Features; +using Exiled.API.Features.Roles; +using KE.CustomRoles.Abilities.SCP049C; +using KE.CustomRoles.API.Features; +using PlayerRoles.FirstPersonControl; +using System; +using UnityEngine; +using LabPlayer = LabApi.Features.Wrappers.Player; +namespace KE.CustomRoles.CR.CustomSCPs.SCP049C.UnlockableAbilities.Tier1 +{ + internal class JumpUnlockable : UnlockableAbility + { + public override byte Tier => 1; //1 + + public override KEAbilities Ability => KEAbilities.Get("ToggleHighJump"); + + public override string GetName(ReferenceHub hub) + { + return "Jump"; + } + public override string GetDescription(ReferenceHub hub) + { + return "You can now jump higher\n(high enough to go up Gate B)"; + } + public override void Grant(ReferenceHub hub) + { + + if (!hub.gameObject.TryGetComponent(out _)) + { + hub.gameObject.AddComponent(); + } + base.Grant(hub); + } + + public override void Remove(ReferenceHub hub) + { + if (hub.gameObject.TryGetComponent(out var comp)) + { + comp.Destroy(); + } + base.Remove(hub); + } + } +} diff --git a/KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP049C/UnlockableAbilities/MoreShieldUnlockable.cs b/KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP049C/UnlockableAbilities/Tier1/MoreShieldUnlockable.cs similarity index 70% rename from KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP049C/UnlockableAbilities/MoreShieldUnlockable.cs rename to KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP049C/UnlockableAbilities/Tier1/MoreShieldUnlockable.cs index 42eb710b..fb3c8b3a 100644 --- a/KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP049C/UnlockableAbilities/MoreShieldUnlockable.cs +++ b/KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP049C/UnlockableAbilities/Tier1/MoreShieldUnlockable.cs @@ -3,12 +3,19 @@ using System; using UnityEngine; using LabPlayer = LabApi.Features.Wrappers.Player; -namespace KE.CustomRoles.CR.CustomSCPs.SCP049C.UnlockableAbilities +namespace KE.CustomRoles.CR.CustomSCPs.SCP049C.UnlockableAbilities.Tier1 { - internal class MoreShieldUnlockable : UnlockableAbility + internal class MoreShieldUnlockable : Unlockable { public override byte Tier => 1; - + public override string GetName(ReferenceHub hub) + { + return "More shield"; + } + public override string GetDescription(ReferenceHub hub) + { + return "Set your max Shield at 700\ninstead of 300"; + } public override void Grant(ReferenceHub hub) { LabPlayer lab = LabPlayer.Get(hub); diff --git a/KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP049C/UnlockableAbilities/Tier2/SmallUnlockable.cs b/KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP049C/UnlockableAbilities/Tier2/SmallUnlockable.cs new file mode 100644 index 00000000..5714e9a6 --- /dev/null +++ b/KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP049C/UnlockableAbilities/Tier2/SmallUnlockable.cs @@ -0,0 +1,26 @@ +using CustomPlayerEffects; +using Exiled.API.Features; +using InventorySystem.Items.Usables.Scp1344; +using KE.CustomRoles.API.Features; +using KE.Utils.API.Features; +using System; +using LabPlayer = LabApi.Features.Wrappers.Player; +namespace KE.CustomRoles.CR.CustomSCPs.SCP049C.UnlockableAbilities.Tier2 +{ + internal class SmallUnlockable : UnlockableAbility + { + public override byte Tier => 2; + + public override KEAbilities Ability => KEAbilities.Get("Small"); + + public override string GetName(ReferenceHub hub) + { + return "Smol"; + } + public override string GetDescription(ReferenceHub hub) + { + return "Gain a new ability to be small for 30 seconds (60s of cooldown)"; + } + + } +} diff --git a/KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP049C/UnlockableAbilities/WallAbilityUnlockable.cs b/KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP049C/UnlockableAbilities/Tier2/WallAbilityUnlockable.cs similarity index 56% rename from KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP049C/UnlockableAbilities/WallAbilityUnlockable.cs rename to KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP049C/UnlockableAbilities/Tier2/WallAbilityUnlockable.cs index 335fd839..f6927831 100644 --- a/KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP049C/UnlockableAbilities/WallAbilityUnlockable.cs +++ b/KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP049C/UnlockableAbilities/Tier2/WallAbilityUnlockable.cs @@ -4,11 +4,19 @@ using PlayerRoles.FirstPersonControl; using System; using LabPlayer = LabApi.Features.Wrappers.Player; -namespace KE.CustomRoles.CR.CustomSCPs.SCP049C.UnlockableAbilities +namespace KE.CustomRoles.CR.CustomSCPs.SCP049C.UnlockableAbilities.Tier2 { - internal class WallAbilityUnlockable : UnlockableAbility + internal class WallAbilityUnlockable : Unlockable { public override byte Tier => 2; + public override string GetName(ReferenceHub hub) + { + return "Deflect Damages"; + } + public override string GetDescription(ReferenceHub hub) + { + return "1 chance sur 8 d'annuler un dégât (.5s par hp sauvé de cooldown)"; + } public override void Grant(ReferenceHub hub) { @@ -17,7 +25,7 @@ public override void Grant(ReferenceHub hub) public override void Remove(ReferenceHub hub) { - KELog.Debug("remove"); + } } } diff --git a/KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP049C/UnlockableAbilities/GogglesNoWarningUnlockable.cs b/KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP049C/UnlockableAbilities/Tier3/GogglesNoWarningUnlockable.cs similarity index 61% rename from KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP049C/UnlockableAbilities/GogglesNoWarningUnlockable.cs rename to KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP049C/UnlockableAbilities/Tier3/GogglesNoWarningUnlockable.cs index b08769c3..1a1fa900 100644 --- a/KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP049C/UnlockableAbilities/GogglesNoWarningUnlockable.cs +++ b/KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP049C/UnlockableAbilities/Tier3/GogglesNoWarningUnlockable.cs @@ -3,12 +3,19 @@ using InventorySystem.Items.Usables.Scp1344; using System; using LabPlayer = LabApi.Features.Wrappers.Player; -namespace KE.CustomRoles.CR.CustomSCPs.SCP049C.UnlockableAbilities +namespace KE.CustomRoles.CR.CustomSCPs.SCP049C.UnlockableAbilities.Tier3 { - internal class GogglesNoWarningUnlockable : UnlockableAbility + internal class GogglesNoWarningUnlockable : Unlockable { - public override byte Tier => 99; //3 - + public override byte Tier => 3; //3 + public override string GetName(ReferenceHub hub) + { + return "SCP-1344"; + } + public override string GetDescription(ReferenceHub hub) + { + return "See through walls like when using SCP-1344"; + } public override void Grant(ReferenceHub hub) { LabPlayer lab = LabPlayer.Get(hub); diff --git a/KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP049C/UnlockableAbilities/SpeedUnlockable.cs b/KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP049C/UnlockableAbilities/Tier3/SpeedUnlockable.cs similarity index 71% rename from KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP049C/UnlockableAbilities/SpeedUnlockable.cs rename to KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP049C/UnlockableAbilities/Tier3/SpeedUnlockable.cs index 40806cda..af89f8ae 100644 --- a/KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP049C/UnlockableAbilities/SpeedUnlockable.cs +++ b/KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP049C/UnlockableAbilities/Tier3/SpeedUnlockable.cs @@ -4,19 +4,28 @@ using KE.Utils.API.Features; using System; using LabPlayer = LabApi.Features.Wrappers.Player; -namespace KE.CustomRoles.CR.CustomSCPs.SCP049C.UnlockableAbilities +namespace KE.CustomRoles.CR.CustomSCPs.SCP049C.UnlockableAbilities.Tier3 { - internal class SpeedUnlockable : UnlockableAbility + internal class SpeedUnlockable : Unlockable { public override byte Tier => 3; + public override string GetName(ReferenceHub hub) + { + return "Speed"; + } + public override string GetDescription(ReferenceHub hub) + { + return "Become 25% faster but lose all of the other abilities"; + } + public override void Grant(ReferenceHub hub) { LabPlayer lab = LabPlayer.Get(hub); MovementBoost move = lab.GetEffect(); - lab.EnableEffect((byte)(move.Intensity + 50), 0, false); + lab.EnableEffect((byte)(move.Intensity + 25), 0, false); hub.GetComponent().DisableAll(); @@ -27,7 +36,7 @@ public override void Remove(ReferenceHub hub) LabPlayer lab = LabPlayer.Get(hub); MovementBoost move = lab.GetEffect(); - lab.EnableEffect((byte)(move.Intensity - 50), 0, false); + lab.EnableEffect((byte)(move.Intensity - 25), 0, false); diff --git a/KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP049C/UnlockableAbilities/Unlockable.cs b/KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP049C/UnlockableAbilities/Unlockable.cs new file mode 100644 index 00000000..8b11119b --- /dev/null +++ b/KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP049C/UnlockableAbilities/Unlockable.cs @@ -0,0 +1,25 @@ +using Exiled.API.Features; +using KE.CustomRoles.API.Features; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace KE.CustomRoles.CR.CustomSCPs.SCP049C.UnlockableAbilities +{ + public abstract class Unlockable + { + + public abstract byte Tier { get; } + + public abstract string GetName(ReferenceHub hub); + public abstract string GetDescription(ReferenceHub hub); + + public abstract void Grant(ReferenceHub hub); + + + public abstract void Remove(ReferenceHub hub); + + } +} diff --git a/KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP049C/UnlockableAbilities/UnlockableAbility.cs b/KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP049C/UnlockableAbilities/UnlockableAbility.cs index bb39a8ad..629a297d 100644 --- a/KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP049C/UnlockableAbilities/UnlockableAbility.cs +++ b/KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP049C/UnlockableAbilities/UnlockableAbility.cs @@ -8,16 +8,29 @@ namespace KE.CustomRoles.CR.CustomSCPs.SCP049C.UnlockableAbilities { - public abstract class UnlockableAbility + public abstract class UnlockableAbility : Unlockable { - public abstract byte Tier { get; } - public abstract void Grant(ReferenceHub hub); + public abstract KEAbilities Ability { get; } + public override void Grant(ReferenceHub hub) + { + Player player = Player.Get(hub); + Ability.AddAbility(player); - public abstract void Remove(ReferenceHub hub); + if(!KEAbilities.TryGetSelected(player, out _)) + { + KEAbilities.SelectFirstAbility(player); + } + + } + + public override void Remove(ReferenceHub hub) + { + Ability.RemoveAbility(Player.Get(hub)); + } } } diff --git a/KruacentExiled/KE.CustomRoles/Settings/SettingHandler.cs b/KruacentExiled/KE.CustomRoles/Settings/SettingHandler.cs index 496ddc1e..875fcc15 100644 --- a/KruacentExiled/KE.CustomRoles/Settings/SettingHandler.cs +++ b/KruacentExiled/KE.CustomRoles/Settings/SettingHandler.cs @@ -27,12 +27,16 @@ internal class SettingHandler : IUsingEvents private readonly int _idArrow = 152; private readonly int _idTimeAbilityDesc = 153; private readonly int _idReshowCustomRole = 154; + private readonly int _idLeft = 7000; + private readonly int _idRight = 7001; public static event Action DownPressed = delegate { }; public static event Action UpPressed = delegate { }; + public static event Action LeftPressed = delegate { }; + public static event Action RightPressed = delegate { }; public static SettingHandler Instance { get; private set; } private List settings; @@ -56,7 +60,9 @@ public SettingHandler() new KeybindSetting(_idDown, "Select down", UnityEngine.KeyCode.None,header:header), new KeybindSetting(_idSelect, "Use selected ability", UnityEngine.KeyCode.None,header:header), arrow, - new ButtonSetting(_idReshowCustomRole, "Reshow Custom role description","click",header:header) + new ButtonSetting(_idReshowCustomRole, "Reshow Custom role description","click",header:header), + new KeybindSetting(_idLeft, "Left", UnityEngine.KeyCode.LeftArrow,header:header), + new KeybindSetting(_idRight, "Right", UnityEngine.KeyCode.RightArrow,header:header), }; @@ -140,7 +146,17 @@ private void OnSettingValueReceived(Player player, ServerSpecificSettingBase set KEAbilities.UseSelected(player); } - if (settingBase is SSButton buttonSetting) + if (CheckPressed(settingBase, _idLeft)) + { + LeftPressed?.Invoke(player); + } + + if (CheckPressed(settingBase, _idRight)) + { + RightPressed?.Invoke(player); + } + + if (settingBase is SSButton buttonSetting && buttonSetting.SettingId == _idReshowCustomRole) { KECustomRole cr = KECustomRole.Get(player).FirstOrDefault(); @@ -148,8 +164,6 @@ private void OnSettingValueReceived(Player player, ServerSpecificSettingBase set { cr.Show(player); } - - } From 378f7c9638c99ac43e44be9d71a94698369312db Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Tue, 24 Feb 2026 16:19:08 +0100 Subject: [PATCH 656/853] curpos --- KruacentExiled/KE.Items/CommandPos.cs | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/KruacentExiled/KE.Items/CommandPos.cs b/KruacentExiled/KE.Items/CommandPos.cs index 4e2d47fd..9fe0d44b 100644 --- a/KruacentExiled/KE.Items/CommandPos.cs +++ b/KruacentExiled/KE.Items/CommandPos.cs @@ -32,12 +32,22 @@ public bool Execute(ArraySegment arguments, ICommandSender sender, out s Timing.CallDelayed(3f,prim.Destroy); - response = p.CurrentRoom.Type + - "\n" + p.CurrentRoom.LocalPosition(p.Position) + - "\n" + p.CurrentRoom.Rotation.eulerAngles + - "\n" + p.Position.ToString() + - "\n" + p.CurrentRoom.LocalPosition(p.Position); - return true; + if(p.CurrentRoom == null) + { + response = p.Position.ToString(); + } + else + { + response = p.CurrentRoom.Type + + "\n" + p.CurrentRoom.LocalPosition(p.Position) + + "\n" + p.CurrentRoom.Rotation.eulerAngles + + "\n" + p.Position.ToString() + + "\n" + p.CurrentRoom.LocalPosition(p.Position); + } + + + + return true; } response = "no"; return false; From e10324ca0e07f542b478df2e71b87cfcdb0e93e6 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Tue, 24 Feb 2026 16:29:24 +0100 Subject: [PATCH 657/853] elevator wrapper --- .../Others/CustomElevator/CustomElevator.cs | 29 +++++++++++++++++++ .../Others/CustomElevator/KEElevator.cs | 29 +++++++++++++++++++ .../Others/CustomElevator/VanillaElevator.cs | 28 ++++++++++++++++++ 3 files changed, 86 insertions(+) create mode 100644 KruacentExiled/KE.Map/Others/CustomElevator/CustomElevator.cs create mode 100644 KruacentExiled/KE.Map/Others/CustomElevator/KEElevator.cs create mode 100644 KruacentExiled/KE.Map/Others/CustomElevator/VanillaElevator.cs diff --git a/KruacentExiled/KE.Map/Others/CustomElevator/CustomElevator.cs b/KruacentExiled/KE.Map/Others/CustomElevator/CustomElevator.cs new file mode 100644 index 00000000..3dfda3d1 --- /dev/null +++ b/KruacentExiled/KE.Map/Others/CustomElevator/CustomElevator.cs @@ -0,0 +1,29 @@ +using KE.Map.Surface.ElevatorGateA; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using UnityEngine; + +namespace KE.Map.Others.CustomElevator +{ + public class CustomElevator : KEElevator + { + + public static ElevatorModel model { get; } = new(); + + public override bool IsReady => false; + + public override void Send() + { + + } + + + public CustomElevator() + { + + } + } +} diff --git a/KruacentExiled/KE.Map/Others/CustomElevator/KEElevator.cs b/KruacentExiled/KE.Map/Others/CustomElevator/KEElevator.cs new file mode 100644 index 00000000..f1d7ae10 --- /dev/null +++ b/KruacentExiled/KE.Map/Others/CustomElevator/KEElevator.cs @@ -0,0 +1,29 @@ +using CustomPlayerEffects; +using LabApi.Features.Wrappers; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace KE.Map.Others.CustomElevator +{ + public abstract class KEElevator + { + + public static HashSet elevators = new(); + + + + public abstract bool IsReady { get; } + public abstract void Send(); + + + + public KEElevator() + { + elevators.Add(this); + } + + } +} diff --git a/KruacentExiled/KE.Map/Others/CustomElevator/VanillaElevator.cs b/KruacentExiled/KE.Map/Others/CustomElevator/VanillaElevator.cs new file mode 100644 index 00000000..91188610 --- /dev/null +++ b/KruacentExiled/KE.Map/Others/CustomElevator/VanillaElevator.cs @@ -0,0 +1,28 @@ +using LabApi.Features.Wrappers; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace KE.Map.Others.CustomElevator +{ + public class VanillaElevator : KEElevator + { + + public Elevator Elevator { get; } + + + public override bool IsReady => Elevator.IsReady; + public override void Send() + { + Elevator.SendToNextFloor(); + } + + + public VanillaElevator(Elevator elevator) : base() + { + Elevator = elevator; + } + } +} From 4eed4d6544eece935cd8f8cbd4679fb76dd7ce45 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Tue, 24 Feb 2026 16:31:06 +0100 Subject: [PATCH 658/853] better killer pit --- .../KE.Map/Surface/ElevatorGateA/CustomKillerCollision.cs | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/KruacentExiled/KE.Map/Surface/ElevatorGateA/CustomKillerCollision.cs b/KruacentExiled/KE.Map/Surface/ElevatorGateA/CustomKillerCollision.cs index 113bd126..3da2aef4 100644 --- a/KruacentExiled/KE.Map/Surface/ElevatorGateA/CustomKillerCollision.cs +++ b/KruacentExiled/KE.Map/Surface/ElevatorGateA/CustomKillerCollision.cs @@ -24,10 +24,7 @@ private void Update() if (InBound(player)) { PitDeath pit = player.GetEffect(); - if (!pit.IsEnabled) - { - pit.IsEnabled = true; - } + pit.KillPlayer(); } } From 26af6d4a67780992a88a3c39b056e0d6e3975689 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Tue, 24 Feb 2026 17:41:23 +0100 Subject: [PATCH 659/853] elvatro ocmp --- .../KE.Map/Others/CustomDoors/CustomDoor.cs | 12 ++ .../KE.Map/Others/CustomDoors/KEDoor.cs | 24 +++ .../KE.Map/Others/CustomDoors/VanillaDoor.cs | 23 +++ .../Others/CustomElevator/VanillaElevator.cs | 28 --- .../CustomElevator.cs | 5 +- .../KECustomElevators/KECustomElevator.cs | 191 ++++++++++++++++++ .../KECustomElevators/KEElevatorPanel.cs | 12 ++ .../KEElevator.cs | 3 +- .../Others/CustomElevators/VanillaElevator.cs | 29 +++ .../KE.Map/Others/CustomZones/AltasReader.cs | 2 +- .../Others/CustomZones/CREventHandler.cs | 6 +- .../Others/CustomZones/CustomFacilityZone.cs | 2 +- .../KE.Map/Others/CustomZones/CustomRoom.cs | 2 +- .../CustomZones/CustomRooms/MCZ/EndRoom.cs | 2 +- .../CustomZones/CustomRooms/MCZ/SCorridor.cs | 2 +- .../CustomZones/CustomRooms/MCZ/TCorridor.cs | 4 +- .../KE.Map/Others/CustomZones/CustomZone.cs | 2 +- .../KE.Map/Others/CustomZones/Layout.cs | 4 +- .../CustomZones/MediumContainmentZone.cs | 2 +- .../Others/CustomZones/SpawnedCustomRoom.cs | 2 +- .../ElevatorGateA/CustomElevatorGateA.cs | 9 + .../ElevatorGateA/CustomKillerCollision.cs | 5 + 22 files changed, 323 insertions(+), 48 deletions(-) create mode 100644 KruacentExiled/KE.Map/Others/CustomDoors/CustomDoor.cs create mode 100644 KruacentExiled/KE.Map/Others/CustomDoors/KEDoor.cs create mode 100644 KruacentExiled/KE.Map/Others/CustomDoors/VanillaDoor.cs delete mode 100644 KruacentExiled/KE.Map/Others/CustomElevator/VanillaElevator.cs rename KruacentExiled/KE.Map/Others/{CustomElevator => CustomElevators}/CustomElevator.cs (79%) create mode 100644 KruacentExiled/KE.Map/Others/CustomElevators/KECustomElevators/KECustomElevator.cs create mode 100644 KruacentExiled/KE.Map/Others/CustomElevators/KECustomElevators/KEElevatorPanel.cs rename KruacentExiled/KE.Map/Others/{CustomElevator => CustomElevators}/KEElevator.cs (91%) create mode 100644 KruacentExiled/KE.Map/Others/CustomElevators/VanillaElevator.cs diff --git a/KruacentExiled/KE.Map/Others/CustomDoors/CustomDoor.cs b/KruacentExiled/KE.Map/Others/CustomDoors/CustomDoor.cs new file mode 100644 index 00000000..7d355067 --- /dev/null +++ b/KruacentExiled/KE.Map/Others/CustomDoors/CustomDoor.cs @@ -0,0 +1,12 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace KE.Map.Others.CustomDoors +{ + internal class CustomDoor + { + } +} diff --git a/KruacentExiled/KE.Map/Others/CustomDoors/KEDoor.cs b/KruacentExiled/KE.Map/Others/CustomDoors/KEDoor.cs new file mode 100644 index 00000000..3d83b301 --- /dev/null +++ b/KruacentExiled/KE.Map/Others/CustomDoors/KEDoor.cs @@ -0,0 +1,24 @@ +using KE.Map.Others.CustomElevators; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace KE.Map.Others.CustomDoors +{ + public abstract class KEDoor + { + + + public static HashSet doors = new(); + + + + public abstract string NameTag { get; } + public KEDoor() + { + doors.Add(this); + } + } +} diff --git a/KruacentExiled/KE.Map/Others/CustomDoors/VanillaDoor.cs b/KruacentExiled/KE.Map/Others/CustomDoors/VanillaDoor.cs new file mode 100644 index 00000000..e29ae586 --- /dev/null +++ b/KruacentExiled/KE.Map/Others/CustomDoors/VanillaDoor.cs @@ -0,0 +1,23 @@ +using Exiled.API.Interfaces; +using LabApi.Features.Wrappers; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace KE.Map.Others.CustomDoors +{ + public class VanillaDoor : KEDoor, IWrapper + { + public Door Base { get; } + + public override string NameTag => Base.NameTag; + public VanillaDoor(Door door) : base() + { + Base = door; + + + } + } +} diff --git a/KruacentExiled/KE.Map/Others/CustomElevator/VanillaElevator.cs b/KruacentExiled/KE.Map/Others/CustomElevator/VanillaElevator.cs deleted file mode 100644 index 91188610..00000000 --- a/KruacentExiled/KE.Map/Others/CustomElevator/VanillaElevator.cs +++ /dev/null @@ -1,28 +0,0 @@ -using LabApi.Features.Wrappers; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace KE.Map.Others.CustomElevator -{ - public class VanillaElevator : KEElevator - { - - public Elevator Elevator { get; } - - - public override bool IsReady => Elevator.IsReady; - public override void Send() - { - Elevator.SendToNextFloor(); - } - - - public VanillaElevator(Elevator elevator) : base() - { - Elevator = elevator; - } - } -} diff --git a/KruacentExiled/KE.Map/Others/CustomElevator/CustomElevator.cs b/KruacentExiled/KE.Map/Others/CustomElevators/CustomElevator.cs similarity index 79% rename from KruacentExiled/KE.Map/Others/CustomElevator/CustomElevator.cs rename to KruacentExiled/KE.Map/Others/CustomElevators/CustomElevator.cs index 3dfda3d1..1761ae99 100644 --- a/KruacentExiled/KE.Map/Others/CustomElevator/CustomElevator.cs +++ b/KruacentExiled/KE.Map/Others/CustomElevators/CustomElevator.cs @@ -1,4 +1,5 @@ -using KE.Map.Surface.ElevatorGateA; +using Exiled.API.Interfaces; +using KE.Map.Surface.ElevatorGateA; using System; using System.Collections.Generic; using System.Linq; @@ -6,7 +7,7 @@ using System.Threading.Tasks; using UnityEngine; -namespace KE.Map.Others.CustomElevator +namespace KE.Map.Others.CustomElevators { public class CustomElevator : KEElevator { diff --git a/KruacentExiled/KE.Map/Others/CustomElevators/KECustomElevators/KECustomElevator.cs b/KruacentExiled/KE.Map/Others/CustomElevators/KECustomElevators/KECustomElevator.cs new file mode 100644 index 00000000..295b78ce --- /dev/null +++ b/KruacentExiled/KE.Map/Others/CustomElevators/KECustomElevators/KECustomElevator.cs @@ -0,0 +1,191 @@ +using Exiled.API.Features; +using Exiled.API.Features.Objectives; +using Exiled.API.Features.Toys; +using KE.Map.Surface.ElevatorGateA; +using KE.Utils.API.Features; +using KE.Utils.Quality.Models; +using MEC; +using ProjectMER.Commands.Modifying.Scale; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Unity.Profiling; +using UnityEngine; + +namespace KE.Map.Others.CustomElevators.KECustomElevators +{ + public class KECustomElevator : MonoBehaviour + { + + + public float BottomHeight; + public float TopHeight = 301f; + + private float objective; + + + private ElevatorModel model; + private Panel toppanel; + private Primitive primtop; + private Panel bottompanel; + private Primitive primbottom; + + + private static Primitive step; + private static Primitive help; + + + private void Awake() + { + + SpawnModel(); + CreatePrimitives(); + CreateModel(); + + BottomHeight = base.transform.localPosition.y; + + objective = TopHeight; + model.SendingElevator += TrySend; + bottompanel.SendingElevator += TrySend; + toppanel.SendingElevator += TrySend; + } + + + public const float Scale = 0.8f; + + private void SpawnModel() + { + model = new(); + toppanel = new(); + bottompanel = new(); + + } + private void CreateModel() + { + model.Create(base.transform); + toppanel.Create(base.transform); + bottompanel.Create(base.transform); + + + model.button.NetworkMaterialColor = Color.blue; + bottompanel.button.NetworkMaterialColor = Color.blue; + toppanel.button.NetworkMaterialColor = Color.blue; + + } + + private void CreatePrimitives() + { + Vector3 helppos = new(18.24f, 255.65f, -46.07f); + Vector3 postop = new(19.92f, 299.97f, -48.95f); + Vector3 posbot = new(15.62f, 290.65f, -45.19f); + + primtop = Primitive.Create(postop, null, Vector3.one * Scale); + primtop.Flags = AdminToys.PrimitiveFlags.None; + primbottom.Position = postop; + + primbottom = Primitive.Create(posbot, null, Vector3.one * Scale); + primbottom.Position = posbot; + primbottom.Flags = AdminToys.PrimitiveFlags.None; + + + help = Primitive.Create(PrimitiveType.Cube, helppos, null, new Vector3(50, 50, 50), false); + help.Flags = AdminToys.PrimitiveFlags.Visible; + help.Spawn(); + help.GameObject.AddComponent(); + } + + + + public void Destroy() + { + Destroy(this); + } + + private void OnDestroy() + { + model.SendingElevator -= TrySend; + bottompanel.SendingElevator -= TrySend; + toppanel.SendingElevator -= TrySend; + model.Destroy(base.transform); + toppanel.Destroy(primtop.Transform); + bottompanel.Destroy(primbottom.Transform); + step.Destroy(); + help.Destroy(); + primbottom = null; + primtop = null; + step = null; + help = null; + } + + public void TrySend() + { + if (isMoving) return; + + startY = transform.position.y; + elapsed = 0f; + + objective = Mathf.Approximately(startY, BottomHeight) + ? TopHeight + : BottomHeight; + + isMoving = true; + } + + + private bool isMoving = false; + + private float duration = 5f; + + private bool sending = false; + private float elapsed = 0f; + private float startY; + private void SendingElevator() + { + if (isMoving) + { + model.button.NetworkMaterialColor = Color.yellow; + bottompanel.button.NetworkMaterialColor = Color.yellow; + toppanel.button.NetworkMaterialColor = Color.yellow; + + elapsed += Time.deltaTime; + + float t = Mathf.Clamp01(elapsed / duration); + t = t * t * (3f - 2f * t); // smoothstep + + float newY = Mathf.Lerp(startY, objective, t); + + transform.position = new Vector3( + transform.position.x, + newY, + transform.position.z + ); + + if (elapsed >= duration) + { + transform.position = new Vector3( + transform.position.x, + objective, + transform.position.z + ); + + isMoving = false; + } + } + else + { + model.button.NetworkMaterialColor = Color.blue; + bottompanel.button.NetworkMaterialColor = Color.blue; + toppanel.button.NetworkMaterialColor = Color.blue; + } + } + private void Update() + { + SendingElevator(); + } + + + + } +} diff --git a/KruacentExiled/KE.Map/Others/CustomElevators/KECustomElevators/KEElevatorPanel.cs b/KruacentExiled/KE.Map/Others/CustomElevators/KECustomElevators/KEElevatorPanel.cs new file mode 100644 index 00000000..07b224bc --- /dev/null +++ b/KruacentExiled/KE.Map/Others/CustomElevators/KECustomElevators/KEElevatorPanel.cs @@ -0,0 +1,12 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace KE.Map.Others.CustomElevators.KECustomElevators +{ + public class KEElevatorPanel + { + } +} diff --git a/KruacentExiled/KE.Map/Others/CustomElevator/KEElevator.cs b/KruacentExiled/KE.Map/Others/CustomElevators/KEElevator.cs similarity index 91% rename from KruacentExiled/KE.Map/Others/CustomElevator/KEElevator.cs rename to KruacentExiled/KE.Map/Others/CustomElevators/KEElevator.cs index f1d7ae10..a282bd03 100644 --- a/KruacentExiled/KE.Map/Others/CustomElevator/KEElevator.cs +++ b/KruacentExiled/KE.Map/Others/CustomElevators/KEElevator.cs @@ -6,7 +6,7 @@ using System.Text; using System.Threading.Tasks; -namespace KE.Map.Others.CustomElevator +namespace KE.Map.Others.CustomElevators { public abstract class KEElevator { @@ -25,5 +25,6 @@ public KEElevator() elevators.Add(this); } + } } diff --git a/KruacentExiled/KE.Map/Others/CustomElevators/VanillaElevator.cs b/KruacentExiled/KE.Map/Others/CustomElevators/VanillaElevator.cs new file mode 100644 index 00000000..9f77dc9f --- /dev/null +++ b/KruacentExiled/KE.Map/Others/CustomElevators/VanillaElevator.cs @@ -0,0 +1,29 @@ +using Exiled.API.Interfaces; +using LabApi.Features.Wrappers; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace KE.Map.Others.CustomElevators +{ + public class VanillaElevator : KEElevator, IWrapper + { + + public Elevator Base { get; } + + + public override bool IsReady => Base.IsReady; + public override void Send() + { + Base.SendToNextFloor(); + } + + + public VanillaElevator(Elevator elevator) : base() + { + Base = elevator; + } + } +} diff --git a/KruacentExiled/KE.Map/Others/CustomZones/AltasReader.cs b/KruacentExiled/KE.Map/Others/CustomZones/AltasReader.cs index e0238916..4aba713e 100644 --- a/KruacentExiled/KE.Map/Others/CustomZones/AltasReader.cs +++ b/KruacentExiled/KE.Map/Others/CustomZones/AltasReader.cs @@ -12,7 +12,7 @@ using UnityEngine; using Color = System.Drawing.Color; -namespace KE.Map.CustomZones +namespace KE.Map.Others.CustomZones { public static class AltasReader { diff --git a/KruacentExiled/KE.Map/Others/CustomZones/CREventHandler.cs b/KruacentExiled/KE.Map/Others/CustomZones/CREventHandler.cs index e4dba051..d95de532 100644 --- a/KruacentExiled/KE.Map/Others/CustomZones/CREventHandler.cs +++ b/KruacentExiled/KE.Map/Others/CustomZones/CREventHandler.cs @@ -1,14 +1,10 @@ using Exiled.API.Features; -using KE.Map.CustomZones; -using KE.Map.CustomZones.CustomRooms.MCZ; +using KE.Map.Others.CustomZones.CustomRooms.MCZ; using KE.Utils.API.Interfaces; using LabApi.Events.Arguments.ServerEvents; using MapGeneration; using System; -using System.Collections.Generic; using System.Linq; -using System.Text; -using System.Threading.Tasks; using UnityEngine; namespace KE.Map.Others.CustomZones diff --git a/KruacentExiled/KE.Map/Others/CustomZones/CustomFacilityZone.cs b/KruacentExiled/KE.Map/Others/CustomZones/CustomFacilityZone.cs index 3c1c7644..b0f4b250 100644 --- a/KruacentExiled/KE.Map/Others/CustomZones/CustomFacilityZone.cs +++ b/KruacentExiled/KE.Map/Others/CustomZones/CustomFacilityZone.cs @@ -4,7 +4,7 @@ using System.Text; using System.Threading.Tasks; -namespace KE.Map.CustomZones +namespace KE.Map.Others.CustomZones { public enum CustomFacilityZone { diff --git a/KruacentExiled/KE.Map/Others/CustomZones/CustomRoom.cs b/KruacentExiled/KE.Map/Others/CustomZones/CustomRoom.cs index 27d778a9..4e1e517a 100644 --- a/KruacentExiled/KE.Map/Others/CustomZones/CustomRoom.cs +++ b/KruacentExiled/KE.Map/Others/CustomZones/CustomRoom.cs @@ -9,7 +9,7 @@ using System.Threading.Tasks; using UnityEngine; -namespace KE.Map.CustomZones +namespace KE.Map.Others.CustomZones { public abstract class CustomRoom { diff --git a/KruacentExiled/KE.Map/Others/CustomZones/CustomRooms/MCZ/EndRoom.cs b/KruacentExiled/KE.Map/Others/CustomZones/CustomRooms/MCZ/EndRoom.cs index 296ca8b5..c825e116 100644 --- a/KruacentExiled/KE.Map/Others/CustomZones/CustomRooms/MCZ/EndRoom.cs +++ b/KruacentExiled/KE.Map/Others/CustomZones/CustomRooms/MCZ/EndRoom.cs @@ -4,7 +4,7 @@ using UnityEngine; using Light = Exiled.API.Features.Toys.Light; -namespace KE.Map.CustomZones.CustomRooms.MCZ +namespace KE.Map.Others.CustomZones.CustomRooms.MCZ { public class EndRoom : CustomRoom { diff --git a/KruacentExiled/KE.Map/Others/CustomZones/CustomRooms/MCZ/SCorridor.cs b/KruacentExiled/KE.Map/Others/CustomZones/CustomRooms/MCZ/SCorridor.cs index ab2a1832..8d7037fe 100644 --- a/KruacentExiled/KE.Map/Others/CustomZones/CustomRooms/MCZ/SCorridor.cs +++ b/KruacentExiled/KE.Map/Others/CustomZones/CustomRooms/MCZ/SCorridor.cs @@ -4,7 +4,7 @@ using UnityEngine; using Light = Exiled.API.Features.Toys.Light; -namespace KE.Map.CustomZones.CustomRooms.MCZ +namespace KE.Map.Others.CustomZones.CustomRooms.MCZ { public class SCorridor : CustomRoom { diff --git a/KruacentExiled/KE.Map/Others/CustomZones/CustomRooms/MCZ/TCorridor.cs b/KruacentExiled/KE.Map/Others/CustomZones/CustomRooms/MCZ/TCorridor.cs index fbe3e392..b34f7a84 100644 --- a/KruacentExiled/KE.Map/Others/CustomZones/CustomRooms/MCZ/TCorridor.cs +++ b/KruacentExiled/KE.Map/Others/CustomZones/CustomRooms/MCZ/TCorridor.cs @@ -4,7 +4,7 @@ using UnityEngine; using Light = Exiled.API.Features.Toys.Light; -namespace KE.Map.CustomZones.CustomRooms.MCZ +namespace KE.Map.Others.CustomZones.CustomRooms.MCZ { public class TCorridor : CustomRoom { @@ -28,7 +28,7 @@ protected override IEnumerable SpawnRoom(Vector3 position, Vector3 rot Quaternion otherBranch = rot * Quaternion.Euler(0, -90f, 0); - float lengthbranch = (15f / 2f) - (6f / 2f); + float lengthbranch = 15f / 2f - 6f / 2f; return new HashSet() diff --git a/KruacentExiled/KE.Map/Others/CustomZones/CustomZone.cs b/KruacentExiled/KE.Map/Others/CustomZones/CustomZone.cs index 5fb7bb77..b0703242 100644 --- a/KruacentExiled/KE.Map/Others/CustomZones/CustomZone.cs +++ b/KruacentExiled/KE.Map/Others/CustomZones/CustomZone.cs @@ -7,7 +7,7 @@ using System.Threading.Tasks; using UnityEngine; -namespace KE.Map.CustomZones +namespace KE.Map.Others.CustomZones { public abstract class CustomZone { diff --git a/KruacentExiled/KE.Map/Others/CustomZones/Layout.cs b/KruacentExiled/KE.Map/Others/CustomZones/Layout.cs index 4d17b888..a2f5bc5d 100644 --- a/KruacentExiled/KE.Map/Others/CustomZones/Layout.cs +++ b/KruacentExiled/KE.Map/Others/CustomZones/Layout.cs @@ -5,9 +5,9 @@ using System.Text; using System.Threading.Tasks; using UnityEngine; -using static KE.Map.CustomZones.AltasReader; +using static KE.Map.Others.CustomZones.AltasReader; -namespace KE.Map.CustomZones +namespace KE.Map.Others.CustomZones { public struct Layout { diff --git a/KruacentExiled/KE.Map/Others/CustomZones/MediumContainmentZone.cs b/KruacentExiled/KE.Map/Others/CustomZones/MediumContainmentZone.cs index df6528c4..170e133e 100644 --- a/KruacentExiled/KE.Map/Others/CustomZones/MediumContainmentZone.cs +++ b/KruacentExiled/KE.Map/Others/CustomZones/MediumContainmentZone.cs @@ -9,7 +9,7 @@ using UnityEngine; using Random = System.Random; -namespace KE.Map.CustomZones +namespace KE.Map.Others.CustomZones { public class MediumContainmentZone : CustomZone { diff --git a/KruacentExiled/KE.Map/Others/CustomZones/SpawnedCustomRoom.cs b/KruacentExiled/KE.Map/Others/CustomZones/SpawnedCustomRoom.cs index a0685f51..e79ce735 100644 --- a/KruacentExiled/KE.Map/Others/CustomZones/SpawnedCustomRoom.cs +++ b/KruacentExiled/KE.Map/Others/CustomZones/SpawnedCustomRoom.cs @@ -7,7 +7,7 @@ using System.Threading.Tasks; using UnityEngine; -namespace KE.Map.CustomZones +namespace KE.Map.Others.CustomZones { public class SpawnedCustomRoom { diff --git a/KruacentExiled/KE.Map/Surface/ElevatorGateA/CustomElevatorGateA.cs b/KruacentExiled/KE.Map/Surface/ElevatorGateA/CustomElevatorGateA.cs index 2c826eeb..8118a37c 100644 --- a/KruacentExiled/KE.Map/Surface/ElevatorGateA/CustomElevatorGateA.cs +++ b/KruacentExiled/KE.Map/Surface/ElevatorGateA/CustomElevatorGateA.cs @@ -2,6 +2,7 @@ using Exiled.API.Features.Toys; using Exiled.Events.EventArgs.Player; using InventorySystem.Items.Firearms.Modules.Scp127; +using KE.Map.Others.CustomElevators.KECustomElevators; using MEC; using System; using System.Collections.Generic; @@ -30,6 +31,14 @@ public static class CustomElevatorGateA private const float Scale = 0.8f; public static void Create() { + //Vector3 pos = new(18.24f, 290.65f, -46.07f); + //prim = Primitive.Create(pos, null, Vector3.one * Scale); + //prim.Flags = AdminToys.PrimitiveFlags.None; + + + //prim.GameObject.AddComponent(); + + Destroy(); model = new(); diff --git a/KruacentExiled/KE.Map/Surface/ElevatorGateA/CustomKillerCollision.cs b/KruacentExiled/KE.Map/Surface/ElevatorGateA/CustomKillerCollision.cs index 3da2aef4..0a6b96fb 100644 --- a/KruacentExiled/KE.Map/Surface/ElevatorGateA/CustomKillerCollision.cs +++ b/KruacentExiled/KE.Map/Surface/ElevatorGateA/CustomKillerCollision.cs @@ -32,6 +32,11 @@ private void Update() } + private void OnTriggerEnter() + { + + } + private bool InBound(Player player) { Vector3 position = transform.position; From 6900a7f889cb24300d6be1a673ab2a9856efd948 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Wed, 25 Feb 2026 14:46:48 +0100 Subject: [PATCH 660/853] animation --- KruacentExiled/KE.Map/KE.Map.csproj | 1 + KruacentExiled/KE.Map/MainPlugin.cs | 61 ++++++++++++++++++++++- KruacentExiled/KE.Map/Utils/Animations.cs | 25 ++++++++++ 3 files changed, 85 insertions(+), 2 deletions(-) create mode 100644 KruacentExiled/KE.Map/Utils/Animations.cs diff --git a/KruacentExiled/KE.Map/KE.Map.csproj b/KruacentExiled/KE.Map/KE.Map.csproj index 5777c855..33dbb476 100644 --- a/KruacentExiled/KE.Map/KE.Map.csproj +++ b/KruacentExiled/KE.Map/KE.Map.csproj @@ -20,6 +20,7 @@ + diff --git a/KruacentExiled/KE.Map/MainPlugin.cs b/KruacentExiled/KE.Map/MainPlugin.cs index 57a1eb7c..4ead7caa 100644 --- a/KruacentExiled/KE.Map/MainPlugin.cs +++ b/KruacentExiled/KE.Map/MainPlugin.cs @@ -9,11 +9,14 @@ using KE.Map.Heavy.GamblingZone; using KE.Map.Others.BlackoutNDoor.Handlers; using KE.Map.Surface.ElevatorGateA; +using KE.Utils.API.Features; using KE.Utils.API.KETextToy; +using KE.Utils.Extensions; using MEC; using PlayerRoles; using PlayerRoles.PlayableScps.Scp106; using ProjectMER.Features; +using System; using System.Collections.Generic; using System.Linq; using UnityEngine; @@ -70,6 +73,7 @@ private void OnRoundStarted() if (Config.Debug) { Player player = Player.List.First(); + Vector3 pos; //StructureSpawner.SpawnPedestal(ItemType.KeycardJanitor,player.Position,Quaternion.identity,Vector3.one); //player.Teleport(Room.List.Where(r => r.Type == Exiled.API.Enums.RoomType.EzVent).First()); @@ -82,7 +86,8 @@ private void OnRoundStarted() //player.Teleport(teleport); }); - Vector3 pos = RoleTypeId.Scp049.GetRandomSpawnLocation().Position; + //pos = RoleTypeId.Scp049.GetRandomSpawnLocation().Position; + pos = player.Position; @@ -110,7 +115,59 @@ private void OnRoundStarted() //FollowingTextToy f2 = new([], player.Position, Quaternion.identity, Vector3.one); //f2.Toy.TextFormat = "F2 tombe à l'eau"; - + + // [█ ] + //[█      ] + //[█      ] + + //[█                                                            ]\n[██████████] + try + { + Primitive parent = Primitive.Create(PrimitiveType.Cube, pos, spawn: false); + parent.Flags = PrimitiveFlags.None; + + parent.Spawn(); + + Primitive prim = Primitive.Create(PrimitiveType.Cube, null, spawn: false); + prim.Transform.parent = parent.Transform; + prim.Transform.localPosition = Vector3.zero; + prim.Flags = PrimitiveFlags.Visible; + prim.MovementSmoothing = 60; + prim.Spawn(); + + Log.Info(prim.Position); + + AnimationClip clip = new AnimationClip(); + clip.legacy = true; + clip.wrapMode = WrapMode.PingPong; + + Transform t = prim.GameObject.transform; + + float startX = t.localPosition.x; + + AnimationCurve curve = AnimationCurve.Linear( + 0f, startX, + 3f, startX + 1f + ); + + clip.SetCurve("", typeof(Transform), "localPosition.x", curve); + + Animation animation = prim.GameObject.AddComponent(); + animation.AddClip(clip, "move"); + animation.Play("move"); + + + Log.Debug(animation.IsPlaying("move")); + Timing.CallDelayed(3, () => + { + Log.Info(prim.Position); + player.Position = prim.Position; + }); + } + catch(Exception e) + { + Log.Error(e); + } diff --git a/KruacentExiled/KE.Map/Utils/Animations.cs b/KruacentExiled/KE.Map/Utils/Animations.cs new file mode 100644 index 00000000..7958dab0 --- /dev/null +++ b/KruacentExiled/KE.Map/Utils/Animations.cs @@ -0,0 +1,25 @@ +using KE.Utils.API.Features.Models; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace KE.Map.Utils +{ + public abstract class AnimatedModel : ModelBase + { + + protected List animationNames = new(); + + + + + + + + + + + } +} From 45465162a54893b8dae966afe7c76d891eee7705 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Wed, 25 Feb 2026 15:57:12 +0100 Subject: [PATCH 661/853] modles uipdfate --- .../KE.Items/API/Core/Models/PickupModel.cs | 8 +- .../KE.Items/API/Features/KECustomItem.cs | 1 - .../KE.Items/Items/PickupModels/MinePModel.cs | 58 +++++- .../Items/PickupModels/TPGrenadaPModel.cs | 177 +++++++++++++++--- 4 files changed, 211 insertions(+), 33 deletions(-) diff --git a/KruacentExiled/KE.Items/API/Core/Models/PickupModel.cs b/KruacentExiled/KE.Items/API/Core/Models/PickupModel.cs index 45c64c73..de239866 100644 --- a/KruacentExiled/KE.Items/API/Core/Models/PickupModel.cs +++ b/KruacentExiled/KE.Items/API/Core/Models/PickupModel.cs @@ -1,4 +1,5 @@ -using Exiled.API.Features; +using AdminToys; +using Exiled.API.Features; using Exiled.API.Features.Pickups; using Exiled.API.Features.Toys; using Exiled.CustomItems.API.Features; @@ -43,6 +44,11 @@ public void UnsubscribeEvents() private Dictionary PickupToParent; + protected override PrimitiveObjectToy CreatePrimitive(Transform parent, PrimitiveType type, Vector3 localPosition, Quaternion localRotation, Vector3 localScale, Color32 color, byte movementSmoothing = 0, bool collidable = false) + { + return base.CreatePrimitive(parent, type, localPosition, localRotation, localScale, color, 0, false); + } + private Primitive CreateParent(Pickup pickup) { diff --git a/KruacentExiled/KE.Items/API/Features/KECustomItem.cs b/KruacentExiled/KE.Items/API/Features/KECustomItem.cs index da7180cc..45288c4e 100644 --- a/KruacentExiled/KE.Items/API/Features/KECustomItem.cs +++ b/KruacentExiled/KE.Items/API/Features/KECustomItem.cs @@ -117,7 +117,6 @@ internal static void Message(CustomItem c, Player player, bool pickedUp = false) bool desc = MainPlugin.Instance.SettingsHandler.GetDescriptionsSettings(player); - Log.Debug(desc); if (desc) { builder.AppendLine(c.Description); diff --git a/KruacentExiled/KE.Items/Items/PickupModels/MinePModel.cs b/KruacentExiled/KE.Items/Items/PickupModels/MinePModel.cs index 62d3cd90..1bacdc8c 100644 --- a/KruacentExiled/KE.Items/Items/PickupModels/MinePModel.cs +++ b/KruacentExiled/KE.Items/Items/PickupModels/MinePModel.cs @@ -23,12 +23,62 @@ public MinePModel(KECustomItem customItem) : base(customItem) { } public static Color32 lightColor = new Color32(255, 0, 0, 0); protected override void CreateModel(Transform parent) { - var baseMine = CreatePrimitive(parent, PrimitiveType.Cylinder, Vector3.zero, Quaternion.identity, new Vector3(1, .05f, 1), new Color32(0, 0, 0, 255)); - var baseLight = CreatePrimitive(parent, PrimitiveType.Sphere, Vector3.zero, Quaternion.identity, Vector3.one*0.2f, new Color32(255, 0, 0, 100)); - Light light = CreateLight(baseLight.transform, Vector3.down/2f, Quaternion.identity, Vector3.one, lightColor, LightType.Point, .1f); - + // This code was auto-generated + var Mine = CreateEmptyPrimitive( + parent, + new Vector3(-1.171f, 1.137f, 0.773f), + new Quaternion(0f, 0f, 0f, 1f), + new Vector3(1f, 1f, 1f) + ); + var botomCylinder = CreatePrimitive( + Mine.transform, + PrimitiveType.Cylinder, + new Vector3(0f, 0f, 0f), + new Quaternion(0f, 0f, 0f, 1f), + new Vector3(1f, 0.07f, 1f), + new Color32(0, 101, 6, 255) + ); + + var middleCylinder = CreatePrimitive( + Mine.transform, + PrimitiveType.Cylinder, + new Vector3(0f, 0.084f, 0f), + new Quaternion(0f, 0f, 0f, 1f), + new Vector3(0.7f, 0.03f, 0.7f), + new Color32(0, 101, 6, 255) + ); + + var topCylinder = CreatePrimitive( + Mine.transform, + PrimitiveType.Cylinder, + new Vector3(0f, 0.121f, 0f), + new Quaternion(0f, 0f, 0f, 1f), + new Vector3(0.6f, 0.03f, 0.6f), + new Color32(0, 101, 6, 255) + ); + + var light = CreatePrimitive( + Mine.transform, + PrimitiveType.Sphere, + new Vector3(0f, 0.135f, 0f), + new Quaternion(0f, 0f, 0f, 1f), + new Vector3(0.08f, 0.08f, 0.08f), + new Color32(255, 0, 0, 112) + ); + + var Point_Light = CreateLight( + light.transform, + new Vector3(0f, 0.9f, 0f), + new Quaternion(0f, 0f, 0f, 1f), + new Vector3(12.5f, 12.5f, 12.5f), + new Color32(255, 0, 0, 255), + LightType.Point, + 3.48f, + 0.4f + ); } + } } diff --git a/KruacentExiled/KE.Items/Items/PickupModels/TPGrenadaPModel.cs b/KruacentExiled/KE.Items/Items/PickupModels/TPGrenadaPModel.cs index 274742ec..91c706f3 100644 --- a/KruacentExiled/KE.Items/Items/PickupModels/TPGrenadaPModel.cs +++ b/KruacentExiled/KE.Items/Items/PickupModels/TPGrenadaPModel.cs @@ -9,15 +9,6 @@ namespace KE.Items.Items.PickupModels { public class TPGrenadaPModel : PickupModel { - private static Vector3 pillar = new Vector3(.15f, 1f, 0.15f); - private static Vector3 support = new Vector3(1, .25f, 1); - private static Vector3 glass = new Vector3(1, 1.75f, 1); - private static float positionPillars = 2.6f; - - private static Color32 centralColor = new Color32(60, 255, 255, 255); - private static Color32 colorSupport = new Color32(80, 80, 80, 255); - private static Color32 glassColor = new Color32(74, 232, 255, 50); - public TPGrenadaPModel(CustomItem customItem) : base(customItem) { } @@ -26,29 +17,161 @@ public TPGrenadaPModel(CustomItem customItem) : base(customItem) protected override void CreateModel(Transform parent) { + // This code was auto-generated + + var Tpgrenada = CreateEmptyPrimitive( + parent, + new Vector3(0f, 0f, 0f), + new Quaternion(0f, 0f, 0f, 1f), + new Vector3(1.21f, 1.21f, 1.21f) + ); + + var bottomSupport = CreatePrimitive( + Tpgrenada.transform, + PrimitiveType.Cube, + new Vector3(0f, -1f, 0f), + new Quaternion(0f, 0f, 0f, 1f), + new Vector3(1f, 0.25f, 1f), + new Color32(217, 217, 217, 255) + ); + + var topSupport = CreatePrimitive( + Tpgrenada.transform, + PrimitiveType.Cube, + new Vector3(0f, 1f, 0f), + new Quaternion(0f, 0f, 0f, 1f), + new Vector3(1f, 0.25f, 1f), + new Color32(217, 217, 217, 255) + ); + + var pillars = CreateEmptyPrimitive( + Tpgrenada.transform, + new Vector3(0f, 0f, 0f), + new Quaternion(0f, 0f, 0f, 1f), + new Vector3(1f, 1f, 1f) + ); + + var pillar1 = CreatePrimitive( + pillars.transform, + PrimitiveType.Cylinder, + new Vector3(-0.4f, 0f, 0.4f), + new Quaternion(0f, 0f, 0f, 1f), + new Vector3(0.1f, 1f, 0.1f), + new Color32(217, 217, 217, 255) + ); + + var pillar2 = CreatePrimitive( + pillars.transform, + PrimitiveType.Cylinder, + new Vector3(0.4f, 0f, 0.4f), + new Quaternion(0f, 0f, 0f, 1f), + new Vector3(0.1f, 1f, 0.1f), + new Color32(217, 217, 217, 255) + ); - var glassPrim = CreatePrimitive(parent, PrimitiveType.Cube, Vector3.zero, Quaternion.identity, glass, glassColor); - //new PrimitiveBlueprint(PrimitiveType.Cube, Vector3.zero, Quaternion.identity, glassColor, glass), + var pillar3 = CreatePrimitive( + pillars.transform, + PrimitiveType.Cylinder, + new Vector3(0.4f, 0f, -0.4f), + new Quaternion(0f, 0f, 0f, 1f), + new Vector3(0.1f, 1f, 0.1f), + new Color32(217, 217, 217, 255) + ); - var topSupport = CreatePrimitive(parent, PrimitiveType.Cube, Vector3.up, Quaternion.identity, support, colorSupport); - var bottomSupport = CreatePrimitive(parent, PrimitiveType.Cube, Vector3.down, Quaternion.identity, support, colorSupport); - //new PrimitiveBlueprint(PrimitiveType.Cube, Vector3.up * 12.5f, Quaternion.identity, colorSupport, support), - //new PrimitiveBlueprint(PrimitiveType.Cube, Vector3.down * 12.5f, Quaternion.identity, colorSupport, support), + var pillar4 = CreatePrimitive( + pillars.transform, + PrimitiveType.Cylinder, + new Vector3(-0.4f, 0f, -0.4f), + new Quaternion(0f, 0f, 0f, 1f), + new Vector3(0.1f, 1f, 0.1f), + new Color32(217, 217, 217, 255) + ); - var centralPillar = CreatePrimitive(parent, PrimitiveType.Cylinder, Vector3.zero, Quaternion.identity, pillar, centralColor); - var pillar1 = CreatePrimitive(centralPillar.transform, PrimitiveType.Cylinder, positionPillars* new Vector3(1, 0, 1), Quaternion.identity, Vector3.one, colorSupport); - var pillar2 = CreatePrimitive(centralPillar.transform, PrimitiveType.Cylinder, positionPillars * new Vector3(-1, 0, 1), Quaternion.identity, Vector3.one, colorSupport); - var pillar3 = CreatePrimitive(centralPillar.transform, PrimitiveType.Cylinder, positionPillars * new Vector3(-1, 0, -1), Quaternion.identity, Vector3.one, colorSupport); - var pillar4 = CreatePrimitive(centralPillar.transform, PrimitiveType.Cylinder, positionPillars * new Vector3(1, 0, -1), Quaternion.identity, Vector3.one, colorSupport); - //new PrimitiveBlueprint(PrimitiveType.Cylinder, Vector3.up + Vector3.back * 6 + Vector3.right * 6, Quaternion.identity, colorSupport, pillar), - //new PrimitiveBlueprint(PrimitiveType.Cylinder, Vector3.up + Vector3.forward * 6 + Vector3.right * 6, Quaternion.identity, colorSupport, pillar), - //new PrimitiveBlueprint(PrimitiveType.Cylinder, Vector3.up + Vector3.back * 6 + Vector3.left * 6, Quaternion.identity, colorSupport, pillar), - //new PrimitiveBlueprint(PrimitiveType.Cylinder, Vector3.up + Vector3.forward * 6 + Vector3.left * 6, Quaternion.identity, colorSupport, pillar), - //new PrimitiveBlueprint(PrimitiveType.Cylinder, Vector3.up, Quaternion.identity, centralColor, pillar), + var centralPillar = CreatePrimitive( + pillars.transform, + PrimitiveType.Cylinder, + new Vector3(0f, 0f, 0f), + new Quaternion(0f, 0f, 0f, 1f), + new Vector3(0.3f, 0.8f, 0.3f), + new Color32(0, 255, 255, 255) + ); - Light light = CreateLight(parent, Vector3.zero, Quaternion.identity, Vector3.one, centralColor, LightType.Point, .1f); - //new LightBlueprint(Vector3.zero, Quaternion.identity, centralColor, Vector3.one,), + var glass = CreatePrimitive( + Tpgrenada.transform, + PrimitiveType.Cube, + new Vector3(0f, 0f, 0f), + new Quaternion(0f, 0f, 0f, 1f), + new Vector3(1f, 1.75f, 1f), + new Color32(54, 219, 243, 69) + ); + var innerglass = CreatePrimitive( + Tpgrenada.transform, + PrimitiveType.Cylinder, + new Vector3(0f, 0f, 0f), + new Quaternion(0f, 0f, 0f, 1f), + new Vector3(0.7f, 1f, 0.7f), + new Color32(54, 219, 243, 69) + ); + + var lights = CreateEmptyPrimitive( + Tpgrenada.transform, + new Vector3(0f, 0f, 0f), + new Quaternion(0f, 0f, 0f, 1f), + new Vector3(1f, 1f, 1f) + ); + + var top = CreateLight( + lights.transform, + new Vector3(0f, 0.5f, 0f), + new Quaternion(0f, 0f, 0f, 1f), + new Vector3(1f, 1f, 1f), + new Color32(0, 255, 255, 255), + LightType.Point, + 1f, + 1.25f + ); + + var center = CreateLight( + lights.transform, + new Vector3(0f, 0f, 0f), + new Quaternion(0f, 0f, 0f, 1f), + new Vector3(1f, 1f, 1f), + new Color32(0, 255, 255, 255), + LightType.Point, + 1f, + 1.25f + ); + + var bottom = CreateLight( + lights.transform, + new Vector3(0f, -0.5f, 0f), + new Quaternion(0f, 0f, 0f, 1f), + new Vector3(1f, 1f, 1f), + new Color32(0, 255, 255, 255), + LightType.Point, + 1f, + 1.25f + ); + + var topbase = CreatePrimitive( + Tpgrenada.transform, + PrimitiveType.Cylinder, + new Vector3(0f, 0.9f, 0f), + new Quaternion(0f, 0f, 0f, 1f), + new Vector3(0.9f, 0.1f, 0.9f), + new Color32(255, 255, 255, 255) + ); + + var botbase = CreatePrimitive( + Tpgrenada.transform, + PrimitiveType.Cylinder, + new Vector3(0f, -0.9f, 0f), + new Quaternion(0f, 0f, 0f, 1f), + new Vector3(0.9f, 0.1f, 0.9f), + new Color32(255, 255, 255, 255) + ); } + } } From fa631b7cbd803d46dfb16902b72d4c3081f2384d Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Wed, 25 Feb 2026 16:09:07 +0100 Subject: [PATCH 662/853] fix elevator bound --- KruacentExiled/KE.Map/MainPlugin.cs | 4 ++-- .../KE.Map/Surface/ElevatorGateA/CustomElevatorGateA.cs | 4 ++++ KruacentExiled/KE.Map/Surface/ElevatorGateA/ElevatorModel.cs | 1 + 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/KruacentExiled/KE.Map/MainPlugin.cs b/KruacentExiled/KE.Map/MainPlugin.cs index 4ead7caa..4023b2a0 100644 --- a/KruacentExiled/KE.Map/MainPlugin.cs +++ b/KruacentExiled/KE.Map/MainPlugin.cs @@ -121,7 +121,7 @@ private void OnRoundStarted() //[█      ] //[█                                                            ]\n[██████████] - try + /*try { Primitive parent = Primitive.Create(PrimitiveType.Cube, pos, spawn: false); parent.Flags = PrimitiveFlags.None; @@ -169,7 +169,7 @@ private void OnRoundStarted() Log.Error(e); } - + */ } diff --git a/KruacentExiled/KE.Map/Surface/ElevatorGateA/CustomElevatorGateA.cs b/KruacentExiled/KE.Map/Surface/ElevatorGateA/CustomElevatorGateA.cs index 8118a37c..cc3f53ef 100644 --- a/KruacentExiled/KE.Map/Surface/ElevatorGateA/CustomElevatorGateA.cs +++ b/KruacentExiled/KE.Map/Surface/ElevatorGateA/CustomElevatorGateA.cs @@ -3,6 +3,7 @@ using Exiled.Events.EventArgs.Player; using InventorySystem.Items.Firearms.Modules.Scp127; using KE.Map.Others.CustomElevators.KECustomElevators; +using KE.Utils.API.Features; using MEC; using System; using System.Collections.Generic; @@ -61,8 +62,11 @@ public static void Create() private static void CreateModels() { + KELog.Debug("creating elevator"); model.Create(prim.Transform); + KELog.Debug("creating top panel"); toppanel.Create(primtop.Transform); + KELog.Debug("creating bototm panel"); bottompanel.Create(primbottom.Transform); diff --git a/KruacentExiled/KE.Map/Surface/ElevatorGateA/ElevatorModel.cs b/KruacentExiled/KE.Map/Surface/ElevatorGateA/ElevatorModel.cs index 46fb55e8..5e957a88 100644 --- a/KruacentExiled/KE.Map/Surface/ElevatorGateA/ElevatorModel.cs +++ b/KruacentExiled/KE.Map/Surface/ElevatorGateA/ElevatorModel.cs @@ -357,6 +357,7 @@ protected override void CreateModel(Transform parent) new Quaternion(0f, 0f, 0f, 1f), new Vector3(4.9f, 7.870179f, 4.9f) ); + waypoint.VisualizeBounds = false; I_button.Base.OnInteracted += Base_OnInteracted; } From 2823f7bad337074ba0e5094f961a401d2413f5f1 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Wed, 25 Feb 2026 16:39:13 +0100 Subject: [PATCH 663/853] whar? --- KruacentExiled/KE.Items/Items/PickupModels/TPGrenadaPModel.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/KruacentExiled/KE.Items/Items/PickupModels/TPGrenadaPModel.cs b/KruacentExiled/KE.Items/Items/PickupModels/TPGrenadaPModel.cs index 91c706f3..c8774d05 100644 --- a/KruacentExiled/KE.Items/Items/PickupModels/TPGrenadaPModel.cs +++ b/KruacentExiled/KE.Items/Items/PickupModels/TPGrenadaPModel.cs @@ -131,6 +131,7 @@ protected override void CreateModel(Transform parent) 1f, 1.25f ); + var center = CreateLight( lights.transform, From cde708bc6a55432a2c742833cd423e3226a3fba1 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Wed, 25 Feb 2026 16:45:44 +0100 Subject: [PATCH 664/853] model mine --- KruacentExiled/KE.Items/Items/Mine.cs | 6 +++--- KruacentExiled/KE.Items/Items/PickupModels/MinePModel.cs | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/KruacentExiled/KE.Items/Items/Mine.cs b/KruacentExiled/KE.Items/Items/Mine.cs index aa433c48..05bbd0aa 100644 --- a/KruacentExiled/KE.Items/Items/Mine.cs +++ b/KruacentExiled/KE.Items/Items/Mine.cs @@ -65,17 +65,17 @@ public class Mine : KECustomItem, ISwichableEffect/*, ICustomPickupModel*/ };*/ - //public PickupModel PickupModel { get; } + public PickupModel PickupModel { get; } public Mine() { Effect = new MineEffect(); - //PickupModel = new MinePModel(this); + PickupModel = new MinePModel(this); } protected override void SubscribeEvents() { - //PickupModel.SubscribeEvents(); + PickupModel.SubscribeEvents(); base.SubscribeEvents(); } diff --git a/KruacentExiled/KE.Items/Items/PickupModels/MinePModel.cs b/KruacentExiled/KE.Items/Items/PickupModels/MinePModel.cs index 1bacdc8c..09575dd7 100644 --- a/KruacentExiled/KE.Items/Items/PickupModels/MinePModel.cs +++ b/KruacentExiled/KE.Items/Items/PickupModels/MinePModel.cs @@ -27,7 +27,7 @@ protected override void CreateModel(Transform parent) var Mine = CreateEmptyPrimitive( parent, - new Vector3(-1.171f, 1.137f, 0.773f), + new Vector3(0, 0, 0), new Quaternion(0f, 0f, 0f, 1f), new Vector3(1f, 1f, 1f) ); From cd9e0b1bfc9518cca801f9b7aed2d147b2465e19 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Wed, 25 Feb 2026 16:46:12 +0100 Subject: [PATCH 665/853] t pgrandeta --- .../Items/PickupModels/TPGrenadaPModel.cs | 42 +++++++++---------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/KruacentExiled/KE.Items/Items/PickupModels/TPGrenadaPModel.cs b/KruacentExiled/KE.Items/Items/PickupModels/TPGrenadaPModel.cs index c8774d05..328b5d0a 100644 --- a/KruacentExiled/KE.Items/Items/PickupModels/TPGrenadaPModel.cs +++ b/KruacentExiled/KE.Items/Items/PickupModels/TPGrenadaPModel.cs @@ -121,16 +121,16 @@ protected override void CreateModel(Transform parent) new Vector3(1f, 1f, 1f) ); - var top = CreateLight( - lights.transform, - new Vector3(0f, 0.5f, 0f), - new Quaternion(0f, 0f, 0f, 1f), - new Vector3(1f, 1f, 1f), - new Color32(0, 255, 255, 255), - LightType.Point, - 1f, - 1.25f - ); + // var top = CreateLight( + // lights.transform, + // new Vector3(0f, 0.5f, 0f), + // new Quaternion(0f, 0f, 0f, 1f), + // new Vector3(1f, 1f, 1f), + // new Color32(0, 255, 255, 255), + // LightType.Point, + // 1f, + // 1.25f + //); var center = CreateLight( @@ -140,20 +140,20 @@ protected override void CreateModel(Transform parent) new Vector3(1f, 1f, 1f), new Color32(0, 255, 255, 255), LightType.Point, - 1f, + .1f, 1.25f ); - var bottom = CreateLight( - lights.transform, - new Vector3(0f, -0.5f, 0f), - new Quaternion(0f, 0f, 0f, 1f), - new Vector3(1f, 1f, 1f), - new Color32(0, 255, 255, 255), - LightType.Point, - 1f, - 1.25f - ); + // var bottom = CreateLight( + // lights.transform, + // new Vector3(0f, -0.5f, 0f), + // new Quaternion(0f, 0f, 0f, 1f), + // new Vector3(1f, 1f, 1f), + // new Color32(0, 255, 255, 255), + // LightType.Point, + // 1f, + // 1.25f + //); var topbase = CreatePrimitive( Tpgrenada.transform, From 5b839c58021ab038660dfc52756804a8801a05e5 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Wed, 25 Feb 2026 17:05:41 +0100 Subject: [PATCH 666/853] added legacy option for custom info --- .../KE.CustomRoles/API/Features/KECustomRole.cs | 2 +- .../KE.CustomRoles/CR/ChaosInsurgency/LeRusse.cs | 5 +++++ .../CR/ChaosInsurgency/Negotiator.cs | 9 +++++++-- .../KE.CustomRoles/CR/ClassD/DBoyInShape.cs | 5 +++++ KruacentExiled/KE.CustomRoles/CR/ClassD/Enfant.cs | 5 +++++ KruacentExiled/KE.CustomRoles/CR/ClassD/Mime.cs | 7 ++++++- .../KE.CustomRoles/CR/CustomSCPs/SCP035.cs | 7 +++++++ .../CR/CustomSCPs/SCP049C/SCP049CGUI.cs | 2 +- .../CR/CustomSCPs/SCP049C/SCP049CRole.cs | 14 +++----------- .../KE.CustomRoles/CR/CustomSCPs/SCP457.cs | 5 +++++ .../KE.CustomRoles/CR/Guard/ChiefGuard.cs | 5 +++++ KruacentExiled/KE.CustomRoles/CR/Guard/Guard914.cs | 6 ++++++ .../KE.CustomRoles/CR/Guard/Introvert.cs | 5 +++++ .../KE.CustomRoles/CR/Human/Alzheimer.cs | 5 +++++ .../KE.CustomRoles/CR/Human/Asthmatique.cs | 5 +++++ KruacentExiled/KE.CustomRoles/CR/Human/Crazy.cs | 7 ++++++- .../KE.CustomRoles/CR/Human/Diabetique.cs | 6 ++++++ KruacentExiled/KE.CustomRoles/CR/Human/Enderman.cs | 6 ++++++ .../KE.CustomRoles/CR/Human/MaladroitVoleur.cs | 5 +++++ KruacentExiled/KE.CustomRoles/CR/Human/Pacifist.cs | 14 ++++++++++---- KruacentExiled/KE.CustomRoles/CR/MTF/Pilot.cs | 7 ++++++- KruacentExiled/KE.CustomRoles/CR/MTF/Tank.cs | 5 +++++ .../KE.CustomRoles/CR/MTF/Terroriste/Terroriste.cs | 7 ++++++- .../KE.CustomRoles/CR/Scientist/GambleAddict.cs | 7 ++++++- .../KE.CustomRoles/CR/Scientist/ZoneManager.cs | 5 +++++ .../KE.CustomRoles/CR/Scientist/scp202.cs | 4 ++-- 26 files changed, 134 insertions(+), 26 deletions(-) diff --git a/KruacentExiled/KE.CustomRoles/API/Features/KECustomRole.cs b/KruacentExiled/KE.CustomRoles/API/Features/KECustomRole.cs index 3670c96b..52312e3c 100644 --- a/KruacentExiled/KE.CustomRoles/API/Features/KECustomRole.cs +++ b/KruacentExiled/KE.CustomRoles/API/Features/KECustomRole.cs @@ -507,7 +507,7 @@ protected virtual void SetCustomInfo(Player player) { //MirrorExtensions.SetPlayerInfoForTargetOnly() - string name = GetTranslation("en", TranslationKeyName); + string name = GetTranslation("legacy", TranslationKeyName); player.CustomInfo = player.CustomName; if (!string.IsNullOrEmpty(name)) diff --git a/KruacentExiled/KE.CustomRoles/CR/ChaosInsurgency/LeRusse.cs b/KruacentExiled/KE.CustomRoles/CR/ChaosInsurgency/LeRusse.cs index 8d37b8ea..4f0167c2 100644 --- a/KruacentExiled/KE.CustomRoles/CR/ChaosInsurgency/LeRusse.cs +++ b/KruacentExiled/KE.CustomRoles/CR/ChaosInsurgency/LeRusse.cs @@ -29,6 +29,11 @@ protected override Dictionary> SetTranslation [TranslationKeyDesc] = "RUSH B or A, i dont rember sooo good luck", }, ["fr"] = new() + { + [TranslationKeyName] = "Russe", + [TranslationKeyDesc] = "RUSH B or A, i dont rember sooo good luck", + }, + ["legacy"] = new() { [TranslationKeyName] = "Russe", [TranslationKeyDesc] = "RUSH B or A, i dont rember sooo good luck", diff --git a/KruacentExiled/KE.CustomRoles/CR/ChaosInsurgency/Negotiator.cs b/KruacentExiled/KE.CustomRoles/CR/ChaosInsurgency/Negotiator.cs index ffab2655..4b859397 100644 --- a/KruacentExiled/KE.CustomRoles/CR/ChaosInsurgency/Negotiator.cs +++ b/KruacentExiled/KE.CustomRoles/CR/ChaosInsurgency/Negotiator.cs @@ -26,8 +26,13 @@ protected override Dictionary> SetTranslation ["fr"] = new() { [TranslationKeyName] = "Negociateur", - [TranslationKeyDesc] = "RUSH B or A, i dont rember sooo good luck", - } + [TranslationKeyDesc] = "T'es immunisé au tire allié et tu peux convertir des zombies", + }, + ["legacy"] = new() + { + [TranslationKeyName] = "Negotiator", + [TranslationKeyDesc] = "You're immune to friendly fire and you can convert zombie into your team, isn't that nice?", + }, }; } public override int MaxHealth { get; set; } = 100; diff --git a/KruacentExiled/KE.CustomRoles/CR/ClassD/DBoyInShape.cs b/KruacentExiled/KE.CustomRoles/CR/ClassD/DBoyInShape.cs index 5224dfd6..e9aaa500 100644 --- a/KruacentExiled/KE.CustomRoles/CR/ClassD/DBoyInShape.cs +++ b/KruacentExiled/KE.CustomRoles/CR/ClassD/DBoyInShape.cs @@ -30,6 +30,11 @@ protected override Dictionary> SetTranslation [TranslationKeyDesc] = "You're strong enough to open any door", }, ["fr"] = new() + { + [TranslationKeyName] = "DBoyInShape", + [TranslationKeyDesc] = "Dammmmnnnnnnn les gates", + }, + ["legacy"] = new() { [TranslationKeyName] = "DBoyInShape", [TranslationKeyDesc] = "Dammmmnnnnnnn les gates", diff --git a/KruacentExiled/KE.CustomRoles/CR/ClassD/Enfant.cs b/KruacentExiled/KE.CustomRoles/CR/ClassD/Enfant.cs index ba0c5ba1..e25b7055 100644 --- a/KruacentExiled/KE.CustomRoles/CR/ClassD/Enfant.cs +++ b/KruacentExiled/KE.CustomRoles/CR/ClassD/Enfant.cs @@ -23,6 +23,11 @@ protected override Dictionary> SetTranslation [TranslationKeyDesc] = "do not the kid \nyou start with a rainbow candy (for real this time) \nyou're a bit smaller", }, ["fr"] = new() + { + [TranslationKeyName] = "Enfant", + [TranslationKeyDesc] = "do not the kid \ntu commences avec un bonbon arc-en-ciel (pour de vrai cette fois) \n t'es un peu plus petit que la normal", + }, + ["legacy"] = new() { [TranslationKeyName] = "Enfant", [TranslationKeyDesc] = "do not the kid \ntu commences avec un bonbon arc-en-ciel (pour de vrai cette fois) \n t'es un peu plus petit que la normal", diff --git a/KruacentExiled/KE.CustomRoles/CR/ClassD/Mime.cs b/KruacentExiled/KE.CustomRoles/CR/ClassD/Mime.cs index 8c295cbb..f69d5339 100644 --- a/KruacentExiled/KE.CustomRoles/CR/ClassD/Mime.cs +++ b/KruacentExiled/KE.CustomRoles/CR/ClassD/Mime.cs @@ -27,10 +27,15 @@ protected override Dictionary> SetTranslation { [TranslationKeyName] = "Mime", [TranslationKeyDesc] = "tu fais très peu de bruit quand tu marches\net t'es tout plat", + }, + ["legacy"] = new() + { + [TranslationKeyName] = "Mime", + [TranslationKeyDesc] = "Tu ne peux pas parler\nmais tu fais très peu de bruit quand tu marches\net t'es tout plat", } }; } - + public override int MaxHealth { get; set; } = 100; public override RoleTypeId Role { get; set; } = RoleTypeId.ClassD; public override bool KeepRoleOnDeath { get; set; } = false; diff --git a/KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP035.cs b/KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP035.cs index 07953e49..6f394125 100644 --- a/KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP035.cs +++ b/KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP035.cs @@ -43,6 +43,13 @@ protected override Dictionary> SetTranslation [TranslationKeyDesc] = "Tue tous les humains!\nTu peux pas prendre d'arme spécial mais tu prends 3 fois moins de dégât de ces armes", ["SCP035CantPickup"] = "Une force étrange qui s'appelle 'équilibre' \nt'empêches de prendre cet objet.", ["SCP035CantUse"] = "Une force étrange qui s'appelle 'équilibre' \nt'empêches d'utiliser cet objet.", + }, + ["legacy"] = new() + { + [TranslationKeyName] = "SCP-035", + [TranslationKeyDesc] = "You can't pickup the Micro-HID and anything made with it, but you take 3 time less damage by these weapon.\nKill every humans", + ["SCP035CantPickup"] = "A strange force called \'game balance\' \nprevents you from picking up this item", + ["SCP035CantUse"] = "A strange force called 'game balance' \nprevents you from using this item.", } }; } diff --git a/KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP049C/SCP049CGUI.cs b/KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP049C/SCP049CGUI.cs index c7214421..11a467ad 100644 --- a/KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP049C/SCP049CGUI.cs +++ b/KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP049C/SCP049CGUI.cs @@ -58,7 +58,7 @@ public void DestroyHints() } - private const string TitleMessage = "Choose an ability! (%seconds%s)"; + private const string TitleMessage = "Choose an ability! (%seconds%s)\n use Right and Left (Server settings)"; private string Title(Player player) diff --git a/KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP049C/SCP049CRole.cs b/KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP049C/SCP049CRole.cs index 857619be..2f2280f7 100644 --- a/KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP049C/SCP049CRole.cs +++ b/KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP049C/SCP049CRole.cs @@ -23,12 +23,12 @@ protected override Dictionary> SetTranslation ["en"] = new() { [TranslationKeyName] = "SCP049-C", - [TranslationKeyDesc] = "WIP", + [TranslationKeyDesc] = "A modified SCP049 instance which does not create any SCP049-2\ninstead consuming the body to gain powerful abilities\nDoctor's call gives 300 Hume Shield\nExpired body can still be consumed but need more time to do so", }, ["fr"] = new() { [TranslationKeyName] = "SCP049-C", - [TranslationKeyDesc] = "WIP", + [TranslationKeyDesc] = "A modified SCP049 instance which does not create any SCP049-2\ninstead consuming the body to gain powerful abilities\nDoctor's call gives 300 Hume Shield\nExpired body can still be consumed but need more time to do so", } }; } @@ -130,15 +130,7 @@ private void OnFinishingRecall(FinishingRecallEventArgs ev) ev.IsAllowed = false; ev.Ragdoll.Destroy(); - - if (true) - { - lvl.AddLevel(); - } - else - { - lvl.AddKill(); - } + lvl.AddKill(); } diff --git a/KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP457.cs b/KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP457.cs index cc05b094..fc62d39b 100644 --- a/KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP457.cs +++ b/KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP457.cs @@ -34,6 +34,11 @@ protected override Dictionary> SetTranslation { [TranslationKeyName] = "SCP-457", [TranslationKeyDesc] = "j'ai dit pas trop cuite", + }, + ["legacy"] = new() + { + [TranslationKeyName] = "SCP-457", + [TranslationKeyDesc] = "You do passive damage around you", } }; } diff --git a/KruacentExiled/KE.CustomRoles/CR/Guard/ChiefGuard.cs b/KruacentExiled/KE.CustomRoles/CR/Guard/ChiefGuard.cs index 18ecbbdf..b42d0ba6 100644 --- a/KruacentExiled/KE.CustomRoles/CR/Guard/ChiefGuard.cs +++ b/KruacentExiled/KE.CustomRoles/CR/Guard/ChiefGuard.cs @@ -24,6 +24,11 @@ protected override Dictionary> SetTranslation [TranslationKeyName] = "Chef des gardes", [TranslationKeyDesc] = "T'as une carte de private \net un crossvec", } + ,["legacy"] = new() + { + [TranslationKeyName] = "Chef des gardes", + [TranslationKeyDesc] = "T'as une carte de private \net un crossvec", + } }; } public override int MaxHealth { get; set; } = 100; diff --git a/KruacentExiled/KE.CustomRoles/CR/Guard/Guard914.cs b/KruacentExiled/KE.CustomRoles/CR/Guard/Guard914.cs index 22fa2398..ee254e18 100644 --- a/KruacentExiled/KE.CustomRoles/CR/Guard/Guard914.cs +++ b/KruacentExiled/KE.CustomRoles/CR/Guard/Guard914.cs @@ -35,6 +35,12 @@ protected override Dictionary> SetTranslation [TranslationKeyName] = "Garde de SCP-914", [TranslationKeyDesc] = "Tu es Le garde de SCP-914 \nTu commences à 914 \nmais on a traffiqué ta carte \net ntm aussi", } + , + ["legacy"] = new() + { + [TranslationKeyName] = "Garde de SCP-914", + [TranslationKeyDesc] = "Tu es Le garde de SCP-914 \nTu commences à 914 \nmais on a traffiqué ta carte \net ntm aussi", + } }; } public override int MaxHealth { get; set; } = 100; diff --git a/KruacentExiled/KE.CustomRoles/CR/Guard/Introvert.cs b/KruacentExiled/KE.CustomRoles/CR/Guard/Introvert.cs index 4f4bef9f..c589bacc 100644 --- a/KruacentExiled/KE.CustomRoles/CR/Guard/Introvert.cs +++ b/KruacentExiled/KE.CustomRoles/CR/Guard/Introvert.cs @@ -27,6 +27,11 @@ protected override Dictionary> SetTranslation { [TranslationKeyName] = "Introverti", [TranslationKeyDesc] = "Tu n'aimes pas trop les humains", + }, + ["legacy"] = new() + { + [TranslationKeyName] = "Introvert", + [TranslationKeyDesc] = "Tu n'aimes pas trop les humains", } }; } diff --git a/KruacentExiled/KE.CustomRoles/CR/Human/Alzheimer.cs b/KruacentExiled/KE.CustomRoles/CR/Human/Alzheimer.cs index 667b34bd..b6d4c498 100644 --- a/KruacentExiled/KE.CustomRoles/CR/Human/Alzheimer.cs +++ b/KruacentExiled/KE.CustomRoles/CR/Human/Alzheimer.cs @@ -31,6 +31,11 @@ protected override Dictionary> SetTranslation { [TranslationKeyName] = "Vieux", [TranslationKeyDesc] = "Je suis vieux", + }, + ["legacy"] = new() + { + [TranslationKeyName] = "Vieux", + [TranslationKeyDesc] = "POV Mishima", } }; } diff --git a/KruacentExiled/KE.CustomRoles/CR/Human/Asthmatique.cs b/KruacentExiled/KE.CustomRoles/CR/Human/Asthmatique.cs index c04c1800..d2254122 100644 --- a/KruacentExiled/KE.CustomRoles/CR/Human/Asthmatique.cs +++ b/KruacentExiled/KE.CustomRoles/CR/Human/Asthmatique.cs @@ -25,6 +25,11 @@ protected override Dictionary> SetTranslation [TranslationKeyDesc] = "Stamina halfed\nbut better accuracy", }, ["fr"] = new() + { + [TranslationKeyName] = "Asthmatique", + [TranslationKeyDesc] = "T'as stamina est réduit de moitié\nMais tu vises mieux", + }, + ["legacy"] = new() { [TranslationKeyName] = "Asthmatique", [TranslationKeyDesc] = "T'as stamina est réduit de moitié\nMais tu vises mieux", diff --git a/KruacentExiled/KE.CustomRoles/CR/Human/Crazy.cs b/KruacentExiled/KE.CustomRoles/CR/Human/Crazy.cs index a6fb6387..a63dd1de 100644 --- a/KruacentExiled/KE.CustomRoles/CR/Human/Crazy.cs +++ b/KruacentExiled/KE.CustomRoles/CR/Human/Crazy.cs @@ -45,7 +45,12 @@ protected override Dictionary> SetTranslation { [TranslationKeyName] = "Fou de la facilité", [TranslationKeyDesc] = "Je pense que le traitement que t'as eu à la fondation t'as pas aidé", - } + }, + ["legacy"] = new() + { + [TranslationKeyName] = "Fou de la facilité", + [TranslationKeyDesc] = "Je pense que le traitement que t'as eu à la fondation t'as pas aidé", + }, }; } diff --git a/KruacentExiled/KE.CustomRoles/CR/Human/Diabetique.cs b/KruacentExiled/KE.CustomRoles/CR/Human/Diabetique.cs index f790d746..5062ab9d 100644 --- a/KruacentExiled/KE.CustomRoles/CR/Human/Diabetique.cs +++ b/KruacentExiled/KE.CustomRoles/CR/Human/Diabetique.cs @@ -27,10 +27,16 @@ protected override Dictionary> SetTranslation [TranslationKeyDesc] = "Fucking type 1. 1", }, ["fr"] = new() + { + [TranslationKeyName] = "Diabétique", + [TranslationKeyDesc] = "T'as mangé le crambleu au pomme de mael", + }, + ["legacy"] = new() { [TranslationKeyName] = "Diabetique", [TranslationKeyDesc] = "T'as mangé le crambleu au pomme de mael", } + }; } public override bool KeepRoleOnDeath { get; set; } = false; diff --git a/KruacentExiled/KE.CustomRoles/CR/Human/Enderman.cs b/KruacentExiled/KE.CustomRoles/CR/Human/Enderman.cs index a46c353a..c64882fd 100644 --- a/KruacentExiled/KE.CustomRoles/CR/Human/Enderman.cs +++ b/KruacentExiled/KE.CustomRoles/CR/Human/Enderman.cs @@ -22,10 +22,16 @@ protected override Dictionary> SetTranslation [TranslationKeyDesc] = "Great job you're now overpowered", }, ["fr"] = new() + { + [TranslationKeyName] = "Enderman", + [TranslationKeyDesc] = "Tu peux te téléporter ! T tro for enféte", + }, + ["legacy"] = new() { [TranslationKeyName] = "Enderman", [TranslationKeyDesc] = "Tu peux te téléporter ! T tro for enféte", } + }; } public override bool KeepRoleOnDeath { get; set; } = false; diff --git a/KruacentExiled/KE.CustomRoles/CR/Human/MaladroitVoleur.cs b/KruacentExiled/KE.CustomRoles/CR/Human/MaladroitVoleur.cs index ca115928..324daae7 100644 --- a/KruacentExiled/KE.CustomRoles/CR/Human/MaladroitVoleur.cs +++ b/KruacentExiled/KE.CustomRoles/CR/Human/MaladroitVoleur.cs @@ -30,6 +30,11 @@ protected override Dictionary> SetTranslation [TranslationKeyDesc] = "Be careful of \"your\" items!", }, ["fr"] = new() + { + [TranslationKeyName] = "Maladroit Voleur", + [TranslationKeyDesc] = "Fais attention à \"tes\" objets !", + }, + ["legacy"] = new() { [TranslationKeyName] = "Maladroit Voleur", [TranslationKeyDesc] = "Fais attention à \"tes\" objets !", diff --git a/KruacentExiled/KE.CustomRoles/CR/Human/Pacifist.cs b/KruacentExiled/KE.CustomRoles/CR/Human/Pacifist.cs index de3ff5aa..0f0fcef6 100644 --- a/KruacentExiled/KE.CustomRoles/CR/Human/Pacifist.cs +++ b/KruacentExiled/KE.CustomRoles/CR/Human/Pacifist.cs @@ -1,6 +1,7 @@ using Exiled.API.Features; using Exiled.Events.EventArgs.Item; using Exiled.Events.EventArgs.Player; +using InventorySystem.Items.ThrowableProjectiles; using KE.CustomRoles.API.Features; using KE.CustomRoles.API.Interfaces; using PlayerRoles; @@ -44,21 +45,26 @@ protected override void SubscribeEvents() Exiled.Events.Handlers.Item.Swinging += OnSwinging; Exiled.Events.Handlers.Item.ChargingJailbird += OnChargingJailbird; Exiled.Events.Handlers.Player.Shooting += OnShooting; - Exiled.Events.Handlers.Player.ThrowingRequest += OnThrowingRequest; + Exiled.Events.Handlers.Player.ThrownProjectile += OnThrownProjectile; Exiled.Events.Handlers.Player.Escaped += OnEscaped; base.SubscribeEvents(); } protected override void UnsubscribeEvents() { - + Exiled.Events.Handlers.Item.DisruptorFiring -= OnDisruptorFiring; + Exiled.Events.Handlers.Item.Swinging -= OnSwinging; + Exiled.Events.Handlers.Item.ChargingJailbird -= OnChargingJailbird; + Exiled.Events.Handlers.Player.Shooting -= OnShooting; + Exiled.Events.Handlers.Player.ThrownProjectile -= OnThrownProjectile; + Exiled.Events.Handlers.Player.Escaped -= OnEscaped; base.UnsubscribeEvents(); } - private void OnThrowingRequest(ThrowingRequestEventArgs ev) + private void OnThrownProjectile(ThrownProjectileEventArgs ev) { if (Check(ev.Player)) { - ev.RequestType = Exiled.API.Enums.ThrowRequest.CancelThrow; + ev.Throwable.Destroy(); } } diff --git a/KruacentExiled/KE.CustomRoles/CR/MTF/Pilot.cs b/KruacentExiled/KE.CustomRoles/CR/MTF/Pilot.cs index 0683cca9..c70400fd 100644 --- a/KruacentExiled/KE.CustomRoles/CR/MTF/Pilot.cs +++ b/KruacentExiled/KE.CustomRoles/CR/MTF/Pilot.cs @@ -33,7 +33,12 @@ protected override Dictionary> SetTranslation { [TranslationKeyName] = "Pilote", [TranslationKeyDesc] = "Je suis pilote!", - } + }, + ["legacy"] = new() + { + [TranslationKeyName] = "Pilot", + [TranslationKeyDesc] = "So I haveth a Laser Pointere", + }, }; } diff --git a/KruacentExiled/KE.CustomRoles/CR/MTF/Tank.cs b/KruacentExiled/KE.CustomRoles/CR/MTF/Tank.cs index b2dbf2a3..a004c84e 100644 --- a/KruacentExiled/KE.CustomRoles/CR/MTF/Tank.cs +++ b/KruacentExiled/KE.CustomRoles/CR/MTF/Tank.cs @@ -27,6 +27,11 @@ protected override Dictionary> SetTranslation { [TranslationKeyName] = "Tank", [TranslationKeyDesc] = "Tu es ralenti selon ton nombre de balle", + }, + ["legacy"] = new() + { + [TranslationKeyName] = "Tank", + [TranslationKeyDesc] = "Tu es débuff mais ta force de tir est démultiplié (fais attention à tes balles)", } }; } diff --git a/KruacentExiled/KE.CustomRoles/CR/MTF/Terroriste/Terroriste.cs b/KruacentExiled/KE.CustomRoles/CR/MTF/Terroriste/Terroriste.cs index 1c648d7d..77ab7833 100644 --- a/KruacentExiled/KE.CustomRoles/CR/MTF/Terroriste/Terroriste.cs +++ b/KruacentExiled/KE.CustomRoles/CR/MTF/Terroriste/Terroriste.cs @@ -24,7 +24,12 @@ protected override Dictionary> SetTranslation { [TranslationKeyName] = "Terroriste", [TranslationKeyDesc] = "Ne fait pas exploser la facilité \ntu commences avec des grenades", - } + }, + ["legacy"] = new() + { + [TranslationKeyName] = "Terroriste", + [TranslationKeyDesc] = "Ne fait pas exploser la facilité \ntu commences avec des grenades", + }, }; } public override int MaxHealth { get; set; } = 100; diff --git a/KruacentExiled/KE.CustomRoles/CR/Scientist/GambleAddict.cs b/KruacentExiled/KE.CustomRoles/CR/Scientist/GambleAddict.cs index f9f69b36..7c63c12d 100644 --- a/KruacentExiled/KE.CustomRoles/CR/Scientist/GambleAddict.cs +++ b/KruacentExiled/KE.CustomRoles/CR/Scientist/GambleAddict.cs @@ -25,7 +25,12 @@ protected override Dictionary> SetTranslation { [TranslationKeyName] = "Accro du casino", [TranslationKeyDesc] = "T'as trade ton kit et ta carte contre 2 pièces \nfais en bon usage", - } + }, + ["en"] = new() + { + [TranslationKeyName] = "Gamble Addict", + [TranslationKeyDesc] = "T'as trade ton kit et ta carte contre 2 pièces \nfais en bon usage", + }, }; } public override int MaxHealth { get; set; } = 100; diff --git a/KruacentExiled/KE.CustomRoles/CR/Scientist/ZoneManager.cs b/KruacentExiled/KE.CustomRoles/CR/Scientist/ZoneManager.cs index e5ad74bd..bd3ef6f6 100644 --- a/KruacentExiled/KE.CustomRoles/CR/Scientist/ZoneManager.cs +++ b/KruacentExiled/KE.CustomRoles/CR/Scientist/ZoneManager.cs @@ -26,6 +26,11 @@ protected override Dictionary> SetTranslation [TranslationKeyDesc] = "Open all of the checkpoint to get a better card!", }, ["fr"] = new() + { + [TranslationKeyName] = "Zone Manager", + [TranslationKeyDesc] = "Incroyable tu peux avoir une promotion alors fais ton boulot et ouvre tous ces checkpoints et tu pourras sortir d'ici!", + }, + ["legacy"] = new() { [TranslationKeyName] = "Zone Manager", [TranslationKeyDesc] = "Incroyable tu peux avoir une promotion alors fais ton boulot et ouvre tous ces checkpoints et tu pourras sortir d'ici!", diff --git a/KruacentExiled/KE.CustomRoles/CR/Scientist/scp202.cs b/KruacentExiled/KE.CustomRoles/CR/Scientist/scp202.cs index 9e3eb440..1aaf03d3 100644 --- a/KruacentExiled/KE.CustomRoles/CR/Scientist/scp202.cs +++ b/KruacentExiled/KE.CustomRoles/CR/Scientist/scp202.cs @@ -1,4 +1,4 @@ -using KE.CustomRoles.API.Features; +/*using KE.CustomRoles.API.Features; using Exiled.API.Features; using UnityEngine; using Exiled.Events.EventArgs.Player; @@ -76,4 +76,4 @@ protected override void RoleRemoved(Player player) } } -} \ No newline at end of file +}*/ \ No newline at end of file From ed64b0aaeb7a5e99759c98344fe41c34b81bcb94 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Wed, 25 Feb 2026 17:13:49 +0100 Subject: [PATCH 667/853] patchen ote --- KruacentExiled/KE.Misc/Config.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/KruacentExiled/KE.Misc/Config.cs b/KruacentExiled/KE.Misc/Config.cs index 379d4bbb..d6e4e35a 100644 --- a/KruacentExiled/KE.Misc/Config.cs +++ b/KruacentExiled/KE.Misc/Config.cs @@ -29,7 +29,7 @@ public class Config : IConfig public int MinPlayerVote { get; set; } = 6; - public string PatchNote { get; set; } = "Patch note:"; + public string PatchNote { get; set; } = ""; From 29369261065a3c512cdc83f407bee0c71c22d18f Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Wed, 25 Feb 2026 17:22:35 +0100 Subject: [PATCH 668/853] added check frozen 173 + fixed pacifist inventory exploding --- KruacentExiled/KE.CustomRoles/CR/Human/Pacifist.cs | 7 ++++++- KruacentExiled/KE.CustomRoles/CR/SCP/Paper.cs | 7 ++++++- KruacentExiled/KE.CustomRoles/CR/SCP/SCP173/Frozen.cs | 10 ++++++++-- KruacentExiled/KE.CustomRoles/CR/SCP/SCP939/Ultra.cs | 7 ++++++- KruacentExiled/KE.CustomRoles/CR/SCP/Small.cs | 7 ++++++- 5 files changed, 32 insertions(+), 6 deletions(-) diff --git a/KruacentExiled/KE.CustomRoles/CR/Human/Pacifist.cs b/KruacentExiled/KE.CustomRoles/CR/Human/Pacifist.cs index 0f0fcef6..b5b15d1b 100644 --- a/KruacentExiled/KE.CustomRoles/CR/Human/Pacifist.cs +++ b/KruacentExiled/KE.CustomRoles/CR/Human/Pacifist.cs @@ -29,7 +29,12 @@ protected override Dictionary> SetTranslation { [TranslationKeyName] = "Pacifiste", [TranslationKeyDesc] = "T'es idées empêche quelconque violence.\nS'enlève quand tu t'échappes et ramène plus de renfort", - } + }, + ["legacy"] = new() + { + [TranslationKeyName] = "Pacifiste", + [TranslationKeyDesc] = "T'es idées empêche quelconque violence.\nS'enlève quand tu t'échappes et ramène plus de renfort", + }, }; } public override bool KeepRoleOnDeath { get; set; } = false; diff --git a/KruacentExiled/KE.CustomRoles/CR/SCP/Paper.cs b/KruacentExiled/KE.CustomRoles/CR/SCP/Paper.cs index 1feda841..24d8b733 100644 --- a/KruacentExiled/KE.CustomRoles/CR/SCP/Paper.cs +++ b/KruacentExiled/KE.CustomRoles/CR/SCP/Paper.cs @@ -21,7 +21,12 @@ protected override Dictionary> SetTranslation { [TranslationKeyName] = "Paper", [TranslationKeyDesc] = "uh oh. paper jam", - } + }, + ["legacy"] = new() + { + [TranslationKeyName] = "Paper", + [TranslationKeyDesc] = "uh oh. paper jam", + }, }; } public override SideEnum Side { get; set; } = SideEnum.SCP; diff --git a/KruacentExiled/KE.CustomRoles/CR/SCP/SCP173/Frozen.cs b/KruacentExiled/KE.CustomRoles/CR/SCP/SCP173/Frozen.cs index 3af8cfde..069c29e6 100644 --- a/KruacentExiled/KE.CustomRoles/CR/SCP/SCP173/Frozen.cs +++ b/KruacentExiled/KE.CustomRoles/CR/SCP/SCP173/Frozen.cs @@ -36,7 +36,12 @@ protected override Dictionary> SetTranslation { [TranslationKeyName] = "SCP-173 Glacé", [TranslationKeyDesc] = "Instead of Tantrum you drop a SCP-244.\nTué quelqu'un qui est en hypothermie donne du shield (dans le jeu hein)", - } + }, + ["legacy"] = new() + { + [TranslationKeyName] = "Frozen SCP-173", + [TranslationKeyDesc] = "Instead of Tantrum you drop a SCP-244.\nKilling anyone with hypothermia gives Hume Shield", + }, }; } public override bool KeepRoleOnDeath { get; set; } = false; @@ -70,7 +75,7 @@ protected override void UnsubscribeEvents() private void OnDeath(PlayerDeathEventArgs ev) { Player player = ev.Player; - + if (!Check(ev.Attacker)) return; if (ev.DamageHandler is ScpDamageHandler scpDamageHandler) @@ -99,6 +104,7 @@ private void OnDeath(PlayerDeathEventArgs ev) private void OnCreatedTantrum(Scp173CreatedTantrumEventArgs ev) { + if (!Check(ev.Player)) return; TantrumHazard tantrum = ev.Tantrum; float time = tantrum.LiveDuration; diff --git a/KruacentExiled/KE.CustomRoles/CR/SCP/SCP939/Ultra.cs b/KruacentExiled/KE.CustomRoles/CR/SCP/SCP939/Ultra.cs index f04984e6..557c7658 100644 --- a/KruacentExiled/KE.CustomRoles/CR/SCP/SCP939/Ultra.cs +++ b/KruacentExiled/KE.CustomRoles/CR/SCP/SCP939/Ultra.cs @@ -28,7 +28,12 @@ protected override Dictionary> SetTranslation { [TranslationKeyName] = "Ultra SCP-939", [TranslationKeyDesc] = "Tu sais où est tout le monde", - } + }, + ["legacy"] = new() + { + [TranslationKeyName] = "Ultra SCP-939", + [TranslationKeyDesc] = "You can sense where people are located", + }, }; } public override bool KeepRoleOnDeath { get; set; } = false; diff --git a/KruacentExiled/KE.CustomRoles/CR/SCP/Small.cs b/KruacentExiled/KE.CustomRoles/CR/SCP/Small.cs index f467c0df..2b9c6a4a 100644 --- a/KruacentExiled/KE.CustomRoles/CR/SCP/Small.cs +++ b/KruacentExiled/KE.CustomRoles/CR/SCP/Small.cs @@ -23,7 +23,12 @@ protected override Dictionary> SetTranslation { [TranslationKeyName] = "Petit", [TranslationKeyDesc] = "t poti", - } + }, + ["legacy"] = new() + { + [TranslationKeyName] = "Small", + [TranslationKeyDesc] = "u smoll", + }, }; } public override bool KeepRoleOnDeath { get; set; } = false; From 993ec7f8290398da8227e51d384c66ff13c241bb Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Wed, 25 Feb 2026 17:25:27 +0100 Subject: [PATCH 669/853] patch ntoe --- KruacentExiled/KE.Misc/Config.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/KruacentExiled/KE.Misc/Config.cs b/KruacentExiled/KE.Misc/Config.cs index d6e4e35a..753bf022 100644 --- a/KruacentExiled/KE.Misc/Config.cs +++ b/KruacentExiled/KE.Misc/Config.cs @@ -29,7 +29,7 @@ public class Config : IConfig public int MinPlayerVote { get; set; } = 6; - public string PatchNote { get; set; } = ""; + public string PatchNote { get; set; } = "-Ajout d'un truc à Surface\r\n-Patch note dans le lobby\r\n-Ajout d'un nouveau custom SCP :\r\nun 049 qui n'a pas de zombie mais des buff à la place\r\n-Ajout d'un bouton pour remontré la description d'un custom role\r\n-Ajout d'un nouveau custom role : Le pacifiste (ClassD et Scientifique)\r\n-Ajout d'un nouveau custom role pour SCP173\r\n-Ajout d'une lumière au dos du Terroriste\r\n-Ajout d'une indication pour SetPosition\r\nuniquement visible pour le joueur ayant utilisé l'ability\r\n-Mise à jour des pickups models de la TP Grenada et de la Mine\r\n-La nuke (ni deadman ni auto) ajoute un respawn à la faction qui l'a activé\r\net met le timer à ~45s du respawn\r\n-auto nuke : 30 min -> 20 min\r\n-SCP-173 gambling est de nouveau interactable\r\nmais les items ne drop plus (sauf par manque de place)\r\nle temps d'utilisation : 10s -> 5s (approx)\r\n-Ajout de traduction aux custom roles et aux abilités\r\n-Shield Belt: 110HP -> 210HP\r\nAjout d'une taille min à la sphere de protection\r\n-Molotov <=> Heal zone à 914\r\n-Enlevé SCP-202\r\n-Removed Sou Hiyori from the facility\r\n"; From f6f9ecdf0c43b61fc57c6299118fa96bca0876b1 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Wed, 25 Feb 2026 17:45:07 +0100 Subject: [PATCH 670/853] patch note --- KruacentExiled/KE.Misc/Features/PatchNotes/PatchNote.cs | 2 +- .../KE.Misc/Features/PatchNotes/PatchNotesPosition.cs | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/KruacentExiled/KE.Misc/Features/PatchNotes/PatchNote.cs b/KruacentExiled/KE.Misc/Features/PatchNotes/PatchNote.cs index 71a3cb86..6c13da00 100644 --- a/KruacentExiled/KE.Misc/Features/PatchNotes/PatchNote.cs +++ b/KruacentExiled/KE.Misc/Features/PatchNotes/PatchNote.cs @@ -48,7 +48,7 @@ private void OnJoined(JoinedEventArgs ev) if (Round.IsLobby) { var hint = DisplayHandler.Instance.CreateAuto(player, (args) => GetPatchNotes(), HintPosition.HintPlacement); - hint.FontSize = 25; + hint.FontSize = 20; } }); diff --git a/KruacentExiled/KE.Misc/Features/PatchNotes/PatchNotesPosition.cs b/KruacentExiled/KE.Misc/Features/PatchNotes/PatchNotesPosition.cs index 65d56eed..9453371e 100644 --- a/KruacentExiled/KE.Misc/Features/PatchNotes/PatchNotesPosition.cs +++ b/KruacentExiled/KE.Misc/Features/PatchNotes/PatchNotesPosition.cs @@ -10,9 +10,9 @@ namespace KE.Misc.Features.PatchNotes { public class PatchNotesPosition : HintPosition { - public override float Xposition => -240; + public override float Xposition => -340; - public override float Yposition => 300; + public override float Yposition => 500; public override string Name => "PatchNotes"; public override HintAlignment HintAlignment => HintAlignment.Left; From 0ca842722a7271b617e209b07d803077738d9ad4 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Wed, 25 Feb 2026 22:30:12 +0100 Subject: [PATCH 671/853] added legacy + fixed 049c --- .../CR/CustomSCPs/SCP049C/SCP049CLevelSystem.cs | 4 ++-- .../KE.CustomRoles/CR/CustomSCPs/SCP049C/SCP049CRole.cs | 7 ++++++- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP049C/SCP049CLevelSystem.cs b/KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP049C/SCP049CLevelSystem.cs index 065078af..94cc5b9f 100644 --- a/KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP049C/SCP049CLevelSystem.cs +++ b/KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP049C/SCP049CLevelSystem.cs @@ -47,7 +47,7 @@ public bool MaxLevelReached { get { - return Level < MaxLevel; + return Level >= MaxLevel; } } @@ -125,7 +125,7 @@ public void AddKill() KELog.Debug("add kill"); currentkill++; - if(!MaxLevelReached &¤tkill >= KillObjective) + if(!MaxLevelReached && currentkill >= KillObjective) { currentkill = 0; diff --git a/KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP049C/SCP049CRole.cs b/KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP049C/SCP049CRole.cs index 2f2280f7..7472523b 100644 --- a/KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP049C/SCP049CRole.cs +++ b/KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP049C/SCP049CRole.cs @@ -26,6 +26,11 @@ protected override Dictionary> SetTranslation [TranslationKeyDesc] = "A modified SCP049 instance which does not create any SCP049-2\ninstead consuming the body to gain powerful abilities\nDoctor's call gives 300 Hume Shield\nExpired body can still be consumed but need more time to do so", }, ["fr"] = new() + { + [TranslationKeyName] = "SCP049-C", + [TranslationKeyDesc] = "A modified SCP049 instance which does not create any SCP049-2\ninstead consuming the body to gain powerful abilities\nDoctor's call gives 300 Hume Shield\nExpired body can still be consumed but need more time to do so", + }, + ["legacy"] = new() { [TranslationKeyName] = "SCP049-C", [TranslationKeyDesc] = "A modified SCP049 instance which does not create any SCP049-2\ninstead consuming the body to gain powerful abilities\nDoctor's call gives 300 Hume Shield\nExpired body can still be consumed but need more time to do so", @@ -37,7 +42,7 @@ protected override Dictionary> SetTranslation public override string InternalName => "C"; public override int MaxHealth { get; set; } = 2500; - public override float SpawnChance { get; set; } = 0; + public override float SpawnChance { get; set; } = 100; protected override int SettingId => 10003; internal static SCP049CRole instance = null; From 3a7aa2ee8326bd4371124db4206a7e67303e3a72 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Thu, 26 Feb 2026 13:10:41 +0100 Subject: [PATCH 672/853] fix mscna --- .../Items/{LeSoleil => LS}/LeSoleil.cs | 0 .../Items/{LeSoleil => LS}/SoleilComp.cs | 0 KruacentExiled/KE.Items/Items/MScan.cs | 147 +++++++++++------- 3 files changed, 93 insertions(+), 54 deletions(-) rename KruacentExiled/KE.Items/Items/{LeSoleil => LS}/LeSoleil.cs (100%) rename KruacentExiled/KE.Items/Items/{LeSoleil => LS}/SoleilComp.cs (100%) diff --git a/KruacentExiled/KE.Items/Items/LeSoleil/LeSoleil.cs b/KruacentExiled/KE.Items/Items/LS/LeSoleil.cs similarity index 100% rename from KruacentExiled/KE.Items/Items/LeSoleil/LeSoleil.cs rename to KruacentExiled/KE.Items/Items/LS/LeSoleil.cs diff --git a/KruacentExiled/KE.Items/Items/LeSoleil/SoleilComp.cs b/KruacentExiled/KE.Items/Items/LS/SoleilComp.cs similarity index 100% rename from KruacentExiled/KE.Items/Items/LeSoleil/SoleilComp.cs rename to KruacentExiled/KE.Items/Items/LS/SoleilComp.cs diff --git a/KruacentExiled/KE.Items/Items/MScan.cs b/KruacentExiled/KE.Items/Items/MScan.cs index c7299d3d..2b6bc6d2 100644 --- a/KruacentExiled/KE.Items/Items/MScan.cs +++ b/KruacentExiled/KE.Items/Items/MScan.cs @@ -5,8 +5,13 @@ using Exiled.API.Features.Spawn; using Exiled.CustomItems.API.Features; using Exiled.Events.EventArgs.Player; +using Exiled.Events.EventArgs.Scp049; +using Exiled.Events.EventArgs.Scp096; +using Exiled.Events.EventArgs.Scp106; +using Exiled.Events.EventArgs.Scp939; using KE.Items.API.Features; using MEC; +using NorthwoodLib.Pools; using System.Collections.Generic; using UnityEngine; @@ -43,7 +48,7 @@ public class MScan : KECustomItem }, }; - private Dictionary ActiveSensors = new Dictionary(); + private Dictionary ActiveSensors private Dictionary Cooldowns = new Dictionary(); private Dictionary BatteryLife = new Dictionary(); @@ -52,14 +57,15 @@ public class MScan : KECustomItem protected override void SubscribeEvents() { - Exiled.Events.Handlers.Player.DroppingItem += OnDropping; - Exiled.Events.Handlers.Player.PickingUpItem += OnPickingUp; + + ActiveSensors = new Dictionary(); Exiled.Events.Handlers.Player.Shot += OnShot; + Exiled.Events.Handlers.Player.DroppedItem += OnDroppedItem; - Exiled.Events.Handlers.Scp049.Attacking += (ev) => CheckDestruction(ev.Player.Position, 2f); - Exiled.Events.Handlers.Scp096.Enraging += (ev) => CheckDestruction(ev.Player.Position, 2f); - Exiled.Events.Handlers.Scp939.Clawed += (ev) => CheckDestruction(ev.Player.Position, 2f); - Exiled.Events.Handlers.Scp106.Teleporting += (ev) => CheckDestruction(ev.Player.Position, 2f); + Exiled.Events.Handlers.Scp049.Attacking += OnSCP049Attacking; + Exiled.Events.Handlers.Scp106.Teleporting += OnSCP106Teleporting; + Exiled.Events.Handlers.Scp939.Clawed += OnSCP939Attacked; + Exiled.Events.Handlers.Scp096.Enraging += OnSCP096Enraging; SensorRoutine = Timing.RunCoroutine(MotionDetector()); base.SubscribeEvents(); @@ -67,61 +73,84 @@ protected override void SubscribeEvents() protected override void UnsubscribeEvents() { - Exiled.Events.Handlers.Player.DroppingItem -= OnDropping; - Exiled.Events.Handlers.Player.PickingUpItem -= OnPickingUp; Exiled.Events.Handlers.Player.Shot -= OnShot; + Exiled.Events.Handlers.Player.DroppedItem -= OnDroppedItem; + + Exiled.Events.Handlers.Scp049.Attacking -= OnSCP049Attacking; + Exiled.Events.Handlers.Scp106.Teleporting -= OnSCP106Teleporting; + Exiled.Events.Handlers.Scp939.Clawed -= OnSCP939Attacked; + Exiled.Events.Handlers.Scp096.Enraging -= OnSCP096Enraging; Timing.KillCoroutines(SensorRoutine); ActiveSensors.Clear(); base.UnsubscribeEvents(); } - private new void OnDropping(DroppingItemEventArgs ev) + + + private void OnSCP049Attacking(Exiled.Events.EventArgs.Scp049.AttackingEventArgs ev) { - if (!Check(ev.Item)) return; + CheckDestruction(ev.Player.Position, 2f); + } + private void OnSCP106Teleporting(TeleportingEventArgs ev) + { + CheckDestruction(ev.Player.Position, 2f); + } + private void OnSCP939Attacked(ClawedEventArgs ev) + { + CheckDestruction(ev.Player.Position, 2f); + } + + private void OnSCP096Enraging(EnragingEventArgs ev) + { + CheckDestruction(ev.Player.Position, 2f); + } + - Timing.CallDelayed(0.5f, () => + + private void OnDroppedItem(DroppedItemEventArgs ev) + { + if (!Check(ev.Pickup)) return; + + + Player player = ev.Player; + Pickup pickup = ev.Pickup; + + if (!ActiveSensors.ContainsKey(pickup)) { - foreach (Pickup p in Pickup.List) - { - if (p.Serial == ev.Item.Serial) - { - if (!ActiveSensors.ContainsKey(p)) - { - ActiveSensors.Add(p, ev.Player); - BatteryLife[p] = Time.time + 300f; + ActiveSensors.Add(pickup, player); + BatteryLife[pickup] = Time.time + 300f; - ev.Player.ShowHint("SCANNER DÉPLOYÉ\nBatterie: 5 minutes", 3f); - } - break; - } - } - }); + KECustomItem.ItemEffectHint(player, "SCANNER DÉPLOYÉ\nBatterie: 5 minutes"); + } } - private new void OnPickingUp(PickingUpItemEventArgs ev) + protected override void OnPickingUp(PickingUpItemEventArgs ev) { - if (!Check(ev.Pickup)) return; + Player player = ev.Player; if (ActiveSensors.ContainsKey(ev.Pickup)) { ActiveSensors.Remove(ev.Pickup); BatteryLife.Remove(ev.Pickup); - ev.Player.ShowHint("Scanner récupéré.", 2f); + KECustomItem.ItemEffectHint(player, "Scanner récupéré."); } } - private void OnShot(ShotEventArgs ev) => CheckDestruction(ev.Position, 0.5f); + private void OnShot(ShotEventArgs ev) + { + CheckDestruction(ev.Position, 0.5f); + } private void CheckDestruction(Vector3 hitPos, float radius) { - List toDestroy = new List(); + List toDestroy = ListPool.Shared.Rent(); foreach (var kvp in ActiveSensors) { Pickup sensor = kvp.Key; Player owner = kvp.Value; - if (sensor == null) continue; + if (!sensor.IsSpawned) continue; if (Vector3.Distance(hitPos, sensor.Position) <= radius) { @@ -136,38 +165,51 @@ private void CheckDestruction(Vector3 hitPos, float radius) BatteryLife.Remove(p); p.Destroy(); } + + ListPool.Shared.Return(toDestroy); + } + + + + private void CheckBattery() + { + List invalid = ListPool.Shared.Rent(); + foreach (var key in ActiveSensors.Keys) + { + if (BatteryLife.ContainsKey(key) && Time.time > BatteryLife[key]) + { + if (ActiveSensors[key] != null) + KECustomItem.ItemEffectHint(ActiveSensors[key], "Scanner: Batterie épuisée."); + invalid.Add(key); + } + } + + foreach (var i in invalid) + { + ActiveSensors.Remove(i); + BatteryLife.Remove(i); + if (!i.IsSpawned) i.Destroy(); + } + ListPool.Shared.Return(invalid); } private IEnumerator MotionDetector() { while (true) { - List invalid = new List(); + float currentTime = Time.time; - foreach (var key in ActiveSensors.Keys) - { - if (key == null || key.GameObject == null) invalid.Add(key); - else if (BatteryLife.ContainsKey(key) && currentTime > BatteryLife[key]) - { - if (ActiveSensors[key] != null) - KECustomItem.ItemEffectHint(ActiveSensors[key], "Scanner: Batterie épuisée."); - invalid.Add(key); - } - } + CheckBattery(); - foreach (var i in invalid) - { - ActiveSensors.Remove(i); - BatteryLife.Remove(i); - if (i != null) i.Destroy(); - } foreach (var kvp in ActiveSensors) { Pickup sensor = kvp.Key; Player owner = kvp.Value; + if (sensor.Base == null) continue; + if (Cooldowns.ContainsKey(sensor) && currentTime < Cooldowns[sensor]) continue; bool detected = false; @@ -177,6 +219,7 @@ private IEnumerator MotionDetector() if (target == owner) continue; if (!target.IsAlive || target.IsNoclipPermitted) continue; if (owner != null && target.Role.Side == owner.Role.Side) continue; + if (Vector3.Distance(sensor.Position, target.Position) < 3.5f) { @@ -184,11 +227,7 @@ private IEnumerator MotionDetector() if (owner != null) { - string color = "orange"; - if (target.Role.Side == Side.Scp) color = "red"; - else if (target.Role.Side == Side.Mtf) color = "blue"; - else if (target.Role.Side == Side.ChaosInsurgency) color = "green"; - + string color = target.Role.Color.ToHex(); KECustomItem.ItemEffectHint(owner, $"M-SCAN: {target.Role.Name} ({target.Nickname})"); } From fe60819db84a601cbf55fa2c154165971d691b5b Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Thu, 26 Feb 2026 13:12:42 +0100 Subject: [PATCH 673/853] fix 914 guard --- KruacentExiled/KE.CustomRoles/CR/Guard/Guard914.cs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/KruacentExiled/KE.CustomRoles/CR/Guard/Guard914.cs b/KruacentExiled/KE.CustomRoles/CR/Guard/Guard914.cs index ee254e18..84f5eb90 100644 --- a/KruacentExiled/KE.CustomRoles/CR/Guard/Guard914.cs +++ b/KruacentExiled/KE.CustomRoles/CR/Guard/Guard914.cs @@ -147,6 +147,9 @@ private void OnProcessedPlayer(Scp914ProcessedPlayerEventArgs ev) { if (ev.KnobSetting != Scp914.Scp914KnobSetting.Fine) return; Player player = ev.Player; + + if (player.CurrentItem is null) return; + Item item = Item.Get(player.CurrentItem.Serial); if (item is null) return; From 875314132610f098ec9e6967fcc376a81878d089 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Thu, 26 Feb 2026 13:34:38 +0100 Subject: [PATCH 674/853] fixed weight + midlelve event --- .../GE/Blitz.cs | 2 +- .../GE/Impostor.cs | 2 +- .../GE/ItemRain.cs | 7 +++++- .../GE/Kaboom.cs | 5 ++++- .../GE/OpenBar.cs | 2 +- .../KE.GlobalEventFramework.Examples/GE/R.cs | 2 +- .../GE/RandomSpawn.cs | 2 +- .../GE/Speed.cs | 2 +- .../MiddleEvents/Disco.cs | 7 ++++++ .../MiddleEvents/HealSCP.cs | 2 +- .../MiddleEvents/ShufflePosition.cs | 22 ++++++++++++++----- 11 files changed, 40 insertions(+), 15 deletions(-) diff --git a/KruacentExiled/KE.GlobalEventFramework.Examples/GE/Blitz.cs b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/Blitz.cs index a6600727..e126525e 100644 --- a/KruacentExiled/KE.GlobalEventFramework.Examples/GE/Blitz.cs +++ b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/Blitz.cs @@ -24,7 +24,7 @@ public class Blitz : GlobalEvent, IStart "Attention aux bombardements!" ]; /// - public override int WeightedChance => 1; + public override int WeightedChance => 4; /// /// The cooldown between 2 spawn of grenades /// diff --git a/KruacentExiled/KE.GlobalEventFramework.Examples/GE/Impostor.cs b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/Impostor.cs index 565fc230..11d78032 100644 --- a/KruacentExiled/KE.GlobalEventFramework.Examples/GE/Impostor.cs +++ b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/Impostor.cs @@ -20,7 +20,7 @@ public class Impostor : GlobalEvent, IStart [ "sussy" ]; - public override int WeightedChance { get; set; } = 1; + public override int WeightedChance { get; set; } = 2; public override ImpactLevel ImpactLevel => ImpactLevel.High; diff --git a/KruacentExiled/KE.GlobalEventFramework.Examples/GE/ItemRain.cs b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/ItemRain.cs index 16a7304c..c6d842a5 100644 --- a/KruacentExiled/KE.GlobalEventFramework.Examples/GE/ItemRain.cs +++ b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/ItemRain.cs @@ -34,7 +34,12 @@ public IEnumerator Start() for (int i = 0; i < NbItemSpawned; i++) { - Item.Create((ItemType)values.GetValue(UnityEngine.Random.Range(0, values.Length))).CreatePickup(Room.Random().Position); + + ItemType itemType = (ItemType)values.GetValue(UnityEngine.Random.Range(0, values.Length)); + + if (itemType == ItemType.None) continue; + + Item.Create(itemType).CreatePickup(Room.Random().Position); } } } diff --git a/KruacentExiled/KE.GlobalEventFramework.Examples/GE/Kaboom.cs b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/Kaboom.cs index 33588068..4287fede 100644 --- a/KruacentExiled/KE.GlobalEventFramework.Examples/GE/Kaboom.cs +++ b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/Kaboom.cs @@ -23,7 +23,7 @@ public class Kaboom : GlobalEvent, IEvent "La guerrilla est présente" ]; /// - public override int WeightedChance { get; set; } = 1; + public override int WeightedChance { get; set; } = 2; public override ImpactLevel ImpactLevel => ImpactLevel.Medium; @@ -87,6 +87,9 @@ private void OnInteractingDoor(InteractingDoorEventArgs ev) float random = UnityEngine.Random.value; Door door = ev.Door; + if (!door.IsOpen) return; + + Log.Debug($"i love debugging random value : {random}"); if ((door.IsElevator && random < .05f) || (door.IsGate && random < .5f) || diff --git a/KruacentExiled/KE.GlobalEventFramework.Examples/GE/OpenBar.cs b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/OpenBar.cs index 30c9934e..e1dd33d5 100644 --- a/KruacentExiled/KE.GlobalEventFramework.Examples/GE/OpenBar.cs +++ b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/OpenBar.cs @@ -19,7 +19,7 @@ public class OpenBar : GlobalEvent, IStart, IEvent public override uint Id { get; set; } = 1048; public override string Name { get; set; } = "OpenBar"; public override string Description { get; } = "j'espère que vous avez pas prévu de kampé"; - public override int WeightedChance { get; set; } = 1; + public override int WeightedChance { get; set; } = 3; public override uint[] IncompatibleEvents { get; set; } = { 1 }; public int NbAdditionalDoor = 3; diff --git a/KruacentExiled/KE.GlobalEventFramework.Examples/GE/R.cs b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/R.cs index 53cbb66e..800ffc5f 100644 --- a/KruacentExiled/KE.GlobalEventFramework.Examples/GE/R.cs +++ b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/R.cs @@ -15,7 +15,7 @@ public class R : GlobalEvent /// public override string Description { get; } = "y'a r"; /// - public override int WeightedChance => 3; + public override int WeightedChance => 10; public override ImpactLevel ImpactLevel => ImpactLevel.VeryLow; diff --git a/KruacentExiled/KE.GlobalEventFramework.Examples/GE/RandomSpawn.cs b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/RandomSpawn.cs index 09874c79..30164551 100644 --- a/KruacentExiled/KE.GlobalEventFramework.Examples/GE/RandomSpawn.cs +++ b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/RandomSpawn.cs @@ -28,7 +28,7 @@ public class RandomSpawn : GlobalEvent,IStart /// public override string Description { get; } = "Les spawns sont random"; /// - public override int WeightedChance { get; set; } = 1; + public override int WeightedChance { get; set; } = 5; public override ImpactLevel ImpactLevel => ImpactLevel.High; public IEnumerable BlacklistedRooms { get; } = []; /// diff --git a/KruacentExiled/KE.GlobalEventFramework.Examples/GE/Speed.cs b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/Speed.cs index dfc1bf05..9a5baeba 100644 --- a/KruacentExiled/KE.GlobalEventFramework.Examples/GE/Speed.cs +++ b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/Speed.cs @@ -41,7 +41,7 @@ public class Speed : GlobalEvent,IStart,IEvent "Mayhem mode activated", }; /// - public override int WeightedChance { get; set; } = 1; + public override int WeightedChance { get; set; } = 5; /// /// intensity of the movement boost effect /// diff --git a/KruacentExiled/KE.GlobalEventFramework.Examples/MiddleEvents/Disco.cs b/KruacentExiled/KE.GlobalEventFramework.Examples/MiddleEvents/Disco.cs index f0637afa..784fa09f 100644 --- a/KruacentExiled/KE.GlobalEventFramework.Examples/MiddleEvents/Disco.cs +++ b/KruacentExiled/KE.GlobalEventFramework.Examples/MiddleEvents/Disco.cs @@ -10,5 +10,12 @@ internal class Disco { //lumière random + + + + private void Start() + { + + } } } diff --git a/KruacentExiled/KE.GlobalEventFramework.Examples/MiddleEvents/HealSCP.cs b/KruacentExiled/KE.GlobalEventFramework.Examples/MiddleEvents/HealSCP.cs index 0a27eb4d..6517a72d 100644 --- a/KruacentExiled/KE.GlobalEventFramework.Examples/MiddleEvents/HealSCP.cs +++ b/KruacentExiled/KE.GlobalEventFramework.Examples/MiddleEvents/HealSCP.cs @@ -33,7 +33,7 @@ public bool Condition() foreach(Player p in list) { - if(p.Health/p.MaxHealth > .1f) + if(p.Health/p.MaxHealth > .3f) { return false; } diff --git a/KruacentExiled/KE.GlobalEventFramework.Examples/MiddleEvents/ShufflePosition.cs b/KruacentExiled/KE.GlobalEventFramework.Examples/MiddleEvents/ShufflePosition.cs index ed51919a..2c713d26 100644 --- a/KruacentExiled/KE.GlobalEventFramework.Examples/MiddleEvents/ShufflePosition.cs +++ b/KruacentExiled/KE.GlobalEventFramework.Examples/MiddleEvents/ShufflePosition.cs @@ -1,6 +1,8 @@ using Exiled.API.Features; using KE.GlobalEventFramework.GEFE.API.Features; +using KE.GlobalEventFramework.GEFE.API.Interfaces; using MEC; +using NorthwoodLib.Pools; using PlayerRoles; using System; using System.Collections.Generic; @@ -12,7 +14,7 @@ namespace KE.GlobalEventFramework.Examples.MiddleEvents { - public class ShufflePosition : MiddleEvent + public class ShufflePosition : MiddleEvent, IStart { //shuffle de position une fois quand il est activé /// @@ -27,16 +29,24 @@ public class ShufflePosition : MiddleEvent public IEnumerator Start() { - List position = Player.Enumerable.Select(p => p.Position).ToList(); - Vector3 tmp = position[0]; - for(int i = 0; i < position.Count-1; i++) + + + List players = Player.Enumerable.ToList(); + List positions = ListPool.Shared.Rent(players.Count); + + Vector3 tmp = positions[0]; + for (int i = 0; i < positions.Count - 1; i++) { - position[i] = position[i + 1]; + positions[i] = players[i+1].Position; } - position[position.Count - 1] = tmp; + positions[positions.Count - 1] = tmp; + for(int i = 0; i < players.Count - 1; i++) + { + players[i].Teleport(positions[i]); + } yield return Timing.WaitForOneFrame; } From ce7ca36506b5ef87e49e91f1fbe92c583868cd11 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Thu, 26 Feb 2026 13:43:39 +0100 Subject: [PATCH 675/853] auto tesla fix --- KruacentExiled/KE.Misc/Features/AutoTesla.cs | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/KruacentExiled/KE.Misc/Features/AutoTesla.cs b/KruacentExiled/KE.Misc/Features/AutoTesla.cs index 524c1115..7e5e717e 100644 --- a/KruacentExiled/KE.Misc/Features/AutoTesla.cs +++ b/KruacentExiled/KE.Misc/Features/AutoTesla.cs @@ -1,4 +1,5 @@ -using Exiled.API.Features; +using Exiled.API.Extensions; +using Exiled.API.Features; using LabApi.Features.Wrappers; using MEC; using System; @@ -32,16 +33,14 @@ private IEnumerator StartElevator() { while (!Round.IsEnded) { - foreach (Tesla tesla in Tesla.List) + yield return Timing.WaitForSeconds(UnityEngine.Random.Range(120f, 200f)); + Tesla tesla = Tesla.List.GetRandomValue(); + + tesla.Trigger(); + if (UnityEngine.Random.Range(0f, 100f) <= 70f) { - yield return Timing.WaitForSeconds(UnityEngine.Random.Range(120f,200f)); + yield return Timing.WaitForSeconds(tesla.Base.windupTime + tesla.Base.cooldownTime + .1f); tesla.Trigger(); - if(UnityEngine.Random.Range(0f,100f) <= 70f) - { - yield return Timing.WaitForSeconds(tesla.Base.windupTime+tesla.Base.cooldownTime+.1f); - tesla.Trigger(); - } - } } } From 7ec306ccd489db80710f577860d311bf971b0239 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Thu, 26 Feb 2026 16:35:48 +0100 Subject: [PATCH 676/853] fix 049c --- .../CR/CustomSCPs/SCP049C/SCP049CGUI.cs | 14 +++- .../CustomSCPs/SCP049C/SCP049CLevelSystem.cs | 19 +++-- .../CR/CustomSCPs/SCP049C/SCP049CRole.cs | 14 ++-- .../Tier1/MoreShieldUnlockable.cs | 4 +- .../Tier2/DeflectDamageUnlockable.cs | 83 +++++++++++++++++++ .../Tier2/WallAbilityUnlockable.cs | 31 ------- .../Tier3/SpeedUnlockable.cs | 9 +- 7 files changed, 120 insertions(+), 54 deletions(-) create mode 100644 KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP049C/UnlockableAbilities/Tier2/DeflectDamageUnlockable.cs delete mode 100644 KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP049C/UnlockableAbilities/Tier2/WallAbilityUnlockable.cs diff --git a/KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP049C/SCP049CGUI.cs b/KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP049C/SCP049CGUI.cs index 11a467ad..fb961441 100644 --- a/KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP049C/SCP049CGUI.cs +++ b/KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP049C/SCP049CGUI.cs @@ -98,15 +98,23 @@ private string GetContent(Player player,HintPlacement hintPlacement) { sb.AppendLine(""); } + else + { + sb.AppendLine(""); + } + - - sb.AppendLine(unlockable.GetName(player.ReferenceHub)); + sb.AppendLine(unlockable.GetName(player.ReferenceHub)); if (flag) { sb.AppendLine(""); } + else + { + sb.AppendLine(""); + } - sb.Append(""); sb.Append(unlockable.GetDescription(player.ReferenceHub)); diff --git a/KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP049C/SCP049CLevelSystem.cs b/KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP049C/SCP049CLevelSystem.cs index 94cc5b9f..26c236ab 100644 --- a/KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP049C/SCP049CLevelSystem.cs +++ b/KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP049C/SCP049CLevelSystem.cs @@ -256,23 +256,26 @@ private void UpdateTime() if (Vector3.Distance(ragdoll.Position,_hub.transform.position) > MaxDistance) { Reset(); + return; } cooldown += Time.deltaTime; - RagdollArrowComp comp = ragdoll.GameObject.GetComponent(); - comp.SetColor(Color.red); - - if (cooldown > timeOnCorpse) + if(ragdoll.GameObject.TryGetComponent(out var comp)) { - ragdoll.Destroy(); - AddKill(); - Reset(); + comp.SetColor(Color.red); - + if (cooldown > timeOnCorpse) + { + ragdoll.Destroy(); + AddKill(); + Reset(); + } } + + } diff --git a/KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP049C/SCP049CRole.cs b/KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP049C/SCP049CRole.cs index 7472523b..9ecb5d63 100644 --- a/KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP049C/SCP049CRole.cs +++ b/KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP049C/SCP049CRole.cs @@ -23,17 +23,17 @@ protected override Dictionary> SetTranslation ["en"] = new() { [TranslationKeyName] = "SCP049-C", - [TranslationKeyDesc] = "A modified SCP049 instance which does not create any SCP049-2\ninstead consuming the body to gain powerful abilities\nDoctor's call gives 300 Hume Shield\nExpired body can still be consumed but need more time to do so", + [TranslationKeyDesc] = "A modified SCP049 instance which does not create any SCP049-2\ninstead consuming the body to gain powerful abilities\nDoctor's call gives 300 Hume Shield\nExpired body can still be consumed but need more time to do so (stay near the arrow until it disappear (10s))", }, ["fr"] = new() { [TranslationKeyName] = "SCP049-C", - [TranslationKeyDesc] = "A modified SCP049 instance which does not create any SCP049-2\ninstead consuming the body to gain powerful abilities\nDoctor's call gives 300 Hume Shield\nExpired body can still be consumed but need more time to do so", + [TranslationKeyDesc] = "A modified SCP049 instance which does not create any SCP049-2\ninstead consuming the body to gain powerful abilities\nDoctor's call gives 300 Hume Shield\nExpired body can still be consumed but need more time to do so (stay near the arrow until it disappear (10s))", }, ["legacy"] = new() { [TranslationKeyName] = "SCP049-C", - [TranslationKeyDesc] = "A modified SCP049 instance which does not create any SCP049-2\ninstead consuming the body to gain powerful abilities\nDoctor's call gives 300 Hume Shield\nExpired body can still be consumed but need more time to do so", + [TranslationKeyDesc] = "A modified SCP049 instance which does not create any SCP049-2\ninstead consuming the body to gain powerful abilities\nDoctor's call gives 300 Hume Shield\nExpired body can still be consumed but need more time to do so (stay near the arrow until it disappear (10s))", } }; } @@ -80,7 +80,7 @@ public string GetContent(Player player) StringBuilder sb = StringBuilderPool.Shared.Rent(); bool flag = comp.MaxLevelReached; - if (flag) + if (!flag) { sb.Append("Tier : "); sb.AppendLine(comp.Level.ToString()); @@ -89,10 +89,10 @@ public string GetContent(Player player) { sb.AppendLine("Max Tier"); } - - sb.Append("Kill : "); + + sb.Append("Kills : "); sb.Append(comp.CurrentKill); - if (flag) + if (!flag) { sb.Append("/"); sb.Append(comp.KillObjective); diff --git a/KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP049C/UnlockableAbilities/Tier1/MoreShieldUnlockable.cs b/KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP049C/UnlockableAbilities/Tier1/MoreShieldUnlockable.cs index fb3c8b3a..5070ff23 100644 --- a/KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP049C/UnlockableAbilities/Tier1/MoreShieldUnlockable.cs +++ b/KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP049C/UnlockableAbilities/Tier1/MoreShieldUnlockable.cs @@ -14,13 +14,13 @@ public override string GetName(ReferenceHub hub) } public override string GetDescription(ReferenceHub hub) { - return "Set your max Shield at 700\ninstead of 300"; + return "Set your max Shield at 1100\ninstead of 300"; } public override void Grant(ReferenceHub hub) { LabPlayer lab = LabPlayer.Get(hub); - lab.MaxHumeShield = 700; + lab.MaxHumeShield = 1100; } public override void Remove(ReferenceHub hub) diff --git a/KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP049C/UnlockableAbilities/Tier2/DeflectDamageUnlockable.cs b/KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP049C/UnlockableAbilities/Tier2/DeflectDamageUnlockable.cs new file mode 100644 index 00000000..9da6b4ec --- /dev/null +++ b/KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP049C/UnlockableAbilities/Tier2/DeflectDamageUnlockable.cs @@ -0,0 +1,83 @@ +using Exiled.API.Features; +using Exiled.API.Features.Roles; +using Exiled.Events.EventArgs.Player; +using KE.Utils.API.Features; +using PlayerRoles.FirstPersonControl; +using System; +using System.Collections.Generic; +using UnityEngine.Windows.Speech; +using LabPlayer = LabApi.Features.Wrappers.Player; +namespace KE.CustomRoles.CR.CustomSCPs.SCP049C.UnlockableAbilities.Tier2 +{ + internal class DeflectDamageUnlockable : Unlockable + { + public override byte Tier => 2; + public override string GetName(ReferenceHub hub) + { + return "Deflect Damages"; + } + public override string GetDescription(ReferenceHub hub) + { + return "1 chance sur 8 d'annuler un dégât (.5s par hp sauvé de cooldown)"; + } + + + private Dictionary cooldowns = new(); + + public override void Grant(ReferenceHub hub) + { + cooldowns.Add(hub, null); + Exiled.Events.Handlers.Player.Hurting += OnHurting; + } + + public override void Remove(ReferenceHub hub) + { + + } + + + private void OnHurting(HurtingEventArgs ev) + { + + ReferenceHub hub = ev.Player.ReferenceHub; + if (ev.IsAllowed && cooldowns.ContainsKey(hub)) + { + LastDamage lastDamage = cooldowns[hub]; + + if(lastDamage is null || lastDamage.IsDeflectable()) + { + ev.IsAllowed = false; + cooldowns[hub] = new(ev.Amount); + } + } + } + + private class LastDamage + { + public float DamageAmount; + public DateTime Time; + public LastDamage(float damageAmount) + { + DamageAmount = damageAmount; + Time = DateTime.Now; + } + + + public bool IsDeflectable() + { + return DateTime.Now > (Time + GetCooldown(DamageAmount)); + } + + + public static TimeSpan GetCooldown(float damage) + { + return TimeSpan.FromSeconds(damage * .5f); + } + + } + } + + + + +} diff --git a/KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP049C/UnlockableAbilities/Tier2/WallAbilityUnlockable.cs b/KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP049C/UnlockableAbilities/Tier2/WallAbilityUnlockable.cs deleted file mode 100644 index f6927831..00000000 --- a/KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP049C/UnlockableAbilities/Tier2/WallAbilityUnlockable.cs +++ /dev/null @@ -1,31 +0,0 @@ -using Exiled.API.Features; -using Exiled.API.Features.Roles; -using KE.Utils.API.Features; -using PlayerRoles.FirstPersonControl; -using System; -using LabPlayer = LabApi.Features.Wrappers.Player; -namespace KE.CustomRoles.CR.CustomSCPs.SCP049C.UnlockableAbilities.Tier2 -{ - internal class WallAbilityUnlockable : Unlockable - { - public override byte Tier => 2; - public override string GetName(ReferenceHub hub) - { - return "Deflect Damages"; - } - public override string GetDescription(ReferenceHub hub) - { - return "1 chance sur 8 d'annuler un dégât (.5s par hp sauvé de cooldown)"; - } - - public override void Grant(ReferenceHub hub) - { - - } - - public override void Remove(ReferenceHub hub) - { - - } - } -} diff --git a/KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP049C/UnlockableAbilities/Tier3/SpeedUnlockable.cs b/KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP049C/UnlockableAbilities/Tier3/SpeedUnlockable.cs index af89f8ae..28892d5a 100644 --- a/KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP049C/UnlockableAbilities/Tier3/SpeedUnlockable.cs +++ b/KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP049C/UnlockableAbilities/Tier3/SpeedUnlockable.cs @@ -16,16 +16,19 @@ public override string GetName(ReferenceHub hub) } public override string GetDescription(ReferenceHub hub) { - return "Become 25% faster but lose all of the other abilities"; + return $"Become {Intensity}% faster but lose all of the other abilities"; } + + public const byte Intensity = 50; + public override void Grant(ReferenceHub hub) { LabPlayer lab = LabPlayer.Get(hub); MovementBoost move = lab.GetEffect(); - lab.EnableEffect((byte)(move.Intensity + 25), 0, false); + lab.EnableEffect((byte)(move.Intensity + Intensity), 0, false); hub.GetComponent().DisableAll(); @@ -36,7 +39,7 @@ public override void Remove(ReferenceHub hub) LabPlayer lab = LabPlayer.Get(hub); MovementBoost move = lab.GetEffect(); - lab.EnableEffect((byte)(move.Intensity - 25), 0, false); + lab.EnableEffect((byte)(move.Intensity - Intensity), 0, false); From 19115e75711e299473adb4a389897af6ae2402af Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Thu, 26 Feb 2026 16:39:10 +0100 Subject: [PATCH 677/853] fix elevator not spawning --- .../ElevatorGateA/CustomElevatorGateA.cs | 44 ++++++++++++++----- 1 file changed, 34 insertions(+), 10 deletions(-) diff --git a/KruacentExiled/KE.Map/Surface/ElevatorGateA/CustomElevatorGateA.cs b/KruacentExiled/KE.Map/Surface/ElevatorGateA/CustomElevatorGateA.cs index cc3f53ef..a6b9b8db 100644 --- a/KruacentExiled/KE.Map/Surface/ElevatorGateA/CustomElevatorGateA.cs +++ b/KruacentExiled/KE.Map/Surface/ElevatorGateA/CustomElevatorGateA.cs @@ -1,4 +1,5 @@ -using Exiled.API.Features.Objectives; +using Exiled.API.Features; +using Exiled.API.Features.Objectives; using Exiled.API.Features.Toys; using Exiled.Events.EventArgs.Player; using InventorySystem.Items.Firearms.Modules.Scp127; @@ -39,8 +40,15 @@ public static void Create() //prim.GameObject.AddComponent(); + try + { + Destroy(); + } + catch(Exception e) + { + Log.Error(e); + } - Destroy(); model = new(); toppanel = new(); @@ -107,20 +115,36 @@ public static void Destroy() if(prim != null) { model.SendingElevator -= SendingElevator; - bottompanel.SendingElevator -= SendingElevator; - toppanel.SendingElevator -= SendingElevator; model.Destroy(prim.Transform); - toppanel.Destroy(primtop.Transform); - bottompanel.Destroy(primbottom.Transform); + prim = null; + step.Destroy(); help.Destroy(); - prim = null; - primbottom = null; - primtop = null; + step = null; help = null; } - + + + + if(primbottom != null) + { + + bottompanel.SendingElevator -= SendingElevator; + bottompanel.Destroy(primbottom.Transform); + primbottom = null; + } + + if(primtop != null) + { + toppanel.SendingElevator -= SendingElevator; + toppanel.Destroy(primtop.Transform); + + primtop = null; + } + + + } private static bool isMoving = false; From 21dc433ae50a39eb83492b6f161a457b59ef8dc4 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Thu, 26 Feb 2026 16:43:42 +0100 Subject: [PATCH 678/853] fix craft --- KruacentExiled/KE.CustomRoles/CR/SCP/SCP173/Frozen.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/KruacentExiled/KE.CustomRoles/CR/SCP/SCP173/Frozen.cs b/KruacentExiled/KE.CustomRoles/CR/SCP/SCP173/Frozen.cs index 069c29e6..6ed45eec 100644 --- a/KruacentExiled/KE.CustomRoles/CR/SCP/SCP173/Frozen.cs +++ b/KruacentExiled/KE.CustomRoles/CR/SCP/SCP173/Frozen.cs @@ -75,6 +75,8 @@ protected override void UnsubscribeEvents() private void OnDeath(PlayerDeathEventArgs ev) { Player player = ev.Player; + + if (player == null || player.ReferenceHub == null) return; if (!Check(ev.Attacker)) return; From 4a69349a58b58c73de7ad023c996893373602ddc Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Thu, 26 Feb 2026 16:50:45 +0100 Subject: [PATCH 679/853] fix nul lexpcetio --- .../KE.CustomRoles/CR/CustomSCPs/SCP049C/RagdollArrowComp.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP049C/RagdollArrowComp.cs b/KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP049C/RagdollArrowComp.cs index 194d082b..a2c88fc3 100644 --- a/KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP049C/RagdollArrowComp.cs +++ b/KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP049C/RagdollArrowComp.cs @@ -38,7 +38,7 @@ private void Update() private void OnDestroy() { - arrow.Destroy(); + arrow?.Destroy(); } public void SetColor(Color color) From cd4ef78c2d73f947024a8e8d3deef1ccff6b8dfa Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Thu, 26 Feb 2026 16:56:35 +0100 Subject: [PATCH 680/853] fix door stuc knull --- .../KE.Map/Others/BlackoutNDoor/DoorStuck.cs | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/KruacentExiled/KE.Map/Others/BlackoutNDoor/DoorStuck.cs b/KruacentExiled/KE.Map/Others/BlackoutNDoor/DoorStuck.cs index 9a84f45e..ccc5a66f 100644 --- a/KruacentExiled/KE.Map/Others/BlackoutNDoor/DoorStuck.cs +++ b/KruacentExiled/KE.Map/Others/BlackoutNDoor/DoorStuck.cs @@ -5,6 +5,7 @@ using KE.Map.Others.BlackoutNDoor.Events.Handlers; using KE.Map.Others.BlackoutNDoor.Handlers; using KE.Utils.API.Map; +using NorthwoodLib.Pools; using System; using System.Collections.Generic; using System.Linq; @@ -15,7 +16,7 @@ namespace KE.Map.Others.BlackoutNDoor public class DoorStuck : MapEvent { - private static HashSet doors = new(); + private static HashSet doors; public override string Cassie => MainPlugin.Translations.Doorstuck; public override string CassieTranslated => MainPlugin.Translations.DoorstuckTranslation; @@ -24,8 +25,8 @@ public class DoorStuck : MapEvent public override void Start(ZoneType zone) { bool open = UnityEngine.Random.value > .5f; - doors = new(); - foreach (Door door in Door.List.Where(d => d.Zone == zone && !d.IsElevator && d.Type != DoorType.Scp079First && d.Type != DoorType.Scp079Second)) + doors = HashSetPool.Shared.Rent(); + foreach (Door door in Door.List.Where(d => d != null&& d.Zone == zone && !d.IsElevator && d.Type != DoorType.Scp079First && d.Type != DoorType.Scp079Second)) { if (door.DoorLockType == DoorLockType.None) { @@ -39,7 +40,7 @@ public override void Start(ZoneType zone) foreach(DoorVariant doorVariant in addDoors) { Door door2 = Door.Get(doorVariant); - if (door2.DoorLockType == DoorLockType.None) + if (door2 != null && door2.DoorLockType == DoorLockType.None) { doors.Add(door2); } @@ -49,7 +50,7 @@ public override void Start(ZoneType zone) DoorStuckEventArgs ev = new(doors,zone,true); DoorStuckHandler.OnDoorStucking(ev); - if (ev.IsAllowed) + if (ev.IsAllowed && ev.Doors != null) { doors = ev.Doors; foreach (Door door in doors) @@ -80,7 +81,9 @@ public override void Stop(ZoneType zone) door.ChangeLock(DoorLockType.None); } - + + HashSetPool.Shared.Return(doors); + } } } From 7f2c29784231f930eaf6717086e6d36b3e8794d2 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Thu, 26 Feb 2026 17:00:53 +0100 Subject: [PATCH 681/853] rename --- KruacentExiled/KE.Items/Items/{LS => LeSoleil}/LeSoleil.cs | 0 KruacentExiled/KE.Items/Items/{LS => LeSoleil}/SoleilComp.cs | 2 +- 2 files changed, 1 insertion(+), 1 deletion(-) rename KruacentExiled/KE.Items/Items/{LS => LeSoleil}/LeSoleil.cs (100%) rename KruacentExiled/KE.Items/Items/{LS => LeSoleil}/SoleilComp.cs (97%) diff --git a/KruacentExiled/KE.Items/Items/LS/LeSoleil.cs b/KruacentExiled/KE.Items/Items/LeSoleil/LeSoleil.cs similarity index 100% rename from KruacentExiled/KE.Items/Items/LS/LeSoleil.cs rename to KruacentExiled/KE.Items/Items/LeSoleil/LeSoleil.cs diff --git a/KruacentExiled/KE.Items/Items/LS/SoleilComp.cs b/KruacentExiled/KE.Items/Items/LeSoleil/SoleilComp.cs similarity index 97% rename from KruacentExiled/KE.Items/Items/LS/SoleilComp.cs rename to KruacentExiled/KE.Items/Items/LeSoleil/SoleilComp.cs index 90e856f4..6497c9dd 100644 --- a/KruacentExiled/KE.Items/Items/LS/SoleilComp.cs +++ b/KruacentExiled/KE.Items/Items/LeSoleil/SoleilComp.cs @@ -36,7 +36,7 @@ public void Init(Primitive prim) Sun.Collidable = false; Light l = Light.Create(@base.Position, null, null, false); - l.LightType = LightType.Directional; + l.LightType = LightType.Directional; // not a good idea l.Color = Color.yellow; l.Intensity = 10; l.Rotation = Quaternion.Euler(135, 0, 0); From d1319be54f001f3d5681bb447127f2fa8b27c8d2 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Thu, 26 Feb 2026 17:24:08 +0100 Subject: [PATCH 682/853] black out stop tesla --- .../KE.Map/Others/BlackoutNDoor/Blackout.cs | 21 ++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/KruacentExiled/KE.Map/Others/BlackoutNDoor/Blackout.cs b/KruacentExiled/KE.Map/Others/BlackoutNDoor/Blackout.cs index ff985780..a1b1d2ea 100644 --- a/KruacentExiled/KE.Map/Others/BlackoutNDoor/Blackout.cs +++ b/KruacentExiled/KE.Map/Others/BlackoutNDoor/Blackout.cs @@ -1,6 +1,8 @@ using Exiled.API.Enums; +using Exiled.API.Extensions; using Exiled.API.Features; using Exiled.API.Features.Doors; +using Exiled.Events.EventArgs.Player; using KE.Map.Others.BlackoutNDoor.Handlers; using System; using System.Collections.Generic; @@ -14,20 +16,37 @@ public class Blackout : MapEvent public override string CassieTranslated => MainPlugin.Translations.BlackoutTranslation; public override float Duration => 30; + + private ZoneType currentZone = ZoneType.Unspecified; public override void Start(ZoneType zone) { - foreach(Room room in Room.List.Where(r => r.Zone == zone)) + currentZone = zone; + foreach (Room room in Room.List.Where(r => r.Zone == zone)) { room.TurnOffLights(); } + + Exiled.Events.Handlers.Player.TriggeringTesla += OnTriggeringTesla; + } + + private void OnTriggeringTesla(TriggeringTeslaEventArgs ev) + { + if (ev.Tesla.Room.Zone.HasFlagFast(currentZone)) + { + ev.IsAllowed = false; + } + } public override void Stop(ZoneType zone) { + + Exiled.Events.Handlers.Player.TriggeringTesla -= OnTriggeringTesla; foreach (Room room in Room.List.Where(r => r.Zone == zone)) { room.AreLightsOff = false; } + currentZone = ZoneType.Unspecified; } From 96b1b6a53b48bb78a87768e219a266b9231aecbd Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Thu, 26 Feb 2026 17:28:34 +0100 Subject: [PATCH 683/853] pools --- KruacentExiled/KE.Items/Items/MScan.cs | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/KruacentExiled/KE.Items/Items/MScan.cs b/KruacentExiled/KE.Items/Items/MScan.cs index 2b6bc6d2..cbc57c50 100644 --- a/KruacentExiled/KE.Items/Items/MScan.cs +++ b/KruacentExiled/KE.Items/Items/MScan.cs @@ -2,6 +2,7 @@ using Exiled.API.Features; using Exiled.API.Features.Attributes; using Exiled.API.Features.Pickups; +using Exiled.API.Features.Pools; using Exiled.API.Features.Spawn; using Exiled.CustomItems.API.Features; using Exiled.Events.EventArgs.Player; @@ -11,7 +12,6 @@ using Exiled.Events.EventArgs.Scp939; using KE.Items.API.Features; using MEC; -using NorthwoodLib.Pools; using System.Collections.Generic; using UnityEngine; @@ -48,7 +48,7 @@ public class MScan : KECustomItem }, }; - private Dictionary ActiveSensors + private Dictionary ActiveSensors; private Dictionary Cooldowns = new Dictionary(); private Dictionary BatteryLife = new Dictionary(); @@ -58,7 +58,8 @@ private Dictionary ActiveSensors protected override void SubscribeEvents() { - ActiveSensors = new Dictionary(); + + ActiveSensors = DictionaryPool.Pool.Get(); Exiled.Events.Handlers.Player.Shot += OnShot; Exiled.Events.Handlers.Player.DroppedItem += OnDroppedItem; @@ -82,7 +83,7 @@ protected override void UnsubscribeEvents() Exiled.Events.Handlers.Scp096.Enraging -= OnSCP096Enraging; Timing.KillCoroutines(SensorRoutine); - ActiveSensors.Clear(); + DictionaryPool.Pool.Return(ActiveSensors); base.UnsubscribeEvents(); } @@ -144,7 +145,7 @@ private void OnShot(ShotEventArgs ev) private void CheckDestruction(Vector3 hitPos, float radius) { - List toDestroy = ListPool.Shared.Rent(); + List toDestroy = ListPool.Pool.Get(); foreach (var kvp in ActiveSensors) { @@ -166,14 +167,14 @@ private void CheckDestruction(Vector3 hitPos, float radius) p.Destroy(); } - ListPool.Shared.Return(toDestroy); + ListPool.Pool.Return(toDestroy); } private void CheckBattery() { - List invalid = ListPool.Shared.Rent(); + List invalid = ListPool.Pool.Get(); foreach (var key in ActiveSensors.Keys) { if (BatteryLife.ContainsKey(key) && Time.time > BatteryLife[key]) @@ -190,7 +191,7 @@ private void CheckBattery() BatteryLife.Remove(i); if (!i.IsSpawned) i.Destroy(); } - ListPool.Shared.Return(invalid); + ListPool.Pool.Return(invalid); } private IEnumerator MotionDetector() From c5976a86169fcd13027e4833a1eb3f1399622381 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Thu, 26 Feb 2026 17:31:37 +0100 Subject: [PATCH 684/853] frozen fix --- KruacentExiled/KE.CustomRoles/CR/SCP/SCP173/Frozen.cs | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/KruacentExiled/KE.CustomRoles/CR/SCP/SCP173/Frozen.cs b/KruacentExiled/KE.CustomRoles/CR/SCP/SCP173/Frozen.cs index 6ed45eec..bb1d67ab 100644 --- a/KruacentExiled/KE.CustomRoles/CR/SCP/SCP173/Frozen.cs +++ b/KruacentExiled/KE.CustomRoles/CR/SCP/SCP173/Frozen.cs @@ -1,9 +1,5 @@ -using CustomPlayerEffects; -using Exiled.API.Features; -using Exiled.API.Features.Items; -using Exiled.API.Features.Pickups; +using Exiled.API.Features.Items; using InventorySystem.Items.Usables.Scp244; -using InventorySystem.Items.Usables.Scp244.Hypothermia; using KE.CustomRoles.API.Features; using KE.CustomRoles.API.Interfaces; using LabApi.Events.Arguments.PlayerEvents; @@ -16,7 +12,7 @@ using System.Linq; using UnityEngine; using Item = Exiled.API.Features.Items.Item; -using Player = LabApi.Features.Wrappers.Player; +using Player = Exiled.API.Features.Player; using Scp244Pickup = Exiled.API.Features.Pickups.Scp244Pickup; namespace KE.CustomRoles.CR.SCP.SCP173 @@ -74,7 +70,7 @@ protected override void UnsubscribeEvents() private void OnDeath(PlayerDeathEventArgs ev) { - Player player = ev.Player; + Player player = Player.Get(ev.Player); if (player == null || player.ReferenceHub == null) return; if (!Check(ev.Attacker)) return; From 876c6064311735472b640037dd003e1c56ff5a1c Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Thu, 26 Feb 2026 17:43:30 +0100 Subject: [PATCH 685/853] fix fr this tie --- KruacentExiled/KE.CustomRoles/CR/SCP/SCP173/Frozen.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/KruacentExiled/KE.CustomRoles/CR/SCP/SCP173/Frozen.cs b/KruacentExiled/KE.CustomRoles/CR/SCP/SCP173/Frozen.cs index bb1d67ab..3d78a3ea 100644 --- a/KruacentExiled/KE.CustomRoles/CR/SCP/SCP173/Frozen.cs +++ b/KruacentExiled/KE.CustomRoles/CR/SCP/SCP173/Frozen.cs @@ -70,16 +70,16 @@ protected override void UnsubscribeEvents() private void OnDeath(PlayerDeathEventArgs ev) { + if (ev.Player == null || ev.Player.ReferenceHub == null) return; + if (ev.Attacker == null || ev.Attacker.ReferenceHub == null) return; Player player = Player.Get(ev.Player); - if (player == null || player.ReferenceHub == null) return; if (!Check(ev.Attacker)) return; if (ev.DamageHandler is ScpDamageHandler scpDamageHandler) { Player attacker = Player.Get(scpDamageHandler.Attacker.Hub); - if (Check(attacker)) { From b95a39cd4b1f407dfd81f747bf1f79111dc0029f Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Thu, 26 Feb 2026 18:11:11 +0100 Subject: [PATCH 686/853] disable the voice changing of the russe --- .../CR/ChaosInsurgency/LeRusse.cs | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/KruacentExiled/KE.CustomRoles/CR/ChaosInsurgency/LeRusse.cs b/KruacentExiled/KE.CustomRoles/CR/ChaosInsurgency/LeRusse.cs index 4f0167c2..3a5a6904 100644 --- a/KruacentExiled/KE.CustomRoles/CR/ChaosInsurgency/LeRusse.cs +++ b/KruacentExiled/KE.CustomRoles/CR/ChaosInsurgency/LeRusse.cs @@ -69,22 +69,21 @@ protected override Dictionary> SetTranslation protected override void RoleAdded(Player player) { - Exiled.Events.Handlers.Player.VoiceChatting += OnVoiceChatting; - Exiled.Events.Handlers.Player.Hurting += OnDealingDamage; - - _playerDamage[player] = 0f; + /*Exiled.Events.Handlers.Player.VoiceChatting += OnVoiceChatting; _filterMems[player] = 0f; - SetupSpeaker(player); + SetupSpeaker(player);*/ + _playerDamage[player] = 0f; + Exiled.Events.Handlers.Player.Hurting += OnDealingDamage; } protected override void RoleRemoved(Player player) { - Exiled.Events.Handlers.Player.VoiceChatting -= OnVoiceChatting; - Exiled.Events.Handlers.Player.Hurting -= OnDealingDamage; - + /*Exiled.Events.Handlers.Player.VoiceChatting -= OnVoiceChatting; DestroySpeaker(player); + _filterMems.Remove(player);*/ + + Exiled.Events.Handlers.Player.Hurting -= OnDealingDamage; _playerDamage.Remove(player); - _filterMems.Remove(player); } private void OnDealingDamage(HurtingEventArgs ev) From 74c7689d37b0c251e1788a3088d2d2453910f225 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Thu, 26 Feb 2026 20:23:56 +0100 Subject: [PATCH 687/853] redmist --- .../Abilities/RedMist/ForwardSlash.cs | 80 +++++++++++++++++ .../Abilities/RedMist/ToggleEGO.cs | 4 +- .../KE.CustomRoles/CR/MTF/RedMist.cs | 47 ---------- .../{Abilities => CR/MTF}/RedMist/EGO.cs | 29 +++--- .../KE.CustomRoles/CR/MTF/RedMist/RedMist.cs | 90 +++++++++++++++++++ .../KE.CustomRoles/KE.CustomRoles.csproj | 1 + 6 files changed, 183 insertions(+), 68 deletions(-) create mode 100644 KruacentExiled/KE.CustomRoles/Abilities/RedMist/ForwardSlash.cs delete mode 100644 KruacentExiled/KE.CustomRoles/CR/MTF/RedMist.cs rename KruacentExiled/KE.CustomRoles/{Abilities => CR/MTF}/RedMist/EGO.cs (62%) create mode 100644 KruacentExiled/KE.CustomRoles/CR/MTF/RedMist/RedMist.cs diff --git a/KruacentExiled/KE.CustomRoles/Abilities/RedMist/ForwardSlash.cs b/KruacentExiled/KE.CustomRoles/Abilities/RedMist/ForwardSlash.cs new file mode 100644 index 00000000..53a46179 --- /dev/null +++ b/KruacentExiled/KE.CustomRoles/Abilities/RedMist/ForwardSlash.cs @@ -0,0 +1,80 @@ +using Exiled.API.Features; +using KE.CustomRoles.API.Features; +using System.Collections.Generic; +using UnityEngine; +using PlayerRoles.FirstPersonControl.Thirdperson; +using PlayerRoles; +using Exiled.API.Features.Roles; +using Exiled.API.Features.Toys; +using Exiled.API.Enums; +using KE.CustomRoles.CR.MTF.RedMist; +namespace KE.CustomRoles.Abilities.RedMist +{ + public class ForwardSlash : KEAbilities + { + public override string Name { get; } = "ForwardSlash"; + protected override Dictionary> SetTranslation() + { + return new() + { + ["en"] = new() + { + [TranslationKeyName] = "Forward Slash", + [TranslationKeyDesc] = "Manifest your E.G.O, gain powerful buff but rapid health drain.\nCan be deactivated anytime", + ["ForwardSlashFailEGO"] = "You need to manifest your E.G.O. first", + ["ForwardSlashFailWeapon"] = "You need to manifest your E.G.O. first", + }, + ["fr"] = new() + { + [TranslationKeyName] = "todo", + [TranslationKeyDesc] = "todo", + } + }; + } + public override float Cooldown { get; } = 0f; + + + public const float MaxDistance = 15; + + protected override bool AbilityUsed(Player player) + { + + + if (!player.GameObject.TryGetComponent(out var ego)) + { + ego = player.GameObject.AddComponent(); + } + + + + if (!ego.Active) + { + //show ForwardSlashFailEGO + return false; + } + + + if(player.CurrentItem.Type != ItemType.SCP1509) + { + //show ForwardSlashFailWeapon + return false; + } + + Vector3 forward = player.Transform.forward; + + if(Physics.Raycast(player.Position, forward,out RaycastHit hit, MaxDistance, (int)~LayerMasks.Hitbox)) + { + if(Physics.Linecast(player.Position, hit.point,out RaycastHit hitPlayer,(int)LayerMasks.Hitbox)) + { + + } + } + + + + return base.AbilityUsed(player); + } + + + } +} diff --git a/KruacentExiled/KE.CustomRoles/Abilities/RedMist/ToggleEGO.cs b/KruacentExiled/KE.CustomRoles/Abilities/RedMist/ToggleEGO.cs index 3d0994a5..235454dc 100644 --- a/KruacentExiled/KE.CustomRoles/Abilities/RedMist/ToggleEGO.cs +++ b/KruacentExiled/KE.CustomRoles/Abilities/RedMist/ToggleEGO.cs @@ -5,7 +5,7 @@ using System.Linq; using System.Text; using System.Threading.Tasks; - +using KE.CustomRoles.CR.MTF.RedMist; namespace KE.CustomRoles.Abilities.RedMist { public class ToggleEGO : KEAbilities @@ -35,7 +35,7 @@ protected override bool AbilityUsed(Player player) { if(!player.GameObject.TryGetComponent(out var ego)) { - player.GameObject.AddComponent(); + ego= player.GameObject.AddComponent(); } ego.ToggleActive(); diff --git a/KruacentExiled/KE.CustomRoles/CR/MTF/RedMist.cs b/KruacentExiled/KE.CustomRoles/CR/MTF/RedMist.cs deleted file mode 100644 index e61d73b2..00000000 --- a/KruacentExiled/KE.CustomRoles/CR/MTF/RedMist.cs +++ /dev/null @@ -1,47 +0,0 @@ -/*using Exiled.API.Enums; -using Exiled.API.Features; -using Exiled.Events.EventArgs.Player; -using KE.CustomRoles.API.Features; -using KE.CustomRoles.API.Interfaces; -using MEC; -using PlayerRoles; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using UnityEngine; - -namespace KE.CustomRoles.CR.MTF -{ - public class RedMist : KECustomRole, IColor - { - public override string Description { get; set; } = "Tu es débuff mais ta force de tir est démultiplié (fais attention à tes balles)"; - public override string PublicName { get; set; } = "RedMist"; - public override int MaxHealth { get; set; } = 175; - public override RoleTypeId Role { get; set; } = RoleTypeId.NtfSergeant; - public override bool KeepRoleOnDeath { get; set; } = false; - public override bool KeepRoleOnChangingRole { get; set; } = false; - public Color32 Color => new(255, 192, 203, 0); - public override float SpawnChance { get; set; } = 100; - - protected override void GiveInventory(Player player) - { - - } - - protected override void SubscribeEvents() - { - - base.SubscribeEvents(); - } - - protected override void UnsubscribeEvents() - { - - base.UnsubscribeEvents(); - } - - } -} -*/ \ No newline at end of file diff --git a/KruacentExiled/KE.CustomRoles/Abilities/RedMist/EGO.cs b/KruacentExiled/KE.CustomRoles/CR/MTF/RedMist/EGO.cs similarity index 62% rename from KruacentExiled/KE.CustomRoles/Abilities/RedMist/EGO.cs rename to KruacentExiled/KE.CustomRoles/CR/MTF/RedMist/EGO.cs index 757f8c17..92d60ea4 100644 --- a/KruacentExiled/KE.CustomRoles/Abilities/RedMist/EGO.cs +++ b/KruacentExiled/KE.CustomRoles/CR/MTF/RedMist/EGO.cs @@ -9,15 +9,15 @@ using System.Threading.Tasks; using UnityEngine; -namespace KE.CustomRoles.Abilities.RedMist +namespace KE.CustomRoles.CR.MTF.RedMist { public class EGO : MonoBehaviour { - private bool active = false; - + public bool Active { get; set; } + private ReferenceHub Hub; @@ -25,22 +25,22 @@ public class EGO : MonoBehaviour private float Damage = 1; - public void Init() + public void Awake() { - active = false; - Hub = ReferenceHub.GetHub(base.transform.root.gameObject); + Active = false; + Hub = ReferenceHub.GetHub(base.gameObject); } - public void Update() { if (Hub is null || !Hub.IsAlive()) { Log.Debug(Hub?.nicknameSync.DisplayName +" is dead"); - Destroy(gameObject); + Destroy(this); + return; } - if (active) + if (Active) { Hub.playerStats.DealDamage(new CustomDamageHandler(Player.Get(Hub), null, Damage)); } @@ -48,18 +48,9 @@ public void Update() } - public void SetActive(bool active) - { - this.active = active; - } - public bool IsActive() - { - return active; - } - public void ToggleActive() { - active = !active; + Active = !Active; } } } diff --git a/KruacentExiled/KE.CustomRoles/CR/MTF/RedMist/RedMist.cs b/KruacentExiled/KE.CustomRoles/CR/MTF/RedMist/RedMist.cs new file mode 100644 index 00000000..a80634dd --- /dev/null +++ b/KruacentExiled/KE.CustomRoles/CR/MTF/RedMist/RedMist.cs @@ -0,0 +1,90 @@ +using Exiled.API.Enums; +using Exiled.API.Features; +using Exiled.Events.EventArgs.Player; +using KE.CustomRoles.Abilities.RedMist; +using KE.CustomRoles.API.Features; +using KE.CustomRoles.API.Interfaces; +using MEC; +using PlayerRoles; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using UnityEngine; + +namespace KE.CustomRoles.CR.MTF.RedMist +{ + public class RedMistRole : KECustomRole, IColor + { + public override string InternalName => "RedMist"; + protected override Dictionary> SetTranslation() + { + return new() + { + ["en"] = new() + { + [TranslationKeyName] = "Red Mist", + [TranslationKeyDesc] = " ", + }, + ["fr"] = new() + { + [TranslationKeyName] = "Red Mist", + [TranslationKeyDesc] = " ", + }, + ["legacy"] = new() + { + [TranslationKeyName] = "Red Mist", + [TranslationKeyDesc] = " ", + } + }; + } + public override int MaxHealth { get; set; } = 200; + public override RoleTypeId Role { get; set; } = RoleTypeId.NtfSergeant; + public override bool KeepRoleOnDeath { get; set; } = false; + public override bool KeepRoleOnChangingRole { get; set; } = false; + public Color32 Color => new(255, 192, 203, 0); + public override float SpawnChance { get; set; } = 0; + + //You're the legendary Fixer, the Red Mist. This role comes with multiple strengths such as increased speed (1.5 to 2 times the normal speed ) , more health (200 health), you spawn with a machete scp but better, The Mimicry also you can't use guns. + //The Mimicry is a weapon that deals 100 damage per normal attacks and instead of inspecting you do a devastating vertical slash (30sec cd) doing 400 damage. + //You have 2 abilities one is to manifest your E.G.O, an armor that boosts your abilities but drains your health over time if you don't do damage (you have life steal). + //The second one is only useable when you manifested your E.G.O, and horizontal slash doing 600 damage and hitting everyone in the room (60sec cd) + //If you let people on your team die you get weaker, you are a protector afterall. + + //faster, 200hp, machete mais 200 hp de dégats (75 pour les humains) + //shield belt + //ego : quick heal drain pause when attacking, 80 damage reduction faster + //forward slash : remove 25hp max to a min of 25hp, damage everything on its path max distance of a room + + public override HashSet Abilities { get; } = + [ + "ToggleEGO", + "ForwardSlash", + ]; + + protected override void GiveInventory(Player player) + { + + } + + protected override void RoleAdded(Player player) + { + player.GameObject.GetComponent(); + base.RoleAdded(player); + } + + protected override void SubscribeEvents() + { + + base.SubscribeEvents(); + } + + protected override void UnsubscribeEvents() + { + + base.UnsubscribeEvents(); + } + + } +} diff --git a/KruacentExiled/KE.CustomRoles/KE.CustomRoles.csproj b/KruacentExiled/KE.CustomRoles/KE.CustomRoles.csproj index d2477105..da36960a 100644 --- a/KruacentExiled/KE.CustomRoles/KE.CustomRoles.csproj +++ b/KruacentExiled/KE.CustomRoles/KE.CustomRoles.csproj @@ -17,6 +17,7 @@ + From 3e232d21d416b77425cabd1db1905afc90d0e9ff Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Fri, 27 Feb 2026 11:19:56 +0100 Subject: [PATCH 688/853] gave russe a keycard --- KruacentExiled/KE.CustomRoles/CR/ChaosInsurgency/LeRusse.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/KruacentExiled/KE.CustomRoles/CR/ChaosInsurgency/LeRusse.cs b/KruacentExiled/KE.CustomRoles/CR/ChaosInsurgency/LeRusse.cs index 3a5a6904..e317f964 100644 --- a/KruacentExiled/KE.CustomRoles/CR/ChaosInsurgency/LeRusse.cs +++ b/KruacentExiled/KE.CustomRoles/CR/ChaosInsurgency/LeRusse.cs @@ -59,7 +59,8 @@ protected override Dictionary> SetTranslation public override List Inventory { get; set; } = new() { $"{ItemType.GunRevolver}", $"{ItemType.GunA7}", $"{ItemType.ArmorHeavy}", - $"{ItemType.GrenadeHE}", $"{ItemType.GrenadeFlash}", $"{ItemType.Radio}" + $"{ItemType.GrenadeHE}", $"{ItemType.GrenadeFlash}", $"{ItemType.Radio}", + $"{ItemType.KeycardChaosInsurgency}" }; public override Dictionary Ammo { get; set; } = new() From 9bfffa1abac4d9061266ee845ef9e49a9a9de51c Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Fri, 27 Feb 2026 11:24:29 +0100 Subject: [PATCH 689/853] fix shield belt not destroying the primitive --- KruacentExiled/KE.Items/Items/ShieldBelt/ShieldBeltStat.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/KruacentExiled/KE.Items/Items/ShieldBelt/ShieldBeltStat.cs b/KruacentExiled/KE.Items/Items/ShieldBelt/ShieldBeltStat.cs index 46491ed4..b3cf4653 100644 --- a/KruacentExiled/KE.Items/Items/ShieldBelt/ShieldBeltStat.cs +++ b/KruacentExiled/KE.Items/Items/ShieldBelt/ShieldBeltStat.cs @@ -165,9 +165,13 @@ public void Awake() public void Destroy() { Log.Debug($"destroying {this}"); + Destroy(this); + } + + private void OnDestroy() + { primitive.Destroy(); primitive = null; - Destroy(this); } public void Update() From fb8a05222e5def62ac71e13c412760303c2b0ed4 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Fri, 27 Feb 2026 11:31:28 +0100 Subject: [PATCH 690/853] reduce cooldown last human --- .../Features/LastHuman/LastHumanHandler.cs | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/KruacentExiled/KE.Misc/Features/LastHuman/LastHumanHandler.cs b/KruacentExiled/KE.Misc/Features/LastHuman/LastHumanHandler.cs index 65a0d74f..4f479df1 100644 --- a/KruacentExiled/KE.Misc/Features/LastHuman/LastHumanHandler.cs +++ b/KruacentExiled/KE.Misc/Features/LastHuman/LastHumanHandler.cs @@ -41,7 +41,7 @@ public class LastHumanHandler : IUsingEvents public static HintPosition position = new LastHumanPosition(); private DateTime _nextPossibleHint; - public static readonly TimeSpan Cooldown = TimeSpan.FromSeconds(20); + public static readonly TimeSpan Cooldown = TimeSpan.FromSeconds(5); public void SubscribeEvents() { LabApi.Events.Handlers.PlayerEvents.ChangedRole += OnChangedRole; @@ -99,7 +99,7 @@ private void OnChangedRole(PlayerChangedRoleEventArgs ev) - if (!player.IsDead && DateTime.Now > _nextPossibleHint) + if (!player.IsDead && DateTime.Now >= _nextPossibleHint) { DisplayHandler.Instance.AddHint(position.HintPlacement, player, msg, 10); KELog.Debug("show message to " + lastTarget.Nickname); @@ -123,27 +123,27 @@ private void OnChangedRole(PlayerChangedRoleEventArgs ev) private static bool TryGetLastTarget(out Player lastTarget) { lastTarget = null; - int num = 0; - int num2 = 0; + int numberHuman = 0; + int numberSCP = 0; foreach (ReferenceHub allHub in ReferenceHub.AllHubs) { KELog.Debug(allHub.nicknameSync.DisplayName); if (allHub.IsHuman() && !SCPTeam.IsSCP(allHub)) { - num++; + numberHuman++; lastTarget = Player.Get(allHub); } else if (SCPTeam.IsSCP(allHub)) { - num2++; + numberSCP++; } } - if (num == 1) + if (numberHuman == 1) { - return num2 > 0; + return numberSCP > 0; } return false; } From 6745083b2ea7a49c39561370a26701affdb0f28c Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Fri, 27 Feb 2026 11:59:35 +0100 Subject: [PATCH 691/853] rollback the elevators --- .../ElevatorGateA/CustomElevatorGateA.cs | 10 ++++- .../ElevatorGateA/CustomKillerCollision.cs | 40 ++++++++----------- 2 files changed, 25 insertions(+), 25 deletions(-) diff --git a/KruacentExiled/KE.Map/Surface/ElevatorGateA/CustomElevatorGateA.cs b/KruacentExiled/KE.Map/Surface/ElevatorGateA/CustomElevatorGateA.cs index a6b9b8db..b833f4db 100644 --- a/KruacentExiled/KE.Map/Surface/ElevatorGateA/CustomElevatorGateA.cs +++ b/KruacentExiled/KE.Map/Surface/ElevatorGateA/CustomElevatorGateA.cs @@ -29,6 +29,7 @@ public static class CustomElevatorGateA private static Primitive primtop; private static Panel bottompanel; private static Primitive primbottom; + private static Primitive helpPlatform; private const float Scale = 0.8f; public static void Create() @@ -103,6 +104,10 @@ private static void CreatePrimitives() help.Flags = AdminToys.PrimitiveFlags.Visible; help.Spawn(); help.GameObject.AddComponent(); + + helpPlatform = Primitive.Create(PrimitiveType.Cube, helppos, null, new Vector3(50, 1, 50), false); + helpPlatform.Flags = AdminToys.PrimitiveFlags.Visible | AdminToys.PrimitiveFlags.Collidable; + helpPlatform.Spawn(); } private static void SendingElevator() @@ -120,9 +125,10 @@ public static void Destroy() step.Destroy(); help.Destroy(); - + helpPlatform.Destroy(); step = null; help = null; + helpPlatform = null; } @@ -145,6 +151,8 @@ public static void Destroy() + + } private static bool isMoving = false; diff --git a/KruacentExiled/KE.Map/Surface/ElevatorGateA/CustomKillerCollision.cs b/KruacentExiled/KE.Map/Surface/ElevatorGateA/CustomKillerCollision.cs index 0a6b96fb..f44403ab 100644 --- a/KruacentExiled/KE.Map/Surface/ElevatorGateA/CustomKillerCollision.cs +++ b/KruacentExiled/KE.Map/Surface/ElevatorGateA/CustomKillerCollision.cs @@ -1,4 +1,5 @@ using CustomPlayerEffects; +using Exiled.API.Enums; using Exiled.API.Features; using ProjectMER.Commands.Modifying.Scale; using System; @@ -14,40 +15,31 @@ namespace KE.Map.Surface.ElevatorGateA public class CustomKillerCollision : MonoBehaviour { + private Collider[] NonAlloc = new Collider[8]; + + private void Update() { - foreach(Player player in Player.List) + if(Physics.OverlapBoxNonAlloc(base.transform.localPosition, base.transform.localScale / 2f, NonAlloc, transform.localRotation, (int)LayerMasks.Hitbox) > 0) { - - if (PitDeath.ValidatePlayer(player.ReferenceHub)) + for (int i = 0; i < NonAlloc.Length; i++) { - if (InBound(player)) + if(Player.TryGet(NonAlloc[i],out Player player)) { - PitDeath pit = player.GetEffect(); - pit.KillPlayer(); - + if (PitDeath.ValidatePlayer(player.ReferenceHub)) + { + PitDeath pit = player.GetEffect(); + //DO NOT USE PitDeath.KillPlayer() + if (!pit.IsEnabled) + { + pit.IsEnabled = true; + } + } } } } - } - - private void OnTriggerEnter() - { - - } - private bool InBound(Player player) - { - Vector3 position = transform.position; - Vector3 playerPosition = player.Position; - Vector3 halfSize = transform.lossyScale / 2; - return playerPosition.x >= position.x - halfSize.x && - playerPosition.x <= position.x + halfSize.x && - playerPosition.y >= position.y - halfSize.y && - playerPosition.y <= position.y + halfSize.y && - playerPosition.z >= position.z - halfSize.z && - playerPosition.z <= position.z + halfSize.z; } } From ff027394b92e5da737399f57fb4008076390a9fa Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Fri, 27 Feb 2026 12:59:26 +0100 Subject: [PATCH 692/853] update + added async start and INonRedatable to KEE --- .../GE/Blitz.cs | 2 +- .../GE/ChangedItemEffect.cs | 4 +-- .../GE/Impostor.cs | 2 +- .../GE/ItemRain.cs | 2 +- .../GE/KIWIS.cs | 2 +- .../GE/Librarby.cs | 2 +- .../GE/OpenBar.cs | 4 +-- .../GE/RandomSpawn.cs | 3 +- .../GE/Rollback.cs | 4 +-- .../GE/Shuffle.cs | 2 +- .../GE/Speed.cs | 2 +- .../GE/SwapProtocol.cs | 2 +- .../GE/SystemMalfunction.cs | 2 +- .../KE.GlobalEventFramework.Examples.csproj | 2 +- .../MiddleEvents/HealSCP.cs | 3 +- .../MiddleEvents/ShufflePosition.cs | 4 +-- .../MiddleEvents/Speed.cs | 2 +- .../MiddleEvents/WallHack.cs | 2 +- .../API/Extensions/ImpactLevelExtension.cs | 12 +++---- .../GEFE/API/Features/GlobalEvent.cs | 31 +++++++++---------- .../GEFE/API/Features/KEEvents.cs | 12 +++++-- .../GEFE/API/Interfaces/IAsyncStart.cs | 16 ++++++++++ .../GEFE/API/Interfaces/IStart.cs | 2 +- .../KE.GlobalEventFramework.csproj | 2 +- 24 files changed, 68 insertions(+), 53 deletions(-) create mode 100644 KruacentExiled/KE.GlobalEventFramework/GEFE/API/Interfaces/IAsyncStart.cs diff --git a/KruacentExiled/KE.GlobalEventFramework.Examples/GE/Blitz.cs b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/Blitz.cs index e126525e..7bce0ac3 100644 --- a/KruacentExiled/KE.GlobalEventFramework.Examples/GE/Blitz.cs +++ b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/Blitz.cs @@ -11,7 +11,7 @@ namespace KE.GlobalEventFramework.Examples.GE /// /// Spawn fused grenades in random rooms in the map /// - public class Blitz : GlobalEvent, IStart + public class Blitz : GlobalEvent, IAsyncStart { /// public override uint Id { get; set; } = 1046; diff --git a/KruacentExiled/KE.GlobalEventFramework.Examples/GE/ChangedItemEffect.cs b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/ChangedItemEffect.cs index 52c8af45..a02ca242 100644 --- a/KruacentExiled/KE.GlobalEventFramework.Examples/GE/ChangedItemEffect.cs +++ b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/ChangedItemEffect.cs @@ -37,15 +37,13 @@ public class ChangedItemEffect : GlobalEvent,IStart ,IEvent public override ImpactLevel ImpactLevel => ImpactLevel.High; - public IEnumerator Start() + public void Start() { ChangeItemsEffect(); ChangeCandyEffect(); - - yield return 0; } private void ChangeItemsEffect() diff --git a/KruacentExiled/KE.GlobalEventFramework.Examples/GE/Impostor.cs b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/Impostor.cs index 11d78032..fe089416 100644 --- a/KruacentExiled/KE.GlobalEventFramework.Examples/GE/Impostor.cs +++ b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/Impostor.cs @@ -11,7 +11,7 @@ namespace KE.GlobalEventFramework.Examples.GE { - public class Impostor : GlobalEvent, IStart + public class Impostor : GlobalEvent, IAsyncStart { public override uint Id { get; set; } = 1044; public override string Name { get; set; } = "Impostor"; diff --git a/KruacentExiled/KE.GlobalEventFramework.Examples/GE/ItemRain.cs b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/ItemRain.cs index c6d842a5..d6bfe721 100644 --- a/KruacentExiled/KE.GlobalEventFramework.Examples/GE/ItemRain.cs +++ b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/ItemRain.cs @@ -11,7 +11,7 @@ namespace KE.GlobalEventFramework.Examples.GE /// /// Randomly item will fall from the sky /// - public class ItemRain : GlobalEvent, IStart + public class ItemRain : GlobalEvent, IAsyncStart { /// public override uint Id { get; set; } = 1090; diff --git a/KruacentExiled/KE.GlobalEventFramework.Examples/GE/KIWIS.cs b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/KIWIS.cs index 7d07249f..2d49406b 100644 --- a/KruacentExiled/KE.GlobalEventFramework.Examples/GE/KIWIS.cs +++ b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/KIWIS.cs @@ -14,7 +14,7 @@ namespace KE.GlobalEventFramework.Examples.GE /// /// The scp start with 2/3 of it's life and end with 4/3 of it's vanilla life /// - public class KIWIS : GlobalEvent,IStart + public class KIWIS : GlobalEvent, IAsyncStart { /// public override uint Id { get; set; } = 1047; diff --git a/KruacentExiled/KE.GlobalEventFramework.Examples/GE/Librarby.cs b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/Librarby.cs index cfc06b92..b6c99093 100644 --- a/KruacentExiled/KE.GlobalEventFramework.Examples/GE/Librarby.cs +++ b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/Librarby.cs @@ -16,7 +16,7 @@ namespace KE.GlobalEventFramework.Examples.GE /// /// You cannot talk to loud /// - public class Librarby : GlobalEvent, IEvent + public class Librarby : GlobalEvent, IEvent, INonRedactable { /// public override uint Id { get; set; } = 1091; diff --git a/KruacentExiled/KE.GlobalEventFramework.Examples/GE/OpenBar.cs b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/OpenBar.cs index e1dd33d5..1960cb0b 100644 --- a/KruacentExiled/KE.GlobalEventFramework.Examples/GE/OpenBar.cs +++ b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/OpenBar.cs @@ -36,7 +36,7 @@ public class OpenBar : GlobalEvent, IStart, IEvent private IEnumerable doorsLocked; - public IEnumerator Start() + public void Start() { List door = DoorsToMaybeUnlock.ToList(); List result = new(); @@ -51,8 +51,6 @@ public IEnumerator Start() UnlockAndOpen(doorsLocked); - - yield return 0; } private void UnlockAndOpen(IEnumerable doors) diff --git a/KruacentExiled/KE.GlobalEventFramework.Examples/GE/RandomSpawn.cs b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/RandomSpawn.cs index 30164551..793775b0 100644 --- a/KruacentExiled/KE.GlobalEventFramework.Examples/GE/RandomSpawn.cs +++ b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/RandomSpawn.cs @@ -32,7 +32,7 @@ public class RandomSpawn : GlobalEvent,IStart public override ImpactLevel ImpactLevel => ImpactLevel.High; public IEnumerable BlacklistedRooms { get; } = []; /// - public IEnumerator Start() + public void Start() { Room room; foreach (RoleTypeId r in Enum.GetValues(typeof(RoleTypeId))) @@ -49,7 +49,6 @@ public IEnumerator Start() } } - yield return 0; } } diff --git a/KruacentExiled/KE.GlobalEventFramework.Examples/GE/Rollback.cs b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/Rollback.cs index 7c376eae..996efd5b 100644 --- a/KruacentExiled/KE.GlobalEventFramework.Examples/GE/Rollback.cs +++ b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/Rollback.cs @@ -15,7 +15,7 @@ namespace KE.GlobalEventFramework.Examples.GE { - public class RollBack: GlobalEvent,IStart + public class RollBack: GlobalEvent, IAsyncStart { /// public override uint Id { get; set; } = 10800; @@ -40,7 +40,7 @@ public class RollBack: GlobalEvent,IStart public IEnumerator Start() { bool luck; - while (true) + while (base.IsActive) { yield return Timing.WaitForSeconds(RefreshRate); luck = Luck > Random.Range(0f,100f); diff --git a/KruacentExiled/KE.GlobalEventFramework.Examples/GE/Shuffle.cs b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/Shuffle.cs index d29075b0..38170f92 100644 --- a/KruacentExiled/KE.GlobalEventFramework.Examples/GE/Shuffle.cs +++ b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/Shuffle.cs @@ -15,7 +15,7 @@ namespace KE.GlobalEventFramework.Examples.GE /// /// Every some amount of time all player take the position of another /// - public class Shuffle : GlobalEvent, IStart,IEvent + public class Shuffle : GlobalEvent, IAsyncStart,IEvent { /// public override uint Id { get; set; } = 1045; diff --git a/KruacentExiled/KE.GlobalEventFramework.Examples/GE/Speed.cs b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/Speed.cs index 9a5baeba..6854c8db 100644 --- a/KruacentExiled/KE.GlobalEventFramework.Examples/GE/Speed.cs +++ b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/Speed.cs @@ -24,7 +24,7 @@ namespace KE.GlobalEventFramework.Examples.GE /// Everyone has a movement boost effect (stackable) /// Maybe inspired by Dr Bright's Mayhem /// - public class Speed : GlobalEvent,IStart,IEvent + public class Speed : GlobalEvent, IAsyncStart, IEvent { public override ImpactLevel ImpactLevel => ImpactLevel.VeryHigh; diff --git a/KruacentExiled/KE.GlobalEventFramework.Examples/GE/SwapProtocol.cs b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/SwapProtocol.cs index f74d89f9..eeb476fa 100644 --- a/KruacentExiled/KE.GlobalEventFramework.Examples/GE/SwapProtocol.cs +++ b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/SwapProtocol.cs @@ -17,7 +17,7 @@ namespace KE.GlobalEventFramework.Examples.GE { - public class SwapProtocol : GlobalEvent, IStart, IEvent + public class SwapProtocol : GlobalEvent, IAsyncStart, IEvent { public override uint Id { get; set; } = 1051; public override string Name { get; set; } = "SwapProtocol"; diff --git a/KruacentExiled/KE.GlobalEventFramework.Examples/GE/SystemMalfunction.cs b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/SystemMalfunction.cs index f8aa76d2..356b50c2 100644 --- a/KruacentExiled/KE.GlobalEventFramework.Examples/GE/SystemMalfunction.cs +++ b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/SystemMalfunction.cs @@ -21,7 +21,7 @@ namespace KE.GlobalEventFramework.Examples.GE /// Checkpoints can open randomly /// ///
- public class SystemMalfunction : GlobalEvent, IStart, IEvent + public class SystemMalfunction : GlobalEvent, IAsyncStart, IEvent { diff --git a/KruacentExiled/KE.GlobalEventFramework.Examples/KE.GlobalEventFramework.Examples.csproj b/KruacentExiled/KE.GlobalEventFramework.Examples/KE.GlobalEventFramework.Examples.csproj index 5d27ec6d..92f63b97 100644 --- a/KruacentExiled/KE.GlobalEventFramework.Examples/KE.GlobalEventFramework.Examples.csproj +++ b/KruacentExiled/KE.GlobalEventFramework.Examples/KE.GlobalEventFramework.Examples.csproj @@ -6,7 +6,7 @@ - + diff --git a/KruacentExiled/KE.GlobalEventFramework.Examples/MiddleEvents/HealSCP.cs b/KruacentExiled/KE.GlobalEventFramework.Examples/MiddleEvents/HealSCP.cs index 6517a72d..a41d76d0 100644 --- a/KruacentExiled/KE.GlobalEventFramework.Examples/MiddleEvents/HealSCP.cs +++ b/KruacentExiled/KE.GlobalEventFramework.Examples/MiddleEvents/HealSCP.cs @@ -41,14 +41,13 @@ public bool Condition() return true; } - public IEnumerator Start() + public void Start() { foreach (Player p in Player.List.Where(p => p.IsScp && p.Role != RoleTypeId.Scp0492)) { p.Health = p.MaxHealth / 2; } - yield return Timing.WaitForOneFrame; } diff --git a/KruacentExiled/KE.GlobalEventFramework.Examples/MiddleEvents/ShufflePosition.cs b/KruacentExiled/KE.GlobalEventFramework.Examples/MiddleEvents/ShufflePosition.cs index 2c713d26..94ec7357 100644 --- a/KruacentExiled/KE.GlobalEventFramework.Examples/MiddleEvents/ShufflePosition.cs +++ b/KruacentExiled/KE.GlobalEventFramework.Examples/MiddleEvents/ShufflePosition.cs @@ -26,7 +26,7 @@ public class ShufflePosition : MiddleEvent, IStart /// public override int WeightedChance { get; set; } = 1; - public IEnumerator Start() + public void Start() { @@ -47,8 +47,6 @@ public IEnumerator Start() { players[i].Teleport(positions[i]); } - - yield return Timing.WaitForOneFrame; } diff --git a/KruacentExiled/KE.GlobalEventFramework.Examples/MiddleEvents/Speed.cs b/KruacentExiled/KE.GlobalEventFramework.Examples/MiddleEvents/Speed.cs index a627282e..77aa71ae 100644 --- a/KruacentExiled/KE.GlobalEventFramework.Examples/MiddleEvents/Speed.cs +++ b/KruacentExiled/KE.GlobalEventFramework.Examples/MiddleEvents/Speed.cs @@ -14,7 +14,7 @@ namespace KE.GlobalEventFramework.Examples.MiddleEvents { - public class SpeedM : MiddleEvent, IStart, IEvent + public class SpeedM : MiddleEvent, IAsyncStart, IEvent { /// public override uint Id { get; set; } = 10042; diff --git a/KruacentExiled/KE.GlobalEventFramework.Examples/MiddleEvents/WallHack.cs b/KruacentExiled/KE.GlobalEventFramework.Examples/MiddleEvents/WallHack.cs index e218aa70..867c8339 100644 --- a/KruacentExiled/KE.GlobalEventFramework.Examples/MiddleEvents/WallHack.cs +++ b/KruacentExiled/KE.GlobalEventFramework.Examples/MiddleEvents/WallHack.cs @@ -13,7 +13,7 @@ namespace KE.GlobalEventFramework.Examples.MiddleEvents { - public class WallHackM : MiddleEvent, IStart, IEvent + public class WallHackM : MiddleEvent, IAsyncStart, IEvent { /// public override uint Id { get; set; } = 10052; diff --git a/KruacentExiled/KE.GlobalEventFramework/GEFE/API/Extensions/ImpactLevelExtension.cs b/KruacentExiled/KE.GlobalEventFramework/GEFE/API/Extensions/ImpactLevelExtension.cs index 1013d6c5..c2ce6c8f 100644 --- a/KruacentExiled/KE.GlobalEventFramework/GEFE/API/Extensions/ImpactLevelExtension.cs +++ b/KruacentExiled/KE.GlobalEventFramework/GEFE/API/Extensions/ImpactLevelExtension.cs @@ -14,12 +14,12 @@ public static string Shorten(this ImpactLevel impact) { return impact switch { - ImpactLevel.VeryLow => "VL", - ImpactLevel.Low => "L", - ImpactLevel.Medium => "M", - ImpactLevel.High => "H", - ImpactLevel.VeryHigh => "VH", - ImpactLevel.Insane => "I", + ImpactLevel.VeryLow => "[VL]", + ImpactLevel.Low => "[L]", + ImpactLevel.Medium => "[M]", + ImpactLevel.High => "[H]", + ImpactLevel.VeryHigh => "[VH]", + ImpactLevel.Insane => "[I]", _ => "" }; } diff --git a/KruacentExiled/KE.GlobalEventFramework/GEFE/API/Features/GlobalEvent.cs b/KruacentExiled/KE.GlobalEventFramework/GEFE/API/Features/GlobalEvent.cs index d34be3af..7485ed0b 100644 --- a/KruacentExiled/KE.GlobalEventFramework/GEFE/API/Features/GlobalEvent.cs +++ b/KruacentExiled/KE.GlobalEventFramework/GEFE/API/Features/GlobalEvent.cs @@ -2,6 +2,7 @@ using Exiled.API.Extensions; using Exiled.API.Features; using Exiled.API.Features.Pools; +using Exiled.Events.EventArgs.Map; using Exiled.Events.EventArgs.Server; using HintServiceMeow.Core.Models.Hints; using KE.GlobalEventFramework.GEFE.API.Enums; @@ -36,7 +37,6 @@ public void SubscribeEvents() public void UnsubscribeEvents() { if (!_eventsub) return; - Exiled.Events.Handlers.Server.RoundStarted -= OnRoundStarted; Exiled.Events.Handlers.Server.RoundEnded -= OnEndingRound; @@ -109,13 +109,13 @@ public bool IsActive - protected override void SubscribeEvents() + protected sealed override void SubscribeEvents() { _handler.SubscribeEvents(); base.SubscribeEvents(); } - protected override void UnsubscribeEvents() + protected sealed override void UnsubscribeEvents() { _handler.UnsubscribeEvents(); @@ -197,11 +197,10 @@ private static string ShowText() StringBuilder builder = StringBuilderPool.Pool.Get(); builder.Append("Global Events: "); - List ge; - ge = _activeGE.ToList(); + List ge = ListPool.Pool.Get(_activeGE); + + - - @@ -217,11 +216,9 @@ private static string ShowText() builder.Append(ImpactToColor[globalEvent.ImpactLevel]); builder.Append(">"); - builder.Append("["); builder.Append(globalEvent.ImpactLevel.Shorten()); - builder.Append("]"); - + if (globalEvent.IsRedacted()) { @@ -244,17 +241,19 @@ private static string ShowText() { builder.Append(", "); } - - - } - + + + } + ListPool.Pool.Return(ge); + + return StringBuilderPool.Pool.ToStringReturn(builder); } private bool IsRedacted() { - if(this is INonRedactable redactable) + if(this is INonRedactable) { return false; } @@ -272,7 +271,7 @@ private bool IsRedacted() chanceRedacted = Mathf.Clamp(chanceRedacted, 0, 100); - return UnityEngine.Random.Range(0f, 100f) < chanceRedacted; + return UnityEngine.Random.Range(0f, 100f) <= chanceRedacted; } diff --git a/KruacentExiled/KE.GlobalEventFramework/GEFE/API/Features/KEEvents.cs b/KruacentExiled/KE.GlobalEventFramework/GEFE/API/Features/KEEvents.cs index 19f63d69..ad30f62a 100644 --- a/KruacentExiled/KE.GlobalEventFramework/GEFE/API/Features/KEEvents.cs +++ b/KruacentExiled/KE.GlobalEventFramework/GEFE/API/Features/KEEvents.cs @@ -161,8 +161,16 @@ protected static void EnableEvents(IEnumerable events) } - if (ev is IStart start) - ev.CoroutineHandles.Add(Timing.RunCoroutine(start.Start())); + if (ev is IAsyncStart asyncstart) + { + ev.CoroutineHandles.Add(Timing.RunCoroutine(asyncstart.Start())); + } + + if(ev is IStart start) + { + start.Start(); + } + s_activeEvents.Add(ev); diff --git a/KruacentExiled/KE.GlobalEventFramework/GEFE/API/Interfaces/IAsyncStart.cs b/KruacentExiled/KE.GlobalEventFramework/GEFE/API/Interfaces/IAsyncStart.cs new file mode 100644 index 00000000..15ea06a0 --- /dev/null +++ b/KruacentExiled/KE.GlobalEventFramework/GEFE/API/Interfaces/IAsyncStart.cs @@ -0,0 +1,16 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace KE.GlobalEventFramework.GEFE.API.Interfaces +{ + public interface IAsyncStart + { + /// + /// Is launched at the start of a round + /// + IEnumerator Start(); + } +} diff --git a/KruacentExiled/KE.GlobalEventFramework/GEFE/API/Interfaces/IStart.cs b/KruacentExiled/KE.GlobalEventFramework/GEFE/API/Interfaces/IStart.cs index b3f00fad..bdd5faf5 100644 --- a/KruacentExiled/KE.GlobalEventFramework/GEFE/API/Interfaces/IStart.cs +++ b/KruacentExiled/KE.GlobalEventFramework/GEFE/API/Interfaces/IStart.cs @@ -11,6 +11,6 @@ public interface IStart /// /// Is launched at the start of a round /// - IEnumerator Start(); + void Start(); } } diff --git a/KruacentExiled/KE.GlobalEventFramework/KE.GlobalEventFramework.csproj b/KruacentExiled/KE.GlobalEventFramework/KE.GlobalEventFramework.csproj index 242e7fbe..a5391b1e 100644 --- a/KruacentExiled/KE.GlobalEventFramework/KE.GlobalEventFramework.csproj +++ b/KruacentExiled/KE.GlobalEventFramework/KE.GlobalEventFramework.csproj @@ -6,7 +6,7 @@ - + From b9db633047b72fd413f1f321a3339a20a0325d0e Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Sun, 1 Mar 2026 14:55:59 +0100 Subject: [PATCH 693/853] fwr slash --- .../Abilities/RedMist/ForwardSlash.cs | 51 ++++++++++++++----- 1 file changed, 39 insertions(+), 12 deletions(-) diff --git a/KruacentExiled/KE.CustomRoles/Abilities/RedMist/ForwardSlash.cs b/KruacentExiled/KE.CustomRoles/Abilities/RedMist/ForwardSlash.cs index 53a46179..cb23eb7b 100644 --- a/KruacentExiled/KE.CustomRoles/Abilities/RedMist/ForwardSlash.cs +++ b/KruacentExiled/KE.CustomRoles/Abilities/RedMist/ForwardSlash.cs @@ -1,13 +1,20 @@ -using Exiled.API.Features; -using KE.CustomRoles.API.Features; -using System.Collections.Generic; -using UnityEngine; -using PlayerRoles.FirstPersonControl.Thirdperson; -using PlayerRoles; +using Exiled.API.Enums; +using Exiled.API.Features; +using Exiled.API.Features.DamageHandlers; +using Exiled.API.Features.Items; using Exiled.API.Features.Roles; using Exiled.API.Features.Toys; -using Exiled.API.Enums; +using Exiled.API.Interfaces; +using Exiled.CreditTags.Features; +using InventorySystem.Items.MicroHID.Modules; +using KE.CustomRoles.API.Features; using KE.CustomRoles.CR.MTF.RedMist; +using PlayerRoles; +using PlayerRoles.FirstPersonControl.Thirdperson; +using System.Collections.Generic; +using System.ComponentModel; +using System.Linq; +using UnityEngine; namespace KE.CustomRoles.Abilities.RedMist { public class ForwardSlash : KEAbilities @@ -22,7 +29,7 @@ protected override Dictionary> SetTranslation [TranslationKeyName] = "Forward Slash", [TranslationKeyDesc] = "Manifest your E.G.O, gain powerful buff but rapid health drain.\nCan be deactivated anytime", ["ForwardSlashFailEGO"] = "You need to manifest your E.G.O. first", - ["ForwardSlashFailWeapon"] = "You need to manifest your E.G.O. first", + ["ForwardSlashFailWeapon"] = "You need your weapon", }, ["fr"] = new() { @@ -32,10 +39,11 @@ protected override Dictionary> SetTranslation }; } public override float Cooldown { get; } = 0f; - + public const float Damage = 100; public const float MaxDistance = 15; + private RaycastHit[] NonAlloc = new RaycastHit[16]; protected override bool AbilityUsed(Player player) { @@ -62,13 +70,32 @@ protected override bool AbilityUsed(Player player) Vector3 forward = player.Transform.forward; - if(Physics.Raycast(player.Position, forward,out RaycastHit hit, MaxDistance, (int)~LayerMasks.Hitbox)) + float size = 2; + + Vector3 position = player.Position; + + int detect = Physics.SphereCastNonAlloc(position, size, player.CameraTransform.forward, NonAlloc, MaxDistance, HitregUtils.DetectionMask); + + Draw.Sphere(position, Quaternion.identity, Vector3.one * size * 2f, Color.green, 10, Player.Enumerable); + Vector3 direction = player.CameraTransform.forward; + direction.Normalize(); + Vector3 end = position + direction * MaxDistance; + Draw.Sphere(end, Quaternion.identity, Vector3.one * size * 2f, Color.yellow, 10,Player.Enumerable); + + for (int i = 0;i < detect;i++) { - if(Physics.Linecast(player.Position, hit.point,out RaycastHit hitPlayer,(int)LayerMasks.Hitbox)) + Collider collider = NonAlloc[i].collider; + + if (collider.TryGetComponent(out var destructible) && + (!Physics.Linecast(position, destructible.CenterOfMass, out var hitInfo, PlayerRolesUtils.AttackMask) + || collider == hitInfo.collider)) { - + Player target = Player.Get(collider); + destructible.Damage(Damage, new CustomDamageHandler(target, player, Damage, DamageType.Scp1509), destructible.CenterOfMass); } + } + From 9280d14a626c7f9e29c004ed37bdfb9a6de1ef55 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Sun, 1 Mar 2026 15:31:04 +0100 Subject: [PATCH 694/853] eog --- .../KE.CustomRoles/CR/MTF/RedMist/EGO.cs | 23 +++++++++++-------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/KruacentExiled/KE.CustomRoles/CR/MTF/RedMist/EGO.cs b/KruacentExiled/KE.CustomRoles/CR/MTF/RedMist/EGO.cs index 92d60ea4..dfb05b68 100644 --- a/KruacentExiled/KE.CustomRoles/CR/MTF/RedMist/EGO.cs +++ b/KruacentExiled/KE.CustomRoles/CR/MTF/RedMist/EGO.cs @@ -1,5 +1,6 @@ using Exiled.API.Features; using Exiled.API.Features.DamageHandlers; +using KE.Utils.API.Features; using PlayerRoles; using PlayerStatsSystem; using System; @@ -24,25 +25,28 @@ public class EGO : MonoBehaviour private float Damage = 1; + private DamageHandler damageHandler; - public void Awake() + private void Awake() { Active = false; Hub = ReferenceHub.GetHub(base.gameObject); + damageHandler = new CustomDamageHandler(Player.Get(Hub), null, Damage); } - public void Update() + private void Update() { - if (Hub is null || !Hub.IsAlive()) - { - Log.Debug(Hub?.nicknameSync.DisplayName +" is dead"); - Destroy(this); - return; - } + //if (Hub is null || !Hub.IsAlive()) + //{ + // Log.Debug(Hub?.nicknameSync.DisplayName +" is dead"); + // Destroy(this); + // return; + //} if (Active) { - Hub.playerStats.DealDamage(new CustomDamageHandler(Player.Get(Hub), null, Damage)); + Hub.playerStats.DealDamage(damageHandler); + KELog.Debug("damage"); } } @@ -51,6 +55,7 @@ public void Update() public void ToggleActive() { Active = !Active; + KELog.Debug("toggle now active? "+ Active); } } } From 787b3a6ee67afc9aeea6bc286cc7d58d4f420c27 Mon Sep 17 00:00:00 2001 From: OmerGS <27omerf@gmail.com> Date: Sun, 1 Mar 2026 15:39:38 +0100 Subject: [PATCH 695/853] feat: temporary remove ability usage of a player --- .../API/Features/KEAbilities.cs | 24 ++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/KruacentExiled/KE.CustomRoles/API/Features/KEAbilities.cs b/KruacentExiled/KE.CustomRoles/API/Features/KEAbilities.cs index a9c0efc7..090dba9f 100644 --- a/KruacentExiled/KE.CustomRoles/API/Features/KEAbilities.cs +++ b/KruacentExiled/KE.CustomRoles/API/Features/KEAbilities.cs @@ -51,6 +51,7 @@ public abstract class KEAbilities public HashSet Players { get; } = new HashSet(); public IReadOnlyCollection Selected => selected; private HashSet selected = new(); + private HashSet blockedPlayer = new(); @@ -279,7 +280,12 @@ public bool CanUse(Player player, out string result) result = "cannot use this"; return false; } - + if (this.blockedPlayer.Contains(player)) + { + result = "blocked"; + return false; + } + if (!LastUsed.ContainsKey(player)) { result = "never used"; @@ -361,6 +367,22 @@ public static void TryRemoveFromPlayer(Player player) } } + public static void TemporaryRemoveAbilities(Player player) + { + foreach(KEAbilities ability in PlayersAbility[player]) + { + ability.blockedPlayer.Add(player); + } + } + + public static void ReaffectRemovedAbilities(Player player) + { + foreach (KEAbilities ability in PlayersAbility[player]) + { + ability.blockedPlayer.Remove(player); + } + } + From 421bd0cc1b7fe91d96c005ce119b55603cb4451f Mon Sep 17 00:00:00 2001 From: OmerGS <27omerf@gmail.com> Date: Sun, 1 Mar 2026 15:57:54 +0100 Subject: [PATCH 696/853] add translation loading --- KruacentExiled/KE.CustomRoles/MainPlugin.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/KruacentExiled/KE.CustomRoles/MainPlugin.cs b/KruacentExiled/KE.CustomRoles/MainPlugin.cs index e33516b6..9eff76f1 100644 --- a/KruacentExiled/KE.CustomRoles/MainPlugin.cs +++ b/KruacentExiled/KE.CustomRoles/MainPlugin.cs @@ -53,7 +53,8 @@ public override void OnEnabled() Instance = this; _settingHandler = new(); - //Utils.API.Settings.SettingHandler.Instance.SubscribeEvents(); + Utils.API.Settings.GlobalSettings.GlobalSettingsHandler.Instance.TryLoad(); + Utils.API.Settings.GlobalSettings.GlobalSettingsHandler.Instance.SubscribeEvents(); CustomPlayerStat.AddModule(); CustomStatsEvents.SubscribeEvents(); @@ -84,6 +85,7 @@ public override void OnDisabled() UnsubscribeEvents(); CustomTeamEvents.UnsubscribeEvents(); CustomStatsEvents.UnsubscribeEvents(); + Utils.API.Settings.GlobalSettings.GlobalSettingsHandler.Instance.UnsubscribeEvents(); _settingHandler = null; Instance = null; base.OnDisabled(); From 5554f20741681d45fe2a68d4dc3cbd123dfb63df Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Sun, 1 Mar 2026 16:03:49 +0100 Subject: [PATCH 697/853] ego --- KruacentExiled/KE.CustomRoles/CR/MTF/RedMist/EGO.cs | 2 +- KruacentExiled/KE.CustomRoles/CR/MTF/RedMist/RedMist.cs | 2 +- KruacentExiled/KE.CustomRoles/MainPlugin.cs | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/KruacentExiled/KE.CustomRoles/CR/MTF/RedMist/EGO.cs b/KruacentExiled/KE.CustomRoles/CR/MTF/RedMist/EGO.cs index dfb05b68..30e6707f 100644 --- a/KruacentExiled/KE.CustomRoles/CR/MTF/RedMist/EGO.cs +++ b/KruacentExiled/KE.CustomRoles/CR/MTF/RedMist/EGO.cs @@ -48,7 +48,7 @@ private void Update() Hub.playerStats.DealDamage(damageHandler); KELog.Debug("damage"); } - + KELog.Debug("update"); } diff --git a/KruacentExiled/KE.CustomRoles/CR/MTF/RedMist/RedMist.cs b/KruacentExiled/KE.CustomRoles/CR/MTF/RedMist/RedMist.cs index a80634dd..85875a84 100644 --- a/KruacentExiled/KE.CustomRoles/CR/MTF/RedMist/RedMist.cs +++ b/KruacentExiled/KE.CustomRoles/CR/MTF/RedMist/RedMist.cs @@ -70,7 +70,7 @@ protected override void GiveInventory(Player player) protected override void RoleAdded(Player player) { - player.GameObject.GetComponent(); + player.GameObject.AddComponent(); base.RoleAdded(player); } diff --git a/KruacentExiled/KE.CustomRoles/MainPlugin.cs b/KruacentExiled/KE.CustomRoles/MainPlugin.cs index e33516b6..8a6f7442 100644 --- a/KruacentExiled/KE.CustomRoles/MainPlugin.cs +++ b/KruacentExiled/KE.CustomRoles/MainPlugin.cs @@ -53,7 +53,7 @@ public override void OnEnabled() Instance = this; _settingHandler = new(); - //Utils.API.Settings.SettingHandler.Instance.SubscribeEvents(); + Utils.API.Settings.GlobalSettings.GlobalSettingsHandler.Instance.SubscribeEvents(); CustomPlayerStat.AddModule(); CustomStatsEvents.SubscribeEvents(); From 0a1b4f6676247ce46ca721fcfb8adcc83f21ff0a Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Sun, 1 Mar 2026 19:35:14 +0100 Subject: [PATCH 698/853] red mist --- .../Abilities/RedMist/ForwardSlash.cs | 22 +++-- .../Abilities/RedMist/ToggleEGO.cs | 4 +- .../KE.CustomRoles/CR/MTF/RedMist/EGO.cs | 99 +++++++++++++++---- .../KE.CustomRoles/CR/MTF/RedMist/RedMist.cs | 54 ++++++++-- 4 files changed, 142 insertions(+), 37 deletions(-) diff --git a/KruacentExiled/KE.CustomRoles/Abilities/RedMist/ForwardSlash.cs b/KruacentExiled/KE.CustomRoles/Abilities/RedMist/ForwardSlash.cs index cb23eb7b..14de6c83 100644 --- a/KruacentExiled/KE.CustomRoles/Abilities/RedMist/ForwardSlash.cs +++ b/KruacentExiled/KE.CustomRoles/Abilities/RedMist/ForwardSlash.cs @@ -9,6 +9,7 @@ using InventorySystem.Items.MicroHID.Modules; using KE.CustomRoles.API.Features; using KE.CustomRoles.CR.MTF.RedMist; +using KE.Utils.API.Features; using PlayerRoles; using PlayerRoles.FirstPersonControl.Thirdperson; using System.Collections.Generic; @@ -35,6 +36,8 @@ protected override Dictionary> SetTranslation { [TranslationKeyName] = "todo", [TranslationKeyDesc] = "todo", + ["ForwardSlashFailEGO"] = "todo", + ["ForwardSlashFailWeapon"] = "todo", } }; } @@ -48,9 +51,9 @@ protected override bool AbilityUsed(Player player) { - if (!player.GameObject.TryGetComponent(out var ego)) + if (!player.ReferenceHub.gameObject.TryGetComponent(out var ego)) { - ego = player.GameObject.AddComponent(); + return false; } @@ -60,19 +63,20 @@ protected override bool AbilityUsed(Player player) //show ForwardSlashFailEGO return false; } + KELog.Debug("check weapopgn"); + - if(player.CurrentItem.Type != ItemType.SCP1509) + if(player.CurrentItem is null || player.CurrentItem.Type != ItemType.SCP1509) { //show ForwardSlashFailWeapon return false; } - Vector3 forward = player.Transform.forward; - float size = 2; + float size = 1; - Vector3 position = player.Position; + Vector3 position = player.Position + player.CameraTransform.forward; int detect = Physics.SphereCastNonAlloc(position, size, player.CameraTransform.forward, NonAlloc, MaxDistance, HitregUtils.DetectionMask); @@ -84,16 +88,22 @@ protected override bool AbilityUsed(Player player) for (int i = 0;i < detect;i++) { + Collider collider = NonAlloc[i].collider; + KELog.Debug("hit collider ="+collider); if (collider.TryGetComponent(out var destructible) && (!Physics.Linecast(position, destructible.CenterOfMass, out var hitInfo, PlayerRolesUtils.AttackMask) || collider == hitInfo.collider)) { Player target = Player.Get(collider); + + + HitboxIdentity.IsDamageable(ego.Hub, target.ReferenceHub); destructible.Damage(Damage, new CustomDamageHandler(target, player, Damage, DamageType.Scp1509), destructible.CenterOfMass); } + } diff --git a/KruacentExiled/KE.CustomRoles/Abilities/RedMist/ToggleEGO.cs b/KruacentExiled/KE.CustomRoles/Abilities/RedMist/ToggleEGO.cs index 235454dc..c26172f3 100644 --- a/KruacentExiled/KE.CustomRoles/Abilities/RedMist/ToggleEGO.cs +++ b/KruacentExiled/KE.CustomRoles/Abilities/RedMist/ToggleEGO.cs @@ -33,9 +33,9 @@ protected override Dictionary> SetTranslation protected override bool AbilityUsed(Player player) { - if(!player.GameObject.TryGetComponent(out var ego)) + if(!player.ReferenceHub.gameObject.TryGetComponent(out var ego)) { - ego= player.GameObject.AddComponent(); + return false; } ego.ToggleActive(); diff --git a/KruacentExiled/KE.CustomRoles/CR/MTF/RedMist/EGO.cs b/KruacentExiled/KE.CustomRoles/CR/MTF/RedMist/EGO.cs index 30e6707f..3031cdbc 100644 --- a/KruacentExiled/KE.CustomRoles/CR/MTF/RedMist/EGO.cs +++ b/KruacentExiled/KE.CustomRoles/CR/MTF/RedMist/EGO.cs @@ -1,6 +1,8 @@ -using Exiled.API.Features; +using CustomPlayerEffects; +using Exiled.API.Features; using Exiled.API.Features.DamageHandlers; using KE.Utils.API.Features; +using KE.Utils.Extensions; using PlayerRoles; using PlayerStatsSystem; using System; @@ -16,46 +18,103 @@ public class EGO : MonoBehaviour { - public bool Active { get; set; } + public bool Active => active; - + private bool active; - private ReferenceHub Hub; + public ReferenceHub Hub { get; private set; } - private float Damage = 1; + private const float Damage = 2; - private DamageHandler damageHandler; + private CustomReasonDamageHandler damage; - private void Awake() + internal void Awake() { - Active = false; Hub = ReferenceHub.GetHub(base.gameObject); - damageHandler = new CustomDamageHandler(Player.Get(Hub), null, Damage); + active = false; + + damage = new CustomReasonDamageHandler("drained", Damage); + KELog.Debug(Hub); } - private void Update() + + private float cooldown = 0; + private float objective = .2f; + private float baseObjective = .2f; + + private void UpdateDamage() { - //if (Hub is null || !Hub.IsAlive()) - //{ - // Log.Debug(Hub?.nicknameSync.DisplayName +" is dead"); - // Destroy(this); - // return; - //} + if (Hub is null) + { + KELog.Debug("null"); + return; + } + + if (!Hub.IsAlive()) + { + KELog.Debug(Hub?.nicknameSync.DisplayName + " is dead"); + Destroy(this); + return; + } if (Active) { - Hub.playerStats.DealDamage(damageHandler); - KELog.Debug("damage"); + cooldown += Time.deltaTime; + KELog.Debug(cooldown); + KELog.Debug(Time.deltaTime); + if (cooldown >= objective) + { + Hub.playerStats.DealDamage(damage); + cooldown = 0; + objective = baseObjective; + } } - KELog.Debug("update"); + + + } + + public void IncreaseObjective() + { + objective += baseObjective*10; + } + + + public void Update() + { + UpdateDamage(); } public void ToggleActive() { - Active = !Active; + active = !Active; KELog.Debug("toggle now active? "+ Active); + Effect(); + } + + + + private void Effect() + { + Player player = Player.Get(Hub); + + if (Active) + { + player.AddLevelEffect(25); + player.AddLevelEffect(2); + if (player.IsEffectActive()) + { + player.DisableEffect(); + } + } + else + { + player.AddLevelEffect(-25); + player.DisableEffect(); + } + + } } } diff --git a/KruacentExiled/KE.CustomRoles/CR/MTF/RedMist/RedMist.cs b/KruacentExiled/KE.CustomRoles/CR/MTF/RedMist/RedMist.cs index 85875a84..58fd83b3 100644 --- a/KruacentExiled/KE.CustomRoles/CR/MTF/RedMist/RedMist.cs +++ b/KruacentExiled/KE.CustomRoles/CR/MTF/RedMist/RedMist.cs @@ -4,6 +4,8 @@ using KE.CustomRoles.Abilities.RedMist; using KE.CustomRoles.API.Features; using KE.CustomRoles.API.Interfaces; +using KE.CustomRoles.CR.CustomSCPs.SCP049C; +using KE.Items.API.Features; using MEC; using PlayerRoles; using System; @@ -25,17 +27,17 @@ protected override Dictionary> SetTranslation ["en"] = new() { [TranslationKeyName] = "Red Mist", - [TranslationKeyDesc] = " ", + [TranslationKeyDesc] = "todo", }, ["fr"] = new() { [TranslationKeyName] = "Red Mist", - [TranslationKeyDesc] = " ", + [TranslationKeyDesc] = "todo", }, ["legacy"] = new() { [TranslationKeyName] = "Red Mist", - [TranslationKeyDesc] = " ", + [TranslationKeyDesc] = "todo", } }; } @@ -53,8 +55,8 @@ protected override Dictionary> SetTranslation //If you let people on your team die you get weaker, you are a protector afterall. //faster, 200hp, machete mais 200 hp de dégats (75 pour les humains) - //shield belt - //ego : quick heal drain pause when attacking, 80 damage reduction faster + //+shield belt + //+ego : quick heal drain pause when attacking, 80 damage reduction faster //forward slash : remove 25hp max to a min of 25hp, damage everything on its path max distance of a room public override HashSet Abilities { get; } = @@ -65,26 +67,60 @@ protected override Dictionary> SetTranslation protected override void GiveInventory(Player player) { - + + + KECustomItem.TryGive(player, "ShieldBelt", false); } protected override void RoleAdded(Player player) { - player.GameObject.AddComponent(); + if (!player.ReferenceHub.TryGetComponent(out _)) + { + Log.Debug("adding comp"); + player.ReferenceHub.gameObject.AddComponent(); + } base.RoleAdded(player); } + protected override void RoleRemoved(Player player) + { + + + if (player.ReferenceHub.gameObject.TryGetComponent(out var ego)) + { + UnityEngine.Object.Destroy(ego); + } + base.RoleRemoved(player); + } + protected override void SubscribeEvents() { - + Exiled.Events.Handlers.Player.Hurt += OnHurt; base.SubscribeEvents(); } protected override void UnsubscribeEvents() { - + Exiled.Events.Handlers.Player.Hurt -= OnHurt; base.UnsubscribeEvents(); } + private void OnHurt(HurtEventArgs ev) + { + + Player player = ev.Attacker; + if (!Check(player)) return; + + if (player.ReferenceHub.gameObject.TryGetComponent(out var ego)) + { + if (ego.Active) + { + ego.IncreaseObjective(); + } + + + } + } + } } From 06f32641f24234d40612401de92ddf853e103aad Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Sun, 1 Mar 2026 19:38:43 +0100 Subject: [PATCH 699/853] ammo negotiator --- .../KE.CustomRoles/CR/ChaosInsurgency/Negotiator.cs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/KruacentExiled/KE.CustomRoles/CR/ChaosInsurgency/Negotiator.cs b/KruacentExiled/KE.CustomRoles/CR/ChaosInsurgency/Negotiator.cs index 4b859397..c6cc9d9e 100644 --- a/KruacentExiled/KE.CustomRoles/CR/ChaosInsurgency/Negotiator.cs +++ b/KruacentExiled/KE.CustomRoles/CR/ChaosInsurgency/Negotiator.cs @@ -53,7 +53,12 @@ protected override Dictionary> SetTranslation "Radio" }; - + public override Dictionary Ammo { get; set; } = new() + { + { AmmoType.Ammo12Gauge, 7 }, { AmmoType.Nato762, 90 } + }; + + protected override void SubscribeEvents() { Exiled.Events.Handlers.Player.Hurting += OnHurting; From 7d64ca1ee711df2907fa0b92368f4b42a7f83a46 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Sun, 1 Mar 2026 19:58:32 +0100 Subject: [PATCH 700/853] tryload --- KruacentExiled/KE.CustomRoles/MainPlugin.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/KruacentExiled/KE.CustomRoles/MainPlugin.cs b/KruacentExiled/KE.CustomRoles/MainPlugin.cs index 8a6f7442..ba391d27 100644 --- a/KruacentExiled/KE.CustomRoles/MainPlugin.cs +++ b/KruacentExiled/KE.CustomRoles/MainPlugin.cs @@ -53,6 +53,7 @@ public override void OnEnabled() Instance = this; _settingHandler = new(); + Utils.API.Settings.GlobalSettings.GlobalSettingsHandler.Instance.TryLoad(); Utils.API.Settings.GlobalSettings.GlobalSettingsHandler.Instance.SubscribeEvents(); CustomPlayerStat.AddModule(); From e2065ef24920a9c235ab521e1cb41a19031eec2e Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Tue, 3 Mar 2026 19:52:53 +0100 Subject: [PATCH 701/853] full rework of the custom items --- .../KE.Items/API/Core/Lights/LightsHandler.cs | 2 +- .../KE.Items/API/Features/KECustomGrenade.cs | 129 ++++++++++-- .../KE.Items/API/Features/KECustomItem.cs | 132 ++++++++++++- .../KE.Items/API/Features/KECustomWeapon.cs | 184 +++++++++++++++--- KruacentExiled/KE.Items/Commands/Give.cs | 102 ++++++++++ .../KE.Items/Commands/KECustomItems.cs | 23 +++ KruacentExiled/KE.Items/Commands/List.cs | 44 +++++ KruacentExiled/KE.Items/Items/Defibrilator.cs | 3 +- .../KE.Items/Items/DeployableWall.cs | 5 +- KruacentExiled/KE.Items/Items/DivinePills.cs | 5 +- KruacentExiled/KE.Items/Items/FriendMaker.cs | 13 +- KruacentExiled/KE.Items/Items/HealZone.cs | 12 +- KruacentExiled/KE.Items/Items/ImpactFlash.cs | 8 +- .../KE.Items/Items/LeSoleil/LeSoleil.cs | 13 +- .../KE.Items/Items/LowGravityGrenade.cs | 12 +- KruacentExiled/KE.Items/Items/MScan.cs | 3 +- KruacentExiled/KE.Items/Items/Mine.cs | 8 +- KruacentExiled/KE.Items/Items/Molotov.cs | 9 +- KruacentExiled/KE.Items/Items/PressePuree.cs | 25 +-- .../KE.Items/Items/ProximityGrenade.cs | 10 +- .../KE.Items/Items/RedbullEnergy.cs | 3 +- .../KE.Items/Items/SainteGrenada.cs | 12 +- KruacentExiled/KE.Items/Items/Scp1650.cs | 4 +- KruacentExiled/KE.Items/Items/Scp3136.cs | 3 +- KruacentExiled/KE.Items/Items/Scp514.cs | 3 +- KruacentExiled/KE.Items/Items/SmokeGrenade.cs | 9 +- KruacentExiled/KE.Items/Items/TPGrenada.cs | 12 +- .../KE.Items/Items/TrueDivinePills.cs | 4 +- KruacentExiled/KE.Items/MainPlugin.cs | 12 +- 29 files changed, 666 insertions(+), 138 deletions(-) create mode 100644 KruacentExiled/KE.Items/Commands/Give.cs create mode 100644 KruacentExiled/KE.Items/Commands/KECustomItems.cs create mode 100644 KruacentExiled/KE.Items/Commands/List.cs diff --git a/KruacentExiled/KE.Items/API/Core/Lights/LightsHandler.cs b/KruacentExiled/KE.Items/API/Core/Lights/LightsHandler.cs index a42790a4..7b9d260c 100644 --- a/KruacentExiled/KE.Items/API/Core/Lights/LightsHandler.cs +++ b/KruacentExiled/KE.Items/API/Core/Lights/LightsHandler.cs @@ -29,7 +29,7 @@ private void AddPickup(ItemPickupBase pickup) var l = LightSourceToy.Create(pickup.transform, false); l.Color = li.Color; l.Intensity = Intensity; - + l.MovementSmoothing = 0; l.Spawn(); } diff --git a/KruacentExiled/KE.Items/API/Features/KECustomGrenade.cs b/KruacentExiled/KE.Items/API/Features/KECustomGrenade.cs index b5319c27..5db2604f 100644 --- a/KruacentExiled/KE.Items/API/Features/KECustomGrenade.cs +++ b/KruacentExiled/KE.Items/API/Features/KECustomGrenade.cs @@ -1,10 +1,13 @@ using Exiled.API.Features; +using Exiled.API.Features.Components; using Exiled.API.Features.Pickups; using Exiled.API.Features.Pickups.Projectiles; using Exiled.API.Features.Spawn; using Exiled.CustomItems.API.Features; using Exiled.Events.EventArgs.Map; using Exiled.Events.EventArgs.Player; +using Exiled.Events.Features; +using InventorySystem.Items.ThrowableProjectiles; using KE.Items.API.Events; using KE.Items.API.Features.SpawnPoints; using KE.Utils.API.Features; @@ -14,20 +17,28 @@ namespace KE.Items.API.Features { - public abstract class KECustomGrenade : CustomGrenade + public abstract class KECustomGrenade : KECustomItem { - public virtual float DamageModifier { get; set; } = 1f; - - + public virtual float DamageModifier { get; } = 1f; + public abstract bool ExplodeOnCollision { get; } + public abstract float FuseTime { get; } protected override void SubscribeEvents() { - ExplodeEvent.ExplodeDestructible += OnExplodeDestructible; + Exiled.Events.Handlers.Player.ThrowingRequest += OnInternalThrowingRequest; + Exiled.Events.Handlers.Player.ThrownProjectile += OnInternalThrownProjectile; + Exiled.Events.Handlers.Map.ExplodingGrenade += OnInternalExplodingGrenade; + Exiled.Events.Handlers.Map.ChangedIntoGrenade += OnInternalChangedIntoGrenade; + ExplodeEvent.ExplodeDestructible += OnInternalExplodeDestructible; base.SubscribeEvents(); } protected override void UnsubscribeEvents() { - ExplodeEvent.ExplodeDestructible -= OnExplodeDestructible; + Exiled.Events.Handlers.Player.ThrowingRequest -= OnInternalThrowingRequest; + Exiled.Events.Handlers.Player.ThrownProjectile -= OnInternalThrownProjectile; + Exiled.Events.Handlers.Map.ExplodingGrenade -= OnInternalExplodingGrenade; + Exiled.Events.Handlers.Map.ChangedIntoGrenade -= OnInternalChangedIntoGrenade; + ExplodeEvent.ExplodeDestructible -= OnInternalExplodeDestructible; base.UnsubscribeEvents(); } @@ -74,15 +85,109 @@ public override uint Spawn(IEnumerable spawnPoints, uint limit) return base.Spawn(spawns, limit - num); } - - private void OnExplodeDestructible(OnExplodeDestructibleEventsArgs ev) + public virtual bool Check(Projectile grenade) { + if (grenade != null) + { + return base.TrackedSerials.Contains(grenade.Serial); + } + + return false; + } - Player player = Player.Get(ev.Destructible.NetworkId); + public virtual bool Check(ExplosionGrenade explosionGrenade) + { + return Check(Pickup.Get(explosionGrenade)); + } + private void OnInternalExplodeDestructible(OnExplodeDestructibleEventsArgs ev) + { KELog.Debug("damage =" + ev.Damage); - if (!Check(Pickup.Get(ev.ExplosionGrenade))) return; - if (ev.Damage < 0f) return; - ev.Damage *= DamageModifier; + KELog.Debug("serial expldode=" + ev.ExplosionGrenade.ItemId.SerialNumber); + + if (Check(ev.ExplosionGrenade)) + { + if(ev.Damage > 0f) + { + ev.Damage *= DamageModifier; + } + + OnExplodeDestructible(ev); + } + } + + + private void OnInternalThrowingRequest(ThrowingRequestEventArgs ev) + { + if (Check(ev.Item)) + { + OnThrowingRequest(ev); + } + } + private void OnInternalThrownProjectile(ThrownProjectileEventArgs ev) + { + KELog.Debug("changings nto grandea"); + KELog.Debug("serialpickup=" + ev.Pickup.Serial); + if (Check(ev.Throwable)) + { + OnThrownProjectile(ev); + if (ev.Projectile is TimeGrenadeProjectile timeGrenadeProjectile) + { + timeGrenadeProjectile.FuseTime = FuseTime; + } + + if (ExplodeOnCollision) + { + ev.Projectile.GameObject.AddComponent().Init((ev.Player ?? Server.Host).GameObject, ev.Projectile.Base); + } + } + } + private void OnInternalExplodingGrenade(ExplodingGrenadeEventArgs ev) + { + if (Check(ev.Projectile)) + { + OnExplodingGrenade(ev); + } + } + private void OnInternalChangedIntoGrenade(ChangedIntoGrenadeEventArgs ev) + { + + + if (Check(ev.Pickup)) + { + if (ev.Projectile is TimeGrenadeProjectile timeGrenadeProjectile) + { + timeGrenadeProjectile.FuseTime = FuseTime; + } + + OnChangedIntoGrenade(ev); + if (ExplodeOnCollision) + { + ev.Projectile.GameObject.AddComponent().Init((ev.Pickup.PreviousOwner ?? Server.Host).GameObject, ev.Projectile.Base); + } + } + + } + + + protected virtual void OnExplodeDestructible(OnExplodeDestructibleEventsArgs ev) + { + + } + protected virtual void OnThrowingRequest(ThrowingRequestEventArgs ev) + { + + } + protected virtual void OnThrownProjectile(ThrownProjectileEventArgs ev) + { + + } + protected virtual void OnExplodingGrenade(ExplodingGrenadeEventArgs ev) + { + + } + protected virtual void OnChangedIntoGrenade(ChangedIntoGrenadeEventArgs ev) + { + } protected override void ShowPickedUpMessage(Player player) diff --git a/KruacentExiled/KE.Items/API/Features/KECustomItem.cs b/KruacentExiled/KE.Items/API/Features/KECustomItem.cs index 45288c4e..8f6da534 100644 --- a/KruacentExiled/KE.Items/API/Features/KECustomItem.cs +++ b/KruacentExiled/KE.Items/API/Features/KECustomItem.cs @@ -1,12 +1,18 @@ -using Exiled.API.Features; +using Exiled.API.Extensions; +using Exiled.API.Features; using Exiled.API.Features.Pools; using Exiled.API.Features.Spawn; +using Exiled.CustomItems.API; using Exiled.CustomItems.API.Features; +using Exiled.Events.EventArgs.Player; using KE.Items.API.Features.SpawnPoints; using KE.Items.API.Interface; using KE.Utils.API.Displays.DisplayMeow; +using PlayerRoles.SpawnData; +using System; using System.Collections.Generic; using System.Linq; +using System.Reflection; using System.Text; using UnityEngine; using static KE.Items.API.Features.SpawnPoints.PoseRoomSpawnPointHandler; @@ -17,6 +23,69 @@ namespace KE.Items.API.Features public abstract class KECustomItem : CustomItem { + + private static Dictionary _typeLookup = new(); + + private static Dictionary _nameLookup = new(); + + + [Obsolete("Uses only the name",true)] + public sealed override uint Id { get; set; } = 0; + + public abstract ItemType ItemType { get; } + + public override float Weight { get; set; } = 1; + + public sealed override ItemType Type + { + get + { + return ItemType; + } + set + { + + } + } + + + public override void Init() + { + _typeLookup.Add(GetType(), this); + Name = Name.RemoveSpaces(); + + _nameLookup.Add(Name, this); + SubscribeEvents(); + } + + + public override void Destroy() + { + UnsubscribeEvents(); + _nameLookup.Remove(Name); + _typeLookup.Remove(GetType()); + } + + + + + + public static T Get() where T : KECustomItem + { + return (T)_typeLookup[typeof(T)]; + } + public new static KECustomItem Get(string name) + { + return _nameLookup[name]; + } + public static bool TryGet(string name, out KECustomItem item) + { + + + return _nameLookup.TryGetValue(name,out item); + } + + protected override void ShowPickedUpMessage(Player player) { Log.Debug("pickup"); @@ -156,5 +225,66 @@ public static void ItemEffectHint(Player player, string text) } + public virtual bool TryRegister() + { + + + if (Registered.Contains(this)) + { + Log.Error($"{Name} is already registered"); + return false; + } + + + if (TryGet(Name,out _)) + { + Log.Error($"A Custom item already have the name {Name}"); + return false; + } + + + if(ItemType == ItemType.None) + { + Log.Error($"No ItemType for {Name}"); + return false; + } + + + Registered.Add(this); + Init(); + return true; + + + } + + +//obselete warning +#pragma warning disable CS0618 +#pragma warning disable CS0672 + protected sealed override void OnDropping(DroppingItemEventArgs ev) + { + base.OnDropping(ev); + } + +#pragma warning restore CS0618 +#pragma warning restore CS0672 + public static void RegisterItems(Assembly assembly = null) + { + IEnumerable items = Utils.API.ReflectionHelper.GetObjects(assembly); + + foreach(KECustomItem customItem in items) + { + customItem.TryRegister(); + } + + } + + public new static void UnregisterItems() + { + foreach(CustomItem item in Registered) + { + item.Unregister(); + } + } } } diff --git a/KruacentExiled/KE.Items/API/Features/KECustomWeapon.cs b/KruacentExiled/KE.Items/API/Features/KECustomWeapon.cs index 78d2b63e..6b1844c2 100644 --- a/KruacentExiled/KE.Items/API/Features/KECustomWeapon.cs +++ b/KruacentExiled/KE.Items/API/Features/KECustomWeapon.cs @@ -1,84 +1,214 @@ -using Exiled.API.Features; +using Exiled.API.Enums; +using Exiled.API.Features; +using Exiled.API.Features.Items; using Exiled.API.Features.Pickups; using Exiled.API.Features.Spawn; using Exiled.CustomItems.API.Features; using Exiled.Events.EventArgs.Player; +using Exiled.Events.Features; +using InventorySystem.Items.Firearms.Modules; using KE.Items.API.Features.SpawnPoints; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; -using static KE.Items.API.Features.SpawnPoints.PoseRoomSpawnPointHandler; +using UnityEngine; namespace KE.Items.API.Features { - public abstract class KECustomWeapon : CustomWeapon + public abstract class KECustomWeapon : KECustomItem { + + public virtual float Damage { get; set; } = -1; + public virtual byte ClipSize { get; } protected override void SubscribeEvents() { - + Exiled.Events.Handlers.Player.Shooting += InternalOnShooting; + Exiled.Events.Handlers.Player.Hurting += InternalOnHurting; + Exiled.Events.Handlers.Player.ReloadingWeapon += OnInternalReloading; + Exiled.Events.Handlers.Player.ReloadedWeapon += OnInternalReloaded; base.SubscribeEvents(); } protected override void UnsubscribeEvents() { + Exiled.Events.Handlers.Player.Shooting -= InternalOnShooting; + Exiled.Events.Handlers.Player.Hurting -= InternalOnHurting; + Exiled.Events.Handlers.Player.ReloadingWeapon -= OnInternalReloading; + Exiled.Events.Handlers.Player.ReloadedWeapon -= OnInternalReloaded; base.UnsubscribeEvents(); } - public override uint Spawn(IEnumerable spawnPoints, uint limit) + + private void InternalOnHurting(HurtingEventArgs ev) { - Log.Debug($"spawning {this.Name}"); - HashSet spawns = spawnPoints.ToHashSet(); - uint num = 0; - foreach (SpawnPoint spawnpoint in spawnPoints.Where(sp => sp is RoomSpawnPoint)) + OnHurting(ev); + if (ev.IsAllowed && Damage >= 0) { - Pickup pickup; - if (Exiled.Loader.Loader.Random.NextDouble() * 100.0 >= (double)spawnpoint.Chance || (limit != 0 && num >= limit)) + ev.Amount = Damage; + + } + } + private void InternalOnShooting(ShootingEventArgs ev) + { + if (Check(ev.Item)) + { + OnShooting(ev); + } + } + + private void OnInternalReloading(ReloadingWeaponEventArgs ev) + { + if (Check(ev.Item)) + { + if (ClipSize > 0 && ev.Firearm.TotalAmmo >= ClipSize) + { + ev.IsAllowed = false; + } + else { - continue; + OnReloading(ev); } - spawns.Remove(spawnpoint); - RoomSpawnPoint room = spawnpoint as RoomSpawnPoint; - ItemSpawn spawn = PoseRoomSpawnPointHandler.UseRandomPose(room.Room); + } + } + private void OnInternalReloaded(ReloadedWeaponEventArgs ev) + { - Log.Debug($"spawning {this.Name} in {room.Room}"); - Log.Debug(room.Room + " : " + PoseRoomSpawnPointHandler.UsablePoses.Count(p => p.roomType == room.Room)); + if (!Check(ev.Item)) + return; - if (spawn is not null) + if (ClipSize > 0) + { + int ammoChambered = ((AutomaticActionModule)ev.Firearm.Base.Modules.FirstOrDefault(x => x is AutomaticActionModule))?.AmmoStored ?? 0; + int ammoToGive = ClipSize - ammoChambered; + + AmmoType ammoType = ev.Firearm.AmmoType; + int firearmAmmo = ev.Firearm.MagazineAmmo; + int ammoDrop = -(ClipSize - firearmAmmo - ammoChambered); + + int ammoInInventory = ev.Player.GetAmmo(ammoType) + firearmAmmo; + if (ammoToGive < ammoInInventory) { - Log.Debug($"spawning custom pos"); - pickup = Spawn(spawn.Position); + ev.Firearm.MagazineAmmo = ammoToGive; + int newAmmo = ev.Player.GetAmmo(ammoType) + ammoDrop; + ev.Player.SetAmmo(ammoType, (ushort)newAmmo); } else { - Log.Error($"can't spawn ({Name}) in custom ({room.Room})"); - pickup = Spawn(spawnpoint.Position); + ev.Firearm.MagazineAmmo = ammoInInventory; + ev.Player.SetAmmo(ammoType, 0); } + } + + OnReloaded(ev); + } + + protected virtual void OnShooting(ShootingEventArgs ev) + { + + } + + protected virtual void OnHurting(HurtingEventArgs ev) + { + + } + protected virtual void OnReloading(ReloadingWeaponEventArgs ev) + { + + } + + protected virtual void OnReloaded(ReloadedWeaponEventArgs ev) + { + + } + + + public override Pickup Spawn(Vector3 position, Player previousOwner = null) + { + if (Item.Create(Type) is not Firearm firearm) + { + Log.Debug("Spawn: Item is not Firearm."); + return null; + } + Pickup pickup = firearm.CreatePickup(position); + if (pickup == null) + { + Log.Debug("Spawn: Pickup is null."); + return null; + } + + if (ClipSize > 0) + { + firearm.MagazineAmmo = ClipSize; + } + + pickup.Weight = Weight; + pickup.Scale = Scale; + if ((object)previousOwner != null) + { + pickup.PreviousOwner = previousOwner; + } - if (pickup is not null) + base.TrackedSerials.Add(pickup.Serial); + return pickup; + } + + public override Pickup Spawn(Vector3 position, Item item, Player previousOwner = null) + { + if (item is Firearm firearm) + { + + if (ClipSize > 0) + { + firearm.MagazineAmmo = ClipSize; + } + + int magazineAmmo = firearm.MagazineAmmo; + Log.Debug(string.Format("{0}.{1}: Spawning weapon with {2} ammo.", "Name", "Spawn", magazineAmmo)); + Pickup pickup = firearm.CreatePickup(position); + pickup.Scale = Scale; + if ((object)previousOwner != null) { - num++; + pickup.PreviousOwner = previousOwner; } + base.TrackedSerials.Add(pickup.Serial); + return pickup; + } + + return base.Spawn(position, item, previousOwner); + } + + public override void Give(Exiled.API.Features.Player player, bool displayMessage = true) + { + Exiled.API.Features.Items.Item item = player.AddItem(Type); + if (item is Firearm firearm) + { + if (ClipSize > 0) + { + firearm.MagazineAmmo = ClipSize; + } } - return base.Spawn(spawns, limit - num); + Log.Debug(string.Format("{0}: Adding {1} to tracker.", "Give", item.Serial)); + base.TrackedSerials.Add(item.Serial); + OnAcquired(player, item, displayMessage); } protected override void ShowPickedUpMessage(Player player) { - KECustomItem.Message(this, player, true); + Message(this, player, true); } protected override void ShowSelectedMessage(Player player) { - KECustomItem.Message(this, player); + Message(this, player); } } diff --git a/KruacentExiled/KE.Items/Commands/Give.cs b/KruacentExiled/KE.Items/Commands/Give.cs new file mode 100644 index 00000000..da3d88f8 --- /dev/null +++ b/KruacentExiled/KE.Items/Commands/Give.cs @@ -0,0 +1,102 @@ +using CommandSystem; +using Exiled.API.Features; +using Exiled.API.Features.Pools; +using Exiled.CustomItems.API.Features; +using Exiled.Permissions.Extensions; +using KE.Items.API.Features; +using RemoteAdmin; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace KE.Items.Commands +{ + internal class Give : ICommand + { + public string Command => "give"; + + public string[] Aliases => ["g"]; + + public string Description => "give"; + + public bool Execute(ArraySegment arguments, ICommandSender sender, out string response) + { + if (!sender.CheckPermission("customitems.give")) + { + response = "Permission Denied, required: customitems.give"; + return false; + } + + if (arguments.Count == 0) + { + response = "give [Nickname/PlayerID/UserID/all/*]"; + return false; + } + + if (!KECustomItem.TryGet(arguments.At(0), out CustomItem item)) + { + response = $"Custom item {arguments.At(0)} not found!"; + return false; + } + + if (arguments.Count == 1) + { + if (sender is PlayerCommandSender playerCommandSender) + { + Player player = Player.Get(playerCommandSender.SenderId); + + if (!CheckEligible(player)) + { + response = "You cannot receive custom items!"; + return false; + } + + item?.Give(player); + response = $"{item?.Name} given to {player.Nickname} ({player.UserId})"; + return true; + } + + response = "Failed to provide a valid player, please follow the syntax."; + return false; + } + + string identifier = string.Join(" ", arguments.Skip(1)); + + switch (identifier) + { + case "*": + case "all": + List eligiblePlayers = Player.List.Where(CheckEligible).ToList(); + foreach (Player ply in eligiblePlayers) + item?.Give(ply); + + response = $"Custom item {item?.Name} given to all players who can receive them ({eligiblePlayers.Count} players)"; + return true; + default: + break; + } + + IEnumerable list = Player.GetProcessedData(arguments, 1); + + if (list.IsEmpty()) + { + response = "Cannot find player! Try using the player ID!"; + return false; + } + + foreach (Player player in list) + { + if (CheckEligible(player)) + { + item?.Give(player); + } + } + + response = $"{item?.Name} given to {list.Count()} players!"; + return true; + } + private bool CheckEligible(Player player) => player.IsAlive && !player.IsCuffed && (player.Items.Count < 8); + } +} diff --git a/KruacentExiled/KE.Items/Commands/KECustomItems.cs b/KruacentExiled/KE.Items/Commands/KECustomItems.cs new file mode 100644 index 00000000..f46e35d1 --- /dev/null +++ b/KruacentExiled/KE.Items/Commands/KECustomItems.cs @@ -0,0 +1,23 @@ +using CommandSystem; +using KE.CustomRoles.Commands.KECR; +using System; + +namespace KE.Items.Commands +{ + [CommandHandler(typeof(RemoteAdminCommandHandler))] + internal class KECustomItems : Utils.API.Commands.KEParentCommand + { + public override string Command => "keci"; + + public override string[] Aliases => []; + + public override string Description => "kecustom item parent command"; + + public override void LoadGeneratedCommands() + { + RegisterCommand(new List()); + RegisterCommand(new Give()); + } + + } +} diff --git a/KruacentExiled/KE.Items/Commands/List.cs b/KruacentExiled/KE.Items/Commands/List.cs new file mode 100644 index 00000000..614f030b --- /dev/null +++ b/KruacentExiled/KE.Items/Commands/List.cs @@ -0,0 +1,44 @@ +using CommandSystem; +using Exiled.API.Features.Pools; +using Exiled.CustomItems.API.Features; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace KE.Items.Commands +{ + internal class List : ICommand + { + public string Command => "list"; + + public string[] Aliases => ["l"]; + + public string Description => "list"; + + public bool Execute(ArraySegment arguments, ICommandSender sender, out string response) + { + + StringBuilder sb = StringBuilderPool.Pool.Get().AppendLine(); + + + + sb.Append("[Registered custom items (").Append(CustomItem.Registered.Count).AppendLine(")]"); + + foreach (CustomItem customItem in CustomItem.Registered.OrderBy(item => item.Name)) + { + sb.Append('['); + sb.Append(customItem.Name); + sb.Append(" ("); + sb.Append(customItem.Type); + sb.Append(')'); + sb.AppendLine("]"); + } + + + response = StringBuilderPool.Pool.ToStringReturn(sb); + return true; + } + } +} diff --git a/KruacentExiled/KE.Items/Items/Defibrilator.cs b/KruacentExiled/KE.Items/Items/Defibrilator.cs index 8e736b17..17311c70 100644 --- a/KruacentExiled/KE.Items/Items/Defibrilator.cs +++ b/KruacentExiled/KE.Items/Items/Defibrilator.cs @@ -13,10 +13,9 @@ using PlayerRoles; using MEC; -[CustomItem(ItemType.SCP1853)] public class Defibrillator : KECustomItem, ILumosItem { - public override uint Id { get; set; } = 1041; + public override ItemType ItemType => ItemType.SCP1853; public override string Name { get; set; } = "Defibrillator"; public override string Description { get; set; } = "Visez un cadavre de près pour tenter une réanimation."; public override float Weight { get; set; } = 1.0f; diff --git a/KruacentExiled/KE.Items/Items/DeployableWall.cs b/KruacentExiled/KE.Items/Items/DeployableWall.cs index 8507a963..4e02391c 100644 --- a/KruacentExiled/KE.Items/Items/DeployableWall.cs +++ b/KruacentExiled/KE.Items/Items/DeployableWall.cs @@ -11,11 +11,10 @@ namespace KE.Items.Items { - [CustomItem(ItemType.KeycardJanitor)] public class DeployableWall : KECustomItem, ILumosItem, ISwichableEffect { - - public override uint Id { get; set; } = 1048; + + public override ItemType ItemType => ItemType.KeycardJanitor; public override string Name { get; set; } = "Deployable Wall"; public override string Description { get; set; } = "Drop to deploy a wall, and throw to just throw the card"; public override float Weight { get; set; } = 0.65f; diff --git a/KruacentExiled/KE.Items/Items/DivinePills.cs b/KruacentExiled/KE.Items/Items/DivinePills.cs index 2bfe2dda..a837c3f1 100644 --- a/KruacentExiled/KE.Items/Items/DivinePills.cs +++ b/KruacentExiled/KE.Items/Items/DivinePills.cs @@ -11,12 +11,11 @@ using KE.Items.Items.ItemEffects; using KE.Items.API.Features; -/// -[CustomItem(ItemType.Painkillers)] public class DivinePills : KECustomItem, ILumosItem, ISwichableEffect, IUpgradableCustomItem { /// - public override uint Id { get; set; } = 1047; + + public override ItemType ItemType => ItemType.Painkillers; /// public override string Name { get; set; } = "Divine Pills"; diff --git a/KruacentExiled/KE.Items/Items/FriendMaker.cs b/KruacentExiled/KE.Items/Items/FriendMaker.cs index 869fa029..00ad728c 100644 --- a/KruacentExiled/KE.Items/Items/FriendMaker.cs +++ b/KruacentExiled/KE.Items/Items/FriendMaker.cs @@ -4,6 +4,7 @@ using Exiled.Events.EventArgs.Player; using HintServiceMeow.UI.Utilities; using KE.Items.API.Features; +using KE.Utils.API.Features; using PlayerRoles; using System; using System.Collections.Generic; @@ -16,20 +17,18 @@ namespace KE.Items.Items { - [CustomItem(ItemType.GunCOM15)] public class FriendMaker : KECustomWeapon { - public override uint Id { get; set; } = 8520; - public override string Name { get; set; } = "Friend Maker"; + + public override ItemType ItemType => ItemType.GunCOM15; + public override string Name { get; set; } = "FriendMaker"; public override string Description { get; set; } = "The number one (1) method to make friends"; public override float Weight { get; set; } = 1f; public override SpawnProperties SpawnProperties { get; set; } = null; - public override byte ClipSize { get; set; } = 1; + public override byte ClipSize { get; } = 1; - public override bool FriendlyFire { get; set; } = true; - private Dictionary cooldowns; private TimeSpan Cooldown = new(0,1,0); @@ -48,6 +47,8 @@ protected override void UnsubscribeEvents() protected override void OnShooting(ShootingEventArgs ev) { + + KELog.Debug("firne dmaker"); Player player = ev.Player; if (!Check(player)) return; if (!ev.IsAllowed) return; diff --git a/KruacentExiled/KE.Items/Items/HealZone.cs b/KruacentExiled/KE.Items/Items/HealZone.cs index 4bdae044..410c1277 100644 --- a/KruacentExiled/KE.Items/Items/HealZone.cs +++ b/KruacentExiled/KE.Items/Items/HealZone.cs @@ -12,15 +12,15 @@ namespace KE.Items.Items { - [CustomItem(ItemType.GrenadeFlash)] public class HealZone : KECustomGrenade, ILumosItem, ISwichableEffect, IUpgradableCustomItem { - public override uint Id { get; set; } = 1051; + + public override ItemType ItemType => ItemType.GrenadeFlash; public override string Name { get; set; } = "Heal Zone"; public override string Description { get; set; } = "Allow to heal you and your ally"; - public override float Weight { get; set; } = 0.65f; - public override float FuseTime { get; set; } = 5f; - public override bool ExplodeOnCollision { get; set; } = true; + public override float Weight => 0.65f; + public override float FuseTime => 5f; + public override bool ExplodeOnCollision => true; public UnityEngine.Color Color { get; set; } = UnityEngine.Color.green; public CustomItemEffect Effect { get; set; } public override SpawnProperties SpawnProperties { get; set; } = new SpawnProperties() @@ -76,7 +76,7 @@ public HealZone() Effect = new HealZoneEffect(); } - protected override void OnExploding(ExplodingGrenadeEventArgs ev) + protected override void OnExplodingGrenade(ExplodingGrenadeEventArgs ev) { Effect.Effect(ev); diff --git a/KruacentExiled/KE.Items/Items/ImpactFlash.cs b/KruacentExiled/KE.Items/Items/ImpactFlash.cs index fa88e150..f40ae63c 100644 --- a/KruacentExiled/KE.Items/Items/ImpactFlash.cs +++ b/KruacentExiled/KE.Items/Items/ImpactFlash.cs @@ -7,15 +7,15 @@ namespace KE.Items.Items { - [CustomItem(ItemType.GrenadeFlash)] public class ImpactFlash : KECustomGrenade { - public override uint Id { get; set; } = 1052; + + public override ItemType ItemType => ItemType.GrenadeFlash; public override string Name { get; set; } = "Impact Flash"; public override string Description { get; set; } = "The grenade explode at impact"; public override float Weight { get; set; } = 0.65f; - public override float FuseTime { get; set; } = 3f; - public override bool ExplodeOnCollision { get; set; } = true; + public override float FuseTime => 3f; + public override bool ExplodeOnCollision => true; public override SpawnProperties SpawnProperties { get; set; } = new SpawnProperties() { Limit = 5, diff --git a/KruacentExiled/KE.Items/Items/LeSoleil/LeSoleil.cs b/KruacentExiled/KE.Items/Items/LeSoleil/LeSoleil.cs index 5c993a0f..cfe9636e 100644 --- a/KruacentExiled/KE.Items/Items/LeSoleil/LeSoleil.cs +++ b/KruacentExiled/KE.Items/Items/LeSoleil/LeSoleil.cs @@ -19,17 +19,16 @@ using System.Threading.Tasks; using UnityEngine; -namespace KE.Items.Items.LeSoleil -{ - [CustomItem(ItemType.GrenadeFlash)] +namespace KE.Items.Items.LeSoleil +{ public class LeSoleil : KECustomGrenade, IUpgradableCustomItem { - public override uint Id { get; set; } = 9999; + public override ItemType ItemType => ItemType.GrenadeFlash; public override string Name { get; set; } = "Le Soleil"; public override string Description { get; set; } = "Probably not the best idea to use it"; public override float Weight { get; set; } = 0.65f; - public override float FuseTime { get; set; } = 5f; - public override bool ExplodeOnCollision { get; set; } = true; + public override float FuseTime =>5f; + public override bool ExplodeOnCollision =>true; public IReadOnlyDictionary Upgrade => new Dictionary() { @@ -41,7 +40,7 @@ public class LeSoleil : KECustomGrenade, IUpgradableCustomItem }; - protected override void OnExploding(ExplodingGrenadeEventArgs ev) + protected override void OnExplodingGrenade(ExplodingGrenadeEventArgs ev) { CastTheSun(); } diff --git a/KruacentExiled/KE.Items/Items/LowGravityGrenade.cs b/KruacentExiled/KE.Items/Items/LowGravityGrenade.cs index 3f485bb2..47459f23 100644 --- a/KruacentExiled/KE.Items/Items/LowGravityGrenade.cs +++ b/KruacentExiled/KE.Items/Items/LowGravityGrenade.cs @@ -11,15 +11,15 @@ namespace KE.Items.Items { - [CustomItem(ItemType.GrenadeHE)] public class LowGravityGrenade : KECustomGrenade, ISwichableEffect { - public override uint Id { get; set; } = 1072; + + public override ItemType ItemType => ItemType.GrenadeHE; public override string Name { get; set; } = "Low Gravity Grenade"; - public override string Description { get; set; } = "You always wanna be on the moon, if the answer is yes this grenade will grant your wishes !"; + public override string Description { get; set; } = "You always wanna be on the moon, if the answer is yes this grenade will grant your wishes!"; public override float Weight { get; set; } = 0.65f; - public override float FuseTime { get; set; } = 3f; - public override bool ExplodeOnCollision { get; set; } = false; + public override float FuseTime => 3f; + public override bool ExplodeOnCollision => false; public UnityEngine.Color Color { get; set; } = UnityEngine.Color.gray; public CustomItemEffect Effect { get; set; } public override SpawnProperties SpawnProperties { get; set; } = new SpawnProperties() @@ -56,7 +56,7 @@ public LowGravityGrenade() Effect = new LowGravityGrenadeEffect(); } - protected override void OnExploding(ExplodingGrenadeEventArgs ev) + protected override void OnExplodingGrenade(ExplodingGrenadeEventArgs ev) { Effect.Effect(ev); ev.TargetsToAffect.Clear(); diff --git a/KruacentExiled/KE.Items/Items/MScan.cs b/KruacentExiled/KE.Items/Items/MScan.cs index cbc57c50..4dafb1d5 100644 --- a/KruacentExiled/KE.Items/Items/MScan.cs +++ b/KruacentExiled/KE.Items/Items/MScan.cs @@ -17,10 +17,9 @@ namespace KE.Items.Items { - [CustomItem(ItemType.Flashlight)] public class MScan : KECustomItem { - public override uint Id { get; set; } = 2090; + public override ItemType ItemType => ItemType.Flashlight; public override string Name { get; set; } = "M-Scan"; public override string Description { get; set; } = "Détecte les mouvements des personnes passant devant"; public override float Weight { get; set; } = 1.5f; diff --git a/KruacentExiled/KE.Items/Items/Mine.cs b/KruacentExiled/KE.Items/Items/Mine.cs index 05bbd0aa..ad5a2035 100644 --- a/KruacentExiled/KE.Items/Items/Mine.cs +++ b/KruacentExiled/KE.Items/Items/Mine.cs @@ -11,10 +11,10 @@ namespace KE.Items.Items { - [Exiled.API.Features.Attributes.CustomItem(ItemType.KeycardJanitor)] - public class Mine : KECustomItem, ISwichableEffect/*, ICustomPickupModel*/ + public class Mine : KECustomItem, ISwichableEffect, ICustomPickupModel { - public override uint Id { get; set; } = 1053; + + public override ItemType ItemType => ItemType.KeycardJanitor; public override string Name { get; set; } = "Mine"; public override string Description { get; set; } = "Drop to deploy the mine, little advice : don't step on it"; public override float Weight { get; set; } = 0.65f; @@ -81,7 +81,7 @@ protected override void SubscribeEvents() protected override void UnsubscribeEvents() { - //PickupModel.UnsubscribeEvents(); + PickupModel.UnsubscribeEvents(); base.UnsubscribeEvents(); } diff --git a/KruacentExiled/KE.Items/Items/Molotov.cs b/KruacentExiled/KE.Items/Items/Molotov.cs index ff0f5045..80a5640e 100644 --- a/KruacentExiled/KE.Items/Items/Molotov.cs +++ b/KruacentExiled/KE.Items/Items/Molotov.cs @@ -16,15 +16,14 @@ namespace KE.Items.Items { - [CustomItem(ItemType.GrenadeFlash)] public class Molotov : KECustomGrenade, ISwichableEffect, ICustomPickupModel, IUpgradableCustomItem { - public override uint Id { get; set; } = 1049; + public override ItemType ItemType => ItemType.GrenadeFlash; public override string Name { get; set; } = "Cocktail Molotov"; public override string Description { get; set; } = "ARSON"; public override float Weight { get; set; } = 0.65f; - public override float FuseTime { get; set; } = 5f; - public override bool ExplodeOnCollision { get; set; } = true; + public override float FuseTime => 5f; + public override bool ExplodeOnCollision => true; public Color Color { get; set; } = Color.yellow; public CustomItemEffect Effect { get; set; } public PickupModel PickupModel { get; } @@ -89,7 +88,7 @@ private void PickingItem(PickingUpItemEventArgs ev) } } - protected override void OnExploding(ExplodingGrenadeEventArgs ev) + protected override void OnExplodingGrenade(ExplodingGrenadeEventArgs ev) { Effect.Effect(ev); ev.TargetsToAffect.Clear(); diff --git a/KruacentExiled/KE.Items/Items/PressePuree.cs b/KruacentExiled/KE.Items/Items/PressePuree.cs index 59f923d5..ab6bdf24 100644 --- a/KruacentExiled/KE.Items/Items/PressePuree.cs +++ b/KruacentExiled/KE.Items/Items/PressePuree.cs @@ -19,15 +19,16 @@ namespace KE.Items.Items { - [CustomItem(ItemType.GrenadeHE)] public class PressePuree : KECustomGrenade, IUpgradableCustomItem, ICustomPickupModel { - public override uint Id { get; set; } = 1046; - public override string Name { get; set; } = "Presse Purée"; - public override string Description { get; set; } = "THIS ITEM DOESNT CURRENTLY DO DAMAGE !!!!!!\nThe grenade explode at impact but does less damage"; + public override string Name { get; set; } = "PressePuree"; + + public override ItemType ItemType => ItemType.GrenadeHE; + public override string Description { get; set; } = "The grenade explode at impact but does less damage"; public override float Weight { get; set; } = 0.65f; - public override float FuseTime { get; set; } = 5f; - public override bool ExplodeOnCollision { get; set; } = true; + public override float FuseTime => 5f; + public override bool ExplodeOnCollision => true; + public override float DamageModifier => .3f; public PickupModel PickupModel { get; } public override SpawnProperties SpawnProperties { get; set; } = new SpawnProperties() { @@ -66,26 +67,26 @@ public PressePuree() protected override void SubscribeEvents() { PickupModel.SubscribeEvents(); - ExplodeEvent.ExplodeDestructible += OnExplodeDestructible; base.SubscribeEvents(); } protected override void UnsubscribeEvents() { PickupModel.UnsubscribeEvents(); - ExplodeEvent.ExplodeDestructible -= OnExplodeDestructible; base.UnsubscribeEvents(); } - private void OnExplodeDestructible(OnExplodeDestructibleEventsArgs ev) + + + + protected override void OnExplodeDestructible(OnExplodeDestructibleEventsArgs ev) { KELog.Debug("old dmagea="+ev.Damage); Player player = Player.Get(ev.Destructible.NetworkId); - if (!Check(Projectile.Get(ev.ExplosionGrenade))) return; + if (!Check(ev.ExplosionGrenade)) return; - if (ev.Damage < 0f) return; - ev.Damage /= 2f; + if (ev.Damage <= 0f) return; if (player is not null && player.IsScp) { diff --git a/KruacentExiled/KE.Items/Items/ProximityGrenade.cs b/KruacentExiled/KE.Items/Items/ProximityGrenade.cs index a207265e..084a325b 100644 --- a/KruacentExiled/KE.Items/Items/ProximityGrenade.cs +++ b/KruacentExiled/KE.Items/Items/ProximityGrenade.cs @@ -10,15 +10,15 @@ namespace KE.Items.Items { - [CustomItem(ItemType.GrenadeFlash)] public class ProximityGrenade : KECustomGrenade, ISwichableEffect { - public override uint Id { get; set; } = 1073; + + public override ItemType ItemType => ItemType.GrenadeFlash; public override string Name { get; set; } = "Proximity Grenade"; public override string Description { get; set; } = "Show lines to all players around 3 rooms"; public override float Weight { get; set; } = 0.65f; - public override float FuseTime { get; set; } = 3f; - public override bool ExplodeOnCollision { get; set; } = false; + public override float FuseTime => 3f; + public override bool ExplodeOnCollision => false; public UnityEngine.Color Color { get; set; } = UnityEngine.Color.red; public CustomItemEffect Effect { get; set; } public override SpawnProperties SpawnProperties { get; set; } = new SpawnProperties() @@ -41,7 +41,7 @@ public ProximityGrenade() Effect = new ProximityGrenadeEffect(); } - protected override void OnExploding(ExplodingGrenadeEventArgs ev) + protected override void OnExplodingGrenade(ExplodingGrenadeEventArgs ev) { Effect.Effect(ev); ev.TargetsToAffect.Clear(); diff --git a/KruacentExiled/KE.Items/Items/RedbullEnergy.cs b/KruacentExiled/KE.Items/Items/RedbullEnergy.cs index 601c9b12..acbac876 100644 --- a/KruacentExiled/KE.Items/Items/RedbullEnergy.cs +++ b/KruacentExiled/KE.Items/Items/RedbullEnergy.cs @@ -10,10 +10,9 @@ namespace KE.Items.Items { - [CustomItem(ItemType.SCP207)] public class RedbullEnergy : KECustomItem, ISwichableEffect { - public override uint Id { get; set; } = 1042; + public override ItemType ItemType => ItemType.SCP207; public override string Name { get; set; } = "RedBull Energy"; public override string Description { get; set; } = "RedBull donne des ailes ! Attention à la chute !!!"; public override float Weight { get; set; } = 0.65f; diff --git a/KruacentExiled/KE.Items/Items/SainteGrenada.cs b/KruacentExiled/KE.Items/Items/SainteGrenada.cs index 2b09d842..90f16a98 100644 --- a/KruacentExiled/KE.Items/Items/SainteGrenada.cs +++ b/KruacentExiled/KE.Items/Items/SainteGrenada.cs @@ -19,16 +19,16 @@ namespace KE.Items.Items { - [CustomItem(ItemType.GrenadeHE)] public class SainteGrenada : KECustomGrenade, ICustomPickupModel { - public override uint Id { get; set; } = 1055; + + public override ItemType ItemType => ItemType.GrenadeHE; public override string Name { get; set; } = "Sainte Grenada"; public override string Description { get; set; } = "Worms reference !?"; public override float Weight { get; set; } = 1.5f; - public override float FuseTime { get; set; } = 6f; - public override bool ExplodeOnCollision { get; set; } = false; - public override float DamageModifier { get; set; } = 3f; + public override float FuseTime => 6f; + public override bool ExplodeOnCollision => false; + public override float DamageModifier => 3f; public Color Color { get; set; } = Color.red; @@ -68,7 +68,7 @@ protected override void OnThrownProjectile(ThrownProjectileEventArgs ev) { Utils.API.Sounds.SoundPlayer.Instance.Play("worms", ev.Projectile.Position, 50,20f); } - protected override void OnExploding(ExplodingGrenadeEventArgs ev) + protected override void OnExplodingGrenade(ExplodingGrenadeEventArgs ev) { ev.Projectile.Scale = new Vector3(GrenadeSize, GrenadeSize, GrenadeSize); diff --git a/KruacentExiled/KE.Items/Items/Scp1650.cs b/KruacentExiled/KE.Items/Items/Scp1650.cs index 7dc127bc..73a95fc7 100644 --- a/KruacentExiled/KE.Items/Items/Scp1650.cs +++ b/KruacentExiled/KE.Items/Items/Scp1650.cs @@ -11,10 +11,10 @@ namespace KE.Items.Items { - [CustomItem(ItemType.Painkillers)] public class Scp1650 : KECustomItem, ISwichableEffect { - public override uint Id { get; set; } = 1056; + public override ItemType ItemType => ItemType.Painkillers; + public override string Name { get; set; } = "SCP-1650"; public override string Description { get; set; } = "ויאמר ה' ל— סח השמן על בשרך ולך בינות ה— כששם אלוהים על שפתיך, וזעם ה' וחרון אפו ו— דם המכבים יטהר בית מקדשו אחריך, לנצח נצחים"; public override float Weight { get; set; } = 0.65f; diff --git a/KruacentExiled/KE.Items/Items/Scp3136.cs b/KruacentExiled/KE.Items/Items/Scp3136.cs index a8387d38..9515adee 100644 --- a/KruacentExiled/KE.Items/Items/Scp3136.cs +++ b/KruacentExiled/KE.Items/Items/Scp3136.cs @@ -13,10 +13,9 @@ namespace KE.Items.Items { - [CustomItem(ItemType.SCP1576)] public class Scp3136 : KECustomItem/*, ICustomPickupModel*/ { - public override uint Id { get; set; } = 1057; + public override ItemType ItemType => ItemType.SCP1576; public override string Name { get; set; } = "SCP-3136"; public override string Description { get; set; } = "A map of the facility, you could draw your friends next to you"; public override float Weight { get; set; } = 0.65f; diff --git a/KruacentExiled/KE.Items/Items/Scp514.cs b/KruacentExiled/KE.Items/Items/Scp514.cs index 15af312d..b8eddb28 100644 --- a/KruacentExiled/KE.Items/Items/Scp514.cs +++ b/KruacentExiled/KE.Items/Items/Scp514.cs @@ -18,10 +18,9 @@ namespace KE.Items.Items { - [CustomItem(ItemType.Flashlight)] public class Scp514 : KECustomItem { - public override uint Id { get; set; } = 1070; + public override ItemType ItemType => ItemType.Flashlight; public override string Name { get; set; } = "SCP-514"; public override string Description { get; set; } = "birb"; public override float Weight { get; set; } = 0.65f; diff --git a/KruacentExiled/KE.Items/Items/SmokeGrenade.cs b/KruacentExiled/KE.Items/Items/SmokeGrenade.cs index 3f372cde..b6fda270 100644 --- a/KruacentExiled/KE.Items/Items/SmokeGrenade.cs +++ b/KruacentExiled/KE.Items/Items/SmokeGrenade.cs @@ -10,15 +10,14 @@ namespace KE.Items.Items { - [CustomItem(ItemType.GrenadeFlash)] public class SmokeGrenade : KECustomGrenade, ISwichableEffect { - public override uint Id { get; set; } = 1071; + public override ItemType ItemType => ItemType.GrenadeFlash; public override string Name { get; set; } = "Smoke Grenade"; public override string Description { get; set; } = "We finally put your grandma inside this thing ! Don't throw it or she will get out !"; public override float Weight { get; set; } = 0.65f; - public override float FuseTime { get; set; } = 3f; - public override bool ExplodeOnCollision { get; set; } = false; + public override float FuseTime => 3f; + public override bool ExplodeOnCollision => false; public UnityEngine.Color Color { get; set; } = UnityEngine.Color.black; public CustomItemEffect Effect { get; set; } public override SpawnProperties SpawnProperties { get; set; } = new SpawnProperties() @@ -45,7 +44,7 @@ public SmokeGrenade() Effect = new SmokeGrenadeEffect(); } - protected override void OnExploding(ExplodingGrenadeEventArgs ev) + protected override void OnExplodingGrenade(ExplodingGrenadeEventArgs ev) { Effect.Effect(ev); ev.TargetsToAffect.Clear(); diff --git a/KruacentExiled/KE.Items/Items/TPGrenada.cs b/KruacentExiled/KE.Items/Items/TPGrenada.cs index 32cf92d2..5d1c215e 100644 --- a/KruacentExiled/KE.Items/Items/TPGrenada.cs +++ b/KruacentExiled/KE.Items/Items/TPGrenada.cs @@ -12,16 +12,16 @@ namespace KE.Items.Items { - [CustomItem(ItemType.GrenadeHE)] public class TPGrenada : KECustomGrenade, ISwichableEffect, ICustomPickupModel { - - public override uint Id { get; set; } = 1045; + + + public override ItemType ItemType => ItemType.GrenadeHE; public override string Name { get; set; } = "Teleportation Grenade"; public override string Description { get; set; } = "This grenade does 0 damage but teleport nearby players in a random place (does work in other dimension ;3 )"; public override float Weight { get; set; } = 0.65f; - public override float FuseTime { get; set; } = 3f; - public override bool ExplodeOnCollision { get; set; } = false; + public override float FuseTime => 3f; + public override bool ExplodeOnCollision => false; public UnityEngine.Color Color { get; set; } = UnityEngine.Color.cyan; public CustomItemEffect Effect { get; set; } public override SpawnProperties SpawnProperties { get; set; } = new SpawnProperties() @@ -61,7 +61,7 @@ public TPGrenada() PickupModel = new TPGrenadaPModel(this); } - protected override void OnExploding(ExplodingGrenadeEventArgs ev) + protected override void OnExplodingGrenade(ExplodingGrenadeEventArgs ev) { Effect.Effect(ev); ev.TargetsToAffect.Clear(); diff --git a/KruacentExiled/KE.Items/Items/TrueDivinePills.cs b/KruacentExiled/KE.Items/Items/TrueDivinePills.cs index 75a547b9..79898e00 100644 --- a/KruacentExiled/KE.Items/Items/TrueDivinePills.cs +++ b/KruacentExiled/KE.Items/Items/TrueDivinePills.cs @@ -12,11 +12,11 @@ using KE.Items.API.Features; /// -[CustomItem(ItemType.SCP500)] public class TrueDivinePills : KECustomItem, ILumosItem { /// - public override uint Id { get; set; } = 1050; + + public override ItemType ItemType => ItemType.SCP500; /// public override string Name { get; set; } = "True Divine Pills"; diff --git a/KruacentExiled/KE.Items/MainPlugin.cs b/KruacentExiled/KE.Items/MainPlugin.cs index 0ccf0e5f..12eac3ee 100644 --- a/KruacentExiled/KE.Items/MainPlugin.cs +++ b/KruacentExiled/KE.Items/MainPlugin.cs @@ -4,15 +4,19 @@ using Exiled.API.Features; using Exiled.API.Features.Toys; using Exiled.CustomItems.API.Features; +using Exiled.Events.EventArgs.Map; +using Exiled.Events.EventArgs.Player; using HarmonyLib; using InventorySystem.Items.ThrowableProjectiles; using KE.Items.API.Core.Lights; using KE.Items.API.Core.Settings; using KE.Items.API.Core.Upgrade; using KE.Items.API.Events; +using KE.Items.API.Features; using KE.Items.API.Features.Complexes; using KE.Items.API.Features.SpawnPoints; using KE.Utils.API.Displays.DisplayMeow; +using KE.Utils.API.Features; using System; using System.Linq; using UnityEngine; @@ -89,8 +93,8 @@ public override void OnEnabled() //Exiled.Events.Handlers.Server.RoundStarted += Test; - - CustomItem.RegisterItems(); + + KECustomItem.RegisterItems(); //PickupQuality?.SubscribeEvents(); SettingsHandler.SubscribeEvents(); UpgradeHandler.SubscribeEvents(); @@ -101,14 +105,13 @@ public override void OnEnabled() public override void OnDisabled() { - CustomItem.UnregisterItems(); + KECustomItem.UnregisterItems(); UpgradeHandler?.UnsubscribeEvents(); LightsHandler?.UnsubscribeEvents(); //PickupQuality?.UnsubscribeEvents(); //QualityHandler?.Unregister(); SettingsHandler.UnsubscribeEvents(); Exiled.Events.Handlers.Map.Generated -= OnGenerated; - //Exiled.Events.Handlers.Server.RoundStarted -= Test; //QualityHandler = null; @@ -137,6 +140,5 @@ public void Test() } - } } \ No newline at end of file From 88cded5d4d5bed7ad431e067ec806a0d5716f575 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Tue, 3 Mar 2026 19:55:34 +0100 Subject: [PATCH 702/853] fixed legacy for gamble addict --- KruacentExiled/KE.CustomRoles/CR/Scientist/GambleAddict.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/KruacentExiled/KE.CustomRoles/CR/Scientist/GambleAddict.cs b/KruacentExiled/KE.CustomRoles/CR/Scientist/GambleAddict.cs index 7c63c12d..d0f50ed7 100644 --- a/KruacentExiled/KE.CustomRoles/CR/Scientist/GambleAddict.cs +++ b/KruacentExiled/KE.CustomRoles/CR/Scientist/GambleAddict.cs @@ -26,7 +26,7 @@ protected override Dictionary> SetTranslation [TranslationKeyName] = "Accro du casino", [TranslationKeyDesc] = "T'as trade ton kit et ta carte contre 2 pièces \nfais en bon usage", }, - ["en"] = new() + ["legacy"] = new() { [TranslationKeyName] = "Gamble Addict", [TranslationKeyDesc] = "T'as trade ton kit et ta carte contre 2 pièces \nfais en bon usage", From 42a469530675c8dbf3d2dd25e40068dfbf1ae3b0 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Tue, 3 Mar 2026 21:11:09 +0100 Subject: [PATCH 703/853] translation --- .../KE.Items/API/Features/KECustomItem.cs | 68 +++++++++++++++++-- KruacentExiled/KE.Items/Items/Defibrilator.cs | 16 +++++ .../KE.Items/Items/DeployableWall.cs | 17 ++++- KruacentExiled/KE.Items/Items/DivinePills.cs | 20 +++++- KruacentExiled/KE.Items/Items/FriendMaker.cs | 20 +++++- KruacentExiled/KE.Items/Items/HealZone.cs | 19 +++++- KruacentExiled/KE.Items/Items/ImpactFlash.cs | 19 +++++- .../KE.Items/Items/LeSoleil/LeSoleil.cs | 18 ++++- .../KE.Items/Items/LowGravityGrenade.cs | 19 +++++- KruacentExiled/KE.Items/Items/MScan.cs | 24 +++++-- KruacentExiled/KE.Items/Items/Mine.cs | 17 ++++- KruacentExiled/KE.Items/Items/Molotov.cs | 20 +++++- KruacentExiled/KE.Items/Items/PressePuree.cs | 16 +++++ .../KE.Items/Items/ProximityGrenade.cs | 22 +++++- .../KE.Items/Items/RedbullEnergy.cs | 20 +++++- .../KE.Items/Items/SainteGrenada.cs | 21 +++++- KruacentExiled/KE.Items/Items/Scp1650.cs | 16 +++++ KruacentExiled/KE.Items/Items/Scp3136.cs | 16 +++++ KruacentExiled/KE.Items/Items/Scp514.cs | 16 +++++ KruacentExiled/KE.Items/Items/SmokeGrenade.cs | 16 +++++ KruacentExiled/KE.Items/Items/TPGrenada.cs | 17 ++++- .../KE.Items/Items/TrueDivinePills.cs | 32 ++++++--- 22 files changed, 426 insertions(+), 43 deletions(-) diff --git a/KruacentExiled/KE.Items/API/Features/KECustomItem.cs b/KruacentExiled/KE.Items/API/Features/KECustomItem.cs index 8f6da534..9ae99da4 100644 --- a/KruacentExiled/KE.Items/API/Features/KECustomItem.cs +++ b/KruacentExiled/KE.Items/API/Features/KECustomItem.cs @@ -8,6 +8,7 @@ using KE.Items.API.Features.SpawnPoints; using KE.Items.API.Interface; using KE.Utils.API.Displays.DisplayMeow; +using KE.Utils.API.Translations; using PlayerRoles.SpawnData; using System; using System.Collections.Generic; @@ -47,7 +48,53 @@ public sealed override ItemType Type } } + public const string CustomItemNameKey = "Name"; + public const string CustomItemDescriptionKey = "Desc"; + public string TranslationKeyName => Name + "_" + CustomItemNameKey; + public string TranslationKeyDesc => Name + "_" + CustomItemDescriptionKey; + public const string CustomItemTranslationId = "CustomItem"; + protected abstract Dictionary> SetTranslation(); + + + public const string PickupKey = "Pickup"; + public const string InventoryKey = "Inventory"; + + private Dictionary> GetBasicTranslation() + { + return new() + { + ["en"] = new() + { + [PickupKey] = "You've picked up ", + [InventoryKey] = "You've selected ", + }, + ["fr"] = new() + { + [PickupKey] = "Tu as pris ", + [InventoryKey] = "Tu as selectionné ", + }, + }; + } + + private void OneTimeInit() + { + if (init) return; + + var trans = GetBasicTranslation(); + TranslationHub.Add(CustomItemTranslationId, trans); + init = true; + } + private bool init = false; + + public static string GetTranslation(Player player, string key) + { + return TranslationHub.Get(player, CustomItemTranslationId, key); + } + public static string GetTranslation(string lang, string key) + { + return TranslationHub.Get(lang, CustomItemTranslationId, key); + } public override void Init() { @@ -56,6 +103,11 @@ public override void Init() _nameLookup.Add(Name, this); SubscribeEvents(); + + OneTimeInit(); + + var translate = SetTranslation(); + TranslationHub.Add(CustomItemTranslationId, translate); } @@ -88,13 +140,11 @@ public static bool TryGet(string name, out KECustomItem item) protected override void ShowPickedUpMessage(Player player) { - Log.Debug("pickup"); Message(this, player, true); } protected override void ShowSelectedMessage(Player player) { - Log.Debug("select"); Message(this, player); } @@ -156,9 +206,11 @@ public void ReplacePickup(Pickup pickup) internal static void Message(CustomItem c, Player player, bool pickedUp = false) { - + KECustomItem kECustomItem = c as KECustomItem; StringBuilder builder = StringBuilderPool.Pool.Get(); + string lang = TranslationHub.GetLang(player); + if (MainPlugin.Instance.SettingsHandler.GetPrefixes(player)) { if (pickedUp) @@ -174,21 +226,23 @@ internal static void Message(CustomItem c, Player player, bool pickedUp = false) { if (pickedUp) { - builder.Append("You've picked up "); + builder.Append(TranslationHub.Get(lang,CustomItemTranslationId,PickupKey)); } else { - builder.Append("You've selected "); + builder.Append(TranslationHub.Get(lang, CustomItemTranslationId, InventoryKey)); } } - builder.AppendLine($"{c.Name}"); + builder.Append(""); + builder.Append(TranslationHub.Get(lang, CustomItemTranslationId, kECustomItem.TranslationKeyName)); + builder.AppendLine(""); bool desc = MainPlugin.Instance.SettingsHandler.GetDescriptionsSettings(player); if (desc) { - builder.AppendLine(c.Description); + builder.Append(TranslationHub.Get(lang, CustomItemTranslationId, kECustomItem.TranslationKeyDesc)); if (c is IUpgradableCustomItem ci) { builder.Append(""); diff --git a/KruacentExiled/KE.Items/Items/Defibrilator.cs b/KruacentExiled/KE.Items/Items/Defibrilator.cs index 17311c70..a6bff28a 100644 --- a/KruacentExiled/KE.Items/Items/Defibrilator.cs +++ b/KruacentExiled/KE.Items/Items/Defibrilator.cs @@ -15,6 +15,22 @@ public class Defibrillator : KECustomItem, ILumosItem { + protected override Dictionary> SetTranslation() + { + return new() + { + ["en"] = new() + { + [TranslationKeyName] = "Defibrillator", + [TranslationKeyDesc] = "Aim for a dead body to try to resuscitate him", + }, + ["fr"] = new() + { + [TranslationKeyName] = "Défibrillateur", + [TranslationKeyDesc] = "Visez un cadavre de près pour tenter une réanimation.", + }, + }; + } public override ItemType ItemType => ItemType.SCP1853; public override string Name { get; set; } = "Defibrillator"; public override string Description { get; set; } = "Visez un cadavre de près pour tenter une réanimation."; diff --git a/KruacentExiled/KE.Items/Items/DeployableWall.cs b/KruacentExiled/KE.Items/Items/DeployableWall.cs index 4e02391c..b4a98350 100644 --- a/KruacentExiled/KE.Items/Items/DeployableWall.cs +++ b/KruacentExiled/KE.Items/Items/DeployableWall.cs @@ -13,7 +13,22 @@ namespace KE.Items.Items { public class DeployableWall : KECustomItem, ILumosItem, ISwichableEffect { - + protected override Dictionary> SetTranslation() + { + return new() + { + ["en"] = new() + { + [TranslationKeyName] = "Deployable Wall", + [TranslationKeyDesc] = "Drop to deploy a wall", + }, + ["fr"] = new() + { + [TranslationKeyName] = "Mur", + [TranslationKeyDesc] = "Lâcher pour faire un mur", + }, + }; + } public override ItemType ItemType => ItemType.KeycardJanitor; public override string Name { get; set; } = "Deployable Wall"; public override string Description { get; set; } = "Drop to deploy a wall, and throw to just throw the card"; diff --git a/KruacentExiled/KE.Items/Items/DivinePills.cs b/KruacentExiled/KE.Items/Items/DivinePills.cs index a837c3f1..fb87afd5 100644 --- a/KruacentExiled/KE.Items/Items/DivinePills.cs +++ b/KruacentExiled/KE.Items/Items/DivinePills.cs @@ -13,15 +13,29 @@ public class DivinePills : KECustomItem, ILumosItem, ISwichableEffect, IUpgradableCustomItem { - /// - + protected override Dictionary> SetTranslation() + { + return new() + { + ["en"] = new() + { + [TranslationKeyName] = "Divine Pills", + [TranslationKeyDesc] = "25% chance you die\n 75% you respawn someone\n", + }, + ["fr"] = new() + { + [TranslationKeyName] = "Divine Pills", + [TranslationKeyDesc] = "25% de chance de mourrir\n 75% de ramener quelqu'un à la vie", + }, + }; + } public override ItemType ItemType => ItemType.Painkillers; /// public override string Name { get; set; } = "Divine Pills"; /// - public override string Description { get; set; } = "25% chance you die\n 75% you respawn someone\n"; + public override string Description { get; set; } = "A"; /// public override float Weight { get; set; } = 0.65f; diff --git a/KruacentExiled/KE.Items/Items/FriendMaker.cs b/KruacentExiled/KE.Items/Items/FriendMaker.cs index 00ad728c..0afeec90 100644 --- a/KruacentExiled/KE.Items/Items/FriendMaker.cs +++ b/KruacentExiled/KE.Items/Items/FriendMaker.cs @@ -19,10 +19,26 @@ namespace KE.Items.Items public class FriendMaker : KECustomWeapon { - + protected override Dictionary> SetTranslation() + { + return new() + { + ["en"] = new() + { + [TranslationKeyName] = "Friend Maker™", + [TranslationKeyDesc] = "The number one (1) method to make friends", + }, + ["fr"] = new() + { + [TranslationKeyName] = "Friend Maker™", + [TranslationKeyDesc] = "LA méthode pour se faire des amis ! Produit non remboursable", + }, + }; + } + public override ItemType ItemType => ItemType.GunCOM15; public override string Name { get; set; } = "FriendMaker"; - public override string Description { get; set; } = "The number one (1) method to make friends"; + public override string Description { get; set; } = ""; public override float Weight { get; set; } = 1f; public override SpawnProperties SpawnProperties { get; set; } = null; diff --git a/KruacentExiled/KE.Items/Items/HealZone.cs b/KruacentExiled/KE.Items/Items/HealZone.cs index 410c1277..b2e1b085 100644 --- a/KruacentExiled/KE.Items/Items/HealZone.cs +++ b/KruacentExiled/KE.Items/Items/HealZone.cs @@ -14,9 +14,24 @@ namespace KE.Items.Items { public class HealZone : KECustomGrenade, ILumosItem, ISwichableEffect, IUpgradableCustomItem { - + protected override Dictionary> SetTranslation() + { + return new() + { + ["en"] = new() + { + [TranslationKeyName] = "Heal Zone", + [TranslationKeyDesc] = "Allow to heal you and your ally", + }, + ["fr"] = new() + { + [TranslationKeyName] = "Heal Zone", + [TranslationKeyDesc] = "Créer une zone pour soigner", + }, + }; + } public override ItemType ItemType => ItemType.GrenadeFlash; - public override string Name { get; set; } = "Heal Zone"; + public override string Name { get; set; } = "HealZone"; public override string Description { get; set; } = "Allow to heal you and your ally"; public override float Weight => 0.65f; public override float FuseTime => 5f; diff --git a/KruacentExiled/KE.Items/Items/ImpactFlash.cs b/KruacentExiled/KE.Items/Items/ImpactFlash.cs index f40ae63c..45b5554b 100644 --- a/KruacentExiled/KE.Items/Items/ImpactFlash.cs +++ b/KruacentExiled/KE.Items/Items/ImpactFlash.cs @@ -9,9 +9,24 @@ namespace KE.Items.Items { public class ImpactFlash : KECustomGrenade { - + protected override Dictionary> SetTranslation() + { + return new() + { + ["en"] = new() + { + [TranslationKeyName] = "Impact Flash", + [TranslationKeyDesc] = "The name is self-explanatory", + }, + ["fr"] = new() + { + [TranslationKeyName] = "Impact Flash", + [TranslationKeyDesc] = "Une flashbang qui explose à l'impacte", + }, + }; + } public override ItemType ItemType => ItemType.GrenadeFlash; - public override string Name { get; set; } = "Impact Flash"; + public override string Name { get; set; } = "ImpactFlash"; public override string Description { get; set; } = "The grenade explode at impact"; public override float Weight { get; set; } = 0.65f; public override float FuseTime => 3f; diff --git a/KruacentExiled/KE.Items/Items/LeSoleil/LeSoleil.cs b/KruacentExiled/KE.Items/Items/LeSoleil/LeSoleil.cs index cfe9636e..2ba15cde 100644 --- a/KruacentExiled/KE.Items/Items/LeSoleil/LeSoleil.cs +++ b/KruacentExiled/KE.Items/Items/LeSoleil/LeSoleil.cs @@ -23,9 +23,25 @@ namespace KE.Items.Items.LeSoleil { public class LeSoleil : KECustomGrenade, IUpgradableCustomItem { + protected override Dictionary> SetTranslation() + { + return new() + { + ["en"] = new() + { + [TranslationKeyName] = "The Sun", + [TranslationKeyDesc] = "Probably not the best idea to use it", + }, + ["fr"] = new() + { + [TranslationKeyName] = "Le Soleil", + [TranslationKeyDesc] = "pas ouf", + }, + }; + } public override ItemType ItemType => ItemType.GrenadeFlash; public override string Name { get; set; } = "Le Soleil"; - public override string Description { get; set; } = "Probably not the best idea to use it"; + public override string Description { get; set; } = ""; public override float Weight { get; set; } = 0.65f; public override float FuseTime =>5f; public override bool ExplodeOnCollision =>true; diff --git a/KruacentExiled/KE.Items/Items/LowGravityGrenade.cs b/KruacentExiled/KE.Items/Items/LowGravityGrenade.cs index 47459f23..9b09dfdb 100644 --- a/KruacentExiled/KE.Items/Items/LowGravityGrenade.cs +++ b/KruacentExiled/KE.Items/Items/LowGravityGrenade.cs @@ -13,10 +13,25 @@ namespace KE.Items.Items { public class LowGravityGrenade : KECustomGrenade, ISwichableEffect { - + protected override Dictionary> SetTranslation() + { + return new() + { + ["en"] = new() + { + [TranslationKeyName] = "Low Gravity Grenade", + [TranslationKeyDesc] = "You always wanna be on the moon, if the answer is yes this grenade will grant your wishes!", + }, + ["fr"] = new() + { + [TranslationKeyName] = "Grenade basse gravité", + [TranslationKeyDesc] = "Pour aller attraper les étoiles", + }, + }; + } public override ItemType ItemType => ItemType.GrenadeHE; public override string Name { get; set; } = "Low Gravity Grenade"; - public override string Description { get; set; } = "You always wanna be on the moon, if the answer is yes this grenade will grant your wishes!"; + public override string Description { get; set; } = ""; public override float Weight { get; set; } = 0.65f; public override float FuseTime => 3f; public override bool ExplodeOnCollision => false; diff --git a/KruacentExiled/KE.Items/Items/MScan.cs b/KruacentExiled/KE.Items/Items/MScan.cs index 4dafb1d5..e3915a2c 100644 --- a/KruacentExiled/KE.Items/Items/MScan.cs +++ b/KruacentExiled/KE.Items/Items/MScan.cs @@ -19,8 +19,24 @@ namespace KE.Items.Items { public class MScan : KECustomItem { + protected override Dictionary> SetTranslation() + { + return new() + { + ["en"] = new() + { + [TranslationKeyName] = "M-Scan", + [TranslationKeyDesc] = "Detect movement", + }, + ["fr"] = new() + { + [TranslationKeyName] = "M-Scan", + [TranslationKeyDesc] = "Détecte les mouvements des personnes passant devant", + }, + }; + } public override ItemType ItemType => ItemType.Flashlight; - public override string Name { get; set; } = "M-Scan"; + public override string Name { get; set; } = "MScan"; public override string Description { get; set; } = "Détecte les mouvements des personnes passant devant"; public override float Weight { get; set; } = 1.5f; public Color Color { get; set; } = Color.cyan; @@ -106,7 +122,7 @@ private void OnSCP096Enraging(EnragingEventArgs ev) CheckDestruction(ev.Player.Position, 2f); } - + public const float TimeUp = 120; private void OnDroppedItem(DroppedItemEventArgs ev) { @@ -119,9 +135,9 @@ private void OnDroppedItem(DroppedItemEventArgs ev) if (!ActiveSensors.ContainsKey(pickup)) { ActiveSensors.Add(pickup, player); - BatteryLife[pickup] = Time.time + 300f; + BatteryLife[pickup] = Time.time + TimeUp; - KECustomItem.ItemEffectHint(player, "SCANNER DÉPLOYÉ\nBatterie: 5 minutes"); + KECustomItem.ItemEffectHint(player, $"SCANNER DÉPLOYÉ\nBatterie: {TimeUp} secondes"); } } diff --git a/KruacentExiled/KE.Items/Items/Mine.cs b/KruacentExiled/KE.Items/Items/Mine.cs index ad5a2035..e5ca1e40 100644 --- a/KruacentExiled/KE.Items/Items/Mine.cs +++ b/KruacentExiled/KE.Items/Items/Mine.cs @@ -13,7 +13,22 @@ namespace KE.Items.Items { public class Mine : KECustomItem, ISwichableEffect, ICustomPickupModel { - + protected override Dictionary> SetTranslation() + { + return new() + { + ["en"] = new() + { + [TranslationKeyName] = "Mine", + [TranslationKeyDesc] = "Drop to deploy the mine, little advice : don't step on it", + }, + ["fr"] = new() + { + [TranslationKeyName] = "Mine", + [TranslationKeyDesc] = "Une Mine ! Lâcher pour la déployer", + }, + }; + } public override ItemType ItemType => ItemType.KeycardJanitor; public override string Name { get; set; } = "Mine"; public override string Description { get; set; } = "Drop to deploy the mine, little advice : don't step on it"; diff --git a/KruacentExiled/KE.Items/Items/Molotov.cs b/KruacentExiled/KE.Items/Items/Molotov.cs index 80a5640e..1d3de004 100644 --- a/KruacentExiled/KE.Items/Items/Molotov.cs +++ b/KruacentExiled/KE.Items/Items/Molotov.cs @@ -18,9 +18,25 @@ namespace KE.Items.Items { public class Molotov : KECustomGrenade, ISwichableEffect, ICustomPickupModel, IUpgradableCustomItem { + protected override Dictionary> SetTranslation() + { + return new() + { + ["en"] = new() + { + [TranslationKeyName] = "Molotov Cocktail", + [TranslationKeyDesc] = "ARSON", + }, + ["fr"] = new() + { + [TranslationKeyName] = "Cocktail Molotov", + [TranslationKeyDesc] = "La meilleur arme contre un blindé", + }, + }; + } public override ItemType ItemType => ItemType.GrenadeFlash; - public override string Name { get; set; } = "Cocktail Molotov"; - public override string Description { get; set; } = "ARSON"; + public override string Name { get; set; } = "CocktailMolotov"; + public override string Description { get; set; } = ""; public override float Weight { get; set; } = 0.65f; public override float FuseTime => 5f; public override bool ExplodeOnCollision => true; diff --git a/KruacentExiled/KE.Items/Items/PressePuree.cs b/KruacentExiled/KE.Items/Items/PressePuree.cs index ab6bdf24..b4bb9590 100644 --- a/KruacentExiled/KE.Items/Items/PressePuree.cs +++ b/KruacentExiled/KE.Items/Items/PressePuree.cs @@ -21,6 +21,22 @@ namespace KE.Items.Items { public class PressePuree : KECustomGrenade, IUpgradableCustomItem, ICustomPickupModel { + protected override Dictionary> SetTranslation() + { + return new() + { + ["en"] = new() + { + [TranslationKeyName] = "Presse Purée", + [TranslationKeyDesc] = "explode at impact but does less damage", + }, + ["fr"] = new() + { + [TranslationKeyName] = "Presse Purée", + [TranslationKeyDesc] = "Explosion à l'impact mais moins efficace", + }, + }; + } public override string Name { get; set; } = "PressePuree"; public override ItemType ItemType => ItemType.GrenadeHE; diff --git a/KruacentExiled/KE.Items/Items/ProximityGrenade.cs b/KruacentExiled/KE.Items/Items/ProximityGrenade.cs index 084a325b..690b52c7 100644 --- a/KruacentExiled/KE.Items/Items/ProximityGrenade.cs +++ b/KruacentExiled/KE.Items/Items/ProximityGrenade.cs @@ -13,9 +13,27 @@ namespace KE.Items.Items public class ProximityGrenade : KECustomGrenade, ISwichableEffect { + protected override Dictionary> SetTranslation() + { + return new() + { + ["en"] = new() + { + [TranslationKeyName] = "Proximity Grenade", + [TranslationKeyDesc] = "Show lines to all players around 3 rooms", + }, + ["fr"] = new() + { + [TranslationKeyName] = "Grenade de proximité", + [TranslationKeyDesc] = "Montre tous les joueurs dans un rayon de 3 salles", + }, + }; + } + + public override ItemType ItemType => ItemType.GrenadeFlash; - public override string Name { get; set; } = "Proximity Grenade"; - public override string Description { get; set; } = "Show lines to all players around 3 rooms"; + public override string Name { get; set; } = "ProximityGrenade"; + public override string Description { get; set; } = ""; public override float Weight { get; set; } = 0.65f; public override float FuseTime => 3f; public override bool ExplodeOnCollision => false; diff --git a/KruacentExiled/KE.Items/Items/RedbullEnergy.cs b/KruacentExiled/KE.Items/Items/RedbullEnergy.cs index acbac876..68ed5300 100644 --- a/KruacentExiled/KE.Items/Items/RedbullEnergy.cs +++ b/KruacentExiled/KE.Items/Items/RedbullEnergy.cs @@ -12,9 +12,25 @@ namespace KE.Items.Items { public class RedbullEnergy : KECustomItem, ISwichableEffect { + protected override Dictionary> SetTranslation() + { + return new() + { + ["en"] = new() + { + [TranslationKeyName] = "RedBull™ Energy", + [TranslationKeyDesc] = "RedBull™ donne des ailes ! Attention à la chute !!!", + }, + ["fr"] = new() + { + [TranslationKeyName] = "RedBull™ Energy", + [TranslationKeyDesc] = "RedBull™ donne des ailes ! Attention à la chute !!!", + }, + }; + } public override ItemType ItemType => ItemType.SCP207; - public override string Name { get; set; } = "RedBull Energy"; - public override string Description { get; set; } = "RedBull donne des ailes ! Attention à la chute !!!"; + public override string Name { get; set; } = "RedBullEnergy"; + public override string Description { get; set; } = ""; public override float Weight { get; set; } = 0.65f; public UnityEngine.Color Color { get; set; } = UnityEngine.Color.blue; public CustomItemEffect Effect { get; set; } diff --git a/KruacentExiled/KE.Items/Items/SainteGrenada.cs b/KruacentExiled/KE.Items/Items/SainteGrenada.cs index 90f16a98..c50bbe4e 100644 --- a/KruacentExiled/KE.Items/Items/SainteGrenada.cs +++ b/KruacentExiled/KE.Items/Items/SainteGrenada.cs @@ -21,10 +21,25 @@ namespace KE.Items.Items { public class SainteGrenada : KECustomGrenade, ICustomPickupModel { - + protected override Dictionary> SetTranslation() + { + return new() + { + ["en"] = new() + { + [TranslationKeyName] = "Holy Grenade", + [TranslationKeyDesc] = "HOLY SHIT WORMS????", + }, + ["fr"] = new() + { + [TranslationKeyName] = "Sainte Grenade", + [TranslationKeyDesc] = "Worms reference !?", + }, + }; + } public override ItemType ItemType => ItemType.GrenadeHE; - public override string Name { get; set; } = "Sainte Grenada"; - public override string Description { get; set; } = "Worms reference !?"; + public override string Name { get; set; } = "SainteGrenada"; + public override string Description { get; set; } = ""; public override float Weight { get; set; } = 1.5f; public override float FuseTime => 6f; public override bool ExplodeOnCollision => false; diff --git a/KruacentExiled/KE.Items/Items/Scp1650.cs b/KruacentExiled/KE.Items/Items/Scp1650.cs index 73a95fc7..e630f073 100644 --- a/KruacentExiled/KE.Items/Items/Scp1650.cs +++ b/KruacentExiled/KE.Items/Items/Scp1650.cs @@ -13,6 +13,22 @@ namespace KE.Items.Items { public class Scp1650 : KECustomItem, ISwichableEffect { + protected override Dictionary> SetTranslation() + { + return new() + { + ["en"] = new() + { + [TranslationKeyName] = "SCP-1650", + [TranslationKeyDesc] = "ויאמר ה' ל— סח השמן על בשרך ולך בינות ה— כששם אלוהים על שפתיך, וזעם ה' וחרון אפו ו— דם המכבים יטהר בית מקדשו אחריך, לנצח נצחים", + }, + ["fr"] = new() + { + [TranslationKeyName] = "SCP-1650", + [TranslationKeyDesc] = "ויאמר ה' ל— סח השמן על בשרך ולך בינות ה— כששם אלוהים על שפתיך, וזעם ה' וחרון אפו ו— דם המכבים יטהר בית מקדשו אחריך, לנצח נצחים", + }, + }; + } public override ItemType ItemType => ItemType.Painkillers; public override string Name { get; set; } = "SCP-1650"; diff --git a/KruacentExiled/KE.Items/Items/Scp3136.cs b/KruacentExiled/KE.Items/Items/Scp3136.cs index 9515adee..b36f7545 100644 --- a/KruacentExiled/KE.Items/Items/Scp3136.cs +++ b/KruacentExiled/KE.Items/Items/Scp3136.cs @@ -15,6 +15,22 @@ namespace KE.Items.Items { public class Scp3136 : KECustomItem/*, ICustomPickupModel*/ { + protected override Dictionary> SetTranslation() + { + return new() + { + ["en"] = new() + { + [TranslationKeyName] = "SCP-3136", + [TranslationKeyDesc] = "A map of the facility, you could draw your friends next to you", + }, + ["fr"] = new() + { + [TranslationKeyName] = "SCP-3136", + [TranslationKeyDesc] = "Une carte de la facilité, tu pourrais dessiner tes amis proche de toi", + }, + }; + } public override ItemType ItemType => ItemType.SCP1576; public override string Name { get; set; } = "SCP-3136"; public override string Description { get; set; } = "A map of the facility, you could draw your friends next to you"; diff --git a/KruacentExiled/KE.Items/Items/Scp514.cs b/KruacentExiled/KE.Items/Items/Scp514.cs index b8eddb28..f1745639 100644 --- a/KruacentExiled/KE.Items/Items/Scp514.cs +++ b/KruacentExiled/KE.Items/Items/Scp514.cs @@ -20,6 +20,22 @@ namespace KE.Items.Items { public class Scp514 : KECustomItem { + protected override Dictionary> SetTranslation() + { + return new() + { + ["en"] = new() + { + [TranslationKeyName] = "SCP-514", + [TranslationKeyDesc] = "birb", + }, + ["fr"] = new() + { + [TranslationKeyName] = "SCP-514", + [TranslationKeyDesc] = "birb", + }, + }; + } public override ItemType ItemType => ItemType.Flashlight; public override string Name { get; set; } = "SCP-514"; public override string Description { get; set; } = "birb"; diff --git a/KruacentExiled/KE.Items/Items/SmokeGrenade.cs b/KruacentExiled/KE.Items/Items/SmokeGrenade.cs index b6fda270..8f530731 100644 --- a/KruacentExiled/KE.Items/Items/SmokeGrenade.cs +++ b/KruacentExiled/KE.Items/Items/SmokeGrenade.cs @@ -12,6 +12,22 @@ namespace KE.Items.Items { public class SmokeGrenade : KECustomGrenade, ISwichableEffect { + protected override Dictionary> SetTranslation() + { + return new() + { + ["en"] = new() + { + [TranslationKeyName] = "SCP-514", + [TranslationKeyDesc] = "birb", + }, + ["fr"] = new() + { + [TranslationKeyName] = "SCP-514", + [TranslationKeyDesc] = "birb", + }, + }; + } public override ItemType ItemType => ItemType.GrenadeFlash; public override string Name { get; set; } = "Smoke Grenade"; public override string Description { get; set; } = "We finally put your grandma inside this thing ! Don't throw it or she will get out !"; diff --git a/KruacentExiled/KE.Items/Items/TPGrenada.cs b/KruacentExiled/KE.Items/Items/TPGrenada.cs index 5d1c215e..896dbdaa 100644 --- a/KruacentExiled/KE.Items/Items/TPGrenada.cs +++ b/KruacentExiled/KE.Items/Items/TPGrenada.cs @@ -15,7 +15,22 @@ namespace KE.Items.Items public class TPGrenada : KECustomGrenade, ISwichableEffect, ICustomPickupModel { - + protected override Dictionary> SetTranslation() + { + return new() + { + ["en"] = new() + { + [TranslationKeyName] = "SCP-514", + [TranslationKeyDesc] = "birb", + }, + ["fr"] = new() + { + [TranslationKeyName] = "SCP-514", + [TranslationKeyDesc] = "birb", + }, + }; + } public override ItemType ItemType => ItemType.GrenadeHE; public override string Name { get; set; } = "Teleportation Grenade"; public override string Description { get; set; } = "This grenade does 0 damage but teleport nearby players in a random place (does work in other dimension ;3 )"; diff --git a/KruacentExiled/KE.Items/Items/TrueDivinePills.cs b/KruacentExiled/KE.Items/Items/TrueDivinePills.cs index 79898e00..7ea70e55 100644 --- a/KruacentExiled/KE.Items/Items/TrueDivinePills.cs +++ b/KruacentExiled/KE.Items/Items/TrueDivinePills.cs @@ -1,25 +1,41 @@ using Exiled.API.Enums; +using Exiled.API.Features; using Exiled.API.Features.Attributes; using Exiled.API.Features.Spawn; using Exiled.CustomItems.API.Features; using Exiled.Events.EventArgs.Player; -using PlayerHandle = Exiled.Events.Handlers.Player; -using Exiled.API.Features; -using UnityEngine; -using System.Linq; -using PlayerRoles; -using KE.Items.API.Interface; using KE.Items.API.Features; +using KE.Items.API.Interface; +using PlayerRoles; +using System.Collections.Generic; +using System.Linq; +using UnityEngine; +using PlayerHandle = Exiled.Events.Handlers.Player; /// public class TrueDivinePills : KECustomItem, ILumosItem { - /// + protected override Dictionary> SetTranslation() + { + return new() + { + ["en"] = new() + { + [TranslationKeyName] = "True Divine Pills", + [TranslationKeyDesc] = "Guaranteed to respawn everybody, drop to change the mode", + }, + ["fr"] = new() + { + [TranslationKeyName] = "True Divine Pills", + [TranslationKeyDesc] = "Fait réappaître tout le monde, lâcher pour changer le mode", + }, + }; + } public override ItemType ItemType => ItemType.SCP500; /// - public override string Name { get; set; } = "True Divine Pills"; + public override string Name { get; set; } = "TrueDivinePills"; /// public override string Description { get; set; } = "Guaranteed to respawn everybody"; From 9201a790e3d8f4f19e5dd433b9f1f352aee1c95b Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Tue, 3 Mar 2026 21:45:31 +0100 Subject: [PATCH 704/853] terrorsite does less damage --- .../KE.CustomRoles/Abilities/Explode.cs | 22 +++++++++++++------ 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/KruacentExiled/KE.CustomRoles/Abilities/Explode.cs b/KruacentExiled/KE.CustomRoles/Abilities/Explode.cs index 1fe8f891..b348e71e 100644 --- a/KruacentExiled/KE.CustomRoles/Abilities/Explode.cs +++ b/KruacentExiled/KE.CustomRoles/Abilities/Explode.cs @@ -1,6 +1,7 @@ using Exiled.API.Features; using Exiled.API.Features.Attributes; using Exiled.API.Features.Items; +using Exiled.API.Features.Pools; using Exiled.CustomRoles.API.Features; using InventorySystem.Items.ThrowableProjectiles; using KE.CustomRoles.API.Features; @@ -41,10 +42,10 @@ protected override Dictionary> SetTranslation public Utils.API.GifAnimator.TextImage IconName => MainPlugin.Instance.icons["Explode"]; - private HashSet Grenades = new(); + private HashSet GrenadesSerials = new(); protected override void SubscribeEvents() { - Grenades = new(); + GrenadesSerials = HashSetPool.Pool.Get(); Items.API.Events.ExplodeEvent.ExplodeDestructible += ExplodeEvent_ExplodeDestructible; base.SubscribeEvents(); @@ -54,6 +55,7 @@ protected override void UnsubscribeEvents() { Items.API.Events.ExplodeEvent.ExplodeDestructible -= ExplodeEvent_ExplodeDestructible; + HashSetPool.Pool.Return(GrenadesSerials); base.UnsubscribeEvents(); } @@ -64,21 +66,27 @@ protected override bool AbilityUsed(Player player) grenade.FuseTime = 0.2f; grenade.SpawnActive(player.Position); - Grenades.Add(grenade.Projectile.Base); - KELog.Debug("Grenade spawned"); + + //idk why it's the next one but it is + ushort serial = (ushort) (grenade.Serial + 1); + + GrenadesSerials.Add(serial); + return base.AbilityUsed(player); } private void ExplodeEvent_ExplodeDestructible(Items.API.Events.OnExplodeDestructibleEventsArgs obj) { + ushort serial = obj.ExplosionGrenade.Info.Serial; + KELog.Debug("explode serial " + serial); + - if (!Grenades.Contains(obj.ExplosionGrenade)) return; - obj.Damage = 75; + if (!GrenadesSerials.Contains(serial)) return; - Grenades.Remove(obj.ExplosionGrenade); + obj.Damage /=3.1f; KELog.Debug("explode with "+ obj.Damage); From 176450ac46b5d3192b39c7e869c9012d7147244b Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Tue, 3 Mar 2026 21:45:38 +0100 Subject: [PATCH 705/853] a bit more damgne --- KruacentExiled/KE.CustomRoles/Abilities/Explode.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/KruacentExiled/KE.CustomRoles/Abilities/Explode.cs b/KruacentExiled/KE.CustomRoles/Abilities/Explode.cs index b348e71e..2564dcf7 100644 --- a/KruacentExiled/KE.CustomRoles/Abilities/Explode.cs +++ b/KruacentExiled/KE.CustomRoles/Abilities/Explode.cs @@ -86,7 +86,7 @@ private void ExplodeEvent_ExplodeDestructible(Items.API.Events.OnExplodeDestruct if (!GrenadesSerials.Contains(serial)) return; - obj.Damage /=3.1f; + obj.Damage /=3f; KELog.Debug("explode with "+ obj.Damage); From d0a3df8b32e219abf3913d578996b33fcdc18439 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Tue, 3 Mar 2026 21:46:09 +0100 Subject: [PATCH 706/853] remove loges --- KruacentExiled/KE.Items/API/Features/KECustomGrenade.cs | 4 ---- 1 file changed, 4 deletions(-) diff --git a/KruacentExiled/KE.Items/API/Features/KECustomGrenade.cs b/KruacentExiled/KE.Items/API/Features/KECustomGrenade.cs index 5db2604f..134efca7 100644 --- a/KruacentExiled/KE.Items/API/Features/KECustomGrenade.cs +++ b/KruacentExiled/KE.Items/API/Features/KECustomGrenade.cs @@ -101,8 +101,6 @@ public virtual bool Check(ExplosionGrenade explosionGrenade) } private void OnInternalExplodeDestructible(OnExplodeDestructibleEventsArgs ev) { - KELog.Debug("damage =" + ev.Damage); - KELog.Debug("serial expldode=" + ev.ExplosionGrenade.ItemId.SerialNumber); if (Check(ev.ExplosionGrenade)) { @@ -125,8 +123,6 @@ private void OnInternalThrowingRequest(ThrowingRequestEventArgs ev) } private void OnInternalThrownProjectile(ThrownProjectileEventArgs ev) { - KELog.Debug("changings nto grandea"); - KELog.Debug("serialpickup=" + ev.Pickup.Serial); if (Check(ev.Throwable)) { OnThrownProjectile(ev); From a39b7701ef12c6353e81dce394580bcfc0d79d40 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Tue, 3 Mar 2026 21:51:44 +0100 Subject: [PATCH 707/853] removed patchnot --- .../KE.Misc/Features/PatchNotes/PatchNote.cs | 92 ------------------- .../Features/PatchNotes/PatchNoteChanger.cs | 62 ------------- .../Features/PatchNotes/PatchNotesPosition.cs | 20 ---- KruacentExiled/KE.Misc/MainPlugin.cs | 2 - 4 files changed, 176 deletions(-) delete mode 100644 KruacentExiled/KE.Misc/Features/PatchNotes/PatchNote.cs delete mode 100644 KruacentExiled/KE.Misc/Features/PatchNotes/PatchNoteChanger.cs delete mode 100644 KruacentExiled/KE.Misc/Features/PatchNotes/PatchNotesPosition.cs diff --git a/KruacentExiled/KE.Misc/Features/PatchNotes/PatchNote.cs b/KruacentExiled/KE.Misc/Features/PatchNotes/PatchNote.cs deleted file mode 100644 index 6c13da00..00000000 --- a/KruacentExiled/KE.Misc/Features/PatchNotes/PatchNote.cs +++ /dev/null @@ -1,92 +0,0 @@ -using Exiled.API.Features; -using Exiled.Events.EventArgs.Player; -using KE.Utils.API.Displays.DisplayMeow; -using KE.Utils.API.Displays.DisplayMeow.Placements; -using KE.Utils.API.Interfaces; -using MEC; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace KE.Misc.Features.PatchNotes -{ - internal class PatchNote : MiscFeature - { - public static HintPosition HintPosition = new PatchNotesPosition(); - public override void SubscribeEvents() - { - Exiled.Events.Handlers.Player.Joined += OnJoined; - Exiled.Events.Handlers.Server.RoundStarted += OnRoundStarted; - } - - public override void UnsubscribeEvents() - { - Exiled.Events.Handlers.Player.Joined -= OnJoined; - Exiled.Events.Handlers.Server.RoundStarted -= OnRoundStarted; - } - - - private void OnJoined(JoinedEventArgs ev) - { - Player player = ev.Player; - - if (ev.Player is null) - { - return; - } - - - if (!ev.Player.IsConnected) - { - return; - } - - Timing.CallDelayed(1f, () => - { - if (Round.IsLobby) - { - var hint = DisplayHandler.Instance.CreateAuto(player, (args) => GetPatchNotes(), HintPosition.HintPlacement); - hint.FontSize = 20; - } - }); - - } - - - private void OnRoundStarted() - { - foreach (Player player in Player.List) - { - DisplayHandler.Instance.RemoveHint(player, HintPosition.HintPlacement); - } - - } - - - public const string PatchNoteStart = "Patch Notes :\n"; - - private static string cachedPatchNote = PatchNoteNotFound; - private const string PatchNoteNotFound = " "; - - - private string GetPatchNotes() - { - if(cachedPatchNote == PatchNoteNotFound) - { - cachedPatchNote = PatchNoteStart + MainPlugin.Instance.Config.PatchNote; - } - - return cachedPatchNote; - - } - - - public static void Reload() - { - cachedPatchNote = PatchNoteNotFound; - } - - } -} diff --git a/KruacentExiled/KE.Misc/Features/PatchNotes/PatchNoteChanger.cs b/KruacentExiled/KE.Misc/Features/PatchNotes/PatchNoteChanger.cs deleted file mode 100644 index 65add532..00000000 --- a/KruacentExiled/KE.Misc/Features/PatchNotes/PatchNoteChanger.cs +++ /dev/null @@ -1,62 +0,0 @@ -using CommandSystem; -using Exiled.API.Features; -using NorthwoodLib.Pools; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace KE.Misc.Features.PatchNotes -{ - [CommandHandler(typeof(RemoteAdminCommandHandler))] - public class PatchNoteChanger : ICommand - { - public string Command => "patchnotechanger"; - - public string[] Aliases => ["pnc"]; - - public string Description => "change patch note"; - - public bool Execute(ArraySegment arguments, ICommandSender sender, out string response) - { - if(!Round.IsLobby) - { - response = "works only in lobby"; - return false; - } - - if(arguments.Count < 1) - { - response = "current patchnote number : "+ MainPlugin.Instance.Config.PatchNote; - return true; - } - - - - - StringBuilder sb = StringBuilderPool.Shared.Rent(arguments.Count); - - for(int i = 0; i < arguments.Count; i++) - { - sb.Append(arguments.At(i)); - sb.Append(" "); - } - - - string result = sb.ToString(); - - - StringBuilderPool.Shared.Return(sb); - - - MainPlugin.Instance.Config.PatchNote = result; - - PatchNote.Reload(); - - - response = "changed"; - return true; - } - } -} diff --git a/KruacentExiled/KE.Misc/Features/PatchNotes/PatchNotesPosition.cs b/KruacentExiled/KE.Misc/Features/PatchNotes/PatchNotesPosition.cs deleted file mode 100644 index 9453371e..00000000 --- a/KruacentExiled/KE.Misc/Features/PatchNotes/PatchNotesPosition.cs +++ /dev/null @@ -1,20 +0,0 @@ -using HintServiceMeow.Core.Enum; -using KE.Utils.API.Displays.DisplayMeow.Placements; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace KE.Misc.Features.PatchNotes -{ - public class PatchNotesPosition : HintPosition - { - public override float Xposition => -340; - - public override float Yposition => 500; - public override string Name => "PatchNotes"; - - public override HintAlignment HintAlignment => HintAlignment.Left; - } -} diff --git a/KruacentExiled/KE.Misc/MainPlugin.cs b/KruacentExiled/KE.Misc/MainPlugin.cs index d092c910..63d12b2c 100644 --- a/KruacentExiled/KE.Misc/MainPlugin.cs +++ b/KruacentExiled/KE.Misc/MainPlugin.cs @@ -41,7 +41,6 @@ public class MainPlugin : Plugin, ILocalizable internal EventHandlers _gamblingCoinHandler { get; private set; } internal SpawnLcz SpawnLcz { get; private set; } internal LastHumanHandler LastHuman { get; private set; } - internal PatchNote PatchNote { get; private set; } private Harmony harmony; internal VoteStart vote { get; private set; } @@ -125,7 +124,6 @@ public override void OnDisabled() AutoElevator = null; vote = null; AutoNukeAnnoucement = null; - PatchNote = null; FriendlyFire = null; //SurfaceLight = null; GamblingCoinManager.DestroyAll(); From 538647362e8fb981520c5665765231593468e60b Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Tue, 3 Mar 2026 21:56:21 +0100 Subject: [PATCH 708/853] removed INonredactable --- .../GE/Librarby.cs | 5 ++++- .../GEFE/API/Features/GlobalEvent.cs | 5 ----- .../GEFE/API/Interfaces/IChanceRedactable.cs | 3 +++ .../GEFE/API/Interfaces/INonRedactable.cs | 14 -------------- 4 files changed, 7 insertions(+), 20 deletions(-) delete mode 100644 KruacentExiled/KE.GlobalEventFramework/GEFE/API/Interfaces/INonRedactable.cs diff --git a/KruacentExiled/KE.GlobalEventFramework.Examples/GE/Librarby.cs b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/Librarby.cs index b6c99093..b9ebe63a 100644 --- a/KruacentExiled/KE.GlobalEventFramework.Examples/GE/Librarby.cs +++ b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/Librarby.cs @@ -16,7 +16,7 @@ namespace KE.GlobalEventFramework.Examples.GE /// /// You cannot talk to loud /// - public class Librarby : GlobalEvent, IEvent, INonRedactable + public class Librarby : GlobalEvent, IEvent, IChanceRedactable { /// public override uint Id { get; set; } = 1091; @@ -26,6 +26,9 @@ public class Librarby : GlobalEvent, IEvent, INonRedactable public override string Description { get; } = "Ne parlez pas trop fort sinon vous subirez les conséquences !"; /// public override int WeightedChance => 1; + + public float ChanceRedacted => 0; + private float MaxVolume = 0.7f; private OpusDecoder _decoder = new OpusDecoder(); diff --git a/KruacentExiled/KE.GlobalEventFramework/GEFE/API/Features/GlobalEvent.cs b/KruacentExiled/KE.GlobalEventFramework/GEFE/API/Features/GlobalEvent.cs index 7485ed0b..91214bd9 100644 --- a/KruacentExiled/KE.GlobalEventFramework/GEFE/API/Features/GlobalEvent.cs +++ b/KruacentExiled/KE.GlobalEventFramework/GEFE/API/Features/GlobalEvent.cs @@ -253,11 +253,6 @@ private static string ShowText() private bool IsRedacted() { - if(this is INonRedactable) - { - return false; - } - float chanceRedacted; if(this is IChanceRedactable force) diff --git a/KruacentExiled/KE.GlobalEventFramework/GEFE/API/Interfaces/IChanceRedactable.cs b/KruacentExiled/KE.GlobalEventFramework/GEFE/API/Interfaces/IChanceRedactable.cs index f9ddcf90..d93ae408 100644 --- a/KruacentExiled/KE.GlobalEventFramework/GEFE/API/Interfaces/IChanceRedactable.cs +++ b/KruacentExiled/KE.GlobalEventFramework/GEFE/API/Interfaces/IChanceRedactable.cs @@ -6,6 +6,9 @@ namespace KE.GlobalEventFramework.GEFE.API.Interfaces { + /// + /// Override the redactable chance + /// public interface IChanceRedactable { diff --git a/KruacentExiled/KE.GlobalEventFramework/GEFE/API/Interfaces/INonRedactable.cs b/KruacentExiled/KE.GlobalEventFramework/GEFE/API/Interfaces/INonRedactable.cs deleted file mode 100644 index 16c66fa1..00000000 --- a/KruacentExiled/KE.GlobalEventFramework/GEFE/API/Interfaces/INonRedactable.cs +++ /dev/null @@ -1,14 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace KE.GlobalEventFramework.GEFE.API.Interfaces -{ - public interface INonRedactable - { - - - } -} From 4287570e3d5c0011a1be0f1a56305096bda8463b Mon Sep 17 00:00:00 2001 From: OmerGS <27omerf@gmail.com> Date: Wed, 4 Mar 2026 12:57:09 +0100 Subject: [PATCH 709/853] add drone --- KruacentExiled/KE.Items/Items/Drone.cs | 387 +++++++++++++++++++++++++ 1 file changed, 387 insertions(+) create mode 100644 KruacentExiled/KE.Items/Items/Drone.cs diff --git a/KruacentExiled/KE.Items/Items/Drone.cs b/KruacentExiled/KE.Items/Items/Drone.cs new file mode 100644 index 00000000..9d7f58fb --- /dev/null +++ b/KruacentExiled/KE.Items/Items/Drone.cs @@ -0,0 +1,387 @@ +using Exiled.API.Enums; +using Exiled.API.Extensions; +using Exiled.API.Features; +using Exiled.API.Features.Items; +using Exiled.API.Features.Roles; +using Exiled.API.Features.Spawn; +using Exiled.API.Features.Toys; +using Exiled.Events.EventArgs.Player; +using KE.CustomRoles.API.Features; +using KE.Items.API.Features; +using MEC; +using PlayerRoles.FirstPersonControl; +using System.Collections.Generic; +using UnityEngine; + +namespace KE.Items.Items +{ + public class Drone : KECustomItem + { + public override string Name { get; set; } = "Drone"; + public override string Description { get; set; } = "Drone de reconnaissance militaire (lancer pour l'utiliser)"; + public override float Weight { get; set; } = 3f; + public Color Color { get; set; } = Color.blue; + public override ItemType ItemType => ItemType.KeycardChaosInsurgency; + + protected override Dictionary> SetTranslation() + { + return new() + { + ["en"] = new() + { + [TranslationKeyName] = "Drone", + [TranslationKeyDesc] = "Military drone (drop to use)", + }, + ["fr"] = new() + { + [TranslationKeyName] = "Drone", + [TranslationKeyDesc] = "Drone de reconnaissance militaire (lancer pour l'utiliser)", + }, + }; + } + public override SpawnProperties SpawnProperties { get; set; } = new SpawnProperties() + { + Limit = 1, + RoomSpawnPoints = new List + { + new RoomSpawnPoint() { Chance = 25, Room = RoomType.HczCornerDeep, }, + new RoomSpawnPoint() { Chance = 25, Room = RoomType.HczIncineratorWayside, }, + new RoomSpawnPoint() { Chance = 25, Room = RoomType.LczAirlock, }, + }, + }; + + private Dictionary DroneBatteries = new Dictionary(); + private Dictionary ActiveDrones = new Dictionary(); + private const float MaxBattery = 100f; + // Battery drain rate per second + public const float BatteryDrainRate = 2.5f; + + protected override void SubscribeEvents() + { + Exiled.Events.Handlers.Player.Died += OnDied; + Exiled.Events.Handlers.Player.PickingUpItem += OnPicking; + Exiled.Events.Handlers.Player.Shooting += OnShooting; + Exiled.Events.Handlers.Player.InteractingDoor += OnInteracting; + Exiled.Events.Handlers.Player.UsingItem += OnUsingItem; + base.SubscribeEvents(); + } + + protected override void UnsubscribeEvents() + { + Exiled.Events.Handlers.Player.Died -= OnDied; + Exiled.Events.Handlers.Player.PickingUpItem -= OnPicking; + Exiled.Events.Handlers.Player.Shooting -= OnShooting; + Exiled.Events.Handlers.Player.InteractingDoor -= OnInteracting; + Exiled.Events.Handlers.Player.UsingItem -= OnUsingItem; + base.UnsubscribeEvents(); + } + + private void OnDied(DiedEventArgs ev) + { + if(ev.Player.GameObject.TryGetComponent(out DroneController dc)) { + UnityEngine.Object.Destroy(dc); + } + } + + protected override void OnDroppingItem(DroppingItemEventArgs ev) + { + if (ev.IsThrown) return; + ev.IsAllowed = false; + + if (KEAbilities.PlayersAbility.TryGetValue(ev.Player, out List abilities)) + { + foreach (KEAbilities ability in abilities) + { + if (ability.IsAbilityActive(ev.Player)) + { + KECustomItem.ItemEffectHint(ev.Player, "Tu ne peux pas utiliser cette item avec une abilité active"); + return; + } + } + } + + if (ActiveDrones.ContainsKey(ev.Player)) + { + StopDrone(ev.Player); + } + else + { + StartDrone(ev.Player, ev.Item.Serial); + } + } + + private void OnInteracting(InteractingDoorEventArgs ev) + { + if (!ev.IsAllowed) return; + ev.IsAllowed = DroneDontHaveArms(ev.Player); + } + + private void OnPicking(PickingUpItemEventArgs ev) + { + if (!ev.IsAllowed) return; + ev.IsAllowed = DroneDontHaveArms(ev.Player); + } + + private void OnShooting(ShootingEventArgs ev) + { + if (!ev.IsAllowed) return; + ev.IsAllowed = DroneDontHaveArms(ev.Player); + } + private void OnUsingItem(UsingItemEventArgs ev) + { + if (!ev.IsAllowed) return; + ev.IsAllowed = DroneDontHaveArms(ev.Player); + } + + private bool DroneDontHaveArms(Player player) + { + if (ActiveDrones.ContainsKey(player)) + { + KECustomItem.ItemEffectHint(player, "Le drone n'a pas de bras pour faire ça"); + return false; + } + return true; + } + + private void StartDrone(Player p, ushort serial) + { + if (!DroneBatteries.ContainsKey(serial)) DroneBatteries[serial] = MaxBattery; + + if(DroneBatteries[serial] <= 0) + { + KECustomItem.ItemEffectHint(p, "Plus de batterie"); + return; + } + + DroneController dController = p.GameObject.AddComponent(); + dController.DroneItem = this; + dController.Serial = serial; + dController.Battery = DroneBatteries[serial]; + + ActiveDrones.Add(p, dController); + + KEAbilities.TemporaryRemoveAbilities(p); + } + + public void StopDrone(Player p) + { + if (ActiveDrones.TryGetValue(p, out DroneController dc)) + { + DroneBatteries[dc.Serial] = dc.Battery; + UnityEngine.Object.Destroy(dc); + ActiveDrones.Remove(p); + KEAbilities.ReaffectRemovedAbilities(p); + p.RemoveItem(dc.Serial, true); + } + } + } + + internal class DroneController : MonoBehaviour + { + public Drone DroneItem; + public ushort Serial; + public float Battery; + + private Player player; + private Primitive drone; + private Npc npc; + private bool npcIsDead = false; + + private Dictionary playerSavedAmmo = new Dictionary(); + private List playerSavedItems = new List(); + private Vector3 originalSize; + + private CoroutineHandle update; + private bool isDestroying = false; + + private void Awake() + { + this.player = Player.Get(base.gameObject); + this.originalSize = player.Scale; + + SpawnNpc(); + PutPlayerOnDrone(); + + this.drone = Primitive.Create(PrimitiveType.Cube, player.Position, player.Rotation.eulerAngles, Vector3.one, false); + this.drone.Collidable = false; + this.drone.Spawn(); + this.drone.Transform.parent = player.Transform; + this.drone.Transform.localPosition = Vector3.zero; + this.drone.Transform.localRotation = Quaternion.identity; + } + + private void Start() + { + Exiled.Events.Handlers.Player.Hurting += OnHurting; + this.update = Timing.RunCoroutine(DroneUpdate()); + } + + private void OnDestroy() + { + if (isDestroying) return; + isDestroying = true; + + Exiled.Events.Handlers.Player.Hurting -= OnHurting; + Timing.KillCoroutines(update); + + if (this.player != null && this.player.IsAlive) + { + this.player.Scale = this.originalSize; + + if (this.player.Role is FpcRole fpc) + { + fpc.Gravity = FpcGravityController.DefaultGravity; + } + + if (this.npc != null) this.player.Position = this.npc.Position; + RestorePlayerInventory(); + } + + if (this.player != null && this.player.Role.Type.IsDead()) + { + if (this.npc != null) { + this.npc.ClearInventory(false); + this.npc.Destroy(); + } + } + else + { + if (this.npc != null) this.npc.Destroy(); + } + + if (this.drone != null) this.drone.Destroy(); + } + + private IEnumerator DroneUpdate() + { + while (true) + { + this.Battery -= Drone.BatteryDrainRate * Time.deltaTime; + if (this.Battery <= 0) + { + KECustomItem.ItemEffectHint(player, "Batterie épuisée"); + DroneItem.StopDrone(player); + yield break; + } + + KECustomItem.ItemEffectHint(player, $"Batterie: {Battery:F1}%"); + + if (player.Role is FpcRole fpc) + { + float pitch = player.CameraTransform.forward.y; + bool isMoving = fpc.MovementDetected; + bool isCrouching = fpc.IsCrouching; + + float targetVelY = 0f; + + if (isCrouching) + { + targetVelY = -3f; + } + else if (isMoving && Mathf.Abs(pitch) > 0.1f) + { + targetVelY = pitch * 3f; + } + + float currentVelY = fpc.Velocity.y; + float diff = targetVelY - currentVelY; + + Vector3 newGravity = new Vector3(0, diff * 15f, 0); + + if (Vector3.Distance(fpc.Gravity, newGravity) > 0.2f) + { + fpc.Gravity = newGravity; + } + + if (targetVelY > 0 && Physics.Raycast(player.Position, Vector3.down, 0.3f, 1 << 0)) + { + player.Position += Vector3.up * 0.2f; + } + } + + yield return Timing.WaitForOneFrame; + } + } + + private void OnHurting(HurtingEventArgs ev) + { + if (isDestroying) return; + + if (this.npc != null && ev.Player == this.npc) + { + if(this.npc.Health - ev.Amount <= 0 || ev.IsInstantKill) + { + this.npcIsDead = true; + } + + this.player.Hurt(ev.Amount, ev.DamageHandler.Type); + } + + if (ev.Player == this.player) + { + if ((ev.Player.Health - ev.Amount) <= 0 || ev.IsInstantKill) + { + if (this.npcIsDead) + { + this.DroneItem.StopDrone(ev.Player); + } else + { + ev.IsAllowed = false; + this.player.Position = this.npc.Position; + this.player.Health = this.npc.Health; + RestorePlayerInventory(); + this.DroneItem.StopDrone(ev.Player); + } + } + } + } + + private void SpawnNpc() + { + this.npc = Npc.Spawn(this.player.Nickname, this.player.Role, this.player.Position); + this.npc.Health = this.player.Health; + this.npc.Scale = this.player.Scale; + + foreach(Item item in this.player.Items) + { + this.npc.AddItem(item.Clone()); + } + + foreach (var ammo in this.player.Ammo) + { + this.npc.SetAmmo((AmmoType)ammo.Key, ammo.Value); + } + } + + private void PutPlayerOnDrone() + { + playerSavedItems.Clear(); + foreach (Item item in this.player.Items) playerSavedItems.Add(item.Type); + + playerSavedAmmo.Clear(); + foreach (var ammo in this.player.Ammo) playerSavedAmmo.Add(ammo.Key, ammo.Value); + + this.player.ClearInventory(true); + this.player.Scale = Vector3.one * 0.1f; + + if (this.player.Role is FpcRole fpc) + { + fpc.Gravity = Vector3.zero; + } + } + + private void RestorePlayerInventory() + { + this.player.ClearInventory(true); + foreach (ItemType type in playerSavedItems) + { + this.player.AddItem(type); + } + + foreach (var ammo in playerSavedAmmo) + { + this.player.SetAmmo((AmmoType)ammo.Key, ammo.Value); + } + } + } +} \ No newline at end of file From 66619e78fe9ef981719b4ed0b6445d19c47276f4 Mon Sep 17 00:00:00 2001 From: OmerGS <27omerf@gmail.com> Date: Wed, 4 Mar 2026 13:11:16 +0100 Subject: [PATCH 710/853] feat: block ability for a specific player during a specific time --- .../API/Features/KEAbilities.cs | 20 +++++++++++-- .../API/Interfaces/Ability/IDuration.cs | 15 ++++++++++ .../KE.CustomRoles/Abilities/SimulateDeath.cs | 28 +++++++++++-------- 3 files changed, 49 insertions(+), 14 deletions(-) create mode 100644 KruacentExiled/KE.CustomRoles/API/Interfaces/Ability/IDuration.cs diff --git a/KruacentExiled/KE.CustomRoles/API/Features/KEAbilities.cs b/KruacentExiled/KE.CustomRoles/API/Features/KEAbilities.cs index 090dba9f..b7d43dc9 100644 --- a/KruacentExiled/KE.CustomRoles/API/Features/KEAbilities.cs +++ b/KruacentExiled/KE.CustomRoles/API/Features/KEAbilities.cs @@ -7,6 +7,7 @@ using KE.CustomRoles.Abilities.FireAbilities; using KE.CustomRoles.API.HintPositions; using KE.CustomRoles.API.Interfaces; +using KE.CustomRoles.API.Interfaces.Ability; using KE.CustomRoles.Settings; using KE.Utils.API; using KE.Utils.API.Displays.DisplayMeow; @@ -52,6 +53,7 @@ public abstract class KEAbilities public IReadOnlyCollection Selected => selected; private HashSet selected = new(); private HashSet blockedPlayer = new(); + private HashSet playerWithActiveAbility = new(); @@ -250,13 +252,25 @@ public void AddAbility(Player player) } public void UseAbility(Player player) { - - if (AbilityUsed(player)) { + if (this is IDuration durationAbility) + { + this.playerWithActiveAbility.Add(player); + Timing.CallDelayed(durationAbility.Duration, () => + { + durationAbility.ActionAfterAbility(player); + this.playerWithActiveAbility.Remove(player); + }); + } + LastUsed[player] = DateTime.Now; } - + } + + public bool IsAbilityActive(Player player) + { + return this.playerWithActiveAbility.Contains(player); } public bool Check(Player player) diff --git a/KruacentExiled/KE.CustomRoles/API/Interfaces/Ability/IDuration.cs b/KruacentExiled/KE.CustomRoles/API/Interfaces/Ability/IDuration.cs new file mode 100644 index 00000000..79e5348d --- /dev/null +++ b/KruacentExiled/KE.CustomRoles/API/Interfaces/Ability/IDuration.cs @@ -0,0 +1,15 @@ +using Exiled.API.Features; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace KE.CustomRoles.API.Interfaces.Ability +{ + internal interface IDuration + { + float Duration { get; set; } + void ActionAfterAbility(Player player); + } +} diff --git a/KruacentExiled/KE.CustomRoles/Abilities/SimulateDeath.cs b/KruacentExiled/KE.CustomRoles/Abilities/SimulateDeath.cs index 67360949..7a4f18e7 100644 --- a/KruacentExiled/KE.CustomRoles/Abilities/SimulateDeath.cs +++ b/KruacentExiled/KE.CustomRoles/Abilities/SimulateDeath.cs @@ -3,6 +3,7 @@ using Exiled.API.Features; using KE.CustomRoles.API.Features; using KE.CustomRoles.API.Interfaces; +using KE.CustomRoles.API.Interfaces.Ability; using MEC; using PlayerRoles.FirstPersonControl.Thirdperson.Subcontrollers; using PlayerStatsSystem; @@ -11,7 +12,7 @@ namespace KE.CustomRoles.Abilities { - public class SimulateDeath : KEAbilities, ICustomIcon + public class SimulateDeath : KEAbilities, ICustomIcon, IDuration { public override string Name { get; } = "SimulateDeath"; @@ -32,30 +33,35 @@ protected override Dictionary> SetTranslation }; } - public int Duration = 10; public Utils.API.GifAnimator.TextImage IconName => MainPlugin.Instance.icons[Name]; public override float Cooldown { get; } = 60f; + public float Duration { get; set; } = 10f; + + private Ragdoll ragdoll; + private Vector3 pScale; + private Vector3 pPos; protected override bool AbilityUsed(Player player) { Dictionary deathTranslation = DeathTranslations.TranslationsById; - Vector3 pScale = player.Scale; - Vector3 pPos = player.Position; - Ragdoll ragdoll = Ragdoll.CreateAndSpawn(player.Role, player.DisplayNickname, deathTranslation[(byte)UnityEngine.Random.Range(0, deathTranslation.Count)].DeathscreenTranslation, player.Position, player.ReferenceHub.PlayerCameraReference.rotation, player); + this.pScale = player.Scale; + this.pPos = player.Position; + this.ragdoll = Ragdoll.CreateAndSpawn(player.Role, player.DisplayNickname, deathTranslation[(byte)UnityEngine.Random.Range(0, deathTranslation.Count)].DeathscreenTranslation, player.Position, player.ReferenceHub.PlayerCameraReference.rotation, player); player.EnableEffect(EffectType.Invisible, this.Duration); player.EnableEffect(EffectType.Ensnared, this.Duration); player.EnableEffect(EffectType.AmnesiaItems, this.Duration); player.Scale = new Vector3(0.1f, 0.1f, 0.1f); - Timing.CallDelayed(this.Duration, () => - { - ragdoll.Destroy(); - player.Scale = pScale; - player.Position = pPos; - }); return base.AbilityUsed(player); } + + public void ActionAfterAbility(Player player) + { + this.ragdoll.Destroy(); + player.Scale = this.pScale; + player.Position = this.pPos; + } } } From 0ccd660b4ac1f44a3a644b51402c155c8bab5b73 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Wed, 4 Mar 2026 15:38:29 +0100 Subject: [PATCH 711/853] new settings --- .../KE.CustomRoles/API/Features/CustomSCP.cs | 17 +++++++------- KruacentExiled/KE.CustomRoles/MainPlugin.cs | 3 +++ .../Settings/DebugSettings/DebugSetting.cs | 12 ++++++++++ .../KE.CustomRoles/Settings/SettingHandler.cs | 22 ++++++++++--------- 4 files changed, 36 insertions(+), 18 deletions(-) diff --git a/KruacentExiled/KE.CustomRoles/API/Features/CustomSCP.cs b/KruacentExiled/KE.CustomRoles/API/Features/CustomSCP.cs index 5ab3c6e1..62ee7a09 100644 --- a/KruacentExiled/KE.CustomRoles/API/Features/CustomSCP.cs +++ b/KruacentExiled/KE.CustomRoles/API/Features/CustomSCP.cs @@ -2,6 +2,7 @@ using Exiled.API.Features.Core.UserSettings; using KE.Utils.API.Features.SCPs; using KE.Utils.API.Settings; +using KE.Utils.API.Settings.SettingsCategories; using System.Collections.Generic; using System.Linq; @@ -19,27 +20,27 @@ public abstract class CustomSCP : KECustomRole protected abstract int SettingId { get; } private static HeaderSetting header = null; private static int HeaderId => MainPlugin.Instance.Config.HeaderId; + + private static SettingsCategory category; public static IEnumerable All => Registered.Where(c => c is CustomSCP).Cast(); public override void Init() { + base.Init(); if (SpawnChance <= 0) { - base.Init(); return; } - base.Init(); - var list = new List(); + - if (header is null) + if (category is null) { header = new(HeaderId, "SCP Spawn Preferences",string.Empty,true); - list.Add(header); + category = new(header, 1001, []); } sliderSetting= new SliderSetting(SettingId, GetTranslation("en", TranslationKeyName), MinValue, MaxValue, DefaultValue, true); - list.Add(sliderSetting); - SettingBase.Register(list); - + + category.Settings.Add(sliderSetting); } diff --git a/KruacentExiled/KE.CustomRoles/MainPlugin.cs b/KruacentExiled/KE.CustomRoles/MainPlugin.cs index 9eff76f1..cf289c23 100644 --- a/KruacentExiled/KE.CustomRoles/MainPlugin.cs +++ b/KruacentExiled/KE.CustomRoles/MainPlugin.cs @@ -103,10 +103,13 @@ public void UnsubscribeEvents() Misc.Features.Spawn.Spawn.OnAssigned -= KECustomRole.SpawnStartRound; Exiled.Events.Handlers.Server.RespawnedTeam -= KECustomRole.RespawnCustomRole; Exiled.Events.Handlers.Server.WaitingForPlayers -= KECustomRole.ResetNumberOfSpawn; + Exiled.Events.Handlers.Player.Joined -= KECustomRole.ShowCustomRole; } + + private void LoadImage() { if (!Directory.Exists(ImageLocation)) diff --git a/KruacentExiled/KE.CustomRoles/Settings/DebugSettings/DebugSetting.cs b/KruacentExiled/KE.CustomRoles/Settings/DebugSettings/DebugSetting.cs index efae8a42..87604110 100644 --- a/KruacentExiled/KE.CustomRoles/Settings/DebugSettings/DebugSetting.cs +++ b/KruacentExiled/KE.CustomRoles/Settings/DebugSettings/DebugSetting.cs @@ -1,6 +1,7 @@ using Exiled.API.Features; using Exiled.API.Features.Core.UserSettings; using KE.CustomRoles.API.Features; +using KE.Utils.API.Settings.SettingsCategories; using System; using System.Collections.Generic; using System.Linq; @@ -17,6 +18,8 @@ public abstract class DebugSetting public HeaderSetting Header; + private SettingsCategory category = null; + public DebugSetting() { settings.Add(this); @@ -39,6 +42,15 @@ public virtual void OnSettingValueReceived(Player player, ServerSpecificSettingB } + public SettingsCategory GetCategory() + { + if(category == null) + { + category = new SettingsCategory(Header, 0, Settings.Where(s => s is not HeaderSetting).ToList()); + } + return category; + } + } } diff --git a/KruacentExiled/KE.CustomRoles/Settings/SettingHandler.cs b/KruacentExiled/KE.CustomRoles/Settings/SettingHandler.cs index 875fcc15..da839d69 100644 --- a/KruacentExiled/KE.CustomRoles/Settings/SettingHandler.cs +++ b/KruacentExiled/KE.CustomRoles/Settings/SettingHandler.cs @@ -5,6 +5,7 @@ using KE.Utils.API; using KE.Utils.API.Interfaces; using KE.Utils.API.Settings; +using KE.Utils.API.Settings.SettingsCategories; using LabApi.Events.Arguments.PlayerEvents; using System; using System.Collections.Generic; @@ -49,10 +50,11 @@ public SettingHandler() HeaderSetting header = new HeaderSetting(_idHeader, "Custom Roles", padding: true); SettingBase arrow = SettingBase.Create(new SSPlaintextSetting(_idArrow, "Personalize the arrow next to the selected ability", baseArrow, 16, TMP_InputField.ContentType.Standard, string.Empty, 0)); arrow.Header = header; + + + settings = new List() { - header, - new TwoButtonsSetting(_idDesc,"Descriptions","Disabled","Enabled",true,"hide/show the description the Custom Role ",header:header), new SliderSetting(_idTimeCustomRole,"Time shown",0,30,20,header:header), new SliderSetting(_idTimeAbilityDesc,"Ability Description time shown",0,30,20,header:header), @@ -67,34 +69,33 @@ public SettingHandler() + SettingsCategory cat = new SettingsCategory(header,1000,settings); if (MainPlugin.Instance.Config.Debug) { ReflectionHelper.GetObjects().ToList(); - - List debugsettings = new(); foreach (DebugSetting debug in DebugSetting.settings) { debug.Create(); - debugsettings.AddRange(debug.Settings); + debug.GetCategory(); } - settings.AddRange(debugsettings); - - } - SettingBase.Register(settings); - } + private void OnWaitingForPlayers() + { + SettingsCategory.Register(); + } public void SubscribeEvents() { ServerSpecificSettingsSync.ServerOnSettingValueReceived += SafeOnSettingValueReceived; + Exiled.Events.Handlers.Server.WaitingForPlayers += OnWaitingForPlayers; LabApi.Events.Handlers.PlayerEvents.Joined += AddPlayer; DownPressed += Down; UpPressed += Up; @@ -105,6 +106,7 @@ public void UnsubscribeEvents() { ServerSpecificSettingsSync.ServerOnSettingValueReceived -= SafeOnSettingValueReceived; LabApi.Events.Handlers.PlayerEvents.Joined -= AddPlayer; + Exiled.Events.Handlers.Server.WaitingForPlayers -= OnWaitingForPlayers; DownPressed -= Down; UpPressed -= Up; } From 1865fa27750449ab2908e4cdbc6c49d0e322e431 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Wed, 4 Mar 2026 15:44:47 +0100 Subject: [PATCH 712/853] cleanup + new settings --- .../API/Core/Settings/SettingsHandler.cs | 39 +++++++------------ KruacentExiled/KE.Items/MainPlugin.cs | 28 ------------- 2 files changed, 13 insertions(+), 54 deletions(-) diff --git a/KruacentExiled/KE.Items/API/Core/Settings/SettingsHandler.cs b/KruacentExiled/KE.Items/API/Core/Settings/SettingsHandler.cs index 1d2a1ad2..6b84b8cb 100644 --- a/KruacentExiled/KE.Items/API/Core/Settings/SettingsHandler.cs +++ b/KruacentExiled/KE.Items/API/Core/Settings/SettingsHandler.cs @@ -2,6 +2,7 @@ using Exiled.API.Features.Core.UserSettings; using KE.Utils.API.Interfaces; using KE.Utils.API.Settings; +using KE.Utils.API.Settings.SettingsCategories; using KE.Utils.Quality.Enums; using System; using System.Collections.Generic; @@ -16,10 +17,9 @@ namespace KE.Items.API.Core.Settings { - internal class SettingsHandler : IUsingEvents + internal class SettingsHandler { - private SettingBase[] _settings; private const int _idHeader = 55; private const int _idDesc = 0; private const int _idPrefix = 1; @@ -28,43 +28,30 @@ internal class SettingsHandler : IUsingEvents //public readonly SettingsPage page; + public const string SettingDescription = "Description"; + public const string SettingDescription1 = "Disabled"; + public const string SettingDescription2 = "Enabled"; + public const string SettingDescriptionDescription = "hide/show the description of the item and its upgrade chances"; + public SettingsHandler() { - _settings = + HeaderSetting header = new HeaderSetting(_idHeader, "Custom Items", padding: true); + + List settings = [ - new HeaderSetting(_idHeader,"Custom Items",padding:true), - new TwoButtonsSetting(_idDesc,"Descriptions","Disabled","Enabled",true,"hide/show the description of the item and its upgrade chances "), + + new TwoButtonsSetting(_idDesc,SettingDescription,SettingDescription1,SettingDescription2,true,SettingDescriptionDescription), new TwoButtonsSetting(_idPrefix,"Pickup/Select prefixes","Disabled","Enabled",false,"show/hide the whole sentence for the picking or selecting of the item, if hidden it will show a (P) if pickup or a (I) if in inventory before the name of the item "), new SliderSetting(_idTimeCustomItem,"Time shown",0,30,10), new SliderSetting(_idTimeCustomItemEffect,"Time effect shown",0,30,10), ]; - List settings = new(); - - - foreach (SettingBase setting in _settings) - { - settings.Add(setting.Base); - } + SettingsCategory category = new(header,999, settings); //page = new("Custom Items", settings); - SettingBase.Register(settings: _settings); - - } - - - - public void SubscribeEvents() - { - //Utils.API.Settings.SettingHandler.Instance.AddPages(page); - } - - public void UnsubscribeEvents() - { - } diff --git a/KruacentExiled/KE.Items/MainPlugin.cs b/KruacentExiled/KE.Items/MainPlugin.cs index 12eac3ee..1da85053 100644 --- a/KruacentExiled/KE.Items/MainPlugin.cs +++ b/KruacentExiled/KE.Items/MainPlugin.cs @@ -38,10 +38,6 @@ public class MainPlugin : Plugin internal static readonly HintPlacement ItemEffectPlacement = new(0, 200, HintServiceMeow.Core.Enum.HintAlignment.Center); internal static readonly HintPlacement HintPlacement = new(0, 400, HintServiceMeow.Core.Enum.HintAlignment.Center); - //scrapped - //internal PickupQuality PickupQuality { get; private set; } - //internal QualityHandler QualityHandler { get; private set; } - public override PluginPriority Priority => PluginPriority.Low; public override Version Version => new (1, 0, 0); internal Harmony harmony; @@ -51,11 +47,8 @@ public override void OnEnabled() Instance = this; harmony = new(Name); harmony.PatchAll(Assembly); - //QualityHandler = QualityHandler.Instance; - //QualityHandler.Register(); UpgradeHandler = new UpgradeHandler(); LightsHandler = new LightsHandler(); - //PickupQuality = new PickupQuality(); SettingsHandler = new(); @@ -91,12 +84,9 @@ public override void OnEnabled() new(RoomType.Hcz049,new Vector3(18.46f, 93.73f, 13.13f),Quaternion.identity), }); - //Exiled.Events.Handlers.Server.RoundStarted += Test; KECustomItem.RegisterItems(); - //PickupQuality?.SubscribeEvents(); - SettingsHandler.SubscribeEvents(); UpgradeHandler.SubscribeEvents(); LightsHandler.SubscribeEvents(); Exiled.Events.Handlers.Map.Generated += OnGenerated; @@ -108,14 +98,8 @@ public override void OnDisabled() KECustomItem.UnregisterItems(); UpgradeHandler?.UnsubscribeEvents(); LightsHandler?.UnsubscribeEvents(); - //PickupQuality?.UnsubscribeEvents(); - //QualityHandler?.Unregister(); - SettingsHandler.UnsubscribeEvents(); Exiled.Events.Handlers.Map.Generated -= OnGenerated; - //Exiled.Events.Handlers.Server.RoundStarted -= Test; - //QualityHandler = null; - //PickupQuality = null; harmony.UnpatchAll(harmony.Id); SettingsHandler = null; LightsHandler = null; @@ -128,17 +112,5 @@ private void OnGenerated() PoseRoomSpawnPointHandler.Reset(); } - public void Test() - { - ComplexBase complex = new ComplexGatling(); - - Player player = Player.List.First(); - Log.Debug(player.Position); - complex.Spawn(player.Position,Quaternion.identity); - - - - } - } } \ No newline at end of file From 4f2ea1e8ca54071329c8713154b0b15636312465 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Wed, 4 Mar 2026 19:41:03 +0100 Subject: [PATCH 713/853] forgor to remove everything --- KruacentExiled/KE.Misc/MainPlugin.cs | 3 --- 1 file changed, 3 deletions(-) diff --git a/KruacentExiled/KE.Misc/MainPlugin.cs b/KruacentExiled/KE.Misc/MainPlugin.cs index 63d12b2c..6818b042 100644 --- a/KruacentExiled/KE.Misc/MainPlugin.cs +++ b/KruacentExiled/KE.Misc/MainPlugin.cs @@ -5,7 +5,6 @@ using System; using KE.Misc.Features; using KE.Misc.Handlers; -using Exiled.CustomRoles.API.Features; using KE.Misc.Features.GamblingCoin; using HarmonyLib; using LabApi.Events.Arguments.ServerEvents; @@ -14,7 +13,6 @@ using KE.Misc.Features.LastHuman; using KE.Utils.API.Settings.GlobalSettings; using KE.Utils.API.Translations; -using KE.Misc.Features.PatchNotes; using KE.Misc.Features.PostNuke; namespace KE.Misc @@ -66,7 +64,6 @@ public override void OnEnabled() LastHuman = new(); Candy = new Candy(); vote = new(); - PatchNote = new(); postnuke = new(); From 6f8e37f9a4bd3c6f91896363fada9e7123e19a8d Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Wed, 4 Mar 2026 19:44:14 +0100 Subject: [PATCH 714/853] change trad --- KruacentExiled/KE.Items/Items/Drone.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/KruacentExiled/KE.Items/Items/Drone.cs b/KruacentExiled/KE.Items/Items/Drone.cs index 9d7f58fb..9b03d67f 100644 --- a/KruacentExiled/KE.Items/Items/Drone.cs +++ b/KruacentExiled/KE.Items/Items/Drone.cs @@ -35,7 +35,7 @@ protected override Dictionary> SetTranslation ["fr"] = new() { [TranslationKeyName] = "Drone", - [TranslationKeyDesc] = "Drone de reconnaissance militaire (lancer pour l'utiliser)", + [TranslationKeyDesc] = "Drone de reconnaissance militaire (lâcher pour l'utiliser)", }, }; } From 3593fd3342acd1b423d6c4179cd67da8973e65e9 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Wed, 4 Mar 2026 19:59:46 +0100 Subject: [PATCH 715/853] unsub event complex base --- KruacentExiled/KE.Items/API/Features/Complexes/ComplexBase.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/KruacentExiled/KE.Items/API/Features/Complexes/ComplexBase.cs b/KruacentExiled/KE.Items/API/Features/Complexes/ComplexBase.cs index 35a38dab..ba829748 100644 --- a/KruacentExiled/KE.Items/API/Features/Complexes/ComplexBase.cs +++ b/KruacentExiled/KE.Items/API/Features/Complexes/ComplexBase.cs @@ -112,6 +112,7 @@ private void OnShootingWeapon(LabApi.Events.Arguments.PlayerEvents.PlayerShootin public void Unspawn() { + LabApi.Events.Handlers.PlayerEvents.ShootingWeapon -= OnShootingWeapon; UnspawnInteractable(); } From 95f5f7b07ef147c99a49a4c9027aca84f24be087 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Wed, 4 Mar 2026 20:00:28 +0100 Subject: [PATCH 716/853] destryo game object --- KruacentExiled/KE.Items/API/Features/Complexes/ComplexBase.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/KruacentExiled/KE.Items/API/Features/Complexes/ComplexBase.cs b/KruacentExiled/KE.Items/API/Features/Complexes/ComplexBase.cs index ba829748..f7ac54ad 100644 --- a/KruacentExiled/KE.Items/API/Features/Complexes/ComplexBase.cs +++ b/KruacentExiled/KE.Items/API/Features/Complexes/ComplexBase.cs @@ -118,6 +118,7 @@ public void Unspawn() public void Destroy() { + UnityEngine.Object.Destroy(gameObject); interactableToy.OnSearched -= OnSearched; interactableToy.Destroy(); debugprim.Destroy(); From 9a93be0dd81acb34f72356116adf3bc4f9be35ee Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Wed, 4 Mar 2026 20:01:27 +0100 Subject: [PATCH 717/853] remove using --- .../KE.Items/API/Core/Settings/SettingsHandler.cs | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/KruacentExiled/KE.Items/API/Core/Settings/SettingsHandler.cs b/KruacentExiled/KE.Items/API/Core/Settings/SettingsHandler.cs index 6b84b8cb..b0f397d7 100644 --- a/KruacentExiled/KE.Items/API/Core/Settings/SettingsHandler.cs +++ b/KruacentExiled/KE.Items/API/Core/Settings/SettingsHandler.cs @@ -1,19 +1,9 @@ using Exiled.API.Features; using Exiled.API.Features.Core.UserSettings; -using KE.Utils.API.Interfaces; -using KE.Utils.API.Settings; using KE.Utils.API.Settings.SettingsCategories; -using KE.Utils.Quality.Enums; using System; using System.Collections.Generic; -using System.Linq; -using System.Runtime; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; -using System.Runtime.Remoting.Messaging; -using System.Text; -using System.Threading.Tasks; -using UserSettings.ServerSpecific; + namespace KE.Items.API.Core.Settings { From 44fce013db39f71b916e17179b8c038639533e7a Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Wed, 4 Mar 2026 20:02:15 +0100 Subject: [PATCH 718/853] correted null chekc --- KruacentExiled/KE.Items/API/Core/Upgrade/UpgradeHandler.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/KruacentExiled/KE.Items/API/Core/Upgrade/UpgradeHandler.cs b/KruacentExiled/KE.Items/API/Core/Upgrade/UpgradeHandler.cs index d7ed060b..41ca4324 100644 --- a/KruacentExiled/KE.Items/API/Core/Upgrade/UpgradeHandler.cs +++ b/KruacentExiled/KE.Items/API/Core/Upgrade/UpgradeHandler.cs @@ -59,8 +59,8 @@ private void UpgradePickUp(UpgradingPickupEventArgs ev) CustomItem newItem = CustomItem.Get(newItemid); ev.Pickup.Destroy(); - newItem.Spawn(ev.OutputPosition); if (newItem == null) Log.Warn("warning id of custom item not found"); + newItem.Spawn(ev.OutputPosition); } ev.IsAllowed = false; From fb32c935c87a26e4e176dc240fbd4bf11a803682 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Wed, 4 Mar 2026 20:03:17 +0100 Subject: [PATCH 719/853] remove private get --- .../API/Core/Upgrade/UpgradeProperties.cs | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/KruacentExiled/KE.Items/API/Core/Upgrade/UpgradeProperties.cs b/KruacentExiled/KE.Items/API/Core/Upgrade/UpgradeProperties.cs index 1b386592..da3270fb 100644 --- a/KruacentExiled/KE.Items/API/Core/Upgrade/UpgradeProperties.cs +++ b/KruacentExiled/KE.Items/API/Core/Upgrade/UpgradeProperties.cs @@ -12,22 +12,14 @@ namespace KE.Items.API.Core.Upgrade { public class UpgradeProperties { - private float _chance; - public float Chance - { - get { return _chance; } - } + public float Chance { get; } - private uint _newItem; - public uint UpgradedItem - { - get { return _newItem; } - } + public uint UpgradedItem { get; } public UpgradeProperties(float chance, uint newItem) { - _newItem = newItem; - _chance = Mathf.Clamp(chance, 0,100); + UpgradedItem = newItem; + Chance = Mathf.Clamp(chance, 0,100); } } From 66bb3dc8863861be8d2e1bc7a6a12ea052be7183 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Wed, 4 Mar 2026 20:04:42 +0100 Subject: [PATCH 720/853] fixed cooldown not removed --- KruacentExiled/KE.Items/Items/MScan.cs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/KruacentExiled/KE.Items/Items/MScan.cs b/KruacentExiled/KE.Items/Items/MScan.cs index e3915a2c..4bbb7b44 100644 --- a/KruacentExiled/KE.Items/Items/MScan.cs +++ b/KruacentExiled/KE.Items/Items/MScan.cs @@ -175,11 +175,12 @@ private void CheckDestruction(Vector3 hitPos, float radius) } } - foreach (var p in toDestroy) + foreach (Pickup pickup in toDestroy) { - ActiveSensors.Remove(p); - BatteryLife.Remove(p); - p.Destroy(); + ActiveSensors.Remove(pickup); + BatteryLife.Remove(pickup); + Cooldowns.Remove(pickup); + pickup.Destroy(); } ListPool.Pool.Return(toDestroy); From 502ae75831d712ef2cf262ee3e050c9ab8c7e253 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Wed, 4 Mar 2026 20:06:48 +0100 Subject: [PATCH 721/853] fixed translation --- KruacentExiled/KE.Items/Items/SmokeGrenade.cs | 10 +++++----- KruacentExiled/KE.Items/Items/TPGrenada.cs | 8 ++++---- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/KruacentExiled/KE.Items/Items/SmokeGrenade.cs b/KruacentExiled/KE.Items/Items/SmokeGrenade.cs index 8f530731..3c17ab1a 100644 --- a/KruacentExiled/KE.Items/Items/SmokeGrenade.cs +++ b/KruacentExiled/KE.Items/Items/SmokeGrenade.cs @@ -18,19 +18,19 @@ protected override Dictionary> SetTranslation { ["en"] = new() { - [TranslationKeyName] = "SCP-514", - [TranslationKeyDesc] = "birb", + [TranslationKeyName] = "Smoke Grenade", + [TranslationKeyDesc] = "We finally put your grandma inside this thing ! Don't throw it or she will get out !", }, ["fr"] = new() { - [TranslationKeyName] = "SCP-514", - [TranslationKeyDesc] = "birb", + [TranslationKeyName] = "Fumigène", + [TranslationKeyDesc] = "Fait beaucoup de fumée", }, }; } public override ItemType ItemType => ItemType.GrenadeFlash; public override string Name { get; set; } = "Smoke Grenade"; - public override string Description { get; set; } = "We finally put your grandma inside this thing ! Don't throw it or she will get out !"; + public override string Description { get; set; } = ""; public override float Weight { get; set; } = 0.65f; public override float FuseTime => 3f; public override bool ExplodeOnCollision => false; diff --git a/KruacentExiled/KE.Items/Items/TPGrenada.cs b/KruacentExiled/KE.Items/Items/TPGrenada.cs index 896dbdaa..35b748f1 100644 --- a/KruacentExiled/KE.Items/Items/TPGrenada.cs +++ b/KruacentExiled/KE.Items/Items/TPGrenada.cs @@ -21,13 +21,13 @@ protected override Dictionary> SetTranslation { ["en"] = new() { - [TranslationKeyName] = "SCP-514", - [TranslationKeyDesc] = "birb", + [TranslationKeyName] = "Teleportation Grenade", + [TranslationKeyDesc] = "This grenade does 0 damage but teleport nearby players in a random place (does work in other dimension ;3 )", }, ["fr"] = new() { - [TranslationKeyName] = "SCP-514", - [TranslationKeyDesc] = "birb", + [TranslationKeyName] = "Grenade de Téléportation", + [TranslationKeyDesc] = "Ne fait pas de dégât mais téléporte dans une pièce aléatoire", }, }; } From ab2f8660b55d5da293d50c5fea1649cc27d64f8c Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Sun, 8 Mar 2026 19:03:32 +0100 Subject: [PATCH 722/853] more 914 role change --- .../RoleChanging/Base914PlayerRoleChange.cs | 2 +- .../914Upgrades/RoleChanging/Human914RC.cs | 26 ++++++++ .../Multiple914PlayerRoleChangeBase.cs | 59 +++++++++++++++++++ 3 files changed, 86 insertions(+), 1 deletion(-) create mode 100644 KruacentExiled/KE.Misc/Features/914Upgrades/RoleChanging/Multiple914PlayerRoleChangeBase.cs diff --git a/KruacentExiled/KE.Misc/Features/914Upgrades/RoleChanging/Base914PlayerRoleChange.cs b/KruacentExiled/KE.Misc/Features/914Upgrades/RoleChanging/Base914PlayerRoleChange.cs index fb91a000..0d23d744 100644 --- a/KruacentExiled/KE.Misc/Features/914Upgrades/RoleChanging/Base914PlayerRoleChange.cs +++ b/KruacentExiled/KE.Misc/Features/914Upgrades/RoleChanging/Base914PlayerRoleChange.cs @@ -15,7 +15,7 @@ namespace KE.Misc.Features._914Upgrades { public abstract class Base914PlayerRoleChange : Base914PlayerUpgrade { - private static HashSet _upgradingPlayer = new(); + protected static HashSet _upgradingPlayer = new(); public abstract RoleTypeId InputRole { get; } diff --git a/KruacentExiled/KE.Misc/Features/914Upgrades/RoleChanging/Human914RC.cs b/KruacentExiled/KE.Misc/Features/914Upgrades/RoleChanging/Human914RC.cs index 3782859f..3dcaa803 100644 --- a/KruacentExiled/KE.Misc/Features/914Upgrades/RoleChanging/Human914RC.cs +++ b/KruacentExiled/KE.Misc/Features/914Upgrades/RoleChanging/Human914RC.cs @@ -1,4 +1,5 @@ using Exiled.API.Features; +using MEC; using PlayerRoles; using Scp914; using System; @@ -41,7 +42,32 @@ public class Guard914RC : Base914PlayerRoleChange protected override void SetRole(Player player, RoleTypeId newRole) { player.Role.Set(newRole, RoleSpawnFlags.AssignInventory); + Timing.CallDelayed(.5f, () => + { + _upgradingPlayer.Remove(player); + }); } } + public class MTF914RC : Multiple914PlayerRoleChangeBase + { + public override HashSet InputRole => [RoleTypeId.NtfCaptain,RoleTypeId.NtfPrivate,RoleTypeId.NtfSergeant,RoleTypeId.NtfSpecialist]; + + public override IReadOnlyDictionary OutputRoles { get; } = new Dictionary() + { + { Scp914KnobSetting.OneToOne,new(RoleTypeId.ChaosRifleman,50f)} + }; + + } + + public class Chaos914RC : Multiple914PlayerRoleChangeBase + { + public override HashSet InputRole => [RoleTypeId.ChaosRifleman, RoleTypeId.ChaosRepressor, RoleTypeId.ChaosMarauder, RoleTypeId.ChaosConscript]; + + public override IReadOnlyDictionary OutputRoles { get; } = new Dictionary() + { + { Scp914KnobSetting.OneToOne,new(RoleTypeId.ChaosRifleman,50f)} + }; + + } } diff --git a/KruacentExiled/KE.Misc/Features/914Upgrades/RoleChanging/Multiple914PlayerRoleChangeBase.cs b/KruacentExiled/KE.Misc/Features/914Upgrades/RoleChanging/Multiple914PlayerRoleChangeBase.cs new file mode 100644 index 00000000..5c57570e --- /dev/null +++ b/KruacentExiled/KE.Misc/Features/914Upgrades/RoleChanging/Multiple914PlayerRoleChangeBase.cs @@ -0,0 +1,59 @@ +using Exiled.API.Features; +using Exiled.Events.EventArgs.Scp914; +using KE.Utils.API.Features; +using KE.Utils.API.Interfaces; +using MEC; +using PlayerRoles; +using Scp914; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace KE.Misc.Features._914Upgrades +{ + public abstract class Multiple914PlayerRoleChangeBase : Base914PlayerUpgrade + { + protected static HashSet _upgradingPlayer = new(); + + public abstract HashSet InputRole { get; } + + public abstract IReadOnlyDictionary OutputRoles { get; } + protected sealed override float Chance => 100; + + protected sealed override void OnUpgradingPlayer(UpgradingPlayerEventArgs ev) + { + Player player = ev.Player; + if (InputRole.Contains(ev.Player.Role)) return; + if (!OutputRoles.TryGetValue(ev.KnobSetting, out var newRole)) return; + if (!LuckCheck(newRole.chance)) return; + if (_upgradingPlayer.Contains(player)) return; + + KELog.Debug($"upgrading {player.Role.Type}->{newRole.role}"); + + + SetRole(player, newRole.role); + + _upgradingPlayer.Add(player); + + } + + protected virtual void SetRole(Player player,RoleTypeId newRole) + { + player.Role.Set(newRole,RoleSpawnFlags.None); + Timing.CallDelayed(.5f, () => + { + _upgradingPlayer.Remove(player); + }); + } + + + + + + + + + } +} From ca26f13d4cba76c9d77b3d07678d281500ef80be Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Sun, 8 Mar 2026 19:23:52 +0100 Subject: [PATCH 723/853] added role check --- .../KE.CustomRoles/API/Features/GlobalCustomRole.cs | 7 ++++++- .../KE.CustomRoles/API/Features/KECustomRole.cs | 8 +++++++- .../API/Features/KECustomRoleMultipleRole.cs | 6 ++---- 3 files changed, 15 insertions(+), 6 deletions(-) diff --git a/KruacentExiled/KE.CustomRoles/API/Features/GlobalCustomRole.cs b/KruacentExiled/KE.CustomRoles/API/Features/GlobalCustomRole.cs index fce1b616..4c704950 100644 --- a/KruacentExiled/KE.CustomRoles/API/Features/GlobalCustomRole.cs +++ b/KruacentExiled/KE.CustomRoles/API/Features/GlobalCustomRole.cs @@ -106,10 +106,15 @@ protected override void ShowMessage(Player player) public override bool IsAvailable(Player player) { - if (player.Role == RoleTypeId.Scp106) return false; + //if (player.Role == RoleTypeId.Scp106) return false; if (CurrentNumberOfSpawn >= Limit) return false; return SideClass.Get(player.Role.Side) == Side; } + + public override bool RoleCheck(RoleTypeId role) + { + return SideClass.Get(role.GetSide()) == Side; + } } public enum SideEnum diff --git a/KruacentExiled/KE.CustomRoles/API/Features/KECustomRole.cs b/KruacentExiled/KE.CustomRoles/API/Features/KECustomRole.cs index 52312e3c..f01054bf 100644 --- a/KruacentExiled/KE.CustomRoles/API/Features/KECustomRole.cs +++ b/KruacentExiled/KE.CustomRoles/API/Features/KECustomRole.cs @@ -556,7 +556,13 @@ public override void RemoveRole(Player player) public virtual bool IsAvailable(Player player) { if (CurrentNumberOfSpawn >= Limit) return false; - return player.Role == Role; + return RoleCheck(player.Role); + } + + + public virtual bool RoleCheck(RoleTypeId role) + { + return Role == role; } diff --git a/KruacentExiled/KE.CustomRoles/API/Features/KECustomRoleMultipleRole.cs b/KruacentExiled/KE.CustomRoles/API/Features/KECustomRoleMultipleRole.cs index a33c8d42..ccbb24ed 100644 --- a/KruacentExiled/KE.CustomRoles/API/Features/KECustomRoleMultipleRole.cs +++ b/KruacentExiled/KE.CustomRoles/API/Features/KECustomRoleMultipleRole.cs @@ -35,11 +35,9 @@ protected override void AttributeHealth(Player player) } - - public override bool IsAvailable(Player player) + public override bool RoleCheck(RoleTypeId role) { - if (CurrentNumberOfSpawn >= Limit) return false; - return Roles.Contains(player.Role); + return Roles.Contains(role); } } From bde763be05c66e37c473b17b550f854127ad6c41 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Sun, 8 Mar 2026 20:53:05 +0100 Subject: [PATCH 724/853] 914 role --- KruacentExiled/KE.Misc/Features/914.cs | 37 ++++++++++++++++++- .../914Upgrades/Base914PlayerUpgrade.cs | 2 +- .../Features/914Upgrades/Base914Upgrade.cs | 27 ++++---------- .../Features/914Upgrades/OmniCardUpgrade.cs | 7 ++-- .../Features/914Upgrades/PlayerTeleport914.cs | 17 +++++++-- .../RoleChanging/Base914PlayerRoleChange.cs | 31 ++++++++-------- .../914Upgrades/RoleChanging/Human914RC.cs | 9 ++--- .../Multiple914PlayerRoleChangeBase.cs | 15 ++++---- 8 files changed, 88 insertions(+), 57 deletions(-) diff --git a/KruacentExiled/KE.Misc/Features/914.cs b/KruacentExiled/KE.Misc/Features/914.cs index 11acf469..36c49557 100644 --- a/KruacentExiled/KE.Misc/Features/914.cs +++ b/KruacentExiled/KE.Misc/Features/914.cs @@ -1,10 +1,45 @@ -using KE.Misc.Features._914Upgrades; +using Exiled.Events.EventArgs.Scp914; +using KE.Misc.Features._914Upgrades; namespace KE.Misc.Features { internal class _914 : LoadingMiscFeature { + public override void SubscribeEvents() + { + Exiled.Events.Handlers.Scp914.UpgradingPlayer += InternalUpgradingPlayer; + base.SubscribeEvents(); + } + + public override void UnsubscribeEvents() + { + Exiled.Events.Handlers.Scp914.UpgradingPlayer -= InternalUpgradingPlayer; + base.UnsubscribeEvents(); + } + + + + internal void InternalUpgradingPlayer(UpgradingPlayerEventArgs ev) + { + if (!ev.IsAllowed) + { + return; + } + + + foreach(Base914Upgrade feature in _allLoadedFeatures) + { + bool flag = feature.InternalUpgradingPlayer(ev); + if (flag) + { + break; + } + } + + + } + } } diff --git a/KruacentExiled/KE.Misc/Features/914Upgrades/Base914PlayerUpgrade.cs b/KruacentExiled/KE.Misc/Features/914Upgrades/Base914PlayerUpgrade.cs index 643f111e..488489c5 100644 --- a/KruacentExiled/KE.Misc/Features/914Upgrades/Base914PlayerUpgrade.cs +++ b/KruacentExiled/KE.Misc/Features/914Upgrades/Base914PlayerUpgrade.cs @@ -12,7 +12,7 @@ namespace KE.Misc.Features._914Upgrades public abstract class Base914PlayerUpgrade : Base914Upgrade { - protected override abstract void OnUpgradingPlayer(UpgradingPlayerEventArgs ev); + protected override abstract bool OnUpgradingPlayer(UpgradingPlayerEventArgs ev); diff --git a/KruacentExiled/KE.Misc/Features/914Upgrades/Base914Upgrade.cs b/KruacentExiled/KE.Misc/Features/914Upgrades/Base914Upgrade.cs index 387ee024..e229cccd 100644 --- a/KruacentExiled/KE.Misc/Features/914Upgrades/Base914Upgrade.cs +++ b/KruacentExiled/KE.Misc/Features/914Upgrades/Base914Upgrade.cs @@ -7,40 +7,29 @@ namespace KE.Misc.Features._914Upgrades { - public abstract class Base914Upgrade : IUsingEvents + public abstract class Base914Upgrade { protected abstract float Chance { get; } - public virtual void SubscribeEvents() - { - Exiled.Events.Handlers.Scp914.UpgradingPlayer += InternalUpgradingPlayer; - } - public virtual void UnsubscribeEvents() - { - Exiled.Events.Handlers.Scp914.UpgradingPlayer -= InternalUpgradingPlayer; - } - private void InternalUpgradingPlayer(UpgradingPlayerEventArgs ev) + + internal bool InternalUpgradingPlayer(UpgradingPlayerEventArgs ev) { - if (!ev.IsAllowed) return; - if (!LuckCheck()) return; - OnUpgradingPlayer(ev); + if (!LuckCheck()) return false; + return OnUpgradingPlayer(ev); } /// /// Auto check the probability with the and if it's allowed /// - protected virtual void OnUpgradingPlayer(UpgradingPlayerEventArgs ev) - { - - } + protected abstract bool OnUpgradingPlayer(UpgradingPlayerEventArgs ev); - protected bool LuckCheck() + public bool LuckCheck() { - return UnityEngine.Random.Range(0f, 100f) < Mathf.Clamp(Chance, 0f, 100f); + return LuckCheck(Chance); } /// diff --git a/KruacentExiled/KE.Misc/Features/914Upgrades/OmniCardUpgrade.cs b/KruacentExiled/KE.Misc/Features/914Upgrades/OmniCardUpgrade.cs index a72e1d88..40171f07 100644 --- a/KruacentExiled/KE.Misc/Features/914Upgrades/OmniCardUpgrade.cs +++ b/KruacentExiled/KE.Misc/Features/914Upgrades/OmniCardUpgrade.cs @@ -23,15 +23,16 @@ public class OmniCardUpgrade : Base914PlayerUpgrade protected override float Chance => 1; public static readonly Color32 CardColor = new(45, 44, 249,255); - protected override void OnUpgradingPlayer(UpgradingPlayerEventArgs ev) + protected override bool OnUpgradingPlayer(UpgradingPlayerEventArgs ev) { LabPlayer player = ev.Player; - if (player.CurrentItem is null) return; - if (player.CurrentItem is not KeycardItem keycard) return; + if (player.CurrentItem is null) return false; + if (player.CurrentItem is not KeycardItem keycard) return false; player.RemoveItem(keycard); player.CurrentItem = CreateOmniCard(player); + return true; } public static KeycardItem CreateOmniCard(LabPlayer player) diff --git a/KruacentExiled/KE.Misc/Features/914Upgrades/PlayerTeleport914.cs b/KruacentExiled/KE.Misc/Features/914Upgrades/PlayerTeleport914.cs index b52a0dcb..6e796b4d 100644 --- a/KruacentExiled/KE.Misc/Features/914Upgrades/PlayerTeleport914.cs +++ b/KruacentExiled/KE.Misc/Features/914Upgrades/PlayerTeleport914.cs @@ -1,9 +1,11 @@ using Exiled.API.Enums; using Exiled.API.Features; using Exiled.Events.EventArgs.Scp914; +using InventorySystem.Items.Usables.Scp330; using KE.Utils.API.Features; using KE.Utils.Extensions; using MEC; +using PlayerRoles.FirstPersonControl; using Scp914; using System; @@ -13,12 +15,19 @@ public class PlayerTeleport914 : Base914PlayerUpgrade { public float ChanceTpEntrance = 1; protected override float Chance => 100; - protected override void OnUpgradingPlayer(UpgradingPlayerEventArgs ev) + protected override bool OnUpgradingPlayer(UpgradingPlayerEventArgs ev) { - KELog.Debug("Upgrade"); + KELog.Debug("Upgrade teleport"); Player player = ev.Player; Room room = null; - if (ev.KnobSetting == Scp914KnobSetting.Fine && LuckCheck(1)) + + if(player.Role is not PlayerRoles.FirstPersonControl.IFpcRole fpc) + { + return false; + } + + //TeleportOutcome.GetBestExitPosition(fpc); + if (ev.KnobSetting == Scp914KnobSetting.Fine && LuckCheck(ChanceTpEntrance)) { try { @@ -53,9 +62,9 @@ protected override void OnUpgradingPlayer(UpgradingPlayerEventArgs ev) }); } - + return true; } diff --git a/KruacentExiled/KE.Misc/Features/914Upgrades/RoleChanging/Base914PlayerRoleChange.cs b/KruacentExiled/KE.Misc/Features/914Upgrades/RoleChanging/Base914PlayerRoleChange.cs index 0d23d744..f4f3ea46 100644 --- a/KruacentExiled/KE.Misc/Features/914Upgrades/RoleChanging/Base914PlayerRoleChange.cs +++ b/KruacentExiled/KE.Misc/Features/914Upgrades/RoleChanging/Base914PlayerRoleChange.cs @@ -2,6 +2,7 @@ using Exiled.Events.EventArgs.Scp914; using KE.Utils.API.Features; using KE.Utils.API.Interfaces; +using KE.Utils.Extensions; using MEC; using PlayerRoles; using Scp914; @@ -22,38 +23,36 @@ public abstract class Base914PlayerRoleChange : Base914PlayerUpgrade public abstract IReadOnlyDictionary OutputRoles { get; } protected sealed override float Chance => 100; - protected sealed override void OnUpgradingPlayer(UpgradingPlayerEventArgs ev) + protected sealed override bool OnUpgradingPlayer(UpgradingPlayerEventArgs ev) { Player player = ev.Player; - if (player.Role != InputRole) return; - if (!OutputRoles.TryGetValue(ev.KnobSetting, out var newRole)) return; - if (!LuckCheck(newRole.chance)) return; - if (_upgradingPlayer.Contains(player)) return; + if (player.Role != InputRole) return false; + if (!OutputRoles.TryGetValue(ev.KnobSetting, out var newRole)) return false; + if (_upgradingPlayer.Contains(player)) return false; + if (!LuckCheck(newRole.chance)) return false; KELog.Debug($"upgrading {player.Role.Type}->{newRole.role}"); - SetRole(player, newRole.role); + Set(player, newRole.role); _upgradingPlayer.Add(player); - + return true; } - protected virtual void SetRole(Player player,RoleTypeId newRole) + private void Set(Player player, RoleTypeId newRole) { - player.Role.Set(newRole,RoleSpawnFlags.None); + + SetRole(player, newRole); Timing.CallDelayed(.5f, () => { _upgradingPlayer.Remove(player); }); } - - - - - - - + protected virtual void SetRole(Player player,RoleTypeId newRole) + { + player.ChangeRole(newRole, Exiled.API.Enums.SpawnReason.ForceClass, RoleSpawnFlags.None); + } } } diff --git a/KruacentExiled/KE.Misc/Features/914Upgrades/RoleChanging/Human914RC.cs b/KruacentExiled/KE.Misc/Features/914Upgrades/RoleChanging/Human914RC.cs index 3dcaa803..b9eb27b4 100644 --- a/KruacentExiled/KE.Misc/Features/914Upgrades/RoleChanging/Human914RC.cs +++ b/KruacentExiled/KE.Misc/Features/914Upgrades/RoleChanging/Human914RC.cs @@ -1,4 +1,5 @@ using Exiled.API.Features; +using KE.Utils.Extensions; using MEC; using PlayerRoles; using Scp914; @@ -41,11 +42,7 @@ public class Guard914RC : Base914PlayerRoleChange protected override void SetRole(Player player, RoleTypeId newRole) { - player.Role.Set(newRole, RoleSpawnFlags.AssignInventory); - Timing.CallDelayed(.5f, () => - { - _upgradingPlayer.Remove(player); - }); + player.ChangeRole(newRole, Exiled.API.Enums.SpawnReason.ForceClass, RoleSpawnFlags.AssignInventory); } } @@ -66,7 +63,7 @@ public class Chaos914RC : Multiple914PlayerRoleChangeBase public override IReadOnlyDictionary OutputRoles { get; } = new Dictionary() { - { Scp914KnobSetting.OneToOne,new(RoleTypeId.ChaosRifleman,50f)} + { Scp914KnobSetting.OneToOne,new(RoleTypeId.NtfPrivate,50f)} }; } diff --git a/KruacentExiled/KE.Misc/Features/914Upgrades/RoleChanging/Multiple914PlayerRoleChangeBase.cs b/KruacentExiled/KE.Misc/Features/914Upgrades/RoleChanging/Multiple914PlayerRoleChangeBase.cs index 5c57570e..1d077bdd 100644 --- a/KruacentExiled/KE.Misc/Features/914Upgrades/RoleChanging/Multiple914PlayerRoleChangeBase.cs +++ b/KruacentExiled/KE.Misc/Features/914Upgrades/RoleChanging/Multiple914PlayerRoleChangeBase.cs @@ -2,6 +2,7 @@ using Exiled.Events.EventArgs.Scp914; using KE.Utils.API.Features; using KE.Utils.API.Interfaces; +using KE.Utils.Extensions; using MEC; using PlayerRoles; using Scp914; @@ -22,13 +23,13 @@ public abstract class Multiple914PlayerRoleChangeBase : Base914PlayerUpgrade public abstract IReadOnlyDictionary OutputRoles { get; } protected sealed override float Chance => 100; - protected sealed override void OnUpgradingPlayer(UpgradingPlayerEventArgs ev) + protected sealed override bool OnUpgradingPlayer(UpgradingPlayerEventArgs ev) { Player player = ev.Player; - if (InputRole.Contains(ev.Player.Role)) return; - if (!OutputRoles.TryGetValue(ev.KnobSetting, out var newRole)) return; - if (!LuckCheck(newRole.chance)) return; - if (_upgradingPlayer.Contains(player)) return; + if (!InputRole.Contains(ev.Player.Role)) return false; + if (!OutputRoles.TryGetValue(ev.KnobSetting, out var newRole)) return false; + if (_upgradingPlayer.Contains(player)) return false; + if (!LuckCheck(newRole.chance)) return false; KELog.Debug($"upgrading {player.Role.Type}->{newRole.role}"); @@ -36,12 +37,12 @@ protected sealed override void OnUpgradingPlayer(UpgradingPlayerEventArgs ev) SetRole(player, newRole.role); _upgradingPlayer.Add(player); - + return true; } protected virtual void SetRole(Player player,RoleTypeId newRole) { - player.Role.Set(newRole,RoleSpawnFlags.None); + player.ChangeRole(newRole, Exiled.API.Enums.SpawnReason.ForceClass, RoleSpawnFlags.None); Timing.CallDelayed(.5f, () => { _upgradingPlayer.Remove(player); From 0594fba07fb503b410f4d7cc2217887f27c7a32e Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Tue, 10 Mar 2026 11:06:56 +0100 Subject: [PATCH 725/853] remove vote when player leave --- .../KE.Misc/Features/VoteStart/VoteStart.cs | 21 +++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/KruacentExiled/KE.Misc/Features/VoteStart/VoteStart.cs b/KruacentExiled/KE.Misc/Features/VoteStart/VoteStart.cs index 9f0a692d..833c907f 100644 --- a/KruacentExiled/KE.Misc/Features/VoteStart/VoteStart.cs +++ b/KruacentExiled/KE.Misc/Features/VoteStart/VoteStart.cs @@ -20,17 +20,15 @@ internal class VoteStart : MiscFeature public static HintPosition HintPosition = new VotePosition(); - private HashSet Voted = new(); + private List Voted = new(); private bool voteCasted = false; public override void SubscribeEvents() { Exiled.Events.Handlers.Server.WaitingForPlayers += OnWaitingForPlayers; Exiled.Events.Handlers.Player.VoiceChatting += OnVoiceChatting; - Exiled.Events.Handlers.Player.Joined += OnJoined; Exiled.Events.Handlers.Server.RoundStarted += OnRoundStarted; - - Init(); - + Exiled.Events.Handlers.Player.Left += OnLeft; + Exiled.Events.Handlers.Player.Joined += OnJoined; base.SubscribeEvents(); } @@ -41,11 +39,22 @@ public override void UnsubscribeEvents() Exiled.Events.Handlers.Player.VoiceChatting -= OnVoiceChatting; Exiled.Events.Handlers.Player.Joined -= OnJoined; Exiled.Events.Handlers.Server.RoundStarted -= OnRoundStarted; + Exiled.Events.Handlers.Player.Left -= OnLeft; base.UnsubscribeEvents(); } + private void OnLeft(LeftEventArgs ev) + { + Player player = ev.Player; + if (DidVote(player)) + { + CancelVote(player); + } + } + + public bool DidVote(Player player) { return Voted.Contains(player); @@ -68,8 +77,8 @@ public void CancelVote(Player player) private void OnVoiceChatting(VoiceChattingEventArgs ev) { - if (!Round.IsLobby) return; if (voteCasted) return; + if (!Round.IsLobby) return; if (ev.Player is null) { return; From 250dffd9ced3ca9bb539b2e150a9b31bc4faf908 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Tue, 10 Mar 2026 11:38:13 +0100 Subject: [PATCH 726/853] omni card command --- .../KE.Misc/Features/914Upgrades/GiveOmni.cs | 47 +++++++++++++++++++ .../Features/914Upgrades/OmniCardUpgrade.cs | 13 +---- 2 files changed, 48 insertions(+), 12 deletions(-) create mode 100644 KruacentExiled/KE.Misc/Features/914Upgrades/GiveOmni.cs diff --git a/KruacentExiled/KE.Misc/Features/914Upgrades/GiveOmni.cs b/KruacentExiled/KE.Misc/Features/914Upgrades/GiveOmni.cs new file mode 100644 index 00000000..926ff934 --- /dev/null +++ b/KruacentExiled/KE.Misc/Features/914Upgrades/GiveOmni.cs @@ -0,0 +1,47 @@ +using CommandSystem; +using Exiled.API.Features; +using Exiled.API.Features.Roles; +using KE.Utils.API.Commands; +using System; +using LabPlayer = LabApi.Features.Wrappers.Player; +namespace KE.Misc.Features._914Upgrades +{ + [CommandHandler(typeof(RemoteAdminCommandHandler))] + public class GiveOmni : KECommand + { + public override string Command => "giveomni"; + + public override string[] Aliases => []; + + public override string Description => "gives an omni card"; + + public override string[] Usage => []; + + public override bool ExecuteCommand(ArraySegment arguments, ICommandSender sender, out string response) + { + Player player = Player.Get(sender); + + if(player is null) + { + response = "player null"; + return false; + } + + if(player.Role is not FpcRole) + { + response = "wrong role"; + return false; + } + + + LabPlayer labPlayer = LabPlayer.Get(sender); + labPlayer.CurrentItem = OmniCardUpgrade.CreateOmniCard(player); + + response = "done"; + return true; + + + + } + } +} diff --git a/KruacentExiled/KE.Misc/Features/914Upgrades/OmniCardUpgrade.cs b/KruacentExiled/KE.Misc/Features/914Upgrades/OmniCardUpgrade.cs index 40171f07..da4ab024 100644 --- a/KruacentExiled/KE.Misc/Features/914Upgrades/OmniCardUpgrade.cs +++ b/KruacentExiled/KE.Misc/Features/914Upgrades/OmniCardUpgrade.cs @@ -1,19 +1,8 @@ -using Exiled.API.Features; -using Exiled.API.Features.Items; -using Exiled.Events.EventArgs.Scp914; -using LabApi.Features.Wrappers; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; +using Exiled.Events.EventArgs.Scp914; using UnityEngine; using LabPlayer = LabApi.Features.Wrappers.Player; -using DetailBase = InventorySystem.Items.Keycards.DetailBase; using Interactables.Interobjects.DoorUtils; -using InventorySystem.Items.Keycards; -using System.Xml.Linq; using KeycardItem = LabApi.Features.Wrappers.KeycardItem; -using InventorySystem; namespace KE.Misc.Features._914Upgrades From d5f1f56e01a2f44c584f1c5c16765d25aca345a5 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Tue, 10 Mar 2026 13:17:29 +0100 Subject: [PATCH 727/853] buff thief --- .../KE.CustomRoles/Abilities/Thief.cs | 75 ++++++++++++++++--- 1 file changed, 64 insertions(+), 11 deletions(-) diff --git a/KruacentExiled/KE.CustomRoles/Abilities/Thief.cs b/KruacentExiled/KE.CustomRoles/Abilities/Thief.cs index 555fed82..b257e571 100644 --- a/KruacentExiled/KE.CustomRoles/Abilities/Thief.cs +++ b/KruacentExiled/KE.CustomRoles/Abilities/Thief.cs @@ -4,9 +4,13 @@ using KE.CustomRoles.API.Features; using KE.CustomRoles.API.Interfaces; using KE.Utils.API.Displays.DisplayMeow; +using KE.Utils.API.Features; +using KE.Utils.API.Features.SCPs; using KE.Utils.API.GifAnimator; +using LiteNetLib4Mirror.Open.Nat; using System.Collections.Generic; using System.Linq; +using UnityEngine; namespace KE.CustomRoles.Abilities { @@ -21,8 +25,10 @@ protected override Dictionary> SetTranslation { ["en"] = new() { - [TranslationKeyName] = "Thief", + [TranslationKeyName] = "Steal", [TranslationKeyDesc] = "Steal a random item from a player in the same room", + ["ThiefNoPlayer"] = "no player to steal from", + ["ThiefFail"] = "I think this is a skill issue ! Congrats !", }, ["fr"] = new() { @@ -32,38 +38,85 @@ protected override Dictionary> SetTranslation }; } - public override float Cooldown { get; } = 120f; + public override float Cooldown { get; } = 60f; public TextImage IconName => MainPlugin.Instance.icons[Name]; protected override bool AbilityUsed(Player player) { - Player thiefed = Player.Enumerable.GetRandomValue(p => !p.IsScp && p.CurrentRoom == player.CurrentRoom && p != player); - if(thiefed is null) + IEnumerable sameRoom = Player.Enumerable.Where(p => p.CurrentRoom == player.CurrentRoom && !p.IsInventoryEmpty && p != player); + + + + KELog.Debug("scp"); + Player scp = GetClosest(sameRoom.Where(p => SCPTeam.IsSCP(p.ReferenceHub)), player.Position); + + + if(scp is not null) { - MainPlugin.ShowEffectHint(player, "no player to steal from"); - return false; + KELog.Debug("steal scp"); + Steal(player, scp); + return true; } - Log.Debug($"Thiefed player : {thiefed.Nickname}"); + KELog.Debug("enemy"); + Player enemy = GetClosest(sameRoom.Where(p => HitboxIdentity.IsEnemy(player.ReferenceHub, p.ReferenceHub)),player.Position); + - Item item = thiefed.Items.GetRandomValue(); + if(enemy is not null) + { + KELog.Debug("steal enemy"); + Steal(player, enemy); + return true; + } + + KELog.Debug("other"); + Player ally = GetClosest(sameRoom, player.Position); - if (item == null) + if (ally is not null) { - MainPlugin.ShowEffectHint(player, "I think this is a skill issue ! Congrats !"); + KELog.Debug("steal ally"); + Steal(player, ally); return true; } + MainPlugin.ShowEffectHint(player, "no player to steal from"); + return false; + } + + private void Steal(Player player, Player thiefed) + { + + Item item; + + if(player.CurrentItem is null || UnityEngine.Random.Range(0f,100f) < 50f) + { + item = thiefed.Items.GetRandomValue(); + } + else + { + item = player.CurrentItem; + } + + Item newitem = item.Clone(); newitem.Give(player); thiefed.RemoveItem(item); + } + - return base.AbilityUsed(player); + + + private Player GetClosest(IEnumerable players,Vector3 center) + { + return players.OrderBy(p => Vector3.Distance(center, p.Position)).FirstOrDefault(); } + + + } } From 2ab6fccde85fe6ee2191cc37e5ee963c34e3f608 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Tue, 10 Mar 2026 14:35:15 +0100 Subject: [PATCH 728/853] limited ability --- .../Features/{ => Abilities}/KEAbilityCost.cs | 4 +- .../Features/Abilities/KEAbilityLimited.cs | 76 +++++++++++++++++++ .../API/Features/KEAbilities.cs | 55 +++++++++----- .../FireAbilities/FireAbilityBase.cs | 2 +- .../KE.CustomRoles/Abilities/ForceOpen.cs | 24 +++--- 5 files changed, 125 insertions(+), 36 deletions(-) rename KruacentExiled/KE.CustomRoles/API/Features/{ => Abilities}/KEAbilityCost.cs (87%) create mode 100644 KruacentExiled/KE.CustomRoles/API/Features/Abilities/KEAbilityLimited.cs diff --git a/KruacentExiled/KE.CustomRoles/API/Features/KEAbilityCost.cs b/KruacentExiled/KE.CustomRoles/API/Features/Abilities/KEAbilityCost.cs similarity index 87% rename from KruacentExiled/KE.CustomRoles/API/Features/KEAbilityCost.cs rename to KruacentExiled/KE.CustomRoles/API/Features/Abilities/KEAbilityCost.cs index 1e6e1f81..a84bf8ea 100644 --- a/KruacentExiled/KE.CustomRoles/API/Features/KEAbilityCost.cs +++ b/KruacentExiled/KE.CustomRoles/API/Features/Abilities/KEAbilityCost.cs @@ -7,12 +7,13 @@ using System.Text; using System.Threading.Tasks; -namespace KE.CustomRoles.API.Features +namespace KE.CustomRoles.API.Features.Abilities { public abstract class KEAbilityCost : KEAbilities { public abstract int Cost { get; } + public virtual string CostName { get; } = string.Empty; protected sealed override bool AbilityUsed(Player player) { bool result = CanLaunchAbility(player); @@ -36,6 +37,7 @@ protected override void Gui(StringBuilder sb,Player player) base.Gui(sb,player); sb.Append("("); sb.Append(Cost); + sb.Append(CostName); sb.Append(")"); sb.Append(" "); } diff --git a/KruacentExiled/KE.CustomRoles/API/Features/Abilities/KEAbilityLimited.cs b/KruacentExiled/KE.CustomRoles/API/Features/Abilities/KEAbilityLimited.cs new file mode 100644 index 00000000..77117a0a --- /dev/null +++ b/KruacentExiled/KE.CustomRoles/API/Features/Abilities/KEAbilityLimited.cs @@ -0,0 +1,76 @@ +using Exiled.API.Features; +using KE.CustomRoles.Abilities.FireAbilities; +using KE.Utils.API.CustomStats; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace KE.CustomRoles.API.Features.Abilities +{ + public abstract class KEAbilityLimited : KEAbilities + { + + public abstract int Uses { get; } + + private Dictionary uses =new(); + + public override void AddAbility(Player player) + { + uses[player] = Uses; + base.AddAbility(player); + } + protected sealed override bool AbilityUsed(Player player) + { + bool result = false; + int use = GetUse(player); + if (use > 0) + { + uses[player]--; + result = LaunchedAbility(player); + } + if(use <= 0) + { + RemoveAbility(player); + } + + return result; + } + + protected virtual bool LaunchedAbility(Player player) + { + return true; + } + + + public int GetUse(Player player) + { + if(!uses.TryGetValue(player,out int result)) + { + return -1; + } + + return result; + } + + + + protected override void Gui(StringBuilder sb,Player player) + { + GuiAbilityName(sb, player); + GuiUses(sb, player); + GuiReady(sb, player); + GuiArrow(sb, player); + } + + + protected void GuiUses(StringBuilder sb, Player player) + { + sb.Append("("); + sb.Append(uses[player]); + sb.Append(" left)"); + sb.Append(" "); + } + } +} diff --git a/KruacentExiled/KE.CustomRoles/API/Features/KEAbilities.cs b/KruacentExiled/KE.CustomRoles/API/Features/KEAbilities.cs index b7d43dc9..cb5115db 100644 --- a/KruacentExiled/KE.CustomRoles/API/Features/KEAbilities.cs +++ b/KruacentExiled/KE.CustomRoles/API/Features/KEAbilities.cs @@ -12,6 +12,7 @@ using KE.Utils.API; using KE.Utils.API.Displays.DisplayMeow; using KE.Utils.API.Displays.DisplayMeow.Placements; +using KE.Utils.API.Features; using KE.Utils.API.Translations; using MEC; using PlayerRoles.FirstPersonControl.Thirdperson; @@ -216,8 +217,11 @@ public void SelectAbility(Player player, bool hide = false) public void UnselectAbility(Player player) { - Log.Debug($"player {player.Nickname} unselected ability {this}"); - selected.Remove(player); + if (selected.Remove(player)) + { + KELog.Debug($"player {player.Nickname} unselected ability {this}"); + } + } public void RemoveAbility(Player player) @@ -225,13 +229,14 @@ public void RemoveAbility(Player player) if (Players.Contains(player)) { - Log.Debug($"player {player.Nickname} lost {this}"); + KELog.Debug($"player {player.Nickname} lost {this}"); PlayersAbility[player].Remove(this); Players.Remove(player); + UnselectAbility(player); AbilityRemoved(player); } } - public void AddAbility(Player player) + public virtual void AddAbility(Player player) { bool result = Players.Add(player); @@ -398,6 +403,11 @@ public static void ReaffectRemovedAbilities(Player player) } + public bool IsSelected(Player player) + { + return Selected.Contains(player); + } + #region register @@ -490,7 +500,7 @@ public static KEAbilities GetSelected(Player player) { foreach(KEAbilities ability in Registered) { - if (ability.Selected.Contains(player)) + if (ability.IsSelected(player)) { return ability; } @@ -512,19 +522,12 @@ public static bool TryGetSelected(Player player, out KEAbilities ability) #region gui - - - protected virtual void Gui(StringBuilder sb,Player player) + + protected void GuiReady(StringBuilder sb, Player player) { - sb.Append(GetTranslation(player,TranslationKeyName)); - sb.Append(" "); - if (CanUse(player, out var output)) { - - - sb.Append("["); sb.Append(GetTranslation(player, "AbilityReady")); sb.Append("]"); @@ -536,12 +539,11 @@ protected virtual void Gui(StringBuilder sb,Player player) sb.Append(Math.Round((dateTime - DateTime.Now).TotalSeconds, 0)); sb.Append("s]"); } + } - - - - - if (Selected.Contains(player)) + protected void GuiArrow(StringBuilder sb, Player player) + { + if (IsSelected(player)) { string arrow = SettingHandler.Instance.GetArrow(player); if (string.IsNullOrEmpty(arrow)) @@ -551,6 +553,21 @@ protected virtual void Gui(StringBuilder sb,Player player) sb.Append(arrow); } } + + protected void GuiAbilityName(StringBuilder sb, Player player) + { + sb.Append(GetTranslation(player, TranslationKeyName)); + sb.Append(" "); + } + + + protected virtual void Gui(StringBuilder sb,Player player) + { + GuiAbilityName(sb, player); + GuiReady(sb, player); + GuiArrow(sb, player); + } + public static Dictionary> PlayersHints { get; } = new(); public static Dictionary AddonHints { get; } = new(); public const int InitialAbilitySlot = 5; diff --git a/KruacentExiled/KE.CustomRoles/Abilities/FireAbilities/FireAbilityBase.cs b/KruacentExiled/KE.CustomRoles/Abilities/FireAbilities/FireAbilityBase.cs index 12076f71..673728bb 100644 --- a/KruacentExiled/KE.CustomRoles/Abilities/FireAbilities/FireAbilityBase.cs +++ b/KruacentExiled/KE.CustomRoles/Abilities/FireAbilities/FireAbilityBase.cs @@ -1,6 +1,6 @@ using Exiled.API.Extensions; using Exiled.API.Features; -using KE.CustomRoles.API.Features; +using KE.CustomRoles.API.Features.Abilities; using KE.Utils.API.CustomStats; using System; using System.Collections.Generic; diff --git a/KruacentExiled/KE.CustomRoles/Abilities/ForceOpen.cs b/KruacentExiled/KE.CustomRoles/Abilities/ForceOpen.cs index 6effe144..6725f3bb 100644 --- a/KruacentExiled/KE.CustomRoles/Abilities/ForceOpen.cs +++ b/KruacentExiled/KE.CustomRoles/Abilities/ForceOpen.cs @@ -6,6 +6,7 @@ using Exiled.CustomRoles.API.Features; using Exiled.Events.EventArgs.Player; using KE.CustomRoles.API.Features; +using KE.CustomRoles.API.Features.Abilities; using KE.CustomRoles.API.Interfaces; using PlayerRoles; using System; @@ -17,7 +18,7 @@ namespace KE.CustomRoles.Abilities { - public class ForceOpen : KEAbilities, ICustomIcon + public class ForceOpen : KEAbilityLimited, ICustomIcon { public override string Name { get; } = "ForceOpen"; protected override Dictionary> SetTranslation() @@ -40,23 +41,16 @@ protected override Dictionary> SetTranslation } public Utils.API.GifAnimator.TextImage IconName => MainPlugin.Instance.icons["ForceOpen"]; public override float Cooldown { get; } = 30; + public override int Uses { get; } = 5; + private Dictionary abilityActivated = new(); public static readonly TimeSpan MaxTime = new (0, 0, 30); - protected override bool AbilityUsed(Player player) + protected override bool LaunchedAbility(Player player) { - if (abilityActivated.ContainsKey(player)) - { - abilityActivated[player] = DateTime.Now; - } - else - { - abilityActivated.Add(player, DateTime.Now); - } - return base.AbilityUsed(player); - - + abilityActivated[player] = DateTime.Now; + return base.LaunchedAbility(player); } private void InteractingDoor(InteractingDoorEventArgs ev) @@ -75,7 +69,7 @@ private void InteractingDoor(InteractingDoorEventArgs ev) if (ev.Door is Gate) { - successRate = 50; + successRate = 100; damage = 20; } else if (ev.Door.Type.IsCheckpoint()) @@ -85,7 +79,7 @@ private void InteractingDoor(InteractingDoorEventArgs ev) } else { - successRate = 75; + successRate = 50; damage = 5; } From ba367003342c3d755dcf5b991db7941705c6de01 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Tue, 10 Mar 2026 15:26:59 +0100 Subject: [PATCH 729/853] update upgradable item --- .../KE.Items/API/Core/Upgrade/UpgradeHandler.cs | 17 ++++++++++++----- .../API/Core/Upgrade/UpgradeProperties.cs | 4 ++-- KruacentExiled/KE.Items/Items/DivinePills.cs | 3 +-- KruacentExiled/KE.Items/Items/HealZone.cs | 2 +- KruacentExiled/KE.Items/Items/Molotov.cs | 2 +- KruacentExiled/KE.Items/Items/PressePuree.cs | 2 +- 6 files changed, 18 insertions(+), 12 deletions(-) diff --git a/KruacentExiled/KE.Items/API/Core/Upgrade/UpgradeHandler.cs b/KruacentExiled/KE.Items/API/Core/Upgrade/UpgradeHandler.cs index 41ca4324..ab09a0a5 100644 --- a/KruacentExiled/KE.Items/API/Core/Upgrade/UpgradeHandler.cs +++ b/KruacentExiled/KE.Items/API/Core/Upgrade/UpgradeHandler.cs @@ -2,6 +2,7 @@ using Exiled.API.Features.Items; using Exiled.CustomItems.API.Features; using Exiled.Events.EventArgs.Scp914; +using KE.Items.API.Features; using KE.Items.API.Interface; using KE.Utils.API.Interfaces; using Scp914; @@ -46,20 +47,26 @@ private void UpgradeItem(UpgradingInventoryItemEventArgs ev) private void UpgradePickUp(UpgradingPickupEventArgs ev) { - + if (!CustomItem.TryGet(ev.Pickup, out CustomItem ci)) return; - if (!(ci is IUpgradableCustomItem upgradable)) return; + if (ci is not IUpgradableCustomItem upgradable) return; Log.Debug("upgrading pickup"); + if(upgradable.Upgrade is null || upgradable.Upgrade.Count == 0) + { + throw new System.ArgumentException("upgradable null or empty"); + } + + if (UpgradeCheck(upgradable, ev.KnobSetting)) { Log.Debug("success"); - var newItemid = upgradable.Upgrade[ev.KnobSetting].UpgradedItem; + string newItemName = upgradable.Upgrade[ev.KnobSetting].UpgradedItem; - CustomItem newItem = CustomItem.Get(newItemid); + KECustomItem newItem = KECustomItem.Get(newItemName); - ev.Pickup.Destroy(); if (newItem == null) Log.Warn("warning id of custom item not found"); + ev.Pickup.Destroy(); newItem.Spawn(ev.OutputPosition); } diff --git a/KruacentExiled/KE.Items/API/Core/Upgrade/UpgradeProperties.cs b/KruacentExiled/KE.Items/API/Core/Upgrade/UpgradeProperties.cs index da3270fb..5c23af8b 100644 --- a/KruacentExiled/KE.Items/API/Core/Upgrade/UpgradeProperties.cs +++ b/KruacentExiled/KE.Items/API/Core/Upgrade/UpgradeProperties.cs @@ -14,9 +14,9 @@ public class UpgradeProperties { public float Chance { get; } - public uint UpgradedItem { get; } + public string UpgradedItem { get; } - public UpgradeProperties(float chance, uint newItem) + public UpgradeProperties(float chance, string newItem) { UpgradedItem = newItem; Chance = Mathf.Clamp(chance, 0,100); diff --git a/KruacentExiled/KE.Items/Items/DivinePills.cs b/KruacentExiled/KE.Items/Items/DivinePills.cs index fb87afd5..af0059bd 100644 --- a/KruacentExiled/KE.Items/Items/DivinePills.cs +++ b/KruacentExiled/KE.Items/Items/DivinePills.cs @@ -42,8 +42,7 @@ protected override Dictionary> SetTranslation public UnityEngine.Color Color { get; set; } = UnityEngine.Color.yellow; public IReadOnlyDictionary Upgrade { get; private set; } = new Dictionary() { - //very fine -> true divine pills 10% - { Scp914KnobSetting.VeryFine,new UpgradeProperties(10, 1050)} + { Scp914KnobSetting.VeryFine,new UpgradeProperties(10, "TrueDivinePills")} }; /// diff --git a/KruacentExiled/KE.Items/Items/HealZone.cs b/KruacentExiled/KE.Items/Items/HealZone.cs index b2e1b085..f9349814 100644 --- a/KruacentExiled/KE.Items/Items/HealZone.cs +++ b/KruacentExiled/KE.Items/Items/HealZone.cs @@ -83,7 +83,7 @@ protected override Dictionary> SetTranslation public IReadOnlyDictionary Upgrade => new Dictionary() { - [Scp914KnobSetting.OneToOne] = new UpgradeProperties(100, 1049) + [Scp914KnobSetting.OneToOne] = new UpgradeProperties(100, "CocktailMolotov") }; public HealZone() diff --git a/KruacentExiled/KE.Items/Items/Molotov.cs b/KruacentExiled/KE.Items/Items/Molotov.cs index 1d3de004..9a5d87c6 100644 --- a/KruacentExiled/KE.Items/Items/Molotov.cs +++ b/KruacentExiled/KE.Items/Items/Molotov.cs @@ -46,7 +46,7 @@ protected override Dictionary> SetTranslation public IReadOnlyDictionary Upgrade => new Dictionary() { - [Scp914KnobSetting.OneToOne] = new UpgradeProperties(100, 1051) + [Scp914KnobSetting.OneToOne] = new UpgradeProperties(100, "HealZone") }; public override SpawnProperties SpawnProperties { get; set; } = new SpawnProperties() { diff --git a/KruacentExiled/KE.Items/Items/PressePuree.cs b/KruacentExiled/KE.Items/Items/PressePuree.cs index b4bb9590..d7f5d146 100644 --- a/KruacentExiled/KE.Items/Items/PressePuree.cs +++ b/KruacentExiled/KE.Items/Items/PressePuree.cs @@ -115,7 +115,7 @@ protected override void OnExplodeDestructible(OnExplodeDestructibleEventsArgs ev public IReadOnlyDictionary Upgrade { get; private set; } = new Dictionary() { - { Scp914KnobSetting.VeryFine,new UpgradeProperties(5, 1055)} + { Scp914KnobSetting.VeryFine,new UpgradeProperties(5, "SainteGrenada")} }; } } From d0dba178bd04e9f5c7c9e3c7078a3044ce6a66cb Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Tue, 10 Mar 2026 15:28:24 +0100 Subject: [PATCH 730/853] fix vote --- KruacentExiled/KE.Misc/Features/VoteStart/VoteStart.cs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/KruacentExiled/KE.Misc/Features/VoteStart/VoteStart.cs b/KruacentExiled/KE.Misc/Features/VoteStart/VoteStart.cs index 833c907f..92984689 100644 --- a/KruacentExiled/KE.Misc/Features/VoteStart/VoteStart.cs +++ b/KruacentExiled/KE.Misc/Features/VoteStart/VoteStart.cs @@ -89,6 +89,11 @@ private void OnVoiceChatting(VoiceChattingEventArgs ev) return; } + if (!DidVote(ev.Player)) + { + return; + } + Voted.Add(ev.Player); if (Voted.Count >= MainPlugin.Instance.Config.MinPlayerVote) { From 735309b73d0ce3467a43e2db0daf6cb378da6914 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Tue, 10 Mar 2026 15:53:00 +0100 Subject: [PATCH 731/853] hm --- KruacentExiled/KE.Misc/Features/VoteStart/VoteStart.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/KruacentExiled/KE.Misc/Features/VoteStart/VoteStart.cs b/KruacentExiled/KE.Misc/Features/VoteStart/VoteStart.cs index 92984689..c38c496f 100644 --- a/KruacentExiled/KE.Misc/Features/VoteStart/VoteStart.cs +++ b/KruacentExiled/KE.Misc/Features/VoteStart/VoteStart.cs @@ -89,7 +89,7 @@ private void OnVoiceChatting(VoiceChattingEventArgs ev) return; } - if (!DidVote(ev.Player)) + if (DidVote(ev.Player)) { return; } From d7e102b9575eb5baab9a108c08bebae0d4c06d18 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Tue, 10 Mar 2026 16:01:55 +0100 Subject: [PATCH 732/853] setting update --- KruacentExiled/KE.CustomRoles/Settings/SettingHandler.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/KruacentExiled/KE.CustomRoles/Settings/SettingHandler.cs b/KruacentExiled/KE.CustomRoles/Settings/SettingHandler.cs index da839d69..73875324 100644 --- a/KruacentExiled/KE.CustomRoles/Settings/SettingHandler.cs +++ b/KruacentExiled/KE.CustomRoles/Settings/SettingHandler.cs @@ -88,7 +88,6 @@ public SettingHandler() private void OnWaitingForPlayers() { - SettingsCategory.Register(); } public void SubscribeEvents() From c797f99f951212ff82be3b85ff3484c1ebdaab1e Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Tue, 10 Mar 2026 16:23:32 +0100 Subject: [PATCH 733/853] reduce spawn chance glassbox --- KruacentExiled/KE.Items/Items/DivinePills.cs | 2 +- KruacentExiled/KE.Items/Items/ItemEffects/TPGrenadaEffect.cs | 2 -- KruacentExiled/KE.Items/Items/Molotov.cs | 4 ++-- 3 files changed, 3 insertions(+), 5 deletions(-) diff --git a/KruacentExiled/KE.Items/Items/DivinePills.cs b/KruacentExiled/KE.Items/Items/DivinePills.cs index af0059bd..d6d576a6 100644 --- a/KruacentExiled/KE.Items/Items/DivinePills.cs +++ b/KruacentExiled/KE.Items/Items/DivinePills.cs @@ -69,7 +69,7 @@ protected override Dictionary> SetTranslation { new RoomSpawnPoint() { - Chance = 100, + Chance = 80, Room = RoomType.LczGlassBox, }, }, diff --git a/KruacentExiled/KE.Items/Items/ItemEffects/TPGrenadaEffect.cs b/KruacentExiled/KE.Items/Items/ItemEffects/TPGrenadaEffect.cs index 0185acaa..6f8dc432 100644 --- a/KruacentExiled/KE.Items/Items/ItemEffects/TPGrenadaEffect.cs +++ b/KruacentExiled/KE.Items/Items/ItemEffects/TPGrenadaEffect.cs @@ -91,8 +91,6 @@ private Room RandomRoom() } else if (random > 0.33f && random <= 0.66f) { - - room = ZoneType.Entrance.RandomSafeRoom(); } else diff --git a/KruacentExiled/KE.Items/Items/Molotov.cs b/KruacentExiled/KE.Items/Items/Molotov.cs index 9a5d87c6..b2345eab 100644 --- a/KruacentExiled/KE.Items/Items/Molotov.cs +++ b/KruacentExiled/KE.Items/Items/Molotov.cs @@ -61,8 +61,8 @@ protected override Dictionary> SetTranslation RoomSpawnPoints = new List { new RoomSpawnPoint() { Chance = 75, Room = RoomType.LczGlassBox, }, - new RoomSpawnPoint() { Chance = 100, Room = RoomType.HczArmory, }, - new RoomSpawnPoint() { Chance = 100, Room = RoomType.Hcz049, }, + new RoomSpawnPoint() { Chance = 80, Room = RoomType.HczArmory, }, + new RoomSpawnPoint() { Chance = 80, Room = RoomType.Hcz049, }, }, }; From b29fb54517af7bb0b7e39548a1b07ace9951df0f Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Wed, 11 Mar 2026 09:08:11 +0100 Subject: [PATCH 734/853] remove dboyinshape slowness --- KruacentExiled/KE.CustomRoles/CR/ClassD/DBoyInShape.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/KruacentExiled/KE.CustomRoles/CR/ClassD/DBoyInShape.cs b/KruacentExiled/KE.CustomRoles/CR/ClassD/DBoyInShape.cs index e9aaa500..72f9d85e 100644 --- a/KruacentExiled/KE.CustomRoles/CR/ClassD/DBoyInShape.cs +++ b/KruacentExiled/KE.CustomRoles/CR/ClassD/DBoyInShape.cs @@ -57,12 +57,12 @@ protected override Dictionary> SetTranslation protected override void RoleAdded(Player player) { - player.EnableEffect(EffectType.Slowness, SpeedReduction,-1 ); + //player.EnableEffect(EffectType.Slowness, SpeedReduction,-1 ); } protected override void RoleRemoved(Player player) { - player.DisableEffect(EffectType.Slowness); + //player.DisableEffect(EffectType.Slowness); } } } \ No newline at end of file From 22b43c82f824b9489c6429a05d558a3d7f355f2f Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Wed, 11 Mar 2026 09:08:21 +0100 Subject: [PATCH 735/853] on rush done --- .../Abilities/RedMist/OnRush.cs | 190 ++++++++++++++++++ .../RedMist/{ForwardSlash.cs => Spear.cs} | 52 +---- .../KE.CustomRoles/CR/MTF/RedMist/EGO.cs | 1 - .../KE.CustomRoles/CR/MTF/RedMist/RedMist.cs | 17 +- 4 files changed, 210 insertions(+), 50 deletions(-) create mode 100644 KruacentExiled/KE.CustomRoles/Abilities/RedMist/OnRush.cs rename KruacentExiled/KE.CustomRoles/Abilities/RedMist/{ForwardSlash.cs => Spear.cs} (52%) diff --git a/KruacentExiled/KE.CustomRoles/Abilities/RedMist/OnRush.cs b/KruacentExiled/KE.CustomRoles/Abilities/RedMist/OnRush.cs new file mode 100644 index 00000000..85d6590a --- /dev/null +++ b/KruacentExiled/KE.CustomRoles/Abilities/RedMist/OnRush.cs @@ -0,0 +1,190 @@ +using Exiled.API.Enums; +using Exiled.API.Features; +using Exiled.API.Features.DamageHandlers; +using Exiled.API.Interfaces; +using InventorySystem.Items.MicroHID.Modules; +using KE.CustomRoles.API.Features; +using KE.CustomRoles.CR.MTF.RedMist; +using KE.Utils.API.Features; +using PlayerRoles; +using System.Collections.Generic; +using UnityEngine; +namespace KE.CustomRoles.Abilities.RedMist +{ + public class OnRush : KEAbilities + { + public override string Name { get; } = "OnRush"; + protected override Dictionary> SetTranslation() + { + return new() + { + ["en"] = new() + { + [TranslationKeyName] = "On Rush", + [TranslationKeyDesc] = "Manifest your E.G.O, gain powerful buff but rapid health drain.\nCan be deactivated anytime", + ["OnRushFailEGO"] = "You need to manifest your E.G.O. first", + ["OnRushFailWeapon"] = "You need your weapon", + }, + ["fr"] = new() + { + [TranslationKeyName] = "todo", + [TranslationKeyDesc] = "todo", + ["OnRushFailEGO"] = "todo", + ["OnRushFailWeapon"] = "todo", + } + }; + } + public override float Cooldown { get; } = 0f; + public const float Damage = 100; + + public const float MaxDistance = 5; + + + private Collider[] NonAlloc = new Collider[64]; + private static readonly Vector3 NonY = new(1, 0, 1); + + public static readonly LayerMasks Mask = LayerMasks.Scp173Teleport | LayerMasks.Glass; + protected override bool AbilityUsed(Player player) + { + + + if (!player.ReferenceHub.gameObject.TryGetComponent(out var ego)) + { + return false; + } + + + + //if (!ego.Active) + //{ + // //show OnRushFailEGO + // return false; + //} + KELog.Debug("check weapopgn"); + + + + if(player.CurrentItem is null || player.CurrentItem.Type != ItemType.SCP1509) + { + //show OnRushFailWeapon + return false; + } + + + float size = 1; + + Vector3 feetposition = player.Position- (Vector3.up*player.Scale.y)/2 + player.CameraTransform.forward*.1f; + Vector3 position = player.Position + player.CameraTransform.forward*.1f; + + + DrawSphere(position, size, Color.green); + DrawSphere(feetposition, size, Color.green); + Vector3 direction = player.CameraTransform.forward; + + direction = direction.NormalizeIgnoreY(); + + + Vector3 end = position + direction * MaxDistance; + Vector3 feetend = feetposition + direction * MaxDistance; + DrawSphere(end, size, Color.yellow); + DrawSphere(feetend, size, Color.yellow); + Vector3 teleport = end; + + Vector3 wallPoint = end; + + + + + if (Physics.Raycast(position, direction,out RaycastHit wallHit, MaxDistance, (int)Mask) + | Physics.Raycast(feetposition, direction, out RaycastHit wallHitFeet, MaxDistance, (int)Mask)) + { + Draw.Sphere(wallHit.point, Quaternion.identity, Vector3.one / 8f, Color.blue, 10, Player.Enumerable); + Draw.Sphere(wallHitFeet.point, Quaternion.identity, Vector3.one / 8f, Color.blue, 10, Player.Enumerable); + + if(Vector3.Distance(wallHit.point,position) <= Vector3.Distance(wallHitFeet.point, feetposition)) + { + teleport = wallHit.point + direction * (-1f); + } + else + { + teleport = wallHitFeet.point + direction * (-1f); + } + Vector3 directionToPoint = teleport - player.Position; + bool behind = Vector3.Dot(direction, directionToPoint) < 0f; + + + wallPoint = teleport; + if (behind) + { + teleport = Vector3.zero; + } + + + + } + + int detect = Physics.OverlapCapsuleNonAlloc(position, wallPoint, size, NonAlloc, HitregUtils.DetectionMask); + + for (int i = 0;i < detect;i++) + { + Collider collider = NonAlloc[i]; + + KELog.Debug("hit collider ="+collider); + + if (collider.TryGetComponent(out var destructible) && + (!Linecast(position, destructible?.CenterOfMass ?? Vector3.zero, out var hitInfo, PlayerRolesUtils.AttackMask) + || collider == hitInfo.collider)) + { + Player target = Player.Get(collider); + + if(target is null || target != player) + { + DrawSphere(collider.transform.position,.2f, Color.red); + } + + + if (destructible is not null) + { + PlayerStatsSystem.DamageHandlerBase handler = new GenericDamageHandler(target, player, Damage, DamageType.Scp1509, new DamageHandlerBase.CassieAnnouncement("")).Base; + destructible.Damage(Damage, handler, destructible.CenterOfMass); + } + } + } + + DrawSphere(teleport,.25f, Color.magenta); + + if(teleport != Vector3.zero) + { + player.Teleport(teleport); + } + + return base.AbilityUsed(player); + } + + + private static bool Debug = false; + private bool Linecast(Vector3 start,Vector3 end,out RaycastHit hit,int layerMask) + { + if (Debug) + { + Draw.Line(start, end, Color.red, 10, Player.Enumerable); + } + + + + return Physics.Linecast(start, end, out hit, layerMask); + + } + + private void DrawSphere(Vector3 position, float size,Color color) + { + if (Debug) + { + Draw.Sphere(position, Quaternion.identity, Vector3.one * size, color, 10, Player.Enumerable); + } + + } + + + } +} diff --git a/KruacentExiled/KE.CustomRoles/Abilities/RedMist/ForwardSlash.cs b/KruacentExiled/KE.CustomRoles/Abilities/RedMist/Spear.cs similarity index 52% rename from KruacentExiled/KE.CustomRoles/Abilities/RedMist/ForwardSlash.cs rename to KruacentExiled/KE.CustomRoles/Abilities/RedMist/Spear.cs index 14de6c83..e824e492 100644 --- a/KruacentExiled/KE.CustomRoles/Abilities/RedMist/ForwardSlash.cs +++ b/KruacentExiled/KE.CustomRoles/Abilities/RedMist/Spear.cs @@ -12,22 +12,23 @@ using KE.Utils.API.Features; using PlayerRoles; using PlayerRoles.FirstPersonControl.Thirdperson; +using PlayerStatsSystem; using System.Collections.Generic; using System.ComponentModel; using System.Linq; using UnityEngine; namespace KE.CustomRoles.Abilities.RedMist { - public class ForwardSlash : KEAbilities + public class Spear : KEAbilities { - public override string Name { get; } = "ForwardSlash"; + public override string Name { get; } = "Spear"; protected override Dictionary> SetTranslation() { return new() { ["en"] = new() { - [TranslationKeyName] = "Forward Slash", + [TranslationKeyName] = "Spear", [TranslationKeyDesc] = "Manifest your E.G.O, gain powerful buff but rapid health drain.\nCan be deactivated anytime", ["ForwardSlashFailEGO"] = "You need to manifest your E.G.O. first", ["ForwardSlashFailWeapon"] = "You need your weapon", @@ -47,6 +48,8 @@ protected override Dictionary> SetTranslation public const float MaxDistance = 15; private RaycastHit[] NonAlloc = new RaycastHit[16]; + + public static readonly CustomReasonDamageHandler BallDamage = new("Burned to death", 25, string.Empty); protected override bool AbilityUsed(Player player) { @@ -63,52 +66,9 @@ protected override bool AbilityUsed(Player player) //show ForwardSlashFailEGO return false; } - KELog.Debug("check weapopgn"); - - - - if(player.CurrentItem is null || player.CurrentItem.Type != ItemType.SCP1509) - { - //show ForwardSlashFailWeapon - return false; - } - - - float size = 1; - - Vector3 position = player.Position + player.CameraTransform.forward; - - int detect = Physics.SphereCastNonAlloc(position, size, player.CameraTransform.forward, NonAlloc, MaxDistance, HitregUtils.DetectionMask); - - Draw.Sphere(position, Quaternion.identity, Vector3.one * size * 2f, Color.green, 10, Player.Enumerable); - Vector3 direction = player.CameraTransform.forward; - direction.Normalize(); - Vector3 end = position + direction * MaxDistance; - Draw.Sphere(end, Quaternion.identity, Vector3.one * size * 2f, Color.yellow, 10,Player.Enumerable); - - for (int i = 0;i < detect;i++) - { - - Collider collider = NonAlloc[i].collider; - - KELog.Debug("hit collider ="+collider); - if (collider.TryGetComponent(out var destructible) && - (!Physics.Linecast(position, destructible.CenterOfMass, out var hitInfo, PlayerRolesUtils.AttackMask) - || collider == hitInfo.collider)) - { - Player target = Player.Get(collider); - - - HitboxIdentity.IsDamageable(ego.Hub, target.ReferenceHub); - destructible.Damage(Damage, new CustomDamageHandler(target, player, Damage, DamageType.Scp1509), destructible.CenterOfMass); - } - - - } - return base.AbilityUsed(player); } diff --git a/KruacentExiled/KE.CustomRoles/CR/MTF/RedMist/EGO.cs b/KruacentExiled/KE.CustomRoles/CR/MTF/RedMist/EGO.cs index 3031cdbc..3c1a2ec0 100644 --- a/KruacentExiled/KE.CustomRoles/CR/MTF/RedMist/EGO.cs +++ b/KruacentExiled/KE.CustomRoles/CR/MTF/RedMist/EGO.cs @@ -62,7 +62,6 @@ private void UpdateDamage() { cooldown += Time.deltaTime; KELog.Debug(cooldown); - KELog.Debug(Time.deltaTime); if (cooldown >= objective) { Hub.playerStats.DealDamage(damage); diff --git a/KruacentExiled/KE.CustomRoles/CR/MTF/RedMist/RedMist.cs b/KruacentExiled/KE.CustomRoles/CR/MTF/RedMist/RedMist.cs index 58fd83b3..506e6812 100644 --- a/KruacentExiled/KE.CustomRoles/CR/MTF/RedMist/RedMist.cs +++ b/KruacentExiled/KE.CustomRoles/CR/MTF/RedMist/RedMist.cs @@ -42,7 +42,7 @@ protected override Dictionary> SetTranslation }; } public override int MaxHealth { get; set; } = 200; - public override RoleTypeId Role { get; set; } = RoleTypeId.NtfSergeant; + public override RoleTypeId Role { get; set; } = RoleTypeId.ClassD; public override bool KeepRoleOnDeath { get; set; } = false; public override bool KeepRoleOnChangingRole { get; set; } = false; public Color32 Color => new(255, 192, 203, 0); @@ -62,14 +62,25 @@ protected override Dictionary> SetTranslation public override HashSet Abilities { get; } = [ "ToggleEGO", - "ForwardSlash", + "Spear", + "OnRush", ]; protected override void GiveInventory(Player player) { + try + { + //KECustomItem shieldbelt = KECustomItem.Get("Shield belt"); + //shieldbelt?.Give(player, false); + player.AddItem(ItemType.SCP1509); + } + catch (Exception e) + { + Log.Error(e); + } + - KECustomItem.TryGive(player, "ShieldBelt", false); } protected override void RoleAdded(Player player) From 816c54080d315d407c88de9121206bff59b80aaf Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Wed, 11 Mar 2026 09:58:36 +0100 Subject: [PATCH 736/853] smoother elevator --- .../ElevatorGateA/CustomElevatorComp.cs | 104 ++++++++++++++++++ .../ElevatorGateA/CustomElevatorGateA.cs | 72 +----------- .../Surface/ElevatorGateA/ElevatorModel.cs | 61 +++++----- .../Surface/ElevatorGateA/IContainPanel.cs | 16 +++ .../KE.Map/Surface/ElevatorGateA/Panel.cs | 7 +- 5 files changed, 166 insertions(+), 94 deletions(-) create mode 100644 KruacentExiled/KE.Map/Surface/ElevatorGateA/CustomElevatorComp.cs create mode 100644 KruacentExiled/KE.Map/Surface/ElevatorGateA/IContainPanel.cs diff --git a/KruacentExiled/KE.Map/Surface/ElevatorGateA/CustomElevatorComp.cs b/KruacentExiled/KE.Map/Surface/ElevatorGateA/CustomElevatorComp.cs new file mode 100644 index 00000000..f9a5ed60 --- /dev/null +++ b/KruacentExiled/KE.Map/Surface/ElevatorGateA/CustomElevatorComp.cs @@ -0,0 +1,104 @@ +using Exiled.API.Features.Objectives; +using Exiled.API.Features.Toys; +using KE.Utils.Quality.Models; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using UnityEngine; + +namespace KE.Map.Surface.ElevatorGateA +{ + internal class CustomElevatorComp : MonoBehaviour + { + private Primitive Primitive; + + private HashSet Models; + + public void Init(Primitive primitive,IEnumerable models) + { + Primitive = primitive; + Models = models.ToHashSet(); + + baseheight = Primitive.Position.y; + objective = increase; + + startPos = Primitive.Position; + endPos = new Vector3(startPos.x, objective, startPos.z); + } + + private float baseheight; + private float increase = 301f; + private float objective; + private float duration = 5f; + private bool isMoving = false; + + + private float startY; + private float elapsed; + public void Send() + { + if (isMoving) return; + if (Primitive == null) return; + + isMoving = true; + + ChangeAllPanel(Color.yellow); + + startY = Primitive.Position.y; + elapsed = 0f; + startPos = Primitive.Position; + endPos = new Vector3(startPos.x, objective, startPos.z); + } + + private void ChangeAllPanel(Color color) + { + foreach(IContainPanel model in Models) + { + model.ChangeColor(color); + } + } + private Vector3 startPos; + private Vector3 endPos; + private float sendInterval = 1f / 20f; + private float sendTimer = 0f; + public void Update() + { + if (!isMoving) return; + + elapsed += Time.deltaTime; + sendTimer += Time.deltaTime; + float t = elapsed / duration; + t = t * t * (3f - 2f * t); // smoothstep + + + if(sendTimer >= sendInterval) + { + sendTimer = 0f; + Primitive.Position = Vector3.Lerp(startPos, endPos, t); + } + + + + if (elapsed >= duration) + { + Primitive.Position = new Vector3( + Primitive.Position.x, + objective, + Primitive.Position.z + ); + + objective = Mathf.Approximately(objective, baseheight) + ? increase + : baseheight; + + ChangeAllPanel(Color.blue); + + isMoving = false; + } + } + + + } +} diff --git a/KruacentExiled/KE.Map/Surface/ElevatorGateA/CustomElevatorGateA.cs b/KruacentExiled/KE.Map/Surface/ElevatorGateA/CustomElevatorGateA.cs index b833f4db..bc321e9e 100644 --- a/KruacentExiled/KE.Map/Surface/ElevatorGateA/CustomElevatorGateA.cs +++ b/KruacentExiled/KE.Map/Surface/ElevatorGateA/CustomElevatorGateA.cs @@ -15,7 +15,7 @@ namespace KE.Map.Surface.ElevatorGateA { - public static class CustomElevatorGateA + public static class CustomElevatorGateA { private static ElevatorModel model; @@ -58,9 +58,6 @@ public static void Create() CreatePrimitives(); CreateModels(); - baseheight = prim.Position.y; - - objective = increase; step = Primitive.Create(PrimitiveType.Cube, new(18.4f, 300.35f, -49.27f),null,new Vector3(2,.5f,1f)); @@ -92,7 +89,7 @@ private static void CreatePrimitives() Vector3 posbot = new(15.62f, 290.65f, -45.19f); prim = Primitive.Create(pos, null, Vector3.one * Scale); prim.Flags = AdminToys.PrimitiveFlags.None; - + prim.MovementSmoothing = 240; primtop = Primitive.Create(postop, null, Vector3.one * Scale); primtop.Flags = AdminToys.PrimitiveFlags.None; @@ -148,74 +145,17 @@ public static void Destroy() primtop = null; } - - - - - } - private static bool isMoving = false; - public static void Send() { - if (isMoving) return; if (prim == null) return; - - Timing.RunCoroutine(Sending()); - - } - - - private static float baseheight; - private static float increase = 301f; - private static float objective; - private static float duration = 5f; - private static IEnumerator Sending() - { - - isMoving = true; - model.button.NetworkMaterialColor = Color.yellow; - bottompanel.button.NetworkMaterialColor = Color.yellow; - toppanel.button.NetworkMaterialColor = Color.yellow; - - float startY = prim.Position.y; - float elapsed = 0f; - - while (elapsed < duration) + if (!prim.GameObject.TryGetComponent(out var comp)) { - elapsed += Time.deltaTime; - - float t = elapsed / duration; - t = t * t * (3f - 2f * t); - - float newY = Mathf.Lerp(startY, objective, t); - - prim.Position = new Vector3( - prim.Position.x, - newY, - prim.Position.z - ); - yield return Timing.WaitForOneFrame; + comp = prim.GameObject.AddComponent(); + comp.Init(prim, [model, bottompanel, toppanel]); } - - prim.Position = new Vector3( - prim.Position.x, - objective, - prim.Position.z - ); - - objective = Mathf.Approximately(objective, baseheight) - ? increase - : baseheight; - - model.button.NetworkMaterialColor = Color.blue; - bottompanel.button.NetworkMaterialColor = Color.blue; - toppanel.button.NetworkMaterialColor = Color.blue; - isMoving = false; + comp.Send(); } - - - } } diff --git a/KruacentExiled/KE.Map/Surface/ElevatorGateA/ElevatorModel.cs b/KruacentExiled/KE.Map/Surface/ElevatorGateA/ElevatorModel.cs index 5e957a88..739b9e04 100644 --- a/KruacentExiled/KE.Map/Surface/ElevatorGateA/ElevatorModel.cs +++ b/KruacentExiled/KE.Map/Surface/ElevatorGateA/ElevatorModel.cs @@ -11,7 +11,7 @@ namespace KE.Map.Surface.ElevatorGateA { - public class ElevatorModel : ModelBase + public class ElevatorModel : ModelBase, IContainPanel { public InteractableToy I_button { get; private set; } public PrimitiveObjectToy button { get; private set; } @@ -25,7 +25,8 @@ protected override void CreateModel(Transform parent) new Vector3(0f, 0f, 0f), new Quaternion(0f, 0f, 0f, 1f), new Vector3(1f, 1f, 1f), - new Color32(0, 0, 0, 0) + new Color32(0, 0, 0, 0), + 240 ); ElevatorCabin.PrimitiveFlags = AdminToys.PrimitiveFlags.None; @@ -35,7 +36,8 @@ protected override void CreateModel(Transform parent) new Vector3(0f, 0f, 1.663f), new Quaternion(0f, 0f, 0f, 1f), new Vector3(1f, 1f, 1f), - new Color32(0, 0, 0, 0) + new Color32(0, 0, 0, 0), + 240 ); panel.PrimitiveFlags = AdminToys.PrimitiveFlags.None; @@ -46,7 +48,7 @@ protected override void CreateModel(Transform parent) new Quaternion(0f, 0f, 0f, 1f), new Vector3(0.15f, 1.3f, 0.15f), new Color32(255, 255, 255, 255), - 60 + 240 ); @@ -57,7 +59,7 @@ protected override void CreateModel(Transform parent) new Quaternion(0.3775984f, 0f, 0f, 0.9259695f), new Vector3(1f, 1f, 0.15f), new Color32(255, 255, 255, 255), - 60 + 240 ); @@ -68,7 +70,7 @@ protected override void CreateModel(Transform parent) new Quaternion(0.3775984f, 0f, 0f, 0.9259695f), new Vector3(0.8f, 0.8f, 0.15f), new Color32(255, 255, 255, 255), - 60 + 240 ); @@ -97,7 +99,7 @@ protected override void CreateModel(Transform parent) new Quaternion(0f, 0f, 0f, 1f), new Vector3(1.666667f, 0.2f, 5f), new Color32(255, 255, 255, 255), - 60 + 240 ); @@ -108,7 +110,7 @@ protected override void CreateModel(Transform parent) new Quaternion(0f, 0f, 0f, 1f), new Vector3(1.666667f, 0.2f, 5f), new Color32(255, 255, 255, 255), - 60 + 240 ); @@ -119,7 +121,7 @@ protected override void CreateModel(Transform parent) new Quaternion(0f, 0f, 0f, 1f), new Vector3(1.666667f, 0.2f, 1.666667f), new Color32(255, 255, 255, 255), - 60 + 240 ); @@ -130,7 +132,7 @@ protected override void CreateModel(Transform parent) new Quaternion(0f, 0f, 0f, 1f), new Vector3(1.666667f, 0.2f, 1.666667f), new Color32(255, 255, 255, 255), - 60 + 240 ); @@ -161,7 +163,7 @@ protected override void CreateModel(Transform parent) new Quaternion(0f, 0f, 0f, 1f), new Vector3(5f, 0.2f, 5f), new Color32(255, 255, 255, 255), - 60 + 240 ); @@ -182,7 +184,7 @@ protected override void CreateModel(Transform parent) new Quaternion(0f, 0f, 0f, 1f), new Vector3(0.1f, 4.9f, 0.1f), new Color32(255, 255, 255, 255), - 60 + 240 ); @@ -193,7 +195,7 @@ protected override void CreateModel(Transform parent) new Quaternion(0f, 0f, 0f, 1f), new Vector3(0.1f, 1.4798f, 0.1f), new Color32(255, 255, 255, 255), - 60 + 240 ); @@ -204,7 +206,7 @@ protected override void CreateModel(Transform parent) new Quaternion(0f, 0f, 0f, 1f), new Vector3(0.1f, 1.4798f, 0.1f), new Color32(255, 255, 255, 255), - 60 + 240 ); @@ -215,7 +217,7 @@ protected override void CreateModel(Transform parent) new Quaternion(0f, 0f, 0f, 1f), new Vector3(0.1f, 4.9f, 0.1f), new Color32(255, 255, 255, 255), - 60 + 240 ); @@ -226,7 +228,7 @@ protected override void CreateModel(Transform parent) new Quaternion(0f, 0f, 0f, 1f), new Vector3(0.1f, 4.9f, 0.1f), new Color32(255, 255, 255, 255), - 60 + 240 ); @@ -237,7 +239,7 @@ protected override void CreateModel(Transform parent) new Quaternion(0f, 0f, 0f, 1f), new Vector3(0.1f, 1.4798f, 0.1f), new Color32(255, 255, 255, 255), - 60 + 240 ); @@ -248,7 +250,7 @@ protected override void CreateModel(Transform parent) new Quaternion(0f, 0f, 0f, 1f), new Vector3(0.1f, 4.9f, 0.1f), new Color32(255, 255, 255, 255), - 60 + 240 ); @@ -259,7 +261,7 @@ protected override void CreateModel(Transform parent) new Quaternion(0f, 0f, 0f, 1f), new Vector3(0.1f, 1.4798f, 0.1f), new Color32(255, 255, 255, 255), - 60 + 240 ); @@ -270,7 +272,7 @@ protected override void CreateModel(Transform parent) new Quaternion(0f, 0f, 0f, 1f), new Vector3(0.1f, 1.4798f, 0.1f), new Color32(255, 255, 255, 255), - 60 + 240 ); @@ -281,7 +283,7 @@ protected override void CreateModel(Transform parent) new Quaternion(0f, 0f, 0f, 1f), new Vector3(0.1f, 1.4798f, 0.1f), new Color32(255, 255, 255, 255), - 60 + 240 ); @@ -292,7 +294,7 @@ protected override void CreateModel(Transform parent) new Quaternion(0f, 0f, 0f, 1f), new Vector3(5f, 0.2f, 0.2f), new Color32(255, 255, 255, 255), - 60 + 240 ); @@ -303,7 +305,7 @@ protected override void CreateModel(Transform parent) new Quaternion(0f, 0f, 0f, 1f), new Vector3(0.2f, 0.2f, 5f), new Color32(255, 255, 255, 255), - 60 + 240 ); @@ -314,7 +316,7 @@ protected override void CreateModel(Transform parent) new Quaternion(0f, 0f, 0f, 1f), new Vector3(0.2f, 0.2f, 1.7f), new Color32(255, 255, 255, 255), - 60 + 240 ); @@ -325,7 +327,7 @@ protected override void CreateModel(Transform parent) new Quaternion(0f, 0f, 0f, 1f), new Vector3(0.2f, 0.2f, 1.7f), new Color32(255, 255, 255, 255), - 60 + 240 ); @@ -336,7 +338,7 @@ protected override void CreateModel(Transform parent) new Quaternion(0f, 0f, 0f, 1f), new Vector3(1.7f, 0.2f, 0.2f), new Color32(255, 255, 255, 255), - 60 + 240 ); @@ -347,7 +349,7 @@ protected override void CreateModel(Transform parent) new Quaternion(0f, 0f, 0f, 1f), new Vector3(1.7f, 0.2f, 0.2f), new Color32(255, 255, 255, 255), - 60 + 240 ); @@ -374,5 +376,10 @@ private void Base_OnInteracted(ReferenceHub obj) { SendingElevator?.Invoke(); } + + public void ChangeColor(Color newColor) + { + button.NetworkMaterialColor = newColor; + } } } diff --git a/KruacentExiled/KE.Map/Surface/ElevatorGateA/IContainPanel.cs b/KruacentExiled/KE.Map/Surface/ElevatorGateA/IContainPanel.cs new file mode 100644 index 00000000..480be48b --- /dev/null +++ b/KruacentExiled/KE.Map/Surface/ElevatorGateA/IContainPanel.cs @@ -0,0 +1,16 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using UnityEngine; + +namespace KE.Map.Surface.ElevatorGateA +{ + internal interface IContainPanel + { + + + void ChangeColor(Color newColor); + } +} diff --git a/KruacentExiled/KE.Map/Surface/ElevatorGateA/Panel.cs b/KruacentExiled/KE.Map/Surface/ElevatorGateA/Panel.cs index f1e5b90f..0178518b 100644 --- a/KruacentExiled/KE.Map/Surface/ElevatorGateA/Panel.cs +++ b/KruacentExiled/KE.Map/Surface/ElevatorGateA/Panel.cs @@ -11,7 +11,7 @@ namespace KE.Map.Surface.ElevatorGateA { - public class Panel : ModelBase + public class Panel : ModelBase, IContainPanel { public InteractableToy I_button { get; private set; } public PrimitiveObjectToy button { get; private set; } @@ -79,5 +79,10 @@ private void Base_OnInteracted(ReferenceHub obj) { SendingElevator?.Invoke(); } + + public void ChangeColor(Color newColor) + { + button.NetworkMaterialColor = newColor; + } } } From d1bc4b5237fda40cf3bf531922d2957dcf056748 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Sat, 14 Mar 2026 14:15:34 +0100 Subject: [PATCH 737/853] red mist --- .../API/Features/Abilities/BaseCompAbility.cs | 17 ++ .../API/Features/Abilities/KEAbilityCost.cs | 4 +- .../Features/Abilities/KEAbilityLimited.cs | 6 +- .../API/Features/Abilities/NeedCompAbility.cs | 47 ++++++ .../Features/Abilities/ToggleableAbility.cs | 51 ++++++ .../API/Features/KEAbilities.cs | 14 +- .../Abilities/RedMist/EgoAbility.cs | 80 +++++++++ .../RedMist/GreaterSplitHorizontal.cs | 157 ++++++++++++++++++ .../Abilities/RedMist/OnRush.cs | 26 +-- .../Abilities/RedMist/ToggleEGO.cs | 17 +- .../KE.CustomRoles/CR/MTF/RedMist/EGO.cs | 13 +- .../KE.CustomRoles/CR/MTF/RedMist/RedMist.cs | 7 +- 12 files changed, 406 insertions(+), 33 deletions(-) create mode 100644 KruacentExiled/KE.CustomRoles/API/Features/Abilities/BaseCompAbility.cs create mode 100644 KruacentExiled/KE.CustomRoles/API/Features/Abilities/NeedCompAbility.cs create mode 100644 KruacentExiled/KE.CustomRoles/API/Features/Abilities/ToggleableAbility.cs create mode 100644 KruacentExiled/KE.CustomRoles/Abilities/RedMist/EgoAbility.cs create mode 100644 KruacentExiled/KE.CustomRoles/Abilities/RedMist/GreaterSplitHorizontal.cs diff --git a/KruacentExiled/KE.CustomRoles/API/Features/Abilities/BaseCompAbility.cs b/KruacentExiled/KE.CustomRoles/API/Features/Abilities/BaseCompAbility.cs new file mode 100644 index 00000000..c1bf3e46 --- /dev/null +++ b/KruacentExiled/KE.CustomRoles/API/Features/Abilities/BaseCompAbility.cs @@ -0,0 +1,17 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using UnityEngine; + +namespace KE.CustomRoles.API.Features.Abilities +{ + public abstract class BaseCompAbility : MonoBehaviour + { + + public abstract bool Active { get; } + + public abstract void ToggleActive(); + } +} diff --git a/KruacentExiled/KE.CustomRoles/API/Features/Abilities/KEAbilityCost.cs b/KruacentExiled/KE.CustomRoles/API/Features/Abilities/KEAbilityCost.cs index a84bf8ea..9f9241aa 100644 --- a/KruacentExiled/KE.CustomRoles/API/Features/Abilities/KEAbilityCost.cs +++ b/KruacentExiled/KE.CustomRoles/API/Features/Abilities/KEAbilityCost.cs @@ -32,9 +32,9 @@ protected virtual bool LaunchedAbility(Player player) public abstract bool CanLaunchAbility(Player player); - protected override void Gui(StringBuilder sb,Player player) + protected override void AbilityGui(StringBuilder sb,Player player) { - base.Gui(sb,player); + base.AbilityGui(sb,player); sb.Append("("); sb.Append(Cost); sb.Append(CostName); diff --git a/KruacentExiled/KE.CustomRoles/API/Features/Abilities/KEAbilityLimited.cs b/KruacentExiled/KE.CustomRoles/API/Features/Abilities/KEAbilityLimited.cs index 77117a0a..57bfd31d 100644 --- a/KruacentExiled/KE.CustomRoles/API/Features/Abilities/KEAbilityLimited.cs +++ b/KruacentExiled/KE.CustomRoles/API/Features/Abilities/KEAbilityLimited.cs @@ -56,12 +56,10 @@ public int GetUse(Player player) - protected override void Gui(StringBuilder sb,Player player) + protected override void AbilityGui(StringBuilder sb,Player player) { - GuiAbilityName(sb, player); + base.AbilityGui(sb, player); GuiUses(sb, player); - GuiReady(sb, player); - GuiArrow(sb, player); } diff --git a/KruacentExiled/KE.CustomRoles/API/Features/Abilities/NeedCompAbility.cs b/KruacentExiled/KE.CustomRoles/API/Features/Abilities/NeedCompAbility.cs new file mode 100644 index 00000000..b5b2ae9c --- /dev/null +++ b/KruacentExiled/KE.CustomRoles/API/Features/Abilities/NeedCompAbility.cs @@ -0,0 +1,47 @@ +using Exiled.API.Features; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using UnityEngine; + +namespace KE.CustomRoles.API.Features.Abilities +{ + public abstract class NeedCompAbility : KEAbilities where T : BaseCompAbility + { + + + protected virtual bool AddCompIfMissing { get; } = false; + + protected sealed override bool AbilityUsed(Player player) + { + bool result = CanLaunchAbility(player,out T comp); + if (result) + { + result = LaunchedAbility(player,comp); + } + return result; + } + + protected abstract bool LaunchedAbility(Player player, T component); + + public virtual bool CanLaunchAbility(Player player, out T component) + { + if(!player.GameObject.TryGetComponent(out component)) + { + if (AddCompIfMissing) + { + component = player.GameObject.AddComponent(); + } + else + { + return false; + } + } + + return component.Active; + } + + } +} diff --git a/KruacentExiled/KE.CustomRoles/API/Features/Abilities/ToggleableAbility.cs b/KruacentExiled/KE.CustomRoles/API/Features/Abilities/ToggleableAbility.cs new file mode 100644 index 00000000..2032a441 --- /dev/null +++ b/KruacentExiled/KE.CustomRoles/API/Features/Abilities/ToggleableAbility.cs @@ -0,0 +1,51 @@ +using Exiled.API.Features; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using UnityEngine; + +namespace KE.CustomRoles.API.Features.Abilities +{ + public abstract class ToggleableAbility : KEAbilities + { + + public abstract Color ColorOn { get; } + private string colorOn = string.Empty; + public abstract Color ColorOff { get; } + private string colorOff = string.Empty; + + public abstract bool GetState(Player player); + + protected override void Gui(StringBuilder sb, Player player) + { + sb.Append(""); + AbilityGui(sb, player); + GuiReady(sb, player); + GuiArrow(sb, player); + sb.Append(""); + } + + + + } +} diff --git a/KruacentExiled/KE.CustomRoles/API/Features/KEAbilities.cs b/KruacentExiled/KE.CustomRoles/API/Features/KEAbilities.cs index cb5115db..ecd24549 100644 --- a/KruacentExiled/KE.CustomRoles/API/Features/KEAbilities.cs +++ b/KruacentExiled/KE.CustomRoles/API/Features/KEAbilities.cs @@ -16,6 +16,7 @@ using KE.Utils.API.Translations; using MEC; using PlayerRoles.FirstPersonControl.Thirdperson; +using PlayerRoles.PlayableScps.HUDs; using System; using System.Collections.Generic; using System.Linq; @@ -560,10 +561,21 @@ protected void GuiAbilityName(StringBuilder sb, Player player) sb.Append(" "); } + /// + /// The ability gui without the arrow or the ready + /// + protected virtual void AbilityGui(StringBuilder sb, Player player) + { + GuiAbilityName(sb, player); + + } + /// + /// The full ability gui + /// protected virtual void Gui(StringBuilder sb,Player player) { - GuiAbilityName(sb, player); + AbilityGui(sb, player); GuiReady(sb, player); GuiArrow(sb, player); } diff --git a/KruacentExiled/KE.CustomRoles/Abilities/RedMist/EgoAbility.cs b/KruacentExiled/KE.CustomRoles/Abilities/RedMist/EgoAbility.cs new file mode 100644 index 00000000..02f7fd95 --- /dev/null +++ b/KruacentExiled/KE.CustomRoles/Abilities/RedMist/EgoAbility.cs @@ -0,0 +1,80 @@ +using Exiled.API.Features; +using KE.CustomRoles.API.Features; +using KE.CustomRoles.API.Features.Abilities; +using KE.CustomRoles.CR.MTF.RedMist; +using KE.Utils.API.Features; +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using UnityEngine; + +namespace KE.CustomRoles.Abilities.RedMist +{ + public abstract class EgoAbility : NeedCompAbility + { + + protected sealed override bool AddCompIfMissing => false; + protected abstract NeedActive NeedEGOActive { get; } + + public override bool CanLaunchAbility(Player player, out EGO comp) + { + + + + bool active = base.CanLaunchAbility(player,out comp); + + if (CheckItem(player)) + { + return false; + } + + + if (NeedEGOActive == NeedActive.NeedActive) + { + return active; + } + + if (NeedEGOActive == NeedActive.NeedNotActive) + { + return !active; + } + + return true; + } + + + protected override void Gui(StringBuilder sb, Player player) + { + + + if(CanLaunchAbility(player, out _)) + { + sb.Append(""); + } + else + { + sb.Append(""); + } + + AbilityGui(sb, player); + GuiReady(sb, player); + GuiArrow(sb, player); + sb.Append(""); + } + + protected static bool CheckItem(Player player) + { + return player.CurrentItem is null || player.CurrentItem.Type != ItemType.SCP1509; + } + + public enum NeedActive + { + NeedActive, + NeedNotActive, + Either, + } + } +} diff --git a/KruacentExiled/KE.CustomRoles/Abilities/RedMist/GreaterSplitHorizontal.cs b/KruacentExiled/KE.CustomRoles/Abilities/RedMist/GreaterSplitHorizontal.cs new file mode 100644 index 00000000..91976faf --- /dev/null +++ b/KruacentExiled/KE.CustomRoles/Abilities/RedMist/GreaterSplitHorizontal.cs @@ -0,0 +1,157 @@ +using Exiled.API.Enums; +using Exiled.API.Features; +using Exiled.API.Features.DamageHandlers; +using InventorySystem.Items.MicroHID.Modules; +using KE.CustomRoles.CR.MTF.RedMist; +using KE.Utils.API.Features; +using PlayerRoles; +using System.Collections.Generic; +using UnityEngine; +namespace KE.CustomRoles.Abilities.RedMist +{ + public class GreaterSplitHorizontal : EgoAbility + { + public override string Name { get; } = "GreaterSplitHorizontal"; + protected override Dictionary> SetTranslation() + { + return new() + { + ["en"] = new() + { + [TranslationKeyName] = "Greater Split : Horizontal", + [TranslationKeyDesc] = "Manifest your E.G.O, gain powerful buff but rapid health drain.\nCan be deactivated anytime", + ["OnRushFailEGO"] = "You need to manifest your E.G.O. first", + ["OnRushFailWeapon"] = "You need your weapon", + }, + ["fr"] = new() + { + [TranslationKeyName] = "todo", + [TranslationKeyDesc] = "todo", + ["OnRushFailEGO"] = "todo", + ["OnRushFailWeapon"] = "todo", + } + }; + } + public override float Cooldown { get; } = 0f; + + protected override NeedActive NeedEGOActive => NeedActive.Either; //active + + public const float Damage = 200; + + public const float MaxDistance = 5; + + + private Collider[] NonAlloc = new Collider[64]; + + public static readonly LayerMasks Mask = LayerMasks.Scp173Teleport | LayerMasks.Glass; + + public const float Size = 5; + protected override bool LaunchedAbility(Player player,EGO ego) + { + + + KELog.Debug("check weapopgn"); + + + + if(player.CurrentItem is null || player.CurrentItem.Type != ItemType.SCP1509) + { + //show OnRushFailWeapon + return false; + } + + + Vector3 feetposition = player.Position- (Vector3.up*player.Scale.y)/2 + player.CameraTransform.forward*.1f; + + + Vector3 direction = player.CameraTransform.forward; + + direction = direction.NormalizeIgnoreY(); + + DrawSphere(feetposition, Size, Color.yellow); + + + + int detect = Physics.OverlapSphereNonAlloc(feetposition, Size, NonAlloc, HitregUtils.DetectionMask); + Collider collider; + for (int i = 0;i < detect;i++) + { + collider = NonAlloc[i]; + + if(!CheckPoint(collider.transform.position, feetposition, direction)) + { + continue; + } + + + if (collider.TryGetComponent(out var destructible) && + (!Linecast(feetposition, destructible?.CenterOfMass ?? Vector3.zero, out var hitInfo, PlayerRolesUtils.AttackMask) + || collider == hitInfo.collider)) + { + Player target = Player.Get(collider); + + if(target is null || target != player) + { + DrawSphere(collider.transform.position,.2f, Color.red); + } + + + if (destructible is not null) + { + PlayerStatsSystem.DamageHandlerBase handler = new GenericDamageHandler(target, player, Damage, DamageType.Scp1509, new DamageHandlerBase.CassieAnnouncement("")).Base; + destructible.Damage(Damage, handler, destructible.CenterOfMass); + } + } + } + return true; + } + private static bool CheckPoint(Vector3 point,Vector3 center, Vector3 direction) + { + + + Vector2 position = new Vector2(point.x - center.x, point.z - center.z); + + float radius = position.magnitude; + if (radius > Size) + return false; + + Vector2 dir = new Vector2(direction.x, direction.z).normalized; + Vector2 pointDir = position.normalized; + float sectorAngle = 60f; + float halfAngle = sectorAngle * 0.5f; + float cosThreshold = Mathf.Cos(halfAngle * Mathf.Deg2Rad); + + if (Debug) + { + DrawSphere(position, .1f, Color.cyan); + } + + return Vector2.Dot(dir, pointDir) >= cosThreshold; + } + + private static bool Debug => MainPlugin.Instance.Config.Debug; + private bool Linecast(Vector3 start,Vector3 end,out RaycastHit hit,int layerMask) + { + if (Debug) + { + Draw.Line(start, end, Color.red, 10, Player.Enumerable); + } + + + + return Physics.Linecast(start, end, out hit, layerMask); + + } + + private static void DrawSphere(Vector3 position, float size,Color color) + { + if (Debug) + { + Draw.Sphere(position, Quaternion.identity, Vector3.one * size, color, 10, Player.Enumerable); + } + + } + + + } +} diff --git a/KruacentExiled/KE.CustomRoles/Abilities/RedMist/OnRush.cs b/KruacentExiled/KE.CustomRoles/Abilities/RedMist/OnRush.cs index 85d6590a..1f3b267d 100644 --- a/KruacentExiled/KE.CustomRoles/Abilities/RedMist/OnRush.cs +++ b/KruacentExiled/KE.CustomRoles/Abilities/RedMist/OnRush.cs @@ -11,7 +11,7 @@ using UnityEngine; namespace KE.CustomRoles.Abilities.RedMist { - public class OnRush : KEAbilities + public class OnRush : EgoAbility { public override string Name { get; } = "OnRush"; protected override Dictionary> SetTranslation() @@ -34,32 +34,22 @@ protected override Dictionary> SetTranslation } }; } - public override float Cooldown { get; } = 0f; + public override float Cooldown { get; } = 120f; + + protected override NeedActive NeedEGOActive => NeedActive.Either; + public const float Damage = 100; public const float MaxDistance = 5; private Collider[] NonAlloc = new Collider[64]; - private static readonly Vector3 NonY = new(1, 0, 1); public static readonly LayerMasks Mask = LayerMasks.Scp173Teleport | LayerMasks.Glass; - protected override bool AbilityUsed(Player player) + protected override bool LaunchedAbility(Player player,EGO ego) { - - if (!player.ReferenceHub.gameObject.TryGetComponent(out var ego)) - { - return false; - } - - - //if (!ego.Active) - //{ - // //show OnRushFailEGO - // return false; - //} KELog.Debug("check weapopgn"); @@ -129,7 +119,7 @@ protected override bool AbilityUsed(Player player) { Collider collider = NonAlloc[i]; - KELog.Debug("hit collider ="+collider); + //KELog.Debug("hit collider ="+collider); if (collider.TryGetComponent(out var destructible) && (!Linecast(position, destructible?.CenterOfMass ?? Vector3.zero, out var hitInfo, PlayerRolesUtils.AttackMask) @@ -158,7 +148,7 @@ protected override bool AbilityUsed(Player player) player.Teleport(teleport); } - return base.AbilityUsed(player); + return true; } diff --git a/KruacentExiled/KE.CustomRoles/Abilities/RedMist/ToggleEGO.cs b/KruacentExiled/KE.CustomRoles/Abilities/RedMist/ToggleEGO.cs index c26172f3..5e16a25d 100644 --- a/KruacentExiled/KE.CustomRoles/Abilities/RedMist/ToggleEGO.cs +++ b/KruacentExiled/KE.CustomRoles/Abilities/RedMist/ToggleEGO.cs @@ -6,10 +6,16 @@ using System.Text; using System.Threading.Tasks; using KE.CustomRoles.CR.MTF.RedMist; +using KE.CustomRoles.API.Features.Abilities; +using UnityEngine; namespace KE.CustomRoles.Abilities.RedMist { - public class ToggleEGO : KEAbilities + public class ToggleEGO : ToggleableAbility { + + public override Color ColorOn => Color.red; + public override Color ColorOff => Color.white; + public override string Name { get; } = "ToggleEGO"; protected override Dictionary> SetTranslation() { @@ -29,8 +35,15 @@ protected override Dictionary> SetTranslation } public override float Cooldown { get; } = 0f; + public override bool GetState(Player player) + { + if (!player.ReferenceHub.gameObject.TryGetComponent(out var ego)) + { + return false; + } - + return ego.Active; + } protected override bool AbilityUsed(Player player) { if(!player.ReferenceHub.gameObject.TryGetComponent(out var ego)) diff --git a/KruacentExiled/KE.CustomRoles/CR/MTF/RedMist/EGO.cs b/KruacentExiled/KE.CustomRoles/CR/MTF/RedMist/EGO.cs index 3c1a2ec0..2f0a75a0 100644 --- a/KruacentExiled/KE.CustomRoles/CR/MTF/RedMist/EGO.cs +++ b/KruacentExiled/KE.CustomRoles/CR/MTF/RedMist/EGO.cs @@ -1,6 +1,7 @@ using CustomPlayerEffects; using Exiled.API.Features; using Exiled.API.Features.DamageHandlers; +using KE.CustomRoles.API.Features.Abilities; using KE.Utils.API.Features; using KE.Utils.Extensions; using PlayerRoles; @@ -14,11 +15,17 @@ namespace KE.CustomRoles.CR.MTF.RedMist { - public class EGO : MonoBehaviour + public class EGO : BaseCompAbility { - public bool Active => active; + public override bool Active + { + get + { + return active; + } + } private bool active; @@ -85,7 +92,7 @@ public void Update() } - public void ToggleActive() + public override void ToggleActive() { active = !Active; KELog.Debug("toggle now active? "+ Active); diff --git a/KruacentExiled/KE.CustomRoles/CR/MTF/RedMist/RedMist.cs b/KruacentExiled/KE.CustomRoles/CR/MTF/RedMist/RedMist.cs index 506e6812..c998e661 100644 --- a/KruacentExiled/KE.CustomRoles/CR/MTF/RedMist/RedMist.cs +++ b/KruacentExiled/KE.CustomRoles/CR/MTF/RedMist/RedMist.cs @@ -26,17 +26,17 @@ protected override Dictionary> SetTranslation { ["en"] = new() { - [TranslationKeyName] = "Red Mist", + [TranslationKeyName] = "The Red Mist", [TranslationKeyDesc] = "todo", }, ["fr"] = new() { - [TranslationKeyName] = "Red Mist", + [TranslationKeyName] = "The Red Mist", [TranslationKeyDesc] = "todo", }, ["legacy"] = new() { - [TranslationKeyName] = "Red Mist", + [TranslationKeyName] = "The Red Mist", [TranslationKeyDesc] = "todo", } }; @@ -64,6 +64,7 @@ protected override Dictionary> SetTranslation "ToggleEGO", "Spear", "OnRush", + "GreaterSplitHorizontal", ]; protected override void GiveInventory(Player player) From 64dfc820560adca42e6746a7e70ca09de9517b80 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Sat, 14 Mar 2026 14:18:13 +0100 Subject: [PATCH 738/853] null check --- .../Items/ItemEffects/DeployableWallEffect.cs | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/KruacentExiled/KE.Items/Items/ItemEffects/DeployableWallEffect.cs b/KruacentExiled/KE.Items/Items/ItemEffects/DeployableWallEffect.cs index 16ca28fb..e609442e 100644 --- a/KruacentExiled/KE.Items/Items/ItemEffects/DeployableWallEffect.cs +++ b/KruacentExiled/KE.Items/Items/ItemEffects/DeployableWallEffect.cs @@ -41,16 +41,23 @@ private void SpawnWall(Vector3 pos, Quaternion rotation) wall.Visible = true; Timing.CallDelayed(10, () => { - wall.UnSpawn(); - wall.Destroy(); + wall?.Destroy(); + wall = null; }); Timing.CallDelayed(5, () => { - wall.Color = Color.yellow; + if(wall is not null) + { + wall.Color = Color.yellow; + } + }); Timing.CallDelayed(8, () => { - wall.Color = Color.red; + if (wall is not null) + { + wall.Color = Color.red; + } }); From 6e05f24264f310c1a57a378a42ba61eb743c66d6 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Sat, 14 Mar 2026 14:19:19 +0100 Subject: [PATCH 739/853] team chekc --- KruacentExiled/KE.Items/Items/ItemEffects/HealZoneEffect.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/KruacentExiled/KE.Items/Items/ItemEffects/HealZoneEffect.cs b/KruacentExiled/KE.Items/Items/ItemEffects/HealZoneEffect.cs index 8545f0b1..1a2fb161 100644 --- a/KruacentExiled/KE.Items/Items/ItemEffects/HealZoneEffect.cs +++ b/KruacentExiled/KE.Items/Items/ItemEffects/HealZoneEffect.cs @@ -4,6 +4,7 @@ using Exiled.Events.EventArgs.Player; using KE.Items.API.Interface; using MEC; +using PlayerRoles; using System.Collections.Generic; using UnityEngine; @@ -52,6 +53,9 @@ private IEnumerator HealZoneHeal(Vector3 wallPosition, float cylinderSize { Dictionary playerHealedAmounts = new Dictionary(); + + Team team = playerThrowingGrenade.Role.Team; + foreach (Player player in Player.List) { playerHealedAmounts.Add(player, 0); @@ -65,7 +69,7 @@ private IEnumerator HealZoneHeal(Vector3 wallPosition, float cylinderSize // Check if a player is in the zone. if (IsPlayerInZone(player, wallPosition, cylinderSize)) { - if (playerThrowingGrenade.Role.Team == player.Role.Team) + if (team == player.Role.Team) { if (playerHealedAmounts[player] <= 100) { From fe99206f9216722553a1942d7c404a90739f1204 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Sat, 14 Mar 2026 14:20:51 +0100 Subject: [PATCH 740/853] add player in dict --- .../KE.Items/Items/ItemEffects/HealZoneEffect.cs | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/KruacentExiled/KE.Items/Items/ItemEffects/HealZoneEffect.cs b/KruacentExiled/KE.Items/Items/ItemEffects/HealZoneEffect.cs index 1a2fb161..72f31128 100644 --- a/KruacentExiled/KE.Items/Items/ItemEffects/HealZoneEffect.cs +++ b/KruacentExiled/KE.Items/Items/ItemEffects/HealZoneEffect.cs @@ -56,10 +56,6 @@ private IEnumerator HealZoneHeal(Vector3 wallPosition, float cylinderSize Team team = playerThrowingGrenade.Role.Team; - foreach (Player player in Player.List) - { - playerHealedAmounts.Add(player, 0); - } while (true) { @@ -71,6 +67,13 @@ private IEnumerator HealZoneHeal(Vector3 wallPosition, float cylinderSize { if (team == player.Role.Team) { + if (!playerHealedAmounts.ContainsKey(player)) + { + playerHealedAmounts[player] = 0; + } + + + if (playerHealedAmounts[player] <= 100) { player.Heal(1); From 6af026d8335f03062c19b4ab1a6a9d2a64fb82fc Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Sat, 14 Mar 2026 14:22:35 +0100 Subject: [PATCH 741/853] lowgrav --- .../KE.Items/Items/ItemEffects/LowGravityGrenadeEffect.cs | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/KruacentExiled/KE.Items/Items/ItemEffects/LowGravityGrenadeEffect.cs b/KruacentExiled/KE.Items/Items/ItemEffects/LowGravityGrenadeEffect.cs index 45891697..6c347622 100644 --- a/KruacentExiled/KE.Items/Items/ItemEffects/LowGravityGrenadeEffect.cs +++ b/KruacentExiled/KE.Items/Items/ItemEffects/LowGravityGrenadeEffect.cs @@ -12,7 +12,6 @@ namespace KE.Items.Items.ItemEffects { public class LowGravityGrenadeEffect : CustomItemEffect { - private Dictionary _effectedPlayers = new(); public float Duration { get; set; } = 15f; public float Range { get; set; } = 10f; @@ -43,7 +42,6 @@ public void OnExploding(Player player) if (player.Role is FpcRole fpcRole) { - _effectedPlayers[player] = fpcRole.Gravity; fpcRole.Gravity = FpcGravityController.DefaultGravity * 0.15f; } @@ -51,8 +49,7 @@ public void OnExploding(Player player) { if (player.Role is FpcRole fpcRole) { - fpcRole.Gravity = _effectedPlayers[player]; - _effectedPlayers.Remove(player); + fpcRole.Gravity = FpcGravityController.DefaultGravity; } }); } From edf0d26bec44937a958e301d04ecad800c50b623 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Sat, 14 Mar 2026 14:23:08 +0100 Subject: [PATCH 742/853] fix targettoaffect --- .../KE.Items/Items/ItemEffects/LowGravityGrenadeEffect.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/KruacentExiled/KE.Items/Items/ItemEffects/LowGravityGrenadeEffect.cs b/KruacentExiled/KE.Items/Items/ItemEffects/LowGravityGrenadeEffect.cs index 6c347622..05320e2b 100644 --- a/KruacentExiled/KE.Items/Items/ItemEffects/LowGravityGrenadeEffect.cs +++ b/KruacentExiled/KE.Items/Items/ItemEffects/LowGravityGrenadeEffect.cs @@ -30,7 +30,7 @@ public override void Effect(ExplodingGrenadeEventArgs ev) foreach(Player player in ev.TargetsToAffect) { - OnExploding(ev.Player); + OnExploding(player); } From b91a63e45bb709258d52a92e2676846529a493d1 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Sat, 14 Mar 2026 14:26:26 +0100 Subject: [PATCH 743/853] increase refresh rate + fix grenade mutlitpel mine --- .../KE.Items/Items/ItemEffects/MineEffect.cs | 32 ++++++++----------- 1 file changed, 13 insertions(+), 19 deletions(-) diff --git a/KruacentExiled/KE.Items/Items/ItemEffects/MineEffect.cs b/KruacentExiled/KE.Items/Items/ItemEffects/MineEffect.cs index 0cc6cd66..d20797ff 100644 --- a/KruacentExiled/KE.Items/Items/ItemEffects/MineEffect.cs +++ b/KruacentExiled/KE.Items/Items/ItemEffects/MineEffect.cs @@ -22,7 +22,7 @@ namespace KE.Items.Items.ItemEffects { public class MineEffect : CustomItemEffect, IUsingEvents { - private const float RefreshRate = .01f; + private const float RefreshRate = .05f; private const int MineActivationTime = 10; private const float MineRadius = 0.7f; public override void Effect(UsedItemEventArgs ev) @@ -88,24 +88,18 @@ private void SpawnMine(Player p, Vector3 pos) Timing.RunCoroutine(WaitAndActivateMine(p, m)); } - private ExplosiveGrenade _grenade; - private ExplosiveGrenade Grenade - { - get - { - if (_grenade == null) - { - _grenade = (ExplosiveGrenade)Item.Create(ItemType.GrenadeHE); - _grenade.MaxRadius = 1; - _grenade.ScpDamageMultiplier = .25f; - _grenade.FuseTime = 0f; - - } - return _grenade; - } - } + + + private ExplosiveGrenade GetGrenade() + { + ExplosiveGrenade grenade = (ExplosiveGrenade)Item.Create(ItemType.GrenadeHE); + grenade.MaxRadius = 1; + grenade.ScpDamageMultiplier = .25f; + grenade.FuseTime = 0f; + return grenade; + } private IEnumerator WaitAndActivateMine(Player player, MineModel mine) { int countdown = MineActivationTime; @@ -132,7 +126,7 @@ private IEnumerator ActiveMine(MineModel mine, float cylinderSize) { if (isActivated && IsPositionInZone(p.Position, mine.Position, cylinderSize, 3)) { - Grenade.SpawnActive(mine.Position+Vector3.up); + GetGrenade().SpawnActive(mine.Position+Vector3.up); DestroyMine(mine); isActivated = false; break; @@ -144,7 +138,7 @@ private IEnumerator ActiveMine(MineModel mine, float cylinderSize) if (isActivated && IsPlayerInZone(player, mine.Position, cylinderSize, 3)) { - Grenade.SpawnActive(mine.Position + Vector3.up); + GetGrenade().SpawnActive(mine.Position + Vector3.up); DestroyMine(mine); isActivated = false; break; From 6da15c919ca2ab2b0c237d67e88f23d615fffcb7 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Sat, 14 Mar 2026 14:27:43 +0100 Subject: [PATCH 744/853] add .hurt --- .../KE.Items/Items/ItemEffects/MolotovEffect.cs | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/KruacentExiled/KE.Items/Items/ItemEffects/MolotovEffect.cs b/KruacentExiled/KE.Items/Items/ItemEffects/MolotovEffect.cs index ab5e05f9..c0c12408 100644 --- a/KruacentExiled/KE.Items/Items/ItemEffects/MolotovEffect.cs +++ b/KruacentExiled/KE.Items/Items/ItemEffects/MolotovEffect.cs @@ -130,17 +130,10 @@ private IEnumerator Fire(Pickup jar, Primitive zone, List lights, if (target.Role == RoleTypeId.Scp0492) { - target.Hurt(dmg * 2.5f, DamageType.Firearm); + dmg *= 2.5f; } - else - { - target.Health -= dmg; - if (target.Health <= 0) - { - target.Kill(DamageType.Firearm); - } - } + target.Hurt(dmg, DamageType.Firearm); } } } From 29da9d497cf7c345cf793fad59dcb6b299e2d6c7 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Sat, 14 Mar 2026 14:28:14 +0100 Subject: [PATCH 745/853] resync namespance --- .../KE.Items/Items/ItemEffects/ProximityGrenadeEffect.cs | 6 +++--- .../KE.Items/Items/ItemEffects/SmokeGrenadeEffect.cs | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/KruacentExiled/KE.Items/Items/ItemEffects/ProximityGrenadeEffect.cs b/KruacentExiled/KE.Items/Items/ItemEffects/ProximityGrenadeEffect.cs index a00ff1ec..7d36e429 100644 --- a/KruacentExiled/KE.Items/Items/ItemEffects/ProximityGrenadeEffect.cs +++ b/KruacentExiled/KE.Items/Items/ItemEffects/ProximityGrenadeEffect.cs @@ -9,7 +9,7 @@ using KE.Items.API.Interface; using System.Collections.Generic; -namespace KE.Items.ItemEffects +namespace KE.Items.Items.ItemEffects { public class ProximityGrenadeEffect : CustomItemEffect { @@ -40,7 +40,7 @@ public void OnExploding(Room originRoom, Vector3 position) List currentLayer = new List(); currentLayer.Add(originRoom); - for (int i = 0; i < this.RoomRadius; i++) + for (int i = 0; i < RoomRadius; i++) { List nextLayer = new List(); @@ -75,7 +75,7 @@ public void OnExploding(Room originRoom, Vector3 position) var laser = Primitive.Create(PrimitiveType.Cylinder, PrimitiveFlags.Visible, laserPos, rotation.eulerAngles, scale, true, lineColor); - Timing.CallDelayed(this.Duration, laser.Destroy); + Timing.CallDelayed(Duration, laser.Destroy); } } } diff --git a/KruacentExiled/KE.Items/Items/ItemEffects/SmokeGrenadeEffect.cs b/KruacentExiled/KE.Items/Items/ItemEffects/SmokeGrenadeEffect.cs index f60c1ee5..a1e93e56 100644 --- a/KruacentExiled/KE.Items/Items/ItemEffects/SmokeGrenadeEffect.cs +++ b/KruacentExiled/KE.Items/Items/ItemEffects/SmokeGrenadeEffect.cs @@ -7,7 +7,7 @@ using System.ComponentModel; using UnityEngine; -namespace KE.Items.ItemEffects +namespace KE.Items.Items.ItemEffects { public class SmokeGrenadeEffect : CustomItemEffect { From 0ebabeb4ac089bc1a30b6f476e7313cac2746da9 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Sat, 14 Mar 2026 14:32:06 +0100 Subject: [PATCH 746/853] namespace + mine damage reduc --- .../KE.Items/Items/ItemEffects/MineEffect.cs | 15 +++++++++------ .../KE.Items/Items/LowGravityGrenade.cs | 3 --- KruacentExiled/KE.Items/Items/ProximityGrenade.cs | 4 +--- KruacentExiled/KE.Items/Items/SmokeGrenade.cs | 2 +- 4 files changed, 11 insertions(+), 13 deletions(-) diff --git a/KruacentExiled/KE.Items/Items/ItemEffects/MineEffect.cs b/KruacentExiled/KE.Items/Items/ItemEffects/MineEffect.cs index d20797ff..e44e5663 100644 --- a/KruacentExiled/KE.Items/Items/ItemEffects/MineEffect.cs +++ b/KruacentExiled/KE.Items/Items/ItemEffects/MineEffect.cs @@ -5,6 +5,7 @@ using Exiled.API.Interfaces; using Exiled.Events.EventArgs.Map; using Exiled.Events.EventArgs.Player; +using InventorySystem.Items.ThrowableProjectiles; using KE.Items.API.Events; using KE.Items.API.Extensions; using KE.Items.API.Interface; @@ -42,11 +43,12 @@ public override void Effect(ExplodingGrenadeEventArgs ev) public void SubscribeEvents() { ExplodeEvent.ExplodeDestructible += OnExplodeDestructible; + grenades = new(); } private void OnExplodeDestructible(OnExplodeDestructibleEventsArgs obj) { - if (obj.ExplosionGrenade == Grenade.Projectile.Base) + if (grenades.Contains(obj.ExplosionGrenade)) { obj.Damage = 100; @@ -90,15 +92,16 @@ private void SpawnMine(Player p, Vector3 pos) + private HashSet grenades; - - private ExplosiveGrenade GetGrenade() + private void SpawnActive(Vector3 position) { ExplosiveGrenade grenade = (ExplosiveGrenade)Item.Create(ItemType.GrenadeHE); grenade.MaxRadius = 1; grenade.ScpDamageMultiplier = .25f; grenade.FuseTime = 0f; - return grenade; + + grenades.Add(grenade.SpawnActive(position).Base); } private IEnumerator WaitAndActivateMine(Player player, MineModel mine) { @@ -126,7 +129,7 @@ private IEnumerator ActiveMine(MineModel mine, float cylinderSize) { if (isActivated && IsPositionInZone(p.Position, mine.Position, cylinderSize, 3)) { - GetGrenade().SpawnActive(mine.Position+Vector3.up); + SpawnActive(mine.Position+Vector3.up); DestroyMine(mine); isActivated = false; break; @@ -138,7 +141,7 @@ private IEnumerator ActiveMine(MineModel mine, float cylinderSize) if (isActivated && IsPlayerInZone(player, mine.Position, cylinderSize, 3)) { - GetGrenade().SpawnActive(mine.Position + Vector3.up); + SpawnActive(mine.Position + Vector3.up); DestroyMine(mine); isActivated = false; break; diff --git a/KruacentExiled/KE.Items/Items/LowGravityGrenade.cs b/KruacentExiled/KE.Items/Items/LowGravityGrenade.cs index 9b09dfdb..27122833 100644 --- a/KruacentExiled/KE.Items/Items/LowGravityGrenade.cs +++ b/KruacentExiled/KE.Items/Items/LowGravityGrenade.cs @@ -1,12 +1,9 @@ using System.Collections.Generic; using Exiled.API.Enums; -using Exiled.API.Features.Attributes; using Exiled.API.Features.Spawn; -using Exiled.CustomItems.API.Features; using Exiled.Events.EventArgs.Map; using KE.Items.API.Features; using KE.Items.API.Interface; -using KE.Items.ItemEffects; using KE.Items.Items.ItemEffects; namespace KE.Items.Items diff --git a/KruacentExiled/KE.Items/Items/ProximityGrenade.cs b/KruacentExiled/KE.Items/Items/ProximityGrenade.cs index 690b52c7..2b8d5415 100644 --- a/KruacentExiled/KE.Items/Items/ProximityGrenade.cs +++ b/KruacentExiled/KE.Items/Items/ProximityGrenade.cs @@ -1,12 +1,10 @@ using System.Collections.Generic; using Exiled.API.Enums; -using Exiled.API.Features.Attributes; using Exiled.API.Features.Spawn; -using Exiled.CustomItems.API.Features; using Exiled.Events.EventArgs.Map; using KE.Items.API.Features; using KE.Items.API.Interface; -using KE.Items.ItemEffects; +using KE.Items.Items.ItemEffects; namespace KE.Items.Items { diff --git a/KruacentExiled/KE.Items/Items/SmokeGrenade.cs b/KruacentExiled/KE.Items/Items/SmokeGrenade.cs index 3c17ab1a..6777b6a0 100644 --- a/KruacentExiled/KE.Items/Items/SmokeGrenade.cs +++ b/KruacentExiled/KE.Items/Items/SmokeGrenade.cs @@ -6,7 +6,7 @@ using Exiled.Events.EventArgs.Map; using KE.Items.API.Features; using KE.Items.API.Interface; -using KE.Items.ItemEffects; +using KE.Items.Items.ItemEffects; namespace KE.Items.Items { From 7ce056be3f234e6d5df46dfb1b4a1d3e72910ed6 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Sat, 14 Mar 2026 14:33:12 +0100 Subject: [PATCH 747/853] fitler --- .../KE.Items/Items/ItemEffects/ProximityGrenadeEffect.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/KruacentExiled/KE.Items/Items/ItemEffects/ProximityGrenadeEffect.cs b/KruacentExiled/KE.Items/Items/ItemEffects/ProximityGrenadeEffect.cs index 7d36e429..45a0e0b6 100644 --- a/KruacentExiled/KE.Items/Items/ItemEffects/ProximityGrenadeEffect.cs +++ b/KruacentExiled/KE.Items/Items/ItemEffects/ProximityGrenadeEffect.cs @@ -8,6 +8,7 @@ using Exiled.API.Features; using KE.Items.API.Interface; using System.Collections.Generic; +using System.Linq; namespace KE.Items.Items.ItemEffects { @@ -57,7 +58,7 @@ public void OnExploding(Room originRoom, Vector3 position) currentLayer = nextLayer; } - foreach (Player player in Player.List) + foreach (Player player in Player.Enumerable.Where(p => p.IsAlive)) { if (roomsInRange.Contains(player.CurrentRoom)) { From dc784ca710574032a92908aec6ec41f4c68aa536 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Sat, 14 Mar 2026 14:36:33 +0100 Subject: [PATCH 748/853] invert if --- .../KE.Items/Items/ItemEffects/TPGrenadaEffect.cs | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/KruacentExiled/KE.Items/Items/ItemEffects/TPGrenadaEffect.cs b/KruacentExiled/KE.Items/Items/ItemEffects/TPGrenadaEffect.cs index 6f8dc432..f6bc2577 100644 --- a/KruacentExiled/KE.Items/Items/ItemEffects/TPGrenadaEffect.cs +++ b/KruacentExiled/KE.Items/Items/ItemEffects/TPGrenadaEffect.cs @@ -28,11 +28,11 @@ public class TPGrenadaEffect : CustomItemEffect public override void Effect(UsedItemEventArgs ev) { - OnExploding(new HashSet() { ev.Player }); + OnExploding([ev.Player]); } public override void Effect(DroppingItemEventArgs ev) { - OnExploding(new HashSet() { ev.Player }); + OnExploding([ev.Player]); } public override void Effect(ExplodingGrenadeEventArgs ev) @@ -54,9 +54,14 @@ private void OnExploding(HashSet targets, EffectGrenadeProjectile projec { bool line; if (projectile == null) - line = Physics.Linecast(projectile.Transform.position, player.Position); - else + { line = true; + } + else + { + line = Physics.Linecast(projectile.Transform.position, player.Position); + } + if (line) { From 73b20ea14d56c90336ea96d29b60583f03610d2e Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Sat, 14 Mar 2026 14:38:39 +0100 Subject: [PATCH 749/853] remove the doc --- KruacentExiled/KE.Items/Items/ShieldBelt/ShieldBeltStat.cs | 5 ----- 1 file changed, 5 deletions(-) diff --git a/KruacentExiled/KE.Items/Items/ShieldBelt/ShieldBeltStat.cs b/KruacentExiled/KE.Items/Items/ShieldBelt/ShieldBeltStat.cs index b3cf4653..f170c66b 100644 --- a/KruacentExiled/KE.Items/Items/ShieldBelt/ShieldBeltStat.cs +++ b/KruacentExiled/KE.Items/Items/ShieldBelt/ShieldBeltStat.cs @@ -82,11 +82,6 @@ public void RechargeTick() } - /// - /// - /// - /// - /// remaining damage public float Damage(float damage) { From aaf113f685e029576a82e75c5fd3f929a425bd16 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Sat, 14 Mar 2026 14:41:06 +0100 Subject: [PATCH 750/853] dict init in sub event --- KruacentExiled/KE.Items/Items/Defibrilator.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/KruacentExiled/KE.Items/Items/Defibrilator.cs b/KruacentExiled/KE.Items/Items/Defibrilator.cs index a6bff28a..f7fbdb4a 100644 --- a/KruacentExiled/KE.Items/Items/Defibrilator.cs +++ b/KruacentExiled/KE.Items/Items/Defibrilator.cs @@ -60,12 +60,13 @@ private struct DeathData public RoleTypeId Role; } - private readonly Dictionary _deathRecords = new Dictionary(); + private Dictionary _deathRecords; private const float MaxReviveTime = 60f; private const float RaycastDistance = 2.5f; protected override void SubscribeEvents() { + _deathRecords = new(); Exiled.Events.Handlers.Player.UsingItem += OnUsingItem; Exiled.Events.Handlers.Player.Dying += OnDying; base.SubscribeEvents(); @@ -75,6 +76,7 @@ protected override void UnsubscribeEvents() { Exiled.Events.Handlers.Player.UsingItem -= OnUsingItem; Exiled.Events.Handlers.Player.Dying -= OnDying; + _deathRecords = null; base.UnsubscribeEvents(); } From 7df07062d49410f3df74ae7c4511cb309b2be407 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Sat, 14 Mar 2026 14:42:48 +0100 Subject: [PATCH 751/853] me when i can't spell --- .../API/Interface/{ISwichableEffect.cs => ISwitchableEffect.cs} | 2 +- KruacentExiled/KE.Items/Items/DeployableWall.cs | 2 +- KruacentExiled/KE.Items/Items/DivinePills.cs | 2 +- KruacentExiled/KE.Items/Items/HealZone.cs | 2 +- KruacentExiled/KE.Items/Items/LowGravityGrenade.cs | 2 +- KruacentExiled/KE.Items/Items/Mine.cs | 2 +- KruacentExiled/KE.Items/Items/Molotov.cs | 2 +- KruacentExiled/KE.Items/Items/ProximityGrenade.cs | 2 +- KruacentExiled/KE.Items/Items/RedbullEnergy.cs | 2 +- KruacentExiled/KE.Items/Items/Scp1650.cs | 2 +- KruacentExiled/KE.Items/Items/SmokeGrenade.cs | 2 +- KruacentExiled/KE.Items/Items/TPGrenada.cs | 2 +- 12 files changed, 12 insertions(+), 12 deletions(-) rename KruacentExiled/KE.Items/API/Interface/{ISwichableEffect.cs => ISwitchableEffect.cs} (84%) diff --git a/KruacentExiled/KE.Items/API/Interface/ISwichableEffect.cs b/KruacentExiled/KE.Items/API/Interface/ISwitchableEffect.cs similarity index 84% rename from KruacentExiled/KE.Items/API/Interface/ISwichableEffect.cs rename to KruacentExiled/KE.Items/API/Interface/ISwitchableEffect.cs index 214c3ee8..666d7fe9 100644 --- a/KruacentExiled/KE.Items/API/Interface/ISwichableEffect.cs +++ b/KruacentExiled/KE.Items/API/Interface/ISwitchableEffect.cs @@ -6,7 +6,7 @@ namespace KE.Items.API.Interface { - public interface ISwichableEffect + public interface ISwitchableEffect { CustomItemEffect Effect { get; set; } } diff --git a/KruacentExiled/KE.Items/Items/DeployableWall.cs b/KruacentExiled/KE.Items/Items/DeployableWall.cs index b4a98350..93d1c593 100644 --- a/KruacentExiled/KE.Items/Items/DeployableWall.cs +++ b/KruacentExiled/KE.Items/Items/DeployableWall.cs @@ -11,7 +11,7 @@ namespace KE.Items.Items { - public class DeployableWall : KECustomItem, ILumosItem, ISwichableEffect + public class DeployableWall : KECustomItem, ILumosItem, ISwitchableEffect { protected override Dictionary> SetTranslation() { diff --git a/KruacentExiled/KE.Items/Items/DivinePills.cs b/KruacentExiled/KE.Items/Items/DivinePills.cs index d6d576a6..3edbeea0 100644 --- a/KruacentExiled/KE.Items/Items/DivinePills.cs +++ b/KruacentExiled/KE.Items/Items/DivinePills.cs @@ -11,7 +11,7 @@ using KE.Items.Items.ItemEffects; using KE.Items.API.Features; -public class DivinePills : KECustomItem, ILumosItem, ISwichableEffect, IUpgradableCustomItem +public class DivinePills : KECustomItem, ILumosItem, ISwitchableEffect, IUpgradableCustomItem { protected override Dictionary> SetTranslation() { diff --git a/KruacentExiled/KE.Items/Items/HealZone.cs b/KruacentExiled/KE.Items/Items/HealZone.cs index f9349814..69ade158 100644 --- a/KruacentExiled/KE.Items/Items/HealZone.cs +++ b/KruacentExiled/KE.Items/Items/HealZone.cs @@ -12,7 +12,7 @@ namespace KE.Items.Items { - public class HealZone : KECustomGrenade, ILumosItem, ISwichableEffect, IUpgradableCustomItem + public class HealZone : KECustomGrenade, ILumosItem, ISwitchableEffect, IUpgradableCustomItem { protected override Dictionary> SetTranslation() { diff --git a/KruacentExiled/KE.Items/Items/LowGravityGrenade.cs b/KruacentExiled/KE.Items/Items/LowGravityGrenade.cs index 27122833..f9a7be59 100644 --- a/KruacentExiled/KE.Items/Items/LowGravityGrenade.cs +++ b/KruacentExiled/KE.Items/Items/LowGravityGrenade.cs @@ -8,7 +8,7 @@ namespace KE.Items.Items { - public class LowGravityGrenade : KECustomGrenade, ISwichableEffect + public class LowGravityGrenade : KECustomGrenade, ISwitchableEffect { protected override Dictionary> SetTranslation() { diff --git a/KruacentExiled/KE.Items/Items/Mine.cs b/KruacentExiled/KE.Items/Items/Mine.cs index e5ca1e40..a9289379 100644 --- a/KruacentExiled/KE.Items/Items/Mine.cs +++ b/KruacentExiled/KE.Items/Items/Mine.cs @@ -11,7 +11,7 @@ namespace KE.Items.Items { - public class Mine : KECustomItem, ISwichableEffect, ICustomPickupModel + public class Mine : KECustomItem, ISwitchableEffect, ICustomPickupModel { protected override Dictionary> SetTranslation() { diff --git a/KruacentExiled/KE.Items/Items/Molotov.cs b/KruacentExiled/KE.Items/Items/Molotov.cs index b2345eab..809796c3 100644 --- a/KruacentExiled/KE.Items/Items/Molotov.cs +++ b/KruacentExiled/KE.Items/Items/Molotov.cs @@ -16,7 +16,7 @@ namespace KE.Items.Items { - public class Molotov : KECustomGrenade, ISwichableEffect, ICustomPickupModel, IUpgradableCustomItem + public class Molotov : KECustomGrenade, ISwitchableEffect, ICustomPickupModel, IUpgradableCustomItem { protected override Dictionary> SetTranslation() { diff --git a/KruacentExiled/KE.Items/Items/ProximityGrenade.cs b/KruacentExiled/KE.Items/Items/ProximityGrenade.cs index 2b8d5415..d759f4ff 100644 --- a/KruacentExiled/KE.Items/Items/ProximityGrenade.cs +++ b/KruacentExiled/KE.Items/Items/ProximityGrenade.cs @@ -8,7 +8,7 @@ namespace KE.Items.Items { - public class ProximityGrenade : KECustomGrenade, ISwichableEffect + public class ProximityGrenade : KECustomGrenade, ISwitchableEffect { protected override Dictionary> SetTranslation() diff --git a/KruacentExiled/KE.Items/Items/RedbullEnergy.cs b/KruacentExiled/KE.Items/Items/RedbullEnergy.cs index 68ed5300..a7271035 100644 --- a/KruacentExiled/KE.Items/Items/RedbullEnergy.cs +++ b/KruacentExiled/KE.Items/Items/RedbullEnergy.cs @@ -10,7 +10,7 @@ namespace KE.Items.Items { - public class RedbullEnergy : KECustomItem, ISwichableEffect + public class RedbullEnergy : KECustomItem, ISwitchableEffect { protected override Dictionary> SetTranslation() { diff --git a/KruacentExiled/KE.Items/Items/Scp1650.cs b/KruacentExiled/KE.Items/Items/Scp1650.cs index e630f073..ad7098e2 100644 --- a/KruacentExiled/KE.Items/Items/Scp1650.cs +++ b/KruacentExiled/KE.Items/Items/Scp1650.cs @@ -11,7 +11,7 @@ namespace KE.Items.Items { - public class Scp1650 : KECustomItem, ISwichableEffect + public class Scp1650 : KECustomItem, ISwitchableEffect { protected override Dictionary> SetTranslation() { diff --git a/KruacentExiled/KE.Items/Items/SmokeGrenade.cs b/KruacentExiled/KE.Items/Items/SmokeGrenade.cs index 6777b6a0..53110fe1 100644 --- a/KruacentExiled/KE.Items/Items/SmokeGrenade.cs +++ b/KruacentExiled/KE.Items/Items/SmokeGrenade.cs @@ -10,7 +10,7 @@ namespace KE.Items.Items { - public class SmokeGrenade : KECustomGrenade, ISwichableEffect + public class SmokeGrenade : KECustomGrenade, ISwitchableEffect { protected override Dictionary> SetTranslation() { diff --git a/KruacentExiled/KE.Items/Items/TPGrenada.cs b/KruacentExiled/KE.Items/Items/TPGrenada.cs index 35b748f1..d8601d8a 100644 --- a/KruacentExiled/KE.Items/Items/TPGrenada.cs +++ b/KruacentExiled/KE.Items/Items/TPGrenada.cs @@ -12,7 +12,7 @@ namespace KE.Items.Items { - public class TPGrenada : KECustomGrenade, ISwichableEffect, ICustomPickupModel + public class TPGrenada : KECustomGrenade, ISwitchableEffect, ICustomPickupModel { protected override Dictionary> SetTranslation() From fcc3e243585dfc7ac8f82d0f036836162bd23c35 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Sat, 14 Mar 2026 14:44:12 +0100 Subject: [PATCH 752/853] remove palyer from dict --- KruacentExiled/KE.Items/Items/Drone.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/KruacentExiled/KE.Items/Items/Drone.cs b/KruacentExiled/KE.Items/Items/Drone.cs index 9b03d67f..2c400a70 100644 --- a/KruacentExiled/KE.Items/Items/Drone.cs +++ b/KruacentExiled/KE.Items/Items/Drone.cs @@ -78,8 +78,10 @@ protected override void UnsubscribeEvents() private void OnDied(DiedEventArgs ev) { - if(ev.Player.GameObject.TryGetComponent(out DroneController dc)) { + if(ev.Player.GameObject.TryGetComponent(out DroneController dc)) + { UnityEngine.Object.Destroy(dc); + ActiveDrones.Remove(ev.Player); } } From 27745d02380b61fc25e34a29545e60ccb99c0165 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Sat, 14 Mar 2026 14:47:07 +0100 Subject: [PATCH 753/853] remove second chekc --- KruacentExiled/KE.Items/Items/FriendMaker.cs | 5 ----- 1 file changed, 5 deletions(-) diff --git a/KruacentExiled/KE.Items/Items/FriendMaker.cs b/KruacentExiled/KE.Items/Items/FriendMaker.cs index 0afeec90..067fd1f7 100644 --- a/KruacentExiled/KE.Items/Items/FriendMaker.cs +++ b/KruacentExiled/KE.Items/Items/FriendMaker.cs @@ -87,11 +87,6 @@ protected override void OnHurting(HurtingEventArgs ev) ev.IsAllowed = false; - if (!CheckCooldown(attacker)) - { - return; - } - if(Convert(ev.Player, ev.Attacker)) From 8c7023ac9e252d3b1fbbd698483a776c047b7526 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Sat, 14 Mar 2026 14:48:06 +0100 Subject: [PATCH 754/853] i destroy --- KruacentExiled/KE.Items/Items/MScan.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/KruacentExiled/KE.Items/Items/MScan.cs b/KruacentExiled/KE.Items/Items/MScan.cs index 4bbb7b44..3cb52a13 100644 --- a/KruacentExiled/KE.Items/Items/MScan.cs +++ b/KruacentExiled/KE.Items/Items/MScan.cs @@ -205,7 +205,7 @@ private void CheckBattery() { ActiveSensors.Remove(i); BatteryLife.Remove(i); - if (!i.IsSpawned) i.Destroy(); + i.Destroy(); } ListPool.Pool.Return(invalid); } From e9872617db5874de33977a3e7bb172a5583c2077 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Sat, 14 Mar 2026 14:50:50 +0100 Subject: [PATCH 755/853] resolve corridor spawn pose point --- .../API/Features/SpawnPoints/PoseRoomSpawnPoint.cs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/KruacentExiled/KE.Items/API/Features/SpawnPoints/PoseRoomSpawnPoint.cs b/KruacentExiled/KE.Items/API/Features/SpawnPoints/PoseRoomSpawnPoint.cs index 091bf612..15ab5407 100644 --- a/KruacentExiled/KE.Items/API/Features/SpawnPoints/PoseRoomSpawnPoint.cs +++ b/KruacentExiled/KE.Items/API/Features/SpawnPoints/PoseRoomSpawnPoint.cs @@ -24,7 +24,12 @@ public class ItemSpawn : IEquatable public readonly Quaternion localrotation; - + /// + /// don't use the corridor + /// + /// + /// + /// public ItemSpawn(RoomType roomType,Vector3 position,Quaternion rotation) { this.roomType = roomType; From d8f451169ea7488651c5cbf8d42ef422d95aa083 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Sat, 14 Mar 2026 14:52:16 +0100 Subject: [PATCH 756/853] remove spawn --- .../KE.Items/API/Features/KECustomGrenade.cs | 42 ------------------- 1 file changed, 42 deletions(-) diff --git a/KruacentExiled/KE.Items/API/Features/KECustomGrenade.cs b/KruacentExiled/KE.Items/API/Features/KECustomGrenade.cs index 134efca7..415917b2 100644 --- a/KruacentExiled/KE.Items/API/Features/KECustomGrenade.cs +++ b/KruacentExiled/KE.Items/API/Features/KECustomGrenade.cs @@ -42,48 +42,6 @@ protected override void UnsubscribeEvents() base.UnsubscribeEvents(); } - public override uint Spawn(IEnumerable spawnPoints, uint limit) - { - Log.Debug($"spawning {this.Name}"); - HashSet spawns = spawnPoints.ToHashSet(); - uint num = 0; - foreach (SpawnPoint spawnpoint in spawnPoints.Where(sp => sp is RoomSpawnPoint)) - { - Pickup pickup; - if (Exiled.Loader.Loader.Random.NextDouble() * 100.0 >= (double)spawnpoint.Chance || (limit != 0 && num >= limit)) - { - continue; - } - spawns.Remove(spawnpoint); - RoomSpawnPoint room = spawnpoint as RoomSpawnPoint; - ItemSpawn spawn = PoseRoomSpawnPointHandler.UseRandomPose(room.Room); - - Log.Debug($"spawning {this.Name} in {room.Room}"); - Log.Debug(room.Room + " : " + PoseRoomSpawnPointHandler.UsablePoses.Count(p => p.roomType == room.Room)); - - if (spawn is not null) - { - Log.Debug($"spawning custom pos"); - pickup = Spawn(spawn.Position); - } - else - { - Log.Error($"can't spawn ({Name}) in custom ({room.Room})"); - pickup = Spawn(spawnpoint.Position); - } - - - - if (pickup is not null) - { - num++; - } - - - } - - return base.Spawn(spawns, limit - num); - } public virtual bool Check(Projectile grenade) { From 57f766b890728812de853dbba8c162bc6a5aa4c3 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Sat, 14 Mar 2026 14:55:04 +0100 Subject: [PATCH 757/853] fix onhuritng --- .../KE.Items/API/Features/KECustomWeapon.cs | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/KruacentExiled/KE.Items/API/Features/KECustomWeapon.cs b/KruacentExiled/KE.Items/API/Features/KECustomWeapon.cs index 6b1844c2..e0f9aa17 100644 --- a/KruacentExiled/KE.Items/API/Features/KECustomWeapon.cs +++ b/KruacentExiled/KE.Items/API/Features/KECustomWeapon.cs @@ -44,12 +44,11 @@ protected override void UnsubscribeEvents() private void InternalOnHurting(HurtingEventArgs ev) { - OnHurting(ev); - if (ev.IsAllowed && Damage >= 0) + if (Check(ev.Attacker.CurrentItem)) { - ev.Amount = Damage; - + OnHurting(ev); } + } private void InternalOnShooting(ShootingEventArgs ev) { @@ -112,7 +111,11 @@ protected virtual void OnShooting(ShootingEventArgs ev) protected virtual void OnHurting(HurtingEventArgs ev) { - + if (ev.IsAllowed && Damage >= 0) + { + ev.Amount = Damage; + + } } protected virtual void OnReloading(ReloadingWeaponEventArgs ev) { From a72f60a139e3b017b3e69cc60e0ea98fb0009568 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Sat, 14 Mar 2026 14:58:10 +0100 Subject: [PATCH 758/853] remove null check + corrected given player --- KruacentExiled/KE.Items/Commands/Give.cs | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/KruacentExiled/KE.Items/Commands/Give.cs b/KruacentExiled/KE.Items/Commands/Give.cs index da3d88f8..74f3b203 100644 --- a/KruacentExiled/KE.Items/Commands/Give.cs +++ b/KruacentExiled/KE.Items/Commands/Give.cs @@ -53,8 +53,8 @@ public bool Execute(ArraySegment arguments, ICommandSender sender, out s return false; } - item?.Give(player); - response = $"{item?.Name} given to {player.Nickname} ({player.UserId})"; + item.Give(player); + response = $"{item.Name} given to {player.Nickname} ({player.UserId})"; return true; } @@ -70,15 +70,16 @@ public bool Execute(ArraySegment arguments, ICommandSender sender, out s case "all": List eligiblePlayers = Player.List.Where(CheckEligible).ToList(); foreach (Player ply in eligiblePlayers) - item?.Give(ply); + item.Give(ply); - response = $"Custom item {item?.Name} given to all players who can receive them ({eligiblePlayers.Count} players)"; + response = $"Custom item {item.Name} given to all players who can receive them ({eligiblePlayers.Count} players)"; return true; default: break; } IEnumerable list = Player.GetProcessedData(arguments, 1); + int num = 0; if (list.IsEmpty()) { @@ -90,11 +91,12 @@ public bool Execute(ArraySegment arguments, ICommandSender sender, out s { if (CheckEligible(player)) { - item?.Give(player); + item.Give(player); + num++; } } - response = $"{item?.Name} given to {list.Count()} players!"; + response = $"{item.Name} given to {num} players!"; return true; } private bool CheckEligible(Player player) => player.IsAlive && !player.IsCuffed && (player.Items.Count < 8); From bfe58fc36a1ffe5a23d09601e5e2359333a3ea26 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Sat, 14 Mar 2026 15:00:26 +0100 Subject: [PATCH 759/853] fix null --- .../KE.Items/API/Core/Upgrade/UpgradeHandler.cs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/KruacentExiled/KE.Items/API/Core/Upgrade/UpgradeHandler.cs b/KruacentExiled/KE.Items/API/Core/Upgrade/UpgradeHandler.cs index ab09a0a5..2861bae5 100644 --- a/KruacentExiled/KE.Items/API/Core/Upgrade/UpgradeHandler.cs +++ b/KruacentExiled/KE.Items/API/Core/Upgrade/UpgradeHandler.cs @@ -64,9 +64,13 @@ private void UpgradePickUp(UpgradingPickupEventArgs ev) string newItemName = upgradable.Upgrade[ev.KnobSetting].UpgradedItem; KECustomItem newItem = KECustomItem.Get(newItemName); - - if (newItem == null) Log.Warn("warning id of custom item not found"); ev.Pickup.Destroy(); + if (newItem == null) + { + Log.Warn("warning id of custom item not found"); + return; + } + newItem.Spawn(ev.OutputPosition); } From 8f4c5beec94e142cf30b8cde543d0ac212393269 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Tue, 17 Mar 2026 15:40:12 +0100 Subject: [PATCH 760/853] fix null exception --- KruacentExiled/KE.Items/API/Features/KECustomWeapon.cs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/KruacentExiled/KE.Items/API/Features/KECustomWeapon.cs b/KruacentExiled/KE.Items/API/Features/KECustomWeapon.cs index e0f9aa17..854872b9 100644 --- a/KruacentExiled/KE.Items/API/Features/KECustomWeapon.cs +++ b/KruacentExiled/KE.Items/API/Features/KECustomWeapon.cs @@ -44,6 +44,9 @@ protected override void UnsubscribeEvents() private void InternalOnHurting(HurtingEventArgs ev) { + + if (ev.Attacker is null) return; + if (Check(ev.Attacker.CurrentItem)) { OnHurting(ev); From 12d52dc8878c06c152a964c5e1ec225c04965345 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Tue, 17 Mar 2026 16:01:34 +0100 Subject: [PATCH 761/853] fix ragdoll null --- .../CR/CustomSCPs/SCP049C/SCP049CLevelSystem.cs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP049C/SCP049CLevelSystem.cs b/KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP049C/SCP049CLevelSystem.cs index 26c236ab..535c3c37 100644 --- a/KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP049C/SCP049CLevelSystem.cs +++ b/KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP049C/SCP049CLevelSystem.cs @@ -253,6 +253,13 @@ internal void Update() private void UpdateTime() { + + if(ragdoll.GameObject == null) + { + Reset(); + return; + } + if (Vector3.Distance(ragdoll.Position,_hub.transform.position) > MaxDistance) { Reset(); From d5ac01be3aeabc37e7628c83bc8e2814dc2362ab Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Tue, 17 Mar 2026 16:55:20 +0100 Subject: [PATCH 762/853] mscan start translation --- KruacentExiled/KE.Items/Items/MScan.cs | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/KruacentExiled/KE.Items/Items/MScan.cs b/KruacentExiled/KE.Items/Items/MScan.cs index 3cb52a13..afadfa9d 100644 --- a/KruacentExiled/KE.Items/Items/MScan.cs +++ b/KruacentExiled/KE.Items/Items/MScan.cs @@ -19,6 +19,14 @@ namespace KE.Items.Items { public class MScan : KECustomItem { + + + public const string Deploy = "MScanDeploy"; + public const string PickUp = "MScanPickUp"; + public const string TranslationDestroy = "MScanDestroy"; + public const string NoBattery = "MScanNoBattery"; + public const string Detect = "MScanDetect"; + protected override Dictionary> SetTranslation() { return new() @@ -27,6 +35,7 @@ protected override Dictionary> SetTranslation { [TranslationKeyName] = "M-Scan", [TranslationKeyDesc] = "Detect movement", + //[Deploy] = "Detect movement", }, ["fr"] = new() { @@ -196,7 +205,9 @@ private void CheckBattery() if (BatteryLife.ContainsKey(key) && Time.time > BatteryLife[key]) { if (ActiveSensors[key] != null) + { KECustomItem.ItemEffectHint(ActiveSensors[key], "Scanner: Batterie épuisée."); + } invalid.Add(key); } } From 85886008a4faed145158df5d114f524ae7d87dd2 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Tue, 17 Mar 2026 18:10:39 +0100 Subject: [PATCH 763/853] added conditional abilities + steal ci + healable desc + fix alzheimer & MV --- .../API/Features/KEAbilities.cs | 34 +++++++-- .../API/Features/KECustomRole.cs | 33 +++++++-- .../API/Interfaces/Ability/IConditional.cs | 15 ++++ .../Abilities/RedMist/EgoAbility.cs | 26 ++----- .../Abilities/SCP049C/ToggleHighJump.cs | 25 ++++++- .../KE.CustomRoles/Abilities/Teleportation.cs | 71 ++++++++++++++----- .../KE.CustomRoles/Abilities/Thief.cs | 25 +++++-- .../CustomSCPs/SCP049C/SCP049CLevelSystem.cs | 7 +- .../KE.CustomRoles/CR/Human/Alzheimer.cs | 23 +++--- .../CR/Human/MaladroitVoleur.cs | 23 +++--- 10 files changed, 196 insertions(+), 86 deletions(-) create mode 100644 KruacentExiled/KE.CustomRoles/API/Interfaces/Ability/IConditional.cs diff --git a/KruacentExiled/KE.CustomRoles/API/Features/KEAbilities.cs b/KruacentExiled/KE.CustomRoles/API/Features/KEAbilities.cs index ecd24549..9bcd36dc 100644 --- a/KruacentExiled/KE.CustomRoles/API/Features/KEAbilities.cs +++ b/KruacentExiled/KE.CustomRoles/API/Features/KEAbilities.cs @@ -575,11 +575,32 @@ protected virtual void AbilityGui(StringBuilder sb, Player player) /// protected virtual void Gui(StringBuilder sb,Player player) { + IConditional conditional = this as IConditional; + + if(conditional != null) + { + if (conditional.CheckCondition(player)) + { + sb.Append(""); + } + else + { + sb.Append(""); + } + } + else + { + sb.Append(""); + } + AbilityGui(sb, player); GuiReady(sb, player); GuiArrow(sb, player); + + sb.Append(""); } + public static Dictionary> PlayersHints { get; } = new(); public static Dictionary AddonHints { get; } = new(); public const int InitialAbilitySlot = 5; @@ -621,17 +642,18 @@ private static string UpdateAddon(AutoContentUpdateArg arg,AbstractHint hint) { if (ability is ICustomIcon icon && !addonAbilitiesexception.Contains(ability)) { - string msg = " "; + StringBuilder sb = StringBuilderPool.Pool.Get(); try { - msg = icon.IconName.RawString; + sb.Append(icon.IconName.RawString); } catch(KeyNotFoundException) { addonAbilitiesexception.Add(ability); Log.Error("Icon for ability "+ ability.Name+ " is missing"); + return " "; } - return msg; + return StringBuilderPool.Pool.ToStringReturn(sb); } } return " "; @@ -639,6 +661,8 @@ private static string UpdateAddon(AutoContentUpdateArg arg,AbstractHint hint) + + private static string UpdateHint(AutoContentUpdateArg arg) { Player player = Player.Get(arg.PlayerDisplay.ReferenceHub); @@ -646,10 +670,6 @@ private static string UpdateHint(AutoContentUpdateArg arg) - - - - if (PlayersAbility[player].TryGet(index,out KEAbilities ability)) { diff --git a/KruacentExiled/KE.CustomRoles/API/Features/KECustomRole.cs b/KruacentExiled/KE.CustomRoles/API/Features/KECustomRole.cs index f01054bf..ca9b14af 100644 --- a/KruacentExiled/KE.CustomRoles/API/Features/KECustomRole.cs +++ b/KruacentExiled/KE.CustomRoles/API/Features/KECustomRole.cs @@ -113,6 +113,12 @@ protected override void ShowMessage(Player player) if (MainPlugin.SettingHandler.GetDescriptionsSettings(player)) { sb.AppendLine(GetTranslation(player, TranslationKeyDesc)); + + if(this is IHealable heal) + { + sb.AppendLine(GetTranslation(player, TranslationHealable)); + } + } @@ -154,11 +160,30 @@ public override void Init() } private bool activated = false; + + private const string TranslationGUI = "CustomRoleGUI"; + private const string TranslationHealable = "CustomRoleHealable"; + private static Dictionary> SetStaticTranslation() + { + return new Dictionary>() + { + ["en"] = new() + { + [TranslationGUI] = "Current Role", + [TranslationHealable] = "This Custom Role is healable!", + }, + ["fr"] = new() + { + [TranslationGUI] = "Role", + [TranslationHealable] = "Ce custom role peut être enlevé avec un object!", + }, + }; + } + private void OneTimeInit() { if (activated) return; - TranslationHub.Add(CustomRoleTranslationId, "en", "CustomRoleGUI", "Current Role"); - TranslationHub.Add(CustomRoleTranslationId, "fr", "CustomRoleGUI", "Role"); + TranslationHub.Add(CustomRoleTranslationId, SetStaticTranslation()); activated = true; @@ -278,7 +303,7 @@ public static string CurrentRole(Player player) { KECustomRole kECustomRole = Get(player).First(); - sb.Append(GetTranslation(player, "CustomRoleGUI")); + sb.Append(GetTranslation(player, TranslationGUI)); sb.AppendLine(" : "); sb.AppendLine(); sb.Append(" + public abstract class EgoAbility : NeedCompAbility, IConditional { protected sealed override bool AddCompIfMissing => false; @@ -45,29 +46,14 @@ public override bool CanLaunchAbility(Player player, out EGO comp) return true; } - - protected override void Gui(StringBuilder sb, Player player) + protected static bool CheckItem(Player player) { - - - if(CanLaunchAbility(player, out _)) - { - sb.Append(""); - } - else - { - sb.Append(""); - } - - AbilityGui(sb, player); - GuiReady(sb, player); - GuiArrow(sb, player); - sb.Append(""); + return player.CurrentItem is null || player.CurrentItem.Type != ItemType.SCP1509; } - protected static bool CheckItem(Player player) + public bool CheckCondition(Player player) { - return player.CurrentItem is null || player.CurrentItem.Type != ItemType.SCP1509; + return CanLaunchAbility(player, out _); } public enum NeedActive diff --git a/KruacentExiled/KE.CustomRoles/Abilities/SCP049C/ToggleHighJump.cs b/KruacentExiled/KE.CustomRoles/Abilities/SCP049C/ToggleHighJump.cs index 9e11d292..c1f62bcf 100644 --- a/KruacentExiled/KE.CustomRoles/Abilities/SCP049C/ToggleHighJump.cs +++ b/KruacentExiled/KE.CustomRoles/Abilities/SCP049C/ToggleHighJump.cs @@ -1,5 +1,7 @@ using Exiled.API.Features; +using HintServiceMeow.UI.Utilities; using KE.CustomRoles.API.Features; +using KE.CustomRoles.API.Features.Abilities; using KE.CustomRoles.CR.CustomSCPs.SCP049C.UnlockableAbilities.Tier1; using MEC; using System; @@ -7,10 +9,11 @@ using System.Linq; using System.Text; using System.Threading.Tasks; +using UnityEngine; namespace KE.CustomRoles.Abilities.SCP049C { - public class ToggleHighJump : KEAbilities + public class ToggleHighJump : ToggleableAbility { public override string Name { get; } = "ToggleHighJump"; @@ -22,18 +25,24 @@ protected override Dictionary> SetTranslation ["en"] = new() { [TranslationKeyName] = "Toggle Big Jump", - [TranslationKeyDesc] = "WIP", + [TranslationKeyDesc] = "", }, ["fr"] = new() { [TranslationKeyName] = "Active/désactive grand saut", - [TranslationKeyDesc] = "WIP", + [TranslationKeyDesc] = "", } }; } public override float Cooldown { get; } = 2f; + public override Color ColorOn => Color.green; + + public override Color ColorOff => Color.red; + + + protected override bool AbilityUsed(Player player) { if (!player.GameObject.TryGetComponent(out var comp)) @@ -45,5 +54,15 @@ protected override bool AbilityUsed(Player player) return base.AbilityUsed(player); } + + public override bool GetState(Player player) + { + if (!player.GameObject.TryGetComponent(out var comp)) + { + return false; + } + + return comp.IsActive; + } } } diff --git a/KruacentExiled/KE.CustomRoles/Abilities/Teleportation.cs b/KruacentExiled/KE.CustomRoles/Abilities/Teleportation.cs index a76c3916..28523b4e 100644 --- a/KruacentExiled/KE.CustomRoles/Abilities/Teleportation.cs +++ b/KruacentExiled/KE.CustomRoles/Abilities/Teleportation.cs @@ -2,6 +2,7 @@ using Exiled.API.Features; using KE.CustomRoles.API.Features; using KE.CustomRoles.API.Interfaces; +using KE.CustomRoles.API.Interfaces.Ability; using MapGeneration; using System.Collections.Generic; using System.Linq; @@ -9,7 +10,7 @@ namespace KE.CustomRoles.Abilities { - public class Teleportation : KEAbilities, ICustomIcon + public class Teleportation : KEAbilities, ICustomIcon, IConditional { public override string Name { get; } = "Teleportation"; @@ -44,48 +45,80 @@ protected override Dictionary> SetTranslation protected override bool AbilityUsed(Player player) { - if(!SetPosition.TryGetTarget(player, out Vector3 target)) + + if (!CheckValid(player, true)) { - ShowEffectHint(player, "TeleportationNoTarget"); return false; } + SetPosition.TryGetTarget(player, out Vector3 target); + player.Hurt(Damage, Exiled.API.Enums.DamageType.Asphyxiation); - - - if(Lift.Get(target) is not null) + if(UnityEngine.Random.Range(1f, 100f) < 5) { - ShowEffectHint(player, "TeleportationLift"); - return false; + if (Player.Enumerable.Count() > 1) + { + player.Teleport(Player.Enumerable.GetRandomValue(p => p != player)); + } } + else + { + player.Position = target; + } + return base.AbilityUsed(player); + } - if (target.GetZone() == FacilityZone.LightContainment && Map.IsLczDecontaminated) + + private bool CheckValid(Player player,bool showMessage) + { + if (!SetPosition.TryGetTarget(player, out Vector3 target)) { - ShowEffectHint(player, "TeleportationLcz"); + if (showMessage) + { + ShowEffectHint(player, "TeleportationNoTarget"); + } + return false; } - if (target.GetZone() != player.Zone.GetZone()) + + + if (Lift.Get(target) is not null) { - ShowEffectHint(player, "TeleportationDifferentZone"); + if (showMessage) + { + ShowEffectHint(player, "TeleportationLift"); + } + return false; } - player.Hurt(Damage, Exiled.API.Enums.DamageType.Asphyxiation); - if(UnityEngine.Random.Range(1f, 100f) < 5) + if (target.GetZone() == FacilityZone.LightContainment && Map.IsLczDecontaminated) { - if (Player.Enumerable.Count() > 1) + if (showMessage) { - player.Teleport(Player.Enumerable.GetRandomValue(p => p != player)); + ShowEffectHint(player, "TeleportationLcz"); } + + + return false; } - else + + if (target.GetZone() != player.Zone.GetZone()) { - player.Position = target; + if (showMessage) + { + ShowEffectHint(player, "TeleportationDifferentZone"); + } + return false; } - return base.AbilityUsed(player); + return true; + } + public bool CheckCondition(Player player) + { + return CheckValid(player, false); } } } \ No newline at end of file diff --git a/KruacentExiled/KE.CustomRoles/Abilities/Thief.cs b/KruacentExiled/KE.CustomRoles/Abilities/Thief.cs index b257e571..1e41a09e 100644 --- a/KruacentExiled/KE.CustomRoles/Abilities/Thief.cs +++ b/KruacentExiled/KE.CustomRoles/Abilities/Thief.cs @@ -1,8 +1,10 @@ using Exiled.API.Extensions; using Exiled.API.Features; using Exiled.API.Features.Items; +using Exiled.CustomItems.API.Features; using KE.CustomRoles.API.Features; using KE.CustomRoles.API.Interfaces; +using KE.Items.API.Features; using KE.Utils.API.Displays.DisplayMeow; using KE.Utils.API.Features; using KE.Utils.API.Features.SCPs; @@ -18,7 +20,8 @@ public class Thief : KEAbilities, ICustomIcon { public override string Name { get; } = "Thief"; - + public const string NoPlayer = "ThiefNoPlayer"; + public const string Fail = "ThiefFail"; protected override Dictionary> SetTranslation() { return new() @@ -27,13 +30,15 @@ protected override Dictionary> SetTranslation { [TranslationKeyName] = "Steal", [TranslationKeyDesc] = "Steal a random item from a player in the same room", - ["ThiefNoPlayer"] = "no player to steal from", - ["ThiefFail"] = "I think this is a skill issue ! Congrats !", + [NoPlayer] = "No player to steal from", + [Fail] = "I think this is a skill issue! Congrats!", }, ["fr"] = new() { [TranslationKeyName] = "Voler", [TranslationKeyDesc] = "Vole un object aléatoire à un joueur dans la même pièce", + [NoPlayer] = "Personne à qui voler", + [Fail] = "Wow faut get good là", } }; } @@ -101,10 +106,16 @@ private void Steal(Player player, Player thiefed) } - - - Item newitem = item.Clone(); - newitem.Give(player); + if(KECustomItem.TryGet(item,out CustomItem ci)) + { + ci.Give(player); + } + else + { + Item newitem = item.Clone(); + newitem.Give(player); + } + thiefed.RemoveItem(item); } diff --git a/KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP049C/SCP049CLevelSystem.cs b/KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP049C/SCP049CLevelSystem.cs index 535c3c37..194209bc 100644 --- a/KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP049C/SCP049CLevelSystem.cs +++ b/KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP049C/SCP049CLevelSystem.cs @@ -136,11 +136,12 @@ public void AddKill() public static int GetNbKillPerTier(int tier) { - int x = tier + 1; + //int x = tier + 1; - double result = ((-1) * Math.Pow(x, 2)) + (6*x)-1; + //double result = ((-1) * Math.Pow(x, 2)) + (6*x)-1; - return (int)Math.Ceiling(result); + //return (int)Math.Ceiling(result); + return 2; } diff --git a/KruacentExiled/KE.CustomRoles/CR/Human/Alzheimer.cs b/KruacentExiled/KE.CustomRoles/CR/Human/Alzheimer.cs index b6d4c498..55364c65 100644 --- a/KruacentExiled/KE.CustomRoles/CR/Human/Alzheimer.cs +++ b/KruacentExiled/KE.CustomRoles/CR/Human/Alzheimer.cs @@ -46,31 +46,30 @@ protected override Dictionary> SetTranslation public Color32 Color => new Color32(112,112,112,0); public HashSet HealItem => [ItemType.SCP500]; - - private static CoroutineHandle coroutine; protected override void RoleAdded(Player player) { - Timing.RunCoroutineSingleton(Teleport(), coroutine, SingletonBehavior.Abort); + Timing.RunCoroutine(Teleport(player)); } - private IEnumerator Teleport() + private IEnumerator Teleport(Player player) { - while (true) + while (TrackedPlayers.Contains(player)) { yield return Timing.WaitForSeconds(UnityEngine.Random.Range(300f, 600f)); - - foreach(Player player in TrackedPlayers) - { - player.EnableEffect(EffectType.Flashed, 1, 5); - player.EnableEffect(EffectType.Invisible, 1, 6); - player.Teleport(player.Zone.RandomSafeRoom()); - } + EffectPlayer(player); } } + private void EffectPlayer(Player player) + { + if (player is null) return; + player.EnableEffect(EffectType.Flashed, 1, 5); + player.EnableEffect(EffectType.Invisible, 1, 6); + player.Teleport(player.Zone.RandomSafeRoom()); + } } diff --git a/KruacentExiled/KE.CustomRoles/CR/Human/MaladroitVoleur.cs b/KruacentExiled/KE.CustomRoles/CR/Human/MaladroitVoleur.cs index 324daae7..60c6fcbb 100644 --- a/KruacentExiled/KE.CustomRoles/CR/Human/MaladroitVoleur.cs +++ b/KruacentExiled/KE.CustomRoles/CR/Human/MaladroitVoleur.cs @@ -52,29 +52,30 @@ protected override Dictionary> SetTranslation "Thief" }; - private CoroutineHandle coroutine; protected override void RoleAdded(Player player) { - Timing.RunCoroutineSingleton(ThrowingItem(), coroutine, SingletonBehavior.Abort); + Timing.RunCoroutine(ThrowingItem(player)); } - private IEnumerator ThrowingItem() + private IEnumerator ThrowingItem(Player player) { - while (true) + while (TrackedPlayers.Contains(player)) { yield return Timing.WaitForSeconds(UnityEngine.Random.Range(90f, 120f)); + EffectPlayer(player); - foreach(Player player in TrackedPlayers) - { - if (UnityEngine.Random.Range(0f, 100f) > .5f) - { - player.DropHeldItem(); - } - } + } + } + + private void EffectPlayer(Player player) + { + if (UnityEngine.Random.Range(0f, 100f) > .5f) + { + player.DropHeldItem(); } } } From 9eacba5dd6caea0bcb9b786bb9e0a869b0772d64 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Tue, 17 Mar 2026 18:28:35 +0100 Subject: [PATCH 764/853] gambling event + scp team can't gamble --- .../Events/EventArgs/GamblingEventArgs.cs | 27 ++++++++++ .../Events/Handlers/GamblingRoom.cs | 22 ++++++++ .../KE.Map/Heavy/GamblingZone/GamblingRoom.cs | 26 +++++++--- .../ElevatorGateA/CustomElevatorGateA.cs | 17 ++++-- .../Surface/ElevatorGateA/ElevatorModel.cs | 52 +++++++++---------- 5 files changed, 106 insertions(+), 38 deletions(-) create mode 100644 KruacentExiled/KE.Map/Heavy/GamblingZone/Events/EventArgs/GamblingEventArgs.cs create mode 100644 KruacentExiled/KE.Map/Heavy/GamblingZone/Events/Handlers/GamblingRoom.cs diff --git a/KruacentExiled/KE.Map/Heavy/GamblingZone/Events/EventArgs/GamblingEventArgs.cs b/KruacentExiled/KE.Map/Heavy/GamblingZone/Events/EventArgs/GamblingEventArgs.cs new file mode 100644 index 00000000..e690b94c --- /dev/null +++ b/KruacentExiled/KE.Map/Heavy/GamblingZone/Events/EventArgs/GamblingEventArgs.cs @@ -0,0 +1,27 @@ +using Exiled.API.Features; +using Exiled.API.Features.Items; +using Exiled.Events.EventArgs.Interfaces; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace KE.Map.Heavy.GamblingZone.Events.EventArgs +{ + public class GamblingEventArgs : IPlayerEvent, IDeniableEvent, IItemEvent + { + public Player Player { get; } + + public bool IsAllowed { get; set; } + + public Item Item { get; } + + public GamblingEventArgs(Player player, Item item,bool isAllowed = true) + { + Player = player; + Item = item; + IsAllowed = isAllowed; + } + } +} diff --git a/KruacentExiled/KE.Map/Heavy/GamblingZone/Events/Handlers/GamblingRoom.cs b/KruacentExiled/KE.Map/Heavy/GamblingZone/Events/Handlers/GamblingRoom.cs new file mode 100644 index 00000000..eacdab49 --- /dev/null +++ b/KruacentExiled/KE.Map/Heavy/GamblingZone/Events/Handlers/GamblingRoom.cs @@ -0,0 +1,22 @@ +using KE.Map.Heavy.GamblingZone.Events.EventArgs; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace KE.Map.Heavy.GamblingZone.Events.Handlers +{ + public static class GamblingRoom + { + + + public static event Action Gambling = delegate { }; + + + public static void OnGambling(GamblingEventArgs ev) + { + Gambling?.Invoke(ev); + } + } +} diff --git a/KruacentExiled/KE.Map/Heavy/GamblingZone/GamblingRoom.cs b/KruacentExiled/KE.Map/Heavy/GamblingZone/GamblingRoom.cs index 5d474460..ace11a73 100644 --- a/KruacentExiled/KE.Map/Heavy/GamblingZone/GamblingRoom.cs +++ b/KruacentExiled/KE.Map/Heavy/GamblingZone/GamblingRoom.cs @@ -3,11 +3,13 @@ using Exiled.API.Features.Items; using Exiled.API.Features.Toys; using Exiled.Events.EventArgs.Server; -using InteractableToy = LabApi.Features.Wrappers.InteractableToy; +using KE.Map.Heavy.GamblingZone.Events.EventArgs; +using KE.Utils.API.Features.SCPs; +using LabApi.Events.Arguments.PlayerEvents; using System.Collections.Generic; -using UnityEngine; using System.Linq; -using LabApi.Events.Arguments.PlayerEvents; +using UnityEngine; +using InteractableToy = LabApi.Features.Wrappers.InteractableToy; namespace KE.Map.Heavy.GamblingZone { @@ -121,15 +123,27 @@ public override void Destroy() } + public void OnPickup(PlayerSearchedToyEventArgs ev) { Player player2 = ev.Player; if (ev.Interactable != _interact) return; if (player2 == null) return; - if (player2.IsScp) return; + if (SCPTeam.IsSCP(player2.ReferenceHub)) return; if (player2.CurrentItem == null) return; Item item = _lootTable.GetRandomItem(); + + GamblingEventArgs ev1 = new(player2, item, true); + + Events.Handlers.GamblingRoom.OnGambling(ev1); + + if (!ev1.IsAllowed) + { + return; + } + + player2.CurrentItem.Destroy(); player2.AddItem(item); @@ -137,10 +151,6 @@ public void OnPickup(PlayerSearchedToyEventArgs ev) { player2.DropItem(item, false); } - - - - } diff --git a/KruacentExiled/KE.Map/Surface/ElevatorGateA/CustomElevatorGateA.cs b/KruacentExiled/KE.Map/Surface/ElevatorGateA/CustomElevatorGateA.cs index bc321e9e..d6aeff02 100644 --- a/KruacentExiled/KE.Map/Surface/ElevatorGateA/CustomElevatorGateA.cs +++ b/KruacentExiled/KE.Map/Surface/ElevatorGateA/CustomElevatorGateA.cs @@ -89,7 +89,7 @@ private static void CreatePrimitives() Vector3 posbot = new(15.62f, 290.65f, -45.19f); prim = Primitive.Create(pos, null, Vector3.one * Scale); prim.Flags = AdminToys.PrimitiveFlags.None; - prim.MovementSmoothing = 240; + prim.MovementSmoothing = 0; primtop = Primitive.Create(postop, null, Vector3.one * Scale); primtop.Flags = AdminToys.PrimitiveFlags.None; @@ -119,18 +119,27 @@ public static void Destroy() model.SendingElevator -= SendingElevator; model.Destroy(prim.Transform); prim = null; + } + if(step != null) + { step.Destroy(); - help.Destroy(); - helpPlatform.Destroy(); step = null; + } + if (help != null) + { + help.Destroy(); help = null; + } + if (helpPlatform != null) + { + helpPlatform.Destroy(); helpPlatform = null; } - if(primbottom != null) + if (primbottom != null) { bottompanel.SendingElevator -= SendingElevator; diff --git a/KruacentExiled/KE.Map/Surface/ElevatorGateA/ElevatorModel.cs b/KruacentExiled/KE.Map/Surface/ElevatorGateA/ElevatorModel.cs index 739b9e04..b78a5cda 100644 --- a/KruacentExiled/KE.Map/Surface/ElevatorGateA/ElevatorModel.cs +++ b/KruacentExiled/KE.Map/Surface/ElevatorGateA/ElevatorModel.cs @@ -26,7 +26,7 @@ protected override void CreateModel(Transform parent) new Quaternion(0f, 0f, 0f, 1f), new Vector3(1f, 1f, 1f), new Color32(0, 0, 0, 0), - 240 + 0 ); ElevatorCabin.PrimitiveFlags = AdminToys.PrimitiveFlags.None; @@ -37,7 +37,7 @@ protected override void CreateModel(Transform parent) new Quaternion(0f, 0f, 0f, 1f), new Vector3(1f, 1f, 1f), new Color32(0, 0, 0, 0), - 240 + 0 ); panel.PrimitiveFlags = AdminToys.PrimitiveFlags.None; @@ -48,7 +48,7 @@ protected override void CreateModel(Transform parent) new Quaternion(0f, 0f, 0f, 1f), new Vector3(0.15f, 1.3f, 0.15f), new Color32(255, 255, 255, 255), - 240 + 0 ); @@ -59,7 +59,7 @@ protected override void CreateModel(Transform parent) new Quaternion(0.3775984f, 0f, 0f, 0.9259695f), new Vector3(1f, 1f, 0.15f), new Color32(255, 255, 255, 255), - 240 + 0 ); @@ -70,7 +70,7 @@ protected override void CreateModel(Transform parent) new Quaternion(0.3775984f, 0f, 0f, 0.9259695f), new Vector3(0.8f, 0.8f, 0.15f), new Color32(255, 255, 255, 255), - 240 + 0 ); @@ -99,7 +99,7 @@ protected override void CreateModel(Transform parent) new Quaternion(0f, 0f, 0f, 1f), new Vector3(1.666667f, 0.2f, 5f), new Color32(255, 255, 255, 255), - 240 + 0 ); @@ -110,7 +110,7 @@ protected override void CreateModel(Transform parent) new Quaternion(0f, 0f, 0f, 1f), new Vector3(1.666667f, 0.2f, 5f), new Color32(255, 255, 255, 255), - 240 + 0 ); @@ -121,7 +121,7 @@ protected override void CreateModel(Transform parent) new Quaternion(0f, 0f, 0f, 1f), new Vector3(1.666667f, 0.2f, 1.666667f), new Color32(255, 255, 255, 255), - 240 + 0 ); @@ -132,7 +132,7 @@ protected override void CreateModel(Transform parent) new Quaternion(0f, 0f, 0f, 1f), new Vector3(1.666667f, 0.2f, 1.666667f), new Color32(255, 255, 255, 255), - 240 + 0 ); @@ -163,7 +163,7 @@ protected override void CreateModel(Transform parent) new Quaternion(0f, 0f, 0f, 1f), new Vector3(5f, 0.2f, 5f), new Color32(255, 255, 255, 255), - 240 + 0 ); @@ -184,7 +184,7 @@ protected override void CreateModel(Transform parent) new Quaternion(0f, 0f, 0f, 1f), new Vector3(0.1f, 4.9f, 0.1f), new Color32(255, 255, 255, 255), - 240 + 0 ); @@ -195,7 +195,7 @@ protected override void CreateModel(Transform parent) new Quaternion(0f, 0f, 0f, 1f), new Vector3(0.1f, 1.4798f, 0.1f), new Color32(255, 255, 255, 255), - 240 + 0 ); @@ -206,7 +206,7 @@ protected override void CreateModel(Transform parent) new Quaternion(0f, 0f, 0f, 1f), new Vector3(0.1f, 1.4798f, 0.1f), new Color32(255, 255, 255, 255), - 240 + 0 ); @@ -217,7 +217,7 @@ protected override void CreateModel(Transform parent) new Quaternion(0f, 0f, 0f, 1f), new Vector3(0.1f, 4.9f, 0.1f), new Color32(255, 255, 255, 255), - 240 + 0 ); @@ -228,7 +228,7 @@ protected override void CreateModel(Transform parent) new Quaternion(0f, 0f, 0f, 1f), new Vector3(0.1f, 4.9f, 0.1f), new Color32(255, 255, 255, 255), - 240 + 0 ); @@ -239,7 +239,7 @@ protected override void CreateModel(Transform parent) new Quaternion(0f, 0f, 0f, 1f), new Vector3(0.1f, 1.4798f, 0.1f), new Color32(255, 255, 255, 255), - 240 + 0 ); @@ -250,7 +250,7 @@ protected override void CreateModel(Transform parent) new Quaternion(0f, 0f, 0f, 1f), new Vector3(0.1f, 4.9f, 0.1f), new Color32(255, 255, 255, 255), - 240 + 0 ); @@ -261,7 +261,7 @@ protected override void CreateModel(Transform parent) new Quaternion(0f, 0f, 0f, 1f), new Vector3(0.1f, 1.4798f, 0.1f), new Color32(255, 255, 255, 255), - 240 + 0 ); @@ -272,7 +272,7 @@ protected override void CreateModel(Transform parent) new Quaternion(0f, 0f, 0f, 1f), new Vector3(0.1f, 1.4798f, 0.1f), new Color32(255, 255, 255, 255), - 240 + 0 ); @@ -283,7 +283,7 @@ protected override void CreateModel(Transform parent) new Quaternion(0f, 0f, 0f, 1f), new Vector3(0.1f, 1.4798f, 0.1f), new Color32(255, 255, 255, 255), - 240 + 0 ); @@ -294,7 +294,7 @@ protected override void CreateModel(Transform parent) new Quaternion(0f, 0f, 0f, 1f), new Vector3(5f, 0.2f, 0.2f), new Color32(255, 255, 255, 255), - 240 + 0 ); @@ -305,7 +305,7 @@ protected override void CreateModel(Transform parent) new Quaternion(0f, 0f, 0f, 1f), new Vector3(0.2f, 0.2f, 5f), new Color32(255, 255, 255, 255), - 240 + 0 ); @@ -316,7 +316,7 @@ protected override void CreateModel(Transform parent) new Quaternion(0f, 0f, 0f, 1f), new Vector3(0.2f, 0.2f, 1.7f), new Color32(255, 255, 255, 255), - 240 + 0 ); @@ -327,7 +327,7 @@ protected override void CreateModel(Transform parent) new Quaternion(0f, 0f, 0f, 1f), new Vector3(0.2f, 0.2f, 1.7f), new Color32(255, 255, 255, 255), - 240 + 0 ); @@ -338,7 +338,7 @@ protected override void CreateModel(Transform parent) new Quaternion(0f, 0f, 0f, 1f), new Vector3(1.7f, 0.2f, 0.2f), new Color32(255, 255, 255, 255), - 240 + 0 ); @@ -349,7 +349,7 @@ protected override void CreateModel(Transform parent) new Quaternion(0f, 0f, 0f, 1f), new Vector3(1.7f, 0.2f, 0.2f), new Color32(255, 255, 255, 255), - 240 + 0 ); From 6736885ef7be8c63be989555439f221a9f885812 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Tue, 17 Mar 2026 18:53:47 +0100 Subject: [PATCH 765/853] translate MSCAN --- .../KE.Items/API/Features/KECustomItem.cs | 5 +++ KruacentExiled/KE.Items/Items/MScan.cs | 31 ++++++++++++++----- 2 files changed, 29 insertions(+), 7 deletions(-) diff --git a/KruacentExiled/KE.Items/API/Features/KECustomItem.cs b/KruacentExiled/KE.Items/API/Features/KECustomItem.cs index 9ae99da4..6f803042 100644 --- a/KruacentExiled/KE.Items/API/Features/KECustomItem.cs +++ b/KruacentExiled/KE.Items/API/Features/KECustomItem.cs @@ -96,6 +96,11 @@ public static string GetTranslation(string lang, string key) return TranslationHub.Get(lang, CustomItemTranslationId, key); } + public static void TranslationHint(Player player,string key) + { + ItemEffectHint(player, GetTranslation(player, key)); + } + public override void Init() { _typeLookup.Add(GetType(), this); diff --git a/KruacentExiled/KE.Items/Items/MScan.cs b/KruacentExiled/KE.Items/Items/MScan.cs index afadfa9d..7ab83208 100644 --- a/KruacentExiled/KE.Items/Items/MScan.cs +++ b/KruacentExiled/KE.Items/Items/MScan.cs @@ -35,12 +35,21 @@ protected override Dictionary> SetTranslation { [TranslationKeyName] = "M-Scan", [TranslationKeyDesc] = "Detect movement", - //[Deploy] = "Detect movement", + [Deploy] = $"MSCAN DEPLOYED\nBattery: {TimeUp} seconds", + [PickUp] = "M-Scan picked up", + [TranslationDestroy] = "M-SCAN DESTROYED", + [NoBattery] = "M-Scan : No battery left", + [Detect] = "M-SCAN: %Name%", }, ["fr"] = new() { [TranslationKeyName] = "M-Scan", [TranslationKeyDesc] = "Détecte les mouvements des personnes passant devant", + [Deploy] = $"SCANNER DÉPLOYÉ\nBatterie: {TimeUp} secondes", + [PickUp] = "Scanner récupéré.", + [TranslationDestroy] = "SCANNER DÉTRUIT", + [NoBattery] = "Scanner: Batterie épuisée.", + [Detect] = "$M-SCAN: %Name%", }, }; } @@ -146,7 +155,8 @@ private void OnDroppedItem(DroppedItemEventArgs ev) ActiveSensors.Add(pickup, player); BatteryLife[pickup] = Time.time + TimeUp; - KECustomItem.ItemEffectHint(player, $"SCANNER DÉPLOYÉ\nBatterie: {TimeUp} secondes"); + + TranslationHint(player, Deploy); } } @@ -158,7 +168,7 @@ protected override void OnPickingUp(PickingUpItemEventArgs ev) { ActiveSensors.Remove(ev.Pickup); BatteryLife.Remove(ev.Pickup); - KECustomItem.ItemEffectHint(player, "Scanner récupéré."); + TranslationHint(player, PickUp); } } @@ -180,7 +190,10 @@ private void CheckDestruction(Vector3 hitPos, float radius) if (Vector3.Distance(hitPos, sensor.Position) <= radius) { toDestroy.Add(sensor); - if (owner != null) KECustomItem.ItemEffectHint(owner, "SCANNER DÉTRUIT"); + if (owner != null) + { + TranslationHint(owner, TranslationDestroy); + } } } @@ -204,9 +217,11 @@ private void CheckBattery() { if (BatteryLife.ContainsKey(key) && Time.time > BatteryLife[key]) { - if (ActiveSensors[key] != null) + + Player player = ActiveSensors[key]; + if (player != null) { - KECustomItem.ItemEffectHint(ActiveSensors[key], "Scanner: Batterie épuisée."); + TranslationHint(player, NoBattery); } invalid.Add(key); } @@ -256,7 +271,9 @@ private IEnumerator MotionDetector() if (owner != null) { string color = target.Role.Color.ToHex(); - KECustomItem.ItemEffectHint(owner, $"M-SCAN: {target.Role.Name} ({target.Nickname})"); + + string msg = GetTranslation(owner, Detect).Replace("%Color%", color).Replace("%Name%", target.Role.Name); + KECustomItem.ItemEffectHint(owner, msg); } break; From 3767d5eee2adf8ae70d4353e0ac771f357c17406 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Wed, 18 Mar 2026 17:13:11 +0100 Subject: [PATCH 766/853] fix mv & alzheimer effect when changing role --- .../KE.CustomRoles/CR/Human/Alzheimer.cs | 27 +++++++++++++++++-- .../CR/Human/MaladroitVoleur.cs | 24 ++++++++++++++--- 2 files changed, 46 insertions(+), 5 deletions(-) diff --git a/KruacentExiled/KE.CustomRoles/CR/Human/Alzheimer.cs b/KruacentExiled/KE.CustomRoles/CR/Human/Alzheimer.cs index 55364c65..923e9518 100644 --- a/KruacentExiled/KE.CustomRoles/CR/Human/Alzheimer.cs +++ b/KruacentExiled/KE.CustomRoles/CR/Human/Alzheimer.cs @@ -12,6 +12,7 @@ using PlayerRoles; using System.Collections.Generic; using UnityEngine; +using UnityEngine.Pool; namespace KE.CustomRoles.CR.Human { @@ -46,13 +47,35 @@ protected override Dictionary> SetTranslation public Color32 Color => new Color32(112,112,112,0); public HashSet HealItem => [ItemType.SCP500]; + private Dictionary handles; + + protected override void SubscribeEvents() + { + handles = DictionaryPool.Get(); + base.SubscribeEvents(); + } + + protected override void UnsubscribeEvents() + { + base.UnsubscribeEvents(); + DictionaryPool.Release(handles); + } + protected override void RoleAdded(Player player) { - Timing.RunCoroutine(Teleport(player)); + handles[player] = Timing.RunCoroutine(Teleport(player)); + } + + protected override void RoleRemoved(Player player) + { + if(handles.TryGetValue(player, out var handle)) + { + Timing.KillCoroutines(handle); + } } private IEnumerator Teleport(Player player) { - while (TrackedPlayers.Contains(player)) + while (Check(player)) { yield return Timing.WaitForSeconds(UnityEngine.Random.Range(300f, 600f)); diff --git a/KruacentExiled/KE.CustomRoles/CR/Human/MaladroitVoleur.cs b/KruacentExiled/KE.CustomRoles/CR/Human/MaladroitVoleur.cs index 60c6fcbb..193727e7 100644 --- a/KruacentExiled/KE.CustomRoles/CR/Human/MaladroitVoleur.cs +++ b/KruacentExiled/KE.CustomRoles/CR/Human/MaladroitVoleur.cs @@ -5,6 +5,7 @@ using Exiled.CustomRoles.API.Features; using KE.CustomRoles.API.Features; using KE.CustomRoles.API.Interfaces; +using KE.Utils.API.Translations.Events; using MEC; using PlayerRoles; using System; @@ -12,6 +13,7 @@ using System.Drawing.Design; using System.Linq; using UnityEngine; +using UnityEngine.Pool; using Utils.NonAllocLINQ; namespace KE.CustomRoles.CR.Human @@ -50,12 +52,30 @@ protected override Dictionary> SetTranslation public override HashSet Abilities { get; } = new() { "Thief" - }; + }; + private Dictionary handles; + protected override void SubscribeEvents() + { + handles = DictionaryPool.Get(); + base.SubscribeEvents(); + } + protected override void UnsubscribeEvents() + { + base.UnsubscribeEvents(); + DictionaryPool.Release(handles); + } protected override void RoleAdded(Player player) { Timing.RunCoroutine(ThrowingItem(player)); } + protected override void RoleRemoved(Player player) + { + if (handles.TryGetValue(player, out var handle)) + { + Timing.KillCoroutines(handle); + } + } private IEnumerator ThrowingItem(Player player) @@ -65,8 +85,6 @@ private IEnumerator ThrowingItem(Player player) { yield return Timing.WaitForSeconds(UnityEngine.Random.Range(90f, 120f)); EffectPlayer(player); - - } } From bafa4e20c5fc81b295dfe6e5d8f064b2004f1198 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Wed, 18 Mar 2026 17:47:20 +0100 Subject: [PATCH 767/853] forgor check --- KruacentExiled/KE.CustomRoles/CR/Human/MaladroitVoleur.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/KruacentExiled/KE.CustomRoles/CR/Human/MaladroitVoleur.cs b/KruacentExiled/KE.CustomRoles/CR/Human/MaladroitVoleur.cs index 193727e7..293fe870 100644 --- a/KruacentExiled/KE.CustomRoles/CR/Human/MaladroitVoleur.cs +++ b/KruacentExiled/KE.CustomRoles/CR/Human/MaladroitVoleur.cs @@ -81,7 +81,7 @@ protected override void RoleRemoved(Player player) private IEnumerator ThrowingItem(Player player) { - while (TrackedPlayers.Contains(player)) + while (Check(player)) { yield return Timing.WaitForSeconds(UnityEngine.Random.Range(90f, 120f)); EffectPlayer(player); From 4182d2d5872bd6f24a1402687fe0d784a5d85a4a Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Wed, 18 Mar 2026 18:45:01 +0100 Subject: [PATCH 768/853] test command --- .../KE.Map/Commands/TestGetValidPosition.cs | 73 +++++++++++++++++++ 1 file changed, 73 insertions(+) create mode 100644 KruacentExiled/KE.Map/Commands/TestGetValidPosition.cs diff --git a/KruacentExiled/KE.Map/Commands/TestGetValidPosition.cs b/KruacentExiled/KE.Map/Commands/TestGetValidPosition.cs new file mode 100644 index 00000000..2cc4c1cf --- /dev/null +++ b/KruacentExiled/KE.Map/Commands/TestGetValidPosition.cs @@ -0,0 +1,73 @@ +using CommandSystem; +using Exiled.API.Enums; +using Exiled.API.Features; +using KE.Utils.API.Commands; +using KE.Utils.Extensions; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace KE.Map.Commands +{ + + [CommandHandler(typeof(RemoteAdminCommandHandler))] + [CommandHandler(typeof(ClientCommandHandler))] + public class TestGetValidPosition : KECommand + { + public override string Command => "test"; + + public override string[] Aliases => []; + + public override string Description => ""; + + public override string[] Usage => []; + + public override bool ExecuteCommand(ArraySegment arguments, ICommandSender sender, out string response) + { + + if (!MainPlugin.Instance.Config.Debug) + { + response = "you can't do that"; + return false; + } + + Player player = Player.Get(sender); + + if(player == null) + { + response = "invalid player"; + return false; + } + + if(arguments.Count == 0) + { + response = "give a roomtype"; + return false; + } + + + if(!Enum.TryParse(arguments.At(0),out RoomType roomtype)) + { + response = "room type not found"; + return false; + } + Room room = Room.Get(roomtype); + + + if(room == null) + { + response = "room not found"; + return false; + } + + + + player.Teleport(room.GetValidPosition()); + response = "ok"; + + return false; + } + } +} From 040b8812fb02bf56d3cd1481e7a8d186a8e8d22b Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Wed, 18 Mar 2026 18:53:03 +0100 Subject: [PATCH 769/853] remove desc from ci --- .../KE.Items/API/Features/KECustomItem.cs | 2 + KruacentExiled/KE.Items/Items/Defibrilator.cs | 1 - .../KE.Items/Items/DeployableWall.cs | 1 - KruacentExiled/KE.Items/Items/DivinePills.cs | 3 -- KruacentExiled/KE.Items/Items/Drone.cs | 47 ++++++++++++++----- KruacentExiled/KE.Items/Items/FriendMaker.cs | 1 - KruacentExiled/KE.Items/Items/HealZone.cs | 1 - KruacentExiled/KE.Items/Items/ImpactFlash.cs | 1 - .../KE.Items/Items/LeSoleil/LeSoleil.cs | 1 - .../KE.Items/Items/LowGravityGrenade.cs | 1 - KruacentExiled/KE.Items/Items/MScan.cs | 1 - KruacentExiled/KE.Items/Items/Mine.cs | 1 - KruacentExiled/KE.Items/Items/Molotov.cs | 1 - KruacentExiled/KE.Items/Items/PressePuree.cs | 1 - .../KE.Items/Items/ProximityGrenade.cs | 1 - .../KE.Items/Items/RedbullEnergy.cs | 1 - .../KE.Items/Items/SainteGrenada.cs | 1 - KruacentExiled/KE.Items/Items/Scp1650.cs | 1 - KruacentExiled/KE.Items/Items/Scp3136.cs | 1 - KruacentExiled/KE.Items/Items/Scp514.cs | 1 - .../KE.Items/Items/ShieldBelt/ShieldBelt.cs | 1 + KruacentExiled/KE.Items/Items/SmokeGrenade.cs | 1 - KruacentExiled/KE.Items/Items/TPGrenada.cs | 1 - .../KE.Items/Items/TrueDivinePills.cs | 1 - 24 files changed, 39 insertions(+), 34 deletions(-) diff --git a/KruacentExiled/KE.Items/API/Features/KECustomItem.cs b/KruacentExiled/KE.Items/API/Features/KECustomItem.cs index 6f803042..88177e59 100644 --- a/KruacentExiled/KE.Items/API/Features/KECustomItem.cs +++ b/KruacentExiled/KE.Items/API/Features/KECustomItem.cs @@ -33,6 +33,8 @@ public abstract class KECustomItem : CustomItem [Obsolete("Uses only the name",true)] public sealed override uint Id { get; set; } = 0; + public sealed override string Description { get; set; } = string.Empty; + public abstract ItemType ItemType { get; } public override float Weight { get; set; } = 1; diff --git a/KruacentExiled/KE.Items/Items/Defibrilator.cs b/KruacentExiled/KE.Items/Items/Defibrilator.cs index f7fbdb4a..b3c90ba9 100644 --- a/KruacentExiled/KE.Items/Items/Defibrilator.cs +++ b/KruacentExiled/KE.Items/Items/Defibrilator.cs @@ -33,7 +33,6 @@ protected override Dictionary> SetTranslation } public override ItemType ItemType => ItemType.SCP1853; public override string Name { get; set; } = "Defibrillator"; - public override string Description { get; set; } = "Visez un cadavre de près pour tenter une réanimation."; public override float Weight { get; set; } = 1.0f; public UnityEngine.Color Color { get; set; } = UnityEngine.Color.magenta; diff --git a/KruacentExiled/KE.Items/Items/DeployableWall.cs b/KruacentExiled/KE.Items/Items/DeployableWall.cs index 93d1c593..f10aabb0 100644 --- a/KruacentExiled/KE.Items/Items/DeployableWall.cs +++ b/KruacentExiled/KE.Items/Items/DeployableWall.cs @@ -31,7 +31,6 @@ protected override Dictionary> SetTranslation } public override ItemType ItemType => ItemType.KeycardJanitor; public override string Name { get; set; } = "Deployable Wall"; - public override string Description { get; set; } = "Drop to deploy a wall, and throw to just throw the card"; public override float Weight { get; set; } = 0.65f; public Color Color { get; set; } = Color.green; diff --git a/KruacentExiled/KE.Items/Items/DivinePills.cs b/KruacentExiled/KE.Items/Items/DivinePills.cs index 3edbeea0..6f2ee49b 100644 --- a/KruacentExiled/KE.Items/Items/DivinePills.cs +++ b/KruacentExiled/KE.Items/Items/DivinePills.cs @@ -34,9 +34,6 @@ protected override Dictionary> SetTranslation /// public override string Name { get; set; } = "Divine Pills"; - /// - public override string Description { get; set; } = "A"; - /// public override float Weight { get; set; } = 0.65f; public UnityEngine.Color Color { get; set; } = UnityEngine.Color.yellow; diff --git a/KruacentExiled/KE.Items/Items/Drone.cs b/KruacentExiled/KE.Items/Items/Drone.cs index 2c400a70..077d98ec 100644 --- a/KruacentExiled/KE.Items/Items/Drone.cs +++ b/KruacentExiled/KE.Items/Items/Drone.cs @@ -18,7 +18,6 @@ namespace KE.Items.Items public class Drone : KECustomItem { public override string Name { get; set; } = "Drone"; - public override string Description { get; set; } = "Drone de reconnaissance militaire (lancer pour l'utiliser)"; public override float Weight { get; set; } = 3f; public Color Color { get; set; } = Color.blue; public override ItemType ItemType => ItemType.KeycardChaosInsurgency; @@ -44,9 +43,18 @@ protected override Dictionary> SetTranslation Limit = 1, RoomSpawnPoints = new List { - new RoomSpawnPoint() { Chance = 25, Room = RoomType.HczCornerDeep, }, - new RoomSpawnPoint() { Chance = 25, Room = RoomType.HczIncineratorWayside, }, - new RoomSpawnPoint() { Chance = 25, Room = RoomType.LczAirlock, }, + new RoomSpawnPoint() + { + Chance = 25, Room = RoomType.HczCornerDeep, + }, + new RoomSpawnPoint() + { + Chance = 25, Room = RoomType.HczIncineratorWayside, + }, + new RoomSpawnPoint() + { + Chance = 25, Room = RoomType.LczAirlock, + }, }, }; @@ -235,23 +243,33 @@ private void OnDestroy() fpc.Gravity = FpcGravityController.DefaultGravity; } - if (this.npc != null) this.player.Position = this.npc.Position; + if (this.npc != null) + { + this.player.Position = this.npc.Position; + } RestorePlayerInventory(); } if (this.player != null && this.player.Role.Type.IsDead()) { - if (this.npc != null) { + if (this.npc != null) + { this.npc.ClearInventory(false); this.npc.Destroy(); } } else { - if (this.npc != null) this.npc.Destroy(); + if (this.npc != null) + { + this.npc.Destroy(); + } } - if (this.drone != null) this.drone.Destroy(); + if (this.drone != null) + { + this.drone.Destroy(); + } } private IEnumerator DroneUpdate() @@ -326,7 +344,8 @@ private void OnHurting(HurtingEventArgs ev) if (this.npcIsDead) { this.DroneItem.StopDrone(ev.Player); - } else + } + else { ev.IsAllowed = false; this.player.Position = this.npc.Position; @@ -358,10 +377,16 @@ private void SpawnNpc() private void PutPlayerOnDrone() { playerSavedItems.Clear(); - foreach (Item item in this.player.Items) playerSavedItems.Add(item.Type); + foreach (Item item in this.player.Items) + { + playerSavedItems.Add(item.Type); + } playerSavedAmmo.Clear(); - foreach (var ammo in this.player.Ammo) playerSavedAmmo.Add(ammo.Key, ammo.Value); + foreach (var ammo in this.player.Ammo) + { + playerSavedAmmo.Add(ammo.Key, ammo.Value); + } this.player.ClearInventory(true); this.player.Scale = Vector3.one * 0.1f; diff --git a/KruacentExiled/KE.Items/Items/FriendMaker.cs b/KruacentExiled/KE.Items/Items/FriendMaker.cs index 067fd1f7..00307a92 100644 --- a/KruacentExiled/KE.Items/Items/FriendMaker.cs +++ b/KruacentExiled/KE.Items/Items/FriendMaker.cs @@ -38,7 +38,6 @@ protected override Dictionary> SetTranslation public override ItemType ItemType => ItemType.GunCOM15; public override string Name { get; set; } = "FriendMaker"; - public override string Description { get; set; } = ""; public override float Weight { get; set; } = 1f; public override SpawnProperties SpawnProperties { get; set; } = null; diff --git a/KruacentExiled/KE.Items/Items/HealZone.cs b/KruacentExiled/KE.Items/Items/HealZone.cs index 69ade158..5edd8198 100644 --- a/KruacentExiled/KE.Items/Items/HealZone.cs +++ b/KruacentExiled/KE.Items/Items/HealZone.cs @@ -32,7 +32,6 @@ protected override Dictionary> SetTranslation } public override ItemType ItemType => ItemType.GrenadeFlash; public override string Name { get; set; } = "HealZone"; - public override string Description { get; set; } = "Allow to heal you and your ally"; public override float Weight => 0.65f; public override float FuseTime => 5f; public override bool ExplodeOnCollision => true; diff --git a/KruacentExiled/KE.Items/Items/ImpactFlash.cs b/KruacentExiled/KE.Items/Items/ImpactFlash.cs index 45b5554b..f34ef632 100644 --- a/KruacentExiled/KE.Items/Items/ImpactFlash.cs +++ b/KruacentExiled/KE.Items/Items/ImpactFlash.cs @@ -27,7 +27,6 @@ protected override Dictionary> SetTranslation } public override ItemType ItemType => ItemType.GrenadeFlash; public override string Name { get; set; } = "ImpactFlash"; - public override string Description { get; set; } = "The grenade explode at impact"; public override float Weight { get; set; } = 0.65f; public override float FuseTime => 3f; public override bool ExplodeOnCollision => true; diff --git a/KruacentExiled/KE.Items/Items/LeSoleil/LeSoleil.cs b/KruacentExiled/KE.Items/Items/LeSoleil/LeSoleil.cs index 2ba15cde..9f339428 100644 --- a/KruacentExiled/KE.Items/Items/LeSoleil/LeSoleil.cs +++ b/KruacentExiled/KE.Items/Items/LeSoleil/LeSoleil.cs @@ -41,7 +41,6 @@ protected override Dictionary> SetTranslation } public override ItemType ItemType => ItemType.GrenadeFlash; public override string Name { get; set; } = "Le Soleil"; - public override string Description { get; set; } = ""; public override float Weight { get; set; } = 0.65f; public override float FuseTime =>5f; public override bool ExplodeOnCollision =>true; diff --git a/KruacentExiled/KE.Items/Items/LowGravityGrenade.cs b/KruacentExiled/KE.Items/Items/LowGravityGrenade.cs index f9a7be59..c077abe6 100644 --- a/KruacentExiled/KE.Items/Items/LowGravityGrenade.cs +++ b/KruacentExiled/KE.Items/Items/LowGravityGrenade.cs @@ -28,7 +28,6 @@ protected override Dictionary> SetTranslation } public override ItemType ItemType => ItemType.GrenadeHE; public override string Name { get; set; } = "Low Gravity Grenade"; - public override string Description { get; set; } = ""; public override float Weight { get; set; } = 0.65f; public override float FuseTime => 3f; public override bool ExplodeOnCollision => false; diff --git a/KruacentExiled/KE.Items/Items/MScan.cs b/KruacentExiled/KE.Items/Items/MScan.cs index 7ab83208..c6f86358 100644 --- a/KruacentExiled/KE.Items/Items/MScan.cs +++ b/KruacentExiled/KE.Items/Items/MScan.cs @@ -55,7 +55,6 @@ protected override Dictionary> SetTranslation } public override ItemType ItemType => ItemType.Flashlight; public override string Name { get; set; } = "MScan"; - public override string Description { get; set; } = "Détecte les mouvements des personnes passant devant"; public override float Weight { get; set; } = 1.5f; public Color Color { get; set; } = Color.cyan; public override SpawnProperties SpawnProperties { get; set; } = new SpawnProperties() diff --git a/KruacentExiled/KE.Items/Items/Mine.cs b/KruacentExiled/KE.Items/Items/Mine.cs index a9289379..145615d2 100644 --- a/KruacentExiled/KE.Items/Items/Mine.cs +++ b/KruacentExiled/KE.Items/Items/Mine.cs @@ -31,7 +31,6 @@ protected override Dictionary> SetTranslation } public override ItemType ItemType => ItemType.KeycardJanitor; public override string Name { get; set; } = "Mine"; - public override string Description { get; set; } = "Drop to deploy the mine, little advice : don't step on it"; public override float Weight { get; set; } = 0.65f; public Color Color { get; set; } = Color.yellow; public CustomItemEffect Effect { get; set; } diff --git a/KruacentExiled/KE.Items/Items/Molotov.cs b/KruacentExiled/KE.Items/Items/Molotov.cs index 809796c3..643b34e4 100644 --- a/KruacentExiled/KE.Items/Items/Molotov.cs +++ b/KruacentExiled/KE.Items/Items/Molotov.cs @@ -36,7 +36,6 @@ protected override Dictionary> SetTranslation } public override ItemType ItemType => ItemType.GrenadeFlash; public override string Name { get; set; } = "CocktailMolotov"; - public override string Description { get; set; } = ""; public override float Weight { get; set; } = 0.65f; public override float FuseTime => 5f; public override bool ExplodeOnCollision => true; diff --git a/KruacentExiled/KE.Items/Items/PressePuree.cs b/KruacentExiled/KE.Items/Items/PressePuree.cs index d7f5d146..23e13bee 100644 --- a/KruacentExiled/KE.Items/Items/PressePuree.cs +++ b/KruacentExiled/KE.Items/Items/PressePuree.cs @@ -40,7 +40,6 @@ protected override Dictionary> SetTranslation public override string Name { get; set; } = "PressePuree"; public override ItemType ItemType => ItemType.GrenadeHE; - public override string Description { get; set; } = "The grenade explode at impact but does less damage"; public override float Weight { get; set; } = 0.65f; public override float FuseTime => 5f; public override bool ExplodeOnCollision => true; diff --git a/KruacentExiled/KE.Items/Items/ProximityGrenade.cs b/KruacentExiled/KE.Items/Items/ProximityGrenade.cs index d759f4ff..861b966c 100644 --- a/KruacentExiled/KE.Items/Items/ProximityGrenade.cs +++ b/KruacentExiled/KE.Items/Items/ProximityGrenade.cs @@ -31,7 +31,6 @@ protected override Dictionary> SetTranslation public override ItemType ItemType => ItemType.GrenadeFlash; public override string Name { get; set; } = "ProximityGrenade"; - public override string Description { get; set; } = ""; public override float Weight { get; set; } = 0.65f; public override float FuseTime => 3f; public override bool ExplodeOnCollision => false; diff --git a/KruacentExiled/KE.Items/Items/RedbullEnergy.cs b/KruacentExiled/KE.Items/Items/RedbullEnergy.cs index a7271035..ac19cb77 100644 --- a/KruacentExiled/KE.Items/Items/RedbullEnergy.cs +++ b/KruacentExiled/KE.Items/Items/RedbullEnergy.cs @@ -30,7 +30,6 @@ protected override Dictionary> SetTranslation } public override ItemType ItemType => ItemType.SCP207; public override string Name { get; set; } = "RedBullEnergy"; - public override string Description { get; set; } = ""; public override float Weight { get; set; } = 0.65f; public UnityEngine.Color Color { get; set; } = UnityEngine.Color.blue; public CustomItemEffect Effect { get; set; } diff --git a/KruacentExiled/KE.Items/Items/SainteGrenada.cs b/KruacentExiled/KE.Items/Items/SainteGrenada.cs index c50bbe4e..b62495d0 100644 --- a/KruacentExiled/KE.Items/Items/SainteGrenada.cs +++ b/KruacentExiled/KE.Items/Items/SainteGrenada.cs @@ -39,7 +39,6 @@ protected override Dictionary> SetTranslation } public override ItemType ItemType => ItemType.GrenadeHE; public override string Name { get; set; } = "SainteGrenada"; - public override string Description { get; set; } = ""; public override float Weight { get; set; } = 1.5f; public override float FuseTime => 6f; public override bool ExplodeOnCollision => false; diff --git a/KruacentExiled/KE.Items/Items/Scp1650.cs b/KruacentExiled/KE.Items/Items/Scp1650.cs index ad7098e2..7522ad46 100644 --- a/KruacentExiled/KE.Items/Items/Scp1650.cs +++ b/KruacentExiled/KE.Items/Items/Scp1650.cs @@ -32,7 +32,6 @@ protected override Dictionary> SetTranslation public override ItemType ItemType => ItemType.Painkillers; public override string Name { get; set; } = "SCP-1650"; - public override string Description { get; set; } = "ויאמר ה' ל— סח השמן על בשרך ולך בינות ה— כששם אלוהים על שפתיך, וזעם ה' וחרון אפו ו— דם המכבים יטהר בית מקדשו אחריך, לנצח נצחים"; public override float Weight { get; set; } = 0.65f; public CustomItemEffect Effect { get; set; } diff --git a/KruacentExiled/KE.Items/Items/Scp3136.cs b/KruacentExiled/KE.Items/Items/Scp3136.cs index b36f7545..e2f5a35e 100644 --- a/KruacentExiled/KE.Items/Items/Scp3136.cs +++ b/KruacentExiled/KE.Items/Items/Scp3136.cs @@ -33,7 +33,6 @@ protected override Dictionary> SetTranslation } public override ItemType ItemType => ItemType.SCP1576; public override string Name { get; set; } = "SCP-3136"; - public override string Description { get; set; } = "A map of the facility, you could draw your friends next to you"; public override float Weight { get; set; } = 0.65f; private Dictionary _respawnPositions = new Dictionary diff --git a/KruacentExiled/KE.Items/Items/Scp514.cs b/KruacentExiled/KE.Items/Items/Scp514.cs index f1745639..9bc0976f 100644 --- a/KruacentExiled/KE.Items/Items/Scp514.cs +++ b/KruacentExiled/KE.Items/Items/Scp514.cs @@ -38,7 +38,6 @@ protected override Dictionary> SetTranslation } public override ItemType ItemType => ItemType.Flashlight; public override string Name { get; set; } = "SCP-514"; - public override string Description { get; set; } = "birb"; public override float Weight { get; set; } = 0.65f; public float TimeActive { get; set; } = 5; public static float Radius { get; set; } = 5; diff --git a/KruacentExiled/KE.Items/Items/ShieldBelt/ShieldBelt.cs b/KruacentExiled/KE.Items/Items/ShieldBelt/ShieldBelt.cs index 1d73c2db..cbfbae9d 100644 --- a/KruacentExiled/KE.Items/Items/ShieldBelt/ShieldBelt.cs +++ b/KruacentExiled/KE.Items/Items/ShieldBelt/ShieldBelt.cs @@ -27,6 +27,7 @@ namespace KE.Items.Items.ShieldBelt [CustomItem(ItemType.KeycardCustomSite02)] public class ShieldBelt : KECustomKeycard { + public override uint Id { get; set; } = 5982; public override string Name { get; set; } = "Shield belt"; public override string Description { get; set; } = "A projectile-repulsion device.\nIt will attempt to stop incoming projectiles or shrapnel, but does nothing against melee attacks or heat.\nIt prevents the wearer from firing out.\n(works in the inventory) "; diff --git a/KruacentExiled/KE.Items/Items/SmokeGrenade.cs b/KruacentExiled/KE.Items/Items/SmokeGrenade.cs index 53110fe1..e3c228b5 100644 --- a/KruacentExiled/KE.Items/Items/SmokeGrenade.cs +++ b/KruacentExiled/KE.Items/Items/SmokeGrenade.cs @@ -30,7 +30,6 @@ protected override Dictionary> SetTranslation } public override ItemType ItemType => ItemType.GrenadeFlash; public override string Name { get; set; } = "Smoke Grenade"; - public override string Description { get; set; } = ""; public override float Weight { get; set; } = 0.65f; public override float FuseTime => 3f; public override bool ExplodeOnCollision => false; diff --git a/KruacentExiled/KE.Items/Items/TPGrenada.cs b/KruacentExiled/KE.Items/Items/TPGrenada.cs index d8601d8a..bd4264f4 100644 --- a/KruacentExiled/KE.Items/Items/TPGrenada.cs +++ b/KruacentExiled/KE.Items/Items/TPGrenada.cs @@ -33,7 +33,6 @@ protected override Dictionary> SetTranslation } public override ItemType ItemType => ItemType.GrenadeHE; public override string Name { get; set; } = "Teleportation Grenade"; - public override string Description { get; set; } = "This grenade does 0 damage but teleport nearby players in a random place (does work in other dimension ;3 )"; public override float Weight { get; set; } = 0.65f; public override float FuseTime => 3f; public override bool ExplodeOnCollision => false; diff --git a/KruacentExiled/KE.Items/Items/TrueDivinePills.cs b/KruacentExiled/KE.Items/Items/TrueDivinePills.cs index 7ea70e55..f98ac2fa 100644 --- a/KruacentExiled/KE.Items/Items/TrueDivinePills.cs +++ b/KruacentExiled/KE.Items/Items/TrueDivinePills.cs @@ -38,7 +38,6 @@ protected override Dictionary> SetTranslation public override string Name { get; set; } = "TrueDivinePills"; /// - public override string Description { get; set; } = "Guaranteed to respawn everybody"; /// public override float Weight { get; set; } = 0.65f; From 5b18c76cb6f3095f110823ea8a6528e8e84785e3 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Wed, 18 Mar 2026 19:32:32 +0100 Subject: [PATCH 770/853] more translations --- KruacentExiled/KE.Items/Items/FriendMaker.cs | 31 +++++++++++++++---- KruacentExiled/KE.Items/Items/Molotov.cs | 2 +- .../KE.Items/Items/RedbullEnergy.cs | 2 +- 3 files changed, 27 insertions(+), 8 deletions(-) diff --git a/KruacentExiled/KE.Items/Items/FriendMaker.cs b/KruacentExiled/KE.Items/Items/FriendMaker.cs index 00307a92..4e011a63 100644 --- a/KruacentExiled/KE.Items/Items/FriendMaker.cs +++ b/KruacentExiled/KE.Items/Items/FriendMaker.cs @@ -2,6 +2,7 @@ using Exiled.API.Features.Attributes; using Exiled.API.Features.Spawn; using Exiled.Events.EventArgs.Player; +using Hints; using HintServiceMeow.UI.Utilities; using KE.Items.API.Features; using KE.Utils.API.Features; @@ -19,6 +20,12 @@ namespace KE.Items.Items public class FriendMaker : KECustomWeapon { + + public const string TranslationCooldown = "FriendMakerCooldown"; + public const string TranslationNobody = "FriendMakerNobody"; + public const string TranslationSameTeam = "FriendMakerSameTeam"; + public const string TranslationNonZombie = "FriendMakerNonZombie"; + public const string TranslationSuccess = "FriendMakerSuccess"; protected override Dictionary> SetTranslation() { return new() @@ -27,11 +34,21 @@ protected override Dictionary> SetTranslation { [TranslationKeyName] = "Friend Maker™", [TranslationKeyDesc] = "The number one (1) method to make friends", + [TranslationCooldown] = "You must wait %second% seconds before using it again", + [TranslationNobody] = "But nobody came", + [TranslationSameTeam] = "I know you don't like them but they're in your team", + [TranslationNonZombie] = "That ain't a zombie", + [TranslationSuccess] = "New friend acquired!", }, ["fr"] = new() { [TranslationKeyName] = "Friend Maker™", [TranslationKeyDesc] = "LA méthode pour se faire des amis ! Produit non remboursable", + [TranslationCooldown] = "Tu dois attendre %second% secondes avant de pouvoir l'utiliser à nouveau", + [TranslationNobody] = "Mais personne n'est venu", + [TranslationSameTeam] = "Je sais que tu l'aime pas mais il est bien avec toi", + [TranslationNonZombie] = "C'est pas un zombie ça", + [TranslationSuccess] = "Nouvel ami obtenu!", }, }; } @@ -70,7 +87,10 @@ protected override void OnShooting(ShootingEventArgs ev) if (!CheckCooldown(player)) { DateTime dateTime = cooldowns[player] + Cooldown; - KECustomItem.ItemEffectHint(player, "You must wait " + Math.Round((dateTime - DateTime.Now).TotalSeconds) + " seconds before using it again"); + + + string msg = GetTranslation(player, TranslationCooldown).Replace("%second%", Math.Round((dateTime - DateTime.Now).TotalSeconds).ToString()); + KECustomItem.ItemEffectHint(player, msg); ev.IsAllowed = false; } @@ -117,20 +137,20 @@ private bool Convert(Player player,Player attacker) { if (player == null) { - KECustomItem.ItemEffectHint(attacker, "But nobody's here"); + TranslationHint(attacker, TranslationNobody); return false; } if (attacker.Role.Side == player.Role.Side) { - KECustomItem.ItemEffectHint(attacker, "I know you don't like them but they're in your team"); + TranslationHint(attacker, TranslationSameTeam); return false; } if (player.IsScp && player.Role != RoleTypeId.Scp0492) { - KECustomItem.ItemEffectHint(attacker, "That ain't a zombie"); + TranslationHint(attacker, TranslationNonZombie); return false; } @@ -142,8 +162,7 @@ private bool Convert(Player player,Player attacker) { player.Role.Set(attacker.Role, RoleSpawnFlags.None); } - - KECustomItem.ItemEffectHint(attacker, "New friend acquired!"); + TranslationHint(attacker, TranslationSuccess); return true; } diff --git a/KruacentExiled/KE.Items/Items/Molotov.cs b/KruacentExiled/KE.Items/Items/Molotov.cs index 643b34e4..b853b954 100644 --- a/KruacentExiled/KE.Items/Items/Molotov.cs +++ b/KruacentExiled/KE.Items/Items/Molotov.cs @@ -30,7 +30,7 @@ protected override Dictionary> SetTranslation ["fr"] = new() { [TranslationKeyName] = "Cocktail Molotov", - [TranslationKeyDesc] = "La meilleur arme contre un blindé", + [TranslationKeyDesc] = "La meilleure arme contre un blindé", }, }; } diff --git a/KruacentExiled/KE.Items/Items/RedbullEnergy.cs b/KruacentExiled/KE.Items/Items/RedbullEnergy.cs index ac19cb77..b22a6f22 100644 --- a/KruacentExiled/KE.Items/Items/RedbullEnergy.cs +++ b/KruacentExiled/KE.Items/Items/RedbullEnergy.cs @@ -19,7 +19,7 @@ protected override Dictionary> SetTranslation ["en"] = new() { [TranslationKeyName] = "RedBull™ Energy", - [TranslationKeyDesc] = "RedBull™ donne des ailes ! Attention à la chute !!!", + [TranslationKeyDesc] = "RedBull™ gives you wings!", }, ["fr"] = new() { From 5d414d0dbbd80facf4c35ac38df93c0f72288e96 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Thu, 19 Mar 2026 14:11:57 +0100 Subject: [PATCH 771/853] smoother and fix exception when destroying --- .../ElevatorGateA/CustomElevatorComp.cs | 2 +- .../ElevatorGateA/CustomElevatorGateA.cs | 19 ++++++++++++------- 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/KruacentExiled/KE.Map/Surface/ElevatorGateA/CustomElevatorComp.cs b/KruacentExiled/KE.Map/Surface/ElevatorGateA/CustomElevatorComp.cs index f9a5ed60..fe403036 100644 --- a/KruacentExiled/KE.Map/Surface/ElevatorGateA/CustomElevatorComp.cs +++ b/KruacentExiled/KE.Map/Surface/ElevatorGateA/CustomElevatorComp.cs @@ -61,7 +61,7 @@ private void ChangeAllPanel(Color color) } private Vector3 startPos; private Vector3 endPos; - private float sendInterval = 1f / 20f; + private float sendInterval = 1f / 240f; private float sendTimer = 0f; public void Update() { diff --git a/KruacentExiled/KE.Map/Surface/ElevatorGateA/CustomElevatorGateA.cs b/KruacentExiled/KE.Map/Surface/ElevatorGateA/CustomElevatorGateA.cs index d6aeff02..e71f439f 100644 --- a/KruacentExiled/KE.Map/Surface/ElevatorGateA/CustomElevatorGateA.cs +++ b/KruacentExiled/KE.Map/Surface/ElevatorGateA/CustomElevatorGateA.cs @@ -114,24 +114,24 @@ private static void SendingElevator() public static void Destroy() { - if(prim != null) + if(CheckPrimitive(prim)) { model.SendingElevator -= SendingElevator; model.Destroy(prim.Transform); prim = null; } - if(step != null) + if(CheckPrimitive(step)) { step.Destroy(); step = null; } - if (help != null) + if (CheckPrimitive(help)) { help.Destroy(); help = null; } - if (helpPlatform != null) + if (CheckPrimitive(helpPlatform)) { helpPlatform.Destroy(); helpPlatform = null; @@ -139,7 +139,7 @@ public static void Destroy() - if (primbottom != null) + if (CheckPrimitive(primbottom)) { bottompanel.SendingElevator -= SendingElevator; @@ -147,15 +147,20 @@ public static void Destroy() primbottom = null; } - if(primtop != null) + if(CheckPrimitive(primtop)) { toppanel.SendingElevator -= SendingElevator; toppanel.Destroy(primtop.Transform); - + primtop = null; } } + private static bool CheckPrimitive(Primitive primitive) + { + return primitive != null && primitive.Base != null && primitive.GameObject != null; + } + public static void Send() { if (prim == null) return; From 34b45323ee9103171f7988305e1d57d35b81d77e Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Thu, 19 Mar 2026 14:15:38 +0100 Subject: [PATCH 772/853] remove arrow when losing ability --- .../KE.CustomRoles/Abilities/SetPosition.cs | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/KruacentExiled/KE.CustomRoles/Abilities/SetPosition.cs b/KruacentExiled/KE.CustomRoles/Abilities/SetPosition.cs index 574b6096..430b46dc 100644 --- a/KruacentExiled/KE.CustomRoles/Abilities/SetPosition.cs +++ b/KruacentExiled/KE.CustomRoles/Abilities/SetPosition.cs @@ -43,10 +43,7 @@ protected override bool AbilityUsed(Player player) SelectedTarget[player] = position; - if (SelectedTextToys.ContainsKey(player)) - { - SelectedTextToys[player].Destroy(); - } + TryDestroyFollowingTextToy(player); @@ -64,6 +61,20 @@ protected override bool AbilityUsed(Player player) return base.AbilityUsed(player); } + private void TryDestroyFollowingTextToy(Player player) + { + if (SelectedTextToys.ContainsKey(player)) + { + SelectedTextToys[player].Destroy(); + } + } + + protected override void AbilityRemoved(Player player) + { + SelectedTarget.Remove(player); + TryDestroyFollowingTextToy(player); + base.AbilityRemoved(player); + } public static bool TryGetTarget(Player p, out Vector3 target) { From d73fdba9bc1ab4341bf497f696d624007ab7ee47 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Thu, 19 Mar 2026 17:47:15 +0100 Subject: [PATCH 773/853] empty ability+ other stuff --- .../API/Features/Abilities/EmptyAbility.cs | 25 ++++++++ .../API/Features/KEAbilities.cs | 52 ++++++++++++++--- .../API/Features/KECustomRole.cs | 2 +- .../API/HintPositions/AbilitiesPosition.cs | 10 ++-- .../Interfaces/Ability/IDynamicDescription.cs | 17 ++++++ .../API/Interfaces/Ability/IDynamicName.cs | 15 +++++ .../KE.CustomRoles/Abilities/Airstrike.cs | 56 +++++++++++++----- .../NumberCheckpointEmptyAbility.cs | 58 +++++++++++++++++++ .../KE.CustomRoles/Abilities/SetPosition.cs | 4 ++ .../KE.CustomRoles/Abilities/Teleportation.cs | 4 +- .../CR/Scientist/ZoneManager.cs | 37 +++++++++--- .../KE.CustomRoles/Settings/SettingHandler.cs | 34 ++++------- 12 files changed, 250 insertions(+), 64 deletions(-) create mode 100644 KruacentExiled/KE.CustomRoles/API/Features/Abilities/EmptyAbility.cs create mode 100644 KruacentExiled/KE.CustomRoles/API/Interfaces/Ability/IDynamicDescription.cs create mode 100644 KruacentExiled/KE.CustomRoles/API/Interfaces/Ability/IDynamicName.cs create mode 100644 KruacentExiled/KE.CustomRoles/Abilities/EmptyAbilities/NumberCheckpointEmptyAbility.cs diff --git a/KruacentExiled/KE.CustomRoles/API/Features/Abilities/EmptyAbility.cs b/KruacentExiled/KE.CustomRoles/API/Features/Abilities/EmptyAbility.cs new file mode 100644 index 00000000..e1a7f84d --- /dev/null +++ b/KruacentExiled/KE.CustomRoles/API/Features/Abilities/EmptyAbility.cs @@ -0,0 +1,25 @@ +using Exiled.API.Features; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace KE.CustomRoles.API.Features.Abilities +{ + /// + /// an ability used to show text + /// + public abstract class EmptyAbility : KEAbilities + { + + public sealed override float Cooldown => 1; + protected override void GuiReady(StringBuilder sb, Player player) + { + + } + + + + } +} diff --git a/KruacentExiled/KE.CustomRoles/API/Features/KEAbilities.cs b/KruacentExiled/KE.CustomRoles/API/Features/KEAbilities.cs index 9bcd36dc..c7469f79 100644 --- a/KruacentExiled/KE.CustomRoles/API/Features/KEAbilities.cs +++ b/KruacentExiled/KE.CustomRoles/API/Features/KEAbilities.cs @@ -187,13 +187,27 @@ public void ShowAbility(Player player) StringBuilder sb = StringBuilderPool.Pool.Get(); sb.Append(""); - sb.Append(GetTranslation(player, TranslationKeyName)); - sb.Append(""); - sb.AppendLine(); - sb.Append(GetTranslation(player, TranslationKeyDesc)); - + if(this is IDynamicName dynamicName) + { + dynamicName.GetName(sb, player); + } + else + { + sb.Append(GetTranslation(player, TranslationKeyName)); + } + sb.AppendLine(""); + + + if(this is IDynamicDescription dynamicDescription) + { + dynamicDescription.GetDescription(sb, player); + } + else + { + sb.Append(GetTranslation(player, TranslationKeyDesc)); + } DisplayHandler.Instance.AddHint(MainPlugin.AbilitiesDesc, player, sb.ToString(), time); StringBuilderPool.Pool.Return(sb); @@ -375,6 +389,17 @@ public static void SelectFirstAbility(Player player,bool hide = false) } + public static void Remove(string name,Player player) + { + KEAbilities abilities = Get(name); + + if(abilities != null) + { + abilities.RemoveAbility(player); + } + + } + public static void TryRemoveFromPlayer(Player player) { RemoveAllSelect(player); @@ -487,8 +512,8 @@ public static KEAbilities Get(string name) return kEAbilities; } } - - return null; + + return null; } public static bool TryGet(string name, out KEAbilities ability) @@ -524,7 +549,7 @@ public static bool TryGetSelected(Player player, out KEAbilities ability) - protected void GuiReady(StringBuilder sb, Player player) + protected virtual void GuiReady(StringBuilder sb, Player player) { if (CanUse(player, out var output)) @@ -557,7 +582,16 @@ protected void GuiArrow(StringBuilder sb, Player player) protected void GuiAbilityName(StringBuilder sb, Player player) { - sb.Append(GetTranslation(player, TranslationKeyName)); + if(this is IDynamicName dynamic) + { + dynamic.GetName(sb, player); + } + else + { + sb.Append(GetTranslation(player, TranslationKeyName)); + } + + sb.Append(" "); } diff --git a/KruacentExiled/KE.CustomRoles/API/Features/KECustomRole.cs b/KruacentExiled/KE.CustomRoles/API/Features/KECustomRole.cs index ca9b14af..fb61c997 100644 --- a/KruacentExiled/KE.CustomRoles/API/Features/KECustomRole.cs +++ b/KruacentExiled/KE.CustomRoles/API/Features/KECustomRole.cs @@ -552,7 +552,7 @@ protected virtual void SetAbilities(Player player) { if(!KEAbilities.TryAddToPlayer(name, player)) { - Log.Error("couldn't find ability :" + name); + Log.Error("couldn't find ability : " + name); } } diff --git a/KruacentExiled/KE.CustomRoles/API/HintPositions/AbilitiesPosition.cs b/KruacentExiled/KE.CustomRoles/API/HintPositions/AbilitiesPosition.cs index 1724e5c6..d92c4e9a 100644 --- a/KruacentExiled/KE.CustomRoles/API/HintPositions/AbilitiesPosition.cs +++ b/KruacentExiled/KE.CustomRoles/API/HintPositions/AbilitiesPosition.cs @@ -1,4 +1,5 @@ -using Exiled.API.Features; +using Exiled.API.Enums; +using Exiled.API.Features; using HintServiceMeow.Core.Enum; using KE.CustomRoles.API.Features; using KE.Utils.API.Displays.DisplayMeow.Placements; @@ -14,7 +15,7 @@ public class AbilitiesPosition : HintPosition { - public const float BaseYPosition = 800; + public const float BaseYPosition = 900; public const float Increments = -50; private float yposition = BaseYPosition; public override float Xposition => -300; @@ -26,20 +27,19 @@ public class AbilitiesPosition : HintPosition private static List nonalloc = new(KEAbilities.InitialAbilitySlot); - + public static AbilitiesPosition GetIndex(int index) { if (!nonalloc.TryGet(index, out AbilitiesPosition position)) { position = new AbilitiesPosition() { - yposition = BaseYPosition + index * 50, + yposition = BaseYPosition - index * 50, index = index }; } Log.Debug($"get index {index} y pos=" + position.Yposition); return position; - } public override HintAlignment HintAlignment => HintAlignment.Left; diff --git a/KruacentExiled/KE.CustomRoles/API/Interfaces/Ability/IDynamicDescription.cs b/KruacentExiled/KE.CustomRoles/API/Interfaces/Ability/IDynamicDescription.cs new file mode 100644 index 00000000..8914727f --- /dev/null +++ b/KruacentExiled/KE.CustomRoles/API/Interfaces/Ability/IDynamicDescription.cs @@ -0,0 +1,17 @@ +using Exiled.API.Features; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace KE.CustomRoles.API.Interfaces.Ability +{ + public interface IDynamicDescription + { + + + void GetDescription(StringBuilder sb, Player player); + + } +} diff --git a/KruacentExiled/KE.CustomRoles/API/Interfaces/Ability/IDynamicName.cs b/KruacentExiled/KE.CustomRoles/API/Interfaces/Ability/IDynamicName.cs new file mode 100644 index 00000000..1b4c31df --- /dev/null +++ b/KruacentExiled/KE.CustomRoles/API/Interfaces/Ability/IDynamicName.cs @@ -0,0 +1,15 @@ +using Exiled.API.Features; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace KE.CustomRoles.API.Interfaces.Ability +{ + public interface IDynamicName + { + + void GetName(StringBuilder sb, Player player); + } +} diff --git a/KruacentExiled/KE.CustomRoles/Abilities/Airstrike.cs b/KruacentExiled/KE.CustomRoles/Abilities/Airstrike.cs index b5e9cc2a..751e4259 100644 --- a/KruacentExiled/KE.CustomRoles/Abilities/Airstrike.cs +++ b/KruacentExiled/KE.CustomRoles/Abilities/Airstrike.cs @@ -1,4 +1,5 @@ -using Exiled.API.Features; +using Exiled.API.Extensions; +using Exiled.API.Features; using Exiled.API.Features.Attributes; using Exiled.API.Features.Items; using Exiled.API.Features.Pickups.Projectiles; @@ -6,6 +7,7 @@ using Exiled.CustomRoles.API.Features; using KE.CustomRoles.API.Features; using KE.CustomRoles.API.Interfaces; +using KE.CustomRoles.API.Interfaces.Ability; using MapGeneration; using MEC; using System; @@ -18,10 +20,11 @@ namespace KE.CustomRoles.Abilities { - public class Airstrike : KEAbilities, ICustomIcon + public class Airstrike : KEAbilities, ICustomIcon, IConditional { - public override string Name { get; } = "AirStrike"; + public override string Name { get; } = "AirStrike"; + public const string TranslationSomethingHere = "AirStrikeSomethingHere"; protected override Dictionary> SetTranslation() { return new() @@ -30,11 +33,13 @@ protected override Dictionary> SetTranslation { [TranslationKeyName] = "Airstrike", [TranslationKeyDesc] = "Don't overuse it or your co-op will not be happy", + [TranslationSomethingHere] = "Something is in the way", }, ["fr"] = new() { [TranslationKeyName] = "Bombardement", [TranslationKeyDesc] = "Ne l'utilise pas trop sinon ton coop sera pas content", + [TranslationSomethingHere] = "Quelque chose gêne", } }; } @@ -46,22 +51,14 @@ protected override Dictionary> SetTranslation protected override bool AbilityUsed(Player player) { - if (!SetPosition.TryGetTarget(player, out Vector3 target)) - { - ShowEffectHint(player, "TeleportationNoTarget"); - return false; - } - - Physics.Linecast(target, target + height * Vector3.up, out RaycastHit hit); - if (hit.collider != null) + if (CheckValid(player, true)) { - Log.Debug($"hit something [{hit.collider}]"); return false; } - - var l = Light.Create(target,null,null,true,Color.red); + SetPosition.TryGetTarget(player, out Vector3 target); + var l = Light.Create(target, null, null, true, Color.red); - ExplosiveGrenade grenade = (ExplosiveGrenade)Item.Create(ItemType.GrenadeHE,player); + ExplosiveGrenade grenade = (ExplosiveGrenade)Item.Create(ItemType.GrenadeHE, player); grenade.ScpDamageMultiplier = 1; grenade.FuseTime = 10; Timing.CallDelayed(1.5f, () => @@ -76,5 +73,34 @@ protected override bool AbilityUsed(Player player) } + + private bool CheckValid(Player player, bool showMessage) + { + if (!SetPosition.TryGetTarget(player, out Vector3 target)) + { + if (showMessage) + { + ShowEffectHint(player, SetPosition.TranslationNoTarget); + } + return false; + } + + Physics.Linecast(target, target + height * Vector3.up, out RaycastHit hit); + if (hit.collider != null) + { + if (showMessage) + { + ShowEffectHint(player, TranslationSomethingHere); + } + return false; + } + + return true; + } + + public bool CheckCondition(Player player) + { + return CheckValid(player, false); + } } } diff --git a/KruacentExiled/KE.CustomRoles/Abilities/EmptyAbilities/NumberCheckpointEmptyAbility.cs b/KruacentExiled/KE.CustomRoles/Abilities/EmptyAbilities/NumberCheckpointEmptyAbility.cs new file mode 100644 index 00000000..5c07dc4c --- /dev/null +++ b/KruacentExiled/KE.CustomRoles/Abilities/EmptyAbilities/NumberCheckpointEmptyAbility.cs @@ -0,0 +1,58 @@ +using Exiled.API.Features; +using KE.CustomRoles.API.Features.Abilities; +using KE.CustomRoles.API.Interfaces.Ability; +using KE.CustomRoles.CR.Scientist; +using KE.Utils.API.Features; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace KE.CustomRoles.Abilities.EmptyAbilities +{ + public class NumberCheckpointEmptyAbility : EmptyAbility, IDynamicName + { + public override string Name { get; } = "NumberCheckpoints"; + + protected override Dictionary> SetTranslation() + { + return new() + { + ["en"] = new() + { + [TranslationKeyName] = "Remaining Checkpoint%S% : %remain%/%total%", + [TranslationKeyDesc] = "", + }, + ["fr"] = new() + { + [TranslationKeyName] = "Checkpoint%S% restant : %remain%/%total% ", + [TranslationKeyDesc] = "", + } + }; + } + + public void GetName(StringBuilder sb, Player player) + { + int remaining = ZoneManager.GetNumberCheckpoints(player); + int total = ZoneManager.DoorToOpen.Count; + KELog.Debug("remainig"+remaining); + + if(remaining > 0) + { + string n = GetTranslation(player, TranslationKeyName).Replace("%remain%", remaining.ToString()).Replace("%total%", total.ToString()); + if(remaining > 1) + { + n = n.Replace("%S%", "s"); + } + else + { + n = n.Replace("%S%", string.Empty); + } + + sb.Append(n); + } + } + + } +} diff --git a/KruacentExiled/KE.CustomRoles/Abilities/SetPosition.cs b/KruacentExiled/KE.CustomRoles/Abilities/SetPosition.cs index 430b46dc..9b5f8453 100644 --- a/KruacentExiled/KE.CustomRoles/Abilities/SetPosition.cs +++ b/KruacentExiled/KE.CustomRoles/Abilities/SetPosition.cs @@ -10,6 +10,8 @@ namespace KE.CustomRoles.Abilities public class SetPosition : KEAbilities, ICustomIcon { public override string Name { get; } = "SetPosition"; + + public const string TranslationNoTarget = "SetPositionNoTarget"; protected override Dictionary> SetTranslation() { return new() @@ -18,11 +20,13 @@ protected override Dictionary> SetTranslation { [TranslationKeyName] = "Set Position", [TranslationKeyDesc] = "Select the current position for another ability", + [TranslationNoTarget] = "No target set", }, ["fr"] = new() { [TranslationKeyName] = "Selection de position", [TranslationKeyDesc] = "Selectionne la position pour une autre abilité", + [TranslationNoTarget] = "Pas de position mise", } }; } diff --git a/KruacentExiled/KE.CustomRoles/Abilities/Teleportation.cs b/KruacentExiled/KE.CustomRoles/Abilities/Teleportation.cs index 28523b4e..19b5dfa2 100644 --- a/KruacentExiled/KE.CustomRoles/Abilities/Teleportation.cs +++ b/KruacentExiled/KE.CustomRoles/Abilities/Teleportation.cs @@ -22,7 +22,6 @@ protected override Dictionary> SetTranslation { [TranslationKeyName] = "Teleportation", [TranslationKeyDesc] = $"You lose {Damage} HP per teleportation, can't be used in lifts", - ["TeleportationNoTarget"] = "No target selected", ["TeleportationLift"] = "can't teleport in lifts", ["TeleportationLcz"] = "The target is inaccessible", ["TeleportationDifferentZone"] = "The target is inaccessible", @@ -31,7 +30,6 @@ protected override Dictionary> SetTranslation { [TranslationKeyName] = "Téléportation", [TranslationKeyDesc] = $"Tu perds {Damage} HP/téléportation, ne peux pas être utilisé dans les ascenseurs", - ["TeleportationNoTarget"] = "Pas de position mise", ["TeleportationLift"] = "Impossible de se téléporter dans un ascenseur", ["TeleportationLcz"] = "Position inaccessible", ["TeleportationDifferentZone"] = "Position inaccessible", @@ -75,7 +73,7 @@ private bool CheckValid(Player player,bool showMessage) { if (showMessage) { - ShowEffectHint(player, "TeleportationNoTarget"); + ShowEffectHint(player, SetPosition.TranslationNoTarget); } return false; diff --git a/KruacentExiled/KE.CustomRoles/CR/Scientist/ZoneManager.cs b/KruacentExiled/KE.CustomRoles/CR/Scientist/ZoneManager.cs index bd3ef6f6..d397174a 100644 --- a/KruacentExiled/KE.CustomRoles/CR/Scientist/ZoneManager.cs +++ b/KruacentExiled/KE.CustomRoles/CR/Scientist/ZoneManager.cs @@ -58,19 +58,25 @@ protected override Dictionary> SetTranslation } }; + + public override HashSet Abilities { get; } = + [ + "NumberCheckpoints" + ]; + public override List Inventory { get; set; } = new List() { $"{ItemType.Medkit}", $"{ItemType.Adrenaline}", $"{ItemType.KeycardZoneManager}" }; - public static readonly List DoorToOpen = new() + public static readonly IReadOnlyCollection DoorToOpen = new List() { DoorType.CheckpointLczA, DoorType.CheckpointLczB, DoorType.CheckpointEzHczA, DoorType.CheckpointEzHczB - }; + }.AsReadOnly(); private static Dictionary> objectives = new(); @@ -101,6 +107,16 @@ protected override void RoleRemoved(Player player) } + public static int GetNumberCheckpoints(Player player) + { + if (!objectives.ContainsKey(player)) + { + return -1; + } + + return objectives[player].Count; + } + private void OnInteractingDoor(InteractingDoorEventArgs ev) { Player player = ev.Player; @@ -109,14 +125,21 @@ private void OnInteractingDoor(InteractingDoorEventArgs ev) if (CheckDoors(player)) { - bool equipped = player.CurrentItem.Type == ItemType.KeycardFacilityManager; - Item zoneKeycard = player.Items.Where(p => p.Type == ItemType.KeycardFacilityManager).ElementAtOrDefault(0); - if (zoneKeycard != null) + KEAbilities.Remove("NumberCheckpoints", player); + bool equipped; + + if(player.CurrentItem != null) { - zoneKeycard.Destroy(); + equipped = player.CurrentItem.Type == ItemType.KeycardZoneManager; } + else + { + equipped = false; + } + + Item zoneKeycard = player.Items.Where(p => p.Type == ItemType.KeycardZoneManager).ElementAtOrDefault(0); + zoneKeycard?.Destroy(); - player.AddItem(ItemType.Radio); flag[player] = true; Item engineerKeycard = player.AddItem(ItemType.KeycardFacilityManager); if (equipped) diff --git a/KruacentExiled/KE.CustomRoles/Settings/SettingHandler.cs b/KruacentExiled/KE.CustomRoles/Settings/SettingHandler.cs index 73875324..0161c90c 100644 --- a/KruacentExiled/KE.CustomRoles/Settings/SettingHandler.cs +++ b/KruacentExiled/KE.CustomRoles/Settings/SettingHandler.cs @@ -181,26 +181,7 @@ private void OnSettingValueReceived(Player player, ServerSpecificSettingBase set private void Up(Player player) { - if(KEAbilities.PlayersAbility.TryGetValue(player,out var list)) - { - if (list.Count == 0) - { - return; - } - if (!playerPos.ContainsKey(player)) - { - playerPos.Add(player, 0); - } - - int index = mod((playerPos[player] - 1),list.Count); - Log.Debug("up "+ index); - KEAbilities ability = list[index]; - playerPos[player] += -1; - - - ability?.SelectAbility(player); - KEAbilities.UpdateGUI(player); - } + Move(player, +1); } private int mod(int x, int m) @@ -209,10 +190,15 @@ private int mod(int x, int m) } private void Down(Player player) + { + Move(player, -1); + } + + private void Move(Player player, int movement) { if (KEAbilities.PlayersAbility.TryGetValue(player, out var list)) { - if(list.Count == 0) + if (list.Count == 0) { return; } @@ -221,12 +207,12 @@ private void Down(Player player) { playerPos.Add(player, 0); } - - int index = mod((playerPos[player] + 1), list.Count); + + int index = mod((playerPos[player] + movement), list.Count); Log.Debug("down " + index); KEAbilities ability = list[index]; - playerPos[player] += 1; + playerPos[player] += movement; ability?.SelectAbility(player); KEAbilities.UpdateGUI(player); } From 7885ff8ed4225da9aabd522b5f5936c3817dcd4f Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Thu, 19 Mar 2026 20:14:36 +0100 Subject: [PATCH 774/853] added hint feed to mscan --- .../KE.Items/API/Features/KECustomItem.cs | 2 +- .../KE.Items/Commands/ForceAddFeed.cs | 50 ++++++++ .../KE.Items/Commands/KECustomItems.cs | 2 +- .../Items/ItemEffects/DeployableWallEffect.cs | 2 +- KruacentExiled/KE.Items/Items/MScan.cs | 53 +++++--- .../KE.Items/Items/Models/MScanModel.cs | 113 ++++++++++++++++++ .../KE.Items/Items/SainteGrenada.cs | 2 +- KruacentExiled/KE.Items/MainPlugin.cs | 2 +- KruacentExiled/KE.Items/Utils/Feed.cs | 20 ++++ KruacentExiled/KE.Items/Utils/HintFeed.cs | 92 ++++++++++++++ .../KE.Items/Utils/HintFeedPosition.cs | 45 +++++++ 11 files changed, 364 insertions(+), 19 deletions(-) create mode 100644 KruacentExiled/KE.Items/Commands/ForceAddFeed.cs create mode 100644 KruacentExiled/KE.Items/Items/Models/MScanModel.cs create mode 100644 KruacentExiled/KE.Items/Utils/Feed.cs create mode 100644 KruacentExiled/KE.Items/Utils/HintFeed.cs create mode 100644 KruacentExiled/KE.Items/Utils/HintFeedPosition.cs diff --git a/KruacentExiled/KE.Items/API/Features/KECustomItem.cs b/KruacentExiled/KE.Items/API/Features/KECustomItem.cs index 88177e59..d7a71c57 100644 --- a/KruacentExiled/KE.Items/API/Features/KECustomItem.cs +++ b/KruacentExiled/KE.Items/API/Features/KECustomItem.cs @@ -331,7 +331,7 @@ protected sealed override void OnDropping(DroppingItemEventArgs ev) #pragma warning restore CS0672 public static void RegisterItems(Assembly assembly = null) { - IEnumerable items = Utils.API.ReflectionHelper.GetObjects(assembly); + IEnumerable items = KE.Utils.API.ReflectionHelper.GetObjects(assembly); foreach(KECustomItem customItem in items) { diff --git a/KruacentExiled/KE.Items/Commands/ForceAddFeed.cs b/KruacentExiled/KE.Items/Commands/ForceAddFeed.cs new file mode 100644 index 00000000..ace602b5 --- /dev/null +++ b/KruacentExiled/KE.Items/Commands/ForceAddFeed.cs @@ -0,0 +1,50 @@ +using CommandSystem; +using Exiled.API.Features; +using KE.Items.Utils; +using MEC; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace KE.Items.Commands +{ + [CommandHandler(typeof(RemoteAdminCommandHandler))] + internal class ForceAddFeed : KE.Utils.API.Commands.KECommand + { + public override string Command => "forceaddfeed"; + + public override string[] Aliases => []; + + public override string Description => "add a feed"; + + public override string[] Usage => []; + + public override bool ExecuteCommand(ArraySegment arguments, ICommandSender sender, out string response) + { + Player player = Player.Get(sender); + if(player == null) + { + + response = "no"; + return false; + } + + + + HintFeed hintfeed = HintFeed.GetOrCreate(player); + + + HintFeed.AddFeed(player, "test1"); + + Timing.CallDelayed(1, () => HintFeed.AddFeed(player, "test2")); + Timing.CallDelayed(2, () => HintFeed.AddFeed(player, "test3")); + response = "ok"; + return true; + } + + + } + +} \ No newline at end of file diff --git a/KruacentExiled/KE.Items/Commands/KECustomItems.cs b/KruacentExiled/KE.Items/Commands/KECustomItems.cs index f46e35d1..51c50584 100644 --- a/KruacentExiled/KE.Items/Commands/KECustomItems.cs +++ b/KruacentExiled/KE.Items/Commands/KECustomItems.cs @@ -5,7 +5,7 @@ namespace KE.Items.Commands { [CommandHandler(typeof(RemoteAdminCommandHandler))] - internal class KECustomItems : Utils.API.Commands.KEParentCommand + internal class KECustomItems : KE.Utils.API.Commands.KEParentCommand { public override string Command => "keci"; diff --git a/KruacentExiled/KE.Items/Items/ItemEffects/DeployableWallEffect.cs b/KruacentExiled/KE.Items/Items/ItemEffects/DeployableWallEffect.cs index e609442e..320aee3d 100644 --- a/KruacentExiled/KE.Items/Items/ItemEffects/DeployableWallEffect.cs +++ b/KruacentExiled/KE.Items/Items/ItemEffects/DeployableWallEffect.cs @@ -36,7 +36,7 @@ private void SpawnWall(Vector3 pos, Quaternion rotation) Primitive wall = Primitive.Create(PrimitiveType.Cube, spawnPos, rotat, new Vector3(4, 4, 0.2f), true); - Utils.API.Sounds.SoundPlayer.Instance.Play("lego", wall.GameObject, 10f, 40); + KE.Utils.API.Sounds.SoundPlayer.Instance.Play("lego", wall.GameObject, 10f, 40); wall.Collidable = true; wall.Visible = true; Timing.CallDelayed(10, () => diff --git a/KruacentExiled/KE.Items/Items/MScan.cs b/KruacentExiled/KE.Items/Items/MScan.cs index c6f86358..a752e4e4 100644 --- a/KruacentExiled/KE.Items/Items/MScan.cs +++ b/KruacentExiled/KE.Items/Items/MScan.cs @@ -1,16 +1,21 @@ -using Exiled.API.Enums; +using AdminToys; +using Exiled.API.Enums; using Exiled.API.Features; using Exiled.API.Features.Attributes; using Exiled.API.Features.Pickups; using Exiled.API.Features.Pools; using Exiled.API.Features.Spawn; +using Exiled.API.Features.Toys; +using Exiled.API.Structs; using Exiled.CustomItems.API.Features; +using Exiled.CustomRoles.Commands; using Exiled.Events.EventArgs.Player; using Exiled.Events.EventArgs.Scp049; using Exiled.Events.EventArgs.Scp096; using Exiled.Events.EventArgs.Scp106; using Exiled.Events.EventArgs.Scp939; using KE.Items.API.Features; +using KE.Items.Utils; using MEC; using System.Collections.Generic; using UnityEngine; @@ -35,7 +40,7 @@ protected override Dictionary> SetTranslation { [TranslationKeyName] = "M-Scan", [TranslationKeyDesc] = "Detect movement", - [Deploy] = $"MSCAN DEPLOYED\nBattery: {TimeUp} seconds", + [Deploy] = $"MSCAN DEPLOYED Battery: {TimeUp} seconds", [PickUp] = "M-Scan picked up", [TranslationDestroy] = "M-SCAN DESTROYED", [NoBattery] = "M-Scan : No battery left", @@ -45,7 +50,7 @@ protected override Dictionary> SetTranslation { [TranslationKeyName] = "M-Scan", [TranslationKeyDesc] = "Détecte les mouvements des personnes passant devant", - [Deploy] = $"SCANNER DÉPLOYÉ\nBatterie: {TimeUp} secondes", + [Deploy] = $"SCANNER DÉPLOYÉ Batterie: {TimeUp} secondes", [PickUp] = "Scanner récupéré.", [TranslationDestroy] = "SCANNER DÉTRUIT", [NoBattery] = "Scanner: Batterie épuisée.", @@ -84,6 +89,7 @@ protected override Dictionary> SetTranslation private Dictionary Cooldowns = new Dictionary(); private Dictionary BatteryLife = new Dictionary(); + private Dictionary Models = new(); private CoroutineHandle SensorRoutine; @@ -153,21 +159,34 @@ private void OnDroppedItem(DroppedItemEventArgs ev) { ActiveSensors.Add(pickup, player); BatteryLife[pickup] = Time.time + TimeUp; + //Models[pickup] = CreateBaseModel(pickup); - - TranslationHint(player, Deploy); + HintFeed.AddFeed(player, GetTranslation(player, Deploy)); } } + private Primitive CreateBaseModel(Pickup pickup) + { + Primitive primitive = Primitive.Create(null, null, null, false); + primitive.Transform.localPosition = pickup.Position; + primitive.Transform.localRotation = Quaternion.identity; + primitive.Transform.localScale = Vector3.one; + primitive.MovementSmoothing = 0; + primitive.Flags = PrimitiveFlags.None; + primitive.Spawn(); + return primitive; + } + protected override void OnPickingUp(PickingUpItemEventArgs ev) { Player player = ev.Player; + Pickup pickup = ev.Pickup; - if (ActiveSensors.ContainsKey(ev.Pickup)) + if (ActiveSensors.ContainsKey(pickup)) { - ActiveSensors.Remove(ev.Pickup); - BatteryLife.Remove(ev.Pickup); - TranslationHint(player, PickUp); + + Remove(pickup); + HintFeed.AddFeed(player, GetTranslation(player, PickUp)); } } @@ -191,15 +210,14 @@ private void CheckDestruction(Vector3 hitPos, float radius) toDestroy.Add(sensor); if (owner != null) { - TranslationHint(owner, TranslationDestroy); + HintFeed.AddFeed(owner, GetTranslation(owner, TranslationDestroy)); } } } foreach (Pickup pickup in toDestroy) { - ActiveSensors.Remove(pickup); - BatteryLife.Remove(pickup); + Remove(pickup); Cooldowns.Remove(pickup); pickup.Destroy(); } @@ -207,6 +225,12 @@ private void CheckDestruction(Vector3 hitPos, float radius) ListPool.Pool.Return(toDestroy); } + private void Remove(Pickup pickup) + { + ActiveSensors.Remove(pickup); + BatteryLife.Remove(pickup); + //Models[pickup].Destroy(); + } private void CheckBattery() @@ -220,7 +244,7 @@ private void CheckBattery() Player player = ActiveSensors[key]; if (player != null) { - TranslationHint(player, NoBattery); + HintFeed.AddFeed(player, GetTranslation(player, NoBattery)); } invalid.Add(key); } @@ -272,7 +296,8 @@ private IEnumerator MotionDetector() string color = target.Role.Color.ToHex(); string msg = GetTranslation(owner, Detect).Replace("%Color%", color).Replace("%Name%", target.Role.Name); - KECustomItem.ItemEffectHint(owner, msg); + + HintFeed.AddFeed(owner, msg); } break; diff --git a/KruacentExiled/KE.Items/Items/Models/MScanModel.cs b/KruacentExiled/KE.Items/Items/Models/MScanModel.cs new file mode 100644 index 00000000..a5a92e87 --- /dev/null +++ b/KruacentExiled/KE.Items/Items/Models/MScanModel.cs @@ -0,0 +1,113 @@ +using KE.Utils.API.Features.Models; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using UnityEngine; + +namespace KE.Items.Items.Models +{ + public class MScanModel : ModelBase + { + + protected override void CreateModel(Transform parent) + { + // This code was auto-generated + + var Mscan = CreateEmptyPrimitive( + parent, + new Vector3(0f, 0f, 0f), + new Quaternion(0f, 0f, 0f, 1f), + new Vector3(1f, 1f, 1f) + ); + + var bottom = CreatePrimitive( + Mscan.transform, + PrimitiveType.Cylinder, + new Vector3(0f, 0f, 0f), + new Quaternion(0f, 0f, 0f, 1f), + new Vector3(5f, 0.5f, 5f), + new Color32(115, 113, 115, 255), + collidable:false + ); + + var middle = CreatePrimitive( + Mscan.transform, + PrimitiveType.Cylinder, + new Vector3(0f, 1.69f, 0f), + new Quaternion(0f, 0f, 0f, 1f), + new Vector3(4.2f, 1.41875f, 4.2f), + new Color32(57, 56, 57, 255), + collidable: false + ); + + var topp = CreatePrimitive( + Mscan.transform, + PrimitiveType.Sphere, + new Vector3(0f, 3f, 0f), + new Quaternion(0f, 0f, 0f, 1f), + new Vector3(4.2f, 4.2f, 4.2f), + new Color32(57, 56, 57, 255), + collidable: false + ); + + var contour = CreatePrimitive( + Mscan.transform, + PrimitiveType.Cylinder, + new Vector3(0f, 2.81f, 0f), + new Quaternion(0f, 0f, 0f, 1f), + new Vector3(4.3f, 0.15f, 4.3f), + new Color32(33, 33, 33, 255), + collidable: false + ); + + var parentLight = CreateEmptyPrimitive( + Mscan.transform, + new Vector3(0f, -0.15f, 0f), + new Quaternion(0f, 0f, 0f, 1f), + new Vector3(1f, 1f, 1f) + ); + + var light1 = CreatePrimitive( + parentLight.transform, + PrimitiveType.Sphere, + new Vector3(-0.7986f, 3.2654f, 0f), + new Quaternion(0f, 0f, 0f, 1f), + new Vector3(3.170261f, 3.587015f, 2.417214f), + new Color32(175, 149, 16, 255), + collidable: false + ); + + var contour1 = CreatePrimitive( + light1.transform, + PrimitiveType.Cylinder, + new Vector3(-0.2495f, 0.1033f, 0f), + new Quaternion(0f, 0f, 0.556803f, 0.8306445f), + new Vector3(0.9123899f, 0.07510301f, 0.79f), + new Color32(57, 56, 57, 255), + collidable: false + ); + + var light2 = CreatePrimitive( + parentLight.transform, + PrimitiveType.Sphere, + new Vector3(0.7986f, 3.2654f, 0f), + new Quaternion(0f, 0f, 0f, 1f), + new Vector3(3.170261f, 3.587015f, 2.417214f), + new Color32(175, 149, 16, 255), + collidable: false + ); + + var contour2 = CreatePrimitive( + light2.transform, + PrimitiveType.Cylinder, + new Vector3(0.2495f, 0.1033f, 0f), + new Quaternion(0f, 0f, -0.556803f, 0.8306445f), + new Vector3(0.9123901f, 0.07510301f, 0.79f), + new Color32(57, 56, 57, 255), + collidable: false + ); + } + } +} diff --git a/KruacentExiled/KE.Items/Items/SainteGrenada.cs b/KruacentExiled/KE.Items/Items/SainteGrenada.cs index b62495d0..443bbea7 100644 --- a/KruacentExiled/KE.Items/Items/SainteGrenada.cs +++ b/KruacentExiled/KE.Items/Items/SainteGrenada.cs @@ -80,7 +80,7 @@ protected override void UnsubscribeEvents() protected override void OnThrownProjectile(ThrownProjectileEventArgs ev) { - Utils.API.Sounds.SoundPlayer.Instance.Play("worms", ev.Projectile.Position, 50,20f); + KE.Utils.API.Sounds.SoundPlayer.Instance.Play("worms", ev.Projectile.Position, 50,20f); } protected override void OnExplodingGrenade(ExplodingGrenadeEventArgs ev) { diff --git a/KruacentExiled/KE.Items/MainPlugin.cs b/KruacentExiled/KE.Items/MainPlugin.cs index 1da85053..2de0365b 100644 --- a/KruacentExiled/KE.Items/MainPlugin.cs +++ b/KruacentExiled/KE.Items/MainPlugin.cs @@ -52,7 +52,7 @@ public override void OnEnabled() SettingsHandler = new(); - Utils.API.Sounds.SoundPlayer.Load(); + KE.Utils.API.Sounds.SoundPlayer.Load(); PoseRoomSpawnPointHandler.AddRoomPoses(new() { new(RoomType.Lcz914,new Vector3(0,0.70f,-7.14f),Quaternion.identity), diff --git a/KruacentExiled/KE.Items/Utils/Feed.cs b/KruacentExiled/KE.Items/Utils/Feed.cs new file mode 100644 index 00000000..4153f0c2 --- /dev/null +++ b/KruacentExiled/KE.Items/Utils/Feed.cs @@ -0,0 +1,20 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace KE.Items.Utils +{ + public sealed class Feed + { + + public string RawHint { get; } + + + public Feed(string msg) + { + RawHint = msg; + } + } +} diff --git a/KruacentExiled/KE.Items/Utils/HintFeed.cs b/KruacentExiled/KE.Items/Utils/HintFeed.cs new file mode 100644 index 00000000..bd04cf80 --- /dev/null +++ b/KruacentExiled/KE.Items/Utils/HintFeed.cs @@ -0,0 +1,92 @@ +using Exiled.API.Features; +using Exiled.API.Interfaces; +using HintServiceMeow.Core.Extension; +using HintServiceMeow.Core.Models.Hints; +using KE.Utils.API.Displays.DisplayMeow; +using KE.Utils.API.Features; +using MEC; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Xml.Linq; + +namespace KE.Items.Utils +{ + public class HintFeed + { + private static readonly HintFeedPosition firstPosition = new(); + private static Dictionary playersFeed = new(); + public const int MaxFeed = 10; + + private readonly List _feeds; + private Player Player { get; } + public static float Duration { get; set; } = 20; + + private HintFeed(Player player) + { + Player = player; + _feeds = new(); + } + + public static HintFeed GetOrCreate(Player player) + { + if(!playersFeed.TryGetValue(player,out HintFeed feed)) + { + feed = new(player); + playersFeed[player] = feed; + } + return feed; + } + + public static Feed AddFeed(Player player,string msg) + { + HintFeed hint = GetOrCreate(player); + Feed feed = new Feed(msg); + + hint.AddFeed(feed); + + return feed; + } + + + public void AddFeed(Feed feed) + { + _feeds.Add(feed); + UpdateDisplay(); + Timing.CallDelayed(Duration, () => + { + _feeds.Remove(feed); + UpdateDisplay(); + }); + } + + + public void UpdateDisplay() + { + for (int i = 0; i < MaxFeed; i++) + { + HintPlacement placement = HintFeedPosition.GetIndex(i).HintPlacement; + if (_feeds.TryGet(i, out Feed fe)) + { + KELog.Debug(fe.RawHint); + KELog.Debug("at "+i); + + DisplayHandler.Instance.AddHint(placement, Player, fe.RawHint, 999); + } + else + { + DisplayHandler.Instance.RemoveHint(Player, placement); + } + + } + } + + + + + + + } +} diff --git a/KruacentExiled/KE.Items/Utils/HintFeedPosition.cs b/KruacentExiled/KE.Items/Utils/HintFeedPosition.cs new file mode 100644 index 00000000..3dc5778b --- /dev/null +++ b/KruacentExiled/KE.Items/Utils/HintFeedPosition.cs @@ -0,0 +1,45 @@ +using Exiled.API.Features; +using HintServiceMeow.Core.Enum; +using KE.Utils.API.Displays.DisplayMeow.Placements; +using KE.Utils.API.Features; +using System.Collections.Generic; + +namespace KE.Items.Utils +{ + public sealed class HintFeedPosition : HintPosition + { + public const float BaseYPosition = 150; + public const float Increments = -50; + private float yposition = BaseYPosition; + public override float Xposition => -350; + + public override float Yposition => yposition; + + private int index; + public int Index => index; + + private static List nonalloc = new(HintFeed.MaxFeed); + + + public static HintFeedPosition GetIndex(int index) + { + if (!nonalloc.TryGet(index, out HintFeedPosition position)) + { + position = new HintFeedPosition() + { + yposition = BaseYPosition + index * 25, + index = index + }; + } + //KELog.Debug($"get index {index} y pos=" + position.Yposition); + return position; + + } + + public override HintAlignment HintAlignment => HintAlignment.Left; + public override string Name => "HintFeed"; + + + + } +} From 7e0957a89d3b44593eb95b4c445f700a3cf2b5e6 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Thu, 19 Mar 2026 20:19:29 +0100 Subject: [PATCH 775/853] remove stalking 106 from mscan detection --- KruacentExiled/KE.Items/Items/MScan.cs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/KruacentExiled/KE.Items/Items/MScan.cs b/KruacentExiled/KE.Items/Items/MScan.cs index a752e4e4..c45cf216 100644 --- a/KruacentExiled/KE.Items/Items/MScan.cs +++ b/KruacentExiled/KE.Items/Items/MScan.cs @@ -4,6 +4,7 @@ using Exiled.API.Features.Attributes; using Exiled.API.Features.Pickups; using Exiled.API.Features.Pools; +using Exiled.API.Features.Roles; using Exiled.API.Features.Spawn; using Exiled.API.Features.Toys; using Exiled.API.Structs; @@ -286,6 +287,11 @@ private IEnumerator MotionDetector() if (!target.IsAlive || target.IsNoclipPermitted) continue; if (owner != null && target.Role.Side == owner.Role.Side) continue; + if(target.Role is Scp106Role scp106 && !scp106.CanActivateTesla) + { + continue; + } + if (Vector3.Distance(sensor.Position, target.Position) < 3.5f) { From 3c3be85e9d87433cb5be3846e333e8dcaf537dd0 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Fri, 20 Mar 2026 17:29:15 +0100 Subject: [PATCH 776/853] hint feed with time now --- KruacentExiled/KE.Items/Items/MScan.cs | 8 ++++---- KruacentExiled/KE.Items/Utils/Feed.cs | 2 ++ KruacentExiled/KE.Items/Utils/HintFeed.cs | 18 ++++++++++++++++-- 3 files changed, 22 insertions(+), 6 deletions(-) diff --git a/KruacentExiled/KE.Items/Items/MScan.cs b/KruacentExiled/KE.Items/Items/MScan.cs index c45cf216..e8f6e8ec 100644 --- a/KruacentExiled/KE.Items/Items/MScan.cs +++ b/KruacentExiled/KE.Items/Items/MScan.cs @@ -41,21 +41,21 @@ protected override Dictionary> SetTranslation { [TranslationKeyName] = "M-Scan", [TranslationKeyDesc] = "Detect movement", - [Deploy] = $"MSCAN DEPLOYED Battery: {TimeUp} seconds", + [Deploy] = "MSCAN DEPLOYED Battery: {TimeUp} seconds", [PickUp] = "M-Scan picked up", [TranslationDestroy] = "M-SCAN DESTROYED", [NoBattery] = "M-Scan : No battery left", - [Detect] = "M-SCAN: %Name%", + [Detect] = "M-SCAN: %Name%", }, ["fr"] = new() { [TranslationKeyName] = "M-Scan", [TranslationKeyDesc] = "Détecte les mouvements des personnes passant devant", - [Deploy] = $"SCANNER DÉPLOYÉ Batterie: {TimeUp} secondes", + [Deploy] = "SCANNER DÉPLOYÉ Batterie: {TimeUp} secondes", [PickUp] = "Scanner récupéré.", [TranslationDestroy] = "SCANNER DÉTRUIT", [NoBattery] = "Scanner: Batterie épuisée.", - [Detect] = "$M-SCAN: %Name%", + [Detect] = "M-SCAN: %Name%", }, }; } diff --git a/KruacentExiled/KE.Items/Utils/Feed.cs b/KruacentExiled/KE.Items/Utils/Feed.cs index 4153f0c2..8262d4f0 100644 --- a/KruacentExiled/KE.Items/Utils/Feed.cs +++ b/KruacentExiled/KE.Items/Utils/Feed.cs @@ -11,10 +11,12 @@ public sealed class Feed public string RawHint { get; } + public DateTime TimeCreated { get; } public Feed(string msg) { RawHint = msg; + TimeCreated = DateTime.Now; } } } diff --git a/KruacentExiled/KE.Items/Utils/HintFeed.cs b/KruacentExiled/KE.Items/Utils/HintFeed.cs index bd04cf80..cdf0d056 100644 --- a/KruacentExiled/KE.Items/Utils/HintFeed.cs +++ b/KruacentExiled/KE.Items/Utils/HintFeed.cs @@ -1,4 +1,5 @@ using Exiled.API.Features; +using Exiled.API.Features.Pools; using Exiled.API.Interfaces; using HintServiceMeow.Core.Extension; using HintServiceMeow.Core.Models.Hints; @@ -22,7 +23,7 @@ public class HintFeed private readonly List _feeds; private Player Player { get; } - public static float Duration { get; set; } = 20; + public static float Duration { get; set; } = 10; private HintFeed(Player player) { @@ -73,16 +74,29 @@ public void UpdateDisplay() KELog.Debug(fe.RawHint); KELog.Debug("at "+i); - DisplayHandler.Instance.AddHint(placement, Player, fe.RawHint, 999); + DisplayHandler.Instance.CreateAuto(Player, (args) => GetUpdate(fe), placement, HintServiceMeow.Core.Enum.HintSyncSpeed.Normal); } else { + KELog.Debug("removing feed at " + i); DisplayHandler.Instance.RemoveHint(Player, placement); } } } + private string GetUpdate(Feed feed) + { + StringBuilder sb = StringBuilderPool.Pool.Get(); + + sb.Append(Math.Truncate(DateTime.Now.Subtract(feed.TimeCreated).TotalSeconds)); + + sb.Append("s ago - "); + sb.Append(feed.RawHint); + + + return StringBuilderPool.Pool.ToStringReturn(sb); + } From b2e2199d9d2e084a87e402e0328d81d8e69fbb1a Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Sun, 22 Mar 2026 18:39:45 +0100 Subject: [PATCH 777/853] added 035 to scp voice chat --- .../KE.CustomRoles/CR/CustomSCPs/SCP035.cs | 48 ++++++++++++++++++- 1 file changed, 46 insertions(+), 2 deletions(-) diff --git a/KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP035.cs b/KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP035.cs index 6f394125..8076d9ed 100644 --- a/KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP035.cs +++ b/KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP035.cs @@ -15,11 +15,14 @@ using KE.Items.API.Features; using KE.Utils.API.Displays.DisplayMeow; using KE.Utils.API.Displays.DisplayMeow.Placements; +using KE.Utils.API.Features.SCPs; using MEC; using PlayerRoles; +using PlayerRoles.FirstPersonControl.Thirdperson; using System; using System.Collections.Generic; using System.Text; +using VoiceChat.Networking; namespace KE.CustomRoles.CR.CustomSCPs { @@ -98,6 +101,7 @@ protected override void SubscribeEvents() Exiled.Events.Handlers.Server.EndingRound += OnEndingRound; Exiled.Events.Handlers.Scp1509.Resurrecting += OnResurrecting; Exiled.Events.Handlers.Player.UsingItem += OnUsingItem; + Exiled.Events.Handlers.Player.VoiceChatting += OnVoiceChatting; base.SubscribeEvents(); } @@ -122,6 +126,44 @@ private void OnDying(DyingEventArgs ev) } + private void OnVoiceChatting(VoiceChattingEventArgs ev) + { + Player player = ev.Player; + + + VoiceMessage msg = ev.VoiceMessage; + + if(msg.Channel == VoiceChat.VoiceChatChannel.ScpChat) + { + msg.Channel = VoiceChat.VoiceChatChannel.RoundSummary; + + foreach (Player scp035 in Player.List) + { + if (scp035 != player && Check(scp035)) + { + scp035.Connection.Send(msg); + } + } + } + + + + if (Check(player)) + { + msg.Channel = VoiceChat.VoiceChatChannel.RoundSummary; + + foreach (ReferenceHub hub in SCPTeam.SCPs) + { + if (hub != player.ReferenceHub) + { + hub.connectionToClient.Send(msg); + } + + } + ev.IsAllowed = false; + } + } + protected override void RoleAdded(Player player) { PlayerDisplay dis = PlayerDisplay.Get(player); @@ -134,16 +176,18 @@ protected override void RoleAdded(Player player) player.Position = RoleTypeId.Scp049.GetRandomSpawnLocation().Position; player.EnableEffect(100, 0, false); base.RoleAdded(player); - KECustomItem.TrySpawn(5982, player.Position, out _); } + + + private string GetPlayers(AutoContentUpdateArg arg) { if (!Check(Player.Get(arg.PlayerDisplay.ReferenceHub))) return string.Empty; - return "" +RoundSummary.singleton.TargetCount.ToString() + ""; + return "👤" + RoundSummary.singleton.TargetCount.ToString() + ""; } From 229ab35d798cfaa48c3dfa3c549eefc3f1c38645 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Sun, 22 Mar 2026 18:40:00 +0100 Subject: [PATCH 778/853] redmist again --- .../API/Features/KEAbilities.cs | 2 +- .../API/Interfaces/Ability/IDuration.cs | 2 +- .../Abilities/RedMist/EgoAbility.cs | 1 + .../RedMist/GreaterSplitHorizontal.cs | 253 ++++++++++++++---- .../Abilities/RedMist/OnRush.cs | 8 +- .../KE.CustomRoles/Abilities/RedMist/Spear.cs | 115 ++++++-- .../KE.CustomRoles/Abilities/SimulateDeath.cs | 4 +- .../KE.CustomRoles/CR/MTF/RedMist/RedMist.cs | 30 ++- 8 files changed, 308 insertions(+), 107 deletions(-) diff --git a/KruacentExiled/KE.CustomRoles/API/Features/KEAbilities.cs b/KruacentExiled/KE.CustomRoles/API/Features/KEAbilities.cs index c7469f79..e1fae151 100644 --- a/KruacentExiled/KE.CustomRoles/API/Features/KEAbilities.cs +++ b/KruacentExiled/KE.CustomRoles/API/Features/KEAbilities.cs @@ -293,7 +293,7 @@ public bool IsAbilityActive(Player player) return this.playerWithActiveAbility.Contains(player); } - public bool Check(Player player) + public virtual bool Check(Player player) { if(player is not null) { diff --git a/KruacentExiled/KE.CustomRoles/API/Interfaces/Ability/IDuration.cs b/KruacentExiled/KE.CustomRoles/API/Interfaces/Ability/IDuration.cs index 79e5348d..e68a58c5 100644 --- a/KruacentExiled/KE.CustomRoles/API/Interfaces/Ability/IDuration.cs +++ b/KruacentExiled/KE.CustomRoles/API/Interfaces/Ability/IDuration.cs @@ -9,7 +9,7 @@ namespace KE.CustomRoles.API.Interfaces.Ability { internal interface IDuration { - float Duration { get; set; } + float Duration { get; } void ActionAfterAbility(Player player); } } diff --git a/KruacentExiled/KE.CustomRoles/Abilities/RedMist/EgoAbility.cs b/KruacentExiled/KE.CustomRoles/Abilities/RedMist/EgoAbility.cs index 51f11f60..d25606f5 100644 --- a/KruacentExiled/KE.CustomRoles/Abilities/RedMist/EgoAbility.cs +++ b/KruacentExiled/KE.CustomRoles/Abilities/RedMist/EgoAbility.cs @@ -17,6 +17,7 @@ namespace KE.CustomRoles.Abilities.RedMist public abstract class EgoAbility : NeedCompAbility, IConditional { + protected sealed override bool AddCompIfMissing => false; protected abstract NeedActive NeedEGOActive { get; } diff --git a/KruacentExiled/KE.CustomRoles/Abilities/RedMist/GreaterSplitHorizontal.cs b/KruacentExiled/KE.CustomRoles/Abilities/RedMist/GreaterSplitHorizontal.cs index 91976faf..1c71344e 100644 --- a/KruacentExiled/KE.CustomRoles/Abilities/RedMist/GreaterSplitHorizontal.cs +++ b/KruacentExiled/KE.CustomRoles/Abilities/RedMist/GreaterSplitHorizontal.cs @@ -1,16 +1,26 @@ using Exiled.API.Enums; using Exiled.API.Features; using Exiled.API.Features.DamageHandlers; +using Exiled.Events.EventArgs.Item; +using Exiled.Events.EventArgs.Scp1509; using InventorySystem.Items.MicroHID.Modules; +using KE.CustomRoles.API.Interfaces.Ability; using KE.CustomRoles.CR.MTF.RedMist; using KE.Utils.API.Features; +using MEC; using PlayerRoles; +using System; using System.Collections.Generic; using UnityEngine; +using UnityEngine.Pool; namespace KE.CustomRoles.Abilities.RedMist { public class GreaterSplitHorizontal : EgoAbility { + public const string FailEgo = "OnRushFailEGO"; + public const string FailWeapon = "OnRushFailWeapon"; + + public override string Name { get; } = "GreaterSplitHorizontal"; protected override Dictionary> SetTranslation() { @@ -34,75 +44,98 @@ protected override Dictionary> SetTranslation } public override float Cooldown { get; } = 0f; - protected override NeedActive NeedEGOActive => NeedActive.Either; //active + protected override NeedActive NeedEGOActive => NeedActive.Either; // active public const float Damage = 200; public const float MaxDistance = 5; - private Collider[] NonAlloc = new Collider[64]; + public static readonly LayerMasks Mask = LayerMasks.Scp173Teleport | LayerMasks.Glass; public const float Size = 5; - protected override bool LaunchedAbility(Player player,EGO ego) - { + - KELog.Debug("check weapopgn"); - + protected override void AbilityAdded(Player player) + { + + if (!player.GameObject.TryGetComponent(out var comp)) + { + comp = player.GameObject.AddComponent(); + } + comp.Init(player, this); - if(player.CurrentItem is null || player.CurrentItem.Type != ItemType.SCP1509) + + base.AbilityAdded(player); + } + + protected override void AbilityRemoved(Player player) + { + if (player.GameObject.TryGetComponent(out var comp)) { - //show OnRushFailWeapon - return false; + UnityEngine.Object.Destroy(comp); } + base.AbilityRemoved(player); + } - Vector3 feetposition = player.Position- (Vector3.up*player.Scale.y)/2 + player.CameraTransform.forward*.1f; + protected override void SubscribeEvents() + { + Exiled.Events.Handlers.Scp1509.TriggeringAttack += OnTriggeringAttack; + base.SubscribeEvents(); + } + protected override void UnsubscribeEvents() + { + Exiled.Events.Handlers.Scp1509.TriggeringAttack -= OnTriggeringAttack; + base.UnsubscribeEvents(); + } - Vector3 direction = player.CameraTransform.forward; - direction = direction.NormalizeIgnoreY(); - DrawSphere(feetposition, Size, Color.yellow); - - int detect = Physics.OverlapSphereNonAlloc(feetposition, Size, NonAlloc, HitregUtils.DetectionMask); - Collider collider; - for (int i = 0;i < detect;i++) + private void OnTriggeringAttack(TriggeringAttackEventArgs ev) + { + Player player = ev.Player; + if (!Check(player)) return; + if (player.GameObject.TryGetComponent(out var comp)) { - collider = NonAlloc[i]; + comp.OnTriggerAttack(); + } - if(!CheckPoint(collider.transform.position, feetposition, direction)) - { - continue; - } + } - - if (collider.TryGetComponent(out var destructible) && - (!Linecast(feetposition, destructible?.CenterOfMass ?? Vector3.zero, out var hitInfo, PlayerRolesUtils.AttackMask) - || collider == hitInfo.collider)) - { - Player target = Player.Get(collider); - if(target is null || target != player) - { - DrawSphere(collider.transform.position,.2f, Color.red); - } + + + protected override bool LaunchedAbility(Player player,EGO ego) + { - if (destructible is not null) - { - PlayerStatsSystem.DamageHandlerBase handler = new GenericDamageHandler(target, player, Damage, DamageType.Scp1509, new DamageHandlerBase.CassieAnnouncement("")).Base; - destructible.Damage(Damage, handler, destructible.CenterOfMass); - } - } + + + KELog.Debug("check weapopgn"); + + + + if(player.CurrentItem is null || player.CurrentItem.Type != ItemType.SCP1509) + { + ShowEffectHint(player, FailWeapon); + return false; + } + + + if (player.GameObject.TryGetComponent(out var comp)) + { + comp.StartAttack(); } + + return true; } private static bool CheckPoint(Vector3 point,Vector3 center, Vector3 direction) @@ -121,37 +154,145 @@ private static bool CheckPoint(Vector3 point,Vector3 center, Vector3 direction) float halfAngle = sectorAngle * 0.5f; float cosThreshold = Mathf.Cos(halfAngle * Mathf.Deg2Rad); - if (Debug) - { - DrawSphere(position, .1f, Color.cyan); - } + DrawSphere(position, .1f, Color.cyan); return Vector2.Dot(dir, pointDir) >= cosThreshold; } - private static bool Debug => MainPlugin.Instance.Config.Debug; - private bool Linecast(Vector3 start,Vector3 end,out RaycastHit hit,int layerMask) + private static bool Linecast(Vector3 start, Vector3 end, out RaycastHit hit, int layerMask) => OnRush.Linecast(start, end, out hit, layerMask); + + private static void DrawSphere(Vector3 position, float size, Color color) => OnRush.DrawSphere(position, size, color); + + + + private class AttackGreaterSplit : MonoBehaviour { - if (Debug) + private Player player; + private readonly Collider[] NonAlloc = new Collider[64]; + private bool currentUsing; + private bool attacking; + private GreaterSplitHorizontal ability; + public void Init(Player player,GreaterSplitHorizontal ability) { - Draw.Line(start, end, Color.red, 10, Player.Enumerable); + this.player = player; + this.ability = ability; + currentUsing = false; + attacking = false; } - - - return Physics.Linecast(start, end, out hit, layerMask); + private float time; + public void StartAttack() + { + currentUsing = true; + time = 10; + } - } - private static void DrawSphere(Vector3 position, float size,Color color) - { - if (Debug) + public void OnTriggerAttack() { - Draw.Sphere(position, Quaternion.identity, Vector3.one * size, color, 10, Player.Enumerable); + if (currentUsing) + { + attacking = true; + } } - - } + private void Update() + { + if (!currentUsing) return; + + + time -= Timing.DeltaTime; + + if(time <= 0 || attacking) + { + if (ability.Check(player)) + { + try + { + LaunchedAttack(time); + } + catch(Exception e) + { + Log.Error(e); + } + + } + attacking = false; + currentUsing = false; + } + } + + + + private void LaunchedAttack(float remainingTime) + { + + KELog.Debug("remainign time=" + remainingTime); + + Vector3 feetposition = player.Position - (Vector3.up * player.Scale.y) / 2 + player.CameraTransform.forward * .1f; + + + Vector3 direction = player.CameraTransform.forward; + + direction = direction.NormalizeIgnoreY(); + + DrawSphere(feetposition, Size, Color.yellow); + + + + int detect = Physics.OverlapSphereNonAlloc(feetposition, Size, NonAlloc, HitregUtils.DetectionMask); + KELog.Debug("detect=" + detect); + + Collider collider; + for (int i = 0; i < detect; i++) + { + collider = NonAlloc[i]; + + if(collider == null) + { + continue; + } + + if (!CheckPoint(collider.transform.position, feetposition, direction)) + { + continue; + } + + + if (!collider.TryGetComponent(out var destructible) || destructible == null) + { + continue; + } + + if (Linecast(feetposition, destructible.CenterOfMass, out var hitInfo, PlayerRolesUtils.AttackMask) + && collider != hitInfo.collider) + { + continue; + } + + Player target = Player.Get(collider); + + if (target != player) + { + DrawSphere(collider.transform.position, .2f, Color.red); + } + + if (target == null || target == player) + { + continue; + } + + + if (destructible is not null) + { + PlayerStatsSystem.DamageHandlerBase handler = new GenericDamageHandler(target, player, Damage, DamageType.Scp1509, new DamageHandlerBase.CassieAnnouncement("")).Base; + destructible.Damage(Damage, handler, destructible.CenterOfMass); + } + } + + } + } + } } diff --git a/KruacentExiled/KE.CustomRoles/Abilities/RedMist/OnRush.cs b/KruacentExiled/KE.CustomRoles/Abilities/RedMist/OnRush.cs index 1f3b267d..470eec91 100644 --- a/KruacentExiled/KE.CustomRoles/Abilities/RedMist/OnRush.cs +++ b/KruacentExiled/KE.CustomRoles/Abilities/RedMist/OnRush.cs @@ -1,9 +1,7 @@ using Exiled.API.Enums; using Exiled.API.Features; using Exiled.API.Features.DamageHandlers; -using Exiled.API.Interfaces; using InventorySystem.Items.MicroHID.Modules; -using KE.CustomRoles.API.Features; using KE.CustomRoles.CR.MTF.RedMist; using KE.Utils.API.Features; using PlayerRoles; @@ -152,8 +150,8 @@ protected override bool LaunchedAbility(Player player,EGO ego) } - private static bool Debug = false; - private bool Linecast(Vector3 start,Vector3 end,out RaycastHit hit,int layerMask) + private static bool Debug => MainPlugin.Configs.Debug; + public static bool Linecast(Vector3 start,Vector3 end,out RaycastHit hit,int layerMask) { if (Debug) { @@ -166,7 +164,7 @@ private bool Linecast(Vector3 start,Vector3 end,out RaycastHit hit,int layerMask } - private void DrawSphere(Vector3 position, float size,Color color) + public static void DrawSphere(Vector3 position, float size,Color color) { if (Debug) { diff --git a/KruacentExiled/KE.CustomRoles/Abilities/RedMist/Spear.cs b/KruacentExiled/KE.CustomRoles/Abilities/RedMist/Spear.cs index e824e492..85c5589c 100644 --- a/KruacentExiled/KE.CustomRoles/Abilities/RedMist/Spear.cs +++ b/KruacentExiled/KE.CustomRoles/Abilities/RedMist/Spear.cs @@ -1,25 +1,16 @@ using Exiled.API.Enums; using Exiled.API.Features; using Exiled.API.Features.DamageHandlers; -using Exiled.API.Features.Items; -using Exiled.API.Features.Roles; -using Exiled.API.Features.Toys; -using Exiled.API.Interfaces; -using Exiled.CreditTags.Features; using InventorySystem.Items.MicroHID.Modules; -using KE.CustomRoles.API.Features; using KE.CustomRoles.CR.MTF.RedMist; using KE.Utils.API.Features; using PlayerRoles; -using PlayerRoles.FirstPersonControl.Thirdperson; -using PlayerStatsSystem; using System.Collections.Generic; -using System.ComponentModel; -using System.Linq; using UnityEngine; + namespace KE.CustomRoles.Abilities.RedMist { - public class Spear : KEAbilities + public class Spear : EgoAbility { public override string Name { get; } = "Spear"; protected override Dictionary> SetTranslation() @@ -30,48 +21,116 @@ protected override Dictionary> SetTranslation { [TranslationKeyName] = "Spear", [TranslationKeyDesc] = "Manifest your E.G.O, gain powerful buff but rapid health drain.\nCan be deactivated anytime", - ["ForwardSlashFailEGO"] = "You need to manifest your E.G.O. first", - ["ForwardSlashFailWeapon"] = "You need your weapon", + ["OnRushFailEGO"] = "You need to manifest your E.G.O. first", + ["OnRushFailWeapon"] = "You need your weapon", }, ["fr"] = new() { [TranslationKeyName] = "todo", [TranslationKeyDesc] = "todo", - ["ForwardSlashFailEGO"] = "todo", - ["ForwardSlashFailWeapon"] = "todo", + ["OnRushFailEGO"] = "todo", + ["OnRushFailWeapon"] = "todo", } }; } public override float Cooldown { get; } = 0f; - public const float Damage = 100; - public const float MaxDistance = 15; + protected override NeedActive NeedEGOActive => NeedActive.Either; + + public const float Damage = 200; + + public const float MaxDistance = 5; + + + private Collider[] NonAlloc = new Collider[64]; - private RaycastHit[] NonAlloc = new RaycastHit[16]; + public static readonly LayerMasks Mask = LayerMasks.Scp173Teleport | LayerMasks.Glass; - public static readonly CustomReasonDamageHandler BallDamage = new("Burned to death", 25, string.Empty); - protected override bool AbilityUsed(Player player) + public const float Size = 5; + protected override bool LaunchedAbility(Player player, EGO ego) { - - if (!player.ReferenceHub.gameObject.TryGetComponent(out var ego)) + + KELog.Debug("check weapopgn"); + + + + if (player.CurrentItem is null || player.CurrentItem.Type != ItemType.SCP1509) { + //show OnRushFailWeapon return false; } + Vector3 feetposition = player.Position - (Vector3.up * player.Scale.y) / 2 + player.CameraTransform.forward * .1f; - if (!ego.Active) + + Vector3 direction = player.CameraTransform.forward; + + direction = direction.NormalizeIgnoreY(); + + DrawSphere(feetposition, Size, Color.yellow); + + + + int detect = Physics.OverlapSphereNonAlloc(feetposition, Size, NonAlloc, HitregUtils.DetectionMask); + Collider collider; + for (int i = 0; i < detect; i++) { - //show ForwardSlashFailEGO - return false; + collider = NonAlloc[i]; + + if (!CheckPoint(collider.transform.position, feetposition, direction)) + { + continue; + } + + + if (collider.TryGetComponent(out var destructible) && + (!Linecast(feetposition, destructible?.CenterOfMass ?? Vector3.zero, out var hitInfo, PlayerRolesUtils.AttackMask) + || collider == hitInfo.collider)) + { + Player target = Player.Get(collider); + + if (target is null || target != player) + { + DrawSphere(collider.transform.position, .2f, Color.red); + } + + + if (destructible is not null) + { + PlayerStatsSystem.DamageHandlerBase handler = new GenericDamageHandler(target, player, Damage, DamageType.Scp1509, new DamageHandlerBase.CassieAnnouncement("")).Base; + destructible.Damage(Damage, handler, destructible.CenterOfMass); + } + } } - + return true; + } + private static bool CheckPoint(Vector3 point, Vector3 center, Vector3 direction) + { + + + Vector2 position = new Vector2(point.x - center.x, point.z - center.z); + + float radius = position.magnitude; + if (radius > Size) + return false; + + Vector2 dir = new Vector2(direction.x, direction.z).normalized; + Vector2 pointDir = position.normalized; + float sectorAngle = 60f; + float halfAngle = sectorAngle * 0.5f; + float cosThreshold = Mathf.Cos(halfAngle * Mathf.Deg2Rad); + DrawSphere(position, .1f, Color.cyan); - return base.AbilityUsed(player); + return Vector2.Dot(dir, pointDir) >= cosThreshold; } + private bool Linecast(Vector3 start, Vector3 end, out RaycastHit hit, int layerMask) => OnRush.Linecast(start, end, out hit, layerMask); + + private static void DrawSphere(Vector3 position, float size, Color color) => OnRush.DrawSphere(position, size, color); + } -} +} \ No newline at end of file diff --git a/KruacentExiled/KE.CustomRoles/Abilities/SimulateDeath.cs b/KruacentExiled/KE.CustomRoles/Abilities/SimulateDeath.cs index 7a4f18e7..d5a66c8b 100644 --- a/KruacentExiled/KE.CustomRoles/Abilities/SimulateDeath.cs +++ b/KruacentExiled/KE.CustomRoles/Abilities/SimulateDeath.cs @@ -34,8 +34,8 @@ protected override Dictionary> SetTranslation } public Utils.API.GifAnimator.TextImage IconName => MainPlugin.Instance.icons[Name]; - public override float Cooldown { get; } = 60f; - public float Duration { get; set; } = 10f; + public override float Cooldown => 60f; + public float Duration => 10f; private Ragdoll ragdoll; private Vector3 pScale; diff --git a/KruacentExiled/KE.CustomRoles/CR/MTF/RedMist/RedMist.cs b/KruacentExiled/KE.CustomRoles/CR/MTF/RedMist/RedMist.cs index c998e661..85314856 100644 --- a/KruacentExiled/KE.CustomRoles/CR/MTF/RedMist/RedMist.cs +++ b/KruacentExiled/KE.CustomRoles/CR/MTF/RedMist/RedMist.cs @@ -1,18 +1,12 @@ -using Exiled.API.Enums; -using Exiled.API.Features; +using Exiled.API.Features; +using Exiled.API.Features.Items; using Exiled.Events.EventArgs.Player; -using KE.CustomRoles.Abilities.RedMist; +using Exiled.Events.EventArgs.Scp1509; using KE.CustomRoles.API.Features; using KE.CustomRoles.API.Interfaces; -using KE.CustomRoles.CR.CustomSCPs.SCP049C; -using KE.Items.API.Features; -using MEC; using PlayerRoles; using System; using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; using UnityEngine; namespace KE.CustomRoles.CR.MTF.RedMist @@ -55,9 +49,8 @@ protected override Dictionary> SetTranslation //If you let people on your team die you get weaker, you are a protector afterall. //faster, 200hp, machete mais 200 hp de dégats (75 pour les humains) - //+shield belt //+ego : quick heal drain pause when attacking, 80 damage reduction faster - //forward slash : remove 25hp max to a min of 25hp, damage everything on its path max distance of a room + //forward slash : damage everything on its path max distance of a room public override HashSet Abilities { get; } = [ @@ -71,10 +64,10 @@ protected override void GiveInventory(Player player) { try { - //KECustomItem shieldbelt = KECustomItem.Get("Shield belt"); - //shieldbelt?.Give(player, false); - player.AddItem(ItemType.SCP1509); + //ci + Item i = player.AddItem(ItemType.SCP1509); + } catch (Exception e) { @@ -108,6 +101,7 @@ protected override void RoleRemoved(Player player) protected override void SubscribeEvents() { Exiled.Events.Handlers.Player.Hurt += OnHurt; + Exiled.Events.Handlers.Scp1509.Resurrecting += OnResurrecting; base.SubscribeEvents(); } @@ -117,6 +111,14 @@ protected override void UnsubscribeEvents() base.UnsubscribeEvents(); } + private void OnResurrecting(ResurrectingEventArgs ev) + { + Player player = ev.Player; + if (!Check(player)) return; + + ev.IsAllowed = false; + } + private void OnHurt(HurtEventArgs ev) { From ff2173912a719eac4b549e504fe361c015b9f066 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Sun, 22 Mar 2026 19:01:11 +0100 Subject: [PATCH 779/853] logo 035 --- .../CR/CustomSCPs/RemainingPlayerPosition.cs | 9 ++++++++ .../KE.CustomRoles/CR/CustomSCPs/SCP035.cs | 22 ++++++++++++++++++- 2 files changed, 30 insertions(+), 1 deletion(-) diff --git a/KruacentExiled/KE.CustomRoles/CR/CustomSCPs/RemainingPlayerPosition.cs b/KruacentExiled/KE.CustomRoles/CR/CustomSCPs/RemainingPlayerPosition.cs index 5c20c9f4..215ea7c2 100644 --- a/KruacentExiled/KE.CustomRoles/CR/CustomSCPs/RemainingPlayerPosition.cs +++ b/KruacentExiled/KE.CustomRoles/CR/CustomSCPs/RemainingPlayerPosition.cs @@ -16,4 +16,13 @@ public class RemainingPlayerPosition : HintPosition public override HintAlignment HintAlignment => HintAlignment.Center; } + + public class LogoPosition : HintPosition + { + public override float Xposition => 1700; + + public override float Yposition => 60; + + public override HintAlignment HintAlignment => HintAlignment.Center; + } } diff --git a/KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP035.cs b/KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP035.cs index 8076d9ed..8053178a 100644 --- a/KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP035.cs +++ b/KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP035.cs @@ -22,6 +22,7 @@ using System; using System.Collections.Generic; using System.Text; +using UnityEngine; using VoiceChat.Networking; namespace KE.CustomRoles.CR.CustomSCPs @@ -117,6 +118,7 @@ protected override void UnsubscribeEvents() base.UnsubscribeEvents(); } private static HintPosition position = new RemainingPlayerPosition(); + private static HintPosition logoposition = new LogoPosition(); private void OnDying(DyingEventArgs ev) { if (!Check(ev.Player)) return; @@ -168,6 +170,7 @@ protected override void RoleAdded(Player player) { PlayerDisplay dis = PlayerDisplay.Get(player); DisplayHandler.Instance.CreateAuto(player, (args) => GetPlayers(args), position.HintPlacement,HintServiceMeow.Core.Enum.HintSyncSpeed.Normal); + DisplayHandler.Instance.CreateAuto(player, (args) => GetLogo(args), logoposition.HintPlacement,HintServiceMeow.Core.Enum.HintSyncSpeed.Normal); @@ -178,6 +181,15 @@ protected override void RoleAdded(Player player) base.RoleAdded(player); } + protected override void RoleRemoved(Player player) + { + DisplayHandler.Instance.RemoveHint(player, position.HintPlacement); + DisplayHandler.Instance.RemoveHint(player, logoposition.HintPlacement); + + + base.RoleRemoved(player); + } + @@ -187,8 +199,16 @@ private string GetPlayers(AutoContentUpdateArg arg) if (!Check(Player.Get(arg.PlayerDisplay.ReferenceHub))) return string.Empty; - return "👤" + RoundSummary.singleton.TargetCount.ToString() + ""; + return "" + Mathf.Clamp(RoundSummary.singleton.TargetCount,0,9).ToString() + ""; + //👤8 + } + + private string GetLogo(AutoContentUpdateArg arg) + { + if (!Check(Player.Get(arg.PlayerDisplay.ReferenceHub))) + return string.Empty; + return "👤"; } From 38a2b81788ab9cfb07f37801977afb172c38c930 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Sun, 22 Mar 2026 19:11:04 +0100 Subject: [PATCH 780/853] scp049 spawn --- KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP035.cs | 2 +- .../KE.CustomRoles/CR/CustomSCPs/SCP049C/SCP049CRole.cs | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP035.cs b/KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP035.cs index 8053178a..3ebc6714 100644 --- a/KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP035.cs +++ b/KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP035.cs @@ -186,7 +186,7 @@ protected override void RoleRemoved(Player player) DisplayHandler.Instance.RemoveHint(player, position.HintPlacement); DisplayHandler.Instance.RemoveHint(player, logoposition.HintPlacement); - + player.DisableEffect(); base.RoleRemoved(player); } diff --git a/KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP049C/SCP049CRole.cs b/KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP049C/SCP049CRole.cs index 9ecb5d63..a82a213c 100644 --- a/KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP049C/SCP049CRole.cs +++ b/KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP049C/SCP049CRole.cs @@ -1,4 +1,5 @@ -using Exiled.API.Features; +using Exiled.API.Extensions; +using Exiled.API.Features; using Exiled.Events.EventArgs.Player; using Exiled.Events.EventArgs.Scp049; using KE.CustomRoles.API.Features; @@ -64,7 +65,7 @@ protected override void RoleAdded(Player player) } - + player.Position = RoleTypeId.Scp939.GetRandomSpawnLocation().Position; base.RoleAdded(player); } From a2d944ec740c92f992eeb8f8b420b61e8a4905de Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Sun, 22 Mar 2026 19:36:43 +0100 Subject: [PATCH 781/853] ff end round + move set token --- KruacentExiled/KE.Misc/Handlers/ServerHandler.cs | 8 ++++++-- KruacentExiled/KE.Misc/MainPlugin.cs | 10 ++++++++-- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/KruacentExiled/KE.Misc/Handlers/ServerHandler.cs b/KruacentExiled/KE.Misc/Handlers/ServerHandler.cs index 4d10f12c..062d2d6d 100644 --- a/KruacentExiled/KE.Misc/Handlers/ServerHandler.cs +++ b/KruacentExiled/KE.Misc/Handlers/ServerHandler.cs @@ -1,4 +1,7 @@ -namespace KE.Misc.Handlers +using Exiled.API.Enums; +using Exiled.API.Features; + +namespace KE.Misc.Handlers { internal class ServerHandler { @@ -9,7 +12,8 @@ public void OnRoundStarted() MainPlugin.Instance.AutoTesla.StartLoop(); MainPlugin.Instance.SCPBuff.StartBuff(); - + Respawn.SetTokens(SpawnableFaction.NtfWave, 2); + Respawn.SetTokens(SpawnableFaction.ChaosWave, 2); /* string test = "test.png"; diff --git a/KruacentExiled/KE.Misc/MainPlugin.cs b/KruacentExiled/KE.Misc/MainPlugin.cs index 6818b042..0383b1ef 100644 --- a/KruacentExiled/KE.Misc/MainPlugin.cs +++ b/KruacentExiled/KE.Misc/MainPlugin.cs @@ -14,6 +14,7 @@ using KE.Utils.API.Settings.GlobalSettings; using KE.Utils.API.Translations; using KE.Misc.Features.PostNuke; +using Exiled.Events.EventArgs.Server; namespace KE.Misc { @@ -68,14 +69,14 @@ public override void OnEnabled() //SpawnLcz = new(); - Respawn.SetTokens(SpawnableFaction.NtfWave, 2); - Respawn.SetTokens(SpawnableFaction.ChaosWave, 2); + GlobalSettingsHandler.Instance.TryLoad(); GlobalSettingsHandler.Instance.SubscribeEvents(); RegisterTranslations(); harmony.PatchAll(Assembly); ClassDDoor.SubscribeEvents(); + ServerHandle.RoundEnded += OnRoundEnded; MiscFeature.SubscribeAllEvents(); AutoNukeAnnoucement.SubscribeEvents(); if (Config.GamblingCoin) @@ -96,6 +97,7 @@ public override void OnEnabled() public override void OnDisabled() { ServerHandle.RoundStarted -= ServerHandler.OnRoundStarted; + ServerHandle.RoundEnded -= OnRoundEnded; LabApi.Events.Handlers.ServerEvents.CassieQueuingScpTermination -= NoeDeath; AutoNukeAnnoucement.UnsubscribeEvents(); LastHuman.UnsubscribeEvents(); @@ -131,6 +133,10 @@ public override void OnDisabled() Instance = null; } + private void OnRoundEnded(Exiled.Events.EventArgs.Server.RoundEndedEventArgs ev) + { + Server.FriendlyFire = true; + } private void NoeDeath(CassieQueuingScpTerminationEventArgs ev) { From db35fff19810a12aabdd4d69674e8769700b6945 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Sun, 22 Mar 2026 19:40:13 +0100 Subject: [PATCH 782/853] change tier 3 requirement --- .../CR/CustomSCPs/SCP049C/SCP049CLevelSystem.cs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP049C/SCP049CLevelSystem.cs b/KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP049C/SCP049CLevelSystem.cs index 194209bc..d8f41495 100644 --- a/KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP049C/SCP049CLevelSystem.cs +++ b/KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP049C/SCP049CLevelSystem.cs @@ -141,6 +141,12 @@ public static int GetNbKillPerTier(int tier) //double result = ((-1) * Math.Pow(x, 2)) + (6*x)-1; //return (int)Math.Ceiling(result); + + if(tier == 2) + { + return 4; + } + return 2; } From 3cb70a94e57aae05645fab24a33f6598253a3b2b Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Sun, 22 Mar 2026 19:41:36 +0100 Subject: [PATCH 783/853] preparing --- KruacentExiled/KE.CustomRoles/Abilities/SetPosition.cs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/KruacentExiled/KE.CustomRoles/Abilities/SetPosition.cs b/KruacentExiled/KE.CustomRoles/Abilities/SetPosition.cs index 9b5f8453..f8507beb 100644 --- a/KruacentExiled/KE.CustomRoles/Abilities/SetPosition.cs +++ b/KruacentExiled/KE.CustomRoles/Abilities/SetPosition.cs @@ -73,10 +73,15 @@ private void TryDestroyFollowingTextToy(Player player) } } - protected override void AbilityRemoved(Player player) + private void RemovePosition(Player player) { SelectedTarget.Remove(player); TryDestroyFollowingTextToy(player); + } + + protected override void AbilityRemoved(Player player) + { + RemovePosition(player); base.AbilityRemoved(player); } From bfbec190e0d70409ef90467613ce19e59390627d Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Tue, 24 Mar 2026 19:09:54 +0100 Subject: [PATCH 784/853] setposition now destroy if too far away --- .../API/Features/KEAbilities.cs | 2 +- .../KE.CustomRoles/Abilities/SetPosition.cs | 136 ++++++++++++++---- 2 files changed, 112 insertions(+), 26 deletions(-) diff --git a/KruacentExiled/KE.CustomRoles/API/Features/KEAbilities.cs b/KruacentExiled/KE.CustomRoles/API/Features/KEAbilities.cs index e1fae151..60628c32 100644 --- a/KruacentExiled/KE.CustomRoles/API/Features/KEAbilities.cs +++ b/KruacentExiled/KE.CustomRoles/API/Features/KEAbilities.cs @@ -85,7 +85,7 @@ private void OneTimeInit() activated = true; } - public void Init() + public virtual void Init() { if (NameToAbility.ContainsKey(Name)) { diff --git a/KruacentExiled/KE.CustomRoles/Abilities/SetPosition.cs b/KruacentExiled/KE.CustomRoles/Abilities/SetPosition.cs index f8507beb..cae83532 100644 --- a/KruacentExiled/KE.CustomRoles/Abilities/SetPosition.cs +++ b/KruacentExiled/KE.CustomRoles/Abilities/SetPosition.cs @@ -1,7 +1,9 @@ using Exiled.API.Features; using KE.CustomRoles.API.Features; using KE.CustomRoles.API.Interfaces; +using KE.Utils.API.Features; using KE.Utils.API.KETextToy; +using MEC; using System.Collections.Generic; using UnityEngine; @@ -12,6 +14,7 @@ public class SetPosition : KEAbilities, ICustomIcon public override string Name { get; } = "SetPosition"; public const string TranslationNoTarget = "SetPositionNoTarget"; + public const string TranslationTooFar = "SetPositionTooFar"; protected override Dictionary> SetTranslation() { return new() @@ -21,75 +24,158 @@ protected override Dictionary> SetTranslation [TranslationKeyName] = "Set Position", [TranslationKeyDesc] = "Select the current position for another ability", [TranslationNoTarget] = "No target set", + [TranslationTooFar] = "Position destroyed : too far away", }, ["fr"] = new() { [TranslationKeyName] = "Selection de position", [TranslationKeyDesc] = "Selectionne la position pour une autre abilité", [TranslationNoTarget] = "Pas de position mise", + [TranslationTooFar] = "Position détruite : trop loin", } }; } public override float Cooldown { get; } = 5f; + public Utils.API.GifAnimator.TextImage IconName => MainPlugin.Instance.icons[Name]; - private static Dictionary SelectedTarget = new(); - private static Dictionary SelectedTextToys = new(); - public Utils.API.GifAnimator.TextImage IconName => MainPlugin.Instance.icons[Name]; protected override bool AbilityUsed(Player player) { Vector3 position = player.Position; + if(SetPositionPosition.TryGet(player,out var setPosition)) + { + setPosition.Destroy(); + } - SelectedTarget[player] = position; - - - TryDestroyFollowingTextToy(player); - + - SelectedTextToys[player] = new FollowingTextToy([player], position, Quaternion.identity, Vector3.one); - FollowingTextToy followingTextToy = SelectedTextToys[player]; + FollowingTextToy followingTextToy = new FollowingTextToy([player], position, Quaternion.identity, Vector3.one); + new SetPositionPosition(player,position, followingTextToy); + followingTextToy.OnlyMoveY = true; followingTextToy.Toy.TextFormat = "↓"; - Log.Debug("set position at " + position); return base.AbilityUsed(player); - } - private void TryDestroyFollowingTextToy(Player player) + + + + + + protected override void AbilityRemoved(Player player) { - if (SelectedTextToys.ContainsKey(player)) + if(SetPositionPosition.TryGet(player,out var position)) { - SelectedTextToys[player].Destroy(); + position.Destroy(); } + base.AbilityRemoved(player); } - private void RemovePosition(Player player) + public static bool TryGetTarget(Player p, out Vector3 target) { - SelectedTarget.Remove(player); - TryDestroyFollowingTextToy(player); + return SetPositionPosition.TryGetTarget(p, out target); } - protected override void AbilityRemoved(Player player) + private class SetPositionPosition { - RemovePosition(player); - base.AbilityRemoved(player); - } + public const float RefreshRate = 1f; + public const float MaxDistance = 25; + private static Dictionary SelectedTarget = new(); + public Player Player { get; private set; } + public Vector3 Position { get; } + public FollowingTextToy Follow { get; } + private readonly CoroutineHandle handle; + + public SetPositionPosition(Player player,Vector3 position, FollowingTextToy follow) + { + Position = position; + Follow = follow; + Player = player; + handle = Timing.RunCoroutine(CheckPosition()); + SelectedTarget.Add(Player, this); + } - public static bool TryGetTarget(Player p, out Vector3 target) - { - return SelectedTarget.TryGetValue(p, out target); + public static void TryDestroyFollowingTextToy(Player player) + { + if (SelectedTarget.ContainsKey(player)) + { + SetPositionPosition setposition = SelectedTarget[player]; + + if (setposition.Follow != null) + { + setposition.Follow.Destroy(); + } + } + } + + public static bool TryGet(Player player, out SetPositionPosition position) + { + return SelectedTarget.TryGetValue(player, out position); + } + + + public void Destroy() + { + Follow.Destroy(); + SelectedTarget.Remove(Player); + Timing.KillCoroutines(handle); + Player = null; + } + + private bool ToDestroy = false; + private IEnumerator CheckPosition() + { + while(Player != null && !ToDestroy) + { + float distance = (Position - Player.Position).sqrMagnitude; + + yield return Timing.WaitForSeconds(RefreshRate); + + if (distance >= MaxDistance * MaxDistance) + { + KELog.Debug("SetPosition to destroy "+ Position); + ToDestroy = true; + } + + + } + + if (ToDestroy) + { + string msg = SetPosition.GetTranslation(Player, SetPosition.TranslationTooFar); + + Items.Utils.HintFeed.AddFeed(Player, msg); + + KELog.Debug($"SetPosition ({Position}) destroyed : too far"); + Destroy(); + } + } + + + public static bool TryGetTarget(Player player, out Vector3 target) + { + target = Vector3.zero; + bool result = SelectedTarget.TryGetValue(player, out SetPositionPosition position); + if (result) + { + target = position.Position; + } + + return result; + } } + } } From b3bc2b4409787cf9bbcfe10c5b25da7d628e7288 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Tue, 24 Mar 2026 19:10:10 +0100 Subject: [PATCH 785/853] tried fixing redmist again --- .../RedMist/GreaterSplitHorizontal.cs | 49 +++++++++++++------ 1 file changed, 35 insertions(+), 14 deletions(-) diff --git a/KruacentExiled/KE.CustomRoles/Abilities/RedMist/GreaterSplitHorizontal.cs b/KruacentExiled/KE.CustomRoles/Abilities/RedMist/GreaterSplitHorizontal.cs index 1c71344e..6923d090 100644 --- a/KruacentExiled/KE.CustomRoles/Abilities/RedMist/GreaterSplitHorizontal.cs +++ b/KruacentExiled/KE.CustomRoles/Abilities/RedMist/GreaterSplitHorizontal.cs @@ -156,6 +156,24 @@ private static bool CheckPoint(Vector3 point,Vector3 center, Vector3 direction) DrawSphere(position, .1f, Color.cyan); + float rad = halfAngle * Mathf.Deg2Rad; + + Vector2 leftDir = new Vector2( + dir.x * Mathf.Cos(rad) - dir.y * Mathf.Sin(rad), + dir.x * Mathf.Sin(rad) + dir.y * Mathf.Cos(rad) + ); + + Vector2 rightDir = new Vector2( + dir.x * Mathf.Cos(-rad) - dir.y * Mathf.Sin(-rad), + dir.x * Mathf.Sin(-rad) + dir.y * Mathf.Cos(-rad) + ); + + Vector3 leftPoint = center + new Vector3(leftDir.x, 0, leftDir.y) * Size; + Vector3 rightPoint = center + new Vector3(rightDir.x, 0, rightDir.y) * Size; + + DrawSphere(leftPoint, 0.2f, Color.green); + DrawSphere(rightPoint, 0.2f, Color.red); + return Vector2.Dot(dir, pointDir) >= cosThreshold; } @@ -227,29 +245,31 @@ private void Update() private void LaunchedAttack(float remainingTime) { - + + if (player == null || player.GameObject == null) return; KELog.Debug("remainign time=" + remainingTime); - Vector3 feetposition = player.Position - (Vector3.up * player.Scale.y) / 2 + player.CameraTransform.forward * .1f; - - - Vector3 direction = player.CameraTransform.forward; + Vector3 feetposition = player.Position - (Vector3.up * player.Scale.y) / 2 + player.Transform.forward * .1f; + + Vector3 direction = player.Transform.forward; + direction = direction.NormalizeIgnoreY(); - DrawSphere(feetposition, Size, Color.yellow); - + //DrawSphere(feetposition, Size, Color.yellow); + int detect = Physics.OverlapSphereNonAlloc(feetposition, Size, NonAlloc, HitregUtils.DetectionMask); KELog.Debug("detect=" + detect); + /* Collider collider; for (int i = 0; i < detect; i++) { collider = NonAlloc[i]; - if(collider == null) + if (collider == null || collider.gameObject == null) { continue; } @@ -273,16 +293,17 @@ private void LaunchedAttack(float remainingTime) Player target = Player.Get(collider); - if (target != player) - { - DrawSphere(collider.transform.position, .2f, Color.red); - } + if (target == null || target == player) { continue; } - + + if (target != player) + { + DrawSphere(collider.transform.position, .2f, Color.red); + } if (destructible is not null) { @@ -290,7 +311,7 @@ private void LaunchedAttack(float remainingTime) destructible.Damage(Damage, handler, destructible.CenterOfMass); } } - + */ } } From b9ac360a6b63eb2a05b0b8ad8b645fec1df38bea Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Tue, 24 Mar 2026 19:12:29 +0100 Subject: [PATCH 786/853] moved feed to utils --- KruacentExiled/KE.Items/Utils/Feed.cs | 22 ---- KruacentExiled/KE.Items/Utils/HintFeed.cs | 106 ------------------ .../KE.Items/Utils/HintFeedPosition.cs | 45 -------- 3 files changed, 173 deletions(-) delete mode 100644 KruacentExiled/KE.Items/Utils/Feed.cs delete mode 100644 KruacentExiled/KE.Items/Utils/HintFeed.cs delete mode 100644 KruacentExiled/KE.Items/Utils/HintFeedPosition.cs diff --git a/KruacentExiled/KE.Items/Utils/Feed.cs b/KruacentExiled/KE.Items/Utils/Feed.cs deleted file mode 100644 index 8262d4f0..00000000 --- a/KruacentExiled/KE.Items/Utils/Feed.cs +++ /dev/null @@ -1,22 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace KE.Items.Utils -{ - public sealed class Feed - { - - public string RawHint { get; } - - public DateTime TimeCreated { get; } - - public Feed(string msg) - { - RawHint = msg; - TimeCreated = DateTime.Now; - } - } -} diff --git a/KruacentExiled/KE.Items/Utils/HintFeed.cs b/KruacentExiled/KE.Items/Utils/HintFeed.cs deleted file mode 100644 index cdf0d056..00000000 --- a/KruacentExiled/KE.Items/Utils/HintFeed.cs +++ /dev/null @@ -1,106 +0,0 @@ -using Exiled.API.Features; -using Exiled.API.Features.Pools; -using Exiled.API.Interfaces; -using HintServiceMeow.Core.Extension; -using HintServiceMeow.Core.Models.Hints; -using KE.Utils.API.Displays.DisplayMeow; -using KE.Utils.API.Features; -using MEC; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using System.Xml.Linq; - -namespace KE.Items.Utils -{ - public class HintFeed - { - private static readonly HintFeedPosition firstPosition = new(); - private static Dictionary playersFeed = new(); - public const int MaxFeed = 10; - - private readonly List _feeds; - private Player Player { get; } - public static float Duration { get; set; } = 10; - - private HintFeed(Player player) - { - Player = player; - _feeds = new(); - } - - public static HintFeed GetOrCreate(Player player) - { - if(!playersFeed.TryGetValue(player,out HintFeed feed)) - { - feed = new(player); - playersFeed[player] = feed; - } - return feed; - } - - public static Feed AddFeed(Player player,string msg) - { - HintFeed hint = GetOrCreate(player); - Feed feed = new Feed(msg); - - hint.AddFeed(feed); - - return feed; - } - - - public void AddFeed(Feed feed) - { - _feeds.Add(feed); - UpdateDisplay(); - Timing.CallDelayed(Duration, () => - { - _feeds.Remove(feed); - UpdateDisplay(); - }); - } - - - public void UpdateDisplay() - { - for (int i = 0; i < MaxFeed; i++) - { - HintPlacement placement = HintFeedPosition.GetIndex(i).HintPlacement; - if (_feeds.TryGet(i, out Feed fe)) - { - KELog.Debug(fe.RawHint); - KELog.Debug("at "+i); - - DisplayHandler.Instance.CreateAuto(Player, (args) => GetUpdate(fe), placement, HintServiceMeow.Core.Enum.HintSyncSpeed.Normal); - } - else - { - KELog.Debug("removing feed at " + i); - DisplayHandler.Instance.RemoveHint(Player, placement); - } - - } - } - - private string GetUpdate(Feed feed) - { - StringBuilder sb = StringBuilderPool.Pool.Get(); - - sb.Append(Math.Truncate(DateTime.Now.Subtract(feed.TimeCreated).TotalSeconds)); - - sb.Append("s ago - "); - sb.Append(feed.RawHint); - - - return StringBuilderPool.Pool.ToStringReturn(sb); - } - - - - - - } -} diff --git a/KruacentExiled/KE.Items/Utils/HintFeedPosition.cs b/KruacentExiled/KE.Items/Utils/HintFeedPosition.cs deleted file mode 100644 index 3dc5778b..00000000 --- a/KruacentExiled/KE.Items/Utils/HintFeedPosition.cs +++ /dev/null @@ -1,45 +0,0 @@ -using Exiled.API.Features; -using HintServiceMeow.Core.Enum; -using KE.Utils.API.Displays.DisplayMeow.Placements; -using KE.Utils.API.Features; -using System.Collections.Generic; - -namespace KE.Items.Utils -{ - public sealed class HintFeedPosition : HintPosition - { - public const float BaseYPosition = 150; - public const float Increments = -50; - private float yposition = BaseYPosition; - public override float Xposition => -350; - - public override float Yposition => yposition; - - private int index; - public int Index => index; - - private static List nonalloc = new(HintFeed.MaxFeed); - - - public static HintFeedPosition GetIndex(int index) - { - if (!nonalloc.TryGet(index, out HintFeedPosition position)) - { - position = new HintFeedPosition() - { - yposition = BaseYPosition + index * 25, - index = index - }; - } - //KELog.Debug($"get index {index} y pos=" + position.Yposition); - return position; - - } - - public override HintAlignment HintAlignment => HintAlignment.Left; - public override string Name => "HintFeed"; - - - - } -} From 17d0c965fd0377a81cf3ad1303c918efc5364497 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Tue, 24 Mar 2026 19:14:31 +0100 Subject: [PATCH 787/853] fix usings --- KruacentExiled/KE.Items/Commands/ForceAddFeed.cs | 8 ++------ KruacentExiled/KE.Items/Items/MScan.cs | 7 +------ 2 files changed, 3 insertions(+), 12 deletions(-) diff --git a/KruacentExiled/KE.Items/Commands/ForceAddFeed.cs b/KruacentExiled/KE.Items/Commands/ForceAddFeed.cs index ace602b5..ede1ba02 100644 --- a/KruacentExiled/KE.Items/Commands/ForceAddFeed.cs +++ b/KruacentExiled/KE.Items/Commands/ForceAddFeed.cs @@ -1,17 +1,13 @@ using CommandSystem; using Exiled.API.Features; -using KE.Items.Utils; +using KE.Utils.API.Displays.Feeds; using MEC; using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; namespace KE.Items.Commands { [CommandHandler(typeof(RemoteAdminCommandHandler))] - internal class ForceAddFeed : KE.Utils.API.Commands.KECommand + internal class ForceAddFeed : Utils.API.Commands.KECommand { public override string Command => "forceaddfeed"; diff --git a/KruacentExiled/KE.Items/Items/MScan.cs b/KruacentExiled/KE.Items/Items/MScan.cs index e8f6e8ec..bd0c92e3 100644 --- a/KruacentExiled/KE.Items/Items/MScan.cs +++ b/KruacentExiled/KE.Items/Items/MScan.cs @@ -1,22 +1,17 @@ using AdminToys; using Exiled.API.Enums; using Exiled.API.Features; -using Exiled.API.Features.Attributes; using Exiled.API.Features.Pickups; using Exiled.API.Features.Pools; using Exiled.API.Features.Roles; using Exiled.API.Features.Spawn; using Exiled.API.Features.Toys; -using Exiled.API.Structs; -using Exiled.CustomItems.API.Features; -using Exiled.CustomRoles.Commands; using Exiled.Events.EventArgs.Player; -using Exiled.Events.EventArgs.Scp049; using Exiled.Events.EventArgs.Scp096; using Exiled.Events.EventArgs.Scp106; using Exiled.Events.EventArgs.Scp939; using KE.Items.API.Features; -using KE.Items.Utils; +using KE.Utils.API.Displays.Feeds; using MEC; using System.Collections.Generic; using UnityEngine; From bcf8dd81327c6cc0ef4b87241b1aa64e3cd0b965 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Tue, 24 Mar 2026 19:17:20 +0100 Subject: [PATCH 788/853] added translation feed --- KruacentExiled/KE.Items/API/Features/KECustomItem.cs | 6 ++++++ KruacentExiled/KE.Items/Items/MScan.cs | 8 ++++---- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/KruacentExiled/KE.Items/API/Features/KECustomItem.cs b/KruacentExiled/KE.Items/API/Features/KECustomItem.cs index d7a71c57..efa50621 100644 --- a/KruacentExiled/KE.Items/API/Features/KECustomItem.cs +++ b/KruacentExiled/KE.Items/API/Features/KECustomItem.cs @@ -8,6 +8,7 @@ using KE.Items.API.Features.SpawnPoints; using KE.Items.API.Interface; using KE.Utils.API.Displays.DisplayMeow; +using KE.Utils.API.Displays.Feeds; using KE.Utils.API.Translations; using PlayerRoles.SpawnData; using System; @@ -103,6 +104,11 @@ public static void TranslationHint(Player player,string key) ItemEffectHint(player, GetTranslation(player, key)); } + public static void TranslationFeed(Player player,string key) + { + HintFeed.AddFeed(player, GetTranslation(player, key)); + } + public override void Init() { _typeLookup.Add(GetType(), this); diff --git a/KruacentExiled/KE.Items/Items/MScan.cs b/KruacentExiled/KE.Items/Items/MScan.cs index bd0c92e3..5461fa9e 100644 --- a/KruacentExiled/KE.Items/Items/MScan.cs +++ b/KruacentExiled/KE.Items/Items/MScan.cs @@ -157,7 +157,7 @@ private void OnDroppedItem(DroppedItemEventArgs ev) BatteryLife[pickup] = Time.time + TimeUp; //Models[pickup] = CreateBaseModel(pickup); - HintFeed.AddFeed(player, GetTranslation(player, Deploy)); + TranslationFeed(player, Deploy); } } @@ -182,7 +182,7 @@ protected override void OnPickingUp(PickingUpItemEventArgs ev) { Remove(pickup); - HintFeed.AddFeed(player, GetTranslation(player, PickUp)); + TranslationFeed(player, PickUp); } } @@ -206,7 +206,7 @@ private void CheckDestruction(Vector3 hitPos, float radius) toDestroy.Add(sensor); if (owner != null) { - HintFeed.AddFeed(owner, GetTranslation(owner, TranslationDestroy)); + TranslationFeed(owner, TranslationDestroy); } } } @@ -240,7 +240,7 @@ private void CheckBattery() Player player = ActiveSensors[key]; if (player != null) { - HintFeed.AddFeed(player, GetTranslation(player, NoBattery)); + TranslationFeed(player, NoBattery); } invalid.Add(key); } From e3f9611d093445ff4f5daa952df68b7685388c5c Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Tue, 24 Mar 2026 19:19:53 +0100 Subject: [PATCH 789/853] added translation feed --- KruacentExiled/KE.CustomRoles/API/Features/KEAbilities.cs | 7 +++++++ KruacentExiled/KE.CustomRoles/Abilities/SetPosition.cs | 4 +--- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/KruacentExiled/KE.CustomRoles/API/Features/KEAbilities.cs b/KruacentExiled/KE.CustomRoles/API/Features/KEAbilities.cs index 60628c32..338d3884 100644 --- a/KruacentExiled/KE.CustomRoles/API/Features/KEAbilities.cs +++ b/KruacentExiled/KE.CustomRoles/API/Features/KEAbilities.cs @@ -12,6 +12,7 @@ using KE.Utils.API; using KE.Utils.API.Displays.DisplayMeow; using KE.Utils.API.Displays.DisplayMeow.Placements; +using KE.Utils.API.Displays.Feeds; using KE.Utils.API.Features; using KE.Utils.API.Translations; using MEC; @@ -130,6 +131,12 @@ public static void ShowEffectHint(Player player, string text, float delay) delay = MainPlugin.SettingHandler.GetTime(player); DisplayHandler.Instance.AddHint(MainPlugin.CREffect, player, text, delay); } + + + public static void TranslationFeed(Player player, string key) + { + HintFeed.AddFeed(player, GetTranslation(player, key)); + } public void Destroy() { InternalUnsubcribeEvent(); diff --git a/KruacentExiled/KE.CustomRoles/Abilities/SetPosition.cs b/KruacentExiled/KE.CustomRoles/Abilities/SetPosition.cs index cae83532..3750775a 100644 --- a/KruacentExiled/KE.CustomRoles/Abilities/SetPosition.cs +++ b/KruacentExiled/KE.CustomRoles/Abilities/SetPosition.cs @@ -152,10 +152,8 @@ private IEnumerator CheckPosition() if (ToDestroy) { - string msg = SetPosition.GetTranslation(Player, SetPosition.TranslationTooFar); - - Items.Utils.HintFeed.AddFeed(Player, msg); + TranslationFeed(Player, SetPosition.TranslationTooFar); KELog.Debug($"SetPosition ({Position}) destroyed : too far"); Destroy(); } From 289928eb6ac8052c960c789a772686d919b55b92 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Thu, 2 Apr 2026 12:26:43 +0200 Subject: [PATCH 790/853] redmist --- .../RedMist/GreaterSplitHorizontal.cs | 137 +++++++++--------- 1 file changed, 68 insertions(+), 69 deletions(-) diff --git a/KruacentExiled/KE.CustomRoles/Abilities/RedMist/GreaterSplitHorizontal.cs b/KruacentExiled/KE.CustomRoles/Abilities/RedMist/GreaterSplitHorizontal.cs index 6923d090..36a66a2b 100644 --- a/KruacentExiled/KE.CustomRoles/Abilities/RedMist/GreaterSplitHorizontal.cs +++ b/KruacentExiled/KE.CustomRoles/Abilities/RedMist/GreaterSplitHorizontal.cs @@ -1,10 +1,7 @@ using Exiled.API.Enums; using Exiled.API.Features; -using Exiled.API.Features.DamageHandlers; -using Exiled.Events.EventArgs.Item; using Exiled.Events.EventArgs.Scp1509; using InventorySystem.Items.MicroHID.Modules; -using KE.CustomRoles.API.Interfaces.Ability; using KE.CustomRoles.CR.MTF.RedMist; using KE.Utils.API.Features; using MEC; @@ -12,7 +9,6 @@ using System; using System.Collections.Generic; using UnityEngine; -using UnityEngine.Pool; namespace KE.CustomRoles.Abilities.RedMist { public class GreaterSplitHorizontal : EgoAbility @@ -105,6 +101,7 @@ private void OnTriggeringAttack(TriggeringAttackEventArgs ev) if (!Check(player)) return; if (player.GameObject.TryGetComponent(out var comp)) { + ev.IsAllowed = false; comp.OnTriggerAttack(); } @@ -116,13 +113,7 @@ private void OnTriggeringAttack(TriggeringAttackEventArgs ev) protected override bool LaunchedAbility(Player player,EGO ego) { - - - KELog.Debug("check weapopgn"); - - - if(player.CurrentItem is null || player.CurrentItem.Type != ItemType.SCP1509) { ShowEffectHint(player, FailWeapon); @@ -138,45 +129,56 @@ protected override bool LaunchedAbility(Player player,EGO ego) return true; } - private static bool CheckPoint(Vector3 point,Vector3 center, Vector3 direction) + private static bool CheckPoint(Vector3 point, Vector3 center, Vector3 direction) { + Vector2 position = new Vector2(point.x - center.x, point.z - center.z); + float sqrMag = position.sqrMagnitude; - Vector2 position = new Vector2(point.x - center.x, point.z - center.z); + if (sqrMag <= 0.0001f) + return false; - float radius = position.magnitude; + float radius = Mathf.Sqrt(sqrMag); if (radius > Size) return false; - Vector2 dir = new Vector2(direction.x, direction.z).normalized; - Vector2 pointDir = position.normalized; - float sectorAngle = 60f; - float halfAngle = sectorAngle * 0.5f; - float cosThreshold = Mathf.Cos(halfAngle * Mathf.Deg2Rad); + Vector2 dir = new Vector2(direction.x, direction.z); - DrawSphere(position, .1f, Color.cyan); + if (dir.sqrMagnitude <= 0.0001f) + return false; - float rad = halfAngle * Mathf.Deg2Rad; + dir /= Mathf.Sqrt(dir.sqrMagnitude); // safe normalize - Vector2 leftDir = new Vector2( - dir.x * Mathf.Cos(rad) - dir.y * Mathf.Sin(rad), - dir.x * Mathf.Sin(rad) + dir.y * Mathf.Cos(rad) - ); + Vector2 pointDir = position / radius; // safer than normalized - Vector2 rightDir = new Vector2( - dir.x * Mathf.Cos(-rad) - dir.y * Mathf.Sin(-rad), - dir.x * Mathf.Sin(-rad) + dir.y * Mathf.Cos(-rad) - ); + float halfAngle = 30f; // 60 / 2 + float cosThreshold = Mathf.Cos(halfAngle * Mathf.Deg2Rad); + + float dot = Vector2.Dot(dir, pointDir); + float rad = halfAngle * Mathf.Deg2Rad; + + Vector2 leftDir = new Vector2(dir.x * Mathf.Cos(rad) - dir.y * Mathf.Sin(rad), dir.x * Mathf.Sin(rad) + dir.y * Mathf.Cos(rad)); + Vector2 rightDir = new Vector2(dir.x * Mathf.Cos(-rad) - dir.y * Mathf.Sin(-rad), dir.x * Mathf.Sin(-rad) + dir.y * Mathf.Cos(-rad)); Vector3 leftPoint = center + new Vector3(leftDir.x, 0, leftDir.y) * Size; Vector3 rightPoint = center + new Vector3(rightDir.x, 0, rightDir.y) * Size; + KELog.Debug("center =" + center); + KELog.Debug("left =" + leftPoint); + KELog.Debug("rightPoint =" + rightPoint); DrawSphere(leftPoint, 0.2f, Color.green); DrawSphere(rightPoint, 0.2f, Color.red); + if (float.IsNaN(dot)) + { + Log.Error("NaN detected in CheckPoint"); + return false; + } + + DrawSphere(center + new Vector3(position.x, 0, position.y), .1f, Color.cyan); - return Vector2.Dot(dir, pointDir) >= cosThreshold; + return dot >= cosThreshold; } - + private static bool Linecast(Vector3 start, Vector3 end, out RaycastHit hit, int layerMask) => OnRush.Linecast(start, end, out hit, layerMask); private static void DrawSphere(Vector3 position, float size, Color color) => OnRush.DrawSphere(position, size, color); @@ -186,7 +188,6 @@ private static bool CheckPoint(Vector3 point,Vector3 center, Vector3 direction) private class AttackGreaterSplit : MonoBehaviour { private Player player; - private readonly Collider[] NonAlloc = new Collider[64]; private bool currentUsing; private bool attacking; private GreaterSplitHorizontal ability; @@ -222,7 +223,9 @@ private void Update() time -= Timing.DeltaTime; - if(time <= 0 || attacking) + + + if (time <= 0 || attacking) { if (ability.Check(player)) { @@ -242,77 +245,73 @@ private void Update() } + private bool InSphere(Vector3 center,Vector3 position,float radius) + { + float sqrDistance = (position - center).sqrMagnitude; + float sqrRadius = radius * radius; + + return sqrDistance <= sqrRadius; + } private void LaunchedAttack(float remainingTime) { if (player == null || player.GameObject == null) return; KELog.Debug("remainign time=" + remainingTime); - - Vector3 feetposition = player.Position - (Vector3.up * player.Scale.y) / 2 + player.Transform.forward * .1f; - - + Vector3 direction = player.Transform.forward; direction = direction.NormalizeIgnoreY(); - //DrawSphere(feetposition, Size, Color.yellow); + //NorthwoodLib.Pools.HashSetPool.Shared.Rent(); + HashSet toDamage = new(); + Vector3 position = player.Position; - - - int detect = Physics.OverlapSphereNonAlloc(feetposition, Size, NonAlloc, HitregUtils.DetectionMask); - KELog.Debug("detect=" + detect); - - /* - Collider collider; - for (int i = 0; i < detect; i++) + foreach (Player target in Player.List) { - collider = NonAlloc[i]; - if (collider == null || collider.gameObject == null) + Vector3 targetPosition = target.Position; + KELog.Debug("sphere"); + + if(player == target) { continue; } - if (!CheckPoint(collider.transform.position, feetposition, direction)) + if (!InSphere(position, targetPosition, 5)) { continue; } - - if (!collider.TryGetComponent(out var destructible) || destructible == null) + //KELog.Debug("fornt"); + if (!CheckPoint(targetPosition, position, direction)) { continue; } - if (Linecast(feetposition, destructible.CenterOfMass, out var hitInfo, PlayerRolesUtils.AttackMask) - && collider != hitInfo.collider) + KELog.Debug("linecast"); + if (!Linecast(position, targetPosition, out var hitInfo, PlayerRolesUtils.AttackMask)) { continue; } - - Player target = Player.Get(collider); - + KELog.Debug("add damage"); + //DrawSphere(targetPosition, .2f, Color.red); + toDamage.Add(target); - if (target == null || target == player) - { - continue; - } - if (target != player) - { - DrawSphere(collider.transform.position, .2f, Color.red); - } + } - if (destructible is not null) - { - PlayerStatsSystem.DamageHandlerBase handler = new GenericDamageHandler(target, player, Damage, DamageType.Scp1509, new DamageHandlerBase.CassieAnnouncement("")).Base; - destructible.Damage(Damage, handler, destructible.CenterOfMass); - } + + foreach (Player target in toDamage) + { + KELog.Debug("damaging" + target.Nickname); + + //target.Hurt(Damage, DamageType.Scp1509); } - */ + //NorthwoodLib.Pools.HashSetPool.Shared.Return(toDamage); } + } } From 001b00a4d61590360490a516d87b8251109c04ae Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Thu, 2 Apr 2026 13:09:07 +0200 Subject: [PATCH 791/853] update +fix cradsh --- KruacentExiled/KE.CustomRoles/API/Features/KECustomRole.cs | 2 +- .../API/HintPositions/CurrentCustomRolePosition.cs | 2 ++ KruacentExiled/KE.CustomRoles/KE.CustomRoles.csproj | 2 +- KruacentExiled/KE.CustomRoles/MainPlugin.cs | 5 ++--- 4 files changed, 6 insertions(+), 5 deletions(-) diff --git a/KruacentExiled/KE.CustomRoles/API/Features/KECustomRole.cs b/KruacentExiled/KE.CustomRoles/API/Features/KECustomRole.cs index fb61c997..4bd85792 100644 --- a/KruacentExiled/KE.CustomRoles/API/Features/KECustomRole.cs +++ b/KruacentExiled/KE.CustomRoles/API/Features/KECustomRole.cs @@ -281,7 +281,7 @@ public static void RespawnCustomRole(RespawnedTeamEventArgs ev) GiveRandomRole(ev.Players); } - public static void ShowCustomRole(JoinedEventArgs ev) + public static void ShowCustomRole(VerifiedEventArgs ev) { Timing.CallDelayed(1, delegate { diff --git a/KruacentExiled/KE.CustomRoles/API/HintPositions/CurrentCustomRolePosition.cs b/KruacentExiled/KE.CustomRoles/API/HintPositions/CurrentCustomRolePosition.cs index ac8412de..e818cbbe 100644 --- a/KruacentExiled/KE.CustomRoles/API/HintPositions/CurrentCustomRolePosition.cs +++ b/KruacentExiled/KE.CustomRoles/API/HintPositions/CurrentCustomRolePosition.cs @@ -15,5 +15,7 @@ public class CurrentCustomRolePosition : HintPosition public override float Yposition => 1030; public override HintAlignment HintAlignment => HintAlignment.Center; + + public override string Name => "CurrentRole"; } } diff --git a/KruacentExiled/KE.CustomRoles/KE.CustomRoles.csproj b/KruacentExiled/KE.CustomRoles/KE.CustomRoles.csproj index da36960a..8c298ee6 100644 --- a/KruacentExiled/KE.CustomRoles/KE.CustomRoles.csproj +++ b/KruacentExiled/KE.CustomRoles/KE.CustomRoles.csproj @@ -5,7 +5,7 @@ - + diff --git a/KruacentExiled/KE.CustomRoles/MainPlugin.cs b/KruacentExiled/KE.CustomRoles/MainPlugin.cs index cf289c23..08ec9811 100644 --- a/KruacentExiled/KE.CustomRoles/MainPlugin.cs +++ b/KruacentExiled/KE.CustomRoles/MainPlugin.cs @@ -96,15 +96,14 @@ public void SubscribeEvents() Misc.Features.Spawn.Spawn.OnAssigned += KECustomRole.SpawnStartRound; Exiled.Events.Handlers.Server.RespawnedTeam += KECustomRole.RespawnCustomRole; Exiled.Events.Handlers.Server.WaitingForPlayers += KECustomRole.ResetNumberOfSpawn; - Exiled.Events.Handlers.Player.Joined += KECustomRole.ShowCustomRole; + Exiled.Events.Handlers.Player.Verified += KECustomRole.ShowCustomRole; } public void UnsubscribeEvents() { Misc.Features.Spawn.Spawn.OnAssigned -= KECustomRole.SpawnStartRound; Exiled.Events.Handlers.Server.RespawnedTeam -= KECustomRole.RespawnCustomRole; Exiled.Events.Handlers.Server.WaitingForPlayers -= KECustomRole.ResetNumberOfSpawn; - - Exiled.Events.Handlers.Player.Joined -= KECustomRole.ShowCustomRole; + Exiled.Events.Handlers.Player.Verified -= KECustomRole.ShowCustomRole; } From cb3bb2832856a7685ff6318780c13c1891e0a8e0 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Thu, 2 Apr 2026 18:13:13 +0200 Subject: [PATCH 792/853] end greater spliut + started spear --- .../RedMist/GreaterSplitHorizontal.cs | 318 -------------- .../GreaterSplitHorizontal.cs | 400 ++++++++++++++++++ .../Abilities/RedMist/OnRush.cs | 2 +- .../KE.CustomRoles/Abilities/RedMist/Spear.cs | 136 ------ .../Abilities/RedMist/Spear/Spear.cs | 70 +++ .../RedMist/Spear/SpearProjectile.cs | 36 ++ 6 files changed, 507 insertions(+), 455 deletions(-) delete mode 100644 KruacentExiled/KE.CustomRoles/Abilities/RedMist/GreaterSplitHorizontal.cs create mode 100644 KruacentExiled/KE.CustomRoles/Abilities/RedMist/GreaterSplitHorizontal/GreaterSplitHorizontal.cs delete mode 100644 KruacentExiled/KE.CustomRoles/Abilities/RedMist/Spear.cs create mode 100644 KruacentExiled/KE.CustomRoles/Abilities/RedMist/Spear/Spear.cs create mode 100644 KruacentExiled/KE.CustomRoles/Abilities/RedMist/Spear/SpearProjectile.cs diff --git a/KruacentExiled/KE.CustomRoles/Abilities/RedMist/GreaterSplitHorizontal.cs b/KruacentExiled/KE.CustomRoles/Abilities/RedMist/GreaterSplitHorizontal.cs deleted file mode 100644 index 36a66a2b..00000000 --- a/KruacentExiled/KE.CustomRoles/Abilities/RedMist/GreaterSplitHorizontal.cs +++ /dev/null @@ -1,318 +0,0 @@ -using Exiled.API.Enums; -using Exiled.API.Features; -using Exiled.Events.EventArgs.Scp1509; -using InventorySystem.Items.MicroHID.Modules; -using KE.CustomRoles.CR.MTF.RedMist; -using KE.Utils.API.Features; -using MEC; -using PlayerRoles; -using System; -using System.Collections.Generic; -using UnityEngine; -namespace KE.CustomRoles.Abilities.RedMist -{ - public class GreaterSplitHorizontal : EgoAbility - { - public const string FailEgo = "OnRushFailEGO"; - public const string FailWeapon = "OnRushFailWeapon"; - - - public override string Name { get; } = "GreaterSplitHorizontal"; - protected override Dictionary> SetTranslation() - { - return new() - { - ["en"] = new() - { - [TranslationKeyName] = "Greater Split : Horizontal", - [TranslationKeyDesc] = "Manifest your E.G.O, gain powerful buff but rapid health drain.\nCan be deactivated anytime", - ["OnRushFailEGO"] = "You need to manifest your E.G.O. first", - ["OnRushFailWeapon"] = "You need your weapon", - }, - ["fr"] = new() - { - [TranslationKeyName] = "todo", - [TranslationKeyDesc] = "todo", - ["OnRushFailEGO"] = "todo", - ["OnRushFailWeapon"] = "todo", - } - }; - } - public override float Cooldown { get; } = 0f; - - protected override NeedActive NeedEGOActive => NeedActive.Either; // active - - public const float Damage = 200; - - public const float MaxDistance = 5; - - - - - public static readonly LayerMasks Mask = LayerMasks.Scp173Teleport | LayerMasks.Glass; - - public const float Size = 5; - - - - - protected override void AbilityAdded(Player player) - { - - if (!player.GameObject.TryGetComponent(out var comp)) - { - comp = player.GameObject.AddComponent(); - } - comp.Init(player, this); - - - base.AbilityAdded(player); - } - - protected override void AbilityRemoved(Player player) - { - if (player.GameObject.TryGetComponent(out var comp)) - { - UnityEngine.Object.Destroy(comp); - } - base.AbilityRemoved(player); - } - - - protected override void SubscribeEvents() - { - Exiled.Events.Handlers.Scp1509.TriggeringAttack += OnTriggeringAttack; - base.SubscribeEvents(); - } - - protected override void UnsubscribeEvents() - { - Exiled.Events.Handlers.Scp1509.TriggeringAttack -= OnTriggeringAttack; - base.UnsubscribeEvents(); - } - - - - - - private void OnTriggeringAttack(TriggeringAttackEventArgs ev) - { - Player player = ev.Player; - if (!Check(player)) return; - if (player.GameObject.TryGetComponent(out var comp)) - { - ev.IsAllowed = false; - comp.OnTriggerAttack(); - } - - } - - - - - - protected override bool LaunchedAbility(Player player,EGO ego) - { - KELog.Debug("check weapopgn"); - if(player.CurrentItem is null || player.CurrentItem.Type != ItemType.SCP1509) - { - ShowEffectHint(player, FailWeapon); - return false; - } - - - if (player.GameObject.TryGetComponent(out var comp)) - { - comp.StartAttack(); - } - - - return true; - } - private static bool CheckPoint(Vector3 point, Vector3 center, Vector3 direction) - { - Vector2 position = new Vector2(point.x - center.x, point.z - center.z); - - float sqrMag = position.sqrMagnitude; - - if (sqrMag <= 0.0001f) - return false; - - float radius = Mathf.Sqrt(sqrMag); - if (radius > Size) - return false; - - Vector2 dir = new Vector2(direction.x, direction.z); - - if (dir.sqrMagnitude <= 0.0001f) - return false; - - dir /= Mathf.Sqrt(dir.sqrMagnitude); // safe normalize - - Vector2 pointDir = position / radius; // safer than normalized - - float halfAngle = 30f; // 60 / 2 - float cosThreshold = Mathf.Cos(halfAngle * Mathf.Deg2Rad); - - float dot = Vector2.Dot(dir, pointDir); - float rad = halfAngle * Mathf.Deg2Rad; - - Vector2 leftDir = new Vector2(dir.x * Mathf.Cos(rad) - dir.y * Mathf.Sin(rad), dir.x * Mathf.Sin(rad) + dir.y * Mathf.Cos(rad)); - Vector2 rightDir = new Vector2(dir.x * Mathf.Cos(-rad) - dir.y * Mathf.Sin(-rad), dir.x * Mathf.Sin(-rad) + dir.y * Mathf.Cos(-rad)); - - Vector3 leftPoint = center + new Vector3(leftDir.x, 0, leftDir.y) * Size; - Vector3 rightPoint = center + new Vector3(rightDir.x, 0, rightDir.y) * Size; - KELog.Debug("center =" + center); - KELog.Debug("left =" + leftPoint); - KELog.Debug("rightPoint =" + rightPoint); - - DrawSphere(leftPoint, 0.2f, Color.green); - DrawSphere(rightPoint, 0.2f, Color.red); - if (float.IsNaN(dot)) - { - Log.Error("NaN detected in CheckPoint"); - return false; - } - - DrawSphere(center + new Vector3(position.x, 0, position.y), .1f, Color.cyan); - - return dot >= cosThreshold; - } - - private static bool Linecast(Vector3 start, Vector3 end, out RaycastHit hit, int layerMask) => OnRush.Linecast(start, end, out hit, layerMask); - - private static void DrawSphere(Vector3 position, float size, Color color) => OnRush.DrawSphere(position, size, color); - - - - private class AttackGreaterSplit : MonoBehaviour - { - private Player player; - private bool currentUsing; - private bool attacking; - private GreaterSplitHorizontal ability; - public void Init(Player player,GreaterSplitHorizontal ability) - { - this.player = player; - this.ability = ability; - currentUsing = false; - attacking = false; - } - - private float time; - public void StartAttack() - { - currentUsing = true; - time = 10; - } - - - public void OnTriggerAttack() - { - if (currentUsing) - { - attacking = true; - } - } - - - private void Update() - { - if (!currentUsing) return; - - - time -= Timing.DeltaTime; - - - - if (time <= 0 || attacking) - { - if (ability.Check(player)) - { - try - { - LaunchedAttack(time); - } - catch(Exception e) - { - Log.Error(e); - } - - } - attacking = false; - currentUsing = false; - } - } - - - private bool InSphere(Vector3 center,Vector3 position,float radius) - { - float sqrDistance = (position - center).sqrMagnitude; - float sqrRadius = radius * radius; - - return sqrDistance <= sqrRadius; - } - - private void LaunchedAttack(float remainingTime) - { - - if (player == null || player.GameObject == null) return; - KELog.Debug("remainign time=" + remainingTime); - - Vector3 direction = player.Transform.forward; - - direction = direction.NormalizeIgnoreY(); - - //NorthwoodLib.Pools.HashSetPool.Shared.Rent(); - HashSet toDamage = new(); - Vector3 position = player.Position; - - foreach (Player target in Player.List) - { - - Vector3 targetPosition = target.Position; - KELog.Debug("sphere"); - - if(player == target) - { - continue; - } - - if (!InSphere(position, targetPosition, 5)) - { - continue; - } - - //KELog.Debug("fornt"); - if (!CheckPoint(targetPosition, position, direction)) - { - continue; - } - - KELog.Debug("linecast"); - if (!Linecast(position, targetPosition, out var hitInfo, PlayerRolesUtils.AttackMask)) - { - continue; - } - - KELog.Debug("add damage"); - //DrawSphere(targetPosition, .2f, Color.red); - toDamage.Add(target); - - - } - - - foreach (Player target in toDamage) - { - KELog.Debug("damaging" + target.Nickname); - - //target.Hurt(Damage, DamageType.Scp1509); - } - //NorthwoodLib.Pools.HashSetPool.Shared.Return(toDamage); - } - - } - - } -} diff --git a/KruacentExiled/KE.CustomRoles/Abilities/RedMist/GreaterSplitHorizontal/GreaterSplitHorizontal.cs b/KruacentExiled/KE.CustomRoles/Abilities/RedMist/GreaterSplitHorizontal/GreaterSplitHorizontal.cs new file mode 100644 index 00000000..8831e001 --- /dev/null +++ b/KruacentExiled/KE.CustomRoles/Abilities/RedMist/GreaterSplitHorizontal/GreaterSplitHorizontal.cs @@ -0,0 +1,400 @@ +using DrawableLine; +using Exiled.API.Enums; +using Exiled.API.Features; +using Exiled.CreditTags.Features; +using Exiled.Events.EventArgs.Scp1509; +using HintServiceMeow.Core.Enum; +using InventorySystem.Items.MicroHID.Modules; +using KE.CustomRoles.CR.MTF.RedMist; +using KE.CustomRoles.CR.SCP; +using KE.Utils.API.Displays.DisplayMeow; +using KE.Utils.API.Displays.DisplayMeow.Placements; +using KE.Utils.API.Features; +using MEC; +using PlayerRoles; +using System; +using System.Collections.Generic; +using UnityEngine; +namespace KE.CustomRoles.Abilities.RedMist.GreaterSplitHorizontal +{ + public class GreaterSplitHorizontal : EgoAbility + { + public const string FailEgo = "GreaterSplitFailEGO"; + public const string FailWeapon = "GreaterSplitFailWeapon"; + + + public override string Name { get; } = "GreaterSplitHorizontal"; + protected override Dictionary> SetTranslation() + { + return new() + { + ["en"] = new() + { + [TranslationKeyName] = "Greater Split : Horizontal", + [TranslationKeyDesc] = "Manifest your E.G.O, gain powerful buff but rapid health drain.\nCan be deactivated anytime", + [FailEgo] = "You need to manifest your E.G.O. first", + [FailWeapon] = "You need your weapon", + }, + ["fr"] = new() + { + [TranslationKeyName] = "todo", + [TranslationKeyDesc] = "todo", + [FailEgo] = "todo", + [FailWeapon] = "todo", + } + }; + } + public override float Cooldown { get; } = 0f; + + protected override NeedActive NeedEGOActive => NeedActive.NeedActive; + + public const float Damage = 200; + + public const float MaxDistance = 5; + + public static readonly LayerMasks Mask = LayerMasks.Scp173Teleport | LayerMasks.Glass; + protected override void AbilityAdded(Player player) + { + + if (!player.GameObject.TryGetComponent(out var comp)) + { + comp = player.GameObject.AddComponent(); + } + comp.Init(player, this); + + + base.AbilityAdded(player); + } + + protected override void AbilityRemoved(Player player) + { + if (player.GameObject.TryGetComponent(out var comp)) + { + UnityEngine.Object.Destroy(comp); + } + base.AbilityRemoved(player); + } + + + protected override void SubscribeEvents() + { + Exiled.Events.Handlers.Scp1509.TriggeringAttack += OnTriggeringAttack; + + base.SubscribeEvents(); + } + + protected override void UnsubscribeEvents() + { + Exiled.Events.Handlers.Scp1509.TriggeringAttack -= OnTriggeringAttack; + base.UnsubscribeEvents(); + } + + + + + + private void OnTriggeringAttack(TriggeringAttackEventArgs ev) + { + Player player = ev.Player; + if (!Check(player)) return; + if (!ev.IsAllowed) return; + if (player.GameObject.TryGetComponent(out var comp)) + { + ev.IsAllowed = !comp.OnTriggerAttack(); + + } + ev.Scp1509.NextResurrectTime = float.MaxValue; + } + + + + + + protected override bool LaunchedAbility(Player player,EGO ego) + { + KELog.Debug("check weapopgn"); + if(player.CurrentItem is null || player.CurrentItem.Type != ItemType.SCP1509) + { + ShowEffectHint(player, FailWeapon); + return false; + } + + + if (player.GameObject.TryGetComponent(out var comp)) + { + comp.StartAttack(); + } + + + return true; + } + + private class DebugPosition : HintPosition + { + public override float Xposition => 800; + public override float Yposition => 400; + public override HintAlignment HintAlignment => HintAlignment.Center; + public override string Name => "DebugGreaterSplit"; + } + + private class AttackGreaterSplit : MonoBehaviour + { + private Player player; + private bool currentUsing; + private bool attacking; + private GreaterSplitHorizontal ability; + public const float TimeAttack = 10; + private readonly float StartTimeAttack; + private readonly float EndTimeAttack; + + private const float HighPowerRequirement = .1f; + private const float MedPowerRequirement = .3f; + + + public AttackGreaterSplit() + { + + StartTimeAttack = Mathf.Abs(TimeAttack) / 2f; + EndTimeAttack = -StartTimeAttack; + + } + private static HintPosition Position = new DebugPosition(); + public void Init(Player player,GreaterSplitHorizontal ability) + { + this.player = player; + this.ability = ability; + currentUsing = false; + attacking = false; + + if (MainPlugin.Instance.Config.Debug) + { + DisplayHandler.Instance.CreateAuto(player, (args) => GetDebug(), Position.HintPlacement, HintSyncSpeed.Fast); + } + } + + private void OnDestroy() + { + + if(player != null) + { + DisplayHandler.Instance.RemoveHint(player, Position.HintPlacement); + } + + } + + + private string GetDebug() + { + float power = GetPower(time); + return "time = " + time + "\npower = " + power + '('+ GetPowerDebug(power) + ')'; + + } + + private string GetPowerDebug(float power) + { + if (power <= StartTimeAttack * HighPowerRequirement) + { + return "high"; + } + else if (power <= StartTimeAttack * MedPowerRequirement) + { + return "medium"; + } + else + { + return "low"; + } + } + + + private float time; + public void StartAttack() + { + currentUsing = true; + time = StartTimeAttack; + } + + + public bool OnTriggerAttack() + { + if (currentUsing) + { + attacking = true; + + } + return attacking; + } + + + private void Update() + { + try + { + UpdateAttack(); + } + catch(Exception e) + { + Log.Error(e); + } + } + + private void UpdateAttack() + { + if (!currentUsing) return; + + + time -= Timing.DeltaTime; + + + + if (time <= EndTimeAttack || attacking) + { + if (ability.Check(player)) + { + float power = GetPower(time); + + + LaunchedAttack(power); + } + attacking = false; + currentUsing = false; + } + } + + + public float GetPower(float time) + { + return Mathf.Abs(time); + } + + private void LaunchedAttack(float power) + { + + if (player == null || player.GameObject == null) return; + KELog.Debug($"power (0~{StartTimeAttack})= {power}"); + + float angle = 1f; + float range = 1f; + bool checkBack = false; + + + if(power <= StartTimeAttack * HighPowerRequirement) + { + angle = 60f; + range = 7f; + checkBack = true; + KELog.Debug("high power"); + } + else if (power <= StartTimeAttack * MedPowerRequirement) + { + angle = 60f; + range = 7f; + KELog.Debug("med power"); + } + else + { + angle = 30f; + range = 5f; + KELog.Debug("low power"); + } + + + + + + + Vector3 direction = player.Transform.forward.NormalizeIgnoreY(); + Vector3 directionBack = -player.Transform.forward.NormalizeIgnoreY(); + + + + Vector3 position = player.Position; + + foreach (Player target in Player.List) + { + + Vector3 targetPosition = target.Position; + KELog.Debug("fornt"); + + //!checkBack || CheckPoint(targetPosition,position, directionBack,range,angle) + + + if(!CheckPoint(targetPosition, position, direction, range, angle) & !(checkBack && CheckPoint(targetPosition, position, directionBack, range, angle))) + { + continue; + } + KELog.Debug("player "+ target.Nickname); + if (player == target) + { + continue; + } + + + KELog.Debug("linecast"); + if (Physics.Linecast(position, targetPosition, out var hitInfo, PlayerRolesUtils.AttackMask)) + { + continue; + } + + KELog.Debug("add damage"); + + + target.Hurt(Damage, DamageType.Scp1509); + + } + + } + + public const float height = 1f; + private bool CheckPoint(Vector3 point, Vector3 center, Vector3 direction, float size, float halfAngle) + { + Vector2 position = new Vector2(point.x - center.x, point.z - center.z); + + float sqrMag = position.sqrMagnitude; + + if (sqrMag <= 0.0001f) + return false; + + float radius = Mathf.Sqrt(sqrMag); + if (radius > size) + return false; + + Vector2 dir = new Vector2(direction.x, direction.z); + + if (dir.sqrMagnitude <= 0.0001f) + return false; + + dir /= Mathf.Sqrt(dir.sqrMagnitude); + + Vector2 pointDir = position / radius; + + float cosThreshold = Mathf.Cos(halfAngle * Mathf.Deg2Rad); + + float dot = Vector2.Dot(dir, pointDir); + float rad = halfAngle * Mathf.Deg2Rad; + + Vector2 leftDir = new Vector2(dir.x * Mathf.Cos(rad) - dir.y * Mathf.Sin(rad), dir.x * Mathf.Sin(rad) + dir.y * Mathf.Cos(rad)); + Vector2 rightDir = new Vector2(dir.x * Mathf.Cos(-rad) - dir.y * Mathf.Sin(-rad), dir.x * Mathf.Sin(-rad) + dir.y * Mathf.Cos(-rad)); + + Vector3 leftPoint = center + new Vector3(leftDir.x, 0, leftDir.y) * size; + Vector3 rightPoint = center + new Vector3(rightDir.x, 0, rightDir.y) * size; + + Vector3 frontPoint = player.Position + direction * size; + + DrawableLines.IsDebugModeEnabled = true; + DrawableLines.GenerateLine(10, Color.yellow,player.Position, leftPoint, frontPoint, rightPoint,player.Position); + + + KELog.Debug("center =" + center); + KELog.Debug("left =" + leftPoint); + KELog.Debug("rightPoint =" + rightPoint); + + + + return dot >= cosThreshold && point.y < center.y + height && point.y > center.y - height; + } + + } + + } +} diff --git a/KruacentExiled/KE.CustomRoles/Abilities/RedMist/OnRush.cs b/KruacentExiled/KE.CustomRoles/Abilities/RedMist/OnRush.cs index 470eec91..354547b1 100644 --- a/KruacentExiled/KE.CustomRoles/Abilities/RedMist/OnRush.cs +++ b/KruacentExiled/KE.CustomRoles/Abilities/RedMist/OnRush.cs @@ -155,7 +155,7 @@ public static bool Linecast(Vector3 start,Vector3 end,out RaycastHit hit,int lay { if (Debug) { - Draw.Line(start, end, Color.red, 10, Player.Enumerable); + //Draw.Line(start, end, Color.red, 10, Player.Enumerable); } diff --git a/KruacentExiled/KE.CustomRoles/Abilities/RedMist/Spear.cs b/KruacentExiled/KE.CustomRoles/Abilities/RedMist/Spear.cs deleted file mode 100644 index 85c5589c..00000000 --- a/KruacentExiled/KE.CustomRoles/Abilities/RedMist/Spear.cs +++ /dev/null @@ -1,136 +0,0 @@ -using Exiled.API.Enums; -using Exiled.API.Features; -using Exiled.API.Features.DamageHandlers; -using InventorySystem.Items.MicroHID.Modules; -using KE.CustomRoles.CR.MTF.RedMist; -using KE.Utils.API.Features; -using PlayerRoles; -using System.Collections.Generic; -using UnityEngine; - -namespace KE.CustomRoles.Abilities.RedMist -{ - public class Spear : EgoAbility - { - public override string Name { get; } = "Spear"; - protected override Dictionary> SetTranslation() - { - return new() - { - ["en"] = new() - { - [TranslationKeyName] = "Spear", - [TranslationKeyDesc] = "Manifest your E.G.O, gain powerful buff but rapid health drain.\nCan be deactivated anytime", - ["OnRushFailEGO"] = "You need to manifest your E.G.O. first", - ["OnRushFailWeapon"] = "You need your weapon", - }, - ["fr"] = new() - { - [TranslationKeyName] = "todo", - [TranslationKeyDesc] = "todo", - ["OnRushFailEGO"] = "todo", - ["OnRushFailWeapon"] = "todo", - } - }; - } - public override float Cooldown { get; } = 0f; - - protected override NeedActive NeedEGOActive => NeedActive.Either; - - public const float Damage = 200; - - public const float MaxDistance = 5; - - - private Collider[] NonAlloc = new Collider[64]; - - public static readonly LayerMasks Mask = LayerMasks.Scp173Teleport | LayerMasks.Glass; - - public const float Size = 5; - protected override bool LaunchedAbility(Player player, EGO ego) - { - - - KELog.Debug("check weapopgn"); - - - - if (player.CurrentItem is null || player.CurrentItem.Type != ItemType.SCP1509) - { - //show OnRushFailWeapon - return false; - } - - - Vector3 feetposition = player.Position - (Vector3.up * player.Scale.y) / 2 + player.CameraTransform.forward * .1f; - - - Vector3 direction = player.CameraTransform.forward; - - direction = direction.NormalizeIgnoreY(); - - DrawSphere(feetposition, Size, Color.yellow); - - - - int detect = Physics.OverlapSphereNonAlloc(feetposition, Size, NonAlloc, HitregUtils.DetectionMask); - Collider collider; - for (int i = 0; i < detect; i++) - { - collider = NonAlloc[i]; - - if (!CheckPoint(collider.transform.position, feetposition, direction)) - { - continue; - } - - - if (collider.TryGetComponent(out var destructible) && - (!Linecast(feetposition, destructible?.CenterOfMass ?? Vector3.zero, out var hitInfo, PlayerRolesUtils.AttackMask) - || collider == hitInfo.collider)) - { - Player target = Player.Get(collider); - - if (target is null || target != player) - { - DrawSphere(collider.transform.position, .2f, Color.red); - } - - - if (destructible is not null) - { - PlayerStatsSystem.DamageHandlerBase handler = new GenericDamageHandler(target, player, Damage, DamageType.Scp1509, new DamageHandlerBase.CassieAnnouncement("")).Base; - destructible.Damage(Damage, handler, destructible.CenterOfMass); - } - } - } - return true; - } - private static bool CheckPoint(Vector3 point, Vector3 center, Vector3 direction) - { - - - Vector2 position = new Vector2(point.x - center.x, point.z - center.z); - - float radius = position.magnitude; - if (radius > Size) - return false; - - Vector2 dir = new Vector2(direction.x, direction.z).normalized; - Vector2 pointDir = position.normalized; - float sectorAngle = 60f; - float halfAngle = sectorAngle * 0.5f; - float cosThreshold = Mathf.Cos(halfAngle * Mathf.Deg2Rad); - - DrawSphere(position, .1f, Color.cyan); - - return Vector2.Dot(dir, pointDir) >= cosThreshold; - } - - private bool Linecast(Vector3 start, Vector3 end, out RaycastHit hit, int layerMask) => OnRush.Linecast(start, end, out hit, layerMask); - - private static void DrawSphere(Vector3 position, float size, Color color) => OnRush.DrawSphere(position, size, color); - - - } -} \ No newline at end of file diff --git a/KruacentExiled/KE.CustomRoles/Abilities/RedMist/Spear/Spear.cs b/KruacentExiled/KE.CustomRoles/Abilities/RedMist/Spear/Spear.cs new file mode 100644 index 00000000..7eac04f4 --- /dev/null +++ b/KruacentExiled/KE.CustomRoles/Abilities/RedMist/Spear/Spear.cs @@ -0,0 +1,70 @@ +using Exiled.API.Enums; +using Exiled.API.Features; +using Exiled.API.Features.DamageHandlers; +using InventorySystem.Items.MicroHID.Modules; +using KE.CustomRoles.CR.MTF.RedMist; +using KE.Utils.API.Features; +using PlayerRoles; +using System.Collections.Generic; +using UnityEngine; +using static PlayerRoles.PlayableScps.VisionInformation; + +namespace KE.CustomRoles.Abilities.RedMist.Spear +{ + public class Spear : EgoAbility + { + public const string FailWeapon = "SpearFailWeapon"; + public override string Name { get; } = "Spear"; + protected override Dictionary> SetTranslation() + { + return new() + { + ["en"] = new() + { + [TranslationKeyName] = "Spear", + [TranslationKeyDesc] = "Manifest your E.G.O, gain powerful buff but rapid health drain.\nCan be deactivated anytime", + [FailWeapon] = "You need your weapon", + }, + ["fr"] = new() + { + [TranslationKeyName] = "todo", + [TranslationKeyDesc] = "todo", + [FailWeapon] = "todo", + } + }; + } + public override float Cooldown { get; } = 0f; + + protected override NeedActive NeedEGOActive => NeedActive.Either; + + public const float Damage = 200; + + public const float MaxDistance = 5; + + + + + protected override bool LaunchedAbility(Player player, EGO ego) + { + KELog.Debug("check weapopgn"); + if (player.CurrentItem is null || player.CurrentItem.Type != ItemType.SCP1509) + { + ShowEffectHint(player, FailWeapon); + return false; + } + + + if (player.GameObject.TryGetComponent(out var comp)) + { + comp.StartAttack(); + } + + + return true; + } + + + + + } +} \ No newline at end of file diff --git a/KruacentExiled/KE.CustomRoles/Abilities/RedMist/Spear/SpearProjectile.cs b/KruacentExiled/KE.CustomRoles/Abilities/RedMist/Spear/SpearProjectile.cs new file mode 100644 index 00000000..6f86507e --- /dev/null +++ b/KruacentExiled/KE.CustomRoles/Abilities/RedMist/Spear/SpearProjectile.cs @@ -0,0 +1,36 @@ +using Exiled.API.Features.Toys; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using UnityEngine; +using Utils; + +namespace KE.CustomRoles.Abilities.RedMist.Spear +{ + [RequireComponent(typeof(Primitive))] + public class SpearProjectile : MonoBehaviour + { + private Primitive primitive; + + + private void Awake() + { + primitive = GetComponent(); + primitive.Collidable = false; + } + + + private void Update() + { + + Bounds b= new() + } + + + + + + } +} From 7beecd9e72f6e64783814db5b92782288bfaf1bd Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Fri, 3 Apr 2026 16:52:22 +0200 Subject: [PATCH 793/853] spear projectile + split greater split --- .../AttackGreaterSplitComp.cs | 278 ++++++++++++++++++ .../GreaterSplitHorizontal/DebugPosition.cs | 18 ++ .../GreaterSplitHorizontal.cs | 277 +---------------- .../Abilities/RedMist/Spear/Spear.cs | 9 +- .../RedMist/Spear/SpearProjectile.cs | 131 ++++++++- 5 files changed, 429 insertions(+), 284 deletions(-) create mode 100644 KruacentExiled/KE.CustomRoles/Abilities/RedMist/GreaterSplitHorizontal/AttackGreaterSplitComp.cs create mode 100644 KruacentExiled/KE.CustomRoles/Abilities/RedMist/GreaterSplitHorizontal/DebugPosition.cs diff --git a/KruacentExiled/KE.CustomRoles/Abilities/RedMist/GreaterSplitHorizontal/AttackGreaterSplitComp.cs b/KruacentExiled/KE.CustomRoles/Abilities/RedMist/GreaterSplitHorizontal/AttackGreaterSplitComp.cs new file mode 100644 index 00000000..14dd0b3b --- /dev/null +++ b/KruacentExiled/KE.CustomRoles/Abilities/RedMist/GreaterSplitHorizontal/AttackGreaterSplitComp.cs @@ -0,0 +1,278 @@ +using CustomPlayerEffects; +using DrawableLine; +using Exiled.API.Enums; +using Exiled.API.Features; +using HintServiceMeow.Core.Enum; +using KE.Utils.API.Displays.DisplayMeow; +using KE.Utils.API.Displays.DisplayMeow.Placements; +using KE.Utils.API.Features; +using MEC; +using PlayerRoles; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using UnityEngine; + +namespace KE.CustomRoles.Abilities.RedMist.GreaterSplitHorizontal +{ + public class AttackGreaterSplitComp : MonoBehaviour + { + private Player player; + private bool currentUsing; + private bool attacking; + private GreaterSplitHorizontal ability; + public const float TimeAttack = 10; + private readonly float StartTimeAttack; + private readonly float EndTimeAttack; + + private const float HighPowerRequirement = .1f; + private const float MedPowerRequirement = .3f; + + + public AttackGreaterSplitComp() + { + + StartTimeAttack = Mathf.Abs(TimeAttack) / 2f; + EndTimeAttack = -StartTimeAttack; + + } + private static HintPosition Position = new DebugPosition(); + public void Init(Player player, GreaterSplitHorizontal ability) + { + this.player = player; + this.ability = ability; + currentUsing = false; + attacking = false; + + if (MainPlugin.Instance.Config.Debug) + { + DisplayHandler.Instance.CreateAuto(player, (args) => GetDebug(), Position.HintPlacement, HintSyncSpeed.Fast); + } + } + + private void OnDestroy() + { + + if (player != null) + { + DisplayHandler.Instance.RemoveHint(player, Position.HintPlacement); + } + + } + + + private string GetDebug() + { + float power = GetPower(time); + return "time = " + time + "\npower = " + power + '(' + GetPowerDebug(power) + ')'; + + } + + private string GetPowerDebug(float power) + { + if (power <= StartTimeAttack * HighPowerRequirement) + { + return "high"; + } + else if (power <= StartTimeAttack * MedPowerRequirement) + { + return "medium"; + } + else + { + return "low"; + } + } + + + private float time; + public void StartAttack() + { + currentUsing = true; + time = StartTimeAttack; + } + + + public bool OnTriggerAttack() + { + if (currentUsing) + { + attacking = true; + + } + return attacking; + } + + + private void Update() + { + try + { + UpdateAttack(); + } + catch (Exception e) + { + Log.Error(e); + } + } + + private void UpdateAttack() + { + if (!currentUsing) return; + + + time -= Timing.DeltaTime; + + + + if (time <= EndTimeAttack || attacking) + { + if (ability.Check(player)) + { + float power = GetPower(time); + + LaunchedAttack(power); + } + attacking = false; + currentUsing = false; + } + } + + + public float GetPower(float time) + { + return Mathf.Abs(time); + } + + private void LaunchedAttack(float power) + { + + if (player == null || player.GameObject == null) return; + KELog.Debug($"power (0~{StartTimeAttack})= {power}"); + + float angle = 1f; + float range = 1f; + bool checkBack = false; + + + if (power <= StartTimeAttack * HighPowerRequirement) + { + angle = 60f; + range = 7f; + checkBack = true; + KELog.Debug("high power"); + } + else if (power <= StartTimeAttack * MedPowerRequirement) + { + angle = 60f; + range = 7f; + KELog.Debug("med power"); + } + else + { + angle = 30f; + range = 5f; + KELog.Debug("low power"); + } + + + + + + + Vector3 direction = player.Transform.forward.NormalizeIgnoreY(); + Vector3 directionBack = -player.Transform.forward.NormalizeIgnoreY(); + + + + Vector3 position = player.Position; + + foreach (Player target in Player.List) + { + + Vector3 targetPosition = target.Position; + KELog.Debug("fornt"); + + //!checkBack || CheckPoint(targetPosition,position, directionBack,range,angle) + + + if (!CheckPoint(targetPosition, position, direction, range, angle) & !(checkBack && CheckPoint(targetPosition, position, directionBack, range, angle))) + { + continue; + } + KELog.Debug("player " + target.Nickname); + if (player == target) + { + continue; + } + + + KELog.Debug("linecast"); + if (Physics.Linecast(position, targetPosition, out var hitInfo, PlayerRolesUtils.AttackMask)) + { + continue; + } + + KELog.Debug("add damage"); + + + target.Hurt(GreaterSplitHorizontal.Damage, DamageType.Scp1509); + + } + + } + + public const float height = 1f; + private bool CheckPoint(Vector3 point, Vector3 center, Vector3 direction, float size, float halfAngle) + { + Vector2 position = new Vector2(point.x - center.x, point.z - center.z); + + float sqrMag = position.sqrMagnitude; + + if (sqrMag <= 0.0001f) + return false; + + float radius = Mathf.Sqrt(sqrMag); + if (radius > size) + return false; + + Vector2 dir = new Vector2(direction.x, direction.z); + + if (dir.sqrMagnitude <= 0.0001f) + return false; + + dir /= Mathf.Sqrt(dir.sqrMagnitude); + + Vector2 pointDir = position / radius; + + float cosThreshold = Mathf.Cos(halfAngle * Mathf.Deg2Rad); + + float dot = Vector2.Dot(dir, pointDir); + float rad = halfAngle * Mathf.Deg2Rad; + + Vector2 leftDir = new Vector2(dir.x * Mathf.Cos(rad) - dir.y * Mathf.Sin(rad), dir.x * Mathf.Sin(rad) + dir.y * Mathf.Cos(rad)); + Vector2 rightDir = new Vector2(dir.x * Mathf.Cos(-rad) - dir.y * Mathf.Sin(-rad), dir.x * Mathf.Sin(-rad) + dir.y * Mathf.Cos(-rad)); + + Vector3 leftPoint = center + new Vector3(leftDir.x, 0, leftDir.y) * size; + Vector3 rightPoint = center + new Vector3(rightDir.x, 0, rightDir.y) * size; + + Vector3 frontPoint = player.Position + direction * size; + + DrawableLines.IsDebugModeEnabled = true; + DrawableLines.GenerateLine(10, Color.yellow, player.Position, leftPoint, frontPoint, rightPoint, player.Position); + + + KELog.Debug("center =" + center); + KELog.Debug("left =" + leftPoint); + KELog.Debug("rightPoint =" + rightPoint); + + + + return dot >= cosThreshold && point.y < center.y + height && point.y > center.y - height; + } + + } + +} diff --git a/KruacentExiled/KE.CustomRoles/Abilities/RedMist/GreaterSplitHorizontal/DebugPosition.cs b/KruacentExiled/KE.CustomRoles/Abilities/RedMist/GreaterSplitHorizontal/DebugPosition.cs new file mode 100644 index 00000000..3a2091a6 --- /dev/null +++ b/KruacentExiled/KE.CustomRoles/Abilities/RedMist/GreaterSplitHorizontal/DebugPosition.cs @@ -0,0 +1,18 @@ +using HintServiceMeow.Core.Enum; +using KE.Utils.API.Displays.DisplayMeow.Placements; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace KE.CustomRoles.Abilities.RedMist.GreaterSplitHorizontal +{ + public class DebugPosition : HintPosition + { + public override float Xposition => 800; + public override float Yposition => 400; + public override HintAlignment HintAlignment => HintAlignment.Center; + public override string Name => "DebugGreaterSplit"; + } +} diff --git a/KruacentExiled/KE.CustomRoles/Abilities/RedMist/GreaterSplitHorizontal/GreaterSplitHorizontal.cs b/KruacentExiled/KE.CustomRoles/Abilities/RedMist/GreaterSplitHorizontal/GreaterSplitHorizontal.cs index 8831e001..badf03ac 100644 --- a/KruacentExiled/KE.CustomRoles/Abilities/RedMist/GreaterSplitHorizontal/GreaterSplitHorizontal.cs +++ b/KruacentExiled/KE.CustomRoles/Abilities/RedMist/GreaterSplitHorizontal/GreaterSplitHorizontal.cs @@ -50,15 +50,14 @@ protected override Dictionary> SetTranslation public const float Damage = 200; - public const float MaxDistance = 5; public static readonly LayerMasks Mask = LayerMasks.Scp173Teleport | LayerMasks.Glass; protected override void AbilityAdded(Player player) { - if (!player.GameObject.TryGetComponent(out var comp)) + if (!player.GameObject.TryGetComponent(out var comp)) { - comp = player.GameObject.AddComponent(); + comp = player.GameObject.AddComponent(); } comp.Init(player, this); @@ -68,7 +67,7 @@ protected override void AbilityAdded(Player player) protected override void AbilityRemoved(Player player) { - if (player.GameObject.TryGetComponent(out var comp)) + if (player.GameObject.TryGetComponent(out var comp)) { UnityEngine.Object.Destroy(comp); } @@ -98,7 +97,7 @@ private void OnTriggeringAttack(TriggeringAttackEventArgs ev) Player player = ev.Player; if (!Check(player)) return; if (!ev.IsAllowed) return; - if (player.GameObject.TryGetComponent(out var comp)) + if (player.GameObject.TryGetComponent(out var comp)) { ev.IsAllowed = !comp.OnTriggerAttack(); @@ -120,7 +119,7 @@ protected override bool LaunchedAbility(Player player,EGO ego) } - if (player.GameObject.TryGetComponent(out var comp)) + if (player.GameObject.TryGetComponent(out var comp)) { comp.StartAttack(); } @@ -129,272 +128,8 @@ protected override bool LaunchedAbility(Player player,EGO ego) return true; } - private class DebugPosition : HintPosition - { - public override float Xposition => 800; - public override float Yposition => 400; - public override HintAlignment HintAlignment => HintAlignment.Center; - public override string Name => "DebugGreaterSplit"; - } - - private class AttackGreaterSplit : MonoBehaviour - { - private Player player; - private bool currentUsing; - private bool attacking; - private GreaterSplitHorizontal ability; - public const float TimeAttack = 10; - private readonly float StartTimeAttack; - private readonly float EndTimeAttack; - - private const float HighPowerRequirement = .1f; - private const float MedPowerRequirement = .3f; - - - public AttackGreaterSplit() - { - - StartTimeAttack = Mathf.Abs(TimeAttack) / 2f; - EndTimeAttack = -StartTimeAttack; - - } - private static HintPosition Position = new DebugPosition(); - public void Init(Player player,GreaterSplitHorizontal ability) - { - this.player = player; - this.ability = ability; - currentUsing = false; - attacking = false; - - if (MainPlugin.Instance.Config.Debug) - { - DisplayHandler.Instance.CreateAuto(player, (args) => GetDebug(), Position.HintPlacement, HintSyncSpeed.Fast); - } - } - - private void OnDestroy() - { - - if(player != null) - { - DisplayHandler.Instance.RemoveHint(player, Position.HintPlacement); - } - - } - - - private string GetDebug() - { - float power = GetPower(time); - return "time = " + time + "\npower = " + power + '('+ GetPowerDebug(power) + ')'; - - } - - private string GetPowerDebug(float power) - { - if (power <= StartTimeAttack * HighPowerRequirement) - { - return "high"; - } - else if (power <= StartTimeAttack * MedPowerRequirement) - { - return "medium"; - } - else - { - return "low"; - } - } - - - private float time; - public void StartAttack() - { - currentUsing = true; - time = StartTimeAttack; - } - - - public bool OnTriggerAttack() - { - if (currentUsing) - { - attacking = true; - - } - return attacking; - } - - - private void Update() - { - try - { - UpdateAttack(); - } - catch(Exception e) - { - Log.Error(e); - } - } - - private void UpdateAttack() - { - if (!currentUsing) return; - - - time -= Timing.DeltaTime; - - - - if (time <= EndTimeAttack || attacking) - { - if (ability.Check(player)) - { - float power = GetPower(time); - - - LaunchedAttack(power); - } - attacking = false; - currentUsing = false; - } - } - - - public float GetPower(float time) - { - return Mathf.Abs(time); - } - - private void LaunchedAttack(float power) - { - - if (player == null || player.GameObject == null) return; - KELog.Debug($"power (0~{StartTimeAttack})= {power}"); - - float angle = 1f; - float range = 1f; - bool checkBack = false; - - - if(power <= StartTimeAttack * HighPowerRequirement) - { - angle = 60f; - range = 7f; - checkBack = true; - KELog.Debug("high power"); - } - else if (power <= StartTimeAttack * MedPowerRequirement) - { - angle = 60f; - range = 7f; - KELog.Debug("med power"); - } - else - { - angle = 30f; - range = 5f; - KELog.Debug("low power"); - } - - - - - - - Vector3 direction = player.Transform.forward.NormalizeIgnoreY(); - Vector3 directionBack = -player.Transform.forward.NormalizeIgnoreY(); - - - - Vector3 position = player.Position; - - foreach (Player target in Player.List) - { - - Vector3 targetPosition = target.Position; - KELog.Debug("fornt"); - - //!checkBack || CheckPoint(targetPosition,position, directionBack,range,angle) - - - if(!CheckPoint(targetPosition, position, direction, range, angle) & !(checkBack && CheckPoint(targetPosition, position, directionBack, range, angle))) - { - continue; - } - KELog.Debug("player "+ target.Nickname); - if (player == target) - { - continue; - } - - - KELog.Debug("linecast"); - if (Physics.Linecast(position, targetPosition, out var hitInfo, PlayerRolesUtils.AttackMask)) - { - continue; - } - - KELog.Debug("add damage"); - - - target.Hurt(Damage, DamageType.Scp1509); - - } - - } - - public const float height = 1f; - private bool CheckPoint(Vector3 point, Vector3 center, Vector3 direction, float size, float halfAngle) - { - Vector2 position = new Vector2(point.x - center.x, point.z - center.z); - - float sqrMag = position.sqrMagnitude; - - if (sqrMag <= 0.0001f) - return false; - - float radius = Mathf.Sqrt(sqrMag); - if (radius > size) - return false; - - Vector2 dir = new Vector2(direction.x, direction.z); - - if (dir.sqrMagnitude <= 0.0001f) - return false; - - dir /= Mathf.Sqrt(dir.sqrMagnitude); - - Vector2 pointDir = position / radius; - - float cosThreshold = Mathf.Cos(halfAngle * Mathf.Deg2Rad); - - float dot = Vector2.Dot(dir, pointDir); - float rad = halfAngle * Mathf.Deg2Rad; - - Vector2 leftDir = new Vector2(dir.x * Mathf.Cos(rad) - dir.y * Mathf.Sin(rad), dir.x * Mathf.Sin(rad) + dir.y * Mathf.Cos(rad)); - Vector2 rightDir = new Vector2(dir.x * Mathf.Cos(-rad) - dir.y * Mathf.Sin(-rad), dir.x * Mathf.Sin(-rad) + dir.y * Mathf.Cos(-rad)); - - Vector3 leftPoint = center + new Vector3(leftDir.x, 0, leftDir.y) * size; - Vector3 rightPoint = center + new Vector3(rightDir.x, 0, rightDir.y) * size; - - Vector3 frontPoint = player.Position + direction * size; - - DrawableLines.IsDebugModeEnabled = true; - DrawableLines.GenerateLine(10, Color.yellow,player.Position, leftPoint, frontPoint, rightPoint,player.Position); - - - KELog.Debug("center =" + center); - KELog.Debug("left =" + leftPoint); - KELog.Debug("rightPoint =" + rightPoint); - - - - return dot >= cosThreshold && point.y < center.y + height && point.y > center.y - height; - } + - } } } diff --git a/KruacentExiled/KE.CustomRoles/Abilities/RedMist/Spear/Spear.cs b/KruacentExiled/KE.CustomRoles/Abilities/RedMist/Spear/Spear.cs index 7eac04f4..bba6f536 100644 --- a/KruacentExiled/KE.CustomRoles/Abilities/RedMist/Spear/Spear.cs +++ b/KruacentExiled/KE.CustomRoles/Abilities/RedMist/Spear/Spear.cs @@ -1,4 +1,5 @@ -using Exiled.API.Enums; +using DrawableLine; +using Exiled.API.Enums; using Exiled.API.Features; using Exiled.API.Features.DamageHandlers; using InventorySystem.Items.MicroHID.Modules; @@ -53,11 +54,7 @@ protected override bool LaunchedAbility(Player player, EGO ego) return false; } - - if (player.GameObject.TryGetComponent(out var comp)) - { - comp.StartAttack(); - } + SpearProjectile.Create(player, player.CameraTransform.forward); return true; diff --git a/KruacentExiled/KE.CustomRoles/Abilities/RedMist/Spear/SpearProjectile.cs b/KruacentExiled/KE.CustomRoles/Abilities/RedMist/Spear/SpearProjectile.cs index 6f86507e..1899f355 100644 --- a/KruacentExiled/KE.CustomRoles/Abilities/RedMist/Spear/SpearProjectile.cs +++ b/KruacentExiled/KE.CustomRoles/Abilities/RedMist/Spear/SpearProjectile.cs @@ -1,36 +1,153 @@ -using Exiled.API.Features.Toys; +using DrawableLine; +using Exiled.API.Enums; +using Exiled.API.Features; +using Exiled.API.Features.Toys; +using KE.Utils.API.Features; +using PlayerRoles; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; +using TMPro; using UnityEngine; using Utils; namespace KE.CustomRoles.Abilities.RedMist.Spear { - [RequireComponent(typeof(Primitive))] public class SpearProjectile : MonoBehaviour { - private Primitive primitive; + public static float Damage => Spear.Damage; + private Primitive _primitive; + private Vector3 _direction; + private Player _player; + public const float Speed = 30; - private void Awake() + public const float TimeBeforeMoving = 2f; + private float timeBeforeMove = 0f; + + public void Init(Primitive primitive,Player player, Vector3 direction) { - primitive = GetComponent(); - primitive.Collidable = false; + _player = player; + _direction = direction; + _primitive = primitive; + DrawableLines.IsDebugModeEnabled = true; + } + public const byte Fallback = 200; + private byte fallback = 0; + private const float SpeedRotation = 90f; + + private static readonly Vector3 SizeProjectile = new Vector3(1,.2f,.2f); + public static SpearProjectile Create(Player player, Vector3 direction) + { + var prim = Primitive.Create(player.Position, null, SizeProjectile, false); + prim.MovementSmoothing = 0; + prim.Collidable = false; + prim.Spawn(); + + SpearProjectile spear = prim.GameObject.AddComponent(); + + spear.Init(prim,player, direction); + + return spear; + + } + + private Collider[] NonAlloc = new Collider[64]; private void Update() { + if(fallback >= Fallback || _player == null || _player.GameObject == null) + { + Destroy(); + return; + } + + if (timeBeforeMove <= TimeBeforeMoving) + { + timeBeforeMove += Time.deltaTime; + _primitive.Rotation = _primitive.Rotation * Quaternion.Euler(0, SpeedRotation* Time.deltaTime, 0); + return; + } + + _primitive.Rotation.SetLookRotation(_direction); + - Bounds b= new() + UpdateDetect(); + UpdateMovement(); + } + private void UpdateMovement() + { + + Vector3 position = base.transform.position; + float checkDistance = base.transform.localScale.z; + DrawableLines.GenerateLine(.1f,Color.blue,position, position + _direction * checkDistance); + if (Physics.Raycast(position, _direction, checkDistance, (int)LayerMasks.AttackMask)) + { + KELog.Debug("hit wall"); + + Destroy(); + return; + + } + + _primitive.Position = _primitive.Position + _direction * Speed * Time.deltaTime; + fallback++; + } + private void UpdateDetect() + { + Vector3 position = base.transform.position; + float radius = _primitive.Scale.x /2f; + int detect = Physics.OverlapSphereNonAlloc(position, radius, NonAlloc, (int)LayerMasks.Hitbox); + + + + DrawableLines.GenerateSphere(position, radius, duration:.1f); + + KELog.Debug("detect=" + detect); + + for (int i = 0; i < detect; i++) + { + Collider collider = NonAlloc[i]; + + if (Player.TryGet(collider, out Player target)) + { + KELog.Debug("collider layer=" + collider.gameObject.layer); + + if (target == _player) + { + continue; + } + + if (HitboxIdentity.IsDamageable(_player.ReferenceHub, target.ReferenceHub)) + { + KELog.Debug("hurt "+ target.Nickname); + target.Hurt(_player, Damage, Exiled.API.Enums.DamageType.Scp1509); + Destroy(); + } + + + } + } + } + + + public void Destroy() + { + KELog.Debug($"destroyed ({fallback}/{Fallback})"); + + _primitive?.Destroy(); + Destroy(this); + } + } } From 909296099ca50ddc1fa0df9b288670ffe2f2ff57 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Fri, 3 Apr 2026 16:59:36 +0200 Subject: [PATCH 794/853] fix lobby steam not foudnd --- KruacentExiled/KE.Misc/Config.cs | 4 ---- .../KE.Misc/Features/VoteStart/VoteStart.cs | 14 ++++---------- 2 files changed, 4 insertions(+), 14 deletions(-) diff --git a/KruacentExiled/KE.Misc/Config.cs b/KruacentExiled/KE.Misc/Config.cs index 753bf022..98e85b92 100644 --- a/KruacentExiled/KE.Misc/Config.cs +++ b/KruacentExiled/KE.Misc/Config.cs @@ -29,10 +29,6 @@ public class Config : IConfig public int MinPlayerVote { get; set; } = 6; - public string PatchNote { get; set; } = "-Ajout d'un truc à Surface\r\n-Patch note dans le lobby\r\n-Ajout d'un nouveau custom SCP :\r\nun 049 qui n'a pas de zombie mais des buff à la place\r\n-Ajout d'un bouton pour remontré la description d'un custom role\r\n-Ajout d'un nouveau custom role : Le pacifiste (ClassD et Scientifique)\r\n-Ajout d'un nouveau custom role pour SCP173\r\n-Ajout d'une lumière au dos du Terroriste\r\n-Ajout d'une indication pour SetPosition\r\nuniquement visible pour le joueur ayant utilisé l'ability\r\n-Mise à jour des pickups models de la TP Grenada et de la Mine\r\n-La nuke (ni deadman ni auto) ajoute un respawn à la faction qui l'a activé\r\net met le timer à ~45s du respawn\r\n-auto nuke : 30 min -> 20 min\r\n-SCP-173 gambling est de nouveau interactable\r\nmais les items ne drop plus (sauf par manque de place)\r\nle temps d'utilisation : 10s -> 5s (approx)\r\n-Ajout de traduction aux custom roles et aux abilités\r\n-Shield Belt: 110HP -> 210HP\r\nAjout d'une taille min à la sphere de protection\r\n-Molotov <=> Heal zone à 914\r\n-Enlevé SCP-202\r\n-Removed Sou Hiyori from the facility\r\n"; - - - } } diff --git a/KruacentExiled/KE.Misc/Features/VoteStart/VoteStart.cs b/KruacentExiled/KE.Misc/Features/VoteStart/VoteStart.cs index c38c496f..758f468b 100644 --- a/KruacentExiled/KE.Misc/Features/VoteStart/VoteStart.cs +++ b/KruacentExiled/KE.Misc/Features/VoteStart/VoteStart.cs @@ -28,7 +28,7 @@ public override void SubscribeEvents() Exiled.Events.Handlers.Player.VoiceChatting += OnVoiceChatting; Exiled.Events.Handlers.Server.RoundStarted += OnRoundStarted; Exiled.Events.Handlers.Player.Left += OnLeft; - Exiled.Events.Handlers.Player.Joined += OnJoined; + Exiled.Events.Handlers.Player.Verified += OnVerified; base.SubscribeEvents(); } @@ -37,7 +37,7 @@ public override void UnsubscribeEvents() { Exiled.Events.Handlers.Server.WaitingForPlayers -= OnWaitingForPlayers; Exiled.Events.Handlers.Player.VoiceChatting -= OnVoiceChatting; - Exiled.Events.Handlers.Player.Joined -= OnJoined; + Exiled.Events.Handlers.Player.Verified -= OnVerified; Exiled.Events.Handlers.Server.RoundStarted -= OnRoundStarted; Exiled.Events.Handlers.Player.Left -= OnLeft; @@ -114,17 +114,11 @@ private void Init() voteCasted = false; } - private void OnJoined(JoinedEventArgs ev) + private void OnVerified(VerifiedEventArgs ev) { Player player = ev.Player; - if(ev.Player is null) - { - return; - } - - - if (!ev.Player.IsConnected) + if(ev.Player == null) { return; } From 73b2207f059ab578d3c422dfe713569087dcab5f Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Mon, 6 Apr 2026 13:11:34 +0200 Subject: [PATCH 795/853] update utils --- KruacentExiled/KE.CustomRoles/Abilities/SetPosition.cs | 2 +- KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP035.cs | 5 +++-- .../CR/CustomSCPs/SCP049C/RagdollArrowComp.cs | 8 +++++--- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/KruacentExiled/KE.CustomRoles/Abilities/SetPosition.cs b/KruacentExiled/KE.CustomRoles/Abilities/SetPosition.cs index 3750775a..e46f7c9f 100644 --- a/KruacentExiled/KE.CustomRoles/Abilities/SetPosition.cs +++ b/KruacentExiled/KE.CustomRoles/Abilities/SetPosition.cs @@ -62,7 +62,7 @@ protected override bool AbilityUsed(Player player) followingTextToy.OnlyMoveY = true; - followingTextToy.Toy.TextFormat = "↓"; + followingTextToy.Text = "↓"; Log.Debug("set position at " + position); return base.AbilityUsed(player); diff --git a/KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP035.cs b/KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP035.cs index 3ebc6714..7427c536 100644 --- a/KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP035.cs +++ b/KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP035.cs @@ -107,6 +107,7 @@ protected override void SubscribeEvents() base.SubscribeEvents(); } + protected override void UnsubscribeEvents() { Exiled.Events.Handlers.Player.Hurting -= OnHurting; @@ -324,12 +325,12 @@ private void OnResurrecting(ResurrectingEventArgs ev) public void OnEndingRound(EndingRoundEventArgs ev) { - if (TrackedPlayers.Count <= 0) return; + /*if (TrackedPlayers.Count <= 0) return; if (ev.ClassList.mtf_and_guards != 0 || ev.ClassList.scientists != 0) ev.IsAllowed = false; else if (ev.ClassList.class_ds != 0 || ev.ClassList.chaos_insurgents != 0) ev.IsAllowed = false; else if (ev.ClassList.scps_except_zombies + ev.ClassList.zombies > 0) ev.IsAllowed = true; - else ev.IsAllowed = true; + else ev.IsAllowed = true;*/ } } } diff --git a/KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP049C/RagdollArrowComp.cs b/KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP049C/RagdollArrowComp.cs index a2c88fc3..f46b5120 100644 --- a/KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP049C/RagdollArrowComp.cs +++ b/KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP049C/RagdollArrowComp.cs @@ -1,4 +1,6 @@ -using Exiled.API.Features; +using Exiled.API.Enums; +using Exiled.API.Features; +using Exiled.API.Features.DamageHandlers; using KE.Utils.API.Features; using KE.Utils.API.KETextToy; using NorthwoodLib.Pools; @@ -30,7 +32,7 @@ public void Init(Ragdoll ragdoll) private void Update() { - if (ragdoll.IsExpired && arrow == null) + if (ragdoll.IsExpired && arrow == null && ragdoll.DamageHandler is PlayerStatsSystem.AttackerDamageHandler) { CreateArrow(); } @@ -52,7 +54,7 @@ public void SetColor(Color color) sb.Append(""); - arrow.Toy.TextFormat = sb.ToString(); + arrow.Text = sb.ToString(); StringBuilderPool.Shared.Return(sb); From 444bd0666f8d48ef16650a663631eeaad9b6adbc Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Mon, 6 Apr 2026 13:11:51 +0200 Subject: [PATCH 796/853] redmist again --- .../AttackGreaterSplitComp.cs | 60 +++++++++++------ .../Abilities/RedMist/Spear/Spear.cs | 2 - .../Abilities/RedMist/Spear/SpearComp.cs | 16 +++++ .../Abilities/RedMist/ToggleEGO.cs | 11 +++ .../KE.CustomRoles/CR/MTF/RedMist/EGO.cs | 67 +++++++++++++++++-- .../KE.CustomRoles/CR/MTF/RedMist/RedMist.cs | 23 +------ 6 files changed, 129 insertions(+), 50 deletions(-) create mode 100644 KruacentExiled/KE.CustomRoles/Abilities/RedMist/Spear/SpearComp.cs diff --git a/KruacentExiled/KE.CustomRoles/Abilities/RedMist/GreaterSplitHorizontal/AttackGreaterSplitComp.cs b/KruacentExiled/KE.CustomRoles/Abilities/RedMist/GreaterSplitHorizontal/AttackGreaterSplitComp.cs index 14dd0b3b..922defbf 100644 --- a/KruacentExiled/KE.CustomRoles/Abilities/RedMist/GreaterSplitHorizontal/AttackGreaterSplitComp.cs +++ b/KruacentExiled/KE.CustomRoles/Abilities/RedMist/GreaterSplitHorizontal/AttackGreaterSplitComp.cs @@ -13,17 +13,20 @@ using System.Linq; using System.Text; using System.Threading.Tasks; +using TMPro; using UnityEngine; namespace KE.CustomRoles.Abilities.RedMist.GreaterSplitHorizontal { public class AttackGreaterSplitComp : MonoBehaviour { + + private static bool Debug => MainPlugin.Instance.Config.Debug; private Player player; private bool currentUsing; private bool attacking; private GreaterSplitHorizontal ability; - public const float TimeAttack = 10; + public const float TimeAttack = 3; private readonly float StartTimeAttack; private readonly float EndTimeAttack; @@ -46,9 +49,9 @@ public void Init(Player player, GreaterSplitHorizontal ability) currentUsing = false; attacking = false; - if (MainPlugin.Instance.Config.Debug) + if (Debug) { - DisplayHandler.Instance.CreateAuto(player, (args) => GetDebug(), Position.HintPlacement, HintSyncSpeed.Fast); + DisplayHandler.Instance.CreateAuto(player, (args) => GetDebug(), Position.HintPlacement, HintSyncSpeed.Fastest); } } @@ -189,14 +192,23 @@ private void LaunchedAttack(float power) Vector3 position = player.Position; + if (Debug) + { + CheckPoint(position, position, direction, range, angle); + if (checkBack) + { + CheckPoint(position, position, directionBack, range, angle); + } + } + + foreach (Player target in Player.List) { Vector3 targetPosition = target.Position; KELog.Debug("fornt"); - //!checkBack || CheckPoint(targetPosition,position, directionBack,range,angle) - + if (!CheckPoint(targetPosition, position, direction, range, angle) & !(checkBack && CheckPoint(targetPosition, position, directionBack, range, angle))) { @@ -228,9 +240,27 @@ private void LaunchedAttack(float power) private bool CheckPoint(Vector3 point, Vector3 center, Vector3 direction, float size, float halfAngle) { Vector2 position = new Vector2(point.x - center.x, point.z - center.z); - + Vector3 playerPosition = player.Position; float sqrMag = position.sqrMagnitude; + float rad = halfAngle * Mathf.Deg2Rad; + + Vector2 dir = new Vector2(direction.x, direction.z); + + dir /= Mathf.Sqrt(dir.sqrMagnitude); + Vector2 leftDir = new Vector2(dir.x * Mathf.Cos(rad) - dir.y * Mathf.Sin(rad), dir.x * Mathf.Sin(rad) + dir.y * Mathf.Cos(rad)); + Vector2 rightDir = new Vector2(dir.x * Mathf.Cos(-rad) - dir.y * Mathf.Sin(-rad), dir.x * Mathf.Sin(-rad) + dir.y * Mathf.Cos(-rad)); + + Vector3 leftPoint = center + new Vector3(leftDir.x, 0, leftDir.y) * size; + Vector3 rightPoint = center + new Vector3(rightDir.x, 0, rightDir.y) * size; + + Vector3 frontPoint = playerPosition + direction * size; + if (Debug) + { + DrawableLines.IsDebugModeEnabled = true; + DrawableLines.GenerateLine(10, Color.yellow, playerPosition, leftPoint, frontPoint, rightPoint, player.Position); + } + if (sqrMag <= 0.0001f) return false; @@ -238,30 +268,16 @@ private bool CheckPoint(Vector3 point, Vector3 center, Vector3 direction, float if (radius > size) return false; - Vector2 dir = new Vector2(direction.x, direction.z); - - if (dir.sqrMagnitude <= 0.0001f) - return false; - - dir /= Mathf.Sqrt(dir.sqrMagnitude); + Vector2 pointDir = position / radius; float cosThreshold = Mathf.Cos(halfAngle * Mathf.Deg2Rad); float dot = Vector2.Dot(dir, pointDir); - float rad = halfAngle * Mathf.Deg2Rad; - - Vector2 leftDir = new Vector2(dir.x * Mathf.Cos(rad) - dir.y * Mathf.Sin(rad), dir.x * Mathf.Sin(rad) + dir.y * Mathf.Cos(rad)); - Vector2 rightDir = new Vector2(dir.x * Mathf.Cos(-rad) - dir.y * Mathf.Sin(-rad), dir.x * Mathf.Sin(-rad) + dir.y * Mathf.Cos(-rad)); - - Vector3 leftPoint = center + new Vector3(leftDir.x, 0, leftDir.y) * size; - Vector3 rightPoint = center + new Vector3(rightDir.x, 0, rightDir.y) * size; - Vector3 frontPoint = player.Position + direction * size; - DrawableLines.IsDebugModeEnabled = true; - DrawableLines.GenerateLine(10, Color.yellow, player.Position, leftPoint, frontPoint, rightPoint, player.Position); + KELog.Debug("center =" + center); diff --git a/KruacentExiled/KE.CustomRoles/Abilities/RedMist/Spear/Spear.cs b/KruacentExiled/KE.CustomRoles/Abilities/RedMist/Spear/Spear.cs index bba6f536..ae55cb74 100644 --- a/KruacentExiled/KE.CustomRoles/Abilities/RedMist/Spear/Spear.cs +++ b/KruacentExiled/KE.CustomRoles/Abilities/RedMist/Spear/Spear.cs @@ -40,8 +40,6 @@ protected override Dictionary> SetTranslation public const float Damage = 200; - public const float MaxDistance = 5; - diff --git a/KruacentExiled/KE.CustomRoles/Abilities/RedMist/Spear/SpearComp.cs b/KruacentExiled/KE.CustomRoles/Abilities/RedMist/Spear/SpearComp.cs new file mode 100644 index 00000000..05786b39 --- /dev/null +++ b/KruacentExiled/KE.CustomRoles/Abilities/RedMist/Spear/SpearComp.cs @@ -0,0 +1,16 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using UnityEngine; + +namespace KE.CustomRoles.Abilities.RedMist.Spear +{ + public class SpearComp : MonoBehaviour + { + + + + } +} diff --git a/KruacentExiled/KE.CustomRoles/Abilities/RedMist/ToggleEGO.cs b/KruacentExiled/KE.CustomRoles/Abilities/RedMist/ToggleEGO.cs index 5e16a25d..4ada626e 100644 --- a/KruacentExiled/KE.CustomRoles/Abilities/RedMist/ToggleEGO.cs +++ b/KruacentExiled/KE.CustomRoles/Abilities/RedMist/ToggleEGO.cs @@ -59,5 +59,16 @@ protected override bool AbilityUsed(Player player) } + protected override void SubscribeEvents() + { + base.SubscribeEvents(); + } + + protected override void UnsubscribeEvents() + { + base.UnsubscribeEvents(); + } + + } } diff --git a/KruacentExiled/KE.CustomRoles/CR/MTF/RedMist/EGO.cs b/KruacentExiled/KE.CustomRoles/CR/MTF/RedMist/EGO.cs index 2f0a75a0..00adf9d2 100644 --- a/KruacentExiled/KE.CustomRoles/CR/MTF/RedMist/EGO.cs +++ b/KruacentExiled/KE.CustomRoles/CR/MTF/RedMist/EGO.cs @@ -1,8 +1,11 @@ using CustomPlayerEffects; +using Exiled.API.Enums; using Exiled.API.Features; using Exiled.API.Features.DamageHandlers; +using Exiled.Events.EventArgs.Player; using KE.CustomRoles.API.Features.Abilities; using KE.Utils.API.Features; +using KE.Utils.API.Interfaces; using KE.Utils.Extensions; using PlayerRoles; using PlayerStatsSystem; @@ -15,7 +18,7 @@ namespace KE.CustomRoles.CR.MTF.RedMist { - public class EGO : BaseCompAbility + public class EGO : BaseCompAbility, IUsingEvents { @@ -42,7 +45,48 @@ internal void Awake() active = false; damage = new CustomReasonDamageHandler("drained", Damage); - KELog.Debug(Hub); + + SubscribeEvents(); + } + + + internal void OnDestroy() + { + UnsubscribeEvents(); + } + + public void SubscribeEvents() + { + Exiled.Events.Handlers.Player.ReceivingEffect += OnReceivingEffect; + Exiled.Events.Handlers.Player.Hurt += OnHurt; + } + private void OnHurt(HurtEventArgs ev) + { + Player player = Player.Get(Hub); + if (player != ev.Attacker) return; + + if (Active) + { + IncreaseObjective(); + } + } + + public void UnsubscribeEvents() + { + Exiled.Events.Handlers.Player.ReceivingEffect -= OnReceivingEffect; + + } + + private void OnReceivingEffect(ReceivingEffectEventArgs ev) + { + Player player = Player.Get(Hub); + if (ev.Player != player) return; + StatusEffectBase effect = ev.Effect; + + if (Active && effect is Poisoned) + { + effect.DisableEffect(); + } } @@ -100,15 +144,24 @@ public override void ToggleActive() } + private static readonly Dictionary effects = new() + { + { EffectType.MovementBoost,25 }, + { EffectType.Scp1853,2 }, + }; + public const byte MovementBoostIntensity = 25; + public const byte SCP1853Intensity = 2; private void Effect() { Player player = Player.Get(Hub); if (Active) { - player.AddLevelEffect(25); - player.AddLevelEffect(2); + foreach(var kvp in effects) + { + player.AddLevelEffect(kvp.Key, kvp.Value); + } if (player.IsEffectActive()) { player.DisableEffect(); @@ -116,8 +169,10 @@ private void Effect() } else { - player.AddLevelEffect(-25); - player.DisableEffect(); + foreach (var kvp in effects) + { + player.AddLevelEffect(kvp.Key, -kvp.Value); + } } diff --git a/KruacentExiled/KE.CustomRoles/CR/MTF/RedMist/RedMist.cs b/KruacentExiled/KE.CustomRoles/CR/MTF/RedMist/RedMist.cs index 85314856..5841f8d1 100644 --- a/KruacentExiled/KE.CustomRoles/CR/MTF/RedMist/RedMist.cs +++ b/KruacentExiled/KE.CustomRoles/CR/MTF/RedMist/RedMist.cs @@ -89,8 +89,6 @@ protected override void RoleAdded(Player player) protected override void RoleRemoved(Player player) { - - if (player.ReferenceHub.gameObject.TryGetComponent(out var ego)) { UnityEngine.Object.Destroy(ego); @@ -100,14 +98,14 @@ protected override void RoleRemoved(Player player) protected override void SubscribeEvents() { - Exiled.Events.Handlers.Player.Hurt += OnHurt; Exiled.Events.Handlers.Scp1509.Resurrecting += OnResurrecting; + base.SubscribeEvents(); } protected override void UnsubscribeEvents() { - Exiled.Events.Handlers.Player.Hurt -= OnHurt; + Exiled.Events.Handlers.Scp1509.Resurrecting -= OnResurrecting; base.UnsubscribeEvents(); } @@ -119,22 +117,7 @@ private void OnResurrecting(ResurrectingEventArgs ev) ev.IsAllowed = false; } - private void OnHurt(HurtEventArgs ev) - { - - Player player = ev.Attacker; - if (!Check(player)) return; - - if (player.ReferenceHub.gameObject.TryGetComponent(out var ego)) - { - if (ego.Active) - { - ego.IncreaseObjective(); - } - - - } - } + } } From 8654d5ea2fba0eb9b8b13e8f441bb0ead488335d Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Mon, 6 Apr 2026 13:18:52 +0200 Subject: [PATCH 797/853] added blacklist --- .../GE/ItemRain.cs | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/KruacentExiled/KE.GlobalEventFramework.Examples/GE/ItemRain.cs b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/ItemRain.cs index d6bfe721..165d2f35 100644 --- a/KruacentExiled/KE.GlobalEventFramework.Examples/GE/ItemRain.cs +++ b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/ItemRain.cs @@ -24,6 +24,12 @@ public class ItemRain : GlobalEvent, IAsyncStart public int Cooldown = 120; public int NbItemSpawned = 5; + + public static readonly HashSet BlacklistedItems = new() + { + ItemType.None,ItemType.Coal,ItemType.SpecialCoal,ItemType.Snowball,ItemType.SCP1507Tape,ItemType.Scp021J,ItemType.DebugRagdollMover + ItemType.KeycardCustomManagement,ItemType.KeycardCustomMetalCase,ItemType.KeycardCustomSite02,ItemType.KeycardCustomTaskForce, + }; public IEnumerator Start() { while (!Round.IsEnded) @@ -37,11 +43,17 @@ public IEnumerator Start() ItemType itemType = (ItemType)values.GetValue(UnityEngine.Random.Range(0, values.Length)); - if (itemType == ItemType.None) continue; + if (CheckItemType(itemType)) continue; Item.Create(itemType).CreatePickup(Room.Random().Position); } } } + + + private bool CheckItemType(ItemType itemType) + { + return !BlacklistedItems.Contains(itemType); + } } } \ No newline at end of file From 967909c5844fdd9f4ac6de5ec2f5ec140b3e0d84 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Mon, 6 Apr 2026 18:57:36 +0200 Subject: [PATCH 798/853] added aspect ratio warning when not using 16:9 --- .../LobbyHints/AspectRatioTypeExtension.cs | 22 ++++++ .../KE.Misc/Features/LobbyHints/LobbyHint.cs | 12 ++++ .../Features/LobbyHints/LobbyHintBase.cs | 53 ++++++++++++++ .../WrongAspectRatioHintPosition.cs | 20 ++++++ .../WrongAspectRatioWarningLobbyHint.cs | 69 +++++++++++++++++++ 5 files changed, 176 insertions(+) create mode 100644 KruacentExiled/KE.Misc/Features/LobbyHints/AspectRatioTypeExtension.cs create mode 100644 KruacentExiled/KE.Misc/Features/LobbyHints/LobbyHint.cs create mode 100644 KruacentExiled/KE.Misc/Features/LobbyHints/LobbyHintBase.cs create mode 100644 KruacentExiled/KE.Misc/Features/LobbyHints/WrongAspectRatioHintPosition.cs create mode 100644 KruacentExiled/KE.Misc/Features/LobbyHints/WrongAspectRatioWarningLobbyHint.cs diff --git a/KruacentExiled/KE.Misc/Features/LobbyHints/AspectRatioTypeExtension.cs b/KruacentExiled/KE.Misc/Features/LobbyHints/AspectRatioTypeExtension.cs new file mode 100644 index 00000000..27651042 --- /dev/null +++ b/KruacentExiled/KE.Misc/Features/LobbyHints/AspectRatioTypeExtension.cs @@ -0,0 +1,22 @@ +using Exiled.API.Enums; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace KE.Misc.Features.LobbyHints +{ + public static class AspectRatioTypeExtension + { + + public static string GetTranslation(this AspectRatioType ratio) + { + if (ratio == AspectRatioType.Unknown) return "Unknown"; + string result = ratio.ToString(); + return result.Replace('_', ':').Remove(0,5); + } + + + } +} diff --git a/KruacentExiled/KE.Misc/Features/LobbyHints/LobbyHint.cs b/KruacentExiled/KE.Misc/Features/LobbyHints/LobbyHint.cs new file mode 100644 index 00000000..7de4403f --- /dev/null +++ b/KruacentExiled/KE.Misc/Features/LobbyHints/LobbyHint.cs @@ -0,0 +1,12 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace KE.Misc.Features.LobbyHints +{ + internal class LobbyHint : LoadingMiscFeature + { + } +} diff --git a/KruacentExiled/KE.Misc/Features/LobbyHints/LobbyHintBase.cs b/KruacentExiled/KE.Misc/Features/LobbyHints/LobbyHintBase.cs new file mode 100644 index 00000000..a1dd024c --- /dev/null +++ b/KruacentExiled/KE.Misc/Features/LobbyHints/LobbyHintBase.cs @@ -0,0 +1,53 @@ +using Exiled.API.Features; +using Exiled.Events.EventArgs.Player; +using KE.Utils.API.Interfaces; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace KE.Misc.Features.LobbyHints +{ + internal abstract class LobbyHintBase : IUsingEvents + { + + + public void SubscribeEvents() + { + Exiled.Events.Handlers.Player.Verified += OnVerified; + Exiled.Events.Handlers.Server.RoundStarted += OnRoundStarted; + } + + public void UnsubscribeEvents() + { + Exiled.Events.Handlers.Player.Verified -= OnVerified; + Exiled.Events.Handlers.Server.RoundStarted -= OnRoundStarted; + } + + + + private void OnVerified(VerifiedEventArgs ev) + { + if (IsNotLobby()) return; + Init(ev.Player); + + } + + + private void OnRoundStarted() + { + Destroy(); + } + + + public abstract void Init(Player player); + public abstract void Destroy(); + + protected bool IsNotLobby() + { + return !Round.IsLobby; + } + + } +} diff --git a/KruacentExiled/KE.Misc/Features/LobbyHints/WrongAspectRatioHintPosition.cs b/KruacentExiled/KE.Misc/Features/LobbyHints/WrongAspectRatioHintPosition.cs new file mode 100644 index 00000000..e6b1e820 --- /dev/null +++ b/KruacentExiled/KE.Misc/Features/LobbyHints/WrongAspectRatioHintPosition.cs @@ -0,0 +1,20 @@ +using HintServiceMeow.Core.Enum; +using KE.Utils.API.Displays.DisplayMeow.Placements; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace KE.Misc.Features.LobbyHints +{ + public class WrongAspectRatioHintPosition : HintPosition + { + public override float Xposition => 0; + + public override float Yposition => 900; + public override string Name => "WrongAspectRatio"; + + public override HintAlignment HintAlignment => HintAlignment.Center; + } +} diff --git a/KruacentExiled/KE.Misc/Features/LobbyHints/WrongAspectRatioWarningLobbyHint.cs b/KruacentExiled/KE.Misc/Features/LobbyHints/WrongAspectRatioWarningLobbyHint.cs new file mode 100644 index 00000000..caba8b79 --- /dev/null +++ b/KruacentExiled/KE.Misc/Features/LobbyHints/WrongAspectRatioWarningLobbyHint.cs @@ -0,0 +1,69 @@ +using Exiled.API.Features; +using KE.Utils.API.Displays.DisplayMeow; +using KE.Utils.API.Displays.DisplayMeow.Placements; +using KE.Utils.API.Features; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace KE.Misc.Features.LobbyHints +{ + internal class WrongAspectRatioWarningLobbyHint : LobbyHintBase + { + + public const string WrongAspectRatioTranslation = "WrongAspectRatioTranslation"; + public static Dictionary> LangToKeyToTranslation = new Dictionary>() + { + ["en"] = new Dictionary() + { + [WrongAspectRatioTranslation] = "Warning wrong aspect ratio : %CurrAspect% instead of 16:9", + }, + ["fr"] = new Dictionary() + { + [WrongAspectRatioTranslation] = "Attention mauvaise résolution d'écran : %CurrAspect% au lieu de 16:9", + }, + }; + + private readonly HintPosition HintPosition = new WrongAspectRatioHintPosition(); + + public override void Init(Player player) + { + DisplayHandler.Instance.CreateAuto(player, (args) => GetWarning(player), HintPosition.HintPlacement,HintServiceMeow.Core.Enum.HintSyncSpeed.Slow); + } + + + public override void Destroy() + { + foreach(Player player in Player.List) + { + DisplayHandler.Instance.RemoveHint(player, HintPosition.HintPlacement); + } + } + + + + private string GetWarning(Player player) + { + if (IsNotLobby()) return " "; + if (CheckAspectRatio(player)) return " "; + + string translation = MainPlugin.GetTranslation(player, WrongAspectRatioTranslation); + + KELog.Debug(player.AspectRatio.ToString()); + + return translation.Replace("%CurrAspect%",player.AspectRatio.GetTranslation()); + + } + + + public bool CheckAspectRatio(Player player) + { + return player.AspectRatio == Exiled.API.Enums.AspectRatioType.Ratio16_9; + } + } + + + +} From 662705cbbefed700d8e872e039fd9d8f4cbe5c1e Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Mon, 6 Apr 2026 18:58:01 +0200 Subject: [PATCH 799/853] same --- KruacentExiled/KE.Misc/MainPlugin.cs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/KruacentExiled/KE.Misc/MainPlugin.cs b/KruacentExiled/KE.Misc/MainPlugin.cs index 0383b1ef..d1c7e71d 100644 --- a/KruacentExiled/KE.Misc/MainPlugin.cs +++ b/KruacentExiled/KE.Misc/MainPlugin.cs @@ -15,6 +15,7 @@ using KE.Utils.API.Translations; using KE.Misc.Features.PostNuke; using Exiled.Events.EventArgs.Server; +using KE.Misc.Features.LobbyHints; namespace KE.Misc { @@ -44,6 +45,7 @@ public class MainPlugin : Plugin, ILocalizable internal VoteStart vote { get; private set; } internal PostNukeHandler postnuke { get; private set; } + internal LobbyHint LobbyHint { get; private set; } public string LocalizationId => Prefix; @@ -66,6 +68,7 @@ public override void OnEnabled() Candy = new Candy(); vote = new(); postnuke = new(); + LobbyHint = new(); //SpawnLcz = new(); @@ -128,6 +131,7 @@ public override void OnDisabled() GamblingCoinManager.DestroyAll(); _gamblingCoinHandler = null; postnuke = null; + LobbyHint = null; LastHuman = null; harmony = null; Instance = null; @@ -164,6 +168,7 @@ private void NoeDeath(CassieQueuingScpTerminationEventArgs ev) public void RegisterTranslations() { TranslationHub.Add(LocalizationId, LastHumanTranslations.LangToKeyToTranslation); + TranslationHub.Add(LocalizationId, WrongAspectRatioWarningLobbyHint.LangToKeyToTranslation); } From 914328b00fa45d9adf35624fc365ea9fe5fcdfbf Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Mon, 6 Apr 2026 18:58:10 +0200 Subject: [PATCH 800/853] lowered vote position --- KruacentExiled/KE.Misc/Features/VoteStart/VotePosition.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/KruacentExiled/KE.Misc/Features/VoteStart/VotePosition.cs b/KruacentExiled/KE.Misc/Features/VoteStart/VotePosition.cs index a5850b1e..c606cbc3 100644 --- a/KruacentExiled/KE.Misc/Features/VoteStart/VotePosition.cs +++ b/KruacentExiled/KE.Misc/Features/VoteStart/VotePosition.cs @@ -12,7 +12,7 @@ public class VotePosition : HintPosition { public override float Xposition => 0; - public override float Yposition => 800; + public override float Yposition => 860; public override string Name => "VoteStart"; public override HintAlignment HintAlignment => HintAlignment.Center; From 8d44bfe448122efd96c443a457cbec2147ce6ba3 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Mon, 6 Apr 2026 19:28:21 +0200 Subject: [PATCH 801/853] remove debuglog --- .../Features/LobbyHints/WrongAspectRatioWarningLobbyHint.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/KruacentExiled/KE.Misc/Features/LobbyHints/WrongAspectRatioWarningLobbyHint.cs b/KruacentExiled/KE.Misc/Features/LobbyHints/WrongAspectRatioWarningLobbyHint.cs index caba8b79..6f25cac9 100644 --- a/KruacentExiled/KE.Misc/Features/LobbyHints/WrongAspectRatioWarningLobbyHint.cs +++ b/KruacentExiled/KE.Misc/Features/LobbyHints/WrongAspectRatioWarningLobbyHint.cs @@ -51,7 +51,6 @@ private string GetWarning(Player player) string translation = MainPlugin.GetTranslation(player, WrongAspectRatioTranslation); - KELog.Debug(player.AspectRatio.ToString()); return translation.Replace("%CurrAspect%",player.AspectRatio.GetTranslation()); From 3907c00d5b864fa9fc7f9f75a7d4ffdc7f5f8448 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Mon, 6 Apr 2026 19:28:46 +0200 Subject: [PATCH 802/853] added trnaslation but still doesn't work yet --- .../KE.Misc/Features/VoteStart/VoteStart.cs | 14 ++++++++++++++ KruacentExiled/KE.Misc/MainPlugin.cs | 1 + 2 files changed, 15 insertions(+) diff --git a/KruacentExiled/KE.Misc/Features/VoteStart/VoteStart.cs b/KruacentExiled/KE.Misc/Features/VoteStart/VoteStart.cs index 758f468b..f0f30b34 100644 --- a/KruacentExiled/KE.Misc/Features/VoteStart/VoteStart.cs +++ b/KruacentExiled/KE.Misc/Features/VoteStart/VoteStart.cs @@ -17,6 +17,18 @@ namespace KE.Misc.Features.VoteStart { internal class VoteStart : MiscFeature { + public const string CancelVoteTranslation = "CancelVote"; + //public static Dictionary> LangToKeyToTranslation { get; } = new() + //{ + // ["en"] = + // { + // [CancelVoteTranslation] = ".rv in the console to cancel your vote." + // }, + // ["fr"] = + // { + // [CancelVoteTranslation] = ".rv dans la console client pour annuler le vote." + // } + //}; public static HintPosition HintPosition = new VotePosition(); @@ -165,7 +177,9 @@ private string GetPlayers(Player player) if (Voted.Contains(player)) { sb.AppendLine(); + sb.Append(".rv dans la console client pour annuler le vote."); + //sb.Append(MainPlugin.GetTranslation(player,CancelVoteTranslation)); } diff --git a/KruacentExiled/KE.Misc/MainPlugin.cs b/KruacentExiled/KE.Misc/MainPlugin.cs index d1c7e71d..4bc56ca9 100644 --- a/KruacentExiled/KE.Misc/MainPlugin.cs +++ b/KruacentExiled/KE.Misc/MainPlugin.cs @@ -169,6 +169,7 @@ public void RegisterTranslations() { TranslationHub.Add(LocalizationId, LastHumanTranslations.LangToKeyToTranslation); TranslationHub.Add(LocalizationId, WrongAspectRatioWarningLobbyHint.LangToKeyToTranslation); + //TranslationHub.Add(LocalizationId, VoteStart.LangToKeyToTranslation); } From 8056a81baf23a97fb2ca57cfd95239b96f3e6e3e Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Mon, 6 Apr 2026 19:47:27 +0200 Subject: [PATCH 803/853] translation + set at 20% health --- KruacentExiled/KE.Items/Items/Defibrilator.cs | 64 +++++++++++++------ 1 file changed, 45 insertions(+), 19 deletions(-) diff --git a/KruacentExiled/KE.Items/Items/Defibrilator.cs b/KruacentExiled/KE.Items/Items/Defibrilator.cs index b3c90ba9..9726d811 100644 --- a/KruacentExiled/KE.Items/Items/Defibrilator.cs +++ b/KruacentExiled/KE.Items/Items/Defibrilator.cs @@ -4,17 +4,26 @@ using Exiled.API.Features.Spawn; using Exiled.CustomItems.API.Features; using Exiled.Events.EventArgs.Player; -using UnityEngine; -using System.Linq; -using KE.Items.API.Interface; using KE.Items.API.Features; -using System.Collections.Generic; -using PlayerRoles.Ragdolls; -using PlayerRoles; +using KE.Items.API.Interface; +using KE.Utils.API.Displays.Feeds; using MEC; +using PlayerRoles; +using PlayerRoles.Ragdolls; +using System.Collections.Generic; +using System.Linq; +using UnityEngine; +using YamlDotNet.Core.Tokens; public class Defibrillator : KECustomItem, ILumosItem { + + public const string TranslationFailed = "DefibrillatorFailed"; + public const string TranslationExpired = "DefibrillatorExpired"; + public const string TranslationTooFar = "DefibrillatorTooFar"; + public const string TranslationRevived = "DefibrillatorRevived"; + public const string TranslationSucceed = "DefibrillatorSucceed"; + public const string TranslationInProgress = "DefibrillatorInProgress"; protected override Dictionary> SetTranslation() { return new() @@ -23,11 +32,23 @@ protected override Dictionary> SetTranslation { [TranslationKeyName] = "Defibrillator", [TranslationKeyDesc] = "Aim for a dead body to try to resuscitate him", + [TranslationFailed] = "Failed!", + [TranslationExpired] = "Body expired.", + [TranslationTooFar] = "Aim at a body.", + [TranslationRevived] = "Revived by %MedicName%\nyou got brian damage", + [TranslationSucceed] = "Successfully ressucitate %PatientName%!", + [TranslationInProgress] = "In progress", }, ["fr"] = new() { [TranslationKeyName] = "Défibrillateur", [TranslationKeyDesc] = "Visez un cadavre de près pour tenter une réanimation.", + [TranslationFailed] = "Réanimation échouée !", + [TranslationExpired] = "Mort trop ancienne.", + [TranslationTooFar] = "Rapprochez-vous ou visez un cadavre.", + [TranslationRevived] = "Réanimé par %MedicName%\nvous avez des traumatisme crânien", + [TranslationSucceed] = "Réanimation réussie sur %PatientName% !", + [TranslationInProgress] = "Réanimation en cours...", }, }; } @@ -94,10 +115,11 @@ private void OnUsingItem(UsingItemEventArgs ev) { if (!Check(ev.Item)) return; ev.IsAllowed = false; + Player player = ev.Player; - Log.Debug($"[Defib] Tentative par {ev.Player.Nickname}"); + Log.Debug($"[Defib] Tentative par {player.Nickname}"); - if (Physics.Raycast(ev.Player.CameraTransform.position, ev.Player.CameraTransform.forward, out RaycastHit hit, RaycastDistance)) + if (Physics.Raycast(player.CameraTransform.position, player.CameraTransform.forward, out RaycastHit hit, RaycastDistance)) { Log.Debug($"[Defib] Raycast a touché : {hit.collider.name}"); @@ -120,17 +142,16 @@ private void OnUsingItem(UsingItemEventArgs ev) if (Time.time - data.Time <= MaxReviveTime) { Log.Debug("[Defib] RÉANIMATION LANCÉE."); - ev.Player.RemoveItem(ev.Item); - Timing.RunCoroutine(ReviveSequence(ev.Player, target, foundRagdoll, data.Role)); + player.RemoveItem(ev.Item); + Timing.RunCoroutine(ReviveSequence(player, target, foundRagdoll, data.Role)); return; } - KECustomItem.ItemEffectHint(ev.Player, "Mort trop ancienne."); + TranslationFeed(player, TranslationExpired); return; } } } - - KECustomItem.ItemEffectHint(ev.Player, "Rapprochez-vous ou visez un cadavre."); + TranslationFeed(player, TranslationTooFar); } private IEnumerator ReviveSequence(Player medic, Player patient, BasicRagdoll ragdoll, RoleTypeId previousRole) @@ -142,16 +163,16 @@ private IEnumerator ReviveSequence(Player medic, Player patient, BasicRag shockLight.Range = 7f; shockLight.Spawn(); - KECustomItem.ItemEffectHint(medic, "Réanimation en cours..."); + TranslationFeed(medic, TranslationInProgress); float elapsed = 0f; while (elapsed < 1.0f) { if (Vector3.Distance(medic.Position, ragdoll.transform.position) > RaycastDistance + 1f) { - KECustomItem.ItemEffectHint(medic, "Réanimation échouée !"); + TranslationFeed(medic, TranslationFailed); shockLight.Destroy(); - CustomItem.TryGive(medic, Id); + CustomItem.TryGive(medic, "Defibrillator",false); yield break; } @@ -176,13 +197,18 @@ private IEnumerator ReviveSequence(Player medic, Player patient, BasicRag { patient.Position = ragdoll.transform.position + Vector3.up * 0.5f; - patient.Health = 20f; + patient.Health = patient.MaxHealth *.2f; patient.EnableEffect(EffectType.Flashed, 2f); patient.EnableEffect(EffectType.Concussed, 20f); patient.EnableEffect(EffectType.Deafened, 20f); - KECustomItem.ItemEffectHint(patient, $"Réanimé par {medic.Nickname}\nvous avez des traumatisme crânien"); - KECustomItem.ItemEffectHint(medic, $"Réanimation réussie sur {patient.Nickname} !"); + + string msgMedic = GetTranslation(medic, TranslationSucceed); + string msgPatient = GetTranslation(medic, TranslationRevived); + + + HintFeed.AddFeed(medic, msgMedic.Replace("%PatientName%",patient.Nickname)); + KECustomItem.ItemEffectHint(patient, msgPatient.Replace("%MedicName%", medic.Nickname)); _deathRecords.Remove(patient); From 1e2aefeb405679ec2cea302859bfaa17143d3306 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Mon, 6 Apr 2026 19:48:41 +0200 Subject: [PATCH 804/853] changed keycard --- KruacentExiled/KE.Items/Items/Drone.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/KruacentExiled/KE.Items/Items/Drone.cs b/KruacentExiled/KE.Items/Items/Drone.cs index 077d98ec..faa0701b 100644 --- a/KruacentExiled/KE.Items/Items/Drone.cs +++ b/KruacentExiled/KE.Items/Items/Drone.cs @@ -20,7 +20,7 @@ public class Drone : KECustomItem public override string Name { get; set; } = "Drone"; public override float Weight { get; set; } = 3f; public Color Color { get; set; } = Color.blue; - public override ItemType ItemType => ItemType.KeycardChaosInsurgency; + public override ItemType ItemType => ItemType.KeycardJanitor;// make a custom keycard protected override Dictionary> SetTranslation() { From 1655a57f02f659d1106f81cd7937533814eb0e28 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Tue, 7 Apr 2026 14:07:11 +0200 Subject: [PATCH 805/853] one token at the start of the round --- KruacentExiled/KE.Misc/Handlers/ServerHandler.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/KruacentExiled/KE.Misc/Handlers/ServerHandler.cs b/KruacentExiled/KE.Misc/Handlers/ServerHandler.cs index 062d2d6d..b14fcc6e 100644 --- a/KruacentExiled/KE.Misc/Handlers/ServerHandler.cs +++ b/KruacentExiled/KE.Misc/Handlers/ServerHandler.cs @@ -12,8 +12,8 @@ public void OnRoundStarted() MainPlugin.Instance.AutoTesla.StartLoop(); MainPlugin.Instance.SCPBuff.StartBuff(); - Respawn.SetTokens(SpawnableFaction.NtfWave, 2); - Respawn.SetTokens(SpawnableFaction.ChaosWave, 2); + Respawn.SetTokens(SpawnableFaction.NtfWave, 1); + Respawn.SetTokens(SpawnableFaction.ChaosWave, 1); /* string test = "test.png"; From da275b1b2a6a9ba0254e8174f9f4fca6ec95e309 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Tue, 7 Apr 2026 14:36:42 +0200 Subject: [PATCH 806/853] added 035 removed zombies --- .../Features/FriendlyFireConditions/ScpDeathFFCC.cs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/KruacentExiled/KE.Misc/Features/FriendlyFireConditions/ScpDeathFFCC.cs b/KruacentExiled/KE.Misc/Features/FriendlyFireConditions/ScpDeathFFCC.cs index ec1fdc23..419d2c84 100644 --- a/KruacentExiled/KE.Misc/Features/FriendlyFireConditions/ScpDeathFFCC.cs +++ b/KruacentExiled/KE.Misc/Features/FriendlyFireConditions/ScpDeathFFCC.cs @@ -1,5 +1,8 @@ -using Exiled.Events.EventArgs.Player; +using Exiled.API.Features; +using Exiled.Events.EventArgs.Player; +using KE.Utils.API.Features.SCPs; using KE.Utils.API.Interfaces; +using PlayerRoles; using System; using System.Collections.Generic; using System.Linq; @@ -26,7 +29,8 @@ public override void UnsubscribeEvents() private void OnDying(DyingEventArgs ev) { - if (!ev.Player.IsScp) return; + Player player = ev.Player; + if (!SCPTeam.IsSCP(player.ReferenceHub) && player.Role != RoleTypeId.Scp0492) return; ChangeFriendlyFire(); } } From 9a5f29792638ff974c53ef4d093f17ed482987db Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Tue, 7 Apr 2026 14:42:06 +0200 Subject: [PATCH 807/853] hope this work --- KruacentExiled/KE.CustomRoles/CR/Human/MaladroitVoleur.cs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/KruacentExiled/KE.CustomRoles/CR/Human/MaladroitVoleur.cs b/KruacentExiled/KE.CustomRoles/CR/Human/MaladroitVoleur.cs index 293fe870..6700525f 100644 --- a/KruacentExiled/KE.CustomRoles/CR/Human/MaladroitVoleur.cs +++ b/KruacentExiled/KE.CustomRoles/CR/Human/MaladroitVoleur.cs @@ -77,14 +77,16 @@ protected override void RoleRemoved(Player player) } } + public const float LowerBound = 90f; + public const float UpperBound = 120f; private IEnumerator ThrowingItem(Player player) { - + yield return Timing.WaitForSeconds(UnityEngine.Random.Range(LowerBound, UpperBound)); while (Check(player)) { - yield return Timing.WaitForSeconds(UnityEngine.Random.Range(90f, 120f)); EffectPlayer(player); + yield return Timing.WaitForSeconds(UnityEngine.Random.Range(LowerBound, UpperBound)); } } From 5dd3fbc987f7903bf909fef291f47e94ca2350e4 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Tue, 7 Apr 2026 14:43:24 +0200 Subject: [PATCH 808/853] welp --- KruacentExiled/KE.CustomRoles/CR/Human/MaladroitVoleur.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/KruacentExiled/KE.CustomRoles/CR/Human/MaladroitVoleur.cs b/KruacentExiled/KE.CustomRoles/CR/Human/MaladroitVoleur.cs index 6700525f..b25c269a 100644 --- a/KruacentExiled/KE.CustomRoles/CR/Human/MaladroitVoleur.cs +++ b/KruacentExiled/KE.CustomRoles/CR/Human/MaladroitVoleur.cs @@ -93,7 +93,7 @@ private IEnumerator ThrowingItem(Player player) private void EffectPlayer(Player player) { - if (UnityEngine.Random.Range(0f, 100f) > .5f) + if (UnityEngine.Random.Range(0f, 100f) > 50f) { player.DropHeldItem(); } From d178bf3d6954d3a50004dcf8605bbed96b3c2a7a Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Tue, 7 Apr 2026 15:08:50 +0200 Subject: [PATCH 809/853] fix interval --- KruacentExiled/KE.CustomRoles/CR/Human/Crazy.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/KruacentExiled/KE.CustomRoles/CR/Human/Crazy.cs b/KruacentExiled/KE.CustomRoles/CR/Human/Crazy.cs index a63dd1de..57742505 100644 --- a/KruacentExiled/KE.CustomRoles/CR/Human/Crazy.cs +++ b/KruacentExiled/KE.CustomRoles/CR/Human/Crazy.cs @@ -2,6 +2,7 @@ using Exiled.API.Extensions; using Exiled.API.Features; using Exiled.API.Features.Attributes; +using Exiled.API.Features.Doors; using Exiled.CustomRoles.API.Features; using KE.CustomRoles.API.Features; using KE.Utils.Extensions; @@ -66,7 +67,7 @@ protected override Dictionary> SetTranslation { CrazyBehaviour.Crazying, 1 } }; private List WeightedList; - private readonly float EFFECT_INTERVAL = UnityEngine.Random.Range(180, 300); + private float EFFECT_INTERVAL => UnityEngine.Random.Range(180, 300); protected override void RoleAdded(Player player) { @@ -158,7 +159,6 @@ private IEnumerator Crazying(Player player) } } - Timing.KillCoroutines(_crazyingCoroutine); } } } \ No newline at end of file From a2679dd4e5013b24055826a1c1f5bab90e37f449 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Tue, 7 Apr 2026 15:51:19 +0200 Subject: [PATCH 810/853] fix being in spec when changing cr --- .../KE.CustomRoles/API/Features/GlobalCustomRole.cs | 1 - .../KE.CustomRoles/API/Features/KECustomRole.cs | 12 ++++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/KruacentExiled/KE.CustomRoles/API/Features/GlobalCustomRole.cs b/KruacentExiled/KE.CustomRoles/API/Features/GlobalCustomRole.cs index 4c704950..dda49e5a 100644 --- a/KruacentExiled/KE.CustomRoles/API/Features/GlobalCustomRole.cs +++ b/KruacentExiled/KE.CustomRoles/API/Features/GlobalCustomRole.cs @@ -26,7 +26,6 @@ public abstract class GlobalCustomRole : KECustomRole public sealed override RoleTypeId Role { get; set; } = RoleTypeId.None; public abstract SideEnum Side { get; set; } public override bool KeepInventoryOnSpawn { get; set; } = true; - public override bool RemovalKillsPlayer => false; public override string Name { diff --git a/KruacentExiled/KE.CustomRoles/API/Features/KECustomRole.cs b/KruacentExiled/KE.CustomRoles/API/Features/KECustomRole.cs index 4bd85792..00fff16d 100644 --- a/KruacentExiled/KE.CustomRoles/API/Features/KECustomRole.cs +++ b/KruacentExiled/KE.CustomRoles/API/Features/KECustomRole.cs @@ -47,6 +47,18 @@ public override string Name } } + public sealed override bool RemovalKillsPlayer + { + get + { + return false; + } + set + { + + } + } + public virtual string InternalName => GetType().Name; public sealed override string Description { get; set; } = string.Empty; From 79ae768c5de7e24e69db69af60dbe2767e9b01fc Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Tue, 7 Apr 2026 15:51:35 +0200 Subject: [PATCH 811/853] fix pacifist not respawning someone --- .../KE.CustomRoles/CR/Human/Pacifist.cs | 30 +++++++++++++------ 1 file changed, 21 insertions(+), 9 deletions(-) diff --git a/KruacentExiled/KE.CustomRoles/CR/Human/Pacifist.cs b/KruacentExiled/KE.CustomRoles/CR/Human/Pacifist.cs index b5b15d1b..1820beaf 100644 --- a/KruacentExiled/KE.CustomRoles/CR/Human/Pacifist.cs +++ b/KruacentExiled/KE.CustomRoles/CR/Human/Pacifist.cs @@ -1,9 +1,12 @@ -using Exiled.API.Features; +using Exiled.API.Extensions; +using Exiled.API.Features; using Exiled.Events.EventArgs.Item; using Exiled.Events.EventArgs.Player; using InventorySystem.Items.ThrowableProjectiles; using KE.CustomRoles.API.Features; using KE.CustomRoles.API.Interfaces; +using KE.Utils.API.Features; +using MEC; using PlayerRoles; using System; using System.Collections.Generic; @@ -51,7 +54,7 @@ protected override void SubscribeEvents() Exiled.Events.Handlers.Item.ChargingJailbird += OnChargingJailbird; Exiled.Events.Handlers.Player.Shooting += OnShooting; Exiled.Events.Handlers.Player.ThrownProjectile += OnThrownProjectile; - Exiled.Events.Handlers.Player.Escaped += OnEscaped; + Exiled.Events.Handlers.Player.Escaping += OnEscaping; base.SubscribeEvents(); } @@ -62,7 +65,7 @@ protected override void UnsubscribeEvents() Exiled.Events.Handlers.Item.ChargingJailbird -= OnChargingJailbird; Exiled.Events.Handlers.Player.Shooting -= OnShooting; Exiled.Events.Handlers.Player.ThrownProjectile -= OnThrownProjectile; - Exiled.Events.Handlers.Player.Escaped -= OnEscaped; + Exiled.Events.Handlers.Player.Escaping -= OnEscaping; base.UnsubscribeEvents(); } private void OnThrownProjectile(ThrownProjectileEventArgs ev) @@ -105,20 +108,29 @@ private void OnShooting(ShootingEventArgs ev) } } - - private void OnEscaped(EscapedEventArgs ev) + private void OnEscaping(EscapingEventArgs ev) { Player escape = ev.Player; - if (Check(escape)) + if (Check(escape) && ev.IsAllowed) { RemoveRole(escape); - if(Player.Enumerable.Count(p => p.Role == RoleTypeId.Spectator) > 0) + + Player respawned = Player.Enumerable.GetRandomValue(p => p.IsDead); + + + if (respawned != null) { - Player respawned = Player.Enumerable.First(); + respawned.Role.Set(ev.NewRole, Exiled.API.Enums.SpawnReason.Respawn, RoleSpawnFlags.All); + GiveRandomRole(respawned); - respawned.Role.Set(escape.Role, Exiled.API.Enums.SpawnReason.Escaped, RoleSpawnFlags.All); + Timing.CallDelayed(1f, () => + { + KELog.Debug(respawned); + }); } + + } } From e2a2fc24f7702c4ae7bafef9fd66ab9d6611d927 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Tue, 7 Apr 2026 16:07:25 +0200 Subject: [PATCH 812/853] added violent check for pacifist cr --- .../KE.Items/API/Features/KECustomItem.cs | 21 +++++++++++++++++++ .../KE.Items/API/Interface/IViolentItem.cs | 14 +++++++++++++ KruacentExiled/KE.Items/Items/FriendMaker.cs | 15 +++++-------- KruacentExiled/KE.Items/Items/HealZone.cs | 4 +++- KruacentExiled/KE.Items/Items/ImpactFlash.cs | 4 +++- .../KE.Items/Items/LeSoleil/LeSoleil.cs | 4 +++- .../KE.Items/Items/LowGravityGrenade.cs | 3 ++- KruacentExiled/KE.Items/Items/Mine.cs | 3 ++- .../KE.Items/Items/ProximityGrenade.cs | 4 ++-- .../KE.Items/Items/SainteGrenada.cs | 3 ++- KruacentExiled/KE.Items/Items/SmokeGrenade.cs | 5 ++--- KruacentExiled/KE.Items/Items/TPGrenada.cs | 3 ++- 12 files changed, 61 insertions(+), 22 deletions(-) create mode 100644 KruacentExiled/KE.Items/API/Interface/IViolentItem.cs diff --git a/KruacentExiled/KE.Items/API/Features/KECustomItem.cs b/KruacentExiled/KE.Items/API/Features/KECustomItem.cs index efa50621..342ffe0e 100644 --- a/KruacentExiled/KE.Items/API/Features/KECustomItem.cs +++ b/KruacentExiled/KE.Items/API/Features/KECustomItem.cs @@ -324,6 +324,27 @@ public virtual bool TryRegister() } + public virtual bool IsViolent() + { + if(this is IViolentItem item) + { + return item.IsViolent; + } + + if (ItemType.IsWeapon(true)) + { + return true; + } + if(ItemType.GetCategory() == ItemCategory.Firearm || ItemType.GetCategory() == ItemCategory.Grenade) + { + return true; + } + + + return false; + } + + //obselete warning #pragma warning disable CS0618 diff --git a/KruacentExiled/KE.Items/API/Interface/IViolentItem.cs b/KruacentExiled/KE.Items/API/Interface/IViolentItem.cs new file mode 100644 index 00000000..cd30c3b3 --- /dev/null +++ b/KruacentExiled/KE.Items/API/Interface/IViolentItem.cs @@ -0,0 +1,14 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace KE.Items.API.Interface +{ + public interface IViolentItem + { + bool IsViolent { get; } + + } +} diff --git a/KruacentExiled/KE.Items/Items/FriendMaker.cs b/KruacentExiled/KE.Items/Items/FriendMaker.cs index 4e011a63..3366717c 100644 --- a/KruacentExiled/KE.Items/Items/FriendMaker.cs +++ b/KruacentExiled/KE.Items/Items/FriendMaker.cs @@ -1,24 +1,17 @@ using Exiled.API.Features; -using Exiled.API.Features.Attributes; using Exiled.API.Features.Spawn; using Exiled.Events.EventArgs.Player; -using Hints; -using HintServiceMeow.UI.Utilities; using KE.Items.API.Features; +using KE.Items.API.Interface; using KE.Utils.API.Features; using PlayerRoles; using System; using System.Collections.Generic; -using System.Diagnostics.Tracing; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using UnityEngine; namespace KE.Items.Items { - public class FriendMaker : KECustomWeapon + public class FriendMaker : KECustomWeapon, IViolentItem { public const string TranslationCooldown = "FriendMakerCooldown"; @@ -60,7 +53,9 @@ protected override Dictionary> SetTranslation public override byte ClipSize { get; } = 1; - + + public bool IsViolent => false; + private Dictionary cooldowns; private TimeSpan Cooldown = new(0,1,0); diff --git a/KruacentExiled/KE.Items/Items/HealZone.cs b/KruacentExiled/KE.Items/Items/HealZone.cs index 5edd8198..bae794b5 100644 --- a/KruacentExiled/KE.Items/Items/HealZone.cs +++ b/KruacentExiled/KE.Items/Items/HealZone.cs @@ -12,7 +12,7 @@ namespace KE.Items.Items { - public class HealZone : KECustomGrenade, ILumosItem, ISwitchableEffect, IUpgradableCustomItem + public class HealZone : KECustomGrenade, ILumosItem, ISwitchableEffect, IUpgradableCustomItem, IViolentItem { protected override Dictionary> SetTranslation() { @@ -85,6 +85,8 @@ protected override Dictionary> SetTranslation [Scp914KnobSetting.OneToOne] = new UpgradeProperties(100, "CocktailMolotov") }; + public bool IsViolent => false; + public HealZone() { Effect = new HealZoneEffect(); diff --git a/KruacentExiled/KE.Items/Items/ImpactFlash.cs b/KruacentExiled/KE.Items/Items/ImpactFlash.cs index f34ef632..5d19b984 100644 --- a/KruacentExiled/KE.Items/Items/ImpactFlash.cs +++ b/KruacentExiled/KE.Items/Items/ImpactFlash.cs @@ -4,10 +4,11 @@ using Exiled.API.Features.Spawn; using Exiled.CustomItems.API.Features; using KE.Items.API.Features; +using KE.Items.API.Interface; namespace KE.Items.Items { - public class ImpactFlash : KECustomGrenade + public class ImpactFlash : KECustomGrenade, IViolentItem { protected override Dictionary> SetTranslation() { @@ -30,6 +31,7 @@ protected override Dictionary> SetTranslation public override float Weight { get; set; } = 0.65f; public override float FuseTime => 3f; public override bool ExplodeOnCollision => true; + public bool IsViolent => false; public override SpawnProperties SpawnProperties { get; set; } = new SpawnProperties() { Limit = 5, diff --git a/KruacentExiled/KE.Items/Items/LeSoleil/LeSoleil.cs b/KruacentExiled/KE.Items/Items/LeSoleil/LeSoleil.cs index 9f339428..3cef6625 100644 --- a/KruacentExiled/KE.Items/Items/LeSoleil/LeSoleil.cs +++ b/KruacentExiled/KE.Items/Items/LeSoleil/LeSoleil.cs @@ -21,7 +21,7 @@ namespace KE.Items.Items.LeSoleil { - public class LeSoleil : KECustomGrenade, IUpgradableCustomItem + public class LeSoleil : KECustomGrenade, IUpgradableCustomItem, IViolentItem { protected override Dictionary> SetTranslation() { @@ -39,6 +39,8 @@ protected override Dictionary> SetTranslation }, }; } + + public bool IsViolent { get; } public override ItemType ItemType => ItemType.GrenadeFlash; public override string Name { get; set; } = "Le Soleil"; public override float Weight { get; set; } = 0.65f; diff --git a/KruacentExiled/KE.Items/Items/LowGravityGrenade.cs b/KruacentExiled/KE.Items/Items/LowGravityGrenade.cs index c077abe6..f26ada0b 100644 --- a/KruacentExiled/KE.Items/Items/LowGravityGrenade.cs +++ b/KruacentExiled/KE.Items/Items/LowGravityGrenade.cs @@ -8,7 +8,7 @@ namespace KE.Items.Items { - public class LowGravityGrenade : KECustomGrenade, ISwitchableEffect + public class LowGravityGrenade : KECustomGrenade, ISwitchableEffect, IViolentItem { protected override Dictionary> SetTranslation() { @@ -29,6 +29,7 @@ protected override Dictionary> SetTranslation public override ItemType ItemType => ItemType.GrenadeHE; public override string Name { get; set; } = "Low Gravity Grenade"; public override float Weight { get; set; } = 0.65f; + public bool IsViolent => false; public override float FuseTime => 3f; public override bool ExplodeOnCollision => false; public UnityEngine.Color Color { get; set; } = UnityEngine.Color.gray; diff --git a/KruacentExiled/KE.Items/Items/Mine.cs b/KruacentExiled/KE.Items/Items/Mine.cs index 145615d2..670ab451 100644 --- a/KruacentExiled/KE.Items/Items/Mine.cs +++ b/KruacentExiled/KE.Items/Items/Mine.cs @@ -11,7 +11,7 @@ namespace KE.Items.Items { - public class Mine : KECustomItem, ISwitchableEffect, ICustomPickupModel + public class Mine : KECustomItem, ISwitchableEffect, ICustomPickupModel,IViolentItem { protected override Dictionary> SetTranslation() { @@ -30,6 +30,7 @@ protected override Dictionary> SetTranslation }; } public override ItemType ItemType => ItemType.KeycardJanitor; + public bool IsViolent => true; public override string Name { get; set; } = "Mine"; public override float Weight { get; set; } = 0.65f; public Color Color { get; set; } = Color.yellow; diff --git a/KruacentExiled/KE.Items/Items/ProximityGrenade.cs b/KruacentExiled/KE.Items/Items/ProximityGrenade.cs index 861b966c..7adf0eae 100644 --- a/KruacentExiled/KE.Items/Items/ProximityGrenade.cs +++ b/KruacentExiled/KE.Items/Items/ProximityGrenade.cs @@ -8,7 +8,7 @@ namespace KE.Items.Items { - public class ProximityGrenade : KECustomGrenade, ISwitchableEffect + public class ProximityGrenade : KECustomGrenade, ISwitchableEffect, IViolentItem { protected override Dictionary> SetTranslation() @@ -28,7 +28,7 @@ protected override Dictionary> SetTranslation }; } - + public bool IsViolent => false; public override ItemType ItemType => ItemType.GrenadeFlash; public override string Name { get; set; } = "ProximityGrenade"; public override float Weight { get; set; } = 0.65f; diff --git a/KruacentExiled/KE.Items/Items/SainteGrenada.cs b/KruacentExiled/KE.Items/Items/SainteGrenada.cs index 443bbea7..92a8cbf0 100644 --- a/KruacentExiled/KE.Items/Items/SainteGrenada.cs +++ b/KruacentExiled/KE.Items/Items/SainteGrenada.cs @@ -19,7 +19,7 @@ namespace KE.Items.Items { - public class SainteGrenada : KECustomGrenade, ICustomPickupModel + public class SainteGrenada : KECustomGrenade, ICustomPickupModel, IViolentItem { protected override Dictionary> SetTranslation() { @@ -37,6 +37,7 @@ protected override Dictionary> SetTranslation }, }; } + public bool IsViolent => false; public override ItemType ItemType => ItemType.GrenadeHE; public override string Name { get; set; } = "SainteGrenada"; public override float Weight { get; set; } = 1.5f; diff --git a/KruacentExiled/KE.Items/Items/SmokeGrenade.cs b/KruacentExiled/KE.Items/Items/SmokeGrenade.cs index e3c228b5..8c59965c 100644 --- a/KruacentExiled/KE.Items/Items/SmokeGrenade.cs +++ b/KruacentExiled/KE.Items/Items/SmokeGrenade.cs @@ -1,8 +1,6 @@ using System.Collections.Generic; using Exiled.API.Enums; -using Exiled.API.Features.Attributes; using Exiled.API.Features.Spawn; -using Exiled.CustomItems.API.Features; using Exiled.Events.EventArgs.Map; using KE.Items.API.Features; using KE.Items.API.Interface; @@ -10,7 +8,7 @@ namespace KE.Items.Items { - public class SmokeGrenade : KECustomGrenade, ISwitchableEffect + public class SmokeGrenade : KECustomGrenade, ISwitchableEffect,IViolentItem { protected override Dictionary> SetTranslation() { @@ -28,6 +26,7 @@ protected override Dictionary> SetTranslation }, }; } + public bool IsViolent => false; public override ItemType ItemType => ItemType.GrenadeFlash; public override string Name { get; set; } = "Smoke Grenade"; public override float Weight { get; set; } = 0.65f; diff --git a/KruacentExiled/KE.Items/Items/TPGrenada.cs b/KruacentExiled/KE.Items/Items/TPGrenada.cs index bd4264f4..575fa9e3 100644 --- a/KruacentExiled/KE.Items/Items/TPGrenada.cs +++ b/KruacentExiled/KE.Items/Items/TPGrenada.cs @@ -12,7 +12,7 @@ namespace KE.Items.Items { - public class TPGrenada : KECustomGrenade, ISwitchableEffect, ICustomPickupModel + public class TPGrenada : KECustomGrenade, ISwitchableEffect, ICustomPickupModel,IViolentItem { protected override Dictionary> SetTranslation() @@ -31,6 +31,7 @@ protected override Dictionary> SetTranslation }, }; } + public bool IsViolent => false; public override ItemType ItemType => ItemType.GrenadeHE; public override string Name { get; set; } = "Teleportation Grenade"; public override float Weight { get; set; } = 0.65f; From 9e2a9c079194c9299e9daa65f1b382fe642f1438 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Tue, 7 Apr 2026 16:10:13 +0200 Subject: [PATCH 813/853] remove flashbang and 2176 being violent --- .../KE.Items/API/Features/KECustomItem.cs | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/KruacentExiled/KE.Items/API/Features/KECustomItem.cs b/KruacentExiled/KE.Items/API/Features/KECustomItem.cs index 342ffe0e..7a6b6883 100644 --- a/KruacentExiled/KE.Items/API/Features/KECustomItem.cs +++ b/KruacentExiled/KE.Items/API/Features/KECustomItem.cs @@ -1,4 +1,5 @@ -using Exiled.API.Extensions; +using Exiled.API.Enums; +using Exiled.API.Extensions; using Exiled.API.Features; using Exiled.API.Features.Pools; using Exiled.API.Features.Spawn; @@ -335,11 +336,18 @@ public virtual bool IsViolent() { return true; } - if(ItemType.GetCategory() == ItemCategory.Firearm || ItemType.GetCategory() == ItemCategory.Grenade) + ItemCategory itemCategory = ItemType.GetCategory(); + + if (itemCategory == ItemCategory.Firearm) { return true; } - + ProjectileType projectileType = ItemType.GetProjectileType(); + if (projectileType == Exiled.API.Enums.ProjectileType.FragGrenade || projectileType == ProjectileType.Scp018) + { + return true; + } + return false; } From 7f9d9dc259699935ebb9ee2c055fec19804c75b6 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Tue, 7 Apr 2026 16:59:25 +0200 Subject: [PATCH 814/853] pacifist can't take violent item --- .../KE.CustomRoles/CR/Human/Pacifist.cs | 103 +++++++++++++++--- 1 file changed, 90 insertions(+), 13 deletions(-) diff --git a/KruacentExiled/KE.CustomRoles/CR/Human/Pacifist.cs b/KruacentExiled/KE.CustomRoles/CR/Human/Pacifist.cs index 1820beaf..d525c084 100644 --- a/KruacentExiled/KE.CustomRoles/CR/Human/Pacifist.cs +++ b/KruacentExiled/KE.CustomRoles/CR/Human/Pacifist.cs @@ -1,24 +1,23 @@ -using Exiled.API.Extensions; +using Exiled.API.Enums; +using Exiled.API.Extensions; using Exiled.API.Features; +using Exiled.API.Features.Items; +using Exiled.API.Features.Pickups; +using Exiled.CustomItems.API.Features; using Exiled.Events.EventArgs.Item; using Exiled.Events.EventArgs.Player; -using InventorySystem.Items.ThrowableProjectiles; using KE.CustomRoles.API.Features; -using KE.CustomRoles.API.Interfaces; +using KE.Items.API.Features; using KE.Utils.API.Features; using MEC; using PlayerRoles; -using System; using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using UnityEngine; namespace KE.CustomRoles.CR.Human { public class Pacifist : KECustomRoleMultipleRole { + public const string TranslationCantPickup = "PacifistCantPickup"; protected override Dictionary> SetTranslation() { return new() @@ -27,11 +26,13 @@ protected override Dictionary> SetTranslation { [TranslationKeyName] = "Pacifist", [TranslationKeyDesc] = "You're incapable of violence.\nRemove when escaping and bring more people", + [TranslationCantPickup] = "Picking up this item make you sick", }, ["fr"] = new() { [TranslationKeyName] = "Pacifiste", [TranslationKeyDesc] = "T'es idées empêche quelconque violence.\nS'enlève quand tu t'échappes et ramène plus de renfort", + [TranslationCantPickup] = "Juste la vue de cet objet te rend malade", }, ["legacy"] = new() { @@ -53,8 +54,9 @@ protected override void SubscribeEvents() Exiled.Events.Handlers.Item.Swinging += OnSwinging; Exiled.Events.Handlers.Item.ChargingJailbird += OnChargingJailbird; Exiled.Events.Handlers.Player.Shooting += OnShooting; - Exiled.Events.Handlers.Player.ThrownProjectile += OnThrownProjectile; Exiled.Events.Handlers.Player.Escaping += OnEscaping; + Exiled.Events.Handlers.Player.PickingUpItem += OnPickingUpItem; + Exiled.Events.Handlers.Player.ItemAdded += OnItemAdded; base.SubscribeEvents(); } @@ -64,19 +66,94 @@ protected override void UnsubscribeEvents() Exiled.Events.Handlers.Item.Swinging -= OnSwinging; Exiled.Events.Handlers.Item.ChargingJailbird -= OnChargingJailbird; Exiled.Events.Handlers.Player.Shooting -= OnShooting; - Exiled.Events.Handlers.Player.ThrownProjectile -= OnThrownProjectile; Exiled.Events.Handlers.Player.Escaping -= OnEscaping; + Exiled.Events.Handlers.Player.PickingUpItem -= OnPickingUpItem; + Exiled.Events.Handlers.Player.ItemAdded -= OnItemAdded; base.UnsubscribeEvents(); } - private void OnThrownProjectile(ThrownProjectileEventArgs ev) + + private void OnItemAdded(ItemAddedEventArgs ev) { - if (Check(ev.Player)) + Player player = ev.Player; + if (!Check(player)) return; + Item item = ev.Item; + + if (IsViolent(item)) + { + ShowEffectHint(player, GetTranslation(player, TranslationCantPickup)); + Timing.CallDelayed(.01f, () => + { + player.DropItem(item); + }); + } + } + + + private void OnPickingUpItem(PickingUpItemEventArgs ev) + { + Player player = ev.Player; + if (!ev.IsAllowed) return; + if (!Check(player)) return; + + bool isViolent = IsViolent(ev.Pickup); + ev.IsAllowed = !isViolent; + + KELog.Debug("violent " + isViolent); + if (isViolent) + { + ShowEffectHint(player, GetTranslation(player, TranslationCantPickup)); + } + } + + private bool IsViolent(Pickup pickup) + { + bool result = IsViolent(pickup.Type); + if (KECustomItem.TryGet(pickup, out CustomItem ci)) + { + if (ci is KECustomItem kecr) + { + result = kecr.IsViolent(); + } + + } + return result; + } + + private bool IsViolent(Item item) + { + bool result = IsViolent(item.Type); + if (KECustomItem.TryGet(item, out CustomItem ci)) { - ev.Throwable.Destroy(); + if (ci is KECustomItem kecr) + { + result = kecr.IsViolent(); + } + } + return result; + } + private bool IsViolent(ItemType itemtype) + { + if (itemtype.IsWeapon()) + { + return true; + } + + if (itemtype.GetCategory() == ItemCategory.Firearm) + { + return true; + } + + ProjectileType projectileType = itemtype.GetProjectileType(); + if (projectileType == ProjectileType.FragGrenade || projectileType == ProjectileType.Scp018) + { + return true; + } + return false; } + private void OnDisruptorFiring(DisruptorFiringEventArgs ev) { if (Check(ev.Attacker)) From e4ea699071b6a881efd3d6623b1584fd5d71a3e4 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Tue, 7 Apr 2026 17:10:29 +0200 Subject: [PATCH 815/853] added surface + reduce blackout duration --- .../KE.Map/Others/BlackoutNDoor/Blackout.cs | 2 +- .../Others/BlackoutNDoor/Handlers/Handler.cs | 8 ++++++- .../Others/BlackoutNDoor/Handlers/MapEvent.cs | 22 +++++++++++++------ KruacentExiled/KE.Map/Translations.cs | 2 ++ 4 files changed, 25 insertions(+), 9 deletions(-) diff --git a/KruacentExiled/KE.Map/Others/BlackoutNDoor/Blackout.cs b/KruacentExiled/KE.Map/Others/BlackoutNDoor/Blackout.cs index a1b1d2ea..f2e7f360 100644 --- a/KruacentExiled/KE.Map/Others/BlackoutNDoor/Blackout.cs +++ b/KruacentExiled/KE.Map/Others/BlackoutNDoor/Blackout.cs @@ -15,7 +15,7 @@ public class Blackout : MapEvent public override string Cassie => MainPlugin.Translations.Blackout; public override string CassieTranslated => MainPlugin.Translations.BlackoutTranslation; - public override float Duration => 30; + public override float Duration => 20; private ZoneType currentZone = ZoneType.Unspecified; public override void Start(ZoneType zone) diff --git a/KruacentExiled/KE.Map/Others/BlackoutNDoor/Handlers/Handler.cs b/KruacentExiled/KE.Map/Others/BlackoutNDoor/Handlers/Handler.cs index b7658be4..a8c211dc 100644 --- a/KruacentExiled/KE.Map/Others/BlackoutNDoor/Handlers/Handler.cs +++ b/KruacentExiled/KE.Map/Others/BlackoutNDoor/Handlers/Handler.cs @@ -28,7 +28,7 @@ public class Handler : IUsingEvents public static readonly HashSet Zones = new() { - FacilityZone.LightContainment,FacilityZone.HeavyContainment,FacilityZone.Entrance + FacilityZone.LightContainment,FacilityZone.HeavyContainment,FacilityZone.Entrance,FacilityZone.Surface }; private FacilityZone currentScpZone = FacilityZone.None; @@ -142,6 +142,10 @@ private void LaunchEvent() { zone = choseZoneEv.Zone; } + else + { + throw new ArgumentException($"zone ({choseZoneEv.Zone}) not authorized"); + } @@ -179,6 +183,7 @@ private string ZoneTypeToCassie(ZoneType zone) ZoneType.LightContainment => MainPlugin.Translations.LightContainment, ZoneType.HeavyContainment => MainPlugin.Translations.HeavyContainment, ZoneType.Entrance => MainPlugin.Translations.EntranceZone, + ZoneType.Surface => MainPlugin.Translations.SurfaceZone, _ => string.Empty }; } @@ -190,6 +195,7 @@ private string ZoneTypeToCassieTranslated(ZoneType zone) ZoneType.LightContainment => MainPlugin.Translations.LightContainmentTranslation, ZoneType.HeavyContainment => MainPlugin.Translations.HeavyContainmentTranslation, ZoneType.Entrance => MainPlugin.Translations.EntranceZoneTranslation, + ZoneType.Surface => MainPlugin.Translations.SurfaceZoneTranslation, _ => string.Empty }; } diff --git a/KruacentExiled/KE.Map/Others/BlackoutNDoor/Handlers/MapEvent.cs b/KruacentExiled/KE.Map/Others/BlackoutNDoor/Handlers/MapEvent.cs index 66f14937..c7a98f77 100644 --- a/KruacentExiled/KE.Map/Others/BlackoutNDoor/Handlers/MapEvent.cs +++ b/KruacentExiled/KE.Map/Others/BlackoutNDoor/Handlers/MapEvent.cs @@ -27,14 +27,22 @@ public void StartEvent(ZoneType zone,float maxTime) time = Mathf.Clamp(Duration, 1, maxTime); } - Start(zone); - Timing.CallDelayed(time, delegate + try { - Log.Debug("stopping"); - Stop(zone); - PostEventEventArgs postEv = new PostEventEventArgs(this); - Events.Handlers.BlackoutNDoor.OnPostEvent(postEv); - }); + Start(zone); + } + finally + { + Timing.CallDelayed(time, delegate + { + Log.Debug("stopping"); + Stop(zone); + PostEventEventArgs postEv = new PostEventEventArgs(this); + Events.Handlers.BlackoutNDoor.OnPostEvent(postEv); + }); + } + + } diff --git a/KruacentExiled/KE.Map/Translations.cs b/KruacentExiled/KE.Map/Translations.cs index e94fff0a..fd3fad11 100644 --- a/KruacentExiled/KE.Map/Translations.cs +++ b/KruacentExiled/KE.Map/Translations.cs @@ -24,6 +24,8 @@ public class Translations : ITranslation public string HeavyContainmentTranslation { get; set; } = "Heavy Containment Zone"; public string EntranceZone { get; set; } = "Entrance Zone"; public string EntranceZoneTranslation { get; set; } = "Entrance Zone"; + public string SurfaceZone { get; set; } = "Surface"; + public string SurfaceZoneTranslation { get; set; } = "Surface"; public string End { get; set; } = "In 5 seconds"; From 158e8deb8af9257f622dad4b8c745286e83eb2f0 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Tue, 7 Apr 2026 17:23:39 +0200 Subject: [PATCH 816/853] remove spawn at gate A & B --- .../KE.GlobalEventFramework.Examples/GE/RandomSpawn.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/KruacentExiled/KE.GlobalEventFramework.Examples/GE/RandomSpawn.cs b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/RandomSpawn.cs index 793775b0..0afea2f6 100644 --- a/KruacentExiled/KE.GlobalEventFramework.Examples/GE/RandomSpawn.cs +++ b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/RandomSpawn.cs @@ -30,7 +30,7 @@ public class RandomSpawn : GlobalEvent,IStart /// public override int WeightedChance { get; set; } = 5; public override ImpactLevel ImpactLevel => ImpactLevel.High; - public IEnumerable BlacklistedRooms { get; } = []; + public IEnumerable BlacklistedRooms { get; } = [RoomType.EzGateA, RoomType.EzGateB]; /// public void Start() { From 3e93f3a27c89654695a22518eca54e0f59777554 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Tue, 7 Apr 2026 20:56:30 +0200 Subject: [PATCH 817/853] fix last message not showing --- .../Features/LastHuman/LastHumanHandler.cs | 59 +++++++++++++------ 1 file changed, 41 insertions(+), 18 deletions(-) diff --git a/KruacentExiled/KE.Misc/Features/LastHuman/LastHumanHandler.cs b/KruacentExiled/KE.Misc/Features/LastHuman/LastHumanHandler.cs index 4f479df1..e18683af 100644 --- a/KruacentExiled/KE.Misc/Features/LastHuman/LastHumanHandler.cs +++ b/KruacentExiled/KE.Misc/Features/LastHuman/LastHumanHandler.cs @@ -74,30 +74,39 @@ private void OnChangedRole(PlayerChangedRoleEventArgs ev) if (SCPTeam.IsSCP(ev.Player.ReferenceHub)) return; - if(TryGetLastTarget(out Player lastTarget)) + if (TryGetLastTarget(out Player lastTarget)) { + if(lastTarget == LastTarget) + { + KELog.Debug("target didn't change"); + + return; + } + + LastTarget = lastTarget; + foreach (Player player in Player.Enumerable) { - AbstractHint hint = DisplayHandler.Instance.GetHint(lastTarget, position.HintPlacement); + AbstractHint hint = DisplayHandler.Instance.GetHint(player, position.HintPlacement); if (hint is null || hint.Hide) { string translatedZone = lastTarget.Zone.GetTranslatedName(TranslationHub.GetLang(player)); - + KELog.Debug("tra,slated zone ="+translatedZone); string msg = string.Empty; if (player == lastTarget) { - msg = MainPlugin.GetTranslation(player,TextLast.GetRandomValue()); + msg = MainPlugin.GetTranslation(player, TextLast.GetRandomValue()); } - else if(!player.IsDead) + else if (!player.IsDead) { - + msg = MainPlugin.GetTranslation(player, TextSCP).Replace("%Zone%", translatedZone); } - + if (!player.IsDead && DateTime.Now >= _nextPossibleHint) { @@ -105,33 +114,47 @@ private void OnChangedRole(PlayerChangedRoleEventArgs ev) KELog.Debug("show message to " + lastTarget.Nickname); _nextPossibleHint = DateTime.Now.Add(Cooldown); } - - - - } - } - - - + } + else + { + KELog.Debug("hint still there"); + } + } + } + else + { + KELog.Debug("set target null"); + LastTarget = null; + } + } + private Player last; + private Player LastTarget + { + get + { + return last; + } + set + { + last = value; } } - - private static bool TryGetLastTarget(out Player lastTarget) + private bool TryGetLastTarget(out Player lastTarget) { lastTarget = null; int numberHuman = 0; int numberSCP = 0; foreach (ReferenceHub allHub in ReferenceHub.AllHubs) { - KELog.Debug(allHub.nicknameSync.DisplayName); if (allHub.IsHuman() && !SCPTeam.IsSCP(allHub)) { numberHuman++; lastTarget = Player.Get(allHub); + } else if (SCPTeam.IsSCP(allHub)) { From 9a14a9071f955ac7b6717fd63425922348aaba11 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Tue, 7 Apr 2026 20:57:55 +0200 Subject: [PATCH 818/853] forgor a comma --- KruacentExiled/KE.GlobalEventFramework.Examples/GE/ItemRain.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/KruacentExiled/KE.GlobalEventFramework.Examples/GE/ItemRain.cs b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/ItemRain.cs index 165d2f35..c8356070 100644 --- a/KruacentExiled/KE.GlobalEventFramework.Examples/GE/ItemRain.cs +++ b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/ItemRain.cs @@ -27,7 +27,7 @@ public class ItemRain : GlobalEvent, IAsyncStart public static readonly HashSet BlacklistedItems = new() { - ItemType.None,ItemType.Coal,ItemType.SpecialCoal,ItemType.Snowball,ItemType.SCP1507Tape,ItemType.Scp021J,ItemType.DebugRagdollMover + ItemType.None,ItemType.Coal,ItemType.SpecialCoal,ItemType.Snowball,ItemType.SCP1507Tape,ItemType.Scp021J,ItemType.DebugRagdollMover, ItemType.KeycardCustomManagement,ItemType.KeycardCustomMetalCase,ItemType.KeycardCustomSite02,ItemType.KeycardCustomTaskForce, }; public IEnumerator Start() From 21127beab0813555781e66cebd555dca4832e1cf Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Wed, 8 Apr 2026 16:45:56 +0200 Subject: [PATCH 819/853] fix the ragdoll arrow crash --- .../KE.CustomRoles/CR/CustomSCPs/SCP049C/RagdollArrowComp.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP049C/RagdollArrowComp.cs b/KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP049C/RagdollArrowComp.cs index f46b5120..b9e66095 100644 --- a/KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP049C/RagdollArrowComp.cs +++ b/KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP049C/RagdollArrowComp.cs @@ -45,6 +45,7 @@ private void OnDestroy() public void SetColor(Color color) { + if (arrow == null) return; StringBuilder sb = StringBuilderPool.Shared.Rent(); sb.Append(" Date: Wed, 8 Apr 2026 16:46:53 +0200 Subject: [PATCH 820/853] added current stat to unlockable --- .../CR/CustomSCPs/SCP049C/SCP049CLevelSystem.cs | 6 +++++- .../KE.CustomRoles/CR/CustomSCPs/SCP049C/SCP049CRole.cs | 3 +++ .../UnlockableAbilities/Tier1/MoreShieldUnlockable.cs | 4 +++- .../UnlockableAbilities/Tier2/DeflectDamageUnlockable.cs | 9 +++++---- .../SCP049C/UnlockableAbilities/Tier3/SpeedUnlockable.cs | 8 +++++--- 5 files changed, 21 insertions(+), 9 deletions(-) diff --git a/KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP049C/SCP049CLevelSystem.cs b/KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP049C/SCP049CLevelSystem.cs index d8f41495..36afafdf 100644 --- a/KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP049C/SCP049CLevelSystem.cs +++ b/KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP049C/SCP049CLevelSystem.cs @@ -296,7 +296,11 @@ private void UpdateTime() private void Reset() { - ragdoll.GameObject.GetComponent().SetColor(Color.white); + if(ragdoll.GameObject.TryGetComponent(out var comp)) + { + comp.SetColor(Color.white); + } + ragdoll = null; cooldown = 0; } diff --git a/KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP049C/SCP049CRole.cs b/KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP049C/SCP049CRole.cs index a82a213c..6eb7b519 100644 --- a/KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP049C/SCP049CRole.cs +++ b/KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP049C/SCP049CRole.cs @@ -4,6 +4,7 @@ using Exiled.Events.EventArgs.Scp049; using KE.CustomRoles.API.Features; using KE.CustomRoles.CR.CustomSCPs.SCP049C.Positions; +using KE.CustomRoles.CR.CustomSCPs.SCP049C.UnlockableAbilities.Tier2; using KE.Utils.API.Displays.DisplayMeow; using LabApi.Events.Arguments.Scp049Events; using NorthwoodLib.Pools; @@ -120,6 +121,7 @@ protected override void SubscribeEvents() Exiled.Events.Handlers.Scp049.FinishingRecall += OnFinishingRecall; LabApi.Events.Handlers.Scp049Events.UsedDoctorsCall += OnUsedDoctorsCall; Exiled.Events.Handlers.Player.SpawnedRagdoll += OnSpawnedRagdoll; + Exiled.Events.Handlers.Player.Hurting += DeflectDamageUnlockable.OnHurting; base.SubscribeEvents(); } protected override void UnsubscribeEvents() @@ -127,6 +129,7 @@ protected override void UnsubscribeEvents() Exiled.Events.Handlers.Scp049.FinishingRecall -= OnFinishingRecall; LabApi.Events.Handlers.Scp049Events.UsedDoctorsCall -= OnUsedDoctorsCall; Exiled.Events.Handlers.Player.SpawnedRagdoll -= OnSpawnedRagdoll; + Exiled.Events.Handlers.Player.Hurting -= DeflectDamageUnlockable.OnHurting; base.UnsubscribeEvents(); } private void OnFinishingRecall(FinishingRecallEventArgs ev) diff --git a/KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP049C/UnlockableAbilities/Tier1/MoreShieldUnlockable.cs b/KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP049C/UnlockableAbilities/Tier1/MoreShieldUnlockable.cs index 5070ff23..4df1182d 100644 --- a/KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP049C/UnlockableAbilities/Tier1/MoreShieldUnlockable.cs +++ b/KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP049C/UnlockableAbilities/Tier1/MoreShieldUnlockable.cs @@ -1,5 +1,6 @@ using Exiled.API.Features; using PlayerRoles.PlayableScps.HumeShield; +using PlayerStatsSystem; using System; using UnityEngine; using LabPlayer = LabApi.Features.Wrappers.Player; @@ -12,9 +13,10 @@ public override string GetName(ReferenceHub hub) { return "More shield"; } + public const float Shield = 1100f; public override string GetDescription(ReferenceHub hub) { - return "Set your max Shield at 1100\ninstead of 300"; + return $"Set your max Shield at {Shield}\ninstead of {hub.playerStats.GetModule().MaxValue}"; } public override void Grant(ReferenceHub hub) { diff --git a/KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP049C/UnlockableAbilities/Tier2/DeflectDamageUnlockable.cs b/KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP049C/UnlockableAbilities/Tier2/DeflectDamageUnlockable.cs index 9da6b4ec..c581b138 100644 --- a/KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP049C/UnlockableAbilities/Tier2/DeflectDamageUnlockable.cs +++ b/KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP049C/UnlockableAbilities/Tier2/DeflectDamageUnlockable.cs @@ -22,21 +22,22 @@ public override string GetDescription(ReferenceHub hub) } - private Dictionary cooldowns = new(); + private static Dictionary cooldowns = new(); public override void Grant(ReferenceHub hub) { cooldowns.Add(hub, null); - Exiled.Events.Handlers.Player.Hurting += OnHurting; + } public override void Remove(ReferenceHub hub) { - + + cooldowns.Remove(hub); } - private void OnHurting(HurtingEventArgs ev) + internal static void OnHurting(HurtingEventArgs ev) { ReferenceHub hub = ev.Player.ReferenceHub; diff --git a/KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP049C/UnlockableAbilities/Tier3/SpeedUnlockable.cs b/KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP049C/UnlockableAbilities/Tier3/SpeedUnlockable.cs index 28892d5a..5514545b 100644 --- a/KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP049C/UnlockableAbilities/Tier3/SpeedUnlockable.cs +++ b/KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP049C/UnlockableAbilities/Tier3/SpeedUnlockable.cs @@ -2,6 +2,7 @@ using Exiled.API.Features; using InventorySystem.Items.Usables.Scp1344; using KE.Utils.API.Features; +using KE.Utils.Extensions; using System; using LabPlayer = LabApi.Features.Wrappers.Player; namespace KE.CustomRoles.CR.CustomSCPs.SCP049C.UnlockableAbilities.Tier3 @@ -28,7 +29,8 @@ public override void Grant(ReferenceHub hub) MovementBoost move = lab.GetEffect(); - lab.EnableEffect((byte)(move.Intensity + Intensity), 0, false); + Player.Get(lab).AddLevelEffect(Intensity); + hub.GetComponent().DisableAll(); @@ -39,10 +41,10 @@ public override void Remove(ReferenceHub hub) LabPlayer lab = LabPlayer.Get(hub); MovementBoost move = lab.GetEffect(); - lab.EnableEffect((byte)(move.Intensity - Intensity), 0, false); + Player.Get(lab).AddLevelEffect(-Intensity); + - } } } From b8f4951d63405d6c1974ba715f4255945567ff32 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Wed, 8 Apr 2026 16:52:58 +0200 Subject: [PATCH 821/853] fix IsViolent() overriding IViolent.IsViolent --- .../KE.Items/API/Features/KECustomItem.cs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/KruacentExiled/KE.Items/API/Features/KECustomItem.cs b/KruacentExiled/KE.Items/API/Features/KECustomItem.cs index 7a6b6883..c9ddbcba 100644 --- a/KruacentExiled/KE.Items/API/Features/KECustomItem.cs +++ b/KruacentExiled/KE.Items/API/Features/KECustomItem.cs @@ -325,25 +325,25 @@ public virtual bool TryRegister() } - public virtual bool IsViolent() + public static bool IsViolent(KECustomItem item) { - if(this is IViolentItem item) + if(item is IViolentItem violent) { - return item.IsViolent; + return violent.IsViolent; } - if (ItemType.IsWeapon(true)) + if (item.ItemType.IsWeapon(true)) { return true; } - ItemCategory itemCategory = ItemType.GetCategory(); + ItemCategory itemCategory = item.ItemType.GetCategory(); if (itemCategory == ItemCategory.Firearm) { return true; } - ProjectileType projectileType = ItemType.GetProjectileType(); - if (projectileType == Exiled.API.Enums.ProjectileType.FragGrenade || projectileType == ProjectileType.Scp018) + ProjectileType projectileType = item.ItemType.GetProjectileType(); + if (projectileType == ProjectileType.FragGrenade || projectileType == ProjectileType.Scp018) { return true; } From e35dacb52f5f8835fe8d3abc3912321096a2b9a3 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Wed, 8 Apr 2026 16:54:33 +0200 Subject: [PATCH 822/853] fix violent ci --- KruacentExiled/KE.CustomRoles/CR/Human/Pacifist.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/KruacentExiled/KE.CustomRoles/CR/Human/Pacifist.cs b/KruacentExiled/KE.CustomRoles/CR/Human/Pacifist.cs index d525c084..dfde153c 100644 --- a/KruacentExiled/KE.CustomRoles/CR/Human/Pacifist.cs +++ b/KruacentExiled/KE.CustomRoles/CR/Human/Pacifist.cs @@ -112,7 +112,7 @@ private bool IsViolent(Pickup pickup) { if (ci is KECustomItem kecr) { - result = kecr.IsViolent(); + result = KECustomItem.IsViolent(kecr); } } @@ -126,7 +126,7 @@ private bool IsViolent(Item item) { if (ci is KECustomItem kecr) { - result = kecr.IsViolent(); + result = KECustomItem.IsViolent(kecr); } } From 4165355376ec517df364ff4dea4a0768963715f8 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Wed, 8 Apr 2026 16:55:45 +0200 Subject: [PATCH 823/853] fix again --- KruacentExiled/KE.Items/API/Features/KECustomItem.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/KruacentExiled/KE.Items/API/Features/KECustomItem.cs b/KruacentExiled/KE.Items/API/Features/KECustomItem.cs index c9ddbcba..74bf5eb0 100644 --- a/KruacentExiled/KE.Items/API/Features/KECustomItem.cs +++ b/KruacentExiled/KE.Items/API/Features/KECustomItem.cs @@ -325,7 +325,7 @@ public virtual bool TryRegister() } - public static bool IsViolent(KECustomItem item) + public static bool IsConsideredViolent(KECustomItem item) { if(item is IViolentItem violent) { From dd7189b313c1dba3a01b98a835f807a83750f780 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Wed, 8 Apr 2026 16:56:35 +0200 Subject: [PATCH 824/853] fix again --- KruacentExiled/KE.CustomRoles/CR/Human/Pacifist.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/KruacentExiled/KE.CustomRoles/CR/Human/Pacifist.cs b/KruacentExiled/KE.CustomRoles/CR/Human/Pacifist.cs index dfde153c..4ff103a3 100644 --- a/KruacentExiled/KE.CustomRoles/CR/Human/Pacifist.cs +++ b/KruacentExiled/KE.CustomRoles/CR/Human/Pacifist.cs @@ -112,7 +112,7 @@ private bool IsViolent(Pickup pickup) { if (ci is KECustomItem kecr) { - result = KECustomItem.IsViolent(kecr); + result = KECustomItem.IsConsideredViolent(kecr); } } @@ -126,7 +126,7 @@ private bool IsViolent(Item item) { if (ci is KECustomItem kecr) { - result = KECustomItem.IsViolent(kecr); + result = KECustomItem.IsConsideredViolent(kecr); } } From de92a22de829ba84d8be3313c000cb237e41554e Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Wed, 8 Apr 2026 16:59:04 +0200 Subject: [PATCH 825/853] uses Role.Color --- .../ItemEffects/ProximityGrenadeEffect.cs | 35 +------------------ 1 file changed, 1 insertion(+), 34 deletions(-) diff --git a/KruacentExiled/KE.Items/Items/ItemEffects/ProximityGrenadeEffect.cs b/KruacentExiled/KE.Items/Items/ItemEffects/ProximityGrenadeEffect.cs index 45a0e0b6..3b600cb0 100644 --- a/KruacentExiled/KE.Items/Items/ItemEffects/ProximityGrenadeEffect.cs +++ b/KruacentExiled/KE.Items/Items/ItemEffects/ProximityGrenadeEffect.cs @@ -62,9 +62,7 @@ public void OnExploding(Room originRoom, Vector3 position) { if (roomsInRange.Contains(player.CurrentRoom)) { - var color = GetTeamColor(player); - - var lineColor = new Color(color.red, color.green, color.blue); + var lineColor = player.Role.Color; var direction = player.Position - position; var distance = direction.magnitude; @@ -81,37 +79,6 @@ public void OnExploding(Room originRoom, Vector3 position) } } - public (float red, float green, float blue) GetTeamColor(Player player) - { - float red; - float green; - float blue; - - switch (player.Role.Side) - { - case Side.Mtf: - red = 0; - green = 0.39f; - blue = 1; - break; - case Side.ChaosInsurgency: - red = 0; - green = 0.51f; - blue = 0; - break; - case Side.Scp: - red = 0.59f; - green = 0; - blue = 0; - break; - default: - red = 1; - green = 0.41f; - blue = 0.71f; - break; - } - return (red, green, blue); - } } } \ No newline at end of file From e2830b0e3c69b461be2f11accc6471585ab80f75 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Wed, 8 Apr 2026 17:17:47 +0200 Subject: [PATCH 826/853] maybe later --- .../KE.Map/Surface/ElevatorGateA/CustomKillerCollision.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/KruacentExiled/KE.Map/Surface/ElevatorGateA/CustomKillerCollision.cs b/KruacentExiled/KE.Map/Surface/ElevatorGateA/CustomKillerCollision.cs index f44403ab..b224e5e8 100644 --- a/KruacentExiled/KE.Map/Surface/ElevatorGateA/CustomKillerCollision.cs +++ b/KruacentExiled/KE.Map/Surface/ElevatorGateA/CustomKillerCollision.cs @@ -14,7 +14,7 @@ namespace KE.Map.Surface.ElevatorGateA { public class CustomKillerCollision : MonoBehaviour { - + // use OnTriggerEnter instead private Collider[] NonAlloc = new Collider[8]; From 0c3f4bb2172d330aeb63c35ad9ebe490ac877b53 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Wed, 8 Apr 2026 17:20:48 +0200 Subject: [PATCH 827/853] removed invalid cooldown --- KruacentExiled/KE.Items/Items/MScan.cs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/KruacentExiled/KE.Items/Items/MScan.cs b/KruacentExiled/KE.Items/Items/MScan.cs index 5461fa9e..f51a546a 100644 --- a/KruacentExiled/KE.Items/Items/MScan.cs +++ b/KruacentExiled/KE.Items/Items/MScan.cs @@ -214,7 +214,6 @@ private void CheckDestruction(Vector3 hitPos, float radius) foreach (Pickup pickup in toDestroy) { Remove(pickup); - Cooldowns.Remove(pickup); pickup.Destroy(); } @@ -225,6 +224,7 @@ private void Remove(Pickup pickup) { ActiveSensors.Remove(pickup); BatteryLife.Remove(pickup); + Cooldowns.Remove(pickup); //Models[pickup].Destroy(); } @@ -248,8 +248,7 @@ private void CheckBattery() foreach (var i in invalid) { - ActiveSensors.Remove(i); - BatteryLife.Remove(i); + Remove(i); i.Destroy(); } ListPool.Pool.Return(invalid); From 80808b72c2f46764dcfa628c49cf28cc4795d346 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Wed, 8 Apr 2026 17:31:51 +0200 Subject: [PATCH 828/853] fix crash when not enough player --- .../MiddleEvents/ShufflePosition.cs | 24 ++++++++++--------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/KruacentExiled/KE.GlobalEventFramework.Examples/MiddleEvents/ShufflePosition.cs b/KruacentExiled/KE.GlobalEventFramework.Examples/MiddleEvents/ShufflePosition.cs index 94ec7357..28ff8c61 100644 --- a/KruacentExiled/KE.GlobalEventFramework.Examples/MiddleEvents/ShufflePosition.cs +++ b/KruacentExiled/KE.GlobalEventFramework.Examples/MiddleEvents/ShufflePosition.cs @@ -34,18 +34,20 @@ public void Start() List players = Player.Enumerable.ToList(); List positions = ListPool.Shared.Rent(players.Count); - - Vector3 tmp = positions[0]; - for (int i = 0; i < positions.Count - 1; i++) - { - positions[i] = players[i+1].Position; - } - - positions[positions.Count - 1] = tmp; - - for(int i = 0; i < players.Count - 1; i++) + if(players.Count > 1) { - players[i].Teleport(positions[i]); + Vector3 tmp = positions[0]; + for (int i = 0; i < positions.Count - 1; i++) + { + positions[i] = players[i + 1].Position; + } + + positions[positions.Count - 1] = tmp; + + for (int i = 0; i < players.Count - 1; i++) + { + players[i].Teleport(positions[i]); + } } } From 3841d60f5648b93d3957e3022588d3d5bf27ecd7 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Wed, 8 Apr 2026 17:53:39 +0200 Subject: [PATCH 829/853] added const translation key --- .../KE.CustomRoles/Abilities/Teleportation.cs | 23 +++++++++++-------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/KruacentExiled/KE.CustomRoles/Abilities/Teleportation.cs b/KruacentExiled/KE.CustomRoles/Abilities/Teleportation.cs index 19b5dfa2..5fd9475f 100644 --- a/KruacentExiled/KE.CustomRoles/Abilities/Teleportation.cs +++ b/KruacentExiled/KE.CustomRoles/Abilities/Teleportation.cs @@ -14,6 +14,11 @@ public class Teleportation : KEAbilities, ICustomIcon, IConditional { public override string Name { get; } = "Teleportation"; + public const string TranslationLift = "TeleportationLift"; + public const string TranslationLcz = "TeleportationLcz"; + public const string TranslationDifferentZone = "TeleportationDifferentZone"; + + protected override Dictionary> SetTranslation() { return new() @@ -22,17 +27,17 @@ protected override Dictionary> SetTranslation { [TranslationKeyName] = "Teleportation", [TranslationKeyDesc] = $"You lose {Damage} HP per teleportation, can't be used in lifts", - ["TeleportationLift"] = "can't teleport in lifts", - ["TeleportationLcz"] = "The target is inaccessible", - ["TeleportationDifferentZone"] = "The target is inaccessible", + [TranslationLift] = "can't teleport in lifts", + [TranslationLcz] = "The target is inaccessible", + [TranslationDifferentZone] = "The target is inaccessible", }, ["fr"] = new() { [TranslationKeyName] = "Téléportation", [TranslationKeyDesc] = $"Tu perds {Damage} HP/téléportation, ne peux pas être utilisé dans les ascenseurs", - ["TeleportationLift"] = "Impossible de se téléporter dans un ascenseur", - ["TeleportationLcz"] = "Position inaccessible", - ["TeleportationDifferentZone"] = "Position inaccessible", + [TranslationLift] = "Impossible de se téléporter dans un ascenseur", + [TranslationLcz] = "Position inaccessible", + [TranslationDifferentZone] = "Position inaccessible", } }; } @@ -85,7 +90,7 @@ private bool CheckValid(Player player,bool showMessage) { if (showMessage) { - ShowEffectHint(player, "TeleportationLift"); + ShowEffectHint(player, TranslationLift); } return false; @@ -96,7 +101,7 @@ private bool CheckValid(Player player,bool showMessage) { if (showMessage) { - ShowEffectHint(player, "TeleportationLcz"); + ShowEffectHint(player, TranslationLcz); } @@ -107,7 +112,7 @@ private bool CheckValid(Player player,bool showMessage) { if (showMessage) { - ShowEffectHint(player, "TeleportationDifferentZone"); + ShowEffectHint(player, TranslationDifferentZone); } return false; } From 9591d3a80dcd80145d4d3fb606a3afcd3a5ddbb0 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Wed, 8 Apr 2026 17:58:44 +0200 Subject: [PATCH 830/853] added frozen 173 --- KruacentExiled/KE.CustomRoles/CR/SCP/SCP173/Frozen.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/KruacentExiled/KE.CustomRoles/CR/SCP/SCP173/Frozen.cs b/KruacentExiled/KE.CustomRoles/CR/SCP/SCP173/Frozen.cs index 3d78a3ea..d4809814 100644 --- a/KruacentExiled/KE.CustomRoles/CR/SCP/SCP173/Frozen.cs +++ b/KruacentExiled/KE.CustomRoles/CR/SCP/SCP173/Frozen.cs @@ -31,7 +31,7 @@ protected override Dictionary> SetTranslation ["fr"] = new() { [TranslationKeyName] = "SCP-173 Glacé", - [TranslationKeyDesc] = "Instead of Tantrum you drop a SCP-244.\nTué quelqu'un qui est en hypothermie donne du shield (dans le jeu hein)", + [TranslationKeyDesc] = "Au lieu de chier tu poses un SCP-244.\nTué quelqu'un qui est en hypothermie donne du shield (dans le jeu hein)", }, ["legacy"] = new() { @@ -42,7 +42,7 @@ protected override Dictionary> SetTranslation } public override bool KeepRoleOnDeath { get; set; } = false; public override bool KeepRoleOnChangingRole { get; set; } = false; - public override float SpawnChance { get; set; } = 0; + public override float SpawnChance { get; set; } = 100; public override int MaxHealth { get; set; } = 4500; public override RoleTypeId Role => RoleTypeId.Scp173; From 7005ad1c84f924dee7d5a38679e6ecae6addde2c Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Thu, 9 Apr 2026 13:15:59 +0200 Subject: [PATCH 831/853] remove KEutils again --- .../Displays/DisplayMeow/DisplayHandler.cs | 67 ------ .../API/Displays/DisplayMeow/HintPlacement.cs | 31 --- .../KE.Utils/API/GifAnimator/RenderGif.cs | 128 ----------- .../KE.Utils/API/Interfaces/IEvents.cs | 17 -- .../KE.Utils/API/Interfaces/ILoadable.cs | 13 -- .../KE.Utils/API/Models/Arrows/Arrow.cs | 58 ----- .../KE.Utils/API/Models/Arrows/MoveArrow.cs | 12 - .../KE.Utils/API/Models/Arrows/RotateArrow.cs | 12 - .../KE.Utils/API/Models/Arrows/ScaleArrow.cs | 12 - .../KE.Utils/API/Models/Arrows/XArrow.cs | 16 -- .../KE.Utils/API/Models/Arrows/YArrow.cs | 16 -- .../KE.Utils/API/Models/Arrows/ZArrow.cs | 16 -- .../Models/Blueprints/AdminToyBlueprint.cs | 69 ------ .../API/Models/Blueprints/LightBlueprint.cs | 37 ---- .../API/Models/Blueprints/ModelBlueprint.cs | 110 --------- .../Models/Blueprints/PrimitiveBlueprint.cs | 39 ---- .../API/Models/Commands/AllCommands.cs | 33 --- .../API/Models/Commands/ChangeColor.cs | 72 ------ .../API/Models/Commands/ChangePrimType.cs | 53 ----- .../API/Models/Commands/CreateModel.cs | 44 ---- .../API/Models/Commands/CreatePrim.cs | 47 ---- .../KE.Utils/API/Models/Commands/ListModel.cs | 42 ---- .../KE.Utils/API/Models/Commands/LoadModel.cs | 65 ------ .../API/Models/Commands/ModeMovePrim.cs | 64 ------ .../KE.Utils/API/Models/Commands/SaveModel.cs | 47 ---- .../API/Models/Commands/SelectModel.cs | 56 ----- .../API/Models/Commands/ShowCenter.cs | 51 ----- KruacentExiled/KE.Utils/API/Models/Model.cs | 202 ----------------- .../KE.Utils/API/Models/ModelCreator.cs | 175 --------------- .../KE.Utils/API/Models/ModelLoader.cs | 152 ------------- KruacentExiled/KE.Utils/API/Models/Models.cs | 47 ---- .../KE.Utils/API/Models/MovementHandler.cs | 208 ------------------ .../KE.Utils/API/Models/SelectedModel.cs | 52 ----- .../Models/ToysSettings/PrimitiveSetting.cs | 31 --- .../API/Models/ToysSettings/ToySetting.cs | 20 -- KruacentExiled/KE.Utils/API/OtherUtils.cs | 18 -- KruacentExiled/KE.Utils/API/Parser.cs | 36 --- .../KE.Utils/API/ReflectionHelper.cs | 47 ---- .../KE.Utils/API/Sounds/SoundPlayer.cs | 115 ---------- .../KE.Utils/Extensions/AdminToyExtension.cs | 29 --- .../KE.Utils/Extensions/DoorExtension.cs | 14 -- .../KE.Utils/Extensions/NpcExtension.cs | 23 -- .../KE.Utils/Extensions/PlayerExtension.cs | 52 ----- .../KE.Utils/Extensions/RoomExtensions.cs | 55 ----- KruacentExiled/KE.Utils/KE.Utils.csproj | 31 --- .../KE.Utils/Quality/Enums/ModelQuality.cs | 16 -- .../Quality/Handlers/QualityToysHandler.cs | 179 --------------- .../KE.Utils/Quality/Models/Base/BaseModel.cs | 41 ---- .../Quality/Models/Base/LightModel.cs | 26 --- .../Quality/Models/Base/PrimitiveModel.cs | 26 --- .../Quality/Models/Examples/MineModel.cs | 118 ---------- .../KE.Utils/Quality/Models/Model.cs | 104 --------- .../KE.Utils/Quality/Models/ModelPrefab.cs | 42 ---- .../KE.Utils/Quality/Models/QualityModel.cs | 40 ---- .../KE.Utils/Quality/QualityHandler.cs | 61 ----- .../KE.Utils/Quality/QualityToysHandler.cs | 155 ------------- .../Quality/Settings/QualitySettings.cs | 62 ------ .../Quality/Structs/LocalWorldSpace.cs | 23 -- KruacentExiled/KE.Utils/Quality/Tests/Test.cs | 108 --------- 59 files changed, 3535 deletions(-) delete mode 100644 KruacentExiled/KE.Utils/API/Displays/DisplayMeow/DisplayHandler.cs delete mode 100644 KruacentExiled/KE.Utils/API/Displays/DisplayMeow/HintPlacement.cs delete mode 100644 KruacentExiled/KE.Utils/API/GifAnimator/RenderGif.cs delete mode 100644 KruacentExiled/KE.Utils/API/Interfaces/IEvents.cs delete mode 100644 KruacentExiled/KE.Utils/API/Interfaces/ILoadable.cs delete mode 100644 KruacentExiled/KE.Utils/API/Models/Arrows/Arrow.cs delete mode 100644 KruacentExiled/KE.Utils/API/Models/Arrows/MoveArrow.cs delete mode 100644 KruacentExiled/KE.Utils/API/Models/Arrows/RotateArrow.cs delete mode 100644 KruacentExiled/KE.Utils/API/Models/Arrows/ScaleArrow.cs delete mode 100644 KruacentExiled/KE.Utils/API/Models/Arrows/XArrow.cs delete mode 100644 KruacentExiled/KE.Utils/API/Models/Arrows/YArrow.cs delete mode 100644 KruacentExiled/KE.Utils/API/Models/Arrows/ZArrow.cs delete mode 100644 KruacentExiled/KE.Utils/API/Models/Blueprints/AdminToyBlueprint.cs delete mode 100644 KruacentExiled/KE.Utils/API/Models/Blueprints/LightBlueprint.cs delete mode 100644 KruacentExiled/KE.Utils/API/Models/Blueprints/ModelBlueprint.cs delete mode 100644 KruacentExiled/KE.Utils/API/Models/Blueprints/PrimitiveBlueprint.cs delete mode 100644 KruacentExiled/KE.Utils/API/Models/Commands/AllCommands.cs delete mode 100644 KruacentExiled/KE.Utils/API/Models/Commands/ChangeColor.cs delete mode 100644 KruacentExiled/KE.Utils/API/Models/Commands/ChangePrimType.cs delete mode 100644 KruacentExiled/KE.Utils/API/Models/Commands/CreateModel.cs delete mode 100644 KruacentExiled/KE.Utils/API/Models/Commands/CreatePrim.cs delete mode 100644 KruacentExiled/KE.Utils/API/Models/Commands/ListModel.cs delete mode 100644 KruacentExiled/KE.Utils/API/Models/Commands/LoadModel.cs delete mode 100644 KruacentExiled/KE.Utils/API/Models/Commands/ModeMovePrim.cs delete mode 100644 KruacentExiled/KE.Utils/API/Models/Commands/SaveModel.cs delete mode 100644 KruacentExiled/KE.Utils/API/Models/Commands/SelectModel.cs delete mode 100644 KruacentExiled/KE.Utils/API/Models/Commands/ShowCenter.cs delete mode 100644 KruacentExiled/KE.Utils/API/Models/Model.cs delete mode 100644 KruacentExiled/KE.Utils/API/Models/ModelCreator.cs delete mode 100644 KruacentExiled/KE.Utils/API/Models/ModelLoader.cs delete mode 100644 KruacentExiled/KE.Utils/API/Models/Models.cs delete mode 100644 KruacentExiled/KE.Utils/API/Models/MovementHandler.cs delete mode 100644 KruacentExiled/KE.Utils/API/Models/SelectedModel.cs delete mode 100644 KruacentExiled/KE.Utils/API/Models/ToysSettings/PrimitiveSetting.cs delete mode 100644 KruacentExiled/KE.Utils/API/Models/ToysSettings/ToySetting.cs delete mode 100644 KruacentExiled/KE.Utils/API/OtherUtils.cs delete mode 100644 KruacentExiled/KE.Utils/API/Parser.cs delete mode 100644 KruacentExiled/KE.Utils/API/ReflectionHelper.cs delete mode 100644 KruacentExiled/KE.Utils/API/Sounds/SoundPlayer.cs delete mode 100644 KruacentExiled/KE.Utils/Extensions/AdminToyExtension.cs delete mode 100644 KruacentExiled/KE.Utils/Extensions/DoorExtension.cs delete mode 100644 KruacentExiled/KE.Utils/Extensions/NpcExtension.cs delete mode 100644 KruacentExiled/KE.Utils/Extensions/PlayerExtension.cs delete mode 100644 KruacentExiled/KE.Utils/Extensions/RoomExtensions.cs delete mode 100644 KruacentExiled/KE.Utils/KE.Utils.csproj delete mode 100644 KruacentExiled/KE.Utils/Quality/Enums/ModelQuality.cs delete mode 100644 KruacentExiled/KE.Utils/Quality/Handlers/QualityToysHandler.cs delete mode 100644 KruacentExiled/KE.Utils/Quality/Models/Base/BaseModel.cs delete mode 100644 KruacentExiled/KE.Utils/Quality/Models/Base/LightModel.cs delete mode 100644 KruacentExiled/KE.Utils/Quality/Models/Base/PrimitiveModel.cs delete mode 100644 KruacentExiled/KE.Utils/Quality/Models/Examples/MineModel.cs delete mode 100644 KruacentExiled/KE.Utils/Quality/Models/Model.cs delete mode 100644 KruacentExiled/KE.Utils/Quality/Models/ModelPrefab.cs delete mode 100644 KruacentExiled/KE.Utils/Quality/Models/QualityModel.cs delete mode 100644 KruacentExiled/KE.Utils/Quality/QualityHandler.cs delete mode 100644 KruacentExiled/KE.Utils/Quality/QualityToysHandler.cs delete mode 100644 KruacentExiled/KE.Utils/Quality/Settings/QualitySettings.cs delete mode 100644 KruacentExiled/KE.Utils/Quality/Structs/LocalWorldSpace.cs delete mode 100644 KruacentExiled/KE.Utils/Quality/Tests/Test.cs diff --git a/KruacentExiled/KE.Utils/API/Displays/DisplayMeow/DisplayHandler.cs b/KruacentExiled/KE.Utils/API/Displays/DisplayMeow/DisplayHandler.cs deleted file mode 100644 index 4ee13535..00000000 --- a/KruacentExiled/KE.Utils/API/Displays/DisplayMeow/DisplayHandler.cs +++ /dev/null @@ -1,67 +0,0 @@ -using Exiled.API.Features; -using HintServiceMeow.Core.Extension; -using HintServiceMeow.Core.Models.Hints; -using HintServiceMeow.Core.Utilities; -using MEC; - - -//damn why the same name -using MHint = HintServiceMeow.Core.Models.Hints.Hint; - -namespace KE.Utils.API.Displays.DisplayMeow -{ - public class DisplayHandler - { - public static DisplayHandler Instance { get; } = new(); - - private DisplayHandler() { } - - - - - - - public MHint AddHint(HintPlacement hintPlacement, Player player, string text, float delay) - { - var dis = PlayerDisplay.Get(player); - string id = $"{player.Id}_{hintPlacement.XCoordinate}_{hintPlacement.YCoordinate}"; - MHint hint; - - if (!dis.TryGetHint(id, out var aHint)) - { - hint = new() - { - Text = text, - XCoordinate = hintPlacement.XCoordinate, - YCoordinate = hintPlacement.YCoordinate, - Alignment = hintPlacement.HintAlignment, - Id = id - - }; - dis.AddHint(hint); - - } - else - { - - hint = (MHint)aHint; - hint.Hide = false; - hint.Text = text; - } - - - hint.HideAfter(delay); - return hint; - } - - - - - - - - - - - } -} diff --git a/KruacentExiled/KE.Utils/API/Displays/DisplayMeow/HintPlacement.cs b/KruacentExiled/KE.Utils/API/Displays/DisplayMeow/HintPlacement.cs deleted file mode 100644 index 936cdbe9..00000000 --- a/KruacentExiled/KE.Utils/API/Displays/DisplayMeow/HintPlacement.cs +++ /dev/null @@ -1,31 +0,0 @@ -using HintServiceMeow.Core.Enum; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace KE.Utils.API.Displays.DisplayMeow -{ - public readonly struct HintPlacement : IEquatable - { - public float YCoordinate { get; } - public float XCoordinate { get; } - public HintAlignment HintAlignment { get; } = HintAlignment.Center; - - - public bool Equals(HintPlacement obj) - { - return YCoordinate == obj.YCoordinate && XCoordinate == obj.XCoordinate; - } - - - public HintPlacement(float xCoordinate, float yCoordinate, HintAlignment alignment = HintAlignment.Center) - { - YCoordinate = yCoordinate; - XCoordinate = xCoordinate; - HintAlignment = alignment; - } - - } -} diff --git a/KruacentExiled/KE.Utils/API/GifAnimator/RenderGif.cs b/KruacentExiled/KE.Utils/API/GifAnimator/RenderGif.cs deleted file mode 100644 index f4276d33..00000000 --- a/KruacentExiled/KE.Utils/API/GifAnimator/RenderGif.cs +++ /dev/null @@ -1,128 +0,0 @@ -using System.Collections.Generic; -using System.Drawing; -using System.Drawing.Imaging; -using System.IO; -using Exiled.API.Features; -using Exiled.API.Features.Toys; -using MEC; -using UnityEngine; -using UnityEngine.Rendering; -using Color = UnityEngine.Color; -namespace KE.Utils.API.GifAnimator -{ - internal class RenderGif - { - - public static void Spawn() - { - - } - - - - private static IEnumerator RenderImageCoroutine(object target, string filePath, float maxWidth, float maxHeight, float distance, float duration, int targetWidth, int targetHeight) - { - if (!File.Exists(filePath)) - { - Log.Debug($"No image was found under: {filePath}"); - yield break; - } - - byte[] imageData = File.ReadAllBytes(filePath); - - - - - - - Texture2D original = new Texture2D(2, 2); - - - try - { - original.LoadRawTextureData(imageData); - } - catch(UnityException) - { - Log.Debug("Image couldnt be loaded."); - yield break; - } - - Texture2D scaled = new Texture2D(targetWidth, targetHeight, TextureFormat.RGBA32, false); - - for (int x = 0; x < targetWidth; x++) - { - for (int y = 0; y < targetHeight; y++) - { - float u = x / (float)targetWidth; - float v = y / (float)targetHeight; - Color color = original.GetPixelBilinear(u, v); - scaled.SetPixel(x, y, color); - } - } - scaled.Apply(); - - float pixelScaleX = maxWidth / targetWidth; - float pixelScaleY = maxHeight / targetHeight; - float scale = Mathf.Min(pixelScaleX, pixelScaleY); - - Vector3 forwardOrigin; - Quaternion rotation = Quaternion.identity; - - if (target is Exiled.API.Features.Player player) - { - forwardOrigin = player.CameraTransform.position + player.CameraTransform.forward * distance; - - Vector3 directionToPlayer = forwardOrigin - player.CameraTransform.position; - directionToPlayer.y = 0; - rotation = Quaternion.LookRotation(directionToPlayer); - } - else if (target is Vector3 position) - { - forwardOrigin = position + Vector3.forward * distance; - Vector3 directionToPosition = forwardOrigin - position; - directionToPosition.y = 0; - rotation = Quaternion.LookRotation(directionToPosition); - } - else if (target is Room room) - { - forwardOrigin = room.Position + Vector3.up * 2f; - Vector3 directionToRoom = forwardOrigin - room.Position; - directionToRoom.y = 0; - rotation = Quaternion.LookRotation(directionToRoom); - } - else - { - Log.Debug("Invalid object type. Valid types: Player, Vector3, Room"); - yield break; - } - - Vector3 offset = new Vector3((targetWidth * scale) / 2f, (targetHeight * scale) / 2f, 0); - - for (int x = 0; x < targetWidth; x++) - { - for (int y = 0; y < targetHeight; y++) - { - Color pixelColor = scaled.GetPixel(x, y); - if (pixelColor.a < 0.1f) - continue; - - Vector3 localOffset = new Vector3(x * scale, y * scale, 0) - offset; - Vector3 worldPos = forwardOrigin + rotation * localOffset; - - Primitive quad = Primitive.Create(PrimitiveType.Quad); - quad.Position = worldPos; - quad.Scale = new Vector3(scale, scale, scale * 0.01f); - quad.Color = pixelColor; - - Quaternion fixedRotation = Quaternion.Euler(0f, rotation.eulerAngles.y, 0f); - quad.Rotation = fixedRotation; - quad.Flags = AdminToys.PrimitiveFlags.Visible; - } - - yield return Timing.WaitForOneFrame; - } - } - - } -} diff --git a/KruacentExiled/KE.Utils/API/Interfaces/IEvents.cs b/KruacentExiled/KE.Utils/API/Interfaces/IEvents.cs deleted file mode 100644 index e573b062..00000000 --- a/KruacentExiled/KE.Utils/API/Interfaces/IEvents.cs +++ /dev/null @@ -1,17 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace KE.Utils.API.Interfaces -{ - public interface IUsingEvents - { - - - public void SubscribeEvents(); - - public void UnsubscribeEvents(); - } -} diff --git a/KruacentExiled/KE.Utils/API/Interfaces/ILoadable.cs b/KruacentExiled/KE.Utils/API/Interfaces/ILoadable.cs deleted file mode 100644 index c9e00399..00000000 --- a/KruacentExiled/KE.Utils/API/Interfaces/ILoadable.cs +++ /dev/null @@ -1,13 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace KE.Utils.API.Interfaces -{ - public interface ILoadable - { - public string Loadable(char separator); - } -} diff --git a/KruacentExiled/KE.Utils/API/Models/Arrows/Arrow.cs b/KruacentExiled/KE.Utils/API/Models/Arrows/Arrow.cs deleted file mode 100644 index 990999c7..00000000 --- a/KruacentExiled/KE.Utils/API/Models/Arrows/Arrow.cs +++ /dev/null @@ -1,58 +0,0 @@ -using Exiled.API.Features.Toys; -using InventorySystem.Items.Keycards; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Net.Sockets; -using System.Text; -using System.Threading.Tasks; -using UnityEngine; - -namespace KE.Utils.API.Models.Arrows -{ - internal abstract class Arrow - { - internal static HashSet List = new(); - internal abstract Vector3 Offset { get; } - internal abstract Vector3 Rotation { get; } - internal abstract Color Color { get; } - - protected readonly Vector3 scale = new Vector3(1f, .1f, .1f); - - private Primitive _primitive; - - internal Primitive Primitive - { - get { return _primitive; } - } - internal Arrow() - { - List.Add(this); - _primitive = Primitive.Create(PrimitiveType.Cube, null, Rotation, scale); - _primitive.Color = Color; - } - - internal void Move(Vector3 newPos) - { - _primitive.Position = newPos + Offset; - } - - internal static bool IsPrimitiveArrow(Primitive p) - { - Arrow a =GetArrow(p); - return a != null; - } - - internal static Arrow GetArrow(Primitive p) - { - - foreach(Arrow a in List) - { - if (p == a.Primitive) - return a; - } - return null; - - } - } -} diff --git a/KruacentExiled/KE.Utils/API/Models/Arrows/MoveArrow.cs b/KruacentExiled/KE.Utils/API/Models/Arrows/MoveArrow.cs deleted file mode 100644 index f3216e7f..00000000 --- a/KruacentExiled/KE.Utils/API/Models/Arrows/MoveArrow.cs +++ /dev/null @@ -1,12 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace KE.Utils.API.Models.Arrows -{ - internal class MoveArrow - { - } -} diff --git a/KruacentExiled/KE.Utils/API/Models/Arrows/RotateArrow.cs b/KruacentExiled/KE.Utils/API/Models/Arrows/RotateArrow.cs deleted file mode 100644 index 518fb4b5..00000000 --- a/KruacentExiled/KE.Utils/API/Models/Arrows/RotateArrow.cs +++ /dev/null @@ -1,12 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace KE.Utils.API.Models.Arrows -{ - internal class RotateArrow - { - } -} diff --git a/KruacentExiled/KE.Utils/API/Models/Arrows/ScaleArrow.cs b/KruacentExiled/KE.Utils/API/Models/Arrows/ScaleArrow.cs deleted file mode 100644 index 99bf7d55..00000000 --- a/KruacentExiled/KE.Utils/API/Models/Arrows/ScaleArrow.cs +++ /dev/null @@ -1,12 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace KE.Utils.API.Models.Arrows -{ - internal class ScaleArrow - { - } -} diff --git a/KruacentExiled/KE.Utils/API/Models/Arrows/XArrow.cs b/KruacentExiled/KE.Utils/API/Models/Arrows/XArrow.cs deleted file mode 100644 index 073802c3..00000000 --- a/KruacentExiled/KE.Utils/API/Models/Arrows/XArrow.cs +++ /dev/null @@ -1,16 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using UnityEngine; - -namespace KE.Utils.API.Models.Arrows -{ - internal class XArrow : Arrow - { - internal override Vector3 Offset => new Vector3(scale.x / 2,0); - internal override Vector3 Rotation => new Vector3(0, 0f, 0f); - internal override Color Color => Color.red; - } -} diff --git a/KruacentExiled/KE.Utils/API/Models/Arrows/YArrow.cs b/KruacentExiled/KE.Utils/API/Models/Arrows/YArrow.cs deleted file mode 100644 index e437766e..00000000 --- a/KruacentExiled/KE.Utils/API/Models/Arrows/YArrow.cs +++ /dev/null @@ -1,16 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using UnityEngine; - -namespace KE.Utils.API.Models.Arrows -{ - internal class YArrow : Arrow - { - internal override Vector3 Offset => new Vector3(0, scale.x / 2); - internal override Vector3 Rotation => new Vector3(0, 0f, 90f); - internal override Color Color => Color.green; - } -} diff --git a/KruacentExiled/KE.Utils/API/Models/Arrows/ZArrow.cs b/KruacentExiled/KE.Utils/API/Models/Arrows/ZArrow.cs deleted file mode 100644 index 30c27866..00000000 --- a/KruacentExiled/KE.Utils/API/Models/Arrows/ZArrow.cs +++ /dev/null @@ -1,16 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using UnityEngine; - -namespace KE.Utils.API.Models.Arrows -{ - internal class ZArrow : Arrow - { - internal override Vector3 Offset => new Vector3(0,0, scale.x / 2); - internal override Vector3 Rotation => new Vector3(0, 90f, 0); - internal override Color Color => Color.blue; - } -} diff --git a/KruacentExiled/KE.Utils/API/Models/Blueprints/AdminToyBlueprint.cs b/KruacentExiled/KE.Utils/API/Models/Blueprints/AdminToyBlueprint.cs deleted file mode 100644 index ccfcff3d..00000000 --- a/KruacentExiled/KE.Utils/API/Models/Blueprints/AdminToyBlueprint.cs +++ /dev/null @@ -1,69 +0,0 @@ -using Exiled.API.Enums; -using Exiled.API.Features.Toys; -using Exiled.API.Interfaces; -using KE.Utils.API.Interfaces; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using UnityEngine; -using Light = Exiled.API.Features.Toys.Light; - -namespace KE.Utils.API.Models.Blueprints -{ - public abstract class AdminToyBlueprint : ILoadable - { - public AdminToyType AdminToyType { get; protected set; } - //local position - public Vector3 Position { get; protected set; } - public Vector3 Rotation { get; protected set; } - public Vector3 Scale { get; protected set; } - - - public static AdminToyBlueprint Create(AdminToy adminToy, Vector3? center = null) - { - AdminToyBlueprint result; - - - if (adminToy.ToyType == AdminToyType.PrimitiveObject) - { - result = new PrimitiveBlueprint(adminToy as Primitive); - - } - else if(adminToy.ToyType == AdminToyType.LightSource) - { - result = new LightBlueprint(adminToy as Light); - } - else - { - throw new NotImplementedException("only primitive and light"); - } - - result.Position = adminToy.Position - center ?? adminToy.Position; - result.Rotation = adminToy.Rotation.eulerAngles; - - return result; - } - - - public string Loadable(char separator) - { - StringBuilder b = new(); - b.Append(AdminToyType.ToString()); - b.Append(separator); - b.Append(Position); - b.Append(separator); - b.Append(Rotation); - b.Append(separator); - b.Append(Scale); - b.Append(separator); - b.Append(Load(separator)); - - - return b.ToString(); - } - public abstract AdminToy Spawn(Vector3 center); - protected abstract string Load(char separator); - } -} diff --git a/KruacentExiled/KE.Utils/API/Models/Blueprints/LightBlueprint.cs b/KruacentExiled/KE.Utils/API/Models/Blueprints/LightBlueprint.cs deleted file mode 100644 index 1dc91294..00000000 --- a/KruacentExiled/KE.Utils/API/Models/Blueprints/LightBlueprint.cs +++ /dev/null @@ -1,37 +0,0 @@ -using Exiled.API.Enums; -using Exiled.API.Features.Toys; -using UnityEngine; -using Light = Exiled.API.Features.Toys.Light; - -namespace KE.Utils.API.Models.Blueprints -{ - public class LightBlueprint : AdminToyBlueprint - { - public Color Color { get; } - public float Intensity { get; } - - public LightBlueprint(Light l) - { - AdminToyType = AdminToyType.PrimitiveObject; - Scale = l.Scale; - Color = l.Color; - Intensity = l.Intensity; - } - - - public override AdminToy Spawn(Vector3 center) - { - var l = Light.Create(Position+center, Rotation, Scale, false); - l.Color = Color; - l.Intensity = Intensity; - - - return l; - } - - protected override string Load(char separator) - { - return "#" + ColorUtility.ToHtmlStringRGBA(Color) + separator + Intensity; - } - } -} diff --git a/KruacentExiled/KE.Utils/API/Models/Blueprints/ModelBlueprint.cs b/KruacentExiled/KE.Utils/API/Models/Blueprints/ModelBlueprint.cs deleted file mode 100644 index 0f3a047c..00000000 --- a/KruacentExiled/KE.Utils/API/Models/Blueprints/ModelBlueprint.cs +++ /dev/null @@ -1,110 +0,0 @@ -using Exiled.API.Features; -using Exiled.API.Features.Core; -using Exiled.API.Features.Doors; -using Exiled.API.Features.Toys; -using Exiled.API.Structs; -using KE.Utils.API.Models.ToysSettings; -using KE.Utils.Quality.Models; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Runtime.InteropServices; -using UnityEngine; -using Light = Exiled.API.Features.Toys.Light; - -namespace KE.Utils.API.Models.Blueprints -{ - public class ModelBlueprint - { - private static List _bps = new(); - public static List Blueprints => _bps.ToList(); - private HashSet _toys = new(); - public IReadOnlyCollection Toys => [.. _toys]; - private string _name; - public string Name - { - get { return _name; } - } - - private ModelBlueprint() { } - - - - /// - /// - /// - /// - /// - public static ModelBlueprint Create(Model model) - { - var oldMbp = Get(model.Name); - _bps.Remove(oldMbp); - - - ModelBlueprint mbp = new(); - mbp._name = model.Name; - _bps.Add(mbp); - - foreach(AdminToy toy in model.Toys) - { - mbp._toys.Add(AdminToyBlueprint.Create(toy,model.Center)); - } - - return mbp; - } - - - public static ModelBlueprint Create(string name,IEnumerable toys = null) - { - ModelBlueprint mbp = new(); - _bps.Add(mbp); - - if (string.IsNullOrEmpty(name)) - { - throw new ArgumentException("name null or empty"); - } - - if(toys != null) - { - foreach(AdminToy at in toys) - { - mbp._toys.Add(AdminToyBlueprint.Create(at)); - } - } - - - - mbp._name = name; - - return mbp; - } - - public void Spawn(Vector3 position) - { - Model m = Model.Create(this, position,false); - - - } - - - #region getters - public static ModelBlueprint Get(string name) - { - foreach (ModelBlueprint m in Blueprints) - { - if (m.Name == name) - { - return m; - } - } - return null; - } - - public static bool TryGet(string name, out ModelBlueprint model) - { - model = Get(name); - return model != null; - } - #endregion - } -} diff --git a/KruacentExiled/KE.Utils/API/Models/Blueprints/PrimitiveBlueprint.cs b/KruacentExiled/KE.Utils/API/Models/Blueprints/PrimitiveBlueprint.cs deleted file mode 100644 index 2e59f30a..00000000 --- a/KruacentExiled/KE.Utils/API/Models/Blueprints/PrimitiveBlueprint.cs +++ /dev/null @@ -1,39 +0,0 @@ -using Exiled.API.Enums; -using Exiled.API.Features.Toys; -using UnityEngine; - -namespace KE.Utils.API.Models.Blueprints -{ - public class PrimitiveBlueprint : AdminToyBlueprint - { - public Color Color { get; } - public PrimitiveType Type { get; } - - - public PrimitiveBlueprint(Primitive p) - { - AdminToyType = AdminToyType.PrimitiveObject; - - Scale = p.Scale; - Color = p.Color; - Type = p.Type; - } - - - - public override AdminToy Spawn(Vector3 center) - { - var p = Primitive.Create(Type,Position+center, Rotation, Scale, false); - p.Collidable = false; - p.Color = Color; - - - return p; - } - - protected override string Load(char separator) - { - return "#" + ColorUtility.ToHtmlStringRGBA(Color) + separator+Type; - } - } -} diff --git a/KruacentExiled/KE.Utils/API/Models/Commands/AllCommands.cs b/KruacentExiled/KE.Utils/API/Models/Commands/AllCommands.cs deleted file mode 100644 index 8ba12e68..00000000 --- a/KruacentExiled/KE.Utils/API/Models/Commands/AllCommands.cs +++ /dev/null @@ -1,33 +0,0 @@ -using CommandSystem; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Reflection; -using System.Text; -using System.Threading.Tasks; - -namespace KE.Utils.API.Models.Commands -{ - public static class AllCommands - { - - public static IEnumerable Get(Assembly assembly = null) - { - return new List() - { - new ChangeColor(), - new ChangePrimType(), - new CreateModel(), - new CreatePrim(), - new ListModel(), - new LoadModel(), - new ModeMovePrim(), - new SelectModel(), - new ShowCenter(), - new SaveModel() - - }; - - } - } -} diff --git a/KruacentExiled/KE.Utils/API/Models/Commands/ChangeColor.cs b/KruacentExiled/KE.Utils/API/Models/Commands/ChangeColor.cs deleted file mode 100644 index 3b78d218..00000000 --- a/KruacentExiled/KE.Utils/API/Models/Commands/ChangeColor.cs +++ /dev/null @@ -1,72 +0,0 @@ -using CommandSystem; -using Exiled.API.Features; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using KE.Utils.API.Models; -using UnityEngine; -using Exiled.API.Features.Toys; - -namespace KE.Utils.API.Models.Commands -{ - public class ChangeColor : ICommand - { - - public string Command { get; } = "changecolor"; - - public string[] Aliases { get; } = { "cc" }; - - public string Description { get; } = "change color rgba (0-255)"; - - public bool Execute(ArraySegment arguments, ICommandSender sender, out string response) - { - Player p = Player.Get(sender); - if (p == null) - { - response = "This player can't do this command"; - return false; - } - - if (arguments.Count < 3) - { - response = "not enough arguments"; - return false; - } - if(!byte.TryParse(arguments.At(0),out byte r) || - !byte.TryParse(arguments.At(1), out byte g) || - !byte.TryParse(arguments.At(2), out byte b)) - { - response = "number between 0 & 255"; - return false; - } - - Color32 c; - - if(arguments.Count > 3 && byte.TryParse(arguments.At(3),out byte a)) - { - c = new Color32(r, g, b, a); - } - else - { - c = new Color32(r, g, b,255); - } - - Primitive prim = Models.Instance.ModelCreator.ModelHandler.SelectedPrimitive; - - if(prim == null) - { - response = "no primitive selected"; - return false; - } - - prim.Color = c; - - - response = $"new color set to " + c.ToString(); - return true; - } - - } -} diff --git a/KruacentExiled/KE.Utils/API/Models/Commands/ChangePrimType.cs b/KruacentExiled/KE.Utils/API/Models/Commands/ChangePrimType.cs deleted file mode 100644 index 434427df..00000000 --- a/KruacentExiled/KE.Utils/API/Models/Commands/ChangePrimType.cs +++ /dev/null @@ -1,53 +0,0 @@ -using CommandSystem; -using Exiled.API.Features; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using KE.Utils.API.Models; -using UnityEngine; - -namespace KE.Utils.API.Models.Commands -{ - public class ChangePrimType : ICommand - { - - public string Command { get; } = "changeprimtype"; - - public string[] Aliases { get; } = { "cpt" }; - - public string Description { get; } = "select the mode : scale,move,rotate"; - - public bool Execute(ArraySegment arguments, ICommandSender sender, out string response) - { - Player p = Player.Get(sender); - if (p == null) - { - response = "This player can't do this command"; - return false; - } - - if (arguments.Count < 1) - { - response = "not enough arguments"; - return false; - } - string type = arguments.At(0); - - - if(!Enum.TryParse(type, out PrimitiveType prim)) - { - response = "wrong argument"; - return false; - } - - - Models.Instance.ModelCreator.ModelHandler.SelectedPrimitive.Type = prim; - - response = $"Mode set to " + prim ; - return true; - } - - } -} diff --git a/KruacentExiled/KE.Utils/API/Models/Commands/CreateModel.cs b/KruacentExiled/KE.Utils/API/Models/Commands/CreateModel.cs deleted file mode 100644 index d549cb50..00000000 --- a/KruacentExiled/KE.Utils/API/Models/Commands/CreateModel.cs +++ /dev/null @@ -1,44 +0,0 @@ -using CommandSystem; -using Exiled.API.Features; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace KE.Utils.API.Models.Commands -{ - public class CreateModel : ICommand - { - - public string Command { get; } = "create"; - - public string[] Aliases { get; } = { "c" }; - - public string Description { get; } = "create a new model at your position"; - - public bool Execute(ArraySegment arguments, ICommandSender sender, out string response) - { - - Player p = Player.Get(sender); - if (p == null) - { - response = "This player can't do this command"; - return false; - } - - if (arguments.Count < 1) - { - response = "not enough arguments"; - return false; - } - string name = arguments.At(0); - - Model m = Model.Create(p.Position, name); - Models.Instance.ModelCreator.ModelHandler.SelectedModel = m; - response = $"Created & selected model ({m.Name}) at {m.Center}"; - return true; - } - - } -} diff --git a/KruacentExiled/KE.Utils/API/Models/Commands/CreatePrim.cs b/KruacentExiled/KE.Utils/API/Models/Commands/CreatePrim.cs deleted file mode 100644 index edcd6306..00000000 --- a/KruacentExiled/KE.Utils/API/Models/Commands/CreatePrim.cs +++ /dev/null @@ -1,47 +0,0 @@ -using CommandSystem; -using Exiled.API.Features; -using Exiled.API.Features.Toys; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace KE.Utils.API.Models.Commands -{ - public class CreatePrim : ICommand - { - - public string Command { get; } = "createprimitive"; - - public string[] Aliases { get; } = { "cp" }; //no not like that - - public string Description { get; } = "create a new primitive at your position"; - - public bool Execute(ArraySegment arguments, ICommandSender sender, out string response) - { - - Player p = Player.Get(sender); - if (p == null) - { - response = "This player can't do this command"; - return false; - } - - - Model m = Models.Instance.ModelCreator.SelectedModel; - - if (m == null) - { - response = "no model selected"; - return false; - } - m.Add(p.Position); - - - response = "created!"; - return true; - } - - } -} diff --git a/KruacentExiled/KE.Utils/API/Models/Commands/ListModel.cs b/KruacentExiled/KE.Utils/API/Models/Commands/ListModel.cs deleted file mode 100644 index 79f42597..00000000 --- a/KruacentExiled/KE.Utils/API/Models/Commands/ListModel.cs +++ /dev/null @@ -1,42 +0,0 @@ -using CommandSystem; -using Exiled.API.Features; -using KE.Utils.API.Models.Blueprints; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace KE.Utils.API.Models.Commands -{ - public class ListModel : ICommand - { - - public string Command { get; } = "list"; - - public string[] Aliases { get; } = { "l" }; - - public string Description { get; } = "create a new model at your position"; - - public bool Execute(ArraySegment arguments, ICommandSender sender, out string response) - { - StringBuilder b = new(); - b.AppendLine($"Models ({Model.Models.Count}) :"); - foreach (Model m in Model.Models) - { - b.AppendLine($"{m.Name} pos: {m.Center} spawned? :{m.Spawned}"); - } - - b.AppendLine($"Blueprints ({ModelBlueprint.Blueprints.Count}) :"); - foreach (ModelBlueprint m in ModelBlueprint.Blueprints) - { - b.AppendLine($"{m.Name}"); - } - - - response = b.ToString(); - return true; - } - - } -} diff --git a/KruacentExiled/KE.Utils/API/Models/Commands/LoadModel.cs b/KruacentExiled/KE.Utils/API/Models/Commands/LoadModel.cs deleted file mode 100644 index 7be25565..00000000 --- a/KruacentExiled/KE.Utils/API/Models/Commands/LoadModel.cs +++ /dev/null @@ -1,65 +0,0 @@ -using CommandSystem; -using Exiled.API.Features; -using KE.Utils.API.Models.Blueprints; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using System.Xml.Linq; - -namespace KE.Utils.API.Models.Commands -{ - public class LoadModel : ICommand - { - - public string Command { get; } = "load"; - - public string[] Aliases { get; } = { "lo" }; - - public string Description { get; } = "load a model from a blueprint"; - - public bool Execute(ArraySegment arguments, ICommandSender sender, out string response) - { - - Player p = Player.Get(sender); - if (p == null) - { - response = "This player can't do this command"; - return false; - } - - if (arguments.Count < 1) - { - response = "not enough arguments"; - return false; - } - - string name = arguments.At(0); - - if (string.IsNullOrEmpty(name)) - { - response = "name null or empty"; - return false; - } - - foreach(ModelBlueprint bp in ModelBlueprint.Blueprints) - { - - Log.Info($"{bp.Name} == {name} : {bp.Name == name}"); - } - - - if(!ModelBlueprint.TryGet(name,out var mbp)) - { - response = "blueprint not found"; - return false; - } - - mbp.Spawn(p.Position); - response = $"Created model ({mbp.Name}) at {p.Position}"; - return true; - } - - } -} diff --git a/KruacentExiled/KE.Utils/API/Models/Commands/ModeMovePrim.cs b/KruacentExiled/KE.Utils/API/Models/Commands/ModeMovePrim.cs deleted file mode 100644 index 2b9ea091..00000000 --- a/KruacentExiled/KE.Utils/API/Models/Commands/ModeMovePrim.cs +++ /dev/null @@ -1,64 +0,0 @@ -using CommandSystem; -using Exiled.API.Features; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using KE.Utils.API.Models; - -namespace KE.Utils.API.Models.Commands -{ - public class ModeMovePrim : ICommand - { - - public string Command { get; } = "mode"; - - public string[] Aliases { get; } = { "m" }; - - public string Description { get; } = "select the mode : scale,move,rotate"; - - public bool Execute(ArraySegment arguments, ICommandSender sender, out string response) - { - Player p = Player.Get(sender); - if (p == null) - { - response = "This player can't do this command"; - return false; - } - - if (arguments.Count < 1) - { - response = "not enough arguments"; - return false; - } - string mode = arguments.At(0); - - switch(mode) - { - case "m": - case "move": - Models.Instance.ModelCreator.MovementMode = MovementMode.Move; - break; - case "s": - case "scale": - Models.Instance.ModelCreator.MovementMode = MovementMode.Scale; - break; - case "r": - case "rotate": - Models.Instance.ModelCreator.MovementMode = MovementMode.Rotate; - break; - default: - response = "wrong argument"; - return false; - - - } - - - response = $"Mode set to " + Models.Instance.ModelCreator.MovementMode.ToString(); - return true; - } - - } -} diff --git a/KruacentExiled/KE.Utils/API/Models/Commands/SaveModel.cs b/KruacentExiled/KE.Utils/API/Models/Commands/SaveModel.cs deleted file mode 100644 index d40048e5..00000000 --- a/KruacentExiled/KE.Utils/API/Models/Commands/SaveModel.cs +++ /dev/null @@ -1,47 +0,0 @@ -using CommandSystem; -using Exiled.API.Features; -using KE.Utils.API.Models.Blueprints; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using System.Xml.Linq; - -namespace KE.Utils.API.Models.Commands -{ - public class SaveModel : ICommand - { - - public string Command { get; } = "save"; - - public string[] Aliases { get; } = { "sa" }; - - public string Description { get; } = "save a model to file"; - - public bool Execute(ArraySegment arguments, ICommandSender sender, out string response) - { - - Player p = Player.Get(sender); - if (p == null) - { - response = "This player can't do this command"; - return false; - } - - - Model model = Models.Instance.ModelCreator.SelectedModel; - if (model == null) - { - response = "no model selected"; - return false; - } - - model.Save(); - - response = $"Saved ({model.Name})"; - return true; - } - - } -} diff --git a/KruacentExiled/KE.Utils/API/Models/Commands/SelectModel.cs b/KruacentExiled/KE.Utils/API/Models/Commands/SelectModel.cs deleted file mode 100644 index 266ce4d4..00000000 --- a/KruacentExiled/KE.Utils/API/Models/Commands/SelectModel.cs +++ /dev/null @@ -1,56 +0,0 @@ -using CommandSystem; -using Exiled.API.Features; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace KE.Utils.API.Models.Commands -{ - public class SelectModel : ICommand - { - - public string Command { get; } = "select"; - - public string[] Aliases { get; } = { "s" }; - - public string Description { get; } = "select an existing model"; - - public bool Execute(ArraySegment arguments, ICommandSender sender, out string response) - { - - Player p = Player.Get(sender); - if (p == null) - { - response = "This player can't do this command"; - return false; - } - if (arguments.Count < 1) - { - response = "not enough arguments"; - return false; - } - string name = arguments.At(0); - - if (string.IsNullOrEmpty(name)) - { - response = "name null or empty"; - return false; - } - - - - - if (!Model.TryGet(name, out Model m)) - { - response = "model not found"; - return false; - } - response = $"model ({m.Name}) selected {m.Center}"; - Models.Instance.ModelCreator.ModelHandler.SelectedModel = m; - return true; - } - - } -} diff --git a/KruacentExiled/KE.Utils/API/Models/Commands/ShowCenter.cs b/KruacentExiled/KE.Utils/API/Models/Commands/ShowCenter.cs deleted file mode 100644 index 7b6cc05e..00000000 --- a/KruacentExiled/KE.Utils/API/Models/Commands/ShowCenter.cs +++ /dev/null @@ -1,51 +0,0 @@ -using CommandSystem; -using Exiled.API.Features; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace KE.Utils.API.Models.Commands -{ - public class ShowCenter : ICommand - { - - public string Command { get; } = "show"; - - public string[] Aliases { get; } = { "sh" }; - - public string Description { get; } = "toggle the center of the model"; - - public bool Execute(ArraySegment arguments, ICommandSender sender, out string response) - { - - Player p = Player.Get(sender); - if (p == null) - { - response = "This player can't do this command"; - return false; - } - - Model m = Models.Instance.ModelCreator.ModelHandler.SelectedModel; - - if(m == null) - { - response = "no model selected"; - return false; - } - - if(!bool.TryParse(arguments.At(0),out bool result)) - { - response = "write true or false"; - return false; - } - - m.SetCenterPrimitive(result); - - response = "done"; - - return true; - } - } -} diff --git a/KruacentExiled/KE.Utils/API/Models/Model.cs b/KruacentExiled/KE.Utils/API/Models/Model.cs deleted file mode 100644 index 6e84fbc9..00000000 --- a/KruacentExiled/KE.Utils/API/Models/Model.cs +++ /dev/null @@ -1,202 +0,0 @@ -using Exiled.API.Features; -using Exiled.API.Features.Toys; -using KE.Utils.API.Models.Blueprints; -using System; -using System.Collections.Generic; -using System.Linq; -using UnityEngine; - -namespace KE.Utils.API.Models -{ - public class Model - { - private static List _models = new(); - public static List Models => _models.ToList(); - - private HashSet _toys = new(); - public IReadOnlyCollection Toys => [.. _toys]; - private string _name; - public string Name - { - get { return _name; } - } - - private Vector3 _center; - public Vector3 Center - { - get { return _center; } - } - private bool _spawned = true; - public bool Spawned - { - get { return _spawned; } - } - - private ModelBlueprint _blueprint; - - public ModelBlueprint Blueprint - { - get { return _blueprint; } - } - - public bool LoadedFromBlueprint - { - get - { - return Blueprint != null; - } - } - - - - - - internal Primitive centerPrim; - - public void SetCenterPrimitive(bool show) - { - if (show) - { - centerPrim.Spawn(); - } - else - { - centerPrim.UnSpawn(); - } - } - - - - public Primitive Add(Vector3 pos) - { - var p = Primitive.Create(pos, null, null, true); - - AddToy(p); - return p; - } - - - protected virtual void AddToy(AdminToy toy,bool editMode = true) - { - if(toy is Primitive p && editMode) - { - p.Collidable = true; - } - - - _toys.Add(toy); - } - - private Model(Vector3 center) - { - _models.Add(this); - _center = center; - } - - public static Model Create(Vector3 position, string name) - { - - Model m = new(position); - if (string.IsNullOrEmpty(name)) - { - throw new ArgumentException("name null or empty"); - } - m._name = name; - - Log.Debug("created model id=" + m.Name); - m.centerPrim = Primitive.Create(position, null, Vector3.one / 5, true, new(1, 0, 0, .25f)); - m.centerPrim.Collidable = false; - - return m; - } - - - public static Model Create(ModelBlueprint blueprint,Vector3 position,bool editMode = false) - { - Model m = new(position); - m._name = blueprint.Name; - - foreach (AdminToyBlueprint toy in blueprint.Toys) - { - Log.Info("create toy "+toy.AdminToyType); - AdminToy trueToy = toy.Spawn(m.Center); - - - m.AddToy(trueToy, editMode); - - } - - return m; - - } - - /// - /// Create a based of this

- /// Note : will overwrite the old blueprint - ///
- public void CreateBlueprint() - { - ModelBlueprint bp = ModelBlueprint.Create(this); - - _blueprint = bp; - - } - - - #region getter - public static Model Get(string name) - { - foreach (Model m in _models) - { - if (m.Name == name) - { - return m; - } - } - return null; - } - - public static bool TryGet(string name, out Model model) - { - model = Get(name); - return model != null; - } - - - public override string ToString() - { - return $"{Name} center = {Center}"; - } - #endregion - - #region spawn - public void Spawn() - { - foreach (AdminToy t in Toys) - { - t.Spawn(); - } - _spawned = true; - } - public void UnSpawn() - { - foreach (AdminToy t in Toys) - { - t.UnSpawn(); - } - _spawned = false; - } - - public void Destroy() - { - foreach (AdminToy t in Toys) - { - t.Destroy(); - } - _models.Remove(this); - - } - - #endregion - } -} diff --git a/KruacentExiled/KE.Utils/API/Models/ModelCreator.cs b/KruacentExiled/KE.Utils/API/Models/ModelCreator.cs deleted file mode 100644 index 85758ad9..00000000 --- a/KruacentExiled/KE.Utils/API/Models/ModelCreator.cs +++ /dev/null @@ -1,175 +0,0 @@ -using AdminToys; -using Exiled.API.Features; -using Exiled.API.Features.Items; -using Exiled.API.Features.Toys; -using Exiled.Events.EventArgs.Player; -using KE.Utils.API.Interfaces; -using KE.Utils.API.Models.Arrows; -using MEC; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Runtime.InteropServices; -using System.Text; -using System.Threading.Tasks; -using UnityEngine; - -namespace KE.Utils.API.Models -{ - public class ModelCreator : IUsingEvents - { - - - public const ItemType item = ItemType.GunCOM18; - - public Model SelectedModel - { - get - { - return ModelHandler.SelectedModel; - } - } - public MovementMode MovementMode - { - get - { - return MovementHandler.Mode; - } - set - { - MovementHandler.Mode = value; - } - } - internal MovementHandler MovementHandler { get; private set; } - internal ModelSelection ModelHandler { get; private set; } - - private bool mode = false; - private const float MAX_DISTANCE = 50; - - public static event Action IsAiming; - public static event Action StoppedAiming; - - - - public ModelCreator() - { - - } - - public void SubscribeEvents() - { - - ModelHandler = new(); - MovementHandler = new(); - - ModelLoader.LoadAll(); - MovementHandler.SubscribeEvents(); - Exiled.Events.Handlers.Player.DryfiringWeapon += OnDryfiringWeapon; - Exiled.Events.Handlers.Player.TogglingWeaponFlashlight += OnTogglingWeaponFlashlight; - Exiled.Events.Handlers.Server.RoundStarted += Test; - Exiled.Events.Handlers.Player.AimingDownSight += OnAimingDownSight; - - } - public void UnsubscribeEvents() - { - Exiled.Events.Handlers.Player.DryfiringWeapon -= OnDryfiringWeapon; - Exiled.Events.Handlers.Player.TogglingWeaponFlashlight -= OnTogglingWeaponFlashlight; - Exiled.Events.Handlers.Player.AimingDownSight -= OnAimingDownSight; - Exiled.Events.Handlers.Server.RoundStarted -= Test; - MovementHandler.UnsubscribeEvents(); - - ModelHandler = null; - MovementHandler = null; - } - - private void Test() - { - foreach (var p in Player.List) - { - p.Role.Set(PlayerRoles.RoleTypeId.ChaosConscript); - Timing.CallDelayed(.1f, () => - { - var a = p.AddItem(item); - var b = a as Firearm; - b.MagazineAmmo = 2; - - Primitive.Create(p.Position + Vector3.back, null, null, true, Color.red); - Primitive.Create(p.Position + Vector3.forward, null, null, true, Color.green); - }); - } - } - - - - - private void OnAimingDownSight(AimingDownSightEventArgs ev) - { - if (ev.AdsIn) - { - IsAiming?.Invoke(ev.Player); - } - else - { - StoppedAiming?.Invoke(); - } - } - - private void OnDryfiringWeapon(DryfiringWeaponEventArgs ev) - { - if (ev.Firearm.Type != item) return; - Log.Info("new mode = " + mode); - - if (!mode) - { - - mode = !mode; - } - - - - } - - private void OnTogglingWeaponFlashlight(TogglingWeaponFlashlightEventArgs ev) - { - if (ev.Firearm.Type != item) return; - - - - Primitive p = GetFacingPrimitive(ev.Player); - if (!Arrow.IsPrimitiveArrow(p)) - { - ModelHandler.ChangedSelectedPrim(p); - } - - } - - internal static Primitive GetFacingPrimitive(Player player) - { - Transform cam = player.CameraTransform; - - Vector3 origin = cam.position + cam.forward * 0.5f; - Ray r = new Ray(origin, cam.forward); - if (Physics.Raycast(r, out RaycastHit hit, MAX_DISTANCE)) - { - Log.Info($"hit ({hit.collider.name})"); - PrimitiveObjectToy pot = hit.collider.GetComponentInParent() ?? hit.collider.GetComponentInChildren(); - if (pot != null) - { - return Primitive.Get(pot); - - - } - } - return null; - } - - - - } - public enum MovementMode - { - Move, - Scale, - Rotate - } -} diff --git a/KruacentExiled/KE.Utils/API/Models/ModelLoader.cs b/KruacentExiled/KE.Utils/API/Models/ModelLoader.cs deleted file mode 100644 index d4c60464..00000000 --- a/KruacentExiled/KE.Utils/API/Models/ModelLoader.cs +++ /dev/null @@ -1,152 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.IO; -using Exiled.API.Features; -using Exiled.API.Features.Toys; -using UnityEngine; -using Light = Exiled.API.Features.Toys.Light; -using Exiled.API.Enums; -using KE.Utils.API.Models.Blueprints; -namespace KE.Utils.API.Models -{ - public static class ModelLoader - { - public static string Path => Paths.Configs + @"\"; - private static readonly char SEPARATOR = '_'; - public static string Extension => ".modelscpsl"; - - - public static IEnumerable LoadAll() - { - List m = new(); - - string[] raw = Directory.GetFiles(Path, "*" + Extension); - - foreach (string d in raw) - { - Log.Info("loading="+d); - ModelBlueprint mbp = Load(string.Empty, d); - if(mbp != null) - { - Log.Info($"loaded {mbp.Name} ({mbp.Toys.Count})"); - m.Add(mbp); - } - - } - - return m; - } - - public static ModelBlueprint Load(string filename) - { - return Load(Path, filename); - } - - public static ModelBlueprint Load(string path,string filename) - { - string[] raw; - try - { - raw = File.ReadAllText(path + filename).Split('\n'); - } - catch(Exception e) - { - Log.Error(e); - return null; - } - - - string[] infoline = raw[0].Split(SEPARATOR); - string name = infoline[0]; - List toys = new(); - - - for (int i = 1; i < raw.Length; i++) - { - string[] line = raw[i].Split(SEPARATOR); - AdminToy toy = null; - AdminToyType type; - if (!Enum.TryParse(line[0], out type)) continue; - - Vector3 ATPos = Parser.Vector3(line[1]); - Vector3 ATRotation = Parser.Vector3(line[2]); - Vector3 ATScale = Parser.Vector3(line[3]); - if(type == AdminToyType.PrimitiveObject) - { - Color color; - ColorUtility.TryParseHtmlString(line[4], out color); - PrimitiveType ptype; - Enum.TryParse(line[5], out ptype); - - - var p = Primitive.Create(ptype, ATPos, ATRotation, ATScale, true, color); - p.Collidable = false; - toy = p; - - } - if(type == AdminToyType.LightSource) - { - Color color; - ColorUtility.TryParseHtmlString(line[4], out color); - - float intensity = float.Parse(line[5]); - var l = Light.Create(ATPos, ATRotation, ATScale, true, color); - l.Intensity = intensity; - toy = l; - } - - if (toy == null) continue; - toys.Add(toy); - - } - - - - - return ModelBlueprint.Create(name, toys); - } - - - // Name\n - // Primitive.Position.RotationEuler.Scale.Color.PrimitiveType\n - // Light.Position.RotationEuler.Scale.Color.Intensity\n - // and repeat - public static bool Save(this ModelBlueprint m) - { - - List result = new(); - - result.Add(m.Name+SEPARATOR); - - foreach(AdminToyBlueprint t in m.Toys) - { - result.Add(t.Loadable(SEPARATOR)); - } - - try - { - File.WriteAllLines(Path + m.Name+ Extension, result); - return true; - } - catch(Exception e) - { - Log.Error(e); - return false; - } - - } - - public static bool Save(this Model model) - { - if (!model.LoadedFromBlueprint) - model.CreateBlueprint(); - - - return Save(model.Blueprint); - } - - - } -} diff --git a/KruacentExiled/KE.Utils/API/Models/Models.cs b/KruacentExiled/KE.Utils/API/Models/Models.cs deleted file mode 100644 index 27fe3cf4..00000000 --- a/KruacentExiled/KE.Utils/API/Models/Models.cs +++ /dev/null @@ -1,47 +0,0 @@ -using KE.Utils.API.Interfaces; -using PlayerRoles.FirstPersonControl.Thirdperson; - -namespace KE.Utils.API.Models -{ - public class Models : IUsingEvents - { - public ModelCreator ModelCreator - { - get; - private set; - } - private static Models _instance; - - - public static Models Instance - { - get - { - if (_instance == null) - _instance = new(); - return _instance; - } - } - - public void DestroyInstance() - { - _instance = null; - } - - private Models() - { - ModelCreator = new(); - } - - - public void SubscribeEvents() - { - ModelCreator.SubscribeEvents(); - } - - public void UnsubscribeEvents() - { - ModelCreator.UnsubscribeEvents(); - } - } -} diff --git a/KruacentExiled/KE.Utils/API/Models/MovementHandler.cs b/KruacentExiled/KE.Utils/API/Models/MovementHandler.cs deleted file mode 100644 index 07e3ee18..00000000 --- a/KruacentExiled/KE.Utils/API/Models/MovementHandler.cs +++ /dev/null @@ -1,208 +0,0 @@ -using Exiled.API.Features; -using Exiled.API.Features.Toys; -using Exiled.Events.EventArgs.Player; -using KE.Utils.API.Interfaces; -using KE.Utils.API.Models.Arrows; -using MEC; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using UnityEngine; - -namespace KE.Utils.API.Models -{ - internal class MovementHandler : IUsingEvents - { - - private MovementMode _mode = MovementMode.Move; - - public MovementMode Mode - { - get - { - return _mode; - } - set - { - OnChangingMode?.Invoke(value); - _mode = value; - } - } - public static event Action OnChangingMode; - - - - //xyz - private Arrow[] _arrows = new Arrow[3]; - private bool _primflag = false; - public readonly static float REFRESH_RATE = Timing.WaitForOneFrame; - - private CoroutineHandle _handle; - private bool _aiming = false; - private void TryCreatePrimitives() - { - if (!_primflag) - { - _arrows[0] = new XArrow(); - _arrows[1] = new YArrow(); - _arrows[2] = new ZArrow(); - _primflag = true; - } - } - - - - - public void SubscribeEvents() - { - ModelCreator.IsAiming += IsAiming; - ModelCreator.StoppedAiming += StoppedAiming; - ModelSelection.OnChangedSelection += OnChangedSelection; - ModelSelection.OnUnSelect += OnUnSelect; - } - - public void UnsubscribeEvents() - { - Timing.KillCoroutines(_handle); - - ModelSelection.OnChangedSelection -= OnChangedSelection; - ModelSelection.OnUnSelect -= OnUnSelect; - } - private void OnUnSelect() - { - foreach (Arrow a in Arrow.List) - { - a.Move(Vector3.zero); - } - } - private void OnChangedSelection(Primitive p) - { - Log.Info("ChangedSelection"); - TryCreatePrimitives(); - foreach (Arrow a in Arrow.List) - { - a.Move(p.Position); - } - - } - - - private void IsAiming(Player p) - { - Log.Info("start aim"); - var prim = ModelCreator.GetFacingPrimitive(p); - if (!Arrow.IsPrimitiveArrow(prim)) return; - - _aiming = true; - _handle = Timing.RunCoroutine(Moving(p,prim)); - } - - private void StoppedAiming() - { - Log.Info("stopped aim"); - _aiming = false; - } - - - - private IEnumerator Moving(Player player,Primitive p) - { - Primitive selected = Models.Instance.ModelCreator.ModelHandler.SelectedPrimitive; - Vector3 pos = selected.Position; - Vector3 targetPos = pos; - Vector3 scale = selected.Scale; - Vector3 tScale = scale; - - - - Vector3 oldEuler = player.CameraTransform.rotation.eulerAngles; - Arrow a = Arrow.GetArrow(p); - List otherArrows = Arrow.List.Where(o => o != a).ToList(); - - Vector3 direction = a.Offset.normalized; - float sensitivity = 0.1f; - float smoothSpeed = 5; - - while (_aiming) - { - Vector3 currentEuler = player.CameraTransform.rotation.eulerAngles; - - float deltaYaw = Mathf.DeltaAngle(oldEuler.y, currentEuler.y); - float deltaPitch = Mathf.DeltaAngle(oldEuler.x, currentEuler.x); - - float movementAmount = 0f; - - if (Mathf.Abs(direction.y) > 0.5f) - { - movementAmount = -deltaPitch * sensitivity; - } - else - { - - Vector3 camRight = player.CameraTransform.right; - - float sign = Mathf.Sign(Vector3.Dot(camRight, direction)); - - movementAmount = deltaYaw * sensitivity * sign; - } - - - - - if(Mode == MovementMode.Move) - { - targetPos += direction.normalized * movementAmount; - pos = Vector3.Lerp(pos, targetPos, Time.deltaTime * smoothSpeed); - p.Position = pos; - selected.Position = pos - a.Offset; - foreach (Arrow arrow in otherArrows) - { - arrow.Move(pos - a.Offset); - } - } - - - - if(Mode == MovementMode.Scale) - { - Vector3 previousParallel = direction.normalized * Vector3.Dot(selected.Scale, direction.normalized); - Vector3 dir = direction.normalized; - - float currentLengthInDir = Vector3.Dot(scale, dir); - - float newLengthInDir = Mathf.Clamp(currentLengthInDir + movementAmount, 0.1f, 10f); - - - Vector3 parallel = dir * newLengthInDir; - Vector3 perpendicular = scale - (dir * currentLengthInDir); - - selected.Scale = parallel + perpendicular; - scale = selected.Scale; - - Vector3 deltaParallel = parallel - previousParallel; - a.Primitive.Position += deltaParallel / 2; - previousParallel = parallel; - } - - - - if(Mode == MovementMode.Rotate) - { - Log.Info("no clue how to do that"); - } - - - - - - oldEuler = currentEuler; - yield return REFRESH_RATE; - } - } - - - - } -} diff --git a/KruacentExiled/KE.Utils/API/Models/SelectedModel.cs b/KruacentExiled/KE.Utils/API/Models/SelectedModel.cs deleted file mode 100644 index 7e502f46..00000000 --- a/KruacentExiled/KE.Utils/API/Models/SelectedModel.cs +++ /dev/null @@ -1,52 +0,0 @@ -using Exiled.API.Features; -using Exiled.API.Features.Toys; -using MEC; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using UnityEngine; - -namespace KE.Utils.API.Models -{ - internal class ModelSelection - { - - - - public Model SelectedModel { get; internal set; } - public Primitive SelectedPrimitive; - - public static event Action OnChangedSelection; - public static event Action OnUnSelect; - - public void ChangedSelectedPrim(Primitive newPrim) - { - if (newPrim == null) return; - - - - Log.Info(SelectedPrimitive == null); - Log.Info(newPrim.GameObject.GetInstanceID() != SelectedPrimitive?.GameObject.GetInstanceID()); - - if (SelectedPrimitive == null || newPrim.GameObject.GetInstanceID() != SelectedPrimitive?.GameObject.GetInstanceID()) - { - Log.Info("selecting"); - OnChangedSelection?.Invoke(newPrim); - SelectedPrimitive = newPrim; - } - else - { - Log.Info("unselecting"); - SelectedPrimitive = null; - OnUnSelect?.Invoke(); - } - - } - - - - - } -} diff --git a/KruacentExiled/KE.Utils/API/Models/ToysSettings/PrimitiveSetting.cs b/KruacentExiled/KE.Utils/API/Models/ToysSettings/PrimitiveSetting.cs deleted file mode 100644 index b3ffe31d..00000000 --- a/KruacentExiled/KE.Utils/API/Models/ToysSettings/PrimitiveSetting.cs +++ /dev/null @@ -1,31 +0,0 @@ -using AdminToys; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using UnityEngine; - -namespace KE.Utils.API.Models.ToysSettings -{ - public class PrimitiveSetting : ToySetting - { - - public PrimitiveType PrimitiveType { get; } - - - public PrimitiveFlags Flags { get; } - - - public Color Color { get; } - - public Vector3 Position { get; } - - - public Vector3 Rotation { get; } - - - public Vector3 Scale { get; } - - } -} diff --git a/KruacentExiled/KE.Utils/API/Models/ToysSettings/ToySetting.cs b/KruacentExiled/KE.Utils/API/Models/ToysSettings/ToySetting.cs deleted file mode 100644 index 8fdc4477..00000000 --- a/KruacentExiled/KE.Utils/API/Models/ToysSettings/ToySetting.cs +++ /dev/null @@ -1,20 +0,0 @@ -using Exiled.API.Features.Toys; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace KE.Utils.API.Models.ToysSettings -{ - public abstract class ToySetting - { - - - - public virtual void Create(AdminToy a) - { - - } - } -} diff --git a/KruacentExiled/KE.Utils/API/OtherUtils.cs b/KruacentExiled/KE.Utils/API/OtherUtils.cs deleted file mode 100644 index ef43b888..00000000 --- a/KruacentExiled/KE.Utils/API/OtherUtils.cs +++ /dev/null @@ -1,18 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using UnityEngine; - -namespace KE.Utils.API -{ - public static class OtherUtils - { - - public static bool IsInCircle(Vector3 pos,Vector3 centerCircle,float radius) - { - return (pos-centerCircle).sqrMagnitude <= Math.Pow(radius, 2); - } - } -} diff --git a/KruacentExiled/KE.Utils/API/Parser.cs b/KruacentExiled/KE.Utils/API/Parser.cs deleted file mode 100644 index a924337f..00000000 --- a/KruacentExiled/KE.Utils/API/Parser.cs +++ /dev/null @@ -1,36 +0,0 @@ -using Exiled.API.Features; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using UnityEngine; - -namespace KE.Utils.API -{ - public static class Parser - { - public static Vector3 Vector3(string s) - { - string[] temp = s.Substring(1, s.Length - 3).Split(','); - - if(!float.TryParse(temp[0],out float x)) - { - return UnityEngine.Vector3.zero; - } - - if (!float.TryParse(temp[1], out float y)) - { - return UnityEngine.Vector3.zero; - } - if (!float.TryParse(temp[1], out float z)) - { - return UnityEngine.Vector3.zero; - } - - - - return new Vector3(x, y, z); - } - } -} diff --git a/KruacentExiled/KE.Utils/API/ReflectionHelper.cs b/KruacentExiled/KE.Utils/API/ReflectionHelper.cs deleted file mode 100644 index d95fa32a..00000000 --- a/KruacentExiled/KE.Utils/API/ReflectionHelper.cs +++ /dev/null @@ -1,47 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Reflection; -using System.Text; -using System.Threading.Tasks; - -namespace KE.Utils.API -{ - public static class ReflectionHelper - { - public static IEnumerable GetObjects(Assembly assembly = null) - { - List result = new(); - if (assembly == null) - { - assembly = Assembly.GetCallingAssembly(); - } - foreach (Type t in assembly.GetTypes()) - { - try - { - if (typeof(T).IsAssignableFrom(t) && !t.IsAbstract) - { - T ffcc = (T)Activator.CreateInstance(t); - result.Add(ffcc); - } - } - catch (Exception) - { - - } - } - return result; - } - - public static IEnumerable GetObjects(IEnumerable assemblies) - { - List result = new(); - foreach (Assembly assembly in assemblies) - { - result.AddRange(GetObjects(assembly)); - } - return result; - } - } -} diff --git a/KruacentExiled/KE.Utils/API/Sounds/SoundPlayer.cs b/KruacentExiled/KE.Utils/API/Sounds/SoundPlayer.cs deleted file mode 100644 index 91b4218b..00000000 --- a/KruacentExiled/KE.Utils/API/Sounds/SoundPlayer.cs +++ /dev/null @@ -1,115 +0,0 @@ -using Exiled.API.Features; -using System; -using System.Collections.Generic; -using System.IO; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using UnityEngine; - -namespace KE.Utils.API.Sounds -{ - public class SoundPlayer - { - private static SoundPlayer _instance; - - public static SoundPlayer Instance - { - get - { - if (_instance == null) - { - _instance = new(); - } - return _instance; - } - } - - private SoundPlayer() { } - - private bool _loaded = false; - public bool Loaded => _loaded; - - public static readonly HashSet clips = new(); - - public static string SoundLocation => Paths.Configs + "/Sounds"; - public static void Load() => Instance.TryLoad(); - public void TryLoad() - { - if (Loaded) - { - return; - } - - if (!Directory.Exists(SoundLocation)) - { - Log.Warn("Directory not found. creating..."); - Directory.CreateDirectory(SoundLocation); - } - - string[] rawfile = Directory.GetFiles(SoundLocation, "*.ogg"); - - foreach (string file in rawfile) - { - string noExFile = Path.GetFileNameWithoutExtension(file); - Log.Info($"loading {file} as {noExFile}"); - clips.Add(noExFile); - AudioClipStorage.LoadClip(file); - } - _loaded = true; - } - - - /// - /// Play a clip at a static point - /// - /// - /// - /// - /// - public AudioClipPlayback Play(string clipName, Vector3 pos, float volume = 50f, float maxDistance = 20f, bool isSpatial = true) - { - if (!Loaded) throw new Exception("clips not loaded use SoundPlayer.Load()"); - Log.Debug($"playing {clipName} at {pos}"); - - var audioPlayer = AudioPlayer.CreateOrGet($"{clipName} ({pos})", onIntialCreation: (p) => - { - GameObject a = new GameObject(); - a.transform.position = pos; - p.transform.parent = a.transform; - Speaker speaker = p.AddSpeaker("main", isSpatial: isSpatial, maxDistance: maxDistance, minDistance: 1f); - speaker.transform.parent = a.transform; - speaker.transform.localPosition = Vector3.zero; - }); - - audioPlayer.DestroyWhenAllClipsPlayed = true; - return audioPlayer.AddClip(clipName, volume: volume); - - - } - - /// - /// Play a clip at a - /// - /// - /// - /// - /// - public void Play(string clipName, GameObject objectEmittingSound, float volume = 50f, float maxDistance = 20f, bool isSpatial = true) - { - if (!Loaded) throw new Exception("clips not loaded use SoundPlayer.Instance.Load()"); - Log.Debug($"playing {clipName} at {objectEmittingSound}"); - - var audioPlayer = AudioPlayer.CreateOrGet($"{clipName} ({objectEmittingSound})", onIntialCreation: (p) => - { - - p.transform.parent = objectEmittingSound.transform; - Speaker speaker = p.AddSpeaker("main", isSpatial: isSpatial, maxDistance: maxDistance, minDistance: 1f); - speaker.transform.parent = objectEmittingSound.transform; - speaker.transform.localPosition = Vector3.zero; - }); - audioPlayer.AddClip(clipName, volume: volume); - audioPlayer.DestroyWhenAllClipsPlayed = true; - } - } -} diff --git a/KruacentExiled/KE.Utils/Extensions/AdminToyExtension.cs b/KruacentExiled/KE.Utils/Extensions/AdminToyExtension.cs deleted file mode 100644 index 5eee9c7b..00000000 --- a/KruacentExiled/KE.Utils/Extensions/AdminToyExtension.cs +++ /dev/null @@ -1,29 +0,0 @@ -using AdminToys; -using Exiled.API.Features; -using Exiled.API.Features.Toys; -using KE.Utils.Quality; -using KE.Utils.Quality.Enums; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using UnityEngine; - -namespace KE.Utils.Extensions -{ - public static class AdminToyExtension - { - - public static void SetAsPickupAdminToy(this AdminToy toy, bool autoSync = true) - { - QualityHandler.Instance.QualityToysHandler.SetAsPickup(toy); - } - - public static void SetQuality(this AdminToy toy, ModelQuality modelQuality,bool autoSync = true) - { - QualityHandler.Instance.QualityToysHandler.SetQuality(toy, modelQuality); - } - - } -} diff --git a/KruacentExiled/KE.Utils/Extensions/DoorExtension.cs b/KruacentExiled/KE.Utils/Extensions/DoorExtension.cs deleted file mode 100644 index 2c8bf677..00000000 --- a/KruacentExiled/KE.Utils/Extensions/DoorExtension.cs +++ /dev/null @@ -1,14 +0,0 @@ -using Exiled.API.Features; -using Exiled.API.Features.Doors; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace KE.Utils.Extensions -{ - public static class DoorExtension - { - } -} diff --git a/KruacentExiled/KE.Utils/Extensions/NpcExtension.cs b/KruacentExiled/KE.Utils/Extensions/NpcExtension.cs deleted file mode 100644 index 6af07bc5..00000000 --- a/KruacentExiled/KE.Utils/Extensions/NpcExtension.cs +++ /dev/null @@ -1,23 +0,0 @@ -using CentralAuth; -using Exiled.API.Features; -using Mirror; -using PlayerRoles; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace KE.Utils.Extensions -{ - public static class NpcExtension - { - - - public static void Hide(this Npc npc) - { - npc.ReferenceHub.authManager.NetworkSyncedUserId = "ID_Dedicated"; - npc.ReferenceHub.authManager.syncMode = (SyncMode)ClientInstanceMode.DedicatedServer; - } - } -} diff --git a/KruacentExiled/KE.Utils/Extensions/PlayerExtension.cs b/KruacentExiled/KE.Utils/Extensions/PlayerExtension.cs deleted file mode 100644 index b01f98d2..00000000 --- a/KruacentExiled/KE.Utils/Extensions/PlayerExtension.cs +++ /dev/null @@ -1,52 +0,0 @@ -using CustomPlayerEffects; -using Exiled.API.Enums; -using Exiled.API.Features; -using Mirror; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using UnityEngine; - -namespace KE.Utils.Extensions -{ - public static class PlayerExtension - { - public static void SetFakeInvis(this Player p, IEnumerable viewers) - { - Vector3 pos = p.Position; - - try - { - p.ReferenceHub.transform.localPosition = Vector3.zero; - foreach (Player viewer in viewers) - { - Server.SendSpawnMessage.Invoke(null, new object[2] { viewer.NetworkIdentity, viewer.Connection }); - } - - p.ReferenceHub.transform.localPosition = pos; - } - catch (Exception arg) - { - Log.Error(string.Format("{0}: {1}", "SetFakeInvis", arg)); - } - } - - - - - public static void AddLevelEffect(this Player p,EffectType type, int intensity) - { - - - if (!p.TryGetEffect(type, out var effect)) - p.ChangeEffectIntensity(type, (byte)(effect.Intensity + intensity)); - else - p.EnableEffect(type, (byte)intensity); - } - - - - } -} diff --git a/KruacentExiled/KE.Utils/Extensions/RoomExtensions.cs b/KruacentExiled/KE.Utils/Extensions/RoomExtensions.cs deleted file mode 100644 index 61fd0291..00000000 --- a/KruacentExiled/KE.Utils/Extensions/RoomExtensions.cs +++ /dev/null @@ -1,55 +0,0 @@ -using Exiled.API.Features; -using Exiled.API.Enums; -using Discord; -using System.Linq; -using Exiled.API.Extensions; - -namespace KE.Utils.Extensions -{ - public static class RoomExtensions - { - - - public static Room RandomSafeRoom(this ZoneType zone) - { - return Room.List.Where(r => r.IsSafe() && r.Zone == zone).GetRandomValue(); - } - - - /// - /// Check if a is Safe (Decontamination,Warhead) - /// - /// Note: Does NOT check if the is safe to teleport in (ex : TestRoom) - /// - /// - /// return true if the is safe for a ; false otherwise - public static bool IsSafe(this Room room) - { - return room.Zone.IsSafe(); - } - - - /// - /// Check if a is Safe (Decontamination,Warhead) - /// - /// return true if the zone is safe for a ; false otherwise - public static bool IsSafe(this ZoneType zone) - { - bool result = true; - if (zone == ZoneType.LightContainment) - result = Map.DecontaminationState < DecontaminationState.Countdown; - switch (zone) - { - case ZoneType.LightContainment: - case ZoneType.HeavyContainment: - case ZoneType.Entrance: - result = !Warhead.IsDetonated; - break; - } - return result; - } - - - - } -} diff --git a/KruacentExiled/KE.Utils/KE.Utils.csproj b/KruacentExiled/KE.Utils/KE.Utils.csproj deleted file mode 100644 index f3aa4e9a..00000000 --- a/KruacentExiled/KE.Utils/KE.Utils.csproj +++ /dev/null @@ -1,31 +0,0 @@ - - - - 13.0 - net48 - - - - - - - - - - - - - - - - - - - if not "$(EXILED_DEV_REFERENCES)"=="" copy /y "$(OutputPath)$(AssemblyName).dll" "$(EXILED_DEV_REFERENCES)\Plugins\" - - - if [[ ! -z "$EXILED_DEV_REFERENCES" ]]; then cp "$(OutputPath)$(AssemblyName).dll" "$EXILED_DEV_REFERENCES/Plugins/"; fi - - - - diff --git a/KruacentExiled/KE.Utils/Quality/Enums/ModelQuality.cs b/KruacentExiled/KE.Utils/Quality/Enums/ModelQuality.cs deleted file mode 100644 index d9d8d295..00000000 --- a/KruacentExiled/KE.Utils/Quality/Enums/ModelQuality.cs +++ /dev/null @@ -1,16 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace KE.Utils.Quality.Enums -{ - public enum ModelQuality - { - None = -1, - Low, - Medium, - High, - } -} diff --git a/KruacentExiled/KE.Utils/Quality/Handlers/QualityToysHandler.cs b/KruacentExiled/KE.Utils/Quality/Handlers/QualityToysHandler.cs deleted file mode 100644 index b2485795..00000000 --- a/KruacentExiled/KE.Utils/Quality/Handlers/QualityToysHandler.cs +++ /dev/null @@ -1,179 +0,0 @@ -using AdminToys; -using Exiled.API.Enums; -using Exiled.API.Extensions; -using Exiled.API.Features; -using Exiled.API.Features.Toys; -using KE.Utils.Quality.Enums; -using KE.Utils.Quality.Settings; -using MEC; -using System; -using System.Collections.Generic; -using System.Linq; -using UnityEngine; -using Light = Exiled.API.Features.Toys.Light; -using QualitySettings = KE.Utils.Quality.Settings.QualitySettings; - -namespace KE.Utils.Quality.Handlers -{ - public class QualityToysHandler - { - private HashSet _pickupToys = new(); - private Dictionary _qualityToys = new(); - public readonly Vector3 Gulag = new Vector3(15000, 15000, 15000); - public const float Delay = Timing.WaitForOneFrame; - public bool IsPickupToy(AdminToy primitive) - { - return _pickupToys.Contains(primitive); - } - - public bool IsQualityToy(AdminToy primitive) - { - return _qualityToys.ContainsKey(primitive); - } - - - public void SetAsPickup(AdminToy toy, bool autoSync = true) - { - if (!_pickupToys.Add(toy)) - { - Log.Warn($"AdminToy {toy} is already a pickupToy"); - return; - } - if (autoSync) - Sync(toy); - } - - public void SetQuality(AdminToy toy, ModelQuality quality, bool autoSync = true) - { - if (toy == null) return; - if (!_qualityToys.ContainsKey(toy)) - _qualityToys.Add(toy, quality); - else - _qualityToys[toy] = quality; - - if (autoSync) - Sync(toy); - } - - - - private void SendToFakePosition(AdminToy adminToy, Player player,Vector3 position) - { - //idk why but without delay it show all of the quality at once - Timing.CallDelayed(Delay, () => - { - if (adminToy is Light l) - { - player.SendFakeSyncVar(l.Base.netIdentity, typeof(LightSourceToy), nameof(LightSourceToy.NetworkPosition), position); - return; - } - if (adminToy is Primitive p) - { - player.SendFakeSyncVar(p.Base.netIdentity, typeof(PrimitiveObjectToy), nameof(PrimitiveObjectToy.NetworkPosition), position); - return; - } - }); - - } - - /// - /// Sync every Players - /// - public void Sync() - { - foreach (Player p in Player.List) - { - Sync(p); - } - } - - /// - /// Sync a specified Player - /// - /// - public void Sync(Player p) - { - - - - var quality = QualitySettings.Get(p); - var pickup = QualitySettings.PickmodelActivated(p); - - HashSet pickupToRemove = []; - HashSet qualityToRemove = []; - - //hide pickup toys - - foreach (AdminToy pk in _pickupToys) - { - try - { - if (pickup) - { - SendToFakePosition(pk, p, pk.Position); - } - else - { - SendToFakePosition(pk, p, Gulag); - } - } - catch (NullReferenceException) - { - //Log.Warn("removing pickup"); - pickupToRemove.Add(pk); - } - - } - - _pickupToys.RemoveWhere(p => pickupToRemove.Contains(p)); - - - foreach (var at in _qualityToys) - { - try - { - if ((at.Value == quality || at.Value == ModelQuality.None) && (pickup || !_pickupToys.Contains(at.Key))) - { - SendToFakePosition(at.Key, p, at.Key.Position); - } - else - { - SendToFakePosition(at.Key, p, Gulag); - } - } - catch (NullReferenceException) - { - //Log.Warn("removing quality" + _qualityToys.Count); - qualityToRemove.Add(at.Key); - } - - - } - foreach(var at in qualityToRemove) - { - - _qualityToys.Remove(at); - } - - } - - /// - /// Sync a specified AdminToy - /// - /// - public void Sync(AdminToy adminToy) - { - //temporary fix - Sync(); - - if (IsPickupToy(adminToy)) - { - - } - if (IsQualityToy(adminToy)) - { - - } - } - } -} diff --git a/KruacentExiled/KE.Utils/Quality/Models/Base/BaseModel.cs b/KruacentExiled/KE.Utils/Quality/Models/Base/BaseModel.cs deleted file mode 100644 index c9f6723c..00000000 --- a/KruacentExiled/KE.Utils/Quality/Models/Base/BaseModel.cs +++ /dev/null @@ -1,41 +0,0 @@ -using Exiled.API.Enums; -using Exiled.API.Extensions; -using Exiled.API.Features.Toys; -using Exiled.API.Interfaces; -using KE.Utils.Quality.Structs; -using PlayerStatsSystem; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using UnityEngine; -using Light = Exiled.API.Features.Toys.Light; - -namespace KE.Utils.Quality.Models.Base -{ - - /// - /// The blocks to build a model with - /// - public abstract class BaseModel : ICloneable - { - - protected AdminToy _toy; - public AdminToy AdminToy { get { return _toy; } } - private Vector3 _position; - public Vector3 LocalPosition { get { return _position; } } - private Quaternion _rotation; - public Quaternion LocalRotation { get { return _rotation; } } - - - public BaseModel(Vector3 localPositon, Quaternion localRotation) - { - _position = localPositon; - _rotation = localRotation; - } - - public abstract object Clone(); - } - -} diff --git a/KruacentExiled/KE.Utils/Quality/Models/Base/LightModel.cs b/KruacentExiled/KE.Utils/Quality/Models/Base/LightModel.cs deleted file mode 100644 index ce808da1..00000000 --- a/KruacentExiled/KE.Utils/Quality/Models/Base/LightModel.cs +++ /dev/null @@ -1,26 +0,0 @@ -using Exiled.API.Features.Toys; -using UnityEngine; -using Light = Exiled.API.Features.Toys.Light; - -namespace KE.Utils.Quality.Models.Base -{ - public class LightModel : BaseModel - { - - /// - /// Create a new Light for modeling - /// - public LightModel(Vector3? scale, Color? color, Vector3 localPositon, Quaternion localRotation) : base(localPositon, localRotation) - { - Light light = Light.Create(null, null, scale, false, color); - _toy = light; - } - - - public override object Clone() - { - Light light = _toy as Light; - return new LightModel(light.Scale, light.Color, LocalPosition, LocalRotation); - } - } -} diff --git a/KruacentExiled/KE.Utils/Quality/Models/Base/PrimitiveModel.cs b/KruacentExiled/KE.Utils/Quality/Models/Base/PrimitiveModel.cs deleted file mode 100644 index 22e07225..00000000 --- a/KruacentExiled/KE.Utils/Quality/Models/Base/PrimitiveModel.cs +++ /dev/null @@ -1,26 +0,0 @@ -using Exiled.API.Features.Toys; -using UnityEngine; -using Color = UnityEngine.Color; - -namespace KE.Utils.Quality.Models.Base -{ - public class PrimitiveModel : BaseModel - { - /// - /// Create a new Primitive for modeling - /// - public PrimitiveModel(PrimitiveType type, Vector3? scale, Color? color,Vector3 localPosition,Quaternion localRotation) : base(localPosition, localRotation) - { - - Primitive prim = Primitive.Create(type, null, null, scale, false, color); - prim.Collidable = false; - _toy = prim; - } - - public override object Clone() - { - Primitive prim = _toy as Primitive; - return new PrimitiveModel(prim.Type, prim.Scale, prim.Color, LocalPosition, LocalRotation); - } - } -} diff --git a/KruacentExiled/KE.Utils/Quality/Models/Examples/MineModel.cs b/KruacentExiled/KE.Utils/Quality/Models/Examples/MineModel.cs deleted file mode 100644 index 00d60fec..00000000 --- a/KruacentExiled/KE.Utils/Quality/Models/Examples/MineModel.cs +++ /dev/null @@ -1,118 +0,0 @@ -using KE.Utils.Quality.Enums; -using KE.Utils.Quality.Models.Base; -using System.Collections.Generic; -using UnityEngine; -using Light = Exiled.API.Features.Toys.Light; - -namespace KE.Utils.Quality.Models.Examples -{ - public abstract class MineModel : QualityModel - { - protected Light _light; - private bool _lightOn = false; - - - - - public void ToggleLight() - { - if (_light == null) throw new System.Exception("no light"); - if (_lightOn) - _light.UnSpawn(); - else - _light.Spawn(); - _lightOn = !_lightOn; - } - - } - - public class MineModelLow : MineModel - { - public override bool IsPickup => false; - public override ModelQuality Quality => ModelQuality.Low; - - protected override IEnumerable GetBaseModels() - { - Quaternion baseRotation = new(); - //spawn + offset - Vector3 offset = new Vector3(0, .05f); - Vector3 sizeDisk = new Vector3(.7f, 0.1f, .7f); - - Vector3 sizeGlobe = new Vector3(.1f, .1f, .1f); - Vector3 posLight = new Vector3(0, sizeDisk.y+sizeGlobe.y); - - - var baseMine = new PrimitiveModel(PrimitiveType.Cylinder, sizeDisk, Color.black, offset, baseRotation); - - var lightGlobe = new PrimitiveModel(PrimitiveType.Sphere, sizeGlobe , new Color(1, 0, 0, .33f), posLight, baseRotation); - - var lightMine = new LightModel(null, Color.red, posLight, baseRotation); - - _light = lightMine.AdminToy as Light; - _light.Intensity = .55f; - - return [baseMine, lightGlobe, lightMine]; - } - - - } - - public class MineModelMedium : MineModel - { - public override bool IsPickup => false; - public override ModelQuality Quality => ModelQuality.Medium; - - protected override IEnumerable GetBaseModels() - { - Quaternion baseRotation = new(); - //spawn + offset - Vector3 offset = new Vector3(0, .05f); - Vector3 sizeDisk = new Vector3(.7f, 0.1f, .7f); - - Vector3 sizeGlobe = new Vector3(.1f, .1f, .1f); - Vector3 posLight = new Vector3(0, sizeDisk.y + sizeGlobe.y); - - - var baseMine = new PrimitiveModel(PrimitiveType.Cylinder, sizeDisk, Color.black, offset, baseRotation); - - var lightGlobe = new PrimitiveModel(PrimitiveType.Sphere, sizeGlobe, new Color(1, 0, 0, .33f), posLight, baseRotation); - - var lightMine = new LightModel(null, Color.green, posLight, baseRotation); - - _light = lightMine.AdminToy as Light; - _light.Intensity = .55f; - - return [baseMine, lightGlobe, lightMine]; - } - } - - public class MineModelPickup : MineModel - { - public override bool IsPickup => true; - public override ModelQuality Quality => ModelQuality.None; - - - protected override IEnumerable GetBaseModels() - { - Quaternion baseRotation = new(); - //spawn + offset - Vector3 offset = new Vector3(0, .05f); - Vector3 sizeDisk = new Vector3(.7f, 0.1f, .7f); - - Vector3 sizeGlobe = new Vector3(.1f, .1f, .1f); - Vector3 posLight = new Vector3(0, sizeDisk.y + sizeGlobe.y); - - - var baseMine = new PrimitiveModel(PrimitiveType.Cylinder, sizeDisk, Color.black, offset, baseRotation); - - var lightGlobe = new PrimitiveModel(PrimitiveType.Sphere, sizeGlobe, new Color(1, 0, 0, .33f), posLight, baseRotation); - - var lightMine = new LightModel(null, Color.magenta, posLight, baseRotation); - - _light = lightMine.AdminToy as Light; - _light.Intensity = .55f; - - return [baseMine, lightGlobe, lightMine]; - } - } -} diff --git a/KruacentExiled/KE.Utils/Quality/Models/Model.cs b/KruacentExiled/KE.Utils/Quality/Models/Model.cs deleted file mode 100644 index 2e26756e..00000000 --- a/KruacentExiled/KE.Utils/Quality/Models/Model.cs +++ /dev/null @@ -1,104 +0,0 @@ -using Exiled.API.Features; -using Exiled.API.Features.Toys; -using KE.Utils.Quality.Models.Base; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using UnityEngine; - -namespace KE.Utils.Quality.Models -{ - public class Model : IEquatable - { - - - private Vector3 _position; - public Vector3 Position - { - get { return _position; } - set - { - _position = value; - } - } - private Quaternion _rotation; - public Quaternion Rotation - { - get { return _rotation; } - set - { - _rotation = value; - } - } - private ModelPrefab _prefab; - public ModelPrefab Prefab - { - get { return _prefab; } - } - - - - private HashSet _models; - - internal Model(ModelPrefab prefab, Vector3 position, Quaternion rotation,IEnumerable toys,bool spawn) - { - _prefab = prefab; - Position = position; - Rotation = rotation; - _models = new HashSet(toys); - QualityHandler.Instance.QualityToysHandler.Sync(); - - foreach (BaseModel based in toys) - { - AdminToy toy = based.AdminToy; - - if (toy is Primitive p) - p.Collidable = false; - toy.AdminToyBase.transform.position = based.LocalPosition + Position; - toy.AdminToyBase.transform.rotation = based.LocalRotation * Rotation; - } - if(spawn) - { - Spawn(); - } - } - - - public void Destroy() - { - foreach (BaseModel primitive in _models) - { - primitive.AdminToy.Destroy(); - } - } - public void UnSpawn() - { - foreach (BaseModel primitive in _models) - { - primitive.AdminToy.UnSpawn(); - } - } - public void Spawn() - { - QualityHandler.Instance.QualityToysHandler.Sync(); - foreach (BaseModel primitive in _models) - { - primitive.AdminToy.Spawn(); - } - - } - - - public bool Equals(Model x) - { - if (x == null) return false; - return x._prefab == _prefab && x.Position == Position && x.Rotation == Rotation; - } - public int GetHashCode(Model obj) - { - return obj.GetHashCode(); - } - } -} diff --git a/KruacentExiled/KE.Utils/Quality/Models/ModelPrefab.cs b/KruacentExiled/KE.Utils/Quality/Models/ModelPrefab.cs deleted file mode 100644 index bbc39da4..00000000 --- a/KruacentExiled/KE.Utils/Quality/Models/ModelPrefab.cs +++ /dev/null @@ -1,42 +0,0 @@ -using Exiled.API.Features; -using Exiled.API.Features.Core; -using Exiled.API.Features.Pickups; -using Exiled.API.Features.Toys; -using Exiled.API.Interfaces; -using KE.Utils.Extensions; -using KE.Utils.Quality.Models.Base; -using KE.Utils.Quality.Structs; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using UnityEngine; -using Light = Exiled.API.Features.Toys.Light; - -namespace KE.Utils.Quality.Models -{ - public abstract class ModelPrefab - { - - protected abstract IEnumerable GetBaseModels(); - - public virtual Model Create(Vector3 position,Quaternion rotation, bool spawn = true) - { - - HashSet clonetoys = new(); - HashSet toys = GetBaseModels().ToHashSet(); - foreach (BaseModel model in toys) - { - BaseModel clone = (BaseModel)model.Clone(); - clonetoys.Add(clone); - } - return new Model(this, position, rotation, clonetoys,spawn); - - } - - - - - } -} diff --git a/KruacentExiled/KE.Utils/Quality/Models/QualityModel.cs b/KruacentExiled/KE.Utils/Quality/Models/QualityModel.cs deleted file mode 100644 index b5cc682f..00000000 --- a/KruacentExiled/KE.Utils/Quality/Models/QualityModel.cs +++ /dev/null @@ -1,40 +0,0 @@ -using Exiled.API.Features; -using Exiled.API.Features.Toys; -using KE.Utils.Extensions; -using KE.Utils.Quality.Enums; -using KE.Utils.Quality.Models.Base; -using System.Collections.Generic; -using System.Linq; -using UnityEngine; - -namespace KE.Utils.Quality.Models -{ - public abstract class QualityModel : ModelPrefab - { - public abstract ModelQuality Quality { get; } - public abstract bool IsPickup { get; } - - - - - public override sealed Model Create(Vector3 position, Quaternion rotation,bool spawn = true) - { - - HashSet clonetoys = new(); - HashSet toys = GetBaseModels().ToHashSet(); - foreach (BaseModel model in toys) - { - BaseModel clone = (BaseModel)model.Clone(); - - if (IsPickup) - clone.AdminToy.SetAsPickupAdminToy(false); - - clone.AdminToy.SetQuality(Quality,false); - clonetoys.Add(clone); - } - QualityHandler.Sync(); - return new Model(this,position, rotation, clonetoys, spawn); - } - - } -} diff --git a/KruacentExiled/KE.Utils/Quality/QualityHandler.cs b/KruacentExiled/KE.Utils/Quality/QualityHandler.cs deleted file mode 100644 index 235d79c9..00000000 --- a/KruacentExiled/KE.Utils/Quality/QualityHandler.cs +++ /dev/null @@ -1,61 +0,0 @@ -using Exiled.API.Features; -using Exiled.API.Features.Core.UserSettings; -using KE.Utils.Quality.Handlers; -using KE.Utils.Quality.Settings; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace KE.Utils.Quality -{ - [Obsolete("scrapped", false)] - internal class QualityHandler - { - public QualitySettings QualitySettings { get; private set; } - public QualityToysHandler QualityToysHandler { get; private set; } - - private static QualityHandler _instance; - public static QualityHandler Instance - { - get - { - if(_instance == null ) - _instance = new QualityHandler(); - return _instance; - } - } - private QualityHandler() - { - QualitySettings = new QualitySettings(Changed); - QualityToysHandler = new QualityToysHandler(); - } - - ~QualityHandler() - { - QualityToysHandler = null; - QualitySettings = null; - } - - public void Changed(Player p, SettingBase _) - { - QualityToysHandler.Sync(p); - } - - public void Register() - { - QualitySettings.Register(); - } - - public void Unregister() - { - QualitySettings.Unregister(); - } - - public static void Sync() - { - Instance.QualityToysHandler.Sync(); - } - } -} diff --git a/KruacentExiled/KE.Utils/Quality/QualityToysHandler.cs b/KruacentExiled/KE.Utils/Quality/QualityToysHandler.cs deleted file mode 100644 index 27320233..00000000 --- a/KruacentExiled/KE.Utils/Quality/QualityToysHandler.cs +++ /dev/null @@ -1,155 +0,0 @@ -using AdminToys; -using Exiled.API.Enums; -using Exiled.API.Extensions; -using Exiled.API.Features; -using Exiled.API.Features.Toys; -using KE.Utils.Quality.Enums; -using KE.Utils.Quality.Settings; -using System.Collections.Generic; -using System.Linq; -using UnityEngine; -using Light = Exiled.API.Features.Toys.Light; -using QualitySettings = KE.Utils.Quality.Settings.QualitySettings; - -namespace KE.Utils.Quality -{ - public class QualityToysHandler - { - private HashSet _pickupToys = new(); - private Dictionary _qualityToys = new(); - public readonly Vector3 Gulag = new Vector3(15000,15000,15000); - - public bool IsPickupToy(AdminToy primitive) - { - return _pickupToys.Contains(primitive); - } - - public bool IsQualityToy(AdminToy primitive) - { - return _qualityToys.ContainsKey(primitive); - } - - - public void SetAsPickup(AdminToy toy) - { - if (!_pickupToys.Add(toy)) - { - Log.Warn($"AdminToy {toy} is already a pickupToy"); - return; - } - } - - public void SetQuality(AdminToy toy,ModelQuality quality) - { - if (toy == null) return; - if (!_qualityToys.ContainsKey(toy)) - _qualityToys.Add(toy,quality); - else - _qualityToys[toy] = quality; - } - - - - private void SendToShadowRealm(AdminToy adminToy, Player player) - { - if(adminToy is Light l) - { - player.SendFakeSyncVar(l.Base.netIdentity, typeof(LightSourceToy), nameof(LightSourceToy.NetworkPosition), Gulag); - return; - } - if(adminToy is Primitive p) - { - player.SendFakeSyncVar(p.Base.netIdentity, typeof(PrimitiveObjectToy), nameof(PrimitiveObjectToy.NetworkPosition), Gulag); - return; - } - } - - private void SetTruePosition(AdminToy adminToy, Player player) - { - if (adminToy is Light l) - { - player.SendFakeSyncVar(l.Base.netIdentity, typeof(LightSourceToy), nameof(LightSourceToy.NetworkPosition), l.Position); - return; - } - if (adminToy is Primitive p) - { - player.SendFakeSyncVar(p.Base.netIdentity, typeof(PrimitiveObjectToy), nameof(PrimitiveObjectToy.NetworkPosition), p.Position); - return; - } - } - - /// - /// Sync every Players - /// - public void Sync() - { - foreach(Player p in Player.List) - { - Sync(p); - } - } - - /// - /// Sync a specified Player - /// - /// - public void Sync(Player p) - { - var quality = QualitySettings.Get(p); - var pickup = QualitySettings.PickmodelActivated(p); - - if (!pickup) - { - //hide pickup toys - foreach (AdminToy pk in _pickupToys) - { - SendToShadowRealm(pk, p); - } - } - else - { - //show pickup toys - foreach (AdminToy pk in _pickupToys) - { - SetTruePosition(pk, p); - } - } - - - - - foreach(var at in _qualityToys) - { - if(at.Value == quality) - { - if (pickup || !_pickupToys.Contains(at.Key)) - { - SetTruePosition(at.Key, p); - } - } - else - { - SendToShadowRealm(at.Key, p); - } - - } - - } - - /// - /// Sync a specified AdminToy - /// - /// - public void Sync(AdminToy adminToy) - { - if (IsPickupToy(adminToy)) - { - - } - if (IsQualityToy(adminToy)) - { - - } - } - } -} diff --git a/KruacentExiled/KE.Utils/Quality/Settings/QualitySettings.cs b/KruacentExiled/KE.Utils/Quality/Settings/QualitySettings.cs deleted file mode 100644 index ca8d49be..00000000 --- a/KruacentExiled/KE.Utils/Quality/Settings/QualitySettings.cs +++ /dev/null @@ -1,62 +0,0 @@ -using Exiled.API.Features; -using Exiled.API.Features.Core.UserSettings; -using KE.Utils.Quality.Enums; -using System; - -namespace KE.Utils.Quality.Settings -{ - public class QualitySettings - { - - private static int _idQuality = 0; - private static int _idModels = 1; - private static int _idSlider = 2; - private SettingBase[] _settings; - public QualitySettings(Action onChanged) - { - HeaderSetting header = new("Quality Settings"); - _settings = - [ - header, - new DropdownSetting(_idQuality,"ModelQuality",["Low","Medium", "High"],onChanged:onChanged), - new TwoButtonsSetting(_idModels,"Pickup models","Disabled","Enabled", onChanged:onChanged) - ]; - } - - public void Register() - { - SettingBase.Register(_settings); - SettingBase.SendToAll(); - } - - public void Unregister() - { - SettingBase.Unregister(settings:_settings); - } - - - - - public static ModelQuality Get(Player p) - { - if (!SettingBase.TryGetSetting(p, _idQuality, out var setting)) return ModelQuality.None; - - return setting.SelectedOption switch - { - "Low" => ModelQuality.Low, - "Medium" => ModelQuality.Medium, - "High" => ModelQuality.High, - _ => ModelQuality.None, - }; - } - - - public static bool PickmodelActivated(Player p) - { - if (!SettingBase.TryGetSetting(p, _idModels, out var setting)) return false; - return setting.IsSecond; - } - - - } -} diff --git a/KruacentExiled/KE.Utils/Quality/Structs/LocalWorldSpace.cs b/KruacentExiled/KE.Utils/Quality/Structs/LocalWorldSpace.cs deleted file mode 100644 index d9c6205b..00000000 --- a/KruacentExiled/KE.Utils/Quality/Structs/LocalWorldSpace.cs +++ /dev/null @@ -1,23 +0,0 @@ -using Exiled.API.Interfaces; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using UnityEngine; - -namespace KE.Utils.Quality.Structs -{ - public readonly struct LocalWorldSpace : IWorldSpace - { - - public Vector3 Position { get; } - public Quaternion Rotation { get; } - - public LocalWorldSpace(Vector3 position, Quaternion rotation) - { - Position = position; - Rotation = rotation; - } - } -} diff --git a/KruacentExiled/KE.Utils/Quality/Tests/Test.cs b/KruacentExiled/KE.Utils/Quality/Tests/Test.cs deleted file mode 100644 index 6ebd3f66..00000000 --- a/KruacentExiled/KE.Utils/Quality/Tests/Test.cs +++ /dev/null @@ -1,108 +0,0 @@ -using Exiled.API.Extensions; -using Exiled.API.Features; -using Exiled.API.Features.Toys; -using KE.Utils.Quality.Models; -using KE.Utils.Quality.Models.Examples; -using MEC; -using PlayerRoles; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using UnityEngine; - -namespace KE.Utils.Quality.Tests -{ - public class Test - { - private QualityHandler QualityHandler; - - - private Test(QualityHandler q) - { - QualityHandler = q; - try - { - TestMine(); - } - catch (Exception ex) - { - Log.Error("Exception for TestMine :\n"+ex); - } - - } - internal void TestQuality() - { - Vector3 pos = RoleTypeId.Scp049.GetRandomSpawnLocation().Position; - Primitive c = Primitive.Create(pos); - c.Color = Color.red; - Primitive c2 = Primitive.Create(pos + Vector3.one); - c2.Color = Color.green; - - - QualityHandler.QualityToysHandler.SetQuality(c, Enums.ModelQuality.Low); - QualityHandler.QualityToysHandler.SetQuality(c2, Enums.ModelQuality.Medium); - } - - internal void StressTest(int count) - { - Timing.RunCoroutine(Stress(count)); - } - - - private IEnumerator Stress(int count) - { - Vector3 pos = RoleTypeId.Scp049.GetRandomSpawnLocation().Position; - Vector3 scale = new Vector3(.1f, .1f, .1f); - float maxSpread = 5; - for (int i = 0; i < count; i++) - { - Primitive c = Primitive.Create(pos + new Vector3(UnityEngine.Random.Range(0f, maxSpread), UnityEngine.Random.Range(0f, maxSpread), UnityEngine.Random.Range(0f, maxSpread)), scale: scale); - QualityHandler.QualityToysHandler.SetQuality(c, Enums.ModelQuality.Medium); - } - QualityHandler.QualityToysHandler.Sync(); - yield return 0; - } - - public void TestMine() - { - Log.Info("TestMine"); - Vector3 pos = RoleTypeId.Scp049.GetRandomSpawnLocation().Position; - MineModelLow mml = new(); - - - Model m = mml.Create(pos, new Quaternion()); - m.Spawn(); - - - MineModelMedium mmm = new(); - - m = mmm.Create(pos + Vector3.up, new Quaternion()); - m.Spawn(); - - - MineModelPickup mmp = new(); - m = mmp.Create(pos + Vector3.right, new Quaternion()); - m.Spawn(); - - QualityHandler.Sync(); - - - - - - - - - foreach (var item in Player.List) - { - item.Teleport(pos); - } - - - - - } - } -} From ff103c867f4475aa0fde22ada8a9652a4dadcdf6 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Thu, 9 Apr 2026 16:16:50 +0200 Subject: [PATCH 832/853] remove Utils proj ajgain --- .../Displays/DisplayMeow/DisplayHandler.cs | 67 ------ .../API/Displays/DisplayMeow/HintPlacement.cs | 31 --- .../KE.Utils/API/GifAnimator/RenderGif.cs | 128 ----------- .../KE.Utils/API/GifAnimator/TextImage.cs | 104 --------- .../KE.Utils/API/Interfaces/IEvents.cs | 17 -- .../KE.Utils/API/Interfaces/ILoadable.cs | 13 -- .../KE.Utils/API/Models/Arrows/Arrow.cs | 58 ----- .../KE.Utils/API/Models/Arrows/MoveArrow.cs | 12 - .../KE.Utils/API/Models/Arrows/RotateArrow.cs | 12 - .../KE.Utils/API/Models/Arrows/ScaleArrow.cs | 12 - .../KE.Utils/API/Models/Arrows/XArrow.cs | 16 -- .../KE.Utils/API/Models/Arrows/YArrow.cs | 16 -- .../KE.Utils/API/Models/Arrows/ZArrow.cs | 16 -- .../Models/Blueprints/AdminToyBlueprint.cs | 75 ------- .../API/Models/Blueprints/LightBlueprint.cs | 48 ---- .../API/Models/Blueprints/ModelBlueprint.cs | 110 --------- .../Models/Blueprints/PrimitiveBlueprint.cs | 47 ---- .../API/Models/Commands/AllCommands.cs | 33 --- .../API/Models/Commands/ChangeColor.cs | 72 ------ .../API/Models/Commands/ChangePrimType.cs | 53 ----- .../API/Models/Commands/CreateModel.cs | 44 ---- .../API/Models/Commands/CreatePrim.cs | 47 ---- .../KE.Utils/API/Models/Commands/ListModel.cs | 42 ---- .../KE.Utils/API/Models/Commands/LoadModel.cs | 65 ------ .../API/Models/Commands/ModeMovePrim.cs | 64 ------ .../KE.Utils/API/Models/Commands/SaveModel.cs | 47 ---- .../API/Models/Commands/SelectModel.cs | 56 ----- .../API/Models/Commands/ShowCenter.cs | 51 ----- KruacentExiled/KE.Utils/API/Models/Model.cs | 202 ----------------- .../KE.Utils/API/Models/ModelCreator.cs | 175 --------------- .../KE.Utils/API/Models/ModelLoader.cs | 152 ------------- KruacentExiled/KE.Utils/API/Models/Models.cs | 47 ---- .../KE.Utils/API/Models/MovementHandler.cs | 208 ------------------ .../KE.Utils/API/Models/SelectedModel.cs | 52 ----- .../Models/ToysSettings/PrimitiveSetting.cs | 31 --- .../API/Models/ToysSettings/ToySetting.cs | 20 -- KruacentExiled/KE.Utils/API/OtherUtils.cs | 18 -- KruacentExiled/KE.Utils/API/Parser.cs | 36 --- .../KE.Utils/API/ReflectionHelper.cs | 47 ---- .../KE.Utils/API/Sounds/SoundPlayer.cs | 116 ---------- .../KE.Utils/Extensions/AdminToyExtension.cs | 25 --- .../KE.Utils/Extensions/NpcExtension.cs | 23 -- .../KE.Utils/Extensions/PlayerExtension.cs | 62 ------ .../KE.Utils/Extensions/RoomExtension.cs | 12 - .../KE.Utils/Extensions/RoomExtensions.cs | 55 ----- KruacentExiled/KE.Utils/KE.Utils.csproj | 32 --- .../KE.Utils/Quality/Enums/ModelQuality.cs | 16 -- .../Quality/Handlers/QualityToysHandler.cs | 179 --------------- .../KE.Utils/Quality/Models/Base/BaseModel.cs | 41 ---- .../Quality/Models/Base/LightModel.cs | 26 --- .../Quality/Models/Base/PrimitiveModel.cs | 26 --- .../Quality/Models/Examples/MineModel.cs | 118 ---------- .../KE.Utils/Quality/Models/Model.cs | 104 --------- .../KE.Utils/Quality/Models/ModelPrefab.cs | 42 ---- .../KE.Utils/Quality/Models/QualityModel.cs | 40 ---- .../KE.Utils/Quality/QualityHandler.cs | 61 ----- .../KE.Utils/Quality/QualityToysHandler.cs | 155 ------------- .../Quality/Settings/QualitySettings.cs | 62 ------ .../Quality/Structs/LocalWorldSpace.cs | 23 -- KruacentExiled/KE.Utils/Quality/Tests/Test.cs | 108 --------- 60 files changed, 3670 deletions(-) delete mode 100644 KruacentExiled/KE.Utils/API/Displays/DisplayMeow/DisplayHandler.cs delete mode 100644 KruacentExiled/KE.Utils/API/Displays/DisplayMeow/HintPlacement.cs delete mode 100644 KruacentExiled/KE.Utils/API/GifAnimator/RenderGif.cs delete mode 100644 KruacentExiled/KE.Utils/API/GifAnimator/TextImage.cs delete mode 100644 KruacentExiled/KE.Utils/API/Interfaces/IEvents.cs delete mode 100644 KruacentExiled/KE.Utils/API/Interfaces/ILoadable.cs delete mode 100644 KruacentExiled/KE.Utils/API/Models/Arrows/Arrow.cs delete mode 100644 KruacentExiled/KE.Utils/API/Models/Arrows/MoveArrow.cs delete mode 100644 KruacentExiled/KE.Utils/API/Models/Arrows/RotateArrow.cs delete mode 100644 KruacentExiled/KE.Utils/API/Models/Arrows/ScaleArrow.cs delete mode 100644 KruacentExiled/KE.Utils/API/Models/Arrows/XArrow.cs delete mode 100644 KruacentExiled/KE.Utils/API/Models/Arrows/YArrow.cs delete mode 100644 KruacentExiled/KE.Utils/API/Models/Arrows/ZArrow.cs delete mode 100644 KruacentExiled/KE.Utils/API/Models/Blueprints/AdminToyBlueprint.cs delete mode 100644 KruacentExiled/KE.Utils/API/Models/Blueprints/LightBlueprint.cs delete mode 100644 KruacentExiled/KE.Utils/API/Models/Blueprints/ModelBlueprint.cs delete mode 100644 KruacentExiled/KE.Utils/API/Models/Blueprints/PrimitiveBlueprint.cs delete mode 100644 KruacentExiled/KE.Utils/API/Models/Commands/AllCommands.cs delete mode 100644 KruacentExiled/KE.Utils/API/Models/Commands/ChangeColor.cs delete mode 100644 KruacentExiled/KE.Utils/API/Models/Commands/ChangePrimType.cs delete mode 100644 KruacentExiled/KE.Utils/API/Models/Commands/CreateModel.cs delete mode 100644 KruacentExiled/KE.Utils/API/Models/Commands/CreatePrim.cs delete mode 100644 KruacentExiled/KE.Utils/API/Models/Commands/ListModel.cs delete mode 100644 KruacentExiled/KE.Utils/API/Models/Commands/LoadModel.cs delete mode 100644 KruacentExiled/KE.Utils/API/Models/Commands/ModeMovePrim.cs delete mode 100644 KruacentExiled/KE.Utils/API/Models/Commands/SaveModel.cs delete mode 100644 KruacentExiled/KE.Utils/API/Models/Commands/SelectModel.cs delete mode 100644 KruacentExiled/KE.Utils/API/Models/Commands/ShowCenter.cs delete mode 100644 KruacentExiled/KE.Utils/API/Models/Model.cs delete mode 100644 KruacentExiled/KE.Utils/API/Models/ModelCreator.cs delete mode 100644 KruacentExiled/KE.Utils/API/Models/ModelLoader.cs delete mode 100644 KruacentExiled/KE.Utils/API/Models/Models.cs delete mode 100644 KruacentExiled/KE.Utils/API/Models/MovementHandler.cs delete mode 100644 KruacentExiled/KE.Utils/API/Models/SelectedModel.cs delete mode 100644 KruacentExiled/KE.Utils/API/Models/ToysSettings/PrimitiveSetting.cs delete mode 100644 KruacentExiled/KE.Utils/API/Models/ToysSettings/ToySetting.cs delete mode 100644 KruacentExiled/KE.Utils/API/OtherUtils.cs delete mode 100644 KruacentExiled/KE.Utils/API/Parser.cs delete mode 100644 KruacentExiled/KE.Utils/API/ReflectionHelper.cs delete mode 100644 KruacentExiled/KE.Utils/API/Sounds/SoundPlayer.cs delete mode 100644 KruacentExiled/KE.Utils/Extensions/AdminToyExtension.cs delete mode 100644 KruacentExiled/KE.Utils/Extensions/NpcExtension.cs delete mode 100644 KruacentExiled/KE.Utils/Extensions/PlayerExtension.cs delete mode 100644 KruacentExiled/KE.Utils/Extensions/RoomExtension.cs delete mode 100644 KruacentExiled/KE.Utils/Extensions/RoomExtensions.cs delete mode 100644 KruacentExiled/KE.Utils/KE.Utils.csproj delete mode 100644 KruacentExiled/KE.Utils/Quality/Enums/ModelQuality.cs delete mode 100644 KruacentExiled/KE.Utils/Quality/Handlers/QualityToysHandler.cs delete mode 100644 KruacentExiled/KE.Utils/Quality/Models/Base/BaseModel.cs delete mode 100644 KruacentExiled/KE.Utils/Quality/Models/Base/LightModel.cs delete mode 100644 KruacentExiled/KE.Utils/Quality/Models/Base/PrimitiveModel.cs delete mode 100644 KruacentExiled/KE.Utils/Quality/Models/Examples/MineModel.cs delete mode 100644 KruacentExiled/KE.Utils/Quality/Models/Model.cs delete mode 100644 KruacentExiled/KE.Utils/Quality/Models/ModelPrefab.cs delete mode 100644 KruacentExiled/KE.Utils/Quality/Models/QualityModel.cs delete mode 100644 KruacentExiled/KE.Utils/Quality/QualityHandler.cs delete mode 100644 KruacentExiled/KE.Utils/Quality/QualityToysHandler.cs delete mode 100644 KruacentExiled/KE.Utils/Quality/Settings/QualitySettings.cs delete mode 100644 KruacentExiled/KE.Utils/Quality/Structs/LocalWorldSpace.cs delete mode 100644 KruacentExiled/KE.Utils/Quality/Tests/Test.cs diff --git a/KruacentExiled/KE.Utils/API/Displays/DisplayMeow/DisplayHandler.cs b/KruacentExiled/KE.Utils/API/Displays/DisplayMeow/DisplayHandler.cs deleted file mode 100644 index 4ee13535..00000000 --- a/KruacentExiled/KE.Utils/API/Displays/DisplayMeow/DisplayHandler.cs +++ /dev/null @@ -1,67 +0,0 @@ -using Exiled.API.Features; -using HintServiceMeow.Core.Extension; -using HintServiceMeow.Core.Models.Hints; -using HintServiceMeow.Core.Utilities; -using MEC; - - -//damn why the same name -using MHint = HintServiceMeow.Core.Models.Hints.Hint; - -namespace KE.Utils.API.Displays.DisplayMeow -{ - public class DisplayHandler - { - public static DisplayHandler Instance { get; } = new(); - - private DisplayHandler() { } - - - - - - - public MHint AddHint(HintPlacement hintPlacement, Player player, string text, float delay) - { - var dis = PlayerDisplay.Get(player); - string id = $"{player.Id}_{hintPlacement.XCoordinate}_{hintPlacement.YCoordinate}"; - MHint hint; - - if (!dis.TryGetHint(id, out var aHint)) - { - hint = new() - { - Text = text, - XCoordinate = hintPlacement.XCoordinate, - YCoordinate = hintPlacement.YCoordinate, - Alignment = hintPlacement.HintAlignment, - Id = id - - }; - dis.AddHint(hint); - - } - else - { - - hint = (MHint)aHint; - hint.Hide = false; - hint.Text = text; - } - - - hint.HideAfter(delay); - return hint; - } - - - - - - - - - - - } -} diff --git a/KruacentExiled/KE.Utils/API/Displays/DisplayMeow/HintPlacement.cs b/KruacentExiled/KE.Utils/API/Displays/DisplayMeow/HintPlacement.cs deleted file mode 100644 index 936cdbe9..00000000 --- a/KruacentExiled/KE.Utils/API/Displays/DisplayMeow/HintPlacement.cs +++ /dev/null @@ -1,31 +0,0 @@ -using HintServiceMeow.Core.Enum; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace KE.Utils.API.Displays.DisplayMeow -{ - public readonly struct HintPlacement : IEquatable - { - public float YCoordinate { get; } - public float XCoordinate { get; } - public HintAlignment HintAlignment { get; } = HintAlignment.Center; - - - public bool Equals(HintPlacement obj) - { - return YCoordinate == obj.YCoordinate && XCoordinate == obj.XCoordinate; - } - - - public HintPlacement(float xCoordinate, float yCoordinate, HintAlignment alignment = HintAlignment.Center) - { - YCoordinate = yCoordinate; - XCoordinate = xCoordinate; - HintAlignment = alignment; - } - - } -} diff --git a/KruacentExiled/KE.Utils/API/GifAnimator/RenderGif.cs b/KruacentExiled/KE.Utils/API/GifAnimator/RenderGif.cs deleted file mode 100644 index f59ddbac..00000000 --- a/KruacentExiled/KE.Utils/API/GifAnimator/RenderGif.cs +++ /dev/null @@ -1,128 +0,0 @@ -using System.Collections.Generic; -using System.Drawing; -using System.Drawing.Imaging; -using System.IO; -using Exiled.API.Features; -using Exiled.API.Features.Toys; -using MEC; -using UnityEngine; -using UnityEngine.Rendering; -using Color = UnityEngine.Color; -namespace KE.Utils.API.GifAnimator -{ - public static class RenderGif - { - - public static void Spawn(string path) - { - - } - - - - private static IEnumerator RenderImageCoroutine(object target, string filePath, float maxWidth, float maxHeight, float distance, float duration, int targetWidth, int targetHeight) - { - if (!File.Exists(filePath)) - { - Log.Debug($"No image was found under: {filePath}"); - yield break; - } - - byte[] imageData = File.ReadAllBytes(filePath); - - - - - - - Texture2D original = new Texture2D(2, 2); - - - try - { - original.LoadRawTextureData(imageData); - } - catch(UnityException) - { - Log.Debug("Image couldnt be loaded."); - yield break; - } - - Texture2D scaled = new Texture2D(targetWidth, targetHeight, TextureFormat.RGBA32, false); - - for (int x = 0; x < targetWidth; x++) - { - for (int y = 0; y < targetHeight; y++) - { - float u = x / (float)targetWidth; - float v = y / (float)targetHeight; - Color color = original.GetPixelBilinear(u, v); - scaled.SetPixel(x, y, color); - } - } - scaled.Apply(); - - float pixelScaleX = maxWidth / targetWidth; - float pixelScaleY = maxHeight / targetHeight; - float scale = Mathf.Min(pixelScaleX, pixelScaleY); - - Vector3 forwardOrigin; - Quaternion rotation = Quaternion.identity; - - if (target is Exiled.API.Features.Player player) - { - forwardOrigin = player.CameraTransform.position + player.CameraTransform.forward * distance; - - Vector3 directionToPlayer = forwardOrigin - player.CameraTransform.position; - directionToPlayer.y = 0; - rotation = Quaternion.LookRotation(directionToPlayer); - } - else if (target is Vector3 position) - { - forwardOrigin = position + Vector3.forward * distance; - Vector3 directionToPosition = forwardOrigin - position; - directionToPosition.y = 0; - rotation = Quaternion.LookRotation(directionToPosition); - } - else if (target is Room room) - { - forwardOrigin = room.Position + Vector3.up * 2f; - Vector3 directionToRoom = forwardOrigin - room.Position; - directionToRoom.y = 0; - rotation = Quaternion.LookRotation(directionToRoom); - } - else - { - Log.Debug("Invalid object type. Valid types: Player, Vector3, Room"); - yield break; - } - - Vector3 offset = new Vector3((targetWidth * scale) / 2f, (targetHeight * scale) / 2f, 0); - - for (int x = 0; x < targetWidth; x++) - { - for (int y = 0; y < targetHeight; y++) - { - Color pixelColor = scaled.GetPixel(x, y); - if (pixelColor.a < 0.1f) - continue; - - Vector3 localOffset = new Vector3(x * scale, y * scale, 0) - offset; - Vector3 worldPos = forwardOrigin + rotation * localOffset; - - Primitive quad = Primitive.Create(PrimitiveType.Quad); - quad.Position = worldPos; - quad.Scale = new Vector3(scale, scale, scale * 0.01f); - quad.Color = pixelColor; - - Quaternion fixedRotation = Quaternion.Euler(0f, rotation.eulerAngles.y, 0f); - quad.Rotation = fixedRotation; - quad.Flags = AdminToys.PrimitiveFlags.Visible; - } - - yield return Timing.WaitForOneFrame; - } - } - - } -} diff --git a/KruacentExiled/KE.Utils/API/GifAnimator/TextImage.cs b/KruacentExiled/KE.Utils/API/GifAnimator/TextImage.cs deleted file mode 100644 index 4e58bfec..00000000 --- a/KruacentExiled/KE.Utils/API/GifAnimator/TextImage.cs +++ /dev/null @@ -1,104 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Drawing.Imaging; -using System.Drawing; -using System.IO; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using Exiled.API.Features.Pools; -using LabApi.Features.Wrappers; -using UnityEngine; -using Color = System.Drawing.Color; -using Exiled.API.Features.Toys; - -namespace KE.Utils.API.GifAnimator -{ - public class TextImage - { - - - private string rawString = string.Empty; - - - - public TextImage(Image img) - { - FrameDimension dimension = new FrameDimension(img.FrameDimensionsList[0]); - img.SelectActiveFrame(dimension, 0); - var b = new Bitmap(img); - - StringBuilder sb = StringBuilderPool.Pool.Get(); - for (int y = 0; y < b.Height; y++) - { - for (int x = 0; x < b.Width; x++) - { - Color pixelColor = b.GetPixel(x, y); - - sb.Append(PixelToString(pixelColor)); - } - sb.AppendLine(); - } - rawString = sb.ToString(); - - StringBuilderPool.Pool.Return(sb); - - } - - public void Spawn(Vector3 position, Quaternion? rotation = null,Vector3? scale = null, Transform parent = null) - { - - TextToy textToy = TextToy.Create(position, rotation ?? Quaternion.Euler(Vector3.zero), scale ?? Vector3.one , parent,false); - - textToy.TextFormat = rawString; - - textToy.Spawn(); - - } - - - - private void Animated(Image img) - { - FrameDimension dimension = new FrameDimension(img.FrameDimensionsList[0]); - int frameCount = img.GetFrameCount(dimension); - StringBuilder sb = StringBuilderPool.Pool.Get(); - for (int i = 0; i < frameCount; i++) - { - img.SelectActiveFrame(dimension, i); - var b = new Bitmap(img); - - for (int x = 0; x < b.Width; x++) - { - for (int y = 0; y < b.Height; y++) - { - Color pixelColor = b.GetPixel(x, y); - - sb.Append(PixelToString(pixelColor)); - } - } - - } - - rawString = sb.ToString(); - - StringBuilderPool.Pool.Return(sb); - } - - - private static string PixelToString(Color color) - { - return "█"; - } - - - private static string ToHexValue(Color color) - { - return "#" + color.R.ToString("X2") + - color.G.ToString("X2") + - color.B.ToString("X2") + - color.A.ToString("X2"); - } - - } -} diff --git a/KruacentExiled/KE.Utils/API/Interfaces/IEvents.cs b/KruacentExiled/KE.Utils/API/Interfaces/IEvents.cs deleted file mode 100644 index e573b062..00000000 --- a/KruacentExiled/KE.Utils/API/Interfaces/IEvents.cs +++ /dev/null @@ -1,17 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace KE.Utils.API.Interfaces -{ - public interface IUsingEvents - { - - - public void SubscribeEvents(); - - public void UnsubscribeEvents(); - } -} diff --git a/KruacentExiled/KE.Utils/API/Interfaces/ILoadable.cs b/KruacentExiled/KE.Utils/API/Interfaces/ILoadable.cs deleted file mode 100644 index c9e00399..00000000 --- a/KruacentExiled/KE.Utils/API/Interfaces/ILoadable.cs +++ /dev/null @@ -1,13 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace KE.Utils.API.Interfaces -{ - public interface ILoadable - { - public string Loadable(char separator); - } -} diff --git a/KruacentExiled/KE.Utils/API/Models/Arrows/Arrow.cs b/KruacentExiled/KE.Utils/API/Models/Arrows/Arrow.cs deleted file mode 100644 index 990999c7..00000000 --- a/KruacentExiled/KE.Utils/API/Models/Arrows/Arrow.cs +++ /dev/null @@ -1,58 +0,0 @@ -using Exiled.API.Features.Toys; -using InventorySystem.Items.Keycards; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Net.Sockets; -using System.Text; -using System.Threading.Tasks; -using UnityEngine; - -namespace KE.Utils.API.Models.Arrows -{ - internal abstract class Arrow - { - internal static HashSet List = new(); - internal abstract Vector3 Offset { get; } - internal abstract Vector3 Rotation { get; } - internal abstract Color Color { get; } - - protected readonly Vector3 scale = new Vector3(1f, .1f, .1f); - - private Primitive _primitive; - - internal Primitive Primitive - { - get { return _primitive; } - } - internal Arrow() - { - List.Add(this); - _primitive = Primitive.Create(PrimitiveType.Cube, null, Rotation, scale); - _primitive.Color = Color; - } - - internal void Move(Vector3 newPos) - { - _primitive.Position = newPos + Offset; - } - - internal static bool IsPrimitiveArrow(Primitive p) - { - Arrow a =GetArrow(p); - return a != null; - } - - internal static Arrow GetArrow(Primitive p) - { - - foreach(Arrow a in List) - { - if (p == a.Primitive) - return a; - } - return null; - - } - } -} diff --git a/KruacentExiled/KE.Utils/API/Models/Arrows/MoveArrow.cs b/KruacentExiled/KE.Utils/API/Models/Arrows/MoveArrow.cs deleted file mode 100644 index f3216e7f..00000000 --- a/KruacentExiled/KE.Utils/API/Models/Arrows/MoveArrow.cs +++ /dev/null @@ -1,12 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace KE.Utils.API.Models.Arrows -{ - internal class MoveArrow - { - } -} diff --git a/KruacentExiled/KE.Utils/API/Models/Arrows/RotateArrow.cs b/KruacentExiled/KE.Utils/API/Models/Arrows/RotateArrow.cs deleted file mode 100644 index 518fb4b5..00000000 --- a/KruacentExiled/KE.Utils/API/Models/Arrows/RotateArrow.cs +++ /dev/null @@ -1,12 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace KE.Utils.API.Models.Arrows -{ - internal class RotateArrow - { - } -} diff --git a/KruacentExiled/KE.Utils/API/Models/Arrows/ScaleArrow.cs b/KruacentExiled/KE.Utils/API/Models/Arrows/ScaleArrow.cs deleted file mode 100644 index 99bf7d55..00000000 --- a/KruacentExiled/KE.Utils/API/Models/Arrows/ScaleArrow.cs +++ /dev/null @@ -1,12 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace KE.Utils.API.Models.Arrows -{ - internal class ScaleArrow - { - } -} diff --git a/KruacentExiled/KE.Utils/API/Models/Arrows/XArrow.cs b/KruacentExiled/KE.Utils/API/Models/Arrows/XArrow.cs deleted file mode 100644 index 073802c3..00000000 --- a/KruacentExiled/KE.Utils/API/Models/Arrows/XArrow.cs +++ /dev/null @@ -1,16 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using UnityEngine; - -namespace KE.Utils.API.Models.Arrows -{ - internal class XArrow : Arrow - { - internal override Vector3 Offset => new Vector3(scale.x / 2,0); - internal override Vector3 Rotation => new Vector3(0, 0f, 0f); - internal override Color Color => Color.red; - } -} diff --git a/KruacentExiled/KE.Utils/API/Models/Arrows/YArrow.cs b/KruacentExiled/KE.Utils/API/Models/Arrows/YArrow.cs deleted file mode 100644 index e437766e..00000000 --- a/KruacentExiled/KE.Utils/API/Models/Arrows/YArrow.cs +++ /dev/null @@ -1,16 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using UnityEngine; - -namespace KE.Utils.API.Models.Arrows -{ - internal class YArrow : Arrow - { - internal override Vector3 Offset => new Vector3(0, scale.x / 2); - internal override Vector3 Rotation => new Vector3(0, 0f, 90f); - internal override Color Color => Color.green; - } -} diff --git a/KruacentExiled/KE.Utils/API/Models/Arrows/ZArrow.cs b/KruacentExiled/KE.Utils/API/Models/Arrows/ZArrow.cs deleted file mode 100644 index 30c27866..00000000 --- a/KruacentExiled/KE.Utils/API/Models/Arrows/ZArrow.cs +++ /dev/null @@ -1,16 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using UnityEngine; - -namespace KE.Utils.API.Models.Arrows -{ - internal class ZArrow : Arrow - { - internal override Vector3 Offset => new Vector3(0,0, scale.x / 2); - internal override Vector3 Rotation => new Vector3(0, 90f, 0); - internal override Color Color => Color.blue; - } -} diff --git a/KruacentExiled/KE.Utils/API/Models/Blueprints/AdminToyBlueprint.cs b/KruacentExiled/KE.Utils/API/Models/Blueprints/AdminToyBlueprint.cs deleted file mode 100644 index 89189f9d..00000000 --- a/KruacentExiled/KE.Utils/API/Models/Blueprints/AdminToyBlueprint.cs +++ /dev/null @@ -1,75 +0,0 @@ -using Discord; -using Exiled.API.Enums; -using Exiled.API.Features.Toys; -using Exiled.API.Interfaces; -using KE.Utils.API.Interfaces; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using UnityEngine; -using Light = Exiled.API.Features.Toys.Light; - -namespace KE.Utils.API.Models.Blueprints -{ - public abstract class AdminToyBlueprint : ILoadable - { - public AdminToyType AdminToyType { get; protected set; } - //local position - public Vector3 Position { get; protected set; } - public Vector3 Rotation { get; protected set; } - public Vector3 Scale { get; protected set; } - - - public AdminToyBlueprint(Vector3 position, Quaternion rotation, Vector3? center = null) - { - Position = position - center ?? position; - Rotation = rotation.eulerAngles; - } - - public static AdminToyBlueprint Create(AdminToy adminToy, Vector3? center = null) - { - AdminToyBlueprint result; - - - if (adminToy.ToyType == AdminToyType.PrimitiveObject) - { - result = new PrimitiveBlueprint(adminToy as Primitive); - - } - else if(adminToy.ToyType == AdminToyType.LightSource) - { - result = new LightBlueprint(adminToy as Light); - } - else - { - throw new NotImplementedException("only primitive and light"); - } - - - - return result; - } - - - public string Loadable(char separator) - { - StringBuilder b = new(); - b.Append(AdminToyType.ToString()); - b.Append(separator); - b.Append(Position); - b.Append(separator); - b.Append(Rotation); - b.Append(separator); - b.Append(Scale); - b.Append(separator); - b.Append(Load(separator)); - - - return b.ToString(); - } - public abstract AdminToy Spawn(Vector3 center); - protected abstract string Load(char separator); - } -} diff --git a/KruacentExiled/KE.Utils/API/Models/Blueprints/LightBlueprint.cs b/KruacentExiled/KE.Utils/API/Models/Blueprints/LightBlueprint.cs deleted file mode 100644 index 456711ee..00000000 --- a/KruacentExiled/KE.Utils/API/Models/Blueprints/LightBlueprint.cs +++ /dev/null @@ -1,48 +0,0 @@ -using Exiled.API.Enums; -using Exiled.API.Features.Toys; -using System; -using UnityEngine; -using Light = Exiled.API.Features.Toys.Light; - -namespace KE.Utils.API.Models.Blueprints -{ - public class LightBlueprint : AdminToyBlueprint - { - public Color Color { get; } - public float Intensity { get; } - - - public LightBlueprint(Vector3 position, Quaternion rotation, Color color, Vector3 scale,float intensity, Vector3? center = null) : base(position, rotation, center) - { - - AdminToyType = AdminToyType.LightSource; - Scale = scale; - Color = color; - Intensity = intensity; - } - - public LightBlueprint(Light l) : base(l.Position,l.Rotation) - { - AdminToyType = AdminToyType.PrimitiveObject; - Scale = l.Scale; - Color = l.Color; - Intensity = l.Intensity; - } - - - public override AdminToy Spawn(Vector3 center) - { - var l = Light.Create(Position+center, Rotation, Scale, false); - l.Color = Color; - l.Intensity = Intensity; - - - return l; - } - - protected override string Load(char separator) - { - return "#" + ColorUtility.ToHtmlStringRGBA(Color) + separator + Intensity; - } - } -} diff --git a/KruacentExiled/KE.Utils/API/Models/Blueprints/ModelBlueprint.cs b/KruacentExiled/KE.Utils/API/Models/Blueprints/ModelBlueprint.cs deleted file mode 100644 index 0f3a047c..00000000 --- a/KruacentExiled/KE.Utils/API/Models/Blueprints/ModelBlueprint.cs +++ /dev/null @@ -1,110 +0,0 @@ -using Exiled.API.Features; -using Exiled.API.Features.Core; -using Exiled.API.Features.Doors; -using Exiled.API.Features.Toys; -using Exiled.API.Structs; -using KE.Utils.API.Models.ToysSettings; -using KE.Utils.Quality.Models; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Runtime.InteropServices; -using UnityEngine; -using Light = Exiled.API.Features.Toys.Light; - -namespace KE.Utils.API.Models.Blueprints -{ - public class ModelBlueprint - { - private static List _bps = new(); - public static List Blueprints => _bps.ToList(); - private HashSet _toys = new(); - public IReadOnlyCollection Toys => [.. _toys]; - private string _name; - public string Name - { - get { return _name; } - } - - private ModelBlueprint() { } - - - - /// - /// - /// - /// - /// - public static ModelBlueprint Create(Model model) - { - var oldMbp = Get(model.Name); - _bps.Remove(oldMbp); - - - ModelBlueprint mbp = new(); - mbp._name = model.Name; - _bps.Add(mbp); - - foreach(AdminToy toy in model.Toys) - { - mbp._toys.Add(AdminToyBlueprint.Create(toy,model.Center)); - } - - return mbp; - } - - - public static ModelBlueprint Create(string name,IEnumerable toys = null) - { - ModelBlueprint mbp = new(); - _bps.Add(mbp); - - if (string.IsNullOrEmpty(name)) - { - throw new ArgumentException("name null or empty"); - } - - if(toys != null) - { - foreach(AdminToy at in toys) - { - mbp._toys.Add(AdminToyBlueprint.Create(at)); - } - } - - - - mbp._name = name; - - return mbp; - } - - public void Spawn(Vector3 position) - { - Model m = Model.Create(this, position,false); - - - } - - - #region getters - public static ModelBlueprint Get(string name) - { - foreach (ModelBlueprint m in Blueprints) - { - if (m.Name == name) - { - return m; - } - } - return null; - } - - public static bool TryGet(string name, out ModelBlueprint model) - { - model = Get(name); - return model != null; - } - #endregion - } -} diff --git a/KruacentExiled/KE.Utils/API/Models/Blueprints/PrimitiveBlueprint.cs b/KruacentExiled/KE.Utils/API/Models/Blueprints/PrimitiveBlueprint.cs deleted file mode 100644 index e7af1e0b..00000000 --- a/KruacentExiled/KE.Utils/API/Models/Blueprints/PrimitiveBlueprint.cs +++ /dev/null @@ -1,47 +0,0 @@ -using Exiled.API.Enums; -using Exiled.API.Features.Toys; -using UnityEngine; - -namespace KE.Utils.API.Models.Blueprints -{ - public class PrimitiveBlueprint : AdminToyBlueprint - { - public Color Color { get; } - public PrimitiveType Type { get; } - - - public PrimitiveBlueprint(PrimitiveType type, Vector3 position,Quaternion rotation,Color color,Vector3 scale,Vector3? center = null) : base(position,rotation, center) - { - AdminToyType = AdminToyType.PrimitiveObject; - Scale = scale; - Color = color; - Type = type; - } - - public PrimitiveBlueprint(Primitive p) : base(p.Position,p.Rotation) - { - AdminToyType = AdminToyType.PrimitiveObject; - - Scale = p.Scale; - Color = p.Color; - Type = p.Type; - } - - - - public override AdminToy Spawn(Vector3 center) - { - var p = Primitive.Create(Type,Position+center, Rotation, Scale, false); - p.Collidable = false; - p.Color = Color; - - - return p; - } - - protected override string Load(char separator) - { - return "#" + ColorUtility.ToHtmlStringRGBA(Color) + separator+Type; - } - } -} diff --git a/KruacentExiled/KE.Utils/API/Models/Commands/AllCommands.cs b/KruacentExiled/KE.Utils/API/Models/Commands/AllCommands.cs deleted file mode 100644 index 8ba12e68..00000000 --- a/KruacentExiled/KE.Utils/API/Models/Commands/AllCommands.cs +++ /dev/null @@ -1,33 +0,0 @@ -using CommandSystem; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Reflection; -using System.Text; -using System.Threading.Tasks; - -namespace KE.Utils.API.Models.Commands -{ - public static class AllCommands - { - - public static IEnumerable Get(Assembly assembly = null) - { - return new List() - { - new ChangeColor(), - new ChangePrimType(), - new CreateModel(), - new CreatePrim(), - new ListModel(), - new LoadModel(), - new ModeMovePrim(), - new SelectModel(), - new ShowCenter(), - new SaveModel() - - }; - - } - } -} diff --git a/KruacentExiled/KE.Utils/API/Models/Commands/ChangeColor.cs b/KruacentExiled/KE.Utils/API/Models/Commands/ChangeColor.cs deleted file mode 100644 index 3b78d218..00000000 --- a/KruacentExiled/KE.Utils/API/Models/Commands/ChangeColor.cs +++ /dev/null @@ -1,72 +0,0 @@ -using CommandSystem; -using Exiled.API.Features; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using KE.Utils.API.Models; -using UnityEngine; -using Exiled.API.Features.Toys; - -namespace KE.Utils.API.Models.Commands -{ - public class ChangeColor : ICommand - { - - public string Command { get; } = "changecolor"; - - public string[] Aliases { get; } = { "cc" }; - - public string Description { get; } = "change color rgba (0-255)"; - - public bool Execute(ArraySegment arguments, ICommandSender sender, out string response) - { - Player p = Player.Get(sender); - if (p == null) - { - response = "This player can't do this command"; - return false; - } - - if (arguments.Count < 3) - { - response = "not enough arguments"; - return false; - } - if(!byte.TryParse(arguments.At(0),out byte r) || - !byte.TryParse(arguments.At(1), out byte g) || - !byte.TryParse(arguments.At(2), out byte b)) - { - response = "number between 0 & 255"; - return false; - } - - Color32 c; - - if(arguments.Count > 3 && byte.TryParse(arguments.At(3),out byte a)) - { - c = new Color32(r, g, b, a); - } - else - { - c = new Color32(r, g, b,255); - } - - Primitive prim = Models.Instance.ModelCreator.ModelHandler.SelectedPrimitive; - - if(prim == null) - { - response = "no primitive selected"; - return false; - } - - prim.Color = c; - - - response = $"new color set to " + c.ToString(); - return true; - } - - } -} diff --git a/KruacentExiled/KE.Utils/API/Models/Commands/ChangePrimType.cs b/KruacentExiled/KE.Utils/API/Models/Commands/ChangePrimType.cs deleted file mode 100644 index 434427df..00000000 --- a/KruacentExiled/KE.Utils/API/Models/Commands/ChangePrimType.cs +++ /dev/null @@ -1,53 +0,0 @@ -using CommandSystem; -using Exiled.API.Features; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using KE.Utils.API.Models; -using UnityEngine; - -namespace KE.Utils.API.Models.Commands -{ - public class ChangePrimType : ICommand - { - - public string Command { get; } = "changeprimtype"; - - public string[] Aliases { get; } = { "cpt" }; - - public string Description { get; } = "select the mode : scale,move,rotate"; - - public bool Execute(ArraySegment arguments, ICommandSender sender, out string response) - { - Player p = Player.Get(sender); - if (p == null) - { - response = "This player can't do this command"; - return false; - } - - if (arguments.Count < 1) - { - response = "not enough arguments"; - return false; - } - string type = arguments.At(0); - - - if(!Enum.TryParse(type, out PrimitiveType prim)) - { - response = "wrong argument"; - return false; - } - - - Models.Instance.ModelCreator.ModelHandler.SelectedPrimitive.Type = prim; - - response = $"Mode set to " + prim ; - return true; - } - - } -} diff --git a/KruacentExiled/KE.Utils/API/Models/Commands/CreateModel.cs b/KruacentExiled/KE.Utils/API/Models/Commands/CreateModel.cs deleted file mode 100644 index d549cb50..00000000 --- a/KruacentExiled/KE.Utils/API/Models/Commands/CreateModel.cs +++ /dev/null @@ -1,44 +0,0 @@ -using CommandSystem; -using Exiled.API.Features; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace KE.Utils.API.Models.Commands -{ - public class CreateModel : ICommand - { - - public string Command { get; } = "create"; - - public string[] Aliases { get; } = { "c" }; - - public string Description { get; } = "create a new model at your position"; - - public bool Execute(ArraySegment arguments, ICommandSender sender, out string response) - { - - Player p = Player.Get(sender); - if (p == null) - { - response = "This player can't do this command"; - return false; - } - - if (arguments.Count < 1) - { - response = "not enough arguments"; - return false; - } - string name = arguments.At(0); - - Model m = Model.Create(p.Position, name); - Models.Instance.ModelCreator.ModelHandler.SelectedModel = m; - response = $"Created & selected model ({m.Name}) at {m.Center}"; - return true; - } - - } -} diff --git a/KruacentExiled/KE.Utils/API/Models/Commands/CreatePrim.cs b/KruacentExiled/KE.Utils/API/Models/Commands/CreatePrim.cs deleted file mode 100644 index edcd6306..00000000 --- a/KruacentExiled/KE.Utils/API/Models/Commands/CreatePrim.cs +++ /dev/null @@ -1,47 +0,0 @@ -using CommandSystem; -using Exiled.API.Features; -using Exiled.API.Features.Toys; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace KE.Utils.API.Models.Commands -{ - public class CreatePrim : ICommand - { - - public string Command { get; } = "createprimitive"; - - public string[] Aliases { get; } = { "cp" }; //no not like that - - public string Description { get; } = "create a new primitive at your position"; - - public bool Execute(ArraySegment arguments, ICommandSender sender, out string response) - { - - Player p = Player.Get(sender); - if (p == null) - { - response = "This player can't do this command"; - return false; - } - - - Model m = Models.Instance.ModelCreator.SelectedModel; - - if (m == null) - { - response = "no model selected"; - return false; - } - m.Add(p.Position); - - - response = "created!"; - return true; - } - - } -} diff --git a/KruacentExiled/KE.Utils/API/Models/Commands/ListModel.cs b/KruacentExiled/KE.Utils/API/Models/Commands/ListModel.cs deleted file mode 100644 index 79f42597..00000000 --- a/KruacentExiled/KE.Utils/API/Models/Commands/ListModel.cs +++ /dev/null @@ -1,42 +0,0 @@ -using CommandSystem; -using Exiled.API.Features; -using KE.Utils.API.Models.Blueprints; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace KE.Utils.API.Models.Commands -{ - public class ListModel : ICommand - { - - public string Command { get; } = "list"; - - public string[] Aliases { get; } = { "l" }; - - public string Description { get; } = "create a new model at your position"; - - public bool Execute(ArraySegment arguments, ICommandSender sender, out string response) - { - StringBuilder b = new(); - b.AppendLine($"Models ({Model.Models.Count}) :"); - foreach (Model m in Model.Models) - { - b.AppendLine($"{m.Name} pos: {m.Center} spawned? :{m.Spawned}"); - } - - b.AppendLine($"Blueprints ({ModelBlueprint.Blueprints.Count}) :"); - foreach (ModelBlueprint m in ModelBlueprint.Blueprints) - { - b.AppendLine($"{m.Name}"); - } - - - response = b.ToString(); - return true; - } - - } -} diff --git a/KruacentExiled/KE.Utils/API/Models/Commands/LoadModel.cs b/KruacentExiled/KE.Utils/API/Models/Commands/LoadModel.cs deleted file mode 100644 index 7be25565..00000000 --- a/KruacentExiled/KE.Utils/API/Models/Commands/LoadModel.cs +++ /dev/null @@ -1,65 +0,0 @@ -using CommandSystem; -using Exiled.API.Features; -using KE.Utils.API.Models.Blueprints; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using System.Xml.Linq; - -namespace KE.Utils.API.Models.Commands -{ - public class LoadModel : ICommand - { - - public string Command { get; } = "load"; - - public string[] Aliases { get; } = { "lo" }; - - public string Description { get; } = "load a model from a blueprint"; - - public bool Execute(ArraySegment arguments, ICommandSender sender, out string response) - { - - Player p = Player.Get(sender); - if (p == null) - { - response = "This player can't do this command"; - return false; - } - - if (arguments.Count < 1) - { - response = "not enough arguments"; - return false; - } - - string name = arguments.At(0); - - if (string.IsNullOrEmpty(name)) - { - response = "name null or empty"; - return false; - } - - foreach(ModelBlueprint bp in ModelBlueprint.Blueprints) - { - - Log.Info($"{bp.Name} == {name} : {bp.Name == name}"); - } - - - if(!ModelBlueprint.TryGet(name,out var mbp)) - { - response = "blueprint not found"; - return false; - } - - mbp.Spawn(p.Position); - response = $"Created model ({mbp.Name}) at {p.Position}"; - return true; - } - - } -} diff --git a/KruacentExiled/KE.Utils/API/Models/Commands/ModeMovePrim.cs b/KruacentExiled/KE.Utils/API/Models/Commands/ModeMovePrim.cs deleted file mode 100644 index 2b9ea091..00000000 --- a/KruacentExiled/KE.Utils/API/Models/Commands/ModeMovePrim.cs +++ /dev/null @@ -1,64 +0,0 @@ -using CommandSystem; -using Exiled.API.Features; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using KE.Utils.API.Models; - -namespace KE.Utils.API.Models.Commands -{ - public class ModeMovePrim : ICommand - { - - public string Command { get; } = "mode"; - - public string[] Aliases { get; } = { "m" }; - - public string Description { get; } = "select the mode : scale,move,rotate"; - - public bool Execute(ArraySegment arguments, ICommandSender sender, out string response) - { - Player p = Player.Get(sender); - if (p == null) - { - response = "This player can't do this command"; - return false; - } - - if (arguments.Count < 1) - { - response = "not enough arguments"; - return false; - } - string mode = arguments.At(0); - - switch(mode) - { - case "m": - case "move": - Models.Instance.ModelCreator.MovementMode = MovementMode.Move; - break; - case "s": - case "scale": - Models.Instance.ModelCreator.MovementMode = MovementMode.Scale; - break; - case "r": - case "rotate": - Models.Instance.ModelCreator.MovementMode = MovementMode.Rotate; - break; - default: - response = "wrong argument"; - return false; - - - } - - - response = $"Mode set to " + Models.Instance.ModelCreator.MovementMode.ToString(); - return true; - } - - } -} diff --git a/KruacentExiled/KE.Utils/API/Models/Commands/SaveModel.cs b/KruacentExiled/KE.Utils/API/Models/Commands/SaveModel.cs deleted file mode 100644 index d40048e5..00000000 --- a/KruacentExiled/KE.Utils/API/Models/Commands/SaveModel.cs +++ /dev/null @@ -1,47 +0,0 @@ -using CommandSystem; -using Exiled.API.Features; -using KE.Utils.API.Models.Blueprints; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using System.Xml.Linq; - -namespace KE.Utils.API.Models.Commands -{ - public class SaveModel : ICommand - { - - public string Command { get; } = "save"; - - public string[] Aliases { get; } = { "sa" }; - - public string Description { get; } = "save a model to file"; - - public bool Execute(ArraySegment arguments, ICommandSender sender, out string response) - { - - Player p = Player.Get(sender); - if (p == null) - { - response = "This player can't do this command"; - return false; - } - - - Model model = Models.Instance.ModelCreator.SelectedModel; - if (model == null) - { - response = "no model selected"; - return false; - } - - model.Save(); - - response = $"Saved ({model.Name})"; - return true; - } - - } -} diff --git a/KruacentExiled/KE.Utils/API/Models/Commands/SelectModel.cs b/KruacentExiled/KE.Utils/API/Models/Commands/SelectModel.cs deleted file mode 100644 index 266ce4d4..00000000 --- a/KruacentExiled/KE.Utils/API/Models/Commands/SelectModel.cs +++ /dev/null @@ -1,56 +0,0 @@ -using CommandSystem; -using Exiled.API.Features; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace KE.Utils.API.Models.Commands -{ - public class SelectModel : ICommand - { - - public string Command { get; } = "select"; - - public string[] Aliases { get; } = { "s" }; - - public string Description { get; } = "select an existing model"; - - public bool Execute(ArraySegment arguments, ICommandSender sender, out string response) - { - - Player p = Player.Get(sender); - if (p == null) - { - response = "This player can't do this command"; - return false; - } - if (arguments.Count < 1) - { - response = "not enough arguments"; - return false; - } - string name = arguments.At(0); - - if (string.IsNullOrEmpty(name)) - { - response = "name null or empty"; - return false; - } - - - - - if (!Model.TryGet(name, out Model m)) - { - response = "model not found"; - return false; - } - response = $"model ({m.Name}) selected {m.Center}"; - Models.Instance.ModelCreator.ModelHandler.SelectedModel = m; - return true; - } - - } -} diff --git a/KruacentExiled/KE.Utils/API/Models/Commands/ShowCenter.cs b/KruacentExiled/KE.Utils/API/Models/Commands/ShowCenter.cs deleted file mode 100644 index 7b6cc05e..00000000 --- a/KruacentExiled/KE.Utils/API/Models/Commands/ShowCenter.cs +++ /dev/null @@ -1,51 +0,0 @@ -using CommandSystem; -using Exiled.API.Features; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace KE.Utils.API.Models.Commands -{ - public class ShowCenter : ICommand - { - - public string Command { get; } = "show"; - - public string[] Aliases { get; } = { "sh" }; - - public string Description { get; } = "toggle the center of the model"; - - public bool Execute(ArraySegment arguments, ICommandSender sender, out string response) - { - - Player p = Player.Get(sender); - if (p == null) - { - response = "This player can't do this command"; - return false; - } - - Model m = Models.Instance.ModelCreator.ModelHandler.SelectedModel; - - if(m == null) - { - response = "no model selected"; - return false; - } - - if(!bool.TryParse(arguments.At(0),out bool result)) - { - response = "write true or false"; - return false; - } - - m.SetCenterPrimitive(result); - - response = "done"; - - return true; - } - } -} diff --git a/KruacentExiled/KE.Utils/API/Models/Model.cs b/KruacentExiled/KE.Utils/API/Models/Model.cs deleted file mode 100644 index 6e84fbc9..00000000 --- a/KruacentExiled/KE.Utils/API/Models/Model.cs +++ /dev/null @@ -1,202 +0,0 @@ -using Exiled.API.Features; -using Exiled.API.Features.Toys; -using KE.Utils.API.Models.Blueprints; -using System; -using System.Collections.Generic; -using System.Linq; -using UnityEngine; - -namespace KE.Utils.API.Models -{ - public class Model - { - private static List _models = new(); - public static List Models => _models.ToList(); - - private HashSet _toys = new(); - public IReadOnlyCollection Toys => [.. _toys]; - private string _name; - public string Name - { - get { return _name; } - } - - private Vector3 _center; - public Vector3 Center - { - get { return _center; } - } - private bool _spawned = true; - public bool Spawned - { - get { return _spawned; } - } - - private ModelBlueprint _blueprint; - - public ModelBlueprint Blueprint - { - get { return _blueprint; } - } - - public bool LoadedFromBlueprint - { - get - { - return Blueprint != null; - } - } - - - - - - internal Primitive centerPrim; - - public void SetCenterPrimitive(bool show) - { - if (show) - { - centerPrim.Spawn(); - } - else - { - centerPrim.UnSpawn(); - } - } - - - - public Primitive Add(Vector3 pos) - { - var p = Primitive.Create(pos, null, null, true); - - AddToy(p); - return p; - } - - - protected virtual void AddToy(AdminToy toy,bool editMode = true) - { - if(toy is Primitive p && editMode) - { - p.Collidable = true; - } - - - _toys.Add(toy); - } - - private Model(Vector3 center) - { - _models.Add(this); - _center = center; - } - - public static Model Create(Vector3 position, string name) - { - - Model m = new(position); - if (string.IsNullOrEmpty(name)) - { - throw new ArgumentException("name null or empty"); - } - m._name = name; - - Log.Debug("created model id=" + m.Name); - m.centerPrim = Primitive.Create(position, null, Vector3.one / 5, true, new(1, 0, 0, .25f)); - m.centerPrim.Collidable = false; - - return m; - } - - - public static Model Create(ModelBlueprint blueprint,Vector3 position,bool editMode = false) - { - Model m = new(position); - m._name = blueprint.Name; - - foreach (AdminToyBlueprint toy in blueprint.Toys) - { - Log.Info("create toy "+toy.AdminToyType); - AdminToy trueToy = toy.Spawn(m.Center); - - - m.AddToy(trueToy, editMode); - - } - - return m; - - } - - /// - /// Create a based of this

- /// Note : will overwrite the old blueprint - ///
- public void CreateBlueprint() - { - ModelBlueprint bp = ModelBlueprint.Create(this); - - _blueprint = bp; - - } - - - #region getter - public static Model Get(string name) - { - foreach (Model m in _models) - { - if (m.Name == name) - { - return m; - } - } - return null; - } - - public static bool TryGet(string name, out Model model) - { - model = Get(name); - return model != null; - } - - - public override string ToString() - { - return $"{Name} center = {Center}"; - } - #endregion - - #region spawn - public void Spawn() - { - foreach (AdminToy t in Toys) - { - t.Spawn(); - } - _spawned = true; - } - public void UnSpawn() - { - foreach (AdminToy t in Toys) - { - t.UnSpawn(); - } - _spawned = false; - } - - public void Destroy() - { - foreach (AdminToy t in Toys) - { - t.Destroy(); - } - _models.Remove(this); - - } - - #endregion - } -} diff --git a/KruacentExiled/KE.Utils/API/Models/ModelCreator.cs b/KruacentExiled/KE.Utils/API/Models/ModelCreator.cs deleted file mode 100644 index 85758ad9..00000000 --- a/KruacentExiled/KE.Utils/API/Models/ModelCreator.cs +++ /dev/null @@ -1,175 +0,0 @@ -using AdminToys; -using Exiled.API.Features; -using Exiled.API.Features.Items; -using Exiled.API.Features.Toys; -using Exiled.Events.EventArgs.Player; -using KE.Utils.API.Interfaces; -using KE.Utils.API.Models.Arrows; -using MEC; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Runtime.InteropServices; -using System.Text; -using System.Threading.Tasks; -using UnityEngine; - -namespace KE.Utils.API.Models -{ - public class ModelCreator : IUsingEvents - { - - - public const ItemType item = ItemType.GunCOM18; - - public Model SelectedModel - { - get - { - return ModelHandler.SelectedModel; - } - } - public MovementMode MovementMode - { - get - { - return MovementHandler.Mode; - } - set - { - MovementHandler.Mode = value; - } - } - internal MovementHandler MovementHandler { get; private set; } - internal ModelSelection ModelHandler { get; private set; } - - private bool mode = false; - private const float MAX_DISTANCE = 50; - - public static event Action IsAiming; - public static event Action StoppedAiming; - - - - public ModelCreator() - { - - } - - public void SubscribeEvents() - { - - ModelHandler = new(); - MovementHandler = new(); - - ModelLoader.LoadAll(); - MovementHandler.SubscribeEvents(); - Exiled.Events.Handlers.Player.DryfiringWeapon += OnDryfiringWeapon; - Exiled.Events.Handlers.Player.TogglingWeaponFlashlight += OnTogglingWeaponFlashlight; - Exiled.Events.Handlers.Server.RoundStarted += Test; - Exiled.Events.Handlers.Player.AimingDownSight += OnAimingDownSight; - - } - public void UnsubscribeEvents() - { - Exiled.Events.Handlers.Player.DryfiringWeapon -= OnDryfiringWeapon; - Exiled.Events.Handlers.Player.TogglingWeaponFlashlight -= OnTogglingWeaponFlashlight; - Exiled.Events.Handlers.Player.AimingDownSight -= OnAimingDownSight; - Exiled.Events.Handlers.Server.RoundStarted -= Test; - MovementHandler.UnsubscribeEvents(); - - ModelHandler = null; - MovementHandler = null; - } - - private void Test() - { - foreach (var p in Player.List) - { - p.Role.Set(PlayerRoles.RoleTypeId.ChaosConscript); - Timing.CallDelayed(.1f, () => - { - var a = p.AddItem(item); - var b = a as Firearm; - b.MagazineAmmo = 2; - - Primitive.Create(p.Position + Vector3.back, null, null, true, Color.red); - Primitive.Create(p.Position + Vector3.forward, null, null, true, Color.green); - }); - } - } - - - - - private void OnAimingDownSight(AimingDownSightEventArgs ev) - { - if (ev.AdsIn) - { - IsAiming?.Invoke(ev.Player); - } - else - { - StoppedAiming?.Invoke(); - } - } - - private void OnDryfiringWeapon(DryfiringWeaponEventArgs ev) - { - if (ev.Firearm.Type != item) return; - Log.Info("new mode = " + mode); - - if (!mode) - { - - mode = !mode; - } - - - - } - - private void OnTogglingWeaponFlashlight(TogglingWeaponFlashlightEventArgs ev) - { - if (ev.Firearm.Type != item) return; - - - - Primitive p = GetFacingPrimitive(ev.Player); - if (!Arrow.IsPrimitiveArrow(p)) - { - ModelHandler.ChangedSelectedPrim(p); - } - - } - - internal static Primitive GetFacingPrimitive(Player player) - { - Transform cam = player.CameraTransform; - - Vector3 origin = cam.position + cam.forward * 0.5f; - Ray r = new Ray(origin, cam.forward); - if (Physics.Raycast(r, out RaycastHit hit, MAX_DISTANCE)) - { - Log.Info($"hit ({hit.collider.name})"); - PrimitiveObjectToy pot = hit.collider.GetComponentInParent() ?? hit.collider.GetComponentInChildren(); - if (pot != null) - { - return Primitive.Get(pot); - - - } - } - return null; - } - - - - } - public enum MovementMode - { - Move, - Scale, - Rotate - } -} diff --git a/KruacentExiled/KE.Utils/API/Models/ModelLoader.cs b/KruacentExiled/KE.Utils/API/Models/ModelLoader.cs deleted file mode 100644 index d4c60464..00000000 --- a/KruacentExiled/KE.Utils/API/Models/ModelLoader.cs +++ /dev/null @@ -1,152 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.IO; -using Exiled.API.Features; -using Exiled.API.Features.Toys; -using UnityEngine; -using Light = Exiled.API.Features.Toys.Light; -using Exiled.API.Enums; -using KE.Utils.API.Models.Blueprints; -namespace KE.Utils.API.Models -{ - public static class ModelLoader - { - public static string Path => Paths.Configs + @"\"; - private static readonly char SEPARATOR = '_'; - public static string Extension => ".modelscpsl"; - - - public static IEnumerable LoadAll() - { - List m = new(); - - string[] raw = Directory.GetFiles(Path, "*" + Extension); - - foreach (string d in raw) - { - Log.Info("loading="+d); - ModelBlueprint mbp = Load(string.Empty, d); - if(mbp != null) - { - Log.Info($"loaded {mbp.Name} ({mbp.Toys.Count})"); - m.Add(mbp); - } - - } - - return m; - } - - public static ModelBlueprint Load(string filename) - { - return Load(Path, filename); - } - - public static ModelBlueprint Load(string path,string filename) - { - string[] raw; - try - { - raw = File.ReadAllText(path + filename).Split('\n'); - } - catch(Exception e) - { - Log.Error(e); - return null; - } - - - string[] infoline = raw[0].Split(SEPARATOR); - string name = infoline[0]; - List toys = new(); - - - for (int i = 1; i < raw.Length; i++) - { - string[] line = raw[i].Split(SEPARATOR); - AdminToy toy = null; - AdminToyType type; - if (!Enum.TryParse(line[0], out type)) continue; - - Vector3 ATPos = Parser.Vector3(line[1]); - Vector3 ATRotation = Parser.Vector3(line[2]); - Vector3 ATScale = Parser.Vector3(line[3]); - if(type == AdminToyType.PrimitiveObject) - { - Color color; - ColorUtility.TryParseHtmlString(line[4], out color); - PrimitiveType ptype; - Enum.TryParse(line[5], out ptype); - - - var p = Primitive.Create(ptype, ATPos, ATRotation, ATScale, true, color); - p.Collidable = false; - toy = p; - - } - if(type == AdminToyType.LightSource) - { - Color color; - ColorUtility.TryParseHtmlString(line[4], out color); - - float intensity = float.Parse(line[5]); - var l = Light.Create(ATPos, ATRotation, ATScale, true, color); - l.Intensity = intensity; - toy = l; - } - - if (toy == null) continue; - toys.Add(toy); - - } - - - - - return ModelBlueprint.Create(name, toys); - } - - - // Name\n - // Primitive.Position.RotationEuler.Scale.Color.PrimitiveType\n - // Light.Position.RotationEuler.Scale.Color.Intensity\n - // and repeat - public static bool Save(this ModelBlueprint m) - { - - List result = new(); - - result.Add(m.Name+SEPARATOR); - - foreach(AdminToyBlueprint t in m.Toys) - { - result.Add(t.Loadable(SEPARATOR)); - } - - try - { - File.WriteAllLines(Path + m.Name+ Extension, result); - return true; - } - catch(Exception e) - { - Log.Error(e); - return false; - } - - } - - public static bool Save(this Model model) - { - if (!model.LoadedFromBlueprint) - model.CreateBlueprint(); - - - return Save(model.Blueprint); - } - - - } -} diff --git a/KruacentExiled/KE.Utils/API/Models/Models.cs b/KruacentExiled/KE.Utils/API/Models/Models.cs deleted file mode 100644 index 27fe3cf4..00000000 --- a/KruacentExiled/KE.Utils/API/Models/Models.cs +++ /dev/null @@ -1,47 +0,0 @@ -using KE.Utils.API.Interfaces; -using PlayerRoles.FirstPersonControl.Thirdperson; - -namespace KE.Utils.API.Models -{ - public class Models : IUsingEvents - { - public ModelCreator ModelCreator - { - get; - private set; - } - private static Models _instance; - - - public static Models Instance - { - get - { - if (_instance == null) - _instance = new(); - return _instance; - } - } - - public void DestroyInstance() - { - _instance = null; - } - - private Models() - { - ModelCreator = new(); - } - - - public void SubscribeEvents() - { - ModelCreator.SubscribeEvents(); - } - - public void UnsubscribeEvents() - { - ModelCreator.UnsubscribeEvents(); - } - } -} diff --git a/KruacentExiled/KE.Utils/API/Models/MovementHandler.cs b/KruacentExiled/KE.Utils/API/Models/MovementHandler.cs deleted file mode 100644 index 07e3ee18..00000000 --- a/KruacentExiled/KE.Utils/API/Models/MovementHandler.cs +++ /dev/null @@ -1,208 +0,0 @@ -using Exiled.API.Features; -using Exiled.API.Features.Toys; -using Exiled.Events.EventArgs.Player; -using KE.Utils.API.Interfaces; -using KE.Utils.API.Models.Arrows; -using MEC; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using UnityEngine; - -namespace KE.Utils.API.Models -{ - internal class MovementHandler : IUsingEvents - { - - private MovementMode _mode = MovementMode.Move; - - public MovementMode Mode - { - get - { - return _mode; - } - set - { - OnChangingMode?.Invoke(value); - _mode = value; - } - } - public static event Action OnChangingMode; - - - - //xyz - private Arrow[] _arrows = new Arrow[3]; - private bool _primflag = false; - public readonly static float REFRESH_RATE = Timing.WaitForOneFrame; - - private CoroutineHandle _handle; - private bool _aiming = false; - private void TryCreatePrimitives() - { - if (!_primflag) - { - _arrows[0] = new XArrow(); - _arrows[1] = new YArrow(); - _arrows[2] = new ZArrow(); - _primflag = true; - } - } - - - - - public void SubscribeEvents() - { - ModelCreator.IsAiming += IsAiming; - ModelCreator.StoppedAiming += StoppedAiming; - ModelSelection.OnChangedSelection += OnChangedSelection; - ModelSelection.OnUnSelect += OnUnSelect; - } - - public void UnsubscribeEvents() - { - Timing.KillCoroutines(_handle); - - ModelSelection.OnChangedSelection -= OnChangedSelection; - ModelSelection.OnUnSelect -= OnUnSelect; - } - private void OnUnSelect() - { - foreach (Arrow a in Arrow.List) - { - a.Move(Vector3.zero); - } - } - private void OnChangedSelection(Primitive p) - { - Log.Info("ChangedSelection"); - TryCreatePrimitives(); - foreach (Arrow a in Arrow.List) - { - a.Move(p.Position); - } - - } - - - private void IsAiming(Player p) - { - Log.Info("start aim"); - var prim = ModelCreator.GetFacingPrimitive(p); - if (!Arrow.IsPrimitiveArrow(prim)) return; - - _aiming = true; - _handle = Timing.RunCoroutine(Moving(p,prim)); - } - - private void StoppedAiming() - { - Log.Info("stopped aim"); - _aiming = false; - } - - - - private IEnumerator Moving(Player player,Primitive p) - { - Primitive selected = Models.Instance.ModelCreator.ModelHandler.SelectedPrimitive; - Vector3 pos = selected.Position; - Vector3 targetPos = pos; - Vector3 scale = selected.Scale; - Vector3 tScale = scale; - - - - Vector3 oldEuler = player.CameraTransform.rotation.eulerAngles; - Arrow a = Arrow.GetArrow(p); - List otherArrows = Arrow.List.Where(o => o != a).ToList(); - - Vector3 direction = a.Offset.normalized; - float sensitivity = 0.1f; - float smoothSpeed = 5; - - while (_aiming) - { - Vector3 currentEuler = player.CameraTransform.rotation.eulerAngles; - - float deltaYaw = Mathf.DeltaAngle(oldEuler.y, currentEuler.y); - float deltaPitch = Mathf.DeltaAngle(oldEuler.x, currentEuler.x); - - float movementAmount = 0f; - - if (Mathf.Abs(direction.y) > 0.5f) - { - movementAmount = -deltaPitch * sensitivity; - } - else - { - - Vector3 camRight = player.CameraTransform.right; - - float sign = Mathf.Sign(Vector3.Dot(camRight, direction)); - - movementAmount = deltaYaw * sensitivity * sign; - } - - - - - if(Mode == MovementMode.Move) - { - targetPos += direction.normalized * movementAmount; - pos = Vector3.Lerp(pos, targetPos, Time.deltaTime * smoothSpeed); - p.Position = pos; - selected.Position = pos - a.Offset; - foreach (Arrow arrow in otherArrows) - { - arrow.Move(pos - a.Offset); - } - } - - - - if(Mode == MovementMode.Scale) - { - Vector3 previousParallel = direction.normalized * Vector3.Dot(selected.Scale, direction.normalized); - Vector3 dir = direction.normalized; - - float currentLengthInDir = Vector3.Dot(scale, dir); - - float newLengthInDir = Mathf.Clamp(currentLengthInDir + movementAmount, 0.1f, 10f); - - - Vector3 parallel = dir * newLengthInDir; - Vector3 perpendicular = scale - (dir * currentLengthInDir); - - selected.Scale = parallel + perpendicular; - scale = selected.Scale; - - Vector3 deltaParallel = parallel - previousParallel; - a.Primitive.Position += deltaParallel / 2; - previousParallel = parallel; - } - - - - if(Mode == MovementMode.Rotate) - { - Log.Info("no clue how to do that"); - } - - - - - - oldEuler = currentEuler; - yield return REFRESH_RATE; - } - } - - - - } -} diff --git a/KruacentExiled/KE.Utils/API/Models/SelectedModel.cs b/KruacentExiled/KE.Utils/API/Models/SelectedModel.cs deleted file mode 100644 index 7e502f46..00000000 --- a/KruacentExiled/KE.Utils/API/Models/SelectedModel.cs +++ /dev/null @@ -1,52 +0,0 @@ -using Exiled.API.Features; -using Exiled.API.Features.Toys; -using MEC; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using UnityEngine; - -namespace KE.Utils.API.Models -{ - internal class ModelSelection - { - - - - public Model SelectedModel { get; internal set; } - public Primitive SelectedPrimitive; - - public static event Action OnChangedSelection; - public static event Action OnUnSelect; - - public void ChangedSelectedPrim(Primitive newPrim) - { - if (newPrim == null) return; - - - - Log.Info(SelectedPrimitive == null); - Log.Info(newPrim.GameObject.GetInstanceID() != SelectedPrimitive?.GameObject.GetInstanceID()); - - if (SelectedPrimitive == null || newPrim.GameObject.GetInstanceID() != SelectedPrimitive?.GameObject.GetInstanceID()) - { - Log.Info("selecting"); - OnChangedSelection?.Invoke(newPrim); - SelectedPrimitive = newPrim; - } - else - { - Log.Info("unselecting"); - SelectedPrimitive = null; - OnUnSelect?.Invoke(); - } - - } - - - - - } -} diff --git a/KruacentExiled/KE.Utils/API/Models/ToysSettings/PrimitiveSetting.cs b/KruacentExiled/KE.Utils/API/Models/ToysSettings/PrimitiveSetting.cs deleted file mode 100644 index b3ffe31d..00000000 --- a/KruacentExiled/KE.Utils/API/Models/ToysSettings/PrimitiveSetting.cs +++ /dev/null @@ -1,31 +0,0 @@ -using AdminToys; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using UnityEngine; - -namespace KE.Utils.API.Models.ToysSettings -{ - public class PrimitiveSetting : ToySetting - { - - public PrimitiveType PrimitiveType { get; } - - - public PrimitiveFlags Flags { get; } - - - public Color Color { get; } - - public Vector3 Position { get; } - - - public Vector3 Rotation { get; } - - - public Vector3 Scale { get; } - - } -} diff --git a/KruacentExiled/KE.Utils/API/Models/ToysSettings/ToySetting.cs b/KruacentExiled/KE.Utils/API/Models/ToysSettings/ToySetting.cs deleted file mode 100644 index 8fdc4477..00000000 --- a/KruacentExiled/KE.Utils/API/Models/ToysSettings/ToySetting.cs +++ /dev/null @@ -1,20 +0,0 @@ -using Exiled.API.Features.Toys; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace KE.Utils.API.Models.ToysSettings -{ - public abstract class ToySetting - { - - - - public virtual void Create(AdminToy a) - { - - } - } -} diff --git a/KruacentExiled/KE.Utils/API/OtherUtils.cs b/KruacentExiled/KE.Utils/API/OtherUtils.cs deleted file mode 100644 index ef43b888..00000000 --- a/KruacentExiled/KE.Utils/API/OtherUtils.cs +++ /dev/null @@ -1,18 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using UnityEngine; - -namespace KE.Utils.API -{ - public static class OtherUtils - { - - public static bool IsInCircle(Vector3 pos,Vector3 centerCircle,float radius) - { - return (pos-centerCircle).sqrMagnitude <= Math.Pow(radius, 2); - } - } -} diff --git a/KruacentExiled/KE.Utils/API/Parser.cs b/KruacentExiled/KE.Utils/API/Parser.cs deleted file mode 100644 index a924337f..00000000 --- a/KruacentExiled/KE.Utils/API/Parser.cs +++ /dev/null @@ -1,36 +0,0 @@ -using Exiled.API.Features; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using UnityEngine; - -namespace KE.Utils.API -{ - public static class Parser - { - public static Vector3 Vector3(string s) - { - string[] temp = s.Substring(1, s.Length - 3).Split(','); - - if(!float.TryParse(temp[0],out float x)) - { - return UnityEngine.Vector3.zero; - } - - if (!float.TryParse(temp[1], out float y)) - { - return UnityEngine.Vector3.zero; - } - if (!float.TryParse(temp[1], out float z)) - { - return UnityEngine.Vector3.zero; - } - - - - return new Vector3(x, y, z); - } - } -} diff --git a/KruacentExiled/KE.Utils/API/ReflectionHelper.cs b/KruacentExiled/KE.Utils/API/ReflectionHelper.cs deleted file mode 100644 index d95fa32a..00000000 --- a/KruacentExiled/KE.Utils/API/ReflectionHelper.cs +++ /dev/null @@ -1,47 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Reflection; -using System.Text; -using System.Threading.Tasks; - -namespace KE.Utils.API -{ - public static class ReflectionHelper - { - public static IEnumerable GetObjects(Assembly assembly = null) - { - List result = new(); - if (assembly == null) - { - assembly = Assembly.GetCallingAssembly(); - } - foreach (Type t in assembly.GetTypes()) - { - try - { - if (typeof(T).IsAssignableFrom(t) && !t.IsAbstract) - { - T ffcc = (T)Activator.CreateInstance(t); - result.Add(ffcc); - } - } - catch (Exception) - { - - } - } - return result; - } - - public static IEnumerable GetObjects(IEnumerable assemblies) - { - List result = new(); - foreach (Assembly assembly in assemblies) - { - result.AddRange(GetObjects(assembly)); - } - return result; - } - } -} diff --git a/KruacentExiled/KE.Utils/API/Sounds/SoundPlayer.cs b/KruacentExiled/KE.Utils/API/Sounds/SoundPlayer.cs deleted file mode 100644 index 08090bbd..00000000 --- a/KruacentExiled/KE.Utils/API/Sounds/SoundPlayer.cs +++ /dev/null @@ -1,116 +0,0 @@ -using Exiled.API.Features; -using System; -using System.Collections.Generic; -using System.IO; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using UnityEngine; - -namespace KE.Utils.API.Sounds -{ - public class SoundPlayer - { - private static SoundPlayer _instance; - - public static SoundPlayer Instance - { - get - { - if (_instance == null) - { - _instance = new(); - } - return _instance; - } - } - - private SoundPlayer() { } - - private bool _loaded = false; - public bool Loaded => _loaded; - - public static readonly HashSet clips = new(); - - public static string SoundLocation => Paths.Configs + "/Sounds"; - public static void Load() => Instance.TryLoad(); - public void TryLoad() - { - if (Loaded) - { - return; - } - - if (!Directory.Exists(SoundLocation)) - { - Log.Warn("Directory not found. creating..."); - Directory.CreateDirectory(SoundLocation); - } - - string[] rawfile = Directory.GetFiles(SoundLocation, "*.ogg"); - - foreach (string file in rawfile) - { - string noExFile = Path.GetFileNameWithoutExtension(file); - Log.Info($"loading {file} as {noExFile}"); - clips.Add(noExFile); - AudioClipStorage.LoadClip(file); - } - _loaded = true; - } - - - /// - /// Play a clip at a static point - /// - /// - /// - /// - /// - public AudioClipPlayback Play(string clipName, Vector3 pos, float volume = 50f, float maxDistance = 20f, bool isSpatial = true) - { - if (!Loaded) throw new Exception("clips not loaded use SoundPlayer.Load()"); - Log.Debug($"playing {clipName} at {pos}"); - - var audioPlayer = AudioPlayer.CreateOrGet($"{clipName} ({pos})", onIntialCreation: (p) => - { - GameObject a = new GameObject(); - a.transform.position = pos; - p.transform.parent = a.transform; - Speaker speaker = p.AddSpeaker("main", isSpatial: isSpatial, maxDistance: maxDistance, minDistance: 1f); - speaker.transform.parent = a.transform; - speaker.transform.localPosition = Vector3.zero; - }); - - audioPlayer.AddClip(clipName, volume: volume); - audioPlayer.DestroyWhenAllClipsPlayed = true; - return audioPlayer.AddClip(clipName, volume: volume); - - - } - - /// - /// Play a clip at a - /// - /// - /// - /// - /// - public void Play(string clipName, GameObject objectEmittingSound, float volume = 50f, float maxDistance = 20f, bool isSpatial = true) - { - if (!Loaded) throw new Exception("clips not loaded use SoundPlayer.Instance.Load()"); - Log.Debug($"playing {clipName} at {objectEmittingSound}"); - - var audioPlayer = AudioPlayer.CreateOrGet($"{clipName} ({objectEmittingSound})", onIntialCreation: (p) => - { - - p.transform.parent = objectEmittingSound.transform; - Speaker speaker = p.AddSpeaker("main", isSpatial: isSpatial, maxDistance: maxDistance, minDistance: 1f); - speaker.transform.parent = objectEmittingSound.transform; - speaker.transform.localPosition = Vector3.zero; - }); - audioPlayer.AddClip(clipName, volume: volume); - audioPlayer.DestroyWhenAllClipsPlayed = true; - } - } -} diff --git a/KruacentExiled/KE.Utils/Extensions/AdminToyExtension.cs b/KruacentExiled/KE.Utils/Extensions/AdminToyExtension.cs deleted file mode 100644 index 37c3706d..00000000 --- a/KruacentExiled/KE.Utils/Extensions/AdminToyExtension.cs +++ /dev/null @@ -1,25 +0,0 @@ -using Exiled.API.Features.Toys; -using KE.Utils.Quality; -using KE.Utils.Quality.Enums; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace KE.Utils.Extensions -{ - public static class AdminToyExtension - { - - public static void SetAsPickupAdminToy(this AdminToy toy, bool autoSync = true) - { - QualityHandler.Instance.QualityToysHandler.SetAsPickup(toy); - } - - public static void SetQuality(this AdminToy toy, ModelQuality modelQuality,bool autoSync = true) - { - QualityHandler.Instance.QualityToysHandler.SetQuality(toy, modelQuality); - } - } -} diff --git a/KruacentExiled/KE.Utils/Extensions/NpcExtension.cs b/KruacentExiled/KE.Utils/Extensions/NpcExtension.cs deleted file mode 100644 index 6af07bc5..00000000 --- a/KruacentExiled/KE.Utils/Extensions/NpcExtension.cs +++ /dev/null @@ -1,23 +0,0 @@ -using CentralAuth; -using Exiled.API.Features; -using Mirror; -using PlayerRoles; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace KE.Utils.Extensions -{ - public static class NpcExtension - { - - - public static void Hide(this Npc npc) - { - npc.ReferenceHub.authManager.NetworkSyncedUserId = "ID_Dedicated"; - npc.ReferenceHub.authManager.syncMode = (SyncMode)ClientInstanceMode.DedicatedServer; - } - } -} diff --git a/KruacentExiled/KE.Utils/Extensions/PlayerExtension.cs b/KruacentExiled/KE.Utils/Extensions/PlayerExtension.cs deleted file mode 100644 index 7625d700..00000000 --- a/KruacentExiled/KE.Utils/Extensions/PlayerExtension.cs +++ /dev/null @@ -1,62 +0,0 @@ -using CustomPlayerEffects; -using Exiled.API.Enums; -using Exiled.API.Features; -using Mirror; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using UnityEngine; - -namespace KE.Utils.Extensions -{ - public static class PlayerExtension - { - public static void SetFakeInvis(this Player p, IEnumerable viewers) - { - Vector3 pos = p.Position; - - try - { - p.ReferenceHub.transform.localPosition = Vector3.zero; - foreach (Player viewer in viewers) - { - Server.SendSpawnMessage.Invoke(null, new object[2] { viewer.NetworkIdentity, viewer.Connection }); - } - - p.ReferenceHub.transform.localPosition = pos; - } - catch (Exception arg) - { - Log.Error(string.Format("{0}: {1}", "SetFakeInvis", arg)); - } - } - - - - - public static void AddLevelEffect(this Player p,EffectType type, int intensity) - { - - - - if (p.TryGetEffect(type, out var effect)) - { - byte newIntensity =(byte) Mathf.Clamp(effect.Intensity + intensity,byte.MinValue,byte.MaxValue); - - p.ChangeEffectIntensity(type, newIntensity); - } - else - { - byte newIntensity = (byte)Mathf.Clamp(intensity, byte.MinValue, byte.MaxValue); - p.EnableEffect(type, newIntensity); - } - - - } - - - - } -} diff --git a/KruacentExiled/KE.Utils/Extensions/RoomExtension.cs b/KruacentExiled/KE.Utils/Extensions/RoomExtension.cs deleted file mode 100644 index 35fee2e8..00000000 --- a/KruacentExiled/KE.Utils/Extensions/RoomExtension.cs +++ /dev/null @@ -1,12 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace KE.Utils.Extensions -{ - internal class RoomExtension - { - } -} diff --git a/KruacentExiled/KE.Utils/Extensions/RoomExtensions.cs b/KruacentExiled/KE.Utils/Extensions/RoomExtensions.cs deleted file mode 100644 index 61fd0291..00000000 --- a/KruacentExiled/KE.Utils/Extensions/RoomExtensions.cs +++ /dev/null @@ -1,55 +0,0 @@ -using Exiled.API.Features; -using Exiled.API.Enums; -using Discord; -using System.Linq; -using Exiled.API.Extensions; - -namespace KE.Utils.Extensions -{ - public static class RoomExtensions - { - - - public static Room RandomSafeRoom(this ZoneType zone) - { - return Room.List.Where(r => r.IsSafe() && r.Zone == zone).GetRandomValue(); - } - - - /// - /// Check if a is Safe (Decontamination,Warhead) - /// - /// Note: Does NOT check if the is safe to teleport in (ex : TestRoom) - /// - /// - /// return true if the is safe for a ; false otherwise - public static bool IsSafe(this Room room) - { - return room.Zone.IsSafe(); - } - - - /// - /// Check if a is Safe (Decontamination,Warhead) - /// - /// return true if the zone is safe for a ; false otherwise - public static bool IsSafe(this ZoneType zone) - { - bool result = true; - if (zone == ZoneType.LightContainment) - result = Map.DecontaminationState < DecontaminationState.Countdown; - switch (zone) - { - case ZoneType.LightContainment: - case ZoneType.HeavyContainment: - case ZoneType.Entrance: - result = !Warhead.IsDetonated; - break; - } - return result; - } - - - - } -} diff --git a/KruacentExiled/KE.Utils/KE.Utils.csproj b/KruacentExiled/KE.Utils/KE.Utils.csproj deleted file mode 100644 index be48bb20..00000000 --- a/KruacentExiled/KE.Utils/KE.Utils.csproj +++ /dev/null @@ -1,32 +0,0 @@ - - - - 13.0 - net48 - - - - - - - - - - - - - - - - - - - - if not "$(EXILED_DEV_REFERENCES)"=="" copy /y "$(OutputPath)$(AssemblyName).dll" "$(EXILED_DEV_REFERENCES)\Plugins\" - - - if [[ ! -z "$EXILED_DEV_REFERENCES" ]]; then cp "$(OutputPath)$(AssemblyName).dll" "$EXILED_DEV_REFERENCES/Plugins/"; fi - - - - diff --git a/KruacentExiled/KE.Utils/Quality/Enums/ModelQuality.cs b/KruacentExiled/KE.Utils/Quality/Enums/ModelQuality.cs deleted file mode 100644 index d9d8d295..00000000 --- a/KruacentExiled/KE.Utils/Quality/Enums/ModelQuality.cs +++ /dev/null @@ -1,16 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace KE.Utils.Quality.Enums -{ - public enum ModelQuality - { - None = -1, - Low, - Medium, - High, - } -} diff --git a/KruacentExiled/KE.Utils/Quality/Handlers/QualityToysHandler.cs b/KruacentExiled/KE.Utils/Quality/Handlers/QualityToysHandler.cs deleted file mode 100644 index b2485795..00000000 --- a/KruacentExiled/KE.Utils/Quality/Handlers/QualityToysHandler.cs +++ /dev/null @@ -1,179 +0,0 @@ -using AdminToys; -using Exiled.API.Enums; -using Exiled.API.Extensions; -using Exiled.API.Features; -using Exiled.API.Features.Toys; -using KE.Utils.Quality.Enums; -using KE.Utils.Quality.Settings; -using MEC; -using System; -using System.Collections.Generic; -using System.Linq; -using UnityEngine; -using Light = Exiled.API.Features.Toys.Light; -using QualitySettings = KE.Utils.Quality.Settings.QualitySettings; - -namespace KE.Utils.Quality.Handlers -{ - public class QualityToysHandler - { - private HashSet _pickupToys = new(); - private Dictionary _qualityToys = new(); - public readonly Vector3 Gulag = new Vector3(15000, 15000, 15000); - public const float Delay = Timing.WaitForOneFrame; - public bool IsPickupToy(AdminToy primitive) - { - return _pickupToys.Contains(primitive); - } - - public bool IsQualityToy(AdminToy primitive) - { - return _qualityToys.ContainsKey(primitive); - } - - - public void SetAsPickup(AdminToy toy, bool autoSync = true) - { - if (!_pickupToys.Add(toy)) - { - Log.Warn($"AdminToy {toy} is already a pickupToy"); - return; - } - if (autoSync) - Sync(toy); - } - - public void SetQuality(AdminToy toy, ModelQuality quality, bool autoSync = true) - { - if (toy == null) return; - if (!_qualityToys.ContainsKey(toy)) - _qualityToys.Add(toy, quality); - else - _qualityToys[toy] = quality; - - if (autoSync) - Sync(toy); - } - - - - private void SendToFakePosition(AdminToy adminToy, Player player,Vector3 position) - { - //idk why but without delay it show all of the quality at once - Timing.CallDelayed(Delay, () => - { - if (adminToy is Light l) - { - player.SendFakeSyncVar(l.Base.netIdentity, typeof(LightSourceToy), nameof(LightSourceToy.NetworkPosition), position); - return; - } - if (adminToy is Primitive p) - { - player.SendFakeSyncVar(p.Base.netIdentity, typeof(PrimitiveObjectToy), nameof(PrimitiveObjectToy.NetworkPosition), position); - return; - } - }); - - } - - /// - /// Sync every Players - /// - public void Sync() - { - foreach (Player p in Player.List) - { - Sync(p); - } - } - - /// - /// Sync a specified Player - /// - /// - public void Sync(Player p) - { - - - - var quality = QualitySettings.Get(p); - var pickup = QualitySettings.PickmodelActivated(p); - - HashSet pickupToRemove = []; - HashSet qualityToRemove = []; - - //hide pickup toys - - foreach (AdminToy pk in _pickupToys) - { - try - { - if (pickup) - { - SendToFakePosition(pk, p, pk.Position); - } - else - { - SendToFakePosition(pk, p, Gulag); - } - } - catch (NullReferenceException) - { - //Log.Warn("removing pickup"); - pickupToRemove.Add(pk); - } - - } - - _pickupToys.RemoveWhere(p => pickupToRemove.Contains(p)); - - - foreach (var at in _qualityToys) - { - try - { - if ((at.Value == quality || at.Value == ModelQuality.None) && (pickup || !_pickupToys.Contains(at.Key))) - { - SendToFakePosition(at.Key, p, at.Key.Position); - } - else - { - SendToFakePosition(at.Key, p, Gulag); - } - } - catch (NullReferenceException) - { - //Log.Warn("removing quality" + _qualityToys.Count); - qualityToRemove.Add(at.Key); - } - - - } - foreach(var at in qualityToRemove) - { - - _qualityToys.Remove(at); - } - - } - - /// - /// Sync a specified AdminToy - /// - /// - public void Sync(AdminToy adminToy) - { - //temporary fix - Sync(); - - if (IsPickupToy(adminToy)) - { - - } - if (IsQualityToy(adminToy)) - { - - } - } - } -} diff --git a/KruacentExiled/KE.Utils/Quality/Models/Base/BaseModel.cs b/KruacentExiled/KE.Utils/Quality/Models/Base/BaseModel.cs deleted file mode 100644 index c9f6723c..00000000 --- a/KruacentExiled/KE.Utils/Quality/Models/Base/BaseModel.cs +++ /dev/null @@ -1,41 +0,0 @@ -using Exiled.API.Enums; -using Exiled.API.Extensions; -using Exiled.API.Features.Toys; -using Exiled.API.Interfaces; -using KE.Utils.Quality.Structs; -using PlayerStatsSystem; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using UnityEngine; -using Light = Exiled.API.Features.Toys.Light; - -namespace KE.Utils.Quality.Models.Base -{ - - /// - /// The blocks to build a model with - /// - public abstract class BaseModel : ICloneable - { - - protected AdminToy _toy; - public AdminToy AdminToy { get { return _toy; } } - private Vector3 _position; - public Vector3 LocalPosition { get { return _position; } } - private Quaternion _rotation; - public Quaternion LocalRotation { get { return _rotation; } } - - - public BaseModel(Vector3 localPositon, Quaternion localRotation) - { - _position = localPositon; - _rotation = localRotation; - } - - public abstract object Clone(); - } - -} diff --git a/KruacentExiled/KE.Utils/Quality/Models/Base/LightModel.cs b/KruacentExiled/KE.Utils/Quality/Models/Base/LightModel.cs deleted file mode 100644 index ce808da1..00000000 --- a/KruacentExiled/KE.Utils/Quality/Models/Base/LightModel.cs +++ /dev/null @@ -1,26 +0,0 @@ -using Exiled.API.Features.Toys; -using UnityEngine; -using Light = Exiled.API.Features.Toys.Light; - -namespace KE.Utils.Quality.Models.Base -{ - public class LightModel : BaseModel - { - - /// - /// Create a new Light for modeling - /// - public LightModel(Vector3? scale, Color? color, Vector3 localPositon, Quaternion localRotation) : base(localPositon, localRotation) - { - Light light = Light.Create(null, null, scale, false, color); - _toy = light; - } - - - public override object Clone() - { - Light light = _toy as Light; - return new LightModel(light.Scale, light.Color, LocalPosition, LocalRotation); - } - } -} diff --git a/KruacentExiled/KE.Utils/Quality/Models/Base/PrimitiveModel.cs b/KruacentExiled/KE.Utils/Quality/Models/Base/PrimitiveModel.cs deleted file mode 100644 index 22e07225..00000000 --- a/KruacentExiled/KE.Utils/Quality/Models/Base/PrimitiveModel.cs +++ /dev/null @@ -1,26 +0,0 @@ -using Exiled.API.Features.Toys; -using UnityEngine; -using Color = UnityEngine.Color; - -namespace KE.Utils.Quality.Models.Base -{ - public class PrimitiveModel : BaseModel - { - /// - /// Create a new Primitive for modeling - /// - public PrimitiveModel(PrimitiveType type, Vector3? scale, Color? color,Vector3 localPosition,Quaternion localRotation) : base(localPosition, localRotation) - { - - Primitive prim = Primitive.Create(type, null, null, scale, false, color); - prim.Collidable = false; - _toy = prim; - } - - public override object Clone() - { - Primitive prim = _toy as Primitive; - return new PrimitiveModel(prim.Type, prim.Scale, prim.Color, LocalPosition, LocalRotation); - } - } -} diff --git a/KruacentExiled/KE.Utils/Quality/Models/Examples/MineModel.cs b/KruacentExiled/KE.Utils/Quality/Models/Examples/MineModel.cs deleted file mode 100644 index 00d60fec..00000000 --- a/KruacentExiled/KE.Utils/Quality/Models/Examples/MineModel.cs +++ /dev/null @@ -1,118 +0,0 @@ -using KE.Utils.Quality.Enums; -using KE.Utils.Quality.Models.Base; -using System.Collections.Generic; -using UnityEngine; -using Light = Exiled.API.Features.Toys.Light; - -namespace KE.Utils.Quality.Models.Examples -{ - public abstract class MineModel : QualityModel - { - protected Light _light; - private bool _lightOn = false; - - - - - public void ToggleLight() - { - if (_light == null) throw new System.Exception("no light"); - if (_lightOn) - _light.UnSpawn(); - else - _light.Spawn(); - _lightOn = !_lightOn; - } - - } - - public class MineModelLow : MineModel - { - public override bool IsPickup => false; - public override ModelQuality Quality => ModelQuality.Low; - - protected override IEnumerable GetBaseModels() - { - Quaternion baseRotation = new(); - //spawn + offset - Vector3 offset = new Vector3(0, .05f); - Vector3 sizeDisk = new Vector3(.7f, 0.1f, .7f); - - Vector3 sizeGlobe = new Vector3(.1f, .1f, .1f); - Vector3 posLight = new Vector3(0, sizeDisk.y+sizeGlobe.y); - - - var baseMine = new PrimitiveModel(PrimitiveType.Cylinder, sizeDisk, Color.black, offset, baseRotation); - - var lightGlobe = new PrimitiveModel(PrimitiveType.Sphere, sizeGlobe , new Color(1, 0, 0, .33f), posLight, baseRotation); - - var lightMine = new LightModel(null, Color.red, posLight, baseRotation); - - _light = lightMine.AdminToy as Light; - _light.Intensity = .55f; - - return [baseMine, lightGlobe, lightMine]; - } - - - } - - public class MineModelMedium : MineModel - { - public override bool IsPickup => false; - public override ModelQuality Quality => ModelQuality.Medium; - - protected override IEnumerable GetBaseModels() - { - Quaternion baseRotation = new(); - //spawn + offset - Vector3 offset = new Vector3(0, .05f); - Vector3 sizeDisk = new Vector3(.7f, 0.1f, .7f); - - Vector3 sizeGlobe = new Vector3(.1f, .1f, .1f); - Vector3 posLight = new Vector3(0, sizeDisk.y + sizeGlobe.y); - - - var baseMine = new PrimitiveModel(PrimitiveType.Cylinder, sizeDisk, Color.black, offset, baseRotation); - - var lightGlobe = new PrimitiveModel(PrimitiveType.Sphere, sizeGlobe, new Color(1, 0, 0, .33f), posLight, baseRotation); - - var lightMine = new LightModel(null, Color.green, posLight, baseRotation); - - _light = lightMine.AdminToy as Light; - _light.Intensity = .55f; - - return [baseMine, lightGlobe, lightMine]; - } - } - - public class MineModelPickup : MineModel - { - public override bool IsPickup => true; - public override ModelQuality Quality => ModelQuality.None; - - - protected override IEnumerable GetBaseModels() - { - Quaternion baseRotation = new(); - //spawn + offset - Vector3 offset = new Vector3(0, .05f); - Vector3 sizeDisk = new Vector3(.7f, 0.1f, .7f); - - Vector3 sizeGlobe = new Vector3(.1f, .1f, .1f); - Vector3 posLight = new Vector3(0, sizeDisk.y + sizeGlobe.y); - - - var baseMine = new PrimitiveModel(PrimitiveType.Cylinder, sizeDisk, Color.black, offset, baseRotation); - - var lightGlobe = new PrimitiveModel(PrimitiveType.Sphere, sizeGlobe, new Color(1, 0, 0, .33f), posLight, baseRotation); - - var lightMine = new LightModel(null, Color.magenta, posLight, baseRotation); - - _light = lightMine.AdminToy as Light; - _light.Intensity = .55f; - - return [baseMine, lightGlobe, lightMine]; - } - } -} diff --git a/KruacentExiled/KE.Utils/Quality/Models/Model.cs b/KruacentExiled/KE.Utils/Quality/Models/Model.cs deleted file mode 100644 index 2e26756e..00000000 --- a/KruacentExiled/KE.Utils/Quality/Models/Model.cs +++ /dev/null @@ -1,104 +0,0 @@ -using Exiled.API.Features; -using Exiled.API.Features.Toys; -using KE.Utils.Quality.Models.Base; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using UnityEngine; - -namespace KE.Utils.Quality.Models -{ - public class Model : IEquatable - { - - - private Vector3 _position; - public Vector3 Position - { - get { return _position; } - set - { - _position = value; - } - } - private Quaternion _rotation; - public Quaternion Rotation - { - get { return _rotation; } - set - { - _rotation = value; - } - } - private ModelPrefab _prefab; - public ModelPrefab Prefab - { - get { return _prefab; } - } - - - - private HashSet _models; - - internal Model(ModelPrefab prefab, Vector3 position, Quaternion rotation,IEnumerable toys,bool spawn) - { - _prefab = prefab; - Position = position; - Rotation = rotation; - _models = new HashSet(toys); - QualityHandler.Instance.QualityToysHandler.Sync(); - - foreach (BaseModel based in toys) - { - AdminToy toy = based.AdminToy; - - if (toy is Primitive p) - p.Collidable = false; - toy.AdminToyBase.transform.position = based.LocalPosition + Position; - toy.AdminToyBase.transform.rotation = based.LocalRotation * Rotation; - } - if(spawn) - { - Spawn(); - } - } - - - public void Destroy() - { - foreach (BaseModel primitive in _models) - { - primitive.AdminToy.Destroy(); - } - } - public void UnSpawn() - { - foreach (BaseModel primitive in _models) - { - primitive.AdminToy.UnSpawn(); - } - } - public void Spawn() - { - QualityHandler.Instance.QualityToysHandler.Sync(); - foreach (BaseModel primitive in _models) - { - primitive.AdminToy.Spawn(); - } - - } - - - public bool Equals(Model x) - { - if (x == null) return false; - return x._prefab == _prefab && x.Position == Position && x.Rotation == Rotation; - } - public int GetHashCode(Model obj) - { - return obj.GetHashCode(); - } - } -} diff --git a/KruacentExiled/KE.Utils/Quality/Models/ModelPrefab.cs b/KruacentExiled/KE.Utils/Quality/Models/ModelPrefab.cs deleted file mode 100644 index bbc39da4..00000000 --- a/KruacentExiled/KE.Utils/Quality/Models/ModelPrefab.cs +++ /dev/null @@ -1,42 +0,0 @@ -using Exiled.API.Features; -using Exiled.API.Features.Core; -using Exiled.API.Features.Pickups; -using Exiled.API.Features.Toys; -using Exiled.API.Interfaces; -using KE.Utils.Extensions; -using KE.Utils.Quality.Models.Base; -using KE.Utils.Quality.Structs; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using UnityEngine; -using Light = Exiled.API.Features.Toys.Light; - -namespace KE.Utils.Quality.Models -{ - public abstract class ModelPrefab - { - - protected abstract IEnumerable GetBaseModels(); - - public virtual Model Create(Vector3 position,Quaternion rotation, bool spawn = true) - { - - HashSet clonetoys = new(); - HashSet toys = GetBaseModels().ToHashSet(); - foreach (BaseModel model in toys) - { - BaseModel clone = (BaseModel)model.Clone(); - clonetoys.Add(clone); - } - return new Model(this, position, rotation, clonetoys,spawn); - - } - - - - - } -} diff --git a/KruacentExiled/KE.Utils/Quality/Models/QualityModel.cs b/KruacentExiled/KE.Utils/Quality/Models/QualityModel.cs deleted file mode 100644 index b5cc682f..00000000 --- a/KruacentExiled/KE.Utils/Quality/Models/QualityModel.cs +++ /dev/null @@ -1,40 +0,0 @@ -using Exiled.API.Features; -using Exiled.API.Features.Toys; -using KE.Utils.Extensions; -using KE.Utils.Quality.Enums; -using KE.Utils.Quality.Models.Base; -using System.Collections.Generic; -using System.Linq; -using UnityEngine; - -namespace KE.Utils.Quality.Models -{ - public abstract class QualityModel : ModelPrefab - { - public abstract ModelQuality Quality { get; } - public abstract bool IsPickup { get; } - - - - - public override sealed Model Create(Vector3 position, Quaternion rotation,bool spawn = true) - { - - HashSet clonetoys = new(); - HashSet toys = GetBaseModels().ToHashSet(); - foreach (BaseModel model in toys) - { - BaseModel clone = (BaseModel)model.Clone(); - - if (IsPickup) - clone.AdminToy.SetAsPickupAdminToy(false); - - clone.AdminToy.SetQuality(Quality,false); - clonetoys.Add(clone); - } - QualityHandler.Sync(); - return new Model(this,position, rotation, clonetoys, spawn); - } - - } -} diff --git a/KruacentExiled/KE.Utils/Quality/QualityHandler.cs b/KruacentExiled/KE.Utils/Quality/QualityHandler.cs deleted file mode 100644 index 235d79c9..00000000 --- a/KruacentExiled/KE.Utils/Quality/QualityHandler.cs +++ /dev/null @@ -1,61 +0,0 @@ -using Exiled.API.Features; -using Exiled.API.Features.Core.UserSettings; -using KE.Utils.Quality.Handlers; -using KE.Utils.Quality.Settings; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace KE.Utils.Quality -{ - [Obsolete("scrapped", false)] - internal class QualityHandler - { - public QualitySettings QualitySettings { get; private set; } - public QualityToysHandler QualityToysHandler { get; private set; } - - private static QualityHandler _instance; - public static QualityHandler Instance - { - get - { - if(_instance == null ) - _instance = new QualityHandler(); - return _instance; - } - } - private QualityHandler() - { - QualitySettings = new QualitySettings(Changed); - QualityToysHandler = new QualityToysHandler(); - } - - ~QualityHandler() - { - QualityToysHandler = null; - QualitySettings = null; - } - - public void Changed(Player p, SettingBase _) - { - QualityToysHandler.Sync(p); - } - - public void Register() - { - QualitySettings.Register(); - } - - public void Unregister() - { - QualitySettings.Unregister(); - } - - public static void Sync() - { - Instance.QualityToysHandler.Sync(); - } - } -} diff --git a/KruacentExiled/KE.Utils/Quality/QualityToysHandler.cs b/KruacentExiled/KE.Utils/Quality/QualityToysHandler.cs deleted file mode 100644 index 27320233..00000000 --- a/KruacentExiled/KE.Utils/Quality/QualityToysHandler.cs +++ /dev/null @@ -1,155 +0,0 @@ -using AdminToys; -using Exiled.API.Enums; -using Exiled.API.Extensions; -using Exiled.API.Features; -using Exiled.API.Features.Toys; -using KE.Utils.Quality.Enums; -using KE.Utils.Quality.Settings; -using System.Collections.Generic; -using System.Linq; -using UnityEngine; -using Light = Exiled.API.Features.Toys.Light; -using QualitySettings = KE.Utils.Quality.Settings.QualitySettings; - -namespace KE.Utils.Quality -{ - public class QualityToysHandler - { - private HashSet _pickupToys = new(); - private Dictionary _qualityToys = new(); - public readonly Vector3 Gulag = new Vector3(15000,15000,15000); - - public bool IsPickupToy(AdminToy primitive) - { - return _pickupToys.Contains(primitive); - } - - public bool IsQualityToy(AdminToy primitive) - { - return _qualityToys.ContainsKey(primitive); - } - - - public void SetAsPickup(AdminToy toy) - { - if (!_pickupToys.Add(toy)) - { - Log.Warn($"AdminToy {toy} is already a pickupToy"); - return; - } - } - - public void SetQuality(AdminToy toy,ModelQuality quality) - { - if (toy == null) return; - if (!_qualityToys.ContainsKey(toy)) - _qualityToys.Add(toy,quality); - else - _qualityToys[toy] = quality; - } - - - - private void SendToShadowRealm(AdminToy adminToy, Player player) - { - if(adminToy is Light l) - { - player.SendFakeSyncVar(l.Base.netIdentity, typeof(LightSourceToy), nameof(LightSourceToy.NetworkPosition), Gulag); - return; - } - if(adminToy is Primitive p) - { - player.SendFakeSyncVar(p.Base.netIdentity, typeof(PrimitiveObjectToy), nameof(PrimitiveObjectToy.NetworkPosition), Gulag); - return; - } - } - - private void SetTruePosition(AdminToy adminToy, Player player) - { - if (adminToy is Light l) - { - player.SendFakeSyncVar(l.Base.netIdentity, typeof(LightSourceToy), nameof(LightSourceToy.NetworkPosition), l.Position); - return; - } - if (adminToy is Primitive p) - { - player.SendFakeSyncVar(p.Base.netIdentity, typeof(PrimitiveObjectToy), nameof(PrimitiveObjectToy.NetworkPosition), p.Position); - return; - } - } - - /// - /// Sync every Players - /// - public void Sync() - { - foreach(Player p in Player.List) - { - Sync(p); - } - } - - /// - /// Sync a specified Player - /// - /// - public void Sync(Player p) - { - var quality = QualitySettings.Get(p); - var pickup = QualitySettings.PickmodelActivated(p); - - if (!pickup) - { - //hide pickup toys - foreach (AdminToy pk in _pickupToys) - { - SendToShadowRealm(pk, p); - } - } - else - { - //show pickup toys - foreach (AdminToy pk in _pickupToys) - { - SetTruePosition(pk, p); - } - } - - - - - foreach(var at in _qualityToys) - { - if(at.Value == quality) - { - if (pickup || !_pickupToys.Contains(at.Key)) - { - SetTruePosition(at.Key, p); - } - } - else - { - SendToShadowRealm(at.Key, p); - } - - } - - } - - /// - /// Sync a specified AdminToy - /// - /// - public void Sync(AdminToy adminToy) - { - if (IsPickupToy(adminToy)) - { - - } - if (IsQualityToy(adminToy)) - { - - } - } - } -} diff --git a/KruacentExiled/KE.Utils/Quality/Settings/QualitySettings.cs b/KruacentExiled/KE.Utils/Quality/Settings/QualitySettings.cs deleted file mode 100644 index 7771958f..00000000 --- a/KruacentExiled/KE.Utils/Quality/Settings/QualitySettings.cs +++ /dev/null @@ -1,62 +0,0 @@ -using Exiled.API.Features; -using Exiled.API.Features.Core.UserSettings; -using KE.Utils.Quality.Enums; -using System; - -namespace KE.Utils.Quality.Settings -{ - public class QualitySettings - { - - private static int _idQuality = 0; - private static int _idModels = 1; - private static int _idSlider = 2; - private SettingBase[] _settings; - public QualitySettings(Action onChanged) - { - //HeaderSetting header = new("Quality Settings"); - _settings = - [ - //header, - new DropdownSetting(_idQuality,"ModelQuality",["Low","Medium", "High"],onChanged:onChanged), - new TwoButtonsSetting(_idModels,"Pickup models","Disabled","Enabled", onChanged:onChanged) - ]; - } - - public void Register() - { - SettingBase.Register(_settings); - SettingBase.SendToAll(); - } - - public void Unregister() - { - SettingBase.Unregister(settings:_settings); - } - - - - - public static ModelQuality Get(Player p) - { - if (!SettingBase.TryGetSetting(p, _idQuality, out var setting)) return ModelQuality.None; - - return setting.SelectedOption switch - { - "Low" => ModelQuality.Low, - "Medium" => ModelQuality.Medium, - "High" => ModelQuality.High, - _ => ModelQuality.None, - }; - } - - - public static bool PickmodelActivated(Player p) - { - if (!SettingBase.TryGetSetting(p, _idModels, out var setting)) return false; - return setting.IsSecond; - } - - - } -} diff --git a/KruacentExiled/KE.Utils/Quality/Structs/LocalWorldSpace.cs b/KruacentExiled/KE.Utils/Quality/Structs/LocalWorldSpace.cs deleted file mode 100644 index d9c6205b..00000000 --- a/KruacentExiled/KE.Utils/Quality/Structs/LocalWorldSpace.cs +++ /dev/null @@ -1,23 +0,0 @@ -using Exiled.API.Interfaces; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using UnityEngine; - -namespace KE.Utils.Quality.Structs -{ - public readonly struct LocalWorldSpace : IWorldSpace - { - - public Vector3 Position { get; } - public Quaternion Rotation { get; } - - public LocalWorldSpace(Vector3 position, Quaternion rotation) - { - Position = position; - Rotation = rotation; - } - } -} diff --git a/KruacentExiled/KE.Utils/Quality/Tests/Test.cs b/KruacentExiled/KE.Utils/Quality/Tests/Test.cs deleted file mode 100644 index 6ebd3f66..00000000 --- a/KruacentExiled/KE.Utils/Quality/Tests/Test.cs +++ /dev/null @@ -1,108 +0,0 @@ -using Exiled.API.Extensions; -using Exiled.API.Features; -using Exiled.API.Features.Toys; -using KE.Utils.Quality.Models; -using KE.Utils.Quality.Models.Examples; -using MEC; -using PlayerRoles; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using UnityEngine; - -namespace KE.Utils.Quality.Tests -{ - public class Test - { - private QualityHandler QualityHandler; - - - private Test(QualityHandler q) - { - QualityHandler = q; - try - { - TestMine(); - } - catch (Exception ex) - { - Log.Error("Exception for TestMine :\n"+ex); - } - - } - internal void TestQuality() - { - Vector3 pos = RoleTypeId.Scp049.GetRandomSpawnLocation().Position; - Primitive c = Primitive.Create(pos); - c.Color = Color.red; - Primitive c2 = Primitive.Create(pos + Vector3.one); - c2.Color = Color.green; - - - QualityHandler.QualityToysHandler.SetQuality(c, Enums.ModelQuality.Low); - QualityHandler.QualityToysHandler.SetQuality(c2, Enums.ModelQuality.Medium); - } - - internal void StressTest(int count) - { - Timing.RunCoroutine(Stress(count)); - } - - - private IEnumerator Stress(int count) - { - Vector3 pos = RoleTypeId.Scp049.GetRandomSpawnLocation().Position; - Vector3 scale = new Vector3(.1f, .1f, .1f); - float maxSpread = 5; - for (int i = 0; i < count; i++) - { - Primitive c = Primitive.Create(pos + new Vector3(UnityEngine.Random.Range(0f, maxSpread), UnityEngine.Random.Range(0f, maxSpread), UnityEngine.Random.Range(0f, maxSpread)), scale: scale); - QualityHandler.QualityToysHandler.SetQuality(c, Enums.ModelQuality.Medium); - } - QualityHandler.QualityToysHandler.Sync(); - yield return 0; - } - - public void TestMine() - { - Log.Info("TestMine"); - Vector3 pos = RoleTypeId.Scp049.GetRandomSpawnLocation().Position; - MineModelLow mml = new(); - - - Model m = mml.Create(pos, new Quaternion()); - m.Spawn(); - - - MineModelMedium mmm = new(); - - m = mmm.Create(pos + Vector3.up, new Quaternion()); - m.Spawn(); - - - MineModelPickup mmp = new(); - m = mmp.Create(pos + Vector3.right, new Quaternion()); - m.Spawn(); - - QualityHandler.Sync(); - - - - - - - - - foreach (var item in Player.List) - { - item.Teleport(pos); - } - - - - - } - } -} From d52d666010d72594031de270f81f60238000f4be Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Thu, 9 Apr 2026 16:26:41 +0200 Subject: [PATCH 833/853] removed utils --- .../Displays/DisplayMeow/DisplayHandler.cs | 67 ------ .../API/Displays/DisplayMeow/HintPlacement.cs | 31 --- .../KE.Utils/API/GifAnimator/RenderGif.cs | 128 ----------- .../KE.Utils/API/Interfaces/IEvents.cs | 17 -- .../KE.Utils/API/Interfaces/ILoadable.cs | 13 -- .../KE.Utils/API/Models/Arrows/Arrow.cs | 58 ----- .../KE.Utils/API/Models/Arrows/MoveArrow.cs | 12 - .../KE.Utils/API/Models/Arrows/RotateArrow.cs | 12 - .../KE.Utils/API/Models/Arrows/ScaleArrow.cs | 12 - .../KE.Utils/API/Models/Arrows/XArrow.cs | 16 -- .../KE.Utils/API/Models/Arrows/YArrow.cs | 16 -- .../KE.Utils/API/Models/Arrows/ZArrow.cs | 16 -- .../Models/Blueprints/AdminToyBlueprint.cs | 69 ------ .../API/Models/Blueprints/LightBlueprint.cs | 37 ---- .../API/Models/Blueprints/ModelBlueprint.cs | 110 --------- .../Models/Blueprints/PrimitiveBlueprint.cs | 39 ---- .../API/Models/Commands/AllCommands.cs | 33 --- .../API/Models/Commands/ChangeColor.cs | 72 ------ .../API/Models/Commands/ChangePrimType.cs | 53 ----- .../API/Models/Commands/CreateModel.cs | 44 ---- .../API/Models/Commands/CreatePrim.cs | 47 ---- .../KE.Utils/API/Models/Commands/ListModel.cs | 42 ---- .../KE.Utils/API/Models/Commands/LoadModel.cs | 65 ------ .../API/Models/Commands/ModeMovePrim.cs | 64 ------ .../KE.Utils/API/Models/Commands/SaveModel.cs | 47 ---- .../API/Models/Commands/SelectModel.cs | 56 ----- .../API/Models/Commands/ShowCenter.cs | 51 ----- KruacentExiled/KE.Utils/API/Models/Model.cs | 202 ----------------- .../KE.Utils/API/Models/ModelCreator.cs | 175 --------------- .../KE.Utils/API/Models/ModelLoader.cs | 152 ------------- KruacentExiled/KE.Utils/API/Models/Models.cs | 47 ---- .../KE.Utils/API/Models/MovementHandler.cs | 208 ------------------ .../KE.Utils/API/Models/SelectedModel.cs | 52 ----- .../Models/ToysSettings/PrimitiveSetting.cs | 31 --- .../API/Models/ToysSettings/ToySetting.cs | 20 -- KruacentExiled/KE.Utils/API/OtherUtils.cs | 18 -- KruacentExiled/KE.Utils/API/Parser.cs | 36 --- .../KE.Utils/API/ReflectionHelper.cs | 47 ---- .../KE.Utils/API/Sounds/SoundPlayer.cs | 116 ---------- .../KE.Utils/Extensions/AdminToyExtension.cs | 25 --- .../KE.Utils/Extensions/NpcExtension.cs | 23 -- .../KE.Utils/Extensions/PlayerExtension.cs | 52 ----- .../KE.Utils/Extensions/RoomExtensions.cs | 55 ----- KruacentExiled/KE.Utils/KE.Utils.csproj | 38 ---- .../KE.Utils/Quality/Enums/ModelQuality.cs | 16 -- .../Quality/Handlers/QualityToysHandler.cs | 179 --------------- .../KE.Utils/Quality/Models/Base/BaseModel.cs | 41 ---- .../Quality/Models/Base/LightModel.cs | 26 --- .../Quality/Models/Base/PrimitiveModel.cs | 26 --- .../Quality/Models/Examples/MineModel.cs | 118 ---------- .../KE.Utils/Quality/Models/Model.cs | 104 --------- .../KE.Utils/Quality/Models/ModelPrefab.cs | 42 ---- .../KE.Utils/Quality/Models/QualityModel.cs | 40 ---- .../KE.Utils/Quality/QualityHandler.cs | 61 ----- .../KE.Utils/Quality/QualityToysHandler.cs | 155 ------------- .../Quality/Settings/QualitySettings.cs | 62 ------ .../Quality/Structs/LocalWorldSpace.cs | 23 -- KruacentExiled/KE.Utils/Quality/Tests/Test.cs | 108 --------- 58 files changed, 3525 deletions(-) delete mode 100644 KruacentExiled/KE.Utils/API/Displays/DisplayMeow/DisplayHandler.cs delete mode 100644 KruacentExiled/KE.Utils/API/Displays/DisplayMeow/HintPlacement.cs delete mode 100644 KruacentExiled/KE.Utils/API/GifAnimator/RenderGif.cs delete mode 100644 KruacentExiled/KE.Utils/API/Interfaces/IEvents.cs delete mode 100644 KruacentExiled/KE.Utils/API/Interfaces/ILoadable.cs delete mode 100644 KruacentExiled/KE.Utils/API/Models/Arrows/Arrow.cs delete mode 100644 KruacentExiled/KE.Utils/API/Models/Arrows/MoveArrow.cs delete mode 100644 KruacentExiled/KE.Utils/API/Models/Arrows/RotateArrow.cs delete mode 100644 KruacentExiled/KE.Utils/API/Models/Arrows/ScaleArrow.cs delete mode 100644 KruacentExiled/KE.Utils/API/Models/Arrows/XArrow.cs delete mode 100644 KruacentExiled/KE.Utils/API/Models/Arrows/YArrow.cs delete mode 100644 KruacentExiled/KE.Utils/API/Models/Arrows/ZArrow.cs delete mode 100644 KruacentExiled/KE.Utils/API/Models/Blueprints/AdminToyBlueprint.cs delete mode 100644 KruacentExiled/KE.Utils/API/Models/Blueprints/LightBlueprint.cs delete mode 100644 KruacentExiled/KE.Utils/API/Models/Blueprints/ModelBlueprint.cs delete mode 100644 KruacentExiled/KE.Utils/API/Models/Blueprints/PrimitiveBlueprint.cs delete mode 100644 KruacentExiled/KE.Utils/API/Models/Commands/AllCommands.cs delete mode 100644 KruacentExiled/KE.Utils/API/Models/Commands/ChangeColor.cs delete mode 100644 KruacentExiled/KE.Utils/API/Models/Commands/ChangePrimType.cs delete mode 100644 KruacentExiled/KE.Utils/API/Models/Commands/CreateModel.cs delete mode 100644 KruacentExiled/KE.Utils/API/Models/Commands/CreatePrim.cs delete mode 100644 KruacentExiled/KE.Utils/API/Models/Commands/ListModel.cs delete mode 100644 KruacentExiled/KE.Utils/API/Models/Commands/LoadModel.cs delete mode 100644 KruacentExiled/KE.Utils/API/Models/Commands/ModeMovePrim.cs delete mode 100644 KruacentExiled/KE.Utils/API/Models/Commands/SaveModel.cs delete mode 100644 KruacentExiled/KE.Utils/API/Models/Commands/SelectModel.cs delete mode 100644 KruacentExiled/KE.Utils/API/Models/Commands/ShowCenter.cs delete mode 100644 KruacentExiled/KE.Utils/API/Models/Model.cs delete mode 100644 KruacentExiled/KE.Utils/API/Models/ModelCreator.cs delete mode 100644 KruacentExiled/KE.Utils/API/Models/ModelLoader.cs delete mode 100644 KruacentExiled/KE.Utils/API/Models/Models.cs delete mode 100644 KruacentExiled/KE.Utils/API/Models/MovementHandler.cs delete mode 100644 KruacentExiled/KE.Utils/API/Models/SelectedModel.cs delete mode 100644 KruacentExiled/KE.Utils/API/Models/ToysSettings/PrimitiveSetting.cs delete mode 100644 KruacentExiled/KE.Utils/API/Models/ToysSettings/ToySetting.cs delete mode 100644 KruacentExiled/KE.Utils/API/OtherUtils.cs delete mode 100644 KruacentExiled/KE.Utils/API/Parser.cs delete mode 100644 KruacentExiled/KE.Utils/API/ReflectionHelper.cs delete mode 100644 KruacentExiled/KE.Utils/API/Sounds/SoundPlayer.cs delete mode 100644 KruacentExiled/KE.Utils/Extensions/AdminToyExtension.cs delete mode 100644 KruacentExiled/KE.Utils/Extensions/NpcExtension.cs delete mode 100644 KruacentExiled/KE.Utils/Extensions/PlayerExtension.cs delete mode 100644 KruacentExiled/KE.Utils/Extensions/RoomExtensions.cs delete mode 100644 KruacentExiled/KE.Utils/KE.Utils.csproj delete mode 100644 KruacentExiled/KE.Utils/Quality/Enums/ModelQuality.cs delete mode 100644 KruacentExiled/KE.Utils/Quality/Handlers/QualityToysHandler.cs delete mode 100644 KruacentExiled/KE.Utils/Quality/Models/Base/BaseModel.cs delete mode 100644 KruacentExiled/KE.Utils/Quality/Models/Base/LightModel.cs delete mode 100644 KruacentExiled/KE.Utils/Quality/Models/Base/PrimitiveModel.cs delete mode 100644 KruacentExiled/KE.Utils/Quality/Models/Examples/MineModel.cs delete mode 100644 KruacentExiled/KE.Utils/Quality/Models/Model.cs delete mode 100644 KruacentExiled/KE.Utils/Quality/Models/ModelPrefab.cs delete mode 100644 KruacentExiled/KE.Utils/Quality/Models/QualityModel.cs delete mode 100644 KruacentExiled/KE.Utils/Quality/QualityHandler.cs delete mode 100644 KruacentExiled/KE.Utils/Quality/QualityToysHandler.cs delete mode 100644 KruacentExiled/KE.Utils/Quality/Settings/QualitySettings.cs delete mode 100644 KruacentExiled/KE.Utils/Quality/Structs/LocalWorldSpace.cs delete mode 100644 KruacentExiled/KE.Utils/Quality/Tests/Test.cs diff --git a/KruacentExiled/KE.Utils/API/Displays/DisplayMeow/DisplayHandler.cs b/KruacentExiled/KE.Utils/API/Displays/DisplayMeow/DisplayHandler.cs deleted file mode 100644 index 4ee13535..00000000 --- a/KruacentExiled/KE.Utils/API/Displays/DisplayMeow/DisplayHandler.cs +++ /dev/null @@ -1,67 +0,0 @@ -using Exiled.API.Features; -using HintServiceMeow.Core.Extension; -using HintServiceMeow.Core.Models.Hints; -using HintServiceMeow.Core.Utilities; -using MEC; - - -//damn why the same name -using MHint = HintServiceMeow.Core.Models.Hints.Hint; - -namespace KE.Utils.API.Displays.DisplayMeow -{ - public class DisplayHandler - { - public static DisplayHandler Instance { get; } = new(); - - private DisplayHandler() { } - - - - - - - public MHint AddHint(HintPlacement hintPlacement, Player player, string text, float delay) - { - var dis = PlayerDisplay.Get(player); - string id = $"{player.Id}_{hintPlacement.XCoordinate}_{hintPlacement.YCoordinate}"; - MHint hint; - - if (!dis.TryGetHint(id, out var aHint)) - { - hint = new() - { - Text = text, - XCoordinate = hintPlacement.XCoordinate, - YCoordinate = hintPlacement.YCoordinate, - Alignment = hintPlacement.HintAlignment, - Id = id - - }; - dis.AddHint(hint); - - } - else - { - - hint = (MHint)aHint; - hint.Hide = false; - hint.Text = text; - } - - - hint.HideAfter(delay); - return hint; - } - - - - - - - - - - - } -} diff --git a/KruacentExiled/KE.Utils/API/Displays/DisplayMeow/HintPlacement.cs b/KruacentExiled/KE.Utils/API/Displays/DisplayMeow/HintPlacement.cs deleted file mode 100644 index 936cdbe9..00000000 --- a/KruacentExiled/KE.Utils/API/Displays/DisplayMeow/HintPlacement.cs +++ /dev/null @@ -1,31 +0,0 @@ -using HintServiceMeow.Core.Enum; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace KE.Utils.API.Displays.DisplayMeow -{ - public readonly struct HintPlacement : IEquatable - { - public float YCoordinate { get; } - public float XCoordinate { get; } - public HintAlignment HintAlignment { get; } = HintAlignment.Center; - - - public bool Equals(HintPlacement obj) - { - return YCoordinate == obj.YCoordinate && XCoordinate == obj.XCoordinate; - } - - - public HintPlacement(float xCoordinate, float yCoordinate, HintAlignment alignment = HintAlignment.Center) - { - YCoordinate = yCoordinate; - XCoordinate = xCoordinate; - HintAlignment = alignment; - } - - } -} diff --git a/KruacentExiled/KE.Utils/API/GifAnimator/RenderGif.cs b/KruacentExiled/KE.Utils/API/GifAnimator/RenderGif.cs deleted file mode 100644 index f4276d33..00000000 --- a/KruacentExiled/KE.Utils/API/GifAnimator/RenderGif.cs +++ /dev/null @@ -1,128 +0,0 @@ -using System.Collections.Generic; -using System.Drawing; -using System.Drawing.Imaging; -using System.IO; -using Exiled.API.Features; -using Exiled.API.Features.Toys; -using MEC; -using UnityEngine; -using UnityEngine.Rendering; -using Color = UnityEngine.Color; -namespace KE.Utils.API.GifAnimator -{ - internal class RenderGif - { - - public static void Spawn() - { - - } - - - - private static IEnumerator RenderImageCoroutine(object target, string filePath, float maxWidth, float maxHeight, float distance, float duration, int targetWidth, int targetHeight) - { - if (!File.Exists(filePath)) - { - Log.Debug($"No image was found under: {filePath}"); - yield break; - } - - byte[] imageData = File.ReadAllBytes(filePath); - - - - - - - Texture2D original = new Texture2D(2, 2); - - - try - { - original.LoadRawTextureData(imageData); - } - catch(UnityException) - { - Log.Debug("Image couldnt be loaded."); - yield break; - } - - Texture2D scaled = new Texture2D(targetWidth, targetHeight, TextureFormat.RGBA32, false); - - for (int x = 0; x < targetWidth; x++) - { - for (int y = 0; y < targetHeight; y++) - { - float u = x / (float)targetWidth; - float v = y / (float)targetHeight; - Color color = original.GetPixelBilinear(u, v); - scaled.SetPixel(x, y, color); - } - } - scaled.Apply(); - - float pixelScaleX = maxWidth / targetWidth; - float pixelScaleY = maxHeight / targetHeight; - float scale = Mathf.Min(pixelScaleX, pixelScaleY); - - Vector3 forwardOrigin; - Quaternion rotation = Quaternion.identity; - - if (target is Exiled.API.Features.Player player) - { - forwardOrigin = player.CameraTransform.position + player.CameraTransform.forward * distance; - - Vector3 directionToPlayer = forwardOrigin - player.CameraTransform.position; - directionToPlayer.y = 0; - rotation = Quaternion.LookRotation(directionToPlayer); - } - else if (target is Vector3 position) - { - forwardOrigin = position + Vector3.forward * distance; - Vector3 directionToPosition = forwardOrigin - position; - directionToPosition.y = 0; - rotation = Quaternion.LookRotation(directionToPosition); - } - else if (target is Room room) - { - forwardOrigin = room.Position + Vector3.up * 2f; - Vector3 directionToRoom = forwardOrigin - room.Position; - directionToRoom.y = 0; - rotation = Quaternion.LookRotation(directionToRoom); - } - else - { - Log.Debug("Invalid object type. Valid types: Player, Vector3, Room"); - yield break; - } - - Vector3 offset = new Vector3((targetWidth * scale) / 2f, (targetHeight * scale) / 2f, 0); - - for (int x = 0; x < targetWidth; x++) - { - for (int y = 0; y < targetHeight; y++) - { - Color pixelColor = scaled.GetPixel(x, y); - if (pixelColor.a < 0.1f) - continue; - - Vector3 localOffset = new Vector3(x * scale, y * scale, 0) - offset; - Vector3 worldPos = forwardOrigin + rotation * localOffset; - - Primitive quad = Primitive.Create(PrimitiveType.Quad); - quad.Position = worldPos; - quad.Scale = new Vector3(scale, scale, scale * 0.01f); - quad.Color = pixelColor; - - Quaternion fixedRotation = Quaternion.Euler(0f, rotation.eulerAngles.y, 0f); - quad.Rotation = fixedRotation; - quad.Flags = AdminToys.PrimitiveFlags.Visible; - } - - yield return Timing.WaitForOneFrame; - } - } - - } -} diff --git a/KruacentExiled/KE.Utils/API/Interfaces/IEvents.cs b/KruacentExiled/KE.Utils/API/Interfaces/IEvents.cs deleted file mode 100644 index e573b062..00000000 --- a/KruacentExiled/KE.Utils/API/Interfaces/IEvents.cs +++ /dev/null @@ -1,17 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace KE.Utils.API.Interfaces -{ - public interface IUsingEvents - { - - - public void SubscribeEvents(); - - public void UnsubscribeEvents(); - } -} diff --git a/KruacentExiled/KE.Utils/API/Interfaces/ILoadable.cs b/KruacentExiled/KE.Utils/API/Interfaces/ILoadable.cs deleted file mode 100644 index c9e00399..00000000 --- a/KruacentExiled/KE.Utils/API/Interfaces/ILoadable.cs +++ /dev/null @@ -1,13 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace KE.Utils.API.Interfaces -{ - public interface ILoadable - { - public string Loadable(char separator); - } -} diff --git a/KruacentExiled/KE.Utils/API/Models/Arrows/Arrow.cs b/KruacentExiled/KE.Utils/API/Models/Arrows/Arrow.cs deleted file mode 100644 index 990999c7..00000000 --- a/KruacentExiled/KE.Utils/API/Models/Arrows/Arrow.cs +++ /dev/null @@ -1,58 +0,0 @@ -using Exiled.API.Features.Toys; -using InventorySystem.Items.Keycards; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Net.Sockets; -using System.Text; -using System.Threading.Tasks; -using UnityEngine; - -namespace KE.Utils.API.Models.Arrows -{ - internal abstract class Arrow - { - internal static HashSet List = new(); - internal abstract Vector3 Offset { get; } - internal abstract Vector3 Rotation { get; } - internal abstract Color Color { get; } - - protected readonly Vector3 scale = new Vector3(1f, .1f, .1f); - - private Primitive _primitive; - - internal Primitive Primitive - { - get { return _primitive; } - } - internal Arrow() - { - List.Add(this); - _primitive = Primitive.Create(PrimitiveType.Cube, null, Rotation, scale); - _primitive.Color = Color; - } - - internal void Move(Vector3 newPos) - { - _primitive.Position = newPos + Offset; - } - - internal static bool IsPrimitiveArrow(Primitive p) - { - Arrow a =GetArrow(p); - return a != null; - } - - internal static Arrow GetArrow(Primitive p) - { - - foreach(Arrow a in List) - { - if (p == a.Primitive) - return a; - } - return null; - - } - } -} diff --git a/KruacentExiled/KE.Utils/API/Models/Arrows/MoveArrow.cs b/KruacentExiled/KE.Utils/API/Models/Arrows/MoveArrow.cs deleted file mode 100644 index f3216e7f..00000000 --- a/KruacentExiled/KE.Utils/API/Models/Arrows/MoveArrow.cs +++ /dev/null @@ -1,12 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace KE.Utils.API.Models.Arrows -{ - internal class MoveArrow - { - } -} diff --git a/KruacentExiled/KE.Utils/API/Models/Arrows/RotateArrow.cs b/KruacentExiled/KE.Utils/API/Models/Arrows/RotateArrow.cs deleted file mode 100644 index 518fb4b5..00000000 --- a/KruacentExiled/KE.Utils/API/Models/Arrows/RotateArrow.cs +++ /dev/null @@ -1,12 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace KE.Utils.API.Models.Arrows -{ - internal class RotateArrow - { - } -} diff --git a/KruacentExiled/KE.Utils/API/Models/Arrows/ScaleArrow.cs b/KruacentExiled/KE.Utils/API/Models/Arrows/ScaleArrow.cs deleted file mode 100644 index 99bf7d55..00000000 --- a/KruacentExiled/KE.Utils/API/Models/Arrows/ScaleArrow.cs +++ /dev/null @@ -1,12 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace KE.Utils.API.Models.Arrows -{ - internal class ScaleArrow - { - } -} diff --git a/KruacentExiled/KE.Utils/API/Models/Arrows/XArrow.cs b/KruacentExiled/KE.Utils/API/Models/Arrows/XArrow.cs deleted file mode 100644 index 073802c3..00000000 --- a/KruacentExiled/KE.Utils/API/Models/Arrows/XArrow.cs +++ /dev/null @@ -1,16 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using UnityEngine; - -namespace KE.Utils.API.Models.Arrows -{ - internal class XArrow : Arrow - { - internal override Vector3 Offset => new Vector3(scale.x / 2,0); - internal override Vector3 Rotation => new Vector3(0, 0f, 0f); - internal override Color Color => Color.red; - } -} diff --git a/KruacentExiled/KE.Utils/API/Models/Arrows/YArrow.cs b/KruacentExiled/KE.Utils/API/Models/Arrows/YArrow.cs deleted file mode 100644 index e437766e..00000000 --- a/KruacentExiled/KE.Utils/API/Models/Arrows/YArrow.cs +++ /dev/null @@ -1,16 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using UnityEngine; - -namespace KE.Utils.API.Models.Arrows -{ - internal class YArrow : Arrow - { - internal override Vector3 Offset => new Vector3(0, scale.x / 2); - internal override Vector3 Rotation => new Vector3(0, 0f, 90f); - internal override Color Color => Color.green; - } -} diff --git a/KruacentExiled/KE.Utils/API/Models/Arrows/ZArrow.cs b/KruacentExiled/KE.Utils/API/Models/Arrows/ZArrow.cs deleted file mode 100644 index 30c27866..00000000 --- a/KruacentExiled/KE.Utils/API/Models/Arrows/ZArrow.cs +++ /dev/null @@ -1,16 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using UnityEngine; - -namespace KE.Utils.API.Models.Arrows -{ - internal class ZArrow : Arrow - { - internal override Vector3 Offset => new Vector3(0,0, scale.x / 2); - internal override Vector3 Rotation => new Vector3(0, 90f, 0); - internal override Color Color => Color.blue; - } -} diff --git a/KruacentExiled/KE.Utils/API/Models/Blueprints/AdminToyBlueprint.cs b/KruacentExiled/KE.Utils/API/Models/Blueprints/AdminToyBlueprint.cs deleted file mode 100644 index ccfcff3d..00000000 --- a/KruacentExiled/KE.Utils/API/Models/Blueprints/AdminToyBlueprint.cs +++ /dev/null @@ -1,69 +0,0 @@ -using Exiled.API.Enums; -using Exiled.API.Features.Toys; -using Exiled.API.Interfaces; -using KE.Utils.API.Interfaces; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using UnityEngine; -using Light = Exiled.API.Features.Toys.Light; - -namespace KE.Utils.API.Models.Blueprints -{ - public abstract class AdminToyBlueprint : ILoadable - { - public AdminToyType AdminToyType { get; protected set; } - //local position - public Vector3 Position { get; protected set; } - public Vector3 Rotation { get; protected set; } - public Vector3 Scale { get; protected set; } - - - public static AdminToyBlueprint Create(AdminToy adminToy, Vector3? center = null) - { - AdminToyBlueprint result; - - - if (adminToy.ToyType == AdminToyType.PrimitiveObject) - { - result = new PrimitiveBlueprint(adminToy as Primitive); - - } - else if(adminToy.ToyType == AdminToyType.LightSource) - { - result = new LightBlueprint(adminToy as Light); - } - else - { - throw new NotImplementedException("only primitive and light"); - } - - result.Position = adminToy.Position - center ?? adminToy.Position; - result.Rotation = adminToy.Rotation.eulerAngles; - - return result; - } - - - public string Loadable(char separator) - { - StringBuilder b = new(); - b.Append(AdminToyType.ToString()); - b.Append(separator); - b.Append(Position); - b.Append(separator); - b.Append(Rotation); - b.Append(separator); - b.Append(Scale); - b.Append(separator); - b.Append(Load(separator)); - - - return b.ToString(); - } - public abstract AdminToy Spawn(Vector3 center); - protected abstract string Load(char separator); - } -} diff --git a/KruacentExiled/KE.Utils/API/Models/Blueprints/LightBlueprint.cs b/KruacentExiled/KE.Utils/API/Models/Blueprints/LightBlueprint.cs deleted file mode 100644 index 1dc91294..00000000 --- a/KruacentExiled/KE.Utils/API/Models/Blueprints/LightBlueprint.cs +++ /dev/null @@ -1,37 +0,0 @@ -using Exiled.API.Enums; -using Exiled.API.Features.Toys; -using UnityEngine; -using Light = Exiled.API.Features.Toys.Light; - -namespace KE.Utils.API.Models.Blueprints -{ - public class LightBlueprint : AdminToyBlueprint - { - public Color Color { get; } - public float Intensity { get; } - - public LightBlueprint(Light l) - { - AdminToyType = AdminToyType.PrimitiveObject; - Scale = l.Scale; - Color = l.Color; - Intensity = l.Intensity; - } - - - public override AdminToy Spawn(Vector3 center) - { - var l = Light.Create(Position+center, Rotation, Scale, false); - l.Color = Color; - l.Intensity = Intensity; - - - return l; - } - - protected override string Load(char separator) - { - return "#" + ColorUtility.ToHtmlStringRGBA(Color) + separator + Intensity; - } - } -} diff --git a/KruacentExiled/KE.Utils/API/Models/Blueprints/ModelBlueprint.cs b/KruacentExiled/KE.Utils/API/Models/Blueprints/ModelBlueprint.cs deleted file mode 100644 index 0f3a047c..00000000 --- a/KruacentExiled/KE.Utils/API/Models/Blueprints/ModelBlueprint.cs +++ /dev/null @@ -1,110 +0,0 @@ -using Exiled.API.Features; -using Exiled.API.Features.Core; -using Exiled.API.Features.Doors; -using Exiled.API.Features.Toys; -using Exiled.API.Structs; -using KE.Utils.API.Models.ToysSettings; -using KE.Utils.Quality.Models; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Runtime.InteropServices; -using UnityEngine; -using Light = Exiled.API.Features.Toys.Light; - -namespace KE.Utils.API.Models.Blueprints -{ - public class ModelBlueprint - { - private static List _bps = new(); - public static List Blueprints => _bps.ToList(); - private HashSet _toys = new(); - public IReadOnlyCollection Toys => [.. _toys]; - private string _name; - public string Name - { - get { return _name; } - } - - private ModelBlueprint() { } - - - - /// - /// - /// - /// - /// - public static ModelBlueprint Create(Model model) - { - var oldMbp = Get(model.Name); - _bps.Remove(oldMbp); - - - ModelBlueprint mbp = new(); - mbp._name = model.Name; - _bps.Add(mbp); - - foreach(AdminToy toy in model.Toys) - { - mbp._toys.Add(AdminToyBlueprint.Create(toy,model.Center)); - } - - return mbp; - } - - - public static ModelBlueprint Create(string name,IEnumerable toys = null) - { - ModelBlueprint mbp = new(); - _bps.Add(mbp); - - if (string.IsNullOrEmpty(name)) - { - throw new ArgumentException("name null or empty"); - } - - if(toys != null) - { - foreach(AdminToy at in toys) - { - mbp._toys.Add(AdminToyBlueprint.Create(at)); - } - } - - - - mbp._name = name; - - return mbp; - } - - public void Spawn(Vector3 position) - { - Model m = Model.Create(this, position,false); - - - } - - - #region getters - public static ModelBlueprint Get(string name) - { - foreach (ModelBlueprint m in Blueprints) - { - if (m.Name == name) - { - return m; - } - } - return null; - } - - public static bool TryGet(string name, out ModelBlueprint model) - { - model = Get(name); - return model != null; - } - #endregion - } -} diff --git a/KruacentExiled/KE.Utils/API/Models/Blueprints/PrimitiveBlueprint.cs b/KruacentExiled/KE.Utils/API/Models/Blueprints/PrimitiveBlueprint.cs deleted file mode 100644 index 2e59f30a..00000000 --- a/KruacentExiled/KE.Utils/API/Models/Blueprints/PrimitiveBlueprint.cs +++ /dev/null @@ -1,39 +0,0 @@ -using Exiled.API.Enums; -using Exiled.API.Features.Toys; -using UnityEngine; - -namespace KE.Utils.API.Models.Blueprints -{ - public class PrimitiveBlueprint : AdminToyBlueprint - { - public Color Color { get; } - public PrimitiveType Type { get; } - - - public PrimitiveBlueprint(Primitive p) - { - AdminToyType = AdminToyType.PrimitiveObject; - - Scale = p.Scale; - Color = p.Color; - Type = p.Type; - } - - - - public override AdminToy Spawn(Vector3 center) - { - var p = Primitive.Create(Type,Position+center, Rotation, Scale, false); - p.Collidable = false; - p.Color = Color; - - - return p; - } - - protected override string Load(char separator) - { - return "#" + ColorUtility.ToHtmlStringRGBA(Color) + separator+Type; - } - } -} diff --git a/KruacentExiled/KE.Utils/API/Models/Commands/AllCommands.cs b/KruacentExiled/KE.Utils/API/Models/Commands/AllCommands.cs deleted file mode 100644 index 8ba12e68..00000000 --- a/KruacentExiled/KE.Utils/API/Models/Commands/AllCommands.cs +++ /dev/null @@ -1,33 +0,0 @@ -using CommandSystem; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Reflection; -using System.Text; -using System.Threading.Tasks; - -namespace KE.Utils.API.Models.Commands -{ - public static class AllCommands - { - - public static IEnumerable Get(Assembly assembly = null) - { - return new List() - { - new ChangeColor(), - new ChangePrimType(), - new CreateModel(), - new CreatePrim(), - new ListModel(), - new LoadModel(), - new ModeMovePrim(), - new SelectModel(), - new ShowCenter(), - new SaveModel() - - }; - - } - } -} diff --git a/KruacentExiled/KE.Utils/API/Models/Commands/ChangeColor.cs b/KruacentExiled/KE.Utils/API/Models/Commands/ChangeColor.cs deleted file mode 100644 index 3b78d218..00000000 --- a/KruacentExiled/KE.Utils/API/Models/Commands/ChangeColor.cs +++ /dev/null @@ -1,72 +0,0 @@ -using CommandSystem; -using Exiled.API.Features; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using KE.Utils.API.Models; -using UnityEngine; -using Exiled.API.Features.Toys; - -namespace KE.Utils.API.Models.Commands -{ - public class ChangeColor : ICommand - { - - public string Command { get; } = "changecolor"; - - public string[] Aliases { get; } = { "cc" }; - - public string Description { get; } = "change color rgba (0-255)"; - - public bool Execute(ArraySegment arguments, ICommandSender sender, out string response) - { - Player p = Player.Get(sender); - if (p == null) - { - response = "This player can't do this command"; - return false; - } - - if (arguments.Count < 3) - { - response = "not enough arguments"; - return false; - } - if(!byte.TryParse(arguments.At(0),out byte r) || - !byte.TryParse(arguments.At(1), out byte g) || - !byte.TryParse(arguments.At(2), out byte b)) - { - response = "number between 0 & 255"; - return false; - } - - Color32 c; - - if(arguments.Count > 3 && byte.TryParse(arguments.At(3),out byte a)) - { - c = new Color32(r, g, b, a); - } - else - { - c = new Color32(r, g, b,255); - } - - Primitive prim = Models.Instance.ModelCreator.ModelHandler.SelectedPrimitive; - - if(prim == null) - { - response = "no primitive selected"; - return false; - } - - prim.Color = c; - - - response = $"new color set to " + c.ToString(); - return true; - } - - } -} diff --git a/KruacentExiled/KE.Utils/API/Models/Commands/ChangePrimType.cs b/KruacentExiled/KE.Utils/API/Models/Commands/ChangePrimType.cs deleted file mode 100644 index 434427df..00000000 --- a/KruacentExiled/KE.Utils/API/Models/Commands/ChangePrimType.cs +++ /dev/null @@ -1,53 +0,0 @@ -using CommandSystem; -using Exiled.API.Features; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using KE.Utils.API.Models; -using UnityEngine; - -namespace KE.Utils.API.Models.Commands -{ - public class ChangePrimType : ICommand - { - - public string Command { get; } = "changeprimtype"; - - public string[] Aliases { get; } = { "cpt" }; - - public string Description { get; } = "select the mode : scale,move,rotate"; - - public bool Execute(ArraySegment arguments, ICommandSender sender, out string response) - { - Player p = Player.Get(sender); - if (p == null) - { - response = "This player can't do this command"; - return false; - } - - if (arguments.Count < 1) - { - response = "not enough arguments"; - return false; - } - string type = arguments.At(0); - - - if(!Enum.TryParse(type, out PrimitiveType prim)) - { - response = "wrong argument"; - return false; - } - - - Models.Instance.ModelCreator.ModelHandler.SelectedPrimitive.Type = prim; - - response = $"Mode set to " + prim ; - return true; - } - - } -} diff --git a/KruacentExiled/KE.Utils/API/Models/Commands/CreateModel.cs b/KruacentExiled/KE.Utils/API/Models/Commands/CreateModel.cs deleted file mode 100644 index d549cb50..00000000 --- a/KruacentExiled/KE.Utils/API/Models/Commands/CreateModel.cs +++ /dev/null @@ -1,44 +0,0 @@ -using CommandSystem; -using Exiled.API.Features; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace KE.Utils.API.Models.Commands -{ - public class CreateModel : ICommand - { - - public string Command { get; } = "create"; - - public string[] Aliases { get; } = { "c" }; - - public string Description { get; } = "create a new model at your position"; - - public bool Execute(ArraySegment arguments, ICommandSender sender, out string response) - { - - Player p = Player.Get(sender); - if (p == null) - { - response = "This player can't do this command"; - return false; - } - - if (arguments.Count < 1) - { - response = "not enough arguments"; - return false; - } - string name = arguments.At(0); - - Model m = Model.Create(p.Position, name); - Models.Instance.ModelCreator.ModelHandler.SelectedModel = m; - response = $"Created & selected model ({m.Name}) at {m.Center}"; - return true; - } - - } -} diff --git a/KruacentExiled/KE.Utils/API/Models/Commands/CreatePrim.cs b/KruacentExiled/KE.Utils/API/Models/Commands/CreatePrim.cs deleted file mode 100644 index edcd6306..00000000 --- a/KruacentExiled/KE.Utils/API/Models/Commands/CreatePrim.cs +++ /dev/null @@ -1,47 +0,0 @@ -using CommandSystem; -using Exiled.API.Features; -using Exiled.API.Features.Toys; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace KE.Utils.API.Models.Commands -{ - public class CreatePrim : ICommand - { - - public string Command { get; } = "createprimitive"; - - public string[] Aliases { get; } = { "cp" }; //no not like that - - public string Description { get; } = "create a new primitive at your position"; - - public bool Execute(ArraySegment arguments, ICommandSender sender, out string response) - { - - Player p = Player.Get(sender); - if (p == null) - { - response = "This player can't do this command"; - return false; - } - - - Model m = Models.Instance.ModelCreator.SelectedModel; - - if (m == null) - { - response = "no model selected"; - return false; - } - m.Add(p.Position); - - - response = "created!"; - return true; - } - - } -} diff --git a/KruacentExiled/KE.Utils/API/Models/Commands/ListModel.cs b/KruacentExiled/KE.Utils/API/Models/Commands/ListModel.cs deleted file mode 100644 index 79f42597..00000000 --- a/KruacentExiled/KE.Utils/API/Models/Commands/ListModel.cs +++ /dev/null @@ -1,42 +0,0 @@ -using CommandSystem; -using Exiled.API.Features; -using KE.Utils.API.Models.Blueprints; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace KE.Utils.API.Models.Commands -{ - public class ListModel : ICommand - { - - public string Command { get; } = "list"; - - public string[] Aliases { get; } = { "l" }; - - public string Description { get; } = "create a new model at your position"; - - public bool Execute(ArraySegment arguments, ICommandSender sender, out string response) - { - StringBuilder b = new(); - b.AppendLine($"Models ({Model.Models.Count}) :"); - foreach (Model m in Model.Models) - { - b.AppendLine($"{m.Name} pos: {m.Center} spawned? :{m.Spawned}"); - } - - b.AppendLine($"Blueprints ({ModelBlueprint.Blueprints.Count}) :"); - foreach (ModelBlueprint m in ModelBlueprint.Blueprints) - { - b.AppendLine($"{m.Name}"); - } - - - response = b.ToString(); - return true; - } - - } -} diff --git a/KruacentExiled/KE.Utils/API/Models/Commands/LoadModel.cs b/KruacentExiled/KE.Utils/API/Models/Commands/LoadModel.cs deleted file mode 100644 index 7be25565..00000000 --- a/KruacentExiled/KE.Utils/API/Models/Commands/LoadModel.cs +++ /dev/null @@ -1,65 +0,0 @@ -using CommandSystem; -using Exiled.API.Features; -using KE.Utils.API.Models.Blueprints; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using System.Xml.Linq; - -namespace KE.Utils.API.Models.Commands -{ - public class LoadModel : ICommand - { - - public string Command { get; } = "load"; - - public string[] Aliases { get; } = { "lo" }; - - public string Description { get; } = "load a model from a blueprint"; - - public bool Execute(ArraySegment arguments, ICommandSender sender, out string response) - { - - Player p = Player.Get(sender); - if (p == null) - { - response = "This player can't do this command"; - return false; - } - - if (arguments.Count < 1) - { - response = "not enough arguments"; - return false; - } - - string name = arguments.At(0); - - if (string.IsNullOrEmpty(name)) - { - response = "name null or empty"; - return false; - } - - foreach(ModelBlueprint bp in ModelBlueprint.Blueprints) - { - - Log.Info($"{bp.Name} == {name} : {bp.Name == name}"); - } - - - if(!ModelBlueprint.TryGet(name,out var mbp)) - { - response = "blueprint not found"; - return false; - } - - mbp.Spawn(p.Position); - response = $"Created model ({mbp.Name}) at {p.Position}"; - return true; - } - - } -} diff --git a/KruacentExiled/KE.Utils/API/Models/Commands/ModeMovePrim.cs b/KruacentExiled/KE.Utils/API/Models/Commands/ModeMovePrim.cs deleted file mode 100644 index 2b9ea091..00000000 --- a/KruacentExiled/KE.Utils/API/Models/Commands/ModeMovePrim.cs +++ /dev/null @@ -1,64 +0,0 @@ -using CommandSystem; -using Exiled.API.Features; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using KE.Utils.API.Models; - -namespace KE.Utils.API.Models.Commands -{ - public class ModeMovePrim : ICommand - { - - public string Command { get; } = "mode"; - - public string[] Aliases { get; } = { "m" }; - - public string Description { get; } = "select the mode : scale,move,rotate"; - - public bool Execute(ArraySegment arguments, ICommandSender sender, out string response) - { - Player p = Player.Get(sender); - if (p == null) - { - response = "This player can't do this command"; - return false; - } - - if (arguments.Count < 1) - { - response = "not enough arguments"; - return false; - } - string mode = arguments.At(0); - - switch(mode) - { - case "m": - case "move": - Models.Instance.ModelCreator.MovementMode = MovementMode.Move; - break; - case "s": - case "scale": - Models.Instance.ModelCreator.MovementMode = MovementMode.Scale; - break; - case "r": - case "rotate": - Models.Instance.ModelCreator.MovementMode = MovementMode.Rotate; - break; - default: - response = "wrong argument"; - return false; - - - } - - - response = $"Mode set to " + Models.Instance.ModelCreator.MovementMode.ToString(); - return true; - } - - } -} diff --git a/KruacentExiled/KE.Utils/API/Models/Commands/SaveModel.cs b/KruacentExiled/KE.Utils/API/Models/Commands/SaveModel.cs deleted file mode 100644 index d40048e5..00000000 --- a/KruacentExiled/KE.Utils/API/Models/Commands/SaveModel.cs +++ /dev/null @@ -1,47 +0,0 @@ -using CommandSystem; -using Exiled.API.Features; -using KE.Utils.API.Models.Blueprints; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using System.Xml.Linq; - -namespace KE.Utils.API.Models.Commands -{ - public class SaveModel : ICommand - { - - public string Command { get; } = "save"; - - public string[] Aliases { get; } = { "sa" }; - - public string Description { get; } = "save a model to file"; - - public bool Execute(ArraySegment arguments, ICommandSender sender, out string response) - { - - Player p = Player.Get(sender); - if (p == null) - { - response = "This player can't do this command"; - return false; - } - - - Model model = Models.Instance.ModelCreator.SelectedModel; - if (model == null) - { - response = "no model selected"; - return false; - } - - model.Save(); - - response = $"Saved ({model.Name})"; - return true; - } - - } -} diff --git a/KruacentExiled/KE.Utils/API/Models/Commands/SelectModel.cs b/KruacentExiled/KE.Utils/API/Models/Commands/SelectModel.cs deleted file mode 100644 index 266ce4d4..00000000 --- a/KruacentExiled/KE.Utils/API/Models/Commands/SelectModel.cs +++ /dev/null @@ -1,56 +0,0 @@ -using CommandSystem; -using Exiled.API.Features; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace KE.Utils.API.Models.Commands -{ - public class SelectModel : ICommand - { - - public string Command { get; } = "select"; - - public string[] Aliases { get; } = { "s" }; - - public string Description { get; } = "select an existing model"; - - public bool Execute(ArraySegment arguments, ICommandSender sender, out string response) - { - - Player p = Player.Get(sender); - if (p == null) - { - response = "This player can't do this command"; - return false; - } - if (arguments.Count < 1) - { - response = "not enough arguments"; - return false; - } - string name = arguments.At(0); - - if (string.IsNullOrEmpty(name)) - { - response = "name null or empty"; - return false; - } - - - - - if (!Model.TryGet(name, out Model m)) - { - response = "model not found"; - return false; - } - response = $"model ({m.Name}) selected {m.Center}"; - Models.Instance.ModelCreator.ModelHandler.SelectedModel = m; - return true; - } - - } -} diff --git a/KruacentExiled/KE.Utils/API/Models/Commands/ShowCenter.cs b/KruacentExiled/KE.Utils/API/Models/Commands/ShowCenter.cs deleted file mode 100644 index 7b6cc05e..00000000 --- a/KruacentExiled/KE.Utils/API/Models/Commands/ShowCenter.cs +++ /dev/null @@ -1,51 +0,0 @@ -using CommandSystem; -using Exiled.API.Features; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace KE.Utils.API.Models.Commands -{ - public class ShowCenter : ICommand - { - - public string Command { get; } = "show"; - - public string[] Aliases { get; } = { "sh" }; - - public string Description { get; } = "toggle the center of the model"; - - public bool Execute(ArraySegment arguments, ICommandSender sender, out string response) - { - - Player p = Player.Get(sender); - if (p == null) - { - response = "This player can't do this command"; - return false; - } - - Model m = Models.Instance.ModelCreator.ModelHandler.SelectedModel; - - if(m == null) - { - response = "no model selected"; - return false; - } - - if(!bool.TryParse(arguments.At(0),out bool result)) - { - response = "write true or false"; - return false; - } - - m.SetCenterPrimitive(result); - - response = "done"; - - return true; - } - } -} diff --git a/KruacentExiled/KE.Utils/API/Models/Model.cs b/KruacentExiled/KE.Utils/API/Models/Model.cs deleted file mode 100644 index 6e84fbc9..00000000 --- a/KruacentExiled/KE.Utils/API/Models/Model.cs +++ /dev/null @@ -1,202 +0,0 @@ -using Exiled.API.Features; -using Exiled.API.Features.Toys; -using KE.Utils.API.Models.Blueprints; -using System; -using System.Collections.Generic; -using System.Linq; -using UnityEngine; - -namespace KE.Utils.API.Models -{ - public class Model - { - private static List _models = new(); - public static List Models => _models.ToList(); - - private HashSet _toys = new(); - public IReadOnlyCollection Toys => [.. _toys]; - private string _name; - public string Name - { - get { return _name; } - } - - private Vector3 _center; - public Vector3 Center - { - get { return _center; } - } - private bool _spawned = true; - public bool Spawned - { - get { return _spawned; } - } - - private ModelBlueprint _blueprint; - - public ModelBlueprint Blueprint - { - get { return _blueprint; } - } - - public bool LoadedFromBlueprint - { - get - { - return Blueprint != null; - } - } - - - - - - internal Primitive centerPrim; - - public void SetCenterPrimitive(bool show) - { - if (show) - { - centerPrim.Spawn(); - } - else - { - centerPrim.UnSpawn(); - } - } - - - - public Primitive Add(Vector3 pos) - { - var p = Primitive.Create(pos, null, null, true); - - AddToy(p); - return p; - } - - - protected virtual void AddToy(AdminToy toy,bool editMode = true) - { - if(toy is Primitive p && editMode) - { - p.Collidable = true; - } - - - _toys.Add(toy); - } - - private Model(Vector3 center) - { - _models.Add(this); - _center = center; - } - - public static Model Create(Vector3 position, string name) - { - - Model m = new(position); - if (string.IsNullOrEmpty(name)) - { - throw new ArgumentException("name null or empty"); - } - m._name = name; - - Log.Debug("created model id=" + m.Name); - m.centerPrim = Primitive.Create(position, null, Vector3.one / 5, true, new(1, 0, 0, .25f)); - m.centerPrim.Collidable = false; - - return m; - } - - - public static Model Create(ModelBlueprint blueprint,Vector3 position,bool editMode = false) - { - Model m = new(position); - m._name = blueprint.Name; - - foreach (AdminToyBlueprint toy in blueprint.Toys) - { - Log.Info("create toy "+toy.AdminToyType); - AdminToy trueToy = toy.Spawn(m.Center); - - - m.AddToy(trueToy, editMode); - - } - - return m; - - } - - /// - /// Create a based of this

- /// Note : will overwrite the old blueprint - ///
- public void CreateBlueprint() - { - ModelBlueprint bp = ModelBlueprint.Create(this); - - _blueprint = bp; - - } - - - #region getter - public static Model Get(string name) - { - foreach (Model m in _models) - { - if (m.Name == name) - { - return m; - } - } - return null; - } - - public static bool TryGet(string name, out Model model) - { - model = Get(name); - return model != null; - } - - - public override string ToString() - { - return $"{Name} center = {Center}"; - } - #endregion - - #region spawn - public void Spawn() - { - foreach (AdminToy t in Toys) - { - t.Spawn(); - } - _spawned = true; - } - public void UnSpawn() - { - foreach (AdminToy t in Toys) - { - t.UnSpawn(); - } - _spawned = false; - } - - public void Destroy() - { - foreach (AdminToy t in Toys) - { - t.Destroy(); - } - _models.Remove(this); - - } - - #endregion - } -} diff --git a/KruacentExiled/KE.Utils/API/Models/ModelCreator.cs b/KruacentExiled/KE.Utils/API/Models/ModelCreator.cs deleted file mode 100644 index 85758ad9..00000000 --- a/KruacentExiled/KE.Utils/API/Models/ModelCreator.cs +++ /dev/null @@ -1,175 +0,0 @@ -using AdminToys; -using Exiled.API.Features; -using Exiled.API.Features.Items; -using Exiled.API.Features.Toys; -using Exiled.Events.EventArgs.Player; -using KE.Utils.API.Interfaces; -using KE.Utils.API.Models.Arrows; -using MEC; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Runtime.InteropServices; -using System.Text; -using System.Threading.Tasks; -using UnityEngine; - -namespace KE.Utils.API.Models -{ - public class ModelCreator : IUsingEvents - { - - - public const ItemType item = ItemType.GunCOM18; - - public Model SelectedModel - { - get - { - return ModelHandler.SelectedModel; - } - } - public MovementMode MovementMode - { - get - { - return MovementHandler.Mode; - } - set - { - MovementHandler.Mode = value; - } - } - internal MovementHandler MovementHandler { get; private set; } - internal ModelSelection ModelHandler { get; private set; } - - private bool mode = false; - private const float MAX_DISTANCE = 50; - - public static event Action IsAiming; - public static event Action StoppedAiming; - - - - public ModelCreator() - { - - } - - public void SubscribeEvents() - { - - ModelHandler = new(); - MovementHandler = new(); - - ModelLoader.LoadAll(); - MovementHandler.SubscribeEvents(); - Exiled.Events.Handlers.Player.DryfiringWeapon += OnDryfiringWeapon; - Exiled.Events.Handlers.Player.TogglingWeaponFlashlight += OnTogglingWeaponFlashlight; - Exiled.Events.Handlers.Server.RoundStarted += Test; - Exiled.Events.Handlers.Player.AimingDownSight += OnAimingDownSight; - - } - public void UnsubscribeEvents() - { - Exiled.Events.Handlers.Player.DryfiringWeapon -= OnDryfiringWeapon; - Exiled.Events.Handlers.Player.TogglingWeaponFlashlight -= OnTogglingWeaponFlashlight; - Exiled.Events.Handlers.Player.AimingDownSight -= OnAimingDownSight; - Exiled.Events.Handlers.Server.RoundStarted -= Test; - MovementHandler.UnsubscribeEvents(); - - ModelHandler = null; - MovementHandler = null; - } - - private void Test() - { - foreach (var p in Player.List) - { - p.Role.Set(PlayerRoles.RoleTypeId.ChaosConscript); - Timing.CallDelayed(.1f, () => - { - var a = p.AddItem(item); - var b = a as Firearm; - b.MagazineAmmo = 2; - - Primitive.Create(p.Position + Vector3.back, null, null, true, Color.red); - Primitive.Create(p.Position + Vector3.forward, null, null, true, Color.green); - }); - } - } - - - - - private void OnAimingDownSight(AimingDownSightEventArgs ev) - { - if (ev.AdsIn) - { - IsAiming?.Invoke(ev.Player); - } - else - { - StoppedAiming?.Invoke(); - } - } - - private void OnDryfiringWeapon(DryfiringWeaponEventArgs ev) - { - if (ev.Firearm.Type != item) return; - Log.Info("new mode = " + mode); - - if (!mode) - { - - mode = !mode; - } - - - - } - - private void OnTogglingWeaponFlashlight(TogglingWeaponFlashlightEventArgs ev) - { - if (ev.Firearm.Type != item) return; - - - - Primitive p = GetFacingPrimitive(ev.Player); - if (!Arrow.IsPrimitiveArrow(p)) - { - ModelHandler.ChangedSelectedPrim(p); - } - - } - - internal static Primitive GetFacingPrimitive(Player player) - { - Transform cam = player.CameraTransform; - - Vector3 origin = cam.position + cam.forward * 0.5f; - Ray r = new Ray(origin, cam.forward); - if (Physics.Raycast(r, out RaycastHit hit, MAX_DISTANCE)) - { - Log.Info($"hit ({hit.collider.name})"); - PrimitiveObjectToy pot = hit.collider.GetComponentInParent() ?? hit.collider.GetComponentInChildren(); - if (pot != null) - { - return Primitive.Get(pot); - - - } - } - return null; - } - - - - } - public enum MovementMode - { - Move, - Scale, - Rotate - } -} diff --git a/KruacentExiled/KE.Utils/API/Models/ModelLoader.cs b/KruacentExiled/KE.Utils/API/Models/ModelLoader.cs deleted file mode 100644 index d4c60464..00000000 --- a/KruacentExiled/KE.Utils/API/Models/ModelLoader.cs +++ /dev/null @@ -1,152 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.IO; -using Exiled.API.Features; -using Exiled.API.Features.Toys; -using UnityEngine; -using Light = Exiled.API.Features.Toys.Light; -using Exiled.API.Enums; -using KE.Utils.API.Models.Blueprints; -namespace KE.Utils.API.Models -{ - public static class ModelLoader - { - public static string Path => Paths.Configs + @"\"; - private static readonly char SEPARATOR = '_'; - public static string Extension => ".modelscpsl"; - - - public static IEnumerable LoadAll() - { - List m = new(); - - string[] raw = Directory.GetFiles(Path, "*" + Extension); - - foreach (string d in raw) - { - Log.Info("loading="+d); - ModelBlueprint mbp = Load(string.Empty, d); - if(mbp != null) - { - Log.Info($"loaded {mbp.Name} ({mbp.Toys.Count})"); - m.Add(mbp); - } - - } - - return m; - } - - public static ModelBlueprint Load(string filename) - { - return Load(Path, filename); - } - - public static ModelBlueprint Load(string path,string filename) - { - string[] raw; - try - { - raw = File.ReadAllText(path + filename).Split('\n'); - } - catch(Exception e) - { - Log.Error(e); - return null; - } - - - string[] infoline = raw[0].Split(SEPARATOR); - string name = infoline[0]; - List toys = new(); - - - for (int i = 1; i < raw.Length; i++) - { - string[] line = raw[i].Split(SEPARATOR); - AdminToy toy = null; - AdminToyType type; - if (!Enum.TryParse(line[0], out type)) continue; - - Vector3 ATPos = Parser.Vector3(line[1]); - Vector3 ATRotation = Parser.Vector3(line[2]); - Vector3 ATScale = Parser.Vector3(line[3]); - if(type == AdminToyType.PrimitiveObject) - { - Color color; - ColorUtility.TryParseHtmlString(line[4], out color); - PrimitiveType ptype; - Enum.TryParse(line[5], out ptype); - - - var p = Primitive.Create(ptype, ATPos, ATRotation, ATScale, true, color); - p.Collidable = false; - toy = p; - - } - if(type == AdminToyType.LightSource) - { - Color color; - ColorUtility.TryParseHtmlString(line[4], out color); - - float intensity = float.Parse(line[5]); - var l = Light.Create(ATPos, ATRotation, ATScale, true, color); - l.Intensity = intensity; - toy = l; - } - - if (toy == null) continue; - toys.Add(toy); - - } - - - - - return ModelBlueprint.Create(name, toys); - } - - - // Name\n - // Primitive.Position.RotationEuler.Scale.Color.PrimitiveType\n - // Light.Position.RotationEuler.Scale.Color.Intensity\n - // and repeat - public static bool Save(this ModelBlueprint m) - { - - List result = new(); - - result.Add(m.Name+SEPARATOR); - - foreach(AdminToyBlueprint t in m.Toys) - { - result.Add(t.Loadable(SEPARATOR)); - } - - try - { - File.WriteAllLines(Path + m.Name+ Extension, result); - return true; - } - catch(Exception e) - { - Log.Error(e); - return false; - } - - } - - public static bool Save(this Model model) - { - if (!model.LoadedFromBlueprint) - model.CreateBlueprint(); - - - return Save(model.Blueprint); - } - - - } -} diff --git a/KruacentExiled/KE.Utils/API/Models/Models.cs b/KruacentExiled/KE.Utils/API/Models/Models.cs deleted file mode 100644 index 27fe3cf4..00000000 --- a/KruacentExiled/KE.Utils/API/Models/Models.cs +++ /dev/null @@ -1,47 +0,0 @@ -using KE.Utils.API.Interfaces; -using PlayerRoles.FirstPersonControl.Thirdperson; - -namespace KE.Utils.API.Models -{ - public class Models : IUsingEvents - { - public ModelCreator ModelCreator - { - get; - private set; - } - private static Models _instance; - - - public static Models Instance - { - get - { - if (_instance == null) - _instance = new(); - return _instance; - } - } - - public void DestroyInstance() - { - _instance = null; - } - - private Models() - { - ModelCreator = new(); - } - - - public void SubscribeEvents() - { - ModelCreator.SubscribeEvents(); - } - - public void UnsubscribeEvents() - { - ModelCreator.UnsubscribeEvents(); - } - } -} diff --git a/KruacentExiled/KE.Utils/API/Models/MovementHandler.cs b/KruacentExiled/KE.Utils/API/Models/MovementHandler.cs deleted file mode 100644 index 07e3ee18..00000000 --- a/KruacentExiled/KE.Utils/API/Models/MovementHandler.cs +++ /dev/null @@ -1,208 +0,0 @@ -using Exiled.API.Features; -using Exiled.API.Features.Toys; -using Exiled.Events.EventArgs.Player; -using KE.Utils.API.Interfaces; -using KE.Utils.API.Models.Arrows; -using MEC; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using UnityEngine; - -namespace KE.Utils.API.Models -{ - internal class MovementHandler : IUsingEvents - { - - private MovementMode _mode = MovementMode.Move; - - public MovementMode Mode - { - get - { - return _mode; - } - set - { - OnChangingMode?.Invoke(value); - _mode = value; - } - } - public static event Action OnChangingMode; - - - - //xyz - private Arrow[] _arrows = new Arrow[3]; - private bool _primflag = false; - public readonly static float REFRESH_RATE = Timing.WaitForOneFrame; - - private CoroutineHandle _handle; - private bool _aiming = false; - private void TryCreatePrimitives() - { - if (!_primflag) - { - _arrows[0] = new XArrow(); - _arrows[1] = new YArrow(); - _arrows[2] = new ZArrow(); - _primflag = true; - } - } - - - - - public void SubscribeEvents() - { - ModelCreator.IsAiming += IsAiming; - ModelCreator.StoppedAiming += StoppedAiming; - ModelSelection.OnChangedSelection += OnChangedSelection; - ModelSelection.OnUnSelect += OnUnSelect; - } - - public void UnsubscribeEvents() - { - Timing.KillCoroutines(_handle); - - ModelSelection.OnChangedSelection -= OnChangedSelection; - ModelSelection.OnUnSelect -= OnUnSelect; - } - private void OnUnSelect() - { - foreach (Arrow a in Arrow.List) - { - a.Move(Vector3.zero); - } - } - private void OnChangedSelection(Primitive p) - { - Log.Info("ChangedSelection"); - TryCreatePrimitives(); - foreach (Arrow a in Arrow.List) - { - a.Move(p.Position); - } - - } - - - private void IsAiming(Player p) - { - Log.Info("start aim"); - var prim = ModelCreator.GetFacingPrimitive(p); - if (!Arrow.IsPrimitiveArrow(prim)) return; - - _aiming = true; - _handle = Timing.RunCoroutine(Moving(p,prim)); - } - - private void StoppedAiming() - { - Log.Info("stopped aim"); - _aiming = false; - } - - - - private IEnumerator Moving(Player player,Primitive p) - { - Primitive selected = Models.Instance.ModelCreator.ModelHandler.SelectedPrimitive; - Vector3 pos = selected.Position; - Vector3 targetPos = pos; - Vector3 scale = selected.Scale; - Vector3 tScale = scale; - - - - Vector3 oldEuler = player.CameraTransform.rotation.eulerAngles; - Arrow a = Arrow.GetArrow(p); - List otherArrows = Arrow.List.Where(o => o != a).ToList(); - - Vector3 direction = a.Offset.normalized; - float sensitivity = 0.1f; - float smoothSpeed = 5; - - while (_aiming) - { - Vector3 currentEuler = player.CameraTransform.rotation.eulerAngles; - - float deltaYaw = Mathf.DeltaAngle(oldEuler.y, currentEuler.y); - float deltaPitch = Mathf.DeltaAngle(oldEuler.x, currentEuler.x); - - float movementAmount = 0f; - - if (Mathf.Abs(direction.y) > 0.5f) - { - movementAmount = -deltaPitch * sensitivity; - } - else - { - - Vector3 camRight = player.CameraTransform.right; - - float sign = Mathf.Sign(Vector3.Dot(camRight, direction)); - - movementAmount = deltaYaw * sensitivity * sign; - } - - - - - if(Mode == MovementMode.Move) - { - targetPos += direction.normalized * movementAmount; - pos = Vector3.Lerp(pos, targetPos, Time.deltaTime * smoothSpeed); - p.Position = pos; - selected.Position = pos - a.Offset; - foreach (Arrow arrow in otherArrows) - { - arrow.Move(pos - a.Offset); - } - } - - - - if(Mode == MovementMode.Scale) - { - Vector3 previousParallel = direction.normalized * Vector3.Dot(selected.Scale, direction.normalized); - Vector3 dir = direction.normalized; - - float currentLengthInDir = Vector3.Dot(scale, dir); - - float newLengthInDir = Mathf.Clamp(currentLengthInDir + movementAmount, 0.1f, 10f); - - - Vector3 parallel = dir * newLengthInDir; - Vector3 perpendicular = scale - (dir * currentLengthInDir); - - selected.Scale = parallel + perpendicular; - scale = selected.Scale; - - Vector3 deltaParallel = parallel - previousParallel; - a.Primitive.Position += deltaParallel / 2; - previousParallel = parallel; - } - - - - if(Mode == MovementMode.Rotate) - { - Log.Info("no clue how to do that"); - } - - - - - - oldEuler = currentEuler; - yield return REFRESH_RATE; - } - } - - - - } -} diff --git a/KruacentExiled/KE.Utils/API/Models/SelectedModel.cs b/KruacentExiled/KE.Utils/API/Models/SelectedModel.cs deleted file mode 100644 index 7e502f46..00000000 --- a/KruacentExiled/KE.Utils/API/Models/SelectedModel.cs +++ /dev/null @@ -1,52 +0,0 @@ -using Exiled.API.Features; -using Exiled.API.Features.Toys; -using MEC; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using UnityEngine; - -namespace KE.Utils.API.Models -{ - internal class ModelSelection - { - - - - public Model SelectedModel { get; internal set; } - public Primitive SelectedPrimitive; - - public static event Action OnChangedSelection; - public static event Action OnUnSelect; - - public void ChangedSelectedPrim(Primitive newPrim) - { - if (newPrim == null) return; - - - - Log.Info(SelectedPrimitive == null); - Log.Info(newPrim.GameObject.GetInstanceID() != SelectedPrimitive?.GameObject.GetInstanceID()); - - if (SelectedPrimitive == null || newPrim.GameObject.GetInstanceID() != SelectedPrimitive?.GameObject.GetInstanceID()) - { - Log.Info("selecting"); - OnChangedSelection?.Invoke(newPrim); - SelectedPrimitive = newPrim; - } - else - { - Log.Info("unselecting"); - SelectedPrimitive = null; - OnUnSelect?.Invoke(); - } - - } - - - - - } -} diff --git a/KruacentExiled/KE.Utils/API/Models/ToysSettings/PrimitiveSetting.cs b/KruacentExiled/KE.Utils/API/Models/ToysSettings/PrimitiveSetting.cs deleted file mode 100644 index b3ffe31d..00000000 --- a/KruacentExiled/KE.Utils/API/Models/ToysSettings/PrimitiveSetting.cs +++ /dev/null @@ -1,31 +0,0 @@ -using AdminToys; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using UnityEngine; - -namespace KE.Utils.API.Models.ToysSettings -{ - public class PrimitiveSetting : ToySetting - { - - public PrimitiveType PrimitiveType { get; } - - - public PrimitiveFlags Flags { get; } - - - public Color Color { get; } - - public Vector3 Position { get; } - - - public Vector3 Rotation { get; } - - - public Vector3 Scale { get; } - - } -} diff --git a/KruacentExiled/KE.Utils/API/Models/ToysSettings/ToySetting.cs b/KruacentExiled/KE.Utils/API/Models/ToysSettings/ToySetting.cs deleted file mode 100644 index 8fdc4477..00000000 --- a/KruacentExiled/KE.Utils/API/Models/ToysSettings/ToySetting.cs +++ /dev/null @@ -1,20 +0,0 @@ -using Exiled.API.Features.Toys; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace KE.Utils.API.Models.ToysSettings -{ - public abstract class ToySetting - { - - - - public virtual void Create(AdminToy a) - { - - } - } -} diff --git a/KruacentExiled/KE.Utils/API/OtherUtils.cs b/KruacentExiled/KE.Utils/API/OtherUtils.cs deleted file mode 100644 index ef43b888..00000000 --- a/KruacentExiled/KE.Utils/API/OtherUtils.cs +++ /dev/null @@ -1,18 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using UnityEngine; - -namespace KE.Utils.API -{ - public static class OtherUtils - { - - public static bool IsInCircle(Vector3 pos,Vector3 centerCircle,float radius) - { - return (pos-centerCircle).sqrMagnitude <= Math.Pow(radius, 2); - } - } -} diff --git a/KruacentExiled/KE.Utils/API/Parser.cs b/KruacentExiled/KE.Utils/API/Parser.cs deleted file mode 100644 index a924337f..00000000 --- a/KruacentExiled/KE.Utils/API/Parser.cs +++ /dev/null @@ -1,36 +0,0 @@ -using Exiled.API.Features; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using UnityEngine; - -namespace KE.Utils.API -{ - public static class Parser - { - public static Vector3 Vector3(string s) - { - string[] temp = s.Substring(1, s.Length - 3).Split(','); - - if(!float.TryParse(temp[0],out float x)) - { - return UnityEngine.Vector3.zero; - } - - if (!float.TryParse(temp[1], out float y)) - { - return UnityEngine.Vector3.zero; - } - if (!float.TryParse(temp[1], out float z)) - { - return UnityEngine.Vector3.zero; - } - - - - return new Vector3(x, y, z); - } - } -} diff --git a/KruacentExiled/KE.Utils/API/ReflectionHelper.cs b/KruacentExiled/KE.Utils/API/ReflectionHelper.cs deleted file mode 100644 index d95fa32a..00000000 --- a/KruacentExiled/KE.Utils/API/ReflectionHelper.cs +++ /dev/null @@ -1,47 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Reflection; -using System.Text; -using System.Threading.Tasks; - -namespace KE.Utils.API -{ - public static class ReflectionHelper - { - public static IEnumerable GetObjects(Assembly assembly = null) - { - List result = new(); - if (assembly == null) - { - assembly = Assembly.GetCallingAssembly(); - } - foreach (Type t in assembly.GetTypes()) - { - try - { - if (typeof(T).IsAssignableFrom(t) && !t.IsAbstract) - { - T ffcc = (T)Activator.CreateInstance(t); - result.Add(ffcc); - } - } - catch (Exception) - { - - } - } - return result; - } - - public static IEnumerable GetObjects(IEnumerable assemblies) - { - List result = new(); - foreach (Assembly assembly in assemblies) - { - result.AddRange(GetObjects(assembly)); - } - return result; - } - } -} diff --git a/KruacentExiled/KE.Utils/API/Sounds/SoundPlayer.cs b/KruacentExiled/KE.Utils/API/Sounds/SoundPlayer.cs deleted file mode 100644 index 08090bbd..00000000 --- a/KruacentExiled/KE.Utils/API/Sounds/SoundPlayer.cs +++ /dev/null @@ -1,116 +0,0 @@ -using Exiled.API.Features; -using System; -using System.Collections.Generic; -using System.IO; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using UnityEngine; - -namespace KE.Utils.API.Sounds -{ - public class SoundPlayer - { - private static SoundPlayer _instance; - - public static SoundPlayer Instance - { - get - { - if (_instance == null) - { - _instance = new(); - } - return _instance; - } - } - - private SoundPlayer() { } - - private bool _loaded = false; - public bool Loaded => _loaded; - - public static readonly HashSet clips = new(); - - public static string SoundLocation => Paths.Configs + "/Sounds"; - public static void Load() => Instance.TryLoad(); - public void TryLoad() - { - if (Loaded) - { - return; - } - - if (!Directory.Exists(SoundLocation)) - { - Log.Warn("Directory not found. creating..."); - Directory.CreateDirectory(SoundLocation); - } - - string[] rawfile = Directory.GetFiles(SoundLocation, "*.ogg"); - - foreach (string file in rawfile) - { - string noExFile = Path.GetFileNameWithoutExtension(file); - Log.Info($"loading {file} as {noExFile}"); - clips.Add(noExFile); - AudioClipStorage.LoadClip(file); - } - _loaded = true; - } - - - /// - /// Play a clip at a static point - /// - /// - /// - /// - /// - public AudioClipPlayback Play(string clipName, Vector3 pos, float volume = 50f, float maxDistance = 20f, bool isSpatial = true) - { - if (!Loaded) throw new Exception("clips not loaded use SoundPlayer.Load()"); - Log.Debug($"playing {clipName} at {pos}"); - - var audioPlayer = AudioPlayer.CreateOrGet($"{clipName} ({pos})", onIntialCreation: (p) => - { - GameObject a = new GameObject(); - a.transform.position = pos; - p.transform.parent = a.transform; - Speaker speaker = p.AddSpeaker("main", isSpatial: isSpatial, maxDistance: maxDistance, minDistance: 1f); - speaker.transform.parent = a.transform; - speaker.transform.localPosition = Vector3.zero; - }); - - audioPlayer.AddClip(clipName, volume: volume); - audioPlayer.DestroyWhenAllClipsPlayed = true; - return audioPlayer.AddClip(clipName, volume: volume); - - - } - - /// - /// Play a clip at a - /// - /// - /// - /// - /// - public void Play(string clipName, GameObject objectEmittingSound, float volume = 50f, float maxDistance = 20f, bool isSpatial = true) - { - if (!Loaded) throw new Exception("clips not loaded use SoundPlayer.Instance.Load()"); - Log.Debug($"playing {clipName} at {objectEmittingSound}"); - - var audioPlayer = AudioPlayer.CreateOrGet($"{clipName} ({objectEmittingSound})", onIntialCreation: (p) => - { - - p.transform.parent = objectEmittingSound.transform; - Speaker speaker = p.AddSpeaker("main", isSpatial: isSpatial, maxDistance: maxDistance, minDistance: 1f); - speaker.transform.parent = objectEmittingSound.transform; - speaker.transform.localPosition = Vector3.zero; - }); - audioPlayer.AddClip(clipName, volume: volume); - audioPlayer.DestroyWhenAllClipsPlayed = true; - } - } -} diff --git a/KruacentExiled/KE.Utils/Extensions/AdminToyExtension.cs b/KruacentExiled/KE.Utils/Extensions/AdminToyExtension.cs deleted file mode 100644 index 37c3706d..00000000 --- a/KruacentExiled/KE.Utils/Extensions/AdminToyExtension.cs +++ /dev/null @@ -1,25 +0,0 @@ -using Exiled.API.Features.Toys; -using KE.Utils.Quality; -using KE.Utils.Quality.Enums; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace KE.Utils.Extensions -{ - public static class AdminToyExtension - { - - public static void SetAsPickupAdminToy(this AdminToy toy, bool autoSync = true) - { - QualityHandler.Instance.QualityToysHandler.SetAsPickup(toy); - } - - public static void SetQuality(this AdminToy toy, ModelQuality modelQuality,bool autoSync = true) - { - QualityHandler.Instance.QualityToysHandler.SetQuality(toy, modelQuality); - } - } -} diff --git a/KruacentExiled/KE.Utils/Extensions/NpcExtension.cs b/KruacentExiled/KE.Utils/Extensions/NpcExtension.cs deleted file mode 100644 index 6af07bc5..00000000 --- a/KruacentExiled/KE.Utils/Extensions/NpcExtension.cs +++ /dev/null @@ -1,23 +0,0 @@ -using CentralAuth; -using Exiled.API.Features; -using Mirror; -using PlayerRoles; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace KE.Utils.Extensions -{ - public static class NpcExtension - { - - - public static void Hide(this Npc npc) - { - npc.ReferenceHub.authManager.NetworkSyncedUserId = "ID_Dedicated"; - npc.ReferenceHub.authManager.syncMode = (SyncMode)ClientInstanceMode.DedicatedServer; - } - } -} diff --git a/KruacentExiled/KE.Utils/Extensions/PlayerExtension.cs b/KruacentExiled/KE.Utils/Extensions/PlayerExtension.cs deleted file mode 100644 index b01f98d2..00000000 --- a/KruacentExiled/KE.Utils/Extensions/PlayerExtension.cs +++ /dev/null @@ -1,52 +0,0 @@ -using CustomPlayerEffects; -using Exiled.API.Enums; -using Exiled.API.Features; -using Mirror; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using UnityEngine; - -namespace KE.Utils.Extensions -{ - public static class PlayerExtension - { - public static void SetFakeInvis(this Player p, IEnumerable viewers) - { - Vector3 pos = p.Position; - - try - { - p.ReferenceHub.transform.localPosition = Vector3.zero; - foreach (Player viewer in viewers) - { - Server.SendSpawnMessage.Invoke(null, new object[2] { viewer.NetworkIdentity, viewer.Connection }); - } - - p.ReferenceHub.transform.localPosition = pos; - } - catch (Exception arg) - { - Log.Error(string.Format("{0}: {1}", "SetFakeInvis", arg)); - } - } - - - - - public static void AddLevelEffect(this Player p,EffectType type, int intensity) - { - - - if (!p.TryGetEffect(type, out var effect)) - p.ChangeEffectIntensity(type, (byte)(effect.Intensity + intensity)); - else - p.EnableEffect(type, (byte)intensity); - } - - - - } -} diff --git a/KruacentExiled/KE.Utils/Extensions/RoomExtensions.cs b/KruacentExiled/KE.Utils/Extensions/RoomExtensions.cs deleted file mode 100644 index 61fd0291..00000000 --- a/KruacentExiled/KE.Utils/Extensions/RoomExtensions.cs +++ /dev/null @@ -1,55 +0,0 @@ -using Exiled.API.Features; -using Exiled.API.Enums; -using Discord; -using System.Linq; -using Exiled.API.Extensions; - -namespace KE.Utils.Extensions -{ - public static class RoomExtensions - { - - - public static Room RandomSafeRoom(this ZoneType zone) - { - return Room.List.Where(r => r.IsSafe() && r.Zone == zone).GetRandomValue(); - } - - - /// - /// Check if a is Safe (Decontamination,Warhead) - /// - /// Note: Does NOT check if the is safe to teleport in (ex : TestRoom) - /// - /// - /// return true if the is safe for a ; false otherwise - public static bool IsSafe(this Room room) - { - return room.Zone.IsSafe(); - } - - - /// - /// Check if a is Safe (Decontamination,Warhead) - /// - /// return true if the zone is safe for a ; false otherwise - public static bool IsSafe(this ZoneType zone) - { - bool result = true; - if (zone == ZoneType.LightContainment) - result = Map.DecontaminationState < DecontaminationState.Countdown; - switch (zone) - { - case ZoneType.LightContainment: - case ZoneType.HeavyContainment: - case ZoneType.Entrance: - result = !Warhead.IsDetonated; - break; - } - return result; - } - - - - } -} diff --git a/KruacentExiled/KE.Utils/KE.Utils.csproj b/KruacentExiled/KE.Utils/KE.Utils.csproj deleted file mode 100644 index 8e8ecea1..00000000 --- a/KruacentExiled/KE.Utils/KE.Utils.csproj +++ /dev/null @@ -1,38 +0,0 @@ - - - - 13.0 - net48 - - - - - - - - - - - - - - - - - - - - - - - - - - if not "$(EXILED_DEV_REFERENCES)"=="" copy /y "$(OutputPath)$(AssemblyName).dll" "$(EXILED_DEV_REFERENCES)\Plugins\" - - - if [[ ! -z "$EXILED_DEV_REFERENCES" ]]; then cp "$(OutputPath)$(AssemblyName).dll" "$EXILED_DEV_REFERENCES/Plugins/"; fi - - - - diff --git a/KruacentExiled/KE.Utils/Quality/Enums/ModelQuality.cs b/KruacentExiled/KE.Utils/Quality/Enums/ModelQuality.cs deleted file mode 100644 index d9d8d295..00000000 --- a/KruacentExiled/KE.Utils/Quality/Enums/ModelQuality.cs +++ /dev/null @@ -1,16 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace KE.Utils.Quality.Enums -{ - public enum ModelQuality - { - None = -1, - Low, - Medium, - High, - } -} diff --git a/KruacentExiled/KE.Utils/Quality/Handlers/QualityToysHandler.cs b/KruacentExiled/KE.Utils/Quality/Handlers/QualityToysHandler.cs deleted file mode 100644 index b2485795..00000000 --- a/KruacentExiled/KE.Utils/Quality/Handlers/QualityToysHandler.cs +++ /dev/null @@ -1,179 +0,0 @@ -using AdminToys; -using Exiled.API.Enums; -using Exiled.API.Extensions; -using Exiled.API.Features; -using Exiled.API.Features.Toys; -using KE.Utils.Quality.Enums; -using KE.Utils.Quality.Settings; -using MEC; -using System; -using System.Collections.Generic; -using System.Linq; -using UnityEngine; -using Light = Exiled.API.Features.Toys.Light; -using QualitySettings = KE.Utils.Quality.Settings.QualitySettings; - -namespace KE.Utils.Quality.Handlers -{ - public class QualityToysHandler - { - private HashSet _pickupToys = new(); - private Dictionary _qualityToys = new(); - public readonly Vector3 Gulag = new Vector3(15000, 15000, 15000); - public const float Delay = Timing.WaitForOneFrame; - public bool IsPickupToy(AdminToy primitive) - { - return _pickupToys.Contains(primitive); - } - - public bool IsQualityToy(AdminToy primitive) - { - return _qualityToys.ContainsKey(primitive); - } - - - public void SetAsPickup(AdminToy toy, bool autoSync = true) - { - if (!_pickupToys.Add(toy)) - { - Log.Warn($"AdminToy {toy} is already a pickupToy"); - return; - } - if (autoSync) - Sync(toy); - } - - public void SetQuality(AdminToy toy, ModelQuality quality, bool autoSync = true) - { - if (toy == null) return; - if (!_qualityToys.ContainsKey(toy)) - _qualityToys.Add(toy, quality); - else - _qualityToys[toy] = quality; - - if (autoSync) - Sync(toy); - } - - - - private void SendToFakePosition(AdminToy adminToy, Player player,Vector3 position) - { - //idk why but without delay it show all of the quality at once - Timing.CallDelayed(Delay, () => - { - if (adminToy is Light l) - { - player.SendFakeSyncVar(l.Base.netIdentity, typeof(LightSourceToy), nameof(LightSourceToy.NetworkPosition), position); - return; - } - if (adminToy is Primitive p) - { - player.SendFakeSyncVar(p.Base.netIdentity, typeof(PrimitiveObjectToy), nameof(PrimitiveObjectToy.NetworkPosition), position); - return; - } - }); - - } - - /// - /// Sync every Players - /// - public void Sync() - { - foreach (Player p in Player.List) - { - Sync(p); - } - } - - /// - /// Sync a specified Player - /// - /// - public void Sync(Player p) - { - - - - var quality = QualitySettings.Get(p); - var pickup = QualitySettings.PickmodelActivated(p); - - HashSet pickupToRemove = []; - HashSet qualityToRemove = []; - - //hide pickup toys - - foreach (AdminToy pk in _pickupToys) - { - try - { - if (pickup) - { - SendToFakePosition(pk, p, pk.Position); - } - else - { - SendToFakePosition(pk, p, Gulag); - } - } - catch (NullReferenceException) - { - //Log.Warn("removing pickup"); - pickupToRemove.Add(pk); - } - - } - - _pickupToys.RemoveWhere(p => pickupToRemove.Contains(p)); - - - foreach (var at in _qualityToys) - { - try - { - if ((at.Value == quality || at.Value == ModelQuality.None) && (pickup || !_pickupToys.Contains(at.Key))) - { - SendToFakePosition(at.Key, p, at.Key.Position); - } - else - { - SendToFakePosition(at.Key, p, Gulag); - } - } - catch (NullReferenceException) - { - //Log.Warn("removing quality" + _qualityToys.Count); - qualityToRemove.Add(at.Key); - } - - - } - foreach(var at in qualityToRemove) - { - - _qualityToys.Remove(at); - } - - } - - /// - /// Sync a specified AdminToy - /// - /// - public void Sync(AdminToy adminToy) - { - //temporary fix - Sync(); - - if (IsPickupToy(adminToy)) - { - - } - if (IsQualityToy(adminToy)) - { - - } - } - } -} diff --git a/KruacentExiled/KE.Utils/Quality/Models/Base/BaseModel.cs b/KruacentExiled/KE.Utils/Quality/Models/Base/BaseModel.cs deleted file mode 100644 index c9f6723c..00000000 --- a/KruacentExiled/KE.Utils/Quality/Models/Base/BaseModel.cs +++ /dev/null @@ -1,41 +0,0 @@ -using Exiled.API.Enums; -using Exiled.API.Extensions; -using Exiled.API.Features.Toys; -using Exiled.API.Interfaces; -using KE.Utils.Quality.Structs; -using PlayerStatsSystem; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using UnityEngine; -using Light = Exiled.API.Features.Toys.Light; - -namespace KE.Utils.Quality.Models.Base -{ - - /// - /// The blocks to build a model with - /// - public abstract class BaseModel : ICloneable - { - - protected AdminToy _toy; - public AdminToy AdminToy { get { return _toy; } } - private Vector3 _position; - public Vector3 LocalPosition { get { return _position; } } - private Quaternion _rotation; - public Quaternion LocalRotation { get { return _rotation; } } - - - public BaseModel(Vector3 localPositon, Quaternion localRotation) - { - _position = localPositon; - _rotation = localRotation; - } - - public abstract object Clone(); - } - -} diff --git a/KruacentExiled/KE.Utils/Quality/Models/Base/LightModel.cs b/KruacentExiled/KE.Utils/Quality/Models/Base/LightModel.cs deleted file mode 100644 index ce808da1..00000000 --- a/KruacentExiled/KE.Utils/Quality/Models/Base/LightModel.cs +++ /dev/null @@ -1,26 +0,0 @@ -using Exiled.API.Features.Toys; -using UnityEngine; -using Light = Exiled.API.Features.Toys.Light; - -namespace KE.Utils.Quality.Models.Base -{ - public class LightModel : BaseModel - { - - /// - /// Create a new Light for modeling - /// - public LightModel(Vector3? scale, Color? color, Vector3 localPositon, Quaternion localRotation) : base(localPositon, localRotation) - { - Light light = Light.Create(null, null, scale, false, color); - _toy = light; - } - - - public override object Clone() - { - Light light = _toy as Light; - return new LightModel(light.Scale, light.Color, LocalPosition, LocalRotation); - } - } -} diff --git a/KruacentExiled/KE.Utils/Quality/Models/Base/PrimitiveModel.cs b/KruacentExiled/KE.Utils/Quality/Models/Base/PrimitiveModel.cs deleted file mode 100644 index 22e07225..00000000 --- a/KruacentExiled/KE.Utils/Quality/Models/Base/PrimitiveModel.cs +++ /dev/null @@ -1,26 +0,0 @@ -using Exiled.API.Features.Toys; -using UnityEngine; -using Color = UnityEngine.Color; - -namespace KE.Utils.Quality.Models.Base -{ - public class PrimitiveModel : BaseModel - { - /// - /// Create a new Primitive for modeling - /// - public PrimitiveModel(PrimitiveType type, Vector3? scale, Color? color,Vector3 localPosition,Quaternion localRotation) : base(localPosition, localRotation) - { - - Primitive prim = Primitive.Create(type, null, null, scale, false, color); - prim.Collidable = false; - _toy = prim; - } - - public override object Clone() - { - Primitive prim = _toy as Primitive; - return new PrimitiveModel(prim.Type, prim.Scale, prim.Color, LocalPosition, LocalRotation); - } - } -} diff --git a/KruacentExiled/KE.Utils/Quality/Models/Examples/MineModel.cs b/KruacentExiled/KE.Utils/Quality/Models/Examples/MineModel.cs deleted file mode 100644 index 00d60fec..00000000 --- a/KruacentExiled/KE.Utils/Quality/Models/Examples/MineModel.cs +++ /dev/null @@ -1,118 +0,0 @@ -using KE.Utils.Quality.Enums; -using KE.Utils.Quality.Models.Base; -using System.Collections.Generic; -using UnityEngine; -using Light = Exiled.API.Features.Toys.Light; - -namespace KE.Utils.Quality.Models.Examples -{ - public abstract class MineModel : QualityModel - { - protected Light _light; - private bool _lightOn = false; - - - - - public void ToggleLight() - { - if (_light == null) throw new System.Exception("no light"); - if (_lightOn) - _light.UnSpawn(); - else - _light.Spawn(); - _lightOn = !_lightOn; - } - - } - - public class MineModelLow : MineModel - { - public override bool IsPickup => false; - public override ModelQuality Quality => ModelQuality.Low; - - protected override IEnumerable GetBaseModels() - { - Quaternion baseRotation = new(); - //spawn + offset - Vector3 offset = new Vector3(0, .05f); - Vector3 sizeDisk = new Vector3(.7f, 0.1f, .7f); - - Vector3 sizeGlobe = new Vector3(.1f, .1f, .1f); - Vector3 posLight = new Vector3(0, sizeDisk.y+sizeGlobe.y); - - - var baseMine = new PrimitiveModel(PrimitiveType.Cylinder, sizeDisk, Color.black, offset, baseRotation); - - var lightGlobe = new PrimitiveModel(PrimitiveType.Sphere, sizeGlobe , new Color(1, 0, 0, .33f), posLight, baseRotation); - - var lightMine = new LightModel(null, Color.red, posLight, baseRotation); - - _light = lightMine.AdminToy as Light; - _light.Intensity = .55f; - - return [baseMine, lightGlobe, lightMine]; - } - - - } - - public class MineModelMedium : MineModel - { - public override bool IsPickup => false; - public override ModelQuality Quality => ModelQuality.Medium; - - protected override IEnumerable GetBaseModels() - { - Quaternion baseRotation = new(); - //spawn + offset - Vector3 offset = new Vector3(0, .05f); - Vector3 sizeDisk = new Vector3(.7f, 0.1f, .7f); - - Vector3 sizeGlobe = new Vector3(.1f, .1f, .1f); - Vector3 posLight = new Vector3(0, sizeDisk.y + sizeGlobe.y); - - - var baseMine = new PrimitiveModel(PrimitiveType.Cylinder, sizeDisk, Color.black, offset, baseRotation); - - var lightGlobe = new PrimitiveModel(PrimitiveType.Sphere, sizeGlobe, new Color(1, 0, 0, .33f), posLight, baseRotation); - - var lightMine = new LightModel(null, Color.green, posLight, baseRotation); - - _light = lightMine.AdminToy as Light; - _light.Intensity = .55f; - - return [baseMine, lightGlobe, lightMine]; - } - } - - public class MineModelPickup : MineModel - { - public override bool IsPickup => true; - public override ModelQuality Quality => ModelQuality.None; - - - protected override IEnumerable GetBaseModels() - { - Quaternion baseRotation = new(); - //spawn + offset - Vector3 offset = new Vector3(0, .05f); - Vector3 sizeDisk = new Vector3(.7f, 0.1f, .7f); - - Vector3 sizeGlobe = new Vector3(.1f, .1f, .1f); - Vector3 posLight = new Vector3(0, sizeDisk.y + sizeGlobe.y); - - - var baseMine = new PrimitiveModel(PrimitiveType.Cylinder, sizeDisk, Color.black, offset, baseRotation); - - var lightGlobe = new PrimitiveModel(PrimitiveType.Sphere, sizeGlobe, new Color(1, 0, 0, .33f), posLight, baseRotation); - - var lightMine = new LightModel(null, Color.magenta, posLight, baseRotation); - - _light = lightMine.AdminToy as Light; - _light.Intensity = .55f; - - return [baseMine, lightGlobe, lightMine]; - } - } -} diff --git a/KruacentExiled/KE.Utils/Quality/Models/Model.cs b/KruacentExiled/KE.Utils/Quality/Models/Model.cs deleted file mode 100644 index 2e26756e..00000000 --- a/KruacentExiled/KE.Utils/Quality/Models/Model.cs +++ /dev/null @@ -1,104 +0,0 @@ -using Exiled.API.Features; -using Exiled.API.Features.Toys; -using KE.Utils.Quality.Models.Base; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using UnityEngine; - -namespace KE.Utils.Quality.Models -{ - public class Model : IEquatable - { - - - private Vector3 _position; - public Vector3 Position - { - get { return _position; } - set - { - _position = value; - } - } - private Quaternion _rotation; - public Quaternion Rotation - { - get { return _rotation; } - set - { - _rotation = value; - } - } - private ModelPrefab _prefab; - public ModelPrefab Prefab - { - get { return _prefab; } - } - - - - private HashSet _models; - - internal Model(ModelPrefab prefab, Vector3 position, Quaternion rotation,IEnumerable toys,bool spawn) - { - _prefab = prefab; - Position = position; - Rotation = rotation; - _models = new HashSet(toys); - QualityHandler.Instance.QualityToysHandler.Sync(); - - foreach (BaseModel based in toys) - { - AdminToy toy = based.AdminToy; - - if (toy is Primitive p) - p.Collidable = false; - toy.AdminToyBase.transform.position = based.LocalPosition + Position; - toy.AdminToyBase.transform.rotation = based.LocalRotation * Rotation; - } - if(spawn) - { - Spawn(); - } - } - - - public void Destroy() - { - foreach (BaseModel primitive in _models) - { - primitive.AdminToy.Destroy(); - } - } - public void UnSpawn() - { - foreach (BaseModel primitive in _models) - { - primitive.AdminToy.UnSpawn(); - } - } - public void Spawn() - { - QualityHandler.Instance.QualityToysHandler.Sync(); - foreach (BaseModel primitive in _models) - { - primitive.AdminToy.Spawn(); - } - - } - - - public bool Equals(Model x) - { - if (x == null) return false; - return x._prefab == _prefab && x.Position == Position && x.Rotation == Rotation; - } - public int GetHashCode(Model obj) - { - return obj.GetHashCode(); - } - } -} diff --git a/KruacentExiled/KE.Utils/Quality/Models/ModelPrefab.cs b/KruacentExiled/KE.Utils/Quality/Models/ModelPrefab.cs deleted file mode 100644 index bbc39da4..00000000 --- a/KruacentExiled/KE.Utils/Quality/Models/ModelPrefab.cs +++ /dev/null @@ -1,42 +0,0 @@ -using Exiled.API.Features; -using Exiled.API.Features.Core; -using Exiled.API.Features.Pickups; -using Exiled.API.Features.Toys; -using Exiled.API.Interfaces; -using KE.Utils.Extensions; -using KE.Utils.Quality.Models.Base; -using KE.Utils.Quality.Structs; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using UnityEngine; -using Light = Exiled.API.Features.Toys.Light; - -namespace KE.Utils.Quality.Models -{ - public abstract class ModelPrefab - { - - protected abstract IEnumerable GetBaseModels(); - - public virtual Model Create(Vector3 position,Quaternion rotation, bool spawn = true) - { - - HashSet clonetoys = new(); - HashSet toys = GetBaseModels().ToHashSet(); - foreach (BaseModel model in toys) - { - BaseModel clone = (BaseModel)model.Clone(); - clonetoys.Add(clone); - } - return new Model(this, position, rotation, clonetoys,spawn); - - } - - - - - } -} diff --git a/KruacentExiled/KE.Utils/Quality/Models/QualityModel.cs b/KruacentExiled/KE.Utils/Quality/Models/QualityModel.cs deleted file mode 100644 index b5cc682f..00000000 --- a/KruacentExiled/KE.Utils/Quality/Models/QualityModel.cs +++ /dev/null @@ -1,40 +0,0 @@ -using Exiled.API.Features; -using Exiled.API.Features.Toys; -using KE.Utils.Extensions; -using KE.Utils.Quality.Enums; -using KE.Utils.Quality.Models.Base; -using System.Collections.Generic; -using System.Linq; -using UnityEngine; - -namespace KE.Utils.Quality.Models -{ - public abstract class QualityModel : ModelPrefab - { - public abstract ModelQuality Quality { get; } - public abstract bool IsPickup { get; } - - - - - public override sealed Model Create(Vector3 position, Quaternion rotation,bool spawn = true) - { - - HashSet clonetoys = new(); - HashSet toys = GetBaseModels().ToHashSet(); - foreach (BaseModel model in toys) - { - BaseModel clone = (BaseModel)model.Clone(); - - if (IsPickup) - clone.AdminToy.SetAsPickupAdminToy(false); - - clone.AdminToy.SetQuality(Quality,false); - clonetoys.Add(clone); - } - QualityHandler.Sync(); - return new Model(this,position, rotation, clonetoys, spawn); - } - - } -} diff --git a/KruacentExiled/KE.Utils/Quality/QualityHandler.cs b/KruacentExiled/KE.Utils/Quality/QualityHandler.cs deleted file mode 100644 index 235d79c9..00000000 --- a/KruacentExiled/KE.Utils/Quality/QualityHandler.cs +++ /dev/null @@ -1,61 +0,0 @@ -using Exiled.API.Features; -using Exiled.API.Features.Core.UserSettings; -using KE.Utils.Quality.Handlers; -using KE.Utils.Quality.Settings; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace KE.Utils.Quality -{ - [Obsolete("scrapped", false)] - internal class QualityHandler - { - public QualitySettings QualitySettings { get; private set; } - public QualityToysHandler QualityToysHandler { get; private set; } - - private static QualityHandler _instance; - public static QualityHandler Instance - { - get - { - if(_instance == null ) - _instance = new QualityHandler(); - return _instance; - } - } - private QualityHandler() - { - QualitySettings = new QualitySettings(Changed); - QualityToysHandler = new QualityToysHandler(); - } - - ~QualityHandler() - { - QualityToysHandler = null; - QualitySettings = null; - } - - public void Changed(Player p, SettingBase _) - { - QualityToysHandler.Sync(p); - } - - public void Register() - { - QualitySettings.Register(); - } - - public void Unregister() - { - QualitySettings.Unregister(); - } - - public static void Sync() - { - Instance.QualityToysHandler.Sync(); - } - } -} diff --git a/KruacentExiled/KE.Utils/Quality/QualityToysHandler.cs b/KruacentExiled/KE.Utils/Quality/QualityToysHandler.cs deleted file mode 100644 index 27320233..00000000 --- a/KruacentExiled/KE.Utils/Quality/QualityToysHandler.cs +++ /dev/null @@ -1,155 +0,0 @@ -using AdminToys; -using Exiled.API.Enums; -using Exiled.API.Extensions; -using Exiled.API.Features; -using Exiled.API.Features.Toys; -using KE.Utils.Quality.Enums; -using KE.Utils.Quality.Settings; -using System.Collections.Generic; -using System.Linq; -using UnityEngine; -using Light = Exiled.API.Features.Toys.Light; -using QualitySettings = KE.Utils.Quality.Settings.QualitySettings; - -namespace KE.Utils.Quality -{ - public class QualityToysHandler - { - private HashSet _pickupToys = new(); - private Dictionary _qualityToys = new(); - public readonly Vector3 Gulag = new Vector3(15000,15000,15000); - - public bool IsPickupToy(AdminToy primitive) - { - return _pickupToys.Contains(primitive); - } - - public bool IsQualityToy(AdminToy primitive) - { - return _qualityToys.ContainsKey(primitive); - } - - - public void SetAsPickup(AdminToy toy) - { - if (!_pickupToys.Add(toy)) - { - Log.Warn($"AdminToy {toy} is already a pickupToy"); - return; - } - } - - public void SetQuality(AdminToy toy,ModelQuality quality) - { - if (toy == null) return; - if (!_qualityToys.ContainsKey(toy)) - _qualityToys.Add(toy,quality); - else - _qualityToys[toy] = quality; - } - - - - private void SendToShadowRealm(AdminToy adminToy, Player player) - { - if(adminToy is Light l) - { - player.SendFakeSyncVar(l.Base.netIdentity, typeof(LightSourceToy), nameof(LightSourceToy.NetworkPosition), Gulag); - return; - } - if(adminToy is Primitive p) - { - player.SendFakeSyncVar(p.Base.netIdentity, typeof(PrimitiveObjectToy), nameof(PrimitiveObjectToy.NetworkPosition), Gulag); - return; - } - } - - private void SetTruePosition(AdminToy adminToy, Player player) - { - if (adminToy is Light l) - { - player.SendFakeSyncVar(l.Base.netIdentity, typeof(LightSourceToy), nameof(LightSourceToy.NetworkPosition), l.Position); - return; - } - if (adminToy is Primitive p) - { - player.SendFakeSyncVar(p.Base.netIdentity, typeof(PrimitiveObjectToy), nameof(PrimitiveObjectToy.NetworkPosition), p.Position); - return; - } - } - - /// - /// Sync every Players - /// - public void Sync() - { - foreach(Player p in Player.List) - { - Sync(p); - } - } - - /// - /// Sync a specified Player - /// - /// - public void Sync(Player p) - { - var quality = QualitySettings.Get(p); - var pickup = QualitySettings.PickmodelActivated(p); - - if (!pickup) - { - //hide pickup toys - foreach (AdminToy pk in _pickupToys) - { - SendToShadowRealm(pk, p); - } - } - else - { - //show pickup toys - foreach (AdminToy pk in _pickupToys) - { - SetTruePosition(pk, p); - } - } - - - - - foreach(var at in _qualityToys) - { - if(at.Value == quality) - { - if (pickup || !_pickupToys.Contains(at.Key)) - { - SetTruePosition(at.Key, p); - } - } - else - { - SendToShadowRealm(at.Key, p); - } - - } - - } - - /// - /// Sync a specified AdminToy - /// - /// - public void Sync(AdminToy adminToy) - { - if (IsPickupToy(adminToy)) - { - - } - if (IsQualityToy(adminToy)) - { - - } - } - } -} diff --git a/KruacentExiled/KE.Utils/Quality/Settings/QualitySettings.cs b/KruacentExiled/KE.Utils/Quality/Settings/QualitySettings.cs deleted file mode 100644 index ca8d49be..00000000 --- a/KruacentExiled/KE.Utils/Quality/Settings/QualitySettings.cs +++ /dev/null @@ -1,62 +0,0 @@ -using Exiled.API.Features; -using Exiled.API.Features.Core.UserSettings; -using KE.Utils.Quality.Enums; -using System; - -namespace KE.Utils.Quality.Settings -{ - public class QualitySettings - { - - private static int _idQuality = 0; - private static int _idModels = 1; - private static int _idSlider = 2; - private SettingBase[] _settings; - public QualitySettings(Action onChanged) - { - HeaderSetting header = new("Quality Settings"); - _settings = - [ - header, - new DropdownSetting(_idQuality,"ModelQuality",["Low","Medium", "High"],onChanged:onChanged), - new TwoButtonsSetting(_idModels,"Pickup models","Disabled","Enabled", onChanged:onChanged) - ]; - } - - public void Register() - { - SettingBase.Register(_settings); - SettingBase.SendToAll(); - } - - public void Unregister() - { - SettingBase.Unregister(settings:_settings); - } - - - - - public static ModelQuality Get(Player p) - { - if (!SettingBase.TryGetSetting(p, _idQuality, out var setting)) return ModelQuality.None; - - return setting.SelectedOption switch - { - "Low" => ModelQuality.Low, - "Medium" => ModelQuality.Medium, - "High" => ModelQuality.High, - _ => ModelQuality.None, - }; - } - - - public static bool PickmodelActivated(Player p) - { - if (!SettingBase.TryGetSetting(p, _idModels, out var setting)) return false; - return setting.IsSecond; - } - - - } -} diff --git a/KruacentExiled/KE.Utils/Quality/Structs/LocalWorldSpace.cs b/KruacentExiled/KE.Utils/Quality/Structs/LocalWorldSpace.cs deleted file mode 100644 index d9c6205b..00000000 --- a/KruacentExiled/KE.Utils/Quality/Structs/LocalWorldSpace.cs +++ /dev/null @@ -1,23 +0,0 @@ -using Exiled.API.Interfaces; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using UnityEngine; - -namespace KE.Utils.Quality.Structs -{ - public readonly struct LocalWorldSpace : IWorldSpace - { - - public Vector3 Position { get; } - public Quaternion Rotation { get; } - - public LocalWorldSpace(Vector3 position, Quaternion rotation) - { - Position = position; - Rotation = rotation; - } - } -} diff --git a/KruacentExiled/KE.Utils/Quality/Tests/Test.cs b/KruacentExiled/KE.Utils/Quality/Tests/Test.cs deleted file mode 100644 index 6ebd3f66..00000000 --- a/KruacentExiled/KE.Utils/Quality/Tests/Test.cs +++ /dev/null @@ -1,108 +0,0 @@ -using Exiled.API.Extensions; -using Exiled.API.Features; -using Exiled.API.Features.Toys; -using KE.Utils.Quality.Models; -using KE.Utils.Quality.Models.Examples; -using MEC; -using PlayerRoles; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using UnityEngine; - -namespace KE.Utils.Quality.Tests -{ - public class Test - { - private QualityHandler QualityHandler; - - - private Test(QualityHandler q) - { - QualityHandler = q; - try - { - TestMine(); - } - catch (Exception ex) - { - Log.Error("Exception for TestMine :\n"+ex); - } - - } - internal void TestQuality() - { - Vector3 pos = RoleTypeId.Scp049.GetRandomSpawnLocation().Position; - Primitive c = Primitive.Create(pos); - c.Color = Color.red; - Primitive c2 = Primitive.Create(pos + Vector3.one); - c2.Color = Color.green; - - - QualityHandler.QualityToysHandler.SetQuality(c, Enums.ModelQuality.Low); - QualityHandler.QualityToysHandler.SetQuality(c2, Enums.ModelQuality.Medium); - } - - internal void StressTest(int count) - { - Timing.RunCoroutine(Stress(count)); - } - - - private IEnumerator Stress(int count) - { - Vector3 pos = RoleTypeId.Scp049.GetRandomSpawnLocation().Position; - Vector3 scale = new Vector3(.1f, .1f, .1f); - float maxSpread = 5; - for (int i = 0; i < count; i++) - { - Primitive c = Primitive.Create(pos + new Vector3(UnityEngine.Random.Range(0f, maxSpread), UnityEngine.Random.Range(0f, maxSpread), UnityEngine.Random.Range(0f, maxSpread)), scale: scale); - QualityHandler.QualityToysHandler.SetQuality(c, Enums.ModelQuality.Medium); - } - QualityHandler.QualityToysHandler.Sync(); - yield return 0; - } - - public void TestMine() - { - Log.Info("TestMine"); - Vector3 pos = RoleTypeId.Scp049.GetRandomSpawnLocation().Position; - MineModelLow mml = new(); - - - Model m = mml.Create(pos, new Quaternion()); - m.Spawn(); - - - MineModelMedium mmm = new(); - - m = mmm.Create(pos + Vector3.up, new Quaternion()); - m.Spawn(); - - - MineModelPickup mmp = new(); - m = mmp.Create(pos + Vector3.right, new Quaternion()); - m.Spawn(); - - QualityHandler.Sync(); - - - - - - - - - foreach (var item in Player.List) - { - item.Teleport(pos); - } - - - - - } - } -} From 220a1c7ef549ed9d91574af218c93d2f7c54da2c Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Fri, 10 Apr 2026 12:46:52 +0200 Subject: [PATCH 834/853] disabled convert --- KruacentExiled/KE.CustomRoles/Abilities/Convert.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/KruacentExiled/KE.CustomRoles/Abilities/Convert.cs b/KruacentExiled/KE.CustomRoles/Abilities/Convert.cs index 70779cc4..84cea815 100644 --- a/KruacentExiled/KE.CustomRoles/Abilities/Convert.cs +++ b/KruacentExiled/KE.CustomRoles/Abilities/Convert.cs @@ -1,4 +1,4 @@ -using DrawableLine; +/*using DrawableLine; using Exiled.API.Features; using Exiled.API.Features.Attributes; using Exiled.API.Features.Toys; @@ -102,3 +102,4 @@ protected override bool AbilityUsed(Player player) } } +*/ \ No newline at end of file From 37ee4c4babc3523cc13a6f32a3e315705b50cd33 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Fri, 10 Apr 2026 12:47:43 +0200 Subject: [PATCH 835/853] remove serial --- KruacentExiled/KE.CustomRoles/Abilities/Explode.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/KruacentExiled/KE.CustomRoles/Abilities/Explode.cs b/KruacentExiled/KE.CustomRoles/Abilities/Explode.cs index 2564dcf7..a0df3680 100644 --- a/KruacentExiled/KE.CustomRoles/Abilities/Explode.cs +++ b/KruacentExiled/KE.CustomRoles/Abilities/Explode.cs @@ -88,6 +88,8 @@ private void ExplodeEvent_ExplodeDestructible(Items.API.Events.OnExplodeDestruct obj.Damage /=3f; + GrenadesSerials.Remove(serial); + KELog.Debug("explode with "+ obj.Damage); } From 3cc5d93a0858b7a946b754b7735d5f983e8b2c1e Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Fri, 10 Apr 2026 12:48:19 +0200 Subject: [PATCH 836/853] add desc --- KruacentExiled/KE.CustomRoles/Commands/KECR/Lists/Abilities.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/KruacentExiled/KE.CustomRoles/Commands/KECR/Lists/Abilities.cs b/KruacentExiled/KE.CustomRoles/Commands/KECR/Lists/Abilities.cs index d70001cd..4b51b0e6 100644 --- a/KruacentExiled/KE.CustomRoles/Commands/KECR/Lists/Abilities.cs +++ b/KruacentExiled/KE.CustomRoles/Commands/KECR/Lists/Abilities.cs @@ -16,7 +16,7 @@ public class Abilities : ICommand public string[] Aliases => ["a"]; - public string Description => throw new NotImplementedException(); + public string Description => "list abilities"; public bool Execute(ArraySegment arguments, ICommandSender sender, out string response) { From b7bb93ebdbc6b234b353cdf62e559e1773bc31d3 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Fri, 10 Apr 2026 12:49:19 +0200 Subject: [PATCH 837/853] unsub events --- .../KE.CustomRoles/CR/CustomSCPs/SCP049C/SCP049CLevelSystem.cs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP049C/SCP049CLevelSystem.cs b/KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP049C/SCP049CLevelSystem.cs index 36afafdf..4db3946e 100644 --- a/KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP049C/SCP049CLevelSystem.cs +++ b/KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP049C/SCP049CLevelSystem.cs @@ -113,6 +113,9 @@ private void SettingHandler_RightPressed(Player obj) public void OnDestroy() { + SettingHandler.RightPressed -= SettingHandler_RightPressed; + SettingHandler.LeftPressed -= SettingHandler_LeftPressed; + GUI.Dispose(); gui = null; DisableAll(); From 9f2db51d7ebd53cfe4323cdf49cc7ae4e660856c Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Fri, 10 Apr 2026 12:52:33 +0200 Subject: [PATCH 838/853] fix ragdoll being null --- .../KE.CustomRoles/CR/CustomSCPs/SCP049C/SCP049CLevelSystem.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP049C/SCP049CLevelSystem.cs b/KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP049C/SCP049CLevelSystem.cs index 4db3946e..e68b27f9 100644 --- a/KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP049C/SCP049CLevelSystem.cs +++ b/KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP049C/SCP049CLevelSystem.cs @@ -299,7 +299,7 @@ private void UpdateTime() private void Reset() { - if(ragdoll.GameObject.TryGetComponent(out var comp)) + if(ragdoll != null && ragdoll.GameObject.TryGetComponent(out var comp)) { comp.SetColor(Color.white); } From f126a4c2624519dcc7947f46c671556c7e6ec4f9 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Fri, 10 Apr 2026 13:10:37 +0200 Subject: [PATCH 839/853] divine pills & true divine pills corrected check --- KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP035.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP035.cs b/KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP035.cs index 7427c536..4f7f97f1 100644 --- a/KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP035.cs +++ b/KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP035.cs @@ -12,6 +12,7 @@ using HintServiceMeow.Core.Models.Arguments; using HintServiceMeow.Core.Utilities; using KE.CustomRoles.API.Features; +using KE.CustomRoles.CR.MTF; using KE.Items.API.Features; using KE.Utils.API.Displays.DisplayMeow; using KE.Utils.API.Displays.DisplayMeow.Placements; @@ -246,7 +247,10 @@ private void OnSearchingPickup(SearchingPickupEventArgs ev) if(item is not null) { - if(item.Id == 1050 || item.Id == 1047) + + KECustomItem kECustomItem = item as KECustomItem; + + if (kECustomItem.Name == "TrueDivinePills" || kECustomItem.Name == "Divine Pills") { ShowEffectHint(player, GetTranslation(player, "SCP035CantPickup")); ev.IsAllowed = false; From d61ba8d3ed4cd0399cdefea55bb47f335e479e56 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Fri, 10 Apr 2026 13:10:48 +0200 Subject: [PATCH 840/853] overlapnonalloc fix --- KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP457.cs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP457.cs b/KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP457.cs index fc62d39b..dc7bae7b 100644 --- a/KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP457.cs +++ b/KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP457.cs @@ -107,12 +107,16 @@ private IEnumerator PassiveDamage(Player scp) { - if(Physics.OverlapSphereNonAlloc(scp.Position,5, SphereNonAlloc) > 0) + int num = Physics.OverlapSphereNonAlloc(scp.Position, 5, SphereNonAlloc); + + if (num > 0) { - for (int i = 0; i < SphereNonAlloc.Length; i++) + for (int i = 0; i < num; i++) { Player player = Player.Get(SphereNonAlloc[i]); if (player is null) continue; + if (!HitboxIdentity.IsDamageable(scp.ReferenceHub, player.ReferenceHub)) continue; + if(Physics.Linecast(player.Position, scp.Position, out var hitinfo)) { float damage = -(hitinfo.distance / 3) + 10; From ba97b8fdcbb49e66112d89084ee487e02e0bdf45 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Fri, 10 Apr 2026 13:11:36 +0200 Subject: [PATCH 841/853] on hurt unsub --- KruacentExiled/KE.CustomRoles/CR/MTF/RedMist/EGO.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/KruacentExiled/KE.CustomRoles/CR/MTF/RedMist/EGO.cs b/KruacentExiled/KE.CustomRoles/CR/MTF/RedMist/EGO.cs index 00adf9d2..83f5b8d3 100644 --- a/KruacentExiled/KE.CustomRoles/CR/MTF/RedMist/EGO.cs +++ b/KruacentExiled/KE.CustomRoles/CR/MTF/RedMist/EGO.cs @@ -74,7 +74,7 @@ private void OnHurt(HurtEventArgs ev) public void UnsubscribeEvents() { Exiled.Events.Handlers.Player.ReceivingEffect -= OnReceivingEffect; - + Exiled.Events.Handlers.Player.Hurt -= OnHurt; } private void OnReceivingEffect(ReceivingEffectEventArgs ev) From 11373b43208963e2e23262626d738d89a9041fd5 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Fri, 10 Apr 2026 13:12:23 +0200 Subject: [PATCH 842/853] moved event in sub event --- .../CR/ChaosInsurgency/LeRusse.cs | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/KruacentExiled/KE.CustomRoles/CR/ChaosInsurgency/LeRusse.cs b/KruacentExiled/KE.CustomRoles/CR/ChaosInsurgency/LeRusse.cs index e317f964..5ac7c485 100644 --- a/KruacentExiled/KE.CustomRoles/CR/ChaosInsurgency/LeRusse.cs +++ b/KruacentExiled/KE.CustomRoles/CR/ChaosInsurgency/LeRusse.cs @@ -68,13 +68,27 @@ protected override Dictionary> SetTranslation { AmmoType.Ammo44Cal, 19 }, { AmmoType.Nato762, 60 } }; + + protected override void SubscribeEvents() + { + Exiled.Events.Handlers.Player.Hurting += OnDealingDamage; + base.SubscribeEvents(); + } + + protected override void UnsubscribeEvents() + { + Exiled.Events.Handlers.Player.Hurting -= OnDealingDamage; + base.UnsubscribeEvents(); + } + + protected override void RoleAdded(Player player) { /*Exiled.Events.Handlers.Player.VoiceChatting += OnVoiceChatting; _filterMems[player] = 0f; SetupSpeaker(player);*/ _playerDamage[player] = 0f; - Exiled.Events.Handlers.Player.Hurting += OnDealingDamage; + } protected override void RoleRemoved(Player player) @@ -83,7 +97,7 @@ protected override void RoleRemoved(Player player) DestroySpeaker(player); _filterMems.Remove(player);*/ - Exiled.Events.Handlers.Player.Hurting -= OnDealingDamage; + _playerDamage.Remove(player); } From aab3219b00cc121f08c6f83f80f03de0ba5df6e6 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Fri, 10 Apr 2026 13:13:28 +0200 Subject: [PATCH 843/853] removed voice chat change --- .../CR/ChaosInsurgency/LeRusse.cs | 83 +------------------ 1 file changed, 1 insertion(+), 82 deletions(-) diff --git a/KruacentExiled/KE.CustomRoles/CR/ChaosInsurgency/LeRusse.cs b/KruacentExiled/KE.CustomRoles/CR/ChaosInsurgency/LeRusse.cs index 5ac7c485..1baf0316 100644 --- a/KruacentExiled/KE.CustomRoles/CR/ChaosInsurgency/LeRusse.cs +++ b/KruacentExiled/KE.CustomRoles/CR/ChaosInsurgency/LeRusse.cs @@ -44,15 +44,9 @@ protected override Dictionary> SetTranslation public override int MaxHealth { get; set; } = 100; public override RoleTypeId Role { get; set; } = RoleTypeId.ChaosRifleman; - public bool CanHearItself { get; set; } = false; public float DamageToLootbox { get; set; } = 500f; private readonly Dictionary _playerDamage = new(); - private readonly Dictionary _speakers = new(); - private readonly Dictionary _filterMems = new(); - - private readonly OpusDecoder _decoder = new(); - private readonly OpusEncoder _encoder = new(VoiceChat.Codec.Enums.OpusApplicationType.Voip); private static object[] _lootPool = null; @@ -84,18 +78,12 @@ protected override void UnsubscribeEvents() protected override void RoleAdded(Player player) { - /*Exiled.Events.Handlers.Player.VoiceChatting += OnVoiceChatting; - _filterMems[player] = 0f; - SetupSpeaker(player);*/ _playerDamage[player] = 0f; } protected override void RoleRemoved(Player player) { - /*Exiled.Events.Handlers.Player.VoiceChatting -= OnVoiceChatting; - DestroySpeaker(player); - _filterMems.Remove(player);*/ _playerDamage.Remove(player); @@ -161,6 +149,7 @@ private IEnumerator LootBoxAnimation(Primitive box, Player p) } } + private object GetRandomGambleReward() { if (_lootPool == null) @@ -190,75 +179,5 @@ private object GetRandomGambleReward() return _lootPool[Random.Range(0, _lootPool.Length)]; } - private void OnVoiceChatting(VoiceChattingEventArgs ev) - { - if (!Check(ev.Player) || !_speakers.TryGetValue(ev.Player, out SpeakerToy speaker)) return; - - ev.IsAllowed = false; - - float[] pcmBuffer = new float[1920]; - int length = _decoder.Decode(ev.VoiceMessage.Data, ev.VoiceMessage.DataLength, pcmBuffer); - - float gateThreshold = 0.02f; - float muffle = 0.10f; - float mem = _filterMems[ev.Player]; - - for (int i = 0; i < length; i++) - { - float input = pcmBuffer[i]; - if (Mathf.Abs(input) < gateThreshold) - { - mem *= 0.9f; - pcmBuffer[i] = mem; - continue; - } - mem += (input - mem) * muffle; - float output = Mathf.Clamp(mem * 6.0f, -1f, 1f); - pcmBuffer[i] = output; - } - _filterMems[ev.Player] = mem; - - byte[] encoded = new byte[4000]; - int encodedLen = _encoder.Encode(pcmBuffer, encoded); - - BroadcastAudio(ev.Player, speaker.NetworkControllerId, encoded, encodedLen); - } - - private void BroadcastAudio(Player source, byte speakerId, byte[] data, int length) - { - var audioMsg = new AudioMessage(speakerId, data, (short)length); - Vector3 sourcePos = source.Position; - - foreach (Player hub in Player.List) - { - if (hub == source && !CanHearItself) continue; - if (Vector3.Distance(hub.Position, sourcePos) <= 20f) - hub.Connection.Send(audioMsg); - } - } - - private void SetupSpeaker(Player p) - { - var prefab = NetworkClient.prefabs.Values.Select(x => x.GetComponent()).FirstOrDefault(s => s != null); - if (prefab == null) return; - - SpeakerToy speaker = Object.Instantiate(prefab, p.GameObject.transform); - speaker.transform.localPosition = Vector3.up * 1.5f; - speaker.transform.localScale = Vector3.zero; - - NetworkServer.Spawn(speaker.gameObject); - speaker.NetworkControllerId = (byte)p.Id; - _speakers[p] = speaker; - } - - private void DestroySpeaker(Player p) - { - if (_speakers.TryGetValue(p, out SpeakerToy speaker)) - { - if (speaker != null) NetworkServer.Destroy(speaker.gameObject); - _speakers.Remove(p); - } - } - } } \ No newline at end of file From 86c7d775dda576984984ad2f0a10337933889df2 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Sat, 11 Apr 2026 14:49:25 +0200 Subject: [PATCH 844/853] maybe fixed the sln? --- KruacentExiled/KruacentExiled.sln | 1 + 1 file changed, 1 insertion(+) diff --git a/KruacentExiled/KruacentExiled.sln b/KruacentExiled/KruacentExiled.sln index 8209ac13..9114a731 100644 --- a/KruacentExiled/KruacentExiled.sln +++ b/KruacentExiled/KruacentExiled.sln @@ -4,6 +4,7 @@ Microsoft Visual Studio Solution File, Format Version 12.00 VisualStudioVersion = 17.12.35506.116 MinimumVisualStudioVersion = 10.0.40219.1 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "KE.Items", "KE.Items\KE.Items.csproj", "{87D91720-B7B5-4FB7-AB18-FB6E70AC0D68}" +EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "KE.CustomRoles", "KE.CustomRoles\KE.CustomRoles.csproj", "{33CC074C-06DD-4545-91F2-F668F3C4779D}" EndProject Global From 81c7ca9d481b28e4083741646fe74dc2d918f1f8 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Sat, 11 Apr 2026 15:02:43 +0200 Subject: [PATCH 845/853] added hint instead of broastcst --- .../Features/GamblingCoin/CoinHintPosition.cs | 20 +++++++++++++++++++ .../Features/GamblingCoin/PlayerUtils.cs | 11 ++++++---- 2 files changed, 27 insertions(+), 4 deletions(-) create mode 100644 KruacentExiled/KE.Misc/Features/GamblingCoin/CoinHintPosition.cs diff --git a/KruacentExiled/KE.Misc/Features/GamblingCoin/CoinHintPosition.cs b/KruacentExiled/KE.Misc/Features/GamblingCoin/CoinHintPosition.cs new file mode 100644 index 00000000..b795c070 --- /dev/null +++ b/KruacentExiled/KE.Misc/Features/GamblingCoin/CoinHintPosition.cs @@ -0,0 +1,20 @@ +using HintServiceMeow.Core.Enum; +using KE.Utils.API.Displays.DisplayMeow.Placements; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace KE.Misc.Features.GamblingCoin +{ + public class CoinHintPosition : HintPosition + { + public override float Xposition => 0; + + public override float Yposition => 800; + + public override HintAlignment HintAlignment => HintAlignment.Center; + public override string Name => "Coins"; + } +} diff --git a/KruacentExiled/KE.Misc/Features/GamblingCoin/PlayerUtils.cs b/KruacentExiled/KE.Misc/Features/GamblingCoin/PlayerUtils.cs index 20bbc400..e198a0ce 100644 --- a/KruacentExiled/KE.Misc/Features/GamblingCoin/PlayerUtils.cs +++ b/KruacentExiled/KE.Misc/Features/GamblingCoin/PlayerUtils.cs @@ -2,15 +2,18 @@ using System.Linq; using Exiled.API.Features; using KE.Utils.API.Displays.DisplayMeow; +using KE.Utils.API.Displays.DisplayMeow.Placements; namespace KE.Misc.Features.GamblingCoin { - internal class PlayerUtils + internal static class PlayerUtils { - public static void SendBroadcast(Player p, string message) + + private static HintPosition Position = new CoinHintPosition(); + public static void SendBroadcast(Player player, string message) { - // todo better with SSS - p.Broadcast(5, message); + DisplayHandler.Instance.AddHint(Position.HintPlacement, player, message,5); + } } } From da8ad7ccb81774e57bfd12cce2026fd4e1f85b93 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Mon, 13 Apr 2026 13:41:15 +0200 Subject: [PATCH 846/853] unsub evnt --- KruacentExiled/KE.Map/Heavy/GamblingZone/GamblingRoom.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/KruacentExiled/KE.Map/Heavy/GamblingZone/GamblingRoom.cs b/KruacentExiled/KE.Map/Heavy/GamblingZone/GamblingRoom.cs index ace11a73..c4dae0b8 100644 --- a/KruacentExiled/KE.Map/Heavy/GamblingZone/GamblingRoom.cs +++ b/KruacentExiled/KE.Map/Heavy/GamblingZone/GamblingRoom.cs @@ -117,7 +117,7 @@ public override void Destroy() { p.Destroy(); } - LabApi.Events.Handlers.PlayerEvents.SearchedToy += OnPickup; + LabApi.Events.Handlers.PlayerEvents.SearchedToy -= OnPickup; _interact.Destroy(); _list.Remove(this); } From 6ae361672e4993fad5ee30396be754d3bae8bb8f Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Mon, 13 Apr 2026 15:26:25 +0200 Subject: [PATCH 847/853] all of custom zone --- KruacentExiled/KE.Map/MainPlugin.cs | 17 +- .../KE.Map/Others/CustomZones/AltasReader.cs | 20 +- .../Others/CustomZones/CREventHandler.cs | 9 +- .../KE.Map/Others/CustomZones/CustomRoom.cs | 9 +- .../CustomZones/CustomRooms/DoorSeparator.cs | 56 ++++++ .../CustomZones/CustomRooms/MCZ/Curve.cs | 41 ++++ .../CustomZones/CustomRooms/MCZ/EndRoom.cs | 8 +- .../CustomRooms/MCZ/MCZDoorSeparator.cs | 34 ++++ .../CustomZones/CustomRooms/MCZ/SCorridor.cs | 34 ++-- .../CustomZones/CustomRooms/MCZ/TCorridor.cs | 30 +-- .../CustomZones/CustomRooms/MCZ/XCorridor.cs | 39 ++++ .../CustomRooms/SpawnedDoorSeparator.cs | 58 ++++++ .../KE.Map/Others/CustomZones/CustomZone.cs | 13 +- .../KE.Map/Others/CustomZones/Layout.cs | 4 +- .../CustomZones/MediumContainmentZone.cs | 45 ++++- .../Others/CustomZones/SpawnedCustomRoom.cs | 72 ++++++- KruacentExiled/KE.Map/ShowPos.cs | 33 ++++ .../KE.Map/Surface/Rooms/SurfaceArmory.cs | 14 ++ .../KE.Map/Surface/Rooms/SurfaceRoom.cs | 17 ++ .../KE.Map/Surface/Rooms/SurfaceRooms.cs | 52 +++++ .../KE.Map/Utils/StructureSpawner.cs | 177 ++++++++++++++++++ 21 files changed, 723 insertions(+), 59 deletions(-) create mode 100644 KruacentExiled/KE.Map/Others/CustomZones/CustomRooms/DoorSeparator.cs create mode 100644 KruacentExiled/KE.Map/Others/CustomZones/CustomRooms/MCZ/Curve.cs create mode 100644 KruacentExiled/KE.Map/Others/CustomZones/CustomRooms/MCZ/MCZDoorSeparator.cs create mode 100644 KruacentExiled/KE.Map/Others/CustomZones/CustomRooms/MCZ/XCorridor.cs create mode 100644 KruacentExiled/KE.Map/Others/CustomZones/CustomRooms/SpawnedDoorSeparator.cs create mode 100644 KruacentExiled/KE.Map/ShowPos.cs create mode 100644 KruacentExiled/KE.Map/Surface/Rooms/SurfaceArmory.cs create mode 100644 KruacentExiled/KE.Map/Surface/Rooms/SurfaceRoom.cs create mode 100644 KruacentExiled/KE.Map/Surface/Rooms/SurfaceRooms.cs create mode 100644 KruacentExiled/KE.Map/Utils/StructureSpawner.cs diff --git a/KruacentExiled/KE.Map/MainPlugin.cs b/KruacentExiled/KE.Map/MainPlugin.cs index 4023b2a0..9407800a 100644 --- a/KruacentExiled/KE.Map/MainPlugin.cs +++ b/KruacentExiled/KE.Map/MainPlugin.cs @@ -8,7 +8,9 @@ using KE.Map.Heavy; using KE.Map.Heavy.GamblingZone; using KE.Map.Others.BlackoutNDoor.Handlers; +using KE.Map.Others.CustomZones; using KE.Map.Surface.ElevatorGateA; +using KE.Map.Surface.Rooms; using KE.Utils.API.Features; using KE.Utils.API.KETextToy; using KE.Utils.Extensions; @@ -18,6 +20,7 @@ using ProjectMER.Features; using System; using System.Collections.Generic; +using System.IO; using System.Linq; using UnityEngine; using Door = Exiled.API.Features.Doors.Door; @@ -34,20 +37,26 @@ public class MainPlugin : Plugin public static Translations Translations => Instance?.Translation; public static Config Configs => Instance?.Config; private Harmony harmony; + + private SurfaceRooms SurfaceRooms; + private CREventHandler cREventHandler; public override void OnEnabled() { handler = new(); harmony = new(Prefix); - - + cREventHandler = new(); + cREventHandler.SubscribeEvents(); handler.SubscribeEvents(); KE.Utils.API.Sounds.SoundPlayer.Instance.TryLoad(); Exiled.Events.Handlers.Map.Generated += OnGenerated; Exiled.Events.Handlers.Server.RoundStarted += OnRoundStarted; Exiled.Events.Handlers.Server.WaitingForPlayers += OnWaitingForPlayers; + + //SurfaceRooms.SubscribeEvents(); + GamblingRoom.SubscribeEvents(); //MoreRoom.CreateAll(); //MoreRoom.SubscribeEvents(); @@ -186,6 +195,10 @@ public override void OnDisabled() Exiled.Events.Handlers.Server.RoundStarted -= OnRoundStarted; Exiled.Events.Handlers.Server.WaitingForPlayers -= OnWaitingForPlayers; + cREventHandler.UnsubscribeEvents(); + cREventHandler = null; + + harmony.UnpatchAll(harmony.Id); GamblingRoom.UnsubscribeEvents(); //MoreRoom.UnsubscribeEvents(); diff --git a/KruacentExiled/KE.Map/Others/CustomZones/AltasReader.cs b/KruacentExiled/KE.Map/Others/CustomZones/AltasReader.cs index 4aba713e..371c71d3 100644 --- a/KruacentExiled/KE.Map/Others/CustomZones/AltasReader.cs +++ b/KruacentExiled/KE.Map/Others/CustomZones/AltasReader.cs @@ -64,7 +64,7 @@ public static void Read() foreach (string file in files) { - string noExFile = System.IO.Path.GetFileName(file); + string noExFile = System.IO.Path.GetFileNameWithoutExtension(file); Log.Debug($"loading {file} as {noExFile}"); using Bitmap bmp = new Bitmap(file); int width = bmp.Width; @@ -120,13 +120,13 @@ public static void Read() { shape = RoomShape.TShape; Vector2Int coordempty = empty[0]; - rotation = new(0, coordempty.x * 90,0); + rotation = new(0, coordempty.x * 90, 0); - if (coordempty.x == 0 && coordempty.y == 1) + if (coordempty.x == 0 && coordempty.y == -1) { rotation = Vector3.zero; } - if (coordempty.x == 0 && coordempty.y == -1) + if (coordempty.x == 0 && coordempty.y == 1) { rotation = new Vector3(0, 180, 0); } @@ -141,11 +141,11 @@ public static void Read() shape = RoomShape.Straight; if(empty[0].x == 0) { - rotation = Vector3.zero; + rotation = new Vector3(0, 90, 0); } else { - rotation = new Vector3(0, 90, 0); + rotation = Vector3.zero; } } else @@ -197,11 +197,11 @@ public static void Read() } if (coordnotempty.x == 1 && coordnotempty.y == 0) { - rotation = new Vector3(0, 90, 0); + rotation = new Vector3(0, -90, 0); } if (coordnotempty.x == -1 && coordnotempty.y == 0) { - rotation = new Vector3(0, -90, 0); + rotation = new Vector3(0, 90, 0); } @@ -229,13 +229,13 @@ public static void Read() Log.Warn($"found undefined at {coord} room skipping"); continue; } - Log.Debug($"adding {shape} at {coord} ({rotation})"); + Log.Debug($"adding {shape} at {coord} ({rotation.y})"); coordtoroom.Add(coord, new (shape,rotation)); } } - Layout layout = new(coordtoroom); + Layout layout = new(coordtoroom, noExFile); coordtoroom.Clear(); } } diff --git a/KruacentExiled/KE.Map/Others/CustomZones/CREventHandler.cs b/KruacentExiled/KE.Map/Others/CustomZones/CREventHandler.cs index d95de532..5e2bc43f 100644 --- a/KruacentExiled/KE.Map/Others/CustomZones/CREventHandler.cs +++ b/KruacentExiled/KE.Map/Others/CustomZones/CREventHandler.cs @@ -1,4 +1,5 @@ using Exiled.API.Features; +using KE.Map.Others.CustomZones.CustomRooms; using KE.Map.Others.CustomZones.CustomRooms.MCZ; using KE.Utils.API.Interfaces; using LabApi.Events.Arguments.ServerEvents; @@ -49,8 +50,14 @@ private void OnGenerated() new SCorridor(); new EndRoom(); new TCorridor(); + new Curve(); + new XCorridor(); + new MCZDoorSeparator(); + + System.Random random = new System.Random(seed); + + zone.Generate(random,Layout.Layouts.First(l => l.Name == "Circle")); - zone.Generate(new System.Random(seed)); teleport = CustomRoom.RegisteredRoom.First().SpawnedRoom.First(s => s.Shape == RoomShape.Straight).Position + Vector3.up * 5; Log.Debug("teleport " + teleport); diff --git a/KruacentExiled/KE.Map/Others/CustomZones/CustomRoom.cs b/KruacentExiled/KE.Map/Others/CustomZones/CustomRoom.cs index 4e1e517a..dd07d1f2 100644 --- a/KruacentExiled/KE.Map/Others/CustomZones/CustomRoom.cs +++ b/KruacentExiled/KE.Map/Others/CustomZones/CustomRoom.cs @@ -30,9 +30,10 @@ public CustomRoom() protected abstract IEnumerable SpawnRoom(Vector3 position,Vector3 rotation); + public SpawnedCustomRoom Spawn(Vector2Int coord,Vector3 rotation,Vector3 spawnzone) { - Vector3 position = new(coord.x * Size.x+ spawnzone.x, spawnzone.y, coord.y * Size.z + spawnzone.z); + Vector3 position = new(-coord.x * Size.x+ spawnzone.x, spawnzone.y, coord.y * Size.z + spawnzone.z); Log.Debug("spawn room at " + position); IEnumerable prims = SpawnRoom(position,rotation); @@ -51,6 +52,12 @@ public SpawnedCustomRoom Spawn(Vector2Int coord,Vector3 rotation,Vector3 spawnzo } + public static Primitive CreatePrimitive(PrimitiveType type = PrimitiveType.Cube,Vector3? position = null, Vector3? rotation = null, Vector3? scale = null,Color? color = null) + { + return Primitive.Create(type, position, rotation, scale, false, color); + } + + } } diff --git a/KruacentExiled/KE.Map/Others/CustomZones/CustomRooms/DoorSeparator.cs b/KruacentExiled/KE.Map/Others/CustomZones/CustomRooms/DoorSeparator.cs new file mode 100644 index 00000000..84a0e212 --- /dev/null +++ b/KruacentExiled/KE.Map/Others/CustomZones/CustomRooms/DoorSeparator.cs @@ -0,0 +1,56 @@ +using Exiled.API.Features; +using KE.Map.Others.CustomZones; +using Mirror; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using UnityEngine; + +namespace KE.Map.Others.CustomZones.CustomRooms +{ + public abstract class DoorSeparator + { + private static readonly HashSet registered = new(); + public static IReadOnlyCollection RegisteredDoorSeparator => registered; + public DoorSeparator() + { + registered.Add(this); + } + + + + public HashSet SpawnDoorSeparator { get; } = new(); + public abstract CustomFacilityZone FacilityZone { get; } + + protected abstract IEnumerable Create(Vector3 position, Vector3 rotation); + + + public SpawnedDoorSeparator Spawn(SpawnedCustomRoom room1, SpawnedCustomRoom room2) + { + Vector3 posdif = room1.Position + room2.Position; + Vector3 position = posdif / 2f; + Vector3 rotation = Vector3.zero; + if (Mathf.Approximately(room1.Position.z, room2.Position.z)) + { + rotation = new Vector3(0, 90, 0); + } + + + //Log.Debug("spawning door at " + position + $"({rotation})"); + IEnumerable objs = Create(position, rotation); + + + + SpawnedDoorSeparator spawned = new(this, position, rotation, [room1, room2], objs.ToHashSet()); + spawned.Spawn(); + + SpawnDoorSeparator.Add(spawned); + room1.Door.Add(spawned); + room2.Door.Add(spawned); + return spawned; + } + + } +} diff --git a/KruacentExiled/KE.Map/Others/CustomZones/CustomRooms/MCZ/Curve.cs b/KruacentExiled/KE.Map/Others/CustomZones/CustomRooms/MCZ/Curve.cs new file mode 100644 index 00000000..5dc16169 --- /dev/null +++ b/KruacentExiled/KE.Map/Others/CustomZones/CustomRooms/MCZ/Curve.cs @@ -0,0 +1,41 @@ +using Exiled.API.Features.Toys; +using MapGeneration; +using System.Collections.Generic; +using UnityEngine; +using Light = Exiled.API.Features.Toys.Light; + +namespace KE.Map.Others.CustomZones.CustomRooms.MCZ +{ + public class Curve : CustomRoom + { + public override RoomShape Shape => RoomShape.Curve; + + public override CustomFacilityZone FacilityZone => CustomFacilityZone.MediumContainment; + private float width = 6f; + protected override IEnumerable SpawnRoom(Vector3 position, Vector3 rotation) + { + Quaternion rot = Quaternion.Euler(rotation); + + + Light light = Light.Create(position + Vector3.up * 2, null, null, false, Color.white); + light.LightType = LightType.Spot; + light.Rotation = Quaternion.LookRotation(Vector3.down); + light.Range = 50f; + light.SpotAngle = 90; + light.Intensity = 8; + + + float lengthbranch = Size.x / 2f - width / 2f; + float lengthmain = Size.x / 2f + width / 2f; + + + return new HashSet() + { + + Primitive.Create(PrimitiveType.Cube,position + rot*Vector3.left*(lengthmain/2f-width/2f), rotation, new Vector3(lengthmain,1,6f), false),//main + CreatePrimitive(PrimitiveType.Cube,position + rot*Vector3.forward*(width/2f+lengthbranch/2f),rot.eulerAngles, new Vector3(width,1,lengthbranch)), //branch + light, + }; + } + } +} diff --git a/KruacentExiled/KE.Map/Others/CustomZones/CustomRooms/MCZ/EndRoom.cs b/KruacentExiled/KE.Map/Others/CustomZones/CustomRooms/MCZ/EndRoom.cs index c825e116..10f8bfd2 100644 --- a/KruacentExiled/KE.Map/Others/CustomZones/CustomRooms/MCZ/EndRoom.cs +++ b/KruacentExiled/KE.Map/Others/CustomZones/CustomRooms/MCZ/EndRoom.cs @@ -10,8 +10,8 @@ public class EndRoom : CustomRoom { public override RoomShape Shape => RoomShape.Endroom; - public override CustomFacilityZone FacilityZone => CustomFacilityZone.MediumContainment; - + public override CustomFacilityZone FacilityZone => CustomFacilityZone.MediumContainment; + private float width = 6f; protected override IEnumerable SpawnRoom(Vector3 position,Vector3 rotation) { Quaternion rot = Quaternion.Euler(rotation); @@ -25,11 +25,11 @@ protected override IEnumerable SpawnRoom(Vector3 position,Vector3 rota light.Intensity = 8; - + float lengthmain = (Size.x / 2f) + (width / 2f); return new HashSet() { - Primitive.Create(PrimitiveType.Cube,position, rotation, new Vector3(15f,1,6f), false), + Primitive.Create(PrimitiveType.Cube,position + rot*Vector3.forward*((lengthmain/2f)-(width/2f)), rotation, new Vector3(6f,1,lengthmain), false,Color.red),//main light, }; } diff --git a/KruacentExiled/KE.Map/Others/CustomZones/CustomRooms/MCZ/MCZDoorSeparator.cs b/KruacentExiled/KE.Map/Others/CustomZones/CustomRooms/MCZ/MCZDoorSeparator.cs new file mode 100644 index 00000000..e6de0d05 --- /dev/null +++ b/KruacentExiled/KE.Map/Others/CustomZones/CustomRooms/MCZ/MCZDoorSeparator.cs @@ -0,0 +1,34 @@ +using Interactables.Interobjects.DoorUtils; +using KE.Map.Utils; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using UnityEngine; + +namespace KE.Map.Others.CustomZones.CustomRooms.MCZ +{ + public class MCZDoorSeparator : DoorSeparator + { + public override CustomFacilityZone FacilityZone => CustomFacilityZone.MediumContainment; + private Vector3 doorpos; + protected override IEnumerable Create(Vector3 position, Vector3 rotation) + { + Quaternion rot = Quaternion.Euler(rotation); + DoorVariant door = StructureSpawner.CreateRawDoor(ProjectMER.Features.Enums.DoorType.Ez, position + Vector3.up / 2f, Quaternion.Euler(rotation), Vector3.one); + + doorpos = door.transform.position+Vector3.up*1.5f; + Vector3 scale = new Vector3(2.5f, 3f, .2f); + + return new HashSet() + { + door.gameObject, + CustomRoom.CreatePrimitive(PrimitiveType.Cube,doorpos+rot*Vector3.right*2,rotation,scale).GameObject, + CustomRoom.CreatePrimitive(PrimitiveType.Cube,doorpos+rot*Vector3.left*2,rotation,scale).GameObject, + }; + + + } + } +} diff --git a/KruacentExiled/KE.Map/Others/CustomZones/CustomRooms/MCZ/SCorridor.cs b/KruacentExiled/KE.Map/Others/CustomZones/CustomRooms/MCZ/SCorridor.cs index 8d7037fe..2105d6ff 100644 --- a/KruacentExiled/KE.Map/Others/CustomZones/CustomRooms/MCZ/SCorridor.cs +++ b/KruacentExiled/KE.Map/Others/CustomZones/CustomRooms/MCZ/SCorridor.cs @@ -12,28 +12,28 @@ public class SCorridor : CustomRoom public override CustomFacilityZone FacilityZone => CustomFacilityZone.MediumContainment; + private float height = 4; protected override IEnumerable SpawnRoom(Vector3 position, Vector3 rotation) { - { - Quaternion rot = Quaternion.Euler(rotation); - - - Light light = Light.Create(position + Vector3.up * 2, null, null, false, Color.white); - light.LightType = LightType.Spot; - light.Rotation = Quaternion.LookRotation(Vector3.down); - light.Range = 50f; - light.SpotAngle = 120; - light.Intensity = 8; + Quaternion rot = Quaternion.Euler(rotation); + + Light light = Light.Create(position + Vector3.up * height, null, null, false, Color.white); + light.LightType = LightType.Point; + light.Rotation = Quaternion.LookRotation(Vector3.down); + light.Range = 10; + light.Intensity = 50; + light.ShadowType = LightShadows.None; - - return new HashSet() - { - Primitive.Create(PrimitiveType.Cube,position, rotation, new Vector3(15f,1,6f), false), - light, - }; - } + return new HashSet() + { + Primitive.Create(PrimitiveType.Cube,position, rotation, new Vector3(6f,1,15f), false), + Primitive.Create(PrimitiveType.Cube,position+Vector3.up*height, rotation, new Vector3(6f,.5f,15f), false), + Primitive.Create(PrimitiveType.Cube,position+Vector3.up*(height/2)+rot*Vector3.left*2, rotation, new Vector3(1f,height,15f), false), + Primitive.Create(PrimitiveType.Cube,position+Vector3.up*(height/2)+rot*Vector3.right*2, rotation, new Vector3(1f,height,15f), false), + light, + }; } } } diff --git a/KruacentExiled/KE.Map/Others/CustomZones/CustomRooms/MCZ/TCorridor.cs b/KruacentExiled/KE.Map/Others/CustomZones/CustomRooms/MCZ/TCorridor.cs index b34f7a84..093e6fcc 100644 --- a/KruacentExiled/KE.Map/Others/CustomZones/CustomRooms/MCZ/TCorridor.cs +++ b/KruacentExiled/KE.Map/Others/CustomZones/CustomRooms/MCZ/TCorridor.cs @@ -1,5 +1,7 @@ -using Exiled.API.Features.Toys; +using DrawableLine; +using Exiled.API.Features.Toys; using MapGeneration; +using MEC; using System.Collections.Generic; using UnityEngine; using Light = Exiled.API.Features.Toys.Light; @@ -12,31 +14,35 @@ public class TCorridor : CustomRoom public override CustomFacilityZone FacilityZone => CustomFacilityZone.MediumContainment; + private float width = 6f; + private float height = 4; protected override IEnumerable SpawnRoom(Vector3 position, Vector3 rotation) { Quaternion rot = Quaternion.Euler(rotation); - Light light = Light.Create(position + Vector3.up * 10, null, null, false, Color.white); - light.LightType = LightType.Spot; + Light light = Light.Create(position + Vector3.up * height, null, null, false, Color.white); + light.LightType = LightType.Point; light.Rotation = Quaternion.LookRotation(Vector3.down); - light.Range = 50f; - light.SpotAngle = 120; - light.Intensity = 8; + light.Range = 10; + light.Intensity = 50; + light.ShadowType = LightShadows.None; - Quaternion otherBranch = rot * Quaternion.Euler(0, -90f, 0); - - float lengthbranch = 15f / 2f - 6f / 2f; - + float lengthbranch = (Size.x / 2f) - (width / 2f); return new HashSet() { - Primitive.Create(PrimitiveType.Cube,position, rot.eulerAngles, new Vector3(15f,1,6f), false), - Primitive.Create(PrimitiveType.Cube,position + rot*Vector3.forward*lengthbranch, otherBranch.eulerAngles , new Vector3(lengthbranch,1,6f), false,Color.blue), + + CreatePrimitive(PrimitiveType.Cube,position,rotation, new Vector3(Size.x,1,width)), + CreatePrimitive(PrimitiveType.Cube,position + rot*Vector3.forward*((width/2)+(lengthbranch/2)),rotation, new Vector3(width,1,lengthbranch)), light, + + CreatePrimitive(PrimitiveType.Cube,position +Vector3.up * height,rotation, new Vector3(Size.x,1,width)), + CreatePrimitive(PrimitiveType.Cube,position +Vector3.up * height+ rot*Vector3.forward*((width/2)+(lengthbranch/2)),rotation, new Vector3(width,1,lengthbranch)), }; + } } } diff --git a/KruacentExiled/KE.Map/Others/CustomZones/CustomRooms/MCZ/XCorridor.cs b/KruacentExiled/KE.Map/Others/CustomZones/CustomRooms/MCZ/XCorridor.cs new file mode 100644 index 00000000..aa330636 --- /dev/null +++ b/KruacentExiled/KE.Map/Others/CustomZones/CustomRooms/MCZ/XCorridor.cs @@ -0,0 +1,39 @@ +using Exiled.API.Features.Toys; +using MapGeneration; +using System.Collections.Generic; +using UnityEngine; +using Light = Exiled.API.Features.Toys.Light; + +namespace KE.Map.Others.CustomZones.CustomRooms.MCZ +{ + public class XCorridor : CustomRoom + { + public override RoomShape Shape => RoomShape.XShape; + + public override CustomFacilityZone FacilityZone => CustomFacilityZone.MediumContainment; + private float width = 6f; + protected override IEnumerable SpawnRoom(Vector3 position, Vector3 rotation) + { + Quaternion rot = Quaternion.Euler(rotation); + + + Light light = Light.Create(position + Vector3.up * 2, null, null, false, Color.white); + light.LightType = LightType.Spot; + light.Rotation = Quaternion.LookRotation(Vector3.down); + light.Range = 50f; + light.SpotAngle = 90; + light.Intensity = 8; + + float lengthbranch = Size.x / 2f - width / 2f; + + + return new HashSet() + { + CreatePrimitive(PrimitiveType.Cube,position,rot.eulerAngles, new Vector3(Size.x,1,width)), + CreatePrimitive(PrimitiveType.Cube,position + rot*Vector3.forward*(width/2+lengthbranch/2),rot.eulerAngles, new Vector3(width,1,lengthbranch)), + CreatePrimitive(PrimitiveType.Cube,position + rot*Vector3.back*(width/2+lengthbranch/2),rot.eulerAngles, new Vector3(width,1,lengthbranch)), + light, + }; + } + } +} diff --git a/KruacentExiled/KE.Map/Others/CustomZones/CustomRooms/SpawnedDoorSeparator.cs b/KruacentExiled/KE.Map/Others/CustomZones/CustomRooms/SpawnedDoorSeparator.cs new file mode 100644 index 00000000..8cf86b0c --- /dev/null +++ b/KruacentExiled/KE.Map/Others/CustomZones/CustomRooms/SpawnedDoorSeparator.cs @@ -0,0 +1,58 @@ +using Exiled.API.Features.Toys; +using MapGeneration; +using Mirror; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using UnityEngine; + +namespace KE.Map.Others.CustomZones.CustomRooms +{ + public class SpawnedDoorSeparator + { + public SpawnedDoorSeparator(DoorSeparator basedoor, Vector3 position, Vector3 rotation, IEnumerable rooms, HashSet gameObjects) + { + BaseDoor = basedoor; + Position = position; + Rooms = rooms; + GameObjects = [.. gameObjects]; + } + + + public DoorSeparator BaseDoor { get; } + public Vector3 Position { get; } + public Vector3 Rotation { get; } + + public IEnumerable Rooms { get; } + + public HashSet GameObjects { get; } + + + public void Spawn() + { + foreach(GameObject obj in GameObjects) + { + NetworkServer.Spawn(obj); + } + } + + public void Unspawn() + { + foreach (GameObject obj in GameObjects) + { + NetworkServer.UnSpawn(obj); + } + } + + public void Destroy() + { + foreach (GameObject obj in GameObjects.ToList()) + { + NetworkServer.Destroy(obj); + } + } + + } +} diff --git a/KruacentExiled/KE.Map/Others/CustomZones/CustomZone.cs b/KruacentExiled/KE.Map/Others/CustomZones/CustomZone.cs index b0703242..d70c71dc 100644 --- a/KruacentExiled/KE.Map/Others/CustomZones/CustomZone.cs +++ b/KruacentExiled/KE.Map/Others/CustomZones/CustomZone.cs @@ -14,9 +14,18 @@ public abstract class CustomZone public abstract CustomFacilityZone FacilityZone { get; } public Layout Layout { get; private set; } public abstract Vector3 Spawnzone { get; } - public abstract void Generate(System.Random rng); + public void Generate(System.Random rng) + { + Generate(rng,SetRandomLayout()); + } + + public void GenerateWithLayout(System.Random rng,Layout layout) + { + Generate(rng, layout); + } + public abstract void Generate(System.Random rng, Layout layout); - protected Layout SetRandomLayout() + private Layout SetRandomLayout() { Layout layout =Layout.Layouts.GetRandomValue(); Layout = layout; diff --git a/KruacentExiled/KE.Map/Others/CustomZones/Layout.cs b/KruacentExiled/KE.Map/Others/CustomZones/Layout.cs index a2f5bc5d..1f8720cc 100644 --- a/KruacentExiled/KE.Map/Others/CustomZones/Layout.cs +++ b/KruacentExiled/KE.Map/Others/CustomZones/Layout.cs @@ -12,9 +12,11 @@ namespace KE.Map.Others.CustomZones public struct Layout { public static HashSet Layouts = new(); + public string Name { get; } public readonly Dictionary coordtoroom = new(); - public Layout(Dictionary coordtoroom) + public Layout(Dictionary coordtoroom, string name) { + Name = name; this.coordtoroom = new Dictionary(coordtoroom); Layouts.Add(this); } diff --git a/KruacentExiled/KE.Map/Others/CustomZones/MediumContainmentZone.cs b/KruacentExiled/KE.Map/Others/CustomZones/MediumContainmentZone.cs index 170e133e..ece53962 100644 --- a/KruacentExiled/KE.Map/Others/CustomZones/MediumContainmentZone.cs +++ b/KruacentExiled/KE.Map/Others/CustomZones/MediumContainmentZone.cs @@ -1,12 +1,14 @@ using Exiled.API.Extensions; using Exiled.API.Features; using Interactables.Interobjects.DoorButtons; +using KE.Map.Others.CustomZones.CustomRooms; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using UnityEngine; +using UnityEngine.Rendering; using Random = System.Random; namespace KE.Map.Others.CustomZones @@ -20,15 +22,17 @@ public class MediumContainmentZone : CustomZone private GameObject gameObject; public MediumContainmentZone() { - Spawnzone = Room.List.Where(r => r.Type == Exiled.API.Enums.RoomType.HczEzCheckpointB).First().Position + new Vector3(0,0,-200); + Spawnzone = AlphaWarheadNukesitePanel.Singleton.lever.position+ new Vector3(0, -50, 0); + //Spawnzone = Room.List.Where(r => r.Type == Exiled.API.Enums.RoomType.HczEzCheckpointB).First().Position + new Vector3(0,0,-200); gameObject = new GameObject("MCZ"); } - public override void Generate(Random rng) + + public override void Generate(Random rng,Layout layout) { - SetRandomLayout(); + if(CustomRoom.RegisteredRoom.Count == 0) { @@ -37,13 +41,13 @@ public override void Generate(Random rng) IEnumerable rooms = CustomRoom.RegisteredRoom.Where(r => r.FacilityZone == FacilityZone); - foreach(var kvp in Layout.coordtoroom) + foreach(var kvp in layout.coordtoroom) { CustomRoom room = rooms.GetRandomValue(c => c.Shape == kvp.Value.RoomShape); if(room is null) { - throw new Exception($"couldn't find a room for {FacilityZone} with shape {kvp.Value}"); + throw new Exception($"couldn't find a room for {FacilityZone} with shape {kvp.Value.RoomShape}"); } Vector3 rotation = kvp.Value.Rotation; @@ -53,8 +57,37 @@ public override void Generate(Random rng) room.Spawn(coord, rotation, Spawnzone); } - + IEnumerable doors = DoorSeparator.RegisteredDoorSeparator.Where(d => d.FacilityZone == FacilityZone); + + + foreach(SpawnedCustomRoom scr in SpawnedCustomRoom.SpawnedRoom) + { + //Log.Debug($"scr1 {scr.Shape} ({scr.Coord})"); + foreach(SpawnedCustomRoom scr2 in scr.Neighbors) + { + //Log.Debug($"scr2 {scr2.Shape} ({scr2.Coord})"); + + var scrDoors = scr.Door.Intersect(scr2.Door); + + + if (scrDoors.Count() > 0) + { + //Log.Debug("already a door"); + continue; + } + + if (scr.DoorAvailable(scr2.Coord)) + { + Log.Debug("not available " + scr2.Coord); + continue; + } + + DoorSeparator door = doors.GetRandomValue(); + door.Spawn(scr, scr2); + + } + } diff --git a/KruacentExiled/KE.Map/Others/CustomZones/SpawnedCustomRoom.cs b/KruacentExiled/KE.Map/Others/CustomZones/SpawnedCustomRoom.cs index e79ce735..86e94dea 100644 --- a/KruacentExiled/KE.Map/Others/CustomZones/SpawnedCustomRoom.cs +++ b/KruacentExiled/KE.Map/Others/CustomZones/SpawnedCustomRoom.cs @@ -1,4 +1,6 @@ -using Exiled.API.Features.Toys; +using Exiled.API.Features; +using Exiled.API.Features.Toys; +using KE.Map.Others.CustomZones.CustomRooms; using MapGeneration; using System; using System.Collections.Generic; @@ -11,6 +13,8 @@ namespace KE.Map.Others.CustomZones { public class SpawnedCustomRoom { + private static readonly HashSet spawned = new(); + public static IReadOnlyCollection SpawnedRoom => spawned; public SpawnedCustomRoom(CustomRoom baseRoom, RoomShape shape, Vector3 position, Vector3 rotation, Vector2Int coord, HashSet primitives) { BaseRoom = baseRoom; @@ -18,11 +22,10 @@ public SpawnedCustomRoom(CustomRoom baseRoom, RoomShape shape, Vector3 position, Position = position; Coord = coord; Primitives = [.. primitives]; - GameObject = new GameObject(); + spawned.Add(this); } - public GameObject GameObject { get; } public CustomRoom BaseRoom { get; } public RoomShape Shape { get; } @@ -31,6 +34,34 @@ public SpawnedCustomRoom(CustomRoom baseRoom, RoomShape shape, Vector3 position, public Vector2Int Coord { get; } + private HashSet cachedNeighbors = null; + public IEnumerable Neighbors + { + get + { + if (cachedNeighbors is null) + { + cachedNeighbors = new(); + foreach (SpawnedCustomRoom scr in SpawnedRoom) + { + + int dx = scr.Coord.x - Coord.x; + int dy = scr.Coord.y - Coord.y; + + if ((Math.Abs(dx) == 1 && dy == 0) || (Math.Abs(dy) == 1 && dx == 0)) + { + if (!cachedNeighbors.Contains(scr)) + cachedNeighbors.Add(scr); + } + } + } + + return cachedNeighbors; + } + } + + public HashSet Door { get; } = new(); + public HashSet Primitives { get; } public void Spawn() @@ -57,5 +88,40 @@ public void Destroy() } } + + + public bool DoorAvailable(Vector2Int roomToLink) + { + if(Shape == RoomShape.Curve) + { + var curveLinks = new Dictionary + { + { 0, new [] { ( 0, 1), ( 1, 0) } }, // Up, Right + { 90, new [] { ( -1, 0), ( 0, 1) } }, // Right, Down + { 180, new [] { ( 0, -1), (-1, 0) } }, // Down, Left + { 270, new [] { (1, 0), ( 0, -1) } }, // Left, Up + }; + + int rot = Mathf.RoundToInt(Rotation.y) % 360; + + if (curveLinks.TryGetValue(rot, out var links)) + { + foreach (var (dx, dy) in links) + { + if (roomToLink.x == Coord.x + dx && + roomToLink.y == Coord.y + dy) + { + return true; + } + } + } + + return false; + } + + + return true; + } + } } diff --git a/KruacentExiled/KE.Map/ShowPos.cs b/KruacentExiled/KE.Map/ShowPos.cs new file mode 100644 index 00000000..12358c97 --- /dev/null +++ b/KruacentExiled/KE.Map/ShowPos.cs @@ -0,0 +1,33 @@ +using CommandSystem; +using Exiled.API.Features; +using KE.Map.Surface.Rooms; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace KE.Map +{ + [CommandHandler(typeof(RemoteAdminCommandHandler))] + public class ShowPos : ICommand + { + public string Command => "showposition"; + + public string[] Aliases => ["showpos"]; + + public string Description => "show pos"; + + public bool Execute(ArraySegment arguments, ICommandSender sender, out string response) + { + Player player = Player.Get(sender); + + + response = player.Position.ToString() + "\n" + + player.CurrentRoom?.Position + "\n" + + (player.CurrentRoom?.Position - player.Position); + + return true; + } + } +} diff --git a/KruacentExiled/KE.Map/Surface/Rooms/SurfaceArmory.cs b/KruacentExiled/KE.Map/Surface/Rooms/SurfaceArmory.cs new file mode 100644 index 00000000..4b1d56f5 --- /dev/null +++ b/KruacentExiled/KE.Map/Surface/Rooms/SurfaceArmory.cs @@ -0,0 +1,14 @@ +using System.Collections.Generic; +using UnityEngine; + +namespace KE.Map.Surface.Rooms +{ + public class SurfaceArmory : SurfaceRoom + { + protected override string RoomName => "Armory"; + + + + + } +} diff --git a/KruacentExiled/KE.Map/Surface/Rooms/SurfaceRoom.cs b/KruacentExiled/KE.Map/Surface/Rooms/SurfaceRoom.cs new file mode 100644 index 00000000..e2dcb27f --- /dev/null +++ b/KruacentExiled/KE.Map/Surface/Rooms/SurfaceRoom.cs @@ -0,0 +1,17 @@ +using HintServiceMeow.UI.Utilities; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace KE.Map.Surface.Rooms +{ + public abstract class SurfaceRoom + { + public const string ZoneName = "Surface"; + protected abstract string RoomName { get; } + public string Name => ZoneName + RoomName; + + } +} diff --git a/KruacentExiled/KE.Map/Surface/Rooms/SurfaceRooms.cs b/KruacentExiled/KE.Map/Surface/Rooms/SurfaceRooms.cs new file mode 100644 index 00000000..40ad8517 --- /dev/null +++ b/KruacentExiled/KE.Map/Surface/Rooms/SurfaceRooms.cs @@ -0,0 +1,52 @@ +using Exiled.API.Extensions; +using Exiled.API.Features; +using KE.Utils.API.Interfaces; +using Mirror; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using UnityEngine; + +namespace KE.Map.Surface.Rooms +{ + public class SurfaceRooms : IUsingEvents + { + + public static GameObject gameObject; + public static readonly HashSet Rooms = new() + { + new SurfaceArmory() + }; + public void SubscribeEvents() + { + //Exiled.Events.Handlers.Map.Generated += OnGenerated; + } + + public void UnsubscribeEvents() + { + //Exiled.Events.Handlers.Map.Generated -= OnGenerated; + + } + + private void OnGenerated() + { + + + Vector3 roomPos = Room.List.FirstOrDefault(x => x.Type == Exiled.API.Enums.RoomType.Surface).Position- new Vector3(-137, 4, 60); + SpawnRandomRoom(roomPos); + + + } + + + private void SpawnRandomRoom(Vector3 position) + { + SurfaceRoom bp = Rooms.GetRandomValue(); + + NetworkServer.Spawn(gameObject); + } + + } +} diff --git a/KruacentExiled/KE.Map/Utils/StructureSpawner.cs b/KruacentExiled/KE.Map/Utils/StructureSpawner.cs new file mode 100644 index 00000000..6e947c8d --- /dev/null +++ b/KruacentExiled/KE.Map/Utils/StructureSpawner.cs @@ -0,0 +1,177 @@ +using Interactables.Interobjects.DoorUtils; +using InventorySystem.Items.Firearms.Attachments; +using MapGeneration; +using MapGeneration.Distributors; +using Mirror; +using ProjectMER.Features; +using ProjectMER.Features.Enums; +using System; +using System.Collections.Generic; +using UnityEngine; + +namespace KE.Map.Utils +{ + public static class StructureSpawner + { + public static Dictionary> AdditionalDoors { get; } = new(); + + + + public static DoorVariant GetDoorPrefab(DoorType doortype) + { + return doortype switch + { + DoorType.Lcz => PrefabManager.DoorLcz, + DoorType.Hcz => PrefabManager.DoorHcz, + DoorType.Ez => PrefabManager.DoorEz, + DoorType.Bulkdoor => PrefabManager.DoorHeavyBulk, + DoorType.Gate => PrefabManager.DoorGate, + _ => throw new InvalidOperationException(), + }; + } + + public static MapGeneration.Distributors.Locker LockerPrefab(LockerType lockertype) + { + return lockertype switch + { + LockerType.PedestalScp500 => PrefabManager.PedestalScp500, + LockerType.LargeGun => PrefabManager.LockerLargeGun, + LockerType.RifleRack => PrefabManager.LockerRifleRack, + LockerType.Misc => PrefabManager.LockerMisc, + LockerType.Medkit => PrefabManager.LockerRegularMedkit, + LockerType.Adrenaline => PrefabManager.LockerAdrenalineMedkit, + LockerType.PedestalScp018 => PrefabManager.PedestalScp018, + LockerType.PedestalScp207 => PrefabManager.PedstalScp207, + LockerType.PedestalScp244 => PrefabManager.PedestalScp244, + LockerType.PedestalScp268 => PrefabManager.PedestalScp268, + LockerType.PedestalScp1853 => PrefabManager.PedstalScp1853, + LockerType.PedestalScp2176 => PrefabManager.PedestalScp2176, + LockerType.PedestalScpScp1576 => PrefabManager.PedestalScp1576, + LockerType.PedestalAntiScp207 => PrefabManager.PedestalAntiScp207, + LockerType.PedestalScp1344 => PrefabManager.PedestalScp1344, + LockerType.ExperimentalWeapon => PrefabManager.LockerExperimentalWeapon, + _ => throw new InvalidOperationException(), + }; + } + + + public static DoorVariant SpawnDoor(DoorType doortype,Vector3 position,Quaternion rotation, Vector3 scale) + { + DoorVariant doorVariant = CreateRawDoor(doortype, position, rotation, scale, true); + FacilityZone zone = doorVariant.transform.position.GetZone(); + + if (!AdditionalDoors.ContainsKey(zone)) + { + AdditionalDoors.Add(zone, new()); + } + AdditionalDoors[zone].Add(doorVariant); + + + + return doorVariant; + } + + public static DoorVariant CreateRawDoor(DoorType doortype, Vector3 position, Quaternion rotation, Vector3 scale, bool spawn = false) + { + Vector3 absolutePosition = position; + Quaternion absoluteRotation = rotation; + DoorVariant doorVariant = UnityEngine.Object.Instantiate(GetDoorPrefab(doortype)); + if (doorVariant.TryGetComponent(out var component)) + { + UnityEngine.Object.Destroy(component); + } + + doorVariant.transform.SetPositionAndRotation(absolutePosition, absoluteRotation); + doorVariant.transform.localScale = scale; + doorVariant.NetworkTargetState = false; + doorVariant.ServerChangeLock(DoorLockReason.SpecialDoorFeature, false); + doorVariant.RequiredPermissions = new DoorPermissionsPolicy(DoorPermissionFlags.None, false); + + NetworkServer.UnSpawn(doorVariant.gameObject); + if (spawn) + { + NetworkServer.Spawn(doorVariant.gameObject); + } + return doorVariant; + } + + public static MapGeneration.Distributors.Locker SpawnPedestal(ItemType item, Vector3 position, Quaternion rotation,Vector3? scale) + { + MapGeneration.Distributors.Locker locker = UnityEngine.Object.Instantiate(LockerPrefab(LockerType.PedestalScp500)); + Vector3 absolutePosition = position; + Quaternion absoluteRotation = rotation; + locker.transform.localScale = scale ?? Vector3.one; + locker.transform.SetPositionAndRotation(absolutePosition, absoluteRotation); + if (locker.TryGetComponent(out var component)) + { + component.Network_position = locker.transform.position; + component.Network_rotationY = (sbyte)Mathf.RoundToInt(locker.transform.rotation.eulerAngles.y / 5.625f); + } + + LabApi.Features.Wrappers.Locker labApiLocker = LabApi.Features.Wrappers.Locker.Get(locker); + + labApiLocker.ClearLockerLoot(); + + + labApiLocker.ClearAllChambers(); + NetworkServer.UnSpawn(locker.gameObject); + NetworkServer.Spawn(locker.gameObject); + + + + foreach (MapGeneration.Distributors.LockerChamber chamber in locker.Chambers) + { + chamber.SpawnItem(item, 1); + } + + return locker; + } + + public static WorkstationController SpawnWorkshop(Vector3 position, Quaternion rotation,Vector3 scale) + { + WorkstationController workstationController = UnityEngine.Object.Instantiate(PrefabManager.Workstation); + Vector3 absolutePosition = position; + Quaternion absoluteRotation = rotation; + workstationController.transform.SetPositionAndRotation(absolutePosition, absoluteRotation); + workstationController.transform.localScale = scale; + workstationController.NetworkStatus = (byte)0u; + if (workstationController.TryGetComponent(out var component)) + { + component.Network_position = workstationController.transform.position; + component.Network_rotationY = (sbyte)Mathf.RoundToInt(workstationController.transform.rotation.eulerAngles.y / 5.625f); + } + + NetworkServer.UnSpawn(workstationController.gameObject); + NetworkServer.Spawn(workstationController.gameObject); + return workstationController; + } + + + + + + + + [Obsolete("one day it'll work",true)] + public static BreakableWindow CreateWindow(Vector3 position, Quaternion rotation) + { + BreakableWindow br = null; + foreach (GameObject gameObject in NetworkClient.prefabs.Values) + { + if (gameObject.TryGetComponent(out var window)) + { + br = UnityEngine.Object.Instantiate(window); + } + } + + br.transform.SetPositionAndRotation(position, rotation); + br.transform.localScale = Vector3.one; + br.NetworkIsBroken = false; + + NetworkServer.UnSpawn(br.gameObject); + NetworkServer.Spawn(br.gameObject); + return br; + } + + } +} From ab7d009083d673a970bb9e6c7373bd48657e10d7 Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Mon, 13 Apr 2026 18:01:31 +0200 Subject: [PATCH 848/853] scp check old room --- KruacentExiled/KE.Map/Heavy/GamblingZone/OldGamblingRoom.cs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/KruacentExiled/KE.Map/Heavy/GamblingZone/OldGamblingRoom.cs b/KruacentExiled/KE.Map/Heavy/GamblingZone/OldGamblingRoom.cs index 3219da5a..114652e6 100644 --- a/KruacentExiled/KE.Map/Heavy/GamblingZone/OldGamblingRoom.cs +++ b/KruacentExiled/KE.Map/Heavy/GamblingZone/OldGamblingRoom.cs @@ -6,6 +6,7 @@ using Exiled.API.Features.Spawn; using Exiled.API.Features.Toys; using Exiled.Events.EventArgs.Player; +using KE.Utils.API.Features.SCPs; using PlayerRoles; using System.Collections.Generic; using System.Linq; @@ -79,6 +80,8 @@ public void OnDropped(DroppedItemEventArgs ev) Player player = ev.Player; if (player == null) return; if (ev.Pickup == null) return; + if (SCPTeam.IsSCP(player.ReferenceHub)) return; + if (!IsInGamblingRoom(player)) { Log.Debug($"player ({player.CustomName}) not in room ({player.Position})"); From 74a63b2145f47bce7db8069c0165eeb26031cd7a Mon Sep 17 00:00:00 2001 From: Patrique29 Date: Tue, 14 Apr 2026 22:38:53 +0200 Subject: [PATCH 849/853] refactored everything in one plugin --- KruacentExiled/IExiledTranslation.cs | 14 +++ .../KE.CustomRoles/API/Features/CustomSCP.cs | 2 +- .../API/Features/RecyclableSettingId.cs | 4 +- .../KE.CustomRoles/Abilities/Teleportation.cs | 2 +- .../KE.CustomRoles/CR/CustomSCPs/SCP035.cs | 4 +- .../KE.CustomRoles/KE.CustomRoles.csproj | 36 ------- KruacentExiled/KE.CustomRoles/MainPlugin.cs | 17 ++-- .../KE.GlobalEventFramework.Examples.csproj | 37 -------- .../MainPlugin.cs | 22 +++-- .../GEFE/API/Features/GlobalEvent.cs | 2 +- .../KE.GlobalEventFramework.csproj | 27 ------ .../KE.GlobalEventFramework/MainPlugin.cs | 18 ++-- .../Items/ItemEffects/TPGrenadaEffect.cs | 2 +- KruacentExiled/KE.Items/KE.Items.csproj | 34 ------- KruacentExiled/KE.Items/MainPlugin.cs | 29 ++---- .../Heavy/GamblingZone/DroppableItem.cs | 8 +- KruacentExiled/KE.Map/KE.Map.csproj | 37 -------- KruacentExiled/KE.Map/MainPlugin.cs | 24 +++-- KruacentExiled/KE.Misc/Features/Candy.cs | 2 +- KruacentExiled/KE.Misc/Features/ClassDDoor.cs | 2 +- .../Features/GamblingCoin/EventHandlers.cs | 2 +- KruacentExiled/KE.Misc/Features/SCPBuff.cs | 2 +- .../KE.Misc/Features/Spawn/Spawn.cs | 4 +- .../KE.Misc/Features/SurfaceLight.cs | 2 +- .../Features/VoteStart/ForceVoteNumber.cs | 6 +- .../KE.Misc/Features/VoteStart/RetractVote.cs | 2 +- .../KE.Misc/Features/VoteStart/VoteStart.cs | 4 +- .../KE.Misc/Handlers/ServerHandler.cs | 2 +- KruacentExiled/KE.Misc/MainPlugin.cs | 20 ++-- KruacentExiled/KEPlugin.cs | 37 ++++++++ .../KE.Misc.csproj => KruacentExiled.csproj} | 3 +- KruacentExiled/KruacentExiled.sln | 40 +------- KruacentExiled/MainPlugin.cs | 94 +++++++++++++++++++ 33 files changed, 253 insertions(+), 288 deletions(-) create mode 100644 KruacentExiled/IExiledTranslation.cs delete mode 100644 KruacentExiled/KE.CustomRoles/KE.CustomRoles.csproj delete mode 100644 KruacentExiled/KE.GlobalEventFramework.Examples/KE.GlobalEventFramework.Examples.csproj delete mode 100644 KruacentExiled/KE.GlobalEventFramework/KE.GlobalEventFramework.csproj delete mode 100644 KruacentExiled/KE.Items/KE.Items.csproj delete mode 100644 KruacentExiled/KE.Map/KE.Map.csproj create mode 100644 KruacentExiled/KEPlugin.cs rename KruacentExiled/{KE.Misc/KE.Misc.csproj => KruacentExiled.csproj} (90%) create mode 100644 KruacentExiled/MainPlugin.cs diff --git a/KruacentExiled/IExiledTranslation.cs b/KruacentExiled/IExiledTranslation.cs new file mode 100644 index 00000000..5edf884d --- /dev/null +++ b/KruacentExiled/IExiledTranslation.cs @@ -0,0 +1,14 @@ +using Exiled.API.Interfaces; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace KruacentExiled +{ + internal interface IExiledTranslation + { + public abstract ITranslation Translation { get; } + } +} diff --git a/KruacentExiled/KE.CustomRoles/API/Features/CustomSCP.cs b/KruacentExiled/KE.CustomRoles/API/Features/CustomSCP.cs index 62ee7a09..88eb4d41 100644 --- a/KruacentExiled/KE.CustomRoles/API/Features/CustomSCP.cs +++ b/KruacentExiled/KE.CustomRoles/API/Features/CustomSCP.cs @@ -19,7 +19,7 @@ public abstract class CustomSCP : KECustomRole protected abstract int SettingId { get; } private static HeaderSetting header = null; - private static int HeaderId => MainPlugin.Instance.Config.HeaderId; + private static int HeaderId => MainPlugin.Configs.HeaderId; private static SettingsCategory category; public static IEnumerable All => Registered.Where(c => c is CustomSCP).Cast(); diff --git a/KruacentExiled/KE.CustomRoles/API/Features/RecyclableSettingId.cs b/KruacentExiled/KE.CustomRoles/API/Features/RecyclableSettingId.cs index 6b69e86e..e7b36e58 100644 --- a/KruacentExiled/KE.CustomRoles/API/Features/RecyclableSettingId.cs +++ b/KruacentExiled/KE.CustomRoles/API/Features/RecyclableSettingId.cs @@ -16,8 +16,8 @@ public struct RecyclableSettingId : IEquatable private static Queue FreeIds = new Queue(); private static int _autoIncrement; - private static int Min => MainPlugin.Instance.Config.CustomScpSliderRangeMin; - private static int Max => MainPlugin.Instance.Config.CustomScpSliderRangeMax; + private static int Min => MainPlugin.Configs.CustomScpSliderRangeMin; + private static int Max => MainPlugin.Configs.CustomScpSliderRangeMax; public RecyclableSettingId(SettingBase setting) { diff --git a/KruacentExiled/KE.CustomRoles/Abilities/Teleportation.cs b/KruacentExiled/KE.CustomRoles/Abilities/Teleportation.cs index 5fd9475f..309f1f36 100644 --- a/KruacentExiled/KE.CustomRoles/Abilities/Teleportation.cs +++ b/KruacentExiled/KE.CustomRoles/Abilities/Teleportation.cs @@ -97,7 +97,7 @@ private bool CheckValid(Player player,bool showMessage) } - if (target.GetZone() == FacilityZone.LightContainment && Map.IsLczDecontaminated) + if (target.GetZone() == FacilityZone.LightContainment && Exiled.API.Features.Map.IsLczDecontaminated) { if (showMessage) { diff --git a/KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP035.cs b/KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP035.cs index 4f7f97f1..419554c5 100644 --- a/KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP035.cs +++ b/KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP035.cs @@ -179,7 +179,7 @@ protected override void RoleAdded(Player player) player.Position = RoleTypeId.Scp049.GetRandomSpawnLocation().Position; - player.EnableEffect(100, 0, false); + player.EnableEffect(100, 0, false); base.RoleAdded(player); } @@ -188,7 +188,7 @@ protected override void RoleRemoved(Player player) DisplayHandler.Instance.RemoveHint(player, position.HintPlacement); DisplayHandler.Instance.RemoveHint(player, logoposition.HintPlacement); - player.DisableEffect(); + player.DisableEffect(); base.RoleRemoved(player); } diff --git a/KruacentExiled/KE.CustomRoles/KE.CustomRoles.csproj b/KruacentExiled/KE.CustomRoles/KE.CustomRoles.csproj deleted file mode 100644 index 8c298ee6..00000000 --- a/KruacentExiled/KE.CustomRoles/KE.CustomRoles.csproj +++ /dev/null @@ -1,36 +0,0 @@ - - - 13.0 - net48 - - - - - - - - - - - - - - - - - - - - - - - - - - if not "$(EXILED_DEV_REFERENCES)"=="" copy /y "$(OutputPath)$(AssemblyName).dll" "$(EXILED_DEV_REFERENCES)\Plugins\" - - - if [[ ! -z "$EXILED_DEV_REFERENCES" ]]; then cp "$(OutputPath)$(AssemblyName).dll" "$EXILED_DEV_REFERENCES/Plugins/"; fi - - - diff --git a/KruacentExiled/KE.CustomRoles/MainPlugin.cs b/KruacentExiled/KE.CustomRoles/MainPlugin.cs index 08ec9811..680f090b 100644 --- a/KruacentExiled/KE.CustomRoles/MainPlugin.cs +++ b/KruacentExiled/KE.CustomRoles/MainPlugin.cs @@ -15,6 +15,7 @@ using KE.Utils.API.Displays.DisplayMeow; using KE.Utils.API.Features.SCPs; using KE.Utils.API.GifAnimator; +using KruacentExiled; using MEC; using Microsoft.Win32; using System; @@ -27,14 +28,12 @@ namespace KE.CustomRoles { - public class MainPlugin : Plugin + public class MainPlugin : KEPlugin { public override string Name => "KE.CustomRoles"; public override string Prefix => "KE.CR"; - public override string Author => "Patrique & OmerGS"; - public override Version Version => new(1, 1, 0); public static MainPlugin Instance; - public static Config Configs => Instance?.Config; + public static Config Configs => (Config) Instance?.Config; public static readonly HintPlacement CRHint = new(0, 750); public static readonly HintPlacement CREffect = new(700, 300); public static readonly HintPlacement AbilitiesDesc = new(0, 900); @@ -48,10 +47,14 @@ public class MainPlugin : Plugin internal Dictionary icons; public static readonly string ImageLocation = Paths.Configs + "/Img/"; + + public override IConfig Config => config; + private IConfig config = null; public override void OnEnabled() { - Instance = this; + config = KruacentExiled.MainPlugin.Instance.Config.CustomRoleConfig; + _settingHandler = new(); Utils.API.Settings.GlobalSettings.GlobalSettingsHandler.Instance.TryLoad(); Utils.API.Settings.GlobalSettings.GlobalSettingsHandler.Instance.SubscribeEvents(); @@ -68,10 +71,9 @@ public override void OnEnabled() Harmony = new(Name); Harmony.PatchAll(); SettingHandler.SubscribeEvents(); - KEAbilities.Register(Assembly); + KEAbilities.Register(KruacentExiled.MainPlugin.Instance.Assembly); KECustomRole.Register(); SubscribeEvents(); - base.OnEnabled(); } public override void OnDisabled() @@ -88,7 +90,6 @@ public override void OnDisabled() Utils.API.Settings.GlobalSettings.GlobalSettingsHandler.Instance.UnsubscribeEvents(); _settingHandler = null; Instance = null; - base.OnDisabled(); } public void SubscribeEvents() diff --git a/KruacentExiled/KE.GlobalEventFramework.Examples/KE.GlobalEventFramework.Examples.csproj b/KruacentExiled/KE.GlobalEventFramework.Examples/KE.GlobalEventFramework.Examples.csproj deleted file mode 100644 index 92f63b97..00000000 --- a/KruacentExiled/KE.GlobalEventFramework.Examples/KE.GlobalEventFramework.Examples.csproj +++ /dev/null @@ -1,37 +0,0 @@ - - - - 13.0 - net48 - - - - - - - - - - - - - - - - - - - - - - - - - - if not "$(EXILED_DEV_REFERENCES)"=="" copy /y "$(OutputPath)$(AssemblyName).dll" "$(EXILED_DEV_REFERENCES)\Plugins\" - - - if [[ ! -z "$EXILED_DEV_REFERENCES" ]]; then cp "$(OutputPath)$(AssemblyName).dll" "$EXILED_DEV_REFERENCES/Plugins/"; fi - - - diff --git a/KruacentExiled/KE.GlobalEventFramework.Examples/MainPlugin.cs b/KruacentExiled/KE.GlobalEventFramework.Examples/MainPlugin.cs index 8af34292..6ec91f79 100644 --- a/KruacentExiled/KE.GlobalEventFramework.Examples/MainPlugin.cs +++ b/KruacentExiled/KE.GlobalEventFramework.Examples/MainPlugin.cs @@ -4,30 +4,33 @@ using System.Runtime.InteropServices; using Exiled.API.Enums; using Exiled.API.Features; +using Exiled.API.Interfaces; using HarmonyLib; +using KruacentExiled; using MEC; using UnityEngine; namespace KE.GlobalEventFramework.Examples { - internal class MainPlugin : Plugin + internal class MainPlugin : KEPlugin { - public override string Author => "Patrique & OmerGS"; - public override Version Version => new Version(1, 0, 0); public override string Name => "KE.GEF.Examples"; public override string Prefix => "KE.GEFE"; public static MainPlugin Instance { get; private set; } private static Harmony Harmony; - public override PluginPriority Priority => PluginPriority.Lower; - - + + public override IConfig Config => config; + private Config config; + public static Config Configs => Instance?.config; + public override void OnEnabled() { + config = KruacentExiled.MainPlugin.Instance.Config.GEFEConfig; Instance = this; Utils.API.Sounds.SoundPlayer.Load(); Exiled.Events.Handlers.Server.WaitingForPlayers += OnWaitingPlayer; @@ -66,4 +69,11 @@ public override void OnDisabled() Harmony = null; } } + + + public class Config : IConfig + { + public bool IsEnabled { get; set; } = true; + public bool Debug { get; set; } = false; + } } diff --git a/KruacentExiled/KE.GlobalEventFramework/GEFE/API/Features/GlobalEvent.cs b/KruacentExiled/KE.GlobalEventFramework/GEFE/API/Features/GlobalEvent.cs index 91214bd9..be094167 100644 --- a/KruacentExiled/KE.GlobalEventFramework/GEFE/API/Features/GlobalEvent.cs +++ b/KruacentExiled/KE.GlobalEventFramework/GEFE/API/Features/GlobalEvent.cs @@ -68,7 +68,7 @@ private void OnRoundStarted() } - private static Config Config => MainPlugin.Instance.Config; + private static Config Config => MainPlugin.Configs; private static GlobalEventHandler _handler = new(); private static HashSet _activeGE = new(); diff --git a/KruacentExiled/KE.GlobalEventFramework/KE.GlobalEventFramework.csproj b/KruacentExiled/KE.GlobalEventFramework/KE.GlobalEventFramework.csproj deleted file mode 100644 index a5391b1e..00000000 --- a/KruacentExiled/KE.GlobalEventFramework/KE.GlobalEventFramework.csproj +++ /dev/null @@ -1,27 +0,0 @@ - - - - 13.0 - net48 - - - - - - - - - - - - - - - - if not "$(EXILED_DEV_REFERENCES)"=="" copy /y "$(OutputPath)$(AssemblyName).dll" "$(EXILED_DEV_REFERENCES)\Plugins\" - - - if [[ ! -z "$EXILED_DEV_REFERENCES" ]]; then cp "$(OutputPath)$(AssemblyName).dll" "$EXILED_DEV_REFERENCES/Plugins/"; fi - - - diff --git a/KruacentExiled/KE.GlobalEventFramework/MainPlugin.cs b/KruacentExiled/KE.GlobalEventFramework/MainPlugin.cs index e0bbf325..7ae7ed15 100644 --- a/KruacentExiled/KE.GlobalEventFramework/MainPlugin.cs +++ b/KruacentExiled/KE.GlobalEventFramework/MainPlugin.cs @@ -3,15 +3,14 @@ using Exiled.API.Enums; using KE.GlobalEventFramework.GEFE.API.Features; using KE.Utils.API.Displays.DisplayMeow; +using KruacentExiled; +using Exiled.API.Interfaces; namespace KE.GlobalEventFramework { - internal class MainPlugin : Plugin + internal class MainPlugin : KEPlugin { - public override string Author => "Patrique"; public override string Name => "KE.GEFramework"; public override string Prefix => "KE.GEF"; - public override Version Version => new Version(2, 0, 0); - public override PluginPriority Priority => PluginPriority.Highest; @@ -19,24 +18,25 @@ internal class MainPlugin : Plugin public static readonly HintPlacement GEEffect = new(360, 300, HintServiceMeow.Core.Enum.HintAlignment.Right); - internal static MainPlugin Instance {get;private set;} + internal static MainPlugin Instance { get; private set;} + public override IConfig Config => config; + private Config config; + public static Config Configs => Instance?.config; - public override void OnEnabled() + public override void OnEnabled() { - + config = KruacentExiled.MainPlugin.Instance.Config.GEFConfig; Instance = this; KEEvents.OnEnabled(); - base.OnEnabled(); } public override void OnDisabled() { KEEvents.OnDisabled(); - base.OnDisabled(); Instance = null; } diff --git a/KruacentExiled/KE.Items/Items/ItemEffects/TPGrenadaEffect.cs b/KruacentExiled/KE.Items/Items/ItemEffects/TPGrenadaEffect.cs index f6bc2577..d7b1cbe5 100644 --- a/KruacentExiled/KE.Items/Items/ItemEffects/TPGrenadaEffect.cs +++ b/KruacentExiled/KE.Items/Items/ItemEffects/TPGrenadaEffect.cs @@ -86,7 +86,7 @@ private Room RandomRoom() return ZoneType.Surface.RandomSafeRoom(); } - if (Map.IsLczDecontaminated) + if (Exiled.API.Features.Map.IsLczDecontaminated) { float random = UnityEngine.Random.value; Log.Debug($"random={random}"); diff --git a/KruacentExiled/KE.Items/KE.Items.csproj b/KruacentExiled/KE.Items/KE.Items.csproj deleted file mode 100644 index f22e6e05..00000000 --- a/KruacentExiled/KE.Items/KE.Items.csproj +++ /dev/null @@ -1,34 +0,0 @@ - - - - 13.0 - net48 - - - - - - - - - - - - - - - - - - - - - - - if not "$(EXILED_DEV_REFERENCES)"=="" copy /y "$(OutputPath)$(AssemblyName).dll" "$(EXILED_DEV_REFERENCES)\Plugins\" - - - if [[ ! -z "$EXILED_DEV_REFERENCES" ]]; then cp "$(OutputPath)$(AssemblyName).dll" "$EXILED_DEV_REFERENCES/Plugins/"; fi - - - diff --git a/KruacentExiled/KE.Items/MainPlugin.cs b/KruacentExiled/KE.Items/MainPlugin.cs index 2de0365b..38331eac 100644 --- a/KruacentExiled/KE.Items/MainPlugin.cs +++ b/KruacentExiled/KE.Items/MainPlugin.cs @@ -1,33 +1,21 @@ - -using AdminToys; -using Exiled.API.Enums; +using Exiled.API.Enums; using Exiled.API.Features; -using Exiled.API.Features.Toys; -using Exiled.CustomItems.API.Features; -using Exiled.Events.EventArgs.Map; -using Exiled.Events.EventArgs.Player; +using Exiled.API.Interfaces; using HarmonyLib; -using InventorySystem.Items.ThrowableProjectiles; using KE.Items.API.Core.Lights; using KE.Items.API.Core.Settings; using KE.Items.API.Core.Upgrade; -using KE.Items.API.Events; using KE.Items.API.Features; -using KE.Items.API.Features.Complexes; using KE.Items.API.Features.SpawnPoints; using KE.Utils.API.Displays.DisplayMeow; -using KE.Utils.API.Features; +using KruacentExiled; using System; -using System.Linq; using UnityEngine; -using static PlayerRoles.Spectating.SpectatableModuleBase; -using InteractableToy = LabApi.Features.Wrappers.InteractableToy; namespace KE.Items { - public class MainPlugin : Plugin + public class MainPlugin : KEPlugin { - public override string Author => "Patrique & OmerGS"; public override string Name => "KE.Items"; public override string Prefix => "KE.I"; internal UpgradeHandler UpgradeHandler { get; private set; } @@ -35,18 +23,20 @@ public class MainPlugin : Plugin internal static MainPlugin Instance { get; private set; } internal SettingsHandler SettingsHandler { get; private set; } + public override IConfig Config => config; + private IConfig config; + internal static readonly HintPlacement ItemEffectPlacement = new(0, 200, HintServiceMeow.Core.Enum.HintAlignment.Center); internal static readonly HintPlacement HintPlacement = new(0, 400, HintServiceMeow.Core.Enum.HintAlignment.Center); - public override PluginPriority Priority => PluginPriority.Low; - public override Version Version => new (1, 0, 0); internal Harmony harmony; public override void OnEnabled() { Instance = this; + config = KruacentExiled.MainPlugin.Instance.Config.CustomItemConfig; harmony = new(Name); - harmony.PatchAll(Assembly); + harmony.PatchAll(KruacentExiled.MainPlugin.Instance.Assembly); UpgradeHandler = new UpgradeHandler(); LightsHandler = new LightsHandler(); SettingsHandler = new(); @@ -90,7 +80,6 @@ public override void OnEnabled() UpgradeHandler.SubscribeEvents(); LightsHandler.SubscribeEvents(); Exiled.Events.Handlers.Map.Generated += OnGenerated; - base.OnEnabled(); } public override void OnDisabled() diff --git a/KruacentExiled/KE.Map/Heavy/GamblingZone/DroppableItem.cs b/KruacentExiled/KE.Map/Heavy/GamblingZone/DroppableItem.cs index ad0f5363..bb5012f3 100644 --- a/KruacentExiled/KE.Map/Heavy/GamblingZone/DroppableItem.cs +++ b/KruacentExiled/KE.Map/Heavy/GamblingZone/DroppableItem.cs @@ -1,6 +1,6 @@ -using Items = Exiled.API.Features.Items.Item; -using System; +using System; using UnityEngine; +using ExiledItem = Exiled.API.Features.Items.Item; using Exiled.API.Features.Items; namespace KE.Map.Heavy.GamblingZone @@ -49,11 +49,11 @@ public bool Equals(DroppableItem other) return other.Item == Item && other.Chance == Chance && other.ItemCap == ItemCap && CurrentCap == other.CurrentCap; } - public Items GetItem() + public ExiledItem GetItem() { if (HasReachCap()) throw new Exception("Cap reached"); CurrentCap++; - return Items.Create(Item); + return ExiledItem.Create(Item); } public bool HasReachCap() diff --git a/KruacentExiled/KE.Map/KE.Map.csproj b/KruacentExiled/KE.Map/KE.Map.csproj deleted file mode 100644 index 33dbb476..00000000 --- a/KruacentExiled/KE.Map/KE.Map.csproj +++ /dev/null @@ -1,37 +0,0 @@ - - - - 13.0 - net48 - - - - - - - - - - - - - - - - - - - - - - - - - - if not "$(EXILED_DEV_REFERENCES)"=="" copy /y "$(OutputPath)$(AssemblyName).dll" "$(EXILED_DEV_REFERENCES)\Plugins\" - - - if [[ ! -z "$EXILED_DEV_REFERENCES" ]]; then cp "$(OutputPath)$(AssemblyName).dll" "$EXILED_DEV_REFERENCES/Plugins/"; fi - - - diff --git a/KruacentExiled/KE.Map/MainPlugin.cs b/KruacentExiled/KE.Map/MainPlugin.cs index 9407800a..827c2de6 100644 --- a/KruacentExiled/KE.Map/MainPlugin.cs +++ b/KruacentExiled/KE.Map/MainPlugin.cs @@ -14,6 +14,7 @@ using KE.Utils.API.Features; using KE.Utils.API.KETextToy; using KE.Utils.Extensions; +using KruacentExiled; using MEC; using PlayerRoles; using PlayerRoles.PlayableScps.Scp106; @@ -23,28 +24,40 @@ using System.IO; using System.Linq; using UnityEngine; +using static PlayerList; using Door = Exiled.API.Features.Doors.Door; using Player = Exiled.API.Features.Player; namespace KE.Map { - public class MainPlugin : Plugin + public class MainPlugin : KEPlugin { public override string Name => "KE.Map"; public override string Prefix => "KE.M"; public static MainPlugin Instance { get; private set; } private Handler handler; - public static Translations Translations => Instance?.Translation; - public static Config Configs => Instance?.Config; + public static Translations Translations { get; } = new Translations(); + public static Config Configs => (Config) Instance?.Config; + + public override IConfig Config => config; + private Config config; private Harmony harmony; private SurfaceRooms SurfaceRooms; private CREventHandler cREventHandler; + + + private Translations translations; + public override void OnEnabled() { + Instance = this; handler = new(); harmony = new(Prefix); + config = KruacentExiled.MainPlugin.Instance.Config.MapConfig; + + cREventHandler = new(); cREventHandler.SubscribeEvents(); @@ -60,14 +73,13 @@ public override void OnEnabled() GamblingRoom.SubscribeEvents(); //MoreRoom.CreateAll(); //MoreRoom.SubscribeEvents(); - harmony.PatchAll(Assembly); + harmony.PatchAll(KruacentExiled.MainPlugin.Instance.Assembly); - Instance = this; - base.OnEnabled(); + } private void OnWaitingForPlayers() diff --git a/KruacentExiled/KE.Misc/Features/Candy.cs b/KruacentExiled/KE.Misc/Features/Candy.cs index b78fd830..d58d400e 100644 --- a/KruacentExiled/KE.Misc/Features/Candy.cs +++ b/KruacentExiled/KE.Misc/Features/Candy.cs @@ -23,7 +23,7 @@ public override void UnsubscribeEvents() } public void InteractingScp330(InteractingScp330EventArgs ev) { - if (UnityEngine.Random.Range(0, 100) < MainPlugin.Instance.Config.ChancePinkCandy) + if (UnityEngine.Random.Range(0, 100) < MainPlugin.Configs.ChancePinkCandy) { ev.Candy = CandyKindID.Pink; } diff --git a/KruacentExiled/KE.Misc/Features/ClassDDoor.cs b/KruacentExiled/KE.Misc/Features/ClassDDoor.cs index e8d1ef5b..c7cd01db 100644 --- a/KruacentExiled/KE.Misc/Features/ClassDDoor.cs +++ b/KruacentExiled/KE.Misc/Features/ClassDDoor.cs @@ -30,7 +30,7 @@ public void UnsubscribeEvents() private void OnRoundStarted() { - if(UnityEngine.Random.Range(0, 101) < MainPlugin.Instance.Config.ChanceClassDDoorGoesBoom) + if(UnityEngine.Random.Range(0, 101) < MainPlugin.Configs.ChanceClassDDoorGoesBoom) { HumanDoorsGoesBoom(); } diff --git a/KruacentExiled/KE.Misc/Features/GamblingCoin/EventHandlers.cs b/KruacentExiled/KE.Misc/Features/GamblingCoin/EventHandlers.cs index 646b532f..a1d31ce5 100644 --- a/KruacentExiled/KE.Misc/Features/GamblingCoin/EventHandlers.cs +++ b/KruacentExiled/KE.Misc/Features/GamblingCoin/EventHandlers.cs @@ -14,7 +14,7 @@ namespace KE.Misc.Features.GamblingCoin { public class EventHandlers { - private static Config Config => MainPlugin.Instance.Config; + private static Config Config => MainPlugin.Configs; private readonly Dictionary _cooldowns = new(); public static Dictionary CoinUses = new(); diff --git a/KruacentExiled/KE.Misc/Features/SCPBuff.cs b/KruacentExiled/KE.Misc/Features/SCPBuff.cs index d6af7ebe..56df544f 100644 --- a/KruacentExiled/KE.Misc/Features/SCPBuff.cs +++ b/KruacentExiled/KE.Misc/Features/SCPBuff.cs @@ -20,7 +20,7 @@ public class SCPBuff : IUsingEvents { public const float RefreshRate = 1f; public float IncreaseSCPHealth { get; } = 1.25f; - private static Config Config => MainPlugin.Instance.Config; + private static Config Config => MainPlugin.Configs; public Dictionary RoleBuff = new() { diff --git a/KruacentExiled/KE.Misc/Features/Spawn/Spawn.cs b/KruacentExiled/KE.Misc/Features/Spawn/Spawn.cs index 020ba764..151576b4 100644 --- a/KruacentExiled/KE.Misc/Features/Spawn/Spawn.cs +++ b/KruacentExiled/KE.Misc/Features/Spawn/Spawn.cs @@ -35,7 +35,7 @@ public class Spawn : MiscFeature private void OnRoundStarted() { - if (!MainPlugin.Instance.Config.ScpPreferences) return; + if (!MainPlugin.Configs.ScpPreferences) return; eventarg = new(); @@ -49,7 +49,7 @@ private void OnRoundStarted() private bool SetScpPreferences(Player player) { - Config config = MainPlugin.Instance.Config; + Config config = MainPlugin.Configs; if (config == null) { Log.Warn("no config, no custom preferences this round"); diff --git a/KruacentExiled/KE.Misc/Features/SurfaceLight.cs b/KruacentExiled/KE.Misc/Features/SurfaceLight.cs index 3dac8f25..186d1c8d 100644 --- a/KruacentExiled/KE.Misc/Features/SurfaceLight.cs +++ b/KruacentExiled/KE.Misc/Features/SurfaceLight.cs @@ -47,7 +47,7 @@ public override void UnsubscribeEvents() private void OnRoundStarted() { - if (!MainPlugin.Instance.Config.SurfaceLight) + if (!MainPlugin.Configs.SurfaceLight) { return; } diff --git a/KruacentExiled/KE.Misc/Features/VoteStart/ForceVoteNumber.cs b/KruacentExiled/KE.Misc/Features/VoteStart/ForceVoteNumber.cs index 2729ba13..99071762 100644 --- a/KruacentExiled/KE.Misc/Features/VoteStart/ForceVoteNumber.cs +++ b/KruacentExiled/KE.Misc/Features/VoteStart/ForceVoteNumber.cs @@ -27,7 +27,7 @@ public bool Execute(ArraySegment arguments, ICommandSender sender, out s if(arguments.Count < 1) { - response = "current min number : "+ MainPlugin.Instance.Config.MinPlayerVote; + response = "current min number : "+ MainPlugin.Configs.MinPlayerVote; return true; } @@ -41,10 +41,10 @@ public bool Execute(ArraySegment arguments, ICommandSender sender, out s - MainPlugin.Instance.Config.MinPlayerVote = result; + MainPlugin.Configs.MinPlayerVote = result; - response = "vote set at " + MainPlugin.Instance.Config.MinPlayerVote + " players"; + response = "vote set at " + MainPlugin.Configs.MinPlayerVote + " players"; return true; } } diff --git a/KruacentExiled/KE.Misc/Features/VoteStart/RetractVote.cs b/KruacentExiled/KE.Misc/Features/VoteStart/RetractVote.cs index b2f9f4c8..39f692c1 100644 --- a/KruacentExiled/KE.Misc/Features/VoteStart/RetractVote.cs +++ b/KruacentExiled/KE.Misc/Features/VoteStart/RetractVote.cs @@ -42,7 +42,7 @@ public override bool ExecuteCommand(ArraySegment arguments, ICommandSend vote.CancelVote(player); - response = "vote set at " + MainPlugin.Instance.Config.MinPlayerVote + " players"; + response = "vote set at " + MainPlugin.Configs.MinPlayerVote + " players"; return true; } } diff --git a/KruacentExiled/KE.Misc/Features/VoteStart/VoteStart.cs b/KruacentExiled/KE.Misc/Features/VoteStart/VoteStart.cs index f0f30b34..d155daad 100644 --- a/KruacentExiled/KE.Misc/Features/VoteStart/VoteStart.cs +++ b/KruacentExiled/KE.Misc/Features/VoteStart/VoteStart.cs @@ -107,7 +107,7 @@ private void OnVoiceChatting(VoiceChattingEventArgs ev) } Voted.Add(ev.Player); - if (Voted.Count >= MainPlugin.Instance.Config.MinPlayerVote) + if (Voted.Count >= MainPlugin.Configs.MinPlayerVote) { Log.Info("starting the round"); Round.IsLobbyLocked = false; @@ -155,7 +155,7 @@ private string GetPlayers(Player player) sb.Append(Voted.Count); sb.Append("/"); - sb.Append(MainPlugin.Instance.Config.MinPlayerVote); + sb.Append(MainPlugin.Configs.MinPlayerVote); sb.AppendLine(") : "); foreach (Player other in Voted) diff --git a/KruacentExiled/KE.Misc/Handlers/ServerHandler.cs b/KruacentExiled/KE.Misc/Handlers/ServerHandler.cs index b14fcc6e..de94f8bd 100644 --- a/KruacentExiled/KE.Misc/Handlers/ServerHandler.cs +++ b/KruacentExiled/KE.Misc/Handlers/ServerHandler.cs @@ -7,7 +7,7 @@ internal class ServerHandler { public void OnRoundStarted() { - if (MainPlugin.Instance.Config.AutoElevator) + if (MainPlugin.Configs.AutoElevator) MainPlugin.Instance.AutoElevator.StartLoop(); MainPlugin.Instance.AutoTesla.StartLoop(); diff --git a/KruacentExiled/KE.Misc/MainPlugin.cs b/KruacentExiled/KE.Misc/MainPlugin.cs index 4bc56ca9..7908fbfb 100644 --- a/KruacentExiled/KE.Misc/MainPlugin.cs +++ b/KruacentExiled/KE.Misc/MainPlugin.cs @@ -16,16 +16,18 @@ using KE.Misc.Features.PostNuke; using Exiled.Events.EventArgs.Server; using KE.Misc.Features.LobbyHints; +using KruacentExiled; +using Exiled.API.Interfaces; namespace KE.Misc { - public class MainPlugin : Plugin, ILocalizable + public class MainPlugin : KEPlugin, ILocalizable { - public override string Author => "Patrique & OmerGS"; public override string Name => "KE.Misc"; public override string Prefix => "KE.Misc"; - public override Version Version => new Version(1, 1, 0); + + internal static MainPlugin Instance { get; private set; } private ServerHandler ServerHandler; internal _914 _914 { get; private set; } @@ -49,11 +51,17 @@ public class MainPlugin : Plugin, ILocalizable public string LocalizationId => Prefix; + public override IConfig Config => config; + public static Config Configs => Instance?.config; + private Config config; + public override void OnEnabled() { Instance = this; harmony = new(Prefix); + config = KruacentExiled.MainPlugin.Instance.Config.MiscConfig; + _914 = new _914(); AutoElevator = new AutoElevator(); ClassDDoor = new ClassDDoor(); @@ -77,12 +85,12 @@ public override void OnEnabled() GlobalSettingsHandler.Instance.SubscribeEvents(); RegisterTranslations(); - harmony.PatchAll(Assembly); + harmony.PatchAll(KruacentExiled.MainPlugin.Instance.Assembly); ClassDDoor.SubscribeEvents(); ServerHandle.RoundEnded += OnRoundEnded; MiscFeature.SubscribeAllEvents(); AutoNukeAnnoucement.SubscribeEvents(); - if (Config.GamblingCoin) + if (Configs.GamblingCoin) { GamblingCoinManager.RegisterAll(); _gamblingCoinHandler = new EventHandlers(); @@ -105,7 +113,7 @@ public override void OnDisabled() AutoNukeAnnoucement.UnsubscribeEvents(); LastHuman.UnsubscribeEvents(); SCPBuff.UnsubscribeEvents(); - if (Config.GamblingCoin) + if (Configs.GamblingCoin) { Exiled.Events.Handlers.Player.FlippingCoin -= _gamblingCoinHandler.OnCoinFlip; } diff --git a/KruacentExiled/KEPlugin.cs b/KruacentExiled/KEPlugin.cs new file mode 100644 index 00000000..6766c11a --- /dev/null +++ b/KruacentExiled/KEPlugin.cs @@ -0,0 +1,37 @@ +using Exiled.API.Features; +using Exiled.API.Interfaces; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace KruacentExiled +{ + public abstract class KEPlugin + { + public abstract string Name { get; } + public abstract string Prefix { get; } + + + + public abstract IConfig Config { get; } + + + public void InternalOnEnabled() + { + if (Config.IsEnabled) + { + OnEnabled(); + + Log.Send(Name + " has been enabled!", Discord.LogLevel.Info, ConsoleColor.DarkYellow); + } + + + } + public abstract void OnEnabled(); + public abstract void OnDisabled(); + + + } +} diff --git a/KruacentExiled/KE.Misc/KE.Misc.csproj b/KruacentExiled/KruacentExiled.csproj similarity index 90% rename from KruacentExiled/KE.Misc/KE.Misc.csproj rename to KruacentExiled/KruacentExiled.csproj index 49449a48..8378a987 100644 --- a/KruacentExiled/KE.Misc/KE.Misc.csproj +++ b/KruacentExiled/KruacentExiled.csproj @@ -21,8 +21,9 @@ - + +
diff --git a/KruacentExiled/KruacentExiled.sln b/KruacentExiled/KruacentExiled.sln index b33298e0..116a4e44 100644 --- a/KruacentExiled/KruacentExiled.sln +++ b/KruacentExiled/KruacentExiled.sln @@ -3,17 +3,7 @@ Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio Version 17 VisualStudioVersion = 17.12.35506.116 MinimumVisualStudioVersion = 10.0.40219.1 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "KE.GlobalEventFramework", "KE.GlobalEventFramework\KE.GlobalEventFramework.csproj", "{73D6C740-96DE-4965-898F-DDD5BCBF7366}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "KE.Items", "KE.Items\KE.Items.csproj", "{87D91720-B7B5-4FB7-AB18-FB6E70AC0D68}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "KE.Map", "KE.Map\KE.Map.csproj", "{2BD019AC-1B86-4E00-B418-BE4C06CD8410}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "KE.GlobalEventFramework.Examples", "KE.GlobalEventFramework.Examples\KE.GlobalEventFramework.Examples.csproj", "{07B92E87-F48F-4F9F-BA0E-1BCB2AF52F53}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "KE.Misc", "KE.Misc\KE.Misc.csproj", "{378DD640-986B-4DA9-8C65-8D318E99E98C}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "KE.CustomRoles", "KE.CustomRoles\KE.CustomRoles.csproj", "{33CC074C-06DD-4545-91F2-F668F3C4779D}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "KruacentExiled", "KruacentExiled.csproj", "{AD0EAD9B-B7D2-954E-31B2-E78DC28B2D9C}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -21,30 +11,10 @@ Global Release|Any CPU = Release|Any CPU EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution - {73D6C740-96DE-4965-898F-DDD5BCBF7366}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {73D6C740-96DE-4965-898F-DDD5BCBF7366}.Debug|Any CPU.Build.0 = Debug|Any CPU - {73D6C740-96DE-4965-898F-DDD5BCBF7366}.Release|Any CPU.ActiveCfg = Release|Any CPU - {73D6C740-96DE-4965-898F-DDD5BCBF7366}.Release|Any CPU.Build.0 = Release|Any CPU - {87D91720-B7B5-4FB7-AB18-FB6E70AC0D68}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {87D91720-B7B5-4FB7-AB18-FB6E70AC0D68}.Debug|Any CPU.Build.0 = Debug|Any CPU - {87D91720-B7B5-4FB7-AB18-FB6E70AC0D68}.Release|Any CPU.ActiveCfg = Release|Any CPU - {87D91720-B7B5-4FB7-AB18-FB6E70AC0D68}.Release|Any CPU.Build.0 = Release|Any CPU - {2BD019AC-1B86-4E00-B418-BE4C06CD8410}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {2BD019AC-1B86-4E00-B418-BE4C06CD8410}.Debug|Any CPU.Build.0 = Debug|Any CPU - {2BD019AC-1B86-4E00-B418-BE4C06CD8410}.Release|Any CPU.ActiveCfg = Release|Any CPU - {2BD019AC-1B86-4E00-B418-BE4C06CD8410}.Release|Any CPU.Build.0 = Release|Any CPU - {07B92E87-F48F-4F9F-BA0E-1BCB2AF52F53}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {07B92E87-F48F-4F9F-BA0E-1BCB2AF52F53}.Debug|Any CPU.Build.0 = Debug|Any CPU - {07B92E87-F48F-4F9F-BA0E-1BCB2AF52F53}.Release|Any CPU.ActiveCfg = Release|Any CPU - {07B92E87-F48F-4F9F-BA0E-1BCB2AF52F53}.Release|Any CPU.Build.0 = Release|Any CPU - {378DD640-986B-4DA9-8C65-8D318E99E98C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {378DD640-986B-4DA9-8C65-8D318E99E98C}.Debug|Any CPU.Build.0 = Debug|Any CPU - {378DD640-986B-4DA9-8C65-8D318E99E98C}.Release|Any CPU.ActiveCfg = Release|Any CPU - {378DD640-986B-4DA9-8C65-8D318E99E98C}.Release|Any CPU.Build.0 = Release|Any CPU - {33CC074C-06DD-4545-91F2-F668F3C4779D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {33CC074C-06DD-4545-91F2-F668F3C4779D}.Debug|Any CPU.Build.0 = Debug|Any CPU - {33CC074C-06DD-4545-91F2-F668F3C4779D}.Release|Any CPU.ActiveCfg = Release|Any CPU - {33CC074C-06DD-4545-91F2-F668F3C4779D}.Release|Any CPU.Build.0 = Release|Any CPU + {AD0EAD9B-B7D2-954E-31B2-E78DC28B2D9C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {AD0EAD9B-B7D2-954E-31B2-E78DC28B2D9C}.Debug|Any CPU.Build.0 = Debug|Any CPU + {AD0EAD9B-B7D2-954E-31B2-E78DC28B2D9C}.Release|Any CPU.ActiveCfg = Release|Any CPU + {AD0EAD9B-B7D2-954E-31B2-E78DC28B2D9C}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/KruacentExiled/MainPlugin.cs b/KruacentExiled/MainPlugin.cs new file mode 100644 index 00000000..3e2a9878 --- /dev/null +++ b/KruacentExiled/MainPlugin.cs @@ -0,0 +1,94 @@ +using Exiled.API.Features; +using Exiled.API.Interfaces; +using KE.CustomRoles.API.Features; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace KruacentExiled +{ + internal class MainPlugin : Plugin + { + + private KEPlugin[] plugins; + public override string Author => "Patrique & OmerGS"; + public override Version Version { get; } = new(2, 0, 0); + + public static MainPlugin Instance { get; private set; } + + + public override void OnEnabled() + { + Instance = this; + + plugins = + [ + new KE.CustomRoles.MainPlugin(), + new KE.GlobalEventFramework.MainPlugin(), + new KE.GlobalEventFramework.Examples.MainPlugin(), + new KE.Items.MainPlugin(), + new KE.Misc.MainPlugin(), + new KE.Map.MainPlugin(), + + ]; + + + + for (int i = 0; i < plugins.Length; i++) + { + KEPlugin plugin = plugins[i]; + try + { + plugin.OnEnabled(); + + } + catch(Exception e) + { + Log.Error(e); + } + + + } + + + base.OnEnabled(); + } + + public override void OnDisabled() + { + for (int i = 0; i < plugins.Length; i++) + { + KEPlugin plugin = plugins[i]; + + plugin.OnDisabled(); + Log.Info(plugin.Name + " has been disabled!"); + + } + + Instance = null; + + base.OnDisabled(); + } + + } + + + + + public class Config : IConfig + { + public bool IsEnabled { get; set; } = true; + public bool Debug { get; set; } = false; + + + public KE.CustomRoles.Config CustomRoleConfig { get; set; } = new(); + public KE.Items.Config CustomItemConfig { get; set; } = new(); + public KE.Map.Config MapConfig { get; set; } = new(); + public KE.Misc.Config MiscConfig { get; set; } = new(); + public KE.GlobalEventFramework.Config GEFConfig { get; set; } = new(); + public KE.GlobalEventFramework.Examples.Config GEFEConfig { get; set; } = new(); + } + +} From afbe47a568e6a9708a74d1ae5830f367244645c0 Mon Sep 17 00:00:00 2001 From: Omer <27omerf@gmail.Com> Date: Wed, 15 Apr 2026 14:47:17 +0200 Subject: [PATCH 850/853] Update README Update README.md --- README.md | 116 +++++++++++++++++++++++++++++++++--------------------- 1 file changed, 71 insertions(+), 45 deletions(-) diff --git a/README.md b/README.md index 95b795d1..89752e99 100644 --- a/README.md +++ b/README.md @@ -1,45 +1,71 @@ -

- GitHub Profile Photo -

- -

Kruaçent-Exiled

- -
- -

Kruaçent-Exiled is a plugin using the Exiled Framework for SCP: Secret Laboratory servers. The plugin was initially created for our small (6-player) private SCP:SL servers

- -
-
-

- -

project-image

- -

shieldsshields

- -

🧐 Features

- -Here're some of the project's features: - -* **Global Event Framework** : The Global Event Framework is designed to introduce Global Events which are gameplay modifications revealed at the beginning of each round. You can easily create your own custom Global Events with dozens of examples provided. -* **BlackoutNDoor** : The BlackoutNDoor introduces new door and light systems. The lights randomly turn off/on and the doors can randomly open and close. -* **Custom Items** : The Customs Items add differents new guns and stuff in the game. You can easily create your own Custom Items with dozens of examples provided. -* **Miscellaneous** : The Miscellaneous plugin changes the game settings such as new inputs and outputs for human in 914 explosive D-Class cells the elevators that can move on its own and new announcements for specific players deaths. - -

🛠️ Installation Steps:

- -

1. Download the DLL you want to use from the latest release.

- -

2. Go to Exiled/Plugins and place the DLL there.

- -

3. Restart your SCP:SL server.

- -

4. The plugin will now be in your server.

- - -

🛡️ License:

- -This project is licensed under the Apache License - -
-
-
+
+

Kruaçent-Exiled

+

Gameplay overhaul plugins for SCP: Secret Laboratory.

+ Release + Contributors +
+ +--- + +## What is Kruaçent-Exiled? + +**Kruaçent-Exiled** is a plugin built on the [EXILED](https://github.com/ExMod-Team/EXILED) framework for SCP: Secret Laboratory game. + +Created to enhance our private servers, it has evolved into a large plugin. Its purpose is not just to add some item or role, but to **overhaul the gameplay**. + +--- + +## Features + +The framework is divided into five main parts to reshape the Site-19 : + +### 1. Global Event Framework +Every round is unique. This sub-plugin randomly selects and triggers a "Global Event" at the start of each round. +* **How it works :** An event can alter the rules of the current game (e.g. dropping bomb everywhere every 5 minutes, giving everyone speed boost, or creating facility malfunction). +* **Usable by developer :** Designed to be extensible, allowing developers to add their own custom global events. + +### 2. Custom Items +Introduces new gears into the game. +* Features modified grenades with variety of effect. +* Includes healing items and tactical gears. + +### 3. Custom Roles +Introduces new roles into the game. +* Features custom roles with variety of effect for humans and SCPs. +* Example : + * **Asthmatic** : Human with less stamina. + * **Pacifist** : Human who can't hurt other being. + * **Enderman** : Human who can set a point and teleport to it. + * **SCP-035** + +### 4. Miscellaneous +A collection of modifications to the base mechanics of SCP:SL to create new experiences. +* **SCP-914 :** New output for SCP-914 +* **Elevators :** Autonomous elevator calls and modified behaviors. +* **Gambling coin :** Coin with magical power + +### 5. Map Modifications +A collection of modifications of SCP:SL map. +* **New elevators in Surface Gate A** +* **A Gambling zone in SCP-173 Heavy Containment** +* **Supply Drops, Turret and more** +--- + +## Installation & Setup + +### Prerequisites +* A working SCP:SL server +* The [EXILED](https://github.com/ExMod-Team/EXILED) framework installed. + +### Installation Steps +1. Download the latest `Kruacent-Exiled.dll` from the [Releases](https://github.com/Kruacent/Kruacent-Exiled/releases) tab. +2. Place the `.dll` file into your server's `/EXILED/Plugins/` directory. +3. Restart your SCP:SL server. + +### Configuration +* After the first launch, the plugin will generate a configuration file in `/EXILED/Configs/`. +Here, you can can adjust configuration for many things. +--- +
+ Developed by the Kruaçent Team +
From 53056a40d21fd24f021b8a6c905a7c0fdf31c404 Mon Sep 17 00:00:00 2001 From: Patrique <62960454+Patrique29@users.noreply.github.com> Date: Wed, 15 Apr 2026 20:21:09 +0200 Subject: [PATCH 851/853] added action to build the server (#142) --- .github/workflows/buildtoserver.yml | 53 ++++++++++++++++ .../Features/Abilities/KEAbilityLimited.cs | 2 +- .../KE.CustomRoles/API/Features/CustomSCP.cs | 4 +- .../API/Features/GlobalCustomRole.cs | 2 +- .../API/Features/KEAbilities.cs | 30 ++++----- .../API/Features/KECustomRole.cs | 20 +++--- .../API/Features/RecyclableSettingId.cs | 5 +- .../API/HintPositions/AbilitiesPosition.cs | 2 +- .../HintPositions/AddonAbilitiesPosition.cs | 2 +- .../KE.CustomRoles/Abilities/Airstrike.cs | 6 +- .../NumberCheckpointEmptyAbility.cs | 6 +- .../KE.CustomRoles/Abilities/Explode.cs | 8 +-- .../Abilities/FireAbilities/BlindingFlash.cs | 6 +- .../Abilities/FireAbilities/Fireball.cs | 12 ++-- .../KE.CustomRoles/Abilities/ForceOpen.cs | 10 +-- .../GreaterSplitHorizontal.cs | 6 +- .../Abilities/RedMist/OnRush.cs | 8 +-- .../Abilities/RedMist/Spear/Spear.cs | 6 +- .../Abilities/RedMist/ToggleEGO.cs | 6 +- .../KE.CustomRoles/Abilities/SCP049C/Small.cs | 6 +- .../Abilities/SCP049C/ToggleHighJump.cs | 6 +- .../KE.CustomRoles/Abilities/SetPosition.cs | 10 +-- .../KE.CustomRoles/Abilities/SimulateDeath.cs | 6 +- .../KE.CustomRoles/Abilities/Teleportation.cs | 8 +-- .../KE.CustomRoles/Abilities/Thief.cs | 12 ++-- .../KE.CustomRoles/Abilities/Trade.cs | 6 +- .../CR/ChaosInsurgency/LeRusse.cs | 14 ++--- .../CR/ChaosInsurgency/Negotiator.cs | 12 ++-- .../KE.CustomRoles/CR/ClassD/DBoyInShape.cs | 10 +-- .../KE.CustomRoles/CR/ClassD/Enfant.cs | 10 +-- .../KE.CustomRoles/CR/ClassD/Mime.cs | 12 ++-- .../KE.CustomRoles/CR/CustomSCPs/SCP035.cs | 20 +++--- .../CustomSCPs/SCP049C/SCP049CLevelSystem.cs | 4 +- .../CR/CustomSCPs/SCP049C/SCP049CRole.cs | 10 +-- .../Tier2/DeflectDamageUnlockable.cs | 4 +- .../KE.CustomRoles/CR/CustomSCPs/SCP457.cs | 22 +++---- .../KE.CustomRoles/CR/Guard/ChiefGuard.cs | 8 +-- .../KE.CustomRoles/CR/Guard/Guard914.cs | 14 ++--- .../KE.CustomRoles/CR/Guard/Introvert.cs | 10 +-- .../KE.CustomRoles/CR/Human/Alzheimer.cs | 10 +-- .../KE.CustomRoles/CR/Human/Asthmatique.cs | 12 ++-- .../KE.CustomRoles/CR/Human/Crazy.cs | 10 +-- .../KE.CustomRoles/CR/Human/Diabetique.cs | 14 ++--- .../KE.CustomRoles/CR/Human/Enderman.cs | 10 +-- .../CR/Human/MaladroitVoleur.cs | 12 ++-- .../KE.CustomRoles/CR/Human/Pacifist.cs | 10 +-- KruacentExiled/KE.CustomRoles/CR/MTF/Pilot.cs | 10 +-- .../KE.CustomRoles/CR/MTF/RedMist/EGO.cs | 2 +- .../KE.CustomRoles/CR/MTF/RedMist/RedMist.cs | 16 ++--- KruacentExiled/KE.CustomRoles/CR/MTF/Tank.cs | 10 +-- .../CR/MTF/Terroriste/Terroriste.cs | 12 ++-- KruacentExiled/KE.CustomRoles/CR/SCP/Paper.cs | 8 +-- .../KE.CustomRoles/CR/SCP/SCP173/Frozen.cs | 10 +-- .../KE.CustomRoles/CR/SCP/SCP939/Ultra.cs | 8 +-- KruacentExiled/KE.CustomRoles/CR/SCP/Small.cs | 8 +-- .../CR/Scientist/GambleAddict.cs | 12 ++-- .../CR/Scientist/ZoneManager.cs | 20 +++--- .../KE.CustomRoles/Commands/KECR/Give.cs | 2 +- .../Commands/KECR/ImageCommand.cs | 4 +- .../Commands/KECR/KEParentCommand.cs | 2 +- .../Commands/KECR/Lists/Abilities.cs | 2 +- .../Commands/KECR/Lists/List.cs | 2 +- .../Commands/KECR/Lists/Registered.cs | 4 +- KruacentExiled/KE.CustomRoles/MainPlugin.cs | 16 ++--- .../KE.CustomRoles/Patches/FpcMotorPatches.cs | 41 ------------- .../Settings/DebugSettings/DebugSetting.cs | 4 +- .../FollowingTextToyDebugSetting.cs | 24 ++++---- .../DebugSettings/HintCreatorDebugSetting.cs | 2 +- .../KE.CustomRoles/Settings/SettingHandler.cs | 2 +- .../GE/Blitz.cs | 6 +- .../GE/ChangedItemEffect.cs | 12 ++-- .../GE/Impostor.cs | 6 +- .../GE/ItemRain.cs | 2 +- .../GE/Kaboom.cs | 6 +- .../GE/OpenBar.cs | 6 +- .../GE/RandomSpawn.cs | 4 +- .../GE/Rollback.cs | 8 +-- .../MainPlugin.cs | 2 +- .../MiddleEvents/Speed.cs | 2 +- .../GEFE/API/Features/GlobalEvent.cs | 16 ++--- .../GEFE/API/Features/KEEvents.cs | 24 ++++---- .../GEFE/API/Features/MiddleEvent.cs | 10 +-- .../GEFE/Commands/ForceGE.cs | 2 +- .../Exceptions/FailedRegisterException.cs | 6 +- .../KE.GlobalEventFramework/MainPlugin.cs | 4 +- .../KE.Items/API/Core/Models/PickupModel.cs | 2 +- .../API/Core/Settings/SettingsHandler.cs | 11 ++-- .../API/Core/Upgrade/UpgradeHandler.cs | 2 +- .../API/Features/Complexes/ComplexBase.cs | 2 +- .../KE.Items/API/Features/KECustomItem.cs | 14 ++--- .../KE.Items/API/Features/KECustomKeycard.cs | 4 +- .../KE.Items/API/Features/KECustomWeapon.cs | 2 +- .../SpawnPoints/PoseRoomSpawnPoint.cs | 4 +- KruacentExiled/KE.Items/CommandPos.cs | 4 +- KruacentExiled/KE.Items/CommandPosRoom.cs | 6 +- .../KE.Items/Commands/ForceAddFeed.cs | 4 +- KruacentExiled/KE.Items/Commands/Give.cs | 2 +- .../KE.Items/Commands/KECustomItems.cs | 2 +- KruacentExiled/KE.Items/Commands/List.cs | 2 +- KruacentExiled/KE.Items/Items/Defibrilator.cs | 8 +-- .../KE.Items/Items/DeployableWall.cs | 6 +- KruacentExiled/KE.Items/Items/DivinePills.cs | 6 +- KruacentExiled/KE.Items/Items/Drone.cs | 6 +- KruacentExiled/KE.Items/Items/FriendMaker.cs | 10 +-- KruacentExiled/KE.Items/Items/HealZone.cs | 6 +- KruacentExiled/KE.Items/Items/ImpactFlash.cs | 6 +- .../Items/ItemEffects/DeployableWallEffect.cs | 4 +- .../Items/ItemEffects/TPGrenadaEffect.cs | 6 +- .../KE.Items/Items/LeSoleil/LeSoleil.cs | 8 +-- .../KE.Items/Items/LowGravityGrenade.cs | 6 +- KruacentExiled/KE.Items/Items/MScan.cs | 8 +-- KruacentExiled/KE.Items/Items/Molotov.cs | 6 +- .../Items/PickupModels/HolyGrenadePModel.cs | 20 +++--- .../Items/PickupModels/MolotovPModel.cs | 10 +-- .../Items/PickupModels/PressePureePModel.cs | 8 +-- KruacentExiled/KE.Items/Items/PressePuree.cs | 8 +-- .../KE.Items/Items/ProximityGrenade.cs | 6 +- .../KE.Items/Items/RedbullEnergy.cs | 6 +- .../KE.Items/Items/SainteGrenada.cs | 6 +- KruacentExiled/KE.Items/Items/Scp1650.cs | 6 +- KruacentExiled/KE.Items/Items/Scp3136.cs | 6 +- .../KE.Items/Items/ShieldBelt/ShieldBelt.cs | 2 +- .../Items/ShieldBelt/ShieldBeltStat.cs | 2 +- KruacentExiled/KE.Items/Items/SmokeGrenade.cs | 6 +- KruacentExiled/KE.Items/Items/TPGrenada.cs | 6 +- .../KE.Items/Items/TrueDivinePills.cs | 6 +- KruacentExiled/KE.Items/MainPlugin.cs | 61 ++++++++++--------- KruacentExiled/KE.Items/SpawnModel.cs | 6 +- .../KE.Map/Commands/TestGetValidPosition.cs | 4 +- KruacentExiled/KE.Map/Entrance/Locked.cs | 2 +- KruacentExiled/KE.Map/Entrance/MoreRoom.cs | 4 +- KruacentExiled/KE.Map/Heavy/BulkDoor049.cs | 2 +- .../Heavy/GamblingZone/DroppableItem.cs | 2 +- .../KE.Map/Heavy/GamblingZone/GamblingRoom.cs | 6 +- .../KE.Map/Heavy/GamblingZone/LootTable.cs | 6 +- .../Heavy/GamblingZone/OldGamblingRoom.cs | 2 +- KruacentExiled/KE.Map/MainPlugin.cs | 20 +++--- .../KE.Map/Others/BlackoutNDoor/Both.cs | 4 +- .../BlackoutNDoor/Commands/BlackoutCommand.cs | 6 +- .../BlackoutNDoor/Commands/BothCommand.cs | 6 +- .../Commands/DoorstuckCommand.cs | 6 +- .../BlackoutNDoor/Commands/MainCommand.cs | 2 +- .../KE.Map/Others/BlackoutNDoor/DoorStuck.cs | 2 +- .../Events/Handlers/BlackoutNDoor.cs | 4 +- .../Events/Handlers/DoorStuckHandler.cs | 2 +- .../Others/BlackoutNDoor/Handlers/Handler.cs | 15 +++-- .../Others/BlackoutNDoor/Handlers/Pattern.cs | 39 +++++++----- .../KE.Map/Others/CustomDoors/KEDoor.cs | 2 +- .../Others/CustomElevators/CustomElevator.cs | 2 +- .../KECustomElevators/KECustomElevator.cs | 12 ++-- .../Others/CustomElevators/KEElevator.cs | 2 +- .../KE.Map/Others/CustomZones/AltasReader.cs | 32 +++++----- .../KE.Map/Others/CustomZones/CustomRoom.cs | 8 +-- .../CustomZones/CustomRooms/DoorSeparator.cs | 6 +- .../CustomRooms/SpawnedDoorSeparator.cs | 2 +- .../KE.Map/Others/CustomZones/Layout.cs | 4 +- .../Others/CustomZones/SpawnedCustomRoom.cs | 8 +-- .../KE.Map/Others/EasterEggs/Capybaras.cs | 4 +- KruacentExiled/KE.Map/ShowPos.cs | 2 +- KruacentExiled/KE.Map/SpawnImage.cs | 6 +- .../Surface/BlinkingBlocks/BlinkingBlock.cs | 4 +- .../BlinkingBlocks/BlinkingBlocksGroup.cs | 4 +- .../ElevatorGateA/CustomElevatorGateA.cs | 18 +++--- .../KE.Map/Surface/Rooms/SurfaceRooms.cs | 2 +- .../KE.Map/Surface/SupplyDrops/SupplyDrop.cs | 16 ++--- .../KE.Map/Surface/Turrets/Turret.cs | 2 +- KruacentExiled/KE.Map/Utils/Animations.cs | 2 +- .../KE.Map/Utils/StructureSpawner.cs | 4 +- .../KE.Misc/Events/Handlers/GamblingCoins.cs | 4 +- .../KE.Misc/Features/914Upgrades/GiveOmni.cs | 6 +- .../Features/914Upgrades/OmniCardUpgrade.cs | 4 +- .../Features/914Upgrades/PlayerTeleport914.cs | 2 +- .../RoleChanging/Base914PlayerRoleChange.cs | 2 +- .../914Upgrades/RoleChanging/Human914RC.cs | 14 ++--- .../Multiple914PlayerRoleChangeBase.cs | 2 +- .../914Upgrades/RoleChanging/SCP914RC.cs | 28 ++++----- .../Effect/NegativeEffect/EatingStar.cs | 4 +- .../Effect/NegativeEffect/SwapInventory.cs | 4 +- .../Features/GamblingCoin/EventHandlers.cs | 8 +-- .../Features/GamblingCoin/ForceEffect.cs | 2 +- .../GamblingCoin/GamblingCoinManager.cs | 8 +-- .../KE.Misc/Features/LoadingMiscFeature.cs | 2 +- .../KE.Misc/Features/MiscFeature.cs | 2 +- KruacentExiled/KE.Misc/Features/SCPBuff.cs | 6 +- .../KE.Misc/Features/Spawn/Spawn.cs | 8 +-- .../Features/Spawn/SpawnedEventArgs.cs | 4 +- KruacentExiled/KE.Misc/Features/SpawnLcz.cs | 6 +- .../KE.Misc/Features/SurfaceLight.cs | 2 +- .../Features/VoteStart/ForceVoteNumber.cs | 2 +- .../KE.Misc/Features/VoteStart/RetractVote.cs | 4 +- .../KE.Misc/Features/VoteStart/VoteStart.cs | 2 +- KruacentExiled/KE.Misc/MainPlugin.cs | 16 ++--- KruacentExiled/KE.Misc/Utils/ImageUtils.cs | 2 +- KruacentExiled/KE.Misc/Utils/TextImage.cs | 6 +- KruacentExiled/KEPlugin.cs | 3 - KruacentExiled/KruacentExiled.csproj | 4 +- KruacentExiled/MainPlugin.cs | 26 +++----- 197 files changed, 800 insertions(+), 784 deletions(-) create mode 100644 .github/workflows/buildtoserver.yml delete mode 100644 KruacentExiled/KE.CustomRoles/Patches/FpcMotorPatches.cs diff --git a/.github/workflows/buildtoserver.yml b/.github/workflows/buildtoserver.yml new file mode 100644 index 00000000..42b086c5 --- /dev/null +++ b/.github/workflows/buildtoserver.yml @@ -0,0 +1,53 @@ +name: Build .NET Solution + +on: + push: + branches: [ "master" ] + pull_request: + branches: [ "master" ] + workflow_dispatch: + +env: + OUTPUT_FOLDER_PATH: /home/grosserv/.config/EXILED/Plugins/ + EXILED_REFERENCES: ${{ github.workspace }}/references + EXILED_DEV_REFERENCES: ${{ github.workspace }}/devreferences + SERVER_LOCATION: /home/grosserv/SCPSL/ + OTHER_DEPENDENCIES: /home/grosserv/OtherDependencies/ +jobs: + build: + runs-on: self-hosted + + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Restore NuGet packages + run: | + SLN=$(find . -name "*.sln" | head -n 1) + nuget restore "$SLN" + + + - name : Fill Exiled References + run: | + mkdir ${{ env.EXILED_REFERENCES }} + mkdir ${{ env.EXILED_DEV_REFERENCES }} + find ${{env.SERVER_LOCATION}}/SCPSL_Data/Managed/ -name "*.dll" | xargs cp -t ${{env.EXILED_REFERENCES}} + find ${{env.OTHER_DEPENDENCIES}} -name "*.dll" | xargs cp -t ${{env.EXILED_REFERENCES}} + + - name: Build solution + run: | + export EXILED_REFERENCES=${{ env.EXILED_REFERENCES }} + export EXILED_DEV_REFERENCES=${{ env.EXILED_DEV_REFERENCES }} + SLN=$(find . -name "*.sln" | head -n 1) + msbuild "$SLN" /p:Configuration=Release + + - name: Copy plugin to server + run: | + DLL=$(find . -path "*/bin/Release/*KruacentExiled.dll" | head -n 1) + + if [ -z "$DLL" ]; then + echo "DLL not found!" + exit 1 + fi + cp "$DLL" $OUTPUT_FOLDER_PATH/ + diff --git a/KruacentExiled/KE.CustomRoles/API/Features/Abilities/KEAbilityLimited.cs b/KruacentExiled/KE.CustomRoles/API/Features/Abilities/KEAbilityLimited.cs index 57bfd31d..f07f316f 100644 --- a/KruacentExiled/KE.CustomRoles/API/Features/Abilities/KEAbilityLimited.cs +++ b/KruacentExiled/KE.CustomRoles/API/Features/Abilities/KEAbilityLimited.cs @@ -14,7 +14,7 @@ public abstract class KEAbilityLimited : KEAbilities public abstract int Uses { get; } - private Dictionary uses =new(); + private Dictionary uses =new Dictionary(); public override void AddAbility(Player player) { diff --git a/KruacentExiled/KE.CustomRoles/API/Features/CustomSCP.cs b/KruacentExiled/KE.CustomRoles/API/Features/CustomSCP.cs index 88eb4d41..09cf8420 100644 --- a/KruacentExiled/KE.CustomRoles/API/Features/CustomSCP.cs +++ b/KruacentExiled/KE.CustomRoles/API/Features/CustomSCP.cs @@ -34,8 +34,8 @@ public override void Init() if (category is null) { - header = new(HeaderId, "SCP Spawn Preferences",string.Empty,true); - category = new(header, 1001, []); + header = new HeaderSetting(HeaderId, "SCP Spawn Preferences",string.Empty,true); + category = new SettingsCategory(header, 1001, new List()); } sliderSetting= new SliderSetting(SettingId, GetTranslation("en", TranslationKeyName), MinValue, MaxValue, DefaultValue, true); diff --git a/KruacentExiled/KE.CustomRoles/API/Features/GlobalCustomRole.cs b/KruacentExiled/KE.CustomRoles/API/Features/GlobalCustomRole.cs index dda49e5a..32aba97f 100644 --- a/KruacentExiled/KE.CustomRoles/API/Features/GlobalCustomRole.cs +++ b/KruacentExiled/KE.CustomRoles/API/Features/GlobalCustomRole.cs @@ -130,7 +130,7 @@ public static SideEnum Get(Side side) return side switch { Side.Scp => SideEnum.SCP, - Side.Tutorial or Side.Mtf or Side.ChaosInsurgency => SideEnum.Human, + Side.Tutorial | Side.Mtf | Side.ChaosInsurgency => SideEnum.Human, Side.None => SideEnum.None, _ => SideEnum.None, }; diff --git a/KruacentExiled/KE.CustomRoles/API/Features/KEAbilities.cs b/KruacentExiled/KE.CustomRoles/API/Features/KEAbilities.cs index 338d3884..e72ed34d 100644 --- a/KruacentExiled/KE.CustomRoles/API/Features/KEAbilities.cs +++ b/KruacentExiled/KE.CustomRoles/API/Features/KEAbilities.cs @@ -33,7 +33,7 @@ namespace KE.CustomRoles.API.Features public abstract class KEAbilities { #region static stuff - private static HashSet registered = new(); + private static HashSet registered = new HashSet(); public static HashSet Registered => registered; #endregion @@ -49,18 +49,18 @@ public abstract class KEAbilities public abstract float Cooldown { get; } #endregion - private Dictionary LastUsed = new(); - private static Dictionary TypeToAbility { get; } = new(); - private static Dictionary NameToAbility { get; } = new(); + private Dictionary LastUsed = new Dictionary(); + private static Dictionary TypeToAbility { get; } = new Dictionary(); + private static Dictionary NameToAbility { get; } = new Dictionary(); public HashSet Players { get; } = new HashSet(); public IReadOnlyCollection Selected => selected; - private HashSet selected = new(); - private HashSet blockedPlayer = new(); - private HashSet playerWithActiveAbility = new(); + private HashSet selected = new HashSet(); + private HashSet blockedPlayer = new HashSet(); + private HashSet playerWithActiveAbility = new HashSet(); - public static Dictionary> PlayersAbility { get;} = new(); + public static Dictionary> PlayersAbility { get;} = new Dictionary>(); @@ -267,7 +267,7 @@ public virtual void AddAbility(Player player) { if(!PlayersAbility.TryGetValue(player,out var _)) { - PlayersAbility.Add(player, new()); + PlayersAbility.Add(player, new List()); } PlayersAbility[player].Add(this); InitHints(player); @@ -302,7 +302,7 @@ public bool IsAbilityActive(Player player) public virtual bool Check(Player player) { - if(player is not null) + if(player != null) { return Players.Contains(player); } @@ -497,7 +497,7 @@ private bool TryUnregister() public static IEnumerable Unregister() { - List list = new(); + List list = new List(); foreach (KEAbilities item in Registered) { item.TryUnregister(); @@ -642,8 +642,8 @@ protected virtual void Gui(StringBuilder sb,Player player) } - public static Dictionary> PlayersHints { get; } = new(); - public static Dictionary AddonHints { get; } = new(); + public static Dictionary> PlayersHints { get; } = new Dictionary>(); + public static Dictionary AddonHints { get; } = new Dictionary(); public const int InitialAbilitySlot = 5; private void InitHints(Player player) { @@ -651,7 +651,7 @@ private void InitHints(Player player) if (!PlayersHints.TryGetValue(player, out var _)) { - PlayersHints.Add(player, new()); + PlayersHints.Add(player, new List()); for (int i = 0; i < InitialAbilitySlot; i++) { AbilitiesPosition position = AbilitiesPosition.GetIndex(i); @@ -666,7 +666,7 @@ private void InitHints(Player player) } - private static HashSet addonAbilitiesexception = new(); + private static HashSet addonAbilitiesexception = new HashSet(); /// /// diff --git a/KruacentExiled/KE.CustomRoles/API/Features/KECustomRole.cs b/KruacentExiled/KE.CustomRoles/API/Features/KECustomRole.cs index 00fff16d..55778ccc 100644 --- a/KruacentExiled/KE.CustomRoles/API/Features/KECustomRole.cs +++ b/KruacentExiled/KE.CustomRoles/API/Features/KECustomRole.cs @@ -63,7 +63,7 @@ public sealed override bool RemovalKillsPlayer public sealed override string Description { get; set; } = string.Empty; - public static new HashSet Registered { get; } = new(); + public static new HashSet Registered { get; } = new HashSet(); public sealed override string CustomInfo { get; set; } @@ -146,8 +146,8 @@ public void Show(Player player) } - private static Dictionary typeLookupTable = new(); - private static Dictionary stringLookupTable = new(); + private static Dictionary typeLookupTable = new Dictionary(); + private static Dictionary stringLookupTable = new Dictionary(); protected const string CustomRoleNameKey = "Name"; protected const string CustomRoleDescriptionKey = "Desc"; @@ -179,12 +179,12 @@ private static Dictionary> SetStaticTranslati { return new Dictionary>() { - ["en"] = new() + ["en"] = new Dictionary() { [TranslationGUI] = "Current Role", [TranslationHealable] = "This Custom Role is healable!", }, - ["fr"] = new() + ["fr"] = new Dictionary() { [TranslationGUI] = "Role", [TranslationHealable] = "Ce custom role peut être enlevé avec un object!", @@ -398,7 +398,7 @@ public override void AddRole(Player player) Log.Debug(Name + ": new role type " + Role + "."); - ReceivingCustomRoleEventArgs ev1 = new(player2,this); + ReceivingCustomRoleEventArgs ev1 = new ReceivingCustomRoleEventArgs(player2,this); Events.Handlers.KECustomRole.OnReceivingCustomRole(ev1); @@ -471,7 +471,7 @@ public override void AddRole(Player player) RoleAdded(player2); player2.UniqueRole = Name; player2.TryAddCustomRoleFriendlyFire(Name, CustomRoleFFMultiplier); - ReceivedCustomRoleEventArgs ev2 = new(player2, this); + ReceivedCustomRoleEventArgs ev2 = new ReceivedCustomRoleEventArgs(player2, this); Events.Handlers.KECustomRole.OnReceivedCustomRole(ev2); @@ -649,7 +649,7 @@ public static bool HasCustomRole(Player player) public static IEnumerable Get(Player player) { - List cr = new(); + List cr = new List(); foreach(KECustomRole ke in Registered) { if (ke.Check(player)) @@ -771,7 +771,7 @@ public bool TryUnregister() public static IEnumerable Register() { - List list = new (); + List list = new List(); Type[] types = Assembly.GetCallingAssembly().GetTypes(); foreach (Type type in types) { @@ -790,7 +790,7 @@ public static IEnumerable Register() public static IEnumerable Unregister() { - List list = new (); + List list = new List(); foreach (KECustomRole item in Registered) { item.TryUnregister(); diff --git a/KruacentExiled/KE.CustomRoles/API/Features/RecyclableSettingId.cs b/KruacentExiled/KE.CustomRoles/API/Features/RecyclableSettingId.cs index e7b36e58..322c6907 100644 --- a/KruacentExiled/KE.CustomRoles/API/Features/RecyclableSettingId.cs +++ b/KruacentExiled/KE.CustomRoles/API/Features/RecyclableSettingId.cs @@ -24,7 +24,7 @@ public RecyclableSettingId(SettingBase setting) Value = setting.Id; } - public RecyclableSettingId() + /*public RecyclableSettingId() { int num = MinThreshold; int value; @@ -43,8 +43,7 @@ public RecyclableSettingId() Log.Debug("creating id =" + value); Value = value; - } - + }*/ public void Destroy() diff --git a/KruacentExiled/KE.CustomRoles/API/HintPositions/AbilitiesPosition.cs b/KruacentExiled/KE.CustomRoles/API/HintPositions/AbilitiesPosition.cs index d92c4e9a..bbcfdb8e 100644 --- a/KruacentExiled/KE.CustomRoles/API/HintPositions/AbilitiesPosition.cs +++ b/KruacentExiled/KE.CustomRoles/API/HintPositions/AbilitiesPosition.cs @@ -25,7 +25,7 @@ public class AbilitiesPosition : HintPosition private int index; public int Index => index; - private static List nonalloc = new(KEAbilities.InitialAbilitySlot); + private static List nonalloc = new List(KEAbilities.InitialAbilitySlot); public static AbilitiesPosition GetIndex(int index) diff --git a/KruacentExiled/KE.CustomRoles/API/HintPositions/AddonAbilitiesPosition.cs b/KruacentExiled/KE.CustomRoles/API/HintPositions/AddonAbilitiesPosition.cs index ddf6a5f8..0e2f40d2 100644 --- a/KruacentExiled/KE.CustomRoles/API/HintPositions/AddonAbilitiesPosition.cs +++ b/KruacentExiled/KE.CustomRoles/API/HintPositions/AddonAbilitiesPosition.cs @@ -20,7 +20,7 @@ public class AddonAbilitiesPosition : HintPosition public override float Yposition => yposition; - private static List nonalloc = new(KEAbilities.InitialAbilitySlot); + private static List nonalloc = new List(KEAbilities.InitialAbilitySlot); public static AddonAbilitiesPosition Get(AbilitiesPosition abilitiesPosition) diff --git a/KruacentExiled/KE.CustomRoles/Abilities/Airstrike.cs b/KruacentExiled/KE.CustomRoles/Abilities/Airstrike.cs index 751e4259..7114e33a 100644 --- a/KruacentExiled/KE.CustomRoles/Abilities/Airstrike.cs +++ b/KruacentExiled/KE.CustomRoles/Abilities/Airstrike.cs @@ -27,15 +27,15 @@ public class Airstrike : KEAbilities, ICustomIcon, IConditional public const string TranslationSomethingHere = "AirStrikeSomethingHere"; protected override Dictionary> SetTranslation() { - return new() + return new Dictionary>() { - ["en"] = new() + ["en"] = new Dictionary() { [TranslationKeyName] = "Airstrike", [TranslationKeyDesc] = "Don't overuse it or your co-op will not be happy", [TranslationSomethingHere] = "Something is in the way", }, - ["fr"] = new() + ["fr"] = new Dictionary() { [TranslationKeyName] = "Bombardement", [TranslationKeyDesc] = "Ne l'utilise pas trop sinon ton coop sera pas content", diff --git a/KruacentExiled/KE.CustomRoles/Abilities/EmptyAbilities/NumberCheckpointEmptyAbility.cs b/KruacentExiled/KE.CustomRoles/Abilities/EmptyAbilities/NumberCheckpointEmptyAbility.cs index 5c07dc4c..13424b4e 100644 --- a/KruacentExiled/KE.CustomRoles/Abilities/EmptyAbilities/NumberCheckpointEmptyAbility.cs +++ b/KruacentExiled/KE.CustomRoles/Abilities/EmptyAbilities/NumberCheckpointEmptyAbility.cs @@ -17,14 +17,14 @@ public class NumberCheckpointEmptyAbility : EmptyAbility, IDynamicName protected override Dictionary> SetTranslation() { - return new() + return new Dictionary>() { - ["en"] = new() + ["en"] = new Dictionary() { [TranslationKeyName] = "Remaining Checkpoint%S% : %remain%/%total%", [TranslationKeyDesc] = "", }, - ["fr"] = new() + ["fr"] = new Dictionary() { [TranslationKeyName] = "Checkpoint%S% restant : %remain%/%total% ", [TranslationKeyDesc] = "", diff --git a/KruacentExiled/KE.CustomRoles/Abilities/Explode.cs b/KruacentExiled/KE.CustomRoles/Abilities/Explode.cs index a0df3680..768a9473 100644 --- a/KruacentExiled/KE.CustomRoles/Abilities/Explode.cs +++ b/KruacentExiled/KE.CustomRoles/Abilities/Explode.cs @@ -22,14 +22,14 @@ public class Explode : KEAbilities, ICustomIcon protected override Dictionary> SetTranslation() { - return new() + return new Dictionary>() { - ["en"] = new() + ["en"] = new Dictionary () { [TranslationKeyName] = "Explode", [TranslationKeyDesc] = "You got an explosive belt", }, - ["fr"] = new() + ["fr"] = new Dictionary() { [TranslationKeyName] = "Explosion", [TranslationKeyDesc] = "Tu as une ceinture d'explosif autour de toi", @@ -42,7 +42,7 @@ protected override Dictionary> SetTranslation public Utils.API.GifAnimator.TextImage IconName => MainPlugin.Instance.icons["Explode"]; - private HashSet GrenadesSerials = new(); + private HashSet GrenadesSerials = new HashSet(); protected override void SubscribeEvents() { GrenadesSerials = HashSetPool.Pool.Get(); diff --git a/KruacentExiled/KE.CustomRoles/Abilities/FireAbilities/BlindingFlash.cs b/KruacentExiled/KE.CustomRoles/Abilities/FireAbilities/BlindingFlash.cs index c95c7218..c56e151a 100644 --- a/KruacentExiled/KE.CustomRoles/Abilities/FireAbilities/BlindingFlash.cs +++ b/KruacentExiled/KE.CustomRoles/Abilities/FireAbilities/BlindingFlash.cs @@ -11,14 +11,14 @@ public class BlindingFlash : FireAbilityBase protected override Dictionary> SetTranslation() { - return new() + return new Dictionary>() { - ["en"] = new() + ["en"] = new Dictionary() { [TranslationKeyName] = "Blinding Flash", [TranslationKeyDesc] = "Spawns an active flashbang at your feet", }, - ["fr"] = new() + ["fr"] = new Dictionary() { [TranslationKeyName] = "Le soleil", [TranslationKeyDesc] = "IS THAT A MOTHERFUCKER RED FLOOD REFERENCE??????????????", diff --git a/KruacentExiled/KE.CustomRoles/Abilities/FireAbilities/Fireball.cs b/KruacentExiled/KE.CustomRoles/Abilities/FireAbilities/Fireball.cs index ee5393a1..f026511c 100644 --- a/KruacentExiled/KE.CustomRoles/Abilities/FireAbilities/Fireball.cs +++ b/KruacentExiled/KE.CustomRoles/Abilities/FireAbilities/Fireball.cs @@ -21,14 +21,14 @@ public class Fireball : FireAbilityBase public override string Name { get; } = "Fireball"; protected override Dictionary> SetTranslation() { - return new() + return new Dictionary>() { - ["en"] = new() + ["en"] = new Dictionary() { [TranslationKeyName] = "Fireball", [TranslationKeyDesc] = "I cast Fireball", }, - ["fr"] = new() + ["fr"] = new Dictionary() { [TranslationKeyName] = "Boule de feur", [TranslationKeyDesc] = "Attends j'ai fait une faute là non?", @@ -40,10 +40,10 @@ protected override Dictionary> SetTranslation public override float Cooldown { get; } = 0f; - public static readonly CustomReasonDamageHandler BallDamage = new("Burned to death", 25, string.Empty); + public static readonly CustomReasonDamageHandler BallDamage = new CustomReasonDamageHandler("Burned to death", 25, string.Empty); public const int MAX_BALLS = 5; - private static readonly Color ballColor = new(2, 1.08f, 0, .75f); - private Dictionary _activeBalls = new(); + private static readonly Color ballColor = new Color(2, 1.08f, 0, .75f); + private Dictionary _activeBalls = new Dictionary(); protected override bool LaunchedAbility(Player player) { diff --git a/KruacentExiled/KE.CustomRoles/Abilities/ForceOpen.cs b/KruacentExiled/KE.CustomRoles/Abilities/ForceOpen.cs index 6725f3bb..7ee97b0c 100644 --- a/KruacentExiled/KE.CustomRoles/Abilities/ForceOpen.cs +++ b/KruacentExiled/KE.CustomRoles/Abilities/ForceOpen.cs @@ -23,15 +23,15 @@ public class ForceOpen : KEAbilityLimited, ICustomIcon public override string Name { get; } = "ForceOpen"; protected override Dictionary> SetTranslation() { - return new() + return new Dictionary>() { - ["en"] = new() + ["en"] = new Dictionary() { [TranslationKeyName] = "Force open", [TranslationKeyDesc] = "Force open a door", ["ForceOpenFail"] = "You failed opening the door and lost %HP% HP!", }, - ["fr"] = new() + ["fr"] = new Dictionary() { [TranslationKeyName] = "Forcer une porte", [TranslationKeyDesc] = "Force une porte (grosse description)", @@ -43,8 +43,8 @@ protected override Dictionary> SetTranslation public override float Cooldown { get; } = 30; public override int Uses { get; } = 5; - private Dictionary abilityActivated = new(); - public static readonly TimeSpan MaxTime = new (0, 0, 30); + private Dictionary abilityActivated = new Dictionary(); + public static readonly TimeSpan MaxTime = new TimeSpan(0, 0, 30); protected override bool LaunchedAbility(Player player) { diff --git a/KruacentExiled/KE.CustomRoles/Abilities/RedMist/GreaterSplitHorizontal/GreaterSplitHorizontal.cs b/KruacentExiled/KE.CustomRoles/Abilities/RedMist/GreaterSplitHorizontal/GreaterSplitHorizontal.cs index badf03ac..7ff68b7c 100644 --- a/KruacentExiled/KE.CustomRoles/Abilities/RedMist/GreaterSplitHorizontal/GreaterSplitHorizontal.cs +++ b/KruacentExiled/KE.CustomRoles/Abilities/RedMist/GreaterSplitHorizontal/GreaterSplitHorizontal.cs @@ -26,16 +26,16 @@ public class GreaterSplitHorizontal : EgoAbility public override string Name { get; } = "GreaterSplitHorizontal"; protected override Dictionary> SetTranslation() { - return new() + return new Dictionary>() { - ["en"] = new() + ["en"] = new Dictionary() { [TranslationKeyName] = "Greater Split : Horizontal", [TranslationKeyDesc] = "Manifest your E.G.O, gain powerful buff but rapid health drain.\nCan be deactivated anytime", [FailEgo] = "You need to manifest your E.G.O. first", [FailWeapon] = "You need your weapon", }, - ["fr"] = new() + ["fr"] = new Dictionary() { [TranslationKeyName] = "todo", [TranslationKeyDesc] = "todo", diff --git a/KruacentExiled/KE.CustomRoles/Abilities/RedMist/OnRush.cs b/KruacentExiled/KE.CustomRoles/Abilities/RedMist/OnRush.cs index 354547b1..e258ae51 100644 --- a/KruacentExiled/KE.CustomRoles/Abilities/RedMist/OnRush.cs +++ b/KruacentExiled/KE.CustomRoles/Abilities/RedMist/OnRush.cs @@ -14,16 +14,16 @@ public class OnRush : EgoAbility public override string Name { get; } = "OnRush"; protected override Dictionary> SetTranslation() { - return new() + return new Dictionary>() { - ["en"] = new() + ["en"] = new Dictionary() { [TranslationKeyName] = "On Rush", [TranslationKeyDesc] = "Manifest your E.G.O, gain powerful buff but rapid health drain.\nCan be deactivated anytime", ["OnRushFailEGO"] = "You need to manifest your E.G.O. first", ["OnRushFailWeapon"] = "You need your weapon", }, - ["fr"] = new() + ["fr"] = new Dictionary() { [TranslationKeyName] = "todo", [TranslationKeyDesc] = "todo", @@ -131,7 +131,7 @@ protected override bool LaunchedAbility(Player player,EGO ego) } - if (destructible is not null) + if (destructible != null) { PlayerStatsSystem.DamageHandlerBase handler = new GenericDamageHandler(target, player, Damage, DamageType.Scp1509, new DamageHandlerBase.CassieAnnouncement("")).Base; destructible.Damage(Damage, handler, destructible.CenterOfMass); diff --git a/KruacentExiled/KE.CustomRoles/Abilities/RedMist/Spear/Spear.cs b/KruacentExiled/KE.CustomRoles/Abilities/RedMist/Spear/Spear.cs index ae55cb74..950447ff 100644 --- a/KruacentExiled/KE.CustomRoles/Abilities/RedMist/Spear/Spear.cs +++ b/KruacentExiled/KE.CustomRoles/Abilities/RedMist/Spear/Spear.cs @@ -18,15 +18,15 @@ public class Spear : EgoAbility public override string Name { get; } = "Spear"; protected override Dictionary> SetTranslation() { - return new() + return new Dictionary>() { - ["en"] = new() + ["en"] = new Dictionary() { [TranslationKeyName] = "Spear", [TranslationKeyDesc] = "Manifest your E.G.O, gain powerful buff but rapid health drain.\nCan be deactivated anytime", [FailWeapon] = "You need your weapon", }, - ["fr"] = new() + ["fr"] = new Dictionary() { [TranslationKeyName] = "todo", [TranslationKeyDesc] = "todo", diff --git a/KruacentExiled/KE.CustomRoles/Abilities/RedMist/ToggleEGO.cs b/KruacentExiled/KE.CustomRoles/Abilities/RedMist/ToggleEGO.cs index 4ada626e..8bad74a5 100644 --- a/KruacentExiled/KE.CustomRoles/Abilities/RedMist/ToggleEGO.cs +++ b/KruacentExiled/KE.CustomRoles/Abilities/RedMist/ToggleEGO.cs @@ -19,14 +19,14 @@ public class ToggleEGO : ToggleableAbility public override string Name { get; } = "ToggleEGO"; protected override Dictionary> SetTranslation() { - return new() + return new Dictionary>() { - ["en"] = new() + ["en"] = new Dictionary() { [TranslationKeyName] = "Toggle E.G.O.", [TranslationKeyDesc] = "Manifest your E.G.O, gain powerful buff but rapid health drain.\nCan be deactivated anytime", }, - ["fr"] = new() + ["fr"] = new Dictionary() { [TranslationKeyName] = "todo", [TranslationKeyDesc] = "todo", diff --git a/KruacentExiled/KE.CustomRoles/Abilities/SCP049C/Small.cs b/KruacentExiled/KE.CustomRoles/Abilities/SCP049C/Small.cs index 107e326e..62265928 100644 --- a/KruacentExiled/KE.CustomRoles/Abilities/SCP049C/Small.cs +++ b/KruacentExiled/KE.CustomRoles/Abilities/SCP049C/Small.cs @@ -18,14 +18,14 @@ public class Small : KEAbilities protected override Dictionary> SetTranslation() { - return new() + return new Dictionary>() { - ["en"] = new() + ["en"] = new Dictionary() { [TranslationKeyName] = "Small", [TranslationKeyDesc] = "Get small for 30 seconds", }, - ["fr"] = new() + ["fr"] = new Dictionary() { [TranslationKeyName] = "Potit", [TranslationKeyDesc] = "Devient plus petit pendant 30 secondes", diff --git a/KruacentExiled/KE.CustomRoles/Abilities/SCP049C/ToggleHighJump.cs b/KruacentExiled/KE.CustomRoles/Abilities/SCP049C/ToggleHighJump.cs index c1f62bcf..dc1d8d63 100644 --- a/KruacentExiled/KE.CustomRoles/Abilities/SCP049C/ToggleHighJump.cs +++ b/KruacentExiled/KE.CustomRoles/Abilities/SCP049C/ToggleHighJump.cs @@ -20,14 +20,14 @@ public class ToggleHighJump : ToggleableAbility protected override Dictionary> SetTranslation() { - return new() + return new Dictionary>() { - ["en"] = new() + ["en"] = new Dictionary() { [TranslationKeyName] = "Toggle Big Jump", [TranslationKeyDesc] = "", }, - ["fr"] = new() + ["fr"] = new Dictionary() { [TranslationKeyName] = "Active/désactive grand saut", [TranslationKeyDesc] = "", diff --git a/KruacentExiled/KE.CustomRoles/Abilities/SetPosition.cs b/KruacentExiled/KE.CustomRoles/Abilities/SetPosition.cs index e46f7c9f..b4cfffbc 100644 --- a/KruacentExiled/KE.CustomRoles/Abilities/SetPosition.cs +++ b/KruacentExiled/KE.CustomRoles/Abilities/SetPosition.cs @@ -17,16 +17,16 @@ public class SetPosition : KEAbilities, ICustomIcon public const string TranslationTooFar = "SetPositionTooFar"; protected override Dictionary> SetTranslation() { - return new() + return new Dictionary>() { - ["en"] = new() + ["en"] = new Dictionary() { [TranslationKeyName] = "Set Position", [TranslationKeyDesc] = "Select the current position for another ability", [TranslationNoTarget] = "No target set", [TranslationTooFar] = "Position destroyed : too far away", }, - ["fr"] = new() + ["fr"] = new Dictionary() { [TranslationKeyName] = "Selection de position", [TranslationKeyDesc] = "Selectionne la position pour une autre abilité", @@ -55,7 +55,7 @@ protected override bool AbilityUsed(Player player) - FollowingTextToy followingTextToy = new FollowingTextToy([player], position, Quaternion.identity, Vector3.one); + FollowingTextToy followingTextToy = new FollowingTextToy(new List() { player }, position, Quaternion.identity, Vector3.one); new SetPositionPosition(player,position, followingTextToy); @@ -90,7 +90,7 @@ private class SetPositionPosition { public const float RefreshRate = 1f; public const float MaxDistance = 25; - private static Dictionary SelectedTarget = new(); + private static Dictionary SelectedTarget = new Dictionary(); public Player Player { get; private set; } public Vector3 Position { get; } public FollowingTextToy Follow { get; } diff --git a/KruacentExiled/KE.CustomRoles/Abilities/SimulateDeath.cs b/KruacentExiled/KE.CustomRoles/Abilities/SimulateDeath.cs index d5a66c8b..ce284a85 100644 --- a/KruacentExiled/KE.CustomRoles/Abilities/SimulateDeath.cs +++ b/KruacentExiled/KE.CustomRoles/Abilities/SimulateDeath.cs @@ -18,14 +18,14 @@ public class SimulateDeath : KEAbilities, ICustomIcon, IDuration protected override Dictionary> SetTranslation() { - return new() + return new Dictionary>() { - ["en"] = new() + ["en"] = new Dictionary() { [TranslationKeyName] = "Play dead", [TranslationKeyDesc] = "Simulate your own death", }, - ["fr"] = new() + ["fr"] = new Dictionary() { [TranslationKeyName] = "Faire le mort", [TranslationKeyDesc] = "T'es talent de mime te permettent de simuler la mort", diff --git a/KruacentExiled/KE.CustomRoles/Abilities/Teleportation.cs b/KruacentExiled/KE.CustomRoles/Abilities/Teleportation.cs index 309f1f36..58e1ad0f 100644 --- a/KruacentExiled/KE.CustomRoles/Abilities/Teleportation.cs +++ b/KruacentExiled/KE.CustomRoles/Abilities/Teleportation.cs @@ -21,9 +21,9 @@ public class Teleportation : KEAbilities, ICustomIcon, IConditional protected override Dictionary> SetTranslation() { - return new() + return new Dictionary>() { - ["en"] = new() + ["en"] = new Dictionary() { [TranslationKeyName] = "Teleportation", [TranslationKeyDesc] = $"You lose {Damage} HP per teleportation, can't be used in lifts", @@ -31,7 +31,7 @@ protected override Dictionary> SetTranslation [TranslationLcz] = "The target is inaccessible", [TranslationDifferentZone] = "The target is inaccessible", }, - ["fr"] = new() + ["fr"] = new Dictionary() { [TranslationKeyName] = "Téléportation", [TranslationKeyDesc] = $"Tu perds {Damage} HP/téléportation, ne peux pas être utilisé dans les ascenseurs", @@ -86,7 +86,7 @@ private bool CheckValid(Player player,bool showMessage) - if (Lift.Get(target) is not null) + if (Lift.Get(target) != null) { if (showMessage) { diff --git a/KruacentExiled/KE.CustomRoles/Abilities/Thief.cs b/KruacentExiled/KE.CustomRoles/Abilities/Thief.cs index 1e41a09e..d306c4fa 100644 --- a/KruacentExiled/KE.CustomRoles/Abilities/Thief.cs +++ b/KruacentExiled/KE.CustomRoles/Abilities/Thief.cs @@ -24,16 +24,16 @@ public class Thief : KEAbilities, ICustomIcon public const string Fail = "ThiefFail"; protected override Dictionary> SetTranslation() { - return new() + return new Dictionary>() { - ["en"] = new() + ["en"] = new Dictionary() { [TranslationKeyName] = "Steal", [TranslationKeyDesc] = "Steal a random item from a player in the same room", [NoPlayer] = "No player to steal from", [Fail] = "I think this is a skill issue! Congrats!", }, - ["fr"] = new() + ["fr"] = new Dictionary() { [TranslationKeyName] = "Voler", [TranslationKeyDesc] = "Vole un object aléatoire à un joueur dans la même pièce", @@ -58,7 +58,7 @@ protected override bool AbilityUsed(Player player) Player scp = GetClosest(sameRoom.Where(p => SCPTeam.IsSCP(p.ReferenceHub)), player.Position); - if(scp is not null) + if(scp != null) { KELog.Debug("steal scp"); Steal(player, scp); @@ -69,7 +69,7 @@ protected override bool AbilityUsed(Player player) Player enemy = GetClosest(sameRoom.Where(p => HitboxIdentity.IsEnemy(player.ReferenceHub, p.ReferenceHub)),player.Position); - if(enemy is not null) + if(enemy != null) { KELog.Debug("steal enemy"); Steal(player, enemy); @@ -80,7 +80,7 @@ protected override bool AbilityUsed(Player player) Player ally = GetClosest(sameRoom, player.Position); - if (ally is not null) + if (ally != null) { KELog.Debug("steal ally"); Steal(player, ally); diff --git a/KruacentExiled/KE.CustomRoles/Abilities/Trade.cs b/KruacentExiled/KE.CustomRoles/Abilities/Trade.cs index ae769773..b0a7acc3 100644 --- a/KruacentExiled/KE.CustomRoles/Abilities/Trade.cs +++ b/KruacentExiled/KE.CustomRoles/Abilities/Trade.cs @@ -22,15 +22,15 @@ public class Trade : KEAbilities, ICustomIcon protected override Dictionary> SetTranslation() { - return new() + return new Dictionary>() { - ["en"] = new() + ["en"] = new Dictionary() { [TranslationKeyName] = "Trade", [TranslationKeyDesc] = "Your link with casinos permit your to gain more coins in exchange of items", ["TradeNoItem"] = "No item?", }, - ["fr"] = new() + ["fr"] = new Dictionary() { [TranslationKeyName] = "Trade", [TranslationKeyDesc] = "T'es lien avec le casino t'as permis d'avoir un peu plus de pièce en échange d'un objet", diff --git a/KruacentExiled/KE.CustomRoles/CR/ChaosInsurgency/LeRusse.cs b/KruacentExiled/KE.CustomRoles/CR/ChaosInsurgency/LeRusse.cs index 1baf0316..ba62946f 100644 --- a/KruacentExiled/KE.CustomRoles/CR/ChaosInsurgency/LeRusse.cs +++ b/KruacentExiled/KE.CustomRoles/CR/ChaosInsurgency/LeRusse.cs @@ -21,19 +21,19 @@ public class Russe : KECustomRole { protected override Dictionary> SetTranslation() { - return new() + return new Dictionary>() { - ["en"] = new() + ["en"] = new Dictionary() { [TranslationKeyName] = "Russian", [TranslationKeyDesc] = "RUSH B or A, i dont rember sooo good luck", }, - ["fr"] = new() + ["fr"] = new Dictionary() { [TranslationKeyName] = "Russe", [TranslationKeyDesc] = "RUSH B or A, i dont rember sooo good luck", }, - ["legacy"] = new() + ["legacy"] = new Dictionary() { [TranslationKeyName] = "Russe", [TranslationKeyDesc] = "RUSH B or A, i dont rember sooo good luck", @@ -46,18 +46,18 @@ protected override Dictionary> SetTranslation public float DamageToLootbox { get; set; } = 500f; - private readonly Dictionary _playerDamage = new(); + private readonly Dictionary _playerDamage = new Dictionary(); private static object[] _lootPool = null; - public override List Inventory { get; set; } = new() + public override List Inventory { get; set; } = new List() { $"{ItemType.GunRevolver}", $"{ItemType.GunA7}", $"{ItemType.ArmorHeavy}", $"{ItemType.GrenadeHE}", $"{ItemType.GrenadeFlash}", $"{ItemType.Radio}", $"{ItemType.KeycardChaosInsurgency}" }; - public override Dictionary Ammo { get; set; } = new() + public override Dictionary Ammo { get; set; } = new Dictionary() { { AmmoType.Ammo44Cal, 19 }, { AmmoType.Nato762, 60 } }; diff --git a/KruacentExiled/KE.CustomRoles/CR/ChaosInsurgency/Negotiator.cs b/KruacentExiled/KE.CustomRoles/CR/ChaosInsurgency/Negotiator.cs index c6cc9d9e..2f850d8e 100644 --- a/KruacentExiled/KE.CustomRoles/CR/ChaosInsurgency/Negotiator.cs +++ b/KruacentExiled/KE.CustomRoles/CR/ChaosInsurgency/Negotiator.cs @@ -16,19 +16,19 @@ public class Negotiator : KECustomRole { protected override Dictionary> SetTranslation() { - return new() + return new Dictionary>() { - ["en"] = new() + ["en"] = new Dictionary() { [TranslationKeyName] = "Negotiator", [TranslationKeyDesc] = "You're immune to friendly fire and you can convert zombie into your team, isn't that nice?", }, - ["fr"] = new() + ["fr"] = new Dictionary() { [TranslationKeyName] = "Negociateur", [TranslationKeyDesc] = "T'es immunisé au tire allié et tu peux convertir des zombies", }, - ["legacy"] = new() + ["legacy"] = new Dictionary() { [TranslationKeyName] = "Negotiator", [TranslationKeyDesc] = "You're immune to friendly fire and you can convert zombie into your team, isn't that nice?", @@ -43,7 +43,7 @@ protected override Dictionary> SetTranslation public override float SpawnChance { get; set; } = 100; - public override List Inventory { get; set; } = new() + public override List Inventory { get; set; } = new List() { "KeycardChaosInsurgency", "GunAK", @@ -53,7 +53,7 @@ protected override Dictionary> SetTranslation "Radio" }; - public override Dictionary Ammo { get; set; } = new() + public override Dictionary Ammo { get; set; } = new Dictionary() { { AmmoType.Ammo12Gauge, 7 }, { AmmoType.Nato762, 90 } }; diff --git a/KruacentExiled/KE.CustomRoles/CR/ClassD/DBoyInShape.cs b/KruacentExiled/KE.CustomRoles/CR/ClassD/DBoyInShape.cs index 72f9d85e..e3b5f18b 100644 --- a/KruacentExiled/KE.CustomRoles/CR/ClassD/DBoyInShape.cs +++ b/KruacentExiled/KE.CustomRoles/CR/ClassD/DBoyInShape.cs @@ -22,19 +22,19 @@ public class DBoyInShape : KECustomRole { protected override Dictionary> SetTranslation() { - return new() + return new Dictionary>() { - ["en"] = new() + ["en"] = new Dictionary() { [TranslationKeyName] = "DBoyInShape", [TranslationKeyDesc] = "You're strong enough to open any door", }, - ["fr"] = new() + ["fr"] = new Dictionary() { [TranslationKeyName] = "DBoyInShape", [TranslationKeyDesc] = "Dammmmnnnnnnn les gates", }, - ["legacy"] = new() + ["legacy"] = new Dictionary() { [TranslationKeyName] = "DBoyInShape", [TranslationKeyDesc] = "Dammmmnnnnnnn les gates", @@ -50,7 +50,7 @@ protected override Dictionary> SetTranslation public const byte SpeedReduction = 15; - public override HashSet Abilities => new() + public override HashSet Abilities => new HashSet() { "ForceOpen" }; diff --git a/KruacentExiled/KE.CustomRoles/CR/ClassD/Enfant.cs b/KruacentExiled/KE.CustomRoles/CR/ClassD/Enfant.cs index e25b7055..96a14048 100644 --- a/KruacentExiled/KE.CustomRoles/CR/ClassD/Enfant.cs +++ b/KruacentExiled/KE.CustomRoles/CR/ClassD/Enfant.cs @@ -15,19 +15,19 @@ public class Enfant : KECustomRole, IColor { protected override Dictionary> SetTranslation() { - return new() + return new Dictionary>() { - ["en"] = new() + ["en"] = new Dictionary() { [TranslationKeyName] = "Kid", [TranslationKeyDesc] = "do not the kid \nyou start with a rainbow candy (for real this time) \nyou're a bit smaller", }, - ["fr"] = new() + ["fr"] = new Dictionary() { [TranslationKeyName] = "Enfant", [TranslationKeyDesc] = "do not the kid \ntu commences avec un bonbon arc-en-ciel (pour de vrai cette fois) \n t'es un peu plus petit que la normal", }, - ["legacy"] = new() + ["legacy"] = new Dictionary() { [TranslationKeyName] = "Enfant", [TranslationKeyDesc] = "do not the kid \ntu commences avec un bonbon arc-en-ciel (pour de vrai cette fois) \n t'es un peu plus petit que la normal", @@ -40,7 +40,7 @@ protected override Dictionary> SetTranslation public override RoleTypeId Role { get; set; } = RoleTypeId.ClassD; public override bool KeepRoleOnDeath { get; set; } = false; public override bool KeepRoleOnChangingRole { get; set; } = true; - public Color32 Color => new(255, 192, 203, 0); + public Color32 Color => new Color32(255, 192, 203, 0); public override float SpawnChance { get; set; } = 100; public override Vector3 Scale { get; set; } = new Vector3(1, 0.75f, 1); diff --git a/KruacentExiled/KE.CustomRoles/CR/ClassD/Mime.cs b/KruacentExiled/KE.CustomRoles/CR/ClassD/Mime.cs index f69d5339..e31cdc53 100644 --- a/KruacentExiled/KE.CustomRoles/CR/ClassD/Mime.cs +++ b/KruacentExiled/KE.CustomRoles/CR/ClassD/Mime.cs @@ -16,19 +16,19 @@ public class Mime : KECustomRole, IColor { protected override Dictionary> SetTranslation() { - return new() + return new Dictionary>() { - ["en"] = new() + ["en"] = new Dictionary() { [TranslationKeyName] = "Mime", [TranslationKeyDesc] = "you make almost no sound while walking \nand you're flat", }, - ["fr"] = new() + ["fr"] = new Dictionary() { [TranslationKeyName] = "Mime", [TranslationKeyDesc] = "tu fais très peu de bruit quand tu marches\net t'es tout plat", }, - ["legacy"] = new() + ["legacy"] = new Dictionary() { [TranslationKeyName] = "Mime", [TranslationKeyDesc] = "Tu ne peux pas parler\nmais tu fais très peu de bruit quand tu marches\net t'es tout plat", @@ -42,7 +42,7 @@ protected override Dictionary> SetTranslation public override bool KeepRoleOnChangingRole { get; set; } = true; public override float SpawnChance { get; set; } = 100; public override Vector3 Scale { get; set; } = new Vector3(0.5f, 1, 1); - public Color32 Color => new(255, 74, 74, 0); + public Color32 Color => new Color32(255, 74, 74, 0); protected override void RoleAdded(Player player) { @@ -54,7 +54,7 @@ protected override void RoleRemoved(Player player) player.DisableEffect(EffectType.SilentWalk); } - public override HashSet Abilities { get; } = new() + public override HashSet Abilities { get; } = new HashSet() { "SimulateDeath" }; diff --git a/KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP035.cs b/KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP035.cs index 419554c5..cec73a86 100644 --- a/KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP035.cs +++ b/KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP035.cs @@ -33,23 +33,23 @@ public class SCP035 : CustomSCP public override bool IsSupport => false; protected override Dictionary> SetTranslation() { - return new() + return new Dictionary>() { - ["en"] = new() + ["en"] = new Dictionary() { [TranslationKeyName] = "SCP-035", [TranslationKeyDesc] = "Kill every humans!\nYou can't pick up the Micro-HID and anything made with it, but you take 3 time less damage by these weapon.", ["SCP035CantPickup"] = "A strange force called 'game balance' \nprevents you from picking up this item.", ["SCP035CantUse"] = "A strange force called 'game balance' \nprevents you from using this item.", }, - ["fr"] = new() + ["fr"] = new Dictionary() { [TranslationKeyName] = "SCP-035", [TranslationKeyDesc] = "Tue tous les humains!\nTu peux pas prendre d'arme spécial mais tu prends 3 fois moins de dégât de ces armes", ["SCP035CantPickup"] = "Une force étrange qui s'appelle 'équilibre' \nt'empêches de prendre cet objet.", ["SCP035CantUse"] = "Une force étrange qui s'appelle 'équilibre' \nt'empêches d'utiliser cet objet.", }, - ["legacy"] = new() + ["legacy"] = new Dictionary() { [TranslationKeyName] = "SCP-035", [TranslationKeyDesc] = "You can't pickup the Micro-HID and anything made with it, but you take 3 time less damage by these weapon.\nKill every humans", @@ -65,7 +65,7 @@ protected override Dictionary> SetTranslation public override RoleTypeId Role { get; set; } = RoleTypeId.Tutorial; // 035 can't pickup these items - public HashSet BlacklistedPickup = new() + public HashSet BlacklistedPickup = new HashSet() { ItemType.Jailbird, ItemType.ParticleDisruptor, @@ -74,13 +74,13 @@ protected override Dictionary> SetTranslation ItemType.Medkit, ItemType.SCP500, }; - public HashSet BlacklistedUsing = new() + public HashSet BlacklistedUsing = new HashSet() { ItemType.Painkillers, ItemType.Medkit, ItemType.SCP500, }; - public HashSet WhitelistUsing = new() + public HashSet WhitelistUsing = new HashSet() { ItemType.SCP330, ItemType.SCP1853, @@ -88,7 +88,7 @@ protected override Dictionary> SetTranslation }; // 035 can't be damaged by these - public HashSet BlacklistedDamage = new() + public HashSet BlacklistedDamage = new HashSet() { DamageType.Jailbird, DamageType.ParticleDisruptor, @@ -245,7 +245,7 @@ private void OnSearchingPickup(SearchingPickupEventArgs ev) CustomItem.TryGet(pickup, out item); - if(item is not null) + if(item != null) { KECustomItem kECustomItem = item as KECustomItem; @@ -300,7 +300,7 @@ private void OnHurting(HurtingEventArgs ev) return; } - if (ev.Attacker is not null && ev.Attacker.Role.Side == Side.Scp) + if (ev.Attacker != null && ev.Attacker.Role.Side == Side.Scp) { ev.IsAllowed = false; return; diff --git a/KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP049C/SCP049CLevelSystem.cs b/KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP049C/SCP049CLevelSystem.cs index e68b27f9..878e5f28 100644 --- a/KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP049C/SCP049CLevelSystem.cs +++ b/KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP049C/SCP049CLevelSystem.cs @@ -77,13 +77,13 @@ private static IReadOnlyCollection Abilities public void Awake() { _hub = ReferenceHub.GetHub(base.gameObject); - CurrentAbilities = new(); + CurrentAbilities = new List(); currentkill = 0; currentTime = 0; Level = 0; objective = GetNbKillPerTier(0); - gui = new(this); + gui = new SCP049CGUI(this); SettingHandler.RightPressed += SettingHandler_RightPressed; SettingHandler.LeftPressed += SettingHandler_LeftPressed; diff --git a/KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP049C/SCP049CRole.cs b/KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP049C/SCP049CRole.cs index 6eb7b519..09d39ca4 100644 --- a/KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP049C/SCP049CRole.cs +++ b/KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP049C/SCP049CRole.cs @@ -20,19 +20,19 @@ public class SCP049CRole : CustomSCP public override bool IsSupport => false; protected override Dictionary> SetTranslation() { - return new() + return new Dictionary>() { - ["en"] = new() + ["en"] = new Dictionary() { [TranslationKeyName] = "SCP049-C", [TranslationKeyDesc] = "A modified SCP049 instance which does not create any SCP049-2\ninstead consuming the body to gain powerful abilities\nDoctor's call gives 300 Hume Shield\nExpired body can still be consumed but need more time to do so (stay near the arrow until it disappear (10s))", }, - ["fr"] = new() + ["fr"] = new Dictionary() { [TranslationKeyName] = "SCP049-C", [TranslationKeyDesc] = "A modified SCP049 instance which does not create any SCP049-2\ninstead consuming the body to gain powerful abilities\nDoctor's call gives 300 Hume Shield\nExpired body can still be consumed but need more time to do so (stay near the arrow until it disappear (10s))", }, - ["legacy"] = new() + ["legacy"] = new Dictionary() { [TranslationKeyName] = "SCP049-C", [TranslationKeyDesc] = "A modified SCP049 instance which does not create any SCP049-2\ninstead consuming the body to gain powerful abilities\nDoctor's call gives 300 Hume Shield\nExpired body can still be consumed but need more time to do so (stay near the arrow until it disappear (10s))", @@ -55,7 +55,7 @@ public override void Init() base.Init(); } - public static readonly SCP049CLevelPosition HintPosition = new(); + public static readonly SCP049CLevelPosition HintPosition = new SCP049CLevelPosition(); protected override void RoleAdded(Player player) { diff --git a/KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP049C/UnlockableAbilities/Tier2/DeflectDamageUnlockable.cs b/KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP049C/UnlockableAbilities/Tier2/DeflectDamageUnlockable.cs index c581b138..e8c3d9e2 100644 --- a/KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP049C/UnlockableAbilities/Tier2/DeflectDamageUnlockable.cs +++ b/KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP049C/UnlockableAbilities/Tier2/DeflectDamageUnlockable.cs @@ -22,7 +22,7 @@ public override string GetDescription(ReferenceHub hub) } - private static Dictionary cooldowns = new(); + private static Dictionary cooldowns = new Dictionary(); public override void Grant(ReferenceHub hub) { @@ -48,7 +48,7 @@ internal static void OnHurting(HurtingEventArgs ev) if(lastDamage is null || lastDamage.IsDeflectable()) { ev.IsAllowed = false; - cooldowns[hub] = new(ev.Amount); + cooldowns[hub] = new LastDamage(ev.Amount); } } } diff --git a/KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP457.cs b/KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP457.cs index dc7bae7b..0552b100 100644 --- a/KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP457.cs +++ b/KruacentExiled/KE.CustomRoles/CR/CustomSCPs/SCP457.cs @@ -23,19 +23,19 @@ public class SCP457 : CustomSCP { protected override Dictionary> SetTranslation() { - return new() + return new Dictionary>() { - ["en"] = new() + ["en"] = new Dictionary() { [TranslationKeyName] = "SCP-457", [TranslationKeyDesc] = "You do passive damage around you", }, - ["fr"] = new() + ["fr"] = new Dictionary() { [TranslationKeyName] = "SCP-457", [TranslationKeyDesc] = "j'ai dit pas trop cuite", }, - ["legacy"] = new() + ["legacy"] = new Dictionary() { [TranslationKeyName] = "SCP-457", [TranslationKeyDesc] = "You do passive damage around you", @@ -50,21 +50,21 @@ protected override Dictionary> SetTranslation public override float SpawnChance { get; set; } = 0; - private Dictionary _inside = new(); - private Dictionary> _handles = new(); + private Dictionary _inside = new Dictionary(); + private Dictionary> _handles = new Dictionary>(); public static float DamageRefreshRate = 5f; - public static readonly Color FlameColor = new(2, 1.08f, 0); + public static readonly Color FlameColor = new Color(2, 1.08f, 0); public Collider[] SphereNonAlloc = new Collider[32]; - public override HashSet Abilities => - [ + public override HashSet Abilities => new HashSet() + { "Fireball", "BlindingFlash" - ]; + }; protected override int SettingId => 10001; @@ -72,7 +72,7 @@ protected override void RoleAdded(Player player) { Log.Debug("adding role 457"); _inside.Add(player, null); - _handles.Add(player, new()); + _handles.Add(player, new HashSet()); _handles[player].Add(Timing.RunCoroutine(InsideLight(player))); _handles[player].Add(Timing.RunCoroutine(PassiveDamage(player))); diff --git a/KruacentExiled/KE.CustomRoles/CR/Guard/ChiefGuard.cs b/KruacentExiled/KE.CustomRoles/CR/Guard/ChiefGuard.cs index b42d0ba6..bfa51549 100644 --- a/KruacentExiled/KE.CustomRoles/CR/Guard/ChiefGuard.cs +++ b/KruacentExiled/KE.CustomRoles/CR/Guard/ChiefGuard.cs @@ -12,19 +12,19 @@ public class ChiefGuard : KECustomRole, IColor { protected override Dictionary> SetTranslation() { - return new() + return new Dictionary>() { - ["en"] = new() + ["en"] = new Dictionary() { [TranslationKeyName] = "Chief Guard", [TranslationKeyDesc] = "you got a private card and a crossvec", }, - ["fr"] = new() + ["fr"] = new Dictionary() { [TranslationKeyName] = "Chef des gardes", [TranslationKeyDesc] = "T'as une carte de private \net un crossvec", } - ,["legacy"] = new() + ,["legacy"] = new Dictionary() { [TranslationKeyName] = "Chef des gardes", [TranslationKeyDesc] = "T'as une carte de private \net un crossvec", diff --git a/KruacentExiled/KE.CustomRoles/CR/Guard/Guard914.cs b/KruacentExiled/KE.CustomRoles/CR/Guard/Guard914.cs index 84f5eb90..d5e6ec97 100644 --- a/KruacentExiled/KE.CustomRoles/CR/Guard/Guard914.cs +++ b/KruacentExiled/KE.CustomRoles/CR/Guard/Guard914.cs @@ -23,20 +23,20 @@ public class Guard914 : KECustomRole protected override Dictionary> SetTranslation() { - return new() + return new Dictionary>() { - ["en"] = new() + ["en"] = new Dictionary() { [TranslationKeyName] = "Guard of SCP-914", [TranslationKeyDesc] = "You are The guard of SCP-914 \nYou start at SCP-914 \nbut someone tampered with your card\nand also fuck you", }, - ["fr"] = new() + ["fr"] = new Dictionary() { [TranslationKeyName] = "Garde de SCP-914", [TranslationKeyDesc] = "Tu es Le garde de SCP-914 \nTu commences à 914 \nmais on a traffiqué ta carte \net ntm aussi", } , - ["legacy"] = new() + ["legacy"] = new Dictionary() { [TranslationKeyName] = "Garde de SCP-914", [TranslationKeyDesc] = "Tu es Le garde de SCP-914 \nTu commences à 914 \nmais on a traffiqué ta carte \net ntm aussi", @@ -78,7 +78,7 @@ protected override Dictionary> SetTranslation public override void Init() { base.Init(); - storedSerials = new(); + storedSerials = new HashSet(); } protected override void RoleAdded(Player player) @@ -156,11 +156,11 @@ private void OnProcessedPlayer(Scp914ProcessedPlayerEventArgs ev) if (storedSerials.Contains(item.Serial)) { ItemBase itemBase = null; - bool equipped = player.CurrentItem is not null && player.CurrentItem.Serial == item.Serial; + bool equipped = player.CurrentItem != null && player.CurrentItem.Serial == item.Serial; player.RemoveItem(item); storedSerials.Remove(item.Serial); - if (item is not CustomKeycardItem keycard) + if (!(item is CustomKeycardItem keycard)) { Log.Error("not a custom keycard"); return; diff --git a/KruacentExiled/KE.CustomRoles/CR/Guard/Introvert.cs b/KruacentExiled/KE.CustomRoles/CR/Guard/Introvert.cs index c589bacc..09d11917 100644 --- a/KruacentExiled/KE.CustomRoles/CR/Guard/Introvert.cs +++ b/KruacentExiled/KE.CustomRoles/CR/Guard/Introvert.cs @@ -16,19 +16,19 @@ internal class Introvert : KECustomRole { protected override Dictionary> SetTranslation() { - return new() + return new Dictionary>() { - ["en"] = new() + ["en"] = new Dictionary() { [TranslationKeyName] = "Introvert", [TranslationKeyDesc] = "your better by yourself", }, - ["fr"] = new() + ["fr"] = new Dictionary() { [TranslationKeyName] = "Introverti", [TranslationKeyDesc] = "Tu n'aimes pas trop les humains", }, - ["legacy"] = new() + ["legacy"] = new Dictionary() { [TranslationKeyName] = "Introvert", [TranslationKeyDesc] = "Tu n'aimes pas trop les humains", @@ -59,7 +59,7 @@ protected override Dictionary> SetTranslation public override void Init() { - _enabled = new(); + _enabled = new Dictionary(); base.Init(); } diff --git a/KruacentExiled/KE.CustomRoles/CR/Human/Alzheimer.cs b/KruacentExiled/KE.CustomRoles/CR/Human/Alzheimer.cs index 923e9518..1e2b9c2b 100644 --- a/KruacentExiled/KE.CustomRoles/CR/Human/Alzheimer.cs +++ b/KruacentExiled/KE.CustomRoles/CR/Human/Alzheimer.cs @@ -21,19 +21,19 @@ public class Alzheimer : GlobalCustomRole, IColor, IHealable public override SideEnum Side { get; set; } = SideEnum.Human; protected override Dictionary> SetTranslation() { - return new() + return new Dictionary>() { - ["en"] = new() + ["en"] = new Dictionary() { [TranslationKeyName] = "Old man", [TranslationKeyDesc] = "I'm old", }, - ["fr"] = new() + ["fr"] = new Dictionary() { [TranslationKeyName] = "Vieux", [TranslationKeyDesc] = "Je suis vieux", }, - ["legacy"] = new() + ["legacy"] = new Dictionary() { [TranslationKeyName] = "Vieux", [TranslationKeyDesc] = "POV Mishima", @@ -46,7 +46,7 @@ protected override Dictionary> SetTranslation public Color32 Color => new Color32(112,112,112,0); - public HashSet HealItem => [ItemType.SCP500]; + public HashSet HealItem => new HashSet() { ItemType.SCP500 }; private Dictionary handles; protected override void SubscribeEvents() diff --git a/KruacentExiled/KE.CustomRoles/CR/Human/Asthmatique.cs b/KruacentExiled/KE.CustomRoles/CR/Human/Asthmatique.cs index d2254122..41878a42 100644 --- a/KruacentExiled/KE.CustomRoles/CR/Human/Asthmatique.cs +++ b/KruacentExiled/KE.CustomRoles/CR/Human/Asthmatique.cs @@ -17,19 +17,19 @@ public class Asthmatique : GlobalCustomRole, IColor, IHealable, IEffectImmunity public override SideEnum Side { get; set; } = SideEnum.Human; protected override Dictionary> SetTranslation() { - return new() + return new Dictionary>() { - ["en"] = new() + ["en"] = new Dictionary() { [TranslationKeyName] = "Asthmatic", [TranslationKeyDesc] = "Stamina halfed\nbut better accuracy", }, - ["fr"] = new() + ["fr"] = new Dictionary() { [TranslationKeyName] = "Asthmatique", [TranslationKeyDesc] = "T'as stamina est réduit de moitié\nMais tu vises mieux", }, - ["legacy"] = new() + ["legacy"] = new Dictionary() { [TranslationKeyName] = "Asthmatique", [TranslationKeyDesc] = "T'as stamina est réduit de moitié\nMais tu vises mieux", @@ -40,9 +40,9 @@ protected override Dictionary> SetTranslation public override bool KeepRoleOnChangingRole { get; set; } = false; public override float SpawnChance { get; set; } = 100; public Color32 Color => new Color32(191, 255, 0, 0); - public HashSet HealItem => [ItemType.SCP500]; + public HashSet HealItem => new HashSet() { ItemType.SCP500 }; - public HashSet ImmuneEffects => [EffectType.Poisoned]; + public HashSet ImmuneEffects => new HashSet() {EffectType.Poisoned}; protected override void RoleAdded(Player player) { diff --git a/KruacentExiled/KE.CustomRoles/CR/Human/Crazy.cs b/KruacentExiled/KE.CustomRoles/CR/Human/Crazy.cs index 57742505..32aa4fb8 100644 --- a/KruacentExiled/KE.CustomRoles/CR/Human/Crazy.cs +++ b/KruacentExiled/KE.CustomRoles/CR/Human/Crazy.cs @@ -35,19 +35,19 @@ internal class Crazy : GlobalCustomRole public override SideEnum Side { get; set; } = SideEnum.Human; protected override Dictionary> SetTranslation() { - return new() + return new Dictionary>() { - ["en"] = new() + ["en"] = new Dictionary() { [TranslationKeyName] = "Crazy", [TranslationKeyDesc] = "Crazy? I Was Crazy Once. They Locked Me In A Room. A Rubber Room. A Rubber Room With Rats. And Rats Make Me Crazy", }, - ["fr"] = new() + ["fr"] = new Dictionary() { [TranslationKeyName] = "Fou de la facilité", [TranslationKeyDesc] = "Je pense que le traitement que t'as eu à la fondation t'as pas aidé", }, - ["legacy"] = new() + ["legacy"] = new Dictionary() { [TranslationKeyName] = "Fou de la facilité", [TranslationKeyDesc] = "Je pense que le traitement que t'as eu à la fondation t'as pas aidé", @@ -59,7 +59,7 @@ protected override Dictionary> SetTranslation public override bool KeepRoleOnChangingRole { get; set; } = false; public override float SpawnChance { get; set; } = 100; - private readonly Dictionary WeightDictionnary = new() + private readonly Dictionary WeightDictionnary = new Dictionary() { { CrazyBehaviour.Jump, 3 }, { CrazyBehaviour.Shoot, 3 }, diff --git a/KruacentExiled/KE.CustomRoles/CR/Human/Diabetique.cs b/KruacentExiled/KE.CustomRoles/CR/Human/Diabetique.cs index 5062ab9d..8a540db5 100644 --- a/KruacentExiled/KE.CustomRoles/CR/Human/Diabetique.cs +++ b/KruacentExiled/KE.CustomRoles/CR/Human/Diabetique.cs @@ -19,19 +19,19 @@ public class Diabetique : GlobalCustomRole, IColor, IHealable, IEffectImmunity public override SideEnum Side { get; set; } = SideEnum.Human; protected override Dictionary> SetTranslation() { - return new() + return new Dictionary>() { - ["en"] = new() + ["en"] = new Dictionary() { [TranslationKeyName] = "Diabetic", [TranslationKeyDesc] = "Fucking type 1. 1", }, - ["fr"] = new() + ["fr"] = new Dictionary() { [TranslationKeyName] = "Diabétique", [TranslationKeyDesc] = "T'as mangé le crambleu au pomme de mael", }, - ["legacy"] = new() + ["legacy"] = new Dictionary() { [TranslationKeyName] = "Diabetique", [TranslationKeyDesc] = "T'as mangé le crambleu au pomme de mael", @@ -42,10 +42,10 @@ protected override Dictionary> SetTranslation public override bool KeepRoleOnDeath { get; set; } = false; public override bool KeepRoleOnChangingRole { get; set; } = false; public override float SpawnChance { get; set; } = 100; - public HashSet HealItem => [ItemType.SCP500]; - public Color32 Color => new(255, 255, 0,0); + public HashSet HealItem => new HashSet() { ItemType.SCP500 }; + public Color32 Color => new Color32(255, 255, 0,0); - public HashSet ImmuneEffects => [EffectType.Poisoned]; + public HashSet ImmuneEffects => new HashSet() { EffectType.Poisoned }; protected override void RoleAdded(Player player) { diff --git a/KruacentExiled/KE.CustomRoles/CR/Human/Enderman.cs b/KruacentExiled/KE.CustomRoles/CR/Human/Enderman.cs index c64882fd..0cc123b8 100644 --- a/KruacentExiled/KE.CustomRoles/CR/Human/Enderman.cs +++ b/KruacentExiled/KE.CustomRoles/CR/Human/Enderman.cs @@ -14,19 +14,19 @@ internal class Enderman : GlobalCustomRole, IColor public override SideEnum Side { get; set; } = SideEnum.Human; protected override Dictionary> SetTranslation() { - return new() + return new Dictionary>() { - ["en"] = new() + ["en"] = new Dictionary() { [TranslationKeyName] = "Enderman", [TranslationKeyDesc] = "Great job you're now overpowered", }, - ["fr"] = new() + ["fr"] = new Dictionary() { [TranslationKeyName] = "Enderman", [TranslationKeyDesc] = "Tu peux te téléporter ! T tro for enféte", }, - ["legacy"] = new() + ["legacy"] = new Dictionary() { [TranslationKeyName] = "Enderman", [TranslationKeyDesc] = "Tu peux te téléporter ! T tro for enféte", @@ -37,7 +37,7 @@ protected override Dictionary> SetTranslation public override bool KeepRoleOnDeath { get; set; } = false; public override bool KeepRoleOnChangingRole { get; set; } = true; public override float SpawnChance { get; set; } = 100; - public override HashSet Abilities { get; } = new() + public override HashSet Abilities { get; } = new HashSet() { "Teleportation", "SetPosition" diff --git a/KruacentExiled/KE.CustomRoles/CR/Human/MaladroitVoleur.cs b/KruacentExiled/KE.CustomRoles/CR/Human/MaladroitVoleur.cs index b25c269a..1a8fc50d 100644 --- a/KruacentExiled/KE.CustomRoles/CR/Human/MaladroitVoleur.cs +++ b/KruacentExiled/KE.CustomRoles/CR/Human/MaladroitVoleur.cs @@ -24,19 +24,19 @@ public class MaladroitVoleur : GlobalCustomRole, IColor public override SideEnum Side { get; set; } = SideEnum.Human; protected override Dictionary> SetTranslation() { - return new() + return new Dictionary>() { - ["en"] = new() + ["en"] = new Dictionary() { [TranslationKeyName] = "Butter Finger Thief", [TranslationKeyDesc] = "Be careful of \"your\" items!", }, - ["fr"] = new() + ["fr"] = new Dictionary() { [TranslationKeyName] = "Maladroit Voleur", [TranslationKeyDesc] = "Fais attention à \"tes\" objets !", }, - ["legacy"] = new() + ["legacy"] = new Dictionary() { [TranslationKeyName] = "Maladroit Voleur", [TranslationKeyDesc] = "Fais attention à \"tes\" objets !", @@ -47,9 +47,9 @@ protected override Dictionary> SetTranslation public override bool KeepRoleOnChangingRole { get; set; } = false; public override float SpawnChance { get; set; } = 100; - public Color32 Color => new(211, 110, 112, 0); + public Color32 Color => new Color32(211, 110, 112, 0); - public override HashSet Abilities { get; } = new() + public override HashSet Abilities { get; } = new HashSet() { "Thief" }; diff --git a/KruacentExiled/KE.CustomRoles/CR/Human/Pacifist.cs b/KruacentExiled/KE.CustomRoles/CR/Human/Pacifist.cs index 4ff103a3..75ac3eaf 100644 --- a/KruacentExiled/KE.CustomRoles/CR/Human/Pacifist.cs +++ b/KruacentExiled/KE.CustomRoles/CR/Human/Pacifist.cs @@ -20,21 +20,21 @@ public class Pacifist : KECustomRoleMultipleRole public const string TranslationCantPickup = "PacifistCantPickup"; protected override Dictionary> SetTranslation() { - return new() + return new Dictionary>() { - ["en"] = new() + ["en"] = new Dictionary() { [TranslationKeyName] = "Pacifist", [TranslationKeyDesc] = "You're incapable of violence.\nRemove when escaping and bring more people", [TranslationCantPickup] = "Picking up this item make you sick", }, - ["fr"] = new() + ["fr"] = new Dictionary() { [TranslationKeyName] = "Pacifiste", [TranslationKeyDesc] = "T'es idées empêche quelconque violence.\nS'enlève quand tu t'échappes et ramène plus de renfort", [TranslationCantPickup] = "Juste la vue de cet objet te rend malade", }, - ["legacy"] = new() + ["legacy"] = new Dictionary() { [TranslationKeyName] = "Pacifiste", [TranslationKeyDesc] = "T'es idées empêche quelconque violence.\nS'enlève quand tu t'échappes et ramène plus de renfort", @@ -45,7 +45,7 @@ protected override Dictionary> SetTranslation public override bool KeepRoleOnChangingRole { get; set; } = false; public override float SpawnChance { get; set; } = 100; - public override HashSet Roles => [RoleTypeId.Scientist,RoleTypeId.ClassD]; + public override HashSet Roles => new HashSet() { RoleTypeId.Scientist, RoleTypeId.ClassD }; protected override void SubscribeEvents() diff --git a/KruacentExiled/KE.CustomRoles/CR/MTF/Pilot.cs b/KruacentExiled/KE.CustomRoles/CR/MTF/Pilot.cs index c70400fd..5eb62445 100644 --- a/KruacentExiled/KE.CustomRoles/CR/MTF/Pilot.cs +++ b/KruacentExiled/KE.CustomRoles/CR/MTF/Pilot.cs @@ -22,19 +22,19 @@ public class Pilot : KECustomRole public override float SpawnChance { get; set; } = 100; protected override Dictionary> SetTranslation() { - return new() + return new Dictionary>() { - ["en"] = new() + ["en"] = new Dictionary() { [TranslationKeyName] = "Pilot", [TranslationKeyDesc] = "So I haveth a Laser Pointere", }, - ["fr"] = new() + ["fr"] = new Dictionary() { [TranslationKeyName] = "Pilote", [TranslationKeyDesc] = "Je suis pilote!", }, - ["legacy"] = new() + ["legacy"] = new Dictionary() { [TranslationKeyName] = "Pilot", [TranslationKeyDesc] = "So I haveth a Laser Pointere", @@ -56,7 +56,7 @@ protected override Dictionary> SetTranslation { AmmoType.Nato9, 100} }; - public override HashSet Abilities { get; } = new() + public override HashSet Abilities { get; } = new HashSet() { "SetPosition", "AirStrike" diff --git a/KruacentExiled/KE.CustomRoles/CR/MTF/RedMist/EGO.cs b/KruacentExiled/KE.CustomRoles/CR/MTF/RedMist/EGO.cs index 83f5b8d3..d10083c9 100644 --- a/KruacentExiled/KE.CustomRoles/CR/MTF/RedMist/EGO.cs +++ b/KruacentExiled/KE.CustomRoles/CR/MTF/RedMist/EGO.cs @@ -144,7 +144,7 @@ public override void ToggleActive() } - private static readonly Dictionary effects = new() + private static readonly Dictionary effects = new Dictionary() { { EffectType.MovementBoost,25 }, { EffectType.Scp1853,2 }, diff --git a/KruacentExiled/KE.CustomRoles/CR/MTF/RedMist/RedMist.cs b/KruacentExiled/KE.CustomRoles/CR/MTF/RedMist/RedMist.cs index 5841f8d1..cf0e38e3 100644 --- a/KruacentExiled/KE.CustomRoles/CR/MTF/RedMist/RedMist.cs +++ b/KruacentExiled/KE.CustomRoles/CR/MTF/RedMist/RedMist.cs @@ -16,19 +16,19 @@ public class RedMistRole : KECustomRole, IColor public override string InternalName => "RedMist"; protected override Dictionary> SetTranslation() { - return new() + return new Dictionary>() { - ["en"] = new() + ["en"] = new Dictionary() { [TranslationKeyName] = "The Red Mist", [TranslationKeyDesc] = "todo", }, - ["fr"] = new() + ["fr"] = new Dictionary() { [TranslationKeyName] = "The Red Mist", [TranslationKeyDesc] = "todo", }, - ["legacy"] = new() + ["legacy"] = new Dictionary() { [TranslationKeyName] = "The Red Mist", [TranslationKeyDesc] = "todo", @@ -39,7 +39,7 @@ protected override Dictionary> SetTranslation public override RoleTypeId Role { get; set; } = RoleTypeId.ClassD; public override bool KeepRoleOnDeath { get; set; } = false; public override bool KeepRoleOnChangingRole { get; set; } = false; - public Color32 Color => new(255, 192, 203, 0); + public Color32 Color => new Color32(255, 192, 203, 0); public override float SpawnChance { get; set; } = 0; //You're the legendary Fixer, the Red Mist. This role comes with multiple strengths such as increased speed (1.5 to 2 times the normal speed ) , more health (200 health), you spawn with a machete scp but better, The Mimicry also you can't use guns. @@ -52,13 +52,13 @@ protected override Dictionary> SetTranslation //+ego : quick heal drain pause when attacking, 80 damage reduction faster //forward slash : damage everything on its path max distance of a room - public override HashSet Abilities { get; } = - [ + public override HashSet Abilities { get; } = new HashSet() + { "ToggleEGO", "Spear", "OnRush", "GreaterSplitHorizontal", - ]; + }; protected override void GiveInventory(Player player) { diff --git a/KruacentExiled/KE.CustomRoles/CR/MTF/Tank.cs b/KruacentExiled/KE.CustomRoles/CR/MTF/Tank.cs index a004c84e..85d56f1d 100644 --- a/KruacentExiled/KE.CustomRoles/CR/MTF/Tank.cs +++ b/KruacentExiled/KE.CustomRoles/CR/MTF/Tank.cs @@ -16,19 +16,19 @@ public class Tank : KECustomRole, IColor { protected override Dictionary> SetTranslation() { - return new() + return new Dictionary>() { - ["en"] = new() + ["en"] = new Dictionary() { [TranslationKeyName] = "Tank", [TranslationKeyDesc] = "The more bullet you got, the slower you are", }, - ["fr"] = new() + ["fr"] = new Dictionary() { [TranslationKeyName] = "Tank", [TranslationKeyDesc] = "Tu es ralenti selon ton nombre de balle", }, - ["legacy"] = new() + ["legacy"] = new Dictionary() { [TranslationKeyName] = "Tank", [TranslationKeyDesc] = "Tu es débuff mais ta force de tir est démultiplié (fais attention à tes balles)", @@ -40,7 +40,7 @@ protected override Dictionary> SetTranslation public override RoleTypeId Role { get; set; } = RoleTypeId.NtfSergeant; public override bool KeepRoleOnDeath { get; set; } = false; public override bool KeepRoleOnChangingRole { get; set; } = false; - public Color32 Color => new (255, 192, 203,0); + public Color32 Color => new Color32(255, 192, 203,0); public override float SpawnChance { get; set; } = 100; public override Vector3 Scale { get; set; } = new Vector3(1.15f, 1f, 1.15f); diff --git a/KruacentExiled/KE.CustomRoles/CR/MTF/Terroriste/Terroriste.cs b/KruacentExiled/KE.CustomRoles/CR/MTF/Terroriste/Terroriste.cs index 77ab7833..d596b2ec 100644 --- a/KruacentExiled/KE.CustomRoles/CR/MTF/Terroriste/Terroriste.cs +++ b/KruacentExiled/KE.CustomRoles/CR/MTF/Terroriste/Terroriste.cs @@ -13,19 +13,19 @@ public class Terroriste : KECustomRole, IColor { protected override Dictionary> SetTranslation() { - return new() + return new Dictionary>() { - ["en"] = new() + ["en"] = new Dictionary() { [TranslationKeyName] = "Terrorist", [TranslationKeyDesc] = "Kaboom!", }, - ["fr"] = new() + ["fr"] = new Dictionary() { [TranslationKeyName] = "Terroriste", [TranslationKeyDesc] = "Ne fait pas exploser la facilité \ntu commences avec des grenades", }, - ["legacy"] = new() + ["legacy"] = new Dictionary() { [TranslationKeyName] = "Terroriste", [TranslationKeyDesc] = "Ne fait pas exploser la facilité \ntu commences avec des grenades", @@ -36,7 +36,7 @@ protected override Dictionary> SetTranslation public override RoleTypeId Role { get; set; } = RoleTypeId.NtfSergeant; public override bool KeepRoleOnDeath { get; set; } = false; public override bool KeepRoleOnChangingRole { get; set; } = false; - public Color32 Color => new(105, 52, 22, 0); + public Color32 Color => new Color32(105, 52, 22, 0); public override float SpawnChance { get; set; } = 100; public override List Inventory { get; set; } = new List() @@ -55,7 +55,7 @@ protected override Dictionary> SetTranslation { AmmoType.Nato556, 100} }; - public override HashSet Abilities { get; } = new() + public override HashSet Abilities { get; } = new HashSet() { "Explode" }; diff --git a/KruacentExiled/KE.CustomRoles/CR/SCP/Paper.cs b/KruacentExiled/KE.CustomRoles/CR/SCP/Paper.cs index 24d8b733..8818ce02 100644 --- a/KruacentExiled/KE.CustomRoles/CR/SCP/Paper.cs +++ b/KruacentExiled/KE.CustomRoles/CR/SCP/Paper.cs @@ -10,19 +10,19 @@ public class Paper : GlobalCustomRole { protected override Dictionary> SetTranslation() { - return new() + return new Dictionary>() { - ["en"] = new() + ["en"] = new Dictionary() { [TranslationKeyName] = "Paper", [TranslationKeyDesc] = "uh oh. paper jam", }, - ["fr"] = new() + ["fr"] = new Dictionary() { [TranslationKeyName] = "Paper", [TranslationKeyDesc] = "uh oh. paper jam", }, - ["legacy"] = new() + ["legacy"] = new Dictionary() { [TranslationKeyName] = "Paper", [TranslationKeyDesc] = "uh oh. paper jam", diff --git a/KruacentExiled/KE.CustomRoles/CR/SCP/SCP173/Frozen.cs b/KruacentExiled/KE.CustomRoles/CR/SCP/SCP173/Frozen.cs index d4809814..59df478d 100644 --- a/KruacentExiled/KE.CustomRoles/CR/SCP/SCP173/Frozen.cs +++ b/KruacentExiled/KE.CustomRoles/CR/SCP/SCP173/Frozen.cs @@ -21,19 +21,19 @@ public class Frozen : KECustomRole, IColor { protected override Dictionary> SetTranslation() { - return new() + return new Dictionary>() { - ["en"] = new() + ["en"] = new Dictionary() { [TranslationKeyName] = "Frozen SCP-173", [TranslationKeyDesc] = "Instead of Tantrum you drop a SCP-244.\nKilling anyone with hypothermia gives Hume Shield", }, - ["fr"] = new() + ["fr"] = new Dictionary() { [TranslationKeyName] = "SCP-173 Glacé", [TranslationKeyDesc] = "Au lieu de chier tu poses un SCP-244.\nTué quelqu'un qui est en hypothermie donne du shield (dans le jeu hein)", }, - ["legacy"] = new() + ["legacy"] = new Dictionary() { [TranslationKeyName] = "Frozen SCP-173", [TranslationKeyDesc] = "Instead of Tantrum you drop a SCP-244.\nKilling anyone with hypothermia gives Hume Shield", @@ -97,7 +97,7 @@ private void OnDeath(PlayerDeathEventArgs ev) } } - private HashSet _primed = new(); + private HashSet _primed = new HashSet(); private void OnCreatedTantrum(Scp173CreatedTantrumEventArgs ev) diff --git a/KruacentExiled/KE.CustomRoles/CR/SCP/SCP939/Ultra.cs b/KruacentExiled/KE.CustomRoles/CR/SCP/SCP939/Ultra.cs index 557c7658..442204f7 100644 --- a/KruacentExiled/KE.CustomRoles/CR/SCP/SCP939/Ultra.cs +++ b/KruacentExiled/KE.CustomRoles/CR/SCP/SCP939/Ultra.cs @@ -17,19 +17,19 @@ public class Ultra : KECustomRole { protected override Dictionary> SetTranslation() { - return new() + return new Dictionary>() { - ["en"] = new() + ["en"] = new Dictionary() { [TranslationKeyName] = "Ultra SCP-939", [TranslationKeyDesc] = "You can sense where people are located", }, - ["fr"] = new() + ["fr"] = new Dictionary() { [TranslationKeyName] = "Ultra SCP-939", [TranslationKeyDesc] = "Tu sais où est tout le monde", }, - ["legacy"] = new() + ["legacy"] = new Dictionary() { [TranslationKeyName] = "Ultra SCP-939", [TranslationKeyDesc] = "You can sense where people are located", diff --git a/KruacentExiled/KE.CustomRoles/CR/SCP/Small.cs b/KruacentExiled/KE.CustomRoles/CR/SCP/Small.cs index 2b9c6a4a..6fff5fc8 100644 --- a/KruacentExiled/KE.CustomRoles/CR/SCP/Small.cs +++ b/KruacentExiled/KE.CustomRoles/CR/SCP/Small.cs @@ -12,19 +12,19 @@ public class Small : GlobalCustomRole public override SideEnum Side { get; set; } = SideEnum.SCP; protected override Dictionary> SetTranslation() { - return new() + return new Dictionary>() { - ["en"] = new() + ["en"] = new Dictionary() { [TranslationKeyName] = "Small", [TranslationKeyDesc] = "u smoll", }, - ["fr"] = new() + ["fr"] = new Dictionary() { [TranslationKeyName] = "Petit", [TranslationKeyDesc] = "t poti", }, - ["legacy"] = new() + ["legacy"] = new Dictionary() { [TranslationKeyName] = "Small", [TranslationKeyDesc] = "u smoll", diff --git a/KruacentExiled/KE.CustomRoles/CR/Scientist/GambleAddict.cs b/KruacentExiled/KE.CustomRoles/CR/Scientist/GambleAddict.cs index d0f50ed7..8d803fc2 100644 --- a/KruacentExiled/KE.CustomRoles/CR/Scientist/GambleAddict.cs +++ b/KruacentExiled/KE.CustomRoles/CR/Scientist/GambleAddict.cs @@ -14,19 +14,19 @@ public class GambleAddict : KECustomRole, IColor { protected override Dictionary> SetTranslation() { - return new() + return new Dictionary>() { - ["en"] = new() + ["en"] = new Dictionary() { [TranslationKeyName] = "Gamble Addict", [TranslationKeyDesc] = "you got 2 coins\ngood luck", }, - ["fr"] = new() + ["fr"] = new Dictionary() { [TranslationKeyName] = "Accro du casino", [TranslationKeyDesc] = "T'as trade ton kit et ta carte contre 2 pièces \nfais en bon usage", }, - ["legacy"] = new() + ["legacy"] = new Dictionary() { [TranslationKeyName] = "Gamble Addict", [TranslationKeyDesc] = "T'as trade ton kit et ta carte contre 2 pièces \nfais en bon usage", @@ -46,11 +46,11 @@ protected override Dictionary> SetTranslation $"{ItemType.Coin}", }; - public override HashSet Abilities { get; } = new() + public override HashSet Abilities { get; } = new HashSet() { "Trade" }; - public Color32 Color => new(0, 105, 59,0); + public Color32 Color => new Color32(0, 105, 59,0); } } diff --git a/KruacentExiled/KE.CustomRoles/CR/Scientist/ZoneManager.cs b/KruacentExiled/KE.CustomRoles/CR/Scientist/ZoneManager.cs index d397174a..96a585c7 100644 --- a/KruacentExiled/KE.CustomRoles/CR/Scientist/ZoneManager.cs +++ b/KruacentExiled/KE.CustomRoles/CR/Scientist/ZoneManager.cs @@ -18,19 +18,19 @@ public class ZoneManager : KECustomRole { protected override Dictionary> SetTranslation() { - return new() + return new Dictionary>() { - ["en"] = new() + ["en"] = new Dictionary() { [TranslationKeyName] = "Zone Manager", [TranslationKeyDesc] = "Open all of the checkpoint to get a better card!", }, - ["fr"] = new() + ["fr"] = new Dictionary() { [TranslationKeyName] = "Zone Manager", [TranslationKeyDesc] = "Incroyable tu peux avoir une promotion alors fais ton boulot et ouvre tous ces checkpoints et tu pourras sortir d'ici!", }, - ["legacy"] = new() + ["legacy"] = new Dictionary() { [TranslationKeyName] = "Zone Manager", [TranslationKeyDesc] = "Incroyable tu peux avoir une promotion alors fais ton boulot et ouvre tous ces checkpoints et tu pourras sortir d'ici!", @@ -59,10 +59,10 @@ protected override Dictionary> SetTranslation }; - public override HashSet Abilities { get; } = - [ + public override HashSet Abilities { get; } = new HashSet() + { "NumberCheckpoints" - ]; + }; public override List Inventory { get; set; } = new List() { @@ -79,8 +79,8 @@ protected override Dictionary> SetTranslation }.AsReadOnly(); - private static Dictionary> objectives = new(); - private static Dictionary flag = new(); + private static Dictionary> objectives = new Dictionary>(); + private static Dictionary flag = new Dictionary(); protected override void SubscribeEvents() { @@ -97,7 +97,7 @@ protected override void UnsubscribeEvents() protected override void RoleAdded(Player player) { - objectives.Add(player, new(DoorToOpen)); + objectives.Add(player, new HashSet(DoorToOpen)); flag.Add(player, false); } protected override void RoleRemoved(Player player) diff --git a/KruacentExiled/KE.CustomRoles/Commands/KECR/Give.cs b/KruacentExiled/KE.CustomRoles/Commands/KECR/Give.cs index afa47c58..a9438a95 100644 --- a/KruacentExiled/KE.CustomRoles/Commands/KECR/Give.cs +++ b/KruacentExiled/KE.CustomRoles/Commands/KECR/Give.cs @@ -17,7 +17,7 @@ internal class Give : ICommand { public string Command => "give"; - public string[] Aliases => ["g"]; + public string[] Aliases => new string[] { "g" }; public string Description => ""; diff --git a/KruacentExiled/KE.CustomRoles/Commands/KECR/ImageCommand.cs b/KruacentExiled/KE.CustomRoles/Commands/KECR/ImageCommand.cs index 6e846835..97f9f291 100644 --- a/KruacentExiled/KE.CustomRoles/Commands/KECR/ImageCommand.cs +++ b/KruacentExiled/KE.CustomRoles/Commands/KECR/ImageCommand.cs @@ -19,11 +19,11 @@ public class ImageCommand : ICommand { public string Command => "img"; - public string[] Aliases => []; + public string[] Aliases => new string[0]; public string Description => "image"; - public string[] Usage => []; + public string[] Usage => new string[0]; public bool Execute(ArraySegment arguments, ICommandSender sender, out string response) { diff --git a/KruacentExiled/KE.CustomRoles/Commands/KECR/KEParentCommand.cs b/KruacentExiled/KE.CustomRoles/Commands/KECR/KEParentCommand.cs index a986a1d1..d9f0c14d 100644 --- a/KruacentExiled/KE.CustomRoles/Commands/KECR/KEParentCommand.cs +++ b/KruacentExiled/KE.CustomRoles/Commands/KECR/KEParentCommand.cs @@ -18,7 +18,7 @@ public KEParentCommand() } public override string Command => "kecustomrole"; - public override string[] Aliases => ["kecr"]; + public override string[] Aliases => new string[1] { "kecr" }; public override string Description => string.Empty; diff --git a/KruacentExiled/KE.CustomRoles/Commands/KECR/Lists/Abilities.cs b/KruacentExiled/KE.CustomRoles/Commands/KECR/Lists/Abilities.cs index 4b51b0e6..1eb70134 100644 --- a/KruacentExiled/KE.CustomRoles/Commands/KECR/Lists/Abilities.cs +++ b/KruacentExiled/KE.CustomRoles/Commands/KECR/Lists/Abilities.cs @@ -14,7 +14,7 @@ public class Abilities : ICommand { public string Command => "Ability"; - public string[] Aliases => ["a"]; + public string[] Aliases => new string[1] { "a" }; public string Description => "list abilities"; diff --git a/KruacentExiled/KE.CustomRoles/Commands/KECR/Lists/List.cs b/KruacentExiled/KE.CustomRoles/Commands/KECR/Lists/List.cs index e43cb88f..dc4be7ee 100644 --- a/KruacentExiled/KE.CustomRoles/Commands/KECR/Lists/List.cs +++ b/KruacentExiled/KE.CustomRoles/Commands/KECR/Lists/List.cs @@ -15,7 +15,7 @@ public List() } public override string Command => "list"; - public override string[] Aliases => ["l"]; + public override string[] Aliases => new string[] { "l" }; public override string Description => ""; diff --git a/KruacentExiled/KE.CustomRoles/Commands/KECR/Lists/Registered.cs b/KruacentExiled/KE.CustomRoles/Commands/KECR/Lists/Registered.cs index a193a5ef..38016304 100644 --- a/KruacentExiled/KE.CustomRoles/Commands/KECR/Lists/Registered.cs +++ b/KruacentExiled/KE.CustomRoles/Commands/KECR/Lists/Registered.cs @@ -11,10 +11,10 @@ namespace KE.CustomRoles.Commands.KECR.Lists { public class Registered : ICommand { - public static Registered Instance = new(); + public static Registered Instance = new Registered(); public string Command => "registered"; - public string[] Aliases => ["r"]; + public string[] Aliases => new string[] { "r" }; public string Description => ""; diff --git a/KruacentExiled/KE.CustomRoles/MainPlugin.cs b/KruacentExiled/KE.CustomRoles/MainPlugin.cs index 680f090b..cc73287e 100644 --- a/KruacentExiled/KE.CustomRoles/MainPlugin.cs +++ b/KruacentExiled/KE.CustomRoles/MainPlugin.cs @@ -34,11 +34,11 @@ public class MainPlugin : KEPlugin public override string Prefix => "KE.CR"; public static MainPlugin Instance; public static Config Configs => (Config) Instance?.Config; - public static readonly HintPlacement CRHint = new(0, 750); - public static readonly HintPlacement CREffect = new(700, 300); - public static readonly HintPlacement AbilitiesDesc = new(0, 900); - public static readonly HintPlacement Abilities = new(0, 850,HintServiceMeow.Core.Enum.HintAlignment.Left); - public static readonly HintPlacement RightHPbars = new(55, 1000,HintServiceMeow.Core.Enum.HintAlignment.Left); + public static readonly HintPlacement CRHint = new HintPlacement(0, 750); + public static readonly HintPlacement CREffect = new HintPlacement(700, 300); + public static readonly HintPlacement AbilitiesDesc = new HintPlacement(0, 900); + public static readonly HintPlacement Abilities = new HintPlacement(0, 850,HintServiceMeow.Core.Enum.HintAlignment.Left); + public static readonly HintPlacement RightHPbars = new HintPlacement(55, 1000,HintServiceMeow.Core.Enum.HintAlignment.Left); private SettingHandler _settingHandler; internal static SettingHandler SettingHandler => Instance?._settingHandler; @@ -55,20 +55,20 @@ public override void OnEnabled() Instance = this; config = KruacentExiled.MainPlugin.Instance.Config.CustomRoleConfig; - _settingHandler = new(); + _settingHandler = new SettingHandler(); Utils.API.Settings.GlobalSettings.GlobalSettingsHandler.Instance.TryLoad(); Utils.API.Settings.GlobalSettings.GlobalSettingsHandler.Instance.SubscribeEvents(); CustomPlayerStat.AddModule(); CustomStatsEvents.SubscribeEvents(); - icons = new(); + icons = new Dictionary(); CustomTeamEvents.SubscribeEvents(); LoadImage(); - Harmony = new(Name); + Harmony = new Harmony(Name); Harmony.PatchAll(); SettingHandler.SubscribeEvents(); KEAbilities.Register(KruacentExiled.MainPlugin.Instance.Assembly); diff --git a/KruacentExiled/KE.CustomRoles/Patches/FpcMotorPatches.cs b/KruacentExiled/KE.CustomRoles/Patches/FpcMotorPatches.cs deleted file mode 100644 index 59e4c427..00000000 --- a/KruacentExiled/KE.CustomRoles/Patches/FpcMotorPatches.cs +++ /dev/null @@ -1,41 +0,0 @@ -using HarmonyLib; -using PlayerRoles.FirstPersonControl; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using UnityEngine; - -namespace KE.CustomRoles.Patches -{ - public static class FpcMotorPatches - { - //me when slowness 200 - - //[HarmonyPatch(typeof(FpcMotor),nameof(FpcMotor.DesiredMove),MethodType.Getter)] - public static class DesiredMovePatch - { - [HarmonyPostfix] - public static void Postfix(FpcMotor __instance,ref Vector3 __result) - { - __result = new(__result.x * -1, __result.y, __result.z * -1); - } - - - } - - //[HarmonyPatch(typeof(FpcMotor), nameof(FpcMotor.GetFrameMove), MethodType.Normal)] - public static class GetFrameMovePatch - { - [HarmonyPostfix] - public static void Postfix(FpcMotor __instance, ref Vector3 __result) - { - __result = new(__result.x * -1, __result.y, __result.z * -1); - } - - - } - - } -} diff --git a/KruacentExiled/KE.CustomRoles/Settings/DebugSettings/DebugSetting.cs b/KruacentExiled/KE.CustomRoles/Settings/DebugSettings/DebugSetting.cs index 87604110..8a210797 100644 --- a/KruacentExiled/KE.CustomRoles/Settings/DebugSettings/DebugSetting.cs +++ b/KruacentExiled/KE.CustomRoles/Settings/DebugSettings/DebugSetting.cs @@ -14,7 +14,7 @@ namespace KE.CustomRoles.Settings.DebugSettings public abstract class DebugSetting { - internal static List settings = new(); + internal static List settings = new List(); public HeaderSetting Header; @@ -46,7 +46,7 @@ public SettingsCategory GetCategory() { if(category == null) { - category = new SettingsCategory(Header, 0, Settings.Where(s => s is not HeaderSetting).ToList()); + category = new SettingsCategory(Header, 0, Settings.Where(s => !(s is HeaderSetting)).ToList()); } return category; } diff --git a/KruacentExiled/KE.CustomRoles/Settings/DebugSettings/FollowingTextToyDebugSetting.cs b/KruacentExiled/KE.CustomRoles/Settings/DebugSettings/FollowingTextToyDebugSetting.cs index eddb4c5b..0f6aebd3 100644 --- a/KruacentExiled/KE.CustomRoles/Settings/DebugSettings/FollowingTextToyDebugSetting.cs +++ b/KruacentExiled/KE.CustomRoles/Settings/DebugSettings/FollowingTextToyDebugSetting.cs @@ -24,17 +24,17 @@ internal class FollowingTextToyDebugSetting : DebugSetting protected override List CreateSettings() { created = true; - return - [ - new HeaderSetting(_idHeaderTestHint,"Follow Text Creator",padding:true), - new SliderSetting(_idTestHintsliderx,"x",0,360,0), - new SliderSetting(_idTestHintslidery,"y",0,360,0), - new SliderSetting(_idTestHintsliderz,"z",0,360,0), - new SliderSetting(_idTestHintslidersize,"size",0,100,5), - SettingBase.Create(new SSPlaintextSetting(_idTestHinttext,"text")), - new ButtonSetting(_idTestHintspawn,"spawn","spawn"), - new ButtonSetting(_idTestHintdestroy,"destroyall","destroyall"), - ]; + return new List() + { + new HeaderSetting(_idHeaderTestHint, "Follow Text Creator", padding: true), + new SliderSetting(_idTestHintsliderx, "x", 0, 360, 0), + new SliderSetting(_idTestHintslidery, "y", 0, 360, 0), + new SliderSetting(_idTestHintsliderz, "z", 0, 360, 0), + new SliderSetting(_idTestHintslidersize, "size", 0, 100, 5), + SettingBase.Create(new SSPlaintextSetting(_idTestHinttext, "text")), + new ButtonSetting(_idTestHintspawn, "spawn", "spawn"), + new ButtonSetting(_idTestHintdestroy, "destroyall", "destroyall"), + }; } private bool created = false; string text = "TEST"; @@ -53,7 +53,7 @@ public override void OnSettingValueReceived(Player player, ServerSpecificSetting } } - private List texttoy = new(); + private List texttoy = new List(); private void CreateTextToy(Player player, ServerSpecificSettingBase setting) { if (SettingBase.TryGetSetting(player, _idTestHinttext, out var textsetting)) diff --git a/KruacentExiled/KE.CustomRoles/Settings/DebugSettings/HintCreatorDebugSetting.cs b/KruacentExiled/KE.CustomRoles/Settings/DebugSettings/HintCreatorDebugSetting.cs index 86b32120..2161fb41 100644 --- a/KruacentExiled/KE.CustomRoles/Settings/DebugSettings/HintCreatorDebugSetting.cs +++ b/KruacentExiled/KE.CustomRoles/Settings/DebugSettings/HintCreatorDebugSetting.cs @@ -26,7 +26,7 @@ internal class HintCreatorDebugSetting : DebugSetting private int _idHeaderTestHint = 160; protected override List CreateSettings() { - string[] options = ["left", "center", "right"]; + string[] options = new string[] { "left", "center", "right" }; created = true; return new List() { diff --git a/KruacentExiled/KE.CustomRoles/Settings/SettingHandler.cs b/KruacentExiled/KE.CustomRoles/Settings/SettingHandler.cs index 0161c90c..5a3b4d1a 100644 --- a/KruacentExiled/KE.CustomRoles/Settings/SettingHandler.cs +++ b/KruacentExiled/KE.CustomRoles/Settings/SettingHandler.cs @@ -177,7 +177,7 @@ private void OnSettingValueReceived(Player player, ServerSpecificSettingBase set } - private Dictionary playerPos = new(); + private Dictionary playerPos = new Dictionary(); private void Up(Player player) { diff --git a/KruacentExiled/KE.GlobalEventFramework.Examples/GE/Blitz.cs b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/Blitz.cs index 7bce0ac3..a5a6ad0d 100644 --- a/KruacentExiled/KE.GlobalEventFramework.Examples/GE/Blitz.cs +++ b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/Blitz.cs @@ -19,10 +19,10 @@ public class Blitz : GlobalEvent, IAsyncStart public override string Name { get; set; } = "Blitz"; /// public override string Description { get; } = "La Luftwaffe arrive!"; - public override string[] AltDescription => - [ + public override string[] AltDescription => new string[] + { "Attention aux bombardements!" - ]; + }; /// public override int WeightedChance => 4; /// diff --git a/KruacentExiled/KE.GlobalEventFramework.Examples/GE/ChangedItemEffect.cs b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/ChangedItemEffect.cs index a02ca242..af10c177 100644 --- a/KruacentExiled/KE.GlobalEventFramework.Examples/GE/ChangedItemEffect.cs +++ b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/ChangedItemEffect.cs @@ -23,10 +23,10 @@ public class ChangedItemEffect : GlobalEvent,IStart ,IEvent public override string Name { get; set; } = "SwitchItemEffect"; /// public override string Description { get; } = "Les effets des items ont changé"; - public override string[] AltDescription => - [ + public override string[] AltDescription => new string[] + { "Roulette russe" - ]; + }; /// public override int WeightedChance { get; set; } = 0; @@ -49,7 +49,7 @@ public void Start() private void ChangeItemsEffect() { - List usableList = new(); + List usableList = new List(); foreach (var item in (ItemType[])Enum.GetValues(typeof(ItemType))) { @@ -74,7 +74,7 @@ private void ChangeItemsEffect() private void ChangeCandyEffect() { - List candys = new(); + List candys = new List(); foreach (var item in (CandyKindID[])Enum.GetValues(typeof(CandyKindID))) { if (item != CandyKindID.None) @@ -84,7 +84,7 @@ private void ChangeCandyEffect() } } - newCandyEffects = new(); + newCandyEffects = new Dictionary(); int switchNumber = UnityEngine.Random.Range(1, candys.Count); diff --git a/KruacentExiled/KE.GlobalEventFramework.Examples/GE/Impostor.cs b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/Impostor.cs index fe089416..4b8f1369 100644 --- a/KruacentExiled/KE.GlobalEventFramework.Examples/GE/Impostor.cs +++ b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/Impostor.cs @@ -16,10 +16,10 @@ public class Impostor : GlobalEvent, IAsyncStart public override uint Id { get; set; } = 1044; public override string Name { get; set; } = "Impostor"; public override string Description { get; } = "Ne vous fiez pas aux apparences !"; - public override string[] AltDescription => - [ + public override string[] AltDescription => new string[] + { "sussy" - ]; + }; public override int WeightedChance { get; set; } = 2; public override ImpactLevel ImpactLevel => ImpactLevel.High; diff --git a/KruacentExiled/KE.GlobalEventFramework.Examples/GE/ItemRain.cs b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/ItemRain.cs index c8356070..f1831bb7 100644 --- a/KruacentExiled/KE.GlobalEventFramework.Examples/GE/ItemRain.cs +++ b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/ItemRain.cs @@ -25,7 +25,7 @@ public class ItemRain : GlobalEvent, IAsyncStart public int Cooldown = 120; public int NbItemSpawned = 5; - public static readonly HashSet BlacklistedItems = new() + public static readonly HashSet BlacklistedItems = new HashSet() { ItemType.None,ItemType.Coal,ItemType.SpecialCoal,ItemType.Snowball,ItemType.SCP1507Tape,ItemType.Scp021J,ItemType.DebugRagdollMover, ItemType.KeycardCustomManagement,ItemType.KeycardCustomMetalCase,ItemType.KeycardCustomSite02,ItemType.KeycardCustomTaskForce, diff --git a/KruacentExiled/KE.GlobalEventFramework.Examples/GE/Kaboom.cs b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/Kaboom.cs index 4287fede..a688a0b7 100644 --- a/KruacentExiled/KE.GlobalEventFramework.Examples/GE/Kaboom.cs +++ b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/Kaboom.cs @@ -18,10 +18,10 @@ public class Kaboom : GlobalEvent, IEvent /// public override string Description { get; } = "Les portes sont piegés attention!"; - public override string[] AltDescription => - [ + public override string[] AltDescription => new string[] + { "La guerrilla est présente" - ]; + }; /// public override int WeightedChance { get; set; } = 2; diff --git a/KruacentExiled/KE.GlobalEventFramework.Examples/GE/OpenBar.cs b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/OpenBar.cs index 1960cb0b..47eed3fa 100644 --- a/KruacentExiled/KE.GlobalEventFramework.Examples/GE/OpenBar.cs +++ b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/OpenBar.cs @@ -24,12 +24,12 @@ public class OpenBar : GlobalEvent, IStart, IEvent public int NbAdditionalDoor = 3; - public static readonly HashSet DoorsToUnlock = new() + public static readonly HashSet DoorsToUnlock = new HashSet() { DoorType.GateA, DoorType.GateB, }; - public static readonly HashSet DoorsToMaybeUnlock = new() + public static readonly HashSet DoorsToMaybeUnlock = new HashSet() { DoorType.HczArmory, DoorType.HIDChamber,DoorType.Intercom,DoorType.Scp049Armory,DoorType.Scp096,DoorType.Scp106Primary,DoorType.Scp106Secondary,DoorType.Scp330,DoorType.Scp914Gate }; @@ -39,7 +39,7 @@ public class OpenBar : GlobalEvent, IStart, IEvent public void Start() { List door = DoorsToMaybeUnlock.ToList(); - List result = new(); + List result = new List(); for (int i = 0; i < NbAdditionalDoor; i++) { diff --git a/KruacentExiled/KE.GlobalEventFramework.Examples/GE/RandomSpawn.cs b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/RandomSpawn.cs index 0afea2f6..69265bfc 100644 --- a/KruacentExiled/KE.GlobalEventFramework.Examples/GE/RandomSpawn.cs +++ b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/RandomSpawn.cs @@ -19,7 +19,7 @@ namespace KE.GlobalEventFramework.Examples.GE /// All spawn are random at the start of the game (NTF & Chaos not included) /// Note: all role spawn with each other except SCPs /// - public class RandomSpawn : GlobalEvent,IStart + public class RandomSpawn : GlobalEvent, IStart { /// public override uint Id { get; set; } = 1043; @@ -30,7 +30,7 @@ public class RandomSpawn : GlobalEvent,IStart /// public override int WeightedChance { get; set; } = 5; public override ImpactLevel ImpactLevel => ImpactLevel.High; - public IEnumerable BlacklistedRooms { get; } = [RoomType.EzGateA, RoomType.EzGateB]; + public IEnumerable BlacklistedRooms { get; } = new List() { RoomType.EzGateA, RoomType.EzGateB }; /// public void Start() { diff --git a/KruacentExiled/KE.GlobalEventFramework.Examples/GE/Rollback.cs b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/Rollback.cs index 996efd5b..99daf180 100644 --- a/KruacentExiled/KE.GlobalEventFramework.Examples/GE/Rollback.cs +++ b/KruacentExiled/KE.GlobalEventFramework.Examples/GE/Rollback.cs @@ -23,10 +23,10 @@ public class RollBack: GlobalEvent, IAsyncStart public override string Name { get; set; } = "RollBack"; /// public override string Description { get; } = "Shit the server is lagging"; - public override string[] AltDescription => - [ + public override string[] AltDescription => new string[] + { "Pov Omer" - ]; + }; /// public override int WeightedChance { get; set; } = 1; @@ -34,7 +34,7 @@ public class RollBack: GlobalEvent, IAsyncStart public static float Luck = 5; public override ImpactLevel ImpactLevel => ImpactLevel.High; - private Dictionary playerpos = new(); + private Dictionary playerpos = new Dictionary(); /// public IEnumerator Start() diff --git a/KruacentExiled/KE.GlobalEventFramework.Examples/MainPlugin.cs b/KruacentExiled/KE.GlobalEventFramework.Examples/MainPlugin.cs index 6ec91f79..bfe91663 100644 --- a/KruacentExiled/KE.GlobalEventFramework.Examples/MainPlugin.cs +++ b/KruacentExiled/KE.GlobalEventFramework.Examples/MainPlugin.cs @@ -40,7 +40,7 @@ public override void OnEnabled() //Kannassie.LoadVoiceLine(); Log.Debug("patching"); - Harmony = new(Name); + Harmony = new Harmony(Name); //Harmony.PatchAll(); } diff --git a/KruacentExiled/KE.GlobalEventFramework.Examples/MiddleEvents/Speed.cs b/KruacentExiled/KE.GlobalEventFramework.Examples/MiddleEvents/Speed.cs index 77aa71ae..cdf7e574 100644 --- a/KruacentExiled/KE.GlobalEventFramework.Examples/MiddleEvents/Speed.cs +++ b/KruacentExiled/KE.GlobalEventFramework.Examples/MiddleEvents/Speed.cs @@ -24,7 +24,7 @@ public class SpeedM : MiddleEvent, IAsyncStart, IEvent public override string Description { get; set; } = "Gas! gas! gas!"; /// public override int WeightedChance { get; set; } = 1; - public override uint[] IncompatibleEvents => [1042]; + public override uint[] IncompatibleEvents => new uint[] { 1042 }; /// /// intensity of the movement boost effect /// diff --git a/KruacentExiled/KE.GlobalEventFramework/GEFE/API/Features/GlobalEvent.cs b/KruacentExiled/KE.GlobalEventFramework/GEFE/API/Features/GlobalEvent.cs index be094167..d3453e81 100644 --- a/KruacentExiled/KE.GlobalEventFramework/GEFE/API/Features/GlobalEvent.cs +++ b/KruacentExiled/KE.GlobalEventFramework/GEFE/API/Features/GlobalEvent.cs @@ -69,9 +69,9 @@ private void OnRoundStarted() private static Config Config => MainPlugin.Configs; - private static GlobalEventHandler _handler = new(); + private static GlobalEventHandler _handler = new GlobalEventHandler(); - private static HashSet _activeGE = new(); + private static HashSet _activeGE = new HashSet(); public static IReadOnlyDictionary ImpactToColor = new Dictionary() { @@ -84,7 +84,7 @@ private void OnRoundStarted() }; - public static HashSet ForcedGE { get; } = new(); + public static HashSet ForcedGE { get; } = new HashSet(); /// @@ -176,11 +176,11 @@ private List AllDesc { get { - List allDesc = - [ - Description, - .. AltDescription - ]; + List allDesc = new List() + { + Description, + }; + allDesc.AddRange(AltDescription); return allDesc; } } diff --git a/KruacentExiled/KE.GlobalEventFramework/GEFE/API/Features/KEEvents.cs b/KruacentExiled/KE.GlobalEventFramework/GEFE/API/Features/KEEvents.cs index ad30f62a..b05e249c 100644 --- a/KruacentExiled/KE.GlobalEventFramework/GEFE/API/Features/KEEvents.cs +++ b/KruacentExiled/KE.GlobalEventFramework/GEFE/API/Features/KEEvents.cs @@ -27,16 +27,16 @@ public abstract class KEEvents public abstract string Name { get; set; } public virtual int WeightedChance { get; set; } = 1; public virtual uint[] IncompatibleEvents { get; set; } = new uint[0]; - protected HashSet CoroutineHandles { get; } = new(); - protected static readonly HashSet s_activeEvents = new(); + protected HashSet CoroutineHandles { get; } = new HashSet(); + protected static readonly HashSet s_activeEvents = new HashSet(); #endregion #region Static Variables - private static Dictionary _idLookup = new(); - private static Dictionary _nameLookup = new(); + private static Dictionary _idLookup = new Dictionary(); + private static Dictionary _nameLookup = new Dictionary(); - public static HashSet List => [.._idLookup.Values]; + public static HashSet List => new HashSet(_idLookup.Values); #endregion #region Events @@ -49,7 +49,7 @@ public abstract class KEEvents public static IEnumerable RegisterAll() { - List assemblies = new(); + List assemblies = new List(); foreach(var plugin in Exiled.Loader.Loader.Plugins) { if (!assemblies.Contains(plugin.Assembly) && plugin.Config.IsEnabled) @@ -150,7 +150,7 @@ protected static void EnableEvents(IEnumerable events) foreach (KEEvents ev in events) { Log.Info("enabling " + ev.Name); - EnablingEventArgs args = new(ev, true); + EnablingEventArgs args = new EnablingEventArgs(ev, true); KEEventsHandler.OnEnabling(args); if (!args.IsAllowed) continue; @@ -174,7 +174,7 @@ protected static void EnableEvents(IEnumerable events) s_activeEvents.Add(ev); - KEEventsHandler.OnEnabled(new(ev)); + KEEventsHandler.OnEnabled(new EnabledEventArgs(ev)); } } @@ -193,7 +193,7 @@ protected static void DisableEvents(IEnumerable events) Timing.KillCoroutines(handle); } ev.Disable(ev); - KEEventsHandler.OnDisabled(new(ev)); + KEEventsHandler.OnDisabled(new DisabledEventArgs(ev)); } } @@ -205,11 +205,11 @@ protected virtual void Disable(KEEvents ev) protected static IEnumerable GetRandomEvent(int numberEvent = 1) where T : KEEvents { - List result = new(); - List weightedPool = new(); + List result = new List(); + List weightedPool = new List(); foreach (T ge in List.Where(ev => ev is T)) { - if (ge is not IConditional || (ge is IConditional c && c.Condition())) + if (!(ge is IConditional) || (ge is IConditional c && c.Condition())) { if (!ge.IsCompatible()) continue; for (int i = 0; i < ge.WeightedChance; i++) diff --git a/KruacentExiled/KE.GlobalEventFramework/GEFE/API/Features/MiddleEvent.cs b/KruacentExiled/KE.GlobalEventFramework/GEFE/API/Features/MiddleEvent.cs index 71aed8d6..f16fb686 100644 --- a/KruacentExiled/KE.GlobalEventFramework/GEFE/API/Features/MiddleEvent.cs +++ b/KruacentExiled/KE.GlobalEventFramework/GEFE/API/Features/MiddleEvent.cs @@ -58,7 +58,7 @@ private void OnRestartingRound() } private void OnRoundStarted() { - TimeToActivate = new(0,UnityEngine.Random.Range(MinTimeToActivate.Minutes,MaxTimeToActivate.Minutes),0); + TimeToActivate = new TimeSpan(0,UnityEngine.Random.Range(MinTimeToActivate.Minutes,MaxTimeToActivate.Minutes),0); _handle = Timing.RunCoroutine(Timer()); } @@ -81,12 +81,12 @@ private IEnumerator Timer() public abstract string Description { get; set; } public static float Chance = 37; - public static TimeSpan MinTimeToActivate = new(0, 10, 0); - public static TimeSpan MaxTimeToActivate = new(0, 16, 0); + public static TimeSpan MinTimeToActivate = new TimeSpan(0, 10, 0); + public static TimeSpan MaxTimeToActivate = new TimeSpan(0, 16, 0); private static TimeSpan TimeToActivate; - private static HashSet _activeEv = new(); - private static MiddleEventHandler _handler = new(); + private static HashSet _activeEv = new HashSet(); + private static MiddleEventHandler _handler = new MiddleEventHandler(); public static IReadOnlyCollection ActiveMiddleEvent => _activeEv; diff --git a/KruacentExiled/KE.GlobalEventFramework/GEFE/Commands/ForceGE.cs b/KruacentExiled/KE.GlobalEventFramework/GEFE/Commands/ForceGE.cs index 10a47673..87db8254 100644 --- a/KruacentExiled/KE.GlobalEventFramework/GEFE/Commands/ForceGE.cs +++ b/KruacentExiled/KE.GlobalEventFramework/GEFE/Commands/ForceGE.cs @@ -15,7 +15,7 @@ public class ForceGE : ICommand public string Command { get; } = "force"; public string[] Aliases { get; } = new string[] { "f" }; public string Description { get; } = "force a or multiple global event"; - internal static List ForcedGE { get; } = new(); + internal static List ForcedGE { get; } = new List(); public bool Execute(ArraySegment arguments, ICommandSender sender, out string response) { diff --git a/KruacentExiled/KE.GlobalEventFramework/GEFE/Exceptions/FailedRegisterException.cs b/KruacentExiled/KE.GlobalEventFramework/GEFE/Exceptions/FailedRegisterException.cs index 4a2d24da..cbfe635a 100644 --- a/KruacentExiled/KE.GlobalEventFramework/GEFE/Exceptions/FailedRegisterException.cs +++ b/KruacentExiled/KE.GlobalEventFramework/GEFE/Exceptions/FailedRegisterException.cs @@ -6,8 +6,12 @@ namespace KE.GlobalEventFramework.GEFE.Exceptions { - public class FailedRegisterException(string message) : Exception(message) + public class FailedRegisterException : Exception { + public FailedRegisterException(string message) : base(message) + { + + } } } diff --git a/KruacentExiled/KE.GlobalEventFramework/MainPlugin.cs b/KruacentExiled/KE.GlobalEventFramework/MainPlugin.cs index 7ae7ed15..98c861f6 100644 --- a/KruacentExiled/KE.GlobalEventFramework/MainPlugin.cs +++ b/KruacentExiled/KE.GlobalEventFramework/MainPlugin.cs @@ -14,8 +14,8 @@ internal class MainPlugin : KEPlugin - public static readonly HintPlacement GEAnnouncement = new(0, 50, HintServiceMeow.Core.Enum.HintAlignment.Center); - public static readonly HintPlacement GEEffect = new(360, 300, HintServiceMeow.Core.Enum.HintAlignment.Right); + public static readonly HintPlacement GEAnnouncement = new HintPlacement(0, 50, HintServiceMeow.Core.Enum.HintAlignment.Center); + public static readonly HintPlacement GEEffect = new HintPlacement(360, 300, HintServiceMeow.Core.Enum.HintAlignment.Right); internal static MainPlugin Instance { get; private set;} diff --git a/KruacentExiled/KE.Items/API/Core/Models/PickupModel.cs b/KruacentExiled/KE.Items/API/Core/Models/PickupModel.cs index de239866..48a2353d 100644 --- a/KruacentExiled/KE.Items/API/Core/Models/PickupModel.cs +++ b/KruacentExiled/KE.Items/API/Core/Models/PickupModel.cs @@ -29,7 +29,7 @@ public PickupModel(CustomItem customItem) public void SubscribeEvents() { - PickupToParent = new(); + PickupToParent = new Dictionary(); ItemPickupBase.OnPickupAdded += OnPickupAdded; ItemPickupBase.OnPickupDestroyed += OnPickupDestroyed; diff --git a/KruacentExiled/KE.Items/API/Core/Settings/SettingsHandler.cs b/KruacentExiled/KE.Items/API/Core/Settings/SettingsHandler.cs index b0f397d7..a922cec8 100644 --- a/KruacentExiled/KE.Items/API/Core/Settings/SettingsHandler.cs +++ b/KruacentExiled/KE.Items/API/Core/Settings/SettingsHandler.cs @@ -28,17 +28,16 @@ public SettingsHandler() { HeaderSetting header = new HeaderSetting(_idHeader, "Custom Items", padding: true); - List settings = - [ - + List settings = new List() + { + new TwoButtonsSetting(_idDesc,SettingDescription,SettingDescription1,SettingDescription2,true,SettingDescriptionDescription), new TwoButtonsSetting(_idPrefix,"Pickup/Select prefixes","Disabled","Enabled",false,"show/hide the whole sentence for the picking or selecting of the item, if hidden it will show a (P) if pickup or a (I) if in inventory before the name of the item "), new SliderSetting(_idTimeCustomItem,"Time shown",0,30,10), new SliderSetting(_idTimeCustomItemEffect,"Time effect shown",0,30,10), + }; - ]; - - SettingsCategory category = new(header,999, settings); + SettingsCategory category = new SettingsCategory(header,999, settings); //page = new("Custom Items", settings); diff --git a/KruacentExiled/KE.Items/API/Core/Upgrade/UpgradeHandler.cs b/KruacentExiled/KE.Items/API/Core/Upgrade/UpgradeHandler.cs index 2861bae5..b6d77171 100644 --- a/KruacentExiled/KE.Items/API/Core/Upgrade/UpgradeHandler.cs +++ b/KruacentExiled/KE.Items/API/Core/Upgrade/UpgradeHandler.cs @@ -49,7 +49,7 @@ private void UpgradePickUp(UpgradingPickupEventArgs ev) { if (!CustomItem.TryGet(ev.Pickup, out CustomItem ci)) return; - if (ci is not IUpgradableCustomItem upgradable) return; + if (!(ci is IUpgradableCustomItem upgradable)) return; Log.Debug("upgrading pickup"); if(upgradable.Upgrade is null || upgradable.Upgrade.Count == 0) diff --git a/KruacentExiled/KE.Items/API/Features/Complexes/ComplexBase.cs b/KruacentExiled/KE.Items/API/Features/Complexes/ComplexBase.cs index f7ac54ad..4c08cf30 100644 --- a/KruacentExiled/KE.Items/API/Features/Complexes/ComplexBase.cs +++ b/KruacentExiled/KE.Items/API/Features/Complexes/ComplexBase.cs @@ -79,7 +79,7 @@ private void OnSearched(LabApi.Features.Wrappers.Player ev) public bool AddPlayer(Player player) { - if (this.player is not null) return false; + if (!(this.player is null)) return false; this.player = player; return true; diff --git a/KruacentExiled/KE.Items/API/Features/KECustomItem.cs b/KruacentExiled/KE.Items/API/Features/KECustomItem.cs index 74bf5eb0..b58b9ac0 100644 --- a/KruacentExiled/KE.Items/API/Features/KECustomItem.cs +++ b/KruacentExiled/KE.Items/API/Features/KECustomItem.cs @@ -27,9 +27,9 @@ public abstract class KECustomItem : CustomItem { - private static Dictionary _typeLookup = new(); + private static Dictionary _typeLookup = new Dictionary(); - private static Dictionary _nameLookup = new(); + private static Dictionary _nameLookup = new Dictionary(); [Obsolete("Uses only the name",true)] @@ -66,14 +66,14 @@ public sealed override ItemType Type private Dictionary> GetBasicTranslation() { - return new() + return new Dictionary>() { - ["en"] = new() + ["en"] = new Dictionary() { [PickupKey] = "You've picked up ", [InventoryKey] = "You've selected ", }, - ["fr"] = new() + ["fr"] = new Dictionary() { [PickupKey] = "Tu as pris ", [InventoryKey] = "Tu as selectionné ", @@ -184,7 +184,7 @@ public override uint Spawn(IEnumerable spawnPoints, uint limit) Log.Debug(room.Room+ " : "+PoseRoomSpawnPointHandler.UsablePoses.Count(p => p.roomType == room.Room)); Log.Debug($"spawning {this.Name} in {room.Room}" ); - if (spawn is not null) + if (spawn != null) { Log.Debug($"spawning custom pos"); pickup = Spawn(spawn.Position); @@ -197,7 +197,7 @@ public override uint Spawn(IEnumerable spawnPoints, uint limit) - if (pickup is not null) + if (pickup != null) { num++; } diff --git a/KruacentExiled/KE.Items/API/Features/KECustomKeycard.cs b/KruacentExiled/KE.Items/API/Features/KECustomKeycard.cs index 41e43aed..8a8b1a57 100644 --- a/KruacentExiled/KE.Items/API/Features/KECustomKeycard.cs +++ b/KruacentExiled/KE.Items/API/Features/KECustomKeycard.cs @@ -39,7 +39,7 @@ public override uint Spawn(IEnumerable spawnPoints, uint limit) Log.Debug($"spawning {this.Name} in {room.Room}"); Log.Debug(room.Room + " : " + PoseRoomSpawnPointHandler.UsablePoses.Count(p => p.roomType == room.Room)); - if (spawn is not null) + if (spawn != null) { Log.Debug($"spawning custom pos"); pickup = Spawn(spawn.Position); @@ -52,7 +52,7 @@ public override uint Spawn(IEnumerable spawnPoints, uint limit) - if (pickup is not null) + if (pickup != null) { num++; } diff --git a/KruacentExiled/KE.Items/API/Features/KECustomWeapon.cs b/KruacentExiled/KE.Items/API/Features/KECustomWeapon.cs index 854872b9..3e90cfbf 100644 --- a/KruacentExiled/KE.Items/API/Features/KECustomWeapon.cs +++ b/KruacentExiled/KE.Items/API/Features/KECustomWeapon.cs @@ -133,7 +133,7 @@ protected virtual void OnReloaded(ReloadedWeaponEventArgs ev) public override Pickup Spawn(Vector3 position, Player previousOwner = null) { - if (Item.Create(Type) is not Firearm firearm) + if (!(Item.Create(Type) is Firearm firearm)) { Log.Debug("Spawn: Item is not Firearm."); return null; diff --git a/KruacentExiled/KE.Items/API/Features/SpawnPoints/PoseRoomSpawnPoint.cs b/KruacentExiled/KE.Items/API/Features/SpawnPoints/PoseRoomSpawnPoint.cs index 15ab5407..520fc9c2 100644 --- a/KruacentExiled/KE.Items/API/Features/SpawnPoints/PoseRoomSpawnPoint.cs +++ b/KruacentExiled/KE.Items/API/Features/SpawnPoints/PoseRoomSpawnPoint.cs @@ -68,8 +68,8 @@ public bool Equals(ItemSpawn other) } } - public static readonly HashSet AllPoses = new(); - private static HashSet usablePoses = new(); + public static readonly HashSet AllPoses = new HashSet(); + private static HashSet usablePoses = new HashSet(); public static IReadOnlyCollection UsablePoses => usablePoses; public static ItemSpawn UseRandomPose(RoomType roomType) diff --git a/KruacentExiled/KE.Items/CommandPos.cs b/KruacentExiled/KE.Items/CommandPos.cs index 9fe0d44b..394bdac1 100644 --- a/KruacentExiled/KE.Items/CommandPos.cs +++ b/KruacentExiled/KE.Items/CommandPos.cs @@ -17,7 +17,7 @@ internal class CommandPos : ICommand { public string Command => "curpos"; - public string[] Aliases => []; + public string[] Aliases => new string[0]; public string Description => "position"; @@ -26,7 +26,7 @@ public bool Execute(ArraySegment arguments, ICommandSender sender, out s var p = Player.Get(sender); response = string.Empty; - if(p is not null) + if(p != null) { Primitive prim = Primitive.Create(p.Position, null, Vector3.one * .1f, true); diff --git a/KruacentExiled/KE.Items/CommandPosRoom.cs b/KruacentExiled/KE.Items/CommandPosRoom.cs index cdd5055b..7d7899fb 100644 --- a/KruacentExiled/KE.Items/CommandPosRoom.cs +++ b/KruacentExiled/KE.Items/CommandPosRoom.cs @@ -20,7 +20,7 @@ internal class CommandPosRoom : ICommand { public string Command => "roompos"; - public string[] Aliases => []; + public string[] Aliases => new string[0]; public string Description => "position"; @@ -29,7 +29,7 @@ public bool Execute(ArraySegment arguments, ICommandSender sender, out s var p = Player.Get(sender); response = string.Empty; - if(p is not null) + if(p != null) { Room room = p.CurrentRoom; @@ -49,7 +49,7 @@ public bool Execute(ArraySegment arguments, ICommandSender sender, out s public static void ShowPoses(RoomType roomType) { - List primitives = new(); + List primitives = new List(); Room room = Room.Get(roomType); foreach (ItemSpawn pose in AllPoses.Where(p => p.roomType == roomType)) { diff --git a/KruacentExiled/KE.Items/Commands/ForceAddFeed.cs b/KruacentExiled/KE.Items/Commands/ForceAddFeed.cs index ede1ba02..585b3342 100644 --- a/KruacentExiled/KE.Items/Commands/ForceAddFeed.cs +++ b/KruacentExiled/KE.Items/Commands/ForceAddFeed.cs @@ -11,11 +11,11 @@ internal class ForceAddFeed : Utils.API.Commands.KECommand { public override string Command => "forceaddfeed"; - public override string[] Aliases => []; + public override string[] Aliases => new string[0]; public override string Description => "add a feed"; - public override string[] Usage => []; + public override string[] Usage => new string[0]; public override bool ExecuteCommand(ArraySegment arguments, ICommandSender sender, out string response) { diff --git a/KruacentExiled/KE.Items/Commands/Give.cs b/KruacentExiled/KE.Items/Commands/Give.cs index 74f3b203..929b1ca6 100644 --- a/KruacentExiled/KE.Items/Commands/Give.cs +++ b/KruacentExiled/KE.Items/Commands/Give.cs @@ -17,7 +17,7 @@ internal class Give : ICommand { public string Command => "give"; - public string[] Aliases => ["g"]; + public string[] Aliases => new string[] { "g" }; public string Description => "give"; diff --git a/KruacentExiled/KE.Items/Commands/KECustomItems.cs b/KruacentExiled/KE.Items/Commands/KECustomItems.cs index 51c50584..52aab765 100644 --- a/KruacentExiled/KE.Items/Commands/KECustomItems.cs +++ b/KruacentExiled/KE.Items/Commands/KECustomItems.cs @@ -9,7 +9,7 @@ internal class KECustomItems : KE.Utils.API.Commands.KEParentCommand { public override string Command => "keci"; - public override string[] Aliases => []; + public override string[] Aliases => new string[0]; public override string Description => "kecustom item parent command"; diff --git a/KruacentExiled/KE.Items/Commands/List.cs b/KruacentExiled/KE.Items/Commands/List.cs index 614f030b..db6a4d01 100644 --- a/KruacentExiled/KE.Items/Commands/List.cs +++ b/KruacentExiled/KE.Items/Commands/List.cs @@ -13,7 +13,7 @@ internal class List : ICommand { public string Command => "list"; - public string[] Aliases => ["l"]; + public string[] Aliases => new string[] { "l" }; public string Description => "list"; diff --git a/KruacentExiled/KE.Items/Items/Defibrilator.cs b/KruacentExiled/KE.Items/Items/Defibrilator.cs index 9726d811..4013d824 100644 --- a/KruacentExiled/KE.Items/Items/Defibrilator.cs +++ b/KruacentExiled/KE.Items/Items/Defibrilator.cs @@ -26,9 +26,9 @@ public class Defibrillator : KECustomItem, ILumosItem public const string TranslationInProgress = "DefibrillatorInProgress"; protected override Dictionary> SetTranslation() { - return new() + return new Dictionary>() { - ["en"] = new() + ["en"] = new Dictionary() { [TranslationKeyName] = "Defibrillator", [TranslationKeyDesc] = "Aim for a dead body to try to resuscitate him", @@ -39,7 +39,7 @@ protected override Dictionary> SetTranslation [TranslationSucceed] = "Successfully ressucitate %PatientName%!", [TranslationInProgress] = "In progress", }, - ["fr"] = new() + ["fr"] = new Dictionary() { [TranslationKeyName] = "Défibrillateur", [TranslationKeyDesc] = "Visez un cadavre de près pour tenter une réanimation.", @@ -86,7 +86,7 @@ private struct DeathData protected override void SubscribeEvents() { - _deathRecords = new(); + _deathRecords = new Dictionary(); Exiled.Events.Handlers.Player.UsingItem += OnUsingItem; Exiled.Events.Handlers.Player.Dying += OnDying; base.SubscribeEvents(); diff --git a/KruacentExiled/KE.Items/Items/DeployableWall.cs b/KruacentExiled/KE.Items/Items/DeployableWall.cs index f10aabb0..41bd7c4b 100644 --- a/KruacentExiled/KE.Items/Items/DeployableWall.cs +++ b/KruacentExiled/KE.Items/Items/DeployableWall.cs @@ -15,14 +15,14 @@ public class DeployableWall : KECustomItem, ILumosItem, ISwitchableEffect { protected override Dictionary> SetTranslation() { - return new() + return new Dictionary>() { - ["en"] = new() + ["en"] = new Dictionary() { [TranslationKeyName] = "Deployable Wall", [TranslationKeyDesc] = "Drop to deploy a wall", }, - ["fr"] = new() + ["fr"] = new Dictionary() { [TranslationKeyName] = "Mur", [TranslationKeyDesc] = "Lâcher pour faire un mur", diff --git a/KruacentExiled/KE.Items/Items/DivinePills.cs b/KruacentExiled/KE.Items/Items/DivinePills.cs index 6f2ee49b..1c8a8066 100644 --- a/KruacentExiled/KE.Items/Items/DivinePills.cs +++ b/KruacentExiled/KE.Items/Items/DivinePills.cs @@ -15,14 +15,14 @@ public class DivinePills : KECustomItem, ILumosItem, ISwitchableEffect, IUpgrada { protected override Dictionary> SetTranslation() { - return new() + return new Dictionary>() { - ["en"] = new() + ["en"] = new Dictionary() { [TranslationKeyName] = "Divine Pills", [TranslationKeyDesc] = "25% chance you die\n 75% you respawn someone\n", }, - ["fr"] = new() + ["fr"] = new Dictionary() { [TranslationKeyName] = "Divine Pills", [TranslationKeyDesc] = "25% de chance de mourrir\n 75% de ramener quelqu'un à la vie", diff --git a/KruacentExiled/KE.Items/Items/Drone.cs b/KruacentExiled/KE.Items/Items/Drone.cs index faa0701b..19c09610 100644 --- a/KruacentExiled/KE.Items/Items/Drone.cs +++ b/KruacentExiled/KE.Items/Items/Drone.cs @@ -24,14 +24,14 @@ public class Drone : KECustomItem protected override Dictionary> SetTranslation() { - return new() + return new Dictionary>() { - ["en"] = new() + ["en"] = new Dictionary() { [TranslationKeyName] = "Drone", [TranslationKeyDesc] = "Military drone (drop to use)", }, - ["fr"] = new() + ["fr"] = new Dictionary() { [TranslationKeyName] = "Drone", [TranslationKeyDesc] = "Drone de reconnaissance militaire (lâcher pour l'utiliser)", diff --git a/KruacentExiled/KE.Items/Items/FriendMaker.cs b/KruacentExiled/KE.Items/Items/FriendMaker.cs index 3366717c..1475b384 100644 --- a/KruacentExiled/KE.Items/Items/FriendMaker.cs +++ b/KruacentExiled/KE.Items/Items/FriendMaker.cs @@ -21,9 +21,9 @@ public class FriendMaker : KECustomWeapon, IViolentItem public const string TranslationSuccess = "FriendMakerSuccess"; protected override Dictionary> SetTranslation() { - return new() + return new Dictionary>() { - ["en"] = new() + ["en"] = new Dictionary() { [TranslationKeyName] = "Friend Maker™", [TranslationKeyDesc] = "The number one (1) method to make friends", @@ -33,7 +33,7 @@ protected override Dictionary> SetTranslation [TranslationNonZombie] = "That ain't a zombie", [TranslationSuccess] = "New friend acquired!", }, - ["fr"] = new() + ["fr"] = new Dictionary() { [TranslationKeyName] = "Friend Maker™", [TranslationKeyDesc] = "LA méthode pour se faire des amis ! Produit non remboursable", @@ -58,11 +58,11 @@ protected override Dictionary> SetTranslation private Dictionary cooldowns; - private TimeSpan Cooldown = new(0,1,0); + private TimeSpan Cooldown = new TimeSpan(0,1,0); protected override void SubscribeEvents() { - cooldowns = new(); + cooldowns = new Dictionary(); base.SubscribeEvents(); } protected override void UnsubscribeEvents() diff --git a/KruacentExiled/KE.Items/Items/HealZone.cs b/KruacentExiled/KE.Items/Items/HealZone.cs index bae794b5..ef324def 100644 --- a/KruacentExiled/KE.Items/Items/HealZone.cs +++ b/KruacentExiled/KE.Items/Items/HealZone.cs @@ -16,14 +16,14 @@ public class HealZone : KECustomGrenade, ILumosItem, ISwitchableEffect, IUpgrada { protected override Dictionary> SetTranslation() { - return new() + return new Dictionary>() { - ["en"] = new() + ["en"] = new Dictionary() { [TranslationKeyName] = "Heal Zone", [TranslationKeyDesc] = "Allow to heal you and your ally", }, - ["fr"] = new() + ["fr"] = new Dictionary() { [TranslationKeyName] = "Heal Zone", [TranslationKeyDesc] = "Créer une zone pour soigner", diff --git a/KruacentExiled/KE.Items/Items/ImpactFlash.cs b/KruacentExiled/KE.Items/Items/ImpactFlash.cs index 5d19b984..25a662e7 100644 --- a/KruacentExiled/KE.Items/Items/ImpactFlash.cs +++ b/KruacentExiled/KE.Items/Items/ImpactFlash.cs @@ -12,14 +12,14 @@ public class ImpactFlash : KECustomGrenade, IViolentItem { protected override Dictionary> SetTranslation() { - return new() + return new Dictionary>() { - ["en"] = new() + ["en"] = new Dictionary() { [TranslationKeyName] = "Impact Flash", [TranslationKeyDesc] = "The name is self-explanatory", }, - ["fr"] = new() + ["fr"] = new Dictionary() { [TranslationKeyName] = "Impact Flash", [TranslationKeyDesc] = "Une flashbang qui explose à l'impacte", diff --git a/KruacentExiled/KE.Items/Items/ItemEffects/DeployableWallEffect.cs b/KruacentExiled/KE.Items/Items/ItemEffects/DeployableWallEffect.cs index 320aee3d..b45825e5 100644 --- a/KruacentExiled/KE.Items/Items/ItemEffects/DeployableWallEffect.cs +++ b/KruacentExiled/KE.Items/Items/ItemEffects/DeployableWallEffect.cs @@ -46,7 +46,7 @@ private void SpawnWall(Vector3 pos, Quaternion rotation) }); Timing.CallDelayed(5, () => { - if(wall is not null) + if(wall != null) { wall.Color = Color.yellow; } @@ -54,7 +54,7 @@ private void SpawnWall(Vector3 pos, Quaternion rotation) }); Timing.CallDelayed(8, () => { - if (wall is not null) + if (wall != null) { wall.Color = Color.red; } diff --git a/KruacentExiled/KE.Items/Items/ItemEffects/TPGrenadaEffect.cs b/KruacentExiled/KE.Items/Items/ItemEffects/TPGrenadaEffect.cs index d7b1cbe5..7f574cb1 100644 --- a/KruacentExiled/KE.Items/Items/ItemEffects/TPGrenadaEffect.cs +++ b/KruacentExiled/KE.Items/Items/ItemEffects/TPGrenadaEffect.cs @@ -19,7 +19,7 @@ public class TPGrenadaEffect : CustomItemEffect private List effectedPlayers = new List(); public HashSet BlacklistedRoles { get; set; } = new HashSet() { RoleTypeId.Scp173, RoleTypeId.Scp106, RoleTypeId.Scp049, RoleTypeId.Scp096, RoleTypeId.Scp3114, RoleTypeId.Scp0492, RoleTypeId.Scp939 }; - public HashSet BlacklistedRooms { get; } = new() + public HashSet BlacklistedRooms { get; } = new HashSet() { RoomType.HczTestRoom, RoomType.HczTesla, @@ -28,11 +28,11 @@ public class TPGrenadaEffect : CustomItemEffect public override void Effect(UsedItemEventArgs ev) { - OnExploding([ev.Player]); + OnExploding(new HashSet() { ev.Player }); } public override void Effect(DroppingItemEventArgs ev) { - OnExploding([ev.Player]); + OnExploding(new HashSet() { ev.Player }); } public override void Effect(ExplodingGrenadeEventArgs ev) diff --git a/KruacentExiled/KE.Items/Items/LeSoleil/LeSoleil.cs b/KruacentExiled/KE.Items/Items/LeSoleil/LeSoleil.cs index 3cef6625..16a24cce 100644 --- a/KruacentExiled/KE.Items/Items/LeSoleil/LeSoleil.cs +++ b/KruacentExiled/KE.Items/Items/LeSoleil/LeSoleil.cs @@ -25,14 +25,14 @@ public class LeSoleil : KECustomGrenade, IUpgradableCustomItem, IViolentItem { protected override Dictionary> SetTranslation() { - return new() + return new Dictionary>() { - ["en"] = new() + ["en"] = new Dictionary() { [TranslationKeyName] = "The Sun", [TranslationKeyDesc] = "Probably not the best idea to use it", }, - ["fr"] = new() + ["fr"] = new Dictionary() { [TranslationKeyName] = "Le Soleil", [TranslationKeyDesc] = "pas ouf", @@ -64,7 +64,7 @@ protected override void OnExplodingGrenade(ExplodingGrenadeEventArgs ev) private void CastTheSun() { - Vector3 position = new(58.72f, 300, 20f); + Vector3 position = new Vector3(58.72f, 300, 20f); Primitive prim = Primitive.Create(position, null, null, false); prim.Flags = AdminToys.PrimitiveFlags.None; diff --git a/KruacentExiled/KE.Items/Items/LowGravityGrenade.cs b/KruacentExiled/KE.Items/Items/LowGravityGrenade.cs index f26ada0b..42e12a2f 100644 --- a/KruacentExiled/KE.Items/Items/LowGravityGrenade.cs +++ b/KruacentExiled/KE.Items/Items/LowGravityGrenade.cs @@ -12,14 +12,14 @@ public class LowGravityGrenade : KECustomGrenade, ISwitchableEffect, IViolentIte { protected override Dictionary> SetTranslation() { - return new() + return new Dictionary>() { - ["en"] = new() + ["en"] = new Dictionary() { [TranslationKeyName] = "Low Gravity Grenade", [TranslationKeyDesc] = "You always wanna be on the moon, if the answer is yes this grenade will grant your wishes!", }, - ["fr"] = new() + ["fr"] = new Dictionary() { [TranslationKeyName] = "Grenade basse gravité", [TranslationKeyDesc] = "Pour aller attraper les étoiles", diff --git a/KruacentExiled/KE.Items/Items/MScan.cs b/KruacentExiled/KE.Items/Items/MScan.cs index f51a546a..9a607aa4 100644 --- a/KruacentExiled/KE.Items/Items/MScan.cs +++ b/KruacentExiled/KE.Items/Items/MScan.cs @@ -30,9 +30,9 @@ public class MScan : KECustomItem protected override Dictionary> SetTranslation() { - return new() + return new Dictionary>() { - ["en"] = new() + ["en"] = new Dictionary() { [TranslationKeyName] = "M-Scan", [TranslationKeyDesc] = "Detect movement", @@ -42,7 +42,7 @@ protected override Dictionary> SetTranslation [NoBattery] = "M-Scan : No battery left", [Detect] = "M-SCAN: %Name%", }, - ["fr"] = new() + ["fr"] = new Dictionary() { [TranslationKeyName] = "M-Scan", [TranslationKeyDesc] = "Détecte les mouvements des personnes passant devant", @@ -85,7 +85,7 @@ protected override Dictionary> SetTranslation private Dictionary Cooldowns = new Dictionary(); private Dictionary BatteryLife = new Dictionary(); - private Dictionary Models = new(); + private Dictionary Models = new Dictionary(); private CoroutineHandle SensorRoutine; diff --git a/KruacentExiled/KE.Items/Items/Molotov.cs b/KruacentExiled/KE.Items/Items/Molotov.cs index b853b954..09ac8633 100644 --- a/KruacentExiled/KE.Items/Items/Molotov.cs +++ b/KruacentExiled/KE.Items/Items/Molotov.cs @@ -20,14 +20,14 @@ public class Molotov : KECustomGrenade, ISwitchableEffect, ICustomPickupModel, I { protected override Dictionary> SetTranslation() { - return new() + return new Dictionary>() { - ["en"] = new() + ["en"] = new Dictionary() { [TranslationKeyName] = "Molotov Cocktail", [TranslationKeyDesc] = "ARSON", }, - ["fr"] = new() + ["fr"] = new Dictionary() { [TranslationKeyName] = "Cocktail Molotov", [TranslationKeyDesc] = "La meilleure arme contre un blindé", diff --git a/KruacentExiled/KE.Items/Items/PickupModels/HolyGrenadePModel.cs b/KruacentExiled/KE.Items/Items/PickupModels/HolyGrenadePModel.cs index f5f8777d..2041ad6c 100644 --- a/KruacentExiled/KE.Items/Items/PickupModels/HolyGrenadePModel.cs +++ b/KruacentExiled/KE.Items/Items/PickupModels/HolyGrenadePModel.cs @@ -16,9 +16,9 @@ public HolyGrenadePModel(CustomItem customItem) : base(customItem) { } - private static Color32 red = new(255, 0, 0, 255); - private static Color32 gold = new(255, 215, 0, 255); - private static Color32 white = new(255, 255, 255, 255); + private static Color32 red = new Color32(255, 0, 0, 255); + private static Color32 gold = new Color32(255, 215, 0, 255); + private static Color32 white = new Color32(255, 255, 255, 255); public override float Scale => 0.2f; @@ -29,16 +29,16 @@ protected override void CreateModel(Transform parent) var sphere = CreatePrimitive(parent, PrimitiveType.Sphere, Vector3.zero, Quaternion.identity, Vector3.one, white); - var gem = CreatePrimitive(parent, PrimitiveType.Sphere, new(0,0.8f,0), Quaternion.identity, new(.15f,.1f,.1f), red); + var gem = CreatePrimitive(parent, PrimitiveType.Sphere, new Vector3(0,0.8f,0), Quaternion.identity, new Vector3(.15f,.1f,.1f), red); - var crossV = CreatePrimitive(parent, PrimitiveType.Cube, new(0, 0.74f, 0), Quaternion.identity, new(.1f, .5f, .1f), white); - var crossH = CreatePrimitive(parent, PrimitiveType.Cube, new(0, 0.8f, 0), Quaternion.identity, new(.1f, .1f, .37f), white); + var crossV = CreatePrimitive(parent, PrimitiveType.Cube, new Vector3(0, 0.74f, 0), Quaternion.identity, new Vector3(.1f, .5f, .1f), white); + var crossH = CreatePrimitive(parent, PrimitiveType.Cube, new Vector3(0, 0.8f, 0), Quaternion.identity, new Vector3(.1f, .1f, .37f), white); - var ring1 = CreatePrimitive(parent, PrimitiveType.Cylinder, Vector3.zero, Quaternion.Euler(90,0,0), new(1.05f, .05f, 1.05f), gold); - var ring2 = CreatePrimitive(parent, PrimitiveType.Cylinder, Vector3.zero, Quaternion.identity, new(1.05f, .05f, 1.05f), gold); - var ring3 = CreatePrimitive(parent, PrimitiveType.Cylinder, Vector3.zero, Quaternion.Euler(90, 90, 0), new(1.05f, .05f, 1.05f), gold); + var ring1 = CreatePrimitive(parent, PrimitiveType.Cylinder, Vector3.zero, Quaternion.Euler(90,0,0), new Vector3(1.05f, .05f, 1.05f), gold); + var ring2 = CreatePrimitive(parent, PrimitiveType.Cylinder, Vector3.zero, Quaternion.identity, new Vector3(1.05f, .05f, 1.05f), gold); + var ring3 = CreatePrimitive(parent, PrimitiveType.Cylinder, Vector3.zero, Quaternion.Euler(90, 90, 0), new Vector3(1.05f, .05f, 1.05f), gold); - var littleBase = CreatePrimitive(parent, PrimitiveType.Cylinder, new(0, 0.5f, 0), Quaternion.identity, new(.3f, .05f, .3f), gold); + var littleBase = CreatePrimitive(parent, PrimitiveType.Cylinder, new Vector3(0, 0.5f, 0), Quaternion.identity, new Vector3(.3f, .05f, .3f), gold); } } diff --git a/KruacentExiled/KE.Items/Items/PickupModels/MolotovPModel.cs b/KruacentExiled/KE.Items/Items/PickupModels/MolotovPModel.cs index ef309cee..1bb9ac0c 100644 --- a/KruacentExiled/KE.Items/Items/PickupModels/MolotovPModel.cs +++ b/KruacentExiled/KE.Items/Items/PickupModels/MolotovPModel.cs @@ -17,11 +17,11 @@ public MolotovPModel(CustomItem customItem) : base(customItem) { } protected override void CreateModel(Transform parent) { - var base1 = CreatePrimitive(parent, PrimitiveType.Cylinder, Vector3.up*.7f, Quaternion.identity, new(0.6f, 0.09f, 0.6f), bottleColor); - var base2 = CreatePrimitive(parent, PrimitiveType.Cylinder, Vector3.down *.08f, Quaternion.identity, new(0.8f,0.7f,0.8f), bottleColor); - var base3 = CreatePrimitive(parent, PrimitiveType.Cylinder, Vector3.up *.9f, Quaternion.identity, new(0.4f,0.1f,0.4f), bottleColor); - var base4 = CreatePrimitive(parent, PrimitiveType.Cylinder, Vector3.up *1.4f, Quaternion.identity, new(0.3f,0.4f,0.3f), bottleColor); - var base5 = CreatePrimitive(parent, PrimitiveType.Cylinder, Vector3.down *.8f, Quaternion.identity, new(0.6f,0.06f,0.6f), bottleColor); + var base1 = CreatePrimitive(parent, PrimitiveType.Cylinder, Vector3.up*.7f, Quaternion.identity, new Vector3(0.6f, 0.09f, 0.6f), bottleColor); + var base2 = CreatePrimitive(parent, PrimitiveType.Cylinder, Vector3.down *.08f, Quaternion.identity, new Vector3(0.8f,0.7f,0.8f), bottleColor); + var base3 = CreatePrimitive(parent, PrimitiveType.Cylinder, Vector3.up *.9f, Quaternion.identity, new Vector3(0.4f,0.1f,0.4f), bottleColor); + var base4 = CreatePrimitive(parent, PrimitiveType.Cylinder, Vector3.up *1.4f, Quaternion.identity, new Vector3(0.3f,0.4f,0.3f), bottleColor); + var base5 = CreatePrimitive(parent, PrimitiveType.Cylinder, Vector3.down *.8f, Quaternion.identity, new Vector3(0.6f,0.06f,0.6f), bottleColor); } } } diff --git a/KruacentExiled/KE.Items/Items/PickupModels/PressePureePModel.cs b/KruacentExiled/KE.Items/Items/PickupModels/PressePureePModel.cs index 8c825e60..95311133 100644 --- a/KruacentExiled/KE.Items/Items/PickupModels/PressePureePModel.cs +++ b/KruacentExiled/KE.Items/Items/PickupModels/PressePureePModel.cs @@ -20,10 +20,10 @@ public PressePureePModel(CustomItem customItem) : base(customItem) { } protected override void CreateModel(Transform parent) { - var manche = CreatePrimitive(parent,PrimitiveType.Cylinder,new(0,.006f,0),Quaternion.identity, mancheScale, colorManche); - var manche2 = CreatePrimitive(parent,PrimitiveType.Cylinder,new(0,.9463f,0),Quaternion.identity, new(0.45f,0.05f,0.45f), colorExplosif); - var explosif1 = CreatePrimitive(parent,PrimitiveType.Cylinder,new(0,1.2113f,0),Quaternion.identity, new(0.7f,0.2274f,0.7f), colorExplosif); - var explosif2 = CreatePrimitive(parent,PrimitiveType.Cylinder,new(0,1,0),Quaternion.identity, new(0.8f,0.02f,0.8f), colorExplosif); + var manche = CreatePrimitive(parent,PrimitiveType.Cylinder,new Vector3(0,.006f,0),Quaternion.identity, mancheScale, colorManche); + var manche2 = CreatePrimitive(parent,PrimitiveType.Cylinder,new Vector3(0,.9463f,0),Quaternion.identity, new Vector3(0.45f,0.05f,0.45f), colorExplosif); + var explosif1 = CreatePrimitive(parent,PrimitiveType.Cylinder,new Vector3(0,1.2113f,0),Quaternion.identity, new Vector3(0.7f,0.2274f,0.7f), colorExplosif); + var explosif2 = CreatePrimitive(parent,PrimitiveType.Cylinder,new Vector3(0,1,0),Quaternion.identity, new Vector3(0.8f,0.02f,0.8f), colorExplosif); } } } diff --git a/KruacentExiled/KE.Items/Items/PressePuree.cs b/KruacentExiled/KE.Items/Items/PressePuree.cs index 23e13bee..6facda1f 100644 --- a/KruacentExiled/KE.Items/Items/PressePuree.cs +++ b/KruacentExiled/KE.Items/Items/PressePuree.cs @@ -23,14 +23,14 @@ public class PressePuree : KECustomGrenade, IUpgradableCustomItem, ICustomPickup { protected override Dictionary> SetTranslation() { - return new() + return new Dictionary>() { - ["en"] = new() + ["en"] = new Dictionary() { [TranslationKeyName] = "Presse Purée", [TranslationKeyDesc] = "explode at impact but does less damage", }, - ["fr"] = new() + ["fr"] = new Dictionary() { [TranslationKeyName] = "Presse Purée", [TranslationKeyDesc] = "Explosion à l'impact mais moins efficace", @@ -103,7 +103,7 @@ protected override void OnExplodeDestructible(OnExplodeDestructibleEventsArgs ev if (ev.Damage <= 0f) return; - if (player is not null && player.IsScp) + if (player != null && player.IsScp) { ev.Damage /= 3f; } diff --git a/KruacentExiled/KE.Items/Items/ProximityGrenade.cs b/KruacentExiled/KE.Items/Items/ProximityGrenade.cs index 7adf0eae..84d0ec0f 100644 --- a/KruacentExiled/KE.Items/Items/ProximityGrenade.cs +++ b/KruacentExiled/KE.Items/Items/ProximityGrenade.cs @@ -13,14 +13,14 @@ public class ProximityGrenade : KECustomGrenade, ISwitchableEffect, IViolentItem protected override Dictionary> SetTranslation() { - return new() + return new Dictionary>() { - ["en"] = new() + ["en"] = new Dictionary() { [TranslationKeyName] = "Proximity Grenade", [TranslationKeyDesc] = "Show lines to all players around 3 rooms", }, - ["fr"] = new() + ["fr"] = new Dictionary() { [TranslationKeyName] = "Grenade de proximité", [TranslationKeyDesc] = "Montre tous les joueurs dans un rayon de 3 salles", diff --git a/KruacentExiled/KE.Items/Items/RedbullEnergy.cs b/KruacentExiled/KE.Items/Items/RedbullEnergy.cs index b22a6f22..91ba02ac 100644 --- a/KruacentExiled/KE.Items/Items/RedbullEnergy.cs +++ b/KruacentExiled/KE.Items/Items/RedbullEnergy.cs @@ -14,14 +14,14 @@ public class RedbullEnergy : KECustomItem, ISwitchableEffect { protected override Dictionary> SetTranslation() { - return new() + return new Dictionary>() { - ["en"] = new() + ["en"] = new Dictionary() { [TranslationKeyName] = "RedBull™ Energy", [TranslationKeyDesc] = "RedBull™ gives you wings!", }, - ["fr"] = new() + ["fr"] = new Dictionary() { [TranslationKeyName] = "RedBull™ Energy", [TranslationKeyDesc] = "RedBull™ donne des ailes ! Attention à la chute !!!", diff --git a/KruacentExiled/KE.Items/Items/SainteGrenada.cs b/KruacentExiled/KE.Items/Items/SainteGrenada.cs index 92a8cbf0..88524a6c 100644 --- a/KruacentExiled/KE.Items/Items/SainteGrenada.cs +++ b/KruacentExiled/KE.Items/Items/SainteGrenada.cs @@ -23,14 +23,14 @@ public class SainteGrenada : KECustomGrenade, ICustomPickupModel, IViolentItem { protected override Dictionary> SetTranslation() { - return new() + return new Dictionary>() { - ["en"] = new() + ["en"] = new Dictionary() { [TranslationKeyName] = "Holy Grenade", [TranslationKeyDesc] = "HOLY SHIT WORMS????", }, - ["fr"] = new() + ["fr"] = new Dictionary() { [TranslationKeyName] = "Sainte Grenade", [TranslationKeyDesc] = "Worms reference !?", diff --git a/KruacentExiled/KE.Items/Items/Scp1650.cs b/KruacentExiled/KE.Items/Items/Scp1650.cs index 7522ad46..cf7f1ca9 100644 --- a/KruacentExiled/KE.Items/Items/Scp1650.cs +++ b/KruacentExiled/KE.Items/Items/Scp1650.cs @@ -15,14 +15,14 @@ public class Scp1650 : KECustomItem, ISwitchableEffect { protected override Dictionary> SetTranslation() { - return new() + return new Dictionary>() { - ["en"] = new() + ["en"] = new Dictionary() { [TranslationKeyName] = "SCP-1650", [TranslationKeyDesc] = "ויאמר ה' ל— סח השמן על בשרך ולך בינות ה— כששם אלוהים על שפתיך, וזעם ה' וחרון אפו ו— דם המכבים יטהר בית מקדשו אחריך, לנצח נצחים", }, - ["fr"] = new() + ["fr"] = new Dictionary() { [TranslationKeyName] = "SCP-1650", [TranslationKeyDesc] = "ויאמר ה' ל— סח השמן על בשרך ולך בינות ה— כששם אלוהים על שפתיך, וזעם ה' וחרון אפו ו— דם המכבים יטהר בית מקדשו אחריך, לנצח נצחים", diff --git a/KruacentExiled/KE.Items/Items/Scp3136.cs b/KruacentExiled/KE.Items/Items/Scp3136.cs index e2f5a35e..a156f731 100644 --- a/KruacentExiled/KE.Items/Items/Scp3136.cs +++ b/KruacentExiled/KE.Items/Items/Scp3136.cs @@ -17,14 +17,14 @@ public class Scp3136 : KECustomItem/*, ICustomPickupModel*/ { protected override Dictionary> SetTranslation() { - return new() + return new Dictionary>() { - ["en"] = new() + ["en"] = new Dictionary() { [TranslationKeyName] = "SCP-3136", [TranslationKeyDesc] = "A map of the facility, you could draw your friends next to you", }, - ["fr"] = new() + ["fr"] = new Dictionary() { [TranslationKeyName] = "SCP-3136", [TranslationKeyDesc] = "Une carte de la facilité, tu pourrais dessiner tes amis proche de toi", diff --git a/KruacentExiled/KE.Items/Items/ShieldBelt/ShieldBelt.cs b/KruacentExiled/KE.Items/Items/ShieldBelt/ShieldBelt.cs index cbfbae9d..c34d6719 100644 --- a/KruacentExiled/KE.Items/Items/ShieldBelt/ShieldBelt.cs +++ b/KruacentExiled/KE.Items/Items/ShieldBelt/ShieldBelt.cs @@ -158,7 +158,7 @@ private void OnHurting(HurtingEventArgs ev) return; if (ev.IsInstantKill) return; - if (ev.DamageHandler.CustomBase is not FirearmDamageHandler) + if (!(ev.DamageHandler.CustomBase is FirearmDamageHandler)) return; if (!ev.Player.GameObject.TryGetComponent(out var stat)) { diff --git a/KruacentExiled/KE.Items/Items/ShieldBelt/ShieldBeltStat.cs b/KruacentExiled/KE.Items/Items/ShieldBelt/ShieldBeltStat.cs index f170c66b..8ec6c4f2 100644 --- a/KruacentExiled/KE.Items/Items/ShieldBelt/ShieldBeltStat.cs +++ b/KruacentExiled/KE.Items/Items/ShieldBelt/ShieldBeltStat.cs @@ -42,7 +42,7 @@ public void RechargeTick() Break(); } - if (primitive is not null) + if (!(primitive is null)) { float percent = Mathf.Clamp01(currentCharge / MaxCharge); primitive.Scale = Mathf.Lerp(MinSize, MaxSize, percent)*Vector3.one; diff --git a/KruacentExiled/KE.Items/Items/SmokeGrenade.cs b/KruacentExiled/KE.Items/Items/SmokeGrenade.cs index 8c59965c..b5ea4d00 100644 --- a/KruacentExiled/KE.Items/Items/SmokeGrenade.cs +++ b/KruacentExiled/KE.Items/Items/SmokeGrenade.cs @@ -12,14 +12,14 @@ public class SmokeGrenade : KECustomGrenade, ISwitchableEffect,IViolentItem { protected override Dictionary> SetTranslation() { - return new() + return new Dictionary>() { - ["en"] = new() + ["en"] = new Dictionary() { [TranslationKeyName] = "Smoke Grenade", [TranslationKeyDesc] = "We finally put your grandma inside this thing ! Don't throw it or she will get out !", }, - ["fr"] = new() + ["fr"] = new Dictionary() { [TranslationKeyName] = "Fumigène", [TranslationKeyDesc] = "Fait beaucoup de fumée", diff --git a/KruacentExiled/KE.Items/Items/TPGrenada.cs b/KruacentExiled/KE.Items/Items/TPGrenada.cs index 575fa9e3..43de77ef 100644 --- a/KruacentExiled/KE.Items/Items/TPGrenada.cs +++ b/KruacentExiled/KE.Items/Items/TPGrenada.cs @@ -17,14 +17,14 @@ public class TPGrenada : KECustomGrenade, ISwitchableEffect, ICustomPickupModel, protected override Dictionary> SetTranslation() { - return new() + return new Dictionary>() { - ["en"] = new() + ["en"] = new Dictionary() { [TranslationKeyName] = "Teleportation Grenade", [TranslationKeyDesc] = "This grenade does 0 damage but teleport nearby players in a random place (does work in other dimension ;3 )", }, - ["fr"] = new() + ["fr"] = new Dictionary() { [TranslationKeyName] = "Grenade de Téléportation", [TranslationKeyDesc] = "Ne fait pas de dégât mais téléporte dans une pièce aléatoire", diff --git a/KruacentExiled/KE.Items/Items/TrueDivinePills.cs b/KruacentExiled/KE.Items/Items/TrueDivinePills.cs index f98ac2fa..4d0dfd34 100644 --- a/KruacentExiled/KE.Items/Items/TrueDivinePills.cs +++ b/KruacentExiled/KE.Items/Items/TrueDivinePills.cs @@ -17,14 +17,14 @@ public class TrueDivinePills : KECustomItem, ILumosItem { protected override Dictionary> SetTranslation() { - return new() + return new Dictionary>() { - ["en"] = new() + ["en"] = new Dictionary() { [TranslationKeyName] = "True Divine Pills", [TranslationKeyDesc] = "Guaranteed to respawn everybody, drop to change the mode", }, - ["fr"] = new() + ["fr"] = new Dictionary() { [TranslationKeyName] = "True Divine Pills", [TranslationKeyDesc] = "Fait réappaître tout le monde, lâcher pour changer le mode", diff --git a/KruacentExiled/KE.Items/MainPlugin.cs b/KruacentExiled/KE.Items/MainPlugin.cs index 38331eac..36349086 100644 --- a/KruacentExiled/KE.Items/MainPlugin.cs +++ b/KruacentExiled/KE.Items/MainPlugin.cs @@ -10,6 +10,7 @@ using KE.Utils.API.Displays.DisplayMeow; using KruacentExiled; using System; +using System.Collections.Generic; using UnityEngine; namespace KE.Items @@ -26,8 +27,8 @@ public class MainPlugin : KEPlugin public override IConfig Config => config; private IConfig config; - internal static readonly HintPlacement ItemEffectPlacement = new(0, 200, HintServiceMeow.Core.Enum.HintAlignment.Center); - internal static readonly HintPlacement HintPlacement = new(0, 400, HintServiceMeow.Core.Enum.HintAlignment.Center); + internal static readonly HintPlacement ItemEffectPlacement = new HintPlacement(0, 200, HintServiceMeow.Core.Enum.HintAlignment.Center); + internal static readonly HintPlacement HintPlacement = new HintPlacement(0, 400, HintServiceMeow.Core.Enum.HintAlignment.Center); internal Harmony harmony; @@ -35,43 +36,43 @@ public override void OnEnabled() { Instance = this; config = KruacentExiled.MainPlugin.Instance.Config.CustomItemConfig; - harmony = new(Name); + harmony = new Harmony(Name); harmony.PatchAll(KruacentExiled.MainPlugin.Instance.Assembly); UpgradeHandler = new UpgradeHandler(); LightsHandler = new LightsHandler(); - SettingsHandler = new(); + SettingsHandler = new SettingsHandler(); KE.Utils.API.Sounds.SoundPlayer.Load(); - PoseRoomSpawnPointHandler.AddRoomPoses(new() + PoseRoomSpawnPointHandler.AddRoomPoses(new HashSet() { - new(RoomType.Lcz914,new Vector3(0,0.70f,-7.14f),Quaternion.identity), - new(RoomType.LczGlassBox,new Vector3(7.39f,0.75f,-5.89f),Quaternion.identity), - new(RoomType.LczGlassBox,new Vector3(8.71f,1.2f,-5.89f),Quaternion.identity), - new(RoomType.Lcz173,new Vector3(7.39f,0.75f,-5.89f),Quaternion.identity), - new(RoomType.EzUpstairsPcs,new Vector3(-2.09f,0.75f,-7f),Quaternion.identity), - new(RoomType.EzUpstairsPcs,new Vector3(-4,1.1f,-0.36f),Quaternion.identity), - new(RoomType.EzGateB,new Vector3(-0.68f,1.33f,4f),Quaternion.identity), - new(RoomType.EzChef,new Vector3(2.36f,.2f,-0.16f),Quaternion.identity), - new(RoomType.HczStraightPipeRoom,new Vector3(6.1f,1.05f,-4.8f),Quaternion.identity), - new(RoomType.HczStraightPipeRoom,new Vector3(-4f,0.23f,-4.52f),Quaternion.identity), - new(RoomType.HczServerRoom,new Vector3(1.79f,0.78f,-0.6f),Quaternion.identity), - new(RoomType.HczNuke,new Vector3(12.11f,-75.11f,2.6f),Quaternion.identity), - new(RoomType.HczNuke,new Vector3(11.06f,-74.85f,-2.5f),Quaternion.identity), - new(RoomType.Surface,new Vector3(27.45f,-8.07f,24.96f),Quaternion.identity), - new(RoomType.Surface,new Vector3(27.45f,-8.07f,-23.62f),Quaternion.identity), - new(RoomType.Surface,new Vector3(27.45f,-8.07f,-23.62f),Quaternion.identity), - new(RoomType.HczHid,new Vector3(-3.41f,5.68f,-2.3f),Quaternion.identity), - new(RoomType.HczHid,new Vector3(-6.44f,5.7f,-2.5f),Quaternion.identity), - new(RoomType.Hcz127,new Vector3(4.77f, 1.12f, 1.83f),Quaternion.identity), - new(RoomType.Hcz939,new Vector3(.6f, 1.3f, -2.8f),Quaternion.identity), - new(RoomType.LczCafe,new Vector3(-2.27f, 0.92f, 3.28f),Quaternion.identity), - new(RoomType.LczCafe,new Vector3(-2.38f, 0.87f, -1.49f),Quaternion.identity), + new PoseRoomSpawnPointHandler.ItemSpawn(RoomType.Lcz914,new Vector3(0,0.70f,-7.14f),Quaternion.identity), + new PoseRoomSpawnPointHandler.ItemSpawn(RoomType.LczGlassBox,new Vector3(7.39f,0.75f,-5.89f),Quaternion.identity), + new PoseRoomSpawnPointHandler.ItemSpawn(RoomType.LczGlassBox,new Vector3(8.71f,1.2f,-5.89f),Quaternion.identity), + new PoseRoomSpawnPointHandler.ItemSpawn(RoomType.Lcz173,new Vector3(7.39f,0.75f,-5.89f),Quaternion.identity), + new PoseRoomSpawnPointHandler.ItemSpawn(RoomType.EzUpstairsPcs,new Vector3(-2.09f,0.75f,-7f),Quaternion.identity), + new PoseRoomSpawnPointHandler.ItemSpawn(RoomType.EzUpstairsPcs,new Vector3(-4,1.1f,-0.36f),Quaternion.identity), + new PoseRoomSpawnPointHandler.ItemSpawn(RoomType.EzGateB,new Vector3(-0.68f,1.33f,4f),Quaternion.identity), + new PoseRoomSpawnPointHandler.ItemSpawn(RoomType.EzChef,new Vector3(2.36f,.2f,-0.16f),Quaternion.identity), + new PoseRoomSpawnPointHandler.ItemSpawn(RoomType.HczStraightPipeRoom,new Vector3(6.1f,1.05f,-4.8f),Quaternion.identity), + new PoseRoomSpawnPointHandler.ItemSpawn(RoomType.HczStraightPipeRoom,new Vector3(-4f,0.23f,-4.52f),Quaternion.identity), + new PoseRoomSpawnPointHandler.ItemSpawn(RoomType.HczServerRoom,new Vector3(1.79f,0.78f,-0.6f),Quaternion.identity), + new PoseRoomSpawnPointHandler.ItemSpawn(RoomType.HczNuke,new Vector3(12.11f,-75.11f,2.6f),Quaternion.identity), + new PoseRoomSpawnPointHandler.ItemSpawn(RoomType.HczNuke,new Vector3(11.06f,-74.85f,-2.5f),Quaternion.identity), + new PoseRoomSpawnPointHandler.ItemSpawn(RoomType.Surface,new Vector3(27.45f,-8.07f,24.96f),Quaternion.identity), + new PoseRoomSpawnPointHandler.ItemSpawn(RoomType.Surface,new Vector3(27.45f,-8.07f,-23.62f),Quaternion.identity), + new PoseRoomSpawnPointHandler.ItemSpawn(RoomType.Surface,new Vector3(27.45f,-8.07f,-23.62f),Quaternion.identity), + new PoseRoomSpawnPointHandler.ItemSpawn(RoomType.HczHid,new Vector3(-3.41f,5.68f,-2.3f),Quaternion.identity), + new PoseRoomSpawnPointHandler.ItemSpawn(RoomType.HczHid,new Vector3(-6.44f,5.7f,-2.5f),Quaternion.identity), + new PoseRoomSpawnPointHandler.ItemSpawn(RoomType.Hcz127,new Vector3(4.77f, 1.12f, 1.83f),Quaternion.identity), + new PoseRoomSpawnPointHandler.ItemSpawn(RoomType.Hcz939,new Vector3(.6f, 1.3f, -2.8f),Quaternion.identity), + new PoseRoomSpawnPointHandler.ItemSpawn(RoomType.LczCafe,new Vector3(-2.27f, 0.92f, 3.28f),Quaternion.identity), + new PoseRoomSpawnPointHandler.ItemSpawn(RoomType.LczCafe,new Vector3(-2.38f, 0.87f, -1.49f),Quaternion.identity), //new(RoomType.HczArmory,new Vector3(1.66f, 1.06f, -2.25f),Quaternion.identity), //new(RoomType.HczArmory,new Vector3(1.33f, 1.06f, -1.66f),Quaternion.identity), - new(RoomType.Hcz049,new Vector3(-6.31f, 89.22f, -11.38f),Quaternion.identity), - new(RoomType.Hcz049,new Vector3(0.64f, 89.31f, 7.22f),Quaternion.identity), - new(RoomType.Hcz049,new Vector3(18.46f, 93.73f, 13.13f),Quaternion.identity), + new PoseRoomSpawnPointHandler.ItemSpawn(RoomType.Hcz049,new Vector3(-6.31f, 89.22f, -11.38f),Quaternion.identity), + new PoseRoomSpawnPointHandler.ItemSpawn(RoomType.Hcz049,new Vector3(0.64f, 89.31f, 7.22f),Quaternion.identity), + new PoseRoomSpawnPointHandler.ItemSpawn(RoomType.Hcz049,new Vector3(18.46f, 93.73f, 13.13f),Quaternion.identity), }); diff --git a/KruacentExiled/KE.Items/SpawnModel.cs b/KruacentExiled/KE.Items/SpawnModel.cs index 4e54c9e6..f7467390 100644 --- a/KruacentExiled/KE.Items/SpawnModel.cs +++ b/KruacentExiled/KE.Items/SpawnModel.cs @@ -20,7 +20,7 @@ public class SpawnModel : ICommand { public string Command => "spawnmodel"; - public string[] Aliases => []; + public string[] Aliases => new string[0]; public string Description => "spawnmodel"; @@ -29,13 +29,13 @@ public bool Execute(ArraySegment arguments, ICommandSender sender, out s var p = Player.Get(sender); response = string.Empty; - if(p is not null) + if(p != null) { Primitive prim = Primitive.Create(p.Position, null, Vector3.one, false); prim.Collidable = false; prim.Visible = false; prim.Spawn(); - TPGrenadaPModel m = new(null); + TPGrenadaPModel m = new TPGrenadaPModel(null); Log.Info("position model=" + prim.Position); diff --git a/KruacentExiled/KE.Map/Commands/TestGetValidPosition.cs b/KruacentExiled/KE.Map/Commands/TestGetValidPosition.cs index 2cc4c1cf..be77590d 100644 --- a/KruacentExiled/KE.Map/Commands/TestGetValidPosition.cs +++ b/KruacentExiled/KE.Map/Commands/TestGetValidPosition.cs @@ -18,11 +18,11 @@ public class TestGetValidPosition : KECommand { public override string Command => "test"; - public override string[] Aliases => []; + public override string[] Aliases => new string[0]; public override string Description => ""; - public override string[] Usage => []; + public override string[] Usage => new string[0]; public override bool ExecuteCommand(ArraySegment arguments, ICommandSender sender, out string response) { diff --git a/KruacentExiled/KE.Map/Entrance/Locked.cs b/KruacentExiled/KE.Map/Entrance/Locked.cs index f7b91232..38afc41d 100644 --- a/KruacentExiled/KE.Map/Entrance/Locked.cs +++ b/KruacentExiled/KE.Map/Entrance/Locked.cs @@ -32,7 +32,7 @@ public override void Create(Vector3 position, Quaternion rotation) primitive.Transform.localPosition = Vector3.up * 2; primitive.Type = PrimitiveType.Cube; primitive.Flags = AdminToys.PrimitiveFlags.Collidable; - primitive.Scale = new (6,5,1); + primitive.Scale = new Vector3(6,5,1); primitive.Spawn(); } diff --git a/KruacentExiled/KE.Map/Entrance/MoreRoom.cs b/KruacentExiled/KE.Map/Entrance/MoreRoom.cs index a7d7ac5c..f1f16b80 100644 --- a/KruacentExiled/KE.Map/Entrance/MoreRoom.cs +++ b/KruacentExiled/KE.Map/Entrance/MoreRoom.cs @@ -12,7 +12,7 @@ namespace KE.Map.Entrance { public abstract class MoreRoom { - private static HashSet all = new(); + private static HashSet all = new HashSet(); public MoreRoom() { all.Add(this); @@ -24,7 +24,7 @@ public MoreRoom() public abstract int Limit { get; } private int curr = 0; - private static HashSet usedRooms = new(); + private static HashSet usedRooms = new HashSet(); public static void CreateAll() { diff --git a/KruacentExiled/KE.Map/Heavy/BulkDoor049.cs b/KruacentExiled/KE.Map/Heavy/BulkDoor049.cs index ec70d992..e093386b 100644 --- a/KruacentExiled/KE.Map/Heavy/BulkDoor049.cs +++ b/KruacentExiled/KE.Map/Heavy/BulkDoor049.cs @@ -20,7 +20,7 @@ public static void Create() Room room = Room.List.Where(r => r.Type == RoomType.Hcz049).First(); - Vector3 pos = new(-19.7f ,89f, 9f); + Vector3 pos = new Vector3(-19.7f ,89f, 9f); Quaternion rot = Quaternion.identity; Vector3 worldpos = room.Position + room.Rotation*pos; diff --git a/KruacentExiled/KE.Map/Heavy/GamblingZone/DroppableItem.cs b/KruacentExiled/KE.Map/Heavy/GamblingZone/DroppableItem.cs index bb5012f3..cf20b1d5 100644 --- a/KruacentExiled/KE.Map/Heavy/GamblingZone/DroppableItem.cs +++ b/KruacentExiled/KE.Map/Heavy/GamblingZone/DroppableItem.cs @@ -43,7 +43,7 @@ internal DroppableItem(ItemType item, int chance, int itemCap = -1) Chance = chance; ItemCap = itemCap; } - public static implicit operator DroppableItem(ItemType d) => new(d, 1, -1); + public static implicit operator DroppableItem(ItemType d) => new DroppableItem(d, 1, -1); public bool Equals(DroppableItem other) { return other.Item == Item && other.Chance == Chance && other.ItemCap == ItemCap && CurrentCap == other.CurrentCap; diff --git a/KruacentExiled/KE.Map/Heavy/GamblingZone/GamblingRoom.cs b/KruacentExiled/KE.Map/Heavy/GamblingZone/GamblingRoom.cs index c4dae0b8..5367207d 100644 --- a/KruacentExiled/KE.Map/Heavy/GamblingZone/GamblingRoom.cs +++ b/KruacentExiled/KE.Map/Heavy/GamblingZone/GamblingRoom.cs @@ -93,9 +93,9 @@ private void CreateModel(Vector3 positionWithOffset) Vector3 width = new Vector3(.1f, 1, .1f); - _model = new() + _model = new HashSet() { - Primitive.Create(PrimitiveType.Cube,positionWithOffset , null,new(1,.8f,1),true,Color.black), + Primitive.Create(PrimitiveType.Cube,positionWithOffset , null,new Vector3(1,.8f,1),true,Color.black), Primitive.Create(PrimitiveType.Cube,positionWithOffset + Vector3.forward/2,null, Vector3.right+width,true,Color.white), Primitive.Create(PrimitiveType.Cube,positionWithOffset + Vector3.back/2, null, Vector3.right+width,true,Color.white), Primitive.Create(PrimitiveType.Cube,positionWithOffset + Vector3.right/2, null, Vector3.forward+width,true,Color.white), @@ -134,7 +134,7 @@ public void OnPickup(PlayerSearchedToyEventArgs ev) if (player2.CurrentItem == null) return; Item item = _lootTable.GetRandomItem(); - GamblingEventArgs ev1 = new(player2, item, true); + GamblingEventArgs ev1 = new GamblingEventArgs(player2, item, true); Events.Handlers.GamblingRoom.OnGambling(ev1); diff --git a/KruacentExiled/KE.Map/Heavy/GamblingZone/LootTable.cs b/KruacentExiled/KE.Map/Heavy/GamblingZone/LootTable.cs index bf30b215..73ae17ee 100644 --- a/KruacentExiled/KE.Map/Heavy/GamblingZone/LootTable.cs +++ b/KruacentExiled/KE.Map/Heavy/GamblingZone/LootTable.cs @@ -22,9 +22,9 @@ public LootTable() { Items = new HashSet() { - new(ItemType.Jailbird,5,1), - new(ItemType.ParticleDisruptor,5,1), - new(ItemType.Radio,15), + new DroppableItem(ItemType.Jailbird,5,1), + new DroppableItem(ItemType.ParticleDisruptor,5,1), + new DroppableItem(ItemType.Radio,15), }; } diff --git a/KruacentExiled/KE.Map/Heavy/GamblingZone/OldGamblingRoom.cs b/KruacentExiled/KE.Map/Heavy/GamblingZone/OldGamblingRoom.cs index 114652e6..ebd106df 100644 --- a/KruacentExiled/KE.Map/Heavy/GamblingZone/OldGamblingRoom.cs +++ b/KruacentExiled/KE.Map/Heavy/GamblingZone/OldGamblingRoom.cs @@ -17,7 +17,7 @@ namespace KE.Map.Heavy.GamblingZone public class OldGamblingRoom : AbstractGambling { private static readonly HashSet _list = new HashSet(); - public static HashSet List => new(_list); + public static HashSet List => new HashSet(_list); private Vector3 _position; diff --git a/KruacentExiled/KE.Map/MainPlugin.cs b/KruacentExiled/KE.Map/MainPlugin.cs index 827c2de6..7ec76ba0 100644 --- a/KruacentExiled/KE.Map/MainPlugin.cs +++ b/KruacentExiled/KE.Map/MainPlugin.cs @@ -52,15 +52,15 @@ public class MainPlugin : KEPlugin public override void OnEnabled() { Instance = this; - handler = new(); - harmony = new(Prefix); + handler = new Handler(); + harmony = new Harmony(Prefix); config = KruacentExiled.MainPlugin.Instance.Config.MapConfig; - cREventHandler = new(); + //cREventHandler = new CREventHandler(); - cREventHandler.SubscribeEvents(); + //cREventHandler.SubscribeEvents(); handler.SubscribeEvents(); KE.Utils.API.Sounds.SoundPlayer.Instance.TryLoad(); Exiled.Events.Handlers.Map.Generated += OnGenerated; @@ -207,7 +207,7 @@ public override void OnDisabled() Exiled.Events.Handlers.Server.RoundStarted -= OnRoundStarted; Exiled.Events.Handlers.Server.WaitingForPlayers -= OnWaitingForPlayers; - cREventHandler.UnsubscribeEvents(); + cREventHandler?.UnsubscribeEvents(); cREventHandler = null; @@ -224,11 +224,11 @@ private void OnGenerated() { Door lcz173 = Door.Get(Exiled.API.Enums.DoorType.Scp173Gate); - HashSet normal = new() + HashSet normal = new HashSet() { - new(ItemType.KeycardO5,1,2), - new(ItemType.Jailbird,1,2), - new(ItemType.SCP268,1,1), + new DroppableItem(ItemType.KeycardO5,1,2), + new DroppableItem(ItemType.Jailbird,1,2), + new DroppableItem(ItemType.SCP268,1,1), ItemType.SCP500, ItemType.KeycardMTFCaptain, ItemType.GunCOM15, @@ -258,7 +258,7 @@ private void OnGenerated() }; - var g = new GamblingRoom(RoleTypeId.Scp173.GetRandomSpawnLocation().Position + Vector3.down, new(normal)); + var g = new GamblingRoom(RoleTypeId.Scp173.GetRandomSpawnLocation().Position + Vector3.down, new LootTable(normal)); //var g = new OldGamblingRoom(RoleTypeId.Scp173.GetRandomSpawnLocation().Position + Vector3.down, Vector3.one*10, new LootTable(normal)); diff --git a/KruacentExiled/KE.Map/Others/BlackoutNDoor/Both.cs b/KruacentExiled/KE.Map/Others/BlackoutNDoor/Both.cs index 22ee0452..50c52e11 100644 --- a/KruacentExiled/KE.Map/Others/BlackoutNDoor/Both.cs +++ b/KruacentExiled/KE.Map/Others/BlackoutNDoor/Both.cs @@ -10,8 +10,8 @@ namespace KE.Map.Others.BlackoutNDoor { public class Both : MapEvent { - private DoorStuck doorstuck = new(); - private Blackout blackout = new(); + private DoorStuck doorstuck = new DoorStuck(); + private Blackout blackout = new Blackout(); public override string Cassie => MainPlugin.Translations.Both; public override float Duration => 20; diff --git a/KruacentExiled/KE.Map/Others/BlackoutNDoor/Commands/BlackoutCommand.cs b/KruacentExiled/KE.Map/Others/BlackoutNDoor/Commands/BlackoutCommand.cs index 85cfd9d8..bb18d9c4 100644 --- a/KruacentExiled/KE.Map/Others/BlackoutNDoor/Commands/BlackoutCommand.cs +++ b/KruacentExiled/KE.Map/Others/BlackoutNDoor/Commands/BlackoutCommand.cs @@ -18,11 +18,11 @@ internal class BlackoutCommand : KECommand { public override string Command => "blackout"; - public override string[] Aliases => ["b"]; + public override string[] Aliases => new string[] { "b" }; public override string Description => "force a blackout"; - public override string[] Usage => ["FacilityZone"]; + public override string[] Usage => new string[] { "FacilityZone" }; public override bool ExecuteCommand(ArraySegment arguments, ICommandSender sender, out string response) { @@ -39,7 +39,7 @@ public override bool ExecuteCommand(ArraySegment arguments, ICommandSend } - Blackout blackout = new(); + Blackout blackout = new Blackout(); blackout.StartEvent(zone.GetZone(),-1); response = "blackout forced at " + zone.ToString(); diff --git a/KruacentExiled/KE.Map/Others/BlackoutNDoor/Commands/BothCommand.cs b/KruacentExiled/KE.Map/Others/BlackoutNDoor/Commands/BothCommand.cs index f5150f84..39dea340 100644 --- a/KruacentExiled/KE.Map/Others/BlackoutNDoor/Commands/BothCommand.cs +++ b/KruacentExiled/KE.Map/Others/BlackoutNDoor/Commands/BothCommand.cs @@ -11,11 +11,11 @@ internal class BothCommand : KECommand { public override string Command => "both"; - public override string[] Aliases => []; + public override string[] Aliases => new string[0]; public override string Description => "force a doorstuck and a blackout"; - public override string[] Usage => ["FacilityZone"]; + public override string[] Usage => new string[] { "FacilityZone" }; public override bool ExecuteCommand(ArraySegment arguments, ICommandSender sender, out string response) { @@ -32,7 +32,7 @@ public override bool ExecuteCommand(ArraySegment arguments, ICommandSend } - Both both = new(); + Both both = new Both(); both.StartEvent(zone.GetZone(),-1); response = "both forced at " + zone.ToString(); diff --git a/KruacentExiled/KE.Map/Others/BlackoutNDoor/Commands/DoorstuckCommand.cs b/KruacentExiled/KE.Map/Others/BlackoutNDoor/Commands/DoorstuckCommand.cs index e7995171..ce6aa7cd 100644 --- a/KruacentExiled/KE.Map/Others/BlackoutNDoor/Commands/DoorstuckCommand.cs +++ b/KruacentExiled/KE.Map/Others/BlackoutNDoor/Commands/DoorstuckCommand.cs @@ -18,11 +18,11 @@ internal class DoorstuckCommand : KECommand { public override string Command => "doorstuck"; - public override string[] Aliases => ["d"]; + public override string[] Aliases => new string[] { "d" }; public override string Description => "force a doorstuck"; - public override string[] Usage => ["FacilityZone"]; + public override string[] Usage => new string[] { "FacilityZone" }; public override bool ExecuteCommand(ArraySegment arguments, ICommandSender sender, out string response) { @@ -39,7 +39,7 @@ public override bool ExecuteCommand(ArraySegment arguments, ICommandSend } - DoorStuck doorstuck = new(); + DoorStuck doorstuck = new DoorStuck(); doorstuck.StartEvent(zone.GetZone(),-1); response = "doorstuck forced at " + zone.ToString(); diff --git a/KruacentExiled/KE.Map/Others/BlackoutNDoor/Commands/MainCommand.cs b/KruacentExiled/KE.Map/Others/BlackoutNDoor/Commands/MainCommand.cs index 182cb317..1831b25f 100644 --- a/KruacentExiled/KE.Map/Others/BlackoutNDoor/Commands/MainCommand.cs +++ b/KruacentExiled/KE.Map/Others/BlackoutNDoor/Commands/MainCommand.cs @@ -15,7 +15,7 @@ public class MainCommand : KEParentCommand { public override string Command => "mapevent"; - public override string[] Aliases => ["me"]; + public override string[] Aliases => new string[] { "me" }; public override string Description => "mapevents"; diff --git a/KruacentExiled/KE.Map/Others/BlackoutNDoor/DoorStuck.cs b/KruacentExiled/KE.Map/Others/BlackoutNDoor/DoorStuck.cs index ccc5a66f..8efa6e46 100644 --- a/KruacentExiled/KE.Map/Others/BlackoutNDoor/DoorStuck.cs +++ b/KruacentExiled/KE.Map/Others/BlackoutNDoor/DoorStuck.cs @@ -47,7 +47,7 @@ public override void Start(ZoneType zone) } } - DoorStuckEventArgs ev = new(doors,zone,true); + DoorStuckEventArgs ev = new DoorStuckEventArgs(doors,zone,true); DoorStuckHandler.OnDoorStucking(ev); if (ev.IsAllowed && ev.Doors != null) diff --git a/KruacentExiled/KE.Map/Others/BlackoutNDoor/Events/Handlers/BlackoutNDoor.cs b/KruacentExiled/KE.Map/Others/BlackoutNDoor/Events/Handlers/BlackoutNDoor.cs index da3d22fa..f9078faa 100644 --- a/KruacentExiled/KE.Map/Others/BlackoutNDoor/Events/Handlers/BlackoutNDoor.cs +++ b/KruacentExiled/KE.Map/Others/BlackoutNDoor/Events/Handlers/BlackoutNDoor.cs @@ -15,8 +15,8 @@ public static class BlackoutNDoor public static Event PreEvent { get; set; } = new Event(); public static Event PostEvent { get; set; } = new Event(); - public static Event ChoseMapEvent { get; set; } = new(); - public static Event ChoseZoneEvent { get; set; } = new(); + public static Event ChoseMapEvent { get; set; } = new Event(); + public static Event ChoseZoneEvent { get; set; } = new Event(); public static void OnPreEvent(PreEventEventArgs ev) { PreEvent.InvokeSafely(ev); diff --git a/KruacentExiled/KE.Map/Others/BlackoutNDoor/Events/Handlers/DoorStuckHandler.cs b/KruacentExiled/KE.Map/Others/BlackoutNDoor/Events/Handlers/DoorStuckHandler.cs index 145b0501..486e5d2e 100644 --- a/KruacentExiled/KE.Map/Others/BlackoutNDoor/Events/Handlers/DoorStuckHandler.cs +++ b/KruacentExiled/KE.Map/Others/BlackoutNDoor/Events/Handlers/DoorStuckHandler.cs @@ -14,7 +14,7 @@ public static class DoorStuckHandler - public static Event DoorStucking { get; set; } = new(); + public static Event DoorStucking { get; set; } = new Event(); diff --git a/KruacentExiled/KE.Map/Others/BlackoutNDoor/Handlers/Handler.cs b/KruacentExiled/KE.Map/Others/BlackoutNDoor/Handlers/Handler.cs index a8c211dc..ea368a66 100644 --- a/KruacentExiled/KE.Map/Others/BlackoutNDoor/Handlers/Handler.cs +++ b/KruacentExiled/KE.Map/Others/BlackoutNDoor/Handlers/Handler.cs @@ -26,7 +26,7 @@ public class Handler : IUsingEvents private float time = 0; public float TimeBeforeNextEvent => time; - public static readonly HashSet Zones = new() + public static readonly HashSet Zones = new HashSet() { FacilityZone.LightContainment,FacilityZone.HeavyContainment,FacilityZone.Entrance,FacilityZone.Surface }; @@ -58,9 +58,12 @@ private void OnRoundStarted() { time = 30; ChosenPattern = new Pattern - ([ - new Blackout(),new DoorStuck() - ]); + ( + new List() + { + new Blackout(),new DoorStuck() + } + ); } @@ -135,7 +138,7 @@ private void LaunchEvent() ZoneType zone = GetZone(); - ChoseZoneEventArgs choseZoneEv = new(zone); + ChoseZoneEventArgs choseZoneEv = new ChoseZoneEventArgs(zone); EventHandle.OnChoseZoneEvent(choseZoneEv); if (Zones.Contains(choseZoneEv.Zone.GetZone())) @@ -208,7 +211,7 @@ private ZoneType GetZone() private ZoneType RandomZoneByWeight() { - List weightedPool = new(); + List weightedPool = new List(); diff --git a/KruacentExiled/KE.Map/Others/BlackoutNDoor/Handlers/Pattern.cs b/KruacentExiled/KE.Map/Others/BlackoutNDoor/Handlers/Pattern.cs index 561dc239..eaf4c47f 100644 --- a/KruacentExiled/KE.Map/Others/BlackoutNDoor/Handlers/Pattern.cs +++ b/KruacentExiled/KE.Map/Others/BlackoutNDoor/Handlers/Pattern.cs @@ -12,42 +12,49 @@ namespace KE.Map.Others.BlackoutNDoor.Handlers { public class Pattern { - public static readonly HashSet AllPatterns = new() + public static readonly HashSet AllPatterns = new HashSet() { new Pattern - ([ + (new List() + { new Blackout(),new DoorStuck() - ]) + }) , new Pattern - ([ + (new List() + { new Blackout(),new Blackout(),new DoorStuck(),new DoorStuck() - ]) + }) , new Pattern - ([ + (new List() + { new DoorStuck(),new Blackout(),new Both(),new Blackout(),new DoorStuck(),new Both() - ]) + }) , new Pattern - ([ + (new List() + { new DoorStuck(),new Blackout(),new Both() - ]) + }) , new Pattern - ([ + (new List() + { new DoorStuck(),new Both() - ]) + }) , new Pattern - ([ + (new List() + { new Blackout(),new Both() - ]) + }) , new Pattern - ([ + (new List() + { new Both() - ]) + }) }; @@ -56,7 +63,7 @@ public class Pattern public Pattern(List pattern) { - _pattern = new(); + _pattern = new List(); for (int i = 0; i < pattern.Count; i++) { _pattern.Add(pattern[i]); diff --git a/KruacentExiled/KE.Map/Others/CustomDoors/KEDoor.cs b/KruacentExiled/KE.Map/Others/CustomDoors/KEDoor.cs index 3d83b301..c6a88d96 100644 --- a/KruacentExiled/KE.Map/Others/CustomDoors/KEDoor.cs +++ b/KruacentExiled/KE.Map/Others/CustomDoors/KEDoor.cs @@ -11,7 +11,7 @@ public abstract class KEDoor { - public static HashSet doors = new(); + public static HashSet doors = new HashSet(); diff --git a/KruacentExiled/KE.Map/Others/CustomElevators/CustomElevator.cs b/KruacentExiled/KE.Map/Others/CustomElevators/CustomElevator.cs index 1761ae99..a608541d 100644 --- a/KruacentExiled/KE.Map/Others/CustomElevators/CustomElevator.cs +++ b/KruacentExiled/KE.Map/Others/CustomElevators/CustomElevator.cs @@ -12,7 +12,7 @@ namespace KE.Map.Others.CustomElevators public class CustomElevator : KEElevator { - public static ElevatorModel model { get; } = new(); + public static ElevatorModel model { get; } = new ElevatorModel(); public override bool IsReady => false; diff --git a/KruacentExiled/KE.Map/Others/CustomElevators/KECustomElevators/KECustomElevator.cs b/KruacentExiled/KE.Map/Others/CustomElevators/KECustomElevators/KECustomElevator.cs index 295b78ce..f85cefc8 100644 --- a/KruacentExiled/KE.Map/Others/CustomElevators/KECustomElevators/KECustomElevator.cs +++ b/KruacentExiled/KE.Map/Others/CustomElevators/KECustomElevators/KECustomElevator.cs @@ -57,9 +57,9 @@ private void Awake() private void SpawnModel() { - model = new(); - toppanel = new(); - bottompanel = new(); + model = new ElevatorModel(); + toppanel = new Panel(); + bottompanel = new Panel(); } private void CreateModel() @@ -77,9 +77,9 @@ private void CreateModel() private void CreatePrimitives() { - Vector3 helppos = new(18.24f, 255.65f, -46.07f); - Vector3 postop = new(19.92f, 299.97f, -48.95f); - Vector3 posbot = new(15.62f, 290.65f, -45.19f); + Vector3 helppos = new Vector3(18.24f, 255.65f, -46.07f); + Vector3 postop = new Vector3(19.92f, 299.97f, -48.95f); + Vector3 posbot = new Vector3(15.62f, 290.65f, -45.19f); primtop = Primitive.Create(postop, null, Vector3.one * Scale); primtop.Flags = AdminToys.PrimitiveFlags.None; diff --git a/KruacentExiled/KE.Map/Others/CustomElevators/KEElevator.cs b/KruacentExiled/KE.Map/Others/CustomElevators/KEElevator.cs index a282bd03..3966cc41 100644 --- a/KruacentExiled/KE.Map/Others/CustomElevators/KEElevator.cs +++ b/KruacentExiled/KE.Map/Others/CustomElevators/KEElevator.cs @@ -11,7 +11,7 @@ namespace KE.Map.Others.CustomElevators public abstract class KEElevator { - public static HashSet elevators = new(); + public static HashSet elevators = new HashSet(); diff --git a/KruacentExiled/KE.Map/Others/CustomZones/AltasReader.cs b/KruacentExiled/KE.Map/Others/CustomZones/AltasReader.cs index 371c71d3..89abb09f 100644 --- a/KruacentExiled/KE.Map/Others/CustomZones/AltasReader.cs +++ b/KruacentExiled/KE.Map/Others/CustomZones/AltasReader.cs @@ -18,7 +18,7 @@ public static class AltasReader { - public static readonly Dictionary ColortoRoom = new() + public static readonly Dictionary ColortoRoom = new Dictionary() { { new Color32(0,255,0,255), RoomShape.Endroom }, { new Color32(255,0,0,255), RoomShape.TShape }, @@ -55,11 +55,11 @@ public static void Read() return ; } - HashSet layouts = new(); + HashSet layouts = new HashSet(); IEnumerable files = Directory.GetFiles(Path, "*.png"); - Dictionary coordtoroom = new(); + Dictionary coordtoroom = new Dictionary(); foreach (string file in files) { @@ -87,12 +87,12 @@ public static void Read() Color pixelleft = bmp.GetPixel(x-1, y); Color pixelright = bmp.GetPixel(x+1, y); - Dictionary colors = new() + Dictionary colors = new Dictionary() { - { new(0,1),pixelup }, - { new(0,-1),pixeldown }, - { new(-1,0),pixelleft }, - { new(1,0),pixelright } + { new Vector2Int(0,1),pixelup }, + { new Vector2Int(0,-1),pixeldown }, + { new Vector2Int(-1,0),pixelleft }, + { new Vector2Int(1,0),pixelright } }; @@ -120,7 +120,7 @@ public static void Read() { shape = RoomShape.TShape; Vector2Int coordempty = empty[0]; - rotation = new(0, coordempty.x * 90, 0); + rotation = new Vector3(0, coordempty.x * 90, 0); if (coordempty.x == 0 && coordempty.y == -1) { @@ -152,12 +152,12 @@ public static void Read() { shape = RoomShape.Curve; - Dictionary coordToRotation = new() + Dictionary coordToRotation = new Dictionary() { - {new (1,1),Vector3.zero }, - {new (-1,1), new Vector3(0,90,0) }, - {new (-1,-1), new Vector3(0,180,0) }, - {new (1,-1), new Vector3(0,-90,0) } + {new Vector2Int(1,1),Vector3.zero }, + {new Vector2Int(-1,1), new Vector3(0,90,0) }, + {new Vector2Int(-1,-1), new Vector3(0,180,0) }, + {new Vector2Int(1,-1), new Vector3(0,-90,0) } }; @@ -230,12 +230,12 @@ public static void Read() continue; } Log.Debug($"adding {shape} at {coord} ({rotation.y})"); - coordtoroom.Add(coord, new (shape,rotation)); + coordtoroom.Add(coord, new RoomShapeRotation(shape,rotation)); } } - Layout layout = new(coordtoroom, noExFile); + Layout layout = new Layout(coordtoroom, noExFile); coordtoroom.Clear(); } } diff --git a/KruacentExiled/KE.Map/Others/CustomZones/CustomRoom.cs b/KruacentExiled/KE.Map/Others/CustomZones/CustomRoom.cs index dd07d1f2..2d46d6f5 100644 --- a/KruacentExiled/KE.Map/Others/CustomZones/CustomRoom.cs +++ b/KruacentExiled/KE.Map/Others/CustomZones/CustomRoom.cs @@ -13,7 +13,7 @@ namespace KE.Map.Others.CustomZones { public abstract class CustomRoom { - private static readonly HashSet registered = new(); + private static readonly HashSet registered = new HashSet(); public static IReadOnlyCollection RegisteredRoom => registered; public abstract RoomShape Shape { get; } @@ -21,7 +21,7 @@ public abstract class CustomRoom public abstract CustomFacilityZone FacilityZone { get; } public Vector3 Size => RoomIdentifier.GridScale; - public HashSet SpawnedRoom { get; } = new(); + public HashSet SpawnedRoom { get; } = new HashSet(); public CustomRoom() { @@ -33,7 +33,7 @@ public CustomRoom() public SpawnedCustomRoom Spawn(Vector2Int coord,Vector3 rotation,Vector3 spawnzone) { - Vector3 position = new(-coord.x * Size.x+ spawnzone.x, spawnzone.y, coord.y * Size.z + spawnzone.z); + Vector3 position = new Vector3(-coord.x * Size.x+ spawnzone.x, spawnzone.y, coord.y * Size.z + spawnzone.z); Log.Debug("spawn room at " + position); IEnumerable prims = SpawnRoom(position,rotation); @@ -44,7 +44,7 @@ public SpawnedCustomRoom Spawn(Vector2Int coord,Vector3 rotation,Vector3 spawnzo } - SpawnedCustomRoom room = new(this, Shape, position,rotation, coord, prims.ToHashSet()); + SpawnedCustomRoom room = new SpawnedCustomRoom(this, Shape, position,rotation, coord, prims.ToHashSet()); room.Spawn(); SpawnedRoom.Add(room); return room; diff --git a/KruacentExiled/KE.Map/Others/CustomZones/CustomRooms/DoorSeparator.cs b/KruacentExiled/KE.Map/Others/CustomZones/CustomRooms/DoorSeparator.cs index 84a0e212..d64a09fb 100644 --- a/KruacentExiled/KE.Map/Others/CustomZones/CustomRooms/DoorSeparator.cs +++ b/KruacentExiled/KE.Map/Others/CustomZones/CustomRooms/DoorSeparator.cs @@ -12,7 +12,7 @@ namespace KE.Map.Others.CustomZones.CustomRooms { public abstract class DoorSeparator { - private static readonly HashSet registered = new(); + private static readonly HashSet registered = new HashSet(); public static IReadOnlyCollection RegisteredDoorSeparator => registered; public DoorSeparator() { @@ -21,7 +21,7 @@ public DoorSeparator() - public HashSet SpawnDoorSeparator { get; } = new(); + public HashSet SpawnDoorSeparator { get; } = new HashSet(); public abstract CustomFacilityZone FacilityZone { get; } protected abstract IEnumerable Create(Vector3 position, Vector3 rotation); @@ -43,7 +43,7 @@ public SpawnedDoorSeparator Spawn(SpawnedCustomRoom room1, SpawnedCustomRoom roo - SpawnedDoorSeparator spawned = new(this, position, rotation, [room1, room2], objs.ToHashSet()); + SpawnedDoorSeparator spawned = new SpawnedDoorSeparator(this, position, rotation, new List() { room1, room2 }, objs.ToHashSet()); spawned.Spawn(); SpawnDoorSeparator.Add(spawned); diff --git a/KruacentExiled/KE.Map/Others/CustomZones/CustomRooms/SpawnedDoorSeparator.cs b/KruacentExiled/KE.Map/Others/CustomZones/CustomRooms/SpawnedDoorSeparator.cs index 8cf86b0c..e46788e9 100644 --- a/KruacentExiled/KE.Map/Others/CustomZones/CustomRooms/SpawnedDoorSeparator.cs +++ b/KruacentExiled/KE.Map/Others/CustomZones/CustomRooms/SpawnedDoorSeparator.cs @@ -17,7 +17,7 @@ public SpawnedDoorSeparator(DoorSeparator basedoor, Vector3 position, Vector3 ro BaseDoor = basedoor; Position = position; Rooms = rooms; - GameObjects = [.. gameObjects]; + GameObjects = gameObjects.ToHashSet(); } diff --git a/KruacentExiled/KE.Map/Others/CustomZones/Layout.cs b/KruacentExiled/KE.Map/Others/CustomZones/Layout.cs index 1f8720cc..9d828235 100644 --- a/KruacentExiled/KE.Map/Others/CustomZones/Layout.cs +++ b/KruacentExiled/KE.Map/Others/CustomZones/Layout.cs @@ -11,9 +11,9 @@ namespace KE.Map.Others.CustomZones { public struct Layout { - public static HashSet Layouts = new(); + public static HashSet Layouts = new HashSet(); public string Name { get; } - public readonly Dictionary coordtoroom = new(); + public readonly Dictionary coordtoroom; public Layout(Dictionary coordtoroom, string name) { Name = name; diff --git a/KruacentExiled/KE.Map/Others/CustomZones/SpawnedCustomRoom.cs b/KruacentExiled/KE.Map/Others/CustomZones/SpawnedCustomRoom.cs index 86e94dea..84ad4261 100644 --- a/KruacentExiled/KE.Map/Others/CustomZones/SpawnedCustomRoom.cs +++ b/KruacentExiled/KE.Map/Others/CustomZones/SpawnedCustomRoom.cs @@ -13,7 +13,7 @@ namespace KE.Map.Others.CustomZones { public class SpawnedCustomRoom { - private static readonly HashSet spawned = new(); + private static readonly HashSet spawned = new HashSet(); public static IReadOnlyCollection SpawnedRoom => spawned; public SpawnedCustomRoom(CustomRoom baseRoom, RoomShape shape, Vector3 position, Vector3 rotation, Vector2Int coord, HashSet primitives) { @@ -21,7 +21,7 @@ public SpawnedCustomRoom(CustomRoom baseRoom, RoomShape shape, Vector3 position, Shape = shape; Position = position; Coord = coord; - Primitives = [.. primitives]; + Primitives = primitives.ToHashSet(); spawned.Add(this); } @@ -41,7 +41,7 @@ public IEnumerable Neighbors { if (cachedNeighbors is null) { - cachedNeighbors = new(); + cachedNeighbors = new HashSet(); foreach (SpawnedCustomRoom scr in SpawnedRoom) { @@ -60,7 +60,7 @@ public IEnumerable Neighbors } } - public HashSet Door { get; } = new(); + public HashSet Door { get; } = new HashSet(); public HashSet Primitives { get; } diff --git a/KruacentExiled/KE.Map/Others/EasterEggs/Capybaras.cs b/KruacentExiled/KE.Map/Others/EasterEggs/Capybaras.cs index 0c78f146..96bbfe06 100644 --- a/KruacentExiled/KE.Map/Others/EasterEggs/Capybaras.cs +++ b/KruacentExiled/KE.Map/Others/EasterEggs/Capybaras.cs @@ -16,8 +16,8 @@ namespace KE.Map.Others.EasterEggs { internal class Capybaras : IUsingEvents - { - private HashSet _spinnyBaras = new(); + { + private HashSet _spinnyBaras = new HashSet(); public readonly Vector3 _capy1 = new Vector3(129, 293, 18); public void SubscribeEvents() diff --git a/KruacentExiled/KE.Map/ShowPos.cs b/KruacentExiled/KE.Map/ShowPos.cs index 12358c97..a34a8d79 100644 --- a/KruacentExiled/KE.Map/ShowPos.cs +++ b/KruacentExiled/KE.Map/ShowPos.cs @@ -14,7 +14,7 @@ public class ShowPos : ICommand { public string Command => "showposition"; - public string[] Aliases => ["showpos"]; + public string[] Aliases => new string[] { "showpos" }; public string Description => "show pos"; diff --git a/KruacentExiled/KE.Map/SpawnImage.cs b/KruacentExiled/KE.Map/SpawnImage.cs index 54e41d70..e758b383 100644 --- a/KruacentExiled/KE.Map/SpawnImage.cs +++ b/KruacentExiled/KE.Map/SpawnImage.cs @@ -19,11 +19,11 @@ public class SpawnImage : KECommand { public override string Command => "spawnimage"; - public override string[] Aliases => []; + public override string[] Aliases => new string[0]; public override string Description => "image"; - public override string[] Usage => [""]; + public override string[] Usage => new string[0]; public override bool ExecuteCommand(ArraySegment arguments, ICommandSender sender, out string response) { @@ -48,7 +48,7 @@ public override bool ExecuteCommand(ArraySegment arguments, ICommandSend return true; } - private TestHintPosition position = new(); + private TestHintPosition position = new TestHintPosition(); } diff --git a/KruacentExiled/KE.Map/Surface/BlinkingBlocks/BlinkingBlock.cs b/KruacentExiled/KE.Map/Surface/BlinkingBlocks/BlinkingBlock.cs index 88acbccd..aa790d5f 100644 --- a/KruacentExiled/KE.Map/Surface/BlinkingBlocks/BlinkingBlock.cs +++ b/KruacentExiled/KE.Map/Surface/BlinkingBlocks/BlinkingBlock.cs @@ -24,8 +24,8 @@ public class BlinkingBlock : IWorldSpace - private HashSet _list = new(); - private HashSet outline = new(); + private HashSet _list = new HashSet(); + private HashSet outline = new HashSet(); public BlinkingBlock(Vector3 pos, Quaternion rotation, Vector3 scale, BlockColor color) { Position = pos; diff --git a/KruacentExiled/KE.Map/Surface/BlinkingBlocks/BlinkingBlocksGroup.cs b/KruacentExiled/KE.Map/Surface/BlinkingBlocks/BlinkingBlocksGroup.cs index cbf47cb2..ce241f34 100644 --- a/KruacentExiled/KE.Map/Surface/BlinkingBlocks/BlinkingBlocksGroup.cs +++ b/KruacentExiled/KE.Map/Surface/BlinkingBlocks/BlinkingBlocksGroup.cs @@ -21,9 +21,9 @@ public class BlinkingBlocksGroup : IPosition private HashSet _list; public BlinkingBlocksGroup(IEnumerable blocks) { - _list = new(blocks); + _list = new HashSet(blocks); - Vector3 center = new(_list.Average(x => x.Position.x), _list.Average(x => x.Position.y),_list.Average(x => x.Position.z)); + Vector3 center = new Vector3(_list.Average(x => x.Position.x), _list.Average(x => x.Position.y),_list.Average(x => x.Position.z)); diff --git a/KruacentExiled/KE.Map/Surface/ElevatorGateA/CustomElevatorGateA.cs b/KruacentExiled/KE.Map/Surface/ElevatorGateA/CustomElevatorGateA.cs index e71f439f..2baac220 100644 --- a/KruacentExiled/KE.Map/Surface/ElevatorGateA/CustomElevatorGateA.cs +++ b/KruacentExiled/KE.Map/Surface/ElevatorGateA/CustomElevatorGateA.cs @@ -50,15 +50,15 @@ public static void Create() Log.Error(e); } - model = new(); + model = new ElevatorModel(); - toppanel = new(); - bottompanel = new(); + toppanel = new Panel(); + bottompanel = new Panel(); CreatePrimitives(); CreateModels(); - step = Primitive.Create(PrimitiveType.Cube, new(18.4f, 300.35f, -49.27f),null,new Vector3(2,.5f,1f)); + step = Primitive.Create(PrimitiveType.Cube, new Vector3(18.4f, 300.35f, -49.27f),null,new Vector3(2,.5f,1f)); model.SendingElevator += SendingElevator; @@ -83,10 +83,10 @@ private static void CreateModels() private static void CreatePrimitives() { - Vector3 pos = new(18.24f, 290.65f, -46.07f); - Vector3 helppos = new(18.24f, 255.65f, -46.07f); - Vector3 postop = new(19.92f, 299.97f, -48.95f); - Vector3 posbot = new(15.62f, 290.65f, -45.19f); + Vector3 pos = new Vector3(18.24f, 290.65f, -46.07f); + Vector3 helppos = new Vector3(18.24f, 255.65f, -46.07f); + Vector3 postop = new Vector3(19.92f, 299.97f, -48.95f); + Vector3 posbot = new Vector3(15.62f, 290.65f, -45.19f); prim = Primitive.Create(pos, null, Vector3.one * Scale); prim.Flags = AdminToys.PrimitiveFlags.None; prim.MovementSmoothing = 0; @@ -167,7 +167,7 @@ public static void Send() if (!prim.GameObject.TryGetComponent(out var comp)) { comp = prim.GameObject.AddComponent(); - comp.Init(prim, [model, bottompanel, toppanel]); + comp.Init(prim, new List() { model, bottompanel, toppanel }); } comp.Send(); } diff --git a/KruacentExiled/KE.Map/Surface/Rooms/SurfaceRooms.cs b/KruacentExiled/KE.Map/Surface/Rooms/SurfaceRooms.cs index 40ad8517..0cb59618 100644 --- a/KruacentExiled/KE.Map/Surface/Rooms/SurfaceRooms.cs +++ b/KruacentExiled/KE.Map/Surface/Rooms/SurfaceRooms.cs @@ -15,7 +15,7 @@ public class SurfaceRooms : IUsingEvents { public static GameObject gameObject; - public static readonly HashSet Rooms = new() + public static readonly HashSet Rooms = new HashSet() { new SurfaceArmory() }; diff --git a/KruacentExiled/KE.Map/Surface/SupplyDrops/SupplyDrop.cs b/KruacentExiled/KE.Map/Surface/SupplyDrops/SupplyDrop.cs index d8cc29a7..7ac559d5 100644 --- a/KruacentExiled/KE.Map/Surface/SupplyDrops/SupplyDrop.cs +++ b/KruacentExiled/KE.Map/Surface/SupplyDrops/SupplyDrop.cs @@ -57,15 +57,15 @@ public bool Show private static Stopwatch _spawnTime; private static TimeSpan _nextSpawn; - private static List list = new(); + private static List list = new List(); public static IReadOnlyCollection SpawnPositions = new List() { - new(-15,292,-39), //spawn chaos - new(40,301,-52), // above the gate - new(138,295,-64), //behind mtf spawn at the unopenable gate - new(124,289,22) //escape + new Vector3(-15,292,-39), //spawn chaos + new Vector3(40,301,-52), // above the gate + new Vector3(138,295,-64), //behind mtf spawn at the unopenable gate + new Vector3(124,289,22) //escape }; - private HashSet primitives = new(); + private HashSet primitives = new HashSet(); private bool _detectingSomeone = false; public RoleTypeId SideClaimed { get; private set; } = RoleTypeId.None; @@ -85,7 +85,7 @@ public SupplyDrop(Vector3 position) //Model primitives.Add(Primitive.Create(PrimitiveType.Cube,position,null,Vector3.one,false)); //radius of pickup - var pr = Primitive.Create(PrimitiveType.Sphere, Position, null, new(Radius, Radius, Radius), false, new(0, 1, 0, .30f)); + var pr = Primitive.Create(PrimitiveType.Sphere, Position, null, new Vector3(Radius, Radius, Radius), false, new Color(0, 1, 0, .30f)); pr.Collidable = false; primitives.Add(pr); @@ -153,7 +153,7 @@ private static void SpawnRandom() //Todo random lol Vector3 spawnloc = SpawnPositions.GetRandomValue(); Log.Info($"spawning drop at {spawnloc}"); - SupplyDrop soup = new(spawnloc); + SupplyDrop soup = new SupplyDrop(spawnloc); } diff --git a/KruacentExiled/KE.Map/Surface/Turrets/Turret.cs b/KruacentExiled/KE.Map/Surface/Turrets/Turret.cs index 768604bb..316cb223 100644 --- a/KruacentExiled/KE.Map/Surface/Turrets/Turret.cs +++ b/KruacentExiled/KE.Map/Surface/Turrets/Turret.cs @@ -63,7 +63,7 @@ public Quaternion Rotation - private static List list = new(); + private static List list = new List(); private Turret(Player p,Vector3 position) { diff --git a/KruacentExiled/KE.Map/Utils/Animations.cs b/KruacentExiled/KE.Map/Utils/Animations.cs index 7958dab0..34ad9f94 100644 --- a/KruacentExiled/KE.Map/Utils/Animations.cs +++ b/KruacentExiled/KE.Map/Utils/Animations.cs @@ -10,7 +10,7 @@ namespace KE.Map.Utils public abstract class AnimatedModel : ModelBase { - protected List animationNames = new(); + protected List animationNames = new List(); diff --git a/KruacentExiled/KE.Map/Utils/StructureSpawner.cs b/KruacentExiled/KE.Map/Utils/StructureSpawner.cs index 6e947c8d..3214b55d 100644 --- a/KruacentExiled/KE.Map/Utils/StructureSpawner.cs +++ b/KruacentExiled/KE.Map/Utils/StructureSpawner.cs @@ -13,7 +13,7 @@ namespace KE.Map.Utils { public static class StructureSpawner { - public static Dictionary> AdditionalDoors { get; } = new(); + public static Dictionary> AdditionalDoors { get; } = new Dictionary>(); @@ -62,7 +62,7 @@ public static DoorVariant SpawnDoor(DoorType doortype,Vector3 position,Quaternio if (!AdditionalDoors.ContainsKey(zone)) { - AdditionalDoors.Add(zone, new()); + AdditionalDoors.Add(zone, new HashSet()); } AdditionalDoors[zone].Add(doorVariant); diff --git a/KruacentExiled/KE.Misc/Events/Handlers/GamblingCoins.cs b/KruacentExiled/KE.Misc/Events/Handlers/GamblingCoins.cs index 443532f8..d3e830c0 100644 --- a/KruacentExiled/KE.Misc/Events/Handlers/GamblingCoins.cs +++ b/KruacentExiled/KE.Misc/Events/Handlers/GamblingCoins.cs @@ -13,8 +13,8 @@ public static class GamblingCoins - public static Event Gambling = new(); - public static Event Gambled = new(); + public static Event Gambling = new Event(); + public static Event Gambled = new Event(); diff --git a/KruacentExiled/KE.Misc/Features/914Upgrades/GiveOmni.cs b/KruacentExiled/KE.Misc/Features/914Upgrades/GiveOmni.cs index 926ff934..447d2ede 100644 --- a/KruacentExiled/KE.Misc/Features/914Upgrades/GiveOmni.cs +++ b/KruacentExiled/KE.Misc/Features/914Upgrades/GiveOmni.cs @@ -11,11 +11,11 @@ public class GiveOmni : KECommand { public override string Command => "giveomni"; - public override string[] Aliases => []; + public override string[] Aliases => new string[0]; public override string Description => "gives an omni card"; - public override string[] Usage => []; + public override string[] Usage => new string[0]; public override bool ExecuteCommand(ArraySegment arguments, ICommandSender sender, out string response) { @@ -27,7 +27,7 @@ public override bool ExecuteCommand(ArraySegment arguments, ICommandSend return false; } - if(player.Role is not FpcRole) + if(!(player.Role is FpcRole)) { response = "wrong role"; return false; diff --git a/KruacentExiled/KE.Misc/Features/914Upgrades/OmniCardUpgrade.cs b/KruacentExiled/KE.Misc/Features/914Upgrades/OmniCardUpgrade.cs index da4ab024..cdb0734b 100644 --- a/KruacentExiled/KE.Misc/Features/914Upgrades/OmniCardUpgrade.cs +++ b/KruacentExiled/KE.Misc/Features/914Upgrades/OmniCardUpgrade.cs @@ -11,12 +11,12 @@ public class OmniCardUpgrade : Base914PlayerUpgrade { protected override float Chance => 1; - public static readonly Color32 CardColor = new(45, 44, 249,255); + public static readonly Color32 CardColor = new Color32(45, 44, 249,255); protected override bool OnUpgradingPlayer(UpgradingPlayerEventArgs ev) { LabPlayer player = ev.Player; if (player.CurrentItem is null) return false; - if (player.CurrentItem is not KeycardItem keycard) return false; + if (!(player.CurrentItem is KeycardItem keycard)) return false; player.RemoveItem(keycard); diff --git a/KruacentExiled/KE.Misc/Features/914Upgrades/PlayerTeleport914.cs b/KruacentExiled/KE.Misc/Features/914Upgrades/PlayerTeleport914.cs index 6e796b4d..737383c0 100644 --- a/KruacentExiled/KE.Misc/Features/914Upgrades/PlayerTeleport914.cs +++ b/KruacentExiled/KE.Misc/Features/914Upgrades/PlayerTeleport914.cs @@ -21,7 +21,7 @@ protected override bool OnUpgradingPlayer(UpgradingPlayerEventArgs ev) Player player = ev.Player; Room room = null; - if(player.Role is not PlayerRoles.FirstPersonControl.IFpcRole fpc) + if(!(player.Role is IFpcRole fpc)) { return false; } diff --git a/KruacentExiled/KE.Misc/Features/914Upgrades/RoleChanging/Base914PlayerRoleChange.cs b/KruacentExiled/KE.Misc/Features/914Upgrades/RoleChanging/Base914PlayerRoleChange.cs index f4f3ea46..b2fad26f 100644 --- a/KruacentExiled/KE.Misc/Features/914Upgrades/RoleChanging/Base914PlayerRoleChange.cs +++ b/KruacentExiled/KE.Misc/Features/914Upgrades/RoleChanging/Base914PlayerRoleChange.cs @@ -16,7 +16,7 @@ namespace KE.Misc.Features._914Upgrades { public abstract class Base914PlayerRoleChange : Base914PlayerUpgrade { - protected static HashSet _upgradingPlayer = new(); + protected static HashSet _upgradingPlayer = new HashSet(); public abstract RoleTypeId InputRole { get; } diff --git a/KruacentExiled/KE.Misc/Features/914Upgrades/RoleChanging/Human914RC.cs b/KruacentExiled/KE.Misc/Features/914Upgrades/RoleChanging/Human914RC.cs index b9eb27b4..85f730fd 100644 --- a/KruacentExiled/KE.Misc/Features/914Upgrades/RoleChanging/Human914RC.cs +++ b/KruacentExiled/KE.Misc/Features/914Upgrades/RoleChanging/Human914RC.cs @@ -17,7 +17,7 @@ public class ClassD914RC : Base914PlayerRoleChange public override IReadOnlyDictionary OutputRoles { get; } = new Dictionary() { - { Scp914KnobSetting.OneToOne,new(RoleTypeId.Scientist,50f)} + { Scp914KnobSetting.OneToOne,new RoleOutput(RoleTypeId.Scientist,50f)} }; } @@ -27,7 +27,7 @@ public class Scientist914RC : Base914PlayerRoleChange public override IReadOnlyDictionary OutputRoles { get; } = new Dictionary() { - { Scp914KnobSetting.OneToOne,new(RoleTypeId.ClassD,50f)} + { Scp914KnobSetting.OneToOne,new RoleOutput(RoleTypeId.ClassD,50f)} }; } @@ -37,7 +37,7 @@ public class Guard914RC : Base914PlayerRoleChange public override IReadOnlyDictionary OutputRoles { get; } = new Dictionary() { - { Scp914KnobSetting.Rough,new(RoleTypeId.Scientist,100f)} + { Scp914KnobSetting.Rough,new RoleOutput(RoleTypeId.Scientist,100f)} }; protected override void SetRole(Player player, RoleTypeId newRole) @@ -48,22 +48,22 @@ protected override void SetRole(Player player, RoleTypeId newRole) } public class MTF914RC : Multiple914PlayerRoleChangeBase { - public override HashSet InputRole => [RoleTypeId.NtfCaptain,RoleTypeId.NtfPrivate,RoleTypeId.NtfSergeant,RoleTypeId.NtfSpecialist]; + public override HashSet InputRole => new HashSet(){ RoleTypeId.NtfCaptain, RoleTypeId.NtfPrivate, RoleTypeId.NtfSergeant, RoleTypeId.NtfSpecialist}; public override IReadOnlyDictionary OutputRoles { get; } = new Dictionary() { - { Scp914KnobSetting.OneToOne,new(RoleTypeId.ChaosRifleman,50f)} + { Scp914KnobSetting.OneToOne,new RoleOutput(RoleTypeId.ChaosRifleman,50f)} }; } public class Chaos914RC : Multiple914PlayerRoleChangeBase { - public override HashSet InputRole => [RoleTypeId.ChaosRifleman, RoleTypeId.ChaosRepressor, RoleTypeId.ChaosMarauder, RoleTypeId.ChaosConscript]; + public override HashSet InputRole => new HashSet() { RoleTypeId.ChaosRifleman, RoleTypeId.ChaosRepressor, RoleTypeId.ChaosMarauder, RoleTypeId.ChaosConscript }; public override IReadOnlyDictionary OutputRoles { get; } = new Dictionary() { - { Scp914KnobSetting.OneToOne,new(RoleTypeId.NtfPrivate,50f)} + { Scp914KnobSetting.OneToOne,new RoleOutput(RoleTypeId.NtfPrivate,50f)} }; } diff --git a/KruacentExiled/KE.Misc/Features/914Upgrades/RoleChanging/Multiple914PlayerRoleChangeBase.cs b/KruacentExiled/KE.Misc/Features/914Upgrades/RoleChanging/Multiple914PlayerRoleChangeBase.cs index 1d077bdd..d8c132d7 100644 --- a/KruacentExiled/KE.Misc/Features/914Upgrades/RoleChanging/Multiple914PlayerRoleChangeBase.cs +++ b/KruacentExiled/KE.Misc/Features/914Upgrades/RoleChanging/Multiple914PlayerRoleChangeBase.cs @@ -16,7 +16,7 @@ namespace KE.Misc.Features._914Upgrades { public abstract class Multiple914PlayerRoleChangeBase : Base914PlayerUpgrade { - protected static HashSet _upgradingPlayer = new(); + protected static HashSet _upgradingPlayer = new HashSet(); public abstract HashSet InputRole { get; } diff --git a/KruacentExiled/KE.Misc/Features/914Upgrades/RoleChanging/SCP914RC.cs b/KruacentExiled/KE.Misc/Features/914Upgrades/RoleChanging/SCP914RC.cs index 8c6a5afd..89978b86 100644 --- a/KruacentExiled/KE.Misc/Features/914Upgrades/RoleChanging/SCP914RC.cs +++ b/KruacentExiled/KE.Misc/Features/914Upgrades/RoleChanging/SCP914RC.cs @@ -14,8 +14,8 @@ public class Scp096RC : Base914PlayerRoleChange public override IReadOnlyDictionary OutputRoles { get; } = new Dictionary() { - { Scp914KnobSetting.OneToOne,new(RoleTypeId.Scp3114,50f)}, - { Scp914KnobSetting.VeryFine,new(RoleTypeId.Scp939,50f)} + { Scp914KnobSetting.OneToOne,new RoleOutput(RoleTypeId.Scp3114,50f)}, + { Scp914KnobSetting.VeryFine,new RoleOutput(RoleTypeId.Scp939,50f)} }; } @@ -25,8 +25,8 @@ public class Scp3114RC : Base914PlayerRoleChange public override IReadOnlyDictionary OutputRoles { get; } = new Dictionary() { - { Scp914KnobSetting.OneToOne,new(RoleTypeId.Scp096,50f)}, - { Scp914KnobSetting.VeryFine,new(RoleTypeId.Scp173,50f)} + { Scp914KnobSetting.OneToOne,new RoleOutput(RoleTypeId.Scp096,50f)}, + { Scp914KnobSetting.VeryFine,new RoleOutput(RoleTypeId.Scp173,50f)} }; } @@ -36,9 +36,9 @@ public class Scp939RC : Base914PlayerRoleChange public override IReadOnlyDictionary OutputRoles { get; } = new Dictionary() { - { Scp914KnobSetting.Rough,new(RoleTypeId.Scp096,50f)}, - { Scp914KnobSetting.OneToOne,new(RoleTypeId.Scp173,50f)}, - { Scp914KnobSetting.VeryFine,new(RoleTypeId.Scp049,50f)}, + { Scp914KnobSetting.Rough,new RoleOutput(RoleTypeId.Scp096,50f)}, + { Scp914KnobSetting.OneToOne,new RoleOutput(RoleTypeId.Scp173,50f)}, + { Scp914KnobSetting.VeryFine,new RoleOutput(RoleTypeId.Scp049,50f)}, }; } @@ -49,9 +49,9 @@ public class Scp173RC : Base914PlayerRoleChange public override IReadOnlyDictionary OutputRoles { get; } = new Dictionary() { - { Scp914KnobSetting.Rough,new(RoleTypeId.Scp096,50f)}, - { Scp914KnobSetting.OneToOne,new(RoleTypeId.Scp939,50f)}, - { Scp914KnobSetting.VeryFine,new(RoleTypeId.Scp106,50f)}, + { Scp914KnobSetting.Rough,new RoleOutput(RoleTypeId.Scp096,50f)}, + { Scp914KnobSetting.OneToOne,new RoleOutput(RoleTypeId.Scp939,50f)}, + { Scp914KnobSetting.VeryFine,new RoleOutput(RoleTypeId.Scp106,50f)}, }; } @@ -62,8 +62,8 @@ public class Scp106RC : Base914PlayerRoleChange public override IReadOnlyDictionary OutputRoles { get; } = new Dictionary() { - { Scp914KnobSetting.Rough,new(RoleTypeId.Scp173,50f)}, - { Scp914KnobSetting.OneToOne,new(RoleTypeId.Scp049,50f)}, + { Scp914KnobSetting.Rough,new RoleOutput(RoleTypeId.Scp173,50f)}, + { Scp914KnobSetting.OneToOne,new RoleOutput(RoleTypeId.Scp049,50f)}, }; } @@ -73,8 +73,8 @@ public class Scp049RC : Base914PlayerRoleChange public override IReadOnlyDictionary OutputRoles { get; } = new Dictionary() { - { Scp914KnobSetting.Rough,new(RoleTypeId.Scp939,50f)}, - { Scp914KnobSetting.OneToOne,new(RoleTypeId.Scp106,50f)}, + { Scp914KnobSetting.Rough,new RoleOutput(RoleTypeId.Scp939,50f)}, + { Scp914KnobSetting.OneToOne,new RoleOutput(RoleTypeId.Scp106,50f)}, }; } diff --git a/KruacentExiled/KE.Misc/Features/GamblingCoin/Effect/NegativeEffect/EatingStar.cs b/KruacentExiled/KE.Misc/Features/GamblingCoin/Effect/NegativeEffect/EatingStar.cs index 37cbc506..6cf6d5a9 100644 --- a/KruacentExiled/KE.Misc/Features/GamblingCoin/Effect/NegativeEffect/EatingStar.cs +++ b/KruacentExiled/KE.Misc/Features/GamblingCoin/Effect/NegativeEffect/EatingStar.cs @@ -15,8 +15,8 @@ public class EatingStar : IDurationEffect public EffectType Type { get; set; } = EffectType.Negative; - private Dictionary _lights = new(); - private Dictionary _clips = new(); + private Dictionary _lights = new Dictionary(); + private Dictionary _clips = new Dictionary(); public float Duration { get; set; } = 20; private static CoroutineHandle _coroutines; diff --git a/KruacentExiled/KE.Misc/Features/GamblingCoin/Effect/NegativeEffect/SwapInventory.cs b/KruacentExiled/KE.Misc/Features/GamblingCoin/Effect/NegativeEffect/SwapInventory.cs index bc4d47cc..5c7944a7 100644 --- a/KruacentExiled/KE.Misc/Features/GamblingCoin/Effect/NegativeEffect/SwapInventory.cs +++ b/KruacentExiled/KE.Misc/Features/GamblingCoin/Effect/NegativeEffect/SwapInventory.cs @@ -29,8 +29,8 @@ public void Execute(Player player) List items1 = player.Items.Select(item => item.Type).ToList(); List items2 = target.Items.Select(item => item.Type).ToList(); - Dictionary ammo1 = new(); - Dictionary ammo2 = new(); + Dictionary ammo1 = new Dictionary(); + Dictionary ammo2 = new Dictionary(); for (int i = 0; i < player.Ammo.Count; i++) { ammo1.Add(player.Ammo.ElementAt(i).Key.GetAmmoType(), player.Ammo.ElementAt(i).Value); diff --git a/KruacentExiled/KE.Misc/Features/GamblingCoin/EventHandlers.cs b/KruacentExiled/KE.Misc/Features/GamblingCoin/EventHandlers.cs index a1d31ce5..582d3ef7 100644 --- a/KruacentExiled/KE.Misc/Features/GamblingCoin/EventHandlers.cs +++ b/KruacentExiled/KE.Misc/Features/GamblingCoin/EventHandlers.cs @@ -16,8 +16,8 @@ public class EventHandlers { private static Config Config => MainPlugin.Configs; - private readonly Dictionary _cooldowns = new(); - public static Dictionary CoinUses = new(); + private readonly Dictionary _cooldowns = new Dictionary(); + public static Dictionary CoinUses = new Dictionary(); public void OnCoinFlip(FlippingCoinEventArgs ev) { @@ -27,7 +27,7 @@ public void OnCoinFlip(FlippingCoinEventArgs ev) if (CustomItem.TryGet(item, out _)) return; - GamblingEventArgs ev1 = new(player, item, true); + GamblingEventArgs ev1 = new GamblingEventArgs(player, item, true); Events.Handlers.GamblingCoins.OnGambling(ev1); @@ -84,7 +84,7 @@ public void OnCoinFlip(FlippingCoinEventArgs ev) player.Broadcast(5, "no more coin"); item = null; } - GambledEventArgs ev2 = new(player, item, effect, remainingUses, shouldBreak); + GambledEventArgs ev2 = new GambledEventArgs(player, item, effect, remainingUses, shouldBreak); Events.Handlers.GamblingCoins.OnGambled(ev2); diff --git a/KruacentExiled/KE.Misc/Features/GamblingCoin/ForceEffect.cs b/KruacentExiled/KE.Misc/Features/GamblingCoin/ForceEffect.cs index 209be2df..7a327484 100644 --- a/KruacentExiled/KE.Misc/Features/GamblingCoin/ForceEffect.cs +++ b/KruacentExiled/KE.Misc/Features/GamblingCoin/ForceEffect.cs @@ -14,7 +14,7 @@ public class ForceCoinEffect : ICommand { public string Command => "forcecoineffect"; - public string[] Aliases => ["fce"]; + public string[] Aliases => new string[] { "fce" }; public string Description => "force a effect for a player"; diff --git a/KruacentExiled/KE.Misc/Features/GamblingCoin/GamblingCoinManager.cs b/KruacentExiled/KE.Misc/Features/GamblingCoin/GamblingCoinManager.cs index 67fc7c17..f0149dbd 100644 --- a/KruacentExiled/KE.Misc/Features/GamblingCoin/GamblingCoinManager.cs +++ b/KruacentExiled/KE.Misc/Features/GamblingCoin/GamblingCoinManager.cs @@ -14,14 +14,14 @@ namespace KE.Misc.Features.GamblingCoin { public static class GamblingCoinManager { - private static readonly Dictionary _nameLookup = new(); - private static readonly HashSet _activeEffects = new(); + private static readonly Dictionary _nameLookup = new Dictionary(); + private static readonly HashSet _activeEffects = new HashSet(); - public static List EffectList { get; private set; } = new(); + public static List EffectList { get; private set; } = new List(); public static IEnumerable RegisterAll() { - List assemblies = new(); + List assemblies = new List(); foreach (var plugin in Exiled.Loader.Loader.Plugins) assemblies.Add(plugin.Assembly); diff --git a/KruacentExiled/KE.Misc/Features/LoadingMiscFeature.cs b/KruacentExiled/KE.Misc/Features/LoadingMiscFeature.cs index 4cb77915..9a0227aa 100644 --- a/KruacentExiled/KE.Misc/Features/LoadingMiscFeature.cs +++ b/KruacentExiled/KE.Misc/Features/LoadingMiscFeature.cs @@ -16,7 +16,7 @@ internal class LoadingMiscFeature : MiscFeature internal LoadingMiscFeature() : base() { - _allLoadedFeatures = new(ReflectionHelper.GetObjects()); + _allLoadedFeatures = new HashSet(ReflectionHelper.GetObjects()); } diff --git a/KruacentExiled/KE.Misc/Features/MiscFeature.cs b/KruacentExiled/KE.Misc/Features/MiscFeature.cs index bc2e7653..3bbd96bc 100644 --- a/KruacentExiled/KE.Misc/Features/MiscFeature.cs +++ b/KruacentExiled/KE.Misc/Features/MiscFeature.cs @@ -11,7 +11,7 @@ namespace KE.Misc.Features { public abstract class MiscFeature : IUsingEvents { - private static HashSet _list = new(); + private static HashSet _list = new HashSet(); internal MiscFeature() diff --git a/KruacentExiled/KE.Misc/Features/SCPBuff.cs b/KruacentExiled/KE.Misc/Features/SCPBuff.cs index 56df544f..f937118c 100644 --- a/KruacentExiled/KE.Misc/Features/SCPBuff.cs +++ b/KruacentExiled/KE.Misc/Features/SCPBuff.cs @@ -22,7 +22,7 @@ public class SCPBuff : IUsingEvents public float IncreaseSCPHealth { get; } = 1.25f; private static Config Config => MainPlugin.Configs; - public Dictionary RoleBuff = new() + public Dictionary RoleBuff = new Dictionary() { {RoleTypeId.Scp049, Config.MultSCP049 }, {RoleTypeId.Scp939, Config.MultSCP939 }, @@ -68,7 +68,7 @@ private void BecomingSCP(ChangingRoleEventArgs ev) healthincrease *= val; } - BuffingSCPEventArgs ev1 = new(player, true, healthincrease); + BuffingSCPEventArgs ev1 = new BuffingSCPEventArgs(player, true, healthincrease); OnBuffingSCP?.Invoke(ev1); if (ev1.IsAllowed) @@ -78,7 +78,7 @@ private void BecomingSCP(ChangingRoleEventArgs ev) player.MaxHealth *= healthincrease; player.Health = player.MaxHealth; }); - BuffedSCPEventArgs ev2 = new(player, healthincrease); + BuffedSCPEventArgs ev2 = new BuffedSCPEventArgs(player, healthincrease); OnBuffedSCP?.Invoke(ev2); } diff --git a/KruacentExiled/KE.Misc/Features/Spawn/Spawn.cs b/KruacentExiled/KE.Misc/Features/Spawn/Spawn.cs index 151576b4..f24152a1 100644 --- a/KruacentExiled/KE.Misc/Features/Spawn/Spawn.cs +++ b/KruacentExiled/KE.Misc/Features/Spawn/Spawn.cs @@ -15,7 +15,7 @@ namespace KE.Misc.Features.Spawn public class Spawn : MiscFeature { - private Dictionary baseRole = new () + private Dictionary baseRole = new Dictionary() { { "173", RoleTypeId.Scp173 }, { "106", RoleTypeId.Scp106 }, @@ -37,7 +37,7 @@ private void OnRoundStarted() { if (!MainPlugin.Configs.ScpPreferences) return; - eventarg = new(); + eventarg = new SpawnedEventArgs(); foreach (Player player in Player.List.Where(p => p.IsScp && !p.IsNPC)) { @@ -75,7 +75,7 @@ private bool SetScpPreferences(Player player) private Dictionary GetPreferences(Player player) { if (player.ScpPreferences.Preferences == null) return null; - Dictionary idChance = new(); + Dictionary idChance = new Dictionary(); foreach(var kvp in baseRole) @@ -118,7 +118,7 @@ private Dictionary GetPreferences(Player player) private string ChooseRandomRole(IDictionary chancescp) { if (chancescp == null) throw new ArgumentException("Dictionary null"); - List weightedPool = new(); + List weightedPool = new List(); foreach (string ge in chancescp.Keys) { for (int i = 0; i < chancescp[ge]; i++) diff --git a/KruacentExiled/KE.Misc/Features/Spawn/SpawnedEventArgs.cs b/KruacentExiled/KE.Misc/Features/Spawn/SpawnedEventArgs.cs index 1c581734..24aeeace 100644 --- a/KruacentExiled/KE.Misc/Features/Spawn/SpawnedEventArgs.cs +++ b/KruacentExiled/KE.Misc/Features/Spawn/SpawnedEventArgs.cs @@ -25,8 +25,8 @@ public SpawnedEventArgs(List vanilla,List custom) public SpawnedEventArgs() { - VanillaRoles = new(); - CustomRoles = new(); + VanillaRoles = new List(); + CustomRoles = new List(); } } } diff --git a/KruacentExiled/KE.Misc/Features/SpawnLcz.cs b/KruacentExiled/KE.Misc/Features/SpawnLcz.cs index 9110491e..d879ed85 100644 --- a/KruacentExiled/KE.Misc/Features/SpawnLcz.cs +++ b/KruacentExiled/KE.Misc/Features/SpawnLcz.cs @@ -17,7 +17,7 @@ internal class SpawnLcz : MiscFeature { public float Time { get; } = 198; - public static readonly Dictionary RoomTypes = new() + public static readonly Dictionary RoomTypes = new Dictionary() { { RoleTypeId.Scp939,RoomType.Lcz330 }, { RoleTypeId.Scp096,RoomType.LczGlassBox }, @@ -36,8 +36,8 @@ public float Chance } } - private HashSet serials = new(); - private HashSet locked = new(); + private HashSet serials = new HashSet(); + private HashSet locked = new HashSet(); public override void SubscribeEvents() { diff --git a/KruacentExiled/KE.Misc/Features/SurfaceLight.cs b/KruacentExiled/KE.Misc/Features/SurfaceLight.cs index 186d1c8d..0a52efaa 100644 --- a/KruacentExiled/KE.Misc/Features/SurfaceLight.cs +++ b/KruacentExiled/KE.Misc/Features/SurfaceLight.cs @@ -13,7 +13,7 @@ namespace KE.Misc.Features internal class SurfaceLight : MiscFeature { - public static readonly HashSet _colors = new() + public static readonly HashSet _colors = new HashSet() { Color.cyan, Color.red, diff --git a/KruacentExiled/KE.Misc/Features/VoteStart/ForceVoteNumber.cs b/KruacentExiled/KE.Misc/Features/VoteStart/ForceVoteNumber.cs index 99071762..0ea4d76c 100644 --- a/KruacentExiled/KE.Misc/Features/VoteStart/ForceVoteNumber.cs +++ b/KruacentExiled/KE.Misc/Features/VoteStart/ForceVoteNumber.cs @@ -13,7 +13,7 @@ public class ForceVoteNumber : ICommand { public string Command => "nbvote"; - public string[] Aliases => ["nbv"]; + public string[] Aliases => new string[] { "nbv" }; public string Description => "force a number of people needed to vote for this round only"; diff --git a/KruacentExiled/KE.Misc/Features/VoteStart/RetractVote.cs b/KruacentExiled/KE.Misc/Features/VoteStart/RetractVote.cs index 39f692c1..cd3dad28 100644 --- a/KruacentExiled/KE.Misc/Features/VoteStart/RetractVote.cs +++ b/KruacentExiled/KE.Misc/Features/VoteStart/RetractVote.cs @@ -14,11 +14,11 @@ public class RestractVote : KECommand { public override string Command => "removevote"; - public override string[] Aliases => ["rv","retractv","removev"]; + public override string[] Aliases => new string[] { "rv", "retractv", "removev" }; public override string Description => "remove the set vote"; - public override string[] Usage => [""]; + public override string[] Usage => new string[] { "" }; public override bool ExecuteCommand(ArraySegment arguments, ICommandSender sender, out string response) { if(!Round.IsLobby) diff --git a/KruacentExiled/KE.Misc/Features/VoteStart/VoteStart.cs b/KruacentExiled/KE.Misc/Features/VoteStart/VoteStart.cs index d155daad..db728e9e 100644 --- a/KruacentExiled/KE.Misc/Features/VoteStart/VoteStart.cs +++ b/KruacentExiled/KE.Misc/Features/VoteStart/VoteStart.cs @@ -32,7 +32,7 @@ internal class VoteStart : MiscFeature public static HintPosition HintPosition = new VotePosition(); - private List Voted = new(); + private List Voted = new List(); private bool voteCasted = false; public override void SubscribeEvents() { diff --git a/KruacentExiled/KE.Misc/MainPlugin.cs b/KruacentExiled/KE.Misc/MainPlugin.cs index 7908fbfb..b54cacc3 100644 --- a/KruacentExiled/KE.Misc/MainPlugin.cs +++ b/KruacentExiled/KE.Misc/MainPlugin.cs @@ -58,7 +58,7 @@ public class MainPlugin : KEPlugin, ILocalizable public override void OnEnabled() { Instance = this; - harmony = new(Prefix); + harmony = new Harmony(Prefix); config = KruacentExiled.MainPlugin.Instance.Config.MiscConfig; @@ -69,14 +69,14 @@ public override void OnEnabled() ServerHandler = new ServerHandler(); Spawn = new Spawn(); SCPBuff = new SCPBuff(); - FriendlyFire = new(); - AutoNukeAnnoucement = new(); - AutoTesla = new(); - LastHuman = new(); + FriendlyFire = new FriendlyFire(); + AutoNukeAnnoucement = new NukeKill(); + AutoTesla = new AutoTesla(); + LastHuman = new LastHumanHandler(); Candy = new Candy(); - vote = new(); - postnuke = new(); - LobbyHint = new(); + vote = new VoteStart(); + postnuke = new PostNukeHandler(); + LobbyHint = new LobbyHint(); //SpawnLcz = new(); diff --git a/KruacentExiled/KE.Misc/Utils/ImageUtils.cs b/KruacentExiled/KE.Misc/Utils/ImageUtils.cs index b30ed794..318d3b4d 100644 --- a/KruacentExiled/KE.Misc/Utils/ImageUtils.cs +++ b/KruacentExiled/KE.Misc/Utils/ImageUtils.cs @@ -17,7 +17,7 @@ public static class ImageUtils public static IEnumerable GetAllImages() { - if(images is not null) + if(images != null) { return images; } diff --git a/KruacentExiled/KE.Misc/Utils/TextImage.cs b/KruacentExiled/KE.Misc/Utils/TextImage.cs index e6611017..0948eb4a 100644 --- a/KruacentExiled/KE.Misc/Utils/TextImage.cs +++ b/KruacentExiled/KE.Misc/Utils/TextImage.cs @@ -20,10 +20,10 @@ namespace KE.Misc.Utils { public class TextImage : IEquatable { - private static HashSet list = new(); + private static HashSet list = new HashSet(); private string rawString = string.Empty; - private HashSet spawnedTextToys = new(); + private HashSet spawnedTextToys = new HashSet(); public static Vector2 DefaultDisplaySize => new Vector2(5000, 5000); @@ -71,7 +71,7 @@ public TextImage(Image img) } } - if (nb > 0 && oldColor is not null) + if (nb > 0 && oldColor != null) { sb.Append(StartColorTag); sb.Append(ToHexValue(oldColor.Value) + ">"); diff --git a/KruacentExiled/KEPlugin.cs b/KruacentExiled/KEPlugin.cs index 6766c11a..61a7a16f 100644 --- a/KruacentExiled/KEPlugin.cs +++ b/KruacentExiled/KEPlugin.cs @@ -12,7 +12,6 @@ public abstract class KEPlugin { public abstract string Name { get; } public abstract string Prefix { get; } - public abstract IConfig Config { get; } @@ -26,8 +25,6 @@ public void InternalOnEnabled() Log.Send(Name + " has been enabled!", Discord.LogLevel.Info, ConsoleColor.DarkYellow); } - - } public abstract void OnEnabled(); public abstract void OnDisabled(); diff --git a/KruacentExiled/KruacentExiled.csproj b/KruacentExiled/KruacentExiled.csproj index 8378a987..50852009 100644 --- a/KruacentExiled/KruacentExiled.csproj +++ b/KruacentExiled/KruacentExiled.csproj @@ -1,7 +1,7 @@  - 13.0 + 8.0 net48 @@ -21,7 +21,7 @@ - + diff --git a/KruacentExiled/MainPlugin.cs b/KruacentExiled/MainPlugin.cs index 3e2a9878..937d5a70 100644 --- a/KruacentExiled/MainPlugin.cs +++ b/KruacentExiled/MainPlugin.cs @@ -14,27 +14,23 @@ internal class MainPlugin : Plugin private KEPlugin[] plugins; public override string Author => "Patrique & OmerGS"; - public override Version Version { get; } = new(2, 0, 0); + public override Version Version { get; } = new Version(2, 0, 0); public static MainPlugin Instance { get; private set; } - public override void OnEnabled() { Instance = this; - plugins = - [ + plugins = new KEPlugin[] + { new KE.CustomRoles.MainPlugin(), new KE.GlobalEventFramework.MainPlugin(), new KE.GlobalEventFramework.Examples.MainPlugin(), new KE.Items.MainPlugin(), new KE.Misc.MainPlugin(), new KE.Map.MainPlugin(), - - ]; - - + }; for (int i = 0; i < plugins.Length; i++) { @@ -42,13 +38,11 @@ public override void OnEnabled() try { plugin.OnEnabled(); - } catch(Exception e) { Log.Error(e); } - } @@ -83,12 +77,12 @@ public class Config : IConfig public bool Debug { get; set; } = false; - public KE.CustomRoles.Config CustomRoleConfig { get; set; } = new(); - public KE.Items.Config CustomItemConfig { get; set; } = new(); - public KE.Map.Config MapConfig { get; set; } = new(); - public KE.Misc.Config MiscConfig { get; set; } = new(); - public KE.GlobalEventFramework.Config GEFConfig { get; set; } = new(); - public KE.GlobalEventFramework.Examples.Config GEFEConfig { get; set; } = new(); + public KE.CustomRoles.Config CustomRoleConfig { get; set; } = new KE.CustomRoles.Config(); + public KE.Items.Config CustomItemConfig { get; set; } = new KE.Items.Config(); + public KE.Map.Config MapConfig { get; set; } = new KE.Map.Config(); + public KE.Misc.Config MiscConfig { get; set; } = new KE.Misc.Config(); + public KE.GlobalEventFramework.Config GEFConfig { get; set; } = new KE.GlobalEventFramework.Config(); + public KE.GlobalEventFramework.Examples.Config GEFEConfig { get; set; } = new KE.GlobalEventFramework.Examples.Config(); } } From 71e26106aa3104272c66b68279be5a12b9781aaa Mon Sep 17 00:00:00 2001 From: Omer <27omerf@gmail.Com> Date: Thu, 16 Apr 2026 20:51:59 +0200 Subject: [PATCH 852/853] add: workflow to block external PRs to master --- .github/workflows/block-pr-to-master.yml | 37 ++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 .github/workflows/block-pr-to-master.yml diff --git a/.github/workflows/block-pr-to-master.yml b/.github/workflows/block-pr-to-master.yml new file mode 100644 index 00000000..bbc1ad35 --- /dev/null +++ b/.github/workflows/block-pr-to-master.yml @@ -0,0 +1,37 @@ +name: Block external PRs to master +on: + pull_request_target: + branches: [ "master" ] + types: [opened, reopened] + +permissions: + pull-requests: write + issues: write + +jobs: + close-pr: + if: > + github.event.pull_request.author_association != 'OWNER' && + github.event.pull_request.author_association != 'MEMBER' && + github.event.pull_request.author_association != 'COLLABORATOR' + runs-on: ubuntu-latest + steps: + - name: Debug - Afficher le statut + run: echo "Le statut de l'auteur de cette PR est ${{ github.event.pull_request.author_association }}" + + - name: Close the PR + uses: actions/github-script@v6 + with: + script: | + github.rest.issues.createComment({ + issue_number: context.issue.number, + owner: context.repo.owner, + repo: context.repo.repo, + body: If you wish to contribute, please target the `dev` branch.' + }) + github.rest.pulls.update({ + pull_number: context.issue.number, + owner: context.repo.owner, + repo: context.repo.repo, + state: 'closed' + }) From ab219eb06f48784675839b0f6839099d4e051ed9 Mon Sep 17 00:00:00 2001 From: webblazar <276524297+webblazar@users.noreply.github.com> Date: Thu, 16 Apr 2026 20:53:36 +0200 Subject: [PATCH 853/853] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 89752e99..05097e95 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@
-

Kruaçent-Exiled

+

Kruaçent-Exilede

Gameplay overhaul plugins for SCP: Secret Laboratory.

Release Contributors