Исходник Warface Classes [RU]

кошмарим форум
Забаненный
Забаненный
Статус
Оффлайн
Регистрация
22 Май 2021
Сообщения
84
Реакции
11
Обратите внимание, пользователь заблокирован на форуме. Не рекомендуется проводить сделки.
C++:
Expand Collapse Copy
#define STATIC_SSGE                                0x141E63CF8
#define STATIC_SILHOUETTS                        0x1414ED6E0

#define j_memset ((void*(*)(void*, int, size_t))0x1417AD3DA)
#ifndef j_memset
#define j_memset(dst, val, size) __stosb( ( PBYTE ) dst, val, size)
#endif
#define j_memcpy  ((void*(*)(void*, void const*, size_t))0x1417AD3CE)
#ifndef j_memcpy
#define j_memcpy(dst, src, size) __movsb( ( PBYTE ) dst, ( const PBYTE ) src, size )
#endif

struct СSkeletonPose
{
public:
    QuatT& GetAbsJointByID(int nJointID) { return CallFunction<QuatT& (__thiscall*)(PVOID, int)>(this, 0x38)(this, nJointID); }
    int16 GetJointIdByName(const char* sz_joint_name) { return CallFunction<int16(__fastcall*)(PVOID64, const char*)>(this, 0x18)(this, sz_joint_name); }
    const char* GetszNameByJointId(int16 sz_joint_name) { return CallFunction<const char* (__fastcall*)(PVOID64, int16)>(this, 0x30)(this, sz_joint_name); }
};
struct СCharacterInstance
{
public:
    СSkeletonPose* GetISkeletonPose() { return CallFunction<СSkeletonPose* (__thiscall*)(PVOID)>(this, 0x28)(this); }
};
class CPhysicalEntity
{
public:
    void* GetForeignData(int itype = 0) { return CallFunction<void* (__thiscall*)(PVOID, int)>(this, 0x68)(this, itype); }
};
struct CRayHit
{
    float dist;
    CPhysicalEntity* pCollider;
    int ipart;
    int partid;
    short surface_idx;
    short idmatOrg;
    int foreignIdx;
    int iNode;
    Vec3 pt;
    Vec3 n;
    int bTerrain;
    int iPrim;
    CRayHit* next;
};
struct CRayHitCached
{
    CPhysicalEntity* pCollider;
    int ipart;
    int iNode;

    CRayHitCached() { pCollider = 0; ipart = 0; }
    CRayHitCached(const CRayHit& hit) { pCollider = hit.pCollider; ipart = hit.ipart; iNode = hit.iNode; }
    CRayHitCached& operator=(const CRayHit& hit) { pCollider = hit.pCollider; ipart = hit.ipart; iNode = hit.iNode; return *this; }
};
struct SSharedGameHitInfo
{
    EntityId shooterId;//0x00
    EntityId targetId;//0x04
    int material;//0x08
    int typeId;//0x0C
    int bulletType;//0x10
    int partId;//0x14
    Vec3 pos;//0x18
    Vec3 dir;//0x24
    Vec3 shootPos;//0x30
    bool meleeArmorAbsorb;//0x3C
};
struct SSourceGameHitInfo
{
    EntityId itemId;////0x40
    EntityId projectileId;//0x44
    uint16 ammoClassId;//0x48
    float angle;//0x4C
    Vec3 normal;//0x50
    bool silencer;//0x5C
};
struct SClientGameHitInfo
{
    SSharedGameHitInfo shared;//0x00
    SSourceGameHitInfo source;//0x40
    float travelDistance;//0x60
    float damageReduction;//0x64
    bool bFromRemote;//0x68
    bool canBeReported;//0x69
    bool bRequest;//0x6A
};
struct CSurfaceType
{
public:
    const char* GetName() { return CallFunction<const char* (__thiscall*)(PVOID)>(this, 0x18)(this); }
};
class CGameRules
{
public:
    INT get_team(int entityId)
    {
        return CallFunction<INT(__fastcall*)(PVOID, int)>(this, 0x368)(this, entityId); // string -> IsSameTeam
        /* reverse
        ///////////////////// step 1
        DWORD2(v8) = 0;
        *(_QWORD *)&v8 = sub_14113E890; <-- here
        if ( v2 )
        {
            v19 = v1;
            v9 = "IsSameTeam";
        ///////////////////// step 2
        v7 = (*(__int64 (**)(void))(**(_QWORD **)(a1 + 208) + 1096i64))();
        v10 = 2;
        if ( v7 )
            LOBYTE(v11) = sub_141008850(v7, v5, v4); <-- here
        else
            LOBYTE(v11) = 0;
        ///////////////////// step 3
        v6 = *(_DWORD *)(qword_1420558B8 + 1536);
        if ( v6 <= 0xB && v6 != 3 )
            return a2 == a3
                || (*(unsigned int (__fastcall **)(__int64))(*(_QWORD *)v3 + 872i64))(v3) <-- 872 / 8 = 109 (if 64 bit = 8, if 32 bit = 4)
        */
    }

