forked from arturzxc/myapex
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Sense.cpp
90 lines (85 loc) · 2.3 KB
/
Sense.cpp
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
#pragma once
#include <vector>
#include "LocalPlayer.cpp"
#include "Player.cpp"
#include "Math.cpp"
#include "Level.cpp"
#include "X11Utils.cpp"
#include "ConfigLoader.cpp"
class Sense
{
private:
ConfigLoader *m_configLoader;
Level *m_level;
LocalPlayer *m_localPlayer;
std::vector<Player *> *m_players;
X11Utils *m_x11Utils;
public:
Sense(ConfigLoader *configLoader,
Level *level,
LocalPlayer *localPlayer,
std::vector<Player *> *players,
X11Utils *x11Utils)
{
m_configLoader = configLoader;
m_level = level;
m_localPlayer = localPlayer;
m_players = players;
m_x11Utils = x11Utils;
}
void update()
{
if (!m_level->isPlayable())
return;
for (int i = 0; i < m_players->size(); i++)
{
Player *player = m_players->at(i);
if (!player->isValid())
continue;
if (player->getTeamNumber() == m_localPlayer->getTeamNumber())
continue;
if (player->isVisible())
{
player->setGlowEnable(1);
player->setGlowThroughWall(1);
player->setGlowColorRed(0);
player->setGlowColorGreen(3);
player->setGlowColorBlue(0);
}
else
{
const int enemyShields = player->getShieldsValue();
int r, g, b;
if (enemyShields >= 120)
{
r = 3;
g = 0;
b = 0;
}
else if (enemyShields >= 100)
{
r = 1.5;
g = 0;
b = 1.5;
}
else if (enemyShields >= 75)
{
r = 0;
g = 1;
b = 2;
}
else
{
r = 1;
g = 1;
b = 1;
}
player->setGlowEnable(1);
player->setGlowThroughWall(1);
player->setGlowColorRed(r);
player->setGlowColorGreen(g);
player->setGlowColorBlue(b);
}
}
}
};