API: Include friend code in groups

This commit is contained in:
mkwcat
2023-12-14 13:45:09 -05:00
parent ad79cb286a
commit adaefd1cbb

View File

@@ -5,6 +5,7 @@ import (
"net/http"
"net/url"
"strconv"
"wwfc/common"
"wwfc/qr2"
)
@@ -36,6 +37,10 @@ func HandleGroups(w http.ResponseWriter, r *http.Request) {
if player["gamename"] == "mariokartwii" {
filtered["ev"] = player["ev"]
filtered["eb"] = player["eb"]
pid, err := strconv.ParseUint(player["dwc_pid"], 10, 32)
if err == nil {
filtered["fc"] = common.CalcFriendCodeString(uint32(pid), "RMCJ")
}
}
group.Players[i] = filtered