-
-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Work on translations, boil down LogManager
* Remove most stuff from LogManager, into their own classes & services * Add PlayerTagHelper as an experimental service to avoid dependency loop shenanigans in main classes * Add LogMessages as an english translation * Add ToServerConsole IView extension
- Loading branch information
Showing
14 changed files
with
227 additions
and
84 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,34 @@ | ||
using Jailbreak.Formatting.Logistics; | ||
using CounterStrikeSharp.API; | ||
using CounterStrikeSharp.API.Modules.Utils; | ||
|
||
using Jailbreak.Formatting.Base; | ||
using Jailbreak.Formatting.Core; | ||
using Jailbreak.Formatting.Logistics; | ||
using Jailbreak.Formatting.Objects; | ||
using Jailbreak.Formatting.Views; | ||
using Jailbreak.Public.Extensions; | ||
|
||
namespace Jailbreak.English.Logs; | ||
|
||
public class LogMessages : ILanguage<Formatting.Languages.English> | ||
public class LogMessages : ILogMessages, ILanguage<Formatting.Languages.English> | ||
{ | ||
|
||
|
||
|
||
public IView BEGIN_JAILBREAK_LOGS => new SimpleView() | ||
{ | ||
{ "********************************" }, | ||
{ "***** BEGIN JAILBREAK LOGS *****" }, | ||
{ "********************************" } | ||
}; | ||
|
||
public IView END_JAILBREAK_LOGS => new SimpleView() | ||
{ | ||
{ "********************************" }, | ||
{ "****** END JAILBREAK LOGS ******" }, | ||
{ "********************************" } | ||
}; | ||
|
||
|
||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
using CounterStrikeSharp.API.Core; | ||
using CounterStrikeSharp.API.Modules.Utils; | ||
|
||
using Jailbreak.Formatting.Core; | ||
using Jailbreak.Formatting.Objects; | ||
using Jailbreak.Formatting.Views; | ||
using Jailbreak.Public.Extensions; | ||
using Jailbreak.Public.Mod.Logs; | ||
using Jailbreak.Public.Mod.Rebel; | ||
using Jailbreak.Public.Mod.Warden; | ||
|
||
using Microsoft.Extensions.DependencyInjection; | ||
|
||
namespace Jailbreak.Logs.Tags; | ||
|
||
public class PlayerTagHelper : IRichPlayerTag, IPlayerTag | ||
{ | ||
private IWardenService _wardenService; | ||
private IRebelService _rebelService; | ||
|
||
public PlayerTagHelper(IServiceProvider provider) | ||
{ | ||
// Lazy-load dependencies to avoid loops, since we are a lower-level class. | ||
_wardenService = provider.GetRequiredService<IWardenService>(); | ||
_rebelService = provider.GetRequiredService<IRebelService>(); | ||
} | ||
|
||
public FormatObject Rich(CCSPlayerController player) | ||
{ | ||
if (_wardenService.IsWarden(player)) | ||
return new StringFormatObject("(WARDEN)", ChatColors.DarkBlue); | ||
if (player.GetTeam() == CsTeam.CounterTerrorist) | ||
return new StringFormatObject("(CT)", ChatColors.BlueGrey); | ||
if (_rebelService.IsRebel(player)) | ||
return new StringFormatObject("(REBEL)", ChatColors.Darkred); | ||
|
||
return new StringFormatObject("(T)", ChatColors.Yellow); | ||
} | ||
|
||
public string Plain(CCSPlayerController playerController) | ||
{ | ||
return $"{playerController.PlayerName} [#{playerController.UserId}] {Rich(playerController).ToPlain()}"; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.