volleyballsimtypes 0.0.175 → 0.0.176

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.
Files changed (51) hide show
  1. package/dist/cjs/src/data/transformers/events.d.ts +8 -0
  2. package/dist/cjs/src/data/transformers/events.js +75 -0
  3. package/dist/cjs/src/data/transformers/rally.js +31 -1
  4. package/dist/cjs/src/service/event/block.d.ts +36 -0
  5. package/dist/cjs/src/service/event/block.js +37 -0
  6. package/dist/cjs/src/service/event/in-play-event.d.ts +17 -0
  7. package/dist/cjs/src/service/event/in-play-event.js +21 -0
  8. package/dist/cjs/src/service/event/index.d.ts +8 -1
  9. package/dist/cjs/src/service/event/index.js +8 -1
  10. package/dist/cjs/src/service/event/libero-replacement.d.ts +18 -0
  11. package/dist/cjs/src/service/event/libero-replacement.js +25 -0
  12. package/dist/cjs/src/service/event/rally-event.d.ts +13 -4
  13. package/dist/cjs/src/service/event/rally-event.js +13 -3
  14. package/dist/cjs/src/service/event/reception.d.ts +33 -0
  15. package/dist/cjs/src/service/event/reception.js +34 -0
  16. package/dist/cjs/src/service/event/serve.d.ts +33 -0
  17. package/dist/cjs/src/service/event/serve.js +34 -0
  18. package/dist/cjs/src/service/event/set.d.ts +31 -0
  19. package/dist/cjs/src/service/event/set.js +32 -0
  20. package/dist/cjs/src/service/event/spike.d.ts +35 -0
  21. package/dist/cjs/src/service/event/spike.js +36 -0
  22. package/dist/cjs/src/service/event/substitution.d.ts +11 -0
  23. package/dist/cjs/src/service/event/substitution.js +18 -0
  24. package/dist/esm/src/data/transformers/events.d.ts +8 -0
  25. package/dist/esm/src/data/transformers/events.js +65 -0
  26. package/dist/esm/src/data/transformers/rally.js +31 -1
  27. package/dist/esm/src/service/event/block.d.ts +36 -0
  28. package/dist/esm/src/service/event/block.js +33 -0
  29. package/dist/esm/src/service/event/in-play-event.d.ts +17 -0
  30. package/dist/esm/src/service/event/in-play-event.js +17 -0
  31. package/dist/esm/src/service/event/index.d.ts +8 -1
  32. package/dist/esm/src/service/event/index.js +8 -1
  33. package/dist/esm/src/service/event/libero-replacement.d.ts +18 -0
  34. package/dist/esm/src/service/event/libero-replacement.js +21 -0
  35. package/dist/esm/src/service/event/rally-event.d.ts +13 -4
  36. package/dist/esm/src/service/event/rally-event.js +12 -2
  37. package/dist/esm/src/service/event/reception.d.ts +33 -0
  38. package/dist/esm/src/service/event/reception.js +30 -0
  39. package/dist/esm/src/service/event/serve.d.ts +33 -0
  40. package/dist/esm/src/service/event/serve.js +30 -0
  41. package/dist/esm/src/service/event/set.d.ts +31 -0
  42. package/dist/esm/src/service/event/set.js +28 -0
  43. package/dist/esm/src/service/event/spike.d.ts +35 -0
  44. package/dist/esm/src/service/event/spike.js +32 -0
  45. package/dist/esm/src/service/event/substitution.d.ts +11 -0
  46. package/dist/esm/src/service/event/substitution.js +14 -0
  47. package/package.json +1 -1
  48. package/dist/cjs/src/service/event/events.d.ts +0 -93
  49. package/dist/cjs/src/service/event/events.js +0 -94
  50. package/dist/esm/src/service/event/events.d.ts +0 -93
  51. package/dist/esm/src/service/event/events.js +0 -91
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Substitution = void 0;
4
+ const rally_event_1 = require("./rally-event");
5
+ const eventType = rally_event_1.EventTypeEnum.SUBSTITUTION;
6
+ class Substitution extends rally_event_1.RallyEvent {
7
+ constructor({ playerOut, playerId }) {
8
+ super({ eventType, playerId });
9
+ this.playerOut = playerOut;
10
+ }
11
+ toString() {
12
+ const playerId = `"playerId":"${this.playerId}"`;
13
+ const playerOut = `"playerOut":"${this.playerOut}"`;
14
+ const eventType = `"eventType":${this.eventType}`;
15
+ return `{${playerId},${playerOut},${eventType}}`;
16
+ }
17
+ }
18
+ exports.Substitution = Substitution;
@@ -0,0 +1,8 @@
1
+ import { Block, LiberoReplacement, Reception, Serve, Set, Spike, Substitution } from '../../service';
2
+ export declare function transformToBlock(event: any): Block;
3
+ export declare function transformToLiberoReplacement(event: any): LiberoReplacement;
4
+ export declare function transformToReception(event: any): Reception;
5
+ export declare function transformToServe(event: any): Serve;
6
+ export declare function transformToSet(event: any): Set;
7
+ export declare function transformToSubstitution(event: any): Substitution;
8
+ export declare function transformToSpike(event: any): Spike;
@@ -0,0 +1,65 @@
1
+ import { Block, LiberoReplacement, Reception, Serve, Set, Spike, Substitution } from '../../service';
2
+ export function transformToBlock(event) {
3
+ return new Block({
4
+ failure: event.failure,
5
+ type: event.type,
6
+ playerId: event.playerId,
7
+ target: event.target,
8
+ blockers: event.blockers,
9
+ score: event.score,
10
+ activeTraits: event.activeTraits
11
+ });
12
+ }
13
+ export function transformToLiberoReplacement(event) {
14
+ return new LiberoReplacement({
15
+ playerId: event.playerId,
16
+ libero: event.libero,
17
+ type: event.type
18
+ });
19
+ }
20
+ export function transformToReception(event) {
21
+ return new Reception({
22
+ failure: event.failure,
23
+ type: event.type,
24
+ playerId: event.playerId,
25
+ target: event.target,
26
+ score: event.score,
27
+ activeTraits: event.activeTraits
28
+ });
29
+ }
30
+ export function transformToServe(event) {
31
+ return new Serve({
32
+ failure: event.failure,
33
+ type: event.type,
34
+ playerId: event.playerId,
35
+ target: event.target,
36
+ score: event.score,
37
+ activeTraits: event.activeTraits
38
+ });
39
+ }
40
+ export function transformToSet(event) {
41
+ return new Set({
42
+ failure: event.failure,
43
+ type: event.type,
44
+ playerId: event.playerId,
45
+ target: event.target,
46
+ score: event.score,
47
+ activeTraits: event.activeTraits
48
+ });
49
+ }
50
+ export function transformToSubstitution(event) {
51
+ return new Substitution({
52
+ playerId: event.playerId,
53
+ playerOut: event.playerIdOut
54
+ });
55
+ }
56
+ export function transformToSpike(event) {
57
+ return new Spike({
58
+ failure: event.failure,
59
+ type: event.type,
60
+ playerId: event.playerId,
61
+ target: event.target,
62
+ score: event.score,
63
+ activeTraits: event.activeTraits
64
+ });
65
+ }
@@ -1,6 +1,7 @@
1
1
  import { Rally } from '../../service';
