Dateien nach "inc" hochladen
This commit is contained in:
+110
@@ -0,0 +1,110 @@
|
||||
#pragma once
|
||||
|
||||
#define OFF_COLLISION 0x03b8
|
||||
#define RS_CONVERT_TEAM_MODULO(num) ((num % 2) ? 1 : 2)
|
||||
|
||||
class Collision
|
||||
{
|
||||
public:
|
||||
auto vec_mins() { return *(Vector3D*)(BASE_OF(this) + 0x10); }
|
||||
auto vec_maxs() { return *(Vector3D*)(BASE_OF(this) + 0x1C); }
|
||||
|
||||
private:
|
||||
};
|
||||
|
||||
enum class EEntityType
|
||||
{
|
||||
INVALID = 0,
|
||||
PLAYER,
|
||||
DUMMIE,
|
||||
};
|
||||
|
||||
class Entity
|
||||
{
|
||||
public:
|
||||
Entity() = delete;
|
||||
Entity(u64 base)
|
||||
{
|
||||
this->m_base = base;
|
||||
}
|
||||
|
||||
u64 base() { return this->m_base; }
|
||||
u64 signifier_id() { return *(u64*)(this->m_base + OFF_ENTITY_SIGNIFIER); }
|
||||
bool is_valid() { return this->m_base != 0ull; }
|
||||
bool is_alive() { return PLAYER__IS_ALIVE(this->m_base); }
|
||||
auto type()
|
||||
{
|
||||
u64 id_ptr = this->signifier_id( );
|
||||
if(id_ptr != 0ull)
|
||||
{
|
||||
u64 id = *(u64*)id_ptr;
|
||||
switch(id)
|
||||
{
|
||||
case 0x726579616c70: return EEntityType::PLAYER;
|
||||
case 0x6d6d75645f63706e: return EEntityType::DUMMIE;
|
||||
}
|
||||
}
|
||||
|
||||
return EEntityType::INVALID;
|
||||
}
|
||||
|
||||
auto vec_origin() { return *(Vector3D*)(this->m_base + OFF_ENTITY_VEC_ORIGIN); }
|
||||
auto health() { return *(int*)(this->m_base + OFF_ENTITY_HEALTH); }
|
||||
auto health_max(){ return *(int*)(this->m_base + OFF_ENTITY_HEALTH_MAX); }
|
||||
auto team_number() { return *(int*)(this->m_base + OFF_ENTITY_TEAM_NUMBER); }
|
||||
auto squad_id() { return *(int*)(this->m_base + OFF_ENTITY_SQUAD_ID); }
|
||||
|
||||
auto collision() { return (Collision*)(this->m_base + OFF_ENTITY_COLLISION);}
|
||||
|
||||
auto vec_recoil() {return *(Vector3D*)(this->m_base + OFF_ENTITY_VEC_PUNCH_ANGLE); }
|
||||
auto vec_eye_angle() { return *(Vector3D*)(this->m_base + OFF_ENTITY_VEC_EYE_ANGLE); }
|
||||
auto coord_frame()
|
||||
{
|
||||
constexpr u32 offset = 0x7C0;
|
||||
math::matrix3x4 result;
|
||||
memset(&result, 0, sizeof(result));
|
||||
memcpy(&result, (void*)(this->m_base + offset), sizeof(math::matrix3x4));
|
||||
return result;
|
||||
}
|
||||
|
||||
auto get_center_pos()
|
||||
{
|
||||
auto result = Vector3D(xf(0), xf(0), xf(0));
|
||||
auto pcoll = collision();
|
||||
if(pcoll)
|
||||
{
|
||||
auto vec_mins = pcoll->vec_mins();
|
||||
auto vec_maxs = pcoll->vec_maxs();
|
||||
|
||||
result = vec_origin();
|
||||
result.z += (vec_mins.z + vec_maxs.z) / xf(0x40000000);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
bool is_ally_of(Context* ctx, Entity& other)
|
||||
{
|
||||
if(ctx->state.game_mode == GameModes::CONTROL ||
|
||||
ctx->state.game_mode == GameModes::TEAM_DEATHMATCH)
|
||||
{
|
||||
return RS_CONVERT_TEAM_MODULO(this->team_number()) ==
|
||||
RS_CONVERT_TEAM_MODULO(other.team_number());
|
||||
}
|
||||
|
||||
if(ctx->state.game_mode == GameModes::GUN_RUN)
|
||||
{
|
||||
return this->squad_id() == other.squad_id();
|
||||
}
|
||||
|
||||
return this->team_number() == other.team_number();
|
||||
}
|
||||
|
||||
int64_t get_level(Context* pctx)
|
||||
{
|
||||
using fn = int64_t(__fastcall*)(u64);
|
||||
auto fun = (fn)(pctx->game_base + 0xB6ACD0);
|
||||
return fun(this->m_base);
|
||||
}
|
||||
private:
|
||||
u64 m_base;
|
||||
};
|
||||
Reference in New Issue
Block a user