Skip to content

Commit

Permalink
rest of strings
Browse files Browse the repository at this point in the history
  • Loading branch information
sniperpl authored Apr 27, 2024
1 parent 0354eb3 commit 192a55b
Show file tree
Hide file tree
Showing 16 changed files with 217 additions and 46 deletions.
8 changes: 5 additions & 3 deletions BackupManagement.cs
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,8 @@ public void OnRestoreCommand(CCSPlayerController? player, CommandInfo command) {
HandleRestoreCommand(player, commandArg);
}
else {
ReplyToUserCommand(player, $"Usage: !restore <round>");
// ReplyToUserCommand(player, $"Usage: !restore <round>");
ReplyToUserCommand(player, Localizer["matchzy.cc.usage", "!restore <round>"]);
}
} else {
SendPlayerNotAdminMessage(player);
Expand All @@ -117,7 +118,8 @@ private void HandleRestoreCommand(CCSPlayerController? player, string commandArg
}
}
else {
ReplyToUserCommand(player, $"Usage: !restore <round>");
// ReplyToUserCommand(player, $"Usage: !restore <round>");
ReplyToUserCommand(player, Localizer["matchzy.cc.usage", "!restore <round>"]);
}
}

Expand Down Expand Up @@ -272,4 +274,4 @@ public void CreateMatchZyRoundDataBackup()
}
}
}
}
}
6 changes: 4 additions & 2 deletions ConfigConvars.cs
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,8 @@ public void MatchZyChatMessagesTimerDelay(CCSPlayerController? player, CommandIn
}
else
{
ReplyToUserCommand(player, $"Invalid value for matchzy_chat_messages_timer_delay. Please specify a valid non-negative number.");
// ReplyToUserCommand(player, $"Invalid value for matchzy_chat_messages_timer_delay. Please specify a valid non-negative number.");
ReplyToUserCommand(player, Localizer["matchzy.cvars.invalidvalue"]);
}
}
} else if (command.ArgCount == 1) {
Expand Down Expand Up @@ -254,7 +255,8 @@ public void MatchZyMaxSavedLastGrenadesConvar(CCSPlayerController? player, Comma
}
else
{
command.ReplyToCommand("Usage: matchzy_max_saved_last_grenades <number>");
// command.ReplyToCommand("Usage: matchzy_max_saved_last_grenades <number>");
ReplyToUserCommand(player, Localizer["matchzy.cc.usage", $"matchzy_max_saved_last_grenades <number>"]);
}
}
}
Expand Down
5 changes: 3 additions & 2 deletions ConsoleCommands.cs
Original file line number Diff line number Diff line change
Expand Up @@ -376,7 +376,8 @@ private void OnMapReloadCommand(CCSPlayerController? player, CommandInfo? comman
Server.ExecuteCommand($"bot_kick");
Server.ExecuteCommand($"changelevel \"{currentMapName}\"");
} else {
ReplyToUserCommand(player, "Invalid map name!");
// ReplyToUserCommand(player, "Invalid map name!");
ReplyToUserCommand(player, Localizer["matchzy.cc.invalidmap"]);
}
}

Expand Down Expand Up @@ -529,4 +530,4 @@ public void OnVersionCommand(CCSPlayerController? player, CommandInfo? command)
command.ReplyToCommand((serverVersion != null) ? $"Protocol version {serverVersion} [{serverVersion}/{serverVersion}]" : "Unable to get server version");
}
}
}
}
4 changes: 2 additions & 2 deletions DamageInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,8 @@ private void ShowDamageInfo()
int targetHP = targetController.PlayerPawn.Value.Health < 0 ? 0 : targetController.PlayerPawn.Value.Health;
string targetName = targetController.PlayerName;

attackerController.PrintToChat($"{chatPrefix} {ChatColors.Green}To: [{damageGiven} / {hitsGiven} hits] From: [{damageTaken} / {hitsTaken} hits] - {targetName} - ({targetHP} hp){ChatColors.Default}");
targetController.PrintToChat($"{chatPrefix} {ChatColors.Green}To: [{damageTaken} / {hitsTaken} hits] From: [{damageGiven} / {hitsGiven} hits] - {attackerName} - ({attackerHP} hp){ChatColors.Default}");
PrintToPlayerChat(attackerController, $"{chatPrefix} {ChatColors.Green}To: [{damageGiven} / {hitsGiven} hits] From: [{damageTaken} / {hitsTaken} hits] - {targetName} - ({targetHP} hp){ChatColors.Default}");
PrintToPlayerChat(targetController, $"{chatPrefix} {ChatColors.Green}To: [{damageTaken} / {hitsTaken} hits] From: [{damageGiven} / {hitsGiven} hits] - {attackerName} - ({attackerHP} hp){ChatColors.Default}");
}

