@@ -470,6 +508,7 @@ MP.socket.on("connect_error", (f) => {
});
MP.socket.on("mp_room_joined", (data) => {
+ mp_playSound("join");
MP.room = data.room;
if (
MP.room.users.filter((user) => user.socketId === MP.socket.id)[0].isLeader
@@ -512,6 +551,7 @@ MP.socket.on("mp_room_leave", () => {
});
MP.socket.on("mp_room_user_left", (data) => {
+ mp_playSound("leave");
MP.room = data.room;
if (data.newLeader !== "" && data.newLeader === MP.id) {
MP.room.isLeader = true;
@@ -529,6 +569,7 @@ MP.socket.on("mp_room_config_update", (data) => {
});
MP.socket.on("mp_chat_message", (data) => {
+ mp_playSound("chat2");
let cls = "message";
let author = "";
if (data.isSystem) {
@@ -599,10 +640,12 @@ MP.socket.on("mp_room_test_start", (data) => {
// Notifications.add("test starting",0);
updateCountdown("Go");
fadeoutCountdown();
+ mp_playSound("cd_go");
});
MP.socket.on("mp_room_test_countdown", (data) => {
updateCountdown(data.val);
+ mp_playSound("cd");
// Notifications.add(`countdown ${data.val}`,0);
});
@@ -619,6 +662,7 @@ MP.socket.on("mp_room_finishTimer_over", (data) => {
});
MP.socket.on("mp_room_test_init", (data) => {
+ mp_playSound("start");
MP.room.testStats = {};
seedrandom(data.seed, { global: true });
mp_refreshTestUserList();
@@ -640,10 +684,10 @@ MP.socket.on("mp_room_user_test_progress_update", (data) => {
$(`.tribePlayers .player[socketId=${data.socketId}] .acc`).text(
Math.floor(data.stats.acc) + "%"
);
- $(`.tribeResult table .player[socketId=${data.socketId}] .wpm`).text(
+ $(`.tribeResult table .player[socketId=${data.socketId}] .wpm .text`).text(
data.stats.wpm
);
- $(`.tribeResult table .player[socketId=${data.socketId}] .acc`).text(
+ $(`.tribeResult table .player[socketId=${data.socketId}] .acc .text`).text(
Math.floor(data.stats.acc) + "%"
);
$(`.tribePlayers .player[socketId=${data.socketId}] .bar`)
@@ -673,10 +717,10 @@ MP.socket.on("mp_room_user_test_progress_update", (data) => {
});
MP.socket.on("mp_room_user_finished", (data) => {
- $(`.tribeResult table .player[socketId=${data.socketId}] .wpm`).text(
+ $(`.tribeResult table .player[socketId=${data.socketId}] .wpm .text`).text(
data.result.wpm
);
- $(`.tribeResult table .player[socketId=${data.socketId}] .acc`).text(
+ $(`.tribeResult table .player[socketId=${data.socketId}] .acc .text`).text(
data.result.acc + "%"
);
// $(`.tribeResult table .player[socketId=${data.socketId}] .progress`).remove();
@@ -688,7 +732,7 @@ MP.socket.on("mp_room_user_finished", (data) => {
//
// |
// `);
- $(`.tribeResult table .player[socketId=${data.socketId}] .raw`).text(
+ $(`.tribeResult table .player[socketId=${data.socketId}] .raw .text`).text(
data.result.raw
);
let val = "-";
@@ -705,16 +749,16 @@ MP.socket.on("mp_room_user_finished", (data) => {
$(`.tribeResult table .player[socketId=${data.socketId}] .char`).text(
data.result.char
);
- $(`.tribeResult table .player[socketId=${data.socketId}] .con`).text(
+ $(`.tribeResult table .player[socketId=${data.socketId}] .con .text`).text(
data.result.con + "%"
);
- if (data.result.failed || data.result.invalid) {
+ if (data.result.failed || data.result.invalid || data.result.afk) {
$(`.tribePlayers .player[socketId=${data.socketId}]`).addClass("failed");
$(`.tribeResult .player[socketId=${data.socketId}]`).addClass("failed");
}
- if (config.mode !== "time" && !data.result.failed) {
+ if (config.mode !== "time" && !data.result.failed && !data.result.afk) {
$(`.tribePlayers .player[socketId=${data.socketId}] .bar`)
.stop(true, false)
.animate(
@@ -741,11 +785,15 @@ MP.socket.on("mp_room_winner", (data) => {
if (data.official) {
hideResultCountdown();
}
+ let userwon = false;
data.sorted.forEach((sid) => {
$(`.tribeResult table [socketId=${sid.sid}] .pos .num`).text(
`${pos}${Misc.getNumberSuffix(pos)}`
);
if (data.official && pos == 1) {
+ if (sid.sid === MP.socket.id) {
+ userwon = true;
+ }
$(`.tribeResult table [socketId=${sid.sid}] .crown .fa-crown`).animate(
{ opacity: 1 },
125
@@ -758,6 +806,23 @@ MP.socket.on("mp_room_winner", (data) => {
}
pos++;
});
+ if (userwon && data.official) {
+ mp_playSound("finish_win");
+ } else if (!userwon && data.official) {
+ mp_playSound("finish");
+ }
+});
+
+MP.socket.on("mp_room_miniCrowns", (data) => {
+ Object.keys(data.crowns).forEach((c) => {
+ let crown = data.crowns[c];
+ crown.sidList.forEach((sid) => {
+ $(`.tribeResult table [socketId=${sid}] .${c} .miniCrown`).animate(
+ { opacity: 0.5 },
+ 125
+ );
+ });
+ });
});
MP.socket.on("mp_room_points", (data) => {
diff --git a/src/sass/style.scss b/src/sass/style.scss
index 9fefb390a..4ed9f0e88 100644
--- a/src/sass/style.scss
+++ b/src/sass/style.scss
@@ -1593,14 +1593,24 @@ key {
.progressAndGraph {
width: 25%;
}
- .acc,
- .con,
- .other {
+ .acc .text,
+ .con .text,
+ .other .text {
opacity: 0.5;
}
.crown {
width: 1px;
}
+ .text {
+ display: inline-block;
+ }
+ .miniCrown {
+ display: inline-block;
+ width: 0;
+ font-size: 0.5rem;
+ vertical-align: super;
+ opacity: 0;
+ }
.pos {
width: 5.6rem;
.num {
diff --git a/static/sound/tribe_ui/alert.wav b/static/sound/tribe_ui/alert.wav
new file mode 100644
index 000000000..aa93c1152
Binary files /dev/null and b/static/sound/tribe_ui/alert.wav differ
diff --git a/static/sound/tribe_ui/cd.wav b/static/sound/tribe_ui/cd.wav
new file mode 100644
index 000000000..f87ee7243
Binary files /dev/null and b/static/sound/tribe_ui/cd.wav differ
diff --git a/static/sound/tribe_ui/cd_go.wav b/static/sound/tribe_ui/cd_go.wav
new file mode 100644
index 000000000..3d7cd727e
Binary files /dev/null and b/static/sound/tribe_ui/cd_go.wav differ
diff --git a/static/sound/tribe_ui/chat1.wav b/static/sound/tribe_ui/chat1.wav
new file mode 100644
index 000000000..c48c43a0d
Binary files /dev/null and b/static/sound/tribe_ui/chat1.wav differ
diff --git a/static/sound/tribe_ui/chat2.wav b/static/sound/tribe_ui/chat2.wav
new file mode 100644
index 000000000..f1ba6638f
Binary files /dev/null and b/static/sound/tribe_ui/chat2.wav differ
diff --git a/static/sound/tribe_ui/finish.wav b/static/sound/tribe_ui/finish.wav
new file mode 100644
index 000000000..cea824880
Binary files /dev/null and b/static/sound/tribe_ui/finish.wav differ
diff --git a/static/sound/tribe_ui/finish_win.wav b/static/sound/tribe_ui/finish_win.wav
new file mode 100644
index 000000000..4c9363842
Binary files /dev/null and b/static/sound/tribe_ui/finish_win.wav differ
diff --git a/static/sound/tribe_ui/join.wav b/static/sound/tribe_ui/join.wav
new file mode 100644
index 000000000..02b3052e1
Binary files /dev/null and b/static/sound/tribe_ui/join.wav differ
diff --git a/static/sound/tribe_ui/leave.wav b/static/sound/tribe_ui/leave.wav
new file mode 100644
index 000000000..69efe2910
Binary files /dev/null and b/static/sound/tribe_ui/leave.wav differ
diff --git a/static/sound/tribe_ui/start.wav b/static/sound/tribe_ui/start.wav
new file mode 100644
index 000000000..dcc0eafb3
Binary files /dev/null and b/static/sound/tribe_ui/start.wav differ
|