    int GetTeam(EntityId entityId) { return CallFunction<int(__thiscall*)(PVOID, EntityId)>(this, 0x368)(this, entityId); }
    int GetHitTypeId(const char* type) { return CallFunction<int(__thiscall*)(PVOID, const char*)>(this, 0x140)(this, type); }
    int GetHitMaterialId(const char* materialName) { return CallFunction<int(__thiscall*)(PVOID, const char*)>(this, 0x390)(this, materialName); }
    CSurfaceType* GetHitMaterial(int materialId) { return CallFunction<CSurfaceType* (__thiscall*)(PVOID, int)>(this, 0x398)(this, materialId); }
    void ClientHit(SClientGameHitInfo* info) { return CallFunction<void(__thiscall*)(PVOID, SClientGameHitInfo*)>(this, 0x4E0)(this, info); }
};
class CEntityClass
{
public:
    const char* GetIClassName() { return CallFunction<const char* (__fastcall*)(PVOID64)>(this, 0x10)(this); }
};
struct CEntityArchetype
{
public:
    const char* GetName() { return CallFunction<const char* (__thiscall*)(PVOID)>(this, 0x10)(this); }
};
class CEntity
{
public:
    __int32 get_entity_id()
    {
        return *(__int32*)((__int64)this + 0x18);
    }
    CEntityClass* GetEntityClass() { return CallFunction<CEntityClass* (__fastcall*)(PVOID64)>(this, 0x18)(this); }
    CEntityArchetype* GetCEntityArchetype() { return (CEntityArchetype*)*(DWORD64*)((DWORD64)this + 0x38); }
    Matrix34 GetEntityWorldTM() { return (Matrix34) * (Matrix34*)((DWORD64)this + 0x40); }
    void SetName(const char* Name) { return CallFunction<void(__thiscall*)(PVOID, const char*)>(this, 0x58)(this, Name); }
    const char* GetName() { return CallFunction<const char* (__thiscall*)(PVOID)>(this, 0x60)(this); }
    Vec3 GetPosition() { return *(Vec3*)((DWORD64)this + 0x70); }
    bool IsHidden() { return CallFunction<bool(__fastcall*)(PVOID64)>(this, 0x178)(this); }
    СCharacterInstance* GetCharacter(int nSlot) { return CallFunction<СCharacterInstance* (__thiscall*)(PVOID, int)>(this, 0x298)(this, nSlot); }
};
class CEntityIt
{
public:
    virtual ~CEntityIt() = 0;
    virtual void AddRef() = 0;
    virtual void Release() = 0;
    virtual void MoveFirst() = 0;
    virtual bool IsEnd() = 0;
    virtual CEntity* This() = 0;
    virtual CEntity* Next() = 0;
};
class CEntitySystem
{
public:
    CEntityIt* GetEntityIterator() { return CallFunction<CEntityIt* (__thiscall*)(PVOID)>(this, 0xA8)(this); }
};
struct CGameObject
{
public:
    char pad_0x0000[0x18];
    CEntity* m_pEntity;
};
struct CWeaponParamsTwo
{
public:
    char pad_0x00[0x68];
    TWeaponMap m_stats;    // 0x68    "needIcon"
    BOOL GetStat(uint32_t id, FLOAT* value)
    {
        if (uint32_t* stat = FindStat(id))
        {
            *(uint32_t*)value = stat[0] ^ stat[1];
            return TRUE;
        }
        return FALSE;
    }
    BOOL SetStat(uint32_t id, FLOAT value)
    {
        if (uint32_t* stat = FindStat(id))
        {
            stat[0] = *(uint32_t*)&value ^ stat[1];
            return TRUE;
        }
        return FALSE;
    }
    void FastKnife(FLOAT value)
    {
        SetStat(56, value);
        SetStat(57, 0.1f);
        SetStat(61, value);
        SetStat(83, value);
        SetStat(84, 0.01f);
        SetStat(85, value);
    }
    void GetIScatter(FLOAT value)
    {
        SetStat(95, value);
        SetStat(96, value);
    }
private:
    uint32_t* FindStat(uint32_t id)
    {
        TWeaponMap::iterator it = m_stats.find(id);
        if (it != m_stats.end())
        {
            return it->second;
        }
        return 0;
    }
};
class CWeaponParamThree
{
public:
    int CounterAmmo(VOID) { return (int)*(DWORD64*)((DWORD64)this + 0xC); }
};
class CWeaponSpecific
{
public:
    CWeaponParamsTwo* GetIWeaponParamsTwo() { return (CWeaponParamsTwo*)*(DWORD64*)((DWORD64)this + 0x60); }
    CWeaponParamThree* GetIWeaponParamThree() { return (CWeaponParamThree*)*(DWORD64*)((DWORD64)this + 0x0068); }
    void RequestReload() { auto _this = this; ((uint64(__fastcall*)(PVOID, uint32))CWeaponSpecific_RequestReload)(&_this, 1); }
    void RequestShoot(int pPellets = 0) { ((int(__thiscall*)(CWeaponSpecific*, int*))CWeaponSpecific_RequestShoot)(this, &pPellets); }
    void GetShutter(int8 Value) { *(int8*)((DWORD64)this + 0xD2) = Value; }
    const char* GetWeaponName() { return (const char*)*(uint64*)((uint64)this + 0x28); }
    void IsFiring(bool Status) { *(DWORD64*)((DWORD64)this + 0xB8) = Status; }
    bool IsFiring()
    {
        DWORD64 Firing = *(DWORD64*)((DWORD64)this + 0xB8);
        return (Firing == 3 || Firing == 6 || Firing == 12 || Firing == 13 || Firing == 14 || Firing == 15 || Firing == 16 || Firing == 48 || Firing == 49);
    }
};
class CWeapon
{
public:
    CWeaponSpecific* GetIWeaponSpecific() { return (CWeaponSpecific*)*(DWORD64*)((DWORD64)this + 0x8); }
    void SetFiringPos(Vec3 Position) { *(Vec3*)((DWORD64) * (DWORD64*)((DWORD64)this + 0x18) + 0x1C) = Position; }
    void StartFire() { CallFunction<void(__thiscall*)(PVOID)>(this, 0x58)(this); }
    void StopFire() { CallFunction<void(__thiscall*)(PVOID)>(this, 0x60)(this); }
};
class CItem
{
public:
    CEntity* GetIWeaponEntity() { return m_pEntity; }
    CGameObject* GetGameObject() { return m_pGameObject; }
    EntityId GetEntityId() { return m_entityId; }
    DWORD GetItemId() { return m_dwItemId; }
    CWeapon* GetIWeapon() { return (CWeapon*)((DWORD64)this + 0x278); }
private:
    char pad_0x0000[0x10]; //0x0000
    CEntity* m_pEntity; //0x0010
    CGameObject* m_pGameObject; //0x0018
    EntityId m_entityId; //0x0020
    char pad_0x0024[0x28]; //0x0024
    DWORD m_dwItemId; //0x004C
};
struct CInventory
{
public:
    int GetCount()
    {
        return CallFunction<int(__thiscall*)(PVOID)>(this, 0x100)(this);
    }
    EntityId GetItem(int slotId)
    {
        return CallFunction<EntityId(__thiscall*)(PVOID, int)>(this, 0x120)(this, slotId);
    }
    EntityId GetCurrentItemId()
    {
        return CallFunction<EntityId(__thiscall*)(PVOID)>(this, 0x170)(this);
    }
};
class CActor
{
public:
    CEntity* GetEntity() { return *(CEntity**)((__int64)this + 0x10); }
    EntityId GetTriggeredID()
    {
        DWORD64 offset_0 = *(DWORD64*)(DWORD64(this + 0x18));
        if (!offset_0) return 0;
        DWORD64 offset_1 = *(DWORD64*)(DWORD64(offset_0 + 0x60));
        if (!offset_1) return 0;
        DWORD64 offset_2 = *(DWORD64*)(DWORD64(offset_1 + 0x20));
        if (!offset_2) return 0;

        return *(EntityId*)(DWORD64(offset_2 + 0x170));
    }
    CItem* GetCurrentItem(bool includeVehicle = false) { return CallFunction<CItem* (__thiscall*)(PVOID, bool)>(this, 0x1C8)(this, includeVehicle); }
    EntityId GetEntityId() { return (EntityId) * (DWORD64*)((DWORD64)this + 0x20); }


