From 0fb97b4f21cebc58051a062eceea4204bdbfa49d Mon Sep 17 00:00:00 2001 From: NotIntense Date: Sun, 16 Jun 2024 21:35:05 -0400 Subject: [PATCH] Delete RainbowTags - Nebuli directory --- RainbowTags - Nebuli/Commands/ToggleRTag.cs | 50 -------- RainbowTags - Nebuli/Config.cs | 40 ------- RainbowTags - Nebuli/Extensions.cs | 22 ---- RainbowTags - Nebuli/MainClass.cs | 108 ------------------ .../Properties/AssemblyInfo.cs | 35 ------ .../RainbowTags - Nebuli.csproj | 87 -------------- RainbowTags - Nebuli/TagController.cs | 80 ------------- 7 files changed, 422 deletions(-) delete mode 100644 RainbowTags - Nebuli/Commands/ToggleRTag.cs delete mode 100644 RainbowTags - Nebuli/Config.cs delete mode 100644 RainbowTags - Nebuli/Extensions.cs delete mode 100644 RainbowTags - Nebuli/MainClass.cs delete mode 100644 RainbowTags - Nebuli/Properties/AssemblyInfo.cs delete mode 100644 RainbowTags - Nebuli/RainbowTags - Nebuli.csproj delete mode 100644 RainbowTags - Nebuli/TagController.cs diff --git a/RainbowTags - Nebuli/Commands/ToggleRTag.cs b/RainbowTags - Nebuli/Commands/ToggleRTag.cs deleted file mode 100644 index 582c6c4..0000000 --- a/RainbowTags - Nebuli/Commands/ToggleRTag.cs +++ /dev/null @@ -1,50 +0,0 @@ -using System; -using CommandSystem; -using Nebuli.API.Features.Player; -using RemoteAdmin; - -namespace RainbowTags.Commands; - -[CommandHandler(typeof(ClientCommandHandler))] -[CommandHandler(typeof(RemoteAdminCommandHandler))] -public class ToggleRTag : ICommand -{ - public string Command { get; } = "togglerainbowtag"; - public string[] Aliases { get; } = { "trt" }; - public string Description { get; } = "Toggles your rainbow tag on or off"; - - public bool Execute(ArraySegment arguments, ICommandSender sender, out string response) - { - if (sender is PlayerCommandSender playerCommandSender) - { - NebuliPlayer player = NebuliPlayer.Get(playerCommandSender); - if (player == null) - { - response = "You must be in-game to use this command!"; - return false; - } - - if (!MainClass.Instance.Config.RanksWithRTags.Contains(player.GroupName)) - { - response = "You must be a member of a rank with a rainbow tag to use this command!"; - return false; - } - - if (player.GameObject.TryGetComponent(out TagController rainbowTag)) - { - player.RemoveComponent(rainbowTag); - MainClass.PlayersWithoutRTags.Add(player); - response = "Your rainbow tag has been disabled!"; - return true; - } - - player.GameObject.AddComponent(); - MainClass.PlayersWithoutRTags.Remove(player); - response = "Your rainbow tag has been enabled!"; - return true; - } - - response = "You must be in-game to use this command!"; - return false; - } -} diff --git a/RainbowTags - Nebuli/Config.cs b/RainbowTags - Nebuli/Config.cs deleted file mode 100644 index 61a3273..0000000 --- a/RainbowTags - Nebuli/Config.cs +++ /dev/null @@ -1,40 +0,0 @@ -using Nebuli.API.Interfaces; -using System.Collections.Generic; -using System.ComponentModel; - -namespace RainbowTags; - -public class Config : IConfiguration -{ - public bool IsEnabled { get; set; } = true; - public bool Debug { get; set; } = false; - public bool GroupSpecificSequences { get; set; } = false; - - [Description("Tags Configuration")] - public float ColorInterval { get; set; } = 0.5f; - public List RanksWithRTags { get; set; } = new() - { - "owner", - "moderator", - "admin" - }; - public string[] Sequences { get; set; } = new[] - { - "red", - "orange", - "yellow", - "green", - "blue_green", - "magenta", - "silver", - "crimson" - }; - - public Dictionary> GroupSequences { get; set; } = new Dictionary> - { - { "owner", new List() { "red", "orange", "yellow", "green", "blue_green", "magenta", "silver", "crimson" } }, - { "moderator", new List() { "red", "orange", "yellow", "green", "blue_green", "magenta", "silver", "crimson" } }, - { "admin", new List() { "red", "orange", "yellow", "green", "blue_green", "magenta", "silver", "crimson" } } - }; - -} \ No newline at end of file diff --git a/RainbowTags - Nebuli/Extensions.cs b/RainbowTags - Nebuli/Extensions.cs deleted file mode 100644 index 27d32a3..0000000 --- a/RainbowTags - Nebuli/Extensions.cs +++ /dev/null @@ -1,22 +0,0 @@ -using Nebuli.API.Features.Player; -using UnityEngine; -using Object = UnityEngine.Object; - -namespace RainbowTags; - -public static class Extensions -{ - public static void RemoveComponent(this NebuliPlayer player, Component component) - { - var componentInstance = player.GameObject.GetComponent(component.GetType()); - if (componentInstance != null) - Object.Destroy(componentInstance); - } - - public static void RemoveComponent(this NebuliPlayer player) where T : Component - { - var component = player.GameObject.GetComponent(); - if (component != null) - Object.Destroy(component); - } -} \ No newline at end of file diff --git a/RainbowTags - Nebuli/MainClass.cs b/RainbowTags - Nebuli/MainClass.cs deleted file mode 100644 index 0eba415..0000000 --- a/RainbowTags - Nebuli/MainClass.cs +++ /dev/null @@ -1,108 +0,0 @@ -using Nebuli.API.Features; -using Nebuli.API.Features.Player; -using Nebuli.Events.EventArguments.Player; -using Nebuli.Events.Handlers; -using System; -using System.Collections.Generic; -using System.Linq; -using Object = UnityEngine.Object; - -namespace RainbowTags; - -public class MainClass : Plugin -{ - public static MainClass Instance { get; set; } - public override string Creator => "NotIntense : (Ported From Build & xNexus-ACS)"; - public override string Name => "RainbowTags"; - public override Version Version { get; } = new(1, 0, 2); - public override Version NebuliVersion { get; } = new(0, 0, 0); - public override bool SkipVersionCheck { get; } = true; - - public static List PlayersWithoutRTags { get; } = new(); - - public override void OnEnabled() - { - Instance = this; - PlayerHandlers.UserChangingUserGroup += OnChangingGroup; - base.OnEnabled(); - } - - public override void OnDisabled() - { - PlayerHandlers.UserChangingUserGroup -= OnChangingGroup; - base.OnDisabled(); - Instance = null; - } - - private bool TryGetColors(string rank, out string[] availableColors) - { - availableColors = Config.Sequences; - return !string.IsNullOrEmpty(rank) && Config.RanksWithRTags.Contains(rank); - } - - private bool TryGetCustomColors(string rank, out string[] availableColors) - { - if (Config.GroupSequences[rank] == null) - { - availableColors = null; - return false; - } - availableColors = Config.GroupSequences[rank].ToArray(); - return !string.IsNullOrEmpty(rank) && Config.RanksWithRTags.Contains(rank); - } - private bool EqualsTo(UserGroup thisGroup, UserGroup otherGroup) - { - return thisGroup.BadgeColor == otherGroup.BadgeColor && thisGroup.BadgeText == otherGroup.BadgeText && - thisGroup.Permissions == otherGroup.Permissions && thisGroup.Cover == otherGroup.Cover && - thisGroup.HiddenByDefault == otherGroup.HiddenByDefault && thisGroup.Shared == otherGroup.Shared && - thisGroup.KickPower == otherGroup.KickPower && - thisGroup.RequiredKickPower == otherGroup.RequiredKickPower; - } - private string GetGroupKey(UserGroup group) - { - if (group == null) - return string.Empty; - - return ServerStatic.PermissionsHandler._groups.FirstOrDefault(g => EqualsTo(g.Value, group)).Key ?? - string.Empty; - } - private void OnChangingGroup(PlayerChangingUserGroupEvent ev) - { - if (ev.Player == null || ev.Group == null) return; - - if (Config.GroupSpecificSequences) - { - if (!PlayersWithoutRTags.Contains(ev.Player) && ev.Group != null && ev.Player.Group == null && TryGetCustomColors(GetGroupKey(ev.Group), out var colors)) - { - Log.Debug("RainbowTags: Added to " + ev.Player.Nickname); - var rtController = ev.Player.GameObject.AddComponent(); - rtController.Colors = colors; - rtController.Interval = Config.ColorInterval; - return; - } - if (TryGetColors(GetGroupKey(ev.Group), out colors)) - { - ev.Player.GameObject.GetComponent().Colors = colors; - return; - } - Object.Destroy(ev.Player.GameObject.GetComponent()); - } - else - { - if (!PlayersWithoutRTags.Contains(ev.Player) && ev.Group != null && ev.Player.Group == null && TryGetColors(GetGroupKey(ev.Group), out var colors)) - { - Log.Debug("RainbowTags: Added to " + ev.Player.Nickname); - var rtController = ev.Player.GameObject.AddComponent(); - rtController.Colors = colors; - rtController.Interval = Config.ColorInterval; - return; - } - if (TryGetColors(GetGroupKey(ev.Group), out colors)) - { - ev.Player.GameObject.GetComponent().Colors = colors; - return; - } - Object.Destroy(ev.Player.GameObject.GetComponent()); - } - } -} \ No newline at end of file diff --git a/RainbowTags - Nebuli/Properties/AssemblyInfo.cs b/RainbowTags - Nebuli/Properties/AssemblyInfo.cs deleted file mode 100644 index fe48956..0000000 --- a/RainbowTags - Nebuli/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,35 +0,0 @@ -using System.Reflection; -using System.Runtime.InteropServices; - -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. -[assembly: AssemblyTitle("RainbowTags")] -[assembly: AssemblyDescription("RainbowTags Plugin for EXILED")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("RainbowTags")] -[assembly: AssemblyCopyright("Copyright © 2023")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from -// COM, set the ComVisible attribute to true on that type. -[assembly: ComVisible(false)] - -// The following GUID is for the ID of the typelib if this project is exposed to COM -[assembly: Guid("638EE7D1-ED8F-4565-8C08-14165D93E041")] - -// Version information for an assembly consists of the following four values: -// -// Major Version -// Minor Version -// Build Number -// Revision -// -// You can specify all the values or you can default the Build and Revision Numbers -// by using the '*' as shown below: -// [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("4.1.0.0")] -[assembly: AssemblyFileVersion("4.1.0.0")] \ No newline at end of file diff --git a/RainbowTags - Nebuli/RainbowTags - Nebuli.csproj b/RainbowTags - Nebuli/RainbowTags - Nebuli.csproj deleted file mode 100644 index 2641149..0000000 --- a/RainbowTags - Nebuli/RainbowTags - Nebuli.csproj +++ /dev/null @@ -1,87 +0,0 @@ - - - - - Debug - AnyCPU - {0374FCB4-D3D8-4169-B79B-9933A65F8A1F} - Library - Properties - RainbowTags - RainbowTags - v4.8 - 512 - 10 - - - AnyCPU - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - true - - - AnyCPU - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - - - - B:\SteamLibrary\steamapps\common\SCP Secret Laboratory Dedicated Server\SCPSL_Data\Managed\Assembly-CSharp-firstpass.dll - - - False - B:\SteamLibrary\steamapps\common\SCP Secret Laboratory Dedicated Server\SCPSL_Data\Managed\Assembly-CSharp-Publicized.dll - - - False - B:\SteamLibrary\steamapps\common\SCP Secret Laboratory Dedicated Server\SCPSL_Data\Managed\CommandSystem.Core.dll - - - B:\SteamLibrary\steamapps\common\SCP Secret Laboratory Dedicated Server\SCPSL_Data\Managed\Mirror.dll - - - - - - - B:\SteamLibrary\steamapps\common\SCP Secret Laboratory Dedicated Server\SCPSL_Data\Managed\UnityEngine.dll - - - B:\SteamLibrary\steamapps\common\SCP Secret Laboratory Dedicated Server\SCPSL_Data\Managed\UnityEngine.CoreModule.dll - - - B:\SteamLibrary\steamapps\common\SCP Secret Laboratory Dedicated Server\SCPSL_Data\Managed\UnityEngine.PhysicsModule.dll - - - - - - - - - - - - - 1.3.4 - - - - - - \ No newline at end of file diff --git a/RainbowTags - Nebuli/TagController.cs b/RainbowTags - Nebuli/TagController.cs deleted file mode 100644 index 3589426..0000000 --- a/RainbowTags - Nebuli/TagController.cs +++ /dev/null @@ -1,80 +0,0 @@ -using System; -using System.Collections.Generic; -using MEC; -using Nebuli.API.Features.Player; -using UnityEngine; - -namespace RainbowTags; - -public class TagController : MonoBehaviour -{ - private NebuliPlayer _player; - private int _position; - private float _interval; - private int _intervalInFrames; - private string[] _colors; - private CoroutineHandle _coroutineHandle; - - public string[] Colors - { - get => _colors ?? Array.Empty(); - set - { - _colors = value ?? Array.Empty(); - _position = 0; - } - } - public float Interval - { - get => _interval; - set - { - _interval = value; - _intervalInFrames = Mathf.CeilToInt(value) * 50; - } - } - private void Awake() - { - _player = NebuliPlayer.Get(gameObject); - } - private void Start() - { - _coroutineHandle = Timing.RunCoroutine(UpdateColor().CancelWith(_player.GameObject)); - } - private void OnDestroy() - { - Timing.KillCoroutines(_coroutineHandle); - } - private string RollNext() - { - var num = _position + 1; - _position = num; - - if (num >= _colors.Length) - _position = 0; - - if (_colors.Length == 0) - return string.Empty; - - return _colors[_position]; - } - private IEnumerator UpdateColor() - { - for (; ; ) - { - int num; - for (var z = 0; z < _intervalInFrames; z = num + 1) - { - yield return 0f; - num = z; - } - var text = RollNext(); - if (string.IsNullOrEmpty(text)) - { - break; - } - _player.RankColor = text; - } - Destroy(this); - } -} \ No newline at end of file