Beispiel #1
0
 public void On_CMSG_PETITION_SIGN(ref Packets.PacketClass packet, ref WS_Network.ClientClass client)
 {
     checked
     {
         if (packet.Data.Length - 1 < 14)
         {
             return;
         }
         packet.GetInt16();
         ulong itemGuid = packet.GetUInt64();
         int   Unk      = packet.GetInt8();
         WorldServiceLocator._WorldServer.Log.WriteLine(LogType.DEBUG, "[{0}:{1}] CMSG_PETITION_SIGN [GUID={2:X} Unk={3}]", client.IP, client.Port, itemGuid, Unk);
         DataTable MySQLQuery = new();
         WorldServiceLocator._WorldServer.CharacterDatabase.Query("SELECT petition_signedMembers, petition_owner FROM petitions WHERE petition_itemGuid = " + Conversions.ToString(itemGuid - WorldServiceLocator._Global_Constants.GUID_ITEM) + ";", ref MySQLQuery);
         if (MySQLQuery.Rows.Count != 0)
         {
             WorldServiceLocator._WorldServer.CharacterDatabase.Update(Conversions.ToString(Operators.ConcatenateObject(Operators.ConcatenateObject(Operators.ConcatenateObject(Operators.ConcatenateObject(Operators.ConcatenateObject(Operators.ConcatenateObject("UPDATE petitions SET petition_signedMembers = petition_signedMembers + 1, petition_signedMember", Operators.AddObject(MySQLQuery.Rows[0]["petition_signedMembers"], 1)), " = "), client.Character.GUID), " WHERE petition_itemGuid = "), itemGuid - WorldServiceLocator._Global_Constants.GUID_ITEM), ";")));
             Packets.PacketClass response = new(Opcodes.SMSG_PETITION_SIGN_RESULTS);
             response.AddUInt64(itemGuid);
             response.AddUInt64(client.Character.GUID);
             response.AddInt32(0);
             client.SendMultiplyPackets(ref response);
             if (WorldServiceLocator._WorldServer.CHARACTERs.ContainsKey(MySQLQuery.Rows[0].As <ulong>("petition_owner")))
             {
                 WorldServiceLocator._WorldServer.CHARACTERs[MySQLQuery.Rows[0].As <ulong>("petition_owner")].client.SendMultiplyPackets(ref response);
             }
             response.Dispose();
         }
     }
 }
Beispiel #2
0
 public void On_MSG_TABARDVENDOR_ACTIVATE(ref Packets.PacketClass packet, ref WS_Network.ClientClass client)
 {
     if (checked (packet.Data.Length - 1) >= 13)
     {
         packet.GetInt16();
         ulong GUID = packet.GetUInt64();
         WorldServiceLocator._WorldServer.Log.WriteLine(LogType.DEBUG, "[{0}:{1}] MSG_TABARDVENDOR_ACTIVATE [GUID={2}]", client.IP, client.Port, GUID);
         SendTabardActivate(ref client.Character, GUID);
     }
 }
Beispiel #3
0
 public void On_CMSG_PETITION_SHOWLIST(ref Packets.PacketClass packet, ref WS_Network.ClientClass client)
 {
     if (checked (packet.Data.Length - 1) >= 13)
     {
         packet.GetInt16();
         ulong GUID = packet.GetUInt64();
         WorldServiceLocator._WorldServer.Log.WriteLine(LogType.DEBUG, "[{0}:{1}] CMSG_PETITION_SHOWLIST [GUID={2:X}]", client.IP, client.Port, GUID);
         SendPetitionActivate(ref client.Character, GUID);
     }
 }
Beispiel #4
0
 public void On_CMSG_OFFER_PETITION(ref Packets.PacketClass packet, ref WS_Network.ClientClass client)
 {
     if (checked (packet.Data.Length - 1) >= 21)
     {
         packet.GetInt16();
         int   PetitionType = packet.GetInt32();
         ulong itemGuid     = packet.GetUInt64();
         ulong GUID         = packet.GetUInt64();
         if (WorldServiceLocator._WorldServer.CHARACTERs.ContainsKey(GUID) && WorldServiceLocator._WorldServer.CHARACTERs[GUID].IsHorde == client.Character.IsHorde)
         {
             WorldServiceLocator._WorldServer.Log.WriteLine(LogType.DEBUG, "[{0}:{1}] CMSG_OFFER_PETITION [GUID={2:X} Petition={3}]", client.IP, client.Port, GUID, itemGuid);
             Dictionary <ulong, WS_PlayerData.CharacterObject> cHARACTERs;
             ulong key;
             WS_PlayerData.CharacterObject objCharacter = (cHARACTERs = WorldServiceLocator._WorldServer.CHARACTERs)[key = GUID];
             SendPetitionSignatures(ref objCharacter, itemGuid);
             cHARACTERs[key] = objCharacter;
         }
     }
 }
Beispiel #5
0
 public void On_CMSG_TURN_IN_PETITION(ref Packets.PacketClass packet, ref WS_Network.ClientClass client)
 {
     if (checked (packet.Data.Length - 1) >= 13)
     {
         packet.GetInt16();
         ulong itemGuid = packet.GetUInt64();
         WorldServiceLocator._WorldServer.Log.WriteLine(LogType.DEBUG, "[{0}:{1}] CMSG_TURN_IN_PETITION [GUID={2:X}]", client.IP, client.Port, itemGuid);
         client.Character.ItemREMOVE(itemGuid, Destroy: true, Update: true);
     }
 }
