XFE Git
XFE Studio Git
Git 首页 全局搜索
XFE 主站 文档 NuGet

XFESpaceNinjaServer

A simple server for a small space ninja game

公开
关注 0 Fork 0 Star 0
返回提交历史

XFEstudio/XFESpaceNinjaServer

chore: some fixes to enter guild dojo on U15 (#2088)

Reviewed-on: https://onlyg.it/OpenWF/SpaceNinjaServer/pulls/2088 Co-authored-by: Sainan <63328889+Sainan@users.noreply.github.com> Co-committed-by: Sainan <63328889+Sainan@users.noreply.github.com>

21164554
Sainan <63328889+Sainan@users.noreply.github.com>
提交于

代码差异

13 个文件 +103 -104
Modified src/controllers/api/confirmGuildInvitationController.ts +1 -1
@@ -62,7 +62,7 @@ export const confirmGuildInvitationGetController: RequestHandler = async (req, r
62 62 await guild.save();
63 63
64 64 res.json({
65 ...(await getGuildClient(guild, account._id.toString())),
65 ...(await getGuildClient(guild, account)),
66 66 InventoryChanges: inventoryChanges
67 67 });
68 68 } else {
Modified src/controllers/api/createGuildController.ts +6 -6
@@ -1,5 +1,5 @@
1 1 import { RequestHandler } from "express";
2 import { getAccountIdForRequest } from "@/src/services/loginService";
2 import { getAccountForRequest } from "@/src/services/loginService";
3 3 import { getJSONfromString } from "@/src/helpers/stringHelpers";
4 4 import { Guild, GuildMember } from "@/src/models/guildModel";
5 5 import { createUniqueClanName, getGuildClient, giveClanKey } from "@/src/services/guildService";
@@ -7,11 +7,11 @@ import { getInventory } from "@/src/services/inventoryService";
7 7 import { IInventoryChanges } from "@/src/types/purchaseTypes";
8 8
9 9 export const createGuildController: RequestHandler = async (req, res) => {
10 const accountId = await getAccountIdForRequest(req);
10 const account = await getAccountForRequest(req);
11 11 const payload = getJSONfromString<ICreateGuildRequest>(String(req.body));
12 12
13 13 // Remove pending applications for this account
14 await GuildMember.deleteMany({ accountId, status: 1 });
14 await GuildMember.deleteMany({ accountId: account._id, status: 1 });
15 15
16 16 // Create guild on database
17 17 const guild = new Guild({
@@ -21,20 +21,20 @@ export const createGuildController: RequestHandler = async (req, res) => {
21 21
22 22 // Create guild member on database
23 23 await GuildMember.insertOne({
24 accountId: accountId,
24 accountId: account._id,
25 25 guildId: guild._id,
26 26 status: 0,
27 27 rank: 0
28 28 });
29 29
30 const inventory = await getInventory(accountId, "GuildId LevelKeys Recipes");
30 const inventory = await getInventory(account._id.toString(), "GuildId LevelKeys Recipes");
31 31 inventory.GuildId = guild._id;
32 32 const inventoryChanges: IInventoryChanges = {};
33 33 giveClanKey(inventory, inventoryChanges);
34 34 await inventory.save();
35 35
36 36 res.json({
37 ...(await getGuildClient(guild, accountId)),
37 ...(await getGuildClient(guild, account)),
38 38 InventoryChanges: inventoryChanges
39 39 });
40 40 };
Modified src/controllers/api/getGuildController.ts +4 -4
@@ -1,13 +1,13 @@
1 1 import { RequestHandler } from "express";
2 2 import { Guild } from "@/src/models/guildModel";
3 import { getAccountIdForRequest } from "@/src/services/loginService";
3 import { getAccountForRequest } from "@/src/services/loginService";
4 4 import { logger } from "@/src/utils/logger";
5 5 import { getInventory } from "@/src/services/inventoryService";
6 6 import { createUniqueClanName, getGuildClient } from "@/src/services/guildService";
7 7
8 8 export const getGuildController: RequestHandler = async (req, res) => {
9 const accountId = await getAccountIdForRequest(req);
10 const inventory = await getInventory(accountId, "GuildId");
9 const account = await getAccountForRequest(req);
10 const inventory = await getInventory(account._id.toString(), "GuildId");
11 11 if (inventory.GuildId) {
12 12 const guild = await Guild.findById(inventory.GuildId);
13 13 if (guild) {
@@ -24,7 +24,7 @@ export const getGuildController: RequestHandler = async (req, res) => {
24 24 guild.CeremonyResetDate = undefined;
25 25 await guild.save();
26 26 }
27 res.json(await getGuildClient(guild, accountId));
27 res.json(await getGuildClient(guild, account));
28 28 return;
29 29 }
30 30 }
Modified src/controllers/api/getGuildDojoController.ts +3 -1
@@ -2,6 +2,7 @@ import { RequestHandler } from "express";
2 2 import { Types } from "mongoose";
3 3 import { Guild } from "@/src/models/guildModel";
4 4 import { getDojoClient } from "@/src/services/guildService";
5 import { Account } from "@/src/models/loginModel";
5 6
6 7 export const getGuildDojoController: RequestHandler = async (req, res) => {
7 8 const guildId = req.query.guildId as string;
@@ -25,7 +26,8 @@ export const getGuildDojoController: RequestHandler = async (req, res) => {
25 26 }
26 27
27 28 const payload: IGetGuildDojoRequest = req.body ? (JSON.parse(String(req.body)) as IGetGuildDojoRequest) : {};
28 res.json(await getDojoClient(guild, 0, payload.ComponentId));
29 const account = await Account.findById(req.query.accountId as string);
30 res.json(await getDojoClient(guild, 0, payload.ComponentId, account?.BuildLabel));
29 31 };
30 32
31 33 interface IGetGuildDojoRequest {
Modified src/controllers/api/hostSessionController.ts +12 -5
@@ -1,17 +1,24 @@
1 1 import { RequestHandler } from "express";
2 import { getAccountIdForRequest } from "@/src/services/loginService";
2 import { getAccountForRequest } from "@/src/services/loginService";
3 3 import { createNewSession } from "@/src/managers/sessionManager";
4 4 import { logger } from "@/src/utils/logger";
5 5 import { ISession } from "@/src/types/session";
6 import { JSONParse } from "json-with-bigint";
7 import { toOid2, version_compare } from "@/src/helpers/inventoryHelpers";
6 8
7 9 const hostSessionController: RequestHandler = async (req, res) => {
8 const accountId = await getAccountIdForRequest(req);
9 const hostSessionRequest = JSON.parse(req.body as string) as ISession;
10 const account = await getAccountForRequest(req);
11 const hostSessionRequest = JSONParse(String(req.body)) as ISession;
10 12 logger.debug("HostSession Request", { hostSessionRequest });
11 const session = createNewSession(hostSessionRequest, accountId);
13 const session = createNewSession(hostSessionRequest, account._id);
12 14 logger.debug(`New Session Created`, { session });
13 15
14 res.json({ sessionId: { $oid: session.sessionId }, rewardSeed: 99999999 });
16 if (account.BuildLabel && version_compare(account.BuildLabel, "2015.03.21.08.17") < 0) {
17 // U15 or below
18 res.send(session.sessionId.toString());
19 } else {
20 res.json({ sessionId: toOid2(session.sessionId, account.BuildLabel), rewardSeed: 99999999 });
21 }
15 22 };
16 23
17 24 export { hostSessionController };
Modified src/controllers/api/startDojoRecipeController.ts +5 -5
@@ -11,7 +11,7 @@ import {
11 11 import { Types } from "mongoose";
12 12 import { ExportDojoRecipes } from "warframe-public-export-plus";
13 13 import { config } from "@/src/services/configService";
14 import { getAccountIdForRequest } from "@/src/services/loginService";
14 import { getAccountForRequest } from "@/src/services/loginService";
15 15 import { getInventory } from "@/src/services/inventoryService";
16 16
17 17 interface IStartDojoRecipeRequest {
@@ -20,10 +20,10 @@ interface IStartDojoRecipeRequest {
20 20 }
21 21
22 22 export const startDojoRecipeController: RequestHandler = async (req, res) => {
23 const accountId = await getAccountIdForRequest(req);
24 const inventory = await getInventory(accountId, "GuildId LevelKeys");
23 const account = await getAccountForRequest(req);
24 const inventory = await getInventory(account._id.toString(), "GuildId LevelKeys");
25 25 const guild = await getGuildForRequestEx(req, inventory);
26 if (!hasAccessToDojo(inventory) || !(await hasGuildPermission(guild, accountId, GuildPermission.Architect))) {
26 if (!hasAccessToDojo(inventory) || !(await hasGuildPermission(guild, account._id, GuildPermission.Architect))) {
27 27 res.json({ DojoRequestStatus: -1 });
28 28 return;
29 29 }
@@ -64,5 +64,5 @@ export const startDojoRecipeController: RequestHandler = async (req, res) => {
64 64 setDojoRoomLogFunded(guild, component);
65 65 }
66 66 await guild.save();
67 res.json(await getDojoClient(guild, 0));
67 res.json(await getDojoClient(guild, 0, undefined, account.BuildLabel));
68 68 };
Modified src/managers/sessionManager.ts +19 -36
@@ -1,10 +1,12 @@
1 1 import { ISession, IFindSessionRequest } from "@/src/types/session";
2 2 import { logger } from "@/src/utils/logger";
3 import { JSONParse } from "json-with-bigint";
4 import { Types } from "mongoose";
3 5
4 6 const sessions: ISession[] = [];
5 7
6 function createNewSession(sessionData: ISession, Creator: string): ISession {
7 const sessionId = getNewSessionID();
8 function createNewSession(sessionData: ISession, Creator: Types.ObjectId): ISession {
9 const sessionId = new Types.ObjectId();
8 10 const newSession: ISession = {
9 11 sessionId,
10 12 creatorId: Creator,
@@ -25,7 +27,7 @@ function createNewSession(sessionData: ISession, Creator: string): ISession {
25 27 customSettings: sessionData.customSettings || "",
26 28 rewardSeed: sessionData.rewardSeed || -1,
27 29 guildId: sessionData.guildId || "",
28 buildId: sessionData.buildId || 4920386201513015989,
30 buildId: sessionData.buildId || 4920386201513015989n,
29 31 platform: sessionData.platform || 0,
30 32 xplatform: sessionData.xplatform || true,
31 33 freePublic: sessionData.freePublic || 3,
@@ -40,13 +42,15 @@ function getAllSessions(): ISession[] {
40 42 return sessions;
41 43 }
42 44
43 function getSessionByID(sessionId: string): ISession | undefined {
44 return sessions.find(session => session.sessionId === sessionId);
45 function getSessionByID(sessionId: string | Types.ObjectId): ISession | undefined {
46 return sessions.find(session => session.sessionId.equals(sessionId));
45 47 }
46 48
47 function getSession(sessionIdOrRequest: string | IFindSessionRequest): { createdBy: string; id: string }[] {
48 if (typeof sessionIdOrRequest === "string") {
49 const session = sessions.find(session => session.sessionId === sessionIdOrRequest);
49 function getSession(
50 sessionIdOrRequest: string | Types.ObjectId | IFindSessionRequest
51 ): { createdBy: Types.ObjectId; id: Types.ObjectId }[] {
52 if (typeof sessionIdOrRequest === "string" || sessionIdOrRequest instanceof Types.ObjectId) {
53 const session = sessions.find(session => session.sessionId.equals(sessionIdOrRequest));
50 54 if (session) {
51 55 logger.debug("Found Sessions:", { session });
52 56 return [
@@ -79,35 +83,15 @@ function getSession(sessionIdOrRequest: string | IFindSessionRequest): { created
79 83 }));
80 84 }
81 85
82 function getSessionByCreatorID(creatorId: string): ISession | undefined {
83 return sessions.find(session => session.creatorId === creatorId);
86 function getSessionByCreatorID(creatorId: string | Types.ObjectId): ISession | undefined {
87 return sessions.find(session => session.creatorId.equals(creatorId));
84 88 }
85 89
86 function getNewSessionID(): string {
87 const characters = "0123456789abcdef";
88 const maxAttempts = 100;
89 let sessionId = "";
90
91 for (let attempt = 0; attempt < maxAttempts; attempt++) {
92 sessionId = "64";
93 for (let i = 0; i < 22; i++) {
94 const randomIndex = Math.floor(Math.random() * characters.length);
95 sessionId += characters[randomIndex];
96 }
97
98 if (!sessions.some(session => session.sessionId === sessionId)) {
99 return sessionId;
100 }
101 }
102
103 throw new Error("Failed to generate a unique session ID");
104 }
105
106 function updateSession(sessionId: string, sessionData: string): boolean {
107 const session = sessions.find(session => session.sessionId === sessionId);
90 function updateSession(sessionId: string | Types.ObjectId, sessionData: string): boolean {
91 const session = sessions.find(session => session.sessionId.equals(sessionId));
108 92 if (!session) return false;
109 93 try {
110 Object.assign(session, JSON.parse(sessionData));
94 Object.assign(session, JSONParse(sessionData));
111 95 return true;
112 96 } catch (error) {
113 97 console.error("Invalid JSON string for session update.");
@@ -115,8 +99,8 @@ function updateSession(sessionId: string, sessionData: string): boolean {
115 99 }
116 100 }
117 101
118 function deleteSession(sessionId: string): boolean {
119 const index = sessions.findIndex(session => session.sessionId === sessionId);
102 function deleteSession(sessionId: string | Types.ObjectId): boolean {
103 const index = sessions.findIndex(session => session.sessionId.equals(sessionId));
120 104 if (index !== -1) {
121 105 sessions.splice(index, 1);
122 106 return true;
@@ -129,7 +113,6 @@ export {
129 113 getAllSessions,
130 114 getSessionByID,
131 115 getSessionByCreatorID,
132 getNewSessionID,
133 116 updateSession,
134 117 deleteSession,
135 118 getSession
Modified src/models/guildModel.ts +9 -8
@@ -13,7 +13,8 @@ import {
13 13 IDojoLeaderboardEntry,
14 14 IGuildAdDatabase,
15 15 IAllianceDatabase,
16 IAllianceMemberDatabase
16 IAllianceMemberDatabase,
17 GuildPermission
17 18 } from "@/src/types/guildTypes";
18 19 import { Document, Model, model, Schema, Types } from "mongoose";
19 20 import { fusionTreasuresSchema, typeCountSchema } from "./inventoryModels/inventoryModel";
@@ -108,31 +109,31 @@ const defaultRanks: IGuildRank[] = [
108 109 },
109 110 {
110 111 Name: "/Lotus/Language/Game/Rank_General",
111 Permissions: 4318
112 Permissions: GuildPermission.Host | 4318
112 113 },
113 114 {
114 115 Name: "/Lotus/Language/Game/Rank_Officer",
115 Permissions: 4314
116 Permissions: GuildPermission.Host | 4314
116 117 },
117 118 {
118 119 Name: "/Lotus/Language/Game/Rank_Leader",
119 Permissions: 4106
120 Permissions: GuildPermission.Host | 4106
120 121 },
121 122 {
122 123 Name: "/Lotus/Language/Game/Rank_Sage",
123 Permissions: 4304
124 Permissions: GuildPermission.Host | 4304
124 125 },
125 126 {
126 127 Name: "/Lotus/Language/Game/Rank_Soldier",
127 Permissions: 4098
128 Permissions: GuildPermission.Host | 4098
128 129 },
129 130 {
130 131 Name: "/Lotus/Language/Game/Rank_Initiate",
131 Permissions: 4096
132 Permissions: GuildPermission.Host | GuildPermission.Fabricator
132 133 },
133 134 {
134 135 Name: "/Lotus/Language/Game/Rank_Utility",
135 Permissions: 4096
136 Permissions: GuildPermission.Host | GuildPermission.Fabricator
136 137 }
137 138 ];
138 139
Modified src/services/friendService.ts +3 -3
@@ -4,16 +4,16 @@ import { config } from "./configService";
4 4 import { Account } from "../models/loginModel";
5 5 import { Types } from "mongoose";
6 6 import { Friendship } from "../models/friendModel";
7 import { toMongoDate } from "../helpers/inventoryHelpers";
7 import { fromOid, toMongoDate } from "../helpers/inventoryHelpers";
8 8
9 9 export const addAccountDataToFriendInfo = async (info: IFriendInfo): Promise<void> => {
10 const account = (await Account.findById(info._id.$oid, "DisplayName LastLogin"))!;
10 const account = (await Account.findById(fromOid(info._id), "DisplayName LastLogin"))!;
11 11 info.DisplayName = account.DisplayName;
12 12 info.LastLogin = toMongoDate(account.LastLogin);
13 13 };
14 14
15 15 export const addInventoryDataToFriendInfo = async (info: IFriendInfo): Promise<void> => {
16 const inventory = await getInventory(info._id.$oid, "PlayerLevel ActiveAvatarImageType");
16 const inventory = await getInventory(fromOid(info._id), "PlayerLevel ActiveAvatarImageType");
17 17 info.PlayerLevel = config.spoofMasteryRank == -1 ? inventory.PlayerLevel : config.spoofMasteryRank;
18 18 info.ActiveAvatarImageType = inventory.ActiveAvatarImageType;
19 19 };
Modified src/services/guildService.ts +20 -16
@@ -1,5 +1,5 @@
1 1 import { Request } from "express";
2 import { getAccountIdForRequest } from "@/src/services/loginService";
2 import { getAccountIdForRequest, TAccountDocument } from "@/src/services/loginService";
3 3 import { addLevelKeys, addRecipes, combineInventoryChanges, getInventory } from "@/src/services/inventoryService";
4 4 import { Alliance, AllianceMember, Guild, GuildAd, GuildMember, TGuildDatabaseDocument } from "@/src/models/guildModel";
5 5 import { TInventoryDatabaseDocument } from "@/src/models/inventoryModels/inventoryModel";
@@ -19,7 +19,7 @@ import {
19 19 IGuildVault,
20 20 ITechProjectDatabase
21 21 } from "@/src/types/guildTypes";
22 import { toMongoDate, toOid } from "@/src/helpers/inventoryHelpers";
22 import { toMongoDate, toOid, toOid2 } from "@/src/helpers/inventoryHelpers";
23 23 import { Types } from "mongoose";
24 24 import { ExportDojoRecipes, ExportResources, IDojoBuild, IDojoResearch } from "warframe-public-export-plus";
25 25 import { logger } from "../utils/logger";
@@ -54,7 +54,10 @@ export const getGuildForRequestEx = async (
54 54 return guild;
55 55 };
56 56
57 export const getGuildClient = async (guild: TGuildDatabaseDocument, accountId: string): Promise<IGuildClient> => {
57 export const getGuildClient = async (
58 guild: TGuildDatabaseDocument,
59 account: TAccountDocument
60 ): Promise<IGuildClient> => {
58 61 const guildMembers = await GuildMember.find({ guildId: guild._id });
59 62
60 63 const members: IGuildMemberClient[] = [];
@@ -62,13 +65,13 @@ export const getGuildClient = async (guild: TGuildDatabaseDocument, accountId: s
62 65 const dataFillInPromises: Promise<void>[] = [];
63 66 for (const guildMember of guildMembers) {
64 67 const member: IGuildMemberClient = {
65 _id: toOid(guildMember.accountId),
68 _id: toOid2(guildMember.accountId, account.BuildLabel),
66 69 Rank: guildMember.rank,
67 70 Status: guildMember.status,
68 71 Note: guildMember.RequestMsg,
69 72 RequestExpiry: guildMember.RequestExpiry ? toMongoDate(guildMember.RequestExpiry) : undefined
70 73 };
71 if (guildMember.accountId.equals(accountId)) {
74 if (guildMember.accountId.equals(account._id)) {
72 75 missingEntry = false;
73 76 } else {
74 77 dataFillInPromises.push(addAccountDataToFriendInfo(member));
@@ -79,13 +82,13 @@ export const getGuildClient = async (guild: TGuildDatabaseDocument, accountId: s
79 82 if (missingEntry) {
80 83 // Handle clans created prior to creation of the GuildMember model.
81 84 await GuildMember.insertOne({
82 accountId: accountId,
85 accountId: account._id,
83 86 guildId: guild._id,
84 87 status: 0,
85 88 rank: 0
86 89 });
87 90 members.push({
88 _id: { $oid: accountId },
91 _id: toOid2(account._id, account.BuildLabel),
89 92 Status: 0,
90 93 Rank: 0
91 94 });
@@ -94,7 +97,7 @@ export const getGuildClient = async (guild: TGuildDatabaseDocument, accountId: s
94 97 await Promise.all(dataFillInPromises);
95 98
96 99 return {
97 _id: toOid(guild._id),
100 _id: toOid2(guild._id, account.BuildLabel),
98 101 Name: guild.Name,
99 102 MOTD: guild.MOTD,
100 103 LongMOTD: guild.LongMOTD,
@@ -106,11 +109,11 @@ export const getGuildClient = async (guild: TGuildDatabaseDocument, accountId: s
106 109 ActiveDojoColorResearch: guild.ActiveDojoColorResearch,
107 110 Class: guild.Class,
108 111 XP: guild.XP,
109 IsContributor: !!guild.CeremonyContributors?.find(x => x.equals(accountId)),
112 IsContributor: !!guild.CeremonyContributors?.find(x => x.equals(account._id)),
110 113 NumContributors: guild.CeremonyContributors?.length ?? 0,
111 114 CeremonyResetDate: guild.CeremonyResetDate ? toMongoDate(guild.CeremonyResetDate) : undefined,
112 115 AutoContributeFromVault: guild.AutoContributeFromVault,
113 AllianceId: guild.AllianceId ? toOid(guild.AllianceId) : undefined
116 AllianceId: guild.AllianceId ? toOid2(guild.AllianceId, account.BuildLabel) : undefined
114 117 };
115 118 };
116 119
@@ -130,10 +133,11 @@ export const getGuildVault = (guild: TGuildDatabaseDocument): IGuildVault => {
130 133 export const getDojoClient = async (
131 134 guild: TGuildDatabaseDocument,
132 135 status: number,
133 componentId?: Types.ObjectId | string
136 componentId?: Types.ObjectId | string,
137 buildLabel?: string
134 138 ): Promise<IDojoClient> => {
135 139 const dojo: IDojoClient = {
136 _id: { $oid: guild._id.toString() },
140 _id: toOid2(guild._id, buildLabel),
137 141 Name: guild.Name,
138 142 Tier: guild.Tier,
139 143 GuildEmblem: guild.Emblem,
@@ -155,8 +159,8 @@ export const getDojoClient = async (
155 159 for (const dojoComponent of guild.DojoComponents) {
156 160 if (!componentId || dojoComponent._id.equals(componentId)) {
157 161 const clientComponent: IDojoComponentClient = {
158 id: toOid(dojoComponent._id),
159 SortId: toOid(dojoComponent.SortId ?? dojoComponent._id), // always providing a SortId so decos don't need repositioning to reparent
162 id: toOid2(dojoComponent._id, buildLabel),
163 SortId: toOid2(dojoComponent.SortId ?? dojoComponent._id, buildLabel), // always providing a SortId so decos don't need repositioning to reparent
160 164 pf: dojoComponent.pf,
161 165 ppf: dojoComponent.ppf,
162 166 Name: dojoComponent.Name,
@@ -165,7 +169,7 @@ export const getDojoClient = async (
165 169 Settings: dojoComponent.Settings
166 170 };
167 171 if (dojoComponent.pi) {
168 clientComponent.pi = toOid(dojoComponent.pi);
172 clientComponent.pi = toOid2(dojoComponent.pi, buildLabel);
169 173 clientComponent.op = dojoComponent.op!;
170 174 clientComponent.pp = dojoComponent.pp!;
171 175 }
@@ -221,7 +225,7 @@ export const getDojoClient = async (
221 225 clientComponent.Decos = [];
222 226 for (const deco of dojoComponent.Decos) {
223 227 const clientDeco: IDojoDecoClient = {
224 id: toOid(deco._id),
228 id: toOid2(deco._id, buildLabel),
225 229 Type: deco.Type,
226 230 Pos: deco.Pos,
227 231 Rot: deco.Rot,
Modified src/types/friendTypes.ts +2 -2
@@ -1,8 +1,8 @@
1 1 import { Types } from "mongoose";
2 import { IMongoDate, IOid } from "./commonTypes";
2 import { IMongoDate, IOidWithLegacySupport } from "./commonTypes";
3 3
4 4 export interface IFriendInfo {
5 _id: IOid;
5 _id: IOidWithLegacySupport;
6 6 DisplayName?: string;
7 7 PlatformNames?: string[];
8 8 PlatformAccountId?: string;
Modified src/types/guildTypes.ts +14 -14
@@ -1,11 +1,11 @@
1 1 import { Types } from "mongoose";
2 import { IOid, IMongoDate } from "@/src/types/commonTypes";
2 import { IOid, IMongoDate, IOidWithLegacySupport } from "@/src/types/commonTypes";
3 3 import { IFusionTreasure, IMiscItem, ITypeCount } from "@/src/types/inventoryTypes/inventoryTypes";
4 4 import { IPictureFrameInfo } from "./shipTypes";
5 5 import { IFriendInfo } from "./friendTypes";
6 6
7 7 export interface IGuildClient {
8 _id: IOid;
8 _id: IOidWithLegacySupport;
9 9 Name: string;
10 10 MOTD: string;
11 11 LongMOTD?: ILongMOTD;
@@ -22,7 +22,7 @@ export interface IGuildClient {
22 22 CeremonyResetDate?: IMongoDate;
23 23 CrossPlatformEnabled?: boolean;
24 24 AutoContributeFromVault?: boolean;
25 AllianceId?: IOid;
25 AllianceId?: IOidWithLegacySupport;
26 26 }
27 27
28 28 export interface IGuildDatabase {
@@ -71,7 +71,6 @@ export interface ILongMOTD {
71 71 authorGuildName?: string;
72 72 }
73 73
74 // 32 seems to be reserved
75 74 export enum GuildPermission {
76 75 Ruler = 1, // Clan: Change hierarchy. Alliance (Creator only): Kick clans.
77 76 Advertiser = 8192,
@@ -79,6 +78,7 @@ export enum GuildPermission {
79 78 Regulator = 4, // Kick members
80 79 Promoter = 8, // Clan: Promote and demote members. Alliance (Creator only): Change clan permissions.
81 80 Architect = 16, // Create and destroy rooms
81 Host = 32, // No longer used in modern versions
82 82 Decorator = 1024, // Create and destroy decos
83 83 Treasurer = 64, // Clan: Contribute from vault and edit tax rate. Alliance: Divvy vault.
84 84 Tech = 128, // Queue research
@@ -127,13 +127,13 @@ export interface IGuildVault {
127 127 }
128 128
129 129 export interface IDojoClient {
130 _id: IOid; // ID of the guild
130 _id: IOidWithLegacySupport; // ID of the guild
131 131 Name: string;
132 132 Tier: number;
133 133 TradeTax?: number;
134 134 FixedContributions: boolean;
135 135 DojoRevision: number;
136 AllianceId?: IOid;
136 AllianceId?: IOidWithLegacySupport;
137 137 Vault?: IGuildVault;
138 138 Class?: number; // Level
139 139 RevisionTime: number;
@@ -148,11 +148,11 @@ export interface IDojoClient {
148 148 }
149 149
150 150 export interface IDojoComponentClient {
151 id: IOid;
152 SortId?: IOid;
151 id: IOidWithLegacySupport;
152 SortId?: IOidWithLegacySupport;
153 153 pf: string; // Prefab (.level)
154 154 ppf: string;
155 pi?: IOid; // Parent ID. N/A to root.
155 pi?: IOidWithLegacySupport; // Parent ID. N/A to root.
156 156 op?: string; // Name of the door within this room that leads to its parent. N/A to root.
157 157 pp?: string; // Name of the door within the parent that leads to this room. N/A to root.
158 158 Name?: string;
@@ -166,7 +166,7 @@ export interface IDojoComponentClient {
166 166 DestructionTimeRemaining?: number; // old versions
167 167 Decos?: IDojoDecoClient[];
168 168 DecoCapacity?: number;
169 PaintBot?: IOid;
169 PaintBot?: IOidWithLegacySupport;
170 170 PendingColors?: number[];
171 171 Colors?: number[];
172 172 PendingLights?: number[];
@@ -191,7 +191,7 @@ export interface IDojoComponentDatabase
191 191 }
192 192
193 193 export interface IDojoDecoClient {
194 id: IOid;
194 id: IOidWithLegacySupport;
195 195 Type: string;
196 196 Pos: number[];
197 197 Rot: number[];
@@ -285,7 +285,7 @@ export interface IGuildAdDatabase {
285 285 }
286 286
287 287 export interface IAllianceClient {
288 _id: IOid;
288 _id: IOidWithLegacySupport;
289 289 Name: string;
290 290 MOTD?: ILongMOTD;
291 291 LongMOTD?: ILongMOTD;
@@ -306,7 +306,7 @@ export interface IAllianceDatabase {
306 306 }
307 307
308 308 export interface IAllianceMemberClient {
309 _id: IOid;
309 _id: IOidWithLegacySupport;
310 310 Name: string;
311 311 Tier: number;
312 312 Pending: boolean;
@@ -314,7 +314,7 @@ export interface IAllianceMemberClient {
314 314 Permissions: number;
315 315 MemberCount: number;
316 316 ClanLeader?: string;
317 ClanLeaderId?: IOid;
317 ClanLeaderId?: IOidWithLegacySupport;
318 318 OriginalPlatform?: number;
319 319 }
320 320
Modified src/types/session.ts +5 -3