rhythia-api 156.0.0 → 157.0.0
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/api/getTimestamp.ts +2 -2
- package/api/submitScore.ts +11 -1
- package/index.ts +1 -0
- package/package.json +1 -1
package/api/getTimestamp.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { NextResponse } from "next/server";
|
|
2
2
|
import z from "zod";
|
|
3
|
-
import { protectedApi
|
|
3
|
+
import { protectedApi } from "../utils/requestUtils";
|
|
4
4
|
|
|
5
5
|
export const Schema = {
|
|
6
6
|
input: z.strictObject({}),
|
|
@@ -13,7 +13,7 @@ export async function POST(request: Request) {
|
|
|
13
13
|
return protectedApi({
|
|
14
14
|
request,
|
|
15
15
|
schema: Schema,
|
|
16
|
-
authorization:
|
|
16
|
+
authorization: () => {},
|
|
17
17
|
activity: handler,
|
|
18
18
|
});
|
|
19
19
|
}
|
package/api/submitScore.ts
CHANGED
|
@@ -18,6 +18,7 @@ export const Schema = {
|
|
|
18
18
|
hits: z.number(),
|
|
19
19
|
mapHash: z.string(),
|
|
20
20
|
speed: z.number(),
|
|
21
|
+
mods: z.array(z.string()),
|
|
21
22
|
}),
|
|
22
23
|
}),
|
|
23
24
|
output: z.object({
|
|
@@ -155,9 +156,18 @@ export async function handler({
|
|
|
155
156
|
beatmaps.noteCount
|
|
156
157
|
);
|
|
157
158
|
|
|
159
|
+
let multiplierMod = 1;
|
|
160
|
+
if (data.mods.includes("mod_hardrock")) {
|
|
161
|
+
multiplierMod *= 1.075;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
if (data.mods.includes("mod_nofail")) {
|
|
165
|
+
multiplierMod *= 0.5;
|
|
166
|
+
}
|
|
167
|
+
|
|
158
168
|
if (beatmaps.starRating) {
|
|
159
169
|
awarded_sp = calculatePerformancePoints(
|
|
160
|
-
data.speed * beatmaps.starRating,
|
|
170
|
+
data.speed * beatmaps.starRating * multiplierMod,
|
|
161
171
|
accurracy
|
|
162
172
|
);
|
|
163
173
|
}
|
package/index.ts
CHANGED