-
Notifications
You must be signed in to change notification settings - Fork 7
/
Base.cpp
89 lines (66 loc) · 1.95 KB
/
Base.cpp
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
#include "Base.hpp"
std::wstring Base::GetBaseName(Entity* e)
{
UINT64 BaseCompAddr = e->GetComponentAddress("Base");
std::wstring baseName;
if (BaseCompAddr == NULL)
{
printf("[ERROR] BaseName was NULL.\n");
return baseName;
}
UINT64 InternalPtr = DereferenceSafe<UINT64>(BaseCompAddr + Base::Offsets::FurtherDetailsPtr);
if (InternalPtr != NULL) //sometimes its the string at the address, sometimes its a pointer to a string..
{
UINT64 NamePtrAddr = *(UINT64*)(InternalPtr + Base::Offsets::BaseName); //sometimes a ptr, not always. . .
if (DereferenceSafe<UINT64>(NamePtrAddr) != NULL)
{
__try
{
baseName = std::wstring((const wchar_t*)NamePtrAddr); //crash. . .
}
__except (EXCEPTION_EXECUTE_HANDLER)
{
baseName = L"";
}
}
}
return baseName;
}
bool Base::IsElder(Entity* e)
{
UINT64 BaseCompAddr = e->GetComponentAddress("Base");
if (BaseCompAddr == NULL)
return 0;
bool isElder = DereferenceSafe<bool>(BaseCompAddr + Base::Offsets::IsElder);
return isElder;
}
bool Base::IsShaper(Entity* e)
{
UINT64 BaseCompAddr = e->GetComponentAddress("Base");
if (BaseCompAddr == NULL)
return 0;
bool isShaper = DereferenceSafe<bool>(BaseCompAddr + Base::Offsets::IsShaper);
return isShaper;
}
bool Base::IsCorrupted(Entity* e)
{
UINT64 BaseCompAddr = e->GetComponentAddress("Base");
if (BaseCompAddr == NULL)
return 0;
bool corrupted = DereferenceSafe<bool>(BaseCompAddr + Base::Offsets::IsCorrupted);
return corrupted;
}
std::wstring Base::GetPublicPrice(Entity* e)
{
UINT64 BaseCompAddr = e->GetComponentAddress("Base");
if (BaseCompAddr == NULL)
return L"";
UINT64 PriceAddr = DereferenceSafe<UINT64>(BaseCompAddr + Base::Offsets::PublicPrice);
if (PriceAddr != NULL)
{
printf("Price Address: %llX\n", PriceAddr);
wchar_t* tagPtr = (wchar_t*)PriceAddr;
return std::wstring(tagPtr);
}
return L"";
}