-
Notifications
You must be signed in to change notification settings - Fork 7
/
Mods.cpp
137 lines (106 loc) · 2.85 KB
/
Mods.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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
#include "Mods.hpp"
bool Mods::IsIdentified(Entity* e)
{
UINT64 CompAddr = e->GetComponentAddress("Mods");
bool isIded = false;
if (CompAddr > NULL)
{
isIded = DereferenceSafe<bool>(CompAddr + Mods::Offsets::IsIdentified);
}
return isIded;
}
bool Mods::IsMirrored(Entity* e)
{
UINT64 CompAddr = e->GetComponentAddress("Mods");
bool mirrored = false;
if (CompAddr > NULL)
{
mirrored = DereferenceSafe<bool>(CompAddr + Mods::Offsets::IsMirrored);
}
return mirrored;
}
bool Mods::IsSynthesized(Entity* e)
{
UINT64 CompAddr = e->GetComponentAddress("Mods");
bool synthesized = false;
if (CompAddr > NULL)
{
synthesized = DereferenceSafe<bool>(CompAddr + Mods::Offsets::IsSynthesized);
}
return synthesized;
}
Mods::ItemRarities Mods::GetItemRarity(Entity* e)
{
UINT64 CompAddr = e->GetComponentAddress("Mods");
int Rarity = 0;
if (CompAddr != NULL)
{
CompAddr = CompAddr + Mods::Offsets::Rarity;
Rarity = DereferenceSafe<int>(CompAddr);
return (ItemRarities)Rarity;
}
return ItemRarities::Normal;
}
int Mods::GetItemLevel(Entity* e)
{
UINT64 CompAddr = e->GetComponentAddress("Mods");
int ItemLevel = 0;
if (CompAddr != NULL)
{
CompAddr = CompAddr + Mods::Offsets::ItemLevel;
ItemLevel = DereferenceSafe<int>(CompAddr);
}
return ItemLevel;
}
int Mods::GetRequiredLevel(Entity* e)
{
UINT64 CompAddr = e->GetComponentAddress("Mods");
int requiredLevel = 0;
if (CompAddr != NULL)
{
CompAddr = CompAddr + Mods::Offsets::RequiredLevel;
requiredLevel = DereferenceSafe<int>(CompAddr);
}
return requiredLevel;
}
std::wstring Mods::GetUniqueName(Entity* e) //broken.... too stupid to update it properly
{
return L"";
UINT64 CompAddr = e->GetComponentAddress("Mods");
std::wstring fullName;
if (CompAddr != NULL)
{
CompAddr = CompAddr + Mods::Offsets::UniqueName;
if (CompAddr != NULL)
{
UINT64 PtrListArray = DereferenceSafe<UINT64>(CompAddr);
UINT64 PtrEndArray = DereferenceSafe<UINT64>(CompAddr + 8);
UINT64 Current = PtrListArray;
int count = 0;
while (Current <= PtrEndArray)
{
UINT64 NameRecord = DereferenceSafe<UINT64>(PtrListArray + (count * 0x10));
UINT32 NameRecordCounter = DereferenceSafe<UINT32>(NameRecord);
if (NameRecordCounter >= 1 && NameRecordCounter <= 10)
{
UINT64 NameAddr = DereferenceSafe<UINT64>(NameRecord + 4);
printf("NameAddr: %llX\n", NameAddr);
if (NameAddr != NULL && NameAddr > 0x0000010000000000 && NameAddr != 0xFFFFFFFFFFFFFFFF)
{
if (NameRecordCounter == 1)
{
fullName = std::wstring((const wchar_t*)NameAddr);
}
else
{
fullName = fullName + (const wchar_t*)NameAddr;
}
}
}
Current += 0x10;
count += 1;
}
}
}
return fullName;
}