diff --git a/src/Application/Common/Resources/Messages.Designer.cs b/src/Application/Common/Resources/Messages.Designer.cs
index 3e29882d..1fc3b213 100644
--- a/src/Application/Common/Resources/Messages.Designer.cs
+++ b/src/Application/Common/Resources/Messages.Designer.cs
@@ -177,6 +177,24 @@ internal static string GameModeDescription {
}
}
+ ///
+ /// Looks up a localized string similar to {PlayerName} has generously given {Points} points to all the players!.
+ ///
+ internal static string GivePointsToAllPlayers {
+ get {
+ return ResourceManager.GetString("GivePointsToAllPlayers", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to You have given {Points} points to {PlayerName}.
+ ///
+ internal static string GivePointsToPlayer {
+ get {
+ return ResourceManager.GetString("GivePointsToPlayer", resourceCulture);
+ }
+ }
+
///
/// Looks up a localized string similar to You do not have enough points to obtain this combo.
///
@@ -555,6 +573,15 @@ internal static string RankUpAward {
}
}
+ ///
+ /// Looks up a localized string similar to Congratulations! You've received {Points} points from {PlayerName}!.
+ ///
+ internal static string ReceivePointsFromPlayer {
+ get {
+ return ResourceManager.GetString("ReceivePointsFromPlayer", resourceCulture);
+ }
+ }
+
///
/// Looks up a localized string similar to {PlayerName} redeemed their points for the combo: {ComboName}.
///
diff --git a/src/Application/Common/Resources/Messages.resx b/src/Application/Common/Resources/Messages.resx
index 6540e2de..630a5088 100644
--- a/src/Application/Common/Resources/Messages.resx
+++ b/src/Application/Common/Resources/Messages.resx
@@ -156,6 +156,12 @@
~r~Welcome to Capture The Flag mode~n~~y~It is a game mode in which two teams (Alpha and Beta) compete to capture the other team's flag and bring it back to their own base to score a point
+
+ {PlayerName} has generously given {Points} points to all the players!
+
+
+ You have given {Points} points to {PlayerName}
+
You do not have enough points to obtain this combo
@@ -282,6 +288,9 @@
You have gained +100 points, +100 armour, and +100 health
+
+ Congratulations! You've received {Points} points from {PlayerName}!
+
{PlayerName} redeemed their points for the combo: {ComboName}
diff --git a/src/Application/Players/Accounts/Systems/ChangeRoleSystem.cs b/src/Application/Players/Accounts/Systems/ChangeRoleSystem.cs
index 8501d04f..4ec76a66 100644
--- a/src/Application/Players/Accounts/Systems/ChangeRoleSystem.cs
+++ b/src/Application/Players/Accounts/Systems/ChangeRoleSystem.cs
@@ -11,13 +11,13 @@ public void SetRole(
if (currentPlayer.HasLowerRoleThan(RoleId.Admin))
return;
- if(currentPlayer == targetPlayer)
+ if (currentPlayer == targetPlayer)
{
currentPlayer.SendClientMessage(Color.Red, Messages.PlayerIsEqualsToTargetPlayer);
return;
}
- if(targetPlayer.IsUnauthenticated())
+ if (targetPlayer.IsUnauthenticated())
{
currentPlayer.SendClientMessage(Color.Red, Messages.UnauthenticatedPlayer);
return;
diff --git a/src/Application/Players/Accounts/Systems/PlayerPointsSystem.cs b/src/Application/Players/Accounts/Systems/PlayerPointsSystem.cs
new file mode 100644
index 00000000..0d3aa0d4
--- /dev/null
+++ b/src/Application/Players/Accounts/Systems/PlayerPointsSystem.cs
@@ -0,0 +1,70 @@
+namespace CTF.Application.Players.Accounts.Systems;
+
+public class PlayerPointsSystem(
+ IEntityManager entityManager,
+ IWorldService worldService,
+ PlayerStatsRenderer playerStatsRenderer) : ISystem
+{
+ [PlayerCommand("givepoints")]
+ public void GivePointsToPlayer(
+ Player currentPlayer,
+ [CommandParameter(Name = "playerId")]Player targetPlayer,
+ int points)
+ {
+ if (currentPlayer.HasLowerRoleThan(RoleId.Admin))
+ return;
+
+ PlayerInfo targetPlayerInfo = targetPlayer.GetInfo();
+ Result result = targetPlayerInfo.StatsPerRound.AddPoints(points);
+ if (result.IsFailed)
+ {
+ currentPlayer.SendClientMessage(Color.Red, result.Message);
+ return;
+ }
+
+ {
+ var message = Smart.Format(Messages.GivePointsToPlayer, new
+ {
+ Points = points,
+ PlayerName = targetPlayer.Name
+ });
+ currentPlayer.SendClientMessage(Color.Yellow, message);
+ }
+ {
+ var message = Smart.Format(Messages.ReceivePointsFromPlayer, new
+ {
+ Points = points,
+ PlayerName = currentPlayer.Name
+ });
+ targetPlayer.SendClientMessage(Color.Yellow, message);
+ }
+ playerStatsRenderer.UpdateTextDraw(targetPlayer);
+ }
+
+ [PlayerCommand("giveallpoints")]
+ public void GivePointsToAllPlayers(Player currentPlayer, int points)
+ {
+ if (currentPlayer.HasLowerRoleThan(RoleId.Admin))
+ return;
+
+ IEnumerable players = entityManager.GetComponents();
+ foreach(Player targetPlayer in players)
+ {
+ PlayerInfo targetPlayerInfo = targetPlayer.GetInfo();
+ Result result = targetPlayerInfo.StatsPerRound.AddPoints(points);
+ if (result.IsFailed)
+ {
+ currentPlayer.SendClientMessage(Color.Red, result.Message);
+ return;
+ }
+ playerStatsRenderer.UpdateTextDraw(targetPlayer);
+ }
+
+ var message = Smart.Format(Messages.GivePointsToAllPlayers, new
+ {
+ PlayerName = currentPlayer.Name,
+ Points = points
+ });
+ worldService.SendClientMessage(Color.Yellow, message);
+ }
+}