Skip to content

Commit cc99bc7

Browse files
authored
Merge pull request #287 from MrDave1999/dev
9.5.0 Release
2 parents 85c80a7 + 1c6bd3d commit cc99bc7

30 files changed

+478
-30
lines changed

.github/workflows/ci.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ jobs:
2020
with:
2121
dotnet-version: ${{ env.DOTNET_VERSION }}
2222
- name: Execute unit tests
23-
run: dotnet test ./tests/Application.Tests/CTF.Application.Tests.csproj -c Release
23+
run: dotnet test ./tests/Application.Tests/CTF.Application.Tests.csproj -c Release --framework=net8.0
2424

2525
integration_testing:
2626
runs-on: ubuntu-latest
@@ -55,4 +55,4 @@ jobs:
5555
- name: Create .env.test file
5656
run: cp ./tests/Persistence.Tests/.env.test.example ./tests/Persistence.Tests/.env.test
5757
- name: Execute integration tests
58-
run: dotnet test ./tests/Persistence.Tests/Persistence.Tests.csproj -c Release
58+
run: dotnet test ./tests/Persistence.Tests/Persistence.Tests.csproj -c Release --framework=net8.0

src/Application/Common/Resources/Messages.Designer.cs

Lines changed: 108 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/Application/Common/Resources/Messages.resx

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,9 @@
162162
<data name="ChatDisabled" xml:space="preserve">
163163
<value>Chat is currently disabled while you select your class. Please finish your selection before chatting!</value>
164164
</data>
165+
<data name="ComboUsage" xml:space="preserve">
166+
<value>Use /combos or NUM 4 key</value>
167+
</data>
165168
<data name="CommandLockClassSelection" xml:space="preserve">
166169
<value>You cannot execute commands in the class selection</value>
167170
</data>
@@ -180,9 +183,15 @@
180183
<data name="DemotedToRole" xml:space="preserve">
181184
<value>Demoted to {RoleName} role</value>
182185
</data>
186+
<data name="DisableRocketLauncher" xml:space="preserve">
187+
<value>{PlayerName} has disabled the Rocket Launcher(RPG)</value>
188+
</data>
183189
<data name="EmptyWeaponPackage" xml:space="preserve">
184190
<value>You have no items in your weapon package</value>
185191
</data>
192+
<data name="EnableRocketLauncher" xml:space="preserve">
193+
<value>{PlayerName} has enabled the Rocket Launcher(RPG). Use /combos or NUM 4 key</value>
194+
</data>
186195
<data name="ExitSpectatorMode" xml:space="preserve">
187196
<value>To exit spectator mode use the command /class</value>
188197
</data>
@@ -195,6 +204,9 @@
195204
<data name="GameModeDescription" xml:space="preserve">
196205
<value>~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</value>
197206
</data>
207+
<data name="GiveJetpackToPlayers" xml:space="preserve">
208+
<value>{PlayerName} has given all players a jetpack</value>
209+
</data>
198210
<data name="GiveMeCoins" xml:space="preserve">
199211
<value>You have obtained 100 coins!</value>
200212
</data>
@@ -204,12 +216,18 @@
204216
<data name="HeadshotToPlayer" xml:space="preserve">
205217
<value>{PlayerName1} landed a headshot with a sniper at {PlayerName2}</value>
206218
</data>
219+
<data name="HideFlagCarriersOnRadarMap" xml:space="preserve">
220+
<value>{PlayerName} decided that the flag carriers will be hidden on the radar map</value>
221+
</data>
207222
<data name="InsufficientCoins" xml:space="preserve">
208223
<value>You do not have enough coins to obtain this combo</value>
209224
</data>
210225
<data name="InvalidAddCoins" xml:space="preserve">
211226
<value>Coins must be between 1 to 100</value>
212227
</data>
228+
<data name="InvalidFlagColor" xml:space="preserve">
229+
<value>Invalid color. Only 'red' and 'blue' are valid options for this command</value>
230+
</data>
213231
<data name="InvalidInterval" xml:space="preserve">
214232
<value>The interval must be between 0 to {Max}</value>
215233
</data>
@@ -363,6 +381,15 @@
363381
<data name="PlayerWithInsufficientHealth" xml:space="preserve">
364382
<value>You don't have enough health</value>
365383
</data>
384+
<data name="PrivateMessagesBlocked" xml:space="preserve">
385+
<value>That player has private messages blocked</value>
386+
</data>
387+
<data name="PrivateMessagesDisabled" xml:space="preserve">
388+
<value>Now players cannot send you a private message</value>
389+
</data>
390+
<data name="PrivateMessagesEnabled" xml:space="preserve">
391+
<value>Now players can send you a private message</value>
392+
</data>
366393
<data name="PromotedToRole" xml:space="preserve">
367394
<value>Promoted to {RoleName} role</value>
368395
</data>
@@ -396,12 +423,18 @@
396423
<data name="ReportToAnotherPlayer" xml:space="preserve">
397424
<value>{CurrentPlayer} reported to {TargetPlayer} [Reason: {Reason}]</value>
398425
</data>
426+
<data name="ResetFlagPosition" xml:space="preserve">
427+
<value>{PlayerName} has reset the {ColorName} flag to its base position</value>
428+
</data>
399429
<data name="ResetPlayerStats" xml:space="preserve">
400430
<value>{PlayerName} has reset their stats, such as score, kills and deaths</value>
401431
</data>
402432
<data name="ResetTeamStats" xml:space="preserve">
403433
<value>{PlayerName} has reset the statistics of both teams (Alpha and Beta)</value>
404434
</data>
435+
<data name="RocketLauncherDisabled" xml:space="preserve">
436+
<value>The rocket launcher is disabled. It must be enabled by the STAFF</value>
437+
</data>
405438
<data name="RoleSuccessfullyChanged" xml:space="preserve">
406439
<value>You have assigned the {RoleName} role to {PlayerName}</value>
407440
</data>
@@ -417,6 +450,9 @@
417450
<data name="SetSpawnToPlayer" xml:space="preserve">
418451
<value>You've spawned {PlayerName} into the game!</value>
419452
</data>
453+
<data name="ShowFlagCarriersOnRadarMap" xml:space="preserve">
454+
<value>{PlayerName} decided that the flag carriers will be shown on the radar map</value>
455+
</data>
420456
<data name="SpawnLocationFailure" xml:space="preserve">
421457
<value>A spawn location can only be obtained for the alpha or beta team</value>
422458
</data>

