@slot-engine/core 0.0.7 → 0.0.9

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
@@ -2028,14 +2028,39 @@ var Analysis = class {
2028
2028
  [15e3, 19999.99],
2029
2029
  [2e4, 24999.99]
2030
2030
  ];
2031
+ const payoutRanges = {};
2031
2032
  for (const modeStr of gameModes) {
2032
- const mode = this.getGameModeConfig(modeStr);
2033
+ payoutRanges[modeStr] = {};
2033
2034
  const lutOptimized = parseLookupTable(
2034
2035
  fs3.readFileSync(this.filePaths[modeStr].lutOptimized, "utf-8")
2035
2036
  );
2036
- const totalWeight = getTotalLutWeight(lutOptimized);
2037
- const payoutWeights = getPayoutWeights(lutOptimized);
2037
+ lutOptimized.forEach(([, , p]) => {
2038
+ const payout = p / 100;
2039
+ for (const [min, max] of winRanges) {
2040
+ if (payout >= min && payout <= max) {
2041
+ const rangeKey = `${min}-${max}`;
2042
+ if (!payoutRanges[modeStr][rangeKey]) {
2043
+ payoutRanges[modeStr][rangeKey] = 0;
2044
+ }
2045
+ payoutRanges[modeStr][rangeKey] += 1;
2046
+ break;
2047
+ }
2048
+ }
2049
+ });
2050
+ const orderedRanges = {};
2051
+ Object.keys(payoutRanges[modeStr]).sort((a, b) => {
2052
+ const [aMin] = a.split("-").map(Number);
2053
+ const [bMin] = b.split("-").map(Number);
2054
+ return aMin - bMin;
2055
+ }).forEach((key) => {
2056
+ orderedRanges[key] = payoutRanges[modeStr][key];
2057
+ });
2058
+ payoutRanges[modeStr] = orderedRanges;
2038
2059
  }
2060
+ writeJsonFile(
2061
+ path2.join(process.cwd(), this.gameConfig.outputDir, "stats_payouts.json"),
2062
+ payoutRanges
2063
+ );
2039
2064
  }
2040
2065
  getGameModeConfig(mode) {
2041
2066
  const config = this.gameConfig.gameModes[mode];