Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 8 additions & 7 deletions _datafiles/html/public/webclient.html
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -121,7 +121,7 @@
}
.slider-container label {
color: #ccc;
width: 70px;
width: 150px;
}
.slider-container input[type="range"] {
flex: 1;
Expand Down Expand Up @@ -347,7 +347,7 @@ <h3>Volume Controls</h3>
SoundPlayer.stop();
}
} else {
SoundPlayer.play(baseMp3Url+fileName, true, (sliderValues["sounds"]/100));
SoundPlayer.play(baseMp3Url+fileName, false, (sliderValues[obj.T.toLowerCase()+" sounds"]/100));
}
}
return;
Expand Down Expand Up @@ -480,9 +480,11 @@ <h3>Volume Controls</h3>
/////////////////////////////////////////////

// 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
Expand Down Expand Up @@ -534,7 +536,6 @@ <h3>Volume Controls</h3>
iconSpan.textContent = getSpeakerIcon(val);

MusicPlayer.setGlobalVolume(sliderValues["music"]/100);
SoundPlayer.setGlobalVolume(sliderValues["sounds"]/100);
});

// Put them all together
Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
1 change: 1 addition & 0 deletions _datafiles/world/default/rooms/frostfang/432.yaml
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
1 change: 1 addition & 0 deletions _datafiles/world/default/rooms/frostfang/61.yaml
Original file line number Diff line number Diff line change
@@ -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
Expand Down
17 changes: 17 additions & 0 deletions internal/combat/combat.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand All @@ -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
}

Expand All @@ -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
}

Expand Down
1 change: 1 addition & 0 deletions internal/events/eventtypes.go
Original file line number Diff line number Diff line change
Expand Up @@ -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` }
3 changes: 3 additions & 0 deletions internal/mobcommands/go.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down
30 changes: 30 additions & 0 deletions internal/rooms/rooms.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{}
Expand Down
1 change: 1 addition & 0 deletions internal/scripting/actor_func.go
Original file line number Diff line number Diff line change
Expand Up @@ -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] {
Expand Down
1 change: 1 addition & 0 deletions internal/usercommands/buy.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 != `` {
Expand Down
3 changes: 3 additions & 0 deletions internal/usercommands/go.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}

}
Expand Down
3 changes: 2 additions & 1 deletion internal/users/userrecord.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
})

}
Expand Down
2 changes: 1 addition & 1 deletion world.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()) {

Expand Down
2 changes: 2 additions & 0 deletions world.roundtick.go
Original file line number Diff line number Diff line change
Expand Up @@ -1770,6 +1770,8 @@ func (w *World) CheckForLevelUps() {
}
}

user.PlaySound(`sound/other/levelup.mp3`, `other`)

users.SaveUser(*user)

continue
Expand Down
Loading