Update Healer Man server
This commit is contained in:
1 parent
15a5254380
commit
9d7e0e2f9e
71 files changed
+3490
-81
No files matched your search
@@ -1,5 +1,6 @@
|
||||
import { randomUUID } from "node:crypto";
|
||||
import { GameDatabaseError } from "./database.mjs";
|
||||
import { BITE_SIZED_LAYOUT_CATALOG } from "../shared/bite-sized-layouts.mjs";
|
||||
import { botOpponent, botProgress, botTierForRecord, compatibleDungeons, hashRaceSeed, raceDungeons, rollRaceAffixes,
|
||||
RACE_COUNTDOWN_MS, RACE_DISCONNECT_MS, RACE_MAX_MS, RACE_PREPARE_MS, RACE_QUEUE_WAIT_MS } from "./dungeon-race-rules.mjs";
|
||||
|
||||
@@ -31,6 +32,7 @@ export function createDungeonRaceService({ database, now = () => Date.now(), aut
|
||||
return { status: match.status === "active" && timestamp < match.startAt ? "countdown" : match.status,
|
||||
serverTime: timestamp, matchId: match.id, seed: match.seed, dungeonId: match.dungeonId,
|
||||
difficultyId: match.difficultyId, bossDifficulty: match.bossDifficulty, affixIds: match.affixIds,
|
||||
...(match.biteSizedSelection ? { biteSizedSelection: match.biteSizedSelection } : {}),
|
||||
prepareDeadline: match.createdAt + RACE_PREPARE_MS, startAt: match.startAt,
|
||||
ready: self?.readyAt != null, opponent: match.bot ?? (rival ? { type: "human", name: rival.username,
|
||||
source: rival.source, ready: rival.readyAt != null, finished: rival.clearAt != null } : null),
|
||||
@@ -56,11 +58,13 @@ export function createDungeonRaceService({ database, now = () => Date.now(), aut
|
||||
const dungeon = choices[hashRaceSeed(id) % choices.length];
|
||||
const affixIds = rollRaceAffixes(id);
|
||||
const bot = right ? null : makeBot(id, left.accountId, affixIds);
|
||||
const biteSizedSelection = database.resolveBiteSizedRun?.(dungeon.id, id,
|
||||
BITE_SIZED_LAYOUT_CATALOG.dungeons.filter((d) => !database.getDungeonQueuePolicy().config.disabled.biteSized.includes(d.id)).map((d) => d.id));
|
||||
const participants = [left, ...(right ? [right] : [{ side: 1, accountId: null,
|
||||
characterId: null, username: bot.name, source: bot.source, role: null }])]
|
||||
.map((entry, side) => ({ side, accountId: entry.accountId, characterId: entry.characterId,
|
||||
username: entry.username, source: entry.source, role: entry.role }));
|
||||
const match = database.createDungeonRaceMatch({ id, dungeonId: dungeon.id, seed: id, affixIds,
|
||||
const match = database.createDungeonRaceMatch({ id, dungeonId: dungeon.id, seed: id, affixIds, biteSizedSelection,
|
||||
difficultyId: dungeon.defaultDifficultyId, createdAt: timestamp, participants, bot });
|
||||
matches.set(id, match);
|
||||
for (const participant of participants) if (participant.accountId) {
|
||||
|
||||
Reference in new issue
Block a user