volleyballsimtypes 0.0.174 → 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 (71) 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/match-set-stats.d.ts +1 -1
  4. package/dist/cjs/src/data/transformers/match-set-stats.js +5 -4
  5. package/dist/cjs/src/data/transformers/player.d.ts +3 -1
  6. package/dist/cjs/src/data/transformers/player.js +50 -2
  7. package/dist/cjs/src/data/transformers/rally.js +31 -1
  8. package/dist/cjs/src/data/transformers/team.d.ts +1 -1
  9. package/dist/cjs/src/data/transformers/team.js +9 -8
  10. package/dist/cjs/src/service/event/block.d.ts +36 -0
  11. package/dist/cjs/src/service/event/block.js +37 -0
  12. package/dist/cjs/src/service/event/in-play-event.d.ts +17 -0
  13. package/dist/cjs/src/service/event/in-play-event.js +21 -0
  14. package/dist/cjs/src/service/event/index.d.ts +8 -1
  15. package/dist/cjs/src/service/event/index.js +8 -1
  16. package/dist/cjs/src/service/event/libero-replacement.d.ts +18 -0
  17. package/dist/cjs/src/service/event/libero-replacement.js +25 -0
  18. package/dist/cjs/src/service/event/rally-event.d.ts +13 -4
  19. package/dist/cjs/src/service/event/rally-event.js +13 -3
  20. package/dist/cjs/src/service/event/reception.d.ts +33 -0
  21. package/dist/cjs/src/service/event/reception.js +34 -0
  22. package/dist/cjs/src/service/event/serve.d.ts +33 -0
  23. package/dist/cjs/src/service/event/serve.js +34 -0
  24. package/dist/cjs/src/service/event/set.d.ts +31 -0
  25. package/dist/cjs/src/service/event/set.js +32 -0
  26. package/dist/cjs/src/service/event/spike.d.ts +35 -0
  27. package/dist/cjs/src/service/event/spike.js +36 -0
  28. package/dist/cjs/src/service/event/substitution.d.ts +11 -0
  29. package/dist/cjs/src/service/event/substitution.js +18 -0
  30. package/dist/cjs/src/service/match/match-set.d.ts +4 -3
  31. package/dist/cjs/src/service/match/match-set.js +1 -1
  32. package/dist/cjs/src/service/player/player.d.ts +4 -1
  33. package/dist/cjs/src/service/player/player.js +2 -1
  34. package/dist/esm/src/data/transformers/events.d.ts +8 -0
  35. package/dist/esm/src/data/transformers/events.js +65 -0
  36. package/dist/esm/src/data/transformers/match-set-stats.d.ts +1 -1
  37. package/dist/esm/src/data/transformers/match-set-stats.js +5 -4
  38. package/dist/esm/src/data/transformers/player.d.ts +3 -1
  39. package/dist/esm/src/data/transformers/player.js +48 -2
  40. package/dist/esm/src/data/transformers/rally.js +31 -1
  41. package/dist/esm/src/data/transformers/team.d.ts +1 -1
  42. package/dist/esm/src/data/transformers/team.js +10 -9
  43. package/dist/esm/src/service/event/block.d.ts +36 -0
  44. package/dist/esm/src/service/event/block.js +33 -0
  45. package/dist/esm/src/service/event/in-play-event.d.ts +17 -0
  46. package/dist/esm/src/service/event/in-play-event.js +17 -0
  47. package/dist/esm/src/service/event/index.d.ts +8 -1
  48. package/dist/esm/src/service/event/index.js +8 -1
  49. package/dist/esm/src/service/event/libero-replacement.d.ts +18 -0
  50. package/dist/esm/src/service/event/libero-replacement.js +21 -0
  51. package/dist/esm/src/service/event/rally-event.d.ts +13 -4
  52. package/dist/esm/src/service/event/rally-event.js +12 -2
  53. package/dist/esm/src/service/event/reception.d.ts +33 -0
  54. package/dist/esm/src/service/event/reception.js +30 -0
  55. package/dist/esm/src/service/event/serve.d.ts +33 -0
  56. package/dist/esm/src/service/event/serve.js +30 -0
  57. package/dist/esm/src/service/event/set.d.ts +31 -0
  58. package/dist/esm/src/service/event/set.js +28 -0
  59. package/dist/esm/src/service/event/spike.d.ts +35 -0
  60. package/dist/esm/src/service/event/spike.js +32 -0
  61. package/dist/esm/src/service/event/substitution.d.ts +11 -0
  62. package/dist/esm/src/service/event/substitution.js +14 -0
  63. package/dist/esm/src/service/match/match-set.d.ts +4 -3
  64. package/dist/esm/src/service/match/match-set.js +1 -1
  65. package/dist/esm/src/service/player/player.d.ts +4 -1
  66. package/dist/esm/src/service/player/player.js +2 -1
  67. package/package.json +1 -1
  68. package/dist/cjs/src/service/event/events.d.ts +0 -93
  69. package/dist/cjs/src/service/event/events.js +0 -94
  70. package/dist/esm/src/service/event/events.d.ts +0 -93
  71. package/dist/esm/src/service/event/events.js +0 -91
