This commit is contained in:
Bel LaPointe
2024-12-15 02:26:52 -07:00
parent 62df483665
commit 2a635bc8b5

View File

@@ -7,6 +7,8 @@ import (
"io" "io"
"log" "log"
"net/http" "net/http"
"slices"
"strconv"
"strings" "strings"
"time" "time"
@@ -64,7 +66,7 @@ func (s *S) serveWS(w http.ResponseWriter, r *http.Request) error {
msg := map[string]any{ msg := map[string]any{
"help": strings.Join([]string{ "help": strings.Join([]string{
"CARD ASSASSINS (HOLIDAY PHONE EDITION)", "CARD ASSASSINS (Mobile Ed.)",
"", "",
"1. Get any target to say any of his or her kill words.", "1. Get any target to say any of his or her kill words.",
"2. Click on the kill word a target said.", "2. Click on the kill word a target said.",
@@ -77,6 +79,15 @@ func (s *S) serveWS(w http.ResponseWriter, r *http.Request) error {
msg["page"] = "B" msg["page"] = "B"
if gameState.Completed.IsZero() { if gameState.Completed.IsZero() {
msg["event"] = "A" msg["event"] = "A"
items := []map[string]any{}
for k, v := range gameState.Players {
_, _ = k, v
}
slices.SortFunc(items, func(a, b map[string]any) int {
an, _ := strconv.Atoi(fmt.Sprint(a["title"]))
bn, _ := strconv.Atoi(fmt.Sprint(b["title"]))
return an - bn
})
return io.EOF return io.EOF
} else { } else {
msg["event"] = "B" msg["event"] = "B"