Repository navigation
Expand file tree
/
Copy pathInfiniteJetpack.h
More file actions
88 lines (69 loc) 路 2.29 KB
/
Copy pathInfiniteJetpack.h
File metadata and controls
88 lines (69 loc) 路 2.29 KB
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
#pragma once
/// @file
/// The InfiniteJetpack feature: keeps the local character's thruster/jetpack
/// perpetually charged and silent to bots while enabled, restoring the
/// captured originals on disable.
#include "Feature.h"
#include "../ue/Engine.h"
/// Overwrites the character's thruster recharge/timing fields each frame so the
/// jetpack never depletes.
class InfiniteJetpack : public Feature
{
private:
APortalWarsCharacter* Player = 0; ///< cached local character; refreshed each Check()
float OriginalThrusterRechargeDelay; ///< captured at Init, restored by Destroy()
float OriginalThrusterCurrentTime; ///< captured at Init, restored by Destroy()
float OriginalThrusterLoudnessForBots; ///< captured at Init, restored by Destroy()
public:
InfiniteJetpack()
{
Name = "InfiniteJetpack";
UpdateEnabled();
Log("Created");
};
void UpdateEnabled()
{
Enabled = Settings.EXPLOITS.InfinteJetpack;
};
// Valid to act whenever we have a live local character; the loop decides
// enabled/disabled and calls Run()/Destroy() accordingly.
bool Check()
{
if (!Initialized) return false;
if (!Engine::PlayerController) return false;
if (!Engine::IsInGame) return false;
Player = reinterpret_cast<APortalWarsCharacter*>(Engine::PlayerController->Character);
if (!Player) return false;
return true;
};
void Init()
{
Player = reinterpret_cast<APortalWarsCharacter*>(Engine::PlayerController->Character);
if (!Player)
{
Initialized = false;
return;
}
OriginalThrusterRechargeDelay = Player->thrusterRechargeDelay;
OriginalThrusterCurrentTime = Player->thrusterCurrentTime;
OriginalThrusterLoudnessForBots = Player->ThrusterLoudnessForBots;
Initialized = true;
Log("Initialized");
};
/// Restore the captured thruster values on disable, but only if they still
/// hold our injected recharge delay (avoids overwriting the game's own value).
void Destroy()
{
if (Player->thrusterRechargeDelay != 0.1f) return;
Player->thrusterRechargeDelay = OriginalThrusterRechargeDelay;
Player->thrusterCurrentTime = OriginalThrusterCurrentTime;
Player->ThrusterLoudnessForBots = OriginalThrusterLoudnessForBots;
return;
};
void Run()
{
Player->thrusterRechargeDelay = 0.1f;
Player->thrusterCurrentTime = 0.0f;
Player->ThrusterLoudnessForBots = 0.0f;
};
};