mirror of
https://github.com/islehorse/HISP.git
synced 2025-04-07 21:55:42 +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.Player;
|
||||||
using HISP.Server;
|
using HISP.Server;
|
||||||
|
|
||||||
namespace HISP.Game
|
namespace HISP.Game.Chat
|
||||||
{
|
{
|
||||||
class Chat
|
class Chat
|
||||||
{
|
{
|
||||||
|
@ -49,13 +49,19 @@ namespace HISP.Game
|
||||||
if (message.Length < 1)
|
if (message.Length < 1)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
string[] args = message.Split(' ').Skip(1).ToArray();
|
||||||
|
|
||||||
if (user.Administrator || user.Moderator)
|
if (user.Administrator || user.Moderator)
|
||||||
if (message[0] == '%')
|
if (message[0] == '%')
|
||||||
return true;
|
return false;
|
||||||
if (message[0] == '!')
|
if (message[0] == '!')
|
||||||
return true;
|
{
|
||||||
|
if (message.StartsWith("!MUTE"))
|
||||||
|
{
|
||||||
|
return Command.Mute(message, args, user);
|
||||||
|
}
|
||||||
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
}
|
}
|
||||||
public static Object FilterMessage(string message) // Handles chat filtering and violation stuffs returns
|
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 ModChatFormat;
|
||||||
public static string AdminChatFormat;
|
public static string AdminChatFormat;
|
||||||
|
|
||||||
|
public static string CommandFormat;
|
||||||
|
|
||||||
public static string GlobalChatFormatForModerators;
|
public static string GlobalChatFormatForModerators;
|
||||||
public static string DirectChatFormatForModerators;
|
public static string DirectChatFormatForModerators;
|
||||||
|
|
||||||
|
@ -238,7 +240,10 @@ namespace HISP.Game
|
||||||
{
|
{
|
||||||
return StatsCompetitionGearFormat.Replace("%GEARFORMAT%", competitonGearFormat);
|
return StatsCompetitionGearFormat.Replace("%GEARFORMAT%", competitonGearFormat);
|
||||||
}
|
}
|
||||||
|
public static string FormatCommandComplete(string command)
|
||||||
|
{
|
||||||
|
return CommandFormat.Replace("%COMMAND%", command);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public static string FormatYouEarnedAnItemMessage(string itemName)
|
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());
|
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);
|
return ChatViolationMessageFormat.Replace("%AMOUNT%", RequiredChatViolations.ToString()).Replace("%REASON%", violationReason.Message);
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,6 +22,7 @@ namespace HISP.Player
|
||||||
public bool MutePrivateMessage = false;
|
public bool MutePrivateMessage = false;
|
||||||
public bool MuteBuddyRequests = false;
|
public bool MuteBuddyRequests = false;
|
||||||
public bool MuteSocials = false;
|
public bool MuteSocials = false;
|
||||||
|
public bool MuteAll = false;
|
||||||
public bool MuteLogins = false;
|
public bool MuteLogins = false;
|
||||||
public string Gender;
|
public string Gender;
|
||||||
public bool MetaPriority = false;
|
public bool MetaPriority = false;
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using HISP.Game;
|
using HISP.Game;
|
||||||
|
using HISP.Game.Chat;
|
||||||
|
|
||||||
namespace HISP.Server
|
namespace HISP.Server
|
||||||
{
|
{
|
||||||
|
@ -453,6 +454,7 @@ namespace HISP.Server
|
||||||
Messages.ModChatFormatForSender = gameData.messages.chat.for_sender.mod_format;
|
Messages.ModChatFormatForSender = gameData.messages.chat.for_sender.mod_format;
|
||||||
Messages.AdminChatFormatForSender = gameData.messages.chat.for_sender.admin_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.PasswordNotice = gameData.messages.chat.password_included;
|
||||||
Messages.CapsNotice = gameData.messages.chat.caps_notice;
|
Messages.CapsNotice = gameData.messages.chat.caps_notice;
|
||||||
|
|
|
@ -8,6 +8,7 @@ using System.Threading;
|
||||||
using HISP.Player;
|
using HISP.Player;
|
||||||
using HISP.Game;
|
using HISP.Game;
|
||||||
using HISP.Security;
|
using HISP.Security;
|
||||||
|
using HISP.Game.Chat;
|
||||||
|
|
||||||
namespace HISP.Server
|
namespace HISP.Server
|
||||||
{
|
{
|
||||||
|
@ -606,6 +607,12 @@ namespace HISP.Server
|
||||||
Chat.ChatChannel channel = (Chat.ChatChannel)packet[1];
|
Chat.ChatChannel channel = (Chat.ChatChannel)packet[1];
|
||||||
string message = packetStr.Substring(2, packetStr.Length - 4);
|
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());
|
Logger.DebugPrint(sender.LoggedinUser.Username + " Attempting to say '" + message + "' in channel: " + channel.ToString());
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue