generated from nhcarrigan/template
feat: add in-game sound effects and browser notifications (#27)
Adds Web Audio API sound effects and browser notifications for key game events: achievement unlocked, quest completed, quest failed, boss defeated, prestige, transcendence, and apotheosis. Both features are toggled via profile settings, with notification permission requested on first enable.
This commit is contained in:
@@ -38,10 +38,22 @@ interface ProfileSettings {
|
||||
* Whether this player appears on the public leaderboards.
|
||||
*/
|
||||
showOnLeaderboards: boolean;
|
||||
|
||||
/**
|
||||
* Whether in-game sound effects are enabled.
|
||||
*/
|
||||
enableSounds: boolean;
|
||||
|
||||
/**
|
||||
* Whether browser system notifications are enabled.
|
||||
*/
|
||||
enableNotifications: boolean;
|
||||
}
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/naming-convention -- intentional constant name
|
||||
const DEFAULT_PROFILE_SETTINGS: ProfileSettings = {
|
||||
enableNotifications: false,
|
||||
enableSounds: false,
|
||||
numberFormat: "suffix",
|
||||
showAchievementsUnlocked: true,
|
||||
showAdventurersRecruited: true,
|
||||
|
||||
@@ -20,6 +20,8 @@ describe("DEFAULT_PROFILE_SETTINGS", () => {
|
||||
expect(DEFAULT_PROFILE_SETTINGS.showAdventurersRecruited).toBe(true);
|
||||
expect(DEFAULT_PROFILE_SETTINGS.showAchievementsUnlocked).toBe(true);
|
||||
expect(DEFAULT_PROFILE_SETTINGS.showOnLeaderboards).toBe(true);
|
||||
expect(DEFAULT_PROFILE_SETTINGS.enableSounds).toBe(false);
|
||||
expect(DEFAULT_PROFILE_SETTINGS.enableNotifications).toBe(false);
|
||||
});
|
||||
|
||||
it("defaults numberFormat to suffix", () => {
|
||||
|
||||
Reference in New Issue
Block a user