2
2
  import { compressToBase64, decompressFromBase64 } from 'lz-string';
3
3
  import { transformToTeam } from './team';
4
+ import { transformToBlock, transformToLiberoReplacement, transformToReception, transformToServe, transformToSet, transformToSpike, transformToSubstitution } from './events';
4
5
  function transformToAttributes(rally, setId) {
5
6
  const events = `[${rally.events.map((e) => e.toString()).join(',')}]`;
6
7
  return {
@@ -12,7 +13,36 @@ function transformToAttributes(rally, setId) {
12
13
  };
13
14
  }
14
15
  function transformToObject(model) {
15
- const events = JSON.parse(decompressFromBase64(model.events));
16
+ const decompressed = decompressFromBase64(model.events);
17
+ const parsed = JSON.parse(decompressed);
18
+ const events = [];
19
+ parsed.forEach(event => {
20
+ switch (event.eventType) {
21
+ case 0:
22
+ events.push(transformToLiberoReplacement(event));
23
+ break;
24
+ case 1:
25
+ events.push(transformToSubstitution(event));
26
+ break;
27
+ case 2:
28
+ events.push(transformToServe(event));
29
+ break;
30
+ case 3:
31
+ events.push(transformToReception(event));
32
+ break;
33
+ case 4:
34
+ events.push(transformToSet(event));
35
+ break;
36
+ case 5:
37
+ events.push(transformToSpike(event));
38
+ break;
39
+ case 6:
40
+ events.push(transformToBlock(event));
41
+ break;
42
+ default:
43
+ throw new Error('UNKNOWN_EVENT');
44
+ }
45
+ });
16
46
  return new Rally({
17
47
  id: model.rally_id,
18
48
  order: model.order,
@@ -0,0 +1,36 @@
1
+ import { InPlayEvent } from './in-play-event';
2
+ import { CourtTarget } from '../match';
3
+ import { Trait } from '../player';
4
+ export declare enum BlockFailureEnum {
5
+ NO_FAILURE = 0,
6
+ MISS = 1,
7
+ FAULT = 2,
8
+ OUT_OF_BOUNDS = 3,
9
+ WIPE = 4,
10
+ TOOL = 5
11
+ }
12
+ export type BlockFailure = BlockFailureEnum.NO_FAILURE | BlockFailureEnum.MISS | BlockFailureEnum.FAULT | BlockFailureEnum.OUT_OF_BOUNDS | BlockFailureEnum.WIPE | BlockFailureEnum.TOOL;
13
+ export declare enum BlockTypeEnum {
14
+ NO_BLOCKER = 0,
15
+ SINGLE = 1,
16
+ DOUBLE = 2,
17
+ TRIPLE = 3
18
+ }
19
+ export type BlockType = BlockTypeEnum.NO_BLOCKER | BlockTypeEnum.SINGLE | BlockTypeEnum.DOUBLE | BlockTypeEnum.TRIPLE;
20
+ interface BlockOpts {
21
+ readonly type: BlockType;
22
+ readonly failure: BlockFailure;
23
+ readonly blockers: string[];
24
+ readonly target: CourtTarget;
25
+ readonly score: number;
26
+ readonly activeTraits: Trait[];
27
+ readonly playerId: string;
28
+ }
29
+ export declare class Block extends InPlayEvent<BlockFailure, BlockType> {
30
+ readonly failure: BlockFailure;
31
+ readonly type: BlockType;
32
+ readonly blockers: string[];
33
+ constructor({ score, playerId, target, failure, type, blockers, activeTraits }: BlockOpts);
34
+ toString(): string;
35
+ }
36
+ export {};
@@ -0,0 +1,33 @@
1
+ import { InPlayEvent } from './in-play-event';
2
+ import { EventTypeEnum } from './rally-event';
3
+ export var BlockFailureEnum;
4
+ (function (BlockFailureEnum) {
5
+ BlockFailureEnum[BlockFailureEnum["NO_FAILURE"] = 0] = "NO_FAILURE";
6
+ BlockFailureEnum[BlockFailureEnum["MISS"] = 1] = "MISS";
7
+ BlockFailureEnum[BlockFailureEnum["FAULT"] = 2] = "FAULT";
8
+ BlockFailureEnum[BlockFailureEnum["OUT_OF_BOUNDS"] = 3] = "OUT_OF_BOUNDS";
9
+ BlockFailureEnum[BlockFailureEnum["WIPE"] = 4] = "WIPE";
10
+ BlockFailureEnum[BlockFailureEnum["TOOL"] = 5] = "TOOL";
11
+ })(BlockFailureEnum || (BlockFailureEnum = {}));
12
+ export var BlockTypeEnum;
13
+ (function (BlockTypeEnum) {
14
+ BlockTypeEnum[BlockTypeEnum["NO_BLOCKER"] = 0] = "NO_BLOCKER";
15
+ BlockTypeEnum[BlockTypeEnum["SINGLE"] = 1] = "SINGLE";
16
+ BlockTypeEnum[BlockTypeEnum["DOUBLE"] = 2] = "DOUBLE";
17
+ BlockTypeEnum[BlockTypeEnum["TRIPLE"] = 3] = "TRIPLE";
18
+ })(BlockTypeEnum || (BlockTypeEnum = {}));
19
+ const eventType = EventTypeEnum.BLOCK;
20
+ export class Block extends InPlayEvent {
21
+ constructor({ score, playerId, target, failure, type, blockers, activeTraits }) {
22
+ super({ score, playerId, target, activeTraits, eventType });
23
+ this.type = type;
24
+ this.failure = failure;
25
+ this.blockers = blockers;
26
+ }
27
+ toString() {
28
+ const failure = `"failure":${this.failure}`;
29
+ const type = `"type":${this.type}`;
30
+ const blockers = `"blockers":[${this.blockers.map(b => `"${b}"`).join(',')}]`;
31
+ return `{${this._toString()},${failure},${type},${blockers}}`;
32
+ }
33
+ }
@@ -0,0 +1,17 @@
1
+ import { CourtTarget } from '../match';
2
+ import { RallyEvent, RallyEventOpts } from './rally-event';
3
+ import { Trait } from '../player';
4
+ export interface InPlayEventOpts extends RallyEventOpts {
5
+ readonly target: CourtTarget;
6
+ readonly score: number;
7
+ readonly activeTraits: Trait[];
8
+ }
9
+ export declare abstract class InPlayEvent<F, T> extends RallyEvent {
10
+ abstract failure: F;
11
+ abstract type: T;
12
+ readonly target: CourtTarget;
13
+ readonly score: number;
14
+ readonly activeTraits: Trait[];
15
+ protected constructor({ eventType, playerId, target, score, activeTraits }: InPlayEventOpts);
16
+ protected _toString(): string;
17
+ }
@@ -0,0 +1,17 @@
1
+ import { RallyEvent } from './rally-event';
2
+ export class InPlayEvent extends RallyEvent {
3
+ constructor({ eventType, playerId, target, score, activeTraits }) {
4
+ super({ playerId, eventType });
5
+ this.target = target;
6
+ this.score = score;
7
+ this.activeTraits = activeTraits;
8
+ }
9
+ _toString() {
10
+ const score = `"score":${this.score}`;
11
+ const playerId = `"playerId":"${this.playerId}"`;
12
+ const target = `"target":${this.target}`;
13
+ const eventType = `"eventType":${this.eventType}`;
14
+ const traits = `"activeTraits":[${this.activeTraits.map(t => `"${t}"`).join(',')}]`;
15
+ return `${score},${playerId},${target},${eventType},${traits}`;
16
+ }
17
+ }
@@ -1,2 +1,9 @@
1
+ export * from './block';
2
+ export * from './in-play-event';
3
+ export * from './libero-replacement';
1
4
  export * from './rally-event';
2
- export * from './events';
5
+ export * from './reception';
6
+ export * from './serve';
7
+ export * from './set';
8
+ export * from './spike';
9
+ export * from './substitution';
@@ -1,2 +1,9 @@
1
+ export * from './block';
2
+ export * from './in-play-event';
3
+ export * from './libero-replacement';
1
4
  export * from './rally-event';
2
- export * from './events';
5
+ export * from './reception';
6
+ export * from './serve';
7
+ export * from './set';
8
+ export * from './spike';
9
+ export * from './substitution';
@@ -0,0 +1,18 @@
1
+ import { RallyEvent } from './rally-event';
2
+ export declare enum LiberoReplacementTypeEnum {
3
+ LIBERO_IN = 0,
4
+ LIBERO_OUT = 1
5
+ }
6
+ export type LiberoReplacementType = LiberoReplacementTypeEnum.LIBERO_IN | LiberoReplacementTypeEnum.LIBERO_OUT;
7
+ interface LiberoReplacementOpts {
8
+ readonly playerId: string;
9
+ readonly libero: string;
10
+ readonly type: LiberoReplacementType;
11
+ }
12
+ export declare class LiberoReplacement extends RallyEvent {
13
+ readonly type: LiberoReplacementType;
14
+ readonly libero: string;
15
+ constructor({ playerId, type, libero }: LiberoReplacementOpts);
16
+ toString(): string;
17
+ }
18
+ export {};
@@ -0,0 +1,21 @@
1
+ import { EventTypeEnum, RallyEvent } from './rally-event';
2
+ export var LiberoReplacementTypeEnum;
3
+ (function (LiberoReplacementTypeEnum) {
4
+ LiberoReplacementTypeEnum[LiberoReplacementTypeEnum["LIBERO_IN"] = 0] = "LIBERO_IN";
5
+ LiberoReplacementTypeEnum[LiberoReplacementTypeEnum["LIBERO_OUT"] = 1] = "LIBERO_OUT";
6
+ })(LiberoReplacementTypeEnum || (LiberoReplacementTypeEnum = {}));
7
+ const eventType = EventTypeEnum.LIBERO_REPLACEMENT;
8
+ export class LiberoReplacement extends RallyEvent {
9
+ constructor({ playerId, type, libero }) {
10
+ super({ playerId, eventType });
11
+ this.type = type;
12
+ this.libero = libero;
13
+ }
14
+ toString() {
15
+ const playerId = `"playerId":"${this.playerId}"`;
16
+ const type = `"type":${this.type}`;
17
+ const eventType = `"eventType":${this.eventType}`;
18
+ const libero = `"libero":"${this.libero}"`;
19
+ return `{${playerId},${type},${eventType},${libero}}`;
20
+ }
21
+ }
@@ -1,11 +1,20 @@
1
- import { EventType } from './events';
1
+ export declare enum EventTypeEnum {
2
+ LIBERO_REPLACEMENT = 0,
3
+ SUBSTITUTION = 1,
4
+ SERVE = 2,
5
+ RECEPTION = 3,
6
+ SET = 4,
7
+ SPIKE = 5,
8
+ BLOCK = 6
9
+ }
10
+ export type EventType = EventTypeEnum.LIBERO_REPLACEMENT | EventTypeEnum.SUBSTITUTION | EventTypeEnum.SERVE | EventTypeEnum.RECEPTION | EventTypeEnum.SET | EventTypeEnum.SPIKE | EventTypeEnum.BLOCK;
2
11
  export interface RallyEventOpts {
3
- readonly player: string;
12
+ readonly playerId: string;
4
13
  readonly eventType: EventType;
5
14
  }
6
15
  export declare abstract class RallyEvent {
7
- readonly player: string;
16
+ readonly playerId: string;
8
17
  readonly eventType: EventType;
9
- protected constructor({ eventType, player }: RallyEventOpts);
18
+ protected constructor({ eventType, playerId }: RallyEventOpts);
10
19
  abstract toString(): string;
11
20
  }
@@ -1,6 +1,16 @@
1
+ export var EventTypeEnum;
2
+ (function (EventTypeEnum) {
3
+ EventTypeEnum[EventTypeEnum["LIBERO_REPLACEMENT"] = 0] = "LIBERO_REPLACEMENT";
4
+ EventTypeEnum[EventTypeEnum["SUBSTITUTION"] = 1] = "SUBSTITUTION";
5
+ EventTypeEnum[EventTypeEnum["SERVE"] = 2] = "SERVE";
6
+ EventTypeEnum[EventTypeEnum["RECEPTION"] = 3] = "RECEPTION";
7
+ EventTypeEnum[EventTypeEnum["SET"] = 4] = "SET";
8
+ EventTypeEnum[EventTypeEnum["SPIKE"] = 5] = "SPIKE";
9
+ EventTypeEnum[EventTypeEnum["BLOCK"] = 6] = "BLOCK";
10
+ })(EventTypeEnum || (EventTypeEnum = {}));
1
11
  export class RallyEvent {
2
- constructor({ eventType, player }) {
3
- this.player = player;
12
+ constructor({ eventType, playerId }) {
13
+ this.playerId = playerId;
4
14
  this.eventType = eventType;
5
15
  }
6
16
  }
@@ -0,0 +1,33 @@
1
+ import { CourtTarget } from '../match';
2
+ import { Trait } from '../player';
3
+ import { InPlayEvent } from './in-play-event';
4
+ export declare enum ReceptionTypeEnum {
5
+ DIG = 0,
6
+ OVERHAND = 1,
7
+ ONE_HAND = 2,
8
+ OTHER_BODY_PART = 3
9
+ }
10
+ export type ReceptionType = ReceptionTypeEnum.DIG | ReceptionTypeEnum.OVERHAND | ReceptionTypeEnum.ONE_HAND | ReceptionTypeEnum.OTHER_BODY_PART;
11
+ export declare enum ReceptionFailureEnum {
12
+ NO_FAILURE = 0,
13
+ FAULT = 1,
14
+ MISS = 2,
15
+ OUT_OF_BOUNDS = 3,
16
+ BAD_PASS = 4
17
+ }
18
+ export type ReceptionFailure = ReceptionFailureEnum.NO_FAILURE | ReceptionFailureEnum.FAULT | ReceptionFailureEnum.MISS | ReceptionFailureEnum.OUT_OF_BOUNDS | ReceptionFailureEnum.BAD_PASS;
19
+ interface ReceptionOpts {
20
+ readonly type: ReceptionType;
21
+ readonly failure: ReceptionFailure;
22
+ readonly target: CourtTarget;
23
+ readonly score: number;
24
+ readonly activeTraits: Trait[];
25
+ readonly playerId: string;
26
+ }
27
+ export declare class Reception extends InPlayEvent<ReceptionFailure, ReceptionType> {
28
+ readonly failure: ReceptionFailure;
29
+ readonly type: ReceptionType;
30
+ constructor({ score, playerId, target, failure, type, activeTraits }: ReceptionOpts);
31
+ toString(): string;
32
+ }
33
+ export {};
@@ -0,0 +1,30 @@
1
+ import { EventTypeEnum } from './rally-event';
2
+ import { InPlayEvent } from './in-play-event';
3
+ export var ReceptionTypeEnum;
4
+ (function (ReceptionTypeEnum) {
5
+ ReceptionTypeEnum[ReceptionTypeEnum["DIG"] = 0] = "DIG";
6
+ ReceptionTypeEnum[ReceptionTypeEnum["OVERHAND"] = 1] = "OVERHAND";
7
+ ReceptionTypeEnum[ReceptionTypeEnum["ONE_HAND"] = 2] = "ONE_HAND";
8
+ ReceptionTypeEnum[ReceptionTypeEnum["OTHER_BODY_PART"] = 3] = "OTHER_BODY_PART";
9
+ })(ReceptionTypeEnum || (ReceptionTypeEnum = {}));
10
+ export var ReceptionFailureEnum;
11
+ (function (ReceptionFailureEnum) {
12
+ ReceptionFailureEnum[ReceptionFailureEnum["NO_FAILURE"] = 0] = "NO_FAILURE";
13
+ ReceptionFailureEnum[ReceptionFailureEnum["FAULT"] = 1] = "FAULT";
14
+ ReceptionFailureEnum[ReceptionFailureEnum["MISS"] = 2] = "MISS";
15
+ ReceptionFailureEnum[ReceptionFailureEnum["OUT_OF_BOUNDS"] = 3] = "OUT_OF_BOUNDS";
16
+ ReceptionFailureEnum[ReceptionFailureEnum["BAD_PASS"] = 4] = "BAD_PASS";
17
+ })(ReceptionFailureEnum || (ReceptionFailureEnum = {}));
18
+ const eventType = EventTypeEnum.RECEPTION;
19
+ export class Reception extends InPlayEvent {
20
+ constructor({ score, playerId, target, failure, type, activeTraits }) {
21
+ super({ score, playerId, target, activeTraits, eventType });
22
+ this.type = type;
23
+ this.failure = failure;
24
+ }
25
+ toString() {
26
+ const failure = `"failure":${this.failure}`;
27
+ const type = `"type":${this.type}`;
28
+ return `{${this._toString()},${failure},${type}}`;
29
+ }
30
+ }
@@ -0,0 +1,33 @@
1
+ import { CourtTarget } from '../match';
2
+ import { Trait } from '../player';
3
+ import { InPlayEvent } from './in-play-event';
4
+ export declare enum ServeTypeEnum {
5
+ OVERHAND_TOPSPIN = 0,
6
+ OVERHAND_FLOAT = 1,
7
+ JUMP_TOPSPIN = 2,
8
+ JUMP_FLOAT = 3
9
+ }
10
+ export type ServeType = ServeTypeEnum.OVERHAND_TOPSPIN | ServeTypeEnum.OVERHAND_FLOAT | ServeTypeEnum.JUMP_TOPSPIN | ServeTypeEnum.JUMP_FLOAT;
11
+ export declare enum ServeFailureEnum {
12
+ NO_FAILURE = 0,
13
+ FAULT = 1,
14
+ MISS = 2,
15
+ NET = 3,
16
+ OUT_OF_BOUNDS = 4
17
+ }
18
+ export type ServeFailure = ServeFailureEnum.NO_FAILURE | ServeFailureEnum.FAULT | ServeFailureEnum.MISS | ServeFailureEnum.NET | ServeFailureEnum.OUT_OF_BOUNDS;
19
+ interface ServeOpts {
20
+ readonly type: ServeType;
21
+ readonly failure: ServeFailure;
22
+ readonly target: CourtTarget;
23
+ readonly score: number;
24
+ readonly activeTraits: Trait[];
25
+ readonly playerId: string;
26
+ }
27
+ export declare class Serve extends InPlayEvent<ServeFailure, ServeType> {
28
+ readonly failure: ServeFailure;
29
+ readonly type: ServeType;
30
+ constructor({ score, playerId, target, failure, type, activeTraits }: ServeOpts);
31
+ toString(): string;
32
+ }
33
+ export {};
@@ -0,0 +1,30 @@
1
+ import { EventTypeEnum } from './rally-event';
2
+ import { InPlayEvent } from './in-play-event';
3
+ export var ServeTypeEnum;
4
+ (function (ServeTypeEnum) {
5
+ ServeTypeEnum[ServeTypeEnum["OVERHAND_TOPSPIN"] = 0] = "OVERHAND_TOPSPIN";
6
+ ServeTypeEnum[ServeTypeEnum["OVERHAND_FLOAT"] = 1] = "OVERHAND_FLOAT";
7
+ ServeTypeEnum[ServeTypeEnum["JUMP_TOPSPIN"] = 2] = "JUMP_TOPSPIN";
8
+ ServeTypeEnum[ServeTypeEnum["JUMP_FLOAT"] = 3] = "JUMP_FLOAT";
9
+ })(ServeTypeEnum || (ServeTypeEnum = {}));
10
+ export var ServeFailureEnum;
11
+ (function (ServeFailureEnum) {
12
+ ServeFailureEnum[ServeFailureEnum["NO_FAILURE"] = 0] = "NO_FAILURE";
13
+ ServeFailureEnum[ServeFailureEnum["FAULT"] = 1] = "FAULT";
14
+ ServeFailureEnum[ServeFailureEnum["MISS"] = 2] = "MISS";
15
+ ServeFailureEnum[ServeFailureEnum["NET"] = 3] = "NET";
16
+ ServeFailureEnum[ServeFailureEnum["OUT_OF_BOUNDS"] = 4] = "OUT_OF_BOUNDS";
17
+ })(ServeFailureEnum || (ServeFailureEnum = {}));
18
+ const eventType = EventTypeEnum.SERVE;
19
+ export class Serve extends InPlayEvent {
20
+ constructor({ score, playerId, target, failure, type, activeTraits }) {
21
+ super({ score, playerId, target, activeTraits, eventType });
22
+ this.type = type;
23
+ this.failure = failure;
24
+ }
25
+ toString() {
26
+ const failure = `"failure":${this.failure}`;
27
+ const type = `"type":${this.type}`;
28
+ return `{${this._toString()},${failure},${type}}`;
29
+ }
30
+ }
@@ -0,0 +1,31 @@
1
+ import { CourtTarget } from '../match';
2
+ import { Trait } from '../player';
3
+ import { InPlayEvent } from './in-play-event';
4
+ export declare enum SetTypeEnum {
5
+ OVERHAND = 0,
6
+ DUMP = 1
7
+ }
8
+ export type SetType = SetTypeEnum.OVERHAND | SetTypeEnum.DUMP;
9
+ export declare enum SetFailureEnum {
10
+ NO_FAILURE = 0,
11
+ FAULT = 1,
12
+ MISS = 2,
13
+ BAD_PASS = 3,
14
+ OUT_OF_BOUNDS = 4
15
+ }
16
+ export type SetFailure = SetFailureEnum.NO_FAILURE | SetFailureEnum.FAULT | SetFailureEnum.MISS | SetFailureEnum.BAD_PASS | SetFailureEnum.OUT_OF_BOUNDS;
17
+ interface SetOpts {
18
+ readonly type: SetType;
19
+ readonly failure: SetFailure;
20
+ readonly target: CourtTarget;
21
+ readonly score: number;
22
+ readonly activeTraits: Trait[];
23
+ readonly playerId: string;
24
+ }
25
+ export declare class Set extends InPlayEvent<SetFailure, SetType> {
26
+ readonly failure: SetFailure;
27
+ readonly type: SetType;
28
+ constructor({ score, playerId, target, failure, type, activeTraits }: SetOpts);
29
+ toString(): string;
30
+ }
31
+ export {};
@@ -0,0 +1,28 @@
1
+ import { EventTypeEnum } from './rally-event';
2
+ import { InPlayEvent } from './in-play-event';
3
+ export var SetTypeEnum;
4
+ (function (SetTypeEnum) {
5
+ SetTypeEnum[SetTypeEnum["OVERHAND"] = 0] = "OVERHAND";
6
+ SetTypeEnum[SetTypeEnum["DUMP"] = 1] = "DUMP";
7
+ })(SetTypeEnum || (SetTypeEnum = {}));
8
+ export var SetFailureEnum;
9
+ (function (SetFailureEnum) {
10
+ SetFailureEnum[SetFailureEnum["NO_FAILURE"] = 0] = "NO_FAILURE";
11
+ SetFailureEnum[SetFailureEnum["FAULT"] = 1] = "FAULT";
12
+ SetFailureEnum[SetFailureEnum["MISS"] = 2] = "MISS";
13
+ SetFailureEnum[SetFailureEnum["BAD_PASS"] = 3] = "BAD_PASS";
14
+ SetFailureEnum[SetFailureEnum["OUT_OF_BOUNDS"] = 4] = "OUT_OF_BOUNDS";
15
+ })(SetFailureEnum || (SetFailureEnum = {}));
16
+ const eventType = EventTypeEnum.SET;
17
+ export class Set extends InPlayEvent {
18
+ constructor({ score, playerId, target, failure, type, activeTraits }) {
19
+ super({ score, playerId, target, activeTraits, eventType });
20
+ this.type = type;
21
+ this.failure = failure;
22
+ }
23
+ toString() {
24
+ const failure = `"failure":${this.failure}`;
25
+ const type = `"type":${this.type}`;
26
+ return `{${this._toString()},${failure},${type}}`;
27
+ }
28
+ }
@@ -0,0 +1,35 @@
1
+ import { CourtTarget } from '../match';
2
+ import { Trait } from '../player';
3
+ import { InPlayEvent } from './in-play-event';
4
+ export declare enum SpikeTypeEnum {
5
+ CROSS_SHOT = 0,
6
+ LINE_SHOT = 1,
7
+ REVERSE_CROSS = 2,
8
+ TIP = 3,
9
+ DOWN_BALL = 4,
10
+ OVERHAND = 5
11
+ }
12
+ export type SpikeType = SpikeTypeEnum.CROSS_SHOT | SpikeTypeEnum.LINE_SHOT | SpikeTypeEnum.REVERSE_CROSS | SpikeTypeEnum.TIP | SpikeTypeEnum.DOWN_BALL | SpikeTypeEnum.OVERHAND;
13
+ export declare enum SpikeFailureEnum {
14
+ NO_FAILURE = 0,
15
+ FAULT = 1,
16
+ MISS = 2,
17
+ OUT_OF_BOUNDS = 3,
18
+ NET = 4
19
+ }
20
+ export type SpikeFailure = SpikeFailureEnum.NO_FAILURE | SpikeFailureEnum.FAULT | SpikeFailureEnum.MISS | SpikeFailureEnum.OUT_OF_BOUNDS | SpikeFailureEnum.NET;
21
+ interface SpikeOpts {
22
+ readonly type: SpikeType;
23
+ readonly failure: SpikeFailure;
24
+ readonly target: CourtTarget;
25
+ readonly score: number;
26
+ readonly activeTraits: Trait[];
27
+ readonly playerId: string;
28
+ }
29
+ export declare class Spike extends InPlayEvent<SpikeFailure, SpikeType> {
30
+ readonly failure: SpikeFailure;
31
+ readonly type: SpikeType;
32
+ constructor({ score, playerId, target, failure, type, activeTraits }: SpikeOpts);
33
+ toString(): string;
34
+ }
35
+ export {};
@@ -0,0 +1,32 @@
1
+ import { EventTypeEnum } from './rally-event';
2
+ import { InPlayEvent } from './in-play-event';
3
+ export var SpikeTypeEnum;
4
+ (function (SpikeTypeEnum) {
5
+ SpikeTypeEnum[SpikeTypeEnum["CROSS_SHOT"] = 0] = "CROSS_SHOT";
6
+ SpikeTypeEnum[SpikeTypeEnum["LINE_SHOT"] = 1] = "LINE_SHOT";
7
+ SpikeTypeEnum[SpikeTypeEnum["REVERSE_CROSS"] = 2] = "REVERSE_CROSS";
8
+ SpikeTypeEnum[SpikeTypeEnum["TIP"] = 3] = "TIP";
9
+ SpikeTypeEnum[SpikeTypeEnum["DOWN_BALL"] = 4] = "DOWN_BALL";
10
+ SpikeTypeEnum[SpikeTypeEnum["OVERHAND"] = 5] = "OVERHAND";
11
+ })(SpikeTypeEnum || (SpikeTypeEnum = {}));
12
+ export var SpikeFailureEnum;
13
+ (function (SpikeFailureEnum) {
14
+ SpikeFailureEnum[SpikeFailureEnum["NO_FAILURE"] = 0] = "NO_FAILURE";
15
+ SpikeFailureEnum[SpikeFailureEnum["FAULT"] = 1] = "FAULT";
16
+ SpikeFailureEnum[SpikeFailureEnum["MISS"] = 2] = "MISS";
17
+ SpikeFailureEnum[SpikeFailureEnum["OUT_OF_BOUNDS"] = 3] = "OUT_OF_BOUNDS";
18
+ SpikeFailureEnum[SpikeFailureEnum["NET"] = 4] = "NET";
19
+ })(SpikeFailureEnum || (SpikeFailureEnum = {}));
20
+ const eventType = EventTypeEnum.SPIKE;
21
+ export class Spike extends InPlayEvent {
22
+ constructor({ score, playerId, target, failure, type, activeTraits }) {
23
+ super({ score, playerId, target, activeTraits, eventType });
24
+ this.type = type;
25
+ this.failure = failure;
26
+ }
27
+ toString() {
28
+ const failure = `"failure":${this.failure}`;
29
+ const type = `"type":${this.type}`;
30
+ return `{${this._toString()},${failure},${type}}`;
31
+ }
32
+ }
@@ -0,0 +1,11 @@
1
+ import { RallyEvent } from './rally-event';
2
+ interface SubstitutionOpts {
3
+ readonly playerOut: string;
4
+ readonly playerId: string;
5
+ }
6
+ export declare class Substitution extends RallyEvent {
7
+ readonly playerOut: string;
8
+ constructor({ playerOut, playerId }: SubstitutionOpts);
9
+ toString(): string;
10
+ }
11
+ export {};
@@ -0,0 +1,14 @@
1
+ import { EventTypeEnum, RallyEvent } from './rally-event';
2
+ const eventType = EventTypeEnum.SUBSTITUTION;
3
+ export class Substitution extends RallyEvent {
4
+ constructor({ playerOut, playerId }) {
5
+ super({ eventType, playerId });
6
+ this.playerOut = playerOut;
7
+ }
8
+ toString() {
9
+ const playerId = `"playerId":"${this.playerId}"`;
10
+ const playerOut = `"playerOut":"${this.playerOut}"`;
11
+ const eventType = `"eventType":${this.eventType}`;
12
+ return `{${playerId},${playerOut},${eventType}}`;
13
+ }
14
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "volleyballsimtypes",
3
- "version": "0.0.175",
3
+ "version": "0.0.176",
4
4
  "description": "vbsim types",
5
5
  "main": "./dist/cjs/src/index.js",
6
6
  "module": "./dist/esm/src/index.js",