Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
81 changes: 20 additions & 61 deletions Source Code/EventHandlers.cs
Original file line number Diff line number Diff line change
@@ -1,21 +1,8 @@
using System.Collections.Generic;
using System.ComponentModel;
using System.Globalization;
using Discord;
using Exiled.API.Enums;
using Exiled.API.Extensions;
using Exiled.API.Features;
using Exiled.API.Features.Roles;
using Exiled.Events.EventArgs.Player;
using Exiled.Events.EventArgs.Server;
using MEC;
using PlayerRoles;
using PlayerRoles.FirstPersonControl;
using PluginAPI.Core;
using PluginAPI.Roles;
using RemoteAdmin.Communication;
using YamlDotNet.Core;
using static Exiled.API.Enums.GeneratorState;
using Player = Exiled.API.Features.Player;
using Round = Exiled.API.Features.Round;
using Server = Exiled.API.Features.Server;
Expand All @@ -37,65 +24,37 @@ public void roundended(RoundEndedEventArgs ev)

public IEnumerator<float> cor()
{
for (;;)
while (true)
{
{
Dictionary<RoleTypeId, string> roleColorDict = new Dictionary<RoleTypeId, string>()
{
{RoleTypeId.ClassD, "FF8E00"},
{RoleTypeId.Scientist,"FFFF7C"},
{RoleTypeId.FacilityGuard, "5B6370"},
{RoleTypeId.NtfCaptain, "003ECA"},
{RoleTypeId.NtfSergeant, "0096FF"},
{RoleTypeId.NtfSpecialist, "0096FF"},
{RoleTypeId.NtfPrivate, "6FC3FF"},
{RoleTypeId.ChaosRepressor, "006728"},
{RoleTypeId.ChaosMarauder, "006728"},
{RoleTypeId.ChaosRifleman, "006728"},
{ RoleTypeId.ChaosConscript, "006728"}
};
string HintMessage = Plugin.Instance.Config.Hint.Replace("%tps%", Server.Tps.ToString())
.Replace("{MinPlayers}", Server.PlayerCount.ToString())
.Replace("{MaxPlayers}", Server.MaxPlayerCount.ToString())
.Replace("{Minutes}", Round.ElapsedTime.Minutes.ToString())
.Replace("{Seconds}", Round.ElapsedTime.Seconds.ToString()).Replace("%NameServer%", Server.Name)
.Replace("{Seconds}", Round.ElapsedTime.Seconds.ToString())
.Replace("%NameServer%", Server.Name)
.Replace("{FF}", Server.FriendlyFire.ToString())
.Replace("{ServerName}", Server.Name)
.Replace("{SCPs}", Round.SurvivingSCPs.ToString())
.Replace("{UserRole}", RoleTranslations.RoleNamesFile);

foreach (Player player in Player.List)
{
if (player.Role.Type == RoleTypeId.ClassD)
{
player.ShowHint($"<b><size=15> <color=#FF8E00>{HintMessage}</color></size></align>", 50);
}
if (player.Role.Type == RoleTypeId.Scientist)
{
player.ShowHint($"<b><size=15> <color=#FFFF7C>{HintMessage}</color></size></align>", 50);
}
if (player.Role.Type == RoleTypeId.FacilityGuard)
{
player.ShowHint($"<b><size=15> <color=#5B6370>{HintMessage}</color></size></align>", 50);
}
if (player.Role.Type == RoleTypeId.NtfCaptain)
{
player.ShowHint($"<b><size=15> <color=#003ECA>{HintMessage}</color></size></align>", 50);
}
if (player.Role.Type == RoleTypeId.NtfSergeant)
{
player.ShowHint($"<b><size=15> <color=#0096FF>{HintMessage}</color></size></align>", 50);
}
if (player.Role.Type == RoleTypeId.NtfSpecialist)
{
player.ShowHint($"<b><size=15> <color=#0096FF>{HintMessage}</color></size></align>", 50);
}
if (player.Role.Type == RoleTypeId.NtfPrivate)
{
player.ShowHint($"<b><size=15> <color=#6FC3FF>{HintMessage}</color></size></align>", 50);
}
if (player.Role.Type == RoleTypeId.ChaosRepressor)
{
player.ShowHint($"<b><size=15> <color=#006728>{HintMessage}</color></size></align>", 50);
}
if (player.Role.Type == RoleTypeId.ChaosMarauder)
{
player.ShowHint($"<b><size=15> <color=#006728>{HintMessage}</color></size></align>", 50);
}
if (player.Role.Type == RoleTypeId.ChaosRifleman)
{
player.ShowHint($"<b><size=15> <color=#006728>{HintMessage}</color></size></align>", 50);
}
if (player.Role.Type == RoleTypeId.ChaosConscript)
{
player.ShowHint($"<b><size=15> <color=#006728>{HintMessage}</color></size></align>", 50);
}
foreach (Player player in Player.List) {
player.ShowHint($"<b><size=15> <color=#{roleColorDict[player.Role.Type]}>{HintMessage}</color></size></align>",
50);
}
}
yield return Timing.WaitForSeconds(1f);
Expand Down