@@ -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
+ }
@@ -1,6 +1,5 @@
1
1
  import { PlayerPosition, Rally } from './rally';
2
2
  import { MatchTeam } from './match-team';
3
- import { Player } from '../player';
4
3
  declare enum ScoreThreshold {
5
4
  SET = 25,
6
5
  TIE_BREAK = 15
@@ -21,7 +20,8 @@ export interface EventStat {
21
20
  error: number;
22
21
  }
23
22
  export interface SetStatistics {
24
- player: Player;
23
+ readonly playerId: string;
24
+ order: number;
25
25
  ace: number;
26
26
  attempts: number;
27
27
  contacts: number;
@@ -34,6 +34,7 @@ export interface SetStatistics {
34
34
  kills: number;
35
35
  killBlocks: number;
36
36
  assists: number;
37
+ setsPlayed: number;
37
38
  }
38
39
  export declare class MatchSet {
39
40
  readonly id: string;
@@ -52,7 +53,7 @@ export declare class MatchSet {
52
53
  increaseScore(team: MatchTeam): void;
53
54
  addRally(rally: Rally): void;
54
55
  /**
55
- * Has a team reached at least 25 points and is the score difference between both teams at least 2?
56
+ * Has a team reached at least 25 points, and is the score difference between both teams at least 2?
56
57
  * @returns boolean
57
58
  */
58
59
  isOver(): boolean;
@@ -37,7 +37,7 @@ export class MatchSet {
37
37
  this.rallies.push(rally);
38
38
  }
39
39
  /**
40
- * Has a team reached at least 25 points and is the score difference between both teams at least 2?
40
+ * Has a team reached at least 25 points, and is the score difference between both teams at least 2?
41
41
  * @returns boolean
42
42
  */
43
43
  isOver() {
@@ -4,6 +4,7 @@ import { Country } from '../country';
4
4
  import { Rarity } from './rarity';
5
5
  import { Stats } from './stats';
6
6
  import { Role } from './role';
7
+ import { SetStatistics } from '../match';
7
8
  export declare class Stat {
8
9
  readonly name: Stats;
9
10
  readonly value: number;
@@ -21,6 +22,7 @@ interface PlayerParams {
21
22
  readonly roles: Role[];
22
23
  readonly traits: Trait[];
23
24
  readonly rarity: Rarity;
25
+ readonly gameStats?: SetStatistics[];
24
26
  }
25
27
  export declare class Name {
26
28
  readonly first: string;
@@ -40,7 +42,8 @@ export declare class Player {
40
42
  readonly traits: Trait[];
41
43
  readonly generalStats: Stat[];
42
44
  readonly rarity: Rarity;
43
- constructor({ id, name, country, stats, roles, traits, rarity }: PlayerParams);
45
+ readonly gameStats?: SetStatistics[];
46
+ constructor({ id, name, country, stats, roles, traits, rarity, gameStats }: PlayerParams);
44
47
  static sortPlayers(roles: Role[]): (p1: Player, p2: Player) => number;
45
48
  static compareStats(p1: Player, p2: Player): number;
46
49
  toString(): string;
@@ -20,7 +20,7 @@ export class Name {
20
20
  }
21
21
  }
22
22
  export class Player {
23
- constructor({ id, name, country, stats, roles, traits, rarity }) {
23
+ constructor({ id, name, country, stats, roles, traits, rarity, gameStats }) {
24
24
  validateUUID(id);
25
25
  this.id = id;
26
26
  this.name = name;
@@ -29,6 +29,7 @@ export class Player {
29
29
  this.roles = roles;
30
30
  this.traits = traits;
31
31
  this.rarity = rarity;
32
+ this.gameStats = gameStats;
32
33
  this.generalStats = Object.values(StatsEnum).map((stat) => ({
33
34
  name: stat,
34
35
  value: calculateStatScore(stats, stat)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "volleyballsimtypes",
3
- "version": "0.0.174",
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",
@@ -1,93 +0,0 @@
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;
11
- export declare enum BlockFailureEnum {
12
- NO_FAILURE = 0,
13
- MISS = 1,
14
- FAULT = 2,
15
- OUT_OF_BOUNDS = 3,
16
- WIPE = 4,
17
- TOOL = 5
18
- }
19
- export type BlockFailure = BlockFailureEnum.NO_FAILURE | BlockFailureEnum.MISS | BlockFailureEnum.FAULT | BlockFailureEnum.OUT_OF_BOUNDS | BlockFailureEnum.WIPE | BlockFailureEnum.TOOL;
20
- export declare enum BlockTypeEnum {
21
- NO_BLOCKER = 0,
22
- SINGLE = 1,
23
- DOUBLE = 2,
24
- TRIPLE = 3
25
- }
26
- export type BlockType = BlockTypeEnum.NO_BLOCKER | BlockTypeEnum.SINGLE | BlockTypeEnum.DOUBLE | BlockTypeEnum.TRIPLE;
27
- export declare enum LiberoReplacementTypeEnum {
28
- LIBERO_IN = 0,
29
- LIBERO_OUT = 1
30
- }
31
- export type LiberoReplacementType = LiberoReplacementTypeEnum.LIBERO_IN | LiberoReplacementTypeEnum.LIBERO_OUT;
32
- export declare enum ReceptionTypeEnum {
33
- DIG = 0,
34
- OVERHAND = 1,
35
- ONE_HAND = 2,
36
- OTHER_BODY_PART = 3
37
- }
38
- export type ReceptionType = ReceptionTypeEnum.DIG | ReceptionTypeEnum.OVERHAND | ReceptionTypeEnum.ONE_HAND | ReceptionTypeEnum.OTHER_BODY_PART;
39
- export declare enum ReceptionFailureEnum {
40
- NO_FAILURE = 0,
41
- FAULT = 1,
42
- MISS = 2,
43
- OUT_OF_BOUNDS = 3,
44
- BAD_PASS = 4
45
- }
46
- export type ReceptionFailure = ReceptionFailureEnum.NO_FAILURE | ReceptionFailureEnum.FAULT | ReceptionFailureEnum.MISS | ReceptionFailureEnum.OUT_OF_BOUNDS | ReceptionFailureEnum.BAD_PASS;
47
- export declare enum ServeTypeEnum {
48
- OVERHAND_TOPSPIN = 0,
49
- OVERHAND_FLOAT = 1,
50
- JUMP_TOPSPIN = 2,
51
- JUMP_FLOAT = 3
52
- }
53
- export type ServeType = ServeTypeEnum.OVERHAND_TOPSPIN | ServeTypeEnum.OVERHAND_FLOAT | ServeTypeEnum.JUMP_TOPSPIN | ServeTypeEnum.JUMP_FLOAT;
54
- export declare enum ServeFailureEnum {
55
- NO_FAILURE = 0,
56
- FAULT = 1,
57
- MISS = 2,
58
- NET = 3,
59
- OUT_OF_BOUNDS = 4
60
- }
61
- export type ServeFailure = ServeFailureEnum.NO_FAILURE | ServeFailureEnum.FAULT | ServeFailureEnum.MISS | ServeFailureEnum.NET | ServeFailureEnum.OUT_OF_BOUNDS;
62
- export declare enum SetTypeEnum {
63
- OVERHAND = 0,
64
- DUMP = 1
65
- }
66
- export type SetType = SetTypeEnum.OVERHAND | SetTypeEnum.DUMP;
67
- export declare enum SetFailureEnum {
68
- NO_FAILURE = 0,
69
- FAULT = 1,
70
- MISS = 2,
71
- BAD_PASS = 3,
72
- OUT_OF_BOUNDS = 4
73
- }
74
- export type SetFailure = SetFailureEnum.NO_FAILURE | SetFailureEnum.FAULT | SetFailureEnum.MISS | SetFailureEnum.BAD_PASS | SetFailureEnum.OUT_OF_BOUNDS;
75
- export declare enum SpikeTypeEnum {
76
- CROSS_SHOT = 0,
77
- LINE_SHOT = 1,
78
- REVERSE_CROSS = 2,
79
- TIP = 3,
80
- DOWN_BALL = 4,
81
- OVERHAND = 5
82
- }
83
- export type SpikeType = SpikeTypeEnum.CROSS_SHOT | SpikeTypeEnum.LINE_SHOT | SpikeTypeEnum.REVERSE_CROSS | SpikeTypeEnum.TIP | SpikeTypeEnum.DOWN_BALL | SpikeTypeEnum.OVERHAND;
84
- export declare enum SpikeFailureEnum {
85
- NO_FAILURE = 0,
86
- FAULT = 1,
87
- MISS = 2,
88
- OUT_OF_BOUNDS = 3,
89
- NET = 4
90
- }
91
- export type SpikeFailure = SpikeFailureEnum.NO_FAILURE | SpikeFailureEnum.FAULT | SpikeFailureEnum.MISS | SpikeFailureEnum.OUT_OF_BOUNDS | SpikeFailureEnum.NET;
92
- export type EventSubType = BlockType | ReceptionType | ServeType | SetType | SpikeType;
93
- export type EventFailureType = BlockFailure | ReceptionFailure | ServeFailure | SetFailure | SpikeFailure;