Skip to content

Commit

Permalink
Get mapWinInfo from client, bump version
Browse files Browse the repository at this point in the history
  • Loading branch information
DarkView committed Jan 10, 2025
1 parent 9d0cf8f commit 3f94665
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 2 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "spectra-server",
"version": "0.2.11",
"version": "0.2.12",
"author": {
"name": "Spectra Team",
"url": "https://valospectra.com"
Expand Down
11 changes: 11 additions & 0 deletions src/model/Match.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@ export class Match {
private spikeState: SpikeStates = { planted: false, detonated: false, defused: false };
private attackersWon: boolean = false;

private mapsNeeded: number = 1;
private mapsWonLeft: number = 0;
private mapsWonRight: number = 0;

// private ranks: { team1: string[]; team2: string[] } = { team1: [], team2: [] };

private replayLog: ReplayLogging;
Expand All @@ -52,6 +56,13 @@ export class Match {
this.teams.push(firstTeam);
this.teams.push(secondTeam);

this.mapsNeeded =
typeof data.mapWinInfo.mapsNeeded == "number" ? data.mapWinInfo.mapsNeeded : 1;
this.mapsWonLeft =
typeof data.mapWinInfo.mapsWonLeft == "number" ? data.mapWinInfo.mapsWonLeft : 0;
this.mapsWonRight =
typeof data.mapWinInfo.mapsWonRight == "number" ? data.mapWinInfo.mapsWonRight : 0;

if (process.env.USE_BACKEND === "true") {
this.organizationId = data.organizationId || "";
}
Expand Down
7 changes: 7 additions & 0 deletions src/model/eventData.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ export interface IAUthenticationData {
groupCode: string;
leftTeam: AuthTeam;
rightTeam: AuthTeam;
mapWinInfo: IMapWinInfo;
organizationId?: string;
}

Expand All @@ -109,3 +110,9 @@ export function isAuthedData(data: object): data is IAuthedData {
}
return false;
}

export interface IMapWinInfo {
mapsNeeded: number;
mapsWonLeft: number;
mapsWonRight: number;
}
1 change: 1 addition & 0 deletions src/replay/ReplayConnectorService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ export class ReplayConnectorService {
key: this.key,
leftTeam: this.leftTeam,
rightTeam: this.rightTeam,
mapWinInfo: { mapsNeeded: 1, mapsWonLeft: 0, mapsWonRight: 0 },
};
this.ws.emit("obs_logon", JSON.stringify(authData));

Expand Down
2 changes: 1 addition & 1 deletion src/util/CompatibleClients.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import semver from "semver";

export function isCompatibleVersion(version: string): boolean {
return semver.satisfies(version, `>=0.2.6 <0.3.0`);
return semver.satisfies(version, `>=0.2.9 <0.3.0`);
}

0 comments on commit 3f94665

Please sign in to comment.