public static PlayerSpeechPacket Parse(NetworkMessage message)
        {
            PlayerSpeechPacket packet = new PlayerSpeechPacket();

            packet.Speech      = new Speech();
            packet.Speech.Type = (SpeechType)message.GetByte();

            switch (packet.Speech.Type)
            {
            case SpeechType.Private:
            case SpeechType.PrivateRed:
            case SpeechType.RuleViolationAnswer:
                packet.Speech.Receiver = message.GetString();
                break;

            case SpeechType.ChannelYellow:
            case SpeechType.ChannelRed:
            case SpeechType.ChannelRedAnonymous:
            case SpeechType.ChannelWhite:
                packet.Speech.ChannelId = (ChatChannel)message.GetUInt16();
                break;

            default:
                break;
            }

            packet.Speech.Message = message.GetString();

            return(packet);
        }
        bool ReceivedPlayerSpeechOutgoingPacket(OutgoingPacket packet)
        {
            PlayerSpeechPacket p = (PlayerSpeechPacket)packet;

            if (p.SpeechType == SpeechType.ChannelYellow &&
                p.ChannelId == ChatChannel.Custom)
            {
                CreatureSpeechPacket.Send(
                    client,
                    "$",
                    0,
                    p.Message,
                    SpeechType.ChannelOrange,
                    ChatChannel.Custom);
                Out(p.Message);
                return(false);
            }
            else
            {
                return(true);
            }
        }
Beispiel #3
0
        public void ParsePlayerSpeech(NetworkMessage message)
        {
            PlayerSpeechPacket packet = PlayerSpeechPacket.Parse(message);

            Game.CreatureSpeech(this.Player, packet.Speech);
        }