GetLow() 공개 메소드

public GetLow ( ) : ulong
리턴 ulong
예제 #1
0
        public void TestGetLow()
        {
            var guid1 = new WowGuid64(0xF130005C0500105F);
            var guid2 = new WowGuid64(0x600000002B2D7C9);
            var guid3 = new WowGuid64(0);

            Assert.AreEqual(0x105F, guid1.GetLow());
            Assert.AreEqual(0x2B2D7C9, guid2.GetLow());
            Assert.AreEqual(0, guid3.GetLow());
        }
예제 #2
0
        public static void HandleNameQueryResponse(Packet packet)
        {
            var guid = packet.StartBitStream(3, 6, 7, 2, 5, 4, 0, 1);
            packet.ParseBitStream(guid, 5, 4, 7, 6, 1, 2);

            var nameData = !packet.ReadBool("!nameData");
            if (nameData)
            {
                packet.ReadInt32("RealmID"); // 108
                packet.ReadInt32("unk36");
                packet.ReadByteE<Class>("Class");
                packet.ReadByteE<Race>("Race");
                packet.ReadByte("Level");
                packet.ReadByteE<Gender>("Gender");
            }
            packet.ParseBitStream(guid, 0, 3);

            packet.WriteGuid("Guid", guid);

            if (!nameData)
                return;

            var guid2 = new byte[8];
            var guid3 = new byte[8];

            guid2[2] = packet.ReadBit();
            guid2[7] = packet.ReadBit();
            guid3[7] = packet.ReadBit();
            guid3[2] = packet.ReadBit();
            guid3[0] = packet.ReadBit();
            var unk32 = packet.ReadBit();
            guid2[4] = packet.ReadBit();
            guid3[5] = packet.ReadBit();
            guid2[1] = packet.ReadBit();
            guid2[3] = packet.ReadBit();
            guid2[0] = packet.ReadBit();

            var len = new uint[5];
            for (var i = 5; i > 0; i--)
                len[i - 1] = packet.ReadBits(7);

            guid3[6] = packet.ReadBit();
            guid3[3] = packet.ReadBit();
            guid2[5] = packet.ReadBit();
            guid3[1] = packet.ReadBit();
            guid3[4] = packet.ReadBit();

            var len56 = packet.ReadBits(6);

            guid2[6] = packet.ReadBit();

            packet.ReadXORByte(guid3, 6);
            packet.ReadXORByte(guid3, 0);

            var name = packet.ReadWoWString("Name", len56);
            var playerGuid = new WowGuid64(BitConverter.ToUInt64(guid, 0));
            StoreGetters.AddName(playerGuid, name);

            packet.ReadXORByte(guid2, 5);
            packet.ReadXORByte(guid2, 2);
            packet.ReadXORByte(guid3, 3);
            packet.ReadXORByte(guid2, 4);
            packet.ReadXORByte(guid2, 3);
            packet.ReadXORByte(guid3, 4);
            packet.ReadXORByte(guid3, 2);
            packet.ReadXORByte(guid2, 7);

            for (var i = 5; i > 0; i--)
                packet.ReadWoWString("str", len[i - 1], i);

            packet.ReadXORByte(guid2, 6);
            packet.ReadXORByte(guid3, 7);
            packet.ReadXORByte(guid3, 1);
            packet.ReadXORByte(guid2, 1);
            packet.ReadXORByte(guid3, 5);
            packet.ReadXORByte(guid2, 0);

            packet.WriteLine("Account: {0}", BitConverter.ToUInt64(guid2, 0));
            packet.WriteGuid("Guid3", guid3);

            var objectName = new ObjectName
            {
                ObjectType = ObjectType.Player,
                Name = name,
                ID = (int)playerGuid.GetLow()
            };
            Storage.ObjectNames.Add(objectName, packet.TimeSpan);
        }