public override bool ParseMessage(NetworkMessage msg, PacketDestination destination) { if (msg.GetByte() != (byte)OutgoingPacketType.PlayerSpeech) { return(false); } Destination = destination; Type = OutgoingPacketType.PlayerSpeech; SpeechTypeInfo info = Enums.GetSpeechTypeInfo(Client.VersionNumber, msg.GetByte()); SpeechType = info.SpeechType; if (SpeechType == SpeechType.Private) { Receiver = msg.GetString(); } else if (info.AdditionalSpeechData == AdditionalSpeechData.ChannelId) { ChannelId = (ChatChannel)msg.GetUInt16(); } Message = msg.GetString(); return(true); }
public override void ToNetworkMessage(NetworkMessage msg) { msg.AddByte((byte)Type); msg.AddUInt32(Unknown); msg.AddString(SenderName); msg.AddUInt16(SenderLevel); SpeechTypeInfo info = Enums.GetSpeechTypeInfo(Client.GetVersionNumber(), SpeechType); msg.AddByte(info.Value); switch (info.AdditionalSpeechData) { case AdditionalSpeechData.Location: msg.AddLocation(Position); break; case AdditionalSpeechData.ChannelId: msg.AddUInt16((ushort)ChannelId); break; case AdditionalSpeechData.Time: msg.AddUInt32(Time); break; default: break; } msg.AddString(Message); }
public override void ToNetworkMessage(NetworkMessage msg) { msg.AddByte((byte)Type); SpeechTypeInfo info = Enums.GetSpeechTypeInfo(Client.VersionNumber, SpeechType); msg.AddByte(info.Value); if (SpeechType == SpeechType.Private) { msg.AddString(Receiver); } else if (info.AdditionalSpeechData == AdditionalSpeechData.ChannelId) { msg.AddUInt16((ushort)ChannelId); } msg.AddString(Message); }
public override bool ParseMessage(NetworkMessage msg, PacketDestination destination) { int position = msg.Position; if (msg.GetByte() != (byte)IncomingPacketType.CreatureSpeech) { return(false); } Destination = destination; Type = IncomingPacketType.CreatureSpeech; Unknown = msg.GetUInt32(); SenderName = msg.GetString(); SenderLevel = msg.GetUInt16(); SpeechTypeInfo info = Enums.GetSpeechTypeInfo(Client.GetVersionNumber(), msg.GetByte()); SpeechType = info.SpeechType; switch (info.AdditionalSpeechData) { case AdditionalSpeechData.Location: Position = msg.GetLocation(); break; case AdditionalSpeechData.ChannelId: ChannelId = (ChatChannel)msg.GetUInt16(); break; case AdditionalSpeechData.Time: Time = msg.GetUInt32(); break; default: break; } Message = msg.GetString(); return(true); }