This repository was archived by the owner on Jul 1, 2026. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathlabGodTables.ts
More file actions
55 lines (46 loc) · 1.46 KB
/
Copy pathlabGodTables.ts
File metadata and controls
55 lines (46 loc) · 1.46 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
/**
* Authoritative lab ladder data from `tables/labs/` JSON.
* Marginal coins and upgrade times for these labs override `tower-labs.json`.
* Loaded at runtime from `public/tables/labs/` (see loadGodTables.ts).
* Generated by scripts/sync-lab-god-tables.mjs — do not hand-edit store helpers.
*/
export type LabGodTime = {
display: string
seconds: number
}
export type LabGodLevel = {
level: number
value: number
time: LabGodTime
gems: number
coins: number
totalTime: LabGodTime
totalGems: number
totalCoins: number
}
export type LabGodTable = {
name: string
maxLevel: number
levels: LabGodLevel[]
}
let labGodTables: Record<string, LabGodTable> = {}
/** Expected lab GOD table count (manifest sanity check). */
export const LAB_GOD_TABLE_COUNT = 217
export function installLabGodTables(tables: Record<string, LabGodTable>): void {
labGodTables = tables
}
export function getLabGodTables(): Readonly<Record<string, LabGodTable>> {
return labGodTables
}
export function getLabGodLabNames(): ReadonlySet<string> {
return new Set(Object.keys(labGodTables))
}
/** Target level row (upgrade ending at `targetLevel`) from a GOD table, if present. */
export function labGodLevelEntry(
labDisplayName: string,
targetLevel: number,
): LabGodLevel | undefined {
const table = labGodTables[labDisplayName]
if (!table || !Number.isFinite(targetLevel) || targetLevel < 1) return undefined
return table.levels.find((row) => row.level === targetLevel)
}