This repository was archived by the owner on Jun 15, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 16
Expand file tree
/
Copy pathmain.cpp
More file actions
2329 lines (1958 loc) · 90.3 KB
/
main.cpp
File metadata and controls
2329 lines (1958 loc) · 90.3 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
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
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
#include <iostream>
#include <thread>
#include <string>
#include "overlay/overlay.h"
#include "mem.hpp"
#include "game_structures.hpp"
#include "util.hpp"
#include "config.h"
#include "menu.h"
#include "radar.h"
#include "globals.h"
#include "ItemProperties.h"
#include <cmath>
#include <iomanip>
#include <sstream>
#include <fstream>
#include <unordered_map>
#include "data_cache.h"
#include <algorithm>
#include <limits>
#include "game_math.hpp"
#include "game_function.hpp"
#include <unordered_set>
#include <algorithm>
#include <set>
#include <Windows.h>
using namespace menu;
using namespace radar;
using namespace config;
using namespace globals;
using namespace protocol::engine::sdk;
using namespace protocol::game::sdk;
using namespace protocol::engine;
std::unordered_map<std::string, ItemProperties> itemData;
static int current_target_index = 0;
void InitializeItems() {
std::cout << "Initializing item data..." << std::endl;
itemData["KNIFE"] = ItemProperties(0.1, 0.4, 0.4, 82, 14);
itemData["PACKAGE"] = ItemProperties(0.3, 1, -1, 180, 40);
itemData["GAZ BOTTLE"] = ItemProperties(0.3, 1, -1, 180, 40);
itemData["FUSE"] = ItemProperties(0.2, 0.7, -0.8, 130, 20);
itemData["EGG"] = ItemProperties(0.2, 0.7, -0.8, 82, 14);
itemData["EASTEREGG"] = ItemProperties(0.2, 0.7, -0.8, 82, 14);
itemData["SCREW DRIVER"] = ItemProperties(0.1, 0.4, 0.1, 130, 15);
itemData["CASSETTE"] = ItemProperties(0.2, 0.7, -0.8, 130, 20);
itemData["BATTERY"] = ItemProperties(0.2, 0.7, -0.8, 130, 20);
itemData["VENT FILTER"] = ItemProperties(0.3, 1, -1, 180, 40);
itemData["DEFIBRILLATOR"] = ItemProperties(0.3, 1, -1, 180, 40);
itemData["REZ"] = ItemProperties(0.3, 1, -1, 180, 40);
itemData["FISH"] = ItemProperties(0.2, 0.7, 1, 130, 20);
itemData["RICE"] = ItemProperties(0.3, 1, -1, 180, 40);
itemData["CONTAINER"] = ItemProperties(0.2, 0.7, -0.8, 130, 20);
itemData["C4"] = ItemProperties(0.2, 0.7, -0.8, 130, 20);
itemData["NAME"] = ItemProperties(0.3, 1, -1, 180, 40); // Pizzushi
itemData["PIZZUSHI"] = ItemProperties(0.3, 1, -1, 180, 40); // Pizzushi
itemData["SAMPLE"] = ItemProperties(0.2, 0.7, -0.8, 130, 20);
itemData["MACHINE PART"] = ItemProperties(0.20, 0.70, -0.80, 82, 14);
itemData["ACCESS CARD"] = ItemProperties(0.20, 0.70, -0.80, 82, 14);
itemData["PISTOL"] = ItemProperties(false, 0.1, 5, 1, 30, 0.8, 1.5, 0.3, 40, 0.5, 4, 1, 0.8);
itemData["SHORTY"] = ItemProperties(false, 0.3, 5, 5, 10, 1, 2.5, 0.3, 20, 30, 0.6, 40, 0.5);
itemData["REVOLVER"] = ItemProperties(false, 0.25, 25, 4, 15, 0.8, 2, 0.4, 20, 0.5, 6, 3, 0.5);
itemData["SHOTGUN"] = ItemProperties(true, 0.2, 5, 3, 100, 0.3, 0.8, 0.1, 20, 2, 1, 5, 0.25);
itemData["RIFLE"] = ItemProperties(true, 0.12, 25, 2, 10, 2, 2.5, 0.1, 10, 1, 7, 3, 0.7);
itemData["SMG"] = ItemProperties(true, 0.07, 10, 0.5, 50, 0.6, 1.2, 0.2, 50, 1, 4, 1.5, 0.75);
}
ItemProperties GetItemProperties(const std::string& itemName) {
if (itemData.find(itemName) != itemData.end()) {
return itemData[itemName];
}
return ItemProperties{};
}
double CalculateDistanceMeters(const vector3& location1, const vector3& location2) {
double dx = location1.x - location2.x;
double dy = location1.y - location2.y;
double dz = location1.z - location2.z;
return std::sqrt(dx * dx + dy * dy + dz * dz) / 100.0;
}
void initialize_process_event() {
uintptr_t process_event_address = mem::module_base + protocol::engine::PROCESSEVENT;
globals::process_event = reinterpret_cast<tProcessEvent>(process_event_address);
if (globals::process_event) {
std::cout << "'ProcessEvent' successfully initialized at: " << std::hex << process_event_address << std::endl;
}
else {
std::cerr << "Failed to initialize 'ProcessEvent'!" << std::endl;
}
}
// Function to simulate a mouse click
void simulate_mouse_click() {
Sleep(5); // Optional: Slight delay before starting (shortened)
mouse_event(MOUSEEVENTF_RIGHTDOWN, 0, 0, 0, 0); // Hold right click
Sleep(30); // Reduced delay to simulate holding right-click
mouse_event(MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0); // Press left click
Sleep(30); // Reduced delay to ensure the press registers
mouse_event(MOUSEEVENTF_LEFTUP, 0, 0, 0, 0); // Release left click
Sleep(30); // Shortened delay to ensure action completes
mouse_event(MOUSEEVENTF_RIGHTUP, 0, 0, 0, 0); // Release right click
}
std::wstring ConvertToWideString(const std::string& input) {
if (input.empty()) {
return L"";
}
int size_needed = MultiByteToWideChar(CP_UTF8, 0, input.c_str(), (int)input.size(), NULL, 0);
std::wstring wide_string(size_needed, 0);
MultiByteToWideChar(CP_UTF8, 0, input.c_str(), (int)input.size(), &wide_string[0], size_needed);
return wide_string;
}
std::string ConvertToUTF8String(const std::wstring& input) {
if (input.empty()) {
return "";
}
int size_needed = WideCharToMultiByte(CP_UTF8, 0, input.c_str(), (int)input.size(), NULL, 0, NULL, NULL);
std::string utf8_string(size_needed, 0);
WideCharToMultiByte(CP_UTF8, 0, input.c_str(), (int)input.size(), &utf8_string[0], size_needed, NULL, NULL);
return utf8_string;
}
auto calculate_text_width = [](const std::string& text) -> size_t {
return text.length() * static_cast<size_t>(5); // Adjust 7 to the average pixel width of font
};
std::string CalculateDistance(const FVector& location1, const vector3& location2) {
// Calculate the difference in coordinates
double dx = location1.X - location2.x;
double dy = location1.Y - location2.y;
double dz = location1.Z - location2.z;
// Calculate the distance and divide by 100.0 to get distance in meters (assuming 100 units per meter)
double distance = std::sqrt(dx * dx + dy * dy + dz * dz) / 100.0;
std::ostringstream stream;
stream << std::fixed << std::setprecision(2) << distance;
return stream.str();
}
// Function to convert FVector to vector3
vector3 ConvertFVectorToVector3(const FVector& fvec) {
return vector3{ static_cast<float>(fvec.X), static_cast<float>(fvec.Y), static_cast<float>(fvec.Z) };
}
// Example CalculateDistance function (returns a float)
float CalculateDistanceFloat(const vector3& player_pos, const vector3& enemy_pos) {
return static_cast<float>(sqrt(
pow(enemy_pos.x - player_pos.x, 2.0) +
pow(enemy_pos.y - player_pos.y, 2.0) +
pow(enemy_pos.z - player_pos.z, 2.0)
));
}
std::string TranslateRoomName(int roomNum) {
switch (roomNum) {
case 111: return "Office 1";
case 112: return "Office 2";
case 123: return "Office 3";
case 124: return "Office 4";
case 125: return "Office 5";
case 211: return "Botanic";
case 141: return "Restaurant";
case 311: return "Medical";
case 511: return "Machine";
case 131: return "Security";
case 411: return "Storage";
default: return "Unknown";
}
}
double ExtractMeaningfulValue(double largeValue) {
std::ostringstream oss;
oss << std::scientific << largeValue; // Convert to string in scientific notation
std::string valueAsString = oss.str();
size_t eIndex = valueAsString.find("e-");
if (eIndex != std::string::npos) {
// Extract the exponent part after "e-"
std::string exponentPart = valueAsString.substr(eIndex + 2); // Skip "e-"
int exponent = std::stoi(exponentPart); // Convert to an integer
// Compute the meaningful value (e.g., exponent % 360 for rotation logic)
return static_cast<float>(exponent % 360);
}
return largeValue; // If no "e-" is found, return the original value
}
// Function to calculate angular distance
float CalculateAngularDistance(float target_pitch, float target_yaw, float camera_pitch, float camera_yaw) {
// Calculate pitch difference and normalize it
float pitch_diff = target_pitch - camera_pitch;
if (pitch_diff > 180.0f) pitch_diff -= 360.0f;
if (pitch_diff < -180.0f) pitch_diff += 360.0f;
// Calculate yaw difference and normalize it
float yaw_diff = target_yaw - camera_yaw;
if (yaw_diff > 180.0f) yaw_diff -= 360.0f;
if (yaw_diff < -180.0f) yaw_diff += 360.0f;
// Return the combined angular difference (simple Euclidean distance)
return sqrtf(pitch_diff * pitch_diff + yaw_diff * yaw_diff);
}
// Function to check if the target has been focused for the required time
bool IsTargetFocused(float focus_time, float required_time) {
return focus_time >= required_time;
}
static void cache_useful() {
bool items_populated = false; // Flag to track if items have been populated once
while (true) {
std::this_thread::sleep_for(std::chrono::milliseconds(50));
gworld = u_world::get_world(mem::module_base);
if (!gworld) continue;
game_state = gworld->get_game_state();
if (!game_state) continue;
owning_instance = gworld->get_owning_game_instance();
if (!owning_instance) continue;
local_player = owning_instance->get_localplayer();
if (!local_player) continue;
local_controller = local_player->get_player_controller();
if (!local_controller) continue;
gm_ref = local_controller->get_gm_ref();
local_camera_manager = local_controller->get_camera_manager();
if (!local_camera_manager) continue;
local_mec = (mec_pawn*)local_controller->get_pawn();
if (!local_mec) continue;
std::vector < mec_pawn* > temp_player_cache{};
std::vector < world_item* > temp_world_item_cache{};
std::vector < task_vents* > temp_task_vents_cache{};
std::vector < task_machines* > temp_task_machines_cache{};
std::vector < task_alimentations* > temp_task_alims_cache{};
std::vector < task_deliveries* > temp_task_delivery_cache{};
std::vector < task_pizzushis* > temp_task_pizzushi_cache{};
std::vector < task_data* > temp_task_data_cache{};
std::vector < task_scanner* > temp_task_scanner_cache{};
std::vector < a_alarm_button_c* > temp_alarm_button_cache{};
std::vector < a_rez_charger_c* > temp_rez_charger_cache{};
std::vector < a_weapon_case_code_c* > temp_weapon_case_cache{};
int current_target_index = 0;
float expanding_radius = 0.0f;
std::vector<FStr_ScannerDot> scanner_targets;
// hack detector
local_mec->set_net_emote_primary(false);
auto levels = gworld->get_levels();
for (auto level : levels.list()) {
auto actors = level->get_actors();
for (auto actor : actors.list()) {
auto class_name = util::get_name_from_fname(actor->class_private()->fname_index());
auto name = util::get_name_from_fname(actor->outer()->fname_index());
if (class_name.find("WorldItem_C") != std::string::npos) {
auto item = static_cast<world_item*>(actor);
auto item_data = item->get_data();
auto item_name = item_data->get_name().read_string();
temp_world_item_cache.push_back((world_item*)actor);
}
if (class_name.find("Task_Vents_C") != std::string::npos) {
temp_task_vents_cache.push_back((task_vents*)actor);
}
if (class_name.find("Task_Machine_C") != std::string::npos) {
temp_task_machines_cache.push_back((task_machines*)actor);
}
if (class_name.find("Task_Alim_C") != std::string::npos) {
temp_task_alims_cache.push_back((task_alimentations*)actor);
}
if (class_name.find("Task_DelivryIn_C") != std::string::npos) {
temp_task_delivery_cache.push_back((task_deliveries*)actor);
}
if (class_name.find("Task_Pizzushi_C") != std::string::npos) {
temp_task_pizzushi_cache.push_back((task_pizzushis*)actor);
}
if (class_name.find("Task_Data_C") != std::string::npos) {
temp_task_data_cache.push_back((task_data*)actor);
}
if (class_name.find("Task_Scanner_C") != std::string::npos) {
temp_task_scanner_cache.push_back((task_scanner*)actor);
}
if (class_name.find("AlarmButton_C") != std::string::npos) {
temp_alarm_button_cache.push_back((a_alarm_button_c*)actor);
}
if (class_name.find("RezCharger_C") != std::string::npos) {
temp_rez_charger_cache.push_back((a_rez_charger_c*)actor);
}
if (class_name.find("Mec_C") != std::string::npos) {
temp_player_cache.push_back((mec_pawn*)actor);
}
if (class_name.find("WeaponCaseCode_C") != std::string::npos) {
temp_weapon_case_cache.push_back((a_weapon_case_code_c*)actor);
}
}
}
player_cache = temp_player_cache;
world_item_cache = temp_world_item_cache;
task_vents_cache = temp_task_vents_cache;
task_machines_cache = temp_task_machines_cache;
task_alims_cache = temp_task_alims_cache;
task_delivery_cache = temp_task_delivery_cache;
task_pizzushi_cache = temp_task_pizzushi_cache;
task_data_cache = temp_task_data_cache;
task_scanner_cache = temp_task_scanner_cache;
alarm_button_cache = temp_alarm_button_cache;
rez_charger_cache = temp_rez_charger_cache;
weapon_case_cache = temp_weapon_case_cache;
// Call PopulateUniqueItems only once after items are populated
if (!items_populated && !temp_world_item_cache.empty()) {
menu::PopulateUniqueItems(inserted_names);
items_populated = true; // Ensure this only happens once
}
}
}
inline void StartRainbowSuitThread() {
/*
static bool thread_started = false;
if (thread_started) return;
thread_started = true;
std::thread([] {
int color = 1;
while (true) {
if (rainbowsuit && local_mec && gm_ref) {
// Step 1: Set the suit color (skin)
auto skin_set = globals::local_mec->get_skin_set();
skin_set.Color_8 = color;
// Step 2: Set the global player color in gm_ref
auto color_array = gm_ref->get_player_colors_app();
bool updated = false;
for (int i = 0; i < color_array.count; ++i) {
auto entry = color_array.at(i);
if (entry.Mec_5 == globals::local_mec) {
entry.Color_2 = color;
color_array.set(i, entry);
updated = true;
break;
}
}
// Log
static const char* color_names[] = {
"Unknown", "Red", "Orange", "Yellow", "Green",
"Cyan", "Blue", "Purple", "Pink", "White"
};
std::cout << "[RainbowSuit] Color set to: " << color_names[color] << "\n";
color = (color + 1) % 10;
}
std::this_thread::sleep_for(std::chrono::milliseconds(rainbow_speed));
}
}).detach();
*/
}
static void render_callback() {
std::this_thread::sleep_for(std::chrono::milliseconds(1));
menu::draw();
radar::draw();
f_camera_cache last_frame_cached = local_camera_manager->get_cached_frame_private();
auto players = game_state->player_array();
if (GetAsyncKeyState(esp_hotkey) & 1) {
esp_enabled = !esp_enabled;
player_esp = esp_enabled;
weapon_esp = esp_enabled;
task_object_esp = esp_enabled;
primary_object_esp = esp_enabled;
secondary_object_esp = esp_enabled;
esp_radar = esp_enabled;
weapon_case_esp = esp_enabled;
//std::cout << "Fire Spread:" << local_mec->get_fire_spread() << std::endl;
}
if (GetAsyncKeyState(speedhack_hotkey) & 1) {
speedhack = !speedhack;
}
if (GetAsyncKeyState(god_mode_hotkey) & 1) {
god_mode = !god_mode;
}
if (GetAsyncKeyState(infinite_stamina_hotkey) & 1) {
infinite_stamina = !infinite_stamina;
}
if (GetAsyncKeyState(fast_melee_hotkey) & 1) {
fast_melee = !fast_melee;
}
if (GetAsyncKeyState(infinite_melee_range_hotkey) & 1) {
infinite_melee_range = !infinite_melee_range;
}
if (GetAsyncKeyState(auto_fire_hotkey) & 1) {
auto_fire = !auto_fire;
}
if (GetAsyncKeyState(rapid_fire_hotkey) & 1) {
rapid_fire = !rapid_fire;
}
if (GetAsyncKeyState(aimbot_hotkey) & 1) {
aimbot = !aimbot;
}
if (fly_mode) {
local_mec->set_fly_stamina(1.0);
}
// Check for Ctrl+P key press (using GetAsyncKeyState)
if ((GetAsyncKeyState(VK_LCONTROL) & 0x8000) && (GetAsyncKeyState('P') & 0x8000)) {
item_puke = !item_puke; // Toggle the bool
// Add a small delay to prevent rapid toggling
Sleep(200); // 200 milliseconds delay
}
if (item_puke) {
simulate_mouse_click();
Sleep(50); // Small delay between clicks (adjust as needed)
}
auto hand_item = local_mec->get_hand_item();
auto melee_item_data = (u_data_melee*)hand_item;
auto gun_item_data = (u_data_gun*)hand_item;
if (isDebugging) {
if (hand_item) {
auto mtype = melee_item_data->get_melee_type();
if (mtype) {
double castTime = mtype->get_cast_time(); // 0x0058
double recoverTime = mtype->get_recover_time(); // 0x0060
double stun = mtype->get_stun(); // 0x0038
int cost = static_cast<int>(mtype->get_cost()); // 0x0050
int range = static_cast<int>(mtype->get_range()); // 0x0068
std::cout << std::fixed << std::setprecision(2)
<< "itemData[\"" << hand_item->get_name().read_string() << "\"] = "
<< "ItemProperties(" << castTime << ", "
<< recoverTime << ", "
<< stun << ", "
<< range << ", "
<< cost << ");" << std::endl;
}
/*
auto gun_data = (u_data_gun*)hand_item;
bool auto_fire = gun_data->get_auto_fire();
double fire_rate = gun_data->get_fire_rate();
int damage = gun_data->get_damage();
double shake = gun_data->get_shake_intensity();
double oscill = gun_data->get_oscillation_reactivity();
double walk_osc = gun_data->get_walk_oscillation();
double run_osc = gun_data->get_run_oscillation();
double stand_osc = gun_data->get_stand_oscillation();
double recoil = gun_data->get_recoil_reactivity();
double walk_prec = gun_data->get_walk_precision();
double air_prec = gun_data->get_air_precision();
double run_prec = gun_data->get_run_precision();
double stun = gun_data->get_stun();
std::cout << "itemData[\"" << hand_item->get_name().read_string() << "\"] = ItemProperties("
<< (auto_fire ? "true" : "false") << ", "
<< fire_rate << ", "
<< damage << ", "
<< shake << ", "
<< oscill << ", "
<< walk_osc << ", "
<< run_osc << ", "
<< stand_osc << ", "
<< recoil << ", "
<< walk_prec << ", "
<< air_prec << ", "
<< run_prec << ", "
<< stun << ");" << std::endl;
*/
/*
// Format and output the string to the console
std::cout << "itemData[\"" << hand_item->get_name().read_string() << "\"] = "
<< "ItemProperties: DMG:" << gun_item_data->get_damage() << ", "
<< "Crit: " << gun_item_data->get_crit() << ", "
<< "Stam_DMG: " << gun_item_data->get_stamina_damage() << ", "
<< "Crit_Stam: " << gun_item_data->get_crit_stamina() << ", "
<< "Impact_Type: " << gun_item_data->get_impact_type() << ", "
<< "Capacity: " << gun_item_data->get_capacity() << ", "
<< "Stun: " << gun_item_data->get_stun() << ", "
<< "Stam_Useage: " << gun_item_data->get_stamina_usage() << ", "
<< "Fire_Rate: " << gun_item_data->get_fire_rate() << ");" << std::endl;
*/
}
for (auto mec : player_cache) {
auto state = mec->player_state();
if (!state) continue;
auto name_str = state->get_player_name_private().read_string();
auto player_id = state->get_player_id();
std::cout << "[Lobby] Player: " << name_str << " | Player ID: " << player_id << std::endl;
}
}
if (aimbot) {
// Draw FOV circle
int screen_width = GetSystemMetrics(SM_CXSCREEN);
int screen_height = GetSystemMetrics(SM_CYSCREEN);
ImVec2 screen_center = ImVec2(screen_width / 2.0f, screen_height / 2.0f);
// Convert ImVec4 to IM_COL32 for the circle
ImU32 circle_color = ImGui::ColorConvertFloat4ToU32(fov_color);
overlay->draw_circle(screen_center, aimbot_fov, circle_color, 64, 1.5f);
}
if (aimbot && GetAsyncKeyState(aimbot_hold_key) & 0x8000) {
// Retrieve cached frame for camera details
f_camera_cache last_frame_cached = local_camera_manager->get_cached_frame_private();
vector3 camera_location = last_frame_cached.pov.location; // Camera position
vector3 camera_rotation = last_frame_cached.pov.rotation; // Camera rotation
// Retrieve local player position
auto player_position_fvector = local_mec->get_net_location();
auto player_position = ConvertFVectorToVector3(player_position_fvector);
mec_pawn* best_target = nullptr;
float best_value = 999999.0f; // Closest distance or smallest screen offset
vector3 best_target_screen_position;
// Screen dimensions and center
int screen_width = GetSystemMetrics(SM_CXSCREEN);
int screen_height = GetSystemMetrics(SM_CYSCREEN);
vector2 screen_center = { screen_width / 2.0f, screen_height / 2.0f };
// Iterate through all cached players to find the best target
for (auto mec : player_cache) {
auto state = mec->player_state();
if (!state) continue;
auto role = mec->get_player_role();
// Apply target filter
if (target_filter == "Employees" && role != 3) continue;
if (target_filter == "Dissidents" && role != 4) continue;
if (mec != local_mec) {
// Check if the player is dead
auto ghost_root = mec->get_ghost_root();
if (!ghost_root) continue;
auto ghost_position = ghost_root->get_relative_location();
auto current_position = mec->get_root_component()->get_relative_location();
double ghost_distance = CalculateDistanceMeters(current_position, ghost_position);
if (ghost_distance > 2) continue; // Skip dead bodies
// Adjust for selected aim target
float aim_height_offset = (aim_target == "Neck") ? 145.0f : (aim_target == "Body") ? 125.0f : 165.0f;
vector3 target_position = current_position + vector3{ 0, 0, aim_height_offset };
vector3 screen_position{};
bool visible = util::w2s(target_position, last_frame_cached.pov, screen_position);
if (visible) {
// Calculate distances
float distance_to_player = CalculateDistanceFloat(player_position, target_position);
float screen_distance = static_cast<float>(sqrt(pow(screen_position.x - screen_center.x, 2.0) +
pow(screen_position.y - screen_center.y, 2.0)));
// Skip targets outside FOV
if (screen_distance > aimbot_fov) continue;
if (target_closest) {
// Prioritize closest to the player
if (distance_to_player < best_value) {
best_value = distance_to_player;
best_target = mec;
best_target_screen_position = screen_position;
}
}
else {
// Prioritize closest to the center of the screen
if (screen_distance < best_value) {
best_value = screen_distance;
best_target = mec;
best_target_screen_position = screen_position;
}
}
}
}
}
// Smoothly move the cursor to the best target
if (best_target) {
int target_x = static_cast<int>(best_target_screen_position.x);
int target_y = static_cast<int>(best_target_screen_position.y);
int center_x = static_cast<int>(screen_center.x);
int center_y = static_cast<int>(screen_center.y);
// Calculate relative movement offsets
float delta_x = static_cast<float>(target_x - center_x);
float delta_y = static_cast<float>(target_y - center_y);
// Apply smoothing
delta_x *= smooth_factor;
delta_y *= smooth_factor;
// Simulate mouse movement using SendInput
INPUT input = { 0 };
input.type = INPUT_MOUSE;
input.mi.dx = static_cast<LONG>(delta_x);
input.mi.dy = static_cast<LONG>(delta_y);
input.mi.dwFlags = MOUSEEVENTF_MOVE | MOUSEEVENTF_MOVE_NOCOALESCE;
// Send the input
SendInput(1, &input, sizeof(INPUT));
}
}
if (infinite_ammo) {
if (hand_item) {
auto item_name = hand_item->get_name().read_string();
if (item_name == "SHORTY" || item_name == "PISTOL" || item_name == "REVOLVER" || item_name == "SHOTGUN" || item_name == "RIFLE" || item_name == "SMG") {
auto hand_state = local_mec->get_hand_state();
hand_state.Value_8 = ammo_count;
local_mec->set_hand_state(hand_state);
}
else {
infinite_ammo = !infinite_ammo;
}
}
}
if (infinite_stamina) {
local_mec->set_stamina(1.);
}
if (anti_weapon_drop) {
// Retrieve the current stamina
double current_stamina = local_mec->get_stamina();
// Convert user-friendly threshold to actual stamina value
double adjusted_threshold = 100.0 - drop_threshold;
// If stamina is greater than or equal to the adjusted threshold and not already at 1.0
if (current_stamina >= adjusted_threshold && current_stamina != 1.0) {
local_mec->set_stamina(1.0);
}
}
if (god_mode) {
if (!local_mec->get_alive()) {
local_mec->set_alive(true);
}
local_mec->set_health(100);
}
if (rainbowsuit) {
std::thread rainbowsuit_thread(StartRainbowSuitThread);
rainbowsuit_thread.detach();
}
if (collisions_toggle) {
}
// Track the last tick time for incremental healing
static auto last_hp_tick = std::chrono::steady_clock::now();
static auto last_stam_tick = std::chrono::steady_clock::now();
if (fast_hp_recovery || fast_stam_recovery) {
// Get the current time
auto current_time = std::chrono::steady_clock::now();
// Check for HP recovery
if (fast_hp_recovery) {
// Calculate the time difference in milliseconds
auto elapsed_hp_time = std::chrono::duration_cast<std::chrono::milliseconds>(current_time - last_hp_tick).count();
// Check if the recovery rate has passed
if (elapsed_hp_time >= hp_recovery_rate) {
// Get current health
int current_health = local_mec->get_health();
// Increment health if it's less than 100
if (current_health < 100) {
local_mec->set_health(current_health + 1); // Increase health by 1
}
// Update the last HP tick time
last_hp_tick = current_time;
}
}
// Check for Stamina recovery
if (fast_stam_recovery) {
// Calculate the time difference in milliseconds
auto elapsed_stam_time = std::chrono::duration_cast<std::chrono::milliseconds>(current_time - last_stam_tick).count();
// Check if the recovery rate has passed
if (elapsed_stam_time >= stam_recovery_rate) {
// Get current stamina
double current_stamina = local_mec->get_stamina();
// Decrement stamina if it's greater than 1.0
if (current_stamina > 1.0) {
local_mec->set_stamina(current_stamina - 1.0); // Decrease stamina by 1.0
}
// Update the last Stamina tick time
last_stam_tick = current_time;
}
}
}
if (player_fov != 103) {
local_mec->get_camera()->set_field_of_view(static_cast<float>(player_fov));
}
//static double fric = local_mec->get_friction();
//std::cout << *reinterpret_cast<std::uint64_t*>(&fric);
if (speedhack) {
local_mec->set_acceleration(vector2(9999.0, 9999.0));
local_mec->set_max_speed(max_speed);
local_mec->set_friction(friction);
}
else {
local_mec->set_acceleration(vector2(100.0, 100.0));
local_mec->set_max_speed(800.0);
local_mec->set_friction(0);
}
if (lock_hand_item) {
// Check if the hand item is empty
if (!local_mec->get_hand_item()) {
if (locked_hand_item) {
// Restore the locked hand item and state
local_mec->set_hand_item(locked_hand_item);
local_mec->set_hand_state(locked_hand_state);
}
}
}
if (lock_bag_item) {
// Check if the bag item is empty
if (!local_mec->get_bag_item()) {
if (locked_bag_item) {
// Restore the locked bag item and state
local_mec->set_bag_item(locked_bag_item);
local_mec->set_bag_state(locked_bag_state);
}
}
}
if (hand_item) {
if (fast_melee || infinite_melee_range || impact_change) {
if (util::get_name_from_fname(hand_item->class_private()->fname_index()).find("Data_Melee_C") != std::string::npos) {
auto mtype = melee_item_data->get_melee_type();
if (fast_melee) {
mtype->set_cast_time(cast_time);
mtype->set_recover_time(recover_time);
mtype->set_stun(stun);
mtype->set_cost(cost);
}
if (infinite_melee_range) {
mtype->set_range(range);
}
if (impact_change) {
mtype->set_stun(impact_change);
}
}
}
}
if (hand_item) {
if (!fast_melee) {
auto mtype = melee_item_data->get_melee_type();
std::string item_name = hand_item->get_name().read_string();
ItemProperties itemprops = GetItemProperties(item_name);
if (!fast_melee) {
mtype->set_cast_time(itemprops.melee_cast_time);
mtype->set_recover_time(itemprops.melee_recover_time);
mtype->set_stun(itemprops.melee_stun);
mtype->set_cost(itemprops.melee_cost);
}
}
if (!infinite_melee_range) {
auto mtype = melee_item_data->get_melee_type();
std::string item_name = hand_item->get_name().read_string();
ItemProperties itemprops = GetItemProperties(item_name);
if (!infinite_melee_range) {
mtype->set_range(itemprops.melee_range);
}
}
}
if (hand_item) {
if (auto_fire || rapid_fire || no_recoil || max_damage || impact_change) {
if (util::get_name_from_fname(hand_item->class_private()->fname_index()).find("Data_Gun_C") != std::string::npos) {
auto gun_data = (u_data_gun*)hand_item;
if (auto_fire) {
gun_data->set_auto_fire(true);
}
if (rapid_fire) {
gun_data->set_fire_rate(rapid_fire_rate);
}
if (no_recoil) {
local_mec->set_fire_spread(fire_spread);
gun_data->set_shake_intensity(shake_intensity);
gun_data->set_oscillation_reactivity(osc_reactivity);
gun_data->set_walk_oscillation(movement_osc);
gun_data->set_run_oscillation(movement_osc);
gun_data->set_stand_oscillation(movement_osc);
gun_data->set_recoil_reactivity(recoil_react);
gun_data->set_walk_precision(movement_prec);
gun_data->set_air_precision(movement_prec);
gun_data->set_run_precision(movement_prec);
}
if (max_damage) {
gun_data->set_damage(10000);
}
if (impact_change) {
gun_data->set_stun(impact_type);
}
}
}
}
if (hand_item) {
if (!auto_fire || !rapid_fire || !no_recoil || !max_damage) {
if (util::get_name_from_fname(hand_item->class_private()->fname_index()).find("Data_Gun_C") != std::string::npos) {
auto gun_data = (u_data_gun*)hand_item;
std::string item_name = hand_item->get_name().read_string();
ItemProperties itemprops = GetItemProperties(item_name);
if (!auto_fire) {
gun_data->set_auto_fire(itemprops.auto_fire);
}
if (!rapid_fire) {
gun_data->set_fire_rate(itemprops.fire_rate);
}
if (!no_recoil) {
gun_data->set_shake_intensity(itemprops.shake_intensity);
gun_data->set_oscillation_reactivity(itemprops.oscillation_reactivity);
gun_data->set_walk_oscillation(itemprops.walk_oscillation);
gun_data->set_run_oscillation(itemprops.run_oscillation);
gun_data->set_stand_oscillation(itemprops.stand_oscillation);
gun_data->set_recoil_reactivity(itemprops.recoil_reactivity);
gun_data->set_walk_precision(itemprops.walk_precision);
gun_data->set_air_precision(itemprops.air_precision);
gun_data->set_run_precision(itemprops.run_precision);
}
if (!max_damage) {
gun_data->set_damage(itemprops.damage);
}
if (!impact_change) {
gun_data->set_stun(itemprops.stun);
}
}
}
}
if (player_esp) {
for (auto mec : player_cache) {
auto state = mec->player_state();
if (!state) continue;
if (mec != local_mec) {
auto name_str = state->get_player_name_private().read_string();
std::wstring name_w = ConvertToWideString(name_str);
std::string name = ConvertToUTF8String(name_w);
//std::u8string name_u8 = ConvertToU8String(name_str);
//std::string name = convert_encoding(name_str, "WINDOWS-1251", "UTF-8");
//std::u8string name_u8 = u8"Женечка"; // Correctly creates a std::u8string
//std::string name(name_utf8.begin(), name_utf8.end()); // Convert to std::string for ImGui
auto role = mec->get_player_role();
auto fish_num = mec->get_wink_lock();
ImU32 color = (role == 4)
? ImGui::ColorConvertFloat4ToU32(dissident_color)
: ImGui::ColorConvertFloat4ToU32(employee_color);
ImU32 ghostcolor = (role == 4)
? ImGui::ColorConvertFloat4ToU32(ghost_dissident_color)
: ImGui::ColorConvertFloat4ToU32(ghost_employee_color);
// Temporary color with modified alpha
ImVec4 temp_color = (role == 4) ? dissident_color : employee_color;
temp_color.w = 0.05f; // 10% transparency
ImU32 color_with_alpha = ImGui::ColorConvertFloat4ToU32(temp_color);
// Temporary color with modified alpha
ImVec4 temp_ghostcolor = (role == 4) ? ghost_dissident_color : ghost_employee_color;
temp_ghostcolor.w = 0.05f; // 10% transparency
ImU32 color_with_alpha_ghost = ImGui::ColorConvertFloat4ToU32(temp_ghostcolor);
auto mec_root = mec->get_root_component();
if (!mec_root) continue;
auto ghost_root = mec->get_ghost_root();
if (!ghost_root) continue;
auto position = mec_root->get_relative_location(); // Player location (feet)
auto ghostPosition = ghost_root->get_relative_location(); // Ghost location (head/base)
// Calculate the distance between ghost and player
double ghost_distance = CalculateDistanceMeters(position, ghostPosition);
if (ghost_distance > 2) { // If ghost moved away from the body
if (player_ghost) {
if (player_box) {
vector3 screen_position_top, screen_position_bottom;
// Adjust for ghost height and feet position
bool top_visible = util::w2s(ghostPosition + vector3{ 0, 0, 20 }, last_frame_cached.pov, screen_position_top); // Adjust for head height
bool bottom_visible = util::w2s(ghostPosition, last_frame_cached.pov, screen_position_bottom); // Adjust for feet
if (top_visible && bottom_visible) {
float bottom_offset = 30.0f; // Ghost-specific bottom offset
screen_position_bottom.y += bottom_offset;
// Calculate box dimensions
float box_height = static_cast<float>(screen_position_bottom.y - screen_position_top.y);
float box_width = box_height * 1.0f; // Ghost-specific width-to-height ratio
ImVec2 box_pos1 = ImVec2(static_cast<float>(screen_position_top.x - box_width * 0.5), static_cast<float>(screen_position_top.y));
ImVec2 box_pos2 = ImVec2(static_cast<float>(screen_position_top.x + box_width * 0.5), static_cast<float>(screen_position_bottom.y));
// Define corner line properties
float corner_line_length = box_width * 0.25f; // Adjust for desired length
float corner_thickness = 2.0f; // Adjust for desired thickness
ImU32 corner_color = ghostcolor;
// Top-left corner lines
overlay->draw_rect_filled(box_pos1, ImVec2(box_pos1.x + corner_line_length, box_pos1.y + corner_thickness), corner_color);
overlay->draw_rect_filled(box_pos1, ImVec2(box_pos1.x + corner_thickness, box_pos1.y + corner_line_length), corner_color);
// Top-right corner lines
overlay->draw_rect_filled(ImVec2(box_pos2.x - corner_line_length, box_pos1.y), ImVec2(box_pos2.x, box_pos1.y + corner_thickness), corner_color);
overlay->draw_rect_filled(ImVec2(box_pos2.x - corner_thickness, box_pos1.y), ImVec2(box_pos2.x, box_pos1.y + corner_line_length), corner_color);
// Bottom-left corner lines
overlay->draw_rect_filled(ImVec2(box_pos1.x, box_pos2.y - corner_thickness), ImVec2(box_pos1.x + corner_line_length, box_pos2.y), corner_color);
overlay->draw_rect_filled(ImVec2(box_pos1.x, box_pos2.y - corner_line_length), ImVec2(box_pos1.x + corner_thickness, box_pos2.y), corner_color);
// Bottom-right corner lines
overlay->draw_rect_filled(ImVec2(box_pos2.x - corner_line_length, box_pos2.y - corner_thickness), box_pos2, corner_color);
overlay->draw_rect_filled(ImVec2(box_pos2.x - corner_thickness, box_pos2.y - corner_line_length), box_pos2, corner_color);
// Optional: Draw filled rectangle inside the box
ImU32 fill_color = color_with_alpha_ghost;
overlay->draw_rect_filled(
ImVec2(box_pos1.x, box_pos1.y),
ImVec2(box_pos2.x, box_pos2.y),
fill_color
);
}
}
vector3 ghost_screen_position{};
if (util::w2s(ghostPosition, last_frame_cached.pov, ghost_screen_position)) {
auto distance = CalculateDistance(local_mec->get_net_location(), ghostPosition);
// Render ghost name centered
std::string ghost_name = "[" + name + "]" + "[G]" + (player_distance ? "[" + distance + "m]" : "");
int ghost_text_width = static_cast<int>(ghost_name.length() * 5LLU); // Approx character width in pixels
ghost_screen_position.x -= ghost_text_width / 2;
overlay->draw_text(ghost_screen_position, ghostcolor, ghost_name.c_str(), true);
}
}
}
else { // Show player ESP if ghost is close
auto distance = CalculateDistance(local_mec->get_net_location(), position);
double distanceDouble = std::stod(distance);