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
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
|
//========= Copyright Valve Corporation, All rights reserved. ============//
//
// Purpose: Generic in-game abuse reporting
//
// $NoKeywords: $
//=============================================================================//
#ifndef ABUSE_REPORT_H
#define ABUSE_REPORT_H
#ifdef _WIN32
#pragma once
#endif
#include <igamesystem.h>
#include <GameEventListener.h>
#include <bitmap/bitmap.h>
#include <netadr.h>
/// Different content types that can be reported as abusive.
///
/// WARNING: These enum values MUST MATCH the values in Steam's
/// ECommunityContentType!
enum EAbuseReportContentType
{
k_EAbuseReportContentNoSelection = -1, // dummy ilegal value: the user has not made a selection
k_EAbuseReportContentUnspecified = 0, // we use this to mean "other"
//k_EAbuseReportContentAll = 1, // reset all community content
k_EAbuseReportContentAvatarImage = 2, // clear avatar image
//k_EAbuseReportContentProfileText = 3, // reset profile text
//k_EAbuseReportContentWebLinks = 4, // delete web links
//k_EAbuseReportContentAnnouncement = 5,
//k_EAbuseReportContentEventText = 6,
//k_EAbuseReportContentCustomCSS = 7,
//k_EAbuseReportContentProfileURL = 8, // delete community URL ID
k_EAbuseReportContentComments = 9, // just comments this guy has written
k_EAbuseReportContentPersonaName = 10, // persona name
//k_EAbuseReportContentScreenshot = 11, // screenshot
//k_EAbuseReportContentVideo = 12, // videos
k_EAbuseReportContentCheating = 13, // cheating
k_EAbuseReportContentUGCImage = 14, // Image stored in UGC --- the report is accusing the image of being offensive
k_EAbuseReportContentActorUGCImage = 15, // Abuse report actor has uploaded a UGC image to server as supporting documentation of their claim
};
/// Types of reasons why a violation report was issued
///
/// WARNING: These enum values MUST MATCH the values in Steam's
/// EAbuseReportType!
enum EAbuseReportType
{
k_EAbuseReportTypeNoSelection = -1, // dummy ilegal value: the user has not made a selection
k_EAbuseReportTypeUnspecified = 0,
k_EAbuseReportTypeInappropriate = 1, // just not ok to post
k_EAbuseReportTypeProhibited = 2, // prohibited by EULA or general law
k_EAbuseReportTypeSpamming = 3, // excessive spamming
k_EAbuseReportTypeAdvertisement = 4, // unwanted advertisement
//k_EAbuseReportTypeExploit = 5, // content data attempts to exploit code issue
k_EAbuseReportTypeSpoofing = 6, // user/group is impersonating an official contact
k_EAbuseReportTypeLanguage = 7, // bad language
k_EAbuseReportTypeAdultContent = 8, // any kind of adult material, references etc
k_EAbuseReportTypeHarassment = 9, // harassment, discrimination, racism etc
k_EAbuseReportTypeCheating = 10, // cheating
};
/// Container class that has everything we need to know in order to file
/// an abuse report, which is significantly more than the data we actually
/// include in a particular abuse report. It's everything we save off at the
/// time the user initiates the abuse reporting mechanism. Games can derive
/// their own report types and put game-specific data in here.
struct AbuseIncidentData_t
{
AbuseIncidentData_t();
virtual ~AbuseIncidentData_t();
enum EPlayerImageType
{
k_PlayerImageType_UGC,
k_PlayerImageType_Spray,
};
/// A custom image of the player's that could be considered offensive
struct PlayerImage_t
{
/// What kind of image is it?
EPlayerImageType m_eType;
/// For UGC images, what's the handle?
uint64 m_hUGCHandle;
};
/// Info we remember for one player.
struct PlayerData_t
{
PlayerData_t()
{
m_iClientIndex = -1;
m_iSteamAvatarIndex = -1;
}
/// The client index. (See UTIL_PlayerByIndex). Note that this
/// index is really only valid at the time the incident is captured.
/// Because players can leave after the incident is captured.
int m_iClientIndex;
/// The name they were going by at the time
CUtlString m_sPersona;
/// Their steam ID. This is essential so we can file
/// an abuse report!
CSteamID m_steamID;
/// Index of steam friends icon for their avatar.
/// 0 if they don't have one!
int m_iSteamAvatarIndex;
/// Do we have an entity for this player? They might not have spawned,
/// or might be outside our PVS, etc.
bool m_bHasEntity;
/// Model transform for the player's render stuff
VMatrix m_matModelToWorld;
/// Model->clip matrix for the player's render stuff
VMatrix m_matModelToClip;
/// True if the render bounds are approximately correct, false if not
bool m_bRenderBoundsValid;
/// Bounds (in model space) of the player's renderable stuff
Vector m_vecRenderBoundsMin, m_vecRenderBoundsMax;
/// Bounds (in normalized screen space coords 0...1) of the player's
/// renderable stuff
Vector2D m_screenBoundsMin, m_screenBoundsMax;
/// List of his images
CUtlVector<PlayerImage_t> m_vecImages;
};
/// List of base player data. You got more data per player in your derived
/// incident type? Store it in a parallel array.
CUtlVector<PlayerData_t> m_vecPlayers;
/// Camera world -> clip matrix.
VMatrix m_matWorldToClip;
/// Screenshot
Bitmap_t m_bitmapScreenshot;
// Screenshot file data
CUtlBuffer m_bufScreenshotFileData;
/// Number of frames we're willing to wait for the engine to write out a screenshot.
/// Zero if we already failed
int m_nScreenShotWaitFrames;
/// Is it possible to report the game server itself for abuse?
bool m_bCanReportGameServer;
/// What Game Server/IP are we on? Will be an invalid address if we don't know
netadr_t m_adrGameServer;
/// Steam ID of the game server / IP we are on
CSteamID m_steamIDGameServer;
/// Poll report (some data may have to be fetched asynchronously),
/// return true if everything is ready
virtual bool Poll();
};
/// Generic abuse reporting panel. Your
class CAbuseReportManager : public CBaseGameSystemPerFrame, public CGameEventListener
{
public:
CAbuseReportManager();
virtual ~CAbuseReportManager();
//
// CAutoGameSystemPerFrame overrides
//
virtual char const *Name();
virtual bool Init();
virtual void Shutdown();
virtual void LevelShutdownPreEntity();
//
// CGameEventListener overrides
//
virtual void FireGameEvent( IGameEvent *event );
// CAutoGameSystemPerFrame defines different stuff depending on which DLL we're building
#ifdef CLIENT_DLL
// Do our frame-time processing
virtual void Update( float frametime );
#else
#error "Why is this being included?"
#endif
/// Called when the console command is executed to capture data for a report
virtual void QueueReport();
/// Called when the console command is executed to submit data for a report
virtual void SubmitReportUIRequested();
/// Called to actually trigger the report UI, after all data is ready
virtual void ActivateSubmitReportUI() = 0;
/// Fetch the incident that's queued to be reported
AbuseIncidentData_t *GetIncidentData() const { return m_pIncidentData; }
/// Delete any current report incident. Also should clean
/// out any temporary files used by the incident system.
virtual void DestroyIncidentData();
/// Show a message box complaining about lack of steam
/// connection
virtual void ShowNoSteamErrorMessage();
/// Insert a a notification into the queue indicating that an unfiled report is ready
virtual void CreateReportReadyNotification( bool bInGame, float flLifetime );
/// Test harness. Set this to true, to generate fake data
bool m_bTestReport;
static const char k_rchScreenShotFilenameBase[];
static const char k_rchScreenShotFilename[];
protected:
/// Your app will probably define its own abuse report types.
/// if so, you will need to override this function.
/// The base class just calls new to create an object, then calls
/// PopulateIncident()
virtual bool CreateAndPopulateIncident();
/// Fill in the details about the current incident. This just fills in the
/// base class data, and it should be called from CreateAndPopulateIncident
bool PopulateIncident();
/// Current incident that is pending to be reported or is being generated.
/// Might be NULL.
AbuseIncidentData_t *m_pIncidentData;
/// Status of incident data.
enum EIncidentDataStatus
{
k_EIncidentDataStatus_None,
k_EIncidentDataStatus_Preparing, // we shuld call Poll() until it's ready
k_EIncidentDataStatus_Ready, // it's ready
};
EIncidentDataStatus m_eIncidentDataStatus;
/// Do we want to show the report UI as soon as the report is ready?
bool m_bReportUIPending;
void CheckCreateReportReadyNotification( float flMinSecondsSinceLastNotification, bool bInGame, float flLifetime );
/// Time when we last pestered them about filing their report
double m_timeLastReportReadyNotification;
/// Address of the lasts server we connected to
netadr_t m_adrCurrentServer;
CSteamID m_steamIDCurrentServer;
};
/// Pointer to the app-specific instance. This pointer mght be NULL! Your
/// app should define set this pointer if it uses the system
extern CAbuseReportManager *g_AbuseReportMgr;
#endif // ABUSE_REPORT_H
|