enable support for custom say name on non IW4 games with tell/say raw
This commit is contained in:
parent
12ddb87fc2
commit
c6c7ca6305
@ -330,7 +330,7 @@ namespace IW4MAdmin
|
|||||||
else if (E.Type == GameEvent.EventType.ConnectionRestored)
|
else if (E.Type == GameEvent.EventType.ConnectionRestored)
|
||||||
{
|
{
|
||||||
ServerLogger.LogInformation(
|
ServerLogger.LogInformation(
|
||||||
"Connection restored with {server}", ToString());
|
"Connection restored with {Server}", ToString());
|
||||||
|
|
||||||
if (!Manager.GetApplicationSettings().Configuration().IgnoreServerConnectionLost)
|
if (!Manager.GetApplicationSettings().Configuration().IgnoreServerConnectionLost)
|
||||||
{
|
{
|
||||||
@ -1347,7 +1347,7 @@ namespace IW4MAdmin
|
|||||||
|
|
||||||
if (Manager.GetApplicationSettings().Configuration().EnableCustomSayName)
|
if (Manager.GetApplicationSettings().Configuration().EnableCustomSayName)
|
||||||
{
|
{
|
||||||
await this.SetDvarAsync("sv_sayname", Manager.GetApplicationSettings().Configuration().CustomSayName,
|
await this.SetDvarAsync("sv_sayname", CustomSayName,
|
||||||
Manager.CancellationToken);
|
Manager.CancellationToken);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -239,8 +239,10 @@ namespace SharedLibraryCore
|
|||||||
/// <param name="sender">Client that initiated the broadcast</param>
|
/// <param name="sender">Client that initiated the broadcast</param>
|
||||||
public GameEvent Broadcast(string message, EFClient sender = null)
|
public GameEvent Broadcast(string message, EFClient sender = null)
|
||||||
{
|
{
|
||||||
|
var hasRawSupport = RconParser.Configuration.CommandPrefixes.Say.Contains("raw");
|
||||||
var formattedMessage = string.Format(RconParser.Configuration.CommandPrefixes.Say ?? "",
|
var formattedMessage = string.Format(RconParser.Configuration.CommandPrefixes.Say ?? "",
|
||||||
$"{(CustomSayEnabled && GameName == Game.IW4 ? $"{CustomSayName}: " : "")}{message}");
|
$"{(CustomSayEnabled && hasRawSupport ? $"{CustomSayName}: " : "")}{message}");
|
||||||
|
|
||||||
ServerLogger.LogDebug("All-> {Message}",
|
ServerLogger.LogDebug("All-> {Message}",
|
||||||
message.FormatMessageForEngine(RconParser.Configuration).StripColors());
|
message.FormatMessageForEngine(RconParser.Configuration).StripColors());
|
||||||
|
|
||||||
@ -294,9 +296,11 @@ namespace SharedLibraryCore
|
|||||||
var parsedClientId = string.IsNullOrEmpty(temporalClientId) ? (int?)null : int.Parse(temporalClientId);
|
var parsedClientId = string.IsNullOrEmpty(temporalClientId) ? (int?)null : int.Parse(temporalClientId);
|
||||||
var clientNumber = parsedClientId ?? targetClient.ClientNumber;
|
var clientNumber = parsedClientId ?? targetClient.ClientNumber;
|
||||||
|
|
||||||
|
var hasRawSupport = RconParser.Configuration.CommandPrefixes.Tell.Contains("raw");
|
||||||
var formattedMessage = string.Format(RconParser.Configuration.CommandPrefixes.Tell,
|
var formattedMessage = string.Format(RconParser.Configuration.CommandPrefixes.Tell,
|
||||||
clientNumber,
|
clientNumber,
|
||||||
$"{(CustomSayEnabled && GameName == Game.IW4 ? $"{CustomSayName}: " : "")}{message}");
|
$"{(CustomSayEnabled && hasRawSupport ? $"{CustomSayName}: " : "")}{message}");
|
||||||
|
|
||||||
if (targetClient.ClientNumber > -1 && message.Length > 0 &&
|
if (targetClient.ClientNumber > -1 && message.Length > 0 &&
|
||||||
targetClient.Level != Data.Models.Client.EFClient.Permission.Console)
|
targetClient.Level != Data.Models.Client.EFClient.Permission.Console)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user