Example #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);
        }
Example #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);
        }
Example #3
0
        public void SendAccountMd5(ClientClass client, WcHandlerCharacter.CharacterObject character)
        {
            var foundData = false;

            // TODO: How Does Mangos Zero Handle the Account Data For the Characters?
            // Dim AccData As New DataTable
            // _WorldCluster.AccountDatabase.Query(String.Format("SELECT id FROM account WHERE username = ""{0}"";", client.Account), AccData)
            // If AccData.Rows.Count > 0 Then
            // Dim AccID As Integer = CType(AccData.Rows(0).Item("account_id"), Integer)

            // AccData.Clear()
            // _WorldCluster.AccountDatabase.Query(String.Format("SELECT * FROM account_data WHERE account_id = {0}", AccID), AccData)
            // If AccData.Rows.Count > 0 Then
            // FoundData = True
            // Else
            // _WorldCluster.AccountDatabase.Update(String.Format("INSERT INTO account_data VALUES({0}, '', '', '', '', '', '', '', '')", AccID))
            // End If
            // End If

            var smsgAccountDataTimes = new PacketClass(Opcodes.SMSG_ACCOUNT_DATA_MD5);

            try
            {
                // Dim md5hash As MD5 = MD5.Create()
                for (var i = 0; i <= 7; i++)
                {
                    if (foundData)
                    {
                    }
                    // Dim tmpBytes() As Byte = AccData.Rows(0).Item("account_data" & i)
                    // If tmpBytes.Length = 0 Then
                    // SMSG_ACCOUNT_DATA_TIMES.AddInt64(0)
                    // SMSG_ACCOUNT_DATA_TIMES.AddInt64(0)
                    // Else
                    // SMSG_ACCOUNT_DATA_TIMES.AddByteArray(md5hash.ComputeHash(tmpBytes))
                    // End If
                    else
                    {
                        smsgAccountDataTimes.AddInt64(0L);
                        smsgAccountDataTimes.AddInt64(0L);
                    }
                }
                // md5hash.Clear()
                // md5hash = Nothing

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

            _clusterServiceLocator.WorldCluster.Log.WriteLine(LogType.DEBUG, "[{0}:{1}] SMSG_ACCOUNT_DATA_MD5", client.IP, client.Port);
        }
Example #4
0
        public void SendMessageNotification(ClientClass client, string message)
        {
            var packet = new PacketClass(Opcodes.SMSG_NOTIFICATION);

            try
            {
                packet.AddString(message);
                client.Send(packet);
            }
            finally
            {
                packet.Dispose();
            }
        }
Example #5
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);
        }
Example #6
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);
        }