@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.mjs CHANGED
@@ -45,7 +45,8 @@ function createPermanentFilePaths(basePath) {
45
45
  simulationSummary: path.join(basePath, "simulation_summary.json"),
46
46
  statsPayouts: path.join(basePath, "stats_payouts.json"),
47
47
  statsSummary: path.join(basePath, "stats_summary.json"),
48
- statsRecords: path.join(basePath, "stats_records.json")
48
+ statsRecords: path.join(basePath, "stats_records.json"),
49
+ frontendConfig: path.join(basePath, "frontend_config.json")
49
50
  };
50
51
  }
51
52
  function createTemporaryFilePaths(basePath, tempFolder) {
@@ -3697,6 +3698,43 @@ async function rustProgram(...args) {
3697
3698
 
3698
3699
  // src/slot-game/index.ts
3699
3700
  import { isMainThread as isMainThread5, workerData as workerData2 } from "worker_threads";
3701
+
3702
+ // src/utils/frontend-config.ts
3703
+ function createFrontendConfig(config, meta) {
3704
+ const path9 = meta.paths.frontendConfig;
3705
+ const gameModes = Object.values(config.gameModes).map((gm) => ({
3706
+ name: gm.name,
3707
+ cost: gm.cost,
3708
+ rtp: gm.rtp
3709
+ }));
3710
+ const reelSets = /* @__PURE__ */ new Map();
3711
+ Object.values(config.gameModes).forEach((gm) => {
3712
+ gm.reelSets.forEach((reelSet) => {
3713
+ reelSet.associatedGameModeName = gm.name;
3714
+ reelSet.generateReels(config);
3715
+ if (!reelSets.has(reelSet.id)) {
3716
+ reelSets.set(
3717
+ reelSet.id,
3718
+ reelSet.reels.map((reel) => reel.map((s) => s.id))
3719
+ );
3720
+ }
3721
+ });
3722
+ });
3723
+ const frontendConfig = {
3724
+ name: config.name,
3725
+ maxWin: config.maxWinX,
3726
+ padSymbols: config.padSymbols,
3727
+ symbols: Array.from(config.symbols.values()).map((s) => ({
3728
+ id: s.id,
3729
+ pays: s.pays
3730
+ })),
3731
+ gameModes,
3732
+ reelSets: Object.fromEntries(reelSets)
3733
+ };
3734
+ writeJsonFile(path9, frontendConfig);
3735
+ }
3736
+
3737
+ // src/slot-game/index.ts
3700
3738
  var SlotGame = class _SlotGame {
3701
3739
  configOpts;
3702
3740
  simulation;
@@ -3784,7 +3822,10 @@ var SlotGame = class _SlotGame {
3784
3822
  this.runAnalysis(opts.analysisOpts || { gameModes: [] });
3785
3823
  }
3786
3824
  }
3787
- if (isMainThread5) console.log("Done!");
3825
+ if (isMainThread5) {
3826
+ createFrontendConfig(this.getConfig(), this.getMetadata());
3827
+ console.log("Done!");
3828
+ }
3788
3829
  }
3789
3830
  /**
3790
3831
  * Gets the game configuration.