mirror of
https://github.com/islehorse/HISP.git
synced 2025-04-08 22:25:42 +12:00
Merge branch 'master' of https://github.com/KuromeSan/HorseIsle-Server
This commit is contained in:
commit
0ced614301
7 changed files with 82 additions and 8 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;
|
||||||
|
|
||||||
|
@ -239,7 +241,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 FormatEquipItemMessage(string name)
|
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());
|
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);
|
||||||
}
|
}
|
||||||
|
|
|
@ -72,6 +72,7 @@
|
||||||
<Reference Include="System.Xml" />
|
<Reference Include="System.Xml" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<Compile Include="Game\Chat\Command.cs" />
|
||||||
<Compile Include="Game\GameExceptions.cs" />
|
<Compile Include="Game\GameExceptions.cs" />
|
||||||
<Compile Include="Game\Inventory\InventoryItem.cs" />
|
<Compile Include="Game\Inventory\InventoryItem.cs" />
|
||||||
<Compile Include="Game\Quest.cs" />
|
<Compile Include="Game\Quest.cs" />
|
||||||
|
@ -84,7 +85,7 @@
|
||||||
<DependentUpon>Resources.resx</DependentUpon>
|
<DependentUpon>Resources.resx</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
<Compile Include="Security\Authentication.cs" />
|
<Compile Include="Security\Authentication.cs" />
|
||||||
<Compile Include="Game\Chat.cs" />
|
<Compile Include="Game\Chat\Chat.cs" />
|
||||||
<Compile Include="Server\GameClient.cs" />
|
<Compile Include="Server\GameClient.cs" />
|
||||||
<Compile Include="Server\Converters.cs" />
|
<Compile Include="Server\Converters.cs" />
|
||||||
<Compile Include="Server\Database.cs" />
|
<Compile Include="Server\Database.cs" />
|
||||||
|
|
|
@ -23,6 +23,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
|
||||||
{
|
{
|
||||||
|
@ -452,7 +453,8 @@ namespace HISP.Server
|
||||||
Messages.DirectChatFormatForSender = gameData.messages.chat.for_sender.dm_format;
|
Messages.DirectChatFormatForSender = gameData.messages.chat.for_sender.dm_format;
|
||||||
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
|
||||||
{
|
{
|
||||||
|
@ -605,6 +606,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