@slot-engine/core 0.2.11 → 0.2.12

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.
package/dist/index.d.mts CHANGED
@@ -65,6 +65,7 @@ type PermanentFilePaths = {
65
65
  statsPayouts: string;
66
66
  statsSummary: string;
67
67
  statsRecords: string;
68
+ frontendConfig: string;
68
69
  };
69
70
  type TemporaryFilePaths = {
70
71
  tempBooks: (mode: string, i: number) => string;
package/dist/index.d.ts CHANGED
@@ -65,6 +65,7 @@ type PermanentFilePaths = {
65
65
  statsPayouts: string;
66
66
  statsSummary: string;
67
67
  statsRecords: string;
68
+ frontendConfig: string;
68
69
  };
69
70
  type TemporaryFilePaths = {
70
71
  tempBooks: (mode: string, i: number) => string;
package/dist/index.js CHANGED
@@ -94,7 +94,8 @@ function createPermanentFilePaths(basePath) {
94
94
  simulationSummary: import_path.default.join(basePath, "simulation_summary.json"),
95
95
  statsPayouts: import_path.default.join(basePath, "stats_payouts.json"),
96
96
  statsSummary: import_path.default.join(basePath, "stats_summary.json"),
97
- statsRecords: import_path.default.join(basePath, "stats_records.json")
97
+ statsRecords: import_path.default.join(basePath, "stats_records.json"),
98
+ frontendConfig: import_path.default.join(basePath, "frontend_config.json")
98
99
  };
99
100
  }
100
101
  function createTemporaryFilePaths(basePath, tempFolder) {
@@ -3746,6 +3747,43 @@ async function rustProgram(...args) {
3746
3747
 
3747
3748
  // src/slot-game/index.ts
3748
3749
  var import_worker_threads5 = require("worker_threads");
3750
+
3751
+ // src/utils/frontend-config.ts
3752
+ function createFrontendConfig(config, meta) {
3753
+ const path9 = meta.paths.frontendConfig;
3754
+ const gameModes = Object.values(config.gameModes).map((gm) => ({
3755
+ name: gm.name,
3756
+ cost: gm.cost,
3757
+ rtp: gm.rtp
3758
+ }));
3759
+ const reelSets = /* @__PURE__ */ new Map();
3760
+ Object.values(config.gameModes).forEach((gm) => {
3761
+ gm.reelSets.forEach((reelSet) => {
3762
+ reelSet.associatedGameModeName = gm.name;
3763
+ reelSet.generateReels(config);
3764
+ if (!reelSets.has(reelSet.id)) {
3765
+ reelSets.set(
3766
+ reelSet.id,
3767
+ reelSet.reels.map((reel) => reel.map((s) => s.id))
3768
+ );
3769
+ }
3770
+ });
3771
+ });
3772
+ const frontendConfig = {
3773
+ name: config.name,
3774
+ maxWin: config.maxWinX,
3775
+ padSymbols: config.padSymbols,
3776
+ symbols: Array.from(config.symbols.values()).map((s) => ({
3777
+ id: s.id,
3778
+ pays: s.pays
3779
+ })),
3780
+ gameModes,
3781
+ reelSets: Object.fromEntries(reelSets)
3782
+ };
3783
+ writeJsonFile(path9, frontendConfig);
3784
+ }
3785
+
3786
+ // src/slot-game/index.ts
3749
3787
  var SlotGame = class _SlotGame {
3750
3788
  configOpts;
3751
3789
  simulation;
@@ -3833,7 +3871,10 @@ var SlotGame = class _SlotGame {
3833
3871
  this.runAnalysis(opts.analysisOpts || { gameModes: [] });
3834
3872
  }
3835
3873
  }
3836
- if (import_worker_threads5.isMainThread) console.log("Done!");
3874
+ if (import_worker_threads5.isMainThread) {
3875
+ createFrontendConfig(this.getConfig(), this.getMetadata());
3876
+ console.log("Done!");
3877
+ }
3837
3878
  }
3838
3879
  /**
3839
3880
  * Gets the game configuration.