enable support for custom say name on non IW4 games with tell/say raw

This commit is contained in:
RaidMax 2023-04-07 14:04:04 -05:00
parent 12ddb87fc2
commit c6c7ca6305
2 changed files with 8 additions and 4 deletions

View File

@ -330,7 +330,7 @@ namespace IW4MAdmin
else if (E.Type == GameEvent.EventType.ConnectionRestored)
{
ServerLogger.LogInformation(
"Connection restored with {server}", ToString());
"Connection restored with {Server}", ToString());
if (!Manager.GetApplicationSettings().Configuration().IgnoreServerConnectionLost)
{
@ -1347,7 +1347,7 @@ namespace IW4MAdmin
if (Manager.GetApplicationSettings().Configuration().EnableCustomSayName)
{
await this.SetDvarAsync("sv_sayname", Manager.GetApplicationSettings().Configuration().CustomSayName,
await this.SetDvarAsync("sv_sayname", CustomSayName,
Manager.CancellationToken);
}

View File

@ -239,8 +239,10 @@ namespace SharedLibraryCore
/// <param name="sender">Client that initiated the broadcast</param>
public GameEvent Broadcast(string message, EFClient sender = null)
{
var hasRawSupport = RconParser.Configuration.CommandPrefixes.Say.Contains("raw");
var formattedMessage = string.Format(RconParser.Configuration.CommandPrefixes.Say ?? "",
$"{(CustomSayEnabled && GameName == Game.IW4 ? $"{CustomSayName}: " : "")}{message}");
$"{(CustomSayEnabled && hasRawSupport ? $"{CustomSayName}: " : "")}{message}");
ServerLogger.LogDebug("All-> {Message}",
message.FormatMessageForEngine(RconParser.Configuration).StripColors());
@ -294,9 +296,11 @@ namespace SharedLibraryCore
var parsedClientId = string.IsNullOrEmpty(temporalClientId) ? (int?)null : int.Parse(temporalClientId);
var clientNumber = parsedClientId ?? targetClient.ClientNumber;
var hasRawSupport = RconParser.Configuration.CommandPrefixes.Tell.Contains("raw");
var formattedMessage = string.Format(RconParser.Configuration.CommandPrefixes.Tell,
clientNumber,
$"{(CustomSayEnabled && GameName == Game.IW4 ? $"{CustomSayName}: " : "")}{message}");
$"{(CustomSayEnabled && hasRawSupport ? $"{CustomSayName}: " : "")}{message}");
if (targetClient.ClientNumber > -1 && message.Length > 0 &&
targetClient.Level != Data.Models.Client.EFClient.Permission.Console)
{