diff --git a/Horse Isle Server/Horse Isle Server/Game/Chat.cs b/Horse Isle Server/Horse Isle Server/Game/Chat/Chat.cs
similarity index 98%
rename from Horse Isle Server/Horse Isle Server/Game/Chat.cs
rename to Horse Isle Server/Horse Isle Server/Game/Chat/Chat.cs
index ce796b5..e940ea3 100644
--- a/Horse Isle Server/Horse Isle Server/Game/Chat.cs
+++ b/Horse Isle Server/Horse Isle Server/Game/Chat/Chat.cs
@@ -4,7 +4,7 @@ using System.Linq;
using HISP.Player;
using HISP.Server;
-namespace HISP.Game
+namespace HISP.Game.Chat
{
class Chat
{
@@ -49,13 +49,19 @@ namespace HISP.Game
if (message.Length < 1)
return false;
+ string[] args = message.Split(' ').Skip(1).ToArray();
+
if (user.Administrator || user.Moderator)
if (message[0] == '%')
- return true;
+ return false;
if (message[0] == '!')
- return true;
+ {
+ if (message.StartsWith("!MUTE"))
+ {
+ return Command.Mute(message, args, user);
+ }
+ }
return false;
-
}
public static Object FilterMessage(string message) // Handles chat filtering and violation stuffs returns
{
diff --git a/Horse Isle Server/Horse Isle Server/Game/Chat/Command.cs b/Horse Isle Server/Horse Isle Server/Game/Chat/Command.cs
new file mode 100644
index 0000000..5ead701
--- /dev/null
+++ b/Horse Isle Server/Horse Isle Server/Game/Chat/Command.cs
@@ -0,0 +1,52 @@
+using HISP.Player;
+using HISP.Server;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace HISP.Game.Chat
+{
+ class Command
+ {
+
+ public static bool Mute(string message, string[] args, User user)
+ {
+ string muteType = args[0];
+
+ if (muteType == "GLOBAL")
+ {
+ user.MuteGlobal = true;
+ } else if (muteType == "ISLAND")
+ {
+ user.MuteIsland = true;
+ } else if (muteType == "NEAR")
+ {
+ user.MuteNear = true;
+ } else if (muteType == "HERE")
+ {
+ user.MuteHere = true;
+ } else if (muteType == "BUDDY")
+ {
+ user.MuteBuddy = true;
+ } else if (muteType == "SOCIALS")
+ {
+ user.MuteSocials = true;
+ } else if (muteType == "ALL")
+ {
+ user.MuteAll = true;
+ } else
+ {
+ return false;
+ }
+
+ byte[] chatPacket = PacketBuilder.CreateChat(Messages.FormatCommandComplete(message.Substring(1)), PacketBuilder.CHAT_BOTTOM_LEFT);
+
+ user.LoggedinClient.SendPacket(chatPacket);
+
+
+ return true;
+ }
+ }
+}
diff --git a/Horse Isle Server/Horse Isle Server/Game/Messages.cs b/Horse Isle Server/Horse Isle Server/Game/Messages.cs
index 16d5726..dd93537 100644
--- a/Horse Isle Server/Horse Isle Server/Game/Messages.cs
+++ b/Horse Isle Server/Horse Isle Server/Game/Messages.cs
@@ -68,6 +68,8 @@ namespace HISP.Game
public static string ModChatFormat;
public static string AdminChatFormat;
+ public static string CommandFormat;
+
public static string GlobalChatFormatForModerators;
public static string DirectChatFormatForModerators;
@@ -239,7 +241,10 @@ namespace HISP.Game
{
return StatsCompetitionGearFormat.Replace("%GEARFORMAT%", competitonGearFormat);
}
-
+ public static string FormatCommandComplete(string command)
+ {
+ return CommandFormat.Replace("%COMMAND%", command);
+ }
public static string FormatEquipItemMessage(string name)
{
@@ -334,7 +339,7 @@ namespace HISP.Game
return NpcStartChatFormat.Replace("%ICONID%", iconId.ToString()).Replace("%NAME%", name).Replace("%DESCRIPTION%", shortDescription).Replace("%ID%", npcId.ToString());
}
- public static string FormatGlobalChatViolationMessage(Chat.Reason violationReason)
+ public static string FormatGlobalChatViolationMessage(Chat.Chat.Reason violationReason)
{
return ChatViolationMessageFormat.Replace("%AMOUNT%", RequiredChatViolations.ToString()).Replace("%REASON%", violationReason.Message);
}
diff --git a/Horse Isle Server/Horse Isle Server/Horse Isle Server.csproj b/Horse Isle Server/Horse Isle Server/Horse Isle Server.csproj
index 13faa9b..079f104 100644
--- a/Horse Isle Server/Horse Isle Server/Horse Isle Server.csproj
+++ b/Horse Isle Server/Horse Isle Server/Horse Isle Server.csproj
@@ -72,6 +72,7 @@
+
@@ -84,7 +85,7 @@
Resources.resx
-
+
diff --git a/Horse Isle Server/Horse Isle Server/Player/User.cs b/Horse Isle Server/Horse Isle Server/Player/User.cs
index 1be9750..62dc7d0 100644
--- a/Horse Isle Server/Horse Isle Server/Player/User.cs
+++ b/Horse Isle Server/Horse Isle Server/Player/User.cs
@@ -23,6 +23,7 @@ namespace HISP.Player
public bool MutePrivateMessage = false;
public bool MuteBuddyRequests = false;
public bool MuteSocials = false;
+ public bool MuteAll = false;
public bool MuteLogins = false;
public string Gender;
public bool MetaPriority = false;
diff --git a/Horse Isle Server/Horse Isle Server/Server/GameDataJson.cs b/Horse Isle Server/Horse Isle Server/Server/GameDataJson.cs
index 6de8764..5faed57 100644
--- a/Horse Isle Server/Horse Isle Server/Server/GameDataJson.cs
+++ b/Horse Isle Server/Horse Isle Server/Server/GameDataJson.cs
@@ -2,6 +2,7 @@
using System.IO;
using Newtonsoft.Json;
using HISP.Game;
+using HISP.Game.Chat;
namespace HISP.Server
{
@@ -452,7 +453,8 @@ namespace HISP.Server
Messages.DirectChatFormatForSender = gameData.messages.chat.for_sender.dm_format;
Messages.ModChatFormatForSender = gameData.messages.chat.for_sender.mod_format;
Messages.AdminChatFormatForSender = gameData.messages.chat.for_sender.admin_format;
-
+
+ Messages.CommandFormat = gameData.messages.commands.command_completed;
Messages.PasswordNotice = gameData.messages.chat.password_included;
Messages.CapsNotice = gameData.messages.chat.caps_notice;
diff --git a/Horse Isle Server/Horse Isle Server/Server/GameServer.cs b/Horse Isle Server/Horse Isle Server/Server/GameServer.cs
index e9ce69c..c479770 100644
--- a/Horse Isle Server/Horse Isle Server/Server/GameServer.cs
+++ b/Horse Isle Server/Horse Isle Server/Server/GameServer.cs
@@ -8,6 +8,7 @@ using System.Threading;
using HISP.Player;
using HISP.Game;
using HISP.Security;
+using HISP.Game.Chat;
namespace HISP.Server
{
@@ -605,6 +606,12 @@ namespace HISP.Server
Chat.ChatChannel channel = (Chat.ChatChannel)packet[1];
string message = packetStr.Substring(2, packetStr.Length - 4);
+
+ if (Chat.ProcessCommand(sender.LoggedinUser, message))
+ {
+ Logger.DebugPrint(sender.LoggedinUser.Username + " Attempting to run command '" + message + "' in channel: " + channel.ToString());
+ return;
+ }
Logger.DebugPrint(sender.LoggedinUser.Username + " Attempting to say '" + message + "' in channel: " + channel.ToString());