volleyballsimtypes 0.0.158 → 0.0.160

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 (31) hide show
  1. package/dist/cjs/src/data/init-models.js +6 -6
  2. package/dist/cjs/src/data/models/index.d.ts +1 -1
  3. package/dist/cjs/src/data/models/index.js +1 -1
  4. package/dist/cjs/src/data/models/{match-result-view.d.ts → match-result.d.ts} +3 -3
  5. package/dist/cjs/src/data/models/{match-result-view.js → match-result.js} +5 -5
  6. package/dist/cjs/src/data/models/match.d.ts +5 -5
  7. package/dist/cjs/src/data/models/player.d.ts +4 -0
  8. package/dist/cjs/src/data/models/player.js +5 -0
  9. package/dist/cjs/src/data/transformers/match.js +3 -3
  10. package/dist/cjs/src/data/transformers/player.js +4 -2
  11. package/dist/cjs/src/service/player/player.d.ts +4 -1
  12. package/dist/cjs/src/service/player/player.js +3 -1
  13. package/dist/cjs/src/service/player/rarity.d.ts +14 -0
  14. package/dist/cjs/src/service/player/rarity.js +18 -0
  15. package/dist/cjs/src/service/player/trait.js +1 -1
  16. package/dist/esm/src/data/init-models.js +7 -7
  17. package/dist/esm/src/data/models/index.d.ts +1 -1
  18. package/dist/esm/src/data/models/index.js +1 -1
  19. package/dist/esm/src/data/models/{match-result-view.d.ts → match-result.d.ts} +3 -3
  20. package/dist/esm/src/data/models/{match-result-view.js → match-result.js} +3 -3
  21. package/dist/esm/src/data/models/match.d.ts +5 -5
  22. package/dist/esm/src/data/models/player.d.ts +4 -0
  23. package/dist/esm/src/data/models/player.js +5 -0
  24. package/dist/esm/src/data/transformers/match.js +3 -3
  25. package/dist/esm/src/data/transformers/player.js +4 -2
  26. package/dist/esm/src/service/player/player.d.ts +4 -1
  27. package/dist/esm/src/service/player/player.js +3 -1
  28. package/dist/esm/src/service/player/rarity.d.ts +14 -0
  29. package/dist/esm/src/service/player/rarity.js +15 -0
  30. package/dist/esm/src/service/player/trait.js +1 -1
  31. package/package.json +1 -1
