Skip to content

Commit

Permalink
entity's vdata
Browse files Browse the repository at this point in the history
you can be creative and do something like this: https://too.lewd.se/2de3969de055_cs2_I439vW2rKx.png
  • Loading branch information
maecry committed Jan 8, 2024
1 parent 3b0ccef commit 1fb70a5
Show file tree
Hide file tree
Showing 4 changed files with 163 additions and 0 deletions.
1 change: 1 addition & 0 deletions cstrike/cstrike.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,7 @@
<ClInclude Include="sdk\interfaces\ischemasystem.h" />
<ClInclude Include="sdk\interfaces\iswapchaindx11.h" />
<ClInclude Include="sdk\interfaces\iviewrender.h" />
<ClInclude Include="sdk\vdata.h" />
<ClInclude Include="utilities\crt.h" />
<ClInclude Include="utilities\detourhook.h" />
<ClInclude Include="utilities\draw.h" />
Expand Down
3 changes: 3 additions & 0 deletions cstrike/cstrike.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,9 @@
<ClInclude Include="sdk\interfaces\iviewrender.h">
<Filter>sdk\interfaces</Filter>
</ClInclude>
<ClInclude Include="sdk\vdata.h">
<Filter>sdk</Filter>
</ClInclude>
<ClInclude Include="utilities\crt.h">
<Filter>utilities</Filter>
</ClInclude>
Expand Down
114 changes: 114 additions & 0 deletions cstrike/sdk/entity.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@
#include "entity_handle.h"
// used: game's definitions
#include "const.h"
// used: entity vdata
#include "vdata.h"

using GameTime_t = std::int32_t;
using GameTick_t = std::int32_t;
Expand Down Expand Up @@ -155,6 +157,7 @@ class C_BaseEntity : public CEntityInstance
SCHEMA_ADD_FIELD(std::int32_t, GetHealth, "C_BaseEntity->m_iHealth");
SCHEMA_ADD_FIELD(std::int32_t, GetMaxHealth, "C_BaseEntity->m_iMaxHealth");
SCHEMA_ADD_FIELD(float, GetWaterLevel, "C_BaseEntity->m_flWaterLevel");
SCHEMA_ADD_FIELD_OFFSET(void*, GetVData, "C_BaseEntity::m_nSubclassID", 0x8);
};

class CGlowProperty;
Expand Down Expand Up @@ -248,6 +251,117 @@ class CCSPlayerController : public CBasePlayerController
SCHEMA_ADD_FIELD(CBaseHandle, GetPlayerPawnHandle, "CCSPlayerController->m_hPlayerPawn");
};

class CBaseAnimGraph : public C_BaseModelEntity
{
public:
CS_CLASS_NO_INITIALIZER(CBaseAnimGraph);

SCHEMA_ADD_FIELD(bool, IsClientRagdoll, "CBaseAnimGraph->m_bClientRagdoll");
};

class C_BaseFlex : public CBaseAnimGraph
{
public:
CS_CLASS_NO_INITIALIZER(C_BaseFlex);
/* not implemented */
};

class C_EconItemView
{
public:
CS_CLASS_NO_INITIALIZER(C_EconItemView);

SCHEMA_ADD_FIELD(std::uint16_t, GetItemDefinitionIndex, "C_EconItemView->m_iItemDefinitionIndex");
SCHEMA_ADD_FIELD(std::uint64_t, GetItemID, "C_EconItemView->m_iItemID");
SCHEMA_ADD_FIELD(std::uint32_t, GetItemIDHigh, "C_EconItemView->m_iItemIDHigh");
SCHEMA_ADD_FIELD(std::uint32_t, GetItemIDLow, "C_EconItemView->m_iItemIDLow");
SCHEMA_ADD_FIELD(std::uint32_t, GetAccountID, "C_EconItemView->m_iAccountID");
SCHEMA_ADD_FIELD(char[161], GetCustomName, "C_EconItemView->m_szCustomName");
SCHEMA_ADD_FIELD(char[161], GetCustomNameOverride, "C_EconItemView->m_szCustomNameOverride");
};

class CAttributeManager
{
public:
CS_CLASS_NO_INITIALIZER(CAttributeManager);
virtual ~CAttributeManager() = 0;
};
static_assert(sizeof(CAttributeManager) == 0x8);

class C_AttributeContainer : public CAttributeManager
{
public:
CS_CLASS_NO_INITIALIZER(C_AttributeContainer);

SCHEMA_ADD_FIELD(C_EconItemView, GetItem, "C_AttributeContainer::m_Item");
};

class C_EconEntity : public C_BaseFlex
{
public:
CS_CLASS_NO_INITIALIZER(C_EconEntity);

SCHEMA_ADD_FIELD(C_AttributeContainer, GetAttributeManager, "C_EconEntity->m_AttributeManager");
SCHEMA_ADD_FIELD(std::uint32_t, GetOriginalOwnerXuidLow, "C_EconEntity->m_OriginalOwnerXuidLow");
SCHEMA_ADD_FIELD(std::uint32_t, GetOriginalOwnerXuidHigh, "C_EconEntity->m_OriginalOwnerXuidHigh");
SCHEMA_ADD_FIELD(std::int32_t, GetFallbackPaintKit, "C_EconEntity->m_nFallbackPaintKit");
SCHEMA_ADD_FIELD(std::int32_t, GetFallbackSeed, "C_EconEntity->m_nFallbackSeed");
SCHEMA_ADD_FIELD(std::int32_t, GetFallbackWear, "C_EconEntity->m_flFallbackWear");
SCHEMA_ADD_FIELD(std::int32_t, GetFallbackStatTrak, "C_EconEntity->m_nFallbackStatTrak");
SCHEMA_ADD_FIELD(CBaseHandle, GetViewModelAttachmentHandle, "C_EconEntity->m_hViewmodelAttachment");
};

