返回提交历史
Modified
src/controllers/dynamic/worldStateController.ts
+7
-2
Modified
src/models/guildModel.ts
+5
-3
Modified
src/services/worldStateService.ts
+15
-0
Modified
src/types/guildTypes.ts
+1
-0
Modified
src/types/worldStateTypes.ts
+22
-0
XFEstudio/XFESpaceNinjaServer
feat: featured clans (#3198)
Closes #3197 Reviewed-on: https://onlyg.it/OpenWF/SpaceNinjaServer/pulls/3198 Co-authored-by: Sainan <63328889+Sainan@users.noreply.github.com> Co-committed-by: Sainan <63328889+Sainan@users.noreply.github.com>
35385ec2
代码差异
5 个文件
+50
-5
@@ -1,5 +1,10 @@
1
1
import type { RequestHandler } from "express";
2
import { getWorldState, populateDailyDeal, populateFissures } from "../../services/worldStateService.ts";
2
import {
3
getWorldState,
4
populateDailyDeal,
5
populateFeaturedGuilds,
6
populateFissures
7
} from "../../services/worldStateService.ts";
3
8
import { version_compare } from "../../helpers/inventoryHelpers.ts";
4
9
import gameToBuildVersion from "../../constants/gameToBuildVersion.ts";
5
10
@@ -7,7 +12,7 @@ export const worldStateController: RequestHandler = async (req, res) => {
7
12
const buildLabel = req.query.buildLabel as string | undefined;
8
13
const worldState = getWorldState(buildLabel);
9
14
10
const populatePromises = [populateDailyDeal(worldState)];
15
const populatePromises = [populateDailyDeal(worldState), populateFeaturedGuilds(worldState)];
11
16
12
17
// Omitting void fissures for versions prior to Dante Unbound to avoid script errors.
13
18
if (!buildLabel || version_compare(buildLabel, gameToBuildVersion["35.5.0"]) >= 0) {
@@ -215,9 +215,11 @@ const guildSchema = new Schema<IGuildDatabase>(
215
215
Ranks: { type: [guildRankSchema], default: defaultRanks },
216
216
TradeTax: { type: Number, default: 0 },
217
217
Tier: { type: Number, default: 1 },
218
Emblem: { type: Boolean },
219
AutoContributeFromVault: { type: Boolean },
220
AllianceId: { type: Types.ObjectId },
218
Emblem: Boolean,
219
AutoContributeFromVault: Boolean,
220
AllianceId: Types.ObjectId,
221
Featured: Boolean,
222
221
223
DojoComponents: { type: [dojoComponentSchema], default: [] },
222
224
DojoCapacity: { type: Number, default: 100 },
223
225
DojoEnergy: { type: Number, default: 5 },
@@ -46,6 +46,7 @@ import { factionToInt, getConquest, getMissionTypeForLegacyOverride } from "./co
46
46
import gameToBuildVersion from "../constants/gameToBuildVersion.ts";
47
47
import { getDescent } from "./descentService.ts";
48
48
import { catBreadHash } from "../helpers/stringHelpers.ts";
49
import { Guild } from "../models/guildModel.ts";
49
50
50
51
const sortieBosses = [
51
52
"SORTIE_BOSS_HYENA",
@@ -1597,6 +1598,7 @@ export const getWorldState = (buildLabel?: string): IWorldState => {
1597
1598
EndlessXpChoices: [],
1598
1599
KnownCalendarSeasons: [],
1599
1600
PVPChallengeInstances: [],
1601
FeaturedGuilds: [],
1600
1602
...staticWorldState,
1601
1603
SyndicateMissions: [...staticWorldState.SyndicateMissions],
1602
1604
InGameMarket: {
@@ -4313,3 +4315,16 @@ const generateGoalAlert = (tag: string, alertIdx: number, wsAlerts: IAlert[], bu
4313
4315
delete alert.MissionInfo.maxRotations;
4314
4316
return alert;
4315
4317
};
4318
4319
export const populateFeaturedGuilds = async (worldState: IWorldState): Promise<void> => {
4320
const guilds = await Guild.find({ Featured: true }, "Name Tier AllianceId Emblem");
4321
for (const guild of guilds) {
4322
worldState.FeaturedGuilds.push({
4323
_id: toOid(guild._id),
4324
Name: guild.Name,
4325
Tier: guild.Tier,
4326
AllianceId: guild.AllianceId ? toOid(guild.AllianceId) : undefined,
4327
Emblem: guild.Emblem
4328
});
4329
}
4330
};
@@ -52,6 +52,7 @@ export interface IGuildDatabase extends IGuildCheats {
52
52
Emblem?: boolean;
53
53
AutoContributeFromVault?: boolean;
54
54
AllianceId?: Types.ObjectId;
55
Featured?: boolean;
55
56
56
57
DojoComponents: IDojoComponentDatabase[];
57
58
DojoCapacity: number;
@@ -25,6 +25,7 @@ export interface IWorldState {
25
25
DailyDeals: IDailyDeal[];
26
26
PVPChallengeInstances: IPVPChallengeInstance[];
27
27
EndlessXpChoices: IEndlessXpChoice[];
28
FeaturedGuilds: IFeaturedGuild[];
28
29
SeasonInfo?: {
29
30
Activation: IMongoDate;
30
31
Expiry: IMongoDate;
@@ -375,6 +376,27 @@ export interface IEndlessXpChoice {
375
376
Choices: string[];
376
377
}
377
378
379
export interface IFeaturedGuild {
380
_id: IOid;
381
Name: string;
382
Tier: number;
383
AllianceId?: IOid;
384
Emblem?: boolean;
385
HiddenPlatforms?: {
386
PLATFORM_WINDOWS?: true;
387
PLATFORM_XBONE?: true;
388
PLATFORM_XSX?: true;
389
PLATFORM_PS4?: true;
390
PLATFORM_PS5?: true;
391
PLATFORM_SWITCH?: true;
392
PLATFORM_SWITCH2?: true;
393
PLATFORM_IOS?: true;
394
PLATFORM_ANDROID?: true;
395
PLATFORM_CROSS_PLATFORM?: true;
396
};
397
IconOveride?: 0 | 1;
398
}
399
378
400
export interface ISeasonChallenge {
379
401
_id: IOid;
380
402
Daily?: boolean;