Beispiel #6
0
 public void On_CMSG_PETITION_QUERY(ref Packets.PacketClass packet, ref WS_Network.ClientClass client)
 {
     checked
     {
         if (packet.Data.Length - 1 < 17)
         {
             return;
         }
         packet.GetInt16();
         int   PetitionGUID = packet.GetInt32();
         ulong itemGuid     = packet.GetUInt64();
         WorldServiceLocator._WorldServer.Log.WriteLine(LogType.DEBUG, "[{0}:{1}] CMSG_PETITION_QUERY [pGUID={3} iGUID={2:X}]", client.IP, client.Port, itemGuid, PetitionGUID);
         DataTable MySQLQuery = new();
         WorldServiceLocator._WorldServer.CharacterDatabase.Query("SELECT * FROM petitions WHERE petition_itemGuid = " + Conversions.ToString(itemGuid - WorldServiceLocator._Global_Constants.GUID_ITEM) + ";", ref MySQLQuery);
         if (MySQLQuery.Rows.Count != 0)
         {
             Packets.PacketClass response = new(Opcodes.SMSG_PETITION_QUERY_RESPONSE);
             response.AddInt32(MySQLQuery.Rows[0].As <int>("petition_id"));
             response.AddUInt64(MySQLQuery.Rows[0].As <ulong>("petition_owner"));
             response.AddString(MySQLQuery.Rows[0].As <string>("petition_name"));
             response.AddInt8(0);
             if (MySQLQuery.Rows[0].As <byte>("petition_type") == 9)
             {
                 response.AddInt32(9);
                 response.AddInt32(9);
                 response.AddInt32(0);
             }
             else
             {
                 response.AddInt32(MySQLQuery.Rows[0].As <byte>("petition_type") - 1);
                 response.AddInt32(MySQLQuery.Rows[0].As <byte>("petition_type") - 1);
                 response.AddInt32(MySQLQuery.Rows[0].As <byte>("petition_type"));
             }
             response.AddInt32(0);
             response.AddInt32(0);
             response.AddInt32(0);
             response.AddInt32(0);
             response.AddInt16(0);
             response.AddInt32(0);
             response.AddInt32(0);
             response.AddInt32(0);
             response.AddInt32(0);
             if (MySQLQuery.Rows[0].As <byte>("petition_type") == 9)
             {
                 response.AddInt32(0);
             }
             else
             {
                 response.AddInt32(1);
             }
             client.Send(ref response);
             response.Dispose();
         }
     }
 }
 public void On_CMSG_TAXIQUERYAVAILABLENODES(ref Packets.PacketClass packet, ref WS_Network.ClientClass client)
 {
     if (checked (packet.Data.Length - 1) >= 13)
     {
         packet.GetInt16();
         var guid = packet.GetUInt64();
         WorldServiceLocator._WorldServer.Log.WriteLine(LogType.DEBUG, "[{0}:{1}] CMSG_TAXIQUERYAVAILABLENODES [taxiGUID={2:X}]", client.IP, client.Port, guid);
         if (WorldServiceLocator._WorldServer.WORLD_CREATUREs.ContainsKey(guid) && ((uint)WorldServiceLocator._WorldServer.WORLD_CREATUREs[guid].CreatureInfo.cNpcFlags & 8u) != 0)
         {
             SendTaxiMenu(ref client.Character, guid);
         }
     }
 }
 public void On_CMSG_TAXINODE_STATUS_QUERY(ref Packets.PacketClass packet, ref WS_Network.ClientClass client)
 {
     if (checked (packet.Data.Length - 1) >= 13)
     {
         packet.GetInt16();
         var guid = packet.GetUInt64();
         WorldServiceLocator._WorldServer.Log.WriteLine(LogType.DEBUG, "[{0}:{1}] CMSG_TAXINODE_STATUS_QUERY [taxiGUID={2:X}]", client.IP, client.Port, guid);
         if (WorldServiceLocator._WorldServer.WORLD_CREATUREs.ContainsKey(guid))
         {
             SendTaxiStatus(ref client.Character, guid);
         }
     }
 }
Beispiel #9
0
 public void On_CMSG_MAIL_MARK_AS_READ(ref Packets.PacketClass packet, ref WS_Network.ClientClass client)
 {
     checked
     {
         if (packet.Data.Length - 1 >= 17)
         {
             packet.GetInt16();
             var GameObjectGUID = packet.GetUInt64();
             var MailID         = packet.GetInt32();
             WorldServiceLocator._WorldServer.Log.WriteLine(LogType.DEBUG, "[{0}:{1}] CMSG_MAIL_MARK_AS_READ [MailID={2}]", client.IP, client.Port, MailID);
             var MailTime = (int)(WorldServiceLocator._Functions.GetTimestamp(DateAndTime.Now) + 259200L);
             WorldServiceLocator._WorldServer.CharacterDatabase.Update(string.Format("UPDATE characters_mail SET mail_read = 1, mail_time = {1} WHERE mail_id = {0} AND mail_read < 2;", MailID, MailTime));
         }
     }
 }
Beispiel #10
0
    public static void On_SMSG_CHAR_ENUM(ref Packets.PacketClass Packet)
    {
        Console.WriteLine("[{0}][World] Received Character List.", Strings.Format(DateAndTime.TimeOfDay, "HH:mm:ss"));
        var NumChars = Packet.GetInt8();

        if (NumChars > 0)
        {
            for (byte i = 1, loopTo = NumChars; i <= loopTo; i++)
            {
                var GUID        = Packet.GetUInt64();
                var Name        = Packet.GetString();
                var Race        = Packet.GetInt8();
                var Classe      = Packet.GetInt8();
                var Gender      = Packet.GetInt8();
                var Skin        = Packet.GetInt8();
                var Face        = Packet.GetInt8();
                var HairStyle   = Packet.GetInt8();
                var HairColor   = Packet.GetInt8();
                var FacialHair  = Packet.GetInt8();
                var Level       = Packet.GetInt8();
                var Zone        = Packet.GetInt32();
                var Map         = Packet.GetInt32();
                var PosX        = Packet.GetFloat();
                var PosY        = Packet.GetFloat();
                var PosZ        = Packet.GetFloat();
                var GuildID     = Packet.GetUInt32();
                var PlayerState = Packet.GetUInt32();
                var RestState   = Packet.GetInt8();
                var PetInfoID   = Packet.GetUInt32();
                var PetLevel    = Packet.GetUInt32();
                var PetFamilyID = Packet.GetUInt32();
                Console.WriteLine("[{0}][World] Logging in with character [{1}].", Strings.Format(DateAndTime.TimeOfDay, "HH:mm:ss"), Name);
                Worldserver.CharacterGUID = GUID;
                Packets.PacketClass Response = new(OPCODES.CMSG_PLAYER_LOGIN);
                Response.AddUInt64(GUID);
                Worldserver.Send(Response);
                Response.Dispose();
                break;

                // Skip the equipment
                Packet.Offset += 20 * 9;
            }
        }
        else
        {
            Console.WriteLine("[{0}][World] No characters found.", Strings.Format(DateAndTime.TimeOfDay, "HH:mm:ss"));
        }
    }
Beispiel #11
0
 public void On_CMSG_MAIL_DELETE(ref Packets.PacketClass packet, ref WS_Network.ClientClass client)
 {
     if (checked (packet.Data.Length - 1) >= 17)
     {
         packet.GetInt16();
         var GameObjectGUID = packet.GetUInt64();
         var MailID         = packet.GetInt32();
         WorldServiceLocator._WorldServer.Log.WriteLine(LogType.DEBUG, "[{0}:{1}] CMSG_MAIL_DELETE [MailID={2}]", client.IP, client.Port, MailID);
         WorldServiceLocator._WorldServer.CharacterDatabase.Update($"DELETE FROM characters_mail WHERE mail_id = {MailID};");
         Packets.PacketClass response = new(Opcodes.SMSG_SEND_MAIL_RESULT);
         response.AddInt32(MailID);
         response.AddInt32(4);
         response.AddInt32(0);
         client.Send(ref response);
         response.Dispose();
     }
 }
