Implement Client.MuteAll

This commit is contained in:
SilicaAndPina 2020-12-23 02:56:30 +13:00
parent 0dabd375b7
commit da205c3cd3
4 changed files with 14 additions and 11 deletions

View file

@ -152,7 +152,7 @@ namespace HISP.Game.Chat
foreach (GameClient client in GameServer.ConnectedClients) foreach (GameClient client in GameServer.ConnectedClients)
{ {
if (client.LoggedIn) if (client.LoggedIn)
if (!client.LoggedinUser.MuteGlobal) if (!client.LoggedinUser.MuteGlobal && !client.LoggedinUser.MuteAll)
if (client.LoggedinUser.Id != user.Id) if (client.LoggedinUser.Id != user.Id)
recipiants.Add(client); recipiants.Add(client);
} }
@ -165,7 +165,7 @@ namespace HISP.Game.Chat
foreach (GameClient client in GameServer.ConnectedClients) foreach (GameClient client in GameServer.ConnectedClients)
{ {
if (client.LoggedIn) if (client.LoggedIn)
if (!client.LoggedinUser.MuteAds) if (!client.LoggedinUser.MuteAds && !client.LoggedinUser.MuteAll)
if (client.LoggedinUser.Id != user.Id) if (client.LoggedinUser.Id != user.Id)
recipiants.Add(client); recipiants.Add(client);
} }
@ -178,7 +178,7 @@ namespace HISP.Game.Chat
foreach (GameClient client in GameServer.ConnectedClients) foreach (GameClient client in GameServer.ConnectedClients)
{ {
if (client.LoggedIn) if (client.LoggedIn)
if (!client.LoggedinUser.MuteBuddy) if (!client.LoggedinUser.MuteBuddy && !client.LoggedinUser.MuteAll)
if (client.LoggedinUser.Id != user.Id) if (client.LoggedinUser.Id != user.Id)
if (client.LoggedinUser.Friends.List.Contains(user.Id)) if (client.LoggedinUser.Friends.List.Contains(user.Id))
recipiants.Add(client); recipiants.Add(client);
@ -195,7 +195,8 @@ namespace HISP.Game.Chat
foreach (User userInIsle in usersInSile) foreach (User userInIsle in usersInSile)
{ {
if (user.Id != userInIsle.Id) if (user.Id != userInIsle.Id)
recipiants.Add(userInIsle.LoggedinClient); if(!user.MuteAll)
recipiants.Add(userInIsle.LoggedinClient);
} }
return recipiants.ToArray(); return recipiants.ToArray();
} }
@ -213,7 +214,8 @@ namespace HISP.Game.Chat
foreach (User userHere in usersHere) foreach (User userHere in usersHere)
{ {
if (user.Id != userHere.Id) if (user.Id != userHere.Id)
recipiants.Add(userHere.LoggedinClient); if (!user.MuteAll)
recipiants.Add(userHere.LoggedinClient);
} }
return recipiants.ToArray(); return recipiants.ToArray();
} }
@ -225,7 +227,8 @@ namespace HISP.Game.Chat
foreach (User nearbyUser in nearbyUsers) foreach (User nearbyUser in nearbyUsers)
{ {
if (user.Id != nearbyUser.Id) if (user.Id != nearbyUser.Id)
recipiants.Add(nearbyUser.LoggedinClient); if (!user.MuteAll)
recipiants.Add(nearbyUser.LoggedinClient);
} }
return recipiants.ToArray(); return recipiants.ToArray();
} }
@ -277,7 +280,7 @@ namespace HISP.Game.Chat
foreach (GameClient client in GameServer.ConnectedClients) foreach (GameClient client in GameServer.ConnectedClients)
{ {
if (client.LoggedIn) if (client.LoggedIn)
if (!client.LoggedinUser.MutePrivateMessage) if (!client.LoggedinUser.MutePrivateMessage && !client.LoggedinUser.MuteAll)
if (client.LoggedinUser.Username == to) if (client.LoggedinUser.Username == to)
recipiants.Add(client); recipiants.Add(client);
} }

View file

@ -48,7 +48,7 @@ namespace HISP.Game
public static string WelcomeFormat; public static string WelcomeFormat;
public static string MotdFormat; public static string MotdFormat;
public static string IdleWarningFormat; public static string IdleWarningFormat;
public static string LoginMessageForamt; public static string LoginMessageFormat;
public static string LogoutMessageFormat; public static string LogoutMessageFormat;
// Records // Records
@ -519,7 +519,7 @@ namespace HISP.Game
public static string FormatLoginMessage(string username) public static string FormatLoginMessage(string username)
{ {
return LoginMessageForamt.Replace("%USERNAME%", username); return LoginMessageFormat.Replace("%USERNAME%", username);
} }
public static string FormatLogoutMessage(string username) public static string FormatLogoutMessage(string username)

View file

@ -389,7 +389,7 @@ namespace HISP.Server
Messages.WelcomeFormat = gameData.messages.welcome_format; Messages.WelcomeFormat = gameData.messages.welcome_format;
Messages.MotdFormat = gameData.messages.motd_format; Messages.MotdFormat = gameData.messages.motd_format;
Messages.ProfileSavedMessage = gameData.messages.profile_save; Messages.ProfileSavedMessage = gameData.messages.profile_save;
Messages.LoginMessageForamt = gameData.messages.login_format; Messages.LoginMessageFormat = gameData.messages.login_format;
Messages.LogoutMessageFormat = gameData.messages.logout_format; Messages.LogoutMessageFormat = gameData.messages.logout_format;
// Stats // Stats

View file

@ -1359,7 +1359,7 @@ namespace HISP.Server
byte[] loginMessageBytes = PacketBuilder.CreateChat(Messages.FormatLoginMessage(sender.LoggedinUser.Username), PacketBuilder.CHAT_BOTTOM_LEFT); byte[] loginMessageBytes = PacketBuilder.CreateChat(Messages.FormatLoginMessage(sender.LoggedinUser.Username), PacketBuilder.CHAT_BOTTOM_LEFT);
foreach (GameClient client in ConnectedClients) foreach (GameClient client in ConnectedClients)
if (client.LoggedIn) if (client.LoggedIn)
if (!client.LoggedinUser.MuteLogins) if (!client.LoggedinUser.MuteLogins || client.LoggedinUser.MuteAll)
if (client.LoggedinUser.Id != userId) if (client.LoggedinUser.Id != userId)
client.SendPacket(loginMessageBytes); client.SendPacket(loginMessageBytes);