Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

css_fire #74

Closed
wants to merge 20 commits into from
Closed
Show file tree
Hide file tree
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
7 changes: 3 additions & 4 deletions lang/Jailbreak.English/Generic/GenericCommandNotifications.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using CounterStrikeSharp.API.Modules.Utils;

using Jailbreak.Formatting.Base;
using Jailbreak.Formatting.Core;
using Jailbreak.Formatting.Logistics;
Expand All @@ -10,7 +9,7 @@ namespace Jailbreak.English.Generic;

public class GenericCommandNotifications : IGenericCommandNotifications, ILanguage<Formatting.Languages.English>
{
public static FormatObject PREFIX =
public static readonly FormatObject GENERIC_PREFIX =
new HiddenFormatObject($" {ChatColors.Darkred}[{ChatColors.LightRed}JB{ChatColors.Darkred}]")
{
// Hide in panorama and center text
Expand All @@ -21,11 +20,11 @@ public class GenericCommandNotifications : IGenericCommandNotifications, ILangua

public IView PlayerNotFound(string query)
{
return new SimpleView { PREFIX, $"Player '{query}' not found!" };
return new SimpleView { GENERIC_PREFIX, $"Player '{query}' not found!" };
}

public IView PlayerFoundMultiple(string query)
{
return new SimpleView { PREFIX, $"Multiple players found for '{query}'!" };
return new SimpleView { GENERIC_PREFIX, $"Multiple players found for '{query}'!" };
}
}
4 changes: 2 additions & 2 deletions lang/Jailbreak.English/Rebel/RebelNotifications.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ namespace Jailbreak.English.Rebel;

public class RebelNotifications : IRebelNotifications, ILanguage<Formatting.Languages.English>
{
public static FormatObject PREFIX = new HiddenFormatObject($" {ChatColors.Darkred}[{ChatColors.LightRed}Rebel{ChatColors.Darkred}]")
public static readonly FormatObject REBEL_PREFIX = new HiddenFormatObject($" {ChatColors.Darkred}[{ChatColors.LightRed}Rebel{ChatColors.Darkred}]")
{
// Hide in panorama and center text
Plain = false,
Expand All @@ -19,5 +19,5 @@ public class RebelNotifications : IRebelNotifications, ILanguage<Formatting.Lang
};

public IView NO_LONGER_REBEL =>
new SimpleView() { PREFIX, "You are no longer a rebel." };
new SimpleView() { REBEL_PREFIX, "You are no longer a rebel." };
}
24 changes: 12 additions & 12 deletions lang/Jailbreak.English/Teams/RatioNotifications.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ namespace Jailbreak.English.Teams;

public class RatioNotifications : IRatioNotifications, ILanguage<Formatting.Languages.English>
{
public static FormatObject PREFIX = new HiddenFormatObject($" {ChatColors.LightRed}[{ChatColors.Red}JB{ChatColors.LightRed}]")
public static readonly FormatObject RATIO_PREFIX = new HiddenFormatObject($" {ChatColors.LightRed}[{ChatColors.Red}JB{ChatColors.LightRed}]")
{
// Hide in panorama and center text
Plain = false,
Expand All @@ -19,34 +19,34 @@ public class RatioNotifications : IRatioNotifications, ILanguage<Formatting.Lang
};

public IView NOT_ENOUGH_GUARDS =>
new SimpleView { PREFIX, "There's not enough guards in the queue!" };
new SimpleView { RATIO_PREFIX, "There's not enough guards in the queue!" };

public IView PLEASE_JOIN_GUARD_QUEUE =>
new SimpleView { PREFIX, "Type !guard to become a guard!" };
new SimpleView { RATIO_PREFIX, "Type !guard to become a guard!" };

public IView JOINED_GUARD_QUEUE =>
new SimpleView { PREFIX, "You've joined the guard queue!" };
new SimpleView { RATIO_PREFIX, "You've joined the guard queue!" };

public IView ALREADY_A_GUARD =>
new SimpleView { PREFIX, "You're already a guard!" };
new SimpleView { RATIO_PREFIX, "You're already a guard!" };

public IView YOU_WERE_AUTOBALANCED_PRISONER =>
new SimpleView
{
{ PREFIX, "You were autobalanced to the prisoner team!" }, SimpleView.NEWLINE,
{ PREFIX, "Please use !guard to join the guard team." }
{ RATIO_PREFIX, "You were autobalanced to the prisoner team!" }, SimpleView.NEWLINE,
{ RATIO_PREFIX, "Please use !guard to join the guard team." }
};

public IView ATTEMPT_TO_JOIN_FROM_TEAM_MENU =>
new SimpleView { PREFIX, "You were swapped back to the prisoner team!" };

new SimpleView { RATIO_PREFIX, "You were swapped back to the prisoner team!" };
public IView LEFT_GUARD =>
new SimpleView
{
{ PREFIX, "You are no longer a guard." }, SimpleView.NEWLINE,
{ PREFIX, "Please use !guard if you want to re-join the guard team." }
{ RATIO_PREFIX, "You are no longer a guard." }, SimpleView.NEWLINE,
{ RATIO_PREFIX, "Please use !guard if you want to re-join the guard team." }
};

public IView YOU_WERE_AUTOBALANCED_GUARD =>
new SimpleView { PREFIX, "You are now a guard!" };
new SimpleView { RATIO_PREFIX, "You are now a guard!" };
}
13 changes: 13 additions & 0 deletions lang/Jailbreak.English/Warden/WardenFireNotifications.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
using CounterStrikeSharp.API.Modules.Utils;
using Jailbreak.Formatting.Base;
using Jailbreak.Formatting.Logistics;
using Jailbreak.Formatting.Views;
using static Jailbreak.English.Warden.WardenNotifications;

namespace Jailbreak.English.Warden;

public class WardenFireNotifications : IWardenFireNotifications, ILanguage<Formatting.Languages.English>
{
public IView WARDEN_FIRED =>
new SimpleView { WARDEN_PREFIX, $"The current warden has been {ChatColors.Red}fired{ChatColors.White} by an admin." };
}
27 changes: 13 additions & 14 deletions lang/Jailbreak.English/Warden/WardenNotifications.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
using CounterStrikeSharp.API.Core;
using CounterStrikeSharp.API.Modules.Utils;

using Jailbreak.Formatting.Base;
using Jailbreak.Formatting.Core;
using Jailbreak.Formatting.Logistics;
Expand All @@ -11,7 +10,7 @@ namespace Jailbreak.English.Warden;

public class WardenNotifications : IWardenNotifications, ILanguage<Formatting.Languages.English>
{
public static FormatObject PREFIX = new HiddenFormatObject($" {ChatColors.Lime}[{ChatColors.Green}WARDEN{ChatColors.Lime}]")
public static readonly FormatObject WARDEN_PREFIX = new HiddenFormatObject($" {ChatColors.Lime}[{ChatColors.Green}WARDEN{ChatColors.Lime}]")
{
// Hide in panorama and center text
Plain = false,
Expand All @@ -22,43 +21,43 @@ public class WardenNotifications : IWardenNotifications, ILanguage<Formatting.La
public IView PICKING_SHORTLY =>
new SimpleView
{
{ PREFIX, "Picking a warden shortly" }, SimpleView.NEWLINE,
{ PREFIX, "To enter the warden queue, type !warden in chat." }
{ WARDEN_PREFIX, "Picking a warden shortly" }, SimpleView.NEWLINE,
{ WARDEN_PREFIX, "To enter the warden queue, type !warden in chat." }
};

public IView NO_WARDENS =>
new SimpleView { PREFIX, "No wardens in queue! The next player to run !warden will become a warden." };
new SimpleView { WARDEN_PREFIX, "No wardens in queue! The next player to run !warden will become a warden." };

public IView WARDEN_LEFT =>
new SimpleView { PREFIX, "The warden has left the game!" };
new SimpleView { WARDEN_PREFIX, "The warden has left the game!" };

public IView WARDEN_DIED =>
new SimpleView { PREFIX, "The warden has died!" };
new SimpleView { WARDEN_PREFIX, "The warden has died!" };

public IView BECOME_NEXT_WARDEN =>
new SimpleView { PREFIX, "Type !warden to become the next warden" };
new SimpleView { WARDEN_PREFIX, "Type !warden to become the next warden" };

public IView JOIN_RAFFLE =>
new SimpleView { PREFIX, "You've joined the warden raffle!" };
new SimpleView { WARDEN_PREFIX, "You've joined the warden raffle!" };

public IView LEAVE_RAFFLE =>
new SimpleView { PREFIX, "You've left the warden raffle!" };
new SimpleView { WARDEN_PREFIX, "You've left the warden raffle!" };

public IView PASS_WARDEN(CCSPlayerController player)
{
return new SimpleView { PREFIX, player, "has resigned from being warden!" };
return new SimpleView { WARDEN_PREFIX, player, "has resigned from being warden!" };
}

public IView NEW_WARDEN(CCSPlayerController player)
{
return new SimpleView { PREFIX, player, "is now the warden!" };
return new SimpleView { WARDEN_PREFIX, player, "is now the warden!" };
}

public IView CURRENT_WARDEN(CCSPlayerController? player)
{
if (player is not null)
return new SimpleView { PREFIX, "The current warden is", player };
return new SimpleView { WARDEN_PREFIX, "The current warden is", player };
else
return new SimpleView { PREFIX, "There is currently no warden!" };
return new SimpleView { WARDEN_PREFIX, "There is currently no warden!" };
}
}
46 changes: 46 additions & 0 deletions lang/Jailbreak.English/Warden/WardenPeaceNotifications.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
using Jailbreak.Formatting.Base;
using Jailbreak.Formatting.Logistics;
using Jailbreak.Formatting.Views;
using static Jailbreak.English.Warden.WardenNotifications;
using static Jailbreak.English.Generic.GenericCommandNotifications;

namespace Jailbreak.English.Warden;

// todo add player name in notification and style it with colour
public class WardenPeaceNotifications : IWardenPeaceNotifications, ILanguage<Formatting.Languages.English>
{

public IView PLAYERS_MUTED_VIACMD =>
new SimpleView { WARDEN_PREFIX, "Prisoners and Guards are silenced for 10 seconds." };

public IView PLAYERS_UNMUTED_VIACMD =>
new SimpleView { WARDEN_PREFIX, "Prisoners and Guards can speak again."};

public IView PRISONERS_MUTED_STARTROUND =>
new SimpleView { GENERIC_PREFIX, "Prisoners are muted for 45 seconds."};

public IView PRISONERS_UNMUTED_STARTROUND =>
new SimpleView { GENERIC_PREFIX, "Prisoners can speak again." };

public IView PLAYERS_MUTED_FIRSTWARDEN =>
new SimpleView { GENERIC_PREFIX, "Prisoners and Guards are automatically silenced for 10 seconds."};

public IView PLAYERS_UNMUTED_FIRSTWARDEN =>
new SimpleView { GENERIC_PREFIX, "Prisoners and Guards can speak again." };

public IView PLAYERS_WARDEN_DIED =>
new SimpleView { GENERIC_PREFIX, "Warden is dead. Players can speak again." };

public IView PLAYERS_UNMUTED_ADMINCMD =>
new SimpleView { GENERIC_PREFIX, "An admin has removed the warden mute." };

public IView PLAYERS_UNMUTED_ROUNDEND =>
new SimpleView { GENERIC_PREFIX, "All players unmuted due to round end." };

public IView CSS_PEACE_COOLDOWN(float cooldownTime)
{
return new SimpleView { GENERIC_PREFIX, $"You\'re on cooldown for {Math.Ceiling(cooldownTime)} second{((Math.Ceiling(cooldownTime) == 1) ? "." : "s." )}" };
}


}
5 changes: 2 additions & 3 deletions mod/Jailbreak.Rebel/RebelManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,13 @@
using Jailbreak.Formatting.Views;
using Jailbreak.Public.Behaviors;
using Jailbreak.Public.Extensions;
using Jailbreak.Public.Mod.Logs;
using Jailbreak.Public.Mod.Rebel;

namespace Jailbreak.Rebel;

public class RebelManager : IPluginBehavior, IRebelService
{
private IRebelNotifications notifs;
//private IRebelNotifications notifs;
private readonly IRichLogService _logs;
private readonly IRebelNotifications _notifs;
private readonly Dictionary<CCSPlayerController, long> _rebelTimes = new();
Expand Down Expand Up @@ -121,7 +120,7 @@ public bool MarkRebel(CCSPlayerController player, long time = 120)

public void UnmarkRebel(CCSPlayerController player)
{
notifs.NO_LONGER_REBEL.ToPlayerChat(player);
_notifs.NO_LONGER_REBEL.ToPlayerChat(player);
_logs.Append(_logs.Player(player), "is no longer a rebel.");

_rebelTimes.Remove(player);
Expand Down
39 changes: 36 additions & 3 deletions mod/Jailbreak.Teams/Queue/QueueBehavior.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using CounterStrikeSharp.API;
using CounterStrikeSharp.API.Core;
using CounterStrikeSharp.API.Core.Attributes.Registration;
using CounterStrikeSharp.API.Modules.Admin;
using CounterStrikeSharp.API.Modules.Commands;
using CounterStrikeSharp.API.Modules.Utils;
using Jailbreak.Formatting.Extensions;
Expand All @@ -20,9 +21,9 @@

private readonly IRatioNotifications _notifications;
private readonly IPlayerState<QueueState> _state;

private BasePlugin _parent;

public QueueBehavior(IPlayerStateFactory factory, IRatioNotifications notifications, ILogger<QueueBehavior> logger)

Check warning on line 26 in mod/Jailbreak.Teams/Queue/QueueBehavior.cs

View workflow job for this annotation

GitHub Actions / build

Non-nullable field '_parent' must contain a non-null value when exiting constructor. Consider declaring the field as nullable.

Check warning on line 26 in mod/Jailbreak.Teams/Queue/QueueBehavior.cs

View workflow job for this annotation

GitHub Actions / build

Non-nullable field '_parent' must contain a non-null value when exiting constructor. Consider declaring the field as nullable.
{
_logger = logger;
_notifications = notifications;
Expand Down Expand Up @@ -60,7 +61,7 @@

public bool TryPop(int count)
{
var queue = Queue.Where(p=>p.IsReal()).ToList();
var queue = Queue.Where(p => p.IsReal()).ToList();

if (queue.Count <= count)
{
Expand Down Expand Up @@ -136,6 +137,7 @@

public void Start(BasePlugin parent)
{
_parent = parent;
// Listen for the player requesting to join a team.
// Thanks, destoer!
parent.AddCommandListener("jointeam", OnRequestToJoinTeam);
Expand All @@ -158,11 +160,28 @@
if (command.ArgCount < 2)
return HookResult.Stop;

if (!state.IsGuard)
_parent.AddTimer(0.1f, () =>
{
if (!invoked.IsReal())
return;
if (invoked.GetTeam() != CsTeam.CounterTerrorist)
return;
_notifications.ATTEMPT_TO_JOIN_FROM_TEAM_MENU
.ToPlayerChat(invoked)
.ToPlayerCenter(invoked);
invoked.ChangeTeam(CsTeam.Terrorist);
});
if (!int.TryParse(command.ArgByIndex(1), out var team))
return HookResult.Stop;

if (Utilities.GetPlayers().Find(c => c.GetTeam() == CsTeam.CounterTerrorist) == null)
return HookResult.Continue; // If no CTs, let anyone on CT team

// Force player to prisoner if they attempt to join prisoners
// Allows for uncapped prisoners regardless of mapos
if((CsTeam)team == CsTeam.Terrorist)
invoked.ChangeTeam(CsTeam.Terrorist);

// Player is attempting to join CT and is not a guard?
// If so, stop them!!
Expand Down Expand Up @@ -255,6 +274,20 @@
{
if (player == null)
return;
if (player.AuthorizedSteamID == null)
{
player.PrintToCenter("Steam has not yet authorized you. Please try again later.");
return;
}

// AdminData? data = AdminManager.GetPlayerAdminData(player.AuthorizedSteamID!);

// if (data == null || !data.Groups.Contains("#ego/e"))
// {
// player.PrintToCenter("You must be an =(e)= to join the guard queue. Apply at https://edgm.rs/join");
// return;
// }

HandleQueueRequest(player);
}

Expand All @@ -266,4 +299,4 @@
return;
HandleLeaveRequest(player);
}
}
}
1 change: 0 additions & 1 deletion mod/Jailbreak.Warden/Commands/WardenCommandsBehavior.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
using CounterStrikeSharp.API.Core;
using CounterStrikeSharp.API.Core.Attributes.Registration;
using CounterStrikeSharp.API.Modules.Commands;
using CounterStrikeSharp.API.Modules.Memory;
using CounterStrikeSharp.API.Modules.Utils;
using Jailbreak.Formatting.Extensions;
using Jailbreak.Formatting.Views;
Expand Down
Loading
Loading