This commit is contained in:
SilicaAndPina 2020-12-23 01:10:04 +13:00
commit 0ced614301
7 changed files with 82 additions and 8 deletions

View file

@ -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
{

View file

@ -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;
}
}
}

View file

@ -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);
}