volleyballsimtypes 0.0.201 → 0.0.203

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,12 +1,10 @@
1
1
  import { CourtPosition } from './court-position';
2
2
  import { RallyEvent } from '../event';
3
- import { Team } from '../team';
4
3
  interface RallyParams {
5
4
  readonly id: string;
6
5
  readonly order: number;
7
6
  readonly servingTeamId: string;
8
7
  readonly events: RallyEvent[];
9
- winner?: Team;
10
8
  }
11
9
  export interface PlayerPosition {
12
10
  position: CourtPosition;
@@ -17,8 +15,7 @@ export declare class Rally {
17
15
  readonly servingTeamId: string;
18
16
  readonly events: RallyEvent[];
19
17
  readonly order: number;
20
- winner?: Team;
21
- constructor({ id, order, servingTeamId, events, winner }: RallyParams);
18
+ constructor({ id, order, servingTeamId, events }: RallyParams);
22
19
  addEvent(event: RallyEvent): void;
23
20
  }
24
21
  export {};
@@ -3,13 +3,12 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.Rally = void 0;
4
4
  const utils_1 = require("../utils");
5
5
  class Rally {
6
- constructor({ id, order, servingTeamId, events, winner }) {
6
+ constructor({ id, order, servingTeamId, events }) {
7
7
  (0, utils_1.validateUUID)(id);
8
8
  this.id = id;
9
9
  this.order = order;
10
10
  this.servingTeamId = servingTeamId;
11
11
  this.events = events;
12
- this.winner = winner;
13
12
  }
14
13
  addEvent(event) {
15
14
  this.events.push(event);
@@ -22,4 +22,5 @@ export declare class Tactics {
22
22
  readonly liberoReplacements: Player[];
23
23
  readonly pinchServerSubs: Map<Player, Player>;
24
24
  constructor({ lineup, pinchServerSubs, liberoReplacements, substitutionTolerance }: TacticsOpts);
25
+ findPlayerInLineup(id: string): CourtPosition | undefined;
25
26
  }
@@ -9,5 +9,23 @@ class Tactics {
9
9
  this.pinchServerSubs = pinchServerSubs;
10
10
  this.liberoReplacements = liberoReplacements;
11
11
  }
12
+ findPlayerInLineup(id) {
13
+ if (this.lineup.bench.some(p => p.id === id))
14
+ return match_1.CourtPosition.NOT_IN_COURT;
15
+ if (this.lineup[match_1.CourtPosition.LEFT_FRONT].id === id)
16
+ return match_1.CourtPosition.LEFT_FRONT;
17
+ if (this.lineup[match_1.CourtPosition.MIDDLE_FRONT].id === id)
18
+ return match_1.CourtPosition.MIDDLE_FRONT;
19
+ if (this.lineup[match_1.CourtPosition.RIGHT_FRONT].id === id)
20
+ return match_1.CourtPosition.RIGHT_FRONT;
21
+ if (this.lineup[match_1.CourtPosition.LEFT_BACK].id === id)
22
+ return match_1.CourtPosition.LEFT_BACK;
23
+ if (this.lineup[match_1.CourtPosition.MIDDLE_BACK].id === id)
24
+ return match_1.CourtPosition.MIDDLE_BACK;
25
+ if (this.lineup[match_1.CourtPosition.RIGHT_BACK].id === id)
26
+ return match_1.CourtPosition.RIGHT_BACK;
27
+ if (this.lineup[match_1.CourtPosition.LIBERO_ZONE]?.id === id)
28
+ return match_1.CourtPosition.LIBERO_ZONE;
29
+ }
12
30
  }
13
31
  exports.Tactics = Tactics;
@@ -1,12 +1,10 @@
1
1
  import { CourtPosition } from './court-position';
2
2
  import { RallyEvent } from '../event';
3
- import { Team } from '../team';
4
3
  interface RallyParams {
5
4
  readonly id: string;
6
5
  readonly order: number;
7
6
  readonly servingTeamId: string;
8
7
  readonly events: RallyEvent[];
9
- winner?: Team;
10
8
  }
11
9
  export interface PlayerPosition {
12
10
  position: CourtPosition;
@@ -17,8 +15,7 @@ export declare class Rally {
17
15
  readonly servingTeamId: string;
18
16
  readonly events: RallyEvent[];
19
17
  readonly order: number;
20
- winner?: Team;
21
- constructor({ id, order, servingTeamId, events, winner }: RallyParams);
18
+ constructor({ id, order, servingTeamId, events }: RallyParams);
22
19
  addEvent(event: RallyEvent): void;
23
20
  }
24
21
  export {};
@@ -1,12 +1,11 @@
1
1
  import { validateUUID } from '../utils';
2
2
  export class Rally {
3
- constructor({ id, order, servingTeamId, events, winner }) {
3
+ constructor({ id, order, servingTeamId, events }) {
4
4
  validateUUID(id);
5
5
  this.id = id;
6
6
  this.order = order;
7
7
  this.servingTeamId = servingTeamId;
8
8
  this.events = events;
9
- this.winner = winner;
10
9
  }
11
10
  addEvent(event) {
12
11
  this.events.push(event);
@@ -22,4 +22,5 @@ export declare class Tactics {
22
22
  readonly liberoReplacements: Player[];
23
23
  readonly pinchServerSubs: Map<Player, Player>;
24
24
  constructor({ lineup, pinchServerSubs, liberoReplacements, substitutionTolerance }: TacticsOpts);
25
+ findPlayerInLineup(id: string): CourtPosition | undefined;
25
26
  }
@@ -6,4 +6,22 @@ export class Tactics {
6
6
  this.pinchServerSubs = pinchServerSubs;
7
7
  this.liberoReplacements = liberoReplacements;
8
8
  }
9
+ findPlayerInLineup(id) {
10
+ if (this.lineup.bench.some(p => p.id === id))
11
+ return CourtPosition.NOT_IN_COURT;
12
+ if (this.lineup[CourtPosition.LEFT_FRONT].id === id)
13
+ return CourtPosition.LEFT_FRONT;
14
+ if (this.lineup[CourtPosition.MIDDLE_FRONT].id === id)
15
+ return CourtPosition.MIDDLE_FRONT;
16
+ if (this.lineup[CourtPosition.RIGHT_FRONT].id === id)
17
+ return CourtPosition.RIGHT_FRONT;
18
+ if (this.lineup[CourtPosition.LEFT_BACK].id === id)
19
+ return CourtPosition.LEFT_BACK;
20
+ if (this.lineup[CourtPosition.MIDDLE_BACK].id === id)
21
+ return CourtPosition.MIDDLE_BACK;
22
+ if (this.lineup[CourtPosition.RIGHT_BACK].id === id)
23
+ return CourtPosition.RIGHT_BACK;
24
+ if (this.lineup[CourtPosition.LIBERO_ZONE]?.id === id)
25
+ return CourtPosition.LIBERO_ZONE;
26
+ }
9
27
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "volleyballsimtypes",
3
- "version": "0.0.201",
3
+ "version": "0.0.203",
4
4
  "description": "vbsim types",
5
5
  "main": "./dist/cjs/src/index.js",
6
6
  "module": "./dist/esm/src/index.js",