-
Notifications
You must be signed in to change notification settings - Fork 0
/
data_classes.h
96 lines (85 loc) · 2.71 KB
/
data_classes.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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
#pragma once
#include <string>
#include <regex>
#include <type_traits>
#include <chrono>
using dseconds = std::chrono::duration<double>;
using dminutes = std::chrono::duration<double, std::ratio<60>>;
using dhours = std::chrono::duration<double, std::ratio<3600>>;
using ddays = std::chrono::duration<double, std::ratio<86400>>;
using dweeks = std::chrono::duration<double, std::ratio<604800>>;
using dmonths = std::chrono::duration<double, std::ratio<2629746>>;
using dyears = std::chrono::duration<double, std::ratio<31556952>>;
enum class TfClass {
Scout = 0,
Soldier = 1,
Pyro = 2,
Demoman = 3,
Heavy = 4,
Engineer = 5,
Medic = 6,
Sniper = 7,
Spy = 8
};
enum class StatType {
accum = 0,
max = 1
};
enum class GameType {
pvp = 0,
coop = 1 // mvm
};
const std::map<std::string, std::string> gamemodes = {
{"arena", "Arena"},
{"cp", "Capture Point"},
{"ctf", "Capture the Flag"},
{"koth", "King of the Hill"},
{"pl", "Payload"},
{"plr", "Payload Race"},
{"sd", "Special Delivery"}
};
class ClassStat {
public:
static inline std::regex regPvp = std::regex("(Class|Scout|Soldier|Pyro|Demoman|Heavy|Engineer|Medic|Sniper|Spy)\\.(accum|max)\\.i([a-zA-Z]+)", std::regex::optimize);
static inline std::regex regMvm = std::regex("(Class|Scout|Soldier|Pyro|Demoman|Heavy|Engineer|Medic|Sniper|Spy)\\.mvm\\.(accum|max)\\.i([a-zA-Z]+)", std::regex::optimize);
std::string fullName;
std::string className;
std::string shortName;
std::string description;
int value;
GameType gameType;
StatType statType;
TfClass tfClass;
};
class MapStat {
public:
static inline std::regex reg = std::regex("((arena|cp|ctf|koth|pl|plr|sd)_[a-zA-Z0-9_]+)\\.accum\\.iPlayTime", std::regex::optimize);
std::string name;
std::string gamemode;
int playTime;
};
class AchievementStat {
public:
static inline std::regex reg = std::regex("TF_.*_STAT", std::regex::optimize);
std::string name;
std::string description;
int value;
};
class PlayerStats {
public:
std::vector<ClassStat> pvpStats;
std::vector<ClassStat> mvmStats;
std::vector<MapStat> mapStats;
std::vector<AchievementStat> achievementStats;
};
TfClass GetEnumFromClassString(const std::string& name) {
if (name == "Scout") return TfClass::Scout;
if (name == "Soldier") return TfClass::Soldier;
if (name == "Pyro") return TfClass::Pyro;
if (name == "Demoman") return TfClass::Demoman;
if (name == "Heavy") return TfClass::Heavy;
if (name == "Engineer") return TfClass::Engineer;
if (name == "Medic") return TfClass::Medic;
if (name == "Sniper") return TfClass::Sniper;
if (name == "Spy") return TfClass::Spy;
}