Skip to content

Commit

Permalink
Add forfeit param to web api integration.
Browse files Browse the repository at this point in the history
  • Loading branch information
splewis committed Jul 3, 2016
1 parent 027b8b0 commit b57520a
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
4 changes: 1 addition & 3 deletions scripting/get5/stats.sp
Original file line number Diff line number Diff line change
Expand Up @@ -122,9 +122,7 @@ public void Stats_UpdateMapScore(MatchTeam winner) {
}

public void Stats_Forfeit(MatchTeam team) {
GoToTeam(team);
g_StatsKv.SetNum(STAT_TEAMFORFEIT, 1);
GoBackFromTeam();
g_StatsKv.SetNum(STAT_SERIES_FORFEIT, 1);

if (team == MatchTeam_Team1)
Stats_SeriesEnd(MatchTeam_Team2);
Expand Down
7 changes: 7 additions & 0 deletions scripting/get5_apistats.sp
Original file line number Diff line number Diff line change
Expand Up @@ -232,9 +232,16 @@ public void Get5_OnSeriesResult(MatchTeam seriesWinner,
int team1MapScore, int team2MapScore) {
char winnerString[64];
GetTeamString(seriesWinner, winnerString, sizeof(winnerString));

KeyValues kv = new KeyValues("Stats");
Get5_GetMatchStats(kv);
bool forfeit = kv.GetNum(STAT_SERIES_FORFEIT, 0) != 0;
delete kv;

Handle req = CreateRequest(k_EHTTPMethodPOST, "match/%d/finish", g_MatchID);
if (req != INVALID_HANDLE) {
AddStringParam(req, "winner", winnerString);
AddIntParam(req, "forfiet", forfeit);
SteamWorks_SendHTTPRequest(req);
}

Expand Down
2 changes: 1 addition & 1 deletion scripting/include/get5.inc
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@ native int Get5_IncreasePlayerStat(int client, const char[] statName, int amount
#define STAT_SERIESTYPE "series_type"
#define STAT_SERIES_TEAM1NAME "team1_name"
#define STAT_SERIES_TEAM2NAME "team2_name"
#define STAT_SERIES_FORFEIT "forfeit"

// Map stats (under "map0", "map1", etc.)
#define STAT_MAPNAME "mapname"
Expand All @@ -150,7 +151,6 @@ native int Get5_IncreasePlayerStat(int client, const char[] statName, int amount

// Team stats (under map section, then "team1" or "team2")
#define STAT_TEAMSCORE "score"
#define STAT_TEAMFORFEIT "forfeit"

// Player stats (under map section, then team section, then player's steam64)
#define STAT_NAME "name"
Expand Down

0 comments on commit b57520a

Please sign in to comment.