返回提交历史
Modified
src/controllers/api/infestedFoundryController.ts
+3
-5
Modified
src/controllers/dynamic/worldStateController.ts
+3
-3
XFEstudio/XFESpaceNinjaServer
chore: replace instances of `new Date().getTime()` with `Date.now()` (#1229)
Reviewed-on: https://onlyg.it/OpenWF/SpaceNinjaServer/pulls/1229
2a703de0
代码差异
2 个文件
+6
-8
@@ -128,7 +128,7 @@ export const infestedFoundryController: RequestHandler = async (req, res) => {
128
128
const miscItemChanges: IMiscItem[] = [];
129
129
let totalPercentagePointsGained = 0;
130
130
131
const currentUnixSeconds = Math.trunc(new Date().getTime() / 1000);
131
const currentUnixSeconds = Math.trunc(Date.now() / 1000);
132
132
133
133
for (const contribution of request.ResourceContributions) {
134
134
const snack = ExportMisc.helminthSnacks[contribution.ItemType];
@@ -260,9 +260,7 @@ export const infestedFoundryController: RequestHandler = async (req, res) => {
260
260
inventory.InfestedFoundry!.ConsumedSuits ??= [];
261
261
inventory.InfestedFoundry!.ConsumedSuits.push(consumedSuit);
262
262
inventory.InfestedFoundry!.LastConsumedSuit = suit;
263
inventory.InfestedFoundry!.AbilityOverrideUnlockCooldown = new Date(
264
new Date().getTime() + 24 * 60 * 60 * 1000
265
);
263
inventory.InfestedFoundry!.AbilityOverrideUnlockCooldown = new Date(Date.now() + 24 * 60 * 60 * 1000);
266
264
const recipeChanges = addInfestedFoundryXP(inventory.InfestedFoundry!, 1600_00);
267
265
addRecipes(inventory, recipeChanges);
268
266
freeUpSlot(inventory, InventorySlot.SUITS);
@@ -310,7 +308,7 @@ export const infestedFoundryController: RequestHandler = async (req, res) => {
310
308
const request = getJSONfromString<IHelminthInvigorationRequest>(String(req.body));
311
309
const inventory = await getInventory(accountId);
312
310
const suit = inventory.Suits.id(request.SuitId.$oid)!;
313
const upgradesExpiry = new Date(new Date().getTime() + 7 * 24 * 60 * 60 * 1000);
311
const upgradesExpiry = new Date(Date.now() + 7 * 24 * 60 * 60 * 1000);
314
312
suit.OffensiveUpgrade = request.OffensiveUpgradeType;
315
313
suit.DefensiveUpgrade = request.DefensiveUpgradeType;
316
314
suit.UpgradesExpiry = upgradesExpiry;
@@ -43,7 +43,7 @@ export const worldStateController: RequestHandler = (req, res) => {
43
43
}
44
44
45
45
const EPOCH = 1734307200 * 1000; // Monday, Dec 16, 2024 @ 00:00 UTC+0; should logically be winter in 1999 iteration 0
46
const day = Math.trunc((new Date().getTime() - EPOCH) / 86400000);
46
const day = Math.trunc((Date.now() - EPOCH) / 86400000);
47
47
const week = Math.trunc(day / 7);
48
48
const weekStart = EPOCH + week * 604800000;
49
49
const weekEnd = weekStart + 604800000;
@@ -52,7 +52,7 @@ export const worldStateController: RequestHandler = (req, res) => {
52
52
worldState.NodeOverrides.find(x => x.Node == "SolNode802")!.Seed = week; // unfaithful
53
53
54
54
// Holdfast, Cavia, & Hex bounties cycling every 2.5 hours; unfaithful implementation
55
const bountyCycle = Math.trunc(new Date().getTime() / 9000000);
55
const bountyCycle = Math.trunc(Date.now() / 9000000);
56
56
const bountyCycleStart = bountyCycle * 9000000;
57
57
const bountyCycleEnd = bountyCycleStart + 9000000;
58
58
worldState.SyndicateMissions[worldState.SyndicateMissions.findIndex(x => x.Tag == "ZarimanSyndicate")] = {
@@ -222,7 +222,7 @@ export const worldStateController: RequestHandler = (req, res) => {
222
222
worldState.KnownCalendarSeasons[0].YearIteration = Math.trunc(week / 4);
223
223
224
224
// Sentient Anomaly cycling every 30 minutes
225
const halfHour = Math.trunc(new Date().getTime() / (unixTimesInMs.hour / 2));
225
const halfHour = Math.trunc(Date.now() / (unixTimesInMs.hour / 2));
226
226
const tmp = {
227
227
cavabegin: "1690761600",
228
228
PurchasePlatformLockEnabled: true,