返回提交历史
Modified
src/services/worldStateService.ts
+52
-55
XFEstudio/XFESpaceNinjaServer
fix(worldState): don't exclude things based on the absence of buildLabel (#3639)
Reviewed-on: https://onlyg.it/OpenWF/SpaceNinjaServer/pulls/3639 Co-authored-by: Sainan <63328889+Sainan@users.noreply.github.com> Co-committed-by: Sainan <63328889+Sainan@users.noreply.github.com>
abcfc333
代码差异
1 个文件
+52
-55
@@ -871,7 +871,7 @@ export const pushClassicBounties = (
871
871
const bountyCycleStart = bountyCycle * 9000000;
872
872
const bountyCycleEnd = bountyCycleStart + 9000000;
873
873
874
if (buildLabel && version_compare(buildLabel, gameToBuildVersion["22.0.0"]) >= 0) {
874
if (!buildLabel || version_compare(buildLabel, gameToBuildVersion["22.0.0"]) >= 0) {
875
875
const rng = new SRng(seed);
876
876
const pool = [...eidolonJobs];
877
877
syndicateMissions.push({
@@ -888,7 +888,7 @@ export const pushClassicBounties = (
888
888
jobType: rng.randomElementPop(pool),
889
889
rewards: `/Lotus/Types/Game/MissionDecks/EidolonJobMissionRewards/TierATable${table}Rewards`,
890
890
// Should be U22.10
891
...(version_compare(buildLabel, gameToBuildVersion["22.13.4"]) >= 0 && {
891
...((!buildLabel || version_compare(buildLabel, gameToBuildVersion["22.13.4"]) >= 0) && {
892
892
masteryReq: 0
893
893
}),
894
894
minEnemyLevel: 5,
@@ -898,7 +898,7 @@ export const pushClassicBounties = (
898
898
{
899
899
jobType: rng.randomElementPop(pool),
900
900
rewards: `/Lotus/Types/Game/MissionDecks/EidolonJobMissionRewards/TierBTable${table}Rewards`,
901
...(version_compare(buildLabel, gameToBuildVersion["22.13.4"]) >= 0 && {
901
...((!buildLabel || version_compare(buildLabel, gameToBuildVersion["22.13.4"]) >= 0) && {
902
902
masteryReq: 1
903
903
}),
904
904
minEnemyLevel: 10,
@@ -908,7 +908,7 @@ export const pushClassicBounties = (
908
908
{
909
909
jobType: rng.randomElementPop(pool),
910
910
rewards: `/Lotus/Types/Game/MissionDecks/EidolonJobMissionRewards/TierCTable${table}Rewards`,
911
...(version_compare(buildLabel, gameToBuildVersion["22.13.4"]) >= 0 && {
911
...((!buildLabel || version_compare(buildLabel, gameToBuildVersion["22.13.4"]) >= 0) && {
912
912
masteryReq: 2
913
913
}),
914
914
minEnemyLevel: 20,
@@ -918,7 +918,7 @@ export const pushClassicBounties = (
918
918
{
919
919
jobType: rng.randomElementPop(pool),
920
920
rewards: `/Lotus/Types/Game/MissionDecks/EidolonJobMissionRewards/TierDTable${table}Rewards`,
921
...(version_compare(buildLabel, gameToBuildVersion["22.13.4"]) >= 0 && {
921
...((!buildLabel || version_compare(buildLabel, gameToBuildVersion["22.13.4"]) >= 0) && {
922
922
masteryReq: 3
923
923
}),
924
924
minEnemyLevel: 30,
@@ -928,7 +928,7 @@ export const pushClassicBounties = (
928
928
{
929
929
jobType: rng.randomElementPop(pool),
930
930
rewards: `/Lotus/Types/Game/MissionDecks/EidolonJobMissionRewards/TierETable${table}Rewards`,
931
...(version_compare(buildLabel, gameToBuildVersion["22.13.4"]) >= 0 && {
931
...((!buildLabel || version_compare(buildLabel, gameToBuildVersion["22.13.4"]) >= 0) && {
932
932
masteryReq: 4
933
933
}),
934
934
minEnemyLevel: 40,
@@ -936,7 +936,7 @@ export const pushClassicBounties = (
936
936
xpAmounts: generateXpAmounts(rng, 5, 4000, 4500)
937
937
},
938
938
// U28.1
939
...(version_compare(buildLabel, gameToBuildVersion["28.3.0"]) >= 0
939
...(!buildLabel || version_compare(buildLabel, gameToBuildVersion["28.3.0"]) >= 0
940
940
? [
941
941
{
942
942
jobType: rng.randomElementPop(pool),
@@ -948,7 +948,7 @@ export const pushClassicBounties = (
948
948
}
949
949
]
950
950
: []),
951
...(version_compare(buildLabel, gameToBuildVersion["31.0.0"]) >= 0
951
...(!buildLabel || version_compare(buildLabel, gameToBuildVersion["31.0.0"]) >= 0
952
952
? [
953
953
{
954
954
jobType: rng.randomElement(eidolonNarmerJobs),
@@ -964,7 +964,7 @@ export const pushClassicBounties = (
964
964
});
965
965
}
966
966
967
if (buildLabel && version_compare(buildLabel, gameToBuildVersion["24.0.0"]) >= 0) {
967
if (!buildLabel || version_compare(buildLabel, gameToBuildVersion["24.0.0"]) >= 0) {
968
968
const rng = new SRng(seed);
969
969
const pool = [...venusJobs];
970
970
syndicateMissions.push({
@@ -1018,7 +1018,7 @@ export const pushClassicBounties = (
1018
1018
xpAmounts: generateXpAmounts(rng, 5, 4000, 4500)
1019
1019
},
1020
1020
// U28.1
1021
...(version_compare(buildLabel, gameToBuildVersion["28.3.0"]) >= 0
1021
...(!buildLabel || version_compare(buildLabel, gameToBuildVersion["28.3.0"]) >= 0
1022
1022
? [
1023
1023
{
1024
1024
jobType: rng.randomElementPop(pool),
@@ -1030,7 +1030,7 @@ export const pushClassicBounties = (
1030
1030
}
1031
1031
]
1032
1032
: []),
1033
...(version_compare(buildLabel, gameToBuildVersion["31.0.0"]) >= 0
1033
...(!buildLabel || version_compare(buildLabel, gameToBuildVersion["31.0.0"]) >= 0
1034
1034
? [
1035
1035
{
1036
1036
jobType: rng.randomElement(venusNarmerJobs),
@@ -1046,7 +1046,7 @@ export const pushClassicBounties = (
1046
1046
});
1047
1047
}
1048
1048
1049
if (buildLabel && version_compare(buildLabel, gameToBuildVersion["29.0.0"]) >= 0) {
1049
if (!buildLabel || version_compare(buildLabel, gameToBuildVersion["29.0.0"]) >= 0) {
1050
1050
const rng = new SRng(seed);
1051
1051
const pool = [...microplanetJobs];
1052
1052
syndicateMissions.push({
@@ -1563,7 +1563,7 @@ const getIdealTimeSatsifyingConstraints = (constraints: ITimeConstraint[]): numb
1563
1563
};
1564
1564
1565
1565
const fullyStockBaro = (vt: IVoidTrader, buildLabel?: string): void => {
1566
if (buildLabel && version_compare(buildLabel, gameToBuildVersion["40.0.0"]) >= 0) {
1566
if (!buildLabel || version_compare(buildLabel, gameToBuildVersion["40.0.0"]) >= 0) {
1567
1567
for (const item of baro.evilBaro as IVoidTraderOffer[]) {
1568
1568
vt.Manifest.push(item);
1569
1569
}
@@ -1586,21 +1586,21 @@ const fullyStockBaro = (vt: IVoidTrader, buildLabel?: string): void => {
1586
1586
}
1587
1587
};
1588
1588
1589
const getVarziaRotation = (week: number, buildLabel: string): string => {
1589
const getVarziaRotation = (week: number, buildLabel: string | undefined): string => {
1590
1590
const seed = new SRng(week).randomInt(0, 100_000);
1591
1591
const rng = new SRng(seed);
1592
1592
const [itemType, rotation] = rng.randomElement(Object.entries(varzia.primeDualPacks))!;
1593
if (version_compare(buildLabel, rotation.minBuildLabel) >= 0) {
1593
if (!buildLabel || version_compare(buildLabel, rotation.minBuildLabel) >= 0) {
1594
1594
return itemType;
1595
1595
} else {
1596
1596
return "/Lotus/StoreItems/Types/StoreItems/Packages/MegaPrimeVault/LastChanceItemC";
1597
1597
}
1598
1598
};
1599
1599
1600
const getVarziaManifest = (dualPack: string, buildLabel: string): IPrimeVaultTraderOffer[] => {
1600
const getVarziaManifest = (dualPack: string, buildLabel: string | undefined): IPrimeVaultTraderOffer[] => {
1601
1601
const rotationManifest = varzia.primeDualPacks[dualPack];
1602
1602
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
1603
if (!rotationManifest || version_compare(buildLabel, rotationManifest.minBuildLabel) < 0) {
1603
if (!rotationManifest || (buildLabel && version_compare(buildLabel, rotationManifest.minBuildLabel) < 0)) {
1604
1604
return [];
1605
1605
}
1606
1606
const mainPack = [{ ItemType: dualPack, PrimePrice: 10 }];
@@ -1609,7 +1609,10 @@ const getVarziaManifest = (dualPack: string, buildLabel: string): IPrimeVaultTra
1609
1609
const items: IPrimeVaultTraderOffer[] = [];
1610
1610
const bobbleHeads: IPrimeVaultTraderOffer[] = [];
1611
1611
1612
if (config.worldState?.vanguardVaultRelics && version_compare(buildLabel, gameToBuildVersion["41.0.0"]) >= 0) {
1612
if (
1613
config.worldState?.vanguardVaultRelics &&
1614
(!buildLabel || version_compare(buildLabel, gameToBuildVersion["41.0.0"]) >= 0)
1615
) {
1613
1616
vanguardRelics.push(...varzia.vanguardVaultRelics);
1614
1617
}
1615
1618
@@ -1628,7 +1631,7 @@ const getVarziaManifest = (dualPack: string, buildLabel: string): IPrimeVaultTra
1628
1631
return [singlePacks[0], ...mainPack, singlePacks[1], ...vanguardRelics, ...items, ...bobbleHeads, ...relics];
1629
1632
};
1630
1633
1631
const getAllVarziaManifests = (buildLabel: string): IPrimeVaultTraderOffer[] => {
1634
const getAllVarziaManifests = (buildLabel: string | undefined): IPrimeVaultTraderOffer[] => {
1632
1635
const dualPacks: IPrimeVaultTraderOffer[] = [];
1633
1636
const singlePacks: IPrimeVaultTraderOffer[] = [];
1634
1637
const vanguardRelics: IPrimeVaultTraderOffer[] = [];
@@ -1640,12 +1643,15 @@ const getAllVarziaManifests = (buildLabel: string): IPrimeVaultTraderOffer[] =>
1640
1643
const itemsSet = new Set<string>();
1641
1644
const bobbleHeadsSet = new Set<string>();
1642
1645
1643
if (config.worldState?.vanguardVaultRelics && version_compare(buildLabel, gameToBuildVersion["41.0.0"]) >= 0) {
1646
if (
1647
config.worldState?.vanguardVaultRelics &&
1648
(!buildLabel || version_compare(buildLabel, gameToBuildVersion["41.0.0"]) >= 0)
1649
) {
1644
1650
vanguardRelics.push(...varzia.vanguardVaultRelics);
1645
1651
}
1646
1652
1647
1653
Object.entries(varzia.primeDualPacks)
1648
.filter(([_, dualPack]) => version_compare(buildLabel, dualPack.minBuildLabel) >= 0)
1654
.filter(([_, dualPack]) => !buildLabel || version_compare(buildLabel, dualPack.minBuildLabel) >= 0)
1649
1655
.forEach(([dualPackItemType, dualPack]) => {
1650
1656
dualPacks.push({ ItemType: dualPackItemType, PrimePrice: 10 });
1651
1657
@@ -2013,8 +2019,7 @@ export const getWorldState = (buildLabel?: string): IWorldState => {
2013
2019
const isFebruary = date.getUTCMonth() == 1;
2014
2020
if (
2015
2021
(config.worldState?.starDaysOverride ?? isFebruary) &&
2016
buildLabel &&
2017
version_compare(buildLabel, gameToBuildVersion["29.10.0"]) >= 0
2022
(!buildLabel || version_compare(buildLabel, gameToBuildVersion["29.10.0"]) >= 0)
2018
2023
) {
2019
2024
worldState.Goals.push({
2020
2025
_id: { $oid: "67a4dcce2a198564d62e1647" },
@@ -2045,7 +2050,7 @@ export const getWorldState = (buildLabel?: string): IWorldState => {
2045
2050
}
2046
2051
2047
2052
// < U38.6.0
2048
if (buildLabel && version_compare(buildLabel, "2025.05.20.10.18") >= 0) {
2053
if (!buildLabel || version_compare(buildLabel, "2025.05.20.10.18") >= 0) {
2049
2054
// The client gets kinda confused when multiple goals have the same tag, so considering these mutually exclusive.
2050
2055
if (config.worldState?.galleonOfGhouls == 1) {
2051
2056
worldState.Goals.push({
@@ -2128,8 +2133,7 @@ export const getWorldState = (buildLabel?: string): IWorldState => {
2128
2133
const isPlagueStarActive = timeMs >= plagueStarStart && timeMs < plagueStarEnd;
2129
2134
if (
2130
2135
(config.worldState?.plagueStarOverride ?? isPlagueStarActive) &&
2131
buildLabel &&
2132
version_compare(buildLabel, gameToBuildVersion["22.7.0"]) >= 0
2136
(!buildLabel || version_compare(buildLabel, gameToBuildVersion["22.7.0"]) >= 0)
2133
2137
) {
2134
2138
worldState.Goals.push({
2135
2139
_id: { $oid: "654a5058c757487cdb11824f" },
@@ -2200,8 +2204,7 @@ export const getWorldState = (buildLabel?: string): IWorldState => {
2200
2204
const isDogDaysActive = timeMs >= dogDaysStart && timeMs < dogDaysEnd;
2201
2205
if (
2202
2206
(config.worldState?.dogDaysOverride ?? isDogDaysActive) &&
2203
buildLabel &&
2204
version_compare(buildLabel, gameToBuildVersion["25.7.0"]) >= 0
2207
(!buildLabel || version_compare(buildLabel, gameToBuildVersion["25.7.0"]) >= 0)
2205
2208
) {
2206
2209
const activation = config.worldState?.dogDaysOverride ? 1699372800000 : dogDaysStart;
2207
2210
const expiry = config.worldState?.dogDaysOverride ? 2000000000000 : dogDaysEnd;
@@ -2419,8 +2422,7 @@ export const getWorldState = (buildLabel?: string): IWorldState => {
2419
2422
const isSaintPatrickActive = timeMs >= saintPatrickStart && timeMs < saintPatrickEnd;
2420
2423
if (
2421
2424
(config.worldState?.saintPatrickOverride ?? isSaintPatrickActive) &&
2422
buildLabel &&
2423
version_compare(buildLabel, gameToBuildVersion["13.0.0"]) >= 0
2425
(!buildLabel || version_compare(buildLabel, gameToBuildVersion["13.0.0"]) >= 0)
2424
2426
) {
2425
2427
const activation = config.worldState?.saintPatrickOverride ? 1772467200000 : saintPatrickStart;
2426
2428
const expiry = config.worldState?.saintPatrickOverride ? 2000000000000 : saintPatrickEnd;
@@ -2652,8 +2654,7 @@ export const getWorldState = (buildLabel?: string): IWorldState => {
2652
2654
2653
2655
if (
2654
2656
config.worldState?.wolfHunt != undefined &&
2655
buildLabel &&
2656
version_compare(buildLabel, gameToBuildVersion["25.0.0"]) >= 0
2657
(!buildLabel || version_compare(buildLabel, gameToBuildVersion["25.0.0"]) >= 0)
2657
2658
) {
2658
2659
if (config.worldState.wolfHunt == 0) {
2659
2660
worldState.Goals.push({
@@ -2772,8 +2773,7 @@ export const getWorldState = (buildLabel?: string): IWorldState => {
2772
2773
2773
2774
if (
2774
2775
config.worldState?.hallowedFlame &&
2775
buildLabel &&
2776
version_compare(buildLabel, gameToBuildVersion["26.0.0"]) >= 0
2776
(!buildLabel || version_compare(buildLabel, gameToBuildVersion["26.0.0"]) >= 0)
2777
2777
) {
2778
2778
worldState.Goals.push(
2779
2779
{
@@ -2841,8 +2841,7 @@ export const getWorldState = (buildLabel?: string): IWorldState => {
2841
2841
2842
2842
if (
2843
2843
config.worldState?.hallowedNightmares &&
2844
buildLabel &&
2845
version_compare(buildLabel, gameToBuildVersion["18.0.2"]) >= 0
2844
(!buildLabel || version_compare(buildLabel, gameToBuildVersion["18.0.2"]) >= 0)
2846
2845
) {
2847
2846
const rewards = [
2848
2847
// 2018
@@ -2939,8 +2938,7 @@ export const getWorldState = (buildLabel?: string): IWorldState => {
2939
2938
2940
2939
if (
2941
2940
config.worldState?.proxyRebellion &&
2942
buildLabel &&
2943
version_compare(buildLabel, gameToBuildVersion["23.2.0"]) >= 0
2941
(!buildLabel || version_compare(buildLabel, gameToBuildVersion["23.2.0"]) >= 0)
2944
2942
) {
2945
2943
const rewards = [
2946
2944
// 2019
@@ -3021,8 +3019,7 @@ export const getWorldState = (buildLabel?: string): IWorldState => {
3021
3019
3022
3020
if (
3023
3021
config.worldState?.longShadow &&
3024
buildLabel &&
3025
version_compare(buildLabel, gameToBuildVersion["18.22.1"]) >= 0
3022
(!buildLabel || version_compare(buildLabel, gameToBuildVersion["18.22.1"]) >= 0)
3026
3023
) {
3027
3024
worldState.Goals.push({
3028
3025
_id: { $oid: "5bc9e8f7272d5d184c8398c9" },
@@ -3070,8 +3067,7 @@ export const getWorldState = (buildLabel?: string): IWorldState => {
3070
3067
const isOctober = date.getUTCMonth() == 9; // October = month index 9
3071
3068
if (
3072
3069
(config.worldState?.naberusNightsOverride ?? isOctober) &&
3073
buildLabel &&
3074
version_compare(buildLabel, gameToBuildVersion["29.3.1"]) >= 0
3070
(!buildLabel || version_compare(buildLabel, gameToBuildVersion["29.3.1"]) >= 0)
3075
3071
) {
3076
3072
const activation = config.worldState?.naberusNightsOverride
3077
3073
? 1727881200000
@@ -3239,7 +3235,7 @@ export const getWorldState = (buildLabel?: string): IWorldState => {
3239
3235
pushFlashSales(worldState, storeItems, activation, expiry, "SEASONAL", buildLabel);
3240
3236
}
3241
3237
3242
if (config.worldState?.bellyOfTheBeast && buildLabel && version_compare(buildLabel, "2024.06.12.18.42") >= 0) {
3238
if (config.worldState?.bellyOfTheBeast && (!buildLabel || version_compare(buildLabel, "2024.06.12.18.42") >= 0)) {
3243
3239
worldState.Goals.push({
3244
3240
_id: { $oid: "67a5035c2a198564d62e165e" },
3245
3241
Activation: { $date: { $numberLong: "1738868400000" } },
@@ -3264,7 +3260,7 @@ export const getWorldState = (buildLabel?: string): IWorldState => {
3264
3260
}
3265
3261
3266
3262
// <U39
3267
if (config.worldState?.eightClaw && buildLabel && version_compare(buildLabel, "2025.06.23.11.39") >= 0) {
3263
if (config.worldState?.eightClaw && (!buildLabel || version_compare(buildLabel, "2025.06.23.11.39") >= 0)) {
3268
3264
worldState.Goals.push({
3269
3265
_id: { $oid: "685c15f80000000000000000" },
3270
3266
Activation: { $date: { $numberLong: "1750865400000" } },
@@ -3350,8 +3346,7 @@ export const getWorldState = (buildLabel?: string): IWorldState => {
3350
3346
3351
3347
if (
3352
3348
config.worldState?.orphixVenom &&
3353
buildLabel &&
3354
version_compare(buildLabel, gameToBuildVersion["29.6.8"]) >= 0
3349
(!buildLabel || version_compare(buildLabel, gameToBuildVersion["29.6.8"]) >= 0)
3355
3350
) {
3356
3351
worldState.Goals.push(
3357
3352
{
@@ -3431,8 +3426,7 @@ export const getWorldState = (buildLabel?: string): IWorldState => {
3431
3426
3432
3427
if (
3433
3428
config.worldState?.bloodOfPerita &&
3434
buildLabel &&
3435
version_compare(buildLabel, gameToBuildVersion["41.0.0"]) >= 0
3429
(!buildLabel || version_compare(buildLabel, gameToBuildVersion["41.0.0"]) >= 0)
3436
3430
) {
3437
3431
worldState.Goals.push({
3438
3432
_id: { $oid: "694189080000000000000000" },
@@ -3461,8 +3455,7 @@ export const getWorldState = (buildLabel?: string): IWorldState => {
3461
3455
3462
3456
if (
3463
3457
(config.worldState?.thermiaFracturesOverride ?? isThermiaFracturesActive) &&
3464
buildLabel &&
3465
version_compare(buildLabel, gameToBuildVersion["24.5.1"]) >= 0
3458
(!buildLabel || version_compare(buildLabel, gameToBuildVersion["24.5.1"]) >= 0)
3466
3459
) {
3467
3460
const activeStartDay = day - activeThermiaFracturesCycleDay;
3468
3461
@@ -3620,8 +3613,7 @@ export const getWorldState = (buildLabel?: string): IWorldState => {
3620
3613
const isGhoulEmergenceActive = ghoulsCycleDay >= 17 && ghoulsCycleDay <= 20; // 4 days for event and 17 days for break
3621
3614
if (
3622
3615
(config.worldState?.ghoulEmergenceOverride ?? isGhoulEmergenceActive) &&
3623
buildLabel &&
3624
version_compare(buildLabel, gameToBuildVersion["22.8.2"])
3616
(!buildLabel || version_compare(buildLabel, gameToBuildVersion["22.8.2"]) >= 0)
3625
3617
) {
3626
3618
const ghoulPool = [...eidolonGhoulJobs];
3627
3619
const pastGhoulPool = [...eidolonGhoulJobs];
@@ -3856,7 +3848,7 @@ export const getWorldState = (buildLabel?: string): IWorldState => {
3856
3848
3857
3849
// Varzia
3858
3850
// introduced in 30.9.4
3859
if (buildLabel && version_compare(buildLabel, gameToBuildVersion["31.0.0"]) >= 0) {
3851
if (!buildLabel || version_compare(buildLabel, gameToBuildVersion["31.0.0"]) >= 0) {
3860
3852
const pt: IPrimeVaultTrader = {
3861
3853
_id: { $oid: ((weekStart / 1000) & 0xffffffff).toString(16).padStart(8, "0") + "c36af423770eaa97" },
3862
3854
Activation: { $date: { $numberLong: weekStart.toString() } },
@@ -4520,7 +4512,7 @@ const pushConclaveWeekly = (
4520
4512
);
4521
4513
};
4522
4514
4523
const pushGoalAlerts = (ws: IWorldState, tag: string, buildLabel: string): void => {
4515
const pushGoalAlerts = (ws: IWorldState, tag: string, buildLabel: string | undefined): void => {
4524
4516
const genMeta = alertGeneratorConfig[tag];
4525
4517
const neededAlerts = genMeta.alertLength / genMeta.alertInterval;
4526
4518
const currentAlertIndex = Math.floor((ws.Time * 1000 - EPOCH) / genMeta.alertInterval);
@@ -4529,7 +4521,12 @@ const pushGoalAlerts = (ws: IWorldState, tag: string, buildLabel: string): void
4529
4521
}
4530
4522
};
4531
4523
4532
const generateGoalAlert = (tag: string, alertIdx: number, wsAlerts: IAlert[], buildLabel?: string): IAlert => {
4524
const generateGoalAlert = (
4525
tag: string,
4526
alertIdx: number,
4527
wsAlerts: IAlert[],
4528
buildLabel: string | undefined
4529
): IAlert => {
4533
4530
const genMeta = alertGeneratorConfig[tag];
4534
4531
const defenseWavesPerRotation = buildLabel && version_compare(buildLabel, gameToBuildVersion["38.5.0"]) < 0 ? 5 : 3;
4535
4532
const activation = EPOCH + alertIdx * genMeta.alertInterval;