    CInventory* GetInventory() { return CallFunction<CInventory* (__thiscall*)(PVOID)>(this, 0x1D8)(this); }
    int GetHealth() { return CallFunction<int(__thiscall*)(PVOID)>(this, 0xD8)(this); }
    bool IsDead() { return GetHealth() <= 0; }
    void GetRecoilParams(int ParamsRecoil) { CallFunction<void(__thiscall*)(PVOID, int)>(this, 0x2D8)(this, ParamsRecoil); }
    int GetWeaponSlot() { return *(int*)((__int64)this + (0xECC + 0x8 + 0x1)); }
    __int32 GetTeamId() { return *(__int32*)((__int64)this + 0x3E0); }
    __int32 GetClassId() { return *(__int32*)((__int64)this + 0x458); }
};

class CActorSystem
{
public:
    CActor* GetActor(int entityId) { return CallFunction<CActor* (__thiscall*)(PVOID, int)>(this, 0x78)(this, entityId); }
};
struct CGameFrameworkListener
{
    virtual ~CGameFrameworkListener() { }//0
    virtual void Render(float fDeltaTime) { };//1
    virtual void OnSaveGame(class ISaveGame* pSaveGame) { };//2
    virtual void OnLoadGame(class ILoadGame* pLoadGame) { };//3
    virtual void OnLevelEnd(const char* nextLevel) { };//4
    virtual void OnActionEvent(const SActionEvent& event) { };//5
    virtual void Fun() { }//6
};
struct CItemSystem
{
public:
    CItem* GetItem(EntityId itemId)
    {
        return CallFunction<CItem* (__thiscall*)(PVOID, EntityId)>(this, 0xB0)(this, itemId);
    }
};
class CGameFramework
{
public:
    static CGameFramework* singleton()
    {
        return *(CGameFramework**)0x14217D408;
    }

