This repository has been archived by the owner on Feb 14, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
PlayerHelper.h
82 lines (67 loc) · 1.6 KB
/
PlayerHelper.h
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
#pragma once
#include <memory.h>
#include <structs.h>
enum class DangerType {
NoDanger,
Scp173,
Scp096,
Combo173_096
};
namespace PlayerHelper {
/// <summary>
/// Not used until spinbot is fixed.
/// </summary>
/// <param name="out">: SCP-173 Instance if found</param>
/// <returns></returns>
DangerType GetDanger(Player &out) {
bool found173;
bool found096;
bool scp173visible;
bool scp096visible;
float scp173distance;
float scp096distance;
static Player scp173 = Player();
scp173.Reset();
out = Player();
for (auto player : entityList) {
auto role = (RoleType)player.team;
if (role == RoleType::Scp173)
{
found173 = true;
scp173 = player;
scp173visible = player.visible;
scp173distance = GetDistance(Local::position, player.position);
}
if (role == RoleType::Scp096)
{
found096 = true;
scp096visible = player.visible;
scp096distance = GetDistance(Local::position, player.position);
}
if (found096 && found173)
break;
}
if (found173 && found096)
{
float delta = abs(scp173distance - scp096distance);
if (delta < 10) {
if (scp173visible && scp096visible)
return DangerType::Combo173_096;
if (!scp096visible && !scp173visible)
return DangerType::NoDanger;
if (scp173visible)
return DangerType::Combo173_096;
if (scp096visible)
return DangerType::Scp096;
}
}
else {
if (found096 && scp096distance < 45)
return DangerType::Scp096;
if (found173 && scp173visible && scp173distance < 45)
return DangerType::Scp173;
}
out = scp173;
return DangerType::NoDanger;
}
}