class C_EconWearable : public C_EconEntity
{
public:
CS_CLASS_NO_INITIALIZER(C_EconWearable);

SCHEMA_ADD_FIELD(std::int32_t, GetForceSkin, "C_EconWearable->m_nForceSkin");
SCHEMA_ADD_FIELD(bool, IsAlwaysAllow, "C_EconWearable->m_bAlwaysAllow");
};

class C_BasePlayerWeapon : public C_EconEntity
{
public:
CS_CLASS_NO_INITIALIZER(C_BasePlayerWeapon);

SCHEMA_ADD_FIELD(GameTick_t, GetNextPrimaryAttackTick, "C_BasePlayerWeapon->m_nNextPrimaryAttackTick");
SCHEMA_ADD_FIELD(float, GetNextPrimaryAttackTickRatio, "C_BasePlayerWeapon->m_flNextPrimaryAttackTickRatio");
SCHEMA_ADD_FIELD(GameTick_t, GetNextSecondaryAttackTick, "C_BasePlayerWeapon->m_nNextSecondaryAttackTick");
SCHEMA_ADD_FIELD(float, GetNextSecondaryAttackTickRatio, "C_BasePlayerWeapon->m_flNextSecondaryAttackTickRatio");
SCHEMA_ADD_FIELD(std::int32_t, GetClip1, "C_BasePlayerWeapon->m_iClip1");
SCHEMA_ADD_FIELD(std::int32_t, GetClip2, "C_BasePlayerWeapon->m_iClip2");
SCHEMA_ADD_FIELD(std::int32_t[2], GetReserveAmmo, "C_BasePlayerWeapon->m_pReserveAmmo");
};

class C_CSWeaponBase : public C_BasePlayerWeapon
{
public:
CS_CLASS_NO_INITIALIZER(C_CSWeaponBase);

SCHEMA_ADD_FIELD(bool, IsInReload, "C_CSWeaponBase->m_bInReload");

CCSWeaponBaseVData* GetWeaponVData()
{
return static_cast<CCSWeaponBaseVData*>(GetVData());
}
};

class C_CSWeaponBaseGun : public C_CSWeaponBase
{
public:
CS_CLASS_NO_INITIALIZER(C_CSWeaponBaseGun);

SCHEMA_ADD_FIELD(std::int32_t, GetZoomLevel, "C_CSWeaponBaseGun->m_zoomLevel");
SCHEMA_ADD_FIELD(std::int32_t, GetBurstShotsRemaining, "C_CSWeaponBaseGun->m_iBurstShotsRemaining");
};

class C_BaseGrenade : public C_BaseFlex
{
public:
CS_CLASS_NO_INITIALIZER(C_BaseGrenade);
};

class CSkeletonInstance : public CGameSceneNode
{
public:
Expand Down
45 changes: 45 additions & 0 deletions cstrike/sdk/vdata.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
#pragma once

// used: schema field
#include "../core/schema.h"
// used: rop
#include "../utilities/memory.h"

class CBasePlayerVData
{
public:
CS_CLASS_NO_INITIALIZER(CBasePlayerVData);

//CResourceNameTyped< CWeakHandle< InfoForResourceTypeCModel > > m_sModelName = 0x28
//CSkillFloat m_flHeadDamageMultiplier = 0x108
//CSkillFloat m_flChestDamageMultiplier = 0x118
//CSkillFloat m_flStomachDamageMultiplier = 0x128
//CSkillFloat m_flArmDamageMultiplier = 0x138
//CSkillFloat m_flLegDamageMultiplier = 0x148
//float32 m_flHoldBreathTime = 0x158
//float32 m_flDrowningDamageInterval = 0x15C
//int32 m_nDrowningDamageInitial = 0x160
//int32 m_nDrowningDamageMax = 0x164
//int32 m_nWaterSpeed = 0x168
//float32 m_flUseRange = 0x16C
//float32 m_flUseAngleTolerance = 0x170
//float32 m_flCrouchTime = 0x174
};

class CBasePlayerWeaponVData
{
public:
CS_CLASS_NO_INITIALIZER(CBasePlayerWeaponVData);

SCHEMA_ADD_FIELD(bool, IsFullAuto, "CBasePlayerWeaponVData->m_bIsFullAuto");
SCHEMA_ADD_FIELD(std::int32_t, GetMaxClip1, "CBasePlayerWeaponVData->m_iMaxClip1");
};

class CCSWeaponBaseVData : public CBasePlayerWeaponVData
{
public:
CS_CLASS_NO_INITIALIZER(CCSWeaponBaseVData);

SCHEMA_ADD_FIELD(std::int32_t, GetWeaponType, "CCSWeaponBaseVData->m_WeaponType");
SCHEMA_ADD_FIELD(float, GetRange, "CCSWeaponBaseVData->m_flRange");
};

0 comments on commit 1fb70a5

Please sign in to comment.