volleyballsimtypes 0.0.500 → 0.0.501

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,4 +1,4 @@
1
- export type EventRewardBand = 'PARTICIPATION' | 'TOP_20' | 'TOP_10' | 'TOP_5' | 'TOP_3' | 'TOP_1';
1
+ export type EventRewardBand = 'PARTICIPATION' | 'FINAL_GROUP' | 'TOP_10' | 'TOP_5' | 'TOP_3' | 'TOP_1';
2
2
  export interface EventRewardRow {
3
3
  readonly band: EventRewardBand;
4
4
  /** Best final position that earns this row; PARTICIPATION has none. */
@@ -15,7 +15,8 @@ export interface EventRewardRow {
15
15
  export declare const EVENT_REWARDS: readonly EventRewardRow[];
16
16
  /**
17
17
  * The band a finish falls into. `position` is the place in the FINAL table; null means the team never reached
18
- * the final, and so does any position past the last banded row, which both count as taking part.
18
+ * the final (it went out in the group stage) and takes the participation row. The final holds MAX_FINAL_SIZE
19
+ * teams and the widest banded row (FINAL_GROUP) covers exactly that, so every finalist earns a banded row.
19
20
  */
20
21
  export declare function eventRewardBandFor(position: number | null): EventRewardBand;
21
22
  export interface EventPayout {
@@ -8,6 +8,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
8
8
  exports.EVENT_REWARDS = void 0;
9
9
  exports.eventRewardBandFor = eventRewardBandFor;
10
10
  exports.eventPayoutFor = eventPayoutFor;
11
+ const event_schedule_1 = require("./event-schedule");
11
12
  /**
12
13
  * Best band first. A team earns its own row and every row BELOW it, which is what "cumulative" means: first
13
14
  * place collects all six.
@@ -17,18 +18,19 @@ exports.EVENT_REWARDS = [
17
18
  { band: 'TOP_3', maxPosition: 3, packs: 0, coins: 500 },
18
19
  { band: 'TOP_5', maxPosition: 5, packs: 0, coins: 1000 },
19
20
  { band: 'TOP_10', maxPosition: 10, packs: 1, coins: 0 },
20
- { band: 'TOP_20', maxPosition: 20, packs: 0, coins: 1000 },
21
+ { band: 'FINAL_GROUP', maxPosition: event_schedule_1.MAX_FINAL_SIZE, packs: 0, coins: 1000 },
21
22
  { band: 'PARTICIPATION', maxPosition: null, packs: 1, coins: 1000 }
22
23
  ];
23
24
  /**
24
25
  * The band a finish falls into. `position` is the place in the FINAL table; null means the team never reached
25
- * the final, and so does any position past the last banded row, which both count as taking part.
26
+ * the final (it went out in the group stage) and takes the participation row. The final holds MAX_FINAL_SIZE
27
+ * teams and the widest banded row (FINAL_GROUP) covers exactly that, so every finalist earns a banded row.
26
28
  */
27
29
  function eventRewardBandFor(position) {
28
30
  if (position == null)
29
31
  return 'PARTICIPATION';
30
32
  // Rows are ordered best-first, so the FIRST row the position satisfies is the narrowest band it earns.
31
- // Scanning to the end instead would always land on the widest, handing first place a "top 20" badge.
33
+ // Scanning to the end instead would always land on the widest, handing first place a "final group" badge.
32
34
  for (const row of exports.EVENT_REWARDS) {
33
35
  if (row.maxPosition != null && position <= row.maxPosition)
34
36
  return row.band;
@@ -11,11 +11,11 @@ const event_rewards_1 = require("./event-rewards");
11
11
  [5, 'TOP_5'],
12
12
  [6, 'TOP_10'],
13
13
  [10, 'TOP_10'],
14
- [11, 'TOP_20'],
15
- [20, 'TOP_20'],
16
- // Inside a 24-team final but outside every banded row, so it counts as taking part.
17
- [21, 'PARTICIPATION'],
18
- [24, 'PARTICIPATION']
14
+ [11, 'FINAL_GROUP'],
15
+ [20, 'FINAL_GROUP'],
16
+ // The final holds 24 teams and FINAL_GROUP covers all of them.
17
+ [21, 'FINAL_GROUP'],
18
+ [24, 'FINAL_GROUP']
19
19
  ])('places a finish of %i in %s', (position, band) => {
20
20
  (0, globals_1.expect)((0, event_rewards_1.eventRewardBandFor)(position)).toBe(band);
21
21
  });
@@ -26,9 +26,9 @@ const event_rewards_1 = require("./event-rewards");
26
26
  (0, globals_1.describe)('eventPayoutFor()', () => {
27
27
  globals_1.it.each([
28
28
  // position, packs, coins. Cumulative: every row from Participation down to the finish.
29
- [null, 1, 1000], // group stage: 1 pack + 1000
30
- [24, 1, 1000], // in the final but outside the top 20: still just participation
31
- [20, 1, 2000], // + top 20's 1000
29
+ [null, 1, 1000], // never reached the final (group stage): 1 pack + 1000
30
+ [24, 1, 2000], // last of the 24-team final: final group's 1000 on top of participation
31
+ [20, 1, 2000], // + final group's 1000
32
32
  [11, 1, 2000],
33
33
  [10, 2, 2000], // + top 10's pack
34
34
  [6, 2, 2000],
@@ -50,7 +50,7 @@ const event_rewards_1 = require("./event-rewards");
50
50
  }
51
51
  });
52
52
  (0, globals_1.it)('adds up to the owner-defined table for a winner', () => {
53
- // 1x pack + 1000 (participation), +1000 (top 20), +1 pack (top 10), +1000 (top 5), +500 (top 3), +1 pack (top 1)
53
+ // 1x pack + 1000 (participation), +1000 (final group), +1 pack (top 10), +1000 (top 5), +500 (top 3), +1 pack (top 1)
54
54
  const total = event_rewards_1.EVENT_REWARDS.reduce((acc, row) => ({ packs: acc.packs + row.packs, coins: acc.coins + row.coins }), { packs: 0, coins: 0 });
55
55
  (0, globals_1.expect)((0, event_rewards_1.eventPayoutFor)(1)).toEqual(total);
56
56
  (0, globals_1.expect)(total).toEqual({ packs: 3, coins: 3500 });
@@ -1,4 +1,4 @@
1
- export type EventRewardBand = 'PARTICIPATION' | 'TOP_20' | 'TOP_10' | 'TOP_5' | 'TOP_3' | 'TOP_1';
1
+ export type EventRewardBand = 'PARTICIPATION' | 'FINAL_GROUP' | 'TOP_10' | 'TOP_5' | 'TOP_3' | 'TOP_1';
2
2
  export interface EventRewardRow {
3
3
  readonly band: EventRewardBand;
4
4
  /** Best final position that earns this row; PARTICIPATION has none. */
@@ -15,7 +15,8 @@ export interface EventRewardRow {
15
15
  export declare const EVENT_REWARDS: readonly EventRewardRow[];
16
16
  /**
17
17
  * The band a finish falls into. `position` is the place in the FINAL table; null means the team never reached
18
- * the final, and so does any position past the last banded row, which both count as taking part.
18
+ * the final (it went out in the group stage) and takes the participation row. The final holds MAX_FINAL_SIZE
19
+ * teams and the widest banded row (FINAL_GROUP) covers exactly that, so every finalist earns a banded row.
19
20
  */
20
21
  export declare function eventRewardBandFor(position: number | null): EventRewardBand;
21
22
  export interface EventPayout {
@@ -3,6 +3,7 @@
3
3
  // One source of truth for three consumers: the simulator grants from it, the About view lists it, and the
4
4
  // accolades page names the band. Rewards are CUMULATIVE, so a team collects every row from Participation down
5
5
  // to its own placement.
6
+ import { MAX_FINAL_SIZE } from './event-schedule';
6
7
  /**
7
8
  * Best band first. A team earns its own row and every row BELOW it, which is what "cumulative" means: first
8
9
  * place collects all six.
@@ -12,18 +13,19 @@ export const EVENT_REWARDS = [
12
13
  { band: 'TOP_3', maxPosition: 3, packs: 0, coins: 500 },
13
14
  { band: 'TOP_5', maxPosition: 5, packs: 0, coins: 1000 },
14
15
  { band: 'TOP_10', maxPosition: 10, packs: 1, coins: 0 },
15
- { band: 'TOP_20', maxPosition: 20, packs: 0, coins: 1000 },
16
+ { band: 'FINAL_GROUP', maxPosition: MAX_FINAL_SIZE, packs: 0, coins: 1000 },
16
17
  { band: 'PARTICIPATION', maxPosition: null, packs: 1, coins: 1000 }
17
18
  ];
18
19
  /**
19
20
  * The band a finish falls into. `position` is the place in the FINAL table; null means the team never reached
20
- * the final, and so does any position past the last banded row, which both count as taking part.
21
+ * the final (it went out in the group stage) and takes the participation row. The final holds MAX_FINAL_SIZE
22
+ * teams and the widest banded row (FINAL_GROUP) covers exactly that, so every finalist earns a banded row.
21
23
  */
22
24
  export function eventRewardBandFor(position) {
23
25
  if (position == null)
24
26
  return 'PARTICIPATION';
25
27
  // Rows are ordered best-first, so the FIRST row the position satisfies is the narrowest band it earns.
26
- // Scanning to the end instead would always land on the widest, handing first place a "top 20" badge.
28
+ // Scanning to the end instead would always land on the widest, handing first place a "final group" badge.
27
29
  for (const row of EVENT_REWARDS) {
28
30
  if (row.maxPosition != null && position <= row.maxPosition)
29
31
  return row.band;
@@ -9,11 +9,11 @@ describe('eventRewardBandFor()', () => {
9
9
  [5, 'TOP_5'],
10
10
  [6, 'TOP_10'],
11
11
  [10, 'TOP_10'],
12
- [11, 'TOP_20'],
13
- [20, 'TOP_20'],
14
- // Inside a 24-team final but outside every banded row, so it counts as taking part.
15
- [21, 'PARTICIPATION'],
16
- [24, 'PARTICIPATION']
12
+ [11, 'FINAL_GROUP'],
13
+ [20, 'FINAL_GROUP'],
14
+ // The final holds 24 teams and FINAL_GROUP covers all of them.
15
+ [21, 'FINAL_GROUP'],
16
+ [24, 'FINAL_GROUP']
17
17
  ])('places a finish of %i in %s', (position, band) => {
18
18
  expect(eventRewardBandFor(position)).toBe(band);
19
19
  });
@@ -24,9 +24,9 @@ describe('eventRewardBandFor()', () => {
24
24
  describe('eventPayoutFor()', () => {
25
25
  it.each([
26
26
  // position, packs, coins. Cumulative: every row from Participation down to the finish.
27
- [null, 1, 1000], // group stage: 1 pack + 1000
28
- [24, 1, 1000], // in the final but outside the top 20: still just participation
29
- [20, 1, 2000], // + top 20's 1000
27
+ [null, 1, 1000], // never reached the final (group stage): 1 pack + 1000
28
+ [24, 1, 2000], // last of the 24-team final: final group's 1000 on top of participation
29
+ [20, 1, 2000], // + final group's 1000
30
30
  [11, 1, 2000],
31
31
  [10, 2, 2000], // + top 10's pack
32
32
  [6, 2, 2000],
@@ -48,7 +48,7 @@ describe('eventPayoutFor()', () => {
48
48
  }
49
49
  });
50
50
  it('adds up to the owner-defined table for a winner', () => {
51
- // 1x pack + 1000 (participation), +1000 (top 20), +1 pack (top 10), +1000 (top 5), +500 (top 3), +1 pack (top 1)
51
+ // 1x pack + 1000 (participation), +1000 (final group), +1 pack (top 10), +1000 (top 5), +500 (top 3), +1 pack (top 1)
52
52
  const total = EVENT_REWARDS.reduce((acc, row) => ({ packs: acc.packs + row.packs, coins: acc.coins + row.coins }), { packs: 0, coins: 0 });
53
53
  expect(eventPayoutFor(1)).toEqual(total);
54
54
  expect(total).toEqual({ packs: 3, coins: 3500 });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "volleyballsimtypes",
3
- "version": "0.0.500",
3
+ "version": "0.0.501",
4
4
  "description": "vbsim types",
5
5
  "main": "./dist/cjs/src/index.js",
6
6
  "module": "./dist/esm/src/index.js",