mirror of
https://github.com/Mezeporta/Erupe.git
synced 2026-03-22 07:32:32 +01:00
refactor: extract gametime package, replace fmt.Printf with zap logging
Move time utilities (TimeAdjusted, TimeMidnight, TimeWeekStart, TimeWeekNext, TimeGameAbsolute) from channelserver into common/gametime to break the inappropriate dependency where signserver, entranceserver, and api imported the 38K-line channelserver package just for time functions. Replace all fmt.Printf debug logging in sys_session.go and handlers_object.go with structured zap logging for consistent observability.
This commit is contained in:
@@ -5,7 +5,7 @@ import (
|
||||
ps "erupe-ce/common/pascalstring"
|
||||
"erupe-ce/common/stringsupport"
|
||||
_config "erupe-ce/config"
|
||||
"erupe-ce/server/channelserver"
|
||||
"erupe-ce/common/gametime"
|
||||
"fmt"
|
||||
"strings"
|
||||
"time"
|
||||
@@ -50,7 +50,7 @@ func (s *Session) makeSignResponse(uid uint32) []byte {
|
||||
bf.WriteUint8(uint8(len(chars)))
|
||||
bf.WriteUint32(tokenID)
|
||||
bf.WriteBytes([]byte(sessToken))
|
||||
bf.WriteUint32(uint32(channelserver.TimeAdjusted().Unix()))
|
||||
bf.WriteUint32(uint32(gametime.Adjusted().Unix()))
|
||||
if s.client == PS3 {
|
||||
ps.Uint8(bf, fmt.Sprintf("%s/ps3", s.server.erupeConfig.PatchServerManifest), false)
|
||||
ps.Uint8(bf, fmt.Sprintf("%s/ps3", s.server.erupeConfig.PatchServerFile), false)
|
||||
@@ -334,7 +334,7 @@ func (s *Session) makeSignResponse(uid uint32) []byte {
|
||||
|
||||
if s.client == VITA || s.client == PS3 || s.client == PS4 {
|
||||
var psnUser string
|
||||
s.server.db.QueryRow("SELECT psn_id FROM users WHERE id = $1", uid).Scan(&psnUser)
|
||||
_ = s.server.db.QueryRow("SELECT psn_id FROM users WHERE id = $1", uid).Scan(&psnUser)
|
||||
bf.WriteBytes(stringsupport.PaddedString(psnUser, 20, true))
|
||||
}
|
||||
|
||||
@@ -385,11 +385,11 @@ func (s *Session) makeSignResponse(uid uint32) []byte {
|
||||
}
|
||||
|
||||
// We can just use the start timestamp as the event ID
|
||||
bf.WriteUint32(uint32(channelserver.TimeWeekStart().Unix()))
|
||||
bf.WriteUint32(uint32(gametime.WeekStart().Unix()))
|
||||
// Start time
|
||||
bf.WriteUint32(uint32(channelserver.TimeWeekNext().Add(-time.Duration(s.server.erupeConfig.GameplayOptions.MezFesDuration) * time.Second).Unix()))
|
||||
bf.WriteUint32(uint32(gametime.WeekNext().Add(-time.Duration(s.server.erupeConfig.GameplayOptions.MezFesDuration) * time.Second).Unix()))
|
||||
// End time
|
||||
bf.WriteUint32(uint32(channelserver.TimeWeekNext().Unix()))
|
||||
bf.WriteUint32(uint32(gametime.WeekNext().Unix()))
|
||||
bf.WriteUint8(uint8(len(tickets)))
|
||||
for i := range tickets {
|
||||
bf.WriteUint32(tickets[i])
|
||||
|
||||
Reference in New Issue
Block a user