From f262471a639749ee4acd3b3100ce592c9b1c32ff Mon Sep 17 00:00:00 2001 From: schwarper <75811921+schwarper@users.noreply.github.com> Date: Sun, 10 Nov 2024 01:51:40 +0300 Subject: [PATCH 1/6] Added hitgroup to CTakeDamageInfo --- .../Core/Schema/Classes/CTakeDamageInfo.g.cs | 30 +++++++++++++++++-- 1 file changed, 28 insertions(+), 2 deletions(-) diff --git a/managed/CounterStrikeSharp.API/Core/Schema/Classes/CTakeDamageInfo.g.cs b/managed/CounterStrikeSharp.API/Core/Schema/Classes/CTakeDamageInfo.g.cs index 67ac64bd7..7e76639a1 100644 --- a/managed/CounterStrikeSharp.API/Core/Schema/Classes/CTakeDamageInfo.g.cs +++ b/managed/CounterStrikeSharp.API/Core/Schema/Classes/CTakeDamageInfo.g.cs @@ -11,6 +11,7 @@ using CounterStrikeSharp.API.Modules.Memory; using CounterStrikeSharp.API.Modules.Utils; using CounterStrikeSharp.API.Core.Attributes; +using CounterStrikeSharp.API.Modules.Memory.DynamicFunctions; namespace CounterStrikeSharp.API.Core; @@ -100,6 +101,31 @@ public CTakeDamageInfo (IntPtr pointer) : base(pointer) {} // m_bInTakeDamageFlow [SchemaMember("CTakeDamageInfo", "m_bInTakeDamageFlow")] - public ref bool InTakeDamageFlow => ref Schema.GetRef(this.Handle, "CTakeDamageInfo", "m_bInTakeDamageFlow"); - + public ref bool InTakeDamageFlow => ref Schema.GetRef(this.Handle, "CTakeDamageInfo", "m_bInTakeDamageFlow"); + + /// + /// Retrieves the hitgroup + /// + /// + /// Returns a enumeration representing the player's current hit group, + /// or if the hit group cannot be determined. + /// + public unsafe HitGroup_t HitGroup() + { + nint v4 = *(nint*)(this.Handle + 0x78); + + if (v4 == nint.Zero) + { + return HitGroup_t.HITGROUP_INVALID; + } + + nint v1 = *(nint*)(v4 + 16); + + if (v1 == nint.Zero) + { + return HitGroup_t.HITGROUP_GENERIC; + } + + return (HitGroup_t)(*(uint*)(v1 + 56)); + } } From d02384d7913e408b3a03dbb70fb89293046e4198 Mon Sep 17 00:00:00 2001 From: schwarper <75811921+schwarper@users.noreply.github.com> Date: Sun, 10 Nov 2024 12:14:49 +0300 Subject: [PATCH 2/6] Created a new partial class for CTakeDamageInfo --- .../Core/Model/CTakeDamageInfo.cs | 30 +++++++++++++++++++ .../Core/Schema/Classes/CTakeDamageInfo.g.cs | 30 ++----------------- 2 files changed, 32 insertions(+), 28 deletions(-) create mode 100644 managed/CounterStrikeSharp.API/Core/Model/CTakeDamageInfo.cs diff --git a/managed/CounterStrikeSharp.API/Core/Model/CTakeDamageInfo.cs b/managed/CounterStrikeSharp.API/Core/Model/CTakeDamageInfo.cs new file mode 100644 index 000000000..3213f2b79 --- /dev/null +++ b/managed/CounterStrikeSharp.API/Core/Model/CTakeDamageInfo.cs @@ -0,0 +1,30 @@ +namespace CounterStrikeSharp.API.Core; + +public partial class CTakeDamageInfo +{ + /// + /// Retrieves the hitgroup + /// + /// + /// Returns a enumeration representing the player's current hit group, + /// or if the hit group cannot be determined. + /// + public unsafe HitGroup_t HitGroup() + { + nint v4 = *(nint*)(this.Handle + 0x78); + + if (v4 == nint.Zero) + { + return HitGroup_t.HITGROUP_INVALID; + } + + nint v1 = *(nint*)(v4 + 16); + + if (v1 == nint.Zero) + { + return HitGroup_t.HITGROUP_GENERIC; + } + + return (HitGroup_t)(*(uint*)(v1 + 56)); + } +} diff --git a/managed/CounterStrikeSharp.API/Core/Schema/Classes/CTakeDamageInfo.g.cs b/managed/CounterStrikeSharp.API/Core/Schema/Classes/CTakeDamageInfo.g.cs index 7e76639a1..0115f2892 100644 --- a/managed/CounterStrikeSharp.API/Core/Schema/Classes/CTakeDamageInfo.g.cs +++ b/managed/CounterStrikeSharp.API/Core/Schema/Classes/CTakeDamageInfo.g.cs @@ -101,31 +101,5 @@ public CTakeDamageInfo (IntPtr pointer) : base(pointer) {} // m_bInTakeDamageFlow [SchemaMember("CTakeDamageInfo", "m_bInTakeDamageFlow")] - public ref bool InTakeDamageFlow => ref Schema.GetRef(this.Handle, "CTakeDamageInfo", "m_bInTakeDamageFlow"); - - /// - /// Retrieves the hitgroup - /// - /// - /// Returns a enumeration representing the player's current hit group, - /// or if the hit group cannot be determined. - /// - public unsafe HitGroup_t HitGroup() - { - nint v4 = *(nint*)(this.Handle + 0x78); - - if (v4 == nint.Zero) - { - return HitGroup_t.HITGROUP_INVALID; - } - - nint v1 = *(nint*)(v4 + 16); - - if (v1 == nint.Zero) - { - return HitGroup_t.HITGROUP_GENERIC; - } - - return (HitGroup_t)(*(uint*)(v1 + 56)); - } -} + public ref bool InTakeDamageFlow => ref Schema.GetRef(this.Handle, "CTakeDamageInfo", "m_bInTakeDamageFlow"); +} From 7f27df5200e7f2892286a71940798a1fb6b4868d Mon Sep 17 00:00:00 2001 From: schwarper <75811921+schwarper@users.noreply.github.com> Date: Sun, 10 Nov 2024 12:15:58 +0300 Subject: [PATCH 3/6] Removed unnecessary code --- .../Core/Schema/Classes/CTakeDamageInfo.g.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/managed/CounterStrikeSharp.API/Core/Schema/Classes/CTakeDamageInfo.g.cs b/managed/CounterStrikeSharp.API/Core/Schema/Classes/CTakeDamageInfo.g.cs index 0115f2892..288ec5ea9 100644 --- a/managed/CounterStrikeSharp.API/Core/Schema/Classes/CTakeDamageInfo.g.cs +++ b/managed/CounterStrikeSharp.API/Core/Schema/Classes/CTakeDamageInfo.g.cs @@ -11,7 +11,6 @@ using CounterStrikeSharp.API.Modules.Memory; using CounterStrikeSharp.API.Modules.Utils; using CounterStrikeSharp.API.Core.Attributes; -using CounterStrikeSharp.API.Modules.Memory.DynamicFunctions; namespace CounterStrikeSharp.API.Core; From 78be4e58e1dd829217e5aea3de8c4c1b610f801e Mon Sep 17 00:00:00 2001 From: schwarper <75811921+schwarper@users.noreply.github.com> Date: Wed, 13 Nov 2024 22:20:45 +0300 Subject: [PATCH 4/6] Converted nint to safe codes --- .../Core/Model/CTakeDamageInfo.cs | 12 +- .../Core/Schema/Classes/CTakeDamageInfo.g.cs | 173 +++++++++--------- 2 files changed, 94 insertions(+), 91 deletions(-) diff --git a/managed/CounterStrikeSharp.API/Core/Model/CTakeDamageInfo.cs b/managed/CounterStrikeSharp.API/Core/Model/CTakeDamageInfo.cs index 3213f2b79..00e62f289 100644 --- a/managed/CounterStrikeSharp.API/Core/Model/CTakeDamageInfo.cs +++ b/managed/CounterStrikeSharp.API/Core/Model/CTakeDamageInfo.cs @@ -1,4 +1,6 @@ -namespace CounterStrikeSharp.API.Core; +using System.Runtime.InteropServices; + +namespace CounterStrikeSharp.API.Core; public partial class CTakeDamageInfo { @@ -9,22 +11,22 @@ public partial class CTakeDamageInfo /// Returns a enumeration representing the player's current hit group, /// or if the hit group cannot be determined. /// - public unsafe HitGroup_t HitGroup() + public HitGroup_t HitGroup() { - nint v4 = *(nint*)(this.Handle + 0x78); + IntPtr v4 = Marshal.ReadIntPtr(Handle, 0x78); if (v4 == nint.Zero) { return HitGroup_t.HITGROUP_INVALID; } - nint v1 = *(nint*)(v4 + 16); + IntPtr v1 = Marshal.ReadIntPtr(v4, 16); if (v1 == nint.Zero) { return HitGroup_t.HITGROUP_GENERIC; } - return (HitGroup_t)(*(uint*)(v1 + 56)); + return (HitGroup_t)Marshal.ReadInt32(v1, 56); } } diff --git a/managed/CounterStrikeSharp.API/Core/Schema/Classes/CTakeDamageInfo.g.cs b/managed/CounterStrikeSharp.API/Core/Schema/Classes/CTakeDamageInfo.g.cs index 288ec5ea9..48d3739b3 100644 --- a/managed/CounterStrikeSharp.API/Core/Schema/Classes/CTakeDamageInfo.g.cs +++ b/managed/CounterStrikeSharp.API/Core/Schema/Classes/CTakeDamageInfo.g.cs @@ -16,89 +16,90 @@ namespace CounterStrikeSharp.API.Core; public partial class CTakeDamageInfo : NativeObject { - public CTakeDamageInfo (IntPtr pointer) : base(pointer) {} - - // m_vecDamageForce - [SchemaMember("CTakeDamageInfo", "m_vecDamageForce")] - public Vector DamageForce => Schema.GetDeclaredClass(this.Handle, "CTakeDamageInfo", "m_vecDamageForce"); - - // m_vecDamagePosition - [SchemaMember("CTakeDamageInfo", "m_vecDamagePosition")] - public Vector DamagePosition => Schema.GetDeclaredClass(this.Handle, "CTakeDamageInfo", "m_vecDamagePosition"); - - // m_vecReportedPosition - [SchemaMember("CTakeDamageInfo", "m_vecReportedPosition")] - public Vector ReportedPosition => Schema.GetDeclaredClass(this.Handle, "CTakeDamageInfo", "m_vecReportedPosition"); - - // m_vecDamageDirection - [SchemaMember("CTakeDamageInfo", "m_vecDamageDirection")] - public Vector DamageDirection => Schema.GetDeclaredClass(this.Handle, "CTakeDamageInfo", "m_vecDamageDirection"); - - // m_hInflictor - [SchemaMember("CTakeDamageInfo", "m_hInflictor")] - public CHandle Inflictor => Schema.GetDeclaredClass>(this.Handle, "CTakeDamageInfo", "m_hInflictor"); - - // m_hAttacker - [SchemaMember("CTakeDamageInfo", "m_hAttacker")] - public CHandle Attacker => Schema.GetDeclaredClass>(this.Handle, "CTakeDamageInfo", "m_hAttacker"); - - // m_hAbility - [SchemaMember("CTakeDamageInfo", "m_hAbility")] - public CHandle Ability => Schema.GetDeclaredClass>(this.Handle, "CTakeDamageInfo", "m_hAbility"); - - // m_flDamage - [SchemaMember("CTakeDamageInfo", "m_flDamage")] - public ref float Damage => ref Schema.GetRef(this.Handle, "CTakeDamageInfo", "m_flDamage"); - - // m_flTotalledDamage - [SchemaMember("CTakeDamageInfo", "m_flTotalledDamage")] - public ref float TotalledDamage => ref Schema.GetRef(this.Handle, "CTakeDamageInfo", "m_flTotalledDamage"); - - // m_flTotalledDamageAbsorbed - [SchemaMember("CTakeDamageInfo", "m_flTotalledDamageAbsorbed")] - public ref float TotalledDamageAbsorbed => ref Schema.GetRef(this.Handle, "CTakeDamageInfo", "m_flTotalledDamageAbsorbed"); - - // m_bitsDamageType - [SchemaMember("CTakeDamageInfo", "m_bitsDamageType")] - public ref DamageTypes_t BitsDamageType => ref Schema.GetRef(this.Handle, "CTakeDamageInfo", "m_bitsDamageType"); - - // m_iDamageCustom - [SchemaMember("CTakeDamageInfo", "m_iDamageCustom")] - public ref Int32 DamageCustom => ref Schema.GetRef(this.Handle, "CTakeDamageInfo", "m_iDamageCustom"); - - // m_iAmmoType - [SchemaMember("CTakeDamageInfo", "m_iAmmoType")] - public ref byte AmmoType => ref Schema.GetRef(this.Handle, "CTakeDamageInfo", "m_iAmmoType"); - - // m_flOriginalDamage - [SchemaMember("CTakeDamageInfo", "m_flOriginalDamage")] - public ref float OriginalDamage => ref Schema.GetRef(this.Handle, "CTakeDamageInfo", "m_flOriginalDamage"); - - // m_bShouldBleed - [SchemaMember("CTakeDamageInfo", "m_bShouldBleed")] - public ref bool ShouldBleed => ref Schema.GetRef(this.Handle, "CTakeDamageInfo", "m_bShouldBleed"); - - // m_bShouldSpark - [SchemaMember("CTakeDamageInfo", "m_bShouldSpark")] - public ref bool ShouldSpark => ref Schema.GetRef(this.Handle, "CTakeDamageInfo", "m_bShouldSpark"); - - // m_flDamageAbsorbed - [SchemaMember("CTakeDamageInfo", "m_flDamageAbsorbed")] - public ref float DamageAbsorbed => ref Schema.GetRef(this.Handle, "CTakeDamageInfo", "m_flDamageAbsorbed"); - - // m_nDamageFlags - [SchemaMember("CTakeDamageInfo", "m_nDamageFlags")] - public ref TakeDamageFlags_t DamageFlags => ref Schema.GetRef(this.Handle, "CTakeDamageInfo", "m_nDamageFlags"); - - // m_nNumObjectsPenetrated - [SchemaMember("CTakeDamageInfo", "m_nNumObjectsPenetrated")] - public ref Int32 NumObjectsPenetrated => ref Schema.GetRef(this.Handle, "CTakeDamageInfo", "m_nNumObjectsPenetrated"); - - // m_flFriendlyFireDamageReductionRatio - [SchemaMember("CTakeDamageInfo", "m_flFriendlyFireDamageReductionRatio")] - public ref float FriendlyFireDamageReductionRatio => ref Schema.GetRef(this.Handle, "CTakeDamageInfo", "m_flFriendlyFireDamageReductionRatio"); - - // m_bInTakeDamageFlow - [SchemaMember("CTakeDamageInfo", "m_bInTakeDamageFlow")] - public ref bool InTakeDamageFlow => ref Schema.GetRef(this.Handle, "CTakeDamageInfo", "m_bInTakeDamageFlow"); -} + public CTakeDamageInfo(IntPtr pointer) : base(pointer) { } + + // m_vecDamageForce + [SchemaMember("CTakeDamageInfo", "m_vecDamageForce")] + public Vector DamageForce => Schema.GetDeclaredClass(this.Handle, "CTakeDamageInfo", "m_vecDamageForce"); + + // m_vecDamagePosition + [SchemaMember("CTakeDamageInfo", "m_vecDamagePosition")] + public Vector DamagePosition => Schema.GetDeclaredClass(this.Handle, "CTakeDamageInfo", "m_vecDamagePosition"); + + // m_vecReportedPosition + [SchemaMember("CTakeDamageInfo", "m_vecReportedPosition")] + public Vector ReportedPosition => Schema.GetDeclaredClass(this.Handle, "CTakeDamageInfo", "m_vecReportedPosition"); + + // m_vecDamageDirection + [SchemaMember("CTakeDamageInfo", "m_vecDamageDirection")] + public Vector DamageDirection => Schema.GetDeclaredClass(this.Handle, "CTakeDamageInfo", "m_vecDamageDirection"); + + // m_hInflictor + [SchemaMember("CTakeDamageInfo", "m_hInflictor")] + public CHandle Inflictor => Schema.GetDeclaredClass>(this.Handle, "CTakeDamageInfo", "m_hInflictor"); + + // m_hAttacker + [SchemaMember("CTakeDamageInfo", "m_hAttacker")] + public CHandle Attacker => Schema.GetDeclaredClass>(this.Handle, "CTakeDamageInfo", "m_hAttacker"); + + // m_hAbility + [SchemaMember("CTakeDamageInfo", "m_hAbility")] + public CHandle Ability => Schema.GetDeclaredClass>(this.Handle, "CTakeDamageInfo", "m_hAbility"); + + // m_flDamage + [SchemaMember("CTakeDamageInfo", "m_flDamage")] + public ref float Damage => ref Schema.GetRef(this.Handle, "CTakeDamageInfo", "m_flDamage"); + + // m_flTotalledDamage + [SchemaMember("CTakeDamageInfo", "m_flTotalledDamage")] + public ref float TotalledDamage => ref Schema.GetRef(this.Handle, "CTakeDamageInfo", "m_flTotalledDamage"); + + // m_flTotalledDamageAbsorbed + [SchemaMember("CTakeDamageInfo", "m_flTotalledDamageAbsorbed")] + public ref float TotalledDamageAbsorbed => ref Schema.GetRef(this.Handle, "CTakeDamageInfo", "m_flTotalledDamageAbsorbed"); + + // m_bitsDamageType + [SchemaMember("CTakeDamageInfo", "m_bitsDamageType")] + public ref DamageTypes_t BitsDamageType => ref Schema.GetRef(this.Handle, "CTakeDamageInfo", "m_bitsDamageType"); + + // m_iDamageCustom + [SchemaMember("CTakeDamageInfo", "m_iDamageCustom")] + public ref Int32 DamageCustom => ref Schema.GetRef(this.Handle, "CTakeDamageInfo", "m_iDamageCustom"); + + // m_iAmmoType + [SchemaMember("CTakeDamageInfo", "m_iAmmoType")] + public ref byte AmmoType => ref Schema.GetRef(this.Handle, "CTakeDamageInfo", "m_iAmmoType"); + + // m_flOriginalDamage + [SchemaMember("CTakeDamageInfo", "m_flOriginalDamage")] + public ref float OriginalDamage => ref Schema.GetRef(this.Handle, "CTakeDamageInfo", "m_flOriginalDamage"); + + // m_bShouldBleed + [SchemaMember("CTakeDamageInfo", "m_bShouldBleed")] + public ref bool ShouldBleed => ref Schema.GetRef(this.Handle, "CTakeDamageInfo", "m_bShouldBleed"); + + // m_bShouldSpark + [SchemaMember("CTakeDamageInfo", "m_bShouldSpark")] + public ref bool ShouldSpark => ref Schema.GetRef(this.Handle, "CTakeDamageInfo", "m_bShouldSpark"); + + // m_flDamageAbsorbed + [SchemaMember("CTakeDamageInfo", "m_flDamageAbsorbed")] + public ref float DamageAbsorbed => ref Schema.GetRef(this.Handle, "CTakeDamageInfo", "m_flDamageAbsorbed"); + + // m_nDamageFlags + [SchemaMember("CTakeDamageInfo", "m_nDamageFlags")] + public ref TakeDamageFlags_t DamageFlags => ref Schema.GetRef(this.Handle, "CTakeDamageInfo", "m_nDamageFlags"); + + // m_nNumObjectsPenetrated + [SchemaMember("CTakeDamageInfo", "m_nNumObjectsPenetrated")] + public ref Int32 NumObjectsPenetrated => ref Schema.GetRef(this.Handle, "CTakeDamageInfo", "m_nNumObjectsPenetrated"); + + // m_flFriendlyFireDamageReductionRatio + [SchemaMember("CTakeDamageInfo", "m_flFriendlyFireDamageReductionRatio")] + public ref float FriendlyFireDamageReductionRatio => ref Schema.GetRef(this.Handle, "CTakeDamageInfo", "m_flFriendlyFireDamageReductionRatio"); + + // m_bInTakeDamageFlow + [SchemaMember("CTakeDamageInfo", "m_bInTakeDamageFlow")] + public ref bool InTakeDamageFlow => ref Schema.GetRef(this.Handle, "CTakeDamageInfo", "m_bInTakeDamageFlow"); + +} From 8319da5651013c7e09daf70e96a256240106d027 Mon Sep 17 00:00:00 2001 From: schwarper <75811921+schwarper@users.noreply.github.com> Date: Wed, 13 Nov 2024 22:22:13 +0300 Subject: [PATCH 5/6] Update CTakeDamageInfo.g.cs --- .../Core/Schema/Classes/CTakeDamageInfo.g.cs | 170 +++++++++--------- 1 file changed, 85 insertions(+), 85 deletions(-) diff --git a/managed/CounterStrikeSharp.API/Core/Schema/Classes/CTakeDamageInfo.g.cs b/managed/CounterStrikeSharp.API/Core/Schema/Classes/CTakeDamageInfo.g.cs index 48d3739b3..67ac64bd7 100644 --- a/managed/CounterStrikeSharp.API/Core/Schema/Classes/CTakeDamageInfo.g.cs +++ b/managed/CounterStrikeSharp.API/Core/Schema/Classes/CTakeDamageInfo.g.cs @@ -16,90 +16,90 @@ namespace CounterStrikeSharp.API.Core; public partial class CTakeDamageInfo : NativeObject { - public CTakeDamageInfo(IntPtr pointer) : base(pointer) { } - - // m_vecDamageForce - [SchemaMember("CTakeDamageInfo", "m_vecDamageForce")] - public Vector DamageForce => Schema.GetDeclaredClass(this.Handle, "CTakeDamageInfo", "m_vecDamageForce"); - - // m_vecDamagePosition - [SchemaMember("CTakeDamageInfo", "m_vecDamagePosition")] - public Vector DamagePosition => Schema.GetDeclaredClass(this.Handle, "CTakeDamageInfo", "m_vecDamagePosition"); - - // m_vecReportedPosition - [SchemaMember("CTakeDamageInfo", "m_vecReportedPosition")] - public Vector ReportedPosition => Schema.GetDeclaredClass(this.Handle, "CTakeDamageInfo", "m_vecReportedPosition"); - - // m_vecDamageDirection - [SchemaMember("CTakeDamageInfo", "m_vecDamageDirection")] - public Vector DamageDirection => Schema.GetDeclaredClass(this.Handle, "CTakeDamageInfo", "m_vecDamageDirection"); - - // m_hInflictor - [SchemaMember("CTakeDamageInfo", "m_hInflictor")] - public CHandle Inflictor => Schema.GetDeclaredClass>(this.Handle, "CTakeDamageInfo", "m_hInflictor"); - - // m_hAttacker - [SchemaMember("CTakeDamageInfo", "m_hAttacker")] - public CHandle Attacker => Schema.GetDeclaredClass>(this.Handle, "CTakeDamageInfo", "m_hAttacker"); - - // m_hAbility - [SchemaMember("CTakeDamageInfo", "m_hAbility")] - public CHandle Ability => Schema.GetDeclaredClass>(this.Handle, "CTakeDamageInfo", "m_hAbility"); - - // m_flDamage - [SchemaMember("CTakeDamageInfo", "m_flDamage")] - public ref float Damage => ref Schema.GetRef(this.Handle, "CTakeDamageInfo", "m_flDamage"); - - // m_flTotalledDamage - [SchemaMember("CTakeDamageInfo", "m_flTotalledDamage")] - public ref float TotalledDamage => ref Schema.GetRef(this.Handle, "CTakeDamageInfo", "m_flTotalledDamage"); - - // m_flTotalledDamageAbsorbed - [SchemaMember("CTakeDamageInfo", "m_flTotalledDamageAbsorbed")] - public ref float TotalledDamageAbsorbed => ref Schema.GetRef(this.Handle, "CTakeDamageInfo", "m_flTotalledDamageAbsorbed"); - - // m_bitsDamageType - [SchemaMember("CTakeDamageInfo", "m_bitsDamageType")] - public ref DamageTypes_t BitsDamageType => ref Schema.GetRef(this.Handle, "CTakeDamageInfo", "m_bitsDamageType"); - - // m_iDamageCustom - [SchemaMember("CTakeDamageInfo", "m_iDamageCustom")] - public ref Int32 DamageCustom => ref Schema.GetRef(this.Handle, "CTakeDamageInfo", "m_iDamageCustom"); - - // m_iAmmoType - [SchemaMember("CTakeDamageInfo", "m_iAmmoType")] - public ref byte AmmoType => ref Schema.GetRef(this.Handle, "CTakeDamageInfo", "m_iAmmoType"); - - // m_flOriginalDamage - [SchemaMember("CTakeDamageInfo", "m_flOriginalDamage")] - public ref float OriginalDamage => ref Schema.GetRef(this.Handle, "CTakeDamageInfo", "m_flOriginalDamage"); - - // m_bShouldBleed - [SchemaMember("CTakeDamageInfo", "m_bShouldBleed")] - public ref bool ShouldBleed => ref Schema.GetRef(this.Handle, "CTakeDamageInfo", "m_bShouldBleed"); - - // m_bShouldSpark - [SchemaMember("CTakeDamageInfo", "m_bShouldSpark")] - public ref bool ShouldSpark => ref Schema.GetRef(this.Handle, "CTakeDamageInfo", "m_bShouldSpark"); - - // m_flDamageAbsorbed - [SchemaMember("CTakeDamageInfo", "m_flDamageAbsorbed")] - public ref float DamageAbsorbed => ref Schema.GetRef(this.Handle, "CTakeDamageInfo", "m_flDamageAbsorbed"); - - // m_nDamageFlags - [SchemaMember("CTakeDamageInfo", "m_nDamageFlags")] - public ref TakeDamageFlags_t DamageFlags => ref Schema.GetRef(this.Handle, "CTakeDamageInfo", "m_nDamageFlags"); - - // m_nNumObjectsPenetrated - [SchemaMember("CTakeDamageInfo", "m_nNumObjectsPenetrated")] - public ref Int32 NumObjectsPenetrated => ref Schema.GetRef(this.Handle, "CTakeDamageInfo", "m_nNumObjectsPenetrated"); - - // m_flFriendlyFireDamageReductionRatio - [SchemaMember("CTakeDamageInfo", "m_flFriendlyFireDamageReductionRatio")] - public ref float FriendlyFireDamageReductionRatio => ref Schema.GetRef(this.Handle, "CTakeDamageInfo", "m_flFriendlyFireDamageReductionRatio"); - - // m_bInTakeDamageFlow - [SchemaMember("CTakeDamageInfo", "m_bInTakeDamageFlow")] - public ref bool InTakeDamageFlow => ref Schema.GetRef(this.Handle, "CTakeDamageInfo", "m_bInTakeDamageFlow"); + public CTakeDamageInfo (IntPtr pointer) : base(pointer) {} + + // m_vecDamageForce + [SchemaMember("CTakeDamageInfo", "m_vecDamageForce")] + public Vector DamageForce => Schema.GetDeclaredClass(this.Handle, "CTakeDamageInfo", "m_vecDamageForce"); + + // m_vecDamagePosition + [SchemaMember("CTakeDamageInfo", "m_vecDamagePosition")] + public Vector DamagePosition => Schema.GetDeclaredClass(this.Handle, "CTakeDamageInfo", "m_vecDamagePosition"); + + // m_vecReportedPosition + [SchemaMember("CTakeDamageInfo", "m_vecReportedPosition")] + public Vector ReportedPosition => Schema.GetDeclaredClass(this.Handle, "CTakeDamageInfo", "m_vecReportedPosition"); + + // m_vecDamageDirection + [SchemaMember("CTakeDamageInfo", "m_vecDamageDirection")] + public Vector DamageDirection => Schema.GetDeclaredClass(this.Handle, "CTakeDamageInfo", "m_vecDamageDirection"); + + // m_hInflictor + [SchemaMember("CTakeDamageInfo", "m_hInflictor")] + public CHandle Inflictor => Schema.GetDeclaredClass>(this.Handle, "CTakeDamageInfo", "m_hInflictor"); + + // m_hAttacker + [SchemaMember("CTakeDamageInfo", "m_hAttacker")] + public CHandle Attacker => Schema.GetDeclaredClass>(this.Handle, "CTakeDamageInfo", "m_hAttacker"); + + // m_hAbility + [SchemaMember("CTakeDamageInfo", "m_hAbility")] + public CHandle Ability => Schema.GetDeclaredClass>(this.Handle, "CTakeDamageInfo", "m_hAbility"); + + // m_flDamage + [SchemaMember("CTakeDamageInfo", "m_flDamage")] + public ref float Damage => ref Schema.GetRef(this.Handle, "CTakeDamageInfo", "m_flDamage"); + + // m_flTotalledDamage + [SchemaMember("CTakeDamageInfo", "m_flTotalledDamage")] + public ref float TotalledDamage => ref Schema.GetRef(this.Handle, "CTakeDamageInfo", "m_flTotalledDamage"); + + // m_flTotalledDamageAbsorbed + [SchemaMember("CTakeDamageInfo", "m_flTotalledDamageAbsorbed")] + public ref float TotalledDamageAbsorbed => ref Schema.GetRef(this.Handle, "CTakeDamageInfo", "m_flTotalledDamageAbsorbed"); + + // m_bitsDamageType + [SchemaMember("CTakeDamageInfo", "m_bitsDamageType")] + public ref DamageTypes_t BitsDamageType => ref Schema.GetRef(this.Handle, "CTakeDamageInfo", "m_bitsDamageType"); + + // m_iDamageCustom + [SchemaMember("CTakeDamageInfo", "m_iDamageCustom")] + public ref Int32 DamageCustom => ref Schema.GetRef(this.Handle, "CTakeDamageInfo", "m_iDamageCustom"); + + // m_iAmmoType + [SchemaMember("CTakeDamageInfo", "m_iAmmoType")] + public ref byte AmmoType => ref Schema.GetRef(this.Handle, "CTakeDamageInfo", "m_iAmmoType"); + + // m_flOriginalDamage + [SchemaMember("CTakeDamageInfo", "m_flOriginalDamage")] + public ref float OriginalDamage => ref Schema.GetRef(this.Handle, "CTakeDamageInfo", "m_flOriginalDamage"); + + // m_bShouldBleed + [SchemaMember("CTakeDamageInfo", "m_bShouldBleed")] + public ref bool ShouldBleed => ref Schema.GetRef(this.Handle, "CTakeDamageInfo", "m_bShouldBleed"); + + // m_bShouldSpark + [SchemaMember("CTakeDamageInfo", "m_bShouldSpark")] + public ref bool ShouldSpark => ref Schema.GetRef(this.Handle, "CTakeDamageInfo", "m_bShouldSpark"); + + // m_flDamageAbsorbed + [SchemaMember("CTakeDamageInfo", "m_flDamageAbsorbed")] + public ref float DamageAbsorbed => ref Schema.GetRef(this.Handle, "CTakeDamageInfo", "m_flDamageAbsorbed"); + + // m_nDamageFlags + [SchemaMember("CTakeDamageInfo", "m_nDamageFlags")] + public ref TakeDamageFlags_t DamageFlags => ref Schema.GetRef(this.Handle, "CTakeDamageInfo", "m_nDamageFlags"); + + // m_nNumObjectsPenetrated + [SchemaMember("CTakeDamageInfo", "m_nNumObjectsPenetrated")] + public ref Int32 NumObjectsPenetrated => ref Schema.GetRef(this.Handle, "CTakeDamageInfo", "m_nNumObjectsPenetrated"); + + // m_flFriendlyFireDamageReductionRatio + [SchemaMember("CTakeDamageInfo", "m_flFriendlyFireDamageReductionRatio")] + public ref float FriendlyFireDamageReductionRatio => ref Schema.GetRef(this.Handle, "CTakeDamageInfo", "m_flFriendlyFireDamageReductionRatio"); + + // m_bInTakeDamageFlow + [SchemaMember("CTakeDamageInfo", "m_bInTakeDamageFlow")] + public ref bool InTakeDamageFlow => ref Schema.GetRef(this.Handle, "CTakeDamageInfo", "m_bInTakeDamageFlow"); } From a956ffce08b8c07ccd64d895a13120f45d20231f Mon Sep 17 00:00:00 2001 From: schwarper <75811921+schwarper@users.noreply.github.com> Date: Fri, 15 Nov 2024 22:36:49 +0300 Subject: [PATCH 6/6] Update CTakeDamageInfo.cs --- managed/CounterStrikeSharp.API/Core/Model/CTakeDamageInfo.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/managed/CounterStrikeSharp.API/Core/Model/CTakeDamageInfo.cs b/managed/CounterStrikeSharp.API/Core/Model/CTakeDamageInfo.cs index 00e62f289..b616e3c96 100644 --- a/managed/CounterStrikeSharp.API/Core/Model/CTakeDamageInfo.cs +++ b/managed/CounterStrikeSharp.API/Core/Model/CTakeDamageInfo.cs @@ -11,7 +11,7 @@ public partial class CTakeDamageInfo /// Returns a enumeration representing the player's current hit group, /// or if the hit group cannot be determined. /// - public HitGroup_t HitGroup() + public HitGroup_t GetHitGroup() { IntPtr v4 = Marshal.ReadIntPtr(Handle, 0x78);