Skip to content

Commit

Permalink
Add ReadyTag #31
Browse files Browse the repository at this point in the history
  • Loading branch information
TheR00st3r committed Nov 15, 2023
1 parent 4f1e391 commit df01944
Show file tree
Hide file tree
Showing 5 changed files with 41 additions and 0 deletions.
1 change: 1 addition & 0 deletions PugSharp.Match.Contract/IPlayer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ public interface IPlayer
string PlayerName { get; }

Team Team { get; }
string Clan { get; set; }

void PrintToChat(string message);

Expand Down
3 changes: 3 additions & 0 deletions PugSharp.Match/Match.cs
Original file line number Diff line number Diff line change
Expand Up @@ -873,13 +873,16 @@ public async Task TogglePlayerIsReadyAsync(IPlayer player)

if (matchPlayer.IsReady)
{
player.Clan = _TextHelper.GetText(nameof(Resources.PugSharp_Match_ReadyTag));
_MatchCallback.SendMessage(_TextHelper.GetText(nameof(Resources.PugSharp_Match_Info_Ready), player.PlayerName, readyPlayers, requiredPlayers));
await TryFireStateAsync(MatchCommand.PlayerReady).ConfigureAwait(false);
}
else
{
player.Clan = _TextHelper.GetText(nameof(Resources.PugSharp_Match_NotReadyTag));
_MatchCallback.SendMessage(_TextHelper.GetText(nameof(Resources.PugSharp_Match_Info_NotReady), player.PlayerName, readyPlayers, requiredPlayers));
}

}

public Team GetPlayerTeam(ulong steamID)
Expand Down
18 changes: 18 additions & 0 deletions PugSharp.Translation/Properties/Resources.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions PugSharp.Translation/Properties/Resources.resx
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,12 @@
<data name="PugSharp.Match.Info.WaitingForAllPlayers" xml:space="preserve">
<value>Waiting for all players to be ready.</value>
</data>
<data name="PugSharp.Match.NotReadyTag" xml:space="preserve">
<value>Not Ready</value>
</data>
<data name="PugSharp.Match.ReadyTag" xml:space="preserve">
<value>Ready</value>
</data>
<data name="PugSharp.Match.RemindReady" xml:space="preserve">
<value>You are !!not!! ready! Type `!ready` if you are ready.</value>
</data>
Expand Down
13 changes: 13 additions & 0 deletions PugSharp/Models/Player.cs
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,18 @@ public int? Money
}
}

public string Clan
{
get => DefaultIfInvalid(() => _PlayerController.Clan, string.Empty);
set
{
if (_PlayerController.IsValid)
{
_PlayerController.Clan = value;
}
}
}

public void PrintToChat(string message)
{
_PlayerController.PrintToChat(message);
Expand Down Expand Up @@ -118,6 +130,7 @@ public void Kick()
CounterStrikeSharp.API.Server.ExecuteCommand(string.Create(CultureInfo.InvariantCulture, $"kickid {UserId!.Value} \"You are not part of the current match!\""));
}


private void ResetScoreboard()
{
var matchStats = _PlayerController.ActionTrackingServices?.MatchStats;
Expand Down

0 comments on commit df01944

Please sign in to comment.