예제 #1
0
        private string PlayerNameFromGuid(ulong guid)
        {
            string playerName = "";

            if (Caching.GetPlayerName(guid, ref playerName))
            {
                return(playerName);
            }
            else
            {
                ulong mask, base_, offset, current, shortGUID, testGUID;

                mask  = WowReader.ReadUInt32((UIntPtr)Offsets.Name.nameStore + Offsets.Name.nameMask);
                base_ = WowReader.ReadUInt32((UIntPtr)Offsets.Name.nameStore + Offsets.Name.nameBase);

                shortGUID = guid & 0xffffffff;
                offset    = 12 * (mask & shortGUID);

                current = WowReader.ReadUInt32((UIntPtr)(base_ + offset + 8));
                offset  = WowReader.ReadUInt32((UIntPtr)(base_ + offset));

                if ((current & 0x1) == 0x1)
                {
                    return("");
                }

                testGUID = WowReader.ReadUInt32((UIntPtr)(current));

                while (testGUID != shortGUID)
                {
                    current = WowReader.ReadUInt32((UIntPtr)(current + offset + 4));

                    if ((current & 0x1) == 0x1)
                    {
                        return("");
                    }
                    testGUID = WowReader.ReadUInt32((UIntPtr)(current));
                }


                //Читаем имя игрока
                string readedName = WowReader.ReadUTF8String((UIntPtr)(current + Offsets.Name.nameString), 26);

                //Добавляем в кэш прочитаннон имя
                Caching.AddPlayerName(guid, readedName);

                //Возвращяем прочитаный ник
                return(readedName);
            }
        }