volleyballsimtypes 0.0.159 → 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.
@@ -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
@@ -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,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
@@ -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.159",
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",