返回提交历史
Modified
src/controllers/dynamic/worldStateController.ts
+5
-10
Modified
src/services/worldStateService.ts
+43
-7
Modified
src/types/worldStateTypes.ts
+3
-3
XFEstudio/XFESpaceNinjaServer
feat: filter void fissures (#3695)
tested in `2016.08.19.17.12` Closes #3688 Reviewed-on: https://onlyg.it/OpenWF/SpaceNinjaServer/pulls/3695 Reviewed-by: Sainan <63328889+sainan@users.noreply.github.com> Co-authored-by: AMelonInsideLemon <166175391+AMelonInsideLemon@users.noreply.github.com> Co-committed-by: AMelonInsideLemon <166175391+AMelonInsideLemon@users.noreply.github.com>
4826bb16
代码差异
3 个文件
+51
-20
@@ -5,21 +5,16 @@ import {
5
5
populateFeaturedGuilds,
6
6
populateFissures
7
7
} from "../../services/worldStateService.ts";
8
import { version_compare } from "../../helpers/inventoryHelpers.ts";
9
import gameToBuildVersion from "../../constants/gameToBuildVersion.ts";
10
8
11
9
export const worldStateController: RequestHandler = async (req, res) => {
12
10
const buildLabel = req.query.buildLabel as string | undefined;
13
11
const worldState = getWorldState(buildLabel);
14
12
15
const populatePromises = [populateDailyDeal(worldState), populateFeaturedGuilds(worldState)];
16
17
// Omitting void fissures for versions prior to Dante Unbound to avoid script errors.
18
if (!buildLabel || version_compare(buildLabel, gameToBuildVersion["35.5.0"]) >= 0) {
19
populatePromises.push(populateFissures(worldState));
20
}
21
22
await Promise.all(populatePromises);
13
await Promise.all([
14
populateDailyDeal(worldState),
15
populateFeaturedGuilds(worldState),
16
populateFissures(worldState)
17
]);
23
18
24
19
if (req.query.l && worldState.Events) {
25
20
for (const event of worldState.Events) {
@@ -4094,11 +4094,11 @@ export const populateFissures = async (worldState: IWorldState): Promise<void> =
4094
4094
for (const node of nodes) {
4095
4095
const meta = ExportRegions[node];
4096
4096
worldState.ActiveMissions.push({
4097
_id: { $oid: (i++).toString().padStart(8, "0") + "8e0c70ba050f1eb7" },
4097
_id: toOid2((i++).toString().padStart(8, "0") + "8e0c70ba050f1eb7", worldState.BuildLabel),
4098
4098
Region: meta.systemIndex + 1,
4099
4099
Seed: 1337,
4100
Activation: { $date: { $numberLong: "1000000000000" } },
4101
Expiry: { $date: { $numberLong: "2000000000000" } },
4100
Activation: toMongoDate2(1000000000000, worldState.BuildLabel),
4101
Expiry: toMongoDate2(2000000000000, worldState.BuildLabel),
4102
4102
Node: node,
4103
4103
MissionType: meta.missionType,
4104
4104
Modifier: tier,
@@ -4111,14 +4111,14 @@ export const populateFissures = async (worldState: IWorldState): Promise<void> =
4111
4111
for (const fissure of fissures) {
4112
4112
const meta = ExportRegions[fissure.Node];
4113
4113
worldState.ActiveMissions.push({
4114
_id: toOid(fissure._id),
4114
_id: toOid2(fissure._id, worldState.BuildLabel),
4115
4115
Region: meta.systemIndex + 1,
4116
4116
Seed: 1337,
4117
4117
Activation:
4118
4118
fissure.Activation.getTime() < Date.now() // Activation is in the past?
4119
? { $date: { $numberLong: "1000000000000" } } // Let the client know 'explicitly' to avoid interference from time constraints.
4120
: toMongoDate(fissure.Activation),
4121
Expiry: toMongoDate(fissure.Expiry),
4119
? toMongoDate2(1000000000000, worldState.BuildLabel) // Let the client know 'explicitly' to avoid interference from time constraints.
4120
: toMongoDate2(fissure.Activation, worldState.BuildLabel),
4121
Expiry: toMongoDate2(fissure.Expiry, worldState.BuildLabel),
4122
4122
Node: fissure.Node,
4123
4123
MissionType: meta.missionType,
4124
4124
Modifier: fissure.Modifier,
@@ -4126,6 +4126,42 @@ export const populateFissures = async (worldState: IWorldState): Promise<void> =
4126
4126
});
4127
4127
}
4128
4128
}
4129
worldState.ActiveMissions = worldState.ActiveMissions.filter(fissure => {
4130
const meta = ExportRegions[fissure.Node];
4131
if (
4132
(meta.faction == "FC_MITW" || fissure.Modifier == "VoidT6") &&
4133
version_compare(worldState.BuildLabel, gameToBuildVersion["35.5.0"]) < 0
4134
) {
4135
return false;
4136
}
4137
if (fissure.Hard && version_compare(worldState.BuildLabel, gameToBuildVersion["32.0.0"]) < 0) {
4138
return false;
4139
}
4140
if (meta.systemIndex == 16 && version_compare(worldState.BuildLabel, gameToBuildVersion["29.0.0"]) < 0) {
4141
return false;
4142
}
4143
if (fissure.Modifier == "VoidT5" && version_compare(worldState.BuildLabel, gameToBuildVersion["26.0.0"]) < 0) {
4144
return false;
4145
}
4146
if (
4147
fissure.MissionType == "MT_ARTIFACT" &&
4148
version_compare(worldState.BuildLabel, gameToBuildVersion["25.7.0"]) < 0
4149
) {
4150
return false;
4151
}
4152
if (
4153
meta.systemIndex == 17 &&
4154
version_compare(worldState.BuildLabel, gameToBuildVersion["18.0.2"]) < 0 // Should be 18.0.0
4155
) {
4156
return false;
4157
}
4158
return true;
4159
});
4160
if (version_compare(worldState.BuildLabel, gameToBuildVersion["32.0.0"]) < 0) {
4161
for (const fissure of worldState.ActiveMissions) {
4162
delete fissure.Hard;
4163
}
4164
}
4129
4165
};
4130
4166
4131
4167
export const populateDailyDeal = async (worldState: IWorldState): Promise<void> => {
@@ -228,11 +228,11 @@ export interface IInvasionMissionInfo {
228
228
}
229
229
230
230
export interface IFissure {
231
_id: IOid;
231
_id: IOidWithLegacySupport;
232
232
Region: number;
233
233
Seed: number;
234
Activation: IMongoDate;
235
Expiry: IMongoDate;
234
Activation: IMongoDateWithLegacySupport;
235
Expiry: IMongoDateWithLegacySupport;
236
236
Node: string;
237
237
MissionType: string;
238
238
Modifier: string;