// Mark this pair as processed to avoid duplicates.
Expand Down
27 changes: 18 additions & 9 deletions MatchManagement.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,23 +51,26 @@ public void LoadMatch(CCSPlayerController? player, CommandInfo command)
if (player != null) return;
if (isMatchSetup)
{
command.ReplyToCommand($"[LoadMatch] A match is already setup with id: {liveMatchId}, cannot load a new match!");
// command.ReplyToCommand($"[LoadMatch] A match is already setup with id: {liveMatchId}, cannot load a new match!");
ReplyToUserCommand(player, Localizer["matchzy.mm.matchisalreadysetup", liveMatchId]);
Log($"[LoadMatch] A match is already setup with id: {liveMatchId}, cannot load a new match!");
return;
}
string fileName = command.ArgString;
string filePath = Path.Join(Server.GameDirectory + "/csgo", fileName);
if (!File.Exists(filePath))
{
command.ReplyToCommand($"[LoadMatch] Provided file does not exist! Usage: matchzy_loadmatch <filename>");
// command.ReplyToCommand($"[LoadMatch] Provided file does not exist! Usage: matchzy_loadmatch <filename>");
ReplyToUserCommand(player, Localizer["matchzy.mm.filedoesntexist"]);
Log($"[LoadMatch] Provided file does not exist! Usage: matchzy_loadmatch <filename>");
return;
}
string jsonData = File.ReadAllText(filePath);
bool success = LoadMatchFromJSON(jsonData);
if (!success)
{
command.ReplyToCommand("Match load failed! Resetting current match");
// command.ReplyToCommand("Match load failed! Resetting current match");
ReplyToUserCommand(player, Localizer["matchzy.mm.matchloadfailed"]);
ResetMatch();
}
loadedConfigFile = fileName;
Expand All @@ -86,7 +89,8 @@ public void LoadMatchFromURL(CCSPlayerController? player, CommandInfo command)
if (player != null) return;
if (isMatchSetup)
{
command.ReplyToCommand($"[LoadMatchDataCommand] A match is already setup with id: {liveMatchId}, cannot load a new match!");
// command.ReplyToCommand($"[LoadMatchDataCommand] A match is already setup with id: {liveMatchId}, cannot load a new match!");
ReplyToUserCommand(player, Localizer["matchzy.mm.get5matchisalreadysetup", liveMatchId]);
Log($"[LoadMatchDataCommand] A match is already setup with id: {liveMatchId}, cannot load a new match!");
return;
}
Expand All @@ -99,7 +103,8 @@ public void LoadMatchFromURL(CCSPlayerController? player, CommandInfo command)

if (!IsValidUrl(url))
{
command.ReplyToCommand($"[LoadMatchDataCommand] Invalid URL: {url}. Please provide a valid URL to load the match!");
// command.ReplyToCommand($"[LoadMatchDataCommand] Invalid URL: {url}. Please provide a valid URL to load the match!");
ReplyToUserCommand(player, Localizer["matchzy.mm.invalidurl", url]);
Log($"[LoadMatchDataCommand] Invalid URL: {url}. Please provide a valid URL to load the match!");
return;
}
Expand All @@ -120,14 +125,16 @@ public void LoadMatchFromURL(CCSPlayerController? player, CommandInfo command)
bool success = LoadMatchFromJSON(jsonData);
if (!success)
{
command.ReplyToCommand("Match load failed! Resetting current match");
// command.ReplyToCommand("Match load failed! Resetting current match");
ReplyToUserCommand(player, Localizer["matchzy.mm.matchloadfailed"]);
ResetMatch();
}
loadedConfigFile = url;
}
else
{
command.ReplyToCommand($"[LoadMatchFromURL] HTTP request failed with status code: {response.StatusCode}");
// command.ReplyToCommand($"[LoadMatchFromURL] HTTP request failed with status code: {response.StatusCode}");
ReplyToUserCommand(player, Localizer["matchzy.mm.httprequestfailed", response.StatusCode]);
Log($"[LoadMatchFromURL] HTTP request failed with status code: {response.StatusCode}");
}
}
Expand Down Expand Up @@ -487,12 +494,14 @@ public void HandleTeamNameChangeCommand(CCSPlayerController? player, string team
return;
}
if (matchStarted) {
ReplyToUserCommand(player, "Team names cannot be changed once the match is started!");
// ReplyToUserCommand(player, "Team names cannot be changed once the match is started!");
ReplyToUserCommand(player, Localizer["matchzy.mm.teamcannotbechanged"]);
return;
}
teamName = RemoveSpecialCharacters(teamName.Trim());
if (teamName == "") {
ReplyToUserCommand(player, $"Usage: !team{teamNum} <name>");
// ReplyToUserCommand(player, $"Usage: !team{teamNum} <name>");
ReplyToUserCommand(player, Localizer["matchzy.cc.usage", $"!team{teamNum} <name>"]);
}