Beispiel #12
0
    public void On_CMSG_BATTLEMASTER_HELLO(ref Packets.PacketClass packet, ref WS_Network.ClientClass client)
    {
        if (checked (packet.Data.Length - 1) < 13)
        {
            return;
        }
        packet.GetInt16();
        var GUID = packet.GetUInt64();

        WorldServiceLocator._WorldServer.Log.WriteLine(LogType.DEBUG, "[{0}:{1}] CMSG_BATTLEMASTER_HELLO [{2:X}]", client.IP, client.Port, GUID);
        if (!WorldServiceLocator._WorldServer.WORLD_CREATUREs.ContainsKey(GUID) || (WorldServiceLocator._WorldServer.WORLD_CREATUREs[GUID].CreatureInfo.cNpcFlags & 0x800) == 0 || !WorldServiceLocator._WS_DBCDatabase.Battlemasters.ContainsKey(WorldServiceLocator._WorldServer.WORLD_CREATUREs[GUID].ID))
        {
            return;
        }
        var BGType = WorldServiceLocator._WS_DBCDatabase.Battlemasters[WorldServiceLocator._WorldServer.WORLD_CREATUREs[GUID].ID];

        if (!WorldServiceLocator._WS_DBCDatabase.Battlegrounds.ContainsKey(BGType))
        {
            return;
        }
        if (WorldServiceLocator._WS_DBCDatabase.Battlegrounds[BGType].MinLevel > (uint)client.Character.Level || WorldServiceLocator._WS_DBCDatabase.Battlegrounds[BGType].MaxLevel < (uint)client.Character.Level)
        {
            WorldServiceLocator._Functions.SendMessageNotification(ref client, "You don't meet Battleground level requirements");
            return;
        }
        Packets.PacketClass response = new(Opcodes.SMSG_BATTLEFIELD_LIST);
        try
        {
            response.AddUInt64(client.Character.GUID);
            response.AddInt32(BGType);
            response.AddInt8(0);
            var Battlegrounds = WorldServiceLocator._WorldServer.ClsWorldServer.Cluster.BattlefieldList(BGType);
            response.AddInt32(Battlegrounds.Count);
            foreach (var Instance in Battlegrounds)
            {
                response.AddInt32(Instance);
            }
            client.Send(ref response);
        }
        finally
        {
            response.Dispose();
        }
    }
Beispiel #13
0
 public void On_MSG_PETITION_RENAME(ref Packets.PacketClass packet, ref WS_Network.ClientClass client)
 {
     checked
     {
         if (packet.Data.Length - 1 >= 14)
         {
             packet.GetInt16();
             ulong  itemGuid = packet.GetUInt64();
             string NewName  = packet.GetString();
             WorldServiceLocator._WorldServer.Log.WriteLine(LogType.DEBUG, "[{0}:{1}] MSG_PETITION_RENAME [NewName={3} GUID={2:X}]", client.IP, client.Port, itemGuid, NewName);
             WorldServiceLocator._WorldServer.CharacterDatabase.Update("UPDATE petitions SET petition_name = '" + NewName + "' WHERE petition_itemGuid = " + Conversions.ToString(itemGuid - WorldServiceLocator._Global_Constants.GUID_ITEM) + ";");
             Packets.PacketClass response = new(Opcodes.MSG_PETITION_RENAME);
             response.AddUInt64(itemGuid);
             response.AddString(NewName);
             response.AddInt32((int)(itemGuid - WorldServiceLocator._Global_Constants.GUID_ITEM));
             client.Send(ref response);
             response.Dispose();
         }
     }
 }
Beispiel #14
0
 public void On_CMSG_MAIL_RETURN_TO_SENDER(ref Packets.PacketClass packet, ref WS_Network.ClientClass client)
 {
     checked
     {
         if (packet.Data.Length - 1 >= 17)
         {
             packet.GetInt16();
             var GameObjectGUID = packet.GetUInt64();
             var MailID         = packet.GetInt32();
             WorldServiceLocator._WorldServer.Log.WriteLine(LogType.DEBUG, "[{0}:{1}] CMSG_MAIL_RETURN_TO_SENDER [MailID={2}]", client.IP, client.Port, MailID);
             var MailTime = (int)(WorldServiceLocator._Functions.GetTimestamp(DateAndTime.Now) + 2592000L);
             WorldServiceLocator._WorldServer.CharacterDatabase.Update(string.Format("UPDATE characters_mail SET mail_time = {1}, mail_read = 0, mail_receiver = (mail_receiver + mail_sender), mail_sender = (mail_receiver - mail_sender), mail_receiver = (mail_receiver - mail_sender) WHERE mail_id = {0};", MailID, MailTime));
             Packets.PacketClass response = new(Opcodes.SMSG_SEND_MAIL_RESULT);
             response.AddInt32(MailID);
             response.AddInt32(3);
             response.AddInt32(0);
             client.Send(ref response);
             response.Dispose();
         }
     }
 }
Beispiel #15
0
 public void On_MSG_PETITION_DECLINE(ref Packets.PacketClass packet, ref WS_Network.ClientClass client)
 {
     checked
     {
         if (packet.Data.Length - 1 >= 13)
         {
             packet.GetInt16();
             ulong itemGuid = packet.GetUInt64();
             WorldServiceLocator._WorldServer.Log.WriteLine(LogType.DEBUG, "[{0}:{1}] MSG_PETITION_DECLINE [GUID={2:X}]", client.IP, client.Port, itemGuid);
             DataTable q = new();
             WorldServiceLocator._WorldServer.CharacterDatabase.Query("SELECT petition_owner FROM petitions WHERE petition_itemGuid = " + Conversions.ToString(itemGuid - WorldServiceLocator._Global_Constants.GUID_ITEM) + " LIMIT 1;", ref q);
             Packets.PacketClass response = new(Opcodes.MSG_PETITION_DECLINE);
             response.AddUInt64(client.Character.GUID);
             if (q.Rows.Count > 0 && WorldServiceLocator._WorldServer.CHARACTERs.ContainsKey(q.Rows[0].As <ulong>("petition_owner")))
             {
                 WorldServiceLocator._WorldServer.CHARACTERs[q.Rows[0].As <ulong>("petition_owner")].client.SendMultiplyPackets(ref response);
             }
             response.Dispose();
         }
     }
 }
