decord/beta/source/modules/guild_rooms/GuildRoomUtils.tsx
github-actions 84d017ff78 chore: update source for beta 348.6
Skipped 1 file(s) >100MB (GitHub limit): source/__polyfill/05xxx/module_5021.js (118.4 MB)
2026-09-28 16:18:32 +00:00

82 lines
3.1 KiB
TypeScript

// Module ID: 4997
// Function ID: 4998
// Name: GuildRoomUtils
// Dependencies: [4994, 4998, 4999, 4996, 4995, 2]
// Exports: findSeat, serverGuildRoomToClient
// Module 4997 (GuildRoomUtils)
import GuildRoomTypes from "GuildRoomTypes" /* 4995 */;
import GuildRoomSeats from "GuildRoomSeats" /* 4996 */;
import GuildRoomBackgrounds from "GuildRoomBackgrounds" /* 4999 */;
import GuildRoomStore from "GuildRoomStore" /* 4994 */;
require = fn;
function serverGuildRoomObjectToClient(object_type) {
if (object_type.object_type === GuildRoomTypes.GuildRoomObjectTypes.PLANT) {
const obj = { objectType: tmp(4995).GuildRoomObjectTypes.PLANT };
const obj7 = { objectId: null, createdBy: null, updatedAt: null, updatedBy: null };
({ object_id: obj2.objectId, created_by: obj2.createdBy } = object_type);
let date;
if (null != object_type.updated_at) {
const _Date2 = Date;
date = new Date(object_type.updated_at);
}
obj7.updatedAt = date;
obj7.updatedBy = object_type.updated_by;
const merged = Object.assign(obj7);
let obj8 = obj;
} else {
obj8 = { objectType: tmp(4995).GuildRoomObjectTypes.NOTE };
const obj9 = { objectId: null, createdBy: null, updatedAt: null, updatedBy: null };
({ object_id: obj4.objectId, created_by: obj4.createdBy } = object_type);
let date1;
if (null != object_type.updated_at) {
const _Date = Date;
date1 = new Date(object_type.updated_at);
}
obj9.updatedAt = date1;
obj9.updatedBy = object_type.updated_by;
const merged1 = Object.assign(obj9);
({ content: obj3.content, position: obj3.position } = object_type);
}
return obj8;
}
let closure_3 = fn(4998).GUILD_ROOM_BACKGROUND_CONFIG;
const size = fn(2);
let result = size.fileFinishedImporting("modules/guild_rooms/GuildRoomUtils.tsx");
export const findSeat = function findSeat(seat, position, channelId) {
const room = GuildRoomStore.getRoom(channelId);
let background;
if (room != null) {
background = room.background;
}
if (background == null) {
background = GuildRoomBackgrounds.GuildRoomBackgrounds.DEFAULT;
}
const seats = closure_3[background].seats;
if (null != seat) {
if (seat !== GuildRoomSeats.GuildRoomSeats.UNSET) {
let found = seats[seat];
}
return found;
}
const values = Object.values(seats);
found = values.find((position) => position.position.x === position.x && position.position.y === tmp.y);
};
export const serverGuildRoomToClient = function serverGuildRoomToClient(body) {
const obj = { roomId: body.room_id, users: null, background: body.background, objects: null };
const users = body.users;
obj.users = users.reduce((set, userId) => {
const result = set.set(userId.user_id, { userId: userId.user_id, seat: userId.seat, position: userId.position, statusId: userId.status_id, statusText: userId.status_text });
return set;
}, new Map());
const entries = Object.entries(body.objects);
const map = new Map();
obj.objects = entries.reduce((set, item) => {
[tmp, arr] = item;
const result = set.set(+tmp, arr.map(serverGuildRoomObjectToClient));
return set;
}, new Map());
return obj;
};