Exemple #1
0
        public void SendGameTime(ClientClass client, WcHandlerCharacter.CharacterObject character)
        {
            var smsgLoginSettimespeed = new PacketClass(Opcodes.SMSG_LOGIN_SETTIMESPEED);

            try
            {
                var time      = DateTime.Now;
                var year      = time.Year - 2000;
                var month     = time.Month - 1;
                var day       = time.Day - 1;
                var dayOfWeek = (int)time.DayOfWeek;
                var hour      = time.Hour;
                var minute    = time.Minute;

                // SMSG_LOGIN_SETTIMESPEED.AddInt32(CType((((((Minute + (Hour << 6)) + (DayOfWeek << 11)) + (Day << 14)) + (Year << 18)) + (Month << 20)), Integer))
                smsgLoginSettimespeed.AddInt32(minute + (hour << 6) + (dayOfWeek << 11) + (day << 14) + (month << 20) + (year << 24));
                smsgLoginSettimespeed.AddSingle(0.01666667f);
                client.Send(smsgLoginSettimespeed);
            }
            finally
            {
                smsgLoginSettimespeed.Dispose();
            }

            _clusterServiceLocator.WorldCluster.Log.WriteLine(LogType.DEBUG, "[{0}:{1}] SMSG_LOGIN_SETTIMESPEED", client.IP, client.Port);
        }
Exemple #2
0
        public void SendTriggerCinematic(ClientClass client, WcHandlerCharacter.CharacterObject character)
        {
            var packet = new PacketClass(Opcodes.SMSG_TRIGGER_CINEMATIC);

            try
            {
                if (_clusterServiceLocator.WsDbcDatabase.CharRaces.ContainsKey((int)character.Race))
                {
                    packet.AddInt32(_clusterServiceLocator.WsDbcDatabase.CharRaces[(int)character.Race].CinematicId);
                }
                else
                {
                    _clusterServiceLocator.WorldCluster.Log.WriteLine(LogType.WARNING, "[{0}:{1}] SMSG_TRIGGER_CINEMATIC [Error: RACE={2} CLASS={3}]", client.IP, client.Port, character.Race, character.Classe);
                    return;
                }

                client.Send(packet);
            }
            finally
            {
                packet.Dispose();
            }

            _clusterServiceLocator.WorldCluster.Log.WriteLine(LogType.DEBUG, "[{0}:{1}] SMSG_TRIGGER_CINEMATIC", client.IP, client.Port);
        }
Exemple #3
0
        public void SendCorpseReclaimDelay(ClientClass client, WcHandlerCharacter.CharacterObject character, int seconds = 30)
        {
            var packet = new PacketClass(Opcodes.SMSG_CORPSE_RECLAIM_DELAY);

            try
            {
                packet.AddInt32(seconds * 1000);
                client.Send(packet);
            }
            finally
            {
                packet.Dispose();
            }

            _clusterServiceLocator.WorldCluster.Log.WriteLine(LogType.DEBUG, "[{0}:{1}] SMSG_CORPSE_RECLAIM_DELAY [{2}s]", client.IP, client.Port, seconds);
        }
Exemple #4
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);
        }
Exemple #5
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);
        }