forked from phenom/healer-man
Release Healer Man 0.1.22
This commit is contained in:
1 parent
f6f2375145
commit
7f6001723a
144 files changed
+54107
-690
No files matched your search
@@ -50,6 +50,7 @@ interface TalentUiCatalogModule {
|
||||
|
||||
const shardLoaders = import.meta.glob<TalentUiCatalogModule>("./generated/talentUi/*.json");
|
||||
const loadCache = new Map<ClassId, Promise<TalentUiCatalog>>();
|
||||
const loadedCatalogs = new Map<ClassId, TalentUiCatalog>();
|
||||
|
||||
export function loadTalentUiCatalog(classId: ClassId): Promise<TalentUiCatalog> {
|
||||
const cached = loadCache.get(classId);
|
||||
@@ -61,6 +62,7 @@ export function loadTalentUiCatalog(classId: ClassId): Promise<TalentUiCatalog>
|
||||
if (module.default.schemaVersion !== 1 || module.default.classId !== classId) {
|
||||
throw new Error(`Talent UI catalog ${classId} has incompatible metadata.`);
|
||||
}
|
||||
loadedCatalogs.set(classId, module.default);
|
||||
return module.default;
|
||||
}).catch((error: unknown) => {
|
||||
loadCache.delete(classId);
|
||||
@@ -70,6 +72,10 @@ export function loadTalentUiCatalog(classId: ClassId): Promise<TalentUiCatalog>
|
||||
return pending;
|
||||
}
|
||||
|
||||
export function loadedTalentUiCatalog(classId: ClassId): TalentUiCatalog | null {
|
||||
return loadedCatalogs.get(classId) ?? null;
|
||||
}
|
||||
|
||||
export function talentUiDescriptionForRank(node: TalentUiNode, rank: number): string {
|
||||
const normalizedRank = Math.min(
|
||||
node.maxRank,
|
||||
@@ -91,3 +97,10 @@ export function talentUiNodesForTree(catalog: TalentUiCatalog, treeId: string):
|
||||
.filter((node) => node.treeId === treeId)
|
||||
.sort((left, right) => left.row - right.row || left.index - right.index);
|
||||
}
|
||||
|
||||
export function talentUiArtUrls(catalog: TalentUiCatalog): readonly string[] {
|
||||
return [...new Set([
|
||||
...catalog.trees.flatMap((tree) => [tree.icon, tree.background]),
|
||||
...catalog.nodes.map((node) => node.icon),
|
||||
])];
|
||||
}
|
||||
Reference in new issue
Block a user