Implement Mute Function.

This commit is contained in:
SilicaAndPina 2021-03-23 19:13:40 +13:00
parent b15e6996fe
commit 5308b53c89
9 changed files with 302 additions and 55 deletions

View file

@ -163,6 +163,7 @@
},
"commands":{
"mute_help":"Mute Channel Not Recognized. (ALL/ADS/GLOBAL/ISLAND/NEAR/HERE/BUDDY/PM/BR/SOCIALS/LOGINS)",
"unmute_help":"Hear Channel Not Recognized. (ALL/ADS/GLOBAL/ISLAND/NEAR/HERE/BUDDY/PM/BR/SOCIALS/LOGINS)",
"player_command_completed":"<FONT COLOR='#FF0000'><B>PLAYER COMMAND [%COMMAND%] COMPLETED</B></FONT>",
"admin_command_completed":"<FONT COLOR='#FF0000'><B>COMMAND [%COMMAND%]:</B></FONT>",
"warp":{
@ -220,6 +221,9 @@
"last_poet":"^LLast Player Poet:%USERNAME% ^R1",
"hammock":"You and all of your horses have fully rested.",
"mute_command":{
"now_ignoring_player":"Completely ignoring player %USERNAME%!",
"stop_ignoring_player":"Stopped ignoring player %USERNAME%!",
"player_ignoring_your_pm":"<FONT COLOR='#0000FF'><B>%USERNAME% does not receive your chats. (Don't take it personally, some players don't like to chat)</B></FONT>",
"player_ignoring_your_br":"Player is ignoring you. You cannot add them as a buddy.",
"player_ignoring_your_socials":"Player is ignoring you. They cannot receive your socials.",
@ -940,7 +944,11 @@
"all_players_header":"^ATAll Players Online^H",
"all_players_alphabetical_header":"^ATAll Players Online Alphabetically^H",
"player_format":"%ICONFORMAT%^T3%USERNAME% (on %TIME% min%IDLE%)^B1L%PLAYERID%^B1M%MAPXY%^B1I%PLAYERID%^B1P%USERNAME%^R1",
"player_format":"%ICONFORMAT%^T3%USERNAME% (on %TIME% min%IDLE%)^B1L%PLAYERID%^B1M%MAPXY%%MUTEORHEAR%%PMBUTTON%^R1",
"pm_button":"^B1P%USERNAME%",
"mute_button":"^B1I%PLAYERID%",
"hear_button":"^B1H%PLAYERID%",
"icon_info":"^L [Star = Subscriber] [A = Admin] [M = Moderator]^R1",
"idle_text":"(IDLE)",
"icon_subbed_3month":415,

View file

@ -55,19 +55,19 @@ namespace HISP.Game.Chat
{
if (message[0] == '%')
{
if (message.StartsWith("%GIVE"))
if (message.ToUpper().StartsWith("%GIVE"))
return Command.Give(message, args, user);
if (message.StartsWith("%GOTO"))
if (message.ToUpper().StartsWith("%GOTO"))
return Command.Goto(message, args, user);
if (message.StartsWith("%KICK"))
if (message.ToUpper().StartsWith("%KICK"))
return Command.Kick(message, args, user);
if (message.StartsWith("%NOCLIP"))
if (message.ToUpper().StartsWith("%NOCLIP"))
return Command.NoClip(message, args, user);
if (message.StartsWith("%BAN"))
if (message.ToUpper().StartsWith("%BAN"))
return Command.Ban(message, args, user);
if (message.StartsWith("%UNBAN"))
if (message.ToUpper().StartsWith("%UNBAN"))
return Command.UnBan(message, args, user);
if (message.StartsWith("%ESCAPE"))
if (message.ToUpper().StartsWith("%ESCAPE"))
return Command.Escape(message, args, user);
return false;
}
@ -75,33 +75,90 @@ namespace HISP.Game.Chat
}
if (message[0] == '!')
{
// Alias for !MUTE
if (message.StartsWith("!MUTEALL"))
if (message.ToUpper().StartsWith("!MUTEALL"))
return Command.Mute(message, new string[] { "ALL" }, user);
else if (message.StartsWith("!MUTEADS"))
else if (message.ToUpper().StartsWith("!MUTEADS"))
return Command.Mute(message, new string[] { "ADS" }, user);
else if (message.StartsWith("!MUTEGLOBAL"))
else if (message.ToUpper().StartsWith("!MUTEGLOBAL"))
return Command.Mute(message, new string[] { "GLOBAL" }, user);
else if (message.StartsWith("!MUTEISLAND"))
else if (message.ToUpper().StartsWith("!MUTEISLAND"))
return Command.Mute(message, new string[] { "ISLAND" }, user);
else if (message.StartsWith("!MUTENEAR"))
else if (message.ToUpper().StartsWith("!MUTENEAR"))
return Command.Mute(message, new string[] { "NEAR" }, user);
else if (message.StartsWith("!MUTEHERE"))
else if (message.ToUpper().StartsWith("!MUTEHERE"))
return Command.Mute(message, new string[] { "HERE" }, user);
else if (message.StartsWith("!MUTEBUDDY"))
else if (message.ToUpper().StartsWith("!MUTEBUDDY"))
return Command.Mute(message, new string[] { "BUDDY" }, user);
else if (message.StartsWith("!MUTEPM"))
else if (message.ToUpper().StartsWith("!MUTEPM"))
return Command.Mute(message, new string[] { "PM" }, user);
else if (message.StartsWith("!MUTEBR"))
else if (message.ToUpper().StartsWith("!MUTEBR"))
return Command.Mute(message, new string[] { "BR" }, user);
else if (message.StartsWith("!MUTESOCIALS"))
else if (message.ToUpper().StartsWith("!MUTESOCIALS"))
return Command.Mute(message, new string[] { "SOCIALS" }, user);
else if (message.StartsWith("!MUTELOGINS"))
else if (message.ToUpper().StartsWith("!MUTELOGINS"))
return Command.Mute(message, new string[] { "LOGINS" }, user);
else if (message.StartsWith("!MUTE"))
else if (message.ToUpper().StartsWith("!MUTE"))
return Command.Mute(message, args, user);
else if (message.StartsWith("!WARP"))
// Alias for !UNMUTE
else if (message.ToUpper().StartsWith("!UNMUTEALL"))
return Command.UnMute(message, new string[] { "ALL" }, user);
else if (message.ToUpper().StartsWith("!UNMUTEADS"))
return Command.UnMute(message, new string[] { "ADS" }, user);
else if (message.ToUpper().StartsWith("!UNMUTEGLOBAL"))
return Command.UnMute(message, new string[] { "GLOBAL" }, user);
else if (message.ToUpper().StartsWith("!UNMUTEISLAND"))
return Command.UnMute(message, new string[] { "ISLAND" }, user);
else if (message.ToUpper().StartsWith("!UNMUTENEAR"))
return Command.UnMute(message, new string[] { "NEAR" }, user);
else if (message.ToUpper().StartsWith("!UNMUTEHERE"))
return Command.UnMute(message, new string[] { "HERE" }, user);
else if (message.ToUpper().StartsWith("!UNMUTEBUDDY"))
return Command.UnMute(message, new string[] { "BUDDY" }, user);
else if (message.ToUpper().StartsWith("!UNMUTEPM"))
return Command.UnMute(message, new string[] { "PM" }, user);
else if (message.ToUpper().StartsWith("!UNMUTEBR"))
return Command.UnMute(message, new string[] { "BR" }, user);
else if (message.ToUpper().StartsWith("!UNMUTESOCIALS"))
return Command.UnMute(message, new string[] { "SOCIALS" }, user);
else if (message.ToUpper().StartsWith("!UNMUTELOGINS"))
return Command.UnMute(message, new string[] { "LOGINS" }, user);
else if (message.ToUpper().StartsWith("!UNMUTE"))
return Command.UnMute(message, args, user);
// Alias for !HEAR
else if (message.ToUpper().StartsWith("!HEARALL"))
return Command.UnMute(message, new string[] { "ALL" }, user);
else if (message.ToUpper().StartsWith("!HEARADS"))
return Command.UnMute(message, new string[] { "ADS" }, user);
else if (message.ToUpper().StartsWith("!HEARGLOBAL"))
return Command.UnMute(message, new string[] { "GLOBAL" }, user);
else if (message.ToUpper().StartsWith("!HEARISLAND"))
return Command.UnMute(message, new string[] { "ISLAND" }, user);
else if (message.ToUpper().StartsWith("!HEARNEAR"))
return Command.UnMute(message, new string[] { "NEAR" }, user);
else if (message.ToUpper().StartsWith("!HEARHERE"))
return Command.UnMute(message, new string[] { "HERE" }, user);
else if (message.ToUpper().StartsWith("!HEARBUDDY"))
return Command.UnMute(message, new string[] { "BUDDY" }, user);
else if (message.ToUpper().StartsWith("!HEARPM"))
return Command.UnMute(message, new string[] { "PM" }, user);
else if (message.ToUpper().StartsWith("!HEARBR"))
return Command.UnMute(message, new string[] { "BR" }, user);
else if (message.ToUpper().StartsWith("!HEARSOCIALS"))
return Command.UnMute(message, new string[] { "SOCIALS" }, user);
else if (message.ToUpper().StartsWith("!HEARLOGINS"))
return Command.UnMute(message, new string[] { "LOGINS" }, user);
else if (message.ToUpper().StartsWith("!HEAR"))
return Command.UnMute(message, args, user);
else if (message.ToUpper().StartsWith("!WARP"))
return Command.Warp(message, args, user);
}

View file

@ -15,7 +15,7 @@ namespace HISP.Game.Chat
return false;
if (!user.Administrator)
return false;
if(args[0] == "OBJECT")
if(args[0].ToUpper() == "OBJECT")
{
int itemId = 0;
try
@ -31,7 +31,7 @@ namespace HISP.Game.Chat
return false;
}
}
else if (args[0] == "MONEY")
else if (args[0].ToUpper() == "MONEY")
{
int money = 0;
try
@ -44,7 +44,7 @@ namespace HISP.Game.Chat
return false;
}
}
else if (args[0] == "QUEST")
else if (args[0].ToUpper() == "QUEST")
{
int questId = 0;
try
@ -52,7 +52,7 @@ namespace HISP.Game.Chat
questId = int.Parse(args[1]);
if(args.Length >= 3)
{
if (args[2] == "FORCE")
if (args[0].ToUpper() == "FORCE")
{
Quest.CompleteQuest(user, Quest.GetQuestById(questId));
goto msg;
@ -190,7 +190,7 @@ namespace HISP.Game.Chat
return false;
if (!user.Administrator)
return false;
if(args[0] == "PLAYER")
if(args[0].ToUpper() == "PLAYER")
{
if(args.Length < 2)
return false;
@ -204,7 +204,7 @@ namespace HISP.Game.Chat
return false;
}
}
else if(args[0] == "AREA")
else if(args[0].ToUpper() == "AREA")
{
if (args.Length < 2)
return false;
@ -230,7 +230,7 @@ namespace HISP.Game.Chat
return false;
}
}
else if(args[0] == "NPC")
else if(args[0].ToUpper() == "NPC")
{
if (args.Length < 2)
return false;
@ -362,38 +362,38 @@ namespace HISP.Game.Chat
string muteType = args[0];
if (muteType == "GLOBAL")
if (muteType.ToUpper() == "GLOBAL")
{
user.MuteGlobal = true;
} else if (muteType == "ISLAND")
} else if (muteType.ToUpper() == "ISLAND")
{
user.MuteIsland = true;
} else if (muteType == "NEAR")
} else if (muteType.ToUpper() == "NEAR")
{
user.MuteNear = true;
} else if (muteType == "HERE")
} else if (muteType.ToUpper() == "HERE")
{
user.MuteHere = true;
} else if (muteType == "BUDDY")
} else if (muteType.ToUpper() == "BUDDY")
{
user.MuteBuddy = true;
} else if (muteType == "SOCIALS")
} else if (muteType.ToUpper() == "SOCIALS")
{
user.MuteSocials = true;
}
else if (muteType == "PM")
else if (muteType.ToUpper() == "PM")
{
user.MutePrivateMessage = true;
}
else if (muteType == "BR")
else if (muteType.ToUpper() == "BR")
{
user.MuteBuddyRequests = true;
}
else if (muteType == "LOGINS")
else if (muteType.ToUpper() == "LOGINS")
{
user.MuteLogins = true;
}
else if (muteType == "ALL")
else if (muteType.ToUpper() == "ALL")
{
user.MuteAll = true;
user.MuteGlobal = true;
@ -419,5 +419,80 @@ namespace HISP.Game.Chat
return true;
}
public static bool UnMute(string message, string[] args, User user)
{
string formattedmessage = Messages.FormatPlayerCommandCompleteMessage(message.Substring(1));
if (args.Length <= 0)
{
formattedmessage += Messages.UnMuteHelp;
goto leave;
}
string muteType = args[0];
if (muteType.ToUpper() == "GLOBAL")
{
user.MuteGlobal = false;
}
else if (muteType.ToUpper() == "ISLAND")
{
user.MuteIsland = false;
}
else if (muteType.ToUpper() == "NEAR")
{
user.MuteNear = false;
}
else if (muteType.ToUpper() == "HERE")
{
user.MuteHere = false;
}
else if (muteType.ToUpper() == "BUDDY")
{
user.MuteBuddy = false;
}
else if (muteType.ToUpper() == "SOCIALS")
{
user.MuteSocials = false;
}
else if (muteType.ToUpper() == "PM")
{
user.MutePrivateMessage = false;
}
else if (muteType.ToUpper() == "BR")
{
user.MuteBuddyRequests = false;
}
else if (muteType.ToUpper() == "LOGINS")
{
user.MuteLogins = false;
}
else if (muteType.ToUpper() == "ALL")
{
user.MuteAll = false;
user.MuteGlobal = false;
user.MuteIsland = false;
user.MuteNear = false;
user.MuteHere = false;
user.MuteBuddy = false;
user.MuteSocials = false;
user.MutePrivateMessage = false;
user.MuteBuddyRequests = false;
user.MuteLogins = false;
}
else
{
formattedmessage += Messages.UnMuteHelp;
goto leave;
}
leave:;
byte[] chatPacket = PacketBuilder.CreateChat(formattedmessage, PacketBuilder.CHAT_BOTTOM_LEFT);
user.LoggedinClient.SendPacket(chatPacket);
return true;
}
}
}

