Overwrite

Complete Overwrite of the Folder with the free shard. ServUO 57.3 has been added.
This commit is contained in:
Unstable Kitsune
2023-11-28 23:20:26 -05:00
parent 3cd54811de
commit b918192e4e
11608 changed files with 2644205 additions and 47 deletions

View File

@@ -0,0 +1,91 @@
using System;
using System.IO;
using Server.Network;
namespace Server.Engines.Chat
{
public class ChatSystem
{
public static readonly bool Enabled = Config.Get("Chat.Enabled", true);
public static readonly bool AllowCreateChannels = Config.Get("Chat.AllowCreateChannels", true);
public static readonly string DefaultChannel = "Help";
public static void Initialize()
{
PacketHandlers.Register(0xB5, 0x40, true, OpenChatWindowRequest);
PacketHandlers.Register(0xB3, 0, true, ChatAction);
}
public static void OpenChatWindowRequest(NetState state, PacketReader pvSrc)
{
var from = state.Mobile;
if (!Enabled)
{
from.SendMessage("The chat system has been disabled.");
return;
}
//pvSrc.Seek(2, SeekOrigin.Begin);
///*string chatName = */pvSrc.ReadUnicodeStringSafe((0x40 - 2) >> 1).Trim();
var chatName = from.Name;
SendCommandTo(from, ChatCommand.OpenChatWindow, chatName);
ChatUser.AddChatUser(from);
}
public static void ChatAction(NetState state, PacketReader pvSrc)
{
if (!Enabled)
return;
try
{
var from = state.Mobile;
var user = ChatUser.GetChatUser(from);
if (user == null)
return;
var lang = pvSrc.ReadStringSafe(4);
var actionId = pvSrc.ReadInt16();
var param = pvSrc.ReadUnicodeString();
var handler = ChatActionHandlers.GetHandler(actionId);
if (handler != null)
{
var channel = user.CurrentChannel;
if (handler.RequireConference && channel == null)
{
/* You must be in a conference to do this.
* To join a conference, select one from the Conference menu.
*/
user.SendMessage(31);
}
else
{
handler.Callback(user, channel, param);
}
}
else
{
Console.WriteLine("Client: {0}: Unknown chat action 0x{1:X}: {2}", state, actionId, param);
}
}
catch (Exception e)
{
Console.WriteLine(e);
}
}
public static void SendCommandTo(Mobile to, ChatCommand type, string param1 = null, string param2 = null)
{
if (to != null)
to.Send(new ChatMessagePacket(null, (int)type + 20, param1, param2));
}
}
}