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

fix: align guild advertisment vendor rotation to monday 0 UTC (#1858)

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

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

代码差异

2 个文件 +10 -5
Modified src/constants/timeConstants.ts +4 -1
@@ -2,15 +2,18 @@ const millisecondsPerSecond = 1000;
2 2 const secondsPerMinute = 60;
3 3 const minutesPerHour = 60;
4 4 const hoursPerDay = 24;
5 const daysPerWeek = 7;
5 6
6 7 const unixSecond = millisecondsPerSecond;
7 8 const unixMinute = secondsPerMinute * millisecondsPerSecond;
8 9 const unixHour = unixMinute * minutesPerHour;
9 10 const unixDay = hoursPerDay * unixHour;
11 const unixWeek = daysPerWeek * unixDay;
10 12
11 13 export const unixTimesInMs = {
12 14 second: unixSecond,
13 15 minute: unixMinute,
14 16 hour: unixHour,
15 day: unixDay
17 day: unixDay,
18 week: unixWeek
16 19 };
Modified src/services/serversideVendorsService.ts +6 -4
@@ -66,7 +66,7 @@ const rawVendorManifests: IVendorManifest[] = [
66 66
67 67 interface IGeneratableVendorInfo extends Omit<IVendorInfo, "ItemManifest" | "Expiry"> {
68 68 cycleOffset?: number;
69 cycleDuration?: number;
69 cycleDuration: number;
70 70 }
71 71
72 72 const generatableVendors: IGeneratableVendorInfo[] = [
@@ -93,13 +93,15 @@ const generatableVendors: IGeneratableVendorInfo[] = [
93 93 _id: { $oid: "5be4a159b144f3cdf1c22efa" },
94 94 TypeName: "/Lotus/Types/Game/VendorManifests/Solaris/DebtTokenVendorManifest",
95 95 PropertyTextHash: "A39621049CA3CA13761028CD21C239EF",
96 RandomSeedType: "VRST_FLAVOUR_TEXT"
96 RandomSeedType: "VRST_FLAVOUR_TEXT",
97 cycleDuration: unixTimesInMs.hour
97 98 },
98 99 {
99 100 _id: { $oid: "61ba123467e5d37975aeeb03" },
100 101 TypeName: "/Lotus/Types/Game/VendorManifests/Hubs/GuildAdvertisementVendorManifest",
101 102 PropertyTextHash: "255AFE2169BAE4130B4B20D7C55D14FA",
102 RandomSeedType: "VRST_FLAVOUR_TEXT"
103 RandomSeedType: "VRST_FLAVOUR_TEXT",
104 cycleDuration: unixTimesInMs.week
103 105 }
104 106 // {
105 107 // _id: { $oid: "5dbb4c41e966f7886c3ce939" },
@@ -193,7 +195,7 @@ const generateVendorManifest = (vendorInfo: IGeneratableVendorInfo): IVendorMani
193 195 // Add new offers
194 196 const vendorSeed = parseInt(vendorInfo._id.$oid.substring(16), 16);
195 197 const cycleOffset = vendorInfo.cycleOffset ?? 1734307200_000;
196 const cycleDuration = vendorInfo.cycleDuration ?? unixTimesInMs.hour;
198 const cycleDuration = vendorInfo.cycleDuration;
197 199 const cycleIndex = Math.trunc((Date.now() - cycleOffset) / cycleDuration);
198 200 const rng = new CRng(mixSeeds(vendorSeed, cycleIndex));
199 201 const manifest = ExportVendors[vendorInfo.TypeName];