case "sum": case "diff": case "k-d": hud_field[hud_num_fields] = SP_SUM; break;
case "name": case "nick": hud_field[hud_num_fields] = SP_NAME; have_name = true; break;
case "|": hud_field[hud_num_fields] = SP_SEPARATOR; have_separator = true; break;
+ case "elo": hud_field[hud_num_fields] = SP_ELO; break;
case "dmg": hud_field[hud_num_fields] = SP_DMG; break;
case "dmgtaken": hud_field[hud_num_fields] = SP_DMGTAKEN; break;
default:
}
return ftos(f);
+ case SP_ELO:
+ {
+ float elo = pl.(scores(SP_ELO));
+ switch (elo) {
+ case -1: return "...";
+ case -2: return _("N/A");
+ default: return ftos(elo);
+ }
+ }
+
case SP_DMG:
num = pl.(scores(SP_DMG));
denom = 1000;
void PlayerStats_PlayerBasic(entity joiningplayer, float newrequest)
{
+ PlayerScore_Add(joiningplayer, SP_ELO, -1);
// http://stats.xonotic.org/player/GgXRw6piDtFIbMArMuiAi8JG4tiin8VLjZgsKB60Uds=/elo.txt
if(autocvar_g_playerstats_playerbasic_uri != "")
{
string uri = autocvar_g_playerstats_playerbasic_uri;
- if(joiningplayer.crypto_idfp != "")
- {
+ if (joiningplayer.crypto_idfp == "") {
+ PlayerScore_Add(joiningplayer, SP_ELO, -1);
+ } else {
// create the database if it doesn't already exist
if(PS_B_IN_DB < 0)
PS_B_IN_DB = db_create();
else
{
// server has this disabled, kill the DB and set status to idle
+ PlayerScore_Add(joiningplayer, SP_ELO, -1);
if(PS_B_IN_DB >= 0)
{
db_close(PS_B_IN_DB);
{
// determine whether we should retrieve playerbasic information again
- #if 0
- LOG_INFOF("PlayerStats_PlayerBasic_CheckUpdate('%s'): %f\n",
+ LOG_TRACEF("PlayerStats_PlayerBasic_CheckUpdate('%s'): %f\n",
joiningplayer.netname,
time
);
- #endif
// TODO: check to see if this playerid is inside the database already somehow...
// for now we'll just check the field, but this won't work for players who disconnect and reconnect properly
url_fputs(fh, sprintf("m %s %s\n", cvar_string("_cl_playermodel"), cvar_string("_cl_playerskin"))); // model/skin
*/url_fputs(fh, "\n");
url_fclose(fh);
- break;
+ return;
}
case URL_READY_CANREAD:
{
+ bool handled = false;
string gt = string_null;
for (string s = ""; (s = url_fgets(fh)); ) {
int n = tokenizebyseparator(s, " "); // key value? data
LOG_TRACE("G: ", gt);
LOG_TRACE("e: ", data);
if (gt == GetGametype()) {
+ handled = true;
float e = stof(data);
- PlayerScore_Add(p, SP_ELO, e);
+ PlayerScore_Add(p, SP_ELO, +1 + e);
}
if (gt == "") {
// PlayerInfo_AddItem(p, value, data);
}
}
url_fclose(fh);
+ if (handled) return;
break;
}
case URL_READY_CLOSED:
{
// url_fclose has finished
LOG_INFO("Player stats synchronized with server\n");
- break;
+ return;
}
case URL_READY_ERROR:
break;
}
}
+ PlayerScore_Add(p, SP_ELO, -1);
}
#endif // SVQC