if (teamNum == 1) {
Expand Down
3 changes: 2 additions & 1 deletion MatchZy.cs
Original file line number Diff line number Diff line change
Expand Up @@ -396,7 +396,8 @@ public override void Load(bool hotReload) {
if (commandArg != "") {
Server.PrintToChatAll($"{adminChatPrefix} {commandArg}");
} else {
ReplyToUserCommand(player, "Usage: .asay <message>");
// ReplyToUserCommand(player, "Usage: .asay <message>");
ReplyToUserCommand(player, Localizer["matchzy.cc.usage, $".asay <message>"]);
}
} else {
SendPlayerNotAdminMessage(player);
Expand Down
42 changes: 28 additions & 14 deletions PracticeMode.cs
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,8 @@ private void HandleSpawnCommand(CCSPlayerController? player, string commandArg,
}
else
{
ReplyToUserCommand(player, $"Usage: !{command} <number>");
// ReplyToUserCommand(player, $"Usage: !{command} <number>");
ReplyToUserCommand(player, Localizer["matchzy.cc.usage", $"!{command} <number>"]);
}
}

Expand Down Expand Up @@ -289,7 +290,8 @@ private void HandleSaveNadeCommand(CCSPlayerController? player, string saveNadeN
}
else
{
ReplyToUserCommand(player, $"Usage: .savenade <name>");
// ReplyToUserCommand(player, $"Usage: .savenade <name>");
ReplyToUserCommand(player, Localizer["matchzy.cc.usage", $".savenade <name>"]);
}
}

Expand Down Expand Up @@ -353,7 +355,8 @@ private void HandleDeleteNadeCommand(CCSPlayerController? player, string saveNad
}
else
{
ReplyToUserCommand(player, $"Usage: .delnade <name>");
// ReplyToUserCommand(player, $"Usage: .delnade <name>");
ReplyToUserCommand(player, Localizer["matchzy.cc.usage", $".delnade <name>"]);
}
}

Expand Down Expand Up @@ -437,7 +440,8 @@ private void HandleImportNadeCommand(CCSPlayerController? player, string saveNad
}
else
{
ReplyToUserCommand(player, $"Usage: .importnade <code>");
// ReplyToUserCommand(player, $"Usage: .importnade <code>");
ReplyToUserCommand(player, Localizer["matchzy.cc.usage", $".importnade <code>"]);
}
}

Expand Down Expand Up @@ -610,7 +614,8 @@ private void HandleLoadNadeCommand(CCSPlayerController? player, string loadNadeN
}
else
{
ReplyToUserCommand(player, $"Nade not found! Usage: .loadnade <name>");
// ReplyToUserCommand(player, $"Nade not found! Usage: .loadnade <name>");
ReplyToUserCommand(player, Localizer["matchzy.pm.loadnadenotfound"]);
}
}

Expand Down Expand Up @@ -705,7 +710,8 @@ public void OnSpawnCommand(CCSPlayerController? player, CommandInfo command)
}
else
{
ReplyToUserCommand(player, $"Usage: !spawn <round>");
// ReplyToUserCommand(player, $"Usage: !spawn <round>");
ReplyToUserCommand(player, Localizer["matchzy.cc.usage", $"!spawn <round>"]);
}
}

Expand All @@ -724,7 +730,8 @@ public void OnCtSpawnCommand(CCSPlayerController? player, CommandInfo command)
}
else
{
ReplyToUserCommand(player, $"Usage: !ctspawn <round>");
// ReplyToUserCommand(player, $"Usage: !ctspawn <round>");
ReplyToUserCommand(player, Localizer["matchzy.cc.usage", $"!ctspawn <round>"]);
}
}

Expand All @@ -743,7 +750,8 @@ public void OnTSpawnCommand(CCSPlayerController? player, CommandInfo command)
}
else
{
ReplyToUserCommand(player, $"Usage: !ctspawn <round>");
// ReplyToUserCommand(player, $"Usage: !ctspawn <round>");
ReplyToUserCommand(player, Localizer["matchzy.cc.usage", $"!ctspawn <round>"]);
}
}

Expand Down Expand Up @@ -1226,7 +1234,8 @@ public void HandleBackCommand(CCSPlayerController player, string number)
else
{
int thrownCount = lastGrenadesData.ContainsKey(userId) ? lastGrenadesData[userId].Count : 0;
ReplyToUserCommand(player, $"Usage: !back <number> (You've thrown {thrownCount} grenades till now)");
// ReplyToUserCommand(player, $"Usage: !back <number> (You've thrown {thrownCount} grenades till now)");
ReplyToUserCommand(player, Localizer["matchzy.pm.backtonumber", thrownCount]);
}
}

