This repository was archived by the owner on Nov 5, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 38
Expand file tree
/
Copy pathTriggerBot.cpp
More file actions
57 lines (52 loc) · 2.04 KB
/
Copy pathTriggerBot.cpp
File metadata and controls
57 lines (52 loc) · 2.04 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
#pragma once
struct TriggerBot {
ConfigLoader* cl;
XDisplay* display;
Level* level;
LocalPlayer* localPlayer;
std::vector<Player*>* players;
const float TB_MAX_RANGE_ZOOMED = util::metersToGameUnits(150);
const float TB_MAX_RANGE_HIPFRE = util::metersToGameUnits(10);
TriggerBot(ConfigLoader* cl, XDisplay* display, Level* level, LocalPlayer* localPlayer, std::vector<Player*>* players) {
this->cl = cl;
this->display = display;
this->level = level;
this->localPlayer = localPlayer;
this->players = players;
}
void shootAtEnemy() {
if (!cl->FEATURE_TRIGGERBOT_ON) return;
if (!localPlayer->isCombatReady()) return;
//only these weapons will work with trigger bot
int weaponId = localPlayer->weaponIndex;
// printf("Last weapon held: %s id: %d \n", WeaponName(weaponId).c_str(), weaponId);
if (
weaponId != WEAPON_KRABER &&
weaponId != WEAPON_P2020 &&
weaponId != WEAPON_MOZAMBIQUE &&
weaponId != WEAPON_EVA8 &&
weaponId != WEAPON_PEACEKEEPER &&
weaponId != WEAPON_MASTIFF &&
weaponId != WEAPON_WINGMAN &&
weaponId != WEAPON_LONGBOW &&
weaponId != WEAPON_SENTINEL &&
weaponId != WEAPON_G7 &&
weaponId != WEAPON_HEMLOCK &&
weaponId != WEAPON_3030 &&
weaponId != WEAPON_TRIPLE_TAKE &&
weaponId != WEAPON_NEMESIS
)return;
//max range changes based on if we are zoomed in or not
const float RANGE_MAX = (localPlayer->inZoom) ? TB_MAX_RANGE_ZOOMED : TB_MAX_RANGE_HIPFRE;
for (int i = 0; i < players->size(); i++) {
Player* player = players->at(i);
if (!player->isCombatReady()) continue;
if (!player->enemy) continue;
if (!player->aimedAt) continue;
if (player->distanceToLocalPlayer < RANGE_MAX) {
display->mouseClickLeft();
break;
}
}
}
};