예제 #1
0
        public IPacket BuildChatPacket(ChatType chatType,
                                       string chat,
                                       string targetCharacter)
        {
            IPacketBuilder packetBuilder = new PacketBuilder(PacketFamily.Talk, GetActionFromType(chatType));

            if (chatType == ChatType.PM)
            {
                if (string.IsNullOrEmpty(targetCharacter))
                {
                    throw new ArgumentException("Target character for PM must not be null or empty", nameof(targetCharacter));
                }
                packetBuilder = packetBuilder.AddBreakString(targetCharacter);
            }

            packetBuilder = packetBuilder.AddString(chat);
            return(packetBuilder.Build());
        }