feature: Season implementation

This commit is contained in:
Matthe815
2023-07-05 19:29:39 -04:00
parent e9d151be33
commit 35f9d5ac18
3 changed files with 50 additions and 9 deletions

View File

@@ -6,6 +6,7 @@ import (
_config "erupe-ce/config"
"fmt"
"net"
"time"
"erupe-ce/common/stringsupport"
@@ -13,9 +14,6 @@ import (
"erupe-ce/server/channelserver"
)
// Server Entries
var season uint8
// Server Channels
var currentplayers uint16
@@ -36,10 +34,8 @@ func encodeServerInfo(config *_config.Config, s *Server, local bool) []byte {
}
}
sid := (4096 + serverIdx*256) + 16
err := s.db.QueryRow("SELECT season FROM servers WHERE server_id=$1", sid).Scan(&season)
if err != nil {
season = 0
}
//season := (uint8(float64((time.Now().Unix() + int64(sid)) / 1000))) % 3
season := uint8((int(float64((time.Now().Unix() * int64(sid)) / (6000 * 15)))) % 3)
if si.IP == "" {
si.IP = config.Host
}