]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blob - qcsrc/common/playerstats.qh
Walking through doors with high ping just got awesome
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / playerstats.qh
1 #ifndef PLAYERSTATS_H
2 #define PLAYERSTATS_H
3
4 #ifdef SVQC
5 //float PS_PM_IN_DB = -1;   // playerstats_prematch_in_db      // db for info COLLECTED at the beginning of a match
6 int PS_GR_OUT_DB = -1;  // playerstats_gamereport_out_db   // db of info SENT at the end of a match
7 //float PS_GR_IN_DB = -1;   // playerstats_gamereport_in_db    // db for info COLLECTED at the end of a match
8 int PS_B_IN_DB = -1;    // playerstats_playerbasic_in_db   // db for info COLLECTED for basic player info (ELO)
9 #endif
10
11 #ifdef MENUQC
12 int PS_D_IN_DB = -1; // playerstats_playerdetail_in_db  // db for info COLLECTED for detailed player profile display
13 #endif
14
15 #ifdef SVQC
16 //string PS_PM_IN_EVL;   // playerstats_prematch_in_events_last
17 string PS_GR_OUT_TL;   // playerstats_gamereport_out_teams_last
18 string PS_GR_OUT_PL;   // playerstats_gamereport_out_players_last
19 string PS_GR_OUT_EVL;  // playerstats_gamereport_out_events_last
20 //string PS_GR_IN_PL;    // playerstats_gamereport_in_players_last
21 //string PS_GR_IN_EVL;   // playerstats_gamereport_in_events_last
22 //string PS_B_IN_PL;     // playerstats_playerbasic_in_players_last
23 //string PS_B_IN_EVL;    // playerstats_playerbasic_in_events_last
24 #endif
25
26 #ifdef MENUQC
27 string PS_D_IN_EVL; // playerstats_playerdetail_in_events_last
28 #endif
29
30 #ifdef SVQC
31
32 // time the player was alive and kicking
33 const string PLAYERSTATS_ALIVETIME  = "alivetime";
34 const string PLAYERSTATS_AVGLATENCY = "avglatency";
35 const string PLAYERSTATS_WINS = "wins";
36 const string PLAYERSTATS_MATCHES = "matches";
37 const string PLAYERSTATS_JOINS = "joins";
38 const string PLAYERSTATS_SCOREBOARD_VALID = "scoreboardvalid";
39 const string PLAYERSTATS_RANK = "rank";
40 const string PLAYERSTATS_SCOREBOARD_POS = "scoreboardpos";
41
42 const string PLAYERSTATS_TOTAL = "total-";
43 const string PLAYERSTATS_SCOREBOARD = "scoreboard-";
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 float PlayerStats_GameReport_DelayMapVote;
58
59 // call at initialization
60 void PlayerStats_GameReport_Init();
61
62 // add a new player
63 void PlayerStats_GameReport_AddPlayer(entity e);
64
65 // add a new team
66 void PlayerStats_GameReport_AddTeam(float t);
67
68 // add a new event
69 void PlayerStats_GameReport_AddEvent(string event_id);
70
71 // call on each event to track, or at player disconnect OR match end for "global stuff"
72 #define PS_GR_P_ADDVAL(ent,eventid,val) PlayerStats_GameReport_Event(ent.playerstats_id, eventid, val)
73 #define PS_GR_T_ADDVAL(team,eventid,val) PlayerStats_GameReport_Event(sprintf("team#%d", team), eventid, val)
74 float PlayerStats_GameReport_Event(string prefix, string event_id, float value);
75
76 void PlayerStats_GameReport_Accuracy(entity p);
77
78 // call this whenever a player leaves
79 void PlayerStats_GameReport_FinalizePlayer(entity p);
80
81 // call this at the end of the match
82 void PlayerStats_GameReport(float finished);
83
84 void PlayerStats_GameReport_Handler(entity fh, entity pass, float status);
85
86 .string playerstats_id;
87
88 //string autocvar_g_playerstats_uri;
89
90 string autocvar_g_playerstats_gamereport_ladder;
91 string autocvar_g_playerstats_gamereport_uri = "http://stats.xonotic.org/stats/submit";
92
93 const float PS_B_STATUS_ERROR = -2;
94 const float PS_B_STATUS_IDLE = -1;
95 const float PS_B_STATUS_WAITING = 0;
96 const float PS_B_STATUS_RECEIVED = 1;
97 const float PS_B_STATUS_UPDATING = 2;
98 .float playerstats_basicstatus;
99 string autocvar_g_playerstats_playerbasic_uri = "http://stats.xonotic.org";
100
101 void PlayerStats_PlayerBasic(entity joiningplayer, float newrequest);
102 void PlayerStats_PlayerBasic_CheckUpdate(entity joiningplayer);
103 void PlayerStats_PlayerBasic_Handler(entity fh, entity p, float status);
104 #endif //SVQC
105 #ifdef MENUQC
106 float PS_D_NEXTUPDATETIME;
107 float PS_D_LASTGAMECOUNT;
108 const float PS_D_STATUS_ERROR = -2;
109 const float PS_D_STATUS_IDLE = -1;
110 const float PS_D_STATUS_WAITING = 0;
111 const float PS_D_STATUS_RECEIVED = 1;
112 float PlayerStats_PlayerDetail_Status = PS_D_STATUS_IDLE;
113 string autocvar_g_playerstats_playerdetail_uri = "http://stats.xonotic.org/player/me";
114 float autocvar_g_playerstats_playerdetail_autoupdatetime = 1800; // automatically update every 30 minutes anyway
115 void PlayerStats_PlayerDetail(void);
116 void PlayerStats_PlayerDetail_CheckUpdate(void);
117 void PlayerStats_PlayerDetail_Handler(entity fh, entity p, float status);
118 #endif
119 #endif