Skip to content

Commit 1ce1c50

Browse files
authored
Merge pull request #15 from ByteCorum/main
code cleanup / organization / optimization
2 parents 9c70a35 + 05c9108 commit 1ce1c50

File tree

16 files changed

+139
-141
lines changed

16 files changed

+139
-141
lines changed

.github/workflows/build-check.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,11 @@ jobs:
1818

1919
- name: Building project
2020
run: |
21-
msbuild CS2-External-Base.sln -t:Rebuild -p:Configuration=Release -p:Platform=x64
21+
msbuild TempleWare-External.sln -t:Rebuild -p:Configuration=Release -p:Platform=x64
2222
2323
- name: Archive artifacts
2424
uses: actions/upload-artifact@v4
2525
with:
2626
name: Compiled-Binaries
2727
path: |
28-
D:\a\CS2-External-Base\x64\Release\CS2-External-Base.exe
28+
D:\a\TempleWare-External\x64\Release\TempleWare-External.exe

TempleWare-External/source/features/bhop.cpp

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,8 @@ namespace features
1414
return;
1515

1616
HWND hwnd_cs2 = FindWindowA(NULL, "Counter-Strike 2");
17-
if (hwnd_cs2 == NULL) {
17+
if (hwnd_cs2 == NULL)
1818
hwnd_cs2 = FindWindowA(NULL, "Counter-Strike 2");
19-
}
2019

2120
bool spacePressed = GetAsyncKeyState(VK_SPACE);
2221
int flags = memory.Read<std::uintptr_t>(localPlayer + offsets::m_fFlags);
@@ -27,14 +26,9 @@ namespace features
2726
SendMessage(hwnd_cs2, WM_KEYUP, VK_SPACE, 0);
2827
SendMessage(hwnd_cs2, WM_KEYDOWN, VK_SPACE, 0);
2928
}
30-
3129
else if (spacePressed && !isInAir)
32-
{
3330
SendMessage(hwnd_cs2, WM_KEYUP, VK_SPACE, 0);
34-
}
3531
else if (!spacePressed)
36-
{
3732
SendMessage(hwnd_cs2, WM_KEYUP, VK_SPACE, 0);
38-
}
3933
}
4034
}

TempleWare-External/source/features/bhop.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,6 @@ namespace features
1010
{
1111
public:
1212
static void Run(const Memory& memory) noexcept;
13+
1314
};
1415
}

TempleWare-External/source/features/fov.h

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,12 @@
22

33
#include "../memory/Memory.h"
44

