Release Healer Man 0.1.40
This commit is contained in:
1 parent
ed0d2fea3d
commit
197a64117c
215 files changed
+5131
-181
No files matched your search
@@ -1,3 +1,5 @@
|
||||
import { validBossDifficulty } from "./dungeonDifficulty";
|
||||
|
||||
export interface DungeonRunMember {
|
||||
readonly name: string;
|
||||
readonly classId: string;
|
||||
@@ -11,6 +13,7 @@ export interface DungeonRunProgress {
|
||||
readonly id: string;
|
||||
readonly dungeonId: string;
|
||||
readonly difficultyId: string;
|
||||
readonly bossDifficulty?: number;
|
||||
readonly startedAt: number | null;
|
||||
readonly finishedAt: number | null;
|
||||
readonly durationMs: number | null;
|
||||
@@ -23,6 +26,7 @@ export interface DungeonRunRecord {
|
||||
readonly id: string;
|
||||
readonly dungeonId: string;
|
||||
readonly difficultyId: string;
|
||||
readonly bossDifficulty?: number;
|
||||
readonly durationMs: number;
|
||||
readonly finishedAt: number;
|
||||
readonly killedBossIds: readonly string[];
|
||||
@@ -57,6 +61,7 @@ export function normalizeDungeonRunProgress(value: unknown): DungeonRunProgress
|
||||
const text = (entry: unknown) => typeof entry === "string" && entry.length > 0 && entry.length <= 100;
|
||||
const time = (entry: unknown) => entry === null || (typeof entry === "number" && Number.isFinite(entry) && entry >= 0);
|
||||
if (!text(input.id) || !text(input.dungeonId) || !text(input.difficultyId)
|
||||
|| (input.bossDifficulty !== undefined && !validBossDifficulty(input.bossDifficulty))
|
||||
|| !time(input.startedAt) || !time(input.finishedAt) || !time(input.durationMs)
|
||||
|| typeof input.timed !== "boolean" || !Array.isArray(input.killedBossIds)
|
||||
|| input.killedBossIds.length > 100 || !input.killedBossIds.every(text)
|
||||
@@ -70,6 +75,7 @@ export function normalizeDungeonRunProgress(value: unknown): DungeonRunProgress
|
||||
|| (input.finishedAt !== null && (input.durationMs === null || input.party.length === 0
|
||||
|| input.durationMs !== Math.max(1, Math.round(input.finishedAt - input.startedAt!))))) return null;
|
||||
return { id: input.id, dungeonId: input.dungeonId, difficultyId: input.difficultyId,
|
||||
...(input.bossDifficulty !== undefined ? { bossDifficulty: input.bossDifficulty } : {}),
|
||||
startedAt: input.startedAt, finishedAt: input.finishedAt, durationMs: input.durationMs,
|
||||
timed: input.timed, killedBossIds: [...new Set(input.killedBossIds)],
|
||||
party: input.party.map((member) => ({ name: member.name, classId: member.classId,
|
||||
|
||||
Reference in new issue
Block a user