Beispiel #1
0
        public static void ShoutHandler(ZoneClient client, Packet packet)
        {
            ZoneCharacter character = client.Character;
            byte          len;
            string        message;

            if (!packet.TryReadByte(out len) ||
                !packet.TryReadString(out message, len))
            {
                Log.WriteLine(LogLevel.Warn, "Could not read shout from {0}.", character.Name);
                return;
            }

            int shoutcheck = character.ShoutCheck();

            if (shoutcheck > 0)
            {
                Handler2.SendChatBlock(character, shoutcheck);
            }
            else
            {
                ChatLog.Instance.LogChat(client.Character.Name, message, true);
                using (var broad = Shout(character.Name, message))
                {
                    character.Map.Broadcast(broad);
                }
            }
        }
Beispiel #2
0
        public static void NormalChatHandler(ZoneClient client, Packet packet)
        {
            byte   len;
            string text;

            if (!packet.TryReadByte(out len) || !packet.TryReadString(out text, len))
            {
                Log.WriteLine(LogLevel.Warn, "Could not parse normal chat from {0}.", client.Character.Name);
                return;
            }
            if (client.Admin > 0 && (text.StartsWith("&") || text.StartsWith("/")))
            {
                CommandLog.Instance.LogCommand(client.Character.Name, text);
                CommandStatus status = CommandHandler.Instance.ExecuteCommand(client.Character, text.Split(' '));
                switch (status)
                {
                case CommandStatus.ERROR:
                    client.Character.DropMessage("Error executing command.");
                    break;

                case CommandStatus.GM_LEVEL_TOO_LOW:
                    client.Character.DropMessage("You do not have the privileges for this command.");
                    break;

                case CommandStatus.NOT_FOUND:
                    client.Character.DropMessage("Command not found.");
                    break;
                }
            }
            else
            {
                int chatblock = client.Character.ChatCheck();
                if (chatblock == -1)
                {
                    ChatLog.Instance.LogChat(client.Character.Name, text, false);
                    SendNormalChat(client.Character, text, client.Admin > 0 ? (byte)0x03 : (byte)0x2a);
                }
                else
                {
                    Handler2.SendChatBlock(client.Character, chatblock);
                }
            }
        }