labag 1.0.8 → 1.0.10

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.ts CHANGED
@@ -3,6 +3,7 @@ import { Mode, ModeNames } from "./types/Mode";
3
3
  import { PlayLaBaG } from "./types/PlayLaBaG";
4
4
  import { JsonLaBaG } from "./types/JsonLaBaG";
5
5
  import { P, PData } from "./types/P";
6
+ import { parseScore, verifyScore } from './utils/data';
6
7
  declare const PDatas: Record<string, PData>;
7
8
  declare const Modes: Record<Exclude<ModeNames, "Normal">, Mode>;
8
- export { OneDataType, AllDataType, LaBaG, PlayLaBaG, JsonLaBaG, Modes, ModeNames, P, PData, PDatas, };
9
+ export { OneDataType, AllDataType, LaBaG, PlayLaBaG, JsonLaBaG, Modes, ModeNames, P, PData, PDatas, parseScore, verifyScore, };
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.PDatas = exports.P = exports.Modes = exports.JsonLaBaG = exports.PlayLaBaG = void 0;
3
+ exports.verifyScore = exports.parseScore = exports.PDatas = exports.P = exports.Modes = exports.JsonLaBaG = exports.PlayLaBaG = void 0;
4
4
  const RandInt_1 = require("./utils/RandInt");
5
5
  const PlayLaBaG_1 = require("./types/PlayLaBaG");
6
6
  Object.defineProperty(exports, "PlayLaBaG", { enumerable: true, get: function () { return PlayLaBaG_1.PlayLaBaG; } });
@@ -8,6 +8,9 @@ const JsonLaBaG_1 = require("./types/JsonLaBaG");
8
8
  Object.defineProperty(exports, "JsonLaBaG", { enumerable: true, get: function () { return JsonLaBaG_1.JsonLaBaG; } });
9
9
  const P_1 = require("./types/P");
10
10
  Object.defineProperty(exports, "P", { enumerable: true, get: function () { return P_1.P; } });
11
+ const data_1 = require("./utils/data");
12
+ Object.defineProperty(exports, "parseScore", { enumerable: true, get: function () { return data_1.parseScore; } });
13
+ Object.defineProperty(exports, "verifyScore", { enumerable: true, get: function () { return data_1.verifyScore; } });
11
14
  const PDatas = {
12
15
  Gss: {
13
16
  name: "咖波",
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.BaseLaBaG = void 0;
4
4
  const __1 = require("..");
5
5
  const P_1 = require("./P");
6
- const RandInt_1 = require("src/utils/RandInt");
6
+ const RandInt_1 = require("../utils/RandInt");
7
7
  class BaseLaBaG {
8
8
  AllData = {};
9
9
  OneData = {};
@@ -0,0 +1,3 @@
1
+ import { AllDataType } from "../types/LaBaG";
2
+ export declare const parseScore: (allData: AllDataType) => number;
3
+ export declare const verifyScore: (score: number, allData: AllDataType) => boolean;
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.verifyScore = exports.parseScore = void 0;
4
+ const JsonLaBaG_1 = require("../types/JsonLaBaG");
5
+ const parseScore = (allData) => {
6
+ const game = new JsonLaBaG_1.JsonLaBaG();
7
+ game.SetupData(allData);
8
+ game.Logic();
9
+ return game.Score;
10
+ };
11
+ exports.parseScore = parseScore;
12
+ const verifyScore = (score, allData) => (0, exports.parseScore)(allData) === score;
13
+ exports.verifyScore = verifyScore;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "labag",
3
- "version": "1.0.8",
3
+ "version": "1.0.10",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
package/src/index.ts CHANGED
@@ -4,6 +4,7 @@ import { RandInt } from "./utils/RandInt";
4
4
  import { PlayLaBaG } from "./types/PlayLaBaG";
5
5
  import { JsonLaBaG } from "./types/JsonLaBaG";
6
6
  import { P, PData } from "./types/P";
7
+ import { parseScore, verifyScore } from './utils/data';
7
8
 
8
9
  const PDatas: Record<string, PData> = {
9
10
  Gss: {
@@ -188,8 +189,11 @@ export {
188
189
 
189
190
  Modes,
190
191
  ModeNames,
191
-
192
+
192
193
  P,
193
194
  PData,
194
195
  PDatas,
196
+
197
+ parseScore,
198
+ verifyScore,
195
199
  };
@@ -2,7 +2,7 @@ import { Modes } from "..";
2
2
  import { AllDataType, LaBaG, OneDataType } from "./LaBaG";
3
3
  import { Mode, ModeNames } from "./Mode";
4
4
  import { P } from "./P";
5
- import { RandInt } from "src/utils/RandInt";
5
+ import { RandInt } from "../utils/RandInt";
6
6
 
7
7
  export class BaseLaBaG implements LaBaG {
8
8
  AllData: AllDataType = {};
@@ -0,0 +1,12 @@
1
+ import { JsonLaBaG } from "../types/JsonLaBaG";
2
+ import { AllDataType } from "../types/LaBaG";
3
+
4
+ export const parseScore = (allData: AllDataType): number => {
5
+ const game = new JsonLaBaG();
6
+ game.SetupData(allData);
7
+ game.Logic();
8
+ return game.Score;
9
+ };
10
+
11
+ export const verifyScore = (score: number, allData: AllDataType): boolean =>
12
+ parseScore(allData) === score;