src/Application/Maps/Services/MapRotationService.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,11 @@ public class MapRotationService(
1818
private bool _isMapLoading;
1919
public bool IsMapLoading() => _isMapLoading;
2020

21+
public delegate void LoadingMapEventHandler();
22+
public delegate void LoadedMapEventHandler();
23+
public event LoadingMapEventHandler LoadingMapEvent;
24+
public event LoadedMapEventHandler LoadedMapEvent;
25+
2126
public void StartRotationTimer()
2227
{
2328
_loadTime ??= new LoadTime(OnLoadingMap, OnLoadedMap);
@@ -49,6 +54,7 @@ private void OnTimer(IServiceProvider serviceProvider)
4954
private void OnLoadingMap()
5055
{
5156
_isMapLoading = true;
57+
LoadingMapEvent?.Invoke();
5258
if (Team.Alpha.IsWinner())
5359
worldService.SendClientMessage(Color.Yellow, Messages.AlphaIsWinner);
5460
else if(Team.Beta.IsWinner())
@@ -84,6 +90,7 @@ private void OnLoadingMap()
8490
private void OnLoadedMap()
8591
{
8692
_isMapLoading = false;
93+
LoadedMapEvent?.Invoke();
8794
TimeLeft.Reset();
8895
CurrentMap currentMap = mapInfoService.Read();
8996
string message = Smart.Format(Messages.MapSuccessfullyLoaded, new { currentMap.Name });
Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
namespace CTF.Application.Players.Chats;
2+
3+
public class PrivateMessageSystem(IEntityManager entityManager) : ISystem
4+
{
5+
[PlayerCommand("pm")]
6+
public void SendMessageToPlayer(
7+
Player sender,
8+
[CommandParameter(Name = "playerId")]Player receiver,
9+
string message)
10+
{
11+
if (sender == receiver)
12+
{
13+
sender.SendClientMessage(Color.Red, Messages.PlayerIsEqualsToTargetPlayer);
14+
return;
15+
}
16+
17+
var privateMessageComponent = receiver.GetComponent<PrivateMessageComponent>();
18+
if (privateMessageComponent.IsBlocked)
19+
{
20+
sender.SendClientMessage(Color.Red, Messages.PrivateMessagesBlocked);
21+
return;
22+
}
23+
24+
int senderId = sender.Entity.Handle;
25+
int receiverId = receiver.Entity.Handle;
26+
sender.SendClientMessage(Color.Yellow, $"PM to {receiver.Name}({receiverId}): {message}");
27+
sender.PlaySound(1058);
28+
receiver.SendClientMessage(Color.Yellow, $"PM from {sender.Name}({senderId}): {message}");
29+
receiver.PlaySound(1058);
30+
31+
// Send private message to the STAFF.
32+
var players = entityManager.GetComponents<Player>();
33+
foreach (Player player in players)
34+
{
35+
PlayerInfo playerInfo = player.GetInfo();
36+
if (playerInfo.HasLowerRoleThan(RoleId.Moderator))
37+
continue;
38+
39+
// This prevents double messaging.
40+
if (player == sender || player == receiver)
41+
continue;
42+
43+
var messageForStaff = $"[PM] {sender.Name} writes to {receiver.Name}: {message}";
44+
player.SendClientMessage(Color.Yellow, messageForStaff);
45+
}
46+
}
47+
48+
[PlayerCommand("blockpm")]
49+
public void Block(Player player)
50+
{
51+
var privateMessageComponent = player.GetComponent<PrivateMessageComponent>();
52+
privateMessageComponent.IsBlocked = true;
53+
player.SendClientMessage(Color.Yellow, Messages.PrivateMessagesDisabled);
54+
player.PlaySound(1139);
55+
}
56+
57+
[PlayerCommand("unblockpm")]
58+
public void Unblock(Player player)
59+
{
60+
var privateMessageComponent = player.GetComponent<PrivateMessageComponent>();
61+
privateMessageComponent.IsBlocked = false;
62+
player.SendClientMessage(Color.Yellow, Messages.PrivateMessagesEnabled);
63+
player.PlaySound(1139);
64+
}
65+
66+
[Event]
67+
public void OnPlayerConnect(Player player)
68+
{
69+
player.AddComponent<PrivateMessageComponent>();
70+
}
71+
72+
private class PrivateMessageComponent : Component
73+
{
74+
public bool IsBlocked { get; set; }
75+
}
76+
}

0 commit comments

Comments
 (0)