/
Round.h
228 lines (205 loc) · 4.83 KB
/
Round.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
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
#ifndef __ROUND
#define __ROUND
// wxWindows includes
#include <wx/datetime.h>
#include <wx/string.h>
#include <wx/arrstr.h>
#include <wx/dynarray.h>
// Statsgen Includes
#include "ErrorData.h"
#include "KillData.h"
#include "ActionData.h"
#include "SpeechData.h"
#include "TeamWinData.h"
#include "TeamLossData.h"
#include "PlayerInRound.h"
#include "XPPoints.h"
class LogFileReader;
class DecodedTeamLoss
{
public:
void Clear();
wxString teamName;
wxArrayString playerIDs;
wxArrayString playerRoundIDs;
wxArrayString playerNames;
};
class DecodedTeamWin
{
public:
void Clear();
wxString teamName;
wxArrayString playerIDs;
wxArrayString playerRoundIDs;
wxArrayString playerNames;
};
class DecodedKill
{
public:
wxString playerID;
wxString playerRoundID;
wxString playerName;
wxString playerClass;
wxString playerTeam;
wxString playerWeapon;
wxString playerAmmo;
wxString targetID;
wxString targetRoundID;
wxString targetName;
wxString targetClass;
wxString targetTeam;
wxString targetDamage;
wxString targetLocation;
};
class DecodedPlayerJoin
{
public:
wxString playerID;
wxString playerRoundID;
wxString playerName;
wxString playerClass;
wxString playerTeam;
};
class DecodedPlayerQuit
{
public:
wxString playerID;
wxString playerRoundID;
wxString playerName;
};
class DecodedAction
{
public:
wxString playerID;
wxString playerRoundID;
wxString playerTeam;
wxString playerClass;
wxString playerName;
wxString action;
};
class DecodedSpeech
{
public:
wxString playerID;
wxString playerRoundID;
wxString playerName;
wxString speech;
};
class DecodedRoundStart
{
public:
wxString admin;
wxString location;
wxString website;
wxString gameType;
wxString mapName;
wxString maxClients;
wxString privateClients;
};
class RoundLine
{
public:
void Set(wxDateTime &lineTimeIn,wxString &lineIn);
wxDateTime lineTime;
wxString line;
};
WX_DECLARE_OBJARRAY(RoundLine,ArrayOfRoundLines);
class Round;
WX_DECLARE_OBJARRAY(Round,ArrayOfRounds);
class Round
{
public:
Round();
virtual ~Round();
void Debug();
void Initiate(LogFileReader *reader,
wxDateTime &lineTime,
wxString &line);
void AddLogLine(wxDateTime &lineTime,wxString &line);
void Process(ErrorData &errorData,int serverIndexIn);
bool IsDropped();
void CalculateScores(int roundIndex);
void WriteToDatabase(int index);
static wxString SQLCreateTable();
static wxString SQLTableName();
static wxString SQLCreateVariableTable();
static wxString SQLVariableTableName();
void AddVariable(wxString &variable,wxString &value);
void SetStartingCondition(int serverIndexIn,
wxString &mapNameIn,
time_t durationIn,
wxString &gameTypeIn);
void AddTeamLoss(wxString &guid,
wxString &playerName,
wxString &playerTeam,
time_t mapStartTime,
time_t mapEndTime);
void AddTeamWin(wxString &guid,
wxString &playerName,
wxString &playerTeam,
time_t mapStartTime,
time_t mapEndTime);
void AddKill(DecodedKill &decoded);
void AddSpeech(DecodedSpeech &decoded,
wxDateTime &speechTime);
void AddXPPoints(wxString &playerName,
wxString &playerGUID,
wxString &xpKey,
float points);
public:
int serverIndex;
ArrayOfKillData kills;
ArrayOfActionData actions;
ArrayOfTeamWinData teamWins;
ArrayOfTeamLossData teamLosses;
ArrayOfSpeechData speeches;
ArrayOfPlayersInRound playersInRound;
ArrayOfXPPoints xpPoints;
int activePlayers;
wxArrayString logfileVariableKeys;
wxArrayString logfileVariableValues;
bool dropped;
wxTimeSpan roundDuration;
private:
void AddKill(DecodedKill &decoded,
wxDateTime &killTime,
int gameType,
int mapName);
void AddTeamLoss(DecodedTeamLoss &decoded,
wxDateTime &lossTime,
int gameType,
int mapName);
void AddTeamWin(DecodedTeamWin &decoded,
wxDateTime &winTime,
int gameType,
int mapName);
void AddAction(DecodedAction &decoded,
wxDateTime &actionTime,
int gameType,
int mapName);
void AddJoin(DecodedPlayerJoin &decoded,
wxDateTime &joinTime);
void AddQuit(DecodedPlayerQuit &decoded,
wxDateTime &quitTime);
void UpdatePlayerInRoundTime(int playerIndex, wxDateTime &timeStamp,bool resetTime);
bool SubstituteLogEntry(const char *logEntryType,
wxString &logEntry);
void StoreLogEntry(const char *logEntryType,
wxString &logEntry);
private:
bool WordAtTextPosition(
wxString &speechLine,
int speechIndex,
int speechLength,
wxString &bannedWord,
int *replacementLength);
wxDateTime roundStartTime;
int gameType;
int mapName;
LogFileReader *logfileReader;
ArrayOfRoundLines roundLines;
wxString serverType;
bool teamWinAlreadyFound;
bool teamLossAlreadyFound;
};
#endif