    bool GetClientActor(CActor** pActor)
    {
        return CallFunction<bool(__thiscall*)(PVOID, CActor**)>(this, 0x470)(this, pActor);
    }
    CActorSystem* GetActorSystem()
    {
        return *(CActorSystem**)((__int64)this + 0x04E0);
    }
    CGameRules* GetGameRulesSystem() { return CallFunction<CGameRules* (__fastcall*)(PVOID)>(this, 0x448)(this); }

    CItemSystem* GetIItemSystem() { return CallFunction<CItemSystem* (__thiscall*)(PVOID)>(this, 0xD0)(this); }
    void RegisterListener(CGameFrameworkListener* pGameFrameworkListener, const char* name, EFRAMEWORKLISTENERPRIORITY eFrameworkListenerPriority)
    {
        CallFunction<void(__fastcall*)(PVOID, CGameFrameworkListener*, const char*, EFRAMEWORKLISTENERPRIORITY)>(this, 0x6C)(this, pGameFrameworkListener, name, eFrameworkListenerPriority);
    }
};


struct w2s_info {

    float x;

    float y;

    float z;

    float* s_x;

    float* s_y;

    float* s_z;

};
class CRenderer
{
public:
    void DrawAABB(AABB& bbox) { return CallFunction<void(__thiscall*)(void*, AABB&)>(this, 0x7F8)(this, bbox); }
    Vec3 GetViewCamera() { return *(Vec3*)((DWORD64)this + 0x1720); }
    float GetWidth() { return (float)CallFunction<int(__fastcall*)(PVOID)>(this, 0x9488)(this); }
    float GetHeight() { return (float)CallFunction<int(__fastcall*)(PVOID)>(this, 0x948C)(this); }
    IDirect3DDevice9* ClientDevice() { return (IDirect3DDevice9*)*(DWORD64*)((DWORD64)this + 0xA760); }
    bool project_to_screen(w2s_info* info) {

        using fn = bool(__thiscall*)(void*, w2s_info*);
        return (*(fn**)this)[109](this, info);

    }
    bool world_to_screen(Vec3 in, Vec3& out) {

        w2s_info info;

        info.x = in.x;
        info.y = in.y;
        info.z = in.z;
        info.s_x = &out.x;
        info.s_y = &out.y;
        info.s_z = &out.z;

        project_to_screen(&info);

        if (out.z < 0.f || out.z > 1.f)
            return false;

        out.x = out.x * (GetWidth() / 100.0f);
        out.y = out.y * (GetHeight() / 100.0f);

        return true;

    }
};
class CGame
{
public:
    CGameFramework* GetIGameFramework() { typedef CGameFramework* (__fastcall* CGameFramework)(PVOID64); return CallFunction<CGameFramework>(this, 0x70)(this); }
    SCVars* GetCVars() { return (SCVars*)*(DWORD64*)((DWORD64)this + 0x128); }
};
class CSystem {};
class CConsole
{
public:
    void sv_telemetry_memory_limit(int iValue) { *(int*)((DWORD64)this + 0x10) = iValue; }
    void sv_telemetry_memory_log(int iValue) { *(int*)((DWORD64)this + 0x18) = iValue; }
    void sv_cvars_hash_enable(int pEnable) { *(int*)((DWORD64)this + 0xD4) = pEnable; }
    void sv_empty_grenade_fix(int iValue) { *(int*)((DWORD64)this + 0xD8) = iValue; }
    SCVars* GetCVars() { return (SCVars*)*(DWORD64*)((DWORD64)this + 0xB8); }
};
class SSystemGlobalEnvironment
{
public:
    class CRenderer* GetIRenderer() { return (CRenderer*)*(uintptr_t*)((uintptr_t)this + 0x48); }

