diff --git a/_datafiles/html/public/webclient.html b/_datafiles/html/public/webclient.html
index b9040539..e2a60740 100644
--- a/_datafiles/html/public/webclient.html
+++ b/_datafiles/html/public/webclient.html
@@ -101,7 +101,7 @@
position: absolute;
top: 60px; /* Just below the icon */
right: 10px;
- width: 300px;
+ width: 450px;
padding: 10px;
background-color: #2e2e2e;
border: 1px solid #444;
@@ -121,7 +121,7 @@
}
.slider-container label {
color: #ccc;
- width: 70px;
+ width: 150px;
}
.slider-container input[type="range"] {
flex: 1;
@@ -347,7 +347,7 @@
Volume Controls
SoundPlayer.stop();
}
} else {
- SoundPlayer.play(baseMp3Url+fileName, true, (sliderValues["sounds"]/100));
+ SoundPlayer.play(baseMp3Url+fileName, false, (sliderValues[obj.T.toLowerCase()+" sounds"]/100));
}
}
return;
@@ -480,9 +480,11 @@ Volume Controls
/////////////////////////////////////////////
// Our multiple volume controls:
- let sliderValues = {
- "music": 75, // default 75%
- "sounds": 75 // default 75%
+ let sliderValues = { // default 75%
+ "music": 75,
+ "combat sounds": 75,
+ "movement sounds": 75,
+ "other sounds": 75
};
// Returns an appropriate speaker icon based on value
@@ -534,7 +536,6 @@ Volume Controls
iconSpan.textContent = getSpeakerIcon(val);
MusicPlayer.setGlobalVolume(sliderValues["music"]/100);
- SoundPlayer.setGlobalVolume(sliderValues["sounds"]/100);
});
// Put them all together
diff --git a/_datafiles/html/static/public/audio/music/_TODO11.mp3 b/_datafiles/html/static/public/audio/music/frostfire-inn.mp3
similarity index 100%
rename from _datafiles/html/static/public/audio/music/_TODO11.mp3
rename to _datafiles/html/static/public/audio/music/frostfire-inn.mp3
diff --git a/_datafiles/html/static/public/audio/sound/sleep.mp3 b/_datafiles/html/static/public/audio/music/goodbye.mp3
similarity index 100%
rename from _datafiles/html/static/public/audio/sound/sleep.mp3
rename to _datafiles/html/static/public/audio/music/goodbye.mp3
diff --git a/_datafiles/html/static/public/audio/sound/combat/downed-other.mp3 b/_datafiles/html/static/public/audio/sound/combat/downed-other.mp3
new file mode 100644
index 00000000..e4e1275f
Binary files /dev/null and b/_datafiles/html/static/public/audio/sound/combat/downed-other.mp3 differ
diff --git a/_datafiles/html/static/public/audio/sound/combat/downed-self.mp3 b/_datafiles/html/static/public/audio/sound/combat/downed-self.mp3
new file mode 100644
index 00000000..d2014495
Binary files /dev/null and b/_datafiles/html/static/public/audio/sound/combat/downed-self.mp3 differ
diff --git a/_datafiles/html/static/public/audio/sound/combat/explosion.mp3 b/_datafiles/html/static/public/audio/sound/combat/explosion.mp3
new file mode 100644
index 00000000..f539f2c2
Binary files /dev/null and b/_datafiles/html/static/public/audio/sound/combat/explosion.mp3 differ
diff --git a/_datafiles/html/static/public/audio/sound/combat/explosion2.mp3 b/_datafiles/html/static/public/audio/sound/combat/explosion2.mp3
new file mode 100644
index 00000000..f916eded
Binary files /dev/null and b/_datafiles/html/static/public/audio/sound/combat/explosion2.mp3 differ
diff --git a/_datafiles/html/static/public/audio/sound/combat/explosion3.mp3 b/_datafiles/html/static/public/audio/sound/combat/explosion3.mp3
new file mode 100644
index 00000000..d28a9bf4
Binary files /dev/null and b/_datafiles/html/static/public/audio/sound/combat/explosion3.mp3 differ
diff --git a/_datafiles/html/static/public/audio/sound/combat/heal1.mp3 b/_datafiles/html/static/public/audio/sound/combat/heal1.mp3
new file mode 100644
index 00000000..3fa9a7c0
Binary files /dev/null and b/_datafiles/html/static/public/audio/sound/combat/heal1.mp3 differ
diff --git a/_datafiles/html/static/public/audio/sound/combat/heal2.mp3 b/_datafiles/html/static/public/audio/sound/combat/heal2.mp3
new file mode 100644
index 00000000..b44ec533
Binary files /dev/null and b/_datafiles/html/static/public/audio/sound/combat/heal2.mp3 differ
diff --git a/_datafiles/html/static/public/audio/sound/combat/hit-other.mp3 b/_datafiles/html/static/public/audio/sound/combat/hit-other.mp3
new file mode 100644
index 00000000..ce43ac33
Binary files /dev/null and b/_datafiles/html/static/public/audio/sound/combat/hit-other.mp3 differ
diff --git a/_datafiles/html/static/public/audio/sound/combat/hit-self.mp3 b/_datafiles/html/static/public/audio/sound/combat/hit-self.mp3
new file mode 100644
index 00000000..a64cbb68
Binary files /dev/null and b/_datafiles/html/static/public/audio/sound/combat/hit-self.mp3 differ
diff --git a/_datafiles/html/static/public/audio/sound/combat/miss1.mp3 b/_datafiles/html/static/public/audio/sound/combat/miss1.mp3
new file mode 100644
index 00000000..4196886f
Binary files /dev/null and b/_datafiles/html/static/public/audio/sound/combat/miss1.mp3 differ
diff --git a/_datafiles/html/static/public/audio/sound/combat/miss2.mp3 b/_datafiles/html/static/public/audio/sound/combat/miss2.mp3
new file mode 100644
index 00000000..fae5bd54
Binary files /dev/null and b/_datafiles/html/static/public/audio/sound/combat/miss2.mp3 differ
diff --git a/_datafiles/html/static/public/audio/sound/movement/room-enter.mp3 b/_datafiles/html/static/public/audio/sound/movement/room-enter.mp3
new file mode 100644
index 00000000..69c56780
Binary files /dev/null and b/_datafiles/html/static/public/audio/sound/movement/room-enter.mp3 differ
diff --git a/_datafiles/html/static/public/audio/sound/movement/room-exit.mp3 b/_datafiles/html/static/public/audio/sound/movement/room-exit.mp3
new file mode 100644
index 00000000..5f659e47
Binary files /dev/null and b/_datafiles/html/static/public/audio/sound/movement/room-exit.mp3 differ
diff --git a/_datafiles/html/static/public/audio/sound/movement/runaway.mp3 b/_datafiles/html/static/public/audio/sound/movement/runaway.mp3
new file mode 100644
index 00000000..8116183e
Binary files /dev/null and b/_datafiles/html/static/public/audio/sound/movement/runaway.mp3 differ
diff --git a/_datafiles/html/static/public/audio/sound/other/buy.mp3 b/_datafiles/html/static/public/audio/sound/other/buy.mp3
new file mode 100644
index 00000000..5f0d8577
Binary files /dev/null and b/_datafiles/html/static/public/audio/sound/other/buy.mp3 differ
diff --git a/_datafiles/html/static/public/audio/sound/other/levelup.mp3 b/_datafiles/html/static/public/audio/sound/other/levelup.mp3
new file mode 100644
index 00000000..686f4066
Binary files /dev/null and b/_datafiles/html/static/public/audio/sound/other/levelup.mp3 differ
diff --git a/_datafiles/world/default/rooms/frostfang/432.yaml b/_datafiles/world/default/rooms/frostfang/432.yaml
index c0aa55d2..dac4a22c 100755
--- a/_datafiles/world/default/rooms/frostfang/432.yaml
+++ b/_datafiles/world/default/rooms/frostfang/432.yaml
@@ -1,5 +1,6 @@
roomid: 432
zone: Frostfang
+musicfile: music/frostfire-inn.mp3
title: A Room at the Inn
description: The dim glow of a crackling hearth in one corner bathes the wooden walls
in a flickering amber light, casting dancing shadows that play across the room.
diff --git a/_datafiles/world/default/rooms/frostfang/61.yaml b/_datafiles/world/default/rooms/frostfang/61.yaml
index fcd46f28..59f5ac4b 100755
--- a/_datafiles/world/default/rooms/frostfang/61.yaml
+++ b/_datafiles/world/default/rooms/frostfang/61.yaml
@@ -1,5 +1,6 @@
roomid: 61
zone: Frostfang
+musicfile: music/frostfire-inn.mp3
title: Frostfire Inn
description: The Frostfire Inn stands as a beacon of warmth and respite amidst Frostfang's
icy embrace. Its sturdy timbered walls, stained a rich mahogany, rise two stories
diff --git a/internal/combat/combat.go b/internal/combat/combat.go
index c577c3d0..e2d992b2 100644
--- a/internal/combat/combat.go
+++ b/internal/combat/combat.go
@@ -42,6 +42,12 @@ func AttackPlayerVsMob(user *users.UserRecord, mob *mobs.Mob) AttackResult {
// Remember who has hit him
mob.Character.TrackPlayerDamage(user.UserId, attackResult.DamageToTarget)
+ if attackResult.Hit {
+ user.PlaySound(`sound/combat/hit-other.mp3`, `combat`)
+ } else {
+ user.PlaySound(`sound/combat/miss1.mp3`, `combat`)
+ }
+
return attackResult
}
@@ -60,6 +66,13 @@ func AttackPlayerVsPlayer(userAtk *users.UserRecord, userDef *users.UserRecord)
userDef.WimpyCheck()
}
+ if attackResult.Hit {
+ userAtk.PlaySound(`sound/combat/hit-other.mp3`, `combat`)
+ userDef.PlaySound(`sound/combat/hit-self.mp3`, `combat`)
+ } else {
+ userAtk.PlaySound(`sound/combat/miss1.mp3`, `combat`)
+ }
+
return attackResult
}
@@ -75,6 +88,10 @@ func AttackMobVsPlayer(mob *mobs.Mob, user *users.UserRecord) AttackResult {
user.WimpyCheck()
}
+ if attackResult.Hit {
+ user.PlaySound(`sound/combat/hit-self.mp3`, `combat`)
+ }
+
return attackResult
}
diff --git a/internal/events/eventtypes.go b/internal/events/eventtypes.go
index cf3a960c..314f1545 100644
--- a/internal/events/eventtypes.go
+++ b/internal/events/eventtypes.go
@@ -96,6 +96,7 @@ type MSP struct {
UserId int
SoundType string // SOUND or MUSIC
SoundFile string
+ Category string // special category/type for MSP string
}
func (m MSP) Type() string { return `MSP` }
diff --git a/internal/mobcommands/go.go b/internal/mobcommands/go.go
index 02fc60b5..2318bf66 100644
--- a/internal/mobcommands/go.go
+++ b/internal/mobcommands/go.go
@@ -138,6 +138,9 @@ func Go(rest string, mob *mobs.Mob, room *rooms.Room) (bool, error) {
destRoom.SendTextToExits(`You hear someone moving around.`, true, room.GetPlayers(rooms.FindAll)...)
+ room.PlaySound(`sound/movement/room-exit.mp3`, `movement`)
+ destRoom.PlaySound(`sound/movement/room-enter.mp3`, `movement`)
+
return true, nil
}
diff --git a/internal/rooms/rooms.go b/internal/rooms/rooms.go
index 83840175..525f1d2b 100644
--- a/internal/rooms/rooms.go
+++ b/internal/rooms/rooms.go
@@ -248,6 +248,36 @@ func (r *Room) SendText(txt string, excludeUserIds ...int) {
}
+func (r *Room) PlaySound(soundFile string, category string, excludeUserIds ...int) {
+
+ for _, userId := range r.players {
+
+ skip := false
+
+ exLen := len(excludeUserIds)
+ if exLen > 0 {
+ for _, excludeId := range excludeUserIds {
+ if excludeId == userId {
+ skip = true
+ break
+ }
+ }
+ }
+
+ if skip {
+ continue
+ }
+
+ events.AddToQueue(events.MSP{
+ UserId: userId,
+ SoundType: `SOUND`,
+ SoundFile: soundFile,
+ Category: category,
+ })
+ }
+
+}
+
func (r *Room) SendTextToExits(txt string, isQuiet bool, excludeUserIds ...int) {
testExitIds := []int{}
diff --git a/internal/scripting/actor_func.go b/internal/scripting/actor_func.go
index fb32b995..2316f93a 100644
--- a/internal/scripting/actor_func.go
+++ b/internal/scripting/actor_func.go
@@ -348,6 +348,7 @@ func (a ScriptActor) MoveRoom(destRoomId int, leaveCharmedMobs ...bool) {
rmNow := rooms.LoadRoom(a.characterRecord.RoomId)
if rmNext := rooms.LoadRoom(destRoomId); rmNext != nil {
+
rooms.MoveToRoom(a.userId, destRoomId)
if len(leaveCharmedMobs) < 1 || !leaveCharmedMobs[0] {
diff --git a/internal/usercommands/buy.go b/internal/usercommands/buy.go
index 6d651e90..bac46efa 100644
--- a/internal/usercommands/buy.go
+++ b/internal/usercommands/buy.go
@@ -332,6 +332,7 @@ func tryPurchase(request string, user *users.UserRecord, room *rooms.Room, shopM
// Give them the item
newItm := items.New(matchedShopItem.ItemId)
user.Character.StoreItem(newItm)
+ user.PlaySound(`sound/other/buy.mp3`, `other`)
iSpec := newItm.GetSpec()
if iSpec.QuestToken != `` {
diff --git a/internal/usercommands/go.go b/internal/usercommands/go.go
index 0d90556e..a01fdc4d 100644
--- a/internal/usercommands/go.go
+++ b/internal/usercommands/go.go
@@ -320,6 +320,9 @@ func Go(rest string, user *users.UserRecord, room *rooms.Room) (bool, error) {
Look(`secretly`, user, destRoom)
scripting.TryRoomScriptEvent(`onEnter`, user.UserId, destRoom.RoomId)
+
+ room.PlaySound(`sound/movement/room-exit.mp3`, `movement`, user.UserId)
+ destRoom.PlaySound(`sound/movement/room-enter.mp3`, `movement`, user.UserId)
}
}
diff --git a/internal/users/userrecord.go b/internal/users/userrecord.go
index 13248cea..41c3d61b 100644
--- a/internal/users/userrecord.go
+++ b/internal/users/userrecord.go
@@ -155,12 +155,13 @@ func (u *UserRecord) PlayMusic(musicFile string) {
}
-func (u *UserRecord) PlaySound(soundFile string) {
+func (u *UserRecord) PlaySound(soundFile string, category string) {
events.AddToQueue(events.MSP{
UserId: u.UserId,
SoundType: `SOUND`,
SoundFile: soundFile,
+ Category: category,
})
}
diff --git a/world.go b/world.go
index 70f35655..f3c409ec 100644
--- a/world.go
+++ b/world.go
@@ -1026,7 +1026,7 @@ func (w *World) MessageTick() {
}
} else {
- msg := []byte("!!SOUND(" + msp.SoundFile + ")")
+ msg := []byte("!!SOUND(" + msp.SoundFile + " T=" + msp.Category + ")")
if connections.IsWebsocket(user.ConnectionId()) {
diff --git a/world.roundtick.go b/world.roundtick.go
index 381c4402..238159b6 100644
--- a/world.roundtick.go
+++ b/world.roundtick.go
@@ -1770,6 +1770,8 @@ func (w *World) CheckForLevelUps() {
}
}
+ user.PlaySound(`sound/other/levelup.mp3`, `other`)
+
users.SaveUser(*user)
continue