1+ // Copyright Armchair Developers. Licensed under GPLv3.
2+
3+ #pragma once
4+
5+ #include < SDK/SDK.h>
6+ #include < SDK/TypeInfo.h>
7+ #include < SDK/Types.h>
8+ #include < Core/EventManager.h>
9+ #include < Network/SocketManager.h>
10+ #include < Voip/VoipManager.h>
11+
12+ #define OFFSET_GET_CLIENT_INSTANCE 0x14659DE50
13+
14+ namespace Kyber
15+ {
16+ __int64 ClientStateChangeHk (__int64 a1, ClientState currentClientState, ClientState lastClientState);
17+
18+ class Client : public EventListener
19+ {
20+ public:
21+ Client ();
22+ ~Client ();
23+
24+ void Initialize ();
25+ void InitializeHooks ();
26+
27+ void HandleClientServerJoin (NetworkCreatePlayerMessage* message);
28+ void RegisterClientUpdatePassListener (ClientUpdatePassListener* listener);
29+ void AttemptJoinVoip ();
30+
31+ // If proxied is true, IP is assumed to be a proxy ID
32+ void JoinServer (const std::string& id, std::string ip, uint16_t port, bool spectate, bool proxied = false , bool changeState = true );
33+
34+ __int64 ChangeClientState (ClientState currentClientState)
35+ {
36+ return ClientStateChangeHk (
37+ *reinterpret_cast <__int64*>(*reinterpret_cast <__int64*>(((__int64 (*)(void ))OFFSET_GET_CLIENT_INSTANCE)() + 0x20 ) + 0x28 ),
38+ currentClientState, m_clientState);
39+ }
40+
41+ void OnEvent (const Event& event) override ;
42+
43+ std::string m_joinToken;
44+
45+ ClientState m_clientState;
46+
47+ SocketManager* m_socketManager;
48+ VoipManager* m_voipManager;
49+ EventManager* m_eventManager;
50+
51+ std::vector<ClientUpdatePassListener*> m_updatePassListeners;
52+
53+ bool m_joining;
54+ bool m_spectator;
55+ bool m_connected;
56+ };
57+ } // namespace Kyber
0 commit comments