forked from phenom/healer-man
Release Healer Man 0.1.14
This commit is contained in:
1 parent
67d7a8ebe7
commit
7b41b102fa
147 files changed
+169892
-1342
No files matched your search
+22
-2
@@ -6,6 +6,10 @@ import {
|
||||
type CombatPresentationSettings,
|
||||
type CombatPresentationSchool,
|
||||
} from "./combatPresentation";
|
||||
import {
|
||||
combatMediaPackReady,
|
||||
fetchOptionalMediaAsset,
|
||||
} from "./combatMediaPack";
|
||||
|
||||
const MAX_COMBAT_VOICES = 32;
|
||||
|
||||
@@ -37,6 +41,19 @@ export function combatAudioOutputEnabled(
|
||||
));
|
||||
}
|
||||
|
||||
export function authenticCombatAudioEnabled(settings: CombatPresentationSettings): boolean {
|
||||
return settings.originalMediaEnabled && combatMediaPackReady();
|
||||
}
|
||||
|
||||
export function combatMediaPreloadEnabled(
|
||||
settings: CombatPresentationSettings,
|
||||
masterVolume: number,
|
||||
): boolean {
|
||||
return authenticCombatAudioEnabled(settings) && (
|
||||
settings.vfxQuality !== "off" || combatAudioOutputEnabled(settings, masterVolume)
|
||||
);
|
||||
}
|
||||
|
||||
function combatAudioGroupOutputEnabled(
|
||||
settings: CombatPresentationSettings,
|
||||
masterVolume: number,
|
||||
@@ -185,6 +202,7 @@ function playSynthesizedCombatCue(event: CombatPresentationEvent): void {
|
||||
}
|
||||
|
||||
function weightedSound(event: CombatPresentationEvent): CombatEffectSoundAsset | null {
|
||||
if (!configuredSettings || !authenticCombatAudioEnabled(configuredSettings)) return null;
|
||||
const sounds = combatEffectManifestEntry(event.sourceSpellId, event.source)?.sounds ?? [];
|
||||
const playable = sounds.filter((sound) => sound.url);
|
||||
if (!playable.length) return null;
|
||||
@@ -201,7 +219,7 @@ async function decodeAudio(url: string): Promise<AudioBuffer | null> {
|
||||
const audioContext = ensureContext();
|
||||
if (!audioContext) return null;
|
||||
if (!decodedBuffers.has(url)) {
|
||||
decodedBuffers.set(url, fetch(url)
|
||||
decodedBuffers.set(url, fetchOptionalMediaAsset(url)
|
||||
.then((response) => response.ok ? response.arrayBuffer() : Promise.reject(new Error(String(response.status))))
|
||||
.then((data) => audioContext.decodeAudioData(data))
|
||||
.catch(() => null));
|
||||
@@ -213,7 +231,9 @@ export async function playMasterAudioCue(
|
||||
url: string,
|
||||
volume = 1,
|
||||
): Promise<(() => void) | null> {
|
||||
if (!masterAudioOutputEnabled(configuredMasterVolume)) return null;
|
||||
if (!configuredSettings
|
||||
|| !authenticCombatAudioEnabled(configuredSettings)
|
||||
|| !masterAudioOutputEnabled(configuredMasterVolume)) return null;
|
||||
const audioContext = ensureContext();
|
||||
const buffer = await decodeAudio(url);
|
||||
if (
|
||||
|
||||
Reference in new issue
Block a user