View file

@ -23,6 +23,9 @@ namespace HISP.Game
public static string AddBuddyDeleteBuddyFormat;
// Mute Command
public static string NowMutingPlayerFormat;
public static string StoppedMutingPlayerFormat;
public static string PlayerIgnoringYourPrivateMessagesFormat;
public static string PlayerIgnoringYourBuddyRequests;
public static string PlayerIgnoringYourSocials;
@ -550,6 +553,7 @@ namespace HISP.Game
public static string PlayerCommandFormat;
public static string MuteHelp;
public static string UnMuteHelp;
public static string GlobalChatFormatForModerators;
public static string DirectChatFormatForModerators;
@ -967,6 +971,10 @@ namespace HISP.Game
public static string PlayerListMapAllBuddiesForamt;
public static string PlayerListMapAllPlayersFormat;
public static string MuteButton;
public static string HearButton;
public static string PmButton;
public static int ThreeMonthSubscripitionIcon;
public static int YearSubscriptionIcon;
public static int NewUserIcon;
@ -1093,7 +1101,14 @@ namespace HISP.Game
public static string NothingInterestingHere;
// Mute Command
public static string FormatStoppedMutingPlayer(string username)
{
return StoppedMutingPlayerFormat.Replace("%USERNAME%", username);
}
public static string FormatNowMutingPlayer(string username)
{
return NowMutingPlayerFormat.Replace("%USERNAME%", username);
}
public static string FormatCantSendYourIgnoringPlayer(string username)
{
return CantSendPrivateMessagePlayerMutedFormat.Replace("%USERNAME%", username);
@ -2229,10 +2244,30 @@ namespace HISP.Game
return PlayerListIconFormat.Replace("%ICON%", iconId.ToString());
}
public static string FormatPlayerEntry(string iconFormat, string username, int userId, int time, int x, int y, bool idle)
public static string FormatMuteButton(int playerId)
{
return MuteButton.Replace("%PLAYERID%", playerId.ToString());
}
public static string FormatHearButton(int playerId)
{
return HearButton.Replace("%PLAYERID%", playerId.ToString());
}
public static string FormatPmButton(string playerName)
{
return PmButton.Replace("%USERNAME%", playerName);
}
public static string FormatPlayerEntry(string iconFormat, string username, int userId, int time, int x, int y, bool idle, bool muteOrHear, bool isYou)
{
string xy = FormatMapLocation(x, y);
return PlayerListEntryFormat.Replace("%ICONFORMAT%", iconFormat).Replace("%USERNAME%", username).Replace("%PLAYERID%", userId.ToString()).Replace("%TIME%", time.ToString("N0", CultureInfo.InvariantCulture)).Replace("%MAPXY%", xy).Replace("%IDLE%", idle ? PlayerListIdle : "");
string muteButton = FormatMuteButton(userId);
string hearButton = FormatHearButton(userId);
string pmButton = FormatPmButton(username);
string msg = PlayerListEntryFormat.Replace("%ICONFORMAT%", iconFormat).Replace("%USERNAME%", username).Replace("%PLAYERID%", userId.ToString()).Replace("%TIME%", time.ToString("N0", CultureInfo.InvariantCulture)).Replace("%MAPXY%", xy).Replace("%IDLE%", idle ? PlayerListIdle : "");
if (isYou)
msg = msg.Replace("%MUTEORHEAR%", "").Replace("%PMBUTTON%", "");
else
msg = msg.Replace("%MUTEORHEAR%", muteOrHear ? hearButton : muteButton).Replace("%PMBUTTON", pmButton);
return msg;
}
public static string FormatOnlineBuddyEntry(string iconFormat, string username, int userId, int time, int x, int y)
{

View file

@ -1125,26 +1125,28 @@ namespace HISP.Game
public static string BuildNearbyList(User user)
public static string BuildNearbyList(User currentUser)
{
string message = "";
message += Messages.NearbyPlayersListHeader;
User[] nearbyUsers = GameServer.GetNearbyUsers(user.X, user.Y, false, true);
User[] nearbyUsers = GameServer.GetNearbyUsers(currentUser.X, currentUser.Y, false, true);
foreach (User nearbyUser in nearbyUsers)
{
if (nearbyUser.Stealth)
continue;
if (nearbyUser.Id == user.Id)
if (nearbyUser.Id == currentUser.Id)
continue;
bool isYou = (nearbyUser.Id == currentUser.Id);
int icon = nearbyUser.GetPlayerListIcon();
string iconFormat = "";
if (icon != -1)
iconFormat = Messages.FormatIconFormat(icon);
message += Messages.FormatPlayerEntry(iconFormat, nearbyUser.Username, nearbyUser.Id, Convert.ToInt32(Math.Round((DateTime.UtcNow - nearbyUser.LoginTime).TotalMinutes)), nearbyUser.X, nearbyUser.Y, nearbyUser.Idle);
message += Messages.FormatPlayerEntry(iconFormat, nearbyUser.Username, nearbyUser.Id, Convert.ToInt32(Math.Round((DateTime.UtcNow - nearbyUser.LoginTime).TotalMinutes)), nearbyUser.X, nearbyUser.Y, nearbyUser.Idle, currentUser.MutePlayer.IsUserMuted(nearbyUser), isYou);
}
message += Messages.PlayerListIconInformation;
@ -1154,7 +1156,7 @@ namespace HISP.Game
return message;
}
public static string BuildPlayerListAlphabetical()
public static string BuildPlayerListAlphabetical(User currentUser)
{
string message = Messages.PlayerListAllAlphabeticalHeader;
GameClient[] clients = GameServer.ConnectedClients;
@ -1175,12 +1177,13 @@ namespace HISP.Game
foreach (User onlineUser in onlineUsers)
{
bool isYou = (onlineUser.Id == currentUser.Id);
int icon = onlineUser.GetPlayerListIcon();
string iconFormat = "";
if (icon != -1)
iconFormat = Messages.FormatIconFormat(icon);
message += Messages.FormatPlayerEntry(iconFormat, onlineUser.Username, onlineUser.Id, Convert.ToInt32(Math.Round((DateTime.UtcNow - onlineUser.LoginTime).TotalMinutes)), onlineUser.X, onlineUser.Y, onlineUser.Idle);
message += Messages.FormatPlayerEntry(iconFormat, onlineUser.Username, onlineUser.Id, Convert.ToInt32(Math.Round((DateTime.UtcNow - onlineUser.LoginTime).TotalMinutes)), onlineUser.X, onlineUser.Y, onlineUser.Idle, currentUser.MutePlayer.IsUserMuted(onlineUser), isYou);
}
message += Messages.PlayerListIconInformation;
@ -1190,7 +1193,7 @@ namespace HISP.Game
return message;
}
public static string BuildPlayerList()
public static string BuildPlayerList(User currentUser)
{
string message = Messages.PlayerListAllHeader;
GameClient[] clients = GameServer.ConnectedClients;
@ -1201,12 +1204,14 @@ namespace HISP.Game
if (client.LoggedinUser.Stealth)
continue;
bool isYou = (client.LoggedinUser.Id == currentUser.Id);
int icon = client.LoggedinUser.GetPlayerListIcon();
string iconFormat = "";
if (icon != -1)
iconFormat = Messages.FormatIconFormat(icon);
message += Messages.FormatPlayerEntry(iconFormat, client.LoggedinUser.Username, client.LoggedinUser.Id, Convert.ToInt32(Math.Round((DateTime.UtcNow - client.LoggedinUser.LoginTime).TotalMinutes)), client.LoggedinUser.X, client.LoggedinUser.Y, client.LoggedinUser.Idle);
message += Messages.FormatPlayerEntry(iconFormat, client.LoggedinUser.Username, client.LoggedinUser.Id, Convert.ToInt32(Math.Round((DateTime.UtcNow - client.LoggedinUser.LoginTime).TotalMinutes)), client.LoggedinUser.X, client.LoggedinUser.Y, client.LoggedinUser.Idle, currentUser.MutePlayer.IsUserMuted(client.LoggedinUser), isYou);
}
}
@ -2074,7 +2079,7 @@ namespace HISP.Game
message += Messages.MetaTerminator;
return message;
}
public static string BuildPlayerList(User user)
public static string BuildPlayerListMenu(User user)
{
string message = "";

View file

@ -573,7 +573,7 @@ namespace HISP.Server
{
db.Open();
MySqlCommand sqlCommand = db.CreateCommand();
sqlCommand.CommandText = "DELETE FROM MutedPlayers WHERE playerId=@playerId AND mutePlayerId=@mutedPlayerId)";
sqlCommand.CommandText = "DELETE FROM MutedPlayers WHERE playerId=@playerId AND mutePlayerId=@mutedPlayerId";
sqlCommand.Parameters.AddWithValue("@playerId", playerId);
sqlCommand.Parameters.AddWithValue("@mutedPlayerId", playerToMute);
sqlCommand.Prepare();

View file

@ -843,6 +843,10 @@ namespace HISP.Server
Messages.AutoSellYouSoldHorseOfflineFormat = gameData.messages.meta.auto_sell.sold_offline;
// Mute Command
Messages.NowMutingPlayerFormat = gameData.messages.meta.mute_command.now_ignoring_player;
Messages.StoppedMutingPlayerFormat = gameData.messages.meta.mute_command.stop_ignoring_player;
Messages.PlayerIgnoringYourPrivateMessagesFormat = gameData.messages.meta.mute_command.player_ignoring_your_pm;
Messages.PlayerIgnoringYourBuddyRequests = gameData.messages.meta.mute_command.player_ignoring_your_br;
Messages.PlayerIgnoringYourSocials = gameData.messages.meta.mute_command.player_ignoring_your_socials;
@ -1672,6 +1676,7 @@ namespace HISP.Server
Messages.AdminCommandFormat = gameData.messages.commands.admin_command_completed;
Messages.PlayerCommandFormat = gameData.messages.commands.player_command_completed;
Messages.MuteHelp = gameData.messages.commands.mute_help;
Messages.UnMuteHelp = gameData.messages.commands.unmute_help;
Messages.PasswordNotice = gameData.messages.chat.password_included;
@ -1745,6 +1750,10 @@ namespace HISP.Server
Messages.PlayerListMapAllPlayersFormat = gameData.messages.meta.player_list.map_all_players_format;
Messages.PlayerListAbuseReport = gameData.messages.meta.player_list.abuse_report;
Messages.MuteButton = gameData.messages.meta.player_list.mute_button;
Messages.HearButton = gameData.messages.meta.player_list.hear_button;
Messages.PmButton = gameData.messages.meta.player_list.pm_button;
Messages.ThreeMonthSubscripitionIcon = gameData.messages.meta.player_list.icon_subbed_3month;
Messages.YearSubscriptionIcon = gameData.messages.meta.player_list.icon_subbed_year;
Messages.NewUserIcon = gameData.messages.meta.player_list.icon_new;

View file

@ -269,6 +269,62 @@ namespace HISP.Server
sender.SendPacket(metaTag);
}
break;
case PacketBuilder.PLAYER_INTERACTION_MUTE:
packetStr = Encoding.UTF8.GetString(packet);
playerIdStr = packetStr.Substring(2, packetStr.Length - 4);
playerId = -1;
try
{
playerId = int.Parse(playerIdStr);
}
catch (FormatException)
{
Logger.ErrorPrint(sender.LoggedinUser.Username + " tried to MUTE User ID NaN.");
break;
}
if (IsUserOnline(playerId))
{
User user = GetUserById(playerId);
if(!sender.LoggedinUser.MutePlayer.IsUserMuted(user))
sender.LoggedinUser.MutePlayer.MuteUser(user);
byte[] nowMuting = PacketBuilder.CreateChat(Messages.FormatNowMutingPlayer(user.Username), PacketBuilder.CHAT_BOTTOM_RIGHT);
sender.SendPacket(nowMuting);
sender.LoggedinUser.MetaPriority = true;
byte[] metaPacket = PacketBuilder.CreateMetaPacket(Meta.BuildPlayerListMenu(sender.LoggedinUser));
sender.SendPacket(metaPacket);
}
break;
case PacketBuilder.PLAYER_INTERACTION_UNMUTE:
packetStr = Encoding.UTF8.GetString(packet);
playerIdStr = packetStr.Substring(2, packetStr.Length - 4);
playerId = -1;
try
{
playerId = int.Parse(playerIdStr);
}
catch (FormatException)
{
Logger.ErrorPrint(sender.LoggedinUser.Username + " tried to UNMUTE User ID NaN.");
break;
}
if (IsUserOnline(playerId))
{
User user = GetUserById(playerId);
if (sender.LoggedinUser.MutePlayer.IsUserMuted(user))
sender.LoggedinUser.MutePlayer.UnmuteUser(user);
byte[] nowMuting = PacketBuilder.CreateChat(Messages.FormatStoppedMutingPlayer(user.Username), PacketBuilder.CHAT_BOTTOM_RIGHT);
sender.SendPacket(nowMuting);
sender.LoggedinUser.MetaPriority = true;
byte[] metaPacket = PacketBuilder.CreateMetaPacket(Meta.BuildPlayerListMenu(sender.LoggedinUser));
sender.SendPacket(metaPacket);
}
break;
case PacketBuilder.PLAYER_INTERACTION_REMOVE_BUDDY:
packetStr = Encoding.UTF8.GetString(packet);
playerIdStr = packetStr.Substring(2, packetStr.Length - 4);
@ -292,7 +348,7 @@ namespace HISP.Server
sender.SendPacket(friendRemoved);
sender.LoggedinUser.MetaPriority = true;
byte[] metaPacket = PacketBuilder.CreateMetaPacket(Meta.BuildPlayerList(sender.LoggedinUser));
byte[] metaPacket = PacketBuilder.CreateMetaPacket(Meta.BuildPlayerListMenu(sender.LoggedinUser));
sender.SendPacket(metaPacket);
}
@ -2500,7 +2556,7 @@ namespace HISP.Server
{
case PacketBuilder.PLAYERINFO_PLAYER_LIST:
sender.LoggedinUser.MetaPriority = true;
byte[] metaPacket = PacketBuilder.CreateMetaPacket(Meta.BuildPlayerList(sender.LoggedinUser));
byte[] metaPacket = PacketBuilder.CreateMetaPacket(Meta.BuildPlayerListMenu(sender.LoggedinUser));
sender.SendPacket(metaPacket);
break;
}
@ -2805,12 +2861,12 @@ namespace HISP.Server
break;
case "37": // All Players List
sender.LoggedinUser.MetaPriority = true;
metaPacket = PacketBuilder.CreateMetaPacket(Meta.BuildPlayerList());
metaPacket = PacketBuilder.CreateMetaPacket(Meta.BuildPlayerList(sender.LoggedinUser));
sender.SendPacket(metaPacket);
break;
case "40": // All Players Alphabetical
sender.LoggedinUser.MetaPriority = true;
metaPacket = PacketBuilder.CreateMetaPacket(Meta.BuildPlayerListAlphabetical());
metaPacket = PacketBuilder.CreateMetaPacket(Meta.BuildPlayerListAlphabetical(sender.LoggedinUser));
sender.SendPacket(metaPacket);
break;
case "30": // Find NPC

View file

@ -64,6 +64,8 @@ namespace HISP.Server
public const byte PLAYER_INTERACTION_TRADE_REJECT = 0x2B;
public const byte PLAYER_INTERACTION_ADD_BUDDY = 0x1E;
public const byte PLAYER_INTERACTION_REMOVE_BUDDY = 0x1F;
public const byte PLAYER_INTERACTION_MUTE = 0x32;
public const byte PLAYER_INTERACTION_UNMUTE = 0x33;
public const byte AUCTION_BID_100 = 0x29;
public const byte AUCTION_BID_1K = 0x2A;