5-
namespace features {
6-
class FOVManager {
5+
namespace features
6+
{
7+
class FOVManager
8+
{
79
public:
810
static void AdjustFOV(const Memory& memory) noexcept;
11+
912
};
1013
}

TempleWare-External/source/features/glow.h

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,12 @@
22

33
#include "../memory/memory.h"
44

5-
namespace features {
6-
class Glow {
5+
namespace features
6+
{
7+
class Glow
8+
{
79
public:
810
static void Run(const Memory& memory) noexcept;
11+
912
};
1013
}

TempleWare-External/source/features/noflash.cpp

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,22 @@
22
#include "../globals/globals.h"
33
#include "../offsets/offsets.h"
44

5-
namespace features {
6-
void NoFlash::Run(const Memory& memory) noexcept {
7-
if (globals::NoFlashEnabled) {
5+
namespace features
6+
{
7+
8+
void NoFlash::Run(const Memory& memory) noexcept
9+
{
10+
if (globals::NoFlashEnabled)
11+
{
812
std::uintptr_t localPlayer = memory.Read<std::uintptr_t>(globals::client + offsets::dwLocalPlayerPawn);
9-
if (localPlayer) {
13+
14+
if (localPlayer)
15+
{
1016
float flashDuration = memory.Read<float>(localPlayer + offsets::flFlashDuration);
11-
if (flashDuration > 0.0f) {
17+
if (flashDuration > 0.0f)
1218
memory.Write<float>(localPlayer + offsets::flFlashDuration, 0.0f);
13-
}
1419
}
1520
}
1621
}
22+
1723
}

TempleWare-External/source/features/noflash.h

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,12 @@
22

33
#include "../memory/Memory.h"
44

5-
namespace features {
6-
class NoFlash {
5+
namespace features
6+
{
7+
class NoFlash
8+
{
79
public:
810
static void Run(const Memory& memory) noexcept;
11+
912
};
1013
}

TempleWare-External/source/features/triggerbot.cpp

Lines changed: 28 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -4,29 +4,36 @@
44
#include <thread>
55
#include <Windows.h>
66

7-
namespace features {
7+
namespace features
8+
{
89
void TriggerBot::Run(const Memory& memory) noexcept {
9-
while (globals::isRunning) {
10-
if (!globals::TriggerBot) {
10+
while (globals::isRunning)
11+
{
12+
if (!globals::TriggerBot)
13+
{
1114
std::this_thread::sleep_for(std::chrono::milliseconds(20));
1215
continue;
1316
}
1417

15-
bool keyState = GetAsyncKeyState(globals::TriggerBotKey) & 0x8000;
16-
17-
if (globals::TriggerBotMode == 0) {
18-
if (!keyState) {
18+
bool keyDown = (GetAsyncKeyState(globals::TriggerBotKey) & 0x8000) != 0;
19+
if (globals::TriggerBotMode == 0)
20+
{
21+
if (!keyDown)
22+
{
1923
std::this_thread::sleep_for(std::chrono::milliseconds(10));
2024
continue;
2125
}
2226
}
23-
else if (globals::TriggerBotMode == 1) {
24-
if (keyState) {
27+
else if (globals::TriggerBotMode == 1)
28+
{
29+
if (keyDown)
30+
{
2531
globals::TriggerBotToggled = !globals::TriggerBotToggled;
2632
std::this_thread::sleep_for(std::chrono::milliseconds(200));
2733
}
2834

29-
if (!globals::TriggerBotToggled) {
35+
if (!globals::TriggerBotToggled)
36+
{
3037
std::this_thread::sleep_for(std::chrono::milliseconds(10));
3138
continue;
3239
}
@@ -35,7 +42,8 @@ namespace features {
3542
std::uintptr_t localPlayer = memory.Read<std::uintptr_t>(globals::client + offsets::dwLocalPlayerPawn);
3643
BYTE team = memory.Read<BYTE>(localPlayer + offsets::m_iTeamNum);
3744

38-
if (!globals::TriggerBotIgnoreFlash) {
45+
if (!globals::TriggerBotIgnoreFlash)
46+
{
3947
float flashDuration = memory.Read<float>(localPlayer + offsets::flFlashDuration);
4048
if (flashDuration > 0.0f) {
4149
std::this_thread::sleep_for(std::chrono::milliseconds(10));
@@ -44,32 +52,25 @@ namespace features {
4452
}
4553

4654
int crosshairEntityIndex = memory.Read<int>(localPlayer + offsets::m_iIDEntIndex);
47-
if (crosshairEntityIndex == 0) {
55+
if (crosshairEntityIndex == 0)
4856
continue;
49-
}
5057

5158
std::uintptr_t entityList = memory.Read<std::uintptr_t>(globals::client + offsets::dwEntityList);
52-
std::uintptr_t listEntry = memory.Read<std::uintptr_t>(entityList + 0x8 * (crosshairEntityIndex >> 9) + 0x10);
53-
std::uintptr_t entity = memory.Read<std::uintptr_t>(listEntry + 120 * (crosshairEntityIndex & 0x1ff));
54-
55-
if (!entity) {
59+
std::uintptr_t entity = memory.Read<std::uintptr_t>(memory.Read<std::uintptr_t>(entityList + 0x8 * (crosshairEntityIndex >> 9) + 0x10) + 120 * (crosshairEntityIndex & 0x1ff));
60+
if (!entity)
5661
continue;
57-
}
5862

59-
if (globals::TriggerBotTeamCheck && team == memory.Read<BYTE>(entity + offsets::m_iTeamNum)) {
63+
// Skip teammate or dead target (optional)
64+
if (globals::TriggerBotTeamCheck && team == memory.Read<BYTE>(entity + offsets::m_iTeamNum))
6065
continue;
61-
}
6266

63-
if (memory.Read<int>(entity + offsets::m_iHealth) <= 0) {
67+
if (memory.Read<int>(entity + offsets::m_iHealth) <= 0)
6468
continue;
65-
}
66-
67-
memory.Write<int>(globals::client + offsets::attack, 65537);
6869

70+
// Simulate shooting
71+
memory.Write<int>(globals::client + offsets::attack, 65537); // Set attack command
6972
std::this_thread::sleep_for(std::chrono::milliseconds(globals::TriggerBotDelay));
70-
71-
memory.Write<int>(globals::client + offsets::attack, 256);
72-
73+
memory.Write<int>(globals::client + offsets::attack, 256); // Clear attack command
7374
std::this_thread::sleep_for(std::chrono::milliseconds(globals::TriggerBotDelay));
7475
}
7576
}

TempleWare-External/source/features/triggerbot.h

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,12 @@
22

33
#include "../memory/Memory.h"
44

5-
namespace features {
6-
class TriggerBot {
5+
namespace features
6+
{
7+
class TriggerBot
8+
{
79
public:
810
static void Run(const Memory& memory) noexcept;
11+
912
};
1013
}

TempleWare-External/source/globals/globals.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@
66

77
#include "../../external/imgui/imgui.h"
88

9-
namespace globals {
9+
namespace globals
10+
{
1011

1112
// TriggerBot
1213
inline bool TriggerBot = false;

0 commit comments

Comments
 (0)