    class CEntitySystem* GetIEntitySystem() { return (CEntitySystem*)*(uintptr_t*)((uintptr_t)this + 0xE0); }
    class CConsole* GetConsole() { return (CConsole*)*(uintptr_t*)((uintptr_t)this + 0xC0); }
    class CPhysicalWorld* GetIPhysicalWorld() { return (CPhysicalWorld*)*(uintptr_t*)((uintptr_t)this + 0x70); }
    class CGame* GetIGame() { return (CGame*)*(uintptr_t*)((uintptr_t)this + 0x40); }
    class CSystem* GetSystem() { return (CSystem*)*(uintptr_t*)((uintptr_t)this + 0xF0); }
    //class CTimer* GetTimer() { return (CTimer*)*(uintptr_t*)((uintptr_t)this + 0xB8); }
    static SSystemGlobalEnvironment* Singleton() { return *(SSystemGlobalEnvironment**)STATIC_SSGE; }
};
class CPhysicalWorld
{
public:
    int RayWorldIntersection(const Vec3& org, const Vec3& dir, int objtypes, unsigned int flags, CRayHit* hits, int nMaxHits, CPhysicalEntity** pSkipEnts = 0, int nSkipEnts = 0, void* pForeignData = 0, int iForeignData = 0, const char* pNameTag = "RayWorldIntersection(Game)", CRayHitCached* phitLast = 0, int iCaller = 4)
    {
        using oRayWorldIntersection = int(__fastcall*)(PVOID, const Vec3&, const Vec3&, int, unsigned int, CRayHit*, int, CPhysicalEntity**, int, void*, int, const char*, CRayHitCached*, int);
        return CallFunction<oRayWorldIntersection>(this, 0x308)(this, org, dir, objtypes, flags, hits, nMaxHits, pSkipEnts, nSkipEnts, pForeignData, iForeignData, pNameTag, phitLast, iCaller);
    }
    bool isVisible(Vec3 shootPos, Vec3 pos)
    {
        CRayHit tmpHit;
        return !this->RayWorldIntersection(shootPos, pos - shootPos, 0x100 | 1, 0xA | 0x400, &tmpHit, 1);
    }
    bool IsVisibleBone(Vec3 BoneID, float Correct)
    {
        CRayHit tmpHit;
        Vec3 CamPos = SSystemGlobalEnvironment::Singleton()->GetIRenderer()->GetViewCamera();
        Vec3 vOut(this->GetMPos(BoneID, CamPos, Correct));
        return !this->RayWorldIntersection(CamPos, vOut, 0x100 | 1, 0xA | 0x400, &tmpHit, (1));
    }
    Vec3 GetMPos(Vec3 BoneID, Vec3 CamPos, FLOAT Correct)
    {
        Vec3 vOut = BoneID - CamPos;
        FLOAT sqr = (FLOAT)sqrt(vOut.x * vOut.x + vOut.y * vOut.y + vOut.z * vOut.z);
        vOut /= sqr;
        vOut *= sqr - Correct;
        return vOut;
    }

