-
Notifications
You must be signed in to change notification settings - Fork 2
/
GlobalStatistics.h
232 lines (211 loc) · 7.13 KB
/
GlobalStatistics.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
229
230
231
232
#ifndef __GLOBALSTATISTICS
#define __GLOBALSTATISTICS
// wxWindows includes
#include <wx/wx.h>
#include <wx/string.h>
#include <wx/filename.h>
// statsgen includes
#include "Cheater.h"
#include "Player.h"
#include "Round.h"
#include "ConfigData.h"
#include "StatsgenDatabase.h"
#include "GenericKey.h"
#include "PlayerCacheEntry.h"
#include "AKAListEntry.h"
#include "AliasListEntry.h"
#include "AwardDefinition.h"
#include "Server.h"
#include "Clan.h"
#include "DropList.h"
#include "ScheduleItem.h"
#include "KillTotalLists.h"
#include "PlayerDataList.h"
#include "WeightList.h"
#include "TemplateFile.h"
#include "PlayerList.h"
#include "AliasCacheEntry.h"
#include "XPPoints.h"
#include "XPTotals.h"
#include "WebServer.h"
#include "TemplateFile.h"
#define CONFIG_KEY_SPEECHFILE "/General/Speechfile"
#define STEP_APPLY_ALIASES "ApplyAliases"
#define STEP_DATABASE_READ_STATIC "DatabaseReadStatic"
#define STEP_DATABASE_LOCATE_EXISTING_PLAYERS "DatabaseLocateExistingPlayers"
#define STEP_DOWNLOAD_LOGS "DownloadLogFile"
#define STEP_CREATE_LOG_FILES "CreateLogfileObjects"
#define STEP_PROCESS_LOG_FILES "ProcessLogfiles"
#define STEP_DROP_PLAYERS "DropPlayersAndRounds"
#define STEP_CALCULATE_SCORES "CalculateScores"
#define STEP_CREATE_DATABASE "CreateDatabase"
#define STEP_EMPTY_DATABASE "EmptyDatabase"
#define STEP_WRITE_DATABASE "WriteDatabase"
#define STEP_TRANSFER_DATABASE "TransferDatabase"
#define STEP_READ_TEMPLATE "ReadTemplate"
#define STEP_PROCESS_TEMPLATE "ProcessTemplate"
#define STEP_POST_PROCESS_TEMPLATE "PostProcessTemplate"
#define STEP_WEBSITE "Website"
class TemplateFile;
class GlobalStatistics
{
public:
GlobalStatistics();
~GlobalStatistics();
void CalculateScores();
void InitiateSkillCalculationType();
wxString SkillCalculationTypeConfigKey();
bool AllowNegativeSkill();
bool ProcessStepAllowed(int step,wxArrayInt &allowedSteps);
void ProduceStatsInitiate();
void ProduceStatsDownload();
void ProduceStatsProcess();
void ProduceStatsTransfer();
void ProduceStatsFinalise();
void ProduceStats(
bool fullRun,
wxArrayInt &allowedSteps,
TemplateFile &templateFile);
void DropPlayersAndRounds();
void DropPlayers();
void DropRounds();
void DropInactiveRounds();
int FindPlayerIndex(wxString &name);
int FindGUIDIndex(wxString &guid);
int AddPlayer(wxString &name,wxString &id);
Player GetPlayer(int index);
int GenericKeyIndex(ArrayOfGenericKey &keyArray,
wxString &id);
wxString GenericKeyID(ArrayOfGenericKey &keyArray,
int index);
int GenericKeyAdd(ArrayOfGenericKey &keyArray,
wxString &id);
void Debug();
bool WriteToDatabase();
void GenericKeyDebug(
ArrayOfGenericKey &arrayKey,
char *tableName);
void ReadPlayerCache();
void WritePlayerCache();
void PlayerListToPlayerCache();
void ReadAliasList();
void WriteAliasList();
void AddAlias(AliasListEntry &aliasEntry);
void DeleteAlias(AliasListEntry &aliasEntry);
bool FindAlias(AliasListEntry &aliasEntry);
void ReadAwardDefinitions();
void ReadClanDefinitions();
void ReadServersFromConfig();
void ClearServers();
int ClanIndex(wxString &name);
void ReadScheduleConfig();
void ReadMessageTimerConfig();
void ReadProductionRunTimerConfig();
void ReadQuickRunTimerConfig();
bool StepAllowed(const char *step);
void ResetProcessingStatus();
void InitiateMessageCentres();
void SendMessages();
void ReadDeathmatchGametypes();
void ReadTeamSwapWeapons();
bool IsDeathmatchGametype(wxString &gametype);
bool IsDeathmatchGametype(int gametype);
bool IsTeamSwapWeapon(int weapon);
bool IsTeamSwapWeapon(wxString &weapon);
void OpenSpeechFile();
void CloseSpeechFile();
void WriteSpeechFile(wxDateTime &speechTime,wxString &guid,wxString &playerName,wxString &speech);
void GenerateUpgrade(wxString &filename);
void AddAKA(int playerIndex,wxString &name);
float ScoreWeight(const char *key,float defaultValue);
float ScoreWeight(const char *key,const char *prefix,float defaultValue);
float ScoreWeight(wxString &key,float defaultValue);
float GametypeScoreWeight(wxString &gametype);
float GametypeScoreWeight(int gametype);
float GametypeSkillWeight(wxString &gametype);
float GametypeSkillWeight(int gametype);
float SkillWeight(const char *key,float defaultValue);
float SkillWeight(const char *key,const char *prefix,float defaultValue);
float SkillWeight(wxString &key,float defaultValue);
int ReadPriority(bool fullRun);
void WritePriority(bool fullRun,int priority);
wxString AutomaticAliasConfigKey();
void EmptyAliasCache();
void AddToAliasCache(ArrayOfAliasCacheEntry *cache,
wxString &name,
wxString &guid,
int index);
void ReadStaticItemsFromDatabase();
void ReadGenericKeyFromDatabase(ArrayOfGenericKey &keyList,
const char *tableName);
void LocateExistingPlayers();
void DropExistingPlayers();
void UpdateExistingPlayersDropStatus(wxArrayInt &playerIndexList,bool dropped);
void UpdateExistingPlayersClan();
void DropExistingCheat(int playerIndex,int worldPlayerIndex);
void FlagStartOfRun();
void FlagEndOfRun();
bool AreStatsRunning();
public:
TemplateFile templateFile;
time_t startTime;
PlayerDataList *playerDataAvatars;
PlayerDataList *playerDataWebsite;
PlayerDataList *playerDataPicture;
PlayerDataList *playerDataXfire;
PlayerDataList *playerDataClanRole;
PlayerDataList *playerDataRealName;
PlayerDataList *playerDataMisc1;
PlayerDataList *playerDataMisc2;
ArrayOfPlayerCacheEntry playerCache;
//ArrayOfServer servers;
ArrayOfPointers servers;
ArrayOfAliasListEntry aliasList;
ArrayOfAKAListEntry AKAList;
DropList dropList;
//ArrayOfPlayers players;
PlayerList playerList;
ArrayOfRounds rounds;
ArrayOfAwardDefinition awardDefinitions;
ArrayOfClan clans;
ConfigData configData;
StatsgenDatabase statsgenDatabase;
ArrayOfGenericKey keysAction;
ArrayOfGenericKey keysAmmo;
ArrayOfGenericKey keysMap;
ArrayOfGenericKey keysWeapon;
ArrayOfGenericKey keysClass;
ArrayOfGenericKey keysTeam;
ArrayOfGenericKey keysGametype;
ArrayOfGenericKey keysLocation;
ArrayOfGenericKey keysXP;
wxArrayInt playersChanged;
wxArrayInt droppedPlayersChanged;
wxArrayInt roundsChanged;
KillTotalLists killTotalLists;
XPTotals totalXP;
int roundsAlreadyProcessed;
ScheduleItem messageTimer;
ScheduleItem productionRunTimer;
ScheduleItem quickRunTimer;
wxArrayString deathmatchGametypes;
wxArrayString teamSwapWeapons;
wxArrayString bannedSpeech;
FILE *speechfp;
bool negativeSkillAllowed;
WeightList skillWeights;
WeightList scoreWeights;
wxThread *currentRunningThread;
wxEvtHandler *mainEventHandler;
bool useAutomaticAliases;
bool aliasCacheEnabled;
ArrayOfAliasCacheEntry *aliasCache;
ArrayOfAliasCacheEntry *aliasPrimaryCache;
Cheaters cheaters;
WebServer webServer;
bool hiddenFeatures;
bool recoveryMode;
bool statsRunning;
};
extern GlobalStatistics globalStatistics;
#endif