From 1fb70a535645b34be47ed5aed4c8bc4ad7fc4891 Mon Sep 17 00:00:00 2001 From: maecry Date: Mon, 8 Jan 2024 18:23:29 +0800 Subject: [PATCH] entity's vdata you can be creative and do something like this: https://too.lewd.se/2de3969de055_cs2_I439vW2rKx.png --- cstrike/cstrike.vcxproj | 1 + cstrike/cstrike.vcxproj.filters | 3 + cstrike/sdk/entity.h | 114 ++++++++++++++++++++++++++++++++ cstrike/sdk/vdata.h | 45 +++++++++++++ 4 files changed, 163 insertions(+) create mode 100644 cstrike/sdk/vdata.h diff --git a/cstrike/cstrike.vcxproj b/cstrike/cstrike.vcxproj index 52c767c..270a483 100644 --- a/cstrike/cstrike.vcxproj +++ b/cstrike/cstrike.vcxproj @@ -195,6 +195,7 @@ + diff --git a/cstrike/cstrike.vcxproj.filters b/cstrike/cstrike.vcxproj.filters index bc09204..a61ef37 100644 --- a/cstrike/cstrike.vcxproj.filters +++ b/cstrike/cstrike.vcxproj.filters @@ -270,6 +270,9 @@ sdk\interfaces + + sdk + utilities diff --git a/cstrike/sdk/entity.h b/cstrike/sdk/entity.h index 2943ee6..2d63a96 100644 --- a/cstrike/sdk/entity.h +++ b/cstrike/sdk/entity.h @@ -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; @@ -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; @@ -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(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: diff --git a/cstrike/sdk/vdata.h b/cstrike/sdk/vdata.h new file mode 100644 index 0000000..944b38d --- /dev/null +++ b/cstrike/sdk/vdata.h @@ -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"); +};