    bool isVisible(Vec3 CamPos, Vec3 BoneID, FLOAT Correct)
    {
        CRayHit tmpHit;
        Vec3 vOut(GetMPos(BoneID, CamPos, Correct));
        return !this->RayWorldIntersection(CamPos, vOut, 0x100 | 1, 0xA | 0x400, &tmpHit, 1);
    }

};
 
Обратите внимание, пользователь заблокирован на форуме. Не рекомендуется проводить сделки.
Обратите внимание, пользователь заблокирован на форуме. Не рекомендуется проводить сделки.
1631263238227.png

Сейчас бы постоянно сюда сливать классы, когда обновление от 30.08.21
Да и индексы редко меняются, можно просто сливать ту часть которая обновилась, а не всё подряд.
 
Обратите внимание, пользователь заблокирован на форуме. Не рекомендуется проводить сделки.
Посмотреть вложение 171106
Сейчас бы постоянно сюда сливать классы, когда обновление от 30.08.21
Да и индексы редко меняются, можно просто сливать ту часть которая обновилась, а не всё подряд.
При чем тут это?
Если речь идет про обновление.
 
Вот почему я не хочу продолжать изучать c++
это обычный каст адреса чтобы вызвать его как (в данном случае fastcall) функцию
у тебя, кстати, в сигнатуре почти тоже самое происходит, кек
 
Обратите внимание, пользователь заблокирован на форуме. Не рекомендуется проводить сделки.
Назад
Сверху Снизу