mirror of
https://github.com/islehorse/HISP.git
synced 2025-04-23 05:05:53 +12:00
added 1 mute command. Added MuteAll flag but not..
...Handled
This commit is contained in:
parent
eae1f4f119
commit
bf92ccb0cd
6 changed files with 80 additions and 7 deletions
|
@ -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
|
||||
{
|
52
Horse Isle Server/Horse Isle Server/Game/Chat/Command.cs
Normal file
52
Horse Isle Server/Horse Isle Server/Game/Chat/Command.cs
Normal 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;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -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;
|
||||
|
||||
|
@ -238,7 +240,10 @@ namespace HISP.Game
|
|||
{
|
||||
return StatsCompetitionGearFormat.Replace("%GEARFORMAT%", competitonGearFormat);
|
||||
}
|
||||
|
||||
public static string FormatCommandComplete(string command)
|
||||
{
|
||||
return CommandFormat.Replace("%COMMAND%", command);
|
||||
}
|
||||
|
||||
|
||||
public static string FormatYouEarnedAnItemMessage(string itemName)
|
||||
|
@ -327,7 +332,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);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue