OOKNET                             [ /  search the index  ]  
──────────────────────────────────────────────────────────────────────────────────────
══════════════════════════════════════════════════════════════════════════════════════
OOKNET   [ /  search  ]  
────────────────────────────────────────────────
════════════════════════════════════════════════
 
 
master @ 48 LINES
 
[ HISTORY ]  [ UP ]
 

export type Mode = "rankings" | "comparison" | "unified" | string;

export type PathParams = {
  mode: Mode;
  classSlug?: string | null;
  specSlug?: string | null;
  comparisonType?: "trinket" | "race" | string;
  phase?: string;
  encounterType?: string;
  targetCount?: string;
  duration?: string;
  unifiedSelection?: "benchmarks" | "comparisons" | string | null;
};

export const PARAM = {
  phase: "phase",
  encounter: "encounter",
  targets: "targets",
  duration: "duration",
  sort: "sort",
  type: "type",
  class: "class",
  spec: "spec",
} as const;

export function buildRankingsUrl(params: PathParams): string {
  const phase = params.phase || "p1";
  const encounter = params.encounterType || "raid";
  const target = params.targetCount || "single";
  const duration = params.duration || "long";
  const file = `dps_${phase}_${encounter}_${target}_${duration}.json`;
  return `/data/rankings/${file}`;
}

export function buildComparisonUrl(params: PathParams): string {
  const cls = (params.classSlug || "").toLowerCase();
  const spec = (params.specSlug || "").toLowerCase();
  if (!cls || !spec) throw new Error("Select a class and spec");
  const type = (params.comparisonType || "trinket") as string;
  const phase = params.phase || "p1";
  const encounter = params.encounterType || "raid";
  const target = params.targetCount || "single";
  const duration = params.duration || "long";
  const file = `${cls}_${spec}_${type}_${phase}_${encounter}_${target}_${duration}
.json`;
  const folder = type === "trinket" ? "trinkets" : "race";
  return `/data/comparison/${folder}/${cls}/${spec}/${file}`;
}

export type Mode = "rankings" | "comparison"
 | "unified" | string;

export type PathParams = {
  mode: Mode;
  classSlug?: string | null;
  specSlug?: string | null;
  comparisonType?: "trinket" | "race" | stri
ng;
  phase?: string;
  encounterType?: string;
  targetCount?: string;
  duration?: string;
  unifiedSelection?: "benchmarks" | "compari
sons" | string | null;
};

export const PARAM = {
  phase: "phase",
  encounter: "encounter",
  targets: "targets",
  duration: "duration",
  sort: "sort",
  type: "type",
  class: "class",
  spec: "spec",
} as const;

export function buildRankingsUrl(params: Pat
hParams): string {
  const phase = params.phase || "p1";
  const encounter = params.encounterType || 
"raid";
  const target = params.targetCount || "sing
le";
  const duration = params.duration || "long"
;
  const file = `dps_${phase}_${encounter}_${
target}_${duration}.json`;
  return `/data/rankings/${file}`;
}

export function buildComparisonUrl(params: P
athParams): string {
  const cls = (params.classSlug || "").toLow
erCase();
  const spec = (params.specSlug || "").toLow
erCase();
  if (!cls || !spec) throw new Error("Select
 a class and spec");
  const type = (params.comparisonType || "tr
inket") as string;
  const phase = params.phase || "p1";
  const encounter = params.encounterType || 
"raid";
  const target = params.targetCount || "sing
le";
  const duration = params.duration || "long"
;
  const file = `${cls}_${spec}_${type}_${pha
se}_${encounter}_${target}_${duration}.json`
;
  const folder = type === "trinket" ? "trink
ets" : "race";
  return `/data/comparison/${folder}/${cls}/
${spec}/${file}`;
}
 
──────────────────────────────────────────────────────────────────────────────────────
OOKNET
────────────────────────────────────────────────
OOKNET