-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathFortPlayerController.cpp
126 lines (100 loc) · 3.84 KB
/
FortPlayerController.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
#include "pch.h"
#include "FortPlayerController.h"
UFunction* AFortPlayerController::Fn_ServerReadyToStartMatch = nullptr;
UFunction* AFortPlayerController::Fn_ServerSetClientHasFinishedLoading = nullptr;
UFunction* AFortPlayerController::Fn_OnRep_bHasServerFinishedLoading = nullptr;
bool AFortPlayerController::CanExec_ServerReadyToStartMatch = false;
bool AFortPlayerController::CanExec_ServerSetClientHasFinishedLoading = false;
bool AFortPlayerController::CanExec_OnRep_bHasServerFinishedLoading = false;
int32_t AFortPlayerController::Offset_bHasServerFinishedLoading = 0;
AFortPlayerController::AFortPlayerController()
{
}
AFortPlayerController::AFortPlayerController(APlayerController* PlayerController)
{
APlayerController::APlayerController(PlayerController);
Setup();
}
void AFortPlayerController::Setup()
{
__super::Setup();
SetPointer(XOR(L"Function /Script/FortniteGame.FortPlayerController:ServerReadyToStartMatch"), &Fn_ServerReadyToStartMatch, &CanExec_ServerReadyToStartMatch);
SetPointer(XOR(L"Function /Script/FortniteGame.FortPlayerController:ServerSetClientHasFinishedLoading"), &Fn_ServerSetClientHasFinishedLoading, &CanExec_ServerSetClientHasFinishedLoading);
SetPointer(XOR(L"Function /Script/FortniteGame.FortPlayerController:OnRep_bHasServerFinishedLoading"), &Fn_OnRep_bHasServerFinishedLoading, &CanExec_OnRep_bHasServerFinishedLoading);
if (Offset_bHasServerFinishedLoading == 0)
{
Offset_bHasServerFinishedLoading = ObjectFinder::FindOffset(XOR(L"Class /Script/FortniteGame.FortGameStateAthena"), XOR(L"GamePhase"));
}
bHasServerFinishedLoading = reinterpret_cast<bool*>(reinterpret_cast<uintptr_t>(InternalObject) + Offset_bHasServerFinishedLoading);
}
void AFortPlayerController::ServerReadyToStartMatch()
{
if (!CanExec_ServerReadyToStartMatch) return;
if (Util::IsBadReadPtr(Fn_ServerReadyToStartMatch))
{
PLOGE << "Fn_ServerReadyToStartMatch is nullptr";
return;
}
InternalObject = GetGame()->LocalPlayers[0].GetPlayerController()->InternalObject;
if (Util::IsBadReadPtr(InternalObject))
{
PLOGE << "InternalObject is nullptr";
return;
}
ProcessNoParamsEvent(InternalObject, Fn_ServerReadyToStartMatch);
}
void AFortPlayerController::ServerSetClientHasFinishedLoading(bool bInHasFinishedLoading)
{
if (!CanExec_ServerSetClientHasFinishedLoading) return;
struct Params {
bool bInHasFinishedLoading;
};
auto params = Params();
params.bInHasFinishedLoading = bInHasFinishedLoading;
if (Util::IsBadReadPtr(Fn_ServerSetClientHasFinishedLoading))
{
PLOGE << "Fn_ServerReadyToStartMatch is nullptr";
return;
}
InternalObject = GetGame()->LocalPlayers[0].GetPlayerController()->InternalObject;
if (Util::IsBadReadPtr(InternalObject))
{
PLOGE << "InternalObject is nullptr";
return;
}
ProcessEvent(InternalObject, Fn_ServerSetClientHasFinishedLoading, ¶ms);
}
void AFortPlayerController::OnRep_bHasServerFinishedLoading()
{
InternalObject = GetGame()->LocalPlayers[0].GetPlayerController()->InternalObject;
if (Util::IsBadReadPtr(InternalObject))
{
PLOGE << "InternalObject is nullptr";
return;
}
ProcessNoParamsEvent(InternalObject, Fn_OnRep_bHasServerFinishedLoading);
}
void AFortPlayerController::SetbHasServerFinishedLoading(bool bHasServerFinishedLoading)
{
InternalObject = GetGame()->LocalPlayers[0].GetPlayerController()->InternalObject;
if (Offset_bHasServerFinishedLoading == 0)
{
PLOGE << "Invalid Offset";
return;
}
if (InternalObject == 0)
{
PLOGE << "Invalid InternalObject";
return;
}
if (Util::IsBadReadPtr(this->bHasServerFinishedLoading))
{
this->bHasServerFinishedLoading = reinterpret_cast<bool*>(reinterpret_cast<uintptr_t>(InternalObject) + Offset_bHasServerFinishedLoading);
}
if (Util::IsBadReadPtr(this->bHasServerFinishedLoading))
{
PLOGE << "Invalid pointer bHasServerFinishedLoading";
return;
}
*this->bHasServerFinishedLoading = bHasServerFinishedLoading;
}