Beispiel #16
0
    public void On_CMSG_TEXT_EMOTE(ref Packets.PacketClass packet, ref WS_Network.ClientClass client)
    {
        checked
        {
            if (packet.Data.Length - 1 < 21 && client.Character != null)
            {
                return;
            }
            packet.GetInt16();
            var TextEmote = packet.GetInt32();
            var Unk       = packet.GetInt32();
            var GUID      = packet.GetUInt64();
            WorldServiceLocator._WorldServer.Log.WriteLine(LogType.DEBUG, "[{0}:{1}] CMSG_TEXT_EMOTE [TextEmote={2} Unk={3}]", client.IP, client.Port, TextEmote, Unk);
            if (WorldServiceLocator._CommonGlobalFunctions.GuidIsCreature(GUID) && WorldServiceLocator._WorldServer.WORLD_CREATUREs.ContainsKey(GUID))
            {
                ref var character = ref client.Character;
                ulong   key;
                Dictionary <ulong, WS_Creatures.CreatureObject> WORLD_CREATUREs;
                var creature = (WORLD_CREATUREs = WorldServiceLocator._WorldServer.WORLD_CREATUREs)[key = GUID];
                WorldServiceLocator._WorldServer.ALLQUESTS.OnQuestDoEmote(ref character, ref creature, TextEmote);
                WORLD_CREATUREs[key] = creature;
                if (WorldServiceLocator._WorldServer.WORLD_CREATUREs[GUID].aiScript is not null and WS_Creatures_AI.GuardAI)
                {
                    ((WS_Creatures_AI.GuardAI)WorldServiceLocator._WorldServer.WORLD_CREATUREs[GUID].aiScript).OnEmote(TextEmote);
                }
            }
            if (WorldServiceLocator._WS_DBCDatabase.EmotesText.ContainsKey(TextEmote))
            {
                switch (WorldServiceLocator._WS_DBCDatabase.EmotesState[WorldServiceLocator._WS_DBCDatabase.EmotesText[TextEmote]])
                {
                case 0:
                    client.Character.DoEmote(WorldServiceLocator._WS_DBCDatabase.EmotesText[TextEmote]);
                    break;

                case 2:
                    client.Character.cEmoteState = WorldServiceLocator._WS_DBCDatabase.EmotesText[TextEmote];
                    client.Character.SetUpdateFlag(148, client.Character.cEmoteState);
                    client.Character.SendCharacterUpdate();
                    break;

                default:
                    break;
                }
            }
            var secondName = "";
            if (decimal.Compare(new decimal(GUID), 0m) > 0)
            {
                if (WorldServiceLocator._WorldServer.CHARACTERs.ContainsKey(GUID))
                {
                    secondName = WorldServiceLocator._WorldServer.CHARACTERs[GUID].Name;
                }
                else if (WorldServiceLocator._WorldServer.WORLD_CREATUREs.ContainsKey(GUID))
                {
                    secondName = WorldServiceLocator._WorldServer.WORLD_CREATUREs[GUID].Name;
                }
            }
            Packets.PacketClass SMSG_TEXT_EMOTE = new(Opcodes.SMSG_TEXT_EMOTE);
            try
            {
                SMSG_TEXT_EMOTE.AddUInt64(client.Character.GUID);
                SMSG_TEXT_EMOTE.AddInt32(TextEmote);
                SMSG_TEXT_EMOTE.AddInt32(255);
                SMSG_TEXT_EMOTE.AddInt32(secondName.Length + 1);
                SMSG_TEXT_EMOTE.AddString(secondName);
                client.Character.SendToNearPlayers(ref SMSG_TEXT_EMOTE);
            }
            finally
            {
                SMSG_TEXT_EMOTE.Dispose();
            }
        }
Beispiel #17
0
    public void On_CMSG_MAIL_TAKE_ITEM(ref Packets.PacketClass packet, ref WS_Network.ClientClass client)
    {
        checked
        {
            if (packet.Data.Length - 1 < 17)
            {
                return;
            }
            packet.GetInt16();
            var GameObjectGUID = packet.GetUInt64();
            var MailID         = packet.GetInt32();
            WorldServiceLocator._WorldServer.Log.WriteLine(LogType.DEBUG, "[{0}:{1}] CMSG_MAIL_TAKE_ITEM [MailID={2}]", client.IP, client.Port, MailID);
            try
            {
                DataTable MySQLQuery = new();
                WorldServiceLocator._WorldServer.CharacterDatabase.Query($"SELECT mail_cod, mail_sender, item_guid FROM characters_mail WHERE mail_id = {MailID} AND mail_receiver = {client.Character.GUID};", ref MySQLQuery);
                if (MySQLQuery.Rows.Count == 0)
                {
                    Packets.PacketClass response4 = new(Opcodes.SMSG_SEND_MAIL_RESULT);
                    response4.AddInt32(MailID);
                    response4.AddInt32(2);
                    response4.AddInt32(6);
                    client.Send(ref response4);
                    response4.Dispose();
                    return;
                }
                if (!Operators.ConditionalCompareObjectNotEqual(MySQLQuery.Rows[0]["mail_cod"], 0, TextCompare: false))
                {
                    goto IL_02b9;
                }
                if (Operators.ConditionalCompareObjectLess(client.Character.Copper, MySQLQuery.Rows[0]["mail_cod"], TextCompare: false))
                {
                    Packets.PacketClass noMoney = new(Opcodes.SMSG_SEND_MAIL_RESULT);
                    noMoney.AddInt32(MailID);
                    noMoney.AddInt32(0);
                    noMoney.AddInt32(3);
                    client.Send(ref noMoney);
                    noMoney.Dispose();
                    return;
                }
                ref var copper = ref client.Character.Copper;
                copper = Conversions.ToUInteger(Operators.SubtractObject(copper, MySQLQuery.Rows[0]["mail_cod"]));
                WorldServiceLocator._WorldServer.CharacterDatabase.Update($"UPDATE characters_mail SET mail_cod = 0 WHERE mail_id = {MailID};");
                var MailTime = (int)(WorldServiceLocator._Functions.GetTimestamp(DateAndTime.Now) + 2592000L);
                WorldServiceLocator._WorldServer.CharacterDatabase.Update(string.Format("INSERT INTO characters_mail (mail_sender, mail_receiver, mail_subject, mail_body, mail_item_guid, mail_money, mail_COD, mail_time, mail_read, mail_type) VALUES \r\n                        ({0},{1},'{2}','{3}',{4},{5},{6},{7},{8},{9});", client.Character.GUID, MySQLQuery.Rows[0]["mail_sender"], "", "", 0, MySQLQuery.Rows[0]["mail_cod"], 0, MailTime, MailReadInfo.COD, 0));
IL_02b9:
                if (Operators.ConditionalCompareObjectEqual(MySQLQuery.Rows[0]["item_guid"], 0, TextCompare: false))
                {
                    Packets.PacketClass response3 = new(Opcodes.SMSG_SEND_MAIL_RESULT);
                    response3.AddInt32(MailID);
                    response3.AddInt32(2);
                    response3.AddInt32(6);
                    client.Send(ref response3);
                    response3.Dispose();
                    return;
                }
                var tmpItem = WorldServiceLocator._WS_Items.LoadItemByGUID(MySQLQuery.Rows[0].As <ulong>("item_guid"));
                tmpItem.OwnerGUID = client.Character.GUID;
                tmpItem.Save();
                if (client.Character.ItemADD(ref tmpItem))
                {
                    WorldServiceLocator._WorldServer.CharacterDatabase.Update($"UPDATE characters_mail SET item_guid = 0 WHERE mail_id = {MailID};");
                    WorldServiceLocator._WorldServer.CharacterDatabase.Update($"DELETE FROM mail_items WHERE mail_id = {MailID};");
                    Packets.PacketClass response2 = new(Opcodes.SMSG_SEND_MAIL_RESULT);
                    response2.AddInt32(MailID);
                    response2.AddInt32(2);
                    response2.AddInt32(0);
                    client.Send(ref response2);
                    response2.Dispose();
                }
                else
                {
                    tmpItem.Dispose();
                    Packets.PacketClass response = new(Opcodes.SMSG_SEND_MAIL_RESULT);
                    response.AddInt32(MailID);
                    response.AddInt32(2);
                    response.AddInt32(1);
                    client.Send(ref response);
                    response.Dispose();
                }
                client.Character.Save();
            }
Beispiel #18
0
 public void On_CMSG_GET_MAIL_LIST(ref Packets.PacketClass packet, ref WS_Network.ClientClass client)
 {
     checked
     {
         if (packet.Data.Length - 1 < 13)
         {
             return;
         }
         packet.GetInt16();
         var GameObjectGUID = packet.GetUInt64();
         WorldServiceLocator._WorldServer.Log.WriteLine(LogType.DEBUG, "[{0}:{1}] CMSG_GET_MAIL_LIST [GUID={2:X}]", client.IP, client.Port, GameObjectGUID);
         try
         {
             DataTable MySQLQuery = new();
             WorldServiceLocator._WorldServer.CharacterDatabase.Query($"SELECT mail_id FROM characters_mail WHERE mail_time < {WorldServiceLocator._Functions.GetTimestamp(DateAndTime.Now)};", ref MySQLQuery);
             if (MySQLQuery.Rows.Count > 0)
             {
                 var  b = (byte)(MySQLQuery.Rows.Count - 1);
                 byte j = 0;
                 while (j <= (uint)b)
                 {
                     WorldServiceLocator._WorldServer.CharacterDatabase.Update(string.Format("DELETE FROM characters_mail WHERE mail_id = {0};", RuntimeHelpers.GetObjectValue(MySQLQuery.Rows[j]["mail_id"])));
                     j = (byte)unchecked ((uint)(j + 1));
                 }
             }
             WorldServiceLocator._WorldServer.CharacterDatabase.Query($"SELECT * FROM characters_mail WHERE mail_receiver = {client.Character.GUID};", ref MySQLQuery);
             Packets.PacketClass response = new(Opcodes.SMSG_MAIL_LIST_RESULT);
             response.AddInt8((byte)MySQLQuery.Rows.Count);
             if (MySQLQuery.Rows.Count > 0)
             {
                 var  b2 = (byte)(MySQLQuery.Rows.Count - 1);
                 byte i  = 0;
                 while (i <= (uint)b2)
                 {
                     response.AddInt32(MySQLQuery.Rows[i].As <int>("mail_id"));
                     response.AddInt8(MySQLQuery.Rows[i].As <byte>("mail_type"));
                     var left = MySQLQuery.Rows[i]["mail_type"];
                     if (Operators.ConditionalCompareObjectEqual(left, MailTypeInfo.NORMAL, TextCompare: false))
                     {
                         response.AddUInt64(MySQLQuery.Rows[i].As <ulong>("mail_sender"));
                     }
                     else if (Operators.ConditionalCompareObjectEqual(left, MailTypeInfo.AUCTION, TextCompare: false))
                     {
                         response.AddInt32(MySQLQuery.Rows[i].As <int>("mail_sender"));
                     }
                     response.AddString(MySQLQuery.Rows[i].As <string>("mail_subject"));
                     if (Operators.ConditionalCompareObjectNotEqual(MySQLQuery.Rows[i]["mail_body"], "", TextCompare: false))
                     {
                         response.AddInt32(MySQLQuery.Rows[i].As <int>("mail_id"));
                     }
                     else
                     {
                         response.AddInt32(0);
                     }
                     response.AddInt32(0);
                     response.AddInt32(MySQLQuery.Rows[i].As <int>("mail_stationary"));
                     if (decimal.Compare(new decimal(MySQLQuery.Rows[i].As <ulong>("item_guid")), 0m) > 0)
                     {
                         var tmpItem = WorldServiceLocator._WS_Items.LoadItemByGUID(MySQLQuery.Rows[i].As <ulong>("item_guid"));
                         response.AddInt32(tmpItem.ItemEntry);
                         if (tmpItem.Enchantments.ContainsKey(0))
                         {
                             packet.AddInt32(tmpItem.Enchantments[0].ID);
                         }
                         else
                         {
                             packet.AddInt32(0);
                         }
                         response.AddInt32(tmpItem.RandomProperties);
                         response.AddInt32(0);
                         response.AddInt8((byte)tmpItem.StackCount);
                         response.AddInt32(tmpItem.ChargesLeft);
                         response.AddInt32(tmpItem.ItemInfo.Durability);
                         response.AddInt32(tmpItem.Durability);
                     }
                     else
                     {
                         response.AddInt32(0);
                         response.AddInt32(0);
                         response.AddInt32(0);
                         response.AddInt32(0);
                         response.AddInt8(0);
                         response.AddInt32(0);
                         response.AddInt32(0);
                         response.AddInt32(0);
                     }
                     response.AddUInt32(MySQLQuery.Rows[i].As <uint>("mail_money"));
                     response.AddUInt32(MySQLQuery.Rows[i].As <uint>("mail_COD"));
                     response.AddInt32(MySQLQuery.Rows[i].As <int>("mail_read"));
                     response.AddSingle((float)((MySQLQuery.Rows[i].As <uint>("mail_time") - WorldServiceLocator._Functions.GetTimestamp(DateAndTime.Now)) / 86400.0));
                     response.AddInt32(0);
                     i = (byte)unchecked ((uint)(i + 1));
                 }
             }
             client.Send(ref response);
             response.Dispose();
         }
         catch (Exception ex)
         {
             ProjectData.SetProjectError(ex);
             var e = ex;
             WorldServiceLocator._WorldServer.Log.WriteLine(LogType.FAILED, "Error getting mail list: {0}{1}", Environment.NewLine, e.ToString());
             ProjectData.ClearProjectError();
         }
     }
 }
Beispiel #19
0
 public void On_CMSG_PETITION_BUY(ref Packets.PacketClass packet, ref WS_Network.ClientClass client)
 {
     checked
     {
         if (packet.Data.Length - 1 < 26)
         {
             return;
         }
         packet.GetInt16();
         ulong GUID = packet.GetUInt64();
         packet.GetInt64();
         packet.GetInt32();
         string Name = packet.GetString();
         if (packet.Data.Length - 1 < 26 + Name.Length + 40 + 2 + 1 + 4 + 4)
         {
             return;
         }
         packet.GetInt64();
         packet.GetInt64();
         packet.GetInt64();
         packet.GetInt64();
         packet.GetInt64();
         packet.GetInt16();
         packet.GetInt8();
         int Index = packet.GetInt32();
         packet.GetInt32();
         if (!WorldServiceLocator._WorldServer.WORLD_CREATUREs.ContainsKey(GUID) || (WorldServiceLocator._WorldServer.WORLD_CREATUREs[GUID].CreatureInfo.cNpcFlags & 0x200) == 0)
         {
             return;
         }
         WorldServiceLocator._WorldServer.Log.WriteLine(LogType.DEBUG, "[{0}:{1}] CMSG_PETITION_BUY [GuildName={2}]", client.IP, client.Port, Name);
         if ((ulong)client.Character.GuildID != 0)
         {
             return;
         }
         int       CharterID    = WorldServiceLocator._Global_Constants.PETITION_GUILD;
         int       CharterPrice = WorldServiceLocator._Global_Constants.PETITION_GUILD_PRICE;
         DataTable q            = new();
         WorldServiceLocator._WorldServer.CharacterDatabase.Query($"SELECT guild_id FROM guilds WHERE guild_name = '{Name}'", ref q);
         if (q.Rows.Count > 0)
         {
             SendGuildResult(ref client, GuildCommand.GUILD_CREATE_S, GuildError.GUILD_NAME_EXISTS, Name);
         }
         q.Clear();
         if (!WorldServiceLocator._Functions.ValidateGuildName(Name))
         {
             SendGuildResult(ref client, GuildCommand.GUILD_CREATE_S, GuildError.GUILD_NAME_INVALID, Name);
         }
         if (!WorldServiceLocator._WorldServer.ITEMDatabase.ContainsKey(CharterID))
         {
             Packets.PacketClass response2 = new(Opcodes.SMSG_BUY_FAILED);
             response2.AddUInt64(GUID);
             response2.AddInt32(CharterID);
             response2.AddInt8(0);
             client.Send(ref response2);
             response2.Dispose();
             return;
         }
         if (client.Character.Copper < CharterPrice)
         {
             Packets.PacketClass response = new(Opcodes.SMSG_BUY_FAILED);
             response.AddUInt64(GUID);
             response.AddInt32(CharterID);
             response.AddInt8(2);
             client.Send(ref response);
             response.Dispose();
             return;
         }
         ref uint copper = ref client.Character.Copper;
         copper = (uint)(copper - CharterPrice);
         client.Character.SetUpdateFlag(1176, client.Character.Copper);
         client.Character.SendCharacterUpdate(toNear: false);
         ItemObject tmpItem = new(CharterID, client.Character.GUID)
         {
             StackCount = 1
         };
         tmpItem.AddEnchantment((int)(tmpItem.GUID - WorldServiceLocator._Global_Constants.GUID_ITEM), 0);
         if (client.Character.ItemADD(ref tmpItem))
         {
             WorldServiceLocator._WorldServer.CharacterDatabase.Update(string.Format("INSERT INTO petitions (petition_id, petition_itemGuid, petition_owner, petition_name, petition_type, petition_signedMembers) VALUES ({0}, {0}, {1}, '{2}', {3}, 0);", tmpItem.GUID - WorldServiceLocator._Global_Constants.GUID_ITEM, client.Character.GUID - WorldServiceLocator._Global_Constants.GUID_PLAYER, Name, 9));
         }
         else
         {
             tmpItem.Delete();
         }
     }
 }
Beispiel #20
0
    public void On_CMSG_ACTIVATETAXI(ref Packets.PacketClass packet, ref WS_Network.ClientClass client)
    {
        if (checked (packet.Data.Length - 1) < 21)
        {
            return;
        }
        packet.GetInt16();
        var guid    = packet.GetUInt64();
        var srcNode = packet.GetInt32();
        var dstNode = packet.GetInt32();

        WorldServiceLocator._WorldServer.Log.WriteLine(LogType.DEBUG, "[{0}:{1}] CMSG_ACTIVATETAXI [taxiGUID={2:X} srcNode={3} dstNode={4}]", client.IP, client.Port, guid, srcNode, dstNode);
        if (!WorldServiceLocator._WorldServer.WORLD_CREATUREs.ContainsKey(guid) || (WorldServiceLocator._WorldServer.WORLD_CREATUREs[guid].CreatureInfo.cNpcFlags & 8) == 0)
        {
            SendActivateTaxiReply(ref client, ActivateTaxiReplies.ERR_TAXINOVENDORNEARBY);
            return;
        }
        if (client.Character.LogoutTimer != null)
        {
            SendActivateTaxiReply(ref client, ActivateTaxiReplies.ERR_TAXIPLAYERBUSY);
            return;
        }
        if (((uint)client.Character.cUnitFlags & 4u) != 0)
        {
            SendActivateTaxiReply(ref client, ActivateTaxiReplies.ERR_TAXINOTSTANDING);
            return;
        }
        if ((int)client.Character.ShapeshiftForm > 0 && client.Character.ShapeshiftForm != ShapeshiftForm.FORM_BERSERKERSTANCE && client.Character.ShapeshiftForm != ShapeshiftForm.FORM_BATTLESTANCE && client.Character.ShapeshiftForm != ShapeshiftForm.FORM_DEFENSIVESTANCE && client.Character.ShapeshiftForm != ShapeshiftForm.FORM_SHADOW)
        {
            SendActivateTaxiReply(ref client, ActivateTaxiReplies.ERR_TAXIPLAYERSHAPESHIFTED);
            return;
        }
        if (client.Character.Mount != 0)
        {
            SendActivateTaxiReply(ref client, ActivateTaxiReplies.ERR_TAXIPLAYERALREADYMOUNTED);
            return;
        }
        if (!WorldServiceLocator._WS_DBCDatabase.TaxiNodes.ContainsKey(srcNode) || !WorldServiceLocator._WS_DBCDatabase.TaxiNodes.ContainsKey(dstNode))
        {
            SendActivateTaxiReply(ref client, ActivateTaxiReplies.ERR_TAXINOSUCHPATH);
            return;
        }
        int mount;

        if (client.Character.IsHorde)
        {
            if (!WorldServiceLocator._WorldServer.CREATURESDatabase.ContainsKey(WorldServiceLocator._WS_DBCDatabase.TaxiNodes[srcNode].HordeMount))
            {
                mount = new CreatureInfo(WorldServiceLocator._WS_DBCDatabase.TaxiNodes[srcNode].HordeMount).GetFirstModel;
            }
            else
            {
                mount = WorldServiceLocator._WorldServer.CREATURESDatabase[WorldServiceLocator._WS_DBCDatabase.TaxiNodes[srcNode].HordeMount].ModelA1;
            }
        }
        else if (!WorldServiceLocator._WorldServer.CREATURESDatabase.ContainsKey(WorldServiceLocator._WS_DBCDatabase.TaxiNodes[srcNode].AllianceMount))
        {
            mount = new CreatureInfo(WorldServiceLocator._WS_DBCDatabase.TaxiNodes[srcNode].AllianceMount).GetFirstModel;
        }
        else
        {
            mount = WorldServiceLocator._WorldServer.CREATURESDatabase[WorldServiceLocator._WS_DBCDatabase.TaxiNodes[srcNode].AllianceMount].ModelA2;
        }
        if (mount == 0)
        {
            SendActivateTaxiReply(ref client, ActivateTaxiReplies.ERR_TAXIUNSPECIFIEDSERVERERROR);
            return;
        }
        checked
        {
            int totalCost   = default;
            var discountMod = client.Character.GetDiscountMod(WorldServiceLocator._WorldServer.WORLD_CREATUREs[guid].Faction);
            foreach (var taxiPath in WorldServiceLocator._WS_DBCDatabase.TaxiPaths)
            {
                if (taxiPath.Value.TFrom == srcNode && taxiPath.Value.TTo == dstNode)
                {
                    totalCost = (int)Math.Round(totalCost + (taxiPath.Value.Price * discountMod));
                    break;
                }
            }
            if (client.Character.Copper < totalCost)
            {
                SendActivateTaxiReply(ref client, ActivateTaxiReplies.ERR_TAXINOTENOUGHMONEY);
                return;
            }
            ref var copper = ref client.Character.Copper;
            copper = (uint)(copper - totalCost);
            client.Character.TaxiNodes.Clear();
            client.Character.TaxiNodes.Enqueue(srcNode);
            client.Character.TaxiNodes.Enqueue(dstNode);
            SendActivateTaxiReply(ref client, ActivateTaxiReplies.ERR_TAXIOK);
            TaxiTake(client.Character, mount);
            TaxiMove(client.Character, discountMod);
        }
Beispiel #21
0
    public void On_CMSG_INITIATE_TRADE(ref Packets.PacketClass packet, ref WS_Network.ClientClass client)
    {
        packet.GetInt16();
        var targetGUID = packet.GetUInt64();

        WorldServiceLocator._WorldServer.Log.WriteLine(LogType.DEBUG, "[{0}:{1}] CMSG_INITIATE_TRADE [Trader={2} Target={3}]", client.IP, client.Port, client.Character.GUID, targetGUID);
        if (client.Character.DEAD)
        {
            Packets.PacketClass response6 = new(Opcodes.SMSG_TRADE_STATUS);
            try
            {
                response6.AddInt32(17);
                client.Send(ref response6);
            }
            finally
            {
                response6.Dispose();
            }
            return;
        }
        if (client.Character.LogoutTimer != null)
        {
            Packets.PacketClass response8 = new(Opcodes.SMSG_TRADE_STATUS);
            try
            {
                response8.AddInt32(19);
                client.Send(ref response8);
            }
            finally
            {
                response8.Dispose();
            }
            return;
        }
        if (((uint)client.Character.cUnitFlags & 0x40000u) != 0)
        {
            Packets.PacketClass response10 = new(Opcodes.SMSG_TRADE_STATUS);
            try
            {
                response10.AddInt32(15);
                client.Send(ref response10);
            }
            finally
            {
                response10.Dispose();
            }
            return;
        }
        if (!WorldServiceLocator._WorldServer.CHARACTERs.ContainsKey(targetGUID))
        {
            Packets.PacketClass response12 = new(Opcodes.SMSG_TRADE_STATUS);
            try
            {
                response12.AddInt32(6);
                client.Send(ref response12);
            }
            finally
            {
                response12.Dispose();
            }
            return;
        }
        if (WorldServiceLocator._WorldServer.CHARACTERs[targetGUID].DEAD)
        {
            Packets.PacketClass response13 = new(Opcodes.SMSG_TRADE_STATUS);
            try
            {
                response13.AddInt32(18);
                client.Send(ref response13);
            }
            finally
            {
                response13.Dispose();
            }
            return;
        }
        if (WorldServiceLocator._WorldServer.CHARACTERs[targetGUID].LogoutTimer != null)
        {
            Packets.PacketClass response11 = new(Opcodes.SMSG_TRADE_STATUS);
            try
            {
                response11.AddInt32(20);
                client.Send(ref response11);
            }
            finally
            {
                response11.Dispose();
            }
            return;
        }
        if (((uint)WorldServiceLocator._WorldServer.CHARACTERs[targetGUID].cUnitFlags & 0x40000u) != 0)
        {
            Packets.PacketClass response9 = new(Opcodes.SMSG_TRADE_STATUS);
            try
            {
                response9.AddInt32(15);
                client.Send(ref response9);
            }
            finally
            {
                response9.Dispose();
            }
            return;
        }
        if (client.Character.tradeInfo != null)
        {
            Packets.PacketClass response7 = new(Opcodes.SMSG_TRADE_STATUS);
            try
            {
                response7.AddInt32(0);
                client.Send(ref response7);
            }
            finally
            {
                response7.Dispose();
            }
            return;
        }
        if (WorldServiceLocator._WorldServer.CHARACTERs[targetGUID].tradeInfo != null)
        {
            Packets.PacketClass response5 = new(Opcodes.SMSG_TRADE_STATUS);
            try
            {
                response5.AddInt32(5);
                client.Send(ref response5);
            }
            finally
            {
                response5.Dispose();
            }
            return;
        }
        if (WorldServiceLocator._WorldServer.CHARACTERs[targetGUID].IsHorde != client.Character.IsHorde)
        {
            Packets.PacketClass response4 = new(Opcodes.SMSG_TRADE_STATUS);
            try
            {
                response4.AddInt32(11);
                client.Send(ref response4);
            }
            finally
            {
                response4.Dispose();
            }
            return;
        }
        if (WorldServiceLocator._WS_Combat.GetDistance(client.Character, WorldServiceLocator._WorldServer.CHARACTERs[targetGUID]) > 30f)
        {
            Packets.PacketClass response3 = new(Opcodes.SMSG_TRADE_STATUS);
            try
            {
                response3.AddInt32(10);
                client.Send(ref response3);
            }
            finally
            {
                response3.Dispose();
            }
            return;
        }
        if (client.Character.Access == AccessLevel.Trial)
        {
            Packets.PacketClass response2 = new(Opcodes.SMSG_TRADE_STATUS);
            try
            {
                response2.AddInt32(21);
                client.Send(ref response2);
            }
            finally
            {
                response2.Dispose();
            }
            return;
        }
        if (WorldServiceLocator._WorldServer.CHARACTERs[targetGUID].Access == AccessLevel.Trial)
        {
            Packets.PacketClass response = new(Opcodes.SMSG_TRADE_STATUS);
            try
            {
                response.AddInt32(21);
                client.Send(ref response);
            }
            finally
            {
                response.Dispose();
            }
            return;
        }
        ref var character = ref client.Character;
Beispiel #22
0
    public void On_CMSG_NAME_QUERY(ref Packets.PacketClass packet, ref WS_Network.ClientClass client)
    {
        try
        {
            if (checked (packet.Data.Length - 1) < 13)
            {
                return;
            }
            packet.GetInt16();
            var GUID = packet.GetUInt64();
            WorldServiceLocator._WorldServer.Log.WriteLine(LogType.DEBUG, "[{0}:{1}] CMSG_NAME_QUERY [GUID={2:X}]", client.IP, client.Port, GUID);
            Packets.PacketClass SMSG_NAME_QUERY_RESPONSE = new(Opcodes.SMSG_NAME_QUERY_RESPONSE);
            switch (GUID)
            {
            case int.MaxValue:
                try
                {
                    SMSG_NAME_QUERY_RESPONSE.AddUInt64(GUID);
                    SMSG_NAME_QUERY_RESPONSE.AddString("System");
                    SMSG_NAME_QUERY_RESPONSE.AddInt32(1);
                    SMSG_NAME_QUERY_RESPONSE.AddInt32(1);
                    SMSG_NAME_QUERY_RESPONSE.AddInt32(1);
                    client.Send(ref SMSG_NAME_QUERY_RESPONSE);
                }
                finally
                {
                    SMSG_NAME_QUERY_RESPONSE.Dispose();
                }
                break;

            default:
                if (WorldServiceLocator._CommonGlobalFunctions.GuidIsPlayer(GUID))
                {
                    if (WorldServiceLocator._WorldServer.CHARACTERs.ContainsKey(GUID))
                    {
                        try
                        {
                            SMSG_NAME_QUERY_RESPONSE.AddUInt64(GUID);
                            SMSG_NAME_QUERY_RESPONSE.AddString(WorldServiceLocator._WorldServer.CHARACTERs[GUID].Name);
                            SMSG_NAME_QUERY_RESPONSE.AddInt32((int)WorldServiceLocator._WorldServer.CHARACTERs[GUID].Race);
                            SMSG_NAME_QUERY_RESPONSE.AddInt32((int)WorldServiceLocator._WorldServer.CHARACTERs[GUID].Gender);
                            SMSG_NAME_QUERY_RESPONSE.AddInt32((int)WorldServiceLocator._WorldServer.CHARACTERs[GUID].Classe);
                            client.Send(ref SMSG_NAME_QUERY_RESPONSE);
                        }
                        finally
                        {
                            SMSG_NAME_QUERY_RESPONSE.Dispose();
                        }
                        return;
                    }
                    DataTable MySQLQuery = new();
                    WorldServiceLocator._WorldServer.CharacterDatabase.Query($"SELECT char_name, char_race, char_class, char_gender FROM characters WHERE char_guid = \"{GUID}\";", ref MySQLQuery);
                    switch (MySQLQuery.Rows.Count)
                    {
                    case > 0:
                        try
                        {
                            SMSG_NAME_QUERY_RESPONSE.AddUInt64(GUID);
                            SMSG_NAME_QUERY_RESPONSE.AddString(MySQLQuery.Rows[0].As <string>("char_name"));
                            SMSG_NAME_QUERY_RESPONSE.AddInt32(MySQLQuery.Rows[0].As <int>("char_race"));
                            SMSG_NAME_QUERY_RESPONSE.AddInt32(MySQLQuery.Rows[0].As <int>("char_gender"));
                            SMSG_NAME_QUERY_RESPONSE.AddInt32(MySQLQuery.Rows[0].As <int>("char_class"));
                            client.Send(ref SMSG_NAME_QUERY_RESPONSE);
                        }
                        finally
                        {
                            SMSG_NAME_QUERY_RESPONSE.Dispose();
                        }
                        break;

                    default:
                        WorldServiceLocator._WorldServer.Log.WriteLine(LogType.DEBUG, "[{0}:{1}] SMSG_NAME_QUERY_RESPONSE [Character GUID={2:X} not found]", client.IP, client.Port, GUID);
                        break;
                    }
                    MySQLQuery.Dispose();
                }
                else
                {
                    if (!WorldServiceLocator._CommonGlobalFunctions.GuidIsCreature(GUID))
                    {
                        return;
                    }
                    if (WorldServiceLocator._WorldServer.WORLD_CREATUREs.ContainsKey(GUID))
                    {
                        try
                        {
                            SMSG_NAME_QUERY_RESPONSE.AddUInt64(GUID);
                            SMSG_NAME_QUERY_RESPONSE.AddString(WorldServiceLocator._WorldServer.WORLD_CREATUREs[GUID].Name);
                            SMSG_NAME_QUERY_RESPONSE.AddInt32(0);
                            SMSG_NAME_QUERY_RESPONSE.AddInt32(0);
                            SMSG_NAME_QUERY_RESPONSE.AddInt32(0);
                            client.Send(ref SMSG_NAME_QUERY_RESPONSE);
                        }
                        finally
                        {
                            SMSG_NAME_QUERY_RESPONSE.Dispose();
                        }
                    }
                    else
                    {
                        WorldServiceLocator._WorldServer.Log.WriteLine(LogType.DEBUG, "[{0}:{1}] SMSG_NAME_QUERY_RESPONSE [Creature GUID={2:X} not found]", client.IP, client.Port, GUID);
                    }
                }

                break;
            }
        }
        catch (Exception e)
        {
            WorldServiceLocator._WorldServer.Log.WriteLine(LogType.CRITICAL, "Error at name query.{0}", Environment.NewLine + e);
        }
    }