@@ -16,7 +16,7 @@ function initModels(sequelize) {
16
16
  const LeagueSeason = models_1.LeagueSeasonModel.initModel(sequelize);
17
17
  const Match = models_1.MatchModel.initModel(sequelize);
18
18
  const MatchRating = models_1.MatchRatingModel.initModel(sequelize);
19
- const MatchResultView = models_1.MatchResultViewModel.initModel(sequelize);
19
+ const MatchResult = models_1.MatchResultModel.initModel(sequelize);
20
20
  const MatchSet = models_1.MatchSetModel.initModel(sequelize);
21
21
  const MatchSetStats = models_1.MatchSetStatsModel.initModel(sequelize);
22
22
  const PerformanceStats = models_1.PerformanceStatsModel.initModel(sequelize);
@@ -72,9 +72,9 @@ function initModels(sequelize) {
72
72
  Match.hasMany(MatchRating, { as: 'MatchRatings', foreignKey: 'match_id' });
73
73
  Match.hasMany(MatchSet, { as: 'MatchSets', foreignKey: 'match_id' });
74
74
  Match.hasOne(CompetitionMatch, { as: 'CompetitionMatch', foreignKey: 'match_id' });
75
- Match.hasOne(MatchResultView, { as: 'MatchResult', foreignKey: 'match_id' });
76
- MatchResultView.belongsTo(Match, { as: 'Match', foreignKey: 'match_id' });
77
- MatchResultView.belongsTo(Team, { as: 'WinnerTeam', foreignKey: 'winner_team_id' });
75
+ Match.hasOne(MatchResult, { as: 'MatchResult', foreignKey: 'match_id' });
76
+ MatchResult.belongsTo(Match, { as: 'Match', foreignKey: 'match_id' });
77
+ MatchResult.belongsTo(Team, { as: 'WinnerTeam', foreignKey: 'winner_team_id' });
78
78
  MatchRating.belongsTo(Match, { as: 'match', foreignKey: 'match_id' });
79
79
  MatchRating.belongsTo(Team, { as: 'team', foreignKey: 'team_id' });
80
80
  MatchSet.belongsTo(Match, { as: 'match', foreignKey: 'match_id' });
@@ -164,7 +164,7 @@ function initModels(sequelize) {
164
164
  Team.hasMany(MatchRating, { as: 'MatchRatings', foreignKey: 'team_id' });
165
165
  Team.hasMany(PlayerTeam, { as: 'PlayerTeams', foreignKey: 'team_id' });
166
166
  Team.hasMany(Rally, { as: 'Rallies', foreignKey: 'serving_team' });
167
- Team.hasMany(MatchResultView, { as: 'WonMatches', foreignKey: 'winner_team_id' });
167
+ Team.hasMany(MatchResult, { as: 'WonMatches', foreignKey: 'winner_team_id' });
168
168
  Trait.belongsToMany(Player, {
169
169
  as: 'Players',
170
170
  through: PlayerTrait,
@@ -187,7 +187,7 @@ function initModels(sequelize) {
187
187
  LeagueSeason,
188
188
  Match,
189
189
  MatchRating,
190
- MatchResultView,
190
+ MatchResult,
191
191
  MatchSet,
192
192
  MatchSetStats,
193
193
  PerformanceStats,
@@ -11,7 +11,7 @@ export * from './league';
11
11
  export * from './league-season';
12
12
  export * from './match';
13
13
  export * from './match-rating';
14
- export * from './match-result-view';
14
+ export * from './match-result';
15
15
  export * from './match-set';
16
16
  export * from './match-set-stats';
17
17
  export * from './performance-stats';
@@ -27,7 +27,7 @@ __exportStar(require("./league"), exports);
27
27
  __exportStar(require("./league-season"), exports);
28
28
  __exportStar(require("./match"), exports);
29
29
  __exportStar(require("./match-rating"), exports);
30
- __exportStar(require("./match-result-view"), exports);
30
+ __exportStar(require("./match-result"), exports);
31
31
  __exportStar(require("./match-set"), exports);
32
32
  __exportStar(require("./match-set-stats"), exports);
33
33
  __exportStar(require("./performance-stats"), exports);
@@ -8,9 +8,9 @@ export interface MatchResultAttributes {
8
8
  winner_team_id: string | null;
9
9
  }
10
10
  export type MatchResultPk = 'match_id';
11
- export type MatchResultId = MatchResultViewModel[MatchResultPk];
11
+ export type MatchResultId = MatchResultModel[MatchResultPk];
12
12
  export type MatchResultCreationAttributes = MatchResultAttributes;
13
- export declare class MatchResultViewModel extends Model<MatchResultAttributes, MatchResultCreationAttributes> implements MatchResultAttributes {
13
+ export declare class MatchResultModel extends Model<MatchResultAttributes, MatchResultCreationAttributes> implements MatchResultAttributes {
14
14
  match_id: string;
15
15
  home_score: number;
16
16
  away_score: number;
@@ -23,5 +23,5 @@ export declare class MatchResultViewModel extends Model<MatchResultAttributes, M
23
23
  getWinnerTeam: Sequelize.BelongsToGetAssociationMixin<TeamModel>;
24
24
  setWinnerTeam: Sequelize.BelongsToSetAssociationMixin<TeamModel, TeamId>;
25
25
  createWinnerTeam: Sequelize.BelongsToCreateAssociationMixin<TeamModel>;
26
- static initModel(sequelize: Sequelize.Sequelize): typeof MatchResultViewModel;
26
+ static initModel(sequelize: Sequelize.Sequelize): typeof MatchResultModel;
27
27
  }
@@ -1,10 +1,10 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.MatchResultViewModel = void 0;
3
+ exports.MatchResultModel = void 0;
4
4
  const sequelize_1 = require("sequelize");
5
- class MatchResultViewModel extends sequelize_1.Model {
5
+ class MatchResultModel extends sequelize_1.Model {
6
6
  static initModel(sequelize) {
7
- return MatchResultViewModel.init({
7
+ return MatchResultModel.init({
8
8
  match_id: {
9
9
  type: sequelize_1.DataTypes.UUID,
10
10
  allowNull: false,
@@ -28,11 +28,11 @@ class MatchResultViewModel extends sequelize_1.Model {
28
28
  schema: 'public',
29
29
  timestamps: false,
30
30
  indexes: [{
31
- name: 'MatchResultView_pk',
31
+ name: 'MatchResult_pk',
32
32
  unique: true,
33
33
  fields: [{ name: 'match_id' }]
34
34
  }]
35
35
  });
36
36
  }
37
37
  }
38
- exports.MatchResultViewModel = MatchResultViewModel;
38
+ exports.MatchResultModel = MatchResultModel;
@@ -1,7 +1,7 @@
1
1
  import * as Sequelize from 'sequelize';
2
2
  import { Model } from 'sequelize';
3
- import { CompetitionMatchId, CompetitionMatchModel, MatchRatingId, MatchRatingModel, MatchResultId, MatchResultViewModel, MatchSetAttributes, MatchSetId, MatchSetModel, TeamId, TeamModel } from '.';
4
3
  import { Status } from '../common';
4
+ import { CompetitionMatchId, CompetitionMatchModel, MatchRatingId, MatchRatingModel, MatchResultId, MatchResultModel, MatchSetAttributes, MatchSetId, MatchSetModel, TeamId, TeamModel } from '.';
5
5
  export interface MatchAttributes {
6
6
  match_id: string;
7
7
  home_team: string;
@@ -23,10 +23,10 @@ export declare class MatchModel extends Model<MatchAttributes, MatchCreationAttr
23
23
  getCompetitionMatch: Sequelize.HasOneGetAssociationMixin<CompetitionMatchModel>;
24
24
  setCompetitionMatch: Sequelize.HasOneSetAssociationMixin<CompetitionMatchModel, CompetitionMatchId>;
25
25
  createCompetitionMatch: Sequelize.HasOneCreateAssociationMixin<CompetitionMatchModel>;
26
- MatchResultView: MatchResultViewModel;
27
- getMatchResultView: Sequelize.HasOneGetAssociationMixin<MatchResultViewModel>;
28
- setMatchResultView: Sequelize.HasOneSetAssociationMixin<MatchResultViewModel, MatchResultId>;
29
- createMatchResultView: Sequelize.HasOneCreateAssociationMixin<MatchResultViewModel>;
26
+ MatchResult: MatchResultModel;
27
+ getMatchResult: Sequelize.HasOneGetAssociationMixin<MatchResultModel>;
28
+ setMatchResult: Sequelize.HasOneSetAssociationMixin<MatchResultModel, MatchResultId>;
29
+ createMatchResult: Sequelize.HasOneCreateAssociationMixin<MatchResultModel>;
30
30
  MatchRatings: MatchRatingModel[];
31
31
  getMatchRatings: Sequelize.HasManyGetAssociationsMixin<MatchRatingModel>;
32
32
  setMatchRatings: Sequelize.HasManySetAssociationsMixin<MatchRatingModel, MatchRatingId>;
@@ -1,9 +1,11 @@
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
5
  export interface PlayerAttributes {
5
6
  player_id: string;
6
7
  roles: RoleType[];
8
+ rarity: PlayerRarity;
7
9
  first_name: string;
8
10
  last_name: string;
9
11
  country_id: string;
@@ -12,11 +14,13 @@ export interface PlayerAttributes {
12
14
  }
13
15
  export type PlayerPk = 'player_id';
14
16
  export type RoleType = 'SETTER' | 'LIBERO' | 'OUTSIDE_HITTER' | 'OPPOSITE_HITTER' | 'MIDDLE_BLOCKER';
17
+ export type PlayerRarity = Rarity.COMMON | Rarity.RARE | Rarity.LEGENDARY | Rarity.MYTHIC | Rarity.SPECIAL;
15
18
  export type PlayerId = PlayerModel[PlayerPk];
16
19
  export type PlayerCreationAttributes = PlayerAttributes;
17
20
  export declare class PlayerModel extends Model<PlayerAttributes, PlayerCreationAttributes> implements PlayerAttributes {
18
21
  player_id: string;
19
22
  roles: RoleType[];
23
+ rarity: PlayerRarity;
20
24
  first_name: string;
21
25
  last_name: string;
22
26
  country_id: string;
@@ -2,6 +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
6
  class PlayerModel extends sequelize_1.Model {
6
7
  static initModel(sequelize) {
7
8
  return PlayerModel.init({
@@ -14,6 +15,10 @@ class PlayerModel extends sequelize_1.Model {
14
15
  type: sequelize_1.DataTypes.ARRAY(sequelize_1.DataTypes.ENUM('SETTER', 'LIBERO', 'OUTSIDE_HITTER', 'OPPOSITE_HITTER', 'MIDDLE_BLOCKER')),
15
16
  allowNull: false
16
17
  },
18
+ rarity: {
19
+ type: sequelize_1.DataTypes.ARRAY(sequelize_1.DataTypes.ENUM(...Object.values(rarity_1.Rarity))),
20
+ allowNull: false
21
+ },
17
22
  first_name: {
18
23
  type: sequelize_1.DataTypes.STRING,
19
24
  allowNull: false
@@ -24,9 +24,9 @@ function transformToObject(model) {
24
24
  scheduledDate: new Date(model.scheduled_date),
25
25
  sets,
26
26
  status: model.status,
27
- homeScore: model.MatchResultView?.home_score,
28
- awayScore: model.MatchResultView?.away_score,
29
- winner: model.MatchResultView?.WinnerTeam != null ? (0, team_1.transformToTeam)(model.MatchResultView.WinnerTeam) : undefined
27
+ homeScore: model.MatchResult?.home_score,
28
+ awayScore: model.MatchResult?.away_score,
29
+ winner: model.MatchResult?.WinnerTeam != null ? (0, team_1.transformToTeam)(model.MatchResult.WinnerTeam) : undefined
30
30
  });
31
31
  }
32
32
  exports.transformToMatch = transformToObject;
@@ -10,7 +10,8 @@ function transformToAttributes(player) {
10
10
  first_name: player.name.first,
11
11
  last_name: player.name.last,
12
12
  roles: player.roles.map(_1.transformFromRole),
13
- PerformanceStat: (0, _1.transformFromPerformanceStats)(player)
13
+ PerformanceStat: (0, _1.transformFromPerformanceStats)(player),
14
+ rarity: player.rarity
14
15
  };
15
16
  }
16
17
  exports.transformFromPlayer = transformToAttributes;
@@ -24,7 +25,8 @@ function transformToObject(model) {
24
25
  country: (0, _1.transformToCountry)(model.country),
25
26
  roles: model.roles.map(_1.transformToRole),
26
27
  traits: model.Traits.map(_1.transformToTrait),
27
- stats: (0, _1.transformToPerformanceStats)(model.PerformanceStat)
28
+ stats: (0, _1.transformToPerformanceStats)(model.PerformanceStat),
29
+ rarity: model.rarity
28
30
  });
29
31
  }
30
32
  exports.transformToPlayer = transformToObject;
@@ -3,6 +3,7 @@ import { Role } from './role';
3
3
  import { Trait } from './trait';
4
4
  import { Country } from '../country';
5
5
  import * as GeneralStat from '../../formula/stats';
6
+ import { Rarity } from './rarity';
6
7
  export declare class Stat {
7
8
  readonly name: GeneralStat.Stats;
8
9
  readonly value: number;
@@ -19,6 +20,7 @@ interface PlayerParams {
19
20
  readonly stats: PerformanceStats;
20
21
  readonly roles: Role[];
21
22
  readonly traits: Trait[];
23
+ readonly rarity: Rarity;
22
24
  }
23
25
  export declare class Name {
24
26
  readonly first: string;
@@ -37,7 +39,8 @@ export declare class Player {
37
39
  readonly roles: Role[];
38
40
  readonly traits: Trait[];
39
41
  readonly generalStats: Stat[];
40
- constructor({ id, name, country, stats, roles, traits }: PlayerParams);
42
+ readonly rarity: Rarity;
43
+ constructor({ id, name, country, stats, roles, traits, rarity }: PlayerParams);
41
44
  static sortPlayers(roles: Role[]): (p1: Player, p2: Player) => number;
42
45
  static compareStats(p1: Player, p2: Player): number;
43
46
  canPlayLibero(): boolean;
@@ -48,7 +48,7 @@ class Name {
48
48
  }
49
49
  exports.Name = Name;
50
50
  class Player {
51
- constructor({ id, name, country, stats, roles, traits }) {
51
+ constructor({ id, name, country, stats, roles, traits, rarity }) {
52
52
  (0, utils_1.validateUUID)(id);
53
53
  this.id = id;
54
54
  this.name = name;
@@ -56,6 +56,7 @@ class Player {
56
56
  this.stats = stats;
57
57
  this.roles = roles;
58
58
  this.traits = traits;
59
+ this.rarity = rarity;
59
60
  this.generalStats = GeneralStat.ALL_STATS.map(stat => ({
60
61
  name: stat,
61
62
  value: GeneralStat.calculateScore(stats, stat)
@@ -103,6 +104,7 @@ class Player {
103
104
  name: this.name.toString(),
104
105
  country: this.country.toString(),
105
106
  stats: this.stats.toString(),
107
+ rarity: this.rarity,
106
108
  roles: `[${this.roles.map(r => r.toString()).join(',')}]`,
107
109
  traits: `[${this.traits.map(r => r.toString()).join(',')}]`,
108
110
  generalStats: `[${this.generalStats.map(r => r.toString()).join(',')}]`
@@ -0,0 +1,14 @@
1
+ export declare enum Rarity {
2
+ COMMON = "COMMON",
3
+ RARE = "RARE",
4
+ LEGENDARY = "LEGENDARY",
5
+ MYTHIC = "MYTHIC",
6
+ SPECIAL = "SPECIAL"
7
+ }
8
+ export declare const RarityRanges: {
9
+ COMMON: number[];
10
+ RARE: number[];
11
+ LEGENDARY: number[];
12
+ MYTHIC: number[];
13
+ SPECIAL: number[];
14
+ };
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.RarityRanges = exports.Rarity = void 0;
4
+ var Rarity;
5
+ (function (Rarity) {
6
+ Rarity["COMMON"] = "COMMON";
7
+ Rarity["RARE"] = "RARE";
8
+ Rarity["LEGENDARY"] = "LEGENDARY";
9
+ Rarity["MYTHIC"] = "MYTHIC";
10
+ Rarity["SPECIAL"] = "SPECIAL";
11
+ })(Rarity = exports.Rarity || (exports.Rarity = {}));
12
+ exports.RarityRanges = {
13
+ [Rarity.COMMON]: [0, 50],
14
+ [Rarity.RARE]: [51, 70],
15
+ [Rarity.LEGENDARY]: [71, 85],
16
+ [Rarity.MYTHIC]: [86, 98],
17
+ [Rarity.SPECIAL]: [99, 100]
18
+ };
@@ -72,7 +72,7 @@ class Trait {
72
72
  }
73
73
  }
74
74
  exports.Trait = Trait;
75
- // A Setter gets a bonus to their score and the receiving attacker gets a bonus as well.
75
+ // A Setter gets a bonus to their score, and the receiving attacker gets a bonus as well.
76
76
  // Stacks with attacker bonus
77
77
  Trait.MASTER_MIND = new Trait({
78
78
  id: '0117a315-a743-43e3-9ec2-ad5cf700ef08',
@@ -1,4 +1,4 @@
1
- import { CoachModel, CompetitionChampionModel, CompetitionMatchModel, CompetitionModel, CompetitionTeamsModel, CountryModel, DraftModel, DraftPickModel, IterationModel, LeagueModel, LeagueSeasonModel, MatchModel, MatchRatingModel, MatchResultViewModel, MatchSetModel, MatchSetStatsModel, PerformanceStatsModel, PlayerModel, PlayerTeamModel, PlayerTraitModel, RallyModel, SetPositionModel, TeamModel, TraitModel, UserModel } from './models';
1
+ import { CoachModel, CompetitionChampionModel, CompetitionMatchModel, CompetitionModel, CompetitionTeamsModel, CountryModel, DraftModel, DraftPickModel, IterationModel, LeagueModel, LeagueSeasonModel, MatchModel, MatchRatingModel, MatchResultModel, MatchSetModel, MatchSetStatsModel, PerformanceStatsModel, PlayerModel, PlayerTeamModel, PlayerTraitModel, RallyModel, SetPositionModel, TeamModel, TraitModel, UserModel } from './models';
2
2
  export function initModels(sequelize) {
3
3
  const Coach = CoachModel.initModel(sequelize);
4
4
  const Country = CountryModel.initModel(sequelize);
@@ -13,7 +13,7 @@ export function initModels(sequelize) {
13
13
  const LeagueSeason = LeagueSeasonModel.initModel(sequelize);
14
14
  const Match = MatchModel.initModel(sequelize);
15
15
  const MatchRating = MatchRatingModel.initModel(sequelize);
16
- const MatchResultView = MatchResultViewModel.initModel(sequelize);
16
+ const MatchResult = MatchResultModel.initModel(sequelize);
17
17
  const MatchSet = MatchSetModel.initModel(sequelize);
18
18
  const MatchSetStats = MatchSetStatsModel.initModel(sequelize);
19
19
  const PerformanceStats = PerformanceStatsModel.initModel(sequelize);
@@ -69,9 +69,9 @@ export function initModels(sequelize) {
69
69
  Match.hasMany(MatchRating, { as: 'MatchRatings', foreignKey: 'match_id' });
70
70
  Match.hasMany(MatchSet, { as: 'MatchSets', foreignKey: 'match_id' });
71
71
  Match.hasOne(CompetitionMatch, { as: 'CompetitionMatch', foreignKey: 'match_id' });
72
- Match.hasOne(MatchResultView, { as: 'MatchResult', foreignKey: 'match_id' });
73
- MatchResultView.belongsTo(Match, { as: 'Match', foreignKey: 'match_id' });
74
- MatchResultView.belongsTo(Team, { as: 'WinnerTeam', foreignKey: 'winner_team_id' });
72
+ Match.hasOne(MatchResult, { as: 'MatchResult', foreignKey: 'match_id' });
73
+ MatchResult.belongsTo(Match, { as: 'Match', foreignKey: 'match_id' });
74
+ MatchResult.belongsTo(Team, { as: 'WinnerTeam', foreignKey: 'winner_team_id' });
75
75
  MatchRating.belongsTo(Match, { as: 'match', foreignKey: 'match_id' });
76
76
  MatchRating.belongsTo(Team, { as: 'team', foreignKey: 'team_id' });
77
77
  MatchSet.belongsTo(Match, { as: 'match', foreignKey: 'match_id' });
@@ -161,7 +161,7 @@ export function initModels(sequelize) {
161
161
  Team.hasMany(MatchRating, { as: 'MatchRatings', foreignKey: 'team_id' });
162
162
  Team.hasMany(PlayerTeam, { as: 'PlayerTeams', foreignKey: 'team_id' });
163
163
  Team.hasMany(Rally, { as: 'Rallies', foreignKey: 'serving_team' });
164
- Team.hasMany(MatchResultView, { as: 'WonMatches', foreignKey: 'winner_team_id' });
164
+ Team.hasMany(MatchResult, { as: 'WonMatches', foreignKey: 'winner_team_id' });
165
165
  Trait.belongsToMany(Player, {
166
166
  as: 'Players',
167
167
  through: PlayerTrait,
@@ -184,7 +184,7 @@ export function initModels(sequelize) {
184
184
  LeagueSeason,
185
185
  Match,
186
186
  MatchRating,
187
- MatchResultView,
187
+ MatchResult,
188
188
  MatchSet,
189
189
  MatchSetStats,
190
190
  PerformanceStats,
@@ -11,7 +11,7 @@ export * from './league';
11
11
  export * from './league-season';
12
12
  export * from './match';
13
13
  export * from './match-rating';
14
- export * from './match-result-view';
14
+ export * from './match-result';
15
15
  export * from './match-set';
16
16
  export * from './match-set-stats';
17
17
  export * from './performance-stats';
@@ -11,7 +11,7 @@ export * from './league';
11
11
  export * from './league-season';
12
12
  export * from './match';
13
13
  export * from './match-rating';
14
- export * from './match-result-view';
14
+ export * from './match-result';
15
15
  export * from './match-set';
16
16
  export * from './match-set-stats';
17
17
  export * from './performance-stats';
@@ -8,9 +8,9 @@ export interface MatchResultAttributes {
8
8
  winner_team_id: string | null;
9
9
  }
10
10
  export type MatchResultPk = 'match_id';
11
- export type MatchResultId = MatchResultViewModel[MatchResultPk];
11
+ export type MatchResultId = MatchResultModel[MatchResultPk];
12
12
  export type MatchResultCreationAttributes = MatchResultAttributes;
13
- export declare class MatchResultViewModel extends Model<MatchResultAttributes, MatchResultCreationAttributes> implements MatchResultAttributes {
13
+ export declare class MatchResultModel extends Model<MatchResultAttributes, MatchResultCreationAttributes> implements MatchResultAttributes {
14
14
  match_id: string;
15
15
  home_score: number;
16
16
  away_score: number;
@@ -23,5 +23,5 @@ export declare class MatchResultViewModel extends Model<MatchResultAttributes, M
23
23
  getWinnerTeam: Sequelize.BelongsToGetAssociationMixin<TeamModel>;
24
24
  setWinnerTeam: Sequelize.BelongsToSetAssociationMixin<TeamModel, TeamId>;
25
25
  createWinnerTeam: Sequelize.BelongsToCreateAssociationMixin<TeamModel>;
26
- static initModel(sequelize: Sequelize.Sequelize): typeof MatchResultViewModel;
26
+ static initModel(sequelize: Sequelize.Sequelize): typeof MatchResultModel;
27
27
  }
@@ -1,7 +1,7 @@
1
1
  import { DataTypes, Model } from 'sequelize';
2
- export class MatchResultViewModel extends Model {
2
+ export class MatchResultModel extends Model {
3
3
  static initModel(sequelize) {
4
- return MatchResultViewModel.init({
4
+ return MatchResultModel.init({
5
5
  match_id: {
6
6
  type: DataTypes.UUID,
7
7
  allowNull: false,
@@ -25,7 +25,7 @@ export class MatchResultViewModel extends Model {
25
25
  schema: 'public',
26
26
  timestamps: false,
27
27
  indexes: [{
28
- name: 'MatchResultView_pk',
28
+ name: 'MatchResult_pk',
29
29
  unique: true,
30
30
  fields: [{ name: 'match_id' }]
31
31
  }]
@@ -1,7 +1,7 @@
1
1
  import * as Sequelize from 'sequelize';
2
2
  import { Model } from 'sequelize';
3
- import { CompetitionMatchId, CompetitionMatchModel, MatchRatingId, MatchRatingModel, MatchResultId, MatchResultViewModel, MatchSetAttributes, MatchSetId, MatchSetModel, TeamId, TeamModel } from '.';
4
3
  import { Status } from '../common';
4
+ import { CompetitionMatchId, CompetitionMatchModel, MatchRatingId, MatchRatingModel, MatchResultId, MatchResultModel, MatchSetAttributes, MatchSetId, MatchSetModel, TeamId, TeamModel } from '.';
5
5
  export interface MatchAttributes {
6
6
  match_id: string;
7
7
  home_team: string;
@@ -23,10 +23,10 @@ export declare class MatchModel extends Model<MatchAttributes, MatchCreationAttr
23
23
  getCompetitionMatch: Sequelize.HasOneGetAssociationMixin<CompetitionMatchModel>;
24
24
  setCompetitionMatch: Sequelize.HasOneSetAssociationMixin<CompetitionMatchModel, CompetitionMatchId>;
25
25
  createCompetitionMatch: Sequelize.HasOneCreateAssociationMixin<CompetitionMatchModel>;
26
- MatchResultView: MatchResultViewModel;
27
- getMatchResultView: Sequelize.HasOneGetAssociationMixin<MatchResultViewModel>;
28
- setMatchResultView: Sequelize.HasOneSetAssociationMixin<MatchResultViewModel, MatchResultId>;
29
- createMatchResultView: Sequelize.HasOneCreateAssociationMixin<MatchResultViewModel>;
26
+ MatchResult: MatchResultModel;
27
+ getMatchResult: Sequelize.HasOneGetAssociationMixin<MatchResultModel>;
28
+ setMatchResult: Sequelize.HasOneSetAssociationMixin<MatchResultModel, MatchResultId>;
29
+ createMatchResult: Sequelize.HasOneCreateAssociationMixin<MatchResultModel>;
30
30
  MatchRatings: MatchRatingModel[];
31
31
  getMatchRatings: Sequelize.HasManyGetAssociationsMixin<MatchRatingModel>;
32
32
  setMatchRatings: Sequelize.HasManySetAssociationsMixin<MatchRatingModel, MatchRatingId>;
@@ -1,9 +1,11 @@
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
5
  export interface PlayerAttributes {
5
6
  player_id: string;
6
7
  roles: RoleType[];
8
+ rarity: PlayerRarity;
7
9
  first_name: string;
8
10
  last_name: string;
9
11
  country_id: string;
@@ -12,11 +14,13 @@ export interface PlayerAttributes {
12
14
  }
13
15
  export type PlayerPk = 'player_id';
14
16
  export type RoleType = 'SETTER' | 'LIBERO' | 'OUTSIDE_HITTER' | 'OPPOSITE_HITTER' | 'MIDDLE_BLOCKER';
17
+ export type PlayerRarity = Rarity.COMMON | Rarity.RARE | Rarity.LEGENDARY | Rarity.MYTHIC | Rarity.SPECIAL;
15
18
  export type PlayerId = PlayerModel[PlayerPk];
16
19
  export type PlayerCreationAttributes = PlayerAttributes;
17
20
  export declare class PlayerModel extends Model<PlayerAttributes, PlayerCreationAttributes> implements PlayerAttributes {
18
21
  player_id: string;
19
22
  roles: RoleType[];
23
+ rarity: PlayerRarity;
20
24
  first_name: string;
21
25
  last_name: string;
22
26
  country_id: string;
@@ -1,4 +1,5 @@
1
1
  import { DataTypes, Model } from 'sequelize';
2
+ import { Rarity } from '../../service/player/rarity';
2
3
  export class PlayerModel extends Model {
3
4
  static initModel(sequelize) {
4
5
  return PlayerModel.init({
@@ -11,6 +12,10 @@ export class PlayerModel extends Model {
11
12
  type: DataTypes.ARRAY(DataTypes.ENUM('SETTER', 'LIBERO', 'OUTSIDE_HITTER', 'OPPOSITE_HITTER', 'MIDDLE_BLOCKER')),
12
13
  allowNull: false
13
14
  },
15
+ rarity: {
16
+ type: DataTypes.ARRAY(DataTypes.ENUM(...Object.values(Rarity))),
17
+ allowNull: false
18
+ },
14
19
  first_name: {
15
20
  type: DataTypes.STRING,
16
21
  allowNull: false
@@ -20,9 +20,9 @@ function transformToObject(model) {
20
20
  scheduledDate: new Date(model.scheduled_date),
21
21
  sets,
22
22
  status: model.status,
23
- homeScore: model.MatchResultView?.home_score,
24
- awayScore: model.MatchResultView?.away_score,
25
- winner: model.MatchResultView?.WinnerTeam != null ? transformToTeam(model.MatchResultView.WinnerTeam) : undefined
23
+ homeScore: model.MatchResult?.home_score,
24
+ awayScore: model.MatchResult?.away_score,
25
+ winner: model.MatchResult?.WinnerTeam != null ? transformToTeam(model.MatchResult.WinnerTeam) : undefined
26
26
  });
27
27
  }
28
28
  export { transformToObject as transformToMatch, transformToAttributes as transformFromMatch };
@@ -7,7 +7,8 @@ function transformToAttributes(player) {
7
7
  first_name: player.name.first,
8
8
  last_name: player.name.last,
9
9
  roles: player.roles.map(transformFromRole),
10
- PerformanceStat: transformFromPerformanceStats(player)
10
+ PerformanceStat: transformFromPerformanceStats(player),
11
+ rarity: player.rarity
11
12
  };
12
13
  }
13
14
  function transformToObject(model) {
@@ -20,7 +21,8 @@ function transformToObject(model) {
20
21
  country: transformToCountry(model.country),
21
22
  roles: model.roles.map(transformToRole),
22
23
  traits: model.Traits.map(transformToTrait),
23
- stats: transformToPerformanceStats(model.PerformanceStat)
24
+ stats: transformToPerformanceStats(model.PerformanceStat),
25
+ rarity: model.rarity
24
26
  });
25
27
  }
26
28
  export { transformToObject as transformToPlayer, transformToAttributes as transformFromPlayer };
@@ -3,6 +3,7 @@ import { Role } from './role';
3
3
  import { Trait } from './trait';
4
4
  import { Country } from '../country';
5
5
  import * as GeneralStat from '../../formula/stats';
6
+ import { Rarity } from './rarity';
6
7
  export declare class Stat {
7
8
  readonly name: GeneralStat.Stats;
8
9
  readonly value: number;
@@ -19,6 +20,7 @@ interface PlayerParams {
19
20
  readonly stats: PerformanceStats;
20
21
  readonly roles: Role[];
21
22
  readonly traits: Trait[];
23
+ readonly rarity: Rarity;
22
24
  }
23
25
  export declare class Name {
24
26
  readonly first: string;
@@ -37,7 +39,8 @@ export declare class Player {
37
39
  readonly roles: Role[];
38
40
  readonly traits: Trait[];
39
41
  readonly generalStats: Stat[];
40
- constructor({ id, name, country, stats, roles, traits }: PlayerParams);
42
+ readonly rarity: Rarity;
43
+ constructor({ id, name, country, stats, roles, traits, rarity }: PlayerParams);
41
44
  static sortPlayers(roles: Role[]): (p1: Player, p2: Player) => number;
42
45
  static compareStats(p1: Player, p2: Player): number;
43
46
  canPlayLibero(): boolean;
@@ -20,7 +20,7 @@ export class Name {
20
20
  }
21
21
  }
22
22
  export class Player {
23
- constructor({ id, name, country, stats, roles, traits }) {
23
+ constructor({ id, name, country, stats, roles, traits, rarity }) {
24
24
  validateUUID(id);
25
25
  this.id = id;
26
26
  this.name = name;
@@ -28,6 +28,7 @@ export class Player {
28
28
  this.stats = stats;
29
29
  this.roles = roles;
30
30
  this.traits = traits;
31
+ this.rarity = rarity;
31
32
  this.generalStats = GeneralStat.ALL_STATS.map(stat => ({
32
33
  name: stat,
33
34
  value: GeneralStat.calculateScore(stats, stat)
@@ -75,6 +76,7 @@ export class Player {
75
76
  name: this.name.toString(),
76
77
  country: this.country.toString(),
77
78
  stats: this.stats.toString(),
79
+ rarity: this.rarity,
78
80
  roles: `[${this.roles.map(r => r.toString()).join(',')}]`,
79
81
  traits: `[${this.traits.map(r => r.toString()).join(',')}]`,
80
82
  generalStats: `[${this.generalStats.map(r => r.toString()).join(',')}]`
@@ -0,0 +1,14 @@
1
+ export declare enum Rarity {
2
+ COMMON = "COMMON",
3
+ RARE = "RARE",
4
+ LEGENDARY = "LEGENDARY",
5
+ MYTHIC = "MYTHIC",
6
+ SPECIAL = "SPECIAL"
7
+ }
8
+ export declare const RarityRanges: {
9
+ COMMON: number[];
10
+ RARE: number[];
11
+ LEGENDARY: number[];
12
+ MYTHIC: number[];
13
+ SPECIAL: number[];
14
+ };
@@ -0,0 +1,15 @@
1
+ export var Rarity;
2
+ (function (Rarity) {
3
+ Rarity["COMMON"] = "COMMON";
4
+ Rarity["RARE"] = "RARE";
5
+ Rarity["LEGENDARY"] = "LEGENDARY";
6
+ Rarity["MYTHIC"] = "MYTHIC";
7
+ Rarity["SPECIAL"] = "SPECIAL";
8
+ })(Rarity || (Rarity = {}));
9
+ export const RarityRanges = {
10
+ [Rarity.COMMON]: [0, 50],
11
+ [Rarity.RARE]: [51, 70],
12
+ [Rarity.LEGENDARY]: [71, 85],
13
+ [Rarity.MYTHIC]: [86, 98],
14
+ [Rarity.SPECIAL]: [99, 100]
15
+ };
@@ -45,7 +45,7 @@ export class Trait {
45
45
  });
46
46
  }
47
47
  }
48
- // A Setter gets a bonus to their score and the receiving attacker gets a bonus as well.
48
+ // A Setter gets a bonus to their score, and the receiving attacker gets a bonus as well.
49
49
  // Stacks with attacker bonus
50
50
  Trait.MASTER_MIND = new Trait({
51
51
  id: '0117a315-a743-43e3-9ec2-ad5cf700ef08',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "volleyballsimtypes",
3
- "version": "0.0.158",
3
+ "version": "0.0.160",
4
4
  "description": "vbsim types",
5
5
  "main": "./dist/cjs/src/index.js",
6
6
  "module": "./dist/esm/src/index.js",