forked from phenom/healer-man
Update Healer Man server
This commit is contained in:
1 parent
97ee0c13f9
commit
f864b5aea7
20 files changed
+468
-211
No files matched your search
@@ -12,15 +12,24 @@ export interface RandomizedBiteSizedCreature {
|
||||
readonly entityId: string;
|
||||
readonly name: string;
|
||||
readonly kind: RandomizedCreatureKind;
|
||||
readonly serverEntry: number;
|
||||
/** Source-catalog identity; RuneWaker entries never leak into AzerothCore combat ids. */
|
||||
readonly sourceEntry: number;
|
||||
readonly definition: PopulationEntityDefinition;
|
||||
}
|
||||
|
||||
function creatureSourceEntry(source: DungeonDefinition, entity: PopulationEntityDefinition): number | null {
|
||||
if (source.expansion !== "runewaker") return entity.combat?.serverEntry ?? null;
|
||||
const encodedEntry = /-([1-9][0-9]*)$/.exec(entity.id)?.[1];
|
||||
if (!encodedEntry) return null;
|
||||
const sourceEntry = Number(encodedEntry);
|
||||
return Number.isSafeInteger(sourceEntry) ? sourceEntry : null;
|
||||
}
|
||||
|
||||
function creatureKey(source: DungeonDefinition, entity: PopulationEntityDefinition): string | null {
|
||||
const serverEntry = entity.combat?.serverEntry;
|
||||
if (!serverEntry) return null;
|
||||
const sourceEntry = creatureSourceEntry(source, entity);
|
||||
if (!sourceEntry) return null;
|
||||
const catalog = source.expansion === "runewaker" ? "rom" : "wow";
|
||||
return `${catalog}:${entity.kind}:${serverEntry}`;
|
||||
return `${catalog}:${entity.kind}:${sourceEntry}`;
|
||||
}
|
||||
|
||||
function seedHash(seed: string): number {
|
||||
@@ -64,8 +73,8 @@ export function randomizedBiteSizedCreatureCatalog(
|
||||
const candidates = sources
|
||||
.flatMap((source) => Object.values(source.entities).flatMap((entity) => {
|
||||
const key = creatureKey(source, entity);
|
||||
const serverEntry = entity.combat?.serverEntry;
|
||||
if (!key || !serverEntry || !entity.visual.model?.url) return [];
|
||||
const sourceEntry = creatureSourceEntry(source, entity);
|
||||
if (!key || !sourceEntry || !entity.visual.model?.url) return [];
|
||||
return [{
|
||||
key,
|
||||
sourceDungeonId: source.id,
|
||||
@@ -73,13 +82,13 @@ export function randomizedBiteSizedCreatureCatalog(
|
||||
entityId: entity.id,
|
||||
name: entity.name,
|
||||
kind: entity.kind,
|
||||
serverEntry,
|
||||
sourceEntry,
|
||||
definition: entity,
|
||||
} satisfies RandomizedBiteSizedCreature];
|
||||
}))
|
||||
.sort((left, right) => left.kind.localeCompare(right.kind)
|
||||
|| left.name.localeCompare(right.name)
|
||||
|| left.serverEntry - right.serverEntry
|
||||
|| left.sourceEntry - right.sourceEntry
|
||||
|| left.sourceDungeonId.localeCompare(right.sourceDungeonId));
|
||||
return [...new Map(candidates.map((candidate) => [candidate.key, candidate])).values()];
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user