maidraw 0.13.4 → 0.13.6

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/README.md CHANGED
@@ -2,12 +2,12 @@
2
2
 
3
3
  A simple library to draw images of
4
4
 
5
- - maimai DX: Best 50, Chart Detail
6
- - CHUNITHM: Best 40, Best 50, Chart Detail
7
- - O.N.G.E.K.I.: Best 55, Best 60, Chart Detail
5
+ - maimai DX: Best 50, Level 50, Chart Detail
6
+ - CHUNITHM: Best 40, Best 50, Chart Detail
7
+ - O.N.G.E.K.I.: Best 55, Best 60, Chart Detail
8
8
 
9
- Includes score adapters for
9
+ Get the adapter for various score trackers at
10
10
 
11
- - maimai DX: [kamaitachi](https://kamai.tachi.ac/), [LXNS](https://maimai.lxns.net/), [maishift](https://maimai.shiftpsh.com/), [Diving-Fish](https://www.diving-fish.com/maimaidx/prober/)
12
- - CHUNITHM: [kamaitachi](https://kamai.tachi.ac/), [LXNS](https://maimai.lxns.net/),
13
- - O.N.G.E.K.I.: [kamaitachi](https://kamai.tachi.ac/)
11
+ - maimai DX: [Kamaitachi](https://github.com/saltcute/maidraw-kamai-tachi-adapter), [LXNS](https://github.com/saltcute/maidraw-lxns-adapter), [maishift](https://github.com/saltcute/maidraw-maishift-adapter)
12
+ - CHUNITHM: [Kamaitachi](https://github.com/saltcute/maidraw-kamai-tachi-adapter), [LXNS](https://github.com/saltcute/maidraw-lxns-adapter),
13
+ - O.N.G.E.K.I.: [Kamaitachi](https://github.com/saltcute/maidraw-kamai-tachi-adapter)
@@ -0,0 +1,9 @@
1
+ /**
2
+ * A dirty workaround to disable all score validity check in rg-stats.
3
+ * Used so that the code won't be unnecessarily complicated just to simply calculate a rating.
4
+ *
5
+ * Eg. 101.0000% score without a ALL PERFECT+ lamp.
6
+ *
7
+ * TODO: a better way to handle this???
8
+ */
9
+ export {};
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ /**
3
+ * A dirty workaround to disable all score validity check in rg-stats.
4
+ * Used so that the code won't be unnecessarily complicated just to simply calculate a rating.
5
+ *
6
+ * Eg. 101.0000% score without a ALL PERFECT+ lamp.
7
+ *
8
+ * TODO: a better way to handle this???
9
+ */
10
+ Object.defineProperty(exports, "__esModule", { value: true });
11
+ const throwIf = require("rg-stats/js/util/throw-if");
12
+ throwIf.ThrowIf = () => { };
13
+ throwIf.ThrowIf.not = () => { };
14
+ throwIf.ThrowIf.negative = () => { };
15
+ throwIf.ThrowIf.positive = () => { };
16
+ throwIf.ThrowIf.positiveOrZero = () => { };
17
+ throwIf.ThrowIf.negativeOrZero = () => { };
18
+ throwIf.ThrowIf.zero = () => { };
19
+ //# sourceMappingURL=injectThrowIf.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"injectThrowIf.js","sourceRoot":"","sources":["../../../src/common/utils/injectThrowIf.ts"],"names":[],"mappings":";AAAA;;;;;;;GAOG;;AAEH,MAAM,OAAO,GAAG,OAAO,CAAC,2BAA2B,CAAC,CAAC;AACrD,OAAO,CAAC,OAAO,GAAG,GAAG,EAAE,GAAE,CAAC,CAAC;AAE3B,OAAO,CAAC,OAAO,CAAC,GAAG,GAAG,GAAG,EAAE,GAAE,CAAC,CAAC;AAC/B,OAAO,CAAC,OAAO,CAAC,QAAQ,GAAG,GAAG,EAAE,GAAE,CAAC,CAAC;AACpC,OAAO,CAAC,OAAO,CAAC,QAAQ,GAAG,GAAG,EAAE,GAAE,CAAC,CAAC;AACpC,OAAO,CAAC,OAAO,CAAC,cAAc,GAAG,GAAG,EAAE,GAAE,CAAC,CAAC;AAC1C,OAAO,CAAC,OAAO,CAAC,cAAc,GAAG,GAAG,EAAE,GAAE,CAAC,CAAC;AAC1C,OAAO,CAAC,OAAO,CAAC,IAAI,GAAG,GAAG,EAAE,GAAE,CAAC,CAAC"}
@@ -1 +1,2 @@
1
+ import "../common/utils/injectThrowIf";
1
2
  export * from "../chunithm/index";
@@ -14,5 +14,6 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
+ require("../common/utils/injectThrowIf");
17
18
  __exportStar(require("../chunithm/index"), exports);
18
19
  //# sourceMappingURL=chunithm.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"chunithm.js","sourceRoot":"","sources":["../../src/exports/chunithm.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,kDAAgC"}
1
+ {"version":3,"file":"chunithm.js","sourceRoot":"","sources":["../../src/exports/chunithm.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,uCAAqC;AAErC,kDAAgC"}
@@ -1,2 +1,3 @@
1
+ import "../common/utils/injectThrowIf";
1
2
  export { BaseScoreAdapter } from "../common/adapter";
2
3
  export * from "../common/error";
@@ -15,6 +15,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  exports.BaseScoreAdapter = void 0;
18
+ require("../common/utils/injectThrowIf");
18
19
  var adapter_1 = require("../common/adapter");
19
20
  Object.defineProperty(exports, "BaseScoreAdapter", { enumerable: true, get: function () { return adapter_1.BaseScoreAdapter; } });
20
21
  __exportStar(require("../common/error"), exports);
@@ -1 +1 @@
1
- {"version":3,"file":"common.js","sourceRoot":"","sources":["../../src/exports/common.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,2CAAmD;AAA1C,2GAAA,gBAAgB,OAAA;AACzB,gDAA8B"}
1
+ {"version":3,"file":"common.js","sourceRoot":"","sources":["../../src/exports/common.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,uCAAqC;AAErC,2CAAmD;AAA1C,2GAAA,gBAAgB,OAAA;AACzB,gDAA8B"}
@@ -1 +1,2 @@
1
+ import "../common/utils/injectThrowIf";
1
2
  export * from "../maimai/index";
@@ -14,5 +14,6 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
+ require("../common/utils/injectThrowIf");
17
18
  __exportStar(require("../maimai/index"), exports);
18
19
  //# sourceMappingURL=maimai.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"maimai.js","sourceRoot":"","sources":["../../src/exports/maimai.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,gDAA8B"}
1
+ {"version":3,"file":"maimai.js","sourceRoot":"","sources":["../../src/exports/maimai.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,uCAAqC;AAErC,gDAA8B"}
@@ -1 +1,2 @@
1
+ import "../common/utils/injectThrowIf";
1
2
  export * from "../ongeki/index";
@@ -14,5 +14,6 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
+ require("../common/utils/injectThrowIf");
17
18
  __exportStar(require("../ongeki/index"), exports);
18
19
  //# sourceMappingURL=ongeki.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ongeki.js","sourceRoot":"","sources":["../../src/exports/ongeki.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,gDAA8B"}
1
+ {"version":3,"file":"ongeki.js","sourceRoot":"","sources":["../../src/exports/ongeki.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,uCAAqC;AAErC,gDAA8B"}
@@ -5,4 +5,4 @@ export declare function getMaxPlatinumScore(chart: Chart): number;
5
5
  *
6
6
  * @param starRatio Ratio between achieved and maximum platinum score, from 0 to 1.
7
7
  */
8
- export declare function getStar(starRatio: number): 1 | 0 | 4 | 2 | 3 | 5;
8
+ export declare function getStar(starRatio: number): 1 | 0 | 4 | -1 | 2 | 3 | 5;
@@ -3,7 +3,13 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getMaxPlatinumScore = getMaxPlatinumScore;
4
4
  exports.getStar = getStar;
5
5
  function getMaxPlatinumScore(chart) {
6
- return (chart.notes.tap + chart.notes.hold + chart.notes.side + chart.notes.flick + chart.notes.bell) * 2;
6
+ if (chart.optionalData &&
7
+ typeof chart.optionalData === "object" &&
8
+ "totalNotes" in chart.optionalData &&
9
+ typeof chart.optionalData.totalNotes === "number") {
10
+ return chart.optionalData.totalNotes * 2;
11
+ }
12
+ return (chart.notes.tap + chart.notes.hold + chart.notes.side + chart.notes.flick) * 2;
7
13
  }
8
14
  /**
9
15
  * Get the amount of platinum stars given a platinum score ratio.
@@ -12,7 +18,7 @@ function getMaxPlatinumScore(chart) {
12
18
  */
13
19
  function getStar(starRatio) {
14
20
  if (starRatio < 0 || starRatio > 1)
15
- return 0;
21
+ return -1;
16
22
  if (starRatio >= 0.98)
17
23
  return 5;
18
24
  if (starRatio >= 0.97)
@@ -1 +1 @@
1
- {"version":3,"file":"util.js","sourceRoot":"","sources":["../../../src/ongeki/lib/util.ts"],"names":[],"mappings":";;AAEA,kDAEC;AAOD,0BAQC;AAjBD,SAAgB,mBAAmB,CAAC,KAAY;IAC5C,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,GAAG,KAAK,CAAC,KAAK,CAAC,IAAI,GAAG,KAAK,CAAC,KAAK,CAAC,IAAI,GAAG,KAAK,CAAC,KAAK,CAAC,KAAK,GAAG,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAC9G,CAAC;AAED;;;;GAIG;AACH,SAAgB,OAAO,CAAC,SAAiB;IACrC,IAAI,SAAS,GAAG,CAAC,IAAI,SAAS,GAAG,CAAC;QAAE,OAAO,CAAC,CAAC;IAC7C,IAAI,SAAS,IAAI,IAAI;QAAE,OAAO,CAAC,CAAC;IAChC,IAAI,SAAS,IAAI,IA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ACb,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "maidraw",
3
- "version": "0.13.4",
3
+ "version": "0.13.6",
4
4
  "description": "A simple library to draw geki/chu/mai images",
5
5
  "main": "dist/index.js",
6
6
  "exports": {