Added function to get entity type

pull/27/head
MisterY52 4 years ago
parent 075ee9fe8c
commit 41641a592a

@ -20,6 +20,25 @@ bool Entity::Observing(uint64_t entitylist)
return *(bool*)(buffer + OFFSET_OBSERVER_MODE);
}
//https://github.com/CasualX/apexbot/blob/master/src/state.cpp#L104
void get_class_name(uint64_t entity_ptr, char* out_str)
{
uint64_t client_networkable_vtable;
apex_mem.Read<uint64_t>(entity_ptr + 8 * 3, client_networkable_vtable);
uint64_t get_client_class;
apex_mem.Read<uint64_t>(client_networkable_vtable + 8 * 3, get_client_class);
uint32_t disp;
apex_mem.Read<uint32_t>(get_client_class + 3, disp);
const uint64_t client_class_ptr = get_client_class + disp + 7;
ClientClass client_class;
apex_mem.Read<ClientClass>(client_class_ptr, client_class);
apex_mem.ReadArray<char>(client_class.pNetworkName, out_str, 32);
}
int Entity::getTeamId()
{
return *(int*)(buffer + OFFSET_TEAM);
@ -52,7 +71,10 @@ bool Entity::isPlayer()
bool Entity::isDummy()
{
return *(int*)(buffer + OFFSET_TEAM) == 97;
char class_name[33] = {};
get_class_name(ptr, class_name);
return strncmp(class_name, "CAI_BaseNPC", 11) == 0;
}
bool Entity::isKnocked()
@ -155,7 +177,10 @@ void Entity::get_name(uint64_t g_Base, uint64_t index, char* name)
bool Item::isItem()
{
return *(int*)(buffer + OFFSET_ITEM_GLOW) >= 1358917120;
char class_name[33] = {};
get_class_name(ptr, class_name);
return strncmp(class_name, "CPropSurvival", 13) == 0;
}
bool Item::isGlowing()

@ -74,8 +74,19 @@ private:
float zoom_fov;
};
struct ClientClass {
uint64_t pCreateFn;
uint64_t pCreateEventFn;
uint64_t pNetworkName;
uint64_t pRecvTable;
uint64_t pNext;
uint32_t ClassID;
uint32_t ClassSize;
};
Entity getEntity(uintptr_t ptr);
Item getItem(uintptr_t ptr);
bool WorldToScreen(Vector from, float* m_vMatrix, int targetWidth, int targetHeight, Vector& to);
float CalculateFov(Entity& from, Entity& target);
QAngle CalculateBestBoneAim(Entity& from, uintptr_t target, float max_fov);
void get_class_name(uint64_t entity_ptr, char* out_str);
Loading…
Cancel
Save