main
Bel LaPointe 2024-12-15 02:26:52 -07:00
parent 62df483665
commit 2a635bc8b5
1 changed files with 12 additions and 1 deletions

View File

@ -7,6 +7,8 @@ import (
"io"
"log"
"net/http"
"slices"
"strconv"
"strings"
"time"
@ -64,7 +66,7 @@ func (s *S) serveWS(w http.ResponseWriter, r *http.Request) error {
msg := map[string]any{
"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.",
"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"
if gameState.Completed.IsZero() {
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
} else {
msg["event"] = "B"