fix: align guild advertisment vendor rotation to monday 0 UTC #1858
@ -2,15 +2,18 @@ const millisecondsPerSecond = 1000;
 | 
				
			|||||||
const secondsPerMinute = 60;
 | 
					const secondsPerMinute = 60;
 | 
				
			||||||
const minutesPerHour = 60;
 | 
					const minutesPerHour = 60;
 | 
				
			||||||
const hoursPerDay = 24;
 | 
					const hoursPerDay = 24;
 | 
				
			||||||
 | 
					const daysPerWeek = 7;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const unixSecond = millisecondsPerSecond;
 | 
					const unixSecond = millisecondsPerSecond;
 | 
				
			||||||
const unixMinute = secondsPerMinute * millisecondsPerSecond;
 | 
					const unixMinute = secondsPerMinute * millisecondsPerSecond;
 | 
				
			||||||
const unixHour = unixMinute * minutesPerHour;
 | 
					const unixHour = unixMinute * minutesPerHour;
 | 
				
			||||||
const unixDay = hoursPerDay * unixHour;
 | 
					const unixDay = hoursPerDay * unixHour;
 | 
				
			||||||
 | 
					const unixWeek = daysPerWeek * unixDay;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
export const unixTimesInMs = {
 | 
					export const unixTimesInMs = {
 | 
				
			||||||
    second: unixSecond,
 | 
					    second: unixSecond,
 | 
				
			||||||
    minute: unixMinute,
 | 
					    minute: unixMinute,
 | 
				
			||||||
    hour: unixHour,
 | 
					    hour: unixHour,
 | 
				
			||||||
    day: unixDay
 | 
					    day: unixDay,
 | 
				
			||||||
 | 
					    week: unixWeek
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
				
			|||||||
@ -66,7 +66,7 @@ const rawVendorManifests: IVendorManifest[] = [
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
interface IGeneratableVendorInfo extends Omit<IVendorInfo, "ItemManifest" | "Expiry"> {
 | 
					interface IGeneratableVendorInfo extends Omit<IVendorInfo, "ItemManifest" | "Expiry"> {
 | 
				
			||||||
    cycleOffset?: number;
 | 
					    cycleOffset?: number;
 | 
				
			||||||
    cycleDuration?: number;
 | 
					    cycleDuration: number;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const generatableVendors: IGeneratableVendorInfo[] = [
 | 
					const generatableVendors: IGeneratableVendorInfo[] = [
 | 
				
			||||||
@ -93,13 +93,15 @@ const generatableVendors: IGeneratableVendorInfo[] = [
 | 
				
			|||||||
        _id: { $oid: "5be4a159b144f3cdf1c22efa" },
 | 
					        _id: { $oid: "5be4a159b144f3cdf1c22efa" },
 | 
				
			||||||
        TypeName: "/Lotus/Types/Game/VendorManifests/Solaris/DebtTokenVendorManifest",
 | 
					        TypeName: "/Lotus/Types/Game/VendorManifests/Solaris/DebtTokenVendorManifest",
 | 
				
			||||||
        PropertyTextHash: "A39621049CA3CA13761028CD21C239EF",
 | 
					        PropertyTextHash: "A39621049CA3CA13761028CD21C239EF",
 | 
				
			||||||
        RandomSeedType: "VRST_FLAVOUR_TEXT"
 | 
					        RandomSeedType: "VRST_FLAVOUR_TEXT",
 | 
				
			||||||
 | 
					        cycleDuration: unixTimesInMs.hour
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        _id: { $oid: "61ba123467e5d37975aeeb03" },
 | 
					        _id: { $oid: "61ba123467e5d37975aeeb03" },
 | 
				
			||||||
        TypeName: "/Lotus/Types/Game/VendorManifests/Hubs/GuildAdvertisementVendorManifest",
 | 
					        TypeName: "/Lotus/Types/Game/VendorManifests/Hubs/GuildAdvertisementVendorManifest",
 | 
				
			||||||
        PropertyTextHash: "255AFE2169BAE4130B4B20D7C55D14FA",
 | 
					        PropertyTextHash: "255AFE2169BAE4130B4B20D7C55D14FA",
 | 
				
			||||||
        RandomSeedType: "VRST_FLAVOUR_TEXT"
 | 
					        RandomSeedType: "VRST_FLAVOUR_TEXT",
 | 
				
			||||||
 | 
					        cycleDuration: unixTimesInMs.week
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    // {
 | 
					    // {
 | 
				
			||||||
    //     _id: { $oid: "5dbb4c41e966f7886c3ce939" },
 | 
					    //     _id: { $oid: "5dbb4c41e966f7886c3ce939" },
 | 
				
			||||||
@ -193,7 +195,7 @@ const generateVendorManifest = (vendorInfo: IGeneratableVendorInfo): IVendorMani
 | 
				
			|||||||
        // Add new offers
 | 
					        // Add new offers
 | 
				
			||||||
        const vendorSeed = parseInt(vendorInfo._id.$oid.substring(16), 16);
 | 
					        const vendorSeed = parseInt(vendorInfo._id.$oid.substring(16), 16);
 | 
				
			||||||
        const cycleOffset = vendorInfo.cycleOffset ?? 1734307200_000;
 | 
					        const cycleOffset = vendorInfo.cycleOffset ?? 1734307200_000;
 | 
				
			||||||
        const cycleDuration = vendorInfo.cycleDuration ?? unixTimesInMs.hour;
 | 
					        const cycleDuration = vendorInfo.cycleDuration;
 | 
				
			||||||
        const cycleIndex = Math.trunc((Date.now() - cycleOffset) / cycleDuration);
 | 
					        const cycleIndex = Math.trunc((Date.now() - cycleOffset) / cycleDuration);
 | 
				
			||||||
        const rng = new CRng(mixSeeds(vendorSeed, cycleIndex));
 | 
					        const rng = new CRng(mixSeeds(vendorSeed, cycleIndex));
 | 
				
			||||||
        const manifest = ExportVendors[vendorInfo.TypeName];
 | 
					        const manifest = ExportVendors[vendorInfo.TypeName];
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user