diff --git a/inc/entity.h b/inc/entity.h new file mode 100644 index 0000000..70f48f1 --- /dev/null +++ b/inc/entity.h @@ -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; +}; diff --git a/inc/features.h b/inc/features.h new file mode 100644 index 0000000..9119169 --- /dev/null +++ b/inc/features.h @@ -0,0 +1,10 @@ +#pragma once + +namespace features +{ + extern void glow( Context* pctx ); + extern void rcs(Context* pctx, float& x, float& y); + extern void movement( Context* pctx ); + extern void esp(Context* pctx); + extern void esp_tick(Context* pctx); +} diff --git a/inc/in_state.h b/inc/in_state.h new file mode 100644 index 0000000..17a6c58 --- /dev/null +++ b/inc/in_state.h @@ -0,0 +1,77 @@ + +#pragma once + +namespace rs +{ + enum class InKeyStates : int + { + UNSET = 0, + FORCE = 1, + TAP = 2, + RELEASE = 3, + IDLE = 4, + HOLDING = 5, + }; + + class In_state + { + public: + In_state() + { + _pstate = nullptr; + } + + In_state(uptr addr) : + In_state() + { + construct(addr); + } + + void construct(uptr addr) + { + _pstate = reinterpret_cast(addr); + } + + auto state() const { return *_pstate; } + + void tap() const + { + *_pstate = InKeyStates::TAP; + } + + void force() const + { + *_pstate = InKeyStates::FORCE; + } + + void toggle(bool val) const + { + if (val) + *_pstate = InKeyStates::HOLDING; + else + *_pstate = InKeyStates::IDLE; + } + + void block() const + { + *_pstate = InKeyStates::RELEASE; + } + + void reset() const + { + *_pstate = InKeyStates::IDLE; + } + + bool active() const + { + if (*_pstate == InKeyStates::HOLDING || *_pstate == InKeyStates::FORCE || + *_pstate == InKeyStates::TAP) + return true; + + return false; + } + + private: + InKeyStates *_pstate; + }; +}