Update Healer Man server
This commit is contained in:
1 parent
a868401ebc
commit
48a678dcc5
295 files changed
+7644
-467
No files matched your search
+20
-23
@@ -202,18 +202,21 @@ export function selectCombatSoundAssets(
|
||||
: [];
|
||||
}
|
||||
|
||||
function weightedSound(event: CombatPresentationEvent): CombatEffectSoundAsset | null {
|
||||
if (!configuredSettings || !authenticCombatAudioEnabled(configuredSettings)) return null;
|
||||
function soundsForEvent(event: CombatPresentationEvent): readonly CombatEffectSoundAsset[] {
|
||||
if (!configuredSettings || !authenticCombatAudioEnabled(configuredSettings)) return [];
|
||||
const sounds = combatEffectManifestEntry(event.sourceSpellId, event.source)?.sounds ?? [];
|
||||
const playable = selectCombatSoundAssets(sounds, event);
|
||||
if (!playable.length) return null;
|
||||
if (!playable.length) return [];
|
||||
// RuneWaker ImageObject and ROS callbacks are independent client sound
|
||||
// layers. Choosing one at random drops cast fades or companion impact cues.
|
||||
if (event.source === "runewaker") return playable;
|
||||
const total = playable.reduce((sum, sound) => sum + Math.max(1, sound.weight ?? 1), 0);
|
||||
let cursor = (event.id * 0.61803398875 % 1) * total;
|
||||
for (const sound of playable) {
|
||||
cursor -= Math.max(1, sound.weight ?? 1);
|
||||
if (cursor <= 0) return sound;
|
||||
if (cursor <= 0) return [sound];
|
||||
}
|
||||
return playable[playable.length - 1] ?? null;
|
||||
return playable.length ? [playable[playable.length - 1]] : [];
|
||||
}
|
||||
|
||||
async function decodeAudio(url: string): Promise<AudioBuffer | null> {
|
||||
@@ -393,24 +396,18 @@ export function playCombatAudio(event: CombatPresentationEvent): void {
|
||||
!configuredSettings
|
||||
|| !combatAudioGroupOutputEnabled(configuredSettings, configuredMasterVolume, event.actorGroup)
|
||||
) return;
|
||||
const sound = weightedSound(event);
|
||||
if (sound) {
|
||||
const castLoop = event.phase === "cast-start" && sound.loopDuringCast
|
||||
? beginCastLoop(event)
|
||||
: undefined;
|
||||
void playBufferedCombatCue(event, sound, castLoop)
|
||||
.then((played) => {
|
||||
if (!played && !castLoop?.cancelled) {
|
||||
if (castLoop) stopCastLoop(castLoopKey(event));
|
||||
playGeneratedCombatCue(event);
|
||||
}
|
||||
})
|
||||
.catch(() => {
|
||||
if (!castLoop?.cancelled) {
|
||||
if (castLoop) stopCastLoop(castLoopKey(event));
|
||||
playGeneratedCombatCue(event);
|
||||
}
|
||||
});
|
||||
const sounds = soundsForEvent(event);
|
||||
if (sounds.length) {
|
||||
const loopingSound = event.phase === "cast-start"
|
||||
? sounds.find((sound) => sound.loopDuringCast) : undefined;
|
||||
const castLoop = loopingSound ? beginCastLoop(event) : undefined;
|
||||
void Promise.all(sounds.map((sound) => playBufferedCombatCue(
|
||||
event, sound, sound === loopingSound ? castLoop : undefined,
|
||||
).catch(() => false))).then((played) => {
|
||||
if (played.some(Boolean) || castLoop?.cancelled) return;
|
||||
if (castLoop) stopCastLoop(castLoopKey(event));
|
||||
playGeneratedCombatCue(event);
|
||||
});
|
||||
} else {
|
||||
playGeneratedCombatCue(event);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user