Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
res.set('Access-Control-Max-Age', '3600');
if (req.method === 'OPTIONS') {
// Send response to OPTIONS requests
res.status(204).send('');
} else {
const stats = new CrafterStats(
req.body.stats.jobId,
req.body.stats.craftsmanship,
req.body.stats.control,
req.body.stats.cp,
req.body.stats.specialist,
req.body.stats.level,
req.body.stats.levels
);
const solver = new Solver(req.body.recipe, stats, req.body.configuration);
const seed = req.body.seed ? CraftingActionsRegistry.deserializeRotation(req.body.seed) : undefined;
return res.json(CraftingActionsRegistry.serializeRotation(solver.run(seed)));
}
});
openMacroPopup(simulation: Simulation): void {
this.dialog.create({
nzContent: MacroPopupComponent,
nzComponentParams: {
rotation: CraftingActionsRegistry.deserializeRotation(this.rotation.rotation),
job: this.rotation.recipe.job,
simulation: simulation.clone(),
food: this.foods.find(f => this.rotation.food && f.itemId === this.rotation.food.id && f.hq === this.rotation.food.hq),
medicine: this.medicines.find(f => this.rotation.medicine && f.itemId === this.rotation.medicine.id && f.hq === this.rotation.medicine.hq),
freeCompanyActions: this.freeCompanyActions.filter(action => this.rotation.freeCompanyActions.indexOf(action.actionId) > -1)
},
nzTitle: this.translate.instant('SIMULATOR.Generate_ingame_macro'),
nzFooter: null
});
}
map(rotation => CraftingActionsRegistry.deserializeRotation(rotation.rotation))
);
this.http.post(`https://us-central1-ffxivteamcraft.cloudfunctions.net/solver `, gcfParams).subscribe(res => {
this.ref.close(CraftingActionsRegistry.deserializeRotation(res));
});
}
map((rotation: any) => {
rotation.actions = CraftingActionsRegistry.deserializeRotation(rotation.rotation);
return rotation;
})
);