How to use the @ffxiv-teamcraft/simulator.CraftingActionsRegistry.serializeRotation function in @ffxiv-teamcraft/simulator

To help you get started, we’ve selected a few @ffxiv-teamcraft/simulator examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github ffxiv-teamcraft / ffxiv-teamcraft / apps / client / src / app / pages / simulator / components / solver-popup / solver-popup.component.ts View on Github external
public submit(): void {
    this.loading = true;
    const formRaw = this.configForm.getRawValue();
    const configuration: SolverConfiguration = {
      populationSize: defaultConfiguration.populationSize,
      progressAccuracy: defaultConfiguration.progressAccuracy,
      hqTarget: formRaw.hqTarget
    };
    const gcfParams: any = {
      configuration: configuration,
      recipe: this.recipe,
      stats: { ...this.stats }
    };
    if (formRaw.seeded && this.seed.length > 0) {
      gcfParams.seed = CraftingActionsRegistry.serializeRotation(this.seed);
    }
    // To debug using local function: http://localhost:5001/ffxivteamcraft/us-central1/solver
    // Prod: https://us-central1-ffxivteamcraft.cloudfunctions.net/solver
    this.http.post(`https://us-central1-ffxivteamcraft.cloudfunctions.net/solver  `, gcfParams).subscribe(res => {
      this.ref.close(CraftingActionsRegistry.deserializeRotation(res));
    });
  }
}
github ffxiv-teamcraft / ffxiv-teamcraft / functions / index.js View on Github external
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)));
  }
});