Expand All @@ -1238,7 +1247,8 @@ public void HandleThrowIndexCommand(CCSPlayerController player, string argString
if (string.IsNullOrEmpty(argString))
{
int thrownCount = lastGrenadesData.ContainsKey(userId) ? lastGrenadesData[userId].Count : 0;
ReplyToUserCommand(player, $"Usage: !throwindex <number> (You've thrown {thrownCount} grenades till now)");
// ReplyToUserCommand(player, $"Usage: !throwindex <number> (You've thrown {thrownCount} grenades till now)");
ReplyToUserCommand(player, Localizer["matchzy.pm.throwindextonumber", thrownCount]);
return;
}

Expand Down Expand Up @@ -1273,7 +1283,8 @@ public void HandleDelayCommand(CCSPlayerController player, string delay)
int userId = player.UserId.Value;
if (string.IsNullOrWhiteSpace(delay))
{
ReplyToUserCommand(player, $"Usage: !delay <delay_in_seconds>");
// ReplyToUserCommand(player, $"Usage: !delay <delay_in_seconds>");
ReplyToUserCommand(player, Localizer["matchzy.cc.usage", $"!delay <delay_in_seconds>"]);
return;
}

Expand Down Expand Up @@ -1387,7 +1398,8 @@ public void OnBackCommand(CCSPlayerController? player, CommandInfo command)
{
int userId = player!.UserId!.Value;
int thrownCount = lastGrenadesData.ContainsKey(userId) ? lastGrenadesData[userId].Count : 0;
ReplyToUserCommand(player, $"Usage: !back <number> (You've thrown {thrownCount} grenades till now)");
// ReplyToUserCommand(player, $"Usage: !back <number> (You've thrown {thrownCount} grenades till now)");
ReplyToUserCommand(player, Localizer["matchzy.pm.backtonumber", thrownCount]);
}
}

Expand All @@ -1404,7 +1416,8 @@ public void OnThrowIndexCommand(CCSPlayerController? player, CommandInfo command
{
int userId = player!.UserId!.Value;
int thrownCount = lastGrenadesData.ContainsKey(userId) ? lastGrenadesData[userId].Count : 0;
ReplyToUserCommand(player, $"Usage: !throwindex <number> (You've thrown {thrownCount} grenades till now)");
// ReplyToUserCommand(player, $"Usage: !throwindex <number> (You've thrown {thrownCount} grenades till now)");
ReplyToUserCommand(player, Localizer["matchzy.pm.throwindextonumber", thrownCount]);
}
}

Expand All @@ -1429,7 +1442,8 @@ public void OnDelayCommand(CCSPlayerController? player, CommandInfo command)
}
else
{
ReplyToUserCommand(player, $"Usage: !delay <delay_in_seconds>");
// ReplyToUserCommand(player, $"Usage: !delay <delay_in_seconds>");
ReplyToUserCommand(player, Localizer["matchzy.cc.usage", $"!delay <delay_in_seconds>"]);
}
}

Expand Down
6 changes: 4 additions & 2 deletions ReadySystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,8 @@ public void OnForceReadyCommandCommand(CCSPlayerController? player, CommandInfo?

if (playerCount < minReady)
{
ReplyToUserCommand(player, $"You must have at least {minReady} player(s) on the server to ready up.");
// ReplyToUserCommand(player, $"You must have at least {minReady} player(s) on the server to ready up.");
ReplyToUserCommand(player, Localizer["matchzy.rs.minreadyplayers", minReady]);
return;
}

Expand All @@ -112,7 +113,8 @@ public void OnForceReadyCommandCommand(CCSPlayerController? player, CommandInfo?
if (!playerData[key].IsValid) continue;
if (playerData[key].TeamNum == player.TeamNum) {
playerReadyStatus[key] = true;
ReplyToUserCommand(playerData[key], $"Your team was force-readied by {player.PlayerName}");
// ReplyToUserCommand(playerData[key], $"Your team was force-readied by {player.PlayerName}");
ReplyToUserCommand(playerData[key], Localizer["matchzy.rs.forcereadiedby", player.PlayerName]);
}
}

Expand Down
3 changes: 2 additions & 1 deletion SleepMode.cs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,8 @@ public void OnSleepCommand(CCSPlayerController? player, CommandInfo? command)

if (matchStarted)
{
ReplyToUserCommand(player, "Sleep Mode cannot be started when a match has been started!");
// ReplyToUserCommand(player, "Sleep Mode cannot be started when a match has been started!");
ReplyToUserCommand(player, Localizer["matchzy.sleep.sleepwhenmatchstared"]);
return;
}
StartSleepMode();
Expand Down
Loading

0 comments on commit 192a55b

Please sign in to comment.