Repository navigation
Expand file tree
/
Copy pathCDOTABaseAbility.h
More file actions
104 lines (96 loc) · 2.9 KB
/
Copy pathCDOTABaseAbility.h
File metadata and controls
104 lines (96 loc) · 2.9 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
#pragma once
#include <span>
#include "netvars.h"
struct AbilityKVEntry : public VClass {
const char* GetKey() {
return Member<const char*>(0);
}
int GetValuesSize() {
return Member<int>(0x30);
}
auto GetValues() {
auto size = GetValuesSize();
return std::span{ MemberInline<float>(0x34), uint64_t(size) };
}
};
class CDOTABaseAbility : public VClass {
public:
int Level() {
uintptr_t Addr = ((uintptr_t)this + Netvars::Offsets.m_iLevel);
return *(int*)Addr;
}
bool IsNeutralDrop() {
uintptr_t Addr = ((uintptr_t)this + Netvars::Offsets.m_bIsNeutralDrop);
return *(bool*)Addr;
}
float Cooldown() {
uintptr_t Addr = ((uintptr_t)this + Netvars::Offsets.m_fCooldown);
return *(float*)Addr;
}
bool IsToggled() {
uintptr_t Addr = ((uintptr_t)this + Netvars::Offsets.m_bToggleState);
return *(bool*)Addr;
}
float CooldownLength() {
uintptr_t Addr = ((uintptr_t)this + Netvars::Offsets.m_flCooldownLength);
return *(float*)Addr;
}
int ManaCost() {
uintptr_t Addr = ((uintptr_t)this + Netvars::Offsets.m_iManaCost);
return *(int*)Addr;
}
bool HaveEnoughMana(float OwnerMana) {
return (this->ManaCost() < OwnerMana);
}
bool InAbilityPhase() {
uintptr_t Addr = ((uintptr_t)this + Netvars::Offsets.m_bInAbilityPhase);
return *(bool*)Addr;
}
/*PT_STATE PowerTreadsStat() {
uintptr_t Addr = ((uintptr_t)this + Netvars::Offsets.m_iStat);
return *(PT_STATE*)Addr;
}*/
int Charges() {
uintptr_t Addr = ((uintptr_t)this + Netvars::Offsets.m_iCurrentCharges);
return *(int*)Addr;
}
typedef float (*GetLevelSpecialValueForFn)(CDOTABaseAbility* thisptr, const char* value, int level, void* unk1, bool noOverride, bool* result);
static inline GetLevelSpecialValueForFn GetLevelSpecialValueForFunc{};
typedef AbilityKVEntry* (*GetKVEntryFn)(CDOTABaseAbility* thisptr, const char* value);
static inline GetKVEntryFn GetKVEntry{};
template<typename T = float>
T GetLevelSpecialValueFor(const char* value, int level = -1) {
return (T)GetLevelSpecialValueForFunc(this, value, level, nullptr, 0, nullptr);
}
template<typename T>
T GetKVValueFor(const char* valName, int level = -1) {
auto entry = GetKVEntry(this, valName);
if (level < 0)
level = Level();
if (level > entry->GetValuesSize() - 1)
level = entry->GetValuesSize();
auto values = entry->GetValues();
return (T)values[level - 1];
}
int CastRange() {
//return GetKVValueFor<int>("AbilityCastRange");
return GetLevelSpecialValueFor<int>("AbilityCastRange");
}
int CastRangeBonus() {
return CallVFunc<249, int>(nullptr, nullptr, nullptr);
}
int EffectiveCastRange() {
return CastRange();//Todo: + CastRangeBonus();
}
int GetAOERadius() {
return GetLevelSpecialValueFor<int>("radius");
}
};
struct Ability {
CDOTABaseAbility* BaseAbility;
const char* name;
int cost;
int level;
float cooldown;
bool IsNeutralDrop;
};