Exemplo n.º 1
0
        public PacketClass BuildPartyMemberStatsOffline(ulong guid)
        {
            var packet = new PacketClass(Opcodes.SMSG_PARTY_MEMBER_STATS_FULL);

            packet.AddPackGuid(guid);
            packet.AddUInt32((uint)PartyMemberStatsFlag.GROUP_UPDATE_FLAG_STATUS);
            packet.AddInt8((byte)PartyMemberStatsStatus.STATUS_OFFLINE);
            return(packet);
        }
Exemplo n.º 2
0
        public void SendProficiency(ClientClass client, byte proficiencyType, int proficiencyFlags)
        {
            var packet = new PacketClass(Opcodes.SMSG_SET_PROFICIENCY);

            try
            {
                packet.AddInt8(proficiencyType);
                packet.AddInt32(proficiencyFlags);
                client.Send(packet);
            }
            finally
            {
                packet.Dispose();
            }

            _clusterServiceLocator.WorldCluster.Log.WriteLine(LogType.DEBUG, "[{0}:{1}] SMSG_SET_PROFICIENCY", client.IP, client.Port);
        }
Exemplo n.º 3
0
        public PacketClass BuildChatMessage(ulong senderGuid, string message, ChatMsg msgType, LANGUAGES msgLanguage, byte flag = 0, string msgChannel = "Global")
        {
            var packet = new PacketClass(Opcodes.SMSG_MESSAGECHAT);

            try
            {
                packet.AddInt8((byte)msgType);
                packet.AddInt32((int)msgLanguage);
                switch (msgType)
                {
                case var @case when @case == ChatMsg.CHAT_MSG_CHANNEL:
                {
                    packet.AddString(msgChannel);
                    packet.AddUInt32(0U);
                    packet.AddUInt64(senderGuid);
                    break;
                }

                case var case1 when case1 == ChatMsg.CHAT_MSG_YELL:
                case var case2 when case2 == ChatMsg.CHAT_MSG_SAY:
                case var case3 when case3 == ChatMsg.CHAT_MSG_PARTY:
                {
                    packet.AddUInt64(senderGuid);
                    packet.AddUInt64(senderGuid);
                    break;
                }

                case var case4 when case4 == ChatMsg.CHAT_MSG_SYSTEM:
                case var case5 when case5 == ChatMsg.CHAT_MSG_EMOTE:
                case var case6 when case6 == ChatMsg.CHAT_MSG_IGNORED:
                case var case7 when case7 == ChatMsg.CHAT_MSG_SKILL:
                case var case8 when case8 == ChatMsg.CHAT_MSG_GUILD:
                case var case9 when case9 == ChatMsg.CHAT_MSG_OFFICER:
                case var case10 when case10 == ChatMsg.CHAT_MSG_RAID:
                case var case11 when case11 == ChatMsg.CHAT_MSG_WHISPER_INFORM:
                case var case12 when case12 == ChatMsg.CHAT_MSG_GUILD:
                case var case13 when case13 == ChatMsg.CHAT_MSG_WHISPER:
                case var case14 when case14 == ChatMsg.CHAT_MSG_AFK:
                case var case15 when case15 == ChatMsg.CHAT_MSG_DND:
                case var case16 when case16 == ChatMsg.CHAT_MSG_RAID_LEADER:
                case var case17 when case17 == ChatMsg.CHAT_MSG_RAID_WARNING:
                {
                    packet.AddUInt64(senderGuid);
                    break;
                }

                case var case18 when case18 == ChatMsg.CHAT_MSG_MONSTER_SAY:
                case var case19 when case19 == ChatMsg.CHAT_MSG_MONSTER_EMOTE:
                case var case20 when case20 == ChatMsg.CHAT_MSG_MONSTER_YELL:
                {
                    _clusterServiceLocator.WorldCluster.Log.WriteLine(LogType.WARNING, "Use Creature.SendChatMessage() for this message type - {0}!", msgType);
                    break;
                }

                default:
                {
                    _clusterServiceLocator.WorldCluster.Log.WriteLine(LogType.WARNING, "Unknown chat message type - {0}!", msgType);
                    break;
                }
                }

                packet.AddUInt32((uint)(Encoding.UTF8.GetByteCount(message) + 1));
                packet.AddString(message);
                packet.AddInt8(flag);
            }
            catch (Exception)
            {
                _clusterServiceLocator.WorldCluster.Log.WriteLine(LogType.FAILED, "failed chat message type - {0}!", msgType);
            }

            return(packet);
        }