forked from leftspace89/pPlat
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGameObject.cpp
72 lines (55 loc) · 1.32 KB
/
GameObject.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
UnitType GameObject::GetType()
{
__try
{
if (this == nullptr)
return UnitType::Unknown;
auto unitType = *reinterpret_cast<UnitType**>(this + static_cast<int>(Offsets::oGameObject::Type));
if (unitType != nullptr)
{
return *static_cast<UnitType*>(unitType);
}
}
__except (1)
{
}
return UnitType::Unknown;
}
byte* GameObject::GetTypeByte()
{
return reinterpret_cast<byte*>(this + static_cast<int>(Offsets::oGameObject::Type));
}
short* GameObject::GetIndex()
{
return reinterpret_cast<short*>(this + 0x8);
}
GameObjectVTable* GameObject::GetVirtual()
{
return reinterpret_cast<GameObjectVTable*>(this);
}
char *GameObject::namechar()
{
__try
{
return (char*)reinterpret_cast<String*>(this + static_cast<int>(Offsets::oGameObject::Name));
}
__except (1)
{
return "except";
}
}
std::string GameObject::GetName()
{
//std::string ss(namechar());
//return ss;
return *reinterpret_cast<String*>(this + static_cast<int>(Offsets::oGameObject::Name));
}
void GameObject::SetName(std::wstring name)
{
*reinterpret_cast<std::wstring*>(this + static_cast<int>(Offsets::oGameObject::Name)) = name;
}
uint* GameObject::GetNetworkId()
{
IS_NULL_RETN(this, static_cast<int>(Offsets::oGameObject::NetworkId), 0);
return reinterpret_cast<uint*>(this + static_cast<int>(Offsets::oGameObject::NetworkId));
}