mirror of
https://github.com/djdevin/recflare.git
synced 2026-10-27 16:08:58 -07:00
[www] reset dorm button for 2023
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import {
|
||||
addUsernameChange,
|
||||
addXp,
|
||||
clearDormSaveBlob,
|
||||
clearPasswordHash,
|
||||
createGift,
|
||||
getAccount,
|
||||
@@ -1532,6 +1533,25 @@ export async function clearPasswordHandler(c: Context<App>) {
|
||||
return c.json({ playerId, hadPassword })
|
||||
}
|
||||
|
||||
/**
|
||||
* Blank the scene on a player's dorm, for a player going back to the 2023 client: a dorm
|
||||
* saved by a newer one won't load there. It publishes a new, empty save rather than erasing
|
||||
* anything, so `previousSaveId` is the save to restore if they want the old dorm back.
|
||||
* `saveId` is null when there was nothing to clear, which writes nothing and is still
|
||||
* logged; a player with no dorm at all is a 404.
|
||||
*/
|
||||
export async function clearDormHandler(c: Context<App>) {
|
||||
const playerId = playerIdParam(c)
|
||||
if (playerId === null) return c.json({ error: 'A numeric player id is required' }, 400)
|
||||
|
||||
const cleared = await clearDormSaveBlob(c.env.DB, playerId)
|
||||
if (cleared === null) return c.json({ error: 'That player has no dorm' }, 404)
|
||||
|
||||
await recordPlayerAudit(c, 'clear_dorm', { playerId, ...cleared })
|
||||
logger.info('staff cleared a dorm', { moderatorId: staffId(c), playerId, ...cleared })
|
||||
return c.json({ playerId, ...cleared })
|
||||
}
|
||||
|
||||
/**
|
||||
* Give a player Rec Room Plus by setting `hasPlus` on their account — the same flag the
|
||||
* Discord benefits claim and `runx admin grant-plus` set, with no Discord link involved.
|
||||
|
||||
Reference in New Issue
Block a user