wdym wrong.
identity is identity, it's not entity.
entitylists contains identities, identities have a pointer to entity as their first member(ie offset 0). you can think of identities as "passports" of entities - it's got name,index,serial number, flags, etc, as well as the address of the entity itself
you take list at index (entityIndex div 512) and that list's entry at index (entityIndex mod 512), you get the identity. you read first 8 bytes(void*) and you get address of the entity. you then do whatever you want with it.
you want entities indexed from 1 to 64 inclusive(ie players), from players you get their selected heroes(m_hAssignedHero netvar)
auto GameResourceServiceClient =
((uintptr_t(*)(const char*, void*))GetProcAddress(GetModuleHandleA("engine2.dll"),
"CreateInterface"))("GameResourceServiceClientV001", nullptr);
void* CGameEntitySystem = *(void**)(GameResourceServiceClient + 0x58);
for (std::size_t index = 1; index <= 64; ++index)
{
constexpr auto sizeof_CEntityIdentity = 0x78;
void* List = *(void**)((uintptr_t)CGameEntitySystem + 0x10 + (index / 512) * sizeof(void*));
if (List)
{
void* Identity = (void*)((uintptr_t)List + (index % 512) * sizeof_CEntityIdentity);
void* Entity = *(void**)Identity;
if (Entity)
{
constexpr auto offset_m_iszPlayerName = 0x628;
constexpr auto offset_m_hAssignedHero = 0x7e4;
constexpr auto high_17_bits = 0b1111111111111111111000000000000000;
constexpr auto low_15_bits = 0b0000000000000000000111111111111111;
struct CHandle
{
int value;
int serial() const noexcept
{
return value & high_17_bits;
}
int index() const noexcept
{
return value & low_15_bits;
}
bool is_valid() const noexcept
{
return value != -1;
}
};
OutputDebugStringA(std::format("player {}({}) controls hero indexed {}\n",
(char*)((uintptr_t)Entity + offset_m_iszPlayerName),
Entity, ((*(CHandle*)((uintptr_t)Entity + offset_m_hAssignedHero)).index())).data());
}
}
}
DebugString: "player unnamed(0x13dac701c00) controls hero indexed 157"
DebugString: "player Kat(0x13d4dab1c00) controls hero indexed 209"
DebugString: "player Kjetil(0x13cc7e42a00) controls hero indexed 256"
DebugString: "player Boris(0x13cca980000) controls hero indexed 304"
DebugString: "player Julia(0x13c78d80000) controls hero indexed 351"
DebugString: "player Jéssica(0x13d34276200) controls hero indexed 399"
DebugString: "player Anne(0x13d38564600) controls hero indexed 447"
DebugString: "player Bjørn(0x13d34274600) controls hero indexed 495"
DebugString: "player กิตติ(0x13d38b50000) controls hero indexed 542"
DebugString: "player Zhang(0x13d2e8a5400) controls hero indexed 590"