X-Git-Url: https://de.git.xonotic.org/?a=blobdiff_plain;f=qcsrc%2Fserver%2Fscores.qc;h=102dd6a33ef326af860bdd8d66c0ba537f5f8a89;hb=5f5505ba20abda2ac0d8eec592d6082846a49b19;hp=2c5e2b14490498ef2f8190f3530c92e77e450796;hpb=2f2147a6c665f04d1b6e860dce8a8a093e7d2b9e;p=xonotic%2Fxonotic-data.pk3dir.git diff --git a/qcsrc/server/scores.qc b/qcsrc/server/scores.qc index 2c5e2b144..102dd6a33 100644 --- a/qcsrc/server/scores.qc +++ b/qcsrc/server/scores.qc @@ -56,7 +56,7 @@ float TeamScore_SendEntity(entity to, float sendflags) longflags = 0; for(i = 0, p = 1; i < MAX_TEAMSCORE; ++i, p *= 2) - if(self.teamscores[i] > 127 || self.teamscores[i] <= -128) + if(self.(teamscores[i]) > 127 || self.(teamscores[i]) <= -128) longflags |= p; #if MAX_TEAMSCORE <= 8 @@ -70,9 +70,9 @@ float TeamScore_SendEntity(entity to, float sendflags) if(sendflags & p) { if(longflags & p) - WriteInt24_t(MSG_ENTITY, self.teamscores[i]); + WriteInt24_t(MSG_ENTITY, self.(teamscores[i])); else - WriteChar(MSG_ENTITY, self.teamscores[i]); + WriteChar(MSG_ENTITY, self.(teamscores[i])); } return TRUE; @@ -88,6 +88,7 @@ void TeamScore_Spawn(float t, string name) Net_LinkEntity(ts, FALSE, 0, TeamScore_SendEntity); teamscorekeepers[t - 1] = ts; ++teamscores_entities_count; + PlayerStats_AddTeam(t); } float TeamScore_AddToTeam(float t, float scorefield, float score) @@ -126,7 +127,7 @@ float TeamScore_Compare(entity t1, entity t2) { if(!t1 || !t2) return (!t2) - !t1; - vector result; + vector result = '0 0 0'; float i; for(i = 0; i < MAX_TEAMSCORE; ++i) { @@ -150,6 +151,11 @@ void ScoreInfo_SetLabel_PlayerScore(float i, string label, float scoreflags) scores_primary = scores[i]; scores_flags_primary = scoreflags; } + if(label != "") + { + PlayerStats_AddEvent(strcat(PLAYERSTATS_TOTAL, label)); + PlayerStats_AddEvent(strcat(PLAYERSTATS_SCOREBOARD, label)); + } } void ScoreInfo_SetLabel_TeamScore(float i, string label, float scoreflags) @@ -167,7 +173,7 @@ float ScoreInfo_SendEntity(entity to, float sf) { float i; WriteByte(MSG_ENTITY, ENT_CLIENT_SCORES_INFO); - WriteByte(MSG_ENTITY, game); + WriteInt24_t(MSG_ENTITY, MapInfo_LoadedGametype); for(i = 0; i < MAX_SCORE; ++i) { WriteString(MSG_ENTITY, scores_label[i]); @@ -216,7 +222,7 @@ float PlayerScore_SendEntity(entity to, float sendflags) longflags = 0; for(i = 0, p = 1; i < MAX_SCORE; ++i, p *= 2) - if(self.scores[i] > 127 || self.scores[i] <= -128) + if(self.(scores[i]) > 127 || self.(scores[i]) <= -128) longflags |= p; #if MAX_SCORE <= 8 @@ -230,9 +236,9 @@ float PlayerScore_SendEntity(entity to, float sendflags) if(sendflags & p) { if(longflags & p) - WriteInt24_t(MSG_ENTITY, self.scores[i]); + WriteInt24_t(MSG_ENTITY, self.(scores[i])); else - WriteChar(MSG_ENTITY, self.scores[i]); + WriteChar(MSG_ENTITY, self.(scores[i])); } return TRUE; @@ -245,9 +251,11 @@ void PlayerScore_Clear(entity player) if(teamscores_entities_count) return; + if(g_lms) return; if(g_arena || g_ca) return; - if(g_race && !g_race_qualifying) return; + if(g_cts) return; // in CTS, you don't lose score by observing + if(g_race && g_race_qualifying) return; // in qualifying, you don't lose score by observing sk = player.scorekeeper; for(i = 0; i < MAX_SCORE; ++i) @@ -330,6 +338,8 @@ float PlayerScore_Add(entity player, float scorefield, float score) if(score) if(scores_label[scorefield] != "") s.SendFlags |= pow(2, scorefield); + if(!inWarmupStage) + PlayerStats_Event(s.owner, strcat(PLAYERSTATS_TOTAL, scores_label[scorefield]), score); return (s.(scores[scorefield]) += score); } @@ -346,7 +356,7 @@ float PlayerScore_Compare(entity t1, entity t2) { if(!t1 || !t2) return (!t2) - !t1; - vector result; + vector result = '0 0 0'; float i; for(i = 0; i < MAX_SCORE; ++i) { @@ -367,9 +377,18 @@ void WinningConditionHelper() entity secondscorekeeper; entity sk; + // format: + // gametype:P:S::plabel,plabel:tlabel,tlabel:teamid:tscore,tscore:teamid:tscore,tscore + // score labels always start with a symbol or with lower case + // so to match pure, match for :P0: + // to match full, match for :S0: + s = GetGametype(); s = strcat(s, ":", autocvar_g_xonoticversion); s = strcat(s, ":P", ftos(cvar_purechanges_count)); + s = strcat(s, ":S", ftos(nJoinAllowed(world))); + s = strcat(s, ":F", ftos(serverflags)); + s = strcat(s, ":M", modname); s = strcat(s, "::", GetPlayerScoreString(world, 1)); // make this 1 once we can, note: this doesn't contain any : fullstatus = autocvar_g_full_getstatus_responses; @@ -864,3 +883,30 @@ void Score_NicePrint(entity to) } } +void PlayerScore_PlayerStats(entity p) +{ + entity s; + float i; + s = p.scorekeeper; + + for(i = 0; i < MAX_SCORE; ++i) + if(s.(scores[i]) != 0) + if(scores_label[i] != "") + PlayerStats_Event(s.owner, strcat(PLAYERSTATS_SCOREBOARD, scores_label[i]), s.(scores[i])); +} + +void PlayerScore_TeamStats(void) +{ + entity sk; + float t, i; + for(t = 0; t < 16; ++t) + { + sk = teamscorekeepers[t]; + if(!sk) + continue; + for(i = 0; i < MAX_TEAMSCORE; ++i) + if(sk.(teamscores[i]) != 0) + if(teamscores_label[i] != "") + PlayerStats_TeamScore(t, strcat(PLAYERSTATS_SCOREBOARD, teamscores_label[i]), sk.(teamscores[i])); + } +}