返回提交历史
Modified
src/services/serversideVendorsService.ts
+1
-3
Modified
src/services/worldStateService.ts
+15
-9
XFEstudio/SpaceNinjaServer
fix: future-proof oid string generation (#1847)
This ensures they are still 24 bytes long even past the year 2106. :^) Reviewed-on: https://onlyg.it/OpenWF/SpaceNinjaServer/pulls/1847 Co-authored-by: Sainan <63328889+Sainan@users.noreply.github.com> Co-committed-by: Sainan <63328889+Sainan@users.noreply.github.com>
13432bf0
代码差异
2 个文件
+16
-12
@@ -236,9 +236,7 @@ const generateVendorManifest = (vendorInfo: IGeneratableVendorInfo): IVendorMani
236
236
AllowMultipurchase: false,
237
237
Id: {
238
238
$oid:
239
Math.trunc(cycleStart / 1000)
240
.toString(16)
241
.padStart(8, "0") +
239
((cycleStart / 1000) & 0xffffffff).toString(16).padStart(8, "0") +
242
240
vendorInfo._id.$oid.substring(8, 16) +
243
241
rng.randomInt(0, 0xffff).toString(16).padStart(4, "0") +
244
242
rng.randomInt(0, 0xffff).toString(16).padStart(4, "0")
@@ -209,7 +209,7 @@ const pushSyndicateMissions = (
209
209
const dayStart = getSortieTime(day);
210
210
const dayEnd = getSortieTime(day + 1);
211
211
worldState.SyndicateMissions.push({
212
_id: { $oid: Math.trunc(dayStart / 1000).toString(16) + idSuffix },
212
_id: { $oid: ((dayStart / 1000) & 0xffffffff).toString(16).padStart(8, "0") + idSuffix },
213
213
Activation: { $date: { $numberLong: dayStart.toString() } },
214
214
Expiry: { $date: { $numberLong: dayEnd.toString() } },
215
215
Tag: syndicateTag,
@@ -354,7 +354,7 @@ const pushSortieIfRelevant = (worldState: IWorldState, day: number): void => {
354
354
}
355
355
356
356
worldState.Sorties.push({
357
_id: { $oid: Math.trunc(dayStart / 1000).toString(16) + "d4d932c97c0a3acd" },
357
_id: { $oid: ((dayStart / 1000) & 0xffffffff).toString(16).padStart(8, "0") + "d4d932c97c0a3acd" },
358
358
Activation: { $date: { $numberLong: dayStart.toString() } },
359
359
Expiry: { $date: { $numberLong: dayEnd.toString() } },
360
360
Reward: "/Lotus/Types/Game/MissionDecks/SortieRewards",
@@ -758,7 +758,7 @@ export const getWorldState = (buildLabel?: string): IWorldState => {
758
758
const bountyCycleStart = bountyCycle * 9000000;
759
759
bountyCycleEnd = bountyCycleStart + 9000000;
760
760
worldState.SyndicateMissions.push({
761
_id: { $oid: Math.trunc(bountyCycleStart / 1000).toString(16) + "0000000000000029" },
761
_id: { $oid: ((bountyCycleStart / 1000) & 0xffffffff).toString(16).padStart(8, "0") + "0000000000000029" },
762
762
Activation: { $date: { $numberLong: bountyCycleStart.toString() } },
763
763
Expiry: { $date: { $numberLong: bountyCycleEnd.toString() } },
764
764
Tag: "ZarimanSyndicate",
@@ -766,7 +766,7 @@ export const getWorldState = (buildLabel?: string): IWorldState => {
766
766
Nodes: []
767
767
});
768
768
worldState.SyndicateMissions.push({
769
_id: { $oid: Math.trunc(bountyCycleStart / 1000).toString(16) + "0000000000000004" },
769
_id: { $oid: ((bountyCycleStart / 1000) & 0xffffffff).toString(16).padStart(8, "0") + "0000000000000004" },
770
770
Activation: { $date: { $numberLong: bountyCycleStart.toString() } },
771
771
Expiry: { $date: { $numberLong: bountyCycleEnd.toString() } },
772
772
Tag: "EntratiLabSyndicate",
@@ -774,7 +774,7 @@ export const getWorldState = (buildLabel?: string): IWorldState => {
774
774
Nodes: []
775
775
});
776
776
worldState.SyndicateMissions.push({
777
_id: { $oid: Math.trunc(bountyCycleStart / 1000).toString(16) + "0000000000000006" },
777
_id: { $oid: ((bountyCycleStart / 1000) & 0xffffffff).toString(16).padStart(8, "0") + "0000000000000006" },
778
778
Activation: { $date: { $numberLong: bountyCycleStart.toString(10) } },
779
779
Expiry: { $date: { $numberLong: bountyCycleEnd.toString(10) } },
780
780
Tag: "HexSyndicate",
@@ -793,7 +793,9 @@ export const getWorldState = (buildLabel?: string): IWorldState => {
793
793
{
794
794
const rng = new CRng(seed);
795
795
worldState.SyndicateMissions.push({
796
_id: { $oid: Math.trunc(bountyCycleStart / 1000).toString(16) + "0000000000000008" },
796
_id: {
797
$oid: ((bountyCycleStart / 1000) & 0xffffffff).toString(16).padStart(8, "0") + "0000000000000008"
798
},
797
799
Activation: { $date: { $numberLong: bountyCycleStart.toString(10) } },
798
800
Expiry: { $date: { $numberLong: bountyCycleEnd.toString(10) } },
799
801
Tag: "CetusSyndicate",
@@ -863,7 +865,9 @@ export const getWorldState = (buildLabel?: string): IWorldState => {
863
865
{
864
866
const rng = new CRng(seed);
865
867
worldState.SyndicateMissions.push({
866
_id: { $oid: Math.trunc(bountyCycleStart / 1000).toString(16) + "0000000000000025" },
868
_id: {
869
$oid: ((bountyCycleStart / 1000) & 0xffffffff).toString(16).padStart(8, "0") + "0000000000000025"
870
},
867
871
Activation: { $date: { $numberLong: bountyCycleStart.toString(10) } },
868
872
Expiry: { $date: { $numberLong: bountyCycleEnd.toString(10) } },
869
873
Tag: "SolarisSyndicate",
@@ -933,7 +937,9 @@ export const getWorldState = (buildLabel?: string): IWorldState => {
933
937
{
934
938
const rng = new CRng(seed);
935
939
worldState.SyndicateMissions.push({
936
_id: { $oid: Math.trunc(bountyCycleStart / 1000).toString(16) + "0000000000000002" },
940
_id: {
941
$oid: ((bountyCycleStart / 1000) & 0xffffffff).toString(16).padStart(8, "0") + "0000000000000002"
942
},
937
943
Activation: { $date: { $numberLong: bountyCycleStart.toString(10) } },
938
944
Expiry: { $date: { $numberLong: bountyCycleEnd.toString(10) } },
939
945
Tag: "EntratiSyndicate",
@@ -1170,7 +1176,7 @@ export const getLiteSortie = (week: number): ILiteSortie => {
1170
1176
const weekEnd = weekStart + 604800000;
1171
1177
return {
1172
1178
_id: {
1173
$oid: Math.trunc(weekStart / 1000).toString(16) + "5e23a244740a190c"
1179
$oid: ((weekStart / 1000) & 0xffffffff).toString(16).padStart(8, "0") + "5e23a244740a190c"
1174
1180
},
1175
1181
Activation: { $date: { $numberLong: weekStart.toString() } },
1176
1182
Expiry: { $date: { $numberLong: weekEnd.toString() } },