volleyballsimtypes 0.0.160 → 0.0.161

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,7 +1,7 @@
1
1
  import * as Sequelize from 'sequelize';
2
2
  import { Model } from 'sequelize';
3
3
  import { CountryId, CountryModel, DraftPickId, DraftPickModel, MatchSetId, MatchSetModel, MatchSetStatsAttributes, MatchSetStatsId, MatchSetStatsModel, PerformanceStatsAttributes, PerformanceStatsId, PerformanceStatsModel, PlayerTeamId, PlayerTeamModel, PlayerTraitId, PlayerTraitModel, SetPositionId, SetPositionModel, TeamId, TeamModel, TraitId, TraitModel } from '.';
4
- import { Rarity } from '../../service/player/rarity';
4
+ import { Rarity } from '../../service';
5
5
  export interface PlayerAttributes {
6
6
  player_id: string;
7
7
  roles: RoleType[];
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.PlayerModel = void 0;
4
4
  const sequelize_1 = require("sequelize");
5
- const rarity_1 = require("../../service/player/rarity");
5
+ const service_1 = require("../../service");
6
6
  class PlayerModel extends sequelize_1.Model {
7
7
  static initModel(sequelize) {
8
8
  return PlayerModel.init({
@@ -16,7 +16,7 @@ class PlayerModel extends sequelize_1.Model {
16
16
  allowNull: false
17
17
  },
18
18
  rarity: {
19
- type: sequelize_1.DataTypes.ARRAY(sequelize_1.DataTypes.ENUM(...Object.values(rarity_1.Rarity))),
19
+ type: sequelize_1.DataTypes.ARRAY(sequelize_1.DataTypes.ENUM(...Object.values(service_1.Rarity))),
20
20
  allowNull: false
21
21
  },
22
22
  first_name: {
@@ -1,22 +1,10 @@
1
- import { PerformanceStats } from '../service';
1
+ import { PerformanceStats, PerformanceStatsParams } from '../service';
2
2
  export declare const ALL_STATS: string[];
3
3
  export type StatsTuple = typeof ALL_STATS;
4
4
  export type Stats = StatsTuple[number];
5
5
  export interface StatFormula {
6
6
  statName: Stats;
7
- weight: {
8
- serve: number;
9
- setting: number;
10
- pass: number;
11
- reception: number;
12
- spike: number;
13
- backAttack: number;
14
- jump: number;
15
- block: number;
16
- awareness: number;
17
- defense: number;
18
- stamina: number;
19
- };
7
+ weight: PerformanceStatsParams;
20
8
  }
21
9
  export declare const statsFormula: StatFormula[];
22
10
  export declare function calculateScore(performanceStats: PerformanceStats, statName: Stats): number;
@@ -12,7 +12,7 @@ function calculateScore(performanceStats, statName) {
12
12
  if (weights == null)
13
13
  throw new Error('COULD_NOT_FIND_ROLE_WEIGHT');
14
14
  const score = Object.entries(weights.weight)
15
- .reduce((score, [key, value]) => score + (performanceStats[key] * value), 0);
15
+ .reduce((total, [key, value]) => total + value * performanceStats[key], 0);
16
16
  return Math.round(score);
17
17
  }
18
18
  exports.calculateScore = calculateScore;
@@ -2,3 +2,4 @@ export * from './player';
2
2
  export * from './performance-stats';
3
3
  export * from './role';
4
4
  export * from './trait';
5
+ export * from './rarity';
@@ -18,3 +18,4 @@ __exportStar(require("./player"), exports);
18
18
  __exportStar(require("./performance-stats"), exports);
19
19
  __exportStar(require("./role"), exports);
20
20
  __exportStar(require("./trait"), exports);
21
+ __exportStar(require("./rarity"), exports);
@@ -1,4 +1,4 @@
1
- interface PerformanceStatsParams {
1
+ export interface PerformanceStatsParams {
2
2
  readonly setting: number;
3
3
  readonly pass: number;
4
4
  readonly reception: number;
@@ -11,6 +11,7 @@ interface PerformanceStatsParams {
11
11
  readonly defense: number;
12
12
  readonly stamina: number;
13
13
  }
14
+ export type PerformanceStatsKey = keyof PerformanceStatsParams;
14
15
  export declare class PerformanceStats {
15
16
  readonly setting: number;
16
17
  readonly pass: number;
@@ -27,4 +28,3 @@ export declare class PerformanceStats {
27
28
  toString(): string;
28
29
  static fromAverage(average: number): PerformanceStats;
29
30
  }
30
- export {};
@@ -1,7 +1,7 @@
1
1
  import * as Sequelize from 'sequelize';
2
2
  import { Model } from 'sequelize';
3
3
  import { CountryId, CountryModel, DraftPickId, DraftPickModel, MatchSetId, MatchSetModel, MatchSetStatsAttributes, MatchSetStatsId, MatchSetStatsModel, PerformanceStatsAttributes, PerformanceStatsId, PerformanceStatsModel, PlayerTeamId, PlayerTeamModel, PlayerTraitId, PlayerTraitModel, SetPositionId, SetPositionModel, TeamId, TeamModel, TraitId, TraitModel } from '.';
4
- import { Rarity } from '../../service/player/rarity';
4
+ import { Rarity } from '../../service';
5
5
  export interface PlayerAttributes {
6
6
  player_id: string;
7
7
  roles: RoleType[];
@@ -1,5 +1,5 @@
1
1
  import { DataTypes, Model } from 'sequelize';
2
- import { Rarity } from '../../service/player/rarity';
2
+ import { Rarity } from '../../service';
3
3
  export class PlayerModel extends Model {
4
4
  static initModel(sequelize) {
5
5
  return PlayerModel.init({
@@ -1,22 +1,10 @@
1
- import { PerformanceStats } from '../service';
1
+ import { PerformanceStats, PerformanceStatsParams } from '../service';
2
2
  export declare const ALL_STATS: string[];
3
3
  export type StatsTuple = typeof ALL_STATS;
4
4
  export type Stats = StatsTuple[number];
5
5
  export interface StatFormula {
6
6
  statName: Stats;
7
- weight: {
8
- serve: number;
9
- setting: number;
10
- pass: number;
11
- reception: number;
12
- spike: number;
13
- backAttack: number;
14
- jump: number;
15
- block: number;
16
- awareness: number;
17
- defense: number;
18
- stamina: number;
19
- };
7
+ weight: PerformanceStatsParams;
20
8
  }
21
9
  export declare const statsFormula: StatFormula[];
22
10
  export declare function calculateScore(performanceStats: PerformanceStats, statName: Stats): number;
@@ -6,6 +6,6 @@ export function calculateScore(performanceStats, statName) {
6
6
  if (weights == null)
7
7
  throw new Error('COULD_NOT_FIND_ROLE_WEIGHT');
8
8
  const score = Object.entries(weights.weight)
9
- .reduce((score, [key, value]) => score + (performanceStats[key] * value), 0);
9
+ .reduce((total, [key, value]) => total + value * performanceStats[key], 0);
10
10
  return Math.round(score);
11
11
  }
@@ -2,3 +2,4 @@ export * from './player';
2
2
  export * from './performance-stats';
3
3
  export * from './role';
4
4
  export * from './trait';
5
+ export * from './rarity';
@@ -2,3 +2,4 @@ export * from './player';
2
2
  export * from './performance-stats';
3
3
  export * from './role';
4
4
  export * from './trait';
5
+ export * from './rarity';
@@ -1,4 +1,4 @@
1
- interface PerformanceStatsParams {
1
+ export interface PerformanceStatsParams {
2
2
  readonly setting: number;
3
3
  readonly pass: number;
4
4
  readonly reception: number;
@@ -11,6 +11,7 @@ interface PerformanceStatsParams {
11
11
  readonly defense: number;
12
12
  readonly stamina: number;
13
13
  }
14
+ export type PerformanceStatsKey = keyof PerformanceStatsParams;
14
15
  export declare class PerformanceStats {
15
16
  readonly setting: number;
16
17
  readonly pass: number;
@@ -27,4 +28,3 @@ export declare class PerformanceStats {
27
28
  toString(): string;
28
29
  static fromAverage(average: number): PerformanceStats;
29
30
  }
30
- export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "volleyballsimtypes",
3
- "version": "0.0.160",
3
+ "version": "0.0.161",
4
4
  "description": "vbsim types",
5
5
  "main": "./dist/cjs/src/index.js",
6
6
  "module": "./dist/esm/src/index.js",