Skip to content

Commit b8085fe

Browse files
committed
# Conflicts:
# src/Client/Module/Manager.cpp
1 parent 5f94836 commit b8085fe

File tree

11 files changed

+405
-5
lines changed

11 files changed

+405
-5
lines changed

src/Client/Client.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,11 @@ void Client::initialize() {
6868
{"https://cdn-c6f.pages.dev/assets/gear.png", Path + "gear.png"},
6969
{"https://cdn-c6f.pages.dev/assets/font.ttf", Path + "font.ttf"},
7070
{"https://cdn-c6f.pages.dev/assets/logo.png", Path + "logo.png"},
71+
{"https://withors-flarial-cdn.pages.dev/flareal-dev.png", Path + "flarial-dev.png"},
72+
{"https://withors-flarial-cdn.pages.dev/flarial-contribiutor.png", Path + "flarial-contribiutor.png"},
73+
{"https://withors-flarial-cdn.pages.dev/flarial-premium.png", Path + "flarial-premium.png"},
74+
{"https://withors-flarial-cdn.pages.dev/flarial-staff.png", Path + "flarial-staff.png"},
75+
{"https://withors-flarial-cdn.pages.dev/re-q.png", Path + "re-q.png"},
7176
{"https://cdn-c6f.pages.dev/assets/fps.png", Path + "fps.png"},
7277
{"https://cdn-c6f.pages.dev/assets/like.png", Path + "like.png"},
7378
{"https://cdn-c6f.pages.dev/assets/auto_sprint.png", Path + "auto_sprint.png"},

src/Client/Module/Manager.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,12 +59,18 @@
5959
#include "Modules/NoHurtCam/NoHurtCam.hpp"
6060
#include "Modules/CommandHotkey/CommandHotkey.hpp"
6161
#include "Modules/Misc/DiscordRPC/DiscordRPCListener.hpp"
62+
#include "Modules/Overlay/OverlayModule.hpp"
63+
#include "Modules/AutoRQ/AutoRQ.hpp"
6264
#include "Modules/MovableChat/MovableChat.hpp"
6365
#include <algorithm>
6466

6567
namespace ModuleManager {
6668
std::unordered_map<size_t, Module*> moduleMap;
6769
std::vector<std::string> onlineUsers;
70+
std::vector<std::string> onlineDevs;
71+
std::vector<std::string> onlineCommites;
72+
std::vector<std::string> onlinePluses;
73+
std::vector<std::string> onlineStaff;
6874
}
6975

7076
void ModuleManager::addModule(Module* module) {
@@ -137,6 +143,8 @@ void ModuleManager::initialize() {
137143
ModuleManager::addModule(new CommandHotkey());
138144
ModuleManager::addModule(new NoHurtCam());
139145
ModuleManager::addModule(new InventoryHUD());
146+
//ModuleManager::addModule(new OverlayModule());
147+
ModuleManager::addModule(new AutoRQ());
140148
//ModuleManager::addModule(new MovableChat());
141149
//ModuleManager::addModule(new CompactChat());
142150

src/Client/Module/Manager.hpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,9 @@ namespace ModuleManager {
2121
Module *getModule(const std::string& name);
2222

2323
extern std::vector<std::string> onlineUsers;
24+
extern std::vector<std::string> onlineDevs;
25+
extern std::vector<std::string> onlineCommites;
26+
extern std::vector<std::string> onlinePluses;
27+
extern std::vector<std::string> onlineStaff;
2428
}
29+
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
#pragma once
2+
3+
#include "../Module.hpp"
4+
#include "../../../Events/EventHandler.hpp"
5+
#include "AutoRQListener.hpp"
6+
7+
8+
class AutoRQ : public Module {
9+
10+
public:
11+
12+
13+
AutoRQ() : Module("Auto RE Q", "just auto re q",
14+
R"(\Flarial\assets\re-q.png)", "") {
15+
16+
Module::setup();
17+
18+
};
19+
20+
void onEnable() override {
21+
EventHandler::registerListener(new AutoRQListener("AutoRQ", this));
22+
Module::onEnable();
23+
}
24+
25+
void onDisable() override {
26+
EventHandler::unregisterListener("AutoRQ");
27+
Module::onDisable();
28+
}
29+
30+
void defaultConfig() override {
31+
if (settings.getSettingByName<std::string>("command") == nullptr)
32+
settings.addSetting("command", (std::string)"");
33+
}
34+
35+
void settingsRender() override {
36+
37+
}
38+
};
39+
Lines changed: 158 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,158 @@
1+
#pragma once
2+
3+
#include "../../../../SDK/SDK.hpp"
4+
#include "../../../../SDK//Client/Network/Packet/PlaySoundPacket.hpp"
5+
#include "../../../../SDK//Client/Network/Packet/TextPacket.hpp"
6+
#include <format>
7+
#include "../../../Events/Listener.hpp"
8+
#include "../../../Events/Input/KeyEvent.hpp"
9+
#include "../Module.hpp"
10+
#include "../../../GUI/Engine/Engine.hpp"
11+
#include <Windows.h>
12+
#include <chrono>
13+
#include "../../../../SDK/SDK.hpp"
14+
#include "../../../../SDK//Client/Network/Packet/CommandRequestPacket.hpp"
15+
#include <format>
16+
#include "../../../Events/Listener.hpp"
17+
#include "../../../Events/Input/KeyEvent.hpp"
18+
#include "../Module.hpp"
19+
#include "../../../GUI/Engine/Engine.hpp"
20+
#include <Windows.h>
21+
#include <chrono>
22+
#include <iostream>
23+
#include <iomanip>
24+
#include <vector>
25+
#include <random>
26+
27+
class AutoRQListener : public Listener {
28+
Module *module;
29+
30+
std::string currentGame = "";
31+
bool triggered = false;
32+
33+
34+
static std::vector<uint8_t> generateUUIDBytes() {
35+
std::random_device rd;
36+
std::mt19937 gen(rd());
37+
std::uniform_int_distribution<> dis(0, 255);
38+
39+
std::vector<uint8_t> uuidBytes(16);
40+
for (int i = 0; i < 16; ++i) {
41+
uuidBytes[i] = static_cast<uint8_t>(dis(gen));
42+
}
43+
44+
// Set the version to 4
45+
uuidBytes[6] = (uuidBytes[6] & 0x0F) | 0x40;
46+
47+
// Set the variant to RFC 4122
48+
uuidBytes[8] = (uuidBytes[8] & 0x3F) | 0x80;
49+
50+
return uuidBytes;
51+
}
52+
53+
static std::string convertUUIDBytesToString(const std::vector<uint8_t>& uuidBytes) {
54+
std::stringstream ss;
55+
56+
for (const auto& byte : uuidBytes) {
57+
ss << std::hex << std::setw(2) << std::setfill('0') << static_cast<int>(byte);
58+
}
59+
60+
return ss.str();
61+
}
62+
63+
// Function to modify and return the UUID bytes
64+
static std::vector<uint8_t> UUIDtoMC() {
65+
// Generate a UUID v4
66+
std::vector<uint8_t> uuidBytes = generateUUIDBytes();
67+
68+
// Reverse the first 8 bytes
69+
for (int i = 0; i < 4; ++i) {
70+
std::swap(uuidBytes[i], uuidBytes[7 - i]);
71+
}
72+
73+
// Reverse the next 8 bytes
74+
for (int i = 8; i < 12; ++i) {
75+
std::swap(uuidBytes[i], uuidBytes[15 - i]);
76+
}
77+
78+
return uuidBytes;
79+
}
80+
81+
82+
void onPacketReceive(PacketEvent &event) override {
83+
MinecraftPacketIds id = event.getPacket()->getId();
84+
85+
// TODO: add support for other servers (look for "won the game" text)
86+
if (id == MinecraftPacketIds::PlaySoundA) {
87+
auto *pkt = reinterpret_cast<PlaySoundPacket *>(event.getPacket());
88+
89+
if (pkt->mName == "raid.horn" ||
90+
pkt->mName == "raid.horn") {
91+
triggered = true;
92+
std::shared_ptr<Packet> packet = SDK::createPacket(77);
93+
auto* command_packet = reinterpret_cast<CommandRequestPacket*>(packet.get());
94+
95+
command_packet->command = "/connection";
96+
97+
command_packet->origin.type = CommandOriginType::Player;
98+
99+
command_packet->InternalSource = true;
100+
101+
SDK::clientInstance->getPacketSender()->sendToServer(command_packet);
102+
103+
} //std::cout << pkt->mName << std::endl;
104+
105+
}
106+
else if (id == MinecraftPacketIds::Text) {
107+
auto* pkt = reinterpret_cast<TextPacket*>(event.getPacket());
108+
//if (pkt->type == TextPacketType::SYSTEM) {
109+
std::string textToCheck = "You are connected to server name ";
110+
std::string textToCheckToSilence = "You are connected";
111+
if (pkt->message.find(textToCheck) != std::string::npos && triggered) {
112+
std::string server = pkt->message.replace(0, textToCheck.length(), "");
113+
std::regex pattern("\\d+");
114+
std::string name = std::regex_replace(server, pattern, "");
115+
FlarialGUI::Notify("Preparing Q: " + name);
116+
std::thread t([name]() {
117+
std::this_thread::sleep_for(std::chrono::milliseconds(1000));
118+
119+
FlarialGUI::Notify("Executing command /q " + name);
120+
121+
std::shared_ptr<Packet> packet = SDK::createPacket(77);
122+
auto* command_packet = reinterpret_cast<CommandRequestPacket*>(packet.get());
123+
command_packet->command = "/q " + name;
124+
125+
command_packet->origin.type = CommandOriginType::Player;
126+
127+
command_packet->InternalSource = true;
128+
SDK::clientInstance->getPacketSender()->sendToServer(command_packet);
129+
});
130+
t.detach();
131+
triggered = false;
132+
pkt->message = "";
133+
134+
}
135+
else if (pkt->message.find(textToCheckToSilence) != std::string::npos) {
136+
pkt->message = "";
137+
}
138+
//}
139+
}
140+
}
141+
142+
void onPacketSend(PacketEvent &event) override {
143+
/*if (event.getPacket()->getId() == MinecraftPacketIds::Text) {
144+
TextPacket *pkt = reinterpret_cast<TextPacket *>(event.getPacket());
145+
std::cout << pkt->message << std::endl;
146+
147+
}
148+
*/
149+
}
150+
151+
public:
152+
explicit AutoRQListener(const char string[5], Module *
153+
154+
module) {
155+
this->name = string;
156+
this->module = module;
157+
}
158+
};

src/Client/Module/Modules/Misc/DiscordRPC/DiscordRPCListener.hpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
class DiscordRPCListener : public Listener {
88

99
public:
10-
std::string towriteip;
1110

1211
void onRaknetTick(RaknetTickEvent &event) override {
1312
static bool once = false;
@@ -49,15 +48,14 @@ class DiscordRPCListener : public Listener {
4948
CloseHandle(fileHandle);
5049
}
5150

52-
if (towriteip != ip) {
51+
if (SDK::getServerIP() != ip) {
5352

5453
std::ofstream outputFile(settingspath);
5554
if (outputFile.is_open()) {
5655
outputFile << ip;
5756
outputFile.close();
5857
}
5958

60-
towriteip = ip;
6159
}
6260
}
6361
}
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
#pragma once
2+
3+
#include <format>
4+
#include "../../../Events/Listener.hpp"
5+
#include "../../../Events/Input/KeyEvent.hpp"
6+
#include "../../../../Utils/Logger/Logger.hpp"
7+
#include "../Module.hpp"
8+
#include "../../../../SDK/SDK.hpp"
9+
#include <Windows.h>
10+
11+
class OverlayListener : public Listener {
12+
Module* module;
13+
bool enabled = false;
14+
15+
public:
16+
static inline std::string backupOri;
17+
18+
void onDrawText(DrawTextEvent &event) override {
19+
if (SDK::clientInstance != nullptr) {
20+
if (SDK::clientInstance->getLocalPlayer() != nullptr) {
21+
if (original.empty()) original = SDK::clientInstance->getLocalPlayer()->playerName;
22+
if (module->isEnabled()) {
23+
std::string localPlayerName = original;
24+
size_t pos = event.getText()->find(localPlayerName);
25+
if (pos != std::string::npos) {
26+
std::string faketxt = *event.getText();
27+
faketxt.replace(pos, localPlayerName.length(),
28+
module->settings.getSettingByName<std::string>("nick")->value);
29+
*event.getText() = faketxt;
30+
}
31+
}
32+
}
33+
}
34+
}
35+
36+
void onTick(TickEvent &event) override {
37+
if (!SDK::clientInstance->getLocalPlayer())
38+
return;
39+
if (enabled != module->isEnabled()) {
40+
}
41+
42+
if (enabled) {
43+
std::for_each(SDK::clientInstance->getLocalPlayer()->getlevel()->getPlayerMap().begin(), SDK::clientInstance->getLocalPlayer()->getlevel()->getPlayerMap().end(),
44+
[](std::pair<mcUUID, PlayerListEntry> p) {
45+
46+
Logger::info(p.second.name);
47+
});
48+
49+
} else {
50+
51+
52+
}
53+
54+
}
55+
56+
explicit OverlayListener(const char string[5], Module *module) {
57+
this->name = string;
58+
this->module = module;
59+
}
60+
61+
static inline std::string original2;
62+
static inline std::string original;
63+
};
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
#pragma once
2+
3+
#include "../Module.hpp"
4+
#include "OverlayListener.hpp"
5+
#include "../../../Events/EventHandler.hpp"
6+
7+
8+
class OverlayModule : public Module {
9+
10+
public:
11+
12+
OverlayModule() : Module("Overlay",
13+
"xD",
14+
R"(\Flarial\assets\icognito.png)", "") {
15+
16+
Module::setup();
17+
18+
};
19+
20+
void onEnable() override {
21+
22+
EventHandler::registerListener(new OverlayListener("OverlayListener", this));
23+
24+
Module::onEnable();
25+
26+
}
27+
28+
void onDisable() override {
29+
EventHandler::unregisterListener("OverlayListener");
30+
Module::onDisable();
31+
}
32+
33+
void defaultConfig() override {
34+
35+
}
36+
37+
void settingsRender() override {
38+
float toggleX = Constraints::PercentageConstraint(0.019, "left");
39+
float toggleY = Constraints::PercentageConstraint(0.10, "top");
40+
41+
const float textWidth = Constraints::RelativeConstraint(0.12, "height", true);
42+
43+
toggleY += Constraints::SpacingConstraint(0.35, textWidth);
44+
FlarialGUI::TextBoxVisual(5, settings.getSettingByName<std::string>("nick")->value, 16, toggleX, toggleY);
45+
}
46+
};

0 commit comments

Comments
 (0)