Transifex autosync
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / playerstats.qh
1 #pragma once
2
3 #ifdef SVQC
4 //float PS_PM_IN_DB = -1;   // playerstats_prematch_in_db      // db for info COLLECTED at the beginning of a match
5 int PS_GR_OUT_DB = -1;  // playerstats_gamereport_out_db   // db of info SENT at the end of a match
6 //float PS_GR_IN_DB = -1;   // playerstats_gamereport_in_db    // db for info COLLECTED at the end of a match
7 float PS_B_IN_DB = -1;    // playerstats_playerbasic_in_db   // db for info COLLECTED for basic player info (ELO)
8 #endif
9
10 #ifdef MENUQC
11 int PS_D_IN_DB = -1; // playerstats_playerdetail_in_db  // db for info COLLECTED for detailed player profile display
12 #endif
13
14 #ifdef SVQC
15 //string PS_PM_IN_EVL;   // playerstats_prematch_in_events_last
16 string PS_GR_OUT_TL;   // playerstats_gamereport_out_teams_last
17 string PS_GR_OUT_PL;   // playerstats_gamereport_out_players_last
18 string PS_GR_OUT_EVL;  // playerstats_gamereport_out_events_last
19 //string PS_GR_IN_PL;    // playerstats_gamereport_in_players_last
20 //string PS_GR_IN_EVL;   // playerstats_gamereport_in_events_last
21 //string PS_B_IN_PL;     // playerstats_playerbasic_in_players_last
22 //string PS_B_IN_EVL;    // playerstats_playerbasic_in_events_last
23 #endif
24
25 #ifdef MENUQC
26 string PS_D_IN_EVL; // playerstats_playerdetail_in_events_last
27 #endif
28
29 #ifdef SVQC
30
31 // time the player was alive and kicking
32 const string PLAYERSTATS_ALIVETIME  = "alivetime";
33 const string PLAYERSTATS_AVGLATENCY = "avglatency";
34 const string PLAYERSTATS_WINS = "wins";
35 const string PLAYERSTATS_MATCHES = "matches";
36 const string PLAYERSTATS_JOINS = "joins";
37 const string PLAYERSTATS_SCOREBOARD_VALID = "scoreboardvalid";
38 const string PLAYERSTATS_RANK = "rank";
39 const string PLAYERSTATS_SCOREBOARD_POS = "scoreboardpos";
40
41 const string PLAYERSTATS_TOTAL = "total-";
42 const string PLAYERSTATS_SCOREBOARD = "scoreboard-";
43 const string PLAYERSTATS_ANTICHEAT = "anticheat-";
44
45 const string PLAYERSTATS_ACHIEVEMENT_KILL_SPREE_3 = "achievement-kill-spree-3";
46 const string PLAYERSTATS_ACHIEVEMENT_KILL_SPREE_5 = "achievement-kill-spree-5";
47 const string PLAYERSTATS_ACHIEVEMENT_KILL_SPREE_10 = "achievement-kill-spree-10";
48 const string PLAYERSTATS_ACHIEVEMENT_KILL_SPREE_15 = "achievement-kill-spree-15";
49 const string PLAYERSTATS_ACHIEVEMENT_KILL_SPREE_20 = "achievement-kill-spree-20";
50 const string PLAYERSTATS_ACHIEVEMENT_KILL_SPREE_25 = "achievement-kill-spree-25";
51 const string PLAYERSTATS_ACHIEVEMENT_KILL_SPREE_30 = "achievement-kill-spree-30";
52 const string PLAYERSTATS_ACHIEVEMENT_BOTLIKE = "achievement-botlike";
53 const string PLAYERSTATS_ACHIEVEMENT_FIRSTBLOOD = "achievement-firstblood";
54 const string PLAYERSTATS_ACHIEVEMENT_FIRSTVICTIM = "achievement-firstvictim";
55
56 // delay map switch until this is set
57 bool PlayerStats_GameReport_DelayMapVote;
58
59 void PlayerStats_GameReport_Reset_All();
60
61 // call at initialization
62 void PlayerStats_GameReport_Init();
63
64 // add a new player
65 void PlayerStats_GameReport_AddPlayer(entity e);
66
67 // add a new team
68 void PlayerStats_GameReport_AddTeam(float t);
69
70 // add a new event
71 void PlayerStats_GameReport_AddEvent(string event_id);
72
73 // call on each event to track, or at player disconnect OR match end for "global stuff"
74 #define PlayerStats_GameReport_Event_Player(ent, eventid, val) PlayerStats_GameReport_Event(ent.playerstats_id, eventid, val)
75 #define PlayerStats_GameReport_Event_Team(team, eventid, val) PlayerStats_GameReport_Event(sprintf("team#%d", team), eventid, val)
76 float PlayerStats_GameReport_Event(string prefix, string event_id, float value);
77
78 void PlayerStats_GameReport_Accuracy(entity p);
79
80 // call this whenever a player leaves
81 void PlayerStats_GameReport_FinalizePlayer(entity p);
82
83 // call this at the end of the match
84 void PlayerStats_GameReport(bool finished);
85
86 void PlayerStats_GameReport_Handler(entity fh, entity pass, float status);
87
88 .string playerstats_id;
89 .float scoreboard_pos;
90
91 //string autocvar_g_playerstats_uri;
92
93 string autocvar_g_playerstats_gamereport_ladder;
94 string autocvar_g_playerstats_gamereport_uri = "https://stats.xonotic.org/stats/submit";
95
96 const float PS_B_STATUS_ERROR = -2;
97 const float PS_B_STATUS_IDLE = -1;
98 const float PS_B_STATUS_WAITING = 0;
99 const float PS_B_STATUS_RECEIVED = 1;
100 const float PS_B_STATUS_UPDATING = 2;
101 .float playerstats_basicstatus;
102 string autocvar_g_playerstats_playerbasic_uri = "https://stats.xonotic.org";
103
104 void PlayerStats_PlayerBasic(entity joiningplayer, float newrequest);
105 void PlayerStats_PlayerBasic_CheckUpdate(entity joiningplayer);
106 void PlayerStats_PlayerBasic_Handler(entity fh, entity p, float status);
107 #endif //SVQC
108 #ifdef MENUQC
109 float PS_D_NEXTUPDATETIME;
110 float PS_D_LASTGAMECOUNT;
111 const float PS_D_STATUS_ERROR = -2;
112 const float PS_D_STATUS_IDLE = -1;
113 const float PS_D_STATUS_WAITING = 0;
114 const float PS_D_STATUS_RECEIVED = 1;
115 float PlayerStats_PlayerDetail_Status = PS_D_STATUS_IDLE;
116 string autocvar_g_playerstats_playerdetail_uri = "https://stats.xonotic.org/player/me";
117 float autocvar_g_playerstats_playerdetail_autoupdatetime = 1800; // automatically update every 30 minutes anyway
118 void PlayerStats_PlayerDetail();
119 void PlayerStats_PlayerDetail_CheckUpdate();
120 void PlayerStats_PlayerDetail_Handler(entity fh, entity p, float status);
121
122 #endif
123
124 #ifdef GAMEQC
125
126 REPLICATE_INIT(int, cvar_cl_allow_uid2name);
127 REPLICATE_INIT(bool, cvar_cl_allow_uidranking);
128 REPLICATE_INIT(int, cvar_cl_allow_uidtracking);
129
130 #endif